From aaa34ce200fbf11c7015269bc1f9c9f8110cb1d5 Mon Sep 17 00:00:00 2001 From: max-morrow Date: Mon, 3 Jun 2024 14:30:31 +0300 Subject: [PATCH 001/149] 1inch: project orders macro & scaling project swaps macro (#5895) * developed project orders macro * added block_month to project orders macro * optimize mapped to macros * fix + rm exchange contract * prod exclude * fix cast * try * try users * try with mapped matview * rm temp * try result amount usd * try amounts * fix * Revert "rm temp" This reverts commit 1e5f38bb257c60b9820d3c63df312b081ee314a9. * try all * change folder name * fix unique key * fixed the duplication in project orders macro * rm event_data from key * Update oneinch_project_orders_macro.sql * Update oneinch_project_orders_macro.sql * change to 2024-01-01 * updates * project orders updated * added contracts to mapped contracts * huge upgrade of project_orders_macro + fix project_swaps_macro + updated mapped_contracts * updated mapped_contracts * easy date wo error * easy date to project orderas * easy date to project orderas * typing issue * Revert "typing issue" This reverts commit 57b1ff131336fd7948bc0486f7c11aeabb4a5705. * fix typing * fix * fix * fix * updated mapped_contracts * try fix * try fix * try fix * fix * fix counter * fix * fix * try fix order keys * fix * fix * fix * bring back dates --------- Co-authored-by: grkhr Co-authored-by: Eduard Gorkh <40689054+grkhr@users.noreply.github.com> --- .../{ => _meta}/oneinch_blockchain_macro.sql | 0 .../oneinch_exposed_blockchains_list.sql | 0 .../_meta/oneinch_mapped_contracts_macro.sql | 412 +++++++++ .../oneinch/_meta/oneinch_mapped_methods.sql | 120 +++ .../oneinch/oneinch_project_orders_macro.sql | 869 ++++++++++++++++++ .../oneinch/oneinch_project_swaps_macro.sql | 101 +- .../_meta/oneinch_exchange_contracts.sql | 185 ---- .../_meta/oneinch_mapped_contracts.sql | 374 +------- .../oneinch/_meta/oneinch_mapped_methods.sql | 121 +-- .../oneinch_arbitrum_mapped_contracts.sql | 17 + .../_meta/oneinch_arbitrum_mapped_methods.sql | 17 + .../oneinch_arbitrum_project_orders.sql | 23 + .../oneinch_avalanche_c_mapped_contracts.sql | 17 + .../oneinch_avalanche_c_mapped_methods.sql | 17 + .../oneinch_avalanche_c_project_orders.sql | 23 + .../_meta/oneinch_base_mapped_contracts.sql | 17 + .../_meta/oneinch_base_mapped_methods.sql | 17 + .../base/oneinch_base_project_orders.sql | 23 + .../_meta/oneinch_bnb_mapped_contracts.sql | 17 + .../bnb/_meta/oneinch_bnb_mapped_methods.sql | 17 + .../bnb/oneinch_bnb_project_orders.sql | 23 + .../oneinch_ethereum_mapped_contracts.sql | 17 + .../_meta/oneinch_ethereum_mapped_methods.sql | 17 + .../oneinch_ethereum_project_orders.sql | 23 + .../_meta/oneinch_fantom_mapped_contracts.sql | 17 + .../_meta/oneinch_fantom_mapped_methods.sql | 17 + .../fantom/oneinch_fantom_project_orders.sql | 23 + .../_meta/oneinch_gnosis_mapped_contracts.sql | 17 + .../_meta/oneinch_gnosis_mapped_methods.sql | 17 + .../gnosis/oneinch_gnosis_project_orders.sql | 23 + models/oneinch/oneinch_project_orders.sql | 140 +++ models/oneinch/oneinch_project_swaps.sql | 15 + models/oneinch/oneinch_schema.yml | 30 - .../oneinch_optimism_mapped_contracts.sql | 17 + .../_meta/oneinch_optimism_mapped_methods.sql | 17 + .../oneinch_optimism_project_orders.sql | 23 + .../oneinch_polygon_mapped_contracts.sql | 17 + .../_meta/oneinch_polygon_mapped_methods.sql | 17 + .../oneinch_polygon_project_orders.sql | 23 + .../_meta/oneinch_zksync_mapped_contracts.sql | 17 + .../_meta/oneinch_zksync_mapped_methods.sql | 17 + .../zksync/oneinch_zksync_project_orders.sql | 23 + 42 files changed, 2190 insertions(+), 747 deletions(-) rename macros/models/_project/oneinch/{ => _meta}/oneinch_blockchain_macro.sql (100%) rename macros/models/_project/oneinch/{ => _meta}/oneinch_exposed_blockchains_list.sql (100%) create mode 100644 macros/models/_project/oneinch/_meta/oneinch_mapped_contracts_macro.sql create mode 100644 macros/models/_project/oneinch/_meta/oneinch_mapped_methods.sql create mode 100644 macros/models/_project/oneinch/oneinch_project_orders_macro.sql delete mode 100644 models/oneinch/_meta/oneinch_exchange_contracts.sql create mode 100644 models/oneinch/arbitrum/_meta/oneinch_arbitrum_mapped_contracts.sql create mode 100644 models/oneinch/arbitrum/_meta/oneinch_arbitrum_mapped_methods.sql create mode 100644 models/oneinch/arbitrum/oneinch_arbitrum_project_orders.sql create mode 100644 models/oneinch/avalanche_c/_meta/oneinch_avalanche_c_mapped_contracts.sql create mode 100644 models/oneinch/avalanche_c/_meta/oneinch_avalanche_c_mapped_methods.sql create mode 100644 models/oneinch/avalanche_c/oneinch_avalanche_c_project_orders.sql create mode 100644 models/oneinch/base/_meta/oneinch_base_mapped_contracts.sql create mode 100644 models/oneinch/base/_meta/oneinch_base_mapped_methods.sql create mode 100644 models/oneinch/base/oneinch_base_project_orders.sql create mode 100644 models/oneinch/bnb/_meta/oneinch_bnb_mapped_contracts.sql create mode 100644 models/oneinch/bnb/_meta/oneinch_bnb_mapped_methods.sql create mode 100644 models/oneinch/bnb/oneinch_bnb_project_orders.sql create mode 100644 models/oneinch/ethereum/_meta/oneinch_ethereum_mapped_contracts.sql create mode 100644 models/oneinch/ethereum/_meta/oneinch_ethereum_mapped_methods.sql create mode 100644 models/oneinch/ethereum/oneinch_ethereum_project_orders.sql create mode 100644 models/oneinch/fantom/_meta/oneinch_fantom_mapped_contracts.sql create mode 100644 models/oneinch/fantom/_meta/oneinch_fantom_mapped_methods.sql create mode 100644 models/oneinch/fantom/oneinch_fantom_project_orders.sql create mode 100644 models/oneinch/gnosis/_meta/oneinch_gnosis_mapped_contracts.sql create mode 100644 models/oneinch/gnosis/_meta/oneinch_gnosis_mapped_methods.sql create mode 100644 models/oneinch/gnosis/oneinch_gnosis_project_orders.sql create mode 100644 models/oneinch/oneinch_project_orders.sql create mode 100644 models/oneinch/oneinch_project_swaps.sql create mode 100644 models/oneinch/optimism/_meta/oneinch_optimism_mapped_contracts.sql create mode 100644 models/oneinch/optimism/_meta/oneinch_optimism_mapped_methods.sql create mode 100644 models/oneinch/optimism/oneinch_optimism_project_orders.sql create mode 100644 models/oneinch/polygon/_meta/oneinch_polygon_mapped_contracts.sql create mode 100644 models/oneinch/polygon/_meta/oneinch_polygon_mapped_methods.sql create mode 100644 models/oneinch/polygon/oneinch_polygon_project_orders.sql create mode 100644 models/oneinch/zksync/_meta/oneinch_zksync_mapped_contracts.sql create mode 100644 models/oneinch/zksync/_meta/oneinch_zksync_mapped_methods.sql create mode 100644 models/oneinch/zksync/oneinch_zksync_project_orders.sql diff --git a/macros/models/_project/oneinch/oneinch_blockchain_macro.sql b/macros/models/_project/oneinch/_meta/oneinch_blockchain_macro.sql similarity index 100% rename from macros/models/_project/oneinch/oneinch_blockchain_macro.sql rename to macros/models/_project/oneinch/_meta/oneinch_blockchain_macro.sql diff --git a/macros/models/_project/oneinch/oneinch_exposed_blockchains_list.sql b/macros/models/_project/oneinch/_meta/oneinch_exposed_blockchains_list.sql similarity index 100% rename from macros/models/_project/oneinch/oneinch_exposed_blockchains_list.sql rename to macros/models/_project/oneinch/_meta/oneinch_exposed_blockchains_list.sql diff --git a/macros/models/_project/oneinch/_meta/oneinch_mapped_contracts_macro.sql b/macros/models/_project/oneinch/_meta/oneinch_mapped_contracts_macro.sql new file mode 100644 index 00000000000..7af3f895b43 --- /dev/null +++ b/macros/models/_project/oneinch/_meta/oneinch_mapped_contracts_macro.sql @@ -0,0 +1,412 @@ +-- this macro helps to optimize the etl in case of adding new contract to a certain chain so it triggers pipeline only for this chain +{% macro oneinch_mapped_contracts_macro(blockchain) %} + + + +{% set + config = [ + ('0xc586bef4a0992c495cf22e1aeee4e446cecdee0e', 'true', '1inch' , 'OneSplit' , ['ethereum']) + , ('0xe4c577bdec9ce0f6c54f2f82aed5b1913b71ae2f', 'true', '1inch' , 'ExchangeV1' , ['ethereum']) + , ('0x0000000006adbd7c01bc0738cdbfc3932600ad63', 'true', '1inch' , 'ExchangeV2' , ['ethereum']) + , ('0x0000000053d411becdb4a82d8603edc6d8b8b3bc', 'true', '1inch' , 'ExchangeV3' , ['ethereum']) + , ('0x000005edbbc1f258302add96b5e20d3442e5dd89', 'true', '1inch' , 'ExchangeV4' , ['ethereum']) + , ('0x0000000f8ef4be2b7aed6724e893c1b674b9682d', 'true', '1inch' , 'ExchangeV5' , ['ethereum']) + , ('0x111112549cfedf7822eb11fbd8fd485d8a10f93f', 'true', '1inch' , 'ExchangeV6' , ['ethereum']) + , ('0x111111254b08ceeee8ad6ca827de9952d2a46781', 'true', '1inch' , 'ExchangeV7' , ['ethereum']) + , ('0x3ef51736315f52d568d6d2cf289419b9cfffe782', 'true', '1inch' , 'LimitOrderProtocolV1' , ['ethereum']) + , ('0xe3456f4ee65e745a44ec3bcb83d0f2529d1b84eb', 'true', '1inch' , 'LimitOrderProtocolV1' , ['bnb']) + , ('0xb707d89d29c189421163515c59e42147371d6857', 'true', '1inch' , 'LimitOrderProtocolV1' , ['polygon','optimism']) + , ('0xe295ad71242373c37c5fda7b57f26f9ea1088afe', 'true', '1inch' , 'LimitOrderProtocolV1' , ['arbitrum']) + , ('0x119c71d3bbac22029622cbaec24854d3d32d2828', 'true', '1inch' , 'LimitOrderProtocolV2' , ['ethereum']) + , ('0x1e38eff998df9d3669e32f4ff400031385bf6362', 'true', '1inch' , 'LimitOrderProtocolV2' , ['bnb']) + , ('0x94bc2a1c732bcad7343b25af48385fe76e08734f', 'true', '1inch' , 'LimitOrderProtocolV2' , ['polygon']) + , ('0x54431918cec22932fcf97e54769f4e00f646690f', 'true', '1inch' , 'LimitOrderProtocolV2' , ['gnosis']) + , ('0x7f069df72b7a39bce9806e3afaf579e54d8cf2b9', 'true', '1inch' , 'LimitOrderProtocolV2' , ['arbitrum']) + , ('0x0f85a912448279111694f4ba4f85dc641c54b594', 'true', '1inch' , 'LimitOrderProtocolV2' , ['avalanche_c']) + , ('0x11431a89893025d2a48dca4eddc396f8c8117187', 'true', '1inch' , 'LimitOrderProtocolV2' , ['optimism']) + , ('0x11dee30e710b8d4a8630392781cc3c0046365d4c', 'true', '1inch' , 'LimitOrderProtocolV2' , ['fantom']) + , ('0x11111254369792b2ca5d084ab5eea397ca8fa48b', 'true', '1inch' , 'AggregationRouterV1' , ['ethereum']) + , ('0x111111125434b319222cdbf8c261674adb56f3ae', 'true', '1inch' , 'AggregationRouterV2' , ['ethereum']) + , ('0x111111254bf8547e7183e4bbfc36199f3cedf4a1', 'true', '1inch' , 'AggregationRouterV2' , ['bnb']) + , ('0x11111112542d85b3ef69ae05771c2dccff4faa26', 'true', '1inch' , 'AggregationRouterV3' , ['ethereum','bnb','polygon','arbitrum','optimism']) + , ('0x1111111254fb6c44bac0bed2854e76f90643097d', 'true', '1inch' , 'AggregationRouterV4' , ['ethereum','bnb','polygon','arbitrum','avalanche_c','gnosis','fantom']) + , ('0x1111111254760f7ab3f16433eea9304126dcd199', 'true', '1inch' , 'AggregationRouterV4' , ['optimism']) + , ('0x1111111254eeb25477b68fb85ed929f73a960582', 'true', '1inch' , 'AggregationRouterV5' , ['ethereum','bnb','polygon','arbitrum','avalanche_c','gnosis','optimism','fantom','base']) + , ('0x6e2b76966cbd9cf4cc2fa0d76d24d5241e0abc2f', 'true', '1inch' , 'AggregationRouterV5' , ['zksync']) + , ('0x111111125421ca6dc452d289314280a0f8842a65', 'true', '1inch' , 'AggregationRouterV6' , ['ethereum','bnb','polygon','arbitrum','avalanche_c','gnosis','optimism','fantom','base']) + , ('0x6fd4383cb451173d5f9304f041c7bcbf27d561ff', 'true', '1inch' , 'AggregationRouterV6' , ['zksync']) + , ('0xa88800cd213da5ae406ce248380802bd53b47647', 'true', '1inch' , 'SettlementV1' , ['ethereum']) + , ('0x1d0ae300eec4093cee4367c00b228d10a5c7ac63', 'true', '1inch' , 'SettlementV1' , ['bnb']) + , ('0x1e8ae092651e7b14e4d0f93611267c5be19b8b9f', 'true', '1inch' , 'SettlementV1' , ['polygon']) + , ('0x4bc3e539aaa5b18a82f6cd88dc9ab0e113c63377', 'true', '1inch' , 'SettlementV1' , ['arbitrum']) + , ('0xd89adc20c400b6c45086a7f6ab2dca19745b89c2', 'true', '1inch' , 'SettlementV1' , ['optimism']) + , ('0x7731f8df999a9441ae10519617c24568dc82f697', 'true', '1inch' , 'SettlementV1' , ['avalanche_c']) + , ('0xcbdb7490968d4dbf183c60fc899c2e9fbd445308', 'true', '1inch' , 'SettlementV1' , ['gnosis']) + , ('0xa218543cc21ee9388fa1e509f950fd127ca82155', 'true', '1inch' , 'SettlementV1' , ['fantom']) + , ('0x7f069df72b7a39bce9806e3afaf579e54d8cf2b9', 'true', '1inch' , 'SettlementV1' , ['base']) + , ('0x11de482747d1b39e599f120d526af512dd1a9326', 'true', '1inch' , 'SettlementV1' , ['zksync']) + , ('0x0cae51e1032e8461f4806e26332c030e34de3adb', 'true', 'AnySwap' , 'AnyswapV3Router' , ['arbitrum']) + , ('0x7782046601e7b9b05ca55a3899780ce6ee6b8b2b', 'true', 'AnySwap' , 'AnyswapV6Router' , ['ethereum']) + , ('0xb0731d50c681c45856bfc3f7539d5f61d4be81d8', 'true', 'AnySwap' , 'UNDEFINED' , ['avalanche_c']) + , ('0xe1d592c3322f1f714ca11f05b6bc0efef1907859', 'true', 'AnySwap' , 'AnyswapV6Router' , ['bnb']) + , ('0xf9736ec3926703e85c843fc972bd89a7f8e827c0', 'true', 'AnySwap' , 'AnyswapV3Router' , ['bnb']) + , ('0xc0788a3ad43d79aa53b09c2eacc313a787d1d607', 'true', 'ApeSwap' , 'ApeRouter' , ['polygon']) + , ('0xcf0febd3f17cef5b47b0cd257acf6025c5bff3b7', 'true', 'ApeSwap' , 'UNDEFINED' , ['bnb']) + , ('0x6947a425453d04305520e612f0cb2952e4d07d62', 'true', 'Arbswap' , 'ArbswapSmartRouter' , ['arbitrum']) + , ('0x8317c460c22a9958c27b4b6403b98d2ef4e2ad32', 'true', 'BabySwap' , 'UNDEFINED' , ['bnb']) + , ('0xba12222222228d8ba445958a75a0704d566bf2c8', 'true', 'Balancer' , 'Vault' , ['ethereum','bnb','polygon','arbitrum','avalanche_c','gnosis','optimism','base']) + , ('0x6093aebac87d62b1a5a4ceec91204e35020e38be', 'true', 'Baoswap' , 'UniswapV2Router02' , ['gnosis']) + , ('0xbbbbbBB520d69a9775E85b458C58c648259FAD5F', 'true', 'Bebop' , 'BebopSettlement' , ['ethereum']) + , ('0xf4D3269fACF1FfD633195715e5d1357f0d4489d5', 'true', 'Bebop' , 'BebopSettlement' , ['base']) + , ('0x3a6d8ca21d1cf76f653a67577fa0d27453350dd8', 'true', 'BiSwap' , 'UNDEFINED' , ['bnb']) + , ('0x6f5ac65ca70f2a44d73c8f711cb2bdf425d9f304', 'true', 'BitKeep' , 'UNDEFINED' , ['bnb']) + , ('0xf5bfcbda96de6a55a3a80af5175a1cbb088d5338', 'true', 'BitKeep' , 'UNDEFINED' , ['polygon']) + , ('0xf6463845b0b9d9d33d8e2bcb6c628bc5cb1ad133', 'true', 'BitKeep' , 'UNDEFINED' , ['polygon']) + , ('0xb099ed146fad4d0daa31e3810591fc0554af62bb', 'true', 'BoggedFinance' , 'BogSwap' , ['bnb','avalanche_c','fantom']) + , ('0xc873fecbd354f5a56e00e710b90ef4201db2448d', 'true', 'Camelot' , 'CamelotRouter' , ['arbitrum']) + , ('0x1f721e2e82f6676fce4ea07a5958cf098d339e18', 'true', 'Camelot' , 'SwapRouter' , ['arbitrum']) + , ('0xbf1fc29668e5f5eaa819948599c9ac1b1e03e75f', 'true', 'Cone' , 'ConeRouter01' , ['bnb']) + , ('0x11984dc4465481512eb5b777e44061c158cf2259', 'true', 'Connext' , 'ConnextDiamond' , ['polygon']) + , ('0xee9dec2712cce65174b561151701bf54b99c24c8', 'true', 'Connext' , 'ConnextDiamond' , ['arbitrum']) + , ('0x9008d19f58aabd9ed0d60971565aa8510560ab41', 'true', 'CoWSwap' , 'GPv2Settlement' , ['ethereum','gnosis']) + , ('0x99a58482bd75cbab83b27ec03ca68ff489b5788f', 'true', 'Curvefi' , 'SwapRouter' , ['ethereum']) + , ('0xbebc44782c7db0a1a60cb6fe97d0b483032ff1c7', 'true', 'Curvefi' , 'ThreepoolSwap' , ['ethereum']) + , ('0xdc24316b9ae028f1497c275eb9192a3ea0f67022', 'true', 'Curvefi' , 'StETHSwap' , ['ethereum']) + , ('0x1d8b86e3d88cdb2d34688e87e72f388cb541b7c8', 'true', 'Curvefi' , 'VyperContract' , ['polygon']) + , ('0x43b4fdfd4ff969587185cdb6f0bd875c5fc83f8c', 'true', 'Curvefi' , 'Vyper' , ['ethereum']) + , ('0x0656fd85364d03b103ceeda192fb2d3906a6ac15', 'true', 'DODO' , 'DODOFeeRouteProxy' , ['bnb']) + , ('0x2fa4334cfd7c56a0e7ca02bd81455205fcbdc5e9', 'true', 'DODO' , 'DODORouteProxy' , ['polygon']) + , ('0x39e3e49c99834c9573c9fc7ff5a4b226cd7b0e63', 'true', 'DODO' , 'DODOFeeRouteProxy' , ['polygon']) + , ('0x3b6067d4caa8a14c63fdbe6318f27a0bbc9f9237', 'true', 'DODO' , 'DODORouteProxy' , ['arbitrum']) + , ('0x6b3d817814eabc984d51896b1015c0b89e9737ca', 'true', 'DODO' , 'DODORouteProxy' , ['bnb']) + , ('0xa222e6a71d1a1dd5f279805fbe38d5329c1d0e70', 'true', 'DODO' , 'DODOV2Proxy02' , ['polygon']) + , ('0xa2398842f37465f89540430bdc00219fa9e4d28a', 'true', 'DODO' , 'DODORouteProxy' , ['ethereum']) + , ('0xa8b034301bb5dd3610db585def3e7c0d52f2319f', 'true', 'DODO' , 'DODOFeeRouteProxy' , ['bnb']) + , ('0xe05dd51e4eb5636f4f0e8e7fbe82ea31a2ecef16', 'true', 'DODO' , 'DODOFeeRouteProxy' , ['arbitrum']) + , ('0x9d0950c595786aba7c26dfddf270d66a8b18b4fa', 'true', 'DfxFinance' , 'Router' , ['ethereum']) + , ('0xa102072a4c07f06ec3b4900fdc4c7b80b6c57429', 'true', 'Dfyn' , 'UniswapV2Router02' , ['polygon']) + , ('0x3af3cc4930ef88f4afe0b695ac95c230e1a108ec', 'true', 'Dzap' , 'DZapAggregator' , ['polygon']) + , ('0x0c6134abc08a1eafc3e2dc9a5ad023bb08da86c3', 'true', 'Firebird' , 'FireBirdRouter' , ['optimism']) + , ('0x92e4f29be975c1b1eb72e77de24dccf11432a5bd', 'true', 'Firebird' , 'FireBirdRouter' , ['bnb']) + , ('0xb31d1b1ea48ce4bf10ed697d44b747287e785ad4', 'true', 'Firebird' , 'FireBirdRouter' , ['polygon']) + , ('0xe0c38b2a8d09aad53f1c67734b9a95e43d5981c0', 'true', 'Firebird' , 'Firebird' , ['fantom']) + , ('0x9bc2152fd37b196c0ff3c16f5533767c9a983971', 'true', 'Fraxswap' , 'FraxswapRouter' , ['polygon']) + , ('0x1b6c9c20693afde803b27f8782156c0f892abc2d', 'true', 'FstSwap' , 'FstswapRouter02' , ['bnb']) + , ('0xb3ca4d73b1e0ea2c53b42173388cc01e1c226f40', 'true', 'FstSwap' , 'UNDEFINED' , ['bnb']) + , ('0x3d6ba331e3d9702c5e8a8d254e5d8a285f223aba', 'true', 'GMX' , 'PositionRouter' , ['arbitrum']) + , ('0x5f719c2f1095f7b9fc68a68e35b51194f4b6abe8', 'true', 'GMX' , 'Router' , ['avalanche_c']) + , ('0xa27c20a7cf0e1c68c0460706bb674f98f362bc21', 'true', 'GMX' , 'OrderBookReader' , ['arbitrum']) + , ('0xabbc5f99639c9b6bcb58544ddf04efa6802f4064', 'true', 'GMX' , 'Router' , ['arbitrum']) + , ('0x83c8f28c26bf6aaca652df1dbbe0e1b56f8baba2', 'true', 'GemSwap' , 'GemSwap' , ['ethereum']) + , ('0x1c232f01118cb8b424793ae03f870aa7d0ac7f77', 'true', 'HoneySwap' , 'UniswapV2Router02' , ['gnosis']) + , ('0xbd3bd95529e0784ad973fd14928eedf3678cfad8', 'true', 'Izumi' , 'Swap0' , ['bnb']) + , ('0xedf2021f41abcfe2dea4427e1b61f4d0aa5aa4b8', 'true', 'Izumi' , 'Swap' , ['bnb']) + , ('0x01fdea353849ca29f778b2663bcaca1d191bed0e', 'true', 'Izumi' , 'Swap' , ['arbitrum']) + , ('0x032b241de86a8660f1ae0691a4760b426ea246d7', 'true', 'Izumi' , 'Swap' , ['polygon']) + , ('0x943ac2310d9bc703d6ab5e5e76876e212100f894', 'true', 'Izumi' , 'Swap' , ['zksync']) + , ('0x02f55d53dce23b4aa962cc68b0f685f26143bdb2', 'true', 'Izumi' , 'Swap' , ['base']) + , ('0x2db0afd0045f3518c77ec6591a542e326befd3d7', 'true', 'Izumi' , 'Swap' , ['scroll']) + , ('0x8b791913eb07c32779a16750e3868aa8495f5964', 'true', 'KoiFinance' , 'Router' , ['zksync']) + , ('0x00555513acf282b42882420e5e5ba87b44d8fa6e', 'true', 'Kyber' , 'AggregationRouterV3' , ['fantom']) + , ('0x1fc3607fa67b58deddb0faf7a116f417a20c551c', 'true', 'Kyber' , 'AggregationRouter' , ['fantom']) + , ('0x546c79662e028b661dfb4767664d0273184e4dd1', 'true', 'Kyber' , 'AggregationRouter' , ['polygon']) + , ('0x617dee16b86534a5d792a4d7a62fb491b544111e', 'true', 'Kyber' , 'MetaAggregationRouterV1' , ['ethereum','polygon','fantom']) + , ('0x6131b5fae19ea4f9d964eac0408e4408b66337b5', 'true', 'Kyber' , 'MetaAggregationRouterV2' , ['ethereum','bnb','polygon','arbitrum','avalanche_c','fantom']) + , ('0x6131b5fae19ea4f9d964eac0408e4408b66337b5', 'true', 'Kyber' , 'MetaAggregationRouterV2' , ['optimism']) + , ('0xdf1a1b60f2d438842916c0adc43748768353ec25', 'true', 'Kyber' , 'AggregationRouterV2' , ['polygon','fantom']) + , ('0xb18d4f69627f8320619a696202ad2c430cef7c53', 'true', 'LevinSwap' , 'UniswapV2Router02' , ['gnosis']) + , ('0x1231deb6f5749ef6ce6943a275a1d3e7486f4eae', 'true', 'LiFi' , 'DiamondV2' , ['ethereum','bnb','polygon','arbitrum','avalanche_c','gnosis','optimism','fantom']) + , ('0x62c1a0d92b09d0912f7bb9c96c5ecdc7f2b87059', 'true', 'Mdex' , 'MdexRouter' , ['bnb']) + , ('0x7dae51bd3e3376b8c7c4900e9107f12be3af1ba8', 'true', 'Mdex' , 'MdexRouter' , ['bnb']) + , ('0xbbf1ee38152e9d8e3470dc47947eaa65dca94913', 'true', 'Maverick' , 'Router' , ['ethereum']) + , ('0x39e098a153ad69834a9dac32f0fca92066ad03f4', 'true', 'Maverick' , 'Router' , ['zksync']) + , ('0xd53a9f3fae2bd46d35e9a30ba58112a585542869', 'true', 'Maverick' , 'Router' , ['bnb']) + , ('0x32aed3bce901da12ca8489788f3a99fce1056e14', 'true', 'Maverick' , 'Router' , ['base']) + , ('0x10f4a785f458bc144e3706575924889954946639', 'true', 'Meshswap' , 'Router' , ['polygon']) + , ('0x881d40237659c251811cec9c364ef91dc08d300c', 'true', 'MetaMask' , 'MetaSwap' , ['ethereum']) + , ('0x1a1ec25dc08e98e5e93f1104b5e5cdd298707d31', 'true', 'MetaMask' , 'MetaSwap' , ['bnb','polygon','avalanche_c']) + , ('0x9dda6ef3d919c9bc8885d5560999a3640431e8e6', 'true', 'MetaMask' , 'MetaSwap' , ['arbitrum','optimism']) + , ('0x3c11f6265ddec22f4d049dde480615735f451646', 'true', 'Mimic' , 'Swapper' , ['ethereum']) + , ('0xd654953d746f0b114d1f85332dc43446ac79413d', 'true', 'NomiSwap' , 'UNDEFINED' , ['bnb']) + , ('0x76f4eed9fe41262669d0250b2a97db79712ad855', 'true', 'Odos' , 'OdosRouter' , ['ethereum']) + , ('0x9f138be5aa5cc442ea7cc7d18cd9e30593ed90b9', 'true', 'Odos' , 'OdosRouter' , ['bnb']) + , ('0x69dd38645f7457be13571a847ffd905f9acbaf6d', 'true', 'Odos' , 'OdosRouter' , ['optimism']) + , ('0xa269031037b4d5fa3f771c401d19e57def6cb491', 'true', 'Odos' , 'OdosRouter' , ['zksync']) + , ('0x061dc8e41c05207bedd6242ea4b342ef294be359', 'true', 'Odos' , 'OdosRouter' , ['fantom']) + , ('0xa32ee1c40594249eb3183c10792bcf573d4da47c', 'true', 'Odos' , 'OdosRouter' , ['polygon']) + , ('0xdd94018f54e565dbfc939f7c44a16e163faab331', 'true', 'Odos' , 'OdosRouter' , ['arbitrum']) + , ('0xfe7ce93ac0f78826cd81d506b07fe9f459c00214', 'true', 'Odos' , 'OdosRouter' , ['avalanche_c']) + , ('0xcf5540fffcdc3d510b18bfca6d2b9987b0772559', 'true', 'Odos' , 'OdosRouterV2' , ['ethereum']) + , ('0x89b8aa89fdd0507a99d334cbe3c808fafc7d850e', 'true', 'Odos' , 'OdosRouterV2' , ['bnb']) + , ('0x4e3288c9ca110bcc82bf38f09a7b425c095d92bf', 'true', 'Odos' , 'OdosRouterV2' , ['polygon']) + , ('0xa669e7a0d4b3e4fa48af2de86bd4cd7126be4e13', 'true', 'Odos' , 'OdosRouterV2' , ['arbitrum']) + , ('0xca423977156bb05b13a2ba3b76bc5419e2fe9680', 'true', 'Odos' , 'OdosRouterV2' , ['optimism']) + , ('0x19ceead7105607cd444f5ad10dd51356436095a1', 'true', 'Odos' , 'OdosRouterV2' , ['base']) + , ('0x88de50b233052e4fb783d4f6db78cc34fea3e9fc', 'true', 'Odos' , 'OdosRouterV2' , ['avalanche_c']) + , ('0xd0c22a5435f4e8e5770c1fafb5374015fc12f7cd', 'true', 'Odos' , 'OdosRouterV2' , ['fantom']) + , ('0x4bba932e9792a2b917d47830c93a9bc79320e4f7', 'true', 'Odos' , 'OdosRouterV2' , ['zksync']) + , ('0x3b3ae790df4f312e745d270119c6052904fb6790', 'true', 'OKXDEX' , 'DEX' , ['ethereum']) + , ('0x6352a56caadc4f1e25cd6c75970fa768a3304e64', 'true', 'OpenOcean' , 'ExchangeV2' , ['ethereum','bnb','polygon','avalanche_c','optimism','fantom']) + , ('0x05ff2b0db69458a0750badebc4f9e13add608c7f', 'true', 'PancakeSwap' , 'PancakeRouter' , ['bnb']) + , ('0x10ed43c718714eb63d5aa57b78b54704e256024e', 'true', 'PancakeSwap' , 'PancakeswapV2' , ['bnb']) + , ('0x5aeaf2883fbf30f3d62471154eda3c0c1b05942d', 'true', 'PancakeSwap' , 'PancakeswapV2' , ['zksync']) + , ('0x13f4ea83d0bd40e75c8222255bc855a974568dd4', 'true', 'PancakeSwap' , 'SmartRouter' , ['ethereum','bnb']) + , ('0x2f22e47ca7c5e07f77785f616ceee80c5e84127c', 'true', 'PancakeSwap' , 'SwapSmartRouter' , ['bnb']) + , ('0x32226588378236fd0c7c4053999f88ac0e5cac77', 'true', 'PancakeSwap' , 'SmartRouter' , ['arbitrum']) + , ('0xf8b59f3c3ab33200ec80a8a58b2aa5f5d2a8944c', 'true', 'PancakeSwap' , 'SmartRouter' , ['zksync']) + , ('0xd4c4a7c55c9f7b3c48bafb6e8643ba79f42418df', 'true', 'PancakeSwap' , 'ZapV1' , ['bnb']) + , ('0xe54ca86531e17ef3616d22ca28b0d458b6c89106', 'true', 'PangolinExchange' , 'Router' , ['avalanche_c']) + , ('0x6b158039b9678b7452f311deb12dd08c579dad26', 'true', 'Paraswap' , 'AugustusSwapperV0v1' , ['ethereum']) + , ('0x72338b82800400f5488eca2b5a37270ba3b7a111', 'true', 'Paraswap' , 'AugustusSwapper' , ['ethereum']) + , ('0x59c7c832e96d2568bea6db468c1aadcbbda08a52', 'true', 'Paraswap' , 'AugustusSwapper' , ['base']) + , ('0xf92c1ad75005e6436b4ee84e88cb23ed8a290988', 'true', 'Paraswap' , 'AugustusSwapperV1' , ['ethereum']) + , ('0x86969d29f5fd327e1009ba66072be22db6017cc6', 'true', 'Paraswap' , 'AugustusSwapperV2' , ['ethereum']) + , ('0x9509665d015bfe3c77aa5ad6ca20c8afa1d98989', 'true', 'Paraswap' , 'AugustusSwapperV3' , ['ethereum']) + , ('0xf90e98f3d8dce44632e5020abf2e122e0f99dfab', 'true', 'Paraswap' , 'AugustusSwapperV4' , ['ethereum']) + , ('0x1bd435f3c054b6e901b7b108a0ab7617c808677b', 'true', 'Paraswap' , 'AugustusSwapperV4' , ['ethereum']) + , ('0x90249ed4d69d70e709ffcd8bee2c5a566f65dade', 'true', 'Paraswap' , 'AugustusSwapperV4' , ['polygon']) + , ('0x55a0e3b6579972055faa983482aceb4b251dcf15', 'true', 'Paraswap' , 'AugustusSwapperV4' , ['bnb']) + , ('0xdef171fe48cf0115b1d80b88dc8eab59176fee57', 'true', 'Paraswap' , 'AugustusSwapperV6' , ['ethereum','bnb','polygon','arbitrum','avalanche_c','optimism','fantom']) + , ('0x00000000fdac7708d0d360bddc1bc7d097f47439', 'true', 'Paraswap' , 'AugustusV6' , ['ethereum','bnb','polygon','arbitrum','avalanche_c','optimism','fantom','base']) + , ('0x000db803a70511e09da650d4c0506d0000100000', 'true', 'Paraswap' , 'AugustusV6v1' , ['ethereum','bnb','polygon','arbitrum','avalanche_c','optimism','fantom','base']) + , ('0x135896de8421be2ec868e0b811006171d9df802a', 'true', 'Paraswap' , 'LiquiditySwapAdapter' , ['ethereum']) + , ('0xe92b586627cca7a83dc919cc7127196d70f55a06', 'true', 'Paraswap' , 'AugustusRFQ' , ['ethereum']) + , ('0x0927fd43a7a87e3e8b81df2c44b03c4756849f6d', 'true', 'Paraswap' , 'AugustusRFQ' , ['arbitrum','optimism']) + , ('0x2DF17455B96Dde3618FD6B1C3a9AA06D6aB89347', 'true', 'Paraswap' , 'AugustusRFQ' , ['fantom']) + , ('0xa003dfba51c9e1e56c67ae445b852bded7ac5eed', 'true', 'Paraswap' , 'AugustusRFQ' , ['base']) + , ('0x34302c4267d0dA0A8c65510282Cc22E9e39df51f', 'true', 'Paraswap' , 'AugustusRFQ' , ['avalanche_c']) + , ('0x8DcDfe88EF0351f27437284D0710cD65b20288bb', 'true', 'Paraswap' , 'AugustusRFQ' , ['bnb']) + , ('0xF3CD476C3C4D3Ac5cA2724767f269070CA09A043', 'true', 'Paraswap' , 'AugustusRFQ' , ['polygon']) + , ('0x7Ee1F7fa4C0b2eDB0Fdd5944c14A07167700486E', 'true', 'Paraswap' , 'AugustusRFQ' , ['zkevm']) + , ('0x82ac2ce43e33683c58be4cdc40975e73aa50f459', 'true', 'Perp' , 'ClearingHouse' , ['optimism']) + , ('0xa0069a14df3ecd19a38c509757ebc2c2aaa44992', 'true', 'Primex' , 'SwapManager' , ['polygon']) + , ('0x2cf7252e74036d1da831d11089d326296e64a728', 'true', 'QuickSwap' , 'UniswapV2Pair' , ['polygon']) + , ('0xa5e0829caced8ffdd4de3c43696c57f7d7a678ff', 'true', 'QuickSwap' , 'UniswapV2Router02' , ['polygon']) + , ('0xf5b509bb0909a69b1c207e495f687a596c168e12', 'true', 'QuickSwap' , 'SwapRouter' , ['polygon']) + , ('0x00000000009726632680fb29d3f7a9734e3010e2', 'true', 'Rainbow' , 'RainbowRouter' , ['ethereum']) + , ('0xaaa87963efeb6f7e0a2711f397663105acb1805e', 'true', 'Ramses' , 'Router' , ['arbitrum']) + , ('0x37da632c6436137bd4d0ca30c98d3c615974120b', 'true', 'SafeMoon' , 'UNDEFINED' , ['bnb']) + , ('0x0c17e776cd218252adfca8d4e761d3fe757e9778', 'true', 'Saita' , 'SaitaSwapRouter' , ['ethereum']) + , ('0x90f765f63e7dc5ae97d6c576bf693fb6af41c129', 'true', 'Setprotocol' , 'TradeModule' , ['ethereum']) + , ('0x03f7724180aa6b939894b5ca4314783b0b36b329', 'true', 'ShibaSwap' , 'UniswapV2Router02' , ['ethereum']) + , ('0x00c0184c0b5d42fba6b7ca914b31239b419ab80b', 'true', 'SlingshotFinance' , 'Swap' , ['optimism']) + , ('0x07e56b727e0eacfa53823977599905024c2de4f0', 'true', 'SlingshotFinance' , 'UNDEFINED' , ['polygon']) + , ('0x224b239b8bb896f125bd77eb334e302a318d9e33', 'true', 'SlingshotFinance' , 'Swap' , ['bnb']) + , ('0x5543550d65813c1fa76242227cbba0a28a297771', 'true', 'SlingshotFinance' , 'UNDEFINED' , ['arbitrum']) + , ('0xe8c97bf6d084880de38aec1a56d97ed9fdfa0c9b', 'true', 'SlingshotFinance' , 'Swap' , ['arbitrum']) + , ('0xf2e4209afa4c3c9eaa3fb8e12eed25d8f328171c', 'true', 'SlingshotFinance' , 'TradingContract' , ['polygon']) + , ('0x2b42affd4b7c14d9b7c2579229495c052672ccd3', 'true', 'Socket' , 'Registry' , ['avalanche_c']) + , ('0xc30141b657f4216252dc59af2e7cdb9d8792e1b0', 'true', 'Socket' , 'Registry' , ['ethereum','polygon','arbitrum','gnosis','optimism']) + , ('0xf26515d5482e2c2fd237149bf6a653da4794b3d0', 'true', 'Solidlizard' , 'Router' , ['arbitrum']) + , ('0xeeee17b45e4d127cfaaad14e2710489523adb4d8', 'true', 'Solisnek' , 'Router' , ['avalanche_c']) + , ('0x16327e3fbdaca3bcf7e38f5af2599d2ddc33ae52', 'true', 'Spiritswap' , 'Router' , ['fantom']) + , ('0x31f63a33141ffee63d4b26755430a390acdd8a4d', 'true', 'Spookyswap' , 'LiquidityBrewer' , ['fantom']) + , ('0xf491e7b69e4244ad4002bc14e878a34207e38c29', 'true', 'Spookyswap' , 'UniswapV2Router02' , ['fantom']) + , ('0x1b02da8cb0d097eb8d57a175b88c7d8b47997506', 'true', 'SushiSwap' , 'SwapRouter' , ['bnb','polygon','arbitrum','avalanche_c','gnosis','fantom']) + , ('0x2c8c987c4777ab740d20cb581f5d381be95a4a4a', 'true', 'SushiSwap' , 'SushiXSwap' , ['avalanche_c']) + , ('0x4c5d5234f232bd2d76b96aa33f5ae4fcf0e4bfab', 'true', 'SushiSwap' , 'RouteProcessorV3' , ['optimism']) + , ('0x7a4af156379f512de147ed3b96393047226d923f', 'true', 'SushiSwap' , 'SushiXSwap' , ['bnb']) + , ('0x8b396ddf906d552b2f98a8e7d743dd58cd0d920f', 'true', 'SushiSwap' , 'SushiXSwap' , ['optimism']) + , ('0xd9e1ce17f2641f24ae83637ab66a2cca9c378b9f', 'true', 'SushiSwap' , 'Router02' , ['ethereum']) + , ('0x2da10a1e27bf85cedd8ffb1abbe97e53391c0295', 'true', 'SyncSwap' , 'Router' , ['zksync']) + , ('0x80e38291e06339d10aab483c65695d004dbd5c69', 'true', 'SyncSwap' , 'Router' , ['scroll']) + , ('0xb9960d9bca016e9748be75dd52f02188b9d0829f', 'true', 'Swapr' , 'Swapr' , ['ethereum']) + , ('0xe43e60736b1cb4a75ad25240e2f9a62bff65c0c0', 'true', 'Swapr' , 'DXswapRouter' , ['gnosis']) + , ('0x1342a24347532de79372283b3a29c63c31dd7711', 'true', 'Swaprum' , 'V2Router02' , ['arbitrum']) + , ('0x1ed5685f345b2fa564ea4a670de1fde39e484751', 'true', 'Swftswap' , 'SwftSwap' , ['bnb']) + , ('0x92e929d8b2c8430bcaf4cd87654789578bb2b786', 'true', 'Swftswap' , 'SwftSwap' , ['ethereum']) + , ('0x03f34be1bf910116595db1b11e9d1b2ca5d59659', 'true', 'Tokenlon' , 'Tokenlon' , ['ethereum']) + , ('0x079c68167f85cb06ed550149cce250e06dc3c52d', 'true', 'TraderJoe' , 'SwapLogic' , ['avalanche_c']) + , ('0x60ae616a2155ee3d9a68541ba4544862310933d4', 'true', 'TraderJoe' , 'JoeRouter02' , ['avalanche_c']) + , ('0xb4315e873dbcf96ffd0acd8ea43f689d8c20fb30', 'true', 'TraderJoe' , 'LBRouter' , ['bnb','arbitrum','avalanche_c']) + , ('0xed8cbd9f0ce3c6986b22002f03c6475ceb7a6256', 'true', 'TraderJoe' , 'JoePair' , ['avalanche_c']) + , ('0x638f32fe09baec1fdc54f962e3e8e5f2b286aa70', 'true', 'TransitSwap' , 'XswapProxyV3' , ['bnb']) + , ('0x8b48715c5d6d1645663a4c460ea85ce846b8580e', 'true', 'TransitSwap' , 'UNDEFINED' , ['polygon']) + , ('0xb45a2dda996c32e93b8c47098e90ed0e7ab18e39', 'true', 'TransitSwap' , 'TransitSwapRouterV4' , ['bnb','polygon','arbitrum']) + , ('0x00000047bb99ea4d791bb749d970de71ee0b1a34', 'true', 'TransitSwap' , 'TransitSwapRouterV5' , ['ethereum']) + , ('0xf164fc0ec4e93095b804a4795bbe1e041497b92a', 'true', 'Uniswap' , 'Router01' , ['ethereum']) + , ('0x7a250d5630b4cf539739df2c5dacb4c659f2488d', 'true', 'Uniswap' , 'Router02' , ['ethereum']) + , ('0xe592427a0aece92de3edee1f18e0157c05861564', 'true', 'Uniswap' , 'SwapRouter' , ['ethereum','polygon','arbitrum','optimism']) + , ('0x68b3465833fb72a70ecdf485e0e4c7bd8665fc45', 'true', 'Uniswap' , 'SwapRouter02' , ['ethereum','polygon','arbitrum','optimism']) + , ('0x0000000052be00ba3a005edbe83a0fb9aadb964c', 'true', 'Uniswap' , 'UNDEFINED' , ['ethereum']) + , ('0xef1c6e67703c7bd7107eed8303fbe6ec2554bf6b', 'true', 'Uniswap' , 'UniversalRouter' , ['ethereum']) + , ('0x3fc91a3afd70395cd496c647d5a6cc9d4b2b7fad', 'true', 'Uniswap' , 'UNDEFINED' , ['ethereum','bnb','polygon','arbitrum','optimism']) + , ('0x5dc88340e1c5c6366864ee415d6034cadd1a9897', 'true', 'Uniswap' , 'UniversalRouter' , ['bnb']) + , ('0x4c60051384bd2d3c01bfc845cf5f4b44bcbe9de5', 'true', 'Uniswap' , 'UniversalRouter' , ['polygon','arbitrum']) + , ('0x643770e279d5d0733f21d6dc03a8efbabf3255b4', 'true', 'Uniswap' , 'UNDEFINED' , ['polygon']) + , ('0xb555edf5dcf85f42ceef1f3630a52a108e55a654', 'true', 'Uniswap' , 'UniversalRouter' , ['optimism']) + , ('0xec8b0f7ffe3ae75d7ffab09429e3675bb63503e4', 'true', 'Uniswap' , 'UNDEFINED' , ['bnb','arbitrum','optimism','base']) + , ('0xb971ef87ede563556b2ed4b1c0b0019111dd85d2', 'true', 'Uniswap' , 'UNDEFINED' , ['bnb']) + , ('0x2626664c2603336e57b271c5c0b26f421741e481', 'true', 'Uniswap' , 'UNDEFINED' , ['base']) + , ('0x198ef79f1f515f02dfe9e3115ed9fc07183f02fc', 'true', 'Uniswap' , 'UNDEFINED' , ['base']) + , ('0xe80bf394d190851e215d5f67b67f8f5a52783f1e', 'true', 'Uniswap' , 'UniswapX' , ['ethereum']) + , ('0x6000da47483062a0d734ba3dc7576ce6a0b645c4', 'true', 'Uniswap' , 'UniswapX' , ['ethereum']) + , ('0x9c12939390052919af3155f41bf4160fd3666a6f', 'true', 'Velodrome' , 'Router' , ['optimism']) + , ('0xa132dab612db5cb9fc9ac426a0cc215a3423f9c9', 'true', 'Velodrome' , 'Router' , ['optimism']) + , ('0x777777773fdd8b28bb03377d10fcea75ad9768da', 'true', 'Viarouter' , 'ViaRouter' , ['polygon','arbitrum','optimism']) + , ('0xf29ace1fe5f36389d0dde450a0195a30c3770245', 'true', 'W3swap' , 'W3swapRouterV2' , ['bnb']) + , ('0x5023882f4d1ec10544fcb2066abe9c1645e95aa0', 'true', 'Wigoswap' , 'Router' , ['fantom']) + , ('0x19609b03c976cca288fbdae5c21d4290e9a4add7', 'true', 'Wombat' , 'WombatRouter' , ['bnb']) + , ('0x5aa6a4e96a9129562e2fc06660d07feddaaf7854', 'true', 'WooFi' , 'WooRouterV2' , ['avalanche_c']) + , ('0xcef5be73ae943b77f9bc08859367d923c030a269', 'true', 'WooFi' , 'WooRouterV2' , ['bnb']) + , ('0xdf37f7a85d4563f39a78494568824b4df8669b7a', 'true', 'WooFi' , 'WooCrossChainRouter' , ['avalanche_c']) + , ('0xeaf1ac8e89ea0ae13e0f03634a4ff23502527024', 'true', 'WooFi' , 'WooRouter' , ['optimism']) + , ('0xc4729e56b831d74bbc18797e0e17a295fa77488c', 'true', 'Yield' , 'YakRouter' , ['avalanche_c']) + , ('0xdef1c0ded9bec7f1a1670819833240f027b25eff', 'true', 'ZeroEx' , 'ExchangeProxy' , ['ethereum','bnb','polygon','arbitrum']) + , ('0xe66b31678d6c16e9ebf358268a790b763c133750', 'true', 'ZeroEx' , 'ExchangeProxy' , ['ethereum']) + , ('0xdef189deaef76e379df891899eb5a00a94cbc250', 'true', 'ZeroEx' , 'ExchangeProxy' , ['fantom']) + , ('0xdef1abe32c034e558cdd535791643c58a13acc10', 'true', 'ZeroEx' , 'ExchangeProxy' , ['optimism']) + , ('0x080bf510fcbf18b91105470639e9561022937712', 'true', 'ZeroEx' , 'ExchangeV2' , ['ethereum']) + , ('0x3f93c3d9304a70c9104642ab8cd37b1e2a7c203a', 'true', 'ZeroEx' , 'ExchangeV2' , ['bnb']) + , ('0x145f83ad6108391cbf9ed554e5ce1dbd984437f8', 'true', 'ZeroEx' , 'ExchangeV2' , ['bnb','polygon']) + , ('0x61935cbdd02287b511119ddb11aeb42f1593b7ef', 'true', 'ZeroEx' , 'ExchangeV3' , ['ethereum']) + , ('0x18381c0f738146fb694de18d1106bde2be040fa4', 'true', 'ZkSwap' , 'Router' , ['zksync']) + , ('0xe7b0ce0526fbe3969035a145c9e9691d4d9d216c', 'false', 'Clipper' , 'Clipper' , ['ethereum','arbitrum']) + , ('0x655edce464cc797526600a462a8154650eee4b77', 'false', 'Clipper' , 'Clipper' , ['ethereum']) + , ('0xcc12532e95c2a6a4c53af153b9b739a3cc9218a7', 'false', 'Clipper' , 'Clipper' , ['ethereum']) + , ('0x6bfce69d1df30fd2b2c8e478edec9daa643ae3b8', 'false', 'Clipper' , 'Clipper' , ['polygon']) + , ('0xd01e3549160c62acabc4d0eb89f67aafa3de8eed', 'false', 'Clipper' , 'Clipper' , ['polygon']) + , ('0x69107c1fc1dbf486ea64ad4fe6f9be81b8265f92', 'false', 'Clipper' , 'Clipper' , ['polygon']) + , ('0x769728b5298445ba2828c0f3f5384227fbf590c5', 'false', 'Clipper' , 'Clipper' , ['arbitrum']) + , ('0x5130f6ce257b8f9bf7fac0a0b519bd588120ed40', 'false', 'Clipper' , 'Clipper' , ['optimism']) + , ('0xdbd4ffc32b34f630dd8ac18d37162ec8462db7db', 'false', 'Clipper' , 'Clipper' , ['optimism']) + , ('0xb32d856cad3d2ef07c94867a800035e37241247c', 'false', 'Clipper' , 'Clipper' , ['base']) + , ('0x32c85e56a82d66fa3c13e7df900682d63fcbaf89', 'false', 'Hashflow' , 'HashflowRouterV1' , ['ethereum','arbitrum']) + , ('0xe2e3441004e7d377a2d97142e75d465e0dd36af9', 'false', 'Hashflow' , 'HashflowRouterV1' , ['ethereum']) + , ('0x79cdfd7bc46d577b95ed92bcdc8ababa1844af0c', 'false', 'Hashflow' , 'HashflowRouterV1' , ['ethereum']) + , ('0xedc827442114f038d009417a88942a619b8cfe17', 'false', 'Hashflow' , 'HashflowRouterV1' , ['polygon']) + , ('0x5e8297efe1a5d9064f5dd3bb525d84807440a90d', 'false', 'Hashflow' , 'HashflowRouterV1' , ['bnb']) + , ('0x3fff9a58676584ba28e8780366d7d9cef0eb78ce', 'false', 'Hashflow' , 'HashflowRouterV1' , ['bnb']) + , ('0x375e05f6e12028e933ce598ad1bed7f1194ab071', 'false', 'Hashflow' , 'HashflowRouterV1' , ['bnb']) + , ('0xacfaaa9da11e66a8cc8af8e3d844673968fff63f', 'false', 'Hashflow' , 'HashflowRouterV1' , ['polygon']) + , ('0x8ee11bbd4139989e5f8bb92e8a9e01bc08df3011', 'false', 'Hashflow' , 'HashflowRouterV1' , ['polygon']) + , ('0xab68b6213b091de92680ec57e879a20bbf12afda', 'false', 'Hashflow' , 'HashflowRouterV1' , ['arbitrum']) + , ('0x6fce1a7c3347e78d22c278eb3a5c72ec8fcea294', 'false', 'Hashflow' , 'HashflowRouterV1' , ['arbitrum']) + , ('0x36c543b8bb76b330ecb66a13c1c1377f889f1919', 'false', 'Hashflow' , 'HashflowRouterV1' , ['arbitrum']) + , ('0x39b558bfc3c65230a5fa5170dbf7a44158a340f6', 'false', 'Hashflow' , 'HashflowRouterV1' , ['avalanche_c']) + , ('0x43b4bf8758cae65e6b8242d2669e0e5e20ff693a', 'false', 'Hashflow' , 'HashflowRouterV1' , ['avalanche_c']) + , ('0x45e817d12758ac37bc8dd3c71143c1be75e3ed6f', 'false', 'Hashflow' , 'HashflowRouterV1' , ['avalanche_c']) + , ('0x54a06197130e02aa0244c4a413f70c52348c3610', 'false', 'Hashflow' , 'HashflowRouterV1' , ['optimism']) + , ('0xfb1b9a97f1836173390d8bdeaf9004727311a8e1', 'false', 'Hashflow' , 'HashflowRouterV1' , ['optimism']) + , ('0xf6a94dfd0e6ea9ddfdffe4762ad4236576136613', 'false', 'Hashflow' , 'HashflowRouterV2' , ['ethereum']) + , ('0x0acffb0fb2cddd9bd35d03d359f3d899e32facc9', 'false', 'Hashflow' , 'HashflowRouterV2' , ['bnb']) + , ('0x72550597dc0b2e0bec24e116add353599eff2e35', 'false', 'Hashflow' , 'HashflowRouterV2' , ['polygon']) + , ('0x1f772fa3bc263160ea09bb16ce1a6b8fc0fab36a', 'false', 'Hashflow' , 'HashflowRouterV2' , ['arbitrum']) + , ('0x64d2f9f44fe26c157d552ae7eaa613ca6587b59e', 'false', 'Hashflow' , 'HashflowRouterV2' , ['avalanche_c']) + , ('0xb3999f658c0391d94a37f7ff328f3fec942bcadc', 'false', 'Hashflow' , 'HashflowRouterV2' , ['optimism']) + , ('0x55084ee0fef03f14a305cd24286359a35d735151', 'false', 'Hashflow' , 'HashflowRouterV3' , ['ethereum','bnb','polygon','arbitrum','avalanche_c']) + , ('0xca310b1b942a30ff4b40a5e1b69ab4607ec79bc1', 'false', 'Hashflow' , 'HashflowRouterV3' , ['optimism']) + , ('0x3d130bf4686b3d4b6eb91a8e26ac629c5bea6082', 'false', 'Native' , 'Native' , ['ethereum','bnb','arbitrum','avalanche_c']) + , ('0xf39276d0eedfd604b55a0bd23c7ab2145ace4ab0', 'false', 'Native' , 'Native' , ['ethereum','bnb']) + , ('0x816ecda969e24583e79b71645f1202dabd7fe90e', 'false', 'Native' , 'Native' , ['ethereum','arbitrum']) + , ('0x5b0711eee0c6366aa35a98b14fd8b4b4c6d1d04c', 'false', 'Native' , 'Native' , ['ethereum']) + , ('0xf6b94770608ebf8b9b7621378cde5bc04b431cc8', 'false', 'Native' , 'Native' , ['bnb','arbitrum']) + , ('0xbd0180f7365a354b3b857c0ab16377c7bcdd2ec9', 'false', 'Native' , 'Native' , ['bnb','avalanche_c']) + , ('0x56385da1f6d17185402fe21795e0593837c8e991', 'false', 'Native' , 'Native' , ['bnb']) + , ('0x52a19f554882743b9e30968aafa48740979b141e', 'false', 'Native' , 'Native' , ['bnb']) + , ('0x63cb5b1d61e15dc31c80c787fe791baf1c81aec7', 'false', 'Native' , 'Native' , ['bnb']) + , ('0xd5473f6fb73422f416f01e096eefcc5af9894b71', 'false', 'Native' , 'Native' , ['polygon']) + , ('0x45b69fd499f068b7306d743d2f8b2ad5c54d99a0', 'false', 'Native' , 'Native' , ['polygon']) + , ('0x3151263101e0361b39cd6c530e45b28c33cbaf46', 'false', 'Native' , 'Native' , ['polygon']) + , ('0xd315a9c38ec871068fec378e4ce78af528c76293', 'false', 'Swaap' , 'Vault' , ['ethereum','polygon','arbitrum']) + , ('0xa57bd00134b2850b2a1c55860c9e9ea100fdd6cf', 'false', 'MEVBot' , 'MEVBot' , ['ethereum']) + , ('0xa69babef1ca67a37ffaf7a485dfff3382056e78c', 'false', 'MEVBot' , 'MEVBot' , ['ethereum']) + , ('0x00000000003b3cc22af3ae1eac0440bcee416b40', 'false', 'MEVBot' , 'MEVBot' , ['ethereum']) + , ('0x0000000000007f150bd6f54c40a34d7c3d5e9f56', 'false', 'MEVBot' , 'MEVBot' , ['ethereum']) + , ('0x80d4230c0a68fc59cb264329d3a717fcaa472a13', 'false', 'MEVBot' , 'MEVBot' , ['ethereum']) + , ('0x0000000000005117dd3a72e64a705198753fdd54', 'false', 'MEVBot' , 'MEVBot' , ['ethereum']) + , ('0xede2fafba9e23418485f49f052d0e1d332853e0f', 'false', 'MEVBot' , 'MEVBot' , ['ethereum']) + , ('0x018d5c4783f5317815f6e8168942a12adde3cd3c', 'false', 'MEVBot' , 'MEVBot' , ['ethereum']) + , ('0xbadc0defafcf6d4239bdf0b66da4d7bd36fcf05a', 'false', 'MEVBot' , 'MEVBot' , ['ethereum']) + , ('0x860bd2dba9cd475a61e6d1b45e16c365f6d78f66', 'false', 'MEVBot' , 'MEVBot' , ['ethereum']) + , ('0x00000000c2cf7648c169b25ef1c217864bfa38cc', 'false', 'MEVBot' , 'MEVBot' , ['ethereum']) + , ('0x3d71d79c224998e608d03c5ec9b405e7a38505f0', 'false', 'Unknown' , 'Unknown' , ['ethereum']) + , ('0x78a55b9b3bbeffb36a43d9905f654d2769dc55e8', 'false', 'Unknown' , 'Unknown' , ['ethereum']) + , ('0x7dad75b50c0e78b34cc543e8632aa63f6a661bce', 'false', 'Unknown' , 'Unknown' , ['polygon']) + , ('0xc715ca10a7eb704af0847b860de4b1ea997fa3de', 'false', 'Unknown' , 'Unknown' , ['polygon']) + , ('0x0773edc0438b2ef18fc535b21d0ac77912c308c0', 'false', 'Unknown' , 'Unknown' , ['polygon']) + , ('0x403022af121cdca9c4acf4b94b2934429594ea29', 'false', 'Unknown' , 'Unknown' , ['polygon']) + , ('0x0773edc0438b2ef18fc535b21d0ac77912c308c0', 'false', 'Unknown' , 'Unknown' , ['arbitrum']) + , ('0x6a3e4b7e23661108aaec70266c468e6c679ae022', 'false', 'Unknown' , 'Unknown' , ['arbitrum']) + , ('0xf770c63b1764a9c8f0fa925044158b09855a7faf', 'false', 'Unknown' , 'Unknown' , ['arbitrum']) + , ('0x00000000001f8b68515efb546542397d3293ccfd', 'false', 'Unknown' , 'ArbBot' , ['bnb']) + ] +%} + + + +with + +contracts as ( + select + '{{blockchain}}' as blockchain + , address + , project + , user + , contains(array[ + '1inch' + , 'BabySwap' + , 'BoggedFinance' + , 'Dzap' + , 'Firebird' + , 'Kyber' + , 'LiFi' + , 'Odos' + , 'OpenOcean' + , 'Paraswap' + , 'SlingshotFinance' + , 'TransitSwap' + , 'ZeroEx' + ], project) as multi + , contains(array[ + '1inch' + , 'ZeroEx' + , 'Clipper' + , 'Hashflow' + , 'Native' + , 'Swaap' + , 'Paraswap' + ], project) as lop + , contains(array[ + '1inch' + , 'CoWSwap' + , 'Uniswap' + , 'Bebop' + ], project) as auction + , tag + from (values + {% for row in config if blockchain in row[4] %} + {% if not loop.first %}, {% endif %}({{ row[0] }}, {{ row[1] }}, '{{ row[2] }}', '{{ row[3] }}') + {% endfor %} + ) as c(address, user, project, tag) +) + +, creations as ( + select + '{{blockchain}}' as blockchain + , address + , min(block_time) as first_created_at + , max(block_time) as last_created_at + , max("from") as last_creator + , max(tx_hash) as last_creation_tx_hash + from {{ source(blockchain, 'creation_traces') }} + group by 1, 2 +) + +-- output -- + +select + blockchain + , address + , project + , tag + , map_from_entries(array[('user', user), ('multi', multi), ('lop', lop), ('auction', auction)]) as flags + , first_created_at + , last_created_at + , last_creator + , last_creation_tx_hash +from contracts +join creations using(blockchain, address) +order by project, blockchain, last_created_at, tag, address + +{% endmacro %} \ No newline at end of file diff --git a/macros/models/_project/oneinch/_meta/oneinch_mapped_methods.sql b/macros/models/_project/oneinch/_meta/oneinch_mapped_methods.sql new file mode 100644 index 00000000000..f21a08a293b --- /dev/null +++ b/macros/models/_project/oneinch/_meta/oneinch_mapped_methods.sql @@ -0,0 +1,120 @@ +{% macro oneinch_mapped_methods_macro(blockchain) %} + + +with + +static as ( + select + array['swap', 'settle', 'change', 'exact', 'batch', 'trade', 'sell', 'buy', 'fill', 'route', 'zap', 'symbiosis', 'aggregate', 'multicall', 'execute', 'wrap', 'transform'] as suitable + , array['add', 'remove', 'mint', 'increase', 'decrease', 'cancel', 'destroy', 'claim', 'rescue', 'withdraw', 'simulate', 'join', 'exit', 'interaction', '721', '1155', 'nft', 'create'] as exceptions + , array['fill', 'order'] as limits + , array['1inch', 'CoWSwap', 'MetaMask', 'Odos', 'OpenOcean', 'Paraswap', 'SlingshotFinance', 'Uniswap', 'ZeroEx'] as main + , array['Rainbow'] as notlimits + , array[ + 0x13d79a0b -- CoW settle + , 0x0965d04b -- 1inch settleOrders + , 0x05afc977 -- UniswapX execute + , 0x6f1d5f51 -- UniswapX executeBatch + , 0x3f62192e -- UniswapX execute + , 0x0d7a16c3 -- UniswapX executeBatch + , 0x0d335884 -- UniswapX executeWithCallback + , 0x13fb72c7 -- UniswapX executeBatchWithCallback + ] as intents +) + +, contracts as ( + select + '{{blockchain}}' as blockchain + , address + , any_value(project) as project + , any_value(tag) as tag + , any_value(flags) as flags + , any_value(last_created_at) as last_created_at + , max_by(abi, created_at) as abi + , max_by(namespace, created_at) as namespace + , max_by(name, created_at) as name + from {{ source(blockchain, 'contracts') }} + join ({{ oneinch_mapped_contracts_macro(blockchain) }}) using(address) + where flags['user'] + group by 1, 2 +) + +, descriptions as ( + select + blockchain + , address + , project + , json_value(entity, 'lax $.name') as method + , cast(json_parse(json_query(entity, 'lax $.inputs.type' with array wrapper)) as array(varchar)) as types + , cast(json_parse(json_query(entity, 'lax $.inputs.components.type' with array wrapper)) as array(varchar)) as components + , cast(json_parse(json_query(entity, 'lax $.inputs.components.size()' with array wrapper)) as array(int)) as sizes + , json_query(entity, 'lax $.inputs') as inputs + , json_query(entity, 'lax $.outputs') as outputs + , namespace + , name + , tag + , flags + , last_created_at + from contracts, unnest(abi) as abi(entity) + where + json_value(entity, 'lax $.type') = 'function' + and json_value(entity, 'lax $.stateMutability') in ('payable', 'nonpayable') +) + +, signatures as ( + select + * + , substr(keccak(to_utf8(signature)), 1, 4) as selector + , reduce(suitable, false, (r, x) -> if(position(x in lower(replace(method, '_'))) > 0, true, r), r -> r) and not reduce(exceptions, false, (r, x) -> if(position(x in lower(replace(method, '_'))) > 0, true, r), r -> r) as swap + , reduce(limits, false, (r, x) -> if(position(x in lower(replace(method, '_'))) > 0, true, r), r -> r) and not reduce(exceptions, false, (r, x) -> if(position(x in lower(replace(method, '_'))) > 0, true, r) and not contains(notlimits, project), r -> r) as _limits + from ( + select + * + , method || '(' || if( + parts is null + , array_join(types, ',') + , reduce( + sequence(1, cardinality(parts)) + , (array_join(types, ','), parts) + , (r, x) -> ( + substr(r[1], 1, position('tuple' in r[1]) - 1) || '(' || r[2][1] || ')' || substr(r[1], position('tuple' in r[1]) + 5) + , slice(r[2], 2, cardinality(r[2]) - 1) + ) + , r -> r[1] + ) + ) || ')' as signature + from ( + select + * + , reduce(sequence(1, cardinality(sizes)), cast(array[] as array(varchar)), (r, x) -> r || array_join(slice(components, start[x], sizes[x]), ','), r -> r) as parts + from ( + select + * + , reduce(sequence(1, cardinality(sizes)), cast(array[] as array(int)), (r, x) -> if(x = 1, r || x, r || r[x - 1] + sizes[x - 1]), r -> r) as start + from descriptions + ) + ) + join static on true + ) +) + +-- output -- + +select + map_concat(flags, map_from_entries(array[('swap', swap), ('limits', _limits), ('intents', contains(intents, selector)), ('multi', flags['multi']), ('main', contains(main, project))])) as flags + , blockchain + , address + , last_created_at + , project + , method + , signature + , selector + , namespace + , name + , tag + , inputs + , outputs +from signatures +order by project, blockchain, last_created_at, tag, address, method + +{% endmacro %} \ No newline at end of file diff --git a/macros/models/_project/oneinch/oneinch_project_orders_macro.sql b/macros/models/_project/oneinch/oneinch_project_orders_macro.sql new file mode 100644 index 00000000000..7f391ddab53 --- /dev/null +++ b/macros/models/_project/oneinch/oneinch_project_orders_macro.sql @@ -0,0 +1,869 @@ +{% macro oneinch_project_orders_macro( + blockchain + , date_from = '2019-01-01' +)%} + +-- EVENTS CONFIG +{% + set events = { + "0x0bcc4c97732e47d9946f229edb95f5b6323f601300e4690de719993f3c371129": { + "project": "ZeroEx", + "name": "Fill", + "maker": "substr(topic1 , 12 + 1 , 20)", + "taker": "substr(data , 12 + 1 , 20)", + "maker_asset": "if(substr(data, bytearray_to_bigint(substr(data, 32*6 + 24 + 1, 8)) + 32*1 + 1, 4) = 0xf47261b0, substr(data, bytearray_to_bigint(substr(data, 32*6 + 24 + 1, 8)) + 32*1 + 4 + 12 + 1, 20), 0x01)", + "taker_asset": "if(substr(data, bytearray_to_bigint(substr(data, 32*7 + 24 + 1, 8)) + 32*1 + 1, 4) = 0xf47261b0, substr(data, bytearray_to_bigint(substr(data, 32*7 + 24 + 1, 8)) + 32*1 + 4 + 12 + 1, 20), 0x01)", + "making_amount": "substr(data , 32*2 + 1 , 32)", + "taking_amount": "substr(data , 32*3 + 1 , 32)", + "order_hash": "substr(topic3 , 1 , 32)", + }, + "0x6869791f0a34781b29882982cc39e882768cf2c96995c2a110c577c53bc932d5": { + "project": "ZeroEx", + "name": "Fill", + "maker": "substr(topic1 , 12 + 1 , 20)", + "taker": "substr(data , 32*4 + 12 + 1 , 20)", + "maker_asset": "if(substr(data, bytearray_to_bigint(substr(data, 32*0 + 24 + 1, 8)) + 32*1 + 1, 4) = 0xf47261b0, substr(data, bytearray_to_bigint(substr(data, 32*0 + 24 + 1, 8)) + 32*1 + 4 + 12 + 1, 20), 0x01)", + "taker_asset": "if(substr(data, bytearray_to_bigint(substr(data, 32*1 + 24 + 1, 8)) + 32*1 + 1, 4) = 0xf47261b0, substr(data, bytearray_to_bigint(substr(data, 32*1 + 24 + 1, 8)) + 32*1 + 4 + 12 + 1, 20), 0x01)", + "making_amount": "substr(data , 32*6 + 1 , 32)", + "taking_amount": "substr(data , 32*7 + 1 , 32)", + "order_hash": "substr(topic3 , 1 , 32)", + }, + "0xab614d2b738543c0ea21f56347cf696a3a0c42a7cbec3212a5ca22a4dcff2124": { + "project": "ZeroEx", + "name": "LimitOrderFilled", + "maker": "substr(data , 32*1 + 12 + 1 , 20)", + "taker": "substr(data , 32*2 + 12 + 1 , 20)", + "maker_asset": "substr(data , 32*4 + 12 + 1 , 20)", + "taker_asset": "substr(data , 32*5 + 12 + 1 , 20)", + "making_amount": "substr(data , 32*7 + 1 , 32)", + "taking_amount": "substr(data , 32*6 + 1 , 32)", + "taker_fee_amount": "substr(data , 32*8 + 1 , 32)", + "order_hash": "substr(data , 1 , 32)", + }, + "0xac75f773e3a92f1a02b12134d65e1f47f8a14eabe4eaf1e24624918e6a8b269f": { + "project": "ZeroEx", + "name": "OtcOrderFilled", + "maker": "substr(data , 32*1 + 12 + 1 , 20)", + "taker": "substr(data , 32*2 + 12 + 1 , 20)", + "maker_asset": "substr(data , 32*3 + 12 + 1 , 20)", + "taker_asset": "substr(data , 32*4 + 12 + 1 , 20)", + "making_amount": "substr(data , 32*5 + 1 , 32)", + "taking_amount": "substr(data , 32*6 + 1 , 32)", + "order_hash": "substr(data , 1 , 32)", + }, + "0x829fa99d94dc4636925b38632e625736a614c154d55006b7ab6bea979c210c32": { + "project": "ZeroEx", + "name": "RfqOrderFilled", + "maker": "substr(data , 32*1 + 12 + 1 , 20)", + "taker": "substr(data , 32*2 + 12 + 1 , 20)", + "maker_asset": "substr(data , 32*3 + 12 + 1 , 20)", + "taker_asset": "substr(data , 32*4 + 12 + 1 , 20)", + "making_amount": "substr(data , 32*6 + 1 , 32)", + "taking_amount": "substr(data , 32*5 + 1 , 32)", + "order_hash": "substr(data , 1 , 32)", + }, + "0xb709ddcc6550418e9b89df1f4938071eeaa3f6376309904c77e15d46b16066f5": { + "project": "Hashflow", + "name": "Trade", + "maker": "substr(data , 32*0 + 12 + 1 , 20)", + "taker": "substr(data , 32*1 + 12 + 1 , 20)", + "maker_asset": "substr(data , 32*4 + 12 + 1 , 20)", + "taker_asset": "substr(data , 32*3 + 12 + 1 , 20)", + "making_amount": "substr(data , 32*6 + 1 , 32)", + "taking_amount": "substr(data , 32*5 + 1 , 32)", + }, + "0x8cf3dec1929508e5677d7db003124e74802bfba7250a572205a9986d86ca9f1e": { + "project": "Hashflow", + "name": "Trade", + "taker": "substr(data , 32*0 + 12 + 1 , 20)", + "maker_asset": "substr(data , 32*3 + 12 + 1 , 20)", + "taker_asset": "substr(data , 32*2 + 12 + 1 , 20)", + "making_amount": "substr(data , 32*5 + 1 , 32)", + "taking_amount": "substr(data , 32*4 + 1 , 32)", + }, + "0x34f57786fb01682fb4eec88d340387ef01a168fe345ea5b76f709d4e560c10eb": { + "project": "Hashflow", + "name": "Trade", + "taker": "substr(data , 32*0 + 12 + 1 , 20)", + "maker_asset": "substr(data , 32*4 + 12 + 1 , 20)", + "taker_asset": "substr(data , 32*3 + 12 + 1 , 20)", + "making_amount": "substr(data , 32*6 + 1 , 32)", + "taking_amount": "substr(data , 32*5 + 1 , 32)", + "order_hash": "substr(data , 32*2 + 1 , 32)", + }, + "0xe3a54b69726c85299f4e794bac96150af56af801be76cafd11947a1103b6308a": { + "project": "Native", + "name": "Swap", + "taker": "substr(topic1 , 12 + 1 , 20)", + "maker_asset": "substr(data , 32*1 + 12 + 1 , 20)", + "taker_asset": "substr(data , 32*0 + 12 + 1 , 20)", + "making_amount": "cast(abs(bytearray_to_int256(substr(data, 32*3 + 1, 32))) as varbinary)", + "taking_amount": "substr(data , 32*2 + 1 , 32)", + "order_hash": "substr(data , 32*5 + 1 , 16)", + }, + "0x4be05c8d54f5e056ab2cfa033e9f582057001268c3e28561bb999d35d2c8f2c8": { + "project": "Clipper", + "name": "Swapped", + "taker": "substr(topic3 , 12 + 1 , 20)", + "maker_asset": "substr(topic2 , 12 + 1 , 20)", + "taker_asset": "substr(topic1 , 12 + 1 , 20)", + "making_amount": "substr(data , 32*1 + 1 , 32)", + "taking_amount": "substr(data , 32*0 + 1 , 32)", + }, + "0x2170c741c41531aec20e7c107c24eecfdd15e69c9bb0a8dd37b1840b9e0b207b": { + "project": "Swaap", + "name": "Swap", + "maker_asset": "substr(topic3 , 12 + 1 , 20)", + "taker_asset": "substr(topic2 , 12 + 1 , 20)", + "making_amount": "substr(data , 32*1 + 1 , 32)", + "taking_amount": "substr(data , 32*0 + 1 , 32)", + }, + "0x6621486d9c28838df4a87d2cca5007bc2aaf6a5b5de083b1db8faf709302c473": { + "project": "Paraswap", + "name": "OrderFilled", + "maker": "substr(topic2 , 12 + 1 , 20)", + "taker": "substr(topic3 , 12 + 1 , 20)", + "maker_asset": "substr(data , 32*0 + 12 + 1 , 20)", + "taker_asset": "substr(data , 32*2 + 12 + 1 , 20)", + "making_amount": "substr(data , 32*1 + 1 , 32)", + "taking_amount": "substr(data , 32*3 + 1 , 32)", + "order_hash": "substr(topic1 , 1 , 32)", + }, + "0xa07a543ab8a018198e99ca0184c93fe9050a79400a0a723441f84de1d972cc17": { + "project": "CoWSwap", + "name": "Trade", + "maker": "substr(topic1 , 12 + 1 , 20)", + "maker_asset": "substr(data , 32*0 + 12 + 1 , 20)", + "taker_asset": "substr(data , 32*1 + 12 + 1 , 20)", + "making_amount": "substr(data , 32*2 + 1 , 32)", + "taking_amount": "substr(data , 32*3 + 1 , 32)", + "fee_asset": "substr(data , 32*0 + 12 + 1 , 20)", + "fee_amount": "substr(data , 32*4 + 1 , 32)", + "order_hash": "substr(data , 32*7 + 1 , 56)", + }, + "0x78ad7ec0e9f89e74012afa58738b6b661c024cb0fd185ee2f616c0a28924bd66": { + "project": "Uniswap", + "name": "Fill", + "maker": "substr(topic3 , 12 + 1 , 20)", + "taker": "substr(topic2 , 12 + 1 , 20)", + "order_hash": "substr(topic1 , 1 , 32)", + "nonce": "substr(data , 1 , 32)", + }, + "0xadd7095becdaa725f0f33243630938c861b0bba83dfd217d4055701aa768ec2e": { + "project": "Bebop", + "name": "BebopOrder", + "order_hash": "substr(topic1 , 16 + 1 , 16)", + } + } +%} + +-- METHODS CONFIG +{% + set cfg = { + "ZeroEx": { + "0xb4be83d5": { + "name": "fillOrder", + "event": "0x0bcc4c97732e47d9946f229edb95f5b6323f601300e4690de719993f3c371129", + "maker": "substr(input , 4 + 32*3 + 12 + 1 , 20)", + "maker_asset": "substr(input, 4 + bytearray_to_bigint(substr(input, 4 + 24 + 1, 8)) + bytearray_to_bigint(substr(input, 4 + bytearray_to_bigint(substr(input, 4 + 24 + 1, 8)) + 32*10 + 24 + 1, 8)) + 32*1 + 4 + 12 + 1, 20)", + "taker_asset": "substr(input, 4 + bytearray_to_bigint(substr(input, 4 + 24 + 1, 8)) + bytearray_to_bigint(substr(input, 4 + bytearray_to_bigint(substr(input, 4 + 24 + 1, 8)) + 32*11 + 24 + 1, 8)) + 32*1 + 4 + 12 + 1, 20)", + "maker_max_amount": "substr(input , 4 + 32*7 + 1 , 32)", + "taker_max_amount": "substr(input , 4 + 32*1 + 1 , 32)", + "making_amount": "substr(output , 32*0 + 1 , 32)", + "taking_amount": "substr(output , 32*1 + 1 , 32)", + }, + "0xf6274f66": { + "name": "fillLimitOrder", + "event": "0xab614d2b738543c0ea21f56347cf696a3a0c42a7cbec3212a5ca22a4dcff2124", + "maker": "substr(input , 4 + 32*5 + 12 + 1 , 20)", + "maker_asset": "substr(input , 4 + 32*0 + 12 + 1 , 20)", + "taker_asset": "substr(input , 4 + 32*1 + 12 + 1 , 20)", + "maker_max_amount": "substr(input , 4 + 32*2 + 1 , 32)", + "taker_max_amount": "substr(input , 4 + 32*3 + 1 , 32)", + "making_amount": "substr(output , 32*1 + 1 , 32)", + "taking_amount": "substr(output , 32*0 + 1 , 32)", + }, + "0x414e4ccf": { + "name": "_fillLimitOrder", + "event": "0xab614d2b738543c0ea21f56347cf696a3a0c42a7cbec3212a5ca22a4dcff2124", + "maker": "substr(input , 4 + 32*5 + 12 + 1 , 20)", + "maker_asset": "substr(input , 4 + 32*0 + 12 + 1 , 20)", + "taker_asset": "substr(input , 4 + 32*1 + 12 + 1 , 20)", + "maker_max_amount": "substr(input , 4 + 32*2 + 1 , 32)", + "taker_max_amount": "substr(input , 4 + 32*3 + 1 , 32)", + "making_amount": "substr(output , 32*1 + 1 , 32)", + "taking_amount": "substr(output , 32*0 + 1 , 32)", + }, + "0x9240529c": { + "name": "fillOrKillLimitOrder", + "event": "0xab614d2b738543c0ea21f56347cf696a3a0c42a7cbec3212a5ca22a4dcff2124", + "maker": "substr(input , 4 + 32*5 + 12 + 1 , 20)", + "maker_asset": "substr(input , 4 + 32*0 + 12 + 1 , 20)", + "taker_asset": "substr(input , 4 + 32*1 + 12 + 1 , 20)", + "maker_max_amount": "substr(input , 4 + 32*2 + 1 , 32)", + "taker_max_amount": "substr(input , 4 + 32*3 + 1 , 32)", + "making_amount": "substr(output , 32*0 + 1 , 32)", + }, + "0xdac748d4": { + "name": "fillOtcOrder", + "event": "0xac75f773e3a92f1a02b12134d65e1f47f8a14eabe4eaf1e24624918e6a8b269f", + "maker": "substr(input , 4 + 32*4 + 12 + 1 , 20)", + "maker_asset": "substr(input , 4 + 32*0 + 12 + 1 , 20)", + "taker_asset": "substr(input , 4 + 32*1 + 12 + 1 , 20)", + "maker_max_amount": "substr(input , 4 + 32*2 + 1 , 32)", + "taker_max_amount": "substr(input , 4 + 32*3 + 1 , 32)", + "making_amount": "substr(output , 32*1 + 1 , 32)", + "taking_amount": "substr(output , 32*0 + 1 , 32)", + }, + "0xe4ba8439": { + "name": "_fillOtcOrder", + "event": "0xac75f773e3a92f1a02b12134d65e1f47f8a14eabe4eaf1e24624918e6a8b269f", + "maker": "substr(input , 4 + 32*4 + 12 + 1 , 20)", + "maker_asset": "substr(input , 4 + 32*0 + 12 + 1 , 20)", + "taker_asset": "substr(input , 4 + 32*1 + 12 + 1 , 20)", + "maker_max_amount": "substr(input , 4 + 32*2 + 1 , 32)", + "taker_max_amount": "substr(input , 4 + 32*3 + 1 , 32)", + "making_amount": "substr(output , 32*1 + 1 , 32)", + "taking_amount": "substr(output , 32*0 + 1 , 32)", + }, + "0xa578efaf": { + "name": "fillOtcOrderForEth", + "event": "0xac75f773e3a92f1a02b12134d65e1f47f8a14eabe4eaf1e24624918e6a8b269f", + "maker": "substr(input , 4 + 32*4 + 12 + 1 , 20)", + "maker_asset": "substr(input , 4 + 32*0 + 12 + 1 , 20)", + "taker_asset": "substr(input , 4 + 32*1 + 12 + 1 , 20)", + "maker_max_amount": "substr(input , 4 + 32*2 + 1 , 32)", + "taker_max_amount": "substr(input , 4 + 32*3 + 1 , 32)", + "making_amount": "substr(output , 32*1 + 1 , 32)", + "taking_amount": "substr(output , 32*0 + 1 , 32)", + }, + "0x706394d5": { + "name": "fillOtcOrderWithEth", + "event": "0xac75f773e3a92f1a02b12134d65e1f47f8a14eabe4eaf1e24624918e6a8b269f", + "maker": "substr(input , 4 + 32*4 + 12 + 1 , 20)", + "maker_asset": "substr(input , 4 + 32*0 + 12 + 1 , 20)", + "taker_asset": "substr(input , 4 + 32*1 + 12 + 1 , 20)", + "maker_max_amount": "substr(input , 4 + 32*2 + 1 , 32)", + "taker_max_amount": "substr(input , 4 + 32*3 + 1 , 32)", + "making_amount": "substr(output , 32*1 + 1 , 32)", + "taking_amount": "substr(output , 32*0 + 1 , 32)", + }, + "0x724d3953": { + "name": "fillTakerSignedOtcOrderForEth", + "event": "0xac75f773e3a92f1a02b12134d65e1f47f8a14eabe4eaf1e24624918e6a8b269f", + "maker": "substr(input , 4 + 32*4 + 12 + 1 , 20)", + "maker_asset": "substr(input , 4 + 32*0 + 12 + 1 , 20)", + "taker_asset": "substr(input , 4 + 32*1 + 12 + 1 , 20)", + "maker_max_amount": "substr(input , 4 + 32*2 + 1 , 32)", + "taker_max_amount": "substr(input , 4 + 32*3 + 1 , 32)", + }, + "0x4f948110": { + "name": "fillTakerSignedOtcOrder", + "event": "0xac75f773e3a92f1a02b12134d65e1f47f8a14eabe4eaf1e24624918e6a8b269f", + "maker": "substr(input , 4 + 32*4 + 12 + 1 , 20)", + "maker_asset": "substr(input , 4 + 32*0 + 12 + 1 , 20)", + "taker_asset": "substr(input , 4 + 32*1 + 12 + 1 , 20)", + "maker_max_amount": "substr(input , 4 + 32*2 + 1 , 32)", + "taker_max_amount": "substr(input , 4 + 32*3 + 1 , 32)", + }, + "0xaa77476c": { + "name": "fillRfqOrder", + "event": "0x829fa99d94dc4636925b38632e625736a614c154d55006b7ab6bea979c210c32", + "maker": "substr(input , 4 + 32*4 + 12 + 1 , 20)", + "maker_asset": "substr(input , 4 + 32*0 + 12 + 1 , 20)", + "taker_asset": "substr(input , 4 + 32*1 + 12 + 1 , 20)", + "maker_max_amount": "substr(input , 4 + 32*2 + 1 , 32)", + "taker_max_amount": "substr(input , 4 + 32*3 + 1 , 32)", + "making_amount": "substr(output , 32*1 + 1 , 32)", + "taking_amount": "substr(output , 32*0 + 1 , 32)", + }, + "0xaa6b21cd": { + "name": "_fillRfqOrder", + "event": "0x829fa99d94dc4636925b38632e625736a614c154d55006b7ab6bea979c210c32", + "maker": "substr(input , 4 + 32*4 + 12 + 1 , 20)", + "maker_asset": "substr(input , 4 + 32*0 + 12 + 1 , 20)", + "taker_asset": "substr(input , 4 + 32*1 + 12 + 1 , 20)", + "maker_max_amount": "substr(input , 4 + 32*2 + 1 , 32)", + "taker_max_amount": "substr(input , 4 + 32*3 + 1 , 32)", + "making_amount": "substr(output , 32*1 + 1 , 32)", + "taking_amount": "substr(output , 32*0 + 1 , 32)", + }, + "0xa656186b": { + "name": "_fillRfqOrder", + "event": "0x829fa99d94dc4636925b38632e625736a614c154d55006b7ab6bea979c210c32", + "maker": "substr(input , 4 + 32*4 + 12 + 1 , 20)", + "maker_asset": "substr(input , 4 + 32*0 + 12 + 1 , 20)", + "taker_asset": "substr(input , 4 + 32*1 + 12 + 1 , 20)", + "maker_max_amount": "substr(input , 4 + 32*2 + 1 , 32)", + "taker_max_amount": "substr(input , 4 + 32*3 + 1 , 32)", + "making_amount": "substr(output , 32*1 + 1 , 32)", + "taking_amount": "substr(output , 32*0 + 1 , 32)", + }, + "0x438cdfc5": { + "name": "fillOrKillRfqOrder", + "event": "0x829fa99d94dc4636925b38632e625736a614c154d55006b7ab6bea979c210c32", + "maker": "substr(input , 4 + 32*4 + 12 + 1 , 20)", + "maker_asset": "substr(input , 4 + 32*0 + 12 + 1 , 20)", + "taker_asset": "substr(input , 4 + 32*1 + 12 + 1 , 20)", + "maker_max_amount": "substr(input , 4 + 32*2 + 1 , 32)", + "taker_max_amount": "substr(input , 4 + 32*3 + 1 , 32)", + "making_amount": "substr(output , 32*0 + 1 , 32)", + }, + "0x3e228bae": { + "name": "fillOrderNoThrow", + "event": "0x0bcc4c97732e47d9946f229edb95f5b6323f601300e4690de719993f3c371129", + "maker": "substr(input , 4 + 32*3 + 12 + 1 , 20)", + "maker_asset": "substr(input, 4 + bytearray_to_bigint(substr(input, 4 + 24 + 1, 8)) + bytearray_to_bigint(substr(input, 4 + bytearray_to_bigint(substr(input, 4 + 24 + 1, 8)) + 32*10 + 24 + 1, 8)) + 32*1 + 4 + 12 + 1, 20)", + "taker_asset": "substr(input, 4 + bytearray_to_bigint(substr(input, 4 + 24 + 1, 8)) + bytearray_to_bigint(substr(input, 4 + bytearray_to_bigint(substr(input, 4 + 24 + 1, 8)) + 32*11 + 24 + 1, 8)) + 32*1 + 4 + 12 + 1, 20)", + "maker_max_amount": "substr(input , 4 + 32*7 + 1 , 32)", + "taker_max_amount": "substr(input , 4 + 32*1 + 1 , 32)", + "making_amount": "substr(output , 32*0 + 1 , 32)", + "taking_amount": "substr(output , 32*1 + 1 , 32)", + }, + "0x9b44d556": { + "name": "fillOrder", + "event": "0x6869791f0a34781b29882982cc39e882768cf2c96995c2a110c577c53bc932d5", + "maker": "substr(input , 4 + 32*3 + 12 + 1 , 20)", + "maker_asset": "substr(input, 4 + bytearray_to_bigint(substr(input, 4 + 24 + 1, 8)) + bytearray_to_bigint(substr(input, 4 + bytearray_to_bigint(substr(input, 4 + 24 + 1, 8)) + 32*10 + 24 + 1, 8)) + 32*1 + 4 + 12 + 1, 20)", + "taker_asset": "substr(input, 4 + bytearray_to_bigint(substr(input, 4 + 24 + 1, 8)) + bytearray_to_bigint(substr(input, 4 + bytearray_to_bigint(substr(input, 4 + 24 + 1, 8)) + 32*11 + 24 + 1, 8)) + 32*1 + 4 + 12 + 1, 20)", + "maker_max_amount": "substr(input , 4 + 32*7 + 1 , 32)", + "taker_max_amount": "substr(input , 4 + 32*8 + 1 , 32)", + "making_amount": "substr(output , 32*0 + 1 , 32)", + "taking_amount": "substr(output , 32*1 + 1 , 32)", + }, + }, + "Hashflow": { + "0x1e9a2e92": { + "name": "tradeSingleHop", + "event": "0xb709ddcc6550418e9b89df1f4938071eeaa3f6376309904c77e15d46b16066f5", + "maker": "substr(input , 4 + 32*2 + 12 + 1 , 20)", + "maker_external": "substr(input , 4 + 32*3 + 12 + 1 , 20)", + "maker_asset": "substr(input , 4 + 32*7 + 12 + 1 , 20)", + "taker_asset": "substr(input , 4 + 32*6 + 12 + 1 , 20)", + "maker_max_amount": "substr(input , 4 + 32*10 + 1 , 32)", + "taker_max_amount": "substr(input , 4 + 32*9 + 1 , 32)", + }, + "0xf0210929": { + "name": "tradeSingleHop", + "event": "0x8cf3dec1929508e5677d7db003124e74802bfba7250a572205a9986d86ca9f1e", + "maker": "substr(input , 4 + 32*1 + 12 + 1 , 20)", + "maker_external": "substr(input , 4 + 32*2 + 12 + 1 , 20)", + "maker_asset": "substr(input , 4 + 32*6 + 12 + 1 , 20)", + "taker_asset": "substr(input , 4 + 32*5 + 12 + 1 , 20)", + "maker_max_amount": "substr(input , 4 + 32*9 + 1 , 32)", + "taker_max_amount": "substr(input , 4 + 32*8 + 1 , 32)", + }, + "0xc52ac720": { + "name": "tradeRFQT", + "event": "0x34f57786fb01682fb4eec88d340387ef01a168fe345ea5b76f709d4e560c10eb", + "maker": "substr(input , 4 + 32*1 + 12 + 1 , 20)", + "maker_external": "substr(input , 4 + 32*2 + 12 + 1 , 20)", + "maker_asset": "substr(input , 4 + 32*6 + 12 + 1 , 20)", + "taker_asset": "substr(input , 4 + 32*5 + 12 + 1 , 20)", + "maker_max_amount": "substr(input , 4 + 32*9 + 1 , 32)", + "taker_max_amount": "substr(input , 4 + 32*8 + 1 , 32)", + "order_hash": "substr(input , 4 + 32*12 + 1 , 32)", + }, + }, + "Native": { + "0xd025fdfa": { + "name": "swap", + "event": "0xe3a54b69726c85299f4e794bac96150af56af801be76cafd11947a1103b6308a", + "maker": "substr(input , 4 + 32*7 + 12 + 1 , 20)", + "maker_asset": "substr(input , 4 + 32*10 + 12 + 1 , 20)", + "taker_asset": "substr(input , 4 + 32*11 + 12 + 1 , 20)", + "making_amount": "cast(abs(bytearray_to_int256(substr(output, 32*0 + 1, 32))) as varbinary)", + "taking_amount": "substr(output , 32*1 + 1 , 32)", + }, + }, + "Clipper": { + "0x2b651a6c": { + "name": "swap", + "event": "0x4be05c8d54f5e056ab2cfa033e9f582057001268c3e28561bb999d35d2c8f2c8", + "taker": "substr(input , 4 + 32*5 + 12 + 1 , 20)", + "maker_asset": "substr(input , 4 + 32*1 + 12 + 1 , 20)", + "taker_asset": "substr(input , 4 + 32*0 + 12 + 1 , 20)", + "maker_max_amount": "substr(input , 4 + 32*3 + 1 , 32)", + "taker_max_amount": "substr(input , 4 + 32*2 + 1 , 32)", + }, + "0x4cb6864c": { + "name": "sellTokenForEth", + "event": "0x4be05c8d54f5e056ab2cfa033e9f582057001268c3e28561bb999d35d2c8f2c8", + "taker": "substr(input , 4 + 32*4 + 12 + 1 , 20)", + "taker_asset": "substr(input , 4 + 32*0 + 12 + 1 , 20)", + "maker_max_amount": "substr(input , 4 + 32*2 + 1 , 32)", + "taker_max_amount": "substr(input , 4 + 32*1 + 1 , 32)", + }, + "0x27a9b424": { + "name": "sellEthForToken", + "event": "0x4be05c8d54f5e056ab2cfa033e9f582057001268c3e28561bb999d35d2c8f2c8", + "taker": "substr(input , 4 + 32*4 + 12 + 1 , 20)", + "maker_asset": "substr(input , 4 + 32*0 + 12 + 1 , 20)", + "taker_max_amount": "substr(input , 4 + 32*2 + 1 , 32)", + "maker_max_amount": "substr(input , 4 + 32*1 + 1 , 32)", + }, + "0x3b26e4eb": { + "name": "transmitAndSwap", + "event": "0x4be05c8d54f5e056ab2cfa033e9f582057001268c3e28561bb999d35d2c8f2c8", + "taker": "substr(input , 4 + 32*5 + 12 + 1 , 20)", + "maker_asset": "substr(input , 4 + 32*1 + 12 + 1 , 20)", + "taker_asset": "substr(input , 4 + 32*0 + 12 + 1 , 20)", + "maker_max_amount": "substr(input , 4 + 32*3 + 1 , 32)", + "taker_max_amount": "substr(input , 4 + 32*2 + 1 , 32)", + }, + }, + "Swaap": { + "0x52bbbe29": { + "name": "swap", + "event": "0x2170c741c41531aec20e7c107c24eecfdd15e69c9bb0a8dd37b1840b9e0b207b", + "taker": "substr(input , 4 + 32*3 + 12 + 1 , 20)", + "maker_asset": "substr(input , 4 + 32*10 + 12 + 1 , 20)", + "taker_asset": "substr(input , 4 + 32*9 + 12 + 1 , 20)", + "taker_max_amount": "substr(input , 4 + 32*11 + 1 , 32)", + "making_amount": "cast(abs(bytearray_to_int256(substr(output, 32*0 + 1, 32))) as varbinary)", + "taking_amount": "if(length(output) > 32, substr(output, 32 * 1 + 1, 32))", + }, + }, + "Paraswap": { + "0x98f9b46b": { + "name": "fillOrder", + "event": "0x6621486d9c28838df4a87d2cca5007bc2aaf6a5b5de083b1db8faf709302c473", + "maker": "substr(input , 4 + 32*4 + 12 + 1 , 20)", + "maker_asset": "substr(input , 4 + 32*2 + 12 + 1 , 20)", + "taker_asset": "substr(input , 4 + 32*3 + 12 + 1 , 20)", + "maker_max_amount": "substr(input , 4 + 32*6 + 1 , 32)", + "taker_max_amount": "substr(input , 4 + 32*7 + 1 , 32)", + }, + "0xc88ae6dc": { + "name": "partialFillOrder", + "event": "0x6621486d9c28838df4a87d2cca5007bc2aaf6a5b5de083b1db8faf709302c473", + "maker": "substr(input , 4 + 32*4 + 12 + 1 , 20)", + "maker_asset": "substr(input , 4 + 32*2 + 12 + 1 , 20)", + "taker_asset": "substr(input , 4 + 32*3 + 12 + 1 , 20)", + "maker_max_amount": "substr(input , 4 + 32*6 + 1 , 32)", + "taker_max_amount": "substr(input , 4 + 32*7 + 1 , 32)", + "making_amount": "substr(output , 32*0 + 1 , 32)", + }, + "0x24abf828": { + "name": "partialFillOrderWithTarget", + "event": "0x6621486d9c28838df4a87d2cca5007bc2aaf6a5b5de083b1db8faf709302c473", + "maker": "substr(input , 4 + 32*4 + 12 + 1 , 20)", + "maker_asset": "substr(input , 4 + 32*2 + 12 + 1 , 20)", + "taker_asset": "substr(input , 4 + 32*3 + 12 + 1 , 20)", + "maker_max_amount": "substr(input , 4 + 32*6 + 1 , 32)", + "taker_max_amount": "substr(input , 4 + 32*7 + 1 , 32)", + "making_amount": "substr(output , 32*0 + 1 , 32)", + }, + }, + "CoWSwap": { + "0x13d79a0b": { + "name": "settle", + "event": "0xa07a543ab8a018198e99ca0184c93fe9050a79400a0a723441f84de1d972cc17", + "number": "coalesce(try(bytearray_to_bigint(substr(input, 4 + bytearray_to_bigint(substr(input, 4 + 32*2 + 24 + 1, 8)) + 24 + 1, 8))), 1)", + "_order_beginning": "4 + bytearray_to_bigint(substr(input, 4 + 32*2 + 24 + 1, 8)) + 32*1 + bytearray_to_bigint(substr(input, 4 + bytearray_to_bigint(substr(input, 4 + 32*2 + 24 + 1, 8)) + 32*x + 24 + 1, 8))", + "maker_asset": "substr(input, 4 + bytearray_to_bigint(substr(input, 4 + 24 + 1, 8)) + 32*(bytearray_to_bigint(substr(input, 4 + bytearray_to_bigint(substr(input, 4 + 32*2 + 24 + 1, 8)) + 32*1 + bytearray_to_bigint(substr(input, 4 + bytearray_to_bigint(substr(input, 4 + 32*2 + 24 + 1, 8)) + 32*x + 24 + 1, 8)) + 32*0 + 24 + 1, 8)) + 1) + 12 + 1, 20)", + "taker_asset": "substr(input, 4 + bytearray_to_bigint(substr(input, 4 + 24 + 1, 8)) + 32*(bytearray_to_bigint(substr(input, 4 + bytearray_to_bigint(substr(input, 4 + 32*2 + 24 + 1, 8)) + 32*1 + bytearray_to_bigint(substr(input, 4 + bytearray_to_bigint(substr(input, 4 + 32*2 + 24 + 1, 8)) + 32*x + 24 + 1, 8)) + 32*1 + 24 + 1, 8)) + 1) + 12 + 1, 20)", + "receiver": "substr(input, 4 + bytearray_to_bigint(substr(input, 4 + 32*2 + 24 + 1, 8)) + 32*1 + bytearray_to_bigint(substr(input, 4 + bytearray_to_bigint(substr(input, 4 + 32*2 + 24 + 1, 8)) + 32*x + 24 + 1, 8)) + 32*2 + 12 + 1, 20)", + "maker_max_amount": "substr(input, 4 + bytearray_to_bigint(substr(input, 4 + 32*2 + 24 + 1, 8)) + 32*1 + bytearray_to_bigint(substr(input, 4 + bytearray_to_bigint(substr(input, 4 + 32*2 + 24 + 1, 8)) + 32*x + 24 + 1, 8)) + 32*3 + 1, 32)", + "taker_max_amount": "substr(input, 4 + bytearray_to_bigint(substr(input, 4 + 32*2 + 24 + 1, 8)) + 32*1 + bytearray_to_bigint(substr(input, 4 + bytearray_to_bigint(substr(input, 4 + 32*2 + 24 + 1, 8)) + 32*x + 24 + 1, 8)) + 32*4 + 1, 32)", + "deadline": "substr(input, 4 + bytearray_to_bigint(substr(input, 4 + 32*2 + 24 + 1, 8)) + 32*1 + bytearray_to_bigint(substr(input, 4 + bytearray_to_bigint(substr(input, 4 + 32*2 + 24 + 1, 8)) + 32*x + 24 + 1, 8)) + 32*5 + 24, 8)", + "fee_amount": "substr(input, 4 + bytearray_to_bigint(substr(input, 4 + 32*2 + 24 + 1, 8)) + 32*1 + bytearray_to_bigint(substr(input, 4 + bytearray_to_bigint(substr(input, 4 + 32*2 + 24 + 1, 8)) + 32*x + 24 + 1, 8)) + 32*7 + 1, 32)", + "making_amount": "substr(input, 4 + bytearray_to_bigint(substr(input, 4 + 32*2 + 24 + 1, 8)) + 32*1 + bytearray_to_bigint(substr(input, 4 + bytearray_to_bigint(substr(input, 4 + 32*2 + 24 + 1, 8)) + 32*x + 24 + 1, 8)) + 32*9 + 1, 32)", + }, + }, + "UniswapX": { + "0x3f62192e": { + "name": "execute", + "event": "0x78ad7ec0e9f89e74012afa58738b6b661c024cb0fd185ee2f616c0a28924bd66", + "maker": "substr(input , 4 + 32*15 + 12 + 1 , 20)", + "receiver": "substr(input, 4 + 32*4 + bytearray_to_bigint(substr(input, 4 + 32*13 + 24 + 1, 8)) + 32*5 + 12 + 1, 20)", + "maker_asset": "substr(input , 4 + 32*10 + 12 + 1 , 20)", + "taker_asset": "substr(input, 4 + 32*4 + bytearray_to_bigint(substr(input, 4 + 32*13 + 24 + 1, 8)) + 32*2 + 12 + 1, 20)", + "maker_max_amount": "substr(input , 4 + 32*11 + 1 , 32)", + "maker_min_amount": "substr(input , 4 + 32*12 + 1 , 32)", + "taker_max_amount": "substr(input, 4 + 32*4 + bytearray_to_bigint(substr(input, 4 + 32*13 + 24 + 1, 8)) + 32*3 + 1, 32)", + "taker_min_amount": "substr(input, 4 + 32*4 + bytearray_to_bigint(substr(input, 4 + 32*13 + 24 + 1, 8)) + 32*4 + 1, 32)", + "start": "substr(input , 4 + 32*6 + 1 , 32)", + "end": "substr(input , 4 + 32*7 + 1 , 32)", + "deadline": "cast(abs(bytearray_to_int256(substr(input, 4 + 32*17 + 1, 32))) as varbinary)", + "nonce": "substr(input , 4 + 32*16 + 1 , 32)", + "fee_asset": "if(bytearray_to_bigint(substr(input, 4 + 32*4 + bytearray_to_bigint(substr(input, 4 + 32*13 + 24 + 1, 8)) + 32*1 + 24 + 1, 8)) > 1, substr(input, 4 + 32*4 + bytearray_to_bigint(substr(input, 4 + 32*13 + 24 + 1, 8)) + 32*6 + 12 + 1, 20))", + "fee_max_amount": "if(bytearray_to_bigint(substr(input, 4 + 32*4 + bytearray_to_bigint(substr(input, 4 + 32*13 + 24 + 1, 8)) + 32*1 + 24 + 1, 8)) > 1, substr(input, 4 + 32*4 + bytearray_to_bigint(substr(input, 4 + 32*13 + 24 + 1, 8)) + 32*7 + 1, 32))", + "fee_min_amount": "if(bytearray_to_bigint(substr(input, 4 + 32*4 + bytearray_to_bigint(substr(input, 4 + 32*13 + 24 + 1, 8)) + 32*1 + 24 + 1, 8)) > 1, substr(input, 4 + 32*4 + bytearray_to_bigint(substr(input, 4 + 32*13 + 24 + 1, 8)) + 32*8 + 1, 32))", + "fee_receiver": "if(bytearray_to_bigint(substr(input, 4 + 32*4 + bytearray_to_bigint(substr(input, 4 + 32*13 + 24 + 1, 8)) + 32*1 + 24 + 1, 8)) > 1, substr(input, 4 + 32*4 + bytearray_to_bigint(substr(input, 4 + 32*13 + 24 + 1, 8)) + 32*9 + 12 + 1, 20))", + }, + "0x0d335884": { + "name": "executeWithCallback", + "event": "0x78ad7ec0e9f89e74012afa58738b6b661c024cb0fd185ee2f616c0a28924bd66", + "maker": "substr(input , 4 + 32*16 + 12 + 1 , 20)", + "receiver": "substr(input, 4 + 32*5 + bytearray_to_bigint(substr(input, 4 + 32*14 + 24 + 1, 8)) + 32*5 + 12 + 1, 20)", + "maker_asset": "substr(input , 4 + 32*11 + 12 + 1 , 20)", + "taker_asset": "substr(input, 4 + 32*5 + bytearray_to_bigint(substr(input, 4 + 32*14 + 24 + 1, 8)) + 32*2 + 12 + 1, 20)", + "maker_max_amount": "substr(input , 4 + 32*12 + 1 , 32)", + "maker_min_amount": "substr(input , 4 + 32*13 + 1 , 32)", + "taker_max_amount": "substr(input, 4 + 32*5 + bytearray_to_bigint(substr(input, 4 + 32*14 + 24 + 1, 8)) + 32*3 + 1, 32)", + "taker_min_amount": "substr(input, 4 + 32*5 + bytearray_to_bigint(substr(input, 4 + 32*14 + 24 + 1, 8)) + 32*4 + 1, 32)", + "start": "substr(input , 4 + 32*7 + 1 , 32)", + "end": "substr(input , 4 + 32*8 + 1 , 32)", + "deadline": "cast(abs(bytearray_to_int256(substr(input, 4 + 32*18 + 1, 32))) as varbinary)", + "nonce": "substr(input , 4 + 32*17 + 1 , 32)", + "fee_asset": "if(bytearray_to_bigint(substr(input, 4 + 32*5 + bytearray_to_bigint(substr(input, 4 + 32*14 + 24 + 1, 8)) + 32*1 + 24 + 1, 8)) > 1, substr(input, 4 + 32*5 + bytearray_to_bigint(substr(input, 4 + 32*14 + 24 + 1, 8)) + 32*6 + 12 + 1, 20))", + "fee_max_amount": "if(bytearray_to_bigint(substr(input, 4 + 32*5 + bytearray_to_bigint(substr(input, 4 + 32*14 + 24 + 1, 8)) + 32*1 + 24 + 1, 8)) > 1, substr(input, 4 + 32*5 + bytearray_to_bigint(substr(input, 4 + 32*14 + 24 + 1, 8)) + 32*7 + 1, 32))", + "fee_min_amount": "if(bytearray_to_bigint(substr(input, 4 + 32*5 + bytearray_to_bigint(substr(input, 4 + 32*14 + 24 + 1, 8)) + 32*1 + 24 + 1, 8)) > 1, substr(input, 4 + 32*5 + bytearray_to_bigint(substr(input, 4 + 32*14 + 24 + 1, 8)) + 32*8 + 1, 32))", + "fee_receiver": "if(bytearray_to_bigint(substr(input, 4 + 32*5 + bytearray_to_bigint(substr(input, 4 + 32*14 + 24 + 1, 8)) + 32*1 + 24 + 1, 8)) > 1, substr(input, 4 + 32*5 + bytearray_to_bigint(substr(input, 4 + 32*14 + 24 + 1, 8)) + 32*9 + 12 + 1, 20))", + }, + "0x0d7a16c3": { + "name": "executeBatch", + "event": "0x78ad7ec0e9f89e74012afa58738b6b661c024cb0fd185ee2f616c0a28924bd66", + "number": "coalesce(try(bytearray_to_bigint(substr(input, 4 + bytearray_to_bigint(substr(input, 4 + 24 + 1, 8)) + 24 + 1, 8))), 1)", + "_order_beginning": "4 + 32*2 + bytearray_to_bigint(substr(input, 4 + 32*2 + 32*(x - 1) + 24 + 1, 8))", + "maker": "substr(input, 4 + 32*2 + bytearray_to_bigint(substr(input, 4 + 32*2 + 32*(x - 1) + 24 + 1, 8)) + 32*14 + 12 + 1, 20)", + "receiver": "substr(input, 4 + 32*2 + bytearray_to_bigint(substr(input, 4 + 32*2 + 32*(x - 1) + 24 + 1, 8)) + bytearray_to_bigint(substr(input, 4 + 32*2 + bytearray_to_bigint(substr(input, 4 + 32*2 + 32*(x - 1) + 24 + 1, 8)) + 32*12 + 24 + 1, 8)) + 32*8 + 12 + 1, 20)", + "maker_asset": "substr(input, 4 + 32*2 + bytearray_to_bigint(substr(input, 4 + 32*2 + 32*(x - 1) + 24 + 1, 8)) + 32*9 + 12 + 1, 20)", + "taker_asset": "substr(input, 4 + 32*2 + bytearray_to_bigint(substr(input, 4 + 32*2 + 32*(x - 1) + 24 + 1, 8)) + bytearray_to_bigint(substr(input, 4 + 32*2 + bytearray_to_bigint(substr(input, 4 + 32*2 + 32*(x - 1) + 24 + 1, 8)) + 32*12 + 24 + 1, 8)) + 32*5 + 12 + 1, 20)", + "maker_max_amount": "substr(input, 4 + 32*2 + bytearray_to_bigint(substr(input, 4 + 32*2 + 32*(x - 1) + 24 + 1, 8)) + 32*10 + 1, 32)", + "maker_min_amount": "substr(input, 4 + 32*2 + bytearray_to_bigint(substr(input, 4 + 32*2 + 32*(x - 1) + 24 + 1, 8)) + 32*11 + 1, 32)", + "taker_max_amount": "substr(input, 4 + 32*2 + bytearray_to_bigint(substr(input, 4 + 32*2 + 32*(x - 1) + 24 + 1, 8)) + bytearray_to_bigint(substr(input, 4 + 32*2 + bytearray_to_bigint(substr(input, 4 + 32*2 + 32*(x - 1) + 24 + 1, 8)) + 32*12 + 24 + 1, 8)) + 32*6 + 1, 32)", + "taker_min_amount": "substr(input, 4 + 32*2 + bytearray_to_bigint(substr(input, 4 + 32*2 + 32*(x - 1) + 24 + 1, 8)) + bytearray_to_bigint(substr(input, 4 + 32*2 + bytearray_to_bigint(substr(input, 4 + 32*2 + 32*(x - 1) + 24 + 1, 8)) + 32*12 + 24 + 1, 8)) + 32*7 + 1, 32)", + "start": "substr(input, 4 + 32*2 + bytearray_to_bigint(substr(input, 4 + 32*2 + 32*(x - 1) + 24 + 1, 8)) + 32*5 + 1, 20)", + "end": "substr(input, 4 + 32*2 + bytearray_to_bigint(substr(input, 4 + 32*2 + 32*(x - 1) + 24 + 1, 8)) + 32*6 + 1, 20)", + "deadline": "cast(abs(bytearray_to_int256(substr(input, 4 + 32*2 + bytearray_to_bigint(substr(input, 4 + 32*2 + 32*(x - 1) + 24 + 1, 8)) + 32*16 + 1, 32))) as varbinary)", + "nonce": "substr(input, 4 + 32*2 + bytearray_to_bigint(substr(input, 4 + 32*2 + 32*(x - 1) + 24 + 1, 8)) + 32*15 + 1, 32)", + "fee_asset": "if(bytearray_to_bigint(substr(input, 4 + 32*2 + bytearray_to_bigint(substr(input, 4 + 32*2 + 32*(x - 1) + 24 + 1, 8)) + bytearray_to_bigint(substr(input, 4 + 32*2 + bytearray_to_bigint(substr(input, 4 + 32*2 + 32*(x - 1) + 24 + 1, 8)) + 32*12 + 24 + 1, 8)) + 32*4 + 24 + 1, 8)) > 1, substr(input, 4 + 32*2 + bytearray_to_bigint(substr(input, 4 + 32*2 + 32*(x - 1) + 24 + 1, 8)) + bytearray_to_bigint(substr(input, 4 + 32*2 + bytearray_to_bigint(substr(input, 4 + 32*2 + 32*(x - 1) + 24 + 1, 8)) + 32*12 + 24 + 1, 8)) + 32*9 + 12 + 1, 20))", + "fee_max_amount": "if(bytearray_to_bigint(substr(input, 4 + 32*2 + bytearray_to_bigint(substr(input, 4 + 32*2 + 32*(x - 1) + 24 + 1, 8)) + bytearray_to_bigint(substr(input, 4 + 32*2 + bytearray_to_bigint(substr(input, 4 + 32*2 + 32*(x - 1) + 24 + 1, 8)) + 32*12 + 24 + 1, 8)) + 32*4 + 24 + 1, 8)) > 1, substr(input, 4 + 32*2 + bytearray_to_bigint(substr(input, 4 + 32*2 + 32*(x - 1) + 24 + 1, 8)) + bytearray_to_bigint(substr(input, 4 + 32*2 + bytearray_to_bigint(substr(input, 4 + 32*2 + 32*(x - 1) + 24 + 1, 8)) + 32*12 + 24 + 1, 8)) + 32*10 + 1, 32))", + "fee_min_amount": "if(bytearray_to_bigint(substr(input, 4 + 32*2 + bytearray_to_bigint(substr(input, 4 + 32*2 + 32*(x - 1) + 24 + 1, 8)) + bytearray_to_bigint(substr(input, 4 + 32*2 + bytearray_to_bigint(substr(input, 4 + 32*2 + 32*(x - 1) + 24 + 1, 8)) + 32*12 + 24 + 1, 8)) + 32*4 + 24 + 1, 8)) > 1, substr(input, 4 + 32*2 + bytearray_to_bigint(substr(input, 4 + 32*2 + 32*(x - 1) + 24 + 1, 8)) + bytearray_to_bigint(substr(input, 4 + 32*2 + bytearray_to_bigint(substr(input, 4 + 32*2 + 32*(x - 1) + 24 + 1, 8)) + 32*12 + 24 + 1, 8)) + 32*11 + 1, 32))", + "fee_receiver": "if(bytearray_to_bigint(substr(input, 4 + 32*2 + bytearray_to_bigint(substr(input, 4 + 32*2 + 32*(x - 1) + 24 + 1, 8)) + bytearray_to_bigint(substr(input, 4 + 32*2 + bytearray_to_bigint(substr(input, 4 + 32*2 + 32*(x - 1) + 24 + 1, 8)) + 32*12 + 24 + 1, 8)) + 32*4 + 24 + 1, 8)) > 1, substr(input, 4 + 32*2 + bytearray_to_bigint(substr(input, 4 + 32*2 + 32*(x - 1) + 24 + 1, 8)) + bytearray_to_bigint(substr(input, 4 + 32*2 + bytearray_to_bigint(substr(input, 4 + 32*2 + 32*(x - 1) + 24 + 1, 8)) + 32*12 + 24 + 1, 8)) + 32*12 + 12 + 1, 20))", + }, + "0x13fb72c7": { + "name": "executeBatchWithCallback", + "event": "0x78ad7ec0e9f89e74012afa58738b6b661c024cb0fd185ee2f616c0a28924bd66", + "number": "coalesce(try(bytearray_to_bigint(substr(input, 4 + bytearray_to_bigint(substr(input, 4 + 24 + 1, 8)) + 24 + 1, 8))), 1)", + "_order_beginning": "4 + bytearray_to_bigint(substr(input, 4 + 24 + 1, 8)) + 32*1 + bytearray_to_bigint(substr(input, 4 + bytearray_to_bigint(substr(input, 4 + 24 + 1, 8)) + 32*1 + 32*(x - 1) + 24 + 1, 8))", + "maker": "substr(input, 4 + bytearray_to_bigint(substr(input, 4 + 24 + 1, 8)) + 32*1 + bytearray_to_bigint(substr(input, 4 + bytearray_to_bigint(substr(input, 4 + 24 + 1, 8)) + 32*1 + 32*(x - 1) + 24 + 1, 8)) + 32*14 + 12 + 1, 20)", + "receiver": "substr(input, 4 + bytearray_to_bigint(substr(input, 4 + 24 + 1, 8)) + 32*1 + bytearray_to_bigint(substr(input, 4 + bytearray_to_bigint(substr(input, 4 + 24 + 1, 8)) + 32*1 + 32*(x - 1) + 24 + 1, 8)) + bytearray_to_bigint(substr(input, 4 + bytearray_to_bigint(substr(input, 4 + 24 + 1, 8)) + 32*1 + bytearray_to_bigint(substr(input, 4 + bytearray_to_bigint(substr(input, 4 + 24 + 1, 8)) + 32*1 + 32*(x - 1) + 24 + 1, 8)) + 32*12 + 24 + 1, 8)) + 32*8 + 12 + 1, 20)", + "maker_asset": "substr(input, 4 + bytearray_to_bigint(substr(input, 4 + 24 + 1, 8)) + 32*1 + bytearray_to_bigint(substr(input, 4 + bytearray_to_bigint(substr(input, 4 + 24 + 1, 8)) + 32*1 + 32*(x - 1) + 24 + 1, 8)) + 32*9 + 12 + 1, 20)", + "taker_asset": "substr(input, 4 + bytearray_to_bigint(substr(input, 4 + 24 + 1, 8)) + 32*1 + bytearray_to_bigint(substr(input, 4 + bytearray_to_bigint(substr(input, 4 + 24 + 1, 8)) + 32*1 + 32*(x - 1) + 24 + 1, 8)) + bytearray_to_bigint(substr(input, 4 + bytearray_to_bigint(substr(input, 4 + 24 + 1, 8)) + 32*1 + bytearray_to_bigint(substr(input, 4 + bytearray_to_bigint(substr(input, 4 + 24 + 1, 8)) + 32*1 + 32*(x - 1) + 24 + 1, 8)) + 32*12 + 24 + 1, 8)) + 32*5 + 12 + 1, 20)", + "maker_max_amount": "substr(input, 4 + bytearray_to_bigint(substr(input, 4 + 24 + 1, 8)) + 32*1 + bytearray_to_bigint(substr(input, 4 + bytearray_to_bigint(substr(input, 4 + 24 + 1, 8)) + 32*1 + 32*(x - 1) + 24 + 1, 8)) + 32*10 + 1, 32)", + "maker_min_amount": "substr(input, 4 + bytearray_to_bigint(substr(input, 4 + 24 + 1, 8)) + 32*1 + bytearray_to_bigint(substr(input, 4 + bytearray_to_bigint(substr(input, 4 + 24 + 1, 8)) + 32*1 + 32*(x - 1) + 24 + 1, 8)) + 32*11 + 1, 32)", + "taker_max_amount": "substr(input, 4 + bytearray_to_bigint(substr(input, 4 + 24 + 1, 8)) + 32*1 + bytearray_to_bigint(substr(input, 4 + bytearray_to_bigint(substr(input, 4 + 24 + 1, 8)) + 32*1 + 32*(x - 1) + 24 + 1, 8)) + bytearray_to_bigint(substr(input, 4 + bytearray_to_bigint(substr(input, 4 + 24 + 1, 8)) + 32*1 + bytearray_to_bigint(substr(input, 4 + bytearray_to_bigint(substr(input, 4 + 24 + 1, 8)) + 32*1 + 32*(x - 1) + 24 + 1, 8)) + 32*12 + 24 + 1, 8)) + 32*6 + 1, 32)", + "taker_min_amount": "substr(input, 4 + bytearray_to_bigint(substr(input, 4 + 24 + 1, 8)) + 32*1 + bytearray_to_bigint(substr(input, 4 + bytearray_to_bigint(substr(input, 4 + 24 + 1, 8)) + 32*1 + 32*(x - 1) + 24 + 1, 8)) + bytearray_to_bigint(substr(input, 4 + bytearray_to_bigint(substr(input, 4 + 24 + 1, 8)) + 32*1 + bytearray_to_bigint(substr(input, 4 + bytearray_to_bigint(substr(input, 4 + 24 + 1, 8)) + 32*1 + 32*(x - 1) + 24 + 1, 8)) + 32*12 + 24 + 1, 8)) + 32*7 + 1, 32)", + "start": "substr(input, 4 + bytearray_to_bigint(substr(input, 4 + 24 + 1, 8)) + 32*1 + bytearray_to_bigint(substr(input, 4 + bytearray_to_bigint(substr(input, 4 + 24 + 1, 8)) + 32*1 + 32*(x - 1) + 24 + 1, 8)) + 32*5 + 1, 20)", + "end": "substr(input, 4 + bytearray_to_bigint(substr(input, 4 + 24 + 1, 8)) + 32*1 + bytearray_to_bigint(substr(input, 4 + bytearray_to_bigint(substr(input, 4 + 24 + 1, 8)) + 32*1 + 32*(x - 1) + 24 + 1, 8)) + 32*6 + 1, 20)", + "deadline": "cast(abs(bytearray_to_int256(substr(input, 4 + bytearray_to_bigint(substr(input, 4 + 24 + 1, 8)) + 32*1 + bytearray_to_bigint(substr(input, 4 + bytearray_to_bigint(substr(input, 4 + 24 + 1, 8)) + 32*1 + 32*(x - 1) + 24 + 1, 8)) + 32*16 + 1, 32))) as varbinary)", + "nonce": "substr(input, 4 + bytearray_to_bigint(substr(input, 4 + 24 + 1, 8)) + 32*1 + bytearray_to_bigint(substr(input, 4 + bytearray_to_bigint(substr(input, 4 + 24 + 1, 8)) + 32*1 + 32*(x - 1) + 24 + 1, 8)) + 32*15 + 1, 32)", + "fee_asset": "if(bytearray_to_bigint(substr(input, 4 + bytearray_to_bigint(substr(input, 4 + 24 + 1, 8)) + 32*1 + bytearray_to_bigint(substr(input, 4 + bytearray_to_bigint(substr(input, 4 + 24 + 1, 8)) + 32*1 + 32*(x - 1) + 24 + 1, 8)) + bytearray_to_bigint(substr(input, 4 + bytearray_to_bigint(substr(input, 4 + 24 + 1, 8)) + 32*1 + bytearray_to_bigint(substr(input, 4 + bytearray_to_bigint(substr(input, 4 + 24 + 1, 8)) + 32*1 + 32*(x - 1) + 24 + 1, 8)) + 32*12 + 24 + 1, 8)) + 32*4 + 24 + 1, 8)) > 1, substr(input, 4 + bytearray_to_bigint(substr(input, 4 + 24 + 1, 8)) + 32*1 + bytearray_to_bigint(substr(input, 4 + bytearray_to_bigint(substr(input, 4 + 24 + 1, 8)) + 32*1 + 32*(x - 1) + 24 + 1, 8)) + bytearray_to_bigint(substr(input, 4 + bytearray_to_bigint(substr(input, 4 + 24 + 1, 8)) + 32*1 + bytearray_to_bigint(substr(input, 4 + bytearray_to_bigint(substr(input, 4 + 24 + 1, 8)) + 32*1 + 32*(x - 1) + 24 + 1, 8)) + 32*12 + 24 + 1, 8)) + 32*9 + 12 + 1, 20))", + "fee_max_amount": "if(bytearray_to_bigint(substr(input, 4 + bytearray_to_bigint(substr(input, 4 + 24 + 1, 8)) + 32*1 + bytearray_to_bigint(substr(input, 4 + bytearray_to_bigint(substr(input, 4 + 24 + 1, 8)) + 32*1 + 32*(x - 1) + 24 + 1, 8)) + bytearray_to_bigint(substr(input, 4 + bytearray_to_bigint(substr(input, 4 + 24 + 1, 8)) + 32*1 + bytearray_to_bigint(substr(input, 4 + bytearray_to_bigint(substr(input, 4 + 24 + 1, 8)) + 32*1 + 32*(x - 1) + 24 + 1, 8)) + 32*12 + 24 + 1, 8)) + 32*4 + 24 + 1, 8)) > 1, substr(input, 4 + bytearray_to_bigint(substr(input, 4 + 24 + 1, 8)) + 32*1 + bytearray_to_bigint(substr(input, 4 + bytearray_to_bigint(substr(input, 4 + 24 + 1, 8)) + 32*1 + 32*(x - 1) + 24 + 1, 8)) + bytearray_to_bigint(substr(input, 4 + bytearray_to_bigint(substr(input, 4 + 24 + 1, 8)) + 32*1 + bytearray_to_bigint(substr(input, 4 + bytearray_to_bigint(substr(input, 4 + 24 + 1, 8)) + 32*1 + 32*(x - 1) + 24 + 1, 8)) + 32*12 + 24 + 1, 8)) + 32*10 + 1, 32))", + "fee_min_amount": "if(bytearray_to_bigint(substr(input, 4 + bytearray_to_bigint(substr(input, 4 + 24 + 1, 8)) + 32*1 + bytearray_to_bigint(substr(input, 4 + bytearray_to_bigint(substr(input, 4 + 24 + 1, 8)) + 32*1 + 32*(x - 1) + 24 + 1, 8)) + bytearray_to_bigint(substr(input, 4 + bytearray_to_bigint(substr(input, 4 + 24 + 1, 8)) + 32*1 + bytearray_to_bigint(substr(input, 4 + bytearray_to_bigint(substr(input, 4 + 24 + 1, 8)) + 32*1 + 32*(x - 1) + 24 + 1, 8)) + 32*12 + 24 + 1, 8)) + 32*4 + 24 + 1, 8)) > 1, substr(input, 4 + bytearray_to_bigint(substr(input, 4 + 24 + 1, 8)) + 32*1 + bytearray_to_bigint(substr(input, 4 + bytearray_to_bigint(substr(input, 4 + 24 + 1, 8)) + 32*1 + 32*(x - 1) + 24 + 1, 8)) + bytearray_to_bigint(substr(input, 4 + bytearray_to_bigint(substr(input, 4 + 24 + 1, 8)) + 32*1 + bytearray_to_bigint(substr(input, 4 + bytearray_to_bigint(substr(input, 4 + 24 + 1, 8)) + 32*1 + 32*(x - 1) + 24 + 1, 8)) + 32*12 + 24 + 1, 8)) + 32*11 + 1, 32))", + "fee_receiver": "if(bytearray_to_bigint(substr(input, 4 + bytearray_to_bigint(substr(input, 4 + 24 + 1, 8)) + 32*1 + bytearray_to_bigint(substr(input, 4 + bytearray_to_bigint(substr(input, 4 + 24 + 1, 8)) + 32*1 + 32*(x - 1) + 24 + 1, 8)) + bytearray_to_bigint(substr(input, 4 + bytearray_to_bigint(substr(input, 4 + 24 + 1, 8)) + 32*1 + bytearray_to_bigint(substr(input, 4 + bytearray_to_bigint(substr(input, 4 + 24 + 1, 8)) + 32*1 + 32*(x - 1) + 24 + 1, 8)) + 32*12 + 24 + 1, 8)) + 32*4 + 24 + 1, 8)) > 1, substr(input, 4 + bytearray_to_bigint(substr(input, 4 + 24 + 1, 8)) + 32*1 + bytearray_to_bigint(substr(input, 4 + bytearray_to_bigint(substr(input, 4 + 24 + 1, 8)) + 32*1 + 32*(x - 1) + 24 + 1, 8)) + bytearray_to_bigint(substr(input, 4 + bytearray_to_bigint(substr(input, 4 + 24 + 1, 8)) + 32*1 + bytearray_to_bigint(substr(input, 4 + bytearray_to_bigint(substr(input, 4 + 24 + 1, 8)) + 32*1 + 32*(x - 1) + 24 + 1, 8)) + 32*12 + 24 + 1, 8)) + 32*12 + 12 + 1, 20))", + }, + }, + "Bebop": { + "0x1a499026": { + "name": "settleSingle", + "event": "0xadd7095becdaa725f0f33243630938c861b0bba83dfd217d4055701aa768ec2e", + "maker": "substr(input , 4 + 32*2 + 12 + 1 , 32)", + "taker": "substr(input , 4 + 32*1 + 12 + 1 , 32)", + "receiver": "substr(input , 4 + 32*8 + 12 + 1 , 32)", + "maker_asset": "substr(input , 4 + 32*5 + 12 + 1 , 32)", + "taker_asset": "substr(input , 4 + 32*4 + 12 + 1 , 32)", + "maker_max_amount": "substr(input , 4 + 32*7 + 1 , 32)", + "taker_max_amount": "substr(input , 4 + 32*6 + 1 , 32)", + "making_amount": "substr(input , 4 + 32*14 + 1 , 32)", + "taking_amount": "if(bytearray_to_bigint(substr(input, 4 + 32*13 + 24 + 1, 8)) = 1, substr(input, 4 + 32*6 + 1, 32), substr(input, 4 + 32*12 + 1, 32))", + "deadline": "substr(input , 4 + 32*1 + 24 + 1 , 8)", + "nonce": "substr(input , 4 + 32*3 + 1 , 32)", + "order_hash": "substr(input , 4 + 32*10 + 1 , 16)", + }, + "0x38ec0211": { + "name": "settleSingleAndSignPermit2", + "event": "0xadd7095becdaa725f0f33243630938c861b0bba83dfd217d4055701aa768ec2e", + "maker": "substr(input , 4 + 32*2 + 12 + 1 , 32)", + "taker": "substr(input , 4 + 32*1 + 12 + 1 , 32)", + "receiver": "substr(input , 4 + 32*8 + 12 + 1 , 32)", + "maker_asset": "substr(input , 4 + 32*5 + 12 + 1 , 32)", + "taker_asset": "substr(input , 4 + 32*4 + 12 + 1 , 32)", + "maker_max_amount": "substr(input , 4 + 32*7 + 1 , 32)", + "taker_max_amount": "substr(input , 4 + 32*6 + 1 , 32)", + "making_amount": "substr(input , 4 + 32*14 + 1 , 32)", + "taking_amount": "if(bytearray_to_bigint(substr(input, 4 + 32*13 + 24 + 1, 8)) = 1, substr(input, 4 + 32*6 + 1, 32), substr(input, 4 + 32*12 + 1, 32))", + "deadline": "substr(input , 4 + 32*1 + 24 + 1 , 8)", + "nonce": "substr(input , 4 + 32*3 + 1 , 32)", + "order_hash": "substr(input , 4 + 32*10 + 1 , 16)", + }, + "0xefe34fe6": { + "name": "settleMulti", + "event": "0xadd7095becdaa725f0f33243630938c861b0bba83dfd217d4055701aa768ec2e", + "_order_beginning": "4 + bytearray_to_bigint(substr(input, 4 + 24 + 1, 8))", + "number": "coalesce(try(greatest(bytearray_to_bigint(substr(input, 4 + bytearray_to_bigint(substr(input, 4 + 24 + 1, 8)) + 32*4 + 24 + 1, 8)), bytearray_to_bigint(substr(input, 4 + bytearray_to_bigint(substr(input, 4 + 24 + 1, 8)) + 32*5 + 24 + 1, 8)))), 1)", + "maker": "substr(input, 4 + bytearray_to_bigint(substr(input, 4 + 24 + 1, 8)) + 32*2 + 12 + 1, 32)", + "taker": "substr(input, 4 + bytearray_to_bigint(substr(input, 4 + 24 + 1, 8)) + 32*1 + 12 + 1, 32)", + "receiver": "substr(input, 4 + bytearray_to_bigint(substr(input, 4 + 24 + 1, 8)) + 32*8 + 12 + 1, 32)", + "maker_asset": "substr(input, 4 + bytearray_to_bigint(substr(input, 4 + 24 + 1, 8)) + bytearray_to_bigint(substr(input, 4 + bytearray_to_bigint(substr(input, 4 + 24 + 1, 8)) + 32*5 + 24 + 1, 8)) + 32 * least(x, bytearray_to_bigint(substr(input, 4 + bytearray_to_bigint(substr(input, 4 + 24 + 1, 8)) + 32*5 + 24 + 1, 8))) + 12 + 1, 20)", + "taker_asset": "substr(input, 4 + bytearray_to_bigint(substr(input, 4 + 24 + 1, 8)) + bytearray_to_bigint(substr(input, 4 + bytearray_to_bigint(substr(input, 4 + 24 + 1, 8)) + 32*4 + 24 + 1, 8)) + 32 * least(x, bytearray_to_bigint(substr(input, 4 + bytearray_to_bigint(substr(input, 4 + 24 + 1, 8)) + 32*4 + 24 + 1, 8))) + 12 + 1, 20)", + "maker_max_amount": "substr(input, 4 + bytearray_to_bigint(substr(input, 4 + 24 + 1, 8)) + bytearray_to_bigint(substr(input, 4 + bytearray_to_bigint(substr(input, 4 + 24 + 1, 8)) + 32*7 + 24 + 1, 8)) + 32 * least(x, bytearray_to_bigint(substr(input, 4 + bytearray_to_bigint(substr(input, 4 + 24 + 1, 8)) + 32*7 + 24 + 1, 8))) + 1, 32)", + "taker_max_amount": "substr(input, 4 + bytearray_to_bigint(substr(input, 4 + 24 + 1, 8)) + bytearray_to_bigint(substr(input, 4 + bytearray_to_bigint(substr(input, 4 + 24 + 1, 8)) + 32*6 + 24 + 1, 8)) + 32 * least(x, bytearray_to_bigint(substr(input, 4 + bytearray_to_bigint(substr(input, 4 + 24 + 1, 8)) + 32*6 + 24 + 1, 8))) + 1, 32)", + "deadline": "substr(input, 4 + bytearray_to_bigint(substr(input, 4 + 24 + 1, 8)) + 32*1 + 24 + 1, 8)", + "nonce": "substr(input, 4 + bytearray_to_bigint(substr(input, 4 + 24 + 1, 8)) + 32*3 + 1, 32)", + "order_hash": "substr(input, 4 + bytearray_to_bigint(substr(input, 4 + 24 + 1, 8)) + 32*10 + 1, 16)", + } + }, + } +%} + +{% set wrapping = 'array[0x0000000000000000000000000000000000000000, 0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee, wrapped_native_token_address]' %} + +with + +logs as ( +{% for event, event_data in events.items() %} + select + block_number + , tx_hash + , index + , contract_address + , topic0 + , '{{event_data["name"]}}' as event + , {{ event_data.get("maker", "null") }} as log_maker + , {{ event_data.get("taker", "null") }} as log_taker + , {{ event_data.get("receiver", "null") }} as log_receiver + , {{ event_data.get("maker_asset", "null") }} as log_maker_asset + , {{ event_data.get("taker_asset", "null") }} as log_taker_asset + , try(bytearray_to_uint256({{ event_data.get("maker_max_amount", "null") }})) as log_maker_max_amount + , try(bytearray_to_uint256({{ event_data.get("taker_max_amount", "null") }})) as log_taker_max_amount + , try(bytearray_to_uint256({{ event_data.get("maker_min_amount", "null") }})) as log_maker_min_amount + , try(bytearray_to_uint256({{ event_data.get("taker_min_amount", "null") }})) as log_taker_min_amount + , try(bytearray_to_uint256({{ event_data.get("making_amount", "null") }})) as log_making_amount + , try(bytearray_to_uint256({{ event_data.get("taking_amount", "null") }})) as log_taking_amount + , try(bytearray_to_uint256({{ event_data.get("log_start", "null") }})) as log_start + , try(bytearray_to_uint256({{ event_data.get("log_end", "null") }})) as log_end + , try(bytearray_to_uint256({{ event_data.get("log_deadline", "null") }})) as log_deadline + , try(bytearray_to_uint256({{ event_data.get("maker_fee_amount", "null") }})) as log_maker_fee_amount + , try(bytearray_to_uint256({{ event_data.get("taker_fee_amount", "null") }})) as log_taker_fee_amount + , {{ event_data.get("fee_asset", "null") }} as log_fee_asset + , try(bytearray_to_uint256({{ event_data.get("fee_max_amount", "null") }})) as log_fee_max_amount + , try(bytearray_to_uint256({{ event_data.get("fee_min_amount", "null") }})) as log_fee_min_amount + , try(bytearray_to_uint256({{ event_data.get("fee_amount", "null") }})) as log_fee_amount + , {{ event_data.get("fee_receiver", "null") }} as log_fee_receiver + , {{ event_data.get("nonce", "null") }} as log_nonce + , {{ event_data.get("order_hash", "null") }} as log_order_hash + , topic1 + , topic2 + , topic3 + , data + , row_number() over(partition by block_number, tx_hash order by index) as log_counter + from {{ source(blockchain, 'logs') }} + where + topic0 = {{ event }} + {% if is_incremental() %} + and {{ incremental_predicate('block_time') }} + {% else %} + and block_time >= timestamp '{{date_from}}' + {% endif %} + {% if not loop.last %}union all{% endif %} +{% endfor %} +) + +, calls as ( + select *, row_number() over(partition by block_number, tx_hash order by call_trace_address, call_trade) as call_trade_counter + from ( + select + blockchain + , project + , tag + , flags + , block_number + , block_time + , tx_hash + , tx_success + , call_from + , call_to + , call_trace_address + , call_success + , call_selector + , call_gas_used + , call_type + , call_error + , method + , topic0 + , trade['trade'] as call_trade + , trade['maker'] as call_maker + , trade['taker'] as call_taker + , trade['receiver'] as call_receiver + , trade['maker_asset'] as call_maker_asset + , trade['taker_asset'] as call_taker_asset + , try(bytearray_to_uint256(trade['maker_max_amount'])) as call_maker_max_amount + , try(bytearray_to_uint256(trade['taker_max_amount'])) as call_taker_max_amount + , try(bytearray_to_uint256(trade['maker_min_amount'])) as call_maker_min_amount + , try(bytearray_to_uint256(trade['taker_min_amount'])) as call_taker_min_amount + , try(bytearray_to_uint256(trade['making_amount'])) as call_making_amount + , try(bytearray_to_uint256(trade['taking_amount'])) as call_taking_amount + , try(bytearray_to_uint256(substr(trade['start'], 24 + 1, 8))) as call_start + , try(bytearray_to_uint256(substr(trade['end'], 24 + 1, 8))) as call_end + , try(bytearray_to_uint256(substr(trade['deadline'], 24 + 1, 8))) as call_deadline + , try(bytearray_to_uint256(trade['maker_fee_amount'])) as call_maker_fee_amount + , try(bytearray_to_uint256(trade['taker_fee_amount'])) as call_taker_fee_amount + , trade['fee_asset'] as call_fee_asset + , try(bytearray_to_uint256(trade['fee_max_amount'])) as call_fee_max_amount + , try(bytearray_to_uint256(trade['fee_min_amount'])) as call_fee_min_amount + , try(bytearray_to_uint256(trade['fee_amount'])) as call_fee_amount + , trade['fee_receiver'] as call_fee_receiver + , trade['nonce'] as call_nonce + , trade['order_hash'] as call_order_hash + , input + , output + from ( + {% for project, selectors in cfg.items() %} + {% for selector, method_data in selectors.items() %} + select + blockchain + , project + , tag + , flags + , block_number + , block_time + , tx_hash + , tx_success + , "from" as call_from + , "to" as call_to + , trace_address as call_trace_address + , success as call_success + , substr(input, 1, 4) as call_selector + , gas_used as call_gas_used + , call_type + , error as call_error + , '{{ method_data["name"] }}' as method + , {{ method_data["event"] }} as topic0 + , transform(sequence(1, {{ method_data.get("number", "1") }}), x -> map_from_entries(array[ + ('trade', try(to_big_endian_64(x))) + , ('maker', {{ method_data.get("maker", "null") }}) + , ('taker', {{ method_data.get("taker", "null") }}) + , ('receiver', {{ method_data.get("receiver", "null") }}) + , ('maker_asset', {{ method_data.get("maker_asset", "null") }}) + , ('taker_asset', {{ method_data.get("taker_asset", "null") }}) + , ('maker_max_amount', {{ method_data.get("maker_max_amount", "null") }}) + , ('taker_max_amount', {{ method_data.get("taker_max_amount", "null") }}) + , ('maker_min_amount', {{ method_data.get("maker_min_amount", "null") }}) + , ('taker_min_amount', {{ method_data.get("taker_min_amount", "null") }}) + , ('making_amount', {{ method_data.get("making_amount", "null") }}) + , ('taking_amount', {{ method_data.get("taking_amount", "null") }}) + , ('start', {{ method_data.get("start", "null") }}) + , ('end', {{ method_data.get("end", "null") }}) + , ('deadline', {{ method_data.get("deadline", "null") }}) + , ('fee_asset', {{ method_data.get("fee_asset", "null") }}) + , ('fee_max_amount', {{ method_data.get("fee_max_amount", "null") }}) + , ('fee_min_amount', {{ method_data.get("fee_min_amount", "null") }}) + , ('fee_amount', {{ method_data.get("fee_amount", "null") }}) + , ('fee_receiver', {{ method_data.get("fee_receiver", "null") }}) + , ('nonce', {{ method_data.get("nonce", "null") }}) + , ('order_hash', {{ method_data.get("order_hash", "null") }}) + ])) as trades + , input + , output + from {{ source(blockchain, 'traces') }} + join ( + select *, address as "to" + from {{ ref('oneinch_' + blockchain + '_mapped_contracts') }} + where + blockchain = '{{ blockchain }}' + and '{{ project }}' in (project, tag) + ) using("to") + where + {% if is_incremental() %}{{ incremental_predicate('block_time') }} + {% else %}block_time > greatest(first_created_at, timestamp '{{date_from}}'){% endif %} + and substr(input, 1, 4) = {{ selector }} + + {% if not loop.last %}union all{% endif %} + {% endfor %} + {% if not loop.last %}union all{% endif %} + {% endfor %} + ), unnest(trades) as trades(trade) + ) +) + +, joined as ( + select + * + , count(*) over(partition by blockchain, block_number, tx_hash, call_trace_address, call_trade) as trades + from calls + full join logs using(block_number, tx_hash, topic0) + join ({{ oneinch_blockchain_macro(blockchain) }}) using(blockchain) + where + (call_maker = log_maker or call_maker is null or log_maker is null) + and (call_taker = log_taker or call_taker is null or log_taker is null) + and (call_receiver = log_receiver or call_receiver is null or log_receiver is null) + and (call_maker_asset = log_maker_asset or call_maker_asset is null or log_maker_asset is null or cardinality(array_intersect({{wrapping}}, array[call_maker_asset, log_maker_asset])) = 2) + and (call_taker_asset = log_taker_asset or call_taker_asset is null or log_taker_asset is null or cardinality(array_intersect({{wrapping}}, array[call_taker_asset, log_taker_asset])) = 2) + and (call_maker_max_amount = log_maker_max_amount or call_maker_max_amount is null or log_maker_max_amount is null) + and (call_taker_max_amount = log_taker_max_amount or call_taker_max_amount is null or log_taker_max_amount is null) + and (call_maker_min_amount = log_maker_min_amount or call_maker_min_amount is null or log_maker_min_amount is null) + and (call_taker_min_amount = log_taker_min_amount or call_taker_min_amount is null or log_taker_min_amount is null) + and (call_making_amount = log_making_amount or call_making_amount is null or log_making_amount is null) + and (call_taking_amount = log_taking_amount or call_taking_amount is null or log_taking_amount is null) + and (call_start = log_start or call_start is null or log_start is null) + and (call_end = log_end or call_end is null or log_end is null) + and (call_deadline = log_deadline or call_deadline is null or log_deadline is null) + and (call_nonce = log_nonce or call_nonce is null or log_nonce is null) + and (call_order_hash = log_order_hash or call_order_hash is null or log_order_hash is null) +) + +-- output -- + +select + blockchain + , project + , tag + , flags + , block_number + , block_time + , tx_hash + , tx_success + , call_from + , call_to + , call_trace_address + , call_success + , call_selector + , call_gas_used + , call_type + , call_error + , call_trade + , method + , coalesce(coalesce(log_maker, call_maker), call_to) as maker + , coalesce(log_taker, call_taker) as taker + , coalesce(log_receiver, call_receiver) as receiver + , coalesce(log_maker_asset, call_maker_asset) as maker_asset + , coalesce(log_taker_asset, call_taker_asset) as taker_asset + , coalesce(log_maker_max_amount, call_maker_max_amount) as maker_max_amount + , coalesce(log_taker_max_amount, call_taker_max_amount) as taker_max_amount + , coalesce(log_maker_min_amount, call_maker_min_amount) as maker_min_amount + , coalesce(log_taker_min_amount, call_taker_min_amount) as taker_min_amount + , coalesce(log_making_amount, call_making_amount) as making_amount + , coalesce(log_taking_amount, call_taking_amount) as taking_amount + , coalesce(log_start, call_start) as order_start + , coalesce(log_end, call_end) as order_end + , coalesce(log_deadline, call_deadline) as order_deadline + , coalesce(log_maker_fee_amount, call_maker_fee_amount) as maker_fee_amount + , coalesce(log_taker_fee_amount, call_taker_fee_amount) as taker_fee_amount + , coalesce(log_fee_asset, call_fee_asset) as fee_asset + , coalesce(log_fee_max_amount, call_fee_max_amount) as fee_max_amount + , coalesce(log_fee_min_amount, call_fee_min_amount) as fee_min_amount + , coalesce(log_fee_amount, call_fee_amount) as fee_amount + , coalesce(log_fee_receiver, call_fee_receiver) as fee_receiver + , coalesce(log_nonce, call_nonce) as order_nonce + , coalesce(log_order_hash, call_order_hash, to_big_endian_64(call_trade_counter)) as order_hash + , array[input] as call_input + , array[output] as call_output + , index as event_index + , contract_address as event_contract_address + , topic1 as event_topic1 + , topic2 as event_topic2 + , topic3 as event_topic3 + , array[data] as event_data + , to_unixtime(block_time) as block_unixtime + , date(date_trunc('month', block_time)) as block_month +from joined +where + trades = 1 + or call_trade_counter = log_counter + or log_counter is null + +{% endmacro %} \ No newline at end of file diff --git a/macros/models/_project/oneinch/oneinch_project_swaps_macro.sql b/macros/models/_project/oneinch/oneinch_project_swaps_macro.sql index a2aea3ea6de..b858aed3386 100644 --- a/macros/models/_project/oneinch/oneinch_project_swaps_macro.sql +++ b/macros/models/_project/oneinch/oneinch_project_swaps_macro.sql @@ -17,10 +17,8 @@ methods as ( , method , selector , flags - from {{ ref('oneinch_mapped_methods') }} - where - blockchain = '{{blockchain}}' - and flags['swap'] + from {{ ref('oneinch_' + blockchain + '_mapped_methods') }} + where flags['swap'] ) , calls as ( @@ -95,47 +93,56 @@ methods as ( , amounts as ( select - calls.blockchain - , calls.block_number - , calls.tx_hash - , calls.call_trace_address - , any_value(calls.block_time) as block_time - , any_value(calls.tx_from) as tx_from - , any_value(calls.project) as project - , any_value(calls.call_from) as call_from - , any_value(calls.call_to) as call_to - , any_value(calls.method) as method - , any_value(calls.flags) as flags - , any_value(calls.direct) as direct - , max(amount * price / pow(10, decimals)) as amount_usd - , max(amount * price / pow(10, decimals)) filter(where creations_from.block_number is null or creations_to.block_number is null) as user_amount_usd - , max(amount * price / pow(10, decimals)) filter(where transfer_from = call_from or transfer_to = call_from) as caller_amount_usd - , array_agg(array[ - cast(row(transfer_from, creations_from.block_number is null) as row(address varbinary, success boolean)), - cast(row(transfer_to, creations_to.block_number is null) as row(address varbinary, success boolean)) - ]) as call_transfer_addresses - from calls - join ( - select * - from ({{ oneinch_parsed_transfers_from_calls_macro(blockchain) }}) - {% if is_incremental() %} - where {{ incremental_predicate('block_time') }} - {% else %} - where block_time >= timestamp '{{date_from}}' - {% endif %} - ) as transfers on - calls.block_number = transfers.block_number - and calls.tx_hash = transfers.tx_hash - and slice(transfer_trace_address, 1, cardinality(call_trace_address)) = call_trace_address - and reduce(call_trace_addresses, call_trace_address, (r, x) -> if(slice(transfer_trace_address, 1, cardinality(x[1])) = x[1] and r < x[1], x[1], r), r -> r) = call_trace_address - left join prices on - prices.contract_address = transfers.contract_address - and prices.minute = date_trunc('minute', transfers.block_time) - left join creations as creations_from on creations_from.address = transfers.transfer_from - left join creations as creations_to on creations_to.address = transfers.transfer_to - where - reduce(call_trace_addresses, true, (r, x) -> if(r and x[1] <> call_trace_address and slice(call_trace_address, 1, cardinality(x[1])) = x[1] and x[2] = flags, false, r), r -> r) - group by 1, 2, 3, 4 + * + , transform(filter(array_distinct(flatten(call_transfer_addresses)), x -> x[2]), x -> (x[1])) as users + , array_agg( + cast(row(project, call_trace_address, coalesce(user_amount_usd, amount_usd)) as row(project varchar, call_trace_address array(bigint), amount_usd double)) + ) over(partition by block_number, tx_hash) as amounts + , coalesce(if(direct, user_amount_usd, caller_amount_usd), amount_usd) as result_amount_usd + from ( + select + calls.blockchain + , calls.block_number + , calls.tx_hash + , calls.call_trace_address + , any_value(calls.block_time) as block_time + , any_value(calls.tx_from) as tx_from + , any_value(calls.project) as project + , any_value(calls.call_from) as call_from + , any_value(calls.call_to) as call_to + , any_value(calls.method) as method + , any_value(calls.flags) as flags + , any_value(calls.direct) as direct + , max(amount * price / pow(10, decimals)) as amount_usd + , max(amount * price / pow(10, decimals)) filter(where creations_from.block_number is null or creations_to.block_number is null) as user_amount_usd + , max(amount * price / pow(10, decimals)) filter(where transfer_from = call_from or transfer_to = call_from) as caller_amount_usd + , array_agg(array[ + cast(row(transfer_from, creations_from.block_number is null) as row(address varbinary, success boolean)), + cast(row(transfer_to, creations_to.block_number is null) as row(address varbinary, success boolean)) + ]) as call_transfer_addresses + from calls + join ( + select * + from ({{ oneinch_parsed_transfers_from_calls_macro(blockchain) }}) + {% if is_incremental() %} + where {{ incremental_predicate('block_time') }} + {% else %} + where block_time >= timestamp '{{date_from}}' + {% endif %} + ) as transfers on + calls.block_number = transfers.block_number + and calls.tx_hash = transfers.tx_hash + and slice(transfer_trace_address, 1, cardinality(call_trace_address)) = call_trace_address + and reduce(call_trace_addresses, call_trace_address, (r, x) -> if(slice(transfer_trace_address, 1, cardinality(x[1])) = x[1] and r < x[1], x[1], r), r -> r) = call_trace_address + left join prices on + prices.contract_address = transfers.contract_address + and prices.minute = date_trunc('minute', transfers.block_time) + left join creations as creations_from on creations_from.address = transfers.transfer_from + left join creations as creations_to on creations_to.address = transfers.transfer_to + where + reduce(call_trace_addresses, true, (r, x) -> if(r and x[1] <> call_trace_address and slice(call_trace_address, 1, cardinality(x[1])) = x[1] and x[2] = flags, false, r), r -> r) + group by 1, 2, 3, 4 + ) ) -- output -- @@ -155,7 +162,9 @@ select , amount_usd , user_amount_usd , caller_amount_usd - , call_transfer_addresses + , result_amount_usd + , amounts + , if(cardinality(users) = 0 or not flags['limits'], array_union(users, array[tx_from]), users) as users , date(date_trunc('month', block_time)) as block_month from amounts diff --git a/models/oneinch/_meta/oneinch_exchange_contracts.sql b/models/oneinch/_meta/oneinch_exchange_contracts.sql deleted file mode 100644 index 641a0534719..00000000000 --- a/models/oneinch/_meta/oneinch_exchange_contracts.sql +++ /dev/null @@ -1,185 +0,0 @@ -{{ - config( - schema = 'oneinch', - alias = 'exchange_contracts', - materialized = 'incremental', - file_format = 'delta', - incremental_strategy = 'merge', - unique_key = ['contract_address', 'blockchain'], - - ) -}} - - - -with - -contracts as ( - select - project - , address - , contract_name - , blockchain - from (values - ('1inch' , 0xe4c577bdec9ce0f6c54f2f82aed5b1913b71ae2f, 'ExchangeV1' , array['ethereum']) - , ('1inch' , 0x0000000006adbd7c01bc0738cdbfc3932600ad63, 'ExchangeV2' , array['ethereum']) - , ('1inch' , 0x0000000053d411becdb4a82d8603edc6d8b8b3bc, 'ExchangeV3' , array['ethereum']) - , ('1inch' , 0x000005edbbc1f258302add96b5e20d3442e5dd89, 'ExchangeV4' , array['ethereum']) - , ('1inch' , 0x0000000f8ef4be2b7aed6724e893c1b674b9682d, 'ExchangeV5' , array['ethereum']) - , ('1inch' , 0x111112549cfedf7822eb11fbd8fd485d8a10f93f, 'ExchangeV6' , array['ethereum']) - , ('1inch' , 0x111111254b08ceeee8ad6ca827de9952d2a46781, 'ExchangeV7' , array['ethereum']) - , ('1inch' , 0x3ef51736315f52d568d6d2cf289419b9cfffe782, 'LimitOrderProtocolV1' , array['ethereum']) - , ('1inch' , 0xe3456f4ee65e745a44ec3bcb83d0f2529d1b84eb, 'LimitOrderProtocolV1' , array['bnb']) - , ('1inch' , 0xb707d89d29c189421163515c59e42147371d6857, 'LimitOrderProtocolV1' , array['polygon', 'optimism']) - , ('1inch' , 0xe295ad71242373c37c5fda7b57f26f9ea1088afe, 'LimitOrderProtocolV1' , array['arbitrum']) - , ('1inch' , 0x119c71d3bbac22029622cbaec24854d3d32d2828, 'LimitOrderProtocolV2' , array['ethereum']) - , ('1inch' , 0x1e38eff998df9d3669e32f4ff400031385bf6362, 'LimitOrderProtocolV2' , array['bnb']) - , ('1inch' , 0x94bc2a1c732bcad7343b25af48385fe76e08734f, 'LimitOrderProtocolV2' , array['polygon']) - , ('1inch' , 0x54431918cec22932fcf97e54769f4e00f646690f, 'LimitOrderProtocolV2' , array['gnosis']) - , ('1inch' , 0x7f069df72b7a39bce9806e3afaf579e54d8cf2b9, 'LimitOrderProtocolV2' , array['arbitrum']) - , ('1inch' , 0x0f85a912448279111694f4ba4f85dc641c54b594, 'LimitOrderProtocolV2' , array['avalanche_c']) - , ('1inch' , 0x11431a89893025d2a48dca4eddc396f8c8117187, 'LimitOrderProtocolV2' , array['optimism']) - , ('1inch' , 0x11dee30e710b8d4a8630392781cc3c0046365d4c, 'LimitOrderProtocolV2' , array['fantom']) - , ('1inch' , 0x11111254369792b2ca5d084ab5eea397ca8fa48b, 'AggregationRouterV1' , array['ethereum']) - , ('1inch' , 0x111111125434b319222cdbf8c261674adb56f3ae, 'AggregationRouterV2' , array['ethereum']) - , ('1inch' , 0x111111254bf8547e7183e4bbfc36199f3cedf4a1, 'AggregationRouterV2' , array['bnb']) - , ('1inch' , 0x11111112542d85b3ef69ae05771c2dccff4faa26, 'AggregationRouterV3' , array['ethereum', 'bnb', 'polygon', 'optimism', 'arbitrum']) - , ('1inch' , 0x1111111254fb6c44bac0bed2854e76f90643097d, 'AggregationRouterV4' , array['ethereum', 'bnb', 'polygon', 'arbitrum', 'avalanche_c', 'gnosis', 'fantom']) - , ('1inch' , 0x1111111254760f7ab3f16433eea9304126dcd199, 'AggregationRouterV4' , array['optimism']) - , ('1inch' , 0x1111111254eeb25477b68fb85ed929f73a960582, 'AggregationRouterV5' , array['ethereum', 'bnb', 'polygon', 'optimism', 'arbitrum', 'avalanche_c', 'gnosis', 'fantom', 'base']) - , ('1inch' , 0x6e2b76966cbd9cf4cc2fa0d76d24d5241e0abc2f, 'AggregationRouterV5' , array['zksync']) - , ('1inch' , 0x111111125421ca6dc452d289314280a0f8842a65, 'AggregationRouterV6' , array['ethereum', 'bnb', 'polygon', 'optimism', 'arbitrum', 'avalanche_c', 'gnosis', 'fantom', 'base']) - , ('1inch' , 0x6fd4383cb451173d5f9304f041c7bcbf27d561ff, 'AggregationRouterV6' , array['zksync']) - , ('MetaMask' , 0x881d40237659c251811cec9c364ef91dc08d300c, 'MetaSwap' , array['ethereum']) - , ('CoW Swap' , 0x9008d19f58aabd9ed0d60971565aa8510560ab41, 'GPv2Settlement' , array['ethereum', 'gnosis']) - , ('MetaMask' , 0x1a1ec25dc08e98e5e93f1104b5e5cdd298707d31, 'MetaSwap' , array['bnb', 'polygon', 'avalanche_c']) - , ('MetaMask' , 0x9dda6ef3d919c9bc8885d5560999a3640431e8e6, 'MetaSwap' , array['arbitrum', 'optimism']) - , ('Odos' , 0x69dd38645f7457be13571a847ffd905f9acbaf6d, 'OdosRouter' , array['optimism']) - , ('Odos' , 0x76f4eed9fe41262669d0250b2a97db79712ad855, 'OdosRouter' , array['ethereum']) - , ('Odos' , 0xa32ee1c40594249eb3183c10792bcf573d4da47c, 'OdosRouter' , array['polygon']) - , ('Odos' , 0xdd94018f54e565dbfc939f7c44a16e163faab331, 'OdosRouter' , array['arbitrum']) - , ('Odos' , 0xfe7ce93ac0f78826cd81d506b07fe9f459c00214, 'OdosRouter' , array['avalanche_c']) - , ('OpenOcean' , 0x6352a56caadc4f1e25cd6c75970fa768a3304e64, 'ExchangeV2' , array['bnb', 'avalanche_c', 'ethereum', 'optimism', 'fantom']) - , ('PancakeSwap' , 0x05ff2b0db69458a0750badebc4f9e13add608c7f, 'PancakeRouter' , array['bnb']) - , ('PancakeSwap' , 0x10ed43c718714eb63d5aa57b78b54704e256024e, 'PancakeSwapV2' , array['bnb']) - , ('PancakeSwap' , 0x13f4ea83d0bd40e75c8222255bc855a974568dd4, 'SmartRouter' , array['ethereum', 'bnb']) - , ('PancakeSwap' , 0x2f22e47ca7c5e07f77785f616ceee80c5e84127c, 'SwapSmartRouter' , array['bnb']) - , ('PancakeSwap' , 0xd4c4a7c55c9f7b3c48bafb6e8643ba79f42418df, 'ZapV1' , array['bnb']) - , ('Paraswap' , 0xdef171fe48cf0115b1d80b88dc8eab59176fee57, 'AugustusSwapperV5' , array['ethereum', 'bnb', 'fantom', 'optimism', 'arbitrum', 'polygon', 'avalanche_c']) - , ('Paraswap' , 0x90249ed4d69d70e709ffcd8bee2c5a566f65dade, 'AugustusSwapperV4' , array['polygon']) - , ('Slingshot Finance' , 0x00c0184c0b5d42fba6b7ca914b31239b419ab80b, 'Swap' , array['optimism']) - , ('Slingshot Finance' , 0x07e56b727e0eacfa53823977599905024c2de4f0, 'Swap' , array['polygon']) - , ('Slingshot Finance' , 0x224b239b8bb896f125bd77eb334e302a318d9e33, 'Swap' , array['bnb']) - , ('Slingshot Finance' , 0x5543550d65813c1fa76242227cbba0a28a297771, 'Swap' , array['arbitrum']) - , ('Slingshot Finance' , 0xe8c97bf6d084880de38aec1a56d97ed9fdfa0c9b, 'Swap' , array['arbitrum']) - , ('Slingshot Finance' , 0xf2e4209afa4c3c9eaa3fb8e12eed25d8f328171c, 'TradingContract' , array['polygon']) - , ('Trader Joe' , 0x079c68167f85cb06ed550149cce250e06dc3c52d, 'SwapLogic' , array['avalanche_c']) - , ('Trader Joe' , 0x60ae616a2155ee3d9a68541ba4544862310933d4, 'JoeRouter02' , array['avalanche_c']) - , ('Trader Joe' , 0xb4315e873dbcf96ffd0acd8ea43f689d8c20fb30, 'LBRouter' , array['bnb', 'arbitrum', 'avalanche_c']) - , ('Trader Joe' , 0xed8cbd9f0ce3c6986b22002f03c6475ceb7a6256, 'JoePair' , array['avalanche_c']) - , ('Uniswap' , 0xf164fc0ec4e93095b804a4795bbe1e041497b92a, 'Router01' , array['ethereum']) - , ('Uniswap' , 0x7a250d5630b4cf539739df2c5dacb4c659f2488d, 'Router02' , array['ethereum']) - , ('Uniswap' , 0xe592427a0aece92de3edee1f18e0157c05861564, 'SwapRouter' , array['ethereum', 'polygon', 'arbitrum', 'optimism']) - , ('Uniswap' , 0x68b3465833fb72a70ecdf485e0e4c7bd8665fc45, 'SwapRouter02' , array['ethereum', 'polygon', 'arbitrum', 'optimism']) - , ('Uniswap' , 0x0000000052be00ba3a005edbe83a0fb9aadb964c, 'UniversalRouter' , array['ethereum']) - , ('Uniswap' , 0xef1c6e67703c7bd7107eed8303fbe6ec2554bf6b, 'UniversalRouter' , array['ethereum']) - , ('Uniswap' , 0x3fc91a3afd70395cd496c647d5a6cc9d4b2b7fad, 'UniversalRouter' , array['ethereum', 'bnb', 'polygon', 'arbitrum', 'optimism']) - , ('Uniswap' , 0x5dc88340e1c5c6366864ee415d6034cadd1a9897, 'UniversalRouter' , array['bnb']) - , ('Uniswap' , 0x4c60051384bd2d3c01bfc845cf5f4b44bcbe9de5, 'UniversalRouter' , array['polygon', 'arbitrum']) - , ('Uniswap' , 0x643770e279d5d0733f21d6dc03a8efbabf3255b4, 'UniversalRouter' , array['polygon']) - , ('Uniswap' , 0xb555edf5dcf85f42ceef1f3630a52a108e55a654, 'UniversalRouter' , array['optimism']) - , ('Uniswap' , 0xec8b0f7ffe3ae75d7ffab09429e3675bb63503e4, 'UniversalRouter' , array['bnb', 'arbitrum', 'optimism', 'base']) - , ('Uniswap' , 0xb971ef87ede563556b2ed4b1c0b0019111dd85d2, 'UniversalRouter' , array['bnb']) - , ('Uniswap' , 0x2626664c2603336e57b271c5c0b26f421741e481, 'UniversalRouter' , array['base']) - , ('Uniswap' , 0x198ef79f1f515f02dfe9e3115ed9fc07183f02fc, 'UniversalRouter' , array['base']) - , ('Uniswap' , 0x6000da47483062a0d734ba3dc7576ce6a0b645c4, 'UniswapX' , array['ethereum']) - , ('Velodrome' , 0x9c12939390052919af3155f41bf4160fd3666a6f, 'Router' , array['optimism']) - , ('Velodrome' , 0xa132dab612db5cb9fc9ac426a0cc215a3423f9c9, 'Router' , array['optimism']) - , ('ZeroEx' , 0x3f93c3d9304a70c9104642ab8cd37b1e2a7c203a, 'Exchange' , array['bnb']) - , ('ZeroEx' , 0xdef189deaef76e379df891899eb5a00a94cbc250, 'ExchangeProxy' , array['fantom']) - , ('ZeroEx' , 0xdef1abe32c034e558cdd535791643c58a13acc10, 'ExchangeProxy' , array['optimism']) - , ('ZeroEx' , 0xdef1c0ded9bec7f1a1670819833240f027b25eff, 'ExchangeProxy' , array['ethereum', 'bnb', 'polygon', 'arbitrum']) - , ('ZeroEx' , 0xe66b31678d6c16e9ebf358268a790b763c133750, 'ExchangeProxy' , array['ethereum']) - ) as c(project, address, contract_name, blockchains), unnest(blockchains) as blockchains(blockchain) -) - -, evms_creation_traces as ( - {% for blockchain in all_evm_chains() %} - select '{{blockchain}}' as blockchain, address, block_time, "from", tx_hash from {{ source(blockchain, 'traces') }} - {% if is_incremental() %} - where {{ incremental_predicate('block_time') }} - {% endif %} - {% if not loop.last %} union all {% endif %} - {% endfor %} -) - -, evms_contracts as ( - {% for blockchain in all_evm_chains() %} - select - '{{blockchain}}' as blockchain - , address - , abi - , dynamic - , base - , factory - , detection_source - , namespace - , created_at - , name - from {{ source(blockchain, 'contracts') }} - {% if not loop.last %} union all {% endif %} - {% endfor %} -) - -, descriptions as ( -- light table, no needs to be incremental - select - blockchain - , address - , max_by(abi, created_at) as abi - , max_by(map_from_entries(array[ - ('dynamic', cast(dynamic as varchar)) - , ('base', cast(base as varchar)) - , ('factory', cast(factory as varchar)) - , ('detection_source', detection_source) - ]), created_at) as params - , array_agg(namespace) as namespaces - , array_agg(name) as names - from evms_contracts - join contracts using(blockchain, address) - group by 1, 2 -) - -, creations as ( - select - project - , address - , contract_name - , blockchain - , abi - , params - , namespaces - , names - , max(block_time) as last_created_at - , max(evms_creation_traces."from") as last_creator - , max(tx_hash) as last_creation_tx_hash - from evms_creation_traces - join contracts using(blockchain, address) - left join descriptions using(blockchain, address) - group by 1, 2, 3, 4, 5, 6, 7, 8 -) - - -select - project - , address as contract_address - , substr(address, length(address) - 1) as contract_id - , contract_name - , blockchain - , last_created_at - , last_creator - , last_creation_tx_hash - , abi - , params - , namespaces - , names -from creations diff --git a/models/oneinch/_meta/oneinch_mapped_contracts.sql b/models/oneinch/_meta/oneinch_mapped_contracts.sql index 4ae0d2dae5d..8b2cec274dd 100644 --- a/models/oneinch/_meta/oneinch_mapped_contracts.sql +++ b/models/oneinch/_meta/oneinch_mapped_contracts.sql @@ -4,378 +4,14 @@ alias = 'mapped_contracts', materialized = 'table', on_table_exists = 'drop', + tags = ['prod_exclude'], unique_key = ['blockchain', 'address'], ) }} -with - -contracts as ( - select - blockchain - , address - , project - , user - , contains(array[ - '1inch' - , 'BabySwap' - , 'BoggedFinance' - , 'Dzap' - , 'Firebird' - , 'Kyber' - , 'LiFi' - , 'Odos' - , 'OpenOcean' - , 'Paraswap' - , 'SlingshotFinance' - , 'TransitSwap' - , 'ZeroEx' - ], project) as multi - , contains(array[ - '1inch' - , 'ZeroEx' - , 'Clipper' - , 'Hashflow' - , 'Native' - , 'Swaap' - ], project) as lops - , tag - from (values - (0xc586bef4a0992c495cf22e1aeee4e446cecdee0e, true, '1inch' , 'OneSplit' , array['ethereum']) - , (0xe4c577bdec9ce0f6c54f2f82aed5b1913b71ae2f, true, '1inch' , 'ExchangeV1' , array['ethereum']) - , (0x0000000006adbd7c01bc0738cdbfc3932600ad63, true, '1inch' , 'ExchangeV2' , array['ethereum']) - , (0x0000000053d411becdb4a82d8603edc6d8b8b3bc, true, '1inch' , 'ExchangeV3' , array['ethereum']) - , (0x000005edbbc1f258302add96b5e20d3442e5dd89, true, '1inch' , 'ExchangeV4' , array['ethereum']) - , (0x0000000f8ef4be2b7aed6724e893c1b674b9682d, true, '1inch' , 'ExchangeV5' , array['ethereum']) - , (0x111112549cfedf7822eb11fbd8fd485d8a10f93f, true, '1inch' , 'ExchangeV6' , array['ethereum']) - , (0x111111254b08ceeee8ad6ca827de9952d2a46781, true, '1inch' , 'ExchangeV7' , array['ethereum']) - , (0x3ef51736315f52d568d6d2cf289419b9cfffe782, true, '1inch' , 'LimitOrderProtocolV1' , array['ethereum']) - , (0xe3456f4ee65e745a44ec3bcb83d0f2529d1b84eb, true, '1inch' , 'LimitOrderProtocolV1' , array['bnb']) - , (0xb707d89d29c189421163515c59e42147371d6857, true, '1inch' , 'LimitOrderProtocolV1' , array['polygon','optimism']) - , (0xe295ad71242373c37c5fda7b57f26f9ea1088afe, true, '1inch' , 'LimitOrderProtocolV1' , array['arbitrum']) - , (0x119c71d3bbac22029622cbaec24854d3d32d2828, true, '1inch' , 'LimitOrderProtocolV2' , array['ethereum']) - , (0x1e38eff998df9d3669e32f4ff400031385bf6362, true, '1inch' , 'LimitOrderProtocolV2' , array['bnb']) - , (0x94bc2a1c732bcad7343b25af48385fe76e08734f, true, '1inch' , 'LimitOrderProtocolV2' , array['polygon']) - , (0x54431918cec22932fcf97e54769f4e00f646690f, true, '1inch' , 'LimitOrderProtocolV2' , array['gnosis']) - , (0x7f069df72b7a39bce9806e3afaf579e54d8cf2b9, true, '1inch' , 'LimitOrderProtocolV2' , array['arbitrum']) - , (0x0f85a912448279111694f4ba4f85dc641c54b594, true, '1inch' , 'LimitOrderProtocolV2' , array['avalanche_c']) - , (0x11431a89893025d2a48dca4eddc396f8c8117187, true, '1inch' , 'LimitOrderProtocolV2' , array['optimism']) - , (0x11dee30e710b8d4a8630392781cc3c0046365d4c, true, '1inch' , 'LimitOrderProtocolV2' , array['fantom']) - , (0x11111254369792b2ca5d084ab5eea397ca8fa48b, true, '1inch' , 'AggregationRouterV1' , array['ethereum']) - , (0x111111125434b319222cdbf8c261674adb56f3ae, true, '1inch' , 'AggregationRouterV2' , array['ethereum']) - , (0x111111254bf8547e7183e4bbfc36199f3cedf4a1, true, '1inch' , 'AggregationRouterV2' , array['bnb']) - , (0x11111112542d85b3ef69ae05771c2dccff4faa26, true, '1inch' , 'AggregationRouterV3' , array['ethereum','bnb','polygon','arbitrum','optimism']) - , (0x1111111254fb6c44bac0bed2854e76f90643097d, true, '1inch' , 'AggregationRouterV4' , array['ethereum','bnb','polygon','arbitrum','avalanche_c','gnosis','fantom']) - , (0x1111111254760f7ab3f16433eea9304126dcd199, true, '1inch' , 'AggregationRouterV4' , array['optimism']) - , (0x1111111254eeb25477b68fb85ed929f73a960582, true, '1inch' , 'AggregationRouterV5' , array['ethereum','bnb','polygon','arbitrum','avalanche_c','gnosis','optimism','fantom','base']) - , (0x6e2b76966cbd9cf4cc2fa0d76d24d5241e0abc2f, true, '1inch' , 'AggregationRouterV5' , array['zksync']) - , (0x111111125421ca6dc452d289314280a0f8842a65, true, '1inch' , 'AggregationRouterV6' , array['ethereum','bnb','polygon','arbitrum','avalanche_c','gnosis','optimism','fantom','base']) - , (0x6fd4383cb451173d5f9304f041c7bcbf27d561ff, true, '1inch' , 'AggregationRouterV6' , array['zksync']) - , (0xa88800cd213da5ae406ce248380802bd53b47647, true, '1inch' , 'SettlementV1' , array['ethereum']) - , (0x1d0ae300eec4093cee4367c00b228d10a5c7ac63, true, '1inch' , 'SettlementV1' , array['bnb']) - , (0x1e8ae092651e7b14e4d0f93611267c5be19b8b9f, true, '1inch' , 'SettlementV1' , array['polygon']) - , (0x4bc3e539aaa5b18a82f6cd88dc9ab0e113c63377, true, '1inch' , 'SettlementV1' , array['arbitrum']) - , (0xd89adc20c400b6c45086a7f6ab2dca19745b89c2, true, '1inch' , 'SettlementV1' , array['optimism']) - , (0x7731f8df999a9441ae10519617c24568dc82f697, true, '1inch' , 'SettlementV1' , array['avalanche_c']) - , (0xcbdb7490968d4dbf183c60fc899c2e9fbd445308, true, '1inch' , 'SettlementV1' , array['gnosis']) - , (0xa218543cc21ee9388fa1e509f950fd127ca82155, true, '1inch' , 'SettlementV1' , array['fantom']) - , (0x7f069df72b7a39bce9806e3afaf579e54d8cf2b9, true, '1inch' , 'SettlementV1' , array['base']) - , (0x11de482747d1b39e599f120d526af512dd1a9326, true, '1inch' , 'SettlementV1' , array['zksync']) - , (0x0cae51e1032e8461f4806e26332c030e34de3adb, true, 'AnySwap' , 'AnyswapV3Router' , array['arbitrum']) - , (0x7782046601e7b9b05ca55a3899780ce6ee6b8b2b, true, 'AnySwap' , 'AnyswapV6Router' , array['ethereum']) - , (0xb0731d50c681c45856bfc3f7539d5f61d4be81d8, true, 'AnySwap' , 'UNDEFINED' , array['avalanche_c']) - , (0xe1d592c3322f1f714ca11f05b6bc0efef1907859, true, 'AnySwap' , 'AnyswapV6Router' , array['bnb']) - , (0xf9736ec3926703e85c843fc972bd89a7f8e827c0, true, 'AnySwap' , 'AnyswapV3Router' , array['bnb']) - , (0xc0788a3ad43d79aa53b09c2eacc313a787d1d607, true, 'ApeSwap' , 'ApeRouter' , array['polygon']) - , (0xcf0febd3f17cef5b47b0cd257acf6025c5bff3b7, true, 'ApeSwap' , 'UNDEFINED' , array['bnb']) - , (0x6947a425453d04305520e612f0cb2952e4d07d62, true, 'Arbswap' , 'ArbswapSmartRouter' , array['arbitrum']) - , (0x8317c460c22a9958c27b4b6403b98d2ef4e2ad32, true, 'BabySwap' , 'UNDEFINED' , array['bnb']) - , (0xba12222222228d8ba445958a75a0704d566bf2c8, true, 'Balancer' , 'Vault' , array['ethereum', 'bnb', 'polygon', 'arbitrum', 'avalanche_c', 'gnosis', 'optimism', 'base']) - , (0x6093aebac87d62b1a5a4ceec91204e35020e38be, true, 'Baoswap' , 'UniswapV2Router02' , array['gnosis']) - , (0x3a6d8ca21d1cf76f653a67577fa0d27453350dd8, true, 'BiSwap' , 'UNDEFINED' , array['bnb']) - , (0x6f5ac65ca70f2a44d73c8f711cb2bdf425d9f304, true, 'BitKeep' , 'UNDEFINED' , array['bnb']) - , (0xf5bfcbda96de6a55a3a80af5175a1cbb088d5338, true, 'BitKeep' , 'UNDEFINED' , array['polygon']) - , (0xf6463845b0b9d9d33d8e2bcb6c628bc5cb1ad133, true, 'BitKeep' , 'UNDEFINED' , array['polygon']) - , (0xb099ed146fad4d0daa31e3810591fc0554af62bb, true, 'BoggedFinance' , 'BogSwap' , array['bnb','avalanche_c','fantom']) - , (0xc873fecbd354f5a56e00e710b90ef4201db2448d, true, 'Camelot' , 'CamelotRouter' , array['arbitrum']) - , (0x1f721e2e82f6676fce4ea07a5958cf098d339e18, true, 'Camelot' , 'SwapRouter' , array['arbitrum']) - , (0xbf1fc29668e5f5eaa819948599c9ac1b1e03e75f, true, 'Cone' , 'ConeRouter01' , array['bnb']) - , (0x11984dc4465481512eb5b777e44061c158cf2259, true, 'Connext' , 'ConnextDiamond' , array['polygon']) - , (0xee9dec2712cce65174b561151701bf54b99c24c8, true, 'Connext' , 'ConnextDiamond' , array['arbitrum']) - , (0x9008d19f58aabd9ed0d60971565aa8510560ab41, true, 'CoWSwap' , 'GPv2Settlement' , array['ethereum','gnosis']) - , (0x99a58482bd75cbab83b27ec03ca68ff489b5788f, true, 'Curvefi' , 'SwapRouter' , array['ethereum']) - , (0xbebc44782c7db0a1a60cb6fe97d0b483032ff1c7, true, 'Curvefi' , 'ThreepoolSwap' , array['ethereum']) - , (0xdc24316b9ae028f1497c275eb9192a3ea0f67022, true, 'Curvefi' , 'StETHSwap' , array['ethereum']) - , (0x1d8b86e3d88cdb2d34688e87e72f388cb541b7c8, true, 'Curvefi' , 'VyperContract' , array['polygon']) - , (0x43b4fdfd4ff969587185cdb6f0bd875c5fc83f8c, true, 'Curvefi' , 'Vyper' , array['ethereum']) - , (0x0656fd85364d03b103ceeda192fb2d3906a6ac15, true, 'DODO' , 'DODOFeeRouteProxy' , array['bnb']) - , (0x2fa4334cfd7c56a0e7ca02bd81455205fcbdc5e9, true, 'DODO' , 'DODORouteProxy' , array['polygon']) - , (0x39e3e49c99834c9573c9fc7ff5a4b226cd7b0e63, true, 'DODO' , 'DODOFeeRouteProxy' , array['polygon']) - , (0x3b6067d4caa8a14c63fdbe6318f27a0bbc9f9237, true, 'DODO' , 'DODORouteProxy' , array['arbitrum']) - , (0x6b3d817814eabc984d51896b1015c0b89e9737ca, true, 'DODO' , 'DODORouteProxy' , array['bnb']) - , (0xa222e6a71d1a1dd5f279805fbe38d5329c1d0e70, true, 'DODO' , 'DODOV2Proxy02' , array['polygon']) - , (0xa2398842f37465f89540430bdc00219fa9e4d28a, true, 'DODO' , 'DODORouteProxy' , array['ethereum']) - , (0xa8b034301bb5dd3610db585def3e7c0d52f2319f, true, 'DODO' , 'DODOFeeRouteProxy' , array['bnb']) - , (0xe05dd51e4eb5636f4f0e8e7fbe82ea31a2ecef16, true, 'DODO' , 'DODOFeeRouteProxy' , array['arbitrum']) - , (0x9d0950c595786aba7c26dfddf270d66a8b18b4fa, true, 'DfxFinance' , 'Router' , array['ethereum']) - , (0xa102072a4c07f06ec3b4900fdc4c7b80b6c57429, true, 'Dfyn' , 'UniswapV2Router02' , array['polygon']) - , (0x3af3cc4930ef88f4afe0b695ac95c230e1a108ec, true, 'Dzap' , 'DZapAggregator' , array['polygon']) - , (0x0c6134abc08a1eafc3e2dc9a5ad023bb08da86c3, true, 'Firebird' , 'FireBirdRouter' , array['optimism']) - , (0x92e4f29be975c1b1eb72e77de24dccf11432a5bd, true, 'Firebird' , 'FireBirdRouter' , array['bnb']) - , (0xb31d1b1ea48ce4bf10ed697d44b747287e785ad4, true, 'Firebird' , 'FireBirdRouter' , array['polygon']) - , (0xe0c38b2a8d09aad53f1c67734b9a95e43d5981c0, true, 'Firebird' , 'Firebird' , array['fantom']) - , (0x9bc2152fd37b196c0ff3c16f5533767c9a983971, true, 'Fraxswap' , 'FraxswapRouter' , array['polygon']) - , (0x1b6c9c20693afde803b27f8782156c0f892abc2d, true, 'FstSwap' , 'FstswapRouter02' , array['bnb']) - , (0xb3ca4d73b1e0ea2c53b42173388cc01e1c226f40, true, 'FstSwap' , 'UNDEFINED' , array['bnb']) - , (0x3d6ba331e3d9702c5e8a8d254e5d8a285f223aba, true, 'GMX' , 'PositionRouter' , array['arbitrum']) - , (0x5f719c2f1095f7b9fc68a68e35b51194f4b6abe8, true, 'GMX' , 'Router' , array['avalanche_c']) - , (0xa27c20a7cf0e1c68c0460706bb674f98f362bc21, true, 'GMX' , 'OrderBookReader' , array['arbitrum']) - , (0xabbc5f99639c9b6bcb58544ddf04efa6802f4064, true, 'GMX' , 'Router' , array['arbitrum']) - , (0x83c8f28c26bf6aaca652df1dbbe0e1b56f8baba2, true, 'GemSwap' , 'GemSwap' , array['ethereum']) - , (0x1c232f01118cb8b424793ae03f870aa7d0ac7f77, true, 'HoneySwap' , 'UniswapV2Router02' , array['gnosis']) - , (0xbd3bd95529e0784ad973fd14928eedf3678cfad8, true, 'Izumi' , 'Swap0' , array['bnb']) - , (0xedf2021f41abcfe2dea4427e1b61f4d0aa5aa4b8, true, 'Izumi' , 'Swap' , array['bnb']) - , (0x01fdea353849ca29f778b2663bcaca1d191bed0e, true, 'Izumi' , 'Swap' , array['arbitrum']) - , (0x032b241de86a8660f1ae0691a4760b426ea246d7, true, 'Izumi' , 'Swap' , array['polygon']) - , (0x943ac2310d9bc703d6ab5e5e76876e212100f894, true, 'Izumi' , 'Swap' , array['zksync']) - , (0x02f55d53dce23b4aa962cc68b0f685f26143bdb2, true, 'Izumi' , 'Swap' , array['base']) - , (0x2db0afd0045f3518c77ec6591a542e326befd3d7, true, 'Izumi' , 'Swap' , array['scroll']) - , (0x8b791913eb07c32779a16750e3868aa8495f5964, true, 'KoiFinance' , 'Router' , array['zksync']) - , (0x00555513acf282b42882420e5e5ba87b44d8fa6e, true, 'Kyber' , 'AggregationRouterV3' , array['fantom']) - , (0x1fc3607fa67b58deddb0faf7a116f417a20c551c, true, 'Kyber' , 'AggregationRouter' , array['fantom']) - , (0x546c79662e028b661dfb4767664d0273184e4dd1, true, 'Kyber' , 'AggregationRouter' , array['polygon']) - , (0x617dee16b86534a5d792a4d7a62fb491b544111e, true, 'Kyber' , 'MetaAggregationRouterV1' , array['ethereum','polygon','fantom']) - , (0x6131b5fae19ea4f9d964eac0408e4408b66337b5, true, 'Kyber' , 'MetaAggregationRouterV2' , array['ethereum','bnb','polygon','arbitrum','avalanche_c','fantom']) - , (0x6131b5fae19ea4f9d964eac0408e4408b66337b5, true, 'Kyber' , 'MetaAggregationRouterV2' , array['optimism']) - , (0xdf1a1b60f2d438842916c0adc43748768353ec25, true, 'Kyber' , 'AggregationRouterV2' , array['polygon','fantom']) - , (0xb18d4f69627f8320619a696202ad2c430cef7c53, true, 'LevinSwap' , 'UniswapV2Router02' , array['gnosis']) - , (0x1231deb6f5749ef6ce6943a275a1d3e7486f4eae, true, 'LiFi' , 'DiamondV2' , array['bnb','polygon','arbitrum','avalanche_c','gnosis','optimism','fantom']) - , (0x62c1a0d92b09d0912f7bb9c96c5ecdc7f2b87059, true, 'Mdex' , 'MdexRouter' , array['bnb']) - , (0x7dae51bd3e3376b8c7c4900e9107f12be3af1ba8, true, 'Mdex' , 'MdexRouter' , array['bnb']) - , (0xbbf1ee38152e9d8e3470dc47947eaa65dca94913, true, 'Maverick' , 'Router' , array['ethereum']) - , (0x39e098a153ad69834a9dac32f0fca92066ad03f4, true, 'Maverick' , 'Router' , array['zksync']) - , (0xd53a9f3fae2bd46d35e9a30ba58112a585542869, true, 'Maverick' , 'Router' , array['bnb']) - , (0x32aed3bce901da12ca8489788f3a99fce1056e14, true, 'Maverick' , 'Router' , array['base']) - , (0x10f4a785f458bc144e3706575924889954946639, true, 'Meshswap' , 'Router' , array['polygon']) - , (0x881d40237659c251811cec9c364ef91dc08d300c, true, 'MetaMask' , 'MetaSwap' , array['ethereum']) - , (0x1a1ec25dc08e98e5e93f1104b5e5cdd298707d31, true, 'MetaMask' , 'MetaSwap' , array['bnb','polygon','avalanche_c']) - , (0x9dda6ef3d919c9bc8885d5560999a3640431e8e6, true, 'MetaMask' , 'MetaSwap' , array['arbitrum','optimism']) - , (0x3c11f6265ddec22f4d049dde480615735f451646, true, 'Mimic' , 'Swapper' , array['ethereum']) - , (0xd654953d746f0b114d1f85332dc43446ac79413d, true, 'NomiSwap' , 'UNDEFINED' , array['bnb']) - , (0x76f4eed9fe41262669d0250b2a97db79712ad855, true, 'Odos' , 'OdosRouter' , array['ethereum']) - , (0x9f138be5aa5cc442ea7cc7d18cd9e30593ed90b9, true, 'Odos' , 'OdosRouter' , array['bnb']) - , (0x69dd38645f7457be13571a847ffd905f9acbaf6d, true, 'Odos' , 'OdosRouter' , array['optimism']) - , (0xa269031037b4d5fa3f771c401d19e57def6cb491, true, 'Odos' , 'OdosRouter' , array['zksync']) - , (0x061dc8e41c05207bedd6242ea4b342ef294be359, true, 'Odos' , 'OdosRouter' , array['fantom']) - , (0xa32ee1c40594249eb3183c10792bcf573d4da47c, true, 'Odos' , 'OdosRouter' , array['polygon']) - , (0xdd94018f54e565dbfc939f7c44a16e163faab331, true, 'Odos' , 'OdosRouter' , array['arbitrum']) - , (0xfe7ce93ac0f78826cd81d506b07fe9f459c00214, true, 'Odos' , 'OdosRouter' , array['avalanche_c']) - , (0xcf5540fffcdc3d510b18bfca6d2b9987b0772559, true, 'Odos' , 'OdosRouterV2' , array['ethereum']) - , (0x89b8aa89fdd0507a99d334cbe3c808fafc7d850e, true, 'Odos' , 'OdosRouterV2' , array['bnb']) - , (0x4e3288c9ca110bcc82bf38f09a7b425c095d92bf, true, 'Odos' , 'OdosRouterV2' , array['polygon']) - , (0xa669e7a0d4b3e4fa48af2de86bd4cd7126be4e13, true, 'Odos' , 'OdosRouterV2' , array['arbitrum']) - , (0xca423977156bb05b13a2ba3b76bc5419e2fe9680, true, 'Odos' , 'OdosRouterV2' , array['optimism']) - , (0x19ceead7105607cd444f5ad10dd51356436095a1, true, 'Odos' , 'OdosRouterV2' , array['base']) - , (0x88de50b233052e4fb783d4f6db78cc34fea3e9fc, true, 'Odos' , 'OdosRouterV2' , array['avalanche_c']) - , (0xd0c22a5435f4e8e5770c1fafb5374015fc12f7cd, true, 'Odos' , 'OdosRouterV2' , array['fantom']) - , (0x4bba932e9792a2b917d47830c93a9bc79320e4f7, true, 'Odos' , 'OdosRouterV2' , array['zksync']) - , (0x3b3ae790df4f312e745d270119c6052904fb6790, true, 'OKXDEX' , 'DEX' , array['ethereum']) - , (0x6352a56caadc4f1e25cd6c75970fa768a3304e64, true, 'OpenOcean' , 'ExchangeV2' , array['ethereum','bnb','polygon','avalanche_c','optimism','fantom']) - , (0x05ff2b0db69458a0750badebc4f9e13add608c7f, true, 'PancakeSwap' , 'PancakeRouter' , array['bnb']) - , (0x10ed43c718714eb63d5aa57b78b54704e256024e, true, 'PancakeSwap' , 'PancakeswapV2' , array['bnb']) - , (0x5aeaf2883fbf30f3d62471154eda3c0c1b05942d, true, 'PancakeSwap' , 'PancakeswapV2' , array['zksync']) - , (0x13f4ea83d0bd40e75c8222255bc855a974568dd4, true, 'PancakeSwap' , 'SmartRouter' , array['ethereum','bnb']) - , (0x2f22e47ca7c5e07f77785f616ceee80c5e84127c, true, 'PancakeSwap' , 'SwapSmartRouter' , array['bnb']) - , (0x32226588378236fd0c7c4053999f88ac0e5cac77, true, 'PancakeSwap' , 'SmartRouter' , array['arbitrum']) - , (0xf8b59f3c3ab33200ec80a8a58b2aa5f5d2a8944c, true, 'PancakeSwap' , 'SmartRouter' , array['zksync']) - , (0xd4c4a7c55c9f7b3c48bafb6e8643ba79f42418df, true, 'PancakeSwap' , 'ZapV1' , array['bnb']) - , (0xe54ca86531e17ef3616d22ca28b0d458b6c89106, true, 'PangolinExchange' , 'Router' , array['avalanche_c']) - , (0x1bd435f3c054b6e901b7b108a0ab7617c808677b, true, 'Paraswap' , 'AugustusSwapperV4' , array['ethereum']) - , (0x90249ed4d69d70e709ffcd8bee2c5a566f65dade, true, 'Paraswap' , 'AugustusSwapperV4' , array['polygon']) - , (0xdef171fe48cf0115b1d80b88dc8eab59176fee57, true, 'Paraswap' , 'AugustusSwapperV5' , array['ethereum','bnb','polygon','arbitrum','avalanche_c','optimism','fantom']) - , (0x135896de8421be2ec868e0b811006171d9df802a, true, 'Paraswap' , 'LiquiditySwapAdapter' , array['ethereum']) - , (0x82ac2ce43e33683c58be4cdc40975e73aa50f459, true, 'Perp' , 'ClearingHouse' , array['optimism']) - , (0xa0069a14df3ecd19a38c509757ebc2c2aaa44992, true, 'Primex' , 'SwapManager' , array['polygon']) - , (0x2cf7252e74036d1da831d11089d326296e64a728, true, 'QuickSwap' , 'UniswapV2Pair' , array['polygon']) - , (0xa5e0829caced8ffdd4de3c43696c57f7d7a678ff, true, 'QuickSwap' , 'UniswapV2Router02' , array['polygon']) - , (0xf5b509bb0909a69b1c207e495f687a596c168e12, true, 'QuickSwap' , 'SwapRouter' , array['polygon']) - , (0x00000000009726632680fb29d3f7a9734e3010e2, true, 'Rainbow' , 'RainbowRouter' , array['ethereum']) - , (0xaaa87963efeb6f7e0a2711f397663105acb1805e, true, 'Ramses' , 'Router' , array['arbitrum']) - , (0x37da632c6436137bd4d0ca30c98d3c615974120b, true, 'SafeMoon' , 'UNDEFINED' , array['bnb']) - , (0x0c17e776cd218252adfca8d4e761d3fe757e9778, true, 'Saita' , 'SaitaSwapRouter' , array['ethereum']) - , (0x90f765f63e7dc5ae97d6c576bf693fb6af41c129, true, 'Setprotocol' , 'TradeModule' , array['ethereum']) - , (0x03f7724180aa6b939894b5ca4314783b0b36b329, true, 'ShibaSwap' , 'UniswapV2Router02' , array['ethereum']) - , (0x00c0184c0b5d42fba6b7ca914b31239b419ab80b, true, 'SlingshotFinance' , 'Swap' , array['optimism']) - , (0x07e56b727e0eacfa53823977599905024c2de4f0, true, 'SlingshotFinance' , 'UNDEFINED' , array['polygon']) - , (0x224b239b8bb896f125bd77eb334e302a318d9e33, true, 'SlingshotFinance' , 'Swap' , array['bnb']) - , (0x5543550d65813c1fa76242227cbba0a28a297771, true, 'SlingshotFinance' , 'UNDEFINED' , array['arbitrum']) - , (0xe8c97bf6d084880de38aec1a56d97ed9fdfa0c9b, true, 'SlingshotFinance' , 'Swap' , array['arbitrum']) - , (0xf2e4209afa4c3c9eaa3fb8e12eed25d8f328171c, true, 'SlingshotFinance' , 'TradingContract' , array['polygon']) - , (0x2b42affd4b7c14d9b7c2579229495c052672ccd3, true, 'Socket' , 'Registry' , array['avalanche_c']) - , (0xc30141b657f4216252dc59af2e7cdb9d8792e1b0, true, 'Socket' , 'Registry' , array['ethereum','polygon','arbitrum','gnosis','optimism']) - , (0xf26515d5482e2c2fd237149bf6a653da4794b3d0, true, 'Solidlizard' , 'Router' , array['arbitrum']) - , (0xeeee17b45e4d127cfaaad14e2710489523adb4d8, true, 'Solisnek' , 'Router' , array['avalanche_c']) - , (0x16327e3fbdaca3bcf7e38f5af2599d2ddc33ae52, true, 'Spiritswap' , 'Router' , array['fantom']) - , (0x31f63a33141ffee63d4b26755430a390acdd8a4d, true, 'Spookyswap' , 'LiquidityBrewer' , array['fantom']) - , (0xf491e7b69e4244ad4002bc14e878a34207e38c29, true, 'Spookyswap' , 'UniswapV2Router02' , array['fantom']) - , (0x1b02da8cb0d097eb8d57a175b88c7d8b47997506, true, 'SushiSwap' , 'SwapRouter' , array['bnb','polygon','arbitrum','avalanche_c','gnosis','fantom']) - , (0x2c8c987c4777ab740d20cb581f5d381be95a4a4a, true, 'SushiSwap' , 'SushiXSwap' , array['avalanche_c']) - , (0x4c5d5234f232bd2d76b96aa33f5ae4fcf0e4bfab, true, 'SushiSwap' , 'RouteProcessorV3' , array['optimism']) - , (0x7a4af156379f512de147ed3b96393047226d923f, true, 'SushiSwap' , 'SushiXSwap' , array['bnb']) - , (0x8b396ddf906d552b2f98a8e7d743dd58cd0d920f, true, 'SushiSwap' , 'SushiXSwap' , array['optimism']) - , (0xd9e1ce17f2641f24ae83637ab66a2cca9c378b9f, true, 'SushiSwap' , 'Router02' , array['ethereum']) - , (0x2da10a1e27bf85cedd8ffb1abbe97e53391c0295, true, 'SyncSwap' , 'Router' , array['zksync']) - , (0x80e38291e06339d10aab483c65695d004dbd5c69, true, 'SyncSwap' , 'Router' , array['scroll']) - , (0xb9960d9bca016e9748be75dd52f02188b9d0829f, true, 'Swapr' , 'Swapr' , array['ethereum']) - , (0xe43e60736b1cb4a75ad25240e2f9a62bff65c0c0, true, 'Swapr' , 'DXswapRouter' , array['gnosis']) - , (0x1342a24347532de79372283b3a29c63c31dd7711, true, 'Swaprum' , 'V2Router02' , array['arbitrum']) - , (0x1ed5685f345b2fa564ea4a670de1fde39e484751, true, 'Swftswap' , 'SwftSwap' , array['bnb']) - , (0x92e929d8b2c8430bcaf4cd87654789578bb2b786, true, 'Swftswap' , 'SwftSwap' , array['ethereum']) - , (0x03f34be1bf910116595db1b11e9d1b2ca5d59659, true, 'Tokenlon' , 'Tokenlon' , array['ethereum']) - , (0x079c68167f85cb06ed550149cce250e06dc3c52d, true, 'TraderJoe' , 'SwapLogic' , array['avalanche_c']) - , (0x60ae616a2155ee3d9a68541ba4544862310933d4, true, 'TraderJoe' , 'JoeRouter02' , array['avalanche_c']) - , (0xb4315e873dbcf96ffd0acd8ea43f689d8c20fb30, true, 'TraderJoe' , 'LBRouter' , array['bnb','arbitrum','avalanche_c']) - , (0xed8cbd9f0ce3c6986b22002f03c6475ceb7a6256, true, 'TraderJoe' , 'JoePair' , array['avalanche_c']) - , (0x638f32fe09baec1fdc54f962e3e8e5f2b286aa70, true, 'TransitSwap' , 'XswapProxyV3' , array['bnb']) - , (0x8b48715c5d6d1645663a4c460ea85ce846b8580e, true, 'TransitSwap' , 'UNDEFINED' , array['polygon']) - , (0xb45a2dda996c32e93b8c47098e90ed0e7ab18e39, true, 'TransitSwap' , 'TransitSwapRouterV4' , array['bnb','polygon','arbitrum']) - , (0x00000047bb99ea4d791bb749d970de71ee0b1a34, true, 'TransitSwap' , 'TransitSwapRouterV5' , array['ethereum']) - , (0xf164fc0ec4e93095b804a4795bbe1e041497b92a, true, 'Uniswap' , 'Router01' , array['ethereum']) - , (0x7a250d5630b4cf539739df2c5dacb4c659f2488d, true, 'Uniswap' , 'Router02' , array['ethereum']) - , (0xe592427a0aece92de3edee1f18e0157c05861564, true, 'Uniswap' , 'SwapRouter' , array['ethereum','polygon','arbitrum','optimism']) - , (0x68b3465833fb72a70ecdf485e0e4c7bd8665fc45, true, 'Uniswap' , 'SwapRouter02' , array['ethereum','polygon','arbitrum','optimism']) - , (0x0000000052be00ba3a005edbe83a0fb9aadb964c, true, 'Uniswap' , 'UNDEFINED' , array['ethereum']) - , (0xef1c6e67703c7bd7107eed8303fbe6ec2554bf6b, true, 'Uniswap' , 'UniversalRouter' , array['ethereum']) - , (0x3fc91a3afd70395cd496c647d5a6cc9d4b2b7fad, true, 'Uniswap' , 'UNDEFINED' , array['ethereum','bnb','polygon','arbitrum','optimism']) - , (0x5dc88340e1c5c6366864ee415d6034cadd1a9897, true, 'Uniswap' , 'UniversalRouter' , array['bnb']) - , (0x4c60051384bd2d3c01bfc845cf5f4b44bcbe9de5, true, 'Uniswap' , 'UniversalRouter' , array['polygon','arbitrum']) - , (0x643770e279d5d0733f21d6dc03a8efbabf3255b4, true, 'Uniswap' , 'UNDEFINED' , array['polygon']) - , (0xb555edf5dcf85f42ceef1f3630a52a108e55a654, true, 'Uniswap' , 'UniversalRouter' , array['optimism']) - , (0xec8b0f7ffe3ae75d7ffab09429e3675bb63503e4, true, 'Uniswap' , 'UNDEFINED' , array['bnb','arbitrum','optimism','base']) - , (0xb971ef87ede563556b2ed4b1c0b0019111dd85d2, true, 'Uniswap' , 'UNDEFINED' , array['bnb']) - , (0x2626664c2603336e57b271c5c0b26f421741e481, true, 'Uniswap' , 'UNDEFINED' , array['base']) - , (0x198ef79f1f515f02dfe9e3115ed9fc07183f02fc, true, 'Uniswap' , 'UNDEFINED' , array['base']) - , (0xe80bf394d190851e215d5f67b67f8f5a52783f1e, true, 'Uniswap' , 'UniswapX' , array['ethereum']) - , (0x6000da47483062a0d734ba3dc7576ce6a0b645c4, true, 'Uniswap' , 'UniswapX' , array['ethereum']) - , (0x9c12939390052919af3155f41bf4160fd3666a6f, true, 'Velodrome' , 'Router' , array['optimism']) - , (0xa132dab612db5cb9fc9ac426a0cc215a3423f9c9, true, 'Velodrome' , 'Router' , array['optimism']) - , (0x777777773fdd8b28bb03377d10fcea75ad9768da, true, 'Viarouter' , 'ViaRouter' , array['polygon','arbitrum','optimism']) - , (0xf29ace1fe5f36389d0dde450a0195a30c3770245, true, 'W3swap' , 'W3swapRouterV2' , array['bnb']) - , (0x5023882f4d1ec10544fcb2066abe9c1645e95aa0, true, 'Wigoswap' , 'Router' , array['fantom']) - , (0x19609b03c976cca288fbdae5c21d4290e9a4add7, true, 'Wombat' , 'WombatRouter' , array['bnb']) - , (0x5aa6a4e96a9129562e2fc06660d07feddaaf7854, true, 'WooFi' , 'WooRouterV2' , array['avalanche_c']) - , (0xcef5be73ae943b77f9bc08859367d923c030a269, true, 'WooFi' , 'WooRouterV2' , array['bnb']) - , (0xdf37f7a85d4563f39a78494568824b4df8669b7a, true, 'WooFi' , 'WooCrossChainRouter' , array['avalanche_c']) - , (0xeaf1ac8e89ea0ae13e0f03634a4ff23502527024, true, 'WooFi' , 'WooRouter' , array['optimism']) - , (0xc4729e56b831d74bbc18797e0e17a295fa77488c, true, 'Yield' , 'YakRouter' , array['avalanche_c']) - , (0xdef1c0ded9bec7f1a1670819833240f027b25eff, true, 'ZeroEx' , 'ExchangeProxy' , array['ethereum','bnb','polygon','arbitrum']) - , (0xe66b31678d6c16e9ebf358268a790b763c133750, true, 'ZeroEx' , 'ExchangeProxy' , array['ethereum']) - , (0xdef189deaef76e379df891899eb5a00a94cbc250, true, 'ZeroEx' , 'ExchangeProxy' , array['fantom']) - , (0xdef1abe32c034e558cdd535791643c58a13acc10, true, 'ZeroEx' , 'ExchangeProxy' , array['optimism']) - , (0x080bf510fcbf18b91105470639e9561022937712, true, 'ZeroEx' , 'ExchangeV2' , array['ethereum']) - , (0x3f93c3d9304a70c9104642ab8cd37b1e2a7c203a, true, 'ZeroEx' , 'ExchangeV2' , array['bnb']) - , (0x145f83ad6108391cbf9ed554e5ce1dbd984437f8, true, 'ZeroEx' , 'ExchangeV2' , array['bnb', 'polygon']) - , (0x61935cbdd02287b511119ddb11aeb42f1593b7ef, true, 'ZeroEx' , 'ExchangeV3' , array['ethereum']) - , (0x18381c0f738146fb694de18d1106bde2be040fa4, true, 'ZkSwap' , 'Router' , array['zksync']) - , (0xe7b0ce0526fbe3969035a145c9e9691d4d9d216c, false, 'Clipper' , 'Clipper' , array['ethereum', 'arbitrum']) - , (0x655edce464cc797526600a462a8154650eee4b77, false, 'Clipper' , 'Clipper' , array['ethereum']) - , (0xcc12532e95c2a6a4c53af153b9b739a3cc9218a7, false, 'Clipper' , 'Clipper' , array['ethereum']) - , (0x6bfce69d1df30fd2b2c8e478edec9daa643ae3b8, false, 'Clipper' , 'Clipper' , array['polygon']) - , (0xd01e3549160c62acabc4d0eb89f67aafa3de8eed, false, 'Clipper' , 'Clipper' , array['polygon']) - , (0x69107c1fc1dbf486ea64ad4fe6f9be81b8265f92, false, 'Clipper' , 'Clipper' , array['polygon']) - , (0x769728b5298445ba2828c0f3f5384227fbf590c5, false, 'Clipper' , 'Clipper' , array['arbitrum']) - , (0x5130f6ce257b8f9bf7fac0a0b519bd588120ed40, false, 'Clipper' , 'Clipper' , array['optimism']) - , (0xdbd4ffc32b34f630dd8ac18d37162ec8462db7db, false, 'Clipper' , 'Clipper' , array['optimism']) - , (0xb32d856cad3d2ef07c94867a800035e37241247c, false, 'Clipper' , 'Clipper' , array['base']) - , (0x32c85e56a82d66fa3c13e7df900682d63fcbaf89, false, 'Hashflow' , 'HashflowRouterV1' , array['ethereum', 'arbitrum']) - , (0xe2e3441004e7d377a2d97142e75d465e0dd36af9, false, 'Hashflow' , 'HashflowRouterV1' , array['ethereum']) - , (0x79cdfd7bc46d577b95ed92bcdc8ababa1844af0c, false, 'Hashflow' , 'HashflowRouterV1' , array['ethereum']) - , (0xedc827442114f038d009417a88942a619b8cfe17, false, 'Hashflow' , 'HashflowRouterV1' , array['polygon']) - , (0x5e8297efe1a5d9064f5dd3bb525d84807440a90d, false, 'Hashflow' , 'HashflowRouterV1' , array['bnb']) - , (0x3fff9a58676584ba28e8780366d7d9cef0eb78ce, false, 'Hashflow' , 'HashflowRouterV1' , array['bnb']) - , (0x375e05f6e12028e933ce598ad1bed7f1194ab071, false, 'Hashflow' , 'HashflowRouterV1' , array['bnb']) - , (0xacfaaa9da11e66a8cc8af8e3d844673968fff63f, false, 'Hashflow' , 'HashflowRouterV1' , array['polygon']) - , (0x8ee11bbd4139989e5f8bb92e8a9e01bc08df3011, false, 'Hashflow' , 'HashflowRouterV1' , array['polygon']) - , (0xab68b6213b091de92680ec57e879a20bbf12afda, false, 'Hashflow' , 'HashflowRouterV1' , array['arbitrum']) - , (0x6fce1a7c3347e78d22c278eb3a5c72ec8fcea294, false, 'Hashflow' , 'HashflowRouterV1' , array['arbitrum']) - , (0x36c543b8bb76b330ecb66a13c1c1377f889f1919, false, 'Hashflow' , 'HashflowRouterV1' , array['arbitrum']) - , (0x39b558bfc3c65230a5fa5170dbf7a44158a340f6, false, 'Hashflow' , 'HashflowRouterV1' , array['avalanche_c']) - , (0x43b4bf8758cae65e6b8242d2669e0e5e20ff693a, false, 'Hashflow' , 'HashflowRouterV1' , array['avalanche_c']) - , (0x45e817d12758ac37bc8dd3c71143c1be75e3ed6f, false, 'Hashflow' , 'HashflowRouterV1' , array['avalanche_c']) - , (0x54a06197130e02aa0244c4a413f70c52348c3610, false, 'Hashflow' , 'HashflowRouterV1' , array['optimism']) - , (0xfb1b9a97f1836173390d8bdeaf9004727311a8e1, false, 'Hashflow' , 'HashflowRouterV1' , array['optimism']) - , (0xf6a94dfd0e6ea9ddfdffe4762ad4236576136613, false, 'Hashflow' , 'HashflowRouterV2' , array['ethereum']) - , (0x0acffb0fb2cddd9bd35d03d359f3d899e32facc9, false, 'Hashflow' , 'HashflowRouterV2' , array['bnb']) - , (0x72550597dc0b2e0bec24e116add353599eff2e35, false, 'Hashflow' , 'HashflowRouterV2' , array['polygon']) - , (0x1f772fa3bc263160ea09bb16ce1a6b8fc0fab36a, false, 'Hashflow' , 'HashflowRouterV2' , array['arbitrum']) - , (0x64d2f9f44fe26c157d552ae7eaa613ca6587b59e, false, 'Hashflow' , 'HashflowRouterV2' , array['avalanche_c']) - , (0xb3999f658c0391d94a37f7ff328f3fec942bcadc, false, 'Hashflow' , 'HashflowRouterV2' , array['optimism']) - , (0x55084ee0fef03f14a305cd24286359a35d735151, false, 'Hashflow' , 'HashflowRouterV3' , array['ethereum', 'bnb', 'polygon', 'arbitrum', 'avalanche_c']) - , (0xca310b1b942a30ff4b40a5e1b69ab4607ec79bc1, false, 'Hashflow' , 'HashflowRouterV3' , array['optimism']) - , (0x3d130bf4686b3d4b6eb91a8e26ac629c5bea6082, false, 'Native' , 'Native' , array['ethereum', 'bnb', 'arbitrum', 'avalanche_c']) - , (0xf39276d0eedfd604b55a0bd23c7ab2145ace4ab0, false, 'Native' , 'Native' , array['ethereum', 'bnb']) - , (0x816ecda969e24583e79b71645f1202dabd7fe90e, false, 'Native' , 'Native' , array['ethereum', 'arbitrum']) - , (0x5b0711eee0c6366aa35a98b14fd8b4b4c6d1d04c, false, 'Native' , 'Native' , array['ethereum']) - , (0xf6b94770608ebf8b9b7621378cde5bc04b431cc8, false, 'Native' , 'Native' , array['bnb', 'arbitrum']) - , (0xbd0180f7365a354b3b857c0ab16377c7bcdd2ec9, false, 'Native' , 'Native' , array['bnb', 'avalanche_c']) - , (0x56385da1f6d17185402fe21795e0593837c8e991, false, 'Native' , 'Native' , array['bnb']) - , (0x52a19f554882743b9e30968aafa48740979b141e, false, 'Native' , 'Native' , array['bnb']) - , (0x63cb5b1d61e15dc31c80c787fe791baf1c81aec7, false, 'Native' , 'Native' , array['bnb']) - , (0xd5473f6fb73422f416f01e096eefcc5af9894b71, false, 'Native' , 'Native' , array['polygon']) - , (0x45b69fd499f068b7306d743d2f8b2ad5c54d99a0, false, 'Native' , 'Native' , array['polygon']) - , (0x3151263101e0361b39cd6c530e45b28c33cbaf46, false, 'Native' , 'Native' , array['polygon']) - , (0xd315a9c38ec871068fec378e4ce78af528c76293, false, 'Swaap' , 'Vault' , array['ethereum', 'polygon', 'arbitrum']) - , (0xa57bd00134b2850b2a1c55860c9e9ea100fdd6cf, false, 'MEVBot' , 'MEVBot' , array['ethereum']) - , (0xa69babef1ca67a37ffaf7a485dfff3382056e78c, false, 'MEVBot' , 'MEVBot' , array['ethereum']) - , (0x00000000003b3cc22af3ae1eac0440bcee416b40, false, 'MEVBot' , 'MEVBot' , array['ethereum']) - , (0x0000000000007f150bd6f54c40a34d7c3d5e9f56, false, 'MEVBot' , 'MEVBot' , array['ethereum']) - , (0x80d4230c0a68fc59cb264329d3a717fcaa472a13, false, 'MEVBot' , 'MEVBot' , array['ethereum']) - , (0x0000000000005117dd3a72e64a705198753fdd54, false, 'MEVBot' , 'MEVBot' , array['ethereum']) - , (0xede2fafba9e23418485f49f052d0e1d332853e0f, false, 'MEVBot' , 'MEVBot' , array['ethereum']) - , (0x018d5c4783f5317815f6e8168942a12adde3cd3c, false, 'MEVBot' , 'MEVBot' , array['ethereum']) - , (0xbadc0defafcf6d4239bdf0b66da4d7bd36fcf05a, false, 'MEVBot' , 'MEVBot' , array['ethereum']) - , (0x860bd2dba9cd475a61e6d1b45e16c365f6d78f66, false, 'MEVBot' , 'MEVBot' , array['ethereum']) - , (0x00000000c2cf7648c169b25ef1c217864bfa38cc, false, 'MEVBot' , 'MEVBot' , array['ethereum']) - , (0x3d71d79c224998e608d03c5ec9b405e7a38505f0, false, 'Unknown' , 'Unknown' , array['ethereum']) - , (0x78a55b9b3bbeffb36a43d9905f654d2769dc55e8, false, 'Unknown' , 'Unknown' , array['ethereum']) - , (0x7dad75b50c0e78b34cc543e8632aa63f6a661bce, false, 'Unknown' , 'Unknown' , array['polygon']) - , (0xc715ca10a7eb704af0847b860de4b1ea997fa3de, false, 'Unknown' , 'Unknown' , array['polygon']) - , (0x0773edc0438b2ef18fc535b21d0ac77912c308c0, false, 'Unknown' , 'Unknown' , array['polygon']) - , (0x403022af121cdca9c4acf4b94b2934429594ea29, false, 'Unknown' , 'Unknown' , array['polygon']) - , (0x0773edc0438b2ef18fc535b21d0ac77912c308c0, false, 'Unknown' , 'Unknown' , array['arbitrum']) - , (0x6a3e4b7e23661108aaec70266c468e6c679ae022, false, 'Unknown' , 'Unknown' , array['arbitrum']) - , (0xf770c63b1764a9c8f0fa925044158b09855a7faf, false, 'Unknown' , 'Unknown' , array['arbitrum']) - , (0x00000000001f8b68515efb546542397d3293ccfd, false, 'Unknown' , 'ArbBot' , array['bnb']) - ) as c(address, user, project, tag, blockchains), unnest(blockchains) as blockchains(blockchain) -) - -, creations as ( - {% for blockchain in all_evm_chains() %} - select - '{{blockchain}}' as blockchain - , address - , max(block_time) as last_created_at - , max("from") as last_creator - , max(tx_hash) as last_creation_tx_hash - from {{ source(blockchain, 'creation_traces') }} - group by 1, 2 - {% if not loop.last %} union all {% endif %} - {% endfor %} -) - --- output -- - -select - blockchain - , address - , project - , tag - , map_from_entries(array[('user', user), ('multi', multi), ('lops', lops)]) as flags - , last_created_at - , last_creator - , last_creation_tx_hash -from contracts -join creations using(blockchain, address) -order by project, blockchain, last_created_at, tag, address \ No newline at end of file +{% for blockchain in oneinch_exposed_blockchains_list() %} + select * from ({{ oneinch_mapped_contracts_macro(blockchain) }}) + {% if not loop.last %} union all {% endif %} +{% endfor %} \ No newline at end of file diff --git a/models/oneinch/_meta/oneinch_mapped_methods.sql b/models/oneinch/_meta/oneinch_mapped_methods.sql index 76e5db8b329..27d5d3244b2 100644 --- a/models/oneinch/_meta/oneinch_mapped_methods.sql +++ b/models/oneinch/_meta/oneinch_mapped_methods.sql @@ -4,127 +4,14 @@ alias = 'mapped_methods', materialized = 'table', on_table_exists = 'drop', + tags = ['prod_exclude'], unique_key = ['blockchain', 'address', 'signature'], ) }} -with - -static as ( - select - array['swap', 'settle', 'change', 'exact', 'batch', 'trade', 'sell', 'buy', 'fill', 'route', 'zap', 'symbiosis', 'aggregate', 'multicall', 'execute', 'wrap', 'transform'] as suitable - , array['add', 'remove', 'mint', 'increase', 'decrease', 'cancel', 'destroy', 'claim', 'rescue', 'withdraw', 'simulate', 'join', 'exit', 'interaction', '721', '1155', 'nft', 'create'] as exceptions - , array['fill', 'order'] as limits - , array['1inch', 'CoWSwap', 'MetaMask', 'Odos', 'OpenOcean', 'Paraswap', 'SlingshotFinance', 'Uniswap', 'ZeroEx'] as main - , array['Rainbow'] as notlimits - , array[ - 0x13d79a0b -- CoW settle - , 0x0965d04b -- 1inch settleOrders - , 0x05afc977 -- UniswapX execute - , 0x6f1d5f51 -- UniswapX executeBatch - , 0x3f62192e -- UniswapX execute - , 0x0d7a16c3 -- UniswapX executeBatch - , 0x0d335884 -- UniswapX executeWithCallback - , 0x13fb72c7 -- UniswapX executeBatchWithCallback - ] as intents -) - -, contracts as ( - {% for blockchain in oneinch_exposed_blockchains_list() %} - select - blockchain - , address - , any_value(project) as project - , any_value(tag) as tag - , any_value(flags) as flags - , any_value(last_created_at) as last_created_at - , max_by(abi, created_at) as abi - , max_by(namespace, created_at) as namespace - , max_by(name, created_at) as name - from {{ source(blockchain, 'contracts') }} - join (select * from {{ ref('oneinch_mapped_contracts') }} where blockchain = '{{blockchain}}') using(address) - where flags['user'] - group by 1, 2 +{% for blockchain in oneinch_exposed_blockchains_list() %} + select * from ({{ oneinch_mapped_methods_macro(blockchain) }}) {% if not loop.last %} union all {% endif %} - {% endfor %} -) - -, descriptions as ( - select - blockchain - , address - , project - , json_value(entity, 'lax $.name') as method - , cast(json_parse(json_query(entity, 'lax $.inputs.type' with array wrapper)) as array(varchar)) as types - , cast(json_parse(json_query(entity, 'lax $.inputs.components.type' with array wrapper)) as array(varchar)) as components - , cast(json_parse(json_query(entity, 'lax $.inputs.components.size()' with array wrapper)) as array(int)) as sizes - , json_query(entity, 'lax $.inputs') as inputs - , json_query(entity, 'lax $.outputs') as outputs - , namespace - , name - , tag - , flags - , last_created_at - from contracts, unnest(abi) as abi(entity) - where - json_value(entity, 'lax $.type') = 'function' - and json_value(entity, 'lax $.stateMutability') in ('payable', 'nonpayable') -) - -, signatures as ( - select - * - , substr(keccak(to_utf8(signature)), 1, 4) as selector - , reduce(suitable, false, (r, x) -> if(position(x in lower(replace(method, '_'))) > 0, true, r), r -> r) and not reduce(exceptions, false, (r, x) -> if(position(x in lower(replace(method, '_'))) > 0, true, r), r -> r) as swap - , reduce(limits, false, (r, x) -> if(position(x in lower(replace(method, '_'))) > 0, true, r), r -> r) and not reduce(exceptions, false, (r, x) -> if(position(x in lower(replace(method, '_'))) > 0, true, r) and not contains(notlimits, project), r -> r) as _limits - from ( - select - * - , method || '(' || if( - parts is null - , array_join(types, ',') - , reduce( - sequence(1, cardinality(parts)) - , (array_join(types, ','), parts) - , (r, x) -> ( - substr(r[1], 1, position('tuple' in r[1]) - 1) || '(' || r[2][1] || ')' || substr(r[1], position('tuple' in r[1]) + 5) - , slice(r[2], 2, cardinality(r[2]) - 1) - ) - , r -> r[1] - ) - ) || ')' as signature - from ( - select - * - , reduce(sequence(1, cardinality(sizes)), cast(array[] as array(varchar)), (r, x) -> r || array_join(slice(components, start[x], sizes[x]), ','), r -> r) as parts - from ( - select - * - , reduce(sequence(1, cardinality(sizes)), cast(array[] as array(int)), (r, x) -> if(x = 1, r || x, r || r[x - 1] + sizes[x - 1]), r -> r) as start - from descriptions - ) - ) - join static on true - ) -) - --- output -- - -select - map_concat(flags, map_from_entries(array[('swap', swap), ('limits', _limits), ('intents', contains(intents, selector)), ('multi', flags['multi']), ('main', contains(main, project))])) as flags - , blockchain - , address - , last_created_at - , project - , method - , signature - , selector - , namespace - , name - , tag - , inputs - , outputs -from signatures -order by project, blockchain, last_created_at, tag, address, method \ No newline at end of file +{% endfor %} \ No newline at end of file diff --git a/models/oneinch/arbitrum/_meta/oneinch_arbitrum_mapped_contracts.sql b/models/oneinch/arbitrum/_meta/oneinch_arbitrum_mapped_contracts.sql new file mode 100644 index 00000000000..9683983f212 --- /dev/null +++ b/models/oneinch/arbitrum/_meta/oneinch_arbitrum_mapped_contracts.sql @@ -0,0 +1,17 @@ +{% set blockchain = 'arbitrum' %} + + + +{{ + config( + schema = 'oneinch_' + blockchain, + alias = 'mapped_contracts', + materialized = 'table', + on_table_exists = 'drop', + unique_key = ['blockchain', 'address'], + ) +}} + + + +{{ oneinch_mapped_contracts_macro(blockchain) }} \ No newline at end of file diff --git a/models/oneinch/arbitrum/_meta/oneinch_arbitrum_mapped_methods.sql b/models/oneinch/arbitrum/_meta/oneinch_arbitrum_mapped_methods.sql new file mode 100644 index 00000000000..ffea59883d7 --- /dev/null +++ b/models/oneinch/arbitrum/_meta/oneinch_arbitrum_mapped_methods.sql @@ -0,0 +1,17 @@ +{% set blockchain = 'arbitrum' %} + + + +{{ + config( + schema = 'oneinch_' + blockchain, + alias = 'mapped_methods', + materialized = 'table', + on_table_exists = 'drop', + unique_key = ['blockchain', 'address'], + ) +}} + + + +{{ oneinch_mapped_methods_macro(blockchain) }} \ No newline at end of file diff --git a/models/oneinch/arbitrum/oneinch_arbitrum_project_orders.sql b/models/oneinch/arbitrum/oneinch_arbitrum_project_orders.sql new file mode 100644 index 00000000000..5d261a925a2 --- /dev/null +++ b/models/oneinch/arbitrum/oneinch_arbitrum_project_orders.sql @@ -0,0 +1,23 @@ +{% set blockchain = 'arbitrum' %} + + + +{{ + config( + schema = 'oneinch_' + blockchain, + alias = 'project_orders', + partition_by = ['block_month'], + materialized = 'incremental', + file_format = 'delta', + incremental_strategy = 'merge', + unique_key = ['blockchain', 'block_number', 'tx_hash', 'call_trace_address', 'order_hash'] + ) +}} + + + +{{ + oneinch_project_orders_macro( + blockchain = blockchain + ) +}} \ No newline at end of file diff --git a/models/oneinch/avalanche_c/_meta/oneinch_avalanche_c_mapped_contracts.sql b/models/oneinch/avalanche_c/_meta/oneinch_avalanche_c_mapped_contracts.sql new file mode 100644 index 00000000000..31ee2fa667f --- /dev/null +++ b/models/oneinch/avalanche_c/_meta/oneinch_avalanche_c_mapped_contracts.sql @@ -0,0 +1,17 @@ +{% set blockchain = 'avalanche_c' %} + + + +{{ + config( + schema = 'oneinch_' + blockchain, + alias = 'mapped_contracts', + materialized = 'table', + on_table_exists = 'drop', + unique_key = ['blockchain', 'address'], + ) +}} + + + +{{ oneinch_mapped_contracts_macro(blockchain) }} \ No newline at end of file diff --git a/models/oneinch/avalanche_c/_meta/oneinch_avalanche_c_mapped_methods.sql b/models/oneinch/avalanche_c/_meta/oneinch_avalanche_c_mapped_methods.sql new file mode 100644 index 00000000000..55dfa362ad4 --- /dev/null +++ b/models/oneinch/avalanche_c/_meta/oneinch_avalanche_c_mapped_methods.sql @@ -0,0 +1,17 @@ +{% set blockchain = 'avalanche_c' %} + + + +{{ + config( + schema = 'oneinch_' + blockchain, + alias = 'mapped_methods', + materialized = 'table', + on_table_exists = 'drop', + unique_key = ['blockchain', 'address'], + ) +}} + + + +{{ oneinch_mapped_methods_macro(blockchain) }} \ No newline at end of file diff --git a/models/oneinch/avalanche_c/oneinch_avalanche_c_project_orders.sql b/models/oneinch/avalanche_c/oneinch_avalanche_c_project_orders.sql new file mode 100644 index 00000000000..d5a2aa06fb1 --- /dev/null +++ b/models/oneinch/avalanche_c/oneinch_avalanche_c_project_orders.sql @@ -0,0 +1,23 @@ +{% set blockchain = 'avalanche_c' %} + + + +{{ + config( + schema = 'oneinch_' + blockchain, + alias = 'project_orders', + partition_by = ['block_month'], + materialized = 'incremental', + file_format = 'delta', + incremental_strategy = 'merge', + unique_key = ['blockchain', 'block_number', 'tx_hash', 'call_trace_address', 'order_hash'] + ) +}} + + + +{{ + oneinch_project_orders_macro( + blockchain = blockchain + ) +}} \ No newline at end of file diff --git a/models/oneinch/base/_meta/oneinch_base_mapped_contracts.sql b/models/oneinch/base/_meta/oneinch_base_mapped_contracts.sql new file mode 100644 index 00000000000..440ca14ab69 --- /dev/null +++ b/models/oneinch/base/_meta/oneinch_base_mapped_contracts.sql @@ -0,0 +1,17 @@ +{% set blockchain = 'base' %} + + + +{{ + config( + schema = 'oneinch_' + blockchain, + alias = 'mapped_contracts', + materialized = 'table', + on_table_exists = 'drop', + unique_key = ['blockchain', 'address'], + ) +}} + + + +{{ oneinch_mapped_contracts_macro(blockchain) }} \ No newline at end of file diff --git a/models/oneinch/base/_meta/oneinch_base_mapped_methods.sql b/models/oneinch/base/_meta/oneinch_base_mapped_methods.sql new file mode 100644 index 00000000000..083988f0c78 --- /dev/null +++ b/models/oneinch/base/_meta/oneinch_base_mapped_methods.sql @@ -0,0 +1,17 @@ +{% set blockchain = 'base' %} + + + +{{ + config( + schema = 'oneinch_' + blockchain, + alias = 'mapped_methods', + materialized = 'table', + on_table_exists = 'drop', + unique_key = ['blockchain', 'address'], + ) +}} + + + +{{ oneinch_mapped_methods_macro(blockchain) }} \ No newline at end of file diff --git a/models/oneinch/base/oneinch_base_project_orders.sql b/models/oneinch/base/oneinch_base_project_orders.sql new file mode 100644 index 00000000000..bd07735e15b --- /dev/null +++ b/models/oneinch/base/oneinch_base_project_orders.sql @@ -0,0 +1,23 @@ +{% set blockchain = 'base' %} + + + +{{ + config( + schema = 'oneinch_' + blockchain, + alias = 'project_orders', + partition_by = ['block_month'], + materialized = 'incremental', + file_format = 'delta', + incremental_strategy = 'merge', + unique_key = ['blockchain', 'block_number', 'tx_hash', 'call_trace_address', 'order_hash'] + ) +}} + + + +{{ + oneinch_project_orders_macro( + blockchain = blockchain + ) +}} \ No newline at end of file diff --git a/models/oneinch/bnb/_meta/oneinch_bnb_mapped_contracts.sql b/models/oneinch/bnb/_meta/oneinch_bnb_mapped_contracts.sql new file mode 100644 index 00000000000..2ce3efeefff --- /dev/null +++ b/models/oneinch/bnb/_meta/oneinch_bnb_mapped_contracts.sql @@ -0,0 +1,17 @@ +{% set blockchain = 'bnb' %} + + + +{{ + config( + schema = 'oneinch_' + blockchain, + alias = 'mapped_contracts', + materialized = 'table', + on_table_exists = 'drop', + unique_key = ['blockchain', 'address'], + ) +}} + + + +{{ oneinch_mapped_contracts_macro(blockchain) }} \ No newline at end of file diff --git a/models/oneinch/bnb/_meta/oneinch_bnb_mapped_methods.sql b/models/oneinch/bnb/_meta/oneinch_bnb_mapped_methods.sql new file mode 100644 index 00000000000..658cb50a493 --- /dev/null +++ b/models/oneinch/bnb/_meta/oneinch_bnb_mapped_methods.sql @@ -0,0 +1,17 @@ +{% set blockchain = 'bnb' %} + + + +{{ + config( + schema = 'oneinch_' + blockchain, + alias = 'mapped_methods', + materialized = 'table', + on_table_exists = 'drop', + unique_key = ['blockchain', 'address'], + ) +}} + + + +{{ oneinch_mapped_methods_macro(blockchain) }} \ No newline at end of file diff --git a/models/oneinch/bnb/oneinch_bnb_project_orders.sql b/models/oneinch/bnb/oneinch_bnb_project_orders.sql new file mode 100644 index 00000000000..6aa5159b77b --- /dev/null +++ b/models/oneinch/bnb/oneinch_bnb_project_orders.sql @@ -0,0 +1,23 @@ +{% set blockchain = 'bnb' %} + + + +{{ + config( + schema = 'oneinch_' + blockchain, + alias = 'project_orders', + partition_by = ['block_month'], + materialized = 'incremental', + file_format = 'delta', + incremental_strategy = 'merge', + unique_key = ['blockchain', 'block_number', 'tx_hash', 'call_trace_address', 'order_hash'] + ) +}} + + + +{{ + oneinch_project_orders_macro( + blockchain = blockchain + ) +}} \ No newline at end of file diff --git a/models/oneinch/ethereum/_meta/oneinch_ethereum_mapped_contracts.sql b/models/oneinch/ethereum/_meta/oneinch_ethereum_mapped_contracts.sql new file mode 100644 index 00000000000..89a969597c3 --- /dev/null +++ b/models/oneinch/ethereum/_meta/oneinch_ethereum_mapped_contracts.sql @@ -0,0 +1,17 @@ +{% set blockchain = 'ethereum' %} + + + +{{ + config( + schema = 'oneinch_' + blockchain, + alias = 'mapped_contracts', + materialized = 'table', + on_table_exists = 'drop', + unique_key = ['blockchain', 'address'], + ) +}} + + + +{{ oneinch_mapped_contracts_macro(blockchain) }} \ No newline at end of file diff --git a/models/oneinch/ethereum/_meta/oneinch_ethereum_mapped_methods.sql b/models/oneinch/ethereum/_meta/oneinch_ethereum_mapped_methods.sql new file mode 100644 index 00000000000..28e4ca95368 --- /dev/null +++ b/models/oneinch/ethereum/_meta/oneinch_ethereum_mapped_methods.sql @@ -0,0 +1,17 @@ +{% set blockchain = 'ethereum' %} + + + +{{ + config( + schema = 'oneinch_' + blockchain, + alias = 'mapped_methods', + materialized = 'table', + on_table_exists = 'drop', + unique_key = ['blockchain', 'address'], + ) +}} + + + +{{ oneinch_mapped_methods_macro(blockchain) }} \ No newline at end of file diff --git a/models/oneinch/ethereum/oneinch_ethereum_project_orders.sql b/models/oneinch/ethereum/oneinch_ethereum_project_orders.sql new file mode 100644 index 00000000000..0febf34d76f --- /dev/null +++ b/models/oneinch/ethereum/oneinch_ethereum_project_orders.sql @@ -0,0 +1,23 @@ +{% set blockchain = 'ethereum' %} + + + +{{ + config( + schema = 'oneinch_' + blockchain, + alias = 'project_orders', + partition_by = ['block_month'], + materialized = 'incremental', + file_format = 'delta', + incremental_strategy = 'merge', + unique_key = ['blockchain', 'block_number', 'tx_hash', 'call_trace_address', 'order_hash'] + ) +}} + + + +{{ + oneinch_project_orders_macro( + blockchain = blockchain + ) +}} \ No newline at end of file diff --git a/models/oneinch/fantom/_meta/oneinch_fantom_mapped_contracts.sql b/models/oneinch/fantom/_meta/oneinch_fantom_mapped_contracts.sql new file mode 100644 index 00000000000..6e11730d196 --- /dev/null +++ b/models/oneinch/fantom/_meta/oneinch_fantom_mapped_contracts.sql @@ -0,0 +1,17 @@ +{% set blockchain = 'fantom' %} + + + +{{ + config( + schema = 'oneinch_' + blockchain, + alias = 'mapped_contracts', + materialized = 'table', + on_table_exists = 'drop', + unique_key = ['blockchain', 'address'], + ) +}} + + + +{{ oneinch_mapped_contracts_macro(blockchain) }} \ No newline at end of file diff --git a/models/oneinch/fantom/_meta/oneinch_fantom_mapped_methods.sql b/models/oneinch/fantom/_meta/oneinch_fantom_mapped_methods.sql new file mode 100644 index 00000000000..37bdc0b8c03 --- /dev/null +++ b/models/oneinch/fantom/_meta/oneinch_fantom_mapped_methods.sql @@ -0,0 +1,17 @@ +{% set blockchain = 'fantom' %} + + + +{{ + config( + schema = 'oneinch_' + blockchain, + alias = 'mapped_methods', + materialized = 'table', + on_table_exists = 'drop', + unique_key = ['blockchain', 'address'], + ) +}} + + + +{{ oneinch_mapped_methods_macro(blockchain) }} \ No newline at end of file diff --git a/models/oneinch/fantom/oneinch_fantom_project_orders.sql b/models/oneinch/fantom/oneinch_fantom_project_orders.sql new file mode 100644 index 00000000000..a36105df5ca --- /dev/null +++ b/models/oneinch/fantom/oneinch_fantom_project_orders.sql @@ -0,0 +1,23 @@ +{% set blockchain = 'fantom' %} + + + +{{ + config( + schema = 'oneinch_' + blockchain, + alias = 'project_orders', + partition_by = ['block_month'], + materialized = 'incremental', + file_format = 'delta', + incremental_strategy = 'merge', + unique_key = ['blockchain', 'block_number', 'tx_hash', 'call_trace_address', 'order_hash'] + ) +}} + + + +{{ + oneinch_project_orders_macro( + blockchain = blockchain + ) +}} \ No newline at end of file diff --git a/models/oneinch/gnosis/_meta/oneinch_gnosis_mapped_contracts.sql b/models/oneinch/gnosis/_meta/oneinch_gnosis_mapped_contracts.sql new file mode 100644 index 00000000000..56f0b3d1295 --- /dev/null +++ b/models/oneinch/gnosis/_meta/oneinch_gnosis_mapped_contracts.sql @@ -0,0 +1,17 @@ +{% set blockchain = 'gnosis' %} + + + +{{ + config( + schema = 'oneinch_' + blockchain, + alias = 'mapped_contracts', + materialized = 'table', + on_table_exists = 'drop', + unique_key = ['blockchain', 'address'], + ) +}} + + + +{{ oneinch_mapped_contracts_macro(blockchain) }} \ No newline at end of file diff --git a/models/oneinch/gnosis/_meta/oneinch_gnosis_mapped_methods.sql b/models/oneinch/gnosis/_meta/oneinch_gnosis_mapped_methods.sql new file mode 100644 index 00000000000..77d8db0d100 --- /dev/null +++ b/models/oneinch/gnosis/_meta/oneinch_gnosis_mapped_methods.sql @@ -0,0 +1,17 @@ +{% set blockchain = 'gnosis' %} + + + +{{ + config( + schema = 'oneinch_' + blockchain, + alias = 'mapped_methods', + materialized = 'table', + on_table_exists = 'drop', + unique_key = ['blockchain', 'address'], + ) +}} + + + +{{ oneinch_mapped_methods_macro(blockchain) }} \ No newline at end of file diff --git a/models/oneinch/gnosis/oneinch_gnosis_project_orders.sql b/models/oneinch/gnosis/oneinch_gnosis_project_orders.sql new file mode 100644 index 00000000000..2671f636c7d --- /dev/null +++ b/models/oneinch/gnosis/oneinch_gnosis_project_orders.sql @@ -0,0 +1,23 @@ +{% set blockchain = 'gnosis' %} + + + +{{ + config( + schema = 'oneinch_' + blockchain, + alias = 'project_orders', + partition_by = ['block_month'], + materialized = 'incremental', + file_format = 'delta', + incremental_strategy = 'merge', + unique_key = ['blockchain', 'block_number', 'tx_hash', 'call_trace_address', 'order_hash'] + ) +}} + + + +{{ + oneinch_project_orders_macro( + blockchain = blockchain + ) +}} \ No newline at end of file diff --git a/models/oneinch/oneinch_project_orders.sql b/models/oneinch/oneinch_project_orders.sql new file mode 100644 index 00000000000..6a6b249fbf6 --- /dev/null +++ b/models/oneinch/oneinch_project_orders.sql @@ -0,0 +1,140 @@ +{{ + config( + schema = 'oneinch', + alias = 'project_orders', + materialized = 'view', + unique_key = ['blockchain', 'block_number', 'tx_hash', 'call_trace_address'] + ) +}} + + + +with + +orders as ( + select + * + , array[maker_asset, taker_asset] as assets + , date_trunc('minute', block_time) as minute + , row_number() over(partition by blockchain, block_number, tx_hash, project order by call_trace_address) as counter + from ( + {% for blockchain in oneinch_exposed_blockchains_list() %} + select + blockchain + , block_number + , block_time + , tx_hash + , project + , method + , call_selector + , call_trace_address + , call_from + , call_to + , call_gas_used + , maker + , maker_asset + , coalesce(making_amount, if(order_start = uint256 '0', maker_max_amount, maker_max_amount - cast(block_unixtime - order_start as double) / (order_end - order_start) * (maker_max_amount - maker_min_amount))) as making_amount + , taker_asset + , coalesce(taking_amount, if(order_start = uint256 '0', taker_max_amount, taker_max_amount - cast(block_unixtime - order_start as double) / (order_end - order_start) * (taker_max_amount - taker_min_amount))) as taking_amount + , order_hash + , flags + from {{ ref('oneinch_' + blockchain + '_project_orders') }} + where call_success + {% if not loop.last %} union all {% endif %} + {% endfor %} + + union all + + select + blockchain + , block_number + , block_time + , tx_hash + , '1inch' as project + , method + , call_selector + , call_trace_address + , call_from + , call_to + , call_gas_used + , maker + , maker_asset + , making_amount + , taker_asset + , taking_amount + , order_hash + , flags + from {{ ref('oneinch_lop') }} + where call_success + ) +) + +, prices as ( + select + blockchain + , contract_address + , minute + , price + , decimals + , symbol + from {{ source('prices', 'usd') }} + {% if is_incremental() %} + where {{ incremental_predicate('minute') }} + {% endif %} +) + +, joined as ( + select + blockchain + , block_number + , tx_hash + , call_trace_address + , any_value(block_time) as block_time + , any_value(project) as project + , any_value(call_selector) as call_selector + , any_value(call_from) as call_from + , any_value(call_to) as call_to + , any_value(call_gas_used) as call_gas_used + , any_value(maker) as maker + , any_value(maker_asset) as maker_asset + , any_value(taker_asset) as taker_asset + , any_value(symbol) filter(where contract_address = maker_asset) as maker_asset_symbol + , any_value(symbol) filter(where contract_address = taker_asset) as taker_asset_symbol + , any_value(making_amount) as making_amount + , any_value(taking_amount) as taking_amount + , any_value(making_amount * price / pow(10, decimals)) filter(where contract_address = maker_asset) as making_amount_usd + , any_value(taking_amount * price / pow(10, decimals)) filter(where contract_address = taker_asset) as taking_amount_usd + , any_value(coalesce(order_hash, concat(tx_hash, to_big_endian_32(cast(counter as int))))) as order_hash + , any_value(flags) as flags + from (select * from orders, unnest(assets) as assets(contract_address)) + left join prices using(blockchain, contract_address, minute) + group by 1, 2, 3, 4 +) + +-- output -- + +select + blockchain + , block_number + , block_time + , tx_hash + , call_trace_address + , project + , call_selector + , call_from + , call_to + , call_gas_used + , maker + , maker_asset + , taker_asset + , maker_asset_symbol + , taker_asset_symbol + , making_amount + , taking_amount + , making_amount_usd + , taking_amount_usd + , greatest(coalesce(making_amount_usd, 0), coalesce(taking_amount_usd, 0)) as amount_usd + , order_hash + , flags + , date(date_trunc('month', block_time)) as block_month +from joined \ No newline at end of file diff --git a/models/oneinch/oneinch_project_swaps.sql b/models/oneinch/oneinch_project_swaps.sql new file mode 100644 index 00000000000..bf3968c152b --- /dev/null +++ b/models/oneinch/oneinch_project_swaps.sql @@ -0,0 +1,15 @@ +{{ + config( + schema = 'oneinch', + alias = 'project_swaps', + materialized = 'view', + unique_key = ['blockchain', 'tx_hash', 'call_trace_address'] + ) +}} + + + +{% for blockchain in oneinch_exposed_blockchains_list() %} + select * from {{ ref('oneinch_' + blockchain + '_project_swaps') }} + {% if not loop.last %} union all {% endif %} +{% endfor %} \ No newline at end of file diff --git a/models/oneinch/oneinch_schema.yml b/models/oneinch/oneinch_schema.yml index cf43f83b371..f4af98a9ea3 100644 --- a/models/oneinch/oneinch_schema.yml +++ b/models/oneinch/oneinch_schema.yml @@ -496,36 +496,6 @@ models: - name: farm_last_distributor - name: farm_last_distributor_set_up_at - - name: oneinch_exchange_contracts - meta: - blockchain: ['ethereum', 'optimism', 'polygon', 'arbitrum', 'avalanche_c', 'gnosis', 'bnb', 'fantom', 'base', 'zksync'] - sector: oneinch - contributors: ['max-morrow', 'grkhr'] - config: - tags: ['contracts', 'metadata'] - description: > - exchange contracts - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - contract_address - - blockchain - columns: - - name: project - - name: contract_address - - name: contract_id - - name: contract_name - - name: blockchain - tests: - - not_null - - name: created_at - - name: creator - - name: creation_tx_hash - - name: abi - - name: params - - name: namespaces - - name: names - - name: oneinch_fusion_accounts meta: blockchain: ['ethereum', 'bnb', 'polygon', 'arbitrum', 'avalanche_c', 'gnosis', 'optimism', 'fantom', 'base'] diff --git a/models/oneinch/optimism/_meta/oneinch_optimism_mapped_contracts.sql b/models/oneinch/optimism/_meta/oneinch_optimism_mapped_contracts.sql new file mode 100644 index 00000000000..3b3f70d7498 --- /dev/null +++ b/models/oneinch/optimism/_meta/oneinch_optimism_mapped_contracts.sql @@ -0,0 +1,17 @@ +{% set blockchain = 'optimism' %} + + + +{{ + config( + schema = 'oneinch_' + blockchain, + alias = 'mapped_contracts', + materialized = 'table', + on_table_exists = 'drop', + unique_key = ['blockchain', 'address'], + ) +}} + + + +{{ oneinch_mapped_contracts_macro(blockchain) }} \ No newline at end of file diff --git a/models/oneinch/optimism/_meta/oneinch_optimism_mapped_methods.sql b/models/oneinch/optimism/_meta/oneinch_optimism_mapped_methods.sql new file mode 100644 index 00000000000..f9010fb3596 --- /dev/null +++ b/models/oneinch/optimism/_meta/oneinch_optimism_mapped_methods.sql @@ -0,0 +1,17 @@ +{% set blockchain = 'optimism' %} + + + +{{ + config( + schema = 'oneinch_' + blockchain, + alias = 'mapped_methods', + materialized = 'table', + on_table_exists = 'drop', + unique_key = ['blockchain', 'address'], + ) +}} + + + +{{ oneinch_mapped_methods_macro(blockchain) }} \ No newline at end of file diff --git a/models/oneinch/optimism/oneinch_optimism_project_orders.sql b/models/oneinch/optimism/oneinch_optimism_project_orders.sql new file mode 100644 index 00000000000..a080b0f190f --- /dev/null +++ b/models/oneinch/optimism/oneinch_optimism_project_orders.sql @@ -0,0 +1,23 @@ +{% set blockchain = 'optimism' %} + + + +{{ + config( + schema = 'oneinch_' + blockchain, + alias = 'project_orders', + partition_by = ['block_month'], + materialized = 'incremental', + file_format = 'delta', + incremental_strategy = 'merge', + unique_key = ['blockchain', 'block_number', 'tx_hash', 'call_trace_address', 'order_hash'] + ) +}} + + + +{{ + oneinch_project_orders_macro( + blockchain = blockchain + ) +}} \ No newline at end of file diff --git a/models/oneinch/polygon/_meta/oneinch_polygon_mapped_contracts.sql b/models/oneinch/polygon/_meta/oneinch_polygon_mapped_contracts.sql new file mode 100644 index 00000000000..f3cb049864c --- /dev/null +++ b/models/oneinch/polygon/_meta/oneinch_polygon_mapped_contracts.sql @@ -0,0 +1,17 @@ +{% set blockchain = 'polygon' %} + + + +{{ + config( + schema = 'oneinch_' + blockchain, + alias = 'mapped_contracts', + materialized = 'table', + on_table_exists = 'drop', + unique_key = ['blockchain', 'address'], + ) +}} + + + +{{ oneinch_mapped_contracts_macro(blockchain) }} \ No newline at end of file diff --git a/models/oneinch/polygon/_meta/oneinch_polygon_mapped_methods.sql b/models/oneinch/polygon/_meta/oneinch_polygon_mapped_methods.sql new file mode 100644 index 00000000000..4a8f9294c6c --- /dev/null +++ b/models/oneinch/polygon/_meta/oneinch_polygon_mapped_methods.sql @@ -0,0 +1,17 @@ +{% set blockchain = 'polygon' %} + + + +{{ + config( + schema = 'oneinch_' + blockchain, + alias = 'mapped_methods', + materialized = 'table', + on_table_exists = 'drop', + unique_key = ['blockchain', 'address'], + ) +}} + + + +{{ oneinch_mapped_methods_macro(blockchain) }} \ No newline at end of file diff --git a/models/oneinch/polygon/oneinch_polygon_project_orders.sql b/models/oneinch/polygon/oneinch_polygon_project_orders.sql new file mode 100644 index 00000000000..910f1facb9a --- /dev/null +++ b/models/oneinch/polygon/oneinch_polygon_project_orders.sql @@ -0,0 +1,23 @@ +{% set blockchain = 'polygon' %} + + + +{{ + config( + schema = 'oneinch_' + blockchain, + alias = 'project_orders', + partition_by = ['block_month'], + materialized = 'incremental', + file_format = 'delta', + incremental_strategy = 'merge', + unique_key = ['blockchain', 'block_number', 'tx_hash', 'call_trace_address', 'order_hash'] + ) +}} + + + +{{ + oneinch_project_orders_macro( + blockchain = blockchain + ) +}} \ No newline at end of file diff --git a/models/oneinch/zksync/_meta/oneinch_zksync_mapped_contracts.sql b/models/oneinch/zksync/_meta/oneinch_zksync_mapped_contracts.sql new file mode 100644 index 00000000000..4dfe241f612 --- /dev/null +++ b/models/oneinch/zksync/_meta/oneinch_zksync_mapped_contracts.sql @@ -0,0 +1,17 @@ +{% set blockchain = 'zksync' %} + + + +{{ + config( + schema = 'oneinch_' + blockchain, + alias = 'mapped_contracts', + materialized = 'table', + on_table_exists = 'drop', + unique_key = ['blockchain', 'address'], + ) +}} + + + +{{ oneinch_mapped_contracts_macro(blockchain) }} \ No newline at end of file diff --git a/models/oneinch/zksync/_meta/oneinch_zksync_mapped_methods.sql b/models/oneinch/zksync/_meta/oneinch_zksync_mapped_methods.sql new file mode 100644 index 00000000000..61ad99b8484 --- /dev/null +++ b/models/oneinch/zksync/_meta/oneinch_zksync_mapped_methods.sql @@ -0,0 +1,17 @@ +{% set blockchain = 'zksync' %} + + + +{{ + config( + schema = 'oneinch_' + blockchain, + alias = 'mapped_methods', + materialized = 'table', + on_table_exists = 'drop', + unique_key = ['blockchain', 'address'], + ) +}} + + + +{{ oneinch_mapped_methods_macro(blockchain) }} \ No newline at end of file diff --git a/models/oneinch/zksync/oneinch_zksync_project_orders.sql b/models/oneinch/zksync/oneinch_zksync_project_orders.sql new file mode 100644 index 00000000000..35a4146f2d1 --- /dev/null +++ b/models/oneinch/zksync/oneinch_zksync_project_orders.sql @@ -0,0 +1,23 @@ +{% set blockchain = 'zksync' %} + + + +{{ + config( + schema = 'oneinch_' + blockchain, + alias = 'project_orders', + partition_by = ['block_month'], + materialized = 'incremental', + file_format = 'delta', + incremental_strategy = 'merge', + unique_key = ['blockchain', 'block_number', 'tx_hash', 'call_trace_address', 'order_hash'] + ) +}} + + + +{{ + oneinch_project_orders_macro( + blockchain = blockchain + ) +}} \ No newline at end of file From 7874b8815b8f420c396afb1cb84df61e9db8fda2 Mon Sep 17 00:00:00 2001 From: viniabussafi <131974393+viniabussafi@users.noreply.github.com> Date: Mon, 3 Jun 2024 16:06:54 +0100 Subject: [PATCH 002/149] Add missing tokens on tokens.erc20 and prices.usd (#6053) * Update tokens_gnosis_erc20.sql * Update prices_arbitrum_tokens.sql --- models/prices/arbitrum/prices_arbitrum_tokens.sql | 3 ++- tokens/models/tokens/gnosis/tokens_gnosis_erc20.sql | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/models/prices/arbitrum/prices_arbitrum_tokens.sql b/models/prices/arbitrum/prices_arbitrum_tokens.sql index df25c8bd112..916a87ba851 100644 --- a/models/prices/arbitrum/prices_arbitrum_tokens.sql +++ b/models/prices/arbitrum/prices_arbitrum_tokens.sql @@ -193,5 +193,6 @@ FROM ('susde-ethena-staked-usde','arbitrum','SUSDE',0x211cc4dd073734da055fbf44a2b4667d5e5fe5d2, 18), ('yak-yield-yak','arbitrum','YAK',0x7f4db37d7beb31f445307782bc3da0f18df13696,18), ('ethx-stader-ethx','arbitrum','ETHX',0xed65c5085a18fa160af0313e60dcc7905e944dc7, 18), - ('gyd-gyro-dollar','arbitrum','GYD',0xca5d8f8a8d49439357d3cf46ca2e720702f132b8, 18) + ('gyd-gyro-dollar','arbitrum','GYD',0xca5d8f8a8d49439357d3cf46ca2e720702f132b8, 18), + ('a51-a51-finance','arbitrum','A51',0xb3f13b0c61d65d67d7d6215d70c89533ee567a91, 18) ) as temp (token_id, blockchain, symbol, contract_address, decimals) diff --git a/tokens/models/tokens/gnosis/tokens_gnosis_erc20.sql b/tokens/models/tokens/gnosis/tokens_gnosis_erc20.sql index 7bbd39d0066..45a84963bc3 100644 --- a/tokens/models/tokens/gnosis/tokens_gnosis_erc20.sql +++ b/tokens/models/tokens/gnosis/tokens_gnosis_erc20.sql @@ -7794,4 +7794,5 @@ FROM (VALUES , ( 0x4d18815d14fe5c3304e87b3fa18318baa5c23820, 'SAFE', 18) , ( 0x270ba1f35d8b87510d24f693fccc0da02e6e4eeb, 'stataGnoUSDC', 6) , ( 0x1a8805194d0ef2f73045a00c70da399d9e74221c, 'GNOBBY', 18) + , ( 0xF4F3c1666E750E014DE65c50d0e98B1263E678B8, 'SLX', 18) ) AS temp_table (contract_address, symbol, decimals) From f19e0e7e11bcb1895bda70da45035a01c90c0ed9 Mon Sep 17 00:00:00 2001 From: yy-analytics <103118737+yy-analytics@users.noreply.github.com> Date: Mon, 3 Jun 2024 20:37:27 +0530 Subject: [PATCH 003/149] Added a few strategies (#6048) --- .../yield_yak/yield_yak_strategies.sql | 15 +++ .../arbitrum/yield_yak_arbitrum_sources.yml | 8 ++ .../yield_yak_avalanche_c_sources.yml | 112 ++++++++++++++++++ 3 files changed, 135 insertions(+) diff --git a/macros/models/_project/yield_yak/yield_yak_strategies.sql b/macros/models/_project/yield_yak/yield_yak_strategies.sql index 304a0a4194b..a5f00be4707 100644 --- a/macros/models/_project/yield_yak/yield_yak_strategies.sql +++ b/macros/models/_project/yield_yak/yield_yak_strategies.sql @@ -11,11 +11,14 @@ 'AaveStrategyV1', 'AaveV3StrategyAvaxV1', 'AaveV3StrategyV1', + 'AbracadabraStrategyForLP', 'AnkrAvaxPlatypusStrategy', 'AutoPoolStrategy', + 'AvaiStrategyForLP', 'AxialStrategyForLP', 'AxialStrategyForMetapoolLP', 'BalancerDirectJoinStrategy', + 'BambooStrategyForLP', 'BenqiStrategyAvaxV1', 'BenqiStrategyForLP', 'BenqiStrategyQiV1', @@ -32,6 +35,7 @@ 'CompoundingBlp', 'CompoundingGondola', 'CompoundingJoe', + 'CompoundingJoeV2', 'CompoundingJoeV3', 'CompoundingXava', 'CompoundingYYStaking', @@ -42,9 +46,11 @@ 'DexStrategySA', 'DexStrategySAWithSwap', 'DexStrategySAWithSwapV2', + 'DexStrategyV3', 'DexStrategyV4', 'DexStrategyV5', 'DexStrategyV5Reflection', + 'DexStrategyV5ReflectionV2', 'DexStrategyV6', 'DexStrategyV6a', 'EchidnaStrategy', @@ -57,6 +63,7 @@ 'GmxStrategyForGLP', 'GmxStrategyForGMX', 'GondolaStrategyForLP', + 'GondolaStrategyForLPV2', 'GondolaStrategyForPoolBTC', 'GondolaStrategyForPoolDAI', 'GondolaStrategyForPoolDAIeUSDTe', @@ -64,6 +71,8 @@ 'GondolaStrategyForPoolUSDT', 'GondolaStrategyForPoolV2', 'HakuStrategyForLP', + 'IceQueenStrategy', + 'IceQueenStrategyV2', 'JoeLendingStrategyAvaxV1', 'JoeLendingStrategyV1', 'JoeLendingStrategyV2', @@ -84,7 +93,9 @@ 'MasterYakStrategyForSA', 'MemeRushStrategy', 'MoreMoneyStrategy', + 'OliveStrategyForLPa', 'OliveStrategyForLPb', + 'OliveStrategyForLPc', 'OliveStrategyForSA', 'PangolinV2StrategyForLP', 'PangolinV2VariableRewardsStrategyForLP', @@ -92,10 +103,13 @@ 'PenguinStrategyForLPb', 'PlatypusStrategy', 'SonicStrategyForSA', + 'StableVaultStrategyForS3D', 'StableVaultStrategyForS3F', 'StargateStrategyForLP', + 'StargateV2Strategy', 'StormStrategyForLP', 'StormStrategyForSA', + 'SuStrategyV2', 'SynapseStrategy', 'UnipoolStrategyV1', 'UspPlatypusStrategy', @@ -128,6 +142,7 @@ 'LevelStrategy', 'PendleStrategy', 'SiloStrategy', + 'StargateV2Strategy', 'SushiStrategyForLP', 'SynapseStrategy', 'SynapseStrategyV2', diff --git a/sources/yield_yak/arbitrum/yield_yak_arbitrum_sources.yml b/sources/yield_yak/arbitrum/yield_yak_arbitrum_sources.yml index 9fc7c247d86..c377ef0e4df 100644 --- a/sources/yield_yak/arbitrum/yield_yak_arbitrum_sources.yml +++ b/sources/yield_yak/arbitrum/yield_yak_arbitrum_sources.yml @@ -112,6 +112,14 @@ sources: loaded_at_field: evt_block_time - name: SiloStrategy_evt_Transfer loaded_at_field: evt_block_time + - name: StargateV2Strategy_evt_Deposit + loaded_at_field: evt_block_time + - name: StargateV2Strategy_evt_Withdraw + loaded_at_field: evt_block_time + - name: StargateV2Strategy_evt_Reinvest + loaded_at_field: evt_block_time + - name: StargateV2Strategy_evt_Transfer + loaded_at_field: evt_block_time - name: SushiStrategyForLP_evt_Deposit loaded_at_field: evt_block_time - name: SushiStrategyForLP_evt_Withdraw diff --git a/sources/yield_yak/avalanche_c/yield_yak_avalanche_c_sources.yml b/sources/yield_yak/avalanche_c/yield_yak_avalanche_c_sources.yml index 016348f39b0..96dd04e2865 100644 --- a/sources/yield_yak/avalanche_c/yield_yak_avalanche_c_sources.yml +++ b/sources/yield_yak/avalanche_c/yield_yak_avalanche_c_sources.yml @@ -52,6 +52,14 @@ sources: loaded_at_field: evt_block_time - name: AaveV3StrategyV1_evt_Transfer loaded_at_field: evt_block_time + - name: AbracadabraStrategyForLP_evt_Deposit + loaded_at_field: evt_block_time + - name: AbracadabraStrategyForLP_evt_Withdraw + loaded_at_field: evt_block_time + - name: AbracadabraStrategyForLP_evt_Reinvest + loaded_at_field: evt_block_time + - name: AbracadabraStrategyForLP_evt_Transfer + loaded_at_field: evt_block_time - name: AnkrAvaxPlatypusStrategy_evt_Deposit loaded_at_field: evt_block_time - name: AnkrAvaxPlatypusStrategy_evt_Withdraw @@ -68,6 +76,14 @@ sources: loaded_at_field: evt_block_time - name: AutoPoolStrategy_evt_Transfer loaded_at_field: evt_block_time + - name: AvaiStrategyForLP_evt_Deposit + loaded_at_field: evt_block_time + - name: AvaiStrategyForLP_evt_Withdraw + loaded_at_field: evt_block_time + - name: AvaiStrategyForLP_evt_Reinvest + loaded_at_field: evt_block_time + - name: AvaiStrategyForLP_evt_Transfer + loaded_at_field: evt_block_time - name: AxialStrategyForLP_evt_Deposit loaded_at_field: evt_block_time - name: AxialStrategyForLP_evt_Withdraw @@ -92,6 +108,14 @@ sources: loaded_at_field: evt_block_time - name: BalancerDirectJoinStrategy_evt_Transfer loaded_at_field: evt_block_time + - name: BambooStrategyForLP_evt_Deposit + loaded_at_field: evt_block_time + - name: BambooStrategyForLP_evt_Withdraw + loaded_at_field: evt_block_time + - name: BambooStrategyForLP_evt_Reinvest + loaded_at_field: evt_block_time + - name: BambooStrategyForLP_evt_Transfer + loaded_at_field: evt_block_time - name: BenqiStrategyAvaxV1_evt_Deposit loaded_at_field: evt_block_time - name: BenqiStrategyAvaxV1_evt_Withdraw @@ -220,6 +244,14 @@ sources: loaded_at_field: evt_block_time - name: CompoundingJoe_evt_Transfer loaded_at_field: evt_block_time + - name: CompoundingJoeV2_evt_Deposit + loaded_at_field: evt_block_time + - name: CompoundingJoeV2_evt_Withdraw + loaded_at_field: evt_block_time + - name: CompoundingJoeV2_evt_Reinvest + loaded_at_field: evt_block_time + - name: CompoundingJoeV2_evt_Transfer + loaded_at_field: evt_block_time - name: CompoundingJoeV3_evt_Deposit loaded_at_field: evt_block_time - name: CompoundingJoeV3_evt_Withdraw @@ -304,6 +336,14 @@ sources: loaded_at_field: evt_block_time - name: DexStrategySAWithSwapV2_evt_Transfer loaded_at_field: evt_block_time + - name: DexStrategyV3_evt_Deposit + loaded_at_field: evt_block_time + - name: DexStrategyV3_evt_Withdraw + loaded_at_field: evt_block_time + - name: DexStrategyV3_evt_Reinvest + loaded_at_field: evt_block_time + - name: DexStrategyV3_evt_Transfer + loaded_at_field: evt_block_time - name: DexStrategyV4_evt_Deposit loaded_at_field: evt_block_time - name: DexStrategyV4_evt_Withdraw @@ -328,6 +368,14 @@ sources: loaded_at_field: evt_block_time - name: DexStrategyV5Reflection_evt_Transfer loaded_at_field: evt_block_time + - name: DexStrategyV5ReflectionV2_evt_Deposit + loaded_at_field: evt_block_time + - name: DexStrategyV5ReflectionV2_evt_Withdraw + loaded_at_field: evt_block_time + - name: DexStrategyV5ReflectionV2_evt_Reinvest + loaded_at_field: evt_block_time + - name: DexStrategyV5ReflectionV2_evt_Transfer + loaded_at_field: evt_block_time - name: DexStrategyV6_evt_Deposit loaded_at_field: evt_block_time - name: DexStrategyV6_evt_Withdraw @@ -424,6 +472,14 @@ sources: loaded_at_field: evt_block_time - name: GondolaStrategyForLP_evt_Transfer loaded_at_field: evt_block_time + - name: GondolaStrategyForLPV2_evt_Deposit + loaded_at_field: evt_block_time + - name: GondolaStrategyForLPV2_evt_Withdraw + loaded_at_field: evt_block_time + - name: GondolaStrategyForLPV2_evt_Reinvest + loaded_at_field: evt_block_time + - name: GondolaStrategyForLPV2_evt_Transfer + loaded_at_field: evt_block_time - name: GondolaStrategyForPoolBTC_evt_Deposit loaded_at_field: evt_block_time - name: GondolaStrategyForPoolBTC_evt_Withdraw @@ -480,6 +536,22 @@ sources: loaded_at_field: evt_block_time - name: HakuStrategyForLP_evt_Transfer loaded_at_field: evt_block_time + - name: IceQueenStrategy_evt_Deposit + loaded_at_field: evt_block_time + - name: IceQueenStrategy_evt_Withdraw + loaded_at_field: evt_block_time + - name: IceQueenStrategy_evt_Reinvest + loaded_at_field: evt_block_time + - name: IceQueenStrategy_evt_Transfer + loaded_at_field: evt_block_time + - name: IceQueenStrategyV2_evt_Deposit + loaded_at_field: evt_block_time + - name: IceQueenStrategyV2_evt_Withdraw + loaded_at_field: evt_block_time + - name: IceQueenStrategyV2_evt_Reinvest + loaded_at_field: evt_block_time + - name: IceQueenStrategyV2_evt_Transfer + loaded_at_field: evt_block_time - name: JoeLendingStrategyAvaxV1_evt_Deposit loaded_at_field: evt_block_time - name: JoeLendingStrategyAvaxV1_evt_Withdraw @@ -640,6 +712,14 @@ sources: loaded_at_field: evt_block_time - name: MoreMoneyStrategy_evt_Transfer loaded_at_field: evt_block_time + - name: OliveStrategyForLPa_evt_Deposit + loaded_at_field: evt_block_time + - name: OliveStrategyForLPa_evt_Withdraw + loaded_at_field: evt_block_time + - name: OliveStrategyForLPa_evt_Reinvest + loaded_at_field: evt_block_time + - name: OliveStrategyForLPa_evt_Transfer + loaded_at_field: evt_block_time - name: OliveStrategyForLPb_evt_Deposit loaded_at_field: evt_block_time - name: OliveStrategyForLPb_evt_Withdraw @@ -648,6 +728,14 @@ sources: loaded_at_field: evt_block_time - name: OliveStrategyForLPb_evt_Transfer loaded_at_field: evt_block_time + - name: OliveStrategyForLPc_evt_Deposit + loaded_at_field: evt_block_time + - name: OliveStrategyForLPc_evt_Withdraw + loaded_at_field: evt_block_time + - name: OliveStrategyForLPc_evt_Reinvest + loaded_at_field: evt_block_time + - name: OliveStrategyForLPc_evt_Transfer + loaded_at_field: evt_block_time - name: OliveStrategyForSA_evt_Deposit loaded_at_field: evt_block_time - name: OliveStrategyForSA_evt_Withdraw @@ -704,6 +792,14 @@ sources: loaded_at_field: evt_block_time - name: SonicStrategyForSA_evt_Transfer loaded_at_field: evt_block_time + - name: StableVaultStrategyForS3D_evt_Deposit + loaded_at_field: evt_block_time + - name: StableVaultStrategyForS3D_evt_Withdraw + loaded_at_field: evt_block_time + - name: StableVaultStrategyForS3D_evt_Reinvest + loaded_at_field: evt_block_time + - name: StableVaultStrategyForS3D_evt_Transfer + loaded_at_field: evt_block_time - name: StableVaultStrategyForS3F_evt_Deposit loaded_at_field: evt_block_time - name: StableVaultStrategyForS3F_evt_Withdraw @@ -720,6 +816,14 @@ sources: loaded_at_field: evt_block_time - name: StargateStrategyForLP_evt_Transfer loaded_at_field: evt_block_time + - name: StargateV2Strategy_evt_Deposit + loaded_at_field: evt_block_time + - name: StargateV2Strategy_evt_Withdraw + loaded_at_field: evt_block_time + - name: StargateV2Strategy_evt_Reinvest + loaded_at_field: evt_block_time + - name: StargateV2Strategy_evt_Transfer + loaded_at_field: evt_block_time - name: StormStrategyForLP_evt_Deposit loaded_at_field: evt_block_time - name: StormStrategyForLP_evt_Withdraw @@ -736,6 +840,14 @@ sources: loaded_at_field: evt_block_time - name: StormStrategyForSA_evt_Transfer loaded_at_field: evt_block_time + - name: SuStrategyV2_evt_Deposit + loaded_at_field: evt_block_time + - name: SuStrategyV2_evt_Withdraw + loaded_at_field: evt_block_time + - name: SuStrategyV2_evt_Reinvest + loaded_at_field: evt_block_time + - name: SuStrategyV2_evt_Transfer + loaded_at_field: evt_block_time - name: SynapseStrategy_evt_Deposit loaded_at_field: evt_block_time - name: SynapseStrategy_evt_Withdraw From c5cd1975aa2867e7555c8d44ae5b347abfe1dc54 Mon Sep 17 00:00:00 2001 From: Rantum Date: Mon, 3 Jun 2024 08:07:52 -0700 Subject: [PATCH 004/149] 0x - update taker [base] (#6045) * initial Socialtokens view * Rename socialTokens to socialtokens.sql * Addded new tokens to list * Update socialtokens.sql * rmv social tokens file * add zeroex to dex_aggregator.trades * remove old branches * reset profiles.yml * remove * save * schema * undo trnsfesr changes * update taker to pull from data * revise taker, add is_gasless field * add is_gasless field * is_gasless fix * group --- models/zeroex/base/zeroex_base_api_fills.sql | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/models/zeroex/base/zeroex_base_api_fills.sql b/models/zeroex/base/zeroex_base_api_fills.sql index dcba40324c4..0a8fb9dc55f 100644 --- a/models/zeroex/base/zeroex_base_api_fills.sql +++ b/models/zeroex/base/zeroex_base_api_fills.sql @@ -23,7 +23,8 @@ WITH zeroex_tx AS ( SELECT tx_hash, - max(affiliate_address) as affiliate_address + max(affiliate_address) as affiliate_address, + is_gasless FROM ( SELECT tr.tx_hash, CASE @@ -33,7 +34,8 @@ WITH zeroex_tx AS ( WHEN bytearray_position(INPUT, 0xfbc019a7) <> 0 THEN SUBSTRING(INPUT FROM (bytearray_position(INPUT, 0xfbc019a7 ) + 16) FOR 20) - END AS affiliate_address + END AS affiliate_address, + case when (varbinary_position(input,0x3d8d4082) <> 0 ) then 1 else 0 end as is_gasless FROM {{ source('base', 'traces') }} tr WHERE tr.to IN ( -- exchange contract @@ -57,7 +59,7 @@ WITH zeroex_tx AS ( AND block_time >= cast('{{zeroex_v3_start_date}}' as date) {% endif %} ) temp - group by tx_hash + group by tx_hash , is_gasless ), @@ -77,7 +79,8 @@ ERC20BridgeTransfer AS ( 'ERC20BridgeTransfer' AS type, zeroex_tx.affiliate_address AS affiliate_address, TRUE AS swap_flag, - FALSE AS matcha_limit_order_flag + FALSE AS matcha_limit_order_flag, + is_gasless FROM {{ source('base', 'logs') }} logs INNER JOIN zeroex_tx ON zeroex_tx.tx_hash = logs.tx_hash WHERE topic0 = 0x349fc08071558d8e3aa92dec9396e4e9f2dfecd6bb9065759d1932e7da43b8a9 @@ -106,7 +109,8 @@ BridgeFill AS ( 'BridgeFill' AS type, zeroex_tx.affiliate_address AS affiliate_address, TRUE AS swap_flag, - FALSE AS matcha_limit_order_flag + FALSE AS matcha_limit_order_flag, + is_gasless FROM {{ source('base', 'logs') }} logs INNER JOIN zeroex_tx ON zeroex_tx.tx_hash = logs.tx_hash WHERE topic0 = 0xff3bc5e46464411f331d1b093e1587d2d1aa667f5618f98a95afc4132709d3a9 @@ -135,7 +139,8 @@ NewBridgeFill AS ( 'BridgeFill' AS type, zeroex_tx.affiliate_address AS affiliate_address, TRUE AS swap_flag, - FALSE AS matcha_limit_order_flag + FALSE AS matcha_limit_order_flag, + is_gasless FROM {{ source('base' ,'logs') }} logs INNER JOIN zeroex_tx ON zeroex_tx.tx_hash = logs.tx_hash WHERE topic0 = 0xe59e71a14fe90157eedc866c4f8c767d3943d6b6b2e8cd64dddcc92ab4c55af8 @@ -172,7 +177,8 @@ SELECT cast(date_trunc('month', all_tx.block_time) AS date) AS block_month, maker, CASE - WHEN taker = 0xdef1c0ded9bec7f1a1670819833240f027b25eff THEN tx."from" + WHEN is_gasless = 1 then case when (varbinary_substring(data,177,19) ) = 0x00000000000000000000000000000000000000 then varbinary_substring(data,81,20) else (varbinary_substring(data,177,20) ) end + WHEN taker = 0xdef1c0ded9bec7f1a1670819833240f027b25eff THEN varbinary_substring(data,177,20) ELSE taker END AS taker, -- fix the user masked by ProxyContract issue taker_token, From 3af57417862915b75d2f9357ecb87b8dc30c6801 Mon Sep 17 00:00:00 2001 From: tomfutago <35136350+tomfutago@users.noreply.github.com> Date: Mon, 3 Jun 2024 16:08:16 +0100 Subject: [PATCH 005/149] EAS schemas - bug fix (#6042) * init * use uid_column_name param --- macros/models/_sector/attestation/eas.sql | 2 +- .../eas/optimism/eas_optimism_schemas.sql | 45 ++++--------------- 2 files changed, 9 insertions(+), 38 deletions(-) diff --git a/macros/models/_sector/attestation/eas.sql b/macros/models/_sector/attestation/eas.sql index d345fa2f509..5f7a135c3bc 100644 --- a/macros/models/_sector/attestation/eas.sql +++ b/macros/models/_sector/attestation/eas.sql @@ -44,7 +44,7 @@ select er.evt_tx_hash as tx_hash, er.evt_index from src_SchemaRegistry_evt_Registered er - join src_SchemaRegistry_call_register cr on er.evt_tx_hash = cr.call_tx_hash + join src_SchemaRegistry_call_register cr on er.evt_tx_hash = cr.call_tx_hash and er.{{ uid_column_name }} = cr.output_0 where cr.call_success {% endmacro %} diff --git a/models/_sector/attestation/eas/optimism/eas_optimism_schemas.sql b/models/_sector/attestation/eas/optimism/eas_optimism_schemas.sql index 13d991947b1..ec23e7e3364 100644 --- a/models/_sector/attestation/eas/optimism/eas_optimism_schemas.sql +++ b/models/_sector/attestation/eas/optimism/eas_optimism_schemas.sql @@ -10,40 +10,11 @@ ) }} -with eas as ( - {{ - eas_schemas( - blockchain = 'optimism', - project = 'eas', - version = '1', - decoded_project_name = 'attestationstation_v1' - ) - }} -) -, dedupe as ( - select distinct - schema_uid - from - ( - select - schema_uid - , count(1) as count - from - eas - group by - schema_uid - having - count(1) > 1 - ) -) -select - * -from - eas -where - schema_uid not in ( - select - schema_uid - from - dedupe - ) \ No newline at end of file +{{ + eas_schemas( + blockchain = 'optimism', + project = 'eas', + version = '1', + decoded_project_name = 'attestationstation_v1' + ) +}} From 248c8363d297f7d75f1334bbf37f705308cd1763 Mon Sep 17 00:00:00 2001 From: viniabussafi <131974393+viniabussafi@users.noreply.github.com> Date: Mon, 3 Jun 2024 16:08:34 +0100 Subject: [PATCH 006/149] Update tokens_ethereum_erc20.sql (#6040) --- tokens/models/tokens/ethereum/tokens_ethereum_erc20.sql | 1 + 1 file changed, 1 insertion(+) diff --git a/tokens/models/tokens/ethereum/tokens_ethereum_erc20.sql b/tokens/models/tokens/ethereum/tokens_ethereum_erc20.sql index e1eab88d4dd..62ef16eec19 100644 --- a/tokens/models/tokens/ethereum/tokens_ethereum_erc20.sql +++ b/tokens/models/tokens/ethereum/tokens_ethereum_erc20.sql @@ -4560,4 +4560,5 @@ FROM (VALUES , ( 0xfc87753df5ef5c368b5fba8d4c5043b77e8c5b39, 'aETH', 18) , ( 0xf1617882a71467534d14eee865922de1395c9e89, 'saETH', 18) , ( 0x9deb0fc809955b79c85e82918e8586d3b7d2695a, 'GOLD', 18) + , ( 0x75e88b8c2d34a52a6d36deada664d7dc9116e4ef, 'ZRS', 18) ) AS temp_table (contract_address, symbol, decimals) From f231f712c4455e3a51b2e9563fe3d3ac6900da57 Mon Sep 17 00:00:00 2001 From: Olga Date: Mon, 3 Jun 2024 16:09:13 +0100 Subject: [PATCH 007/149] Adding Arbitrum Chain to CoW Protocol (#6038) * Create cow_protocol_arbitrum_trades.sql Adding cow protocol arbitrum trades * Changing gnosis to arbitrum adjusting name * Create cow_protocol_arbitrum_schema.yml Adding YML file for Arbitrum chain * Update cow_protocol_trades.sql Adding Arbitrum chain to the table * Update dbt_project.yml Adding Arbitrum schema to the projects * Create cow_protocol_arbitrum_sources.yml Adding new sources for arbitrum cow protocol * Update cow_protocol_arbitrum_sources.yml Changing gnosis to arbitrum * Update cow_protocol_arbitrum_sources.yml Fixing syntax * Update dbt_project.yml Removing unnecessary logic * Update cow_protocol_arbitrum_trades.sql Adding schema directly to cow_protocol_arbitrum_trades.sql to avoid complexity --- .../arbitrum/cow_protocol_arbitrum_schema.yml | 109 +++++++++ .../arbitrum/cow_protocol_arbitrum_trades.sql | 225 ++++++++++++++++++ models/cow_protocol/cow_protocol_trades.sql | 36 ++- .../cow_protocol_arbitrum_sources.yml | 78 ++++++ 4 files changed, 445 insertions(+), 3 deletions(-) create mode 100644 models/cow_protocol/arbitrum/cow_protocol_arbitrum_schema.yml create mode 100644 models/cow_protocol/arbitrum/cow_protocol_arbitrum_trades.sql create mode 100644 sources/cow_protocol/arbitrum/cow_protocol_arbitrum_sources.yml diff --git a/models/cow_protocol/arbitrum/cow_protocol_arbitrum_schema.yml b/models/cow_protocol/arbitrum/cow_protocol_arbitrum_schema.yml new file mode 100644 index 00000000000..68f3a0fdc48 --- /dev/null +++ b/models/cow_protocol/arbitrum/cow_protocol_arbitrum_schema.yml @@ -0,0 +1,109 @@ +version: 2 + +models: + - name: cow_protocol_arbitrum_trades + meta: + blockchain: arbitrum + project: cow_protocol + contributors: olgafetisova + config: + tags: ['arbitrum','cow_protocol','trades', 'dex', 'aggregator'] + description: > + CoW Protocol enriched trades list on Arbitrum Chain + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - tx_hash + - order_uid + - evt_index + columns: + - &block_date + name: block_date + description: "UTC event block date of each trade" + - &block_time + name: block_time + description: "Timestamp for block event time in UTC" + - &tx_hash + name: tx_hash + description: "Transaction hash of trade" + - &evt_index + name: evt_index + description: "Index of the corresponding trade event" + - &order_uid + name: order_uid + description: "Unique identifier of order involved in trade. Note that partially fillable orders can be touched multiple times so this is not a unique ID for trade events." + - &trader + name: trader + description: "Owner of the order being traded (aka trader)" + - &sell_token_address + name: sell_token_address + description: "Arbitrum address of sellToken" + - &sell_token + name: sell_token + description: "Symbol of sellToken" + - &buy_token_address + name: buy_token_address + description: "Arbitrum address of buyToken" + - &buy_token + name: buy_token + description: "Symbol of buyToken" + - &token_pair + name: token_pair + description: "Ordered concatenation of buy/sell token symbols involved in trade" + - &units_sold + name: units_sold + description: "Units of sellToken sold (incorporates token decimals)." + - &atoms_sold + name: atoms_sold + description: "Amount (in atoms) of the sellToken sold" + - &units_bought + name: units_bought + description: "Units of buyToken bought (incorporates token decimals)." + - &atoms_bought + name: atoms_bought + description: "Amount (in atoms) of the buyToken bought" + - &usd_value + name: usd_value + description: "USD value of trade (taken as the max of buy value, sell value when both available, otherwise whichever is known)" + - &buy_price + name: buy_price + description: "USD price of buyToken at the time of trade" + - &buy_value_usd + name: buy_value_usd + description: "USD value of buyToken amount" + - &sell_price + name: sell_price + description: "USD price of sellToken at the time of trade" + - &sell_value_usd + name: sell_value_usd + description: "USD value of sellToken amount" + - &fee + name: fee + description: "Unit of fee taken (in sellToken) - incorporating token decimals" + - &fee_atoms + name: fee_atoms + description: "Amount (in atoms) of fee - taken in sellToken" + - &fee_usd + name: fee_usd + description: "USD value of trade fee" + - &app_data + name: app_data + description: "Hashed metadata related to trade event (full content available on IPFS)" + - &receiver + name: receiver + description: "Recipient of trades buyToken" + - &limit_sell_amount + name: limit_sell_amount + description: "Sell amount side of the limit price" + - &limit_buy_amount + name: limit_buy_amount + description: "Buy amount side of the limit price" + - &valid_to + name: valid_to + description: "epoch timestamp (in seconds) until when the order was valid" + - &flags + name: flags + description: "bitmap with additional trade information (cf. https://github.com/cowprotocol/contracts/blob/main/src/contracts/libraries/GPv2Trade.sol#L58-L94)" + - &surplus_usd + name: surplus_usd + description: "USD value of surplus (difference between limit and executed price)" diff --git a/models/cow_protocol/arbitrum/cow_protocol_arbitrum_trades.sql b/models/cow_protocol/arbitrum/cow_protocol_arbitrum_trades.sql new file mode 100644 index 00000000000..8a9ec8d7a4f --- /dev/null +++ b/models/cow_protocol/arbitrum/cow_protocol_arbitrum_trades.sql @@ -0,0 +1,225 @@ +{{ config( + schema = 'cow_protocol_arbitrum', + alias='trades', + materialized='incremental', + partition_by = ['block_month'], + unique_key = ['tx_hash', 'order_uid', 'evt_index'], + on_schema_change='sync_all_columns', + file_format ='delta', + incremental_strategy='merge', + post_hook='{{ expose_spells(\'["arbitrum"]\', + "project", + "cow_protocol", + \'["olgafetisova"]\') }}' + ) +}} + +-- Find the PoC Query here: https://dune.com/queries/3783635 +WITH +-- First subquery joins buy and sell token prices from prices.usd. +-- Also deducts fee from sell amount. +trades_with_prices AS ( + SELECT cast(date_trunc('day', evt_block_time) as date) as block_date, + cast(date_trunc('month', evt_block_time) as date) as block_month, + evt_block_time as block_time, + evt_block_number as block_number, + evt_tx_hash as tx_hash, + evt_index, + settlement.contract_address as project_contract_address, + owner as trader, + orderUid as order_uid, + sellToken as sell_token, + buyToken as buy_token, + (sellAmount - feeAmount) as sell_amount, + buyAmount as buy_amount, + feeAmount as fee_amount, + ps.price as sell_price, + pb.price as buy_price + FROM {{ source('gnosis_protocol_v2_arbitrum', 'GPv2Settlement_evt_Trade') }} settlement + LEFT OUTER JOIN {{ source('prices', 'usd') }} as ps + ON sellToken = ps.contract_address + AND ps.minute = date_trunc('minute', evt_block_time) + AND ps.blockchain = 'arbitrum' + {% if is_incremental() %} + AND ps.minute >= date_trunc('day', now() - interval '7' day) + {% endif %} + LEFT OUTER JOIN {{ source('prices', 'usd') }} as pb + ON pb.contract_address = buyToken + AND pb.minute = date_trunc('minute', evt_block_time) + AND pb.blockchain = 'arbitrum' + {% if is_incremental() %} + AND pb.minute >= date_trunc('day', now() - interval '7' day) + {% endif %} + {% if is_incremental() %} + WHERE evt_block_time >= date_trunc('day', now() - interval '7' day) + {% endif %} +), +-- Second subquery gets token symbol and decimals from tokens.erc20 (to display units bought and sold) +trades_with_token_units as ( + SELECT block_date, + block_month, + block_time, + block_number, + tx_hash, + evt_index, + project_contract_address, + order_uid, + trader, + sell_token as sell_token_address, + (CASE + WHEN ts.symbol IS NULL THEN cast(sell_token as varchar) + ELSE ts.symbol + END) as sell_token, + buy_token as buy_token_address, + (CASE + WHEN tb.symbol IS NULL THEN cast(buy_token AS varchar) + ELSE tb.symbol + END) as buy_token, + sell_amount / pow(10, ts.decimals) as units_sold, + sell_amount as atoms_sold, + buy_amount / pow(10, tb.decimals) as units_bought, + buy_amount as atoms_bought, + -- We use sell value when possible and buy value when not + fee_amount / pow(10, ts.decimals) as fee, + fee_amount as fee_atoms, + sell_price, + buy_price + FROM trades_with_prices + LEFT OUTER JOIN {{ source('tokens', 'erc20') }} ts + ON ts.blockchain='arbitrum' AND ts.contract_address = sell_token + LEFT OUTER JOIN {{ source('tokens', 'erc20') }} tb + ON tb.blockchain='arbitrum' AND tb.contract_address = buy_token +), +sorted_orders as ( + select + evt_tx_hash, + evt_block_number, + array_agg(orderUid order by evt_index) as order_ids + from ( + select + evt_tx_hash, + evt_index, + evt_block_number, + orderUid + from {{ source('gnosis_protocol_v2_arbitrum', 'GPv2Settlement_evt_Trade') }} + {% if is_incremental() %} + where evt_block_time >= date_trunc('day', now() - interval '7' day) + {% endif %} + ) + group by evt_tx_hash, evt_block_number +), + +orders_and_trades as ( + select + evt_tx_hash, + trades, + order_ids + from sorted_orders + inner join {{ source('gnosis_protocol_v2_arbitrum', 'GPv2Settlement_call_settle') }} + on evt_block_number = call_block_number + and evt_tx_hash = call_tx_hash +), + +uid_to_app_id as ( + SELECT + distinct uid, + evt_tx_hash as hash, + from_hex(JSON_EXTRACT_SCALAR(trade, '$.appData')) AS app_data, + from_hex(JSON_EXTRACT_SCALAR(trade, '$.receiver')) AS receiver, + cast(JSON_EXTRACT_SCALAR(trade, '$.sellAmount') as uint256) AS limit_sell_amount, + cast(JSON_EXTRACT_SCALAR(trade, '$.buyAmount') as uint256) AS limit_buy_amount, + date_format( + from_unixtime(cast(JSON_EXTRACT_SCALAR(trade, '$.validTo') as double)), + '%Y-%m-%d %T' + ) AS valid_to, + cast(JSON_EXTRACT_SCALAR(trade, '$.flags') as integer) AS flags + FROM + orders_and_trades + CROSS JOIN UNNEST (order_ids) + WITH + ORDINALITY AS o (uid, i) + CROSS JOIN UNNEST (trades) + WITH + ORDINALITY AS t (trade, j) + WHERE + i = j +), + +valued_trades as ( + SELECT block_date, + block_month, + block_time, + block_number, + tx_hash, + evt_index, + ARRAY[-1] as trace_address, + project_contract_address, + trades.order_uid, + trader, + sell_token_address, + sell_token, + buy_token_address, + buy_token, + case + when lower(buy_token) > lower(sell_token) then concat(sell_token, '-', buy_token) + else concat(buy_token, '-', sell_token) + end as token_pair, + units_sold, + atoms_sold, + units_bought, + atoms_bought, + (CASE + WHEN sell_price IS NOT NULL THEN + -- Choose the larger of two prices when both not null. + CASE + WHEN buy_price IS NOT NULL and buy_price * units_bought > sell_price * units_sold + then buy_price * units_bought + ELSE sell_price * units_sold + END + WHEN sell_price IS NULL AND buy_price IS NOT NULL THEN buy_price * units_bought + END) as usd_value, + buy_price, + buy_price * units_bought as buy_value_usd, + sell_price, + sell_price * units_sold as sell_value_usd, + fee, + fee_atoms, + (CASE + WHEN sell_price IS NOT NULL THEN + CASE + WHEN buy_price IS NOT NULL and buy_price * units_bought > sell_price * units_sold + then buy_price * units_bought * fee / units_sold + ELSE sell_price * fee + END + WHEN sell_price IS NULL AND buy_price IS NOT NULL + THEN buy_price * units_bought * fee / units_sold + END) as fee_usd, + app_data, + case + when receiver = 0x0000000000000000000000000000000000000000 + then trader + else receiver + end as receiver, + limit_sell_amount, + limit_buy_amount, + valid_to, + flags, + case when (flags % 2) = 0 then 'SELL' else 'BUY' end as order_type, + bitwise_and(flags, 2) != 0 as partial_fill, + (CASE + when (flags % 2) = 0 then atoms_sold / limit_sell_amount + else atoms_bought / limit_buy_amount + end + ) as fill_proportion + FROM trades_with_token_units trades + JOIN uid_to_app_id + ON uid = trades.order_uid + AND hash=tx_hash +) + +select + *, + -- Relative surplus (in %) is the difference between limit price and executed price as a ratio of the limit price. + -- Absolute surplus (in USD) is relative surplus multiplied with the value of the trade + usd_value * (atoms_bought * limit_sell_amount - atoms_sold * limit_buy_amount) / (atoms_bought * limit_sell_amount) as surplus_usd +from valued_trades diff --git a/models/cow_protocol/cow_protocol_trades.sql b/models/cow_protocol/cow_protocol_trades.sql index a682df2dfb2..6f2a84d55e8 100644 --- a/models/cow_protocol/cow_protocol_trades.sql +++ b/models/cow_protocol/cow_protocol_trades.sql @@ -1,10 +1,10 @@ {{ config( alias='trades', - post_hook='{{ expose_spells(\'["ethereum", "gnosis"]\', + post_hook='{{ expose_spells(\'["ethereum", "gnosis", "arbitrum"]\', "project", "cow_protocol", - \'["bh2smith", "gentrexha"]\') }}' + \'["bh2smith", "gentrexha", "olgafetisova"]\') }}' ) }} SELECT * @@ -66,4 +66,34 @@ FROM trace_address, evt_index FROM {{ ref('cow_protocol_gnosis_trades') }} -) \ No newline at end of file + + UNION ALL + + + SELECT + 'arbitrum' AS blockchain, + 'cow_protocol' AS project, + '1' AS version, + block_date, + block_month, + block_time, + buy_token AS token_bought_symbol, + sell_token AS token_sold_symbol, + token_pair, + units_bought AS token_bought_amount, + units_sold AS token_sold_amount, + atoms_bought AS token_bought_amount_raw, + atoms_sold AS token_sold_amount_raw, + usd_value AS amount_usd, + buy_token_address AS token_bought_address, + sell_token_address AS token_sold_address, + trader AS taker, + CAST(NULL AS VARBINARY) AS maker, + project_contract_address, + tx_hash, + trader AS tx_from, + receiver AS tx_to, + trace_address, + evt_index + FROM {{ ref('cow_protocol_arbitrum_trades') }} +) diff --git a/sources/cow_protocol/arbitrum/cow_protocol_arbitrum_sources.yml b/sources/cow_protocol/arbitrum/cow_protocol_arbitrum_sources.yml new file mode 100644 index 00000000000..421803f0864 --- /dev/null +++ b/sources/cow_protocol/arbitrum/cow_protocol_arbitrum_sources.yml @@ -0,0 +1,78 @@ +version: 2 + +sources: + - name: gnosis_protocol_v2_arbitrum + description: "Arbitrum Chain decoded tables related to CoW Protocol contract" + tables: + - name: GPv2Settlement_evt_Trade + description: "Trade events emitted by GPv2Settlement" + columns: + - &feeAmount + name: feeAmount + description: "Amount (in sell token) in atoms of the trade fee" + - &buyAmount + name: buyAmount + description: "Amount (in atoms) of the buyToken bought" + - &buyToken + name: buyToken + description: "Contract address of token obtained in trade" + - &contract_address + name: contract_address + description: "Ethereum address of contract emitting the event" + - &evt_block_number + name: evt_block_number + description: "Block number which processed the unique transaction hash" + - &evt_block_time + name: evt_block_time + description: "Timestamp for block event time in UTC" + - &evt_index + name: evt_index + description: "Index of the event within transaction" + - &evt_tx_hash + name: evt_tx_hash + description: "Primary key of the transaction" + tests: + - not_null + - &orderUid + name: orderUid + description: "Unique identifier of order involved in trade. Note that partially fillable orders can be touched multiple times so this is not a unique ID for trade events." + - &owner + name: owner + description: "Owner of the order being traded (aka trader address)" + - &sellAmount + name: sellAmount + description: "Amount in atoms of the sellToken sold" + - &sellToken + name: sellToken + description: "Contract address of token sold in trade." + - name: GPv2Settlement_call_settle + description: "Contains all calls to the settle method of GPv2Settlement (both successful and failed)" + columns: + - &call_block_number + name: call_block_number + description: "Block number on which the method was called" + - &call_block_time + name: call_block_time + description: "UTC timestamp at which the method was called" + - &call_success + name: call_success + description: "Whether or not the call resulted in a successful transaction" + - &call_trace_address + name: call_trace_address + description: "Trace address of the call" + - &call_tx_hash + name: call_tx_hash + description: "Transaction hash of call (if successful, will result in a real transaction hash)." + - &clearingPrices + name: clearingPrices + description: "An array of relative token prices (matched with `tokens` by index)" + - *contract_address + - &interactions + name: interactions + description: "An array of internal contract interactions" + - &tokens + name: tokens + description: "An array of token addresses (to be matched by index on `clearingPrices`)" + - &trades + name: trades + description: "An array of order data for the trades being executed" From 1dbea28c41b53b8872748ade376c8d5048c971e8 Mon Sep 17 00:00:00 2001 From: viniabussafi <131974393+viniabussafi@users.noreply.github.com> Date: Mon, 3 Jun 2024 16:09:35 +0100 Subject: [PATCH 008/149] add ECLPs on base to balancer pool labels (#6028) * add ECLP on base to labels * small change --------- Co-authored-by: jeff-dude <102681548+jeff-dude@users.noreply.github.com> --- .../labels_balancer_v2_pools_base.sql | 16 ++++++++++- .../labels_balancer_v2_sources.yml | 28 +++++++++++++++++++ 2 files changed, 43 insertions(+), 1 deletion(-) diff --git a/models/labels/addresses/__single_category_labels__/balancer_v2/labels_balancer_v2_pools_base.sql b/models/labels/addresses/__single_category_labels__/balancer_v2/labels_balancer_v2_pools_base.sql index 83b26be59f1..7eba615f28e 100644 --- a/models/labels/addresses/__single_category_labels__/balancer_v2/labels_balancer_v2_pools_base.sql +++ b/models/labels/addresses/__single_category_labels__/balancer_v2/labels_balancer_v2_pools_base.sql @@ -100,6 +100,20 @@ WITH pools AS ( CROSS JOIN UNNEST( CAST(json_extract(settingsParams, '$.tokens') AS ARRAY(VARCHAR)) ) AS t (tokens) + + UNION ALL + + SELECT + c.poolId AS pool_id, + t.tokens AS token_address, + 0 AS normalized_weight, + cc.symbol, + 'ECLP' AS pool_type + FROM {{ source('balancer_v2_base', 'Vault_evt_PoolRegistered') }} c + INNER JOIN {{ source('gyroscope_base', 'GyroECLPPoolFactory_call_create') }} cc + ON c.evt_tx_hash = cc.call_tx_hash + AND bytearray_substring(c.poolId, 1, 20) = cc.output_0 + CROSS JOIN UNNEST(cc.tokens) AS t(tokens) ), settings AS ( @@ -116,7 +130,7 @@ settings AS ( SELECT 'base' AS blockchain, bytearray_substring(pool_id, 1, 20) AS address, - CASE WHEN pool_type IN ('stable', 'linear', 'LBP', 'managed') + CASE WHEN pool_type IN ('stable', 'linear', 'LBP', 'managed', 'ECLP') THEN lower(pool_symbol) ELSE lower(concat(array_join(array_agg(token_symbol ORDER BY token_symbol), '/'), ' ', array_join(array_agg(cast(norm_weight AS varchar) ORDER BY token_symbol), '/'))) diff --git a/sources/labels/addresses/__single_category_labels__/balancer_v2/labels_balancer_v2_sources.yml b/sources/labels/addresses/__single_category_labels__/balancer_v2/labels_balancer_v2_sources.yml index ec70a496227..700ce3cb4af 100644 --- a/sources/labels/addresses/__single_category_labels__/balancer_v2/labels_balancer_v2_sources.yml +++ b/sources/labels/addresses/__single_category_labels__/balancer_v2/labels_balancer_v2_sources.yml @@ -1873,6 +1873,34 @@ sources: - *tokens - name: gyroscope_gnosis + tables: + - name: GyroECLPPoolFactory_call_create + description: > + Decoded table of registered pools on the Gyroscope ECLP contract. + loaded_at_field: call_block_time + columns: + - *call_block_number + - *call_block_time + - *call_success + - *call_trace_address + - *call_tx_hash + - name: capManager + - name: capParams + - name: contract_address + description: "Address of the ComposableStablePoolFactory contract" + - name: derivedECLPParams + - name: eclpParams + - name: name + - *output_0 + - *owner + - name: pauseManager + - name: pauseParams + - *swapFeePercentage + - *rateProviders + - *symbol + - *tokens + + - name: gyroscope_base tables: - name: GyroECLPPoolFactory_call_create description: > From 104eb1cb203fd72d5cc82eea21bad7ce18fa72a1 Mon Sep 17 00:00:00 2001 From: Huang Geyang Date: Mon, 3 Jun 2024 23:10:09 +0800 Subject: [PATCH 009/149] Add prod_exclude tags to uniswap_*_trades (#6013) Co-authored-by: jeff-dude <102681548+jeff-dude@users.noreply.github.com> --- models/uniswap/arbitrum/uniswap_arbitrum_trades.sql | 1 + models/uniswap/arbitrum/uniswap_v3_arbitrum_trades.sql | 1 + models/uniswap/avalanche_c/uniswap_avalanche_c_trades.sql | 5 +++-- models/uniswap/avalanche_c/uniswap_v3_avalanche_c_trades.sql | 1 + models/uniswap/base/uniswap_base_trades.sql | 1 + models/uniswap/base/uniswap_v3_base_trades.sql | 1 + models/uniswap/bnb/uniswap_bnb_trades.sql | 1 + models/uniswap/bnb/uniswap_v3_bnb_trades.sql | 1 + models/uniswap/celo/uniswap_celo_trades.sql | 1 + models/uniswap/celo/uniswap_v3_celo_trades.sql | 1 + models/uniswap/ethereum/uniswap_ethereum_trades.sql | 1 + models/uniswap/ethereum/uniswap_v1_ethereum_trades.sql | 1 + models/uniswap/ethereum/uniswap_v2_ethereum_trades.sql | 1 + models/uniswap/ethereum/uniswap_v3_ethereum_trades.sql | 1 + models/uniswap/optimism/uniswap_optimism_trades.sql | 1 + models/uniswap/optimism/uniswap_v3_optimism_trades.sql | 1 + models/uniswap/polygon/uniswap_polygon_trades.sql | 1 + models/uniswap/polygon/uniswap_v3_polygon_trades.sql | 1 + 18 files changed, 20 insertions(+), 2 deletions(-) diff --git a/models/uniswap/arbitrum/uniswap_arbitrum_trades.sql b/models/uniswap/arbitrum/uniswap_arbitrum_trades.sql index dcf01223e55..adfa8e14cac 100644 --- a/models/uniswap/arbitrum/uniswap_arbitrum_trades.sql +++ b/models/uniswap/arbitrum/uniswap_arbitrum_trades.sql @@ -1,5 +1,6 @@ {{ config( alias = 'trades' + , tags = ['prod_exclude'] ) }} diff --git a/models/uniswap/arbitrum/uniswap_v3_arbitrum_trades.sql b/models/uniswap/arbitrum/uniswap_v3_arbitrum_trades.sql index 100c110c8ca..48e18251c6f 100644 --- a/models/uniswap/arbitrum/uniswap_v3_arbitrum_trades.sql +++ b/models/uniswap/arbitrum/uniswap_v3_arbitrum_trades.sql @@ -1,6 +1,7 @@ {{ config( schema = 'uniswap_v3_arbitrum', alias = 'trades', + tags = ['prod_exclude'], partition_by = ['block_month'], materialized = 'incremental', file_format = 'delta', diff --git a/models/uniswap/avalanche_c/uniswap_avalanche_c_trades.sql b/models/uniswap/avalanche_c/uniswap_avalanche_c_trades.sql index 89f7fec1b08..767f36bef15 100644 --- a/models/uniswap/avalanche_c/uniswap_avalanche_c_trades.sql +++ b/models/uniswap/avalanche_c/uniswap_avalanche_c_trades.sql @@ -1,6 +1,7 @@ {{ config( - schema = 'uniswap_avalanche_c', - alias = 'trades' + schema = 'uniswap_avalanche_c' + , alias = 'trades' + , tags = ['prod_exclude'] ) }} diff --git a/models/uniswap/avalanche_c/uniswap_v3_avalanche_c_trades.sql b/models/uniswap/avalanche_c/uniswap_v3_avalanche_c_trades.sql index 25a9182efc5..d3b189d99f3 100644 --- a/models/uniswap/avalanche_c/uniswap_v3_avalanche_c_trades.sql +++ b/models/uniswap/avalanche_c/uniswap_v3_avalanche_c_trades.sql @@ -1,6 +1,7 @@ {{ config( schema = 'uniswap_v3_avalanche_c', alias = 'trades', + tags = ['prod_exclude'], partition_by = ['block_month'], materialized = 'incremental', file_format = 'delta', diff --git a/models/uniswap/base/uniswap_base_trades.sql b/models/uniswap/base/uniswap_base_trades.sql index 441b3da12ff..6390c817a7f 100644 --- a/models/uniswap/base/uniswap_base_trades.sql +++ b/models/uniswap/base/uniswap_base_trades.sql @@ -1,5 +1,6 @@ {{ config( alias = 'trades' + , tags = ['prod_exclude'] ) }} diff --git a/models/uniswap/base/uniswap_v3_base_trades.sql b/models/uniswap/base/uniswap_v3_base_trades.sql index 2aa03db0d04..e9f96ec9f4b 100644 --- a/models/uniswap/base/uniswap_v3_base_trades.sql +++ b/models/uniswap/base/uniswap_v3_base_trades.sql @@ -1,6 +1,7 @@ {{ config( schema = 'uniswap_v3_base', alias = 'trades', + tags = ['prod_exclude'], partition_by = ['block_month'], materialized = 'incremental', file_format = 'delta', diff --git a/models/uniswap/bnb/uniswap_bnb_trades.sql b/models/uniswap/bnb/uniswap_bnb_trades.sql index e4fffe497ad..fd14d526849 100644 --- a/models/uniswap/bnb/uniswap_bnb_trades.sql +++ b/models/uniswap/bnb/uniswap_bnb_trades.sql @@ -1,5 +1,6 @@ {{ config( alias = 'trades' + , tags = ['prod_exclude'] ) }} diff --git a/models/uniswap/bnb/uniswap_v3_bnb_trades.sql b/models/uniswap/bnb/uniswap_v3_bnb_trades.sql index a0c0a349f5e..8c582789d1b 100644 --- a/models/uniswap/bnb/uniswap_v3_bnb_trades.sql +++ b/models/uniswap/bnb/uniswap_v3_bnb_trades.sql @@ -1,6 +1,7 @@ {{ config( schema = 'uniswap_v3_bnb', alias = 'trades', + tags = ['prod_exclude'], partition_by = ['block_month'], materialized = 'incremental', file_format = 'delta', diff --git a/models/uniswap/celo/uniswap_celo_trades.sql b/models/uniswap/celo/uniswap_celo_trades.sql index 3c194b2d692..d0421add4b7 100644 --- a/models/uniswap/celo/uniswap_celo_trades.sql +++ b/models/uniswap/celo/uniswap_celo_trades.sql @@ -1,5 +1,6 @@ {{ config( alias = 'trades' + , tags = ['prod_exclude'] ) }} diff --git a/models/uniswap/celo/uniswap_v3_celo_trades.sql b/models/uniswap/celo/uniswap_v3_celo_trades.sql index 37cbd344fd6..ec605b2f080 100644 --- a/models/uniswap/celo/uniswap_v3_celo_trades.sql +++ b/models/uniswap/celo/uniswap_v3_celo_trades.sql @@ -1,6 +1,7 @@ {{ config( schema = 'uniswap_v3_celo', alias = 'trades', + tags = ['prod_exclude'], partition_by = ['block_month'], materialized = 'incremental', file_format = 'delta', diff --git a/models/uniswap/ethereum/uniswap_ethereum_trades.sql b/models/uniswap/ethereum/uniswap_ethereum_trades.sql index 64b1db26471..956d767aedc 100644 --- a/models/uniswap/ethereum/uniswap_ethereum_trades.sql +++ b/models/uniswap/ethereum/uniswap_ethereum_trades.sql @@ -1,5 +1,6 @@ {{ config( alias = 'trades' + , tags = ['prod_exclude'] ) }} diff --git a/models/uniswap/ethereum/uniswap_v1_ethereum_trades.sql b/models/uniswap/ethereum/uniswap_v1_ethereum_trades.sql index 11deb75d393..fa79ab08f68 100644 --- a/models/uniswap/ethereum/uniswap_v1_ethereum_trades.sql +++ b/models/uniswap/ethereum/uniswap_v1_ethereum_trades.sql @@ -1,6 +1,7 @@ {{ config( schema = 'uniswap_v1_ethereum', alias = 'trades', + tags = ['prod_exclude'], partition_by = ['block_month'], materialized = 'incremental', file_format = 'delta', diff --git a/models/uniswap/ethereum/uniswap_v2_ethereum_trades.sql b/models/uniswap/ethereum/uniswap_v2_ethereum_trades.sql index 1db4c57a537..0185107c796 100644 --- a/models/uniswap/ethereum/uniswap_v2_ethereum_trades.sql +++ b/models/uniswap/ethereum/uniswap_v2_ethereum_trades.sql @@ -1,6 +1,7 @@ {{ config( schema = 'uniswap_v2_ethereum', alias = 'trades', + tags = ['prod_exclude'], partition_by = ['block_month'], materialized = 'incremental', file_format = 'delta', diff --git a/models/uniswap/ethereum/uniswap_v3_ethereum_trades.sql b/models/uniswap/ethereum/uniswap_v3_ethereum_trades.sql index 3b60d237fce..d8ebe425c2e 100644 --- a/models/uniswap/ethereum/uniswap_v3_ethereum_trades.sql +++ b/models/uniswap/ethereum/uniswap_v3_ethereum_trades.sql @@ -1,6 +1,7 @@ {{ config( schema = 'uniswap_v3_ethereum', alias = 'trades', + tags = ['prod_exclude'], partition_by = ['block_month'], materialized = 'incremental', file_format = 'delta', diff --git a/models/uniswap/optimism/uniswap_optimism_trades.sql b/models/uniswap/optimism/uniswap_optimism_trades.sql index bfecc85d8cf..5672d94c4b3 100644 --- a/models/uniswap/optimism/uniswap_optimism_trades.sql +++ b/models/uniswap/optimism/uniswap_optimism_trades.sql @@ -1,5 +1,6 @@ {{ config( alias = 'trades' + , tags = ['prod_exclude'] ) }} diff --git a/models/uniswap/optimism/uniswap_v3_optimism_trades.sql b/models/uniswap/optimism/uniswap_v3_optimism_trades.sql index 89b0e50c4e5..ef530f792c7 100644 --- a/models/uniswap/optimism/uniswap_v3_optimism_trades.sql +++ b/models/uniswap/optimism/uniswap_v3_optimism_trades.sql @@ -1,6 +1,7 @@ {{ config( schema = 'uniswap_v3_optimism', alias = 'trades', + tags = ['prod_exclude'], partition_by = ['block_month'], materialized = 'incremental', file_format = 'delta', diff --git a/models/uniswap/polygon/uniswap_polygon_trades.sql b/models/uniswap/polygon/uniswap_polygon_trades.sql index 3fa29e9a91e..c8aae59f359 100644 --- a/models/uniswap/polygon/uniswap_polygon_trades.sql +++ b/models/uniswap/polygon/uniswap_polygon_trades.sql @@ -1,5 +1,6 @@ {{ config( alias = 'trades' + , tags = ['prod_exclude'] ) }} diff --git a/models/uniswap/polygon/uniswap_v3_polygon_trades.sql b/models/uniswap/polygon/uniswap_v3_polygon_trades.sql index 00bb564e741..deb55266b4f 100644 --- a/models/uniswap/polygon/uniswap_v3_polygon_trades.sql +++ b/models/uniswap/polygon/uniswap_v3_polygon_trades.sql @@ -1,6 +1,7 @@ {{ config( schema = 'uniswap_v3_polygon', alias = 'trades', + tags = ['prod_exclude'], partition_by = ['block_month'], materialized = 'incremental', file_format = 'delta', From c21568379f6244973dcd0ffda106d1c4937241ee Mon Sep 17 00:00:00 2001 From: Kofi Date: Mon, 3 Jun 2024 17:10:25 +0200 Subject: [PATCH 010/149] Add Nuri Scroll to dex.trades (#5983) * add nuri scroll to dex.trades * fix error * fix error * remove nuri from scroll base * add seed * add seed * add seed * commit * commit * commit * add to dex info --------- Co-authored-by: Huang Geyang Co-authored-by: jeff-dude <102681548+jeff-dude@users.noreply.github.com> --- models/_sector/dex/trades/scroll/_schema.yml | 17 +++++++++++++++ .../trades/scroll/dex_scroll_base_trades.sql | 1 + .../platforms/nuri_scroll_base_trades.sql | 21 +++++++++++++++++++ models/dex/dex_info.sql | 1 + seeds/_sector/dex/_schema.yml | 15 +++++++++++++ .../dex/nuri_scroll_base_trades_seed.csv | 6 ++++++ .../_sector/dex/trades/scroll/_sources.yml | 4 ++++ 7 files changed, 65 insertions(+) create mode 100644 models/_sector/dex/trades/scroll/platforms/nuri_scroll_base_trades.sql create mode 100644 seeds/_sector/dex/nuri_scroll_base_trades_seed.csv diff --git a/models/_sector/dex/trades/scroll/_schema.yml b/models/_sector/dex/trades/scroll/_schema.yml index eed6843adcb..171f0f923e3 100644 --- a/models/_sector/dex/trades/scroll/_schema.yml +++ b/models/_sector/dex/trades/scroll/_schema.yml @@ -89,3 +89,20 @@ models: - evt_index - check_dex_base_trades_seed: seed_file: ref('syncswap_scroll_base_trades_seed') + + - name: nuri_scroll_base_trades + meta: + blockchain: scroll + sector: dex + project: nuri + contributors: niftytable + config: + tags: [ 'scroll', 'dex', 'trades', 'nuri' ] + description: "Nuri scroll base trades" + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - tx_hash + - evt_index + - check_dex_base_trades_seed: + seed_file: ref('nuri_scroll_base_trades_seed') \ No newline at end of file diff --git a/models/_sector/dex/trades/scroll/dex_scroll_base_trades.sql b/models/_sector/dex/trades/scroll/dex_scroll_base_trades.sql index f896e26350d..6b303cf1ca7 100644 --- a/models/_sector/dex/trades/scroll/dex_scroll_base_trades.sql +++ b/models/_sector/dex/trades/scroll/dex_scroll_base_trades.sql @@ -11,6 +11,7 @@ , ref('zebra_scroll_base_trades') , ref('scrollswap_scroll_base_trades') , ref('syncswap_v1_scroll_base_trades') + , ref('nuri_scroll_base_trades') ] %} WITH base_union AS ( diff --git a/models/_sector/dex/trades/scroll/platforms/nuri_scroll_base_trades.sql b/models/_sector/dex/trades/scroll/platforms/nuri_scroll_base_trades.sql new file mode 100644 index 00000000000..01acb424ef3 --- /dev/null +++ b/models/_sector/dex/trades/scroll/platforms/nuri_scroll_base_trades.sql @@ -0,0 +1,21 @@ +{{ + config( + schema = 'nuri_scroll', + alias = 'base_trades', + materialized = 'incremental', + file_format = 'delta', + incremental_strategy = 'merge', + unique_key = ['tx_hash', 'evt_index'], + incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.block_time')] + ) +}} + +{{ + uniswap_compatible_v3_trades( + blockchain = 'scroll', + project = 'nuri', + version = '1', + Pair_evt_Swap = source('nuri_scroll', 'ClPool_evt_Swap'), + Factory_evt_PoolCreated = source('nuri_scroll', 'ClPoolFactory_evt_PoolCreated') + ) +}} \ No newline at end of file diff --git a/models/dex/dex_info.sql b/models/dex/dex_info.sql index 356a6bc6d15..856046b6aac 100644 --- a/models/dex/dex_info.sql +++ b/models/dex/dex_info.sql @@ -158,4 +158,5 @@ FROM (VALUES , ('echodex', 'EchoDex', 'Direct', 'EchoDex') , ('lynex', 'Lynex', 'Direct', 'Lynex') , ('nile', 'Nile', 'Direct', 'Nile') + , ('nuri', 'Nuri', 'Direct', 'nuriexchange') ) AS temp_table (project, name, marketplace_type, x_username) diff --git a/seeds/_sector/dex/_schema.yml b/seeds/_sector/dex/_schema.yml index 32ea7c86760..2c6c8156c2e 100644 --- a/seeds/_sector/dex/_schema.yml +++ b/seeds/_sector/dex/_schema.yml @@ -2851,6 +2851,21 @@ seeds: token_bought_amount_raw: uint256 token_sold_amount_raw: uint256 block_date: timestamp + + - name: nuri_scroll_base_trades_seed + config: + column_types: + blockchain: varchar + project: varchar + version: varchar + tx_hash: varbinary + evt_index: uint256 + block_number: uint256 + token_bought_address: varbinary + token_sold_address: varbinary + token_bought_amount_raw: uint256 + token_sold_amount_raw: uint256 + block_date: timestamp - name: auragi_arbitrum_base_trades_seed config: diff --git a/seeds/_sector/dex/nuri_scroll_base_trades_seed.csv b/seeds/_sector/dex/nuri_scroll_base_trades_seed.csv new file mode 100644 index 00000000000..235ef7922ac --- /dev/null +++ b/seeds/_sector/dex/nuri_scroll_base_trades_seed.csv @@ -0,0 +1,6 @@ +blockchain,project,version,block_month,block_date,block_time,block_number,token_bought_amount_raw,token_sold_amount_raw,token_bought_address,token_sold_address,taker,maker,project_contract_address,tx_hash,evt_index +scroll,nuri,1,2024-05-01,2024-05-26,2024-05-26 15:31:20.000 UTC,6011693,842698557,842636162,0xf55bec9cafdbe8730f096aa55dad6d22d44099df,0x06efdbff2a14a7c8e15944d1f4a48f9f95f663a4,0xf40442e1cb0bdfb496e8b7405d0c1c48a81bc897,,0x4637d496c7c56e670608bd40e0d1f257518ac420,0xbd3b6e4f9537f4480a1aa3a463c494b74f6856fbf7b941742d85dccfcefc7c85,4 +scroll,nuri,1,2024-05-01,2024-05-26,2024-05-26 16:02:08.000 UTC,6012309,37895,6808495837785072,0x3c1bca5a656e69edcd0d4e36bebb3fcdaca60cf1,0x5300000000000000000000000000000000000004,0xf40442e1cb0bdfb496e8b7405d0c1c48a81bc897,,0xc75319c4d0f69380249384c4cf7ad96b69dfc344,0x6e1a2a01e2c651ec2a89ecb62ef5dd308a34fe70424efd641e0b060c7703f492,33 +scroll,nuri,1,2024-05-01,2024-05-25,2024-05-25 23:02:41.000 UTC,5991920,308572808,82400000000000000,0xf55bec9cafdbe8730f096aa55dad6d22d44099df,0x5300000000000000000000000000000000000004,0xf40442e1cb0bdfb496e8b7405d0c1c48a81bc897,,0x6e13a2ae9fd9f40f8cc7d3b3944c57f3919c7fe3,0x05c7b80a0f73c80c768138408983a19f93af2606bf73f28a9c458716d198f880,26 +scroll,nuri,1,2024-05-01,2024-05-25,2024-05-25 08:14:19.000 UTC,5974159,367456772832261245363,367731006,0xca77eb3fefe3725dc33bccb54edefc3d9f764f97,0x06efdbff2a14a7c8e15944d1f4a48f9f95f663a4,0xf40442e1cb0bdfb496e8b7405d0c1c48a81bc897,,0xccdf79ced5fd02af299d3548b4e35ed6163064bf,0x681b9baa9ea68120169bdb38b07a20f944acd67d56016aafea1b2412a3155427,25 +scroll,nuri,1,2024-05-01,2024-05-25,2024-05-25 12:34:35.000 UTC,5979363,990774801,990730590,0xf55bec9cafdbe8730f096aa55dad6d22d44099df,0x06efdbff2a14a7c8e15944d1f4a48f9f95f663a4,0xf40442e1cb0bdfb496e8b7405d0c1c48a81bc897,,0x4637d496c7c56e670608bd40e0d1f257518ac420,0x726543924170573c87a03aa4b1bcd08a36aab88d1284ad7c66038e231bacd566,19 diff --git a/sources/_sector/dex/trades/scroll/_sources.yml b/sources/_sector/dex/trades/scroll/_sources.yml index 1c74222ce54..dce53b7b0ff 100644 --- a/sources/_sector/dex/trades/scroll/_sources.yml +++ b/sources/_sector/dex/trades/scroll/_sources.yml @@ -23,3 +23,7 @@ sources: - name: SyncSwapClassicPool_evt_Swap - name: SyncSwapStablePoolFactory_evt_PoolCreated - name: SyncSwapStablePool_evt_Swap + - name: nuri_scroll + tables: + - name: ClPoolFactory_evt_PoolCreated + - name: ClPool_evt_Swap From f230791d9591881c94c1d169a3b4ed96ef828aac Mon Sep 17 00:00:00 2001 From: hildobby Date: Mon, 3 Jun 2024 17:10:54 +0200 Subject: [PATCH 011/149] create `gas.prices` (#5981) * create gas.prices * fix * add goerli * fix * fix * fix * fix * fix * fix * fix * fix --------- Co-authored-by: Huang Geyang Co-authored-by: jeff-dude <102681548+jeff-dude@users.noreply.github.com> --- macros/models/_sector/gas/gas_prices.sql | 17 + models/_sector/gas/prices/_schema.yml | 42 ++ models/_sector/gas/prices/chains/_schema.yml | 402 ++++++++++++++++++ .../gas/prices/chains/gas_arbitrum_prices.sql | 17 + .../prices/chains/gas_avalanche_c_prices.sql | 17 + .../gas/prices/chains/gas_base_prices.sql | 17 + .../gas/prices/chains/gas_bnb_prices.sql | 17 + .../gas/prices/chains/gas_celo_prices.sql | 17 + .../gas/prices/chains/gas_ethereum_prices.sql | 17 + .../gas/prices/chains/gas_fantom_prices.sql | 17 + .../gas/prices/chains/gas_gnosis_prices.sql | 17 + .../gas/prices/chains/gas_goerli_prices.sql | 17 + .../gas/prices/chains/gas_linea_prices.sql | 17 + .../gas/prices/chains/gas_optimism_prices.sql | 17 + .../gas/prices/chains/gas_polygon_prices.sql | 17 + .../gas/prices/chains/gas_scroll_prices.sql | 17 + .../gas/prices/chains/gas_zkevm_prices.sql | 17 + .../gas/prices/chains/gas_zksync_prices.sql | 17 + .../gas/prices/chains/gas_zora_prices.sql | 17 + models/_sector/gas/prices/gas_prices.sql | 54 +++ 20 files changed, 787 insertions(+) create mode 100644 macros/models/_sector/gas/gas_prices.sql create mode 100644 models/_sector/gas/prices/_schema.yml create mode 100644 models/_sector/gas/prices/chains/_schema.yml create mode 100644 models/_sector/gas/prices/chains/gas_arbitrum_prices.sql create mode 100644 models/_sector/gas/prices/chains/gas_avalanche_c_prices.sql create mode 100644 models/_sector/gas/prices/chains/gas_base_prices.sql create mode 100644 models/_sector/gas/prices/chains/gas_bnb_prices.sql create mode 100644 models/_sector/gas/prices/chains/gas_celo_prices.sql create mode 100644 models/_sector/gas/prices/chains/gas_ethereum_prices.sql create mode 100644 models/_sector/gas/prices/chains/gas_fantom_prices.sql create mode 100644 models/_sector/gas/prices/chains/gas_gnosis_prices.sql create mode 100644 models/_sector/gas/prices/chains/gas_goerli_prices.sql create mode 100644 models/_sector/gas/prices/chains/gas_linea_prices.sql create mode 100644 models/_sector/gas/prices/chains/gas_optimism_prices.sql create mode 100644 models/_sector/gas/prices/chains/gas_polygon_prices.sql create mode 100644 models/_sector/gas/prices/chains/gas_scroll_prices.sql create mode 100644 models/_sector/gas/prices/chains/gas_zkevm_prices.sql create mode 100644 models/_sector/gas/prices/chains/gas_zksync_prices.sql create mode 100644 models/_sector/gas/prices/chains/gas_zora_prices.sql create mode 100644 models/_sector/gas/prices/gas_prices.sql diff --git a/macros/models/_sector/gas/gas_prices.sql b/macros/models/_sector/gas/gas_prices.sql new file mode 100644 index 00000000000..d1ecb74e285 --- /dev/null +++ b/macros/models/_sector/gas/gas_prices.sql @@ -0,0 +1,17 @@ +{% macro gas_prices(blockchain, transactions) %} + +SELECT '{{blockchain}}' AS blockchain +, date_trunc('minute', block_time) AS minute +, approx_percentile(gas_price/1e9, 0.1) AS tenth_percentile_gas +, approx_percentile(gas_price/1e9, 0.5) AS median_gas +, approx_percentile(gas_price/1e9, 0.9) AS ninetieth_percentile_gas +, AVG(gas_price/1e9) AS avg_gas +, MIN(gas_price/1e9) AS min_gas +, MAX(gas_price/1e9) AS max_gas +FROM {{transactions}} +{% if is_incremental() %} +WHERE {{ incremental_predicate('block_time') }} +{% endif %} +GROUP BY 2 + +{% endmacro %} diff --git a/models/_sector/gas/prices/_schema.yml b/models/_sector/gas/prices/_schema.yml new file mode 100644 index 00000000000..9c034dc8935 --- /dev/null +++ b/models/_sector/gas/prices/_schema.yml @@ -0,0 +1,42 @@ +version: 2 + +models: + - name: gas_prices + meta: + blockchain: ethereum, bnb, avalanche_c, gnosis, optimism, fantom, arbitrum, celo, zkync, zora, scroll, goerli, linea, zkevm, goerli + sector: gas + contributors: hildobby + config: + tags: ['gas', 'prices'] + description: > + Gas prices per minute, per chain + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - blockchain + - minute + columns: + - &blockchain + name: blockchain + description: "Blockchain" + - &minute + name: minute + description: "UTC minute" + - &median_gas + name: median_gas + description: "Median gas price" + - &tenth_percentile_gas + name: tenth_percentile_gas + description: "10th percentile gas price" + - &ninetieth_percentile_gas + name: ninetieth_percentile_gas + description: "90th percentile gas price" + - &avg_gas + name: avg_gas + description: "Average gas price" + - &min_gas + name: min_gas + description: "Minimum gas price" + - &max_gas + name: max_gas + description: "Maximum gas price" \ No newline at end of file diff --git a/models/_sector/gas/prices/chains/_schema.yml b/models/_sector/gas/prices/chains/_schema.yml new file mode 100644 index 00000000000..de418cd42fa --- /dev/null +++ b/models/_sector/gas/prices/chains/_schema.yml @@ -0,0 +1,402 @@ +version: 2 + +models: + - name: gas_arbitrum_prices + meta: + blockchain: arbitrum + sector: gas + contributors: hildobby + config: + tags: ['gas', 'prices'] + description: > + Gas prices per minute, on arbitrum + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - blockchain + - minute + columns: + - &blockchain + name: blockchain + description: "Blockchain" + - &minute + name: minute + description: "UTC minute" + - &median_gas + name: median_gas + description: "Median gas price" + - &tenth_percentile_gas + name: tenth_percentile_gas + description: "10th percentile gas price" + - &ninetieth_percentile_gas + name: ninetieth_percentile_gas + description: "90th percentile gas price" + - &avg_gas + name: avg_gas + description: "Average gas price" + - &min_gas + name: min_gas + description: "Minimum gas price" + - &max_gas + name: max_gas + description: "Maximum gas price" + + - name: gas_avalanche_c_prices + meta: + blockchain: avalanche_c + sector: gas + contributors: hildobby + config: + tags: ['gas', 'prices'] + description: > + Gas prices per minute, on avalanche_c + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - blockchain + - minute + columns: + - *blockchain + - *minute + - *median_gas + - *tenth_percentile_gas + - *ninetieth_percentile_gas + - *avg_gas + - *min_gas + - *max_gas + + - name: gas_base_prices + meta: + blockchain: base + sector: gas + contributors: hildobby + config: + tags: ['gas', 'prices'] + description: > + Gas prices per minute, on base + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - blockchain + - minute + columns: + - *blockchain + - *minute + - *median_gas + - *tenth_percentile_gas + - *ninetieth_percentile_gas + - *avg_gas + - *min_gas + - *max_gas + + - name: gas_bnb_prices + meta: + blockchain: bnb + sector: gas + contributors: hildobby + config: + tags: ['gas', 'prices'] + description: > + Gas prices per minute, on bnb + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - blockchain + - minute + columns: + - *blockchain + - *minute + - *median_gas + - *tenth_percentile_gas + - *ninetieth_percentile_gas + - *avg_gas + - *min_gas + - *max_gas + + - name: gas_celo_prices + meta: + blockchain: celo + sector: gas + contributors: hildobby + config: + tags: ['gas', 'prices'] + description: > + Gas prices per minute, on celo + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - blockchain + - minute + columns: + - *blockchain + - *minute + - *median_gas + - *tenth_percentile_gas + - *ninetieth_percentile_gas + - *avg_gas + - *min_gas + - *max_gas + + - name: gas_ethereum_prices + meta: + blockchain: ethereum + sector: gas + contributors: hildobby + config: + tags: ['gas', 'prices'] + description: > + Gas prices per minute, on ethereum + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - blockchain + - minute + columns: + - *blockchain + - *minute + - *median_gas + - *tenth_percentile_gas + - *ninetieth_percentile_gas + - *avg_gas + - *min_gas + - *max_gas + + - name: gas_fantom_prices + meta: + blockchain: fantom + sector: gas + contributors: hildobby + config: + tags: ['gas', 'prices'] + description: > + Gas prices per minute, on fantom + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - blockchain + - minute + columns: + - *blockchain + - *minute + - *median_gas + - *tenth_percentile_gas + - *ninetieth_percentile_gas + - *avg_gas + - *min_gas + - *max_gas + + - name: gas_gnosis_prices + meta: + blockchain: gnosis + sector: gas + contributors: hildobby + config: + tags: ['gas', 'prices'] + description: > + Gas prices per minute, on gnosis + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - blockchain + - minute + columns: + - *blockchain + - *minute + - *median_gas + - *tenth_percentile_gas + - *ninetieth_percentile_gas + - *avg_gas + - *min_gas + - *max_gas + + - name: gas_linea_prices + meta: + blockchain: linea + sector: gas + contributors: hildobby + config: + tags: ['gas', 'prices'] + description: > + Gas prices per minute, on linea + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - blockchain + - minute + columns: + - *blockchain + - *minute + - *median_gas + - *tenth_percentile_gas + - *ninetieth_percentile_gas + - *avg_gas + - *min_gas + - *max_gas + + - name: gas_optimism_prices + meta: + blockchain: optimism + sector: gas + contributors: hildobby + config: + tags: ['gas', 'prices'] + description: > + Gas prices per minute, on optimism + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - blockchain + - minute + columns: + - *blockchain + - *minute + - *median_gas + - *tenth_percentile_gas + - *ninetieth_percentile_gas + - *avg_gas + - *min_gas + - *max_gas + + - name: gas_polygon_prices + meta: + blockchain: polygon + sector: gas + contributors: hildobby + config: + tags: ['gas', 'prices'] + description: > + Gas prices per minute, on polygon + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - blockchain + - minute + columns: + - *blockchain + - *minute + - *median_gas + - *tenth_percentile_gas + - *ninetieth_percentile_gas + - *avg_gas + - *min_gas + - *max_gas + + - name: gas_scroll_prices + meta: + blockchain: scroll + sector: gas + contributors: hildobby + config: + tags: ['gas', 'prices'] + description: > + Gas prices per minute, on scroll + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - blockchain + - minute + columns: + - *blockchain + - *minute + - *median_gas + - *tenth_percentile_gas + - *ninetieth_percentile_gas + - *avg_gas + - *min_gas + - *max_gas + + - name: gas_zkevm_prices + meta: + blockchain: zkevm + sector: gas + contributors: hildobby + config: + tags: ['gas', 'prices'] + description: > + Gas prices per minute, on zkevm + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - blockchain + - minute + columns: + - *blockchain + - *minute + - *median_gas + - *tenth_percentile_gas + - *ninetieth_percentile_gas + - *avg_gas + - *min_gas + - *max_gas + + - name: gas_zksync_prices + meta: + blockchain: zksync + sector: gas + contributors: hildobby + config: + tags: ['gas', 'prices'] + description: > + Gas prices per minute, on zksync + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - blockchain + - minute + columns: + - *blockchain + - *minute + - *median_gas + - *tenth_percentile_gas + - *ninetieth_percentile_gas + - *avg_gas + - *min_gas + - *max_gas + + - name: gas_zora_prices + meta: + blockchain: zora + sector: gas + contributors: hildobby + config: + tags: ['gas', 'prices'] + description: > + Gas prices per minute, on zora + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - blockchain + - minute + columns: + - *blockchain + - *minute + - *median_gas + - *tenth_percentile_gas + - *ninetieth_percentile_gas + - *avg_gas + - *min_gas + - *max_gas + + - name: gas_goerli_prices + meta: + blockchain: goerli + sector: gas + contributors: hildobby + config: + tags: ['gas', 'prices'] + description: > + Gas prices per minute, on goerli + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - blockchain + - minute + columns: + - *blockchain + - *minute + - *median_gas + - *tenth_percentile_gas + - *ninetieth_percentile_gas + - *avg_gas + - *min_gas + - *max_gas \ No newline at end of file diff --git a/models/_sector/gas/prices/chains/gas_arbitrum_prices.sql b/models/_sector/gas/prices/chains/gas_arbitrum_prices.sql new file mode 100644 index 00000000000..8317291e04d --- /dev/null +++ b/models/_sector/gas/prices/chains/gas_arbitrum_prices.sql @@ -0,0 +1,17 @@ +{% set blockchain = 'arbitrum' %} + +{{ config( + + schema = 'gas_' + blockchain, + alias = 'prices', + materialized = 'incremental', + file_format = 'delta', + incremental_strategy = 'merge', + unique_key = ['minute'] +) +}} + +{{gas_prices( + blockchain = blockchain + , transactions = source(blockchain, 'transactions') +)}} \ No newline at end of file diff --git a/models/_sector/gas/prices/chains/gas_avalanche_c_prices.sql b/models/_sector/gas/prices/chains/gas_avalanche_c_prices.sql new file mode 100644 index 00000000000..d1675241909 --- /dev/null +++ b/models/_sector/gas/prices/chains/gas_avalanche_c_prices.sql @@ -0,0 +1,17 @@ +{% set blockchain = 'avalanche_c' %} + +{{ config( + + schema = 'gas_' + blockchain, + alias = 'prices', + materialized = 'incremental', + file_format = 'delta', + incremental_strategy = 'merge', + unique_key = ['minute'] +) +}} + +{{gas_prices( + blockchain = blockchain + , transactions = source(blockchain, 'transactions') +)}} \ No newline at end of file diff --git a/models/_sector/gas/prices/chains/gas_base_prices.sql b/models/_sector/gas/prices/chains/gas_base_prices.sql new file mode 100644 index 00000000000..95438a23a01 --- /dev/null +++ b/models/_sector/gas/prices/chains/gas_base_prices.sql @@ -0,0 +1,17 @@ +{% set blockchain = 'base' %} + +{{ config( + + schema = 'gas_' + blockchain, + alias = 'prices', + materialized = 'incremental', + file_format = 'delta', + incremental_strategy = 'merge', + unique_key = ['minute'] +) +}} + +{{gas_prices( + blockchain = blockchain + , transactions = source(blockchain, 'transactions') +)}} \ No newline at end of file diff --git a/models/_sector/gas/prices/chains/gas_bnb_prices.sql b/models/_sector/gas/prices/chains/gas_bnb_prices.sql new file mode 100644 index 00000000000..5fa572a08cf --- /dev/null +++ b/models/_sector/gas/prices/chains/gas_bnb_prices.sql @@ -0,0 +1,17 @@ +{% set blockchain = 'bnb' %} + +{{ config( + + schema = 'gas_' + blockchain, + alias = 'prices', + materialized = 'incremental', + file_format = 'delta', + incremental_strategy = 'merge', + unique_key = ['minute'] +) +}} + +{{gas_prices( + blockchain = blockchain + , transactions = source(blockchain, 'transactions') +)}} \ No newline at end of file diff --git a/models/_sector/gas/prices/chains/gas_celo_prices.sql b/models/_sector/gas/prices/chains/gas_celo_prices.sql new file mode 100644 index 00000000000..413af108e5b --- /dev/null +++ b/models/_sector/gas/prices/chains/gas_celo_prices.sql @@ -0,0 +1,17 @@ +{% set blockchain = 'celo' %} + +{{ config( + + schema = 'gas_' + blockchain, + alias = 'prices', + materialized = 'incremental', + file_format = 'delta', + incremental_strategy = 'merge', + unique_key = ['minute'] +) +}} + +{{gas_prices( + blockchain = blockchain + , transactions = source(blockchain, 'transactions') +)}} \ No newline at end of file diff --git a/models/_sector/gas/prices/chains/gas_ethereum_prices.sql b/models/_sector/gas/prices/chains/gas_ethereum_prices.sql new file mode 100644 index 00000000000..646359c16af --- /dev/null +++ b/models/_sector/gas/prices/chains/gas_ethereum_prices.sql @@ -0,0 +1,17 @@ +{% set blockchain = 'ethereum' %} + +{{ config( + + schema = 'gas_' + blockchain, + alias = 'prices', + materialized = 'incremental', + file_format = 'delta', + incremental_strategy = 'merge', + unique_key = ['minute'] +) +}} + +{{gas_prices( + blockchain = blockchain + , transactions = source(blockchain, 'transactions') +)}} \ No newline at end of file diff --git a/models/_sector/gas/prices/chains/gas_fantom_prices.sql b/models/_sector/gas/prices/chains/gas_fantom_prices.sql new file mode 100644 index 00000000000..ab893f556a4 --- /dev/null +++ b/models/_sector/gas/prices/chains/gas_fantom_prices.sql @@ -0,0 +1,17 @@ +{% set blockchain = 'fantom' %} + +{{ config( + + schema = 'gas_' + blockchain, + alias = 'prices', + materialized = 'incremental', + file_format = 'delta', + incremental_strategy = 'merge', + unique_key = ['minute'] +) +}} + +{{gas_prices( + blockchain = blockchain + , transactions = source(blockchain, 'transactions') +)}} \ No newline at end of file diff --git a/models/_sector/gas/prices/chains/gas_gnosis_prices.sql b/models/_sector/gas/prices/chains/gas_gnosis_prices.sql new file mode 100644 index 00000000000..1195d37aaa2 --- /dev/null +++ b/models/_sector/gas/prices/chains/gas_gnosis_prices.sql @@ -0,0 +1,17 @@ +{% set blockchain = 'gnosis' %} + +{{ config( + + schema = 'gas_' + blockchain, + alias = 'prices', + materialized = 'incremental', + file_format = 'delta', + incremental_strategy = 'merge', + unique_key = ['minute'] +) +}} + +{{gas_prices( + blockchain = blockchain + , transactions = source(blockchain, 'transactions') +)}} \ No newline at end of file diff --git a/models/_sector/gas/prices/chains/gas_goerli_prices.sql b/models/_sector/gas/prices/chains/gas_goerli_prices.sql new file mode 100644 index 00000000000..cea277c7cd7 --- /dev/null +++ b/models/_sector/gas/prices/chains/gas_goerli_prices.sql @@ -0,0 +1,17 @@ +{% set blockchain = 'goerli' %} + +{{ config( + + schema = 'gas_' + blockchain, + alias = 'prices', + materialized = 'incremental', + file_format = 'delta', + incremental_strategy = 'merge', + unique_key = ['minute'] +) +}} + +{{gas_prices( + blockchain = blockchain + , transactions = source(blockchain, 'transactions') +)}} \ No newline at end of file diff --git a/models/_sector/gas/prices/chains/gas_linea_prices.sql b/models/_sector/gas/prices/chains/gas_linea_prices.sql new file mode 100644 index 00000000000..0854912d2cf --- /dev/null +++ b/models/_sector/gas/prices/chains/gas_linea_prices.sql @@ -0,0 +1,17 @@ +{% set blockchain = 'linea' %} + +{{ config( + + schema = 'gas_' + blockchain, + alias = 'prices', + materialized = 'incremental', + file_format = 'delta', + incremental_strategy = 'merge', + unique_key = ['minute'] +) +}} + +{{gas_prices( + blockchain = blockchain + , transactions = source(blockchain, 'transactions') +)}} \ No newline at end of file diff --git a/models/_sector/gas/prices/chains/gas_optimism_prices.sql b/models/_sector/gas/prices/chains/gas_optimism_prices.sql new file mode 100644 index 00000000000..304f2f8894f --- /dev/null +++ b/models/_sector/gas/prices/chains/gas_optimism_prices.sql @@ -0,0 +1,17 @@ +{% set blockchain = 'optimism' %} + +{{ config( + + schema = 'gas_' + blockchain, + alias = 'prices', + materialized = 'incremental', + file_format = 'delta', + incremental_strategy = 'merge', + unique_key = ['minute'] +) +}} + +{{gas_prices( + blockchain = blockchain + , transactions = source(blockchain, 'transactions') +)}} \ No newline at end of file diff --git a/models/_sector/gas/prices/chains/gas_polygon_prices.sql b/models/_sector/gas/prices/chains/gas_polygon_prices.sql new file mode 100644 index 00000000000..fe16e30d77e --- /dev/null +++ b/models/_sector/gas/prices/chains/gas_polygon_prices.sql @@ -0,0 +1,17 @@ +{% set blockchain = 'polygon' %} + +{{ config( + + schema = 'gas_' + blockchain, + alias = 'prices', + materialized = 'incremental', + file_format = 'delta', + incremental_strategy = 'merge', + unique_key = ['minute'] +) +}} + +{{gas_prices( + blockchain = blockchain + , transactions = source(blockchain, 'transactions') +)}} \ No newline at end of file diff --git a/models/_sector/gas/prices/chains/gas_scroll_prices.sql b/models/_sector/gas/prices/chains/gas_scroll_prices.sql new file mode 100644 index 00000000000..e540ad977f9 --- /dev/null +++ b/models/_sector/gas/prices/chains/gas_scroll_prices.sql @@ -0,0 +1,17 @@ +{% set blockchain = 'scroll' %} + +{{ config( + + schema = 'gas_' + blockchain, + alias = 'prices', + materialized = 'incremental', + file_format = 'delta', + incremental_strategy = 'merge', + unique_key = ['minute'] +) +}} + +{{gas_prices( + blockchain = blockchain + , transactions = source(blockchain, 'transactions') +)}} \ No newline at end of file diff --git a/models/_sector/gas/prices/chains/gas_zkevm_prices.sql b/models/_sector/gas/prices/chains/gas_zkevm_prices.sql new file mode 100644 index 00000000000..a9fd3ed31a4 --- /dev/null +++ b/models/_sector/gas/prices/chains/gas_zkevm_prices.sql @@ -0,0 +1,17 @@ +{% set blockchain = 'zkevm' %} + +{{ config( + + schema = 'gas_' + blockchain, + alias = 'prices', + materialized = 'incremental', + file_format = 'delta', + incremental_strategy = 'merge', + unique_key = ['minute'] +) +}} + +{{gas_prices( + blockchain = blockchain + , transactions = source(blockchain, 'transactions') +)}} \ No newline at end of file diff --git a/models/_sector/gas/prices/chains/gas_zksync_prices.sql b/models/_sector/gas/prices/chains/gas_zksync_prices.sql new file mode 100644 index 00000000000..cb4c4a3a489 --- /dev/null +++ b/models/_sector/gas/prices/chains/gas_zksync_prices.sql @@ -0,0 +1,17 @@ +{% set blockchain = 'zksync' %} + +{{ config( + + schema = 'gas_' + blockchain, + alias = 'prices', + materialized = 'incremental', + file_format = 'delta', + incremental_strategy = 'merge', + unique_key = ['minute'] +) +}} + +{{gas_prices( + blockchain = blockchain + , transactions = source(blockchain, 'transactions') +)}} \ No newline at end of file diff --git a/models/_sector/gas/prices/chains/gas_zora_prices.sql b/models/_sector/gas/prices/chains/gas_zora_prices.sql new file mode 100644 index 00000000000..da1a602eb5b --- /dev/null +++ b/models/_sector/gas/prices/chains/gas_zora_prices.sql @@ -0,0 +1,17 @@ +{% set blockchain = 'zora' %} + +{{ config( + + schema = 'gas_' + blockchain, + alias = 'prices', + materialized = 'incremental', + file_format = 'delta', + incremental_strategy = 'merge', + unique_key = ['minute'] +) +}} + +{{gas_prices( + blockchain = blockchain + , transactions = source(blockchain, 'transactions') +)}} \ No newline at end of file diff --git a/models/_sector/gas/prices/gas_prices.sql b/models/_sector/gas/prices/gas_prices.sql new file mode 100644 index 00000000000..8b1f0a89d14 --- /dev/null +++ b/models/_sector/gas/prices/gas_prices.sql @@ -0,0 +1,54 @@ +{{ config( + + schema='gas', + alias = 'prices', + materialized = 'incremental', + file_format = 'delta', + incremental_strategy = 'merge', + unique_key = ['blockchain', 'minute'], + post_hook='{{ expose_spells(\'["ethereum", "bnb", "avalanche_c", "gnosis", "optimism", "arbitrum", "fantom", "polygon", "base", "celo", "zora", "zksync", "scroll", "linea", "zkevm"]\', + "sector", + "gas", + \'["hildobby"]\') }}' + ) +}} + +{% set all_models = [ + (ref('gas_arbitrum_prices')) + , (ref('gas_avalanche_c_prices')) + , (ref('gas_bnb_prices')) + , (ref('gas_ethereum_prices')) + , (ref('gas_fantom_prices')) + , (ref('gas_gnosis_prices')) + , (ref('gas_optimism_prices')) + , (ref('gas_polygon_prices')) + , (ref('gas_base_prices')) + , (ref('gas_celo_prices')) + , (ref('gas_zora_prices')) + , (ref('gas_zksync_prices')) + , (ref('gas_scroll_prices')) + , (ref('gas_goerli_prices')) + , (ref('gas_linea_prices')) + , (ref('gas_zkevm_prices')) +] %} + +SELECT * +FROM ( + {% for all_model in all_models %} + SELECT blockchain + , minute + , median_gas + , tenth_percentile_gas + , ninetieth_percentile_gas + , avg_gas + , min_gas + , max_gas + FROM {{ all_model }} + {% if is_incremental() %} + WHERE {{ incremental_predicate('minute') }} + {% endif %} + {% if not loop.last %} + UNION ALL + {% endif %} + {% endfor %} + ) \ No newline at end of file From dac5cc792eafb1db2b3452053314d593afb39925 Mon Sep 17 00:00:00 2001 From: ppclunghe <90045511+ppclunghe@users.noreply.github.com> Date: Mon, 3 Jun 2024 17:11:19 +0200 Subject: [PATCH 012/149] lido accounting updates (#5977) Co-authored-by: Huang Geyang Co-authored-by: jeff-dude <102681548+jeff-dude@users.noreply.github.com> --- .../lido_accounting_ethereum_other_expenses.sql | 6 ++++++ .../lido_accounting_ethereum_other_income.sql | 5 +++++ .../ethereum/lido_accounting_ethereum_revenue.sql | 5 +++-- ...accounting_ethereum_steth_referral_payment.sql | 12 +----------- .../lido_accounting_ethereum_trp_expenses.sql | 15 --------------- 5 files changed, 15 insertions(+), 28 deletions(-) diff --git a/models/lido/accounting/ethereum/lido_accounting_ethereum_other_expenses.sql b/models/lido/accounting/ethereum/lido_accounting_ethereum_other_expenses.sql index dc5888dee8b..8ca5244ead8 100644 --- a/models/lido/accounting/ethereum/lido_accounting_ethereum_other_expenses.sql +++ b/models/lido/accounting/ethereum/lido_accounting_ethereum_other_expenses.sql @@ -104,6 +104,10 @@ dai_referral_payments_addr AS ( SELECT 0xaf8aE6955d07776aB690e565Ba6Fbc79B8dE3a5d --rhino ), +steth_referral_payments_addr AS ( + SELECT _recipient AS address FROM {{source('lido_ethereum','AllowedRecipientsRegistry_RevShare_evt_RecipientAdded')}} +), + other_expenses_txns AS ( SELECT @@ -128,6 +132,8 @@ other_expenses_txns AS ( UNION ALL SELECT address FROM dai_referral_payments_addr UNION ALL + SELECT address FROM steth_referral_payments_addr + UNION ALL SELECT 0x0000000000000000000000000000000000000000 UNION ALL SELECT address FROM diversifications_addresses diff --git a/models/lido/accounting/ethereum/lido_accounting_ethereum_other_income.sql b/models/lido/accounting/ethereum/lido_accounting_ethereum_other_income.sql index 15b87745b72..5004bee2e8b 100644 --- a/models/lido/accounting/ethereum/lido_accounting_ethereum_other_income.sql +++ b/models/lido/accounting/ethereum/lido_accounting_ethereum_other_income.sql @@ -103,6 +103,9 @@ dai_referral_payments_addr AS ( SELECT 0xaf8aE6955d07776aB690e565Ba6Fbc79B8dE3a5d --rhino ), +steth_referral_payments_addr AS ( + SELECT _recipient AS address FROM {{source('lido_ethereum','AllowedRecipientsRegistry_RevShare_evt_RecipientAdded')}} +), other_income_txns AS ( SELECT @@ -125,6 +128,8 @@ other_income_txns AS ( UNION ALL SELECT address FROM dai_referral_payments_addr UNION ALL + SELECT address FROM steth_referral_payments_addr + UNION ALL select 0x0000000000000000000000000000000000000000 UNION ALL SELECT address FROM diversifications_addresses diff --git a/models/lido/accounting/ethereum/lido_accounting_ethereum_revenue.sql b/models/lido/accounting/ethereum/lido_accounting_ethereum_revenue.sql index d728a314890..9373633f012 100644 --- a/models/lido/accounting/ethereum/lido_accounting_ethereum_revenue.sql +++ b/models/lido/accounting/ethereum/lido_accounting_ethereum_revenue.sql @@ -17,7 +17,8 @@ with addresses AS ( select * from (values (0x3e40d73eb977dc6a537af587d48316fee66e9c8c, 'Aragon'), -(0x55032650b14df07b85bF18A3a3eC8E0Af2e028d5, 'NO'), +(0x55032650b14df07b85bF18A3a3eC8E0Af2e028d5, 'NO (Curated)'), +(0xaE7B191A31f627b4eB1d4DaC64eaB9976995b433, 'NO (DVT)'), (0x8B3f33234ABD88493c0Cd28De33D583B70beDe35, 'InsuranceFund') ) as list(address, name) ), @@ -39,7 +40,7 @@ oraclev2_txns as ( SELECT o.evt_block_time as period, case when t.to in (select address from addresses where name = 'Aragon') then cast(t.value as double) else 0 end AS treasury_revenue, - case when t.to in (select address from addresses where name = 'NO') then cast(t.value as double) else 0 end AS operators_revenue, + case when t.to in (select address from addresses where name like 'NO%') then cast(t.value as double) else 0 end AS operators_revenue, case when t.to in (select address from addresses where name = 'InsuranceFund') then cast(t.value as double) else 0 end as insurance_revenue, o.evt_tx_hash FROM {{source('lido_ethereum','AccountingOracle_evt_ProcessingStarted')}} o diff --git a/models/lido/accounting/ethereum/lido_accounting_ethereum_steth_referral_payment.sql b/models/lido/accounting/ethereum/lido_accounting_ethereum_steth_referral_payment.sql index 247d9934c32..176ea49830e 100644 --- a/models/lido/accounting/ethereum/lido_accounting_ethereum_steth_referral_payment.sql +++ b/models/lido/accounting/ethereum/lido_accounting_ethereum_steth_referral_payment.sql @@ -6,7 +6,7 @@ post_hook='{{ expose_spells(\'["ethereum"]\', "project", "lido_accounting", - \'["ppclunghe"]\') }}' + \'["pipistrella"]\') }}' ) }} @@ -46,16 +46,6 @@ select * from (values steth_referral_payments_addr AS ( SELECT _recipient AS address FROM {{source('lido_ethereum','AllowedRecipientsRegistry_RevShare_evt_RecipientAdded')}} - WHERE - ( - NOT EXISTS (SELECT _recipient FROM {{source('lido_ethereum','AllowedRecipientsRegistry_RevShare_evt_RecipientRemoved')}}) - OR ( - EXISTS (SELECT _recipient FROM {{source('lido_ethereum','AllowedRecipientsRegistry_RevShare_evt_RecipientRemoved')}}) - AND - _recipient NOT IN (SELECT _recipient FROM {{source('lido_ethereum','AllowedRecipientsRegistry_RevShare_evt_RecipientRemoved')}}) - ) - ) - ), diff --git a/models/lido/accounting/ethereum/lido_accounting_ethereum_trp_expenses.sql b/models/lido/accounting/ethereum/lido_accounting_ethereum_trp_expenses.sql index 5010e19a5cc..8391a30f8b0 100644 --- a/models/lido/accounting/ethereum/lido_accounting_ethereum_trp_expenses.sql +++ b/models/lido/accounting/ethereum/lido_accounting_ethereum_trp_expenses.sql @@ -62,21 +62,6 @@ select * from (values ), -dai_referral_payments_addr AS ( - SELECT _recipient AS address FROM {{source('lido_ethereum','AllowedRecipientsRegistry_evt_RecipientAdded')}} - WHERE - ( - NOT EXISTS (SELECT _recipient FROM {{source('lido_ethereum','AllowedRecipientsRegistry_evt_RecipientRemoved')}}) - OR ( - EXISTS (SELECT _recipient FROM {{source('lido_ethereum','AllowedRecipientsRegistry_evt_RecipientRemoved')}}) - AND - _recipient NOT IN (SELECT _recipient FROM {{source('lido_ethereum','AllowedRecipientsRegistry_evt_RecipientRemoved')}}) - ) - ) - UNION ALL - SELECT 0xaf8aE6955d07776aB690e565Ba6Fbc79B8dE3a5d --rhino -), - trp_expenses_txns AS ( SELECT evt_block_time, From bf3d49dd8de6639e83486de5db0f184842c0c06e Mon Sep 17 00:00:00 2001 From: B1boid <47173672+B1boid@users.noreply.github.com> Date: Mon, 3 Jun 2024 16:17:41 +0100 Subject: [PATCH 013/149] [READY_FOR_REVIEW]: Update Bebop dex-aggregator (#6035) * adding new chains * adding new version for ethereum * fix typo * fix typo * adding new version for base,arbitrum,polygon * fix duplicates * switcch to incremental_predicate & change post_hooks format * fix incremental_predicate --- .../bebop/arbitrum/bebop_arbitrum_schema.yml | 50 +++ .../bebop/arbitrum/bebop_arbitrum_trades.sql | 15 +- .../arbitrum/bebop_blend_arbitrum_trades.sql | 304 ++++++++++++++++++ .../arbitrum/bebop_jam_arbitrum_trades.sql | 8 +- .../arbitrum/bebop_rfq_arbitrum_trades.sql | 8 +- models/bebop/base/bebop_base_schema.yml | 188 +++++++++++ models/bebop/base/bebop_base_trades.sql | 51 +++ models/bebop/base/bebop_blend_base_trades.sql | 304 ++++++++++++++++++ models/bebop/base/bebop_jam_base_trades.sql | 208 ++++++++++++ models/bebop/bebop_trades.sql | 18 +- models/bebop/bebop_trades_schema.yml | 4 +- models/bebop/bnb/bebop_bnb_trades.sql | 12 +- models/bebop/bnb/bebop_jam_bnb_trades.sql | 8 +- .../ethereum/bebop_blend_ethereum_trades.sql | 304 ++++++++++++++++++ .../bebop/ethereum/bebop_ethereum_schema.yml | 50 +++ .../bebop/ethereum/bebop_ethereum_trades.sql | 15 +- .../ethereum/bebop_jam_ethereum_trades.sql | 8 +- .../ethereum/bebop_rfq_ethereum_trades.sql | 8 +- .../optimism/bebop_jam_optimism_trades.sql | 208 ++++++++++++ .../bebop/optimism/bebop_optimism_schema.yml | 188 +++++++++++ .../bebop/optimism/bebop_optimism_trades.sql | 51 +++ .../optimism/bebop_rfq_optimism_trades.sql | 219 +++++++++++++ .../polygon/bebop_blend_polygon_trades.sql | 304 ++++++++++++++++++ .../polygon/bebop_jam_polygon_trades.sql | 8 +- models/bebop/polygon/bebop_polygon_schema.yml | 50 +++ models/bebop/polygon/bebop_polygon_trades.sql | 15 +- .../polygon/bebop_rfq_polygon_trades.sql | 8 +- .../bebop/scroll/bebop_jam_scroll_trades.sql | 208 ++++++++++++ models/bebop/scroll/bebop_scroll_schema.yml | 138 ++++++++ models/bebop/scroll/bebop_scroll_trades.sql | 50 +++ .../bebop/zksync/bebop_jam_zksync_trades.sql | 208 ++++++++++++ models/bebop/zksync/bebop_zksync_schema.yml | 138 ++++++++ models/bebop/zksync/bebop_zksync_trades.sql | 50 +++ seeds/dex/aggregator/dex_aggregator_seed.csv | 11 +- .../bebop/arbitrum/bebop_arbitrum_sources.yml | 34 ++ sources/bebop/base/bebop_base_sources.yml | 49 +++ .../bebop/ethereum/bebop_ethereum_sources.yml | 34 ++ .../bebop/optimism/bebop_optimism_sources.yml | 27 ++ .../bebop/polygon/bebop_polygon_sources.yml | 34 ++ sources/bebop/scroll/bebop_scroll_sources.yml | 15 + sources/bebop/zksync/bebop_zksync_sources.yml | 15 + 41 files changed, 3560 insertions(+), 65 deletions(-) create mode 100644 models/bebop/arbitrum/bebop_blend_arbitrum_trades.sql create mode 100644 models/bebop/base/bebop_base_schema.yml create mode 100644 models/bebop/base/bebop_base_trades.sql create mode 100644 models/bebop/base/bebop_blend_base_trades.sql create mode 100644 models/bebop/base/bebop_jam_base_trades.sql create mode 100644 models/bebop/ethereum/bebop_blend_ethereum_trades.sql create mode 100644 models/bebop/optimism/bebop_jam_optimism_trades.sql create mode 100644 models/bebop/optimism/bebop_optimism_schema.yml create mode 100644 models/bebop/optimism/bebop_optimism_trades.sql create mode 100644 models/bebop/optimism/bebop_rfq_optimism_trades.sql create mode 100644 models/bebop/polygon/bebop_blend_polygon_trades.sql create mode 100644 models/bebop/scroll/bebop_jam_scroll_trades.sql create mode 100644 models/bebop/scroll/bebop_scroll_schema.yml create mode 100644 models/bebop/scroll/bebop_scroll_trades.sql create mode 100644 models/bebop/zksync/bebop_jam_zksync_trades.sql create mode 100644 models/bebop/zksync/bebop_zksync_schema.yml create mode 100644 models/bebop/zksync/bebop_zksync_trades.sql create mode 100644 sources/bebop/base/bebop_base_sources.yml create mode 100644 sources/bebop/optimism/bebop_optimism_sources.yml create mode 100644 sources/bebop/scroll/bebop_scroll_sources.yml create mode 100644 sources/bebop/zksync/bebop_zksync_sources.yml diff --git a/models/bebop/arbitrum/bebop_arbitrum_schema.yml b/models/bebop/arbitrum/bebop_arbitrum_schema.yml index ae64cec060c..dc11a552272 100644 --- a/models/bebop/arbitrum/bebop_arbitrum_schema.yml +++ b/models/bebop/arbitrum/bebop_arbitrum_schema.yml @@ -151,6 +151,56 @@ models: - *block_month - *trade_type + - name: bebop_blend_arbitrum_trades + meta: + blockchain: arbitrum + sector: dex + project: bebop + contributors: alekss + config: + tags: [ 'arbitrum','bebop','pmm','trades','dex', 'blend' ] + description: Bebop-BLEND contract trades on arbitrum - formatted for dex.trades + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - block_date + - blockchain + - project + - version + - tx_hash + - evt_index + - trace_address + - check_dex_aggregator_seed: + blockchain: arbitrum + project: bebop + version: blend + columns: + - *blockchain + - *project + - *version + - *block_date + - *block_time + - *token_bought_symbol + - *token_sold_symbol + - *token_pair + - *token_bought_amount + - *token_sold_amount + - *token_bought_amount_raw + - *token_sold_amount_raw + - *amount_usd + - *token_bought_address + - *token_sold_address + - *taker + - *maker + - *project_contract_address + - *tx_hash + - *tx_from + - *tx_to + - *trace_address + - *evt_index + - *block_month + - *trade_type + - name: bebop_arbitrum_trades meta: blockchain: arbitrum diff --git a/models/bebop/arbitrum/bebop_arbitrum_trades.sql b/models/bebop/arbitrum/bebop_arbitrum_trades.sql index 4e9b3a8f0a8..379112ab450 100644 --- a/models/bebop/arbitrum/bebop_arbitrum_trades.sql +++ b/models/bebop/arbitrum/bebop_arbitrum_trades.sql @@ -1,17 +1,18 @@ {{ config( schema = 'bebop_arbitrum', alias = 'trades', - post_hook='{{ expose_spells(\'["arbitrum"]\', - "project", - "bebop", - \'["alekss"]\') }}' - ) -}} + materialized = 'view', + post_hook='{{ expose_spells(blockchains = \'["arbitrum"]\', + spell_type = "project", + spell_name = "bebop", + contributors = \'["alekss"]\') }}' +)}} {% set bebop_models = [ ref('bebop_rfq_arbitrum_trades'), - ref('bebop_jam_arbitrum_trades') + ref('bebop_jam_arbitrum_trades'), + ref('bebop_blend_arbitrum_trades') ] %} SELECT * diff --git a/models/bebop/arbitrum/bebop_blend_arbitrum_trades.sql b/models/bebop/arbitrum/bebop_blend_arbitrum_trades.sql new file mode 100644 index 00000000000..30c4184d95b --- /dev/null +++ b/models/bebop/arbitrum/bebop_blend_arbitrum_trades.sql @@ -0,0 +1,304 @@ +{{ config( + schema = 'bebop_blend_arbitrum', + alias = 'trades', + partition_by = ['block_month'], + materialized = 'incremental', + file_format = 'delta', + incremental_strategy = 'merge', + unique_key = ['block_date', 'blockchain', 'project', 'version', 'tx_hash', 'evt_index', 'trace_address'] +)}} + +{% set project_start_date = '2024-04-30' %} + +WITH + + +bebop_single_trade AS ( + SELECT + call_block_time AS block_time, + call_block_number AS block_number, + call_tx_hash AS tx_hash, + evt_index, + ex.contract_address, + from_hex(JSON_EXTRACT_SCALAR(ex."order", '$.taker_address')) as taker_address, + from_hex(JSON_EXTRACT_SCALAR(ex."order", '$.maker_address')) as maker_address, + from_hex(JSON_EXTRACT_SCALAR(ex."order", '$.taker_token')) AS taker_token_address, + from_hex(JSON_EXTRACT_SCALAR(ex."order", '$.maker_token')) AS maker_token_address, + JSON_EXTRACT_SCALAR(ex."order", '$.taker_amount') AS taker_token_amount, + JSON_EXTRACT_SCALAR(ex."order", '$.maker_amount') AS maker_token_amount, + 'Simple-Swap' as trade_type, + cast(array[0, 0, 0] as array) as trace_address + FROM + (SELECT + evt_index, evt_tx_hash, evt_block_time, ROW_NUMBER() OVER (PARTITION BY evt_tx_hash ORDER BY evt_index) AS row_num + FROM {{ source('bebop_pmms_arbitrum', 'BebopSettlement_evt_BebopOrder') }}) evt + LEFT JOIN + (SELECT + call_success, call_block_time, call_block_number, call_tx_hash, contract_address, "order", + ROW_NUMBER() OVER (PARTITION BY call_tx_hash ORDER BY call_block_number) AS row_num + FROM {{ source('bebop_pmms_arbitrum', 'BebopSettlement_call_settleSingle') }} + UNION ALL + SELECT + call_success, call_block_time, call_block_number, call_tx_hash, contract_address, "order", + ROW_NUMBER() OVER (PARTITION BY call_tx_hash ORDER BY call_block_number) AS row_num + FROM {{ source('bebop_pmms_arbitrum', 'BebopSettlement_call_settleSingleAndSignPermit') }} + UNION ALL + SELECT + call_success, call_block_time, call_block_number, call_tx_hash, contract_address, "order", + ROW_NUMBER() OVER (PARTITION BY call_tx_hash ORDER BY call_block_number) AS row_num + FROM {{ source('bebop_pmms_arbitrum', 'BebopSettlement_call_settleSingleAndSignPermit2') }} + UNION ALL + SELECT + call_success, call_block_time, call_block_number, call_tx_hash, contract_address, "order", + ROW_NUMBER() OVER (PARTITION BY call_tx_hash ORDER BY call_block_number) AS row_num + FROM {{ source('bebop_pmms_arbitrum', 'BebopSettlement_call_swapSingle') }} + UNION ALL + SELECT + call_success, call_block_time, call_block_number, call_tx_hash, contract_address, "order", + ROW_NUMBER() OVER (PARTITION BY call_tx_hash ORDER BY call_block_number) AS row_num + FROM {{ source('bebop_pmms_arbitrum', 'BebopSettlement_call_swapSingleFromContract') }} + ) ex + ON ex.call_tx_hash = evt.evt_tx_hash and ex.row_num = evt.row_num + WHERE ex.call_success = TRUE + {% if is_incremental() %} + AND {{ incremental_predicate('evt.evt_block_time') }} + {% endif %} +), +raw_bebop_multi_trade AS ( + SELECT + call_block_time AS block_time, + call_block_number AS block_number, + call_tx_hash AS tx_hash, + evt_index, + ex.contract_address, + from_hex(JSON_EXTRACT_SCALAR(ex."order", '$.taker_address')) as taker_address, + from_hex(JSON_EXTRACT_SCALAR(ex."order", '$.maker_address')) as maker_address, + CAST(JSON_EXTRACT(ex."order", '$.taker_tokens') AS ARRAY) AS taker_tokens, + CAST(JSON_EXTRACT(ex."order", '$.maker_tokens') AS ARRAY) AS maker_tokens, + CAST(JSON_EXTRACT(ex."order", '$.taker_amounts') AS ARRAY) AS taker_amounts, + CAST(JSON_EXTRACT(ex."order", '$.maker_amounts') AS ARRAY) AS maker_amounts, + json_array_length(JSON_EXTRACT(ex."order", '$.taker_amounts')) as taker_tokens_len, + json_array_length(JSON_EXTRACT(ex."order", '$.maker_amounts')) as maker_tokens_len, + 0 as order_index + FROM + (SELECT + evt_index, evt_tx_hash, evt_block_time, ROW_NUMBER() OVER (PARTITION BY evt_tx_hash ORDER BY evt_index) AS row_num + FROM {{ source('bebop_pmms_arbitrum', 'BebopSettlement_evt_BebopOrder') }}) evt + LEFT JOIN + (SELECT + call_success, call_block_time, call_block_number, call_tx_hash, contract_address, "order", + ROW_NUMBER() OVER (PARTITION BY call_tx_hash ORDER BY call_block_number) AS row_num + FROM {{ source('bebop_pmms_arbitrum', 'BebopSettlement_call_settleMulti') }} + UNION ALL + SELECT + call_success, call_block_time, call_block_number, call_tx_hash, contract_address, "order", + ROW_NUMBER() OVER (PARTITION BY call_tx_hash ORDER BY call_block_number) AS row_num + FROM {{ source('bebop_pmms_arbitrum', 'BebopSettlement_call_settleMultiAndSignPermit') }} + UNION ALL + SELECT + call_success, call_block_time, call_block_number, call_tx_hash, contract_address, "order", + ROW_NUMBER() OVER (PARTITION BY call_tx_hash ORDER BY call_block_number) AS row_num + FROM {{ source('bebop_pmms_arbitrum', 'BebopSettlement_call_settleMultiAndSignPermit2') }} + UNION ALL + SELECT + call_success, call_block_time, call_block_number, call_tx_hash, contract_address, "order", + ROW_NUMBER() OVER (PARTITION BY call_tx_hash ORDER BY call_block_number) AS row_num + FROM {{ source('bebop_pmms_arbitrum', 'BebopSettlement_call_swapMulti') }} + ) ex + ON ex.call_tx_hash = evt.evt_tx_hash and ex.row_num = evt.row_num + WHERE ex.call_success = TRUE + {% if is_incremental() %} + AND {{ incremental_predicate('evt.evt_block_time') }} + {% endif %} +), + +raw_bebop_aggregate_trade AS ( + SELECT + call_block_time AS block_time, + call_block_number AS block_number, + call_tx_hash AS tx_hash, + evt_index, + ex.contract_address, + from_hex(JSON_EXTRACT_SCALAR(ex."order", '$.taker_address')) as taker_address, + CAST(JSON_EXTRACT(ex."order", '$.maker_addresses') AS ARRAY) AS maker_addresses, + JSON_EXTRACT(ex."order", '$.taker_tokens') AS taker_tokens_json, + JSON_EXTRACT(ex."order", '$.maker_tokens') AS maker_tokens_json, + JSON_EXTRACT(ex."order", '$.taker_amounts') AS taker_amounts_json, + JSON_EXTRACT(ex."order", '$.maker_amounts') AS maker_amounts_json, + json_array_length(JSON_EXTRACT(ex."order", '$.maker_addresses')) as orders_len + FROM + (SELECT + evt_index, evt_tx_hash, evt_block_time, ROW_NUMBER() OVER (PARTITION BY evt_tx_hash ORDER BY evt_index) AS row_num + FROM {{ source('bebop_pmms_arbitrum', 'BebopSettlement_evt_BebopOrder') }}) evt + LEFT JOIN + (SELECT + call_success, call_block_time, call_block_number, call_tx_hash, contract_address, "order", + ROW_NUMBER() OVER (PARTITION BY call_tx_hash ORDER BY call_block_number) AS row_num + FROM {{ source('bebop_pmms_arbitrum', 'BebopSettlement_call_settleAggregate') }} + UNION ALL + SELECT + call_success, call_block_time, call_block_number, call_tx_hash, contract_address, "order", + ROW_NUMBER() OVER (PARTITION BY call_tx_hash ORDER BY call_block_number) AS row_num + FROM {{ source('bebop_pmms_arbitrum', 'BebopSettlement_call_settleAggregateAndSignPermit') }} + UNION ALL + SELECT + call_success, call_block_time, call_block_number, call_tx_hash, contract_address, "order", + ROW_NUMBER() OVER (PARTITION BY call_tx_hash ORDER BY call_block_number) AS row_num + FROM {{ source('bebop_pmms_arbitrum', 'BebopSettlement_call_settleAggregateAndSignPermit2') }} + UNION ALL + SELECT + call_success, call_block_time, call_block_number, call_tx_hash, contract_address, "order", + ROW_NUMBER() OVER (PARTITION BY call_tx_hash ORDER BY call_block_number) AS row_num + FROM {{ source('bebop_pmms_arbitrum', 'BebopSettlement_call_swapAggregate') }} + ) ex + ON ex.call_tx_hash = evt.evt_tx_hash and ex.row_num = evt.row_num + WHERE ex.call_success = TRUE + {% if is_incremental() %} + AND {{ incremental_predicate('evt.evt_block_time') }} + {% endif %} +), +unnested_aggregate_orders AS ( + SELECT + block_time, + block_number, + tx_hash, + evt_index, + contract_address, + taker_address, + from_hex(element_at(maker_addresses, sequence_number)) AS maker_address, + CAST(json_extract(taker_tokens_json, concat('$[', cast(sequence_number - 1 as VARCHAR), ']')) AS ARRAY) AS taker_tokens, + CAST(json_extract(maker_tokens_json, concat('$[', cast(sequence_number - 1 as VARCHAR), ']')) AS ARRAY) AS maker_tokens, + CAST(json_extract(taker_amounts_json, concat('$[', cast(sequence_number - 1 as VARCHAR), ']')) AS ARRAY) AS taker_amounts, + CAST(json_extract(maker_amounts_json, concat('$[', cast(sequence_number - 1 as VARCHAR), ']')) AS ARRAY) AS maker_amounts, + json_array_length(json_extract(taker_tokens_json, concat('$[', cast(sequence_number - 1 as VARCHAR), ']'))) as taker_tokens_len, + json_array_length(json_extract(maker_tokens_json, concat('$[', cast(sequence_number - 1 as VARCHAR), ']'))) as maker_tokens_len, + sequence_number - 1 AS order_index + FROM raw_bebop_aggregate_trade + CROSS JOIN UNNEST(sequence(1, orders_len)) AS t(sequence_number) +), + +unnested_taker_arrays AS ( + SELECT + block_time, + block_number, + tx_hash, + evt_index, + contract_address, + taker_address, + maker_address, + maker_tokens, + maker_amounts, + taker_tokens_len, + maker_tokens_len, + from_hex(element_at(taker_tokens, sequence_number)) AS taker_token_address, + element_at(taker_amounts, sequence_number) AS taker_token_amount, + order_index, + sequence_number - 1 AS taker_token_index + FROM (SELECT * FROM raw_bebop_multi_trade UNION ALL SELECT * FROM unnested_aggregate_orders) + CROSS JOIN UNNEST(sequence(1, taker_tokens_len)) AS t(sequence_number) +), +bebop_multi_and_aggregate_trades AS ( + SELECT + block_time, + block_number, + tx_hash, + evt_index, + contract_address, + taker_address, + maker_address, + taker_token_address, + from_hex(element_at(maker_tokens, sequence_number)) AS maker_token_address, + taker_token_amount, + element_at(maker_amounts, sequence_number) AS maker_token_amount, + CASE + WHEN taker_tokens_len = 1 AND maker_tokens_len > 1 THEN 'Multi-Buy' + WHEN maker_tokens_len = 1 AND taker_tokens_len > 1 THEN 'Multi-Sell' + ELSE 'Simple-Swap' + END as trade_type, + cast(array[order_index, taker_token_index, sequence_number - 1] as array) as trace_address + FROM unnested_taker_arrays + CROSS JOIN UNNEST(sequence(1, maker_tokens_len)) AS t(sequence_number) +) + +SELECT + 'arbitrum' AS blockchain, + 'bebop' AS project, + 'blend' AS version, + CAST(date_trunc('DAY', t.block_time) AS date) AS block_date, + CAST(date_trunc('MONTH', t.block_time) AS date) AS block_month, + t.block_time AS block_time, + t.trade_type, + t_bought.symbol AS token_bought_symbol, + t_sold.symbol AS token_sold_symbol, + CASE + WHEN lower(t_bought.symbol) > lower(t_sold.symbol) THEN concat(t_sold.symbol, '-', t_bought.symbol) + ELSE concat(t_bought.symbol, '-', t_sold.symbol) + END AS token_pair, + CAST(t.maker_token_amount as double) / power(10, coalesce(t_bought.decimals, 0)) AS token_bought_amount, + CAST(t.taker_token_amount as double) / power(10, coalesce(t_sold.decimals, 0)) AS token_sold_amount, + CAST(t.maker_token_amount as UINT256) AS token_bought_amount_raw, + CAST(t.taker_token_amount as UINT256) as token_sold_amount_raw, + CASE + WHEN t.trade_type = 'Multi-Buy' THEN COALESCE( + (CAST(t.maker_token_amount as double) / power(10, t_bought.decimals)) * p_bought.price, + (CAST(t.taker_token_amount as double) / power(10, t_sold.decimals)) * p_sold.price / t.trace_address[2] + ) + WHEN t.trade_type = 'Multi-Sell' THEN COALESCE( + (CAST(t.taker_token_amount as double) / power(10, t_sold.decimals)) * p_sold.price, + (CAST(t.maker_token_amount as double) / power(10, t_bought.decimals)) * p_bought.price / t.trace_address[1] + ) + ELSE COALESCE( + (CAST(t.maker_token_amount as double) / power(10, t_bought.decimals)) * p_bought.price, + (CAST(t.taker_token_amount as double) / power(10, t_sold.decimals)) * p_sold.price + ) + END as amount_usd, + t.maker_token_address AS token_bought_address, + t.taker_token_address AS token_sold_address, + t.taker_address AS taker, + t.maker_address AS maker, + t.contract_address AS project_contract_address, + t.tx_hash, + tx."from" AS tx_from, + tx.to AS tx_to, + t.trace_address, + t.evt_index +FROM (SELECT * FROM bebop_single_trade UNION ALL SELECT * FROM bebop_multi_and_aggregate_trades) t +INNER JOIN +{{ source('arbitrum', 'transactions')}} tx + ON t.tx_hash = tx.hash + {% if not is_incremental() %} + AND tx.block_time >= TIMESTAMP '{{project_start_date}}' + {% endif %} + {% if is_incremental() %} + AND {{ incremental_predicate('tx.block_time') }} + {% endif %} + LEFT JOIN + {{ source('tokens', 'erc20') }} t_bought + ON t_bought.contract_address = t.maker_token_address + AND t_bought.blockchain = 'arbitrum' + LEFT JOIN + {{ source('tokens', 'erc20') }} t_sold + ON t_sold.contract_address = t.taker_token_address + AND t_sold.blockchain = 'arbitrum' + LEFT JOIN + {{ source('prices', 'usd') }} p_bought + ON p_bought.minute = date_trunc('minute', t.block_time) + AND p_bought.contract_address = t.maker_token_address + AND p_bought.blockchain = 'arbitrum' + {% if not is_incremental() %} + AND p_bought.minute >= TIMESTAMP '{{project_start_date}}' + {% endif %} + {% if is_incremental() %} + AND {{ incremental_predicate('p_bought.minute') }} + {% endif %} + LEFT JOIN + {{ source('prices', 'usd') }} p_sold + ON p_sold.minute = date_trunc('minute', t.block_time) + AND p_sold.contract_address = t.taker_token_address + AND p_sold.blockchain = 'arbitrum' + {% if not is_incremental() %} + AND p_sold.minute >= TIMESTAMP '{{project_start_date}}' + {% endif %} + {% if is_incremental() %} + AND {{ incremental_predicate('p_sold.minute') }} + {% endif %} \ No newline at end of file diff --git a/models/bebop/arbitrum/bebop_jam_arbitrum_trades.sql b/models/bebop/arbitrum/bebop_jam_arbitrum_trades.sql index 0652df7ecde..28185ae90e0 100644 --- a/models/bebop/arbitrum/bebop_jam_arbitrum_trades.sql +++ b/models/bebop/arbitrum/bebop_jam_arbitrum_trades.sql @@ -46,7 +46,7 @@ bebop_jam_raw_data AS ( ON ex.call_tx_hash = evt.evt_tx_hash and ex.row_num = evt.row_num WHERE ex.call_success = TRUE {% if is_incremental() %} - AND evt.evt_block_time >= date_trunc('day', now() - interval '7' Day) + AND {{ incremental_predicate('evt.evt_block_time') }} {% endif %} ), @@ -174,7 +174,7 @@ INNER JOIN AND tx.block_time >= TIMESTAMP '{{project_start_date}}' {% endif %} {% if is_incremental() %} - AND tx.block_time >= date_trunc('day', now() - interval '7' Day) + AND {{ incremental_predicate('tx.block_time') }} {% endif %} LEFT JOIN {{ source('tokens', 'erc20') }} t_bought @@ -193,7 +193,7 @@ INNER JOIN AND p_bought.minute >= TIMESTAMP '{{project_start_date}}' {% endif %} {% if is_incremental() %} - AND p_bought.minute >= date_trunc('day', now() - interval '7' Day) + AND {{ incremental_predicate('p_bought.minute') }} {% endif %} LEFT JOIN {{ source('prices', 'usd') }} p_sold @@ -204,5 +204,5 @@ INNER JOIN AND p_sold.minute >= TIMESTAMP '{{project_start_date}}' {% endif %} {% if is_incremental() %} - AND p_sold.minute >= date_trunc('day', now() - interval '7' Day) + AND {{ incremental_predicate('p_sold.minute') }} {% endif %} \ No newline at end of file diff --git a/models/bebop/arbitrum/bebop_rfq_arbitrum_trades.sql b/models/bebop/arbitrum/bebop_rfq_arbitrum_trades.sql index 78d5c2bbe09..8ad2b992239 100644 --- a/models/bebop/arbitrum/bebop_rfq_arbitrum_trades.sql +++ b/models/bebop/arbitrum/bebop_rfq_arbitrum_trades.sql @@ -55,7 +55,7 @@ bebop_raw_data AS ( ON ex.call_tx_hash = evt.evt_tx_hash and ex.row_num = evt.row_num WHERE ex.call_success = TRUE {% if is_incremental() %} - AND evt.evt_block_time >= date_trunc('day', now() - interval '7' Day) + AND {{ incremental_predicate('evt.evt_block_time') }} {% endif %} ), @@ -192,7 +192,7 @@ INNER JOIN AND tx.block_time >= TIMESTAMP '{{project_start_date}}' {% endif %} {% if is_incremental() %} - AND tx.block_time >= date_trunc('day', now() - interval '7' Day) + AND {{ incremental_predicate('tx.block_time') }} {% endif %} LEFT JOIN {{ source('tokens', 'erc20') }} t_bought @@ -211,7 +211,7 @@ INNER JOIN AND p_bought.minute >= TIMESTAMP '{{project_start_date}}' {% endif %} {% if is_incremental() %} - AND p_bought.minute >= date_trunc('day', now() - interval '7' Day) + AND {{ incremental_predicate('p_bought.minute') }} {% endif %} LEFT JOIN {{ source('prices', 'usd') }} p_sold @@ -222,5 +222,5 @@ INNER JOIN AND p_sold.minute >= TIMESTAMP '{{project_start_date}}' {% endif %} {% if is_incremental() %} - AND p_sold.minute >= date_trunc('day', now() - interval '7' Day) + AND {{ incremental_predicate('p_sold.minute') }} {% endif %} \ No newline at end of file diff --git a/models/bebop/base/bebop_base_schema.yml b/models/bebop/base/bebop_base_schema.yml new file mode 100644 index 00000000000..5535d241fc9 --- /dev/null +++ b/models/bebop/base/bebop_base_schema.yml @@ -0,0 +1,188 @@ +version: 2 + +models: + - name: bebop_jam_base_trades + meta: + blockchain: base + sector: dex + project: bebop + contributors: alekss + config: + tags: [ 'base','bebop','jam','trades','dex' ] + description: Bebop-JAM contract trades on base - formatted for dex.trades + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - block_date + - blockchain + - project + - version + - tx_hash + - evt_index + - trace_address + - check_dex_aggregator_seed: + blockchain: base + project: bebop + version: jam + columns: + - &blockchain + name: blockchain + description: "Blockchain which the DEX is deployed" + - &project + name: project + description: "Project name of the DEX" + - &version + name: version + description: "Version of the contract built and deployed by the DEX project" + - &block_date + name: block_date + description: "UTC event block date of each DEX trade" + - &block_time + name: block_time + description: "UTC event block time of each DEX trade" + - &token_bought_symbol + name: token_bought_symbol + description: "Token symbol for token bought in the transaction" + - &token_sold_symbol + name: token_sold_symbol + description: "Token symbol for token sold in the transaction" + - &token_pair + name: token_pair + description: "Token symbol pair for each token involved in the transaction" + - &token_bought_amount + name: token_bought_amount + description: "Value of the token bought at time of execution in the original currency" + - &token_sold_amount + name: token_sold_amount + description: "Value of the token sold at time of execution in the original currency" + - &token_bought_amount_raw + name: token_bought_amount_raw + description: "Raw value of the token bought at time of execution in the original currency" + - &token_sold_amount_raw + name: token_sold_amount_raw + description: "Raw value of the token sold at time of execution in the original currency" + - &amount_usd + name: amount_usd + description: "USD value of the trade at time of execution" + - &token_bought_address + name: token_bought_address + description: "Contract address of the token bought" + - &token_sold_address + name: token_sold_address + description: "Contract address of the token sold" + - &taker + name: taker + description: "Address of trader who purchased a token" + - &maker + name: maker + description: "Address of trader who sold a token" + - &project_contract_address + name: project_contract_address + description: "Project contract address which executed the trade on the blockchain" + - &tx_hash + name: tx_hash + description: "Unique transaction hash value tied to each transaction on the DEX" + - &tx_from + name: tx_from + description: "Address which initiated the transaction" + - &tx_to + name: tx_to + description: "Address which received the transaction" + - &trace_address + name: trace_address + description: "" + - &evt_index + name: evt_index + description: "" + - &block_month + name: block_month + description: "UTC event block month of each DEX trade" + - &trade_type + name: trade_type + description: "Trade classification (Multi-buy, Multi-sell or Simple-swap)" + + - name: bebop_blend_base_trades + meta: + blockchain: base + sector: dex + project: bebop + contributors: alekss + config: + tags: [ 'base','bebop','pmm','trades','dex', 'blend' ] + description: Bebop-BLEND contract trades on base - formatted for dex.trades + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - block_date + - blockchain + - project + - version + - tx_hash + - evt_index + - trace_address + - check_dex_aggregator_seed: + blockchain: base + project: bebop + version: blend + columns: + - *blockchain + - *project + - *version + - *block_date + - *block_time + - *token_bought_symbol + - *token_sold_symbol + - *token_pair + - *token_bought_amount + - *token_sold_amount + - *token_bought_amount_raw + - *token_sold_amount_raw + - *amount_usd + - *token_bought_address + - *token_sold_address + - *taker + - *maker + - *project_contract_address + - *tx_hash + - *tx_from + - *tx_to + - *trace_address + - *evt_index + - *block_month + - *trade_type + + - name: bebop_base_trades + meta: + blockchain: base + sector: dex + project: bebop + contributors: alekss + config: + tags: [ 'base','bebop','trades','dex' ] + description: Bebop contract trades on base - formatted for dex.trades + columns: + - *blockchain + - *project + - *version + - *block_date + - *block_time + - *token_bought_symbol + - *token_sold_symbol + - *token_pair + - *token_bought_amount + - *token_sold_amount + - *token_bought_amount_raw + - *token_sold_amount_raw + - *amount_usd + - *token_bought_address + - *token_sold_address + - *taker + - *maker + - *project_contract_address + - *tx_hash + - *tx_from + - *tx_to + - *trace_address + - *evt_index + - *block_month + - *trade_type diff --git a/models/bebop/base/bebop_base_trades.sql b/models/bebop/base/bebop_base_trades.sql new file mode 100644 index 00000000000..4f15ae0ebdd --- /dev/null +++ b/models/bebop/base/bebop_base_trades.sql @@ -0,0 +1,51 @@ +{{ config( + schema = 'bebop_base', + alias = 'trades', + materialized = 'view', + post_hook='{{ expose_spells(blockchains = \'["base"]\', + spell_type = "project", + spell_name = "bebop", + contributors = \'["alekss"]\') }}' +)}} + + +{% set bebop_models = [ + ref('bebop_jam_base_trades'), + ref('bebop_blend_base_trades') +] %} + +SELECT * +FROM ( + {% for dex_model in bebop_models %} + SELECT + blockchain, + project, + version, + block_month, + block_date, + block_time, + trade_type, + token_bought_symbol, + token_sold_symbol, + token_pair, + token_bought_amount, + token_sold_amount, + token_bought_amount_raw, + token_sold_amount_raw, + amount_usd, + token_bought_address, + token_sold_address, + taker, + maker, + project_contract_address, + tx_hash, + tx_from, + tx_to, + trace_address, + evt_index + FROM {{ dex_model }} + {% if not loop.last %} + UNION ALL + {% endif %} + {% endfor %} +) diff --git a/models/bebop/base/bebop_blend_base_trades.sql b/models/bebop/base/bebop_blend_base_trades.sql new file mode 100644 index 00000000000..98e8cc835e0 --- /dev/null +++ b/models/bebop/base/bebop_blend_base_trades.sql @@ -0,0 +1,304 @@ +{{ config( + schema = 'bebop_blend_base', + alias = 'trades', + partition_by = ['block_month'], + materialized = 'incremental', + file_format = 'delta', + incremental_strategy = 'merge', + unique_key = ['block_date', 'blockchain', 'project', 'version', 'tx_hash', 'evt_index', 'trace_address'] +)}} + +{% set project_start_date = '2024-04-23' %} + +WITH + + +bebop_single_trade AS ( + SELECT + call_block_time AS block_time, + call_block_number AS block_number, + call_tx_hash AS tx_hash, + evt_index, + ex.contract_address, + from_hex(JSON_EXTRACT_SCALAR(ex."order", '$.taker_address')) as taker_address, + from_hex(JSON_EXTRACT_SCALAR(ex."order", '$.maker_address')) as maker_address, + from_hex(JSON_EXTRACT_SCALAR(ex."order", '$.taker_token')) AS taker_token_address, + from_hex(JSON_EXTRACT_SCALAR(ex."order", '$.maker_token')) AS maker_token_address, + JSON_EXTRACT_SCALAR(ex."order", '$.taker_amount') AS taker_token_amount, + JSON_EXTRACT_SCALAR(ex."order", '$.maker_amount') AS maker_token_amount, + 'Simple-Swap' as trade_type, + cast(array[0, 0, 0] as array) as trace_address + FROM + (SELECT + evt_index, evt_tx_hash, evt_block_time, ROW_NUMBER() OVER (PARTITION BY evt_tx_hash ORDER BY evt_index) AS row_num + FROM {{ source('bebop_pmms_base', 'BebopSettlement_evt_BebopOrder') }}) evt + LEFT JOIN + (SELECT + call_success, call_block_time, call_block_number, call_tx_hash, contract_address, "order", + ROW_NUMBER() OVER (PARTITION BY call_tx_hash ORDER BY call_block_number) AS row_num + FROM {{ source('bebop_pmms_base', 'BebopSettlement_call_settleSingle') }} + UNION ALL + SELECT + call_success, call_block_time, call_block_number, call_tx_hash, contract_address, "order", + ROW_NUMBER() OVER (PARTITION BY call_tx_hash ORDER BY call_block_number) AS row_num + FROM {{ source('bebop_pmms_base', 'BebopSettlement_call_settleSingleAndSignPermit') }} + UNION ALL + SELECT + call_success, call_block_time, call_block_number, call_tx_hash, contract_address, "order", + ROW_NUMBER() OVER (PARTITION BY call_tx_hash ORDER BY call_block_number) AS row_num + FROM {{ source('bebop_pmms_base', 'BebopSettlement_call_settleSingleAndSignPermit2') }} + UNION ALL + SELECT + call_success, call_block_time, call_block_number, call_tx_hash, contract_address, "order", + ROW_NUMBER() OVER (PARTITION BY call_tx_hash ORDER BY call_block_number) AS row_num + FROM {{ source('bebop_pmms_base', 'BebopSettlement_call_swapSingle') }} + UNION ALL + SELECT + call_success, call_block_time, call_block_number, call_tx_hash, contract_address, "order", + ROW_NUMBER() OVER (PARTITION BY call_tx_hash ORDER BY call_block_number) AS row_num + FROM {{ source('bebop_pmms_base', 'BebopSettlement_call_swapSingleFromContract') }} + ) ex + ON ex.call_tx_hash = evt.evt_tx_hash and ex.row_num = evt.row_num + WHERE ex.call_success = TRUE + {% if is_incremental() %} + AND {{ incremental_predicate('evt.evt_block_time') }} + {% endif %} +), +raw_bebop_multi_trade AS ( + SELECT + call_block_time AS block_time, + call_block_number AS block_number, + call_tx_hash AS tx_hash, + evt_index, + ex.contract_address, + from_hex(JSON_EXTRACT_SCALAR(ex."order", '$.taker_address')) as taker_address, + from_hex(JSON_EXTRACT_SCALAR(ex."order", '$.maker_address')) as maker_address, + CAST(JSON_EXTRACT(ex."order", '$.taker_tokens') AS ARRAY) AS taker_tokens, + CAST(JSON_EXTRACT(ex."order", '$.maker_tokens') AS ARRAY) AS maker_tokens, + CAST(JSON_EXTRACT(ex."order", '$.taker_amounts') AS ARRAY) AS taker_amounts, + CAST(JSON_EXTRACT(ex."order", '$.maker_amounts') AS ARRAY) AS maker_amounts, + json_array_length(JSON_EXTRACT(ex."order", '$.taker_amounts')) as taker_tokens_len, + json_array_length(JSON_EXTRACT(ex."order", '$.maker_amounts')) as maker_tokens_len, + 0 as order_index + FROM + (SELECT + evt_index, evt_tx_hash, evt_block_time, ROW_NUMBER() OVER (PARTITION BY evt_tx_hash ORDER BY evt_index) AS row_num + FROM {{ source('bebop_pmms_base', 'BebopSettlement_evt_BebopOrder') }}) evt + LEFT JOIN + (SELECT + call_success, call_block_time, call_block_number, call_tx_hash, contract_address, "order", + ROW_NUMBER() OVER (PARTITION BY call_tx_hash ORDER BY call_block_number) AS row_num + FROM {{ source('bebop_pmms_base', 'BebopSettlement_call_settleMulti') }} + UNION ALL + SELECT + call_success, call_block_time, call_block_number, call_tx_hash, contract_address, "order", + ROW_NUMBER() OVER (PARTITION BY call_tx_hash ORDER BY call_block_number) AS row_num + FROM {{ source('bebop_pmms_base', 'BebopSettlement_call_settleMultiAndSignPermit') }} + UNION ALL + SELECT + call_success, call_block_time, call_block_number, call_tx_hash, contract_address, "order", + ROW_NUMBER() OVER (PARTITION BY call_tx_hash ORDER BY call_block_number) AS row_num + FROM {{ source('bebop_pmms_base', 'BebopSettlement_call_settleMultiAndSignPermit2') }} + UNION ALL + SELECT + call_success, call_block_time, call_block_number, call_tx_hash, contract_address, "order", + ROW_NUMBER() OVER (PARTITION BY call_tx_hash ORDER BY call_block_number) AS row_num + FROM {{ source('bebop_pmms_base', 'BebopSettlement_call_swapMulti') }} + ) ex + ON ex.call_tx_hash = evt.evt_tx_hash and ex.row_num = evt.row_num + WHERE ex.call_success = TRUE + {% if is_incremental() %} + AND {{ incremental_predicate('evt.evt_block_time') }} + {% endif %} +), + +raw_bebop_aggregate_trade AS ( + SELECT + call_block_time AS block_time, + call_block_number AS block_number, + call_tx_hash AS tx_hash, + evt_index, + ex.contract_address, + from_hex(JSON_EXTRACT_SCALAR(ex."order", '$.taker_address')) as taker_address, + CAST(JSON_EXTRACT(ex."order", '$.maker_addresses') AS ARRAY) AS maker_addresses, + JSON_EXTRACT(ex."order", '$.taker_tokens') AS taker_tokens_json, + JSON_EXTRACT(ex."order", '$.maker_tokens') AS maker_tokens_json, + JSON_EXTRACT(ex."order", '$.taker_amounts') AS taker_amounts_json, + JSON_EXTRACT(ex."order", '$.maker_amounts') AS maker_amounts_json, + json_array_length(JSON_EXTRACT(ex."order", '$.maker_addresses')) as orders_len + FROM + (SELECT + evt_index, evt_tx_hash, evt_block_time, ROW_NUMBER() OVER (PARTITION BY evt_tx_hash ORDER BY evt_index) AS row_num + FROM {{ source('bebop_pmms_base', 'BebopSettlement_evt_BebopOrder') }}) evt + LEFT JOIN + (SELECT + call_success, call_block_time, call_block_number, call_tx_hash, contract_address, "order", + ROW_NUMBER() OVER (PARTITION BY call_tx_hash ORDER BY call_block_number) AS row_num + FROM {{ source('bebop_pmms_base', 'BebopSettlement_call_settleAggregate') }} + UNION ALL + SELECT + call_success, call_block_time, call_block_number, call_tx_hash, contract_address, "order", + ROW_NUMBER() OVER (PARTITION BY call_tx_hash ORDER BY call_block_number) AS row_num + FROM {{ source('bebop_pmms_base', 'BebopSettlement_call_settleAggregateAndSignPermit') }} + UNION ALL + SELECT + call_success, call_block_time, call_block_number, call_tx_hash, contract_address, "order", + ROW_NUMBER() OVER (PARTITION BY call_tx_hash ORDER BY call_block_number) AS row_num + FROM {{ source('bebop_pmms_base', 'BebopSettlement_call_settleAggregateAndSignPermit2') }} + UNION ALL + SELECT + call_success, call_block_time, call_block_number, call_tx_hash, contract_address, "order", + ROW_NUMBER() OVER (PARTITION BY call_tx_hash ORDER BY call_block_number) AS row_num + FROM {{ source('bebop_pmms_base', 'BebopSettlement_call_swapAggregate') }} + ) ex + ON ex.call_tx_hash = evt.evt_tx_hash and ex.row_num = evt.row_num + WHERE ex.call_success = TRUE + {% if is_incremental() %} + AND {{ incremental_predicate('evt.evt_block_time') }} + {% endif %} +), +unnested_aggregate_orders AS ( + SELECT + block_time, + block_number, + tx_hash, + evt_index, + contract_address, + taker_address, + from_hex(element_at(maker_addresses, sequence_number)) AS maker_address, + CAST(json_extract(taker_tokens_json, concat('$[', cast(sequence_number - 1 as VARCHAR), ']')) AS ARRAY) AS taker_tokens, + CAST(json_extract(maker_tokens_json, concat('$[', cast(sequence_number - 1 as VARCHAR), ']')) AS ARRAY) AS maker_tokens, + CAST(json_extract(taker_amounts_json, concat('$[', cast(sequence_number - 1 as VARCHAR), ']')) AS ARRAY) AS taker_amounts, + CAST(json_extract(maker_amounts_json, concat('$[', cast(sequence_number - 1 as VARCHAR), ']')) AS ARRAY) AS maker_amounts, + json_array_length(json_extract(taker_tokens_json, concat('$[', cast(sequence_number - 1 as VARCHAR), ']'))) as taker_tokens_len, + json_array_length(json_extract(maker_tokens_json, concat('$[', cast(sequence_number - 1 as VARCHAR), ']'))) as maker_tokens_len, + sequence_number - 1 AS order_index + FROM raw_bebop_aggregate_trade + CROSS JOIN UNNEST(sequence(1, orders_len)) AS t(sequence_number) +), + +unnested_taker_arrays AS ( + SELECT + block_time, + block_number, + tx_hash, + evt_index, + contract_address, + taker_address, + maker_address, + maker_tokens, + maker_amounts, + taker_tokens_len, + maker_tokens_len, + from_hex(element_at(taker_tokens, sequence_number)) AS taker_token_address, + element_at(taker_amounts, sequence_number) AS taker_token_amount, + order_index, + sequence_number - 1 AS taker_token_index + FROM (SELECT * FROM raw_bebop_multi_trade UNION ALL SELECT * FROM unnested_aggregate_orders) + CROSS JOIN UNNEST(sequence(1, taker_tokens_len)) AS t(sequence_number) +), +bebop_multi_and_aggregate_trades AS ( + SELECT + block_time, + block_number, + tx_hash, + evt_index, + contract_address, + taker_address, + maker_address, + taker_token_address, + from_hex(element_at(maker_tokens, sequence_number)) AS maker_token_address, + taker_token_amount, + element_at(maker_amounts, sequence_number) AS maker_token_amount, + CASE + WHEN taker_tokens_len = 1 AND maker_tokens_len > 1 THEN 'Multi-Buy' + WHEN maker_tokens_len = 1 AND taker_tokens_len > 1 THEN 'Multi-Sell' + ELSE 'Simple-Swap' + END as trade_type, + cast(array[order_index, taker_token_index, sequence_number - 1] as array) as trace_address + FROM unnested_taker_arrays + CROSS JOIN UNNEST(sequence(1, maker_tokens_len)) AS t(sequence_number) +) + +SELECT + 'base' AS blockchain, + 'bebop' AS project, + 'blend' AS version, + CAST(date_trunc('DAY', t.block_time) AS date) AS block_date, + CAST(date_trunc('MONTH', t.block_time) AS date) AS block_month, + t.block_time AS block_time, + t.trade_type, + t_bought.symbol AS token_bought_symbol, + t_sold.symbol AS token_sold_symbol, + CASE + WHEN lower(t_bought.symbol) > lower(t_sold.symbol) THEN concat(t_sold.symbol, '-', t_bought.symbol) + ELSE concat(t_bought.symbol, '-', t_sold.symbol) + END AS token_pair, + CAST(t.maker_token_amount as double) / power(10, coalesce(t_bought.decimals, 0)) AS token_bought_amount, + CAST(t.taker_token_amount as double) / power(10, coalesce(t_sold.decimals, 0)) AS token_sold_amount, + CAST(t.maker_token_amount as UINT256) AS token_bought_amount_raw, + CAST(t.taker_token_amount as UINT256) as token_sold_amount_raw, + CASE + WHEN t.trade_type = 'Multi-Buy' THEN COALESCE( + (CAST(t.maker_token_amount as double) / power(10, t_bought.decimals)) * p_bought.price, + (CAST(t.taker_token_amount as double) / power(10, t_sold.decimals)) * p_sold.price / t.trace_address[2] + ) + WHEN t.trade_type = 'Multi-Sell' THEN COALESCE( + (CAST(t.taker_token_amount as double) / power(10, t_sold.decimals)) * p_sold.price, + (CAST(t.maker_token_amount as double) / power(10, t_bought.decimals)) * p_bought.price / t.trace_address[1] + ) + ELSE COALESCE( + (CAST(t.maker_token_amount as double) / power(10, t_bought.decimals)) * p_bought.price, + (CAST(t.taker_token_amount as double) / power(10, t_sold.decimals)) * p_sold.price + ) + END as amount_usd, + t.maker_token_address AS token_bought_address, + t.taker_token_address AS token_sold_address, + t.taker_address AS taker, + t.maker_address AS maker, + t.contract_address AS project_contract_address, + t.tx_hash, + tx."from" AS tx_from, + tx.to AS tx_to, + t.trace_address, + t.evt_index +FROM (SELECT * FROM bebop_single_trade UNION ALL SELECT * FROM bebop_multi_and_aggregate_trades) t +INNER JOIN +{{ source('base', 'transactions')}} tx + ON t.tx_hash = tx.hash + {% if not is_incremental() %} + AND tx.block_time >= TIMESTAMP '{{project_start_date}}' + {% endif %} + {% if is_incremental() %} + AND {{ incremental_predicate('tx.block_time') }} + {% endif %} + LEFT JOIN + {{ source('tokens', 'erc20') }} t_bought + ON t_bought.contract_address = t.maker_token_address + AND t_bought.blockchain = 'base' + LEFT JOIN + {{ source('tokens', 'erc20') }} t_sold + ON t_sold.contract_address = t.taker_token_address + AND t_sold.blockchain = 'base' + LEFT JOIN + {{ source('prices', 'usd') }} p_bought + ON p_bought.minute = date_trunc('minute', t.block_time) + AND p_bought.contract_address = t.maker_token_address + AND p_bought.blockchain = 'base' + {% if not is_incremental() %} + AND p_bought.minute >= TIMESTAMP '{{project_start_date}}' + {% endif %} + {% if is_incremental() %} + AND {{ incremental_predicate('p_bought.minute') }} + {% endif %} + LEFT JOIN + {{ source('prices', 'usd') }} p_sold + ON p_sold.minute = date_trunc('minute', t.block_time) + AND p_sold.contract_address = t.taker_token_address + AND p_sold.blockchain = 'base' + {% if not is_incremental() %} + AND p_sold.minute >= TIMESTAMP '{{project_start_date}}' + {% endif %} + {% if is_incremental() %} + AND {{ incremental_predicate('p_sold.minute') }} + {% endif %} \ No newline at end of file diff --git a/models/bebop/base/bebop_jam_base_trades.sql b/models/bebop/base/bebop_jam_base_trades.sql new file mode 100644 index 00000000000..09731935584 --- /dev/null +++ b/models/bebop/base/bebop_jam_base_trades.sql @@ -0,0 +1,208 @@ +{{ config( + schema = 'bebop_jam_base', + alias = 'trades', + partition_by = ['block_month'], + materialized = 'incremental', + file_format = 'delta', + incremental_strategy = 'merge', + unique_key = ['block_date', 'blockchain', 'project', 'version', 'tx_hash', 'evt_index', 'trace_address'] +)}} + +{% set project_start_date = '2024-04-24' %} + +WITH + +bebop_jam_raw_data AS ( + SELECT + call_block_time AS block_time, + call_block_number AS block_number, + call_tx_hash AS tx_hash, + evt_index, + ex.contract_address, + JSON_EXTRACT_SCALAR(ex."order", '$.expiry') AS expiry, + from_hex(JSON_EXTRACT_SCALAR(ex."order", '$.taker')) as taker_address, + (CAST(JSON_EXTRACT(ex."order", '$.sellTokens') AS ARRAY)) AS taker_tokens_raw, + (CAST(JSON_EXTRACT(ex."order", '$.buyTokens') AS ARRAY)) AS maker_tokens_raw, + (CAST(JSON_EXTRACT(ex."order", '$.sellAmounts') AS ARRAY)) AS taker_amounts_raw, + (CAST(JSON_EXTRACT(ex."order", '$.buyAmounts') AS ARRAY)) AS maker_amounts_raw, + json_array_length(JSON_EXTRACT(ex."order", '$.sellTokens')) as taker_length, + json_array_length(JSON_EXTRACT(ex."order", '$.buyTokens')) as maker_length + FROM + (SELECT + evt_index, evt_tx_hash, evt_block_time, ROW_NUMBER() OVER (PARTITION BY evt_tx_hash ORDER BY evt_index) AS row_num + FROM {{ source('bebop_jam_base', 'JamSettlement_evt_Settlement') }} + ) evt + LEFT JOIN + (SELECT + call_success, call_block_time, call_block_number, call_tx_hash, contract_address, "order", + ROW_NUMBER() OVER (PARTITION BY call_tx_hash ORDER BY call_block_number) AS row_num + FROM {{ source('bebop_jam_base', 'JamSettlement_call_settle') }} + UNION ALL + SELECT + call_success, call_block_time, call_block_number, call_tx_hash, contract_address, "order", + ROW_NUMBER() OVER (PARTITION BY call_tx_hash ORDER BY call_block_number) AS row_num + FROM {{ source('bebop_jam_base', 'JamSettlement_call_settleWithPermitsSignatures') }} + ) ex + ON ex.call_tx_hash = evt.evt_tx_hash and ex.row_num = evt.row_num + WHERE ex.call_success = TRUE + {% if is_incremental() %} + AND {{ incremental_predicate('evt.evt_block_time') }} + {% endif %} +), + +jam_unnested_array_taker AS ( + SELECT + block_time, + block_number, + tx_hash, + evt_index, + contract_address, + expiry, + taker_address, + maker_tokens_raw, + maker_amounts_raw, + taker_length, + maker_length, + element_at(taker_tokens_raw, sequence_number) AS taker_token_address, + element_at(taker_amounts_raw, sequence_number) AS taker_token_amounts, + sequence_number - 1 AS taker_index + FROM bebop_jam_raw_data + CROSS JOIN UNNEST(sequence(1, taker_length)) AS t(sequence_number) +), + +jam_unnested_array_maker AS ( + SELECT + block_time, + block_number, + tx_hash, + evt_index, + contract_address, + expiry, + taker_address, + taker_token_address, + taker_token_amounts, + taker_index, + taker_length, + maker_length, + element_at(maker_tokens_raw, sequence_number) AS maker_token_address, + element_at(maker_amounts_raw, sequence_number) AS maker_token_amounts, + sequence_number - 1 AS maker_index + FROM jam_unnested_array_taker + CROSS JOIN UNNEST(sequence(1, maker_length)) AS t(sequence_number) +), + +jam_simple_trades as ( + SELECT + block_time, + block_number, + contract_address, + tx_hash, + evt_index, + taker_address, + taker_length, + maker_length, + CASE + WHEN taker_length = 1 AND maker_length > 1 THEN CAST(array[taker_index, maker_index] as array) + WHEN maker_length = 1 AND taker_length > 1 THEN CAST(array[maker_index, taker_index] as array) + ELSE CAST(array[taker_index, maker_index] as array) + END as trace_address, + CASE + WHEN taker_length = 1 AND maker_length > 1 THEN 'Multi-Buy' + WHEN maker_length = 1 AND taker_length > 1 THEN 'Multi-Sell' + ELSE 'Simple-Swap' + END as trade_type, + from_hex(maker_token_address) as token_bought_address, + from_hex(taker_token_address) as token_sold_address, + CAST(maker_token_amounts as UINT256) as token_bought_amount_raw, + CAST(maker_token_amounts as double) as token_bought_amount, + CAST(taker_token_amounts as UINT256) as token_sold_amount_raw, + CAST(taker_token_amounts as double) as token_sold_amount + FROM + jam_unnested_array_maker + WHERE maker_token_address IS NOT NULL + AND taker_token_address IS NOT NULL +) + +SELECT + 'base' AS blockchain, + 'bebop' AS project, + 'jam' AS version, + CAST(date_trunc('DAY', t.block_time) AS date) AS block_date, + CAST(date_trunc('MONTH', t.block_time) AS date) AS block_month, + t.block_time AS block_time, + t.trade_type, + t_bought.symbol AS token_bought_symbol, + t_sold.symbol AS token_sold_symbol, + CASE + WHEN lower(t_bought.symbol) > lower(t_sold.symbol) THEN concat(t_sold.symbol, '-', t_bought.symbol) + ELSE concat(t_bought.symbol, '-', t_sold.symbol) + END AS token_pair, + t.token_bought_amount / power(10, coalesce(t_bought.decimals, 0)) AS token_bought_amount, + t.token_sold_amount / power(10, coalesce(t_sold.decimals, 0)) AS token_sold_amount, + t.token_bought_amount_raw, + t.token_sold_amount_raw, + CASE + WHEN t.trade_type = 'Multi-Buy' THEN COALESCE( + (t.token_bought_amount / power(10, t_bought.decimals)) * p_bought.price, + (t.token_sold_amount / power(10, t_sold.decimals)) * p_sold.price / maker_length + ) + WHEN t.trade_type = 'Multi-Sell' THEN COALESCE( + (t.token_sold_amount / power(10, t_sold.decimals)) * p_sold.price, + (t.token_bought_amount / power(10, t_bought.decimals)) * p_bought.price / taker_length + ) + ELSE COALESCE( + (t.token_bought_amount / power(10, t_bought.decimals)) * p_bought.price, + (t.token_sold_amount / power(10, t_sold.decimals)) * p_sold.price + ) + END as amount_usd, -- when there's a Multi-trade, the usd value of the multi tokens traded is used as the amount_usd + t.token_bought_address, + t.token_sold_address, + t.taker_address AS taker, + t.contract_address AS maker, + t.contract_address AS project_contract_address, + t.tx_hash, + tx."from" tx_from, + tx.to AS tx_to, + t.trace_address, + t.evt_index +FROM +jam_simple_trades t +INNER JOIN +{{ source('base', 'transactions')}} tx + ON t.tx_hash = tx.hash + {% if not is_incremental() %} + AND tx.block_time >= TIMESTAMP '{{project_start_date}}' + {% endif %} + {% if is_incremental() %} + AND {{ incremental_predicate('tx.block_time') }} + {% endif %} + LEFT JOIN + {{ source('tokens', 'erc20') }} t_bought + ON t_bought.contract_address = t.token_bought_address + AND t_bought.blockchain = 'base' + LEFT JOIN + {{ source('tokens', 'erc20') }} t_sold + ON t_sold.contract_address = t.token_sold_address + AND t_sold.blockchain = 'base' + LEFT JOIN + {{ source('prices', 'usd') }} p_bought + ON p_bought.minute = date_trunc('minute', t.block_time) + AND p_bought.contract_address = t.token_bought_address + AND p_bought.blockchain = 'base' + {% if not is_incremental() %} + AND p_bought.minute >= TIMESTAMP '{{project_start_date}}' + {% endif %} + {% if is_incremental() %} + AND {{ incremental_predicate('p_bought.minute') }} + {% endif %} + LEFT JOIN + {{ source('prices', 'usd') }} p_sold + ON p_sold.minute = date_trunc('minute', t.block_time) + AND p_sold.contract_address = t.token_sold_address + AND p_sold.blockchain = 'base' + {% if not is_incremental() %} + AND p_sold.minute >= TIMESTAMP '{{project_start_date}}' + {% endif %} + {% if is_incremental() %} + AND {{ incremental_predicate('p_sold.minute') }} + {% endif %} \ No newline at end of file diff --git a/models/bebop/bebop_trades.sql b/models/bebop/bebop_trades.sql index 800544fedf7..a27b2dbd722 100644 --- a/models/bebop/bebop_trades.sql +++ b/models/bebop/bebop_trades.sql @@ -1,19 +1,23 @@ {{ config( schema = 'bebop', alias = 'trades', - post_hook='{{ expose_spells(\'["polygon", "arbitrum", "ethereum", "bnb"]\', - "project", - "bebop", - \'["alekss"]\') }}' - ) -}} + materialized = 'view', + post_hook='{{ expose_spells(blockchains = \'["polygon", "arbitrum", "ethereum", "bnb", "base", "optimism", "scroll", "zksync"]\', + spell_type = "project", + spell_name = "bebop", + contributors = \'["alekss"]\') }}' +)}} {% set bebop_models = [ ref('bebop_polygon_trades'), ref('bebop_ethereum_trades'), ref('bebop_arbitrum_trades'), - ref('bebop_bnb_trades') + ref('bebop_bnb_trades'), + ref('bebop_base_trades'), + ref('bebop_optimism_trades'), + ref('bebop_scroll_trades'), + ref('bebop_zksync_trades') ] %} SELECT * diff --git a/models/bebop/bebop_trades_schema.yml b/models/bebop/bebop_trades_schema.yml index 270fc93e035..7a5058e4dcd 100644 --- a/models/bebop/bebop_trades_schema.yml +++ b/models/bebop/bebop_trades_schema.yml @@ -3,12 +3,12 @@ version: 2 models: - name: bebop_trades meta: - blockchain: polygon, arbitrum, ethereum, bnb + blockchain: polygon, arbitrum, ethereum, bnb, base, optimism, scroll, zksync sector: dex project: bebop contributors: alekss config: - tags: [ 'polygon', 'arbitrum', 'ethereum', 'bnb', 'bebop','trades','dex' ] + tags: ['bebop', 'trades', 'dex', 'intents', 'rfq', 'jam'] description: Bebop trades - formatted for dex.trades columns: - &blockchain diff --git a/models/bebop/bnb/bebop_bnb_trades.sql b/models/bebop/bnb/bebop_bnb_trades.sql index 4e6ad06cbb6..c685e81b692 100644 --- a/models/bebop/bnb/bebop_bnb_trades.sql +++ b/models/bebop/bnb/bebop_bnb_trades.sql @@ -1,12 +1,12 @@ {{ config( schema = 'bebop_bnb', alias = 'trades', - post_hook='{{ expose_spells(\'["bnb"]\', - "project", - "bebop", - \'["alekss"]\') }}' - ) -}} + materialized = 'view', + post_hook='{{ expose_spells(blockchains = \'["bnb"]\', + spell_type = "project", + spell_name = "bebop", + contributors = \'["alekss"]\') }}' +)}} {% set bebop_models = [ diff --git a/models/bebop/bnb/bebop_jam_bnb_trades.sql b/models/bebop/bnb/bebop_jam_bnb_trades.sql index d6fb22e6426..75cee91e370 100644 --- a/models/bebop/bnb/bebop_jam_bnb_trades.sql +++ b/models/bebop/bnb/bebop_jam_bnb_trades.sql @@ -46,7 +46,7 @@ bebop_jam_raw_data AS ( ON ex.call_tx_hash = evt.evt_tx_hash and ex.row_num = evt.row_num WHERE ex.call_success = TRUE {% if is_incremental() %} - AND evt.evt_block_time >= date_trunc('day', now() - interval '7' Day) + AND {{ incremental_predicate('evt.evt_block_time') }} {% endif %} ), @@ -174,7 +174,7 @@ INNER JOIN AND tx.block_time >= TIMESTAMP '{{project_start_date}}' {% endif %} {% if is_incremental() %} - AND tx.block_time >= date_trunc('day', now() - interval '7' Day) + AND {{ incremental_predicate('tx.block_time') }} {% endif %} LEFT JOIN {{ source('tokens', 'erc20') }} t_bought @@ -193,7 +193,7 @@ INNER JOIN AND p_bought.minute >= TIMESTAMP '{{project_start_date}}' {% endif %} {% if is_incremental() %} - AND p_bought.minute >= date_trunc('day', now() - interval '7' Day) + AND {{ incremental_predicate('p_bought.minute') }} {% endif %} LEFT JOIN {{ source('prices', 'usd') }} p_sold @@ -204,5 +204,5 @@ INNER JOIN AND p_sold.minute >= TIMESTAMP '{{project_start_date}}' {% endif %} {% if is_incremental() %} - AND p_sold.minute >= date_trunc('day', now() - interval '7' Day) + AND {{ incremental_predicate('p_sold.minute') }} {% endif %} \ No newline at end of file diff --git a/models/bebop/ethereum/bebop_blend_ethereum_trades.sql b/models/bebop/ethereum/bebop_blend_ethereum_trades.sql new file mode 100644 index 00000000000..b46be1a6f53 --- /dev/null +++ b/models/bebop/ethereum/bebop_blend_ethereum_trades.sql @@ -0,0 +1,304 @@ +{{ config( + schema = 'bebop_blend_ethereum', + alias = 'trades', + partition_by = ['block_month'], + materialized = 'incremental', + file_format = 'delta', + incremental_strategy = 'merge', + unique_key = ['block_date', 'blockchain', 'project', 'version', 'tx_hash', 'evt_index', 'trace_address'] +)}} + +{% set project_start_date = '2024-05-01' %} + +WITH + + +bebop_single_trade AS ( + SELECT + call_block_time AS block_time, + call_block_number AS block_number, + call_tx_hash AS tx_hash, + evt_index, + ex.contract_address, + from_hex(JSON_EXTRACT_SCALAR(ex."order", '$.taker_address')) as taker_address, + from_hex(JSON_EXTRACT_SCALAR(ex."order", '$.maker_address')) as maker_address, + from_hex(JSON_EXTRACT_SCALAR(ex."order", '$.taker_token')) AS taker_token_address, + from_hex(JSON_EXTRACT_SCALAR(ex."order", '$.maker_token')) AS maker_token_address, + JSON_EXTRACT_SCALAR(ex."order", '$.taker_amount') AS taker_token_amount, + JSON_EXTRACT_SCALAR(ex."order", '$.maker_amount') AS maker_token_amount, + 'Simple-Swap' as trade_type, + cast(array[0, 0, 0] as array) as trace_address + FROM + (SELECT + evt_index, evt_tx_hash, evt_block_time, ROW_NUMBER() OVER (PARTITION BY evt_tx_hash ORDER BY evt_index) AS row_num + FROM {{ source('bebop_pmms_ethereum', 'BebopSettlement_evt_BebopOrder') }}) evt + LEFT JOIN + (SELECT + call_success, call_block_time, call_block_number, call_tx_hash, contract_address, "order", + ROW_NUMBER() OVER (PARTITION BY call_tx_hash ORDER BY call_block_number) AS row_num + FROM {{ source('bebop_pmms_ethereum', 'BebopSettlement_call_settleSingle') }} + UNION ALL + SELECT + call_success, call_block_time, call_block_number, call_tx_hash, contract_address, "order", + ROW_NUMBER() OVER (PARTITION BY call_tx_hash ORDER BY call_block_number) AS row_num + FROM {{ source('bebop_pmms_ethereum', 'BebopSettlement_call_settleSingleAndSignPermit') }} + UNION ALL + SELECT + call_success, call_block_time, call_block_number, call_tx_hash, contract_address, "order", + ROW_NUMBER() OVER (PARTITION BY call_tx_hash ORDER BY call_block_number) AS row_num + FROM {{ source('bebop_pmms_ethereum', 'BebopSettlement_call_settleSingleAndSignPermit2') }} + UNION ALL + SELECT + call_success, call_block_time, call_block_number, call_tx_hash, contract_address, "order", + ROW_NUMBER() OVER (PARTITION BY call_tx_hash ORDER BY call_block_number) AS row_num + FROM {{ source('bebop_pmms_ethereum', 'BebopSettlement_call_swapSingle') }} + UNION ALL + SELECT + call_success, call_block_time, call_block_number, call_tx_hash, contract_address, "order", + ROW_NUMBER() OVER (PARTITION BY call_tx_hash ORDER BY call_block_number) AS row_num + FROM {{ source('bebop_pmms_ethereum', 'BebopSettlement_call_swapSingleFromContract') }} + ) ex + ON ex.call_tx_hash = evt.evt_tx_hash and ex.row_num = evt.row_num + WHERE ex.call_success = TRUE + {% if is_incremental() %} + AND {{ incremental_predicate('evt.evt_block_time') }} + {% endif %} +), +raw_bebop_multi_trade AS ( + SELECT + call_block_time AS block_time, + call_block_number AS block_number, + call_tx_hash AS tx_hash, + evt_index, + ex.contract_address, + from_hex(JSON_EXTRACT_SCALAR(ex."order", '$.taker_address')) as taker_address, + from_hex(JSON_EXTRACT_SCALAR(ex."order", '$.maker_address')) as maker_address, + CAST(JSON_EXTRACT(ex."order", '$.taker_tokens') AS ARRAY) AS taker_tokens, + CAST(JSON_EXTRACT(ex."order", '$.maker_tokens') AS ARRAY) AS maker_tokens, + CAST(JSON_EXTRACT(ex."order", '$.taker_amounts') AS ARRAY) AS taker_amounts, + CAST(JSON_EXTRACT(ex."order", '$.maker_amounts') AS ARRAY) AS maker_amounts, + json_array_length(JSON_EXTRACT(ex."order", '$.taker_amounts')) as taker_tokens_len, + json_array_length(JSON_EXTRACT(ex."order", '$.maker_amounts')) as maker_tokens_len, + 0 as order_index + FROM + (SELECT + evt_index, evt_tx_hash, evt_block_time, ROW_NUMBER() OVER (PARTITION BY evt_tx_hash ORDER BY evt_index) AS row_num + FROM {{ source('bebop_pmms_ethereum', 'BebopSettlement_evt_BebopOrder') }}) evt + LEFT JOIN + (SELECT + call_success, call_block_time, call_block_number, call_tx_hash, contract_address, "order", + ROW_NUMBER() OVER (PARTITION BY call_tx_hash ORDER BY call_block_number) AS row_num + FROM {{ source('bebop_pmms_ethereum', 'BebopSettlement_call_settleMulti') }} + UNION ALL + SELECT + call_success, call_block_time, call_block_number, call_tx_hash, contract_address, "order", + ROW_NUMBER() OVER (PARTITION BY call_tx_hash ORDER BY call_block_number) AS row_num + FROM {{ source('bebop_pmms_ethereum', 'BebopSettlement_call_settleMultiAndSignPermit') }} + UNION ALL + SELECT + call_success, call_block_time, call_block_number, call_tx_hash, contract_address, "order", + ROW_NUMBER() OVER (PARTITION BY call_tx_hash ORDER BY call_block_number) AS row_num + FROM {{ source('bebop_pmms_ethereum', 'BebopSettlement_call_settleMultiAndSignPermit2') }} + UNION ALL + SELECT + call_success, call_block_time, call_block_number, call_tx_hash, contract_address, "order", + ROW_NUMBER() OVER (PARTITION BY call_tx_hash ORDER BY call_block_number) AS row_num + FROM {{ source('bebop_pmms_ethereum', 'BebopSettlement_call_swapMulti') }} + ) ex + ON ex.call_tx_hash = evt.evt_tx_hash and ex.row_num = evt.row_num + WHERE ex.call_success = TRUE + {% if is_incremental() %} + AND {{ incremental_predicate('evt.evt_block_time') }} + {% endif %} +), + +raw_bebop_aggregate_trade AS ( + SELECT + call_block_time AS block_time, + call_block_number AS block_number, + call_tx_hash AS tx_hash, + evt_index, + ex.contract_address, + from_hex(JSON_EXTRACT_SCALAR(ex."order", '$.taker_address')) as taker_address, + CAST(JSON_EXTRACT(ex."order", '$.maker_addresses') AS ARRAY) AS maker_addresses, + JSON_EXTRACT(ex."order", '$.taker_tokens') AS taker_tokens_json, + JSON_EXTRACT(ex."order", '$.maker_tokens') AS maker_tokens_json, + JSON_EXTRACT(ex."order", '$.taker_amounts') AS taker_amounts_json, + JSON_EXTRACT(ex."order", '$.maker_amounts') AS maker_amounts_json, + json_array_length(JSON_EXTRACT(ex."order", '$.maker_addresses')) as orders_len + FROM + (SELECT + evt_index, evt_tx_hash, evt_block_time, ROW_NUMBER() OVER (PARTITION BY evt_tx_hash ORDER BY evt_index) AS row_num + FROM {{ source('bebop_pmms_ethereum', 'BebopSettlement_evt_BebopOrder') }}) evt + LEFT JOIN + (SELECT + call_success, call_block_time, call_block_number, call_tx_hash, contract_address, "order", + ROW_NUMBER() OVER (PARTITION BY call_tx_hash ORDER BY call_block_number) AS row_num + FROM {{ source('bebop_pmms_ethereum', 'BebopSettlement_call_settleAggregate') }} + UNION ALL + SELECT + call_success, call_block_time, call_block_number, call_tx_hash, contract_address, "order", + ROW_NUMBER() OVER (PARTITION BY call_tx_hash ORDER BY call_block_number) AS row_num + FROM {{ source('bebop_pmms_ethereum', 'BebopSettlement_call_settleAggregateAndSignPermit') }} + UNION ALL + SELECT + call_success, call_block_time, call_block_number, call_tx_hash, contract_address, "order", + ROW_NUMBER() OVER (PARTITION BY call_tx_hash ORDER BY call_block_number) AS row_num + FROM {{ source('bebop_pmms_ethereum', 'BebopSettlement_call_settleAggregateAndSignPermit2') }} + UNION ALL + SELECT + call_success, call_block_time, call_block_number, call_tx_hash, contract_address, "order", + ROW_NUMBER() OVER (PARTITION BY call_tx_hash ORDER BY call_block_number) AS row_num + FROM {{ source('bebop_pmms_ethereum', 'BebopSettlement_call_swapAggregate') }} + ) ex + ON ex.call_tx_hash = evt.evt_tx_hash and ex.row_num = evt.row_num + WHERE ex.call_success = TRUE + {% if is_incremental() %} + AND {{ incremental_predicate('evt.evt_block_time') }} + {% endif %} +), +unnested_aggregate_orders AS ( + SELECT + block_time, + block_number, + tx_hash, + evt_index, + contract_address, + taker_address, + from_hex(element_at(maker_addresses, sequence_number)) AS maker_address, + CAST(json_extract(taker_tokens_json, concat('$[', cast(sequence_number - 1 as VARCHAR), ']')) AS ARRAY) AS taker_tokens, + CAST(json_extract(maker_tokens_json, concat('$[', cast(sequence_number - 1 as VARCHAR), ']')) AS ARRAY) AS maker_tokens, + CAST(json_extract(taker_amounts_json, concat('$[', cast(sequence_number - 1 as VARCHAR), ']')) AS ARRAY) AS taker_amounts, + CAST(json_extract(maker_amounts_json, concat('$[', cast(sequence_number - 1 as VARCHAR), ']')) AS ARRAY) AS maker_amounts, + json_array_length(json_extract(taker_tokens_json, concat('$[', cast(sequence_number - 1 as VARCHAR), ']'))) as taker_tokens_len, + json_array_length(json_extract(maker_tokens_json, concat('$[', cast(sequence_number - 1 as VARCHAR), ']'))) as maker_tokens_len, + sequence_number - 1 AS order_index + FROM raw_bebop_aggregate_trade + CROSS JOIN UNNEST(sequence(1, orders_len)) AS t(sequence_number) +), + +unnested_taker_arrays AS ( + SELECT + block_time, + block_number, + tx_hash, + evt_index, + contract_address, + taker_address, + maker_address, + maker_tokens, + maker_amounts, + taker_tokens_len, + maker_tokens_len, + from_hex(element_at(taker_tokens, sequence_number)) AS taker_token_address, + element_at(taker_amounts, sequence_number) AS taker_token_amount, + order_index, + sequence_number - 1 AS taker_token_index + FROM (SELECT * FROM raw_bebop_multi_trade UNION ALL SELECT * FROM unnested_aggregate_orders) + CROSS JOIN UNNEST(sequence(1, taker_tokens_len)) AS t(sequence_number) +), +bebop_multi_and_aggregate_trades AS ( + SELECT + block_time, + block_number, + tx_hash, + evt_index, + contract_address, + taker_address, + maker_address, + taker_token_address, + from_hex(element_at(maker_tokens, sequence_number)) AS maker_token_address, + taker_token_amount, + element_at(maker_amounts, sequence_number) AS maker_token_amount, + CASE + WHEN taker_tokens_len = 1 AND maker_tokens_len > 1 THEN 'Multi-Buy' + WHEN maker_tokens_len = 1 AND taker_tokens_len > 1 THEN 'Multi-Sell' + ELSE 'Simple-Swap' + END as trade_type, + cast(array[order_index, taker_token_index, sequence_number - 1] as array) as trace_address + FROM unnested_taker_arrays + CROSS JOIN UNNEST(sequence(1, maker_tokens_len)) AS t(sequence_number) +) + +SELECT + 'ethereum' AS blockchain, + 'bebop' AS project, + 'blend' AS version, + CAST(date_trunc('DAY', t.block_time) AS date) AS block_date, + CAST(date_trunc('MONTH', t.block_time) AS date) AS block_month, + t.block_time AS block_time, + t.trade_type, + t_bought.symbol AS token_bought_symbol, + t_sold.symbol AS token_sold_symbol, + CASE + WHEN lower(t_bought.symbol) > lower(t_sold.symbol) THEN concat(t_sold.symbol, '-', t_bought.symbol) + ELSE concat(t_bought.symbol, '-', t_sold.symbol) + END AS token_pair, + CAST(t.maker_token_amount as double) / power(10, coalesce(t_bought.decimals, 0)) AS token_bought_amount, + CAST(t.taker_token_amount as double) / power(10, coalesce(t_sold.decimals, 0)) AS token_sold_amount, + CAST(t.maker_token_amount as UINT256) AS token_bought_amount_raw, + CAST(t.taker_token_amount as UINT256) as token_sold_amount_raw, + CASE + WHEN t.trade_type = 'Multi-Buy' THEN COALESCE( + (CAST(t.maker_token_amount as double) / power(10, t_bought.decimals)) * p_bought.price, + (CAST(t.taker_token_amount as double) / power(10, t_sold.decimals)) * p_sold.price / t.trace_address[2] + ) + WHEN t.trade_type = 'Multi-Sell' THEN COALESCE( + (CAST(t.taker_token_amount as double) / power(10, t_sold.decimals)) * p_sold.price, + (CAST(t.maker_token_amount as double) / power(10, t_bought.decimals)) * p_bought.price / t.trace_address[1] + ) + ELSE COALESCE( + (CAST(t.maker_token_amount as double) / power(10, t_bought.decimals)) * p_bought.price, + (CAST(t.taker_token_amount as double) / power(10, t_sold.decimals)) * p_sold.price + ) + END as amount_usd, + t.maker_token_address AS token_bought_address, + t.taker_token_address AS token_sold_address, + t.taker_address AS taker, + t.maker_address AS maker, + t.contract_address AS project_contract_address, + t.tx_hash, + tx."from" AS tx_from, + tx.to AS tx_to, + t.trace_address, + t.evt_index +FROM (SELECT * FROM bebop_single_trade UNION ALL SELECT * FROM bebop_multi_and_aggregate_trades) t +INNER JOIN +{{ source('ethereum', 'transactions')}} tx + ON t.tx_hash = tx.hash + {% if not is_incremental() %} + AND tx.block_time >= TIMESTAMP '{{project_start_date}}' + {% endif %} + {% if is_incremental() %} + AND {{ incremental_predicate('tx.block_time') }} + {% endif %} + LEFT JOIN + {{ source('tokens', 'erc20') }} t_bought + ON t_bought.contract_address = t.maker_token_address + AND t_bought.blockchain = 'ethereum' + LEFT JOIN + {{ source('tokens', 'erc20') }} t_sold + ON t_sold.contract_address = t.taker_token_address + AND t_sold.blockchain = 'ethereum' + LEFT JOIN + {{ source('prices', 'usd') }} p_bought + ON p_bought.minute = date_trunc('minute', t.block_time) + AND p_bought.contract_address = t.maker_token_address + AND p_bought.blockchain = 'ethereum' + {% if not is_incremental() %} + AND p_bought.minute >= TIMESTAMP '{{project_start_date}}' + {% endif %} + {% if is_incremental() %} + AND {{ incremental_predicate('p_bought.minute') }} + {% endif %} + LEFT JOIN + {{ source('prices', 'usd') }} p_sold + ON p_sold.minute = date_trunc('minute', t.block_time) + AND p_sold.contract_address = t.taker_token_address + AND p_sold.blockchain = 'ethereum' + {% if not is_incremental() %} + AND p_sold.minute >= TIMESTAMP '{{project_start_date}}' + {% endif %} + {% if is_incremental() %} + AND {{ incremental_predicate('p_sold.minute') }} + {% endif %} \ No newline at end of file diff --git a/models/bebop/ethereum/bebop_ethereum_schema.yml b/models/bebop/ethereum/bebop_ethereum_schema.yml index 37b42c28860..7a1b88751cb 100644 --- a/models/bebop/ethereum/bebop_ethereum_schema.yml +++ b/models/bebop/ethereum/bebop_ethereum_schema.yml @@ -151,6 +151,56 @@ models: - *block_month - *trade_type + - name: bebop_blend_ethereum_trades + meta: + blockchain: ethereum + sector: dex + project: bebop + contributors: alekss + config: + tags: [ 'ethereum','bebop','pmm','trades','dex', 'blend' ] + description: Bebop-BLEND contract trades on ethereum - formatted for dex.trades + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - block_date + - blockchain + - project + - version + - tx_hash + - evt_index + - trace_address + - check_dex_aggregator_seed: + blockchain: ethereum + project: bebop + version: blend + columns: + - *blockchain + - *project + - *version + - *block_date + - *block_time + - *token_bought_symbol + - *token_sold_symbol + - *token_pair + - *token_bought_amount + - *token_sold_amount + - *token_bought_amount_raw + - *token_sold_amount_raw + - *amount_usd + - *token_bought_address + - *token_sold_address + - *taker + - *maker + - *project_contract_address + - *tx_hash + - *tx_from + - *tx_to + - *trace_address + - *evt_index + - *block_month + - *trade_type + - name: bebop_ethereum_trades meta: blockchain: ethereum diff --git a/models/bebop/ethereum/bebop_ethereum_trades.sql b/models/bebop/ethereum/bebop_ethereum_trades.sql index 4b3ba673d41..487eefdff4a 100644 --- a/models/bebop/ethereum/bebop_ethereum_trades.sql +++ b/models/bebop/ethereum/bebop_ethereum_trades.sql @@ -1,17 +1,18 @@ {{ config( schema = 'bebop_ethereum', alias = 'trades', - post_hook='{{ expose_spells(\'["ethereum"]\', - "project", - "bebop", - \'["alekss"]\') }}' - ) -}} + materialized = 'view', + post_hook='{{ expose_spells(blockchains = \'["ethereum"]\', + spell_type = "project", + spell_name = "bebop", + contributors = \'["alekss"]\') }}' +)}} {% set bebop_models = [ ref('bebop_rfq_ethereum_trades'), - ref('bebop_jam_ethereum_trades') + ref('bebop_jam_ethereum_trades'), + ref('bebop_blend_ethereum_trades') ] %} SELECT * diff --git a/models/bebop/ethereum/bebop_jam_ethereum_trades.sql b/models/bebop/ethereum/bebop_jam_ethereum_trades.sql index 998c8ac7a41..c11112e19f3 100644 --- a/models/bebop/ethereum/bebop_jam_ethereum_trades.sql +++ b/models/bebop/ethereum/bebop_jam_ethereum_trades.sql @@ -46,7 +46,7 @@ bebop_jam_raw_data AS ( ON ex.call_tx_hash = evt.evt_tx_hash and ex.row_num = evt.row_num WHERE ex.call_success = TRUE {% if is_incremental() %} - AND evt.evt_block_time >= date_trunc('day', now() - interval '7' Day) + AND {{ incremental_predicate('evt.evt_block_time') }} {% endif %} ), @@ -174,7 +174,7 @@ INNER JOIN AND tx.block_time >= TIMESTAMP '{{project_start_date}}' {% endif %} {% if is_incremental() %} - AND tx.block_time >= date_trunc('day', now() - interval '7' Day) + AND {{ incremental_predicate('tx.block_time') }} {% endif %} LEFT JOIN {{ source('tokens', 'erc20') }} t_bought @@ -193,7 +193,7 @@ INNER JOIN AND p_bought.minute >= TIMESTAMP '{{project_start_date}}' {% endif %} {% if is_incremental() %} - AND p_bought.minute >= date_trunc('day', now() - interval '7' Day) + AND {{ incremental_predicate('p_bought.minute') }} {% endif %} LEFT JOIN {{ source('prices', 'usd') }} p_sold @@ -204,5 +204,5 @@ INNER JOIN AND p_sold.minute >= TIMESTAMP '{{project_start_date}}' {% endif %} {% if is_incremental() %} - AND p_sold.minute >= date_trunc('day', now() - interval '7' Day) + AND {{ incremental_predicate('p_sold.minute') }} {% endif %} \ No newline at end of file diff --git a/models/bebop/ethereum/bebop_rfq_ethereum_trades.sql b/models/bebop/ethereum/bebop_rfq_ethereum_trades.sql index 2b6cb18b4e1..991f8fc07b4 100644 --- a/models/bebop/ethereum/bebop_rfq_ethereum_trades.sql +++ b/models/bebop/ethereum/bebop_rfq_ethereum_trades.sql @@ -55,7 +55,7 @@ bebop_raw_data AS ( ON ex.call_tx_hash = evt.evt_tx_hash and ex.row_num = evt.row_num WHERE ex.call_success = TRUE {% if is_incremental() %} - AND evt.evt_block_time >= date_trunc('day', now() - interval '7' Day) + AND {{ incremental_predicate('evt.evt_block_time') }} {% endif %} ), @@ -192,7 +192,7 @@ INNER JOIN AND tx.block_time >= TIMESTAMP '{{project_start_date}}' {% endif %} {% if is_incremental() %} - AND tx.block_time >= date_trunc('day', now() - interval '7' Day) + AND {{ incremental_predicate('tx.block_time') }} {% endif %} LEFT JOIN {{ source('tokens', 'erc20') }} t_bought @@ -211,7 +211,7 @@ INNER JOIN AND p_bought.minute >= TIMESTAMP '{{project_start_date}}' {% endif %} {% if is_incremental() %} - AND p_bought.minute >= date_trunc('day', now() - interval '7' Day) + AND {{ incremental_predicate('p_bought.minute') }} {% endif %} LEFT JOIN {{ source('prices', 'usd') }} p_sold @@ -222,5 +222,5 @@ INNER JOIN AND p_sold.minute >= TIMESTAMP '{{project_start_date}}' {% endif %} {% if is_incremental() %} - AND p_sold.minute >= date_trunc('day', now() - interval '7' Day) + AND {{ incremental_predicate('p_sold.minute') }} {% endif %} \ No newline at end of file diff --git a/models/bebop/optimism/bebop_jam_optimism_trades.sql b/models/bebop/optimism/bebop_jam_optimism_trades.sql new file mode 100644 index 00000000000..205d15b4922 --- /dev/null +++ b/models/bebop/optimism/bebop_jam_optimism_trades.sql @@ -0,0 +1,208 @@ +{{ config( + schema = 'bebop_jam_optimism', + alias = 'trades', + partition_by = ['block_month'], + materialized = 'incremental', + file_format = 'delta', + incremental_strategy = 'merge', + unique_key = ['block_date', 'blockchain', 'project', 'version', 'tx_hash', 'evt_index', 'trace_address'] +)}} + +{% set project_start_date = '2024-02-25' %} + +WITH + +bebop_jam_raw_data AS ( + SELECT + call_block_time AS block_time, + call_block_number AS block_number, + call_tx_hash AS tx_hash, + evt_index, + ex.contract_address, + JSON_EXTRACT_SCALAR(ex."order", '$.expiry') AS expiry, + from_hex(JSON_EXTRACT_SCALAR(ex."order", '$.taker')) as taker_address, + (CAST(JSON_EXTRACT(ex."order", '$.sellTokens') AS ARRAY)) AS taker_tokens_raw, + (CAST(JSON_EXTRACT(ex."order", '$.buyTokens') AS ARRAY)) AS maker_tokens_raw, + (CAST(JSON_EXTRACT(ex."order", '$.sellAmounts') AS ARRAY)) AS taker_amounts_raw, + (CAST(JSON_EXTRACT(ex."order", '$.buyAmounts') AS ARRAY)) AS maker_amounts_raw, + json_array_length(JSON_EXTRACT(ex."order", '$.sellTokens')) as taker_length, + json_array_length(JSON_EXTRACT(ex."order", '$.buyTokens')) as maker_length + FROM + (SELECT + evt_index, evt_tx_hash, evt_block_time, ROW_NUMBER() OVER (PARTITION BY evt_tx_hash ORDER BY evt_index) AS row_num + FROM {{ source('bebop_jam_optimism', 'JamSettlement_evt_Settlement') }} + ) evt + LEFT JOIN + (SELECT + call_success, call_block_time, call_block_number, call_tx_hash, contract_address, "order", + ROW_NUMBER() OVER (PARTITION BY call_tx_hash ORDER BY call_block_number) AS row_num + FROM {{ source('bebop_jam_optimism', 'JamSettlement_call_settle') }} + UNION ALL + SELECT + call_success, call_block_time, call_block_number, call_tx_hash, contract_address, "order", + ROW_NUMBER() OVER (PARTITION BY call_tx_hash ORDER BY call_block_number) AS row_num + FROM {{ source('bebop_jam_optimism', 'JamSettlement_call_settleWithPermitsSignatures') }} + ) ex + ON ex.call_tx_hash = evt.evt_tx_hash and ex.row_num = evt.row_num + WHERE ex.call_success = TRUE + {% if is_incremental() %} + AND {{ incremental_predicate('evt.evt_block_time') }} + {% endif %} +), + +jam_unnested_array_taker AS ( + SELECT + block_time, + block_number, + tx_hash, + evt_index, + contract_address, + expiry, + taker_address, + maker_tokens_raw, + maker_amounts_raw, + taker_length, + maker_length, + element_at(taker_tokens_raw, sequence_number) AS taker_token_address, + element_at(taker_amounts_raw, sequence_number) AS taker_token_amounts, + sequence_number - 1 AS taker_index + FROM bebop_jam_raw_data + CROSS JOIN UNNEST(sequence(1, taker_length)) AS t(sequence_number) +), + +jam_unnested_array_maker AS ( + SELECT + block_time, + block_number, + tx_hash, + evt_index, + contract_address, + expiry, + taker_address, + taker_token_address, + taker_token_amounts, + taker_index, + taker_length, + maker_length, + element_at(maker_tokens_raw, sequence_number) AS maker_token_address, + element_at(maker_amounts_raw, sequence_number) AS maker_token_amounts, + sequence_number - 1 AS maker_index + FROM jam_unnested_array_taker + CROSS JOIN UNNEST(sequence(1, maker_length)) AS t(sequence_number) +), + +jam_simple_trades as ( + SELECT + block_time, + block_number, + contract_address, + tx_hash, + evt_index, + taker_address, + taker_length, + maker_length, + CASE + WHEN taker_length = 1 AND maker_length > 1 THEN CAST(array[taker_index, maker_index] as array) + WHEN maker_length = 1 AND taker_length > 1 THEN CAST(array[maker_index, taker_index] as array) + ELSE CAST(array[taker_index, maker_index] as array) + END as trace_address, + CASE + WHEN taker_length = 1 AND maker_length > 1 THEN 'Multi-Buy' + WHEN maker_length = 1 AND taker_length > 1 THEN 'Multi-Sell' + ELSE 'Simple-Swap' + END as trade_type, + from_hex(maker_token_address) as token_bought_address, + from_hex(taker_token_address) as token_sold_address, + CAST(maker_token_amounts as UINT256) as token_bought_amount_raw, + CAST(maker_token_amounts as double) as token_bought_amount, + CAST(taker_token_amounts as UINT256) as token_sold_amount_raw, + CAST(taker_token_amounts as double) as token_sold_amount + FROM + jam_unnested_array_maker + WHERE maker_token_address IS NOT NULL + AND taker_token_address IS NOT NULL +) + +SELECT + 'optimism' AS blockchain, + 'bebop' AS project, + 'jam' AS version, + CAST(date_trunc('DAY', t.block_time) AS date) AS block_date, + CAST(date_trunc('MONTH', t.block_time) AS date) AS block_month, + t.block_time AS block_time, + t.trade_type, + t_bought.symbol AS token_bought_symbol, + t_sold.symbol AS token_sold_symbol, + CASE + WHEN lower(t_bought.symbol) > lower(t_sold.symbol) THEN concat(t_sold.symbol, '-', t_bought.symbol) + ELSE concat(t_bought.symbol, '-', t_sold.symbol) + END AS token_pair, + t.token_bought_amount / power(10, coalesce(t_bought.decimals, 0)) AS token_bought_amount, + t.token_sold_amount / power(10, coalesce(t_sold.decimals, 0)) AS token_sold_amount, + t.token_bought_amount_raw, + t.token_sold_amount_raw, + CASE + WHEN t.trade_type = 'Multi-Buy' THEN COALESCE( + (t.token_bought_amount / power(10, t_bought.decimals)) * p_bought.price, + (t.token_sold_amount / power(10, t_sold.decimals)) * p_sold.price / maker_length + ) + WHEN t.trade_type = 'Multi-Sell' THEN COALESCE( + (t.token_sold_amount / power(10, t_sold.decimals)) * p_sold.price, + (t.token_bought_amount / power(10, t_bought.decimals)) * p_bought.price / taker_length + ) + ELSE COALESCE( + (t.token_bought_amount / power(10, t_bought.decimals)) * p_bought.price, + (t.token_sold_amount / power(10, t_sold.decimals)) * p_sold.price + ) + END as amount_usd, -- when there's a Multi-trade, the usd value of the multi tokens traded is used as the amount_usd + t.token_bought_address, + t.token_sold_address, + t.taker_address AS taker, + t.contract_address AS maker, + t.contract_address AS project_contract_address, + t.tx_hash, + tx."from" tx_from, + tx.to AS tx_to, + t.trace_address, + t.evt_index +FROM +jam_simple_trades t +INNER JOIN +{{ source('optimism', 'transactions')}} tx + ON t.tx_hash = tx.hash + {% if not is_incremental() %} + AND tx.block_time >= TIMESTAMP '{{project_start_date}}' + {% endif %} + {% if is_incremental() %} + AND {{ incremental_predicate('tx.block_time') }} + {% endif %} + LEFT JOIN + {{ source('tokens', 'erc20') }} t_bought + ON t_bought.contract_address = t.token_bought_address + AND t_bought.blockchain = 'optimism' + LEFT JOIN + {{ source('tokens', 'erc20') }} t_sold + ON t_sold.contract_address = t.token_sold_address + AND t_sold.blockchain = 'optimism' + LEFT JOIN + {{ source('prices', 'usd') }} p_bought + ON p_bought.minute = date_trunc('minute', t.block_time) + AND p_bought.contract_address = t.token_bought_address + AND p_bought.blockchain = 'optimism' + {% if not is_incremental() %} + AND p_bought.minute >= TIMESTAMP '{{project_start_date}}' + {% endif %} + {% if is_incremental() %} + AND {{ incremental_predicate('p_bought.minute') }} + {% endif %} + LEFT JOIN + {{ source('prices', 'usd') }} p_sold + ON p_sold.minute = date_trunc('minute', t.block_time) + AND p_sold.contract_address = t.token_sold_address + AND p_sold.blockchain = 'optimism' + {% if not is_incremental() %} + AND p_sold.minute >= TIMESTAMP '{{project_start_date}}' + {% endif %} + {% if is_incremental() %} + AND {{ incremental_predicate('p_sold.minute') }} + {% endif %} \ No newline at end of file diff --git a/models/bebop/optimism/bebop_optimism_schema.yml b/models/bebop/optimism/bebop_optimism_schema.yml new file mode 100644 index 00000000000..653b4ada9a2 --- /dev/null +++ b/models/bebop/optimism/bebop_optimism_schema.yml @@ -0,0 +1,188 @@ +version: 2 + +models: + - name: bebop_rfq_optimism_trades + meta: + blockchain: optimism + sector: dex + project: bebop + contributors: alekss + config: + tags: [ 'optimism','bebop','rfq','trades','dex' ] + description: Bebop-RFQ contract trades on optimism - formatted for dex.trades + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - block_date + - blockchain + - project + - version + - tx_hash + - evt_index + - trace_address + - check_dex_aggregator_seed: + blockchain: optimism + project: bebop + version: 2 + columns: + - &blockchain + name: blockchain + description: "Blockchain which the DEX is deployed" + - &project + name: project + description: "Project name of the DEX" + - &version + name: version + description: "Version of the contract built and deployed by the DEX project" + - &block_date + name: block_date + description: "UTC event block date of each DEX trade" + - &block_time + name: block_time + description: "UTC event block time of each DEX trade" + - &token_bought_symbol + name: token_bought_symbol + description: "Token symbol for token bought in the transaction" + - &token_sold_symbol + name: token_sold_symbol + description: "Token symbol for token sold in the transaction" + - &token_pair + name: token_pair + description: "Token symbol pair for each token involved in the transaction" + - &token_bought_amount + name: token_bought_amount + description: "Value of the token bought at time of execution in the original currency" + - &token_sold_amount + name: token_sold_amount + description: "Value of the token sold at time of execution in the original currency" + - &token_bought_amount_raw + name: token_bought_amount_raw + description: "Raw value of the token bought at time of execution in the original currency" + - &token_sold_amount_raw + name: token_sold_amount_raw + description: "Raw value of the token sold at time of execution in the original currency" + - &amount_usd + name: amount_usd + description: "USD value of the trade at time of execution" + - &token_bought_address + name: token_bought_address + description: "Contract address of the token bought" + - &token_sold_address + name: token_sold_address + description: "Contract address of the token sold" + - &taker + name: taker + description: "Address of trader who purchased a token" + - &maker + name: maker + description: "Address of trader who sold a token" + - &project_contract_address + name: project_contract_address + description: "Project contract address which executed the trade on the blockchain" + - &tx_hash + name: tx_hash + description: "Unique transaction hash value tied to each transaction on the DEX" + - &tx_from + name: tx_from + description: "Address which initiated the transaction" + - &tx_to + name: tx_to + description: "Address which received the transaction" + - &trace_address + name: trace_address + description: "" + - &evt_index + name: evt_index + description: "" + - &block_month + name: block_month + description: "UTC event block month of each DEX trade" + - &trade_type + name: trade_type + description: "Trade classification (Multi-buy, Multi-sell or Simple-swap)" + + - name: bebop_jam_optimism_trades + meta: + blockchain: optimism + sector: dex + project: bebop + contributors: alekss + config: + tags: [ 'optimism','bebop','jam','trades','dex' ] + description: Bebop-JAM contract trades on optimism - formatted for dex.trades + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - block_date + - blockchain + - project + - version + - tx_hash + - evt_index + - trace_address + - check_dex_aggregator_seed: + blockchain: optimism + project: bebop + version: jam + columns: + - *blockchain + - *project + - *version + - *block_date + - *block_time + - *token_bought_symbol + - *token_sold_symbol + - *token_pair + - *token_bought_amount + - *token_sold_amount + - *token_bought_amount_raw + - *token_sold_amount_raw + - *amount_usd + - *token_bought_address + - *token_sold_address + - *taker + - *maker + - *project_contract_address + - *tx_hash + - *tx_from + - *tx_to + - *trace_address + - *evt_index + - *block_month + - *trade_type + + - name: bebop_optimism_trades + meta: + blockchain: optimism + sector: dex + project: bebop + contributors: alekss + config: + tags: [ 'optimism','bebop','trades','dex' ] + description: Bebop contract trades on optimism - formatted for dex.trades + columns: + - *blockchain + - *project + - *version + - *block_date + - *block_time + - *token_bought_symbol + - *token_sold_symbol + - *token_pair + - *token_bought_amount + - *token_sold_amount + - *token_bought_amount_raw + - *token_sold_amount_raw + - *amount_usd + - *token_bought_address + - *token_sold_address + - *taker + - *maker + - *project_contract_address + - *tx_hash + - *tx_from + - *tx_to + - *trace_address + - *evt_index + - *block_month + - *trade_type diff --git a/models/bebop/optimism/bebop_optimism_trades.sql b/models/bebop/optimism/bebop_optimism_trades.sql new file mode 100644 index 00000000000..a4d32a4d25b --- /dev/null +++ b/models/bebop/optimism/bebop_optimism_trades.sql @@ -0,0 +1,51 @@ +{{ config( + schema = 'bebop_optimism', + alias = 'trades', + materialized = 'view', + post_hook='{{ expose_spells(blockchains = \'["optimism"]\', + spell_type = "project", + spell_name = "bebop", + contributors = \'["alekss"]\') }}' +)}} + + +{% set bebop_models = [ + ref('bebop_rfq_optimism_trades'), + ref('bebop_jam_optimism_trades') +] %} + +SELECT * +FROM ( + {% for dex_model in bebop_models %} + SELECT + blockchain, + project, + version, + block_month, + block_date, + block_time, + trade_type, + token_bought_symbol, + token_sold_symbol, + token_pair, + token_bought_amount, + token_sold_amount, + token_bought_amount_raw, + token_sold_amount_raw, + amount_usd, + token_bought_address, + token_sold_address, + taker, + maker, + project_contract_address, + tx_hash, + tx_from, + tx_to, + trace_address, + evt_index + FROM {{ dex_model }} + {% if not loop.last %} + UNION ALL + {% endif %} + {% endfor %} +) diff --git a/models/bebop/optimism/bebop_rfq_optimism_trades.sql b/models/bebop/optimism/bebop_rfq_optimism_trades.sql new file mode 100644 index 00000000000..7aa27dfd878 --- /dev/null +++ b/models/bebop/optimism/bebop_rfq_optimism_trades.sql @@ -0,0 +1,219 @@ +{{ config( + schema = 'bebop_rfq_optimism', + alias = 'trades', + partition_by = ['block_month'], + materialized = 'incremental', + file_format = 'delta', + incremental_strategy = 'merge', + unique_key = ['block_date', 'blockchain', 'project', 'version', 'tx_hash', 'evt_index', 'trace_address'] +)}} + +{% set project_start_date = '2023-02-22' %} + +WITH + +bebop_raw_data AS ( + SELECT + call_block_time AS block_time, + call_block_number AS block_number, + call_tx_hash AS tx_hash, + evt_index, + ex.contract_address, + JSON_EXTRACT_SCALAR(ex."order", '$.expiry') AS expiry, + from_hex(JSON_EXTRACT_SCALAR(ex."order", '$.taker_address')) as taker_address, + from_hex(JSON_EXTRACT_SCALAR(JSON_EXTRACT(ex."order", '$.maker_addresses'), '$[0]')) AS maker_address, + JSON_EXTRACT(ex."order", '$.taker_tokens') AS taker_tokens_json, + JSON_EXTRACT(ex."order", '$.maker_tokens') AS maker_tokens_json, + JSON_EXTRACT(ex."order", '$.taker_amounts') AS taker_amounts_json, + JSON_EXTRACT(ex."order", '$.maker_amounts') AS maker_amounts_json, + json_array_length(json_extract((JSON_EXTRACT(ex."order", '$.taker_tokens')), '$[0]')) as taker_length, + json_array_length(json_extract((JSON_EXTRACT(ex."order", '$.maker_tokens')), '$[0]')) as maker_length + FROM + ( + SELECT + evt_index, evt_tx_hash, evt_block_time, ROW_NUMBER() OVER (PARTITION BY evt_tx_hash ORDER BY evt_index) AS row_num + FROM {{ source('bebop_v4_optimism', 'BebopSettlement_evt_AggregateOrderExecuted') }}) evt + LEFT JOIN + ( + SELECT + call_success, call_block_time, call_block_number, call_tx_hash, contract_address, "order", + ROW_NUMBER() OVER (PARTITION BY call_tx_hash ORDER BY call_block_number) AS row_num + FROM {{ source('bebop_v4_optimism', 'BebopSettlement_call_SettleAggregateOrder') }} + UNION ALL + SELECT + call_success, call_block_time, call_block_number, call_tx_hash, contract_address, "order", + ROW_NUMBER() OVER (PARTITION BY call_tx_hash ORDER BY call_block_number) AS row_num + FROM {{ source('bebop_v4_optimism', 'BebopSettlement_call_SettleAggregateOrderWithTakerPermits') }} + ) ex + ON ex.call_tx_hash = evt.evt_tx_hash and ex.row_num = evt.row_num + WHERE ex.call_success = TRUE + {% if is_incremental() %} + AND {{ incremental_predicate('evt.evt_block_time') }} + {% endif %} +), + +unnested_array_taker AS ( + SELECT + block_time, + block_number, + tx_hash, + evt_index, + contract_address, + expiry, + taker_address, + maker_address, + taker_tokens_json, + maker_tokens_json, + taker_amounts_json, + maker_amounts_json, + taker_length, + maker_length, + element_at(CAST(json_extract(taker_tokens_json, '$[0]') AS ARRAY), sequence_number) AS taker_token_address, + element_at(CAST(json_extract(taker_amounts_json, '$[0]') AS ARRAY), sequence_number) AS taker_token_amounts, + sequence_number - 1 AS taker_index + FROM bebop_raw_data + CROSS JOIN UNNEST(sequence(1, json_array_length(json_extract(taker_tokens_json, '$[0]')))) AS t(sequence_number) +), + +unnested_array_maker AS ( + SELECT + block_time, + block_number, + tx_hash, + evt_index, + contract_address, + expiry, + taker_address, + maker_address, + taker_tokens_json, + maker_tokens_json, + taker_amounts_json, + maker_amounts_json, + taker_token_address, + taker_token_amounts, + taker_index, + taker_length, + maker_length, + element_at(CAST(json_extract(maker_tokens_json, '$[0]') AS ARRAY), sequence_number) AS maker_token_address, + element_at(CAST(json_extract(maker_amounts_json, '$[0]') AS ARRAY), sequence_number) AS maker_token_amounts, + sequence_number - 1 AS maker_index + FROM unnested_array_taker + CROSS JOIN UNNEST(sequence(1, json_array_length(json_extract(maker_tokens_json, '$[0]')))) AS t(sequence_number) +), + +simple_trades as ( + SELECT + block_time, + block_number, + contract_address, + tx_hash, + evt_index, + taker_address, + maker_address, + taker_length, + maker_length, + CASE + WHEN taker_length = 1 AND maker_length > 1 THEN CAST(array[taker_index, maker_index] as array) + WHEN maker_length = 1 AND taker_length > 1 THEN CAST(array[maker_index, taker_index] as array) + ELSE CAST(array[taker_index, maker_index] as array) + END as trace_address, + CASE + WHEN taker_length = 1 AND maker_length > 1 THEN 'Multi-Buy' -- inverted + WHEN maker_length = 1 AND taker_length > 1 THEN 'Multi-Sell' -- inverted, noted below... + ELSE 'Simple-Swap' + END as trade_type, + from_hex(maker_token_address) as token_bought_address, -- for some weird reason, this is inverted, based on the spark version of this query & also on arbiscan + from_hex(taker_token_address) as token_sold_address, -- noted above + CAST(maker_token_amounts as UINT256) as token_bought_amount_raw, + CAST(maker_token_amounts as double) as token_bought_amount, + CAST(taker_token_amounts as UINT256) as token_sold_amount_raw, + CAST(taker_token_amounts as double) as token_sold_amount + FROM + unnested_array_maker + WHERE maker_token_address IS NOT NULL + AND taker_token_address IS NOT NULL +) + +SELECT + 'optimism' AS blockchain, + 'bebop' AS project, + '2' AS version, + CAST(date_trunc('DAY', t.block_time) AS date) AS block_date, + CAST(date_trunc('MONTH', t.block_time) AS date) AS block_month, + t.block_time AS block_time, + t.trade_type, + t_bought.symbol AS token_bought_symbol, + t_sold.symbol AS token_sold_symbol, + CASE + WHEN lower(t_bought.symbol) > lower(t_sold.symbol) THEN concat(t_sold.symbol, '-', t_bought.symbol) + ELSE concat(t_bought.symbol, '-', t_sold.symbol) + END AS token_pair, + t.token_bought_amount / power(10, coalesce(t_bought.decimals, 0)) AS token_bought_amount, + t.token_sold_amount / power(10, coalesce(t_sold.decimals, 0)) AS token_sold_amount, + t.token_bought_amount_raw, + t.token_sold_amount_raw, + CASE + WHEN t.trade_type = 'Multi-Buy' THEN COALESCE( + (t.token_bought_amount / power(10, t_bought.decimals)) * p_bought.price, + (t.token_sold_amount / power(10, t_sold.decimals)) * p_sold.price / maker_length + ) + WHEN t.trade_type = 'Multi-Sell' THEN COALESCE( + (t.token_sold_amount / power(10, t_sold.decimals)) * p_sold.price, + (t.token_bought_amount / power(10, t_bought.decimals)) * p_bought.price / taker_length + ) + ELSE COALESCE( + (t.token_bought_amount / power(10, t_bought.decimals)) * p_bought.price, + (t.token_sold_amount / power(10, t_sold.decimals)) * p_sold.price + ) + END as amount_usd, -- when there's a Multi-trade, the usd value of the multi tokens traded is used as the amount_usd + t.token_bought_address, + t.token_sold_address, + t.taker_address AS taker, + t.contract_address AS maker, + t.contract_address AS project_contract_address, + t.tx_hash, + tx."from" tx_from, + tx.to AS tx_to, + t.trace_address, + t.evt_index +FROM +simple_trades t +INNER JOIN +{{ source('optimism', 'transactions')}} tx + ON t.tx_hash = tx.hash + {% if not is_incremental() %} + AND tx.block_time >= TIMESTAMP '{{project_start_date}}' + {% endif %} + {% if is_incremental() %} + AND {{ incremental_predicate('tx.block_time') }} + {% endif %} + LEFT JOIN + {{ source('tokens', 'erc20') }} t_bought + ON t_bought.contract_address = t.token_bought_address + AND t_bought.blockchain = 'optimism' + LEFT JOIN + {{ source('tokens', 'erc20') }} t_sold + ON t_sold.contract_address = t.token_sold_address + AND t_sold.blockchain = 'optimism' + LEFT JOIN + {{ source('prices', 'usd') }} p_bought + ON p_bought.minute = date_trunc('minute', t.block_time) + AND p_bought.contract_address = t.token_bought_address + AND p_bought.blockchain = 'optimism' + {% if not is_incremental() %} + AND p_bought.minute >= TIMESTAMP '{{project_start_date}}' + {% endif %} + {% if is_incremental() %} + AND {{ incremental_predicate('p_bought.minute') }} + {% endif %} + LEFT JOIN + {{ source('prices', 'usd') }} p_sold + ON p_sold.minute = date_trunc('minute', t.block_time) + AND p_sold.contract_address = t.token_sold_address + AND p_sold.blockchain = 'optimism' + {% if not is_incremental() %} + AND p_sold.minute >= TIMESTAMP '{{project_start_date}}' + {% endif %} + {% if is_incremental() %} + AND {{ incremental_predicate('p_sold.minute') }} + {% endif %} \ No newline at end of file diff --git a/models/bebop/polygon/bebop_blend_polygon_trades.sql b/models/bebop/polygon/bebop_blend_polygon_trades.sql new file mode 100644 index 00000000000..19f6cc54ff6 --- /dev/null +++ b/models/bebop/polygon/bebop_blend_polygon_trades.sql @@ -0,0 +1,304 @@ +{{ config( + schema = 'bebop_blend_polygon', + alias = 'trades', + partition_by = ['block_month'], + materialized = 'incremental', + file_format = 'delta', + incremental_strategy = 'merge', + unique_key = ['block_date', 'blockchain', 'project', 'version', 'tx_hash', 'evt_index', 'trace_address'] +)}} + +{% set project_start_date = '2024-04-23' %} + +WITH + + +bebop_single_trade AS ( + SELECT + call_block_time AS block_time, + call_block_number AS block_number, + call_tx_hash AS tx_hash, + evt_index, + ex.contract_address, + from_hex(JSON_EXTRACT_SCALAR(ex."order", '$.taker_address')) as taker_address, + from_hex(JSON_EXTRACT_SCALAR(ex."order", '$.maker_address')) as maker_address, + from_hex(JSON_EXTRACT_SCALAR(ex."order", '$.taker_token')) AS taker_token_address, + from_hex(JSON_EXTRACT_SCALAR(ex."order", '$.maker_token')) AS maker_token_address, + JSON_EXTRACT_SCALAR(ex."order", '$.taker_amount') AS taker_token_amount, + JSON_EXTRACT_SCALAR(ex."order", '$.maker_amount') AS maker_token_amount, + 'Simple-Swap' as trade_type, + cast(array[0, 0, 0] as array) as trace_address + FROM + (SELECT + evt_index, evt_tx_hash, evt_block_time, ROW_NUMBER() OVER (PARTITION BY evt_tx_hash ORDER BY evt_index) AS row_num + FROM {{ source('bebop_pmms_polygon', 'BebopSettlement_evt_BebopOrder') }}) evt + LEFT JOIN + (SELECT + call_success, call_block_time, call_block_number, call_tx_hash, contract_address, "order", + ROW_NUMBER() OVER (PARTITION BY call_tx_hash ORDER BY call_block_number) AS row_num + FROM {{ source('bebop_pmms_polygon', 'BebopSettlement_call_settleSingle') }} + UNION ALL + SELECT + call_success, call_block_time, call_block_number, call_tx_hash, contract_address, "order", + ROW_NUMBER() OVER (PARTITION BY call_tx_hash ORDER BY call_block_number) AS row_num + FROM {{ source('bebop_pmms_polygon', 'BebopSettlement_call_settleSingleAndSignPermit') }} + UNION ALL + SELECT + call_success, call_block_time, call_block_number, call_tx_hash, contract_address, "order", + ROW_NUMBER() OVER (PARTITION BY call_tx_hash ORDER BY call_block_number) AS row_num + FROM {{ source('bebop_pmms_polygon', 'BebopSettlement_call_settleSingleAndSignPermit2') }} + UNION ALL + SELECT + call_success, call_block_time, call_block_number, call_tx_hash, contract_address, "order", + ROW_NUMBER() OVER (PARTITION BY call_tx_hash ORDER BY call_block_number) AS row_num + FROM {{ source('bebop_pmms_polygon', 'BebopSettlement_call_swapSingle') }} + UNION ALL + SELECT + call_success, call_block_time, call_block_number, call_tx_hash, contract_address, "order", + ROW_NUMBER() OVER (PARTITION BY call_tx_hash ORDER BY call_block_number) AS row_num + FROM {{ source('bebop_pmms_polygon', 'BebopSettlement_call_swapSingleFromContract') }} + ) ex + ON ex.call_tx_hash = evt.evt_tx_hash and ex.row_num = evt.row_num + WHERE ex.call_success = TRUE + {% if is_incremental() %} + AND {{ incremental_predicate('evt.evt_block_time') }} + {% endif %} +), +raw_bebop_multi_trade AS ( + SELECT + call_block_time AS block_time, + call_block_number AS block_number, + call_tx_hash AS tx_hash, + evt_index, + ex.contract_address, + from_hex(JSON_EXTRACT_SCALAR(ex."order", '$.taker_address')) as taker_address, + from_hex(JSON_EXTRACT_SCALAR(ex."order", '$.maker_address')) as maker_address, + CAST(JSON_EXTRACT(ex."order", '$.taker_tokens') AS ARRAY) AS taker_tokens, + CAST(JSON_EXTRACT(ex."order", '$.maker_tokens') AS ARRAY) AS maker_tokens, + CAST(JSON_EXTRACT(ex."order", '$.taker_amounts') AS ARRAY) AS taker_amounts, + CAST(JSON_EXTRACT(ex."order", '$.maker_amounts') AS ARRAY) AS maker_amounts, + json_array_length(JSON_EXTRACT(ex."order", '$.taker_amounts')) as taker_tokens_len, + json_array_length(JSON_EXTRACT(ex."order", '$.maker_amounts')) as maker_tokens_len, + 0 as order_index + FROM + (SELECT + evt_index, evt_tx_hash, evt_block_time, ROW_NUMBER() OVER (PARTITION BY evt_tx_hash ORDER BY evt_index) AS row_num + FROM {{ source('bebop_pmms_polygon', 'BebopSettlement_evt_BebopOrder') }}) evt + LEFT JOIN + (SELECT + call_success, call_block_time, call_block_number, call_tx_hash, contract_address, "order", + ROW_NUMBER() OVER (PARTITION BY call_tx_hash ORDER BY call_block_number) AS row_num + FROM {{ source('bebop_pmms_polygon', 'BebopSettlement_call_settleMulti') }} + UNION ALL + SELECT + call_success, call_block_time, call_block_number, call_tx_hash, contract_address, "order", + ROW_NUMBER() OVER (PARTITION BY call_tx_hash ORDER BY call_block_number) AS row_num + FROM {{ source('bebop_pmms_polygon', 'BebopSettlement_call_settleMultiAndSignPermit') }} + UNION ALL + SELECT + call_success, call_block_time, call_block_number, call_tx_hash, contract_address, "order", + ROW_NUMBER() OVER (PARTITION BY call_tx_hash ORDER BY call_block_number) AS row_num + FROM {{ source('bebop_pmms_polygon', 'BebopSettlement_call_settleMultiAndSignPermit2') }} + UNION ALL + SELECT + call_success, call_block_time, call_block_number, call_tx_hash, contract_address, "order", + ROW_NUMBER() OVER (PARTITION BY call_tx_hash ORDER BY call_block_number) AS row_num + FROM {{ source('bebop_pmms_polygon', 'BebopSettlement_call_swapMulti') }} + ) ex + ON ex.call_tx_hash = evt.evt_tx_hash and ex.row_num = evt.row_num + WHERE ex.call_success = TRUE + {% if is_incremental() %} + AND {{ incremental_predicate('evt.evt_block_time') }} + {% endif %} +), + +raw_bebop_aggregate_trade AS ( + SELECT + call_block_time AS block_time, + call_block_number AS block_number, + call_tx_hash AS tx_hash, + evt_index, + ex.contract_address, + from_hex(JSON_EXTRACT_SCALAR(ex."order", '$.taker_address')) as taker_address, + CAST(JSON_EXTRACT(ex."order", '$.maker_addresses') AS ARRAY) AS maker_addresses, + JSON_EXTRACT(ex."order", '$.taker_tokens') AS taker_tokens_json, + JSON_EXTRACT(ex."order", '$.maker_tokens') AS maker_tokens_json, + JSON_EXTRACT(ex."order", '$.taker_amounts') AS taker_amounts_json, + JSON_EXTRACT(ex."order", '$.maker_amounts') AS maker_amounts_json, + json_array_length(JSON_EXTRACT(ex."order", '$.maker_addresses')) as orders_len + FROM + (SELECT + evt_index, evt_tx_hash, evt_block_time, ROW_NUMBER() OVER (PARTITION BY evt_tx_hash ORDER BY evt_index) AS row_num + FROM {{ source('bebop_pmms_polygon', 'BebopSettlement_evt_BebopOrder') }}) evt + LEFT JOIN + (SELECT + call_success, call_block_time, call_block_number, call_tx_hash, contract_address, "order", + ROW_NUMBER() OVER (PARTITION BY call_tx_hash ORDER BY call_block_number) AS row_num + FROM {{ source('bebop_pmms_polygon', 'BebopSettlement_call_settleAggregate') }} + UNION ALL + SELECT + call_success, call_block_time, call_block_number, call_tx_hash, contract_address, "order", + ROW_NUMBER() OVER (PARTITION BY call_tx_hash ORDER BY call_block_number) AS row_num + FROM {{ source('bebop_pmms_polygon', 'BebopSettlement_call_settleAggregateAndSignPermit') }} + UNION ALL + SELECT + call_success, call_block_time, call_block_number, call_tx_hash, contract_address, "order", + ROW_NUMBER() OVER (PARTITION BY call_tx_hash ORDER BY call_block_number) AS row_num + FROM {{ source('bebop_pmms_polygon', 'BebopSettlement_call_settleAggregateAndSignPermit2') }} + UNION ALL + SELECT + call_success, call_block_time, call_block_number, call_tx_hash, contract_address, "order", + ROW_NUMBER() OVER (PARTITION BY call_tx_hash ORDER BY call_block_number) AS row_num + FROM {{ source('bebop_pmms_polygon', 'BebopSettlement_call_swapAggregate') }} + ) ex + ON ex.call_tx_hash = evt.evt_tx_hash and ex.row_num = evt.row_num + WHERE ex.call_success = TRUE + {% if is_incremental() %} + AND {{ incremental_predicate('evt.evt_block_time') }} + {% endif %} +), +unnested_aggregate_orders AS ( + SELECT + block_time, + block_number, + tx_hash, + evt_index, + contract_address, + taker_address, + from_hex(element_at(maker_addresses, sequence_number)) AS maker_address, + CAST(json_extract(taker_tokens_json, concat('$[', cast(sequence_number - 1 as VARCHAR), ']')) AS ARRAY) AS taker_tokens, + CAST(json_extract(maker_tokens_json, concat('$[', cast(sequence_number - 1 as VARCHAR), ']')) AS ARRAY) AS maker_tokens, + CAST(json_extract(taker_amounts_json, concat('$[', cast(sequence_number - 1 as VARCHAR), ']')) AS ARRAY) AS taker_amounts, + CAST(json_extract(maker_amounts_json, concat('$[', cast(sequence_number - 1 as VARCHAR), ']')) AS ARRAY) AS maker_amounts, + json_array_length(json_extract(taker_tokens_json, concat('$[', cast(sequence_number - 1 as VARCHAR), ']'))) as taker_tokens_len, + json_array_length(json_extract(maker_tokens_json, concat('$[', cast(sequence_number - 1 as VARCHAR), ']'))) as maker_tokens_len, + sequence_number - 1 AS order_index + FROM raw_bebop_aggregate_trade + CROSS JOIN UNNEST(sequence(1, orders_len)) AS t(sequence_number) +), + +unnested_taker_arrays AS ( + SELECT + block_time, + block_number, + tx_hash, + evt_index, + contract_address, + taker_address, + maker_address, + maker_tokens, + maker_amounts, + taker_tokens_len, + maker_tokens_len, + from_hex(element_at(taker_tokens, sequence_number)) AS taker_token_address, + element_at(taker_amounts, sequence_number) AS taker_token_amount, + order_index, + sequence_number - 1 AS taker_token_index + FROM (SELECT * FROM raw_bebop_multi_trade UNION ALL SELECT * FROM unnested_aggregate_orders) + CROSS JOIN UNNEST(sequence(1, taker_tokens_len)) AS t(sequence_number) +), +bebop_multi_and_aggregate_trades AS ( + SELECT + block_time, + block_number, + tx_hash, + evt_index, + contract_address, + taker_address, + maker_address, + taker_token_address, + from_hex(element_at(maker_tokens, sequence_number)) AS maker_token_address, + taker_token_amount, + element_at(maker_amounts, sequence_number) AS maker_token_amount, + CASE + WHEN taker_tokens_len = 1 AND maker_tokens_len > 1 THEN 'Multi-Buy' + WHEN maker_tokens_len = 1 AND taker_tokens_len > 1 THEN 'Multi-Sell' + ELSE 'Simple-Swap' + END as trade_type, + cast(array[order_index, taker_token_index, sequence_number - 1] as array) as trace_address + FROM unnested_taker_arrays + CROSS JOIN UNNEST(sequence(1, maker_tokens_len)) AS t(sequence_number) +) + +SELECT + 'polygon' AS blockchain, + 'bebop' AS project, + 'blend' AS version, + CAST(date_trunc('DAY', t.block_time) AS date) AS block_date, + CAST(date_trunc('MONTH', t.block_time) AS date) AS block_month, + t.block_time AS block_time, + t.trade_type, + t_bought.symbol AS token_bought_symbol, + t_sold.symbol AS token_sold_symbol, + CASE + WHEN lower(t_bought.symbol) > lower(t_sold.symbol) THEN concat(t_sold.symbol, '-', t_bought.symbol) + ELSE concat(t_bought.symbol, '-', t_sold.symbol) + END AS token_pair, + CAST(t.maker_token_amount as double) / power(10, coalesce(t_bought.decimals, 0)) AS token_bought_amount, + CAST(t.taker_token_amount as double) / power(10, coalesce(t_sold.decimals, 0)) AS token_sold_amount, + CAST(t.maker_token_amount as UINT256) AS token_bought_amount_raw, + CAST(t.taker_token_amount as UINT256) as token_sold_amount_raw, + CASE + WHEN t.trade_type = 'Multi-Buy' THEN COALESCE( + (CAST(t.maker_token_amount as double) / power(10, t_bought.decimals)) * p_bought.price, + (CAST(t.taker_token_amount as double) / power(10, t_sold.decimals)) * p_sold.price / t.trace_address[2] + ) + WHEN t.trade_type = 'Multi-Sell' THEN COALESCE( + (CAST(t.taker_token_amount as double) / power(10, t_sold.decimals)) * p_sold.price, + (CAST(t.maker_token_amount as double) / power(10, t_bought.decimals)) * p_bought.price / t.trace_address[1] + ) + ELSE COALESCE( + (CAST(t.maker_token_amount as double) / power(10, t_bought.decimals)) * p_bought.price, + (CAST(t.taker_token_amount as double) / power(10, t_sold.decimals)) * p_sold.price + ) + END as amount_usd, + t.maker_token_address AS token_bought_address, + t.taker_token_address AS token_sold_address, + t.taker_address AS taker, + t.maker_address AS maker, + t.contract_address AS project_contract_address, + t.tx_hash, + tx."from" AS tx_from, + tx.to AS tx_to, + t.trace_address, + t.evt_index +FROM (SELECT * FROM bebop_single_trade UNION ALL SELECT * FROM bebop_multi_and_aggregate_trades) t +INNER JOIN +{{ source('polygon', 'transactions')}} tx + ON t.tx_hash = tx.hash + {% if not is_incremental() %} + AND tx.block_time >= TIMESTAMP '{{project_start_date}}' + {% endif %} + {% if is_incremental() %} + AND {{ incremental_predicate('tx.block_time') }} + {% endif %} + LEFT JOIN + {{ source('tokens', 'erc20') }} t_bought + ON t_bought.contract_address = t.maker_token_address + AND t_bought.blockchain = 'polygon' + LEFT JOIN + {{ source('tokens', 'erc20') }} t_sold + ON t_sold.contract_address = t.taker_token_address + AND t_sold.blockchain = 'polygon' + LEFT JOIN + {{ source('prices', 'usd') }} p_bought + ON p_bought.minute = date_trunc('minute', t.block_time) + AND p_bought.contract_address = t.maker_token_address + AND p_bought.blockchain = 'polygon' + {% if not is_incremental() %} + AND p_bought.minute >= TIMESTAMP '{{project_start_date}}' + {% endif %} + {% if is_incremental() %} + AND {{ incremental_predicate('p_bought.minute') }} + {% endif %} + LEFT JOIN + {{ source('prices', 'usd') }} p_sold + ON p_sold.minute = date_trunc('minute', t.block_time) + AND p_sold.contract_address = t.taker_token_address + AND p_sold.blockchain = 'polygon' + {% if not is_incremental() %} + AND p_sold.minute >= TIMESTAMP '{{project_start_date}}' + {% endif %} + {% if is_incremental() %} + AND {{ incremental_predicate('p_sold.minute') }} + {% endif %} \ No newline at end of file diff --git a/models/bebop/polygon/bebop_jam_polygon_trades.sql b/models/bebop/polygon/bebop_jam_polygon_trades.sql index 9c712528f38..944486070cf 100644 --- a/models/bebop/polygon/bebop_jam_polygon_trades.sql +++ b/models/bebop/polygon/bebop_jam_polygon_trades.sql @@ -46,7 +46,7 @@ bebop_jam_raw_data AS ( ON ex.call_tx_hash = evt.evt_tx_hash and ex.row_num = evt.row_num WHERE ex.call_success = TRUE {% if is_incremental() %} - AND evt.evt_block_time >= date_trunc('day', now() - interval '7' Day) + AND {{ incremental_predicate('evt.evt_block_time') }} {% endif %} ), @@ -174,7 +174,7 @@ INNER JOIN AND tx.block_time >= TIMESTAMP '{{project_start_date}}' {% endif %} {% if is_incremental() %} - AND tx.block_time >= date_trunc('day', now() - interval '7' Day) + AND {{ incremental_predicate('tx.block_time') }} {% endif %} LEFT JOIN {{ source('tokens', 'erc20') }} t_bought @@ -193,7 +193,7 @@ INNER JOIN AND p_bought.minute >= TIMESTAMP '{{project_start_date}}' {% endif %} {% if is_incremental() %} - AND p_bought.minute >= date_trunc('day', now() - interval '7' Day) + AND {{ incremental_predicate('p_bought.minute') }} {% endif %} LEFT JOIN {{ source('prices', 'usd') }} p_sold @@ -204,5 +204,5 @@ INNER JOIN AND p_sold.minute >= TIMESTAMP '{{project_start_date}}' {% endif %} {% if is_incremental() %} - AND p_sold.minute >= date_trunc('day', now() - interval '7' Day) + AND {{ incremental_predicate('p_sold.minute') }} {% endif %} \ No newline at end of file diff --git a/models/bebop/polygon/bebop_polygon_schema.yml b/models/bebop/polygon/bebop_polygon_schema.yml index 01a818f24fa..87303c28b02 100644 --- a/models/bebop/polygon/bebop_polygon_schema.yml +++ b/models/bebop/polygon/bebop_polygon_schema.yml @@ -151,6 +151,56 @@ models: - *block_month - *trade_type + - name: bebop_blend_polygon_trades + meta: + blockchain: polygon + sector: dex + project: bebop + contributors: alekss + config: + tags: [ 'polygon','bebop','pmm','trades','dex', 'blend' ] + description: Bebop-BLEND contract trades on polygon - formatted for dex.trades + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - block_date + - blockchain + - project + - version + - tx_hash + - evt_index + - trace_address + - check_dex_aggregator_seed: + blockchain: polygon + project: bebop + version: blend + columns: + - *blockchain + - *project + - *version + - *block_date + - *block_time + - *token_bought_symbol + - *token_sold_symbol + - *token_pair + - *token_bought_amount + - *token_sold_amount + - *token_bought_amount_raw + - *token_sold_amount_raw + - *amount_usd + - *token_bought_address + - *token_sold_address + - *taker + - *maker + - *project_contract_address + - *tx_hash + - *tx_from + - *tx_to + - *trace_address + - *evt_index + - *block_month + - *trade_type + - name: bebop_polygon_trades meta: blockchain: polygon diff --git a/models/bebop/polygon/bebop_polygon_trades.sql b/models/bebop/polygon/bebop_polygon_trades.sql index 38392c9654b..7e0bf94c74f 100644 --- a/models/bebop/polygon/bebop_polygon_trades.sql +++ b/models/bebop/polygon/bebop_polygon_trades.sql @@ -1,17 +1,18 @@ {{ config( schema = 'bebop_polygon', alias = 'trades', - post_hook='{{ expose_spells(\'["polygon"]\', - "project", - "bebop", - \'["alekss"]\') }}' - ) -}} + materialized = 'view', + post_hook='{{ expose_spells(blockchains = \'["polygon"]\', + spell_type = "project", + spell_name = "bebop", + contributors = \'["alekss"]\') }}' +)}} {% set bebop_models = [ ref('bebop_rfq_polygon_trades'), - ref('bebop_jam_polygon_trades') + ref('bebop_jam_polygon_trades'), + ref('bebop_blend_polygon_trades') ] %} SELECT * diff --git a/models/bebop/polygon/bebop_rfq_polygon_trades.sql b/models/bebop/polygon/bebop_rfq_polygon_trades.sql index d01f354c12b..a2ed8dc0408 100644 --- a/models/bebop/polygon/bebop_rfq_polygon_trades.sql +++ b/models/bebop/polygon/bebop_rfq_polygon_trades.sql @@ -55,7 +55,7 @@ bebop_raw_data AS ( ON ex.call_tx_hash = evt.evt_tx_hash and ex.row_num = evt.row_num WHERE ex.call_success = TRUE {% if is_incremental() %} - AND evt.evt_block_time >= date_trunc('day', now() - interval '7' Day) + AND {{ incremental_predicate('evt.evt_block_time') }} {% endif %} ), @@ -192,7 +192,7 @@ INNER JOIN AND tx.block_time >= TIMESTAMP '{{project_start_date}}' {% endif %} {% if is_incremental() %} - AND tx.block_time >= date_trunc('day', now() - interval '7' Day) + AND {{ incremental_predicate('tx.block_time') }} {% endif %} LEFT JOIN {{ source('tokens', 'erc20') }} t_bought @@ -211,7 +211,7 @@ INNER JOIN AND p_bought.minute >= TIMESTAMP '{{project_start_date}}' {% endif %} {% if is_incremental() %} - AND p_bought.minute >= date_trunc('day', now() - interval '7' Day) + AND {{ incremental_predicate('p_bought.minute') }} {% endif %} LEFT JOIN {{ source('prices', 'usd') }} p_sold @@ -222,5 +222,5 @@ INNER JOIN AND p_sold.minute >= TIMESTAMP '{{project_start_date}}' {% endif %} {% if is_incremental() %} - AND p_sold.minute >= date_trunc('day', now() - interval '7' Day) + AND {{ incremental_predicate('p_sold.minute') }} {% endif %} \ No newline at end of file diff --git a/models/bebop/scroll/bebop_jam_scroll_trades.sql b/models/bebop/scroll/bebop_jam_scroll_trades.sql new file mode 100644 index 00000000000..23339c68875 --- /dev/null +++ b/models/bebop/scroll/bebop_jam_scroll_trades.sql @@ -0,0 +1,208 @@ +{{ config( + schema = 'bebop_jam_scroll', + alias = 'trades', + partition_by = ['block_month'], + materialized = 'incremental', + file_format = 'delta', + incremental_strategy = 'merge', + unique_key = ['block_date', 'blockchain', 'project', 'version', 'tx_hash', 'evt_index', 'trace_address'] +)}} + +{% set project_start_date = '2023-11-30' %} + +WITH + +bebop_jam_raw_data AS ( + SELECT + call_block_time AS block_time, + call_block_number AS block_number, + call_tx_hash AS tx_hash, + evt_index, + ex.contract_address, + JSON_EXTRACT_SCALAR(ex."order", '$.expiry') AS expiry, + from_hex(JSON_EXTRACT_SCALAR(ex."order", '$.taker')) as taker_address, + (CAST(JSON_EXTRACT(ex."order", '$.sellTokens') AS ARRAY)) AS taker_tokens_raw, + (CAST(JSON_EXTRACT(ex."order", '$.buyTokens') AS ARRAY)) AS maker_tokens_raw, + (CAST(JSON_EXTRACT(ex."order", '$.sellAmounts') AS ARRAY)) AS taker_amounts_raw, + (CAST(JSON_EXTRACT(ex."order", '$.buyAmounts') AS ARRAY)) AS maker_amounts_raw, + json_array_length(JSON_EXTRACT(ex."order", '$.sellTokens')) as taker_length, + json_array_length(JSON_EXTRACT(ex."order", '$.buyTokens')) as maker_length + FROM + (SELECT + evt_index, evt_tx_hash, evt_block_time, ROW_NUMBER() OVER (PARTITION BY evt_tx_hash ORDER BY evt_index) AS row_num + FROM {{ source('bebop_jam_scroll', 'JamSettlement_evt_Settlement') }} + ) evt + LEFT JOIN + (SELECT + call_success, call_block_time, call_block_number, call_tx_hash, contract_address, "order", + ROW_NUMBER() OVER (PARTITION BY call_tx_hash ORDER BY call_block_number) AS row_num + FROM {{ source('bebop_jam_scroll', 'JamSettlement_call_settle') }} + UNION ALL + SELECT + call_success, call_block_time, call_block_number, call_tx_hash, contract_address, "order", + ROW_NUMBER() OVER (PARTITION BY call_tx_hash ORDER BY call_block_number) AS row_num + FROM {{ source('bebop_jam_scroll', 'JamSettlement_call_settleWithPermitsSignatures') }} + ) ex + ON ex.call_tx_hash = evt.evt_tx_hash and ex.row_num = evt.row_num + WHERE ex.call_success = TRUE + {% if is_incremental() %} + AND {{ incremental_predicate('evt.evt_block_time') }} + {% endif %} +), + +jam_unnested_array_taker AS ( + SELECT + block_time, + block_number, + tx_hash, + evt_index, + contract_address, + expiry, + taker_address, + maker_tokens_raw, + maker_amounts_raw, + taker_length, + maker_length, + element_at(taker_tokens_raw, sequence_number) AS taker_token_address, + element_at(taker_amounts_raw, sequence_number) AS taker_token_amounts, + sequence_number - 1 AS taker_index + FROM bebop_jam_raw_data + CROSS JOIN UNNEST(sequence(1, taker_length)) AS t(sequence_number) +), + +jam_unnested_array_maker AS ( + SELECT + block_time, + block_number, + tx_hash, + evt_index, + contract_address, + expiry, + taker_address, + taker_token_address, + taker_token_amounts, + taker_index, + taker_length, + maker_length, + element_at(maker_tokens_raw, sequence_number) AS maker_token_address, + element_at(maker_amounts_raw, sequence_number) AS maker_token_amounts, + sequence_number - 1 AS maker_index + FROM jam_unnested_array_taker + CROSS JOIN UNNEST(sequence(1, maker_length)) AS t(sequence_number) +), + +jam_simple_trades as ( + SELECT + block_time, + block_number, + contract_address, + tx_hash, + evt_index, + taker_address, + taker_length, + maker_length, + CASE + WHEN taker_length = 1 AND maker_length > 1 THEN CAST(array[taker_index, maker_index] as array) + WHEN maker_length = 1 AND taker_length > 1 THEN CAST(array[maker_index, taker_index] as array) + ELSE CAST(array[taker_index, maker_index] as array) + END as trace_address, + CASE + WHEN taker_length = 1 AND maker_length > 1 THEN 'Multi-Buy' + WHEN maker_length = 1 AND taker_length > 1 THEN 'Multi-Sell' + ELSE 'Simple-Swap' + END as trade_type, + from_hex(maker_token_address) as token_bought_address, + from_hex(taker_token_address) as token_sold_address, + CAST(maker_token_amounts as UINT256) as token_bought_amount_raw, + CAST(maker_token_amounts as double) as token_bought_amount, + CAST(taker_token_amounts as UINT256) as token_sold_amount_raw, + CAST(taker_token_amounts as double) as token_sold_amount + FROM + jam_unnested_array_maker + WHERE maker_token_address IS NOT NULL + AND taker_token_address IS NOT NULL +) + +SELECT + 'scroll' AS blockchain, + 'bebop' AS project, + 'jam' AS version, + CAST(date_trunc('DAY', t.block_time) AS date) AS block_date, + CAST(date_trunc('MONTH', t.block_time) AS date) AS block_month, + t.block_time AS block_time, + t.trade_type, + t_bought.symbol AS token_bought_symbol, + t_sold.symbol AS token_sold_symbol, + CASE + WHEN lower(t_bought.symbol) > lower(t_sold.symbol) THEN concat(t_sold.symbol, '-', t_bought.symbol) + ELSE concat(t_bought.symbol, '-', t_sold.symbol) + END AS token_pair, + t.token_bought_amount / power(10, coalesce(t_bought.decimals, 0)) AS token_bought_amount, + t.token_sold_amount / power(10, coalesce(t_sold.decimals, 0)) AS token_sold_amount, + t.token_bought_amount_raw, + t.token_sold_amount_raw, + CASE + WHEN t.trade_type = 'Multi-Buy' THEN COALESCE( + (t.token_bought_amount / power(10, t_bought.decimals)) * p_bought.price, + (t.token_sold_amount / power(10, t_sold.decimals)) * p_sold.price / maker_length + ) + WHEN t.trade_type = 'Multi-Sell' THEN COALESCE( + (t.token_sold_amount / power(10, t_sold.decimals)) * p_sold.price, + (t.token_bought_amount / power(10, t_bought.decimals)) * p_bought.price / taker_length + ) + ELSE COALESCE( + (t.token_bought_amount / power(10, t_bought.decimals)) * p_bought.price, + (t.token_sold_amount / power(10, t_sold.decimals)) * p_sold.price + ) + END as amount_usd, -- when there's a Multi-trade, the usd value of the multi tokens traded is used as the amount_usd + t.token_bought_address, + t.token_sold_address, + t.taker_address AS taker, + t.contract_address AS maker, + t.contract_address AS project_contract_address, + t.tx_hash, + tx."from" tx_from, + tx.to AS tx_to, + t.trace_address, + t.evt_index +FROM +jam_simple_trades t +INNER JOIN +{{ source('scroll', 'transactions')}} tx + ON t.tx_hash = tx.hash + {% if not is_incremental() %} + AND tx.block_time >= TIMESTAMP '{{project_start_date}}' + {% endif %} + {% if is_incremental() %} + AND {{ incremental_predicate('tx.block_time') }} + {% endif %} + LEFT JOIN + {{ source('tokens', 'erc20') }} t_bought + ON t_bought.contract_address = t.token_bought_address + AND t_bought.blockchain = 'scroll' + LEFT JOIN + {{ source('tokens', 'erc20') }} t_sold + ON t_sold.contract_address = t.token_sold_address + AND t_sold.blockchain = 'scroll' + LEFT JOIN + {{ source('prices', 'usd') }} p_bought + ON p_bought.minute = date_trunc('minute', t.block_time) + AND p_bought.contract_address = t.token_bought_address + AND p_bought.blockchain = 'scroll' + {% if not is_incremental() %} + AND p_bought.minute >= TIMESTAMP '{{project_start_date}}' + {% endif %} + {% if is_incremental() %} + AND {{ incremental_predicate('p_bought.minute') }} + {% endif %} + LEFT JOIN + {{ source('prices', 'usd') }} p_sold + ON p_sold.minute = date_trunc('minute', t.block_time) + AND p_sold.contract_address = t.token_sold_address + AND p_sold.blockchain = 'scroll' + {% if not is_incremental() %} + AND p_sold.minute >= TIMESTAMP '{{project_start_date}}' + {% endif %} + {% if is_incremental() %} + AND {{ incremental_predicate('p_sold.minute') }} + {% endif %} \ No newline at end of file diff --git a/models/bebop/scroll/bebop_scroll_schema.yml b/models/bebop/scroll/bebop_scroll_schema.yml new file mode 100644 index 00000000000..ecd92e26bbf --- /dev/null +++ b/models/bebop/scroll/bebop_scroll_schema.yml @@ -0,0 +1,138 @@ +version: 2 + +models: + - name: bebop_jam_scroll_trades + meta: + blockchain: scroll + sector: dex + project: bebop + contributors: alekss + config: + tags: [ 'scroll','bebop','jam','trades','dex' ] + description: Bebop-JAM contract trades on scroll - formatted for dex.trades + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - block_date + - blockchain + - project + - version + - tx_hash + - evt_index + - trace_address + - check_dex_aggregator_seed: + blockchain: scroll + project: bebop + version: jam + columns: + - &blockchain + name: blockchain + description: "Blockchain which the DEX is deployed" + - &project + name: project + description: "Project name of the DEX" + - &version + name: version + description: "Version of the contract built and deployed by the DEX project" + - &block_date + name: block_date + description: "UTC event block date of each DEX trade" + - &block_time + name: block_time + description: "UTC event block time of each DEX trade" + - &token_bought_symbol + name: token_bought_symbol + description: "Token symbol for token bought in the transaction" + - &token_sold_symbol + name: token_sold_symbol + description: "Token symbol for token sold in the transaction" + - &token_pair + name: token_pair + description: "Token symbol pair for each token involved in the transaction" + - &token_bought_amount + name: token_bought_amount + description: "Value of the token bought at time of execution in the original currency" + - &token_sold_amount + name: token_sold_amount + description: "Value of the token sold at time of execution in the original currency" + - &token_bought_amount_raw + name: token_bought_amount_raw + description: "Raw value of the token bought at time of execution in the original currency" + - &token_sold_amount_raw + name: token_sold_amount_raw + description: "Raw value of the token sold at time of execution in the original currency" + - &amount_usd + name: amount_usd + description: "USD value of the trade at time of execution" + - &token_bought_address + name: token_bought_address + description: "Contract address of the token bought" + - &token_sold_address + name: token_sold_address + description: "Contract address of the token sold" + - &taker + name: taker + description: "Address of trader who purchased a token" + - &maker + name: maker + description: "Address of trader who sold a token" + - &project_contract_address + name: project_contract_address + description: "Project contract address which executed the trade on the blockchain" + - &tx_hash + name: tx_hash + description: "Unique transaction hash value tied to each transaction on the DEX" + - &tx_from + name: tx_from + description: "Address which initiated the transaction" + - &tx_to + name: tx_to + description: "Address which received the transaction" + - &trace_address + name: trace_address + description: "" + - &evt_index + name: evt_index + description: "" + - &block_month + name: block_month + description: "UTC event block month of each DEX trade" + - &trade_type + name: trade_type + description: "Trade classification (Multi-buy, Multi-sell or Simple-swap)" + + - name: bebop_scroll_trades + meta: + blockchain: scroll + sector: dex + project: bebop + contributors: alekss + config: + tags: [ 'scroll','bebop','trades','dex' ] + description: Bebop contract trades on scroll - formatted for dex.trades + columns: + - *blockchain + - *project + - *version + - *block_date + - *block_time + - *token_bought_symbol + - *token_sold_symbol + - *token_pair + - *token_bought_amount + - *token_sold_amount + - *token_bought_amount_raw + - *token_sold_amount_raw + - *amount_usd + - *token_bought_address + - *token_sold_address + - *taker + - *maker + - *project_contract_address + - *tx_hash + - *tx_from + - *tx_to + - *trace_address + - *evt_index + - *block_month + - *trade_type diff --git a/models/bebop/scroll/bebop_scroll_trades.sql b/models/bebop/scroll/bebop_scroll_trades.sql new file mode 100644 index 00000000000..44c428c7d5b --- /dev/null +++ b/models/bebop/scroll/bebop_scroll_trades.sql @@ -0,0 +1,50 @@ +{{ config( + schema = 'bebop_scroll', + alias = 'trades', + materialized = 'view', + post_hook='{{ expose_spells(blockchains = \'["scroll"]\', + spell_type = "project", + spell_name = "bebop", + contributors = \'["alekss"]\') }}' +)}} + + +{% set bebop_models = [ + ref('bebop_jam_scroll_trades') +] %} + +SELECT * +FROM ( + {% for dex_model in bebop_models %} + SELECT + blockchain, + project, + version, + block_month, + block_date, + block_time, + trade_type, + token_bought_symbol, + token_sold_symbol, + token_pair, + token_bought_amount, + token_sold_amount, + token_bought_amount_raw, + token_sold_amount_raw, + amount_usd, + token_bought_address, + token_sold_address, + taker, + maker, + project_contract_address, + tx_hash, + tx_from, + tx_to, + trace_address, + evt_index + FROM {{ dex_model }} + {% if not loop.last %} + UNION ALL + {% endif %} + {% endfor %} +) diff --git a/models/bebop/zksync/bebop_jam_zksync_trades.sql b/models/bebop/zksync/bebop_jam_zksync_trades.sql new file mode 100644 index 00000000000..0c247f3b4de --- /dev/null +++ b/models/bebop/zksync/bebop_jam_zksync_trades.sql @@ -0,0 +1,208 @@ +{{ config( + schema = 'bebop_jam_zksync', + alias = 'trades', + partition_by = ['block_month'], + materialized = 'incremental', + file_format = 'delta', + incremental_strategy = 'merge', + unique_key = ['block_date', 'blockchain', 'project', 'version', 'tx_hash', 'evt_index', 'trace_address'] +)}} + +{% set project_start_date = '2023-11-30' %} + +WITH + +bebop_jam_raw_data AS ( + SELECT + call_block_time AS block_time, + call_block_number AS block_number, + call_tx_hash AS tx_hash, + evt_index, + ex.contract_address, + JSON_EXTRACT_SCALAR(ex."order", '$.expiry') AS expiry, + from_hex(JSON_EXTRACT_SCALAR(ex."order", '$.taker')) as taker_address, + (CAST(JSON_EXTRACT(ex."order", '$.sellTokens') AS ARRAY)) AS taker_tokens_raw, + (CAST(JSON_EXTRACT(ex."order", '$.buyTokens') AS ARRAY)) AS maker_tokens_raw, + (CAST(JSON_EXTRACT(ex."order", '$.sellAmounts') AS ARRAY)) AS taker_amounts_raw, + (CAST(JSON_EXTRACT(ex."order", '$.buyAmounts') AS ARRAY)) AS maker_amounts_raw, + json_array_length(JSON_EXTRACT(ex."order", '$.sellTokens')) as taker_length, + json_array_length(JSON_EXTRACT(ex."order", '$.buyTokens')) as maker_length + FROM + (SELECT + evt_index, evt_tx_hash, evt_block_time, ROW_NUMBER() OVER (PARTITION BY evt_tx_hash ORDER BY evt_index) AS row_num + FROM {{ source('bebop_jam_zksync', 'JamSettlement_evt_Settlement') }} + ) evt + LEFT JOIN + (SELECT + call_success, call_block_time, call_block_number, call_tx_hash, contract_address, "order", + ROW_NUMBER() OVER (PARTITION BY call_tx_hash ORDER BY call_block_number) AS row_num + FROM {{ source('bebop_jam_zksync', 'JamSettlement_call_settle') }} + UNION ALL + SELECT + call_success, call_block_time, call_block_number, call_tx_hash, contract_address, "order", + ROW_NUMBER() OVER (PARTITION BY call_tx_hash ORDER BY call_block_number) AS row_num + FROM {{ source('bebop_jam_zksync', 'JamSettlement_call_settleWithPermitsSignatures') }} + ) ex + ON ex.call_tx_hash = evt.evt_tx_hash and ex.row_num = evt.row_num + WHERE ex.call_success = TRUE + {% if is_incremental() %} + AND {{ incremental_predicate('evt.evt_block_time') }} + {% endif %} +), + +jam_unnested_array_taker AS ( + SELECT + block_time, + block_number, + tx_hash, + evt_index, + contract_address, + expiry, + taker_address, + maker_tokens_raw, + maker_amounts_raw, + taker_length, + maker_length, + element_at(taker_tokens_raw, sequence_number) AS taker_token_address, + element_at(taker_amounts_raw, sequence_number) AS taker_token_amounts, + sequence_number - 1 AS taker_index + FROM bebop_jam_raw_data + CROSS JOIN UNNEST(sequence(1, taker_length)) AS t(sequence_number) +), + +jam_unnested_array_maker AS ( + SELECT + block_time, + block_number, + tx_hash, + evt_index, + contract_address, + expiry, + taker_address, + taker_token_address, + taker_token_amounts, + taker_index, + taker_length, + maker_length, + element_at(maker_tokens_raw, sequence_number) AS maker_token_address, + element_at(maker_amounts_raw, sequence_number) AS maker_token_amounts, + sequence_number - 1 AS maker_index + FROM jam_unnested_array_taker + CROSS JOIN UNNEST(sequence(1, maker_length)) AS t(sequence_number) +), + +jam_simple_trades as ( + SELECT + block_time, + block_number, + contract_address, + tx_hash, + evt_index, + taker_address, + taker_length, + maker_length, + CASE + WHEN taker_length = 1 AND maker_length > 1 THEN CAST(array[taker_index, maker_index] as array) + WHEN maker_length = 1 AND taker_length > 1 THEN CAST(array[maker_index, taker_index] as array) + ELSE CAST(array[taker_index, maker_index] as array) + END as trace_address, + CASE + WHEN taker_length = 1 AND maker_length > 1 THEN 'Multi-Buy' + WHEN maker_length = 1 AND taker_length > 1 THEN 'Multi-Sell' + ELSE 'Simple-Swap' + END as trade_type, + from_hex(maker_token_address) as token_bought_address, + from_hex(taker_token_address) as token_sold_address, + CAST(maker_token_amounts as UINT256) as token_bought_amount_raw, + CAST(maker_token_amounts as double) as token_bought_amount, + CAST(taker_token_amounts as UINT256) as token_sold_amount_raw, + CAST(taker_token_amounts as double) as token_sold_amount + FROM + jam_unnested_array_maker + WHERE maker_token_address IS NOT NULL + AND taker_token_address IS NOT NULL +) + +SELECT + 'zksync' AS blockchain, + 'bebop' AS project, + 'jam' AS version, + CAST(date_trunc('DAY', t.block_time) AS date) AS block_date, + CAST(date_trunc('MONTH', t.block_time) AS date) AS block_month, + t.block_time AS block_time, + t.trade_type, + t_bought.symbol AS token_bought_symbol, + t_sold.symbol AS token_sold_symbol, + CASE + WHEN lower(t_bought.symbol) > lower(t_sold.symbol) THEN concat(t_sold.symbol, '-', t_bought.symbol) + ELSE concat(t_bought.symbol, '-', t_sold.symbol) + END AS token_pair, + t.token_bought_amount / power(10, coalesce(t_bought.decimals, 0)) AS token_bought_amount, + t.token_sold_amount / power(10, coalesce(t_sold.decimals, 0)) AS token_sold_amount, + t.token_bought_amount_raw, + t.token_sold_amount_raw, + CASE + WHEN t.trade_type = 'Multi-Buy' THEN COALESCE( + (t.token_bought_amount / power(10, t_bought.decimals)) * p_bought.price, + (t.token_sold_amount / power(10, t_sold.decimals)) * p_sold.price / maker_length + ) + WHEN t.trade_type = 'Multi-Sell' THEN COALESCE( + (t.token_sold_amount / power(10, t_sold.decimals)) * p_sold.price, + (t.token_bought_amount / power(10, t_bought.decimals)) * p_bought.price / taker_length + ) + ELSE COALESCE( + (t.token_bought_amount / power(10, t_bought.decimals)) * p_bought.price, + (t.token_sold_amount / power(10, t_sold.decimals)) * p_sold.price + ) + END as amount_usd, -- when there's a Multi-trade, the usd value of the multi tokens traded is used as the amount_usd + t.token_bought_address, + t.token_sold_address, + t.taker_address AS taker, + t.contract_address AS maker, + t.contract_address AS project_contract_address, + t.tx_hash, + tx."from" tx_from, + tx.to AS tx_to, + t.trace_address, + t.evt_index +FROM +jam_simple_trades t +INNER JOIN +{{ source('zksync', 'transactions')}} tx + ON t.tx_hash = tx.hash + {% if not is_incremental() %} + AND tx.block_time >= TIMESTAMP '{{project_start_date}}' + {% endif %} + {% if is_incremental() %} + AND {{ incremental_predicate('tx.block_time') }} + {% endif %} + LEFT JOIN + {{ source('tokens', 'erc20') }} t_bought + ON t_bought.contract_address = t.token_bought_address + AND t_bought.blockchain = 'zksync' + LEFT JOIN + {{ source('tokens', 'erc20') }} t_sold + ON t_sold.contract_address = t.token_sold_address + AND t_sold.blockchain = 'zksync' + LEFT JOIN + {{ source('prices', 'usd') }} p_bought + ON p_bought.minute = date_trunc('minute', t.block_time) + AND p_bought.contract_address = t.token_bought_address + AND p_bought.blockchain = 'zksync' + {% if not is_incremental() %} + AND p_bought.minute >= TIMESTAMP '{{project_start_date}}' + {% endif %} + {% if is_incremental() %} + AND {{ incremental_predicate('p_bought.minute') }} + {% endif %} + LEFT JOIN + {{ source('prices', 'usd') }} p_sold + ON p_sold.minute = date_trunc('minute', t.block_time) + AND p_sold.contract_address = t.token_sold_address + AND p_sold.blockchain = 'zksync' + {% if not is_incremental() %} + AND p_sold.minute >= TIMESTAMP '{{project_start_date}}' + {% endif %} + {% if is_incremental() %} + AND {{ incremental_predicate('p_sold.minute') }} + {% endif %} \ No newline at end of file diff --git a/models/bebop/zksync/bebop_zksync_schema.yml b/models/bebop/zksync/bebop_zksync_schema.yml new file mode 100644 index 00000000000..97571db4f14 --- /dev/null +++ b/models/bebop/zksync/bebop_zksync_schema.yml @@ -0,0 +1,138 @@ +version: 2 + +models: + - name: bebop_jam_zksync_trades + meta: + blockchain: zksync + sector: dex + project: bebop + contributors: alekss + config: + tags: [ 'zksync','bebop','jam','trades','dex' ] + description: Bebop-JAM contract trades on zksync - formatted for dex.trades + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - block_date + - blockchain + - project + - version + - tx_hash + - evt_index + - trace_address + - check_dex_aggregator_seed: + blockchain: zksync + project: bebop + version: jam + columns: + - &blockchain + name: blockchain + description: "Blockchain which the DEX is deployed" + - &project + name: project + description: "Project name of the DEX" + - &version + name: version + description: "Version of the contract built and deployed by the DEX project" + - &block_date + name: block_date + description: "UTC event block date of each DEX trade" + - &block_time + name: block_time + description: "UTC event block time of each DEX trade" + - &token_bought_symbol + name: token_bought_symbol + description: "Token symbol for token bought in the transaction" + - &token_sold_symbol + name: token_sold_symbol + description: "Token symbol for token sold in the transaction" + - &token_pair + name: token_pair + description: "Token symbol pair for each token involved in the transaction" + - &token_bought_amount + name: token_bought_amount + description: "Value of the token bought at time of execution in the original currency" + - &token_sold_amount + name: token_sold_amount + description: "Value of the token sold at time of execution in the original currency" + - &token_bought_amount_raw + name: token_bought_amount_raw + description: "Raw value of the token bought at time of execution in the original currency" + - &token_sold_amount_raw + name: token_sold_amount_raw + description: "Raw value of the token sold at time of execution in the original currency" + - &amount_usd + name: amount_usd + description: "USD value of the trade at time of execution" + - &token_bought_address + name: token_bought_address + description: "Contract address of the token bought" + - &token_sold_address + name: token_sold_address + description: "Contract address of the token sold" + - &taker + name: taker + description: "Address of trader who purchased a token" + - &maker + name: maker + description: "Address of trader who sold a token" + - &project_contract_address + name: project_contract_address + description: "Project contract address which executed the trade on the blockchain" + - &tx_hash + name: tx_hash + description: "Unique transaction hash value tied to each transaction on the DEX" + - &tx_from + name: tx_from + description: "Address which initiated the transaction" + - &tx_to + name: tx_to + description: "Address which received the transaction" + - &trace_address + name: trace_address + description: "" + - &evt_index + name: evt_index + description: "" + - &block_month + name: block_month + description: "UTC event block month of each DEX trade" + - &trade_type + name: trade_type + description: "Trade classification (Multi-buy, Multi-sell or Simple-swap)" + + - name: bebop_zksync_trades + meta: + blockchain: zksync + sector: dex + project: bebop + contributors: alekss + config: + tags: [ 'zksync','bebop','trades','dex' ] + description: Bebop contract trades on zksync - formatted for dex.trades + columns: + - *blockchain + - *project + - *version + - *block_date + - *block_time + - *token_bought_symbol + - *token_sold_symbol + - *token_pair + - *token_bought_amount + - *token_sold_amount + - *token_bought_amount_raw + - *token_sold_amount_raw + - *amount_usd + - *token_bought_address + - *token_sold_address + - *taker + - *maker + - *project_contract_address + - *tx_hash + - *tx_from + - *tx_to + - *trace_address + - *evt_index + - *block_month + - *trade_type diff --git a/models/bebop/zksync/bebop_zksync_trades.sql b/models/bebop/zksync/bebop_zksync_trades.sql new file mode 100644 index 00000000000..d65cd570fdf --- /dev/null +++ b/models/bebop/zksync/bebop_zksync_trades.sql @@ -0,0 +1,50 @@ +{{ config( + schema = 'bebop_zksync', + alias = 'trades', + materialized = 'view', + post_hook='{{ expose_spells(blockchains = \'["zksync"]\', + spell_type = "project", + spell_name = "bebop", + contributors = \'["alekss"]\') }}' +)}} + + +{% set bebop_models = [ + ref('bebop_jam_zksync_trades') +] %} + +SELECT * +FROM ( + {% for dex_model in bebop_models %} + SELECT + blockchain, + project, + version, + block_month, + block_date, + block_time, + trade_type, + token_bought_symbol, + token_sold_symbol, + token_pair, + token_bought_amount, + token_sold_amount, + token_bought_amount_raw, + token_sold_amount_raw, + amount_usd, + token_bought_address, + token_sold_address, + taker, + maker, + project_contract_address, + tx_hash, + tx_from, + tx_to, + trace_address, + evt_index + FROM {{ dex_model }} + {% if not loop.last %} + UNION ALL + {% endif %} + {% endfor %} +) diff --git a/seeds/dex/aggregator/dex_aggregator_seed.csv b/seeds/dex/aggregator/dex_aggregator_seed.csv index 40a38ecc92e..caf350e12df 100644 --- a/seeds/dex/aggregator/dex_aggregator_seed.csv +++ b/seeds/dex/aggregator/dex_aggregator_seed.csv @@ -139,4 +139,13 @@ base,odos,2,2024-03-07,0x5c12e43ddaa2bdcc94dd149c0060a972cef54bc3c8f35d99b0bfa61 base,paraswap,5,2023-09-28,0x8e141830a3dc963c10050ebf012bfcb1d0f02b88583568748f2dc3cfdbb96180,62,-1,0x2ae3f1ec7f1f5012cfeab0185bfc7aa3cf0dec22,0.08578952217686285,0x4200000000000000000000000000000000000006,0.09 base,paraswap,5,2023-09-30,0xdd95c0eefbc4cb42fd31241e1f5910082a25f1ca8e98ee68ac7e0416af6d45e3,7,-1,0x4200000000000000000000000000000000000006,0.04466528192622946,0xd9aaec86b65d86f6a7b5b1b0c42ffa531710b6ca,75 ethereum,odos,2,2024-03-06,0xc5db3e9291b5867ce009dccefa855bfa2f5470b96f6f78cc271146a91c0c4a73,348,-1,0x5de8ab7e27f6e7a1fff3e5b337584aa43961beef,38276.8472580857790464,0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2,0.24 -ethereum,odos,2,2023-08-16,0x48309564a23a8c0c6f284dcb6a8856d40ed934fc3892890bfa08d3cd6a1382c2,28,-1,0x046eee2cc3188071c02bfc1745a6b17c656e3f3d,18588.297962630695354368,0xf1182229b71e79e504b1d2bf076c15a277311e05,1700 \ No newline at end of file +ethereum,odos,2,2023-08-16,0x48309564a23a8c0c6f284dcb6a8856d40ed934fc3892890bfa08d3cd6a1382c2,28,-1,0x046eee2cc3188071c02bfc1745a6b17c656e3f3d,18588.297962630695354368,0xf1182229b71e79e504b1d2bf076c15a277311e05,1700 +base,bebop,jam,2024-05-27,0x3f96ae0debb072a19ee0259fdc9f88cf46732bff923b3bff4f91a637f5b697b1,571,"0,0",0x50c5725949a6f0c72e6c4a641f24049a917db0cb,2967.266782753299,0x833589fcd6edb6e08f4c7c32d4f71b54bda02913,2967.19278 +optimism,bebop,jam,2024-05-27,0x8363cd4150e8dd8aca8106a91b987957fe282db52782c2e420c3935743164590,17,"0,0",0x0b2c639c533813f4aa9d7837caf62653d097ff85,2993.588534,0x94b008aa00579c1307b0ef2c499ad98a8ce58e58,2997.557535 +optimism,bebop,2,2024-05-27,0x5a28d9e22df9e2970bbeb92df74fa86573aee3b7b2ae3b412086156e1ade4c01,68,"0,0",0x94b008aa00579c1307b0ef2c499ad98a8ce58e58,120.674325,0x4200000000000000000000000000000000000006,0.031 +scroll,bebop,jam,2024-05-27,0x6ae71cf80daa5601f9e2fc1f55e73cc7bf2e5b837a31400ff3b66b0e278a272e,25,"0,0",0x5300000000000000000000000000000000000004,0.007211155976746815,0x3c1bca5a656e69edcd0d4e36bebb3fcdaca60cf1,0.00041691 +zksync,bebop,jam,2024-05-27,0x3f1d7f99e108b3f5380d1d7344f4ced18b31b14ab1015b48e7a070debf8439aa,40,"0,0",0x493257fd37edb34451f62edf8d2a0c418852ba4c,154.837841,0x5aea5775959fbc2557cc8789bc1bf90a239d9a91,0.04001969744514608 +ethereum,bebop,blend,2024-05-21,0x21677f9f3c67d01ab04e0099e96504eaba4e096048904d395e5cb7d2406fd00f,120,"0,0,0",0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2,0.42318489471676,0xae7ab96520de3a18e5e111b5eaab095312d7fe84,0.43046091487172494 +polygon,bebop,blend,2024-05-31,0x680a55160e096aeee0e01390d5dbeab32263bfca3f842f58c44cdcca5349ad10,102,"0,0,0",0x2791bca1f2de4661ed88a30c99a7a9449aa84174,21.723107,0xc2132d05d31c914a87c6611c10748aeb04b58e8f,21.737614 +arbitrum,bebop,blend,2024-05-26,0x04045cbce9de0469c40c2ad17fca876cda06ce6946c7d7a84b80bf6d8c662d6e,7,"0,0,0",0x82af49447d8a07e3bd95bd0d56f35241523fbab1,0.045019157349776975,0xfd086bc7cd5c481dcc9c85ebe478a1c0b69fcbb9,172.591646 +base,bebop,blend,2024-05-21,0x2e3d46d6e847ad3a88f515aca7e556a14c93dc1eba5899da0b0edd6936ec8054,163,"0,0,0",0x833589fcd6edb6e08f4c7c32d4f71b54bda02913,40.623838,0x4200000000000000000000000000000000000006,0.0109 \ No newline at end of file diff --git a/sources/bebop/arbitrum/bebop_arbitrum_sources.yml b/sources/bebop/arbitrum/bebop_arbitrum_sources.yml index f1b6f5dde69..29fc16a6391 100644 --- a/sources/bebop/arbitrum/bebop_arbitrum_sources.yml +++ b/sources/bebop/arbitrum/bebop_arbitrum_sources.yml @@ -34,4 +34,38 @@ sources: - name: JamSettlement_call_settleWithPermitsSignatures loaded_at_field: call_block_time - name: JamSettlement_evt_Settlement + loaded_at_field: evt_block_time + - name: bebop_pmms_arbitrum + description: "Bebop decoded tables related to Bebop" + freshness: # default freshness + warn_after: { count: 12, period: hour } + error_after: { count: 24, period: hour } + tables: + - name: BebopSettlement_call_settleSingle + loaded_at_field: call_block_time + - name: BebopSettlement_call_settleSingleAndSignPermit + loaded_at_field: call_block_time + - name: BebopSettlement_call_settleSingleAndSignPermit2 + loaded_at_field: call_block_time + - name: BebopSettlement_call_swapSingle + loaded_at_field: call_block_time + - name: BebopSettlement_call_swapSingleFromContract + loaded_at_field: call_block_time + - name: BebopSettlement_call_settleMulti + loaded_at_field: call_block_time + - name: BebopSettlement_call_settleMultiAndSignPermit + loaded_at_field: call_block_time + - name: BebopSettlement_call_settleMultiAndSignPermit2 + loaded_at_field: call_block_time + - name: BebopSettlement_call_swapMulti + loaded_at_field: call_block_time + - name: BebopSettlement_call_settleAggregate + loaded_at_field: call_block_time + - name: BebopSettlement_call_settleAggregateAndSignPermit + loaded_at_field: call_block_time + - name: BebopSettlement_call_settleAggregateAndSignPermit2 + loaded_at_field: call_block_time + - name: BebopSettlement_call_swapAggregate + loaded_at_field: call_block_time + - name: BebopSettlement_evt_BebopOrder loaded_at_field: evt_block_time \ No newline at end of file diff --git a/sources/bebop/base/bebop_base_sources.yml b/sources/bebop/base/bebop_base_sources.yml new file mode 100644 index 00000000000..d7a8c305808 --- /dev/null +++ b/sources/bebop/base/bebop_base_sources.yml @@ -0,0 +1,49 @@ +version: 2 + +sources: + - name: bebop_jam_base + description: "BebopJAM decoded tables related to Bebop" + freshness: # default freshness + warn_after: { count: 12, period: hour } + error_after: { count: 24, period: hour } + tables: + - name: JamSettlement_call_settle + loaded_at_field: call_block_time + - name: JamSettlement_call_settleWithPermitsSignatures + loaded_at_field: call_block_time + - name: JamSettlement_evt_Settlement + loaded_at_field: evt_block_time + - name: bebop_pmms_base + description: "Bebop decoded tables related to Bebop" + freshness: # default freshness + warn_after: { count: 12, period: hour } + error_after: { count: 24, period: hour } + tables: + - name: BebopSettlement_call_settleSingle + loaded_at_field: call_block_time + - name: BebopSettlement_call_settleSingleAndSignPermit + loaded_at_field: call_block_time + - name: BebopSettlement_call_settleSingleAndSignPermit2 + loaded_at_field: call_block_time + - name: BebopSettlement_call_swapSingle + loaded_at_field: call_block_time + - name: BebopSettlement_call_swapSingleFromContract + loaded_at_field: call_block_time + - name: BebopSettlement_call_settleMulti + loaded_at_field: call_block_time + - name: BebopSettlement_call_settleMultiAndSignPermit + loaded_at_field: call_block_time + - name: BebopSettlement_call_settleMultiAndSignPermit2 + loaded_at_field: call_block_time + - name: BebopSettlement_call_swapMulti + loaded_at_field: call_block_time + - name: BebopSettlement_call_settleAggregate + loaded_at_field: call_block_time + - name: BebopSettlement_call_settleAggregateAndSignPermit + loaded_at_field: call_block_time + - name: BebopSettlement_call_settleAggregateAndSignPermit2 + loaded_at_field: call_block_time + - name: BebopSettlement_call_swapAggregate + loaded_at_field: call_block_time + - name: BebopSettlement_evt_BebopOrder + loaded_at_field: evt_block_time \ No newline at end of file diff --git a/sources/bebop/ethereum/bebop_ethereum_sources.yml b/sources/bebop/ethereum/bebop_ethereum_sources.yml index 3080b322041..1654f0cb7f0 100644 --- a/sources/bebop/ethereum/bebop_ethereum_sources.yml +++ b/sources/bebop/ethereum/bebop_ethereum_sources.yml @@ -34,4 +34,38 @@ sources: - name: JamSettlement_call_settleWithPermitsSignatures loaded_at_field: call_block_time - name: JamSettlement_evt_Settlement + loaded_at_field: evt_block_time + - name: bebop_pmms_ethereum + description: "Bebop decoded tables related to Bebop" + freshness: # default freshness + warn_after: { count: 12, period: hour } + error_after: { count: 24, period: hour } + tables: + - name: BebopSettlement_call_settleSingle + loaded_at_field: call_block_time + - name: BebopSettlement_call_settleSingleAndSignPermit + loaded_at_field: call_block_time + - name: BebopSettlement_call_settleSingleAndSignPermit2 + loaded_at_field: call_block_time + - name: BebopSettlement_call_swapSingle + loaded_at_field: call_block_time + - name: BebopSettlement_call_swapSingleFromContract + loaded_at_field: call_block_time + - name: BebopSettlement_call_settleMulti + loaded_at_field: call_block_time + - name: BebopSettlement_call_settleMultiAndSignPermit + loaded_at_field: call_block_time + - name: BebopSettlement_call_settleMultiAndSignPermit2 + loaded_at_field: call_block_time + - name: BebopSettlement_call_swapMulti + loaded_at_field: call_block_time + - name: BebopSettlement_call_settleAggregate + loaded_at_field: call_block_time + - name: BebopSettlement_call_settleAggregateAndSignPermit + loaded_at_field: call_block_time + - name: BebopSettlement_call_settleAggregateAndSignPermit2 + loaded_at_field: call_block_time + - name: BebopSettlement_call_swapAggregate + loaded_at_field: call_block_time + - name: BebopSettlement_evt_BebopOrder loaded_at_field: evt_block_time \ No newline at end of file diff --git a/sources/bebop/optimism/bebop_optimism_sources.yml b/sources/bebop/optimism/bebop_optimism_sources.yml new file mode 100644 index 00000000000..a6aa3158915 --- /dev/null +++ b/sources/bebop/optimism/bebop_optimism_sources.yml @@ -0,0 +1,27 @@ +version: 2 + +sources: + - name: bebop_v4_optimism + description: "Bebop decoded tables related to Bebop" + freshness: # default freshness + warn_after: { count: 12, period: hour } + error_after: { count: 24, period: hour } + tables: + - name: BebopSettlement_call_SettleAggregateOrder + loaded_at_field: call_block_time + - name: BebopSettlement_call_SettleAggregateOrderWithTakerPermits + loaded_at_field: call_block_time + - name: BebopSettlement_evt_AggregateOrderExecuted + loaded_at_field: evt_block_time + - name: bebop_jam_optimism + description: "BebopJAM decoded tables related to Bebop" + freshness: # default freshness + warn_after: { count: 12, period: hour } + error_after: { count: 24, period: hour } + tables: + - name: JamSettlement_call_settle + loaded_at_field: call_block_time + - name: JamSettlement_call_settleWithPermitsSignatures + loaded_at_field: call_block_time + - name: JamSettlement_evt_Settlement + loaded_at_field: evt_block_time \ No newline at end of file diff --git a/sources/bebop/polygon/bebop_polygon_sources.yml b/sources/bebop/polygon/bebop_polygon_sources.yml index e16bf9806a7..917be58d89b 100644 --- a/sources/bebop/polygon/bebop_polygon_sources.yml +++ b/sources/bebop/polygon/bebop_polygon_sources.yml @@ -34,4 +34,38 @@ sources: - name: JamSettlement_call_settleWithPermitsSignatures loaded_at_field: call_block_time - name: JamSettlement_evt_Settlement + loaded_at_field: evt_block_time + - name: bebop_pmms_polygon + description: "Bebop decoded tables related to Bebop" + freshness: # default freshness + warn_after: { count: 12, period: hour } + error_after: { count: 24, period: hour } + tables: + - name: BebopSettlement_call_settleSingle + loaded_at_field: call_block_time + - name: BebopSettlement_call_settleSingleAndSignPermit + loaded_at_field: call_block_time + - name: BebopSettlement_call_settleSingleAndSignPermit2 + loaded_at_field: call_block_time + - name: BebopSettlement_call_swapSingle + loaded_at_field: call_block_time + - name: BebopSettlement_call_swapSingleFromContract + loaded_at_field: call_block_time + - name: BebopSettlement_call_settleMulti + loaded_at_field: call_block_time + - name: BebopSettlement_call_settleMultiAndSignPermit + loaded_at_field: call_block_time + - name: BebopSettlement_call_settleMultiAndSignPermit2 + loaded_at_field: call_block_time + - name: BebopSettlement_call_swapMulti + loaded_at_field: call_block_time + - name: BebopSettlement_call_settleAggregate + loaded_at_field: call_block_time + - name: BebopSettlement_call_settleAggregateAndSignPermit + loaded_at_field: call_block_time + - name: BebopSettlement_call_settleAggregateAndSignPermit2 + loaded_at_field: call_block_time + - name: BebopSettlement_call_swapAggregate + loaded_at_field: call_block_time + - name: BebopSettlement_evt_BebopOrder loaded_at_field: evt_block_time \ No newline at end of file diff --git a/sources/bebop/scroll/bebop_scroll_sources.yml b/sources/bebop/scroll/bebop_scroll_sources.yml new file mode 100644 index 00000000000..52f5af047c3 --- /dev/null +++ b/sources/bebop/scroll/bebop_scroll_sources.yml @@ -0,0 +1,15 @@ +version: 2 + +sources: + - name: bebop_jam_scroll + description: "BebopJAM decoded tables related to Bebop" + freshness: # default freshness + warn_after: { count: 12, period: hour } + error_after: { count: 24, period: hour } + tables: + - name: JamSettlement_call_settle + loaded_at_field: call_block_time + - name: JamSettlement_call_settleWithPermitsSignatures + loaded_at_field: call_block_time + - name: JamSettlement_evt_Settlement + loaded_at_field: evt_block_time \ No newline at end of file diff --git a/sources/bebop/zksync/bebop_zksync_sources.yml b/sources/bebop/zksync/bebop_zksync_sources.yml new file mode 100644 index 00000000000..668bfb94e77 --- /dev/null +++ b/sources/bebop/zksync/bebop_zksync_sources.yml @@ -0,0 +1,15 @@ +version: 2 + +sources: + - name: bebop_jam_zksync + description: "BebopJAM decoded tables related to Bebop" + freshness: # default freshness + warn_after: { count: 12, period: hour } + error_after: { count: 24, period: hour } + tables: + - name: JamSettlement_call_settle + loaded_at_field: call_block_time + - name: JamSettlement_call_settleWithPermitsSignatures + loaded_at_field: call_block_time + - name: JamSettlement_evt_Settlement + loaded_at_field: evt_block_time \ No newline at end of file From 452a560fdbacb3c5e661b98b1b46d253cf104391 Mon Sep 17 00:00:00 2001 From: hildobby Date: Mon, 3 Jun 2024 19:54:46 +0200 Subject: [PATCH 014/149] Create tokens_linea.transfers (#5991) * add linea token transfers * fix start date * fix * Update post_hook * Add linea to tokens_transfers --------- Co-authored-by: Huang Geyang --- models/_sector/tokens/linea/_schema.yml | 106 ++++++++++++++++++ .../linea/tokens_linea_base_transfers.sql | 20 ++++ .../tokens/linea/tokens_linea_transfers.sql | 26 +++++ models/_sector/tokens/tokens_transfers.sql | 3 +- 4 files changed, 154 insertions(+), 1 deletion(-) create mode 100644 models/_sector/tokens/linea/_schema.yml create mode 100644 models/_sector/tokens/linea/tokens_linea_base_transfers.sql create mode 100644 models/_sector/tokens/linea/tokens_linea_transfers.sql diff --git a/models/_sector/tokens/linea/_schema.yml b/models/_sector/tokens/linea/_schema.yml new file mode 100644 index 00000000000..b1e44050700 --- /dev/null +++ b/models/_sector/tokens/linea/_schema.yml @@ -0,0 +1,106 @@ +version: 2 + +models: + - name: tokens_linea_base_transfers + meta: + blockchain: linea + sector: tokens + contributors: aalan3, jeff-dude, hildobby + config: + tags: ['tokens','transfers', 'linea'] + description: > + Token transfers + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - block_date + - unique_key + columns: + - name: unique_key + description: "Surrogate key to identify unique row" + - name: blockchain + description: "The blockchain of the transfers" + - name: block_date + description: "The date of the block" + - name: block_time + description: "The time of the block" + - name: block_number + description: "The block number" + - name: tx_hash + description: "The transaction hash" + - name: evt_index + description: "The log event index of the transfer if any" + - name: trace_address + description: "The trace address of the transfer if any" + - name: token_standard + description: "The token standard of the transfer" + - name: tx_from + description: "The transaction sender" + - name: tx_to + description: "The transaction receiver" + - name: tx_index + description: "The transaction index" + - name: from + description: "The sender of the transfer" + - name: to + description: "The receiver of the transfer" + - name: contract_address + description: "The contract address of the transfer" + - name: amount_raw + description: "The raw amount of the transfer" + + - name: tokens_linea_transfers + meta: + blockchain: linea + sector: tokens + contributors: aalan3, jeff-dude, hildobby + config: + tags: ['tokens','transfers', 'linea'] + description: > + Token transfers + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - block_date + - unique_key + columns: + - name: unique_key + description: "Surrogate key to identify unique row" + - name: blockchain + description: "The blockchain of the transfers" + - name: block_date + description: "The date of the block" + - name: block_time + description: "The time of the block" + - name: block_number + description: "The block number" + - name: tx_hash + description: "The transaction hash" + - name: evt_index + description: "The log event index of the transfer if any" + - name: trace_address + description: "The trace address of the transfer if any" + - name: token_standard + description: "The token standard of the transfer" + - name: tx_from + description: "The transaction sender" + - name: tx_to + description: "The transaction receiver" + - name: tx_index + description: "The transaction index" + - name: from + description: "The sender of the transfer" + - name: to + description: "The receiver of the transfer" + - name: contract_address + description: "The contract address of the transfer" + - name: symbol + description: "The token symbol transferred" + - name: amount_raw + description: "The raw amount of the transfer" + - name: amount + description: "The formatted amount of the transfer" + - name: price_usd + description: "The USD price used to calculate the amount_usd" + - name: amount_usd + description: "The USD amount of the transfer" \ No newline at end of file diff --git a/models/_sector/tokens/linea/tokens_linea_base_transfers.sql b/models/_sector/tokens/linea/tokens_linea_base_transfers.sql new file mode 100644 index 00000000000..05a438b22d7 --- /dev/null +++ b/models/_sector/tokens/linea/tokens_linea_base_transfers.sql @@ -0,0 +1,20 @@ +{{config( + schema = 'tokens_linea', + alias = 'base_transfers', + partition_by = ['block_date'], + materialized = 'incremental', + file_format = 'delta', + incremental_strategy = 'merge', + incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.block_time')], + unique_key = ['block_date','unique_key'], +) +}} + +{{transfers_base( + blockchain='linea', + traces = source('linea','traces'), + transactions = source('linea','transactions'), + erc20_transfers = source('erc20_linea','evt_transfer'), + native_contract_address = '0x000000000000000000000000000000000000800a' +) +}} diff --git a/models/_sector/tokens/linea/tokens_linea_transfers.sql b/models/_sector/tokens/linea/tokens_linea_transfers.sql new file mode 100644 index 00000000000..059a9bc6f93 --- /dev/null +++ b/models/_sector/tokens/linea/tokens_linea_transfers.sql @@ -0,0 +1,26 @@ +{{config( + schema = 'tokens_linea', + alias = 'transfers', + partition_by = ['block_date'], + materialized = 'incremental', + file_format = 'delta', + incremental_strategy = 'merge', + unique_key = ['block_date','unique_key'], + incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.block_date')], + post_hook='{{ expose_spells(blockchains = \'["linea"]\', + spell_type = "sector", + spell_name = "tokens", + contributors = \'["aalan3", "jeff-dude", "hildobby"]\') }}' +) +}} + +{{ + transfers_enrich( + base_transfers = ref('tokens_linea_base_transfers') + , tokens_erc20_model = source('tokens', 'erc20') + , prices_model = source('prices', 'usd') + , evms_info_model = ref('evms_info') + , transfers_start_date = '2023-07-06' + , blockchain = 'linea' + ) +}} diff --git a/models/_sector/tokens/tokens_transfers.sql b/models/_sector/tokens/tokens_transfers.sql index 3e532f5caa8..420d9ff4b4c 100644 --- a/models/_sector/tokens/tokens_transfers.sql +++ b/models/_sector/tokens/tokens_transfers.sql @@ -1,6 +1,6 @@ {{ config( schema = 'tokens' - ,alias = 'transfers' + , alias = 'transfers' ) }} @@ -18,6 +18,7 @@ ,'zksync' ,'zora' ,'scroll' + ,'linea' ] %} SELECT * From 7ed882ddbe7219d148c62fb2cc9ec9d7c10ce852 Mon Sep 17 00:00:00 2001 From: hildobby Date: Mon, 3 Jun 2024 19:56:50 +0200 Subject: [PATCH 015/149] create tokens_zkevm_transfers (#5992) * create tokens_zkevm_transfers * fix start date * fix * Add zkevm into tokens_transfers --------- Co-authored-by: jeff-dude <102681548+jeff-dude@users.noreply.github.com> Co-authored-by: Huang Geyang --- models/_sector/tokens/tokens_transfers.sql | 1 + models/_sector/tokens/zkevm/_schema.yml | 106 ++++++++++++++++++ .../zkevm/tokens_zkevm_base_transfers.sql | 20 ++++ .../tokens/zkevm/tokens_zkevm_transfers.sql | 26 +++++ 4 files changed, 153 insertions(+) create mode 100644 models/_sector/tokens/zkevm/_schema.yml create mode 100644 models/_sector/tokens/zkevm/tokens_zkevm_base_transfers.sql create mode 100644 models/_sector/tokens/zkevm/tokens_zkevm_transfers.sql diff --git a/models/_sector/tokens/tokens_transfers.sql b/models/_sector/tokens/tokens_transfers.sql index 420d9ff4b4c..31b48c395b9 100644 --- a/models/_sector/tokens/tokens_transfers.sql +++ b/models/_sector/tokens/tokens_transfers.sql @@ -18,6 +18,7 @@ ,'zksync' ,'zora' ,'scroll' + ,'zkevm' ,'linea' ] %} diff --git a/models/_sector/tokens/zkevm/_schema.yml b/models/_sector/tokens/zkevm/_schema.yml new file mode 100644 index 00000000000..6ab7613a40a --- /dev/null +++ b/models/_sector/tokens/zkevm/_schema.yml @@ -0,0 +1,106 @@ +version: 2 + +models: + - name: tokens_zkevm_base_transfers + meta: + blockchain: zkevm + sector: tokens + contributors: aalan3, jeff-dude, hildobby + config: + tags: ['tokens','transfers', 'zkevm'] + description: > + Token transfers + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - block_date + - unique_key + columns: + - name: unique_key + description: "Surrogate key to identify unique row" + - name: blockchain + description: "The blockchain of the transfers" + - name: block_date + description: "The date of the block" + - name: block_time + description: "The time of the block" + - name: block_number + description: "The block number" + - name: tx_hash + description: "The transaction hash" + - name: evt_index + description: "The log event index of the transfer if any" + - name: trace_address + description: "The trace address of the transfer if any" + - name: token_standard + description: "The token standard of the transfer" + - name: tx_from + description: "The transaction sender" + - name: tx_to + description: "The transaction receiver" + - name: tx_index + description: "The transaction index" + - name: from + description: "The sender of the transfer" + - name: to + description: "The receiver of the transfer" + - name: contract_address + description: "The contract address of the transfer" + - name: amount_raw + description: "The raw amount of the transfer" + + - name: tokens_zkevm_transfers + meta: + blockchain: zkevm + sector: tokens + contributors: aalan3, jeff-dude, hildobby + config: + tags: ['tokens','transfers', 'zkevm'] + description: > + Token transfers + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - block_date + - unique_key + columns: + - name: unique_key + description: "Surrogate key to identify unique row" + - name: blockchain + description: "The blockchain of the transfers" + - name: block_date + description: "The date of the block" + - name: block_time + description: "The time of the block" + - name: block_number + description: "The block number" + - name: tx_hash + description: "The transaction hash" + - name: evt_index + description: "The log event index of the transfer if any" + - name: trace_address + description: "The trace address of the transfer if any" + - name: token_standard + description: "The token standard of the transfer" + - name: tx_from + description: "The transaction sender" + - name: tx_to + description: "The transaction receiver" + - name: tx_index + description: "The transaction index" + - name: from + description: "The sender of the transfer" + - name: to + description: "The receiver of the transfer" + - name: contract_address + description: "The contract address of the transfer" + - name: symbol + description: "The token symbol transferred" + - name: amount_raw + description: "The raw amount of the transfer" + - name: amount + description: "The formatted amount of the transfer" + - name: price_usd + description: "The USD price used to calculate the amount_usd" + - name: amount_usd + description: "The USD amount of the transfer" \ No newline at end of file diff --git a/models/_sector/tokens/zkevm/tokens_zkevm_base_transfers.sql b/models/_sector/tokens/zkevm/tokens_zkevm_base_transfers.sql new file mode 100644 index 00000000000..97af39bcf7f --- /dev/null +++ b/models/_sector/tokens/zkevm/tokens_zkevm_base_transfers.sql @@ -0,0 +1,20 @@ +{{config( + schema = 'tokens_zkevm', + alias = 'base_transfers', + partition_by = ['block_date'], + materialized = 'incremental', + file_format = 'delta', + incremental_strategy = 'merge', + incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.block_time')], + unique_key = ['block_date','unique_key'], +) +}} + +{{transfers_base( + blockchain='zkevm', + traces = source('zkevm','traces'), + transactions = source('zkevm','transactions'), + erc20_transfers = source('erc20_zkevm','evt_transfer'), + native_contract_address = '0x000000000000000000000000000000000000800a' +) +}} diff --git a/models/_sector/tokens/zkevm/tokens_zkevm_transfers.sql b/models/_sector/tokens/zkevm/tokens_zkevm_transfers.sql new file mode 100644 index 00000000000..f28cabb314c --- /dev/null +++ b/models/_sector/tokens/zkevm/tokens_zkevm_transfers.sql @@ -0,0 +1,26 @@ +{{config( + schema = 'tokens_zkevm', + alias = 'transfers', + partition_by = ['block_date'], + materialized = 'incremental', + file_format = 'delta', + incremental_strategy = 'merge', + unique_key = ['block_date','unique_key'], + incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.block_date')], + post_hook='{{ expose_spells(blockchains = \'["zkevm"]\', + spell_type = "sector", + spell_name = "tokens", + contributors = \'["aalan3", "jeff-dude", "hildobby"]\') }}' +) +}} + +{{ + transfers_enrich( + base_transfers = ref('tokens_zkevm_base_transfers') + , tokens_erc20_model = source('tokens', 'erc20') + , prices_model = source('prices', 'usd') + , evms_info_model = ref('evms_info') + , transfers_start_date = '2023-03-24' + , blockchain = 'zkevm' + ) +}} From 7135e4113134c1f5e89266eab78fae17d495f0b3 Mon Sep 17 00:00:00 2001 From: yy-analytics <103118737+yy-analytics@users.noreply.github.com> Date: Mon, 3 Jun 2024 23:26:59 +0530 Subject: [PATCH 016/149] Added new tokens to Arbitrum tokens model (#6057) * Added new tokens to Arbitrum tokens model * Quick addition of USDe token --- models/prices/arbitrum/prices_arbitrum_tokens.sql | 1 + tokens/models/tokens/arbitrum/tokens_arbitrum_erc20.sql | 7 +++++++ 2 files changed, 8 insertions(+) diff --git a/models/prices/arbitrum/prices_arbitrum_tokens.sql b/models/prices/arbitrum/prices_arbitrum_tokens.sql index 916a87ba851..bd90cb14f97 100644 --- a/models/prices/arbitrum/prices_arbitrum_tokens.sql +++ b/models/prices/arbitrum/prices_arbitrum_tokens.sql @@ -191,6 +191,7 @@ FROM ('ankr-ankr-network','arbitrum','ANKR',0x46f74778b265df3a15ec9695ccd2fd3869ca848c, 18), ('forex-handlefi','arbitrum','FOREX',0xdb298285fe4c5410b05390ca80e8fbe9de1f259b, 18), ('susde-ethena-staked-usde','arbitrum','SUSDE',0x211cc4dd073734da055fbf44a2b4667d5e5fe5d2, 18), + ('usde-ethena-usde','arbitrum','USDe',0x5d3a1Ff2b6BAb83b63cd9AD0787074081a52ef34, 18), ('yak-yield-yak','arbitrum','YAK',0x7f4db37d7beb31f445307782bc3da0f18df13696,18), ('ethx-stader-ethx','arbitrum','ETHX',0xed65c5085a18fa160af0313e60dcc7905e944dc7, 18), ('gyd-gyro-dollar','arbitrum','GYD',0xca5d8f8a8d49439357d3cf46ca2e720702f132b8, 18), diff --git a/tokens/models/tokens/arbitrum/tokens_arbitrum_erc20.sql b/tokens/models/tokens/arbitrum/tokens_arbitrum_erc20.sql index f08fa39e420..691be9433eb 100644 --- a/tokens/models/tokens/arbitrum/tokens_arbitrum_erc20.sql +++ b/tokens/models/tokens/arbitrum/tokens_arbitrum_erc20.sql @@ -68,4 +68,11 @@ FROM (VALUES , (0x7cc35c17db6fc7c7894f0ac19932a2c852fa7ed2, 'testDE', 18) , (0x88762f15d0150ac231af265737106e0b9e28e584, 'TA', 18) , (0xa170eaa9a74ab4b3218c736210b0421af35c3c00, 'MOLANDAK', 18) + , (0x1d38d4204159aa5e767afba8f76be22117de61e5, 'PENDLE-LPT', 18) + , (0x2dfaf9a5e4f293bceede49f2dba29aacdd88e0c4, 'PENDLE-LPT', 18) + , (0x35f3db08a6e9cb4391348b0b404f493e7ae264c0, 'PENDLE-LPT', 18) + , (0x6ea313859a5d9f6ff2a68f529e6361174bfd2225, 'S*USDC', 6) + , (0x8d66ff1845b1bacc6e87d867ca4680d05a349ca8, 'S*USDT', 6) + , (0xba4a858d664ddb052158168db04afa3cff5cfcc8, 'PENDLE-LPT', 18) + , (0xf9f9779d8ff604732eba9ad345e6a27ef5c2a9d6, 'PENDLE-LPT', 18) ) AS temp_table (contract_address, symbol, decimals) From 723ee761914a8073cbc76aadf19865ff0c18fbb7 Mon Sep 17 00:00:00 2001 From: max-morrow Date: Mon, 3 Jun 2024 20:57:56 +0300 Subject: [PATCH 017/149] 1inch: hot fix underflow (#6056) * hot fix underflow * added some order data --- models/oneinch/oneinch_project_orders.sql | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/models/oneinch/oneinch_project_orders.sql b/models/oneinch/oneinch_project_orders.sql index 6a6b249fbf6..36c497c23de 100644 --- a/models/oneinch/oneinch_project_orders.sql +++ b/models/oneinch/oneinch_project_orders.sql @@ -33,10 +33,13 @@ orders as ( , call_gas_used , maker , maker_asset - , coalesce(making_amount, if(order_start = uint256 '0', maker_max_amount, maker_max_amount - cast(block_unixtime - order_start as double) / (order_end - order_start) * (maker_max_amount - maker_min_amount))) as making_amount + , coalesce(making_amount, if(order_start = uint256 '0', maker_max_amount, maker_max_amount - cast(block_unixtime - order_start as double) / (order_end - order_start) * (cast(maker_max_amount as double) - cast(maker_min_amount as double)))) as making_amount , taker_asset - , coalesce(taking_amount, if(order_start = uint256 '0', taker_max_amount, taker_max_amount - cast(block_unixtime - order_start as double) / (order_end - order_start) * (taker_max_amount - taker_min_amount))) as taking_amount + , coalesce(taking_amount, if(order_start = uint256 '0', taker_max_amount, taker_max_amount - cast(block_unixtime - order_start as double) / (order_end - order_start) * (cast(taker_max_amount as double) - cast(taker_min_amount as double)))) as taking_amount , order_hash + , order_start + , order_end + , order_deadline , flags from {{ ref('oneinch_' + blockchain + '_project_orders') }} where call_success @@ -63,6 +66,9 @@ orders as ( , taker_asset , taking_amount , order_hash + , null as order_start + , null as order_end + , null as order_deadline , flags from {{ ref('oneinch_lop') }} where call_success @@ -105,6 +111,9 @@ orders as ( , any_value(making_amount * price / pow(10, decimals)) filter(where contract_address = maker_asset) as making_amount_usd , any_value(taking_amount * price / pow(10, decimals)) filter(where contract_address = taker_asset) as taking_amount_usd , any_value(coalesce(order_hash, concat(tx_hash, to_big_endian_32(cast(counter as int))))) as order_hash + , any_value(order_start) as order_start + , any_value(order_end) as order_end + , any_value(order_deadline) as order_deadline , any_value(flags) as flags from (select * from orders, unnest(assets) as assets(contract_address)) left join prices using(blockchain, contract_address, minute) @@ -135,6 +144,9 @@ select , taking_amount_usd , greatest(coalesce(making_amount_usd, 0), coalesce(taking_amount_usd, 0)) as amount_usd , order_hash + , order_start + , order_end + , order_deadline , flags , date(date_trunc('month', block_time)) as block_month from joined \ No newline at end of file From cf066dfb15ee9901ceeaf29ed2f5fc3c6ae3fcd2 Mon Sep 17 00:00:00 2001 From: tomfutago <35136350+tomfutago@users.noreply.github.com> Date: Mon, 3 Jun 2024 18:58:08 +0100 Subject: [PATCH 018/149] Nexus Mutual - capital pool (#5980) * init * running totals * latest totals * fix ref * add evt_index to uniqueness * update uniqueness * add Cover Re & Aave logic * next_block_date tweak * update defaults * update chainlink ref to source * fix chainlink source * add mcr * incremental_predicates * fix incremental_predicate --------- Co-authored-by: jeff-dude <102681548+jeff-dude@users.noreply.github.com> --- .../ethereum/capital_pool/_schema.yml | 246 +++++++++ ...tal_pool_eth_daily_transaction_summary.sql | 3 +- ...xusmutual_ethereum_capital_pool_latest.sql | 97 ++++ .../nexusmutual_ethereum_capital_pool_mcr.sql | 84 +++ ...xusmutual_ethereum_capital_pool_totals.sql | 501 ++++++++++++++++++ ...mutual_ethereum_capital_pool_transfers.sql | 123 +++++ .../ethereum/nexusmutual_ethereum_schema.yml | 30 -- .../lending/supply/ethereum/_sources.yml | 1 + .../daily_spellbook/chainlink_sources.yml | 9 + .../ethereum/nexusmutual_ethereum_sources.yml | 3 + 10 files changed, 1066 insertions(+), 31 deletions(-) create mode 100644 models/nexusmutual/ethereum/capital_pool/_schema.yml rename models/nexusmutual/ethereum/{ => capital_pool}/nexusmutual_ethereum_capital_pool_eth_daily_transaction_summary.sql (96%) create mode 100644 models/nexusmutual/ethereum/capital_pool/nexusmutual_ethereum_capital_pool_latest.sql create mode 100644 models/nexusmutual/ethereum/capital_pool/nexusmutual_ethereum_capital_pool_mcr.sql create mode 100644 models/nexusmutual/ethereum/capital_pool/nexusmutual_ethereum_capital_pool_totals.sql create mode 100644 models/nexusmutual/ethereum/capital_pool/nexusmutual_ethereum_capital_pool_transfers.sql create mode 100644 sources/_subprojects/daily_spellbook/chainlink_sources.yml diff --git a/models/nexusmutual/ethereum/capital_pool/_schema.yml b/models/nexusmutual/ethereum/capital_pool/_schema.yml new file mode 100644 index 00000000000..9953ced90ee --- /dev/null +++ b/models/nexusmutual/ethereum/capital_pool/_schema.yml @@ -0,0 +1,246 @@ +version: 2 + +models: + - name: nexusmutual_ethereum_capital_pool_transfers + meta: + blockchain: ethereum + project: nexusmutual + contributors: tomfutago + config: + tags: ["ethereum", "nexusmutual", "capital_pool"] + description: "Token transfers in the Nexus Mutual Capital Pool" + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - block_time + - transfer_type + - symbol + - unique_key + - tx_hash + columns: + - &block_time + name: block_time + description: "UTC event block time of each transfer" + tests: + - not_null + - &block_number + name: block_number + description: "Block number of each transfer" + tests: + - not_null + - &block_date + name: block_date + description: "UTC event block date of each transfer" + tests: + - not_null + - &transfer_type + name: transfer_type + description: "Transfer type: in/out (inflow/outflow)" + tests: + - not_null + - &symbol + name: symbol + description: "Token symbol for transferred token" + tests: + - not_null + - &amount + name: amount + description: "Token amount for transferred token" + - &contract_address + name: contract_address + description: "Contract address of the transferred token" + - &unique_key + name: unique_key + description: "Generated unique key of the corresponding token transfer" + - &tx_hash + name: tx_hash + description: "unique transaction hash value tied to each token transfer" + tests: + - not_null + + - name: nexusmutual_ethereum_capital_pool_totals + meta: + blockchain: ethereum + project: nexusmutual + contributors: tomfutago + config: + tags: ["ethereum", "nexusmutual", "capital_pool"] + description: "Daily running totals for core tokens in the Nexus Mutual Capital Pool" + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - block_date + columns: + - *block_date + - &avg_eth_usd_price + name: avg_eth_usd_price + description: "Daily average ETH/USD price" + - &avg_capital_pool_eth_total + name: avg_capital_pool_eth_total + description: "Daily average Capital Pool total expressed in ETH" + - &avg_capital_pool_usd_total + name: avg_capital_pool_usd_total + description: "Daily average Capital Pool total expressed in USD" + - ð_total + name: eth_total + description: "Daily ETH total in the Capital Pool" + - &avg_eth_usd_total + name: avg_eth_usd_total + description: "Daily average ETH total in the Capital Pool expressed in USD" + - &dai_total + name: dai_total + description: "Daily DAI total in the Capital Pool" + - &avg_dai_usd_total + name: avg_dai_usd_total + description: "Daily average DAI total in the Capital Pool expressed in USD" + - &avg_dai_eth_total + name: avg_dai_eth_total + description: "Daily average DAI total in the Capital Pool expressed in ETH" + - &nxmty_total + name: nxmty_total + description: "Daily NXMTY total in the Capital Pool" + - &nxmty_eth_total + name: nxmty_eth_total + description: "Daily average NXMTY total in the Capital Pool expressed in ETH" + - &avg_nxmty_usd_total + name: avg_nxmty_usd_total + description: "Daily average NXMTY total in the Capital Pool expressed in USD" + - &steth_total + name: steth_total + description: "Daily stETH total in the Capital Pool" + - &avg_steth_usd_total + name: avg_steth_usd_total + description: "Daily average stETH total in the Capital Pool expressed in USD" + - &reth_total + name: reth_total + description: "Daily rETH total in the Capital Pool" + - &avg_reth_usd_total + name: avg_reth_usd_total + description: "Daily average rETH total in the Capital Pool expressed in USD" + - &avg_reth_eth_total + name: avg_reth_eth_total + description: "Daily average rETH total in the Capital Pool expressed in ETH" + - &usdc_total + name: usdc_total + description: "Daily USDC total in the Capital Pool" + - &avg_usdc_usd_total + name: avg_usdc_usd_total + description: "Daily average USDC total in the Capital Pool expressed in USD" + - &avg_usdc_eth_total + name: avg_usdc_eth_total + description: "Daily average USDC total in the Capital Pool expressed in ETH" + - &cover_re_usdc_total + name: cover_re_usdc_total + description: "Daily Cover Re USDC Investment total" + - &avg_cover_re_usdc_usd_total + name: avg_cover_re_usdc_usd_total + description: "Daily average Cover Re USDC Investment expressed in USD" + - &avg_cover_re_usdc_eth_total + name: avg_cover_re_usdc_eth_total + description: "Daily average Cover Re USDC Investment expressed in ETH" + - &aave_collateral_weth_total + name: aave_collateral_weth_total + description: "Daily AAVE WETH collateral (supply position)" + - &avg_aave_collateral_weth_usd_total + name: avg_aave_collateral_weth_usd_total + description: "Daily average AAVE WETH collateral expressed in USD" + - &aave_debt_usdc_total + name: aave_debt_usdc_total + description: "Daily AAVE USDC debt (borrow position)" + - &avg_aave_debt_usdc_usd_total + name: avg_aave_debt_usdc_usd_total + description: "Daily average AAVE USDC debt expressed in USD" + - &avg_aave_debt_usdc_eth_total + name: avg_aave_debt_usdc_eth_total + description: "Daily average AAVE USDC debt expressed in ETH" + + - name: nexusmutual_ethereum_capital_pool_latest + meta: + blockchain: ethereum + project: nexusmutual + contributors: tomfutago + config: + tags: ["ethereum", "nexusmutual", "capital_pool"] + description: "Latest totals for core tokens in the Nexus Mutual Capital Pool" + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - block_date + columns: + - *block_date + - *avg_eth_usd_price + - *avg_capital_pool_eth_total + - *avg_capital_pool_usd_total + - *eth_total + - *avg_eth_usd_total + - *dai_total + - *avg_dai_usd_total + - *avg_dai_eth_total + - *nxmty_total + - *nxmty_eth_total + - *avg_nxmty_usd_total + - *steth_total + - *avg_steth_usd_total + - *reth_total + - *avg_reth_usd_total + - *avg_reth_eth_total + - *usdc_total + - *avg_usdc_usd_total + - *avg_usdc_eth_total + - *cover_re_usdc_total + - *avg_cover_re_usdc_usd_total + - *avg_cover_re_usdc_eth_total + - *aave_collateral_weth_total + - *avg_aave_collateral_weth_usd_total + - *aave_debt_usdc_total + - *avg_aave_debt_usdc_usd_total + - *avg_aave_debt_usdc_eth_total + + - name: nexusmutual_ethereum_capital_pool_mcr + meta: + blockchain: ethereum + project: nexusmutual + contributors: tomfutago + config: + tags: ["ethereum", "nexusmutual", "capital_pool"] + description: "Minimum Capital Requirement (MCR) in the Nexus Mutual Capital Pool" + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - block_date + columns: + - *block_date + - *avg_eth_usd_price + - &mcr_eth_total + name: mcr_eth_total + description: "MCR ETH total" + - &mcr_floor_total + name: mcr_floor_total + description: "MCR ETH floor" + - &mcr_cover_min_total + name: mcr_cover_min_total + description: "MCR ETH cover minimum" + + + # to be deprecated: + - name: nexusmutual_ethereum_capital_pool_eth_daily_transaction_summary + meta: + blockchain: ethereum + project: nexusmutual + contributors: [guyhow] + config: + tags: ["ethereum","nexusmutual","trades"] + description: > + Daily summary for ethereum entering and leaving the nexus mutual capital pool contracts + columns: + - &day + name: day + description: "Table primary key: day of summarised transctions" + tests: + - unique + - ð_ingress + name: ingress ethereum + description: "Sum of incoming transctions over the time covered by day" + - ð_egress + name: egress ethereum + description: "Sum of outgoing transctions over the time covered by day" diff --git a/models/nexusmutual/ethereum/nexusmutual_ethereum_capital_pool_eth_daily_transaction_summary.sql b/models/nexusmutual/ethereum/capital_pool/nexusmutual_ethereum_capital_pool_eth_daily_transaction_summary.sql similarity index 96% rename from models/nexusmutual/ethereum/nexusmutual_ethereum_capital_pool_eth_daily_transaction_summary.sql rename to models/nexusmutual/ethereum/capital_pool/nexusmutual_ethereum_capital_pool_eth_daily_transaction_summary.sql index 85ac8ccfdc3..3c62c04043a 100644 --- a/models/nexusmutual/ethereum/nexusmutual_ethereum_capital_pool_eth_daily_transaction_summary.sql +++ b/models/nexusmutual/ethereum/capital_pool/nexusmutual_ethereum_capital_pool_eth_daily_transaction_summary.sql @@ -1,11 +1,12 @@ {{ config( - + schema = 'nexusmutual_ethereum', alias = 'capital_pool_eth_daily_transaction_summary', partition_by = ['day'], materialized = 'incremental', incremental_strategy = 'merge', file_format = 'delta', unique_key = ['day'], + incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.day')], post_hook='{{ expose_spells(\'["ethereum"]\', "project", "nexusmutual", diff --git a/models/nexusmutual/ethereum/capital_pool/nexusmutual_ethereum_capital_pool_latest.sql b/models/nexusmutual/ethereum/capital_pool/nexusmutual_ethereum_capital_pool_latest.sql new file mode 100644 index 00000000000..d91e40fb40a --- /dev/null +++ b/models/nexusmutual/ethereum/capital_pool/nexusmutual_ethereum_capital_pool_latest.sql @@ -0,0 +1,97 @@ +{{ + config( + schema = 'nexusmutual_ethereum', + alias = 'capital_pool_latest', + materialized = 'view', + post_hook = '{{ expose_spells(\'["ethereum"]\', + "project", + "nexusmutual", + \'["tomfutago"]\') }}' + ) +}} + +with + +daily_running_totals as ( + select + block_date, + avg_eth_usd_price, + -- Capital Pool + avg_capital_pool_eth_total, + avg_capital_pool_usd_total, + -- ETH + eth_total, + avg_eth_usd_total, + -- DAI + dai_total, + avg_dai_usd_total, + avg_dai_eth_total, + -- NXMTY + nxmty_total, + nxmty_eth_total, + avg_nxmty_usd_total, + -- stETH + steth_total, + avg_steth_usd_total, + -- rETH + reth_total, + avg_reth_usd_total, + avg_reth_eth_total, + -- USDC + usdc_total, + avg_usdc_usd_total, + avg_usdc_eth_total, + -- Cover Re USDC investment + cover_re_usdc_total, + avg_cover_re_usdc_usd_total, + avg_cover_re_usdc_eth_total, + -- AAVE positions + aave_collateral_weth_total, + avg_aave_collateral_weth_usd_total, + aave_debt_usdc_total, + avg_aave_debt_usdc_usd_total, + avg_aave_debt_usdc_eth_total, + row_number() over (order by block_date desc) as rn + from {{ ref('nexusmutual_ethereum_capital_pool_totals') }} +) + +select + block_date, + avg_eth_usd_price, + -- Capital Pool + avg_capital_pool_eth_total, + avg_capital_pool_usd_total, + -- ETH + eth_total, + avg_eth_usd_total, + -- DAI + dai_total, + avg_dai_usd_total, + avg_dai_eth_total, + -- NXMTY + nxmty_total, + nxmty_eth_total, + avg_nxmty_usd_total, + -- stETH + steth_total, + avg_steth_usd_total, + -- rETH + reth_total, + avg_reth_usd_total, + avg_reth_eth_total, + -- USDC + usdc_total, + avg_usdc_usd_total, + avg_usdc_eth_total, + -- Cover Re USDC investment + cover_re_usdc_total, + avg_cover_re_usdc_usd_total, + avg_cover_re_usdc_eth_total, + -- AAVE positions + aave_collateral_weth_total, + avg_aave_collateral_weth_usd_total, + aave_debt_usdc_total, + avg_aave_debt_usdc_usd_total, + avg_aave_debt_usdc_eth_total +from daily_running_totals +where rn = 1 diff --git a/models/nexusmutual/ethereum/capital_pool/nexusmutual_ethereum_capital_pool_mcr.sql b/models/nexusmutual/ethereum/capital_pool/nexusmutual_ethereum_capital_pool_mcr.sql new file mode 100644 index 00000000000..ef0cd51e9a9 --- /dev/null +++ b/models/nexusmutual/ethereum/capital_pool/nexusmutual_ethereum_capital_pool_mcr.sql @@ -0,0 +1,84 @@ +{{ + config( + schema = 'nexusmutual_ethereum', + alias = 'capital_pool_mcr', + materialized = 'view', + post_hook = '{{ expose_spells(\'["ethereum"]\', + "project", + "nexusmutual", + \'["tomfutago"]\') }}' + ) +}} + +with + +daily_avg_eth_prices as ( + select + date_trunc('day', minute) as block_date, + avg(price) as avg_eth_usd_price + from {{ source('prices', 'usd') }} + where symbol = 'ETH' + and blockchain is null + and contract_address is null + and minute >= timestamp '2019-11-06' + group by 1 +), + +mcr_events as ( + select + date_trunc('day', evt_block_time) as block_date, + cast(mcrEtherx100 as double) / 1e18 as mcr_eth, + cast(7000 as double) as mcr_floor, + cast(0 as double) as mcr_cover_min + from {{ source('nexusmutual_ethereum', 'MCR_evt_MCREvent') }} + union all + select + date_trunc('day', evt_block_time) as block_date, + cast(mcr as double) / 1e18 as mcr_eth, + cast(mcrFloor as double) / 1e18 as mcr_floor, + cast(mcrETHWithGear as double) / 1e18 as mcr_cover_min + from {{ source('nexusmutual_ethereum', 'MCR_evt_MCRUpdated') }} +), + +mcr_daily_avgs as ( + select + p.block_date, + p.avg_eth_usd_price, + avg(me.mcr_eth) as mcr_eth, + avg(me.mcr_floor) as mcr_floor, + avg(me.mcr_cover_min) as mcr_cover_min + from daily_avg_eth_prices p + left join mcr_events me on p.block_date = me.block_date + group by 1, 2 +), + +mcr_filled_null_cnts as ( + select + block_date, + avg_eth_usd_price, + mcr_eth, + mcr_floor, + mcr_cover_min, + count(mcr_eth) over (order by block_date) as mcr_eth_count, + count(mcr_floor) over (order by block_date) as mcr_floor_count, + count(mcr_cover_min) over (order by block_date) as mcr_cover_min_count + from mcr_daily_avgs +), + +mcr_daily_totals as ( + select + block_date, + avg_eth_usd_price, + first_value(mcr_eth) over (partition by mcr_eth_count order by block_date) as mcr_eth_total, + first_value(mcr_floor) over (partition by mcr_floor_count order by block_date) as mcr_floor_total, + first_value(mcr_cover_min) over (partition by mcr_cover_min_count order by block_date) as mcr_cover_min_total + from mcr_filled_null_cnts +) + +select + block_date, + avg_eth_usd_price, + mcr_eth_total, + mcr_floor_total, + mcr_cover_min_total +from mcr_daily_totals diff --git a/models/nexusmutual/ethereum/capital_pool/nexusmutual_ethereum_capital_pool_totals.sql b/models/nexusmutual/ethereum/capital_pool/nexusmutual_ethereum_capital_pool_totals.sql new file mode 100644 index 00000000000..a5557c2d1b4 --- /dev/null +++ b/models/nexusmutual/ethereum/capital_pool/nexusmutual_ethereum_capital_pool_totals.sql @@ -0,0 +1,501 @@ +{{ + config( + schema = 'nexusmutual_ethereum', + alias = 'capital_pool_totals', + materialized = 'incremental', + file_format = 'delta', + incremental_strategy = 'merge', + unique_key = ['block_date'], + incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.block_date')], + post_hook = '{{ expose_spells(\'["ethereum"]\', + "project", + "nexusmutual", + \'["tomfutago"]\') }}' + ) +}} + +with + +transfer_combined as ( + select * from {{ ref('nexusmutual_ethereum_capital_pool_transfers') }} +), + +lido_oracle as ( + select + 1 as anchor, + evt_block_time as block_time, + date_trunc('day', evt_block_time) as block_date, + cast(postTotalPooledEther as double) / cast(totalShares as double) as rebase + from {{ source('lido_ethereum', 'LegacyOracle_evt_PostTotalShares') }} + where evt_block_time >= timestamp '2021-05-26' +), + +steth_adjusted_date as ( + select + date_add('day', case when t.block_time < lo.block_time then -1 else 0 end, t.block_date) as block_date, + t.amount as steth_amount + from lido_oracle lo + inner join transfer_combined t on lo.block_date = t.block_date + where t.symbol = 'stETH' +), + +steth_net_staking as ( + select + 1 as anchor, + lo.block_date, + sd.steth_amount, + lo.rebase as rebase2 + from lido_oracle lo + inner join ( + select block_date, sum(steth_amount) as steth_amount + from steth_adjusted_date + group by 1 + ) sd on lo.block_date = sd.block_date +), + +steth_expanded_rebase as ( + select + lo.block_date, + ns.steth_amount, + lo.rebase, + ns.rebase2 + from steth_net_staking ns + inner join lido_oracle lo on ns.anchor = lo.anchor + where ns.block_date <= lo.block_date +), + +steth_running_total as ( + select distinct + block_date, + sum(steth_amount * rebase / rebase2) over (partition by block_date) as steth_total + from steth_expanded_rebase +), + +chainlink_oracle_nxmty_price as ( + select + block_date, + avg(oracle_price) as nxmty_price + from {{ source('chainlink_ethereum', 'price_feeds') }} + where proxy_address = 0xcc72039a141c6e34a779ef93aef5eb4c82a893c7 -- Nexus wETH Reserves + and block_time > timestamp '2022-08-15' + group by 1 +), + +nxmty_running_total as ( + select + cop.block_date, + sum(t.amount) over (order by cop.block_date) as nxmty_total, + sum(t.amount) over (order by cop.block_date) * cop.nxmty_price as nxmty_in_eth_total + from chainlink_oracle_nxmty_price cop + left join ( + select block_date, sum(amount) as amount + from transfer_combined + where symbol = 'NXMTY' + group by 1 + ) t on cop.block_date = t.block_date +), + +transfer_totals as ( + select + block_date, + sum(case when symbol = 'ETH' then amount end) as eth_total, + sum(case when symbol = 'DAI' then amount end) as dai_total, + sum(case when symbol = 'rETH' then amount end) as reth_total, + sum(case when symbol = 'USDC' then amount end) as usdc_total + from transfer_combined + group by 1 +), + +cover_re_usdc_investment as ( + select + block_time, + block_date, + lead(block_date, 1, date_add('day', 1, current_date)) over (order by block_date) as next_block_date, + amount, + tx_hash + from ( + select + evt_block_time as block_time, + date_trunc('day', evt_block_time) as block_date, + investedUSDC / 1e6 as amount, + evt_tx_hash as tx_hash, + row_number() over (partition by date_trunc('day', evt_block_time) order by evt_block_time desc) as rn + from {{ source('nexusmutual_ethereum', 'SafeTrackerNXMIS_evt_CoverReInvestmentUSDCUpdated') }} + ) t + where t.rn = 1 +), + +aave_current_market as ( + select block_time, block_date, symbol, reserve, liquidity_index, variable_borrow_index + from ( + select + r.evt_block_time as block_time, + date_trunc('day', r.evt_block_time) as block_date, + t.symbol, + r.reserve, + r.liquidityIndex as liquidity_index, + r.variableBorrowIndex as variable_borrow_index, + row_number() over (partition by date_trunc('day', r.evt_block_time), r.reserve order by r.evt_block_number desc, r.evt_index desc) as rn + from {{ source('aave_v3_ethereum', 'Pool_evt_ReserveDataUpdated') }} r + inner join {{ source('tokens', 'erc20') }} as t on r.reserve = t.contract_address and t.blockchain = 'ethereum' + where r.evt_block_time >= timestamp '2024-05-23' + and t.symbol in ('WETH', 'USDC') + ) t + where rn = 1 +), + +aave_supplied as ( + select + block_date, + symbol, + sum(atoken_amount) as atoken_amount + from ( + select + date_trunc('day', s.evt_block_time) as block_date, + t.symbol, + s.amount / power(10, t.decimals) / u.liquidityIndex * power(10, 27) as atoken_amount + from {{ source('aave_v3_ethereum', 'Pool_evt_Supply') }} s + inner join {{ source('tokens', 'erc20') }} t on t.contract_address = s.reserve and t.blockchain = 'ethereum' + inner join {{ source('aave_v3_ethereum', 'Pool_evt_ReserveDataUpdated') }} u + on u.evt_block_number = s.evt_block_number + and u.evt_index < s.evt_index + and u.evt_tx_hash = s.evt_tx_hash + and u.reserve = s.reserve + where s.evt_block_time >= timestamp '2024-05-23' + and s.onBehalfOf = 0x51ad1265C8702c9e96Ea61Fe4088C2e22eD4418e + ) t + group by 1, 2 +), + +aave_supply_withdrawn as ( + select + block_date, + symbol, + sum(atoken_amount) as atoken_amount + from ( + select + date_trunc('day', w.evt_block_time) as block_date, + t.symbol, + w.amount / power(10, t.decimals) / u.liquidityIndex * power(10, 27) as atoken_amount + from {{ source('aave_v3_ethereum', 'Pool_evt_Withdraw') }} w + inner join {{ source('tokens', 'erc20') }} t on t.contract_address = w.reserve and t.blockchain = 'ethereum' + inner join {{ source('aave_v3_ethereum', 'Pool_evt_ReserveDataUpdated') }} u + on u.evt_block_number = w.evt_block_number + and u.evt_index < w.evt_index + and u.evt_tx_hash = w.evt_tx_hash + and u.reserve = w.reserve + where w.evt_block_time >= timestamp '2024-05-23' + and w.user = 0x51ad1265C8702c9e96Ea61Fe4088C2e22eD4418e + ) t + group by 1, 2 +), + +aave_supply_repaid as ( + select + block_date, + symbol, + sum(atoken_amount) as atoken_amount + from ( + select + date_trunc('day', r.evt_block_time) as block_date, + t.symbol, + r.amount / power(10, t.decimals) / u.liquidityIndex * power(10, 27) as atoken_amount + from {{ source('aave_v3_ethereum', 'Pool_evt_Repay') }} r + inner join {{ source('tokens', 'erc20') }} t on t.contract_address = r.reserve and t.blockchain = 'ethereum' + inner join {{ source('aave_v3_ethereum', 'Pool_evt_ReserveDataUpdated') }} u + on u.evt_block_number = r.evt_block_number + and u.evt_index < r.evt_index + and u.evt_tx_hash = r.evt_tx_hash + and u.reserve = r.reserve + where r.evt_block_time >= timestamp '2024-05-23' + and r.user = 0x51ad1265C8702c9e96Ea61Fe4088C2e22eD4418e + and r.useATokens + ) t + group by 1, 2 +), + +aave_supply_liquidated as ( + select + block_date, + symbol, + sum(atoken_amount) as atoken_amount + from ( + select + date_trunc('day', l.evt_block_time) as block_date, + t.symbol, + cast(l.liquidatedCollateralAmount as double) / power(10, t.decimals) / u.liquidityIndex * power(10, 27) as atoken_amount + from {{ source('aave_v3_ethereum', 'Pool_evt_LiquidationCall') }} l + inner join {{ source('tokens', 'erc20') }} t on t.contract_address = l.collateralasset and t.blockchain = 'ethereum' + inner join {{ source('aave_v3_ethereum', 'Pool_evt_ReserveDataUpdated') }} u + on u.evt_block_number = l.evt_block_number + and u.evt_index < l.evt_index + and u.evt_tx_hash = l.evt_tx_hash + and u.reserve = l.collateralAsset + where l.evt_block_time >= timestamp '2024-05-23' + and l.user = 0x51ad1265C8702c9e96Ea61Fe4088C2e22eD4418e + ) t + group by 1, 2 +), + +aave_scaled_supplies as ( + select + cm.block_date, + cm.symbol, + sum( + s.atoken_amount - coalesce(sw.atoken_amount, 0) - coalesce(sr.atoken_amount, 0) - coalesce(sl.atoken_amount, 0) + ) over (order by cm.block_date) * cm.liquidity_index / power(10, 27) as supplied_amount + from aave_current_market cm + left join aave_supplied s on cm.block_date = s.block_date and cm.symbol = s.symbol + left join aave_supply_withdrawn sw on cm.block_date = sw.block_date and cm.symbol = sw.symbol + left join aave_supply_repaid sr on cm.block_date = sr.block_date and cm.symbol = sr.symbol + left join aave_supply_liquidated sl on cm.block_date = sl.block_date and cm.symbol = sl.symbol + where cm.symbol = 'WETH' +), + +aave_borrowed as ( + select + block_date, + symbol, + sum(atoken_amount) as atoken_amount + from ( + select + date_trunc('day', b.evt_block_time) as block_date, + t.symbol, + b.amount / power(10, t.decimals) / u.variableBorrowIndex * power(10, 27) as atoken_amount + from {{ source('aave_v3_ethereum', 'Pool_evt_Borrow') }} b + inner join {{ source('tokens', 'erc20') }} t on b.reserve = t.contract_address and t.blockchain = 'ethereum' + inner join {{ source('aave_v3_ethereum', 'Pool_evt_ReserveDataUpdated') }} u + on u.evt_block_number = b.evt_block_number + and u.evt_index < b.evt_index + and u.evt_tx_hash = b.evt_tx_hash + and u.reserve = b.reserve + where b.evt_block_time >= timestamp '2024-05-23' + and b.onBehalfOf = 0x51ad1265C8702c9e96Ea61Fe4088C2e22eD4418e + ) t + group by 1, 2 +), + +aave_borrow_repaid as ( + select + block_date, + symbol, + sum(atoken_amount) as atoken_amount + from ( + select + date_trunc('day', r.evt_block_time) as block_date, + t.symbol, + r.amount / power(10, t.decimals) / u.variableBorrowIndex * power(10, 27) as atoken_amount + from {{ source('aave_v3_ethereum', 'Pool_evt_Repay') }} r + inner join {{ source('tokens', 'erc20') }} t on t.contract_address = r.reserve and t.blockchain = 'ethereum' + inner join {{ source('aave_v3_ethereum', 'Pool_evt_ReserveDataUpdated') }} u + on u.evt_block_number = r.evt_block_number + and u.evt_index < r.evt_index + and u.evt_tx_hash = r.evt_tx_hash + and u.reserve = r.reserve + where r.evt_block_time >= timestamp '2024-05-23' + and r.user = 0x51ad1265C8702c9e96Ea61Fe4088C2e22eD4418e + and r.useATokens + ) t + group by 1, 2 +), + +aave_borrow_liquidated as ( + select + block_date, + symbol, + sum(atoken_amount) as atoken_amount + from ( + select + date_trunc('day', l.evt_block_time) as block_date, + t.symbol, + cast(l.debtToCover as double) / power(10, t.decimals) / u.variableBorrowIndex * power(10, 27) as atoken_amount + from {{ source('aave_v3_ethereum', 'Pool_evt_LiquidationCall') }} l + inner join {{ source('tokens', 'erc20') }} t on t.contract_address = l.collateralasset and t.blockchain = 'ethereum' + inner join {{ source('aave_v3_ethereum', 'Pool_evt_ReserveDataUpdated') }} u + on u.evt_block_number = l.evt_block_number + and u.evt_index < l.evt_index + and u.evt_tx_hash = l.evt_tx_hash + and u.reserve = l.collateralAsset + where l.evt_block_time >= timestamp '2024-05-23' + and l.user = 0x51ad1265C8702c9e96Ea61Fe4088C2e22eD4418e + ) t + group by 1, 2 +), + +aave_scaled_borrows as ( + select + cm.block_date, + cm.symbol, + sum( + b.atoken_amount - coalesce(br.atoken_amount, 0) - coalesce(bl.atoken_amount, 0) + ) over (order by cm.block_date) * cm.variable_borrow_index / power(10, 27) as borrowed_amount + from aave_current_market cm + left join aave_borrowed b on cm.block_date = b.block_date and cm.symbol = b.symbol + left join aave_borrow_repaid br on cm.block_date = br.block_date and cm.symbol = br.symbol + left join aave_borrow_liquidated bl on cm.block_date = bl.block_date and cm.symbol = bl.symbol + where cm.symbol = 'USDC' +), + +daily_avg_eth_prices as ( + select + date_trunc('day', minute) as block_date, + avg(price) as price_usd + from {{ source('prices', 'usd') }} + where symbol = 'ETH' + and blockchain is null + and contract_address is null + and minute >= timestamp '2019-05-01' + group by 1 +), + +daily_avg_dai_prices as ( + select + date_trunc('day', minute) as block_date, + avg(price) as price_usd + from {{ source('prices', 'usd') }} + where symbol = 'DAI' + and blockchain = 'ethereum' + and contract_address = 0x6b175474e89094c44da98b954eedeac495271d0f + and minute >= timestamp '2019-07-12' + group by 1 +), + +daily_avg_reth_prices as ( + select + date_trunc('day', minute) as block_date, + avg(price) as price_usd + from {{ source('prices', 'usd') }} + where symbol = 'rETH' + and blockchain = 'ethereum' + and contract_address = 0xae78736cd615f374d3085123a210448e74fc6393 + and minute >= timestamp '2021-09-30' + group by 1 +), + +daily_avg_usdc_prices as ( + select + date_trunc('day', minute) as block_date, + avg(price) as price_usd + from {{ source('prices', 'usd') }} + where symbol = 'USDC' + and blockchain = 'ethereum' + and contract_address = 0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48 + and minute >= timestamp '2019-05-01' + group by 1 +), + +day_sequence as ( + select cast(d.seq_date as timestamp) as block_date + from (select sequence(date '2019-05-23', current_date, interval '1' day) as days) as days_s + cross join unnest(days) as d(seq_date) +), + +daily_running_totals as ( + select + ds.block_date, + sum(coalesce(tt.eth_total, 0)) over (order by ds.block_date) as eth_total, + sum(coalesce(tt.dai_total, 0)) over (order by ds.block_date) as dai_total, + sum(coalesce(tt.reth_total, 0)) over (order by ds.block_date) as reth_total, + sum(coalesce(tt.usdc_total, 0)) over (order by ds.block_date) as usdc_total, + coalesce(steth_rt.steth_total, lag(steth_rt.steth_total) over (order by ds.block_date), 0) as steth_total, + coalesce(nxmty_rt.nxmty_total, lag(nxmty_rt.nxmty_total) over (order by ds.block_date), 0) as nxmty_total, + coalesce(nxmty_rt.nxmty_in_eth_total, lag(nxmty_rt.nxmty_in_eth_total) over (order by ds.block_date), 0) as nxmty_eth_total, + coalesce(cre.amount, 0) as cover_re_usdc_total, + coalesce(aave_s.supplied_amount, 0) as aave_collateral_weth_total, + -1 * coalesce(aave_b.borrowed_amount, 0) as aave_debt_usdc_total + from day_sequence ds + left join transfer_totals tt on ds.block_date = tt.block_date + left join steth_running_total steth_rt on ds.block_date = steth_rt.block_date + left join nxmty_running_total nxmty_rt on ds.block_date = nxmty_rt.block_date + left join aave_scaled_supplies aave_s on ds.block_date = aave_s.block_date + left join aave_scaled_borrows aave_b on ds.block_date = aave_b.block_date + left join cover_re_usdc_investment cre on ds.block_date >= cre.block_date and ds.block_date < cre.next_block_date +), + +daily_running_totals_enriched as ( + select + drt.block_date, + coalesce(p_avg_eth.price_usd, 0) as avg_eth_usd_price, + -- ETH + coalesce(drt.eth_total, 0) as eth_total, + coalesce(drt.eth_total * p_avg_eth.price_usd, 0) as avg_eth_usd_total, + -- DAI + coalesce(drt.dai_total, 0) as dai_total, + coalesce(drt.dai_total * p_avg_dai.price_usd, 0) as avg_dai_usd_total, + coalesce(drt.dai_total * p_avg_dai.price_usd / p_avg_eth.price_usd, 0) as avg_dai_eth_total, + -- NXMTY + coalesce(drt.nxmty_total, 0) as nxmty_total, + coalesce(drt.nxmty_eth_total, 0) as nxmty_eth_total, + coalesce(drt.nxmty_eth_total * p_avg_eth.price_usd, 0) as avg_nxmty_usd_total, + -- stETH + coalesce(drt.steth_total, 0) as steth_total, + coalesce(drt.steth_total * p_avg_eth.price_usd, 0) as avg_steth_usd_total, + -- rETH + coalesce(drt.reth_total, 0) as reth_total, + coalesce(drt.reth_total * p_avg_reth.price_usd, 0) as avg_reth_usd_total, + coalesce(drt.reth_total * p_avg_reth.price_usd / p_avg_eth.price_usd, 0) as avg_reth_eth_total, + -- USDC + coalesce(drt.usdc_total, 0) as usdc_total, + coalesce(drt.usdc_total * p_avg_usdc.price_usd, 0) as avg_usdc_usd_total, + coalesce(drt.usdc_total * p_avg_usdc.price_usd / p_avg_eth.price_usd, 0) as avg_usdc_eth_total, + -- Cover Re USDC investment + coalesce(drt.cover_re_usdc_total, 0) as cover_re_usdc_total, + coalesce(drt.cover_re_usdc_total * p_avg_usdc.price_usd, 0) as avg_cover_re_usdc_usd_total, + coalesce(drt.cover_re_usdc_total * p_avg_usdc.price_usd / p_avg_eth.price_usd, 0) as avg_cover_re_usdc_eth_total, + -- AAVE positions + coalesce(drt.aave_collateral_weth_total, 0) as aave_collateral_weth_total, + coalesce(drt.aave_collateral_weth_total * p_avg_eth.price_usd, 0) as avg_aave_collateral_weth_usd_total, + coalesce(drt.aave_debt_usdc_total, 0) as aave_debt_usdc_total, + coalesce(drt.aave_debt_usdc_total * p_avg_usdc.price_usd, 0) as avg_aave_debt_usdc_usd_total, + coalesce(drt.aave_debt_usdc_total * p_avg_usdc.price_usd / p_avg_eth.price_usd, 0) as avg_aave_debt_usdc_eth_total + from daily_running_totals drt + inner join daily_avg_eth_prices p_avg_eth on drt.block_date = p_avg_eth.block_date + left join daily_avg_dai_prices p_avg_dai on drt.block_date = p_avg_dai.block_date + left join daily_avg_reth_prices p_avg_reth on drt.block_date = p_avg_reth.block_date + left join daily_avg_usdc_prices p_avg_usdc on drt.block_date = p_avg_usdc.block_date +) + +select + block_date, + avg_eth_usd_price, + -- Capital Pool totals + eth_total + nxmty_eth_total + steth_total + avg_dai_eth_total + avg_reth_eth_total + avg_usdc_eth_total + + avg_cover_re_usdc_eth_total + aave_collateral_weth_total + avg_aave_debt_usdc_eth_total as avg_capital_pool_eth_total, + avg_eth_usd_total + avg_nxmty_usd_total + avg_steth_usd_total + avg_dai_usd_total + avg_reth_usd_total + avg_usdc_usd_total + + avg_cover_re_usdc_usd_total + avg_aave_collateral_weth_usd_total + avg_aave_debt_usdc_usd_total as avg_capital_pool_usd_total, + -- ETH + eth_total, + avg_eth_usd_total, + -- DAI + dai_total, + avg_dai_usd_total, + avg_dai_eth_total, + -- NXMTY + nxmty_total, + nxmty_eth_total, + avg_nxmty_usd_total, + -- stETH + steth_total, + avg_steth_usd_total, + -- rETH + reth_total, + avg_reth_usd_total, + avg_reth_eth_total, + -- USDC + usdc_total, + avg_usdc_usd_total, + avg_usdc_eth_total, + -- Cover Re USDC investment + cover_re_usdc_total, + avg_cover_re_usdc_usd_total, + avg_cover_re_usdc_eth_total, + -- AAVE positions + aave_collateral_weth_total, + avg_aave_collateral_weth_usd_total, + aave_debt_usdc_total, + avg_aave_debt_usdc_usd_total, + avg_aave_debt_usdc_eth_total +from daily_running_totals_enriched +{% if is_incremental() %} +where {{ incremental_predicate('block_date') }} +{% endif %} diff --git a/models/nexusmutual/ethereum/capital_pool/nexusmutual_ethereum_capital_pool_transfers.sql b/models/nexusmutual/ethereum/capital_pool/nexusmutual_ethereum_capital_pool_transfers.sql new file mode 100644 index 00000000000..08a1ab17190 --- /dev/null +++ b/models/nexusmutual/ethereum/capital_pool/nexusmutual_ethereum_capital_pool_transfers.sql @@ -0,0 +1,123 @@ +{{ + config( + schema = 'nexusmutual_ethereum', + alias = 'capital_pool_transfers', + materialized = 'incremental', + file_format = 'delta', + incremental_strategy = 'merge', + unique_key = ['block_time', 'transfer_type', 'symbol', 'unique_key', 'tx_hash'], + incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.block_time')], + post_hook = '{{ expose_spells(\'["ethereum"]\', + "project", + "nexusmutual", + \'["tomfutago"]\') }}' + ) +}} + +with + +nexusmutual_contracts (contract_address) as ( + values + (0xcafeaBED7e0653aFe9674A3ad862b78DB3F36e60), --Pool (active), deployed: Nov-21-2023 + (0xcafea112Db32436c2390F5EC988f3aDB96870627), --Pool (Pool V2), deployed: Mar-08-2023 + (0xcafea35ce5a2fc4ced4464da4349f81a122fd12b), --Pool (Pool3), deployed: May-25-2021 + (0xcafea7934490ef8b9d2572eaefeb9d48162ea5d8), --Pool (old), deployed: Jan-26-2021 + (0xcafeada4d15bbc7592113d5d5af631b5dcd53dcb), --Pool2 (Pool 4), deployed: Jan-26-2021 + (0xfd61352232157815cf7b71045557192bf0ce1884), --Pool1, deployed: May-23-2019 + (0x7cbe5682be6b648cc1100c76d4f6c96997f753d6), --Pool2, deployed: May-23-2019 + (0xcafea8321b5109d22c53ac019d7a449c947701fb), --MCR, deployed: May-25-2021 + (0xcafea92739e411a4D95bbc2275CA61dE6993C9a7), --MCR, deployed: Nov-21-2023 + (0x51ad1265C8702c9e96Ea61Fe4088C2e22eD4418e) --Advisory Board multisig +), + +transfer_in as ( + select + block_time, + block_number, + date_trunc('day', block_time) as block_date, + 'in' as transfer_type, + symbol, + amount, + contract_address, + unique_key, + tx_hash + from {{ ref('tokens_ethereum_transfers') }} + where block_time >= timestamp '2019-05-01' + and "to" in (select contract_address from nexusmutual_contracts) + and symbol in ('ETH', 'DAI', 'stETH', 'rETH', 'USDC') + {% if is_incremental() %} + and {{ incremental_predicate('block_time') }} + {% endif %} +), + +transfer_out as ( + select + block_time, + block_number, + date_trunc('day', block_time) as block_date, + 'out' as transfer_type, + symbol, + -1 * amount as amount, + contract_address, + unique_key, + tx_hash + from {{ ref('tokens_ethereum_transfers') }} + where block_time >= timestamp '2019-05-01' + and "from" in (select contract_address from nexusmutual_contracts) + and symbol in ('ETH', 'DAI', 'stETH', 'rETH', 'USDC') + {% if is_incremental() %} + and {{ incremental_predicate('block_time') }} + {% endif %} +), + +transfer_nxmty_in as ( + select + block_time, + block_number, + date_trunc('day', block_time) as block_date, + 'in' as transfer_type, + 'NXMTY' as symbol, + cast(amount_raw as double) / 1e18 as amount, + contract_address, + unique_key, + tx_hash + from {{ ref('tokens_ethereum_transfers') }} + where block_time >= timestamp '2022-05-27' + and "to" in (select contract_address from nexusmutual_contracts) + and contract_address = 0x27f23c710dd3d878fe9393d93465fed1302f2ebd --NXMTY + {% if is_incremental() %} + and {{ incremental_predicate('block_time') }} + {% endif %} +), + +transfer_nxmty_out as ( + select + block_time, + block_number, + date_trunc('day', block_time) as block_date, + 'out' as transfer_type, + 'NXMTY' as symbol, + -1 * cast(amount_raw as double) / 1e18 as amount, + contract_address, + unique_key, + tx_hash + from {{ ref('tokens_ethereum_transfers') }} + where block_time >= timestamp '2022-05-27' + and "from" in (select contract_address from nexusmutual_contracts) + and contract_address = 0x27f23c710dd3d878fe9393d93465fed1302f2ebd --NXMTY + {% if is_incremental() %} + and {{ incremental_predicate('block_time') }} + {% endif %} +) + +select block_time, block_number, block_date, transfer_type, symbol, amount, contract_address, unique_key, tx_hash +from transfer_in +union all +select block_time, block_number, block_date, transfer_type, symbol, amount, contract_address, unique_key, tx_hash +from transfer_out +union all +select block_time, block_number, block_date, transfer_type, symbol, amount, contract_address, unique_key, tx_hash +from transfer_nxmty_in +union all +select block_time, block_number, block_date, transfer_type, symbol, amount, contract_address, unique_key, tx_hash +from transfer_nxmty_out diff --git a/models/nexusmutual/ethereum/nexusmutual_ethereum_schema.yml b/models/nexusmutual/ethereum/nexusmutual_ethereum_schema.yml index 5cae9fec18b..9889e261c89 100644 --- a/models/nexusmutual/ethereum/nexusmutual_ethereum_schema.yml +++ b/models/nexusmutual/ethereum/nexusmutual_ethereum_schema.yml @@ -125,36 +125,6 @@ models: - &token_address name: token_address - - name: nexusmutual_ethereum_capital_pool_eth_daily_transaction_summary - meta: - blockchain: ethereum - project: nexusmutual - contributors: [guyhow] - config: - tags: ["ethereum","nexusmutual","trades"] - description: > - Daily summary for ethereum entering and leaving the nexus mutual capital pool contracts - #tests: - # - check_seed: - # seed_file: ref("nexusmutual_ethereum_capital_pool_eth_daily_transaction_summary_seed") - # match_columns: - # - day - # check_columns: - # - eth_ingress - # - eth_egress - columns: - - &day - name: day - description: "Table primary key: day of summarised transctions" - tests: - - unique - - ð_ingress - name: ingress ethereum - description: "Sum of incoming transctions over the time covered by day" - - ð_egress - name: egress ethereum - description: "Sum of outgoing transctions over the time covered by day" - - name: nexusmutual_ethereum_staking_pools meta: blockchain: ethereum diff --git a/sources/_sector/lending/supply/ethereum/_sources.yml b/sources/_sector/lending/supply/ethereum/_sources.yml index adcba7fcdd2..0799f2b28a4 100644 --- a/sources/_sector/lending/supply/ethereum/_sources.yml +++ b/sources/_sector/lending/supply/ethereum/_sources.yml @@ -16,6 +16,7 @@ sources: tables: - name: Pool_evt_Supply - name: Pool_evt_Withdraw + - name: Pool_evt_ReserveDataUpdated - name: compound_v2_ethereum tables: diff --git a/sources/_subprojects/daily_spellbook/chainlink_sources.yml b/sources/_subprojects/daily_spellbook/chainlink_sources.yml new file mode 100644 index 00000000000..cbae66c916d --- /dev/null +++ b/sources/_subprojects/daily_spellbook/chainlink_sources.yml @@ -0,0 +1,9 @@ +version: 2 +sources: + - name: chainlink + tables: + - name: price_feeds + + - name: chainlink_ethereum + tables: + - name: price_feeds diff --git a/sources/nexusmutual/ethereum/nexusmutual_ethereum_sources.yml b/sources/nexusmutual/ethereum/nexusmutual_ethereum_sources.yml index 988394f7306..3ee02b81d8a 100644 --- a/sources/nexusmutual/ethereum/nexusmutual_ethereum_sources.yml +++ b/sources/nexusmutual/ethereum/nexusmutual_ethereum_sources.yml @@ -15,3 +15,6 @@ sources: - name: StakingProducts_evt_ProductUpdated - name: StakingPool_call_manager - name: StakingPool_evt_PoolFeeChanged + - name: SafeTrackerNXMIS_evt_CoverReInvestmentUSDCUpdated + - name: MCR_evt_MCREvent + - name: MCR_evt_MCRUpdated From 4ce1437b197d8019a6d8ebd69db186fa6b8b0399 Mon Sep 17 00:00:00 2001 From: 0xrusowsky <90208954+0xrusowsky@users.noreply.github.com> Date: Mon, 3 Jun 2024 19:58:25 +0200 Subject: [PATCH 019/149] feat: setup ALM trades + feed Arrakis data (#5764) * feat: uniV3 basic lp info * fix: compilation errors * fix: missing alias * Fix mismatched alias * fix: alias typo * fix: aslias mismatch * fix: missing alias * fix: remove duplicates * fix: remove duplicates * fix: position manager ids * fix: position mannager join * fix: position manager id * fix: use variable properly * fix: cast input address * hardcode position manager address * fix: burns * fix: wrong table * feat: arrakis trades * fix: schema name * fix: undo uniswap source changes * fix: add alm sources * fix sources: arrakis_v2 to arrakis_finance * fix: missing source * fix: aliases * fix: missing aggregation * fix: typo * fix: missing parameter * fix: rename schema * fix: schema * Add missing sources * Revert "Add missing sources" This reverts commit 597d662078086aaeb80f77beacf6560a29c62095. * Fix CTE name * Comment unclear ref i lines * Comment volumn[0|1|_usd] * fix: missing erc20 import * fix: column name * fix: union query * fix: alias * fix: missing fields * fix: usd price calculation * fix: add swap volume * fix: use evt_index in liquidity_ts * fix: substract burns from mints * test: liquidity_ts * fix: evt_index usage * fix: wrong volume for pool with multiple vaults * test: volume usd * fix: price test * fix: aliases * fix: volume usd * style: nice-to-have fields * fix: swap volume * docs: add comments and field descriptions * update yml version Co-authored-by: Huang Geyang * fix: incremental * fix: hosuke's feedback * Add alm_ethereum_base_trades in schema * Fix schema * remove `base_` from schema Co-authored-by: jeff-dude <102681548+jeff-dude@users.noreply.github.com> * fix: alm_ethereum_base_trades as view * Remove incremental part * Fix name * Rename alm_trades * remove _base_ naming standard * docs: sector readme * fix typos on spell name in readme --------- Co-authored-by: Huang Geyang Co-authored-by: jeff-dude <102681548+jeff-dude@users.noreply.github.com> Co-authored-by: jeff-dude --- macros/models/_sector/add_pool_price_usd.sql | 57 ++++ .../_sector/alm/arrakis_compatible_trades.sql | 292 ++++++++++++++++++ models/_sector/alm/README.md | 192 ++++++++++++ models/_sector/alm/_schema.yml | 99 ++++++ models/_sector/alm/alm_trades.sql | 67 ++++ models/_sector/alm/ethereum/_schema.yml | 26 ++ .../alm/ethereum/alm_ethereum_trades.sql | 58 ++++ .../arrakis_finance_ethereum_trades.sql | 25 ++ sources/_sector/alm/ethereum/_sources.yml | 5 + .../ethereum/arrakis_ethereum_sources.yml | 10 + 10 files changed, 831 insertions(+) create mode 100644 macros/models/_sector/add_pool_price_usd.sql create mode 100644 macros/models/_sector/alm/arrakis_compatible_trades.sql create mode 100644 models/_sector/alm/README.md create mode 100644 models/_sector/alm/_schema.yml create mode 100644 models/_sector/alm/alm_trades.sql create mode 100644 models/_sector/alm/ethereum/_schema.yml create mode 100644 models/_sector/alm/ethereum/alm_ethereum_trades.sql create mode 100644 models/_sector/alm/ethereum/platforms/arrakis_finance_ethereum_trades.sql create mode 100644 sources/_sector/alm/ethereum/_sources.yml create mode 100644 sources/arrakis/ethereum/arrakis_ethereum_sources.yml diff --git a/macros/models/_sector/add_pool_price_usd.sql b/macros/models/_sector/add_pool_price_usd.sql new file mode 100644 index 00000000000..7a1524d02cc --- /dev/null +++ b/macros/models/_sector/add_pool_price_usd.sql @@ -0,0 +1,57 @@ +{% macro add_pool_price_usd( + pool_prices_cte +) %} + +-- This macro adds the price_usd column to the pool_prices_cte +-- Required columns in pool_prices_cte: + -- blockchain + -- , token0_address + -- , token1_address + -- , price + -- , block_time + +WITH trusted_tokens AS ( + SELECT contract_address + , blockchain + FROM {{ ref('prices_trusted_tokens') }} +) +, prices AS ( + SELECT + blockchain + , contract_address + , minute + , price + FROM + {{ source('prices','usd') }} + {% if is_incremental() %} + WHERE + {{ incremental_predicate('minute') }} + {% endif %} +) + +SELECT + pp.* + , COALESCE( + CASE WHEN tt0.contract_address IS NOT NULL THEN pp.price / p0.price END, + CASE WHEN tt1.contract_address IS NOT NULL THEN p1.price * pp.price END, + pp.price / p0.price, + p1.price * pp.price + ) AS price_usd +FROM + {{ pool_prices_cte }} pp +LEFT JOIN prices p0 + ON pp.token0_address = p0.contract_address + AND pp.blockchain = p0.blockchain + AND p0.minute = date_trunc('minute', pp.block_time) +LEFT JOIN prices p1 + ON pp.token1_address = p1.contract_address + AND pp.blockchain = p1.blockchain + AND p1.minute = date_trunc('minute', pp.block_time) +LEFT JOIN trusted_tokens tt0 + ON pp.token0_address = tt0.contract_address + AND pp.blockchain = tt0.blockchain +LEFT JOIN trusted_tokens tt1 + ON pp.token1_address = tt1.contract_address + AND pp.blockchain = tt1.blockchain + +{% endmacro %} diff --git a/macros/models/_sector/alm/arrakis_compatible_trades.sql b/macros/models/_sector/alm/arrakis_compatible_trades.sql new file mode 100644 index 00000000000..2fc143bb012 --- /dev/null +++ b/macros/models/_sector/alm/arrakis_compatible_trades.sql @@ -0,0 +1,292 @@ +/* + In order to compute the aggregated volume traded through the liquidity owned by a given vault, + first we need to compute: + - All the arrakis vaults created by the factory (arrakis_vaults) + - The liquidity of each vault at every swap (liquidity_ts) + - The price of each pool at every swap (pool_price_ts) + - The price of each pool in USD at every swap (pool_price_usd_ts) + - The volume traded through each vault at every swap (vault_swaps) +*/ + +{% macro arrakis_compatible_v2_trades( + blockchain = null + , project = null + , version = null + , dex = null + , dex_version = null + , Pair_evt_Mint = null + , Pair_evt_Burn = null + , Pair_evt_Swap = null + , Factory_evt_PoolCreated = null + , ArrakisV2Factory_evt_VaultCreated = null + ) +%} + +------------------------------------------------------------------------------------------ +-- GET POOL LIQUIDITY -------------------------------------------------------------------- +------------------------------------------------------------------------------------------ + +WITH arrakis_vaults AS +( + SELECT DISTINCT a.evt_block_time as creation_time + , a.vault as vault_address + , f.token0 AS token0_address + , f.token1 AS token1_address + , m.contract_address AS pool_address + FROM + {{ Pair_evt_Mint }} as m + INNER JOIN + {{ ArrakisV2Factory_evt_VaultCreated }} as a + ON a.evt_block_time <= m.evt_block_time AND a.vault = m.owner + INNER JOIN + {{ Factory_evt_PoolCreated }} as f + ON f.evt_block_time <= m.evt_block_time AND f.pool = m.contract_address +) + +, mints AS +( + SELECT m.evt_block_number AS block_number + , m.evt_block_time AS block_time + , m.evt_tx_hash AS tx_hash + , m.evt_index + , m.owner AS vault_address + , m.tickLower AS tick_lower + , m.tickUpper AS tick_upper + , m.amount AS liquidity + , m.contract_address AS pool_address + FROM + {{ Pair_evt_Mint }} as m + INNER JOIN + arrakis_vaults as a + ON a.creation_time <= m.evt_block_time AND a.pool_address = m.contract_address AND a.vault_address = m.owner + {% if is_incremental() %} + WHERE + {{ incremental_predicate('m.evt_block_time') }} + {% endif %} +) + +, burns AS +( + SELECT b.evt_block_number AS block_number + , b.evt_block_time AS block_time + , b.evt_tx_hash AS tx_hash + , b.evt_index + , b.owner AS vault_address + , b.tickLower AS tick_lower + , b.tickUpper AS tick_upper + , -b.amount AS liquidity + , b.contract_address AS pool_address + FROM + {{ Pair_evt_Burn }} as b + INNER JOIN + arrakis_vaults as a + ON a.creation_time <= b.evt_block_time AND a.pool_address = b.contract_address AND a.vault_address = b.owner + {% if is_incremental() %} + WHERE + {{ incremental_predicate('b.evt_block_time') }} + {% endif %} +) + +, lp_data AS ( + SELECT block_number + , block_time + , evt_index + , pool_address + , vault_address + , tick_lower + , tick_upper + , SUM(liquidity) OVER (PARTITION BY tick_lower, tick_upper, pool_address, vault_address ORDER BY block_number ASC, evt_index ASC) AS liquidity + FROM ( + SELECT block_number + , block_time + , evt_index + , pool_address + , vault_address + , tick_lower + , tick_upper + , SUM(liquidity) AS liquidity + FROM ( + SELECT * FROM mints + UNION ALL + SELECT * FROM burns + ) mints_and_burns + GROUP BY 1,2,3,4,5,6,7 + ) lp_data +) + +, time_series AS ( + -- all liquidity events + SELECT DISTINCT block_time, evt_index, pool_address + FROM lp_data + UNION DISTINCT + -- all swap events + SELECT DISTINCT s.evt_block_time AS block_time, s.evt_index, a.pool_address + FROM {{ Pair_evt_Swap }} as s + INNER JOIN arrakis_vaults as a + ON a.creation_time <= s.evt_block_time AND a.pool_address = s.contract_address + {% if is_incremental() %} + WHERE + {{ incremental_predicate('s.evt_block_time') }} + {% endif %} +) + +, liquidity_ts AS ( + SELECT * FROM ( + SELECT DISTINCT block_time + , evt_index + , pool_address + , vault_address + , tick_lower + , tick_upper + , POWER(1.0001, tick_lower) AS pa + , POWER(1.0001, tick_upper) AS pb + , MIN(liquidity) OVER (PARTITION BY pool_address, tick_lower, tick_upper, adj_index ORDER BY block_time ASC, evt_index ASC) AS liquidity + FROM ( + SELECT *, SUM(index_check) OVER (PARTITION BY pool_address, tick_lower, tick_upper ORDER BY block_time ASC, evt_index ASC) AS adj_index + FROM ( + SELECT ts.* + , l.liquidity + , CASE WHEN l.liquidity IS NOT NULL THEN 1 END AS index_check + FROM ( + SELECT DISTINCT ts.*, l.vault_address, l.tick_lower, l.tick_upper + FROM time_series AS ts + INNER JOIN lp_data AS l + ON ts.pool_address = l.pool_address + ) AS ts + LEFT JOIN lp_data AS l + ON ts.block_time = l.block_time AND ts.evt_index = l.evt_index AND + ts.pool_address = l.pool_address AND ts.vault_address = l.vault_address AND + ts.tick_lower = l.tick_lower AND ts.tick_upper = l.tick_upper + ) AS l + ) AS l_adj + ) WHERE liquidity is not null AND liquidity > 0 +) + +------------------------------------------------------------------------------------------ +-- GET POOL PRICE ------------------------------------------------------------------------ +------------------------------------------------------------------------------------------ + +, pool_price_ts AS ( + SELECT p.* + , a.token0_address + , a.token1_address + , '{{ blockchain }}' AS blockchain + FROM ( + SELECT DISTINCT block_time + , pool_address + , MIN(price) OVER (PARTITION BY pool_address, adj_index ORDER BY block_time) AS price + FROM ( + SELECT *, SUM(index_check) OVER (PARTITION BY pool_address ORDER BY block_time) AS adj_index + FROM ( + SELECT ts.block_time + , ts.pool_address + , AVG(POWER(1.0001, s.tick)) AS price + , CASE WHEN s.tick IS NOT NULL THEN 1 END AS index_check + FROM time_series AS ts + LEFT JOIN {{ Pair_evt_Swap }} AS s + ON ts.pool_address = s.contract_address AND ts.block_time = s.evt_block_time + GROUP BY 1,2,4 + ) AS p + ) AS p_adj + ) AS p + INNER JOIN arrakis_vaults AS a + ON a.pool_address = p.pool_address + WHERE price IS NOT NULL +) + +, pool_price_usd_ts AS ( + {{ + add_pool_price_usd( + pool_prices_cte = 'pool_price_ts' + ) + }} +) + +------------------------------------------------------------------------------------------ +-- GET VOLUME PROVIDED BY EACH VAULT ----------------------------------------------------- +------------------------------------------------------------------------------------------ + +,vault_swaps as ( + select distinct s.block_time + , s.block_number + , s.tx_hash + , s.evt_index + , s.pool_address + , s.vault_address + , greatest(least(s.sqrt_price, sqrt(lp.pb)), sqrt(lp.pa)) as sqrt_price + , greatest(least(s.prev_sqrt_price, sqrt(lp.pb)), sqrt(lp.pa)) as prev_sqrt_price + , lp.liquidity + , s.swap_volume0 + , s.swap_volume1 + from liquidity_ts as lp + inner join ( + SELECT s.evt_block_time as block_time + , s.evt_block_number as block_number + , s.evt_tx_hash as tx_hash + , s.evt_index + , a.pool_address + , a.vault_address + , lag(cast(s.sqrtPriceX96 as double), 1) over (partition by a.pool_address order by s.evt_block_number asc, s.evt_index asc) / pow(2,96) as prev_sqrt_price + , cast(s.sqrtPriceX96 as double) / pow(2,96) as sqrt_price + , abs(cast(s.amount0 as double)) as swap_volume0 + , abs(cast(s.amount1 as double)) as swap_volume1 + FROM {{ Pair_evt_Swap }} AS s + INNER JOIN arrakis_vaults AS a + ON a.creation_time <= s.evt_block_time AND a.pool_address = s.contract_address + {% if is_incremental() %} + WHERE + {{ incremental_predicate('s.evt_block_time') }} + {% endif %} + ) AS s ON s.block_time = lp.block_time AND s.evt_index = lp.evt_index AND s.pool_address = lp.pool_address AND s.vault_address = lp.vault_address + -- overlapping ranges only + where sqrt(lp.pa) <= (case when s.sqrt_price > s.prev_sqrt_price then s.sqrt_price else s.prev_sqrt_price end) + and (case when s.prev_sqrt_price < s.sqrt_price then s.prev_sqrt_price else s.sqrt_price end) <= sqrt(lp.pb) +) + +select distinct '{{ blockchain }}' AS blockchain + , '{{ project }}' AS project + , '{{ version }}' AS version + , '{{ dex }}' AS dex + , '{{ dex_version }}' AS dex_version + , v.block_time + , date_trunc('MONTH',v.block_time) AS block_month + , v.block_number + , v.tx_hash + , v.evt_index + , a.pool_address + , a.vault_address + , concat(t0.symbol, '-', t1.symbol) as token_pair + , a.token0_address + , a.token1_address + , v.volume1 / p.price AS volume0_raw + , v.volume1 / (p.price * power(10, coalesce(t0.decimals, 18))) AS volume0 + , v.swap_volume0 / power(10, coalesce(t0.decimals, 18)) AS swap_volume0 + , t0.symbol AS token0_symbol + , v.volume1 AS volume1_raw + , v.volume1 / power(10, coalesce(t1.decimals, 18)) AS volume1 + , v.swap_volume1 / power(10, coalesce(t1.decimals, 18)) AS swap_volume1 + , t1.symbol AS token1_symbol + , p.price + , p.price_usd + , v.volume1 / (p.price * power(10, coalesce(t0.decimals, 18))) * p.price_usd AS volume_usd + , v.swap_volume1 / (p.price * power(10, coalesce(t0.decimals, 18))) * p.price_usd AS swap_volume_usd + , v.volume1 / v.swap_volume1 AS volume_share +from ( + select block_time + , block_number + , tx_hash + , evt_index + , pool_address + , vault_address + , sum(liquidity * abs(prev_sqrt_price - sqrt_price)) as volume1 + , sum(swap_volume0) as swap_volume0 + , sum(swap_volume1) as swap_volume1 + from vault_swaps + group by 1,2,3,4,5,6 +) as v +inner join pool_price_usd_ts as p on p.block_time = v.block_time and p.pool_address = v.pool_address +inner join arrakis_vaults as a on a.pool_address = v.pool_address and a.vault_address = v.vault_address + and a.token0_address = p.token0_address and a.token1_address = p.token1_address +left join {{ source('tokens', 'erc20') }} as t0 on t0.contract_address = a.token0_address and t0.blockchain = '{{ blockchain }}' +left join {{ source('tokens', 'erc20') }} as t1 on t1.contract_address = a.token1_address and t1.blockchain = '{{ blockchain }}' +{% endmacro %} \ No newline at end of file diff --git a/models/_sector/alm/README.md b/models/_sector/alm/README.md new file mode 100644 index 00000000000..64b40fc9f58 --- /dev/null +++ b/models/_sector/alm/README.md @@ -0,0 +1,192 @@ +# README for `alm.trades` + +Welcome to the `models/_sector/alm/` directory of our project. This README provides essential information on contributing to the `alm` sector models, insights into our design choices, and outlines the next steps in the `alm.trades` redesign workstream. + +## Table of Contents + +- [How to Contribute](#how-to-contribute) +- [Project Structure Details](#project-structure-details) +- [Adding New Sources](#adding-new-sources) +- [Defining Model Schemas](#defining-model-schemas) +- [Model Config Settings](#model-config-settings) +- [Example PRs](#example-prs) +- [PR Submission Guidelines](#pr-submission-guidelines) +- [Further Information](#further-information) +- [Contact](#contact) + +## How to Contribute + +### Understanding the Structure + +Familiarize yourself with the current structure and conventions used in the `alm` sector models. + +### Making Changes + +For any changes or additions, please fork the repository and create your feature branch from `main`. + +### Pull Requests (PRs) + +Submit PRs with clear descriptions of changes and reference related issues or discussions. + +### Code Review + +PRs will be reviewed by the team. Constructive feedback and suggestions are welcomed. + +## Project Structure Details + +### Overview + +Similar to `dex.trades` this model aims to easily serve data regarding the subset of traded volume that were served by liquidity managed by protocols such as Arrakis Finance, or Gamma, etc. +Because of that, the `alm.trades` design mimics the one used for `dex.trades`. + +### Data Flow Architecture + +As previously said, the architecture of `alm.trades` mimics the one of `dex.trades`. Because of that, [this diagram](https://github.com/duneanalytics/spellbook/blob/main/models/_sector/dex/readme.md#data-flow-architecture) can be taken as a reference. +In `alm.trades`, the 2 macros used are: +- `arrakis_compatible_v2_trades`: which tracks all the Uniswap V3 LP positions (timestamp, liquidity, and tick information) minted by Arrakis Finance vaults, and then derives the volume served for each swap based on the price movement of the pool. +- `add_pool_price_usd`: which uses `prices.usd` to populate the pool price in USD, so the volume served can be expressed in USD terms. + +### Core Components + +- **Base Project-Level Spells**: Contain only data from raw & decoded source tables, serving as building blocks for `alm.trades`. +- **Chain Union Spells**: Utilize a dbt macro to standardize a union of input spells on the same blockchain. +- **Sector Union Spell**: Enriches the raw/decoded data with necessary metadata at the `alm.trades` level. + +### Naming Standards + +Adoption of `arrakis_` for macro names. + +### Directory Structure + +- Macros/Models: `macros/models/_sector/alm/` +- Platforms: `models/_sector/alm/trades//platforms/` + +### Materialization Strategy + +- Platform/Project Level: Incremental. +- Blockchain Level: View. +- Sector Level: Incremental. + +### Macro vs. Code in Model + +- Standalone protocols can have code directly in the model. +- Those protocols which are forks, or deployed in multiple chains, or with repeatable logic, should utilize or create macros. + +### Macro Usage Example + +Below is an example of how to use the [`arrakis_compatible_v2_trades` macro](/macros/models/_sector/alm/arrakis_compatible_trades.sql) macro within our project. This macro is designed to standardize the trades data for projects compatible with Arrakis V2 on various blockchains. + +```sql +{{ + arrakis_compatible_v2_trades( + blockchain = 'arbitrum', + project = 'arrakis', + version = '2', + dex = 'uniswap', + dex_version = '3', + Pair_evt_Mint = source('uniswap_v3_ethereum', 'Pair_evt_Mint'), + Pair_evt_Burn = source('uniswap_v3_ethereum', 'Pair_evt_Burn'), + Pair_evt_Swap = source('uniswap_v3_ethereum', 'Pair_evt_Swap'), + Factory_evt_PoolCreated = source('uniswap_v3_ethereum', 'Factory_evt_PoolCreated'), + ArrakisV2Factory_evt_VaultCreated = source('arrakis_finance_ethereum', 'ArrakisV2Factory_evt_VaultCreated') + ) +}} +``` + +## Adding New Sources + +When incorporating new data sources into the `alm` sector, it's essential to properly define them in our dbt project. Here’s how to add new sources: + +1. **Locate the Source YML File**: Navigate to `sources/_sector/alm/[blockchain]` in the project directory. + +2. **Edit the `_sources.yml` File**: Within this file, you’ll define the new source tables. Provide the necessary details such as name, description, database, schema, and table identifier. Here’s an example: + +```yaml +version: 2 + +sources: + - name: arrakis_v2_ethereum + - name: uniswap_v3_ethereum +``` + +## Defining Model Schemas + +For each model in the DEX sector, we must define its schema. This schema outlines the structure of the model and the definitions of its columns. Here’s how to add a schema for a model: + +1. **Locate the Schema YML File**: Go to `models/_sector/dex/trades/[blockchain]` in the project directory. + +2. **Edit the `_schema.yml` File**: Add the schema definition for your model. This includes specifying column names, types, descriptions, and any tests that should be applied to the columns. For example: + +```yaml +version: 2 + +models: + - name: alm_ethereum_trades + meta: + blockchain: ethereum + sector: alm + contributors: 0xrusowsky + config: + tags: [ 'ethereum', 'alm', 'trades' ] + + - name: arrakis_finance_ethereum_trades + meta: + blockchain: ethereum + sector: alm + project: arrakis_finance + contributors: 0xrusowsky + config: + tags: [ 'ethereum', 'alm', 'arrakis', 'arrakis_finance', 'trades' ] + description: "arrakis finance ethereum base trades" + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - tx_hash + - evt_index + - vault_address +``` + +## Model Config Settings + +- Include both schema and alias, avoiding schema addition to project files. +- Retain table configs as incremental/merge/delta. +- Add incremental predicates for targeted filtering. + +Example config block: + +```yaml +{{ config( + schema = 'arrakis_finance_ethereum' + , alias = 'trades' + , materialized = 'incremental' + , file_format = 'delta' + , incremental_strategy = 'merge' + , unique_key = ['tx_hash', 'evt_index', 'vault_address'] + , incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.block_time')] + ) +}} +``` + +## Example PRs + +- [PR #5764: setup ALM trades + feed Arrakis data](https://github.com/duneanalytics/spellbook/pull/5764/files) + +## PR Submission Guidelines + +When contributing new protocols to the `alm.trades`, here are a few guidelines to ensure a smooth submission process: + +- **Multiple protocols on the Same Chain**: If you're adding multiple protocols that operate on the same blockchain, it's best to group them together in the same Pull Request (PR). This helps in consolidating the review process and ensures consistency across integrations on the same chain. + +- **Different Chains**: For protocols operating on different blockchains, please submit a separate PR for each chain. This approach not only makes it easier to manage and review changes specific to each blockchain's unique characteristics and requirements but also significantly reduces the potential for file conflicts when updates are merged into the main branch. + +Following these guidelines helps maintain the spellbook's organization and facilitates efficient review and integration of your contributions. + +## Further Information + +For more details, please refer to relevant GitHub issues, PRs, and comments. This repository is a collective effort, and your contributions are highly valued. + +- [PR #5764: setup ALM trades + feed Arrakis data](https://github.com/duneanalytics/spellbook/pull/5764/files) + +## Contact + +For any questions or discussions, feel free to reach out to [Jeff](https://github.com/jeff-dude), [Hosuke](https://github.com/hosuke), or [0xrusowsky](https://github.com/0xrusowsky). diff --git a/models/_sector/alm/_schema.yml b/models/_sector/alm/_schema.yml new file mode 100644 index 00000000000..0fb852df751 --- /dev/null +++ b/models/_sector/alm/_schema.yml @@ -0,0 +1,99 @@ +version: 2 + +models: + + - name: alm_trades + meta: + blockchain: ethereum + sector: alm + contributors: 0xrusowsky + config: + tags: [ 'alm', 'trades' ] + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - blockchain + - project + - version + - tx_hash + - evt_index + - vault_address + columns: + - &blockchain + name: blockchain + description: "Blockchain where the ALM is deployed" + - &project + name: project + description: "Project name" + - &version + name: version + description: "Version of the contract built and deployed by the project" + - &dex + name: dex + description: "DEX name" + - &dex_version + name: dex_version + description: "Version of the liquidity pool contract" + - &block_month + name: block_month + description: "Month of the event block time" + - &block_time + name: block_time + description: "UTC event block time of each DEX trade" + - &block_number + name: block_number + description: "Block number of each DEX trade" + - &pool_address + name: pool_address + description: "Project contract address which executed the trade on the blockchain" + - &vault_address + name: vault_address + description: "Address of the vault (liquidity provider)" + - &token_pair + name: token_pair + description: "Token symbol pair for the pool tokens" + - &token0_address + name: token0_address + description: "Contract address of the token bought" + - &token1_address + name: token1_address + description: "Contract address of the token sold" + - &volume_usd + name: volume_usd + description: "USD volume provided by the ALM" + - &swap_volume_usd + name: swap_volume_usd + description: "Full USD volume traded in the DEX pool" + - &volume_share + name: volume_share + description: "Share of the traded volume provided by the ALM" + - &volume0 + name: volume0 + description: "Amount of token0 provided by the ALM (with parsed decimals)" + - &swap_volume0 + name: swap_volume0 + description: "Full amount of token0 traded in the DEX pool" + - &token0_symbol + name: token0_symbol + description: "Token symbol for token0 of the pool" + - &volume1 + name: volume1 + description: "Amount of token1 provided by the ALM (with parsed decimals)" + - &swap_volume1 + name: swap_volume1 + description: "Full amount of token1 traded in the DEX pool" + - &token1_symbol + name: token1_symbol + description: "Token symbol for token1 of the pool" + - &volume0_raw + name: volume0_raw + description: "Raw amount of token0 provided by the ALM" + - &volume1_raw + name: volume1_raw + description: "Raw amount of token1 provided by the ALM" + - &tx_hash + name: tx_hash + description: "Unique transaction hash value tied to each transaction on the DEX" + - &evt_index + name: evt_index + description: "Index of the corresponding trade event" \ No newline at end of file diff --git a/models/_sector/alm/alm_trades.sql b/models/_sector/alm/alm_trades.sql new file mode 100644 index 00000000000..7635eb81a45 --- /dev/null +++ b/models/_sector/alm/alm_trades.sql @@ -0,0 +1,67 @@ +{{ config( + schema = 'alm' + , alias = 'trades' + , partition_by = ['block_month', 'blockchain', 'project'] + , materialized = 'incremental' + , file_format = 'delta' + , incremental_strategy = 'merge' + , unique_key = ['blockchain', 'project', 'version', 'tx_hash', 'evt_index', 'vault_address'] + , incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.block_time')] + ) +}} + +{% set models = [ + ref('alm_ethereum_trades') +] %} + +WITH base_union AS ( + SELECT * + FROM ( + {% for model in models %} + SELECT + blockchain + , project + , version + , dex + , dex_version + , block_time + , block_month + , block_number + , pool_address + , vault_address + , token_pair + , token0_address + , token1_address + , volume_usd + , volume_share + , swap_volume_usd + , volume0 + , swap_volume0 + , token0_symbol + , volume1 + , swap_volume1 + , token1_symbol + , volume0_raw + , volume1_raw + , tx_hash + , evt_index + , row_number() over (partition by tx_hash, evt_index, vault_address order by tx_hash asc, evt_index asc) as duplicates_rank + FROM + {{ model }} + {% if is_incremental() %} + WHERE + {{ incremental_predicate('block_time') }} + {% endif %} + {% if not loop.last %} + UNION ALL + {% endif %} + {% endfor %} + ) + WHERE + duplicates_rank = 1 +) + +select + * +from + base_union diff --git a/models/_sector/alm/ethereum/_schema.yml b/models/_sector/alm/ethereum/_schema.yml new file mode 100644 index 00000000000..8201927e030 --- /dev/null +++ b/models/_sector/alm/ethereum/_schema.yml @@ -0,0 +1,26 @@ +version: 2 + +models: + - name: alm_ethereum_trades + meta: + blockchain: ethereum + sector: alm + contributors: 0xrusowsky + config: + tags: [ 'ethereum', 'alm', 'trades' ] + + - name: arrakis_finance_ethereum_trades + meta: + blockchain: ethereum + sector: alm + project: arrakis_finance + contributors: 0xrusowsky + config: + tags: [ 'ethereum', 'alm', 'arrakis', 'arrakis_finance', 'trades' ] + description: "arrakis finance ethereum base trades" + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - tx_hash + - evt_index + - vault_address \ No newline at end of file diff --git a/models/_sector/alm/ethereum/alm_ethereum_trades.sql b/models/_sector/alm/ethereum/alm_ethereum_trades.sql new file mode 100644 index 00000000000..63008411056 --- /dev/null +++ b/models/_sector/alm/ethereum/alm_ethereum_trades.sql @@ -0,0 +1,58 @@ +{{ config( + schema = 'alm_ethereum' + , alias = 'trades' + , materialized = 'view' + ) +}} + +{% set base_models = [ + ref('arrakis_finance_ethereum_trades') +] %} + +WITH base_union AS ( + SELECT * + FROM ( + {% for base_model in base_models %} + SELECT + blockchain + , project + , version + , dex + , dex_version + , block_time + , block_month + , block_number + , pool_address + , vault_address + , token_pair + , token0_address + , token1_address + , volume_usd + , volume_share + , swap_volume_usd + , volume0 + , swap_volume0 + , token0_symbol + , volume1 + , swap_volume1 + , token1_symbol + , volume0_raw + , volume1_raw + , tx_hash + , evt_index + , row_number() over (partition by tx_hash, evt_index, vault_address order by tx_hash asc, evt_index asc) as duplicates_rank + FROM + {{ base_model }} + {% if not loop.last %} + UNION ALL + {% endif %} + {% endfor %} + ) + WHERE + duplicates_rank = 1 +) + +select + * +from + base_union diff --git a/models/_sector/alm/ethereum/platforms/arrakis_finance_ethereum_trades.sql b/models/_sector/alm/ethereum/platforms/arrakis_finance_ethereum_trades.sql new file mode 100644 index 00000000000..7326be4c1cb --- /dev/null +++ b/models/_sector/alm/ethereum/platforms/arrakis_finance_ethereum_trades.sql @@ -0,0 +1,25 @@ +{{ config( + schema = 'arrakis_finance_ethereum' + , alias = 'trades' + , materialized = 'incremental' + , file_format = 'delta' + , incremental_strategy = 'merge' + , unique_key = ['tx_hash', 'evt_index', 'vault_address'] + , incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.block_time')] + ) +}} + +{{ + arrakis_compatible_v2_trades( + blockchain = 'ethereum' + , project = 'arrakis' + , version = '2' + , dex = 'uniswap' + , dex_version = '3' + , Pair_evt_Mint = source('uniswap_v3_ethereum', 'Pair_evt_Mint') + , Pair_evt_Burn = source('uniswap_v3_ethereum', 'Pair_evt_Burn') + , Pair_evt_Swap = source('uniswap_v3_ethereum', 'Pair_evt_Swap') + , Factory_evt_PoolCreated = source('uniswap_v3_ethereum', 'Factory_evt_PoolCreated') + , ArrakisV2Factory_evt_VaultCreated = source('arrakis_finance_ethereum', 'ArrakisV2Factory_evt_VaultCreated') + ) +}} \ No newline at end of file diff --git a/sources/_sector/alm/ethereum/_sources.yml b/sources/_sector/alm/ethereum/_sources.yml new file mode 100644 index 00000000000..214113363ec --- /dev/null +++ b/sources/_sector/alm/ethereum/_sources.yml @@ -0,0 +1,5 @@ +version: 2 + +sources: + - name: arrakis_v2_ethereum + - name: uniswap_v3_ethereum \ No newline at end of file diff --git a/sources/arrakis/ethereum/arrakis_ethereum_sources.yml b/sources/arrakis/ethereum/arrakis_ethereum_sources.yml new file mode 100644 index 00000000000..cda0b361db1 --- /dev/null +++ b/sources/arrakis/ethereum/arrakis_ethereum_sources.yml @@ -0,0 +1,10 @@ +version: 2 + +sources: + - name: arrakis_finance_ethereum + description: "Ethereum decoded tables related to Arrakis Finance contracts" + freshness: + warn_after: { count: 12, period: hour } + tables: + - name: ArrakisV2Factory_evt_VaultCreated + loaded_at_field: evt_block_time \ No newline at end of file From b3ce1b4f14743b9a0e1f5223ddfb3de2360f76a3 Mon Sep 17 00:00:00 2001 From: franzns <93920061+franzns@users.noreply.github.com> Date: Mon, 3 Jun 2024 19:59:11 +0200 Subject: [PATCH 020/149] Beethovenx/weightedv2 and composable stable (#5964) * add weighted v2 factory * fix * add pool name * fix name of contract * fix name * add to sources * remove blank * use notation * fix naming * add composable stable * change desc * change CSP source * add pool_name * labels --------- Co-authored-by: jeff-dude <102681548+jeff-dude@users.noreply.github.com> --- ...eethoven_x_fantom_pools_tokens_weights.sql | 32 +++++++- .../labels_beethoven_x_pools_fantom.sql | 79 ++++++++++++++++--- .../beethoven_x/labels_beethoven_x_schema.yml | 3 + .../fantom/beethoven_x_fantom_sources.yml | 51 +++++++++++- 4 files changed, 147 insertions(+), 18 deletions(-) diff --git a/models/beethoven_x/fantom/beethoven_x_fantom_pools_tokens_weights.sql b/models/beethoven_x/fantom/beethoven_x_fantom_pools_tokens_weights.sql index 0f852054c82..f37d8890f6e 100644 --- a/models/beethoven_x/fantom/beethoven_x_fantom_pools_tokens_weights.sql +++ b/models/beethoven_x/fantom/beethoven_x_fantom_pools_tokens_weights.sql @@ -10,6 +10,9 @@ ) }} +-- +-- Balancer v2 Pools Tokens Weights +-- WITH registered AS ( SELECT poolID AS pool_id, @@ -47,7 +50,20 @@ weighted_pool_2tokens_factory AS ( AND call_create.call_block_time >= date_trunc('day', now() - interval '7' day) {% endif %} ), - +weighted_pool_v2_factory AS ( + SELECT + call_create.output_0 AS pool_id, + t.pos AS pos, + t.token_address AS token_address, + t2.normalized_weight AS normalized_weight + FROM {{ source('beethoven_x_fantom', 'WeightedPoolFactoryV2_call_create') }} AS call_create + CROSS JOIN UNNEST(call_create.tokens) WITH ORDINALITY t(token_address, pos) + CROSS JOIN UNNEST(call_create.normalizedWeights) WITH ORDINALITY t2(normalized_weight, pos) + WHERE t.pos = t2.pos + {% if is_incremental() %} + AND call_create.call_block_time >= date_trunc('day', now() - interval '7' day) + {% endif %} +), normalized_weights AS ( SELECT pool_id, @@ -60,8 +76,20 @@ normalized_weights AS ( token_address, normalized_weight / POWER(10, 18) AS normalized_weight FROM weighted_pool_2tokens_factory + UNION ALL + SELECT + pool_id, + token_address, + normalized_weight / POWER(10, 18) AS normalized_weight + FROM weighted_pool_v2_factory ) -SELECT 'fantom' as blockchain, r.pool_id, w.token_address, w.normalized_weight + +SELECT + 'fantom' AS blockchain, + '2' AS version, + r.pool_id, + w.token_address, + w.normalized_weight FROM normalized_weights w LEFT JOIN registered r ON BYTEARRAY_SUBSTRING(r.pool_id,1,20) = w.pool_id WHERE w.pool_id IS NOT NULL diff --git a/models/labels/addresses/__single_category_labels__/beethoven_x/labels_beethoven_x_pools_fantom.sql b/models/labels/addresses/__single_category_labels__/beethoven_x/labels_beethoven_x_pools_fantom.sql index 013af4a74b9..6f6594a5508 100644 --- a/models/labels/addresses/__single_category_labels__/beethoven_x/labels_beethoven_x_pools_fantom.sql +++ b/models/labels/addresses/__single_category_labels__/beethoven_x/labels_beethoven_x_pools_fantom.sql @@ -12,14 +12,16 @@ WITH pools AS ( zip.tokens AS token_address, zip.weights / pow(10, 18) AS normalized_weight, symbol, - pool_type + pool_type, + pool_name FROM ( SELECT c.poolId AS pool_id, t.tokens, w.weights, cc.symbol, - 'weighted' AS pool_type + 'weighted' AS pool_type, + cc.name AS pool_name FROM {{ source('beethoven_x_fantom', 'Vault_evt_PoolRegistered') }} c INNER JOIN {{ source('beethoven_x_fantom', 'WeightedPoolFactory_call_create') }} cc ON c.evt_tx_hash = cc.call_tx_hash @@ -36,14 +38,16 @@ WITH pools AS ( zip.tokens AS token_address, zip.weights / pow(10, 18) AS normalized_weight, symbol, - pool_type + pool_type, + pool_name FROM ( SELECT c.poolId AS pool_id, t.tokens, w.weights, cc.symbol, - 'weighted' AS pool_type + 'weighted' AS pool_type, + cc.name AS pool_name FROM {{ source('beethoven_x_fantom', 'Vault_evt_PoolRegistered') }} c INNER JOIN {{ source('beethoven_x_fantom', 'WeightedPool2TokensFactory_call_create') }} cc ON c.evt_tx_hash = cc.call_tx_hash @@ -55,12 +59,39 @@ WITH pools AS ( UNION ALL + SELECT + pool_id, + zip.tokens AS token_address, + zip.weights / pow(10, 18) AS normalized_weight, + symbol, + pool_type, + pool_name + FROM ( + SELECT + c.poolId AS pool_id, + t.tokens, + w.weights, + cc.symbol, + 'weighted' AS pool_type, + cc.name AS pool_name + FROM {{ source('beethoven_x_fantom', 'Vault_evt_PoolRegistered') }} c + INNER JOIN {{ source('beethoven_x_fantom', 'WeightedPoolFactoryV2_call_create') }} cc + ON c.evt_tx_hash = cc.call_tx_hash + AND bytearray_substring(c.poolId, 1, 20) = cc.output_0 + CROSS JOIN UNNEST(cc.tokens) WITH ORDINALITY t(tokens, pos) + CROSS JOIN UNNEST(cc.normalizedWeights) WITH ORDINALITY w(weights, pos) + WHERE t.pos = w.pos + ) zip + + UNION ALL + SELECT c.poolId AS pool_id, t.tokens, 0 AS weights, cc.symbol, - 'stable' AS pool_type + 'stable' AS pool_type, + cc.name AS pool_name FROM {{ source('beethoven_x_fantom', 'Vault_evt_PoolRegistered') }} c INNER JOIN {{ source('beethoven_x_fantom', 'StablePoolFactory_call_create') }} cc ON c.evt_tx_hash = cc.call_tx_hash @@ -74,7 +105,8 @@ WITH pools AS ( t.tokens AS token_address, 0 AS normalized_weight, cc.symbol, - 'stable' AS pool_type + 'stable' AS pool_type, + cc.name AS pool_name FROM {{ source('beethoven_x_fantom', 'Vault_evt_PoolRegistered') }} c INNER JOIN {{ source('beethoven_x_fantom', 'MetaStablePoolFactory_call_create') }} cc ON c.evt_tx_hash = cc.call_tx_hash @@ -88,7 +120,8 @@ WITH pools AS ( t.tokens AS token_address, 0 AS normalized_weight, cc.symbol, - 'stable' AS pool_type + 'stable' AS pool_type, + cc.name AS pool_name FROM {{ source('beethoven_x_fantom', 'Vault_evt_PoolRegistered') }} c INNER JOIN {{ source('beethoven_x_fantom', 'StablePhantomPoolFactory_call_create') }} cc ON c.evt_tx_hash = cc.call_tx_hash @@ -102,7 +135,8 @@ WITH pools AS ( t.tokens AS token_address, 0 AS normalized_weight, cc.symbol, - 'LBP' AS pool_type + 'LBP' AS pool_type, + cc.name AS pool_name FROM {{ source('beethoven_x_fantom', 'Vault_evt_PoolRegistered') }} c INNER JOIN {{ source('beethoven_x_fantom', 'NoProtocolFeeLiquidityBootstrappingPoolFactory_call_create') }} cc ON c.evt_tx_hash = cc.call_tx_hash @@ -111,12 +145,28 @@ WITH pools AS ( UNION ALL + SELECT + c.poolId AS pool_id, + t.tokens AS token_address, + 0 AS normalized_weight, + cc.symbol, + 'stable' AS pool_type, + cc.name AS pool_name + FROM {{ source('beethoven_x_fantom', 'Vault_evt_PoolRegistered') }} c + INNER JOIN {{ source('beethoven_x_fantom', 'ComposableStablePoolFactory_call_create') }} cc + ON c.evt_tx_hash = cc.call_tx_hash + AND bytearray_substring(c.poolId, 1, 20) = cc.output_0 + CROSS JOIN UNNEST(cc.tokens) AS t(tokens) + + UNION ALL + SELECT c.poolId AS pool_id, element AS token_address, 0 AS normalized_weight, cc.symbol, - 'linear' AS pool_type + 'linear' AS pool_type, + cc.name AS pool_name FROM {{ source('beethoven_x_fantom', 'Vault_evt_PoolRegistered') }} c INNER JOIN {{ source('beethoven_x_fantom', 'YearnLinearPoolFactory_call_create') }} cc ON c.evt_tx_hash = cc.call_tx_hash @@ -130,7 +180,8 @@ settings AS ( coalesce(t.symbol, '?') AS token_symbol, normalized_weight, p.symbol AS pool_symbol, - p.pool_type + p.pool_type, + p.pool_name FROM pools p LEFT JOIN {{ source('tokens', 'erc20') }} t ON p.token_address = t.contract_address ) @@ -143,6 +194,7 @@ SELECT ELSE lower(concat(array_join(array_agg(token_symbol ORDER BY token_symbol), '/'), ' ', array_join(array_agg(cast(norm_weight AS varchar) ORDER BY token_symbol), '/'))) END AS name, + pool_name AS poolname, pool_type, 'beethoven_x' AS category, 'balancerlabs' AS contributor, @@ -157,9 +209,10 @@ FROM ( token_symbol, pool_symbol, cast(100 * normalized_weight AS integer) AS norm_weight, - pool_type + pool_type, + pool_name FROM settings s1 - GROUP BY s1.pool_id, token_symbol, pool_symbol, normalized_weight, pool_type + GROUP BY s1.pool_id, token_symbol, pool_symbol, normalized_weight, pool_type, pool_name ) s -GROUP BY pool_id, pool_symbol, pool_type +GROUP BY pool_id, pool_symbol, pool_type, pool_name ORDER BY 1 diff --git a/models/labels/addresses/__single_category_labels__/beethoven_x/labels_beethoven_x_schema.yml b/models/labels/addresses/__single_category_labels__/beethoven_x/labels_beethoven_x_schema.yml index d40a67068f5..f015858717e 100644 --- a/models/labels/addresses/__single_category_labels__/beethoven_x/labels_beethoven_x_schema.yml +++ b/models/labels/addresses/__single_category_labels__/beethoven_x/labels_beethoven_x_schema.yml @@ -28,6 +28,9 @@ models: - &name name: name description: 'Label name of pool containg the token symbols and their respective weights (if applicable)' + - &poolname + name: poolname + description: 'Label name of pool set at contract creation' - &category name: category description: 'Label category' diff --git a/sources/beethoven_x/fantom/beethoven_x_fantom_sources.yml b/sources/beethoven_x/fantom/beethoven_x_fantom_sources.yml index e8a21479e65..00584d36d85 100644 --- a/sources/beethoven_x/fantom/beethoven_x_fantom_sources.yml +++ b/sources/beethoven_x/fantom/beethoven_x_fantom_sources.yml @@ -41,7 +41,7 @@ sources: - name: evt_block_number description: 'Block number which processed the unique transaction hash' - name: poolAddress - description: 'Arbitrum address for the liquidity pool used in transaction' + description: 'Fantom address for the liquidity pool used in transaction' - name: poolId description: 'Unique encoded identifier that refers to each pool' - name: specialization @@ -79,6 +79,38 @@ sources: - name: weights description: 'Array with the weight of each token in the created pool' + - name: WeightedPoolFactoryV2_call_create + description: > + Decoded table of registered pools on the Balancer WeightedPool2TokensFactory contract. + loaded_at_field: call_block_time + columns: + - name: call_block_number + description: 'Block number which processed the unique transaction hash' + - name: call_block_time + description: 'Timestamp for block time in which the call occurred in UTC' + - name: call_success + description: 'Boolean indicating if call was successfully processed' + - name: call_trace_address + description: '' + - name: call_tx_hash + description: 'Primary key of the transaction' + - name: contract_address + description: 'Address of the WeightedPoolV2Factory contract' + - name: name + description: 'Name of the created pool' + - name: normalizedWeights + description: 'Array with the normalized weight of each token in the created pool' + - name: output_0 + description: 'Contract address of the created pool' + - name: owner + description: 'Contract of the pool owner' + - name: swapFeePercentage + description: 'Pool swap fee in percentage' + - name: symbol + description: 'Symbol of the created pool' + - name: tokens + description: 'Array with the address of the created pool tokens' + - name: WeightedPool2TokensFactory_call_create description: > Decoded table of registered pools on the Balancer WeightedPool2TokensFactory contract. @@ -102,7 +134,7 @@ sources: - name: Vault_evt_PoolBalanceChanged description: > - Decoded table of pool balances changes record on the Balancer Vault contract on Arbitrum. + Decoded table of pool balances changes record on the Balancer Vault contract on Fantom. loaded_at_field: evt_block_time columns: - name: contract_address @@ -124,7 +156,7 @@ sources: - name: Vault_evt_PoolBalanceManaged description: > - Decoded table of transactions performed by asset managers on the Balancer Vault contract on Arbitrum. + Decoded table of transactions performed by asset managers on the Balancer Vault contract on Fantom. loaded_at_field: evt_block_time columns: - name: contract_address @@ -144,3 +176,16 @@ sources: - name: cashDelta description: 'Change in the amount of token cashed the vault' + - name: ComposableStablePoolFactory_call_create + description: > + Decoded table of Composable Stable Pools created by the Composable Stable Pool Factory contract. + loaded_at_field: evt_block_time + columns: + - name: contract_address + description: 'Balancer v2 Composable Stable Pool Factory contract address.' + - name: evt_tx_hash + - name: evt_index + - name: evt_block_time + - name: evt_block_number + - name: pool + description: 'Ethereum address for the Composable Stable Pool created in the transaction.' \ No newline at end of file From 7dafebcfb0ca6f78bbba9db20370b5e4ac36e621 Mon Sep 17 00:00:00 2001 From: viniabussafi <131974393+viniabussafi@users.noreply.github.com> Date: Mon, 3 Jun 2024 18:59:22 +0100 Subject: [PATCH 021/149] Init protocol fees spell for beethoven_x on fantom (#5961) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * init protocol fees on fantom * fix schema * rename * again * update schema * update references * remove versioning and fix group by * extra comma * remove extra CTE * Schema descriptions improvement --------- Co-authored-by: Markus Buhatem Koch Co-authored-by: Fábio Mendes <43360747+mendesfabio@users.noreply.github.com> Co-authored-by: mendesfabio --- .../fantom/beethoven_x_fantom_bpt_prices.sql | 385 ++++++++++++++++++ .../fantom/beethoven_x_fantom_bpt_supply.sql | 138 +++++++ .../fantom/beethoven_x_fantom_liquidity.sql | 2 +- .../beethoven_x_fantom_protocol_fee.sql | 154 +++++++ .../fantom/beethoven_x_fantom_schema.yml | 103 ++++- .../beethoven_x_fantom_transfers_bpt.sql | 41 ++ 6 files changed, 821 insertions(+), 2 deletions(-) create mode 100644 models/beethoven_x/fantom/beethoven_x_fantom_bpt_prices.sql create mode 100644 models/beethoven_x/fantom/beethoven_x_fantom_bpt_supply.sql create mode 100644 models/beethoven_x/fantom/beethoven_x_fantom_protocol_fee.sql create mode 100644 models/beethoven_x/fantom/beethoven_x_fantom_transfers_bpt.sql diff --git a/models/beethoven_x/fantom/beethoven_x_fantom_bpt_prices.sql b/models/beethoven_x/fantom/beethoven_x_fantom_bpt_prices.sql new file mode 100644 index 00000000000..26ad476e648 --- /dev/null +++ b/models/beethoven_x/fantom/beethoven_x_fantom_bpt_prices.sql @@ -0,0 +1,385 @@ +{{ + config( + schema = 'beethoven_x_fantom', + alias = 'bpt_prices', + materialized = 'table', + file_format = 'delta' + ) +}} + + +WITH pool_labels AS ( + SELECT + address AS pool_id, + name AS pool_symbol, + pool_type + FROM {{ ref('labels_beethoven_x_pools_fantom') }} + WHERE blockchain = 'fantom' + ), + +-- liquidity formulation, with a few simplifications, compared to liquidity spell + + prices AS ( + SELECT + date_trunc('day', minute) AS day, + contract_address AS token, + decimals, + AVG(price) AS price + FROM {{ source('prices', 'usd') }} + WHERE blockchain = 'fantom' + GROUP BY 1, 2, 3 + ), + + swaps_changes AS ( + SELECT + day, + pool_id, + token, + SUM(COALESCE(delta, INT256 '0')) AS delta + FROM + ( + SELECT + date_trunc('day', evt_block_time) AS day, + poolId AS pool_id, + tokenIn AS token, + CAST(amountIn as int256) AS delta + FROM {{ source('beethoven_x_fantom','Vault_evt_Swap') }} + + UNION ALL + + SELECT + date_trunc('day', evt_block_time) AS day, + poolId AS pool_id, + tokenOut AS token, + -CAST(amountOut AS int256) AS delta + FROM {{ source('beethoven_x_fantom','Vault_evt_Swap') }} + ) swaps + GROUP BY 1, 2, 3 + ), + + zipped_balance_changes AS ( + SELECT + date_trunc('day', evt_block_time) AS day, + poolId AS pool_id, + t.tokens, + d.deltas, + p.protocolFeeAmounts + FROM {{ source('beethoven_x_fantom','Vault_evt_PoolBalanceChanged') }} + CROSS JOIN UNNEST (tokens) WITH ORDINALITY as t(tokens,i) + CROSS JOIN UNNEST (deltas) WITH ORDINALITY as d(deltas,i) + CROSS JOIN UNNEST (protocolFeeAmounts) WITH ORDINALITY as p(protocolFeeAmounts,i) + WHERE t.i = d.i + AND d.i = p.i + ORDER BY 1, 2, 3 + ), + + balances_changes AS ( + SELECT + day, + pool_id, + tokens AS token, + deltas - CAST(protocolFeeAmounts as int256) AS delta + FROM zipped_balance_changes + ORDER BY 1, 2, 3 + ), + + managed_changes AS ( + SELECT + date_trunc('day', evt_block_time) AS day, + poolId AS pool_id, + token, + cashDelta + managedDelta AS delta + FROM {{ source('beethoven_x_fantom','Vault_evt_PoolBalanceManaged') }} + ), + + daily_delta_balance AS ( + SELECT + day, + pool_id, + token, + SUM(COALESCE(amount, INT256 '0')) AS amount + FROM + ( + SELECT + day, + pool_id, + token, + SUM(COALESCE(delta, INT256 '0')) AS amount + FROM balances_changes + GROUP BY 1, 2, 3 + + UNION ALL + + SELECT + day, + pool_id, + token, + delta AS amount + FROM + swaps_changes + + UNION ALL + + SELECT + day, + pool_id, + token, + CAST(delta AS int256) AS amount + FROM managed_changes + ) balance + GROUP BY 1, 2, 3 + ), + + cumulative_balance AS ( + SELECT + DAY, + pool_id, + token, + LEAD(DAY, 1, NOW()) OVER (PARTITION BY token, pool_id ORDER BY DAY) AS day_of_next_change, + SUM(amount) OVER (PARTITION BY pool_id, token ORDER BY DAY ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW) AS cumulative_amount + FROM daily_delta_balance + ), + + calendar AS ( + SELECT date_sequence AS day + FROM unnest(sequence(date('2021-04-21'), date(now()), interval '1' day)) as t(date_sequence) + ), + + cumulative_usd_balance AS ( + SELECT + c.day, + 'fantom' as blockchain, + b.pool_id, + b.token, + cumulative_amount / POWER(10, COALESCE(t.decimals, p1.decimals)) * COALESCE(p1.price, 0) AS protocol_liquidity_usd + FROM calendar c + LEFT JOIN cumulative_balance b ON b.day <= c.day + AND c.day < b.day_of_next_change + LEFT JOIN {{ source('tokens', 'erc20') }} t ON t.contract_address = b.token + AND blockchain = 'fantom' + LEFT JOIN prices p1 ON p1.day = b.day + AND p1.token = b.token + WHERE b.token != BYTEARRAY_SUBSTRING(b.pool_id, 1, 20) + ), + + weighted_pool_liquidity_estimates AS ( + SELECT + b.day, + b.pool_id, + q.name, + pool_type, + ROW_NUMBER() OVER (partition by b.day, b.pool_id ORDER BY SUM(b.protocol_liquidity_usd) ASC) AS pricing_count, --to avoid double count in pools with multiple pricing assets + SUM(b.protocol_liquidity_usd) / COALESCE(SUM(w.normalized_weight), 1) AS protocol_liquidity + FROM cumulative_usd_balance b + LEFT JOIN {{ ref('beethoven_x_fantom_pools_tokens_weights') }} w ON b.pool_id = w.pool_id + AND b.token = w.token_address + AND b.protocol_liquidity_usd > 0 + LEFT JOIN {{ ref('balancer_token_whitelist') }} q ON b.token = q.address + AND b.blockchain = q.chain + LEFT JOIN pool_labels p ON p.pool_id = BYTEARRAY_SUBSTRING(b.pool_id, 1, 20) + WHERE q.name IS NOT NULL + AND p.pool_type IN ('weighted') -- filters for weighted pools with pricing assets + AND w.blockchain = 'fantom' + GROUP BY 1, 2, 3, 4 + ), + + weighted_pool_liquidity_estimates_2 AS( + SELECT e.day, + e.pool_id, + SUM(e.protocol_liquidity) / MAX(e.pricing_count) AS protocol_liquidity + FROM weighted_pool_liquidity_estimates e + GROUP BY 1,2 + ), + + tvl AS( + SELECT + c.day, + BYTEARRAY_SUBSTRING(c.pool_id, 1, 20) AS pool_address, + 'fantom' AS blockchain, + SUM(COALESCE(b.protocol_liquidity * w.normalized_weight, c.protocol_liquidity_usd)) AS liquidity + FROM cumulative_usd_balance c + FULL OUTER JOIN weighted_pool_liquidity_estimates_2 b ON c.day = b.day + AND c.pool_id = b.pool_id + LEFT JOIN {{ ref('beethoven_x_fantom_pools_tokens_weights') }} w ON b.pool_id = w.pool_id + AND w.blockchain = 'fantom' + AND w.token_address = c.token + LEFT JOIN pool_labels p ON p.pool_id = BYTEARRAY_SUBSTRING(c.pool_id, 1, 20) + GROUP BY 1, 2, 3 + ), + +-- trade based formulation, for Linear Pools (former BPT prices spell) + + bpt_trades AS ( + SELECT * + FROM {{ source('beethoven_x_fantom','Vault_evt_Swap') }} v + LEFT JOIN pool_labels l ON bytearray_substring(v.poolId, 1, 20) = l.pool_id + WHERE v.tokenIn = bytearray_substring(v.poolId, 1, 20) OR v.tokenOut = bytearray_substring(v.poolId, 1, 20) + AND l.pool_type = 'linear' + ), + + all_trades_info AS ( + SELECT + a.evt_tx_hash AS tx_hash, + a.evt_block_time AS block_time, + a.evt_block_number AS block_number, + a.poolId AS pool_id, + bytearray_substring(a.poolId, 1, 20) AS bpt_address, + a.tokenIn AS token_in, + CAST(a.amountIn AS DOUBLE) AS amount_in, + a.tokenOut AS token_out, + CAST(a.amountOut AS DOUBLE) AS amount_out, + p1.price AS token_in_p, + COALESCE(p1.symbol, t1.symbol) AS token_in_sym, + COALESCE(p1.decimals, t1.decimals) AS token_in_decimals, + p2.price AS token_out_p, + COALESCE(p2.symbol, t2.symbol) AS token_out_sym, + COALESCE(p2.decimals, t2.decimals) AS token_out_decimals + FROM bpt_trades a + LEFT JOIN {{ source ('prices', 'usd') }} p1 ON p1.contract_address = a.tokenIn AND p1.blockchain = 'fantom' + AND p1.minute = date_trunc('minute', a.evt_block_time) + LEFT JOIN {{ source ('prices', 'usd') }} p2 ON p2.contract_address = a.tokenOut AND p2.blockchain = 'fantom' + AND p2.minute = date_trunc('minute', a.evt_block_time) + LEFT JOIN {{ source('tokens', 'erc20') }} t1 ON t1.contract_address = a.tokenIn AND t1.blockchain = 'fantom' + LEFT JOIN {{ source('tokens', 'erc20') }} t2 ON t2.contract_address = a.tokenOut AND t2.blockchain = 'fantom' + ORDER BY a.evt_block_number DESC, a.evt_index DESC + ), + + all_trades_calc_2 AS ( + SELECT *, + amount_in / POWER(10, COALESCE(token_in_decimals, 18)) AS amount_in_norm, + amount_out / POWER(10, COALESCE(token_out_decimals, 18)) AS amount_out_norm, + (amount_in / POWER(10, COALESCE(token_in_decimals, 18))) / (amount_out / POWER(10, COALESCE(token_out_decimals, 18))) AS in_out_norm_rate, + (amount_out / POWER(10, COALESCE(token_out_decimals, 18))) / (amount_in / POWER(10, COALESCE(token_in_decimals, 18))) AS out_in_norm_rate, + CASE + WHEN token_in_p IS NULL AND token_out_p IS NULL THEN NULL + ELSE COALESCE( + token_in_p, + (amount_out / POWER(10, COALESCE(token_out_decimals, 18))) / (amount_in / POWER(10, COALESCE(token_in_decimals, 18))) * token_out_p + ) + END AS token_in_price, + CASE + WHEN token_in_p IS NULL AND token_out_p IS NULL THEN NULL + ELSE COALESCE( + token_out_p, + (amount_in / POWER(10, COALESCE(token_in_decimals, 18))) / (amount_out / POWER(10, COALESCE(token_out_decimals, 18))) * token_in_p + ) + END AS token_out_price + FROM all_trades_info + ), + + unique_tx_token_price AS ( + SELECT + distinct + tx_hash, + token, + AVG(token_price) OVER(PARTITION BY tx_hash, token) AS avg_price + FROM ( + SELECT tx_hash, token_in AS token, token_in_price AS token_price + FROM all_trades_calc_2 + UNION ALL + SELECT tx_hash, token_out AS token, token_out_price AS token_price + FROM all_trades_calc_2 + ) + + ORDER BY 1,2 + ), + + backfill_pricing_1 AS ( + SELECT + c2.block_time, + c2.tx_hash, + c2.bpt_address, + c2.token_in, + c2.in_out_norm_rate, + COALESCE(c2.token_in_price, u1.avg_price) AS token_in_price, + c2.token_out, + c2.out_in_norm_rate, + COALESCE(c2.token_out_price, u2.avg_price) AS token_out_price + FROM all_trades_calc_2 c2 + LEFT JOIN unique_tx_token_price u1 ON u1.tx_hash = c2.tx_hash AND u1.token = c2.token_in + LEFT JOIN unique_tx_token_price u2 ON u2.tx_hash = c2.tx_hash AND u2.token = c2.token_out + ), + + backfill_pricing_2 AS ( + SELECT + block_time, + tx_hash, + bpt_address AS contract_address, + token_in, + COALESCE(token_in_price, (out_in_norm_rate * token_out_price)) AS token_in_price, + token_out, + COALESCE(token_out_price, (in_out_norm_rate * token_in_price)) AS token_out_price, + in_out_norm_rate, + out_in_norm_rate + FROM backfill_pricing_1 + ), + + trade_price_formulation AS ( + SELECT + date_trunc('day', block_time) AS day, + contract_address, + approx_percentile(price, 0.5) FILTER (WHERE is_finite(price)) AS median_price + FROM ( + SELECT block_time, contract_address, token_in_price AS price + FROM backfill_pricing_2 b2 WHERE b2.contract_address = b2.token_in + UNION + SELECT block_time, contract_address, token_out_price AS price + FROM backfill_pricing_2 b2 WHERE b2.contract_address = b2.token_out + ) + GROUP BY 1, 2 + ), + + trade_price_formulation_2 AS( + SELECT + day, + contract_address, + CASE + WHEN median_price IS NOT NULL THEN median_price + WHEN LEAD(median_price) OVER(PARTITION BY contract_address ORDER BY day DESC) IS NOT NULL + THEN LEAD(median_price) OVER(PARTITION BY contract_address ORDER BY day DESC) + WHEN LAG(median_price) OVER(PARTITION BY contract_address ORDER BY day DESC) IS NOT NULL + THEN LAG(median_price) OVER(PARTITION BY contract_address ORDER BY day DESC) + ELSE approx_percentile(median_price, 0.5) OVER( + PARTITION BY contract_address ORDER BY day + ROWS BETWEEN 10 PRECEDING AND 10 FOLLOWING + ) + END AS median_price + FROM trade_price_formulation + ), + + price_formulation AS( + SELECT + day, + contract_address, + median_price + FROM ( + SELECT + day, + contract_address, + median_price, + AVG(median_price) OVER (PARTITION BY contract_address) AS avg_median_price + FROM trade_price_formulation + ) subquery + WHERE median_price < avg_median_price * 2 --removes outliers + GROUP BY 1, 2, 3 + ) + + SELECT + l.day, + l.blockchain, + 18 AS decimals, + l.pool_address AS contract_address, + pl.pool_type, + CASE WHEN pl.pool_type = 'linear' AND median_price IS NOT NULL + THEN p.median_price + WHEN l.liquidity = 0 AND median_price IS NOT NULL + THEN p.median_price + ELSE l.liquidity / s.supply + END AS bpt_price + FROM tvl l + LEFT JOIN {{ ref('beethoven_x_fantom_bpt_supply') }} s ON l.pool_address = s.token_address + AND l.blockchain = s.blockchain + AND l.day = s.day + LEFT JOIN price_formulation p ON p.day = l.day AND p.contract_address = l.pool_address + LEFT JOIN pool_labels pl ON pl.pool_id = l.pool_address + WHERE supply > 1 \ No newline at end of file diff --git a/models/beethoven_x/fantom/beethoven_x_fantom_bpt_supply.sql b/models/beethoven_x/fantom/beethoven_x_fantom_bpt_supply.sql new file mode 100644 index 00000000000..d9c665f3261 --- /dev/null +++ b/models/beethoven_x/fantom/beethoven_x_fantom_bpt_supply.sql @@ -0,0 +1,138 @@ +{{ config( + schema = 'beethoven_x_fantom', + alias = 'bpt_supply', + materialized = 'table', + file_format = 'delta' + ) +}} + +WITH pool_labels AS ( + SELECT * FROM ( + SELECT + address, + name, + pool_type, + ROW_NUMBER() OVER (PARTITION BY address ORDER BY MAX(updated_at) DESC) AS num + FROM {{ ref('labels_beethoven_x_pools_fantom') }} + WHERE blockchain = 'fantom' + GROUP BY 1, 2, 3) + WHERE num = 1 + ), + + -- Extract mints and burns from transfers + transfers AS ( + SELECT + block_date AS day, + contract_address AS token, + COALESCE(SUM(CASE WHEN t."from" = 0x0000000000000000000000000000000000000000 THEN value / POWER(10, 18) ELSE 0 END), 0) AS mints, + COALESCE(SUM(CASE WHEN t.to = 0x0000000000000000000000000000000000000000 THEN value / POWER(10, 18) ELSE 0 END), 0) AS burns + FROM {{ ref('beethoven_x_fantom_transfers_bpt') }} t + WHERE blockchain = 'fantom' + GROUP BY 1, 2 + ), + + -- Calculate token balances over time + balances AS ( + SELECT + day, + token, + LEAD(DAY, 1, NOW()) OVER (PARTITION BY token ORDER BY DAY) AS day_of_next_change, + SUM(COALESCE(mints, 0) - COALESCE(burns, 0)) OVER (PARTITION BY token ORDER BY DAY ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW) AS supply + FROM transfers + ), + + -- Extract preminted BPTs data + premints_1 AS ( + SELECT + poolId AS pool_id, + t.token, + d.delta, + ROW_NUMBER() OVER (PARTITION BY poolId ORDER BY evt_block_time ASC) AS rn + FROM {{ source('beethoven_x_fantom', 'Vault_evt_PoolBalanceChanged') }} pb + CROSS JOIN UNNEST (pb.deltas) WITH ORDINALITY d(delta, i) + CROSS JOIN UNNEST (pb.tokens) WITH ORDINALITY t(token, i) + WHERE d.i = t.i + AND BYTEARRAY_SUBSTRING(poolId, 1, 20) = t.token + ORDER BY 1 DESC + ), + + -- Select the first row for each pool, which counts as the preminted tokens + premints_2 AS ( + SELECT + * + FROM premints_1 + WHERE rn = 1 + ), + + -- Calculate preminted BPTs based on pool type + premints AS ( + SELECT + p.address AS bpt, + CASE WHEN pool_type IN ('linear') THEN CAST('5192296858534827628530496329220095' AS INT256) / POWER(10, 18) + WHEN pool_type IN ('stable') THEN CAST(m.delta AS INT256) / POWER(10, 18) + ELSE 0 + END AS preminted_bpts + FROM pool_labels p + LEFT JOIN premints_2 m ON p.address = BYTEARRAY_SUBSTRING(m.pool_id, 1, 20) + ), + + -- Calculating Joins(mint) and Exits(burn) via Swap + joins AS ( + SELECT + DATE_TRUNC('day', evt_block_time) AS block_date, + tokenOut, + pool_type, + CASE WHEN pool_type IN ('weighted') + THEN 0 + ELSE SUM(amountOut / POWER(10, 18)) + END AS ajoins + FROM {{ source('beethoven_x_fantom', 'Vault_evt_Swap') }} + LEFT JOIN pool_labels ON BYTEARRAY_SUBSTRING(poolId, 1, 20) = address + WHERE tokenOut = BYTEARRAY_SUBSTRING(poolId, 1, 20) + GROUP BY 1, 2, 3 + ), + + exits AS ( + SELECT + DATE_TRUNC('day', evt_block_time) AS block_date, + tokenIn, + pool_type, + CASE WHEN pool_type IN ('weighted') + THEN 0 + ELSE SUM(amountIn / POWER(10, 18)) + END AS aexits + FROM {{ source('beethoven_x_fantom', 'Vault_evt_Swap') }} + LEFT JOIN pool_labels ON BYTEARRAY_SUBSTRING(poolId, 1, 20) = address + WHERE tokenIn = BYTEARRAY_SUBSTRING(poolId, 1, 20) + GROUP BY 1, 2, 3 + ), + + joins_and_exits AS ( + SELECT + j.block_date, + j.tokenOut AS bpt, + SUM(COALESCE(ajoins, 0) - COALESCE(aexits, 0)) OVER (PARTITION BY j.tokenOut ORDER BY j.block_date ASC) AS adelta + FROM joins j + FULL OUTER JOIN exits e ON j.block_date = e.block_date AND e.tokenIn = j.tokenOut + ), + + calendar AS ( + SELECT + date_sequence AS day + FROM unnest(sequence(date('2021-04-21'), date(now()), interval '1' day)) as t(date_sequence) + ) + + SELECT + c.day, + l.pool_type, + 'fantom' as blockchain, + b.token AS token_address, + COALESCE(SUM(b.supply - COALESCE(preminted_bpts, 0) + COALESCE(adelta, 0)),0) AS supply + FROM calendar c + LEFT JOIN balances b ON b.day <= c.day AND c.day < b.day_of_next_change + LEFT JOIN joins_and_exits j ON c.day = j.block_date AND b.token = j.bpt + LEFT JOIN premints p ON b.token = p.bpt + LEFT JOIN pool_labels l ON b.token = l.address + WHERE l.pool_type IN ('weighted', 'LBP', 'investment', 'stable', 'linear', 'ECLP', 'managed', 'FX') + GROUP BY 1, 2, 3, 4 + HAVING SUM(b.supply - COALESCE(preminted_bpts, 0) + COALESCE(adelta, 0)) >= 0 --simple filter to remove outliers diff --git a/models/beethoven_x/fantom/beethoven_x_fantom_liquidity.sql b/models/beethoven_x/fantom/beethoven_x_fantom_liquidity.sql index 0acbfa83fe1..3190dd21fa3 100644 --- a/models/beethoven_x/fantom/beethoven_x_fantom_liquidity.sql +++ b/models/beethoven_x/fantom/beethoven_x_fantom_liquidity.sql @@ -80,7 +80,7 @@ WITH pool_labels AS ( CROSS JOIN UNNEST (protocolFeeAmounts) WITH ORDINALITY as p(protocolFeeAmounts,i) WHERE t.i = d.i AND d.i = p.i - ORDER BY 1,2,3 + ORDER BY 1, 2, 3 ), balances_changes AS ( diff --git a/models/beethoven_x/fantom/beethoven_x_fantom_protocol_fee.sql b/models/beethoven_x/fantom/beethoven_x_fantom_protocol_fee.sql new file mode 100644 index 00000000000..ac4f94d2a9f --- /dev/null +++ b/models/beethoven_x/fantom/beethoven_x_fantom_protocol_fee.sql @@ -0,0 +1,154 @@ +{{ + config( + schema = 'beethoven_x_fantom', + alias = 'protocol_fee', + materialized = 'table', + file_format = 'delta' + ) +}} + +WITH pool_labels AS ( + SELECT * FROM ( + SELECT + address, + name, + pool_type, + ROW_NUMBER() OVER (PARTITION BY address ORDER BY MAX(updated_at) DESC) AS num + FROM {{ ref('labels_beethoven_x_pools_fantom') }} + GROUP BY 1, 2, 3) + WHERE num = 1 + ), + + prices AS ( + SELECT + date_trunc('day', minute) AS day, + contract_address AS token, + decimals, + AVG(price) AS price + FROM {{ source('prices', 'usd') }} + WHERE blockchain = 'fantom' + GROUP BY 1, 2, 3 + + ), + + dex_prices_1 AS ( + SELECT + date_trunc('day', hour) AS DAY, + contract_address AS token, + approx_percentile(median_price, 0.5) AS price, + sum(sample_size) AS sample_size + FROM {{ ref('dex_prices') }} + GROUP BY 1, 2 + HAVING sum(sample_size) > 3 + ), + + dex_prices_2 AS( + SELECT + day, + token, + price, + lag(price) OVER(PARTITION BY token ORDER BY day) AS previous_price + FROM dex_prices_1 + ), + + dex_prices AS ( + SELECT + day, + token, + price, + LEAD(DAY, 1, NOW()) OVER (PARTITION BY token ORDER BY DAY) AS day_of_next_change + FROM dex_prices_2 + WHERE (price < previous_price * 1e4 AND price > previous_price / 1e4) + ), + + bpt_prices_1 AS ( --special calculation for this spell, in order to achieve completeness without relying on prices.usd + SELECT + l.day, + s.token_address AS token, + 18 AS decimals, + SUM(protocol_liquidity_usd / supply) AS price + FROM {{ ref('beethoven_x_fantom_liquidity') }} l + LEFT JOIN {{ ref('beethoven_x_fantom_bpt_supply') }} s ON s.token_address = l.pool_address + AND l.blockchain = s.blockchain AND s.day = l.day AND s.supply > 0 + WHERE l.blockchain = 'fantom' + GROUP BY 1, 2, 3 + ), + + bpt_prices AS ( + SELECT + day, + token, + decimals, + price, + LEAD(DAY, 1, NOW()) OVER (PARTITION BY token ORDER BY DAY) AS day_of_next_change + FROM bpt_prices_1 + ), + + daily_protocol_fee_collected AS ( + SELECT + date_trunc('day', evt_block_time) AS day, + poolId AS pool_id, + token AS token_address, + SUM(protocol_fees) AS protocol_fee_amount_raw + FROM {{ source('beethoven_x_fantom', 'Vault_evt_PoolBalanceChanged') }} b + CROSS JOIN unnest("protocolFeeAmounts", "tokens") AS t(protocol_fees, token) + GROUP BY 1, 2, 3 + + UNION ALL + + SELECT + date_trunc('day', t.evt_block_time) AS day, + poolId AS pool_id, + b.poolAddress AS token_address, + sum(value) AS protocol_fee_amount_raw + FROM {{ source('beethoven_x_fantom', 'Vault_evt_PoolRegistered') }} b + INNER JOIN {{ source('erc20_fantom', 'evt_transfer') }} t + ON t.contract_address = b.poolAddress + AND t."from" = 0x0000000000000000000000000000000000000000 + AND t.to = 0xc6920d3a369e7c8bd1a22dbe385e11d1f7af948f + GROUP BY 1, 2, 3 + ), + + decorated_protocol_fee AS ( + SELECT + d.day, + d.pool_id, + d.token_address, + t.symbol AS token_symbol, + SUM(d.protocol_fee_amount_raw) AS token_amount_raw, + SUM(d.protocol_fee_amount_raw / power(10, COALESCE(t.decimals,p1.decimals, p3.decimals))) AS token_amount, + SUM(COALESCE(p1.price, p2.price, p3.price) * protocol_fee_amount_raw / POWER(10, COALESCE(t.decimals,p1.decimals, p3.decimals))) AS protocol_fee_collected_usd + FROM daily_protocol_fee_collected d + LEFT JOIN prices p1 + ON p1.token = d.token_address + AND p1.day = d.day + LEFT JOIN dex_prices p2 + ON p2.token = d.token_address + AND p2.day = d.day + LEFT JOIN bpt_prices p3 + ON p3.token = d.token_address + AND p3.day <= d.day + AND d.day < p3.day_of_next_change + LEFT JOIN {{ source('tokens', 'erc20') }} t + ON t.contract_address = d.token_address + AND t.blockchain = 'fantom' + GROUP BY 1, 2, 3, 4 + ) + + + SELECT + f.day, + f.pool_id, + BYTEARRAY_SUBSTRING(f.pool_id,1,20) as pool_address, + l.name AS pool_symbol, + 'fantom' as blockchain, + l.pool_type, + f.token_address, + f.token_symbol, + SUM(f.token_amount_raw) as token_amount_raw, + SUM(f.token_amount) as token_amount, + SUM(f.protocol_fee_collected_usd) as protocol_fee_collected_usd + FROM decorated_protocol_fee f + LEFT JOIN pool_labels l + ON BYTEARRAY_SUBSTRING(f.pool_id,1,20) = l.address + GROUP BY 1, 2, 3, 4, 5, 6, 7, 8 \ No newline at end of file diff --git a/models/beethoven_x/fantom/beethoven_x_fantom_schema.yml b/models/beethoven_x/fantom/beethoven_x_fantom_schema.yml index bd3df7df0c0..54e2a286953 100644 --- a/models/beethoven_x/fantom/beethoven_x_fantom_schema.yml +++ b/models/beethoven_x/fantom/beethoven_x_fantom_schema.yml @@ -34,7 +34,7 @@ models: config: tags: ['fantom', 'balancer', 'pools', 'liquidity'] description: > - Beethoven X v2 pools liquidity by token in Arbitrum. + Beethoven X pools liquidity by token in fantom. tests: - dbt_utils.unique_combination_of_columns: combination_of_columns: @@ -111,3 +111,104 @@ models: tests: - not_null + - name: beethoven_x_fantom_protocol_fee + meta: + blockchain: fantom + project: beethoven_x + contributors: viniabussafi + config: + tags: ['fantom', 'revenue', 'fees'] + description: > + Daily Protocol Fee collected and Revenue by pool on Beethoven X, an automated portfolio manager and trading platform built on Balancer. + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - day + - pool_id + - token_address + columns: + - name: day + - name: pool_id + - name: pool_address + - name: pool_symbol + - name: blockchain + - name: token_address + - name: token_symbol + - name: token_amount_raw + description: "Raw amount of revenues of the token in the pool" + - name: token_amount + description: "Amount of revenues of the token in the pool" + - name: protocol_fee_collected_usd + description: "Fee collected in the pool in USD" + + - name: beethoven_x_fantom_bpt_supply + meta: + blockchain: fantom + project: beethoven_x + contributors: viniabussafi + config: + tags: ['fantom', 'bpt', 'supply'] + description: > + Balancer Pool Token (BPT) supply for Beethoven X pools built on Balancer. + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - day + - blockchain + - token_address + columns: + - name: day + - name: pool_type + - name: blockchain + - name: token_address + - name: supply + + - name: beethoven_x_fantom_bpt_prices + meta: + blockchain: fantom + project: beethoven_x + contributors: viniabussafi + config: + tags: ['fantom', 'bpt', 'prices'] + description: > + Balancer Pool Token (BPT) daily price by pool on Beethoven X, an automated portfolio manager and trading platform built on Balancer. + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - blockchain + - day + - contract_address + columns: + - name: blockchain + - name: day + - name: decimals + - name: contract_address + - name: bpt_price + + - name: beethoven_x_fantom_transfers_bpt + meta: + blockchain: fantom + project: beethoven_x + contributors: viniabussafi + config: + tags: ['fantom', 'bpt', 'transfers'] + description: > + Balancer Pool Token (BPT) transfer logs on Beethoven X, an automated portfolio manager and trading platform built on Balancer. + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - evt_tx_hash + - evt_index + - block_date + columns: + - name: blockchain + - name: contract_address + - name: block_date + - name: block_month + - name: evt_tx_hash + - name: evt_index + - name: evt_block_time + - name: evt_block_number + - name: from + - name: to + - name: value diff --git a/models/beethoven_x/fantom/beethoven_x_fantom_transfers_bpt.sql b/models/beethoven_x/fantom/beethoven_x_fantom_transfers_bpt.sql new file mode 100644 index 00000000000..6d6e33b2ac5 --- /dev/null +++ b/models/beethoven_x/fantom/beethoven_x_fantom_transfers_bpt.sql @@ -0,0 +1,41 @@ +{{ + config( + schema = 'beethoven_x_fantom', + alias = 'transfers_bpt', + partition_by = ['block_month'], + materialized = 'incremental', + file_format = 'delta', + incremental_strategy = 'merge', + unique_key = ['block_date', 'evt_tx_hash', 'evt_index'], + incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.evt_block_time')] + ) +}} + + WITH registered_pools AS ( + SELECT + DISTINCT poolAddress AS pool_address + FROM + {{ source('beethoven_x_fantom', 'Vault_evt_PoolRegistered') }} + ) + + SELECT DISTINCT * FROM ( + SELECT + 'fantom' AS blockchain, + transfer.contract_address, + transfer.evt_tx_hash, + transfer.evt_index, + transfer.evt_block_time, + TRY_CAST(date_trunc('DAY', transfer.evt_block_time) AS date) AS block_date, + TRY_CAST(date_trunc('MONTH', transfer.evt_block_time) AS date) AS block_month, + transfer.evt_block_number, + transfer."from", + transfer.to, + transfer.value + FROM {{ source('erc20_fantom', 'evt_transfer') }} transfer + INNER JOIN registered_pools p ON p.pool_address = transfer.contract_address + {% if not is_incremental() %} + WHERE transfer.evt_block_time >= TIMESTAMP '2021-08-26' + {% endif %} + {% if is_incremental() %} + WHERE {{ incremental_predicate('evt_block_time') }} + {% endif %} ) transfers \ No newline at end of file From c5bd5ad9e9d3234595741f3a4d28337a7150c281 Mon Sep 17 00:00:00 2001 From: tomfutago <35136350+tomfutago@users.noreply.github.com> Date: Mon, 3 Jun 2024 18:59:35 +0100 Subject: [PATCH 022/149] init (#5993) Co-authored-by: Huang Geyang Co-authored-by: jeff-dude <102681548+jeff-dude@users.noreply.github.com> --- macros/models/_sector/lending/lending_enrich_borrow.sql | 1 + macros/models/_sector/lending/lending_enrich_supply.sql | 1 + models/_sector/lending/borrow/_schema.yml | 3 +++ models/aave/ethereum/aave_ethereum_borrow.sql | 2 ++ models/aave/ethereum/aave_ethereum_schema.yml | 8 ++++++++ models/aave/ethereum/aave_ethereum_supply.sql | 2 ++ models/aave/optimism/aave_optimism_borrow.sql | 2 ++ models/aave/optimism/aave_optimism_schema.yml | 8 ++++++++ models/aave/optimism/aave_optimism_supply.sql | 2 ++ models/compound/ethereum/compound_ethereum_borrow.sql | 2 ++ models/compound/ethereum/compound_ethereum_schema.yml | 8 ++++++++ models/compound/ethereum/compound_ethereum_supply.sql | 2 ++ 12 files changed, 41 insertions(+) diff --git a/macros/models/_sector/lending/lending_enrich_borrow.sql b/macros/models/_sector/lending/lending_enrich_borrow.sql index 9179e322c55..646028c1bdb 100644 --- a/macros/models/_sector/lending/lending_enrich_borrow.sql +++ b/macros/models/_sector/lending/lending_enrich_borrow.sql @@ -9,6 +9,7 @@ select erc20.symbol, borrow.token_address, borrow.borrower, + borrow.on_behalf_of, borrow.repayer, borrow.liquidator, borrow.amount / power(10, coalesce(erc20.decimals, 18)) as amount, diff --git a/macros/models/_sector/lending/lending_enrich_supply.sql b/macros/models/_sector/lending/lending_enrich_supply.sql index 8600973a1ad..fa8af9c046a 100644 --- a/macros/models/_sector/lending/lending_enrich_supply.sql +++ b/macros/models/_sector/lending/lending_enrich_supply.sql @@ -8,6 +8,7 @@ select erc20.symbol, supply.token_address, supply.depositor, + supply.on_behalf_of, supply.withdrawn_to, supply.liquidator, supply.amount / power(10, coalesce(erc20.decimals, 18)) as amount, diff --git a/models/_sector/lending/borrow/_schema.yml b/models/_sector/lending/borrow/_schema.yml index 16f8998942c..64d0124459c 100644 --- a/models/_sector/lending/borrow/_schema.yml +++ b/models/_sector/lending/borrow/_schema.yml @@ -52,6 +52,9 @@ models: - &borrower name: borrower description: "Borrower wallet address" + - &on_behalf_of + name: on_behalf_of + description: "Wallet address tx was executed on behalf of" - &repayer name: repayer description: "Repayer wallet address" diff --git a/models/aave/ethereum/aave_ethereum_borrow.sql b/models/aave/ethereum/aave_ethereum_borrow.sql index 8bc8b7d7e7a..0ed57c505c9 100644 --- a/models/aave/ethereum/aave_ethereum_borrow.sql +++ b/models/aave/ethereum/aave_ethereum_borrow.sql @@ -19,6 +19,7 @@ select symbol, token_address, borrower, + on_behalf_of, repayer, liquidator, amount, @@ -26,6 +27,7 @@ select block_month, block_time, block_number, + project_contract_address, tx_hash, evt_index from {{ ref('lending_borrow') }} diff --git a/models/aave/ethereum/aave_ethereum_schema.yml b/models/aave/ethereum/aave_ethereum_schema.yml index b36176e8d07..f036e58e9a3 100644 --- a/models/aave/ethereum/aave_ethereum_schema.yml +++ b/models/aave/ethereum/aave_ethereum_schema.yml @@ -121,6 +121,9 @@ models: - &depositor name: depositor description: "Depositor wallet address" + - &on_behalf_of + name: on_behalf_of + description: "Wallet address tx was executed on behalf of" - &withdrawn_to name: withdrawn_to description: "The wallet address where the tokens are withdrawn" @@ -133,6 +136,9 @@ models: - &usd_amount name: usd_amount description: "Token amount in USD" + - &project_contract_address + name: project_contract_address + description: "Project contract address" - &tx_hash name: tx_hash description: "Transaction hash of the event" @@ -163,12 +169,14 @@ models: - &borrower name: borrower description: "Borrower wallet address" + - *on_behalf_of - &repayer name: repayer description: "Repayer wallet address" - *liquidator - *amount - *usd_amount + - *project_contract_address - *tx_hash - *evt_index - *block_time diff --git a/models/aave/ethereum/aave_ethereum_supply.sql b/models/aave/ethereum/aave_ethereum_supply.sql index 03391e8cac6..70ded20deb3 100644 --- a/models/aave/ethereum/aave_ethereum_supply.sql +++ b/models/aave/ethereum/aave_ethereum_supply.sql @@ -18,6 +18,7 @@ select symbol, token_address, depositor, + on_behalf_of, withdrawn_to, liquidator, amount, @@ -25,6 +26,7 @@ select block_month, block_time, block_number, + project_contract_address, tx_hash, evt_index from {{ ref('lending_supply') }} diff --git a/models/aave/optimism/aave_optimism_borrow.sql b/models/aave/optimism/aave_optimism_borrow.sql index f22f0b36b6b..b3deb66b1aa 100644 --- a/models/aave/optimism/aave_optimism_borrow.sql +++ b/models/aave/optimism/aave_optimism_borrow.sql @@ -19,6 +19,7 @@ select symbol, token_address, borrower, + on_behalf_of, repayer, liquidator, amount, @@ -26,6 +27,7 @@ select block_month, block_time, block_number, + project_contract_address, tx_hash, evt_index from {{ ref('lending_borrow') }} diff --git a/models/aave/optimism/aave_optimism_schema.yml b/models/aave/optimism/aave_optimism_schema.yml index 987f466cd9b..4add7b84a51 100644 --- a/models/aave/optimism/aave_optimism_schema.yml +++ b/models/aave/optimism/aave_optimism_schema.yml @@ -32,6 +32,9 @@ models: - &depositor name: depositor description: "Depositor wallet address" + - &on_behalf_of + name: on_behalf_of + description: "Wallet address tx was executed on behalf of" - &withdrawn_to name: withdrawn_to description: "Withdrawn to wallet address" @@ -53,6 +56,9 @@ models: - &block_number name: block_number description: "Event block number" + - &project_contract_address + name: project_contract_address + description: "Project contract address" - &tx_hash name: tx_hash description: "Transaction hash of the event" @@ -127,12 +133,14 @@ models: - &borrower name: borrower description: "Borrower wallet address" + - *on_behalf_of - &repayer name: repayer description: "Repayer wallet address" - *liquidator - *amount - *usd_amount + - *project_contract_address - *tx_hash - *evt_index - *block_time diff --git a/models/aave/optimism/aave_optimism_supply.sql b/models/aave/optimism/aave_optimism_supply.sql index deec38e0ef1..59f4eadc453 100644 --- a/models/aave/optimism/aave_optimism_supply.sql +++ b/models/aave/optimism/aave_optimism_supply.sql @@ -18,6 +18,7 @@ select symbol, token_address, depositor, + on_behalf_of, withdrawn_to, liquidator, amount, @@ -25,6 +26,7 @@ select block_month, block_time, block_number, + project_contract_address, tx_hash, evt_index from {{ ref('lending_supply') }} diff --git a/models/compound/ethereum/compound_ethereum_borrow.sql b/models/compound/ethereum/compound_ethereum_borrow.sql index 847ccfaf233..30b9c4e7139 100644 --- a/models/compound/ethereum/compound_ethereum_borrow.sql +++ b/models/compound/ethereum/compound_ethereum_borrow.sql @@ -19,6 +19,7 @@ select symbol, token_address, borrower, + on_behalf_of, repayer, liquidator, amount, @@ -26,6 +27,7 @@ select block_month, block_time, block_number, + project_contract_address, tx_hash, evt_index from {{ ref('lending_borrow') }} diff --git a/models/compound/ethereum/compound_ethereum_schema.yml b/models/compound/ethereum/compound_ethereum_schema.yml index 6d1f5395194..91feab51859 100644 --- a/models/compound/ethereum/compound_ethereum_schema.yml +++ b/models/compound/ethereum/compound_ethereum_schema.yml @@ -149,6 +149,9 @@ models: - &depositor name: depositor description: "Depositor wallet address" + - &on_behalf_of + name: on_behalf_of + description: "Wallet address tx was executed on behalf of" - &withdrawn_to name: withdrawn_to description: "The wallet address where the tokens are withdrawn to" @@ -161,6 +164,9 @@ models: - &usd_amount name: usd_amount description: "Token amount in USD" + - &project_contract_address + name: project_contract_address + description: "Project contract address" - &tx_hash name: tx_hash description: "Transaction hash of the event" @@ -196,6 +202,7 @@ models: - &borrower name: borrower description: "Borrower wallet address" + - *on_behalf_of - &repayer name: repayer description: "Repayer wallet address" @@ -204,5 +211,6 @@ models: - *usd_amount - *block_time - *block_number + - *project_contract_address - *tx_hash - *evt_index diff --git a/models/compound/ethereum/compound_ethereum_supply.sql b/models/compound/ethereum/compound_ethereum_supply.sql index d9be476a80e..32809d7b41d 100644 --- a/models/compound/ethereum/compound_ethereum_supply.sql +++ b/models/compound/ethereum/compound_ethereum_supply.sql @@ -18,6 +18,7 @@ select symbol, token_address, depositor, + on_behalf_of, withdrawn_to, liquidator, amount, @@ -25,6 +26,7 @@ select block_month, block_time, block_number, + project_contract_address, tx_hash, evt_index from {{ ref('lending_supply') }} From 07542e083045b305c2eb6de87519c213747fda07 Mon Sep 17 00:00:00 2001 From: Aleksander Partyga <59826792+alexus-98@users.noreply.github.com> Date: Mon, 3 Jun 2024 20:31:10 +0200 Subject: [PATCH 023/149] hivemapper model created (#5997) * hivemapper model created * minor change * minor change * config structure adjusted * config adjusted * incremental predicates added * ref func corrected * dbt_project.yml adjusted with source * identifiers syntax correction * identifier * jinja parameters into normal sql * is_incremental() macro added * limit to last 7 days * day adjusted * jeffs suggestions implemented * missing columns added * test for amount adjusted * accepted_range adjustment * incremental_predicate corrected * where statement corrected * last 3 days filter deleted * add target incremental predicate --------- Co-authored-by: jeff-dude <102681548+jeff-dude@users.noreply.github.com> --- .../solana/hivemapper_solana_rewards.sql | 72 +++++++++++++++++++ .../solana/hivemapper_solana_schema.yml | 40 +++++++++++ 2 files changed, 112 insertions(+) create mode 100644 models/hivemapper/solana/hivemapper_solana_rewards.sql create mode 100644 models/hivemapper/solana/hivemapper_solana_schema.yml diff --git a/models/hivemapper/solana/hivemapper_solana_rewards.sql b/models/hivemapper/solana/hivemapper_solana_rewards.sql new file mode 100644 index 00000000000..749d9cff9c2 --- /dev/null +++ b/models/hivemapper/solana/hivemapper_solana_rewards.sql @@ -0,0 +1,72 @@ +{{ + config( + schema = 'hivemapper_solana', + alias = 'rewards', + materialized = 'incremental', + file_format = 'delta', + incremental_strategy = 'merge', + unique_key = ['tx_id', 'outer_instruction_index', 'inner_instruction_index', 'block_slot'], + incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.block_time')], + post_hook = '{{ expose_spells(\'["solana"]\', + "project", + "hivemapper", + \'["ilemi", "alexus98"]\') }}') +}} + +with + honey_transfers as ( + SELECT + block_time + , block_date + , block_slot + , "action" + , amount + , token_mint_address + , from_owner + , to_owner + , from_token_account + , to_token_account + , tx_signer + , tx_id + , outer_instruction_index + , inner_instruction_index + , outer_executing_account + + FROM {{ ref('tokens_solana_transfers') }} WHERE token_mint_address = '4vMsoUT2BWatFweudnQM1xedRLfJgJ7hswhcpz4xgBTy' + + {% if is_incremental() %} + and + {{ incremental_predicate('block_time') }} + {% endif %} + ) + + , memo_join as ( + SELECT + case + when contains(tx.log_messages,'Program log: Memo (len 12): "Map Coverage"') then 'map coverage' + when contains(tx.log_messages,'Program log: Memo (len 6): "Bounty"') then 'bounty' + when contains(tx.log_messages,'Program log: Memo (len 4): "Buzz"') then 'buzz' + when contains(tx.log_messages,'Program log: Memo (len 18): "Map Editing and QA"') then 'QA (AI trainer)' + when contains(tx.log_messages,'Program log: Memo (len 15): "Map Consumption"') then 'map consumption' + when contains(tx.log_messages,'Program log: Memo (len 23): "Map Consumption (fleet)"') then 'map consumption (fleet)' + when contains(tx.log_messages,'Program log: Memo (len 17): "Foundation Reward"') then 'FTM' + when contains(tx.log_messages,'Program log: Memo (len 11): "Honey Burst"') then 'burst' + else null + end as reward_type + , hny.* + FROM {{ source('solana', 'transactions') }} tx + JOIN honey_transfers hny ON tx.id = hny.tx_id --assumes only one transfer per tx + WHERE 1=1 + and contains(account_keys, 'MemoSq4gqABAXKb96qnH8TysNcWxMyWCqXgDLGmfcHr') --memo program invoked sometimes not by honey though + {% if is_incremental() %} + and + {{ incremental_predicate('tx.block_time') }} + {% endif %} + + ) + +SELECT +* +FROM memo_join +WHERE reward_type is not null + diff --git a/models/hivemapper/solana/hivemapper_solana_schema.yml b/models/hivemapper/solana/hivemapper_solana_schema.yml new file mode 100644 index 00000000000..0ad95a4d00a --- /dev/null +++ b/models/hivemapper/solana/hivemapper_solana_schema.yml @@ -0,0 +1,40 @@ +version: 2 + +models: + - name: hivemapper_solana_rewards + meta: + blockchain: solana + project: hivemapper + contributors: [ilemi, alexus98] + config: + tags: ['hivemapper', 'solana', 'reward', 'honey'] + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - tx_id + - outer_instruction_index + - inner_instruction_index + - block_slot + + description: > + List of HONEY rewards distributed for contributors + columns: + - name: reward_type + - name: block_time + - name: block_date + - name: block_slot + - name: action + - name: amount + tests: + - dbt_utils.accepted_range: + max_value: 1000000000000000 # maximum reward of 1 million HONEY * 1e9 (9 decimal places) + min_value: 0 + - name: token_mint_address + - name: from_owner + - name: to_owner + - name: from_token_account + - name: to_token_account + - name: tx_signer + - name: tx_id + + From d0dfb68c9015ddf2004b3fe8d2b0ee3700209c41 Mon Sep 17 00:00:00 2001 From: 0xRob <83790096+0xRobin@users.noreply.github.com> Date: Mon, 3 Jun 2024 21:52:16 +0200 Subject: [PATCH 024/149] Clean up NFT incoming lineage (#6039) * Clean up NFT incoming lineage * add zora * fixref * remove dependency on base_transfers for zonic --- .../nft/platforms/sudoswap_v2_base_trades.sql | 6 +- .../nft/platforms/zonic_base_trades.sql | 56 +------------------ .../chains/arbitrum/platforms/_schema.yml | 15 +++++ .../sudoswap_v2_arbitrum__pools.sql} | 23 +++----- .../trades/chains/base/platforms/_schema.yml | 17 +++++- .../platforms/magiceden_base_base_trades.sql | 20 +++---- .../platforms/sudoswap_v2_base__pools.sql} | 23 +++----- .../chains/ethereum/platforms/_schema.yml | 30 ++++++++++ .../collectionswap_ethereum__pools.sql} | 0 .../collectionswap_ethereum_base_trades.sql | 2 +- .../sudoswap_v2_ethereum__pools.sql} | 23 +++----- .../quix_v1_optimism_base_trades.sql | 45 +++------------ .../quix_v2_optimism_base_trades.sql | 45 +++------------ .../quix_v3_optimism_base_trades.sql | 46 +++------------ .../quix_v4_optimism_base_trades.sql | 48 +++------------- .../quix_v5_optimism_base_trades.sql | 49 +++------------- models/_sector/nft/trades/nft_base_trades.sql | 1 + models/collectionswap/ethereum/_schema.yml | 20 ------- .../arbitrum/sudoswap_arbitrum_schema.yml | 51 ----------------- models/sudoswap/base/sudoswap_base_schema.yml | 51 ----------------- .../ethereum/sudoswap_ethereum_schema.yml | 36 ------------ 21 files changed, 147 insertions(+), 460 deletions(-) rename models/{sudoswap/arbitrum/sudoswap_v2_arbitrum_pool_creations.sql => _sector/nft/trades/chains/arbitrum/platforms/sudoswap_v2_arbitrum__pools.sql} (90%) rename models/{sudoswap/base/sudoswap_v2_base_pool_creations.sql => _sector/nft/trades/chains/base/platforms/sudoswap_v2_base__pools.sql} (90%) rename models/{collectionswap/ethereum/collectionswap_ethereum_pools.sql => _sector/nft/trades/chains/ethereum/platforms/collectionswap_ethereum__pools.sql} (100%) rename models/{sudoswap/ethereum/sudoswap_v2_ethereum_pool_creations.sql => _sector/nft/trades/chains/ethereum/platforms/sudoswap_v2_ethereum__pools.sql} (90%) delete mode 100644 models/collectionswap/ethereum/_schema.yml delete mode 100644 models/sudoswap/arbitrum/sudoswap_arbitrum_schema.yml delete mode 100644 models/sudoswap/base/sudoswap_base_schema.yml diff --git a/macros/models/_sector/nft/platforms/sudoswap_v2_base_trades.sql b/macros/models/_sector/nft/platforms/sudoswap_v2_base_trades.sql index 4746b9cea2b..5645e3844e9 100644 --- a/macros/models/_sector/nft/platforms/sudoswap_v2_base_trades.sql +++ b/macros/models/_sector/nft/platforms/sudoswap_v2_base_trades.sql @@ -7,7 +7,7 @@ WITH pools as ( SELECT * - FROM {{ ref('sudoswap_v2_' ~ blockchain ~ '_pool_creations')}} + FROM {{ ref('sudoswap_v2_' ~ blockchain ~ '__pools')}} ) , sell_nft_base as ( @@ -21,7 +21,7 @@ WITH ,case when p.nft_type = 'ERC1155' then array[p.nft_id] else sp_start.nftIds end as token_ids ,sp.output_protocolFee/(sp.protocolFeeMultiplier/1e18) as amount_raw --for some reason sp.spotPrice is sometimes inaccurate for GDA curves? https://explorer.phalcon.xyz/tx/eth/0x20f4cf9aecae7d26ee170fbbf8017fb290bc6ce0caeae30ad2ae085d214d04d3 ,sp.feeMultiplier - ,sp.protocolFeeMultiplier + ,sp.protocolFeeMultiplier ,sp.output_tradeFee ,sp.output_protocolFee ,COALESCE(case when cardinality(roy.output_1) = 0 then null else roy.output_1[1] end,cast(0 as uint256)) as royalty_fee_amount_raw @@ -184,7 +184,7 @@ blockchain , trade_type , trade_category , currency_contract -, case when trade_category = 'buy' +, case when trade_category = 'buy' then price_raw + platform_fee_amount_raw + royalty_fee_amount_raw + pool_fee_amount_raw --when purchasing, the user pays for the spot price + fees to the pool else price_raw - pool_fee_amount_raw --when selling, the pool pays out just the spot price since fees are deducted from amount out to user end as price_raw --trade pool fees are added to spot on purchase and subtracted on sale diff --git a/macros/models/_sector/nft/platforms/zonic_base_trades.sql b/macros/models/_sector/nft/platforms/zonic_base_trades.sql index 92b177a58ac..143c3eb6552 100644 --- a/macros/models/_sector/nft/platforms/zonic_base_trades.sql +++ b/macros/models/_sector/nft/platforms/zonic_base_trades.sql @@ -39,56 +39,6 @@ with events_raw as ( where {{incremental_predicate('evt_block_time')}} {% endif %} ) -,transfers_raw as ( - -- royalties - select - tr.block_number - ,tr.block_time - ,tr.tx_hash - ,tr.amount_raw as value - ,tr.to - ,er.evt_index - ,er.evt_index - coalesce(tr.evt_index,element_at(tr.trace_address,1), 0) as ranking - from events_raw as er - join {{ ref('tokens_' ~ blockchain ~ '_base_transfers') }} as tr - on er.tx_hash = tr.tx_hash - and er.block_number = tr.block_number - and tr.amount_raw > 0 - and tr."from" in (er.project_contract_address, er.buyer) -- only include transfer from zonic or buyer to royalty fee address - and tr.to not in ( - {{zonic_fee_address_address}} --platform fee address - ,er.seller - ,er.project_contract_address - {% if royalty_fee_receive_address_to_skip %} - {% for receive_address in royalty_fee_receive_address_to_skip %} - ,{{ receive_address }} - {% endfor %} - {% endif %} - ) - {% if not is_incremental() %} - -- smallest block number for source tables above - and tr.block_number >= {{min_block_number}} - {% endif %} - {% if is_incremental() %} - and {{incremental_predicate('tr.block_time')}} - {% endif %} -) -,transfers as ( - select - block_number - ,block_time - ,tx_hash - ,value - ,to - ,evt_index - from ( - select - * - ,row_number() over (partition by tx_hash, evt_index order by abs(ranking)) as rn - from transfers_raw - ) as x - where rn = 1 -- select closest by order -) , base_trades as ( select '{{ blockchain }}' as blockchain @@ -111,14 +61,10 @@ select ,er.project_contract_address ,er.platform_fee_amount_raw ,er.royalty_fee_amount_raw - ,case when tr.value is not null then tr.to end as royalty_fee_address + ,cast(null as varbinary) royalty_fee_address ,cast(null as varbinary) as platform_fee_address ,er.evt_index as sub_tx_trade_id from events_raw as er -left join transfers as tr - on tr.tx_hash = er.tx_hash - and tr.block_number = er.block_number - and tr.evt_index = er.evt_index ) -- this will be removed once tx_from and tx_to are available in the base event tables diff --git a/models/_sector/nft/trades/chains/arbitrum/platforms/_schema.yml b/models/_sector/nft/trades/chains/arbitrum/platforms/_schema.yml index d86b53a991d..01443e7a65d 100644 --- a/models/_sector/nft/trades/chains/arbitrum/platforms/_schema.yml +++ b/models/_sector/nft/trades/chains/arbitrum/platforms/_schema.yml @@ -91,6 +91,21 @@ models: - platform_fee_amount_raw - royalty_fee_amount_raw + - name: sudoswap_v2_arbitrum__pools + meta: + blockchain: arbitrum + project: sudoswap + contributors: [ ilemi ] + config: + tags: [ 'base','sudoswap','pool_creations' ] + description: > + sudoswap v2 pool creations on base + columns: + - name: pool_address + description: 'Address of the pool' + tests: + - unique + - name: sudoswap_v2_arbitrum_base_trades meta: blockchain: arbitrum diff --git a/models/sudoswap/arbitrum/sudoswap_v2_arbitrum_pool_creations.sql b/models/_sector/nft/trades/chains/arbitrum/platforms/sudoswap_v2_arbitrum__pools.sql similarity index 90% rename from models/sudoswap/arbitrum/sudoswap_v2_arbitrum_pool_creations.sql rename to models/_sector/nft/trades/chains/arbitrum/platforms/sudoswap_v2_arbitrum__pools.sql index f1aac256ee3..2031524b26c 100644 --- a/models/sudoswap/arbitrum/sudoswap_v2_arbitrum_pool_creations.sql +++ b/models/_sector/nft/trades/chains/arbitrum/platforms/sudoswap_v2_arbitrum__pools.sql @@ -1,21 +1,16 @@ {{ config( - alias = 'pool_creations', + alias = 'pools', schema = 'sudoswap_v2_arbitrum', - materialized = 'incremental', file_format = 'delta', incremental_strategy = 'merge', - unique_key = ['pool_address'], - post_hook='{{ expose_spells(\'["arbitrum"]\', - "project", - "sudoswap", - \'["niftytable","0xRob"]\') }}' + unique_key = ['pool_address'] ) }} with pool_creations as ( - SELECT + SELECT output_pair AS pool_address, nft_contract_address, nft_type, @@ -39,7 +34,7 @@ with call_tx_hash as creation_tx_hash, tx."from" as creator_address FROM ( - SELECT + SELECT output_pair, _nft AS nft_contract_address, _bondingCurve as bonding_curve, @@ -72,8 +67,8 @@ with {% if is_incremental() %} AND call_block_time >= date_trunc('day', now() - interval '7' day) {% endif %} - UNION ALL - SELECT + UNION ALL + SELECT output_pair , from_hex(json_extract_scalar(params,'$.nft')) as nft_contract_address , from_hex(json_extract_scalar(params,'$.bondingCurve')) as bonding_curve @@ -89,8 +84,8 @@ with {% if is_incremental() %} AND call_block_time >= date_trunc('day', now() - interval '7' day) {% endif %} - UNION ALL - SELECT + UNION ALL + SELECT output_pair , from_hex(json_extract_scalar(params,'$.nft')) as nft_contract_address , from_hex(json_extract_scalar(params,'$.bondingCurve')) as bonding_curve @@ -107,7 +102,7 @@ with AND call_block_time >= date_trunc('day', now() - interval '7' day) {% endif %} ) cre - INNER JOIN {{ source('arbitrum','transactions') }} tx + INNER JOIN {{ source('arbitrum','transactions') }} tx ON tx.block_time = cre.call_block_time AND tx.hash = cre.call_tx_hash AND tx.success diff --git a/models/_sector/nft/trades/chains/base/platforms/_schema.yml b/models/_sector/nft/trades/chains/base/platforms/_schema.yml index 42fe7517dab..3465314d8fc 100644 --- a/models/_sector/nft/trades/chains/base/platforms/_schema.yml +++ b/models/_sector/nft/trades/chains/base/platforms/_schema.yml @@ -94,6 +94,21 @@ models: - platform_fee_amount_raw - royalty_fee_amount_raw + - name: sudoswap_v2_base__pools + meta: + blockchain: base + project: sudoswap + contributors: [ ilemi ] + config: + tags: [ 'base','sudoswap','pool_creations' ] + description: > + sudoswap v2 pool creations on base + columns: + - name: pool_address + description: 'Address of the pool' + tests: + - unique + - name: sudoswap_v2_base_base_trades meta: blockchain: base @@ -134,4 +149,4 @@ models: tests: - check_columns_nft_base_trades - dbt_utils.unique_combination_of_columns: - combination_of_columns: [ 'block_number','tx_hash','sub_tx_trade_id' ] \ No newline at end of file + combination_of_columns: [ 'block_number','tx_hash','sub_tx_trade_id' ] diff --git a/models/_sector/nft/trades/chains/base/platforms/magiceden_base_base_trades.sql b/models/_sector/nft/trades/chains/base/platforms/magiceden_base_base_trades.sql index 8accfa47295..2a2e35e39c1 100644 --- a/models/_sector/nft/trades/chains/base/platforms/magiceden_base_base_trades.sql +++ b/models/_sector/nft/trades/chains/base/platforms/magiceden_base_base_trades.sql @@ -1,6 +1,6 @@ {{ config( schema = 'magiceden_base', - + alias = 'base_trades', materialized = 'incremental', file_format = 'delta', @@ -31,9 +31,9 @@ WITH trades AS ( {% else %} WHERE evt_block_time >= {{magiceden_start_date}} {% endif %} - + UNION ALL - + SELECT evt_block_time AS block_time , evt_block_number AS block_number , evt_tx_hash AS tx_hash @@ -53,9 +53,9 @@ WITH trades AS ( {% else %} WHERE evt_block_time >= {{magiceden_start_date}} {% endif %} - + UNION ALL - + SELECT evt_block_time AS block_time , evt_block_number AS block_number , evt_tx_hash AS tx_hash @@ -75,9 +75,9 @@ WITH trades AS ( {% else %} WHERE evt_block_time >= {{magiceden_start_date}} {% endif %} - + UNION ALL - + SELECT evt_block_time AS block_time , evt_block_number AS block_number , evt_tx_hash AS tx_hash @@ -98,7 +98,7 @@ WITH trades AS ( WHERE evt_block_time >= {{magiceden_start_date}} {% endif %} ) - + , whitelisted_trades AS ( SELECT t.block_time , t.block_number @@ -141,7 +141,7 @@ WITH trades AS ( , MAX_BY(tr.to, tr.amount_raw) FILTER (WHERE to != 0xca9337244b5f04cb946391bc8b8a980e988f9a6a) AS royalty_fee_address , SUM(tr.amount_raw) FILTER (WHERE to = 0xca9337244b5f04cb946391bc8b8a980e988f9a6a) AS platform_fee_amount_raw , SUM(tr.amount_raw) FILTER (WHERE to != 0xca9337244b5f04cb946391bc8b8a980e988f9a6a) AS royalty_fee_amount_raw - FROM {{ ref('tokens_base_transfers') }} tr + FROM {{ ref('tokens_base_base_transfers') }} tr INNER JOIN bundled_whitelisted_trades wt ON tr.block_number=wt.block_number AND tr.tx_hash=wt.tx_hash AND tr.amount_raw > 0 @@ -187,4 +187,4 @@ WITH trades AS ( ) -- this will be removed once tx_from and tx_to are available in the base event tables -{{ add_nft_tx_data('base_trades', 'base') }} \ No newline at end of file +{{ add_nft_tx_data('base_trades', 'base') }} diff --git a/models/sudoswap/base/sudoswap_v2_base_pool_creations.sql b/models/_sector/nft/trades/chains/base/platforms/sudoswap_v2_base__pools.sql similarity index 90% rename from models/sudoswap/base/sudoswap_v2_base_pool_creations.sql rename to models/_sector/nft/trades/chains/base/platforms/sudoswap_v2_base__pools.sql index a79ff0f9a7f..00981584c7f 100644 --- a/models/sudoswap/base/sudoswap_v2_base_pool_creations.sql +++ b/models/_sector/nft/trades/chains/base/platforms/sudoswap_v2_base__pools.sql @@ -1,21 +1,16 @@ {{ config( - alias = 'pool_creations', + alias = 'pools', schema = 'sudoswap_v2_base', - materialized = 'incremental', file_format = 'delta', incremental_strategy = 'merge', - unique_key = ['pool_address'], - post_hook='{{ expose_spells(\'["base"]\', - "project", - "sudoswap", - \'["niftytable","0xRob"]\') }}' + unique_key = ['pool_address'] ) }} with pool_creations as ( - SELECT + SELECT output_pair AS pool_address, nft_contract_address, nft_type, @@ -39,7 +34,7 @@ with call_tx_hash as creation_tx_hash, tx."from" as creator_address FROM ( - SELECT + SELECT output_pair, _nft AS nft_contract_address, _bondingCurve as bonding_curve, @@ -72,8 +67,8 @@ with {% if is_incremental() %} AND call_block_time >= date_trunc('day', now() - interval '7' day) {% endif %} - UNION ALL - SELECT + UNION ALL + SELECT output_pair , from_hex(json_extract_scalar(params,'$.nft')) as nft_contract_address , from_hex(json_extract_scalar(params,'$.bondingCurve')) as bonding_curve @@ -89,8 +84,8 @@ with {% if is_incremental() %} AND call_block_time >= date_trunc('day', now() - interval '7' day) {% endif %} - UNION ALL - SELECT + UNION ALL + SELECT output_pair , from_hex(json_extract_scalar(params,'$.nft')) as nft_contract_address , from_hex(json_extract_scalar(params,'$.bondingCurve')) as bonding_curve @@ -107,7 +102,7 @@ with AND call_block_time >= date_trunc('day', now() - interval '7' day) {% endif %} ) cre - INNER JOIN {{ source('base','transactions') }} tx + INNER JOIN {{ source('base','transactions') }} tx ON tx.block_time = cre.call_block_time AND tx.hash = cre.call_tx_hash AND tx.success diff --git a/models/_sector/nft/trades/chains/ethereum/platforms/_schema.yml b/models/_sector/nft/trades/chains/ethereum/platforms/_schema.yml index 8874c750877..a67d9178e45 100644 --- a/models/_sector/nft/trades/chains/ethereum/platforms/_schema.yml +++ b/models/_sector/nft/trades/chains/ethereum/platforms/_schema.yml @@ -499,6 +499,21 @@ models: - platform_fee_amount_raw - royalty_fee_amount_raw + - name: sudoswap_v2_ethereum__pools + meta: + blockchain: ethereum + project: sudoswap + contributors: [ ilemi ] + config: + tags: [ 'ethereum','sudoswap','pool_creations' ] + description: > + sudoswap v2 pool creations on Ethereum + columns: + - name: pool_address # unique + description: 'Address of the pool' + tests: + - unique + - name: sudoswap_v2_ethereum_base_trades meta: blockchain: ethereum @@ -527,6 +542,21 @@ models: - platform_fee_amount_raw - royalty_fee_amount_raw + - name: collectionswap_ethereum__pools + meta: + blockchain: ethereum + project: collectionswap + contributors: 0xRob + config: + tags: [ 'ethereum','collectionswap','v1','pools' ] + description: > + collectionswap v1 pools on ethereum + columns: + - name: pool_address + tests: + - unique + + - name: collectionswap_ethereum_base_trades meta: blockchain: ethereum diff --git a/models/collectionswap/ethereum/collectionswap_ethereum_pools.sql b/models/_sector/nft/trades/chains/ethereum/platforms/collectionswap_ethereum__pools.sql similarity index 100% rename from models/collectionswap/ethereum/collectionswap_ethereum_pools.sql rename to models/_sector/nft/trades/chains/ethereum/platforms/collectionswap_ethereum__pools.sql diff --git a/models/_sector/nft/trades/chains/ethereum/platforms/collectionswap_ethereum_base_trades.sql b/models/_sector/nft/trades/chains/ethereum/platforms/collectionswap_ethereum_base_trades.sql index b7029404ce9..b3c557ccc92 100644 --- a/models/_sector/nft/trades/chains/ethereum/platforms/collectionswap_ethereum_base_trades.sql +++ b/models/_sector/nft/trades/chains/ethereum/platforms/collectionswap_ethereum_base_trades.sql @@ -92,7 +92,7 @@ base_trades as ( p.nft_contract_address, p.token_address as currency_contract from raw_trades t - left join {{ ref('collectionswap_ethereum_pools') }} p + left join {{ ref('collectionswap_ethereum__pools') }} p on t.project_contract_address = p.pool_address ) diff --git a/models/sudoswap/ethereum/sudoswap_v2_ethereum_pool_creations.sql b/models/_sector/nft/trades/chains/ethereum/platforms/sudoswap_v2_ethereum__pools.sql similarity index 90% rename from models/sudoswap/ethereum/sudoswap_v2_ethereum_pool_creations.sql rename to models/_sector/nft/trades/chains/ethereum/platforms/sudoswap_v2_ethereum__pools.sql index e03945706fd..b1b845c9b84 100644 --- a/models/sudoswap/ethereum/sudoswap_v2_ethereum_pool_creations.sql +++ b/models/_sector/nft/trades/chains/ethereum/platforms/sudoswap_v2_ethereum__pools.sql @@ -1,21 +1,16 @@ {{ config( - alias = 'pool_creations', + alias = 'pools', schema = 'sudoswap_v2_ethereum', - materialized = 'incremental', file_format = 'delta', incremental_strategy = 'merge', - unique_key = ['pool_address'], - post_hook='{{ expose_spells(\'["ethereum"]\', - "project", - "sudoswap", - \'["niftytable","0xRob"]\') }}' + unique_key = ['pool_address'] ) }} with pool_creations as ( - SELECT + SELECT output_pair AS pool_address, nft_contract_address, nft_type, @@ -39,7 +34,7 @@ with call_tx_hash as creation_tx_hash, tx."from" as creator_address FROM ( - SELECT + SELECT output_pair, _nft AS nft_contract_address, _bondingCurve as bonding_curve, @@ -72,8 +67,8 @@ with {% if is_incremental() %} AND call_block_time >= date_trunc('day', now() - interval '7' day) {% endif %} - UNION ALL - SELECT + UNION ALL + SELECT output_pair , from_hex(json_extract_scalar(params,'$.nft')) as nft_contract_address , from_hex(json_extract_scalar(params,'$.bondingCurve')) as bonding_curve @@ -89,8 +84,8 @@ with {% if is_incremental() %} AND call_block_time >= date_trunc('day', now() - interval '7' day) {% endif %} - UNION ALL - SELECT + UNION ALL + SELECT output_pair , from_hex(json_extract_scalar(params,'$.nft')) as nft_contract_address , from_hex(json_extract_scalar(params,'$.bondingCurve')) as bonding_curve @@ -107,7 +102,7 @@ with AND call_block_time >= date_trunc('day', now() - interval '7' day) {% endif %} ) cre - INNER JOIN {{ source('ethereum','transactions') }} tx + INNER JOIN {{ source('ethereum','transactions') }} tx ON tx.block_time = cre.call_block_time AND tx.hash = cre.call_tx_hash AND tx.success diff --git a/models/_sector/nft/trades/chains/optimism/platforms/quix_v1_optimism_base_trades.sql b/models/_sector/nft/trades/chains/optimism/platforms/quix_v1_optimism_base_trades.sql index 2c5cc8974ea..62d1aa1fe10 100644 --- a/models/_sector/nft/trades/chains/optimism/platforms/quix_v1_optimism_base_trades.sql +++ b/models/_sector/nft/trades/chains/optimism/platforms/quix_v1_optimism_base_trades.sql @@ -31,18 +31,18 @@ with events_raw as ( {% endif %} ) ,transfers as ( - -- eth royalties + -- royalties select - tr.tx_block_number as block_number - ,tr.tx_block_time as block_time + tr.block_number as block_number + ,tr.block_time as block_time ,tr.tx_hash - ,cast(tr.value as uint256) as value + ,tr.amount_raw as value ,tr.to from events_raw as er - join {{ ref('transfers_optimism_eth') }} as tr + join {{ ref('tokens_optimism_base_transfers') }} as tr on er.tx_hash = tr.tx_hash - and er.block_number = tr.tx_block_number - and tr.value_decimal > 0 + and er.block_number = tr.block_number + and tr.amount_raw > 0 and tr.to not in ( {{quix_fee_address_address}} --qx platform fee address ,er.seller @@ -50,37 +50,10 @@ with events_raw as ( ) {% if not is_incremental() %} -- smallest block number for source tables above - and tr.tx_block_number >= {{min_block_number}} + and tr.block_number >= {{min_block_number}} {% endif %} {% if is_incremental() %} - and tr.tx_block_time >= date_trunc('day', now() - interval '7' day) - {% endif %} - - union all - - -- erc20 royalities - select - erc20.evt_block_number as block_number - ,erc20.evt_block_time as block_time - ,erc20.evt_tx_hash as tx_hash - ,cast(erc20.value as uint256) as value - ,erc20.to - from events_raw as er - join {{ source('erc20_optimism','evt_transfer') }} as erc20 - on er.tx_hash = erc20.evt_tx_hash - and er.block_number = erc20.evt_block_number - and erc20.value is not null - and erc20.to not in ( - {{quix_fee_address_address}} --qx platform fee address - ,er.seller - ,er.project_contract_address - ) - {% if not is_incremental() %} - -- smallest block number for source tables above - and erc20.evt_block_number >= {{min_block_number}} - {% endif %} - {% if is_incremental() %} - and erc20.evt_block_time >= date_trunc('day', now() - interval '7' day) + and tr.block_time >= date_trunc('day', now() - interval '7' day) {% endif %} ) ,base_trades as ( diff --git a/models/_sector/nft/trades/chains/optimism/platforms/quix_v2_optimism_base_trades.sql b/models/_sector/nft/trades/chains/optimism/platforms/quix_v2_optimism_base_trades.sql index 3fe012f8ca0..40f5bf45a29 100644 --- a/models/_sector/nft/trades/chains/optimism/platforms/quix_v2_optimism_base_trades.sql +++ b/models/_sector/nft/trades/chains/optimism/platforms/quix_v2_optimism_base_trades.sql @@ -71,18 +71,18 @@ with events_raw as ( where nft_contract_address != 0xbe81eabdbd437cba43e4c1c330c63022772c2520 -- --exploit contract ) ,transfers as ( - -- eth royalities + -- royalities select - tr.tx_block_number as block_number - ,tr.tx_block_time as block_time + tr.block_number as block_number + ,tr.block_time as block_time ,tr.tx_hash - ,cast(tr.value as uint256) as value + ,cast(tr.amount_raw as uint256) as value ,tr.to from events_raw as er - join {{ ref('transfers_optimism_eth') }} as tr + join {{ ref('tokens_optimism_base_transfers') }} as tr on er.tx_hash = tr.tx_hash - and er.block_number = tr.tx_block_number - and tr.value_decimal > 0 + and er.block_number = tr.block_number + and tr.amount_raw > 0 and tr.to not in ( {{quix_fee_address_address}} --qx platform fee address ,er.seller @@ -90,37 +90,10 @@ with events_raw as ( ) {% if not is_incremental() %} -- smallest block number for source tables above - and tr.tx_block_number >= {{min_block_number}} + and tr.block_number >= {{min_block_number}} {% endif %} {% if is_incremental() %} - and tr.tx_block_time >= date_trunc('day', now() - interval '7' day) - {% endif %} - - union all - - -- erc20 royalities - select - erc20.evt_block_number as block_number - ,erc20.evt_block_time as block_time - ,erc20.evt_tx_hash as tx_hash - ,erc20.value - ,erc20.to - from events_raw as er - join {{ source('erc20_optimism','evt_transfer') }} as erc20 - on er.tx_hash = erc20.evt_tx_hash - and er.block_number = erc20.evt_block_number - and erc20.value is not null - and erc20.to not in ( - {{quix_fee_address_address}} --qx platform fee address - ,er.seller - ,er.project_contract_address - ) - {% if not is_incremental() %} - -- smallest block number for source tables above - and erc20.evt_block_number >= {{min_block_number}} - {% endif %} - {% if is_incremental() %} - and erc20.evt_block_time >= date_trunc('day', now() - interval '7' day) + and tr.block_time >= date_trunc('day', now() - interval '7' day) {% endif %} ) ,base_trades as ( diff --git a/models/_sector/nft/trades/chains/optimism/platforms/quix_v3_optimism_base_trades.sql b/models/_sector/nft/trades/chains/optimism/platforms/quix_v3_optimism_base_trades.sql index 89eeed6aa79..44a38dc53b5 100644 --- a/models/_sector/nft/trades/chains/optimism/platforms/quix_v3_optimism_base_trades.sql +++ b/models/_sector/nft/trades/chains/optimism/platforms/quix_v3_optimism_base_trades.sql @@ -71,18 +71,18 @@ with events_raw as ( where nft_contract_address != 0xbe81eabdbd437cba43e4c1c330c63022772c2520 -- --exploit contract ) ,transfers as ( - -- eth royalities + -- royalities select - tr.tx_block_number as block_number - ,tr.tx_block_time as block_time + tr.block_number as block_number + ,tr.block_time as block_time ,tr.tx_hash - ,cast(tr.value as uint256) as value + ,cast(tr.amount_raw as uint256) as value ,tr.to from events_raw as er - join {{ ref('transfers_optimism_eth') }} as tr + join {{ ref('tokens_optimism_base_transfers') }} as tr on er.tx_hash = tr.tx_hash - and er.block_number = tr.tx_block_number - and tr.value_decimal > 0 + and er.block_number = tr.block_number + and tr.amount_raw > 0 and tr.to not in ( {{quix_fee_address_address}} --qx platform fee address ,er.seller @@ -91,38 +91,10 @@ with events_raw as ( ) {% if not is_incremental() %} -- smallest block number for source tables above - and tr.tx_block_number >= {{min_block_number}} + and tr.block_number >= {{min_block_number}} {% endif %} {% if is_incremental() %} - and tr.tx_block_time >= date_trunc('day', now() - interval '7' day) - {% endif %} - - union all - - -- erc20 royalities - select - erc20.evt_block_number as block_number - ,erc20.evt_block_time as block_time - ,erc20.evt_tx_hash as tx_hash - ,erc20.value - ,erc20.to - from events_raw as er - join {{ source('erc20_optimism','evt_transfer') }} as erc20 - on er.tx_hash = erc20.evt_tx_hash - and er.block_number = erc20.evt_block_number - and erc20.value is not null - and erc20.to not in ( - {{quix_fee_address_address}} --qx platform fee address - ,er.seller - ,er.project_contract_address - ,0x0000000000000000000000000000000000000000 -- v3 first few txs misconfigured to send fee to null address - ) - {% if not is_incremental() %} - -- smallest block number for source tables above - and erc20.evt_block_number >= {{min_block_number}} - {% endif %} - {% if is_incremental() %} - and erc20.evt_block_time >= date_trunc('day', now() - interval '7' day) + and tr.block_time >= date_trunc('day', now() - interval '7' day) {% endif %} ) ,base_trades as ( diff --git a/models/_sector/nft/trades/chains/optimism/platforms/quix_v4_optimism_base_trades.sql b/models/_sector/nft/trades/chains/optimism/platforms/quix_v4_optimism_base_trades.sql index 2dea93485df..ea24e52ae13 100644 --- a/models/_sector/nft/trades/chains/optimism/platforms/quix_v4_optimism_base_trades.sql +++ b/models/_sector/nft/trades/chains/optimism/platforms/quix_v4_optimism_base_trades.sql @@ -73,18 +73,18 @@ with events_raw as ( ,transfers_raw as ( -- eth royalities select - tr.tx_block_number as block_number - ,tr.tx_block_time as block_time + tr.block_number as block_number + ,tr.block_time as block_time ,tr.tx_hash - ,cast(tr.value as uint256) as value + ,cast(tr.amount_raw as uint256) as value ,tr.to ,er.evt_index ,er.evt_index - coalesce(tr.trace_address[1], 0) as ranking from events_raw as er - join {{ ref('transfers_optimism_eth') }} as tr + join {{ ref('tokens_optimism_base_transfers') }} as tr on er.tx_hash = tr.tx_hash - and er.block_number = tr.tx_block_number - and tr.value_decimal > 0 + and er.block_number = tr.block_number + and tr.amount_raw > 0 and tr."from" in (er.project_contract_address, er.buyer) -- only include transfer from qx or buyer to royalty fee address and tr.to not in ( {{quix_fee_address_address}} --qx platform fee address @@ -95,42 +95,10 @@ with events_raw as ( ) {% if not is_incremental() %} -- smallest block number for source tables above - and tr.tx_block_number >= {{min_block_number}} + and tr.block_number >= {{min_block_number}} {% endif %} {% if is_incremental() %} - and tr.tx_block_time >= date_trunc('day', now() - interval '7' day) - {% endif %} - - union all - - -- erc20 royalities - select - erc20.evt_block_number as block_number - ,erc20.evt_block_time as block_time - ,erc20.evt_tx_hash as tx_hash - ,erc20.value - ,erc20.to - ,er.evt_index - ,er.evt_index - erc20.evt_index as ranking - from events_raw as er - join {{ source('erc20_optimism','evt_transfer') }} as erc20 - on er.tx_hash = erc20.evt_tx_hash - and er.block_number = erc20.evt_block_number - and erc20.value is not null - and erc20."from" in (er.project_contract_address, er.buyer) -- only include transfer from qx to royalty fee address - and erc20.to not in ( - {{quix_fee_address_address}} --qx platform fee address - ,er.seller - ,er.project_contract_address - ,0x0000000000000000000000000000000000000000 -- v3 first few txs misconfigured to send fee to null address - ,0x942f9ce5d9a33a82f88d233aeb3292e680230348 -- v4 there are txs via Ambire Wallet Contract Deployer to be excluded - ) - {% if not is_incremental() %} - -- smallest block number for source tables above - and erc20.evt_block_number >= {{min_block_number}} - {% endif %} - {% if is_incremental() %} - and erc20.evt_block_time >= date_trunc('day', now() - interval '7' day) + and tr.block_time >= date_trunc('day', now() - interval '7' day) {% endif %} ) diff --git a/models/_sector/nft/trades/chains/optimism/platforms/quix_v5_optimism_base_trades.sql b/models/_sector/nft/trades/chains/optimism/platforms/quix_v5_optimism_base_trades.sql index 052427dc7f0..724135ba0ba 100644 --- a/models/_sector/nft/trades/chains/optimism/platforms/quix_v5_optimism_base_trades.sql +++ b/models/_sector/nft/trades/chains/optimism/platforms/quix_v5_optimism_base_trades.sql @@ -33,18 +33,18 @@ with events_raw as ( ,transfers_raw as ( -- eth royalities select - tr.tx_block_number as block_number - ,tr.tx_block_time as block_time + tr.block_number as block_number + ,tr.block_time as block_time ,tr.tx_hash - ,cast(tr.value as uint256) as value + ,cast(tr.amount_raw as uint256) as value ,tr.to ,er.evt_index ,er.evt_index - coalesce(tr.trace_address[1], 0) as ranking from events_raw as er - join {{ ref('transfers_optimism_eth') }} as tr + join {{ ref('tokens_optimism_base_transfers') }} as tr on er.tx_hash = tr.tx_hash - and er.block_number = tr.tx_block_number - and tr.value_decimal > 0 + and er.block_number = tr.block_number + and tr.amount_raw > 0 and tr."from" in (er.project_contract_address, er.buyer) -- only include transfer from qx or buyer to royalty fee address and tr.to not in ( {{quix_fee_address_address}} --qx platform fee address @@ -56,43 +56,10 @@ with events_raw as ( ) {% if not is_incremental() %} -- smallest block number for source tables above - and tr.tx_block_number >= {{min_block_number}} + and tr.block_number >= {{min_block_number}} {% endif %} {% if is_incremental() %} - and tr.tx_block_time >= date_trunc('day', now() - interval '7' day) - {% endif %} - - union all - - -- erc20 royalities - select - erc20.evt_block_number as block_number - ,erc20.evt_block_time as block_time - ,erc20.evt_tx_hash as tx_hash - ,erc20.value - ,erc20.to - ,er.evt_index - ,er.evt_index - erc20.evt_index as ranking - from events_raw as er - join {{ source('erc20_optimism','evt_transfer') }} as erc20 - on er.tx_hash = erc20.evt_tx_hash - and er.block_number = erc20.evt_block_number - and erc20.value is not null - and erc20."from" in (er.project_contract_address, er.buyer) -- only include transfer from qx to royalty fee address - and erc20.to not in ( - {{quix_fee_address_address}} --qx platform fee address - ,er.seller - ,er.project_contract_address - ,0x0000000000000000000000000000000000000000 -- v3 first few txs misconfigured to send fee to null address - ,0x942f9ce5d9a33a82f88d233aeb3292e680230348 -- v4 there are txs via Ambire Wallet Contract Deployer to be excluded - ,0xdf95dc47753c94771f52444a2517f4bae7c6046d -- v5 another contract that creates mutiple internal transfers, e.g. https://optimistic.etherscan.io/tx/0x7c7daf30bf3fa829c22428fd275bbe7b30b62f7ccebd2a8e4aaa396904f01b78 - ) - {% if not is_incremental() %} - -- smallest block number for source tables above - and erc20.evt_block_number >= {{min_block_number}} - {% endif %} - {% if is_incremental() %} - and erc20.evt_block_time >= date_trunc('day', now() - interval '7' day) + and tr.block_time >= date_trunc('day', now() - interval '7' day) {% endif %} ) ,transfers as ( diff --git a/models/_sector/nft/trades/nft_base_trades.sql b/models/_sector/nft/trades/nft_base_trades.sql index cb93a161a0d..94cfd80f831 100644 --- a/models/_sector/nft/trades/nft_base_trades.sql +++ b/models/_sector/nft/trades/nft_base_trades.sql @@ -24,6 +24,7 @@ ,ref('nft_celo_base_trades') ,ref('nft_avalanche_c_base_trades') ,ref('nft_linea_base_trades') + ,ref('nft_zora_base_trades') ] %} with base_union as ( diff --git a/models/collectionswap/ethereum/_schema.yml b/models/collectionswap/ethereum/_schema.yml deleted file mode 100644 index a39af856a86..00000000000 --- a/models/collectionswap/ethereum/_schema.yml +++ /dev/null @@ -1,20 +0,0 @@ -version: 2 - -models: - - name: collectionswap_ethereum_pools - meta: - blockchain: ethereum - project: collectionswap - contributors: 0xRob - config: - tags: [ 'ethereum','collectionswap','v1','pools' ] - description: > - collectionswap v1 pools on ethereum - columns: - - name: pool_address - tests: - - unique - - name: nft_contract_address - - name: token_address - - name: create_tx_hash - - name: create_block_time diff --git a/models/sudoswap/arbitrum/sudoswap_arbitrum_schema.yml b/models/sudoswap/arbitrum/sudoswap_arbitrum_schema.yml deleted file mode 100644 index feb82552a51..00000000000 --- a/models/sudoswap/arbitrum/sudoswap_arbitrum_schema.yml +++ /dev/null @@ -1,51 +0,0 @@ -version: 2 - -models: - - - name: sudoswap_v2_arbitrum_pool_creations - meta: - blockchain: arbitrum - project: sudoswap - contributors: [ ilemi ] - config: - tags: [ 'arbitrum','sudoswap','pool_creations' ] - description: > - sudoswap v2 pool creations on arbitrum - columns: - - name: pool_address # unique - description: 'Address of the pool' - tests: - - unique - - &nft_contract_address - name: nft_contract_address - description: "Address of the NFT contract" - - &creator_address - name: creator_address - description: "Address of the pool creator" - - &pool_type - name: pool_type - description: "Type of pool" - - &bonding_curve - name: bonding_curve - description: "Type of bonding curve" - - &pool_factory - name: pool_factory - description: "the factory used to create the pool" - - &creation_block_time - name: creation_block_time - description: "time the pool was created" - - &creation_tx_hash - name: creation_tx_hash - description: "hash of the tx the pool was created" - - &nft_type - name: nft_type - description: "ERC721 or ERC1155 pool type" - - &nft_id - name: nft_id - description: "id of ERC1155 token if it's an 1155 pool" - - &token_type - name: token_type - description: "the token type used for trading the NFTs" - - &token_contract_address - name: token_contract_address - description: "address of token used for trading the NFTs" \ No newline at end of file diff --git a/models/sudoswap/base/sudoswap_base_schema.yml b/models/sudoswap/base/sudoswap_base_schema.yml deleted file mode 100644 index ba3fcf05574..00000000000 --- a/models/sudoswap/base/sudoswap_base_schema.yml +++ /dev/null @@ -1,51 +0,0 @@ -version: 2 - -models: - - - name: sudoswap_v2_base_pool_creations - meta: - blockchain: base - project: sudoswap - contributors: [ ilemi ] - config: - tags: [ 'base','sudoswap','pool_creations' ] - description: > - sudoswap v2 pool creations on base - columns: - - name: pool_address # unique - description: 'Address of the pool' - tests: - - unique - - &nft_contract_address - name: nft_contract_address - description: "Address of the NFT contract" - - &creator_address - name: creator_address - description: "Address of the pool creator" - - &pool_type - name: pool_type - description: "Type of pool" - - &bonding_curve - name: bonding_curve - description: "Type of bonding curve" - - &pool_factory - name: pool_factory - description: "the factory used to create the pool" - - &creation_block_time - name: creation_block_time - description: "time the pool was created" - - &creation_tx_hash - name: creation_tx_hash - description: "hash of the tx the pool was created" - - &nft_type - name: nft_type - description: "ERC721 or ERC1155 pool type" - - &nft_id - name: nft_id - description: "id of ERC1155 token if it's an 1155 pool" - - &token_type - name: token_type - description: "the token type used for trading the NFTs" - - &token_contract_address - name: token_contract_address - description: "address of token used for trading the NFTs" \ No newline at end of file diff --git a/models/sudoswap/ethereum/sudoswap_ethereum_schema.yml b/models/sudoswap/ethereum/sudoswap_ethereum_schema.yml index 959e11f8f5b..76d2e3255b7 100644 --- a/models/sudoswap/ethereum/sudoswap_ethereum_schema.yml +++ b/models/sudoswap/ethereum/sudoswap_ethereum_schema.yml @@ -116,41 +116,6 @@ models: - *creation_block_time - *creation_tx_hash - - name: sudoswap_v2_ethereum_pool_creations - meta: - blockchain: ethereum - project: sudoswap - contributors: [ ilemi ] - config: - tags: [ 'ethereum','sudoswap','pool_creations' ] - description: > - sudoswap v2 pool creations on Ethereum - columns: - - name: pool_address # unique - description: 'Address of the pool' - tests: - - unique - - *nft_contract_address - - *creator_address - - *bonding_curve - - *pool_type - - *pool_factory - - *creation_block_time - - *creation_tx_hash - - &nft_type - name: nft_type - description: "ERC721 or ERC1155 pool type" - - &nft_id - name: nft_id - description: "id of ERC1155 token if it's an 1155 pool" - - &token_type - name: token_type - description: "the token type used for trading the NFTs" - - &token_contract_address - name: token_contract_address - description: "address of token used for trading the NFTs" - - - name: sudoswap_ethereum_pool_trades_agg_day meta: blockchain: ethereum @@ -280,4 +245,3 @@ models: - &evt_index name: evt_index description: "Event index" - \ No newline at end of file From 8945fa510a1a28cb225af568568fb4a9d7d696ff Mon Sep 17 00:00:00 2001 From: 0xRob <83790096+0xRobin@users.noreply.github.com> Date: Mon, 3 Jun 2024 21:52:45 +0200 Subject: [PATCH 025/149] partition by blockchain (#6023) Co-authored-by: jeff-dude <102681548+jeff-dude@users.noreply.github.com> --- models/_sector/nft/mints/nft_mints.sql | 2 +- models/_sector/nft/transfers/nft_transfers.sql | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/models/_sector/nft/mints/nft_mints.sql b/models/_sector/nft/mints/nft_mints.sql index a069e4a1769..a8c91d9e6dc 100644 --- a/models/_sector/nft/mints/nft_mints.sql +++ b/models/_sector/nft/mints/nft_mints.sql @@ -1,7 +1,7 @@ {{ config( alias = 'mints', schema = 'nft', - partition_by = ['block_month'], + partition_by = ['blockchain','block_month'], materialized = 'incremental', file_format = 'delta', incremental_strategy = 'merge', diff --git a/models/_sector/nft/transfers/nft_transfers.sql b/models/_sector/nft/transfers/nft_transfers.sql index 01249423cfb..3ea4b3cf5aa 100644 --- a/models/_sector/nft/transfers/nft_transfers.sql +++ b/models/_sector/nft/transfers/nft_transfers.sql @@ -2,7 +2,7 @@ schema = 'nft', alias ='transfers', - partition_by = ['block_month'], + partition_by = ['blockchain','block_month'], materialized = 'incremental', file_format = 'delta', incremental_strategy = 'merge', From 1d6b95932440d1eebb9f22ffc3206278dec68ad9 Mon Sep 17 00:00:00 2001 From: 0xRob <83790096+0xRobin@users.noreply.github.com> Date: Mon, 3 Jun 2024 21:55:38 +0200 Subject: [PATCH 026/149] Seaport refactor to base trades schema (#6000) * Move all Opensea Seaport models to the new base_trades schema * adapt polygon schema * adopt schema + fake seed * remove refs * syntax fix * remove duplicate bandage * include sub_tx_trade_id in seed * amount_raw -> price_raw * restore wyvern seed * version -> project_version * remove double matched transaction * integrate into chain-level base trades * block_date and block_month * syntax * fixxies * fix compile * fixxx plez * improve performance * fix ref * syntax * fix merge * fix compile --------- Co-authored-by: jeff-dude <102681548+jeff-dude@users.noreply.github.com> --- .../nft/platforms/seaport_v3_trades.sql | 50 ++-- .../nft/platforms/seaport_v4_trades.sql | 61 ++--- .../arbitrum/nft_arbitrum_base_trades.sql | 2 + .../chains/arbitrum/platforms/_schema.yml | 66 +++++ .../opensea_v3_arbitrum_base_trades.sql} | 4 +- .../opensea_v4_arbitrum_base_trades.sql} | 5 +- .../nft_avalanche_c_base_trades.sql | 4 +- .../chains/avalanche_c/platforms/_schema.yml | 66 +++++ .../opensea_v3_avalanche_c_base_trades.sql} | 4 +- .../opensea_v4_avalanche_c_base_trades.sql} | 5 +- .../chains/base/nft_base_base_trades.sql | 1 + .../trades/chains/base/platforms/_schema.yml | 33 +++ .../opensea_v4_base_base_trades.sql} | 5 +- .../ethereum/nft_ethereum_base_trades.sql | 2 + .../chains/ethereum/platforms/_schema.yml | 65 +++++ .../opensea_v3_ethereum_base_trades.sql} | 4 +- .../opensea_v4_ethereum_base_trades.sql} | 13 +- .../trades/chains/old/nft_old_base_trades.sql | 12 - .../old/platforms/opensea_arbitrum_schema.yml | 92 ------- .../platforms/opensea_avalanche_c_schema.yml | 92 ------- .../old/platforms/opensea_base_schema.yml | 28 --- .../old/platforms/opensea_ethereum_schema.yml | 92 ------- .../old/platforms/opensea_optimism_schema.yml | 92 ------- .../old/platforms/opensea_polygon_schema.yml | 92 ------- .../old/platforms/opensea_zora_schema.yml | 222 ----------------- .../optimism/nft_optimism_base_trades.sql | 2 + .../chains/optimism/platforms/_schema.yml | 66 +++++ .../opensea_v3_optimism_base_trades.sql} | 4 +- .../opensea_v4_optimism_base_trades.sql} | 5 +- .../polygon/nft_polygon_base_trades.sql | 2 + .../chains/polygon/platforms/_schema.yml | 66 +++++ .../opensea_v3_polygon_base_trades.sql} | 5 +- .../opensea_v4_polygon_base_trades.sql} | 13 +- .../chains/zora/nft_zora_base_trades.sql | 1 + .../trades/chains/zora/platforms/_schema.yml | 33 +++ .../opensea_v4_zora_base_trades.sql} | 5 +- ...pensea_arbitrum_seaport_trades_samples.csv | 29 --- ...sea_avalanche_c_seaport_trades_samples.csv | 5 - seeds/opensea/avalanche_c/schema.yml | 15 -- ...pensea_ethereum_seaport_trades_samples.csv | 59 ----- seeds/opensea/ethereum/schema.yml | 13 - .../opensea_seaport_trades_samples.csv | 229 ++++++++++++++++++ ...pensea_optimism_seaport_trades_samples.csv | 28 --- seeds/opensea/optimism/schema.yml | 15 -- ...opensea_polygon_seaport_trades_samples.csv | 51 ---- seeds/opensea/polygon/schema.yml | 12 - seeds/opensea/{arbitrum => }/schema.yml | 6 +- .../opensea_zora_seaport_trades_samples.csv | 14 -- seeds/opensea/zora/schema.yml | 14 -- 49 files changed, 709 insertions(+), 1095 deletions(-) rename models/_sector/nft/trades/chains/{old/platforms/opensea_v3_arbitrum_events.sql => arbitrum/platforms/opensea_v3_arbitrum_base_trades.sql} (88%) rename models/_sector/nft/trades/chains/{old/platforms/opensea_v4_arbitrum_events.sql => arbitrum/platforms/opensea_v4_arbitrum_base_trades.sql} (87%) rename models/_sector/nft/trades/chains/{old/platforms/opensea_v3_avalanche_c_events.sql => avalanche_c/platforms/opensea_v3_avalanche_c_base_trades.sql} (89%) rename models/_sector/nft/trades/chains/{old/platforms/opensea_v4_avalanche_c_events.sql => avalanche_c/platforms/opensea_v4_avalanche_c_base_trades.sql} (88%) rename models/_sector/nft/trades/chains/{old/platforms/opensea_v4_base_events.sql => base/platforms/opensea_v4_base_base_trades.sql} (88%) rename models/_sector/nft/trades/chains/{old/platforms/opensea_v3_ethereum_events.sql => ethereum/platforms/opensea_v3_ethereum_base_trades.sql} (92%) rename models/_sector/nft/trades/chains/{old/platforms/opensea_v4_ethereum_events.sql => ethereum/platforms/opensea_v4_ethereum_base_trades.sql} (81%) delete mode 100644 models/_sector/nft/trades/chains/old/platforms/opensea_arbitrum_schema.yml delete mode 100644 models/_sector/nft/trades/chains/old/platforms/opensea_avalanche_c_schema.yml delete mode 100644 models/_sector/nft/trades/chains/old/platforms/opensea_base_schema.yml delete mode 100644 models/_sector/nft/trades/chains/old/platforms/opensea_ethereum_schema.yml delete mode 100644 models/_sector/nft/trades/chains/old/platforms/opensea_optimism_schema.yml delete mode 100644 models/_sector/nft/trades/chains/old/platforms/opensea_polygon_schema.yml delete mode 100644 models/_sector/nft/trades/chains/old/platforms/opensea_zora_schema.yml rename models/_sector/nft/trades/chains/{old/platforms/opensea_v3_optimism_events.sql => optimism/platforms/opensea_v3_optimism_base_trades.sql} (89%) rename models/_sector/nft/trades/chains/{old/platforms/opensea_v4_optimism_events.sql => optimism/platforms/opensea_v4_optimism_base_trades.sql} (88%) rename models/_sector/nft/trades/chains/{old/platforms/opensea_v3_polygon_events.sql => polygon/platforms/opensea_v3_polygon_base_trades.sql} (89%) rename models/_sector/nft/trades/chains/{old/platforms/opensea_v4_polygon_events.sql => polygon/platforms/opensea_v4_polygon_base_trades.sql} (74%) rename models/_sector/nft/trades/chains/{old/platforms/opensea_v4_zora_events.sql => zora/platforms/opensea_v4_zora_base_trades.sql} (86%) delete mode 100644 seeds/opensea/arbitrum/opensea_arbitrum_seaport_trades_samples.csv delete mode 100644 seeds/opensea/avalanche_c/opensea_avalanche_c_seaport_trades_samples.csv delete mode 100644 seeds/opensea/avalanche_c/schema.yml delete mode 100644 seeds/opensea/ethereum/opensea_ethereum_seaport_trades_samples.csv create mode 100644 seeds/opensea/opensea_seaport_trades_samples.csv delete mode 100644 seeds/opensea/optimism/opensea_optimism_seaport_trades_samples.csv delete mode 100644 seeds/opensea/optimism/schema.yml delete mode 100644 seeds/opensea/polygon/opensea_polygon_seaport_trades_samples.csv rename seeds/opensea/{arbitrum => }/schema.yml (70%) delete mode 100644 seeds/opensea/zora/opensea_zora_seaport_trades_samples.csv delete mode 100644 seeds/opensea/zora/schema.yml diff --git a/macros/models/_sector/nft/platforms/seaport_v3_trades.sql b/macros/models/_sector/nft/platforms/seaport_v3_trades.sql index 7bde79ff456..3e6b39bec4d 100644 --- a/macros/models/_sector/nft/platforms/seaport_v3_trades.sql +++ b/macros/models/_sector/nft/platforms/seaport_v3_trades.sql @@ -565,6 +565,7 @@ with source_ethereum_transactions as ( ,t."from" as tx_from ,t.to as tx_to ,bytearray_reverse(bytearray_substring(bytearray_reverse(t.data),1,4)) as right_hash + ,bytearray_reverse(bytearray_substring(bytearray_reverse(t.data),1,32)) as tx_data_marker ,a.fee_wallet_name from iv_nfts a inner join source_ethereum_transactions t on t.hash = a.tx_hash @@ -576,69 +577,48 @@ select -- basic info '{{blockchain}}' as blockchain ,'opensea' as project - ,'v3' as version + ,'v3' as project_version -- order info ,block_time + ,cast(date_trunc('day', block_time) as date) as block_date + ,cast(date_trunc('month', block_time) as date) as block_month ,seller ,buyer ,trade_type - ,order_type as trade_category -- Buy / Offer Accepted - ,'Trade' as evt_type + ,order_type as trade_category -- Buy / Sell -- nft token info ,nft_contract_address - ,nft_token_id as token_id - ,nft_token_amount as number_of_items - ,nft_token_standard as token_standard + ,nft_token_id as nft_token_id + ,nft_token_amount as nft_amount -- price info - ,price_amount_raw as amount_raw + ,price_amount_raw as price_raw ,case when token_contract_address = 0x0000000000000000000000000000000000000000 then {{native_currency_contract}} else token_contract_address end as currency_contract -- project info (platform or exchange) ,platform_contract_address as project_contract_address - ,platform_fee_receiver as platform_fee_receive_address + ,platform_fee_receiver as platform_fee_address ,platform_fee_amount_raw -- royalty info - ,creator_fee_receiver_1 as royalty_fee_receive_address + ,creator_fee_receiver_1 as royalty_fee_address ,creator_fee_amount_raw as royalty_fee_amount_raw - ,creator_fee_receiver_1 as royalty_fee_receive_address_1 - ,creator_fee_receiver_2 as royalty_fee_receive_address_2 - ,creator_fee_receiver_3 as royalty_fee_receive_address_3 - ,creator_fee_receiver_4 as royalty_fee_receive_address_4 - ,creator_fee_receiver_5 as royalty_fee_receive_address_5 - ,creator_fee_amount_raw_1 as royalty_fee_amount_raw_1 - ,creator_fee_amount_raw_2 as royalty_fee_amount_raw_2 - ,creator_fee_amount_raw_3 as royalty_fee_amount_raw_3 - ,creator_fee_amount_raw_4 as royalty_fee_amount_raw_4 - ,creator_fee_amount_raw_5 as royalty_fee_amount_raw_5 -- tx ,block_number ,tx_hash - ,evt_index ,tx_from ,tx_to - ,right_hash + ,tx_data_marker -- seaport etc - ,zone as zone_address - ,estimated_price - ,is_private - ,sub_idx - ,sub_type + , row_number() over (partition by tx_hash order by evt_index) as sub_tx_trade_id + + ,right_hash ,fee_wallet_name - ,'seaport-' || CAST(tx_hash AS varchar) || '-' || cast(evt_index as varchar) || '-' || CAST(nft_contract_address AS varchar) || '-' || cast(nft_token_id as varchar) || '-' || cast(sub_type as varchar) || '-' || cast(sub_idx as varchar) as unique_trade_id + ,zone as zone_address from iv_trades --- where ( zone in (0xf397619df7bfd4d1657ea9bdd9df7ff888731a11 --- ,0x9b814233894cd227f561b78cc65891aa55c62ad2 --- ,0x004c00500000ad104d7dbd00e3ae0a5c00560c00 --- ,0x110b2b128a9ed1be5ef3232d8e4e41640df5c2cd --- ,0x000000e7ec00e7b300774b00001314b8610022b8 -- newly added on seaport v1.4 --- ) --- or fee_wallet_name = 'opensea' --- ) {% endmacro %} diff --git a/macros/models/_sector/nft/platforms/seaport_v4_trades.sql b/macros/models/_sector/nft/platforms/seaport_v4_trades.sql index 88e90df62db..d915265c3fd 100644 --- a/macros/models/_sector/nft/platforms/seaport_v4_trades.sql +++ b/macros/models/_sector/nft/platforms/seaport_v4_trades.sql @@ -214,8 +214,8 @@ with source_ethereum_transactions as ( ,a.nft_cnt ,a.erc721_cnt ,a.erc1155_cnt - ,case when offer_first_item_type = 'erc20' then 'offer accepted' - when offer_first_item_type in ('erc721','erc1155') then 'buy' + ,case when offer_first_item_type = 'erc20' then 'Sell' + when offer_first_item_type in ('erc721','erc1155') then 'Buy' else 'etc' -- some txns has no nfts end as order_type ,case when om_order_id % 2 = 0 then false @@ -327,9 +327,7 @@ with source_ethereum_transactions as ( ,a.block_number ,a.sender as seller ,a.receiver as buyer - ,case when nft_cnt > 1 then 'bundle trade' - else 'single item trade' - end as trade_type + ,'secondary' as trade_type ,a.order_type ,a.token_contract_address as nft_contract_address ,a.original_amount as nft_token_amount @@ -404,10 +402,11 @@ with source_ethereum_transactions as ( ,t."from" as tx_from ,t.to as tx_to ,bytearray_reverse(bytearray_substring(bytearray_reverse(t.data),1,4)) as right_hash + ,bytearray_reverse(bytearray_substring(bytearray_reverse(t.data),1,32)) as tx_data_marker ,a.fee_wallet_name from iv_nfts a inner join source_ethereum_transactions t on t.hash = a.tx_hash - where t."from" != 0x110b2b128a9ed1be5ef3232d8e4e41640df5c2cd -- this is a special address which transact English Auction, will handle later. test comment to force CI + where t."from" != 0x110b2b128a9ed1be5ef3232d8e4e41640df5c2cd -- this is a special address which transact English Auction, will handle later. ) -- Rename column to align other *.trades tables @@ -417,69 +416,49 @@ select -- basic info '{{blockchain}}' as blockchain ,'opensea' as project - ,'v4' as version + ,'v4' as project_version -- order info ,block_time + ,cast(date_trunc('day', block_time) as date) as block_date + ,cast(date_trunc('month', block_time) as date) as block_month ,seller ,buyer ,trade_type - ,order_type as trade_category -- Buy / Offer Accepted - ,'Trade' as evt_type + ,order_type as trade_category -- Buy / Sell -- nft token info ,nft_contract_address - ,nft_token_id as token_id - ,nft_token_amount as number_of_items - ,nft_token_standard as token_standard + ,nft_token_id as nft_token_id + ,nft_token_amount as nft_amount -- price info - ,price_amount_raw as amount_raw + ,price_amount_raw as price_raw ,case when token_contract_address = 0x0000000000000000000000000000000000000000 then {{native_currency_contract}} else token_contract_address end as currency_contract -- project info (platform or exchange) ,platform_contract_address as project_contract_address - ,platform_fee_receiver as platform_fee_receive_address + ,platform_fee_receiver as platform_fee_address ,platform_fee_amount_raw -- royalty info - ,creator_fee_receiver_1 as royalty_fee_receive_address + ,creator_fee_receiver_1 as royalty_fee_address ,creator_fee_amount_raw as royalty_fee_amount_raw - ,creator_fee_receiver_1 as royalty_fee_receive_address_1 - ,creator_fee_receiver_2 as royalty_fee_receive_address_2 - ,creator_fee_receiver_3 as royalty_fee_receive_address_3 - ,creator_fee_receiver_4 as royalty_fee_receive_address_4 - ,creator_fee_receiver_5 as royalty_fee_receive_address_5 - ,creator_fee_amount_raw_1 as royalty_fee_amount_raw_1 - ,creator_fee_amount_raw_2 as royalty_fee_amount_raw_2 - ,creator_fee_amount_raw_3 as royalty_fee_amount_raw_3 - ,creator_fee_amount_raw_4 as royalty_fee_amount_raw_4 - ,creator_fee_amount_raw_5 as royalty_fee_amount_raw_5 -- tx ,block_number ,tx_hash - ,evt_index ,tx_from ,tx_to - ,right_hash + ,tx_data_marker -- seaport etc - ,zone as zone_address - ,estimated_price - ,is_private - ,sub_idx - ,sub_type + , row_number() over (partition by tx_hash order by evt_index) as sub_tx_trade_id + + ,right_hash ,fee_wallet_name - ,'seaport-' || CAST(tx_hash AS varchar) || '-' || cast(evt_index as varchar) || '-' || CAST(nft_contract_address AS varchar) || '-' || cast(nft_token_id as varchar) || '-' || cast(sub_type as varchar) || '-' || cast(sub_idx as varchar) as unique_trade_id + ,zone as zone_address from iv_trades --- where ( zone in (0xf397619df7bfd4d1657ea9bdd9df7ff888731a11 --- ,0x9b814233894cd227f561b78cc65891aa55c62ad2 --- ,0x004c00500000ad104d7dbd00e3ae0a5c00560c00 --- ,0x110b2b128a9ed1be5ef3232d8e4e41640df5c2cd --- ,0x000000e7ec00e7b300774b00001314b8610022b8 -- newly added on seaport v1.4 --- ) --- or fee_wallet_name = 'opensea' --- ) + {% endmacro %} diff --git a/models/_sector/nft/trades/chains/arbitrum/nft_arbitrum_base_trades.sql b/models/_sector/nft/trades/chains/arbitrum/nft_arbitrum_base_trades.sql index a435c6eefa9..bbd1746696a 100644 --- a/models/_sector/nft/trades/chains/arbitrum/nft_arbitrum_base_trades.sql +++ b/models/_sector/nft/trades/chains/arbitrum/nft_arbitrum_base_trades.sql @@ -14,6 +14,8 @@ ,ref('sudoswap_v2_arbitrum_base_trades') ,ref('element_arbitrum_base_trades') ,ref('zonic_arbitrum_base_trades') +,ref('opensea_v3_arbitrum_base_trades') +,ref('opensea_v4_arbitrum_base_trades') ] %} diff --git a/models/_sector/nft/trades/chains/arbitrum/platforms/_schema.yml b/models/_sector/nft/trades/chains/arbitrum/platforms/_schema.yml index 01443e7a65d..65126e51fdf 100644 --- a/models/_sector/nft/trades/chains/arbitrum/platforms/_schema.yml +++ b/models/_sector/nft/trades/chains/arbitrum/platforms/_schema.yml @@ -161,3 +161,69 @@ models: - price_raw - platform_fee_amount_raw - royalty_fee_amount_raw + + - name: opensea_v3_arbitrum_base_trades + meta: + blockchain: arbitrum + project: opensea + contributors: sohwak, 0xRob + config: + tags: [ 'opensea','base_trades','seaport' ] + description: > + Opensea base trades from seaport (v3) + tests: + - check_columns_nft_base_trades + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - block_number + - tx_hash + - sub_tx_trade_id + - check_seed: + seed_file: ref('opensea_seaport_trades_samples') + filter: + blockchain: arbitrum + project: opensea + project_version: v3 + check_columns: + - buyer + - seller + - price_raw + - platform_fee_amount_raw + - royalty_fee_amount_raw + match_columns: + - block_number + - tx_hash + - sub_tx_trade_id + + - name: opensea_v4_arbitrum_base_trades + meta: + blockchain: arbitrum + project: opensea + contributors: sohwak, 0xRob + config: + tags: [ 'opensea','base_trades','seaport' ] + description: > + Opensea base trades from seaport (v4) + tests: + - check_columns_nft_base_trades + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - block_number + - tx_hash + - sub_tx_trade_id + - check_seed: + seed_file: ref('opensea_seaport_trades_samples') + filter: + blockchain: arbitrum + project: opensea + project_version: v4 + check_columns: + - buyer + - seller + - price_raw + - platform_fee_amount_raw + - royalty_fee_amount_raw + match_columns: + - block_number + - tx_hash + - sub_tx_trade_id diff --git a/models/_sector/nft/trades/chains/old/platforms/opensea_v3_arbitrum_events.sql b/models/_sector/nft/trades/chains/arbitrum/platforms/opensea_v3_arbitrum_base_trades.sql similarity index 88% rename from models/_sector/nft/trades/chains/old/platforms/opensea_v3_arbitrum_events.sql rename to models/_sector/nft/trades/chains/arbitrum/platforms/opensea_v3_arbitrum_base_trades.sql index 75d2b12bbc2..cc45c6a0980 100644 --- a/models/_sector/nft/trades/chains/old/platforms/opensea_v3_arbitrum_events.sql +++ b/models/_sector/nft/trades/chains/arbitrum/platforms/opensea_v3_arbitrum_base_trades.sql @@ -1,11 +1,11 @@ {{ config( schema = 'opensea_v3_arbitrum', - alias = 'events', + alias = 'base_trades', materialized = 'incremental', file_format = 'delta', incremental_strategy = 'merge', - unique_key = ['tx_hash', 'evt_index', 'nft_contract_address', 'token_id', 'sub_type', 'sub_idx'] + unique_key = ['block_number', 'tx_hash', 'sub_tx_trade_id'] ) }} diff --git a/models/_sector/nft/trades/chains/old/platforms/opensea_v4_arbitrum_events.sql b/models/_sector/nft/trades/chains/arbitrum/platforms/opensea_v4_arbitrum_base_trades.sql similarity index 87% rename from models/_sector/nft/trades/chains/old/platforms/opensea_v4_arbitrum_events.sql rename to models/_sector/nft/trades/chains/arbitrum/platforms/opensea_v4_arbitrum_base_trades.sql index e75d9b1c2a4..91d01734612 100644 --- a/models/_sector/nft/trades/chains/old/platforms/opensea_v4_arbitrum_events.sql +++ b/models/_sector/nft/trades/chains/arbitrum/platforms/opensea_v4_arbitrum_base_trades.sql @@ -1,10 +1,11 @@ {{ config( schema = 'opensea_v4_arbitrum', - alias = 'events', + alias = 'base_trades', + materialized = 'incremental', file_format = 'delta', incremental_strategy = 'merge', - unique_key = ['tx_hash', 'evt_index', 'nft_contract_address', 'token_id', 'sub_type', 'sub_idx'] + unique_key = ['block_number', 'tx_hash', 'sub_tx_trade_id'] ) }} diff --git a/models/_sector/nft/trades/chains/avalanche_c/nft_avalanche_c_base_trades.sql b/models/_sector/nft/trades/chains/avalanche_c/nft_avalanche_c_base_trades.sql index 1abe41afaa9..ed393b130a8 100644 --- a/models/_sector/nft/trades/chains/avalanche_c/nft_avalanche_c_base_trades.sql +++ b/models/_sector/nft/trades/chains/avalanche_c/nft_avalanche_c_base_trades.sql @@ -11,7 +11,9 @@ ,ref('chikn_avalanche_c_base_trades') ,ref('campfire_avalanche_c_base_trades') ,ref('hyperspace_avalanche_c_base_trades') - ,ref('element_avalanche_c_base_trades') + ,ref('element_avalanche_c_base_trades') + ,ref('opensea_v3_avalanche_c_base_trades') + ,ref('opensea_v4_avalanche_c_base_trades') ] %} diff --git a/models/_sector/nft/trades/chains/avalanche_c/platforms/_schema.yml b/models/_sector/nft/trades/chains/avalanche_c/platforms/_schema.yml index 6cb3c1947af..eebffe3179f 100644 --- a/models/_sector/nft/trades/chains/avalanche_c/platforms/_schema.yml +++ b/models/_sector/nft/trades/chains/avalanche_c/platforms/_schema.yml @@ -119,3 +119,69 @@ models: - check_columns_nft_base_trades - dbt_utils.unique_combination_of_columns: combination_of_columns: [ 'block_number','tx_hash','sub_tx_trade_id' ] + + - name: opensea_v3_avalanche_c_base_trades + meta: + blockchain: avalanche_c + project: opensea + contributors: sohwak, 0xRob + config: + tags: [ 'opensea','base_trades','seaport' ] + description: > + Opensea base trades from seaport (v3) + tests: + - check_columns_nft_base_trades + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - block_number + - tx_hash + - sub_tx_trade_id + - check_seed: + seed_file: ref('opensea_seaport_trades_samples') + filter: + blockchain: avalanche_c + project: opensea + project_version: v3 + check_columns: + - buyer + - seller + - price_raw + - platform_fee_amount_raw + - royalty_fee_amount_raw + match_columns: + - block_number + - tx_hash + - sub_tx_trade_id + + - name: opensea_v4_avalanche_c_base_trades + meta: + blockchain: avalanche_c + project: opensea + contributors: sohwak, 0xRob + config: + tags: [ 'opensea','base_trades','seaport' ] + description: > + Opensea base trades from seaport (v4) + tests: + - check_columns_nft_base_trades + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - block_number + - tx_hash + - sub_tx_trade_id + - check_seed: + seed_file: ref('opensea_seaport_trades_samples') + filter: + blockchain: avalanche_c + project: opensea + project_version: v4 + check_columns: + - buyer + - seller + - price_raw + - platform_fee_amount_raw + - royalty_fee_amount_raw + match_columns: + - block_number + - tx_hash + - sub_tx_trade_id diff --git a/models/_sector/nft/trades/chains/old/platforms/opensea_v3_avalanche_c_events.sql b/models/_sector/nft/trades/chains/avalanche_c/platforms/opensea_v3_avalanche_c_base_trades.sql similarity index 89% rename from models/_sector/nft/trades/chains/old/platforms/opensea_v3_avalanche_c_events.sql rename to models/_sector/nft/trades/chains/avalanche_c/platforms/opensea_v3_avalanche_c_base_trades.sql index d99a5daefd0..65a738c3e11 100644 --- a/models/_sector/nft/trades/chains/old/platforms/opensea_v3_avalanche_c_events.sql +++ b/models/_sector/nft/trades/chains/avalanche_c/platforms/opensea_v3_avalanche_c_base_trades.sql @@ -1,11 +1,11 @@ {{ config( schema = 'opensea_v3_avalanche_c', - alias = 'events', + alias = 'base_trades', materialized = 'incremental', file_format = 'delta', incremental_strategy = 'merge', - unique_key = ['tx_hash', 'evt_index', 'nft_contract_address', 'token_id', 'sub_type', 'sub_idx'] + unique_key = ['block_number', 'tx_hash', 'sub_tx_trade_id'] ) }} diff --git a/models/_sector/nft/trades/chains/old/platforms/opensea_v4_avalanche_c_events.sql b/models/_sector/nft/trades/chains/avalanche_c/platforms/opensea_v4_avalanche_c_base_trades.sql similarity index 88% rename from models/_sector/nft/trades/chains/old/platforms/opensea_v4_avalanche_c_events.sql rename to models/_sector/nft/trades/chains/avalanche_c/platforms/opensea_v4_avalanche_c_base_trades.sql index aaa2bd4ec78..dfeee2988ea 100644 --- a/models/_sector/nft/trades/chains/old/platforms/opensea_v4_avalanche_c_events.sql +++ b/models/_sector/nft/trades/chains/avalanche_c/platforms/opensea_v4_avalanche_c_base_trades.sql @@ -1,10 +1,11 @@ {{ config( schema = 'opensea_v4_avalanche_c', - alias = 'events', + alias = 'base_trades', + materialized = 'incremental', file_format = 'delta', incremental_strategy = 'merge', - unique_key = ['tx_hash', 'evt_index', 'nft_contract_address', 'token_id', 'sub_type', 'sub_idx'] + unique_key = ['block_number', 'tx_hash', 'sub_tx_trade_id'] ) }} diff --git a/models/_sector/nft/trades/chains/base/nft_base_base_trades.sql b/models/_sector/nft/trades/chains/base/nft_base_base_trades.sql index b0696498f9d..0f4b0421a3d 100644 --- a/models/_sector/nft/trades/chains/base/nft_base_base_trades.sql +++ b/models/_sector/nft/trades/chains/base/nft_base_base_trades.sql @@ -12,6 +12,7 @@ ,ref('zonic_base_base_trades') ,ref('sudoswap_v2_base_base_trades') ,ref('magiceden_base_base_trades') + ,ref('opensea_v4_base_base_trades') ] %} with base_union as ( diff --git a/models/_sector/nft/trades/chains/base/platforms/_schema.yml b/models/_sector/nft/trades/chains/base/platforms/_schema.yml index 3465314d8fc..c396cea8980 100644 --- a/models/_sector/nft/trades/chains/base/platforms/_schema.yml +++ b/models/_sector/nft/trades/chains/base/platforms/_schema.yml @@ -150,3 +150,36 @@ models: - check_columns_nft_base_trades - dbt_utils.unique_combination_of_columns: combination_of_columns: [ 'block_number','tx_hash','sub_tx_trade_id' ] + + - name: opensea_v4_base_base_trades + meta: + blockchain: base + project: opensea + contributors: sohwak, 0xRob + config: + tags: [ 'opensea','base_trades','seaport' ] + description: > + Opensea base trades from seaport (v4) + tests: + - check_columns_nft_base_trades + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - block_number + - tx_hash + - sub_tx_trade_id + - check_seed: + seed_file: ref('opensea_seaport_trades_samples') + filter: + blockchain: base + project: opensea + project_version: v4 + check_columns: + - buyer + - seller + - price_raw + - platform_fee_amount_raw + - royalty_fee_amount_raw + match_columns: + - block_number + - tx_hash + - sub_tx_trade_id diff --git a/models/_sector/nft/trades/chains/old/platforms/opensea_v4_base_events.sql b/models/_sector/nft/trades/chains/base/platforms/opensea_v4_base_base_trades.sql similarity index 88% rename from models/_sector/nft/trades/chains/old/platforms/opensea_v4_base_events.sql rename to models/_sector/nft/trades/chains/base/platforms/opensea_v4_base_base_trades.sql index df3513d1dbd..53df899a454 100644 --- a/models/_sector/nft/trades/chains/old/platforms/opensea_v4_base_events.sql +++ b/models/_sector/nft/trades/chains/base/platforms/opensea_v4_base_base_trades.sql @@ -1,10 +1,11 @@ {{ config( schema = 'opensea_v4_base', - alias = 'events', + alias = 'base_trades', + materialized = 'incremental', file_format = 'delta', incremental_strategy = 'merge', - unique_key = ['tx_hash', 'evt_index', 'nft_contract_address', 'token_id', 'sub_type', 'sub_idx'] + unique_key = ['block_number', 'tx_hash', 'sub_tx_trade_id'] ) }} diff --git a/models/_sector/nft/trades/chains/ethereum/nft_ethereum_base_trades.sql b/models/_sector/nft/trades/chains/ethereum/nft_ethereum_base_trades.sql index 7195e942967..21f0e3d0630 100644 --- a/models/_sector/nft/trades/chains/ethereum/nft_ethereum_base_trades.sql +++ b/models/_sector/nft/trades/chains/ethereum/nft_ethereum_base_trades.sql @@ -29,6 +29,8 @@ ,ref('zora_v2_ethereum_base_trades') ,ref('zora_v3_ethereum_base_trades') ,ref('magiceden_ethereum_base_trades') +,ref('opensea_v3_ethereum_base_trades') +,ref('opensea_v4_ethereum_base_trades') ] %} with base_union as ( diff --git a/models/_sector/nft/trades/chains/ethereum/platforms/_schema.yml b/models/_sector/nft/trades/chains/ethereum/platforms/_schema.yml index a67d9178e45..a0777b4ce7a 100644 --- a/models/_sector/nft/trades/chains/ethereum/platforms/_schema.yml +++ b/models/_sector/nft/trades/chains/ethereum/platforms/_schema.yml @@ -653,3 +653,68 @@ models: - price_raw - platform_fee_amount_raw - royalty_fee_amount_raw + - name: opensea_v3_ethereum_base_trades + meta: + blockchain: ethereum + project: opensea + contributors: sohwak, 0xRob + config: + tags: [ 'opensea','base_trades','seaport' ] + description: > + Opensea base trades from seaport (v3) + tests: + - check_columns_nft_base_trades + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - block_number + - tx_hash + - sub_tx_trade_id + - check_seed: + seed_file: ref('opensea_seaport_trades_samples') + filter: + blockchain: ethereum + project: opensea + project_version: v3 + check_columns: + - buyer + - seller + - price_raw + - platform_fee_amount_raw + - royalty_fee_amount_raw + match_columns: + - block_number + - tx_hash + - sub_tx_trade_id + + - name: opensea_v4_ethereum_base_trades + meta: + blockchain: ethereum + project: opensea + contributors: sohwak, 0xRob + config: + tags: [ 'opensea','base_trades','seaport' ] + description: > + Opensea base trades from seaport (v4) + tests: + - check_columns_nft_base_trades + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - block_number + - tx_hash + - sub_tx_trade_id + - check_seed: + seed_file: ref('opensea_seaport_trades_samples') + filter: + blockchain: ethereum + project: opensea + project_version: v4 + check_columns: + - buyer + - seller + - price_raw + - platform_fee_amount_raw + - royalty_fee_amount_raw + match_columns: + - block_number + - tx_hash + - sub_tx_trade_id diff --git a/models/_sector/nft/trades/chains/old/platforms/opensea_v3_ethereum_events.sql b/models/_sector/nft/trades/chains/ethereum/platforms/opensea_v3_ethereum_base_trades.sql similarity index 92% rename from models/_sector/nft/trades/chains/old/platforms/opensea_v3_ethereum_events.sql rename to models/_sector/nft/trades/chains/ethereum/platforms/opensea_v3_ethereum_base_trades.sql index ad5458ea5f4..53583c88883 100644 --- a/models/_sector/nft/trades/chains/old/platforms/opensea_v3_ethereum_events.sql +++ b/models/_sector/nft/trades/chains/ethereum/platforms/opensea_v3_ethereum_base_trades.sql @@ -1,11 +1,11 @@ {{ config( schema = 'opensea_v3_ethereum', - alias = 'events', + alias = 'base_trades', materialized = 'incremental', file_format = 'delta', incremental_strategy = 'merge', - unique_key = ['tx_hash', 'evt_index', 'nft_contract_address', 'token_id', 'sub_type', 'sub_idx'] + unique_key = ['block_number', 'tx_hash', 'sub_tx_trade_id'] ) }} WITH fee_wallets as ( diff --git a/models/_sector/nft/trades/chains/old/platforms/opensea_v4_ethereum_events.sql b/models/_sector/nft/trades/chains/ethereum/platforms/opensea_v4_ethereum_base_trades.sql similarity index 81% rename from models/_sector/nft/trades/chains/old/platforms/opensea_v4_ethereum_events.sql rename to models/_sector/nft/trades/chains/ethereum/platforms/opensea_v4_ethereum_base_trades.sql index 93ba178d8c6..534b9e42896 100644 --- a/models/_sector/nft/trades/chains/old/platforms/opensea_v4_ethereum_events.sql +++ b/models/_sector/nft/trades/chains/ethereum/platforms/opensea_v4_ethereum_base_trades.sql @@ -1,10 +1,11 @@ {{ config( schema = 'opensea_v4_ethereum', - alias = 'events', + alias = 'base_trades', + materialized = 'incremental', file_format = 'delta', incremental_strategy = 'merge', - unique_key = ['tx_hash', 'evt_index', 'nft_contract_address', 'token_id', 'sub_type', 'sub_idx', 'number_of_items'] + unique_key = ['block_number', 'tx_hash', 'sub_tx_trade_id'] ) }} @@ -40,10 +41,4 @@ where ) or fee_wallet_name = 'opensea' ) --- temporary fix to exclude duplicates -and tx_hash not in ( -select tx_hash from -trades -group by tx_hash, evt_index, nft_contract_address, token_id, sub_type, sub_idx -having count(*) > 1 -) + diff --git a/models/_sector/nft/trades/chains/old/nft_old_base_trades.sql b/models/_sector/nft/trades/chains/old/nft_old_base_trades.sql index a9c36404c43..f45f07504cc 100644 --- a/models/_sector/nft/trades/chains/old/nft_old_base_trades.sql +++ b/models/_sector/nft/trades/chains/old/nft_old_base_trades.sql @@ -12,20 +12,8 @@ ref('magiceden_solana_events') ,ref('nftearth_optimism_events') ,ref('mooar_polygon_events') ,ref('oneplanet_polygon_events') -,ref('opensea_v3_arbitrum_events') -,ref('opensea_v4_arbitrum_events') -,ref('opensea_v3_ethereum_events') -,ref('opensea_v4_ethereum_events') -,ref('opensea_v3_optimism_events') -,ref('opensea_v4_optimism_events') -,ref('opensea_v3_polygon_events') -,ref('opensea_v4_polygon_events') -,ref('opensea_v4_base_events') -,ref('opensea_v4_zora_events') ,ref('opensea_solana_events') ,ref('quix_seaport_optimism_events') -,ref('opensea_v3_avalanche_c_events') -,ref('opensea_v4_avalanche_c_events') ] %} diff --git a/models/_sector/nft/trades/chains/old/platforms/opensea_arbitrum_schema.yml b/models/_sector/nft/trades/chains/old/platforms/opensea_arbitrum_schema.yml deleted file mode 100644 index 496853992f5..00000000000 --- a/models/_sector/nft/trades/chains/old/platforms/opensea_arbitrum_schema.yml +++ /dev/null @@ -1,92 +0,0 @@ -version: 2 - -models: - - name: opensea_v3_arbitrum_events - meta: - blockchain: arbitrum - project: opensea - contributors: sohwak - config: - tags: ['arbitrum','opensea','events','seaport'] - description: > - Opensea events on Arbitrum, from Seaport v1.0 - tests: - - check_columns_nft_old_events - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - tx_hash - - evt_index - - nft_contract_address - - token_id - - sub_type - - sub_idx - - check_seed: - seed_file: ref('opensea_arbitrum_seaport_trades_samples') - filter: - blockchain: arbitrum - project: opensea - version: v3 - check_columns: - - buyer - - seller - - amount_raw - - platform_fee_amount_raw - - royalty_fee_amount_raw - match_columns: - - blockchain - - project - - version - - tx_hash - - evt_index - - sub_idx - - nft_contract_address - - token_id - columns: - - &unique_trade_id - name: unique_trade_id - description: "Unique trade ID" - tests: - - unique - - - name: opensea_v4_arbitrum_events - meta: - blockchain: arbitrum - project: opensea - contributors: sohwak - config: - tags: ['arbitrum','opensea','events','seaport'] - description: > - Opensea events on Arbitrum, from Seaport v1.4, v1.5 - tests: - - check_columns_nft_old_events - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - tx_hash - - evt_index - - nft_contract_address - - token_id - - sub_type - - sub_idx - - check_seed: - seed_file: ref('opensea_arbitrum_seaport_trades_samples') - filter: - blockchain: arbitrum - project: opensea - version: v4 - check_columns: - - buyer - - seller - - amount_raw - - platform_fee_amount_raw - - royalty_fee_amount_raw - match_columns: - - blockchain - - project - - version - - tx_hash - - evt_index - - sub_idx - - nft_contract_address - - token_id - columns: - - *unique_trade_id diff --git a/models/_sector/nft/trades/chains/old/platforms/opensea_avalanche_c_schema.yml b/models/_sector/nft/trades/chains/old/platforms/opensea_avalanche_c_schema.yml deleted file mode 100644 index 2bc1e2ab46b..00000000000 --- a/models/_sector/nft/trades/chains/old/platforms/opensea_avalanche_c_schema.yml +++ /dev/null @@ -1,92 +0,0 @@ -version: 2 - -models: - - name: opensea_v3_avalanche_c_events - meta: - blockchain: avalanche_c - project: opensea - contributors: sohwak - config: - tags: ['avalanche_c','opensea','events','seaport'] - description: > - Opensea events on avalanche_c, from Seaport v1.0 - tests: - - check_columns_nft_old_events - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - tx_hash - - evt_index - - nft_contract_address - - token_id - - sub_type - - sub_idx - - check_seed: - seed_file: ref('opensea_avalanche_c_seaport_trades_samples') - filter: - blockchain: avalanche_c - project: opensea - version: v3 - check_columns: - - buyer - - seller - - amount_raw - - platform_fee_amount_raw - - royalty_fee_amount_raw - match_columns: - - blockchain - - project - - version - - tx_hash - - evt_index - - sub_idx - - nft_contract_address - - token_id - columns: - - &unique_trade_id - name: unique_trade_id - description: "Unique trade ID" - tests: - - unique - - - name: opensea_v4_avalanche_c_events - meta: - blockchain: avalanche_c - project: opensea - contributors: sohwak - config: - tags: ['avalanche_c','opensea','events','seaport'] - description: > - Opensea events on avalanche_c, from Seaport v1.4, v1.5 - tests: - - check_columns_nft_old_events - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - tx_hash - - evt_index - - nft_contract_address - - token_id - - sub_type - - sub_idx - - check_seed: - seed_file: ref('opensea_avalanche_c_seaport_trades_samples') - filter: - blockchain: avalanche_c - project: opensea - version: v4 - check_columns: - - buyer - - seller - - amount_raw - - platform_fee_amount_raw - - royalty_fee_amount_raw - match_columns: - - blockchain - - project - - version - - tx_hash - - evt_index - - sub_idx - - nft_contract_address - - token_id - columns: - - *unique_trade_id diff --git a/models/_sector/nft/trades/chains/old/platforms/opensea_base_schema.yml b/models/_sector/nft/trades/chains/old/platforms/opensea_base_schema.yml deleted file mode 100644 index ef5f5062f86..00000000000 --- a/models/_sector/nft/trades/chains/old/platforms/opensea_base_schema.yml +++ /dev/null @@ -1,28 +0,0 @@ -version: 2 - -models: - - name: opensea_v4_base_events - meta: - blockchain: base - project: opensea - contributors: BroderickBonelli - config: - tags: ['base','opensea','events'] - description: > - Opensea events on base, from Seaport v1.4, 1.5, and 1.6 - tests: - - check_columns_nft_old_events - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - tx_hash - - evt_index - - nft_contract_address - - token_id - - sub_type - - sub_idx - columns: - - &unique_trade_id - name: unique_trade_id - description: "Unique trade ID" - tests: - - unique diff --git a/models/_sector/nft/trades/chains/old/platforms/opensea_ethereum_schema.yml b/models/_sector/nft/trades/chains/old/platforms/opensea_ethereum_schema.yml deleted file mode 100644 index c30bb65699c..00000000000 --- a/models/_sector/nft/trades/chains/old/platforms/opensea_ethereum_schema.yml +++ /dev/null @@ -1,92 +0,0 @@ -version: 2 - -models: - - name: opensea_v3_ethereum_events - meta: - blockchain: ethereum - project: opensea - contributors: [soispoke, sohwak, hildobby] - config: - tags: ['ethereum','opensea','v3','events'] - description: > - OpenSea V3 events on Ethereum - tests: - - check_columns_nft_old_events - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - tx_hash - - evt_index - - nft_contract_address - - token_id - - sub_type - - sub_idx - - check_seed: - seed_file: ref('opensea_ethereum_seaport_trades_samples') - filter: - blockchain: ethereum - project: opensea - version: v3 - check_columns: - - buyer - - seller - - amount_raw - - platform_fee_amount_raw - - royalty_fee_amount_raw - match_columns: - - blockchain - - project - - version - - tx_hash - - evt_index - - sub_idx - - nft_contract_address - - token_id - columns: - - &unique_trade_id - name: unique_trade_id - description: "Unique trade ID" - tests: - - unique - - - name: opensea_v4_ethereum_events - meta: - blockchain: ethereum - project: opensea - contributors: [sohwak] - config: - tags: ['ethereum','opensea','v4','events'] - description: > - OpenSea V4 events on Ethereum - tests: - - check_columns_nft_old_events - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - tx_hash - - evt_index - - nft_contract_address - - token_id - - sub_type - - sub_idx - - check_seed: - seed_file: ref('opensea_ethereum_seaport_trades_samples') - filter: - blockchain: ethereum - project: opensea - version: v4 - check_columns: - - buyer - - seller - - amount_raw - - platform_fee_amount_raw - - royalty_fee_amount_raw - match_columns: - - blockchain - - project - - version - - tx_hash - - evt_index - - sub_idx - - nft_contract_address - - token_id - columns: - - *unique_trade_id diff --git a/models/_sector/nft/trades/chains/old/platforms/opensea_optimism_schema.yml b/models/_sector/nft/trades/chains/old/platforms/opensea_optimism_schema.yml deleted file mode 100644 index 53984874f03..00000000000 --- a/models/_sector/nft/trades/chains/old/platforms/opensea_optimism_schema.yml +++ /dev/null @@ -1,92 +0,0 @@ -version: 2 - -models: - - name: opensea_v3_optimism_events - meta: - blockchain: optimism - project: opensea - contributors: chuxin, sohwak - config: - tags: ['optimism','opensea','events'] - description: > - Opensea events on optimism, from Seaport v1.1 - tests: - - check_columns_nft_old_events - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - tx_hash - - evt_index - - nft_contract_address - - token_id - - sub_type - - sub_idx - - check_seed: - seed_file: ref('opensea_optimism_seaport_trades_samples') - filter: - blockchain: optimism - project: opensea - version: v3 - check_columns: - - buyer - - seller - - amount_raw - - platform_fee_amount_raw - - royalty_fee_amount_raw - match_columns: - - blockchain - - project - - version - - tx_hash - - evt_index - - sub_idx - - nft_contract_address - - token_id - columns: - - &unique_trade_id - name: unique_trade_id - description: "Unique trade ID" - tests: - - unique - - - name: opensea_v4_optimism_events - meta: - blockchain: optimism - project: opensea - contributors: sohwak - config: - tags: ['optimism','opensea','events'] - description: > - Opensea events on optimism, from Seaport v1.4 - tests: - - check_columns_nft_old_events - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - tx_hash - - evt_index - - nft_contract_address - - token_id - - sub_type - - sub_idx - - check_seed: - seed_file: ref('opensea_optimism_seaport_trades_samples') - filter: - blockchain: optimism - project: opensea - version: v4 - check_columns: - - buyer - - seller - - amount_raw - - platform_fee_amount_raw - - royalty_fee_amount_raw - match_columns: - - blockchain - - project - - version - - tx_hash - - evt_index - - sub_idx - - nft_contract_address - - token_id - columns: - - *unique_trade_id diff --git a/models/_sector/nft/trades/chains/old/platforms/opensea_polygon_schema.yml b/models/_sector/nft/trades/chains/old/platforms/opensea_polygon_schema.yml deleted file mode 100644 index b61e747d94d..00000000000 --- a/models/_sector/nft/trades/chains/old/platforms/opensea_polygon_schema.yml +++ /dev/null @@ -1,92 +0,0 @@ -version: 2 - -models: - - name: opensea_v3_polygon_events - meta: - blockchain: polygon - project: opensea - contributors: sohwak - config: - tags: ['polygon','opensea','events'] - description: > - Opensea events on Polygon, from Seaport v1.1 - tests: - - check_columns_nft_old_events - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - tx_hash - - evt_index - - nft_contract_address - - token_id - - sub_type - - sub_idx - - check_seed: - seed_file: ref('opensea_polygon_seaport_trades_samples') - filter: - blockchain: polygon - project: opensea - version: v3 - check_columns: - - buyer - - seller - - amount_raw - - platform_fee_amount_raw - - royalty_fee_amount_raw - match_columns: - - blockchain - - project - - version - - tx_hash - - evt_index - - sub_idx - - nft_contract_address - - token_id - columns: - - &unique_trade_id - name: unique_trade_id - description: "Unique trade ID" - tests: - - unique - - - name: opensea_v4_polygon_events - meta: - blockchain: polygon - project: opensea - contributors: sohwak - config: - tags: ['polygon','opensea','events'] - description: > - Opensea events on Polygon, from Seaport v1.4 - tests: - - check_columns_nft_old_events - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - tx_hash - - evt_index - - nft_contract_address - - token_id - - sub_type - - sub_idx - - check_seed: - seed_file: ref('opensea_polygon_seaport_trades_samples') - filter: - blockchain: polygon - project: opensea - version: v4 - check_columns: - - buyer - - seller - - amount_raw - - platform_fee_amount_raw - - royalty_fee_amount_raw - match_columns: - - blockchain - - project - - version - - tx_hash - - evt_index - - sub_idx - - nft_contract_address - - token_id - columns: - - *unique_trade_id diff --git a/models/_sector/nft/trades/chains/old/platforms/opensea_zora_schema.yml b/models/_sector/nft/trades/chains/old/platforms/opensea_zora_schema.yml deleted file mode 100644 index 6c711f10c28..00000000000 --- a/models/_sector/nft/trades/chains/old/platforms/opensea_zora_schema.yml +++ /dev/null @@ -1,222 +0,0 @@ -version: 2 - -models: - - name: opensea_v4_zora_events - - meta: - blockchain: zora - project: opensea - contributors: kaiblade - config: - tags: ['zora','opensea','events','seaport'] - description: > - Opensea events on zora, from Seaport v1.4, v1.5 - tests: - - check_columns_nft_old_events - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - tx_hash - - evt_index - - nft_contract_address - - token_id - - sub_type - - sub_idx - - check_seed: - seed_file: ref('opensea_zora_seaport_trades_samples') - filter: - blockchain: zora - project: opensea - version: v4 - check_columns: - - buyer - - seller - - amount_raw - - platform_fee_amount_raw - - royalty_fee_amount_raw - match_columns: - - blockchain - - project - - version - - tx_hash - - evt_index - - sub_idx - - nft_contract_address - - token_id - columns: - - &blockchain - name: blockchain - description: "Blockchain" - - &project - name: project - description: "Project" - - &version - name: version - description: "Project version" - - &block_time - name: block_time - description: "UTC event block time" - - &token_id - name: token_id - description: "NFT Token ID" - - &collection - name: collection - description: "NFT collection name" - - &amount_usd - name: amount_usd - description: "USD value of the trade at time of execution" - - &token_standard - name: token_standard - description: "Token standard" - - &trade_type - name: trade_type - description: "Identify whether it was a single NFT trade or multiple NFTs traded" - - &number_of_items - name: number_of_items - description: "Number of items traded" - - &trade_category - name: trade_category - description: "How was this NFT traded ? (Direct buy, auction, etc...)" - - &evt_type - name: evt_type - description: "Event type (Trade, Mint, Burn)" - - &seller - name: seller - description: "Seller wallet address" - - &buyer - name: buyer - description: "Buyer wallet address" - - &amount_original - name: amount_original - description: "Traded amount in original currency" - - &amount_raw - name: amount_raw - description: "Traded amount in original currency before decimals correction" - - ¤cy_symbol - name: currency_symbol - description: "Symbol of original currency used for payment" - - ¤cy_contract - name: currency_contract - description: "Contract address of original token used for payment, with ETH contract address swapped for WETH" - - &nft_contract_address - name: nft_contract_address - description: "NFT contract address, only if 1 nft was transacted" - - &project_contract_address - name: project_contract_address - description: "Contract address used by the project, in this case wyvern contract" - - &aggregator_name - name: aggregator_name - description: "If the trade was performed via an aggregator, displays aggregator name" - - &aggregator_address - name: aggregator_address - description: "If the trade was performed via an aggregator, displays aggregator address" - - &tx_hash - name: tx_hash - description: "Transaction hash" - - &block_number - name: block_number - description: "Block number in which the transaction was executed " - - &tx_from - name: tx_from - description: "Address that initiated the transaction" - - &tx_to - name: tx_to - description: "Address that received the transaction" - - &platform_fee_amount_raw - name: platform_fee_amount_raw - description: "Raw numerical amount for platform fees" - - &platform_fee_amount - name: platform_fee_amount - description: "Platform fee amount in original token currency (properly formatted in decimals)" - - &platform_fee_amount_usd - name: platform_fee_amount_usd - description: "Platform fee amount in USD" - - &platform_fee_percentage - name: platform_fee_amount_usd - description: "Platform fee in % of the amount paid for a given trade" - - &royalty_fee_amount_raw - name: royalty_fee_amount_raw - description: "Raw numerical amount for royalty fees" - - &royalty_fee_amount - name: royalty_fee_amount - description: "Royalty fee amount in original token currency (properly formatted in decimals)" - - &royalty_fee_amount_usd - name: royalty_fee_amount_usd - description: "Royalty fee amount in USD" - - &royalty_fee_percentage - name: royalty_fee_percentage - description: "Royalty fee in % of the amount paid for a given trade" - - &royalty_fee_receive_address - name: royalty_fee_receive_address - description: "Wallet addresses receiving fees from the transaction" - - &royalty_fee_currency_symbol - name: royalty_fee_currency_symbol - description: "Symbol of the token in which fees are paid out" - - &unique_trade_id - name: unique_trade_id - description: "Unique trade ID" - tests: - - unique - - &original_currency_contract - name: original_currency_contract - description: "original currency" - - ¤cy_decimals - name: currency_decimals - description: "Token Decimal" - - &platform_fee_receive_address - name: platform_fee_receive_address - description: "Platform fee receive address" - - &royalty_fee_receive_address_1 - name: royalty_fee_receive_address_1 - description: "Wallet addresses receiving fees from the transaction" - - &royalty_fee_receive_address_2 - name: royalty_fee_receive_address_2 - description: "Wallet addresses receiving fees from the transaction" - - &royalty_fee_receive_address_3 - name: royalty_fee_receive_address_3 - description: "Wallet addresses receiving fees from the transaction" - - &royalty_fee_receive_address_4 - name: royalty_fee_receive_address_4 - description: "Wallet addresses receiving fees from the transaction" - - &royalty_fee_receive_address_5 - name: royalty_fee_receive_address_5 - description: "Wallet addresses receiving fees from the transaction" - - &royalty_fee_amount_raw_1 - name: royalty_fee_amount_raw_1 - description: "Wallet addresses receiving fees from the transaction" - - &royalty_fee_amount_raw_2 - name: royalty_fee_amount_raw_2 - description: "Wallet addresses receiving fees from the transaction" - - &royalty_fee_amount_raw_3 - name: royalty_fee_amount_raw_3 - description: "Wallet addresses receiving fees from the transaction" - - &royalty_fee_amount_raw_4 - name: royalty_fee_amount_raw_4 - description: "Wallet addresses receiving fees from the transaction" - - &royalty_fee_amount_raw_5 - name: royalty_fee_amount_raw_5 - description: "Wallet addresses receiving fees from the transaction" - - &evt_index - name: evt_index - description: "Event index of transaction event" - - &right_hash - name: right_hash - description: "right 8 character of data column on Transaction" - - &zone_address - name: zone_address - description: "zone address of Seaport transaction" - - &estimated_price - name: estimated_price - description: "True if it is bundle trade and dividened price" - - &is_private - name: is_private - description: "True if it is private sale" - - &sub_idx - name: sub_idx - description: "Generated value used in seaport internally" - - &sub_type - name: sub_type - description: "Generated value used in seaport internally" - - &fee_wallet_name - name: fee_wallet_name - description: "Address name when a specific pre-specified fee address is included." - diff --git a/models/_sector/nft/trades/chains/optimism/nft_optimism_base_trades.sql b/models/_sector/nft/trades/chains/optimism/nft_optimism_base_trades.sql index bd08b51a0d3..17ba24f0af7 100644 --- a/models/_sector/nft/trades/chains/optimism/nft_optimism_base_trades.sql +++ b/models/_sector/nft/trades/chains/optimism/nft_optimism_base_trades.sql @@ -14,6 +14,8 @@ ,ref('quix_v4_optimism_base_trades') ,ref('quix_v5_optimism_base_trades') ,ref('element_optimism_base_trades') + ,ref('opensea_v3_optimism_base_trades') + ,ref('opensea_v4_optimism_base_trades') ] %} with base_union as ( diff --git a/models/_sector/nft/trades/chains/optimism/platforms/_schema.yml b/models/_sector/nft/trades/chains/optimism/platforms/_schema.yml index 758e6430ca4..5f8b540e25c 100644 --- a/models/_sector/nft/trades/chains/optimism/platforms/_schema.yml +++ b/models/_sector/nft/trades/chains/optimism/platforms/_schema.yml @@ -132,3 +132,69 @@ models: - price_raw - platform_fee_amount_raw - royalty_fee_amount_raw + + - name: opensea_v3_optimism_base_trades + meta: + blockchain: optimism + project: opensea + contributors: sohwak, 0xRob + config: + tags: [ 'opensea','base_trades','seaport' ] + description: > + Opensea base trades from seaport (v3) + tests: + - check_columns_nft_base_trades + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - block_number + - tx_hash + - sub_tx_trade_id + - check_seed: + seed_file: ref('opensea_seaport_trades_samples') + filter: + blockchain: optimism + project: opensea + project_version: v3 + check_columns: + - buyer + - seller + - price_raw + - platform_fee_amount_raw + - royalty_fee_amount_raw + match_columns: + - block_number + - tx_hash + - sub_tx_trade_id + + - name: opensea_v4_optimism_base_trades + meta: + blockchain: optimism + project: opensea + contributors: sohwak, 0xRob + config: + tags: [ 'opensea','base_trades','seaport' ] + description: > + Opensea base trades from seaport (v4) + tests: + - check_columns_nft_base_trades + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - block_number + - tx_hash + - sub_tx_trade_id + - check_seed: + seed_file: ref('opensea_seaport_trades_samples') + filter: + blockchain: optimism + project: opensea + project_version: v4 + check_columns: + - buyer + - seller + - price_raw + - platform_fee_amount_raw + - royalty_fee_amount_raw + match_columns: + - block_number + - tx_hash + - sub_tx_trade_id diff --git a/models/_sector/nft/trades/chains/old/platforms/opensea_v3_optimism_events.sql b/models/_sector/nft/trades/chains/optimism/platforms/opensea_v3_optimism_base_trades.sql similarity index 89% rename from models/_sector/nft/trades/chains/old/platforms/opensea_v3_optimism_events.sql rename to models/_sector/nft/trades/chains/optimism/platforms/opensea_v3_optimism_base_trades.sql index 2ceeb7bcc76..f947e6ade38 100644 --- a/models/_sector/nft/trades/chains/old/platforms/opensea_v3_optimism_events.sql +++ b/models/_sector/nft/trades/chains/optimism/platforms/opensea_v3_optimism_base_trades.sql @@ -1,11 +1,11 @@ {{ config( schema = 'opensea_v3_optimism', - alias = 'events', + alias = 'base_trades', materialized = 'incremental', file_format = 'delta', incremental_strategy = 'merge', - unique_key = ['tx_hash', 'evt_index', 'nft_contract_address', 'token_id', 'sub_type', 'sub_idx'] + unique_key = ['block_number', 'tx_hash', 'sub_tx_trade_id'] ) }} diff --git a/models/_sector/nft/trades/chains/old/platforms/opensea_v4_optimism_events.sql b/models/_sector/nft/trades/chains/optimism/platforms/opensea_v4_optimism_base_trades.sql similarity index 88% rename from models/_sector/nft/trades/chains/old/platforms/opensea_v4_optimism_events.sql rename to models/_sector/nft/trades/chains/optimism/platforms/opensea_v4_optimism_base_trades.sql index eb72aa90c21..ff7ea904ad7 100644 --- a/models/_sector/nft/trades/chains/old/platforms/opensea_v4_optimism_events.sql +++ b/models/_sector/nft/trades/chains/optimism/platforms/opensea_v4_optimism_base_trades.sql @@ -1,10 +1,11 @@ {{ config( schema = 'opensea_v4_optimism', - alias = 'events', + alias = 'base_trades', + materialized = 'incremental', file_format = 'delta', incremental_strategy = 'merge', - unique_key = ['tx_hash', 'evt_index', 'nft_contract_address', 'token_id', 'sub_type', 'sub_idx'] + unique_key = ['block_number', 'tx_hash', 'sub_tx_trade_id'] ) }} diff --git a/models/_sector/nft/trades/chains/polygon/nft_polygon_base_trades.sql b/models/_sector/nft/trades/chains/polygon/nft_polygon_base_trades.sql index d0fea85b1e1..62959678cbb 100644 --- a/models/_sector/nft/trades/chains/polygon/nft_polygon_base_trades.sql +++ b/models/_sector/nft/trades/chains/polygon/nft_polygon_base_trades.sql @@ -17,6 +17,8 @@ ,ref('tofu_polygon_base_trades') ,ref('magiceden_polygon_base_trades') ,ref('magiceden_v2_polygon_base_trades') + ,ref('opensea_v3_polygon_base_trades') + ,ref('opensea_v4_polygon_base_trades') ] %} with base_union as ( diff --git a/models/_sector/nft/trades/chains/polygon/platforms/_schema.yml b/models/_sector/nft/trades/chains/polygon/platforms/_schema.yml index 96ad3cdcdf3..384dad9ae2a 100644 --- a/models/_sector/nft/trades/chains/polygon/platforms/_schema.yml +++ b/models/_sector/nft/trades/chains/polygon/platforms/_schema.yml @@ -171,6 +171,72 @@ models: - dbt_utils.unique_combination_of_columns: combination_of_columns: [ 'block_number','tx_hash','sub_tx_trade_id' ] + - name: opensea_v3_polygon_base_trades + meta: + blockchain: polygon + project: opensea + contributors: sohwak, 0xRob + config: + tags: [ 'opensea','base_trades','seaport' ] + description: > + Opensea base trades from seaport (v3) + tests: + - check_columns_nft_base_trades + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - block_number + - tx_hash + - sub_tx_trade_id + - check_seed: + seed_file: ref('opensea_seaport_trades_samples') + filter: + blockchain: polygon + project: opensea + project_version: v3 + check_columns: + - buyer + - seller + - price_raw + - platform_fee_amount_raw + - royalty_fee_amount_raw + match_columns: + - block_number + - tx_hash + - sub_tx_trade_id + + - name: opensea_v4_polygon_base_trades + meta: + blockchain: polygon + project: opensea + contributors: sohwak, 0xRob + config: + tags: [ 'opensea','base_trades','seaport' ] + description: > + Opensea base trades from seaport (v4) + tests: + - check_columns_nft_base_trades + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - block_number + - tx_hash + - sub_tx_trade_id + - check_seed: + seed_file: ref('opensea_seaport_trades_samples') + filter: + blockchain: polygon + project: opensea + project_version: v4 + check_columns: + - buyer + - seller + - price_raw + - platform_fee_amount_raw + - royalty_fee_amount_raw + match_columns: + - block_number + - tx_hash + - sub_tx_trade_id + - name: opensea_v2_polygon_base_trades meta: blockchain: polygon diff --git a/models/_sector/nft/trades/chains/old/platforms/opensea_v3_polygon_events.sql b/models/_sector/nft/trades/chains/polygon/platforms/opensea_v3_polygon_base_trades.sql similarity index 89% rename from models/_sector/nft/trades/chains/old/platforms/opensea_v3_polygon_events.sql rename to models/_sector/nft/trades/chains/polygon/platforms/opensea_v3_polygon_base_trades.sql index 1ef1a58d822..f007e00ce76 100644 --- a/models/_sector/nft/trades/chains/old/platforms/opensea_v3_polygon_events.sql +++ b/models/_sector/nft/trades/chains/polygon/platforms/opensea_v3_polygon_base_trades.sql @@ -1,10 +1,11 @@ {{ config( schema = 'opensea_v3_polygon', - alias = 'events', + alias = 'base_trades', + materialized = 'incremental', file_format = 'delta', incremental_strategy = 'merge', - unique_key = ['tx_hash', 'evt_index', 'nft_contract_address', 'token_id', 'sub_type', 'sub_idx'] + unique_key = ['block_number', 'tx_hash', 'sub_tx_trade_id'] ) }} WITH fee_wallets as ( diff --git a/models/_sector/nft/trades/chains/old/platforms/opensea_v4_polygon_events.sql b/models/_sector/nft/trades/chains/polygon/platforms/opensea_v4_polygon_base_trades.sql similarity index 74% rename from models/_sector/nft/trades/chains/old/platforms/opensea_v4_polygon_events.sql rename to models/_sector/nft/trades/chains/polygon/platforms/opensea_v4_polygon_base_trades.sql index 836dc303953..92c6518d037 100644 --- a/models/_sector/nft/trades/chains/old/platforms/opensea_v4_polygon_events.sql +++ b/models/_sector/nft/trades/chains/polygon/platforms/opensea_v4_polygon_base_trades.sql @@ -1,10 +1,11 @@ {{ config( schema = 'opensea_v4_polygon', - alias = 'events', + alias = 'base_trades', + materialized = 'incremental', file_format = 'delta', incremental_strategy = 'merge', - unique_key = ['tx_hash', 'evt_index', 'nft_contract_address', 'token_id', 'sub_type', 'sub_idx'] + unique_key = ['block_number', 'tx_hash', 'sub_tx_trade_id'] ) }} WITH fee_wallets as ( @@ -30,10 +31,4 @@ from trades where ( fee_wallet_name = 'opensea' or right_hash = 0x360c6ebe ) --- temporary fix to exclude duplicates -and tx_hash not in ( -select tx_hash from -trades -group by tx_hash, evt_index, nft_contract_address, token_id, sub_type, sub_idx -having count(*) > 1 -) + diff --git a/models/_sector/nft/trades/chains/zora/nft_zora_base_trades.sql b/models/_sector/nft/trades/chains/zora/nft_zora_base_trades.sql index b9fa163df4b..2b628babb47 100644 --- a/models/_sector/nft/trades/chains/zora/nft_zora_base_trades.sql +++ b/models/_sector/nft/trades/chains/zora/nft_zora_base_trades.sql @@ -7,6 +7,7 @@ {% set nft_models = [ ref('zonic_zora_base_trades') + ,ref('opensea_v4_zora_base_trades') ] %} with base_union as ( diff --git a/models/_sector/nft/trades/chains/zora/platforms/_schema.yml b/models/_sector/nft/trades/chains/zora/platforms/_schema.yml index 17875136758..92a8d1fcc11 100644 --- a/models/_sector/nft/trades/chains/zora/platforms/_schema.yml +++ b/models/_sector/nft/trades/chains/zora/platforms/_schema.yml @@ -28,3 +28,36 @@ models: - price_raw - platform_fee_amount_raw - royalty_fee_amount_raw + + - name: opensea_v4_zora_base_trades + meta: + blockchain: zora + project: opensea + contributors: sohwak, 0xRob + config: + tags: [ 'opensea','base_trades','seaport' ] + description: > + Opensea base trades from seaport (v4) + tests: + - check_columns_nft_base_trades + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - block_number + - tx_hash + - sub_tx_trade_id + - check_seed: + seed_file: ref('opensea_seaport_trades_samples') + filter: + blockchain: zora + project: opensea + project_version: v4 + check_columns: + - buyer + - seller + - price_raw + - platform_fee_amount_raw + - royalty_fee_amount_raw + match_columns: + - block_number + - tx_hash + - sub_tx_trade_id diff --git a/models/_sector/nft/trades/chains/old/platforms/opensea_v4_zora_events.sql b/models/_sector/nft/trades/chains/zora/platforms/opensea_v4_zora_base_trades.sql similarity index 86% rename from models/_sector/nft/trades/chains/old/platforms/opensea_v4_zora_events.sql rename to models/_sector/nft/trades/chains/zora/platforms/opensea_v4_zora_base_trades.sql index 2c2a8594d7d..c423a2221a9 100644 --- a/models/_sector/nft/trades/chains/old/platforms/opensea_v4_zora_events.sql +++ b/models/_sector/nft/trades/chains/zora/platforms/opensea_v4_zora_base_trades.sql @@ -1,10 +1,11 @@ {{ config( schema = 'opensea_v4_zora', - alias = 'events', + alias = 'base_trades', + materialized = 'incremental', file_format = 'delta', incremental_strategy = 'merge', - unique_key = ['tx_hash', 'evt_index', 'nft_contract_address', 'token_id', 'sub_type', 'sub_idx'] + unique_key = ['block_number', 'tx_hash', 'sub_tx_trade_id'] ) }} diff --git a/seeds/opensea/arbitrum/opensea_arbitrum_seaport_trades_samples.csv b/seeds/opensea/arbitrum/opensea_arbitrum_seaport_trades_samples.csv deleted file mode 100644 index c71bb4f17b6..00000000000 --- a/seeds/opensea/arbitrum/opensea_arbitrum_seaport_trades_samples.csv +++ /dev/null @@ -1,29 +0,0 @@ -blockchain,project,version,block_date,tx_hash,evt_index,sub_idx,nft_contract_address,token_id,buyer,seller,amount_raw,platform_fee_amount_raw,royalty_fee_amount_raw -arbitrum,opensea,v3,2022-09-23,0x6d1c85d0b2e5992f7771dcc33455f37db889fba76988480d9e7819f186ab5e06,0,1,0x2a4730b0bd1bb9e06f365c15403fa264119d9a51,6364,0xaa312eb19552f924dfc47bfefe47f35a902fc595,0x5fa98b2545710bc4bd0e0ac57b8efd8d3c50ceab,990000000000000,24750000000000,99000000000000 -arbitrum,opensea,v3,2022-09-23,0x16eab415701d1bb5ef66396ee676ff9a10ca112fced41195333aa23a6d613e65,0,1,0x642ffab2752df3bce97083709f36080fb1482c80,32796,0xae0edff62177152d8fea78c57b022e513f86a5c2,0xf54dc01a59c5333617d03aef49aa1d2357c5f68a,21000000000000000,525000000000000, -arbitrum,opensea,v3,2022-09-23,0xa9a5c08da80e1b450bfd7cb56fafc178c36fd7280c6a9d9159508429565ed2ef,0,1,0xb07b371bf4f4634cf816051d2ee741164d4203fc,31080,0x012db66110d211e5aa15171b15265384f22fd1de,0x9ec3161bd0eb90225129b1376a269023b4bc4665,150000000000000,3750000000000, -arbitrum,opensea,v3,2022-09-23,0x1869f5e27e81654fb218c087417a0ad68c3ea302742c5af833e692f7d3f6659e,0,1,0x9fd5b98251becfbf66bead6035fd5c95afdb8bb1,193,0xf1ea4eaea0f6b0a12a4795b5e857ecda6dae21c6,0xe981e2a9a49c82a22fe5e44e58c8523c8d622792,100000000000000,2500000000000, -arbitrum,opensea,v3,2022-09-23,0x409fed8268db78513d0b329368c640dd879ad7219bce304646936708b36db773,0,1,0x642ffab2752df3bce97083709f36080fb1482c80,33572,0xc1ac3133e13355f6e41807da6b5d5dfae77f60f9,0x61e6f8812198e172a6104f8c956e4b58859bfab8,13300000000000000,332500000000000, -arbitrum,opensea,v3,2022-09-23,0x7701e95fd7b0bce93b374507bd3d10d4033ef64724161f34baf4505c3dd7b756,0,1,0xe00cc435fff6331963bfc2d984009be524c282c8,411,0x97dbf4d74fccca9767d9243a1380adfc000c3638,0x8431eb65dedc382b9aae759dc0488cc12a29f9cb,40000000000000,1000000000000, -arbitrum,opensea,v3,2022-09-23,0x905b9b8bb024051a48e0592e588761744ed4b87c3cd348862b5505495fec759a,0,1,0x55df058c5934ba3f1ffcf6c726e75659009f0983,1701,0xc1ac3133e13355f6e41807da6b5d5dfae77f60f9,0x508f159b415dd59eccf9e738f67e8c854d475c0e,2999900000000000,74997500000000,99896670000000 -arbitrum,opensea,v3,2022-09-23,0xd6eeb93fb6d317cc189dd19891db352d292d02080af505d9a455995201894f27,0,1,0xe00cc435fff6331963bfc2d984009be524c282c8,480,0x3ce8ce4a5ee7d6ef768df4ad35bf245e0d0314db,0xe981e2a9a49c82a22fe5e44e58c8523c8d622792,40000000000000,1000000000000, -arbitrum,opensea,v3,2022-09-23,0x59fe0f30fc5eb3d9ca268f15381151010e3fbf0ec2dd7c6e8f08318ca22186ac,0,1,0xb07b371bf4f4634cf816051d2ee741164d4203fc,59058,0xaf21854d58550db12aad2b8e9dd3a08414edd120,0x412dd131438d86c088bde31b6feb5616e3dd0566,150000000000000,3750000000000, -arbitrum,opensea,v3,2022-09-23,0x3a636652ebf24620ffb8ff9fe1d1252c40e833a9d074574a08bac51879f5c8c3,0,1,0x642ffab2752df3bce97083709f36080fb1482c80,4575,0x940459a510b2f4ad950795d4a47941391628bf0d,0x537789a5cd977c0161a36c73b8154f313ce86028,17500000000000000,437500000000000, -arbitrum,opensea,v3,2022-09-23,0x2ad4fd12398f49047d4a33ca5e55e3808c56e504d2b4ae2d1cab4071ec404331,0,1,0xe00cc435fff6331963bfc2d984009be524c282c8,49,0xd19fd69bfdc2651272c523df8408738bc1f93104,0xe981e2a9a49c82a22fe5e44e58c8523c8d622792,40000000000000,1000000000000, -arbitrum,opensea,v3,2022-09-23,0x08553b9bcb1f8ba7b0b2e47c6a09f737f4b32fbe6c47d2546232f359f7b2845b,0,1,0xe00cc435fff6331963bfc2d984009be524c282c8,48,0x9421a58872b8e4bf6287b26295f64719f5283b89,0xe981e2a9a49c82a22fe5e44e58c8523c8d622792,40000000000000,1000000000000, -arbitrum,opensea,v4,2023-03-16,0x0bfef583027f29d2f316120902600de7f2b1e9235d6df3a97b80cbb43fe07c83,10,1,0x652d66fe218a7c33808b7d6a7db6a54e2f9f4a51,989,0xad2365dff389fc05db964e36d3bb80baf755d016,0x80c69f62ff8258f58c56a587fb02a03d59a50e39,4900000000000000,24500000000000,245000000000000 -arbitrum,opensea,v4,2023-03-16,0xf7484562aab1a1cf0478db3e96d8911bb9991f38f72d5940eaf964edc582d896,2,1,0x10c67db7876306fd4dc246184611625a77c7440c,9620,0x0452ae1f57b02f390b603a60f21608758689727d,0xf2ecaaf3af6c21144d2ebacc855d84fad6b1595f,1200000000000000,6000000000000,60000000000000 -arbitrum,opensea,v4,2023-03-16,0xa20a5f38f4c5c9cb5b3902f0c8adea697df5a1c078480cd925b47d37a4c15c40,4,1,0xfae39ec09730ca0f14262a636d2d7c5539353752,218668,0x9178deac61d49d30f5b49b1fb687312bbf9d960b,0x4773b2577e2166ee3f7e21381f4ecf6a7535fbb1,5900000000000000,29500000000000, -arbitrum,opensea,v4,2023-03-16,0xa20a5f38f4c5c9cb5b3902f0c8adea697df5a1c078480cd925b47d37a4c15c40,3,1,0xfae39ec09730ca0f14262a636d2d7c5539353752,372894,0x9178deac61d49d30f5b49b1fb687312bbf9d960b,0x7b6d789390e979eef34737e242a8ba8c93a6666c,5800000000000000,29000000000000, -arbitrum,opensea,v4,2023-03-16,0xa20a5f38f4c5c9cb5b3902f0c8adea697df5a1c078480cd925b47d37a4c15c40,5,1,0xfae39ec09730ca0f14262a636d2d7c5539353752,14261,0x9178deac61d49d30f5b49b1fb687312bbf9d960b,0xadb1dcabfcdd8e60457e4c856214f471cd41b178,6400000000000000,32000000000000, -arbitrum,opensea,v4,2023-03-16,0xa20a5f38f4c5c9cb5b3902f0c8adea697df5a1c078480cd925b47d37a4c15c40,2,1,0xfae39ec09730ca0f14262a636d2d7c5539353752,263656,0x9178deac61d49d30f5b49b1fb687312bbf9d960b,0x3a33e605008433f1eda7bd5c65befa9fccd8c344,5500000000000000,27500000000000, -arbitrum,opensea,v4,2023-03-16,0xa20a5f38f4c5c9cb5b3902f0c8adea697df5a1c078480cd925b47d37a4c15c40,1,1,0xfae39ec09730ca0f14262a636d2d7c5539353752,214352,0x9178deac61d49d30f5b49b1fb687312bbf9d960b,0xb1d65729bd421a15c12880c62113445f602bc7ff,5400000000000000,27000000000000, -arbitrum,opensea,v4,2023-03-16,0xa20a5f38f4c5c9cb5b3902f0c8adea697df5a1c078480cd925b47d37a4c15c40,0,1,0xfae39ec09730ca0f14262a636d2d7c5539353752,26139,0x9178deac61d49d30f5b49b1fb687312bbf9d960b,0xaa6c7b556449e1d5a75b6322a256180edd1c8edc,5200000000000000,26000000000000, -arbitrum,opensea,v4,2023-03-16,0xbce61db764fc9318153f15c279a19c6011365f502fcdbf6c3ea91ec94c6f4d9d,7,1,0x3ecc587ef402b5e00a9767d6f9670b463de2e177,4294967298,0xf7cb0b1bffa994c71811a72d777e94ed480105a2,0x7e335a2f5c91debac9e5af002dc17c5c747c017e,146000000000000000,,7300000000000000 -arbitrum,opensea,v4,2023-03-16,0x36b46f8f6c96080fcaabc586e9038037f748e97532971cc0e7a6b54846007f7d,0,1,0xfae39ec09730ca0f14262a636d2d7c5539353752,210105,0x7ad28ffa81c91c758ba48f26270c8df5b76f6198,0xa6d599a1c10d5517c97edf46857deb5795dd1576,14700000000000000,73500000000000, -arbitrum,opensea,v4,2023-03-16,0x583b92e180038ada4fa1cb2ed6bd172d6d7d32a1c799b0bd3949995b48d4a570,6,1,0xfae39ec09730ca0f14262a636d2d7c5539353752,405228,0x96e1877e833a3297326178625028eab7fd57ff71,0xeb4f3dec696f3234d2347ecdf41b7d6a969641bf,4200000000000000,21000000000000, -arbitrum,opensea,v4,2023-03-16,0x577f53e8d058d16683f83a6452c847b1ac377d789a11d63359b7d06ef8b0559e,0,1,0xfae39ec09730ca0f14262a636d2d7c5539353752,322474,0xb3a0b9f56cb12328b1143cf969d40e01c3730c6a,0xc9879d3cfc7d71a90d39230e058d287c438c81c9,4100000000000000,20500000000000, -arbitrum,opensea,v4,2023-03-16,0x37691a2fe0b3d9c078023cefe9158690790d9e9a7f76359f0efd45a73fae1a20,2,1,0xfae39ec09730ca0f14262a636d2d7c5539353752,272813,0x383c1e458b1885e2e16a7bd2b13abd46b447da3b,0x0f476f28479a24e7a1917123be0b5434095849c6,4300000000000000,21500000000000, -arbitrum,opensea,v4,2023-03-16,0xb22a6a71e58770100c4ed749c38373a2368d46334f962d8a34eb6ad7c5c84141,0,1,0xfae39ec09730ca0f14262a636d2d7c5539353752,405650,0xe3eb37be2f3f363562ad04eeba9b9ce67722cb81,0xbcf0b928fd4b3906ec18f227f9d46e539c0b2173,4200000000000000,21000000000000, -arbitrum,opensea,v4,2023-03-16,0x29c10ea00299d8e128a640c16cc51cef37a6ac87ceb37dda16d5cb96b54eb7ed,0,1,0xfae39ec09730ca0f14262a636d2d7c5539353752,275625,0x9219630ff1f382429ba29abbf6754d26e1e9aac7,0x2d5d8eb41abc1fc50dccc36c5029ea46e5301b59,4100000000000000,20500000000000, -arbitrum,opensea,v4,2023-03-16,0xd49e4f614d5e253fb3d8efc14d449791d896ec6154a0aed79564c9b44b7ff977,0,1,0x0b6f1ea63e959bffe87eaf56a4ac7b9fddfb6abf,32393,0x4ddc9139099209e8437a33652e5203f2fd092c68,0xa3f9a6da1c45a54a0d5acd4edad705ac94d8a4e6,700000000000000,3500000000000,21000000000000 diff --git a/seeds/opensea/avalanche_c/opensea_avalanche_c_seaport_trades_samples.csv b/seeds/opensea/avalanche_c/opensea_avalanche_c_seaport_trades_samples.csv deleted file mode 100644 index 1fd6d6a44cb..00000000000 --- a/seeds/opensea/avalanche_c/opensea_avalanche_c_seaport_trades_samples.csv +++ /dev/null @@ -1,5 +0,0 @@ -blockchain,project,version,block_date,tx_hash,evt_index,sub_idx,nft_contract_address,token_id,buyer,seller,amount_raw,platform_fee_amount_raw,royalty_fee_amount_raw -avalanche_c,opensea,v4,2024-04-10,0x1ecb0c73521e7be760f7fc22f77fe1bc7167f9c945b276c3d3db2623bd24e25e,20,1,0x2837359114c5c265e7d2f7c599828da74e34485e,373,0xec8541d68a2f66690c2b45e8908fde7e3b3e1bce,0xfc791c6847dd23e1cc980e3e57b50b14485b5ec4,1350000000000000000,33750000000000000, -avalanche_c,opensea,v4,2024-04-08,0xa87e9f72956505d11ae4ebb48a78c003e99b99c5c24ed1683a9c9dc9bc24ccab,25,1,0x9d5d18864d7776a61220c287258e06db7cdcf444,559,0xe4461b21b6639c729b0d86e4c60697a9ae38199b,0x3fd1cdaab0628ad69558524aae377abc32988fd7,79700000000000000,1992500000000000, -avalanche_c,opensea,v3,2023-01-12,0xafce6894c0ad66c8518565f571a3ba286de4f56881fc78aa5f6cee41e5abd4e0,24,1,0x825189515d0a7756436f0efb6e4be5a5af87e21d,11372,0x1728d41d4016a351f6a8d38c1fdd7d40763e9f7d,0x26663df4bdb9983466fc83cdf527c973f92428e7,250000000000000000,6250000000000000,17500000000000000 -avalanche_c,opensea,v3,2023-01-13,0x90e30aff4a29237a08414ecb5f1db5a4620ed689f8a2da8109ad3d996cfa200a,3,1,0x7325e3564b89968d102b3261189ea44c0f5f1a8e,102370,0xb16c1f3b2e71f80260ad8ffd7706850d6ff38995,0xb5d36382dd9771865d9a70c138522dc681d3ab25,1330000000000000000,33250000000000000,93100000000000000 \ No newline at end of file diff --git a/seeds/opensea/avalanche_c/schema.yml b/seeds/opensea/avalanche_c/schema.yml deleted file mode 100644 index 5f1690f0c11..00000000000 --- a/seeds/opensea/avalanche_c/schema.yml +++ /dev/null @@ -1,15 +0,0 @@ -version: 2 - -seeds: - - name: opensea_avalanche_c_seaport_trades_samples - config: - column_types: - token_id: uint256 - tx_hash: varbinary - buyer: varbinary - seller: varbinary - nft_contract_address: varbinary - amount_raw: uint256 - platform_fee_amount_raw: uint256 - royalty_fee_amount_raw: uint256 - diff --git a/seeds/opensea/ethereum/opensea_ethereum_seaport_trades_samples.csv b/seeds/opensea/ethereum/opensea_ethereum_seaport_trades_samples.csv deleted file mode 100644 index 7dfe56eec14..00000000000 --- a/seeds/opensea/ethereum/opensea_ethereum_seaport_trades_samples.csv +++ /dev/null @@ -1,59 +0,0 @@ -blockchain,project,version,block_date,tx_hash,evt_index,sub_idx,nft_contract_address,token_id,buyer,seller,amount_raw,platform_fee_amount_raw,royalty_fee_amount_raw -ethereum,opensea,v4,2023-03-05,0xff0be907571ddf73d40de143a111f2cfaaec0fa57eedb8672f16f49711e31188,51,1,0x5f076e995290f3f9aea85fdd06d8fae118f2b75c,2463,0xcf1319531bee286e85c289b9747e159e742c0495,0x52b1180367d47f64a7de5535abe78c8e16f735ef,500000000000000000,,25000000000000000 -ethereum,opensea,v4,2023-03-05,0xff5ed04bf03a8162c784a2c3ae8fec9a687b5c0857bd6c8abcdef9af1c6da211,229,1,0xd1466d7a2e13a47677608f68093c5ea9fe910611,4144,0xa2bd9bafe5dd685f8ca1a729d368be40496e6304,0x7510396b6801c6a88c383baed7058dc553ab980e,7000000000000000,,35000000000000 -ethereum,opensea,v4,2023-03-05,0xff5ed04bf03a8162c784a2c3ae8fec9a687b5c0857bd6c8abcdef9af1c6da211,228,1,0xd1466d7a2e13a47677608f68093c5ea9fe910611,24548,0xa2bd9bafe5dd685f8ca1a729d368be40496e6304,0x17ce24a23b708a6056d2b52ea4f59123e3ca5281,7000000000000000,,35000000000000 -ethereum,opensea,v4,2023-03-05,0xffa9e33956c304a314cf1ea8dd609755a9f26895032c49e780c9176113ed9517,488,1,0xd32abb10c0a8fb6147152542088e0fce4aeb7f4f,9041,0x86bdb768bbfe8de39c658346db93bb952cd9e526,0x96b9042d68be24547e334c816690c8d0065d70b0,23000000000000000,,115000000000000 -ethereum,opensea,v4,2023-03-04,0xffc51c85163e2a024c3fe784d3321552e94cf5c6e5fed97bef8080c5d9851b5b,107,1,0xe2e27b49e405f6c25796167b2500c195f972ebac,3780,0x9db0a2ce0d7e643950a3bd51e02fdc7eaf640234,0x6922406d81bb47c3dac75122929eb2c537eb878a,239900000000000000,,1199500000000000 -ethereum,opensea,v4,2023-03-04,0xff762b16ae398dc89a68e48726e129d9e7cc16dbd0a726126f9db044f7c905ce,402,1,0x7de3e2f540cf5c3065de34ac16a39deb08fcdcf3,2774,0x167ade962cb60346d2525e6a724b3c8e52e73c34,0x9ad35828f52866370938d4db1601e9b7bb23ef1c,15000000000000000,,999000000000000 -ethereum,opensea,v4,2023-03-04,0xffb6664a935384a81aa04c4772a3fa6a2e553bcc985ec1a3a73942bf9961f135,296,1,0xe70659b717112ac4e14284d0db2f5d5703df8e43,2,0xa817b9bd1ece360e4a1692894a5ad1d40b889f20,0x9d8945e2c08751ce18bab505a57073c8de16cd11,208024000000000000,,1040120000000000 -ethereum,opensea,v4,2023-03-23,0x82691542b8a1ded1c293fb3cccaf0975cdef43e9add82c7ceb8c063cc2cd2602,430,1,0xea917326e8a95299c02655fe947962c43a11487f,3625,0x45c2188ec89cce1f0d08b41ffe6c7efb7e72479f,0x7dc6b875d1ebd51bb1871f826e286e9ad8a0371b,20000000000000000,,100000000000000 -ethereum,opensea,v4,2023-03-23,0xdb4b4534714949ae70ec134efefefa6a484533ced2bab7827109c93cde9de2c6,293,1,0xb0ceae21d27efbd4569626f49e5316bf89e78c38,413,0x55360022eb99dc1f2fda1fcdbabbfb2f5382f0f2,0x18c43569593a10c124fb738c00c33b75748b971e,2000000000000000,10000000000000,50000000000000 -ethereum,opensea,v4,2023-03-23,0xdb4b4534714949ae70ec134efefefa6a484533ced2bab7827109c93cde9de2c6,294,1,0xb0ceae21d27efbd4569626f49e5316bf89e78c38,537,0x55360022eb99dc1f2fda1fcdbabbfb2f5382f0f2,0x2c0bd965de00a507f4625ceb43c36adce38a9739,2500000000000000,12500000000000,62500000000000 -ethereum,opensea,v4,2023-03-23,0xe248d2eedf3ced8daf1cc2c693c4704273a8fadc74567f70689df2153d3bbe5d,138,1,0x05327e6e27f251d2f2cfdbc37b9f289cf9f21529,8667,0xb199a4fffcb8219025f2b9492a37a7bdb89e0b00,0xe02cfc16c8e64548bbcf955c6fa85635e97f4c14,20000000000000000,100000000000000,1000000000000000 -ethereum,opensea,v4,2023-03-23,0x5d2a6f5a89e7dd554f6904c5e5c9119cf7d96c1bf9c1bf04d8cb9cba8cd72284,252,1,0xbe84a4f409e5b8932cd13f89c4c34f6c43308855,350,0x7e1876cd27d2c9e6aa2f49610330b9e25d690380,0x622ff61c8eee4cdc46b814d31903fe34c09abfbf,65000000000000000,325000000000000,4875000000000000 -ethereum,opensea,v4,2023-03-23,0xf54b4b2e6ecfdf90919987cf9d7defa20458487874b64e8a97b6ae8af83b58ad,294,1,0x99a9b7c1116f9ceeb1652de04d5969cce509b069,417000217,0x12bd6121197848f93f40bd82d4c80db4e3198990,0xdbcc6698d4686ee3fba49c2245072460594efe6e,156000000000000000,780000000000000,780000000000000 -ethereum,opensea,v4,2023-03-23,0x469560b0766af11237275669d6e06d207ea0754edad8a57396ee6168a4a01f67,228,1,0x16039f39bfac528c81148f905ce1cc3d21318b0f,3492,0x571909d4c525d898814b40652a0643b8f0ad0302,0x44725f3c536fe700d5a501051f99abb4a220ceb6,3900000000000000,19500000000000,195000000000000 -ethereum,opensea,v4,2023-03-06,0xc6e22aaed867405c19003a12a16c4876dc498c5ba3d08eb3fc86b3569521d121,308,1,0xde4e5d593e527e425d154dfc504562c48c6ac5b7,959,0xd0df1aa764f1650184ffd549648dd84964ba0097,0x981ae75f1dafb46460099e3b696df20daadc105b,16250000000000000,81250000000000,1121250000000000 -ethereum,opensea,v4,2023-03-06,0xc6e22aaed867405c19003a12a16c4876dc498c5ba3d08eb3fc86b3569521d121,308,2,0xde4e5d593e527e425d154dfc504562c48c6ac5b7,950,0xd0df1aa764f1650184ffd549648dd84964ba0097,0x981ae75f1dafb46460099e3b696df20daadc105b,16250000000000000,81250000000000,1121250000000000 -ethereum,opensea,v4,2023-03-06,0xc6e22aaed867405c19003a12a16c4876dc498c5ba3d08eb3fc86b3569521d121,308,3,0xde4e5d593e527e425d154dfc504562c48c6ac5b7,468,0xd0df1aa764f1650184ffd549648dd84964ba0097,0x981ae75f1dafb46460099e3b696df20daadc105b,16250000000000000,81250000000000,1121250000000000 -ethereum,opensea,v4,2023-03-06,0xc6e22aaed867405c19003a12a16c4876dc498c5ba3d08eb3fc86b3569521d121,308,4,0xde4e5d593e527e425d154dfc504562c48c6ac5b7,559,0xd0df1aa764f1650184ffd549648dd84964ba0097,0x981ae75f1dafb46460099e3b696df20daadc105b,16250000000000000,81250000000000,1121250000000000 -ethereum,opensea,v4,2023-03-06,0xc6e22aaed867405c19003a12a16c4876dc498c5ba3d08eb3fc86b3569521d121,308,5,0xde4e5d593e527e425d154dfc504562c48c6ac5b7,560,0xd0df1aa764f1650184ffd549648dd84964ba0097,0x981ae75f1dafb46460099e3b696df20daadc105b,16250000000000000,81250000000000,1121250000000000 -ethereum,opensea,v4,2023-03-06,0xc6e22aaed867405c19003a12a16c4876dc498c5ba3d08eb3fc86b3569521d121,308,6,0xde4e5d593e527e425d154dfc504562c48c6ac5b7,561,0xd0df1aa764f1650184ffd549648dd84964ba0097,0x981ae75f1dafb46460099e3b696df20daadc105b,16250000000000000,81250000000000,1121250000000000 -ethereum,opensea,v4,2023-03-06,0xc6e22aaed867405c19003a12a16c4876dc498c5ba3d08eb3fc86b3569521d121,308,7,0xde4e5d593e527e425d154dfc504562c48c6ac5b7,621,0xd0df1aa764f1650184ffd549648dd84964ba0097,0x981ae75f1dafb46460099e3b696df20daadc105b,16250000000000000,81250000000000,1121250000000000 -ethereum,opensea,v4,2023-03-06,0xc6e22aaed867405c19003a12a16c4876dc498c5ba3d08eb3fc86b3569521d121,308,8,0xde4e5d593e527e425d154dfc504562c48c6ac5b7,701,0xd0df1aa764f1650184ffd549648dd84964ba0097,0x981ae75f1dafb46460099e3b696df20daadc105b,16250000000000000,81250000000000,1121250000000000 -ethereum,opensea,v4,2023-03-06,0x8078c8c442e2513e924188c2dcbf7e8a5b9e57eb41641a9466d9a7de7279b13e,295,1,0xd32abb10c0a8fb6147152542088e0fce4aeb7f4f,2438,0x9c2da765c7389d36dfb418f0381090685b5692e8,0x08a6d384f31f0da6ddd6e803278a278751ca3033,10800000000000000,,54000000000000 -ethereum,opensea,v4,2023-03-06,0x8078c8c442e2513e924188c2dcbf7e8a5b9e57eb41641a9466d9a7de7279b13e,298,1,0xd32abb10c0a8fb6147152542088e0fce4aeb7f4f,788,0x9c2da765c7389d36dfb418f0381090685b5692e8,0x2b39fed6cc2bad303afb4be17405b8a7bbefc128,10900000000000000,,817500000000000 -ethereum,opensea,v4,2023-03-06,0x8078c8c442e2513e924188c2dcbf7e8a5b9e57eb41641a9466d9a7de7279b13e,296,1,0xd32abb10c0a8fb6147152542088e0fce4aeb7f4f,7067,0x9c2da765c7389d36dfb418f0381090685b5692e8,0x2b39fed6cc2bad303afb4be17405b8a7bbefc128,10900000000000000,,817500000000000 -ethereum,opensea,v4,2023-03-06,0x8078c8c442e2513e924188c2dcbf7e8a5b9e57eb41641a9466d9a7de7279b13e,297,1,0xd32abb10c0a8fb6147152542088e0fce4aeb7f4f,7352,0x9c2da765c7389d36dfb418f0381090685b5692e8,0x2b39fed6cc2bad303afb4be17405b8a7bbefc128,10900000000000000,,817500000000000 -ethereum,opensea,v4,2023-03-06,0x3e8a1db5f2013453d9ad0f83c331f9400a0976f04dfad58cd17481afeaa5659a,456,1,0x0be697ce3f41508510ccf502c55c37990274f05e,836,0xc0c27d29ac68df3675ed3e5e24acc571e0dcc710,0x222a38410f47cb9741845eec4df7526f62d0e377,52010000000000000,,2600500000000000 -ethereum,opensea,v4,2023-03-06,0x598d86e99446aad58fdb06ee1ff8061b780e60eff1807fcbc781eff9c81041e2,96,1,0x0be697ce3f41508510ccf502c55c37990274f05e,1124,0xb45ec3d9fab5b77b2da5fba343c513f548af6ca9,0x9fe98adff9c37deb4433201203cb0852b8e49193,62900000000000000,,3145000000000000 -ethereum,opensea,v4,2023-03-06,0xfffcb51972d15d1e68e29a763d8e5810bda74d209e5c27cea456152e54caad42,3,1,0x34ba8992fbbec87fc9959ec4a360df3a8f957ccc,6193,0x71fe8f38d4ba5973def012752e13140414e335eb,0x2b3ccb55a404c0e99add7e3041f76883e22e5e72,33000000000000000,165000000000000,165000000000000 -ethereum,opensea,v4,2023-03-03,0xff66a1ff50cae31934cb41c31f08637d296f372e1cd104a551cd614556bd73c7,149,1,0xbd8451d2d5fb88469a764b05c1e0b623c5106145,25096,0x5603d121834371c219a12bca6c1f8afdcde40e97,0x4dac5aecc9b076432a7d575995b742d6cedbdbbc,54400000000000000,,1360000000000000 -ethereum,opensea,v4,2023-03-03,0xff66a1ff50cae31934cb41c31f08637d296f372e1cd104a551cd614556bd73c7,150,1,0xbd8451d2d5fb88469a764b05c1e0b623c5106145,19536,0x5603d121834371c219a12bca6c1f8afdcde40e97,0xacd29609f1df530c41ba9fdd897f7352e6798dba,53900000000000000,,1347500000000000 -ethereum,opensea,v4,2023-03-03,0xff66a1ff50cae31934cb41c31f08637d296f372e1cd104a551cd614556bd73c7,146,1,0xbd8451d2d5fb88469a764b05c1e0b623c5106145,27234,0x5603d121834371c219a12bca6c1f8afdcde40e97,0x4dac5aecc9b076432a7d575995b742d6cedbdbbc,54400000000000000,,1360000000000000 -ethereum,opensea,v4,2023-03-03,0xff66a1ff50cae31934cb41c31f08637d296f372e1cd104a551cd614556bd73c7,148,1,0xbd8451d2d5fb88469a764b05c1e0b623c5106145,25656,0x5603d121834371c219a12bca6c1f8afdcde40e97,0x22fdc055dc1878c77064b7e0274a885cf5fe672d,54000000000000000,,1350000000000000 -ethereum,opensea,v4,2023-03-03,0xff66a1ff50cae31934cb41c31f08637d296f372e1cd104a551cd614556bd73c7,147,1,0xbd8451d2d5fb88469a764b05c1e0b623c5106145,25289,0x5603d121834371c219a12bca6c1f8afdcde40e97,0x4dac5aecc9b076432a7d575995b742d6cedbdbbc,54400000000000000,,1360000000000000 -ethereum,opensea,v4,2023-04-27,0xfcb380ca3ebabdce3d7d15dda782eb54c4857f777313cce7b9499db55fc55f8a,732,1,0xfdba198c9214ebec12e2ef857877b52aec463d99,24,0x1108f964b384f1dcda03658b24310ccbc48e226f,0x4d41232b0d963afb52cd0354da5819b259f133bd,3000000000000000,75000000000000, -ethereum,opensea,v4,2023-04-27,0x4e21e35b92f34efa169b5d7fd3b559d5ec593559e9bc2089f5dc8c697f694898,199,1,0xbd115428dde5827eca3203e58a19f2f93169a6d2,3,0x4d41232b0d963afb52cd0354da5819b259f133bd,0x1108f964b384f1dcda03658b24310ccbc48e226f,3333000000000000,83325000000000, -ethereum,opensea,v4,2023-04-27,0x5ff5946bf1aa8a4ae88a38e73f0715d86f168f8f424af8ca3c7dd16b3caec031,258,1,0x1e196b7873b8456437309ba3fa748fa6f1602da8,18,0xfba662e1a8e91a350702cf3b87d0c2d2fb4ba57f,0xf0e16c071e2cd421974dcb76d9af4dedb578e059,2000000000000000,50000000000000,100000000000000 -ethereum,opensea,v4,2023-04-27,0xb2514d5067b1d12a636eac6cc9ad1659b9682263137fdce5f9d465695c08cf21,198,1,0x65cf197a0e3d851bc92fd9ea34d7582335cf5be8,21,0x4d41232b0d963afb52cd0354da5819b259f133bd,0x1108f964b384f1dcda03658b24310ccbc48e226f,2000000000000000,50000000000000,20000000000000 -ethereum,opensea,v4,2023-04-28,0x05bd45ee982cace6de04b51d299e34e88ebb9178d138fbd4d6bbbc11bc273c7d,584,1,0x399f0c34c0193674a29e290eef484da007ddef4e,18,0x1108f964b384f1dcda03658b24310ccbc48e226f,0x4d41232b0d963afb52cd0354da5819b259f133bd,3000000000000000,75000000000000, -ethereum,opensea,v4,2023-04-27,0xe96bd02f7e8c8e195df4357ea135dd2aa4ca4233e2a665f875119fcba0f5a265,176,1,0xbd115428dde5827eca3203e58a19f2f93169a6d2,3,0x1108f964b384f1dcda03658b24310ccbc48e226f,0x4d41232b0d963afb52cd0354da5819b259f133bd,1200000000000000,30000000000000, -ethereum,opensea,v4,2023-03-22,0x761b5a640281d26e9043ae9981f326e1f79fb2f9660c0592ea9c7fee3f93d03f,140,1,0x3acce66cd37518a6d77d9ea3039e00b3a2955460,5170,0xb59614452e749b9ceb3659b5195d2aa87a368dc3,0x1b7665c81b213d21c58446ec455f10b57834ed74,240000000000000000,,1200000000000000 -ethereum,opensea,v4,2023-03-22,0x497dcf45b2a3de4b34b9116829e18a0372159eaf35b036640b08dfc20295d2a0,492,1,0x3acce66cd37518a6d77d9ea3039e00b3a2955460,3260,0xee21068efaf8e59eb28fec33cd97d1401e9ea177,0xa1658a3f0e08bb5c0ba758e4704788172f78df24,220410000000000000,,1102050000000000 -ethereum,opensea,v3,2022-10-19,0x2937240ba78b44f383b34ba4aaa1c4cec5621619a9fb00b47a52aa48764bc900,148,1,0xaac2662e23e5d442db49e1340aae0f4830ca29fa,9598,0x9066f8e640cb01c9680e6daae1c54a1fcf36161b,0x163f89fefe1a8e285d5846dc011967a48f2c84d4,24000000000000000,600000000000000,1200000000000000 -ethereum,opensea,v3,2022-10-19,0x97bc33974334397db4448752ee118705f68568330fe80e46698dfeb21cbea187,136,1,0xaf555c317608d4f9aebae2c97bb2984656f408df,3321,0xc469f1ea62f0720f224deedb99612921fa66ac6f,0xbdf21d265de05e617f1e557c6f8f54b602a49057,7000000000000000,175000000000000, -ethereum,opensea,v3,2022-10-19,0x246c1973832b25ca48ebc10ab87fd9a7a50eabda2e938a4e5ba1836c1adaab82,377,1,0xaf555c317608d4f9aebae2c97bb2984656f408df,5774,0x7decf7a31168778f311c57b9a948abaa7321001e,0xecc424c1ffb22ba13d84669f15107f53809b0ee3,99000000000000000,2475000000000000, -ethereum,opensea,v3,2022-10-19,0xd852750d986b4a97840ab14c29aeccf0b7f9dc353ce4eab1ee1fd2dcf5ad4742,104,1,0x556697ca91476b811f37a851dd2e53ae4c6024db,372,0x29eae4b2b54900f06a11a9943ac2415ba2f97fd2,0x2cfee54d8c83a61312a914015405066f9ac03f0b,11750000000000000,293750000000000,411250000000000 -ethereum,opensea,v3,2022-10-19,0xfb595b148b3d9719fa4d9325aef3e7ad75b6b9415f6809620e19195b45b9fe39,228,1,0x49adcc97404c197190a5866885018c558006974a,7045,0x088e0eb015b4515d4ead6c117c8005807a5b57fc,0xf8c5e7821bf049457ed78fbec9f915c35f118480,70000000000000000,1750000000000000,5250000000000000 -ethereum,opensea,v3,2022-10-19,0xd53550c8c02d58cc54719ec0585ba7685627dab032825b7cad503bb9c92adcf5,90,1,0x49adcc97404c197190a5866885018c558006974a,7934,0xe183ed7befd6128074b16f1a14916f281177e589,0x7662c68b7077177e32726b9f07a8cf060d876882,75000000000000000,1875000000000000,5625000000000000 -ethereum,opensea,v3,2022-10-19,0xd53550c8c02d58cc54719ec0585ba7685627dab032825b7cad503bb9c92adcf5,91,1,0x49adcc97404c197190a5866885018c558006974a,2551,0xe183ed7befd6128074b16f1a14916f281177e589,0x34e185255b129fce935ed264dc4bc166f8644dcb,100000000000000000,2500000000000000,7500000000000000 -ethereum,opensea,v3,2022-10-19,0xbb5ad9b55a28638b77ec895f36b5db418764cec397e3cc6e45e6e18b0c8325b0,567,1,0x40948a124b632a900a58ad01e2ef0534b97a1087,465,0xd6e3a9a7c6162c50596f12cfa322043a774cfbae,0x6a8dff311672955e67c69becef660d3a41dd7060,1630000000000000000,40750000000000000,81500000000000000 -ethereum,opensea,v3,2022-10-19,0xce3bd853b0f39c165902da9bd03cd877e0faa4d635887beec00407ceebfcfdae,90,1,0x34d85c9cdeb23fa97cb08333b511ac86e1c4e258,94783,0x537038d516e7e71bff78a555799ce0daa01e79a1,0xc0ac56cf556b41da25354cc0199200bf36f79ccc,1500000000000000000,37500000000000000,75000000000000000 -ethereum,opensea,v3,2022-10-19,0x427919428b28af6cff2a6d92c3905574f63fc6f4b5051e3610dd76837287b9b0,128,1,0x2cc8342d7c8bff5a213eb2cde39de9a59b3461a7,32372,0x36c72892fcc72b52fa3b82ed3bb2a467d9079b9a,0xa210712d5cd1926b631fb32a80ee5eeeb054549c,343000000000000000,8575000000000000,8575000000000000 -ethereum,opensea,v3,2022-10-19,0xf02823f1c5cc314f115e0f0fdefaa76ce49740bf345da23820698ec29714888a,250,1,0x8dc7b6ec6fafa36085ee9ec8e39112428d3360aa,1463,0xf3c9c543666d1ba0f232682cd74dfc5b6bad8264,0xa6fdc48f931bc417f56efb3731b8cb4e20295160,99500000000000000,2487500000000000,4975000000000000 -ethereum,opensea,v3,2022-10-19,0xfc1fafa9eb9e551cecef0921c79017d553c07d107e835e1c5af9b974eac7bd1a,313,1,0x6fb5d24447a668963315d7a614b1710458ef6bb5,543,0xac5b158854158ea0de15b6a17d77fd612671b54e,0x72cffe3aea6ffa7c9e4e064e7f7859fbf8a468a9,6000000000000000,150000000000000,300000000000000 -ethereum,opensea,v3,2022-10-19,0xfc1fafa9eb9e551cecef0921c79017d553c07d107e835e1c5af9b974eac7bd1a,314,1,0x6fb5d24447a668963315d7a614b1710458ef6bb5,539,0xac5b158854158ea0de15b6a17d77fd612671b54e,0x72cffe3aea6ffa7c9e4e064e7f7859fbf8a468a9,7000000000000000,175000000000000,350000000000000 -ethereum,opensea,v3,2022-10-19,0x60b2f50edff701c89cc2eb1c65f258d1b8769e1389c218f8da76ca2852c67fd6,177,1,0x6fb5d24447a668963315d7a614b1710458ef6bb5,2630,0x4d939c565b03cc47d2bf5a037acfb3ab8b2a606c,0x57a099bbf0932c730f78252918be5ff44d799107,7900000000000000,197500000000000,395000000000000 -ethereum,opensea,v3,2022-10-19,0xb876e5fbf63f7936bded916756bf72d4419ca133521bf2ecb8960fe5e7d1a2a8,66,1,0x6fb5d24447a668963315d7a614b1710458ef6bb5,700,0x88e89eb7284fd5196deec1fe1fb19f1510b4125a,0xefe9064485f23886ec2c07579f7c68351c7afa60,8000000000000000,200000000000000,400000000000000 -ethereum,opensea,v4,2024-03-23,0xc2ccf706eb6880e8f06e116458c9ea69dc27b02462cd8827201161cca0a1dd68,1357,1,0x1e196b7873b8456437309ba3fa748fa6f1602da8,24,0xf0e16c071e2cd421974dcb76d9af4dedb578e059,0xfba662e1a8e91a350702cf3b87d0c2d2fb4ba57f,1000000000000000,25000000000000,53000000000000 diff --git a/seeds/opensea/ethereum/schema.yml b/seeds/opensea/ethereum/schema.yml index 5ce485f8b98..a128a84edd6 100644 --- a/seeds/opensea/ethereum/schema.yml +++ b/seeds/opensea/ethereum/schema.yml @@ -12,16 +12,3 @@ seeds: nft_contract_address: varbinary platform_fee_amount_raw: uint256 royalty_fee_amount_raw: uint256 - - - name: opensea_ethereum_seaport_trades_samples - config: - column_types: - token_id: uint256 - tx_hash: varbinary - buyer: varbinary - seller: varbinary - nft_contract_address: varbinary - amount_raw: uint256 - platform_fee_amount_raw: uint256 - royalty_fee_amount_raw: uint256 - diff --git a/seeds/opensea/opensea_seaport_trades_samples.csv b/seeds/opensea/opensea_seaport_trades_samples.csv new file mode 100644 index 00000000000..737aae2b53b --- /dev/null +++ b/seeds/opensea/opensea_seaport_trades_samples.csv @@ -0,0 +1,229 @@ +blockchain,project,project_version,block_number,tx_hash,sub_tx_trade_id,nft_contract_address,nft_token_id,buyer,seller,price_raw,platform_fee_amount_raw,royalty_fee_amount_raw +arbitrum,opensea,v3,26127290,0x3a636652ebf24620ffb8ff9fe1d1252c40e833a9d074574a08bac51879f5c8c3,1,0x642ffab2752df3bce97083709f36080fb1482c80,4575,0x940459a510b2f4ad950795d4a47941391628bf0d,0x537789a5cd977c0161a36c73b8154f313ce86028,17500000000000000,437500000000000, +arbitrum,opensea,v3,26141551,0x59fe0f30fc5eb3d9ca268f15381151010e3fbf0ec2dd7c6e8f08318ca22186ac,1,0xb07b371bf4f4634cf816051d2ee741164d4203fc,59058,0xaf21854d58550db12aad2b8e9dd3a08414edd120,0x412dd131438d86c088bde31b6feb5616e3dd0566,150000000000000,3750000000000, +arbitrum,opensea,v3,26157833,0x16eab415701d1bb5ef66396ee676ff9a10ca112fced41195333aa23a6d613e65,1,0x642ffab2752df3bce97083709f36080fb1482c80,32796,0xae0edff62177152d8fea78c57b022e513f86a5c2,0xf54dc01a59c5333617d03aef49aa1d2357c5f68a,21000000000000000,525000000000000, +arbitrum,opensea,v3,26167624,0x409fed8268db78513d0b329368c640dd879ad7219bce304646936708b36db773,1,0x642ffab2752df3bce97083709f36080fb1482c80,33572,0xc1ac3133e13355f6e41807da6b5d5dfae77f60f9,0x61e6f8812198e172a6104f8c956e4b58859bfab8,13300000000000000,332500000000000, +arbitrum,opensea,v3,26189502,0x905b9b8bb024051a48e0592e588761744ed4b87c3cd348862b5505495fec759a,1,0x55df058c5934ba3f1ffcf6c726e75659009f0983,1701,0xc1ac3133e13355f6e41807da6b5d5dfae77f60f9,0x508f159b415dd59eccf9e738f67e8c854d475c0e,2999900000000000,74997500000000,99896670000000 +arbitrum,opensea,v3,26255912,0x6d1c85d0b2e5992f7771dcc33455f37db889fba76988480d9e7819f186ab5e06,1,0x2a4730b0bd1bb9e06f365c15403fa264119d9a51,6364,0xaa312eb19552f924dfc47bfefe47f35a902fc595,0x5fa98b2545710bc4bd0e0ac57b8efd8d3c50ceab,990000000000000,24750000000000,99000000000000 +arbitrum,opensea,v3,26261165,0x1869f5e27e81654fb218c087417a0ad68c3ea302742c5af833e692f7d3f6659e,1,0x9fd5b98251becfbf66bead6035fd5c95afdb8bb1,193,0xf1ea4eaea0f6b0a12a4795b5e857ecda6dae21c6,0xe981e2a9a49c82a22fe5e44e58c8523c8d622792,100000000000000,2500000000000, +arbitrum,opensea,v3,26263130,0xa9a5c08da80e1b450bfd7cb56fafc178c36fd7280c6a9d9159508429565ed2ef,1,0xb07b371bf4f4634cf816051d2ee741164d4203fc,31080,0x012db66110d211e5aa15171b15265384f22fd1de,0x9ec3161bd0eb90225129b1376a269023b4bc4665,150000000000000,3750000000000, +arbitrum,opensea,v3,26263204,0x7701e95fd7b0bce93b374507bd3d10d4033ef64724161f34baf4505c3dd7b756,1,0xe00cc435fff6331963bfc2d984009be524c282c8,411,0x97dbf4d74fccca9767d9243a1380adfc000c3638,0x8431eb65dedc382b9aae759dc0488cc12a29f9cb,40000000000000,1000000000000, +arbitrum,opensea,v3,26275948,0x2ad4fd12398f49047d4a33ca5e55e3808c56e504d2b4ae2d1cab4071ec404331,1,0xe00cc435fff6331963bfc2d984009be524c282c8,49,0xd19fd69bfdc2651272c523df8408738bc1f93104,0xe981e2a9a49c82a22fe5e44e58c8523c8d622792,40000000000000,1000000000000, +arbitrum,opensea,v3,26275974,0x08553b9bcb1f8ba7b0b2e47c6a09f737f4b32fbe6c47d2546232f359f7b2845b,1,0xe00cc435fff6331963bfc2d984009be524c282c8,48,0x9421a58872b8e4bf6287b26295f64719f5283b89,0xe981e2a9a49c82a22fe5e44e58c8523c8d622792,40000000000000,1000000000000, +arbitrum,opensea,v3,26278982,0xd6eeb93fb6d317cc189dd19891db352d292d02080af505d9a455995201894f27,1,0xe00cc435fff6331963bfc2d984009be524c282c8,480,0x3ce8ce4a5ee7d6ef768df4ad35bf245e0d0314db,0xe981e2a9a49c82a22fe5e44e58c8523c8d622792,40000000000000,1000000000000, +arbitrum,opensea,v4,70262555,0xbce61db764fc9318153f15c279a19c6011365f502fcdbf6c3ea91ec94c6f4d9d,1,0x3ecc587ef402b5e00a9767d6f9670b463de2e177,4294967298,0xf7cb0b1bffa994c71811a72d777e94ed480105a2,0x7e335a2f5c91debac9e5af002dc17c5c747c017e,146000000000000000,,7300000000000000 +arbitrum,opensea,v4,70282038,0x36b46f8f6c96080fcaabc586e9038037f748e97532971cc0e7a6b54846007f7d,1,0xfae39ec09730ca0f14262a636d2d7c5539353752,210105,0x7ad28ffa81c91c758ba48f26270c8df5b76f6198,0xa6d599a1c10d5517c97edf46857deb5795dd1576,14700000000000000,73500000000000, +arbitrum,opensea,v4,70292814,0xd49e4f614d5e253fb3d8efc14d449791d896ec6154a0aed79564c9b44b7ff977,1,0x0b6f1ea63e959bffe87eaf56a4ac7b9fddfb6abf,32393,0x4ddc9139099209e8437a33652e5203f2fd092c68,0xa3f9a6da1c45a54a0d5acd4edad705ac94d8a4e6,700000000000000,3500000000000,21000000000000 +arbitrum,opensea,v4,70315456,0x0bfef583027f29d2f316120902600de7f2b1e9235d6df3a97b80cbb43fe07c83,1,0x652d66fe218a7c33808b7d6a7db6a54e2f9f4a51,989,0xad2365dff389fc05db964e36d3bb80baf755d016,0x80c69f62ff8258f58c56a587fb02a03d59a50e39,4900000000000000,24500000000000,245000000000000 +arbitrum,opensea,v4,70315553,0xf7484562aab1a1cf0478db3e96d8911bb9991f38f72d5940eaf964edc582d896,1,0x10c67db7876306fd4dc246184611625a77c7440c,9620,0x0452ae1f57b02f390b603a60f21608758689727d,0xf2ecaaf3af6c21144d2ebacc855d84fad6b1595f,1200000000000000,6000000000000,60000000000000 +arbitrum,opensea,v4,70519690,0x577f53e8d058d16683f83a6452c847b1ac377d789a11d63359b7d06ef8b0559e,1,0xfae39ec09730ca0f14262a636d2d7c5539353752,322474,0xb3a0b9f56cb12328b1143cf969d40e01c3730c6a,0xc9879d3cfc7d71a90d39230e058d287c438c81c9,4100000000000000,20500000000000, +arbitrum,opensea,v4,70519775,0x37691a2fe0b3d9c078023cefe9158690790d9e9a7f76359f0efd45a73fae1a20,1,0xfae39ec09730ca0f14262a636d2d7c5539353752,272813,0x383c1e458b1885e2e16a7bd2b13abd46b447da3b,0x0f476f28479a24e7a1917123be0b5434095849c6,4300000000000000,21500000000000, +arbitrum,opensea,v4,70519823,0x583b92e180038ada4fa1cb2ed6bd172d6d7d32a1c799b0bd3949995b48d4a570,1,0xfae39ec09730ca0f14262a636d2d7c5539353752,405228,0x96e1877e833a3297326178625028eab7fd57ff71,0xeb4f3dec696f3234d2347ecdf41b7d6a969641bf,4200000000000000,21000000000000, +arbitrum,opensea,v4,70531352,0x29c10ea00299d8e128a640c16cc51cef37a6ac87ceb37dda16d5cb96b54eb7ed,1,0xfae39ec09730ca0f14262a636d2d7c5539353752,275625,0x9219630ff1f382429ba29abbf6754d26e1e9aac7,0x2d5d8eb41abc1fc50dccc36c5029ea46e5301b59,4100000000000000,20500000000000, +arbitrum,opensea,v4,70531501,0xb22a6a71e58770100c4ed749c38373a2368d46334f962d8a34eb6ad7c5c84141,1,0xfae39ec09730ca0f14262a636d2d7c5539353752,405650,0xe3eb37be2f3f363562ad04eeba9b9ce67722cb81,0xbcf0b928fd4b3906ec18f227f9d46e539c0b2173,4200000000000000,21000000000000, +arbitrum,opensea,v4,70562200,0xa20a5f38f4c5c9cb5b3902f0c8adea697df5a1c078480cd925b47d37a4c15c40,1,0xfae39ec09730ca0f14262a636d2d7c5539353752,26139,0x9178deac61d49d30f5b49b1fb687312bbf9d960b,0xaa6c7b556449e1d5a75b6322a256180edd1c8edc,5200000000000000,26000000000000, +arbitrum,opensea,v4,70562200,0xa20a5f38f4c5c9cb5b3902f0c8adea697df5a1c078480cd925b47d37a4c15c40,2,0xfae39ec09730ca0f14262a636d2d7c5539353752,214352,0x9178deac61d49d30f5b49b1fb687312bbf9d960b,0xb1d65729bd421a15c12880c62113445f602bc7ff,5400000000000000,27000000000000, +arbitrum,opensea,v4,70562200,0xa20a5f38f4c5c9cb5b3902f0c8adea697df5a1c078480cd925b47d37a4c15c40,3,0xfae39ec09730ca0f14262a636d2d7c5539353752,263656,0x9178deac61d49d30f5b49b1fb687312bbf9d960b,0x3a33e605008433f1eda7bd5c65befa9fccd8c344,5500000000000000,27500000000000, +arbitrum,opensea,v4,70562200,0xa20a5f38f4c5c9cb5b3902f0c8adea697df5a1c078480cd925b47d37a4c15c40,4,0xfae39ec09730ca0f14262a636d2d7c5539353752,372894,0x9178deac61d49d30f5b49b1fb687312bbf9d960b,0x7b6d789390e979eef34737e242a8ba8c93a6666c,5800000000000000,29000000000000, +arbitrum,opensea,v4,70562200,0xa20a5f38f4c5c9cb5b3902f0c8adea697df5a1c078480cd925b47d37a4c15c40,5,0xfae39ec09730ca0f14262a636d2d7c5539353752,218668,0x9178deac61d49d30f5b49b1fb687312bbf9d960b,0x4773b2577e2166ee3f7e21381f4ecf6a7535fbb1,5900000000000000,29500000000000, +arbitrum,opensea,v4,70562200,0xa20a5f38f4c5c9cb5b3902f0c8adea697df5a1c078480cd925b47d37a4c15c40,6,0xfae39ec09730ca0f14262a636d2d7c5539353752,14261,0x9178deac61d49d30f5b49b1fb687312bbf9d960b,0xadb1dcabfcdd8e60457e4c856214f471cd41b178,6400000000000000,32000000000000, +avalanche_c,opensea,v3,24864615,0xafce6894c0ad66c8518565f571a3ba286de4f56881fc78aa5f6cee41e5abd4e0,1,0x825189515d0a7756436f0efb6e4be5a5af87e21d,11372,0x1728d41d4016a351f6a8d38c1fdd7d40763e9f7d,0x26663df4bdb9983466fc83cdf527c973f92428e7,250000000000000000,6250000000000000,17500000000000000 +avalanche_c,opensea,v3,24875286,0x90e30aff4a29237a08414ecb5f1db5a4620ed689f8a2da8109ad3d996cfa200a,1,0x7325e3564b89968d102b3261189ea44c0f5f1a8e,102370,0xb16c1f3b2e71f80260ad8ffd7706850d6ff38995,0xb5d36382dd9771865d9a70c138522dc681d3ab25,1330000000000000000,33250000000000000,93100000000000000 +avalanche_c,opensea,v4,43935249,0xa87e9f72956505d11ae4ebb48a78c003e99b99c5c24ed1683a9c9dc9bc24ccab,1,0x9d5d18864d7776a61220c287258e06db7cdcf444,559,0xe4461b21b6639c729b0d86e4c60697a9ae38199b,0x3fd1cdaab0628ad69558524aae377abc32988fd7,79700000000000000,1992500000000000, +avalanche_c,opensea,v4,44028690,0x1ecb0c73521e7be760f7fc22f77fe1bc7167f9c945b276c3d3db2623bd24e25e,1,0x2837359114c5c265e7d2f7c599828da74e34485e,373,0xec8541d68a2f66690c2b45e8908fde7e3b3e1bce,0xfc791c6847dd23e1cc980e3e57b50b14485b5ec4,1350000000000000000,33750000000000000, +ethereum,opensea,v3,15785042,0xfc1fafa9eb9e551cecef0921c79017d553c07d107e835e1c5af9b974eac7bd1a,1,0x6fb5d24447a668963315d7a614b1710458ef6bb5,543,0xac5b158854158ea0de15b6a17d77fd612671b54e,0x72cffe3aea6ffa7c9e4e064e7f7859fbf8a468a9,6000000000000000,150000000000000,300000000000000 +ethereum,opensea,v3,15785042,0xfc1fafa9eb9e551cecef0921c79017d553c07d107e835e1c5af9b974eac7bd1a,2,0x6fb5d24447a668963315d7a614b1710458ef6bb5,539,0xac5b158854158ea0de15b6a17d77fd612671b54e,0x72cffe3aea6ffa7c9e4e064e7f7859fbf8a468a9,7000000000000000,175000000000000,350000000000000 +ethereum,opensea,v3,15785043,0xd53550c8c02d58cc54719ec0585ba7685627dab032825b7cad503bb9c92adcf5,1,0x49adcc97404c197190a5866885018c558006974a,7934,0xe183ed7befd6128074b16f1a14916f281177e589,0x7662c68b7077177e32726b9f07a8cf060d876882,75000000000000000,1875000000000000,5625000000000000 +ethereum,opensea,v3,15785043,0x2937240ba78b44f383b34ba4aaa1c4cec5621619a9fb00b47a52aa48764bc900,1,0xaac2662e23e5d442db49e1340aae0f4830ca29fa,9598,0x9066f8e640cb01c9680e6daae1c54a1fcf36161b,0x163f89fefe1a8e285d5846dc011967a48f2c84d4,24000000000000000,600000000000000,1200000000000000 +ethereum,opensea,v3,15785043,0xb876e5fbf63f7936bded916756bf72d4419ca133521bf2ecb8960fe5e7d1a2a8,1,0x6fb5d24447a668963315d7a614b1710458ef6bb5,2432,0x88e89eb7284fd5196deec1fe1fb19f1510b4125a,0xb39a6b4cb933aab3c30da765acf26c4c00a4bf11,8000000000000000,200000000000000,400000000000000 +ethereum,opensea,v3,15785043,0x97bc33974334397db4448752ee118705f68568330fe80e46698dfeb21cbea187,1,0xaf555c317608d4f9aebae2c97bb2984656f408df,3321,0xc469f1ea62f0720f224deedb99612921fa66ac6f,0xbdf21d265de05e617f1e557c6f8f54b602a49057,7000000000000000,175000000000000, +ethereum,opensea,v3,15785043,0xd53550c8c02d58cc54719ec0585ba7685627dab032825b7cad503bb9c92adcf5,2,0x49adcc97404c197190a5866885018c558006974a,2551,0xe183ed7befd6128074b16f1a14916f281177e589,0x34e185255b129fce935ed264dc4bc166f8644dcb,100000000000000000,2500000000000000,7500000000000000 +ethereum,opensea,v3,15785043,0xb876e5fbf63f7936bded916756bf72d4419ca133521bf2ecb8960fe5e7d1a2a8,2,0x6fb5d24447a668963315d7a614b1710458ef6bb5,700,0x88e89eb7284fd5196deec1fe1fb19f1510b4125a,0xefe9064485f23886ec2c07579f7c68351c7afa60,8000000000000000,200000000000000,400000000000000 +ethereum,opensea,v3,15785044,0xbb5ad9b55a28638b77ec895f36b5db418764cec397e3cc6e45e6e18b0c8325b0,1,0x40948a124b632a900a58ad01e2ef0534b97a1087,465,0xd6e3a9a7c6162c50596f12cfa322043a774cfbae,0x6a8dff311672955e67c69becef660d3a41dd7060,1630000000000000000,40750000000000000,81500000000000000 +ethereum,opensea,v3,15785044,0x246c1973832b25ca48ebc10ab87fd9a7a50eabda2e938a4e5ba1836c1adaab82,1,0xaf555c317608d4f9aebae2c97bb2984656f408df,5774,0x7decf7a31168778f311c57b9a948abaa7321001e,0xecc424c1ffb22ba13d84669f15107f53809b0ee3,99000000000000000,2475000000000000, +ethereum,opensea,v3,15785044,0xfb595b148b3d9719fa4d9325aef3e7ad75b6b9415f6809620e19195b45b9fe39,1,0x5008c2a3af41024e9f0bd0432df4f75828602598,5185,0x088e0eb015b4515d4ead6c117c8005807a5b57fc,0x1fbd95baaddedc81b3264c04e796d205ac3baa8f,27899000000000000,697475000000000,1394950000000000 +ethereum,opensea,v3,15785044,0xfb595b148b3d9719fa4d9325aef3e7ad75b6b9415f6809620e19195b45b9fe39,2,0x49adcc97404c197190a5866885018c558006974a,7045,0x088e0eb015b4515d4ead6c117c8005807a5b57fc,0xf8c5e7821bf049457ed78fbec9f915c35f118480,70000000000000000,1750000000000000,5250000000000000 +ethereum,opensea,v3,15785044,0xfb595b148b3d9719fa4d9325aef3e7ad75b6b9415f6809620e19195b45b9fe39,3,0x5008c2a3af41024e9f0bd0432df4f75828602598,2139,0x088e0eb015b4515d4ead6c117c8005807a5b57fc,0xba3c5da153d468a61370f93492c3d6b208324531,27900000000000000,697500000000000,1395000000000000 +ethereum,opensea,v3,15785045,0xf02823f1c5cc314f115e0f0fdefaa76ce49740bf345da23820698ec29714888a,1,0x8dc7b6ec6fafa36085ee9ec8e39112428d3360aa,1463,0xf3c9c543666d1ba0f232682cd74dfc5b6bad8264,0xa6fdc48f931bc417f56efb3731b8cb4e20295160,99500000000000000,2487500000000000,4975000000000000 +ethereum,opensea,v3,15785045,0xd852750d986b4a97840ab14c29aeccf0b7f9dc353ce4eab1ee1fd2dcf5ad4742,1,0x556697ca91476b811f37a851dd2e53ae4c6024db,372,0x29eae4b2b54900f06a11a9943ac2415ba2f97fd2,0x2cfee54d8c83a61312a914015405066f9ac03f0b,11750000000000000,293750000000000,411250000000000 +ethereum,opensea,v3,15785045,0x427919428b28af6cff2a6d92c3905574f63fc6f4b5051e3610dd76837287b9b0,1,0x2cc8342d7c8bff5a213eb2cde39de9a59b3461a7,32372,0x36c72892fcc72b52fa3b82ed3bb2a467d9079b9a,0xa210712d5cd1926b631fb32a80ee5eeeb054549c,343000000000000000,8575000000000000,8575000000000000 +ethereum,opensea,v3,15785045,0x60b2f50edff701c89cc2eb1c65f258d1b8769e1389c218f8da76ca2852c67fd6,1,0x6fb5d24447a668963315d7a614b1710458ef6bb5,2630,0x4d939c565b03cc47d2bf5a037acfb3ab8b2a606c,0x57a099bbf0932c730f78252918be5ff44d799107,7900000000000000,197500000000000,395000000000000 +ethereum,opensea,v3,15785045,0xce3bd853b0f39c165902da9bd03cd877e0faa4d635887beec00407ceebfcfdae,1,0x34d85c9cdeb23fa97cb08333b511ac86e1c4e258,94783,0x537038d516e7e71bff78a555799ce0daa01e79a1,0xc0ac56cf556b41da25354cc0199200bf36f79ccc,1500000000000000000,37500000000000000,75000000000000000 +ethereum,opensea,v4,16750740,0xff66a1ff50cae31934cb41c31f08637d296f372e1cd104a551cd614556bd73c7,1,0xbd8451d2d5fb88469a764b05c1e0b623c5106145,27234,0x5603d121834371c219a12bca6c1f8afdcde40e97,0x4dac5aecc9b076432a7d575995b742d6cedbdbbc,54400000000000000,,1360000000000000 +ethereum,opensea,v4,16750740,0xff66a1ff50cae31934cb41c31f08637d296f372e1cd104a551cd614556bd73c7,2,0xbd8451d2d5fb88469a764b05c1e0b623c5106145,25289,0x5603d121834371c219a12bca6c1f8afdcde40e97,0x4dac5aecc9b076432a7d575995b742d6cedbdbbc,54400000000000000,,1360000000000000 +ethereum,opensea,v4,16750740,0xff66a1ff50cae31934cb41c31f08637d296f372e1cd104a551cd614556bd73c7,3,0xbd8451d2d5fb88469a764b05c1e0b623c5106145,25656,0x5603d121834371c219a12bca6c1f8afdcde40e97,0x22fdc055dc1878c77064b7e0274a885cf5fe672d,54000000000000000,,1350000000000000 +ethereum,opensea,v4,16750740,0xff66a1ff50cae31934cb41c31f08637d296f372e1cd104a551cd614556bd73c7,4,0xbd8451d2d5fb88469a764b05c1e0b623c5106145,25096,0x5603d121834371c219a12bca6c1f8afdcde40e97,0x4dac5aecc9b076432a7d575995b742d6cedbdbbc,54400000000000000,,1360000000000000 +ethereum,opensea,v4,16750740,0xff66a1ff50cae31934cb41c31f08637d296f372e1cd104a551cd614556bd73c7,5,0xbd8451d2d5fb88469a764b05c1e0b623c5106145,19536,0x5603d121834371c219a12bca6c1f8afdcde40e97,0xacd29609f1df530c41ba9fdd897f7352e6798dba,53900000000000000,,1347500000000000 +ethereum,opensea,v4,16754094,0xff762b16ae398dc89a68e48726e129d9e7cc16dbd0a726126f9db044f7c905ce,1,0x7de3e2f540cf5c3065de34ac16a39deb08fcdcf3,2774,0x167ade962cb60346d2525e6a724b3c8e52e73c34,0x9ad35828f52866370938d4db1601e9b7bb23ef1c,15000000000000000,,999000000000000 +ethereum,opensea,v4,16757278,0xffb6664a935384a81aa04c4772a3fa6a2e553bcc985ec1a3a73942bf9961f135,1,0xe70659b717112ac4e14284d0db2f5d5703df8e43,2,0xa817b9bd1ece360e4a1692894a5ad1d40b889f20,0x9d8945e2c08751ce18bab505a57073c8de16cd11,208024000000000000,,1040120000000000 +ethereum,opensea,v4,16758043,0xffc51c85163e2a024c3fe784d3321552e94cf5c6e5fed97bef8080c5d9851b5b,1,0xe2e27b49e405f6c25796167b2500c195f972ebac,3780,0x9db0a2ce0d7e643950a3bd51e02fdc7eaf640234,0x6922406d81bb47c3dac75122929eb2c537eb878a,239900000000000000,,1199500000000000 +ethereum,opensea,v4,16762724,0xffa9e33956c304a314cf1ea8dd609755a9f26895032c49e780c9176113ed9517,1,0xd32abb10c0a8fb6147152542088e0fce4aeb7f4f,9041,0x86bdb768bbfe8de39c658346db93bb952cd9e526,0x96b9042d68be24547e334c816690c8d0065d70b0,23000000000000000,,115000000000000 +ethereum,opensea,v4,16764157,0xff5ed04bf03a8162c784a2c3ae8fec9a687b5c0857bd6c8abcdef9af1c6da211,1,0xd1466d7a2e13a47677608f68093c5ea9fe910611,24548,0xa2bd9bafe5dd685f8ca1a729d368be40496e6304,0x17ce24a23b708a6056d2b52ea4f59123e3ca5281,7000000000000000,,35000000000000 +ethereum,opensea,v4,16764157,0xff5ed04bf03a8162c784a2c3ae8fec9a687b5c0857bd6c8abcdef9af1c6da211,2,0xd1466d7a2e13a47677608f68093c5ea9fe910611,4144,0xa2bd9bafe5dd685f8ca1a729d368be40496e6304,0x7510396b6801c6a88c383baed7058dc553ab980e,7000000000000000,,35000000000000 +ethereum,opensea,v4,16765066,0xff0be907571ddf73d40de143a111f2cfaaec0fa57eedb8672f16f49711e31188,1,0x5f076e995290f3f9aea85fdd06d8fae118f2b75c,2463,0xcf1319531bee286e85c289b9747e159e742c0495,0x52b1180367d47f64a7de5535abe78c8e16f735ef,500000000000000000,,25000000000000000 +ethereum,opensea,v4,16767181,0xfffcb51972d15d1e68e29a763d8e5810bda74d209e5c27cea456152e54caad42,1,0x34ba8992fbbec87fc9959ec4a360df3a8f957ccc,6193,0x71fe8f38d4ba5973def012752e13140414e335eb,0x2b3ccb55a404c0e99add7e3041f76883e22e5e72,33000000000000000,165000000000000,165000000000000 +ethereum,opensea,v4,16768710,0xc6e22aaed867405c19003a12a16c4876dc498c5ba3d08eb3fc86b3569521d121,1,0xde4e5d593e527e425d154dfc504562c48c6ac5b7,701,0xd0df1aa764f1650184ffd549648dd84964ba0097,0x981ae75f1dafb46460099e3b696df20daadc105b,16250000000000000,81250000000000,1121250000000000 +ethereum,opensea,v4,16768710,0xc6e22aaed867405c19003a12a16c4876dc498c5ba3d08eb3fc86b3569521d121,2,0xde4e5d593e527e425d154dfc504562c48c6ac5b7,950,0xd0df1aa764f1650184ffd549648dd84964ba0097,0x981ae75f1dafb46460099e3b696df20daadc105b,16250000000000000,81250000000000,1121250000000000 +ethereum,opensea,v4,16768710,0xc6e22aaed867405c19003a12a16c4876dc498c5ba3d08eb3fc86b3569521d121,3,0xde4e5d593e527e425d154dfc504562c48c6ac5b7,468,0xd0df1aa764f1650184ffd549648dd84964ba0097,0x981ae75f1dafb46460099e3b696df20daadc105b,16250000000000000,81250000000000,1121250000000000 +ethereum,opensea,v4,16768710,0xc6e22aaed867405c19003a12a16c4876dc498c5ba3d08eb3fc86b3569521d121,4,0xde4e5d593e527e425d154dfc504562c48c6ac5b7,621,0xd0df1aa764f1650184ffd549648dd84964ba0097,0x981ae75f1dafb46460099e3b696df20daadc105b,16250000000000000,81250000000000,1121250000000000 +ethereum,opensea,v4,16768710,0xc6e22aaed867405c19003a12a16c4876dc498c5ba3d08eb3fc86b3569521d121,5,0xde4e5d593e527e425d154dfc504562c48c6ac5b7,561,0xd0df1aa764f1650184ffd549648dd84964ba0097,0x981ae75f1dafb46460099e3b696df20daadc105b,16250000000000000,81250000000000,1121250000000000 +ethereum,opensea,v4,16768710,0xc6e22aaed867405c19003a12a16c4876dc498c5ba3d08eb3fc86b3569521d121,6,0xde4e5d593e527e425d154dfc504562c48c6ac5b7,560,0xd0df1aa764f1650184ffd549648dd84964ba0097,0x981ae75f1dafb46460099e3b696df20daadc105b,16250000000000000,81250000000000,1121250000000000 +ethereum,opensea,v4,16768710,0xc6e22aaed867405c19003a12a16c4876dc498c5ba3d08eb3fc86b3569521d121,7,0xde4e5d593e527e425d154dfc504562c48c6ac5b7,559,0xd0df1aa764f1650184ffd549648dd84964ba0097,0x981ae75f1dafb46460099e3b696df20daadc105b,16250000000000000,81250000000000,1121250000000000 +ethereum,opensea,v4,16768710,0xc6e22aaed867405c19003a12a16c4876dc498c5ba3d08eb3fc86b3569521d121,8,0xde4e5d593e527e425d154dfc504562c48c6ac5b7,959,0xd0df1aa764f1650184ffd549648dd84964ba0097,0x981ae75f1dafb46460099e3b696df20daadc105b,16250000000000000,81250000000000,1121250000000000 +ethereum,opensea,v4,16768753,0x3e8a1db5f2013453d9ad0f83c331f9400a0976f04dfad58cd17481afeaa5659a,1,0x0be697ce3f41508510ccf502c55c37990274f05e,836,0xc0c27d29ac68df3675ed3e5e24acc571e0dcc710,0x222a38410f47cb9741845eec4df7526f62d0e377,52010000000000000,,2600500000000000 +ethereum,opensea,v4,16769167,0x598d86e99446aad58fdb06ee1ff8061b780e60eff1807fcbc781eff9c81041e2,1,0x0be697ce3f41508510ccf502c55c37990274f05e,1124,0xb45ec3d9fab5b77b2da5fba343c513f548af6ca9,0x9fe98adff9c37deb4433201203cb0852b8e49193,62900000000000000,,3145000000000000 +ethereum,opensea,v4,16769682,0x8078c8c442e2513e924188c2dcbf7e8a5b9e57eb41641a9466d9a7de7279b13e,1,0xd32abb10c0a8fb6147152542088e0fce4aeb7f4f,2438,0x9c2da765c7389d36dfb418f0381090685b5692e8,0x08a6d384f31f0da6ddd6e803278a278751ca3033,10800000000000000,,54000000000000 +ethereum,opensea,v4,16769682,0x8078c8c442e2513e924188c2dcbf7e8a5b9e57eb41641a9466d9a7de7279b13e,2,0xd32abb10c0a8fb6147152542088e0fce4aeb7f4f,7067,0x9c2da765c7389d36dfb418f0381090685b5692e8,0x2b39fed6cc2bad303afb4be17405b8a7bbefc128,10900000000000000,,817500000000000 +ethereum,opensea,v4,16769682,0x8078c8c442e2513e924188c2dcbf7e8a5b9e57eb41641a9466d9a7de7279b13e,3,0xd32abb10c0a8fb6147152542088e0fce4aeb7f4f,7352,0x9c2da765c7389d36dfb418f0381090685b5692e8,0x2b39fed6cc2bad303afb4be17405b8a7bbefc128,10900000000000000,,817500000000000 +ethereum,opensea,v4,16769682,0x8078c8c442e2513e924188c2dcbf7e8a5b9e57eb41641a9466d9a7de7279b13e,4,0xd32abb10c0a8fb6147152542088e0fce4aeb7f4f,788,0x9c2da765c7389d36dfb418f0381090685b5692e8,0x2b39fed6cc2bad303afb4be17405b8a7bbefc128,10900000000000000,,817500000000000 +ethereum,opensea,v4,16882382,0x761b5a640281d26e9043ae9981f326e1f79fb2f9660c0592ea9c7fee3f93d03f,1,0x3acce66cd37518a6d77d9ea3039e00b3a2955460,5170,0xb59614452e749b9ceb3659b5195d2aa87a368dc3,0x1b7665c81b213d21c58446ec455f10b57834ed74,240000000000000000,,1200000000000000 +ethereum,opensea,v4,16886415,0x497dcf45b2a3de4b34b9116829e18a0372159eaf35b036640b08dfc20295d2a0,1,0x3acce66cd37518a6d77d9ea3039e00b3a2955460,3260,0xee21068efaf8e59eb28fec33cd97d1401e9ea177,0xa1658a3f0e08bb5c0ba758e4704788172f78df24,220410000000000000,,1102050000000000 +ethereum,opensea,v4,16887809,0xe248d2eedf3ced8daf1cc2c693c4704273a8fadc74567f70689df2153d3bbe5d,1,0x05327e6e27f251d2f2cfdbc37b9f289cf9f21529,8667,0xb199a4fffcb8219025f2b9492a37a7bdb89e0b00,0xe02cfc16c8e64548bbcf955c6fa85635e97f4c14,20000000000000000,100000000000000,1000000000000000 +ethereum,opensea,v4,16888059,0x5d2a6f5a89e7dd554f6904c5e5c9119cf7d96c1bf9c1bf04d8cb9cba8cd72284,1,0xbe84a4f409e5b8932cd13f89c4c34f6c43308855,350,0x7e1876cd27d2c9e6aa2f49610330b9e25d690380,0x622ff61c8eee4cdc46b814d31903fe34c09abfbf,65000000000000000,325000000000000,4875000000000000 +ethereum,opensea,v4,16888077,0xf54b4b2e6ecfdf90919987cf9d7defa20458487874b64e8a97b6ae8af83b58ad,1,0x99a9b7c1116f9ceeb1652de04d5969cce509b069,417000217,0x12bd6121197848f93f40bd82d4c80db4e3198990,0xdbcc6698d4686ee3fba49c2245072460594efe6e,156000000000000000,780000000000000,780000000000000 +ethereum,opensea,v4,16888316,0xdb4b4534714949ae70ec134efefefa6a484533ced2bab7827109c93cde9de2c6,1,0xb0ceae21d27efbd4569626f49e5316bf89e78c38,347,0x55360022eb99dc1f2fda1fcdbabbfb2f5382f0f2,0x91fa0e794d37d12c94d8a1f636566ad98d084ec5,1000000000000000,5000000000000,25000000000000 +ethereum,opensea,v4,16888316,0xdb4b4534714949ae70ec134efefefa6a484533ced2bab7827109c93cde9de2c6,2,0xb0ceae21d27efbd4569626f49e5316bf89e78c38,413,0x55360022eb99dc1f2fda1fcdbabbfb2f5382f0f2,0x18c43569593a10c124fb738c00c33b75748b971e,2000000000000000,10000000000000,50000000000000 +ethereum,opensea,v4,16888316,0xdb4b4534714949ae70ec134efefefa6a484533ced2bab7827109c93cde9de2c6,3,0xb0ceae21d27efbd4569626f49e5316bf89e78c38,537,0x55360022eb99dc1f2fda1fcdbabbfb2f5382f0f2,0x2c0bd965de00a507f4625ceb43c36adce38a9739,2500000000000000,12500000000000,62500000000000 +ethereum,opensea,v4,16888387,0x469560b0766af11237275669d6e06d207ea0754edad8a57396ee6168a4a01f67,1,0x16039f39bfac528c81148f905ce1cc3d21318b0f,3492,0x571909d4c525d898814b40652a0643b8f0ad0302,0x44725f3c536fe700d5a501051f99abb4a220ceb6,3900000000000000,19500000000000,195000000000000 +ethereum,opensea,v4,16888387,0x469560b0766af11237275669d6e06d207ea0754edad8a57396ee6168a4a01f67,2,0x16039f39bfac528c81148f905ce1cc3d21318b0f,3789,0x571909d4c525d898814b40652a0643b8f0ad0302,0x687a990c2e81de7bd148f255c083328172289a8e,3200000000000000,16000000000000,160000000000000 +ethereum,opensea,v4,16888929,0x82691542b8a1ded1c293fb3cccaf0975cdef43e9add82c7ceb8c063cc2cd2602,1,0xea917326e8a95299c02655fe947962c43a11487f,3625,0x45c2188ec89cce1f0d08b41ffe6c7efb7e72479f,0x7dc6b875d1ebd51bb1871f826e286e9ad8a0371b,20000000000000000,,100000000000000 +ethereum,opensea,v4,17139947,0x5ff5946bf1aa8a4ae88a38e73f0715d86f168f8f424af8ca3c7dd16b3caec031,1,0x1e196b7873b8456437309ba3fa748fa6f1602da8,18,0xfba662e1a8e91a350702cf3b87d0c2d2fb4ba57f,0xf0e16c071e2cd421974dcb76d9af4dedb578e059,2000000000000000,50000000000000,100000000000000 +ethereum,opensea,v4,17139999,0x4e21e35b92f34efa169b5d7fd3b559d5ec593559e9bc2089f5dc8c697f694898,1,0xbd115428dde5827eca3203e58a19f2f93169a6d2,3,0x4d41232b0d963afb52cd0354da5819b259f133bd,0x1108f964b384f1dcda03658b24310ccbc48e226f,3333000000000000,83325000000000, +ethereum,opensea,v4,17140616,0xfcb380ca3ebabdce3d7d15dda782eb54c4857f777313cce7b9499db55fc55f8a,1,0xfdba198c9214ebec12e2ef857877b52aec463d99,24,0x1108f964b384f1dcda03658b24310ccbc48e226f,0x4d41232b0d963afb52cd0354da5819b259f133bd,3000000000000000,75000000000000, +ethereum,opensea,v4,17140654,0xe96bd02f7e8c8e195df4357ea135dd2aa4ca4233e2a665f875119fcba0f5a265,1,0xbd115428dde5827eca3203e58a19f2f93169a6d2,3,0x1108f964b384f1dcda03658b24310ccbc48e226f,0x4d41232b0d963afb52cd0354da5819b259f133bd,1200000000000000,30000000000000, +ethereum,opensea,v4,17140883,0xb2514d5067b1d12a636eac6cc9ad1659b9682263137fdce5f9d465695c08cf21,1,0x65cf197a0e3d851bc92fd9ea34d7582335cf5be8,21,0x4d41232b0d963afb52cd0354da5819b259f133bd,0x1108f964b384f1dcda03658b24310ccbc48e226f,2000000000000000,50000000000000,20000000000000 +ethereum,opensea,v4,17140957,0x05bd45ee982cace6de04b51d299e34e88ebb9178d138fbd4d6bbbc11bc273c7d,1,0x399f0c34c0193674a29e290eef484da007ddef4e,18,0x1108f964b384f1dcda03658b24310ccbc48e226f,0x4d41232b0d963afb52cd0354da5819b259f133bd,3000000000000000,75000000000000, +ethereum,opensea,v4,19494173,0xc2ccf706eb6880e8f06e116458c9ea69dc27b02462cd8827201161cca0a1dd68,1,0x1e196b7873b8456437309ba3fa748fa6f1602da8,24,0xf0e16c071e2cd421974dcb76d9af4dedb578e059,0xfba662e1a8e91a350702cf3b87d0c2d2fb4ba57f,1000000000000000,25000000000000,53000000000000 +polygon,opensea,v3,33414963,0xf7ddb9a8b972e56f9bffa223ba3c266387536e5cf7c6b6d20fea647ee409adbd,1,0xf021bf78b90f17a7b0dd2a071be5aaf5222c721b,1,0xdbecbe669c8d2e397d0f82570180934bb1834052,0x34df86fcb776811984a26ca0e21e8f5ab78efe3b,14000000000000000,350000000000000, +polygon,opensea,v3,33424200,0x1bf58b0eaef3e3ff158fd40b1258ca3375e46e86a4ba40b39aa4a285d296e6de,1,0x2b4a66557a79263275826ad31a4cddc2789334bd,76504,0x02c5e05886a9be0ebfd3cb9e19652c0723faea5b,0x8152fff80c08adda55b524d3c287275f1c9bd671,3000000000000000000,75000000000000000,300000000000000000 +polygon,opensea,v3,33426349,0xc7beca9b987ae3beb12031f53343e3afb7f449a8b8b3e5b30e7086b566637e96,1,0xc7a096b4c6610ba3a836070333ff7922b9866a36,10000000012871,0xa1ac9882c1f2fa810eebad1adee4b71ee2454a19,0x9f21551c17007216e7ede249a0d0b56bafada70b,25000000000000000,625000000000000, +polygon,opensea,v3,33429469,0x9ce4b5e4765b1fd32af0a34296adf95ae522a30e9cbfc0db84d18c4af11e6af1,1,0xcbc964dd716f07b4965b4526e30541a66f414ccf,12001,0xdaa914dd16cbb6fefcce34dff7e9a88f8531744a,0x0790523ee7ee48010f19f8a6707555fd92c8eb39,74999900000000000,1874997500000000,3749995000000000 +polygon,opensea,v3,38453137,0x849c0508b7b3dd8d61e4a0d29e9f8c700c958827bcae77a137cc3b3a196e34ad,1,0x48c75fbf0452fa8ff2928ddf46b0fe7629cca2ff,25,0xde88d43e523935ffb96124d6c3058f44561948ce,0xb8bf4cedfba620260a67b28c29ffeeca8ab35a1b,1520000000000000,38000000000000,152000000000000 +polygon,opensea,v3,38455958,0x00b1879922558ee2d46bc37be568a852b793abd4336269aab3dcfce1c7aeb36d,1,0x5e40037d3c0b2afa1495582431f27a83d199a6d8,2242,0xf00d61e4a0484ad87ff5cfbd33aff1b4ea232814,0xaf4ac2f4c6787e81db915415eba3425b39fdf163,7350000000000000,183750000000000,551250000000000 +polygon,opensea,v3,39485461,0xfe1d38ad787ada5179c8e00b7cf31195dfedaa985c75764001462ffff143d45c,1,0x87eaeac4fce71752442eafca3cb2c5fb979851a1,4805,0xa911c01502e8183a854edc0db9fae2bc27cf986e,0xbad152dde94f9475158c81eb3010f376085079bb,1500000000000000000,,150000000000000000 +polygon,opensea,v3,39597361,0xff3879843249432358bc2ea2d940709458b2d7bb7a03e76bde74e7e8847254c1,1,0x667570ae3212dc0cf98b46ccf151011ff310949b,3499,0x68704756a969bdea418b69db0c8bef9f5b9b0845,0x9f9fb9af3add5caf7f73816a0535083da89ec0ff,100000000000000000,,10000000000000000 +polygon,opensea,v3,39597361,0xff3879843249432358bc2ea2d940709458b2d7bb7a03e76bde74e7e8847254c1,2,0x667570ae3212dc0cf98b46ccf151011ff310949b,3917,0x68704756a969bdea418b69db0c8bef9f5b9b0845,0x9f9fb9af3add5caf7f73816a0535083da89ec0ff,100000000000000000,,10000000000000000 +polygon,opensea,v3,39597361,0xff3879843249432358bc2ea2d940709458b2d7bb7a03e76bde74e7e8847254c1,3,0x667570ae3212dc0cf98b46ccf151011ff310949b,3813,0x68704756a969bdea418b69db0c8bef9f5b9b0845,0x9f9fb9af3add5caf7f73816a0535083da89ec0ff,100000000000000000,,10000000000000000 +polygon,opensea,v3,39597361,0xff3879843249432358bc2ea2d940709458b2d7bb7a03e76bde74e7e8847254c1,4,0x667570ae3212dc0cf98b46ccf151011ff310949b,3829,0x68704756a969bdea418b69db0c8bef9f5b9b0845,0x9f9fb9af3add5caf7f73816a0535083da89ec0ff,100000000000000000,,10000000000000000 +polygon,opensea,v3,39597361,0xff3879843249432358bc2ea2d940709458b2d7bb7a03e76bde74e7e8847254c1,5,0x667570ae3212dc0cf98b46ccf151011ff310949b,3655,0x68704756a969bdea418b69db0c8bef9f5b9b0845,0x9f9fb9af3add5caf7f73816a0535083da89ec0ff,100000000000000000,,10000000000000000 +polygon,opensea,v3,39597361,0xff3879843249432358bc2ea2d940709458b2d7bb7a03e76bde74e7e8847254c1,6,0x667570ae3212dc0cf98b46ccf151011ff310949b,3785,0x68704756a969bdea418b69db0c8bef9f5b9b0845,0x9f9fb9af3add5caf7f73816a0535083da89ec0ff,100000000000000000,,10000000000000000 +polygon,opensea,v3,39597361,0xff3879843249432358bc2ea2d940709458b2d7bb7a03e76bde74e7e8847254c1,7,0x667570ae3212dc0cf98b46ccf151011ff310949b,3626,0x68704756a969bdea418b69db0c8bef9f5b9b0845,0x9f9fb9af3add5caf7f73816a0535083da89ec0ff,100000000000000000,,10000000000000000 +polygon,opensea,v3,39597361,0xff3879843249432358bc2ea2d940709458b2d7bb7a03e76bde74e7e8847254c1,8,0x667570ae3212dc0cf98b46ccf151011ff310949b,4185,0x68704756a969bdea418b69db0c8bef9f5b9b0845,0x9f9fb9af3add5caf7f73816a0535083da89ec0ff,100000000000000000,,10000000000000000 +polygon,opensea,v3,39597361,0xff3879843249432358bc2ea2d940709458b2d7bb7a03e76bde74e7e8847254c1,9,0x667570ae3212dc0cf98b46ccf151011ff310949b,3777,0x68704756a969bdea418b69db0c8bef9f5b9b0845,0x9f9fb9af3add5caf7f73816a0535083da89ec0ff,100000000000000000,,10000000000000000 +polygon,opensea,v3,39597361,0xff3879843249432358bc2ea2d940709458b2d7bb7a03e76bde74e7e8847254c1,10,0x667570ae3212dc0cf98b46ccf151011ff310949b,3814,0x68704756a969bdea418b69db0c8bef9f5b9b0845,0x9f9fb9af3add5caf7f73816a0535083da89ec0ff,100000000000000000,,10000000000000000 +polygon,opensea,v3,39597361,0xff3879843249432358bc2ea2d940709458b2d7bb7a03e76bde74e7e8847254c1,11,0x667570ae3212dc0cf98b46ccf151011ff310949b,3699,0x68704756a969bdea418b69db0c8bef9f5b9b0845,0x9f9fb9af3add5caf7f73816a0535083da89ec0ff,100000000000000000,,10000000000000000 +polygon,opensea,v3,39597361,0xff3879843249432358bc2ea2d940709458b2d7bb7a03e76bde74e7e8847254c1,12,0x667570ae3212dc0cf98b46ccf151011ff310949b,3877,0x68704756a969bdea418b69db0c8bef9f5b9b0845,0x9f9fb9af3add5caf7f73816a0535083da89ec0ff,100000000000000000,,10000000000000000 +polygon,opensea,v3,39597361,0xff3879843249432358bc2ea2d940709458b2d7bb7a03e76bde74e7e8847254c1,13,0x667570ae3212dc0cf98b46ccf151011ff310949b,3977,0x68704756a969bdea418b69db0c8bef9f5b9b0845,0x9f9fb9af3add5caf7f73816a0535083da89ec0ff,100000000000000000,,10000000000000000 +polygon,opensea,v3,39597361,0xff3879843249432358bc2ea2d940709458b2d7bb7a03e76bde74e7e8847254c1,14,0x667570ae3212dc0cf98b46ccf151011ff310949b,3443,0x68704756a969bdea418b69db0c8bef9f5b9b0845,0x9f9fb9af3add5caf7f73816a0535083da89ec0ff,100000000000000000,,10000000000000000 +polygon,opensea,v3,39597361,0xff3879843249432358bc2ea2d940709458b2d7bb7a03e76bde74e7e8847254c1,15,0x667570ae3212dc0cf98b46ccf151011ff310949b,4210,0x68704756a969bdea418b69db0c8bef9f5b9b0845,0x9f9fb9af3add5caf7f73816a0535083da89ec0ff,100000000000000000,,10000000000000000 +polygon,opensea,v3,39597361,0xff3879843249432358bc2ea2d940709458b2d7bb7a03e76bde74e7e8847254c1,16,0x667570ae3212dc0cf98b46ccf151011ff310949b,3896,0x68704756a969bdea418b69db0c8bef9f5b9b0845,0x9f9fb9af3add5caf7f73816a0535083da89ec0ff,100000000000000000,,10000000000000000 +polygon,opensea,v3,39597361,0xff3879843249432358bc2ea2d940709458b2d7bb7a03e76bde74e7e8847254c1,17,0x667570ae3212dc0cf98b46ccf151011ff310949b,3444,0x68704756a969bdea418b69db0c8bef9f5b9b0845,0x9f9fb9af3add5caf7f73816a0535083da89ec0ff,100000000000000000,,10000000000000000 +polygon,opensea,v3,39597361,0xff3879843249432358bc2ea2d940709458b2d7bb7a03e76bde74e7e8847254c1,18,0x667570ae3212dc0cf98b46ccf151011ff310949b,4199,0x68704756a969bdea418b69db0c8bef9f5b9b0845,0x9f9fb9af3add5caf7f73816a0535083da89ec0ff,100000000000000000,,10000000000000000 +polygon,opensea,v3,39687014,0xfffa729112ae8325e3dc0c1f8ed91220ae75c8747214f5c76ce9e14bbadb8da6,1,0x22d5f9b75c524fec1d6619787e582644cd4d7422,201,0xe16abd5205ad67a9369524f530d3acdb7dda6618,0xa04dee099b9d5ecf41e6f9b0ead429b62686acb5,158000000000000,,7900000000000 +polygon,opensea,v4,40059143,0xffb0d4ac4161622dd8e6ce309ad81c6c45a8cfc24c237622fb47b3843708c8d1,1,0x622d8fea4603ba9edaf1084b407052d8b0a9bed7,2805765,0x324edf2adb60cfc3471c3931fe0e43eaef986349,0x5d8b274fb462080be1bfeb219a79b0570db3234e,89000000000000000,,4450000000000000 +polygon,opensea,v4,40059143,0xffb0d4ac4161622dd8e6ce309ad81c6c45a8cfc24c237622fb47b3843708c8d1,2,0x622d8fea4603ba9edaf1084b407052d8b0a9bed7,2803727,0x324edf2adb60cfc3471c3931fe0e43eaef986349,0x5d8b274fb462080be1bfeb219a79b0570db3234e,89000000000000000,,4450000000000000 +polygon,opensea,v4,40059143,0xffb0d4ac4161622dd8e6ce309ad81c6c45a8cfc24c237622fb47b3843708c8d1,3,0x622d8fea4603ba9edaf1084b407052d8b0a9bed7,6205272,0x324edf2adb60cfc3471c3931fe0e43eaef986349,0x5d8b274fb462080be1bfeb219a79b0570db3234e,90000000000000000,,4500000000000000 +polygon,opensea,v4,40059143,0xffb0d4ac4161622dd8e6ce309ad81c6c45a8cfc24c237622fb47b3843708c8d1,4,0x622d8fea4603ba9edaf1084b407052d8b0a9bed7,6205410,0x324edf2adb60cfc3471c3931fe0e43eaef986349,0x5d8b274fb462080be1bfeb219a79b0570db3234e,90000000000000000,,4500000000000000 +polygon,opensea,v4,40059143,0xffb0d4ac4161622dd8e6ce309ad81c6c45a8cfc24c237622fb47b3843708c8d1,5,0x622d8fea4603ba9edaf1084b407052d8b0a9bed7,203014,0x324edf2adb60cfc3471c3931fe0e43eaef986349,0x5d8b274fb462080be1bfeb219a79b0570db3234e,90000000000000000,,4500000000000000 +polygon,opensea,v4,40059143,0xffb0d4ac4161622dd8e6ce309ad81c6c45a8cfc24c237622fb47b3843708c8d1,6,0x622d8fea4603ba9edaf1084b407052d8b0a9bed7,2808615,0x324edf2adb60cfc3471c3931fe0e43eaef986349,0x5d8b274fb462080be1bfeb219a79b0570db3234e,90000000000000000,,4500000000000000 +polygon,opensea,v4,40059143,0xffb0d4ac4161622dd8e6ce309ad81c6c45a8cfc24c237622fb47b3843708c8d1,7,0x622d8fea4603ba9edaf1084b407052d8b0a9bed7,2811180,0x324edf2adb60cfc3471c3931fe0e43eaef986349,0x5d8b274fb462080be1bfeb219a79b0570db3234e,89000000000000000,,4450000000000000 +polygon,opensea,v4,40059143,0xffb0d4ac4161622dd8e6ce309ad81c6c45a8cfc24c237622fb47b3843708c8d1,8,0x622d8fea4603ba9edaf1084b407052d8b0a9bed7,2406306,0x324edf2adb60cfc3471c3931fe0e43eaef986349,0x5d8b274fb462080be1bfeb219a79b0570db3234e,89000000000000000,,4450000000000000 +polygon,opensea,v4,40059143,0xffb0d4ac4161622dd8e6ce309ad81c6c45a8cfc24c237622fb47b3843708c8d1,9,0x622d8fea4603ba9edaf1084b407052d8b0a9bed7,7540,0x324edf2adb60cfc3471c3931fe0e43eaef986349,0x5d8b274fb462080be1bfeb219a79b0570db3234e,89000000000000000,,4450000000000000 +polygon,opensea,v4,40059143,0xffb0d4ac4161622dd8e6ce309ad81c6c45a8cfc24c237622fb47b3843708c8d1,10,0x622d8fea4603ba9edaf1084b407052d8b0a9bed7,2405987,0x324edf2adb60cfc3471c3931fe0e43eaef986349,0x5d8b274fb462080be1bfeb219a79b0570db3234e,90000000000000000,,4500000000000000 +polygon,opensea,v4,40059143,0xffb0d4ac4161622dd8e6ce309ad81c6c45a8cfc24c237622fb47b3843708c8d1,11,0x622d8fea4603ba9edaf1084b407052d8b0a9bed7,2811049,0x324edf2adb60cfc3471c3931fe0e43eaef986349,0x5d8b274fb462080be1bfeb219a79b0570db3234e,90000000000000000,,4500000000000000 +polygon,opensea,v4,40059143,0xffb0d4ac4161622dd8e6ce309ad81c6c45a8cfc24c237622fb47b3843708c8d1,12,0x622d8fea4603ba9edaf1084b407052d8b0a9bed7,2811130,0x324edf2adb60cfc3471c3931fe0e43eaef986349,0x5d8b274fb462080be1bfeb219a79b0570db3234e,90000000000000000,,4500000000000000 +polygon,opensea,v4,40059143,0xffb0d4ac4161622dd8e6ce309ad81c6c45a8cfc24c237622fb47b3843708c8d1,13,0x622d8fea4603ba9edaf1084b407052d8b0a9bed7,202456,0x324edf2adb60cfc3471c3931fe0e43eaef986349,0x5d8b274fb462080be1bfeb219a79b0570db3234e,90000000000000000,,4500000000000000 +polygon,opensea,v4,40059143,0xffb0d4ac4161622dd8e6ce309ad81c6c45a8cfc24c237622fb47b3843708c8d1,14,0x622d8fea4603ba9edaf1084b407052d8b0a9bed7,2811126,0x324edf2adb60cfc3471c3931fe0e43eaef986349,0x5d8b274fb462080be1bfeb219a79b0570db3234e,90000000000000000,,4500000000000000 +polygon,opensea,v4,40059143,0xffb0d4ac4161622dd8e6ce309ad81c6c45a8cfc24c237622fb47b3843708c8d1,15,0x622d8fea4603ba9edaf1084b407052d8b0a9bed7,6205122,0x324edf2adb60cfc3471c3931fe0e43eaef986349,0x5d8b274fb462080be1bfeb219a79b0570db3234e,90000000000000000,,4500000000000000 +polygon,opensea,v4,40059143,0xffb0d4ac4161622dd8e6ce309ad81c6c45a8cfc24c237622fb47b3843708c8d1,16,0x622d8fea4603ba9edaf1084b407052d8b0a9bed7,2406107,0x324edf2adb60cfc3471c3931fe0e43eaef986349,0x5d8b274fb462080be1bfeb219a79b0570db3234e,89000000000000000,,4450000000000000 +polygon,opensea,v4,40059143,0xffb0d4ac4161622dd8e6ce309ad81c6c45a8cfc24c237622fb47b3843708c8d1,17,0x622d8fea4603ba9edaf1084b407052d8b0a9bed7,202224,0x324edf2adb60cfc3471c3931fe0e43eaef986349,0x5d8b274fb462080be1bfeb219a79b0570db3234e,90000000000000000,,4500000000000000 +polygon,opensea,v4,40059143,0xffb0d4ac4161622dd8e6ce309ad81c6c45a8cfc24c237622fb47b3843708c8d1,18,0x622d8fea4603ba9edaf1084b407052d8b0a9bed7,202118,0x324edf2adb60cfc3471c3931fe0e43eaef986349,0x5d8b274fb462080be1bfeb219a79b0570db3234e,89000000000000000,,4450000000000000 +polygon,opensea,v4,40059143,0xffb0d4ac4161622dd8e6ce309ad81c6c45a8cfc24c237622fb47b3843708c8d1,19,0x622d8fea4603ba9edaf1084b407052d8b0a9bed7,2409862,0x324edf2adb60cfc3471c3931fe0e43eaef986349,0x5d8b274fb462080be1bfeb219a79b0570db3234e,90000000000000000,,4500000000000000 +polygon,opensea,v4,40059143,0xffb0d4ac4161622dd8e6ce309ad81c6c45a8cfc24c237622fb47b3843708c8d1,20,0x622d8fea4603ba9edaf1084b407052d8b0a9bed7,2409859,0x324edf2adb60cfc3471c3931fe0e43eaef986349,0x5d8b274fb462080be1bfeb219a79b0570db3234e,90000000000000000,,4500000000000000 +polygon,opensea,v4,40059143,0xffb0d4ac4161622dd8e6ce309ad81c6c45a8cfc24c237622fb47b3843708c8d1,21,0x622d8fea4603ba9edaf1084b407052d8b0a9bed7,4008190,0x324edf2adb60cfc3471c3931fe0e43eaef986349,0x5d8b274fb462080be1bfeb219a79b0570db3234e,90000000000000000,,4500000000000000 +polygon,opensea,v4,40059143,0xffb0d4ac4161622dd8e6ce309ad81c6c45a8cfc24c237622fb47b3843708c8d1,22,0x622d8fea4603ba9edaf1084b407052d8b0a9bed7,4008191,0x324edf2adb60cfc3471c3931fe0e43eaef986349,0x5d8b274fb462080be1bfeb219a79b0570db3234e,90000000000000000,,4500000000000000 +polygon,opensea,v4,40059143,0xffb0d4ac4161622dd8e6ce309ad81c6c45a8cfc24c237622fb47b3843708c8d1,23,0x622d8fea4603ba9edaf1084b407052d8b0a9bed7,2209294,0x324edf2adb60cfc3471c3931fe0e43eaef986349,0x5d8b274fb462080be1bfeb219a79b0570db3234e,90000000000000000,,4500000000000000 +polygon,opensea,v4,40059143,0xffb0d4ac4161622dd8e6ce309ad81c6c45a8cfc24c237622fb47b3843708c8d1,24,0x622d8fea4603ba9edaf1084b407052d8b0a9bed7,2405688,0x324edf2adb60cfc3471c3931fe0e43eaef986349,0x5d8b274fb462080be1bfeb219a79b0570db3234e,89000000000000000,,4450000000000000 +polygon,opensea,v4,40059143,0xffb0d4ac4161622dd8e6ce309ad81c6c45a8cfc24c237622fb47b3843708c8d1,25,0x622d8fea4603ba9edaf1084b407052d8b0a9bed7,2009186,0x324edf2adb60cfc3471c3931fe0e43eaef986349,0x5d8b274fb462080be1bfeb219a79b0570db3234e,90000000000000000,,4500000000000000 +polygon,opensea,v4,40059143,0xffb0d4ac4161622dd8e6ce309ad81c6c45a8cfc24c237622fb47b3843708c8d1,26,0x622d8fea4603ba9edaf1084b407052d8b0a9bed7,2406568,0x324edf2adb60cfc3471c3931fe0e43eaef986349,0x5d8b274fb462080be1bfeb219a79b0570db3234e,90000000000000000,,4500000000000000 +polygon,opensea,v4,40059143,0xffb0d4ac4161622dd8e6ce309ad81c6c45a8cfc24c237622fb47b3843708c8d1,27,0x622d8fea4603ba9edaf1084b407052d8b0a9bed7,2810587,0x324edf2adb60cfc3471c3931fe0e43eaef986349,0x5d8b274fb462080be1bfeb219a79b0570db3234e,90000000000000000,,4500000000000000 +polygon,opensea,v4,40059143,0xffb0d4ac4161622dd8e6ce309ad81c6c45a8cfc24c237622fb47b3843708c8d1,28,0x622d8fea4603ba9edaf1084b407052d8b0a9bed7,4012596,0x324edf2adb60cfc3471c3931fe0e43eaef986349,0x66434e59772b18b462bae3519685f378f84b42e0,87500000000000000,,4375000000000000 +polygon,opensea,v4,40059143,0xffb0d4ac4161622dd8e6ce309ad81c6c45a8cfc24c237622fb47b3843708c8d1,29,0x622d8fea4603ba9edaf1084b407052d8b0a9bed7,4018821,0x324edf2adb60cfc3471c3931fe0e43eaef986349,0x66434e59772b18b462bae3519685f378f84b42e0,87500000000000000,,4375000000000000 +polygon,opensea,v4,40430925,0x9675110993fa6c3c92bc9100ad681afb964c7989b0dea3b45975d5a7ef376031,1,0x3aa456d7b6b4bb6c13363c81e06240c1897da270,77041,0xbf90248aa584f0f3524ce9c0d29f0423f3c1f9d4,0x4eaadd50e0492f93a1b41f8a492af5aaa25fecc9,3000000000000000000,15000000000000000, +polygon,opensea,v4,40438617,0xab52e57e7210031569b9b7085fdad9c6d9377c9518b63dc0c052cd6f0de48db2,1,0x24a11e702cd90f034ea44faf1e180c0c654ac5d9,8432,0xb8e8f66088deb559116d0b9cc0d03cc53d8eda44,0x37b45293aaf561a2cdf9e260bf984b643dd3699a,419000000000000000,,41900000000000000 +polygon,opensea,v4,40438636,0xc9d94c98c986356b2b8339691e39adf6c94ff7756ff14cf61eefd12e99a581c6,1,0x461aeb735b06295dbb85cd4f15578f0252b240cd,3960,0x4f960d763e2d153299f310432fd8e16f75cc9bca,0xe72f92bab38b9bb62714ffeb50d9aae18a21e1de,4126306955000000,20631534775000,206315347750000 +polygon,opensea,v4,40438640,0x0a7c0dec6d8943ac37655716a34a0cc3c7a53fca37b252ff5a48f7055d6eb08b,1,0x99a558bdbde247c2b2716f0d4cfb0e246dfb697d,110,0x8662967884d317cafac40288cdc37bb1494570e1,0xc1aa696e7ee1a06f1c9a22c657e5e6586d3c4db5,4910000000000000,,122750000000000 +polygon,opensea,v4,40439802,0x359c2cad36c7655aead7b6a82abb4b350f16c97d069da0b6caf8646f7a74ac97,1,0x3aa456d7b6b4bb6c13363c81e06240c1897da270,191032,0x9931ef91ea7ce55d584786044b7b47ffe66a9098,0xdb874494722b6ad8aa553b9049c0b490484c688d,1000000000000000000,5000000000000000, +polygon,opensea,v4,40439855,0xfbe1f276ff612a7a3918a2258d50d4326433a7ecf72f291f780ec5ef3dcbabf0,1,0x461aeb735b06295dbb85cd4f15578f0252b240cd,3688,0xb415f808d6821524a6ccd6afa92a59482d0e8955,0x045cc8b7c96d5c1825200891e0d07fba48ea5a34,3489432872000000,17447164360000,174471643600000 +polygon,opensea,v4,40445227,0x67bf46fcf3605a1175ad22c794ca9e8d9d0e2b330e80444d24e6a468dbd6a462,1,0x57a9b65ceac6c5ee0cec8cd4571a7c3805b558d8,4,0xc1f1d9c9322cddd420390113248792cf37630180,0xd6c46293b04b39c6c4d5f418ca72d5962f1fedcb,70000000000000,350000000000,7000000000000 +polygon,opensea,v4,40446249,0xf2eb09440a75b52c2ee092c7429a2802d5beed3c94109843e3b7966d0fd94b1d,1,0x8634666ba15ada4bbc83b9dbf285f73d9e46e4c2,30954,0x547f6b586bed31883e0641de018ffeb6f9ed4bb7,0x4eeddad4153517407d906e97c319efc155e0fc21,8700000000000000,,87000000000000 +polygon,opensea,v4,40461406,0x4b548fd1d21f4135c49e4a98be9ee3b90a0c6dbab788352a3416aaf8e6dffdc2,1,0x9d305a42a3975ee4c1c57555bed5919889dce63f,6258,0x49658c334d2d2c43638797ca09ab60ddbcf6ec8c,0x86de2b6e55ddb8b3a6caaffb307fadb63cdcf4f9,690000000000000000,,3450000000000000 +polygon,opensea,v4,40468286,0x1405f7b6652a62d948e565ebe1ad564b84c949bd2b688de6e26a6c5ab91a82d8,1,0xb581cc7a3211674d6484a11c8663b9011b600eee,0,0xeb428fa0ff5a3a097fabaff0709b932ffd0b0936,0x6cfb5f69c48f3211aecd4c6236842c35307cb111,14999999000000000,,749999950000000 +polygon,opensea,v4,40468291,0xd2ab88bd1e5ed0adddf161de4b22e6194f956b444b20cd97fa653429f5b28d4a,1,0xc8d3a3a83bde5dad06d436694e3e22ac3e64d577,928194,0x406115a0b6aae5d052601ea91256dc5c4121e311,0xd0382d975a7ccf3206cfb42771417e1371b162a3,7500000000000000,37500000000000,375000000000000 +polygon,opensea,v4,42575697,0x94cd09fb45ef8060035add64ddc7910f406d7555ac87e033e2cdc2e36c14911b,1,0xba6666b118f8303f990f3519df07e160227cce87,7,0x8b2e8c120e28068663cbfc2a245bea4ef797ecd5,0x77372cf0e82af8c0e0c1e6e19c9e9edad39fbb36,250000000000000000,6250000000000000,25000000000000000 +polygon,opensea,v4,42575705,0x4ff0e6f91b45525945066dddc5629c5eb116ab52b025d755ea361c4ed0a3a97e,1,0x624e4fa6980afcf8ea27bfe08e2fb5979b64df1c,44845,0xad5ae1b5c8091c0aedb4abc73beed9eeaa3e97f4,0xe9fbe9cb3bad6f3faddc696ca555e60681c77737,1099000000000000000,27475000000000000,109900000000000000 +polygon,opensea,v4,42575945,0xe16eb078461675a7de703b039321cb18c378464f8a81d3c8146b6356314d9adc,1,0xba6666b118f8303f990f3519df07e160227cce87,24,0xa23166921339b2ee682918a76b3194b302260932,0x3134db15d15dcf8ec926e9145bb1b889bc025631,7107000000000000000,177675000000000000,710700000000000000 +polygon,opensea,v4,42576046,0xe001a1f7789a14d4f20890aa047122f0ceb63178c4113fac0a73e5d7dc37f50b,1,0x99a558bdbde247c2b2716f0d4cfb0e246dfb697d,55,0x5314b430520257fcb572e38a40e0c4894fe3950e,0x4bf9a0f7f49cb4fd5cdf1d43b80a1db867072d67,8800000000000000000,220000000000000000,220000000000000000 +polygon,opensea,v4,42576046,0xac42c1ac9732463d135764ad931c0aaebd2b33f93f76d8957bdb932a96552354,1,0x5d666f215a85b87cb042d59662a7ecd2c8cc44e6,12274009,0x5c5066c61c9ff7a5965b1d78f8e26a8b71dd054b,0x248dae0c51eb25542521fca470bf422885a668b7,20000000000000000,500000000000000, +polygon,opensea,v4,42576051,0x154ad43d340718c224e9eacf839bef48627d72cbca327ab294223d385f52b813,1,0xc6210509389fdac176d68a35d021c095ba657b82,9969,0x81f8f0ee2eb45310b44f5c407628dfd4596d2059,0xe72a829e88b24ad492c92bf499e5d8d2cc71c72d,800000000000000000,20000000000000000,80000000000000000 +polygon,opensea,v4,42576051,0x154ad43d340718c224e9eacf839bef48627d72cbca327ab294223d385f52b813,2,0xc6210509389fdac176d68a35d021c095ba657b82,4981,0x81f8f0ee2eb45310b44f5c407628dfd4596d2059,0x3ca34a6d50ca99b8d91007776d701fcc7880e950,800000000000000000,20000000000000000,80000000000000000 +polygon,opensea,v4,42576053,0x2d2d09ef9ea1e55e7d805d538c61bfe7cc6db6f504cb8cf31e628f78e9bfc131,1,0x7e846523cb8a8de443b795a40cf5d63b35791c1c,192,0xf2137bedaa5ecbc935f6b32b18d48dcaae3cb7d9,0x0274f1e0f156d63c9a0ee922d62c9c4d5cc5414e,1000000000000000,25000000000000,50000000000000 +polygon,opensea,v4,42576502,0x256a31ca135b92a4cb9e3d72b4d32244a9cbf02994d666066f5542f928f08b0a,1,0xdc0479cc5bba033b3e7de9f178607150b3abce1f,144657,0xafe572337b43702e2bc83da106d137e1b5c705ac,0x312349e885c5bdc9c01c14748c145bb87e45bc7e,5000000000000000,125000000000000,125000000000000 +polygon,opensea,v4,42576503,0x98d28f22ab819da4f3468e7f816e316efc6e4e237eb3afffa5afe115906bcdbb,1,0x7cbccc4a1576d7a05eb6f6286206596bcbee14ac,1,0x9ce16b0ff00cea66c954efcd6bc93c7bf2c06c3d,0x0f4eeb30ece8d741b2dd142aaf11d549d23f5e03,1990000000000000,49750000000000,99500000000000 +polygon,opensea,v4,42576797,0xa0bb4e68659dfc4a7a45fbdd3e50c678b078ac8ec0f0806ab96a1c3882be2b97,1,0xdc0479cc5bba033b3e7de9f178607150b3abce1f,82639,0xea1ca730d3636744d2c58ebca793575db505cd4a,0xf1d968251fc105da8c42945beaa0af7486340af1,26400000000000000000,660000000000000000,660000000000000000 +polygon,opensea,v4,42576797,0xa0bb4e68659dfc4a7a45fbdd3e50c678b078ac8ec0f0806ab96a1c3882be2b97,2,0xdc0479cc5bba033b3e7de9f178607150b3abce1f,37391,0xea1ca730d3636744d2c58ebca793575db505cd4a,0xcf6ea7e74c2b5107e5f0d21c6f3915a91bf33f39,12200000000000000,305000000000000,305000000000000 +polygon,opensea,v4,42576882,0x0f2b51a501efe6bea57a7fe6852a071d37522d5e10629e71f5f88ff68cf8aa5f,1,0x22d5f9b75c524fec1d6619787e582644cd4d7422,612,0x9ee280b9ab8a33a88cfba45f1b184d79bf552c3d,0xbc1bc43efa8c3b4153fb125bde6dccd7e3e5bd72,2000000,50000,100000 +polygon,opensea,v4,42576883,0x54c80f2785a64f63cb3d9e9fa8993402ce037286c8b8a262f0a39b6b7776e444,1,0x4bb5b2461e9ef782152c3a96698b2a4cf55b6162,28,0x2e8f5b800b971bfbde9b1775d9147af7cae9ca61,0x6001620237a35aa07b0f50337e347d824423aff0,2320000,58000,232000 +polygon,opensea,v4,42576887,0xe7eab72a720cd29c2c84aa31fe71c9d4fac23e944cedad24143a8d98492addcf,1,0xba6666b118f8303f990f3519df07e160227cce87,36,0x71f7a3a5d833e49023c93b5aa9aa385c60c2bf3b,0x935dd9b73b62c1377c0f699544145bb6de1ac77b,120000000000000000,3000000000000000,12000000000000000 +polygon,opensea,v4,42576901,0x14dd17243359fa7f25e28625569be5eb626c2ecaceab554e92b36f29b9ffa54a,1,0xef453154766505feb9dbf0a58e6990fd6eb66969,4236,0xef0b56692f78a44cf4034b07f80204757c31bcc9,0x5974edb5e30f260e1b45bd816a75c6cfbc573d7c,36000000000000000,900000000000000,3600000000000000 +optimism,opensea,v3,68203166,0x894a6ffea478953e520cb2d6fb89e5a97589d717ed7aa2402f4419971de8e1bc,1,0xfa14e1157f35e1dad95dc3f822a9d18c40e360e2,99191,0x2afd01591002e8d432627de68cad7964bd124871,0x2f277208a66abae03b24b8757d52b55b4d9ba9a7,8880000000000000,222000000000000, +optimism,opensea,v3,68203166,0x894a6ffea478953e520cb2d6fb89e5a97589d717ed7aa2402f4419971de8e1bc,2,0xfa14e1157f35e1dad95dc3f822a9d18c40e360e2,2237224,0x2afd01591002e8d432627de68cad7964bd124871,0xcfa01c37657917f77c206eb8115b99c2d521d9ed,8949000000000000,223725000000000, +optimism,opensea,v3,68203285,0x59e0e830ce03678c81f7ed40f5d8f9d5024d624573acd6e3c025bfc890bf73a2,1,0xfa14e1157f35e1dad95dc3f822a9d18c40e360e2,1586636,0x415fc02ac3cb6300c97732fcc22ffd8060f4a0f2,0xff4bc6638916246df2abe32e584f05d40fe58e38,2800000000000000,70000000000000, +optimism,opensea,v3,68244119,0x05ed879b4578789f69324aa0b2c1477000db92b6f487960310192fde150530ab,1,0xfa14e1157f35e1dad95dc3f822a9d18c40e360e2,1120588,0x95f0efe07e451c4a507f0105715e056f1a7f727e,0xbaf5eacf1712e6f4a4633e67f518cffef54b6262,1100000000000000,27500000000000, +optimism,opensea,v3,68307929,0x07050e0ff68f87c7e58d570104d5cc63bf6f392e093e057052609f8911eb3892,1,0x1e04c33cd5a015e1ced0e3ecd8bdc42902512124,0,0xe15086ee928af9a05fd3cbd45df32f6367265d73,0x3aab9b3145df48a22ae337d50d1d66a3b2a3bda0,399900000000000,9997500000000,39990000000000 +optimism,opensea,v3,68397883,0x293e65bc1c1cd4e917ddf7c190285729082a7364ef100f1d9ad50fc71cc27f1d,1,0x1e04c33cd5a015e1ced0e3ecd8bdc42902512124,0,0xa314ac24a470e90e79b991e170a4569263122651,0x3aab9b3145df48a22ae337d50d1d66a3b2a3bda0,399900000000000,9997500000000,39990000000000 +optimism,opensea,v3,68606133,0xd73ad8b3861edab2904ceb87cb794d95db6201778857fd4cf2aa6409ae51edcb,1,0xfa14e1157f35e1dad95dc3f822a9d18c40e360e2,2782261,0x82677d9edde5870055d7deaf2b0a123bb30c8848,0xcbf85ca57df4b8b64be97d15c35810f56e93758a,6000000000000000,150000000000000, +optimism,opensea,v3,68636104,0x6131624118010cebf4b1d739cdff9e78a951bdd287d4b832b632b9f6bd9d9d52,1,0xfa14e1157f35e1dad95dc3f822a9d18c40e360e2,1067246,0x26a25f95f321d0dc2988651913b607b9017fe4a3,0x5ecc9ce730061de9955b692548cff3b7db454368,444000000000000,11100000000000, +optimism,opensea,v3,68687483,0x10ac14b26100f3ac8ef68d1dd71ccfe5bbcaae4de7fd01cf45a669d60321d975,1,0xfa14e1157f35e1dad95dc3f822a9d18c40e360e2,3342849,0x72571c8e07b15d85d6c32ac2ff4eb9f4b8b84f1e,0x1cbdde6d31409605b7c48650acabdf9948ef614c,1777000000000000,44425000000000, +optimism,opensea,v3,68687483,0x10ac14b26100f3ac8ef68d1dd71ccfe5bbcaae4de7fd01cf45a669d60321d975,2,0xfa14e1157f35e1dad95dc3f822a9d18c40e360e2,3390883,0x72571c8e07b15d85d6c32ac2ff4eb9f4b8b84f1e,0x0bb924fd2db39fc396c783c88c01cd2a5fa9c8ba,1253000000000000,31325000000000, +optimism,opensea,v3,68707143,0x38135ff5b5e24d3842fd9e09c7782c084a84734ddd59e24eb990a0d73d884581,1,0x81b30ff521d1feb67ede32db726d95714eb00637,195696,0x4aa194b8b7b1ee728b0a1508b9b9f3e1864f1fb5,0x0696e973c37dc629b0bfd487477d137445be459e,500000000000000,12500000000000, +optimism,opensea,v3,68707282,0xba398bf116dc4188c5ae4adf8028d76df3897ae106312e97a175e4158e501498,1,0xfa14e1157f35e1dad95dc3f822a9d18c40e360e2,1918771,0x773b5337c547ce517653d35783a4f0e404ac872f,0x4e3da8b358569a826261b5da35efcd65e912b0ed,1100000000000000,27500000000000, +optimism,opensea,v3,68756185,0x8fb18c2928e162af20881330d426578ab0ff497a23d64783ce81a3c754d76f04,1,0xfa14e1157f35e1dad95dc3f822a9d18c40e360e2,1115029,0xc3e8e833448a6d832deb0d187a164810c6291b68,0x15e3ca456b25fe8ef8bba804140f4c1d867f1fc2,1277900000000000,31947500000000, +optimism,opensea,v3,68778194,0x9630983e744207231f3976dfc7ce447c5d4baf6af19ebe1e42abaf95a3fbd528,1,0xfa14e1157f35e1dad95dc3f822a9d18c40e360e2,1645386,0xcc47b94b5cf9067808c91fd6111d1ed122421111,0xb69171380111e4c7959898e6e83ca79c71015575,1080000000000000,27000000000000, +optimism,opensea,v4,88848508,0xd702b55459a46239095b609d88ae28d0bb23ea70c70014f670e26982b71eb746,1,0xe22fd22b3fc0ecd5217d2461d15159a7dfc38790,0,0xdfd5c1b2645ed0f33803fbfff0e0bf020f4bb25b,0xbdef6a773653c2364372ea16d62882bdb4a9feb4,1190000000000000,29750000000000, +optimism,opensea,v4,88861715,0x20ca9b91cf054527564f1b0e686d49f081b12171669be9232537dd446d1c06e4,1,0x11af3226b32701c7a7395ea2532c6c1ae906b6ae,2033,0x6d59931af25d136034671e024371eeeff838345d,0x0ecdf59596b285d769fd473a57b3ffbc9606ea15,2800000000000000,70000000000000,280000000000000 +optimism,opensea,v4,89064389,0x3e9ec8b3ea07e6f9b929aaab596012121265a558fd492abcbd7418114517e5a1,1,0xe22fd22b3fc0ecd5217d2461d15159a7dfc38790,0,0xe98f343da5232bc7d99b45e8fe1e738a22b83b3e,0xbf137f3e501f5b8549fd0f5020be775b079c0ec1,1200000000000000,30000000000000, +optimism,opensea,v4,89064587,0x6dde257aa21ec9f05bd2245785d89dd020ada76347a3f8028a226f9785b8679d,1,0x2f05e799c61b600c65238a9df060caba63db8e78,1,0xb7264811ce186586691f0fd8dd9b3e7f997affe5,0x997a861468f3a4ca26be2f754415479d74213b8b,690000000000000,17250000000000, +optimism,opensea,v4,89087931,0xbf143be016cdd16d900c4bf95ae2bd6b47968a7da1118d45f6d9f02bf5da39fe,1,0xe22fd22b3fc0ecd5217d2461d15159a7dfc38790,0,0x5b605894f800e534d6d8370632398a767a54b2a0,0x346a0b4da75bb8294fa0e7acf6c0592b665e8c48,690000000000000,17250000000000, +optimism,opensea,v4,89104326,0x412d8423b1c880b635636bc4060177e27761a07fab6f781cd5f9dfd6711ca085,1,0xe22fd22b3fc0ecd5217d2461d15159a7dfc38790,0,0xaf33bdbda6d4929a5112e8b3fbc8be4757c4dbe8,0xeb7cf646b90709a5f77e479669a2ccb2f08f8dc8,1170000000000000,29250000000000, +optimism,opensea,v4,89115869,0xf21d2a61e0354f892b603e8e6d27977baed2afa01fe2e90b0d78cbea57f9711e,1,0xfa14e1157f35e1dad95dc3f822a9d18c40e360e2,1638348,0xf473de0df183cb762dd4817489d9357b0beb15fc,0x09953e0ebccf1fa2b808bb942c45e7ab40fd8c11,990000000000000,24750000000000, +optimism,opensea,v4,89126874,0x9ddac43591a50876d222653c821c6d959bc4648b80717774a17b0e0f9cb38ce3,1,0xe22fd22b3fc0ecd5217d2461d15159a7dfc38790,0,0x744f617343f03bb7c9d52a6d84f87aa4b1017fac,0xeb7cf646b90709a5f77e479669a2ccb2f08f8dc8,5870010500000000,146750262500000, +optimism,opensea,v4,89126874,0x9ddac43591a50876d222653c821c6d959bc4648b80717774a17b0e0f9cb38ce3,2,0xe22fd22b3fc0ecd5217d2461d15159a7dfc38790,0,0x744f617343f03bb7c9d52a6d84f87aa4b1017fac,0x346a0b4da75bb8294fa0e7acf6c0592b665e8c48,2352000000000000,58800000000000, +optimism,opensea,v4,89149018,0xa12db84a2a1812715fe4e046a686185f6c75faa4e02901ab4e47ff8aac9e8f24,1,0xb18d96445eba9ee0e0d42d1c8ad113e12bdd8be4,716,0x20eebeb9f65027f0150d3cddd29a6f33fbecd319,0x3654be7bba479c999394737d043bc8c4b4d7879c,5400000000000000,135000000000000,540000000000000 +optimism,opensea,v4,89161454,0xa1f8e85909ef498f739c4be16e089861a5dd2cf894b462600019db92f1cfca25,1,0x1f4887dd2e4b94b9e83144cd11d83643c9e65430,579,0x0c0ffaaf6378cc0b4118f2752209a206a046d56e,0xa74a7dec78415ff444fb1c3fb8eba803fe5c42f5,1650000000000000,41250000000000,165000000000000 +optimism,opensea,v4,89164693,0xcd0692f64507eb2cc35cda5e52f9d093cfa7aa3e7a0f3b701ede9da1b58bc8e6,1,0xe22fd22b3fc0ecd5217d2461d15159a7dfc38790,0,0x3c5f6974aedf2b8180f27559efcd1e1b89bb8689,0xeb7cf646b90709a5f77e479669a2ccb2f08f8dc8,1174000000000000,29350000000000, +optimism,opensea,v4,89178410,0x6f8292035c53510aebaaccfd1b68b264fdc7934bdd83cf565cfa6f54fb9b7c3a,1,0xe22fd22b3fc0ecd5217d2461d15159a7dfc38790,0,0x3312e8e1fa3cd72b4691d19429ce393435a34162,0xeb7cf646b90709a5f77e479669a2ccb2f08f8dc8,1174027000000000,29350675000000, +optimism,opensea,v4,89185558,0xc0aa9fd397bff99a141648d08e77c791c0820565b7384ba94e5401763d7fbb5b,1,0xe22fd22b3fc0ecd5217d2461d15159a7dfc38790,0,0xa83d16c382e2e5d436b6f645963853a42184fbd2,0xeb7cf646b90709a5f77e479669a2ccb2f08f8dc8,1174000000000000,29350000000000, +base,opensea,v4,2607845,0xa85033e66d21036d4a6e53a336807bb03082c3046f444036b48d7b1d0d8aecaf,1,0x735564d0e9e3a17aac487dde99823ee8abb0de42,4335,0x3e20eaab33f13a96adfdb876931bd6686c79ca1e,0xef88a697c3a7c5656fe4d5c130c30c72136d1778,1500000000000000,37500000000000,105000000000000 +base,opensea,v4,10280831,0xa86ddb7830f4e7cd0e9ab73ac6ea84267e513e1d97217249666c9b84733d7610,1,0x628cb4601cb45fb4dacde367041fc49a74da8020,2579,0x2205fad5a09332887d4b56f0f46ec1ef42f4ec65,0x42b8644e217bad886752684054a4b83a6e521671,15000000000000000,375000000000000, +base,opensea,v4,10516666,0xa8489f7807735dd51c38db310e28137132e211f8f01a49a7418653752c103e28,1,0x99b540ba95f7ad7fde7eca255b43cdb40d2bbf9b,1,0x4cdf4cd30a9fac19d26a8426df2f1ae22616d69d,0x61fd6dbbb485cd593d1244423b28894a12befd4f,400000000000000,10000000000000, +base,opensea,v4,13412294,0xa84dd78f20e17e4d853ac92bda3b7d48c971ad6dec34281b45eed636ce377469,1,0xbfd0f82949ba5b2469fdd755cc99073c442361d1,5,0x0b4704cb5cab89c2fdc8a773b17b7d7a012d16cb,0x34c5bd3639d2b4683565eb9051c4f7ad13dab914,1300000000000000,32500000000000,32500000000000 +base,opensea,v4,13412294,0xa84dd78f20e17e4d853ac92bda3b7d48c971ad6dec34281b45eed636ce377469,2,0xbfd0f82949ba5b2469fdd755cc99073c442361d1,5,0x0b4704cb5cab89c2fdc8a773b17b7d7a012d16cb,0xfa5532919af26deae495a45fc5040688f2ca73bd,1300000000000000,32500000000000,32500000000000 +base,opensea,v4,13780807,0xa86146581e9322fafbb6c01c36aaea15da37d90cfa12313fc30ea67b2a585a0c,1,0x1029e3c4b90f438dfa2f60da070846606b8e020d,4559,0x4d3ddbf45dd7fff0320b74399d4f302747f1d25f,0x426a3e5981626a997b8bcef7d5a60ef81da599d7,24500000000000,612500000000, +base,opensea,v4,13780807,0xa86146581e9322fafbb6c01c36aaea15da37d90cfa12313fc30ea67b2a585a0c,2,0x1029e3c4b90f438dfa2f60da070846606b8e020d,4558,0x4d3ddbf45dd7fff0320b74399d4f302747f1d25f,0x426a3e5981626a997b8bcef7d5a60ef81da599d7,24500000000000,612500000000, +base,opensea,v4,13780807,0xa86146581e9322fafbb6c01c36aaea15da37d90cfa12313fc30ea67b2a585a0c,3,0x1029e3c4b90f438dfa2f60da070846606b8e020d,4460,0x4d3ddbf45dd7fff0320b74399d4f302747f1d25f,0x426a3e5981626a997b8bcef7d5a60ef81da599d7,24500000000000,612500000000, +base,opensea,v4,13863239,0xa85d7decbd0e3ed4b83d2e2940c0b10b48ec9110bc35a2b6694013762b46138d,1,0xc11836ebedd4a46058594ee25ba4fe9707ed32c4,5,0x25eb9f2f1f9366c3ca81def000ca4c23017ae599,0xe2049494cb6f61ca29577bfc6c6cfd78db1c5515,600000000000000,15000000000000,18000000000000 +base,opensea,v4,14105980,0xa86ae6fdc5281694449d64aa9b1af062dbcb232074b02e10f647439245f361ee,1,0x442a71a40b23d6171ffe8dd6c653568e9f5a5782,1337,0x557193439e4360856268e14b78e740ed24fe6d9e,0x8318bc21a67baa09c64650cb86867b2c35663714,300000000000000,7500000000000,22500000000000 +zora,opensea,v4,2469900,0xfd56694982b1bcfe92b5eeb4459644d24d99aa6a7d5adbacab645077b9b567cd,1,0x22ebbcb38a0666f09042b02f0e2bfe930c33eacb,18874,0xbf0d78ebe5e2c5a8ed9dbe42d539f5e8ea115d61,0x475060616fd5b39a1a2ee5ef07e0c163b3f0df7d,1690000000000000,42250000000000,33800000000000 +zora,opensea,v4,3785464,0x817366ec6040785c4697b835bb207579bf7375749577d484a3ad77494e604de3,1,0x199a21f0be1cdcdd882865e7d0f462e4778c5ee4,79285,0xcfe86281728d140d4796ae2fe20c6533b5fae104,0x4c9f29229c47c4207e05923a3121dd7d51783454,8000000000000,200000000000, +zora,opensea,v4,3790945,0x8f400349a2c838ea5b1ff653d4a8fe5408a7154a3e6f7c91ad105bafd44d549b,1,0x09dd68c87020055a19733a6ccd7bfc7e7dfb3483,63954,0x3625eff632eab044489a46014dd168ccb5112240,0xb54638bb3327df2df142fde3b957725dde2e5732,1790000000000000,44750000000000, +zora,opensea,v4,5247523,0x8abdafe547e508cce677552a0ce64765b32abdd5ec2d5472513b6c6be1ba1a8c,1,0x5921a344e85553d8ec7f8510917d38aaa8d21081,12064,0xa1551c98a14f36631ac8737bb21ffe4d6c57d987,0xcc65acb37028b18c0103ef53b28b73e39db201bb,3880000000000000,97000000000000,194000000000000 +zora,opensea,v4,11250185,0x84cf93a1cce030053756d2524a8347c9a4d80dd55f93d7c4e02926caca85eaea,1,0x03fee76c3901d802407b0e3b1259657ef2e163a4,16,0x28faef4c17dd9c3da8864c2ff37e00c0df15e3d4,0x1935cc900625c6f077a7489fe2c9de0e6dc815dc,1400000000000000,35000000000000,70000000000000 +zora,opensea,v4,11250535,0xaf1b34558066e39d643e680759e9947119da0d3d17bb82a08c5d6fce2a62ba56,1,0xc278e830b07ba22eae411af7f3b0396907856156,10144,0xb7005bd95ee95feb3a7ce143bf628340c99f1104,0x71d0953075c39f4b3da1625ec848e278ff91d15a,13000000000000,325000000000, +zora,opensea,v4,11561773,0xb78975c5d768c8e933c81c462903c7374f421d89f5c227c22ef27abe892881b8,1,0xc673832ff7995d9eacaf198b5ab94eaef0499341,2,0xfc258b128dd2839666530eb0611b5c00735a5aaa,0xd1f6a55632ff7a0cc635cd649e62e355f8e17fc8,789000000000000,19725000000000, +zora,opensea,v4,11562790,0x10a1801a192307fc447e0564b501148e7744950004c1dc20e60523e6c69d065c,1,0x09dd68c87020055a19733a6ccd7bfc7e7dfb3483,50784,0x215271c23ee0781dcf8fcb64790bb88b694b7fc5,0xd651b62a886e4cc9ce865b5dfb295fd77d2224a5,1098990000000000,27474750000000, +zora,opensea,v4,11563185,0x6c9f8b1e4fc52d38e7e0e16763c6f1bc921a6f856f2641f8d267444540ec8523,1,0x060f3edd18c47f59bd23d063bbeb9aa4a8fec6df,1,0xfc6fc698a19f95832ecee8cdb9e55cb8f475a6e8,0x922197fd26290e3af3da0c35e7f4f299d95e8741,899000000000000,22475000000000, +zora,opensea,v4,11563469,0xf67931c83460914310b2a481683a573a8b9cbfd98d46a78853ca9c1e2eb04c6e,1,0xab598a164729d88fa04a72b8420556ab9de756a8,3,0x3a49b43bd994f3ce7dde3a8af6d0a5660dbaaa2a,0xfe8ceb5eeb7de237fcb047747551b581371dfa87,1195000000000000,29875000000000, +zora,opensea,v4,11563636,0x67043d84c0bce1d95b133f1e04b0a73c6af3e869fcb688c329ae86dc8e7ea072,1,0xc51ba90509e1d3a5cb5a78e21705a844abfb8172,1,0x3a49b43bd994f3ce7dde3a8af6d0a5660dbaaa2a,0x3dbd05fd99be44e03dc962837b7cc40a4a55b116,1900000000000000,47500000000000, +zora,opensea,v4,11564307,0x36f536069a3c25483278c597148d8038bb06d377ffb7a57f5f86c43a6296dd6e,1,0x266b7e8df0368dd4006be5469dd4ee13ea53d3a4,560918,0xd94b9a07f7823cedeee3e5955a37c55e88a998b2,0xd24425e7d3c239d7fba892e19899bcdc4322eedd,20000000000000,500000000000, +zora,opensea,v4,11565422,0x337d9dd461f50d52d8dc44d61918cbddf005ad5c01f077d60f78a156c76331cf,1,0xb9a2f7762c890b243c92348cbb2b1ff31e4d7fda,1,0xa0434628d6f56ff5291096a29356205323bc91da,0x89fbe203edcc8dc1cca45b672e48f7b8ea04433a,2800000000000000,70000000000000,140000000000000 diff --git a/seeds/opensea/optimism/opensea_optimism_seaport_trades_samples.csv b/seeds/opensea/optimism/opensea_optimism_seaport_trades_samples.csv deleted file mode 100644 index 11f0e92ae85..00000000000 --- a/seeds/opensea/optimism/opensea_optimism_seaport_trades_samples.csv +++ /dev/null @@ -1,28 +0,0 @@ -blockchain,project,version,block_date,tx_hash,evt_index,sub_idx,nft_contract_address,token_id,buyer,seller,amount_raw,platform_fee_amount_raw,royalty_fee_amount_raw -optimism,opensea,v3,2023-01-17,0x293e65bc1c1cd4e917ddf7c190285729082a7364ef100f1d9ad50fc71cc27f1d,1,1,0x1e04c33cd5a015e1ced0e3ecd8bdc42902512124,0,0xa314ac24a470e90e79b991e170a4569263122651,0x3aab9b3145df48a22ae337d50d1d66a3b2a3bda0,399900000000000,9997500000000,39990000000000 -optimism,opensea,v3,2023-01-17,0x10ac14b26100f3ac8ef68d1dd71ccfe5bbcaae4de7fd01cf45a669d60321d975,0,1,0xfa14e1157f35e1dad95dc3f822a9d18c40e360e2,3342849,0x72571c8e07b15d85d6c32ac2ff4eb9f4b8b84f1e,0x1cbdde6d31409605b7c48650acabdf9948ef614c,1777000000000000,44425000000000, -optimism,opensea,v3,2023-01-17,0x10ac14b26100f3ac8ef68d1dd71ccfe5bbcaae4de7fd01cf45a669d60321d975,1,1,0xfa14e1157f35e1dad95dc3f822a9d18c40e360e2,3390883,0x72571c8e07b15d85d6c32ac2ff4eb9f4b8b84f1e,0x0bb924fd2db39fc396c783c88c01cd2a5fa9c8ba,1253000000000000,31325000000000, -optimism,opensea,v3,2023-01-17,0x38135ff5b5e24d3842fd9e09c7782c084a84734ddd59e24eb990a0d73d884581,0,1,0x81b30ff521d1feb67ede32db726d95714eb00637,195696,0x4aa194b8b7b1ee728b0a1508b9b9f3e1864f1fb5,0x0696e973c37dc629b0bfd487477d137445be459e,500000000000000,12500000000000, -optimism,opensea,v3,2023-01-17,0xba398bf116dc4188c5ae4adf8028d76df3897ae106312e97a175e4158e501498,0,1,0xfa14e1157f35e1dad95dc3f822a9d18c40e360e2,1918771,0x773b5337c547ce517653d35783a4f0e404ac872f,0x4e3da8b358569a826261b5da35efcd65e912b0ed,1100000000000000,27500000000000, -optimism,opensea,v3,2023-01-17,0x9630983e744207231f3976dfc7ce447c5d4baf6af19ebe1e42abaf95a3fbd528,0,1,0xfa14e1157f35e1dad95dc3f822a9d18c40e360e2,1645386,0xcc47b94b5cf9067808c91fd6111d1ed122421111,0xb69171380111e4c7959898e6e83ca79c71015575,1080000000000000,27000000000000, -optimism,opensea,v3,2023-01-17,0x05ed879b4578789f69324aa0b2c1477000db92b6f487960310192fde150530ab,0,1,0xfa14e1157f35e1dad95dc3f822a9d18c40e360e2,1120588,0x95f0efe07e451c4a507f0105715e056f1a7f727e,0xbaf5eacf1712e6f4a4633e67f518cffef54b6262,1100000000000000,27500000000000, -optimism,opensea,v3,2023-01-17,0x07050e0ff68f87c7e58d570104d5cc63bf6f392e093e057052609f8911eb3892,1,1,0x1e04c33cd5a015e1ced0e3ecd8bdc42902512124,0,0xe15086ee928af9a05fd3cbd45df32f6367265d73,0x3aab9b3145df48a22ae337d50d1d66a3b2a3bda0,399900000000000,9997500000000,39990000000000 -optimism,opensea,v3,2023-01-17,0xd73ad8b3861edab2904ceb87cb794d95db6201778857fd4cf2aa6409ae51edcb,0,1,0xfa14e1157f35e1dad95dc3f822a9d18c40e360e2,2782261,0x82677d9edde5870055d7deaf2b0a123bb30c8848,0xcbf85ca57df4b8b64be97d15c35810f56e93758a,6000000000000000,150000000000000, -optimism,opensea,v3,2023-01-17,0x6131624118010cebf4b1d739cdff9e78a951bdd287d4b832b632b9f6bd9d9d52,0,1,0xfa14e1157f35e1dad95dc3f822a9d18c40e360e2,1067246,0x26a25f95f321d0dc2988651913b607b9017fe4a3,0x5ecc9ce730061de9955b692548cff3b7db454368,444000000000000,11100000000000, -optimism,opensea,v3,2023-01-17,0x8fb18c2928e162af20881330d426578ab0ff497a23d64783ce81a3c754d76f04,0,1,0xfa14e1157f35e1dad95dc3f822a9d18c40e360e2,1115029,0xc3e8e833448a6d832deb0d187a164810c6291b68,0x15e3ca456b25fe8ef8bba804140f4c1d867f1fc2,1277900000000000,31947500000000, -optimism,opensea,v3,2023-01-17,0x59e0e830ce03678c81f7ed40f5d8f9d5024d624573acd6e3c025bfc890bf73a2,0,1,0xfa14e1157f35e1dad95dc3f822a9d18c40e360e2,1586636,0x415fc02ac3cb6300c97732fcc22ffd8060f4a0f2,0xff4bc6638916246df2abe32e584f05d40fe58e38,2800000000000000,70000000000000, -optimism,opensea,v3,2023-01-17,0x894a6ffea478953e520cb2d6fb89e5a97589d717ed7aa2402f4419971de8e1bc,0,1,0xfa14e1157f35e1dad95dc3f822a9d18c40e360e2,99191,0x2afd01591002e8d432627de68cad7964bd124871,0x2f277208a66abae03b24b8757d52b55b4d9ba9a7,8880000000000000,222000000000000, -optimism,opensea,v4,2023-04-11,0xa1f8e85909ef498f739c4be16e089861a5dd2cf894b462600019db92f1cfca25,0,1,0x1f4887dd2e4b94b9e83144cd11d83643c9e65430,579,0x0c0ffaaf6378cc0b4118f2752209a206a046d56e,0xa74a7dec78415ff444fb1c3fb8eba803fe5c42f5,1650000000000000,41250000000000,165000000000000 -optimism,opensea,v4,2023-04-11,0x9ddac43591a50876d222653c821c6d959bc4648b80717774a17b0e0f9cb38ce3,1,1,0xe22fd22b3fc0ecd5217d2461d15159a7dfc38790,0,0x744f617343f03bb7c9d52a6d84f87aa4b1017fac,0x346a0b4da75bb8294fa0e7acf6c0592b665e8c48,2352000000000000,58800000000000, -optimism,opensea,v4,2023-04-11,0x9ddac43591a50876d222653c821c6d959bc4648b80717774a17b0e0f9cb38ce3,0,1,0xe22fd22b3fc0ecd5217d2461d15159a7dfc38790,0,0x744f617343f03bb7c9d52a6d84f87aa4b1017fac,0xeb7cf646b90709a5f77e479669a2ccb2f08f8dc8,5870010500000000,146750262500000, -optimism,opensea,v4,2023-04-11,0xf21d2a61e0354f892b603e8e6d27977baed2afa01fe2e90b0d78cbea57f9711e,0,1,0xfa14e1157f35e1dad95dc3f822a9d18c40e360e2,1638348,0xf473de0df183cb762dd4817489d9357b0beb15fc,0x09953e0ebccf1fa2b808bb942c45e7ab40fd8c11,990000000000000,24750000000000, -optimism,opensea,v4,2023-04-11,0x412d8423b1c880b635636bc4060177e27761a07fab6f781cd5f9dfd6711ca085,1,1,0xe22fd22b3fc0ecd5217d2461d15159a7dfc38790,0,0xaf33bdbda6d4929a5112e8b3fbc8be4757c4dbe8,0xeb7cf646b90709a5f77e479669a2ccb2f08f8dc8,1170000000000000,29250000000000, -optimism,opensea,v4,2023-04-11,0xbf143be016cdd16d900c4bf95ae2bd6b47968a7da1118d45f6d9f02bf5da39fe,1,1,0xe22fd22b3fc0ecd5217d2461d15159a7dfc38790,0,0x5b605894f800e534d6d8370632398a767a54b2a0,0x346a0b4da75bb8294fa0e7acf6c0592b665e8c48,690000000000000,17250000000000, -optimism,opensea,v4,2023-04-11,0x3e9ec8b3ea07e6f9b929aaab596012121265a558fd492abcbd7418114517e5a1,0,1,0xe22fd22b3fc0ecd5217d2461d15159a7dfc38790,0,0xe98f343da5232bc7d99b45e8fe1e738a22b83b3e,0xbf137f3e501f5b8549fd0f5020be775b079c0ec1,1200000000000000,30000000000000, -optimism,opensea,v4,2023-04-11,0x6dde257aa21ec9f05bd2245785d89dd020ada76347a3f8028a226f9785b8679d,0,1,0x2f05e799c61b600c65238a9df060caba63db8e78,1,0xb7264811ce186586691f0fd8dd9b3e7f997affe5,0x997a861468f3a4ca26be2f754415479d74213b8b,690000000000000,17250000000000, -optimism,opensea,v4,2023-04-11,0x20ca9b91cf054527564f1b0e686d49f081b12171669be9232537dd446d1c06e4,0,1,0x11af3226b32701c7a7395ea2532c6c1ae906b6ae,2033,0x6d59931af25d136034671e024371eeeff838345d,0x0ecdf59596b285d769fd473a57b3ffbc9606ea15,2800000000000000,70000000000000,280000000000000 -optimism,opensea,v4,2023-04-11,0xd702b55459a46239095b609d88ae28d0bb23ea70c70014f670e26982b71eb746,1,1,0xe22fd22b3fc0ecd5217d2461d15159a7dfc38790,0,0xdfd5c1b2645ed0f33803fbfff0e0bf020f4bb25b,0xbdef6a773653c2364372ea16d62882bdb4a9feb4,1190000000000000,29750000000000, -optimism,opensea,v4,2023-04-11,0xc0aa9fd397bff99a141648d08e77c791c0820565b7384ba94e5401763d7fbb5b,1,1,0xe22fd22b3fc0ecd5217d2461d15159a7dfc38790,0,0xa83d16c382e2e5d436b6f645963853a42184fbd2,0xeb7cf646b90709a5f77e479669a2ccb2f08f8dc8,1174000000000000,29350000000000, -optimism,opensea,v4,2023-04-11,0x6f8292035c53510aebaaccfd1b68b264fdc7934bdd83cf565cfa6f54fb9b7c3a,1,1,0xe22fd22b3fc0ecd5217d2461d15159a7dfc38790,0,0x3312e8e1fa3cd72b4691d19429ce393435a34162,0xeb7cf646b90709a5f77e479669a2ccb2f08f8dc8,1174027000000000,29350675000000, -optimism,opensea,v4,2023-04-11,0xcd0692f64507eb2cc35cda5e52f9d093cfa7aa3e7a0f3b701ede9da1b58bc8e6,1,1,0xe22fd22b3fc0ecd5217d2461d15159a7dfc38790,0,0x3c5f6974aedf2b8180f27559efcd1e1b89bb8689,0xeb7cf646b90709a5f77e479669a2ccb2f08f8dc8,1174000000000000,29350000000000, -optimism,opensea,v4,2023-04-11,0xa12db84a2a1812715fe4e046a686185f6c75faa4e02901ab4e47ff8aac9e8f24,0,1,0xb18d96445eba9ee0e0d42d1c8ad113e12bdd8be4,716,0x20eebeb9f65027f0150d3cddd29a6f33fbecd319,0x3654be7bba479c999394737d043bc8c4b4d7879c,5400000000000000,135000000000000,540000000000000 \ No newline at end of file diff --git a/seeds/opensea/optimism/schema.yml b/seeds/opensea/optimism/schema.yml deleted file mode 100644 index d97142ec419..00000000000 --- a/seeds/opensea/optimism/schema.yml +++ /dev/null @@ -1,15 +0,0 @@ -version: 2 - -seeds: - - name: opensea_optimism_seaport_trades_samples - config: - column_types: - token_id: uint256 - tx_hash: varbinary - buyer: varbinary - seller: varbinary - nft_contract_address: varbinary - amount_raw: uint256 - platform_fee_amount_raw: uint256 - royalty_fee_amount_raw: uint256 - diff --git a/seeds/opensea/polygon/opensea_polygon_seaport_trades_samples.csv b/seeds/opensea/polygon/opensea_polygon_seaport_trades_samples.csv deleted file mode 100644 index 34c039b2ba1..00000000000 --- a/seeds/opensea/polygon/opensea_polygon_seaport_trades_samples.csv +++ /dev/null @@ -1,51 +0,0 @@ -blockchain,project,version,block_date,tx_hash,evt_index,sub_idx,nft_contract_address,token_id,buyer,seller,amount_raw,platform_fee_amount_raw,royalty_fee_amount_raw -polygon,opensea,v3,2023-02-19,0xfe1d38ad787ada5179c8e00b7cf31195dfedaa985c75764001462ffff143d45c,681,1,0x87eaeac4fce71752442eafca3cb2c5fb979851a1,4805,0xa911c01502e8183a854edc0db9fae2bc27cf986e,0xbad152dde94f9475158c81eb3010f376085079bb,1500000000000000000,,150000000000000000 -polygon,opensea,v3,2023-02-25,0xfffa729112ae8325e3dc0c1f8ed91220ae75c8747214f5c76ce9e14bbadb8da6,153,1,0x22d5f9b75c524fec1d6619787e582644cd4d7422,201,0xe16abd5205ad67a9369524f530d3acdb7dda6618,0xa04dee099b9d5ecf41e6f9b0ead429b62686acb5,158000000000000,,7900000000000 -polygon,opensea,v3,2022-09-22,0xc7beca9b987ae3beb12031f53343e3afb7f449a8b8b3e5b30e7086b566637e96,298,1,0xc7a096b4c6610ba3a836070333ff7922b9866a36,10000000012871,0xa1ac9882c1f2fa810eebad1adee4b71ee2454a19,0x9f21551c17007216e7ede249a0d0b56bafada70b,25000000000000000,625000000000000, -polygon,opensea,v3,2022-09-22,0xf7ddb9a8b972e56f9bffa223ba3c266387536e5cf7c6b6d20fea647ee409adbd,176,1,0xf021bf78b90f17a7b0dd2a071be5aaf5222c721b,1,0xdbecbe669c8d2e397d0f82570180934bb1834052,0x34df86fcb776811984a26ca0e21e8f5ab78efe3b,14000000000000000,350000000000000, -polygon,opensea,v3,2022-09-22,0x1bf58b0eaef3e3ff158fd40b1258ca3375e46e86a4ba40b39aa4a285d296e6de,231,1,0x2b4a66557a79263275826ad31a4cddc2789334bd,76504,0x02c5e05886a9be0ebfd3cb9e19652c0723faea5b,0x8152fff80c08adda55b524d3c287275f1c9bd671,3000000000000000000,75000000000000000,300000000000000000 -polygon,opensea,v3,2022-09-22,0x9ce4b5e4765b1fd32af0a34296adf95ae522a30e9cbfc0db84d18c4af11e6af1,327,1,0xcbc964dd716f07b4965b4526e30541a66f414ccf,12001,0xdaa914dd16cbb6fefcce34dff7e9a88f8531744a,0x0790523ee7ee48010f19f8a6707555fd92c8eb39,74999900000000000,1874997500000000,3749995000000000 -polygon,opensea,v3,2023-03-07,0xffb0d4ac4161622dd8e6ce309ad81c6c45a8cfc24c237622fb47b3843708c8d1,163,1,0x622d8fea4603ba9edaf1084b407052d8b0a9bed7,4021799,0x324edf2adb60cfc3471c3931fe0e43eaef986349,0x92d24d304c2a36e1c3d25a32f1bc98729a683cc8,95000000000000000,,4750000000000000 -polygon,opensea,v3,2023-01-24,0x849c0508b7b3dd8d61e4a0d29e9f8c700c958827bcae77a137cc3b3a196e34ad,463,1,0x48c75fbf0452fa8ff2928ddf46b0fe7629cca2ff,25,0xde88d43e523935ffb96124d6c3058f44561948ce,0xb8bf4cedfba620260a67b28c29ffeeca8ab35a1b,1520000000000000,38000000000000,152000000000000 -polygon,opensea,v3,2023-01-24,0x00b1879922558ee2d46bc37be568a852b793abd4336269aab3dcfce1c7aeb36d,1,1,0x5e40037d3c0b2afa1495582431f27a83d199a6d8,2242,0xf00d61e4a0484ad87ff5cfbd33aff1b4ea232814,0xaf4ac2f4c6787e81db915415eba3425b39fdf163,7350000000000000,183750000000000,551250000000000 -polygon,opensea,v3,2023-02-22,0xff3879843249432358bc2ea2d940709458b2d7bb7a03e76bde74e7e8847254c1,484,1,0x667570ae3212dc0cf98b46ccf151011ff310949b,4210,0x68704756a969bdea418b69db0c8bef9f5b9b0845,0x9f9fb9af3add5caf7f73816a0535083da89ec0ff,100000000000000000,,10000000000000000 -polygon,opensea,v3,2023-02-22,0xff3879843249432358bc2ea2d940709458b2d7bb7a03e76bde74e7e8847254c1,472,1,0x667570ae3212dc0cf98b46ccf151011ff310949b,3813,0x68704756a969bdea418b69db0c8bef9f5b9b0845,0x9f9fb9af3add5caf7f73816a0535083da89ec0ff,100000000000000000,,10000000000000000 -polygon,opensea,v3,2023-02-22,0xff3879843249432358bc2ea2d940709458b2d7bb7a03e76bde74e7e8847254c1,478,1,0x667570ae3212dc0cf98b46ccf151011ff310949b,3777,0x68704756a969bdea418b69db0c8bef9f5b9b0845,0x9f9fb9af3add5caf7f73816a0535083da89ec0ff,100000000000000000,,10000000000000000 -polygon,opensea,v3,2023-02-22,0xff3879843249432358bc2ea2d940709458b2d7bb7a03e76bde74e7e8847254c1,476,1,0x667570ae3212dc0cf98b46ccf151011ff310949b,3626,0x68704756a969bdea418b69db0c8bef9f5b9b0845,0x9f9fb9af3add5caf7f73816a0535083da89ec0ff,100000000000000000,,10000000000000000 -polygon,opensea,v3,2023-02-22,0xff3879843249432358bc2ea2d940709458b2d7bb7a03e76bde74e7e8847254c1,486,1,0x667570ae3212dc0cf98b46ccf151011ff310949b,3444,0x68704756a969bdea418b69db0c8bef9f5b9b0845,0x9f9fb9af3add5caf7f73816a0535083da89ec0ff,100000000000000000,,10000000000000000 -polygon,opensea,v3,2023-02-22,0xff3879843249432358bc2ea2d940709458b2d7bb7a03e76bde74e7e8847254c1,485,1,0x667570ae3212dc0cf98b46ccf151011ff310949b,3896,0x68704756a969bdea418b69db0c8bef9f5b9b0845,0x9f9fb9af3add5caf7f73816a0535083da89ec0ff,100000000000000000,,10000000000000000 -polygon,opensea,v3,2023-02-22,0xff3879843249432358bc2ea2d940709458b2d7bb7a03e76bde74e7e8847254c1,482,1,0x667570ae3212dc0cf98b46ccf151011ff310949b,3977,0x68704756a969bdea418b69db0c8bef9f5b9b0845,0x9f9fb9af3add5caf7f73816a0535083da89ec0ff,100000000000000000,,10000000000000000 -polygon,opensea,v3,2023-02-22,0xff3879843249432358bc2ea2d940709458b2d7bb7a03e76bde74e7e8847254c1,473,1,0x667570ae3212dc0cf98b46ccf151011ff310949b,3829,0x68704756a969bdea418b69db0c8bef9f5b9b0845,0x9f9fb9af3add5caf7f73816a0535083da89ec0ff,100000000000000000,,10000000000000000 -polygon,opensea,v3,2023-02-22,0xff3879843249432358bc2ea2d940709458b2d7bb7a03e76bde74e7e8847254c1,487,1,0x667570ae3212dc0cf98b46ccf151011ff310949b,4199,0x68704756a969bdea418b69db0c8bef9f5b9b0845,0x9f9fb9af3add5caf7f73816a0535083da89ec0ff,100000000000000000,,10000000000000000 -polygon,opensea,v3,2023-02-22,0xff3879843249432358bc2ea2d940709458b2d7bb7a03e76bde74e7e8847254c1,471,1,0x667570ae3212dc0cf98b46ccf151011ff310949b,3917,0x68704756a969bdea418b69db0c8bef9f5b9b0845,0x9f9fb9af3add5caf7f73816a0535083da89ec0ff,100000000000000000,,10000000000000000 -polygon,opensea,v3,2023-02-22,0xff3879843249432358bc2ea2d940709458b2d7bb7a03e76bde74e7e8847254c1,470,1,0x667570ae3212dc0cf98b46ccf151011ff310949b,3499,0x68704756a969bdea418b69db0c8bef9f5b9b0845,0x9f9fb9af3add5caf7f73816a0535083da89ec0ff,100000000000000000,,10000000000000000 -polygon,opensea,v3,2023-02-22,0xff3879843249432358bc2ea2d940709458b2d7bb7a03e76bde74e7e8847254c1,475,1,0x667570ae3212dc0cf98b46ccf151011ff310949b,3785,0x68704756a969bdea418b69db0c8bef9f5b9b0845,0x9f9fb9af3add5caf7f73816a0535083da89ec0ff,100000000000000000,,10000000000000000 -polygon,opensea,v3,2023-02-22,0xff3879843249432358bc2ea2d940709458b2d7bb7a03e76bde74e7e8847254c1,481,1,0x667570ae3212dc0cf98b46ccf151011ff310949b,3877,0x68704756a969bdea418b69db0c8bef9f5b9b0845,0x9f9fb9af3add5caf7f73816a0535083da89ec0ff,100000000000000000,,10000000000000000 -polygon,opensea,v3,2023-02-22,0xff3879843249432358bc2ea2d940709458b2d7bb7a03e76bde74e7e8847254c1,479,1,0x667570ae3212dc0cf98b46ccf151011ff310949b,3814,0x68704756a969bdea418b69db0c8bef9f5b9b0845,0x9f9fb9af3add5caf7f73816a0535083da89ec0ff,100000000000000000,,10000000000000000 -polygon,opensea,v3,2023-02-22,0xff3879843249432358bc2ea2d940709458b2d7bb7a03e76bde74e7e8847254c1,483,1,0x667570ae3212dc0cf98b46ccf151011ff310949b,3443,0x68704756a969bdea418b69db0c8bef9f5b9b0845,0x9f9fb9af3add5caf7f73816a0535083da89ec0ff,100000000000000000,,10000000000000000 -polygon,opensea,v4,2023-03-17,0x359c2cad36c7655aead7b6a82abb4b350f16c97d069da0b6caf8646f7a74ac97,4,1,0x3aa456d7b6b4bb6c13363c81e06240c1897da270,191032,0x9931ef91ea7ce55d584786044b7b47ffe66a9098,0xdb874494722b6ad8aa553b9049c0b490484c688d,1000000000000000000,5000000000000000, -polygon,opensea,v4,2023-03-17,0x9675110993fa6c3c92bc9100ad681afb964c7989b0dea3b45975d5a7ef376031,229,1,0x3aa456d7b6b4bb6c13363c81e06240c1897da270,77041,0xbf90248aa584f0f3524ce9c0d29f0423f3c1f9d4,0x4eaadd50e0492f93a1b41f8a492af5aaa25fecc9,3000000000000000000,15000000000000000, -polygon,opensea,v4,2023-03-17,0xd2ab88bd1e5ed0adddf161de4b22e6194f956b444b20cd97fa653429f5b28d4a,139,1,0xc8d3a3a83bde5dad06d436694e3e22ac3e64d577,928194,0x406115a0b6aae5d052601ea91256dc5c4121e311,0xd0382d975a7ccf3206cfb42771417e1371b162a3,7500000000000000,37500000000000,375000000000000 -polygon,opensea,v4,2023-03-17,0x1405f7b6652a62d948e565ebe1ad564b84c949bd2b688de6e26a6c5ab91a82d8,159,1,0xb581cc7a3211674d6484a11c8663b9011b600eee,0,0xeb428fa0ff5a3a097fabaff0709b932ffd0b0936,0x6cfb5f69c48f3211aecd4c6236842c35307cb111,14999999000000000,,749999950000000 -polygon,opensea,v4,2023-03-17,0x4b548fd1d21f4135c49e4a98be9ee3b90a0c6dbab788352a3416aaf8e6dffdc2,247,1,0x9d305a42a3975ee4c1c57555bed5919889dce63f,6258,0x49658c334d2d2c43638797ca09ab60ddbcf6ec8c,0x86de2b6e55ddb8b3a6caaffb307fadb63cdcf4f9,690000000000000000,,3450000000000000 -polygon,opensea,v4,2023-03-17,0xf2eb09440a75b52c2ee092c7429a2802d5beed3c94109843e3b7966d0fd94b1d,193,1,0x8634666ba15ada4bbc83b9dbf285f73d9e46e4c2,30954,0x547f6b586bed31883e0641de018ffeb6f9ed4bb7,0x4eeddad4153517407d906e97c319efc155e0fc21,8700000000000000,,87000000000000 -polygon,opensea,v4,2023-03-17,0x67bf46fcf3605a1175ad22c794ca9e8d9d0e2b330e80444d24e6a468dbd6a462,132,1,0x57a9b65ceac6c5ee0cec8cd4571a7c3805b558d8,4,0xc1f1d9c9322cddd420390113248792cf37630180,0xd6c46293b04b39c6c4d5f418ca72d5962f1fedcb,70000000000000,350000000000,7000000000000 -polygon,opensea,v4,2023-03-17,0xfbe1f276ff612a7a3918a2258d50d4326433a7ecf72f291f780ec5ef3dcbabf0,400,1,0x461aeb735b06295dbb85cd4f15578f0252b240cd,3688,0xb415f808d6821524a6ccd6afa92a59482d0e8955,0x045cc8b7c96d5c1825200891e0d07fba48ea5a34,3489432872000000,17447164360000,174471643600000 -polygon,opensea,v4,2023-03-17,0x0a7c0dec6d8943ac37655716a34a0cc3c7a53fca37b252ff5a48f7055d6eb08b,13,1,0x99a558bdbde247c2b2716f0d4cfb0e246dfb697d,110,0x8662967884d317cafac40288cdc37bb1494570e1,0xc1aa696e7ee1a06f1c9a22c657e5e6586d3c4db5,4910000000000000,,122750000000000 -polygon,opensea,v4,2023-03-17,0xc9d94c98c986356b2b8339691e39adf6c94ff7756ff14cf61eefd12e99a581c6,257,1,0x461aeb735b06295dbb85cd4f15578f0252b240cd,3960,0x4f960d763e2d153299f310432fd8e16f75cc9bca,0xe72f92bab38b9bb62714ffeb50d9aae18a21e1de,4126306955000000,20631534775000,206315347750000 -polygon,opensea,v4,2023-03-17,0xab52e57e7210031569b9b7085fdad9c6d9377c9518b63dc0c052cd6f0de48db2,249,1,0x24a11e702cd90f034ea44faf1e180c0c654ac5d9,8432,0xb8e8f66088deb559116d0b9cc0d03cc53d8eda44,0x37b45293aaf561a2cdf9e260bf984b643dd3699a,419000000000000000,,41900000000000000 -polygon,opensea,v4,2023-05-11,0xa0bb4e68659dfc4a7a45fbdd3e50c678b078ac8ec0f0806ab96a1c3882be2b97,161,1,0xdc0479cc5bba033b3e7de9f178607150b3abce1f,37391,0xea1ca730d3636744d2c58ebca793575db505cd4a,0xcf6ea7e74c2b5107e5f0d21c6f3915a91bf33f39,12200000000000000,305000000000000,305000000000000 -polygon,opensea,v4,2023-05-11,0x256a31ca135b92a4cb9e3d72b4d32244a9cbf02994d666066f5542f928f08b0a,842,1,0xdc0479cc5bba033b3e7de9f178607150b3abce1f,144657,0xafe572337b43702e2bc83da106d137e1b5c705ac,0x312349e885c5bdc9c01c14748c145bb87e45bc7e,5000000000000000,125000000000000,125000000000000 -polygon,opensea,v4,2023-05-11,0x98d28f22ab819da4f3468e7f816e316efc6e4e237eb3afffa5afe115906bcdbb,417,1,0x7cbccc4a1576d7a05eb6f6286206596bcbee14ac,1,0x9ce16b0ff00cea66c954efcd6bc93c7bf2c06c3d,0x0f4eeb30ece8d741b2dd142aaf11d549d23f5e03,1990000000000000,49750000000000,99500000000000 -polygon,opensea,v4,2023-05-11,0x0f2b51a501efe6bea57a7fe6852a071d37522d5e10629e71f5f88ff68cf8aa5f,174,1,0x22d5f9b75c524fec1d6619787e582644cd4d7422,612,0x9ee280b9ab8a33a88cfba45f1b184d79bf552c3d,0xbc1bc43efa8c3b4153fb125bde6dccd7e3e5bd72,2000000,50000,100000 -polygon,opensea,v4,2023-05-11,0x54c80f2785a64f63cb3d9e9fa8993402ce037286c8b8a262f0a39b6b7776e444,159,1,0x4bb5b2461e9ef782152c3a96698b2a4cf55b6162,28,0x2e8f5b800b971bfbde9b1775d9147af7cae9ca61,0x6001620237a35aa07b0f50337e347d824423aff0,2320000,58000,232000 -polygon,opensea,v4,2023-05-11,0xe7eab72a720cd29c2c84aa31fe71c9d4fac23e944cedad24143a8d98492addcf,258,1,0xba6666b118f8303f990f3519df07e160227cce87,36,0x71f7a3a5d833e49023c93b5aa9aa385c60c2bf3b,0x935dd9b73b62c1377c0f699544145bb6de1ac77b,120000000000000000,3000000000000000,12000000000000000 -polygon,opensea,v4,2023-05-11,0xe16eb078461675a7de703b039321cb18c378464f8a81d3c8146b6356314d9adc,115,1,0xba6666b118f8303f990f3519df07e160227cce87,24,0xa23166921339b2ee682918a76b3194b302260932,0x3134db15d15dcf8ec926e9145bb1b889bc025631,7107000000000000000,177675000000000000,710700000000000000 -polygon,opensea,v4,2023-05-11,0x14dd17243359fa7f25e28625569be5eb626c2ecaceab554e92b36f29b9ffa54a,14,1,0xef453154766505feb9dbf0a58e6990fd6eb66969,4236,0xef0b56692f78a44cf4034b07f80204757c31bcc9,0x5974edb5e30f260e1b45bd816a75c6cfbc573d7c,36000000000000000,900000000000000,3600000000000000 -polygon,opensea,v4,2023-05-11,0x2d2d09ef9ea1e55e7d805d538c61bfe7cc6db6f504cb8cf31e628f78e9bfc131,631,1,0x7e846523cb8a8de443b795a40cf5d63b35791c1c,192,0xf2137bedaa5ecbc935f6b32b18d48dcaae3cb7d9,0x0274f1e0f156d63c9a0ee922d62c9c4d5cc5414e,1000000000000000,25000000000000,50000000000000 -polygon,opensea,v4,2023-05-11,0xe001a1f7789a14d4f20890aa047122f0ceb63178c4113fac0a73e5d7dc37f50b,327,1,0x99a558bdbde247c2b2716f0d4cfb0e246dfb697d,55,0x5314b430520257fcb572e38a40e0c4894fe3950e,0x4bf9a0f7f49cb4fd5cdf1d43b80a1db867072d67,8800000000000000000,220000000000000000,220000000000000000 -polygon,opensea,v4,2023-05-11,0x154ad43d340718c224e9eacf839bef48627d72cbca327ab294223d385f52b813,316,1,0xc6210509389fdac176d68a35d021c095ba657b82,9969,0x81f8f0ee2eb45310b44f5c407628dfd4596d2059,0xe72a829e88b24ad492c92bf499e5d8d2cc71c72d,800000000000000000,20000000000000000,80000000000000000 -polygon,opensea,v4,2023-05-11,0x154ad43d340718c224e9eacf839bef48627d72cbca327ab294223d385f52b813,317,1,0xc6210509389fdac176d68a35d021c095ba657b82,4981,0x81f8f0ee2eb45310b44f5c407628dfd4596d2059,0x3ca34a6d50ca99b8d91007776d701fcc7880e950,800000000000000000,20000000000000000,80000000000000000 -polygon,opensea,v4,2023-05-11,0x94cd09fb45ef8060035add64ddc7910f406d7555ac87e033e2cdc2e36c14911b,803,1,0xba6666b118f8303f990f3519df07e160227cce87,7,0x8b2e8c120e28068663cbfc2a245bea4ef797ecd5,0x77372cf0e82af8c0e0c1e6e19c9e9edad39fbb36,250000000000000000,6250000000000000,25000000000000000 -polygon,opensea,v4,2023-05-11,0x4ff0e6f91b45525945066dddc5629c5eb116ab52b025d755ea361c4ed0a3a97e,4398,1,0x624e4fa6980afcf8ea27bfe08e2fb5979b64df1c,44845,0xad5ae1b5c8091c0aedb4abc73beed9eeaa3e97f4,0xe9fbe9cb3bad6f3faddc696ca555e60681c77737,1099000000000000000,27475000000000000,109900000000000000 -polygon,opensea,v4,2023-05-11,0xac42c1ac9732463d135764ad931c0aaebd2b33f93f76d8957bdb932a96552354,408,1,0x5d666f215a85b87cb042d59662a7ecd2c8cc44e6,12274009,0x5c5066c61c9ff7a5965b1d78f8e26a8b71dd054b,0x248dae0c51eb25542521fca470bf422885a668b7,20000000000000000,500000000000000, diff --git a/seeds/opensea/polygon/schema.yml b/seeds/opensea/polygon/schema.yml index 02d494eab9b..47c808ed4d4 100644 --- a/seeds/opensea/polygon/schema.yml +++ b/seeds/opensea/polygon/schema.yml @@ -12,15 +12,3 @@ seeds: price_raw: uint256 platform_fee_amount_raw: uint256 royalty_fee_amount_raw: uint256 - - - name: opensea_polygon_seaport_trades_samples - config: - column_types: - token_id: uint256 - tx_hash: varbinary - buyer: varbinary - seller: varbinary - nft_contract_address: varbinary - amount_raw: uint256 - platform_fee_amount_raw: uint256 - royalty_fee_amount_raw: uint256 diff --git a/seeds/opensea/arbitrum/schema.yml b/seeds/opensea/schema.yml similarity index 70% rename from seeds/opensea/arbitrum/schema.yml rename to seeds/opensea/schema.yml index 8747507887a..013bebbf66b 100644 --- a/seeds/opensea/arbitrum/schema.yml +++ b/seeds/opensea/schema.yml @@ -1,15 +1,15 @@ version: 2 seeds: - - name: opensea_arbitrum_seaport_trades_samples + - name: opensea_seaport_trades_samples config: column_types: - token_id: uint256 + nft_token_id: uint256 tx_hash: varbinary buyer: varbinary seller: varbinary + price_raw: uint256 nft_contract_address: varbinary - amount_raw: uint256 platform_fee_amount_raw: uint256 royalty_fee_amount_raw: uint256 diff --git a/seeds/opensea/zora/opensea_zora_seaport_trades_samples.csv b/seeds/opensea/zora/opensea_zora_seaport_trades_samples.csv deleted file mode 100644 index 4f2cf977743..00000000000 --- a/seeds/opensea/zora/opensea_zora_seaport_trades_samples.csv +++ /dev/null @@ -1,14 +0,0 @@ -blockchain,project,version,block_date,tx_hash,evt_index,sub_idx,nft_contract_address,token_id,buyer,seller,amount_raw,platform_fee_amount_raw,royalty_fee_amount_raw -zora,opensea,v4,2024-03-07,0x36f536069a3c25483278c597148d8038bb06d377ffb7a57f5f86c43a6296dd6e,1,1,0x266b7e8df0368dd4006be5469dd4ee13ea53d3a4,560918,0xd94b9a07f7823cedeee3e5955a37c55e88a998b2,0xd24425e7d3c239d7fba892e19899bcdc4322eedd,20000000000000,500000000000, -zora,opensea,v4,2024-03-07,0x67043d84c0bce1d95b133f1e04b0a73c6af3e869fcb688c329ae86dc8e7ea072,1,1,0xc51ba90509e1d3a5cb5a78e21705a844abfb8172,1,0x3a49b43bd994f3ce7dde3a8af6d0a5660dbaaa2a,0x3dbd05fd99be44e03dc962837b7cc40a4a55b116,1900000000000000,47500000000000, -zora,opensea,v4,2024-03-07,0xf67931c83460914310b2a481683a573a8b9cbfd98d46a78853ca9c1e2eb04c6e,1,1,0xab598a164729d88fa04a72b8420556ab9de756a8,3,0x3a49b43bd994f3ce7dde3a8af6d0a5660dbaaa2a,0xfe8ceb5eeb7de237fcb047747551b581371dfa87,1195000000000000,29875000000000, -zora,opensea,v4,2024-03-07,0x10a1801a192307fc447e0564b501148e7744950004c1dc20e60523e6c69d065c,3,1,0x09dd68c87020055a19733a6ccd7bfc7e7dfb3483,50784,0x215271c23ee0781dcf8fcb64790bb88b694b7fc5,0xd651b62a886e4cc9ce865b5dfb295fd77d2224a5,1098990000000000,27474750000000, -zora,opensea,v4,2024-03-07,0xb78975c5d768c8e933c81c462903c7374f421d89f5c227c22ef27abe892881b8,5,1,0xc673832ff7995d9eacaf198b5ab94eaef0499341,2,0xfc258b128dd2839666530eb0611b5c00735a5aaa,0xd1f6a55632ff7a0cc635cd649e62e355f8e17fc8,789000000000000,19725000000000, -zora,opensea,v4,2024-03-07,0x6c9f8b1e4fc52d38e7e0e16763c6f1bc921a6f856f2641f8d267444540ec8523,1,1,0x060f3edd18c47f59bd23d063bbeb9aa4a8fec6df,1,0xfc6fc698a19f95832ecee8cdb9e55cb8f475a6e8,0x922197fd26290e3af3da0c35e7f4f299d95e8741,899000000000000,22475000000000, -zora,opensea,v4,2024-03-07,0x337d9dd461f50d52d8dc44d61918cbddf005ad5c01f077d60f78a156c76331cf,1,1,0xb9a2f7762c890b243c92348cbb2b1ff31e4d7fda,1,0xa0434628d6f56ff5291096a29356205323bc91da,0x89fbe203edcc8dc1cca45b672e48f7b8ea04433a,2800000000000000,70000000000000,140000000000000 -zora,opensea,v4,2024-02-29,0x84cf93a1cce030053756d2524a8347c9a4d80dd55f93d7c4e02926caca85eaea,1,1,0x03fee76c3901d802407b0e3b1259657ef2e163a4,16,0x28faef4c17dd9c3da8864c2ff37e00c0df15e3d4,0x1935cc900625c6f077a7489fe2c9de0e6dc815dc,1400000000000000,35000000000000,70000000000000 -zora,opensea,v4,2024-02-29,0xaf1b34558066e39d643e680759e9947119da0d3d17bb82a08c5d6fce2a62ba56,0,1,0xc278e830b07ba22eae411af7f3b0396907856156,10144,0xb7005bd95ee95feb3a7ce143bf628340c99f1104,0x71d0953075c39f4b3da1625ec848e278ff91d15a,13000000000000,325000000000, -zora,opensea,v4,2023-08-10,0xfd56694982b1bcfe92b5eeb4459644d24d99aa6a7d5adbacab645077b9b567cd,0,1,0x22ebbcb38a0666f09042b02f0e2bfe930c33eacb,18874,0xbf0d78ebe5e2c5a8ed9dbe42d539f5e8ea115d61,0x475060616fd5b39a1a2ee5ef07e0c163b3f0df7d,1690000000000000,42250000000000,33800000000000 -zora,opensea,v4,2023-09-09,0x817366ec6040785c4697b835bb207579bf7375749577d484a3ad77494e604de3,1,1,0x199a21f0be1cdcdd882865e7d0f462e4778c5ee4,79285,0xcfe86281728d140d4796ae2fe20c6533b5fae104,0x4c9f29229c47c4207e05923a3121dd7d51783454,8000000000000,200000000000, -zora,opensea,v4,2023-09-09,0x8f400349a2c838ea5b1ff653d4a8fe5408a7154a3e6f7c91ad105bafd44d549b,108,1,0x09dd68c87020055a19733a6ccd7bfc7e7dfb3483,63954,0x3625eff632eab044489a46014dd168ccb5112240,0xb54638bb3327df2df142fde3b957725dde2e5732,1790000000000000,44750000000000, -zora,opensea,v4,2023-10-13,0x8abdafe547e508cce677552a0ce64765b32abdd5ec2d5472513b6c6be1ba1a8c,5,1,0x5921a344e85553d8ec7f8510917d38aaa8d21081,12064,0xa1551c98a14f36631ac8737bb21ffe4d6c57d987,0xcc65acb37028b18c0103ef53b28b73e39db201bb,3880000000000000,97000000000000,194000000000000 diff --git a/seeds/opensea/zora/schema.yml b/seeds/opensea/zora/schema.yml deleted file mode 100644 index 10076fa3dcf..00000000000 --- a/seeds/opensea/zora/schema.yml +++ /dev/null @@ -1,14 +0,0 @@ -version: 2 - -seeds: - - name: opensea_zora_seaport_trades_samples - config: - column_types: - token_id: uint256 - tx_hash: varbinary - buyer: varbinary - seller: varbinary - nft_contract_address: varbinary - amount_raw: uint256 - platform_fee_amount_raw: uint256 - royalty_fee_amount_raw: uint256 \ No newline at end of file From 089dd063ea8f5e54812601e8ff1a3ab24bd1cabf Mon Sep 17 00:00:00 2001 From: 0xRob <83790096+0xRobin@users.noreply.github.com> Date: Mon, 3 Jun 2024 21:59:53 +0200 Subject: [PATCH 027/149] chore: review solana trades setup (#5979) * chore: review solana trades setup * chore: review solana trades setup * exclude * syntax * currency contract * add types * fix ref * fix more types * fix * types * include into nft base trades * test * re-enable magiceden model * revert changes * remove double refs --------- Co-authored-by: jeff-dude <102681548+jeff-dude@users.noreply.github.com> --- .../trades/chains/old/nft_old_base_trades.sql | 4 +- .../chains/solana/nft_solana_base_trades.sql | 41 ++++++++ .../chains/solana/nft_solana_old_trades.sql | 70 ++++++++++++++ .../chains/solana/nft_solana_trades.sql | 5 +- .../solana/nft_solana_trades_schema.yml | 18 +++- .../nft/trades/chains/solana/old/_schema.yml | 29 ++++++ .../solana/old/magiceden_solana_schema.yml | 96 ------------------- .../solana/old/opensea_solana_schema.yml | 50 ---------- 8 files changed, 160 insertions(+), 153 deletions(-) create mode 100644 models/_sector/nft/trades/chains/solana/nft_solana_base_trades.sql create mode 100644 models/_sector/nft/trades/chains/solana/nft_solana_old_trades.sql create mode 100644 models/_sector/nft/trades/chains/solana/old/_schema.yml delete mode 100644 models/_sector/nft/trades/chains/solana/old/magiceden_solana_schema.yml delete mode 100644 models/_sector/nft/trades/chains/solana/old/opensea_solana_schema.yml diff --git a/models/_sector/nft/trades/chains/old/nft_old_base_trades.sql b/models/_sector/nft/trades/chains/old/nft_old_base_trades.sql index f45f07504cc..a75064b76cf 100644 --- a/models/_sector/nft/trades/chains/old/nft_old_base_trades.sql +++ b/models/_sector/nft/trades/chains/old/nft_old_base_trades.sql @@ -8,11 +8,9 @@ -- while we refactor more marketplace models, they should be removed here and added to the chain specific base_trades unions. {% set nft_models = [ -ref('magiceden_solana_events') -,ref('nftearth_optimism_events') +ref('nftearth_optimism_events') ,ref('mooar_polygon_events') ,ref('oneplanet_polygon_events') -,ref('opensea_solana_events') ,ref('quix_seaport_optimism_events') ] %} diff --git a/models/_sector/nft/trades/chains/solana/nft_solana_base_trades.sql b/models/_sector/nft/trades/chains/solana/nft_solana_base_trades.sql new file mode 100644 index 00000000000..c56e6060a1d --- /dev/null +++ b/models/_sector/nft/trades/chains/solana/nft_solana_base_trades.sql @@ -0,0 +1,41 @@ +{{ config( + schema = 'nft_solana', + alias = 'base_trades', + materialized = 'view' + ) +}} + +-- transformative view to get the solana trades into nft.trades as much as possible +-- columns are filled on a best effort basis, but many will probably hold null values.. +-- the main goal is to get transaction count and overall volume correct +-- any values cast to varbinary will be wrongly encoded but will still hold equality and uniqueness constraints + + +SELECT + blockchain, + project, + version as project_version, + block_date, + block_month, + block_time, + block_slot as block_number, + cast(tx_id as varbinary) as tx_hash, + cast(project_program_id as varbinary) as project_contract_address, + trade_category, + trade_type, + cast(buyer as varbinary) as buyer, + cast(seller as varbinary) as seller, + cast(null as varbinary) as nft_contract_address, + cast(null as uint256) as nft_token_id, + coalesce(try(cast(number_of_items as uint256)), uint256 '0') as nft_amount, + coalesce(try(cast(amount_raw as uint256)), uint256 '0') as price_raw, + case when currency_symbol = 'SOL' then 0x069b8857feab8184fb687f634618c035dac439dc1aeb3b5598a0f00000000001 else null end as currency_contract, + coalesce(try(cast(taker_fee_amount_raw + maker_fee_amount_raw as uint256)), uint256 '0') as platform_fee_amount_raw, + coalesce(try(cast(royalty_fee_amount_raw as uint256)), uint256 '0') as royalty_fee_amount_raw, + cast(null as varbinary) as platform_fee_address, + cast(null as varbinary) as royalty_fee_address, + cast(null as varbinary) as tx_from, + cast(null as varbinary) as tx_to, + cast(null as varbinary) as tx_data_marker, -- forwarc compatibility with aggregator marker matching + row_number() over (partition by tx_id order by leaf_id) as sub_tx_trade_id -- intermediate fix to fill this column +FROM {{ ref('nft_solana_trades') }} diff --git a/models/_sector/nft/trades/chains/solana/nft_solana_old_trades.sql b/models/_sector/nft/trades/chains/solana/nft_solana_old_trades.sql new file mode 100644 index 00000000000..9cc7d9221b0 --- /dev/null +++ b/models/_sector/nft/trades/chains/solana/nft_solana_old_trades.sql @@ -0,0 +1,70 @@ +{{ config( + schema = 'nft_solana', + alias = 'old_trades', + materialized = 'view' + ) +}} + + +-- while we refactor more marketplace models, they should be removed here and added to the chain specific base_trades unions. +{% set nft_models = [ +ref('magiceden_solana_events') +,ref('opensea_solana_events') +] %} + + +-- we have to do some column wrangling here to convert the old schema to the new schema +-- lots of columns will hold null values.. +SELECT * FROM ( +{% for nft_model in nft_models %} + SELECT + blockchain, + project, + version, + cast(date_trunc('day', block_time) as date) as block_date, + cast(date_trunc('month', block_time) as date) as block_month, + block_time, + case when evt_type = 'Mint' then 'primary' else 'secondary' end as trade_type, + number_of_items, + trade_category, + cast(buyer as varchar) as buyer, + cast(seller as varchar) as seller, + amount_raw, + amount_original, + amount_usd, + currency_symbol, + cast(currency_contract as varchar) as currency_address, + cast(null as varchar) as account_merkle_tree, + cast(null as uint256) as leaf_id, + cast(null as varchar) as account_mint, + cast(null as varchar) as project_program_id, + aggregator_name, + cast(aggregator_address as varchar) as aggregator_address, + cast(tx_hash as varchar) as tx_id, + block_number as block_slot, + cast(null as varchar) as tx_signer, + cast(null as double) as taker_fee_amount_raw, + cast(null as double) as taker_fee_amount, + cast(null as double) as taker_fee_amount_usd, + cast(null as double) as taker_fee_percentage, + cast(null as double) as maker_fee_amount_raw, + cast(null as double) as maker_fee_amount, + cast(null as double) as maker_fee_amount_usd, + cast(null as double) as maker_fee_percentage, + royalty_fee_amount_raw, + royalty_fee_amount, + royalty_fee_amount_usd, + royalty_fee_percentage, + cast(null as double) as amm_fee_amount_raw, + cast(null as double) as amm_fee_amount, + cast(null as double) as amm_fee_amount_usd, + cast(null as double) as amm_fee_percentage, + cast(null as varchar) as instruction, + cast(null as integer) as outer_instruction_index, + cast(null as integer) as inner_instruction_index + FROM {{ nft_model }} + {% if not loop.last %} + UNION ALL + {% endif %} + {% endfor %} +) diff --git a/models/_sector/nft/trades/chains/solana/nft_solana_trades.sql b/models/_sector/nft/trades/chains/solana/nft_solana_trades.sql index f4d9f540360..51abd2c81ff 100644 --- a/models/_sector/nft/trades/chains/solana/nft_solana_trades.sql +++ b/models/_sector/nft/trades/chains/solana/nft_solana_trades.sql @@ -1,7 +1,7 @@ {{ config( schema = 'nft_solana' - + , alias = 'trades' , materialized = 'view' ,post_hook='{{ expose_spells(\'["solana"]\', @@ -17,6 +17,7 @@ , ref('magiceden_mmm_solana_trades') , ref('tensorswap_v1_solana_trades') , ref('tensorswap_v2_solana_trades') + , ref('nft_solana_old_trades') ] %} @@ -71,4 +72,4 @@ FROM {{ marketplace }} {% if not loop.last %} UNION ALL {% endif %} -{% endfor %} \ No newline at end of file +{% endfor %} diff --git a/models/_sector/nft/trades/chains/solana/nft_solana_trades_schema.yml b/models/_sector/nft/trades/chains/solana/nft_solana_trades_schema.yml index de9c7564c55..a359956cace 100644 --- a/models/_sector/nft/trades/chains/solana/nft_solana_trades_schema.yml +++ b/models/_sector/nft/trades/chains/solana/nft_solana_trades_schema.yml @@ -23,7 +23,7 @@ models: - &block_time name: block_time description: "UTC event block time" - - &block_date + - &block_date name: block_date - &block_month name: block_month @@ -135,4 +135,18 @@ models: description: "outer index of instruction call" - &inner_instruction_index name: inner_instruction_index - description: "inner index of instruction call" \ No newline at end of file + 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' ] diff --git a/models/_sector/nft/trades/chains/solana/old/_schema.yml b/models/_sector/nft/trades/chains/solana/old/_schema.yml new file mode 100644 index 00000000000..32618cd7f37 --- /dev/null +++ b/models/_sector/nft/trades/chains/solana/old/_schema.yml @@ -0,0 +1,29 @@ +version: 2 + +models: + - name: magiceden_solana_events + meta: + blockchain: solana + project: magiceden + contributors: soispoke + config: + tags: ['magiceden','solana','events'] + description: > + Magic Eden events on Solana + tests: + - check_columns_nft_old_events + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - unique_trade_id + + - name: opensea_solana_events + meta: + blockchain: solana + project: opensea + contributors: rchen8, soispoke + config: + tags: [ 'solana','opensea','events' ] + description: > + OpenSea events on Solana + tests: + - check_columns_nft_old_events diff --git a/models/_sector/nft/trades/chains/solana/old/magiceden_solana_schema.yml b/models/_sector/nft/trades/chains/solana/old/magiceden_solana_schema.yml deleted file mode 100644 index e7d54fdef4b..00000000000 --- a/models/_sector/nft/trades/chains/solana/old/magiceden_solana_schema.yml +++ /dev/null @@ -1,96 +0,0 @@ -version: 2 - -models: - - name: magiceden_solana_events - meta: - blockchain: solana - project: magiceden - contributors: soispoke - config: - tags: ['magiceden','solana','events'] - description: > - Magic Eden events on Solana - tests: - - check_columns_nft_old_events - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - unique_trade_id - columns: - - &blockchain - name: blockchain - description: "Blockchain" - - &tx_hash - name: tx_hash - description: "Transaction hash" - - &block_time - name: block_time - description: "UTC event block time" - - &token_id - name: token_id - description: "NFT Token ID. In Solana case, we display the token address" - - ¤cy_symbol - name: currency_symbol - description: "Currency Symbol of the trade value" - - ¤cy_contract - name: currency_contract - description: "Contract address of the currency in which the trade is denominated in" - - &token_standard - name: token_standard - description: "Token standard (Metaplex for Solana NFTs)" - - &trade_type - name: trade_type - description: "Identify whether it was a single NFT trade or multiple NFTs traded" - - &amount_original - name: amount_original - description: "Value of the trade at time of execution in the original currency" - - &amount_usd - name: amount_usd - description: "USD value of the trade at time of execution" - - &number_of_items - name: number_of_items - description: "Number of items traded" - - &project_contract_address - name: project_contract_address - description: "Contract address used by the v1 project" - - &evt_type - name: evt_type - description: "Event type (Trade, Mint, Burn, Bid, List)" - - &seller - name: seller - description: "Seller wallet address" - - &buyer - name: buyer - description: "Buyer wallet address" - - &platform_fee_amount_raw - name: platform_fee_amount_raw - description: "Raw numerical amount for platform fees" - - &platform_fee_amount - name: platform_fee_amount - description: "Platform fee amount in original token currency (properly formatted in decimals)" - - &platform_fee_amount_usd - name: platform_fee_amount_usd - description: "Platform fee amount in USD" - - &platform_fee_percentage - name: platform_fee_amount_usd - description: "Platform fee in % of the amount paid for a given trade" - - &royalty_fee_amount_raw - name: royalty_fee_amount_raw - description: "Raw numerical amount for royalty fees" - - &royalty_fee_amount - name: royalty_fee_amount - description: "Royalty fee amount in original token currency (properly formatted in decimals)" - - &royalty_fee_amount_usd - name: royalty_fee_amount_usd - description: "Royalty fee amount in USD" - - &royalty_fee_percentage - name: royalty_fee_percentage - description: "Royalty fee in % of the amount paid for a given trade" - - &royalty_fee_currency_symbol - name: royalty_fee_currency_symbol - description: "Symbol of the token in which fees are paid out" - - &unique_trade_id - name: unique_trade_id - description: "Unique trade id, combination of signatures[0] and id" - tests: - - unique - - not_null diff --git a/models/_sector/nft/trades/chains/solana/old/opensea_solana_schema.yml b/models/_sector/nft/trades/chains/solana/old/opensea_solana_schema.yml deleted file mode 100644 index 4e809fa7736..00000000000 --- a/models/_sector/nft/trades/chains/solana/old/opensea_solana_schema.yml +++ /dev/null @@ -1,50 +0,0 @@ -version: 2 - -models: - - name: opensea_solana_events - meta: - blockchain: solana - project: opensea - contributors: rchen8, soispoke - config: - tags: ['solana','opensea','events'] - description: > - OpenSea events on Solana - tests: - - check_columns_nft_old_events - columns: - - &blockchain - name: blockchain - description: "Blockchain" - - &tx_hash - name: tx_hash - description: "Transaction hash" - - &block_time - name: block_time - description: "UTC event block time" - - ¤cy_symbol - name: currency_symbol - description: "Currency Symbol of the trade value" - - ¤cy_contract - name: currency_contract - description: "Contract address of the currency in which the trade is denominated in" - - &token_standard - name: token_standard - description: "Token standard (Metaplex for Solana NFTs)" - - &amount_original - name: amount_original - description: "Value of the trade at time of execution in the original currency" - - &amount_usd - name: amount_usd - description: "USD value of the trade at time of execution" - - &project_contract_address - name: project_contract_address - description: "Contract address used by the v1 project" - - &evt_type - name: evt_type - description: "Event type (Trade, Mint, Burn, Transaction)" - - &unique_trade_id - name: unique_trade_id - description: "Unique trade id, combination of signatures[0] and id" - tests: - - unique From 1363339659874d54df8a2c0f8af97facee39f2be Mon Sep 17 00:00:00 2001 From: jeff-dude <102681548+jeff-dude@users.noreply.github.com> Date: Mon, 3 Jun 2024 16:11:34 -0400 Subject: [PATCH 028/149] one file per subproject (#6059) --- .../_subprojects/daily_spellbook/_sources.yml | 18 ++++++++++++++++++ .../daily_spellbook/chainlink_sources.yml | 9 --------- .../daily_spellbook/contracts_sources.yml | 10 ---------- ...dresses_events_sources.yml => _sources.yml} | 18 +++++++++--------- sources/_subprojects/spellbook/abi_sources.yml | 6 ------ .../_subprojects/spellbook/bridge_sources.yml | 6 ------ .../_subprojects/spellbook/uniswap_sources.yml | 6 ------ 7 files changed, 27 insertions(+), 46 deletions(-) create mode 100644 sources/_subprojects/daily_spellbook/_sources.yml delete mode 100644 sources/_subprojects/daily_spellbook/chainlink_sources.yml delete mode 100644 sources/_subprojects/daily_spellbook/contracts_sources.yml rename sources/_subprojects/spellbook/{addresses_events_sources.yml => _sources.yml} (82%) delete mode 100644 sources/_subprojects/spellbook/abi_sources.yml delete mode 100644 sources/_subprojects/spellbook/bridge_sources.yml delete mode 100644 sources/_subprojects/spellbook/uniswap_sources.yml diff --git a/sources/_subprojects/daily_spellbook/_sources.yml b/sources/_subprojects/daily_spellbook/_sources.yml new file mode 100644 index 00000000000..197b52c324a --- /dev/null +++ b/sources/_subprojects/daily_spellbook/_sources.yml @@ -0,0 +1,18 @@ +version: 2 +sources: + - name: chainlink + tables: + - name: price_feeds + + - name: chainlink_ethereum + tables: + - name: price_feeds + + - name: contracts + tables: + - name: system_predeploys + + - name: contracts_optimism + tables: + - name: disperse_contracts + - name: contract_creator_project_mapping \ No newline at end of file diff --git a/sources/_subprojects/daily_spellbook/chainlink_sources.yml b/sources/_subprojects/daily_spellbook/chainlink_sources.yml deleted file mode 100644 index cbae66c916d..00000000000 --- a/sources/_subprojects/daily_spellbook/chainlink_sources.yml +++ /dev/null @@ -1,9 +0,0 @@ -version: 2 -sources: - - name: chainlink - tables: - - name: price_feeds - - - name: chainlink_ethereum - tables: - - name: price_feeds diff --git a/sources/_subprojects/daily_spellbook/contracts_sources.yml b/sources/_subprojects/daily_spellbook/contracts_sources.yml deleted file mode 100644 index 78990cc8d40..00000000000 --- a/sources/_subprojects/daily_spellbook/contracts_sources.yml +++ /dev/null @@ -1,10 +0,0 @@ -version: 2 -sources: - - name: contracts - tables: - - name: system_predeploys - - - name: contracts_optimism - tables: - - name: disperse_contracts - - name: contract_creator_project_mapping diff --git a/sources/_subprojects/spellbook/addresses_events_sources.yml b/sources/_subprojects/spellbook/_sources.yml similarity index 82% rename from sources/_subprojects/spellbook/addresses_events_sources.yml rename to sources/_subprojects/spellbook/_sources.yml index c919286516c..dacbe372c60 100644 --- a/sources/_subprojects/spellbook/addresses_events_sources.yml +++ b/sources/_subprojects/spellbook/_sources.yml @@ -1,12 +1,13 @@ - version: 2 sources: + - name: abi + tables: + - name: signatures - name: addresses_events_optimism tables: - name: first_activity - name: first_funded_by - - name: addresses_events_arbitrum tables: - name: first_funded_by @@ -16,34 +17,33 @@ sources: - name: addresses_events_bnb tables: - name: first_funded_by - - name: addresses_events_base tables: - name: first_funded_by - - name: addresses_events_celo tables: - name: first_funded_by - - name: addresses_events_ethereum tables: - name: first_funded_by - - name: addresses_events_gnosis tables: - name: first_funded_by - - name: addresses_events_polygon tables: - name: first_funded_by - name: addresses_events_scroll tables: - name: first_funded_by - - name: addresses_events_zksync tables: - name: first_funded_by - - name: addresses_events_zora tables: - name: first_funded_by + - name: bridge_optimism + tables: + - name: standard_bridge_flows + - name: uniswap_v3_optimism + tables: + - name: ovm1_pool_mapping \ No newline at end of file diff --git a/sources/_subprojects/spellbook/abi_sources.yml b/sources/_subprojects/spellbook/abi_sources.yml deleted file mode 100644 index 5e9594292f4..00000000000 --- a/sources/_subprojects/spellbook/abi_sources.yml +++ /dev/null @@ -1,6 +0,0 @@ -version: 2 - -sources: - - name: abi - tables: - - name: signatures \ No newline at end of file diff --git a/sources/_subprojects/spellbook/bridge_sources.yml b/sources/_subprojects/spellbook/bridge_sources.yml deleted file mode 100644 index 1aa9af87eb3..00000000000 --- a/sources/_subprojects/spellbook/bridge_sources.yml +++ /dev/null @@ -1,6 +0,0 @@ -version: 2 - -sources: - - name: bridge_optimism - tables: - - name: standard_bridge_flows \ No newline at end of file diff --git a/sources/_subprojects/spellbook/uniswap_sources.yml b/sources/_subprojects/spellbook/uniswap_sources.yml deleted file mode 100644 index 34980db551e..00000000000 --- a/sources/_subprojects/spellbook/uniswap_sources.yml +++ /dev/null @@ -1,6 +0,0 @@ -version: 2 - -sources: - - name: uniswap_v3_optimism - tables: - - name: ovm1_pool_mapping \ No newline at end of file From c1b5417a186c4701e452fcaeea1ebebaea625653 Mon Sep 17 00:00:00 2001 From: viniabussafi <131974393+viniabussafi@users.noreply.github.com> Date: Tue, 4 Jun 2024 00:19:10 +0100 Subject: [PATCH 029/149] Organize Balancer Spells into folders (#6005) * test folders * fix typo * again * organize balancer spells into folders * fix indentation * fix schema references * again * again * remove legacy model for zkevm * Remove balancer from dbt_project.yml * rerun a few schemas * again * fix macro * again * force run schemas * rerun * fix indentation issues and remove legacy trades models * update post hooks * fix typo * again * again * again * move all folders into _project --------- Co-authored-by: Huang Geyang --- dbt_project.yml | 13 - .../balancer/balancer_bpt_supply_macro.sql | 34 +- ...l_token_supply_changes_daily_agg_macro.sql | 37 + ...lancer_pool_token_supply_changes_macro.sql | 130 ++++ ..._token_balance_changes_daily_agg_macro.sql | 184 +++++ .../balancer_token_balance_changes_macro.sql | 169 +++++ models/_project/balancer/balances/_schema.yml | 98 +++ .../balancer/balances/arbitrum/_schema.yml | 100 +++ ...ncer_v2_arbitrum_token_balance_changes.sql | 16 + ...2_arbitrum_token_balance_changes_daily.sql | 17 + .../balancer/balances/avalanche_c/_schema.yml | 100 +++ ...r_v2_avalanche_c_token_balance_changes.sql | 16 + ...valanche_c_token_balance_changes_daily.sql | 17 + .../balancer_token_balance_changes.sql | 46 ++ .../balancer_token_balance_changes_daily.sql | 43 ++ .../balancer/balances/base/_schema.yml | 100 +++ ...balancer_v2_base_token_balance_changes.sql | 16 + ...er_v2_base_token_balance_changes_daily.sql | 17 + .../balancer/balances/ethereum/_schema.yml | 131 ++++ .../ethereum/balancer_ethereum_balances.sql | 11 +- ...ncer_v2_ethereum_token_balance_changes.sql | 16 + ...2_ethereum_token_balance_changes_daily.sql | 17 + .../balancer/balances/gnosis/_schema.yml | 100 +++ ...lancer_v2_gnosis_token_balance_changes.sql | 16 + ..._v2_gnosis_token_balance_changes_daily.sql | 17 + .../balancer/balances/optimism/_schema.yml | 100 +++ ...ncer_v2_optimism_token_balance_changes.sql | 16 + ...2_optimism_token_balance_changes_daily.sql | 17 + .../balancer/balances/polygon/_schema.yml | 100 +++ ...ancer_v2_polygon_token_balance_changes.sql | 16 + ...v2_polygon_token_balance_changes_daily.sql | 17 + .../balancer/balances/zkevm/_schema.yml | 100 +++ ...alancer_v2_zkevm_token_balance_changes.sql | 16 + ...r_v2_zkevm_token_balance_changes_daily.sql | 17 + models/_project/balancer/bpt/_schema.yml | 176 +++++ .../balancer/bpt/arbitrum/_schema.yml | 178 +++++ .../balancer_v2_arbitrum_bpt_prices.sql | 0 .../balancer_v2_arbitrum_bpt_supply.sql | 0 ...alancer_v2_arbitrum_bpt_supply_changes.sql | 20 + ...r_v2_arbitrum_bpt_supply_changes_daily.sql | 17 + .../balancer_v2_arbitrum_transfers_bpt.sql | 0 .../balancer/bpt/avalanche_c/_schema.yml | 178 +++++ .../balancer_v2_avalanche_c_bpt_prices.sql | 0 .../balancer_v2_avalanche_c_bpt_supply.sql | 0 ...ncer_v2_avalanche_c_bpt_supply_changes.sql | 20 + ...2_avalanche_c_bpt_supply_changes_daily.sql | 17 + .../balancer_v2_avalanche_c_transfers_bpt.sql | 0 .../balancer/bpt}/balancer_bpt_prices.sql | 8 +- .../balancer/bpt}/balancer_bpt_supply.sql | 8 +- .../bpt/balancer_bpt_supply_changes.sql | 44 ++ .../bpt/balancer_bpt_supply_changes_daily.sql | 38 + .../balancer/bpt}/balancer_transfers_bpt.sql | 8 +- models/_project/balancer/bpt/base/_schema.yml | 178 +++++ .../bpt}/base/balancer_v2_base_bpt_prices.sql | 0 .../bpt}/base/balancer_v2_base_bpt_supply.sql | 0 .../balancer_v2_base_bpt_supply_changes.sql | 20 + ...ancer_v2_base_bpt_supply_changes_daily.sql | 17 + .../base/balancer_v2_base_transfers_bpt.sql | 0 .../balancer/bpt/ethereum/_schema.yml | 178 +++++ .../balancer_v2_ethereum_bpt_prices.sql | 0 .../balancer_v2_ethereum_bpt_supply.sql | 0 ...alancer_v2_ethereum_bpt_supply_changes.sql | 20 + ...r_v2_ethereum_bpt_supply_changes_daily.sql | 17 + .../balancer_v2_ethereum_transfers_bpt.sql | 0 .../_project/balancer/bpt/gnosis/_schema.yml | 178 +++++ .../gnosis/balancer_v2_gnosis_bpt_prices.sql | 0 .../gnosis/balancer_v2_gnosis_bpt_supply.sql | 0 .../balancer_v2_gnosis_bpt_supply_changes.sql | 20 + ...cer_v2_gnosis_bpt_supply_changes_daily.sql | 17 + .../balancer_v2_gnosis_transfers_bpt.sql | 0 .../balancer/bpt/optimism/_schema.yml | 178 +++++ .../balancer_v2_optimism_bpt_prices.sql | 0 .../balancer_v2_optimism_bpt_supply.sql | 0 ...alancer_v2_optimism_bpt_supply_changes.sql | 20 + ...r_v2_optimism_bpt_supply_changes_daily.sql | 17 + .../balancer_v2_optimism_transfers_bpt.sql | 0 .../_project/balancer/bpt/polygon/_schema.yml | 178 +++++ .../balancer_v2_polygon_bpt_prices.sql | 0 .../balancer_v2_polygon_bpt_supply.sql | 0 ...balancer_v2_polygon_bpt_supply_changes.sql | 20 + ...er_v2_polygon_bpt_supply_changes_daily.sql | 17 + .../balancer_v2_polygon_transfers_bpt.sql | 0 .../_project/balancer/bpt/zkevm/_schema.yml | 178 +++++ .../zkevm/balancer_v2_zkevm_bpt_prices.sql | 0 .../zkevm/balancer_v2_zkevm_bpt_supply.sql | 0 .../balancer_v2_zkevm_bpt_supply_changes.sql | 20 + ...ncer_v2_zkevm_bpt_supply_changes_daily.sql | 17 + .../zkevm/balancer_v2_zkevm_transfers_bpt.sql | 0 .../_project/balancer/flashloans/_schema.yml | 35 + .../balancer/flashloans/arbitrum/_schema.yml | 36 + .../balancer_v2_arbitrum_flashloans.sql | 4 - .../flashloans/avalanche_c/_schema.yml | 36 + .../balancer_v2_avalanche_c_flashloans.sql | 4 - .../flashloans}/balancer_flashloans.sql | 11 +- .../balancer/flashloans/base/_schema.yml | 36 + .../base/balancer_v2_base_flashloans.sql | 4 - .../balancer/flashloans/ethereum/_schema.yml | 36 + .../balancer_v2_ethereum_flashloans.sql | 4 - .../balancer/flashloans/gnosis/_schema.yml | 36 + .../gnosis/balancer_v2_gnosis_flashloans.sql | 4 - .../balancer/flashloans/optimism/_schema.yml | 36 + .../balancer_v2_optimism_flashloans.sql | 4 - .../balancer/flashloans/polygon/_schema.yml | 36 + .../balancer_v2_polygon_flashloans.sql | 4 - .../balancer/flashloans/zkevm/_schema.yml | 36 + .../zkevm/balancer_v2_zkevm_flashloans.sql | 4 - .../_project/balancer/liquidity/_schema.yml | 60 ++ .../balancer/liquidity/arbitrum/_schema.yml | 58 ++ .../balancer_v2_arbitrum_liquidity.sql | 6 +- .../liquidity/avalanche_c/_schema.yml | 58 ++ .../balancer_v2_avalanche_c_liquidity.sql | 6 +- .../liquidity}/balancer_liquidity.sql | 9 +- .../balancer/liquidity/base/_schema.yml | 58 ++ .../base/balancer_v2_base_liquidity.sql | 6 +- .../balancer/liquidity/ethereum/_schema.yml | 96 +++ .../balancer_v1_ethereum_liquidity.sql | 6 +- .../balancer_v2_ethereum_liquidity.sql | 6 +- .../balancer/liquidity/gnosis/_schema.yml | 58 ++ .../gnosis/balancer_v2_gnosis_liquidity.sql | 6 +- .../balancer/liquidity/optimism/_schema.yml | 58 ++ .../balancer_v2_optimism_liquidity.sql | 6 +- .../balancer/liquidity/polygon/_schema.yml | 58 ++ .../polygon/balancer_v2_polygon_liquidity.sql | 6 +- .../balancer/liquidity/zkevm/_schema.yml | 58 ++ .../zkevm/balancer_v2_zkevm_liquidity.sql | 6 +- models/_project/balancer/pools/_schema.yml | 173 +++++ .../balancer/pools/arbitrum/_schema.yml | 105 +++ ...balancer_arbitrum_pools_tokens_weights.sql | 0 .../balancer_v2_arbitrum_pools_fees.sql | 11 +- ...ancer_v2_arbitrum_pools_tokens_weights.sql | 1 - .../balancer/pools/avalanche_c/_schema.yml | 105 +++ ...ancer_avalanche_c_pools_tokens_weights.sql | 0 .../balancer_v2_avalanche_c_pools_fees.sql | 9 +- ...er_v2_avalanche_c_pools_tokens_weights.sql | 1 - .../pools}/balancer_gauge_mappings.sql | 7 +- .../balancer/pools}/balancer_pools_fees.sql | 9 +- .../pools}/balancer_pools_metrics_daily.sql | 0 .../pools}/balancer_pools_tokens_weights.sql | 8 +- .../_project/balancer/pools/base/_schema.yml | 105 +++ .../balancer_base_pools_tokens_weights.sql | 0 .../base/balancer_v2_base_pools_fees.sql | 9 +- .../balancer_v2_base_pools_tokens_weights.sql | 1 - .../balancer/pools/ethereum/_schema.yml | 149 ++++ ...balancer_ethereum_pools_tokens_weights.sql | 0 ...ancer_v1_ethereum_pools_tokens_weights.sql | 7 +- .../ethereum/balancer_v2_ethereum_lbps.sql | 0 .../balancer_v2_ethereum_pools_fees.sql | 7 +- ...ancer_v2_ethereum_pools_tokens_weights.sql | 1 - .../balancer/pools/gnosis/_schema.yml | 105 +++ .../balancer_gnosis_pools_tokens_weights.sql | 0 .../gnosis/balancer_v2_gnosis_pools_fees.sql | 9 +- ...alancer_v2_gnosis_pools_tokens_weights.sql | 1 - .../balancer/pools/optimism/_schema.yml | 146 ++++ .../balancer_optimism_gauge_mappings.sql | 7 +- ...balancer_optimism_pools_tokens_weights.sql | 3 +- .../balancer_v2_optimism_pools_fees.sql | 9 +- ...ancer_v2_optimism_pools_tokens_weights.sql | 1 - .../balancer/pools/polygon/_schema.yml | 128 ++++ .../balancer_polygon_pools_tokens_weights.sql | 0 .../polygon/balancer_v2_polygon_lbps.sql | 0 .../balancer_v2_polygon_pools_fees.sql | 9 +- ...lancer_v2_polygon_pools_tokens_weights.sql | 1 - .../_project/balancer/pools/zkevm/_schema.yml | 105 +++ .../zkevm/balancer_v2_zkevm_pools_fees.sql | 6 +- ...balancer_v2_zkevm_pools_tokens_weights.sql | 0 .../balancer_zkevm_pools_tokens_weights.sql | 0 .../balancer/protocol_fee/_schema.yml | 61 ++ .../protocol_fee/arbitrum/_schema.yml | 61 ++ .../balancer_v2_arbitrum_protocol_fee.sql | 0 .../protocol_fee/avalanche_c/_schema.yml | 61 ++ .../balancer_v2_avalanche_c_protocol_fee.sql | 0 .../protocol_fee}/balancer_protocol_fee.sql | 8 +- .../balancer/protocol_fee/base/_schema.yml | 61 ++ .../base/balancer_v2_base_protocol_fee.sql | 0 .../protocol_fee/ethereum/_schema.yml | 61 ++ .../balancer_v2_ethereum_protocol_fee.sql | 0 .../balancer/protocol_fee/gnosis/_schema.yml | 61 ++ .../balancer_v2_gnosis_protocol_fee.sql | 0 .../protocol_fee/optimism/_schema.yml | 61 ++ .../balancer_v2_optimism_protocol_fee.sql | 0 .../balancer/protocol_fee/polygon/_schema.yml | 61 ++ .../balancer_v2_polygon_protocol_fee.sql | 0 .../balancer/protocol_fee/zkevm/_schema.yml | 61 ++ .../zkevm/balancer_v2_zkevm_protocol_fee.sql | 0 models/_project/balancer/support/_schema.yml | 56 ++ .../balancer_single_recipient_gauges.sql | 0 .../support}/balancer_token_whitelist.sql | 0 .../balancer/trades/arbitrum/_schema.yml | 149 ++++ .../arbitrum/balancer_arbitrum_trades.sql | 0 .../arbitrum/balancer_v2_arbitrum_trades.sql | 6 +- .../balancer/trades/avalanche_c/_schema.yml | 149 ++++ .../balancer_avalanche_c_trades.sql | 0 .../balancer_v2_avalanche_c_trades.sql | 8 +- .../balancer/{ => trades}/balancer_trades.sql | 0 .../_project/balancer/trades/base/_schema.yml | 149 ++++ .../trades}/base/balancer_base_trades.sql | 0 .../trades}/base/balancer_v2_base_trades.sql | 6 +- .../balancer/trades/ethereum/_schema.yml | 145 ++++ .../ethereum/balancer_ethereum_trades.sql | 0 .../ethereum/balancer_v1_ethereum_trades.sql | 0 .../ethereum/balancer_v2_ethereum_trades.sql | 6 +- .../balancer/trades/gnosis/_schema.yml | 149 ++++ .../trades}/gnosis/balancer_gnosis_trades.sql | 0 .../gnosis/balancer_v2_gnosis_trades.sql | 6 +- .../balancer/trades/optimism/_schema.yml | 149 ++++ .../optimism/balancer_optimism_trades.sql | 0 .../optimism/balancer_v2_optimism_trades.sql | 6 +- .../balancer/trades/polygon/_schema.yml | 149 ++++ .../polygon/balancer_polygon_trades.sql | 0 .../polygon/balancer_v2_polygon_trades.sql | 6 +- .../balancer/trades/zkevm/_schema.yml | 110 +++ .../zkevm/balancer_v2_zkevm_trades.sql | 6 +- .../trades}/zkevm/balancer_zkevm_trades.sql | 0 .../balancer/vebal/ethereum/_schema.yml | 91 +++ .../balancer_ethereum_vebal_balances_day.sql | 7 +- .../balancer_ethereum_vebal_slopes.sql | 9 +- .../balancer_ethereum_vebal_votes.sql | 8 +- .../arbitrum/balancer_arbitrum_schema.yml | 432 ------------ .../balancer_avalanche_c_schema.yml | 405 ----------- models/balancer/balancer_schema.yml | 365 ---------- models/balancer/base/balancer_base_schema.yml | 405 ----------- .../ethereum/balancer_ethereum_schema.yml | 665 ------------------ .../gnosis/balancer_gnosis_schema.yml | 404 ----------- .../optimism/balancer_optimism_schema.yml | 464 ------------ .../polygon/balancer_polygon_schema.yml | 454 ------------ .../balancer/zkevm/balancer_zkevm_schema.yml | 431 ------------ 226 files changed, 7748 insertions(+), 4295 deletions(-) create mode 100644 macros/models/_project/balancer/balancer_pool_token_supply_changes_daily_agg_macro.sql create mode 100644 macros/models/_project/balancer/balancer_pool_token_supply_changes_macro.sql create mode 100644 macros/models/_project/balancer/balancer_token_balance_changes_daily_agg_macro.sql create mode 100644 macros/models/_project/balancer/balancer_token_balance_changes_macro.sql create mode 100644 models/_project/balancer/balances/_schema.yml create mode 100644 models/_project/balancer/balances/arbitrum/_schema.yml create mode 100644 models/_project/balancer/balances/arbitrum/balancer_v2_arbitrum_token_balance_changes.sql create mode 100644 models/_project/balancer/balances/arbitrum/balancer_v2_arbitrum_token_balance_changes_daily.sql create mode 100644 models/_project/balancer/balances/avalanche_c/_schema.yml create mode 100644 models/_project/balancer/balances/avalanche_c/balancer_v2_avalanche_c_token_balance_changes.sql create mode 100644 models/_project/balancer/balances/avalanche_c/balancer_v2_avalanche_c_token_balance_changes_daily.sql create mode 100644 models/_project/balancer/balances/balancer_token_balance_changes.sql create mode 100644 models/_project/balancer/balances/balancer_token_balance_changes_daily.sql create mode 100644 models/_project/balancer/balances/base/_schema.yml create mode 100644 models/_project/balancer/balances/base/balancer_v2_base_token_balance_changes.sql create mode 100644 models/_project/balancer/balances/base/balancer_v2_base_token_balance_changes_daily.sql create mode 100644 models/_project/balancer/balances/ethereum/_schema.yml rename models/{balancer => _project/balancer/balances}/ethereum/balancer_ethereum_balances.sql (88%) create mode 100644 models/_project/balancer/balances/ethereum/balancer_v2_ethereum_token_balance_changes.sql create mode 100644 models/_project/balancer/balances/ethereum/balancer_v2_ethereum_token_balance_changes_daily.sql create mode 100644 models/_project/balancer/balances/gnosis/_schema.yml create mode 100644 models/_project/balancer/balances/gnosis/balancer_v2_gnosis_token_balance_changes.sql create mode 100644 models/_project/balancer/balances/gnosis/balancer_v2_gnosis_token_balance_changes_daily.sql create mode 100644 models/_project/balancer/balances/optimism/_schema.yml create mode 100644 models/_project/balancer/balances/optimism/balancer_v2_optimism_token_balance_changes.sql create mode 100644 models/_project/balancer/balances/optimism/balancer_v2_optimism_token_balance_changes_daily.sql create mode 100644 models/_project/balancer/balances/polygon/_schema.yml create mode 100644 models/_project/balancer/balances/polygon/balancer_v2_polygon_token_balance_changes.sql create mode 100644 models/_project/balancer/balances/polygon/balancer_v2_polygon_token_balance_changes_daily.sql create mode 100644 models/_project/balancer/balances/zkevm/_schema.yml create mode 100644 models/_project/balancer/balances/zkevm/balancer_v2_zkevm_token_balance_changes.sql create mode 100644 models/_project/balancer/balances/zkevm/balancer_v2_zkevm_token_balance_changes_daily.sql create mode 100644 models/_project/balancer/bpt/_schema.yml create mode 100644 models/_project/balancer/bpt/arbitrum/_schema.yml rename models/{balancer => _project/balancer/bpt}/arbitrum/balancer_v2_arbitrum_bpt_prices.sql (100%) rename models/{balancer => _project/balancer/bpt}/arbitrum/balancer_v2_arbitrum_bpt_supply.sql (100%) create mode 100644 models/_project/balancer/bpt/arbitrum/balancer_v2_arbitrum_bpt_supply_changes.sql create mode 100644 models/_project/balancer/bpt/arbitrum/balancer_v2_arbitrum_bpt_supply_changes_daily.sql rename models/{balancer => _project/balancer/bpt}/arbitrum/balancer_v2_arbitrum_transfers_bpt.sql (100%) create mode 100644 models/_project/balancer/bpt/avalanche_c/_schema.yml rename models/{balancer => _project/balancer/bpt}/avalanche_c/balancer_v2_avalanche_c_bpt_prices.sql (100%) rename models/{balancer => _project/balancer/bpt}/avalanche_c/balancer_v2_avalanche_c_bpt_supply.sql (100%) create mode 100644 models/_project/balancer/bpt/avalanche_c/balancer_v2_avalanche_c_bpt_supply_changes.sql create mode 100644 models/_project/balancer/bpt/avalanche_c/balancer_v2_avalanche_c_bpt_supply_changes_daily.sql rename models/{balancer => _project/balancer/bpt}/avalanche_c/balancer_v2_avalanche_c_transfers_bpt.sql (100%) rename models/{balancer => _project/balancer/bpt}/balancer_bpt_prices.sql (69%) rename models/{balancer => _project/balancer/bpt}/balancer_bpt_supply.sql (68%) create mode 100644 models/_project/balancer/bpt/balancer_bpt_supply_changes.sql create mode 100644 models/_project/balancer/bpt/balancer_bpt_supply_changes_daily.sql rename models/{balancer => _project/balancer/bpt}/balancer_transfers_bpt.sql (70%) create mode 100644 models/_project/balancer/bpt/base/_schema.yml rename models/{balancer => _project/balancer/bpt}/base/balancer_v2_base_bpt_prices.sql (100%) rename models/{balancer => _project/balancer/bpt}/base/balancer_v2_base_bpt_supply.sql (100%) create mode 100644 models/_project/balancer/bpt/base/balancer_v2_base_bpt_supply_changes.sql create mode 100644 models/_project/balancer/bpt/base/balancer_v2_base_bpt_supply_changes_daily.sql rename models/{balancer => _project/balancer/bpt}/base/balancer_v2_base_transfers_bpt.sql (100%) create mode 100644 models/_project/balancer/bpt/ethereum/_schema.yml rename models/{balancer => _project/balancer/bpt}/ethereum/balancer_v2_ethereum_bpt_prices.sql (100%) rename models/{balancer => _project/balancer/bpt}/ethereum/balancer_v2_ethereum_bpt_supply.sql (100%) create mode 100644 models/_project/balancer/bpt/ethereum/balancer_v2_ethereum_bpt_supply_changes.sql create mode 100644 models/_project/balancer/bpt/ethereum/balancer_v2_ethereum_bpt_supply_changes_daily.sql rename models/{balancer => _project/balancer/bpt}/ethereum/balancer_v2_ethereum_transfers_bpt.sql (100%) create mode 100644 models/_project/balancer/bpt/gnosis/_schema.yml rename models/{balancer => _project/balancer/bpt}/gnosis/balancer_v2_gnosis_bpt_prices.sql (100%) rename models/{balancer => _project/balancer/bpt}/gnosis/balancer_v2_gnosis_bpt_supply.sql (100%) create mode 100644 models/_project/balancer/bpt/gnosis/balancer_v2_gnosis_bpt_supply_changes.sql create mode 100644 models/_project/balancer/bpt/gnosis/balancer_v2_gnosis_bpt_supply_changes_daily.sql rename models/{balancer => _project/balancer/bpt}/gnosis/balancer_v2_gnosis_transfers_bpt.sql (100%) create mode 100644 models/_project/balancer/bpt/optimism/_schema.yml rename models/{balancer => _project/balancer/bpt}/optimism/balancer_v2_optimism_bpt_prices.sql (100%) rename models/{balancer => _project/balancer/bpt}/optimism/balancer_v2_optimism_bpt_supply.sql (100%) create mode 100644 models/_project/balancer/bpt/optimism/balancer_v2_optimism_bpt_supply_changes.sql create mode 100644 models/_project/balancer/bpt/optimism/balancer_v2_optimism_bpt_supply_changes_daily.sql rename models/{balancer => _project/balancer/bpt}/optimism/balancer_v2_optimism_transfers_bpt.sql (100%) create mode 100644 models/_project/balancer/bpt/polygon/_schema.yml rename models/{balancer => _project/balancer/bpt}/polygon/balancer_v2_polygon_bpt_prices.sql (100%) rename models/{balancer => _project/balancer/bpt}/polygon/balancer_v2_polygon_bpt_supply.sql (100%) create mode 100644 models/_project/balancer/bpt/polygon/balancer_v2_polygon_bpt_supply_changes.sql create mode 100644 models/_project/balancer/bpt/polygon/balancer_v2_polygon_bpt_supply_changes_daily.sql rename models/{balancer => _project/balancer/bpt}/polygon/balancer_v2_polygon_transfers_bpt.sql (100%) create mode 100644 models/_project/balancer/bpt/zkevm/_schema.yml rename models/{balancer => _project/balancer/bpt}/zkevm/balancer_v2_zkevm_bpt_prices.sql (100%) rename models/{balancer => _project/balancer/bpt}/zkevm/balancer_v2_zkevm_bpt_supply.sql (100%) create mode 100644 models/_project/balancer/bpt/zkevm/balancer_v2_zkevm_bpt_supply_changes.sql create mode 100644 models/_project/balancer/bpt/zkevm/balancer_v2_zkevm_bpt_supply_changes_daily.sql rename models/{balancer => _project/balancer/bpt}/zkevm/balancer_v2_zkevm_transfers_bpt.sql (100%) create mode 100644 models/_project/balancer/flashloans/_schema.yml create mode 100644 models/_project/balancer/flashloans/arbitrum/_schema.yml rename models/{balancer => _project/balancer/flashloans}/arbitrum/balancer_v2_arbitrum_flashloans.sql (88%) create mode 100644 models/_project/balancer/flashloans/avalanche_c/_schema.yml rename models/{balancer => _project/balancer/flashloans}/avalanche_c/balancer_v2_avalanche_c_flashloans.sql (88%) rename models/{balancer => _project/balancer/flashloans}/balancer_flashloans.sql (69%) create mode 100644 models/_project/balancer/flashloans/base/_schema.yml rename models/{balancer => _project/balancer/flashloans}/base/balancer_v2_base_flashloans.sql (88%) create mode 100644 models/_project/balancer/flashloans/ethereum/_schema.yml rename models/{balancer => _project/balancer/flashloans}/ethereum/balancer_v2_ethereum_flashloans.sql (88%) create mode 100644 models/_project/balancer/flashloans/gnosis/_schema.yml rename models/{balancer => _project/balancer/flashloans}/gnosis/balancer_v2_gnosis_flashloans.sql (88%) create mode 100644 models/_project/balancer/flashloans/optimism/_schema.yml rename models/{balancer => _project/balancer/flashloans}/optimism/balancer_v2_optimism_flashloans.sql (88%) create mode 100644 models/_project/balancer/flashloans/polygon/_schema.yml rename models/{balancer => _project/balancer/flashloans}/polygon/balancer_v2_polygon_flashloans.sql (88%) create mode 100644 models/_project/balancer/flashloans/zkevm/_schema.yml rename models/{balancer => _project/balancer/flashloans}/zkevm/balancer_v2_zkevm_flashloans.sql (88%) create mode 100644 models/_project/balancer/liquidity/_schema.yml create mode 100644 models/_project/balancer/liquidity/arbitrum/_schema.yml rename models/{balancer => _project/balancer/liquidity}/arbitrum/balancer_v2_arbitrum_liquidity.sql (52%) create mode 100644 models/_project/balancer/liquidity/avalanche_c/_schema.yml rename models/{balancer => _project/balancer/liquidity}/avalanche_c/balancer_v2_avalanche_c_liquidity.sql (53%) rename models/{balancer => _project/balancer/liquidity}/balancer_liquidity.sql (74%) create mode 100644 models/_project/balancer/liquidity/base/_schema.yml rename models/{balancer => _project/balancer/liquidity}/base/balancer_v2_base_liquidity.sql (51%) create mode 100644 models/_project/balancer/liquidity/ethereum/_schema.yml rename models/{balancer => _project/balancer/liquidity}/ethereum/balancer_v1_ethereum_liquidity.sql (92%) rename models/{balancer => _project/balancer/liquidity}/ethereum/balancer_v2_ethereum_liquidity.sql (52%) create mode 100644 models/_project/balancer/liquidity/gnosis/_schema.yml rename models/{balancer => _project/balancer/liquidity}/gnosis/balancer_v2_gnosis_liquidity.sql (51%) create mode 100644 models/_project/balancer/liquidity/optimism/_schema.yml rename models/{balancer => _project/balancer/liquidity}/optimism/balancer_v2_optimism_liquidity.sql (52%) create mode 100644 models/_project/balancer/liquidity/polygon/_schema.yml rename models/{balancer => _project/balancer/liquidity}/polygon/balancer_v2_polygon_liquidity.sql (52%) create mode 100644 models/_project/balancer/liquidity/zkevm/_schema.yml rename models/{balancer => _project/balancer/liquidity}/zkevm/balancer_v2_zkevm_liquidity.sql (51%) create mode 100644 models/_project/balancer/pools/_schema.yml create mode 100644 models/_project/balancer/pools/arbitrum/_schema.yml rename models/{balancer => _project/balancer/pools}/arbitrum/balancer_arbitrum_pools_tokens_weights.sql (100%) rename models/{balancer => _project/balancer/pools}/arbitrum/balancer_v2_arbitrum_pools_fees.sql (75%) rename models/{balancer => _project/balancer/pools}/arbitrum/balancer_v2_arbitrum_pools_tokens_weights.sql (99%) create mode 100644 models/_project/balancer/pools/avalanche_c/_schema.yml rename models/{balancer => _project/balancer/pools}/avalanche_c/balancer_avalanche_c_pools_tokens_weights.sql (100%) rename models/{balancer => _project/balancer/pools}/avalanche_c/balancer_v2_avalanche_c_pools_fees.sql (77%) rename models/{balancer => _project/balancer/pools}/avalanche_c/balancer_v2_avalanche_c_pools_tokens_weights.sql (99%) rename models/{balancer => _project/balancer/pools}/balancer_gauge_mappings.sql (78%) rename models/{balancer => _project/balancer/pools}/balancer_pools_fees.sql (69%) rename models/{balancer => _project/balancer/pools}/balancer_pools_metrics_daily.sql (100%) rename models/{balancer => _project/balancer/pools}/balancer_pools_tokens_weights.sql (71%) create mode 100644 models/_project/balancer/pools/base/_schema.yml rename models/{balancer => _project/balancer/pools}/base/balancer_base_pools_tokens_weights.sql (100%) rename models/{balancer => _project/balancer/pools}/base/balancer_v2_base_pools_fees.sql (77%) rename models/{balancer => _project/balancer/pools}/base/balancer_v2_base_pools_tokens_weights.sql (99%) create mode 100644 models/_project/balancer/pools/ethereum/_schema.yml rename models/{balancer => _project/balancer/pools}/ethereum/balancer_ethereum_pools_tokens_weights.sql (100%) rename models/{balancer => _project/balancer/pools}/ethereum/balancer_v1_ethereum_pools_tokens_weights.sql (93%) rename models/{balancer => _project/balancer/pools}/ethereum/balancer_v2_ethereum_lbps.sql (100%) rename models/{balancer => _project/balancer/pools}/ethereum/balancer_v2_ethereum_pools_fees.sql (78%) rename models/{balancer => _project/balancer/pools}/ethereum/balancer_v2_ethereum_pools_tokens_weights.sql (99%) create mode 100644 models/_project/balancer/pools/gnosis/_schema.yml rename models/{balancer => _project/balancer/pools}/gnosis/balancer_gnosis_pools_tokens_weights.sql (100%) rename models/{balancer => _project/balancer/pools}/gnosis/balancer_v2_gnosis_pools_fees.sql (77%) rename models/{balancer => _project/balancer/pools}/gnosis/balancer_v2_gnosis_pools_tokens_weights.sql (99%) create mode 100644 models/_project/balancer/pools/optimism/_schema.yml rename models/{balancer => _project/balancer/pools}/optimism/balancer_optimism_gauge_mappings.sql (87%) rename models/{balancer => _project/balancer/pools}/optimism/balancer_optimism_pools_tokens_weights.sql (86%) rename models/{balancer => _project/balancer/pools}/optimism/balancer_v2_optimism_pools_fees.sql (77%) rename models/{balancer => _project/balancer/pools}/optimism/balancer_v2_optimism_pools_tokens_weights.sql (99%) create mode 100644 models/_project/balancer/pools/polygon/_schema.yml rename models/{balancer => _project/balancer/pools}/polygon/balancer_polygon_pools_tokens_weights.sql (100%) rename models/{balancer => _project/balancer/pools}/polygon/balancer_v2_polygon_lbps.sql (100%) rename models/{balancer => _project/balancer/pools}/polygon/balancer_v2_polygon_pools_fees.sql (77%) rename models/{balancer => _project/balancer/pools}/polygon/balancer_v2_polygon_pools_tokens_weights.sql (99%) create mode 100644 models/_project/balancer/pools/zkevm/_schema.yml rename models/{balancer => _project/balancer/pools}/zkevm/balancer_v2_zkevm_pools_fees.sql (82%) rename models/{balancer => _project/balancer/pools}/zkevm/balancer_v2_zkevm_pools_tokens_weights.sql (100%) rename models/{balancer => _project/balancer/pools}/zkevm/balancer_zkevm_pools_tokens_weights.sql (100%) create mode 100644 models/_project/balancer/protocol_fee/_schema.yml create mode 100644 models/_project/balancer/protocol_fee/arbitrum/_schema.yml rename models/{balancer => _project/balancer/protocol_fee}/arbitrum/balancer_v2_arbitrum_protocol_fee.sql (100%) create mode 100644 models/_project/balancer/protocol_fee/avalanche_c/_schema.yml rename models/{balancer => _project/balancer/protocol_fee}/avalanche_c/balancer_v2_avalanche_c_protocol_fee.sql (100%) rename models/{balancer => _project/balancer/protocol_fee}/balancer_protocol_fee.sql (75%) create mode 100644 models/_project/balancer/protocol_fee/base/_schema.yml rename models/{balancer => _project/balancer/protocol_fee}/base/balancer_v2_base_protocol_fee.sql (100%) create mode 100644 models/_project/balancer/protocol_fee/ethereum/_schema.yml rename models/{balancer => _project/balancer/protocol_fee}/ethereum/balancer_v2_ethereum_protocol_fee.sql (100%) create mode 100644 models/_project/balancer/protocol_fee/gnosis/_schema.yml rename models/{balancer => _project/balancer/protocol_fee}/gnosis/balancer_v2_gnosis_protocol_fee.sql (100%) create mode 100644 models/_project/balancer/protocol_fee/optimism/_schema.yml rename models/{balancer => _project/balancer/protocol_fee}/optimism/balancer_v2_optimism_protocol_fee.sql (100%) create mode 100644 models/_project/balancer/protocol_fee/polygon/_schema.yml rename models/{balancer => _project/balancer/protocol_fee}/polygon/balancer_v2_polygon_protocol_fee.sql (100%) create mode 100644 models/_project/balancer/protocol_fee/zkevm/_schema.yml rename models/{balancer => _project/balancer/protocol_fee}/zkevm/balancer_v2_zkevm_protocol_fee.sql (100%) create mode 100644 models/_project/balancer/support/_schema.yml rename models/{balancer => _project/balancer/support}/balancer_single_recipient_gauges.sql (100%) rename models/{balancer => _project/balancer/support}/balancer_token_whitelist.sql (100%) create mode 100644 models/_project/balancer/trades/arbitrum/_schema.yml rename models/{balancer => _project/balancer/trades}/arbitrum/balancer_arbitrum_trades.sql (100%) rename models/{balancer => _project/balancer/trades}/arbitrum/balancer_v2_arbitrum_trades.sql (94%) create mode 100644 models/_project/balancer/trades/avalanche_c/_schema.yml rename models/{balancer => _project/balancer/trades}/avalanche_c/balancer_avalanche_c_trades.sql (100%) rename models/{balancer => _project/balancer/trades}/avalanche_c/balancer_v2_avalanche_c_trades.sql (94%) rename models/_project/balancer/{ => trades}/balancer_trades.sql (100%) create mode 100644 models/_project/balancer/trades/base/_schema.yml rename models/{balancer => _project/balancer/trades}/base/balancer_base_trades.sql (100%) rename models/{balancer => _project/balancer/trades}/base/balancer_v2_base_trades.sql (94%) create mode 100644 models/_project/balancer/trades/ethereum/_schema.yml rename models/{balancer => _project/balancer/trades}/ethereum/balancer_ethereum_trades.sql (100%) rename models/{balancer => _project/balancer/trades}/ethereum/balancer_v1_ethereum_trades.sql (100%) rename models/{balancer => _project/balancer/trades}/ethereum/balancer_v2_ethereum_trades.sql (94%) create mode 100644 models/_project/balancer/trades/gnosis/_schema.yml rename models/{balancer => _project/balancer/trades}/gnosis/balancer_gnosis_trades.sql (100%) rename models/{balancer => _project/balancer/trades}/gnosis/balancer_v2_gnosis_trades.sql (94%) create mode 100644 models/_project/balancer/trades/optimism/_schema.yml rename models/{balancer => _project/balancer/trades}/optimism/balancer_optimism_trades.sql (100%) rename models/{balancer => _project/balancer/trades}/optimism/balancer_v2_optimism_trades.sql (94%) create mode 100644 models/_project/balancer/trades/polygon/_schema.yml rename models/{balancer => _project/balancer/trades}/polygon/balancer_polygon_trades.sql (100%) rename models/{balancer => _project/balancer/trades}/polygon/balancer_v2_polygon_trades.sql (94%) create mode 100644 models/_project/balancer/trades/zkevm/_schema.yml rename models/{balancer => _project/balancer/trades}/zkevm/balancer_v2_zkevm_trades.sql (94%) rename models/{balancer => _project/balancer/trades}/zkevm/balancer_zkevm_trades.sql (100%) create mode 100644 models/_project/balancer/vebal/ethereum/_schema.yml rename models/{balancer => _project/balancer/vebal}/ethereum/balancer_ethereum_vebal_balances_day.sql (94%) rename models/{balancer => _project/balancer/vebal}/ethereum/balancer_ethereum_vebal_slopes.sql (93%) rename models/{balancer => _project/balancer/vebal}/ethereum/balancer_ethereum_vebal_votes.sql (92%) delete mode 100644 models/balancer/arbitrum/balancer_arbitrum_schema.yml delete mode 100644 models/balancer/avalanche_c/balancer_avalanche_c_schema.yml delete mode 100644 models/balancer/balancer_schema.yml delete mode 100644 models/balancer/base/balancer_base_schema.yml delete mode 100644 models/balancer/ethereum/balancer_ethereum_schema.yml delete mode 100644 models/balancer/gnosis/balancer_gnosis_schema.yml delete mode 100644 models/balancer/optimism/balancer_optimism_schema.yml delete mode 100644 models/balancer/polygon/balancer_polygon_schema.yml delete mode 100644 models/balancer/zkevm/balancer_zkevm_schema.yml diff --git a/dbt_project.yml b/dbt_project.yml index c73e8699cff..91320626953 100644 --- a/dbt_project.yml +++ b/dbt_project.yml @@ -71,19 +71,6 @@ models: optimism: +schema: aave_optimism - balancer: - +schema: balancer - arbitrum: - +schema: balancer_arbitrum - ethereum: - +schema: balancer_ethereum - polygon: - +schema: balancer_polygon - optimism: - +schema: balancer_optimism - gnosis: - +schema: balancer_gnosis - ens: +schema: ens ethereum: diff --git a/macros/models/_project/balancer/balancer_bpt_supply_macro.sql b/macros/models/_project/balancer/balancer_bpt_supply_macro.sql index 60cf5a6e4bc..1b1dab0a80a 100644 --- a/macros/models/_project/balancer/balancer_bpt_supply_macro.sql +++ b/macros/models/_project/balancer/balancer_bpt_supply_macro.sql @@ -79,12 +79,12 @@ WITH pool_labels AS ( joins AS ( SELECT DATE_TRUNC('day', evt_block_time) AS block_date, - tokenOut AS token, + tokenOut, pool_type, CASE WHEN pool_type IN ('weighted') THEN 0 ELSE SUM(amountOut / POWER(10, 18)) - END AS amount + END AS ajoins FROM {{ source('balancer_v2_' + blockchain, 'Vault_evt_Swap') }} LEFT JOIN pool_labels ON BYTEARRAY_SUBSTRING(poolId, 1, 20) = address WHERE tokenOut = BYTEARRAY_SUBSTRING(poolId, 1, 20) @@ -94,37 +94,25 @@ WITH pool_labels AS ( exits AS ( SELECT DATE_TRUNC('day', evt_block_time) AS block_date, - tokenIn AS token, + tokenIn, pool_type, CASE WHEN pool_type IN ('weighted') THEN 0 - ELSE SUM( -amountIn / POWER(10, 18)) - END AS amount + ELSE SUM(amountIn / POWER(10, 18)) + END AS aexits FROM {{ source('balancer_v2_' + blockchain, 'Vault_evt_Swap') }} LEFT JOIN pool_labels ON BYTEARRAY_SUBSTRING(poolId, 1, 20) = address WHERE tokenIn = BYTEARRAY_SUBSTRING(poolId, 1, 20) GROUP BY 1, 2, 3 ), - joins_and_exits_1 AS ( - SELECT - * - FROM joins - - UNION ALL - - SELECT - * - FROM exits - ), - joins_and_exits AS ( SELECT - block_date, - token AS bpt, - LEAD(block_date, 1, NOW()) OVER (PARTITION BY token ORDER BY block_date) AS day_of_next_change, - SUM(amount) OVER (PARTITION BY token ORDER BY block_date ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW) AS adelta - FROM joins_and_exits_1 + j.block_date, + j.tokenOut AS bpt, + SUM(COALESCE(ajoins, 0) - COALESCE(aexits, 0)) OVER (PARTITION BY j.tokenOut ORDER BY j.block_date ASC) AS adelta + FROM joins j + FULL OUTER JOIN exits e ON j.block_date = e.block_date AND e.tokenIn = j.tokenOut ), calendar AS ( @@ -142,7 +130,7 @@ WITH pool_labels AS ( COALESCE(SUM(b.supply - COALESCE(preminted_bpts, 0) + COALESCE(adelta, 0)),0) AS supply FROM calendar c LEFT JOIN balances b ON b.day <= c.day AND c.day < b.day_of_next_change - LEFT JOIN joins_and_exits j ON j.block_date <= c.day AND c.day < j.day_of_next_change AND b.token = j.bpt + LEFT JOIN joins_and_exits j ON c.day = j.block_date AND b.token = j.bpt LEFT JOIN premints p ON b.token = p.bpt LEFT JOIN pool_labels l ON b.token = l.address WHERE l.pool_type IN ('weighted', 'LBP', 'investment', 'stable', 'linear', 'ECLP', 'managed', 'FX') diff --git a/macros/models/_project/balancer/balancer_pool_token_supply_changes_daily_agg_macro.sql b/macros/models/_project/balancer/balancer_pool_token_supply_changes_daily_agg_macro.sql new file mode 100644 index 00000000000..d94bbccf741 --- /dev/null +++ b/macros/models/_project/balancer/balancer_pool_token_supply_changes_daily_agg_macro.sql @@ -0,0 +1,37 @@ +{% macro + bpt_supply_changes_daily_agg_macro( + blockchain, version + ) +%} +WITH + daily_balance AS ( + SELECT + block_date, + blockchain, + pool_type, + pool_symbol, + token_address, + LEAD(block_date, 1, NOW()) OVER (PARTITION BY token_address ORDER BY block_date) AS day_of_next_change, + SUM(delta_amount) AS daily_amount + FROM {{ ref('balancer_bpt_supply_changes') }} + WHERE blockchain = '{{blockchain}}' + GROUP BY 1, 2, 3, 4, 5 + ), + + calendar AS ( + SELECT date_sequence AS day + FROM unnest(sequence(date('2021-04-21'), date(now()), interval '1' day)) as t(date_sequence) + ) + + SELECT + c.day AS block_date, + '{{blockchain}}' as blockchain, + '{{version}}' AS version, + b.pool_type, + b.pool_symbol, + b.token_address, + b.daily_amount AS daily_delta + FROM calendar c + LEFT JOIN daily_balance b ON b.block_date = c.day + WHERE b.token_address IS NOT NULL + {% endmacro %} \ No newline at end of file diff --git a/macros/models/_project/balancer/balancer_pool_token_supply_changes_macro.sql b/macros/models/_project/balancer/balancer_pool_token_supply_changes_macro.sql new file mode 100644 index 00000000000..5b876cca011 --- /dev/null +++ b/macros/models/_project/balancer/balancer_pool_token_supply_changes_macro.sql @@ -0,0 +1,130 @@ +{% macro + bpt_supply_changes_macro( + blockchain, version + ) +%} +WITH pool_labels AS ( + SELECT + address, + name, + pool_type + FROM {{ ref('labels_balancer_v2_pools') }} + WHERE blockchain = '{{blockchain}}' + ), + + -- Extract mints and burns from transfers + transfers AS ( + SELECT + t.evt_block_time, + t.evt_block_number, + t.evt_tx_hash, + t.evt_index, + t.contract_address AS token, + CASE + WHEN t."from" = 0x0000000000000000000000000000000000000000 + THEN 'mint' + WHEN t.to = 0x0000000000000000000000000000000000000000 + THEN 'burn' + END AS label, + l.pool_type, + l.name, + CASE + WHEN t."from" = 0x0000000000000000000000000000000000000000 + THEN value + WHEN t.to = 0x0000000000000000000000000000000000000000 + THEN - value + ELSE 0 + END AS amount + FROM {{ ref('balancer_transfers_bpt') }} t + LEFT JOIN pool_labels l ON t.contract_address = l.address + WHERE t.blockchain = '{{blockchain}}' + AND t.version = '{{version}}' + {% if is_incremental() %} + AND {{ incremental_predicate('t.evt_block_time') }} + {% endif %} + ), + + -- Calculating Joins(mint) and Exits(burn) via Swap + joins AS ( + SELECT + s.evt_block_time, + s.evt_block_number, + s.evt_tx_hash, + s.evt_index, + s.tokenOut AS token, + 'join' AS label, + l.pool_type, + l.name, + CASE WHEN l.pool_type IN ('weighted') + THEN 0 + ELSE s.amountOut + END AS amount + FROM {{ source('balancer_v2_' + blockchain, 'Vault_evt_Swap') }} s + LEFT JOIN pool_labels l ON BYTEARRAY_SUBSTRING(s.poolId, 1, 20) = l.address + WHERE tokenOut = BYTEARRAY_SUBSTRING(s.poolId, 1, 20) + {% if is_incremental() %} + AND {{ incremental_predicate('s. evt_block_time') }} + {% endif %} + + ), + + exits AS ( + SELECT + s.evt_block_time, + s.evt_block_number, + s.evt_tx_hash, + s.evt_index, + s.tokenIn AS token, + 'exit' AS label, + l.pool_type, + l.name, + CASE WHEN l.pool_type IN ('weighted') + THEN 0 + ELSE - s.amountIn + END AS amount + FROM {{ source('balancer_v2_' + blockchain, 'Vault_evt_Swap') }} s + LEFT JOIN pool_labels l ON BYTEARRAY_SUBSTRING(s.poolId, 1, 20) = l.address + WHERE tokenIn = BYTEARRAY_SUBSTRING(s.poolId, 1, 20) + {% if is_incremental() %} + AND {{ incremental_predicate('s. evt_block_time') }} + {% endif %} + ) + + SELECT + date_trunc('day', evt_block_time) AS block_date, + evt_block_time, + evt_block_number, + '{{blockchain}}' AS blockchain, + evt_tx_hash, + evt_index, + pool_type, + name AS pool_symbol, + '{{version}}' AS version, + label, + token AS token_address, + amount AS delta_amount_raw, + amount / POWER (10, 18) AS delta_amount --18 decimals standard for BPTs + FROM + ( + SELECT + * + FROM joins + + UNION ALL + + SELECT + * + FROM exits + + UNION ALL + + SELECT + * + FROM transfers + WHERE label IS NOT NULL + ) + {% if is_incremental() %} + WHERE {{ incremental_predicate('evt_block_time') }} + {% endif %} + + {% endmacro %} \ No newline at end of file diff --git a/macros/models/_project/balancer/balancer_token_balance_changes_daily_agg_macro.sql b/macros/models/_project/balancer/balancer_token_balance_changes_daily_agg_macro.sql new file mode 100644 index 00000000000..7500f5d7e82 --- /dev/null +++ b/macros/models/_project/balancer/balancer_token_balance_changes_daily_agg_macro.sql @@ -0,0 +1,184 @@ +{% macro + balancer_token_balance_changes_daily_agg_macro( + blockchain, version + ) +%} +WITH + prices AS ( + SELECT + date_trunc('day', minute) AS day, + contract_address AS token, + decimals, + AVG(price) AS price + FROM {{ source('prices', 'usd') }} + WHERE blockchain = '{{blockchain}}' + {% if is_incremental() %} + WHERE {{ incremental_predicate('minute') }} + {% endif %} + GROUP BY 1, 2, 3 + ), + + dex_prices_1 AS ( + SELECT + date_trunc('day', HOUR) AS DAY, + contract_address AS token, + approx_percentile(median_price, 0.5) AS price, + sum(sample_size) AS sample_size + FROM {{ ref('dex_prices') }} + {% if is_incremental() %} + WHERE {{ incremental_predicate('hour') }} + {% endif %} + GROUP BY 1, 2 + HAVING sum(sample_size) > 3 + ), + + dex_prices_2 AS( + SELECT + day, + token, + price, + lag(price) OVER(PARTITION BY token ORDER BY day) AS previous_price + FROM dex_prices_1 + ), + + dex_prices AS ( + SELECT + day, + token, + price, + LEAD(DAY, 1, NOW()) OVER (PARTITION BY token ORDER BY DAY) AS day_of_next_change + FROM dex_prices_2 + WHERE (price < previous_price * 1e4 AND price > previous_price / 1e4) + ), + + bpt_prices AS( + SELECT DISTINCT + day, + contract_address AS token, + decimals, + bpt_price + FROM {{ ref('balancer_bpt_prices') }} + WHERE blockchain = '{{blockchain}}' + {% if is_incremental() %} + AND {{ incremental_predicate('day') }} + {% endif %} + AND version = '{{version}}' + ), + + eth_prices AS ( + SELECT + DATE_TRUNC('day', minute) as day, + AVG(price) as eth_price + FROM {{ source('prices', 'usd') }} + WHERE symbol = 'ETH' + {% if is_incremental() %} + WHERE {{ incremental_predicate('minute') }} + {% endif %} + GROUP BY 1 + ), + + gyro_prices AS ( + SELECT + token_address, + decimals, + price + FROM {{ ref('gyroscope_gyro_tokens') }} + WHERE blockchain = '{{blockchain}}' + ), + + daily_balance AS ( + SELECT + block_date, + pool_id, + pool_symbol, + pool_type, + token_address, + token_symbol, + LEAD(block_date, 1, NOW()) OVER (PARTITION BY token_address, pool_id ORDER BY block_date) AS day_of_next_change, + SUM(delta_amount) AS daily_amount + FROM {{ ref('balancer_token_balance_changes') }} + WHERE blockchain = '{{blockchain}}' + GROUP BY 1, 2, 3, 4, 5, 6 + ), + + calendar AS ( + SELECT date_sequence AS day + FROM unnest(sequence(date('2021-04-21'), date(now()), interval '1' day)) as t(date_sequence) + ), + + daily_usd_balance AS ( + SELECT + c.day AS block_date, + '{{blockchain}}"' as blockchain, + b.pool_id, + b.pool_symbol, + b.pool_type, + b.token_address, + b.token_symbol, + daily_amount, + daily_amount * COALESCE(p1.price, p2.price, p3.bpt_price, p4.price, 0) AS daily_amount_usd + FROM calendar c + LEFT JOIN daily_balance b ON b.block_date <= c.day + AND c.day < b.day_of_next_change + LEFT JOIN prices p1 ON p1.day = b.block_date + AND p1.token = b.token_address + LEFT JOIN dex_prices p2 ON p2.day <= c.day + AND c.day < p2.day_of_next_change + AND p2.token = b.token_address + LEFT JOIN bpt_prices p3 ON p3.day = b.block_date + AND p3.token = b.token_address + LEFT JOIN gyro_prices p4 ON p4.token_address = b.token_address + WHERE b.token_address != BYTEARRAY_SUBSTRING(b.pool_id, 1, 20) + ), + + weighted_pool_amount_estimates AS ( + SELECT + b.block_date, + b.pool_id, + q.name, + pool_type, + ROW_NUMBER() OVER (PARTITION BY b.block_date, b.pool_id ORDER BY SUM(b.daily_amount_usd) ASC) AS pricing_count, --to avoid double count in pools with multiple pricing assets + SUM(b.daily_amount_usd) / COALESCE(SUM(w.normalized_weight), 1) AS weighted_daily_amount_usd + FROM daily_usd_balance b + LEFT JOIN {{ ref('balancer_pools_tokens_weights') }} w ON b.pool_id = w.pool_id + AND b.token_address = w.token_address + AND b.daily_amount_usd > 0 + LEFT JOIN {{ ref('balancer_token_whitelist') }} q ON b.token_address = q.address + AND b.blockchain = q.chain + WHERE q.name IS NOT NULL + AND b.pool_type = 'weighted' -- filters for weighted pools with pricing assets + AND w.blockchain = '{{blockchain}}' + AND w.version = '2' + GROUP BY 1, 2, 3, 4 + ), + + weighted_pool_amount_estimates_2 AS( + SELECT e.block_date, + e.pool_id, + SUM(e.weighted_daily_amount_usd) / MAX(e.pricing_count) AS weighted_daily_amount_usd + FROM weighted_pool_amount_estimates e + GROUP BY 1,2 + ) + + SELECT + c.block_date, + c.pool_id, + BYTEARRAY_SUBSTRING(c.pool_id, 1, 20) AS pool_address, + c.pool_symbol, + '2' AS version, + 'ethereum' AS blockchain, + c.pool_type, + c.token_address, + c.token_symbol, + c.daily_amount AS daily_delta, + COALESCE(b.weighted_daily_amount_usd * w.normalized_weight, c.daily_amount_usd) AS daily_delta_usd, + COALESCE(b.weighted_daily_amount_usd * w.normalized_weight, c.daily_amount_usd)/e.eth_price AS daily_delta_eth + FROM daily_usd_balance c + FULL OUTER JOIN weighted_pool_amount_estimates_2 b ON c.block_date = b.block_date + AND c.pool_id = b.pool_id + LEFT JOIN {{ ref('balancer_pools_tokens_weights') }} w ON b.pool_id = w.pool_id + AND w.blockchain = 'ethereum' + AND w.version = '2' + AND w.token_address = c.token_address + LEFT JOIN eth_prices e ON e.day = c.block_date + {% endmacro %} \ No newline at end of file diff --git a/macros/models/_project/balancer/balancer_token_balance_changes_macro.sql b/macros/models/_project/balancer/balancer_token_balance_changes_macro.sql new file mode 100644 index 00000000000..b16c9bf038e --- /dev/null +++ b/macros/models/_project/balancer/balancer_token_balance_changes_macro.sql @@ -0,0 +1,169 @@ +{% macro + balancer_token_balance_changes_macro( + blockchain, version + ) +%} +WITH pool_labels AS ( + SELECT + address AS pool_id, + name AS pool_symbol, + pool_type + FROM {{ ref('labels_balancer_v2_pools') }} + WHERE blockchain = '{{blockchain}}' + ), + + swaps_changes AS ( + SELECT + evt_block_time, + evt_block_number, + evt_tx_hash, + evt_index, + pool_id, + token, + SUM(COALESCE(delta, INT256 '0')) AS delta + FROM + ( + SELECT + evt_block_time, + evt_block_number, + evt_tx_hash, + evt_index, + poolId AS pool_id, + tokenIn AS token, + CAST(amountIn as int256) AS delta + FROM {{ source('balancer_v2_' + blockchain, 'Vault_evt_Swap') }} + {% if is_incremental() %} + WHERE {{ incremental_predicate('evt_block_time') }} + {% endif %} + + UNION ALL + + SELECT + evt_block_time, + evt_block_number, + evt_tx_hash, + evt_index, + poolId AS pool_id, + tokenOut AS token, + -CAST(amountOut AS int256) AS delta + FROM {{ source('balancer_v2_' + blockchain, 'Vault_evt_Swap') }} + {% if is_incremental() %} + WHERE {{ incremental_predicate('evt_block_time') }} + {% endif %} + ) swaps + GROUP BY 1, 2, 3, 4, 5, 6 + ), + + zipped_balance_changes AS ( + SELECT + evt_block_time, + evt_block_number, + evt_tx_hash, + evt_index, + poolId AS pool_id, + t.tokens, + d.deltas, + p.protocolFeeAmounts + FROM {{ source('balancer_v2_' + blockchain, 'Vault_evt_PoolBalanceChanged') }} + CROSS JOIN UNNEST (tokens) WITH ORDINALITY as t(tokens,i) + CROSS JOIN UNNEST (deltas) WITH ORDINALITY as d(deltas,i) + CROSS JOIN UNNEST (protocolFeeAmounts) WITH ORDINALITY as p(protocolFeeAmounts,i) + WHERE t.i = d.i + AND d.i = p.i + {% if is_incremental() %} + AND {{ incremental_predicate('evt_block_time') }} + {% endif %} + ), + + balances_changes AS ( + SELECT + evt_block_time, + evt_block_number, + evt_tx_hash, + evt_index, + pool_id, + tokens AS token, + deltas - CAST(protocolFeeAmounts as int256) AS delta + FROM zipped_balance_changes + ), + + managed_changes AS ( + SELECT + evt_block_time, + evt_block_number, + evt_tx_hash, + evt_index, + poolId AS pool_id, + token, + cashDelta + managedDelta AS delta + FROM {{ source('balancer_v2_' + blockchain, 'Vault_evt_PoolBalanceManaged') }} + {% if is_incremental() %} + WHERE {{ incremental_predicate('evt_block_time') }} + {% endif %} + ) + + + SELECT + date_trunc('day', b.evt_block_time) AS block_date, + b.evt_block_time, + b.evt_block_number, + '{{blockchain}}' AS blockchain, + b.evt_tx_hash, + b.evt_index, + b.pool_id, + BYTEARRAY_SUBSTRING(b.pool_id, 1, 20) AS pool_address, + p.pool_symbol, + p.pool_type, + '{{version}}' AS version, + b.token AS token_address, + t.symbol AS token_symbol, + b.amount AS delta_amount_raw, + CASE WHEN BYTEARRAY_SUBSTRING(b.pool_id, 1, 20) = b.token + THEN amount / POWER (10, 18) --for Balancer Pool Tokens + ELSE amount / POWER (10, COALESCE(t.decimals, 0)) + END AS delta_amount + FROM + ( + SELECT + evt_block_time, + evt_block_number, + evt_tx_hash, + evt_index, + pool_id, + token, + COALESCE(delta, INT256 '0') AS amount + FROM balances_changes + + UNION ALL + + SELECT + evt_block_time, + evt_block_number, + evt_tx_hash, + evt_index, + pool_id, + token, + delta AS amount + FROM + swaps_changes + + UNION ALL + + SELECT + evt_block_time, + evt_block_number, + evt_tx_hash, + evt_index, + pool_id, + token, + CAST(delta AS int256) AS amount + FROM managed_changes + ) b + LEFT JOIN {{ source('tokens', 'erc20') }} t ON t.contract_address = b.token + AND blockchain = '{{blockchain}}' + LEFT JOIN pool_labels p ON p.pool_id = BYTEARRAY_SUBSTRING(b.pool_id, 1, 20) + {% if is_incremental() %} + WHERE {{ incremental_predicate('evt_block_time') }} + {% endif %} + + {% endmacro %} \ No newline at end of file diff --git a/models/_project/balancer/balances/_schema.yml b/models/_project/balancer/balances/_schema.yml new file mode 100644 index 00000000000..9d8b84cf3a1 --- /dev/null +++ b/models/_project/balancer/balances/_schema.yml @@ -0,0 +1,98 @@ +version: 2 + +models: + - name: balancer_token_balance_changes + meta: + blockchain: arbitrum, avalanche_c, base, ethereum, gnosis, optimism, polygon, zkevm + contributors: viniabussafi + config: + tags: ['arbitrum', 'avalanche_c', 'base', 'ethereum', 'gnosis', 'optimism', 'polygon', 'zkevm', 'bpt', 'supply', 'changes'] + description: > + Token Balance Changes on Balancer Pools. + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - block_date + - evt_tx_hash + - evt_index + - token_address + columns: + - &block_date + name: block_date + description: "UTC event block date of each DEX trade" + - &evt_block_time + name: evt_block_time + description: 'Block time of transfer event' + - &evt_block_number + name: evt_block_number + description: 'Block number of transfer event' + - &blockchain + name: blockchain + description: "Blockchain" + - &evt_tx_hash + name: evt_tx_hash + description: 'Transaction hash of transfer event' + - &evt_index + name: evt_index + description: 'Event index' + - &pool_id + name: pool_id + description: "Unique encoded identifier that refers to each pool" + - &pool_address + name: pool_address + description: "Pool address" + - &pool_symbol + name: pool_symbol + description: "Token symbols, followed by their respective weights, if applicable" + - &pool_type + name: pool_type + description: "Pool attributes, determined by the pool's factory" + - &version + name: version + description: "Version of Balancer where the liquidity pool used in transaction is deployed" + - &token_address + name: token_address + description: "Contract address of the token" + - &token_symbol + name: token_symbol + description: "Token symbol" + - &delta_amount_raw + name: delta_amount_raw + description: "Raw value of the transaction at the time of execution in the original currency" + - &delta_amount + name: delta_amount + description: "Normalized value of the transaction at the time of execution in the original currency" + + - name: balancer_token_balance_changes_daily + meta: + blockchain: arbitrum, avalanche_c, base, ethereum, gnosis, optimism, polygon, zkevm + contributors: viniabussafi + config: + tags: ['arbitrum', 'avalanche_c', 'base', 'ethereum', 'gnosis', 'optimism', 'polygon', 'zkevm', 'bpt', 'supply', 'changes'] + description: > + Token Balance Changes on Balancer Pools, grouped by day. + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - block_date + - pool_id + - token_address + columns: + - *block_date + - *pool_id + - *pool_address + - *pool_symbol + - *version + - *blockchain + - *pool_type + - *token_address + - *token_symbol + - &daily_delta + name: daily_delta + description: "Daily total impact on token balance" + - &daily_delta_usd + name: daily_delta_usd + description: "Daily total impact on token balance, in USD" + - &daily_delta_eth + name: daily_delta_eth + description: "Daily total impact on token balance, in eth" \ No newline at end of file diff --git a/models/_project/balancer/balances/arbitrum/_schema.yml b/models/_project/balancer/balances/arbitrum/_schema.yml new file mode 100644 index 00000000000..ff5e07ed5d8 --- /dev/null +++ b/models/_project/balancer/balances/arbitrum/_schema.yml @@ -0,0 +1,100 @@ +version: 2 + +models: + - name: balancer_v2_arbitrum_token_balance_changes + meta: + blockchain: arbitrum + project: balancer_v2 + contributors: viniabussafi + config: + tags: ['arbitrum', 'bpt', 'supply', 'changes'] + description: > + Token Balance Changes on Balancer Pools. + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - block_date + - evt_tx_hash + - evt_index + - token_address + columns: + - &block_date + name: block_date + description: "UTC event block date of each DEX trade" + - &evt_block_time + name: evt_block_time + description: 'Block time of transfer event' + - &evt_block_number + name: evt_block_number + description: 'Block number of transfer event' + - &blockchain + name: blockchain + description: "Blockchain" + - &evt_tx_hash + name: evt_tx_hash + description: 'Transaction hash of transfer event' + - &evt_index + name: evt_index + description: 'Event index' + - &pool_id + name: pool_id + description: "Unique encoded identifier that refers to each pool" + - &pool_address + name: pool_address + description: "Pool address" + - &pool_symbol + name: pool_symbol + description: "Token symbols, followed by their respective weights, if applicable" + - &pool_type + name: pool_type + description: "Pool attributes, determined by the pool's factory" + - &version + name: version + description: "Version of Balancer where the liquidity pool used in transaction is deployed" + - &token_address + name: token_address + description: "Contract address of the token" + - &token_symbol + name: token_symbol + description: "Token symbol" + - &delta_amount_raw + name: delta_amount_raw + description: "Raw value of the transaction at the time of execution in the original currency" + - &delta_amount + name: delta_amount + description: "Normalized value of the transaction at the time of execution in the original currency" + + - name: balancer_v2_arbitrum_token_balance_changes_daily + meta: + blockchain: arbitrum + project: balancer_v2 + contributors: viniabussafi + config: + tags: ['arbitrum', 'bpt', 'supply', 'changes'] + description: > + Token Balance Changes on Balancer Pools, grouped by day. + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - block_date + - pool_id + - token_address + columns: + - *block_date + - *pool_id + - *pool_address + - *pool_symbol + - *version + - *blockchain + - *pool_type + - *token_address + - *token_symbol + - &daily_delta + name: daily_delta + description: "Daily total impact on token balance" + - &daily_delta_usd + name: daily_delta_usd + description: "Daily total impact on token balance, in USD" + - &daily_delta_eth + name: daily_delta_eth + description: "Daily total impact on token balance, in eth" \ No newline at end of file diff --git a/models/_project/balancer/balances/arbitrum/balancer_v2_arbitrum_token_balance_changes.sql b/models/_project/balancer/balances/arbitrum/balancer_v2_arbitrum_token_balance_changes.sql new file mode 100644 index 00000000000..ca58f713377 --- /dev/null +++ b/models/_project/balancer/balances/arbitrum/balancer_v2_arbitrum_token_balance_changes.sql @@ -0,0 +1,16 @@ +{% set blockchain = 'arbitrum' %} + +{{ config( + schema = 'balancer_v2_arbitrum', + alias = 'token_balance_changes', + materialized = 'table', + file_format = 'delta' + ) +}} + +{{ + balancer_token_balance_changes_macro( + blockchain = blockchain, + version = '2' + ) +}} \ No newline at end of file diff --git a/models/_project/balancer/balances/arbitrum/balancer_v2_arbitrum_token_balance_changes_daily.sql b/models/_project/balancer/balances/arbitrum/balancer_v2_arbitrum_token_balance_changes_daily.sql new file mode 100644 index 00000000000..c35d7b60259 --- /dev/null +++ b/models/_project/balancer/balances/arbitrum/balancer_v2_arbitrum_token_balance_changes_daily.sql @@ -0,0 +1,17 @@ +{% set blockchain = 'arbitrum' %} + +{{ + config( + schema = 'balancer_v2_arbitrum', + alias = 'token_balance_changes_daily', + materialized = 'table', + file_format = 'delta' + ) +}} + +{{ + balancer_token_balance_changes_daily_agg_macro( + blockchain = blockchain, + version = '2' + ) +}} \ No newline at end of file diff --git a/models/_project/balancer/balances/avalanche_c/_schema.yml b/models/_project/balancer/balances/avalanche_c/_schema.yml new file mode 100644 index 00000000000..e341729e2fa --- /dev/null +++ b/models/_project/balancer/balances/avalanche_c/_schema.yml @@ -0,0 +1,100 @@ +version: 2 + +models: + - name: balancer_v2_avalanche_c_token_balance_changes + meta: + blockchain: avalanche_c + project: balancer_v2 + contributors: viniabussafi + config: + tags: ['avalanche_c', 'bpt', 'supply', 'changes'] + description: > + Token Balance Changes on Balancer Pools. + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - block_date + - evt_tx_hash + - evt_index + - token_address + columns: + - &block_date + name: block_date + description: "UTC event block date of each DEX trade" + - &evt_block_time + name: evt_block_time + description: 'Block time of transfer event' + - &evt_block_number + name: evt_block_number + description: 'Block number of transfer event' + - &blockchain + name: blockchain + description: "Blockchain" + - &evt_tx_hash + name: evt_tx_hash + description: 'Transaction hash of transfer event' + - &evt_index + name: evt_index + description: 'Event index' + - &pool_id + name: pool_id + description: "Unique encoded identifier that refers to each pool" + - &pool_address + name: pool_address + description: "Pool address" + - &pool_symbol + name: pool_symbol + description: "Token symbols, followed by their respective weights, if applicable" + - &pool_type + name: pool_type + description: "Pool attributes, determined by the pool's factory" + - &version + name: version + description: "Version of Balancer where the liquidity pool used in transaction is deployed" + - &token_address + name: token_address + description: "Contract address of the token" + - &token_symbol + name: token_symbol + description: "Token symbol" + - &delta_amount_raw + name: delta_amount_raw + description: "Raw value of the transaction at the time of execution in the original currency" + - &delta_amount + name: delta_amount + description: "Normalized value of the transaction at the time of execution in the original currency" + + - name: balancer_v2_avalanche_c_token_balance_changes_daily + meta: + blockchain: avalanche_c + project: balancer_v2 + contributors: viniabussafi + config: + tags: ['avalanche_c', 'bpt', 'supply', 'changes'] + description: > + Token Balance Changes on Balancer Pools, grouped by day. + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - block_date + - pool_id + - token_address + columns: + - *block_date + - *pool_id + - *pool_address + - *pool_symbol + - *version + - *blockchain + - *pool_type + - *token_address + - *token_symbol + - &daily_delta + name: daily_delta + description: "Daily total impact on token balance" + - &daily_delta_usd + name: daily_delta_usd + description: "Daily total impact on token balance, in USD" + - &daily_delta_eth + name: daily_delta_eth + description: "Daily total impact on token balance, in eth" \ No newline at end of file diff --git a/models/_project/balancer/balances/avalanche_c/balancer_v2_avalanche_c_token_balance_changes.sql b/models/_project/balancer/balances/avalanche_c/balancer_v2_avalanche_c_token_balance_changes.sql new file mode 100644 index 00000000000..ab55e6e99f1 --- /dev/null +++ b/models/_project/balancer/balances/avalanche_c/balancer_v2_avalanche_c_token_balance_changes.sql @@ -0,0 +1,16 @@ +{% set blockchain = 'avalanche_c' %} + +{{ config( + schema = 'balancer_v2_avalanche_c', + alias = 'token_balance_changes', + materialized = 'table', + file_format = 'delta' + ) +}} + +{{ + balancer_token_balance_changes_macro( + blockchain = blockchain, + version = '2' + ) +}} \ No newline at end of file diff --git a/models/_project/balancer/balances/avalanche_c/balancer_v2_avalanche_c_token_balance_changes_daily.sql b/models/_project/balancer/balances/avalanche_c/balancer_v2_avalanche_c_token_balance_changes_daily.sql new file mode 100644 index 00000000000..35ed123547e --- /dev/null +++ b/models/_project/balancer/balances/avalanche_c/balancer_v2_avalanche_c_token_balance_changes_daily.sql @@ -0,0 +1,17 @@ +{% set blockchain = 'avalanche_c' %} + +{{ + config( + schema = 'balancer_v2_avalanche_c', + alias = 'token_balance_changes_daily', + materialized = 'table', + file_format = 'delta' + ) +}} + +{{ + balancer_token_balance_changes_daily_agg_macro( + blockchain = blockchain, + version = '2' + ) +}} \ No newline at end of file diff --git a/models/_project/balancer/balances/balancer_token_balance_changes.sql b/models/_project/balancer/balances/balancer_token_balance_changes.sql new file mode 100644 index 00000000000..7f531a769f3 --- /dev/null +++ b/models/_project/balancer/balances/balancer_token_balance_changes.sql @@ -0,0 +1,46 @@ +{{ config( + schema = 'balancer', + alias = 'token_balance_changes', + post_hook='{{ expose_spells(blockchains = \'["arbitrum", "avalanche_c", "base", "ethereum", "gnosis", "optimism", "polygon", "zkevm"]\', + spell_type = "project", + spell_name = "balancer", + contributors = \'["viniabussafi"]\') }}' + ) +}} + +{% set balancer_models = [ + ref('balancer_v2_arbitrum_token_balance_changes'), + ref('balancer_v2_avalanche_c_token_balance_changes'), + ref('balancer_v2_base_token_balance_changes'), + ref('balancer_v2_ethereum_token_balance_changes'), + ref('balancer_v2_gnosis_token_balance_changes'), + ref('balancer_v2_optimism_token_balance_changes'), + ref('balancer_v2_polygon_token_balance_changes'), + ref('balancer_v2_zkevm_token_balance_changes') +] %} + +SELECT * +FROM ( + {% for model in balancer_models %} + SELECT + block_date + , evt_block_time + , evt_block_number + , blockchain + , evt_tx_hash + , evt_index + , pool_id + , pool_address + , pool_symbol + , pool_type + , version + , token_address + , token_symbol + , delta_amount_raw + , delta_amount + FROM {{ model }} + {% if not loop.last %} + UNION ALL + {% endif %} + {% endfor %} +) \ No newline at end of file diff --git a/models/_project/balancer/balances/balancer_token_balance_changes_daily.sql b/models/_project/balancer/balances/balancer_token_balance_changes_daily.sql new file mode 100644 index 00000000000..8e199a25708 --- /dev/null +++ b/models/_project/balancer/balances/balancer_token_balance_changes_daily.sql @@ -0,0 +1,43 @@ +{{ config( + schema = 'balancer', + alias = 'token_balance_changes_daily', + post_hook='{{ expose_spells(blockchains = \'["arbitrum", "avalanche_c", "base", "ethereum", "gnosis", "optimism", "polygon", "zkevm"]\', + spell_type = "project", + spell_name = "balancer", + contributors = \'["viniabussafi"]\') }}' + ) +}} + +{% set balancer_models = [ + ref('balancer_v2_arbitrum_token_balance_changes_daily'), + ref('balancer_v2_avalanche_c_token_balance_changes_daily'), + ref('balancer_v2_base_token_balance_changes_daily'), + ref('balancer_v2_ethereum_token_balance_changes_daily'), + ref('balancer_v2_gnosis_token_balance_changes_daily'), + ref('balancer_v2_optimism_token_balance_changes_daily'), + ref('balancer_v2_polygon_token_balance_changes_daily'), + ref('balancer_v2_zkevm_token_balance_changes_daily') +] %} + +SELECT * +FROM ( + {% for model in balancer_models %} + SELECT + block_date + , pool_id + , pool_address + , pool_symbol + , version + , blockchain + , pool_type + , token_address + , token_symbol + , daily_delta + , daily_delta_usd + , daily_delta_eth + FROM {{ model }} + {% if not loop.last %} + UNION ALL + {% endif %} + {% endfor %} +) \ No newline at end of file diff --git a/models/_project/balancer/balances/base/_schema.yml b/models/_project/balancer/balances/base/_schema.yml new file mode 100644 index 00000000000..89a11b3e539 --- /dev/null +++ b/models/_project/balancer/balances/base/_schema.yml @@ -0,0 +1,100 @@ +version: 2 + +models: + - name: balancer_v2_base_token_balance_changes + meta: + blockchain: base + project: balancer_v2 + contributors: viniabussafi + config: + tags: ['base', 'bpt', 'supply', 'changes'] + description: > + Token Balance Changes on Balancer Pools. + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - block_date + - evt_tx_hash + - evt_index + - token_address + columns: + - &block_date + name: block_date + description: "UTC event block date of each DEX trade" + - &evt_block_time + name: evt_block_time + description: 'Block time of transfer event' + - &evt_block_number + name: evt_block_number + description: 'Block number of transfer event' + - &blockchain + name: blockchain + description: "Blockchain" + - &evt_tx_hash + name: evt_tx_hash + description: 'Transaction hash of transfer event' + - &evt_index + name: evt_index + description: 'Event index' + - &pool_id + name: pool_id + description: "Unique encoded identifier that refers to each pool" + - &pool_address + name: pool_address + description: "Pool address" + - &pool_symbol + name: pool_symbol + description: "Token symbols, followed by their respective weights, if applicable" + - &pool_type + name: pool_type + description: "Pool attributes, determined by the pool's factory" + - &version + name: version + description: "Version of Balancer where the liquidity pool used in transaction is deployed" + - &token_address + name: token_address + description: "Contract address of the token" + - &token_symbol + name: token_symbol + description: "Token symbol" + - &delta_amount_raw + name: delta_amount_raw + description: "Raw value of the transaction at the time of execution in the original currency" + - &delta_amount + name: delta_amount + description: "Normalized value of the transaction at the time of execution in the original currency" + + - name: balancer_v2_base_token_balance_changes_daily + meta: + blockchain: base + project: balancer_v2 + contributors: viniabussafi + config: + tags: ['base', 'bpt', 'supply', 'changes'] + description: > + Token Balance Changes on Balancer Pools, grouped by day. + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - block_date + - pool_id + - token_address + columns: + - *block_date + - *pool_id + - *pool_address + - *pool_symbol + - *version + - *blockchain + - *pool_type + - *token_address + - *token_symbol + - &daily_delta + name: daily_delta + description: "Daily total impact on token balance" + - &daily_delta_usd + name: daily_delta_usd + description: "Daily total impact on token balance, in USD" + - &daily_delta_eth + name: daily_delta_eth + description: "Daily total impact on token balance, in eth" \ No newline at end of file diff --git a/models/_project/balancer/balances/base/balancer_v2_base_token_balance_changes.sql b/models/_project/balancer/balances/base/balancer_v2_base_token_balance_changes.sql new file mode 100644 index 00000000000..1f35750f21d --- /dev/null +++ b/models/_project/balancer/balances/base/balancer_v2_base_token_balance_changes.sql @@ -0,0 +1,16 @@ +{% set blockchain = 'base' %} + +{{ config( + schema = 'balancer_v2_base', + alias = 'token_balance_changes', + materialized = 'table', + file_format = 'delta' + ) +}} + +{{ + balancer_token_balance_changes_macro( + blockchain = blockchain, + version = '2' + ) +}} \ No newline at end of file diff --git a/models/_project/balancer/balances/base/balancer_v2_base_token_balance_changes_daily.sql b/models/_project/balancer/balances/base/balancer_v2_base_token_balance_changes_daily.sql new file mode 100644 index 00000000000..fe24b712bee --- /dev/null +++ b/models/_project/balancer/balances/base/balancer_v2_base_token_balance_changes_daily.sql @@ -0,0 +1,17 @@ +{% set blockchain = 'base' %} + +{{ + config( + schema = 'balancer_v2_base', + alias = 'token_balance_changes_daily', + materialized = 'table', + file_format = 'delta' + ) +}} + +{{ + balancer_token_balance_changes_daily_agg_macro( + blockchain = blockchain, + version = '2' + ) +}} \ No newline at end of file diff --git a/models/_project/balancer/balances/ethereum/_schema.yml b/models/_project/balancer/balances/ethereum/_schema.yml new file mode 100644 index 00000000000..dab33f52016 --- /dev/null +++ b/models/_project/balancer/balances/ethereum/_schema.yml @@ -0,0 +1,131 @@ +version: 2 + +models: + - name: balancer_ethereum_balances + meta: + blockchain: ethereum + project: balancer + contributors: jacektrocinski, metacrypto, viniabussafi + config: + tags: ['ethereum', 'balancer', 'balances'] + description: > + ERC20 token rolling sum balances on Balancer, an automated portfolio manager and trading platform. + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - day + - pool + - token + columns: + - &day + name: day + description: "UTC event block time truncated to the day mark" + tests: + - not_null + - &pool + name: pool + description: "Balancer pool contract address" + - &token + name: token + description: "Token contract address" + - &cumulative_amount + name: cumulative_amount + description: "Balance of a token" + + - name: balancer_v2_ethereum_token_balance_changes + meta: + blockchain: ethereum + project: balancer_v2 + contributors: viniabussafi + config: + tags: ['ethereum', 'bpt', 'supply', 'changes'] + description: > + Token Balance Changes on Balancer Pools. + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - block_date + - evt_tx_hash + - evt_index + - token_address + columns: + - &block_date + name: block_date + description: "UTC event block date of each DEX trade" + - &evt_block_time + name: evt_block_time + description: "Block time of transfer event" + - &evt_block_number + name: evt_block_number + description: "Block number of transfer event" + - &blockchain + name: blockchain + description: "Blockchain" + - &evt_tx_hash + name: evt_tx_hash + description: "Transaction hash of transfer event" + - &evt_index + name: evt_index + description: "Event index" + - &pool_id + name: pool_id + description: "Unique encoded identifier that refers to each pool" + - &pool_address + name: pool_address + description: "Pool address" + - &pool_symbol + name: pool_symbol + description: "Token symbols, followed by their respective weights, if applicable" + - &pool_type + name: pool_type + description: "Pool attributes, determined by the pool's factory" + - &version + name: version + description: "Version of Balancer where the liquidity pool used in transaction is deployed" + - &token_address + name: token_address + description: "Contract address of the token" + - &token_symbol + name: token_symbol + description: "Token symbol" + - &delta_amount_raw + name: delta_amount_raw + description: "Raw value of the transaction at the time of execution in the original currency" + - &delta_amount + name: delta_amount + description: "Normalized value of the transaction at the time of execution in the original currency" + + - name: balancer_v2_ethereum_token_balance_changes_daily + meta: + blockchain: ethereum + project: balancer_v2 + contributors: viniabussafi + config: + tags: ['ethereum', 'bpt', 'supply', 'changes'] + description: > + Token Balance Changes on Balancer Pools, grouped by day. + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - block_date + - pool_id + - token_address + columns: + - *block_date + - *pool_id + - *pool_address + - *pool_symbol + - *version + - *blockchain + - *pool_type + - *token_address + - *token_symbol + - &daily_delta + name: daily_delta + description: "Daily total impact on token balance" + - &daily_delta_usd + name: daily_delta_usd + description: "Daily total impact on token balance, in USD" + - &daily_delta_eth + name: daily_delta_eth + description: "Daily total impact on token balance, in ETH" \ No newline at end of file diff --git a/models/balancer/ethereum/balancer_ethereum_balances.sql b/models/_project/balancer/balances/ethereum/balancer_ethereum_balances.sql similarity index 88% rename from models/balancer/ethereum/balancer_ethereum_balances.sql rename to models/_project/balancer/balances/ethereum/balancer_ethereum_balances.sql index bddec24d0bf..aa584c6c39d 100644 --- a/models/balancer/ethereum/balancer_ethereum_balances.sql +++ b/models/_project/balancer/balances/ethereum/balancer_ethereum_balances.sql @@ -1,11 +1,11 @@ {{ config( + schema = 'balancer_ethereum', alias = 'balances', - post_hook='{{ expose_spells(\'["ethereum"]\', - "project", - "balancer", - \'["metacrypto", "jacektrocinski", "viniabussafi"]\') }}' + spell_type = "project", + spell_name = "balancer", + contributors = \'["metacrypto", "jacektrocinski", "viniabussafi"]\') }}' )  }} @@ -72,5 +72,4 @@ running_cumulative_balance_by_token AS ( LEFT JOIN cumulative_balance_by_token b ON b.day <= c.day AND c.day < b.day_of_next_change ) -SELECT * FROM running_cumulative_balance_by_token - +SELECT * FROM running_cumulative_balance_by_token \ No newline at end of file diff --git a/models/_project/balancer/balances/ethereum/balancer_v2_ethereum_token_balance_changes.sql b/models/_project/balancer/balances/ethereum/balancer_v2_ethereum_token_balance_changes.sql new file mode 100644 index 00000000000..12b1a61ad46 --- /dev/null +++ b/models/_project/balancer/balances/ethereum/balancer_v2_ethereum_token_balance_changes.sql @@ -0,0 +1,16 @@ +{% set blockchain = 'ethereum' %} + +{{ config( + schema = 'balancer_v2_ethereum', + alias = 'token_balance_changes', + materialized = 'table', + file_format = 'delta' + ) +}} + +{{ + balancer_token_balance_changes_macro( + blockchain = blockchain, + version = '2' + ) +}} \ No newline at end of file diff --git a/models/_project/balancer/balances/ethereum/balancer_v2_ethereum_token_balance_changes_daily.sql b/models/_project/balancer/balances/ethereum/balancer_v2_ethereum_token_balance_changes_daily.sql new file mode 100644 index 00000000000..44aeb0ee7b8 --- /dev/null +++ b/models/_project/balancer/balances/ethereum/balancer_v2_ethereum_token_balance_changes_daily.sql @@ -0,0 +1,17 @@ +{% set blockchain = 'ethereum' %} + +{{ + config( + schema = 'balancer_v2_ethereum', + alias = 'token_balance_changes_daily', + materialized = 'table', + file_format = 'delta' + ) +}} + +{{ + balancer_token_balance_changes_daily_agg_macro( + blockchain = blockchain, + version = '2' + ) +}} \ No newline at end of file diff --git a/models/_project/balancer/balances/gnosis/_schema.yml b/models/_project/balancer/balances/gnosis/_schema.yml new file mode 100644 index 00000000000..9fdd91e45e3 --- /dev/null +++ b/models/_project/balancer/balances/gnosis/_schema.yml @@ -0,0 +1,100 @@ +version: 2 + +models: + - name: balancer_v2_gnosis_token_balance_changes + meta: + blockchain: gnosis + project: balancer_v2 + contributors: viniabussafi + config: + tags: ['gnosis', 'bpt', 'supply', 'changes'] + description: > + Token Balance Changes on Balancer Pools. + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - block_date + - evt_tx_hash + - evt_index + - token_address + columns: + - &block_date + name: block_date + description: "UTC event block date of each DEX trade" + - &evt_block_time + name: evt_block_time + description: 'Block time of transfer event' + - &evt_block_number + name: evt_block_number + description: 'Block number of transfer event' + - &blockchain + name: blockchain + description: "Blockchain" + - &evt_tx_hash + name: evt_tx_hash + description: 'Transaction hash of transfer event' + - &evt_index + name: evt_index + description: 'Event index' + - &pool_id + name: pool_id + description: "Unique encoded identifier that refers to each pool" + - &pool_address + name: pool_address + description: "Pool address" + - &pool_symbol + name: pool_symbol + description: "Token symbols, followed by their respective weights, if applicable" + - &pool_type + name: pool_type + description: "Pool attributes, determined by the pool's factory" + - &version + name: version + description: "Version of Balancer where the liquidity pool used in transaction is deployed" + - &token_address + name: token_address + description: "Contract address of the token" + - &token_symbol + name: token_symbol + description: "Token symbol" + - &delta_amount_raw + name: delta_amount_raw + description: "Raw value of the transaction at the time of execution in the original currency" + - &delta_amount + name: delta_amount + description: "Normalized value of the transaction at the time of execution in the original currency" + + - name: balancer_v2_gnosis_token_balance_changes_daily + meta: + blockchain: gnosis + project: balancer_v2 + contributors: viniabussafi + config: + tags: ['gnosis', 'bpt', 'supply', 'changes'] + description: > + Token Balance Changes on Balancer Pools, grouped by day. + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - block_date + - pool_id + - token_address + columns: + - *block_date + - *pool_id + - *pool_address + - *pool_symbol + - *version + - *blockchain + - *pool_type + - *token_address + - *token_symbol + - &daily_delta + name: daily_delta + description: "Daily total impact on token balance" + - &daily_delta_usd + name: daily_delta_usd + description: "Daily total impact on token balance, in USD" + - &daily_delta_eth + name: daily_delta_eth + description: "Daily total impact on token balance, in eth" \ No newline at end of file diff --git a/models/_project/balancer/balances/gnosis/balancer_v2_gnosis_token_balance_changes.sql b/models/_project/balancer/balances/gnosis/balancer_v2_gnosis_token_balance_changes.sql new file mode 100644 index 00000000000..e3e0177541d --- /dev/null +++ b/models/_project/balancer/balances/gnosis/balancer_v2_gnosis_token_balance_changes.sql @@ -0,0 +1,16 @@ +{% set blockchain = 'gnosis' %} + +{{ config( + schema = 'balancer_v2_gnosis', + alias = 'token_balance_changes', + materialized = 'table', + file_format = 'delta' + ) +}} + +{{ + balancer_token_balance_changes_macro( + blockchain = blockchain, + version = '2' + ) +}} \ No newline at end of file diff --git a/models/_project/balancer/balances/gnosis/balancer_v2_gnosis_token_balance_changes_daily.sql b/models/_project/balancer/balances/gnosis/balancer_v2_gnosis_token_balance_changes_daily.sql new file mode 100644 index 00000000000..434e9b096fb --- /dev/null +++ b/models/_project/balancer/balances/gnosis/balancer_v2_gnosis_token_balance_changes_daily.sql @@ -0,0 +1,17 @@ +{% set blockchain = 'gnosis' %} + +{{ + config( + schema = 'balancer_v2_gnosis', + alias = 'token_balance_changes_daily', + materialized = 'table', + file_format = 'delta' + ) +}} + +{{ + balancer_token_balance_changes_daily_agg_macro( + blockchain = blockchain, + version = '2' + ) +}} \ No newline at end of file diff --git a/models/_project/balancer/balances/optimism/_schema.yml b/models/_project/balancer/balances/optimism/_schema.yml new file mode 100644 index 00000000000..952aefc44ee --- /dev/null +++ b/models/_project/balancer/balances/optimism/_schema.yml @@ -0,0 +1,100 @@ +version: 2 + +models: + - name: balancer_v2_optimism_token_balance_changes + meta: + blockchain: optimism + project: balancer_v2 + contributors: viniabussafi + config: + tags: ['optimism', 'bpt', 'supply', 'changes'] + description: > + Token Balance Changes on Balancer Pools. + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - block_date + - evt_tx_hash + - evt_index + - token_address + columns: + - &block_date + name: block_date + description: "UTC event block date of each DEX trade" + - &evt_block_time + name: evt_block_time + description: 'Block time of transfer event' + - &evt_block_number + name: evt_block_number + description: 'Block number of transfer event' + - &blockchain + name: blockchain + description: "Blockchain" + - &evt_tx_hash + name: evt_tx_hash + description: 'Transaction hash of transfer event' + - &evt_index + name: evt_index + description: 'Event index' + - &pool_id + name: pool_id + description: "Unique encoded identifier that refers to each pool" + - &pool_address + name: pool_address + description: "Pool address" + - &pool_symbol + name: pool_symbol + description: "Token symbols, followed by their respective weights, if applicable" + - &pool_type + name: pool_type + description: "Pool attributes, determined by the pool's factory" + - &version + name: version + description: "Version of Balancer where the liquidity pool used in transaction is deployed" + - &token_address + name: token_address + description: "Contract address of the token" + - &token_symbol + name: token_symbol + description: "Token symbol" + - &delta_amount_raw + name: delta_amount_raw + description: "Raw value of the transaction at the time of execution in the original currency" + - &delta_amount + name: delta_amount + description: "Normalized value of the transaction at the time of execution in the original currency" + + - name: balancer_v2_optimism_token_balance_changes_daily + meta: + blockchain: optimism + project: balancer_v2 + contributors: viniabussafi + config: + tags: ['optimism', 'bpt', 'supply', 'changes'] + description: > + Token Balance Changes on Balancer Pools, grouped by day. + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - block_date + - pool_id + - token_address + columns: + - *block_date + - *pool_id + - *pool_address + - *pool_symbol + - *version + - *blockchain + - *pool_type + - *token_address + - *token_symbol + - &daily_delta + name: daily_delta + description: "Daily total impact on token balance" + - &daily_delta_usd + name: daily_delta_usd + description: "Daily total impact on token balance, in USD" + - &daily_delta_eth + name: daily_delta_eth + description: "Daily total impact on token balance, in eth" \ No newline at end of file diff --git a/models/_project/balancer/balances/optimism/balancer_v2_optimism_token_balance_changes.sql b/models/_project/balancer/balances/optimism/balancer_v2_optimism_token_balance_changes.sql new file mode 100644 index 00000000000..39fd96a795d --- /dev/null +++ b/models/_project/balancer/balances/optimism/balancer_v2_optimism_token_balance_changes.sql @@ -0,0 +1,16 @@ +{% set blockchain = 'optimism' %} + +{{ config( + schema = 'balancer_v2_optimism', + alias = 'token_balance_changes', + materialized = 'table', + file_format = 'delta' + ) +}} + +{{ + balancer_token_balance_changes_macro( + blockchain = blockchain, + version = '2' + ) +}} \ No newline at end of file diff --git a/models/_project/balancer/balances/optimism/balancer_v2_optimism_token_balance_changes_daily.sql b/models/_project/balancer/balances/optimism/balancer_v2_optimism_token_balance_changes_daily.sql new file mode 100644 index 00000000000..ac9db7d6bd7 --- /dev/null +++ b/models/_project/balancer/balances/optimism/balancer_v2_optimism_token_balance_changes_daily.sql @@ -0,0 +1,17 @@ +{% set blockchain = 'optimism' %} + +{{ + config( + schema = 'balancer_v2_optimism', + alias = 'token_balance_changes_daily', + materialized = 'table', + file_format = 'delta' + ) +}} + +{{ + balancer_token_balance_changes_daily_agg_macro( + blockchain = blockchain, + version = '2' + ) +}} \ No newline at end of file diff --git a/models/_project/balancer/balances/polygon/_schema.yml b/models/_project/balancer/balances/polygon/_schema.yml new file mode 100644 index 00000000000..70c27f9cac4 --- /dev/null +++ b/models/_project/balancer/balances/polygon/_schema.yml @@ -0,0 +1,100 @@ +version: 2 + +models: + - name: balancer_v2_polygon_token_balance_changes + meta: + blockchain: polygon + project: balancer_v2 + contributors: viniabussafi + config: + tags: ['polygon', 'bpt', 'supply', 'changes'] + description: > + Token Balance Changes on Balancer Pools. + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - block_date + - evt_tx_hash + - evt_index + - token_address + columns: + - &block_date + name: block_date + description: "UTC event block date of each DEX trade" + - &evt_block_time + name: evt_block_time + description: 'Block time of transfer event' + - &evt_block_number + name: evt_block_number + description: 'Block number of transfer event' + - &blockchain + name: blockchain + description: "Blockchain" + - &evt_tx_hash + name: evt_tx_hash + description: 'Transaction hash of transfer event' + - &evt_index + name: evt_index + description: 'Event index' + - &pool_id + name: pool_id + description: "Unique encoded identifier that refers to each pool" + - &pool_address + name: pool_address + description: "Pool address" + - &pool_symbol + name: pool_symbol + description: "Token symbols, followed by their respective weights, if applicable" + - &pool_type + name: pool_type + description: "Pool attributes, determined by the pool's factory" + - &version + name: version + description: "Version of Balancer where the liquidity pool used in transaction is deployed" + - &token_address + name: token_address + description: "Contract address of the token" + - &token_symbol + name: token_symbol + description: "Token symbol" + - &delta_amount_raw + name: delta_amount_raw + description: "Raw value of the transaction at the time of execution in the original currency" + - &delta_amount + name: delta_amount + description: "Normalized value of the transaction at the time of execution in the original currency" + + - name: balancer_v2_polygon_token_balance_changes_daily + meta: + blockchain: polygon + project: balancer_v2 + contributors: viniabussafi + config: + tags: ['polygon', 'bpt', 'supply', 'changes'] + description: > + Token Balance Changes on Balancer Pools, grouped by day. + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - block_date + - pool_id + - token_address + columns: + - *block_date + - *pool_id + - *pool_address + - *pool_symbol + - *version + - *blockchain + - *pool_type + - *token_address + - *token_symbol + - &daily_delta + name: daily_delta + description: "Daily total impact on token balance" + - &daily_delta_usd + name: daily_delta_usd + description: "Daily total impact on token balance, in USD" + - &daily_delta_eth + name: daily_delta_eth + description: "Daily total impact on token balance, in eth" \ No newline at end of file diff --git a/models/_project/balancer/balances/polygon/balancer_v2_polygon_token_balance_changes.sql b/models/_project/balancer/balances/polygon/balancer_v2_polygon_token_balance_changes.sql new file mode 100644 index 00000000000..efbac69046b --- /dev/null +++ b/models/_project/balancer/balances/polygon/balancer_v2_polygon_token_balance_changes.sql @@ -0,0 +1,16 @@ +{% set blockchain = 'polygon' %} + +{{ config( + schema = 'balancer_v2_polygon', + alias = 'token_balance_changes', + materialized = 'table', + file_format = 'delta' + ) +}} + +{{ + balancer_token_balance_changes_macro( + blockchain = blockchain, + version = '2' + ) +}} \ No newline at end of file diff --git a/models/_project/balancer/balances/polygon/balancer_v2_polygon_token_balance_changes_daily.sql b/models/_project/balancer/balances/polygon/balancer_v2_polygon_token_balance_changes_daily.sql new file mode 100644 index 00000000000..fa318aaec80 --- /dev/null +++ b/models/_project/balancer/balances/polygon/balancer_v2_polygon_token_balance_changes_daily.sql @@ -0,0 +1,17 @@ +{% set blockchain = 'polygon' %} + +{{ + config( + schema = 'balancer_v2_polygon', + alias = 'token_balance_changes_daily', + materialized = 'table', + file_format = 'delta' + ) +}} + +{{ + balancer_token_balance_changes_daily_agg_macro( + blockchain = blockchain, + version = '2' + ) +}} \ No newline at end of file diff --git a/models/_project/balancer/balances/zkevm/_schema.yml b/models/_project/balancer/balances/zkevm/_schema.yml new file mode 100644 index 00000000000..3fae28a259a --- /dev/null +++ b/models/_project/balancer/balances/zkevm/_schema.yml @@ -0,0 +1,100 @@ +version: 2 + +models: + - name: balancer_v2_zkevm_token_balance_changes + meta: + blockchain: zkevm + project: balancer_v2 + contributors: viniabussafi + config: + tags: ['zkevm', 'bpt', 'supply', 'changes'] + description: > + Token Balance Changes on Balancer Pools. + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - block_date + - evt_tx_hash + - evt_index + - token_address + columns: + - &block_date + name: block_date + description: "UTC event block date of each DEX trade" + - &evt_block_time + name: evt_block_time + description: 'Block time of transfer event' + - &evt_block_number + name: evt_block_number + description: 'Block number of transfer event' + - &blockchain + name: blockchain + description: "Blockchain" + - &evt_tx_hash + name: evt_tx_hash + description: 'Transaction hash of transfer event' + - &evt_index + name: evt_index + description: 'Event index' + - &pool_id + name: pool_id + description: "Unique encoded identifier that refers to each pool" + - &pool_address + name: pool_address + description: "Pool address" + - &pool_symbol + name: pool_symbol + description: "Token symbols, followed by their respective weights, if applicable" + - &pool_type + name: pool_type + description: "Pool attributes, determined by the pool's factory" + - &version + name: version + description: "Version of Balancer where the liquidity pool used in transaction is deployed" + - &token_address + name: token_address + description: "Contract address of the token" + - &token_symbol + name: token_symbol + description: "Token symbol" + - &delta_amount_raw + name: delta_amount_raw + description: "Raw value of the transaction at the time of execution in the original currency" + - &delta_amount + name: delta_amount + description: "Normalized value of the transaction at the time of execution in the original currency" + + - name: balancer_v2_zkevm_token_balance_changes_daily + meta: + blockchain: zkevm + project: balancer_v2 + contributors: viniabussafi + config: + tags: ['zkevm', 'bpt', 'supply', 'changes'] + description: > + Token Balance Changes on Balancer Pools, grouped by day. + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - block_date + - pool_id + - token_address + columns: + - *block_date + - *pool_id + - *pool_address + - *pool_symbol + - *version + - *blockchain + - *pool_type + - *token_address + - *token_symbol + - &daily_delta + name: daily_delta + description: "Daily total impact on token balance" + - &daily_delta_usd + name: daily_delta_usd + description: "Daily total impact on token balance, in USD" + - &daily_delta_eth + name: daily_delta_eth + description: "Daily total impact on token balance, in eth" \ No newline at end of file diff --git a/models/_project/balancer/balances/zkevm/balancer_v2_zkevm_token_balance_changes.sql b/models/_project/balancer/balances/zkevm/balancer_v2_zkevm_token_balance_changes.sql new file mode 100644 index 00000000000..80eff1513b7 --- /dev/null +++ b/models/_project/balancer/balances/zkevm/balancer_v2_zkevm_token_balance_changes.sql @@ -0,0 +1,16 @@ +{% set blockchain = 'zkevm' %} + +{{ config( + schema = 'balancer_v2_zkevm', + alias = 'token_balance_changes', + materialized = 'table', + file_format = 'delta' + ) +}} + +{{ + balancer_token_balance_changes_macro( + blockchain = blockchain, + version = '2' + ) +}} \ No newline at end of file diff --git a/models/_project/balancer/balances/zkevm/balancer_v2_zkevm_token_balance_changes_daily.sql b/models/_project/balancer/balances/zkevm/balancer_v2_zkevm_token_balance_changes_daily.sql new file mode 100644 index 00000000000..9bd7cabbb72 --- /dev/null +++ b/models/_project/balancer/balances/zkevm/balancer_v2_zkevm_token_balance_changes_daily.sql @@ -0,0 +1,17 @@ +{% set blockchain = 'zkevm' %} + +{{ + config( + schema = 'balancer_v2_zkevm', + alias = 'token_balance_changes_daily', + materialized = 'table', + file_format = 'delta' + ) +}} + +{{ + balancer_token_balance_changes_daily_agg_macro( + blockchain = blockchain, + version = '2' + ) +}} \ No newline at end of file diff --git a/models/_project/balancer/bpt/_schema.yml b/models/_project/balancer/bpt/_schema.yml new file mode 100644 index 00000000000..4afa2327ca2 --- /dev/null +++ b/models/_project/balancer/bpt/_schema.yml @@ -0,0 +1,176 @@ +version: 2 + +models: + - name: balancer_transfers_bpt + meta: + blockchain: arbitrum, avalanche_c, base, ethereum, gnosis, optimism, polygon, zkevmn + contributors: victorstefenon, thetroyharris, viniabussafi + config: + tags: ['arbitrum', 'avalanche_c', 'base', 'ethereum', 'gnosis', 'optimism', 'polygon', 'zkevm', 'bpt', 'transfers'] + description: > + Balancer Pool Token (BPT) transfer logs on Balancer, an automated portfolio manager and trading platform. + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - evt_tx_hash + - evt_index + - block_date + columns: + - &blockchain + name: blockchain + description: "Blockchain" + - &version + name: version + description: "Version of Balancer where the liquidity pool used in transaction is deployed" + - &contract_address + name: contract_address + description: 'zkevm address for the liquidity pool used in transaction' + - &block_date + name: block_date + description: "UTC event block date of each DEX trade" + - &block_month + name: block_month + description: "UTC event block month of each DEX trade" + - &evt_tx_hash + name: evt_tx_hash + description: 'Transaction hash of transfer event' + - &evt_index + name: evt_index + description: 'Event index' + - &evt_block_time + name: evt_block_time + description: 'Block time of transfer event' + - &evt_block_number + name: evt_block_number + description: 'Block number of transfer event' + - &from + name: from + description: 'Address of BPT provider of transfer event' + - &to + name: to + description: 'Address of BPT receiver of transfer event' + - &value + name: value + description: 'Amount of BPT transferred in transfer event' + + - name: balancer_bpt_prices + meta: + blockchain: arbitrum, avalanche_c, base, ethereum, gnosis, optimism, polygon, zkevm + sector: dex + contributors: thetroyharris, victorstefenon, viniabussafi + config: + tags: ['balancer', 'amm', 'dex', 'bpt', 'prices', 'ethereum', 'arbitrum', 'optimism', 'polygon', 'gnosis', 'avalanche_c', 'base', 'zkevm'] + description: > + Balancer Pool Token (BPT) hourly median price by pool on Balancer, an automated portfolio manager and trading platform. + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - blockchain + - day + - contract_address + columns: + - *blockchain + - &day + name: day + description: "Block date in UTC" + - *version + - &decimals + name: decimals + description: "Token decimals. 18, by default, on BPTs" + - *contract_address + - &bpt_price + name: bpt_price + description: "Price of the BPT" + + + - name: balancer_bpt_supply + meta: + blockchain: arbitrum, avalanche_c, base, ethereum, gnosis, optimism, polygon, zkevm + contributors: thetroyharris, viniabussafi + config: + tags: ['arbitrum', 'avalanche_c', 'base', 'ethereum', 'gnosis', 'optimism', 'polygon', 'zkevm', 'bpt'] + description: > + The Balancer Pool Token (BPT) supply over time of ComposableStablePools versions 4+ + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - day + - blockchain + - token_address + columns: + - *day + - &pool_type + name: pool_type + description: "Pool attributes, determined by the pool's factory" + - *version + - *blockchain + - &token_address + name: token_address + description: "Contract address of the BPT" + - &supply + name: supply + description: "Supply of the BPT, discounted of premints" + + - name: balancer_bpt_supply_changes + meta: + blockchain: arbitrum, avalanche_c, base, ethereum, gnosis, optimism, polygon, zkevm + contributors: viniabussafi + config: + tags: ['arbitrum', 'avalanche_c', 'base', 'ethereum', 'gnosis', 'optimism', 'polygon', 'zkevm', 'bpt', 'supply', 'changes'] + description: > + Balancer Pool Token (BPT) supply change events. + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - block_date + - evt_tx_hash + - evt_index + - label + columns: + - *block_date + - *evt_block_time + - *evt_block_number + - *blockchain + - *evt_tx_hash + - *evt_index + - *pool_type + - &pool_symbol + name: pool_symbol + description: "Token symbols, followed by their respective weights, if applicable" + - *version + - &label + name: label + description: "Nature of the transaction (Join/Exit via swap or Mint/Burn via transfer)" + - *token_address + - &delta_amount_raw + name: delta_amount_raw + description: "Raw value of the transaction on token supply at the time of execution in the original currency" + - &delta_amount + name: delta_amount + description: "Normalized value of the transaction on token supply at the time of execution in the original currency" + + + - name: balancer_bpt_supply_changes_daily + meta: + blockchain: arbitrum, avalanche_c, base, ethereum, gnosis, optimism, polygon, zkevm + contributors: viniabussafi + config: + tags: ['arbitrum', 'avalanche_c', 'base', 'ethereum', 'gnosis', 'optimism', 'polygon', 'zkevm', 'bpt', 'supply', 'changes'] + description: > + Balancer Pool Token (BPT) supply change events. grouped by day + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - block_date + - blockchain + - token_address + columns: + - *block_date + - *blockchain + - *pool_type + - *pool_symbol + - *version + - *token_address + - &daily_delta + name: daily_delta + description: "Daily total impact on BPT supply" \ No newline at end of file diff --git a/models/_project/balancer/bpt/arbitrum/_schema.yml b/models/_project/balancer/bpt/arbitrum/_schema.yml new file mode 100644 index 00000000000..c32bee8b667 --- /dev/null +++ b/models/_project/balancer/bpt/arbitrum/_schema.yml @@ -0,0 +1,178 @@ +version: 2 + +models: + - name: balancer_v2_arbitrum_transfers_bpt + meta: + blockchain: arbitrum + project: balancer_v2 + contributors: victorstefenon, thetroyharris, viniabussafi + config: + tags: ['arbitrum', 'bpt', 'transfers'] + description: > + Balancer Pool Token (BPT) transfer logs on Balancer, an automated portfolio manager and trading platform, on Arbitrum. + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - evt_tx_hash + - evt_index + - block_date + columns: + - &blockchain + name: blockchain + description: "Blockchain" + - &version + name: version + description: "Version of Balancer where the liquidity pool used in transaction is deployed" + - &contract_address + name: contract_address + description: 'Arbitrum address for the liquidity pool used in transaction' + - &block_date + name: block_date + description: "UTC event block date of each DEX trade" + - &block_month + name: block_month + description: "UTC event block month of each DEX trade" + - &evt_tx_hash + name: evt_tx_hash + description: 'Transaction hash of transfer event' + - &evt_index + name: evt_index + description: 'Event index' + - &evt_block_time + name: evt_block_time + description: 'Block time of transfer event' + - &evt_block_number + name: evt_block_number + description: 'Block number of transfer event' + - &from + name: from + description: 'Address of BPT provider of transfer event' + - &to + name: to + description: 'Address of BPT receiver of transfer event' + - &value + name: value + description: 'Amount of BPT transferred in transfer event' + + - name: balancer_v2_arbitrum_bpt_prices + meta: + blockchain: arbitrum + project: balancer_v2 + contributors: victorstefenon, thetroyharris, viniabussafi + config: + tags: ['arbitrum', 'bpt', 'prices'] + description: > + Balancer Pool Token (BPT) daily price by pool on Balancer, an automated portfolio manager and trading platform. + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - blockchain + - day + - contract_address + columns: + - *blockchain + - &day + name: day + description: "Block date in UTC" + - *version + - &decimals + name: decimals + description: "Token decimals. 18, by default, on BPTs" + - *contract_address + - &bpt_price + name: bpt_price + description: "Price of the BPT" + + - name: balancer_v2_arbitrum_bpt_supply + meta: + blockchain: arbitrum + project: balancer_v2 + contributors: thetroyharris, viniabussafi + config: + tags: ['arbitrum', 'bpt', 'supply'] + description: > + Balancer Pool Token (BPT) supply by pool on Balancer, an automated portfolio manager and trading platform. + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - day + - blockchain + - token_address + columns: + - *day + - &pool_type + name: pool_type + description: "Pool attributes, determined by the pool's factory" + - *version + - *blockchain + - &token_address + name: token_address + description: "Contract address of the BPT" + - &supply + name: supply + description: "Supply of the BPT, discounted of premints" + + - name: balancer_v2_arbitrum_bpt_supply_changes + meta: + blockchain: arbitrum + project: balancer_v2 + contributors: viniabussafi + config: + tags: ['arbitrum', 'bpt', 'supply', 'changes'] + description: > + Balancer Pool Token (BPT) supply change events. + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - block_date + - evt_tx_hash + - evt_index + - label + columns: + - *block_date + - *evt_block_time + - *evt_block_number + - *blockchain + - *evt_tx_hash + - *evt_index + - *pool_type + - &pool_symbol + name: pool_symbol + description: "Token symbols, followed by their respective weights, if applicable" + - *version + - &label + name: label + description: "Nature of the transaction (Join/Exit via swap or Mint/Burn via transfer)" + - *token_address + - &delta_amount_raw + name: delta_amount_raw + description: "Raw value of the transaction on token supply at the time of execution in the original currency" + - &delta_amount + name: delta_amount + description: "Normalized value of the transaction on token supply at the time of execution in the original currency" + + - name: balancer_v2_arbitrum_bpt_supply_changes_daily + meta: + blockchain: arbitrum + project: balancer_v2 + contributors: viniabussafi + config: + tags: ['arbitrum', 'bpt', 'supply', 'changes'] + description: > + Balancer Pool Token (BPT) supply change events. grouped by day + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - block_date + - blockchain + - token_address + columns: + - *block_date + - *blockchain + - *pool_type + - *pool_symbol + - *version + - *token_address + - &daily_delta + name: daily_delta + description: "Daily total impact on BPT supply" \ No newline at end of file diff --git a/models/balancer/arbitrum/balancer_v2_arbitrum_bpt_prices.sql b/models/_project/balancer/bpt/arbitrum/balancer_v2_arbitrum_bpt_prices.sql similarity index 100% rename from models/balancer/arbitrum/balancer_v2_arbitrum_bpt_prices.sql rename to models/_project/balancer/bpt/arbitrum/balancer_v2_arbitrum_bpt_prices.sql diff --git a/models/balancer/arbitrum/balancer_v2_arbitrum_bpt_supply.sql b/models/_project/balancer/bpt/arbitrum/balancer_v2_arbitrum_bpt_supply.sql similarity index 100% rename from models/balancer/arbitrum/balancer_v2_arbitrum_bpt_supply.sql rename to models/_project/balancer/bpt/arbitrum/balancer_v2_arbitrum_bpt_supply.sql diff --git a/models/_project/balancer/bpt/arbitrum/balancer_v2_arbitrum_bpt_supply_changes.sql b/models/_project/balancer/bpt/arbitrum/balancer_v2_arbitrum_bpt_supply_changes.sql new file mode 100644 index 00000000000..b30224001c3 --- /dev/null +++ b/models/_project/balancer/bpt/arbitrum/balancer_v2_arbitrum_bpt_supply_changes.sql @@ -0,0 +1,20 @@ +{% set blockchain = 'arbitrum' %} + +{{ + config( + schema = 'balancer_v2_arbitrum', + alias = 'bpt_supply_changes', + materialized = 'incremental', + file_format = 'delta', + incremental_strategy = 'merge', + unique_key = ['block_date', 'evt_tx_hash', 'evt_index', 'label'], + incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.evt_block_time')] + ) +}} + +{{ + bpt_supply_changes_macro( + blockchain = blockchain, + version = '2' + ) +}} \ No newline at end of file diff --git a/models/_project/balancer/bpt/arbitrum/balancer_v2_arbitrum_bpt_supply_changes_daily.sql b/models/_project/balancer/bpt/arbitrum/balancer_v2_arbitrum_bpt_supply_changes_daily.sql new file mode 100644 index 00000000000..df606a75ceb --- /dev/null +++ b/models/_project/balancer/bpt/arbitrum/balancer_v2_arbitrum_bpt_supply_changes_daily.sql @@ -0,0 +1,17 @@ +{% set blockchain = 'ethereum' %} + +{{ + config( + schema = 'balancer_v2_ethereum', + alias = 'bpt_supply_changes_daily', + materialized = 'table', + file_format = 'delta' + ) +}} + +{{ + bpt_supply_changes_daily_agg_macro( + blockchain = blockchain, + version = '2' + ) +}} \ No newline at end of file diff --git a/models/balancer/arbitrum/balancer_v2_arbitrum_transfers_bpt.sql b/models/_project/balancer/bpt/arbitrum/balancer_v2_arbitrum_transfers_bpt.sql similarity index 100% rename from models/balancer/arbitrum/balancer_v2_arbitrum_transfers_bpt.sql rename to models/_project/balancer/bpt/arbitrum/balancer_v2_arbitrum_transfers_bpt.sql diff --git a/models/_project/balancer/bpt/avalanche_c/_schema.yml b/models/_project/balancer/bpt/avalanche_c/_schema.yml new file mode 100644 index 00000000000..8bde08a0ad8 --- /dev/null +++ b/models/_project/balancer/bpt/avalanche_c/_schema.yml @@ -0,0 +1,178 @@ +version: 2 + +models: + - name: balancer_v2_avalanche_c_transfers_bpt + meta: + blockchain: avalanche_c + project: balancer_v2 + contributors: victorstefenon, thetroyharris, viniabussafi + config: + tags: ['avalanche_c', 'bpt', 'transfers'] + description: > + Balancer Pool Token (BPT) transfer logs on Balancer, an automated portfolio manager and trading platform, on avalanche_c. + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - evt_tx_hash + - evt_index + - block_date + columns: + - &blockchain + name: blockchain + description: "Blockchain" + - &version + name: version + description: "Version of Balancer where the liquidity pool used in transaction is deployed" + - &contract_address + name: contract_address + description: 'avalanche_c address for the liquidity pool used in transaction' + - &block_date + name: block_date + description: "UTC event block date of each DEX trade" + - &block_month + name: block_month + description: "UTC event block month of each DEX trade" + - &evt_tx_hash + name: evt_tx_hash + description: 'Transaction hash of transfer event' + - &evt_index + name: evt_index + description: 'Event index' + - &evt_block_time + name: evt_block_time + description: 'Block time of transfer event' + - &evt_block_number + name: evt_block_number + description: 'Block number of transfer event' + - &from + name: from + description: 'Address of BPT provider of transfer event' + - &to + name: to + description: 'Address of BPT receiver of transfer event' + - &value + name: value + description: 'Amount of BPT transferred in transfer event' + + - name: balancer_v2_avalanche_c_bpt_prices + meta: + blockchain: avalanche_c + project: balancer_v2 + contributors: victorstefenon, thetroyharris, viniabussafi + config: + tags: ['avalanche_c', 'bpt', 'prices'] + description: > + Balancer Pool Token (BPT) daily price by pool on Balancer, an automated portfolio manager and trading platform. + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - blockchain + - day + - contract_address + columns: + - *blockchain + - &day + name: day + description: "Block date in UTC" + - *version + - &decimals + name: decimals + description: "Token decimals. 18, by default, on BPTs" + - *contract_address + - &bpt_price + name: bpt_price + description: "Price of the BPT" + + - name: balancer_v2_avalanche_c_bpt_supply + meta: + blockchain: avalanche_c + project: balancer_v2 + contributors: thetroyharris, viniabussafi + config: + tags: ['avalanche_c', 'bpt', 'supply'] + description: > + Balancer Pool Token (BPT) supply by pool on Balancer, an automated portfolio manager and trading platform. + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - day + - blockchain + - token_address + columns: + - *day + - &pool_type + name: pool_type + description: "Pool attributes, determined by the pool's factory" + - *version + - *blockchain + - &token_address + name: token_address + description: "Contract address of the BPT" + - &supply + name: supply + description: "Supply of the BPT, discounted of premints" + + - name: balancer_v2_avalanche_c_bpt_supply_changes + meta: + blockchain: avalanche_c + project: balancer_v2 + contributors: viniabussafi + config: + tags: ['avalanche_c', 'bpt', 'supply', 'changes'] + description: > + Balancer Pool Token (BPT) supply change events. + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - block_date + - evt_tx_hash + - evt_index + - label + columns: + - *block_date + - *evt_block_time + - *evt_block_number + - *blockchain + - *evt_tx_hash + - *evt_index + - *pool_type + - &pool_symbol + name: pool_symbol + description: "Token symbols, followed by their respective weights, if applicable" + - *version + - &label + name: label + description: "Nature of the transaction (Join/Exit via swap or Mint/Burn via transfer)" + - *token_address + - &delta_amount_raw + name: delta_amount_raw + description: "Raw value of the transaction on token supply at the time of execution in the original currency" + - &delta_amount + name: delta_amount + description: "Normalized value of the transaction on token supply at the time of execution in the original currency" + + - name: balancer_v2_avalanche_c_bpt_supply_changes_daily + meta: + blockchain: avalanche_c + project: balancer_v2 + contributors: viniabussafi + config: + tags: ['avalanche_c', 'bpt', 'supply', 'changes'] + description: > + Balancer Pool Token (BPT) supply change events. grouped by day + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - block_date + - blockchain + - token_address + columns: + - *block_date + - *blockchain + - *pool_type + - *pool_symbol + - *version + - *token_address + - &daily_delta + name: daily_delta + description: "Daily total impact on BPT supply" \ No newline at end of file diff --git a/models/balancer/avalanche_c/balancer_v2_avalanche_c_bpt_prices.sql b/models/_project/balancer/bpt/avalanche_c/balancer_v2_avalanche_c_bpt_prices.sql similarity index 100% rename from models/balancer/avalanche_c/balancer_v2_avalanche_c_bpt_prices.sql rename to models/_project/balancer/bpt/avalanche_c/balancer_v2_avalanche_c_bpt_prices.sql diff --git a/models/balancer/avalanche_c/balancer_v2_avalanche_c_bpt_supply.sql b/models/_project/balancer/bpt/avalanche_c/balancer_v2_avalanche_c_bpt_supply.sql similarity index 100% rename from models/balancer/avalanche_c/balancer_v2_avalanche_c_bpt_supply.sql rename to models/_project/balancer/bpt/avalanche_c/balancer_v2_avalanche_c_bpt_supply.sql diff --git a/models/_project/balancer/bpt/avalanche_c/balancer_v2_avalanche_c_bpt_supply_changes.sql b/models/_project/balancer/bpt/avalanche_c/balancer_v2_avalanche_c_bpt_supply_changes.sql new file mode 100644 index 00000000000..db1052cb8d8 --- /dev/null +++ b/models/_project/balancer/bpt/avalanche_c/balancer_v2_avalanche_c_bpt_supply_changes.sql @@ -0,0 +1,20 @@ +{% set blockchain = 'avalanche_c' %} + +{{ + config( + schema = 'balancer_v2_avalanche_c', + alias = 'bpt_supply_changes', + materialized = 'incremental', + file_format = 'delta', + incremental_strategy = 'merge', + unique_key = ['block_date', 'evt_tx_hash', 'evt_index', 'label'], + incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.evt_block_time')] + ) +}} + +{{ + bpt_supply_changes_macro( + blockchain = blockchain, + version = '2' + ) +}} \ No newline at end of file diff --git a/models/_project/balancer/bpt/avalanche_c/balancer_v2_avalanche_c_bpt_supply_changes_daily.sql b/models/_project/balancer/bpt/avalanche_c/balancer_v2_avalanche_c_bpt_supply_changes_daily.sql new file mode 100644 index 00000000000..5ce53b4aa92 --- /dev/null +++ b/models/_project/balancer/bpt/avalanche_c/balancer_v2_avalanche_c_bpt_supply_changes_daily.sql @@ -0,0 +1,17 @@ +{% set blockchain = 'avalanche_c' %} + +{{ + config( + schema = 'balancer_v2_avalanche_c', + alias = 'bpt_supply_changes_daily', + materialized = 'table', + file_format = 'delta' + ) +}} + +{{ + bpt_supply_changes_daily_agg_macro( + blockchain = blockchain, + version = '2' + ) +}} \ No newline at end of file diff --git a/models/balancer/avalanche_c/balancer_v2_avalanche_c_transfers_bpt.sql b/models/_project/balancer/bpt/avalanche_c/balancer_v2_avalanche_c_transfers_bpt.sql similarity index 100% rename from models/balancer/avalanche_c/balancer_v2_avalanche_c_transfers_bpt.sql rename to models/_project/balancer/bpt/avalanche_c/balancer_v2_avalanche_c_transfers_bpt.sql diff --git a/models/balancer/balancer_bpt_prices.sql b/models/_project/balancer/bpt/balancer_bpt_prices.sql similarity index 69% rename from models/balancer/balancer_bpt_prices.sql rename to models/_project/balancer/bpt/balancer_bpt_prices.sql index ad8502801b9..0a1180a8013 100644 --- a/models/balancer/balancer_bpt_prices.sql +++ b/models/_project/balancer/bpt/balancer_bpt_prices.sql @@ -1,10 +1,10 @@ {{ config( schema = 'balancer', alias = 'bpt_prices', - post_hook='{{ expose_spells(\'["ethereum", "arbitrum", "polygon", "gnosis", "optimism","avalanche_c", "base", "zkevm"]\', - "project", - "balancer", - \'["thetroyharris", "viniabussafi"]\') }}' + post_hook='{{ expose_spells(blockchains = \'["arbitrum", "avalanche_c", "base", "ethereum", "gnosis", "optimism", "polygon", "zkevm"]\', + spell_type = "project", + spell_name = "balancer", + contributors = \'["thetroyharris", "viniabussafi"]\') }}' ) }} diff --git a/models/balancer/balancer_bpt_supply.sql b/models/_project/balancer/bpt/balancer_bpt_supply.sql similarity index 68% rename from models/balancer/balancer_bpt_supply.sql rename to models/_project/balancer/bpt/balancer_bpt_supply.sql index a15ed33c911..e43ef846b55 100644 --- a/models/balancer/balancer_bpt_supply.sql +++ b/models/_project/balancer/bpt/balancer_bpt_supply.sql @@ -1,10 +1,10 @@ {{ config( schema = 'balancer', alias = 'bpt_supply', - post_hook = '{{ expose_spells(\'["arbitrum", "avalanche_c", "base", "ethereum", "gnosis", "optimism", "polygon", "zkevm"]\', - "project", - "balancer", - \'["thetroyharris", "viniabussafi"]\') }}' + post_hook = '{{ expose_spells(blockchains = \'["arbitrum", "avalanche_c", "base", "ethereum", "gnosis", "optimism", "polygon", "zkevm"]\', + spell_type = "project", + spell_name = "balancer", + contributors = \'["thetroyharris", "viniabussafi"]\') }}' ) }} diff --git a/models/_project/balancer/bpt/balancer_bpt_supply_changes.sql b/models/_project/balancer/bpt/balancer_bpt_supply_changes.sql new file mode 100644 index 00000000000..e46a587b3b0 --- /dev/null +++ b/models/_project/balancer/bpt/balancer_bpt_supply_changes.sql @@ -0,0 +1,44 @@ +{{ config( + schema = 'balancer', + alias = 'bpt_supply_changes', + post_hook='{{ expose_spells(blockchains = \'["arbitrum", "avalanche_c", "base", "ethereum", "gnosis", "optimism", "polygon", "zkevm"]\', + spell_type = "project", + spell_name = "balancer", + contributors = \'["viniabussafi"]\') }}' + ) +}} + +{% set balancer_models = [ + ref('balancer_v2_arbitrum_bpt_supply_changes'), + ref('balancer_v2_avalanche_c_bpt_supply_changes'), + ref('balancer_v2_base_bpt_supply_changes'), + ref('balancer_v2_ethereum_bpt_supply_changes'), + ref('balancer_v2_gnosis_bpt_supply_changes'), + ref('balancer_v2_optimism_bpt_supply_changes'), + ref('balancer_v2_polygon_bpt_supply_changes'), + ref('balancer_v2_zkevm_bpt_supply_changes') +] %} + +SELECT * +FROM ( + {% for model in balancer_models %} + SELECT + block_date + , evt_block_time + , evt_block_number + , blockchain + , evt_tx_hash + , evt_index + , pool_type + , pool_symbol + , version + , label + , token_address + , delta_amount_raw + , delta_amount + FROM {{ model }} + {% if not loop.last %} + UNION ALL + {% endif %} + {% endfor %} +) \ No newline at end of file diff --git a/models/_project/balancer/bpt/balancer_bpt_supply_changes_daily.sql b/models/_project/balancer/bpt/balancer_bpt_supply_changes_daily.sql new file mode 100644 index 00000000000..5b593cef48a --- /dev/null +++ b/models/_project/balancer/bpt/balancer_bpt_supply_changes_daily.sql @@ -0,0 +1,38 @@ +{{ config( + schema = 'balancer', + alias = 'bpt_supply_changes_daily', + post_hook='{{ expose_spells(blockchains = \'["arbitrum", "avalanche_c", "base", "ethereum", "gnosis", "optimism", "polygon", "zkevm"]\', + spell_type = "project", + spell_name = "balancer", + contributors = \'["viniabussafi"]\') }}' + ) +}} + +{% set balancer_models = [ + ref('balancer_v2_arbitrum_bpt_supply_changes_daily'), + ref('balancer_v2_avalanche_c_bpt_supply_changes_daily'), + ref('balancer_v2_base_bpt_supply_changes_daily'), + ref('balancer_v2_ethereum_bpt_supply_changes_daily'), + ref('balancer_v2_gnosis_bpt_supply_changes_daily'), + ref('balancer_v2_optimism_bpt_supply_changes_daily'), + ref('balancer_v2_polygon_bpt_supply_changes_daily'), + ref('balancer_v2_zkevm_bpt_supply_changes_daily') +] %} + +SELECT * +FROM ( + {% for model in balancer_models %} + SELECT + block_date + , blockchain + , pool_type + , pool_symbol + , version + , token_address + , daily_delta + FROM {{ model }} + {% if not loop.last %} + UNION ALL + {% endif %} + {% endfor %} +) \ No newline at end of file diff --git a/models/balancer/balancer_transfers_bpt.sql b/models/_project/balancer/bpt/balancer_transfers_bpt.sql similarity index 70% rename from models/balancer/balancer_transfers_bpt.sql rename to models/_project/balancer/bpt/balancer_transfers_bpt.sql index bd6fe9064c5..dda9c32ecb1 100644 --- a/models/balancer/balancer_transfers_bpt.sql +++ b/models/_project/balancer/bpt/balancer_transfers_bpt.sql @@ -1,10 +1,10 @@ {{ config( schema = 'balancer', alias = 'transfers_bpt', - post_hook='{{ expose_spells(\'["arbitrum", "avalanche_c", "base", "ethereum", "gnosis", "optimism", "polygon", "zkevm"]\', - "project", - "balancer", - \'["thetroyharris", "victorstefenon", "viniabussafi"]\') }}' + post_hook='{{ expose_spells(blockchains = \'["arbitrum", "avalanche_c", "base", "ethereum", "gnosis", "optimism", "polygon", "zkevm"]\', + spell_type = "project", + spell_name = "balancer", + contributors = \'["thetroyharris", "victorstefenon", "viniabussafi"]\') }}' ) }} diff --git a/models/_project/balancer/bpt/base/_schema.yml b/models/_project/balancer/bpt/base/_schema.yml new file mode 100644 index 00000000000..a32b805f7e2 --- /dev/null +++ b/models/_project/balancer/bpt/base/_schema.yml @@ -0,0 +1,178 @@ +version: 2 + +models: + - name: balancer_v2_base_transfers_bpt + meta: + blockchain: base + project: balancer_v2 + contributors: victorstefenon, thetroyharris, viniabussafi + config: + tags: ['base', 'bpt', 'transfers'] + description: > + Balancer Pool Token (BPT) transfer logs on Balancer, an automated portfolio manager and trading platform, on base. + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - evt_tx_hash + - evt_index + - block_date + columns: + - &blockchain + name: blockchain + description: "Blockchain" + - &version + name: version + description: "Version of Balancer where the liquidity pool used in transaction is deployed" + - &contract_address + name: contract_address + description: 'base address for the liquidity pool used in transaction' + - &block_date + name: block_date + description: "UTC event block date of each DEX trade" + - &block_month + name: block_month + description: "UTC event block month of each DEX trade" + - &evt_tx_hash + name: evt_tx_hash + description: 'Transaction hash of transfer event' + - &evt_index + name: evt_index + description: 'Event index' + - &evt_block_time + name: evt_block_time + description: 'Block time of transfer event' + - &evt_block_number + name: evt_block_number + description: 'Block number of transfer event' + - &from + name: from + description: 'Address of BPT provider of transfer event' + - &to + name: to + description: 'Address of BPT receiver of transfer event' + - &value + name: value + description: 'Amount of BPT transferred in transfer event' + + - name: balancer_v2_base_bpt_prices + meta: + blockchain: base + project: balancer_v2 + contributors: victorstefenon, thetroyharris, viniabussafi + config: + tags: ['base', 'bpt', 'prices'] + description: > + Balancer Pool Token (BPT) daily price by pool on Balancer, an automated portfolio manager and trading platform. + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - blockchain + - day + - contract_address + columns: + - *blockchain + - &day + name: day + description: "Block date in UTC" + - *version + - &decimals + name: decimals + description: "Token decimals. 18, by default, on BPTs" + - *contract_address + - &bpt_price + name: bpt_price + description: "Price of the BPT" + + - name: balancer_v2_base_bpt_supply + meta: + blockchain: base + project: balancer_v2 + contributors: thetroyharris, viniabussafi + config: + tags: ['base', 'bpt', 'supply'] + description: > + Balancer Pool Token (BPT) supply by pool on Balancer, an automated portfolio manager and trading platform. + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - day + - blockchain + - token_address + columns: + - *day + - &pool_type + name: pool_type + description: "Pool attributes, determined by the pool's factory" + - *version + - *blockchain + - &token_address + name: token_address + description: "Contract address of the BPT" + - &supply + name: supply + description: "Supply of the BPT, discounted of premints" + + - name: balancer_v2_base_bpt_supply_changes + meta: + blockchain: base + project: balancer_v2 + contributors: viniabussafi + config: + tags: ['base', 'bpt', 'supply', 'changes'] + description: > + Balancer Pool Token (BPT) supply change events. + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - block_date + - evt_tx_hash + - evt_index + - label + columns: + - *block_date + - *evt_block_time + - *evt_block_number + - *blockchain + - *evt_tx_hash + - *evt_index + - *pool_type + - &pool_symbol + name: pool_symbol + description: "Token symbols, followed by their respective weights, if applicable" + - *version + - &label + name: label + description: "Nature of the transaction (Join/Exit via swap or Mint/Burn via transfer)" + - *token_address + - &delta_amount_raw + name: delta_amount_raw + description: "Raw value of the transaction on token supply at the time of execution in the original currency" + - &delta_amount + name: delta_amount + description: "Normalized value of the transaction on token supply at the time of execution in the original currency" + + - name: balancer_v2_base_bpt_supply_changes_daily + meta: + blockchain: base + project: balancer_v2 + contributors: viniabussafi + config: + tags: ['base', 'bpt', 'supply', 'changes'] + description: > + Balancer Pool Token (BPT) supply change events. grouped by day + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - block_date + - blockchain + - token_address + columns: + - *block_date + - *blockchain + - *pool_type + - *pool_symbol + - *version + - *token_address + - &daily_delta + name: daily_delta + description: "Daily total impact on BPT supply" \ No newline at end of file diff --git a/models/balancer/base/balancer_v2_base_bpt_prices.sql b/models/_project/balancer/bpt/base/balancer_v2_base_bpt_prices.sql similarity index 100% rename from models/balancer/base/balancer_v2_base_bpt_prices.sql rename to models/_project/balancer/bpt/base/balancer_v2_base_bpt_prices.sql diff --git a/models/balancer/base/balancer_v2_base_bpt_supply.sql b/models/_project/balancer/bpt/base/balancer_v2_base_bpt_supply.sql similarity index 100% rename from models/balancer/base/balancer_v2_base_bpt_supply.sql rename to models/_project/balancer/bpt/base/balancer_v2_base_bpt_supply.sql diff --git a/models/_project/balancer/bpt/base/balancer_v2_base_bpt_supply_changes.sql b/models/_project/balancer/bpt/base/balancer_v2_base_bpt_supply_changes.sql new file mode 100644 index 00000000000..1d273f4e49e --- /dev/null +++ b/models/_project/balancer/bpt/base/balancer_v2_base_bpt_supply_changes.sql @@ -0,0 +1,20 @@ +{% set blockchain = 'base' %} + +{{ + config( + schema = 'balancer_v2_base', + alias = 'bpt_supply_changes', + materialized = 'incremental', + file_format = 'delta', + incremental_strategy = 'merge', + unique_key = ['block_date', 'evt_tx_hash', 'evt_index', 'label'], + incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.evt_block_time')] + ) +}} + +{{ + bpt_supply_changes_macro( + blockchain = blockchain, + version = '2' + ) +}} \ No newline at end of file diff --git a/models/_project/balancer/bpt/base/balancer_v2_base_bpt_supply_changes_daily.sql b/models/_project/balancer/bpt/base/balancer_v2_base_bpt_supply_changes_daily.sql new file mode 100644 index 00000000000..b90fdf94033 --- /dev/null +++ b/models/_project/balancer/bpt/base/balancer_v2_base_bpt_supply_changes_daily.sql @@ -0,0 +1,17 @@ +{% set blockchain = 'base' %} + +{{ + config( + schema = 'balancer_v2_base', + alias = 'bpt_supply_changes_daily', + materialized = 'table', + file_format = 'delta' + ) +}} + +{{ + bpt_supply_changes_daily_agg_macro( + blockchain = blockchain, + version = '2' + ) +}} \ No newline at end of file diff --git a/models/balancer/base/balancer_v2_base_transfers_bpt.sql b/models/_project/balancer/bpt/base/balancer_v2_base_transfers_bpt.sql similarity index 100% rename from models/balancer/base/balancer_v2_base_transfers_bpt.sql rename to models/_project/balancer/bpt/base/balancer_v2_base_transfers_bpt.sql diff --git a/models/_project/balancer/bpt/ethereum/_schema.yml b/models/_project/balancer/bpt/ethereum/_schema.yml new file mode 100644 index 00000000000..aa54846a5f3 --- /dev/null +++ b/models/_project/balancer/bpt/ethereum/_schema.yml @@ -0,0 +1,178 @@ +version: 2 + +models: + - name: balancer_v2_ethereum_transfers_bpt + meta: + blockchain: ethereum + project: balancer_v2 + contributors: victorstefenon, thetroyharris, viniabussafi + config: + tags: ['ethereum', 'bpt', 'transfers'] + description: > + Balancer Pool Token (BPT) transfer logs on Balancer, an automated portfolio manager and trading platform, on ethereum. + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - evt_tx_hash + - evt_index + - block_date + columns: + - &blockchain + name: blockchain + description: "Blockchain" + - &version + name: version + description: "Version of Balancer where the liquidity pool used in transaction is deployed" + - &contract_address + name: contract_address + description: 'ethereum address for the liquidity pool used in transaction' + - &block_date + name: block_date + description: "UTC event block date of each DEX trade" + - &block_month + name: block_month + description: "UTC event block month of each DEX trade" + - &evt_tx_hash + name: evt_tx_hash + description: 'Transaction hash of transfer event' + - &evt_index + name: evt_index + description: 'Event index' + - &evt_block_time + name: evt_block_time + description: 'Block time of transfer event' + - &evt_block_number + name: evt_block_number + description: 'Block number of transfer event' + - &from + name: from + description: 'Address of BPT provider of transfer event' + - &to + name: to + description: 'Address of BPT receiver of transfer event' + - &value + name: value + description: 'Amount of BPT transferred in transfer event' + + - name: balancer_v2_ethereum_bpt_prices + meta: + blockchain: ethereum + project: balancer_v2 + contributors: victorstefenon, thetroyharris, viniabussafi + config: + tags: ['ethereum', 'bpt', 'prices'] + description: > + Balancer Pool Token (BPT) daily price by pool on Balancer, an automated portfolio manager and trading platform. + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - blockchain + - day + - contract_address + columns: + - *blockchain + - &day + name: day + description: "Block date in UTC" + - *version + - &decimals + name: decimals + description: "Token decimals. 18, by default, on BPTs" + - *contract_address + - &bpt_price + name: bpt_price + description: "Price of the BPT" + + - name: balancer_v2_ethereum_bpt_supply + meta: + blockchain: ethereum + project: balancer_v2 + contributors: thetroyharris, viniabussafi + config: + tags: ['ethereum', 'bpt', 'supply'] + description: > + Balancer Pool Token (BPT) supply by pool on Balancer, an automated portfolio manager and trading platform. + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - day + - blockchain + - token_address + columns: + - *day + - &pool_type + name: pool_type + description: "Pool attributes, determined by the pool's factory" + - *version + - *blockchain + - &token_address + name: token_address + description: "Contract address of the BPT" + - &supply + name: supply + description: "Supply of the BPT, discounted of premints" + + - name: balancer_v2_ethereum_bpt_supply_changes + meta: + blockchain: ethereum + project: balancer_v2 + contributors: viniabussafi + config: + tags: ['ethereum', 'bpt', 'supply', 'changes'] + description: > + Balancer Pool Token (BPT) supply change events. + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - block_date + - evt_tx_hash + - evt_index + - label + columns: + - *block_date + - *evt_block_time + - *evt_block_number + - *blockchain + - *evt_tx_hash + - *evt_index + - *pool_type + - &pool_symbol + name: pool_symbol + description: "Token symbols, followed by their respective weights, if applicable" + - *version + - &label + name: label + description: "Nature of the transaction (Join/Exit via swap or Mint/Burn via transfer)" + - *token_address + - &delta_amount_raw + name: delta_amount_raw + description: "Raw value of the transaction on token supply at the time of execution in the original currency" + - &delta_amount + name: delta_amount + description: "Normalized value of the transaction on token supply at the time of execution in the original currency" + + - name: balancer_v2_ethereum_bpt_supply_changes_daily + meta: + blockchain: ethereum + project: balancer_v2 + contributors: viniabussafi + config: + tags: ['ethereum', 'bpt', 'supply', 'changes'] + description: > + Balancer Pool Token (BPT) supply change events. grouped by day + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - block_date + - blockchain + - token_address + columns: + - *block_date + - *blockchain + - *pool_type + - *pool_symbol + - *version + - *token_address + - &daily_delta + name: daily_delta + description: "Daily total impact on BPT supply" \ No newline at end of file diff --git a/models/balancer/ethereum/balancer_v2_ethereum_bpt_prices.sql b/models/_project/balancer/bpt/ethereum/balancer_v2_ethereum_bpt_prices.sql similarity index 100% rename from models/balancer/ethereum/balancer_v2_ethereum_bpt_prices.sql rename to models/_project/balancer/bpt/ethereum/balancer_v2_ethereum_bpt_prices.sql diff --git a/models/balancer/ethereum/balancer_v2_ethereum_bpt_supply.sql b/models/_project/balancer/bpt/ethereum/balancer_v2_ethereum_bpt_supply.sql similarity index 100% rename from models/balancer/ethereum/balancer_v2_ethereum_bpt_supply.sql rename to models/_project/balancer/bpt/ethereum/balancer_v2_ethereum_bpt_supply.sql diff --git a/models/_project/balancer/bpt/ethereum/balancer_v2_ethereum_bpt_supply_changes.sql b/models/_project/balancer/bpt/ethereum/balancer_v2_ethereum_bpt_supply_changes.sql new file mode 100644 index 00000000000..1fa7db6b904 --- /dev/null +++ b/models/_project/balancer/bpt/ethereum/balancer_v2_ethereum_bpt_supply_changes.sql @@ -0,0 +1,20 @@ +{% set blockchain = 'ethereum' %} + +{{ + config( + schema = 'balancer_v2_ethereum', + alias = 'bpt_supply_changes', + materialized = 'incremental', + file_format = 'delta', + incremental_strategy = 'merge', + unique_key = ['block_date', 'evt_tx_hash', 'evt_index', 'label'], + incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.evt_block_time')] + ) +}} + +{{ + bpt_supply_changes_macro( + blockchain = blockchain, + version = '2' + ) +}} \ No newline at end of file diff --git a/models/_project/balancer/bpt/ethereum/balancer_v2_ethereum_bpt_supply_changes_daily.sql b/models/_project/balancer/bpt/ethereum/balancer_v2_ethereum_bpt_supply_changes_daily.sql new file mode 100644 index 00000000000..74d3be91fdf --- /dev/null +++ b/models/_project/balancer/bpt/ethereum/balancer_v2_ethereum_bpt_supply_changes_daily.sql @@ -0,0 +1,17 @@ +{% set blockchain = 'arbitrum' %} + +{{ + config( + schema = 'balancer_v2_arbitrum', + alias = 'bpt_supply_changes_daily', + materialized = 'table', + file_format = 'delta' + ) +}} + +{{ + bpt_supply_changes_daily_agg_macro( + blockchain = blockchain, + version = '2' + ) +}} \ No newline at end of file diff --git a/models/balancer/ethereum/balancer_v2_ethereum_transfers_bpt.sql b/models/_project/balancer/bpt/ethereum/balancer_v2_ethereum_transfers_bpt.sql similarity index 100% rename from models/balancer/ethereum/balancer_v2_ethereum_transfers_bpt.sql rename to models/_project/balancer/bpt/ethereum/balancer_v2_ethereum_transfers_bpt.sql diff --git a/models/_project/balancer/bpt/gnosis/_schema.yml b/models/_project/balancer/bpt/gnosis/_schema.yml new file mode 100644 index 00000000000..aae23d80a8a --- /dev/null +++ b/models/_project/balancer/bpt/gnosis/_schema.yml @@ -0,0 +1,178 @@ +version: 2 + +models: + - name: balancer_v2_gnosis_transfers_bpt + meta: + blockchain: gnosis + project: balancer_v2 + contributors: victorstefenon, thetroyharris, viniabussafi + config: + tags: ['gnosis', 'bpt', 'transfers'] + description: > + Balancer Pool Token (BPT) transfer logs on Balancer, an automated portfolio manager and trading platform, on gnosis. + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - evt_tx_hash + - evt_index + - block_date + columns: + - &blockchain + name: blockchain + description: "Blockchain" + - &version + name: version + description: "Version of Balancer where the liquidity pool used in transaction is deployed" + - &contract_address + name: contract_address + description: 'gnosis address for the liquidity pool used in transaction' + - &block_date + name: block_date + description: "UTC event block date of each DEX trade" + - &block_month + name: block_month + description: "UTC event block month of each DEX trade" + - &evt_tx_hash + name: evt_tx_hash + description: 'Transaction hash of transfer event' + - &evt_index + name: evt_index + description: 'Event index' + - &evt_block_time + name: evt_block_time + description: 'Block time of transfer event' + - &evt_block_number + name: evt_block_number + description: 'Block number of transfer event' + - &from + name: from + description: 'Address of BPT provider of transfer event' + - &to + name: to + description: 'Address of BPT receiver of transfer event' + - &value + name: value + description: 'Amount of BPT transferred in transfer event' + + - name: balancer_v2_gnosis_bpt_prices + meta: + blockchain: gnosis + project: balancer_v2 + contributors: victorstefenon, thetroyharris, viniabussafi + config: + tags: ['gnosis', 'bpt', 'prices'] + description: > + Balancer Pool Token (BPT) daily price by pool on Balancer, an automated portfolio manager and trading platform. + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - blockchain + - day + - contract_address + columns: + - *blockchain + - &day + name: day + description: "Block date in UTC" + - *version + - &decimals + name: decimals + description: "Token decimals. 18, by default, on BPTs" + - *contract_address + - &bpt_price + name: bpt_price + description: "Price of the BPT" + + - name: balancer_v2_gnosis_bpt_supply + meta: + blockchain: gnosis + project: balancer_v2 + contributors: thetroyharris, viniabussafi + config: + tags: ['gnosis', 'bpt', 'supply'] + description: > + Balancer Pool Token (BPT) supply by pool on Balancer, an automated portfolio manager and trading platform. + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - day + - blockchain + - token_address + columns: + - *day + - &pool_type + name: pool_type + description: "Pool attributes, determined by the pool's factory" + - *version + - *blockchain + - &token_address + name: token_address + description: "Contract address of the BPT" + - &supply + name: supply + description: "Supply of the BPT, discounted of premints" + + - name: balancer_v2_gnosis_bpt_supply_changes + meta: + blockchain: gnosis + project: balancer_v2 + contributors: viniabussafi + config: + tags: ['gnosis', 'bpt', 'supply', 'changes'] + description: > + Balancer Pool Token (BPT) supply change events. + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - block_date + - evt_tx_hash + - evt_index + - label + columns: + - *block_date + - *evt_block_time + - *evt_block_number + - *blockchain + - *evt_tx_hash + - *evt_index + - *pool_type + - &pool_symbol + name: pool_symbol + description: "Token symbols, followed by their respective weights, if applicable" + - *version + - &label + name: label + description: "Nature of the transaction (Join/Exit via swap or Mint/Burn via transfer)" + - *token_address + - &delta_amount_raw + name: delta_amount_raw + description: "Raw value of the transaction on token supply at the time of execution in the original currency" + - &delta_amount + name: delta_amount + description: "Normalized value of the transaction on token supply at the time of execution in the original currency" + + - name: balancer_v2_gnosis_bpt_supply_changes_daily + meta: + blockchain: gnosis + project: balancer_v2 + contributors: viniabussafi + config: + tags: ['gnosis', 'bpt', 'supply', 'changes'] + description: > + Balancer Pool Token (BPT) supply change events. grouped by day + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - block_date + - blockchain + - token_address + columns: + - *block_date + - *blockchain + - *pool_type + - *pool_symbol + - *version + - *token_address + - &daily_delta + name: daily_delta + description: "Daily total impact on BPT supply" \ No newline at end of file diff --git a/models/balancer/gnosis/balancer_v2_gnosis_bpt_prices.sql b/models/_project/balancer/bpt/gnosis/balancer_v2_gnosis_bpt_prices.sql similarity index 100% rename from models/balancer/gnosis/balancer_v2_gnosis_bpt_prices.sql rename to models/_project/balancer/bpt/gnosis/balancer_v2_gnosis_bpt_prices.sql diff --git a/models/balancer/gnosis/balancer_v2_gnosis_bpt_supply.sql b/models/_project/balancer/bpt/gnosis/balancer_v2_gnosis_bpt_supply.sql similarity index 100% rename from models/balancer/gnosis/balancer_v2_gnosis_bpt_supply.sql rename to models/_project/balancer/bpt/gnosis/balancer_v2_gnosis_bpt_supply.sql diff --git a/models/_project/balancer/bpt/gnosis/balancer_v2_gnosis_bpt_supply_changes.sql b/models/_project/balancer/bpt/gnosis/balancer_v2_gnosis_bpt_supply_changes.sql new file mode 100644 index 00000000000..fd1539a9495 --- /dev/null +++ b/models/_project/balancer/bpt/gnosis/balancer_v2_gnosis_bpt_supply_changes.sql @@ -0,0 +1,20 @@ +{% set blockchain = 'gnosis' %} + +{{ + config( + schema = 'balancer_v2_gnosis', + alias = 'bpt_supply_changes', + materialized = 'incremental', + file_format = 'delta', + incremental_strategy = 'merge', + unique_key = ['block_date', 'evt_tx_hash', 'evt_index', 'label'], + incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.evt_block_time')] + ) +}} + +{{ + bpt_supply_changes_macro( + blockchain = blockchain, + version = '2' + ) +}} \ No newline at end of file diff --git a/models/_project/balancer/bpt/gnosis/balancer_v2_gnosis_bpt_supply_changes_daily.sql b/models/_project/balancer/bpt/gnosis/balancer_v2_gnosis_bpt_supply_changes_daily.sql new file mode 100644 index 00000000000..516f2e2dc0c --- /dev/null +++ b/models/_project/balancer/bpt/gnosis/balancer_v2_gnosis_bpt_supply_changes_daily.sql @@ -0,0 +1,17 @@ +{% set blockchain = 'gnosis' %} + +{{ + config( + schema = 'balancer_v2_gnosis', + alias = 'bpt_supply_changes_daily', + materialized = 'table', + file_format = 'delta' + ) +}} + +{{ + bpt_supply_changes_daily_agg_macro( + blockchain = blockchain, + version = '2' + ) +}} \ No newline at end of file diff --git a/models/balancer/gnosis/balancer_v2_gnosis_transfers_bpt.sql b/models/_project/balancer/bpt/gnosis/balancer_v2_gnosis_transfers_bpt.sql similarity index 100% rename from models/balancer/gnosis/balancer_v2_gnosis_transfers_bpt.sql rename to models/_project/balancer/bpt/gnosis/balancer_v2_gnosis_transfers_bpt.sql diff --git a/models/_project/balancer/bpt/optimism/_schema.yml b/models/_project/balancer/bpt/optimism/_schema.yml new file mode 100644 index 00000000000..746fd32e9da --- /dev/null +++ b/models/_project/balancer/bpt/optimism/_schema.yml @@ -0,0 +1,178 @@ +version: 2 + +models: + - name: balancer_v2_optimism_transfers_bpt + meta: + blockchain: optimism + project: balancer_v2 + contributors: victorstefenon, thetroyharris, viniabussafi + config: + tags: ['optimism', 'bpt', 'transfers'] + description: > + Balancer Pool Token (BPT) transfer logs on Balancer, an automated portfolio manager and trading platform, on optimism. + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - evt_tx_hash + - evt_index + - block_date + columns: + - &blockchain + name: blockchain + description: "Blockchain" + - &version + name: version + description: "Version of Balancer where the liquidity pool used in transaction is deployed" + - &contract_address + name: contract_address + description: 'optimism address for the liquidity pool used in transaction' + - &block_date + name: block_date + description: "UTC event block date of each DEX trade" + - &block_month + name: block_month + description: "UTC event block month of each DEX trade" + - &evt_tx_hash + name: evt_tx_hash + description: 'Transaction hash of transfer event' + - &evt_index + name: evt_index + description: 'Event index' + - &evt_block_time + name: evt_block_time + description: 'Block time of transfer event' + - &evt_block_number + name: evt_block_number + description: 'Block number of transfer event' + - &from + name: from + description: 'Address of BPT provider of transfer event' + - &to + name: to + description: 'Address of BPT receiver of transfer event' + - &value + name: value + description: 'Amount of BPT transferred in transfer event' + + - name: balancer_v2_optimism_bpt_prices + meta: + blockchain: optimism + project: balancer_v2 + contributors: victorstefenon, thetroyharris, viniabussafi + config: + tags: ['optimism', 'bpt', 'prices'] + description: > + Balancer Pool Token (BPT) daily price by pool on Balancer, an automated portfolio manager and trading platform. + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - blockchain + - day + - contract_address + columns: + - *blockchain + - &day + name: day + description: "Block date in UTC" + - *version + - &decimals + name: decimals + description: "Token decimals. 18, by default, on BPTs" + - *contract_address + - &bpt_price + name: bpt_price + description: "Price of the BPT" + + - name: balancer_v2_optimism_bpt_supply + meta: + blockchain: optimism + project: balancer_v2 + contributors: thetroyharris, viniabussafi + config: + tags: ['optimism', 'bpt', 'supply'] + description: > + Balancer Pool Token (BPT) supply by pool on Balancer, an automated portfolio manager and trading platform. + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - day + - blockchain + - token_address + columns: + - *day + - &pool_type + name: pool_type + description: "Pool attributes, determined by the pool's factory" + - *version + - *blockchain + - &token_address + name: token_address + description: "Contract address of the BPT" + - &supply + name: supply + description: "Supply of the BPT, discounted of premints" + + - name: balancer_v2_optimism_bpt_supply_changes + meta: + blockchain: optimism + project: balancer_v2 + contributors: viniabussafi + config: + tags: ['optimism', 'bpt', 'supply', 'changes'] + description: > + Balancer Pool Token (BPT) supply change events. + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - block_date + - evt_tx_hash + - evt_index + - label + columns: + - *block_date + - *evt_block_time + - *evt_block_number + - *blockchain + - *evt_tx_hash + - *evt_index + - *pool_type + - &pool_symbol + name: pool_symbol + description: "Token symbols, followed by their respective weights, if applicable" + - *version + - &label + name: label + description: "Nature of the transaction (Join/Exit via swap or Mint/Burn via transfer)" + - *token_address + - &delta_amount_raw + name: delta_amount_raw + description: "Raw value of the transaction on token supply at the time of execution in the original currency" + - &delta_amount + name: delta_amount + description: "Normalized value of the transaction on token supply at the time of execution in the original currency" + + - name: balancer_v2_optimism_bpt_supply_changes_daily + meta: + blockchain: optimism + project: balancer_v2 + contributors: viniabussafi + config: + tags: ['optimism', 'bpt', 'supply', 'changes'] + description: > + Balancer Pool Token (BPT) supply change events. grouped by day + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - block_date + - blockchain + - token_address + columns: + - *block_date + - *blockchain + - *pool_type + - *pool_symbol + - *version + - *token_address + - &daily_delta + name: daily_delta + description: "Daily total impact on BPT supply" \ No newline at end of file diff --git a/models/balancer/optimism/balancer_v2_optimism_bpt_prices.sql b/models/_project/balancer/bpt/optimism/balancer_v2_optimism_bpt_prices.sql similarity index 100% rename from models/balancer/optimism/balancer_v2_optimism_bpt_prices.sql rename to models/_project/balancer/bpt/optimism/balancer_v2_optimism_bpt_prices.sql diff --git a/models/balancer/optimism/balancer_v2_optimism_bpt_supply.sql b/models/_project/balancer/bpt/optimism/balancer_v2_optimism_bpt_supply.sql similarity index 100% rename from models/balancer/optimism/balancer_v2_optimism_bpt_supply.sql rename to models/_project/balancer/bpt/optimism/balancer_v2_optimism_bpt_supply.sql diff --git a/models/_project/balancer/bpt/optimism/balancer_v2_optimism_bpt_supply_changes.sql b/models/_project/balancer/bpt/optimism/balancer_v2_optimism_bpt_supply_changes.sql new file mode 100644 index 00000000000..225b00465db --- /dev/null +++ b/models/_project/balancer/bpt/optimism/balancer_v2_optimism_bpt_supply_changes.sql @@ -0,0 +1,20 @@ +{% set blockchain = 'optimism' %} + +{{ + config( + schema = 'balancer_v2_optimism', + alias = 'bpt_supply_changes', + materialized = 'incremental', + file_format = 'delta', + incremental_strategy = 'merge', + unique_key = ['block_date', 'evt_tx_hash', 'evt_index', 'label'], + incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.evt_block_time')] + ) +}} + +{{ + bpt_supply_changes_macro( + blockchain = blockchain, + version = '2' + ) +}} \ No newline at end of file diff --git a/models/_project/balancer/bpt/optimism/balancer_v2_optimism_bpt_supply_changes_daily.sql b/models/_project/balancer/bpt/optimism/balancer_v2_optimism_bpt_supply_changes_daily.sql new file mode 100644 index 00000000000..f816df8d206 --- /dev/null +++ b/models/_project/balancer/bpt/optimism/balancer_v2_optimism_bpt_supply_changes_daily.sql @@ -0,0 +1,17 @@ +{% set blockchain = 'optimism' %} + +{{ + config( + schema = 'balancer_v2_optimism', + alias = 'bpt_supply_changes_daily', + materialized = 'table', + file_format = 'delta' + ) +}} + +{{ + bpt_supply_changes_daily_agg_macro( + blockchain = blockchain, + version = '2' + ) +}} \ No newline at end of file diff --git a/models/balancer/optimism/balancer_v2_optimism_transfers_bpt.sql b/models/_project/balancer/bpt/optimism/balancer_v2_optimism_transfers_bpt.sql similarity index 100% rename from models/balancer/optimism/balancer_v2_optimism_transfers_bpt.sql rename to models/_project/balancer/bpt/optimism/balancer_v2_optimism_transfers_bpt.sql diff --git a/models/_project/balancer/bpt/polygon/_schema.yml b/models/_project/balancer/bpt/polygon/_schema.yml new file mode 100644 index 00000000000..3e0b5c419f6 --- /dev/null +++ b/models/_project/balancer/bpt/polygon/_schema.yml @@ -0,0 +1,178 @@ +version: 2 + +models: + - name: balancer_v2_polygon_transfers_bpt + meta: + blockchain: polygon + project: balancer_v2 + contributors: victorstefenon, thetroyharris, viniabussafi + config: + tags: ['polygon', 'bpt', 'transfers'] + description: > + Balancer Pool Token (BPT) transfer logs on Balancer, an automated portfolio manager and trading platform, on polygon. + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - evt_tx_hash + - evt_index + - block_date + columns: + - &blockchain + name: blockchain + description: "Blockchain" + - &version + name: version + description: "Version of Balancer where the liquidity pool used in transaction is deployed" + - &contract_address + name: contract_address + description: 'polygon address for the liquidity pool used in transaction' + - &block_date + name: block_date + description: "UTC event block date of each DEX trade" + - &block_month + name: block_month + description: "UTC event block month of each DEX trade" + - &evt_tx_hash + name: evt_tx_hash + description: 'Transaction hash of transfer event' + - &evt_index + name: evt_index + description: 'Event index' + - &evt_block_time + name: evt_block_time + description: 'Block time of transfer event' + - &evt_block_number + name: evt_block_number + description: 'Block number of transfer event' + - &from + name: from + description: 'Address of BPT provider of transfer event' + - &to + name: to + description: 'Address of BPT receiver of transfer event' + - &value + name: value + description: 'Amount of BPT transferred in transfer event' + + - name: balancer_v2_polygon_bpt_prices + meta: + blockchain: polygon + project: balancer_v2 + contributors: victorstefenon, thetroyharris, viniabussafi + config: + tags: ['polygon', 'bpt', 'prices'] + description: > + Balancer Pool Token (BPT) daily price by pool on Balancer, an automated portfolio manager and trading platform. + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - blockchain + - day + - contract_address + columns: + - *blockchain + - &day + name: day + description: "Block date in UTC" + - *version + - &decimals + name: decimals + description: "Token decimals. 18, by default, on BPTs" + - *contract_address + - &bpt_price + name: bpt_price + description: "Price of the BPT" + + - name: balancer_v2_polygon_bpt_supply + meta: + blockchain: polygon + project: balancer_v2 + contributors: thetroyharris, viniabussafi + config: + tags: ['polygon', 'bpt', 'supply'] + description: > + Balancer Pool Token (BPT) supply by pool on Balancer, an automated portfolio manager and trading platform. + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - day + - blockchain + - token_address + columns: + - *day + - &pool_type + name: pool_type + description: "Pool attributes, determined by the pool's factory" + - *version + - *blockchain + - &token_address + name: token_address + description: "Contract address of the BPT" + - &supply + name: supply + description: "Supply of the BPT, discounted of premints" + + - name: balancer_v2_polygon_bpt_supply_changes + meta: + blockchain: polygon + project: balancer_v2 + contributors: viniabussafi + config: + tags: ['polygon', 'bpt', 'supply', 'changes'] + description: > + Balancer Pool Token (BPT) supply change events. + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - block_date + - evt_tx_hash + - evt_index + - label + columns: + - *block_date + - *evt_block_time + - *evt_block_number + - *blockchain + - *evt_tx_hash + - *evt_index + - *pool_type + - &pool_symbol + name: pool_symbol + description: "Token symbols, followed by their respective weights, if applicable" + - *version + - &label + name: label + description: "Nature of the transaction (Join/Exit via swap or Mint/Burn via transfer)" + - *token_address + - &delta_amount_raw + name: delta_amount_raw + description: "Raw value of the transaction on token supply at the time of execution in the original currency" + - &delta_amount + name: delta_amount + description: "Normalized value of the transaction on token supply at the time of execution in the original currency" + + - name: balancer_v2_polygon_bpt_supply_changes_daily + meta: + blockchain: polygon + project: balancer_v2 + contributors: viniabussafi + config: + tags: ['polygon', 'bpt', 'supply', 'changes'] + description: > + Balancer Pool Token (BPT) supply change events. grouped by day + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - block_date + - blockchain + - token_address + columns: + - *block_date + - *blockchain + - *pool_type + - *pool_symbol + - *version + - *token_address + - &daily_delta + name: daily_delta + description: "Daily total impact on BPT supply" \ No newline at end of file diff --git a/models/balancer/polygon/balancer_v2_polygon_bpt_prices.sql b/models/_project/balancer/bpt/polygon/balancer_v2_polygon_bpt_prices.sql similarity index 100% rename from models/balancer/polygon/balancer_v2_polygon_bpt_prices.sql rename to models/_project/balancer/bpt/polygon/balancer_v2_polygon_bpt_prices.sql diff --git a/models/balancer/polygon/balancer_v2_polygon_bpt_supply.sql b/models/_project/balancer/bpt/polygon/balancer_v2_polygon_bpt_supply.sql similarity index 100% rename from models/balancer/polygon/balancer_v2_polygon_bpt_supply.sql rename to models/_project/balancer/bpt/polygon/balancer_v2_polygon_bpt_supply.sql diff --git a/models/_project/balancer/bpt/polygon/balancer_v2_polygon_bpt_supply_changes.sql b/models/_project/balancer/bpt/polygon/balancer_v2_polygon_bpt_supply_changes.sql new file mode 100644 index 00000000000..7ff8034b96b --- /dev/null +++ b/models/_project/balancer/bpt/polygon/balancer_v2_polygon_bpt_supply_changes.sql @@ -0,0 +1,20 @@ +{% set blockchain = 'polygon' %} + +{{ + config( + schema = 'balancer_v2_polygon', + alias = 'bpt_supply_changes', + materialized = 'incremental', + file_format = 'delta', + incremental_strategy = 'merge', + unique_key = ['block_date', 'evt_tx_hash', 'evt_index', 'label'], + incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.evt_block_time')] + ) +}} + +{{ + bpt_supply_changes_macro( + blockchain = blockchain, + version = '2' + ) +}} \ No newline at end of file diff --git a/models/_project/balancer/bpt/polygon/balancer_v2_polygon_bpt_supply_changes_daily.sql b/models/_project/balancer/bpt/polygon/balancer_v2_polygon_bpt_supply_changes_daily.sql new file mode 100644 index 00000000000..57615beb139 --- /dev/null +++ b/models/_project/balancer/bpt/polygon/balancer_v2_polygon_bpt_supply_changes_daily.sql @@ -0,0 +1,17 @@ +{% set blockchain = 'polygon' %} + +{{ + config( + schema = 'balancer_v2_polygon', + alias = 'bpt_supply_changes_daily', + materialized = 'table', + file_format = 'delta' + ) +}} + +{{ + bpt_supply_changes_daily_agg_macro( + blockchain = blockchain, + version = '2' + ) +}} \ No newline at end of file diff --git a/models/balancer/polygon/balancer_v2_polygon_transfers_bpt.sql b/models/_project/balancer/bpt/polygon/balancer_v2_polygon_transfers_bpt.sql similarity index 100% rename from models/balancer/polygon/balancer_v2_polygon_transfers_bpt.sql rename to models/_project/balancer/bpt/polygon/balancer_v2_polygon_transfers_bpt.sql diff --git a/models/_project/balancer/bpt/zkevm/_schema.yml b/models/_project/balancer/bpt/zkevm/_schema.yml new file mode 100644 index 00000000000..fbdd80ddb56 --- /dev/null +++ b/models/_project/balancer/bpt/zkevm/_schema.yml @@ -0,0 +1,178 @@ +version: 2 + +models: + - name: balancer_v2_zkevm_transfers_bpt + meta: + blockchain: zkevm + project: balancer_v2 + contributors: victorstefenon, thetroyharris, viniabussafi + config: + tags: ['zkevm', 'bpt', 'transfers'] + description: > + Balancer Pool Token (BPT) transfer logs on Balancer, an automated portfolio manager and trading platform, on zkevm. + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - evt_tx_hash + - evt_index + - block_date + columns: + - &blockchain + name: blockchain + description: "Blockchain" + - &version + name: version + description: "Version of Balancer where the liquidity pool used in transaction is deployed" + - &contract_address + name: contract_address + description: 'zkevm address for the liquidity pool used in transaction' + - &block_date + name: block_date + description: "UTC event block date of each DEX trade" + - &block_month + name: block_month + description: "UTC event block month of each DEX trade" + - &evt_tx_hash + name: evt_tx_hash + description: 'Transaction hash of transfer event' + - &evt_index + name: evt_index + description: 'Event index' + - &evt_block_time + name: evt_block_time + description: 'Block time of transfer event' + - &evt_block_number + name: evt_block_number + description: 'Block number of transfer event' + - &from + name: from + description: 'Address of BPT provider of transfer event' + - &to + name: to + description: 'Address of BPT receiver of transfer event' + - &value + name: value + description: 'Amount of BPT transferred in transfer event' + + - name: balancer_v2_zkevm_bpt_prices + meta: + blockchain: zkevm + project: balancer_v2 + contributors: victorstefenon, thetroyharris, viniabussafi + config: + tags: ['zkevm', 'bpt', 'prices'] + description: > + Balancer Pool Token (BPT) daily price by pool on Balancer, an automated portfolio manager and trading platform. + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - blockchain + - day + - contract_address + columns: + - *blockchain + - &day + name: day + description: "Block date in UTC" + - *version + - &decimals + name: decimals + description: "Token decimals. 18, by default, on BPTs" + - *contract_address + - &bpt_price + name: bpt_price + description: "Price of the BPT" + + - name: balancer_v2_zkevm_bpt_supply + meta: + blockchain: zkevm + project: balancer_v2 + contributors: thetroyharris, viniabussafi + config: + tags: ['zkevm', 'bpt', 'supply'] + description: > + Balancer Pool Token (BPT) supply by pool on Balancer, an automated portfolio manager and trading platform. + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - day + - blockchain + - token_address + columns: + - *day + - &pool_type + name: pool_type + description: "Pool attributes, determined by the pool's factory" + - *version + - *blockchain + - &token_address + name: token_address + description: "Contract address of the BPT" + - &supply + name: supply + description: "Supply of the BPT, discounted of premints" + + - name: balancer_v2_zkevm_bpt_supply_changes + meta: + blockchain: zkevm + project: balancer_v2 + contributors: viniabussafi + config: + tags: ['zkevm', 'bpt', 'supply', 'changes'] + description: > + Balancer Pool Token (BPT) supply change events. + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - block_date + - evt_tx_hash + - evt_index + - label + columns: + - *block_date + - *evt_block_time + - *evt_block_number + - *blockchain + - *evt_tx_hash + - *evt_index + - *pool_type + - &pool_symbol + name: pool_symbol + description: "Token symbols, followed by their respective weights, if applicable" + - *version + - &label + name: label + description: "Nature of the transaction (Join/Exit via swap or Mint/Burn via transfer)" + - *token_address + - &delta_amount_raw + name: delta_amount_raw + description: "Raw value of the transaction on token supply at the time of execution in the original currency" + - &delta_amount + name: delta_amount + description: "Normalized value of the transaction on token supply at the time of execution in the original currency" + + - name: balancer_v2_zkevm_bpt_supply_changes_daily + meta: + blockchain: zkevm + project: balancer_v2 + contributors: viniabussafi + config: + tags: ['zkevm', 'bpt', 'supply', 'changes'] + description: > + Balancer Pool Token (BPT) supply change events. grouped by day + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - block_date + - blockchain + - token_address + columns: + - *block_date + - *blockchain + - *pool_type + - *pool_symbol + - *version + - *token_address + - &daily_delta + name: daily_delta + description: "Daily total impact on BPT supply" \ No newline at end of file diff --git a/models/balancer/zkevm/balancer_v2_zkevm_bpt_prices.sql b/models/_project/balancer/bpt/zkevm/balancer_v2_zkevm_bpt_prices.sql similarity index 100% rename from models/balancer/zkevm/balancer_v2_zkevm_bpt_prices.sql rename to models/_project/balancer/bpt/zkevm/balancer_v2_zkevm_bpt_prices.sql diff --git a/models/balancer/zkevm/balancer_v2_zkevm_bpt_supply.sql b/models/_project/balancer/bpt/zkevm/balancer_v2_zkevm_bpt_supply.sql similarity index 100% rename from models/balancer/zkevm/balancer_v2_zkevm_bpt_supply.sql rename to models/_project/balancer/bpt/zkevm/balancer_v2_zkevm_bpt_supply.sql diff --git a/models/_project/balancer/bpt/zkevm/balancer_v2_zkevm_bpt_supply_changes.sql b/models/_project/balancer/bpt/zkevm/balancer_v2_zkevm_bpt_supply_changes.sql new file mode 100644 index 00000000000..f11227e4013 --- /dev/null +++ b/models/_project/balancer/bpt/zkevm/balancer_v2_zkevm_bpt_supply_changes.sql @@ -0,0 +1,20 @@ +{% set blockchain = 'zkevm' %} + +{{ + config( + schema = 'balancer_v2_zkevm', + alias = 'bpt_supply_changes', + materialized = 'incremental', + file_format = 'delta', + incremental_strategy = 'merge', + unique_key = ['block_date', 'evt_tx_hash', 'evt_index', 'label'], + incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.evt_block_time')] + ) +}} + +{{ + bpt_supply_changes_macro( + blockchain = blockchain, + version = '2' + ) +}} \ No newline at end of file diff --git a/models/_project/balancer/bpt/zkevm/balancer_v2_zkevm_bpt_supply_changes_daily.sql b/models/_project/balancer/bpt/zkevm/balancer_v2_zkevm_bpt_supply_changes_daily.sql new file mode 100644 index 00000000000..4e548f4bcf7 --- /dev/null +++ b/models/_project/balancer/bpt/zkevm/balancer_v2_zkevm_bpt_supply_changes_daily.sql @@ -0,0 +1,17 @@ +{% set blockchain = 'zkevm' %} + +{{ + config( + schema = 'balancer_v2_zkevm', + alias = 'bpt_supply_changes_daily', + materialized = 'table', + file_format = 'delta' + ) +}} + +{{ + bpt_supply_changes_daily_agg_macro( + blockchain = blockchain, + version = '2' + ) +}} \ No newline at end of file diff --git a/models/balancer/zkevm/balancer_v2_zkevm_transfers_bpt.sql b/models/_project/balancer/bpt/zkevm/balancer_v2_zkevm_transfers_bpt.sql similarity index 100% rename from models/balancer/zkevm/balancer_v2_zkevm_transfers_bpt.sql rename to models/_project/balancer/bpt/zkevm/balancer_v2_zkevm_transfers_bpt.sql diff --git a/models/_project/balancer/flashloans/_schema.yml b/models/_project/balancer/flashloans/_schema.yml new file mode 100644 index 00000000000..948574c1ad6 --- /dev/null +++ b/models/_project/balancer/flashloans/_schema.yml @@ -0,0 +1,35 @@ +version: 2 + +models: + - name: balancer_flashloans + meta: + blockchain: arbitrum, avalanche_c, base, ethereum, gnosis, optimism, polygon, zkevm + sector: lending + contributors: hildobby, viniabussafi + config: + tags: ['ethereum', 'arbitrum', 'optimism', 'polygon', 'gnosis','avalanche_c', 'base', 'zkevm', 'flashloans'] + description: > + All Balancer flashloans + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - blockchain + - tx_hash + - evt_index + columns: + - name: blockchain + - name: project + - name: version + - name: block_time + - name: block_month + - name: block_number + - name: amount + - name: amount_usd + - name: tx_hash + - name: evt_index + - name: fee + - name: currency_contract + - name: currency_symbol + - name: recipient + - name: contract_address + \ No newline at end of file diff --git a/models/_project/balancer/flashloans/arbitrum/_schema.yml b/models/_project/balancer/flashloans/arbitrum/_schema.yml new file mode 100644 index 00000000000..562e948bde1 --- /dev/null +++ b/models/_project/balancer/flashloans/arbitrum/_schema.yml @@ -0,0 +1,36 @@ +version: 2 + +models: + - name: balancer_v2_arbitrum_flashloans + meta: + blockchain: arbitrum + sector: lending + contributors: hildobby, viniabussafi + config: + tags: ['arbitrum', 'flashloans'] + description: > + All Balancer v2 flashloans on Arbitrum + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - blockchain + - tx_hash + - evt_index + columns: + - name: blockchain + - name: project + - name: version + - name: block_time + - name: block_number + - name: amount + - name: amount_usd + - &tx_hash + name: tx_hash + description: "Tx. Hash" + - name: evt_index + - name: fee + - name: currency_contract + - name: currency_symbol + - name: recipient + - name: contract_address + - name: block_month \ No newline at end of file diff --git a/models/balancer/arbitrum/balancer_v2_arbitrum_flashloans.sql b/models/_project/balancer/flashloans/arbitrum/balancer_v2_arbitrum_flashloans.sql similarity index 88% rename from models/balancer/arbitrum/balancer_v2_arbitrum_flashloans.sql rename to models/_project/balancer/flashloans/arbitrum/balancer_v2_arbitrum_flashloans.sql index 52ec11d81ee..bf21ac0ece7 100644 --- a/models/balancer/arbitrum/balancer_v2_arbitrum_flashloans.sql +++ b/models/_project/balancer/flashloans/arbitrum/balancer_v2_arbitrum_flashloans.sql @@ -6,10 +6,6 @@ , file_format = 'delta' , incremental_strategy = 'merge' , unique_key = ['tx_hash', 'evt_index'] - , post_hook='{{ expose_spells(\'["arbitrum"]\', - "project", - "balancer_v2", - \'["hildobby"]\') }}' ) }} diff --git a/models/_project/balancer/flashloans/avalanche_c/_schema.yml b/models/_project/balancer/flashloans/avalanche_c/_schema.yml new file mode 100644 index 00000000000..6a0a0a719f3 --- /dev/null +++ b/models/_project/balancer/flashloans/avalanche_c/_schema.yml @@ -0,0 +1,36 @@ +version: 2 + +models: + - name: balancer_v2_avalanche_c_flashloans + meta: + blockchain: avalanche_c + sector: lending + contributors: hildobby, viniabussafi + config: + tags: ['avalanche_c', 'flashloans'] + description: > + All Balancer v2 flashloans on avalanche_c + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - blockchain + - tx_hash + - evt_index + columns: + - name: blockchain + - name: project + - name: version + - name: block_time + - name: block_number + - name: amount + - name: amount_usd + - &tx_hash + name: tx_hash + description: "Tx. Hash" + - name: evt_index + - name: fee + - name: currency_contract + - name: currency_symbol + - name: recipient + - name: contract_address + - name: block_month \ No newline at end of file diff --git a/models/balancer/avalanche_c/balancer_v2_avalanche_c_flashloans.sql b/models/_project/balancer/flashloans/avalanche_c/balancer_v2_avalanche_c_flashloans.sql similarity index 88% rename from models/balancer/avalanche_c/balancer_v2_avalanche_c_flashloans.sql rename to models/_project/balancer/flashloans/avalanche_c/balancer_v2_avalanche_c_flashloans.sql index eca6b3b0809..d4ec0d2e79d 100644 --- a/models/balancer/avalanche_c/balancer_v2_avalanche_c_flashloans.sql +++ b/models/_project/balancer/flashloans/avalanche_c/balancer_v2_avalanche_c_flashloans.sql @@ -6,10 +6,6 @@ , file_format = 'delta' , incremental_strategy = 'merge' , unique_key = ['tx_hash', 'evt_index'] - , post_hook='{{ expose_spells(\'["avalanche_c"]\', - "project", - "balancer_v2", - \'["hildobby", "viniabussafi"]\') }}' ) }} diff --git a/models/balancer/balancer_flashloans.sql b/models/_project/balancer/flashloans/balancer_flashloans.sql similarity index 69% rename from models/balancer/balancer_flashloans.sql rename to models/_project/balancer/flashloans/balancer_flashloans.sql index bf79fcbf7f9..19f69ad6231 100644 --- a/models/balancer/balancer_flashloans.sql +++ b/models/_project/balancer/flashloans/balancer_flashloans.sql @@ -1,10 +1,10 @@ {{ config( - + schema = 'balancer', alias = 'flashloans', - post_hook='{{ expose_spells(\'["ethereum","arbitrum", "optimism", "polygon", "gnosis", "avalanche_c", "base", "zkevm"]\', - "project", - "balancer", - \'["hildobby", "viniabussafi"]\') }}' + post_hook='{{ expose_spells(blockchains = \'["arbitrum", "avalanche_c", "base", "ethereum", "gnosis", "optimism", "polygon", "zkevm"]\', + spell_type = "project", + spell_name = "balancer", + contributors = \'["hildobby", "viniabussafi"]\') }}' ) }} @@ -19,7 +19,6 @@ ref('balancer_v2_ethereum_flashloans') , ref('balancer_v2_zkevm_flashloans') ] %} - SELECT * FROM ( {% for flash_model in balancer_models %} diff --git a/models/_project/balancer/flashloans/base/_schema.yml b/models/_project/balancer/flashloans/base/_schema.yml new file mode 100644 index 00000000000..3664ca0dbb5 --- /dev/null +++ b/models/_project/balancer/flashloans/base/_schema.yml @@ -0,0 +1,36 @@ +version: 2 + +models: + - name: balancer_v2_base_flashloans + meta: + blockchain: base + sector: lending + contributors: hildobby, viniabussafi + config: + tags: ['base', 'flashloans'] + description: > + All Balancer v2 flashloans on base + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - blockchain + - tx_hash + - evt_index + columns: + - name: blockchain + - name: project + - name: version + - name: block_time + - name: block_number + - name: amount + - name: amount_usd + - &tx_hash + name: tx_hash + description: "Tx. Hash" + - name: evt_index + - name: fee + - name: currency_contract + - name: currency_symbol + - name: recipient + - name: contract_address + - name: block_month \ No newline at end of file diff --git a/models/balancer/base/balancer_v2_base_flashloans.sql b/models/_project/balancer/flashloans/base/balancer_v2_base_flashloans.sql similarity index 88% rename from models/balancer/base/balancer_v2_base_flashloans.sql rename to models/_project/balancer/flashloans/base/balancer_v2_base_flashloans.sql index 9438b88cf9c..da8cb9d2ae1 100644 --- a/models/balancer/base/balancer_v2_base_flashloans.sql +++ b/models/_project/balancer/flashloans/base/balancer_v2_base_flashloans.sql @@ -6,10 +6,6 @@ , file_format = 'delta' , incremental_strategy = 'merge' , unique_key = ['tx_hash', 'evt_index'] - , post_hook='{{ expose_spells(\'["base"]\', - "project", - "balancer_v2", - \'["hildobby", "viniabussafi"]\') }}' ) }} diff --git a/models/_project/balancer/flashloans/ethereum/_schema.yml b/models/_project/balancer/flashloans/ethereum/_schema.yml new file mode 100644 index 00000000000..48e15def9f8 --- /dev/null +++ b/models/_project/balancer/flashloans/ethereum/_schema.yml @@ -0,0 +1,36 @@ +version: 2 + +models: + - name: balancer_v2_ethereum_flashloans + meta: + blockchain: ethereum + sector: lending + contributors: hildobby, viniabussafi + config: + tags: ['ethereum', 'flashloans'] + description: > + All Balancer v2 flashloans on ethereum + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - blockchain + - tx_hash + - evt_index + columns: + - name: blockchain + - name: project + - name: version + - name: block_time + - name: block_number + - name: amount + - name: amount_usd + - &tx_hash + name: tx_hash + description: "Tx. Hash" + - name: evt_index + - name: fee + - name: currency_contract + - name: currency_symbol + - name: recipient + - name: contract_address + - name: block_month \ No newline at end of file diff --git a/models/balancer/ethereum/balancer_v2_ethereum_flashloans.sql b/models/_project/balancer/flashloans/ethereum/balancer_v2_ethereum_flashloans.sql similarity index 88% rename from models/balancer/ethereum/balancer_v2_ethereum_flashloans.sql rename to models/_project/balancer/flashloans/ethereum/balancer_v2_ethereum_flashloans.sql index cdbd54e0a7c..652ad476e88 100644 --- a/models/balancer/ethereum/balancer_v2_ethereum_flashloans.sql +++ b/models/_project/balancer/flashloans/ethereum/balancer_v2_ethereum_flashloans.sql @@ -6,10 +6,6 @@ , file_format = 'delta' , incremental_strategy = 'merge' , unique_key = ['tx_hash', 'evt_index'] - , post_hook='{{ expose_spells(\'["ethereum"]\', - "project", - "balancer_v2", - \'["hildobby"]\') }}' ) }} diff --git a/models/_project/balancer/flashloans/gnosis/_schema.yml b/models/_project/balancer/flashloans/gnosis/_schema.yml new file mode 100644 index 00000000000..a7db5e36011 --- /dev/null +++ b/models/_project/balancer/flashloans/gnosis/_schema.yml @@ -0,0 +1,36 @@ +version: 2 + +models: + - name: balancer_v2_gnosis_flashloans + meta: + blockchain: gnosis + sector: lending + contributors: hildobby, viniabussafi + config: + tags: ['gnosis', 'flashloans'] + description: > + All Balancer v2 flashloans on gnosis + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - blockchain + - tx_hash + - evt_index + columns: + - name: blockchain + - name: project + - name: version + - name: block_time + - name: block_number + - name: amount + - name: amount_usd + - &tx_hash + name: tx_hash + description: "Tx. Hash" + - name: evt_index + - name: fee + - name: currency_contract + - name: currency_symbol + - name: recipient + - name: contract_address + - name: block_month \ No newline at end of file diff --git a/models/balancer/gnosis/balancer_v2_gnosis_flashloans.sql b/models/_project/balancer/flashloans/gnosis/balancer_v2_gnosis_flashloans.sql similarity index 88% rename from models/balancer/gnosis/balancer_v2_gnosis_flashloans.sql rename to models/_project/balancer/flashloans/gnosis/balancer_v2_gnosis_flashloans.sql index 7a4dd71de65..f8d11b83452 100644 --- a/models/balancer/gnosis/balancer_v2_gnosis_flashloans.sql +++ b/models/_project/balancer/flashloans/gnosis/balancer_v2_gnosis_flashloans.sql @@ -6,10 +6,6 @@ , file_format = 'delta' , incremental_strategy = 'merge' , unique_key = ['tx_hash', 'evt_index'] - , post_hook='{{ expose_spells(\'["gnosis"]\', - "project", - "balancer_v2", - \'["hildobby"]\') }}' ) }} diff --git a/models/_project/balancer/flashloans/optimism/_schema.yml b/models/_project/balancer/flashloans/optimism/_schema.yml new file mode 100644 index 00000000000..64a96dc514f --- /dev/null +++ b/models/_project/balancer/flashloans/optimism/_schema.yml @@ -0,0 +1,36 @@ +version: 2 + +models: + - name: balancer_v2_optimism_flashloans + meta: + blockchain: optimism + sector: lending + contributors: hildobby, viniabussafi + config: + tags: ['optimism', 'flashloans'] + description: > + All Balancer v2 flashloans on optimism + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - blockchain + - tx_hash + - evt_index + columns: + - name: blockchain + - name: project + - name: version + - name: block_time + - name: block_number + - name: amount + - name: amount_usd + - &tx_hash + name: tx_hash + description: "Tx. Hash" + - name: evt_index + - name: fee + - name: currency_contract + - name: currency_symbol + - name: recipient + - name: contract_address + - name: block_month \ No newline at end of file diff --git a/models/balancer/optimism/balancer_v2_optimism_flashloans.sql b/models/_project/balancer/flashloans/optimism/balancer_v2_optimism_flashloans.sql similarity index 88% rename from models/balancer/optimism/balancer_v2_optimism_flashloans.sql rename to models/_project/balancer/flashloans/optimism/balancer_v2_optimism_flashloans.sql index 9908e24f7b3..c7036fcc2ac 100644 --- a/models/balancer/optimism/balancer_v2_optimism_flashloans.sql +++ b/models/_project/balancer/flashloans/optimism/balancer_v2_optimism_flashloans.sql @@ -6,10 +6,6 @@ , file_format = 'delta' , incremental_strategy = 'merge' , unique_key = ['tx_hash', 'evt_index'] - , post_hook='{{ expose_spells(\'["optimism"]\', - "project", - "balancer_v2", - \'["hildobby"]\') }}' ) }} diff --git a/models/_project/balancer/flashloans/polygon/_schema.yml b/models/_project/balancer/flashloans/polygon/_schema.yml new file mode 100644 index 00000000000..305a7252c6c --- /dev/null +++ b/models/_project/balancer/flashloans/polygon/_schema.yml @@ -0,0 +1,36 @@ +version: 2 + +models: + - name: balancer_v2_polygon_flashloans + meta: + blockchain: polygon + sector: lending + contributors: hildobby, viniabussafi + config: + tags: ['polygon', 'flashloans'] + description: > + All Balancer v2 flashloans on polygon + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - blockchain + - tx_hash + - evt_index + columns: + - name: blockchain + - name: project + - name: version + - name: block_time + - name: block_number + - name: amount + - name: amount_usd + - &tx_hash + name: tx_hash + description: "Tx. Hash" + - name: evt_index + - name: fee + - name: currency_contract + - name: currency_symbol + - name: recipient + - name: contract_address + - name: block_month \ No newline at end of file diff --git a/models/balancer/polygon/balancer_v2_polygon_flashloans.sql b/models/_project/balancer/flashloans/polygon/balancer_v2_polygon_flashloans.sql similarity index 88% rename from models/balancer/polygon/balancer_v2_polygon_flashloans.sql rename to models/_project/balancer/flashloans/polygon/balancer_v2_polygon_flashloans.sql index 0f0cb1d9982..392c3866d89 100644 --- a/models/balancer/polygon/balancer_v2_polygon_flashloans.sql +++ b/models/_project/balancer/flashloans/polygon/balancer_v2_polygon_flashloans.sql @@ -6,10 +6,6 @@ , file_format = 'delta' , incremental_strategy = 'merge' , unique_key = ['tx_hash', 'evt_index'] - , post_hook='{{ expose_spells(\'["polygon"]\', - "project", - "balancer_v2", - \'["hildobby"]\') }}' ) }} diff --git a/models/_project/balancer/flashloans/zkevm/_schema.yml b/models/_project/balancer/flashloans/zkevm/_schema.yml new file mode 100644 index 00000000000..feb6c20d41b --- /dev/null +++ b/models/_project/balancer/flashloans/zkevm/_schema.yml @@ -0,0 +1,36 @@ +version: 2 + +models: + - name: balancer_v2_zkevm_flashloans + meta: + blockchain: zkevm + sector: lending + contributors: hildobby, viniabussafi + config: + tags: ['zkevm', 'flashloans'] + description: > + All Balancer v2 flashloans on zkevm + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - blockchain + - tx_hash + - evt_index + columns: + - name: blockchain + - name: project + - name: version + - name: block_time + - name: block_number + - name: amount + - name: amount_usd + - &tx_hash + name: tx_hash + description: "Tx. Hash" + - name: evt_index + - name: fee + - name: currency_contract + - name: currency_symbol + - name: recipient + - name: contract_address + - name: block_month \ No newline at end of file diff --git a/models/balancer/zkevm/balancer_v2_zkevm_flashloans.sql b/models/_project/balancer/flashloans/zkevm/balancer_v2_zkevm_flashloans.sql similarity index 88% rename from models/balancer/zkevm/balancer_v2_zkevm_flashloans.sql rename to models/_project/balancer/flashloans/zkevm/balancer_v2_zkevm_flashloans.sql index a11355919f7..3e1d9d1a6f5 100644 --- a/models/balancer/zkevm/balancer_v2_zkevm_flashloans.sql +++ b/models/_project/balancer/flashloans/zkevm/balancer_v2_zkevm_flashloans.sql @@ -6,10 +6,6 @@ , file_format = 'delta' , incremental_strategy = 'merge' , unique_key = ['tx_hash', 'evt_index'] - , post_hook='{{ expose_spells(\'["zkevm"]\', - "project", - "balancer_v2", - \'["hildobby", "viniabussafi"]\') }}' ) }} diff --git a/models/_project/balancer/liquidity/_schema.yml b/models/_project/balancer/liquidity/_schema.yml new file mode 100644 index 00000000000..b014ad151e4 --- /dev/null +++ b/models/_project/balancer/liquidity/_schema.yml @@ -0,0 +1,60 @@ +version: 2 + +models: + - name: balancer_liquidity + meta: + blockchain: arbitrum, avalanche_c, base, ethereum, gnosis, optimism, polygon, zkevm + project: balancer + contributors: viniabussafi + config: + tags: ['balancer', 'amm', 'dex', 'liquidity', 'ethereum', 'arbitrum', 'optimism', 'polygon', 'avalanche_c', 'base', 'zkevm'] + description: > + Liquidity by token on Balancer, an automated portfolio manager and trading platform. + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - day + - pool_id + - blockchain + - token_address + - token_symbol + columns: + - &day + name: day + description: "Block date in UTC" + - &pool_id + name: pool_id + description: "Unique encoded identifier that refers to each pool" + - &pool_address + name: pool_address + description: "Pool address" + - &pool_symbol + name: pool_symbol + description: "Token symbols, followed by their respective weights, if applicable" + - &version + name: version + description: "Version of the project" + - &blockchain + name: blockchain + description: "Blockchain" + - &pool_type + name: pool_type + description: "Pool attributes, determined by the pool's factory" + - &token_address + name: token_address + description: "Contract address of the token" + - &token_symbol + name: token_symbol + description: "Token symbol" + - name: token_balance_raw + description: 'Raw balance of the token in the pool in the original currency' + - name: token_balance + description: 'Scaled balance of the token in the pool in the original currency' + - name: protocol_liquidity_usd + description: 'Liquidity of the token in the pool in USD, except BPTs' + - name: protocol_liquidity_eth + description: 'Liquidity of the token in the pool in ETH, except BPTs' + - name: pool_liquidity_usd + description: 'Liquidity of the token in the pool in USD, including BPTs' + - name: pool_liquidity_eth + description: 'Liquidity of the token in the pool in ETH, including BPTs' \ No newline at end of file diff --git a/models/_project/balancer/liquidity/arbitrum/_schema.yml b/models/_project/balancer/liquidity/arbitrum/_schema.yml new file mode 100644 index 00000000000..ca88eb050b8 --- /dev/null +++ b/models/_project/balancer/liquidity/arbitrum/_schema.yml @@ -0,0 +1,58 @@ +version: 2 + +models: + - name: balancer_v2_arbitrum_liquidity + meta: + blockchain: arbitrum + project: balancer_v2 + contributors: victorstefenon, viniabussafi, thetroyharris + config: + tags: ['arbitrum', 'balancer', 'pools', 'liquidity'] + description: > + Balancer v2 pools liquidity by token in Arbitrum. + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - day + - pool_id + - token_address + columns: + - &day + name: day + description: "Block date in UTC" + - &pool_id + name: pool_id + description: "Unique encoded identifier that refers to each pool" + - &pool_address + name: pool_address + description: "Pool address" + - &pool_symbol + name: pool_symbol + description: "Token symbols, followed by their respective weights, if applicable" + - &version + name: version + description: "Version of the project" + - &blockchain + name: blockchain + description: "Blockchain" + - &pool_type + name: pool_type + description: "Pool attributes, determined by the pool's factory" + - &token_address + name: token_address + description: "Contract address of the token" + - &token_symbol + name: token_symbol + description: "Token symbol" + - name: token_balance_raw + description: 'Raw balance of the token in the pool in the original currency' + - name: token_balance + description: 'Scaled balance of the token in the pool in the original currency' + - name: protocol_liquidity_usd + description: 'Liquidity of the token in the pool in USD, except BPTs' + - name: protocol_liquidity_eth + description: 'Liquidity of the token in the pool in ETH, except BPTs' + - name: pool_liquidity_usd + description: 'Liquidity of the token in the pool in USD, including BPTs' + - name: pool_liquidity_eth + description: 'Liquidity of the token in the pool in ETH, including BPTs' \ No newline at end of file diff --git a/models/balancer/arbitrum/balancer_v2_arbitrum_liquidity.sql b/models/_project/balancer/liquidity/arbitrum/balancer_v2_arbitrum_liquidity.sql similarity index 52% rename from models/balancer/arbitrum/balancer_v2_arbitrum_liquidity.sql rename to models/_project/balancer/liquidity/arbitrum/balancer_v2_arbitrum_liquidity.sql index c78ddea2ad7..c32f49c73ac 100644 --- a/models/balancer/arbitrum/balancer_v2_arbitrum_liquidity.sql +++ b/models/_project/balancer/liquidity/arbitrum/balancer_v2_arbitrum_liquidity.sql @@ -6,11 +6,7 @@ schema = 'balancer_v2_arbitrum', alias = 'liquidity', materialized = 'table', - file_format = 'delta', - post_hook="{{ expose_spells('[\"" + blockchain + '"]' + '\', - "project", - "balancer_v2", - \'["stefenon", "viniabussafi"]\') }}' + file_format = 'delta' ) }} diff --git a/models/_project/balancer/liquidity/avalanche_c/_schema.yml b/models/_project/balancer/liquidity/avalanche_c/_schema.yml new file mode 100644 index 00000000000..cd5e9580b08 --- /dev/null +++ b/models/_project/balancer/liquidity/avalanche_c/_schema.yml @@ -0,0 +1,58 @@ +version: 2 + +models: + - name: balancer_v2_avalanche_c_liquidity + meta: + blockchain: avalanche_c + project: balancer_v2 + contributors: victorstefenon, viniabussafi, thetroyharris + config: + tags: ['avalanche_c', 'balancer', 'pools', 'liquidity'] + description: > + Balancer v2 pools liquidity by token in Arbitrum. + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - day + - pool_id + - token_address + columns: + - &day + name: day + description: "Block date in UTC" + - &pool_id + name: pool_id + description: "Unique encoded identifier that refers to each pool" + - &pool_address + name: pool_address + description: "Pool address" + - &pool_symbol + name: pool_symbol + description: "Token symbols, followed by their respective weights, if applicable" + - &version + name: version + description: "Version of the project" + - &blockchain + name: blockchain + description: "Blockchain" + - &pool_type + name: pool_type + description: "Pool attributes, determined by the pool's factory" + - &token_address + name: token_address + description: "Contract address of the token" + - &token_symbol + name: token_symbol + description: "Token symbol" + - name: token_balance_raw + description: 'Raw balance of the token in the pool in the original currency' + - name: token_balance + description: 'Scaled balance of the token in the pool in the original currency' + - name: protocol_liquidity_usd + description: 'Liquidity of the token in the pool in USD, except BPTs' + - name: protocol_liquidity_eth + description: 'Liquidity of the token in the pool in ETH, except BPTs' + - name: pool_liquidity_usd + description: 'Liquidity of the token in the pool in USD, including BPTs' + - name: pool_liquidity_eth + description: 'Liquidity of the token in the pool in ETH, including BPTs' \ No newline at end of file diff --git a/models/balancer/avalanche_c/balancer_v2_avalanche_c_liquidity.sql b/models/_project/balancer/liquidity/avalanche_c/balancer_v2_avalanche_c_liquidity.sql similarity index 53% rename from models/balancer/avalanche_c/balancer_v2_avalanche_c_liquidity.sql rename to models/_project/balancer/liquidity/avalanche_c/balancer_v2_avalanche_c_liquidity.sql index 15b3912d3ee..30e2856d411 100644 --- a/models/balancer/avalanche_c/balancer_v2_avalanche_c_liquidity.sql +++ b/models/_project/balancer/liquidity/avalanche_c/balancer_v2_avalanche_c_liquidity.sql @@ -6,11 +6,7 @@ schema = 'balancer_v2_avalanche_c', alias = 'liquidity', materialized = 'table', - file_format = 'delta', - post_hook="{{ expose_spells('[\"" + blockchain + '"]' + '\', - "project", - "balancer_v2", - \'["stefenon", "viniabussafi"]\') }}' + file_format = 'delta' ) }} diff --git a/models/balancer/balancer_liquidity.sql b/models/_project/balancer/liquidity/balancer_liquidity.sql similarity index 74% rename from models/balancer/balancer_liquidity.sql rename to models/_project/balancer/liquidity/balancer_liquidity.sql index 0f003bc5d6d..57fb1122ef5 100644 --- a/models/balancer/balancer_liquidity.sql +++ b/models/_project/balancer/liquidity/balancer_liquidity.sql @@ -2,11 +2,10 @@ schema = 'balancer', alias = 'liquidity', - post_hook='{{ expose_spells(\'["ethereum","arbitrum", "optimism", "polygon", "gnosis","avalanche_c", "base", "zkevm" - ]\', - "project", - "balancer", - \'["viniabussafi"]\') }}' + post_hook='{{ expose_spells(blockchains = \'["arbitrum", "avalanche_c", "base", "ethereum", "gnosis", "optimism", "polygon", "zkevm"]\', + spell_type = "project", + spell_name = "balancer", + contributors = \'["viniabussafi"]\') }}' ) }} diff --git a/models/_project/balancer/liquidity/base/_schema.yml b/models/_project/balancer/liquidity/base/_schema.yml new file mode 100644 index 00000000000..d4b57b38164 --- /dev/null +++ b/models/_project/balancer/liquidity/base/_schema.yml @@ -0,0 +1,58 @@ +version: 2 + +models: + - name: balancer_v2_base_liquidity + meta: + blockchain: base + project: balancer_v2 + contributors: victorstefenon, viniabussafi, thetroyharris + config: + tags: ['base', 'balancer', 'pools', 'liquidity'] + description: > + Balancer v2 pools liquidity by token in Arbitrum. + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - day + - pool_id + - token_address + columns: + - &day + name: day + description: "Block date in UTC" + - &pool_id + name: pool_id + description: "Unique encoded identifier that refers to each pool" + - &pool_address + name: pool_address + description: "Pool address" + - &pool_symbol + name: pool_symbol + description: "Token symbols, followed by their respective weights, if applicable" + - &version + name: version + description: "Version of the project" + - &blockchain + name: blockchain + description: "Blockchain" + - &pool_type + name: pool_type + description: "Pool attributes, determined by the pool's factory" + - &token_address + name: token_address + description: "Contract address of the token" + - &token_symbol + name: token_symbol + description: "Token symbol" + - name: token_balance_raw + description: 'Raw balance of the token in the pool in the original currency' + - name: token_balance + description: 'Scaled balance of the token in the pool in the original currency' + - name: protocol_liquidity_usd + description: 'Liquidity of the token in the pool in USD, except BPTs' + - name: protocol_liquidity_eth + description: 'Liquidity of the token in the pool in ETH, except BPTs' + - name: pool_liquidity_usd + description: 'Liquidity of the token in the pool in USD, including BPTs' + - name: pool_liquidity_eth + description: 'Liquidity of the token in the pool in ETH, including BPTs' \ No newline at end of file diff --git a/models/balancer/base/balancer_v2_base_liquidity.sql b/models/_project/balancer/liquidity/base/balancer_v2_base_liquidity.sql similarity index 51% rename from models/balancer/base/balancer_v2_base_liquidity.sql rename to models/_project/balancer/liquidity/base/balancer_v2_base_liquidity.sql index 10b08a41262..20f257ad753 100644 --- a/models/balancer/base/balancer_v2_base_liquidity.sql +++ b/models/_project/balancer/liquidity/base/balancer_v2_base_liquidity.sql @@ -6,11 +6,7 @@ schema = 'balancer_v2_base', alias = 'liquidity', materialized = 'table', - file_format = 'delta', - post_hook="{{ expose_spells('[\"" + blockchain + '"]' + '\', - "project", - "balancer_v2", - \'["stefenon", "viniabussafi"]\') }}' + file_format = 'delta' ) }} diff --git a/models/_project/balancer/liquidity/ethereum/_schema.yml b/models/_project/balancer/liquidity/ethereum/_schema.yml new file mode 100644 index 00000000000..42866a2e449 --- /dev/null +++ b/models/_project/balancer/liquidity/ethereum/_schema.yml @@ -0,0 +1,96 @@ +version: 2 + +models: + - name: balancer_v2_ethereum_liquidity + meta: + blockchain: ethereum + project: balancer_v2 + contributors: victorstefenon, viniabussafi, thetroyharris + config: + tags: ['ethereum', 'balancer', 'pools', 'liquidity'] + description: > + Balancer v2 pools liquidity by token in Ethereum. + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - day + - pool_id + - token_address + columns: + - &day + name: day + description: "Block date in UTC" + - &pool_id + name: pool_id + description: "Unique encoded identifier that refers to each pool" + - &pool_address + name: pool_address + description: "Pool address" + - &pool_symbol + name: pool_symbol + description: "Token symbols, followed by their respective weights, if applicable" + - &version + name: version + description: "Version of the project" + - &blockchain + name: blockchain + description: "Blockchain" + - &pool_type + name: pool_type + description: "Pool attributes, determined by the pool's factory" + - &token_address + name: token_address + description: "Contract address of the token" + - &token_symbol + name: token_symbol + description: "Token symbol" + - &token_balance_raw + name: token_balance_raw + description: 'Raw balance of the token in the pool in the original currency' + - &token_balance + name: token_balance + description: 'Scaled balance of the token in the pool in the original currency' + - &protocol_liquidity_usd + name: protocol_liquidity_usd + description: 'Liquidity of the token in the pool in USD, except BPTs' + - &protocol_liquidity_eth + name: protocol_liquidity_eth + description: 'Liquidity of the token in the pool in ETH, except BPTs' + - &pool_liquidity_usd + name: pool_liquidity_usd + description: 'Liquidity of the token in the pool in USD, including BPTs' + - &pool_liquidity_eth + name: pool_liquidity_eth + description: 'Liquidity of the token in the pool in ETH, including BPTs' + + - name: balancer_v1_ethereum_liquidity + meta: + blockchain: ethereum + project: balancer_v1 + contributors: markusbkoch, mendesfabio, victorstefenon, viniabussafi, thetroyharris + config: + tags: ['ethereum', 'balancer', 'pools', 'liquidity'] + description: > + Balancer v1 pools liquidity by token in Ethereum. + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - day + - pool_id + - token_address + columns: + - *day + - *pool_id + - *pool_address + - *pool_symbol + - *version + - *blockchain + - *pool_type + - *token_address + - *token_symbol + - *token_balance_raw + - *token_balance + - *protocol_liquidity_usd + - *protocol_liquidity_eth + - *pool_liquidity_usd + - *pool_liquidity_eth \ No newline at end of file diff --git a/models/balancer/ethereum/balancer_v1_ethereum_liquidity.sql b/models/_project/balancer/liquidity/ethereum/balancer_v1_ethereum_liquidity.sql similarity index 92% rename from models/balancer/ethereum/balancer_v1_ethereum_liquidity.sql rename to models/_project/balancer/liquidity/ethereum/balancer_v1_ethereum_liquidity.sql index 31601ee7cdd..b433278b8db 100644 --- a/models/balancer/ethereum/balancer_v1_ethereum_liquidity.sql +++ b/models/_project/balancer/liquidity/ethereum/balancer_v1_ethereum_liquidity.sql @@ -3,11 +3,7 @@ schema='balancer_v1_ethereum', alias = 'liquidity', materialized = 'table', - file_format = 'delta', - post_hook='{{ expose_spells(\'["ethereum"]\', - "project", - "balancer_v1", - \'["stefenon", "viniabussafi"]\') }}' + file_format = 'delta' ) }} diff --git a/models/balancer/ethereum/balancer_v2_ethereum_liquidity.sql b/models/_project/balancer/liquidity/ethereum/balancer_v2_ethereum_liquidity.sql similarity index 52% rename from models/balancer/ethereum/balancer_v2_ethereum_liquidity.sql rename to models/_project/balancer/liquidity/ethereum/balancer_v2_ethereum_liquidity.sql index 56ccd353f93..54efdce06c3 100644 --- a/models/balancer/ethereum/balancer_v2_ethereum_liquidity.sql +++ b/models/_project/balancer/liquidity/ethereum/balancer_v2_ethereum_liquidity.sql @@ -6,11 +6,7 @@ schema = 'balancer_v2_ethereum', alias = 'liquidity', materialized = 'table', - file_format = 'delta', - post_hook="{{ expose_spells('[\"" + blockchain + '"]' + '\', - "project", - "balancer_v2", - \'["stefenon", "viniabussafi"]\') }}' + file_format = 'delta' ) }} diff --git a/models/_project/balancer/liquidity/gnosis/_schema.yml b/models/_project/balancer/liquidity/gnosis/_schema.yml new file mode 100644 index 00000000000..d21460430ab --- /dev/null +++ b/models/_project/balancer/liquidity/gnosis/_schema.yml @@ -0,0 +1,58 @@ +version: 2 + +models: + - name: balancer_v2_gnosis_liquidity + meta: + blockchain: gnosis + project: balancer_v2 + contributors: victorstefenon, viniabussafi, thetroyharris + config: + tags: ['gnosis', 'balancer', 'pools', 'liquidity'] + description: > + Balancer v2 pools liquidity by token in Arbitrum. + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - day + - pool_id + - token_address + columns: + - &day + name: day + description: "Block date in UTC" + - &pool_id + name: pool_id + description: "Unique encoded identifier that refers to each pool" + - &pool_address + name: pool_address + description: "Pool address" + - &pool_symbol + name: pool_symbol + description: "Token symbols, followed by their respective weights, if applicable" + - &version + name: version + description: "Version of the project" + - &blockchain + name: blockchain + description: "Blockchain" + - &pool_type + name: pool_type + description: "Pool attributes, determined by the pool's factory" + - &token_address + name: token_address + description: "Contract address of the token" + - &token_symbol + name: token_symbol + description: "Token symbol" + - name: token_balance_raw + description: 'Raw balance of the token in the pool in the original currency' + - name: token_balance + description: 'Scaled balance of the token in the pool in the original currency' + - name: protocol_liquidity_usd + description: 'Liquidity of the token in the pool in USD, except BPTs' + - name: protocol_liquidity_eth + description: 'Liquidity of the token in the pool in ETH, except BPTs' + - name: pool_liquidity_usd + description: 'Liquidity of the token in the pool in USD, including BPTs' + - name: pool_liquidity_eth + description: 'Liquidity of the token in the pool in ETH, including BPTs' \ No newline at end of file diff --git a/models/balancer/gnosis/balancer_v2_gnosis_liquidity.sql b/models/_project/balancer/liquidity/gnosis/balancer_v2_gnosis_liquidity.sql similarity index 51% rename from models/balancer/gnosis/balancer_v2_gnosis_liquidity.sql rename to models/_project/balancer/liquidity/gnosis/balancer_v2_gnosis_liquidity.sql index 478f1b6c77f..fc5885a24e0 100644 --- a/models/balancer/gnosis/balancer_v2_gnosis_liquidity.sql +++ b/models/_project/balancer/liquidity/gnosis/balancer_v2_gnosis_liquidity.sql @@ -6,11 +6,7 @@ schema = 'balancer_v2_gnosis', alias = 'liquidity', materialized = 'table', - file_format = 'delta', - post_hook="{{ expose_spells('[\"" + blockchain + '"]' + '\', - "project", - "balancer_v2", - \'["stefenon", "viniabussafi"]\') }}' + file_format = 'delta' ) }} diff --git a/models/_project/balancer/liquidity/optimism/_schema.yml b/models/_project/balancer/liquidity/optimism/_schema.yml new file mode 100644 index 00000000000..d41d2cb3e49 --- /dev/null +++ b/models/_project/balancer/liquidity/optimism/_schema.yml @@ -0,0 +1,58 @@ +version: 2 + +models: + - name: balancer_v2_optimism_liquidity + meta: + blockchain: optimism + project: balancer_v2 + contributors: victorstefenon, viniabussafi, thetroyharris + config: + tags: ['optimism', 'balancer', 'pools', 'liquidity'] + description: > + Balancer v2 pools liquidity by token in Arbitrum. + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - day + - pool_id + - token_address + columns: + - &day + name: day + description: "Block date in UTC" + - &pool_id + name: pool_id + description: "Unique encoded identifier that refers to each pool" + - &pool_address + name: pool_address + description: "Pool address" + - &pool_symbol + name: pool_symbol + description: "Token symbols, followed by their respective weights, if applicable" + - &version + name: version + description: "Version of the project" + - &blockchain + name: blockchain + description: "Blockchain" + - &pool_type + name: pool_type + description: "Pool attributes, determined by the pool's factory" + - &token_address + name: token_address + description: "Contract address of the token" + - &token_symbol + name: token_symbol + description: "Token symbol" + - name: token_balance_raw + description: 'Raw balance of the token in the pool in the original currency' + - name: token_balance + description: 'Scaled balance of the token in the pool in the original currency' + - name: protocol_liquidity_usd + description: 'Liquidity of the token in the pool in USD, except BPTs' + - name: protocol_liquidity_eth + description: 'Liquidity of the token in the pool in ETH, except BPTs' + - name: pool_liquidity_usd + description: 'Liquidity of the token in the pool in USD, including BPTs' + - name: pool_liquidity_eth + description: 'Liquidity of the token in the pool in ETH, including BPTs' \ No newline at end of file diff --git a/models/balancer/optimism/balancer_v2_optimism_liquidity.sql b/models/_project/balancer/liquidity/optimism/balancer_v2_optimism_liquidity.sql similarity index 52% rename from models/balancer/optimism/balancer_v2_optimism_liquidity.sql rename to models/_project/balancer/liquidity/optimism/balancer_v2_optimism_liquidity.sql index d9e8ac55868..b34e0e3557a 100644 --- a/models/balancer/optimism/balancer_v2_optimism_liquidity.sql +++ b/models/_project/balancer/liquidity/optimism/balancer_v2_optimism_liquidity.sql @@ -6,11 +6,7 @@ schema = 'balancer_v2_optimism', alias = 'liquidity', materialized = 'table', - file_format = 'delta', - post_hook="{{ expose_spells('[\"" + blockchain + '"]' + '\', - "project", - "balancer_v2", - \'["stefenon", "viniabussafi"]\') }}' + file_format = 'delta' ) }} diff --git a/models/_project/balancer/liquidity/polygon/_schema.yml b/models/_project/balancer/liquidity/polygon/_schema.yml new file mode 100644 index 00000000000..5054f2a9740 --- /dev/null +++ b/models/_project/balancer/liquidity/polygon/_schema.yml @@ -0,0 +1,58 @@ +version: 2 + +models: + - name: balancer_v2_polygon_liquidity + meta: + blockchain: polygon + project: balancer_v2 + contributors: victorstefenon, viniabussafi, thetroyharris + config: + tags: ['polygon', 'balancer', 'pools', 'liquidity'] + description: > + Balancer v2 pools liquidity by token in Arbitrum. + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - day + - pool_id + - token_address + columns: + - &day + name: day + description: "Block date in UTC" + - &pool_id + name: pool_id + description: "Unique encoded identifier that refers to each pool" + - &pool_address + name: pool_address + description: "Pool address" + - &pool_symbol + name: pool_symbol + description: "Token symbols, followed by their respective weights, if applicable" + - &version + name: version + description: "Version of the project" + - &blockchain + name: blockchain + description: "Blockchain" + - &pool_type + name: pool_type + description: "Pool attributes, determined by the pool's factory" + - &token_address + name: token_address + description: "Contract address of the token" + - &token_symbol + name: token_symbol + description: "Token symbol" + - name: token_balance_raw + description: 'Raw balance of the token in the pool in the original currency' + - name: token_balance + description: 'Scaled balance of the token in the pool in the original currency' + - name: protocol_liquidity_usd + description: 'Liquidity of the token in the pool in USD, except BPTs' + - name: protocol_liquidity_eth + description: 'Liquidity of the token in the pool in ETH, except BPTs' + - name: pool_liquidity_usd + description: 'Liquidity of the token in the pool in USD, including BPTs' + - name: pool_liquidity_eth + description: 'Liquidity of the token in the pool in ETH, including BPTs' \ No newline at end of file diff --git a/models/balancer/polygon/balancer_v2_polygon_liquidity.sql b/models/_project/balancer/liquidity/polygon/balancer_v2_polygon_liquidity.sql similarity index 52% rename from models/balancer/polygon/balancer_v2_polygon_liquidity.sql rename to models/_project/balancer/liquidity/polygon/balancer_v2_polygon_liquidity.sql index f830e2df02c..3f0c521ade6 100644 --- a/models/balancer/polygon/balancer_v2_polygon_liquidity.sql +++ b/models/_project/balancer/liquidity/polygon/balancer_v2_polygon_liquidity.sql @@ -6,11 +6,7 @@ schema = 'balancer_v2_polygon', alias = 'liquidity', materialized = 'table', - file_format = 'delta', - post_hook="{{ expose_spells('[\"" + blockchain + '"]' + '\', - "project", - "balancer_v2", - \'["stefenon", "viniabussafi"]\') }}' + file_format = 'delta' ) }} diff --git a/models/_project/balancer/liquidity/zkevm/_schema.yml b/models/_project/balancer/liquidity/zkevm/_schema.yml new file mode 100644 index 00000000000..67f36eb3b21 --- /dev/null +++ b/models/_project/balancer/liquidity/zkevm/_schema.yml @@ -0,0 +1,58 @@ +version: 2 + +models: + - name: balancer_v2_zkevm_liquidity + meta: + blockchain: zkevm + project: balancer_v2 + contributors: victorstefenon, viniabussafi, thetroyharris + config: + tags: ['zkevm', 'balancer', 'pools', 'liquidity'] + description: > + Balancer v2 pools liquidity by token in Arbitrum. + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - day + - pool_id + - token_address + columns: + - &day + name: day + description: "Block date in UTC" + - &pool_id + name: pool_id + description: "Unique encoded identifier that refers to each pool" + - &pool_address + name: pool_address + description: "Pool address" + - &pool_symbol + name: pool_symbol + description: "Token symbols, followed by their respective weights, if applicable" + - &version + name: version + description: "Version of the project" + - &blockchain + name: blockchain + description: "Blockchain" + - &pool_type + name: pool_type + description: "Pool attributes, determined by the pool's factory" + - &token_address + name: token_address + description: "Contract address of the token" + - &token_symbol + name: token_symbol + description: "Token symbol" + - name: token_balance_raw + description: 'Raw balance of the token in the pool in the original currency' + - name: token_balance + description: 'Scaled balance of the token in the pool in the original currency' + - name: protocol_liquidity_usd + description: 'Liquidity of the token in the pool in USD, except BPTs' + - name: protocol_liquidity_eth + description: 'Liquidity of the token in the pool in ETH, except BPTs' + - name: pool_liquidity_usd + description: 'Liquidity of the token in the pool in USD, including BPTs' + - name: pool_liquidity_eth + description: 'Liquidity of the token in the pool in ETH, including BPTs' \ No newline at end of file diff --git a/models/balancer/zkevm/balancer_v2_zkevm_liquidity.sql b/models/_project/balancer/liquidity/zkevm/balancer_v2_zkevm_liquidity.sql similarity index 51% rename from models/balancer/zkevm/balancer_v2_zkevm_liquidity.sql rename to models/_project/balancer/liquidity/zkevm/balancer_v2_zkevm_liquidity.sql index f3fd420bb39..737b858ca3c 100644 --- a/models/balancer/zkevm/balancer_v2_zkevm_liquidity.sql +++ b/models/_project/balancer/liquidity/zkevm/balancer_v2_zkevm_liquidity.sql @@ -6,11 +6,7 @@ schema = 'balancer_v2_zkevm', alias = 'liquidity', materialized = 'table', - file_format = 'delta', - post_hook="{{ expose_spells('[\"" + blockchain + '"]' + '\', - "project", - "balancer_v2", - \'["stefenon", "viniabussafi"]\') }}' + file_format = 'delta' ) }} diff --git a/models/_project/balancer/pools/_schema.yml b/models/_project/balancer/pools/_schema.yml new file mode 100644 index 00000000000..65c86555a7c --- /dev/null +++ b/models/_project/balancer/pools/_schema.yml @@ -0,0 +1,173 @@ +version: 2 + +models: + - name: balancer_pools_fees + meta: + blockchain: arbitrum, avalanche_c, base, ethereum, gnosis, optimism, polygon, zkevm + contributors: jacektrocinski, thetroyharris, viniabussafi + config: + tags: ['arbitrum', 'avalanche_c', 'base', 'ethereum', 'gnosis', 'optimism', 'polygon', 'zkevm', 'pools', 'fees'] + description: > + Balancer v2 swap fees stored at the pool level. + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - blockchain + - block_number + - tx_hash + - index + columns: + - &blockchain + name: blockchain + description: "Blockchain" + - &version + name: version + description: "Version of Balancer where the liquidity pool used in transaction is deployed" + - &contract_address + name: contract_address + description: 'zkevm address for the liquidity pool used in transaction' + tests: + - not_null + - &tx_hash + name: tx_hash + description: 'Transaction hash' + tests: + - not_null + - &index + name: index + description: 'Event Index' + tests: + - not_null + - &tx_index + name: tx_index + description: 'Transaction Index' + tests: + - not_null + - &block_time + name: block_time + description: 'Block time in UTC' + tests: + - not_null + - &block_number + name: block_number + description: 'Event Block Number' + tests: + - not_null + - &swap_fee_percentage + name: swap_fee_percentage + description: 'Swap fees for the pool, values are returned with 18 decimals (1e18 meaning 100%)' + tests: + - not_null + + - name: balancer_pools_tokens_weights + meta: + blockchain: arbitrum, avalanche_c, base, ethereum, gnosis, optimism, polygon, 'zkevm' + contributors: jacektrocinski, viniabussafi + config: + tags: ['arbitrum', 'avalanche_c', 'base', 'ethereum', 'gnosis', 'optimism', 'polygon', 'zkevm', 'bpt', 'transfers'] + description: > + Token weights in Balancer pools. + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - blockchain + - pool_id + - token_address + columns: + - *blockchain + - *version + - &pool_id + name: pool_id + description: 'Unique encoded identifier that refers to each pool' + tests: + - not_null + - &token_address + name: token_address + description: 'Contract address for the token' + - &normalized_weight + name: normalized_weight + description: 'Weight of the token in the pool.' + + + - name: balancer_pools_metrics_daily + meta: + blockchain: arbitrum, avalanche_c, base, ethereum, gnosis, optimism, polygon, zkevm + contributors: viniabussafi, metacrypto + config: + tags: ['arbitrum', 'avalanche_c', 'base', 'ethereum', 'gnosis', 'optimism', 'polygon', 'zkevm', 'balancer', 'pool', 'stats', 'volume', 'tvl', 'fee'] + description: > + This spell aggregates data from the trades, liquidity and protocol fees spells, by day and pool, while also displaying some basic information about the pool + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - block_date + - blockchain + - project + - version + - project_contract_address + columns: + - *blockchain + - &project + name: project + description: "Project name (balancer)" + - *version + - &block_date + name: block_date + description: "Block date in UTC" + - &project_contract_address + name: project_contract_address + description: "Pool address" + - &pool_symbol + name: pool_symbol + description: "Token symbols, followed by their respective weights, if applicable" + - &pool_type + name: pool_type + description: "Pool attributes, determined by the pool's factory" + - &swap_amount_usd + name: swap_amount_usd + description: "Daily swap volume on a pool, in USD" + - &tvl_usd + name: tvl_usd + description: "Total Value Locked on a pool, in USD" + - &tvl_eth + name: tvl_eth + description: "Total Value Locked on a pool, in eth" + - &fee_amount_usd + name: fee_amount_usd + description: "Daily fees collected on a pool, in USD" + + - name: balancer_gauge_mappings + meta: + blockchain: optimism + sector: dex + contributors: msilb7 + config: + tags: ['balancer', 'amm', 'trades', 'dex', 'incentives'] + description: > + Gauge to Pool mappings for balancer on all chains + columns: + - *blockchain + - *version + - &pool_contract + name: pool_contract + description: "Address of the liquidity pool contract" + - *pool_id + - &incentives_contract + name: incentives_contract + description: "Address of the contract where incentives are stored and emitted." + - &incentives_type + name: incentives_type + description: "Description of the incentives address type." + - &evt_block_time + name: evt_block_time + description: "Block time in UTC" + - &evt_block_number + name: evt_block_number + description: 'Event Block Number' + - *contract_address + - &evt_tx_hash + name: evt_tx_hash + description: 'Transaction hash' + - &evt_index + name: evT_index + description: 'Event Index' \ No newline at end of file diff --git a/models/_project/balancer/pools/arbitrum/_schema.yml b/models/_project/balancer/pools/arbitrum/_schema.yml new file mode 100644 index 00000000000..fd04cb90077 --- /dev/null +++ b/models/_project/balancer/pools/arbitrum/_schema.yml @@ -0,0 +1,105 @@ +version: 2 + +models: + - name: balancer_v2_arbitrum_pools_fees + meta: + blockchain: arbitrum + project: balancer_v2 + contributors: jacektrocinski, thetroyharris, viniabussafi + config: + tags: ['arbitrum', 'balancer', 'pools_fees'] + description: > + Balancer v2 swap fees stored at the pool level. + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - block_number + - tx_hash + - index + columns: + - &blockchain + name: blockchain + description: "Blockchain" + - &version + name: version + description: "Version of Balancer where the liquidity pool used in transaction is deployed" + - &contract_address + name: contract_address + description: 'Arbitrum address for the liquidity pool used in transaction' + tests: + - not_null + - &tx_hash + name: tx_hash + description: 'Transaction hash' + tests: + - not_null + - &index + name: index + description: 'Event Index' + tests: + - not_null + - &tx_index + name: tx_index + description: 'Transaction Index' + tests: + - not_null + - &block_time + name: block_time + description: 'Block time in UTC' + tests: + - not_null + - &block_number + name: block_number + description: 'Event Block Number' + tests: + - not_null + - &swap_fee_percentage + name: swap_fee_percentage + description: 'Swap fees for the pool, values are returned with 18 decimals (1e18 meaning 100%)' + tests: + - not_null + + - name: balancer_arbitrum_pools_tokens_weights + meta: + blockchain: arbitrum + project: balancer + contributors: jacektrocinski, viniabussafi + config: + tags: ['arbitrum', 'balancer', 'pools', 'tokens', 'weights'] + description: > + Token weights in Balancer pools. + columns: + - *blockchain + - *version + - &pool_id + name: pool_id + description: 'Unique encoded identifier that refers to each pool' + tests: + - not_null + - &token_address + name: token_address + description: 'Contract address for the token' + - &normalized_weight + name: normalized_weight + description: 'Weight of the token in the pool.' + + - name: balancer_v2_arbitrum_pools_tokens_weights + meta: + blockchain: arbitrum + project: balancer + contributors: jacektrocinski, viniabussafi + config: + tags: ['arbitrum', 'balancer', 'pools', 'tokens', 'weights'] + description: > + Token weights in Balancer v2 pools. + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - pool_id + - token_address + columns: + - *blockchain + - *version + - *pool_id + - *token_address + - *normalized_weight \ No newline at end of file diff --git a/models/balancer/arbitrum/balancer_arbitrum_pools_tokens_weights.sql b/models/_project/balancer/pools/arbitrum/balancer_arbitrum_pools_tokens_weights.sql similarity index 100% rename from models/balancer/arbitrum/balancer_arbitrum_pools_tokens_weights.sql rename to models/_project/balancer/pools/arbitrum/balancer_arbitrum_pools_tokens_weights.sql diff --git a/models/balancer/arbitrum/balancer_v2_arbitrum_pools_fees.sql b/models/_project/balancer/pools/arbitrum/balancer_v2_arbitrum_pools_fees.sql similarity index 75% rename from models/balancer/arbitrum/balancer_v2_arbitrum_pools_fees.sql rename to models/_project/balancer/pools/arbitrum/balancer_v2_arbitrum_pools_fees.sql index 105650c0b9b..39b5671f202 100644 --- a/models/balancer/arbitrum/balancer_v2_arbitrum_pools_fees.sql +++ b/models/_project/balancer/pools/arbitrum/balancer_v2_arbitrum_pools_fees.sql @@ -1,17 +1,12 @@ {{ config( - schema = 'balancer_v2_arbitrum', - + schema = 'balancer_v2_arbitrum', alias = 'pools_fees', materialized = 'incremental', file_format = 'delta', incremental_strategy = 'merge', - unique_key = ['block_number', 'tx_hash', 'index'], - post_hook='{{ expose_spells(\'["arbitrum"]\', - "project", - "balancer_v2", - \'["metacrypto", "jacektrocinski", "thetroyharris", "viniabussafi"]\') }}' - )  + unique_key = ['block_number', 'tx_hash', 'index'] + ) }} {% set event_signature = '0xa9ba3ffe0b6c366b81232caab38605a0699ad5398d6cce76f91ee809e322dafc' %} diff --git a/models/balancer/arbitrum/balancer_v2_arbitrum_pools_tokens_weights.sql b/models/_project/balancer/pools/arbitrum/balancer_v2_arbitrum_pools_tokens_weights.sql similarity index 99% rename from models/balancer/arbitrum/balancer_v2_arbitrum_pools_tokens_weights.sql rename to models/_project/balancer/pools/arbitrum/balancer_v2_arbitrum_pools_tokens_weights.sql index 16ee7481c9b..ae20e0126b1 100644 --- a/models/balancer/arbitrum/balancer_v2_arbitrum_pools_tokens_weights.sql +++ b/models/_project/balancer/pools/arbitrum/balancer_v2_arbitrum_pools_tokens_weights.sql @@ -2,7 +2,6 @@ config( schema='balancer_v2_arbitrum', alias = 'pools_tokens_weights', - materialized = 'incremental', file_format = 'delta', incremental_strategy = 'merge', diff --git a/models/_project/balancer/pools/avalanche_c/_schema.yml b/models/_project/balancer/pools/avalanche_c/_schema.yml new file mode 100644 index 00000000000..2c5082a751c --- /dev/null +++ b/models/_project/balancer/pools/avalanche_c/_schema.yml @@ -0,0 +1,105 @@ +version: 2 + +models: + - name: balancer_v2_avalanche_c_pools_fees + meta: + blockchain: avalanche_c + project: balancer_v2 + contributors: jacektrocinski, thetroyharris, viniabussafi + config: + tags: ['avalanche_c', 'balancer', 'pools_fees'] + description: > + Balancer v2 swap fees stored at the pool level. + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - block_number + - tx_hash + - index + columns: + - &blockchain + name: blockchain + description: "Blockchain" + - &version + name: version + description: "Version of Balancer where the liquidity pool used in transaction is deployed" + - &contract_address + name: contract_address + description: 'avalanche_c address for the liquidity pool used in transaction' + tests: + - not_null + - &tx_hash + name: tx_hash + description: 'Transaction hash' + tests: + - not_null + - &index + name: index + description: 'Event Index' + tests: + - not_null + - &tx_index + name: tx_index + description: 'Transaction Index' + tests: + - not_null + - &block_time + name: block_time + description: 'Block time in UTC' + tests: + - not_null + - &block_number + name: block_number + description: 'Event Block Number' + tests: + - not_null + - &swap_fee_percentage + name: swap_fee_percentage + description: 'Swap fees for the pool, values are returned with 18 decimals (1e18 meaning 100%)' + tests: + - not_null + + - name: balancer_avalanche_c_pools_tokens_weights + meta: + blockchain: avalanche_c + project: balancer + contributors: jacektrocinski, viniabussafi + config: + tags: ['avalanche_c', 'balancer', 'pools', 'tokens', 'weights'] + description: > + Token weights in Balancer pools. + columns: + - *blockchain + - *version + - &pool_id + name: pool_id + description: 'Unique encoded identifier that refers to each pool' + tests: + - not_null + - &token_address + name: token_address + description: 'Contract address for the token' + - &normalized_weight + name: normalized_weight + description: 'Weight of the token in the pool.' + + - name: balancer_v2_avalanche_c_pools_tokens_weights + meta: + blockchain: avalanche_c + project: balancer + contributors: jacektrocinski, viniabussafi + config: + tags: ['avalanche_c', 'balancer', 'pools', 'tokens', 'weights'] + description: > + Token weights in Balancer v2 pools. + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - pool_id + - token_address + columns: + - *blockchain + - *version + - *pool_id + - *token_address + - *normalized_weight \ No newline at end of file diff --git a/models/balancer/avalanche_c/balancer_avalanche_c_pools_tokens_weights.sql b/models/_project/balancer/pools/avalanche_c/balancer_avalanche_c_pools_tokens_weights.sql similarity index 100% rename from models/balancer/avalanche_c/balancer_avalanche_c_pools_tokens_weights.sql rename to models/_project/balancer/pools/avalanche_c/balancer_avalanche_c_pools_tokens_weights.sql diff --git a/models/balancer/avalanche_c/balancer_v2_avalanche_c_pools_fees.sql b/models/_project/balancer/pools/avalanche_c/balancer_v2_avalanche_c_pools_fees.sql similarity index 77% rename from models/balancer/avalanche_c/balancer_v2_avalanche_c_pools_fees.sql rename to models/_project/balancer/pools/avalanche_c/balancer_v2_avalanche_c_pools_fees.sql index 1b52e13c114..e3aae2cdf1a 100644 --- a/models/balancer/avalanche_c/balancer_v2_avalanche_c_pools_fees.sql +++ b/models/_project/balancer/pools/avalanche_c/balancer_v2_avalanche_c_pools_fees.sql @@ -1,17 +1,12 @@ {{ config( schema = 'balancer_v2_avalanche_c', - alias = 'pools_fees', materialized = 'incremental', file_format = 'delta', incremental_strategy = 'merge', - unique_key = ['block_number', 'tx_hash', 'index'], - post_hook='{{ expose_spells(\'["avalanche_c"]\', - "project", - "balancer_v2", - \'["metacrypto", "jacektrocinski", "thetroyharris", "viniabussafi"]\') }}' - )  + unique_key = ['block_number', 'tx_hash', 'index'] + ) }} {% set event_signature = '0xa9ba3ffe0b6c366b81232caab38605a0699ad5398d6cce76f91ee809e322dafc' %} diff --git a/models/balancer/avalanche_c/balancer_v2_avalanche_c_pools_tokens_weights.sql b/models/_project/balancer/pools/avalanche_c/balancer_v2_avalanche_c_pools_tokens_weights.sql similarity index 99% rename from models/balancer/avalanche_c/balancer_v2_avalanche_c_pools_tokens_weights.sql rename to models/_project/balancer/pools/avalanche_c/balancer_v2_avalanche_c_pools_tokens_weights.sql index 730b6b327f5..48bbb28e693 100644 --- a/models/balancer/avalanche_c/balancer_v2_avalanche_c_pools_tokens_weights.sql +++ b/models/_project/balancer/pools/avalanche_c/balancer_v2_avalanche_c_pools_tokens_weights.sql @@ -2,7 +2,6 @@ config( schema='balancer_v2_avalanche_c', alias = 'pools_tokens_weights', - materialized = 'incremental', file_format = 'delta', incremental_strategy = 'merge', diff --git a/models/balancer/balancer_gauge_mappings.sql b/models/_project/balancer/pools/balancer_gauge_mappings.sql similarity index 78% rename from models/balancer/balancer_gauge_mappings.sql rename to models/_project/balancer/pools/balancer_gauge_mappings.sql index b764f659dde..0ad73a0a700 100644 --- a/models/balancer/balancer_gauge_mappings.sql +++ b/models/_project/balancer/pools/balancer_gauge_mappings.sql @@ -1,11 +1,10 @@ {{ config( schema = 'balancer', - alias = 'gauge_mappings', post_hook='{{ expose_spells(\'["optimism"]\', - "project", - "balancer", - \'["msilb7"]\') }}' + spell_type = "project", + spell_name = "balancer", + contributors = \'["msilb7"]\') }}' ) }} diff --git a/models/balancer/balancer_pools_fees.sql b/models/_project/balancer/pools/balancer_pools_fees.sql similarity index 69% rename from models/balancer/balancer_pools_fees.sql rename to models/_project/balancer/pools/balancer_pools_fees.sql index e638f381024..2a54b518ec1 100644 --- a/models/balancer/balancer_pools_fees.sql +++ b/models/_project/balancer/pools/balancer_pools_fees.sql @@ -1,11 +1,10 @@ {{ config( schema = 'balancer', - alias = 'pools_fees', - post_hook='{{ expose_spells(\'["arbitrum", "avalanche_c", "base", "ethereum", "gnosis", "optimism", "polygon", "zkevm"]\', - "project", - "balancer", - \'["thetroyharris", "viniabussafi"]\') }}' + post_hook='{{ expose_spells(blockchains = \'["arbitrum", "avalanche_c", "base", "ethereum", "gnosis", "optimism", "polygon", "zkevm"]\', + spell_type = "project", + spell_name = "balancer", + contributors = \'["thetroyharris", "viniabussafi"]\') }}' ) }} diff --git a/models/balancer/balancer_pools_metrics_daily.sql b/models/_project/balancer/pools/balancer_pools_metrics_daily.sql similarity index 100% rename from models/balancer/balancer_pools_metrics_daily.sql rename to models/_project/balancer/pools/balancer_pools_metrics_daily.sql diff --git a/models/balancer/balancer_pools_tokens_weights.sql b/models/_project/balancer/pools/balancer_pools_tokens_weights.sql similarity index 71% rename from models/balancer/balancer_pools_tokens_weights.sql rename to models/_project/balancer/pools/balancer_pools_tokens_weights.sql index 95a71d1c294..d2e50c49ce9 100644 --- a/models/balancer/balancer_pools_tokens_weights.sql +++ b/models/_project/balancer/pools/balancer_pools_tokens_weights.sql @@ -1,10 +1,10 @@ {{ config( schema = 'balancer', alias = 'pools_tokens_weights', - post_hook='{{ expose_spells(\'["arbitrum", "avalanche_c", "base", "ethereum", "gnosis", "optimism", "polygon"]\', - "project", - "balancer", - \'["viniabussafi"]\') }}' + post_hook='{{ expose_spells(blockchains = \'["arbitrum", "avalanche_c", "base", "ethereum", "gnosis", "optimism", "polygon", "zkevm"]\', + spell_type = "project", + spell_name = "balancer", + contributors = \'["viniabussafi"]\') }}' ) }} diff --git a/models/_project/balancer/pools/base/_schema.yml b/models/_project/balancer/pools/base/_schema.yml new file mode 100644 index 00000000000..0949d82f17c --- /dev/null +++ b/models/_project/balancer/pools/base/_schema.yml @@ -0,0 +1,105 @@ +version: 2 + +models: + - name: balancer_v2_base_pools_fees + meta: + blockchain: base + project: balancer_v2 + contributors: jacektrocinski, thetroyharris, viniabussafi + config: + tags: ['base', 'balancer', 'pools_fees'] + description: > + Balancer v2 swap fees stored at the pool level. + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - block_number + - tx_hash + - index + columns: + - &blockchain + name: blockchain + description: "Blockchain" + - &version + name: version + description: "Version of Balancer where the liquidity pool used in transaction is deployed" + - &contract_address + name: contract_address + description: 'base address for the liquidity pool used in transaction' + tests: + - not_null + - &tx_hash + name: tx_hash + description: 'Transaction hash' + tests: + - not_null + - &index + name: index + description: 'Event Index' + tests: + - not_null + - &tx_index + name: tx_index + description: 'Transaction Index' + tests: + - not_null + - &block_time + name: block_time + description: 'Block time in UTC' + tests: + - not_null + - &block_number + name: block_number + description: 'Event Block Number' + tests: + - not_null + - &swap_fee_percentage + name: swap_fee_percentage + description: 'Swap fees for the pool, values are returned with 18 decimals (1e18 meaning 100%)' + tests: + - not_null + + - name: balancer_base_pools_tokens_weights + meta: + blockchain: base + project: balancer + contributors: jacektrocinski, viniabussafi + config: + tags: ['base', 'balancer', 'pools', 'tokens', 'weights'] + description: > + Token weights in Balancer pools. + columns: + - *blockchain + - *version + - &pool_id + name: pool_id + description: 'Unique encoded identifier that refers to each pool' + tests: + - not_null + - &token_address + name: token_address + description: 'Contract address for the token' + - &normalized_weight + name: normalized_weight + description: 'Weight of the token in the pool.' + + - name: balancer_v2_base_pools_tokens_weights + meta: + blockchain: base + project: balancer + contributors: jacektrocinski, viniabussafi + config: + tags: ['base', 'balancer', 'pools', 'tokens', 'weights'] + description: > + Token weights in Balancer v2 pools. + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - pool_id + - token_address + columns: + - *blockchain + - *version + - *pool_id + - *token_address + - *normalized_weight \ No newline at end of file diff --git a/models/balancer/base/balancer_base_pools_tokens_weights.sql b/models/_project/balancer/pools/base/balancer_base_pools_tokens_weights.sql similarity index 100% rename from models/balancer/base/balancer_base_pools_tokens_weights.sql rename to models/_project/balancer/pools/base/balancer_base_pools_tokens_weights.sql diff --git a/models/balancer/base/balancer_v2_base_pools_fees.sql b/models/_project/balancer/pools/base/balancer_v2_base_pools_fees.sql similarity index 77% rename from models/balancer/base/balancer_v2_base_pools_fees.sql rename to models/_project/balancer/pools/base/balancer_v2_base_pools_fees.sql index 7aaf2ef8939..c4029cb33d6 100644 --- a/models/balancer/base/balancer_v2_base_pools_fees.sql +++ b/models/_project/balancer/pools/base/balancer_v2_base_pools_fees.sql @@ -1,17 +1,12 @@ {{ config( schema = 'balancer_v2_base', - alias = 'pools_fees', materialized = 'incremental', file_format = 'delta', incremental_strategy = 'merge', - unique_key = ['block_number', 'tx_hash', 'index'], - post_hook='{{ expose_spells(\'["base"]\', - "project", - "balancer_v2", - \'["metacrypto", "jacektrocinski", "thetroyharris", "viniabussafi"]\') }}' - )  + unique_key = ['block_number', 'tx_hash', 'index'] + ) }} {% set event_signature = '0xa9ba3ffe0b6c366b81232caab38605a0699ad5398d6cce76f91ee809e322dafc' %} diff --git a/models/balancer/base/balancer_v2_base_pools_tokens_weights.sql b/models/_project/balancer/pools/base/balancer_v2_base_pools_tokens_weights.sql similarity index 99% rename from models/balancer/base/balancer_v2_base_pools_tokens_weights.sql rename to models/_project/balancer/pools/base/balancer_v2_base_pools_tokens_weights.sql index 29086428514..531e3214489 100644 --- a/models/balancer/base/balancer_v2_base_pools_tokens_weights.sql +++ b/models/_project/balancer/pools/base/balancer_v2_base_pools_tokens_weights.sql @@ -2,7 +2,6 @@ config( schema='balancer_v2_base', alias = 'pools_tokens_weights', - materialized = 'incremental', file_format = 'delta', incremental_strategy = 'merge', diff --git a/models/_project/balancer/pools/ethereum/_schema.yml b/models/_project/balancer/pools/ethereum/_schema.yml new file mode 100644 index 00000000000..ea4a24ef8c8 --- /dev/null +++ b/models/_project/balancer/pools/ethereum/_schema.yml @@ -0,0 +1,149 @@ +version: 2 + +models: + - name: balancer_v2_ethereum_pools_fees + meta: + blockchain: ethereum + project: balancer_v2 + contributors: jacektrocinski, thetroyharris, viniabussafi + config: + tags: ['ethereum', 'balancer', 'pools', 'fees'] + description: > + Balancer v2 swap fees stored at the pool level. + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - block_number + - tx_hash + - index + columns: + - &blockchain + name: blockchain + description: "Blockchain" + - &version + name: version + description: "Version of Balancer where the liquidity pool used in transaction is deployed" + - &contract_address + name: contract_address + description: 'zkevm address for the liquidity pool used in transaction' + tests: + - not_null + - &tx_hash + name: tx_hash + description: 'Transaction hash' + tests: + - not_null + - &index + name: index + description: 'Event Index' + tests: + - not_null + - &tx_index + name: tx_index + description: 'Transaction Index' + tests: + - not_null + - &block_time + name: block_time + description: 'Block time in UTC' + tests: + - not_null + - &block_number + name: block_number + description: 'Event Block Number' + tests: + - not_null + - &swap_fee_percentage + name: swap_fee_percentage + description: 'Swap fees for the pool, values are returned with 18 decimals (1e18 meaning 100%)' + tests: + - not_null + + - name: balancer_ethereum_pools_tokens_weights + meta: + blockchain: ethereum + project: balancer + contributors: jacektrocinski, viniabussafi + config: + tags: ['ethereum', 'balancer', 'pools', 'tokens', 'weights'] + description: > + Token weights in Balancer pools. + columns: + - *blockchain + - *version + - &pool_id + name: pool_id + description: 'Unique encoded identifier that refers to each pool' + tests: + - not_null + - &token_address + name: token_address + description: 'Contract address for the token' + - &normalized_weight + name: normalized_weight + description: 'Weight of the token in the pool.' + + - name: balancer_v1_ethereum_pools_tokens_weights + meta: + blockchain: ethereum + project: balancer + contributors: jacektrocinski, viniabussafi + config: + tags: ['ethereum', 'balancer', 'pools', 'tokens', 'weights'] + description: > + Token weights in Balancer v1 pools. + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - pool_id + - token_address + columns: + - *blockchain + - *version + - *pool_id + - *token_address + - *normalized_weight + + - name: balancer_v2_ethereum_pools_tokens_weights + meta: + blockchain: ethereum + project: balancer + contributors: jacektrocinski, viniabussafi + config: + tags: ['ethereum', 'balancer', 'pools', 'tokens', 'weights'] + description: > + Token weights in Balancer v2 pools. + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - pool_id + - token_address + columns: + - *blockchain + - *version + - *pool_id + - *token_address + - *normalized_weight + + - name: balancer_v2_ethereum_lbps + meta: + blockchain: ethereum + project: balancer_v2 + contributors: stefenon + config: + tags: ['ethereum', 'balancer', 'lbp'] + description: > + Record of the Liquidity Boostrapping Pools (LBP) of Balancer, an automated portfolio manager and trading platform, on Ethereum. + columns: + - name: name + description: "Name of the LBP" + - name: pool_id + description: "ID of the LBP" + - name: token_sold + description: "Contract address of the token sold by the LBP" + - name: token_symbol + description: "Symbol of the token sold by the LBP" + - name: start_time + description: "LBP start time" + - name: end_time + description: "LBP end time" \ No newline at end of file diff --git a/models/balancer/ethereum/balancer_ethereum_pools_tokens_weights.sql b/models/_project/balancer/pools/ethereum/balancer_ethereum_pools_tokens_weights.sql similarity index 100% rename from models/balancer/ethereum/balancer_ethereum_pools_tokens_weights.sql rename to models/_project/balancer/pools/ethereum/balancer_ethereum_pools_tokens_weights.sql diff --git a/models/balancer/ethereum/balancer_v1_ethereum_pools_tokens_weights.sql b/models/_project/balancer/pools/ethereum/balancer_v1_ethereum_pools_tokens_weights.sql similarity index 93% rename from models/balancer/ethereum/balancer_v1_ethereum_pools_tokens_weights.sql rename to models/_project/balancer/pools/ethereum/balancer_v1_ethereum_pools_tokens_weights.sql index 01b031110e7..eb0bd2626f6 100644 --- a/models/balancer/ethereum/balancer_v1_ethereum_pools_tokens_weights.sql +++ b/models/_project/balancer/pools/ethereum/balancer_v1_ethereum_pools_tokens_weights.sql @@ -2,15 +2,10 @@ config( schema='balancer_v1_ethereum', alias = 'pools_tokens_weights', - materialized = 'incremental', file_format = 'delta', incremental_strategy = 'merge', - unique_key = ['pool_id', 'token_address'], - post_hook='{{ expose_spells(\'["ethereum"]\', - "project", - "balancer_v1", - \'["metacrypto", "jacektrocinski"]\') }}' + unique_key = ['pool_id', 'token_address'] ) }} diff --git a/models/balancer/ethereum/balancer_v2_ethereum_lbps.sql b/models/_project/balancer/pools/ethereum/balancer_v2_ethereum_lbps.sql similarity index 100% rename from models/balancer/ethereum/balancer_v2_ethereum_lbps.sql rename to models/_project/balancer/pools/ethereum/balancer_v2_ethereum_lbps.sql diff --git a/models/balancer/ethereum/balancer_v2_ethereum_pools_fees.sql b/models/_project/balancer/pools/ethereum/balancer_v2_ethereum_pools_fees.sql similarity index 78% rename from models/balancer/ethereum/balancer_v2_ethereum_pools_fees.sql rename to models/_project/balancer/pools/ethereum/balancer_v2_ethereum_pools_fees.sql index 08bee4948e9..8e6041c0a42 100644 --- a/models/balancer/ethereum/balancer_v2_ethereum_pools_fees.sql +++ b/models/_project/balancer/pools/ethereum/balancer_v2_ethereum_pools_fees.sql @@ -1,16 +1,11 @@ {{ config( schema = 'balancer_v2_ethereum', - alias = 'pools_fees', materialized = 'incremental', file_format = 'delta', incremental_strategy = 'merge', - unique_key = ['block_number', 'tx_hash', 'index'], - post_hook='{{ expose_spells(\'["ethereum"]\', - "project", - "balancer_v2", - \'["metacrypto", "jacektrocinski", "thetroyharris", "viniabussafi"]\') }}' + unique_key = ['block_number', 'tx_hash', 'index'] )  }} diff --git a/models/balancer/ethereum/balancer_v2_ethereum_pools_tokens_weights.sql b/models/_project/balancer/pools/ethereum/balancer_v2_ethereum_pools_tokens_weights.sql similarity index 99% rename from models/balancer/ethereum/balancer_v2_ethereum_pools_tokens_weights.sql rename to models/_project/balancer/pools/ethereum/balancer_v2_ethereum_pools_tokens_weights.sql index fd0cfd29bb6..3fe74c18771 100644 --- a/models/balancer/ethereum/balancer_v2_ethereum_pools_tokens_weights.sql +++ b/models/_project/balancer/pools/ethereum/balancer_v2_ethereum_pools_tokens_weights.sql @@ -2,7 +2,6 @@ config( schema='balancer_v2_ethereum', alias = 'pools_tokens_weights', - materialized = 'incremental', file_format = 'delta', incremental_strategy = 'merge', diff --git a/models/_project/balancer/pools/gnosis/_schema.yml b/models/_project/balancer/pools/gnosis/_schema.yml new file mode 100644 index 00000000000..ac61b0140a4 --- /dev/null +++ b/models/_project/balancer/pools/gnosis/_schema.yml @@ -0,0 +1,105 @@ +version: 2 + +models: + - name: balancer_v2_gnosis_pools_fees + meta: + blockchain: gnosis + project: balancer_v2 + contributors: jacektrocinski, thetroyharris, viniabussafi + config: + tags: ['gnosis', 'balancer', 'pools_fees'] + description: > + Balancer v2 swap fees stored at the pool level. + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - block_number + - tx_hash + - index + columns: + - &blockchain + name: blockchain + description: "Blockchain" + - &version + name: version + description: "Version of Balancer where the liquidity pool used in transaction is deployed" + - &contract_address + name: contract_address + description: 'gnosis address for the liquidity pool used in transaction' + tests: + - not_null + - &tx_hash + name: tx_hash + description: 'Transaction hash' + tests: + - not_null + - &index + name: index + description: 'Event Index' + tests: + - not_null + - &tx_index + name: tx_index + description: 'Transaction Index' + tests: + - not_null + - &block_time + name: block_time + description: 'Block time in UTC' + tests: + - not_null + - &block_number + name: block_number + description: 'Event Block Number' + tests: + - not_null + - &swap_fee_percentage + name: swap_fee_percentage + description: 'Swap fees for the pool, values are returned with 18 decimals (1e18 meaning 100%)' + tests: + - not_null + + - name: balancer_gnosis_pools_tokens_weights + meta: + blockchain: gnosis + project: balancer + contributors: jacektrocinski, viniabussafi + config: + tags: ['gnosis', 'balancer', 'pools', 'tokens', 'weights'] + description: > + Token weights in Balancer pools. + columns: + - *blockchain + - *version + - &pool_id + name: pool_id + description: 'Unique encoded identifier that refers to each pool' + tests: + - not_null + - &token_address + name: token_address + description: 'Contract address for the token' + - &normalized_weight + name: normalized_weight + description: 'Weight of the token in the pool.' + + - name: balancer_v2_gnosis_pools_tokens_weights + meta: + blockchain: gnosis + project: balancer + contributors: jacektrocinski, viniabussafi + config: + tags: ['gnosis', 'balancer', 'pools', 'tokens', 'weights'] + description: > + Token weights in Balancer v2 pools. + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - pool_id + - token_address + columns: + - *blockchain + - *version + - *pool_id + - *token_address + - *normalized_weight \ No newline at end of file diff --git a/models/balancer/gnosis/balancer_gnosis_pools_tokens_weights.sql b/models/_project/balancer/pools/gnosis/balancer_gnosis_pools_tokens_weights.sql similarity index 100% rename from models/balancer/gnosis/balancer_gnosis_pools_tokens_weights.sql rename to models/_project/balancer/pools/gnosis/balancer_gnosis_pools_tokens_weights.sql diff --git a/models/balancer/gnosis/balancer_v2_gnosis_pools_fees.sql b/models/_project/balancer/pools/gnosis/balancer_v2_gnosis_pools_fees.sql similarity index 77% rename from models/balancer/gnosis/balancer_v2_gnosis_pools_fees.sql rename to models/_project/balancer/pools/gnosis/balancer_v2_gnosis_pools_fees.sql index de1a7618af6..086072fc70b 100644 --- a/models/balancer/gnosis/balancer_v2_gnosis_pools_fees.sql +++ b/models/_project/balancer/pools/gnosis/balancer_v2_gnosis_pools_fees.sql @@ -1,17 +1,12 @@ {{ config( schema = 'balancer_v2_gnosis', - alias = 'pools_fees', materialized = 'incremental', file_format = 'delta', incremental_strategy = 'merge', - unique_key = ['block_number', 'tx_hash', 'index'], - post_hook='{{ expose_spells(\'["gnosis"]\', - "project", - "balancer_v2", - \'["metacrypto", "jacektrocinski", "thetroyharris", "viniabussafi"]\') }}' - )  + unique_key = ['block_number', 'tx_hash', 'index'] + ) }} {% set event_signature = '0xa9ba3ffe0b6c366b81232caab38605a0699ad5398d6cce76f91ee809e322dafc' %} diff --git a/models/balancer/gnosis/balancer_v2_gnosis_pools_tokens_weights.sql b/models/_project/balancer/pools/gnosis/balancer_v2_gnosis_pools_tokens_weights.sql similarity index 99% rename from models/balancer/gnosis/balancer_v2_gnosis_pools_tokens_weights.sql rename to models/_project/balancer/pools/gnosis/balancer_v2_gnosis_pools_tokens_weights.sql index ee2bef6e0a7..a4b0a7688a8 100644 --- a/models/balancer/gnosis/balancer_v2_gnosis_pools_tokens_weights.sql +++ b/models/_project/balancer/pools/gnosis/balancer_v2_gnosis_pools_tokens_weights.sql @@ -2,7 +2,6 @@ config( schema='balancer_v2_gnosis', alias = 'pools_tokens_weights', - materialized = 'incremental', file_format = 'delta', incremental_strategy = 'merge', diff --git a/models/_project/balancer/pools/optimism/_schema.yml b/models/_project/balancer/pools/optimism/_schema.yml new file mode 100644 index 00000000000..289820cd3bc --- /dev/null +++ b/models/_project/balancer/pools/optimism/_schema.yml @@ -0,0 +1,146 @@ +version: 2 + +models: + - name: balancer_v2_optimism_pools_fees + meta: + blockchain: optimism + project: balancer_v2 + contributors: jacektrocinski, thetroyharris, viniabussafi + config: + tags: ['optimism', 'balancer', 'pools_fees'] + description: > + Balancer v2 swap fees stored at the pool level. + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - block_number + - tx_hash + - index + columns: + - &blockchain + name: blockchain + description: "Blockchain" + - &version + name: version + description: "Version of Balancer where the liquidity pool used in transaction is deployed" + - &contract_address + name: contract_address + description: 'optimism address for the liquidity pool used in transaction' + tests: + - not_null + - &tx_hash + name: tx_hash + description: 'Transaction hash' + tests: + - not_null + - &index + name: index + description: 'Event Index' + tests: + - not_null + - &tx_index + name: tx_index + description: 'Transaction Index' + tests: + - not_null + - &block_time + name: block_time + description: 'Block time in UTC' + tests: + - not_null + - &block_number + name: block_number + description: 'Event Block Number' + tests: + - not_null + - &swap_fee_percentage + name: swap_fee_percentage + description: 'Swap fees for the pool, values are returned with 18 decimals (1e18 meaning 100%)' + tests: + - not_null + + - name: balancer_optimism_pools_tokens_weights + meta: + blockchain: optimism + project: balancer + contributors: jacektrocinski, viniabussafi + config: + tags: ['optimism', 'balancer', 'pools', 'tokens', 'weights'] + description: > + Token weights in Balancer pools. + columns: + - *blockchain + - *version + - &pool_id + name: pool_id + description: 'Unique encoded identifier that refers to each pool' + tests: + - not_null + - &token_address + name: token_address + description: 'Contract address for the token' + - &normalized_weight + name: normalized_weight + description: 'Weight of the token in the pool.' + + - name: balancer_v2_optimism_pools_tokens_weights + meta: + blockchain: optimism + project: balancer + contributors: jacektrocinski, viniabussafi + config: + tags: ['optimism', 'balancer', 'pools', 'tokens', 'weights'] + description: > + Token weights in Balancer v2 pools. + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - pool_id + - token_address + columns: + - *blockchain + - *version + - *pool_id + - *token_address + - *normalized_weight + + - name: balancer_optimism_gauge_mappings + meta: + blockchain: optimism + project: balancer + contributors: msilb7 + config: + tags: ['optimism', 'balancer', 'gauges', 'incentives'] + description: > + Balancer gauge to pool mappings on Optimism. + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - pool_contract + - incentives_contract + columns: + - *blockchain + - *version + - &pool_contract + name: pool_contract + description: "Address of the liquidity pool contract" + - *pool_id + - &incentives_contract + name: incentives_contract + description: "Address of the contract where incentives are stored and emitted." + - &incentives_type + name: incentives_type + description: "Description of the incentives address type." + - &evt_block_time + name: evt_block_time + description: "Block time in UTC" + - &evt_block_number + name: evt_block_number + description: 'Event Block Number' + - *contract_address + - &evt_tx_hash + name: evt_tx_hash + description: 'Transaction hash' + - &evt_index + name: evT_index + description: 'Event Index' \ No newline at end of file diff --git a/models/balancer/optimism/balancer_optimism_gauge_mappings.sql b/models/_project/balancer/pools/optimism/balancer_optimism_gauge_mappings.sql similarity index 87% rename from models/balancer/optimism/balancer_optimism_gauge_mappings.sql rename to models/_project/balancer/pools/optimism/balancer_optimism_gauge_mappings.sql index 382424a91be..10ecdde4e86 100644 --- a/models/balancer/optimism/balancer_optimism_gauge_mappings.sql +++ b/models/_project/balancer/pools/optimism/balancer_optimism_gauge_mappings.sql @@ -1,16 +1,15 @@ {{ config( schema = 'balancer_optimism', - alias = 'gauge_mappings', materialized = 'incremental', file_format = 'delta', incremental_strategy = 'merge', unique_key = ['pool_contract', 'incentives_contract'], post_hook='{{ expose_spells(\'["optimism"]\', - "project", - "balancer", - \'["msilb7"]\') }}' + spell_type = "project", + spell_name = "balancer", + contributors = \'["msilb7"]\') }}' )  }} diff --git a/models/balancer/optimism/balancer_optimism_pools_tokens_weights.sql b/models/_project/balancer/pools/optimism/balancer_optimism_pools_tokens_weights.sql similarity index 86% rename from models/balancer/optimism/balancer_optimism_pools_tokens_weights.sql rename to models/_project/balancer/pools/optimism/balancer_optimism_pools_tokens_weights.sql index b6bdf48de02..204da50aa15 100644 --- a/models/balancer/optimism/balancer_optimism_pools_tokens_weights.sql +++ b/models/_project/balancer/pools/optimism/balancer_optimism_pools_tokens_weights.sql @@ -1,7 +1,6 @@ {{ config( schema = 'balancer_optimism', - alias = 'pools_tokens_weights', - + alias = 'pools_tokens_weights' ) }} diff --git a/models/balancer/optimism/balancer_v2_optimism_pools_fees.sql b/models/_project/balancer/pools/optimism/balancer_v2_optimism_pools_fees.sql similarity index 77% rename from models/balancer/optimism/balancer_v2_optimism_pools_fees.sql rename to models/_project/balancer/pools/optimism/balancer_v2_optimism_pools_fees.sql index adeeb98918e..7cde533a681 100644 --- a/models/balancer/optimism/balancer_v2_optimism_pools_fees.sql +++ b/models/_project/balancer/pools/optimism/balancer_v2_optimism_pools_fees.sql @@ -1,17 +1,12 @@ {{ config( schema = 'balancer_v2_optimism', - alias = 'pools_fees', materialized = 'incremental', file_format = 'delta', incremental_strategy = 'merge', - unique_key = ['block_number', 'tx_hash', 'index'], - post_hook='{{ expose_spells(\'["optimism"]\', - "project", - "balancer_v2", - \'["metacrypto", "jacektrocinski", "thetroyharris", "viniabussafi"]\') }}' - )  + unique_key = ['block_number', 'tx_hash', 'index'] + ) }} {% set event_signature = '0xa9ba3ffe0b6c366b81232caab38605a0699ad5398d6cce76f91ee809e322dafc' %} diff --git a/models/balancer/optimism/balancer_v2_optimism_pools_tokens_weights.sql b/models/_project/balancer/pools/optimism/balancer_v2_optimism_pools_tokens_weights.sql similarity index 99% rename from models/balancer/optimism/balancer_v2_optimism_pools_tokens_weights.sql rename to models/_project/balancer/pools/optimism/balancer_v2_optimism_pools_tokens_weights.sql index 74220656f88..0888c1c2a0b 100644 --- a/models/balancer/optimism/balancer_v2_optimism_pools_tokens_weights.sql +++ b/models/_project/balancer/pools/optimism/balancer_v2_optimism_pools_tokens_weights.sql @@ -2,7 +2,6 @@ config( schema='balancer_v2_optimism', alias = 'pools_tokens_weights', - materialized = 'incremental', file_format = 'delta', incremental_strategy = 'merge', diff --git a/models/_project/balancer/pools/polygon/_schema.yml b/models/_project/balancer/pools/polygon/_schema.yml new file mode 100644 index 00000000000..40929f01c30 --- /dev/null +++ b/models/_project/balancer/pools/polygon/_schema.yml @@ -0,0 +1,128 @@ +version: 2 + +models: + - name: balancer_v2_polygon_pools_fees + meta: + blockchain: polygon + project: balancer_v2 + contributors: jacektrocinski, thetroyharris, viniabussafi + config: + tags: ['polygon', 'balancer', 'pools', 'fees'] + description: > + Balancer v2 swap fees stored at the pool level. + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - block_number + - tx_hash + - index + columns: + - &blockchain + name: blockchain + description: "Blockchain" + - &version + name: version + description: "Version of Balancer where the liquidity pool used in transaction is deployed" + - &contract_address + name: contract_address + description: 'zkevm address for the liquidity pool used in transaction' + tests: + - not_null + - &tx_hash + name: tx_hash + description: 'Transaction hash' + tests: + - not_null + - &index + name: index + description: 'Event Index' + tests: + - not_null + - &tx_index + name: tx_index + description: 'Transaction Index' + tests: + - not_null + - &block_time + name: block_time + description: 'Block time in UTC' + tests: + - not_null + - &block_number + name: block_number + description: 'Event Block Number' + tests: + - not_null + - &swap_fee_percentage + name: swap_fee_percentage + description: 'Swap fees for the pool, values are returned with 18 decimals (1e18 meaning 100%)' + tests: + - not_null + + - name: balancer_polygon_pools_tokens_weights + meta: + blockchain: polygon + project: balancer + contributors: jacektrocinski, viniabussafi + config: + tags: ['polygon', 'balancer', 'pools', 'tokens', 'weights'] + description: > + Token weights in Balancer pools. + columns: + - *blockchain + - *version + - &pool_id + name: pool_id + description: 'Unique encoded identifier that refers to each pool' + tests: + - not_null + - &token_address + name: token_address + description: 'Contract address for the token' + - &normalized_weight + name: normalized_weight + description: 'Weight of the token in the pool.' + + - name: balancer_v2_polygon_pools_tokens_weights + meta: + blockchain: polygon + project: balancer + contributors: jacektrocinski, viniabussafi + config: + tags: ['polygon', 'balancer', 'pools', 'tokens', 'weights'] + description: > + Token weights in Balancer v2 pools. + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - pool_id + - token_address + columns: + - *blockchain + - *version + - *pool_id + - *token_address + - *normalized_weight + + - name: balancer_v2_polygon_lbps + meta: + blockchain: polygon + project: balancer_v2 + contributors: stefenon + config: + tags: ['polygon', 'balancer', 'lbp'] + description: > + Record of the Liquidity Boostrapping Pools (LBP) of Balancer, an automated portfolio manager and trading platform, on polygon. + columns: + - name: name + description: "Name of the LBP" + - name: pool_id + description: "ID of the LBP" + - name: token_sold + description: "Contract address of the token sold by the LBP" + - name: token_symbol + description: "Symbol of the token sold by the LBP" + - name: start_time + description: "LBP start time" + - name: end_time + description: "LBP end time" \ No newline at end of file diff --git a/models/balancer/polygon/balancer_polygon_pools_tokens_weights.sql b/models/_project/balancer/pools/polygon/balancer_polygon_pools_tokens_weights.sql similarity index 100% rename from models/balancer/polygon/balancer_polygon_pools_tokens_weights.sql rename to models/_project/balancer/pools/polygon/balancer_polygon_pools_tokens_weights.sql diff --git a/models/balancer/polygon/balancer_v2_polygon_lbps.sql b/models/_project/balancer/pools/polygon/balancer_v2_polygon_lbps.sql similarity index 100% rename from models/balancer/polygon/balancer_v2_polygon_lbps.sql rename to models/_project/balancer/pools/polygon/balancer_v2_polygon_lbps.sql diff --git a/models/balancer/polygon/balancer_v2_polygon_pools_fees.sql b/models/_project/balancer/pools/polygon/balancer_v2_polygon_pools_fees.sql similarity index 77% rename from models/balancer/polygon/balancer_v2_polygon_pools_fees.sql rename to models/_project/balancer/pools/polygon/balancer_v2_polygon_pools_fees.sql index 556cb0003af..586839b9ff9 100644 --- a/models/balancer/polygon/balancer_v2_polygon_pools_fees.sql +++ b/models/_project/balancer/pools/polygon/balancer_v2_polygon_pools_fees.sql @@ -1,17 +1,12 @@ {{ config( schema = 'balancer_v2_polygon', - alias = 'pools_fees', materialized = 'incremental', file_format = 'delta', incremental_strategy = 'merge', - unique_key = ['block_number', 'tx_hash', 'index'], - post_hook='{{ expose_spells(\'["polygon"]\', - "project", - "balancer_v2", - \'["metacrypto", "jacektrocinski", "thetroyharris", "viniabussafi"]\') }}' - )  + unique_key = ['block_number', 'tx_hash', 'index'] + ) }} {% set event_signature = '0xa9ba3ffe0b6c366b81232caab38605a0699ad5398d6cce76f91ee809e322dafc' %} diff --git a/models/balancer/polygon/balancer_v2_polygon_pools_tokens_weights.sql b/models/_project/balancer/pools/polygon/balancer_v2_polygon_pools_tokens_weights.sql similarity index 99% rename from models/balancer/polygon/balancer_v2_polygon_pools_tokens_weights.sql rename to models/_project/balancer/pools/polygon/balancer_v2_polygon_pools_tokens_weights.sql index afc223ecb81..20023ba61c3 100644 --- a/models/balancer/polygon/balancer_v2_polygon_pools_tokens_weights.sql +++ b/models/_project/balancer/pools/polygon/balancer_v2_polygon_pools_tokens_weights.sql @@ -2,7 +2,6 @@ config( schema='balancer_v2_polygon', alias = 'pools_tokens_weights', - materialized = 'incremental', file_format = 'delta', incremental_strategy = 'merge', diff --git a/models/_project/balancer/pools/zkevm/_schema.yml b/models/_project/balancer/pools/zkevm/_schema.yml new file mode 100644 index 00000000000..03f7ab4e6be --- /dev/null +++ b/models/_project/balancer/pools/zkevm/_schema.yml @@ -0,0 +1,105 @@ +version: 2 + +models: + - name: balancer_v2_zkevm_pools_fees + meta: + blockchain: zkevm + project: balancer_v2 + contributors: jacektrocinski, thetroyharris, viniabussafi + config: + tags: ['zkevm', 'balancer', 'pools_fees'] + description: > + Balancer v2 swap fees stored at the pool level. + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - block_number + - tx_hash + - index + columns: + - &blockchain + name: blockchain + description: "Blockchain" + - &version + name: version + description: "Version of Balancer where the liquidity pool used in transaction is deployed" + - &contract_address + name: contract_address + description: 'zkevm address for the liquidity pool used in transaction' + tests: + - not_null + - &tx_hash + name: tx_hash + description: 'Transaction hash' + tests: + - not_null + - &index + name: index + description: 'Event Index' + tests: + - not_null + - &tx_index + name: tx_index + description: 'Transaction Index' + tests: + - not_null + - &block_time + name: block_time + description: 'Block time in UTC' + tests: + - not_null + - &block_number + name: block_number + description: 'Event Block Number' + tests: + - not_null + - &swap_fee_percentage + name: swap_fee_percentage + description: 'Swap fees for the pool, values are returned with 18 decimals (1e18 meaning 100%)' + tests: + - not_null + + - name: balancer_zkevm_pools_tokens_weights + meta: + blockchain: zkevm + project: balancer + contributors: jacektrocinski, viniabussafi + config: + tags: ['zkevm', 'balancer', 'pools', 'tokens', 'weights'] + description: > + Token weights in Balancer pools. + columns: + - *blockchain + - *version + - &pool_id + name: pool_id + description: 'Unique encoded identifier that refers to each pool' + tests: + - not_null + - &token_address + name: token_address + description: 'Contract address for the token' + - &normalized_weight + name: normalized_weight + description: 'Weight of the token in the pool.' + + - name: balancer_v2_zkevm_pools_tokens_weights + meta: + blockchain: zkevm + project: balancer + contributors: jacektrocinski, viniabussafi + config: + tags: ['zkevm', 'balancer', 'pools', 'tokens', 'weights'] + description: > + Token weights in Balancer v2 pools. + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - pool_id + - token_address + columns: + - *blockchain + - *version + - *pool_id + - *token_address + - *normalized_weight \ No newline at end of file diff --git a/models/balancer/zkevm/balancer_v2_zkevm_pools_fees.sql b/models/_project/balancer/pools/zkevm/balancer_v2_zkevm_pools_fees.sql similarity index 82% rename from models/balancer/zkevm/balancer_v2_zkevm_pools_fees.sql rename to models/_project/balancer/pools/zkevm/balancer_v2_zkevm_pools_fees.sql index a92e4c5c00c..87bf3434eba 100644 --- a/models/balancer/zkevm/balancer_v2_zkevm_pools_fees.sql +++ b/models/_project/balancer/pools/zkevm/balancer_v2_zkevm_pools_fees.sql @@ -6,11 +6,7 @@ file_format = 'delta', incremental_strategy = 'merge', unique_key = ['block_number', 'tx_hash', 'index'], - post_hook='{{ expose_spells(\'["zkevm"]\', - "project", - "balancer_v2", - \'["metacrypto", "jacektrocinski", "thetroyharris", "viniabussafi"]\') }}' - )  + ) }} {% set event_signature = '0xa9ba3ffe0b6c366b81232caab38605a0699ad5398d6cce76f91ee809e322dafc' %} diff --git a/models/balancer/zkevm/balancer_v2_zkevm_pools_tokens_weights.sql b/models/_project/balancer/pools/zkevm/balancer_v2_zkevm_pools_tokens_weights.sql similarity index 100% rename from models/balancer/zkevm/balancer_v2_zkevm_pools_tokens_weights.sql rename to models/_project/balancer/pools/zkevm/balancer_v2_zkevm_pools_tokens_weights.sql diff --git a/models/balancer/zkevm/balancer_zkevm_pools_tokens_weights.sql b/models/_project/balancer/pools/zkevm/balancer_zkevm_pools_tokens_weights.sql similarity index 100% rename from models/balancer/zkevm/balancer_zkevm_pools_tokens_weights.sql rename to models/_project/balancer/pools/zkevm/balancer_zkevm_pools_tokens_weights.sql diff --git a/models/_project/balancer/protocol_fee/_schema.yml b/models/_project/balancer/protocol_fee/_schema.yml new file mode 100644 index 00000000000..ddc320d1692 --- /dev/null +++ b/models/_project/balancer/protocol_fee/_schema.yml @@ -0,0 +1,61 @@ +version: 2 + +models: + - name: balancer_protocol_fee + meta: + blockchain: arbitrum, avalanche_c, base, ethereum, gnosis, optimism, polygon, zkevm + project: balancer + contributors: viniabussafi + config: + tags: ['arbitrum', 'avalanche_c', 'base', 'ethereum', 'gnosis', 'optimism', 'polygon', 'zkevm', 'fees'] + description: > + Daily Protocol Fee collected and Revenue by pool on Balancer, an automated portfolio manager and trading platform. + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - day + - pool_id + - token_address + columns: + - &day + name: day + description: "Block date in UTC" + - &pool_id + name: pool_id + description: "Unique encoded identifier that refers to each pool" + - &pool_address + name: pool_address + description: "Pool address" + - &pool_symbol + name: pool_symbol + description: "Token symbols, followed by their respective weights, if applicable" + - &version + name: version + description: "Version of the project" + - &blockchain + name: blockchain + description: "Blockchain" + - &pool_type + name: pool_type + description: "Pool attributes, determined by the pool's factory" + - &token_address + name: token_address + description: "Contract address of the token in which protocol fees were collected" + - &token_symbol + name: token_symbol + description: Token symbol of the token in which protocol fees were collected" + - &token_amount_raw + name: token_amount_raw + description: "Raw amount of fees of the token in the pool at time of execution in the original currency" + - &token_amount + name: token_amount + description: "Normalized amount of fees of the token in the pool at time of execution in the original currency" + - &protocol_fee_collected_usd + name: protocol_fee_collected_usd + description: "USD value of the collected fee" + - &treasury_share + name: treasury_share + description: "Share of total fee that is directed to Balancer DAO's treasury, as per BIPs 19, 161 and 371" + - &treasury_revenue_usd + name: treasury_revenue_usd + description: "USD value of fee directed to Balancer DAO's treasury" \ No newline at end of file diff --git a/models/_project/balancer/protocol_fee/arbitrum/_schema.yml b/models/_project/balancer/protocol_fee/arbitrum/_schema.yml new file mode 100644 index 00000000000..b529565a645 --- /dev/null +++ b/models/_project/balancer/protocol_fee/arbitrum/_schema.yml @@ -0,0 +1,61 @@ +version: 2 + +models: + - name: balancer_v2_arbitrum_protocol_fee + meta: + blockchain: arbitrum + project: balancer_v2 + contributors: viniabussafi + config: + tags: ['arbitrum', 'protocol', 'fees'] + description: > + Daily Protocol Fee collected and Treasury Revenue by pool on Balancer, an automated portfolio manager and trading platform. + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - day + - pool_id + - token_address + columns: + - &day + name: day + description: "Block date in UTC" + - &pool_id + name: pool_id + description: "Unique encoded identifier that refers to each pool" + - &pool_address + name: pool_address + description: "Pool address" + - &pool_symbol + name: pool_symbol + description: "Token symbols, followed by their respective weights, if applicable" + - &version + name: version + description: "Version of the project" + - &blockchain + name: blockchain + description: "Blockchain" + - &pool_type + name: pool_type + description: "Pool attributes, determined by the pool's factory" + - &token_address + name: token_address + description: "Contract address of the token in which protocol fees were collected" + - &token_symbol + name: token_symbol + description: Token symbol of the token in which protocol fees were collected" + - &token_amount_raw + name: token_amount_raw + description: "Raw amount of fees of the token in the pool at time of execution in the original currency" + - &token_amount + name: token_amount + description: "Normalized amount of fees of the token in the pool at time of execution in the original currency" + - &protocol_fee_collected_usd + name: protocol_fee_collected_usd + description: "USD value of the collected fee" + - &treasury_share + name: treasury_share + description: "Share of total fee that is directed to Balancer DAO's treasury, as per BIPs 19, 161 and 371" + - &treasury_revenue_usd + name: treasury_revenue_usd + description: "USD value of fee directed to Balancer DAO's treasury" \ No newline at end of file diff --git a/models/balancer/arbitrum/balancer_v2_arbitrum_protocol_fee.sql b/models/_project/balancer/protocol_fee/arbitrum/balancer_v2_arbitrum_protocol_fee.sql similarity index 100% rename from models/balancer/arbitrum/balancer_v2_arbitrum_protocol_fee.sql rename to models/_project/balancer/protocol_fee/arbitrum/balancer_v2_arbitrum_protocol_fee.sql diff --git a/models/_project/balancer/protocol_fee/avalanche_c/_schema.yml b/models/_project/balancer/protocol_fee/avalanche_c/_schema.yml new file mode 100644 index 00000000000..536823df10d --- /dev/null +++ b/models/_project/balancer/protocol_fee/avalanche_c/_schema.yml @@ -0,0 +1,61 @@ +version: 2 + +models: + - name: balancer_v2_avalanche_c_protocol_fee + meta: + blockchain: avalanche_c + project: balancer_v2 + contributors: viniabussafi + config: + tags: ['avalanche_c', 'revenue', 'fees'] + description: > + Daily Protocol Fee collected and Revenue by pool on Balancer, an automated portfolio manager and trading platform. + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - day + - pool_id + - token_address + columns: + - &day + name: day + description: "Block date in UTC" + - &pool_id + name: pool_id + description: "Unique encoded identifier that refers to each pool" + - &pool_address + name: pool_address + description: "Pool address" + - &pool_symbol + name: pool_symbol + description: "Token symbols, followed by their respective weights, if applicable" + - &version + name: version + description: "Version of the project" + - &blockchain + name: blockchain + description: "Blockchain" + - &pool_type + name: pool_type + description: "Pool attributes, determined by the pool's factory" + - &token_address + name: token_address + description: "Contract address of the token in which protocol fees were collected" + - &token_symbol + name: token_symbol + description: Token symbol of the token in which protocol fees were collected" + - &token_amount_raw + name: token_amount_raw + description: "Raw amount of fees of the token in the pool at time of execution in the original currency" + - &token_amount + name: token_amount + description: "Normalized amount of fees of the token in the pool at time of execution in the original currency" + - &protocol_fee_collected_usd + name: protocol_fee_collected_usd + description: "USD value of the collected fee" + - &treasury_share + name: treasury_share + description: "Share of total fee that is directed to Balancer DAO's treasury, as per BIPs 19, 161 and 371" + - &treasury_revenue_usd + name: treasury_revenue_usd + description: "USD value of fee directed to Balancer DAO's treasury" \ No newline at end of file diff --git a/models/balancer/avalanche_c/balancer_v2_avalanche_c_protocol_fee.sql b/models/_project/balancer/protocol_fee/avalanche_c/balancer_v2_avalanche_c_protocol_fee.sql similarity index 100% rename from models/balancer/avalanche_c/balancer_v2_avalanche_c_protocol_fee.sql rename to models/_project/balancer/protocol_fee/avalanche_c/balancer_v2_avalanche_c_protocol_fee.sql diff --git a/models/balancer/balancer_protocol_fee.sql b/models/_project/balancer/protocol_fee/balancer_protocol_fee.sql similarity index 75% rename from models/balancer/balancer_protocol_fee.sql rename to models/_project/balancer/protocol_fee/balancer_protocol_fee.sql index d871a6aef89..37fef24dc85 100644 --- a/models/balancer/balancer_protocol_fee.sql +++ b/models/_project/balancer/protocol_fee/balancer_protocol_fee.sql @@ -1,10 +1,10 @@ {{ config( schema = 'balancer', alias = 'protocol_fee', - post_hook='{{ expose_spells(\'["ethereum", "arbitrum", "polygon", "gnosis", "optimism","avalanche_c", "base"]\', - "project", - "balancer", - \'["viniabussafi"]\') }}' + post_hook='{{ expose_spells(blockchains = \'["arbitrum", "avalanche_c", "base", "ethereum", "gnosis", "optimism", "polygon", "zkevm"]\', + spell_type = "project", + spell_name = "balancer", + contributors = \'["viniabussafi"]\') }}' ) }} diff --git a/models/_project/balancer/protocol_fee/base/_schema.yml b/models/_project/balancer/protocol_fee/base/_schema.yml new file mode 100644 index 00000000000..cebb1c312e9 --- /dev/null +++ b/models/_project/balancer/protocol_fee/base/_schema.yml @@ -0,0 +1,61 @@ +version: 2 + +models: + - name: balancer_v2_base_protocol_fee + meta: + blockchain: base + project: balancer_v2 + contributors: viniabussafi + config: + tags: ['base', 'revenue', 'fees'] + description: > + Daily Protocol Fee collected and Revenue by pool on Balancer, an automated portfolio manager and trading platform. + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - day + - pool_id + - token_address + columns: + - &day + name: day + description: "Block date in UTC" + - &pool_id + name: pool_id + description: "Unique encoded identifier that refers to each pool" + - &pool_address + name: pool_address + description: "Pool address" + - &pool_symbol + name: pool_symbol + description: "Token symbols, followed by their respective weights, if applicable" + - &version + name: version + description: "Version of the project" + - &blockchain + name: blockchain + description: "Blockchain" + - &pool_type + name: pool_type + description: "Pool attributes, determined by the pool's factory" + - &token_address + name: token_address + description: "Contract address of the token in which protocol fees were collected" + - &token_symbol + name: token_symbol + description: Token symbol of the token in which protocol fees were collected" + - &token_amount_raw + name: token_amount_raw + description: "Raw amount of fees of the token in the pool at time of execution in the original currency" + - &token_amount + name: token_amount + description: "Normalized amount of fees of the token in the pool at time of execution in the original currency" + - &protocol_fee_collected_usd + name: protocol_fee_collected_usd + description: "USD value of the collected fee" + - &treasury_share + name: treasury_share + description: "Share of total fee that is directed to Balancer DAO's treasury, as per BIPs 19, 161 and 371" + - &treasury_revenue_usd + name: treasury_revenue_usd + description: "USD value of fee directed to Balancer DAO's treasury" \ No newline at end of file diff --git a/models/balancer/base/balancer_v2_base_protocol_fee.sql b/models/_project/balancer/protocol_fee/base/balancer_v2_base_protocol_fee.sql similarity index 100% rename from models/balancer/base/balancer_v2_base_protocol_fee.sql rename to models/_project/balancer/protocol_fee/base/balancer_v2_base_protocol_fee.sql diff --git a/models/_project/balancer/protocol_fee/ethereum/_schema.yml b/models/_project/balancer/protocol_fee/ethereum/_schema.yml new file mode 100644 index 00000000000..b6830c20e7e --- /dev/null +++ b/models/_project/balancer/protocol_fee/ethereum/_schema.yml @@ -0,0 +1,61 @@ +version: 2 + +models: + - name: balancer_v2_ethereum_protocol_fee + meta: + blockchain: ethereum + project: balancer_v2 + contributors: viniabussafi + config: + tags: ['ethereum', 'revenue', 'fees'] + description: > + Daily Protocol Fee collected and Revenue by pool on Balancer, an automated portfolio manager and trading platform. + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - day + - pool_id + - token_address + columns: + - &day + name: day + description: "Block date in UTC" + - &pool_id + name: pool_id + description: "Unique encoded identifier that refers to each pool" + - &pool_address + name: pool_address + description: "Pool address" + - &pool_symbol + name: pool_symbol + description: "Token symbols, followed by their respective weights, if applicable" + - &version + name: version + description: "Version of the project" + - &blockchain + name: blockchain + description: "Blockchain" + - &pool_type + name: pool_type + description: "Pool attributes, determined by the pool's factory" + - &token_address + name: token_address + description: "Contract address of the token in which protocol fees were collected" + - &token_symbol + name: token_symbol + description: Token symbol of the token in which protocol fees were collected" + - &token_amount_raw + name: token_amount_raw + description: "Raw amount of fees of the token in the pool at time of execution in the original currency" + - &token_amount + name: token_amount + description: "Normalized amount of fees of the token in the pool at time of execution in the original currency" + - &protocol_fee_collected_usd + name: protocol_fee_collected_usd + description: "USD value of the collected fee" + - &treasury_share + name: treasury_share + description: "Share of total fee that is directed to Balancer DAO's treasury, as per BIPs 19, 161 and 371" + - &treasury_revenue_usd + name: treasury_revenue_usd + description: "USD value of fee directed to Balancer DAO's treasury" \ No newline at end of file diff --git a/models/balancer/ethereum/balancer_v2_ethereum_protocol_fee.sql b/models/_project/balancer/protocol_fee/ethereum/balancer_v2_ethereum_protocol_fee.sql similarity index 100% rename from models/balancer/ethereum/balancer_v2_ethereum_protocol_fee.sql rename to models/_project/balancer/protocol_fee/ethereum/balancer_v2_ethereum_protocol_fee.sql diff --git a/models/_project/balancer/protocol_fee/gnosis/_schema.yml b/models/_project/balancer/protocol_fee/gnosis/_schema.yml new file mode 100644 index 00000000000..defa5e74781 --- /dev/null +++ b/models/_project/balancer/protocol_fee/gnosis/_schema.yml @@ -0,0 +1,61 @@ +version: 2 + +models: + - name: balancer_v2_gnosis_protocol_fee + meta: + blockchain: gnosis + project: balancer_v2 + contributors: viniabussafi + config: + tags: ['gnosis', 'revenue', 'fees'] + description: > + Daily Protocol Fee collected and Revenue by pool on Balancer, an automated portfolio manager and trading platform. + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - day + - pool_id + - token_address + columns: + - &day + name: day + description: "Block date in UTC" + - &pool_id + name: pool_id + description: "Unique encoded identifier that refers to each pool" + - &pool_address + name: pool_address + description: "Pool address" + - &pool_symbol + name: pool_symbol + description: "Token symbols, followed by their respective weights, if applicable" + - &version + name: version + description: "Version of the project" + - &blockchain + name: blockchain + description: "Blockchain" + - &pool_type + name: pool_type + description: "Pool attributes, determined by the pool's factory" + - &token_address + name: token_address + description: "Contract address of the token in which protocol fees were collected" + - &token_symbol + name: token_symbol + description: Token symbol of the token in which protocol fees were collected" + - &token_amount_raw + name: token_amount_raw + description: "Raw amount of fees of the token in the pool at time of execution in the original currency" + - &token_amount + name: token_amount + description: "Normalized amount of fees of the token in the pool at time of execution in the original currency" + - &protocol_fee_collected_usd + name: protocol_fee_collected_usd + description: "USD value of the collected fee" + - &treasury_share + name: treasury_share + description: "Share of total fee that is directed to Balancer DAO's treasury, as per BIPs 19, 161 and 371" + - &treasury_revenue_usd + name: treasury_revenue_usd + description: "USD value of fee directed to Balancer DAO's treasury" \ No newline at end of file diff --git a/models/balancer/gnosis/balancer_v2_gnosis_protocol_fee.sql b/models/_project/balancer/protocol_fee/gnosis/balancer_v2_gnosis_protocol_fee.sql similarity index 100% rename from models/balancer/gnosis/balancer_v2_gnosis_protocol_fee.sql rename to models/_project/balancer/protocol_fee/gnosis/balancer_v2_gnosis_protocol_fee.sql diff --git a/models/_project/balancer/protocol_fee/optimism/_schema.yml b/models/_project/balancer/protocol_fee/optimism/_schema.yml new file mode 100644 index 00000000000..6b096a72bc6 --- /dev/null +++ b/models/_project/balancer/protocol_fee/optimism/_schema.yml @@ -0,0 +1,61 @@ +version: 2 + +models: + - name: balancer_v2_optimism_protocol_fee + meta: + blockchain: optimism + project: balancer_v2 + contributors: viniabussafi + config: + tags: ['optimism', 'revenue', 'fees'] + description: > + Daily Protocol Fee collected and Revenue by pool on Balancer, an automated portfolio manager and trading platform. + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - day + - pool_id + - token_address + columns: + - &day + name: day + description: "Block date in UTC" + - &pool_id + name: pool_id + description: "Unique encoded identifier that refers to each pool" + - &pool_address + name: pool_address + description: "Pool address" + - &pool_symbol + name: pool_symbol + description: "Token symbols, followed by their respective weights, if applicable" + - &version + name: version + description: "Version of the project" + - &blockchain + name: blockchain + description: "Blockchain" + - &pool_type + name: pool_type + description: "Pool attributes, determined by the pool's factory" + - &token_address + name: token_address + description: "Contract address of the token in which protocol fees were collected" + - &token_symbol + name: token_symbol + description: Token symbol of the token in which protocol fees were collected" + - &token_amount_raw + name: token_amount_raw + description: "Raw amount of fees of the token in the pool at time of execution in the original currency" + - &token_amount + name: token_amount + description: "Normalized amount of fees of the token in the pool at time of execution in the original currency" + - &protocol_fee_collected_usd + name: protocol_fee_collected_usd + description: "USD value of the collected fee" + - &treasury_share + name: treasury_share + description: "Share of total fee that is directed to Balancer DAO's treasury, as per BIPs 19, 161 and 371" + - &treasury_revenue_usd + name: treasury_revenue_usd + description: "USD value of fee directed to Balancer DAO's treasury" \ No newline at end of file diff --git a/models/balancer/optimism/balancer_v2_optimism_protocol_fee.sql b/models/_project/balancer/protocol_fee/optimism/balancer_v2_optimism_protocol_fee.sql similarity index 100% rename from models/balancer/optimism/balancer_v2_optimism_protocol_fee.sql rename to models/_project/balancer/protocol_fee/optimism/balancer_v2_optimism_protocol_fee.sql diff --git a/models/_project/balancer/protocol_fee/polygon/_schema.yml b/models/_project/balancer/protocol_fee/polygon/_schema.yml new file mode 100644 index 00000000000..b541beceb65 --- /dev/null +++ b/models/_project/balancer/protocol_fee/polygon/_schema.yml @@ -0,0 +1,61 @@ +version: 2 + +models: + - name: balancer_v2_polygon_protocol_fee + meta: + blockchain: polygon + project: balancer_v2 + contributors: viniabussafi + config: + tags: ['polygon', 'revenue', 'fees'] + description: > + Daily Protocol Fee collected and Revenue by pool on Balancer, an automated portfolio manager and trading platform. + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - day + - pool_id + - token_address + columns: + - &day + name: day + description: "Block date in UTC" + - &pool_id + name: pool_id + description: "Unique encoded identifier that refers to each pool" + - &pool_address + name: pool_address + description: "Pool address" + - &pool_symbol + name: pool_symbol + description: "Token symbols, followed by their respective weights, if applicable" + - &version + name: version + description: "Version of the project" + - &blockchain + name: blockchain + description: "Blockchain" + - &pool_type + name: pool_type + description: "Pool attributes, determined by the pool's factory" + - &token_address + name: token_address + description: "Contract address of the token in which protocol fees were collected" + - &token_symbol + name: token_symbol + description: Token symbol of the token in which protocol fees were collected" + - &token_amount_raw + name: token_amount_raw + description: "Raw amount of fees of the token in the pool at time of execution in the original currency" + - &token_amount + name: token_amount + description: "Normalized amount of fees of the token in the pool at time of execution in the original currency" + - &protocol_fee_collected_usd + name: protocol_fee_collected_usd + description: "USD value of the collected fee" + - &treasury_share + name: treasury_share + description: "Share of total fee that is directed to Balancer DAO's treasury, as per BIPs 19, 161 and 371" + - &treasury_revenue_usd + name: treasury_revenue_usd + description: "USD value of fee directed to Balancer DAO's treasury" \ No newline at end of file diff --git a/models/balancer/polygon/balancer_v2_polygon_protocol_fee.sql b/models/_project/balancer/protocol_fee/polygon/balancer_v2_polygon_protocol_fee.sql similarity index 100% rename from models/balancer/polygon/balancer_v2_polygon_protocol_fee.sql rename to models/_project/balancer/protocol_fee/polygon/balancer_v2_polygon_protocol_fee.sql diff --git a/models/_project/balancer/protocol_fee/zkevm/_schema.yml b/models/_project/balancer/protocol_fee/zkevm/_schema.yml new file mode 100644 index 00000000000..b8c5d67a600 --- /dev/null +++ b/models/_project/balancer/protocol_fee/zkevm/_schema.yml @@ -0,0 +1,61 @@ +version: 2 + +models: + - name: balancer_v2_zkevm_protocol_fee + meta: + blockchain: zkevm + project: balancer_v2 + contributors: viniabussafi + config: + tags: ['zkevm', 'revenue', 'fees'] + description: > + Daily Protocol Fee collected and Revenue by pool on Balancer, an automated portfolio manager and trading platform. + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - day + - pool_id + - token_address + columns: + - &day + name: day + description: "Block date in UTC" + - &pool_id + name: pool_id + description: "Unique encoded identifier that refers to each pool" + - &pool_address + name: pool_address + description: "Pool address" + - &pool_symbol + name: pool_symbol + description: "Token symbols, followed by their respective weights, if applicable" + - &version + name: version + description: "Version of the project" + - &blockchain + name: blockchain + description: "Blockchain" + - &pool_type + name: pool_type + description: "Pool attributes, determined by the pool's factory" + - &token_address + name: token_address + description: "Contract address of the token in which protocol fees were collected" + - &token_symbol + name: token_symbol + description: Token symbol of the token in which protocol fees were collected" + - &token_amount_raw + name: token_amount_raw + description: "Raw amount of fees of the token in the pool at time of execution in the original currency" + - &token_amount + name: token_amount + description: "Normalized amount of fees of the token in the pool at time of execution in the original currency" + - &protocol_fee_collected_usd + name: protocol_fee_collected_usd + description: "USD value of the collected fee" + - &treasury_share + name: treasury_share + description: "Share of total fee that is directed to Balancer DAO's treasury, as per BIPs 19, 161 and 371" + - &treasury_revenue_usd + name: treasury_revenue_usd + description: "USD value of fee directed to Balancer DAO's treasury" \ No newline at end of file diff --git a/models/balancer/zkevm/balancer_v2_zkevm_protocol_fee.sql b/models/_project/balancer/protocol_fee/zkevm/balancer_v2_zkevm_protocol_fee.sql similarity index 100% rename from models/balancer/zkevm/balancer_v2_zkevm_protocol_fee.sql rename to models/_project/balancer/protocol_fee/zkevm/balancer_v2_zkevm_protocol_fee.sql diff --git a/models/_project/balancer/support/_schema.yml b/models/_project/balancer/support/_schema.yml new file mode 100644 index 00000000000..fbb445cf773 --- /dev/null +++ b/models/_project/balancer/support/_schema.yml @@ -0,0 +1,56 @@ +version: 2 + +models: + - name: balancer_token_whitelist + meta: + blockchain: arbitrum, avalanche_c, base, ethereum, gnosis, optimism, polygon, 'zkevm' + contributors: viniabussafi + config: + tags: ['arbitrum', 'avalanche_c', 'base', 'ethereum', 'gnosis', 'optimism', 'polygon', 'zkevm'] + description: > + These tokens are whitelisted to be used as pricing assets on liquidity calculations for weighted pools, due to the trustability of their data. + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - address + - name + - chain + columns: + - &address + name: address + description: "Token address" + - &name + name: name + description: "Token symbol" + - &chain + name: chain + description: "Token blockchain" + + - name: balancer_single_recipient_gauges + meta: + blockchain: ethereum + contributors: viniabussafi + config: + tags: ['ethereum', 'gauges'] + description: > + These gauges are deployed by the SingleRecipientGauge contract and this mapping manually links each gauge to it's correspondent pool and project + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - gauge_address + - pool_id + - project + - blockchain + columns: + - &gauge_address + name: gauge_address + descripton: "Gauge address" + - &pool_id + name: pool_id + description: "Unique encoded identifier that refers to each pool to which each gauge directs incentives" + - &project + name: project + description: "ve8020 project for each gauge" + - &blockchain + name: blockchain + description: "Blockchain" \ No newline at end of file diff --git a/models/balancer/balancer_single_recipient_gauges.sql b/models/_project/balancer/support/balancer_single_recipient_gauges.sql similarity index 100% rename from models/balancer/balancer_single_recipient_gauges.sql rename to models/_project/balancer/support/balancer_single_recipient_gauges.sql diff --git a/models/balancer/balancer_token_whitelist.sql b/models/_project/balancer/support/balancer_token_whitelist.sql similarity index 100% rename from models/balancer/balancer_token_whitelist.sql rename to models/_project/balancer/support/balancer_token_whitelist.sql diff --git a/models/_project/balancer/trades/arbitrum/_schema.yml b/models/_project/balancer/trades/arbitrum/_schema.yml new file mode 100644 index 00000000000..09ef97905b8 --- /dev/null +++ b/models/_project/balancer/trades/arbitrum/_schema.yml @@ -0,0 +1,149 @@ +version: 2 + +models: + - name: balancer_arbitrum_trades + meta: + blockchain: arbitrum + sector: dex + contributors: bizzyvinci, viniabussafi + config: + tags: ['balancer', 'arbitrum', 'amm', 'trades', 'dex'] + description: > + DEX trades on balancer on arbitrum + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - block_date + - blockchain + - project + - version + - tx_hash + - evt_index + - check_dex_seed: + blockchain: arbitrum + project: balancer + version: 2 + columns: + - &blockchain + name: blockchain + description: "Blockchain" + - &project + name: project + description: "Project name (balancer)" + - &version + name: version + description: "Version of the project" + - &block_month + name: block_month + description: "Block month in UTC" + - &block_date + name: block_date + description: "Block date in UTC" + - &block_time + name: block_time + description: 'Block time in UTC' + - &block_number + name: block_number + description: 'Block number' + - &token_bought_symbol + name: token_bought_symbol + description: "Token symbol for token bought in the trade" + - &token_sold_symbol + name: token_sold_symbol + description: "Token symbol for token sold in the trade" + - &token_pair + name: token_pair + description: "Token symbol pair for each token involved in the trade" + - &token_bought_amount + name: token_bought_amount + description: "Value of the token bought at time of execution in the original currency" + - &token_sold_amount + name: token_sold_amount + description: "Value of the token sold at time of execution in the original currency" + - &token_bought_amount_raw + name: token_bought_amount_raw + description: "Raw value of the token bought at time of execution in the original currency" + - &token_sold_amount_raw + name: token_sold_amount_raw + description: "Raw value of the token sold at time of execution in the original currency" + - &amount_usd + name: amount_usd + description: "USD value of the trade at time of execution" + - &token_bought_address + name: token_bought_address + description: "Contract address of the token bought" + - &token_sold_address + name: token_sold_address + description: "Contract address of the token sold" + - &taker + name: taker + description: "Address of trader who purchased a token" + - &maker + name: maker + description: "Address of trader who sold a token" + - &pool_id + name: pool_id + description: "Unique encoded identifier that refers to each pool" + - &swap_fee + name: swap_fee + description: 'Swap fee' + - &project_contract_address + name: project_contract_address + description: "Pool address" + - &pool_symbol + name: pool_symbol + description: "Token symbols, followed by their respective weights, if applicable" + - &pool_type + name: pool_type + description: "Pool attributes, determined by the pool's factory" + - &tx_hash + name: tx_hash + description: "Tx. Hash" + - &tx_from + name: tx_from + description: "transaction.from" + - &tx_to + name: tx_to + description: "transaction.to" + - &evt_index + name: evt_index + description: 'Event index' + + - name: balancer_v2_arbitrum_trades + meta: + blockchain: arbitrum + sector: dex + contributors: bizzyvinci, thetroyharris, tomfutago, viniabussafi + config: + tags: [ 'balancer', 'arbitrum', 'amm', 'trades', 'dex', 'beta' ] + description: > + DEX trades on balancer v2 on arbitrum + columns: + - *blockchain + - *project + - *version + - *block_month + - *block_date + - *block_time + - *block_number + - *token_bought_symbol + - *token_sold_symbol + - *token_pair + - *token_bought_amount + - *token_sold_amount + - *token_bought_amount_raw + - *token_sold_amount_raw + - *amount_usd + - *token_bought_address + - *token_sold_address + - *taker + - *maker + - *project_contract_address + - *pool_symbol + - *pool_type + - *pool_id + - *swap_fee + - *tx_hash + - *tx_from + - *tx_to + - *evt_index \ No newline at end of file diff --git a/models/balancer/arbitrum/balancer_arbitrum_trades.sql b/models/_project/balancer/trades/arbitrum/balancer_arbitrum_trades.sql similarity index 100% rename from models/balancer/arbitrum/balancer_arbitrum_trades.sql rename to models/_project/balancer/trades/arbitrum/balancer_arbitrum_trades.sql diff --git a/models/balancer/arbitrum/balancer_v2_arbitrum_trades.sql b/models/_project/balancer/trades/arbitrum/balancer_v2_arbitrum_trades.sql similarity index 94% rename from models/balancer/arbitrum/balancer_v2_arbitrum_trades.sql rename to models/_project/balancer/trades/arbitrum/balancer_v2_arbitrum_trades.sql index 750f467f653..2baa6afd2b2 100644 --- a/models/balancer/arbitrum/balancer_v2_arbitrum_trades.sql +++ b/models/_project/balancer/trades/arbitrum/balancer_v2_arbitrum_trades.sql @@ -4,9 +4,9 @@ alias = 'trades', materialized = 'view', post_hook = '{{ expose_spells(\'["arbitrum"]\', - "project", - "balancer_v2", - \'["mendesfabio", "jacektrocinski", "thetroyharris", "tomfutago", "viniabussafi"]\') }}' + spell_type = "project", + spell_name = "balancer", + contributors = \'["mendesfabio", "jacektrocinski", "thetroyharris", "tomfutago", "viniabussafi"]\') }}' ) }} diff --git a/models/_project/balancer/trades/avalanche_c/_schema.yml b/models/_project/balancer/trades/avalanche_c/_schema.yml new file mode 100644 index 00000000000..86aca24b807 --- /dev/null +++ b/models/_project/balancer/trades/avalanche_c/_schema.yml @@ -0,0 +1,149 @@ +version: 2 + +models: + - name: balancer_avalanche_c_trades + meta: + blockchain: avalanche_c + sector: dex + contributors: bizzyvinci, viniabussafi + config: + tags: ['balancer', 'avalanche_c', 'amm', 'trades', 'dex'] + description: > + DEX trades on balancer on avalanche_c + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - block_date + - blockchain + - project + - version + - tx_hash + - evt_index + - check_dex_seed: + blockchain: avalanche_c + project: balancer + version: 2 + columns: + - &blockchain + name: blockchain + description: "Blockchain" + - &project + name: project + description: "Project name (balancer)" + - &version + name: version + description: "Version of the project" + - &block_month + name: block_month + description: "Block month in UTC" + - &block_date + name: block_date + description: "Block date in UTC" + - &block_time + name: block_time + description: 'Block time in UTC' + - &block_number + name: block_number + description: 'Block number' + - &token_bought_symbol + name: token_bought_symbol + description: "Token symbol for token bought in the trade" + - &token_sold_symbol + name: token_sold_symbol + description: "Token symbol for token sold in the trade" + - &token_pair + name: token_pair + description: "Token symbol pair for each token involved in the trade" + - &token_bought_amount + name: token_bought_amount + description: "Value of the token bought at time of execution in the original currency" + - &token_sold_amount + name: token_sold_amount + description: "Value of the token sold at time of execution in the original currency" + - &token_bought_amount_raw + name: token_bought_amount_raw + description: "Raw value of the token bought at time of execution in the original currency" + - &token_sold_amount_raw + name: token_sold_amount_raw + description: "Raw value of the token sold at time of execution in the original currency" + - &amount_usd + name: amount_usd + description: "USD value of the trade at time of execution" + - &token_bought_address + name: token_bought_address + description: "Contract address of the token bought" + - &token_sold_address + name: token_sold_address + description: "Contract address of the token sold" + - &taker + name: taker + description: "Address of trader who purchased a token" + - &maker + name: maker + description: "Address of trader who sold a token" + - &pool_id + name: pool_id + description: "Unique encoded identifier that refers to each pool" + - &swap_fee + name: swap_fee + description: 'Swap fee' + - &project_contract_address + name: project_contract_address + description: "Pool address" + - &pool_symbol + name: pool_symbol + description: "Token symbols, followed by their respective weights, if applicable" + - &pool_type + name: pool_type + description: "Pool attributes, determined by the pool's factory" + - &tx_hash + name: tx_hash + description: "Tx. Hash" + - &tx_from + name: tx_from + description: "transaction.from" + - &tx_to + name: tx_to + description: "transaction.to" + - &evt_index + name: evt_index + description: 'Event index' + + - name: balancer_v2_avalanche_c_trades + meta: + blockchain: avalanche_c + sector: dex + contributors: bizzyvinci, thetroyharris, tomfutago, viniabussafi + config: + tags: [ 'balancer', 'avalanche_c', 'amm', 'trades', 'dex', 'beta' ] + description: > + DEX trades on balancer v2 on avalanche_c + columns: + - *blockchain + - *project + - *version + - *block_month + - *block_date + - *block_time + - *block_number + - *token_bought_symbol + - *token_sold_symbol + - *token_pair + - *token_bought_amount + - *token_sold_amount + - *token_bought_amount_raw + - *token_sold_amount_raw + - *amount_usd + - *token_bought_address + - *token_sold_address + - *taker + - *maker + - *project_contract_address + - *pool_symbol + - *pool_type + - *pool_id + - *swap_fee + - *tx_hash + - *tx_from + - *tx_to + - *evt_index \ No newline at end of file diff --git a/models/balancer/avalanche_c/balancer_avalanche_c_trades.sql b/models/_project/balancer/trades/avalanche_c/balancer_avalanche_c_trades.sql similarity index 100% rename from models/balancer/avalanche_c/balancer_avalanche_c_trades.sql rename to models/_project/balancer/trades/avalanche_c/balancer_avalanche_c_trades.sql diff --git a/models/balancer/avalanche_c/balancer_v2_avalanche_c_trades.sql b/models/_project/balancer/trades/avalanche_c/balancer_v2_avalanche_c_trades.sql similarity index 94% rename from models/balancer/avalanche_c/balancer_v2_avalanche_c_trades.sql rename to models/_project/balancer/trades/avalanche_c/balancer_v2_avalanche_c_trades.sql index 54dfd905dbc..d1a0eb61af5 100644 --- a/models/balancer/avalanche_c/balancer_v2_avalanche_c_trades.sql +++ b/models/_project/balancer/trades/avalanche_c/balancer_v2_avalanche_c_trades.sql @@ -4,10 +4,10 @@ alias = 'trades', materialized = 'view', post_hook = '{{ expose_spells(\'["avalanche_c"]\', - "project", - "balancer_v2", - \'["mendesfabio", "jacektrocinski", "thetroyharris", "tomfutago", "viniabussafi"]\') }}' - ) + spell_type = "project", + spell_name = "balancer", + contributors = \'["mendesfabio", "jacektrocinski", "thetroyharris", "tomfutago", "viniabussafi"]\') }}' + ) }} WITH diff --git a/models/_project/balancer/balancer_trades.sql b/models/_project/balancer/trades/balancer_trades.sql similarity index 100% rename from models/_project/balancer/balancer_trades.sql rename to models/_project/balancer/trades/balancer_trades.sql diff --git a/models/_project/balancer/trades/base/_schema.yml b/models/_project/balancer/trades/base/_schema.yml new file mode 100644 index 00000000000..4a0bd85156f --- /dev/null +++ b/models/_project/balancer/trades/base/_schema.yml @@ -0,0 +1,149 @@ +version: 2 + +models: + - name: balancer_base_trades + meta: + blockchain: base + sector: dex + contributors: bizzyvinci, viniabussafi + config: + tags: ['balancer', 'base', 'amm', 'trades', 'dex'] + description: > + DEX trades on balancer on base + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - block_date + - blockchain + - project + - version + - tx_hash + - evt_index + - check_dex_seed: + blockchain: base + project: balancer + version: 2 + columns: + - &blockchain + name: blockchain + description: "Blockchain" + - &project + name: project + description: "Project name (balancer)" + - &version + name: version + description: "Version of the project" + - &block_month + name: block_month + description: "Block month in UTC" + - &block_date + name: block_date + description: "Block date in UTC" + - &block_time + name: block_time + description: 'Block time in UTC' + - &block_number + name: block_number + description: 'Block number' + - &token_bought_symbol + name: token_bought_symbol + description: "Token symbol for token bought in the trade" + - &token_sold_symbol + name: token_sold_symbol + description: "Token symbol for token sold in the trade" + - &token_pair + name: token_pair + description: "Token symbol pair for each token involved in the trade" + - &token_bought_amount + name: token_bought_amount + description: "Value of the token bought at time of execution in the original currency" + - &token_sold_amount + name: token_sold_amount + description: "Value of the token sold at time of execution in the original currency" + - &token_bought_amount_raw + name: token_bought_amount_raw + description: "Raw value of the token bought at time of execution in the original currency" + - &token_sold_amount_raw + name: token_sold_amount_raw + description: "Raw value of the token sold at time of execution in the original currency" + - &amount_usd + name: amount_usd + description: "USD value of the trade at time of execution" + - &token_bought_address + name: token_bought_address + description: "Contract address of the token bought" + - &token_sold_address + name: token_sold_address + description: "Contract address of the token sold" + - &taker + name: taker + description: "Address of trader who purchased a token" + - &maker + name: maker + description: "Address of trader who sold a token" + - &pool_id + name: pool_id + description: "Unique encoded identifier that refers to each pool" + - &swap_fee + name: swap_fee + description: 'Swap fee' + - &project_contract_address + name: project_contract_address + description: "Pool address" + - &pool_symbol + name: pool_symbol + description: "Token symbols, followed by their respective weights, if applicable" + - &pool_type + name: pool_type + description: "Pool attributes, determined by the pool's factory" + - &tx_hash + name: tx_hash + description: "Tx. Hash" + - &tx_from + name: tx_from + description: "transaction.from" + - &tx_to + name: tx_to + description: "transaction.to" + - &evt_index + name: evt_index + description: 'Event index' + + - name: balancer_v2_base_trades + meta: + blockchain: base + sector: dex + contributors: bizzyvinci, thetroyharris, tomfutago, viniabussafi + config: + tags: [ 'balancer', 'base', 'amm', 'trades', 'dex', 'beta' ] + description: > + DEX trades on balancer v2 on base + columns: + - *blockchain + - *project + - *version + - *block_month + - *block_date + - *block_time + - *block_number + - *token_bought_symbol + - *token_sold_symbol + - *token_pair + - *token_bought_amount + - *token_sold_amount + - *token_bought_amount_raw + - *token_sold_amount_raw + - *amount_usd + - *token_bought_address + - *token_sold_address + - *taker + - *maker + - *project_contract_address + - *pool_symbol + - *pool_type + - *pool_id + - *swap_fee + - *tx_hash + - *tx_from + - *tx_to + - *evt_index \ No newline at end of file diff --git a/models/balancer/base/balancer_base_trades.sql b/models/_project/balancer/trades/base/balancer_base_trades.sql similarity index 100% rename from models/balancer/base/balancer_base_trades.sql rename to models/_project/balancer/trades/base/balancer_base_trades.sql diff --git a/models/balancer/base/balancer_v2_base_trades.sql b/models/_project/balancer/trades/base/balancer_v2_base_trades.sql similarity index 94% rename from models/balancer/base/balancer_v2_base_trades.sql rename to models/_project/balancer/trades/base/balancer_v2_base_trades.sql index ccf037af146..b94589a490a 100644 --- a/models/balancer/base/balancer_v2_base_trades.sql +++ b/models/_project/balancer/trades/base/balancer_v2_base_trades.sql @@ -4,9 +4,9 @@ alias = 'trades', materialized = 'view', post_hook = '{{ expose_spells(\'["base"]\', - "project", - "balancer_v2", - \'["mendesfabio", "jacektrocinski", "thetroyharris", "tomfutago", "viniabussafi"]\') }}' + spell_type = "project", + spell_name = "balancer", + contributors = \'["mendesfabio", "jacektrocinski", "thetroyharris", "tomfutago", "viniabussafi"]\') }}' ) }} diff --git a/models/_project/balancer/trades/ethereum/_schema.yml b/models/_project/balancer/trades/ethereum/_schema.yml new file mode 100644 index 00000000000..42d29d7e17d --- /dev/null +++ b/models/_project/balancer/trades/ethereum/_schema.yml @@ -0,0 +1,145 @@ +version: 2 + +models: + - name: balancer_ethereum_trades + meta: + blockchain: ethereum + sector: dex + contributors: bizzyvinci, thetroyharris, viniabussafi + config: + tags: ['balancer', 'ethereum', 'amm', 'trades', 'dex'] + description: > + DEX trades on balancer on ethereum + columns: + - &blockchain + name: blockchain + description: "Blockchain" + - &project + name: project + description: "Project name (balancer)" + - &version + name: version + description: "Version of the project" + - &block_month + name: block_month + description: "Block month in UTC" + - &block_date + name: block_date + description: "Block date in UTC" + - &block_time + name: block_time + description: 'Block time in UTC' + - &block_number + name: block_number + description: 'Block number' + - &token_bought_symbol + name: token_bought_symbol + description: "Token symbol for token bought in the trade" + - &token_sold_symbol + name: token_sold_symbol + description: "Token symbol for token sold in the trade" + - &token_pair + name: token_pair + description: "Token symbol pair for each token involved in the trade" + - &token_bought_amount + name: token_bought_amount + description: "Value of the token bought at time of execution in the original currency" + - &token_sold_amount + name: token_sold_amount + description: "Value of the token sold at time of execution in the original currency" + - &token_bought_amount_raw + name: token_bought_amount_raw + description: "Raw value of the token bought at time of execution in the original currency" + - &token_sold_amount_raw + name: token_sold_amount_raw + description: "Raw value of the token sold at time of execution in the original currency" + - &amount_usd + name: amount_usd + description: "USD value of the trade at time of execution" + - &token_bought_address + name: token_bought_address + description: "Contract address of the token bought" + - &token_sold_address + name: token_sold_address + description: "Contract address of the token sold" + - &taker + name: taker + description: "Address of trader who purchased a token" + - &maker + name: maker + description: "Address of trader who sold a token" + - &pool_id + name: pool_id + description: "Unique encoded identifier that refers to each pool" + - &swap_fee + name: swap_fee + description: 'Swap fee' + - &project_contract_address + name: project_contract_address + description: "Pool address" + - &pool_symbol + name: pool_symbol + description: "Token symbols, followed by their respective weights, if applicable" + - &pool_type + name: pool_type + description: "Pool attributes, determined by the pool's factory" + - &tx_hash + name: tx_hash + description: "Tx. Hash" + - &tx_from + name: tx_from + description: "transaction.from" + - &tx_to + name: tx_to + description: "transaction.to" + - &evt_index + name: evt_index + description: 'Event index' + + - name: balancer_v1_ethereum_trades + meta: + blockchain: ethereum + sector: dex + contributors: bizzyvinci, thetroyharris, viniabussafi + config: + tags: [ 'balancer', 'ethereum', 'amm', 'trades', 'dex' ] + description: > + DEX trades on balancer v1 on ethereum + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - block_time + - tx_hash + - evt_index + - check_dex_seed: + blockchain: ethereum + project: balancer + version: 1 + columns: + - *blockchain + - *project + - *version + - *block_month + - *block_date + - *block_time + - *token_bought_symbol + - *token_sold_symbol + - *token_pair + - *token_bought_amount + - *token_sold_amount + - *token_bought_amount_raw + - *token_sold_amount_raw + - *amount_usd + - *token_bought_address + - *token_sold_address + - *taker + - *maker + - *pool_id + - *swap_fee + - *project_contract_address + - *pool_symbol + - *pool_type + - *tx_hash + - *tx_from + - *tx_to + - *evt_index \ No newline at end of file diff --git a/models/balancer/ethereum/balancer_ethereum_trades.sql b/models/_project/balancer/trades/ethereum/balancer_ethereum_trades.sql similarity index 100% rename from models/balancer/ethereum/balancer_ethereum_trades.sql rename to models/_project/balancer/trades/ethereum/balancer_ethereum_trades.sql diff --git a/models/balancer/ethereum/balancer_v1_ethereum_trades.sql b/models/_project/balancer/trades/ethereum/balancer_v1_ethereum_trades.sql similarity index 100% rename from models/balancer/ethereum/balancer_v1_ethereum_trades.sql rename to models/_project/balancer/trades/ethereum/balancer_v1_ethereum_trades.sql diff --git a/models/balancer/ethereum/balancer_v2_ethereum_trades.sql b/models/_project/balancer/trades/ethereum/balancer_v2_ethereum_trades.sql similarity index 94% rename from models/balancer/ethereum/balancer_v2_ethereum_trades.sql rename to models/_project/balancer/trades/ethereum/balancer_v2_ethereum_trades.sql index 3fe902cf12b..dfb4c2439bf 100644 --- a/models/balancer/ethereum/balancer_v2_ethereum_trades.sql +++ b/models/_project/balancer/trades/ethereum/balancer_v2_ethereum_trades.sql @@ -4,9 +4,9 @@ alias = 'trades', materialized = 'view', post_hook = '{{ expose_spells(\'["ethereum"]\', - "project", - "balancer_v2", - \'["mendesfabio", "jacektrocinski", "thetroyharris", "tomfutago", "viniabussafi"]\') }}' + spell_type = "project", + spell_name = "balancer", + contributors = \'["mendesfabio", "jacektrocinski", "thetroyharris", "tomfutago", "viniabussafi"]\') }}' ) }} diff --git a/models/_project/balancer/trades/gnosis/_schema.yml b/models/_project/balancer/trades/gnosis/_schema.yml new file mode 100644 index 00000000000..ae5ae4065a2 --- /dev/null +++ b/models/_project/balancer/trades/gnosis/_schema.yml @@ -0,0 +1,149 @@ +version: 2 + +models: + - name: balancer_gnosis_trades + meta: + blockchain: gnosis + sector: dex + contributors: bizzyvinci, viniabussafi + config: + tags: ['balancer', 'gnosis', 'amm', 'trades', 'dex'] + description: > + DEX trades on balancer on gnosis + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - block_date + - blockchain + - project + - version + - tx_hash + - evt_index + - check_dex_seed: + blockchain: gnosis + project: balancer + version: 2 + columns: + - &blockchain + name: blockchain + description: "Blockchain" + - &project + name: project + description: "Project name (balancer)" + - &version + name: version + description: "Version of the project" + - &block_month + name: block_month + description: "Block month in UTC" + - &block_date + name: block_date + description: "Block date in UTC" + - &block_time + name: block_time + description: 'Block time in UTC' + - &block_number + name: block_number + description: 'Block number' + - &token_bought_symbol + name: token_bought_symbol + description: "Token symbol for token bought in the trade" + - &token_sold_symbol + name: token_sold_symbol + description: "Token symbol for token sold in the trade" + - &token_pair + name: token_pair + description: "Token symbol pair for each token involved in the trade" + - &token_bought_amount + name: token_bought_amount + description: "Value of the token bought at time of execution in the original currency" + - &token_sold_amount + name: token_sold_amount + description: "Value of the token sold at time of execution in the original currency" + - &token_bought_amount_raw + name: token_bought_amount_raw + description: "Raw value of the token bought at time of execution in the original currency" + - &token_sold_amount_raw + name: token_sold_amount_raw + description: "Raw value of the token sold at time of execution in the original currency" + - &amount_usd + name: amount_usd + description: "USD value of the trade at time of execution" + - &token_bought_address + name: token_bought_address + description: "Contract address of the token bought" + - &token_sold_address + name: token_sold_address + description: "Contract address of the token sold" + - &taker + name: taker + description: "Address of trader who purchased a token" + - &maker + name: maker + description: "Address of trader who sold a token" + - &pool_id + name: pool_id + description: "Unique encoded identifier that refers to each pool" + - &swap_fee + name: swap_fee + description: 'Swap fee' + - &project_contract_address + name: project_contract_address + description: "Pool address" + - &pool_symbol + name: pool_symbol + description: "Token symbols, followed by their respective weights, if applicable" + - &pool_type + name: pool_type + description: "Pool attributes, determined by the pool's factory" + - &tx_hash + name: tx_hash + description: "Tx. Hash" + - &tx_from + name: tx_from + description: "transaction.from" + - &tx_to + name: tx_to + description: "transaction.to" + - &evt_index + name: evt_index + description: 'Event index' + + - name: balancer_v2_gnosis_trades + meta: + blockchain: gnosis + sector: dex + contributors: bizzyvinci, thetroyharris, tomfutago, viniabussafi + config: + tags: [ 'balancer', 'gnosis', 'amm', 'trades', 'dex', 'beta' ] + description: > + DEX trades on balancer v2 on gnosis + columns: + - *blockchain + - *project + - *version + - *block_month + - *block_date + - *block_time + - *block_number + - *token_bought_symbol + - *token_sold_symbol + - *token_pair + - *token_bought_amount + - *token_sold_amount + - *token_bought_amount_raw + - *token_sold_amount_raw + - *amount_usd + - *token_bought_address + - *token_sold_address + - *taker + - *maker + - *project_contract_address + - *pool_symbol + - *pool_type + - *pool_id + - *swap_fee + - *tx_hash + - *tx_from + - *tx_to + - *evt_index \ No newline at end of file diff --git a/models/balancer/gnosis/balancer_gnosis_trades.sql b/models/_project/balancer/trades/gnosis/balancer_gnosis_trades.sql similarity index 100% rename from models/balancer/gnosis/balancer_gnosis_trades.sql rename to models/_project/balancer/trades/gnosis/balancer_gnosis_trades.sql diff --git a/models/balancer/gnosis/balancer_v2_gnosis_trades.sql b/models/_project/balancer/trades/gnosis/balancer_v2_gnosis_trades.sql similarity index 94% rename from models/balancer/gnosis/balancer_v2_gnosis_trades.sql rename to models/_project/balancer/trades/gnosis/balancer_v2_gnosis_trades.sql index c895c351328..090b5b9e737 100644 --- a/models/balancer/gnosis/balancer_v2_gnosis_trades.sql +++ b/models/_project/balancer/trades/gnosis/balancer_v2_gnosis_trades.sql @@ -4,9 +4,9 @@ alias = 'trades', materialized = 'view', post_hook = '{{ expose_spells(\'["gnosis"]\', - "project", - "balancer_v2", - \'["mendesfabio", "jacektrocinski", "thetroyharris", "tomfutago", "viniabussafi"]\') }}' + spell_type = "project", + spell_name = "balancer", + contributors = \'["mendesfabio", "jacektrocinski", "thetroyharris", "tomfutago", "viniabussafi"]\') }}' ) }} diff --git a/models/_project/balancer/trades/optimism/_schema.yml b/models/_project/balancer/trades/optimism/_schema.yml new file mode 100644 index 00000000000..481a7f9073b --- /dev/null +++ b/models/_project/balancer/trades/optimism/_schema.yml @@ -0,0 +1,149 @@ +version: 2 + +models: + - name: balancer_optimism_trades + meta: + blockchain: optimism + sector: dex + contributors: bizzyvinci, viniabussafi + config: + tags: ['balancer', 'optimism', 'amm', 'trades', 'dex'] + description: > + DEX trades on balancer on optimism + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - block_date + - blockchain + - project + - version + - tx_hash + - evt_index + - check_dex_seed: + blockchain: optimism + project: balancer + version: 2 + columns: + - &blockchain + name: blockchain + description: "Blockchain" + - &project + name: project + description: "Project name (balancer)" + - &version + name: version + description: "Version of the project" + - &block_month + name: block_month + description: "Block month in UTC" + - &block_date + name: block_date + description: "Block date in UTC" + - &block_time + name: block_time + description: 'Block time in UTC' + - &block_number + name: block_number + description: 'Block number' + - &token_bought_symbol + name: token_bought_symbol + description: "Token symbol for token bought in the trade" + - &token_sold_symbol + name: token_sold_symbol + description: "Token symbol for token sold in the trade" + - &token_pair + name: token_pair + description: "Token symbol pair for each token involved in the trade" + - &token_bought_amount + name: token_bought_amount + description: "Value of the token bought at time of execution in the original currency" + - &token_sold_amount + name: token_sold_amount + description: "Value of the token sold at time of execution in the original currency" + - &token_bought_amount_raw + name: token_bought_amount_raw + description: "Raw value of the token bought at time of execution in the original currency" + - &token_sold_amount_raw + name: token_sold_amount_raw + description: "Raw value of the token sold at time of execution in the original currency" + - &amount_usd + name: amount_usd + description: "USD value of the trade at time of execution" + - &token_bought_address + name: token_bought_address + description: "Contract address of the token bought" + - &token_sold_address + name: token_sold_address + description: "Contract address of the token sold" + - &taker + name: taker + description: "Address of trader who purchased a token" + - &maker + name: maker + description: "Address of trader who sold a token" + - &pool_id + name: pool_id + description: "Unique encoded identifier that refers to each pool" + - &swap_fee + name: swap_fee + description: 'Swap fee' + - &project_contract_address + name: project_contract_address + description: "Pool address" + - &pool_symbol + name: pool_symbol + description: "Token symbols, followed by their respective weights, if applicable" + - &pool_type + name: pool_type + description: "Pool attributes, determined by the pool's factory" + - &tx_hash + name: tx_hash + description: "Tx. Hash" + - &tx_from + name: tx_from + description: "transaction.from" + - &tx_to + name: tx_to + description: "transaction.to" + - &evt_index + name: evt_index + description: 'Event index' + + - name: balancer_v2_optimism_trades + meta: + blockchain: optimism + sector: dex + contributors: bizzyvinci, thetroyharris, tomfutago, viniabussafi + config: + tags: [ 'balancer', 'optimism', 'amm', 'trades', 'dex', 'beta' ] + description: > + DEX trades on balancer v2 on optimism + columns: + - *blockchain + - *project + - *version + - *block_month + - *block_date + - *block_time + - *block_number + - *token_bought_symbol + - *token_sold_symbol + - *token_pair + - *token_bought_amount + - *token_sold_amount + - *token_bought_amount_raw + - *token_sold_amount_raw + - *amount_usd + - *token_bought_address + - *token_sold_address + - *taker + - *maker + - *project_contract_address + - *pool_symbol + - *pool_type + - *pool_id + - *swap_fee + - *tx_hash + - *tx_from + - *tx_to + - *evt_index \ No newline at end of file diff --git a/models/balancer/optimism/balancer_optimism_trades.sql b/models/_project/balancer/trades/optimism/balancer_optimism_trades.sql similarity index 100% rename from models/balancer/optimism/balancer_optimism_trades.sql rename to models/_project/balancer/trades/optimism/balancer_optimism_trades.sql diff --git a/models/balancer/optimism/balancer_v2_optimism_trades.sql b/models/_project/balancer/trades/optimism/balancer_v2_optimism_trades.sql similarity index 94% rename from models/balancer/optimism/balancer_v2_optimism_trades.sql rename to models/_project/balancer/trades/optimism/balancer_v2_optimism_trades.sql index 03327617f4f..b53e845ddd6 100644 --- a/models/balancer/optimism/balancer_v2_optimism_trades.sql +++ b/models/_project/balancer/trades/optimism/balancer_v2_optimism_trades.sql @@ -4,9 +4,9 @@ alias = 'trades', materialized = 'view', post_hook = '{{ expose_spells(\'["optimism"]\', - "project", - "balancer_v2", - \'["mendesfabio", "jacektrocinski", "thetroyharris", "tomfutago", "viniabussafi"]\') }}' + spell_type = "project", + spell_name = "balancer", + contributors = \'["mendesfabio", "jacektrocinski", "thetroyharris", "tomfutago", "viniabussafi"]\') }}' ) }} diff --git a/models/_project/balancer/trades/polygon/_schema.yml b/models/_project/balancer/trades/polygon/_schema.yml new file mode 100644 index 00000000000..c0dfa6ac51b --- /dev/null +++ b/models/_project/balancer/trades/polygon/_schema.yml @@ -0,0 +1,149 @@ +version: 2 + +models: + - name: balancer_polygon_trades + meta: + blockchain: polygon + sector: dex + contributors: bizzyvinci, viniabussafi + config: + tags: ['balancer', 'polygon', 'amm', 'trades', 'dex'] + description: > + DEX trades on balancer on polygon + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - block_date + - blockchain + - project + - version + - tx_hash + - evt_index + - check_dex_seed: + blockchain: polygon + project: balancer + version: 2 + columns: + - &blockchain + name: blockchain + description: "Blockchain" + - &project + name: project + description: "Project name (balancer)" + - &version + name: version + description: "Version of the project" + - &block_month + name: block_month + description: "Block month in UTC" + - &block_date + name: block_date + description: "Block date in UTC" + - &block_time + name: block_time + description: 'Block time in UTC' + - &block_number + name: block_number + description: 'Block number' + - &token_bought_symbol + name: token_bought_symbol + description: "Token symbol for token bought in the trade" + - &token_sold_symbol + name: token_sold_symbol + description: "Token symbol for token sold in the trade" + - &token_pair + name: token_pair + description: "Token symbol pair for each token involved in the trade" + - &token_bought_amount + name: token_bought_amount + description: "Value of the token bought at time of execution in the original currency" + - &token_sold_amount + name: token_sold_amount + description: "Value of the token sold at time of execution in the original currency" + - &token_bought_amount_raw + name: token_bought_amount_raw + description: "Raw value of the token bought at time of execution in the original currency" + - &token_sold_amount_raw + name: token_sold_amount_raw + description: "Raw value of the token sold at time of execution in the original currency" + - &amount_usd + name: amount_usd + description: "USD value of the trade at time of execution" + - &token_bought_address + name: token_bought_address + description: "Contract address of the token bought" + - &token_sold_address + name: token_sold_address + description: "Contract address of the token sold" + - &taker + name: taker + description: "Address of trader who purchased a token" + - &maker + name: maker + description: "Address of trader who sold a token" + - &pool_id + name: pool_id + description: "Unique encoded identifier that refers to each pool" + - &swap_fee + name: swap_fee + description: 'Swap fee' + - &project_contract_address + name: project_contract_address + description: "Pool address" + - &pool_symbol + name: pool_symbol + description: "Token symbols, followed by their respective weights, if applicable" + - &pool_type + name: pool_type + description: "Pool attributes, determined by the pool's factory" + - &tx_hash + name: tx_hash + description: "Tx. Hash" + - &tx_from + name: tx_from + description: "transaction.from" + - &tx_to + name: tx_to + description: "transaction.to" + - &evt_index + name: evt_index + description: 'Event index' + + - name: balancer_v2_polygon_trades + meta: + blockchain: polygon + sector: dex + contributors: bizzyvinci, thetroyharris, tomfutago, viniabussafi + config: + tags: [ 'balancer', 'polygon', 'amm', 'trades', 'dex', 'beta' ] + description: > + DEX trades on balancer v2 on polygon + columns: + - *blockchain + - *project + - *version + - *block_month + - *block_date + - *block_time + - *block_number + - *token_bought_symbol + - *token_sold_symbol + - *token_pair + - *token_bought_amount + - *token_sold_amount + - *token_bought_amount_raw + - *token_sold_amount_raw + - *amount_usd + - *token_bought_address + - *token_sold_address + - *taker + - *maker + - *project_contract_address + - *pool_symbol + - *pool_type + - *pool_id + - *swap_fee + - *tx_hash + - *tx_from + - *tx_to + - *evt_index \ No newline at end of file diff --git a/models/balancer/polygon/balancer_polygon_trades.sql b/models/_project/balancer/trades/polygon/balancer_polygon_trades.sql similarity index 100% rename from models/balancer/polygon/balancer_polygon_trades.sql rename to models/_project/balancer/trades/polygon/balancer_polygon_trades.sql diff --git a/models/balancer/polygon/balancer_v2_polygon_trades.sql b/models/_project/balancer/trades/polygon/balancer_v2_polygon_trades.sql similarity index 94% rename from models/balancer/polygon/balancer_v2_polygon_trades.sql rename to models/_project/balancer/trades/polygon/balancer_v2_polygon_trades.sql index a17dabab52d..37b12105abe 100644 --- a/models/balancer/polygon/balancer_v2_polygon_trades.sql +++ b/models/_project/balancer/trades/polygon/balancer_v2_polygon_trades.sql @@ -4,9 +4,9 @@ alias = 'trades', materialized = 'view', post_hook = '{{ expose_spells(\'["polygon"]\', - "project", - "balancer_v2", - \'["mendesfabio", "jacektrocinski", "thetroyharris", "tomfutago", "viniabussafi"]\') }}' + spell_type = "project", + spell_name = "balancer", + contributors = \'["mendesfabio", "jacektrocinski", "thetroyharris", "tomfutago", "viniabussafi"]\') }}' ) }} diff --git a/models/_project/balancer/trades/zkevm/_schema.yml b/models/_project/balancer/trades/zkevm/_schema.yml new file mode 100644 index 00000000000..80f42ffe980 --- /dev/null +++ b/models/_project/balancer/trades/zkevm/_schema.yml @@ -0,0 +1,110 @@ +version: 2 + +models: + - name: balancer_zkevm_trades + meta: + blockchain: zkevm + sector: dex + contributors: bizzyvinci, viniabussafi + config: + tags: ['balancer', 'zkevm', 'amm', 'trades', 'dex'] + description: > + DEX trades on balancer on zkevm + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - block_date + - blockchain + - project + - version + - tx_hash + - evt_index + - check_dex_seed: + blockchain: zkevm + project: balancer + version: 2 + columns: + - &blockchain + name: blockchain + description: "Blockchain" + - &project + name: project + description: "Project name (balancer)" + - &version + name: version + description: "Version of the project" + - &block_month + name: block_month + description: "Block month in UTC" + - &block_date + name: block_date + description: "Block date in UTC" + - &block_time + name: block_time + description: 'Block time in UTC' + - &block_number + name: block_number + description: 'Block number' + - &token_bought_symbol + name: token_bought_symbol + description: "Token symbol for token bought in the trade" + - &token_sold_symbol + name: token_sold_symbol + description: "Token symbol for token sold in the trade" + - &token_pair + name: token_pair + description: "Token symbol pair for each token involved in the trade" + - &token_bought_amount + name: token_bought_amount + description: "Value of the token bought at time of execution in the original currency" + - &token_sold_amount + name: token_sold_amount + description: "Value of the token sold at time of execution in the original currency" + - &token_bought_amount_raw + name: token_bought_amount_raw + description: "Raw value of the token bought at time of execution in the original currency" + - &token_sold_amount_raw + name: token_sold_amount_raw + description: "Raw value of the token sold at time of execution in the original currency" + - &amount_usd + name: amount_usd + description: "USD value of the trade at time of execution" + - &token_bought_address + name: token_bought_address + description: "Contract address of the token bought" + - &token_sold_address + name: token_sold_address + description: "Contract address of the token sold" + - &taker + name: taker + description: "Address of trader who purchased a token" + - &maker + name: maker + description: "Address of trader who sold a token" + - &pool_id + name: pool_id + description: "Unique encoded identifier that refers to each pool" + - &swap_fee + name: swap_fee + description: 'Swap fee' + - &project_contract_address + name: project_contract_address + description: "Pool address" + - &pool_symbol + name: pool_symbol + description: "Token symbols, followed by their respective weights, if applicable" + - &pool_type + name: pool_type + description: "Pool attributes, determined by the pool's factory" + - &tx_hash + name: tx_hash + description: "Tx. Hash" + - &tx_from + name: tx_from + description: "transaction.from" + - &tx_to + name: tx_to + description: "transaction.to" + - &evt_index + name: evt_index + description: 'Event index' \ No newline at end of file diff --git a/models/balancer/zkevm/balancer_v2_zkevm_trades.sql b/models/_project/balancer/trades/zkevm/balancer_v2_zkevm_trades.sql similarity index 94% rename from models/balancer/zkevm/balancer_v2_zkevm_trades.sql rename to models/_project/balancer/trades/zkevm/balancer_v2_zkevm_trades.sql index 340fbe1dbd8..36cc38e4a44 100644 --- a/models/balancer/zkevm/balancer_v2_zkevm_trades.sql +++ b/models/_project/balancer/trades/zkevm/balancer_v2_zkevm_trades.sql @@ -4,9 +4,9 @@ alias = 'trades', materialized = 'view', post_hook = '{{ expose_spells(\'["zkevm"]\', - "project", - "balancer_v2", - \'["mendesfabio", "jacektrocinski", "thetroyharris", "tomfutago", "viniabussafi"]\') }}' + spell_type = "project", + spell_name = "balancer", + contributors = \'["mendesfabio", "jacektrocinski", "thetroyharris", "tomfutago", "viniabussafi"]\') }}' ) }} diff --git a/models/balancer/zkevm/balancer_zkevm_trades.sql b/models/_project/balancer/trades/zkevm/balancer_zkevm_trades.sql similarity index 100% rename from models/balancer/zkevm/balancer_zkevm_trades.sql rename to models/_project/balancer/trades/zkevm/balancer_zkevm_trades.sql diff --git a/models/_project/balancer/vebal/ethereum/_schema.yml b/models/_project/balancer/vebal/ethereum/_schema.yml new file mode 100644 index 00000000000..ab2ba4d4bdf --- /dev/null +++ b/models/_project/balancer/vebal/ethereum/_schema.yml @@ -0,0 +1,91 @@ +version: 2 + +models: + - name: balancer_ethereum_vebal_balances_day + meta: + blockchain: ethereum + project: balancer + contributors: markusbkoch, mendesfabio, victorstefenon, viniabussafi + config: + tags: ['balancer', 'ethereum', 'vebal', 'day'] + description: > + Daily balances of veBAL per wallet + Depends on veBAL_call_create_lock, veBAL_evt_Deposit and veBAL_evt_Withdraw + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - day + - wallet_address + columns: + - name: day + - name: wallet_address + description: "Address of the wallet holding the veBAL" + - name: bpt_balance + description: "Amount of BPT held in the veBAL lock" + - name: vebal_balance + description: "Amount of veBAL" + - name: lock_time + description: "Amount of time the BPT was locked for at the last time the lock was updated" + + - name: balancer_ethereum_vebal_slopes + meta: + blockchain: ethereum + project: balancer + contributors: markusbkoch, mendesfabio, victorstefenon, viniabussafi + config: + tags: ['balancer', 'ethereum', 'vebal', 'slope'] + description: > + Slope and bias of veBAL per wallet after each balance update + Depends on veBAL_call_create_lock, veBAL_evt_Deposit and veBAL_evt_Withdraw + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - block_number + - wallet_address + columns: + - name: block_number + - name: block_time + - name: block_timestamp + description: "Block timestamp" + - name: wallet_address + description: "Address of the wallet holding the veBAL" + - name: bpt_balance + description: "Amount of BPT held in the veBAL lock" + - name: unlocked_at + description: "Timestamp at which B-80BAL-20WETH BPT can be unlocked" + - name: slope + description: "veBAL decay rate (per second)" + - name: bias + description: "veBAL balance at the moment user locks or re-locks" + - name: block_date + description: "Block time trunc to date" + + - name: balancer_ethereum_vebal_votes + meta: + blockchain: ethereum + project: balancer + contributors: markusbkoch, mendesfabio, stefenon, viniabussafi + config: + tags: ['balancer', 'ethereum', 'vebal', 'votes'] + description: > + Records of votes for Balancer gauges by provider at each voting round + Depends on GaugeController_evt_VoteForGauge and the vebal_slopes spell + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - round_id + - gauge + - provider + columns: + - name: round_id + description: "ID of the voting round" + - name: start_date + description: "Day of the voting round start date" + - name: end_date + description: "Day of the voting round end date" + - name: gauge + description: "Address of the gauge which provider votes for" + - name: provider + description: "Address of the wallet which voted for the gauge" + - name: vote + description: "Weight of the vote performed by the provider for the gauge" \ No newline at end of file diff --git a/models/balancer/ethereum/balancer_ethereum_vebal_balances_day.sql b/models/_project/balancer/vebal/ethereum/balancer_ethereum_vebal_balances_day.sql similarity index 94% rename from models/balancer/ethereum/balancer_ethereum_vebal_balances_day.sql rename to models/_project/balancer/vebal/ethereum/balancer_ethereum_vebal_balances_day.sql index 31df281cbcf..dbeb8065ba9 100644 --- a/models/balancer/ethereum/balancer_ethereum_vebal_balances_day.sql +++ b/models/_project/balancer/vebal/ethereum/balancer_ethereum_vebal_balances_day.sql @@ -1,12 +1,11 @@ {{ config( schema="balancer_ethereum", - alias = 'vebal_balances_day', post_hook='{{ expose_spells(\'["ethereum"]\', - "project", - "balancer", - \'["markusbkoch", "mendesfabio", "stefenon", "viniabussafi"]\') }}' + spell_type = "project", + spell_name = "balancer", + contributors = \'["markusbkoch", "mendesfabio", "stefenon", "viniabussafi"]\') }}' ) }} diff --git a/models/balancer/ethereum/balancer_ethereum_vebal_slopes.sql b/models/_project/balancer/vebal/ethereum/balancer_ethereum_vebal_slopes.sql similarity index 93% rename from models/balancer/ethereum/balancer_ethereum_vebal_slopes.sql rename to models/_project/balancer/vebal/ethereum/balancer_ethereum_vebal_slopes.sql index 7f549cd9a81..bf49f4f5471 100644 --- a/models/balancer/ethereum/balancer_ethereum_vebal_slopes.sql +++ b/models/_project/balancer/vebal/ethereum/balancer_ethereum_vebal_slopes.sql @@ -1,12 +1,11 @@ {{ config( - schema="balancer_ethereum", - + schema="balancer_ethereum", alias = 'vebal_slopes', post_hook='{{ expose_spells(\'["ethereum"]\', - "project", - "balancer", - \'["markusbkoch", "mendesfabio", "stefenon", "viniabussafi"]\') }}' + spell_type = "project", + spell_name = "balancer", + contributors = \'["markusbkoch", "mendesfabio", "stefenon", "viniabussafi"]\') }}' ) }} diff --git a/models/balancer/ethereum/balancer_ethereum_vebal_votes.sql b/models/_project/balancer/vebal/ethereum/balancer_ethereum_vebal_votes.sql similarity index 92% rename from models/balancer/ethereum/balancer_ethereum_vebal_votes.sql rename to models/_project/balancer/vebal/ethereum/balancer_ethereum_vebal_votes.sql index 17929d1105c..d52c0fe757f 100644 --- a/models/balancer/ethereum/balancer_ethereum_vebal_votes.sql +++ b/models/_project/balancer/vebal/ethereum/balancer_ethereum_vebal_votes.sql @@ -1,13 +1,13 @@ {{ config( - + schema = 'balancer_ethereum', alias = 'vebal_votes', materialized = 'table', file_format = 'delta', post_hook='{{ expose_spells(\'["ethereum"]\', - "project", - "balancer", - \'["markusbkoch", "mendesfabio", "stefenon", "viniabussafi"]\') }}' + spell_type = "project", + spell_name = "balancer", + contributors = \'["markusbkoch", "mendesfabio", "stefenon", "viniabussafi"]\') }}' ) }} diff --git a/models/balancer/arbitrum/balancer_arbitrum_schema.yml b/models/balancer/arbitrum/balancer_arbitrum_schema.yml deleted file mode 100644 index c533ff3ff10..00000000000 --- a/models/balancer/arbitrum/balancer_arbitrum_schema.yml +++ /dev/null @@ -1,432 +0,0 @@ -version: 2 - -models: - - name: balancer_v2_arbitrum_pools_fees - meta: - blockchain: arbitrum - project: balancer_v2 - contributors: jacektrocinski, thetroyharris, viniabussafi - config: - tags: ['arbitrum', 'balancer', 'pools_fees'] - description: > - Balancer v2 swap fees stored at the pool level. - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - block_number - - tx_hash - - index - columns: - - name: blockchain - - name: version - - &contract_address - name: contract_address - description: 'Arbitrum address for the liquidity pool used in transaction' - tests: - - not_null - - &tx_hash - name: tx_hash - description: 'Transaction hash' - tests: - - not_null - - &index - name: index - description: '' - tests: - - not_null - - &tx_index - name: tx_index - description: '' - tests: - - not_null - - &block_time - name: block_time - description: 'Block time in UTC' - tests: - - not_null - - &block_number - name: block_number - description: '' - tests: - - not_null - - &swap_fee_percentage - name: swap_fee_percentage - description: 'Swap fees for the pool, values are returned with 18 decimals (1e18 meaning 100%)' - tests: - - not_null - - - name: balancer_v2_arbitrum_transfers_bpt - meta: - blockchain: arbitrum - project: balancer_v2 - contributors: victorstefenon, thetroyharris, viniabussafi - config: - tags: ['arbitrum', 'bpt', 'transfers'] - description: > - Balancer Pool Token (BPT) transfer logs on Balancer, an automated portfolio manager and trading platform, on Arbitrum. - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - evt_tx_hash - - evt_index - - block_date - columns: - - &blockchain - name: blockchain - description: "Blockchain" - - name: version - - *contract_address - - &block_date - name: block_date - description: "UTC event block date of each DEX trade" - - &block_month - name: block_month - description: "UTC event block month of each DEX trade" - - &evt_tx_hash - name: evt_tx_hash - description: 'Transaction hash of transfer event' - - &evt_index - name: evt_index - description: 'Event index' - - &evt_block_time - name: evt_block_time - description: 'Block time of transfer event' - - &evt_block_number - name: evt_block_number - description: 'Block number of transfer event' - - &from - name: from - description: 'Address of BPT provider of transfer event' - - &to - name: to - description: 'Address of BPT receiver of transfer event' - - &value - name: value - description: 'Amount of BPT transferred in transfer event' - - - name: balancer_arbitrum_pools_tokens_weights - meta: - blockchain: arbitrum - project: balancer - contributors: jacektrocinski, viniabussafi - config: - tags: ['arbitrum', 'balancer', 'pools', 'tokens', 'weights'] - description: > - Token weights in Balancer pools. - columns: - - *blockchain - - name: version - - &pool_id - name: pool_id - description: 'Unique encoded identifier that refers to each pool' - tests: - - not_null - - &token_address - name: token_address - description: 'Contract address for the token' - - &normalized_weight - name: normalized_weight - description: 'Weight of the token in the pool.' - - - name: balancer_v2_arbitrum_pools_tokens_weights - meta: - blockchain: arbitrum - project: balancer - contributors: jacektrocinski, viniabussafi - config: - tags: ['arbitrum', 'balancer', 'pools', 'tokens', 'weights'] - description: > - Token weights in Balancer v2 pools. - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - pool_id - - token_address - columns: - - *blockchain - - name: version - - *pool_id - - *token_address - - *normalized_weight - - - name: balancer_arbitrum_trades - meta: - blockchain: arbitrum - sector: dex - contributors: bizzyvinci - config: - tags: ['balancer', 'arbitrum', 'amm', 'trades', 'dex'] - description: > - DEX trades on balancer on arbitrum - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - block_date - - blockchain - - project - - version - - tx_hash - - evt_index - - check_dex_seed: - blockchain: arbitrum - project: balancer - version: 2 - columns: - - *blockchain - - &project - name: project - description: "Project name (balancer)" - - &version - name: version - description: "Version of the project" - - *block_month - - *block_date - - *block_time - - &token_bought_symbol - name: token_bought_symbol - description: "Token symbol for token bought in the trade" - - &token_sold_symbol - name: token_sold_symbol - description: "Token symbol for token sold in the trade" - - &token_pair - name: token_pair - description: "Token symbol pair for each token involved in the trade" - - &token_bought_amount - name: token_bought_amount - description: "Value of the token bought at time of execution in the original currency" - - &token_sold_amount - name: token_sold_amount - description: "Value of the token sold at time of execution in the original currency" - - &token_bought_amount_raw - name: token_bought_amount_raw - description: "Raw value of the token bought at time of execution in the original currency" - - &token_sold_amount_raw - name: token_sold_amount_raw - description: "Raw value of the token sold at time of execution in the original currency" - - &amount_usd - name: amount_usd - description: "USD value of the trade at time of execution" - - &token_bought_address - name: token_bought_address - description: "Contract address of the token bought" - - &token_sold_address - name: token_sold_address - description: "Contract address of the token sold" - - &taker - name: taker - description: "Address of trader who purchased a token" - - &maker - name: maker - description: "Address of trader who sold a token" - - *pool_id - - &swap_fee - name: swap_fee - description: 'Swap fee' - - &project_contract_address - name: project_contract_address - description: "Pool address" - - name: pool_symbol - - name: pool_type - - *tx_hash - - &tx_from - name: tx_from - description: "transaction.from" - - &tx_to - name: tx_to - description: "transaction.to" - - *evt_index - - - name: balancer_v2_arbitrum_trades - meta: - blockchain: arbitrum - sector: dex - contributors: bizzyvinci, thetroyharris, tomfutago, viniabussafi - config: - tags: [ 'balancer', 'arbitrum', 'amm', 'trades', 'dex', 'beta' ] - description: > - DEX trades on balancer v2 on arbitrum - columns: - - *blockchain - - *project - - *version - - *block_month - - *block_date - - *block_time - - *block_number - - *token_bought_symbol - - *token_sold_symbol - - *token_pair - - *token_bought_amount - - *token_sold_amount - - *token_bought_amount_raw - - *token_sold_amount_raw - - *amount_usd - - *token_bought_address - - *token_sold_address - - *taker - - *maker - - *project_contract_address - - name: pool_symbol - - name: pool_type - - *pool_id - - *swap_fee - - *tx_hash - - *tx_from - - *tx_to - - *evt_index - - - name: balancer_v2_arbitrum_liquidity - meta: - blockchain: arbitrum - project: balancer_v2 - contributors: victorstefenon, viniabussafi, thetroyharris - config: - tags: ['arbitrum', 'balancer', 'pools', 'liquidity'] - description: > - Balancer v2 pools liquidity by token in Arbitrum. - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - day - - pool_id - - token_address - columns: - - name: day - description: 'UTC event block time truncated to the day mark' - - *pool_id - - name: pool_address - - name: pool_symbol - description: 'Symbol of the pool, consisting of the symbol of its tokens and their respective weights' - - name: version - description: 'Version of Balancer in which pool was deployed' - - name: blockchain - description: 'Blockchain in which pool was deployed' - - *token_address - - name: token_symbol - description: 'Symbol of the token' - - name: token_balance_raw - description: 'Raw balance of the token in the pool' - - name: token_balance - description: 'Scaled balance of the token in the pool' - - name: protocol_liquidity_usd - description: 'Liquidity of the token in the pool in USD, except BPTs' - - name: protocol_liquidity_eth - description: 'Liquidity of the token in the pool in ETH, except BPTs' - - name: pool_liquidity_usd - description: 'Liquidity of the token in the pool in USD, including BPTs' - - name: pool_liquidity_eth - description: 'Liquidity of the token in the pool in ETH, including BPTs' - - - - name: balancer_v2_arbitrum_flashloans - meta: - blockchain: arbitrum - sector: lending - contributors: hildobby - config: - tags: ['arbitrum', 'flashloans'] - description: > - All Balancer v2 flashloans on Arbitrum - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - blockchain - - tx_hash - - evt_index - columns: - - name: blockchain - - name: project - - name: version - - name: block_time - - name: block_number - - name: amount - - name: amount_usd - - name: tx_hash - - name: evt_index - - name: fee - - name: currency_contract - - name: currency_symbol - - name: recipient - - name: contract_address - - name: block_month - - - name: balancer_v2_arbitrum_bpt_prices - meta: - blockchain: arbitrum - project: balancer_v2 - contributors: victorstefenon, thetroyharris, viniabussafi - config: - tags: ['arbitrum', 'bpt', 'prices'] - description: > - Balancer Pool Token (BPT) daily price by pool on Balancer, an automated portfolio manager and trading platform. - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - blockchain - - day - - contract_address - columns: - - name: blockchain - - name: day - - name: version - - name: decimals - - name: contract_address - - name: bpt_price - - - name: balancer_v2_arbitrum_protocol_fee - meta: - blockchain: arbitrum - project: balancer_v2 - contributors: viniabussafi - config: - tags: ['arbitrum', 'revenue', 'fees'] - description: > - Daily Protocol Fee collected and Revenue by pool on Balancer, an automated portfolio manager and trading platform. - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - day - - pool_id - - token_address - columns: - - name: day - - name: pool_id - - name: pool_address - - name: pool_symbol - - name: version - - name: blockchain - - name: token_address - - name: token_symbol - - name: token_amount_raw - description: "Raw amount of revenues of the token in the pool" - - name: token_amount - description: "Amount of revenues of the token in the pool" - - name: protocol_fee_collected_usd - description: "Fee collected in the pool in USD" - - name: treasury_share - description: "Share of total revenue that is directed to Balancer DAO's treasury, as per BIPs 19, 161 and 371" - - name: treasury_revenue_usd - description: "Total revenue directed to Balancer DAO's treasury" - - - name: balancer_v2_arbitrum_bpt_supply - meta: - blockchain: arbiturm - project: balancer_v2 - contributors: thetroyharris, viniabussafi - config: - tags: ['arbiturm', 'bpt', 'supply'] - description: > - Balancer Pool Token (BPT) supply for ComposableStablePools versions 4 and 5. - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - day - - blockchain - - token_address - columns: - - name: day - - name: pool_type - - name: version - - name: blockchain - - name: token_address - - name: supply \ No newline at end of file diff --git a/models/balancer/avalanche_c/balancer_avalanche_c_schema.yml b/models/balancer/avalanche_c/balancer_avalanche_c_schema.yml deleted file mode 100644 index 93cc2e87629..00000000000 --- a/models/balancer/avalanche_c/balancer_avalanche_c_schema.yml +++ /dev/null @@ -1,405 +0,0 @@ -version: 2 - -models: - - - name: balancer_avalanche_c_trades - meta: - blockchain: avalanche_c - sector: dex - contributors: bizzyvinci - config: - tags: ['balancer', 'avalanche_c', 'amm', 'trades', 'dex'] - description: > - DEX trades on balancer on avalanche_c - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - block_date - - blockchain - - project - - version - - tx_hash - - evt_index - - check_dex_seed: - blockchain: avalanche_c - project: balancer - version: 2 - columns: - - &blockchain - name: blockchain - description: "Blockchain" - - &project - name: project - description: "Project name (balancer)" - - &version - name: version - description: "Version of the project" - - &block_month - name: block_month - description: "Block month in UTC" - - &block_date - name: block_date - description: "Block date in UTC" - - &block_time - name: block_time - description: 'Block time in UTC' - - &token_bought_symbol - name: token_bought_symbol - description: "Token symbol for token bought in the trade" - - &token_sold_symbol - name: token_sold_symbol - description: "Token symbol for token sold in the trade" - - &token_pair - name: token_pair - description: "Token symbol pair for each token involved in the trade" - - &token_bought_amount - name: token_bought_amount - description: "Value of the token bought at time of execution in the original currency" - - &token_sold_amount - name: token_sold_amount - description: "Value of the token sold at time of execution in the original currency" - - &token_bought_amount_raw - name: token_bought_amount_raw - description: "Raw value of the token bought at time of execution in the original currency" - - &token_sold_amount_raw - name: token_sold_amount_raw - description: "Raw value of the token sold at time of execution in the original currency" - - &amount_usd - name: amount_usd - description: "USD value of the trade at time of execution" - - &token_bought_address - name: token_bought_address - description: "Contract address of the token bought" - - &token_sold_address - name: token_sold_address - description: "Contract address of the token sold" - - &taker - name: taker - description: "Address of trader who purchased a token" - - &maker - name: maker - description: "Address of trader who sold a token" - - &pool_id - name: pool_id - description: 'Unique encoded identifier that refers to each pool' - - &swap_fee - name: swap_fee - description: 'Swap fee' - - &project_contract_address - name: project_contract_address - description: "Pool address" - - name: pool_symbol - - name: pool_type - - &tx_hash - name: tx_hash - description: "Transaction hash" - - &tx_from - name: tx_from - description: "transaction.from" - - &tx_to - name: tx_to - description: "transaction.to" - - &evt_index - name: evt_index - description: "Event index" - - - name: balancer_v2_avalanche_c_trades - meta: - blockchain: avalanche_c - sector: dex - contributors: bizzyvinci, thetroyharris, tomfutago, viniabussafi - config: - tags: [ 'balancer', 'avalanche_c', 'amm', 'trades', 'dex', 'beta' ] - description: > - DEX trades on balancer v2 on avalanche_c - columns: - - *blockchain - - *project - - *version - - *block_month - - *block_date - - *block_time - - name: block_number - - *token_bought_symbol - - *token_sold_symbol - - *token_pair - - *token_bought_amount - - *token_sold_amount - - *token_bought_amount_raw - - *token_sold_amount_raw - - *amount_usd - - *token_bought_address - - *token_sold_address - - *taker - - *maker - - *project_contract_address - - name: pool_symbol - - name: pool_type - - *pool_id - - *swap_fee - - *tx_hash - - *tx_from - - *tx_to - - *evt_index - - - name: balancer_avalanche_c_pools_tokens_weights - meta: - blockchain: avalanche_c - project: balancer - contributors: jacektrocinski, viniabussafi - config: - tags: ['avalanche_c', 'balancer', 'pools', 'tokens', 'weights'] - description: > - Token weights in Balancer pools. - columns: - - *blockchain - - name: version - - *pool_id - - &token_address - name: token_address - description: 'Contract address for the token' - - &normalized_weight - name: normalized_weight - description: 'Weight of the token in the pool.' - - - name: balancer_v2_avalanche_c_pools_tokens_weights - meta: - blockchain: avalanche_c - project: balancer - contributors: jacektrocinski, viniabussafi - config: - tags: ['avalanche_c', 'balancer', 'pools', 'tokens', 'weights'] - description: > - Token weights in Balancer v2 pools. - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - pool_id - - token_address - columns: - - *blockchain - - name: version - - *pool_id - - *token_address - - *normalized_weight - - - name: balancer_v2_avalanche_c_liquidity - meta: - blockchain: avalanche_c - project: balancer_v2 - contributors: victorstefenon, viniabussafi, thetroyharris - config: - tags: ['avalanche_c', 'balancer', 'pools', 'liquidity'] - description: > - Balancer v2 pools liquidity by token in avalanche_c. - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - day - - pool_id - - token_address - columns: - - name: day - description: 'UTC event block time truncated to the day mark' - - *pool_id - - name: pool_address - - name: pool_symbol - description: 'Symbol of the pool, consisting of the symbol of its tokens and their respective weights' - - name: version - description: 'Version of Balancer in which pool was deployed' - - name: blockchain - description: 'Blockchain in which pool was deployed' - - *token_address - - name: token_symbol - description: 'Symbol of the token' - - name: token_balance_raw - description: 'Raw balance of the token in the pool' - - name: token_balance - description: 'Scaled balance of the token in the pool' - - name: protocol_liquidity_usd - description: 'Liquidity of the token in the pool in USD, except BPTs' - - name: protocol_liquidity_eth - description: 'Liquidity of the token in the pool in ETH, except BPTs' - - name: pool_liquidity_usd - description: 'Liquidity of the token in the pool in USD, including BPTs' - - name: pool_liquidity_eth - description: 'Liquidity of the token in the pool in ETH, including BPTs' - - - - name: balancer_v2_avalanche_c_bpt_prices - meta: - blockchain: avalanche_c - project: balancer_v2 - contributors: victorstefenon, thetroyharris, viniabussafi - config: - tags: ['avalanche_c', 'bpt', 'prices'] - description: > - Balancer Pool Token (BPT) hourly median price by pool on Balancer, an automated portfolio manager and trading platform. - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - blockchain - - day - - contract_address - columns: - - name: blockchain - - name: day - - name: version - - name: decimals - - name: contract_address - - name: bpt_price - - - name: balancer_v2_avalanche_c_transfers_bpt - meta: - blockchain: avalanche_c - project: balancer_v2 - contributors: victorstefenon, thetroyharris, viniabussafi - config: - tags: ['avalanche_c', 'bpt', 'transfers'] - description: > - Balancer Pool Token (BPT) transfer logs on Balancer, an automated portfolio manager and trading platform, on Avalanche C Chain. - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - evt_tx_hash - - evt_index - - block_date - columns: - - name: blockchain - - name: version - - name: contract_address - - name: block_date - - name: block_month - - name: evt_tx_hash - - name: evt_index - - &evt_block_time - name: evt_block_time - description: 'Block time of transfer event' - - &evt_block_number - name: evt_block_number - description: 'Block number of transfer event' - - &from - name: from - description: 'Address of BPT provider of transfer event' - - &to - name: to - description: 'Address of BPT receiver of transfer event' - - &value - name: value - description: 'Amount of BPT transferred in transfer event' - - - name: balancer_v2_avalanche_c_pools_fees - meta: - blockchain: avalanche_c - project: balancer_v2 - contributors: jacektrocinski, thetroyharris, viniabussafi - config: - tags: ['avalanche_c', 'balancer', 'pools', 'fees'] - description: > - Balancer v2 swap fees stored at the pool level. - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - block_number - - tx_hash - - index - columns: - - name: blockchain - - name: version - - name: contract_address - - name: tx_hash - - name: index - - name: tx_index - - name: block_time - - name: block_number - - name: swap_fee_percentage - - - name: balancer_v2_avalanche_c_flashloans - meta: - blockchain: avalanche_c - sector: lending - contributors: hildobby, viniabussafi - config: - tags: ['avalanche_c', 'flashloans'] - description: > - All Balancer v2 flashloans on avalanche_c - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - blockchain - - tx_hash - - evt_index - columns: - - name: blockchain - - name: project - - name: version - - name: block_time - - name: block_number - - name: amount - - name: amount_usd - - name: tx_hash - - name: evt_index - - name: fee - - name: currency_contract - - name: currency_symbol - - name: recipient - - name: contract_address - - name: block_month - - - name: balancer_v2_avalanche_c_protocol_fee - meta: - blockchain: avalanche_c - project: balancer_v2 - contributors: viniabussafi - config: - tags: ['avalanche_c', 'revenue', 'fees'] - description: > - Daily Protocol Fee collected and Revenue by pool on Balancer, an automated portfolio manager and trading platform. - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - day - - pool_id - - token_address - columns: - - name: day - - name: pool_id - - name: pool_address - - name: pool_symbol - - name: version - - name: blockchain - - name: token_address - - name: token_symbol - - name: token_amount_raw - description: "Raw amount of revenues of the token in the pool" - - name: token_amount - description: "Amount of revenues of the token in the pool" - - name: protocol_fee_collected_usd - description: "Fee collected in the pool in USD" - - name: treasury_share - description: "Share of total revenue that is directed to Balancer DAO's treasury, as per BIPs 19, 161 and 371" - - name: treasury_revenue_usd - description: "Total revenue directed to Balancer DAO's treasury" - - - name: balancer_v2_avalanche_c_bpt_supply - meta: - blockchain: avalanche_c - project: balancer_v2 - contributors: thetroyharris, viniabussafi - config: - tags: ['avalanche_c', 'bpt', 'supply'] - description: > - Balancer Pool Token (BPT) supply for ComposableStablePools versions 4 and 5. - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - day - - blockchain - - token_address - columns: - - name: day - - name: pool_type - - name: version - - name: blockchain - - name: token_address - - name: supply \ No newline at end of file diff --git a/models/balancer/balancer_schema.yml b/models/balancer/balancer_schema.yml deleted file mode 100644 index 5e7fb29a97b..00000000000 --- a/models/balancer/balancer_schema.yml +++ /dev/null @@ -1,365 +0,0 @@ -version: 2 - -models: - - name: balancer_gauge_mappings - meta: - blockchain: optimism - sector: dex - contributors: msilb7 - config: - tags: ['balancer', 'amm', 'trades', 'dex', 'incentives'] - description: > - Gauge to Pool mappings for balancer on all chains - columns: - - &blockchain - name: blockchain - description: "Blockchain" - - &project - name: project - description: "Project name (balancer)" - - &version - name: version - description: "Version of the project" - - &pool_contract - name: pool_contract - description: "Address of the liquidity pool contract" - - &pool_id - name: pool_id - description: "Pool id" - - &incentives_contract - name: incentives_contract - description: "Address of the contract where incentives are stored and emitted." - - &incentives_type - name: incentives_type - description: "Description of the incentives address type." - - &evt_block_time - name: evt_block_time - description: 'Block time in UTC' - - &evt_block_number - name: evt_block_number - description: 'Block Number' - - &contract_address - name: contract_address - description: 'Gauge Creator Contract Address' - - &evt_tx_hash - name: evt_tx_hash - description: 'Tx Hash' - - &evt_index - name: evt_index - description: 'Event index' - - - name: balancer_flashloans - meta: - blockchain: ethereum, arbitrum, optimism, polygon, gnosis - sector: lending - contributors: hildobby - config: - tags: ['ethereum', 'arbitrum', 'optimism', 'polygon', 'gnosis','avalanche_c', 'base', 'flashloans'] - description: > - All Balancer flashloans - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - blockchain - - tx_hash - - evt_index - columns: - - name: blockchain - - name: project - - name: version - - name: block_time - - name: block_month - - name: block_number - - name: amount - - name: amount_usd - - name: tx_hash - - name: evt_index - - name: fee - - name: currency_contract - - name: currency_symbol - - name: recipient - - name: contract_address - - name: block_month - - - name: balancer_bpt_prices - meta: - blockchain: ethereum, arbitrum, optimism, polygon, gnosis, avalanche_c, base - sector: dex - contributors: thetroyharris, victorstefenon, viniabussafi - config: - tags: ['balancer', 'amm', 'dex', 'bpt', 'prices', 'ethereum', 'arbitrum', 'optimism', 'polygon', 'gnosis', 'avalanche_c', 'base'] - description: > - Balancer Pool Token (BPT) hourly median price by pool on Balancer, an automated portfolio manager and trading platform. - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - blockchain - - day - - contract_address - columns: - - name: blockchain - - name: day - - name: version - - name: decimals - - name: contract_address - - name: pool_type - - name: bpt_price - - - name: balancer_liquidity - meta: - blockchain: ethereum, arbitrum, optimism, polygon, gnosis, avalanche_c, base - project: balancer - contributors: viniabussafi - config: - tags: ['balancer', 'amm', 'dex', 'liquidity', 'ethereum', 'arbitrum', 'optimism', 'polygon', 'avalanche_c', 'base'] - description: > - Liquidity by token on Balancer, an automated portfolio manager and trading platform. - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - day - - pool_id - - blockchain - - token_address - - token_symbol - columns: - - name: day - description: 'UTC event block time truncated to the day mark' - - *pool_id - - name: pool_address - - name: pool_symbol - description: 'Symbol of the pool, consisting of the symbol of its tokens and their respective weights' - - name: version - description: 'Version of Balancer in which pool was deployed' - - name: blockchain - description: 'Blockchain in which pool was deployed' - - name: pool_type - - name: token_address - - name: token_symbol - description: 'Symbol of the token' - - name: token_balance_raw - description: 'Raw balance of the token in the pool' - - name: token_balance - description: 'Scaled balance of the token in the pool' - - name: protocol_liquidity_usd - description: 'Liquidity of the token in the pool in USD, except BPTs' - - name: protocol_liquidity_eth - description: 'Liquidity of the token in the pool in ETH, except BPTs' - - name: pool_liquidity_usd - description: 'Liquidity of the token in the pool in USD, including BPTs' - - name: pool_liquidity_eth - description: 'Liquidity of the token in the pool in ETH, including BPTs' - - - - name: balancer_transfers_bpt - meta: - blockchain: arbitrum, avalanche_c, base, ethereum, gnosis, optimism, polygon - contributors: victorstefenon, thetroyharris, viniabussafi - config: - tags: ['arbitrum', 'avalanche_c', 'base', 'ethereum', 'gnosis', 'optimism', 'polygon', 'bpt', 'transfers'] - description: > - Balancer Pool Token (BPT) transfer logs on Balancer, an automated portfolio manager and trading platform. - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - evt_tx_hash - - evt_index - - block_date - columns: - - *blockchain - - name: version - - *contract_address - - &block_date - name: block_date - description: "Block date in UTC" - - *evt_tx_hash - - *evt_index - - *evt_block_time - - *evt_block_number - - &from - name: from - description: 'Address of BPT provider of transfer event' - - &to - name: to - description: 'Address of BPT receiver of transfer event' - - &value - name: value - description: 'Amount of BPT transferred in transfer event' - - - name: balancer_pools_fees - meta: - blockchain: arbitrum, avalanche_c, base, ethereum, gnosis, optimism, polygon - contributors: jacektrocinski, thetroyharris, viniabussafi - config: - tags: ['arbitrum', 'avalanche_c', 'base', 'ethereum', 'gnosis', 'optimism', 'polygon', 'bpt', 'transfers'] - description: > - Balancer v2 swap fees stored at the pool level. - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - blockchain - - block_number - - tx_hash - - index - columns: - - name: blockchain - - name: version - - name: contract_address - - name: tx_hash - - name: index - - name: tx_index - - name: block_time - - name: block_number - - name: swap_fee_percentage - - - name: balancer_protocol_fee - meta: - blockchain: arbitrum, avalanche_c, base, ethereum, gnosis, optimism, polygon - project: balancer - contributors: viniabussafi - config: - tags: ['arbitrum', 'avalanche_c', 'base', 'ethereum', 'gnosis', 'optimism', 'polygon', 'revenue', 'fees'] - description: > - Daily Protocol Fee collected and Revenue by pool on Balancer, an automated portfolio manager and trading platform. - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - day - - pool_id - - token_address - columns: - - name: day - - *pool_id - - name: pool_address - - name: pool_symbol - - *version - - *blockchain - - name: pool_type - - name: token_address - - name: token_symbol - - name: token_amount_raw - description: "Raw amount of revenues of the token in the pool" - - name: token_amount - description: "Amount of revenues of the token in the pool" - - name: protocol_fee_collected_usd - description: "Fee collected in the pool in USD" - - name: treasury_share - description: "Share of total revenue that is directed to Balancer DAO's treasury, as per BIPs 19, 161 and 371" - - name: treasury_revenue_usd - description: "Total revenue directed to Balancer DAO's treasury" - - - name: balancer_bpt_supply - meta: - blockchain: arbitrum, avalanche_c, base, ethereum, gnosis, optimism, polygon - contributors: thetroyharris, viniabussafi - config: - tags: ['arbitrum', 'avalanche_c', 'base', 'ethereum', 'gnosis', 'optimism', 'polygon', 'bpt'] - description: > - The Balancer Pool Token (BPT) supply over time of ComposableStablePools versions 4+ - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - day - - blockchain - - token_address - columns: - - name: day - - name: pool_type - - name: version - - name: blockchain - - name: token_address - - name: supply - - - name: balancer_token_whitelist - meta: - blockchain: arbitrum, avalanche_c, base, ethereum, gnosis, optimism, polygon - contributors: viniabussafi - config: - tags: ['arbitrum', 'avalanche_c', 'base', 'ethereum', 'gnosis', 'optimism', 'polygon', 'bpt'] - description: > - These tokens are whitelisted to be used as pricing assets on liquidity calculations for weighted pools, due to the trustability of their data. - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - address - - name - - chain - columns: - - name: address - - name: name - - name: chain - - - name: balancer_pools_tokens_weights - meta: - blockchain: arbitrum, avalanche_c, base, ethereum, gnosis, optimism, polygon - contributors: jacektrocinski, viniabussafi - config: - tags: ['arbitrum', 'avalanche_c', 'base', 'ethereum', 'gnosis', 'optimism', 'polygon', 'bpt', 'transfers'] - description: > - Token weights in Balancer pools. - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - blockchain - - pool_id - - token_address - columns: - - *blockchain - - name: version - - *pool_id - - name: token_address - - name: normalized_weight - - - name: balancer_single_recipient_gauges - meta: - blockchain: ethereum - contributors: viniabussafi - config: - tags: ['ethereum', 'gauges'] - description: > - These gauges are deployed by the SingleRecipientGauge contract and this mapping manually links each gauge to it's correspondent pool and project - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - gauge_address - - pool_id - - project - - blockchain - columns: - - name: gauge_address - - name: pool_id - - name: project - - name: blockchain - - - name: balancer_pools_metrics_daily - meta: - blockchain: arbitrum, avalanche_c, base, ethereum, gnosis, optimism, polygon, zkevm - contributors: viniabussafi, metacrypto - config: - tags: ['arbitrum', 'avalanche_c', 'base', 'ethereum', 'gnosis', 'optimism', 'polygon', 'zkevm', 'balancer', 'pool', 'stats', 'volume', 'tvl', 'fee'] - description: > - This spell aggregates data from the trades, liquidity and protocol fees spells, by day and pool, while also displaying some basic information about the pool - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - block_date - - blockchain - - project - - version - - project_contract_address - columns: - - name: blockchain - - name: project - - name: version - - name: block_date - - name: project_contract_address - - name: pool_symbol - - name: pool_type - - name: swap_amount_usd - description: "Daily swap volume on a pool, in USD" - - name: tvl_usd - description: "Total Value Locked on a pool, in USD" - - name: tvl_eth - description: "Total Value Locked on a pool, in eth" - - name: fee_amount_usd - description: "Daily fees collected on a pool, in USD" \ No newline at end of file diff --git a/models/balancer/base/balancer_base_schema.yml b/models/balancer/base/balancer_base_schema.yml deleted file mode 100644 index d6e170e5536..00000000000 --- a/models/balancer/base/balancer_base_schema.yml +++ /dev/null @@ -1,405 +0,0 @@ -version: 2 - -models: - - - name: balancer_base_trades - meta: - blockchain: base - sector: dex - contributors: bizzyvinci - config: - tags: ['balancer', 'base', 'amm', 'trades', 'dex'] - description: > - DEX trades on balancer on base - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - block_date - - blockchain - - project - - version - - tx_hash - - evt_index - - check_dex_seed: - blockchain: base - project: balancer - version: 2 - columns: - - &blockchain - name: blockchain - description: "Blockchain" - - &project - name: project - description: "Project name (balancer)" - - &version - name: version - description: "Version of the project" - - &block_month - name: block_month - description: "Block month in UTC" - - &block_date - name: block_date - description: "Block date in UTC" - - &block_time - name: block_time - description: 'Block time in UTC' - - &token_bought_symbol - name: token_bought_symbol - description: "Token symbol for token bought in the trade" - - &token_sold_symbol - name: token_sold_symbol - description: "Token symbol for token sold in the trade" - - &token_pair - name: token_pair - description: "Token symbol pair for each token involved in the trade" - - &token_bought_amount - name: token_bought_amount - description: "Value of the token bought at time of execution in the original currency" - - &token_sold_amount - name: token_sold_amount - description: "Value of the token sold at time of execution in the original currency" - - &token_bought_amount_raw - name: token_bought_amount_raw - description: "Raw value of the token bought at time of execution in the original currency" - - &token_sold_amount_raw - name: token_sold_amount_raw - description: "Raw value of the token sold at time of execution in the original currency" - - &amount_usd - name: amount_usd - description: "USD value of the trade at time of execution" - - &token_bought_address - name: token_bought_address - description: "Contract address of the token bought" - - &token_sold_address - name: token_sold_address - description: "Contract address of the token sold" - - &taker - name: taker - description: "Address of trader who purchased a token" - - &maker - name: maker - description: "Address of trader who sold a token" - - &pool_id - name: pool_id - description: 'Unique encoded identifier that refers to each pool' - - &swap_fee - name: swap_fee - description: 'Swap fee' - - &project_contract_address - name: project_contract_address - description: "Pool address" - - name: pool_symbol - - name: pool_type - - &tx_hash - name: tx_hash - description: "Transaction hash" - - &tx_from - name: tx_from - description: "transaction.from" - - &tx_to - name: tx_to - description: "transaction.to" - - &evt_index - name: evt_index - description: "Event index" - - - name: balancer_v2_base_trades - meta: - blockchain: base - sector: dex - contributors: bizzyvinci, thetroyharris, tomfutago, viniabussafi - config: - tags: [ 'balancer', 'base', 'amm', 'trades', 'dex', 'beta' ] - description: > - DEX trades on balancer v2 on base - columns: - - *blockchain - - *project - - *version - - *block_month - - *block_date - - *block_time - - name: block_number - - *token_bought_symbol - - *token_sold_symbol - - *token_pair - - *token_bought_amount - - *token_sold_amount - - *token_bought_amount_raw - - *token_sold_amount_raw - - *amount_usd - - *token_bought_address - - *token_sold_address - - *taker - - *maker - - *project_contract_address - - name: pool_symbol - - name: pool_type - - *pool_id - - *swap_fee - - *tx_hash - - *tx_from - - *tx_to - - *evt_index - - - name: balancer_v2_base_pools_fees - meta: - blockchain: base - project: balancer_v2 - contributors: jacektrocinski, thetroyharris, viniabussafi - config: - tags: ['base', 'balancer', 'pools', 'fees'] - description: > - Balancer v2 swap fees stored at the pool level. - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - block_number - - tx_hash - - index - columns: - - name: blockchain - - name: version - - name: contract_address - - name: tx_hash - - name: index - - name: tx_index - - name: block_time - - name: block_number - - name: swap_fee_percentage - - - name: balancer_base_pools_tokens_weights - meta: - blockchain: base - project: balancer - contributors: jacektrocinski, viniabussafi - config: - tags: ['base', 'balancer', 'pools', 'tokens', 'weights'] - description: > - Token weights in Balancer pools. - columns: - - *blockchain - - name: version - - *pool_id - - &token_address - name: token_address - description: 'Contract address for the token' - - &normalized_weight - name: normalized_weight - description: 'Weight of the token in the pool.' - - - name: balancer_v2_base_pools_tokens_weights - meta: - blockchain: base - project: balancer - contributors: jacektrocinski, viniabussafi - config: - tags: ['base', 'balancer', 'pools', 'tokens', 'weights'] - description: > - Token weights in Balancer v2 pools. - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - pool_id - - token_address - columns: - - *blockchain - - name: version - - *pool_id - - *token_address - - *normalized_weight - - - name: balancer_v2_base_liquidity - meta: - blockchain: base - project: balancer_v2 - contributors: victorstefenon, viniabussafi, thetroyharris - config: - tags: ['base', 'balancer', 'pools', 'liquidity'] - description: > - Balancer v2 pools liquidity by token in base. - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - day - - pool_id - - token_address - columns: - - name: day - description: 'UTC event block time truncated to the day mark' - - *pool_id - - name: pool_address - - name: pool_symbol - description: 'Symbol of the pool, consisting of the symbol of its tokens and their respective weights' - - name: version - description: 'Version of Balancer in which pool was deployed' - - name: blockchain - description: 'Blockchain in which pool was deployed' - - *token_address - - name: token_symbol - description: 'Symbol of the token' - - name: token_balance_raw - description: 'Raw balance of the token in the pool' - - name: token_balance - description: 'Scaled balance of the token in the pool' - - name: protocol_liquidity_usd - description: 'Liquidity of the token in the pool in USD, except BPTs' - - name: protocol_liquidity_eth - description: 'Liquidity of the token in the pool in ETH, except BPTs' - - name: pool_liquidity_usd - description: 'Liquidity of the token in the pool in USD, including BPTs' - - name: pool_liquidity_eth - description: 'Liquidity of the token in the pool in ETH, including BPTs' - - - - name: balancer_v2_base_bpt_prices - meta: - blockchain: base - project: balancer_v2 - contributors: victorstefenon, thetroyharris, viniabussafi - config: - tags: ['base', 'bpt', 'prices'] - description: > - Balancer Pool Token (BPT) hourly median price by pool on Balancer, an automated portfolio manager and trading platform. - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - blockchain - - day - - contract_address - columns: - - name: blockchain - - name: day - - name: version - - name: decimals - - name: contract_address - - name: bpt_price - - - name: balancer_v2_base_transfers_bpt - meta: - blockchain: base - project: balancer_v2 - contributors: victorstefenon, thetroyharris, viniabussafi - config: - tags: ['base', 'bpt', 'transfers'] - description: > - Balancer Pool Token (BPT) transfer logs on Balancer, an automated portfolio manager and trading platform, on Base. - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - evt_tx_hash - - evt_index - - block_date - columns: - - name: blockchain - - name: version - - name: contract_address - - name: block_date - - name: block_month - - name: evt_tx_hash - - name: evt_index - - &evt_block_time - name: evt_block_time - description: 'Block time of transfer event' - - &evt_block_number - name: evt_block_number - description: 'Block number of transfer event' - - &from - name: from - description: 'Address of BPT provider of transfer event' - - &to - name: to - description: 'Address of BPT receiver of transfer event' - - &value - name: value - description: 'Amount of BPT transferred in transfer event' - - - name: balancer_v2_base_flashloans - meta: - blockchain: base - sector: lending - contributors: hildobby, viniabussafi - config: - tags: ['base', 'flashloans'] - description: > - All Balancer v2 flashloans on base - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - blockchain - - tx_hash - - evt_index - columns: - - name: blockchain - - name: project - - name: version - - name: block_time - - name: block_number - - name: amount - - name: amount_usd - - name: tx_hash - - name: evt_index - - name: fee - - name: currency_contract - - name: currency_symbol - - name: recipient - - name: contract_address - - name: block_month - - - name: balancer_v2_base_protocol_fee - meta: - blockchain: base - project: balancer_v2 - contributors: viniabussafi - config: - tags: ['base', 'revenue', 'fees'] - description: > - Daily Protocol Fee collected and Revenue by pool on Balancer, an automated portfolio manager and trading platform. - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - day - - pool_id - - token_address - columns: - - name: day - - name: pool_id - - name: pool_address - - name: pool_symbol - - name: version - - name: blockchain - - name: token_address - - name: token_symbol - - name: token_amount_raw - description: "Raw amount of revenues of the token in the pool" - - name: token_amount - description: "Amount of revenues of the token in the pool" - - name: protocol_fee_collected_usd - description: "Fee collected in the pool in USD" - - name: treasury_share - description: "Share of total revenue that is directed to Balancer DAO's treasury, as per BIPs 19, 161 and 371" - - name: treasury_revenue_usd - description: "Total revenue directed to Balancer DAO's treasury" - - - name: balancer_v2_base_bpt_supply - meta: - blockchain: base - project: balancer_v2 - contributors: thetroyharris, viniabussafi - config: - tags: ['base', 'bpt', 'supply'] - description: > - Balancer Pool Token (BPT) supply for ComposableStablePools versions 4 and 5. - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - day - - blockchain - - token_address - columns: - - name: day - - name: pool_type - - name: version - - name: blockchain - - name: token_address - - name: supply \ No newline at end of file diff --git a/models/balancer/ethereum/balancer_ethereum_schema.yml b/models/balancer/ethereum/balancer_ethereum_schema.yml deleted file mode 100644 index d2f899d1c61..00000000000 --- a/models/balancer/ethereum/balancer_ethereum_schema.yml +++ /dev/null @@ -1,665 +0,0 @@ -version: 2 - -models: - - name: balancer_v2_ethereum_pools_fees - meta: - blockchain: ethereum - project: balancer_v2 - contributors: jacektrocinski, thetroyharris, viniabussafi - config: - tags: ['ethereum', 'balancer', 'pools', 'fees'] - description: > - Balancer v2 swap fees stored at the pool level. - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - block_number - - tx_hash - - index - columns: - - name: blockchain - - name: version - - &contract_address - name: contract_address - description: "Ethereum address for the liquidity pool used in transaction" - tests: - - not_null - - &tx_hash - name: tx_hash - description: "Transaction hash" - tests: - - not_null - - &index - name: index - description: "" - tests: - - not_null - - &tx_index - name: tx_index - description: "" - tests: - - not_null - - &block_time - name: block_time - description: "Block time in UTC" - tests: - - not_null - - &block_number - name: block_number - description: "Block number" - tests: - - not_null - - &swap_fee_percentage - name: swap_fee_percentage - description: "Swap fees for the pool, values are returned with 18 decimals (1e18 meaning 100%)" - tests: - - not_null - - - name: balancer_ethereum_balances - meta: - blockchain: ethereum - project: balancer - contributors: jacektrocinski - config: - tags: ['ethereum', 'balancer', 'balances'] - description: > - ERC20 token rolling sum balances on Balancer, an automated portfolio manager and trading platform. - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - day - - pool - - token - columns: - - &day - name: day - description: "UTC event block time truncated to the day mark" - tests: - - not_null - - &pool - name: pool - description: "Balancer pool contract address" - - &token - name: token - description: "Token contract address" - - &cumulative_amount - name: cumulative_amount - description: "Balance of a token" - - - name: balancer_v2_ethereum_transfers_bpt - meta: - blockchain: ethereum - project: balancer_v2 - contributors: victorstefenon, thetroyharris, viniabussafi - config: - tags: ['ethereum', 'bpt', 'transfers'] - description: > - Balancer Pool Token (BPT) transfer logs on Balancer, an automated portfolio manager and trading platform, on Ethereum. - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - evt_tx_hash - - evt_index - - block_date - columns: - - &blockchain - name: blockchain - description: "Blockchain" - - name: version - - *contract_address - - &block_date - name: block_date - description: "UTC event block date" - - &block_month - name: block_month - description: "UTC event block month" - - &evt_tx_hash - name: evt_tx_hash - description: "Transaction hash of transfer event" - - &evt_index - name: evt_index - description: "Event index" - - &evt_block_time - name: evt_block_time - description: "Block time of transfer event" - - &evt_block_number - name: evt_block_number - description: "Block number of transfer event" - - &from - name: from - description: "Address of BPT provider of transfer event" - - &to - name: to - description: "Address of BPT receiver of transfer event" - - &value - name: value - description: "Amount of BPT transferred in transfer event" - - - name: balancer_ethereum_pools_tokens_weights - meta: - blockchain: ethereum - project: balancer - contributors: jacektrocinski, viniabussafi - config: - tags: ['ethereum', 'balancer', 'pools', 'tokens', 'weights'] - description: > - Token weights in Balancer pools. - columns: - - *blockchain - - name: version - - &pool_id - name: pool_id - description: "Unique encoded identifier that refers to each pool" - - &token_address - name: token_address - description: "Contract address for the token" - - &normalized_weight - name: normalized_weight - description: "Weight of the token in the pool." - - - name: balancer_v1_ethereum_pools_tokens_weights - meta: - blockchain: ethereum - project: balancer - contributors: jacektrocinski, viniabussafi - config: - tags: ['ethereum', 'balancer', 'pools', 'tokens', 'weights'] - description: > - Token weights in Balancer v1 pools. - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - pool_id - - token_address - columns: - - *blockchain - - name: version - - *pool_id - - *token_address - - *normalized_weight - - - name: balancer_v2_ethereum_pools_tokens_weights - meta: - blockchain: ethereum - project: balancer - contributors: jacektrocinski, viniabussafi - config: - tags: ['ethereum', 'balancer', 'pools', 'tokens', 'weights'] - description: > - Token weights in Balancer v2 pools. - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - pool_id - - token_address - columns: - - *blockchain - - name: version - - *pool_id - - *token_address - - *normalized_weight - - - name: balancer_ethereum_vebal_balances_day - meta: - blockchain: ethereum - project: balancer - contibutors: markusbkoch, mendesfabio, victorstefenon - config: - tags: ['balancer', 'ethereum', 'vebal', 'day', 'markusbkoch', 'mendesfabio'] - description: > - Daily balances of veBAL per wallet - Depends on veBAL_call_create_lock, veBAL_evt_Deposit and veBAL_evt_Withdraw - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - day - - wallet_address - columns: - - *day - - name: wallet_address - description: "Address of the wallet holding the veBAL" - - name: bpt_balance - description: "Amount of BPT held in the veBAL lock" - - name: vebal_balance - description: "Amount of veBAL" - - name: lock_time - description: "Amount of time the BPT was locked for at the last time the lock was updated" - - - name: balancer_ethereum_vebal_slopes - meta: - blockchain: ethereum - project: balancer - contibutors: markusbkoch, mendesfabio, victorstefenon - config: - tags: ['balancer', 'ethereum', 'vebal', 'slope', 'markusbkoch', 'mendesfabio', 'victorstefenon'] - description: > - Slope and bias of veBAL per wallet after each balance update - Depends on veBAL_call_create_lock, veBAL_evt_Deposit and veBAL_evt_Withdraw - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - block_number - - wallet_address - columns: - - *block_number - - *block_time - - name: block_timestamp - description: "Block timestamp" - - name: wallet_address - description: "Address of the wallet holding the veBAL" - - name: bpt_balance - description: "Amount of BPT held in the veBAL lock" - - name: unlocked_at - description: "Timestamp at which B-80BAL-20WETH BPT can be unlocked" - - name: slope - description: "veBAL decay rate (per second)" - - name: bias - description: "veBAL balance at the moment user locks or re-locks" - - name: block_date - description: "Block time trunc to date" - - - name: balancer_ethereum_trades - meta: - blockchain: ethereum - sector: dex - contributors: bizzyvinci, thetroyharris - config: - tags: ['balancer', 'ethereum', 'amm', 'trades', 'dex'] - description: > - DEX trades on balancer on ethereum - columns: - - *blockchain - - &project - name: project - description: "Project name (balancer)" - - &version - name: version - description: "Version of the project" - - *block_month - - *block_date - - *block_time - - &token_bought_symbol - name: token_bought_symbol - description: "Token symbol for token bought in the trade" - - &token_sold_symbol - name: token_sold_symbol - description: "Token symbol for token sold in the trade" - - &token_pair - name: token_pair - description: "Token symbol pair for each token involved in the trade" - - &token_bought_amount - name: token_bought_amount - description: "Value of the token bought at time of execution in the original currency" - - &token_sold_amount - name: token_sold_amount - description: "Value of the token sold at time of execution in the original currency" - - &token_bought_amount_raw - name: token_bought_amount_raw - description: "Raw value of the token bought at time of execution in the original currency" - - &token_sold_amount_raw - name: token_sold_amount_raw - description: "Raw value of the token sold at time of execution in the original currency" - - &amount_usd - name: amount_usd - description: "USD value of the trade at time of execution" - - &token_bought_address - name: token_bought_address - description: "Contract address of the token bought" - - &token_sold_address - name: token_sold_address - description: "Contract address of the token sold" - - &taker - name: taker - description: "Address of trader who purchased a token" - - &maker - name: maker - description: "Address of trader who sold a token" - - *pool_id - - &swap_fee - name: swap_fee - description: 'Swap fee' - - &project_contract_address - name: project_contract_address - description: "Pool address" - - name: pool_symbol - - name: pool_type - - *tx_hash - - &tx_from - name: tx_from - description: "transaction.from" - - &tx_to - name: tx_to - description: "transaction.to" - - *evt_index - - - name: balancer_v1_ethereum_trades - meta: - blockchain: ethereum - sector: dex - contributors: bizzyvinci, thetroyharris, viniabussafi - config: - tags: [ 'balancer', 'ethereum', 'amm', 'trades', 'dex' ] - description: > - DEX trades on balancer v1 on ethereum - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - block_time - - tx_hash - - evt_index - - check_dex_seed: - blockchain: ethereum - project: balancer - version: 1 - columns: - - *blockchain - - *project - - *version - - *block_month - - *block_date - - *block_time - - *token_bought_symbol - - *token_sold_symbol - - *token_pair - - *token_bought_amount - - *token_sold_amount - - *token_bought_amount_raw - - *token_sold_amount_raw - - *amount_usd - - *token_bought_address - - *token_sold_address - - *taker - - *maker - - *pool_id - - *swap_fee - - *project_contract_address - - name: pool_symbol - - name: pool_type - - *tx_hash - - *tx_from - - *tx_to - - *evt_index - - - name: balancer_v2_ethereum_trades - meta: - blockchain: ethereum - sector: dex - contributors: bizzyvinci, thetroyharris, tomfutago, viniabussafi - config: - tags: [ 'balancer', 'ethereum', 'amm', 'trades', 'dex', 'beta' ] - description: > - DEX trades on balancer v2 on ethereum - columns: - - *blockchain - - *project - - *version - - *block_month - - *block_date - - *block_time - - *block_number - - *token_bought_symbol - - *token_sold_symbol - - *token_pair - - *token_bought_amount - - *token_sold_amount - - *token_bought_amount_raw - - *token_sold_amount_raw - - *amount_usd - - *token_bought_address - - *token_sold_address - - *taker - - *maker - - *project_contract_address - - name: pool_symbol - - name: pool_type - - *pool_id - - *swap_fee - - *tx_hash - - *tx_from - - *tx_to - - *evt_index - - - name: balancer_v2_ethereum_liquidity - meta: - blockchain: ethereum - project: balancer_v2 - contributors: victorstefenon, viniabussafi, thetroyharris - config: - tags: ['ethereum', 'balancer', 'pools', 'liquidity'] - description: > - Balancer v2 pools liquidity by token in Ethereum. - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - day - - pool_id - - token_address - columns: - - name: day - description: 'UTC event block time truncated to the day mark' - - *pool_id - - name: pool_address - - name: pool_symbol - description: 'Symbol of the pool, consisting of the symbol of its tokens and their respective weights' - - name: version - description: 'Version of Balancer in which pool was deployed' - - name: blockchain - description: 'Blockchain in which pool was deployed' - - *token_address - - name: token_symbol - description: 'Symbol of the token' - - name: token_balance_raw - description: 'Raw balance of the token in the pool' - - name: token_balance - description: 'Scaled balance of the token in the pool' - - name: protocol_liquidity_usd - description: 'Liquidity of the token in the pool in USD, except BPTs' - - name: protocol_liquidity_eth - description: 'Liquidity of the token in the pool in ETH, except BPTs' - - name: pool_liquidity_usd - description: 'Liquidity of the token in the pool in USD, including BPTs' - - name: pool_liquidity_eth - description: 'Liquidity of the token in the pool in ETH, including BPTs' - - - name: balancer_ethereum_vebal_votes - meta: - blockchain: ethereum - project: balancer - contibutors: markusbkoch, mendesfabio, stefenon - config: - tags: ['balancer', 'ethereum', 'vebal', 'votes', 'markusbkoch', 'mendesfabio', 'stefenon'] - description: > - Records of votes for Balancer gauges by provider at each voting round - Depends on GaugeController_evt_VoteForGauge and the vebal_slopes spell - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - round_id - - gauge - - provider - columns: - - name: round_id - description: "ID of the voting round" - - name: start_date - description: "Day of the voting round start date" - - name: end_date - description: "Day of the voting round end date" - - name: gauge - description: "Address of the gauge which provider votes for" - - name: provider - description: "Address of the wallet which voted for the gauge" - - name: vote - description: "Weight of the vote performed by the provider for the gauge" - - - name: balancer_v2_ethereum_lbps - meta: - blockchain: ethereum - project: balancer_v2 - contributors: stefenon - config: - tags: ['ethereum', 'balancer', 'lbp'] - description: > - Record of the Liquidity Boostrapping Pools (LBP) of Balancer, an automated portfolio manager and trading platform, on Ethereum. - columns: - - name: name - description: "Name of the LBP" - - name: pool_id - description: "ID of the LBP" - - name: token_sold - description: "Contract address of the token sold by the LBP" - - name: token_symbol - description: "Symbol of the token sold by the LBP" - - name: start_time - description: "LBP start time" - - name: end_time - description: "LBP end time" - - - name: balancer_v1_ethereum_liquidity - meta: - blockchain: ethereum - project: balancer_v1 - contributors: markusbkoch, mendesfabio, victorstefenon, viniabussafi, thetroyharris - config: - tags: ['ethereum', 'balancer', 'pools', 'liquidity'] - description: > - Balancer v1 pools liquidity by token in Ethereum. - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - day - - pool_id - - token_address - columns: - - name: day - description: "UTC event block time truncated to the day mark" - - *pool_id - - name: pool_address - - name: pool_symbol - description: "Symbol of the pool, consisting of the symbol of its tokens and their respective weights" - - name: version - description: "Version of Balancer in which pool was deployed" - - *blockchain - - *token_address - - name: token_symbol - description: "Symbol of the token" - - name: token_balance_raw - description: "Raw balance of the token in the pool" - - name: token_balance - description: "Scaled balance of the token in the pool" - - name: protocol_liquidity_usd - description: "Liquidity of the token in the pool in USD, except BPTs" - - name: pool_liquidity_usd - description: "Liquidity of the token in the pool in USD, including BPTs" - - - name: balancer_v2_ethereum_flashloans - meta: - blockchain: ethereum - sector: lending - contributors: hildobby - config: - tags: ['ethereum', 'flashloans'] - description: > - All Balancer flashloans on Ethereum - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - blockchain - - tx_hash - - evt_index - columns: - - name: blockchain - - name: project - - name: version - - name: block_time - - name: block_number - - name: amount - - name: amount_usd - - name: tx_hash - - name: evt_index - - name: fee - - name: currency_contract - - name: currency_symbol - - name: recipient - - name: contract_address - - name: block_month - - - name: balancer_v2_ethereum_bpt_prices - meta: - blockchain: ethereum - project: balancer_v2 - contributors: victorstefenon, thetroyharris, viniabussafi - config: - tags: ['ethereum', 'bpt', 'prices'] - description: > - Balancer Pool Token (BPT) hourly median price by pool on Balancer, an automated portfolio manager and trading platform. - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - blockchain - - day - - contract_address - columns: - - name: blockchain - - name: day - - name: version - - name: decimals - - name: contract_address - - name: bpt_price - - - name: balancer_v2_ethereum_protocol_fee - meta: - blockchain: ethereum - project: balancer_v2 - contributors: viniabussafi - config: - tags: ['ethereum', 'revenue', 'fees'] - description: > - Daily Protocol Fee collected and Revenue by pool on Balancer, an automated portfolio manager and trading platform. - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - day - - pool_id - - token_address - columns: - - name: day - - name: pool_id - - name: pool_address - - name: pool_symbol - - name: version - - name: blockchain - - name: token_address - - name: token_symbol - - name: token_amount_raw - description: "Raw amount of revenues of the token in the pool" - - name: token_amount - description: "Amount of revenues of the token in the pool" - - name: protocol_fee_collected_usd - description: "Fee collected in the pool in USD" - - name: treasury_share - description: "Share of total revenue that is directed to Balancer DAO's treasury, as per BIPs 19, 161 and 371" - - name: treasury_revenue_usd - description: "Total revenue directed to Balancer DAO's treasury" - - - name: balancer_v2_ethereum_bpt_supply - meta: - blockchain: ethereum - project: balancer_v2 - contributors: thetroyharris, viniabussafi - config: - tags: ['ethereum', 'bpt', 'supply'] - description: > - Balancer Pool Token (BPT) supply for ComposableStablePools versions 4 and 5. - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - day - - blockchain - - token_address - columns: - - name: day - - name: pool_type - - name: version - - name: blockchain - - name: token_address - - name: supply \ No newline at end of file diff --git a/models/balancer/gnosis/balancer_gnosis_schema.yml b/models/balancer/gnosis/balancer_gnosis_schema.yml deleted file mode 100644 index a9ef89846ef..00000000000 --- a/models/balancer/gnosis/balancer_gnosis_schema.yml +++ /dev/null @@ -1,404 +0,0 @@ -version: 2 - -models: - - name: balancer_gnosis_trades - meta: - blockchain: gnosis - sector: dex - contributors: bizzyvinci - config: - tags: ['balancer', 'gnosis', 'amm', 'trades', 'dex'] - description: > - DEX trades on balancer on gnosis - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - block_date - - blockchain - - project - - version - - tx_hash - - evt_index - - check_dex_seed: - blockchain: gnosis - project: balancer - version: 2 - columns: - - &blockchain - name: blockchain - description: "Blockchain" - - &project - name: project - description: "Project name (balancer)" - - &version - name: version - description: "Version of the project" - - &block_month - name: block_month - description: "Block month in UTC" - - &block_date - name: block_date - description: "Block date in UTC" - - &block_time - name: block_time - description: 'Block time in UTC' - - &token_bought_symbol - name: token_bought_symbol - description: "Token symbol for token bought in the trade" - - &token_sold_symbol - name: token_sold_symbol - description: "Token symbol for token sold in the trade" - - &token_pair - name: token_pair - description: "Token symbol pair for each token involved in the trade" - - &token_bought_amount - name: token_bought_amount - description: "Value of the token bought at time of execution in the original currency" - - &token_sold_amount - name: token_sold_amount - description: "Value of the token sold at time of execution in the original currency" - - &token_bought_amount_raw - name: token_bought_amount_raw - description: "Raw value of the token bought at time of execution in the original currency" - - &token_sold_amount_raw - name: token_sold_amount_raw - description: "Raw value of the token sold at time of execution in the original currency" - - &amount_usd - name: amount_usd - description: "USD value of the trade at time of execution" - - &token_bought_address - name: token_bought_address - description: "Contract address of the token bought" - - &token_sold_address - name: token_sold_address - description: "Contract address of the token sold" - - &taker - name: taker - description: "Address of trader who purchased a token" - - &maker - name: maker - description: "Address of trader who sold a token" - - &pool_id - name: pool_id - description: 'Unique encoded identifier that refers to each pool' - - &swap_fee - name: swap_fee - description: 'Swap fee' - - &project_contract_address - name: project_contract_address - description: "Pool address" - - name: pool_symbol - - name: pool_type - - &tx_hash - name: tx_hash - description: "Transaction hash" - - &tx_from - name: tx_from - description: "transaction.from" - - &tx_to - name: tx_to - description: "transaction.to" - - &evt_index - name: evt_index - description: "Event index" - - - name: balancer_v2_gnosis_flashloans - meta: - blockchain: gnosis - sector: lending - contributors: hildobby - config: - tags: ['gnosis', 'flashloans'] - description: > - All Balancer flashloans on Gnosis - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - blockchain - - tx_hash - - evt_index - columns: - - name: blockchain - - name: project - - name: version - - name: block_time - - name: block_number - - name: amount - - name: amount_usd - - name: tx_hash - - name: evt_index - - name: fee - - name: currency_contract - - name: currency_symbol - - name: recipient - - name: contract_address - - name: block_month - - - name: balancer_v2_gnosis_bpt_prices - meta: - blockchain: gnosis - project: balancer_v2 - contributors: thetroyharris, viniabussafi - config: - tags: ['gnosis', 'bpt', 'prices'] - description: > - Balancer Pool Token (BPT) hourly median price by pool on Balancer, an automated portfolio manager and trading platform. - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - blockchain - - day - - contract_address - columns: - - name: blockchain - - name: day - - name: version - - name: decimals - - name: contract_address - - name: bpt_price - - - name: balancer_v2_gnosis_pools_fees - meta: - blockchain: gnosis - project: balancer_v2 - contributors: jacektrocinski, thetroyharris, viniabussafi - config: - tags: ['gnosis', 'balancer', 'pools_fees'] - description: > - Balancer v2 swap fees stored at the pool level. - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - block_number - - tx_hash - - index - columns: - - name: blockchain - - name: version - - name: contract_address - - name: tx_hash - - name: index - - name: tx_index - - name: block_time - - name: block_number - - name: swap_fee_percentage - - - name: balancer_v2_gnosis_trades - meta: - blockchain: gnosis - sector: dex - contributors: bizzyvinci, thetroyharris, tomfutago, viniabussafi - config: - tags: [ 'balancer', 'gnosis', 'amm', 'trades', 'dex', 'beta' ] - description: > - DEX trades on balancer v2 on gnosis - columns: - - *blockchain - - *project - - *version - - *block_month - - *block_date - - *block_time - - name: block_number - - *token_bought_symbol - - *token_sold_symbol - - *token_pair - - *token_bought_amount - - *token_sold_amount - - *token_bought_amount_raw - - *token_sold_amount_raw - - *amount_usd - - *token_bought_address - - *token_sold_address - - *taker - - *maker - - *project_contract_address - - name: pool_symbol - - name: pool_type - - *pool_id - - *swap_fee - - *tx_hash - - *tx_from - - *tx_to - - *evt_index - - - name: balancer_v2_gnosis_liquidity - meta: - blockchain: gnosis - project: balancer_v2 - contributors: victorstefenon, viniabussafi, thetroyharris - config: - tags: ['gnosis', 'balancer', 'pools', 'liquidity'] - description: > - Balancer v2 pools liquidity by token in Gnosis. - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - day - - pool_id - - token_address - columns: - - name: day - description: 'UTC event block time truncated to the day mark' - - *pool_id - - name: pool_address - - name: pool_symbol - description: 'Symbol of the pool, consisting of the symbol of its tokens and their respective weights' - - name: version - description: 'Version of Balancer in which pool was deployed' - - name: blockchain - description: 'Blockchain in which pool was deployed' - - name: token_address - - name: token_symbol - description: 'Symbol of the token' - - name: token_balance_raw - description: 'Raw balance of the token in the pool' - - name: token_balance - description: 'Scaled balance of the token in the pool' - - name: protocol_liquidity_usd - description: 'Liquidity of the token in the pool in USD, except BPTs' - - name: protocol_liquidity_eth - description: 'Liquidity of the token in the pool in ETH, except BPTs' - - name: pool_liquidity_usd - description: 'Liquidity of the token in the pool in USD, including BPTs' - - name: pool_liquidity_eth - description: 'Liquidity of the token in the pool in ETH, including BPTs' - - - - name: balancer_gnosis_pools_tokens_weights - meta: - blockchain: gnosis - project: balancer - contributors: jacektrocinski, viniabussafi - config: - tags: ['gnosis', 'balancer', 'pools', 'tokens', 'weights'] - description: > - Token weights in Balancer pools. - columns: - - *blockchain - - name: version - - *pool_id - - &token_address - name: token_address - description: 'Contract address for the token' - - &normalized_weight - name: normalized_weight - description: 'Weight of the token in the pool.' - - - name: balancer_v2_gnosis_pools_tokens_weights - meta: - blockchain: gnosis - project: balancer - contributors: metacrypto, jacektrocinski, viniabussafi - config: - tags: ['gnosis', 'balancer', 'pools', 'tokens', 'weights'] - description: > - Token weights in Balancer v2 pools. - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - pool_id - - token_address - columns: - - *blockchain - - name: version - - *pool_id - - *token_address - - *normalized_weight - - - name: balancer_v2_gnosis_transfers_bpt - meta: - blockchain: gnosis - project: balancer_v2 - contributors: victorstefenon, thetroyharris, viniabussafi - config: - tags: ['gnosis', 'bpt', 'transfers'] - description: > - Balancer Pool Token (BPT) transfer logs on Balancer, an automated portfolio manager and trading platform, on Gnosis. - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - evt_tx_hash - - evt_index - - block_date - columns: - - name: blockchain - - name: version - - name: contract_address - - name: block_date - - name: block_month - - name: evt_tx_hash - - name: evt_index - - &evt_block_time - name: evt_block_time - description: 'Block time of transfer event' - - &evt_block_number - name: evt_block_number - description: 'Block number of transfer event' - - &from - name: from - description: 'Address of BPT provider of transfer event' - - &to - name: to - description: 'Address of BPT receiver of transfer event' - - &value - name: value - description: 'Amount of BPT transferred in transfer event' - - - name: balancer_v2_gnosis_protocol_fee - meta: - blockchain: gnosis - project: balancer_v2 - contributors: viniabussafi - config: - tags: ['gnosis', 'revenue', 'fees'] - description: > - Daily Protocol Fee collected and Revenue by pool on Balancer, an automated portfolio manager and trading platform. - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - day - - pool_id - - token_address - columns: - - name: day - - name: pool_id - - name: pool_address - - name: pool_symbol - - name: version - - name: blockchain - - name: token_address - - name: token_symbol - - name: token_amount_raw - description: "Raw amount of revenues of the token in the pool" - - name: token_amount - description: "Amount of revenues of the token in the pool" - - name: protocol_fee_collected_usd - description: "Fee collected in the pool in USD" - - name: treasury_share - description: "Share of total revenue that is directed to Balancer DAO's treasury, as per BIPs 19, 161 and 371" - - name: treasury_revenue - description: "Total revenue directed to Balancer DAO's treasury" - - - name: balancer_v2_gnosis_bpt_supply - meta: - blockchain: gnosis - project: balancer_v2 - contributors: thetroyharris, viniabussafi - config: - tags: ['gnosis', 'bpt', 'supply'] - description: > - Balancer Pool Token (BPT) supply for ComposableStablePools versions 4 and 5. - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - day - - blockchain - - token_address - columns: - - name: day - - name: pool_type - - name: version - - name: blockchain - - name: token_address - - name: supply \ No newline at end of file diff --git a/models/balancer/optimism/balancer_optimism_schema.yml b/models/balancer/optimism/balancer_optimism_schema.yml deleted file mode 100644 index bb4c52fbe0e..00000000000 --- a/models/balancer/optimism/balancer_optimism_schema.yml +++ /dev/null @@ -1,464 +0,0 @@ -version: 2 - -models: - - name: balancer_v2_optimism_pools_fees - meta: - blockchain: optimism - project: balancer_v2 - contributors: jacektrocinski, thetroyharris, viniabussafi - config: - tags: ['optimism', 'balancer', 'pools_fees'] - description: > - Balancer v2 swap fees stored at the pool level. - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - block_number - - tx_hash - - index - columns: - - name: blockchain - - name: version - - &contract_address - name: contract_address - description: 'Optimism address for the liquidity pool used in transaction' - tests: - - not_null - - &tx_hash - name: tx_hash - description: 'Transaction hash' - tests: - - not_null - - &index - name: index - description: '' - tests: - - not_null - - &tx_index - name: tx_index - description: '' - tests: - - not_null - - &block_time - name: block_time - description: 'Block time in UTC' - tests: - - not_null - - &block_number - name: block_number - description: 'Block number' - tests: - - not_null - - &swap_fee_percentage - name: swap_fee_percentage - description: 'Swap fees for the pool, values are returned with 18 decimals (1e18 meaning 100%)' - tests: - - not_null - - - name: balancer_v2_optimism_transfers_bpt - meta: - blockchain: optimism - project: balancer_v2 - contributors: victorstefenon, thetroyharris, viniabussafi - config: - tags: ['optimism', 'bpt', 'transfers'] - description: > - Balancer Pool Token (BPT) transfer logs on Balancer, an automated portfolio manager and trading platform, on Optimism. - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - evt_tx_hash - - evt_index - - block_date - columns: - - &blockchain - name: blockchain - description: "Blockchain" - - name: version - - *contract_address - - &block_date - name: block_date - description: "UTC event block date of each DEX trade" - - &block_month - name: block_month - description: "UTC event block month of each DEX trade" - - &evt_tx_hash - name: evt_tx_hash - description: 'Transaction hash of transfer event' - - &evt_index - name: evt_index - description: 'Event index' - - &evt_block_time - name: evt_block_time - description: 'Block time of transfer event' - - &evt_block_number - name: evt_block_number - description: 'Block number of transfer event' - - &from - name: from - description: 'Address of BPT provider of transfer event' - - &to - name: to - description: 'Address of BPT receiver of transfer event' - - &value - name: value - description: 'Amount of BPT transferred in transfer event' - - - name: balancer_optimism_pools_tokens_weights - meta: - blockchain: optimism - project: balancer - contributors: jacektrocinski, viniabussafi - config: - tags: ['optimism', 'balancer', 'pools', 'tokens', 'weights'] - description: > - Token weights in Balancer pools. - columns: - - *blockchain - - name: version - - &pool_id - name: pool_id - description: 'Unique encoded identifier that refers to each pool' - tests: - - not_null - - &token_address - name: token_address - description: 'Contract address for the token' - - &normalized_weight - name: normalized_weight - description: 'Weight of the token in the pool.' - - - name: balancer_v2_optimism_pools_tokens_weights - meta: - blockchain: optimism - project: balancer - contributors: jacektrocinski, viniabussafi - config: - tags: ['optimism', 'balancer', 'pools', 'tokens', 'weights'] - description: > - Token weights in Balancer v2 pools. - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - pool_id - - token_address - columns: - - *blockchain - - name: version - - *pool_id - - *token_address - - *normalized_weight - - - name: balancer_optimism_trades - meta: - blockchain: optimism - sector: dex - contributors: bizzyvinci - config: - tags: ['balancer', 'optimism', 'amm', 'trades', 'dex'] - description: > - DEX trades on balancer on optimism - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - block_date - - blockchain - - project - - version - - tx_hash - - evt_index - - check_dex_seed: - blockchain: optimism - project: balancer - version: 2 - columns: - - *blockchain - - &project - name: project - description: "Project name (balancer)" - - &version - name: version - description: "Version of the project" - - *block_month - - *block_date - - *block_time - - &token_bought_symbol - name: token_bought_symbol - description: "Token symbol for token bought in the trade" - - &token_sold_symbol - name: token_sold_symbol - description: "Token symbol for token sold in the trade" - - &token_pair - name: token_pair - description: "Token symbol pair for each token involved in the trade" - - &token_bought_amount - name: token_bought_amount - description: "Value of the token bought at time of execution in the original currency" - - &token_sold_amount - name: token_sold_amount - description: "Value of the token sold at time of execution in the original currency" - - &token_bought_amount_raw - name: token_bought_amount_raw - description: "Raw value of the token bought at time of execution in the original currency" - - &token_sold_amount_raw - name: token_sold_amount_raw - description: "Raw value of the token sold at time of execution in the original currency" - - &amount_usd - name: amount_usd - description: "USD value of the trade at time of execution" - - &token_bought_address - name: token_bought_address - description: "Contract address of the token bought" - - &token_sold_address - name: token_sold_address - description: "Contract address of the token sold" - - &taker - name: taker - description: "Address of trader who purchased a token" - - &maker - name: maker - description: "Address of trader who sold a token" - - *pool_id - - &swap_fee - name: swap_fee - description: 'Swap fee' - - &project_contract_address - name: project_contract_address - description: "Pool address" - - name: pool_symbol - - name: pool_type - - *tx_hash - - &tx_from - name: tx_from - description: "transaction.from" - - &tx_to - name: tx_to - description: "transaction.to" - - *evt_index - - - name: balancer_v2_optimism_liquidity - meta: - blockchain: optimism - project: balancer_v2 - contributors: victorstefenon, viniabussafi, thetroyharris - config: - tags: ['optimism', 'balancer', 'pools', 'liquidity'] - description: > - Balancer v2 pools liquidity by token in Optimism. - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - day - - pool_id - - token_address - columns: - - name: day - description: 'UTC event block time truncated to the day mark' - - *pool_id - - name: pool_address - - name: pool_symbol - description: 'Symbol of the pool, consisting of the symbol of its tokens and their respective weights' - - name: version - description: 'Version of Balancer in which pool was deployed' - - name: blockchain - description: 'Blockchain in which pool was deployed' - - *token_address - - name: token_symbol - description: 'Symbol of the token' - - name: token_balance_raw - description: 'Raw balance of the token in the pool' - - name: token_balance - description: 'Scaled balance of the token in the pool' - - name: protocol_liquidity_usd - description: 'Liquidity of the token in the pool in USD, except BPTs' - - name: protocol_liquidity_eth - description: 'Liquidity of the token in the pool in ETH, except BPTs' - - name: pool_liquidity_usd - description: 'Liquidity of the token in the pool in USD, including BPTs' - - name: pool_liquidity_eth - description: 'Liquidity of the token in the pool in ETH, including BPTs' - - - name: balancer_optimism_gauge_mappings - meta: - blockchain: optimism - project: balancer - contributors: msilb7 - config: - tags: ['optimism', 'balancer', 'gauges', 'incentives'] - description: > - Balancer gauge to pool mappings on Optimism. - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - pool_contract - - incentives_contract - columns: - - *blockchain - - *version - - &pool_contract - name: pool_contract - description: "Address of the liquidity pool contract" - - *pool_id - - &incentives_contract - name: incentives_contract - description: "Address of the contract where incentives are stored and emitted." - - &incentives_type - name: incentives_type - description: "Description of the incentives address type." - - *evt_block_time - - *evt_block_number - - *contract_address - - *evt_tx_hash - - *evt_index - - - name: balancer_v2_optimism_flashloans - meta: - blockchain: optimism - sector: lending - contributors: hildobby - config: - tags: ['optimism', 'flashloans'] - description: > - All Balancer flashloans on Optimism - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - blockchain - - tx_hash - - evt_index - columns: - - name: blockchain - - name: project - - name: version - - name: block_time - - name: block_number - - name: amount - - name: amount_usd - - name: tx_hash - - name: evt_index - - name: fee - - name: currency_contract - - name: currency_symbol - - name: recipient - - name: contract_address - - name: block_month - - - name: balancer_v2_optimism_bpt_prices - meta: - blockchain: optimism - project: balancer_v2 - contributors: victorstefenon, thetroyharris, viniabussafi - config: - tags: ['optimism', 'bpt', 'prices'] - description: > - Balancer Pool Token (BPT) hourly median price by pool on Balancer, an automated portfolio manager and trading platform. - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - blockchain - - day - - contract_address - columns: - - name: blockchain - - name: day - - name: version - - name: decimals - - name: contract_address - - name: bpt_price - - - name: balancer_v2_optimism_trades - meta: - blockchain: optimism - sector: dex - contributors: bizzyvinci, thetroyharris, tomfutago, viniabussafi - config: - tags: [ 'balancer', 'optimism', 'amm', 'trades', 'dex', 'beta' ] - description: > - DEX trades on balancer v2 on optimism - columns: - - *blockchain - - *project - - *version - - *block_month - - *block_date - - *block_time - - name: block_number - - *token_bought_symbol - - *token_sold_symbol - - *token_pair - - *token_bought_amount - - *token_sold_amount - - *token_bought_amount_raw - - *token_sold_amount_raw - - *amount_usd - - *token_bought_address - - *token_sold_address - - *taker - - *maker - - *project_contract_address - - name: pool_symbol - - name: pool_type - - *pool_id - - *swap_fee - - *tx_hash - - *tx_from - - *tx_to - - *evt_index - - - name: balancer_v2_optimism_protocol_fee - meta: - blockchain: optimism - project: balancer_v2 - contributors: viniabussafi - config: - tags: ['optimism', 'revenue', 'fees'] - description: > - Daily Protocol Fee collected and Revenue by pool on Balancer, an automated portfolio manager and trading platform. - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - day - - pool_id - - token_address - columns: - - name: day - - name: pool_id - - name: pool_address - - name: pool_symbol - - name: version - - name: blockchain - - name: token_address - - name: token_symbol - - name: token_amount_raw - description: "Raw amount of revenues of the token in the pool" - - name: token_amount - description: "Amount of revenues of the token in the pool" - - name: protocol_fee_collected_usd - description: "Fee collected in the pool in USD" - - name: treasury_share - description: "Share of total revenue that is directed to Balancer DAO's treasury, as per BIPs 19, 161 and 371" - - name: treasury_revenue_usd - description: "Total revenue directed to Balancer DAO's treasury" - - - name: balancer_v2_optimism_bpt_supply - meta: - blockchain: optimism - project: balancer_v2 - contributors: thetroyharris, viniabussafi - config: - tags: ['optimism', 'bpt', 'supply'] - description: > - Balancer Pool Token (BPT) supply for ComposableStablePools versions 4 and 5. - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - day - - blockchain - - token_address - columns: - - name: day - - name: pool_type - - name: version - - name: blockchain - - name: token_address - - name: supply \ No newline at end of file diff --git a/models/balancer/polygon/balancer_polygon_schema.yml b/models/balancer/polygon/balancer_polygon_schema.yml deleted file mode 100644 index 4f2bbd24412..00000000000 --- a/models/balancer/polygon/balancer_polygon_schema.yml +++ /dev/null @@ -1,454 +0,0 @@ -version: 2 - -models: - - name: balancer_v2_polygon_pools_fees - meta: - blockchain: polygon - project: balancer_v2 - contributors: jacektrocinski, thetroyharris, viniabussafi - config: - tags: ['polygon', 'balancer', 'pools_fees'] - description: > - Balancer v2 swap fees stored at the pool level. - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - block_number - - tx_hash - - index - columns: - - name: blockchain - - name: version - - &contract_address - name: contract_address - description: 'Polygon address for the liquidity pool used in transaction' - tests: - - not_null - - &tx_hash - name: tx_hash - description: 'Transaction hash' - tests: - - not_null - - &index - name: index - description: '' - tests: - - not_null - - &tx_index - name: tx_index - description: '' - tests: - - not_null - - &block_time - name: block_time - description: '' - tests: - - not_null - - &block_number - name: block_number - description: 'Block number' - tests: - - not_null - - &swap_fee_percentage - name: swap_fee_percentage - description: 'Swap fees for the pool, values are returned with 18 decimals (1e18 meaning 100%)' - tests: - - not_null - - - name: balancer_v2_polygon_transfers_bpt - meta: - blockchain: polygon - project: balancer_v2 - contributors: victorstefenon, thetroyharris, viniabussafi - config: - tags: ['polygon', 'bpt', 'transfers'] - description: > - Balancer Pool Token (BPT) transfer logs on Balancer, an automated portfolio manager and trading platform, on Polygon. - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - evt_tx_hash - - evt_index - - block_date - columns: - - &blockchain - name: blockchain - description: "Blockchain" - - name: version - - *contract_address - - &block_date - name: block_date - description: "UTC event block date of each DEX trade" - - &block_month - name: block_month - description: "UTC event block month of each DEX trade" - - &evt_tx_hash - name: evt_tx_hash - description: 'Transaction hash of transfer event' - - &evt_index - name: evt_index - description: 'Event index' - - &evt_block_time - name: evt_block_time - description: 'Block time of transfer event' - - &evt_block_number - name: evt_block_number - description: 'Block number of transfer event' - - &from - name: from - description: 'Address of BPT provider of transfer event' - - &to - name: to - description: 'Address of BPT receiver of transfer event' - - &value - name: value - description: 'Amount of BPT transferred in transfer event' - - - name: balancer_polygon_pools_tokens_weights - meta: - blockchain: polygon - project: balancer - contributors: jacektrocinski, viniabussafi - config: - tags: ['polygon', 'balancer', 'pools', 'tokens', 'weights'] - description: > - Token weights in Balancer pools. - columns: - - *blockchain - - name: version - - &pool_id - name: pool_id - description: 'Unique encoded identifier that refers to each pool' - tests: - - not_null - - &token_address - name: token_address - description: 'Contract address for the token' - - &normalized_weight - name: normalized_weight - description: 'Weight of the token in the pool.' - - - name: balancer_v2_polygon_pools_tokens_weights - meta: - blockchain: polygon - project: balancer - contributors: jacektrocinski, viniabussafi - config: - tags: ['polygon', 'balancer', 'pools', 'tokens', 'weights'] - description: > - Token weights in Balancer v2 pools. - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - pool_id - - token_address - columns: - - *blockchain - - name: version - - *pool_id - - *token_address - - *normalized_weight - - - name: balancer_polygon_trades - meta: - blockchain: polygon - sector: dex - contributors: bizzyvinci - config: - tags: ['balancer', 'polygon', 'amm', 'trades', 'dex'] - description: > - DEX trades on balancer on polygon - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - block_date - - blockchain - - project - - version - - tx_hash - - evt_index - - check_dex_seed: - blockchain: polygon - project: balancer - version: 2 - columns: - - *blockchain - - &project - name: project - description: "Project name (balancer)" - - &version - name: version - description: "Version of the project" - - *block_month - - *block_date - - *block_time - - &token_bought_symbol - name: token_bought_symbol - description: "Token symbol for token bought in the trade" - - &token_sold_symbol - name: token_sold_symbol - description: "Token symbol for token sold in the trade" - - &token_pair - name: token_pair - description: "Token symbol pair for each token involved in the trade" - - &token_bought_amount - name: token_bought_amount - description: "Value of the token bought at time of execution in the original currency" - - &token_sold_amount - name: token_sold_amount - description: "Value of the token sold at time of execution in the original currency" - - &token_bought_amount_raw - name: token_bought_amount_raw - description: "Raw value of the token bought at time of execution in the original currency" - - &token_sold_amount_raw - name: token_sold_amount_raw - description: "Raw value of the token sold at time of execution in the original currency" - - &amount_usd - name: amount_usd - description: "USD value of the trade at time of execution" - - &token_bought_address - name: token_bought_address - description: "Contract address of the token bought" - - &token_sold_address - name: token_sold_address - description: "Contract address of the token sold" - - &taker - name: taker - description: "Address of trader who purchased a token" - - &maker - name: maker - description: "Address of trader who sold a token" - - *pool_id - - &swap_fee - name: swap_fee - description: 'Swap fee' - - &project_contract_address - name: project_contract_address - description: "Pool address" - - name: pool_symbol - - name: pool_type - - *tx_hash - - &tx_from - name: tx_from - description: "transaction.from" - - &tx_to - name: tx_to - description: "transaction.to" - - *evt_index - - - name: balancer_v2_polygon_liquidity - meta: - blockchain: polygon - project: balancer_v2 - contributors: victorstefenon, viniabussafi, thetroyharris - config: - tags: ['polygon', 'balancer', 'pools', 'liquidity'] - description: > - Balancer v2 pools liquidity by token in Polygon. - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - day - - pool_id - - token_address - columns: - - name: day - description: 'UTC event block time truncated to the day mark' - - *pool_id - - name: pool_address - - name: pool_symbol - description: 'Symbol of the pool, consisting of the symbol of its tokens and their respective weights' - - name: version - description: 'Version of Balancer in which pool was deployed' - - name: blockchain - description: 'Blockchain in which pool was deployed' - - *token_address - - name: token_symbol - description: 'Symbol of the token' - - name: token_balance_raw - description: 'Raw balance of the token in the pool' - - name: token_balance - description: 'Scaled balance of the token in the pool' - - name: protocol_liquidity_usd - description: 'Liquidity of the token in the pool in USD, except BPTs' - - name: protocol_liquidity_eth - description: 'Liquidity of the token in the pool in ETH, except BPTs' - - name: pool_liquidity_usd - description: 'Liquidity of the token in the pool in USD, including BPTs' - - name: pool_liquidity_eth - description: 'Liquidity of the token in the pool in ETH, including BPTs' - - - name: balancer_v2_polygon_lbps - meta: - blockchain: polygon - project: balancer_v2 - contributors: stefenon - config: - tags: ['polygon', 'balancer', 'lbp'] - description: > - Record of the Liquidity Boostrapping Pools (LBP) of Balancer, an automated portfolio manager and trading platform, on Polygon. - columns: - - name: name - description: 'Name of the LBP' - - name: pool_id - description: 'ID of the LBP' - - name: token_sold - description: 'Contract address of the token sold by the LBP' - - name: token_symbol - description: 'Symbol of the token sold by the LBP' - - name: start_time - description: 'LBP start time' - - name: end_time - description: 'LBP end time' - - - name: balancer_v2_polygon_flashloans - meta: - blockchain: polygon - sector: lending - contributors: hildobby - config: - tags: ['polygon', 'flashloans'] - description: > - All Balancer flashloans on Polygon - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - blockchain - - tx_hash - - evt_index - columns: - - name: blockchain - - name: project - - name: version - - name: block_time - - name: block_number - - name: amount - - name: amount_usd - - name: tx_hash - - name: evt_index - - name: fee - - name: currency_contract - - name: currency_symbol - - name: recipient - - name: contract_address - - name: block_month - - - name: balancer_v2_polygon_bpt_prices - meta: - blockchain: polygon - project: balancer_v2 - contributors: victorstefenon, thetroyharris, viniabussafi - config: - tags: ['polygon', 'bpt', 'prices'] - description: > - Balancer Pool Token (BPT) hourly median price by pool on Balancer, an automated portfolio manager and trading platform. - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - blockchain - - day - - contract_address - columns: - - name: blockchain - - name: day - - name: version - - name: decimals - - name: contract_address - - name: bpt_price - - - name: balancer_v2_polygon_trades - meta: - blockchain: polygon - sector: dex - contributors: bizzyvinci, thetroyharris, tomfutago, viniabussafi - config: - tags: [ 'balancer', 'polygon', 'amm', 'trades', 'dex', 'beta' ] - description: > - DEX trades on balancer v2 on polygon - columns: - - *blockchain - - *project - - *version - - *block_month - - *block_date - - *block_time - - name: block_number - - *token_bought_symbol - - *token_sold_symbol - - *token_pair - - *token_bought_amount - - *token_sold_amount - - *token_bought_amount_raw - - *token_sold_amount_raw - - *amount_usd - - *token_bought_address - - *token_sold_address - - *taker - - *maker - - *project_contract_address - - name: pool_symbol - - name: pool_type - - *pool_id - - *swap_fee - - *tx_hash - - *tx_from - - *tx_to - - *evt_index - - - name: balancer_v2_polygon_protocol_fee - meta: - blockchain: polygon - project: balancer_v2 - contributors: viniabussafi - config: - tags: ['polygon', 'revenue', 'fees'] - description: > - Daily Protocol Fee collected and Revenue by pool on Balancer, an automated portfolio manager and trading platform. - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - day - - pool_id - - token_address - columns: - - name: day - - name: pool_id - - name: pool_address - - name: pool_symbol - - name: version - - name: blockchain - - name: token_address - - name: token_symbol - - name: token_amount_raw - description: "Raw amount of revenues of the token in the pool" - - name: token_amount - description: "Amount of revenues of the token in the pool" - - name: protocol_fee_collected_usd - description: "Fee collected in the pool in USD" - - name: treasury_share - description: "Share of total revenue that is directed to Balancer DAO's treasury, as per BIPs 19, 161 and 371" - - name: treasury_revenue_usd - description: "Total revenue directed to Balancer DAO's treasury" - - - name: balancer_v2_polygon_bpt_supply - meta: - blockchain: polygon - project: balancer_v2 - contributors: thetroyharris, viniabussafi - config: - tags: ['polygon', 'bpt', 'supply'] - description: > - Balancer Pool Token (BPT) supply for ComposableStablePools versions 4 and 5. - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - day - - blockchain - - token_address - columns: - - name: day - - name: pool_type - - name: version - - name: blockchain - - name: token_address - - name: supply \ No newline at end of file diff --git a/models/balancer/zkevm/balancer_zkevm_schema.yml b/models/balancer/zkevm/balancer_zkevm_schema.yml deleted file mode 100644 index a573e89563d..00000000000 --- a/models/balancer/zkevm/balancer_zkevm_schema.yml +++ /dev/null @@ -1,431 +0,0 @@ -version: 2 - -models: - - name: balancer_v2_zkevm_pools_fees - meta: - blockchain: zkevm - project: balancer_v2 - contributors: jacektrocinski, thetroyharris, viniabussafi - config: - tags: ['zkevm', 'balancer', 'pools_fees'] - description: > - Balancer v2 swap fees stored at the pool level. - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - block_number - - tx_hash - - index - columns: - - name: blockchain - - name: version - - &contract_address - name: contract_address - description: 'zkevm address for the liquidity pool used in transaction' - tests: - - not_null - - &tx_hash - name: tx_hash - description: 'Transaction hash' - tests: - - not_null - - &index - name: index - description: '' - tests: - - not_null - - &tx_index - name: tx_index - description: '' - tests: - - not_null - - &block_time - name: block_time - description: '' - tests: - - not_null - - &block_number - name: block_number - description: 'Block number' - tests: - - not_null - - &swap_fee_percentage - name: swap_fee_percentage - description: 'Swap fees for the pool, values are returned with 18 decimals (1e18 meaning 100%)' - tests: - - not_null - - - name: balancer_v2_zkevm_transfers_bpt - meta: - blockchain: zkevm - project: balancer_v2 - contributors: victorstefenon, thetroyharris, viniabussafi - config: - tags: ['zkevm', 'bpt', 'transfers'] - description: > - Balancer Pool Token (BPT) transfer logs on Balancer, an automated portfolio manager and trading platform, on Polygon. - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - evt_tx_hash - - evt_index - - block_date - columns: - - &blockchain - name: blockchain - description: "Blockchain" - - name: version - - *contract_address - - &block_date - name: block_date - description: "UTC event block date of each DEX trade" - - &block_month - name: block_month - description: "UTC event block month of each DEX trade" - - &evt_tx_hash - name: evt_tx_hash - description: 'Transaction hash of transfer event' - - &evt_index - name: evt_index - description: 'Event index' - - &evt_block_time - name: evt_block_time - description: 'Block time of transfer event' - - &evt_block_number - name: evt_block_number - description: 'Block number of transfer event' - - &from - name: from - description: 'Address of BPT provider of transfer event' - - &to - name: to - description: 'Address of BPT receiver of transfer event' - - &value - name: value - description: 'Amount of BPT transferred in transfer event' - - - name: balancer_zkevm_pools_tokens_weights - meta: - blockchain: zkevm - project: balancer - contributors: jacektrocinski, viniabussafi - config: - tags: ['zkevm', 'balancer', 'pools', 'tokens', 'weights'] - description: > - Token weights in Balancer pools. - columns: - - name: blockchain - - name: version - - &pool_id - name: pool_id - description: 'Unique encoded identifier that refers to each pool' - tests: - - not_null - - &token_address - name: token_address - description: 'Contract address for the token' - - &normalized_weight - name: normalized_weight - description: 'Weight of the token in the pool.' - - - name: balancer_v2_zkevm_pools_tokens_weights - meta: - blockchain: zkevm - project: balancer - contributors: jacektrocinski, viniabussafi - config: - tags: ['zkevm', 'balancer', 'pools', 'tokens', 'weights'] - description: > - Token weights in Balancer v2 pools. - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - pool_id - - token_address - columns: - - name: blockchain - - name: version - - name: pool_id - - name: token_address - - name: normalized_weight - - - name: balancer_zkevm_trades - meta: - blockchain: zkevm - sector: dex - contributors: bizzyvinci, viniabussafi - config: - tags: ['balancer', 'zkevm', 'amm', 'trades', 'dex'] - description: > - DEX trades on balancer on zkevm - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - block_date - - blockchain - - project - - version - - tx_hash - - evt_index - - check_dex_seed: - blockchain: zkevm - project: balancer - version: 2 - columns: - - name: blockchain - - &project - name: project - description: "Project name (balancer)" - - &version - name: version - description: "Version of the project" - - name: block_month - - name: block_date - - name: block_time - - &token_bought_symbol - name: token_bought_symbol - description: "Token symbol for token bought in the trade" - - &token_sold_symbol - name: token_sold_symbol - description: "Token symbol for token sold in the trade" - - &token_pair - name: token_pair - description: "Token symbol pair for each token involved in the trade" - - &token_bought_amount - name: token_bought_amount - description: "Value of the token bought at time of execution in the original currency" - - &token_sold_amount - name: token_sold_amount - description: "Value of the token sold at time of execution in the original currency" - - &token_bought_amount_raw - name: token_bought_amount_raw - description: "Raw value of the token bought at time of execution in the original currency" - - &token_sold_amount_raw - name: token_sold_amount_raw - description: "Raw value of the token sold at time of execution in the original currency" - - &amount_usd - name: amount_usd - description: "USD value of the trade at time of execution" - - &token_bought_address - name: token_bought_address - description: "Contract address of the token bought" - - &token_sold_address - name: token_sold_address - description: "Contract address of the token sold" - - &taker - name: taker - description: "Address of trader who purchased a token" - - &maker - name: maker - description: "Address of trader who sold a token" - - name: pool_id - - &swap_fee - name: swap_fee - description: 'Swap fee' - - &project_contract_address - name: project_contract_address - description: "Pool address" - - name: pool_symbol - - name: pool_type - - name: tx_hash - - &tx_from - name: tx_from - description: "transaction.from" - - &tx_to - name: tx_to - description: "transaction.to" - - name: evt_index - - - name: balancer_v2_zkevm_liquidity - meta: - blockchain: zkevm - project: balancer_v2 - contributors: victorstefenon, viniabussafi, thetroyharris - config: - tags: ['zkevm', 'balancer', 'pools', 'liquidity'] - description: > - Balancer v2 pools liquidity by token in zkevm. - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - day - - pool_id - - token_address - columns: - - name: day - description: 'UTC event block time truncated to the day mark' - - name: pool_id - - name: pool_address - - name: pool_symbol - description: 'Symbol of the pool, consisting of the symbol of its tokens and their respective weights' - - name: version - description: 'Version of Balancer in which pool was deployed' - - name: blockchain - description: 'Blockchain in which pool was deployed' - - name: token_address - - name: token_symbol - description: 'Symbol of the token' - - name: token_balance_raw - description: 'Raw balance of the token in the pool' - - name: token_balance - description: 'Scaled balance of the token in the pool' - - name: protocol_liquidity_usd - description: 'Liquidity of the token in the pool in USD, except BPTs' - - name: protocol_liquidity_eth - description: 'Liquidity of the token in the pool in ETH, except BPTs' - - name: pool_liquidity_usd - description: 'Liquidity of the token in the pool in USD, including BPTs' - - name: pool_liquidity_eth - description: 'Liquidity of the token in the pool in ETH, including BPTs' - - - name: balancer_v2_zkevm_flashloans - meta: - blockchain: zkevm - sector: lending - contributors: hildobby, viniabussafi - config: - tags: ['zkevm', 'flashloans'] - description: > - All Balancer flashloans on zkevm - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - blockchain - - tx_hash - - evt_index - columns: - - name: blockchain - - name: project - - name: version - - name: block_time - - name: block_number - - name: amount - - name: amount_usd - - name: tx_hash - - name: evt_index - - name: fee - - name: currency_contract - - name: currency_symbol - - name: recipient - - name: contract_address - - name: block_month - - - name: balancer_v2_zkevm_bpt_prices - meta: - blockchain: zkevm - project: balancer_v2 - contributors: victorstefenon, thetroyharris, viniabussafi - config: - tags: ['zkevm', 'bpt', 'prices'] - description: > - Balancer Pool Token (BPT) hourly median price by pool on Balancer, an automated portfolio manager and trading platform. - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - blockchain - - day - - contract_address - columns: - - name: blockchain - - name: day - - name: version - - name: decimals - - name: contract_address - - name: bpt_price - - - name: balancer_v2_zkevm_trades - meta: - blockchain: zkevm - sector: dex - contributors: bizzyvinci, thetroyharris, tomfutago, viniabussafi - config: - tags: [ 'balancer', 'zkevm', 'amm', 'trades', 'dex', 'beta' ] - description: > - DEX trades on balancer v2 on zkevm - columns: - - name: blockchain - - name: project - - name: version - - name: block_month - - name: block_date - - name: block_time - - name: block_number - - name: token_bought_symbol - - name: token_sold_symbol - - name: token_pair - - name: token_bought_amount - - name: token_sold_amount - - name: token_bought_amount_raw - - name: token_sold_amount_raw - - name: amount_usd - - name: token_bought_address - - name: token_sold_address - - name: taker - - name: maker - - name: project_contract_address - - name: pool_symbol - - name: pool_type - - name: pool_id - - name: swap_fee - - name: tx_hash - - name: tx_from - - name: tx_to - - name: evt_index - - - name: balancer_v2_zkevm_protocol_fee - meta: - blockchain: zkevm - project: balancer_v2 - contributors: viniabussafi - config: - tags: ['zkevm', 'revenue', 'fees'] - description: > - Daily Protocol Fee collected and Revenue by pool on Balancer, an automated portfolio manager and trading platform. - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - day - - pool_id - - token_address - columns: - - name: day - - name: pool_id - - name: pool_address - - name: pool_symbol - - name: version - - name: blockchain - - name: token_address - - name: token_symbol - - name: token_amount_raw - description: "Raw amount of revenues of the token in the pool" - - name: token_amount - description: "Amount of revenues of the token in the pool" - - name: protocol_fee_collected_usd - description: "Fee collected in the pool in USD" - - name: treasury_share - description: "Share of total revenue that is directed to Balancer DAO's treasury, as per BIPs 19, 161 and 371" - - name: treasury_revenue_usd - description: "Total revenue directed to Balancer DAO's treasury" - - - name: balancer_v2_zkevm_bpt_supply - meta: - blockchain: zkevm - project: balancer_v2 - contributors: thetroyharris, viniabussafi - config: - tags: ['zkevm', 'bpt', 'supply'] - description: > - Balancer Pool Token (BPT) supply for ComposableStablePools versions 4 and 5. - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - day - - blockchain - - token_address - columns: - - name: day - - name: pool_type - - name: version - - name: blockchain - - name: token_address - - name: supply From d108e3db088e56690956f9fb36676a3ae474101b Mon Sep 17 00:00:00 2001 From: Alan Ghobadi Date: Tue, 4 Jun 2024 01:20:17 +0200 Subject: [PATCH 030/149] Transfers incremental predicate (#6046) * Update transfer models to use incremental predicate macro * Update transfer macros to use incremental predicate macro * More updates * Remove schema * Add incremental_predicates to merge intos --- dbt_project.yml | 2 - .../transfers/erc20/transfers_erc20.sql | 84 ++++++++--------- .../erc20/transfers_erc20_agg_day.sql | 6 +- .../erc20/transfers_erc20_agg_hour.sql | 6 +- .../erc20/transfers_arbitrum_erc20.sql | 43 ++++----- .../transfers_arbitrum_erc20_agg_day.sql | 9 +- .../transfers_arbitrum_erc20_agg_hour.sql | 9 +- .../base/erc20/transfers_base_erc20.sql | 11 ++- models/transfers/base/transfers_base_eth.sql | 11 ++- .../bitcoin/transfers_bitcoin_satoshi.sql | 55 +++++------ .../transfers_bitcoin_satoshi_agg_day.sql | 5 +- .../bnb/bep20/transfers_bnb_bep20.sql | 91 ++++++++++--------- .../bnb/bep20/transfers_bnb_bep20_agg_day.sql | 9 +- .../bep20/transfers_bnb_bep20_agg_hour.sql | 9 +- .../transfers/bnb/bnb/transfers_bnb_bnb.sql | 79 ++++++++-------- .../bnb/bnb/transfers_bnb_bnb_agg_day.sql | 7 +- .../bnb/bnb/transfers_bnb_bnb_agg_hour.sql | 7 +- .../celo/erc1155/transfers_celo_erc1155.sql | 13 +-- .../transfers_celo_erc1155_agg_day.sql | 7 +- .../transfers_celo_erc1155_agg_hour.sql | 7 +- .../celo/erc20/transfers_celo_erc20.sql | 20 ++-- .../erc20/transfers_celo_erc20_agg_day.sql | 7 +- .../erc20/transfers_celo_erc20_agg_hour.sql | 7 +- .../transfers_celo_erc20_rolling_day.sql | 5 +- .../transfers_celo_erc20_rolling_hour.sql | 6 +- .../celo/erc721/transfers_celo_erc721.sql | 9 +- .../erc721/transfers_celo_erc721_agg_day.sql | 7 +- .../erc721/transfers_celo_erc721_agg_hour.sql | 7 +- models/transfers/celo/transfers_celo_celo.sql | 11 ++- .../ethereum/transfers_ethereum_eth.sql | 19 ++-- .../fantom/erc20/transfers_fantom_erc20.sql | 76 ---------------- .../fantom/erc20/transfers_fantom_schema.yml | 37 -------- .../optimism/transfers_optimism_eth.sql | 11 ++- .../polygon/erc20/transfers_polygon_erc20.sql | 5 +- .../erc20/transfers_polygon_erc20_agg_day.sql | 3 +- .../transfers_polygon_erc20_agg_hour.sql | 3 +- .../polygon/matic/transfers_polygon_matic.sql | 79 ++++++++-------- .../matic/transfers_polygon_matic_agg_day.sql | 7 +- .../transfers_polygon_matic_agg_hour.sql | 7 +- .../fantom/transfers_fantom_erc20_test.sql | 16 ---- 40 files changed, 356 insertions(+), 456 deletions(-) delete mode 100644 models/transfers/fantom/erc20/transfers_fantom_erc20.sql delete mode 100644 models/transfers/fantom/erc20/transfers_fantom_schema.yml delete mode 100644 tests/transfers/fantom/transfers_fantom_erc20_test.sql diff --git a/dbt_project.yml b/dbt_project.yml index 91320626953..1daa6f7fd4a 100644 --- a/dbt_project.yml +++ b/dbt_project.yml @@ -437,8 +437,6 @@ models: +schema: transfers_arbitrum polygon: +schema: transfers_polygon - fantom: - +schema: transfers_fantom base: +schema: transfers_base celo: diff --git a/macros/models/_sector/transfers/erc20/transfers_erc20.sql b/macros/models/_sector/transfers/erc20/transfers_erc20.sql index ce02f2a1880..5f58c1bcdce 100644 --- a/macros/models/_sector/transfers/erc20/transfers_erc20.sql +++ b/macros/models/_sector/transfers/erc20/transfers_erc20.sql @@ -4,98 +4,98 @@ WITH erc20_transfers as ( - SELECT - 'receive' as transfer_type, + SELECT + 'receive' as transfer_type, evt_tx_hash, - evt_index, + evt_index, evt_block_time, - to as wallet_address, + to as wallet_address, contract_address as token_address, CAST(value as double) as amount_raw - FROM + FROM {{ erc20_evt_transfer }} {% if is_incremental() %} - WHERE evt_block_time >= date_trunc('day', now() - interval '3' Day) + WHERE {{ incremental_predicate('evt_block_time') }} {% endif %} - UNION ALL + UNION ALL - SELECT - 'send' as transfer_type, + SELECT + 'send' as transfer_type, evt_tx_hash, - evt_index, + evt_index, evt_block_time, - "from" as wallet_address, + "from" as wallet_address, contract_address as token_address, -CAST(value as double) as amount_raw - FROM + FROM {{ erc20_evt_transfer }} {% if is_incremental() %} - WHERE evt_block_time >= date_trunc('day', now() - interval '3' Day) + WHERE {{ incremental_predicate('evt_block_time') }} {% endif %} ) {% if wrapped_token_deposit and wrapped_token_withdrawal %} , wrapped_token_events as ( - SELECT - 'deposit' as transfer_type, - evt_tx_hash, - evt_index, + SELECT + 'deposit' as transfer_type, + evt_tx_hash, + evt_index, evt_block_time, - dst as wallet_address, - contract_address as token_address, + dst as wallet_address, + contract_address as token_address, CAST(wad as double)as amount_raw - FROM + FROM {{ wrapped_token_deposit }} {% if is_incremental() %} - WHERE evt_block_time >= date_trunc('day', now() - interval '3' Day) + WHERE {{ incremental_predicate('evt_block_time') }} {% endif %} - UNION ALL + UNION ALL - SELECT - 'withdraw' as transfer_type, - evt_tx_hash, - evt_index, + SELECT + 'withdraw' as transfer_type, + evt_tx_hash, + evt_index, evt_block_time, - src as wallet_address, - contract_address as token_address, + src as wallet_address, + contract_address as token_address, -CAST(wad as double)as amount_raw - FROM + FROM {{ wrapped_token_withdrawal }} {% if is_incremental() %} - WHERE evt_block_time >= date_trunc('day', now() - interval '3' Day) + WHERE {{ incremental_predicate('evt_block_time') }} {% endif %} ) {% endif %} SELECT - '{{blockchain}}' as blockchain, + '{{blockchain}}' as blockchain, transfer_type, - evt_tx_hash, + evt_tx_hash, evt_index, evt_block_time, CAST(date_trunc('month', evt_block_time) as date) as block_month, - wallet_address, - token_address, + wallet_address, + token_address, amount_raw -FROM +FROM erc20_transfers {% if wrapped_token_deposit and wrapped_token_withdrawal %} -UNION ALL +UNION ALL -SELECT - '{{blockchain}}' as blockchain, +SELECT + '{{blockchain}}' as blockchain, transfer_type, - evt_tx_hash, + evt_tx_hash, evt_index, evt_block_time, CAST(date_trunc('month', evt_block_time) as date) as block_month, - wallet_address, - token_address, + wallet_address, + token_address, amount_raw -FROM +FROM wrapped_token_events {% endif %} diff --git a/macros/models/_sector/transfers/erc20/transfers_erc20_agg_day.sql b/macros/models/_sector/transfers/erc20/transfers_erc20_agg_day.sql index 12607fce1e3..e4ce5f93ff3 100644 --- a/macros/models/_sector/transfers/erc20/transfers_erc20_agg_day.sql +++ b/macros/models/_sector/transfers/erc20/transfers_erc20_agg_day.sql @@ -9,13 +9,13 @@ SELECT t.symbol, sum(tr.amount_raw) as amount_raw, sum(tr.amount_raw / power(10, t.decimals)) as amount -FROM +FROM {{ transfers_erc20 }} tr -LEFT JOIN +LEFT JOIN {{ tokens_erc20 }} t on t.contract_address = tr.token_address {% if is_incremental() %} -- this filter will only be applied on an incremental run -WHERE tr.evt_block_time >= date_trunc('day', now() - interval '3' Day) +WHERE {{ incremental_predicate('tr.evt_block_time') }} {% endif %} GROUP BY 1, 2, 3, 4, 5, 6 diff --git a/macros/models/_sector/transfers/erc20/transfers_erc20_agg_hour.sql b/macros/models/_sector/transfers/erc20/transfers_erc20_agg_hour.sql index 9b6d8ccf5d2..f28169a5f8d 100644 --- a/macros/models/_sector/transfers/erc20/transfers_erc20_agg_hour.sql +++ b/macros/models/_sector/transfers/erc20/transfers_erc20_agg_hour.sql @@ -9,13 +9,13 @@ SELECT t.symbol, sum(tr.amount_raw) as amount_raw, sum(tr.amount_raw / power(10, t.decimals)) as amount -FROM +FROM {{ transfers_erc20 }} tr -LEFT JOIN +LEFT JOIN {{ tokens_erc20 }} t on t.contract_address = tr.token_address {% if is_incremental() %} -- this filter will only be applied on an incremental run -WHERE tr.evt_block_time >= date_trunc('hour', now() - interval '3' Day) +WHERE {{ incremental_predicate('tr.evt_block_time') }} {% endif %} GROUP BY 1, 2, 3, 4, 5, 6 diff --git a/models/transfers/arbitrum/erc20/transfers_arbitrum_erc20.sql b/models/transfers/arbitrum/erc20/transfers_arbitrum_erc20.sql index b2285e92538..3919e8ea425 100644 --- a/models/transfers/arbitrum/erc20/transfers_arbitrum_erc20.sql +++ b/models/transfers/arbitrum/erc20/transfers_arbitrum_erc20.sql @@ -1,59 +1,60 @@ {{ config( - + materialized = 'incremental', partition_by = ['block_month'], file_format = 'delta', incremental_strategy = 'merge', - unique_key = ['transfer_type', 'evt_tx_hash', 'evt_index', 'wallet_address'], + incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.evt_block_time')], + unique_key = ['transfer_type', 'evt_tx_hash', 'evt_index', 'wallet_address'], alias = 'erc20', post_hook='{{ expose_spells(\'["arbitrum"]\', "sector", "transfers", \'["Henrystats"]\') }}') }} -WITH +WITH erc20_transfers as ( - SELECT - 'receive' as transfer_type, + SELECT + 'receive' as transfer_type, evt_tx_hash, - evt_index, + evt_index, evt_block_time, - to as wallet_address, + to as wallet_address, contract_address as token_address, CAST(value as double) as amount_raw - FROM + FROM {{ source('erc20_arbitrum', 'evt_transfer') }} {% if is_incremental() %} - WHERE evt_block_time >= date_trunc('day', now() - interval '3' Day) + WHERE {{ incremental_predicate('evt_block_time') }} {% endif %} - UNION ALL + UNION ALL - SELECT - 'send' as transfer_type, + SELECT + 'send' as transfer_type, evt_tx_hash, - evt_index, + evt_index, evt_block_time, - "from" as wallet_address, + "from" as wallet_address, contract_address as token_address, -CAST(value as double) as amount_raw - FROM + FROM {{ source('erc20_arbitrum', 'evt_transfer') }} {% if is_incremental() %} - WHERE evt_block_time >= date_trunc('day', now() - interval '3' Day) + WHERE {{ incremental_predicate('evt_block_time') }} {% endif %} ) SELECT - 'arbitrum' as blockchain, + 'arbitrum' as blockchain, transfer_type, - evt_tx_hash, + evt_tx_hash, evt_index, evt_block_time, CAST(date_trunc('month', evt_block_time) as date) as block_month, - wallet_address, - token_address, + wallet_address, + token_address, amount_raw -FROM +FROM erc20_transfers \ No newline at end of file diff --git a/models/transfers/arbitrum/erc20/transfers_arbitrum_erc20_agg_day.sql b/models/transfers/arbitrum/erc20/transfers_arbitrum_erc20_agg_day.sql index ed191363adb..b78ec3fac43 100644 --- a/models/transfers/arbitrum/erc20/transfers_arbitrum_erc20_agg_day.sql +++ b/models/transfers/arbitrum/erc20/transfers_arbitrum_erc20_agg_day.sql @@ -1,10 +1,11 @@ {{ config( - + alias = 'erc20_agg_day', materialized ='incremental', partition_by = ['block_month'], file_format ='delta', incremental_strategy='merge', + incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.block_day')], unique_key = ['block_day', 'wallet_address', 'token_address'] ) }} @@ -18,12 +19,12 @@ select t.symbol, sum(tr.amount_raw) as amount_raw, sum(tr.amount_raw / power(10, t.decimals)) as amount -FROM +FROM {{ ref('transfers_arbitrum_erc20') }} tr -LEFT JOIN +LEFT JOIN {{ source('tokens_arbitrum', 'erc20') }} t on t.contract_address = tr.token_address {% if is_incremental() %} -- this filter will only be applied on an incremental run -WHERE tr.evt_block_time >= date_trunc('day', now() - interval '3' Day) +WHERE {{ incremental_predicate('tr.evt_block_time') }} {% endif %} GROUP BY 1, 2, 3, 4, 5, 6 \ No newline at end of file diff --git a/models/transfers/arbitrum/erc20/transfers_arbitrum_erc20_agg_hour.sql b/models/transfers/arbitrum/erc20/transfers_arbitrum_erc20_agg_hour.sql index 4c7b879e68f..0e18fd08b5a 100644 --- a/models/transfers/arbitrum/erc20/transfers_arbitrum_erc20_agg_hour.sql +++ b/models/transfers/arbitrum/erc20/transfers_arbitrum_erc20_agg_hour.sql @@ -1,10 +1,11 @@ {{ config( - + alias = 'erc20_agg_hour', materialized ='incremental', partition_by = ['block_month'], file_format ='delta', incremental_strategy='merge', + incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.block_hour')], unique_key = ['block_hour', 'wallet_address', 'token_address'] ) }} @@ -18,12 +19,12 @@ select t.symbol, sum(tr.amount_raw) as amount_raw, sum(tr.amount_raw / power(10, t.decimals)) as amount -FROM +FROM {{ ref('transfers_arbitrum_erc20') }} tr -LEFT JOIN +LEFT JOIN {{ source('tokens_arbitrum', 'erc20') }} t on t.contract_address = tr.token_address {% if is_incremental() %} -- this filter will only be applied on an incremental run -WHERE tr.evt_block_time >= date_trunc('hour', now() - interval '3' Day) +WHERE {{ incremental_predicate('tr.evt_block_time') }} {% endif %} GROUP BY 1, 2, 3, 4, 5, 6 \ No newline at end of file diff --git a/models/transfers/base/erc20/transfers_base_erc20.sql b/models/transfers/base/erc20/transfers_base_erc20.sql index b0ca8109d14..67c954bcdf6 100644 --- a/models/transfers/base/erc20/transfers_base_erc20.sql +++ b/models/transfers/base/erc20/transfers_base_erc20.sql @@ -1,9 +1,10 @@ {{ config( alias = 'erc20', - + materialized ='incremental', file_format ='delta', incremental_strategy='merge', + incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.evt_block_time')], unique_key='unique_transfer_id', post_hook='{{ expose_spells(\'["base"]\', "sector", @@ -22,7 +23,7 @@ with {{ source('erc20_base', 'evt_transfer') }} where 1=1 {% if is_incremental() %} -- this filter will only be applied on an incremental run - and evt_block_time >= date_trunc('day', now() - interval '7' day) + and {{ incremental_predicate('evt_block_time') }} {% endif %} ) @@ -38,7 +39,7 @@ with {{ source('erc20_base', 'evt_transfer') }} where 1=1 {% if is_incremental() %} -- this filter will only be applied on an incremental run - and evt_block_time >= date_trunc('day', now() - interval '7' day) + and {{ incremental_predicate('evt_block_time') }} {% endif %} ) @@ -56,7 +57,7 @@ with WHERE contract_address = 0x4200000000000000000000000000000000000006 AND topic0 = 0xe1fffcc4923d04b559f4d29a8bfc6cda04eb5b0d3c460751c2402c5c5cc9109c --deposit {% if is_incremental() %} -- this filter will only be applied on an incremental run - and block_time >= date_trunc('day', now() - interval '7' day) + and {{ incremental_predicate('block_time') }} {% endif %} ) @@ -73,7 +74,7 @@ with WHERE contract_address = 0x4200000000000000000000000000000000000006 AND topic0 = 0x7fcf532c15f0a6db0bd6d0e038bea71d30d808c7d98cb3bf7268a95bf5081b65 --withdrawal {% if is_incremental() %} -- this filter will only be applied on an incremental run - and block_time >= date_trunc('day', now() - interval '7' day) + and {{ incremental_predicate('block_time') }} {% endif %} ) diff --git a/models/transfers/base/transfers_base_eth.sql b/models/transfers/base/transfers_base_eth.sql index 14bfe7258be..448ee7df82d 100644 --- a/models/transfers/base/transfers_base_eth.sql +++ b/models/transfers/base/transfers_base_eth.sql @@ -1,10 +1,11 @@ {{ config( alias ='eth', - + materialized ='incremental', file_format ='delta', incremental_strategy='merge', + incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.tx_block_time')], unique_key='unique_transfer_id', post_hook='{{ expose_spells(\'["base"]\', "sector", @@ -38,8 +39,8 @@ with eth_transfers as ( and r.success and r.value > uint256 '0' {% if is_incremental() %} -- this filter will only be applied on an incremental run - and r.block_time >= date_trunc('day', now() - interval '7' day) - and t.block_time >= date_trunc('day', now() - interval '7' day) + and {{ incremental_predicate('r.block_time') }} + and {{ incremental_predicate('t.block_time') }} {% endif %} union all @@ -69,8 +70,8 @@ with eth_transfers as ( and t.success and r.value > uint256 '0' {% if is_incremental() %} -- this filter will only be applied on an incremental run - and r.evt_block_time >= date_trunc('day', now() - interval '7' day) - and t.block_time >= date_trunc('day', now() - interval '7' day) + and {{ incremental_predicate('r.evt_block_time') }} + and {{ incremental_predicate('t.block_time') }} {% endif %} ) select * diff --git a/models/transfers/bitcoin/transfers_bitcoin_satoshi.sql b/models/transfers/bitcoin/transfers_bitcoin_satoshi.sql index e174852f8be..e50f7c9f04d 100644 --- a/models/transfers/bitcoin/transfers_bitcoin_satoshi.sql +++ b/models/transfers/bitcoin/transfers_bitcoin_satoshi.sql @@ -1,16 +1,17 @@ {{ config( - + schema = 'transfers_bitcoin', alias = 'satoshi', materialized='incremental', file_format = 'delta', incremental_strategy = 'merge', + incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.block_time')], unique_key = ['type', 'tx_id', 'index', 'wallet_address'], post_hook='{{ expose_spells(\'["bitcoin"]\', "sector", "transfers", \'["longnhbkhn", "hosuke"]\') }}') }} -with +with input_transfers as ( select 'input' as type, @@ -22,13 +23,13 @@ with block_height, -1 * value as amount_raw from - {{ source('bitcoin', 'inputs') }} + {{ source('bitcoin', 'inputs') }} where address is not null {% if is_incremental() %} - and block_time >= date_trunc('day', now() - interval '7' day) + and {{ incremental_predicate('block_time') }} {% endif %} ) - , + , output_transfers as ( select 'output' as type, @@ -40,38 +41,38 @@ with block_height, value as amount_raw from - {{ source('bitcoin', 'outputs') }} + {{ source('bitcoin', 'outputs') }} where address is not null {% if is_incremental() %} - and block_time >= date_trunc('day', now() - interval '7' day) + and {{ incremental_predicate('block_time') }} {% endif %} ) , transfer_btc as ( - select any_value(type) as type, - tx_id, - index, - 'bitcoin' as blockchain, - any_value(wallet_address) as wallet_address, - any_value(block_time) as block_time, - any_value(block_date) as block_date, - any_value(block_height) as block_height, + select any_value(type) as type, + tx_id, + index, + 'bitcoin' as blockchain, + any_value(wallet_address) as wallet_address, + any_value(block_time) as block_time, + any_value(block_date) as block_date, + any_value(block_height) as block_height, any_value(amount_raw) as amount_raw from input_transfers - group by + group by tx_id , index union all - select any_value(type) as type, - tx_id, - index, - 'bitcoin' as blockchain, - any_value(wallet_address) as wallet_address, - any_value(block_time) as block_time, - any_value(block_date) as block_date, - any_value(block_height) as block_height, + select any_value(type) as type, + tx_id, + index, + 'bitcoin' as blockchain, + any_value(wallet_address) as wallet_address, + any_value(block_time) as block_time, + any_value(block_date) as block_date, + any_value(block_height) as block_height, any_value(amount_raw) as amount_raw - from output_transfers - group by + from output_transfers + group by tx_id , index ) @@ -81,7 +82,7 @@ with where symbol='BTC' and blockchain is null {% if is_incremental() %} - and minute >= date_trunc('day', now() - interval '7' day) + and {{ incremental_predicate('minute') }} {% endif %} ) diff --git a/models/transfers/bitcoin/transfers_bitcoin_satoshi_agg_day.sql b/models/transfers/bitcoin/transfers_bitcoin_satoshi_agg_day.sql index 277a1b2e805..562584dcd91 100644 --- a/models/transfers/bitcoin/transfers_bitcoin_satoshi_agg_day.sql +++ b/models/transfers/bitcoin/transfers_bitcoin_satoshi_agg_day.sql @@ -1,10 +1,11 @@ {{ config( schema = 'transfers_bitcoin', alias = 'satoshi_agg_day', - + materialized ='incremental', file_format ='delta', incremental_strategy='merge', + incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.day')], unique_key = ['day', 'wallet_address'] ) }} @@ -18,6 +19,6 @@ select from {{ ref('transfers_bitcoin_satoshi') }} tr {% if is_incremental() %} -- this filter will only be applied on an incremental run -where tr.block_date >= date_trunc('day', now() - interval '7' day) +where {{ incremental_predicate('tr.block_date ') }} {% endif %} group by 1, 2, 3 diff --git a/models/transfers/bnb/bep20/transfers_bnb_bep20.sql b/models/transfers/bnb/bep20/transfers_bnb_bep20.sql index 8921398de71..2caafa44c6e 100644 --- a/models/transfers/bnb/bep20/transfers_bnb_bep20.sql +++ b/models/transfers/bnb/bep20/transfers_bnb_bep20.sql @@ -1,10 +1,11 @@ {{ config( - + materialized = 'incremental', partition_by = ['block_month'], file_format = 'delta', incremental_strategy = 'merge', - unique_key = ['transfer_type', 'evt_tx_hash', 'evt_index', 'wallet_address'], + incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.evt_block_time')], + unique_key = ['transfer_type', 'evt_tx_hash', 'evt_index', 'wallet_address'], alias = 'erc20', post_hook='{{ expose_spells(\'["bnb"]\', "sector", @@ -12,95 +13,95 @@ \'["soispoke", "dot2dotseurat", "tschubotz", "Henrystats"]\') }}' ) }} -WITH +WITH erc20_transfers as ( - SELECT - 'receive' as transfer_type, + SELECT + 'receive' as transfer_type, evt_tx_hash, - evt_index, + evt_index, evt_block_time, - to as wallet_address, + to as wallet_address, contract_address as token_address, CAST(value as double) as amount_raw - FROM + FROM {{ source('erc20_bnb', 'evt_transfer') }} {% if is_incremental() %} - WHERE evt_block_time >= date_trunc('day', now() - interval '3' Day) + WHERE {{ incremental_predicate('evt_block_time') }} {% endif %} - UNION ALL + UNION ALL - SELECT - 'send' as transfer_type, + SELECT + 'send' as transfer_type, evt_tx_hash, - evt_index, + evt_index, evt_block_time, - "from" as wallet_address, + "from" as wallet_address, contract_address as token_address, -CAST(value as double) as amount_raw - FROM + FROM {{ source('erc20_bnb', 'evt_transfer') }} {% if is_incremental() %} - WHERE evt_block_time >= date_trunc('day', now() - interval '3' Day) + WHERE {{ incremental_predicate('evt_block_time') }} {% endif %} ), wbnb_events as ( - SELECT - 'deposit' as transfer_type, - evt_tx_hash, - evt_index, + SELECT + 'deposit' as transfer_type, + evt_tx_hash, + evt_index, evt_block_time, - dst as wallet_address, - contract_address as token_address, + dst as wallet_address, + contract_address as token_address, CAST(wad as double)as amount_raw - FROM + FROM {{ source('bnb_bnb', 'WBNB_evt_Deposit') }} {% if is_incremental() %} - WHERE evt_block_time >= date_trunc('day', now() - interval '3' Day) + WHERE {{ incremental_predicate('evt_block_time') }} {% endif %} - UNION ALL + UNION ALL - SELECT - 'withdraw' as transfer_type, - evt_tx_hash, - evt_index, + SELECT + 'withdraw' as transfer_type, + evt_tx_hash, + evt_index, evt_block_time, - src as wallet_address, - contract_address as token_address, + src as wallet_address, + contract_address as token_address, -CAST(wad as double)as amount_raw - FROM + FROM {{ source('bnb_bnb', 'WBNB_evt_Withdrawal') }} {% if is_incremental() %} - WHERE evt_block_time >= date_trunc('day', now() - interval '3' Day) + WHERE {{ incremental_predicate('evt_block_time') }} {% endif %} ) SELECT - 'bnb' as blockchain, + 'bnb' as blockchain, transfer_type, - evt_tx_hash, + evt_tx_hash, evt_index, evt_block_time, CAST(date_trunc('month', evt_block_time) as date) as block_month, - wallet_address, - token_address, + wallet_address, + token_address, amount_raw -FROM +FROM erc20_transfers -UNION ALL +UNION ALL -SELECT - 'bnb' as blockchain, +SELECT + 'bnb' as blockchain, transfer_type, - evt_tx_hash, + evt_tx_hash, evt_index, evt_block_time, CAST(date_trunc('month', evt_block_time) as date) as block_month, - wallet_address, - token_address, + wallet_address, + token_address, amount_raw -FROM +FROM wbnb_events diff --git a/models/transfers/bnb/bep20/transfers_bnb_bep20_agg_day.sql b/models/transfers/bnb/bep20/transfers_bnb_bep20_agg_day.sql index 387f8f73270..9dd7c1d891d 100644 --- a/models/transfers/bnb/bep20/transfers_bnb_bep20_agg_day.sql +++ b/models/transfers/bnb/bep20/transfers_bnb_bep20_agg_day.sql @@ -1,10 +1,11 @@ {{ config( - + alias = 'bep20_agg_day', partition_by = ['block_month'], materialized ='incremental', file_format ='delta', incremental_strategy='merge', + incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.day')], unique_key = ['day', 'wallet_address', 'token_address'] ) }} @@ -18,12 +19,12 @@ select t.symbol, sum(tr.amount_raw) as amount_raw, sum(tr.amount_raw / power(10, t.decimals)) as amount -FROM +FROM {{ ref('transfers_bnb_bep20') }} tr -LEFT JOIN +LEFT JOIN {{ source('tokens_bnb', 'bep20') }} t on t.contract_address = tr.token_address {% if is_incremental() %} -- this filter will only be applied on an incremental run -WHERE tr.evt_block_time >= date_trunc('day', now() - interval '3' Day) +WHERE {{ incremental_predicate('tr.evt_block_time') }} {% endif %} GROUP BY 1, 2, 3, 4, 5, 6 \ No newline at end of file diff --git a/models/transfers/bnb/bep20/transfers_bnb_bep20_agg_hour.sql b/models/transfers/bnb/bep20/transfers_bnb_bep20_agg_hour.sql index 3f860895ae7..b2f067a8e71 100644 --- a/models/transfers/bnb/bep20/transfers_bnb_bep20_agg_hour.sql +++ b/models/transfers/bnb/bep20/transfers_bnb_bep20_agg_hour.sql @@ -1,10 +1,11 @@ {{ config( - + alias = 'bep20_agg_hour', partition_by = ['block_month'], materialized ='incremental', file_format ='delta', incremental_strategy='merge', + incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.hour')], unique_key = ['hour', 'wallet_address', 'token_address'] ) }} @@ -18,12 +19,12 @@ select t.symbol, sum(tr.amount_raw) as amount_raw, sum(tr.amount_raw / power(10, t.decimals)) as amount -FROM +FROM {{ ref('transfers_bnb_bep20') }} tr -LEFT JOIN +LEFT JOIN {{ source('tokens_bnb', 'bep20') }} t on t.contract_address = tr.token_address {% if is_incremental() %} -- this filter will only be applied on an incremental run -WHERE tr.evt_block_time >= date_trunc('hour', now() - interval '3' Day) +WHERE {{ incremental_predicate('tr.evt_block_time') }} {% endif %} GROUP BY 1, 2, 3, 4, 5, 6 \ No newline at end of file diff --git a/models/transfers/bnb/bnb/transfers_bnb_bnb.sql b/models/transfers/bnb/bnb/transfers_bnb_bnb.sql index aaa482009d5..8406a09b907 100644 --- a/models/transfers/bnb/bnb/transfers_bnb_bnb.sql +++ b/models/transfers/bnb/bnb/transfers_bnb_bnb.sql @@ -1,103 +1,104 @@ {{ config( - + materialized = 'incremental', partition_by = ['block_month'], file_format = 'delta', incremental_strategy = 'merge', - unique_key = ['transfer_type', 'tx_hash', 'trace_address', 'wallet_address', 'block_time'], + incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.block_time')], + unique_key = ['transfer_type', 'tx_hash', 'trace_address', 'wallet_address', 'block_time'], alias = 'bnb', post_hook='{{ expose_spells(\'["bnb"]\', "sector", "transfers", \'["Henrystats"]\') }}') }} -WITH +WITH bnb_transfers as ( - SELECT - 'receive' as transfer_type, + SELECT + 'receive' as transfer_type, tx_hash, - trace_address, + trace_address, block_time, - to as wallet_address, + to as wallet_address, 0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c as token_address, CAST(value as double) as amount_raw - FROM + FROM {{ source('bnb', 'traces') }} WHERE (call_type NOT IN ('delegatecall', 'callcode', 'staticcall') OR call_type IS NULL) AND success AND CAST(value as double) > 0 - AND to IS NOT NULL + AND to IS NOT NULL AND to != 0x0000000000000000000000000000000000000000 {% if is_incremental() %} - AND block_time >= date_trunc('day', now() - interval '3' Day) + AND {{ incremental_predicate('block_time') }} {% endif %} - UNION ALL + UNION ALL - SELECT - 'send' as transfer_type, + SELECT + 'send' as transfer_type, tx_hash, - trace_address, + trace_address, block_time, - "from" as wallet_address, + "from" as wallet_address, 0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c as token_address, -CAST(value as double) as amount_raw - FROM + FROM {{ source('bnb', 'traces') }} WHERE (call_type NOT IN ('delegatecall', 'callcode', 'staticcall') OR call_type IS NULL) AND success AND CAST(value as double) > 0 - AND "from" IS NOT NULL + AND "from" IS NOT NULL AND "from" != 0x0000000000000000000000000000000000000000 -- this is causing duplicates in the test because for some weird reason there are transactions showing in bnb.transactions of this address that doesn't have a tx_hash {% if is_incremental() %} - AND block_time >= date_trunc('day', now() - interval '3' Day) + AND {{ incremental_predicate('block_time') }} {% endif %} ), gas_fee as ( - SELECT + SELECT 'gas_fee' as transfer_type, - hash as tx_hash, - array[index] as trace_address, - block_time, - "from" as wallet_address, - 0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c as token_address, - -(CASE + hash as tx_hash, + array[index] as trace_address, + block_time, + "from" as wallet_address, + 0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c as token_address, + -(CASE WHEN CAST(gas_price as double) = 0 THEN 0 ELSE (CAST(gas_used as DOUBLE) * CAST(gas_price as DOUBLE)) END) as amount_raw - FROM + FROM {{ source('bnb', 'transactions') }} {% if is_incremental() %} - WHERE block_time >= date_trunc('day', now() - interval '3' Day) + WHERE {{ incremental_predicate('block_time') }} {% endif %} ) SELECT - 'bnb' as blockchain, + 'bnb' as blockchain, transfer_type, - tx_hash, + tx_hash, trace_address, block_time, CAST(date_trunc('month', block_time) as date) as block_month, - wallet_address, - token_address, + wallet_address, + token_address, amount_raw -FROM +FROM bnb_transfers -UNION ALL +UNION ALL -SELECT - 'bnb' as blockchain, +SELECT + 'bnb' as blockchain, transfer_type, - tx_hash, + tx_hash, trace_address, block_time, CAST(date_trunc('month', block_time) as date) as block_month, - wallet_address, - token_address, + wallet_address, + token_address, amount_raw -FROM +FROM gas_fee diff --git a/models/transfers/bnb/bnb/transfers_bnb_bnb_agg_day.sql b/models/transfers/bnb/bnb/transfers_bnb_bnb_agg_day.sql index 6cf61e7754e..e6230256d7f 100644 --- a/models/transfers/bnb/bnb/transfers_bnb_bnb_agg_day.sql +++ b/models/transfers/bnb/bnb/transfers_bnb_bnb_agg_day.sql @@ -1,10 +1,11 @@ {{ config( - + alias = 'bnb_agg_day', partition_by = ['block_month'], materialized ='incremental', file_format ='delta', incremental_strategy='merge', + incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.day')], unique_key = ['day', 'wallet_address', 'token_address'] ) }} @@ -18,10 +19,10 @@ select 'BNB' as symbol, sum(tr.amount_raw) as amount_raw, sum(tr.amount_raw / power(10, 18)) as amount -FROM +FROM {{ ref('transfers_bnb_bnb') }} tr {% if is_incremental() %} -- this filter will only be applied on an incremental run -WHERE tr.block_time >= date_trunc('day', now() - interval '3' Day) +WHERE {{ incremental_predicate('tr.block_time') }} {% endif %} GROUP BY 1, 2, 3, 4, 5, 6 \ No newline at end of file diff --git a/models/transfers/bnb/bnb/transfers_bnb_bnb_agg_hour.sql b/models/transfers/bnb/bnb/transfers_bnb_bnb_agg_hour.sql index d3ba23b4505..7b993c6073f 100644 --- a/models/transfers/bnb/bnb/transfers_bnb_bnb_agg_hour.sql +++ b/models/transfers/bnb/bnb/transfers_bnb_bnb_agg_hour.sql @@ -1,10 +1,11 @@ {{ config( - + alias = 'bnb_agg_hour', partition_by = ['block_month'], materialized ='incremental', file_format ='delta', incremental_strategy='merge', + incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.hour')], unique_key = ['hour', 'wallet_address', 'token_address'] ) }} @@ -18,10 +19,10 @@ select 'BNB' as symbol, sum(tr.amount_raw) as amount_raw, sum(tr.amount_raw / power(10, 18)) as amount -FROM +FROM {{ ref('transfers_bnb_bnb') }} tr {% if is_incremental() %} -- this filter will only be applied on an incremental run -WHERE tr.block_time >= date_trunc('hour', now() - interval '3' Day) +WHERE {{ incremental_predicate('tr.block_time') }} {% endif %} GROUP BY 1, 2, 3, 4, 5, 6 \ No newline at end of file diff --git a/models/transfers/celo/erc1155/transfers_celo_erc1155.sql b/models/transfers/celo/erc1155/transfers_celo_erc1155.sql index 2247d6c37ad..6130e6e6add 100644 --- a/models/transfers/celo/erc1155/transfers_celo_erc1155.sql +++ b/models/transfers/celo/erc1155/transfers_celo_erc1155.sql @@ -1,11 +1,12 @@ -{{ +{{ config( - + alias = 'erc1155', partition_by = ['block_month'], materialized = 'incremental', file_format = 'delta', incremental_strategy = 'merge', + incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.block_time')], unique_key = ['tx_hash', 'transfer_type', 'wallet_address', 'token_address', 'token_id', 'amount'], post_hook='{{ expose_spells(\'["celo"]\', "sector", @@ -37,7 +38,7 @@ sent_transfers as ( from {{ source('erc1155_celo', 'evt_transfersingle') }} where 1=1 {% if is_incremental() %} -- this filter will only be applied on an incremental run - and evt_block_time >= date_trunc('day', now() - interval '7' day) + and {{ incremental_predicate('evt_block_time') }} {% endif %} union all select @@ -52,7 +53,7 @@ sent_transfers as ( from transfer_batch where 1=1 {% if is_incremental() %} -- this filter will only be applied on an incremental run - and evt_block_time >= date_trunc('day', now() - interval '7' day) + and {{ incremental_predicate('evt_block_time') }} {% endif %} ), @@ -69,7 +70,7 @@ received_transfers as ( from {{ source('erc1155_celo', 'evt_transfersingle') }} where 1=1 {% if is_incremental() %} -- this filter will only be applied on an incremental run - and evt_block_time >= date_trunc('day', now() - interval '7' day) + and {{ incremental_predicate('evt_block_time') }} {% endif %} union all select @@ -84,7 +85,7 @@ received_transfers as ( from transfer_batch where 1=1 {% if is_incremental() %} -- this filter will only be applied on an incremental run - and evt_block_time >= date_trunc('day', now() - interval '7' day) + and {{ incremental_predicate('evt_block_time') }} {% endif %} ) diff --git a/models/transfers/celo/erc1155/transfers_celo_erc1155_agg_day.sql b/models/transfers/celo/erc1155/transfers_celo_erc1155_agg_day.sql index 83b0dc0ee18..575f22cc07d 100644 --- a/models/transfers/celo/erc1155/transfers_celo_erc1155_agg_day.sql +++ b/models/transfers/celo/erc1155/transfers_celo_erc1155_agg_day.sql @@ -1,11 +1,12 @@ -{{ +{{ config( - + alias = 'erc1155_agg_day', partition_by = ['block_month'], materialized = 'incremental', file_format = 'delta', incremental_strategy = 'merge', + incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.block_day')], unique_key = ['wallet_address', 'token_address', 'block_day', 'token_id'], post_hook='{{ expose_spells(\'["celo"]\', "sector", @@ -25,6 +26,6 @@ select from {{ ref('transfers_celo_erc1155') }} tr {% if is_incremental() %} -- this filter will only be applied on an incremental run -where tr.block_time >= date_trunc('day', now() - interval '7' day) +where t{{ incremental_predicate('r.block_time') }} {% endif %} group by 1, 2, 3, 4, 5, 6 diff --git a/models/transfers/celo/erc1155/transfers_celo_erc1155_agg_hour.sql b/models/transfers/celo/erc1155/transfers_celo_erc1155_agg_hour.sql index 82ecd34afe4..e400b55eb3a 100644 --- a/models/transfers/celo/erc1155/transfers_celo_erc1155_agg_hour.sql +++ b/models/transfers/celo/erc1155/transfers_celo_erc1155_agg_hour.sql @@ -1,11 +1,12 @@ -{{ +{{ config( - + alias = 'erc1155_agg_hour', partition_by = ['block_month'], materialized = 'incremental', file_format = 'delta', incremental_strategy = 'merge', + incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.block_hour')], unique_key = ['wallet_address', 'token_address', 'block_hour', 'token_id'], post_hook='{{ expose_spells(\'["celo"]\', "sector", @@ -25,6 +26,6 @@ select from {{ ref('transfers_celo_erc1155') }} tr {% if is_incremental() %} -- this filter will only be applied on an incremental run -where tr.block_time >= date_trunc('day', now() - interval '7' day) +where t{{ incremental_predicate('r.block_time') }} {% endif %} group by 1, 2, 3, 4, 5, 6 diff --git a/models/transfers/celo/erc20/transfers_celo_erc20.sql b/models/transfers/celo/erc20/transfers_celo_erc20.sql index d2836e1f579..eb3f092dc1b 100644 --- a/models/transfers/celo/erc20/transfers_celo_erc20.sql +++ b/models/transfers/celo/erc20/transfers_celo_erc20.sql @@ -1,11 +1,11 @@ -{{ +{{ config( - + alias = 'erc20', partition_by = ['block_month'], materialized = 'incremental', file_format = 'delta', - incremental_strategy = 'merge', + incremental_strategy = 'merge',incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.block_time')], unique_key = ['tx_hash', 'transfer_type', 'evt_index', 'wallet_address'], post_hook='{{ expose_spells(\'["celo"]\', "sector", @@ -29,10 +29,10 @@ with {{ source('erc20_celo', 'evt_transfer') }} where 1=1 {% if is_incremental() %} -- this filter will only be applied on an incremental run - and evt_block_time >= date_trunc('day', now() - interval '7' day) + and {{ incremental_predicate('evt_block_time') }} {% endif %} ), - + received_transfers as ( select 'received' as transfer_type, @@ -47,11 +47,11 @@ with {{ source('erc20_celo', 'evt_transfer') }} where 1=1 {% if is_incremental() %} -- this filter will only be applied on an incremental run - and evt_block_time >= date_trunc('day', now() - interval '7' day) + and {{ incremental_predicate('evt_block_time') }} {% endif %} ) - + /*, -- Wrapped Celo looks to work differently than WETH - commenting this section out for now deposited_wcelo as ( @@ -69,7 +69,7 @@ with and topic0 = 0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef --deposit and bytearray_substring(topic1,13,20) <> 0x0000000000000000000000000000000000000000 {% if is_incremental() %} -- this filter will only be applied on an incremental run - and block_time >= date_trunc('day', now() - interval '7' day) + and {{ incremental_predicate('block_time') }} {% endif %} ), @@ -88,11 +88,11 @@ with and topic0 = 0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef --withdrawal and bytearray_substring(topic1,13,20) = 0x0000000000000000000000000000000000000000 {% if is_incremental() %} -- this filter will only be applied on an incremental run - and block_time >= date_trunc('day', now() - interval '7' day) + and {{ incremental_predicate('block_time') }} {% endif %} ) */ - + select 'celo' as blockchain, transfer_type, wallet_address, token_address, block_time, block_month, amount_raw, evt_index, tx_hash from sent_transfers union diff --git a/models/transfers/celo/erc20/transfers_celo_erc20_agg_day.sql b/models/transfers/celo/erc20/transfers_celo_erc20_agg_day.sql index 44ba0912566..22a114a417f 100644 --- a/models/transfers/celo/erc20/transfers_celo_erc20_agg_day.sql +++ b/models/transfers/celo/erc20/transfers_celo_erc20_agg_day.sql @@ -1,11 +1,12 @@ -{{ +{{ config( - + alias = 'erc20_agg_day', partition_by = ['block_month'], materialized = 'incremental', file_format = 'delta', incremental_strategy = 'merge', + incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.block_day')], unique_key = ['wallet_address', 'token_address', 'block_day'], post_hook='{{ expose_spells(\'["celo"]\', "sector", @@ -27,6 +28,6 @@ from {{ ref('transfers_celo_erc20') }} tr left join {{ source('tokens_celo', 'erc20') }} t on t.contract_address = tr.token_address {% if is_incremental() %} -- this filter will only be applied on an incremental run -where tr.block_time >= date_trunc('day', now() - interval '7' day) +where t{{ incremental_predicate('r.block_time') }} {% endif %} group by 1, 2, 3, 4, 5, 6 diff --git a/models/transfers/celo/erc20/transfers_celo_erc20_agg_hour.sql b/models/transfers/celo/erc20/transfers_celo_erc20_agg_hour.sql index 115e6cea85e..66d71999af6 100644 --- a/models/transfers/celo/erc20/transfers_celo_erc20_agg_hour.sql +++ b/models/transfers/celo/erc20/transfers_celo_erc20_agg_hour.sql @@ -1,11 +1,12 @@ -{{ +{{ config( - + alias = 'erc20_agg_hour', partition_by = ['block_month'], materialized = 'incremental', file_format = 'delta', incremental_strategy = 'merge', + incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.block_hour')], unique_key = ['wallet_address', 'token_address', 'block_hour'], post_hook='{{ expose_spells(\'["celo"]\', "sector", @@ -27,6 +28,6 @@ from {{ ref('transfers_celo_erc20') }} tr left join {{ source('tokens_celo', 'erc20') }} t on t.contract_address = tr.token_address {% if is_incremental() %} -- this filter will only be applied on an incremental run -where tr.block_time >= date_trunc('day', now() - interval '7' day) +where t{{ incremental_predicate('r.block_time') }} {% endif %} group by 1, 2, 3, 4, 5, 6 diff --git a/models/transfers/celo/erc20/transfers_celo_erc20_rolling_day.sql b/models/transfers/celo/erc20/transfers_celo_erc20_rolling_day.sql index fa092d432b7..6c155e0fa0a 100644 --- a/models/transfers/celo/erc20/transfers_celo_erc20_rolling_day.sql +++ b/models/transfers/celo/erc20/transfers_celo_erc20_rolling_day.sql @@ -1,11 +1,12 @@ -{{ +{{ config( - + alias = 'erc20_rolling_day', partition_by = ['block_month'], materialized = 'incremental', file_format = 'delta', incremental_strategy = 'merge', + incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.block_day')], unique_key = ['wallet_address', 'token_address', 'block_day'], post_hook='{{ expose_spells(\'["celo"]\', "sector", diff --git a/models/transfers/celo/erc20/transfers_celo_erc20_rolling_hour.sql b/models/transfers/celo/erc20/transfers_celo_erc20_rolling_hour.sql index c716e959a38..88ff7c0c44c 100644 --- a/models/transfers/celo/erc20/transfers_celo_erc20_rolling_hour.sql +++ b/models/transfers/celo/erc20/transfers_celo_erc20_rolling_hour.sql @@ -1,11 +1,11 @@ -{{ +{{ config( - + alias = 'erc20_rolling_hour', partition_by = ['block_month'], materialized = 'incremental', file_format = 'delta', - incremental_strategy = 'merge', + incremental_strategy = 'merge',incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.block_hour')], unique_key = ['wallet_address', 'token_address', 'block_hour'], post_hook='{{ expose_spells(\'["celo"]\', "sector", diff --git a/models/transfers/celo/erc721/transfers_celo_erc721.sql b/models/transfers/celo/erc721/transfers_celo_erc721.sql index ad8e1ede0b9..2eff96ee8e4 100644 --- a/models/transfers/celo/erc721/transfers_celo_erc721.sql +++ b/models/transfers/celo/erc721/transfers_celo_erc721.sql @@ -1,11 +1,12 @@ -{{ +{{ config( - + alias = 'erc721', partition_by = ['block_month'], materialized = 'incremental', file_format = 'delta', incremental_strategy = 'merge', + incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.block_time')], unique_key = ['tx_hash', 'transfer_type', 'wallet_address', 'token_address', 'token_id'], post_hook='{{ expose_spells(\'["celo"]\', "sector", @@ -29,7 +30,7 @@ sent_transfers as ( from {{ source('erc721_celo', 'evt_transfer') }} where 1=1 {% if is_incremental() %} -- this filter will only be applied on an incremental run - and evt_block_time >= date_trunc('day', now() - interval '7' day) + and {{ incremental_predicate('evt_block_time') }} {% endif %} ), @@ -46,7 +47,7 @@ received_transfers as ( from {{ source('erc721_celo', 'evt_transfer') }} where 1=1 {% if is_incremental() %} -- this filter will only be applied on an incremental run - and evt_block_time >= date_trunc('day', now() - interval '7' day) + and {{ incremental_predicate('evt_block_time') }} {% endif %} ) diff --git a/models/transfers/celo/erc721/transfers_celo_erc721_agg_day.sql b/models/transfers/celo/erc721/transfers_celo_erc721_agg_day.sql index 76032aa249e..2b050159e4c 100644 --- a/models/transfers/celo/erc721/transfers_celo_erc721_agg_day.sql +++ b/models/transfers/celo/erc721/transfers_celo_erc721_agg_day.sql @@ -1,11 +1,12 @@ -{{ +{{ config( - + alias = 'erc721_agg_day', partition_by = ['block_month'], materialized = 'incremental', file_format = 'delta', incremental_strategy = 'merge', + incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.block_day')], unique_key = ['wallet_address', 'token_address', 'block_day', 'token_id'], post_hook='{{ expose_spells(\'["celo"]\', "sector", @@ -25,6 +26,6 @@ select from {{ ref('transfers_celo_erc721') }} tr {% if is_incremental() %} -- this filter will only be applied on an incremental run -where tr.block_time >= date_trunc('day', now() - interval '7' day) +where t{{ incremental_predicate('r.block_time') }} {% endif %} group by 1, 2, 3, 4, 5, 6 diff --git a/models/transfers/celo/erc721/transfers_celo_erc721_agg_hour.sql b/models/transfers/celo/erc721/transfers_celo_erc721_agg_hour.sql index af48081d25d..c623c320093 100644 --- a/models/transfers/celo/erc721/transfers_celo_erc721_agg_hour.sql +++ b/models/transfers/celo/erc721/transfers_celo_erc721_agg_hour.sql @@ -1,11 +1,12 @@ -{{ +{{ config( - + alias = 'erc721_agg_hour', partition_by = ['block_month'], materialized = 'incremental', file_format = 'delta', incremental_strategy = 'merge', + incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.block_hour')], unique_key = ['wallet_address', 'token_address', 'block_hour', 'token_id'], post_hook='{{ expose_spells(\'["celo"]\', "sector", @@ -25,6 +26,6 @@ select from {{ ref('transfers_celo_erc721') }} tr {% if is_incremental() %} -- this filter will only be applied on an incremental run -where tr.block_time >= date_trunc('day', now() - interval '7' day) +where t{{ incremental_predicate('r.block_time') }} {% endif %} group by 1, 2, 3, 4, 5, 6 diff --git a/models/transfers/celo/transfers_celo_celo.sql b/models/transfers/celo/transfers_celo_celo.sql index 3da630dd3cc..d8817179c54 100644 --- a/models/transfers/celo/transfers_celo_celo.sql +++ b/models/transfers/celo/transfers_celo_celo.sql @@ -1,11 +1,12 @@ {{ config( - + alias = 'celo', partition_by = ['block_month'], materialized = 'incremental', file_format = 'delta', incremental_strategy = 'merge', + incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.tx_block_time')], unique_key = ['tx_hash', 'trace_address'], post_hook='{{ expose_spells(\'["celo"]\', "sector", @@ -40,8 +41,8 @@ with celo_transfers as ( and r.success and r.value > uint256 '0' {% if is_incremental() %} -- this filter will only be applied on an incremental run - and r.block_time >= date_trunc('day', now() - interval '7' day) - and t.block_time >= date_trunc('day', now() - interval '7' day) + and {{ incremental_predicate('r.block_time') }} + and {{ incremental_predicate('t.block_time') }} {% endif %} union all @@ -71,8 +72,8 @@ with celo_transfers as ( and t.success and r.value > uint256 '0' {% if is_incremental() %} -- this filter will only be applied on an incremental run - and r.evt_block_time >= date_trunc('day', now() - interval '7' day) - and t.block_time >= date_trunc('day', now() - interval '7' day) + and {{ incremental_predicate('r.evt_block_time') }} + and {{ incremental_predicate('t.block_time') }} {% endif %} ) select * diff --git a/models/transfers/ethereum/transfers_ethereum_eth.sql b/models/transfers/ethereum/transfers_ethereum_eth.sql index f9da5171501..a364db16bf6 100644 --- a/models/transfers/ethereum/transfers_ethereum_eth.sql +++ b/models/transfers/ethereum/transfers_ethereum_eth.sql @@ -1,10 +1,11 @@ -{{ +{{ config( - alias = 'eth', - + alias = 'eth', + materialized ='incremental', file_format ='delta', incremental_strategy='merge', + incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.tx_block_time')], unique_key=['tx_hash', 'trace_address'], post_hook='{{ expose_spells(\'["ethereum"]\', "sector", @@ -13,7 +14,7 @@ ) }} -select +select r."from" ,r.to --Using the ETH placeholder address to match with prices tables @@ -22,19 +23,19 @@ select ,cast(r.value as double)/1e18 as value_decimal ,r.tx_hash ,r.trace_address - ,r.block_time as tx_block_time - ,r.block_number as tx_block_number + ,r.block_time as tx_block_time + ,r.block_number as tx_block_number ,bytearray_substring(t.data, 1, 4) as tx_method_id ,t.to AS tx_to ,t."from" AS tx_from -from {{ source('ethereum', 'traces') }} as r -join {{ source('ethereum', 'transactions') }} as t +from {{ source('ethereum', 'traces') }} as r +join {{ source('ethereum', 'transactions') }} as t on r.tx_hash = t.hash and r.block_number = t.block_number {% if is_incremental() %} -- this filter will only be applied on an incremental run and {{incremental_predicate('t.block_time')}} {% endif %} -where +where (r.call_type not in ('delegatecall', 'callcode', 'staticcall') or r.call_type is null) and r.tx_success = true and r.success = true diff --git a/models/transfers/fantom/erc20/transfers_fantom_erc20.sql b/models/transfers/fantom/erc20/transfers_fantom_erc20.sql deleted file mode 100644 index 7cf2e78af04..00000000000 --- a/models/transfers/fantom/erc20/transfers_fantom_erc20.sql +++ /dev/null @@ -1,76 +0,0 @@ -{{ config( -tags=['prod_exclude'], - alias = 'erc20', - materialized = 'incremental', - file_format = 'delta', - incremental_strategy = 'merge', - unique_key = ['transfer_type', 'evt_tx_hash', 'evt_index', 'wallet_address'], - post_hook='{{ expose_spells(\'["fantom"]\', - "sector", - "transfers", - \'["soispoke", "dot2dotseurat", "tschubotz", "hosuke"]\') }}' - ) -}} - -/* - note: this spell has not been migrated to dunesql, therefore is only a view on spark - please migrate to dunesql to ensure up-to-date logic & data -*/ - -with - sent_transfers as ( - select - 'send'as transfer_type, - evt_tx_hash, - evt_index, - et.to as wallet_address, - contract_address as token_address, - evt_block_time, - value as amount_raw - from - {{ source('erc20_fantom', 'evt_transfer') }} et - {% if is_incremental() %} - where evt_block_time >= date_trunc("day", now() - interval '1 week') - {% endif %} - ), - received_transfers as ( - select - 'receive'as transfer_type, - evt_tx_hash, - evt_index, - et.from as wallet_address, - contract_address as token_address, - evt_block_time, - '-' || CAST(value AS VARCHAR(100)) as amount_raw - from - {{ source('erc20_fantom', 'evt_transfer') }} et - {% if is_incremental() %} - where evt_block_time >= date_trunc("day", now() - interval '1 week') - {% endif %} - ) - --- There is no need to add wrapped FTM deposits / withdrawals since wrapped FTM on fantom triggers transfer events for both. - -select - transfer_type, - 'fantom' as blockchain, - evt_tx_hash, - evt_index, - wallet_address, - token_address, - evt_block_time, - CAST(amount_raw AS VARCHAR(100)) as amount_raw -from sent_transfers - -union - -select - transfer_type, - 'fantom' as blockchain, - evt_tx_hash, - evt_index, - wallet_address, - token_address, - evt_block_time, - CAST(amount_raw AS VARCHAR(100)) as amount_raw -from received_transfers diff --git a/models/transfers/fantom/erc20/transfers_fantom_schema.yml b/models/transfers/fantom/erc20/transfers_fantom_schema.yml deleted file mode 100644 index d0bfea93ae9..00000000000 --- a/models/transfers/fantom/erc20/transfers_fantom_schema.yml +++ /dev/null @@ -1,37 +0,0 @@ -version: 2 - -models: - - name: transfers_fantom_erc20 - meta: - blockchain: fantom - sector: transfers - project: erc20 - contributors: soispoke, dot2dotseurat, tschubotz, hosuke - config: - tags: ['transfers', 'fantom', 'erc20'] - description: "ERC20 Token Transfers on fantom. This table is updated every 30 minutes." - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - transfer_type - - evt_tx_hash - - evt_index - - wallet_address - columns: - - name: unique_transfer_id - description: "Unique transfer ID (used for testing for duplicates)" - - &blockchain - name: blockchain - description: "Blockchain" - - &wallet_address - name: wallet_address - description: "Wallet address of sender or receiver. If amount is negative, wallet address is the sender's." - - &token_address - name: token_address - description: "Contract address for token" - - &evt_block_time - name: evt_block_time - description: "Timestamp for block event time in UTC" - - &amount_raw - name: amount_raw - description: "Raw amount of ERC20 token held *before* taking into account token decimals" diff --git a/models/transfers/optimism/transfers_optimism_eth.sql b/models/transfers/optimism/transfers_optimism_eth.sql index 2f00544a8d7..18af49bb26c 100644 --- a/models/transfers/optimism/transfers_optimism_eth.sql +++ b/models/transfers/optimism/transfers_optimism_eth.sql @@ -1,10 +1,11 @@ {{ config( alias ='eth', - + materialized ='incremental', file_format ='delta', incremental_strategy='merge', + incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.tx_block_time')], unique_key='unique_transfer_id', post_hook='{{ expose_spells(\'["optimism"]\', "sector", @@ -38,8 +39,8 @@ with eth_transfers as ( and r.success and r.value > uint256 '0' {% if is_incremental() %} -- this filter will only be applied on an incremental run - and r.block_time >= date_trunc('day', now() - interval '7' day) - and t.block_time >= date_trunc('day', now() - interval '7' day) + and {{ incremental_predicate('r.block_time') }} + and {{ incremental_predicate('t.block_time') }} {% endif %} union all @@ -69,8 +70,8 @@ with eth_transfers as ( and t.success and r.value > uint256 '0' {% if is_incremental() %} -- this filter will only be applied on an incremental run - and r.evt_block_time >= date_trunc('day', now() - interval '7' day) - and t.block_time >= date_trunc('day', now() - interval '7' day) + and {{ incremental_predicate('r.evt_block_time') }} + and {{ incremental_predicate('t.block_time') }} {% endif %} ) select * diff --git a/models/transfers/polygon/erc20/transfers_polygon_erc20.sql b/models/transfers/polygon/erc20/transfers_polygon_erc20.sql index 3b5a549c296..b574cb43315 100644 --- a/models/transfers/polygon/erc20/transfers_polygon_erc20.sql +++ b/models/transfers/polygon/erc20/transfers_polygon_erc20.sql @@ -1,10 +1,11 @@ {{ config( - + materialized = 'incremental', partition_by = ['block_month'], file_format = 'delta', incremental_strategy = 'merge', - unique_key = ['transfer_type', 'evt_tx_hash', 'evt_index', 'wallet_address'], + incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.evt_block_time')], + unique_key = ['transfer_type', 'evt_tx_hash', 'evt_index', 'wallet_address'], alias = 'erc20', post_hook='{{ expose_spells(\'["polygon"]\', "sector", diff --git a/models/transfers/polygon/erc20/transfers_polygon_erc20_agg_day.sql b/models/transfers/polygon/erc20/transfers_polygon_erc20_agg_day.sql index a0682edd544..e30315898d0 100644 --- a/models/transfers/polygon/erc20/transfers_polygon_erc20_agg_day.sql +++ b/models/transfers/polygon/erc20/transfers_polygon_erc20_agg_day.sql @@ -1,10 +1,11 @@ {{ config( - + alias = 'erc20_agg_day', partition_by = ['block_month'], materialized ='incremental', file_format ='delta', incremental_strategy='merge', + incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.block_day')], unique_key = ['block_day', 'wallet_address', 'token_address'] ) }} diff --git a/models/transfers/polygon/erc20/transfers_polygon_erc20_agg_hour.sql b/models/transfers/polygon/erc20/transfers_polygon_erc20_agg_hour.sql index c563c45d4eb..b2cae84b8cd 100644 --- a/models/transfers/polygon/erc20/transfers_polygon_erc20_agg_hour.sql +++ b/models/transfers/polygon/erc20/transfers_polygon_erc20_agg_hour.sql @@ -1,10 +1,11 @@ {{ config( - + alias = 'erc20_agg_hour', partition_by = ['block_month'], materialized ='incremental', file_format ='delta', incremental_strategy='merge', + incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.block_hour')], unique_key = ['block_hour', 'wallet_address', 'token_address'] ) }} diff --git a/models/transfers/polygon/matic/transfers_polygon_matic.sql b/models/transfers/polygon/matic/transfers_polygon_matic.sql index 160215cbfd5..7fa06a2d5cb 100644 --- a/models/transfers/polygon/matic/transfers_polygon_matic.sql +++ b/models/transfers/polygon/matic/transfers_polygon_matic.sql @@ -1,101 +1,102 @@ {{ config( - + materialized = 'incremental', partition_by = ['block_month'], file_format = 'delta', incremental_strategy = 'merge', - unique_key = ['transfer_type', 'tx_hash', 'trace_address', 'wallet_address', 'block_time'], + incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.block_time')], + unique_key = ['transfer_type', 'tx_hash', 'trace_address', 'wallet_address', 'block_time'], alias = 'matic', post_hook='{{ expose_spells(\'["polygon"]\', "sector", "transfers", \'["Henrystats"]\') }}') }} -WITH +WITH matic_transfers as ( - SELECT - 'receive' as transfer_type, + SELECT + 'receive' as transfer_type, tx_hash, - trace_address, + trace_address, block_time, - to as wallet_address, + to as wallet_address, 0x0d500B1d8E8eF31E21C99d1Db9A6444d3ADf1270 as token_address, CAST(value as double) as amount_raw - FROM + FROM {{ source('polygon', 'traces') }} WHERE (call_type NOT IN ('delegatecall', 'callcode', 'staticcall') OR call_type IS NULL) AND success AND CAST(value as double) > 0 - AND to IS NOT NULL + AND to IS NOT NULL {% if is_incremental() %} - AND block_time >= date_trunc('day', now() - interval '3' Day) + and {{ incremental_predicate('block_time') }} {% endif %} - UNION ALL + UNION ALL - SELECT - 'send' as transfer_type, + SELECT + 'send' as transfer_type, tx_hash, - trace_address, + trace_address, block_time, - "from" as wallet_address, + "from" as wallet_address, 0x0d500B1d8E8eF31E21C99d1Db9A6444d3ADf1270 as token_address, -CAST(value as double) as amount_raw - FROM + FROM {{ source('polygon', 'traces') }} WHERE (call_type NOT IN ('delegatecall', 'callcode', 'staticcall') OR call_type IS NULL) AND success AND CAST(value as double) > 0 - AND "from" IS NOT NULL + AND "from" IS NOT NULL {% if is_incremental() %} - AND block_time >= date_trunc('day', now() - interval '3' Day) + and {{ incremental_predicate('block_time') }} {% endif %} ), gas_fee as ( - SELECT + SELECT 'gas_fee' as transfer_type, - hash as tx_hash, - array[index] as trace_address, - block_time, - "from" as wallet_address, - 0x0d500B1d8E8eF31E21C99d1Db9A6444d3ADf1270 as token_address, - -(CASE + hash as tx_hash, + array[index] as trace_address, + block_time, + "from" as wallet_address, + 0x0d500B1d8E8eF31E21C99d1Db9A6444d3ADf1270 as token_address, + -(CASE WHEN CAST(gas_price as double) = 0 THEN 0 ELSE (CAST(gas_used as DOUBLE) * CAST(gas_price as DOUBLE)) END) as amount_raw - FROM + FROM {{ source('polygon', 'transactions') }} {% if is_incremental() %} - WHERE block_time >= date_trunc('day', now() - interval '3' Day) + WHERE {{ incremental_predicate('block_time') }} {% endif %} ) SELECT - 'polygon' as blockchain, + 'polygon' as blockchain, transfer_type, - tx_hash, + tx_hash, trace_address, block_time, CAST(date_trunc('month', block_time) as date) as block_month, - wallet_address, - token_address, + wallet_address, + token_address, amount_raw -FROM +FROM matic_transfers -UNION ALL +UNION ALL -SELECT - 'polygon' as blockchain, +SELECT + 'polygon' as blockchain, transfer_type, - tx_hash, + tx_hash, trace_address, block_time, CAST(date_trunc('month', block_time) as date) as block_month, - wallet_address, - token_address, + wallet_address, + token_address, amount_raw -FROM +FROM gas_fee diff --git a/models/transfers/polygon/matic/transfers_polygon_matic_agg_day.sql b/models/transfers/polygon/matic/transfers_polygon_matic_agg_day.sql index 796ea4111bb..64c2dc6f1ce 100644 --- a/models/transfers/polygon/matic/transfers_polygon_matic_agg_day.sql +++ b/models/transfers/polygon/matic/transfers_polygon_matic_agg_day.sql @@ -1,10 +1,11 @@ {{ config( - + alias = 'matic_agg_day', partition_by = ['block_month'], materialized ='incremental', file_format ='delta', incremental_strategy='merge', + incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.day')], unique_key = ['day', 'wallet_address', 'token_address'] ) }} @@ -18,10 +19,10 @@ select 'MATIC' as symbol, sum(tr.amount_raw) as amount_raw, sum(tr.amount_raw / power(10, 18)) as amount -FROM +FROM {{ ref('transfers_polygon_matic') }} tr {% if is_incremental() %} -- this filter will only be applied on an incremental run -WHERE tr.block_time >= date_trunc('day', now() - interval '3' Day) +WHERE {{ incremental_predicate('tr.block_time') }} {% endif %} GROUP BY 1, 2, 3, 4, 5, 6 \ No newline at end of file diff --git a/models/transfers/polygon/matic/transfers_polygon_matic_agg_hour.sql b/models/transfers/polygon/matic/transfers_polygon_matic_agg_hour.sql index 0e96ebfa12f..c1bef60a800 100644 --- a/models/transfers/polygon/matic/transfers_polygon_matic_agg_hour.sql +++ b/models/transfers/polygon/matic/transfers_polygon_matic_agg_hour.sql @@ -1,10 +1,11 @@ {{ config( - + alias = 'matic_agg_hour', partition_by = ['block_month'], materialized ='incremental', file_format ='delta', incremental_strategy='merge', + incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.hour')], unique_key = ['hour', 'wallet_address', 'token_address'] ) }} @@ -18,10 +19,10 @@ select 'MATIC' as symbol, sum(tr.amount_raw) as amount_raw, sum(tr.amount_raw / power(10, 18)) as amount -FROM +FROM {{ ref('transfers_polygon_matic') }} tr {% if is_incremental() %} -- this filter will only be applied on an incremental run -WHERE tr.block_time >= date_trunc('hour', now() - interval '3' Day) +WHERE {{ incremental_predicate('tr.block_time') }} {% endif %} GROUP BY 1, 2, 3, 4, 5, 6 \ No newline at end of file diff --git a/tests/transfers/fantom/transfers_fantom_erc20_test.sql b/tests/transfers/fantom/transfers_fantom_erc20_test.sql deleted file mode 100644 index ce620e51703..00000000000 --- a/tests/transfers/fantom/transfers_fantom_erc20_test.sql +++ /dev/null @@ -1,16 +0,0 @@ --- Check that number of transfers in data range is correct - -with test_data as ( - select count(*) as total - from {{ ref('transfers_fantom_erc20') }} - where evt_block_time between '2023-01-01' and '2023-02-01' -), - -test_result as ( - select case when total = 69781172 then true else false end as success - from test_data -) - -select * -from test_result -where success = false From 36ba5ffae48610763ca091b34411bf4b86c00b6f Mon Sep 17 00:00:00 2001 From: Alan Ghobadi Date: Tue, 4 Jun 2024 13:18:27 +0200 Subject: [PATCH 031/149] Incremental predicates solana (#6061) * Add incremental predicate strategy to bot trades * Add to Orca * Incremental predicates for sharky * Incremental predicates for magiceden and opensea solana * Incremental predicates for orca prices --- .../banana_gun_solana_bot_trades.sql | 1 + .../platforms/bonkbot_solana_bot_trades.sql | 1 + .../consortium_key_solana_bot_trades.sql | 3 +- .../platforms/looter_solana_bot_trades.sql | 1 + .../platforms/maestro_solana_bot_trades.sql | 1 + .../platforms/magnum_solana_bot_trades.sql | 1 + .../pepe_boost_solana_bot_trades.sql | 1 + .../platforms/readyswap_solana_bot_trades.sql | 1 + .../platforms/shuriken_solana_bot_trades.sql | 1 + .../platforms/sol_gun_solana_bot_trades.sql | 1 + .../sol_trading_bot_solana_bot_trades.sql | 1 + .../soul_sniper_solana_bot_trades.sql | 3 +- .../platforms/trojan_solana_bot_trades.sql | 1 + .../platforms/wifbot_solana_bot_trades.sql | 3 +- .../solana/old/magiceden_solana_events.sql | 7 +- .../solana/old/opensea_solana_events.sql | 5 +- .../orca_whirlpool_token_prices.sql | 3 +- .../orca_whirlpool_token_prices_hour.sql | 3 +- .../orca_whirlpool/orca_whirlpool_trades.sql | 85 ++++++++++--------- models/sharky/solana/sharky_solana_events.sql | 41 ++++----- 20 files changed, 92 insertions(+), 72 deletions(-) diff --git a/models/_sector/dex/bot_trades/solana/platforms/banana_gun_solana_bot_trades.sql b/models/_sector/dex/bot_trades/solana/platforms/banana_gun_solana_bot_trades.sql index 06e66610691..0b8a7a24292 100644 --- a/models/_sector/dex/bot_trades/solana/platforms/banana_gun_solana_bot_trades.sql +++ b/models/_sector/dex/bot_trades/solana/platforms/banana_gun_solana_bot_trades.sql @@ -5,6 +5,7 @@ materialized = 'incremental', file_format = 'delta', incremental_strategy = 'merge', + incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.block_time')], unique_key = ['blockchain', 'tx_id', 'tx_index', 'outer_instruction_index', 'inner_instruction_index'] ) }} diff --git a/models/_sector/dex/bot_trades/solana/platforms/bonkbot_solana_bot_trades.sql b/models/_sector/dex/bot_trades/solana/platforms/bonkbot_solana_bot_trades.sql index 97e94659e95..8f947337b1e 100644 --- a/models/_sector/dex/bot_trades/solana/platforms/bonkbot_solana_bot_trades.sql +++ b/models/_sector/dex/bot_trades/solana/platforms/bonkbot_solana_bot_trades.sql @@ -5,6 +5,7 @@ materialized = 'incremental', file_format = 'delta', incremental_strategy = 'merge', + incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.block_time')], unique_key = ['blockchain', 'tx_id', 'tx_index', 'outer_instruction_index', 'inner_instruction_index'] ) }} diff --git a/models/_sector/dex/bot_trades/solana/platforms/consortium_key_solana_bot_trades.sql b/models/_sector/dex/bot_trades/solana/platforms/consortium_key_solana_bot_trades.sql index b354b2a0daa..20c91b56134 100644 --- a/models/_sector/dex/bot_trades/solana/platforms/consortium_key_solana_bot_trades.sql +++ b/models/_sector/dex/bot_trades/solana/platforms/consortium_key_solana_bot_trades.sql @@ -5,7 +5,8 @@ partition_by=["block_month"], materialized="incremental", file_format="delta", - incremental_strategy="merge", + incremental_strategy='merge', + incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.block_time')], unique_key=[ "blockchain", "tx_id", diff --git a/models/_sector/dex/bot_trades/solana/platforms/looter_solana_bot_trades.sql b/models/_sector/dex/bot_trades/solana/platforms/looter_solana_bot_trades.sql index 30092b5f925..a3cff7b0b94 100644 --- a/models/_sector/dex/bot_trades/solana/platforms/looter_solana_bot_trades.sql +++ b/models/_sector/dex/bot_trades/solana/platforms/looter_solana_bot_trades.sql @@ -6,6 +6,7 @@ materialized='incremental', file_format='delta', incremental_strategy='merge', + incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.block_time')], unique_key=[ 'blockchain', 'tx_id', diff --git a/models/_sector/dex/bot_trades/solana/platforms/maestro_solana_bot_trades.sql b/models/_sector/dex/bot_trades/solana/platforms/maestro_solana_bot_trades.sql index 5da5acb603f..fd836bb953f 100644 --- a/models/_sector/dex/bot_trades/solana/platforms/maestro_solana_bot_trades.sql +++ b/models/_sector/dex/bot_trades/solana/platforms/maestro_solana_bot_trades.sql @@ -5,6 +5,7 @@ materialized = 'incremental', file_format = 'delta', incremental_strategy = 'merge', + incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.block_time')], unique_key = ['blockchain', 'tx_id', 'tx_index', 'outer_instruction_index', 'inner_instruction_index'] ) }} diff --git a/models/_sector/dex/bot_trades/solana/platforms/magnum_solana_bot_trades.sql b/models/_sector/dex/bot_trades/solana/platforms/magnum_solana_bot_trades.sql index 712485544f5..91f0abaeb6e 100644 --- a/models/_sector/dex/bot_trades/solana/platforms/magnum_solana_bot_trades.sql +++ b/models/_sector/dex/bot_trades/solana/platforms/magnum_solana_bot_trades.sql @@ -5,6 +5,7 @@ materialized = 'incremental', file_format = 'delta', incremental_strategy = 'merge', + incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.block_time')], unique_key = ['blockchain', 'tx_id', 'tx_index', 'outer_instruction_index', 'inner_instruction_index'] ) }} diff --git a/models/_sector/dex/bot_trades/solana/platforms/pepe_boost_solana_bot_trades.sql b/models/_sector/dex/bot_trades/solana/platforms/pepe_boost_solana_bot_trades.sql index a8d11df014b..ea64d0f452d 100644 --- a/models/_sector/dex/bot_trades/solana/platforms/pepe_boost_solana_bot_trades.sql +++ b/models/_sector/dex/bot_trades/solana/platforms/pepe_boost_solana_bot_trades.sql @@ -5,6 +5,7 @@ materialized = 'incremental', file_format = 'delta', incremental_strategy = 'merge', + incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.block_time')], unique_key = ['blockchain', 'tx_id', 'tx_index', 'outer_instruction_index', 'inner_instruction_index'] ) }} diff --git a/models/_sector/dex/bot_trades/solana/platforms/readyswap_solana_bot_trades.sql b/models/_sector/dex/bot_trades/solana/platforms/readyswap_solana_bot_trades.sql index e10fee69c32..39fbb605fc3 100644 --- a/models/_sector/dex/bot_trades/solana/platforms/readyswap_solana_bot_trades.sql +++ b/models/_sector/dex/bot_trades/solana/platforms/readyswap_solana_bot_trades.sql @@ -5,6 +5,7 @@ materialized = 'incremental', file_format = 'delta', incremental_strategy = 'merge', + incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.block_time')], unique_key = ['blockchain', 'tx_id', 'tx_index', 'outer_instruction_index', 'inner_instruction_index'] ) }} diff --git a/models/_sector/dex/bot_trades/solana/platforms/shuriken_solana_bot_trades.sql b/models/_sector/dex/bot_trades/solana/platforms/shuriken_solana_bot_trades.sql index 4b57f2cd886..576abf1c8de 100644 --- a/models/_sector/dex/bot_trades/solana/platforms/shuriken_solana_bot_trades.sql +++ b/models/_sector/dex/bot_trades/solana/platforms/shuriken_solana_bot_trades.sql @@ -5,6 +5,7 @@ materialized = 'incremental', file_format = 'delta', incremental_strategy = 'merge', + incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.block_time')], unique_key = ['blockchain', 'tx_id', 'tx_index', 'outer_instruction_index', 'inner_instruction_index'] ) }} diff --git a/models/_sector/dex/bot_trades/solana/platforms/sol_gun_solana_bot_trades.sql b/models/_sector/dex/bot_trades/solana/platforms/sol_gun_solana_bot_trades.sql index 150c7a3debb..aa1ecce87d1 100644 --- a/models/_sector/dex/bot_trades/solana/platforms/sol_gun_solana_bot_trades.sql +++ b/models/_sector/dex/bot_trades/solana/platforms/sol_gun_solana_bot_trades.sql @@ -5,6 +5,7 @@ materialized = 'incremental', file_format = 'delta', incremental_strategy = 'merge', + incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.block_time')], unique_key = ['blockchain', 'tx_id', 'tx_index', 'outer_instruction_index', 'inner_instruction_index'] ) }} diff --git a/models/_sector/dex/bot_trades/solana/platforms/sol_trading_bot_solana_bot_trades.sql b/models/_sector/dex/bot_trades/solana/platforms/sol_trading_bot_solana_bot_trades.sql index eb104fbc21f..2fb9d00d068 100644 --- a/models/_sector/dex/bot_trades/solana/platforms/sol_trading_bot_solana_bot_trades.sql +++ b/models/_sector/dex/bot_trades/solana/platforms/sol_trading_bot_solana_bot_trades.sql @@ -5,6 +5,7 @@ materialized = 'incremental', file_format = 'delta', incremental_strategy = 'merge', + incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.block_time')], unique_key = ['blockchain', 'tx_id', 'tx_index', 'outer_instruction_index', 'inner_instruction_index'] ) }} diff --git a/models/_sector/dex/bot_trades/solana/platforms/soul_sniper_solana_bot_trades.sql b/models/_sector/dex/bot_trades/solana/platforms/soul_sniper_solana_bot_trades.sql index ae63478203d..3fbabe5124e 100644 --- a/models/_sector/dex/bot_trades/solana/platforms/soul_sniper_solana_bot_trades.sql +++ b/models/_sector/dex/bot_trades/solana/platforms/soul_sniper_solana_bot_trades.sql @@ -6,6 +6,7 @@ materialized='incremental', file_format='delta', incremental_strategy='merge', + incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.block_time')], unique_key=[ 'blockchain', 'tx_id', @@ -27,7 +28,7 @@ with from {{ source('solana', 'account_activity') }} as activity join {{ source("solana", "transactions") }} as transactions on tx_id = id where - {% if is_incremental() %} + {% if is_incremental() %} {{ incremental_predicate('activity.block_time') }} {% else %} activity.block_time >= timestamp '{{project_start_date}}' {% endif %} diff --git a/models/_sector/dex/bot_trades/solana/platforms/trojan_solana_bot_trades.sql b/models/_sector/dex/bot_trades/solana/platforms/trojan_solana_bot_trades.sql index 678c5d76b49..e6ba7307d45 100644 --- a/models/_sector/dex/bot_trades/solana/platforms/trojan_solana_bot_trades.sql +++ b/models/_sector/dex/bot_trades/solana/platforms/trojan_solana_bot_trades.sql @@ -5,6 +5,7 @@ materialized = 'incremental', file_format = 'delta', incremental_strategy = 'merge', + incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.block_time')], unique_key = ['blockchain', 'tx_id', 'tx_index', 'outer_instruction_index', 'inner_instruction_index'] ) }} diff --git a/models/_sector/dex/bot_trades/solana/platforms/wifbot_solana_bot_trades.sql b/models/_sector/dex/bot_trades/solana/platforms/wifbot_solana_bot_trades.sql index 1c5a3f04ec9..3ac01dc0e5d 100644 --- a/models/_sector/dex/bot_trades/solana/platforms/wifbot_solana_bot_trades.sql +++ b/models/_sector/dex/bot_trades/solana/platforms/wifbot_solana_bot_trades.sql @@ -6,6 +6,7 @@ materialized='incremental', file_format='delta', incremental_strategy='merge', + incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.block_time')], unique_key=[ 'blockchain', 'tx_id', @@ -29,7 +30,7 @@ with '{{wsol_token}}' as fee_token_mint_address from {{ source('solana', 'account_activity') }} where - {% if is_incremental() %} + {% if is_incremental() %} {{ incremental_predicate('block_time') }} {% else %} block_time >= timestamp '{{project_start_date}}' {% endif %} diff --git a/models/_sector/nft/trades/chains/solana/old/magiceden_solana_events.sql b/models/_sector/nft/trades/chains/solana/old/magiceden_solana_events.sql index af7da8379ca..201e0874a80 100644 --- a/models/_sector/nft/trades/chains/solana/old/magiceden_solana_events.sql +++ b/models/_sector/nft/trades/chains/solana/old/magiceden_solana_events.sql @@ -1,10 +1,11 @@ {{ config( schema = 'magiceden_solana', alias = 'events', - + materialized = 'incremental', file_format = 'delta', incremental_strategy = 'merge', + incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.block_time')], unique_key = ['unique_trade_id'] ) }} @@ -40,7 +41,7 @@ WITH me_txs AS ( {% endif %} {% if is_incremental() %} -- this filter will only be applied on an incremental run - AND block_time >= date_trunc('day', now() - interval '7' day) + AND {{ incremental_predicate('block_time') }} {% endif %} ) @@ -154,5 +155,5 @@ LEFT JOIN {{ source('prices', 'usd') }} AS p AND p.blockchain is NULL AND p.symbol = 'SOL' {% if is_incremental() %} - AND p.minute >= date_trunc('day', now() - interval '7' day) + AND {{ incremental_predicate('p.minute') }} {% endif %} diff --git a/models/_sector/nft/trades/chains/solana/old/opensea_solana_events.sql b/models/_sector/nft/trades/chains/solana/old/opensea_solana_events.sql index 55d6d588273..013a9979e2a 100644 --- a/models/_sector/nft/trades/chains/solana/old/opensea_solana_events.sql +++ b/models/_sector/nft/trades/chains/solana/old/opensea_solana_events.sql @@ -5,6 +5,7 @@ materialized = 'incremental', file_format = 'delta', incremental_strategy = 'merge', + incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.block_time')], unique_key = ['unique_trade_id'] ) }} @@ -34,7 +35,7 @@ LEFT JOIN {{ source('prices', 'usd') }} p AND p.blockchain is null AND p.symbol = 'SOL' {% if is_incremental() %} - AND p.minute >= date_trunc('day', now() - interval '7' day) + AND {{ incremental_predicate('p.minute') }} {% endif %} WHERE (contains(account_keys, '3o9d13qUvEuuauhFrVom1vuCzgNsJifeaBYDPquaT73Y') OR contains(account_keys, 'pAHAKoTJsAAe2ZcvTZUxoYzuygVAFAmbYmJYdWT886r')) @@ -43,7 +44,7 @@ AND block_time > TIMESTAMP '2022-04-06' AND block_slot > 128251864 {% endif %} {% if is_incremental() %} -AND block_time >= date_trunc('day', now() - interval '7' day) +AND {{ incremental_predicate('block_time') }} {% endif %} ) diff --git a/models/orca_whirlpool/orca_whirlpool_token_prices.sql b/models/orca_whirlpool/orca_whirlpool_token_prices.sql index 4c9b799580c..6696ce4fbdf 100644 --- a/models/orca_whirlpool/orca_whirlpool_token_prices.sql +++ b/models/orca_whirlpool/orca_whirlpool_token_prices.sql @@ -1,11 +1,12 @@ {{ - config( + config( schema = 'orca_whirlpool', alias = 'token_prices', partition_by = ['block_month'], materialized = 'incremental', file_format = 'delta', incremental_strategy = 'merge', + incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.minute')], unique_key = ['blockchain', 'contract_address', 'minute'], pre_hook='{{ enforce_join_distribution("PARTITIONED") }}', post_hook='{{ expose_spells(\'["solana"]\', diff --git a/models/orca_whirlpool/orca_whirlpool_token_prices_hour.sql b/models/orca_whirlpool/orca_whirlpool_token_prices_hour.sql index bd3f677720f..2f70d9a81de 100644 --- a/models/orca_whirlpool/orca_whirlpool_token_prices_hour.sql +++ b/models/orca_whirlpool/orca_whirlpool_token_prices_hour.sql @@ -1,11 +1,12 @@ {{ - config( + config( schema = 'orca_whirlpool', alias = 'token_prices_hour', partition_by = ['block_month'], materialized = 'incremental', file_format = 'delta', incremental_strategy = 'merge', + incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.hour')], unique_key = ['blockchain', 'contract_address', 'hour'], pre_hook='{{ enforce_join_distribution("PARTITIONED") }}', post_hook='{{ expose_spells(\'["solana"]\', diff --git a/models/orca_whirlpool/orca_whirlpool_trades.sql b/models/orca_whirlpool/orca_whirlpool_trades.sql index 57026cf1778..1b806e84e15 100644 --- a/models/orca_whirlpool/orca_whirlpool_trades.sql +++ b/models/orca_whirlpool/orca_whirlpool_trades.sql @@ -1,12 +1,13 @@ {{ config( - + schema = 'orca_whirlpool', alias = 'trades', partition_by = ['block_month'], materialized = 'incremental', file_format = 'delta', incremental_strategy = 'merge', + incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.block_time')], unique_key = ['tx_id', 'outer_instruction_index', 'inner_instruction_index', 'tx_index','block_month'], pre_hook='{{ enforce_join_distribution("PARTITIONED") }}', post_hook='{{ expose_spells(\'["solana"]\', @@ -17,18 +18,18 @@ {% set project_start_date = '2022-03-10' %} --grabbed min block time from whirlpool_solana.whirlpool_call_swap -with +with whirlpools as ( - with + with fee_tiers_defaults as ( --the fee tier has defaults that can be changed. Once the pool is initialized, the fee tier is set to the default fee tier. - SELECT + SELECT account_feeTier as fee_tier , defaultfeeRate as fee_rate , call_block_time as fee_time FROM {{ source('whirlpool_solana', 'whirlpool_call_initializeFeeTier') }} - UNION ALL + UNION ALL SELECT account_feeTier as fee_tier @@ -39,13 +40,13 @@ with --https://docs.orca.so/reference/trading-fees, should track protocol fees too. and rewards. , fee_updates as ( - SELECT + SELECT whirlpool_id , update_time , fee_rate FROM ( --get defaultFeeRate at time of pool init based on account_feeTier - SELECT + SELECT fi.account_whirlpool as whirlpool_id , fi.call_block_time as update_time , fi.account_feeTier as fee_tier @@ -56,18 +57,18 @@ with LEFT JOIN fee_tiers_defaults ftd ON ftd.fee_tier = account_feeTier AND ftd.fee_time <= fi.call_block_time ) WHERE recent_update = 1 - + UNION all - + --after being initialized, the fee rate can be set manually using setFeeRate on the pool (does not update with defaultFeeRate) - SELECT + SELECT account_whirlpool as whirlpool_id , call_block_time as update_time , feeRate as fee_rate FROM {{ source('whirlpool_solana', 'whirlpool_call_setFeeRate') }} ) - - SELECT + + SELECT tkA.symbol as tokenA_symbol , tkA.decimals as tokenA_decimals , account_tokenMintA as tokenA @@ -83,7 +84,7 @@ with , ip.call_tx_id as init_tx FROM {{ source('whirlpool_solana', 'whirlpool_call_initializePool') }} ip LEFT JOIN fee_updates fu ON fu.whirlpool_id = ip.account_whirlpool - LEFT JOIN {{ ref('tokens_solana_fungible') }} tkA ON tkA.token_mint_address = ip.account_tokenMintA + LEFT JOIN {{ ref('tokens_solana_fungible') }} tkA ON tkA.token_mint_address = ip.account_tokenMintA LEFT JOIN {{ ref('tokens_solana_fungible') }} tkB ON tkB.token_mint_address = ip.account_tokenMintB ) @@ -100,10 +101,10 @@ with , call_block_slot , call_outer_executing_account FROM {{ source('whirlpool_solana', 'whirlpool_call_twoHopSwap') }} sp - + UNION ALL - - --for second hop, we're going to spoof things so that the join on +1 and +2 still work just fine. + + --for second hop, we're going to spoof things so that the join on +1 and +2 still work just fine. SELECT account_whirlpoolTwo as account_whirlpool , call_outer_instruction_index @@ -117,9 +118,9 @@ with , call_outer_executing_account FROM {{ source('whirlpool_solana', 'whirlpool_call_twoHopSwap') }} sp ) - + , all_swaps as ( - SELECT + SELECT sp.call_block_time as block_time , 'whirlpool' as project , 1 as version @@ -131,9 +132,9 @@ with when lower(tokenA_symbol) > lower(tokenB_symbol) then concat(tokenB_symbol, '-', tokenA_symbol) else concat(tokenA_symbol, '-', tokenB_symbol) end as token_pair - , case when tk_1.token_mint_address = wp.tokenA then COALESCE(tokenB_symbol, tokenB) + , case when tk_1.token_mint_address = wp.tokenA then COALESCE(tokenB_symbol, tokenB) else COALESCE(tokenA_symbol, tokenA) - end as token_bought_symbol + end as token_bought_symbol -- token bought is always the second instruction (transfer) in the inner instructions , tr_2.amount as token_bought_amount_raw , tr_2.amount/pow(10,case when tk_1.token_mint_address = wp.tokenA then wp.tokenB_decimals else tokenA_decimals end) as token_bought_amount @@ -152,19 +153,19 @@ with , case when tk_1.token_mint_address = wp.tokenA then wp.tokenB else wp.tokenA end as token_bought_mint_address - , case when tk_1.token_mint_address = wp.tokenA then wp.tokenA + , case when tk_1.token_mint_address = wp.tokenA then wp.tokenA else wp.tokenB end as token_sold_mint_address , case when tk_1.token_mint_address = wp.tokenA then wp.tokenBVault else wp.tokenAVault end as token_bought_vault , case when tk_1.token_mint_address = wp.tokenA - then wp.tokenAVault + then wp.tokenAVault else wp.tokenBVault end as token_sold_vault , wp.update_time FROM ( - SELECT + SELECT account_whirlpool , call_outer_instruction_index , call_inner_instruction_index @@ -174,17 +175,17 @@ with , call_tx_index , call_block_time , call_block_slot - , call_outer_executing_account - FROM {{ source('whirlpool_solana', 'whirlpool_call_swap') }} + , call_outer_executing_account + FROM {{ source('whirlpool_solana', 'whirlpool_call_swap') }} WHERE 1=1 {% if is_incremental() %} AND {{incremental_predicate('call_block_time')}} {% else %} AND call_block_time >= TIMESTAMP '{{project_start_date}}' {% endif %} - - UNION ALL - + + UNION ALL + SELECT * FROM two_hop WHERE 1=1 {% if is_incremental() %} @@ -195,13 +196,13 @@ with ) sp INNER JOIN whirlpools wp - ON sp.account_whirlpool = wp.whirlpool_id + ON sp.account_whirlpool = wp.whirlpool_id AND sp.call_block_time >= wp.update_time - INNER JOIN {{ source('spl_token_solana', 'spl_token_call_transfer') }} tr_1 - ON tr_1.call_tx_id = sp.call_tx_id + INNER JOIN {{ source('spl_token_solana', 'spl_token_call_transfer') }} tr_1 + ON tr_1.call_tx_id = sp.call_tx_id AND tr_1.call_block_slot = sp.call_block_slot - AND tr_1.call_outer_instruction_index = sp.call_outer_instruction_index - AND ((sp.call_is_inner = false AND tr_1.call_inner_instruction_index = 1) + AND tr_1.call_outer_instruction_index = sp.call_outer_instruction_index + AND ((sp.call_is_inner = false AND tr_1.call_inner_instruction_index = 1) OR (sp.call_is_inner = true AND tr_1.call_inner_instruction_index = sp.call_inner_instruction_index + 1)) {% if is_incremental() %} AND {{incremental_predicate('tr_1.call_block_time')}} @@ -209,10 +210,10 @@ with AND tr_1.call_block_time >= TIMESTAMP '{{project_start_date}}' {% endif %} INNER JOIN {{ source('spl_token_solana', 'spl_token_call_transfer') }} tr_2 - ON tr_2.call_tx_id = sp.call_tx_id + ON tr_2.call_tx_id = sp.call_tx_id AND tr_2.call_block_slot = sp.call_block_slot - AND tr_2.call_outer_instruction_index = sp.call_outer_instruction_index - AND ((sp.call_is_inner = false AND tr_2.call_inner_instruction_index = 2) + AND tr_2.call_outer_instruction_index = sp.call_outer_instruction_index + AND ((sp.call_is_inner = false AND tr_2.call_inner_instruction_index = 2) OR (sp.call_is_inner = true AND tr_2.call_inner_instruction_index = sp.call_inner_instruction_index + 2)) {% if is_incremental() %} AND {{incremental_predicate('tr_2.call_block_time')}} @@ -224,7 +225,7 @@ with SELECT tb.blockchain - , tb.project + , tb.project , tb.version , CAST(date_trunc('month', tb.block_time) AS DATE) as block_month , tb.block_time @@ -251,22 +252,22 @@ SELECT , tb.tx_index , recent_update FROM ( - SELECT + SELECT * , row_number() OVER (partition by tx_id, outer_instruction_index, inner_instruction_index, tx_index order by update_time desc) as recent_update FROM all_swaps ) tb -LEFT JOIN {{ source('prices', 'usd') }} p_bought ON p_bought.blockchain = 'solana' - AND date_trunc('minute', tb.block_time) = p_bought.minute +LEFT JOIN {{ source('prices', 'usd') }} p_bought ON p_bought.blockchain = 'solana' + AND date_trunc('minute', tb.block_time) = p_bought.minute AND token_bought_mint_address = toBase58(p_bought.contract_address) {% if is_incremental() %} AND p_bought.minute >= date_trunc('day', now() - interval '7' day) {% else %} AND p_bought.minute >= TIMESTAMP '{{project_start_date}}' {% endif %} -LEFT JOIN {{ source('prices', 'usd') }} p_sold ON p_sold.blockchain = 'solana' - AND date_trunc('minute', tb.block_time) = p_sold.minute +LEFT JOIN {{ source('prices', 'usd') }} p_sold ON p_sold.blockchain = 'solana' + AND date_trunc('minute', tb.block_time) = p_sold.minute AND token_sold_mint_address = toBase58(p_sold.contract_address) {% if is_incremental() %} AND p_sold.minute >= date_trunc('day', now() - interval '7' day) diff --git a/models/sharky/solana/sharky_solana_events.sql b/models/sharky/solana/sharky_solana_events.sql index 4e713ddf0fc..e90a63016f1 100644 --- a/models/sharky/solana/sharky_solana_events.sql +++ b/models/sharky/solana/sharky_solana_events.sql @@ -1,11 +1,12 @@ {{ config( - + schema = 'sharky_solana', alias = 'events', partition_by = ['block_month'], materialized = 'incremental', file_format = 'delta', incremental_strategy = 'merge', + incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.block_time')], unique_key = ['block_month', 'evt_type', 'loan_id', 'id'], pre_hook='{{ enforce_join_distribution("PARTITIONED") }}', post_hook='{{ expose_spells(\'["solana"]\', @@ -29,7 +30,7 @@ WITH {% if not is_incremental() %} AND minute >= TIMESTAMP '{{ project_start_date }}' {% else %} - AND minute >= DATE_TRUNC('day', NOW() - INTERVAL '7' DAY) + AND {{ incremental_predicate('minute') }} {% endif %} ), offers AS ( @@ -49,7 +50,7 @@ WITH FROM {{ source('sharky_solana', 'sharky_call_offerLoan') }} WHERE {% if is_incremental() %} - call_block_time >= DATE_TRUNC('day', NOW() - INTERVAL '7' DAY) + {{ incremental_predicate('call_block_time') }} {% else %} True {% endif %} @@ -69,7 +70,7 @@ WITH FROM {{ source('sharky_solana', 'sharky_call_rescindLoan') }} WHERE {% if is_incremental() %} - call_block_time >= DATE_TRUNC('day', NOW() - INTERVAL '7' DAY) + {{ incremental_predicate('call_block_time') }} {% else %} True {% endif %} @@ -90,7 +91,7 @@ WITH FROM {{ source('sharky_solana', 'sharky_call_takeLoan') }} WHERE {% if is_incremental() %} - call_block_time >= DATE_TRUNC('day', NOW() - INTERVAL '7' DAY) + {{ incremental_predicate('call_block_time') }} {% else %} True {% endif %} @@ -111,7 +112,7 @@ WITH FROM {{ source('sharky_solana', 'sharky_call_takeLoanV3') }} WHERE {% if is_incremental() %} - call_block_time >= DATE_TRUNC('day', NOW() - INTERVAL '7' DAY) + {{ incremental_predicate('call_block_time') }} {% else %} True {% endif %} @@ -132,7 +133,7 @@ WITH FROM {{ source('sharky_solana', 'sharky_call_takeLoanV3Compressed') }} WHERE {% if is_incremental() %} - call_block_time >= DATE_TRUNC('day', NOW() - INTERVAL '7' DAY) + {{ incremental_predicate('call_block_time') }} {% else %} True {% endif %} @@ -152,7 +153,7 @@ WITH FROM {{ source('sharky_solana', 'sharky_call_repayLoan') }} WHERE {% if is_incremental() %} - call_block_time >= DATE_TRUNC('day', NOW() - INTERVAL '7' DAY) + {{ incremental_predicate('call_block_time') }} {% else %} True {% endif %} @@ -173,7 +174,7 @@ WITH FROM {{ source('sharky_solana', 'sharky_call_repayLoanEscrow') }} WHERE {% if is_incremental() %} - call_block_time >= DATE_TRUNC('day', NOW() - INTERVAL '7' DAY) + {{ incremental_predicate('call_block_time') }} {% else %} True {% endif %} @@ -194,7 +195,7 @@ WITH FROM {{ source('sharky_solana', 'sharky_call_repayLoanV3') }} WHERE {% if is_incremental() %} - call_block_time >= DATE_TRUNC('day', NOW() - INTERVAL '7' DAY) + {{ incremental_predicate('call_block_time') }} {% else %} True {% endif %} @@ -215,7 +216,7 @@ WITH FROM {{ source('sharky_solana', 'sharky_call_repayLoanV3Compressed') }} WHERE {% if is_incremental() %} - call_block_time >= DATE_TRUNC('day', NOW() - INTERVAL '7' DAY) + {{ incremental_predicate('call_block_time') }} {% else %} True {% endif %} @@ -235,7 +236,7 @@ WITH FROM {{ source('sharky_solana', 'sharky_call_forecloseLoan') }} WHERE {% if is_incremental() %} - call_block_time >= DATE_TRUNC('day', NOW() - INTERVAL '7' DAY) + {{ incremental_predicate('call_block_time') }} {% else %} True {% endif %} @@ -256,7 +257,7 @@ WITH FROM {{ source('sharky_solana', 'sharky_call_forecloseLoanEscrow') }} WHERE {% if is_incremental() %} - call_block_time >= DATE_TRUNC('day', NOW() - INTERVAL '7' DAY) + {{ incremental_predicate('call_block_time') }} {% else %} True {% endif %} @@ -277,7 +278,7 @@ WITH FROM {{ source('sharky_solana', 'sharky_call_forecloseLoanV3') }} WHERE {% if is_incremental() %} - call_block_time >= DATE_TRUNC('day', NOW() - INTERVAL '7' DAY) + {{ incremental_predicate('call_block_time') }} {% else %} True {% endif %} @@ -298,7 +299,7 @@ WITH FROM {{ source('sharky_solana', 'sharky_call_forecloseLoanV3Compressed') }} WHERE {% if is_incremental() %} - call_block_time >= DATE_TRUNC('day', NOW() - INTERVAL '7' DAY) + {{ incremental_predicate('call_block_time') }} {% else %} True {% endif %} @@ -318,7 +319,7 @@ WITH FROM {{ source('sharky_solana', 'sharky_call_extendLoan') }} WHERE {% if is_incremental() %} - call_block_time >= DATE_TRUNC('day', NOW() - INTERVAL '7' DAY) + {{ incremental_predicate('call_block_time') }} {% else %} True {% endif %} @@ -339,7 +340,7 @@ WITH FROM {{ source('sharky_solana', 'sharky_call_extendLoanEscrow') }} WHERE {% if is_incremental() %} - call_block_time >= DATE_TRUNC('day', NOW() - INTERVAL '7' DAY) + {{ incremental_predicate('call_block_time') }} {% else %} True {% endif %} @@ -360,7 +361,7 @@ WITH FROM {{ source('sharky_solana', 'sharky_call_extendLoanV3') }} WHERE {% if is_incremental() %} - call_block_time >= DATE_TRUNC('day', NOW() - INTERVAL '7' DAY) + {{ incremental_predicate('call_block_time') }} {% else %} True {% endif %} @@ -381,7 +382,7 @@ WITH FROM {{ source('sharky_solana', 'sharky_call_extendLoanV3Compressed') }} WHERE {% if is_incremental() %} - call_block_time >= DATE_TRUNC('day', NOW() - INTERVAL '7' DAY) + {{ incremental_predicate('call_block_time') }} {% else %} True {% endif %} @@ -413,7 +414,7 @@ WITH {% if not is_incremental() %} AND st.block_time >= TIMESTAMP '{{ project_start_date }}' {% else %} - AND st.block_time >= DATE_TRUNC('day', NOW() - INTERVAL '7' DAY) + AND {{ incremental_predicate('st.block_time') }} {% endif %} ), final_event AS ( SELECT * FROM offers From c38608cb8f9a4203a59bad90144cff82b1be6f36 Mon Sep 17 00:00:00 2001 From: Alan Ghobadi Date: Tue, 4 Jun 2024 13:31:31 +0200 Subject: [PATCH 032/149] Add incremental predicates on zeroex (#6063) --- .../ethereum/staking_ethereum_deposits.sql | 7 +- .../arbitrum/zeroex_arbitrum_api_fills.sql | 74 ++++++++--------- .../zeroex_arbitrum_api_fills_deduped.sql | 15 ++-- .../arbitrum/zeroex_arbitrum_native_fills.sql | 58 ++++++------- .../zeroex_avalanche_c_api_fills.sql | 79 +++++++++--------- .../zeroex_avalanche_c_api_fills_deduped.sql | 13 +-- models/zeroex/base/zeroex_base_api_fills.sql | 59 +++++++------- .../base/zeroex_base_api_fills_deduped.sql | 19 ++--- models/zeroex/bnb/zeroex_bnb_api_fills.sql | 81 ++++++++++--------- .../bnb/zeroex_bnb_api_fills_deduped.sql | 13 +-- models/zeroex/bnb/zeroex_bnb_native_fills.sql | 52 ++++++------ models/zeroex/celo/zeroex_celo_api_fills.sql | 53 ++++++------ .../celo/zeroex_celo_api_fills_deduped.sql | 21 ++--- .../ethereum/zeroex_ethereum_api_fills.sql | 60 +++++++------- .../zeroex_ethereum_api_fills_deduped.sql | 15 ++-- .../ethereum/zeroex_ethereum_native_fills.sql | 59 +++++++------- .../ethereum/zeroex_ethereum_nft_fills.sql | 7 +- .../zeroex/fantom/zeroex_fantom_api_fills.sql | 71 ++++++++-------- .../zeroex_fantom_api_fills_deduped.sql | 13 +-- .../optimism/zeroex_optimism_api_fills.sql | 57 ++++++------- .../zeroex_optimism_api_fills_deduped.sql | 17 ++-- .../optimism/zeroex_optimism_native_fills.sql | 46 +++++------ .../polygon/zeroex_polygon_api_fills.sql | 75 ++++++++--------- .../zeroex_polygon_api_fills_deduped.sql | 13 +-- .../polygon/zeroex_polygon_native_fills.sql | 51 ++++++------ .../polygon/zeroex_polygon_nft_fills.sql | 5 +- 26 files changed, 525 insertions(+), 508 deletions(-) diff --git a/models/staking/ethereum/staking_ethereum_deposits.sql b/models/staking/ethereum/staking_ethereum_deposits.sql index 2016b346f06..364ac4322c5 100644 --- a/models/staking/ethereum/staking_ethereum_deposits.sql +++ b/models/staking/ethereum/staking_ethereum_deposits.sql @@ -1,5 +1,5 @@ {{ config( - + schema = 'staking_ethereum', alias = 'deposits', materialized = 'incremental', @@ -36,7 +36,7 @@ WITH deposit_events AS ( WHERE d.evt_block_time >= date_trunc('day', now() - interval '7' day) {% endif %} ) - + , traces AS ( SELECT t.block_number , t.tx_hash AS tx_hash @@ -55,7 +55,7 @@ WITH deposit_events AS ( AND t.block_time >= date_trunc('day', now() - interval '7' day) {% endif %} ) - + SELECT distinct d.block_time , d.block_number , d.amount AS amount_staked @@ -100,4 +100,3 @@ LEFT JOIN {{ ref('staking_ethereum_entities')}} etes OR (etes.pubkey IS NOT NULL AND d.pubkey=etes.pubkey) OR (etes.withdrawal_credentials IS NOT NULL AND d.withdrawal_credentials=etes.withdrawal_credentials)) AND etes.sub_entity IS NOT NULL - \ No newline at end of file diff --git a/models/zeroex/arbitrum/zeroex_arbitrum_api_fills.sql b/models/zeroex/arbitrum/zeroex_arbitrum_api_fills.sql index cb456398d97..d877cb4ac0e 100644 --- a/models/zeroex/arbitrum/zeroex_arbitrum_api_fills.sql +++ b/models/zeroex/arbitrum/zeroex_arbitrum_api_fills.sql @@ -1,12 +1,12 @@ {{ config( - + alias = 'api_fills', materialized='incremental', partition_by = ['block_month'], unique_key = ['block_date', 'tx_hash', 'evt_index'], on_schema_change='sync_all_columns', file_format ='delta', - incremental_strategy='merge' + incremental_strategy='merge' ) }} @@ -16,7 +16,7 @@ -- Test Query here: https://dune.com/queries/1855986 WITH zeroex_tx AS ( - SELECT + SELECT tr.tx_hash, tr.block_number, MAX(CASE @@ -28,11 +28,11 @@ WITH zeroex_tx AS ( FROM {{ source('arbitrum', 'traces') }} tr WHERE tr.to IN ( -- exchange contract - 0x61935cbdd02287b511119ddb11aeb42f1593b7ef, + 0x61935cbdd02287b511119ddb11aeb42f1593b7ef, -- forwarder addresses 0x6958f5e95332d93d21af0d7b9ca85b8212fee0a5, 0x4aa817c6f383c8e8ae77301d18ce48efb16fd2be, - 0x4ef40d1bf0983899892946830abf99eca2dbc5ce, + 0x4ef40d1bf0983899892946830abf99eca2dbc5ce, -- exchange proxy 0xdef1c0ded9bec7f1a1670819833240f027b25eff ) @@ -40,9 +40,9 @@ WITH zeroex_tx AS ( bytearray_position(INPUT, 0x869584cd ) <> 0 OR bytearray_position(INPUT, 0xfbc019a7 ) <> 0 ) - + {% if is_incremental() %} - AND tr.block_time >= date_trunc('day', now() - interval '7' day) + AND {{ incremental_predicate('tr.block_time') }} {% endif %} {% if not is_incremental() %} AND tr.block_time >= TIMESTAMP '{{zeroex_v3_start_date}}' @@ -51,7 +51,7 @@ WITH zeroex_tx AS ( ), v4_rfq_fills_no_bridge AS ( - SELECT + SELECT fills.evt_tx_hash AS tx_hash, fills.evt_block_number AS block_number, fills.evt_index, @@ -68,18 +68,18 @@ v4_rfq_fills_no_bridge AS ( (zeroex_tx.tx_hash IS NOT NULL) AS swap_flag, FALSE AS matcha_limit_order_flag FROM {{ source('zeroex_arbitrum', 'ExchangeProxy_evt_RfqOrderFilled') }} fills - INNER JOIN zeroex_tx + INNER JOIN zeroex_tx ON zeroex_tx.tx_hash = fills.evt_tx_hash AND zeroex_tx.block_number = fills.evt_block_number {% if is_incremental() %} - WHERE evt_block_time >= date_trunc('day', now() - interval '7' day) + WHERE {{ incremental_predicate('evt_block_time') }} {% endif %} {% if not is_incremental() %} WHERE evt_block_time >= TIMESTAMP '{{zeroex_v4_start_date}}' {% endif %} ), v4_limit_fills_no_bridge AS ( - SELECT + SELECT fills.evt_tx_hash AS tx_hash, fills.evt_block_number AS block_number, fills.evt_index, @@ -94,23 +94,23 @@ v4_limit_fills_no_bridge AS ( 'LimitOrderFilled' AS type, COALESCE(zeroex_tx.affiliate_address, fills.feeRecipient) AS affiliate_address, (zeroex_tx.tx_hash IS NOT NULL) AS swap_flag, - (fills.feeRecipient in - (0x9b858be6e3047d88820f439b240deac2418a2551,0x86003b044f70dac0abc80ac8957305b6370893ed,0x5bc2419a087666148bfbe1361ae6c06d240c6131)) - AS matcha_limit_order_flag + (fills.feeRecipient in + (0x9b858be6e3047d88820f439b240deac2418a2551,0x86003b044f70dac0abc80ac8957305b6370893ed,0x5bc2419a087666148bfbe1361ae6c06d240c6131)) + AS matcha_limit_order_flag FROM {{ source('zeroex_arbitrum', 'ExchangeProxy_evt_LimitOrderFilled') }} fills - INNER JOIN zeroex_tx + INNER JOIN zeroex_tx ON zeroex_tx.tx_hash = fills.evt_tx_hash AND zeroex_tx.block_number = fills.evt_block_number {% if is_incremental() %} - WHERE evt_block_time >= date_trunc('day', now() - interval '7' day) + WHERE {{ incremental_predicate('evt_block_time') }} {% endif %} {% if not is_incremental() %} WHERE evt_block_time >= TIMESTAMP '{{zeroex_v4_start_date}}' {% endif %} ), otc_fills AS ( - SELECT + SELECT fills.evt_tx_hash AS tx_hash, fills.evt_block_number AS block_number, fills.evt_index, @@ -132,7 +132,7 @@ otc_fills AS ( AND zeroex_tx.block_number = fills.evt_block_number {% if is_incremental() %} - WHERE evt_block_time >= date_trunc('day', now() - interval '7' day) + WHERE {{ incremental_predicate('evt_block_time') }} {% endif %} {% if not is_incremental() %} WHERE evt_block_time >= TIMESTAMP '{{zeroex_v4_start_date}}' @@ -141,7 +141,7 @@ otc_fills AS ( ), /* ERC20BridgeTransfer AS ( - SELECT + SELECT logs.tx_hash, INDEX AS evt_index, logs.contract_address, @@ -159,17 +159,17 @@ ERC20BridgeTransfer AS ( FROM {{ source('arbitrum', 'logs') }} logs INNER JOIN zeroex_tx ON zeroex_tx.tx_hash = logs.tx_hash WHERE topic0 = '0x349fc08071558d8e3aa92dec9396e4e9f2dfecd6bb9065759d1932e7da43b8a9' - + {% if is_incremental() %} - AND block_time >= date_trunc('day', now() - interval '7' day) + AND {{ incremental_predicate('block_time') }} {% endif %} {% if not is_incremental() %} -- AND block_time >= TIMESTAMP '{{zeroex_v3_start_date}}' {% endif %} -), +), BridgeFill AS ( - SELECT + SELECT logs.tx_hash, INDEX AS evt_index, logs.contract_address, @@ -190,14 +190,14 @@ BridgeFill AS ( AND contract_address = 0xdb6f1920a889355780af7570773609bd8cb1f498 {% if is_incremental() %} - AND block_time >= date_trunc('day', now() - interval '7' day) + AND {{ incremental_predicate('block_time') }} {% endif %} {% if not is_incremental() %} -- AND block_time >= TIMESTAMP '{{zeroex_v4_start_date}}' {% endif %} ), */ NewBridgeFill AS ( - SELECT + SELECT logs.tx_hash as tx_hash, logs.block_number as block_number, INDEX AS evt_index, @@ -221,7 +221,7 @@ NewBridgeFill AS ( AND contract_address = 0xdb6f1920a889355780af7570773609bd8cb1f498 {% if is_incremental() %} - AND block_time >= date_trunc('day', now() - interval '7' day) + AND {{ incremental_predicate('block_time') }} {% endif %} {% if not is_incremental() %} AND block_time >= TIMESTAMP '{{zeroex_v4_start_date}}' @@ -229,7 +229,7 @@ NewBridgeFill AS ( ), direct_PLP AS ( - SELECT + SELECT plp.evt_tx_hash as tx_hash, plp.evt_block_number as block_number, plp.evt_index AS evt_index, @@ -251,7 +251,7 @@ direct_PLP AS ( AND zeroex_tx.block_number = plp.evt_block_number {% if is_incremental() %} - WHERE evt_block_time >= date_trunc('day', now() - interval '7' day) + WHERE {{ incremental_predicate('evt_block_time') }} {% endif %} {% if not is_incremental() %} WHERE evt_block_time >= TIMESTAMP '{{zeroex_v3_start_date}}' @@ -260,19 +260,19 @@ direct_PLP AS ( all_tx AS ( SELECT * - FROM direct_PLP - UNION ALL + FROM direct_PLP + UNION ALL SELECT * - FROM NewBridgeFill + FROM NewBridgeFill UNION ALL SELECT * FROM v4_rfq_fills_no_bridge UNION ALL SELECT * FROM v4_limit_fills_no_bridge UNION ALL SELECT * - FROM otc_fills + FROM otc_fills ) -SELECT +SELECT all_tx.tx_hash, all_tx.block_number, all_tx.evt_index, @@ -299,7 +299,7 @@ SELECT swap_flag, matcha_limit_order_flag, CASE when maker_token in (0xaf88d065e77c8cc2239327c5edb3a432268e5831) then all_tx.maker_token_amount_raw / CAST(POWER(10, 6) AS DOUBLE) --usdc - when taker_token in (0xaf88d065e77c8cc2239327c5edb3a432268e5831) then all_tx.taker_token_amount_raw / CAST(POWER(10, 6) AS DOUBLE) --usdc + when taker_token in (0xaf88d065e77c8cc2239327c5edb3a432268e5831) then all_tx.taker_token_amount_raw / CAST(POWER(10, 6) AS DOUBLE) --usdc WHEN maker_token IN (0x82af49447d8a07e3bd95bd0d56f35241523fbab1,0xff970a61a04b1ca14834a43f5de4533ebddb5cc8,0xda10009cbd5d07dd0cecc66161fc93d7c9000da1, 0xfc5a1a6eb076a2c7ad06ed22c90d7e710e35ad0a,0xfd086bc7cd5c481dcc9c85ebe478a1c0b69fcbb9, 0xd74f5255d557944cf7dd0e45ff521520002d5748) AND mp.price IS NOT NULL THEN (all_tx.maker_token_amount_raw / pow(10, mp.decimals)) * mp.price @@ -315,7 +315,7 @@ FROM all_tx INNER JOIN {{ source('arbitrum', 'transactions')}} tx ON all_tx.tx_hash = tx.hash AND all_tx.block_number = tx.block_number {% if is_incremental() %} -AND tx.block_time >= date_trunc('day', now() - interval '7' day) +AND {{ incremental_predicate('tx.block_time') }} {% endif %} {% if not is_incremental() %} AND tx.block_time >= TIMESTAMP '{{zeroex_v3_start_date}}' @@ -329,7 +329,7 @@ AND CASE AND tp.blockchain = 'arbitrum' {% if is_incremental() %} -AND tp.minute >= date_trunc('day', now() - interval '7' day) +AND {{ incremental_predicate('tp.minute') }} {% endif %} {% if not is_incremental() %} AND tp.minute >= TIMESTAMP '{{zeroex_v3_start_date}}' @@ -343,7 +343,7 @@ AND CASE AND mp.blockchain = 'arbitrum' {% if is_incremental() %} -AND mp.minute >= date_trunc('day', now() - interval '7' day) +AND {{ incremental_predicate('mp.minute') }} {% endif %} {% if not is_incremental() %} AND mp.minute >= TIMESTAMP '{{zeroex_v3_start_date}}' diff --git a/models/zeroex/arbitrum/zeroex_arbitrum_api_fills_deduped.sql b/models/zeroex/arbitrum/zeroex_arbitrum_api_fills_deduped.sql index 0d36882af04..2f3063f3a04 100644 --- a/models/zeroex/arbitrum/zeroex_arbitrum_api_fills_deduped.sql +++ b/models/zeroex/arbitrum/zeroex_arbitrum_api_fills_deduped.sql @@ -1,5 +1,5 @@ {{ config( - + schema = 'zeroex_arbitrum', alias = 'api_fills_deduped', materialized='incremental', @@ -7,7 +7,8 @@ unique_key = ['block_date', 'tx_hash', 'evt_index'], on_schema_change='sync_all_columns', file_format ='delta', - incremental_strategy='merge' + incremental_strategy='merge', + incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.block_time')] ) }} @@ -22,11 +23,11 @@ AS WHERE 1=1 AND swap_flag = true {% if is_incremental() %} - AND block_time >= date_trunc('day', now() - interval '7' day) + AND {{ incremental_predicate('block_time') }} {% endif %} {% if not is_incremental() %} AND block_time >= TIMESTAMP '{{zeroex_v3_start_date}}' - {% endif %} + {% endif %} ) , fills_first_last AS @@ -54,7 +55,7 @@ AS , MAX(CASE WHEN taker_consider_flag = 0 THEN NULL ELSE taker_token END ) AS taker_token , MAX(CASE WHEN maker_consider_flag = 0 THEN NULL ELSE maker_token END ) AS maker_token , MAX(CASE WHEN taker_consider_flag = 0 THEN NULL ELSE taker_symbol END ) AS taker_symbol - , MAX(CASE WHEN maker_consider_flag = 0 THEN NULL ELSE maker_symbol END ) AS maker_symbol + , MAX(CASE WHEN maker_consider_flag = 0 THEN NULL ELSE maker_symbol END ) AS maker_symbol , MAX(CASE WHEN taker_consider_flag = 0 THEN NULL ELSE taker_token_amount END) AS taker_token_amount , MAX(CASE WHEN maker_consider_flag = 0 THEN NULL ELSE maker_token_amount END) AS maker_token_amount , MAX(CASE WHEN taker_consider_flag = 0 THEN NULL ELSE taker_token_amount_raw END) AS taker_token_amount_raw @@ -66,7 +67,7 @@ AS SELECT a.blockchain , '0x API' as project , cast(null as varchar) as version - + , a.block_date , a.block_month , a.block_time @@ -91,7 +92,7 @@ SELECT a.blockchain , a.type , a.swap_flag , b.fills_within - , a.contract_address + , a.contract_address FROM fills_with_tx_fill_number a INNER JOIN deduped_bridge_fills b ON (a.tx_hash = b.tx_hash AND a.evt_index = b.evt_index) \ No newline at end of file diff --git a/models/zeroex/arbitrum/zeroex_arbitrum_native_fills.sql b/models/zeroex/arbitrum/zeroex_arbitrum_native_fills.sql index 8f91480e146..e8206fb93fb 100644 --- a/models/zeroex/arbitrum/zeroex_arbitrum_native_fills.sql +++ b/models/zeroex/arbitrum/zeroex_arbitrum_native_fills.sql @@ -5,16 +5,17 @@ unique_key = ['block_date', 'tx_hash', 'evt_index'], on_schema_change='sync_all_columns', file_format ='delta', - incremental_strategy='merge' + incremental_strategy='merge', + incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.block_time')] ) }} {% set zeroex_v3_start_date = '2019-12-01' %} {% set zeroex_v4_start_date = '2021-01-06' %} --- Test Query here: -WITH - +-- Test Query here: +WITH + v4_limit_fills AS ( SELECT @@ -29,15 +30,15 @@ WITH , fills.makerToken AS maker_token , fills.takerTokenFilledAmount as taker_token_filled_amount_raw , fills.makerTokenFilledAmount as maker_token_filled_amount_raw - , fills.contract_address + , fills.contract_address , mt.symbol AS maker_symbol , CASE WHEN lower(tt.symbol) > lower(mt.symbol) THEN concat(mt.symbol, '-', tt.symbol) ELSE concat(tt.symbol, '-', mt.symbol) END AS token_pair , fills.makerTokenFilledAmount / pow(10, mt.decimals) AS maker_asset_filled_amount , fills.takerToken AS taker_token , tt.symbol AS taker_symbol , fills.takerTokenFilledAmount / pow(10, tt.decimals) AS taker_asset_filled_amount - , (fills.feeRecipient in - (0x9b858be6e3047d88820f439b240deac2418a2551,0x86003b044f70dac0abc80ac8957305b6370893ed,0x5bc2419a087666148bfbe1361ae6c06d240c6131)) + , (fills.feeRecipient in + (0x9b858be6e3047d88820f439b240deac2418a2551,0x86003b044f70dac0abc80ac8957305b6370893ed,0x5bc2419a087666148bfbe1361ae6c06d240c6131)) AS matcha_limit_order_flag , CASE WHEN tp.symbol = 'USDC' THEN (fills.takerTokenFilledAmount / 1e6) ----don't multiply by anything as these assets are USD @@ -70,9 +71,9 @@ WITH END = mp.contract_address LEFT OUTER JOIN {{ source('tokens', 'erc20') }} mt ON mt.contract_address = fills.makerToken and mt.blockchain = 'arbitrum' LEFT OUTER JOIN {{ source('tokens', 'erc20') }} tt ON tt.contract_address = fills.takerToken and tt.blockchain = 'arbitrum' - where 1=1 + where 1=1 {% if is_incremental() %} - AND evt_block_time >= date_trunc('day', now() - interval '7' day) + AND {{ incremental_predicate('evt_block_time') }} {% endif %} {% if not is_incremental() %} AND evt_block_time >= TIMESTAMP '{{zeroex_v3_start_date}}' @@ -92,7 +93,7 @@ WITH , fills.makerToken AS maker_token , fills.takerTokenFilledAmount as taker_token_filled_amount_raw , fills.makerTokenFilledAmount as maker_token_filled_amount_raw - , fills.contract_address + , fills.contract_address , mt.symbol AS maker_symbol , CASE WHEN lower(tt.symbol) > lower(mt.symbol) THEN concat(mt.symbol, '-', tt.symbol) ELSE concat(tt.symbol, '-', mt.symbol) END AS token_pair , fills.makerTokenFilledAmount / pow(10, mt.decimals) AS maker_asset_filled_amount @@ -115,15 +116,15 @@ WITH END AS volume_usd , cast(NULL as double) AS protocol_fee_paid_eth FROM {{ source('zeroex_arbitrum', 'ExchangeProxy_evt_RfqOrderFilled') }} fills - LEFT JOIN {{ source('prices', 'usd') }} tp ON tp.blockchain = 'arbitrum' and - date_trunc('minute', evt_block_time) = tp.minute + LEFT JOIN {{ source('prices', 'usd') }} tp ON tp.blockchain = 'arbitrum' and + date_trunc('minute', evt_block_time) = tp.minute AND CASE -- set native token to wrapped version WHEN fills.takerToken = 0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee THEN 0x82af49447d8a07e3bd95bd0d56f35241523fbab1 ELSE fills.takerToken END = tp.contract_address LEFT JOIN {{ source('prices', 'usd') }} mp ON mp.blockchain = 'arbitrum' and - DATE_TRUNC('minute', evt_block_time) = mp.minute + DATE_TRUNC('minute', evt_block_time) = mp.minute AND CASE -- set native token to wrapped version WHEN fills.makerToken = 0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee THEN 0x82af49447d8a07e3bd95bd0d56f35241523fbab1 @@ -131,9 +132,9 @@ WITH END = mp.contract_address LEFT OUTER JOIN {{ source('tokens', 'erc20') }} mt ON mt.contract_address = fills.makerToken and mt.blockchain = 'arbitrum' LEFT OUTER JOIN {{ source('tokens', 'erc20') }} tt ON tt.contract_address = fills.takerToken and tt.blockchain = 'arbitrum' - where 1=1 + where 1=1 {% if is_incremental() %} - AND evt_block_time >= date_trunc('day', now() - interval '7' day) + AND {{ incremental_predicate('evt_block_time') }} {% endif %} {% if not is_incremental() %} AND evt_block_time >= TIMESTAMP '{{zeroex_v3_start_date}}' @@ -141,7 +142,7 @@ WITH ), otc_fills as ( SELECT - fills.evt_block_time AS block_time, + fills.evt_block_time AS block_time, fills.evt_block_number as block_number , 'v4' AS protocol_version , 'otc' as native_order_type @@ -152,7 +153,7 @@ WITH , fills.makerToken AS maker_token , fills.takerTokenFilledAmount as taker_token_filled_amount_raw , fills.makerTokenFilledAmount as maker_token_filled_amount_raw - , fills.contract_address + , fills.contract_address , mt.symbol AS maker_symbol , CASE WHEN lower(tt.symbol) > lower(mt.symbol) THEN concat(mt.symbol, '-', tt.symbol) ELSE concat(tt.symbol, '-', mt.symbol) END AS token_pair , fills.makerTokenFilledAmount / pow(10, mt.decimals) AS maker_asset_filled_amount @@ -175,15 +176,15 @@ WITH END AS volume_usd , cast(NULL as double) AS protocol_fee_paid_eth FROM {{ source('zeroex_arbitrum', 'ExchangeProxy_evt_OtcOrderFilled') }} fills - LEFT JOIN {{ source('prices', 'usd') }} tp ON tp.blockchain = 'arbitrum' and - date_trunc('minute', evt_block_time) = tp.minute + LEFT JOIN {{ source('prices', 'usd') }} tp ON tp.blockchain = 'arbitrum' and + date_trunc('minute', evt_block_time) = tp.minute AND CASE -- set native token to wrapped version WHEN fills.takerToken = 0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee THEN 0x82af49447d8a07e3bd95bd0d56f35241523fbab1 ELSE fills.takerToken END = tp.contract_address - LEFT JOIN {{ source('prices', 'usd') }} mp ON mp.blockchain = 'arbitrum' and - DATE_TRUNC('minute', evt_block_time) = mp.minute + LEFT JOIN {{ source('prices', 'usd') }} mp ON mp.blockchain = 'arbitrum' and + DATE_TRUNC('minute', evt_block_time) = mp.minute AND CASE -- set native token to wrapped version WHEN fills.makerToken = 0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee THEN 0x82af49447d8a07e3bd95bd0d56f35241523fbab1 @@ -191,9 +192,9 @@ WITH END = mp.contract_address LEFT OUTER JOIN {{ source('tokens', 'erc20') }} mt ON mt.contract_address = fills.makerToken and mt.blockchain = 'arbitrum' LEFT OUTER JOIN {{ source('tokens', 'erc20') }} tt ON tt.contract_address = fills.takerToken and tt.blockchain = 'arbitrum' - where 1=1 + where 1=1 {% if is_incremental() %} - AND evt_block_time >= date_trunc('day', now() - interval '7' day) + AND {{ incremental_predicate('evt_block_time') }} {% endif %} {% if not is_incremental() %} AND evt_block_time >= TIMESTAMP '{{zeroex_v3_start_date}}' @@ -202,8 +203,8 @@ WITH ), all_fills as ( - - + + SELECT * FROM v4_limit_fills @@ -212,10 +213,10 @@ WITH SELECT * FROM v4_rfq_fills UNION ALL - + SELECT * FROM otc_fills ) - SELECT distinct + SELECT distinct all_fills.block_time AS block_time, all_fills.block_number as block_number, protocol_version as version, date_trunc('day', all_fills.block_time) as block_date, @@ -245,9 +246,8 @@ WITH INNER JOIN {{ source('arbitrum', 'transactions')}} tx ON all_fills.transaction_hash = tx.hash AND all_fills.block_number = tx.block_number {% if is_incremental() %} - AND tx.block_time >= date_trunc('day', now() - interval '7' day) + AND {{ incremental_predicate('tx.block_time') }} {% endif %} {% if not is_incremental() %} AND tx.block_time >= TIMESTAMP '{{zeroex_v3_start_date}}' {% endif %} - \ No newline at end of file diff --git a/models/zeroex/avalanche_c/zeroex_avalanche_c_api_fills.sql b/models/zeroex/avalanche_c/zeroex_avalanche_c_api_fills.sql index 6933831b1e6..ecc912e35f6 100644 --- a/models/zeroex/avalanche_c/zeroex_avalanche_c_api_fills.sql +++ b/models/zeroex/avalanche_c/zeroex_avalanche_c_api_fills.sql @@ -1,12 +1,13 @@ {{ config( - + alias = 'api_fills', materialized='incremental', partition_by = ['block_month'], unique_key = ['block_date', 'tx_hash', 'evt_index'], on_schema_change='sync_all_columns', file_format ='delta', - incremental_strategy='merge' + incremental_strategy='merge', + incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.block_time')] ) }} @@ -16,7 +17,7 @@ -- Test Query here: https://dune.com/queries/1855493 WITH zeroex_tx AS ( - SELECT + SELECT tr.tx_hash, tr.block_number, MAX(CASE @@ -28,11 +29,11 @@ WITH zeroex_tx AS ( FROM {{ source('avalanche_c', 'traces') }} tr WHERE tr.to IN ( -- exchange contract - 0x61935cbdd02287b511119ddb11aeb42f1593b7ef, + 0x61935cbdd02287b511119ddb11aeb42f1593b7ef, -- forwarder addresses 0x6958f5e95332d93d21af0d7b9ca85b8212fee0a5, 0x4aa817c6f383c8e8ae77301d18ce48efb16fd2be, - 0x4ef40d1bf0983899892946830abf99eca2dbc5ce, + 0x4ef40d1bf0983899892946830abf99eca2dbc5ce, -- exchange proxy 0xdef1c0ded9bec7f1a1670819833240f027b25eff ) @@ -40,9 +41,9 @@ WITH zeroex_tx AS ( bytearray_position(INPUT, 0x869584cd ) <> 0 OR bytearray_position(INPUT, 0xfbc019a7 ) <> 0 ) - + {% if is_incremental() %} - AND tr.block_time >= date_trunc('day', now() - interval '7' day) + AND {{ incremental_predicate('tr.block_time') }} {% endif %} {% if not is_incremental() %} AND tr.block_time >= TIMESTAMP '{{zeroex_v3_start_date}}' @@ -51,7 +52,7 @@ WITH zeroex_tx AS ( ), v4_rfq_fills_no_bridge AS ( - SELECT + SELECT fills.evt_tx_hash AS tx_hash, fills.evt_block_number AS block_number, fills.evt_index, @@ -68,18 +69,18 @@ v4_rfq_fills_no_bridge AS ( (zeroex_tx.tx_hash IS NOT NULL) AS swap_flag, FALSE AS matcha_limit_order_flag FROM {{ source('zeroex_avalanche_c', 'ExchangeProxy_evt_RfqOrderFilled') }} fills - INNER JOIN zeroex_tx + INNER JOIN zeroex_tx ON zeroex_tx.tx_hash = fills.evt_tx_hash AND zeroex_tx.block_number = fills.evt_block_number {% if is_incremental() %} - WHERE fills.evt_block_time >= date_trunc('day', now() - interval '7' day) + WHERE {{ incremental_predicate('fills.evt_block_time') }} {% endif %} {% if not is_incremental() %} WHERE fills.evt_block_time >= TIMESTAMP '{{zeroex_v4_start_date}}' {% endif %} ), v4_limit_fills_no_bridge AS ( - SELECT + SELECT fills.evt_tx_hash AS tx_hash, fills.evt_block_number as block_number, fills.evt_index, @@ -94,22 +95,22 @@ v4_limit_fills_no_bridge AS ( 'LimitOrderFilled' AS type, COALESCE(zeroex_tx.affiliate_address, fills.feeRecipient) AS affiliate_address, (zeroex_tx.tx_hash IS NOT NULL) AS swap_flag, - (fills.feeRecipient in - (0x9b858be6e3047d88820f439b240deac2418a2551,0x86003b044f70dac0abc80ac8957305b6370893ed,0x5bc2419a087666148bfbe1361ae6c06d240c6131)) - AS matcha_limit_order_flag + (fills.feeRecipient in + (0x9b858be6e3047d88820f439b240deac2418a2551,0x86003b044f70dac0abc80ac8957305b6370893ed,0x5bc2419a087666148bfbe1361ae6c06d240c6131)) + AS matcha_limit_order_flag FROM {{ source('zeroex_avalanche_c', 'ExchangeProxy_evt_LimitOrderFilled') }} fills - INNER JOIN zeroex_tx + INNER JOIN zeroex_tx ON zeroex_tx.tx_hash = fills.evt_tx_hash AND zeroex_tx.block_number = fills.evt_block_number {% if is_incremental() %} - WHERE fills.evt_block_time >= date_trunc('day', now() - interval '7' day) + WHERE {{ incremental_predicate('fills.evt_block_time') }} {% endif %} {% if not is_incremental() %} WHERE fills.evt_block_time >= TIMESTAMP '{{zeroex_v4_start_date}}' {% endif %} ), otc_fills AS ( - SELECT + SELECT fills.evt_tx_hash AS tx_hash, fills.evt_block_number AS block_number, fills.evt_index, @@ -130,7 +131,7 @@ otc_fills AS ( ON zeroex_tx.tx_hash = fills.evt_tx_hash AND zeroex_tx.block_number = fills.evt_block_number {% if is_incremental() %} - WHERE fills.evt_block_time >= date_trunc('day', now() - interval '7' day) + WHERE {{ incremental_predicate('fills.evt_block_time') }} {% endif %} {% if not is_incremental() %} WHERE fills.evt_block_time >= TIMESTAMP '{{zeroex_v4_start_date}}' @@ -139,7 +140,7 @@ otc_fills AS ( ), /* ERC20BridgeTransfer AS ( - SELECT + SELECT logs.tx_hash, INDEX AS evt_index, logs.contract_address, @@ -157,17 +158,17 @@ ERC20BridgeTransfer AS ( FROM {{ source('avalanche_c', 'logs') }} logs INNER JOIN zeroex_tx ON zeroex_tx.tx_hash = logs.tx_hash WHERE topic0 = '0x349fc08071558d8e3aa92dec9396e4e9f2dfecd6bb9065759d1932e7da43b8a9' - + {% if is_incremental() %} - AND block_time >= date_trunc('day', now() - interval '7' day) + AND {{ incremental_predicate('block_time') }} {% endif %} {% if not is_incremental() %} -- AND block_time >= TIMESTAMP '{{zeroex_v3_start_date}}' {% endif %} -), +), BridgeFill AS ( - SELECT + SELECT logs.tx_hash, INDEX AS evt_index, logs.contract_address, @@ -188,14 +189,14 @@ BridgeFill AS ( AND contract_address = 0xdb6f1920a889355780af7570773609bd8cb1f498 {% if is_incremental() %} - AND block_time >= date_trunc('day', now() - interval '7' day) + AND {{ incremental_predicate('block_time') }} {% endif %} {% if not is_incremental() %} -- AND block_time >= TIMESTAMP '{{zeroex_v4_start_date}}' {% endif %} ), */ NewBridgeFill AS ( - SELECT + SELECT logs.tx_hash as tx_hash, logs.block_number as block_number, INDEX AS evt_index, @@ -219,7 +220,7 @@ NewBridgeFill AS ( AND contract_address = 0xdb6f1920a889355780af7570773609bd8cb1f498 {% if is_incremental() %} - AND logs.block_time >= date_trunc('day', now() - interval '7' day) + AND {{ incremental_predicate('logs.block_time') }} {% endif %} {% if not is_incremental() %} AND logs.block_time >= TIMESTAMP '{{zeroex_v4_start_date}}' @@ -227,7 +228,7 @@ NewBridgeFill AS ( ), direct_PLP AS ( - SELECT + SELECT plp.evt_tx_hash as tx_hash, plp.evt_block_number as block_number, plp.evt_index AS evt_index, @@ -248,7 +249,7 @@ direct_PLP AS ( ON zeroex_tx.tx_hash = plp.evt_tx_hash AND zeroex_tx.block_number = plp.evt_block_number {% if is_incremental() %} - WHERE plp.evt_block_time >= date_trunc('day', now() - interval '7' day) + WHERE {{ incremental_predicate('plp.evt_block_time') }} {% endif %} {% if not is_incremental() %} WHERE plp.evt_block_time >= TIMESTAMP '{{zeroex_v3_start_date}}' @@ -257,10 +258,10 @@ direct_PLP AS ( all_tx AS ( SELECT * - FROM direct_PLP - UNION ALL + FROM direct_PLP + UNION ALL SELECT * - FROM NewBridgeFill + FROM NewBridgeFill UNION ALL SELECT * FROM v4_rfq_fills_no_bridge @@ -269,10 +270,10 @@ all_tx AS ( FROM v4_limit_fills_no_bridge UNION ALL SELECT * - FROM otc_fills + FROM otc_fills ) -SELECT +SELECT all_tx.tx_hash, all_tx.block_number, all_tx.evt_index, @@ -305,7 +306,7 @@ SELECT 0xb31f66aa3c1e785363f0875a1b74e27b85fd66c7,0xd586e7f844cea2f87f50152665bcbc2c279d8d70, 0x49d5c2bdffac6ce2bfdb6640f4f80f226bc10bab,0x1c20e891bab6b1727d14da358fae2984ed9b59eb) AND tp.price IS NOT NULL THEN (all_tx.taker_token_amount_raw / pow(10, tp.decimals)) * tp.price ELSE COALESCE((all_tx.maker_token_amount_raw / pow(10, mp.decimals)) * mp.price, (all_tx.taker_token_amount_raw / pow(10, tp.decimals)) * tp.price) - END AS volume_usd, + END AS volume_usd, tx."from" AS tx_from, tx.to AS tx_to, 'avalanche_c' AS blockchain @@ -314,13 +315,13 @@ INNER JOIN {{ source('avalanche_c', 'transactions')}} tx ON all_tx.tx_hash = tx.hash AND all_tx.block_number = tx.block_number {% if is_incremental() %} - AND tx.block_time >= date_trunc('day', now() - interval '7' day) + AND {{ incremental_predicate('tx.block_time') }} {% endif %} {% if not is_incremental() %} AND tx.block_time >= TIMESTAMP '{{zeroex_v3_start_date}}' {% endif %} -LEFT JOIN {{ source('prices', 'usd') }} tp +LEFT JOIN {{ source('prices', 'usd') }} tp ON date_trunc('minute', all_tx.block_time) = tp.minute AND CASE WHEN all_tx.taker_token = 0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee THEN 0xb31f66aa3c1e785363f0875a1b74e27b85fd66c7 @@ -328,13 +329,13 @@ LEFT JOIN {{ source('prices', 'usd') }} tp END = tp.contract_address AND tp.blockchain = 'avalanche_c' {% if is_incremental() %} - AND tp.minute >= date_trunc('day', now() - interval '7' day) + AND {{ incremental_predicate('tp.minute') }} {% endif %} {% if not is_incremental() %} AND tp.minute >= TIMESTAMP '{{zeroex_v3_start_date}}' {% endif %} -LEFT JOIN {{ source('prices', 'usd') }} mp +LEFT JOIN {{ source('prices', 'usd') }} mp ON DATE_TRUNC('minute', all_tx.block_time) = mp.minute AND CASE WHEN all_tx.maker_token = 0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee THEN 0xb31f66aa3c1e785363f0875a1b74e27b85fd66c7 @@ -342,7 +343,7 @@ LEFT JOIN {{ source('prices', 'usd') }} mp END = mp.contract_address AND mp.blockchain = 'avalanche_c' {% if is_incremental() %} - AND mp.minute >= date_trunc('day', now() - interval '7' day) + AND {{ incremental_predicate('mp.minute') }} {% endif %} {% if not is_incremental() %} AND mp.minute >= TIMESTAMP '{{zeroex_v3_start_date}}' diff --git a/models/zeroex/avalanche_c/zeroex_avalanche_c_api_fills_deduped.sql b/models/zeroex/avalanche_c/zeroex_avalanche_c_api_fills_deduped.sql index 7ba2b3d5843..dc222702278 100644 --- a/models/zeroex/avalanche_c/zeroex_avalanche_c_api_fills_deduped.sql +++ b/models/zeroex/avalanche_c/zeroex_avalanche_c_api_fills_deduped.sql @@ -1,5 +1,5 @@ {{ config( - + schema = 'zeroex_avalanche_c', alias = 'api_fills_deduped', materialized='incremental', @@ -7,7 +7,8 @@ unique_key = ['block_date', 'tx_hash', 'evt_index'], on_schema_change='sync_all_columns', file_format ='delta', - incremental_strategy='merge' + incremental_strategy='merge', + incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.block_time')] ) }} @@ -22,7 +23,7 @@ AS WHERE 1=1 AND swap_flag = true {% if is_incremental() %} - AND block_time >= date_trunc('day', now() - interval '7' day) + AND {{ incremental_predicate('block_time') }} {% endif %} {% if not is_incremental() %} AND block_time >= TIMESTAMP '{{zeroex_v3_start_date}}' @@ -54,7 +55,7 @@ AS , MAX(CASE WHEN taker_consider_flag = 0 THEN NULL ELSE taker_token END ) AS taker_token , MAX(CASE WHEN maker_consider_flag = 0 THEN NULL ELSE maker_token END ) AS maker_token , MAX(CASE WHEN taker_consider_flag = 0 THEN NULL ELSE taker_symbol END ) AS taker_symbol - , MAX(CASE WHEN maker_consider_flag = 0 THEN NULL ELSE maker_symbol END ) AS maker_symbol + , MAX(CASE WHEN maker_consider_flag = 0 THEN NULL ELSE maker_symbol END ) AS maker_symbol , MAX(CASE WHEN taker_consider_flag = 0 THEN NULL ELSE taker_token_amount END) AS taker_token_amount , MAX(CASE WHEN maker_consider_flag = 0 THEN NULL ELSE maker_token_amount END) AS maker_token_amount , MAX(CASE WHEN taker_consider_flag = 0 THEN NULL ELSE taker_token_amount_raw END) AS taker_token_amount_raw @@ -66,7 +67,7 @@ AS SELECT a.blockchain , '0x API' as project , cast(null as varchar) as version - + , a.block_date , a.block_month , a.block_time @@ -91,7 +92,7 @@ SELECT a.blockchain , a.type , a.swap_flag , b.fills_within - , a.contract_address + , a.contract_address FROM fills_with_tx_fill_number a INNER JOIN deduped_bridge_fills b ON (a.tx_hash = b.tx_hash AND a.evt_index = b.evt_index) \ No newline at end of file diff --git a/models/zeroex/base/zeroex_base_api_fills.sql b/models/zeroex/base/zeroex_base_api_fills.sql index 0a8fb9dc55f..0d034d7d640 100644 --- a/models/zeroex/base/zeroex_base_api_fills.sql +++ b/models/zeroex/base/zeroex_base_api_fills.sql @@ -1,5 +1,5 @@ {{ config( - + schema = 'zeroex_base', alias = 'api_fills', materialized='incremental', @@ -8,23 +8,24 @@ on_schema_change='sync_all_columns', file_format ='delta', incremental_strategy='merge', + incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.block_time')], post_hook='{{ expose_spells(\'["base"]\', "project", "zeroex", \'["rantum"]\') }}' - + ) }} {% set zeroex_v3_start_date = '2019-12-01' %} {% set zeroex_v4_start_date = '2021-01-06' %} --- Test Query here: https://dune.com/queries/2755622 / https://dune.com/queries/2755822 +-- Test Query here: https://dune.com/queries/2755622 / https://dune.com/queries/2755822 WITH zeroex_tx AS ( SELECT tx_hash, max(affiliate_address) as affiliate_address, - is_gasless + is_gasless FROM ( SELECT tr.tx_hash, CASE @@ -39,11 +40,11 @@ WITH zeroex_tx AS ( FROM {{ source('base', 'traces') }} tr WHERE tr.to IN ( -- exchange contract - 0xdef1c0ded9bec7f1a1670819833240f027b25eff, + 0xdef1c0ded9bec7f1a1670819833240f027b25eff, -- forwarder addresses 0x6958f5e95332d93d21af0d7b9ca85b8212fee0a5, 0x4aa817c6f383c8e8ae77301d18ce48efb16fd2be, - 0x4ef40d1bf0983899892946830abf99eca2dbc5ce, + 0x4ef40d1bf0983899892946830abf99eca2dbc5ce, -- exchange proxy 0xdef189deaef76e379df891899eb5a00a94cbc250 ) @@ -51,20 +52,20 @@ WITH zeroex_tx AS ( bytearray_position(INPUT, 0x869584cd ) <> 0 OR bytearray_position(INPUT, 0xfbc019a7 ) <> 0 ) - + {% if is_incremental() %} - AND block_time >= date_trunc('day', now() - interval '7' day) + AND {{ incremental_predicate('block_time') }} {% endif %} {% if not is_incremental() %} AND block_time >= cast('{{zeroex_v3_start_date}}' as date) {% endif %} ) temp - group by tx_hash , is_gasless + group by tx_hash , is_gasless ), ERC20BridgeTransfer AS ( - SELECT + SELECT logs.tx_hash, logs.block_number AS block_number, INDEX AS evt_index, @@ -84,17 +85,17 @@ ERC20BridgeTransfer AS ( FROM {{ source('base', 'logs') }} logs INNER JOIN zeroex_tx ON zeroex_tx.tx_hash = logs.tx_hash WHERE topic0 = 0x349fc08071558d8e3aa92dec9396e4e9f2dfecd6bb9065759d1932e7da43b8a9 - + {% if is_incremental() %} - AND block_time >= date_trunc('day', now() - interval '7' day) + AND {{ incremental_predicate('block_time') }} {% endif %} {% if not is_incremental() %} AND block_time >= cast('{{zeroex_v3_start_date}}' as date) {% endif %} -), +), BridgeFill AS ( - SELECT + SELECT logs.tx_hash, logs.block_number AS block_number, INDEX AS evt_index, @@ -117,14 +118,14 @@ BridgeFill AS ( AND contract_address = 0xdb6f1920a889355780af7570773609bd8cb1f498 {% if is_incremental() %} - AND block_time >= date_trunc('day', now() - interval '7' day) + AND {{ incremental_predicate('block_time') }} {% endif %} {% if not is_incremental() %} AND block_time >= cast('{{zeroex_v4_start_date}}' as date) {% endif %} -), +), NewBridgeFill AS ( - SELECT + SELECT logs.tx_hash as tx_hash, logs.block_number AS block_number, INDEX AS evt_index, @@ -147,7 +148,7 @@ NewBridgeFill AS ( AND contract_address = 0xdb6f1920a889355780af7570773609bd8cb1f498 {% if is_incremental() %} - AND block_time >= date_trunc('day', now() - interval '7' day) + AND {{ incremental_predicate('block_time') }} {% endif %} {% if not is_incremental() %} AND block_time >= cast('{{zeroex_v4_start_date}}' as date) @@ -155,19 +156,19 @@ NewBridgeFill AS ( ), all_tx AS ( - + SELECT * FROM ERC20BridgeTransfer UNION ALL SELECT * FROM BridgeFill - UNION ALL + UNION ALL SELECT * - FROM NewBridgeFill - - + FROM NewBridgeFill + + ) -SELECT +SELECT all_tx.tx_hash, all_tx.block_number, all_tx.evt_index, @@ -177,8 +178,8 @@ SELECT cast(date_trunc('month', all_tx.block_time) AS date) AS block_month, maker, CASE - WHEN is_gasless = 1 then case when (varbinary_substring(data,177,19) ) = 0x00000000000000000000000000000000000000 then varbinary_substring(data,81,20) else (varbinary_substring(data,177,20) ) end - WHEN taker = 0xdef1c0ded9bec7f1a1670819833240f027b25eff THEN varbinary_substring(data,177,20) + WHEN is_gasless = 1 then case when (varbinary_substring(data,177,19) ) = 0x00000000000000000000000000000000000000 then varbinary_substring(data,81,20) else (varbinary_substring(data,177,20) ) end + WHEN taker = 0xdef1c0ded9bec7f1a1670819833240f027b25eff THEN varbinary_substring(data,177,20) ELSE taker END AS taker, -- fix the user masked by ProxyContract issue taker_token, @@ -207,7 +208,7 @@ FROM all_tx INNER JOIN {{ source('base', 'transactions')}} tx ON all_tx.tx_hash = tx.hash {% if is_incremental() %} -AND tx.block_time >= date_trunc('day', now() - interval '7' day) +AND {{ incremental_predicate('tx.block_time') }} {% endif %} {% if not is_incremental() %} AND tx.block_time >= cast('{{zeroex_v3_start_date}}' as date) @@ -221,7 +222,7 @@ AND CASE AND tp.blockchain = 'base' {% if is_incremental() %} -AND tp.minute >= date_trunc('day', now() - interval '7' day) +AND {{ incremental_predicate('tp.minute') }} {% endif %} {% if not is_incremental() %} AND tp.minute >= cast('{{zeroex_v3_start_date}}' as date) @@ -235,7 +236,7 @@ AND CASE AND mp.blockchain = 'base' {% if is_incremental() %} -AND mp.minute >= date_trunc('day', now() - interval '7' day) +AND {{ incremental_predicate('mp.minute') }} {% endif %} {% if not is_incremental() %} AND mp.minute >= cast('{{zeroex_v3_start_date}}' as date) diff --git a/models/zeroex/base/zeroex_base_api_fills_deduped.sql b/models/zeroex/base/zeroex_base_api_fills_deduped.sql index 62f49f3cb2e..5b8efdd8e51 100644 --- a/models/zeroex/base/zeroex_base_api_fills_deduped.sql +++ b/models/zeroex/base/zeroex_base_api_fills_deduped.sql @@ -1,5 +1,5 @@ {{ config( - + schema = 'zeroex_base', alias = 'api_fills_deduped', materialized='incremental', @@ -7,7 +7,8 @@ unique_key = ['block_date', 'tx_hash', 'evt_index'], on_schema_change='sync_all_columns', file_format ='delta', - incremental_strategy='merge' + incremental_strategy='merge', + incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.block_time')] ) }} @@ -20,13 +21,13 @@ AS , * FROM {{ ref('zeroex_base_api_fills') }} WHERE 1=1 - AND swap_flag = true + AND swap_flag = true {% if is_incremental() %} - AND block_time >= date_trunc('day', now() - interval '7' day) + AND {{ incremental_predicate('block_time') }} {% endif %} {% if not is_incremental() %} AND block_time >= cast('{{zeroex_v3_start_date}}' as date) - {% endif %} + {% endif %} ) , fills_first_last AS @@ -54,7 +55,7 @@ AS , MAX(CASE WHEN taker_consider_flag = 0 THEN NULL ELSE taker_token END ) AS taker_token , MAX(CASE WHEN maker_consider_flag = 0 THEN NULL ELSE maker_token END ) AS maker_token , MAX(CASE WHEN taker_consider_flag = 0 THEN NULL ELSE taker_symbol END ) AS taker_symbol - , MAX(CASE WHEN maker_consider_flag = 0 THEN NULL ELSE maker_symbol END ) AS maker_symbol + , MAX(CASE WHEN maker_consider_flag = 0 THEN NULL ELSE maker_symbol END ) AS maker_symbol , MAX(CASE WHEN taker_consider_flag = 0 THEN NULL ELSE taker_token_amount END) AS taker_token_amount , MAX(CASE WHEN maker_consider_flag = 0 THEN NULL ELSE maker_token_amount END) AS maker_token_amount , MAX(CASE WHEN taker_consider_flag = 0 THEN NULL ELSE taker_token_amount_raw END) AS taker_token_amount_raw @@ -66,7 +67,7 @@ AS SELECT a.blockchain , '0x API' as project , cast(null as varchar(10)) as version - + , a.block_date , a.block_month , a.block_time @@ -76,7 +77,7 @@ SELECT a.blockchain WHEN LOWER(b.taker_symbol) > LOWER(b.maker_symbol) THEN CONCAT(COALESCE(b.maker_symbol, ''), '-', COALESCE(b.taker_symbol, '')) ELSE CONCAT(COALESCE(b.taker_symbol, ''), '-', COALESCE(b.maker_symbol, '')) - END AS token_pair + END AS token_pair , b.taker_token_amount , b.maker_token_amount , b.taker_token_amount_raw AS taker_token_amount_raw @@ -95,7 +96,7 @@ SELECT a.blockchain , a.type , a.swap_flag , b.fills_within - , a.contract_address + , a.contract_address FROM fills_with_tx_fill_number a INNER JOIN deduped_bridge_fills b ON a.tx_hash = b.tx_hash AND a.evt_index = b.evt_index \ No newline at end of file diff --git a/models/zeroex/bnb/zeroex_bnb_api_fills.sql b/models/zeroex/bnb/zeroex_bnb_api_fills.sql index b77e9d36dae..f1300c783a9 100644 --- a/models/zeroex/bnb/zeroex_bnb_api_fills.sql +++ b/models/zeroex/bnb/zeroex_bnb_api_fills.sql @@ -1,12 +1,13 @@ {{ config( - + alias = 'api_fills', materialized='incremental', partition_by = ['block_month'], unique_key = ['block_date', 'tx_hash', 'evt_index'], on_schema_change='sync_all_columns', file_format ='delta', - incremental_strategy='merge' + incremental_strategy='merge', + incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.block_time')] ) }} @@ -36,7 +37,7 @@ WITH zeroex_tx AS ( ) ) {% if is_incremental() %} - AND evt_block_time >= date_trunc('day', now() - interval '7' day) + AND {{ incremental_predicate('evt_block_time') }} {% else %} AND evt_block_time >= TIMESTAMP '{{zeroex_v3_start_date}}' {% endif %} @@ -50,7 +51,7 @@ WITH zeroex_tx AS ( THEN SUBSTRING(INPUT FROM (bytearray_position(INPUT, 0x869584cd) + 16) FOR 20) WHEN bytearray_position(INPUT, 0xfbc019a7) <> 0 THEN SUBSTRING(INPUT FROM (bytearray_position(INPUT, 0xfbc019a7 ) + 16) FOR 20) - END AS affiliate_address + END AS affiliate_address FROM {{ source('bnb', 'traces') }} tr WHERE tr.to IN ( -- exchange contract @@ -67,7 +68,7 @@ WITH zeroex_tx AS ( OR bytearray_position(INPUT, 0xfbc019a7 ) <> 0 ) {% if is_incremental() %} - AND block_time >= date_trunc('day', now() - interval '7' day) + AND {{ incremental_predicate('block_time') }} {% else %} AND block_time >= TIMESTAMP '{{zeroex_v3_start_date}}' {% endif %} @@ -85,11 +86,11 @@ direct_sushiswap AS ( LAST_VALUE(swap.to) OVER (PARTITION BY swap.evt_tx_hash ORDER BY swap.evt_index) AS taker, CASE WHEN swap.amount0In > swap.amount0Out THEN pair.token0 ELSE pair.token1 END AS taker_token, CASE WHEN swap.amount0In > swap.amount0Out THEN pair.token1 ELSE pair.token0 END AS maker_token, - CASE WHEN swap.amount0In > swap.amount0Out THEN - CASE WHEN swap.amount0In >= swap.amount0Out THEN cast(swap.amount0In - swap.amount0Out as uint256) ELSE cast(0 as uint256) END ELSE + CASE WHEN swap.amount0In > swap.amount0Out THEN + CASE WHEN swap.amount0In >= swap.amount0Out THEN cast(swap.amount0In - swap.amount0Out as uint256) ELSE cast(0 as uint256) END ELSE CASE WHEN swap.amount1In >= swap.amount1Out THEN cast(swap.amount1In - swap.amount1Out as uint256) ELSE cast(0 as uint256) END END AS taker_token_amount_raw, - CASE WHEN swap.amount0In > swap.amount0Out THEN - CASE WHEN swap.amount1Out >= swap.amount1In THEN cast(swap.amount1Out - swap.amount1In as uint256) ELSE cast(0 as uint256) END ELSE + CASE WHEN swap.amount0In > swap.amount0Out THEN + CASE WHEN swap.amount1Out >= swap.amount1In THEN cast(swap.amount1Out - swap.amount1In as uint256) ELSE cast(0 as uint256) END ELSE CASE WHEN swap.amount0Out >= swap.amount0In THEN cast(swap.amount0Out - swap.amount0In as uint256) ELSE cast(0 as uint256) END END AS maker_token_amount_raw, 'Sushiswap Direct' AS type, @@ -102,7 +103,7 @@ direct_sushiswap AS ( WHERE sender = 0xdef1c0ded9bec7f1a1670819833240f027b25eff {% if is_incremental() %} - AND swap.evt_block_time >= date_trunc('day', now() - interval '7' day) + AND {{ incremental_predicate('swap.evt_block_time') }} {% endif %} {% if not is_incremental() %} AND swap.evt_block_time >= cast('{{zeroex_v3_start_date}}' as date) @@ -131,7 +132,7 @@ v2_fills_no_bridge AS ( OR fills.feeRecipientAddress = 0x86003b044f70dac0abc80ac8957305b6370893ed) {% if is_incremental() %} - AND evt_block_time >= date_trunc('day', now() - interval '7' day) + AND {{ incremental_predicate('evt_block_time') }} {% else %} AND evt_block_time >= TIMESTAMP '{{zeroex_v3_start_date}}' {% endif %} @@ -157,7 +158,7 @@ v4_rfq_fills_no_bridge AS ( JOIN zeroex_tx ON zeroex_tx.tx_hash = fills.evt_tx_hash {% if is_incremental() %} - WHERE evt_block_time >= date_trunc('day', now() - interval '7' day) + WHERE {{ incremental_predicate('evt_block_time') }} {% else %} WHERE evt_block_time >= TIMESTAMP '{{zeroex_v4_start_date}}' {% endif %} @@ -182,7 +183,7 @@ v4_limit_fills_no_bridge AS ( JOIN zeroex_tx ON zeroex_tx.tx_hash = fills.evt_tx_hash {% if is_incremental() %} - WHERE evt_block_time >= date_trunc('day', now() - interval '7' day) + WHERE {{ incremental_predicate('evt_block_time') }} {% else %} WHERE evt_block_time >= TIMESTAMP '{{zeroex_v4_start_date}}' {% endif %} @@ -207,7 +208,7 @@ otc_fills AS ( JOIN zeroex_tx ON zeroex_tx.tx_hash = fills.evt_tx_hash {% if is_incremental() %} - WHERE evt_block_time >= date_trunc('day', now() - interval '7' day) + WHERE {{ incremental_predicate('evt_block_time') }} {% else %} WHERE evt_block_time >= TIMESTAMP '{{zeroex_v4_start_date}}' {% endif %} @@ -215,7 +216,7 @@ otc_fills AS ( ), ERC20BridgeTransfer AS ( SELECT - logs.tx_hash as tx_hash, + logs.tx_hash as tx_hash, INDEX AS evt_index, logs.contract_address, block_time AS block_time, @@ -234,7 +235,7 @@ ERC20BridgeTransfer AS ( WHERE topic0 = 0x349fc08071558d8e3aa92dec9396e4e9f2dfecd6bb9065759d1932e7da43b8a9 {% if is_incremental() %} - AND block_time >= date_trunc('day', now() - interval '7' day) + AND {{ incremental_predicate('block_time') }} {% else %} AND block_time >= TIMESTAMP '{{zeroex_v3_start_date}}' {% endif %} @@ -262,7 +263,7 @@ BridgeFill AS ( AND contract_address = 0xdb6f1920a889355780af7570773609bd8cb1f498 {% if is_incremental() %} - AND block_time >= date_trunc('day', now() - interval '7' day) + AND {{ incremental_predicate('block_time') }} {% else %} AND block_time >= TIMESTAMP '{{zeroex_v4_start_date}}' {% endif %} @@ -289,7 +290,7 @@ NewBridgeFill AS ( WHERE topic0 = 0xe59e71a14fe90157eedc866c4f8c767d3943d6b6b2e8cd64dddcc92ab4c55af8 AND contract_address = 0xdb6f1920a889355780af7570773609bd8cb1f498 {% if is_incremental() %} - AND block_time >= date_trunc('day', now() - interval '7' day) + AND {{ incremental_predicate('block_time') }} {% else %} AND block_time >= TIMESTAMP '{{zeroex_v4_start_date}}' {% endif %} @@ -314,7 +315,7 @@ direct_PLP AS ( JOIN zeroex_tx ON zeroex_tx.tx_hash = plp.evt_tx_hash {% if is_incremental() %} - WHERE evt_block_time >= date_trunc('day', now() - interval '7' day) + WHERE {{ incremental_predicate('evt_block_time') }} {% else %} WHERE evt_block_time >= TIMESTAMP '{{zeroex_v3_start_date}}' {% endif %} @@ -335,36 +336,36 @@ uni_v2_swap as ( , TRUE AS swap_flag , FALSE AS matcha_limit_order_flag FROM {{ source('bnb', 'logs') }} s - JOIN zeroex_tx z on z.tx_hash = s.tx_hash + JOIN zeroex_tx z on z.tx_hash = s.tx_hash WHERE topic0 = 0xd78ad95fa46c994b6551d0da85fc275fe613ce37657fb8d5e3d130840159d822 -- all the uni v2 swap event and topic1 = 0x000000000000000000000000def1c0ded9bec7f1a1670819833240f027b25eff -- 0x EP {% if is_incremental() %} - AND block_time >= date_trunc('day', now() - interval '7' day) + AND {{ incremental_predicate('block_time') }} {% else %} AND block_time >= TIMESTAMP '{{zeroex_v4_start_date}}' {% endif %} - - -) + + +) , uni_v2_pair_creation as ( SELECT bytearray_substring(data,13,20) as pair, bytearray_substring(topic1, 13, 20) AS makerToken, bytearray_substring(topic2, 13, 20) AS takerToken, - row_number() over (partition by bytearray_substring(creation.data, 13, 20) order by block_time ) rn + row_number() over (partition by bytearray_substring(creation.data, 13, 20) order by block_time ) rn FROM {{ source('bnb', 'logs') }} creation WHERE creation.topic0 = 0x0d3648bd0f6ba80134a33ba9275ac585d9d315f0ad8355cddefde31afa28d0e9 -- all the uni v2 pair creation event - - - -) , + + + +) , direct_uniswapv2 as ( -select s.tx_hash, +select s.tx_hash, s.evt_index, s.contract_address, s.block_time, - maker, + maker, taker, takerToken taker_token, makerToken maker_token, @@ -375,16 +376,16 @@ select s.tx_hash, swap_flag, matcha_limit_order_flag -from uni_v2_swap s +from uni_v2_swap s -join uni_v2_pair_creation creation on s.contract_address = creation.pair +join uni_v2_pair_creation creation on s.contract_address = creation.pair where rn = 1 -), +), all_tx AS ( SELECT * FROM direct_uniswapv2 - /*union ALL SELECT * + /*union ALL SELECT * from direct_sushiswap */ UNION ALL SELECT * FROM direct_PLP @@ -444,7 +445,7 @@ SELECT distinct FROM all_tx INNER JOIN {{ source('bnb', 'transactions')}} tx ON all_tx.tx_hash = tx.hash {% if is_incremental() %} - AND tx.block_time >= date_trunc('day', now() - interval '7' day) + AND {{ incremental_predicate('tx.block_time') }} {% else %} AND tx.block_time >= TIMESTAMP '{{zeroex_v3_start_date}}' {% endif %} @@ -456,7 +457,7 @@ LEFT JOIN {{ source('prices', 'usd') }} tp ON date_trunc('minute', all_tx.block_ END = tp.contract_address AND tp.blockchain = 'bnb' {% if is_incremental() %} - AND tp.minute >= date_trunc('day', now() - interval '7' day) + AND {{ incremental_predicate('tp.minute') }} {% else %} AND tp.minute >= TIMESTAMP '{{zeroex_v3_start_date}}' {% endif %} @@ -468,7 +469,7 @@ LEFT JOIN {{ source('prices', 'usd') }} mp ON DATE_TRUNC('minute', all_tx.block_ END = mp.contract_address AND mp.blockchain = 'bnb' {% if is_incremental() %} - AND mp.minute >= date_trunc('day', now() - interval '7' day) + AND {{ incremental_predicate('mp.minute') }} {% else %} AND mp.minute >= TIMESTAMP '{{zeroex_v3_start_date}}' {% endif %} @@ -478,8 +479,8 @@ LEFT OUTER JOIN {{ source('tokens', 'erc20') }} ts ON ts.contract_address = cas ELSE all_tx.taker_token end AND ts.blockchain = 'bnb' LEFT OUTER JOIN {{ source('tokens', 'erc20') }} ms ON ms.contract_address = - case + case WHEN all_tx.maker_token = 0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee THEN 0xbb4cdb9cbd36b01bd1cbaebf2de08d9173bc095c WHEN all_tx.maker_token = 0x0000000000000000000000000000000000000000 THEN 0x55d398326f99059ff775485246999027b3197955 - ELSE all_tx.maker_token end + ELSE all_tx.maker_token end AND ms.blockchain = 'bnb' \ No newline at end of file diff --git a/models/zeroex/bnb/zeroex_bnb_api_fills_deduped.sql b/models/zeroex/bnb/zeroex_bnb_api_fills_deduped.sql index 68cbd53230b..f669c048297 100644 --- a/models/zeroex/bnb/zeroex_bnb_api_fills_deduped.sql +++ b/models/zeroex/bnb/zeroex_bnb_api_fills_deduped.sql @@ -1,13 +1,14 @@ {{ config( - + alias = 'api_fills_deduped', materialized='incremental', partition_by = ['block_month'], unique_key = ['block_date', 'tx_hash', 'evt_index'], on_schema_change='sync_all_columns', file_format ='delta', - incremental_strategy='merge' - ) + incremental_strategy='merge', + incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.block_time')] + ) }} {% set zeroex_v3_start_date = '2019-12-01' %} @@ -21,7 +22,7 @@ AS WHERE 1=1 AND swap_flag = true {% if is_incremental() %} - AND block_time >= date_trunc('day', now() - interval '7' day) + AND {{ incremental_predicate('block_time') }} {% endif %} {% if not is_incremental() %} AND block_time >= TIMESTAMP '{{zeroex_v3_start_date}}' @@ -53,7 +54,7 @@ AS , MAX(CASE WHEN taker_consider_flag = 0 THEN NULL ELSE taker_token END ) AS taker_token , MAX(CASE WHEN maker_consider_flag = 0 THEN NULL ELSE maker_token END ) AS maker_token , MAX(CASE WHEN taker_consider_flag = 0 THEN NULL ELSE taker_symbol END ) AS taker_symbol - , MAX(CASE WHEN maker_consider_flag = 0 THEN NULL ELSE maker_symbol END ) AS maker_symbol + , MAX(CASE WHEN maker_consider_flag = 0 THEN NULL ELSE maker_symbol END ) AS maker_symbol , MAX(CASE WHEN taker_consider_flag = 0 THEN NULL ELSE taker_token_amount END) AS taker_token_amount , MAX(CASE WHEN maker_consider_flag = 0 THEN NULL ELSE maker_token_amount END) AS maker_token_amount , MAX(CASE WHEN taker_consider_flag = 0 THEN NULL ELSE taker_token_amount_raw END) AS taker_token_amount_raw @@ -89,7 +90,7 @@ SELECT a.blockchain , a.type , a.swap_flag , b.fills_within - , a.contract_address + , a.contract_address FROM fills_with_tx_fill_number a INNER JOIN deduped_bridge_fills b ON (a.tx_hash = b.tx_hash AND a.evt_index = b.evt_index) \ No newline at end of file diff --git a/models/zeroex/bnb/zeroex_bnb_native_fills.sql b/models/zeroex/bnb/zeroex_bnb_native_fills.sql index 1b8b7cc6fbd..4af8d4e490f 100644 --- a/models/zeroex/bnb/zeroex_bnb_native_fills.sql +++ b/models/zeroex/bnb/zeroex_bnb_native_fills.sql @@ -5,16 +5,17 @@ unique_key = ['block_date', 'tx_hash', 'evt_index'], on_schema_change='sync_all_columns', file_format ='delta', - incremental_strategy='merge' + incremental_strategy='merge', + incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.block_time')] ) }} {% set zeroex_v3_start_date = '2019-12-01' %} {% set zeroex_v4_start_date = '2021-01-06' %} --- Test Query here: -WITH - +-- Test Query here: +WITH + v4_limit_fills AS ( SELECT @@ -28,15 +29,15 @@ WITH , fills.makerToken AS maker_token , fills.takerTokenFilledAmount as taker_token_filled_amount_raw , fills.makerTokenFilledAmount as maker_token_filled_amount_raw - , fills.contract_address + , fills.contract_address , mt.symbol AS maker_symbol , CASE WHEN lower(tt.symbol) > lower(mt.symbol) THEN concat(mt.symbol, '-', tt.symbol) ELSE concat(tt.symbol, '-', mt.symbol) END AS token_pair , fills.makerTokenFilledAmount / pow(10, mt.decimals) AS maker_asset_filled_amount , fills.takerToken AS taker_token , tt.symbol AS taker_symbol , fills.takerTokenFilledAmount / pow(10, tt.decimals) AS taker_asset_filled_amount - , (fills.feeRecipient in - (0x9b858be6e3047d88820f439b240deac2418a2551,0x86003b044f70dac0abc80ac8957305b6370893ed,0x5bc2419a087666148bfbe1361ae6c06d240c6131)) + , (fills.feeRecipient in + (0x9b858be6e3047d88820f439b240deac2418a2551,0x86003b044f70dac0abc80ac8957305b6370893ed,0x5bc2419a087666148bfbe1361ae6c06d240c6131)) AS matcha_limit_order_flag , COALESCE((fills.makerTokenFilledAmount / pow(10, mt.decimals))*mp.price,(fills.takerTokenFilledAmount / pow(10, tt.decimals))*tp.price) AS volume_usd , fills.protocolFeePaid/ 1e18 AS protocol_fee_paid_eth @@ -48,7 +49,7 @@ WITH WHEN fills.takerToken = 0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee THEN 0xbb4cdb9cbd36b01bd1cbaebf2de08d9173bc095c ELSE fills.takerToken END = tp.contract_address - LEFT JOIN {{ source('prices', 'usd') }} mp ON + LEFT JOIN {{ source('prices', 'usd') }} mp ON DATE_TRUNC('minute', evt_block_time) = mp.minute and mp.blockchain = 'bnb' AND CASE -- set native token to wrapped version @@ -57,9 +58,9 @@ WITH END = mp.contract_address LEFT OUTER JOIN {{ source('tokens', 'erc20') }} mt ON mt.contract_address = fills.makerToken and mt.blockchain = 'bnb' LEFT OUTER JOIN {{ source('tokens', 'erc20') }} tt ON tt.contract_address = fills.takerToken and tt.blockchain = 'bnb' - where 1=1 + where 1=1 {% if is_incremental() %} - AND evt_block_time >= date_trunc('day', now() - interval '7' day) + AND {{ incremental_predicate('evt_block_time') }} {% endif %} {% if not is_incremental() %} AND evt_block_time >= TIMESTAMP '{{zeroex_v3_start_date}}' @@ -78,7 +79,7 @@ WITH , fills.makerToken AS maker_token , fills.takerTokenFilledAmount as taker_token_filled_amount_raw , fills.makerTokenFilledAmount as maker_token_filled_amount_raw - , fills.contract_address + , fills.contract_address , mt.symbol AS maker_symbol , CASE WHEN lower(tt.symbol) > lower(mt.symbol) THEN concat(mt.symbol, '-', tt.symbol) ELSE concat(tt.symbol, '-', mt.symbol) END AS token_pair , fills.makerTokenFilledAmount / pow(10, mt.decimals) AS maker_asset_filled_amount @@ -96,7 +97,7 @@ WITH WHEN fills.takerToken = 0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee THEN 0xbb4cdb9cbd36b01bd1cbaebf2de08d9173bc095c ELSE fills.takerToken END = tp.contract_address - LEFT JOIN {{ source('prices', 'usd') }} mp ON + LEFT JOIN {{ source('prices', 'usd') }} mp ON DATE_TRUNC('minute', evt_block_time) = mp.minute and mp.blockchain = 'bnb' AND CASE -- set native token to wrapped version @@ -105,14 +106,14 @@ WITH END = mp.contract_address LEFT OUTER JOIN {{ source('tokens', 'erc20') }} mt ON mt.contract_address = fills.makerToken and mt.blockchain = 'bnb' LEFT OUTER JOIN {{ source('tokens', 'erc20') }} tt ON tt.contract_address = fills.takerToken and tt.blockchain = 'bnb' - where 1=1 + where 1=1 {% if is_incremental() %} - AND evt_block_time >= date_trunc('day', now() - interval '7' day) + AND {{ incremental_predicate('evt_block_time') }} {% endif %} {% if not is_incremental() %} AND evt_block_time >= TIMESTAMP '{{zeroex_v3_start_date}}' {% endif %} - + ), otc_fills as ( SELECT @@ -126,7 +127,7 @@ WITH , fills.makerToken AS maker_token , fills.takerTokenFilledAmount as taker_token_filled_amount_raw , fills.makerTokenFilledAmount as maker_token_filled_amount_raw - , fills.contract_address + , fills.contract_address , mt.symbol AS maker_symbol , CASE WHEN lower(tt.symbol) > lower(mt.symbol) THEN concat(mt.symbol, '-', tt.symbol) ELSE concat(tt.symbol, '-', mt.symbol) END AS token_pair , fills.makerTokenFilledAmount / pow(10, mt.decimals) AS maker_asset_filled_amount @@ -144,7 +145,7 @@ WITH WHEN fills.takerToken = 0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee THEN 0xbb4cdb9cbd36b01bd1cbaebf2de08d9173bc095c ELSE fills.takerToken END = tp.contract_address - LEFT JOIN {{ source('prices', 'usd') }} mp ON + LEFT JOIN {{ source('prices', 'usd') }} mp ON DATE_TRUNC('minute', evt_block_time) = mp.minute and mp.blockchain = 'bnb' AND CASE -- set native token to wrapped version @@ -153,9 +154,9 @@ WITH END = mp.contract_address LEFT OUTER JOIN {{ source('tokens', 'erc20') }} mt ON mt.contract_address = fills.makerToken and mt.blockchain = 'bnb' LEFT OUTER JOIN {{ source('tokens', 'erc20') }} tt ON tt.contract_address = fills.takerToken and tt.blockchain = 'bnb' - where 1=1 + where 1=1 {% if is_incremental() %} - AND evt_block_time >= date_trunc('day', now() - interval '7' day) + AND {{ incremental_predicate('evt_block_time') }} {% endif %} {% if not is_incremental() %} AND evt_block_time >= TIMESTAMP '{{zeroex_v3_start_date}}' @@ -164,8 +165,8 @@ WITH ), all_fills as ( - - + + SELECT * FROM v4_limit_fills @@ -174,11 +175,11 @@ WITH SELECT * FROM v4_rfq_fills UNION ALL - + SELECT * FROM otc_fills ) - SELECT distinct - all_fills.block_time AS block_time, + SELECT distinct + all_fills.block_time AS block_time, all_fills.block_number as block_number, protocol_version as version, date_trunc('day', all_fills.block_time) as block_date, @@ -208,9 +209,8 @@ WITH INNER JOIN {{ source('bnb', 'transactions')}} tx ON all_fills.transaction_hash = tx.hash AND all_fills.block_number = tx.block_number {% if is_incremental() %} - AND tx.block_time >= date_trunc('day', now() - interval '7' day) + AND {{ incremental_predicate('tx.block_time') }} {% endif %} {% if not is_incremental() %} AND tx.block_time >= TIMESTAMP '{{zeroex_v3_start_date}}' {% endif %} - \ No newline at end of file diff --git a/models/zeroex/celo/zeroex_celo_api_fills.sql b/models/zeroex/celo/zeroex_celo_api_fills.sql index 862f668f7c5..fe4aaaa147c 100644 --- a/models/zeroex/celo/zeroex_celo_api_fills.sql +++ b/models/zeroex/celo/zeroex_celo_api_fills.sql @@ -1,5 +1,5 @@ {{ config( - + schema = 'zeroex_celo', alias = 'api_fills', materialized='incremental', @@ -8,18 +8,19 @@ on_schema_change='sync_all_columns', file_format ='delta', incremental_strategy='merge', + incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.block_time')], post_hook='{{ expose_spells(\'["celo"]\', "project", "zeroex", \'["rantum"]\') }}' - + ) }} {% set zeroex_v3_start_date = '2019-12-01' %} {% set zeroex_v4_start_date = '2021-01-06' %} --- Test Query here: https://dune.com/queries/2755622 / https://dune.com/queries/2755822 +-- Test Query here: https://dune.com/queries/2755622 / https://dune.com/queries/2755822 WITH zeroex_tx AS ( SELECT tx_hash, @@ -37,11 +38,11 @@ WITH zeroex_tx AS ( FROM {{ source('celo', 'traces') }} tr WHERE tr.to IN ( -- exchange contract - 0x61935cbdd02287b511119ddb11aeb42f1593b7ef, + 0x61935cbdd02287b511119ddb11aeb42f1593b7ef, -- forwarder addresses 0x6958f5e95332d93d21af0d7b9ca85b8212fee0a5, 0x4aa817c6f383c8e8ae77301d18ce48efb16fd2be, - 0x4ef40d1bf0983899892946830abf99eca2dbc5ce, + 0x4ef40d1bf0983899892946830abf99eca2dbc5ce, -- exchange proxy 0xdef1c0ded9bec7f1a1670819833240f027b25eff ) @@ -49,9 +50,9 @@ WITH zeroex_tx AS ( bytearray_position(INPUT, 0x869584cd ) <> 0 OR bytearray_position(INPUT, 0xfbc019a7 ) <> 0 ) - + {% if is_incremental() %} - AND block_time >= date_trunc('day', now() - interval '7' day) + AND {{ incremental_predicate('block_time') }} {% endif %} {% if not is_incremental() %} AND block_time >= cast('{{zeroex_v3_start_date}}' as date) @@ -62,7 +63,7 @@ WITH zeroex_tx AS ( ), ERC20BridgeTransfer AS ( - SELECT + SELECT logs.tx_hash, logs.block_number AS block_number, INDEX AS evt_index, @@ -81,17 +82,17 @@ ERC20BridgeTransfer AS ( FROM {{ source('celo', 'logs') }} logs INNER JOIN zeroex_tx ON zeroex_tx.tx_hash = logs.tx_hash WHERE topic0 = 0x349fc08071558d8e3aa92dec9396e4e9f2dfecd6bb9065759d1932e7da43b8a9 - + {% if is_incremental() %} - AND block_time >= date_trunc('day', now() - interval '7' day) + AND {{ incremental_predicate('block_time') }} {% endif %} {% if not is_incremental() %} AND block_time >= cast('{{zeroex_v3_start_date}}' as date) {% endif %} -), +), BridgeFill AS ( - SELECT + SELECT logs.tx_hash, logs.block_number AS block_number, INDEX AS evt_index, @@ -113,14 +114,14 @@ BridgeFill AS ( AND contract_address = 0xdb6f1920a889355780af7570773609bd8cb1f498 {% if is_incremental() %} - AND block_time >= date_trunc('day', now() - interval '7' day) + AND {{ incremental_predicate('block_time') }} {% endif %} {% if not is_incremental() %} AND block_time >= cast('{{zeroex_v4_start_date}}' as date) {% endif %} -), +), NewBridgeFill AS ( - SELECT + SELECT logs.tx_hash as tx_hash, logs.block_number AS block_number, INDEX AS evt_index, @@ -142,7 +143,7 @@ NewBridgeFill AS ( AND contract_address = 0xdb6f1920a889355780af7570773609bd8cb1f498 {% if is_incremental() %} - AND block_time >= date_trunc('day', now() - interval '7' day) + AND {{ incremental_predicate('block_time') }} {% endif %} {% if not is_incremental() %} AND block_time >= cast('{{zeroex_v4_start_date}}' as date) @@ -150,19 +151,19 @@ NewBridgeFill AS ( ), all_tx AS ( - + SELECT * FROM ERC20BridgeTransfer UNION ALL SELECT * FROM BridgeFill - UNION ALL + UNION ALL SELECT * - FROM NewBridgeFill - - + FROM NewBridgeFill + + ) -SELECT +SELECT all_tx.tx_hash, all_tx.block_number, all_tx.evt_index, @@ -190,7 +191,7 @@ SELECT matcha_limit_order_flag, CASE WHEN maker_token IN (0x04068da6c83afcfa0e13ba15a6696662335d5b75,0x21be370d5312f44cb42ce377bc9b8a0cef1a4c83,0x74b23882a30290451a17c44f4f05243b6b58c76d,0x049d68029688eabf473097a2fc38ef61633a3c7a,0x82f0b8b456c1a451378467398982d4834b6829c1, 0x321162cd933e2be498cd2267a90534a804051b11) THEN (all_tx.maker_token_amount_raw / pow(10, mp.decimals)) * mp.price - WHEN taker_token IN (0x04068da6c83afcfa0e13ba15a6696662335d5b75,0x21be370d5312f44cb42ce377bc9b8a0cef1a4c83,0x74b23882a30290451a17c44f4f05243b6b58c76d,0x049d68029688eabf473097a2fc38ef61633a3c7a,0x82f0b8b456c1a451378467398982d4834b6829c1, 0x321162cd933e2be498cd2267a90534a804051b11) + WHEN taker_token IN (0x04068da6c83afcfa0e13ba15a6696662335d5b75,0x21be370d5312f44cb42ce377bc9b8a0cef1a4c83,0x74b23882a30290451a17c44f4f05243b6b58c76d,0x049d68029688eabf473097a2fc38ef61633a3c7a,0x82f0b8b456c1a451378467398982d4834b6829c1, 0x321162cd933e2be498cd2267a90534a804051b11) THEN (all_tx.taker_token_amount_raw / pow(10, tp.decimals)) * tp.price ELSE COALESCE((all_tx.maker_token_amount_raw / pow(10, mp.decimals)) * mp.price, (all_tx.taker_token_amount_raw / pow(10, tp.decimals)) * tp.price) END AS volume_usd, @@ -201,7 +202,7 @@ FROM all_tx INNER JOIN {{ source('celo', 'transactions')}} tx ON all_tx.tx_hash = tx.hash {% if is_incremental() %} -AND tx.block_time >= date_trunc('day', now() - interval '7' day) +AND {{ incremental_predicate('tx.block_time') }} {% endif %} {% if not is_incremental() %} AND tx.block_time >= cast('{{zeroex_v3_start_date}}' as date) @@ -215,7 +216,7 @@ AND CASE AND tp.blockchain = 'celo' {% if is_incremental() %} -AND tp.minute >= date_trunc('day', now() - interval '7' day) +AND {{ incremental_predicate('tp.minute') }} {% endif %} {% if not is_incremental() %} AND tp.minute >= cast('{{zeroex_v3_start_date}}' as date) @@ -229,7 +230,7 @@ AND CASE AND mp.blockchain = 'celo' {% if is_incremental() %} -AND mp.minute >= date_trunc('day', now() - interval '7' day) +AND {{ incremental_predicate('mp.minute') }} {% endif %} {% if not is_incremental() %} AND mp.minute >= cast('{{zeroex_v3_start_date}}' as date) diff --git a/models/zeroex/celo/zeroex_celo_api_fills_deduped.sql b/models/zeroex/celo/zeroex_celo_api_fills_deduped.sql index 4c8217ea8e2..ad010ef0185 100644 --- a/models/zeroex/celo/zeroex_celo_api_fills_deduped.sql +++ b/models/zeroex/celo/zeroex_celo_api_fills_deduped.sql @@ -1,5 +1,5 @@ {{ config( - + schema = 'zeroex_celo', alias = 'api_fills_deduped', materialized='incremental', @@ -7,7 +7,8 @@ unique_key = ['block_date', 'tx_hash', 'evt_index'], on_schema_change='sync_all_columns', file_format ='delta', - incremental_strategy='merge' + incremental_strategy='merge', + incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.block_time')] ) }} @@ -20,13 +21,13 @@ AS , * FROM {{ ref('zeroex_celo_api_fills') }} WHERE 1=1 - AND swap_flag = true + AND swap_flag = true {% if is_incremental() %} - AND block_time >= date_trunc('day', now() - interval '7' day) + AND {{ incremental_predicate('block_time') }} {% endif %} {% if not is_incremental() %} - AND block_time >= cast('{{zeroex_v3_start_date}}' as date) - {% endif %} + AND block_time >= cast('{{zeroex_v3_start_date}}' as date) + {% endif %} ) , fills_first_last AS @@ -54,7 +55,7 @@ AS , MAX(CASE WHEN taker_consider_flag = 0 THEN NULL ELSE taker_token END ) AS taker_token , MAX(CASE WHEN maker_consider_flag = 0 THEN NULL ELSE maker_token END ) AS maker_token , MAX(CASE WHEN taker_consider_flag = 0 THEN NULL ELSE taker_symbol END ) AS taker_symbol - , MAX(CASE WHEN maker_consider_flag = 0 THEN NULL ELSE maker_symbol END ) AS maker_symbol + , MAX(CASE WHEN maker_consider_flag = 0 THEN NULL ELSE maker_symbol END ) AS maker_symbol , MAX(CASE WHEN taker_consider_flag = 0 THEN NULL ELSE taker_token_amount END) AS taker_token_amount , MAX(CASE WHEN maker_consider_flag = 0 THEN NULL ELSE maker_token_amount END) AS maker_token_amount , MAX(CASE WHEN taker_consider_flag = 0 THEN NULL ELSE taker_token_amount_raw END) AS taker_token_amount_raw @@ -67,7 +68,7 @@ SELECT a.blockchain , '0x API' as project , cast(null as varchar(10)) as version , a.block_date - , CAST(date_trunc('month', a.block_time) as DATE) as block_month + , CAST(date_trunc('month', a.block_time) as DATE) as block_month , a.block_time , b.taker_symbol AS taker_symbol , b.maker_symbol AS maker_symbol @@ -75,7 +76,7 @@ SELECT a.blockchain WHEN LOWER(b.taker_symbol) > LOWER(b.maker_symbol) THEN CONCAT(COALESCE(b.maker_symbol, ''), '-', COALESCE(b.taker_symbol, '')) ELSE CONCAT(COALESCE(b.taker_symbol, ''), '-', COALESCE(b.maker_symbol, '')) - END AS token_pair + END AS token_pair , b.taker_token_amount , b.maker_token_amount , b.taker_token_amount_raw AS taker_token_amount_raw @@ -94,7 +95,7 @@ SELECT a.blockchain , a.type , a.swap_flag , b.fills_within - , a.contract_address + , a.contract_address FROM fills_with_tx_fill_number a INNER JOIN deduped_bridge_fills b ON a.tx_hash = b.tx_hash AND a.evt_index = b.evt_index \ No newline at end of file diff --git a/models/zeroex/ethereum/zeroex_ethereum_api_fills.sql b/models/zeroex/ethereum/zeroex_ethereum_api_fills.sql index c63976ee739..99ac30ff8a8 100644 --- a/models/zeroex/ethereum/zeroex_ethereum_api_fills.sql +++ b/models/zeroex/ethereum/zeroex_ethereum_api_fills.sql @@ -1,12 +1,12 @@ {{ config( - + alias = 'api_fills', materialized='incremental', partition_by = ['block_month'], unique_key = ['block_date', 'tx_hash', 'evt_index'], on_schema_change='sync_all_columns', file_format ='delta', - incremental_strategy='merge' + incremental_strategy='merge' ) }} @@ -35,11 +35,11 @@ WITH zeroex_tx AS ( ) {% if is_incremental() %} - AND evt_block_time >= date_trunc('day', now() - interval '7' day) + AND {{ incremental_predicate('evt_block_time') }} {% endif %} {% if not is_incremental() %} AND evt_block_time >= cast('{{zeroex_v3_start_date}}' as date) - {% endif %} + {% endif %} UNION ALL SELECT tr.tx_hash, @@ -68,7 +68,7 @@ WITH zeroex_tx AS ( ) {% if is_incremental() %} - AND block_time >= date_trunc('day', now() - interval '7' day) + AND {{ incremental_predicate('block_time') }} {% endif %} {% if not is_incremental() %} AND block_time >= cast('{{zeroex_v3_start_date}}' as date) @@ -100,7 +100,7 @@ v3_fills_no_bridge AS ( OR fills.feeRecipientAddress = 0x86003b044f70dac0abc80ac8957305b6370893ed) {% if is_incremental() %} - AND evt_block_time >= date_trunc('day', now() - interval '7' day) + AND {{ incremental_predicate('evt_block_time') }} {% endif %} {% if not is_incremental() %} AND evt_block_time >= cast('{{zeroex_v3_start_date}}' as date) @@ -127,7 +127,7 @@ v4_rfq_fills_no_bridge AS ( LEFT JOIN zeroex_tx ON zeroex_tx.tx_hash = fills.evt_tx_hash {% if is_incremental() %} - WHERE evt_block_time >= date_trunc('day', now() - interval '7' day) + WHERE {{ incremental_predicate('evt_block_time') }} {% endif %} {% if not is_incremental() %} WHERE evt_block_time >= cast('{{zeroex_v4_start_date}}' as date) @@ -148,14 +148,14 @@ v4_limit_fills_no_bridge AS ( 'LimitOrderFilled' AS type, COALESCE(zeroex_tx.affiliate_address, fills.feeRecipient) AS affiliate_address, (zeroex_tx.tx_hash IS NOT NULL) AS swap_flag, - (fills.feeRecipient in - (0x9b858be6e3047d88820f439b240deac2418a2551,0x86003b044f70dac0abc80ac8957305b6370893ed,0x5bc2419a087666148bfbe1361ae6c06d240c6131)) + (fills.feeRecipient in + (0x9b858be6e3047d88820f439b240deac2418a2551,0x86003b044f70dac0abc80ac8957305b6370893ed,0x5bc2419a087666148bfbe1361ae6c06d240c6131)) AS matcha_limit_order_flag FROM {{ source('zeroex_ethereum', 'ExchangeProxy_evt_LimitOrderFilled') }} fills LEFT JOIN zeroex_tx ON zeroex_tx.tx_hash = fills.evt_tx_hash {% if is_incremental() %} - WHERE evt_block_time >= date_trunc('day', now() - interval '7' day) + WHERE {{ incremental_predicate('evt_block_time') }} {% endif %} {% if not is_incremental() %} WHERE evt_block_time >= cast('{{zeroex_v4_start_date}}' as date) @@ -181,7 +181,7 @@ otc_fills AS ( LEFT JOIN zeroex_tx ON zeroex_tx.tx_hash = fills.evt_tx_hash {% if is_incremental() %} - WHERE evt_block_time >= date_trunc('day', now() - interval '7' day) + WHERE {{ incremental_predicate('evt_block_time') }} {% endif %} {% if not is_incremental() %} WHERE evt_block_time >= cast('{{zeroex_v4_start_date}}' as date) @@ -209,7 +209,7 @@ ERC20BridgeTransfer AS ( WHERE topic0 = 0x349fc08071558d8e3aa92dec9396e4e9f2dfecd6bb9065759d1932e7da43b8a9 {% if is_incremental() %} - AND block_time >= date_trunc('day', now() - interval '7' day) + AND {{ incremental_predicate('block_time') }} {% endif %} {% if not is_incremental() %} AND block_time >= cast('{{zeroex_v3_start_date}}' as date) @@ -238,7 +238,7 @@ BridgeFill AS ( AND contract_address = 0x22f9dcf4647084d6c31b2765f6910cd85c178c18 {% if is_incremental() %} - AND block_time >= date_trunc('day', now() - interval '7' day) + AND {{ incremental_predicate('block_time') }} {% endif %} {% if not is_incremental() %} AND block_time >= cast('{{zeroex_v4_start_date}}' as date) @@ -266,7 +266,7 @@ NewBridgeFill AS ( AND contract_address = 0x22f9dcf4647084d6c31b2765f6910cd85c178c18 {% if is_incremental() %} - AND block_time >= date_trunc('day', now() - interval '7' day) + AND {{ incremental_predicate('block_time') }} {% endif %} {% if not is_incremental() %} AND block_time >= cast('{{zeroex_v4_start_date}}' as date) @@ -292,7 +292,7 @@ direct_PLP AS ( JOIN zeroex_tx ON zeroex_tx.tx_hash = plp.evt_tx_hash {% if is_incremental() %} - WHERE evt_block_time >= date_trunc('day', now() - interval '7' day) + WHERE {{ incremental_predicate('evt_block_time') }} {% endif %} {% if not is_incremental() %} WHERE evt_block_time >= cast('{{zeroex_v3_start_date}}' as date) @@ -309,11 +309,11 @@ direct_uniswapv2 AS ( LAST_VALUE(swap.to) OVER ( PARTITION BY swap.evt_tx_hash ORDER BY swap.evt_index) AS taker, CASE WHEN swap.amount0In > swap.amount0Out THEN pair.token0 ELSE pair.token1 END AS taker_token, CASE WHEN swap.amount0In > swap.amount0Out THEN pair.token1 ELSE pair.token0 END AS maker_token, - CASE WHEN swap.amount0In > swap.amount0Out THEN - CASE WHEN swap.amount0In >= swap.amount0Out THEN cast(swap.amount0In - swap.amount0Out as int256) ELSE cast(0 as int256) END ELSE + CASE WHEN swap.amount0In > swap.amount0Out THEN + CASE WHEN swap.amount0In >= swap.amount0Out THEN cast(swap.amount0In - swap.amount0Out as int256) ELSE cast(0 as int256) END ELSE CASE WHEN swap.amount1In >= swap.amount1Out THEN cast(swap.amount1In - swap.amount1Out as int256) ELSE cast(0 as int256) END END AS taker_token_amount_raw, - CASE WHEN swap.amount0In > swap.amount0Out THEN - CASE WHEN swap.amount1Out >= swap.amount1In THEN cast(swap.amount1Out - swap.amount1In as int256) ELSE cast(0 as int256) END ELSE + CASE WHEN swap.amount0In > swap.amount0Out THEN + CASE WHEN swap.amount1Out >= swap.amount1In THEN cast(swap.amount1Out - swap.amount1In as int256) ELSE cast(0 as int256) END ELSE CASE WHEN swap.amount0Out >= swap.amount0In THEN cast(swap.amount0Out - swap.amount0In as int256) ELSE cast(0 as int256) END END AS maker_token_amount_raw, 'Uniswap V2 Direct' AS type, zeroex_tx.affiliate_address AS affiliate_address, @@ -325,7 +325,7 @@ direct_uniswapv2 AS ( WHERE sender = 0xdef1c0ded9bec7f1a1670819833240f027b25eff {% if is_incremental() %} - AND swap.evt_block_time >= date_trunc('day', now() - interval '7' day) + AND {{ incremental_predicate('swap.evt_block_time') }} {% endif %} {% if not is_incremental() %} AND swap.evt_block_time >= cast('{{zeroex_v3_start_date}}' as date) @@ -342,11 +342,11 @@ direct_sushiswap AS ( LAST_VALUE(swap.to) OVER (PARTITION BY swap.evt_tx_hash ORDER BY swap.evt_index) AS taker, CASE WHEN swap.amount0In > swap.amount0Out THEN pair.token0 ELSE pair.token1 END AS taker_token, CASE WHEN swap.amount0In > swap.amount0Out THEN pair.token1 ELSE pair.token0 END AS maker_token, - CASE WHEN swap.amount0In > swap.amount0Out THEN - CASE WHEN swap.amount0In >= swap.amount0Out THEN cast(swap.amount0In - swap.amount0Out as int256) ELSE cast(0 as int256) END ELSE + CASE WHEN swap.amount0In > swap.amount0Out THEN + CASE WHEN swap.amount0In >= swap.amount0Out THEN cast(swap.amount0In - swap.amount0Out as int256) ELSE cast(0 as int256) END ELSE CASE WHEN swap.amount1In >= swap.amount1Out THEN cast(swap.amount1In - swap.amount1Out as int256) ELSE cast(0 as int256) END END AS taker_token_amount_raw, - CASE WHEN swap.amount0In > swap.amount0Out THEN - CASE WHEN swap.amount1Out >= swap.amount1In THEN cast(swap.amount1Out - swap.amount1In as int256) ELSE cast(0 as int256) END ELSE + CASE WHEN swap.amount0In > swap.amount0Out THEN + CASE WHEN swap.amount1Out >= swap.amount1In THEN cast(swap.amount1Out - swap.amount1In as int256) ELSE cast(0 as int256) END ELSE CASE WHEN swap.amount0Out >= swap.amount0In THEN cast(swap.amount0Out - swap.amount0In as int256) ELSE cast(0 as int256) END END AS maker_token_amount_raw, 'Sushiswap Direct' AS type, @@ -359,7 +359,7 @@ direct_sushiswap AS ( WHERE sender = 0xdef1c0ded9bec7f1a1670819833240f027b25eff {% if is_incremental() %} - AND swap.evt_block_time >= date_trunc('day', now() - interval '7' day) + AND {{ incremental_predicate('swap.evt_block_time') }} {% endif %} {% if not is_incremental() %} AND swap.evt_block_time >= cast('{{zeroex_v3_start_date}}' as date) @@ -387,7 +387,7 @@ direct_uniswapv3 AS ( WHERE sender = 0xdef1c0ded9bec7f1a1670819833240f027b25eff {% if is_incremental() %} - AND swap.evt_block_time >= date_trunc('day', now() - interval '7' day) + AND {{ incremental_predicate('swap.evt_block_time') }} {% endif %} {% if not is_incremental() %} AND swap.evt_block_time >= cast('{{zeroex_v4_start_date}}' as date) @@ -434,7 +434,7 @@ SELECT END AS taker, -- fix the user masked by ProxyContract issue taker_token, ts.symbol AS taker_symbol, - maker_token, + maker_token, ms.symbol AS maker_symbol, CASE WHEN lower(ts.symbol) > lower(ms.symbol) THEN concat(ms.symbol, '-', ts.symbol) ELSE concat(ts.symbol, '-', ms.symbol) END AS token_pair, taker_token_amount_raw / pow(10, tp.decimals) AS taker_token_amount, @@ -460,7 +460,7 @@ FROM all_tx INNER JOIN {{ source('ethereum', 'transactions')}} tx ON all_tx.tx_hash = tx.hash {% if is_incremental() %} -AND tx.block_time >= date_trunc('day', now() - interval '7' day) +AND {{ incremental_predicate('tx.block_time') }} {% endif %} {% if not is_incremental() %} AND tx.block_time >= cast('{{zeroex_v3_start_date}}' as date) @@ -474,7 +474,7 @@ AND CASE AND tp.blockchain = 'ethereum' {% if is_incremental() %} -AND tp.minute >= date_trunc('day', now() - interval '7' day) +AND {{ incremental_predicate('tp.minute') }} {% endif %} {% if not is_incremental() %} AND tp.minute >= cast('{{zeroex_v3_start_date}}' as date) @@ -488,7 +488,7 @@ AND CASE AND mp.blockchain = 'ethereum' {% if is_incremental() %} -AND mp.minute >= date_trunc('day', now() - interval '7' day) +AND {{ incremental_predicate('mp.minute') }} {% endif %} {% if not is_incremental() %} AND mp.minute >= cast('{{zeroex_v3_start_date}}' as date) diff --git a/models/zeroex/ethereum/zeroex_ethereum_api_fills_deduped.sql b/models/zeroex/ethereum/zeroex_ethereum_api_fills_deduped.sql index bee28984618..eec7610518e 100644 --- a/models/zeroex/ethereum/zeroex_ethereum_api_fills_deduped.sql +++ b/models/zeroex/ethereum/zeroex_ethereum_api_fills_deduped.sql @@ -1,5 +1,5 @@ {{ config( - + schema = 'zeroex_ethereum', alias = 'api_fills_deduped', materialized='incremental', @@ -7,7 +7,8 @@ unique_key = ['block_date', 'tx_hash', 'evt_index'], on_schema_change='sync_all_columns', file_format ='delta', - incremental_strategy='merge' + incremental_strategy='merge', + incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.block_time')] ) }} @@ -24,13 +25,13 @@ AS , * FROM {{ ref('zeroex_ethereum_api_fills') }} WHERE 1=1 - AND swap_flag = true + AND swap_flag = true {% if is_incremental() %} - AND block_time >= date_trunc('day', now() - interval '7' day) + AND {{ incremental_predicate('block_time') }} {% endif %} {% if not is_incremental() %} AND block_time >= cast('{{zeroex_v3_start_date}}' as date) - {% endif %} + {% endif %} ) , fills_first_last AS @@ -58,7 +59,7 @@ AS , MAX(CASE WHEN taker_consider_flag = 0 THEN NULL ELSE taker_token END ) AS taker_token , MAX(CASE WHEN maker_consider_flag = 0 THEN NULL ELSE maker_token END ) AS maker_token , MAX(CASE WHEN taker_consider_flag = 0 THEN NULL ELSE taker_symbol END ) AS taker_symbol - , MAX(CASE WHEN maker_consider_flag = 0 THEN NULL ELSE maker_symbol END ) AS maker_symbol + , MAX(CASE WHEN maker_consider_flag = 0 THEN NULL ELSE maker_symbol END ) AS maker_symbol , MAX(CASE WHEN taker_consider_flag = 0 THEN NULL ELSE taker_token_amount END) AS taker_token_amount , MAX(CASE WHEN maker_consider_flag = 0 THEN NULL ELSE maker_token_amount END) AS maker_token_amount , MAX(CASE WHEN taker_consider_flag = 0 THEN NULL ELSE taker_token_amount_raw END) AS taker_token_amount_raw @@ -94,7 +95,7 @@ SELECT a.blockchain , a.type , a.swap_flag , b.fills_within - , a.contract_address + , a.contract_address FROM fills_with_tx_fill_number a INNER JOIN deduped_bridge_fills b ON a.tx_hash = b.tx_hash AND a.evt_index = b.evt_index \ No newline at end of file diff --git a/models/zeroex/ethereum/zeroex_ethereum_native_fills.sql b/models/zeroex/ethereum/zeroex_ethereum_native_fills.sql index 826639a3773..b5b78a708f9 100644 --- a/models/zeroex/ethereum/zeroex_ethereum_native_fills.sql +++ b/models/zeroex/ethereum/zeroex_ethereum_native_fills.sql @@ -5,15 +5,16 @@ unique_key = ['block_date', 'tx_hash', 'evt_index'], on_schema_change='sync_all_columns', file_format ='delta', - incremental_strategy='merge' + incremental_strategy='merge', + incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.block_time')] ) }} {% set zeroex_v3_start_date = '2019-12-01' %} {% set zeroex_v4_start_date = '2021-01-06' %} --- Test Query here: -WITH +-- Test Query here: +WITH v3_fills AS ( SELECT evt_block_time AS block_time, fills.evt_block_number as block_number @@ -31,8 +32,8 @@ WITH , greatest(bytearray_substring(takerAssetData, 17, 20),bytearray_substring(takerAssetData, 245, 20)) AS taker_token , tt.symbol AS taker_symbol , fills.takerAssetFilledAmount / pow(10, tt.decimals) AS taker_asset_filled_amount - , (fills.feeRecipientAddress in - (0x9b858be6e3047d88820f439b240deac2418a2551,0x86003b044f70dac0abc80ac8957305b6370893ed,0x5bc2419a087666148bfbe1361ae6c06d240c6131)) + , (fills.feeRecipientAddress in + (0x9b858be6e3047d88820f439b240deac2418a2551,0x86003b044f70dac0abc80ac8957305b6370893ed,0x5bc2419a087666148bfbe1361ae6c06d240c6131)) AS matcha_limit_order_flag , CASE WHEN tp.symbol = 'USDC' THEN (fills.takerAssetFilledAmount / 1e6) --don't multiply by anything as these assets are USD @@ -50,7 +51,7 @@ WITH , fills.protocolFeePaid / 1e18 AS protocol_fee_paid_eth, fills.contract_address , 'fills' as native_order_type - FROM {{ source('zeroex_v3_ethereum', 'Exchange_evt_Fill') }} fills + FROM {{ source('zeroex_v3_ethereum', 'Exchange_evt_Fill') }} fills LEFT JOIN {{ source('prices', 'usd') }} tp ON date_trunc('minute', evt_block_time) = tp.minute and tp.blockchain = 'ethereum' AND CASE @@ -67,14 +68,14 @@ WITH END = mp.contract_address LEFT OUTER JOIN {{ source('tokens_ethereum', 'erc20') }} mt ON mt.contract_address = greatest(bytearray_substring(makerAssetData, 17, 20),bytearray_substring(makerAssetData, 245, 20)) LEFT OUTER JOIN {{ source('tokens_ethereum', 'erc20') }} tt ON tt.contract_address = greatest(bytearray_substring(takerAssetData, 17, 20),bytearray_substring(takerAssetData, 245, 20)) - where 1=1 + where 1=1 {% if is_incremental() %} - AND evt_block_time >= date_trunc('day', now() - interval '7' day) + AND {{ incremental_predicate('evt_block_time') }} {% endif %} {% if not is_incremental() %} AND evt_block_time >= TIMESTAMP '{{zeroex_v3_start_date}}' {% endif %} - + ) , v2_1_fills AS ( SELECT @@ -93,8 +94,8 @@ WITH , greatest(bytearray_substring(takerAssetData, 17, 20),bytearray_substring(takerAssetData, 245, 20)) AS taker_token , tt.symbol AS taker_symbol , fills.takerAssetFilledAmount / pow(10, tt.decimals) AS taker_asset_filled_amount - , (fills.feeRecipientAddress in - (0x9b858be6e3047d88820f439b240deac2418a2551,0x86003b044f70dac0abc80ac8957305b6370893ed,0x5bc2419a087666148bfbe1361ae6c06d240c6131)) + , (fills.feeRecipientAddress in + (0x9b858be6e3047d88820f439b240deac2418a2551,0x86003b044f70dac0abc80ac8957305b6370893ed,0x5bc2419a087666148bfbe1361ae6c06d240c6131)) AS matcha_limit_order_flag , CASE WHEN tp.symbol = 'USDC' THEN (fills.takerAssetFilledAmount / 1e6) ----don't multiply by anything as these assets are USD @@ -128,9 +129,9 @@ WITH END = mp.contract_address LEFT OUTER JOIN {{ source('tokens_ethereum', 'erc20') }} mt ON mt.contract_address = greatest(bytearray_substring(makerAssetData, 17, 20),bytearray_substring(makerAssetData, 245, 20)) LEFT OUTER JOIN {{ source('tokens_ethereum', 'erc20') }} tt ON tt.contract_address = greatest(bytearray_substring(takerAssetData, 17, 20),bytearray_substring(takerAssetData, 245, 20)) - where 1=1 + where 1=1 {% if is_incremental() %} - AND evt_block_time >= date_trunc('day', now() - interval '7' day) + AND {{ incremental_predicate('evt_block_time') }} {% endif %} {% if not is_incremental() %} AND evt_block_time >= TIMESTAMP '{{zeroex_v3_start_date}}' @@ -154,8 +155,8 @@ WITH , fills.takerToken AS taker_token , tt.symbol AS taker_symbol , fills.takerTokenFilledAmount / pow(10, tt.decimals) AS taker_asset_filled_amount - , (fills.feeRecipient in - (0x9b858be6e3047d88820f439b240deac2418a2551,0x86003b044f70dac0abc80ac8957305b6370893ed,0x5bc2419a087666148bfbe1361ae6c06d240c6131)) + , (fills.feeRecipient in + (0x9b858be6e3047d88820f439b240deac2418a2551,0x86003b044f70dac0abc80ac8957305b6370893ed,0x5bc2419a087666148bfbe1361ae6c06d240c6131)) AS matcha_limit_order_flag , CASE WHEN tp.symbol = 'USDC' THEN (fills.takerTokenFilledAmount / 1e6) ----don't multiply by anything as these assets are USD @@ -174,14 +175,14 @@ WITH , fills.contract_address , 'limit' as native_order_type FROM {{ source('zeroex_ethereum', 'ExchangeProxy_evt_LimitOrderFilled') }} fills - LEFT JOIN {{ source('prices', 'usd') }} tp ON + LEFT JOIN {{ source('prices', 'usd') }} tp ON date_trunc('minute', evt_block_time) = tp.minute and tp.blockchain = 'ethereum' AND CASE -- Set Deversifi ETHWrapper to WETH WHEN fills.takerToken IN (0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee) THEN 0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2 ELSE fills.takerToken END = tp.contract_address - LEFT JOIN {{ source('prices', 'usd') }} mp ON + LEFT JOIN {{ source('prices', 'usd') }} mp ON DATE_TRUNC('minute', evt_block_time) = mp.minute and mp.blockchain = 'ethereum' AND CASE -- Set Deversifi ETHWrapper to WETH @@ -190,9 +191,9 @@ WITH END = mp.contract_address LEFT OUTER JOIN {{ source('tokens_ethereum', 'erc20') }} mt ON mt.contract_address = fills.makerToken LEFT OUTER JOIN {{ source('tokens_ethereum', 'erc20') }} tt ON tt.contract_address = fills.takerToken - where 1=1 + where 1=1 {% if is_incremental() %} - AND evt_block_time >= date_trunc('day', now() - interval '7' day) + AND {{ incremental_predicate('evt_block_time') }} {% endif %} {% if not is_incremental() %} AND evt_block_time >= TIMESTAMP '{{zeroex_v3_start_date}}' @@ -235,24 +236,24 @@ WITH , 'rfq' as native_order_type FROM {{ source('zeroex_ethereum', 'ExchangeProxy_evt_RfqOrderFilled') }} fills LEFT JOIN {{ source('prices', 'usd') }} tp ON - date_trunc('minute', evt_block_time) = tp.minute + date_trunc('minute', evt_block_time) = tp.minute AND CASE -- Set Deversifi ETHWrapper to WETH WHEN fills.takerToken IN (0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee) THEN 0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2 ELSE fills.takerToken END = tp.contract_address LEFT JOIN {{ source('prices', 'usd') }} mp ON - DATE_TRUNC('minute', evt_block_time) = mp.minute + DATE_TRUNC('minute', evt_block_time) = mp.minute AND CASE -- Set Deversifi ETHWrapper to WETH WHEN fills.makerToken IN (0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee) THEN 0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2 ELSE fills.makerToken END = mp.contract_address - LEFT OUTER JOIN {{ source('tokens_ethereum', 'erc20') }} mt ON mt.contract_address = fills.makerToken - LEFT OUTER JOIN {{ source('tokens_ethereum', 'erc20') }} tt ON tt.contract_address = fills.takerToken - where 1=1 + LEFT OUTER JOIN {{ source('tokens_ethereum', 'erc20') }} mt ON mt.contract_address = fills.makerToken + LEFT OUTER JOIN {{ source('tokens_ethereum', 'erc20') }} tt ON tt.contract_address = fills.takerToken + where 1=1 {% if is_incremental() %} - AND evt_block_time >= date_trunc('day', now() - interval '7' day) + AND {{ incremental_predicate('evt_block_time') }} {% endif %} {% if not is_incremental() %} AND evt_block_time >= TIMESTAMP '{{zeroex_v3_start_date}}' @@ -308,10 +309,10 @@ WITH ELSE fills.makerToken END = mp.contract_address LEFT OUTER JOIN {{ source('tokens_ethereum', 'erc20') }} mt ON mt.contract_address = fills.makerToken - LEFT OUTER JOIN {{ source('tokens_ethereum', 'erc20') }} tt ON tt.contract_address = fills.takerToken - where 1=1 + LEFT OUTER JOIN {{ source('tokens_ethereum', 'erc20') }} tt ON tt.contract_address = fills.takerToken + where 1=1 {% if is_incremental() %} - AND evt_block_time >= date_trunc('day', now() - interval '7' day) + AND {{ incremental_predicate('evt_block_time') }} {% endif %} {% if not is_incremental() %} AND evt_block_time >= TIMESTAMP '{{zeroex_v3_start_date}}' @@ -383,7 +384,7 @@ INNER JOIN {{ source('ethereum', 'transactions')}} tx ON all_fills.transaction_hash = tx.hash AND all_fills.block_number = tx.block_number {% if is_incremental() %} - AND tx.block_time >= date_trunc('day', now() - interval '7' day) + AND {{ incremental_predicate('tx.block_time') }} {% endif %} {% if not is_incremental() %} AND tx.block_time >= TIMESTAMP '{{zeroex_v3_start_date}}' diff --git a/models/zeroex/ethereum/zeroex_ethereum_nft_fills.sql b/models/zeroex/ethereum/zeroex_ethereum_nft_fills.sql index 1048f0b1313..67140ef0f2a 100644 --- a/models/zeroex/ethereum/zeroex_ethereum_nft_fills.sql +++ b/models/zeroex/ethereum/zeroex_ethereum_nft_fills.sql @@ -7,6 +7,7 @@ on_schema_change='sync_all_columns', file_format ='delta', incremental_strategy='merge', + incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.block_time')], post_hook='{{ expose_spells(\'["ethereum"]\', "project", "zeroex", @@ -39,7 +40,7 @@ WITH tbl_cte_transaction AS FROM {{ source ('zeroex_ethereum', 'ExchangeProxy_evt_ERC721OrderFilled') }} WHERE 1 = 1 {% if is_incremental() %} - AND evt_block_time >= date_trunc('day', now() - interval '7' day) + AND {{ incremental_predicate('evt_block_time') }} {% endif %} {% if not is_incremental() %} AND evt_block_time >= TIMESTAMP '{{zeroex_v4_nft_start_date}}' @@ -67,7 +68,7 @@ WITH tbl_cte_transaction AS FROM {{ source ('zeroex_ethereum', 'ExchangeProxy_evt_ERC1155OrderFilled') }} WHERE 1 = 1 {% if is_incremental() %} - AND evt_block_time >= date_trunc('day', now() - interval '7' day) + AND {{ incremental_predicate('evt_block_time') }} {% endif %} {% if not is_incremental() %} AND evt_block_time >= TIMESTAMP '{{zeroex_v4_nft_start_date}}' @@ -89,7 +90,7 @@ WITH tbl_cte_transaction AS AND blockchain = 'ethereum' AND p.contract_address IN ( SELECT DISTINCT price_label FROM tbl_cte_transaction) {% if is_incremental() %} - AND minute >= date_trunc('day', now() - interval '7' day) + AND {{ incremental_predicate('minute') }} {% endif %} {% if not is_incremental() %} AND minute >= TIMESTAMP '{{zeroex_v4_nft_start_date}}' diff --git a/models/zeroex/fantom/zeroex_fantom_api_fills.sql b/models/zeroex/fantom/zeroex_fantom_api_fills.sql index 2238630477f..7aa286884d8 100644 --- a/models/zeroex/fantom/zeroex_fantom_api_fills.sql +++ b/models/zeroex/fantom/zeroex_fantom_api_fills.sql @@ -1,12 +1,13 @@ {{ config( - + alias = 'api_fills', materialized='incremental', partition_by = ['block_month'], unique_key = ['block_date', 'tx_hash', 'evt_index'], on_schema_change='sync_all_columns', file_format ='delta', - incremental_strategy='merge' + incremental_strategy='merge', + incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.block_time')] ) }} @@ -29,11 +30,11 @@ WITH zeroex_tx AS ( FROM {{ source('fantom', 'traces') }} tr WHERE tr.to IN ( -- exchange contract - 0x61935cbdd02287b511119ddb11aeb42f1593b7ef, + 0x61935cbdd02287b511119ddb11aeb42f1593b7ef, -- forwarder addresses 0x6958f5e95332d93d21af0d7b9ca85b8212fee0a5, 0x4aa817c6f383c8e8ae77301d18ce48efb16fd2be, - 0x4ef40d1bf0983899892946830abf99eca2dbc5ce, + 0x4ef40d1bf0983899892946830abf99eca2dbc5ce, -- exchange proxy 0xdef189deaef76e379df891899eb5a00a94cbc250 ) @@ -41,9 +42,9 @@ WITH zeroex_tx AS ( bytearray_position(INPUT, 0x869584cd ) <> 0 OR bytearray_position(INPUT, 0xfbc019a7 ) <> 0 ) - + {% if is_incremental() %} - AND block_time >= date_trunc('day', now() - interval '7' day) + AND {{ incremental_predicate('block_time') }} {% endif %} {% if not is_incremental() %} AND block_time >= TIMESTAMP '{{zeroex_v3_start_date}}' @@ -54,7 +55,7 @@ WITH zeroex_tx AS ( ), /* v4_rfq_fills_no_bridge AS ( - SELECT + SELECT fills.evt_tx_hash AS tx_hash, fills.evt_index, fills.contract_address, @@ -73,14 +74,14 @@ v4_rfq_fills_no_bridge AS ( LEFT JOIN zeroex_tx ON zeroex_tx.tx_hash = fills.evt_tx_hash {% if is_incremental() %} - WHERE evt_block_time >= date_trunc('day', now() - interval '7' day) + WHERE {{ incremental_predicate('evt_block_time') }} {% endif %} {% if not is_incremental() %} WHERE evt_block_time >= TIMESTAMP '{{zeroex_v4_start_date}}' {% endif %} ), v4_limit_fills_no_bridge AS ( - SELECT + SELECT fills.evt_tx_hash AS tx_hash, fills.evt_index, fills.contract_address, @@ -99,14 +100,14 @@ v4_limit_fills_no_bridge AS ( LEFT JOIN zeroex_tx ON zeroex_tx.tx_hash = fills.evt_tx_hash {% if is_incremental() %} - WHERE evt_block_time >= date_trunc('day', now() - interval '7' day) + WHERE {{ incremental_predicate('evt_block_time') }} {% endif %} {% if not is_incremental() %} WHERE evt_block_time >= TIMESTAMP '{{zeroex_v4_start_date}}' {% endif %} ), otc_fills AS ( - SELECT + SELECT fills.evt_tx_hash AS tx_hash, fills.evt_index, fills.contract_address, @@ -125,7 +126,7 @@ otc_fills AS ( LEFT JOIN zeroex_tx ON zeroex_tx.tx_hash = fills.evt_tx_hash {% if is_incremental() %} - WHERE evt_block_time >= date_trunc('day', now() - interval '7' day) + WHERE {{ incremental_predicate('evt_block_time') }} {% endif %} {% if not is_incremental() %} WHERE evt_block_time >= TIMESTAMP '{{zeroex_v4_start_date}}' @@ -134,7 +135,7 @@ otc_fills AS ( ), */ ERC20BridgeTransfer AS ( - SELECT + SELECT logs.tx_hash, logs.block_number AS block_number, INDEX AS evt_index, @@ -153,17 +154,17 @@ ERC20BridgeTransfer AS ( FROM {{ source('fantom', 'logs') }} logs INNER JOIN zeroex_tx ON zeroex_tx.tx_hash = logs.tx_hash WHERE topic0 = 0x349fc08071558d8e3aa92dec9396e4e9f2dfecd6bb9065759d1932e7da43b8a9 - + {% if is_incremental() %} - AND block_time >= date_trunc('day', now() - interval '7' day) + AND {{ incremental_predicate('block_time') }} {% endif %} {% if not is_incremental() %} AND block_time >= TIMESTAMP '{{zeroex_v3_start_date}}' {% endif %} -), +), BridgeFill AS ( - SELECT + SELECT logs.tx_hash, logs.block_number AS block_number, INDEX AS evt_index, @@ -185,14 +186,14 @@ BridgeFill AS ( AND contract_address = 0xb4d961671cadfed687e040b076eee29840c142e5 {% if is_incremental() %} - AND block_time >= date_trunc('day', now() - interval '7' day) + AND {{ incremental_predicate('block_time') }} {% endif %} {% if not is_incremental() %} AND block_time >= TIMESTAMP '{{zeroex_v4_start_date}}' {% endif %} -), +), NewBridgeFill AS ( - SELECT + SELECT logs.tx_hash as tx_hash, logs.block_number AS block_number, INDEX AS evt_index, @@ -214,7 +215,7 @@ NewBridgeFill AS ( AND contract_address = 0xb4d961671cadfed687e040b076eee29840c142e5 {% if is_incremental() %} - AND block_time >= date_trunc('day', now() - interval '7' day) + AND {{ incremental_predicate('block_time') }} {% endif %} {% if not is_incremental() %} AND block_time >= TIMESTAMP '{{zeroex_v4_start_date}}' @@ -222,7 +223,7 @@ NewBridgeFill AS ( ), /* direct_PLP AS ( - SELECT + SELECT plp.evt_tx_hash, plp.evt_index AS evt_index, plp.contract_address, @@ -241,27 +242,27 @@ direct_PLP AS ( INNER JOIN zeroex_tx ON zeroex_tx.tx_hash = plp.evt_tx_hash {% if is_incremental() %} - WHERE evt_block_time >= date_trunc('day', now() - interval '7' day) + WHERE {{ incremental_predicate('evt_block_time') }} {% endif %} {% if not is_incremental() %} WHERE evt_block_time >= TIMESTAMP '{{zeroex_v3_start_date}}' {% endif %} -), +), */ all_tx AS ( - + SELECT * FROM ERC20BridgeTransfer UNION ALL SELECT * FROM BridgeFill - UNION ALL + UNION ALL SELECT * - FROM NewBridgeFill - - + FROM NewBridgeFill + + ) -SELECT +SELECT all_tx.tx_hash, all_tx.block_number, all_tx.evt_index, @@ -291,10 +292,10 @@ SELECT ,0x049d68029688eabf473097a2fc38ef61633a3c7a,0x321162cd933e2be498cd2267a90534a804051b11,0x8d11ec38a3eb5e956b052f67da8bdc9bef8abf3e) AND mp.price IS NOT NULL THEN (all_tx.maker_token_amount_raw / pow(10, mp.decimals)) * mp.price WHEN taker_token IN (0x04068da6c83afcfa0e13ba15a6696662335d5b75,0x21be370d5312f44cb42ce377bc9b8a0cef1a4c83,0x74b23882a30290451a17c44f4f05243b6b58c76d, - 0x049d68029688eabf473097a2fc38ef61633a3c7a, 0x321162cd933e2be498cd2267a90534a804051b11,0x8d11ec38a3eb5e956b052f67da8bdc9bef8abf3e) AND tp.price IS NOT NULL + 0x049d68029688eabf473097a2fc38ef61633a3c7a, 0x321162cd933e2be498cd2267a90534a804051b11,0x8d11ec38a3eb5e956b052f67da8bdc9bef8abf3e) AND tp.price IS NOT NULL THEN (all_tx.taker_token_amount_raw / pow(10, tp.decimals)) * tp.price ELSE COALESCE((all_tx.maker_token_amount_raw / pow(10, mp.decimals)) * mp.price, (all_tx.taker_token_amount_raw / pow(10, tp.decimals)) * tp.price) - END AS volume_usd, + END AS volume_usd, tx."from" AS tx_from, tx.to AS tx_to, 'fantom' AS blockchain @@ -302,7 +303,7 @@ FROM all_tx INNER JOIN {{ source('fantom', 'transactions')}} tx ON all_tx.tx_hash = tx.hash {% if is_incremental() %} -AND tx.block_time >= date_trunc('day', now() - interval '7' day) +AND {{ incremental_predicate('tx.block_time') }} {% endif %} {% if not is_incremental() %} AND tx.block_time >= TIMESTAMP '{{zeroex_v3_start_date}}' @@ -316,7 +317,7 @@ AND CASE AND tp.blockchain = 'fantom' {% if is_incremental() %} -AND tp.minute >= date_trunc('day', now() - interval '7' day) +AND {{ incremental_predicate('tp.minute') }} {% endif %} {% if not is_incremental() %} AND tp.minute >= TIMESTAMP '{{zeroex_v3_start_date}}' @@ -330,7 +331,7 @@ AND CASE AND mp.blockchain = 'fantom' {% if is_incremental() %} -AND mp.minute >= date_trunc('day', now() - interval '7' day) +AND {{ incremental_predicate('mp.minute') }} {% endif %} {% if not is_incremental() %} AND mp.minute >= TIMESTAMP '{{zeroex_v3_start_date}}' diff --git a/models/zeroex/fantom/zeroex_fantom_api_fills_deduped.sql b/models/zeroex/fantom/zeroex_fantom_api_fills_deduped.sql index 5f004b648e2..f0761e8dc53 100644 --- a/models/zeroex/fantom/zeroex_fantom_api_fills_deduped.sql +++ b/models/zeroex/fantom/zeroex_fantom_api_fills_deduped.sql @@ -1,5 +1,5 @@ {{ config( - + schema = 'zeroex_fantom', alias = 'api_fills_deduped', materialized='incremental', @@ -7,7 +7,8 @@ unique_key = ['block_date', 'tx_hash', 'evt_index'], on_schema_change='sync_all_columns', file_format ='delta', - incremental_strategy='merge' + incremental_strategy='merge', + incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.block_time')] ) }} @@ -22,11 +23,11 @@ AS WHERE 1=1 AND swap_flag = true {% if is_incremental() %} - AND block_time >= date_trunc('day', now() - interval '7' day) + AND {{ incremental_predicate('block_time') }} {% endif %} {% if not is_incremental() %} AND block_time >= TIMESTAMP '{{zeroex_v3_start_date}}' - {% endif %} + {% endif %} ) , fills_first_last AS @@ -54,7 +55,7 @@ AS , MAX(CASE WHEN taker_consider_flag = 0 THEN NULL ELSE taker_token END ) AS taker_token , MAX(CASE WHEN maker_consider_flag = 0 THEN NULL ELSE maker_token END ) AS maker_token , MAX(CASE WHEN taker_consider_flag = 0 THEN NULL ELSE taker_symbol END ) AS taker_symbol - , MAX(CASE WHEN maker_consider_flag = 0 THEN NULL ELSE maker_symbol END ) AS maker_symbol + , MAX(CASE WHEN maker_consider_flag = 0 THEN NULL ELSE maker_symbol END ) AS maker_symbol , MAX(CASE WHEN taker_consider_flag = 0 THEN NULL ELSE taker_token_amount END) AS taker_token_amount , MAX(CASE WHEN maker_consider_flag = 0 THEN NULL ELSE maker_token_amount END) AS maker_token_amount , MAX(CASE WHEN taker_consider_flag = 0 THEN NULL ELSE taker_token_amount_raw END) AS taker_token_amount_raw @@ -90,7 +91,7 @@ SELECT a.blockchain , a.type , a.swap_flag , b.fills_within - , a.contract_address + , a.contract_address FROM fills_with_tx_fill_number a INNER JOIN deduped_bridge_fills b ON (a.tx_hash = b.tx_hash AND a.evt_index = b.evt_index) \ No newline at end of file diff --git a/models/zeroex/optimism/zeroex_optimism_api_fills.sql b/models/zeroex/optimism/zeroex_optimism_api_fills.sql index 142c0ae9432..077077242e8 100644 --- a/models/zeroex/optimism/zeroex_optimism_api_fills.sql +++ b/models/zeroex/optimism/zeroex_optimism_api_fills.sql @@ -1,15 +1,16 @@ {{ config( schema = 'zeroex_optimism', - + alias = 'api_fills', - materialized='incremental', + materialized='incremental', partition_by = ['block_month'], unique_key = ['block_date', 'tx_hash', 'evt_index'], on_schema_change='sync_all_columns', file_format ='delta', - incremental_strategy='merge' + incremental_strategy='merge', + incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.block_time')] ) -}} +}} {% set zeroex_v3_start_date = '2019-12-01' %} {% set zeroex_v4_start_date = '2021-01-06' %} @@ -43,9 +44,9 @@ WITH zeroex_tx AS ( bytearray_position(INPUT, 0x869584cd ) <> 0 OR bytearray_position(INPUT, 0xfbc019a7 ) <> 0 ) - + {% if is_incremental() %} - AND block_time >= date_trunc('day', now() - interval '7' day) + AND {{ incremental_predicate('block_time') }} {% endif %} {% if not is_incremental() %} AND block_time >= TIMESTAMP '{{zeroex_v3_start_date}}' @@ -56,7 +57,7 @@ WITH zeroex_tx AS ( ), v4_rfq_fills_no_bridge AS ( - SELECT + SELECT fills.evt_tx_hash AS tx_hash, fills.evt_index, fills.contract_address, @@ -74,14 +75,14 @@ v4_rfq_fills_no_bridge AS ( FROM {{ source('zeroex_optimism', 'ExchangeProxy_evt_RfqOrderFilled') }} fills INNER JOIN zeroex_tx ON zeroex_tx.tx_hash = fills.evt_tx_hash {% if is_incremental() %} - WHERE evt_block_time >= date_trunc('day', now() - interval '7' day) + WHERE {{ incremental_predicate('evt_block_time') }} {% endif %} {% if not is_incremental() %} WHERE evt_block_time >= cast('{{zeroex_v4_start_date}}' as date) {% endif %} ), v4_limit_fills_no_bridge AS ( - SELECT + SELECT fills.evt_tx_hash AS tx_hash, fills.evt_index, fills.contract_address, @@ -95,18 +96,18 @@ v4_limit_fills_no_bridge AS ( 'LimitOrderFilled' AS type, COALESCE(zeroex_tx.affiliate_address, fills.feeRecipient) AS affiliate_address, (zeroex_tx.tx_hash IS NOT NULL) AS swap_flag, - (fills.feeRecipient in + (fills.feeRecipient in (0x9b858be6e3047d88820f439b240deac2418a2551, 0x86003b044f70dac0abc80ac8957305b6370893ed, - 0x5bc2419a087666148bfbe1361ae6c06d240c6131)) - AS matcha_limit_order_flag + 0x5bc2419a087666148bfbe1361ae6c06d240c6131)) + AS matcha_limit_order_flag FROM {{ source('zeroex_optimism', 'ExchangeProxy_evt_LimitOrderFilled') }} fills INNER JOIN zeroex_tx ON zeroex_tx.tx_hash = fills.evt_tx_hash {% if is_incremental() %} - WHERE evt_block_time >= date_trunc('day', now() - interval '7' day) + WHERE {{ incremental_predicate('evt_block_time') }} {% endif %} {% if not is_incremental() %} WHERE evt_block_time >= cast('{{zeroex_v4_start_date}}' as date) @@ -116,7 +117,7 @@ v4_limit_fills_no_bridge AS ( otc_fills AS ( - SELECT + SELECT fills.evt_tx_hash AS tx_hash, fills.evt_index, fills.contract_address, @@ -137,7 +138,7 @@ otc_fills AS ( {% if is_incremental() %} - WHERE evt_block_time >= date_trunc('day', now() - interval '7' day) + WHERE {{ incremental_predicate('evt_block_time') }} {% endif %} {% if not is_incremental() %} WHERE evt_block_time >= cast('{{zeroex_v4_start_date}}' as date) @@ -147,7 +148,7 @@ otc_fills AS ( ERC20BridgeTransfer AS ( - SELECT + SELECT logs.tx_hash, INDEX AS evt_index, logs.contract_address, @@ -167,7 +168,7 @@ ERC20BridgeTransfer AS ( WHERE topic0 = 0x349fc08071558d8e3aa92dec9396e4e9f2dfecd6bb9065759d1932e7da43b8a9 {% if is_incremental() %} - AND block_time >= date_trunc('day', now() - interval '7' day) + AND {{ incremental_predicate('block_time') }} {% endif %} {% if not is_incremental() %} AND block_time >= cast('{{zeroex_v3_start_date}}' as date) @@ -199,7 +200,7 @@ NewBridgeFill AS ( AND contract_address = 0xa3128d9b7cca7d5af29780a56abeec12b05a6740 {% if is_incremental() %} - AND block_time >= date_trunc('day', now() - interval '7' day) + AND {{ incremental_predicate('block_time') }} {% endif %} {% if not is_incremental() %} AND block_time >= cast('{{zeroex_v4_start_date}}' as date) @@ -208,22 +209,22 @@ NewBridgeFill AS ( all_tx AS ( SELECT * - FROM NewBridgeFill + FROM NewBridgeFill UNION ALL SELECT * FROM ERC20BridgeTransfer - UNION ALL + UNION ALL SELECT * FROM v4_rfq_fills_no_bridge - UNION ALL + UNION ALL SELECT * FROM v4_limit_fills_no_bridge - UNION ALL + UNION ALL SELECT * - FROM otc_fills + FROM otc_fills ) -SELECT +SELECT all_tx.tx_hash, tx.block_number, all_tx.evt_index, @@ -257,14 +258,14 @@ SELECT 0x4200000000000000000000000000000000000042,0x94b008aa00579c1307b0ef2c499ad98a8ce58e58, 0x8c6f28f2f1a3c87f0f938b96d27520d9751ec8d9) AND tp.price IS NOT NULL THEN (all_tx.taker_token_amount_raw / pow(10, tp.decimals)) * tp.price ELSE COALESCE((all_tx.maker_token_amount_raw / pow(10, mp.decimals)) * mp.price, (all_tx.taker_token_amount_raw / pow(10, tp.decimals)) * tp.price) - END AS volume_usd, + END AS volume_usd, tx."from" AS tx_from, tx.to AS tx_to, 'optimism' AS blockchain FROM all_tx INNER JOIN {{ source('optimism', 'transactions')}} tx ON all_tx.tx_hash = tx.hash {% if is_incremental() %} -AND tx.block_time >= date_trunc('day', now() - interval '7' day) +AND {{ incremental_predicate('tx.block_time') }} {% endif %} {% if not is_incremental() %} AND tx.block_time >= cast('{{zeroex_v3_start_date}}' as date) @@ -278,7 +279,7 @@ AND CASE AND tp.blockchain = 'optimism' {% if is_incremental() %} -AND tp.minute >= date_trunc('day', now() - interval '7' day) +AND {{ incremental_predicate('tp.minute') }} {% endif %} {% if not is_incremental() %} AND tp.minute >= cast('{{zeroex_v3_start_date}}' as date) @@ -292,7 +293,7 @@ AND CASE AND mp.blockchain = 'optimism' {% if is_incremental() %} -AND mp.minute >= date_trunc('day', now() - interval '7' day) +AND {{ incremental_predicate('mp.minute') }} {% endif %} {% if not is_incremental() %} AND mp.minute >= cast('{{zeroex_v3_start_date}}' as date) diff --git a/models/zeroex/optimism/zeroex_optimism_api_fills_deduped.sql b/models/zeroex/optimism/zeroex_optimism_api_fills_deduped.sql index 4b75a98df1f..e46fe510b67 100644 --- a/models/zeroex/optimism/zeroex_optimism_api_fills_deduped.sql +++ b/models/zeroex/optimism/zeroex_optimism_api_fills_deduped.sql @@ -1,5 +1,5 @@ {{ config( - + schema = 'zeroex_optimism', alias = 'api_fills_deduped', materialized='incremental', @@ -7,7 +7,8 @@ unique_key = ['block_date', 'tx_hash', 'evt_index'], on_schema_change='sync_all_columns', file_format ='delta', - incremental_strategy='merge' + incremental_strategy='merge', + incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.block_time')] ) }} @@ -22,11 +23,11 @@ AS WHERE 1=1 AND swap_flag = true {% if is_incremental() %} - AND block_time >= date_trunc('day', now() - interval '7' day ) + AND {{ incremental_predicate('block_time') }} {% endif %} {% if not is_incremental() %} - AND block_time >= cast('{{zeroex_v3_start_date}}' as date) - {% endif %} + AND block_time >= cast('{{zeroex_v3_start_date}}' as date) + {% endif %} ) , fills_first_last AS @@ -54,7 +55,7 @@ AS , MAX(CASE WHEN taker_consider_flag = 0 THEN NULL ELSE taker_token END ) AS taker_token , MAX(CASE WHEN maker_consider_flag = 0 THEN NULL ELSE maker_token END ) AS maker_token , MAX(CASE WHEN taker_consider_flag = 0 THEN NULL ELSE taker_symbol END ) AS taker_symbol - , MAX(CASE WHEN maker_consider_flag = 0 THEN NULL ELSE maker_symbol END ) AS maker_symbol + , MAX(CASE WHEN maker_consider_flag = 0 THEN NULL ELSE maker_symbol END ) AS maker_symbol , MAX(CASE WHEN taker_consider_flag = 0 THEN NULL ELSE taker_token_amount END) AS taker_token_amount , MAX(CASE WHEN maker_consider_flag = 0 THEN NULL ELSE maker_token_amount END) AS maker_token_amount , MAX(CASE WHEN taker_consider_flag = 0 THEN NULL ELSE taker_token_amount_raw END) AS taker_token_amount_raw @@ -85,12 +86,12 @@ SELECT a.blockchain , a.tx_hash , a.tx_from , a.tx_to - , b.evt_index + , b.evt_index , ARRAY[-1] as trace_address , a.type , a.swap_flag , b.fills_within - , a.contract_address + , a.contract_address FROM fills_with_tx_fill_number a INNER JOIN deduped_bridge_fills b ON (a.tx_hash = b.tx_hash AND a.evt_index = b.evt_index) \ No newline at end of file diff --git a/models/zeroex/optimism/zeroex_optimism_native_fills.sql b/models/zeroex/optimism/zeroex_optimism_native_fills.sql index 7eebb792853..a5d5de8d610 100644 --- a/models/zeroex/optimism/zeroex_optimism_native_fills.sql +++ b/models/zeroex/optimism/zeroex_optimism_native_fills.sql @@ -5,16 +5,17 @@ unique_key = ['block_date', 'tx_hash', 'evt_index'], on_schema_change='sync_all_columns', file_format ='delta', - incremental_strategy='merge' + incremental_strategy='merge', + incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.block_time')] ) }} {% set zeroex_v3_start_date = '2019-12-01' %} {% set zeroex_v4_start_date = '2021-01-06' %} --- Test Query here: -WITH - +-- Test Query here: +WITH + v4_limit_fills AS ( SELECT @@ -29,14 +30,14 @@ WITH , CASE WHEN lower(tt.symbol) > lower(mt.symbol) THEN concat(mt.symbol, '-', tt.symbol) ELSE concat(tt.symbol, '-', mt.symbol) END AS token_pair , fills.takerTokenFilledAmount as taker_token_filled_amount_raw , fills.makerTokenFilledAmount as maker_token_filled_amount_raw - , fills.contract_address + , fills.contract_address , mt.symbol AS maker_symbol , fills.makerTokenFilledAmount / pow(10, mt.decimals) AS maker_asset_filled_amount , fills.takerToken AS taker_token , tt.symbol AS taker_symbol , fills.takerTokenFilledAmount / pow(10, tt.decimals) AS taker_asset_filled_amount - , (fills.feeRecipient in - (0x9b858be6e3047d88820f439b240deac2418a2551,0x86003b044f70dac0abc80ac8957305b6370893ed,0x5bc2419a087666148bfbe1361ae6c06d240c6131)) + , (fills.feeRecipient in + (0x9b858be6e3047d88820f439b240deac2418a2551,0x86003b044f70dac0abc80ac8957305b6370893ed,0x5bc2419a087666148bfbe1361ae6c06d240c6131)) AS matcha_limit_order_flag , CASE WHEN tp.symbol = 'USDC' THEN (fills.takerTokenFilledAmount / 1e6) ----don't multiply by anything as these assets are USD @@ -69,9 +70,9 @@ WITH END = mp.contract_address LEFT OUTER JOIN {{ source('tokens', 'erc20') }} mt ON mt.contract_address = fills.makerToken and mt.blockchain = 'optimism' LEFT OUTER JOIN {{ source('tokens', 'erc20') }} tt ON tt.contract_address = fills.takerToken and tt.blockchain = 'optimism' - where 1=1 + where 1=1 {% if is_incremental() %} - AND evt_block_time >= date_trunc('day', now() - interval '7' day) + AND {{ incremental_predicate('evt_block_time') }} {% endif %} {% if not is_incremental() %} AND evt_block_time >= TIMESTAMP '{{zeroex_v3_start_date}}' @@ -91,7 +92,7 @@ WITH , CASE WHEN lower(tt.symbol) > lower(mt.symbol) THEN concat(mt.symbol, '-', tt.symbol) ELSE concat(tt.symbol, '-', mt.symbol) END AS token_pair , fills.takerTokenFilledAmount as taker_token_filled_amount_raw , fills.makerTokenFilledAmount as maker_token_filled_amount_raw - , fills.contract_address + , fills.contract_address , mt.symbol AS maker_symbol , fills.makerTokenFilledAmount / pow(10, mt.decimals) AS maker_asset_filled_amount , fills.takerToken AS taker_token @@ -129,9 +130,9 @@ WITH END = mp.contract_address LEFT OUTER JOIN {{ source('tokens', 'erc20') }} mt ON mt.contract_address = fills.makerToken and mt.blockchain = 'optimism' LEFT OUTER JOIN {{ source('tokens', 'erc20') }} tt ON tt.contract_address = fills.takerToken and tt.blockchain = 'optimism' - where 1=1 + where 1=1 {% if is_incremental() %} - AND evt_block_time >= date_trunc('day', now() - interval '7' day) + AND {{ incremental_predicate('evt_block_time') }} {% endif %} {% if not is_incremental() %} AND evt_block_time >= TIMESTAMP '{{zeroex_v3_start_date}}' @@ -150,7 +151,7 @@ WITH , CASE WHEN lower(tt.symbol) > lower(mt.symbol) THEN concat(mt.symbol, '-', tt.symbol) ELSE concat(tt.symbol, '-', mt.symbol) END AS token_pair , fills.takerTokenFilledAmount as taker_token_filled_amount_raw , fills.makerTokenFilledAmount as maker_token_filled_amount_raw - , fills.contract_address + , fills.contract_address , mt.symbol AS maker_symbol , fills.makerTokenFilledAmount / pow(10, mt.decimals) AS maker_asset_filled_amount , fills.takerToken AS taker_token @@ -188,9 +189,9 @@ WITH END = mp.contract_address LEFT OUTER JOIN {{ source('tokens', 'erc20') }} mt ON mt.contract_address = fills.makerToken and mt.blockchain = 'optimism' LEFT OUTER JOIN {{ source('tokens', 'erc20') }} tt ON tt.contract_address = fills.takerToken and tt.blockchain = 'optimism' - where 1=1 + where 1=1 {% if is_incremental() %} - AND evt_block_time >= date_trunc('day', now() - interval '7' day) + AND {{ incremental_predicate('evt_block_time') }} {% endif %} {% if not is_incremental() %} AND evt_block_time >= TIMESTAMP '{{zeroex_v3_start_date}}' @@ -199,8 +200,8 @@ WITH ), all_fills as ( - - + + SELECT * FROM v4_limit_fills @@ -209,11 +210,11 @@ WITH SELECT * FROM v4_rfq_fills UNION ALL - + SELECT * FROM otc_fills ) - SELECT distinct - all_fills.block_time AS block_time, + SELECT distinct + all_fills.block_time AS block_time, all_fills.block_number, protocol_version as version, date_trunc('day', all_fills.block_time) as block_date, @@ -243,10 +244,9 @@ WITH INNER JOIN {{ source('optimism', 'transactions')}} tx ON all_fills.transaction_hash = tx.hash AND all_fills.block_number = tx.block_number {% if is_incremental() %} - AND tx.block_time >= date_trunc('day', now() - interval '7' day) + AND {{ incremental_predicate('tx.block_time') }} {% endif %} {% if not is_incremental() %} AND tx.block_time >= TIMESTAMP '{{zeroex_v3_start_date}}' {% endif %} - - \ No newline at end of file + diff --git a/models/zeroex/polygon/zeroex_polygon_api_fills.sql b/models/zeroex/polygon/zeroex_polygon_api_fills.sql index 550e284add6..1ce4f287866 100644 --- a/models/zeroex/polygon/zeroex_polygon_api_fills.sql +++ b/models/zeroex/polygon/zeroex_polygon_api_fills.sql @@ -1,13 +1,14 @@ {{ config( schema = 'zeroex_polygon', - + alias = 'api_fills', materialized='incremental', partition_by = ['block_month'], unique_key = ['block_date', 'tx_hash', 'evt_index'], on_schema_change='sync_all_columns', file_format ='delta', - incremental_strategy='merge' + incremental_strategy='merge', + incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.block_time')] ) }} @@ -17,7 +18,7 @@ -- Test Query here: https://dune.com/queries/1684477 WITH zeroex_tx AS ( - SELECT distinct + SELECT distinct tr.tx_hash, max(CASE WHEN bytearray_position(INPUT, 0x869584cd ) <> 0 THEN SUBSTRING(INPUT @@ -44,9 +45,9 @@ WITH zeroex_tx AS ( bytearray_position(INPUT, 0x869584cd ) <> 0 OR bytearray_position(INPUT, 0xfbc019a7 ) <> 0 ) - + {% if is_incremental() %} - AND block_time >= date_trunc('day', now() - interval '7' day) + AND {{ incremental_predicate('block_time') }} {% endif %} {% if not is_incremental() %} AND block_time >= cast('{{zeroex_v3_start_date}}' as date) @@ -55,7 +56,7 @@ WITH zeroex_tx AS ( ), v4_rfq_fills_no_bridge AS ( - SELECT + SELECT fills.evt_tx_hash AS tx_hash, fills.evt_index, fills.contract_address, @@ -78,7 +79,7 @@ v4_rfq_fills_no_bridge AS ( AND zeroex_tx.block_time = fills.evt_block_time {% if is_incremental() %} - WHERE evt_block_time >= date_trunc('day', now() - interval '7' day) + WHERE {{ incremental_predicate('evt_block_time') }} {% endif %} {% if not is_incremental() %} WHERE evt_block_time >= cast('{{zeroex_v4_start_date}}' as date) @@ -86,7 +87,7 @@ v4_rfq_fills_no_bridge AS ( ), v4_limit_fills_no_bridge AS ( - SELECT + SELECT fills.evt_tx_hash AS tx_hash, fills.evt_index, fills.contract_address, @@ -101,9 +102,9 @@ v4_limit_fills_no_bridge AS ( COALESCE(zeroex_tx.affiliate_address, fills.feeRecipient) AS affiliate_address, zeroex_tx.block_number, (zeroex_tx.tx_hash IS NOT NULL) AS swap_flag, - (fills.feeRecipient in - (0x9b858be6e3047d88820f439b240deac2418a2551,0x86003b044f70dac0abc80ac8957305b6370893ed,0x5bc2419a087666148bfbe1361ae6c06d240c6131)) - AS matcha_limit_order_flag + (fills.feeRecipient in + (0x9b858be6e3047d88820f439b240deac2418a2551,0x86003b044f70dac0abc80ac8957305b6370893ed,0x5bc2419a087666148bfbe1361ae6c06d240c6131)) + AS matcha_limit_order_flag FROM {{ source('zeroex_polygon', 'ExchangeProxy_evt_LimitOrderFilled') }} fills INNER JOIN zeroex_tx ON zeroex_tx.tx_hash = fills.evt_tx_hash @@ -111,7 +112,7 @@ v4_limit_fills_no_bridge AS ( AND zeroex_tx.block_time = fills.evt_block_time {% if is_incremental() %} - WHERE evt_block_time >= date_trunc('day', now() - interval '7' day) + WHERE {{ incremental_predicate('evt_block_time') }} {% endif %} {% if not is_incremental() %} WHERE evt_block_time >= cast('{{zeroex_v4_start_date}}' as date) @@ -119,7 +120,7 @@ v4_limit_fills_no_bridge AS ( ), otc_fills AS ( - SELECT + SELECT fills.evt_tx_hash AS tx_hash, fills.evt_index, fills.contract_address, @@ -142,7 +143,7 @@ otc_fills AS ( AND zeroex_tx.block_time = fills.evt_block_time {% if is_incremental() %} - WHERE evt_block_time >= date_trunc('day', now() - interval '7' day) + WHERE {{ incremental_predicate('evt_block_time') }} {% endif %} {% if not is_incremental() %} WHERE evt_block_time >= cast('{{zeroex_v4_start_date}}' as date) @@ -151,7 +152,7 @@ otc_fills AS ( ), ERC20BridgeTransfer AS ( - SELECT + SELECT logs.tx_hash, INDEX AS evt_index, logs.contract_address, @@ -170,18 +171,18 @@ ERC20BridgeTransfer AS ( FROM {{ source('polygon', 'logs') }} logs INNER JOIN zeroex_tx ON zeroex_tx.tx_hash = logs.tx_hash WHERE topic0 = 0x349fc08071558d8e3aa92dec9396e4e9f2dfecd6bb9065759d1932e7da43b8a9 - + {% if is_incremental() %} - AND zeroex_tx.block_time >= date_trunc('day', now() - interval '7' day) + AND {{ incremental_predicate('zeroex_tx.block_time') }} {% endif %} {% if not is_incremental() %} AND zeroex_tx.block_time >= cast('{{zeroex_v3_start_date}}' as date) {% endif %} -), +), NewBridgeFill AS ( - SELECT + SELECT logs.tx_hash, logs.INDEX AS evt_index, logs.contract_address, @@ -207,7 +208,7 @@ NewBridgeFill AS ( AND logs.contract_address = 0xdb6f1920a889355780af7570773609bd8cb1f498 {% if is_incremental() %} - AND logs.block_time >= date_trunc('day', now() - interval '7' day) + AND {{ incremental_predicate('logs.block_time') }} {% endif %} {% if not is_incremental() %} AND logs.block_time >= cast('{{zeroex_v4_start_date}}' as date) @@ -215,7 +216,7 @@ NewBridgeFill AS ( ), direct_PLP AS ( - SELECT + SELECT plp.evt_tx_hash AS tx_hash, plp.evt_index AS evt_index, plp.contract_address, @@ -238,16 +239,16 @@ direct_PLP AS ( AND zeroex_tx.block_time = plp.evt_block_time {% if is_incremental() %} - WHERE evt_block_time >= date_trunc('day', now() - interval '7' day) + WHERE {{ incremental_predicate('evt_block_time') }} {% endif %} {% if not is_incremental() %} WHERE evt_block_time >= cast('{{zeroex_v3_start_date}}' as date) {% endif %} -), +), direct_uniswapv3 AS ( - SELECT + SELECT swap.evt_tx_hash AS tx_hash, swap.evt_index, swap.contract_address, @@ -269,13 +270,13 @@ direct_uniswapv3 AS ( WHERE 1=1 --sender = 0xdef1c0ded9bec7f1a1670819833240f027b25eff {% if is_incremental() %} - AND swap.evt_block_time >= date_trunc('day', now() - interval '7' day) + AND {{ incremental_predicate('swap.evt_block_time') }} {% endif %} {% if not is_incremental() %} AND swap.evt_block_time >= cast('{{zeroex_v4_start_date}}' as date) {% endif %} -), +), all_tx AS ( SELECT * @@ -283,25 +284,25 @@ all_tx AS ( UNION ALL SELECT * FROM ERC20BridgeTransfer - UNION ALL + UNION ALL SELECT * FROM v4_limit_fills_no_bridge - UNION ALL + UNION ALL SELECT * - FROM NewBridgeFill + FROM NewBridgeFill UNION ALL SELECT * FROM v4_rfq_fills_no_bridge UNION ALL SELECT * - FROM otc_fills - UNION ALL + FROM otc_fills + UNION ALL SELECT * from direct_uniswapv3 ) -SELECT distinct +SELECT distinct all_tx.tx_hash, - all_tx.block_number, + all_tx.block_number, all_tx.evt_index, all_tx.contract_address, all_tx.block_time, @@ -323,7 +324,7 @@ SELECT distinct swap_flag, matcha_limit_order_flag, CASE WHEN maker_token IN (0x2791bca1f2de4661ed88a30c99a7a9449aa84174, 0x7ceb23fd6bc0add59e62ac25578270cff1b9f619, 0x0d500b1d8e8ef31e21c99d1db9a6444d3adf1270, - 0xc2132d05d31c914a87c6611c10748aeb04b58e8f, 0x1bfd67037b42cf73acf2047067bd4f2c47d9bfd6, 0x8f3cf7ad23cd3cadbd9735aff958023239c6a063, + 0xc2132d05d31c914a87c6611c10748aeb04b58e8f, 0x1bfd67037b42cf73acf2047067bd4f2c47d9bfd6, 0x8f3cf7ad23cd3cadbd9735aff958023239c6a063, 0x3a58a54c066fdc0f2d55fc9c89f0415c92ebf3c4,0x7ceb23fd6bc0add59e62ac25578270cff1b9f619) AND mp.price IS NOT NULL THEN (all_tx.maker_token_amount_raw / pow(10, mp.decimals)) * mp.price WHEN taker_token IN (0x2791bca1f2de4661ed88a30c99a7a9449aa84174,0x7ceb23fd6bc0add59e62ac25578270cff1b9f619,0x0d500b1d8e8ef31e21c99d1db9a6444d3adf1270, @@ -341,7 +342,7 @@ FROM all_tx INNER JOIN {{ source('polygon', 'transactions')}} tx ON all_tx.tx_hash = tx.hash {% if is_incremental() %} -AND tx.block_time >= date_trunc('day', now() - interval '7' day) +AND {{ incremental_predicate('tx.block_time') }} {% endif %} {% if not is_incremental() %} AND tx.block_time >= cast('{{zeroex_v3_start_date}}' as date) @@ -357,7 +358,7 @@ AND CASE AND tp.blockchain = 'polygon' {% if is_incremental() %} -AND tp.minute >= date_trunc('day', now() - interval '7' day) +AND {{ incremental_predicate('tp.minute') }} {% endif %} {% if not is_incremental() %} AND tp.minute >= cast('{{zeroex_v3_start_date}}' as date) @@ -372,7 +373,7 @@ AND CASE AND mp.blockchain = 'polygon' {% if is_incremental() %} -AND mp.minute >= date_trunc('day', now() - interval '7' day) +AND {{ incremental_predicate('mp.minute') }} {% endif %} {% if not is_incremental() %} AND mp.minute >= cast('{{zeroex_v3_start_date}}' as date) diff --git a/models/zeroex/polygon/zeroex_polygon_api_fills_deduped.sql b/models/zeroex/polygon/zeroex_polygon_api_fills_deduped.sql index b70768786df..4cdd58e500b 100644 --- a/models/zeroex/polygon/zeroex_polygon_api_fills_deduped.sql +++ b/models/zeroex/polygon/zeroex_polygon_api_fills_deduped.sql @@ -1,13 +1,14 @@ {{ config( schema = 'zeroex_polygon', - + alias = 'api_fills_deduped', materialized='incremental', partition_by = ['block_month'], unique_key = ['block_date', 'tx_hash', 'evt_index'], on_schema_change='sync_all_columns', file_format ='delta', - incremental_strategy='merge' + incremental_strategy='merge', + incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.block_time')] ) }} @@ -24,11 +25,11 @@ AS WHERE 1=1 AND swap_flag = true {% if is_incremental() %} - AND block_time >= date_trunc('day', now() - interval '7' day) + AND {{ incremental_predicate('block_time') }} {% endif %} {% if not is_incremental() %} AND block_time >= cast('{{zeroex_v3_start_date}}' as date) - {% endif %} + {% endif %} ) , fills_first_last AS @@ -56,7 +57,7 @@ AS , MAX(CASE WHEN taker_consider_flag = 0 THEN NULL ELSE taker_token END ) AS taker_token , MAX(CASE WHEN maker_consider_flag = 0 THEN NULL ELSE maker_token END ) AS maker_token , MAX(CASE WHEN taker_consider_flag = 0 THEN NULL ELSE taker_symbol END ) AS taker_symbol - , MAX(CASE WHEN maker_consider_flag = 0 THEN NULL ELSE maker_symbol END ) AS maker_symbol + , MAX(CASE WHEN maker_consider_flag = 0 THEN NULL ELSE maker_symbol END ) AS maker_symbol , MAX(CASE WHEN taker_consider_flag = 0 THEN NULL ELSE taker_token_amount END) AS taker_token_amount , MAX(CASE WHEN maker_consider_flag = 0 THEN NULL ELSE maker_token_amount END) AS maker_token_amount , MAX(CASE WHEN taker_consider_flag = 0 THEN NULL ELSE taker_token_amount_raw END) AS taker_token_amount_raw @@ -92,7 +93,7 @@ SELECT a.blockchain , a.type , a.swap_flag , b.fills_within - , a.contract_address + , a.contract_address FROM fills_with_tx_fill_number a INNER JOIN deduped_bridge_fills b ON (a.tx_hash = b.tx_hash AND a.evt_index = b.evt_index) \ No newline at end of file diff --git a/models/zeroex/polygon/zeroex_polygon_native_fills.sql b/models/zeroex/polygon/zeroex_polygon_native_fills.sql index 9448ab9715b..548a6251a2b 100644 --- a/models/zeroex/polygon/zeroex_polygon_native_fills.sql +++ b/models/zeroex/polygon/zeroex_polygon_native_fills.sql @@ -5,15 +5,15 @@ unique_key = ['block_date', 'tx_hash', 'evt_index'], on_schema_change='sync_all_columns', file_format ='delta', - incremental_strategy='merge' + incremental_strategy='merge' ) }} {% set zeroex_v3_start_date = '2019-12-01' %} {% set zeroex_v4_start_date = '2021-01-06' %} --- Test Query here: -WITH +-- Test Query here: +WITH v3_fills AS ( SELECT fills.evt_block_time AS block_time @@ -28,14 +28,14 @@ WITH , CASE WHEN lower(tt.symbol) > lower(mt.symbol) THEN concat(mt.symbol, '-', tt.symbol) ELSE concat(tt.symbol, '-', mt.symbol) END AS token_pair , fills.takerAssetFilledAmount as taker_token_filled_amount_raw , fills.makerAssetFilledAmount as maker_token_filled_amount_raw - , fills.contract_address + , fills.contract_address , mt.symbol AS maker_symbol , fills.makerAssetFilledAmount / pow(10, mt.decimals) AS maker_asset_filled_amount , bytearray_substring(fills.takerAssetData, 8, 10) AS taker_token , tt.symbol AS taker_symbol , fills.takerAssetFilledAmount / pow(10, tt.decimals) AS taker_asset_filled_amount - , (fills.feeRecipientAddress in - (0x9b858be6e3047d88820f439b240deac2418a2551,0x86003b044f70dac0abc80ac8957305b6370893ed,0x5bc2419a087666148bfbe1361ae6c06d240c6131)) + , (fills.feeRecipientAddress in + (0x9b858be6e3047d88820f439b240deac2418a2551,0x86003b044f70dac0abc80ac8957305b6370893ed,0x5bc2419a087666148bfbe1361ae6c06d240c6131)) AS matcha_limit_order_flag , CASE WHEN tp.symbol = 'USDC' THEN (fills.takerAssetFilledAmount / 1e6) --don't multiply by anything as these assets are USD @@ -51,7 +51,7 @@ WITH ELSE COALESCE((fills.makerAssetFilledAmount / pow(10, mt.decimals))*mp.price,(fills.takerAssetFilledAmount / pow(10, tt.decimals))*tp.price) END AS volume_usd , fills.protocolFeePaid / 1e18 AS protocol_fee_paid_eth - FROM {{ source('zeroex_v3_polygon', 'Exchange_evt_Fill') }} fills + FROM {{ source('zeroex_v3_polygon', 'Exchange_evt_Fill') }} fills LEFT JOIN {{ source('prices', 'usd') }} tp ON date_trunc('minute', evt_block_time) = tp.minute and tp.blockchain = 'polygon' AND CASE @@ -68,15 +68,15 @@ WITH END = mp.contract_address LEFT OUTER JOIN {{ source('tokens', 'erc20') }} mt ON mt.contract_address = bytearray_substring(fills.makerAssetData, 8, 10) and mt.blockchain = 'polygon' LEFT OUTER JOIN {{ source('tokens', 'erc20') }} tt ON tt.contract_address = bytearray_substring(fills.takerAssetData, 8, 10) and tt.blockchain = 'polygon' - where 1=1 + where 1=1 {% if is_incremental() %} - AND evt_block_time >= date_trunc('day', now() - interval '7' day) + AND {{ incremental_predicate('evt_block_time') }} {% endif %} {% if not is_incremental() %} AND evt_block_time >= TIMESTAMP '{{zeroex_v3_start_date}}' {% endif %} ) - + , v4_limit_fills AS ( SELECT @@ -92,14 +92,14 @@ WITH , CASE WHEN lower(tt.symbol) > lower(mt.symbol) THEN concat(mt.symbol, '-', tt.symbol) ELSE concat(tt.symbol, '-', mt.symbol) END AS token_pair , fills.takerTokenFilledAmount as taker_token_filled_amount_raw , fills.makerTokenFilledAmount as maker_token_filled_amount_raw - , fills.contract_address + , fills.contract_address , mt.symbol AS maker_symbol , fills.makerTokenFilledAmount / pow(10, mt.decimals) AS maker_asset_filled_amount , fills.takerToken AS taker_token , tt.symbol AS taker_symbol , fills.takerTokenFilledAmount / pow(10, tt.decimals) AS taker_asset_filled_amount - , (fills.feeRecipient in - (0x9b858be6e3047d88820f439b240deac2418a2551,0x86003b044f70dac0abc80ac8957305b6370893ed,0x5bc2419a087666148bfbe1361ae6c06d240c6131)) + , (fills.feeRecipient in + (0x9b858be6e3047d88820f439b240deac2418a2551,0x86003b044f70dac0abc80ac8957305b6370893ed,0x5bc2419a087666148bfbe1361ae6c06d240c6131)) AS matcha_limit_order_flag , CASE WHEN tp.symbol = 'USDC' THEN (fills.takerTokenFilledAmount / 1e6) ----don't multiply by anything as these assets are USD @@ -132,9 +132,9 @@ WITH END = mp.contract_address LEFT OUTER JOIN {{ source('tokens', 'erc20') }} mt ON mt.contract_address = fills.makerToken and mt.blockchain = 'polygon' LEFT OUTER JOIN {{ source('tokens', 'erc20') }} tt ON tt.contract_address = fills.takerToken and tt.blockchain = 'polygon' - where 1=1 + where 1=1 {% if is_incremental() %} - AND evt_block_time >= date_trunc('day', now() - interval '7' day) + AND {{ incremental_predicate('evt_block_time') }} {% endif %} {% if not is_incremental() %} AND evt_block_time >= TIMESTAMP '{{zeroex_v3_start_date}}' @@ -155,7 +155,7 @@ WITH , CASE WHEN lower(tt.symbol) > lower(mt.symbol) THEN concat(mt.symbol, '-', tt.symbol) ELSE concat(tt.symbol, '-', mt.symbol) END AS token_pair , fills.takerTokenFilledAmount as taker_token_filled_amount_raw , fills.makerTokenFilledAmount as maker_token_filled_amount_raw - , fills.contract_address + , fills.contract_address , mt.symbol AS maker_symbol , fills.makerTokenFilledAmount / pow(10, mt.decimals) AS maker_asset_filled_amount , fills.takerToken AS taker_token @@ -193,9 +193,9 @@ WITH END = mp.contract_address LEFT OUTER JOIN {{ source('tokens', 'erc20') }} mt ON mt.contract_address = fills.makerToken and mt.blockchain = 'polygon' LEFT OUTER JOIN {{ source('tokens', 'erc20') }} tt ON tt.contract_address = fills.takerToken and tt.blockchain = 'polygon' - where 1=1 + where 1=1 {% if is_incremental() %} - AND evt_block_time >= date_trunc('day', now() - interval '7' day) + AND {{ incremental_predicate('evt_block_time') }} {% endif %} {% if not is_incremental() %} AND evt_block_time >= TIMESTAMP '{{zeroex_v3_start_date}}' @@ -215,7 +215,7 @@ WITH , CASE WHEN lower(tt.symbol) > lower(mt.symbol) THEN concat(mt.symbol, '-', tt.symbol) ELSE concat(tt.symbol, '-', mt.symbol) END AS token_pair , fills.takerTokenFilledAmount as taker_token_filled_amount_raw , fills.makerTokenFilledAmount as maker_token_filled_amount_raw - , fills.contract_address + , fills.contract_address , mt.symbol AS maker_symbol , fills.makerTokenFilledAmount / pow(10, mt.decimals) AS maker_asset_filled_amount , fills.takerToken AS taker_token @@ -253,9 +253,9 @@ WITH END = mp.contract_address LEFT OUTER JOIN {{ source('tokens', 'erc20') }} mt ON mt.contract_address = fills.makerToken and mt.blockchain = 'polygon' LEFT OUTER JOIN {{ source('tokens', 'erc20') }} tt ON tt.contract_address = fills.takerToken and tt.blockchain = 'polygon' - where 1=1 + where 1=1 {% if is_incremental() %} - AND evt_block_time >= date_trunc('day', now() - interval '7' day) + AND {{ incremental_predicate('evt_block_time') }} {% endif %} {% if not is_incremental() %} AND evt_block_time >= TIMESTAMP '{{zeroex_v3_start_date}}' @@ -315,7 +315,7 @@ WITH FROM v4_rfq_fills UNION ALL - + SELECT block_time , block_number @@ -340,8 +340,8 @@ WITH , protocol_fee_paid_eth FROM otc_fills ) - SELECT distinct - all_fills.block_time AS block_time, + SELECT distinct + all_fills.block_time AS block_time, all_fills.block_number, protocol_version as version, date_trunc('day', all_fills.block_time) as block_date, @@ -371,9 +371,8 @@ WITH INNER JOIN {{ source('polygon', 'transactions')}} tx ON all_fills.transaction_hash = tx.hash AND all_fills.block_number = tx.block_number {% if is_incremental() %} - AND tx.block_time >= date_trunc('day', now() - interval '7' day) + AND {{ incremental_predicate('tx.block_time') }} {% endif %} {% if not is_incremental() %} AND tx.block_time >= TIMESTAMP '{{zeroex_v3_start_date}}' {% endif %} - \ No newline at end of file diff --git a/models/zeroex/polygon/zeroex_polygon_nft_fills.sql b/models/zeroex/polygon/zeroex_polygon_nft_fills.sql index 1aad6647a29..c59c022a550 100644 --- a/models/zeroex/polygon/zeroex_polygon_nft_fills.sql +++ b/models/zeroex/polygon/zeroex_polygon_nft_fills.sql @@ -7,6 +7,7 @@ tags=['prod_exclude'], on_schema_change='sync_all_columns', file_format ='delta', incremental_strategy='merge', + incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.block_time')], post_hook='{{ expose_spells(\'["polygon"]\', "project", "zeroex", @@ -44,7 +45,7 @@ WITH tbl_cte_transaction AS FROM {{ source ('zeroex_polygon', 'ExchangeProxy_evt_ERC721OrderFilled') }} WHERE 1 = 1 {% if is_incremental() %} - AND evt_block_time >= date_trunc('day', now() - interval '1 week') + AND {{ incremental_predicate('evt_block_time') }} {% endif %} {% if not is_incremental() %} AND evt_block_time >= '{{zeroex_v4_nft_start_date}}' @@ -72,7 +73,7 @@ WITH tbl_cte_transaction AS FROM {{ source ('zeroex_polygon', 'ExchangeProxy_evt_ERC1155OrderFilled') }} WHERE 1 = 1 {% if is_incremental() %} - AND evt_block_time >= date_trunc('day', now() - interval '1 week') + AND {{ incremental_predicate('evt_block_time') }} {% endif %} {% if not is_incremental() %} AND evt_block_time >= '{{zeroex_v4_nft_start_date}}' From 8619be187ef8f5e67c054fb0e1401741799c6ec7 Mon Sep 17 00:00:00 2001 From: Alan Ghobadi Date: Tue, 4 Jun 2024 18:07:25 +0200 Subject: [PATCH 033/149] Incremental predicate various models (#6066) * Use incremental predicates for gitcoin models * Use incremental predicates for gas fees * Ethereum staking deposits --- models/gas/arbitrum/gas_arbitrum_fees.sql | 23 ++++++------- .../gas/arbitrum/gas_arbitrum_fees_traces.sql | 19 ++++++----- .../gas/avalanche_c/gas_avalanche_c_fees.sql | 33 ++++++++++--------- .../gas_avalanche_c_fees_traces.sql | 19 ++++++----- models/gas/base/gas_base_fees.sql | 11 ++++--- models/gas/bnb/gas_bnb_fees.sql | 27 +++++++-------- models/gas/ethereum/gas_ethereum_fees.sql | 33 ++++++++++--------- .../gas/ethereum/gas_ethereum_fees_traces.sql | 19 ++++++----- models/gas/fantom/gas_fantom_fees_traces.sql | 19 ++++++----- models/gas/gnosis/gas_gnosis_fees_traces.sql | 19 ++++++----- models/gas/optimism/gas_optimism_fees.sql | 27 +++++++-------- .../gas/optimism/gas_optimism_fees_traces.sql | 10 +++--- .../gas/polygon/gas_polygon_fees_traces.sql | 19 ++++++----- models/gas/scroll/gas_scroll_fees.sql | 11 ++++--- models/gas/zksync/gas_zksync_fees.sql | 11 ++++--- models/gas/zora/gas_zora_fees.sql | 11 ++++--- .../ethereum/gitcoin_ethereum_donations.sql | 5 +-- .../polygon/gitcoin_polygon_donations.sql | 7 ++-- .../ethereum/staking_ethereum_deposits.sql | 7 ++-- 19 files changed, 174 insertions(+), 156 deletions(-) diff --git a/models/gas/arbitrum/gas_arbitrum_fees.sql b/models/gas/arbitrum/gas_arbitrum_fees.sql index 02ebaf7e599..deafec33444 100644 --- a/models/gas/arbitrum/gas_arbitrum_fees.sql +++ b/models/gas/arbitrum/gas_arbitrum_fees.sql @@ -4,24 +4,25 @@ partition_by = ['block_month'], materialized = 'incremental', file_format = 'delta', - incremental_strategy = 'merge', + incremental_strategy='merge', + incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.block_time')], unique_key = ['tx_hash','block_number'] ) }} -SELECT +SELECT 'arbitrum' as blockchain, date_trunc('day', block_time) AS block_date, CAST(date_trunc('month', block_time) AS DATE) AS block_month, block_number, block_time, txns.hash AS tx_hash, - txns."from" AS tx_sender, + txns."from" AS tx_sender, txns.to AS tx_receiver, 'ETH' as native_token_symbol, value/1e18 AS tx_amount_native, value/1e18 * p.price AS tx_amount_usd, - (effective_gas_price / 1e18) * txns.gas_used as tx_fee_native, + (effective_gas_price / 1e18) * txns.gas_used as tx_fee_native, (effective_gas_price / 1e18) * txns.gas_used * p.price AS tx_fee_usd, cast(NULL as double) AS burned_native, -- Not applicable for L2s cast(NULL as double) AS burned_usd, -- Not applicable for L2s @@ -32,7 +33,7 @@ SELECT txns.gas_price/1e18 * p.price as gas_price_bid_usd, txns.gas_used as gas_used, txns.gas_limit as gas_limit, - CASE + CASE WHEN txns.gas_limit = 0 THEN NULL WHEN txns.gas_limit != 0 THEN txns.gas_used / txns.gas_limit * 100 END AS gas_usage_percent, @@ -41,15 +42,15 @@ SELECT FROM {{ source('arbitrum','transactions') }} txns JOIN {{ source('arbitrum','blocks') }} blocks ON blocks.number = txns.block_number {% if is_incremental() %} -AND block_time >= date_trunc('day', now() - interval '2' day) -AND blocks.time >= date_trunc('day', now() - interval '2' day) +AND {{ incremental_predicate('block_time') }} +AND {{ incremental_predicate('blocks.time') }} {% endif %} LEFT JOIN {{ source('prices','usd') }} p ON p.minute = date_trunc('minute', block_time) AND p.blockchain = 'arbitrum' AND p.symbol = 'WETH' {% if is_incremental() %} -AND p.minute >= date_trunc('day', now() - interval '2' day) -WHERE block_time >= date_trunc('day', now() - interval '2' day) -AND blocks.time >= date_trunc('day', now() - interval '2' day) -AND p.minute >= date_trunc('day', now() - interval '2' day) +AND {{ incremental_predicate('p.minute') }} +WHERE {{ incremental_predicate('block_time') }} +AND {{ incremental_predicate('blocks.time') }} +AND {{ incremental_predicate('p.minute') }} {% endif %} \ No newline at end of file diff --git a/models/gas/arbitrum/gas_arbitrum_fees_traces.sql b/models/gas/arbitrum/gas_arbitrum_fees_traces.sql index 6fba7bc812d..14399c0df50 100644 --- a/models/gas/arbitrum/gas_arbitrum_fees_traces.sql +++ b/models/gas/arbitrum/gas_arbitrum_fees_traces.sql @@ -5,7 +5,8 @@ tags=['prod_exclude'], partition_by = ['block_date'], materialized = 'incremental', file_format = 'delta', - incremental_strategy = 'merge', + incremental_strategy='merge', + incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.block_time')], unique_key = ['tx_hash', 'trace'], ) }} @@ -46,13 +47,13 @@ WITH traces AS ( , tx_success FROM {{ source('arbitrum','traces') }} {% if is_incremental() %} - WHERE block_time >= date_trunc("day", NOW() - interval '1 days') + WHERE {{ incremental_predicate('block_time') }} {% endif %} - + UNION ALL - - SELECT CAST(NULL AS varchar(1)) AS from - , CAST(NULL AS varchar(1)) AS to + + SELECT CAST(NULL AS varchar(1)) AS from + , CAST(NULL AS varchar(1)) AS to , tx_hash , slice(trace_address, 1, cardinality(trace_address) - 1) AS trace , CAST(NULL AS double) AS gas_used_original @@ -67,7 +68,7 @@ WITH traces AS ( FROM {{ source('arbitrum','traces') }} WHERE cardinality(trace_address) > 0 {% if is_incremental() %} - AND block_time >= date_trunc("day", NOW() - interval '1 days') + AND {{ incremental_predicate('block_time') }} {% endif %} ) traces GROUP BY traces.tx_hash, traces.trace, traces.block_time, traces.block_number @@ -104,11 +105,11 @@ FROM traces INNER JOIN {{ source('arbitrum','transactions') }} txs ON txs.block_time=traces.block_time AND txs.hash=traces.tx_hash {% if is_incremental() %} - AND txs.block_time >= date_trunc("day", NOW() - interval '1 days') + AND {{ incremental_predicate('txs.block_time') }} {% endif %} LEFT JOIN {{ source('prices', 'usd') }} pu ON pu.minute=date_trunc('minute', traces.block_time) AND pu.blockchain='arbitrum' AND pu.contract_address='0x82af49447d8a07e3bd95bd0d56f35241523fbab1' {% if is_incremental() %} - AND pu.minute >= date_trunc("day", NOW() - interval '1' week) + AND {{ incremental_predicate('pu.minute') }} {% endif %} \ No newline at end of file diff --git a/models/gas/avalanche_c/gas_avalanche_c_fees.sql b/models/gas/avalanche_c/gas_avalanche_c_fees.sql index 378b32d0285..fd9502baad9 100644 --- a/models/gas/avalanche_c/gas_avalanche_c_fees.sql +++ b/models/gas/avalanche_c/gas_avalanche_c_fees.sql @@ -4,35 +4,36 @@ partition_by = ['block_month'], materialized = 'incremental', file_format = 'delta', - incremental_strategy = 'merge', + incremental_strategy='merge', + incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.block_time')], unique_key = ['tx_hash'] ) }} -SELECT +SELECT 'avalanche_c' as blockchain, date_trunc('day', block_time) AS block_date, CAST(date_trunc('month', block_time) AS DATE) AS block_month, block_number, block_time, txns.hash AS tx_hash, - txns."from" AS tx_sender, + txns."from" AS tx_sender, txns.to AS tx_receiver, 'AVAX' as native_token_symbol, value/1e18 AS tx_amount_native, value/1e18 * p.price AS tx_amount_usd, CASE WHEN type = 'Legacy' THEN (gas_price/1e18) * txns.gas_used WHEN type = 'DynamicFee' THEN ((base_fee_per_gas + priority_fee_per_gas)/1e18) * txns.gas_used - END AS tx_fee_native, - CASE WHEN type = 'Legacy' THEN (gas_price/1e18) * txns.gas_used * p.price - WHEN type = 'DynamicFee' THEN ((base_fee_per_gas + priority_fee_per_gas)/1e18 * txns.gas_used) * p.price + END AS tx_fee_native, + CASE WHEN type = 'Legacy' THEN (gas_price/1e18) * txns.gas_used * p.price + WHEN type = 'DynamicFee' THEN ((base_fee_per_gas + priority_fee_per_gas)/1e18 * txns.gas_used) * p.price END AS tx_fee_usd, CASE WHEN type = 'Legacy' THEN (gas_price/1e18) * txns.gas_used WHEN type = 'DynamicFee' THEN ((base_fee_per_gas + priority_fee_per_gas)/1e18) * txns.gas_used - END AS burned_native, - CASE WHEN type = 'Legacy' THEN (gas_price /1e18) * txns.gas_used * p.price - WHEN type = 'DynamicFee' THEN ((base_fee_per_gas + priority_fee_per_gas)/1e18) * txns.gas_used * p.price + END AS burned_native, + CASE WHEN type = 'Legacy' THEN (gas_price /1e18) * txns.gas_used * p.price + WHEN type = 'DynamicFee' THEN ((base_fee_per_gas + priority_fee_per_gas)/1e18) * txns.gas_used * p.price END AS burned_usd, (max_fee_per_gas - priority_fee_per_gas - base_fee_per_gas) / 1e18 * txns.gas_used AS tx_savings_native, (max_fee_per_gas - priority_fee_per_gas - base_fee_per_gas) / 1e18 * txns.gas_used * p.price AS tx_savings_usd, @@ -47,7 +48,7 @@ SELECT gas_price / 1e18 * p.price AS gas_price_usd, txns.gas_used, txns.gas_limit, - CASE + CASE WHEN txns.gas_limit = 0 THEN NULL WHEN txns.gas_limit != 0 THEN txns.gas_used / txns.gas_limit * 100 END AS gas_usage_percent, @@ -56,14 +57,14 @@ SELECT FROM {{ source('avalanche_c','transactions') }} txns JOIN {{ source('avalanche_c','blocks') }} blocks ON blocks.number = txns.block_number {% if is_incremental() %} -AND block_time >= date_trunc('day', now() - interval '2' day) -AND blocks.time >= date_trunc('day', now() - interval '2' day) +AND {{ incremental_predicate('block_time') }} +AND {{ incremental_predicate('blocks.time') }} {% endif %} LEFT JOIN {{ source('prices','usd') }} p ON p.minute = date_trunc('minute', block_time) AND p.symbol = 'AVAX' and p.blockchain is null {% if is_incremental() %} -AND p.minute >= date_trunc('day', now() - interval '2' day) -WHERE block_time >= date_trunc('day', now() - interval '2' day) -AND blocks.time >= date_trunc('day', now() - interval '2' day) -AND p.minute >= date_trunc('day', now() - interval '2' day) +AND {{ incremental_predicate('p.minute') }} +WHERE {{ incremental_predicate('block_time') }} +AND {{ incremental_predicate('blocks.time') }} +AND {{ incremental_predicate('p.minute') }} {% endif %} diff --git a/models/gas/avalanche_c/gas_avalanche_c_fees_traces.sql b/models/gas/avalanche_c/gas_avalanche_c_fees_traces.sql index 47d34eb097a..2388ec14886 100644 --- a/models/gas/avalanche_c/gas_avalanche_c_fees_traces.sql +++ b/models/gas/avalanche_c/gas_avalanche_c_fees_traces.sql @@ -5,7 +5,8 @@ tags=['prod_exclude'], partition_by = ['block_date'], materialized = 'incremental', file_format = 'delta', - incremental_strategy = 'merge', + incremental_strategy='merge', + incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.block_time')], unique_key = ['tx_hash', 'trace'], ) }} @@ -46,13 +47,13 @@ WITH traces AS ( , tx_success FROM {{ source('avalanche_c','traces') }} {% if is_incremental() %} - WHERE block_time >= date_trunc("day", NOW() - interval '1 days') + WHERE {{ incremental_predicate('block_time') }} {% endif %} - + UNION ALL - - SELECT CAST(NULL AS varchar(1)) AS from - , CAST(NULL AS varchar(1)) AS to + + SELECT CAST(NULL AS varchar(1)) AS from + , CAST(NULL AS varchar(1)) AS to , tx_hash , slice(trace_address, 1, cardinality(trace_address) - 1) AS trace , CAST(NULL AS double) AS gas_used_original @@ -67,7 +68,7 @@ WITH traces AS ( FROM {{ source('avalanche_c','traces') }} WHERE cardinality(trace_address) > 0 {% if is_incremental() %} - AND block_time >= date_trunc("day", NOW() - interval '1 days') + AND {{ incremental_predicate('block_time') }} {% endif %} ) traces GROUP BY traces.tx_hash, traces.trace, traces.block_time, traces.block_number @@ -104,11 +105,11 @@ FROM traces INNER JOIN {{ source('avalanche_c','transactions') }} txs ON txs.block_time=traces.block_time AND txs.hash=traces.tx_hash {% if is_incremental() %} - AND txs.block_time >= date_trunc("day", NOW() - interval '1 days') + AND {{ incremental_predicate('txs.block_time') }} {% endif %} LEFT JOIN {{ source('prices', 'usd') }} pu ON pu.minute=date_trunc('minute', traces.block_time) AND pu.blockchain='avalanche_c' AND pu.contract_address='0xb31f66aa3c1e785363f0875a1b74e27b85fd66c7' {% if is_incremental() %} - AND pu.minute >= date_trunc("day", NOW() - interval '1' week) + AND {{ incremental_predicate('pu.minute') }} {% endif %} diff --git a/models/gas/base/gas_base_fees.sql b/models/gas/base/gas_base_fees.sql index c9f226193d9..db43b4783cd 100644 --- a/models/gas/base/gas_base_fees.sql +++ b/models/gas/base/gas_base_fees.sql @@ -4,24 +4,25 @@ partition_by = ['block_month'], materialized = 'incremental', file_format = 'delta', - incremental_strategy = 'merge', + incremental_strategy='merge', + incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.block_time')], unique_key = ['tx_hash','block_number'] ) }} -SELECT +SELECT 'base' as blockchain, date_trunc('day', block_time) AS block_date, CAST(date_trunc('month', block_time) AS DATE) AS block_month, block_number, block_time, txns.hash AS tx_hash, - txns."from" AS tx_sender, + txns."from" AS tx_sender, txns.to AS tx_receiver, 'ETH' as native_token_symbol, value/1e18 AS tx_amount_native, value/1e18 * p.price AS tx_amount_usd, - (l1_fee/1e18 + ((txns.gas_used/1e18) * txns.gas_price)) as tx_fee_native, + (l1_fee/1e18 + ((txns.gas_used/1e18) * txns.gas_price)) as tx_fee_native, (l1_fee/1e18 + ((txns.gas_used/1e18) * txns.gas_price)) * p.price AS tx_fee_usd, cast(NULL as double) AS burned_native, -- Not applicable for L2s cast(NULL as double) AS burned_usd, -- Not applicable for L2s @@ -30,7 +31,7 @@ SELECT txns.gas_price/1e18 * p.price as gas_price_usd, txns.gas_used as gas_used, txns.gas_limit as gas_limit, - CASE + CASE WHEN txns.gas_limit = 0 THEN NULL WHEN txns.gas_limit != 0 THEN txns.gas_used / txns.gas_limit * 100 END AS gas_usage_percent, diff --git a/models/gas/bnb/gas_bnb_fees.sql b/models/gas/bnb/gas_bnb_fees.sql index 8f29bdfce0f..292598b21ce 100644 --- a/models/gas/bnb/gas_bnb_fees.sql +++ b/models/gas/bnb/gas_bnb_fees.sql @@ -4,34 +4,35 @@ partition_by = ['block_month'], materialized = 'incremental', file_format = 'delta', - incremental_strategy = 'merge', + incremental_strategy='merge', + incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.block_time')], unique_key = ['tx_hash'] ) }} -SELECT +SELECT 'bnb' as blockchain, date_trunc('day', block_time) AS block_date, CAST(date_trunc('month', block_time) AS DATE) AS block_month, block_number, block_time, txns.hash AS tx_hash, - txns."from" AS tx_sender, + txns."from" AS tx_sender, txns.to AS tx_receiver, 'BNB' as native_token_symbol, value/1e18 AS tx_amount_native, value/1e18 * p.price AS tx_amount_usd, - gas_price / 1e18 * txns.gas_used AS tx_fee_native, + gas_price / 1e18 * txns.gas_used AS tx_fee_native, gas_price / 1e18 * txns.gas_used * p.price AS tx_fee_usd, - CASE WHEN block_number >= 13082000 AND txns.to = 0x0000000000000000000000000000000000001000 THEN value/1e18 * 10 / 100 + CASE WHEN block_number >= 13082000 AND txns.to = 0x0000000000000000000000000000000000001000 THEN value/1e18 * 10 / 100 ELSE cast(NULL as double) END AS burned_native, -- change after BEP95 - CASE WHEN block_number >= 13082000 AND txns.to = 0x0000000000000000000000000000000000001000 THEN value/1e18 * 10 / 100 * p.price + CASE WHEN block_number >= 13082000 AND txns.to = 0x0000000000000000000000000000000000001000 THEN value/1e18 * 10 / 100 * p.price ELSE cast(NULL as double) END AS burned_usd, -- change after BEP95 miner AS validator, gas_price /1e9 AS gas_price_gwei, gas_price / 1e18 * p.price AS gas_price_usd, txns.gas_used, - CASE + CASE WHEN txns.gas_limit = 0 THEN NULL WHEN txns.gas_limit != 0 THEN txns.gas_used / txns.gas_limit * 100 END AS gas_usage_percent, @@ -41,15 +42,15 @@ SELECT FROM {{ source('bnb','transactions') }} txns JOIN {{ source('bnb','blocks') }} blocks ON blocks.number = txns.block_number {% if is_incremental() %} -AND block_time >= date_trunc('day', now() - interval '2' day) -AND blocks.time >= date_trunc('day', now() - interval '2' day) +AND {{ incremental_predicate('block_time') }} +AND {{ incremental_predicate('blocks.time') }} {% endif %} LEFT JOIN {{ source('prices', 'usd') }} p ON p.minute = date_trunc('minute', block_time) AND p.blockchain = 'ethereum' AND p.symbol = 'BNB' {% if is_incremental() %} -AND p.minute >= date_trunc('day', now() - interval '2' day) -WHERE block_time >= date_trunc('day', now() - interval '2' day) -AND blocks.time >= date_trunc('day', now() - interval '2' day) -AND p.minute >= date_trunc('day', now() - interval '2' day) +AND {{ incremental_predicate('p.minute') }} +WHERE {{ incremental_predicate('block_time') }} +AND {{ incremental_predicate('blocks.time') }} +AND {{ incremental_predicate('p.minute') }} {% endif %} \ No newline at end of file diff --git a/models/gas/ethereum/gas_ethereum_fees.sql b/models/gas/ethereum/gas_ethereum_fees.sql index 82196dbbe9b..f2b17e66766 100644 --- a/models/gas/ethereum/gas_ethereum_fees.sql +++ b/models/gas/ethereum/gas_ethereum_fees.sql @@ -4,32 +4,33 @@ partition_by = ['block_month'], materialized = 'incremental', file_format = 'delta', - incremental_strategy = 'merge', + incremental_strategy='merge', + incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.block_time')], unique_key = ['tx_hash'] ) }} -SELECT +SELECT 'ethereum' as blockchain, date_trunc('day', block_time) AS block_date, CAST(date_trunc('month', block_time) AS DATE) AS block_month, block_number, block_time, txns.hash AS tx_hash, - txns."from" AS tx_sender, + txns."from" AS tx_sender, txns.to AS tx_receiver, 'ETH' as native_token_symbol, value/1e18 AS tx_amount_native, value/1e18 * p.price AS tx_amount_usd, CASE WHEN type = 'Legacy' THEN (cast(gas_price as double)/1e18 * cast(txns.gas_used as double)) WHEN type = 'AccessList' THEN (cast(gas_price as double)/1e18 * cast(txns.gas_used as double)) - WHEN type = 'DynamicFee' THEN ((cast(base_fee_per_gas as double)/1e18 + cast(priority_fee_per_gas as double)/1e18)* cast(txns.gas_used as double)) - END AS tx_fee_native, - CASE WHEN type = 'Legacy' THEN (cast(gas_price as double)/1e18 * cast(txns.gas_used as double)) * p.price - WHEN type = 'AccessList' THEN (cast(gas_price as double)/1e18 * cast(txns.gas_used as double)) * p.price - WHEN type = 'DynamicFee' THEN ((cast(base_fee_per_gas as double)/1e18 + cast(priority_fee_per_gas as double)/1e18)* cast(txns.gas_used as double)) * p.price + WHEN type = 'DynamicFee' THEN ((cast(base_fee_per_gas as double)/1e18 + cast(priority_fee_per_gas as double)/1e18)* cast(txns.gas_used as double)) + END AS tx_fee_native, + CASE WHEN type = 'Legacy' THEN (cast(gas_price as double)/1e18 * cast(txns.gas_used as double)) * p.price + WHEN type = 'AccessList' THEN (cast(gas_price as double)/1e18 * cast(txns.gas_used as double)) * p.price + WHEN type = 'DynamicFee' THEN ((cast(base_fee_per_gas as double)/1e18 + cast(priority_fee_per_gas as double)/1e18)* cast(txns.gas_used as double)) * p.price END AS tx_fee_usd, - base_fee_per_gas / 1e18 * txns.gas_used AS burned_native, + base_fee_per_gas / 1e18 * txns.gas_used AS burned_native, base_fee_per_gas / 1e18 * txns.gas_used * p.price AS burned_usd, (max_fee_per_gas - priority_fee_per_gas - base_fee_per_gas) / 1e18 * txns.gas_used AS tx_savings_native, ((max_fee_per_gas - priority_fee_per_gas - base_fee_per_gas) /1e18 * txns.gas_used) * p.price AS tx_savings_usd, @@ -44,7 +45,7 @@ SELECT gas_price / 1e18 * p.price AS gas_price_usd, txns.gas_used, txns.gas_limit, - CASE + CASE WHEN txns.gas_limit = 0 THEN NULL WHEN txns.gas_limit != 0 THEN txns.gas_used / txns.gas_limit * 100 END AS gas_usage_percent, @@ -53,15 +54,15 @@ SELECT FROM {{ source('ethereum','transactions') }} txns JOIN {{ source('ethereum','blocks') }} blocks ON blocks.number = txns.block_number {% if is_incremental() %} -AND block_time >= date_trunc('day', now() - interval '2' day) -AND blocks.time >= date_trunc('day', now() - interval '2' day) +AND {{ incremental_predicate('block_time') }} +AND {{ incremental_predicate('blocks.time') }} {% endif %} LEFT JOIN {{ source('prices','usd') }} p ON p.minute = date_trunc('minute', block_time) AND p.blockchain = 'ethereum' AND p.symbol = 'WETH' {% if is_incremental() %} -AND p.minute >= date_trunc('day', now() - interval '2' day) -WHERE block_time >= date_trunc('day', now() - interval '2' day) -AND blocks.time >= date_trunc('day', now() - interval '2' day) -AND p.minute >= date_trunc('day', now() - interval '2' day) +AND {{ incremental_predicate('p.minute') }} +WHERE {{ incremental_predicate('block_time') }} +AND {{ incremental_predicate('blocks.time') }} +AND {{ incremental_predicate('p.minute') }} {% endif %} \ No newline at end of file diff --git a/models/gas/ethereum/gas_ethereum_fees_traces.sql b/models/gas/ethereum/gas_ethereum_fees_traces.sql index 865dd30d533..3c2d28a706a 100644 --- a/models/gas/ethereum/gas_ethereum_fees_traces.sql +++ b/models/gas/ethereum/gas_ethereum_fees_traces.sql @@ -5,7 +5,8 @@ tags=['prod_exclude'], partition_by = ['block_date'], materialized = 'incremental', file_format = 'delta', - incremental_strategy = 'merge', + incremental_strategy='merge', + incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.block_time')], unique_key = ['tx_hash', 'trace'], ) }} @@ -46,13 +47,13 @@ WITH traces AS ( , tx_success FROM {{ source('ethereum','traces') }} {% if is_incremental() %} - WHERE block_time >= date_trunc("day", NOW() - interval '1 days') + WHERE {{ incremental_predicate('block_time') }} {% endif %} - + UNION ALL - - SELECT CAST(NULL AS varchar(1)) AS from - , CAST(NULL AS varchar(1)) AS to + + SELECT CAST(NULL AS varchar(1)) AS from + , CAST(NULL AS varchar(1)) AS to , tx_hash , slice(trace_address, 1, cardinality(trace_address) - 1) AS trace , CAST(NULL AS double) AS gas_used_original @@ -67,7 +68,7 @@ WITH traces AS ( FROM {{ source('ethereum','traces') }} WHERE cardinality(trace_address) > 0 {% if is_incremental() %} - AND block_time >= date_trunc("day", NOW() - interval '1 days') + AND {{ incremental_predicate('block_time') }} {% endif %} ) traces GROUP BY traces.tx_hash, traces.trace, traces.block_time, traces.block_number @@ -104,11 +105,11 @@ FROM traces INNER JOIN {{ source('ethereum','transactions') }} txs ON txs.block_time=traces.block_time AND txs.hash=traces.tx_hash {% if is_incremental() %} - AND txs.block_time >= date_trunc("day", NOW() - interval '1 days') + AND {{ incremental_predicate('txs.block_time') }} {% endif %} LEFT JOIN {{ source('prices', 'usd') }} pu ON pu.minute=date_trunc('minute', traces.block_time) AND pu.blockchain='ethereum' AND pu.contract_address='0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2' {% if is_incremental() %} - AND pu.minute >= date_trunc("day", NOW() - interval '1' week) + AND {{ incremental_predicate('pu.minute') }} {% endif %} diff --git a/models/gas/fantom/gas_fantom_fees_traces.sql b/models/gas/fantom/gas_fantom_fees_traces.sql index 1a838bb2e99..276d997b4fa 100644 --- a/models/gas/fantom/gas_fantom_fees_traces.sql +++ b/models/gas/fantom/gas_fantom_fees_traces.sql @@ -5,7 +5,8 @@ tags=['prod_exclude'], partition_by = ['block_date'], materialized = 'incremental', file_format = 'delta', - incremental_strategy = 'merge', + incremental_strategy='merge', + incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.block_time')], unique_key = ['tx_hash', 'trace'], ) }} @@ -46,13 +47,13 @@ WITH traces AS ( , tx_success FROM {{ source('fantom','traces') }} {% if is_incremental() %} - WHERE block_time >= date_trunc("day", NOW() - interval '1 days') + WHERE {{ incremental_predicate('block_time') }} {% endif %} - + UNION ALL - - SELECT CAST(NULL AS varchar(1)) AS from - , CAST(NULL AS varchar(1)) AS to + + SELECT CAST(NULL AS varchar(1)) AS from + , CAST(NULL AS varchar(1)) AS to , tx_hash , slice(trace_address, 1, cardinality(trace_address) - 1) AS trace , CAST(NULL AS double) AS gas_used_original @@ -67,7 +68,7 @@ WITH traces AS ( FROM {{ source('fantom','traces') }} WHERE cardinality(trace_address) > 0 {% if is_incremental() %} - AND block_time >= date_trunc("day", NOW() - interval '1 days') + AND {{ incremental_predicate('block_time') }} {% endif %} ) traces GROUP BY traces.tx_hash, traces.trace, traces.block_time, traces.block_number @@ -104,11 +105,11 @@ FROM traces INNER JOIN {{ source('fantom','transactions') }} txs ON txs.block_time=traces.block_time AND txs.hash=traces.tx_hash {% if is_incremental() %} - AND txs.block_time >= date_trunc("day", NOW() - interval '1 days') + AND {{ incremental_predicate('txs.block_time') }} {% endif %} LEFT JOIN {{ source('prices', 'usd') }} pu ON pu.minute=date_trunc('minute', traces.block_time) AND pu.blockchain='fantom' AND pu.contract_address='0x21be370d5312f44cb42ce377bc9b8a0cef1a4c83' {% if is_incremental() %} - AND pu.minute >= date_trunc("day", NOW() - interval '1' week) + AND {{ incremental_predicate('pu.minute') }} {% endif %} diff --git a/models/gas/gnosis/gas_gnosis_fees_traces.sql b/models/gas/gnosis/gas_gnosis_fees_traces.sql index c4073da8301..22c7c504dbf 100644 --- a/models/gas/gnosis/gas_gnosis_fees_traces.sql +++ b/models/gas/gnosis/gas_gnosis_fees_traces.sql @@ -5,7 +5,8 @@ tags=['prod_exclude'], partition_by = ['block_date'], materialized = 'incremental', file_format = 'delta', - incremental_strategy = 'merge', + incremental_strategy='merge', + incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.block_time')], unique_key = ['tx_hash', 'trace'], ) }} @@ -46,13 +47,13 @@ WITH traces AS ( , tx_success FROM {{ source('gnosis','traces') }} {% if is_incremental() %} - WHERE block_time >= date_trunc("day", NOW() - interval '1 days') + WHERE {{ incremental_predicate('block_time') }} {% endif %} - + UNION ALL - - SELECT CAST(NULL AS varchar(1)) AS from - , CAST(NULL AS varchar(1)) AS to + + SELECT CAST(NULL AS varchar(1)) AS from + , CAST(NULL AS varchar(1)) AS to , tx_hash , slice(trace_address, 1, cardinality(trace_address) - 1) AS trace , CAST(NULL AS double) AS gas_used_original @@ -67,7 +68,7 @@ WITH traces AS ( FROM {{ source('gnosis','traces') }} WHERE cardinality(trace_address) > 0 {% if is_incremental() %} - AND block_time >= date_trunc("day", NOW() - interval '1 days') + AND {{ incremental_predicate('block_time') }} {% endif %} ) traces GROUP BY traces.tx_hash, traces.trace, traces.block_time, traces.block_number @@ -104,11 +105,11 @@ FROM traces INNER JOIN {{ source('gnosis','transactions') }} txs ON txs.block_time=traces.block_time AND txs.hash=traces.tx_hash {% if is_incremental() %} - AND txs.block_time >= date_trunc("day", NOW() - interval '1 days') + AND {{ incremental_predicate('txs.block_time') }} {% endif %} LEFT JOIN {{ source('prices', 'usd') }} pu ON pu.minute=date_trunc('minute', traces.block_time) AND pu.blockchain='gnosis' AND pu.contract_address='0xe91d153e0b41518a2ce8dd3d7944fa863463a97d' {% if is_incremental() %} - AND pu.minute >= date_trunc("day", NOW() - interval '1' week) + AND {{ incremental_predicate('pu.minute') }} {% endif %} diff --git a/models/gas/optimism/gas_optimism_fees.sql b/models/gas/optimism/gas_optimism_fees.sql index c970f9c9834..31e136572cd 100644 --- a/models/gas/optimism/gas_optimism_fees.sql +++ b/models/gas/optimism/gas_optimism_fees.sql @@ -4,24 +4,25 @@ partition_by = ['block_month'], materialized = 'incremental', file_format = 'delta', - incremental_strategy = 'merge', + incremental_strategy='merge', + incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.block_time')], unique_key = ['tx_hash','block_number'] ) }} -SELECT +SELECT 'optimism' as blockchain, date_trunc('day', block_time) AS block_date, CAST(date_trunc('month', block_time) AS DATE) AS block_month, block_number, block_time, txns.hash AS tx_hash, - txns."from" AS tx_sender, + txns."from" AS tx_sender, txns.to AS tx_receiver, 'ETH' as native_token_symbol, value/1e18 AS tx_amount_native, value/1e18 * p.price AS tx_amount_usd, - (l1_fee/1e18 + ((txns.gas_used/1e18) * txns.gas_price)) as tx_fee_native, + (l1_fee/1e18 + ((txns.gas_used/1e18) * txns.gas_price)) as tx_fee_native, (l1_fee/1e18 + ((txns.gas_used/1e18) * txns.gas_price)) * p.price AS tx_fee_usd, cast(NULL as double) AS burned_native, -- Not applicable for L2s cast(NULL as double) AS burned_usd, -- Not applicable for L2s @@ -30,7 +31,7 @@ SELECT txns.gas_price/1e18 * p.price as gas_price_usd, txns.gas_used as gas_used, txns.gas_limit as gas_limit, - CASE + CASE WHEN txns.gas_limit = 0 THEN NULL WHEN txns.gas_limit != 0 THEN txns.gas_used / txns.gas_limit * 100 END AS gas_usage_percent, @@ -40,7 +41,7 @@ SELECT l1_fee_scalar, (l1_gas_price/1e18 )* txns.gas_used as tx_fee_equivalent_on_l1_native, (l1_gas_price/1e18 )* txns.gas_used * p.price as tx_fee_equivalent_on_l1_usd, - (length(from_utf8(data)) - length(replace(from_utf8(data), chr(0), ''))) as num_zero_bytes, + (length(from_utf8(data)) - length(replace(from_utf8(data), chr(0), ''))) as num_zero_bytes, bytearray_length(data) - (length(from_utf8(data)) - length(replace(from_utf8(data), chr(0), ''))) as num_nonzero_bytes, -- source: https://www.starburst.io/community/forum/t/count-zero-bytes-and-nonzero-bytes-in-a-bytestring-varbinary/261/2 16 * (length(from_utf8(data)) - length(replace(from_utf8(data), chr(0), ''))) --16 * nonzero bytes @@ -54,7 +55,7 @@ SELECT p.price * (COALESCE(CAST(blocks.base_fee_per_gas AS UINT256),txns.gas_price)/1e18)*txns.gas_used AS l2_base_fee_usd, --base_fee_per_gas was null pre-bedrock when there was no base fee case when (txns.gas_price = UINT256 '0') or (blocks.base_fee_per_gas IS NULL)then 0 else - cast( (txns.gas_price-blocks.base_fee_per_gas/ 1e18)*txns.gas_used as double) + cast( (txns.gas_price-blocks.base_fee_per_gas/ 1e18)*txns.gas_used as double) end AS l2_priority_fee_native, case when (txns.gas_price = UINT256 '0') or (blocks.base_fee_per_gas IS NULL)then 0 else p.price * cast( (txns.gas_price-blocks.base_fee_per_gas/ 1e18)*txns.gas_used as double) @@ -63,15 +64,15 @@ SELECT FROM {{ source('optimism','transactions') }} txns JOIN {{ source('optimism','blocks') }} blocks ON blocks.number = txns.block_number {% if is_incremental() %} -AND block_time >= date_trunc('day', now() - interval '2' day) -AND blocks.time >= date_trunc('day', now() - interval '2' day) +AND {{ incremental_predicate('block_time') }} +AND {{ incremental_predicate('blocks.time') }} {% endif %} LEFT JOIN {{ source('prices','usd') }} p ON p.minute = date_trunc('minute', block_time) AND p.blockchain = 'optimism' AND p.symbol = 'WETH' {% if is_incremental() %} -AND p.minute >= date_trunc('day', now() - interval '2' day) -WHERE block_time >= date_trunc('day', now() - interval '2' day) -AND blocks.time >= date_trunc('day', now() - interval '2' day) -AND p.minute >= date_trunc('day', now() - interval '2' day) +AND {{ incremental_predicate('p.minute') }} +WHERE {{ incremental_predicate('block_time') }} +AND {{ incremental_predicate('blocks.time') }} +AND {{ incremental_predicate('p.minute') }} {% endif %} diff --git a/models/gas/optimism/gas_optimism_fees_traces.sql b/models/gas/optimism/gas_optimism_fees_traces.sql index 46a203b2143..8bee017d0b8 100644 --- a/models/gas/optimism/gas_optimism_fees_traces.sql +++ b/models/gas/optimism/gas_optimism_fees_traces.sql @@ -1,5 +1,5 @@ {{ config( - + schema = 'gas_optimism', alias = 'fees_traces', materialized = 'view', @@ -42,7 +42,7 @@ WITH traces AS ( , tx_success FROM {{ source('optimism','traces') }} {% if is_incremental() %} - WHERE block_time >= date_trunc('day', NOW() - interval '1' day) + WHERE {{ incremental_predicate('block_time') }} {% endif %} UNION ALL @@ -63,7 +63,7 @@ WITH traces AS ( FROM {{ source('optimism','traces') }} WHERE cardinality(trace_address) > 0 {% if is_incremental() %} - AND block_time >= date_trunc('day', NOW() - interval '1' day) + AND {{ incremental_predicate('block_time') }} {% endif %} ) traces GROUP BY traces.tx_hash, traces.trace, traces.block_time, traces.block_number @@ -100,11 +100,11 @@ FROM traces INNER JOIN {{ source('optimism','transactions') }} txs ON txs.block_time=traces.block_time AND txs.hash=traces.tx_hash {% if is_incremental() %} - AND txs.block_time >= date_trunc('day', NOW() - interval '1' day) + AND {{ incremental_predicate('txs.block_time') }} {% endif %} LEFT JOIN {{ source('prices', 'usd') }} pu ON pu.minute=date_trunc('minute', traces.block_time) AND pu.blockchain='optimism' AND pu.contract_address=0x4200000000000000000000000000000000000006 {% if is_incremental() %} - AND pu.minute >= date_trunc('day', NOW() - interval '7' day) + AND {{ incremental_predicate('pu.minute') }} {% endif %} \ No newline at end of file diff --git a/models/gas/polygon/gas_polygon_fees_traces.sql b/models/gas/polygon/gas_polygon_fees_traces.sql index 9ebb41a1830..ebe8d28227d 100644 --- a/models/gas/polygon/gas_polygon_fees_traces.sql +++ b/models/gas/polygon/gas_polygon_fees_traces.sql @@ -5,7 +5,8 @@ tags=['prod_exclude'], partition_by = ['block_date'], materialized = 'incremental', file_format = 'delta', - incremental_strategy = 'merge', + incremental_strategy='merge', + incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.block_time')], unique_key = ['tx_hash', 'trace'], ) }} @@ -46,13 +47,13 @@ WITH traces AS ( , tx_success FROM {{ source('polygon','traces') }} {% if is_incremental() %} - WHERE block_time >= date_trunc("day", NOW() - interval '1 days') + WHERE {{ incremental_predicate('block_time') }} {% endif %} - + UNION ALL - - SELECT CAST(NULL AS varchar(1)) AS from - , CAST(NULL AS varchar(1)) AS to + + SELECT CAST(NULL AS varchar(1)) AS from + , CAST(NULL AS varchar(1)) AS to , tx_hash , slice(trace_address, 1, cardinality(trace_address) - 1) AS trace , CAST(NULL AS double) AS gas_used_original @@ -67,7 +68,7 @@ WITH traces AS ( FROM {{ source('polygon','traces') }} WHERE cardinality(trace_address) > 0 {% if is_incremental() %} - AND block_time >= date_trunc("day", NOW() - interval '1 days') + AND {{ incremental_predicate('block_time') }} {% endif %} ) traces GROUP BY traces.tx_hash, traces.trace, traces.block_time, traces.block_number @@ -104,11 +105,11 @@ FROM traces INNER JOIN {{ source('polygon','transactions') }} txs ON txs.block_time=traces.block_time AND txs.hash=traces.tx_hash {% if is_incremental() %} - AND txs.block_time >= date_trunc("day", NOW() - interval '1 days') + AND {{ incremental_predicate('txs.block_time') }} {% endif %} LEFT JOIN {{ source('prices', 'usd') }} pu ON pu.minute=date_trunc('minute', traces.block_time) AND pu.blockchain='polygon' AND pu.contract_address='0x0d500b1d8e8ef31e21c99d1db9a6444d3adf1270' {% if is_incremental() %} - AND pu.minute >= date_trunc("day", NOW() - interval '1' week) + AND {{ incremental_predicate('pu.minute') }} {% endif %} \ No newline at end of file diff --git a/models/gas/scroll/gas_scroll_fees.sql b/models/gas/scroll/gas_scroll_fees.sql index 1fdcbc95ee2..ceb7e381438 100644 --- a/models/gas/scroll/gas_scroll_fees.sql +++ b/models/gas/scroll/gas_scroll_fees.sql @@ -4,24 +4,25 @@ partition_by = ['block_month'], materialized = 'incremental', file_format = 'delta', - incremental_strategy = 'merge', + incremental_strategy='merge', + incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.block_time')], unique_key = ['tx_hash','block_number'] ) }} -SELECT +SELECT 'scroll' as blockchain, date_trunc('day', block_time) AS block_date, CAST(date_trunc('month', block_time) AS DATE) AS block_month, block_number, block_time, txns.hash AS tx_hash, - txns."from" AS tx_sender, + txns."from" AS tx_sender, txns.to AS tx_receiver, 'ETH' as native_token_symbol, value/1e18 AS tx_amount_native, value/1e18 * p.price AS tx_amount_usd, - (gas_price/1e18 * txns.gas_used) + txns.l1_fee/1e18 as tx_fee_native, + (gas_price/1e18 * txns.gas_used) + txns.l1_fee/1e18 as tx_fee_native, ((gas_price/1e18 * txns.gas_used) + txns.l1_fee/1e18) * p.price AS tx_fee_usd, cast(NULL as double) AS burned_native, -- Not applicable for L2s cast(NULL as double) AS burned_usd, -- Not applicable for L2s @@ -30,7 +31,7 @@ SELECT txns.gas_price/1e18 * p.price as gas_price_usd, txns.gas_used as gas_used, txns.gas_limit as gas_limit, - CASE + CASE WHEN txns.gas_limit = 0 THEN NULL WHEN txns.gas_limit != 0 THEN txns.gas_used / txns.gas_limit * 100 END AS gas_usage_percent, diff --git a/models/gas/zksync/gas_zksync_fees.sql b/models/gas/zksync/gas_zksync_fees.sql index 19715e426a0..47cdcee3b7d 100644 --- a/models/gas/zksync/gas_zksync_fees.sql +++ b/models/gas/zksync/gas_zksync_fees.sql @@ -4,24 +4,25 @@ partition_by = ['block_month'], materialized = 'incremental', file_format = 'delta', - incremental_strategy = 'merge', + incremental_strategy='merge', + incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.block_time')], unique_key = ['tx_hash','block_number'] ) }} -SELECT +SELECT 'zksync' as blockchain, date_trunc('day', block_time) AS block_date, CAST(date_trunc('month', block_time) AS DATE) AS block_month, block_number, block_time, txns.hash AS tx_hash, - txns."from" AS tx_sender, + txns."from" AS tx_sender, txns.to AS tx_receiver, 'ETH' as native_token_symbol, value/1e18 AS tx_amount_native, value/1e18 * p.price AS tx_amount_usd, - (gas_price / 1e18) * txns.gas_used as tx_fee_native, + (gas_price / 1e18) * txns.gas_used as tx_fee_native, (gas_price / 1e18) * txns.gas_used * p.price AS tx_fee_usd, cast(NULL as double) AS burned_native, -- Not applicable for L2s cast(NULL as double) AS burned_usd, -- Not applicable for L2s @@ -30,7 +31,7 @@ SELECT txns.gas_price/1e18 * p.price as gas_price_usd, txns.gas_used as gas_used, txns.gas_limit as gas_limit, - CASE + CASE WHEN txns.gas_limit = 0 THEN NULL WHEN txns.gas_limit != 0 THEN txns.gas_used / txns.gas_limit * 100 END AS gas_usage_percent, diff --git a/models/gas/zora/gas_zora_fees.sql b/models/gas/zora/gas_zora_fees.sql index 8ed57260441..3c5c3ad3061 100644 --- a/models/gas/zora/gas_zora_fees.sql +++ b/models/gas/zora/gas_zora_fees.sql @@ -4,24 +4,25 @@ partition_by = ['block_month'], materialized = 'incremental', file_format = 'delta', - incremental_strategy = 'merge', + incremental_strategy='merge', + incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.block_time')], unique_key = ['tx_hash','block_number'] ) }} -SELECT +SELECT 'zora' as blockchain, date_trunc('day', block_time) AS block_date, CAST(date_trunc('month', block_time) AS DATE) AS block_month, block_number, block_time, txns.hash AS tx_hash, - txns."from" AS tx_sender, + txns."from" AS tx_sender, txns.to AS tx_receiver, 'ETH' as native_token_symbol, value/1e18 AS tx_amount_native, value/1e18 * p.price AS tx_amount_usd, - (l1_fee/1e18 + ((txns.gas_used/1e18) * txns.gas_price)) as tx_fee_native, + (l1_fee/1e18 + ((txns.gas_used/1e18) * txns.gas_price)) as tx_fee_native, (l1_fee/1e18 + ((txns.gas_used/1e18) * txns.gas_price)) * p.price AS tx_fee_usd, cast(NULL as double) AS burned_native, -- Not applicable for L2s cast(NULL as double) AS burned_usd, -- Not applicable for L2s @@ -30,7 +31,7 @@ SELECT txns.gas_price/1e18 * p.price as gas_price_usd, txns.gas_used as gas_used, txns.gas_limit as gas_limit, - CASE + CASE WHEN txns.gas_limit = 0 THEN NULL WHEN txns.gas_limit != 0 THEN txns.gas_used / txns.gas_limit * 100 END AS gas_usage_percent, diff --git a/models/gitcoin/ethereum/gitcoin_ethereum_donations.sql b/models/gitcoin/ethereum/gitcoin_ethereum_donations.sql index 718abff4701..e35c056740b 100644 --- a/models/gitcoin/ethereum/gitcoin_ethereum_donations.sql +++ b/models/gitcoin/ethereum/gitcoin_ethereum_donations.sql @@ -1,10 +1,11 @@ {{ config( - + alias = 'donations', partition_by = ['block_month'], materialized = 'incremental', file_format = 'delta', incremental_strategy = 'merge', + incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.block_time')], unique_key = ['blockchain', 'tx_hash', 'evt_index'], post_hook='{{ expose_spells(\'["ethereum"]\', "project", @@ -41,7 +42,7 @@ WITH gitcoin_donations AS ( LEFT JOIN {{ source('tokens_ethereum', 'erc20') }} tok ON tok.contract_address=gd.token {% if is_incremental() %} - WHERE gd.evt_block_time >= date_trunc('day', now() - interval '7' day) + WHERE {{ incremental_predicate('gd.evt_block_time') }} {% endif %} ) diff --git a/models/gitcoin/polygon/gitcoin_polygon_donations.sql b/models/gitcoin/polygon/gitcoin_polygon_donations.sql index a5e2aee3b0d..58021bd4d8b 100644 --- a/models/gitcoin/polygon/gitcoin_polygon_donations.sql +++ b/models/gitcoin/polygon/gitcoin_polygon_donations.sql @@ -1,11 +1,12 @@ {{ config( - + alias = 'donations', partition_by = ['block_month'], materialized = 'incremental', file_format = 'delta', incremental_strategy = 'merge', unique_key = ['blockchain', 'tx_hash', 'evt_index'], + incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.block_time')], post_hook='{{ expose_spells(\'["polygon"]\', "project", "gitcoin", @@ -31,7 +32,7 @@ WITH gitcoin_donations AS ( ELSE gd.token END AS currency_contract , CASE WHEN gd.token = {{eth_contract}} - THEN 'MATIC' + THEN 'MATIC' ELSE tok.symbol END AS currency_symbol , gd.evt_index @@ -41,7 +42,7 @@ WITH gitcoin_donations AS ( LEFT JOIN {{ source('tokens_polygon', 'erc20') }} tok ON tok.contract_address=gd.token {% if is_incremental() %} - WHERE gd.evt_block_time >= date_trunc('day', now() - interval '7' day) + WHERE {{ incremental_predicate('gd.evt_block_time') }} {% endif %} ) diff --git a/models/staking/ethereum/staking_ethereum_deposits.sql b/models/staking/ethereum/staking_ethereum_deposits.sql index 364ac4322c5..2918e922fc8 100644 --- a/models/staking/ethereum/staking_ethereum_deposits.sql +++ b/models/staking/ethereum/staking_ethereum_deposits.sql @@ -5,6 +5,7 @@ materialized = 'incremental', file_format = 'delta', incremental_strategy = 'merge', + incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.block_time')], unique_key = ['tx_hash', 'evt_index'], post_hook='{{ expose_spells(\'["ethereum"]\', "sector", @@ -33,7 +34,7 @@ WITH deposit_events AS ( WHERE d.evt_block_time >= TIMESTAMP '2020-10-13' -- SHOULD BE 2020-10-14 BUT CHANGED TO 2020-10-13 TO TRIGGER TABLE RERUN {% endif %} {% if is_incremental() %} - WHERE d.evt_block_time >= date_trunc('day', now() - interval '7' day) + WHERE {{ incremental_predicate('d.evt_block_time') }} {% endif %} ) @@ -52,7 +53,7 @@ WITH deposit_events AS ( AND t.block_time >= TIMESTAMP '2020-10-13' -- SHOULD BE 2020-10-14 BUT CHANGED TO 2020-10-13 TO TRIGGER TABLE RERUN {% endif %} {% if is_incremental() %} - AND t.block_time >= date_trunc('day', now() - interval '7' day) + AND {{ incremental_predicate('t.block_time') }} {% endif %} ) @@ -82,7 +83,7 @@ INNER JOIN {{ source('ethereum', 'transactions') }} et ON et.block_number=d.bloc AND et.block_time >= TIMESTAMP '2020-10-13' -- SHOULD BE 2020-10-14 BUT CHANGED TO 2020-10-13 TO TRIGGER TABLE RERUN {% endif %} {% if is_incremental() %} - AND et.block_time >= date_trunc('day', now() - interval '7' day) + AND {{ incremental_predicate('et.block_time') }} {% endif %} INNER JOIN traces ett ON ett.block_number=d.block_number AND ett.tx_hash=d.tx_hash From 11fa1c4227e8717e8e3397396b1a25c5847f2383 Mon Sep 17 00:00:00 2001 From: Alan Ghobadi Date: Tue, 4 Jun 2024 18:07:36 +0200 Subject: [PATCH 034/149] Add incremental predicates strategy to oneinch (#6062) --- models/oneinch/arbitrum/oneinch_arbitrum_ar.sql | 7 ++++--- .../arbitrum/oneinch_arbitrum_call_transfers.sql | 7 ++++--- models/oneinch/arbitrum/oneinch_arbitrum_lop.sql | 7 ++++--- .../arbitrum/oneinch_arbitrum_project_orders.sql | 7 ++++--- .../arbitrum/oneinch_arbitrum_project_swaps.sql | 5 +++-- .../oneinch/avalanche_c/oneinch_avalanche_c_ar.sql | 7 ++++--- .../oneinch_avalanche_c_call_transfers.sql | 7 ++++--- .../oneinch/avalanche_c/oneinch_avalanche_c_lop.sql | 7 ++++--- .../oneinch_avalanche_c_project_orders.sql | 7 ++++--- .../oneinch_avalanche_c_project_swaps.sql | 5 +++-- models/oneinch/base/oneinch_base_ar.sql | 5 +++-- models/oneinch/base/oneinch_base_call_transfers.sql | 7 ++++--- models/oneinch/base/oneinch_base_lop.sql | 7 ++++--- models/oneinch/base/oneinch_base_project_orders.sql | 7 ++++--- models/oneinch/base/oneinch_base_project_swaps.sql | 5 +++-- models/oneinch/bnb/oneinch_bnb_ar.sql | 7 ++++--- models/oneinch/bnb/oneinch_bnb_call_transfers.sql | 5 +++-- models/oneinch/bnb/oneinch_bnb_lop.sql | 7 ++++--- models/oneinch/bnb/oneinch_bnb_project_orders.sql | 7 ++++--- models/oneinch/bnb/oneinch_bnb_project_swaps.sql | 5 +++-- .../ethereum/oneinch_ethereum_airdrop_claims.sql | 3 ++- models/oneinch/ethereum/oneinch_ethereum_ar.sql | 7 ++++--- .../ethereum/oneinch_ethereum_call_transfers.sql | 5 +++-- models/oneinch/ethereum/oneinch_ethereum_lop.sql | 7 ++++--- .../ethereum/oneinch_ethereum_project_orders.sql | 7 ++++--- .../ethereum/oneinch_ethereum_project_swaps.sql | 5 +++-- models/oneinch/fantom/oneinch_fantom_ar.sql | 7 ++++--- .../fantom/oneinch_fantom_call_transfers.sql | 7 ++++--- models/oneinch/fantom/oneinch_fantom_lop.sql | 7 ++++--- .../fantom/oneinch_fantom_project_orders.sql | 7 ++++--- .../oneinch/fantom/oneinch_fantom_project_swaps.sql | 5 +++-- models/oneinch/gnosis/oneinch_gnosis_ar.sql | 7 ++++--- .../gnosis/oneinch_gnosis_call_transfers.sql | 7 ++++--- models/oneinch/gnosis/oneinch_gnosis_lop.sql | 7 ++++--- .../gnosis/oneinch_gnosis_project_orders.sql | 7 ++++--- .../oneinch/gnosis/oneinch_gnosis_project_swaps.sql | 5 +++-- models/oneinch/oneinch_swaps.sql | 13 +++++++------ models/oneinch/optimism/oneinch_optimism_ar.sql | 7 ++++--- .../optimism/oneinch_optimism_call_transfers.sql | 7 ++++--- models/oneinch/optimism/oneinch_optimism_lop.sql | 7 ++++--- .../optimism/oneinch_optimism_project_orders.sql | 7 ++++--- .../optimism/oneinch_optimism_project_swaps.sql | 5 +++-- models/oneinch/polygon/oneinch_polygon_ar.sql | 7 ++++--- .../polygon/oneinch_polygon_call_transfers.sql | 5 +++-- models/oneinch/polygon/oneinch_polygon_lop.sql | 7 ++++--- .../polygon/oneinch_polygon_project_orders.sql | 7 ++++--- .../polygon/oneinch_polygon_project_swaps.sql | 5 +++-- models/oneinch/zksync/oneinch_zksync_ar.sql | 7 ++++--- .../zksync/oneinch_zksync_call_transfers.sql | 7 ++++--- models/oneinch/zksync/oneinch_zksync_lop.sql | 7 ++++--- .../zksync/oneinch_zksync_project_orders.sql | 7 ++++--- .../oneinch/zksync/oneinch_zksync_project_swaps.sql | 5 +++-- 52 files changed, 195 insertions(+), 143 deletions(-) diff --git a/models/oneinch/arbitrum/oneinch_arbitrum_ar.sql b/models/oneinch/arbitrum/oneinch_arbitrum_ar.sql index cf4c60c1234..1f156f3d008 100644 --- a/models/oneinch/arbitrum/oneinch_arbitrum_ar.sql +++ b/models/oneinch/arbitrum/oneinch_arbitrum_ar.sql @@ -2,21 +2,22 @@ -{{ - config( +{{ + config( schema = 'oneinch_' + blockchain, alias = 'ar', partition_by = ['block_month'], materialized = 'incremental', file_format = 'delta', incremental_strategy = 'merge', + incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.block_time')], unique_key = ['blockchain', 'tx_hash', 'call_trace_address'] ) }} -{{ +{{ oneinch_ar_macro( blockchain = blockchain ) diff --git a/models/oneinch/arbitrum/oneinch_arbitrum_call_transfers.sql b/models/oneinch/arbitrum/oneinch_arbitrum_call_transfers.sql index 423bfe3a954..1848eef74ce 100644 --- a/models/oneinch/arbitrum/oneinch_arbitrum_call_transfers.sql +++ b/models/oneinch/arbitrum/oneinch_arbitrum_call_transfers.sql @@ -2,21 +2,22 @@ -{{ - config( +{{ + config( schema = 'oneinch_' + blockchain, alias = 'call_transfers', partition_by = ['block_month'], materialized = 'incremental', file_format = 'delta', incremental_strategy = 'merge', + incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.block_time')], unique_key = ['tx_hash', 'call_trace_address', 'transfer_trace_address', 'transfer_native'] ) }} -{{ +{{ oneinch_call_transfers_macro( blockchain = blockchain ) diff --git a/models/oneinch/arbitrum/oneinch_arbitrum_lop.sql b/models/oneinch/arbitrum/oneinch_arbitrum_lop.sql index 3ed08c80bcb..9ffc2bc2f9c 100644 --- a/models/oneinch/arbitrum/oneinch_arbitrum_lop.sql +++ b/models/oneinch/arbitrum/oneinch_arbitrum_lop.sql @@ -2,21 +2,22 @@ -{{ - config( +{{ + config( schema = 'oneinch_' + blockchain, alias = 'lop', partition_by = ['block_month'], materialized = 'incremental', file_format = 'delta', incremental_strategy = 'merge', + incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.block_time')], unique_key = ['blockchain', 'tx_hash', 'call_trace_address'] ) }} -{{ +{{ oneinch_lop_macro( blockchain = blockchain ) diff --git a/models/oneinch/arbitrum/oneinch_arbitrum_project_orders.sql b/models/oneinch/arbitrum/oneinch_arbitrum_project_orders.sql index 5d261a925a2..3bdbec8bcdd 100644 --- a/models/oneinch/arbitrum/oneinch_arbitrum_project_orders.sql +++ b/models/oneinch/arbitrum/oneinch_arbitrum_project_orders.sql @@ -2,21 +2,22 @@ -{{ - config( +{{ + config( schema = 'oneinch_' + blockchain, alias = 'project_orders', partition_by = ['block_month'], materialized = 'incremental', file_format = 'delta', incremental_strategy = 'merge', + incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.block_time')], unique_key = ['blockchain', 'block_number', 'tx_hash', 'call_trace_address', 'order_hash'] ) }} -{{ +{{ oneinch_project_orders_macro( blockchain = blockchain ) diff --git a/models/oneinch/arbitrum/oneinch_arbitrum_project_swaps.sql b/models/oneinch/arbitrum/oneinch_arbitrum_project_swaps.sql index da47b743f06..9a560bdcf91 100644 --- a/models/oneinch/arbitrum/oneinch_arbitrum_project_swaps.sql +++ b/models/oneinch/arbitrum/oneinch_arbitrum_project_swaps.sql @@ -2,14 +2,15 @@ -{{ - config( +{{ + config( schema = 'oneinch_' + blockchain, alias = 'project_swaps', partition_by = ['block_month'], materialized = 'incremental', file_format = 'delta', incremental_strategy = 'merge', + incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.block_time')], unique_key = ['blockchain', 'tx_hash', 'call_trace_address'] ) }} diff --git a/models/oneinch/avalanche_c/oneinch_avalanche_c_ar.sql b/models/oneinch/avalanche_c/oneinch_avalanche_c_ar.sql index bffaf3caab1..8da2c844d09 100644 --- a/models/oneinch/avalanche_c/oneinch_avalanche_c_ar.sql +++ b/models/oneinch/avalanche_c/oneinch_avalanche_c_ar.sql @@ -2,21 +2,22 @@ -{{ - config( +{{ + config( schema = 'oneinch_' + blockchain, alias = 'ar', partition_by = ['block_month'], materialized = 'incremental', file_format = 'delta', incremental_strategy = 'merge', + incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.block_time')], unique_key = ['blockchain', 'tx_hash', 'call_trace_address'] ) }} -{{ +{{ oneinch_ar_macro( blockchain = blockchain ) diff --git a/models/oneinch/avalanche_c/oneinch_avalanche_c_call_transfers.sql b/models/oneinch/avalanche_c/oneinch_avalanche_c_call_transfers.sql index e7060ec0961..6e9ad024ac6 100644 --- a/models/oneinch/avalanche_c/oneinch_avalanche_c_call_transfers.sql +++ b/models/oneinch/avalanche_c/oneinch_avalanche_c_call_transfers.sql @@ -2,21 +2,22 @@ -{{ - config( +{{ + config( schema = 'oneinch_' + blockchain, alias = 'call_transfers', partition_by = ['block_month'], materialized = 'incremental', file_format = 'delta', incremental_strategy = 'merge', + incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.block_time')], unique_key = ['tx_hash', 'call_trace_address', 'transfer_trace_address', 'transfer_native'] ) }} -{{ +{{ oneinch_call_transfers_macro( blockchain = blockchain ) diff --git a/models/oneinch/avalanche_c/oneinch_avalanche_c_lop.sql b/models/oneinch/avalanche_c/oneinch_avalanche_c_lop.sql index c0acb4df6a1..c39d7e471b0 100644 --- a/models/oneinch/avalanche_c/oneinch_avalanche_c_lop.sql +++ b/models/oneinch/avalanche_c/oneinch_avalanche_c_lop.sql @@ -2,21 +2,22 @@ -{{ - config( +{{ + config( schema = 'oneinch_' + blockchain, alias = 'lop', partition_by = ['block_month'], materialized = 'incremental', file_format = 'delta', incremental_strategy = 'merge', + incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.block_time')], unique_key = ['blockchain', 'tx_hash', 'call_trace_address'] ) }} -{{ +{{ oneinch_lop_macro( blockchain = blockchain ) diff --git a/models/oneinch/avalanche_c/oneinch_avalanche_c_project_orders.sql b/models/oneinch/avalanche_c/oneinch_avalanche_c_project_orders.sql index d5a2aa06fb1..28f0ea8cf7d 100644 --- a/models/oneinch/avalanche_c/oneinch_avalanche_c_project_orders.sql +++ b/models/oneinch/avalanche_c/oneinch_avalanche_c_project_orders.sql @@ -2,21 +2,22 @@ -{{ - config( +{{ + config( schema = 'oneinch_' + blockchain, alias = 'project_orders', partition_by = ['block_month'], materialized = 'incremental', file_format = 'delta', incremental_strategy = 'merge', + incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.block_time')], unique_key = ['blockchain', 'block_number', 'tx_hash', 'call_trace_address', 'order_hash'] ) }} -{{ +{{ oneinch_project_orders_macro( blockchain = blockchain ) diff --git a/models/oneinch/avalanche_c/oneinch_avalanche_c_project_swaps.sql b/models/oneinch/avalanche_c/oneinch_avalanche_c_project_swaps.sql index a71f3c509f5..2165d04fa7a 100644 --- a/models/oneinch/avalanche_c/oneinch_avalanche_c_project_swaps.sql +++ b/models/oneinch/avalanche_c/oneinch_avalanche_c_project_swaps.sql @@ -2,14 +2,15 @@ -{{ - config( +{{ + config( schema = 'oneinch_' + blockchain, alias = 'project_swaps', partition_by = ['block_month'], materialized = 'incremental', file_format = 'delta', incremental_strategy = 'merge', + incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.block_time')], unique_key = ['blockchain', 'tx_hash', 'call_trace_address'] ) }} diff --git a/models/oneinch/base/oneinch_base_ar.sql b/models/oneinch/base/oneinch_base_ar.sql index 3136720bc0b..a1e3f1f111b 100644 --- a/models/oneinch/base/oneinch_base_ar.sql +++ b/models/oneinch/base/oneinch_base_ar.sql @@ -2,14 +2,15 @@ -{{ - config( +{{ + config( schema = 'oneinch_' + blockchain, alias = 'ar', partition_by = ['block_month'], materialized = 'incremental', file_format = 'delta', incremental_strategy = 'merge', + incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.block_time')], unique_key = ['blockchain', 'tx_hash', 'call_trace_address'] ) }} diff --git a/models/oneinch/base/oneinch_base_call_transfers.sql b/models/oneinch/base/oneinch_base_call_transfers.sql index 007dbe1266e..3e2c498ad6d 100644 --- a/models/oneinch/base/oneinch_base_call_transfers.sql +++ b/models/oneinch/base/oneinch_base_call_transfers.sql @@ -2,21 +2,22 @@ -{{ - config( +{{ + config( schema = 'oneinch_' + blockchain, alias = 'call_transfers', partition_by = ['block_month'], materialized = 'incremental', file_format = 'delta', incremental_strategy = 'merge', + incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.block_time')], unique_key = ['tx_hash', 'call_trace_address', 'transfer_trace_address', 'transfer_native'] ) }} -{{ +{{ oneinch_call_transfers_macro( blockchain = blockchain ) diff --git a/models/oneinch/base/oneinch_base_lop.sql b/models/oneinch/base/oneinch_base_lop.sql index d71098ac53b..c5ebf0af5a2 100644 --- a/models/oneinch/base/oneinch_base_lop.sql +++ b/models/oneinch/base/oneinch_base_lop.sql @@ -2,21 +2,22 @@ -{{ - config( +{{ + config( schema = 'oneinch_' + blockchain, alias = 'lop', partition_by = ['block_month'], materialized = 'incremental', file_format = 'delta', incremental_strategy = 'merge', + incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.block_time')], unique_key = ['blockchain', 'tx_hash', 'call_trace_address'] ) }} -{{ +{{ oneinch_lop_macro( blockchain = blockchain ) diff --git a/models/oneinch/base/oneinch_base_project_orders.sql b/models/oneinch/base/oneinch_base_project_orders.sql index bd07735e15b..732da3d4bb0 100644 --- a/models/oneinch/base/oneinch_base_project_orders.sql +++ b/models/oneinch/base/oneinch_base_project_orders.sql @@ -2,21 +2,22 @@ -{{ - config( +{{ + config( schema = 'oneinch_' + blockchain, alias = 'project_orders', partition_by = ['block_month'], materialized = 'incremental', file_format = 'delta', incremental_strategy = 'merge', + incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.block_time')], unique_key = ['blockchain', 'block_number', 'tx_hash', 'call_trace_address', 'order_hash'] ) }} -{{ +{{ oneinch_project_orders_macro( blockchain = blockchain ) diff --git a/models/oneinch/base/oneinch_base_project_swaps.sql b/models/oneinch/base/oneinch_base_project_swaps.sql index 2886864a03d..68373480266 100644 --- a/models/oneinch/base/oneinch_base_project_swaps.sql +++ b/models/oneinch/base/oneinch_base_project_swaps.sql @@ -2,14 +2,15 @@ -{{ - config( +{{ + config( schema = 'oneinch_' + blockchain, alias = 'project_swaps', partition_by = ['block_month'], materialized = 'incremental', file_format = 'delta', incremental_strategy = 'merge', + incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.block_time')], unique_key = ['blockchain', 'tx_hash', 'call_trace_address'] ) }} diff --git a/models/oneinch/bnb/oneinch_bnb_ar.sql b/models/oneinch/bnb/oneinch_bnb_ar.sql index b6c6a738f5e..3fe6795f012 100644 --- a/models/oneinch/bnb/oneinch_bnb_ar.sql +++ b/models/oneinch/bnb/oneinch_bnb_ar.sql @@ -2,21 +2,22 @@ -{{ - config( +{{ + config( schema = 'oneinch_' + blockchain, alias = 'ar', partition_by = ['block_month'], materialized = 'incremental', file_format = 'delta', incremental_strategy = 'merge', + incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.block_time')], unique_key = ['blockchain', 'tx_hash', 'call_trace_address'] ) }} -{{ +{{ oneinch_ar_macro( blockchain = blockchain ) diff --git a/models/oneinch/bnb/oneinch_bnb_call_transfers.sql b/models/oneinch/bnb/oneinch_bnb_call_transfers.sql index ed5e0545104..129e8ea3083 100644 --- a/models/oneinch/bnb/oneinch_bnb_call_transfers.sql +++ b/models/oneinch/bnb/oneinch_bnb_call_transfers.sql @@ -2,7 +2,7 @@ -{{ +{{ config( schema = 'oneinch_' + blockchain, alias = 'call_transfers', @@ -10,13 +10,14 @@ materialized = 'incremental', file_format = 'delta', incremental_strategy = 'merge', + incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.block_time')], unique_key = ['tx_hash', 'call_trace_address', 'transfer_trace_address', 'transfer_native'] ) }} -{{ +{{ oneinch_call_transfers_macro( blockchain = blockchain ) diff --git a/models/oneinch/bnb/oneinch_bnb_lop.sql b/models/oneinch/bnb/oneinch_bnb_lop.sql index 289231004cc..db960f5cfab 100644 --- a/models/oneinch/bnb/oneinch_bnb_lop.sql +++ b/models/oneinch/bnb/oneinch_bnb_lop.sql @@ -2,21 +2,22 @@ -{{ - config( +{{ + config( schema = 'oneinch_' + blockchain, alias = 'lop', partition_by = ['block_month'], materialized = 'incremental', file_format = 'delta', incremental_strategy = 'merge', + incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.block_time')], unique_key = ['blockchain', 'tx_hash', 'call_trace_address'] ) }} -{{ +{{ oneinch_lop_macro( blockchain = blockchain ) diff --git a/models/oneinch/bnb/oneinch_bnb_project_orders.sql b/models/oneinch/bnb/oneinch_bnb_project_orders.sql index 6aa5159b77b..dd3579f2cba 100644 --- a/models/oneinch/bnb/oneinch_bnb_project_orders.sql +++ b/models/oneinch/bnb/oneinch_bnb_project_orders.sql @@ -2,21 +2,22 @@ -{{ - config( +{{ + config( schema = 'oneinch_' + blockchain, alias = 'project_orders', partition_by = ['block_month'], materialized = 'incremental', file_format = 'delta', incremental_strategy = 'merge', + incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.block_time')], unique_key = ['blockchain', 'block_number', 'tx_hash', 'call_trace_address', 'order_hash'] ) }} -{{ +{{ oneinch_project_orders_macro( blockchain = blockchain ) diff --git a/models/oneinch/bnb/oneinch_bnb_project_swaps.sql b/models/oneinch/bnb/oneinch_bnb_project_swaps.sql index d2fc3667518..dd0d00a2bb8 100644 --- a/models/oneinch/bnb/oneinch_bnb_project_swaps.sql +++ b/models/oneinch/bnb/oneinch_bnb_project_swaps.sql @@ -2,14 +2,15 @@ -{{ - config( +{{ + config( schema = 'oneinch_' + blockchain, alias = 'project_swaps', partition_by = ['block_month'], materialized = 'incremental', file_format = 'delta', incremental_strategy = 'merge', + incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.block_time')], unique_key = ['blockchain', 'tx_hash', 'call_trace_address'] ) }} diff --git a/models/oneinch/ethereum/oneinch_ethereum_airdrop_claims.sql b/models/oneinch/ethereum/oneinch_ethereum_airdrop_claims.sql index 377e2835237..57a5bb0d1e9 100644 --- a/models/oneinch/ethereum/oneinch_ethereum_airdrop_claims.sql +++ b/models/oneinch/ethereum/oneinch_ethereum_airdrop_claims.sql @@ -1,11 +1,12 @@ {{ config( - + schema = 'oneinch_ethereum', alias = 'airdrop_claims', materialized = 'incremental', file_format = 'delta', incremental_strategy = 'merge', + incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.block_time')], unique_key = ['recipient', 'tx_hash', 'evt_index'], post_hook='{{ expose_spells(\'["ethereum"]\', "project", diff --git a/models/oneinch/ethereum/oneinch_ethereum_ar.sql b/models/oneinch/ethereum/oneinch_ethereum_ar.sql index 415f640e075..c2da5abb1a8 100644 --- a/models/oneinch/ethereum/oneinch_ethereum_ar.sql +++ b/models/oneinch/ethereum/oneinch_ethereum_ar.sql @@ -2,21 +2,22 @@ -{{ - config( +{{ + config( schema = 'oneinch_' + blockchain, alias = 'ar', partition_by = ['block_month'], materialized = 'incremental', file_format = 'delta', incremental_strategy = 'merge', + incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.block_time')], unique_key = ['blockchain', 'tx_hash', 'call_trace_address'] ) }} -{{ +{{ oneinch_ar_macro( blockchain = blockchain ) diff --git a/models/oneinch/ethereum/oneinch_ethereum_call_transfers.sql b/models/oneinch/ethereum/oneinch_ethereum_call_transfers.sql index 4eb026d858d..2685b4b9524 100644 --- a/models/oneinch/ethereum/oneinch_ethereum_call_transfers.sql +++ b/models/oneinch/ethereum/oneinch_ethereum_call_transfers.sql @@ -2,7 +2,7 @@ -{{ +{{ config( schema = 'oneinch_' + blockchain, alias = 'call_transfers', @@ -10,13 +10,14 @@ materialized = 'incremental', file_format = 'delta', incremental_strategy = 'merge', + incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.block_time')], unique_key = ['tx_hash', 'call_trace_address', 'transfer_trace_address', 'transfer_native'] ) }} -{{ +{{ oneinch_call_transfers_macro( blockchain = blockchain ) diff --git a/models/oneinch/ethereum/oneinch_ethereum_lop.sql b/models/oneinch/ethereum/oneinch_ethereum_lop.sql index 5288d18388c..0021275602e 100644 --- a/models/oneinch/ethereum/oneinch_ethereum_lop.sql +++ b/models/oneinch/ethereum/oneinch_ethereum_lop.sql @@ -2,21 +2,22 @@ -{{ - config( +{{ + config( schema = 'oneinch_' + blockchain, alias = 'lop', partition_by = ['block_month'], materialized = 'incremental', file_format = 'delta', incremental_strategy = 'merge', + incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.block_time')], unique_key = ['blockchain', 'tx_hash', 'call_trace_address'] ) }} -{{ +{{ oneinch_lop_macro( blockchain = blockchain ) diff --git a/models/oneinch/ethereum/oneinch_ethereum_project_orders.sql b/models/oneinch/ethereum/oneinch_ethereum_project_orders.sql index 0febf34d76f..8f9625750d7 100644 --- a/models/oneinch/ethereum/oneinch_ethereum_project_orders.sql +++ b/models/oneinch/ethereum/oneinch_ethereum_project_orders.sql @@ -2,21 +2,22 @@ -{{ - config( +{{ + config( schema = 'oneinch_' + blockchain, alias = 'project_orders', partition_by = ['block_month'], materialized = 'incremental', file_format = 'delta', incremental_strategy = 'merge', + incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.block_time')], unique_key = ['blockchain', 'block_number', 'tx_hash', 'call_trace_address', 'order_hash'] ) }} -{{ +{{ oneinch_project_orders_macro( blockchain = blockchain ) diff --git a/models/oneinch/ethereum/oneinch_ethereum_project_swaps.sql b/models/oneinch/ethereum/oneinch_ethereum_project_swaps.sql index 63080d11e00..62ede1328e7 100644 --- a/models/oneinch/ethereum/oneinch_ethereum_project_swaps.sql +++ b/models/oneinch/ethereum/oneinch_ethereum_project_swaps.sql @@ -2,14 +2,15 @@ -{{ - config( +{{ + config( schema = 'oneinch_' + blockchain, alias = 'project_swaps', partition_by = ['block_month'], materialized = 'incremental', file_format = 'delta', incremental_strategy = 'merge', + incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.block_time')], unique_key = ['blockchain', 'tx_hash', 'call_trace_address'] ) }} diff --git a/models/oneinch/fantom/oneinch_fantom_ar.sql b/models/oneinch/fantom/oneinch_fantom_ar.sql index d623cf21013..b26703e708f 100644 --- a/models/oneinch/fantom/oneinch_fantom_ar.sql +++ b/models/oneinch/fantom/oneinch_fantom_ar.sql @@ -2,21 +2,22 @@ -{{ - config( +{{ + config( schema = 'oneinch_' + blockchain, alias = 'ar', partition_by = ['block_month'], materialized = 'incremental', file_format = 'delta', incremental_strategy = 'merge', + incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.block_time')], unique_key = ['blockchain', 'tx_hash', 'call_trace_address'] ) }} -{{ +{{ oneinch_ar_macro( blockchain = blockchain ) diff --git a/models/oneinch/fantom/oneinch_fantom_call_transfers.sql b/models/oneinch/fantom/oneinch_fantom_call_transfers.sql index 839bb3e3be7..583bf576047 100644 --- a/models/oneinch/fantom/oneinch_fantom_call_transfers.sql +++ b/models/oneinch/fantom/oneinch_fantom_call_transfers.sql @@ -2,21 +2,22 @@ -{{ - config( +{{ + config( schema = 'oneinch_' + blockchain, alias = 'call_transfers', partition_by = ['block_month'], materialized = 'incremental', file_format = 'delta', incremental_strategy = 'merge', + incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.block_time')], unique_key = ['tx_hash', 'call_trace_address', 'transfer_trace_address', 'transfer_native'] ) }} -{{ +{{ oneinch_call_transfers_macro( blockchain = blockchain ) diff --git a/models/oneinch/fantom/oneinch_fantom_lop.sql b/models/oneinch/fantom/oneinch_fantom_lop.sql index 4a42652cd0d..c1cd5b5013c 100644 --- a/models/oneinch/fantom/oneinch_fantom_lop.sql +++ b/models/oneinch/fantom/oneinch_fantom_lop.sql @@ -2,21 +2,22 @@ -{{ - config( +{{ + config( schema = 'oneinch_' + blockchain, alias = 'lop', partition_by = ['block_month'], materialized = 'incremental', file_format = 'delta', incremental_strategy = 'merge', + incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.block_time')], unique_key = ['blockchain', 'tx_hash', 'call_trace_address'] ) }} -{{ +{{ oneinch_lop_macro( blockchain = blockchain ) diff --git a/models/oneinch/fantom/oneinch_fantom_project_orders.sql b/models/oneinch/fantom/oneinch_fantom_project_orders.sql index a36105df5ca..267f459ce37 100644 --- a/models/oneinch/fantom/oneinch_fantom_project_orders.sql +++ b/models/oneinch/fantom/oneinch_fantom_project_orders.sql @@ -2,21 +2,22 @@ -{{ - config( +{{ + config( schema = 'oneinch_' + blockchain, alias = 'project_orders', partition_by = ['block_month'], materialized = 'incremental', file_format = 'delta', incremental_strategy = 'merge', + incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.block_time')], unique_key = ['blockchain', 'block_number', 'tx_hash', 'call_trace_address', 'order_hash'] ) }} -{{ +{{ oneinch_project_orders_macro( blockchain = blockchain ) diff --git a/models/oneinch/fantom/oneinch_fantom_project_swaps.sql b/models/oneinch/fantom/oneinch_fantom_project_swaps.sql index a0cec005af9..04c4a8ce828 100644 --- a/models/oneinch/fantom/oneinch_fantom_project_swaps.sql +++ b/models/oneinch/fantom/oneinch_fantom_project_swaps.sql @@ -2,14 +2,15 @@ -{{ - config( +{{ + config( schema = 'oneinch_' + blockchain, alias = 'project_swaps', partition_by = ['block_month'], materialized = 'incremental', file_format = 'delta', incremental_strategy = 'merge', + incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.block_time')], unique_key = ['blockchain', 'tx_hash', 'call_trace_address'] ) }} diff --git a/models/oneinch/gnosis/oneinch_gnosis_ar.sql b/models/oneinch/gnosis/oneinch_gnosis_ar.sql index b19996713cb..029208088c0 100644 --- a/models/oneinch/gnosis/oneinch_gnosis_ar.sql +++ b/models/oneinch/gnosis/oneinch_gnosis_ar.sql @@ -2,21 +2,22 @@ -{{ - config( +{{ + config( schema = 'oneinch_' + blockchain, alias = 'ar', partition_by = ['block_month'], materialized = 'incremental', file_format = 'delta', incremental_strategy = 'merge', + incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.block_time')], unique_key = ['blockchain', 'tx_hash', 'call_trace_address'] ) }} -{{ +{{ oneinch_ar_macro( blockchain = blockchain ) diff --git a/models/oneinch/gnosis/oneinch_gnosis_call_transfers.sql b/models/oneinch/gnosis/oneinch_gnosis_call_transfers.sql index 23aa8d253fd..82435e33455 100644 --- a/models/oneinch/gnosis/oneinch_gnosis_call_transfers.sql +++ b/models/oneinch/gnosis/oneinch_gnosis_call_transfers.sql @@ -2,21 +2,22 @@ -{{ - config( +{{ + config( schema = 'oneinch_' + blockchain, alias = 'call_transfers', partition_by = ['block_month'], materialized = 'incremental', file_format = 'delta', incremental_strategy = 'merge', + incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.block_time')], unique_key = ['tx_hash', 'call_trace_address', 'transfer_trace_address', 'transfer_native'] ) }} -{{ +{{ oneinch_call_transfers_macro( blockchain = blockchain ) diff --git a/models/oneinch/gnosis/oneinch_gnosis_lop.sql b/models/oneinch/gnosis/oneinch_gnosis_lop.sql index dea2e854b28..2597a740491 100644 --- a/models/oneinch/gnosis/oneinch_gnosis_lop.sql +++ b/models/oneinch/gnosis/oneinch_gnosis_lop.sql @@ -2,21 +2,22 @@ -{{ - config( +{{ + config( schema = 'oneinch_' + blockchain, alias = 'lop', partition_by = ['block_month'], materialized = 'incremental', file_format = 'delta', incremental_strategy = 'merge', + incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.block_time')], unique_key = ['blockchain', 'tx_hash', 'call_trace_address'] ) }} -{{ +{{ oneinch_lop_macro( blockchain = blockchain ) diff --git a/models/oneinch/gnosis/oneinch_gnosis_project_orders.sql b/models/oneinch/gnosis/oneinch_gnosis_project_orders.sql index 2671f636c7d..000c325a3ce 100644 --- a/models/oneinch/gnosis/oneinch_gnosis_project_orders.sql +++ b/models/oneinch/gnosis/oneinch_gnosis_project_orders.sql @@ -2,21 +2,22 @@ -{{ - config( +{{ + config( schema = 'oneinch_' + blockchain, alias = 'project_orders', partition_by = ['block_month'], materialized = 'incremental', file_format = 'delta', incremental_strategy = 'merge', + incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.block_time')], unique_key = ['blockchain', 'block_number', 'tx_hash', 'call_trace_address', 'order_hash'] ) }} -{{ +{{ oneinch_project_orders_macro( blockchain = blockchain ) diff --git a/models/oneinch/gnosis/oneinch_gnosis_project_swaps.sql b/models/oneinch/gnosis/oneinch_gnosis_project_swaps.sql index 65893681f27..5c140abcfbc 100644 --- a/models/oneinch/gnosis/oneinch_gnosis_project_swaps.sql +++ b/models/oneinch/gnosis/oneinch_gnosis_project_swaps.sql @@ -2,14 +2,15 @@ -{{ - config( +{{ + config( schema = 'oneinch_' + blockchain, alias = 'project_swaps', partition_by = ['block_month'], materialized = 'incremental', file_format = 'delta', incremental_strategy = 'merge', + incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.block_time')], unique_key = ['blockchain', 'tx_hash', 'call_trace_address'] ) }} diff --git a/models/oneinch/oneinch_swaps.sql b/models/oneinch/oneinch_swaps.sql index f2edf87d806..2d7320e7075 100644 --- a/models/oneinch/oneinch_swaps.sql +++ b/models/oneinch/oneinch_swaps.sql @@ -1,10 +1,11 @@ -{{ +{{ config( schema = 'oneinch', alias = 'swaps', materialized = 'incremental', file_format = 'delta', incremental_strategy = 'merge', + incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.block_time')], partition_by = ['block_month'], unique_key = ['unique_key'], post_hook='{{ expose_spells(\'["ethereum", "bnb", "polygon", "arbitrum", "avalanche_c", "gnosis", "fantom", "optimism", "base"]\', @@ -20,7 +21,7 @@ {% set true_native_address = '0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee' %} -- base columns to not to duplicate in the union -{% set +{% set calls_base_columns = [ 'blockchain', 'block_number', @@ -55,7 +56,7 @@ with tokens as ( - select + select blockchain , contract_address , symbol as token_symbol @@ -97,7 +98,7 @@ tokens as ( , swaps as ( -- AR & LOP calls - select + select {{ calls_base_columns | join(', ') }} , if(protocol = 'AR', tx_from, maker) as user , receiver @@ -141,7 +142,7 @@ tokens as ( {% set decimals = 'coalesce(decimals, token_decimals)' %} , amounts as ( - select + select blockchain , block_number , tx_hash @@ -176,7 +177,7 @@ tokens as ( , count(distinct (contract_address, transfer_native)) as tokens -- count distinct tokens in transfers , count(*) as transfers -- count transfers - from swaps + from swaps join ( select * from {{ ref('oneinch_call_transfers') }} {% if is_incremental() %} diff --git a/models/oneinch/optimism/oneinch_optimism_ar.sql b/models/oneinch/optimism/oneinch_optimism_ar.sql index 8378a703e44..7a9118d80a5 100644 --- a/models/oneinch/optimism/oneinch_optimism_ar.sql +++ b/models/oneinch/optimism/oneinch_optimism_ar.sql @@ -2,21 +2,22 @@ -{{ - config( +{{ + config( schema = 'oneinch_' + blockchain, alias = 'ar', partition_by = ['block_month'], materialized = 'incremental', file_format = 'delta', incremental_strategy = 'merge', + incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.block_time')], unique_key = ['blockchain', 'tx_hash', 'call_trace_address'] ) }} -{{ +{{ oneinch_ar_macro( blockchain = blockchain ) diff --git a/models/oneinch/optimism/oneinch_optimism_call_transfers.sql b/models/oneinch/optimism/oneinch_optimism_call_transfers.sql index a61db344e37..ebb2b2a3363 100644 --- a/models/oneinch/optimism/oneinch_optimism_call_transfers.sql +++ b/models/oneinch/optimism/oneinch_optimism_call_transfers.sql @@ -2,21 +2,22 @@ -{{ - config( +{{ + config( schema = 'oneinch_' + blockchain, alias = 'call_transfers', partition_by = ['block_month'], materialized = 'incremental', file_format = 'delta', incremental_strategy = 'merge', + incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.block_time')], unique_key = ['tx_hash', 'call_trace_address', 'transfer_trace_address', 'transfer_native'] ) }} -{{ +{{ oneinch_call_transfers_macro( blockchain = blockchain ) diff --git a/models/oneinch/optimism/oneinch_optimism_lop.sql b/models/oneinch/optimism/oneinch_optimism_lop.sql index 90629741a47..1c0cbccd8cf 100644 --- a/models/oneinch/optimism/oneinch_optimism_lop.sql +++ b/models/oneinch/optimism/oneinch_optimism_lop.sql @@ -2,21 +2,22 @@ -{{ - config( +{{ + config( schema = 'oneinch_' + blockchain, alias = 'lop', partition_by = ['block_month'], materialized = 'incremental', file_format = 'delta', incremental_strategy = 'merge', + incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.block_time')], unique_key = ['blockchain', 'tx_hash', 'call_trace_address'] ) }} -{{ +{{ oneinch_lop_macro( blockchain = blockchain ) diff --git a/models/oneinch/optimism/oneinch_optimism_project_orders.sql b/models/oneinch/optimism/oneinch_optimism_project_orders.sql index a080b0f190f..e9f66172d26 100644 --- a/models/oneinch/optimism/oneinch_optimism_project_orders.sql +++ b/models/oneinch/optimism/oneinch_optimism_project_orders.sql @@ -2,21 +2,22 @@ -{{ - config( +{{ + config( schema = 'oneinch_' + blockchain, alias = 'project_orders', partition_by = ['block_month'], materialized = 'incremental', file_format = 'delta', incremental_strategy = 'merge', + incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.block_time')], unique_key = ['blockchain', 'block_number', 'tx_hash', 'call_trace_address', 'order_hash'] ) }} -{{ +{{ oneinch_project_orders_macro( blockchain = blockchain ) diff --git a/models/oneinch/optimism/oneinch_optimism_project_swaps.sql b/models/oneinch/optimism/oneinch_optimism_project_swaps.sql index b04f1a056fb..5715b69e0eb 100644 --- a/models/oneinch/optimism/oneinch_optimism_project_swaps.sql +++ b/models/oneinch/optimism/oneinch_optimism_project_swaps.sql @@ -2,14 +2,15 @@ -{{ - config( +{{ + config( schema = 'oneinch_' + blockchain, alias = 'project_swaps', partition_by = ['block_month'], materialized = 'incremental', file_format = 'delta', incremental_strategy = 'merge', + incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.block_time')], unique_key = ['blockchain', 'tx_hash', 'call_trace_address'] ) }} diff --git a/models/oneinch/polygon/oneinch_polygon_ar.sql b/models/oneinch/polygon/oneinch_polygon_ar.sql index a763c4c8993..a187a01d7c0 100644 --- a/models/oneinch/polygon/oneinch_polygon_ar.sql +++ b/models/oneinch/polygon/oneinch_polygon_ar.sql @@ -2,21 +2,22 @@ -{{ - config( +{{ + config( schema = 'oneinch_' + blockchain, alias = 'ar', partition_by = ['block_month'], materialized = 'incremental', file_format = 'delta', incremental_strategy = 'merge', + incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.block_time')], unique_key = ['blockchain', 'tx_hash', 'call_trace_address'] ) }} -{{ +{{ oneinch_ar_macro( blockchain = blockchain ) diff --git a/models/oneinch/polygon/oneinch_polygon_call_transfers.sql b/models/oneinch/polygon/oneinch_polygon_call_transfers.sql index 1c1ff9f36cf..4e8b1fbbbfd 100644 --- a/models/oneinch/polygon/oneinch_polygon_call_transfers.sql +++ b/models/oneinch/polygon/oneinch_polygon_call_transfers.sql @@ -2,7 +2,7 @@ -{{ +{{ config( schema = 'oneinch_' + blockchain, alias = 'call_transfers', @@ -10,13 +10,14 @@ materialized = 'incremental', file_format = 'delta', incremental_strategy = 'merge', + incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.block_time')], unique_key = ['tx_hash', 'call_trace_address', 'transfer_trace_address', 'transfer_native'] ) }} -{{ +{{ oneinch_call_transfers_macro( blockchain = blockchain ) diff --git a/models/oneinch/polygon/oneinch_polygon_lop.sql b/models/oneinch/polygon/oneinch_polygon_lop.sql index 279ca74369c..aa23fdec628 100644 --- a/models/oneinch/polygon/oneinch_polygon_lop.sql +++ b/models/oneinch/polygon/oneinch_polygon_lop.sql @@ -2,21 +2,22 @@ -{{ - config( +{{ + config( schema = 'oneinch_' + blockchain, alias = 'lop', partition_by = ['block_month'], materialized = 'incremental', file_format = 'delta', incremental_strategy = 'merge', + incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.block_time')], unique_key = ['blockchain', 'tx_hash', 'call_trace_address'] ) }} -{{ +{{ oneinch_lop_macro( blockchain = blockchain ) diff --git a/models/oneinch/polygon/oneinch_polygon_project_orders.sql b/models/oneinch/polygon/oneinch_polygon_project_orders.sql index 910f1facb9a..519729a3126 100644 --- a/models/oneinch/polygon/oneinch_polygon_project_orders.sql +++ b/models/oneinch/polygon/oneinch_polygon_project_orders.sql @@ -2,21 +2,22 @@ -{{ - config( +{{ + config( schema = 'oneinch_' + blockchain, alias = 'project_orders', partition_by = ['block_month'], materialized = 'incremental', file_format = 'delta', incremental_strategy = 'merge', + incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.block_time')], unique_key = ['blockchain', 'block_number', 'tx_hash', 'call_trace_address', 'order_hash'] ) }} -{{ +{{ oneinch_project_orders_macro( blockchain = blockchain ) diff --git a/models/oneinch/polygon/oneinch_polygon_project_swaps.sql b/models/oneinch/polygon/oneinch_polygon_project_swaps.sql index 57752705661..b93244d2cb1 100644 --- a/models/oneinch/polygon/oneinch_polygon_project_swaps.sql +++ b/models/oneinch/polygon/oneinch_polygon_project_swaps.sql @@ -2,14 +2,15 @@ -{{ - config( +{{ + config( schema = 'oneinch_' + blockchain, alias = 'project_swaps', partition_by = ['block_month'], materialized = 'incremental', file_format = 'delta', incremental_strategy = 'merge', + incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.block_time')], unique_key = ['blockchain', 'tx_hash', 'call_trace_address'] ) }} diff --git a/models/oneinch/zksync/oneinch_zksync_ar.sql b/models/oneinch/zksync/oneinch_zksync_ar.sql index 7646ef33af4..521743d2b7e 100644 --- a/models/oneinch/zksync/oneinch_zksync_ar.sql +++ b/models/oneinch/zksync/oneinch_zksync_ar.sql @@ -2,21 +2,22 @@ -{{ - config( +{{ + config( schema = 'oneinch_' + blockchain, alias = 'ar', partition_by = ['block_month'], materialized = 'incremental', file_format = 'delta', incremental_strategy = 'merge', + incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.block_time')], unique_key = ['blockchain', 'tx_hash', 'call_trace_address'] ) }} -{{ +{{ oneinch_ar_macro( blockchain = blockchain ) diff --git a/models/oneinch/zksync/oneinch_zksync_call_transfers.sql b/models/oneinch/zksync/oneinch_zksync_call_transfers.sql index 9821d0c09a8..002f281728c 100644 --- a/models/oneinch/zksync/oneinch_zksync_call_transfers.sql +++ b/models/oneinch/zksync/oneinch_zksync_call_transfers.sql @@ -2,21 +2,22 @@ -{{ - config( +{{ + config( schema = 'oneinch_' + blockchain, alias = 'call_transfers', partition_by = ['block_month'], materialized = 'incremental', file_format = 'delta', incremental_strategy = 'merge', + incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.block_time')], unique_key = ['tx_hash', 'call_trace_address', 'transfer_trace_address', 'transfer_native'] ) }} -{{ +{{ oneinch_call_transfers_macro( blockchain = blockchain ) diff --git a/models/oneinch/zksync/oneinch_zksync_lop.sql b/models/oneinch/zksync/oneinch_zksync_lop.sql index b05c2dccb87..5fac726a6e7 100644 --- a/models/oneinch/zksync/oneinch_zksync_lop.sql +++ b/models/oneinch/zksync/oneinch_zksync_lop.sql @@ -2,21 +2,22 @@ -{{ - config( +{{ + config( schema = 'oneinch_' + blockchain, alias = 'lop', partition_by = ['block_month'], materialized = 'incremental', file_format = 'delta', incremental_strategy = 'merge', + incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.block_time')], unique_key = ['blockchain', 'tx_hash', 'call_trace_address'] ) }} -{{ +{{ oneinch_lop_macro( blockchain = blockchain ) diff --git a/models/oneinch/zksync/oneinch_zksync_project_orders.sql b/models/oneinch/zksync/oneinch_zksync_project_orders.sql index 35a4146f2d1..b3f3798bedf 100644 --- a/models/oneinch/zksync/oneinch_zksync_project_orders.sql +++ b/models/oneinch/zksync/oneinch_zksync_project_orders.sql @@ -2,21 +2,22 @@ -{{ - config( +{{ + config( schema = 'oneinch_' + blockchain, alias = 'project_orders', partition_by = ['block_month'], materialized = 'incremental', file_format = 'delta', incremental_strategy = 'merge', + incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.block_time')], unique_key = ['blockchain', 'block_number', 'tx_hash', 'call_trace_address', 'order_hash'] ) }} -{{ +{{ oneinch_project_orders_macro( blockchain = blockchain ) diff --git a/models/oneinch/zksync/oneinch_zksync_project_swaps.sql b/models/oneinch/zksync/oneinch_zksync_project_swaps.sql index 1307b073233..c5fe2f1848d 100644 --- a/models/oneinch/zksync/oneinch_zksync_project_swaps.sql +++ b/models/oneinch/zksync/oneinch_zksync_project_swaps.sql @@ -2,14 +2,15 @@ -{{ - config( +{{ + config( schema = 'oneinch_' + blockchain, alias = 'project_swaps', partition_by = ['block_month'], materialized = 'incremental', file_format = 'delta', incremental_strategy = 'merge', + incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.block_time')], unique_key = ['blockchain', 'tx_hash', 'call_trace_address'] ) }} From bfa5b3c71ec834367d2a7c83264d6a4968f6421b Mon Sep 17 00:00:00 2001 From: Alan Ghobadi Date: Tue, 4 Jun 2024 18:08:07 +0200 Subject: [PATCH 035/149] Use incremental predicates in cow_protocol (#6060) --- .../arbitrum/cow_protocol_arbitrum_trades.sql | 11 ++++++----- .../ethereum/cow_protocol_ethereum_batches.sql | 11 ++++++----- .../cow_protocol_ethereum_eth_flow_orders.sql | 7 ++++--- .../ethereum/cow_protocol_ethereum_trades.sql | 13 +++++++------ .../gnosis/cow_protocol_gnosis_batches.sql | 11 ++++++----- .../gnosis/cow_protocol_gnosis_trades.sql | 11 ++++++----- 6 files changed, 35 insertions(+), 29 deletions(-) diff --git a/models/cow_protocol/arbitrum/cow_protocol_arbitrum_trades.sql b/models/cow_protocol/arbitrum/cow_protocol_arbitrum_trades.sql index 8a9ec8d7a4f..e6dcd1c2e6d 100644 --- a/models/cow_protocol/arbitrum/cow_protocol_arbitrum_trades.sql +++ b/models/cow_protocol/arbitrum/cow_protocol_arbitrum_trades.sql @@ -7,6 +7,7 @@ on_schema_change='sync_all_columns', file_format ='delta', incremental_strategy='merge', + incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.block_time')], post_hook='{{ expose_spells(\'["arbitrum"]\', "project", "cow_protocol", @@ -41,17 +42,17 @@ trades_with_prices AS ( AND ps.minute = date_trunc('minute', evt_block_time) AND ps.blockchain = 'arbitrum' {% if is_incremental() %} - AND ps.minute >= date_trunc('day', now() - interval '7' day) + AND {{ incremental_predicate('ps.minute') }} {% endif %} LEFT OUTER JOIN {{ source('prices', 'usd') }} as pb - ON pb.contract_address = buyToken + ON pb.contract_address = buyToken AND pb.minute = date_trunc('minute', evt_block_time) AND pb.blockchain = 'arbitrum' {% if is_incremental() %} - AND pb.minute >= date_trunc('day', now() - interval '7' day) + AND {{ incremental_predicate('pb.minute') }} {% endif %} {% if is_incremental() %} - WHERE evt_block_time >= date_trunc('day', now() - interval '7' day) + WHERE {{ incremental_predicate('evt_block_time') }} {% endif %} ), -- Second subquery gets token symbol and decimals from tokens.erc20 (to display units bought and sold) @@ -103,7 +104,7 @@ sorted_orders as ( orderUid from {{ source('gnosis_protocol_v2_arbitrum', 'GPv2Settlement_evt_Trade') }} {% if is_incremental() %} - where evt_block_time >= date_trunc('day', now() - interval '7' day) + where {{ incremental_predicate('evt_block_time') }} {% endif %} ) group by evt_tx_hash, evt_block_number diff --git a/models/cow_protocol/ethereum/cow_protocol_ethereum_batches.sql b/models/cow_protocol/ethereum/cow_protocol_ethereum_batches.sql index 5a43a8630a1..f10cd5e28b0 100644 --- a/models/cow_protocol/ethereum/cow_protocol_ethereum_batches.sql +++ b/models/cow_protocol/ethereum/cow_protocol_ethereum_batches.sql @@ -1,12 +1,13 @@ {{ config( alias = 'batches', - + materialized='incremental', partition_by = ['block_date'], unique_key = ['tx_hash'], on_schema_change='sync_all_columns', file_format ='delta', incremental_strategy='merge', + incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.block_time')], post_hook='{{ expose_spells(\'["ethereum"]\', "project", "cow_protocol", @@ -36,12 +37,12 @@ batch_counts as ( left outer join {{ source('gnosis_protocol_v2_ethereum', 'GPv2Settlement_evt_Interaction') }} i on i.evt_tx_hash = s.evt_tx_hash {% if is_incremental() %} - AND i.evt_block_time >= date_trunc('day', now() - interval '7' day) + AND {{ incremental_predicate('i.evt_block_time') }} {% endif %} join cow_protocol_ethereum.solvers on solver = address {% if is_incremental() %} - WHERE s.evt_block_time >= date_trunc('day', now() - interval '7' day) + WHERE {{ incremental_predicate('s.evt_block_time') }} {% endif %} group by s.evt_block_number, s.evt_block_time, s.evt_tx_hash, solver, name ), @@ -59,7 +60,7 @@ batch_values as ( and p.minute = date_trunc('minute', block_time) and blockchain = 'ethereum' {% if is_incremental() %} - WHERE block_time >= date_trunc('day', now() - interval '7' day) + WHERE {{ incremental_predicate('block_time') }} {% endif %} group by tx_hash, price ), @@ -87,7 +88,7 @@ combined_batch_info as ( inner join {{ source('ethereum', 'transactions') }} tx on evt_tx_hash = hash {% if is_incremental() %} - AND block_time >= date_trunc('day', now() - interval '7' day) + AND {{ incremental_predicate('block_time') }} {% endif %} where num_trades > 0 --! Exclude Withdraw Batches ) diff --git a/models/cow_protocol/ethereum/cow_protocol_ethereum_eth_flow_orders.sql b/models/cow_protocol/ethereum/cow_protocol_ethereum_eth_flow_orders.sql index 9c19dc5d942..3dbf191bcc6 100644 --- a/models/cow_protocol/ethereum/cow_protocol_ethereum_eth_flow_orders.sql +++ b/models/cow_protocol/ethereum/cow_protocol_ethereum_eth_flow_orders.sql @@ -1,12 +1,13 @@ {{ config( alias='eth_flow_orders', - + materialized='incremental', partition_by = ['block_date'], unique_key = ['tx_hash', 'order_uid'], on_schema_change='sync_all_columns', file_format ='delta', incremental_strategy='merge', + incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.block_time')], post_hook='{{ expose_spells(\'["ethereum"]\', "project", "cow_protocol", @@ -53,8 +54,8 @@ eth_flow_orders as ( and call_tx_hash = evt_tx_hash and call_success = true {% if is_incremental() %} - WHERE evt_block_time >= date_trunc('day', now() - interval '7' day) - AND call_block_time >= date_trunc('day', now() - interval '7' day) + WHERE {{ incremental_predicate('evt_block_time') }} + AND {{ incremental_predicate('call_block_time') }} {% endif %} ) diff --git a/models/cow_protocol/ethereum/cow_protocol_ethereum_trades.sql b/models/cow_protocol/ethereum/cow_protocol_ethereum_trades.sql index f1f8b14beeb..5f7b78c54ee 100644 --- a/models/cow_protocol/ethereum/cow_protocol_ethereum_trades.sql +++ b/models/cow_protocol/ethereum/cow_protocol_ethereum_trades.sql @@ -1,5 +1,5 @@ {{ config( - + alias='trades', materialized='incremental', partition_by = ['block_month'], @@ -7,6 +7,7 @@ on_schema_change='sync_all_columns', file_format ='delta', incremental_strategy='merge', + incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.block_time')], post_hook='{{ expose_spells(\'["ethereum"]\', "project", "cow_protocol", @@ -41,7 +42,7 @@ trades_with_prices AS ( AND ps.minute = date_trunc('minute', evt_block_time) AND ps.blockchain = 'ethereum' {% if is_incremental() %} - AND ps.minute >= date_trunc('day', now() - interval '7' day) + AND {{ incremental_predicate('ps.minute') }} {% endif %} LEFT OUTER JOIN {{ source('prices', 'usd') }} as pb ON pb.contract_address = ( @@ -53,10 +54,10 @@ trades_with_prices AS ( AND pb.minute = date_trunc('minute', evt_block_time) AND pb.blockchain = 'ethereum' {% if is_incremental() %} - AND pb.minute >= date_trunc('day', now() - interval '7' day) + AND {{ incremental_predicate('pb.minute') }} {% endif %} {% if is_incremental() %} - WHERE evt_block_time >= date_trunc('day', now() - interval '7' day) + WHERE {{ incremental_predicate('evt_block_time') }} {% endif %} ), -- Second subquery gets token symbol and decimals from tokens.erc20 (to display units bought and sold) @@ -114,7 +115,7 @@ sorted_orders as ( orderUid from {{ source('gnosis_protocol_v2_ethereum', 'GPv2Settlement_evt_Trade') }} {% if is_incremental() %} - where evt_block_time >= date_trunc('day', now() - interval '7' day) + where {{ incremental_predicate('evt_block_time') }} {% endif %} ) group by evt_tx_hash, evt_block_number @@ -171,7 +172,7 @@ eth_flow_senders as ( on call_block_number = evt_block_number and call_tx_hash = evt_tx_hash {% if is_incremental() %} - where evt_block_time >= date_trunc('day', now() - interval '7' day) + where {{ incremental_predicate('evt_block_time') }} {% endif %} ), diff --git a/models/cow_protocol/gnosis/cow_protocol_gnosis_batches.sql b/models/cow_protocol/gnosis/cow_protocol_gnosis_batches.sql index bda9ae5d0e3..a1035548408 100644 --- a/models/cow_protocol/gnosis/cow_protocol_gnosis_batches.sql +++ b/models/cow_protocol/gnosis/cow_protocol_gnosis_batches.sql @@ -1,12 +1,13 @@ {{ config( alias = 'batches', - + materialized='incremental', partition_by = ['block_date'], unique_key = ['tx_hash'], on_schema_change='sync_all_columns', file_format ='delta', incremental_strategy='merge', + incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.block_time')], post_hook='{{ expose_spells(\'["gnosis"]\', "project", "cow_protocol", @@ -35,12 +36,12 @@ batch_counts as ( left outer join {{ source('gnosis_protocol_v2_gnosis', 'GPv2Settlement_evt_Interaction') }} i on i.evt_tx_hash = s.evt_tx_hash {% if is_incremental() %} - AND i.evt_block_time >= date_trunc('day', now() - interval '7' day) + AND {{ incremental_predicate('i.evt_block_time') }} {% endif %} join cow_protocol_gnosis.solvers on solver = address {% if is_incremental() %} - WHERE s.evt_block_time >= date_trunc('day', now() - interval '7' day) + WHERE {{ incremental_predicate('s.evt_block_time') }} {% endif %} group by s.evt_tx_hash, solver, s.evt_block_time, name ), @@ -58,7 +59,7 @@ batch_values as ( and p.minute = date_trunc('minute', block_time) and blockchain = 'gnosis' {% if is_incremental() %} - WHERE block_time >= date_trunc('day', now() - interval '7' day) + WHERE {{ incremental_predicate('block_time') }} {% endif %} group by tx_hash, price ), @@ -85,7 +86,7 @@ combined_batch_info as ( inner join {{ source('gnosis', 'transactions') }} tx on evt_tx_hash = hash {% if is_incremental() %} - AND tx.block_time >= date_trunc('day', now() - interval '7' day) + AND {{ incremental_predicate('tx.block_time') }} {% endif %} where num_trades > 0 --! Exclude Withdraw Batches ) diff --git a/models/cow_protocol/gnosis/cow_protocol_gnosis_trades.sql b/models/cow_protocol/gnosis/cow_protocol_gnosis_trades.sql index d203b38f077..2bae34d7c63 100644 --- a/models/cow_protocol/gnosis/cow_protocol_gnosis_trades.sql +++ b/models/cow_protocol/gnosis/cow_protocol_gnosis_trades.sql @@ -1,5 +1,5 @@ {{ config( - + alias='trades', materialized='incremental', partition_by = ['block_month'], @@ -7,6 +7,7 @@ on_schema_change='sync_all_columns', file_format ='delta', incremental_strategy='merge', + incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.block_time')], post_hook='{{ expose_spells(\'["gnosis"]\', "project", "cow_protocol", @@ -41,7 +42,7 @@ trades_with_prices AS ( AND ps.minute = date_trunc('minute', evt_block_time) AND ps.blockchain = 'gnosis' {% if is_incremental() %} - AND ps.minute >= date_trunc('day', now() - interval '7' day) + AND {{ incremental_predicate('ps.minute') }} {% endif %} LEFT OUTER JOIN {{ source('prices', 'usd') }} as pb ON pb.contract_address = ( @@ -53,10 +54,10 @@ trades_with_prices AS ( AND pb.minute = date_trunc('minute', evt_block_time) AND pb.blockchain = 'gnosis' {% if is_incremental() %} - AND pb.minute >= date_trunc('day', now() - interval '7' day) + AND {{ incremental_predicate('pb.minute') }} {% endif %} {% if is_incremental() %} - WHERE evt_block_time >= date_trunc('day', now() - interval '7' day) + WHERE {{ incremental_predicate('evt_block_time') }} {% endif %} ), -- Second subquery gets token symbol and decimals from tokens.erc20 (to display units bought and sold) @@ -114,7 +115,7 @@ sorted_orders as ( orderUid from {{ source('gnosis_protocol_v2_gnosis', 'GPv2Settlement_evt_Trade') }} {% if is_incremental() %} - where evt_block_time >= date_trunc('day', now() - interval '7' day) + where {{ incremental_predicate('evt_block_time') }} {% endif %} ) group by evt_tx_hash, evt_block_number From c383264113bbb8a5eee1ae2639d75979cc4b40cd Mon Sep 17 00:00:00 2001 From: Alan Ghobadi Date: Tue, 4 Jun 2024 18:08:20 +0200 Subject: [PATCH 036/149] Add missing incremental predicates to zeroex (#6069) --- models/zeroex/arbitrum/zeroex_arbitrum_api_fills.sql | 3 ++- models/zeroex/ethereum/zeroex_ethereum_api_fills.sql | 3 ++- models/zeroex/polygon/zeroex_polygon_native_fills.sql | 3 ++- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/models/zeroex/arbitrum/zeroex_arbitrum_api_fills.sql b/models/zeroex/arbitrum/zeroex_arbitrum_api_fills.sql index d877cb4ac0e..ca28b611eb6 100644 --- a/models/zeroex/arbitrum/zeroex_arbitrum_api_fills.sql +++ b/models/zeroex/arbitrum/zeroex_arbitrum_api_fills.sql @@ -6,7 +6,8 @@ unique_key = ['block_date', 'tx_hash', 'evt_index'], on_schema_change='sync_all_columns', file_format ='delta', - incremental_strategy='merge' + incremental_strategy='merge', + incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.block_time')] ) }} diff --git a/models/zeroex/ethereum/zeroex_ethereum_api_fills.sql b/models/zeroex/ethereum/zeroex_ethereum_api_fills.sql index 99ac30ff8a8..1531044e861 100644 --- a/models/zeroex/ethereum/zeroex_ethereum_api_fills.sql +++ b/models/zeroex/ethereum/zeroex_ethereum_api_fills.sql @@ -6,7 +6,8 @@ unique_key = ['block_date', 'tx_hash', 'evt_index'], on_schema_change='sync_all_columns', file_format ='delta', - incremental_strategy='merge' + incremental_strategy='merge', + incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.block_time')] ) }} diff --git a/models/zeroex/polygon/zeroex_polygon_native_fills.sql b/models/zeroex/polygon/zeroex_polygon_native_fills.sql index 548a6251a2b..686061f2904 100644 --- a/models/zeroex/polygon/zeroex_polygon_native_fills.sql +++ b/models/zeroex/polygon/zeroex_polygon_native_fills.sql @@ -5,7 +5,8 @@ unique_key = ['block_date', 'tx_hash', 'evt_index'], on_schema_change='sync_all_columns', file_format ='delta', - incremental_strategy='merge' + incremental_strategy='merge', + incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.block_time')] ) }} From 548e714138642e65de501a32467e064cb18edacd Mon Sep 17 00:00:00 2001 From: Alan Ghobadi Date: Tue, 4 Jun 2024 18:08:32 +0200 Subject: [PATCH 037/149] Incremental predicate chainlink (#6054) * Use incremental_predicate macro in chainlink models Via search and replace `(\w+\.\w+|\w+) >= date_trunc\(.*?\)` and ` {{ incremental_predicate('$1') }}` * Remove incremental_interval variable * Add incremental predicate strategy For models with the specific unique key * Add incremental_predicate strategy to more models * More models * Fix typo --- ...k_arbitrum_ccip_fulfilled_transactions.sql | 11 +++++------ .../chainlink_arbitrum_ccip_gas_daily.sql | 13 ++++++------- ...ainlink_arbitrum_ccip_nop_reward_daily.sql | 17 ++++++++--------- .../chainlink_arbitrum_ccip_request_daily.sql | 9 ++++----- ...nk_arbitrum_ccip_reverted_transactions.sql | 11 +++++------ .../chainlink_arbitrum_ccip_reward_daily.sql | 19 +++++++++---------- ...ink_arbitrum_ccip_send_requested_daily.sql | 7 +++---- ...nk_arbitrum_ccip_transmitted_fulfilled.sql | 16 ++++++++-------- ...ink_arbitrum_ccip_transmitted_reverted.sql | 16 ++++++++-------- ...ink_arbitrum_fm_fulfilled_transactions.sql | 16 ++++++++-------- .../chainlink_arbitrum_fm_gas_daily.sql | 13 ++++++------- .../chainlink_arbitrum_fm_request_daily.sql | 11 +++++------ ...link_arbitrum_fm_reverted_transactions.sql | 14 +++++++------- .../chainlink_arbitrum_fm_reward_daily.sql | 17 ++++++++--------- ..._arbitrum_fm_reward_evt_transfer_daily.sql | 7 +++---- ...nk_arbitrum_ocr_fulfilled_transactions.sql | 12 ++++++------ .../chainlink_arbitrum_ocr_gas_daily.sql | 13 ++++++------- .../chainlink_arbitrum_ocr_request_daily.sql | 11 +++++------ ...ink_arbitrum_ocr_reverted_transactions.sql | 12 ++++++------ .../chainlink_arbitrum_ocr_reward_daily.sql | 17 ++++++++--------- ...arbitrum_ocr_reward_evt_transfer_daily.sql | 7 +++---- .../chainlink_arbitrum_price_feeds.sql | 17 ++++++++--------- .../chainlink_arbitrum_price_feeds_hourly.sql | 7 +++---- ...nk_arbitrum_vrf_fulfilled_transactions.sql | 13 +++++++------ .../chainlink_arbitrum_vrf_gas_daily.sql | 13 ++++++------- .../chainlink_arbitrum_vrf_request_daily.sql | 11 +++++------ ...k_arbitrum_vrf_request_fulfilled_daily.sql | 7 +++---- ...ink_arbitrum_vrf_reverted_transactions.sql | 14 +++++++------- .../chainlink_arbitrum_vrf_reward_daily.sql | 13 ++++++------- ...he_c_automation_fulfilled_transactions.sql | 16 ++++++++-------- ...nlink_avalanche_c_automation_gas_daily.sql | 13 ++++++------- ...avalanche_c_automation_performed_daily.sql | 10 +++++----- ...k_avalanche_c_automation_request_daily.sql | 11 +++++------ ...che_c_automation_reverted_transactions.sql | 14 +++++++------- ...nk_avalanche_c_automation_reward_daily.sql | 13 ++++++------- ...valanche_c_ccip_fulfilled_transactions.sql | 11 +++++------ .../chainlink_avalanche_c_ccip_gas_daily.sql | 13 ++++++------- ...link_avalanche_c_ccip_nop_reward_daily.sql | 17 ++++++++--------- ...ainlink_avalanche_c_ccip_request_daily.sql | 9 ++++----- ...avalanche_c_ccip_reverted_transactions.sql | 11 +++++------ ...hainlink_avalanche_c_ccip_reward_daily.sql | 17 ++++++++--------- ..._avalanche_c_ccip_send_requested_daily.sql | 7 +++---- ...avalanche_c_ccip_transmitted_fulfilled.sql | 16 ++++++++-------- ..._avalanche_c_ccip_transmitted_reverted.sql | 16 ++++++++-------- ..._avalanche_c_fm_fulfilled_transactions.sql | 16 ++++++++-------- .../chainlink_avalanche_c_fm_gas_daily.sql | 13 ++++++------- ...chainlink_avalanche_c_fm_request_daily.sql | 11 +++++------ ...k_avalanche_c_fm_reverted_transactions.sql | 14 +++++++------- .../chainlink_avalanche_c_fm_reward_daily.sql | 17 ++++++++--------- ...alanche_c_fm_reward_evt_transfer_daily.sql | 7 +++---- ...avalanche_c_ocr_fulfilled_transactions.sql | 12 ++++++------ .../chainlink_avalanche_c_ocr_gas_daily.sql | 13 ++++++------- ...hainlink_avalanche_c_ocr_request_daily.sql | 11 +++++------ ..._avalanche_c_ocr_reverted_transactions.sql | 12 ++++++------ ...chainlink_avalanche_c_ocr_reward_daily.sql | 17 ++++++++--------- ...lanche_c_ocr_reward_evt_transfer_daily.sql | 7 +++---- .../chainlink_avalanche_c_price_feeds.sql | 17 ++++++++--------- ...ainlink_avalanche_c_price_feeds_hourly.sql | 7 +++---- ...avalanche_c_vrf_fulfilled_transactions.sql | 13 +++++++------ .../chainlink_avalanche_c_vrf_gas_daily.sql | 13 ++++++------- ...hainlink_avalanche_c_vrf_request_daily.sql | 11 +++++------ ...valanche_c_vrf_request_fulfilled_daily.sql | 7 +++---- ..._avalanche_c_vrf_reverted_transactions.sql | 14 +++++++------- ...chainlink_avalanche_c_vrf_reward_daily.sql | 13 ++++++------- ...nlink_base_ccip_fulfilled_transactions.sql | 11 +++++------ .../base/chainlink_base_ccip_gas_daily.sql | 13 ++++++------- .../chainlink_base_ccip_nop_reward_daily.sql | 17 ++++++++--------- .../chainlink_base_ccip_request_daily.sql | 9 ++++----- ...inlink_base_ccip_reverted_transactions.sql | 11 +++++------ .../base/chainlink_base_ccip_reward_daily.sql | 17 ++++++++--------- ...ainlink_base_ccip_send_requested_daily.sql | 7 +++---- ...inlink_base_ccip_transmitted_fulfilled.sql | 16 ++++++++-------- ...ainlink_base_ccip_transmitted_reverted.sql | 16 ++++++++-------- ..._bnb_automation_fulfilled_transactions.sql | 16 ++++++++-------- .../chainlink_bnb_automation_gas_daily.sql | 13 ++++++------- ...ainlink_bnb_automation_performed_daily.sql | 10 +++++----- ...chainlink_bnb_automation_request_daily.sql | 11 +++++------ ...k_bnb_automation_reverted_transactions.sql | 14 +++++++------- .../chainlink_bnb_automation_reward_daily.sql | 13 ++++++------- ...inlink_bnb_ccip_fulfilled_transactions.sql | 11 +++++------ .../bnb/chainlink_bnb_ccip_gas_daily.sql | 13 ++++++------- .../chainlink_bnb_ccip_nop_reward_daily.sql | 17 ++++++++--------- .../bnb/chainlink_bnb_ccip_request_daily.sql | 9 ++++----- ...ainlink_bnb_ccip_reverted_transactions.sql | 11 +++++------ .../bnb/chainlink_bnb_ccip_reward_daily.sql | 17 ++++++++--------- ...hainlink_bnb_ccip_send_requested_daily.sql | 7 +++---- ...ainlink_bnb_ccip_transmitted_fulfilled.sql | 16 ++++++++-------- ...hainlink_bnb_ccip_transmitted_reverted.sql | 16 ++++++++-------- ...hainlink_bnb_fm_fulfilled_transactions.sql | 16 ++++++++-------- .../bnb/chainlink_bnb_fm_gas_daily.sql | 13 ++++++------- .../bnb/chainlink_bnb_fm_request_daily.sql | 11 +++++------ ...chainlink_bnb_fm_reverted_transactions.sql | 14 +++++++------- .../bnb/chainlink_bnb_fm_reward_daily.sql | 17 ++++++++--------- ...nlink_bnb_fm_reward_evt_transfer_daily.sql | 7 +++---- ...ainlink_bnb_ocr_fulfilled_transactions.sql | 12 ++++++------ .../bnb/chainlink_bnb_ocr_gas_daily.sql | 13 ++++++------- .../bnb/chainlink_bnb_ocr_request_daily.sql | 11 +++++------ ...hainlink_bnb_ocr_reverted_transactions.sql | 12 ++++++------ .../bnb/chainlink_bnb_ocr_reward_daily.sql | 17 ++++++++--------- ...link_bnb_ocr_reward_evt_transfer_daily.sql | 7 +++---- .../bnb/chainlink_bnb_price_feeds.sql | 17 ++++++++--------- .../bnb/chainlink_bnb_price_feeds_hourly.sql | 7 +++---- ...ainlink_bnb_vrf_fulfilled_transactions.sql | 13 +++++++------ .../bnb/chainlink_bnb_vrf_gas_daily.sql | 13 ++++++------- .../bnb/chainlink_bnb_vrf_request_daily.sql | 11 +++++------ ...inlink_bnb_vrf_request_fulfilled_daily.sql | 7 +++---- ...hainlink_bnb_vrf_reverted_transactions.sql | 14 +++++++------- .../bnb/chainlink_bnb_vrf_reward_daily.sql | 13 ++++++------- ...reum_automation_fulfilled_transactions.sql | 16 ++++++++-------- ...hainlink_ethereum_automation_gas_daily.sql | 13 ++++++------- ...nk_ethereum_automation_performed_daily.sql | 10 +++++----- ...link_ethereum_automation_request_daily.sql | 11 +++++------ ...ereum_automation_reverted_transactions.sql | 14 +++++++------- ...nlink_ethereum_automation_reward_daily.sql | 13 ++++++------- ...k_ethereum_ccip_fulfilled_transactions.sql | 11 +++++------ .../chainlink_ethereum_ccip_gas_daily.sql | 13 ++++++------- ...ainlink_ethereum_ccip_nop_reward_daily.sql | 17 ++++++++--------- .../chainlink_ethereum_ccip_request_daily.sql | 9 ++++----- ...nk_ethereum_ccip_reverted_transactions.sql | 11 +++++------ .../chainlink_ethereum_ccip_reward_daily.sql | 17 ++++++++--------- ...ink_ethereum_ccip_send_requested_daily.sql | 7 +++---- ...nk_ethereum_ccip_transmitted_fulfilled.sql | 16 ++++++++-------- ...ink_ethereum_ccip_transmitted_reverted.sql | 16 ++++++++-------- ...ink_ethereum_fm_fulfilled_transactions.sql | 16 ++++++++-------- .../chainlink_ethereum_fm_gas_daily.sql | 13 ++++++------- .../chainlink_ethereum_fm_request_daily.sql | 11 +++++------ ...link_ethereum_fm_reverted_transactions.sql | 14 +++++++------- .../chainlink_ethereum_fm_reward_daily.sql | 17 ++++++++--------- ..._ethereum_fm_reward_evt_transfer_daily.sql | 7 +++---- ...nk_ethereum_ocr_fulfilled_transactions.sql | 12 ++++++------ .../chainlink_ethereum_ocr_gas_daily.sql | 13 ++++++------- .../chainlink_ethereum_ocr_request_daily.sql | 11 +++++------ ...ink_ethereum_ocr_reverted_transactions.sql | 12 ++++++------ .../chainlink_ethereum_ocr_reward_daily.sql | 17 ++++++++--------- ...ethereum_ocr_reward_evt_transfer_daily.sql | 7 +++---- .../chainlink_ethereum_price_feeds.sql | 17 ++++++++--------- .../chainlink_ethereum_price_feeds_hourly.sql | 7 +++---- ...nk_ethereum_vrf_fulfilled_transactions.sql | 13 +++++++------ .../chainlink_ethereum_vrf_gas_daily.sql | 13 ++++++------- .../chainlink_ethereum_vrf_request_daily.sql | 11 +++++------ ...k_ethereum_vrf_request_fulfilled_daily.sql | 7 +++---- ...ink_ethereum_vrf_reverted_transactions.sql | 14 +++++++------- .../chainlink_ethereum_vrf_reward_daily.sql | 13 ++++++------- ...ntom_automation_fulfilled_transactions.sql | 16 ++++++++-------- .../chainlink_fantom_automation_gas_daily.sql | 13 ++++++------- ...link_fantom_automation_performed_daily.sql | 10 +++++----- ...inlink_fantom_automation_request_daily.sql | 11 +++++------ ...antom_automation_reverted_transactions.sql | 14 +++++++------- ...ainlink_fantom_automation_reward_daily.sql | 13 ++++++------- ...nlink_fantom_fm_fulfilled_transactions.sql | 16 ++++++++-------- .../fantom/chainlink_fantom_fm_gas_daily.sql | 13 ++++++------- .../chainlink_fantom_fm_request_daily.sql | 11 +++++------ ...inlink_fantom_fm_reverted_transactions.sql | 14 +++++++------- .../chainlink_fantom_fm_reward_daily.sql | 17 ++++++++--------- ...nk_fantom_fm_reward_evt_transfer_daily.sql | 7 +++---- ...link_fantom_ocr_fulfilled_transactions.sql | 12 ++++++------ .../fantom/chainlink_fantom_ocr_gas_daily.sql | 13 ++++++------- .../chainlink_fantom_ocr_request_daily.sql | 11 +++++------ ...nlink_fantom_ocr_reverted_transactions.sql | 12 ++++++------ .../chainlink_fantom_ocr_reward_daily.sql | 17 ++++++++--------- ...k_fantom_ocr_reward_evt_transfer_daily.sql | 7 +++---- .../fantom/chainlink_fantom_price_feeds.sql | 17 ++++++++--------- .../chainlink_fantom_price_feeds_hourly.sql | 7 +++---- ...link_fantom_vrf_fulfilled_transactions.sql | 11 ++++++----- .../fantom/chainlink_fantom_vrf_gas_daily.sql | 13 ++++++------- .../chainlink_fantom_vrf_request_daily.sql | 11 +++++------ ...ink_fantom_vrf_request_fulfilled_daily.sql | 7 +++---- ...nlink_fantom_vrf_reverted_transactions.sql | 14 +++++++------- .../chainlink_fantom_vrf_reward_daily.sql | 13 ++++++------- ...nlink_gnosis_fm_fulfilled_transactions.sql | 16 ++++++++-------- .../gnosis/chainlink_gnosis_fm_gas_daily.sql | 13 ++++++------- .../chainlink_gnosis_fm_request_daily.sql | 11 +++++------ ...inlink_gnosis_fm_reverted_transactions.sql | 14 +++++++------- .../chainlink_gnosis_fm_reward_daily.sql | 17 ++++++++--------- ...nk_gnosis_fm_reward_evt_transfer_daily.sql | 7 +++---- ...link_gnosis_ocr_fulfilled_transactions.sql | 12 ++++++------ .../gnosis/chainlink_gnosis_ocr_gas_daily.sql | 13 ++++++------- .../chainlink_gnosis_ocr_request_daily.sql | 11 +++++------ ...nlink_gnosis_ocr_reverted_transactions.sql | 12 ++++++------ .../chainlink_gnosis_ocr_reward_daily.sql | 17 ++++++++--------- ...k_gnosis_ocr_reward_evt_transfer_daily.sql | 7 +++---- .../gnosis/chainlink_gnosis_price_feeds.sql | 17 ++++++++--------- .../chainlink_gnosis_price_feeds_hourly.sql | 7 +++---- ...k_optimism_ccip_fulfilled_transactions.sql | 11 +++++------ .../chainlink_optimism_ccip_gas_daily.sql | 13 ++++++------- ...ainlink_optimism_ccip_nop_reward_daily.sql | 17 ++++++++--------- .../chainlink_optimism_ccip_request_daily.sql | 9 ++++----- ...nk_optimism_ccip_reverted_transactions.sql | 11 +++++------ .../chainlink_optimism_ccip_reward_daily.sql | 17 ++++++++--------- ...ink_optimism_ccip_send_requested_daily.sql | 7 +++---- ...nk_optimism_ccip_transmitted_fulfilled.sql | 16 ++++++++-------- ...ink_optimism_ccip_transmitted_reverted.sql | 16 ++++++++-------- ...ink_optimism_fm_fulfilled_transactions.sql | 16 ++++++++-------- .../chainlink_optimism_fm_gas_daily.sql | 13 ++++++------- .../chainlink_optimism_fm_request_daily.sql | 11 +++++------ ...link_optimism_fm_reverted_transactions.sql | 14 +++++++------- .../chainlink_optimism_fm_reward_daily.sql | 17 ++++++++--------- ..._optimism_fm_reward_evt_transfer_daily.sql | 7 +++---- ...nk_optimism_ocr_fulfilled_transactions.sql | 12 ++++++------ .../chainlink_optimism_ocr_gas_daily.sql | 13 ++++++------- .../chainlink_optimism_ocr_request_daily.sql | 11 +++++------ ...ink_optimism_ocr_reverted_transactions.sql | 12 ++++++------ .../chainlink_optimism_ocr_reward_daily.sql | 17 ++++++++--------- ...optimism_ocr_reward_evt_transfer_daily.sql | 7 +++---- .../chainlink_optimism_price_feeds.sql | 5 ++--- .../chainlink_optimism_price_feeds_hourly.sql | 7 +++---- ...ygon_automation_fulfilled_transactions.sql | 16 ++++++++-------- ...chainlink_polygon_automation_gas_daily.sql | 13 ++++++------- ...ink_polygon_automation_performed_daily.sql | 10 +++++----- ...nlink_polygon_automation_request_daily.sql | 11 +++++------ ...lygon_automation_reverted_transactions.sql | 14 +++++++------- ...inlink_polygon_automation_reward_daily.sql | 13 ++++++------- ...nk_polygon_ccip_fulfilled_transactions.sql | 11 +++++------ .../chainlink_polygon_ccip_gas_daily.sql | 13 ++++++------- ...hainlink_polygon_ccip_nop_reward_daily.sql | 17 ++++++++--------- .../chainlink_polygon_ccip_request_daily.sql | 9 ++++----- ...ink_polygon_ccip_reverted_transactions.sql | 11 +++++------ .../chainlink_polygon_ccip_reward_daily.sql | 17 ++++++++--------- ...link_polygon_ccip_send_requested_daily.sql | 7 +++---- ...ink_polygon_ccip_transmitted_fulfilled.sql | 16 ++++++++-------- ...link_polygon_ccip_transmitted_reverted.sql | 16 ++++++++-------- ...link_polygon_fm_fulfilled_transactions.sql | 16 ++++++++-------- .../chainlink_polygon_fm_gas_daily.sql | 13 ++++++------- .../chainlink_polygon_fm_request_daily.sql | 11 +++++------ ...nlink_polygon_fm_reverted_transactions.sql | 14 +++++++------- .../chainlink_polygon_fm_reward_daily.sql | 17 ++++++++--------- ...k_polygon_fm_reward_evt_transfer_daily.sql | 7 +++---- ...ink_polygon_ocr_fulfilled_transactions.sql | 12 ++++++------ .../chainlink_polygon_ocr_gas_daily.sql | 13 ++++++------- .../chainlink_polygon_ocr_request_daily.sql | 11 +++++------ ...link_polygon_ocr_reverted_transactions.sql | 12 ++++++------ .../chainlink_polygon_ocr_reward_daily.sql | 15 +++++++-------- ..._polygon_ocr_reward_evt_transfer_daily.sql | 7 +++---- .../polygon/chainlink_polygon_price_feeds.sql | 5 ++--- .../chainlink_polygon_price_feeds_hourly.sql | 7 +++---- ...ink_polygon_vrf_fulfilled_transactions.sql | 13 +++++++------ .../chainlink_polygon_vrf_gas_daily.sql | 13 ++++++------- .../chainlink_polygon_vrf_request_daily.sql | 11 +++++------ ...nk_polygon_vrf_request_fulfilled_daily.sql | 7 +++---- ...link_polygon_vrf_reverted_transactions.sql | 14 +++++++------- .../chainlink_polygon_vrf_reward_daily.sql | 13 ++++++------- 241 files changed, 1417 insertions(+), 1579 deletions(-) diff --git a/daily_spellbook/models/chainlink/arbitrum/chainlink_arbitrum_ccip_fulfilled_transactions.sql b/daily_spellbook/models/chainlink/arbitrum/chainlink_arbitrum_ccip_fulfilled_transactions.sql index 3ec03d275c7..26c6c86fb7f 100644 --- a/daily_spellbook/models/chainlink/arbitrum/chainlink_arbitrum_ccip_fulfilled_transactions.sql +++ b/daily_spellbook/models/chainlink/arbitrum/chainlink_arbitrum_ccip_fulfilled_transactions.sql @@ -8,7 +8,6 @@ ) }} -{% set incremental_interval = '7' %} WITH ccip_fulfilled_transactions AS ( @@ -23,12 +22,12 @@ WITH LEFT JOIN {{ source('arbitrum', 'transactions') }} tx ON ccip_send_logs_v1.tx_hash = tx.hash {% if is_incremental() %} - AND tx.block_time >= date_trunc('day', now() - interval '{{incremental_interval}}' day) + AND {{ incremental_predicate('tx.block_time') }} {% endif %} WHERE tx.success = true {% if is_incremental() %} - AND ccip_send_logs_v1.block_time >= date_trunc('day', now() - interval '{{incremental_interval}}' day) + AND {{ incremental_predicate('ccip_send_logs_v1.block_time') }} {% endif %} UNION @@ -44,14 +43,14 @@ WITH LEFT JOIN {{ source('arbitrum', 'transactions') }} tx ON ccip_send_logs_v1_2.tx_hash = tx.hash {% if is_incremental() %} - AND tx.block_time >= date_trunc('day', now() - interval '{{incremental_interval}}' day) + AND {{ incremental_predicate('tx.block_time') }} {% endif %} WHERE tx.success = true {% if is_incremental() %} - AND ccip_send_logs_v1_2.block_time >= date_trunc('day', now() - interval '{{incremental_interval}}' day) + AND {{ incremental_predicate('ccip_send_logs_v1_2.block_time') }} {% endif %} - + ) SELECT 'arbitrum' as blockchain, diff --git a/daily_spellbook/models/chainlink/arbitrum/chainlink_arbitrum_ccip_gas_daily.sql b/daily_spellbook/models/chainlink/arbitrum/chainlink_arbitrum_ccip_gas_daily.sql index e266bd4554b..b773bf5d783 100644 --- a/daily_spellbook/models/chainlink/arbitrum/chainlink_arbitrum_ccip_gas_daily.sql +++ b/daily_spellbook/models/chainlink/arbitrum/chainlink_arbitrum_ccip_gas_daily.sql @@ -1,6 +1,6 @@ {{ config( - + alias='ccip_gas_daily', partition_by=['date_month'], materialized='incremental', @@ -10,7 +10,6 @@ ) }} -{% set incremental_interval = '7' %} {% set truncate_by = 'day' %} WITH @@ -24,7 +23,7 @@ WITH {{ ref('chainlink_arbitrum_ccip_transmitted_fulfilled') }} fulfilled {% if is_incremental() %} WHERE - fulfilled.block_time >= date_trunc('day', now() - interval '{{incremental_interval}}' day) + {{ incremental_predicate('fulfilled.block_time') }} {% endif %} GROUP BY 1, 2 @@ -41,7 +40,7 @@ WITH {{ ref('chainlink_arbitrum_ccip_transmitted_reverted') }} reverted {% if is_incremental() %} WHERE - reverted.block_time >= date_trunc('day', now() - interval '{{incremental_interval}}' day) + {{ incremental_predicate('reverted.block_time') }} {% endif %} GROUP BY 1, 2 @@ -53,7 +52,7 @@ WITH COALESCE( fulfilled.date_start, reverted.date_start - ) AS "date_start", + ) AS "date_start", COALESCE( fulfilled.node_address, reverted.node_address @@ -86,7 +85,7 @@ WITH FROM ccip_gas_daily_meta LEFT JOIN {{ ref('chainlink_arbitrum_ccip_operator_meta') }} ccip_operator_meta ON ccip_operator_meta.node_address = ccip_gas_daily_meta.node_address ) -SELECT +SELECT blockchain, date_start, date_month, @@ -97,7 +96,7 @@ SELECT reverted_token_amount, reverted_usd_amount, total_token_amount, - total_usd_amount + total_usd_amount FROM ccip_gas_daily ORDER BY diff --git a/daily_spellbook/models/chainlink/arbitrum/chainlink_arbitrum_ccip_nop_reward_daily.sql b/daily_spellbook/models/chainlink/arbitrum/chainlink_arbitrum_ccip_nop_reward_daily.sql index fd14f700aa9..7e9063aa055 100644 --- a/daily_spellbook/models/chainlink/arbitrum/chainlink_arbitrum_ccip_nop_reward_daily.sql +++ b/daily_spellbook/models/chainlink/arbitrum/chainlink_arbitrum_ccip_nop_reward_daily.sql @@ -1,6 +1,6 @@ {{ config( - + alias='ccip_nop_reward_daily', partition_by = ['date_month'], materialized = 'incremental', @@ -10,7 +10,6 @@ ) }} -{% set incremental_interval = '7' %} WITH link_usd_daily AS ( @@ -20,7 +19,7 @@ WITH FROM {{ source('prices', 'usd') }} price WHERE - price.symbol = 'LINK' + price.symbol = 'LINK' GROUP BY 1 ORDER BY @@ -38,22 +37,22 @@ FROM {{ref('chainlink_arbitrum_ccip_nop_paid_logs')}} nop_logs LEFT JOIN {{ref('chainlink_arbitrum_ccip_admin_meta')}} admin_meta ON admin_meta.admin_address = nop_logs.nop_address {% if is_incremental() %} - WHERE block_time >= date_trunc('day', now() - interval '{{incremental_interval}}' day) -{% endif %} + WHERE {{ incremental_predicate('block_time') }} +{% endif %} GROUP BY 2, 4 ORDER BY 2, 4 ), nop_reward_daily AS ( - SELECT + SELECT nop_paid.date_start, cast(date_trunc('month', nop_paid.date_start) as date) as date_month, nop_paid.operator_name, - nop_paid.nop_address, + nop_paid.nop_address, nop_paid.token_amount as token_amount, (nop_paid.token_amount * lud.usd_amount) as usd_amount - FROM + FROM nop_paid LEFT JOIN link_usd_daily lud ON lud.date_start = nop_paid.date_start ORDER BY date_start @@ -66,7 +65,7 @@ SELECT nop_address, token_amount, usd_amount -FROM +FROM nop_reward_daily ORDER BY 2, 5 diff --git a/daily_spellbook/models/chainlink/arbitrum/chainlink_arbitrum_ccip_request_daily.sql b/daily_spellbook/models/chainlink/arbitrum/chainlink_arbitrum_ccip_request_daily.sql index 79de16d221a..d9b81bd3277 100644 --- a/daily_spellbook/models/chainlink/arbitrum/chainlink_arbitrum_ccip_request_daily.sql +++ b/daily_spellbook/models/chainlink/arbitrum/chainlink_arbitrum_ccip_request_daily.sql @@ -9,7 +9,6 @@ ) }} -{% set incremental_interval = '7' %} WITH ethereum_agg AS ( @@ -23,7 +22,7 @@ ethereum_agg AS ( WHERE eth.date_start = date_series.date_start {% if is_incremental() %} - AND eth.block_time >= date_trunc('day', now() - interval '{{incremental_interval}}' day) + AND {{ incremental_predicate('eth.block_time') }} {% endif %} ) AS fulfilled_requests, ( @@ -34,7 +33,7 @@ ethereum_agg AS ( WHERE rev.date_start = date_series.date_start {% if is_incremental() %} - AND rev.block_time >= date_trunc('day', now() - interval '{{incremental_interval}}' day) + AND {{ incremental_predicate('rev.block_time') }} {% endif %} ) AS reverted_requests FROM @@ -52,7 +51,7 @@ ethereum_agg AS ( ) AS seq CROSS JOIN UNNEST (seq.date_sequence) AS t (date_start) {% if is_incremental() %} - WHERE date_start >= date_trunc('day', now() - interval '{{incremental_interval}}' day) + WHERE {{ incremental_predicate('date_start') }} {% endif %} ) date_series ), @@ -67,7 +66,7 @@ ethereum_agg AS ( FROM ethereum_agg ) -SELECT +SELECT ccip_request_daily.blockchain, date_start, date_month, diff --git a/daily_spellbook/models/chainlink/arbitrum/chainlink_arbitrum_ccip_reverted_transactions.sql b/daily_spellbook/models/chainlink/arbitrum/chainlink_arbitrum_ccip_reverted_transactions.sql index 81efd4d4a7d..848043bf125 100644 --- a/daily_spellbook/models/chainlink/arbitrum/chainlink_arbitrum_ccip_reverted_transactions.sql +++ b/daily_spellbook/models/chainlink/arbitrum/chainlink_arbitrum_ccip_reverted_transactions.sql @@ -8,7 +8,6 @@ ) }} -{% set incremental_interval = '7' %} WITH ccip_reverted_transactions AS ( @@ -23,12 +22,12 @@ WITH LEFT JOIN {{ source('arbitrum', 'transactions') }} tx ON ccip_send_logs_v1.tx_hash = tx.hash {% if is_incremental() %} - AND tx.block_time >= date_trunc('day', now() - interval '{{incremental_interval}}' day) + AND {{ incremental_predicate('tx.block_time') }} {% endif %} WHERE tx.success = false {% if is_incremental() %} - AND ccip_send_logs_v1.block_time >= date_trunc('day', now() - interval '{{incremental_interval}}' day) + AND {{ incremental_predicate('ccip_send_logs_v1.block_time') }} {% endif %} UNION @@ -44,14 +43,14 @@ WITH LEFT JOIN {{ source('arbitrum', 'transactions') }} tx ON ccip_send_logs_v1_2.tx_hash = tx.hash {% if is_incremental() %} - AND tx.block_time >= date_trunc('day', now() - interval '{{incremental_interval}}' day) + AND {{ incremental_predicate('tx.block_time') }} {% endif %} WHERE tx.success = false {% if is_incremental() %} - AND ccip_send_logs_v1_2.block_time >= date_trunc('day', now() - interval '{{incremental_interval}}' day) + AND {{ incremental_predicate('ccip_send_logs_v1_2.block_time') }} {% endif %} - + ) SELECT 'arbitrum' as blockchain, diff --git a/daily_spellbook/models/chainlink/arbitrum/chainlink_arbitrum_ccip_reward_daily.sql b/daily_spellbook/models/chainlink/arbitrum/chainlink_arbitrum_ccip_reward_daily.sql index 319a60dcc05..14ac7111d4f 100644 --- a/daily_spellbook/models/chainlink/arbitrum/chainlink_arbitrum_ccip_reward_daily.sql +++ b/daily_spellbook/models/chainlink/arbitrum/chainlink_arbitrum_ccip_reward_daily.sql @@ -9,7 +9,6 @@ ) }} -{% set incremental_interval = '7' %} WITH token_meta AS ( @@ -28,29 +27,29 @@ WITH {{ source('prices', 'usd') }} price JOIN token_meta ON price.symbol = token_meta.token_symbol {% if is_incremental() %} - WHERE price.minute >= date_trunc('day', now() - interval '{{incremental_interval}}' day) - {% endif %} + WHERE {{ incremental_predicate('price.minute') }} + {% endif %} GROUP BY 1, token_meta.token_symbol ORDER BY 1 ), ccip_reward_daily AS ( - SELECT + SELECT ccip_send_requested_daily.date_start, - cast(date_trunc('month', ccip_send_requested_daily.date_start) as date) as date_month, + cast(date_trunc('month', ccip_send_requested_daily.date_start) as date) as date_month, SUM(ccip_send_requested_daily.fee_amount) as token_amount, SUM((ccip_send_requested_daily.fee_amount * tud.usd_amount)) as usd_amount, ccip_send_requested_daily.token as token - FROM + FROM {{ref('chainlink_arbitrum_ccip_send_requested_daily')}} ccip_send_requested_daily LEFT JOIN token_usd_daily tud ON tud.date_start = ccip_send_requested_daily.date_start AND tud.symbol = ccip_send_requested_daily.token {% if is_incremental() %} - WHERE ccip_send_requested_daily.date_start >= date_trunc('day', now() - interval '{{incremental_interval}}' day) - {% endif %} + WHERE {{ incremental_predicate('ccip_send_requested_daily.date_start') }} + {% endif %} GROUP BY 1, 5 ) - + SELECT 'arbitrum' as blockchain, date_start, @@ -58,7 +57,7 @@ SELECT token_amount, usd_amount, token -FROM +FROM ccip_reward_daily ORDER BY 2, 6 diff --git a/daily_spellbook/models/chainlink/arbitrum/chainlink_arbitrum_ccip_send_requested_daily.sql b/daily_spellbook/models/chainlink/arbitrum/chainlink_arbitrum_ccip_send_requested_daily.sql index 66df73ed9d5..46da580dcaf 100644 --- a/daily_spellbook/models/chainlink/arbitrum/chainlink_arbitrum_ccip_send_requested_daily.sql +++ b/daily_spellbook/models/chainlink/arbitrum/chainlink_arbitrum_ccip_send_requested_daily.sql @@ -1,6 +1,6 @@ {{ config( - + alias='ccip_send_requested_daily', partition_by=['date_month'], materialized='incremental', @@ -10,7 +10,6 @@ ) }} -{% set incremental_interval = '7' %} SELECT 'arbitrum' as blockchain, @@ -23,8 +22,8 @@ SELECT FROM {{ref('chainlink_arbitrum_ccip_send_requested')}} ccip_send_requested {% if is_incremental() %} - WHERE evt_block_time >= date_trunc('day', now() - interval '{{incremental_interval}}' day) -{% endif %} + WHERE {{ incremental_predicate('evt_block_time') }} +{% endif %} GROUP BY 2, 5, 6 ORDER BY diff --git a/daily_spellbook/models/chainlink/arbitrum/chainlink_arbitrum_ccip_transmitted_fulfilled.sql b/daily_spellbook/models/chainlink/arbitrum/chainlink_arbitrum_ccip_transmitted_fulfilled.sql index d1ae1b1f36c..da11788896d 100644 --- a/daily_spellbook/models/chainlink/arbitrum/chainlink_arbitrum_ccip_transmitted_fulfilled.sql +++ b/daily_spellbook/models/chainlink/arbitrum/chainlink_arbitrum_ccip_transmitted_fulfilled.sql @@ -1,16 +1,16 @@ {{ config( - + alias='ccip_transmitted_fulfilled', partition_by=['date_month'], materialized='incremental', file_format='delta', incremental_strategy='merge', - unique_key=['tx_hash', 'tx_index', 'node_address'] + unique_key=['tx_hash', 'tx_index', 'node_address'], + incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.block_time')] ) }} -{% set incremental_interval = '7' %} WITH arbitrum_usd AS ( @@ -22,8 +22,8 @@ WITH WHERE symbol = 'ETH' {% if is_incremental() %} - AND minute >= date_trunc('day', now() - interval '{{incremental_interval}}' day) - {% endif %} + AND {{ incremental_predicate('minute') }} + {% endif %} ), ccip_fulfilled_transactions AS ( SELECT @@ -38,12 +38,12 @@ WITH {{ source('arbitrum', 'transactions') }} tx RIGHT JOIN {{ ref('chainlink_arbitrum_ccip_transmitted_logs') }} ccip_tx ON ccip_tx.tx_hash = tx.hash {% if is_incremental() %} - AND ccip_tx.block_time >= date_trunc('day', now() - interval '{{incremental_interval}}' day) + AND {{ incremental_predicate('ccip_tx.block_time') }} {% endif %} LEFT JOIN arbitrum_usd ON date_trunc('minute', tx.block_time) = arbitrum_usd.block_time {% if is_incremental() %} - WHERE tx.block_time >= date_trunc('day', now() - interval '{{incremental_interval}}' day) - {% endif %} + WHERE {{ incremental_predicate('tx.block_time') }} + {% endif %} GROUP BY tx.hash, tx.index, diff --git a/daily_spellbook/models/chainlink/arbitrum/chainlink_arbitrum_ccip_transmitted_reverted.sql b/daily_spellbook/models/chainlink/arbitrum/chainlink_arbitrum_ccip_transmitted_reverted.sql index e4b9b07b940..beed2f2b11f 100644 --- a/daily_spellbook/models/chainlink/arbitrum/chainlink_arbitrum_ccip_transmitted_reverted.sql +++ b/daily_spellbook/models/chainlink/arbitrum/chainlink_arbitrum_ccip_transmitted_reverted.sql @@ -1,16 +1,16 @@ {{ config( - + alias='ccip_transmitted_reverted', partition_by=['date_month'], materialized='incremental', file_format='delta', incremental_strategy='merge', - unique_key=['tx_hash', 'tx_index', 'node_address'] + unique_key=['tx_hash', 'tx_index', 'node_address'], + incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.block_time')] ) }} -{% set incremental_interval = '7' %} WITH arbitrum_usd AS ( @@ -22,8 +22,8 @@ WITH WHERE symbol = 'ETH' {% if is_incremental() %} - AND minute >= date_trunc('day', now() - interval '{{incremental_interval}}' day) - {% endif %} + AND {{ incremental_predicate('minute') }} + {% endif %} ), ccip_reverted_transactions AS ( SELECT @@ -38,14 +38,14 @@ WITH {{ ref('chainlink_arbitrum_ccip_transmitted_logs') }} tx LEFT JOIN {{ source('arbitrum', 'transactions') }} tx2 ON tx2.hash = tx.tx_hash {% if is_incremental() %} - AND tx.block_time >= date_trunc('day', now() - interval '{{incremental_interval}}' day) + AND {{ incremental_predicate('tx.block_time') }} {% endif %} LEFT JOIN arbitrum_usd ON date_trunc('minute', tx.block_time) = arbitrum_usd.block_time WHERE tx2.success = false {% if is_incremental() %} - AND tx.block_time >= date_trunc('day', now() - interval '{{incremental_interval}}' day) - {% endif %} + AND {{ incremental_predicate('tx.block_time') }} + {% endif %} GROUP BY tx.tx_hash, tx.index, diff --git a/daily_spellbook/models/chainlink/arbitrum/chainlink_arbitrum_fm_fulfilled_transactions.sql b/daily_spellbook/models/chainlink/arbitrum/chainlink_arbitrum_fm_fulfilled_transactions.sql index 487074a0189..1584199af1d 100644 --- a/daily_spellbook/models/chainlink/arbitrum/chainlink_arbitrum_fm_fulfilled_transactions.sql +++ b/daily_spellbook/models/chainlink/arbitrum/chainlink_arbitrum_fm_fulfilled_transactions.sql @@ -1,16 +1,16 @@ {{ config( - + alias='fm_fulfilled_transactions', partition_by=['date_month'], materialized='incremental', file_format='delta', incremental_strategy='merge', - unique_key=['tx_hash', 'tx_index', 'node_address'] + unique_key=['tx_hash', 'tx_index', 'node_address'], + incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.block_time')] ) }} -{% set incremental_interval = '7' %} WITH arbitrum_usd AS ( @@ -22,8 +22,8 @@ WITH WHERE symbol = 'ETH' {% if is_incremental() %} - AND minute >= date_trunc('day', now() - interval '{{incremental_interval}}' day) - {% endif %} + AND {{ incremental_predicate('minute') }} + {% endif %} ), fm_submission_transactions AS ( SELECT @@ -40,12 +40,12 @@ WITH {{ source('arbitrum', 'transactions') }} tx RIGHT JOIN {{ ref('chainlink_arbitrum_fm_gas_submission_logs') }} fm_gas_submission_logs ON fm_gas_submission_logs.tx_hash = tx.hash {% if is_incremental() %} - AND fm_gas_submission_logs.block_time >= date_trunc('day', now() - interval '{{incremental_interval}}' day) + AND {{ incremental_predicate('fm_gas_submission_logs.block_time') }} {% endif %} LEFT JOIN arbitrum_usd ON date_trunc('minute', tx.block_time) = arbitrum_usd.block_time {% if is_incremental() %} - WHERE tx.block_time >= date_trunc('day', now() - interval '{{incremental_interval}}' day) - {% endif %} + WHERE {{ incremental_predicate('tx.block_time') }} + {% endif %} GROUP BY tx.hash, tx.index, diff --git a/daily_spellbook/models/chainlink/arbitrum/chainlink_arbitrum_fm_gas_daily.sql b/daily_spellbook/models/chainlink/arbitrum/chainlink_arbitrum_fm_gas_daily.sql index 2cf0ba0092b..240f9759a67 100644 --- a/daily_spellbook/models/chainlink/arbitrum/chainlink_arbitrum_fm_gas_daily.sql +++ b/daily_spellbook/models/chainlink/arbitrum/chainlink_arbitrum_fm_gas_daily.sql @@ -1,6 +1,6 @@ {{ config( - + alias='fm_gas_daily', partition_by=['date_month'], materialized='incremental', @@ -10,7 +10,6 @@ ) }} -{% set incremental_interval = '7' %} {% set truncate_by = 'day' %} WITH @@ -24,7 +23,7 @@ WITH {{ ref('chainlink_arbitrum_fm_fulfilled_transactions') }} fulfilled {% if is_incremental() %} WHERE - fulfilled.block_time >= date_trunc('day', now() - interval '{{incremental_interval}}' day) + {{ incremental_predicate('fulfilled.block_time') }} {% endif %} GROUP BY 1, 2 @@ -41,7 +40,7 @@ WITH {{ ref('chainlink_arbitrum_fm_reverted_transactions') }} reverted {% if is_incremental() %} WHERE - reverted.block_time >= date_trunc('day', now() - interval '{{incremental_interval}}' day) + {{ incremental_predicate('reverted.block_time') }} {% endif %} GROUP BY 1, 2 @@ -53,7 +52,7 @@ WITH COALESCE( fulfilled.date_start, reverted.date_start - ) AS "date_start", + ) AS "date_start", COALESCE( fulfilled.node_address, reverted.node_address @@ -86,7 +85,7 @@ WITH FROM fm_gas_daily_meta LEFT JOIN {{ ref('chainlink_arbitrum_ocr_operator_node_meta') }} fm_operator_node_meta ON fm_operator_node_meta.node_address = fm_gas_daily_meta.node_address ) -SELECT +SELECT blockchain, date_start, date_month, @@ -97,7 +96,7 @@ SELECT reverted_token_amount, reverted_usd_amount, total_token_amount, - total_usd_amount + total_usd_amount FROM fm_gas_daily ORDER BY diff --git a/daily_spellbook/models/chainlink/arbitrum/chainlink_arbitrum_fm_request_daily.sql b/daily_spellbook/models/chainlink/arbitrum/chainlink_arbitrum_fm_request_daily.sql index 23fae7cdf27..b1c601e0a6c 100644 --- a/daily_spellbook/models/chainlink/arbitrum/chainlink_arbitrum_fm_request_daily.sql +++ b/daily_spellbook/models/chainlink/arbitrum/chainlink_arbitrum_fm_request_daily.sql @@ -1,6 +1,6 @@ {{ config( - + alias='fm_request_daily', partition_by=['date_month'], materialized='incremental', @@ -10,7 +10,6 @@ ) }} -{% set incremental_interval = '7' %} {% set truncate_by = 'day' %} WITH @@ -19,7 +18,7 @@ WITH COALESCE( cast(date_trunc('{{truncate_by}}', fulfilled.block_time) as date), cast(date_trunc('{{truncate_by}}', reverted.block_time) as date) - ) AS "date_start", + ) AS "date_start", COALESCE( fulfilled.node_address, reverted.node_address @@ -34,8 +33,8 @@ WITH reverted.node_address = fulfilled.node_address {% if is_incremental() %} WHERE - fulfilled.block_time >= date_trunc('day', now() - interval '{{incremental_interval}}' day) - AND reverted.block_time >= date_trunc('day', now() - interval '{{incremental_interval}}' day) + {{ incremental_predicate('fulfilled.block_time') }} + AND {{ incremental_predicate('reverted.block_time') }} {% endif %} GROUP BY 1, 2 @@ -55,7 +54,7 @@ WITH FROM fm_request_daily_meta LEFT JOIN {{ ref('chainlink_arbitrum_ocr_operator_node_meta') }} fm_operator_node_meta ON fm_operator_node_meta.node_address = fm_request_daily_meta.node_address ) -SELECT +SELECT blockchain, date_start, date_month, diff --git a/daily_spellbook/models/chainlink/arbitrum/chainlink_arbitrum_fm_reverted_transactions.sql b/daily_spellbook/models/chainlink/arbitrum/chainlink_arbitrum_fm_reverted_transactions.sql index ee03d9ebc27..654546a51ce 100644 --- a/daily_spellbook/models/chainlink/arbitrum/chainlink_arbitrum_fm_reverted_transactions.sql +++ b/daily_spellbook/models/chainlink/arbitrum/chainlink_arbitrum_fm_reverted_transactions.sql @@ -1,16 +1,16 @@ {{ config( - + alias='fm_reverted_transactions', partition_by=['date_month'], materialized='incremental', file_format='delta', incremental_strategy='merge', - unique_key=['tx_hash', 'tx_index', 'node_address'] + unique_key=['tx_hash', 'tx_index', 'node_address'], + incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.block_time')] ) }} -{% set incremental_interval = '7' %} WITH arbitrum_usd AS ( @@ -22,8 +22,8 @@ WITH WHERE symbol = 'ETH' {% if is_incremental() %} - AND minute >= date_trunc('day', now() - interval '{{incremental_interval}}' day) - {% endif %} + AND {{ incremental_predicate('minute') }} + {% endif %} ), fm_reverted_transactions AS ( SELECT @@ -42,8 +42,8 @@ WITH WHERE success = false {% if is_incremental() %} - AND tx.block_time >= date_trunc('day', now() - interval '{{incremental_interval}}' day) - {% endif %} + AND {{ incremental_predicate('tx.block_time') }} + {% endif %} GROUP BY tx.hash, tx.index, diff --git a/daily_spellbook/models/chainlink/arbitrum/chainlink_arbitrum_fm_reward_daily.sql b/daily_spellbook/models/chainlink/arbitrum/chainlink_arbitrum_fm_reward_daily.sql index bfd641f7084..2d13e8edb81 100644 --- a/daily_spellbook/models/chainlink/arbitrum/chainlink_arbitrum_fm_reward_daily.sql +++ b/daily_spellbook/models/chainlink/arbitrum/chainlink_arbitrum_fm_reward_daily.sql @@ -1,6 +1,6 @@ {{ config( - + alias='fm_reward_daily', partition_by = ['date_month'], materialized = 'incremental', @@ -10,7 +10,6 @@ ) }} -{% set incremental_interval = '7' %} WITH admin_address_meta as ( @@ -28,8 +27,8 @@ WITH WHERE price.symbol = 'LINK' {% if is_incremental() %} - AND price.minute >= date_trunc('day', now() - interval '{{incremental_interval}}' day) - {% endif %} + AND {{ incremental_predicate('price.minute') }} + {% endif %} GROUP BY 1 ORDER BY @@ -77,16 +76,16 @@ WITH 1, 2 ), fm_reward_daily AS ( - SELECT + SELECT payment_meta.date_start, cast(date_trunc('month', payment_meta.date_start) as date) as date_month, payment_meta.admin_address, - ocr_operator_admin_meta.operator_name, + ocr_operator_admin_meta.operator_name, COALESCE(fm_reward_evt_transfer_daily.token_amount / EXTRACT(DAY FROM next_payment_date - prev_payment_date), 0) as token_amount, (COALESCE(fm_reward_evt_transfer_daily.token_amount / EXTRACT(DAY FROM next_payment_date - prev_payment_date), 0) * payment_meta.usd_amount) as usd_amount - FROM + FROM payment_meta - LEFT JOIN + LEFT JOIN {{ref('chainlink_arbitrum_fm_reward_evt_transfer_daily')}} fm_reward_evt_transfer_daily ON payment_meta.next_payment_date = fm_reward_evt_transfer_daily.date_start AND payment_meta.admin_address = fm_reward_evt_transfer_daily.admin_address @@ -101,7 +100,7 @@ SELECT operator_name, token_amount, usd_amount -FROM +FROM fm_reward_daily ORDER BY 2, 4 diff --git a/daily_spellbook/models/chainlink/arbitrum/chainlink_arbitrum_fm_reward_evt_transfer_daily.sql b/daily_spellbook/models/chainlink/arbitrum/chainlink_arbitrum_fm_reward_evt_transfer_daily.sql index 06b75bee4c6..7b6f8959dd0 100644 --- a/daily_spellbook/models/chainlink/arbitrum/chainlink_arbitrum_fm_reward_evt_transfer_daily.sql +++ b/daily_spellbook/models/chainlink/arbitrum/chainlink_arbitrum_fm_reward_evt_transfer_daily.sql @@ -1,6 +1,6 @@ {{ config( - + alias='fm_reward_evt_transfer_daily', partition_by=['date_month'], materialized='incremental', @@ -10,7 +10,6 @@ ) }} -{% set incremental_interval = '7' %} SELECT 'arbitrum' as blockchain, @@ -23,8 +22,8 @@ FROM {{ref('chainlink_arbitrum_fm_reward_evt_transfer')}} fm_reward_evt_transfer LEFT JOIN {{ ref('chainlink_arbitrum_ocr_operator_admin_meta') }} fm_operator_admin_meta ON fm_operator_admin_meta.admin_address = fm_reward_evt_transfer.admin_address {% if is_incremental() %} - WHERE evt_block_time >= date_trunc('day', now() - interval '{{incremental_interval}}' day) -{% endif %} + WHERE {{ incremental_predicate('evt_block_time') }} +{% endif %} GROUP BY 2, 4 ORDER BY diff --git a/daily_spellbook/models/chainlink/arbitrum/chainlink_arbitrum_ocr_fulfilled_transactions.sql b/daily_spellbook/models/chainlink/arbitrum/chainlink_arbitrum_ocr_fulfilled_transactions.sql index 6a442c8af4c..5357b952bb9 100644 --- a/daily_spellbook/models/chainlink/arbitrum/chainlink_arbitrum_ocr_fulfilled_transactions.sql +++ b/daily_spellbook/models/chainlink/arbitrum/chainlink_arbitrum_ocr_fulfilled_transactions.sql @@ -1,12 +1,13 @@ {{ config( - + alias='ocr_fulfilled_transactions', partition_by=['date_month'], materialized='incremental', file_format='delta', incremental_strategy='merge', unique_key=['tx_hash', 'tx_index', 'node_address'], + incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.block_time')], post_hook='{{ expose_spells(\'["arbitrum"]\', "project", "chainlink", @@ -14,7 +15,6 @@ ) }} -{% set incremental_interval = '7' %} WITH arbitrum_usd AS ( @@ -26,8 +26,8 @@ WITH WHERE symbol = 'ETH' {% if is_incremental() %} - AND minute >= date_trunc('day', now() - interval '{{incremental_interval}}' day) - {% endif %} + AND {{ incremental_predicate('minute') }} + {% endif %} ), ocr_fulfilled_transactions AS ( SELECT @@ -45,8 +45,8 @@ WITH RIGHT JOIN {{ ref('chainlink_arbitrum_ocr_gas_transmission_logs') }} ocr_gas_transmission_logs ON ocr_gas_transmission_logs.tx_hash = tx.hash LEFT JOIN arbitrum_usd ON date_trunc('minute', tx.block_time) = arbitrum_usd.block_time {% if is_incremental() %} - WHERE tx.block_time >= date_trunc('day', now() - interval '{{incremental_interval}}' day) - {% endif %} + WHERE {{ incremental_predicate('tx.block_time') }} + {% endif %} GROUP BY tx.hash, tx.index, diff --git a/daily_spellbook/models/chainlink/arbitrum/chainlink_arbitrum_ocr_gas_daily.sql b/daily_spellbook/models/chainlink/arbitrum/chainlink_arbitrum_ocr_gas_daily.sql index d4dd3b72c0f..0807a79b33d 100644 --- a/daily_spellbook/models/chainlink/arbitrum/chainlink_arbitrum_ocr_gas_daily.sql +++ b/daily_spellbook/models/chainlink/arbitrum/chainlink_arbitrum_ocr_gas_daily.sql @@ -1,6 +1,6 @@ {{ config( - + alias='ocr_gas_daily', partition_by=['date_month'], materialized='incremental', @@ -14,7 +14,6 @@ ) }} -{% set incremental_interval = '7' %} {% set truncate_by = 'day' %} WITH @@ -28,7 +27,7 @@ WITH {{ ref('chainlink_arbitrum_ocr_fulfilled_transactions') }} fulfilled {% if is_incremental() %} WHERE - fulfilled.block_time >= date_trunc('day', now() - interval '{{incremental_interval}}' day) + {{ incremental_predicate('fulfilled.block_time') }} {% endif %} GROUP BY 1, 2 @@ -45,7 +44,7 @@ WITH {{ ref('chainlink_arbitrum_ocr_reverted_transactions') }} reverted {% if is_incremental() %} WHERE - reverted.block_time >= date_trunc('day', now() - interval '{{incremental_interval}}' day) + {{ incremental_predicate('reverted.block_time') }} {% endif %} GROUP BY 1, 2 @@ -57,7 +56,7 @@ WITH COALESCE( fulfilled.date_start, reverted.date_start - ) AS "date_start", + ) AS "date_start", COALESCE( fulfilled.node_address, reverted.node_address @@ -90,7 +89,7 @@ WITH FROM ocr_gas_daily_meta LEFT JOIN {{ ref('chainlink_arbitrum_ocr_operator_node_meta') }} ocr_operator_node_meta ON ocr_operator_node_meta.node_address = ocr_gas_daily_meta.node_address ) -SELECT +SELECT blockchain, date_start, date_month, @@ -101,7 +100,7 @@ SELECT reverted_token_amount, reverted_usd_amount, total_token_amount, - total_usd_amount + total_usd_amount FROM ocr_gas_daily ORDER BY diff --git a/daily_spellbook/models/chainlink/arbitrum/chainlink_arbitrum_ocr_request_daily.sql b/daily_spellbook/models/chainlink/arbitrum/chainlink_arbitrum_ocr_request_daily.sql index d33a0c0732d..418573db597 100644 --- a/daily_spellbook/models/chainlink/arbitrum/chainlink_arbitrum_ocr_request_daily.sql +++ b/daily_spellbook/models/chainlink/arbitrum/chainlink_arbitrum_ocr_request_daily.sql @@ -1,6 +1,6 @@ {{ config( - + alias='ocr_request_daily', partition_by=['date_month'], materialized='incremental', @@ -14,7 +14,6 @@ ) }} -{% set incremental_interval = '7' %} {% set truncate_by = 'day' %} WITH @@ -23,7 +22,7 @@ WITH COALESCE( cast(date_trunc('{{truncate_by}}', fulfilled.block_time) as date), cast(date_trunc('{{truncate_by}}', reverted.block_time) as date) - ) AS "date_start", + ) AS "date_start", COALESCE( fulfilled.node_address, reverted.node_address @@ -38,8 +37,8 @@ WITH reverted.node_address = fulfilled.node_address {% if is_incremental() %} WHERE - fulfilled.block_time >= date_trunc('day', now() - interval '{{incremental_interval}}' day) - OR reverted.block_time >= date_trunc('day', now() - interval '{{incremental_interval}}' day) + {{ incremental_predicate('fulfilled.block_time') }} + OR {{ incremental_predicate('reverted.block_time') }} {% endif %} GROUP BY 1, 2 @@ -59,7 +58,7 @@ WITH FROM ocr_request_daily_meta LEFT JOIN {{ ref('chainlink_arbitrum_ocr_operator_node_meta') }} ocr_operator_node_meta ON ocr_operator_node_meta.node_address = ocr_request_daily_meta.node_address ) -SELECT +SELECT blockchain, date_start, date_month, diff --git a/daily_spellbook/models/chainlink/arbitrum/chainlink_arbitrum_ocr_reverted_transactions.sql b/daily_spellbook/models/chainlink/arbitrum/chainlink_arbitrum_ocr_reverted_transactions.sql index b654f1f74bd..15273ec7ea7 100644 --- a/daily_spellbook/models/chainlink/arbitrum/chainlink_arbitrum_ocr_reverted_transactions.sql +++ b/daily_spellbook/models/chainlink/arbitrum/chainlink_arbitrum_ocr_reverted_transactions.sql @@ -1,12 +1,13 @@ {{ config( - + alias='ocr_reverted_transactions', partition_by=['date_month'], materialized='incremental', file_format='delta', incremental_strategy='merge', unique_key=['tx_hash', 'tx_index', 'node_address'], + incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.block_time')], post_hook='{{ expose_spells(\'["arbitrum"]\', "project", "chainlink", @@ -14,7 +15,6 @@ ) }} -{% set incremental_interval = '7' %} WITH arbitrum_usd AS ( @@ -26,8 +26,8 @@ WITH WHERE symbol = 'ETH' {% if is_incremental() %} - AND minute >= date_trunc('day', now() - interval '{{incremental_interval}}' day) - {% endif %} + AND {{ incremental_predicate('minute') }} + {% endif %} ), ocr_reverted_transactions AS ( SELECT @@ -46,8 +46,8 @@ WITH WHERE success = false {% if is_incremental() %} - AND tx.block_time >= date_trunc('day', now() - interval '{{incremental_interval}}' day) - {% endif %} + AND {{ incremental_predicate('tx.block_time') }} + {% endif %} GROUP BY tx.hash, tx.index, diff --git a/daily_spellbook/models/chainlink/arbitrum/chainlink_arbitrum_ocr_reward_daily.sql b/daily_spellbook/models/chainlink/arbitrum/chainlink_arbitrum_ocr_reward_daily.sql index 473456cd2b4..742ede407fb 100644 --- a/daily_spellbook/models/chainlink/arbitrum/chainlink_arbitrum_ocr_reward_daily.sql +++ b/daily_spellbook/models/chainlink/arbitrum/chainlink_arbitrum_ocr_reward_daily.sql @@ -1,6 +1,6 @@ {{ config( - + alias='ocr_reward_daily', partition_by = ['date_month'], materialized = 'incremental', @@ -14,7 +14,6 @@ ) }} -{% set incremental_interval = '7' %} WITH admin_address_meta as ( @@ -32,8 +31,8 @@ WITH WHERE price.symbol = 'LINK' {% if is_incremental() %} - AND price.minute >= date_trunc('day', now() - interval '{{incremental_interval}}' day) - {% endif %} + AND {{ incremental_predicate('price.minute') }} + {% endif %} GROUP BY 1 ORDER BY @@ -81,16 +80,16 @@ WITH 1, 2 ), ocr_reward_daily AS ( - SELECT + SELECT payment_meta.date_start, cast(date_trunc('month', payment_meta.date_start) as date) as date_month, payment_meta.admin_address, - ocr_operator_admin_meta.operator_name, + ocr_operator_admin_meta.operator_name, COALESCE(ocr_reward_evt_transfer_daily.token_amount / EXTRACT(DAY FROM next_payment_date - prev_payment_date), 0) as token_amount, (COALESCE(ocr_reward_evt_transfer_daily.token_amount / EXTRACT(DAY FROM next_payment_date - prev_payment_date), 0) * payment_meta.usd_amount) as usd_amount - FROM + FROM payment_meta - LEFT JOIN + LEFT JOIN {{ref('chainlink_arbitrum_ocr_reward_evt_transfer_daily')}} ocr_reward_evt_transfer_daily ON payment_meta.next_payment_date = ocr_reward_evt_transfer_daily.date_start AND payment_meta.admin_address = ocr_reward_evt_transfer_daily.admin_address @@ -105,7 +104,7 @@ SELECT operator_name, token_amount, usd_amount -FROM +FROM ocr_reward_daily ORDER BY 2, 4 diff --git a/daily_spellbook/models/chainlink/arbitrum/chainlink_arbitrum_ocr_reward_evt_transfer_daily.sql b/daily_spellbook/models/chainlink/arbitrum/chainlink_arbitrum_ocr_reward_evt_transfer_daily.sql index 0d330f8c2ab..80bb9c4edc8 100644 --- a/daily_spellbook/models/chainlink/arbitrum/chainlink_arbitrum_ocr_reward_evt_transfer_daily.sql +++ b/daily_spellbook/models/chainlink/arbitrum/chainlink_arbitrum_ocr_reward_evt_transfer_daily.sql @@ -1,6 +1,6 @@ {{ config( - + alias='ocr_reward_evt_transfer_daily', partition_by=['date_month'], materialized='incremental', @@ -14,7 +14,6 @@ ) }} -{% set incremental_interval = '7' %} SELECT 'arbitrum' as blockchain, @@ -27,8 +26,8 @@ FROM {{ref('chainlink_arbitrum_ocr_reward_evt_transfer')}} ocr_reward_evt_transfer LEFT JOIN {{ ref('chainlink_arbitrum_ocr_operator_admin_meta') }} ocr_operator_admin_meta ON ocr_operator_admin_meta.admin_address = ocr_reward_evt_transfer.admin_address {% if is_incremental() %} - WHERE evt_block_time >= date_trunc('day', now() - interval '{{incremental_interval}}' day) -{% endif %} + WHERE {{ incremental_predicate('evt_block_time') }} +{% endif %} GROUP BY 2, 4 ORDER BY diff --git a/daily_spellbook/models/chainlink/arbitrum/chainlink_arbitrum_price_feeds.sql b/daily_spellbook/models/chainlink/arbitrum/chainlink_arbitrum_price_feeds.sql index 72fe95d4aa4..b58e6e5902e 100644 --- a/daily_spellbook/models/chainlink/arbitrum/chainlink_arbitrum_price_feeds.sql +++ b/daily_spellbook/models/chainlink/arbitrum/chainlink_arbitrum_price_feeds.sql @@ -1,6 +1,6 @@ {{ config( - + alias='price_feeds', partition_by=['block_month'], materialized='incremental', @@ -14,7 +14,6 @@ ) }} -{% set incremental_interval = '7' %} {% set project_start_date = '2021-08-31' %} SELECT 'arbitrum' as blockchain, @@ -27,11 +26,11 @@ SELECT 'arbitrum' as blockchain, c.proxy_address, c.aggregator_address, c.oracle_price / POWER(10, 0) as underlying_token_price, - CASE + CASE WHEN cardinality(split(c.feed_name, ' / ')) = 1 THEN c.feed_name ELSE element_at(split(c.feed_name, ' / '), 1) END AS base, - CASE + CASE WHEN cardinality(split(c.feed_name, ' / ')) = 1 THEN NULL ELSE element_at(split(c.feed_name, ' / '), 2) END AS quote @@ -39,14 +38,14 @@ FROM ( SELECT l.block_time, - cast(date_trunc('day', l.block_time) as date) as block_date, - cast(date_trunc('month', l.block_time) as date) as block_month, + cast(date_trunc('day', l.block_time) as date) as block_date, + cast(date_trunc('month', l.block_time) as date) as block_month, l.block_number, cfa.feed_name, cfa.proxy_address, MAX(cfa.aggregator_address) as aggregator_address, AVG( - CAST(bytearray_to_uint256(bytearray_substring(l.topic1, 3, 64)) as DOUBLE) + CAST(bytearray_to_uint256(bytearray_substring(l.topic1, 3, 64)) as DOUBLE) / POWER(10, cfa.decimals) ) as oracle_price FROM @@ -56,10 +55,10 @@ FROM WHERE l.topic0 = 0x0559884fd3a460db3073b7fc896cc77986f16e378210ded43186175bf646fc5f {% if not is_incremental() %} - AND l.block_time >= cast('{{project_start_date}}' as date) + AND l.block_time >= cast('{{project_start_date}}' as date) {% endif %} {% if is_incremental() %} - AND l.block_time >= date_trunc('day', now() - interval '{{incremental_interval}}' day) + AND {{ incremental_predicate('l.block_time') }} {% endif %} GROUP BY 1, 2, 3, 4, 5, 6 diff --git a/daily_spellbook/models/chainlink/arbitrum/chainlink_arbitrum_price_feeds_hourly.sql b/daily_spellbook/models/chainlink/arbitrum/chainlink_arbitrum_price_feeds_hourly.sql index 37f371a58ef..da55388df17 100644 --- a/daily_spellbook/models/chainlink/arbitrum/chainlink_arbitrum_price_feeds_hourly.sql +++ b/daily_spellbook/models/chainlink/arbitrum/chainlink_arbitrum_price_feeds_hourly.sql @@ -1,6 +1,6 @@ {{ config( - + alias='price_feeds_hourly', partition_by=['block_month'], materialized='incremental', @@ -11,7 +11,6 @@ ) }} -{% set incremental_interval = '7' %} {% set project_start_date = '2019-10-01' %} WITH hourly_sequence_meta AS ( @@ -25,7 +24,7 @@ WITH hourly_sequence_meta AS ( AND price.minute >= timestamp '{{project_start_date}}' {% endif %} {% if is_incremental() %} - AND price.minute >= date_trunc('hour', now() - interval '{{incremental_interval}}' day) + AND {{ incremental_predicate('price.minute') }} {% endif %} GROUP BY 1 @@ -70,7 +69,7 @@ aggregated_price_feeds AS ( hourly_sequence.hr >= timestamp '{{project_start_date}}' {% endif %} {% if is_incremental() %} - hourly_sequence.hr >= date_trunc('hour', now() - interval '{{incremental_interval}}' day) + {{ incremental_predicate('hourly_sequence.hr') }} {% endif %} GROUP BY hourly_sequence.hr, hourly_sequence.feed_name, hourly_sequence.proxy_address, hourly_sequence.aggregator_address diff --git a/daily_spellbook/models/chainlink/arbitrum/chainlink_arbitrum_vrf_fulfilled_transactions.sql b/daily_spellbook/models/chainlink/arbitrum/chainlink_arbitrum_vrf_fulfilled_transactions.sql index a8d7fa66bd1..ec3e5f71dc0 100644 --- a/daily_spellbook/models/chainlink/arbitrum/chainlink_arbitrum_vrf_fulfilled_transactions.sql +++ b/daily_spellbook/models/chainlink/arbitrum/chainlink_arbitrum_vrf_fulfilled_transactions.sql @@ -1,12 +1,13 @@ {{ config( - + alias='vrf_fulfilled_transactions', partition_by=['date_month'], materialized='incremental', file_format='delta', incremental_strategy='merge', - unique_key=['tx_hash', 'tx_index', 'node_address'] + unique_key=['tx_hash', 'tx_index', 'node_address'], + incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.block_time')] ) }} @@ -22,7 +23,7 @@ WITH {% if is_incremental() %} AND {{ incremental_predicate('minute') }} - {% endif %} + {% endif %} ), vrf_fulfilled_transactions AS ( SELECT @@ -39,14 +40,14 @@ WITH {{ source('arbitrum', 'transactions') }} tx RIGHT JOIN {{ ref('chainlink_arbitrum_vrf_v1_random_fulfilled_logs') }} vrf_v1_logs ON vrf_v1_logs.tx_hash = tx.hash {% if is_incremental() %} - AND + AND {{ incremental_predicate('tx.block_time') }} {% endif %} LEFT JOIN arbitrum_usd ON date_trunc('minute', tx.block_time) = arbitrum_usd.block_time {% if is_incremental() %} WHERE {{ incremental_predicate('tx.block_time') }} - {% endif %} + {% endif %} GROUP BY tx.hash, tx.index, @@ -75,7 +76,7 @@ WITH {% if is_incremental() %} WHERE {{ incremental_predicate('tx.block_time') }} - {% endif %} + {% endif %} GROUP BY tx.hash, tx.index, diff --git a/daily_spellbook/models/chainlink/arbitrum/chainlink_arbitrum_vrf_gas_daily.sql b/daily_spellbook/models/chainlink/arbitrum/chainlink_arbitrum_vrf_gas_daily.sql index d5c5e5290d2..a7b26ea2d15 100644 --- a/daily_spellbook/models/chainlink/arbitrum/chainlink_arbitrum_vrf_gas_daily.sql +++ b/daily_spellbook/models/chainlink/arbitrum/chainlink_arbitrum_vrf_gas_daily.sql @@ -1,6 +1,6 @@ {{ config( - + alias='vrf_gas_daily', partition_by=['date_month'], materialized='incremental', @@ -10,7 +10,6 @@ ) }} -{% set incremental_interval = '7' %} {% set truncate_by = 'day' %} WITH @@ -24,7 +23,7 @@ WITH {{ ref('chainlink_arbitrum_vrf_fulfilled_transactions') }} fulfilled {% if is_incremental() %} WHERE - fulfilled.block_time >= date_trunc('day', now() - interval '{{incremental_interval}}' day) + {{ incremental_predicate('fulfilled.block_time') }} {% endif %} GROUP BY 1, 2 @@ -41,7 +40,7 @@ WITH {{ ref('chainlink_arbitrum_vrf_reverted_transactions') }} reverted {% if is_incremental() %} WHERE - reverted.block_time >= date_trunc('day', now() - interval '{{incremental_interval}}' day) + {{ incremental_predicate('reverted.block_time') }} {% endif %} GROUP BY 1, 2 @@ -53,7 +52,7 @@ WITH COALESCE( fulfilled.date_start, reverted.date_start - ) AS "date_start", + ) AS "date_start", COALESCE( fulfilled.node_address, reverted.node_address @@ -84,7 +83,7 @@ WITH fulfilled_usd_amount + reverted_usd_amount as total_usd_amount FROM vrf_gas_daily_meta ) -SELECT +SELECT blockchain, date_start, date_month, @@ -94,7 +93,7 @@ SELECT reverted_token_amount, reverted_usd_amount, total_token_amount, - total_usd_amount + total_usd_amount FROM vrf_gas_daily ORDER BY diff --git a/daily_spellbook/models/chainlink/arbitrum/chainlink_arbitrum_vrf_request_daily.sql b/daily_spellbook/models/chainlink/arbitrum/chainlink_arbitrum_vrf_request_daily.sql index daaef4c98a9..9e2fcc6f9ad 100644 --- a/daily_spellbook/models/chainlink/arbitrum/chainlink_arbitrum_vrf_request_daily.sql +++ b/daily_spellbook/models/chainlink/arbitrum/chainlink_arbitrum_vrf_request_daily.sql @@ -1,6 +1,6 @@ {{ config( - + alias='vrf_request_daily', partition_by=['date_month'], materialized='incremental', @@ -10,7 +10,6 @@ ) }} -{% set incremental_interval = '7' %} {% set truncate_by = 'day' %} WITH @@ -19,7 +18,7 @@ WITH COALESCE( cast(date_trunc('{{truncate_by}}', fulfilled.block_time) as date), cast(date_trunc('{{truncate_by}}', reverted.block_time) as date) - ) AS "date_start", + ) AS "date_start", COALESCE( fulfilled.node_address, reverted.node_address @@ -34,8 +33,8 @@ WITH reverted.node_address = fulfilled.node_address {% if is_incremental() %} WHERE - fulfilled.block_time >= date_trunc('day', now() - interval '{{incremental_interval}}' day) - AND reverted.block_time >= date_trunc('day', now() - interval '{{incremental_interval}}' day) + {{ incremental_predicate('fulfilled.block_time') }} + AND {{ incremental_predicate('reverted.block_time') }} {% endif %} GROUP BY 1, 2 @@ -53,7 +52,7 @@ WITH total_requests FROM vrf_request_daily_meta ) -SELECT +SELECT blockchain, date_start, date_month, diff --git a/daily_spellbook/models/chainlink/arbitrum/chainlink_arbitrum_vrf_request_fulfilled_daily.sql b/daily_spellbook/models/chainlink/arbitrum/chainlink_arbitrum_vrf_request_fulfilled_daily.sql index 7943b2053a1..e0c4b09fa5e 100644 --- a/daily_spellbook/models/chainlink/arbitrum/chainlink_arbitrum_vrf_request_fulfilled_daily.sql +++ b/daily_spellbook/models/chainlink/arbitrum/chainlink_arbitrum_vrf_request_fulfilled_daily.sql @@ -1,6 +1,6 @@ {{ config( - + alias='vrf_request_fulfilled_daily', partition_by=['date_month'], materialized='incremental', @@ -10,7 +10,6 @@ ) }} -{% set incremental_interval = '7' %} SELECT 'arbitrum' as blockchain, @@ -21,8 +20,8 @@ SELECT FROM {{ref('chainlink_arbitrum_vrf_request_fulfilled')}} vrf_request_fulfilled {% if is_incremental() %} - WHERE evt_block_time >= date_trunc('day', now() - interval '{{incremental_interval}}' day) -{% endif %} + WHERE {{ incremental_predicate('evt_block_time') }} +{% endif %} GROUP BY 2, 4 ORDER BY diff --git a/daily_spellbook/models/chainlink/arbitrum/chainlink_arbitrum_vrf_reverted_transactions.sql b/daily_spellbook/models/chainlink/arbitrum/chainlink_arbitrum_vrf_reverted_transactions.sql index 829bc61940f..c293afc64c5 100644 --- a/daily_spellbook/models/chainlink/arbitrum/chainlink_arbitrum_vrf_reverted_transactions.sql +++ b/daily_spellbook/models/chainlink/arbitrum/chainlink_arbitrum_vrf_reverted_transactions.sql @@ -1,16 +1,16 @@ {{ config( - + alias='vrf_reverted_transactions', partition_by=['date_month'], materialized='incremental', file_format='delta', incremental_strategy='merge', - unique_key=['tx_hash', 'tx_index', 'node_address'] + unique_key=['tx_hash', 'tx_index', 'node_address'], + incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.block_time')] ) }} -{% set incremental_interval = '7' %} WITH arbitrum_usd AS ( @@ -22,8 +22,8 @@ WITH WHERE symbol = 'ETH' {% if is_incremental() %} - AND minute >= date_trunc('day', now() - interval '{{incremental_interval}}' day) - {% endif %} + AND {{ incremental_predicate('minute') }} + {% endif %} ), vrf_reverted_transactions AS ( SELECT @@ -42,8 +42,8 @@ WITH WHERE success = false {% if is_incremental() %} - AND tx.block_time >= date_trunc('day', now() - interval '{{incremental_interval}}' day) - {% endif %} + AND {{ incremental_predicate('tx.block_time') }} + {% endif %} GROUP BY tx.hash, tx.index, diff --git a/daily_spellbook/models/chainlink/arbitrum/chainlink_arbitrum_vrf_reward_daily.sql b/daily_spellbook/models/chainlink/arbitrum/chainlink_arbitrum_vrf_reward_daily.sql index e5b821f8e71..5a9c53871e4 100644 --- a/daily_spellbook/models/chainlink/arbitrum/chainlink_arbitrum_vrf_reward_daily.sql +++ b/daily_spellbook/models/chainlink/arbitrum/chainlink_arbitrum_vrf_reward_daily.sql @@ -1,6 +1,6 @@ {{ config( - + alias='vrf_reward_daily', partition_by = ['date_month'], materialized = 'incremental', @@ -10,7 +10,6 @@ ) }} -{% set incremental_interval = '7' %} WITH link_usd_daily AS ( @@ -20,20 +19,20 @@ WITH FROM {{ source('prices', 'usd') }} price WHERE - price.symbol = 'LINK' + price.symbol = 'LINK' GROUP BY 1 ORDER BY 1 ), vrf_reward_daily AS ( - SELECT + SELECT vrf_daily.date_start, cast(date_trunc('month', vrf_daily.date_start) as date) as date_month, - vrf_daily.operator_address, + vrf_daily.operator_address, COALESCE(vrf_daily.token_amount, 0) as token_amount, COALESCE(vrf_daily.token_amount * lud.usd_amount, 0) as usd_amount - FROM + FROM {{ref('chainlink_arbitrum_vrf_request_fulfilled_daily')}} vrf_daily LEFT JOIN link_usd_daily lud ON lud.date_start = vrf_daily.date_start ORDER BY date_start @@ -45,7 +44,7 @@ SELECT operator_address, token_amount, usd_amount -FROM +FROM vrf_reward_daily ORDER BY 2, 4 diff --git a/daily_spellbook/models/chainlink/avalanche_c/chainlink_avalanche_c_automation_fulfilled_transactions.sql b/daily_spellbook/models/chainlink/avalanche_c/chainlink_avalanche_c_automation_fulfilled_transactions.sql index 241ab4a8ecb..2212c6bb88c 100644 --- a/daily_spellbook/models/chainlink/avalanche_c/chainlink_avalanche_c_automation_fulfilled_transactions.sql +++ b/daily_spellbook/models/chainlink/avalanche_c/chainlink_avalanche_c_automation_fulfilled_transactions.sql @@ -1,16 +1,16 @@ {{ config( - + alias='automation_fulfilled_transactions', partition_by=['date_month'], materialized='incremental', file_format='delta', incremental_strategy='merge', - unique_key=['tx_hash', 'tx_index', 'node_address'] + unique_key=['tx_hash', 'tx_index', 'node_address'], + incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.block_time')] ) }} -{% set incremental_interval = '7' %} WITH avalanche_c_usd AS ( @@ -22,8 +22,8 @@ WITH WHERE symbol = 'AVAX' {% if is_incremental() %} - AND minute >= date_trunc('day', now() - interval '{{incremental_interval}}' day) - {% endif %} + AND {{ incremental_predicate('minute') }} + {% endif %} ), automation_fulfilled_transactions AS ( SELECT @@ -38,12 +38,12 @@ WITH {{ source('avalanche_c', 'transactions') }} tx RIGHT JOIN {{ ref('chainlink_avalanche_c_automation_upkeep_performed_logs') }} automation_upkeep_performed_logs ON automation_upkeep_performed_logs.tx_hash = tx.hash {% if is_incremental() %} - AND automation_upkeep_performed_logs.block_time >= date_trunc('day', now() - interval '{{incremental_interval}}' day) + AND {{ incremental_predicate('automation_upkeep_performed_logs.block_time') }} {% endif %} LEFT JOIN avalanche_c_usd ON date_trunc('minute', tx.block_time) = avalanche_c_usd.block_time {% if is_incremental() %} - WHERE tx.block_time >= date_trunc('day', now() - interval '{{incremental_interval}}' day) - {% endif %} + WHERE {{ incremental_predicate('tx.block_time') }} + {% endif %} GROUP BY tx.hash, tx.index, diff --git a/daily_spellbook/models/chainlink/avalanche_c/chainlink_avalanche_c_automation_gas_daily.sql b/daily_spellbook/models/chainlink/avalanche_c/chainlink_avalanche_c_automation_gas_daily.sql index 81e68ed7aa0..0f5489ae4f3 100644 --- a/daily_spellbook/models/chainlink/avalanche_c/chainlink_avalanche_c_automation_gas_daily.sql +++ b/daily_spellbook/models/chainlink/avalanche_c/chainlink_avalanche_c_automation_gas_daily.sql @@ -1,6 +1,6 @@ {{ config( - + alias='automation_gas_daily', partition_by=['date_month'], materialized='incremental', @@ -10,7 +10,6 @@ ) }} -{% set incremental_interval = '7' %} {% set truncate_by = 'day' %} WITH @@ -24,7 +23,7 @@ WITH {{ ref('chainlink_avalanche_c_automation_fulfilled_transactions') }} fulfilled {% if is_incremental() %} WHERE - fulfilled.block_time >= date_trunc('day', now() - interval '{{incremental_interval}}' day) + {{ incremental_predicate('fulfilled.block_time') }} {% endif %} GROUP BY 1, 2 @@ -41,7 +40,7 @@ WITH {{ ref('chainlink_avalanche_c_automation_reverted_transactions') }} reverted {% if is_incremental() %} WHERE - reverted.block_time >= date_trunc('day', now() - interval '{{incremental_interval}}' day) + {{ incremental_predicate('reverted.block_time') }} {% endif %} GROUP BY 1, 2 @@ -53,7 +52,7 @@ WITH COALESCE( fulfilled.date_start, reverted.date_start - ) AS "date_start", + ) AS "date_start", COALESCE( fulfilled.node_address, reverted.node_address @@ -86,7 +85,7 @@ WITH FROM automation_gas_daily_meta LEFT JOIN {{ ref('chainlink_avalanche_c_automation_meta') }} automation_meta ON automation_meta.keeper_address = automation_gas_daily_meta.node_address ) -SELECT +SELECT blockchain, date_start, date_month, @@ -97,7 +96,7 @@ SELECT reverted_token_amount, reverted_usd_amount, total_token_amount, - total_usd_amount + total_usd_amount FROM automation_gas_daily ORDER BY diff --git a/daily_spellbook/models/chainlink/avalanche_c/chainlink_avalanche_c_automation_performed_daily.sql b/daily_spellbook/models/chainlink/avalanche_c/chainlink_avalanche_c_automation_performed_daily.sql index 7c5027cc638..cd7edf3f436 100644 --- a/daily_spellbook/models/chainlink/avalanche_c/chainlink_avalanche_c_automation_performed_daily.sql +++ b/daily_spellbook/models/chainlink/avalanche_c/chainlink_avalanche_c_automation_performed_daily.sql @@ -1,16 +1,16 @@ {{ config( - + alias='automation_performed_daily', partition_by=['date_month'], materialized='incremental', file_format='delta', incremental_strategy='merge', - unique_key=['date_start', 'keeper_address'] + unique_key=['date_start', 'keeper_address'], + incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.date_month')] ) }} -{% set incremental_interval = '7' %} SELECT 'avalanche_c' as blockchain, @@ -22,8 +22,8 @@ SELECT FROM {{ref('chainlink_avalanche_c_automation_performed')}} automation_performed {% if is_incremental() %} - WHERE evt_block_time >= date_trunc('day', now() - interval '{{incremental_interval}}' day) -{% endif %} + WHERE {{ incremental_predicate('evt_block_time') }} +{% endif %} GROUP BY 2, 4 ORDER BY diff --git a/daily_spellbook/models/chainlink/avalanche_c/chainlink_avalanche_c_automation_request_daily.sql b/daily_spellbook/models/chainlink/avalanche_c/chainlink_avalanche_c_automation_request_daily.sql index b07ddd73bc3..29bca2bba7f 100644 --- a/daily_spellbook/models/chainlink/avalanche_c/chainlink_avalanche_c_automation_request_daily.sql +++ b/daily_spellbook/models/chainlink/avalanche_c/chainlink_avalanche_c_automation_request_daily.sql @@ -1,6 +1,6 @@ {{ config( - + alias='automation_request_daily', partition_by=['date_month'], materialized='incremental', @@ -10,7 +10,6 @@ ) }} -{% set incremental_interval = '7' %} {% set truncate_by = 'day' %} WITH @@ -19,7 +18,7 @@ WITH COALESCE( cast(date_trunc('{{truncate_by}}', fulfilled.block_time) as date), cast(date_trunc('{{truncate_by}}', reverted.block_time) as date) - ) AS "date_start", + ) AS "date_start", COALESCE( fulfilled.node_address, reverted.node_address @@ -34,8 +33,8 @@ WITH reverted.node_address = fulfilled.node_address {% if is_incremental() %} WHERE - fulfilled.block_time >= date_trunc('day', now() - interval '{{incremental_interval}}' day) - OR reverted.block_time >= date_trunc('day', now() - interval '{{incremental_interval}}' day) + {{ incremental_predicate('fulfilled.block_time') }} + OR {{ incremental_predicate('reverted.block_time') }} {% endif %} GROUP BY 1, 2 @@ -53,7 +52,7 @@ WITH total_requests FROM automation_request_daily_meta ) -SELECT +SELECT automation_request_daily.blockchain, date_start, date_month, diff --git a/daily_spellbook/models/chainlink/avalanche_c/chainlink_avalanche_c_automation_reverted_transactions.sql b/daily_spellbook/models/chainlink/avalanche_c/chainlink_avalanche_c_automation_reverted_transactions.sql index 791009798f1..00a756135fd 100644 --- a/daily_spellbook/models/chainlink/avalanche_c/chainlink_avalanche_c_automation_reverted_transactions.sql +++ b/daily_spellbook/models/chainlink/avalanche_c/chainlink_avalanche_c_automation_reverted_transactions.sql @@ -1,16 +1,16 @@ {{ config( - + alias='automation_reverted_transactions', partition_by=['date_month'], materialized='incremental', file_format='delta', incremental_strategy='merge', - unique_key=['tx_hash', 'tx_index', 'node_address'] + unique_key=['tx_hash', 'tx_index', 'node_address'], + incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.block_time')] ) }} -{% set incremental_interval = '7' %} WITH avalanche_c_usd AS ( @@ -22,8 +22,8 @@ WITH WHERE symbol = 'AVAX' {% if is_incremental() %} - AND minute >= date_trunc('day', now() - interval '{{incremental_interval}}' day) - {% endif %} + AND {{ incremental_predicate('minute') }} + {% endif %} ), automation_reverted_transactions AS ( SELECT @@ -40,8 +40,8 @@ WITH WHERE success = false {% if is_incremental() %} - AND tx.block_time >= date_trunc('day', now() - interval '{{incremental_interval}}' day) - {% endif %} + AND {{ incremental_predicate('tx.block_time') }} + {% endif %} GROUP BY tx.hash, tx.index, diff --git a/daily_spellbook/models/chainlink/avalanche_c/chainlink_avalanche_c_automation_reward_daily.sql b/daily_spellbook/models/chainlink/avalanche_c/chainlink_avalanche_c_automation_reward_daily.sql index b8a34c1133c..93473302f0f 100644 --- a/daily_spellbook/models/chainlink/avalanche_c/chainlink_avalanche_c_automation_reward_daily.sql +++ b/daily_spellbook/models/chainlink/avalanche_c/chainlink_avalanche_c_automation_reward_daily.sql @@ -1,6 +1,6 @@ {{ config( - + alias='automation_reward_daily', partition_by = ['date_month'], materialized = 'incremental', @@ -10,7 +10,6 @@ ) }} -{% set incremental_interval = '7' %} WITH link_usd_daily AS ( @@ -20,21 +19,21 @@ WITH FROM {{ source('prices', 'usd') }} price WHERE - price.symbol = 'LINK' + price.symbol = 'LINK' GROUP BY 1 ORDER BY 1 ), automation_reward_daily AS ( - SELECT + SELECT automation_performed_daily.date_start, cast(date_trunc('month', automation_performed_daily.date_start) as date) as date_month, automation_performed_daily.operator_name, - automation_performed_daily.keeper_address, + automation_performed_daily.keeper_address, automation_performed_daily.token_amount as token_amount, (automation_performed_daily.token_amount * lud.usd_amount) as usd_amount - FROM + FROM {{ref('chainlink_avalanche_c_automation_performed_daily')}} automation_performed_daily LEFT JOIN link_usd_daily lud ON lud.date_start = automation_performed_daily.date_start ORDER BY date_start @@ -47,7 +46,7 @@ SELECT keeper_address, token_amount, usd_amount -FROM +FROM automation_reward_daily ORDER BY 2, 5 diff --git a/daily_spellbook/models/chainlink/avalanche_c/chainlink_avalanche_c_ccip_fulfilled_transactions.sql b/daily_spellbook/models/chainlink/avalanche_c/chainlink_avalanche_c_ccip_fulfilled_transactions.sql index 22e121fd7d6..5703d9456ca 100644 --- a/daily_spellbook/models/chainlink/avalanche_c/chainlink_avalanche_c_ccip_fulfilled_transactions.sql +++ b/daily_spellbook/models/chainlink/avalanche_c/chainlink_avalanche_c_ccip_fulfilled_transactions.sql @@ -8,7 +8,6 @@ ) }} -{% set incremental_interval = '7' %} WITH ccip_fulfilled_transactions AS ( @@ -23,12 +22,12 @@ WITH LEFT JOIN {{ source('avalanche_c', 'transactions') }} tx ON ccip_send_logs_v1.tx_hash = tx.hash {% if is_incremental() %} - AND tx.block_time >= date_trunc('day', now() - interval '{{incremental_interval}}' day) + AND {{ incremental_predicate('tx.block_time') }} {% endif %} WHERE tx.success = true {% if is_incremental() %} - AND ccip_send_logs_v1.block_time >= date_trunc('day', now() - interval '{{incremental_interval}}' day) + AND {{ incremental_predicate('ccip_send_logs_v1.block_time') }} {% endif %} UNION @@ -44,14 +43,14 @@ WITH LEFT JOIN {{ source('avalanche_c', 'transactions') }} tx ON ccip_send_logs_v1_2.tx_hash = tx.hash {% if is_incremental() %} - AND tx.block_time >= date_trunc('day', now() - interval '{{incremental_interval}}' day) + AND {{ incremental_predicate('tx.block_time') }} {% endif %} WHERE tx.success = true {% if is_incremental() %} - AND ccip_send_logs_v1_2.block_time >= date_trunc('day', now() - interval '{{incremental_interval}}' day) + AND {{ incremental_predicate('ccip_send_logs_v1_2.block_time') }} {% endif %} - + ) SELECT 'avalanche_c' as blockchain, diff --git a/daily_spellbook/models/chainlink/avalanche_c/chainlink_avalanche_c_ccip_gas_daily.sql b/daily_spellbook/models/chainlink/avalanche_c/chainlink_avalanche_c_ccip_gas_daily.sql index 69caa136ec9..e87a932d92d 100644 --- a/daily_spellbook/models/chainlink/avalanche_c/chainlink_avalanche_c_ccip_gas_daily.sql +++ b/daily_spellbook/models/chainlink/avalanche_c/chainlink_avalanche_c_ccip_gas_daily.sql @@ -1,6 +1,6 @@ {{ config( - + alias='ccip_gas_daily', partition_by=['date_month'], materialized='incremental', @@ -10,7 +10,6 @@ ) }} -{% set incremental_interval = '7' %} {% set truncate_by = 'day' %} WITH @@ -24,7 +23,7 @@ WITH {{ ref('chainlink_avalanche_c_ccip_transmitted_fulfilled') }} fulfilled {% if is_incremental() %} WHERE - fulfilled.block_time >= date_trunc('day', now() - interval '{{incremental_interval}}' day) + {{ incremental_predicate('fulfilled.block_time') }} {% endif %} GROUP BY 1, 2 @@ -41,7 +40,7 @@ WITH {{ ref('chainlink_avalanche_c_ccip_transmitted_reverted') }} reverted {% if is_incremental() %} WHERE - reverted.block_time >= date_trunc('day', now() - interval '{{incremental_interval}}' day) + {{ incremental_predicate('reverted.block_time') }} {% endif %} GROUP BY 1, 2 @@ -53,7 +52,7 @@ WITH COALESCE( fulfilled.date_start, reverted.date_start - ) AS "date_start", + ) AS "date_start", COALESCE( fulfilled.node_address, reverted.node_address @@ -85,7 +84,7 @@ WITH FROM ccip_gas_daily_meta LEFT JOIN {{ ref('chainlink_avalanche_c_ccip_operator_meta') }} ccip_operator_meta ON ccip_operator_meta.node_address = ccip_gas_daily_meta.node_address ) -SELECT +SELECT blockchain, date_start, date_month, @@ -96,7 +95,7 @@ SELECT reverted_token_amount, reverted_usd_amount, total_token_amount, - total_usd_amount + total_usd_amount FROM ccip_gas_daily ORDER BY diff --git a/daily_spellbook/models/chainlink/avalanche_c/chainlink_avalanche_c_ccip_nop_reward_daily.sql b/daily_spellbook/models/chainlink/avalanche_c/chainlink_avalanche_c_ccip_nop_reward_daily.sql index 6b0a1fce9c2..9556a777fa7 100644 --- a/daily_spellbook/models/chainlink/avalanche_c/chainlink_avalanche_c_ccip_nop_reward_daily.sql +++ b/daily_spellbook/models/chainlink/avalanche_c/chainlink_avalanche_c_ccip_nop_reward_daily.sql @@ -1,6 +1,6 @@ {{ config( - + alias='ccip_nop_reward_daily', partition_by = ['date_month'], materialized = 'incremental', @@ -10,7 +10,6 @@ ) }} -{% set incremental_interval = '7' %} WITH link_usd_daily AS ( @@ -20,7 +19,7 @@ WITH FROM {{ source('prices', 'usd') }} price WHERE - price.symbol = 'LINK' + price.symbol = 'LINK' GROUP BY 1 ORDER BY @@ -38,22 +37,22 @@ FROM {{ref('chainlink_avalanche_c_ccip_nop_paid_logs')}} nop_logs LEFT JOIN {{ref('chainlink_avalanche_c_ccip_admin_meta')}} admin_meta ON admin_meta.admin_address = nop_logs.nop_address {% if is_incremental() %} - WHERE block_time >= date_trunc('day', now() - interval '{{incremental_interval}}' day) -{% endif %} + WHERE {{ incremental_predicate('block_time') }} +{% endif %} GROUP BY 2, 4 ORDER BY 2, 4 ), nop_reward_daily AS ( - SELECT + SELECT nop_paid.date_start, cast(date_trunc('month', nop_paid.date_start) as date) as date_month, nop_paid.operator_name, - nop_paid.nop_address, + nop_paid.nop_address, nop_paid.token_amount as token_amount, (nop_paid.token_amount * lud.usd_amount) as usd_amount - FROM + FROM nop_paid LEFT JOIN link_usd_daily lud ON lud.date_start = nop_paid.date_start ORDER BY date_start @@ -66,7 +65,7 @@ SELECT nop_address, token_amount, usd_amount -FROM +FROM nop_reward_daily ORDER BY 2, 5 diff --git a/daily_spellbook/models/chainlink/avalanche_c/chainlink_avalanche_c_ccip_request_daily.sql b/daily_spellbook/models/chainlink/avalanche_c/chainlink_avalanche_c_ccip_request_daily.sql index 8a1d6651777..eb4eb13c6ff 100644 --- a/daily_spellbook/models/chainlink/avalanche_c/chainlink_avalanche_c_ccip_request_daily.sql +++ b/daily_spellbook/models/chainlink/avalanche_c/chainlink_avalanche_c_ccip_request_daily.sql @@ -9,7 +9,6 @@ ) }} -{% set incremental_interval = '7' %} WITH ethereum_agg AS ( @@ -23,7 +22,7 @@ ethereum_agg AS ( WHERE eth.date_start = date_series.date_start {% if is_incremental() %} - AND eth.block_time >= date_trunc('day', now() - interval '{{incremental_interval}}' day) + AND {{ incremental_predicate('eth.block_time') }} {% endif %} ) AS fulfilled_requests, ( @@ -34,7 +33,7 @@ ethereum_agg AS ( WHERE rev.date_start = date_series.date_start {% if is_incremental() %} - AND rev.block_time >= date_trunc('day', now() - interval '{{incremental_interval}}' day) + AND {{ incremental_predicate('rev.block_time') }} {% endif %} ) AS reverted_requests FROM @@ -52,7 +51,7 @@ ethereum_agg AS ( ) AS seq CROSS JOIN UNNEST (seq.date_sequence) AS t (date_start) {% if is_incremental() %} - WHERE date_start >= date_trunc('day', now() - interval '{{incremental_interval}}' day) + WHERE {{ incremental_predicate('date_start') }} {% endif %} ) date_series ), @@ -67,7 +66,7 @@ ethereum_agg AS ( FROM ethereum_agg ) -SELECT +SELECT ccip_request_daily.blockchain, date_start, date_month, diff --git a/daily_spellbook/models/chainlink/avalanche_c/chainlink_avalanche_c_ccip_reverted_transactions.sql b/daily_spellbook/models/chainlink/avalanche_c/chainlink_avalanche_c_ccip_reverted_transactions.sql index 4a82d48a6ec..33ba2f10b11 100644 --- a/daily_spellbook/models/chainlink/avalanche_c/chainlink_avalanche_c_ccip_reverted_transactions.sql +++ b/daily_spellbook/models/chainlink/avalanche_c/chainlink_avalanche_c_ccip_reverted_transactions.sql @@ -8,7 +8,6 @@ ) }} -{% set incremental_interval = '7' %} WITH ccip_reverted_transactions AS ( @@ -23,12 +22,12 @@ WITH LEFT JOIN {{ source('avalanche_c', 'transactions') }} tx ON ccip_send_logs_v1.tx_hash = tx.hash {% if is_incremental() %} - AND tx.block_time >= date_trunc('day', now() - interval '{{incremental_interval}}' day) + AND {{ incremental_predicate('tx.block_time') }} {% endif %} WHERE tx.success = false {% if is_incremental() %} - AND ccip_send_logs_v1.block_time >= date_trunc('day', now() - interval '{{incremental_interval}}' day) + AND {{ incremental_predicate('ccip_send_logs_v1.block_time') }} {% endif %} UNION @@ -44,14 +43,14 @@ WITH LEFT JOIN {{ source('avalanche_c', 'transactions') }} tx ON ccip_send_logs_v1_2.tx_hash = tx.hash {% if is_incremental() %} - AND tx.block_time >= date_trunc('day', now() - interval '{{incremental_interval}}' day) + AND {{ incremental_predicate('tx.block_time') }} {% endif %} WHERE tx.success = false {% if is_incremental() %} - AND ccip_send_logs_v1_2.block_time >= date_trunc('day', now() - interval '{{incremental_interval}}' day) + AND {{ incremental_predicate('ccip_send_logs_v1_2.block_time') }} {% endif %} - + ) SELECT 'avalanche_c' as blockchain, diff --git a/daily_spellbook/models/chainlink/avalanche_c/chainlink_avalanche_c_ccip_reward_daily.sql b/daily_spellbook/models/chainlink/avalanche_c/chainlink_avalanche_c_ccip_reward_daily.sql index cce88e484fa..d02dc3e0b22 100644 --- a/daily_spellbook/models/chainlink/avalanche_c/chainlink_avalanche_c_ccip_reward_daily.sql +++ b/daily_spellbook/models/chainlink/avalanche_c/chainlink_avalanche_c_ccip_reward_daily.sql @@ -9,7 +9,6 @@ ) }} -{% set incremental_interval = '7' %} WITH token_meta AS ( @@ -28,7 +27,7 @@ WITH {{ source('prices', 'usd') }} price JOIN token_meta ON price.symbol = token_meta.token_symbol {% if is_incremental() %} - WHERE price.minute >= date_trunc('day', now() - interval '{{incremental_interval}}' day) + WHERE {{ incremental_predicate('price.minute') }} {% endif %} GROUP BY 1, token_meta.token_symbol @@ -36,21 +35,21 @@ WITH 1 ), ccip_reward_daily AS ( - SELECT + SELECT ccip_send_requested_daily.date_start, - cast(date_trunc('month', ccip_send_requested_daily.date_start) as date) as date_month, + cast(date_trunc('month', ccip_send_requested_daily.date_start) as date) as date_month, SUM(ccip_send_requested_daily.fee_amount) as token_amount, SUM((ccip_send_requested_daily.fee_amount * tud.usd_amount)) as usd_amount, ccip_send_requested_daily.token as token - FROM + FROM {{ref('chainlink_avalanche_c_ccip_send_requested_daily')}} ccip_send_requested_daily LEFT JOIN token_usd_daily tud ON tud.date_start = ccip_send_requested_daily.date_start AND tud.symbol = ccip_send_requested_daily.token {% if is_incremental() %} - WHERE ccip_send_requested_daily.date_start >= date_trunc('day', now() - interval '{{incremental_interval}}' day) - {% endif %} + WHERE {{ incremental_predicate('ccip_send_requested_daily.date_start') }} + {% endif %} GROUP BY 1, 5 ) - + SELECT 'avalanche_c' as blockchain, date_start, @@ -58,7 +57,7 @@ SELECT token_amount, usd_amount, token -FROM +FROM ccip_reward_daily ORDER BY 2, 6 diff --git a/daily_spellbook/models/chainlink/avalanche_c/chainlink_avalanche_c_ccip_send_requested_daily.sql b/daily_spellbook/models/chainlink/avalanche_c/chainlink_avalanche_c_ccip_send_requested_daily.sql index 5b38ee00fab..e8a1768ea0a 100644 --- a/daily_spellbook/models/chainlink/avalanche_c/chainlink_avalanche_c_ccip_send_requested_daily.sql +++ b/daily_spellbook/models/chainlink/avalanche_c/chainlink_avalanche_c_ccip_send_requested_daily.sql @@ -1,6 +1,6 @@ {{ config( - + alias='ccip_send_requested_daily', partition_by=['date_month'], materialized='incremental', @@ -10,7 +10,6 @@ ) }} -{% set incremental_interval = '7' %} SELECT 'avalanche_c' as blockchain, @@ -23,8 +22,8 @@ SELECT FROM {{ref('chainlink_avalanche_c_ccip_send_requested')}} ccip_send_requested {% if is_incremental() %} - WHERE evt_block_time >= date_trunc('day', now() - interval '{{incremental_interval}}' day) -{% endif %} + WHERE {{ incremental_predicate('evt_block_time') }} +{% endif %} GROUP BY 2, 5, 6 ORDER BY diff --git a/daily_spellbook/models/chainlink/avalanche_c/chainlink_avalanche_c_ccip_transmitted_fulfilled.sql b/daily_spellbook/models/chainlink/avalanche_c/chainlink_avalanche_c_ccip_transmitted_fulfilled.sql index dd969de666c..40128a2677a 100644 --- a/daily_spellbook/models/chainlink/avalanche_c/chainlink_avalanche_c_ccip_transmitted_fulfilled.sql +++ b/daily_spellbook/models/chainlink/avalanche_c/chainlink_avalanche_c_ccip_transmitted_fulfilled.sql @@ -1,16 +1,16 @@ {{ config( - + alias='ccip_transmitted_fulfilled', partition_by=['date_month'], materialized='incremental', file_format='delta', incremental_strategy='merge', - unique_key=['tx_hash', 'tx_index', 'node_address'] + unique_key=['tx_hash', 'tx_index', 'node_address'], + incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.block_time')] ) }} -{% set incremental_interval = '7' %} WITH avalanche_c_usd AS ( @@ -22,8 +22,8 @@ WITH WHERE symbol = 'AVAX' {% if is_incremental() %} - AND minute >= date_trunc('day', now() - interval '{{incremental_interval}}' day) - {% endif %} + AND {{ incremental_predicate('minute') }} + {% endif %} ), ccip_fulfilled_transactions AS ( SELECT @@ -38,12 +38,12 @@ WITH {{ source('avalanche_c', 'transactions') }} tx RIGHT JOIN {{ ref('chainlink_avalanche_c_ccip_transmitted_logs') }} ccip_tx ON ccip_tx.tx_hash = tx.hash {% if is_incremental() %} - AND ccip_tx.block_time >= date_trunc('day', now() - interval '{{incremental_interval}}' day) + AND {{ incremental_predicate('ccip_tx.block_time') }} {% endif %} LEFT JOIN avalanche_c_usd ON date_trunc('minute', tx.block_time) = avalanche_c_usd.block_time {% if is_incremental() %} - WHERE tx.block_time >= date_trunc('day', now() - interval '{{incremental_interval}}' day) - {% endif %} + WHERE {{ incremental_predicate('tx.block_time') }} + {% endif %} GROUP BY tx.hash, tx.index, diff --git a/daily_spellbook/models/chainlink/avalanche_c/chainlink_avalanche_c_ccip_transmitted_reverted.sql b/daily_spellbook/models/chainlink/avalanche_c/chainlink_avalanche_c_ccip_transmitted_reverted.sql index 8c8acffc6c8..4bc7773d626 100644 --- a/daily_spellbook/models/chainlink/avalanche_c/chainlink_avalanche_c_ccip_transmitted_reverted.sql +++ b/daily_spellbook/models/chainlink/avalanche_c/chainlink_avalanche_c_ccip_transmitted_reverted.sql @@ -1,16 +1,16 @@ {{ config( - + alias='ccip_transmitted_reverted', partition_by=['date_month'], materialized='incremental', file_format='delta', incremental_strategy='merge', - unique_key=['tx_hash', 'tx_index', 'node_address'] + unique_key=['tx_hash', 'tx_index', 'node_address'], + incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.block_time')] ) }} -{% set incremental_interval = '7' %} WITH avalanche_c_usd AS ( @@ -22,8 +22,8 @@ WITH WHERE symbol = 'AVAX' {% if is_incremental() %} - AND minute >= date_trunc('day', now() - interval '{{incremental_interval}}' day) - {% endif %} + AND {{ incremental_predicate('minute') }} + {% endif %} ), ccip_reverted_transactions AS ( SELECT @@ -38,14 +38,14 @@ WITH {{ ref('chainlink_avalanche_c_ccip_transmitted_logs') }} tx LEFT JOIN {{ source('avalanche_c', 'transactions') }} tx2 ON tx2.hash = tx.tx_hash {% if is_incremental() %} - AND tx.block_time >= date_trunc('day', now() - interval '{{incremental_interval}}' day) + AND {{ incremental_predicate('tx.block_time') }} {% endif %} LEFT JOIN avalanche_c_usd ON date_trunc('minute', tx.block_time) = avalanche_c_usd.block_time WHERE tx2.success = false {% if is_incremental() %} - AND tx.block_time >= date_trunc('day', now() - interval '{{incremental_interval}}' day) - {% endif %} + AND {{ incremental_predicate('tx.block_time') }} + {% endif %} GROUP BY tx.tx_hash, tx.index, diff --git a/daily_spellbook/models/chainlink/avalanche_c/chainlink_avalanche_c_fm_fulfilled_transactions.sql b/daily_spellbook/models/chainlink/avalanche_c/chainlink_avalanche_c_fm_fulfilled_transactions.sql index ff53aaf0de2..de8709a126b 100644 --- a/daily_spellbook/models/chainlink/avalanche_c/chainlink_avalanche_c_fm_fulfilled_transactions.sql +++ b/daily_spellbook/models/chainlink/avalanche_c/chainlink_avalanche_c_fm_fulfilled_transactions.sql @@ -1,16 +1,16 @@ {{ config( - + alias='fm_fulfilled_transactions', partition_by=['date_month'], materialized='incremental', file_format='delta', incremental_strategy='merge', - unique_key=['tx_hash', 'tx_index', 'node_address'] + unique_key=['tx_hash', 'tx_index', 'node_address'], + incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.block_time')] ) }} -{% set incremental_interval = '7' %} WITH avalanche_c_usd AS ( @@ -22,8 +22,8 @@ WITH WHERE symbol = 'AVAX' {% if is_incremental() %} - AND minute >= date_trunc('day', now() - interval '{{incremental_interval}}' day) - {% endif %} + AND {{ incremental_predicate('minute') }} + {% endif %} ), fm_submission_transactions AS ( SELECT @@ -40,12 +40,12 @@ WITH {{ source('avalanche_c', 'transactions') }} tx RIGHT JOIN {{ ref('chainlink_avalanche_c_fm_gas_submission_logs') }} fm_gas_submission_logs ON fm_gas_submission_logs.tx_hash = tx.hash {% if is_incremental() %} - AND fm_gas_submission_logs.block_time >= date_trunc('day', now() - interval '{{incremental_interval}}' day) + AND {{ incremental_predicate('fm_gas_submission_logs.block_time') }} {% endif %} LEFT JOIN avalanche_c_usd ON date_trunc('minute', tx.block_time) = avalanche_c_usd.block_time {% if is_incremental() %} - WHERE tx.block_time >= date_trunc('day', now() - interval '{{incremental_interval}}' day) - {% endif %} + WHERE {{ incremental_predicate('tx.block_time') }} + {% endif %} GROUP BY tx.hash, tx.index, diff --git a/daily_spellbook/models/chainlink/avalanche_c/chainlink_avalanche_c_fm_gas_daily.sql b/daily_spellbook/models/chainlink/avalanche_c/chainlink_avalanche_c_fm_gas_daily.sql index 332fd2d43ae..dabb8063c6f 100644 --- a/daily_spellbook/models/chainlink/avalanche_c/chainlink_avalanche_c_fm_gas_daily.sql +++ b/daily_spellbook/models/chainlink/avalanche_c/chainlink_avalanche_c_fm_gas_daily.sql @@ -1,6 +1,6 @@ {{ config( - + alias='fm_gas_daily', partition_by=['date_month'], materialized='incremental', @@ -10,7 +10,6 @@ ) }} -{% set incremental_interval = '7' %} {% set truncate_by = 'day' %} WITH @@ -24,7 +23,7 @@ WITH {{ ref('chainlink_avalanche_c_fm_fulfilled_transactions') }} fulfilled {% if is_incremental() %} WHERE - fulfilled.block_time >= date_trunc('day', now() - interval '{{incremental_interval}}' day) + {{ incremental_predicate('fulfilled.block_time') }} {% endif %} GROUP BY 1, 2 @@ -41,7 +40,7 @@ WITH {{ ref('chainlink_avalanche_c_fm_reverted_transactions') }} reverted {% if is_incremental() %} WHERE - reverted.block_time >= date_trunc('day', now() - interval '{{incremental_interval}}' day) + {{ incremental_predicate('reverted.block_time') }} {% endif %} GROUP BY 1, 2 @@ -53,7 +52,7 @@ WITH COALESCE( fulfilled.date_start, reverted.date_start - ) AS "date_start", + ) AS "date_start", COALESCE( fulfilled.node_address, reverted.node_address @@ -86,7 +85,7 @@ WITH FROM fm_gas_daily_meta LEFT JOIN {{ ref('chainlink_avalanche_c_ocr_operator_node_meta') }} fm_operator_node_meta ON fm_operator_node_meta.node_address = fm_gas_daily_meta.node_address ) -SELECT +SELECT blockchain, date_start, date_month, @@ -97,7 +96,7 @@ SELECT reverted_token_amount, reverted_usd_amount, total_token_amount, - total_usd_amount + total_usd_amount FROM fm_gas_daily ORDER BY diff --git a/daily_spellbook/models/chainlink/avalanche_c/chainlink_avalanche_c_fm_request_daily.sql b/daily_spellbook/models/chainlink/avalanche_c/chainlink_avalanche_c_fm_request_daily.sql index 2faa016fcd0..8f9b3aab4e7 100644 --- a/daily_spellbook/models/chainlink/avalanche_c/chainlink_avalanche_c_fm_request_daily.sql +++ b/daily_spellbook/models/chainlink/avalanche_c/chainlink_avalanche_c_fm_request_daily.sql @@ -1,6 +1,6 @@ {{ config( - + alias='fm_request_daily', partition_by=['date_month'], materialized='incremental', @@ -10,7 +10,6 @@ ) }} -{% set incremental_interval = '7' %} {% set truncate_by = 'day' %} WITH @@ -19,7 +18,7 @@ WITH COALESCE( cast(date_trunc('{{truncate_by}}', fulfilled.block_time) as date), cast(date_trunc('{{truncate_by}}', reverted.block_time) as date) - ) AS "date_start", + ) AS "date_start", COALESCE( fulfilled.node_address, reverted.node_address @@ -34,8 +33,8 @@ WITH reverted.node_address = fulfilled.node_address {% if is_incremental() %} WHERE - fulfilled.block_time >= date_trunc('day', now() - interval '{{incremental_interval}}' day) - AND reverted.block_time >= date_trunc('day', now() - interval '{{incremental_interval}}' day) + {{ incremental_predicate('fulfilled.block_time') }} + AND {{ incremental_predicate('reverted.block_time') }} {% endif %} GROUP BY 1, 2 @@ -55,7 +54,7 @@ WITH FROM fm_request_daily_meta LEFT JOIN {{ ref('chainlink_avalanche_c_ocr_operator_node_meta') }} fm_operator_node_meta ON fm_operator_node_meta.node_address = fm_request_daily_meta.node_address ) -SELECT +SELECT blockchain, date_start, date_month, diff --git a/daily_spellbook/models/chainlink/avalanche_c/chainlink_avalanche_c_fm_reverted_transactions.sql b/daily_spellbook/models/chainlink/avalanche_c/chainlink_avalanche_c_fm_reverted_transactions.sql index 12e2921a1dc..6e6f14e4e39 100644 --- a/daily_spellbook/models/chainlink/avalanche_c/chainlink_avalanche_c_fm_reverted_transactions.sql +++ b/daily_spellbook/models/chainlink/avalanche_c/chainlink_avalanche_c_fm_reverted_transactions.sql @@ -1,16 +1,16 @@ {{ config( - + alias='fm_reverted_transactions', partition_by=['date_month'], materialized='incremental', file_format='delta', incremental_strategy='merge', - unique_key=['tx_hash', 'tx_index', 'node_address'] + unique_key=['tx_hash', 'tx_index', 'node_address'], + incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.block_time')] ) }} -{% set incremental_interval = '7' %} WITH avalanche_c_usd AS ( @@ -22,8 +22,8 @@ WITH WHERE symbol = 'AVAX' {% if is_incremental() %} - AND minute >= date_trunc('day', now() - interval '{{incremental_interval}}' day) - {% endif %} + AND {{ incremental_predicate('minute') }} + {% endif %} ), fm_reverted_transactions AS ( SELECT @@ -42,8 +42,8 @@ WITH WHERE success = false {% if is_incremental() %} - AND tx.block_time >= date_trunc('day', now() - interval '{{incremental_interval}}' day) - {% endif %} + AND {{ incremental_predicate('tx.block_time') }} + {% endif %} GROUP BY tx.hash, tx.index, diff --git a/daily_spellbook/models/chainlink/avalanche_c/chainlink_avalanche_c_fm_reward_daily.sql b/daily_spellbook/models/chainlink/avalanche_c/chainlink_avalanche_c_fm_reward_daily.sql index ae6fb3a151d..3e0ac993419 100644 --- a/daily_spellbook/models/chainlink/avalanche_c/chainlink_avalanche_c_fm_reward_daily.sql +++ b/daily_spellbook/models/chainlink/avalanche_c/chainlink_avalanche_c_fm_reward_daily.sql @@ -1,6 +1,6 @@ {{ config( - + alias='fm_reward_daily', partition_by = ['date_month'], materialized = 'incremental', @@ -10,7 +10,6 @@ ) }} -{% set incremental_interval = '7' %} WITH admin_address_meta as ( @@ -28,8 +27,8 @@ WITH WHERE price.symbol = 'LINK' {% if is_incremental() %} - AND price.minute >= date_trunc('day', now() - interval '{{incremental_interval}}' day) - {% endif %} + AND {{ incremental_predicate('price.minute') }} + {% endif %} GROUP BY 1 ORDER BY @@ -77,16 +76,16 @@ WITH 1, 2 ), fm_reward_daily AS ( - SELECT + SELECT payment_meta.date_start, cast(date_trunc('month', payment_meta.date_start) as date) as date_month, payment_meta.admin_address, - ocr_operator_admin_meta.operator_name, + ocr_operator_admin_meta.operator_name, COALESCE(fm_reward_evt_transfer_daily.token_amount / EXTRACT(DAY FROM next_payment_date - prev_payment_date), 0) as token_amount, (COALESCE(fm_reward_evt_transfer_daily.token_amount / EXTRACT(DAY FROM next_payment_date - prev_payment_date), 0) * payment_meta.usd_amount) as usd_amount - FROM + FROM payment_meta - LEFT JOIN + LEFT JOIN {{ref('chainlink_avalanche_c_fm_reward_evt_transfer_daily')}} fm_reward_evt_transfer_daily ON payment_meta.next_payment_date = fm_reward_evt_transfer_daily.date_start AND payment_meta.admin_address = fm_reward_evt_transfer_daily.admin_address @@ -101,7 +100,7 @@ SELECT operator_name, token_amount, usd_amount -FROM +FROM fm_reward_daily ORDER BY 2, 4 diff --git a/daily_spellbook/models/chainlink/avalanche_c/chainlink_avalanche_c_fm_reward_evt_transfer_daily.sql b/daily_spellbook/models/chainlink/avalanche_c/chainlink_avalanche_c_fm_reward_evt_transfer_daily.sql index d020dd0f814..fe44503d356 100644 --- a/daily_spellbook/models/chainlink/avalanche_c/chainlink_avalanche_c_fm_reward_evt_transfer_daily.sql +++ b/daily_spellbook/models/chainlink/avalanche_c/chainlink_avalanche_c_fm_reward_evt_transfer_daily.sql @@ -1,6 +1,6 @@ {{ config( - + alias='fm_reward_evt_transfer_daily', partition_by=['date_month'], materialized='incremental', @@ -10,7 +10,6 @@ ) }} -{% set incremental_interval = '7' %} SELECT 'avalanche_c' as blockchain, @@ -23,8 +22,8 @@ FROM {{ref('chainlink_avalanche_c_fm_reward_evt_transfer')}} fm_reward_evt_transfer LEFT JOIN {{ ref('chainlink_avalanche_c_ocr_operator_admin_meta') }} fm_operator_admin_meta ON fm_operator_admin_meta.admin_address = fm_reward_evt_transfer.admin_address {% if is_incremental() %} - WHERE evt_block_time >= date_trunc('day', now() - interval '{{incremental_interval}}' day) -{% endif %} + WHERE {{ incremental_predicate('evt_block_time') }} +{% endif %} GROUP BY 2, 4 ORDER BY diff --git a/daily_spellbook/models/chainlink/avalanche_c/chainlink_avalanche_c_ocr_fulfilled_transactions.sql b/daily_spellbook/models/chainlink/avalanche_c/chainlink_avalanche_c_ocr_fulfilled_transactions.sql index c9de3ccd2cd..23c183a3b09 100644 --- a/daily_spellbook/models/chainlink/avalanche_c/chainlink_avalanche_c_ocr_fulfilled_transactions.sql +++ b/daily_spellbook/models/chainlink/avalanche_c/chainlink_avalanche_c_ocr_fulfilled_transactions.sql @@ -1,12 +1,13 @@ {{ config( - + alias='ocr_fulfilled_transactions', partition_by=['date_month'], materialized='incremental', file_format='delta', incremental_strategy='merge', unique_key=['tx_hash', 'tx_index', 'node_address'], + incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.block_time')], post_hook='{{ expose_spells(\'["avalanche_c"]\', "project", "chainlink", @@ -14,7 +15,6 @@ ) }} -{% set incremental_interval = '7' %} WITH avalanche_c_usd AS ( @@ -26,8 +26,8 @@ WITH WHERE symbol = 'AVAX' {% if is_incremental() %} - AND minute >= date_trunc('day', now() - interval '{{incremental_interval}}' day) - {% endif %} + AND {{ incremental_predicate('minute') }} + {% endif %} ), ocr_fulfilled_transactions AS ( SELECT @@ -43,8 +43,8 @@ WITH RIGHT JOIN {{ ref('chainlink_avalanche_c_ocr_gas_transmission_logs') }} ocr_gas_transmission_logs ON ocr_gas_transmission_logs.tx_hash = tx.hash LEFT JOIN avalanche_c_usd ON date_trunc('minute', tx.block_time) = avalanche_c_usd.block_time {% if is_incremental() %} - WHERE tx.block_time >= date_trunc('day', now() - interval '{{incremental_interval}}' day) - {% endif %} + WHERE {{ incremental_predicate('tx.block_time') }} + {% endif %} GROUP BY tx.hash, tx.index, diff --git a/daily_spellbook/models/chainlink/avalanche_c/chainlink_avalanche_c_ocr_gas_daily.sql b/daily_spellbook/models/chainlink/avalanche_c/chainlink_avalanche_c_ocr_gas_daily.sql index df32c6ec147..f60ed96f85f 100644 --- a/daily_spellbook/models/chainlink/avalanche_c/chainlink_avalanche_c_ocr_gas_daily.sql +++ b/daily_spellbook/models/chainlink/avalanche_c/chainlink_avalanche_c_ocr_gas_daily.sql @@ -1,6 +1,6 @@ {{ config( - + alias='ocr_gas_daily', partition_by=['date_month'], materialized='incremental', @@ -14,7 +14,6 @@ ) }} -{% set incremental_interval = '7' %} {% set truncate_by = 'day' %} WITH @@ -28,7 +27,7 @@ WITH {{ ref('chainlink_avalanche_c_ocr_fulfilled_transactions') }} fulfilled {% if is_incremental() %} WHERE - fulfilled.block_time >= date_trunc('day', now() - interval '{{incremental_interval}}' day) + {{ incremental_predicate('fulfilled.block_time') }} {% endif %} GROUP BY 1, 2 @@ -45,7 +44,7 @@ WITH {{ ref('chainlink_avalanche_c_ocr_reverted_transactions') }} reverted {% if is_incremental() %} WHERE - reverted.block_time >= date_trunc('day', now() - interval '{{incremental_interval}}' day) + {{ incremental_predicate('reverted.block_time') }} {% endif %} GROUP BY 1, 2 @@ -57,7 +56,7 @@ WITH COALESCE( fulfilled.date_start, reverted.date_start - ) AS "date_start", + ) AS "date_start", COALESCE( fulfilled.node_address, reverted.node_address @@ -90,7 +89,7 @@ WITH FROM ocr_gas_daily_meta LEFT JOIN {{ ref('chainlink_avalanche_c_ocr_operator_node_meta') }} ocr_operator_node_meta ON ocr_operator_node_meta.node_address = ocr_gas_daily_meta.node_address ) -SELECT +SELECT blockchain, date_start, date_month, @@ -101,7 +100,7 @@ SELECT reverted_token_amount, reverted_usd_amount, total_token_amount, - total_usd_amount + total_usd_amount FROM ocr_gas_daily ORDER BY diff --git a/daily_spellbook/models/chainlink/avalanche_c/chainlink_avalanche_c_ocr_request_daily.sql b/daily_spellbook/models/chainlink/avalanche_c/chainlink_avalanche_c_ocr_request_daily.sql index e56e11a5eb1..f24d66dd98e 100644 --- a/daily_spellbook/models/chainlink/avalanche_c/chainlink_avalanche_c_ocr_request_daily.sql +++ b/daily_spellbook/models/chainlink/avalanche_c/chainlink_avalanche_c_ocr_request_daily.sql @@ -1,6 +1,6 @@ {{ config( - + alias='ocr_request_daily', partition_by=['date_month'], materialized='incremental', @@ -14,7 +14,6 @@ ) }} -{% set incremental_interval = '7' %} {% set truncate_by = 'day' %} WITH @@ -23,7 +22,7 @@ WITH COALESCE( cast(date_trunc('{{truncate_by}}', fulfilled.block_time) as date), cast(date_trunc('{{truncate_by}}', reverted.block_time) as date) - ) AS "date_start", + ) AS "date_start", COALESCE( fulfilled.node_address, reverted.node_address @@ -38,8 +37,8 @@ WITH reverted.node_address = fulfilled.node_address {% if is_incremental() %} WHERE - fulfilled.block_time >= date_trunc('day', now() - interval '{{incremental_interval}}' day) - OR reverted.block_time >= date_trunc('day', now() - interval '{{incremental_interval}}' day) + {{ incremental_predicate('fulfilled.block_time') }} + OR {{ incremental_predicate('reverted.block_time') }} {% endif %} GROUP BY 1, 2 @@ -59,7 +58,7 @@ WITH FROM ocr_request_daily_meta LEFT JOIN {{ ref('chainlink_avalanche_c_ocr_operator_node_meta') }} ocr_operator_node_meta ON ocr_operator_node_meta.node_address = ocr_request_daily_meta.node_address ) -SELECT +SELECT blockchain, date_start, date_month, diff --git a/daily_spellbook/models/chainlink/avalanche_c/chainlink_avalanche_c_ocr_reverted_transactions.sql b/daily_spellbook/models/chainlink/avalanche_c/chainlink_avalanche_c_ocr_reverted_transactions.sql index b9286ce469f..589d1c7956f 100644 --- a/daily_spellbook/models/chainlink/avalanche_c/chainlink_avalanche_c_ocr_reverted_transactions.sql +++ b/daily_spellbook/models/chainlink/avalanche_c/chainlink_avalanche_c_ocr_reverted_transactions.sql @@ -1,12 +1,13 @@ {{ config( - + alias='ocr_reverted_transactions', partition_by=['date_month'], materialized='incremental', file_format='delta', incremental_strategy='merge', unique_key=['tx_hash', 'tx_index', 'node_address'], + incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.block_time')], post_hook='{{ expose_spells(\'["avalanche_c"]\', "project", "chainlink", @@ -14,7 +15,6 @@ ) }} -{% set incremental_interval = '7' %} WITH avalanche_c_usd AS ( @@ -26,8 +26,8 @@ WITH WHERE symbol = 'AVAX' {% if is_incremental() %} - AND minute >= date_trunc('day', now() - interval '{{incremental_interval}}' day) - {% endif %} + AND {{ incremental_predicate('minute') }} + {% endif %} ), ocr_reverted_transactions AS ( SELECT @@ -44,8 +44,8 @@ WITH WHERE success = false {% if is_incremental() %} - AND tx.block_time >= date_trunc('day', now() - interval '{{incremental_interval}}' day) - {% endif %} + AND {{ incremental_predicate('tx.block_time') }} + {% endif %} GROUP BY tx.hash, tx.index, diff --git a/daily_spellbook/models/chainlink/avalanche_c/chainlink_avalanche_c_ocr_reward_daily.sql b/daily_spellbook/models/chainlink/avalanche_c/chainlink_avalanche_c_ocr_reward_daily.sql index 5676d8f93af..715f6b7db12 100644 --- a/daily_spellbook/models/chainlink/avalanche_c/chainlink_avalanche_c_ocr_reward_daily.sql +++ b/daily_spellbook/models/chainlink/avalanche_c/chainlink_avalanche_c_ocr_reward_daily.sql @@ -1,6 +1,6 @@ {{ config( - + alias='ocr_reward_daily', partition_by = ['date_month'], materialized = 'incremental', @@ -14,7 +14,6 @@ ) }} -{% set incremental_interval = '7' %} WITH admin_address_meta as ( @@ -32,8 +31,8 @@ WITH WHERE price.symbol = 'LINK' {% if is_incremental() %} - AND price.minute >= date_trunc('day', now() - interval '{{incremental_interval}}' day) - {% endif %} + AND {{ incremental_predicate('price.minute') }} + {% endif %} GROUP BY 1 ORDER BY @@ -81,16 +80,16 @@ WITH 1, 2 ), ocr_reward_daily AS ( - SELECT + SELECT payment_meta.date_start, cast(date_trunc('month', payment_meta.date_start) as date) as date_month, payment_meta.admin_address, - ocr_operator_admin_meta.operator_name, + ocr_operator_admin_meta.operator_name, COALESCE(ocr_reward_evt_transfer_daily.token_amount / EXTRACT(DAY FROM next_payment_date - prev_payment_date), 0) as token_amount, (COALESCE(ocr_reward_evt_transfer_daily.token_amount / EXTRACT(DAY FROM next_payment_date - prev_payment_date), 0) * payment_meta.usd_amount) as usd_amount - FROM + FROM payment_meta - LEFT JOIN + LEFT JOIN {{ref('chainlink_avalanche_c_ocr_reward_evt_transfer_daily')}} ocr_reward_evt_transfer_daily ON payment_meta.next_payment_date = ocr_reward_evt_transfer_daily.date_start AND payment_meta.admin_address = ocr_reward_evt_transfer_daily.admin_address @@ -105,7 +104,7 @@ SELECT operator_name, token_amount, usd_amount -FROM +FROM ocr_reward_daily ORDER BY 2, 4 diff --git a/daily_spellbook/models/chainlink/avalanche_c/chainlink_avalanche_c_ocr_reward_evt_transfer_daily.sql b/daily_spellbook/models/chainlink/avalanche_c/chainlink_avalanche_c_ocr_reward_evt_transfer_daily.sql index a8f636b03e5..afe031825c0 100644 --- a/daily_spellbook/models/chainlink/avalanche_c/chainlink_avalanche_c_ocr_reward_evt_transfer_daily.sql +++ b/daily_spellbook/models/chainlink/avalanche_c/chainlink_avalanche_c_ocr_reward_evt_transfer_daily.sql @@ -1,6 +1,6 @@ {{ config( - + alias='ocr_reward_evt_transfer_daily', partition_by=['date_month'], materialized='incremental', @@ -14,7 +14,6 @@ ) }} -{% set incremental_interval = '7' %} SELECT 'avalanche_c' as blockchain, @@ -27,8 +26,8 @@ FROM {{ref('chainlink_avalanche_c_ocr_reward_evt_transfer')}} ocr_reward_evt_transfer LEFT JOIN {{ ref('chainlink_avalanche_c_ocr_operator_admin_meta') }} ocr_operator_admin_meta ON ocr_operator_admin_meta.admin_address = ocr_reward_evt_transfer.admin_address {% if is_incremental() %} - WHERE evt_block_time >= date_trunc('day', now() - interval '{{incremental_interval}}' day) -{% endif %} + WHERE {{ incremental_predicate('evt_block_time') }} +{% endif %} GROUP BY 2, 4 ORDER BY diff --git a/daily_spellbook/models/chainlink/avalanche_c/chainlink_avalanche_c_price_feeds.sql b/daily_spellbook/models/chainlink/avalanche_c/chainlink_avalanche_c_price_feeds.sql index c8564bbee70..1acdee443d1 100644 --- a/daily_spellbook/models/chainlink/avalanche_c/chainlink_avalanche_c_price_feeds.sql +++ b/daily_spellbook/models/chainlink/avalanche_c/chainlink_avalanche_c_price_feeds.sql @@ -1,6 +1,6 @@ {{ config( - + alias='price_feeds', partition_by=['block_month'], materialized='incremental', @@ -14,7 +14,6 @@ ) }} -{% set incremental_interval = '7' %} {% set project_start_date = '2020-09-21' %} SELECT 'avalanche_c' as blockchain, @@ -27,11 +26,11 @@ SELECT 'avalanche_c' as blockchain, c.proxy_address, c.aggregator_address, c.oracle_price / POWER(10, 0) as underlying_token_price, - CASE + CASE WHEN cardinality(split(c.feed_name, ' / ')) = 1 THEN c.feed_name ELSE element_at(split(c.feed_name, ' / '), 1) END AS base, - CASE + CASE WHEN cardinality(split(c.feed_name, ' / ')) = 1 THEN NULL ELSE element_at(split(c.feed_name, ' / '), 2) END AS quote @@ -39,14 +38,14 @@ FROM ( SELECT l.block_time, - cast(date_trunc('day', l.block_time) as date) as block_date, - cast(date_trunc('month', l.block_time) as date) as block_month, + cast(date_trunc('day', l.block_time) as date) as block_date, + cast(date_trunc('month', l.block_time) as date) as block_month, l.block_number, cfa.feed_name, cfa.proxy_address, MAX(cfa.aggregator_address) as aggregator_address, AVG( - CAST(bytearray_to_uint256(bytearray_substring(l.topic1, 3, 64)) as DOUBLE) + CAST(bytearray_to_uint256(bytearray_substring(l.topic1, 3, 64)) as DOUBLE) / POWER(10, cfa.decimals) ) as oracle_price FROM @@ -56,10 +55,10 @@ FROM WHERE l.topic0 = 0x0559884fd3a460db3073b7fc896cc77986f16e378210ded43186175bf646fc5f {% if not is_incremental() %} - AND l.block_time >= cast('{{project_start_date}}' as date) + AND l.block_time >= cast('{{project_start_date}}' as date) {% endif %} {% if is_incremental() %} - AND l.block_time >= date_trunc('day', now() - interval '{{incremental_interval}}' day) + AND {{ incremental_predicate('l.block_time') }} {% endif %} GROUP BY 1, 2, 3, 4, 5, 6 diff --git a/daily_spellbook/models/chainlink/avalanche_c/chainlink_avalanche_c_price_feeds_hourly.sql b/daily_spellbook/models/chainlink/avalanche_c/chainlink_avalanche_c_price_feeds_hourly.sql index e5312462e5d..3ef689123db 100644 --- a/daily_spellbook/models/chainlink/avalanche_c/chainlink_avalanche_c_price_feeds_hourly.sql +++ b/daily_spellbook/models/chainlink/avalanche_c/chainlink_avalanche_c_price_feeds_hourly.sql @@ -1,6 +1,6 @@ {{ config( - + alias='price_feeds_hourly', partition_by=['block_month'], materialized='incremental', @@ -11,7 +11,6 @@ ) }} -{% set incremental_interval = '7' %} {% set project_start_date = '2019-10-01' %} WITH hourly_sequence_meta AS ( @@ -25,7 +24,7 @@ WITH hourly_sequence_meta AS ( AND price.minute >= timestamp '{{project_start_date}}' {% endif %} {% if is_incremental() %} - AND price.minute >= date_trunc('hour', now() - interval '{{incremental_interval}}' day) + AND {{ incremental_predicate('price.minute') }} {% endif %} GROUP BY 1 @@ -70,7 +69,7 @@ aggregated_price_feeds AS ( hourly_sequence.hr >= timestamp '{{project_start_date}}' {% endif %} {% if is_incremental() %} - hourly_sequence.hr >= date_trunc('hour', now() - interval '{{incremental_interval}}' day) + {{ incremental_predicate('hourly_sequence.hr') }} {% endif %} GROUP BY hourly_sequence.hr, hourly_sequence.feed_name, hourly_sequence.proxy_address, hourly_sequence.aggregator_address diff --git a/daily_spellbook/models/chainlink/avalanche_c/chainlink_avalanche_c_vrf_fulfilled_transactions.sql b/daily_spellbook/models/chainlink/avalanche_c/chainlink_avalanche_c_vrf_fulfilled_transactions.sql index 1e644235fea..20ec7142644 100644 --- a/daily_spellbook/models/chainlink/avalanche_c/chainlink_avalanche_c_vrf_fulfilled_transactions.sql +++ b/daily_spellbook/models/chainlink/avalanche_c/chainlink_avalanche_c_vrf_fulfilled_transactions.sql @@ -1,12 +1,13 @@ {{ config( - + alias='vrf_fulfilled_transactions', partition_by=['date_month'], materialized='incremental', file_format='delta', incremental_strategy='merge', - unique_key=['tx_hash', 'tx_index', 'node_address'] + unique_key=['tx_hash', 'tx_index', 'node_address'], + incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.block_time')] ) }} @@ -22,7 +23,7 @@ WITH {% if is_incremental() %} AND {{ incremental_predicate('minute') }} - {% endif %} + {% endif %} ), vrf_fulfilled_transactions AS ( SELECT @@ -39,14 +40,14 @@ WITH {{ source('avalanche_c', 'transactions') }} tx RIGHT JOIN {{ ref('chainlink_avalanche_c_vrf_v1_random_fulfilled_logs') }} vrf_v1_logs ON vrf_v1_logs.tx_hash = tx.hash {% if is_incremental() %} - AND + AND {{ incremental_predicate('tx.block_time') }} {% endif %} LEFT JOIN avalanche_c_usd ON date_trunc('minute', tx.block_time) = avalanche_c_usd.block_time {% if is_incremental() %} WHERE {{ incremental_predicate('tx.block_time') }} - {% endif %} + {% endif %} GROUP BY tx.hash, tx.index, @@ -75,7 +76,7 @@ WITH {% if is_incremental() %} WHERE {{ incremental_predicate('tx.block_time') }} - {% endif %} + {% endif %} GROUP BY tx.hash, tx.index, diff --git a/daily_spellbook/models/chainlink/avalanche_c/chainlink_avalanche_c_vrf_gas_daily.sql b/daily_spellbook/models/chainlink/avalanche_c/chainlink_avalanche_c_vrf_gas_daily.sql index b1efe8f999c..224f448139c 100644 --- a/daily_spellbook/models/chainlink/avalanche_c/chainlink_avalanche_c_vrf_gas_daily.sql +++ b/daily_spellbook/models/chainlink/avalanche_c/chainlink_avalanche_c_vrf_gas_daily.sql @@ -1,6 +1,6 @@ {{ config( - + alias='vrf_gas_daily', partition_by=['date_month'], materialized='incremental', @@ -10,7 +10,6 @@ ) }} -{% set incremental_interval = '7' %} {% set truncate_by = 'day' %} WITH @@ -24,7 +23,7 @@ WITH {{ ref('chainlink_avalanche_c_vrf_fulfilled_transactions') }} fulfilled {% if is_incremental() %} WHERE - fulfilled.block_time >= date_trunc('day', now() - interval '{{incremental_interval}}' day) + {{ incremental_predicate('fulfilled.block_time') }} {% endif %} GROUP BY 1, 2 @@ -41,7 +40,7 @@ WITH {{ ref('chainlink_avalanche_c_vrf_reverted_transactions') }} reverted {% if is_incremental() %} WHERE - reverted.block_time >= date_trunc('day', now() - interval '{{incremental_interval}}' day) + {{ incremental_predicate('reverted.block_time') }} {% endif %} GROUP BY 1, 2 @@ -53,7 +52,7 @@ WITH COALESCE( fulfilled.date_start, reverted.date_start - ) AS "date_start", + ) AS "date_start", COALESCE( fulfilled.node_address, reverted.node_address @@ -85,7 +84,7 @@ WITH fulfilled_usd_amount + reverted_usd_amount as total_usd_amount FROM vrf_gas_daily_meta ) -SELECT +SELECT blockchain, date_start, date_month, @@ -95,7 +94,7 @@ SELECT reverted_token_amount, reverted_usd_amount, total_token_amount, - total_usd_amount + total_usd_amount FROM vrf_gas_daily ORDER BY diff --git a/daily_spellbook/models/chainlink/avalanche_c/chainlink_avalanche_c_vrf_request_daily.sql b/daily_spellbook/models/chainlink/avalanche_c/chainlink_avalanche_c_vrf_request_daily.sql index d68d5bb2a33..002372412c8 100644 --- a/daily_spellbook/models/chainlink/avalanche_c/chainlink_avalanche_c_vrf_request_daily.sql +++ b/daily_spellbook/models/chainlink/avalanche_c/chainlink_avalanche_c_vrf_request_daily.sql @@ -1,6 +1,6 @@ {{ config( - + alias='vrf_request_daily', partition_by=['date_month'], materialized='incremental', @@ -10,7 +10,6 @@ ) }} -{% set incremental_interval = '7' %} {% set truncate_by = 'day' %} WITH @@ -19,7 +18,7 @@ WITH COALESCE( cast(date_trunc('{{truncate_by}}', fulfilled.block_time) as date), cast(date_trunc('{{truncate_by}}', reverted.block_time) as date) - ) AS "date_start", + ) AS "date_start", COALESCE( fulfilled.node_address, reverted.node_address @@ -34,8 +33,8 @@ WITH reverted.node_address = fulfilled.node_address {% if is_incremental() %} WHERE - fulfilled.block_time >= date_trunc('day', now() - interval '{{incremental_interval}}' day) - AND reverted.block_time >= date_trunc('day', now() - interval '{{incremental_interval}}' day) + {{ incremental_predicate('fulfilled.block_time') }} + AND {{ incremental_predicate('reverted.block_time') }} {% endif %} GROUP BY 1, 2 @@ -53,7 +52,7 @@ WITH total_requests FROM vrf_request_daily_meta ) -SELECT +SELECT blockchain, date_start, date_month, diff --git a/daily_spellbook/models/chainlink/avalanche_c/chainlink_avalanche_c_vrf_request_fulfilled_daily.sql b/daily_spellbook/models/chainlink/avalanche_c/chainlink_avalanche_c_vrf_request_fulfilled_daily.sql index e06c4b37498..75fc552095d 100644 --- a/daily_spellbook/models/chainlink/avalanche_c/chainlink_avalanche_c_vrf_request_fulfilled_daily.sql +++ b/daily_spellbook/models/chainlink/avalanche_c/chainlink_avalanche_c_vrf_request_fulfilled_daily.sql @@ -1,6 +1,6 @@ {{ config( - + alias='vrf_request_fulfilled_daily', partition_by=['date_month'], materialized='incremental', @@ -10,7 +10,6 @@ ) }} -{% set incremental_interval = '7' %} SELECT 'avalanche_c' as blockchain, @@ -21,8 +20,8 @@ SELECT FROM {{ref('chainlink_avalanche_c_vrf_request_fulfilled')}} vrf_request_fulfilled {% if is_incremental() %} - WHERE evt_block_time >= date_trunc('day', now() - interval '{{incremental_interval}}' day) -{% endif %} + WHERE {{ incremental_predicate('evt_block_time') }} +{% endif %} GROUP BY 2, 4 ORDER BY diff --git a/daily_spellbook/models/chainlink/avalanche_c/chainlink_avalanche_c_vrf_reverted_transactions.sql b/daily_spellbook/models/chainlink/avalanche_c/chainlink_avalanche_c_vrf_reverted_transactions.sql index 06d0eaabe4f..88be41e263e 100644 --- a/daily_spellbook/models/chainlink/avalanche_c/chainlink_avalanche_c_vrf_reverted_transactions.sql +++ b/daily_spellbook/models/chainlink/avalanche_c/chainlink_avalanche_c_vrf_reverted_transactions.sql @@ -1,16 +1,16 @@ {{ config( - + alias='vrf_reverted_transactions', partition_by=['date_month'], materialized='incremental', file_format='delta', incremental_strategy='merge', - unique_key=['tx_hash', 'tx_index', 'node_address'] + unique_key=['tx_hash', 'tx_index', 'node_address'], + incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.block_time')] ) }} -{% set incremental_interval = '7' %} WITH avalanche_c_usd AS ( @@ -22,8 +22,8 @@ WITH WHERE symbol = 'AVAX' {% if is_incremental() %} - AND minute >= date_trunc('day', now() - interval '{{incremental_interval}}' day) - {% endif %} + AND {{ incremental_predicate('minute') }} + {% endif %} ), vrf_reverted_transactions AS ( SELECT @@ -42,8 +42,8 @@ WITH WHERE success = false {% if is_incremental() %} - AND tx.block_time >= date_trunc('day', now() - interval '{{incremental_interval}}' day) - {% endif %} + AND {{ incremental_predicate('tx.block_time') }} + {% endif %} GROUP BY tx.hash, tx.index, diff --git a/daily_spellbook/models/chainlink/avalanche_c/chainlink_avalanche_c_vrf_reward_daily.sql b/daily_spellbook/models/chainlink/avalanche_c/chainlink_avalanche_c_vrf_reward_daily.sql index 167d182fa12..0bd005e59e6 100644 --- a/daily_spellbook/models/chainlink/avalanche_c/chainlink_avalanche_c_vrf_reward_daily.sql +++ b/daily_spellbook/models/chainlink/avalanche_c/chainlink_avalanche_c_vrf_reward_daily.sql @@ -1,6 +1,6 @@ {{ config( - + alias='vrf_reward_daily', partition_by = ['date_month'], materialized = 'incremental', @@ -10,7 +10,6 @@ ) }} -{% set incremental_interval = '7' %} WITH link_usd_daily AS ( @@ -20,20 +19,20 @@ WITH FROM {{ source('prices', 'usd') }} price WHERE - price.symbol = 'LINK' + price.symbol = 'LINK' GROUP BY 1 ORDER BY 1 ), vrf_reward_daily AS ( - SELECT + SELECT vrf_daily.date_start, cast(date_trunc('month', vrf_daily.date_start) as date) as date_month, - vrf_daily.operator_address, + vrf_daily.operator_address, COALESCE(vrf_daily.token_amount, 0) as token_amount, COALESCE(vrf_daily.token_amount * lud.usd_amount, 0) as usd_amount - FROM + FROM {{ref('chainlink_avalanche_c_vrf_request_fulfilled_daily')}} vrf_daily LEFT JOIN link_usd_daily lud ON lud.date_start = vrf_daily.date_start ORDER BY date_start @@ -45,7 +44,7 @@ SELECT operator_address, token_amount, usd_amount -FROM +FROM vrf_reward_daily ORDER BY 2, 4 diff --git a/daily_spellbook/models/chainlink/base/chainlink_base_ccip_fulfilled_transactions.sql b/daily_spellbook/models/chainlink/base/chainlink_base_ccip_fulfilled_transactions.sql index 941806ac044..73041476480 100644 --- a/daily_spellbook/models/chainlink/base/chainlink_base_ccip_fulfilled_transactions.sql +++ b/daily_spellbook/models/chainlink/base/chainlink_base_ccip_fulfilled_transactions.sql @@ -8,7 +8,6 @@ ) }} -{% set incremental_interval = '7' %} WITH ccip_fulfilled_transactions AS ( @@ -23,12 +22,12 @@ WITH LEFT JOIN {{ source('base', 'transactions') }} tx ON ccip_send_logs_v1.tx_hash = tx.hash {% if is_incremental() %} - AND tx.block_time >= date_trunc('day', now() - interval '{{incremental_interval}}' day) + AND {{ incremental_predicate('tx.block_time') }} {% endif %} WHERE tx.success = true {% if is_incremental() %} - AND ccip_send_logs_v1.block_time >= date_trunc('day', now() - interval '{{incremental_interval}}' day) + AND {{ incremental_predicate('ccip_send_logs_v1.block_time') }} {% endif %} UNION @@ -44,14 +43,14 @@ WITH LEFT JOIN {{ source('base', 'transactions') }} tx ON ccip_send_logs_v1_2.tx_hash = tx.hash {% if is_incremental() %} - AND tx.block_time >= date_trunc('day', now() - interval '{{incremental_interval}}' day) + AND {{ incremental_predicate('tx.block_time') }} {% endif %} WHERE tx.success = true {% if is_incremental() %} - AND ccip_send_logs_v1_2.block_time >= date_trunc('day', now() - interval '{{incremental_interval}}' day) + AND {{ incremental_predicate('ccip_send_logs_v1_2.block_time') }} {% endif %} - + ) SELECT 'base' as blockchain, diff --git a/daily_spellbook/models/chainlink/base/chainlink_base_ccip_gas_daily.sql b/daily_spellbook/models/chainlink/base/chainlink_base_ccip_gas_daily.sql index 3b2fd5b906d..ae73f42394d 100644 --- a/daily_spellbook/models/chainlink/base/chainlink_base_ccip_gas_daily.sql +++ b/daily_spellbook/models/chainlink/base/chainlink_base_ccip_gas_daily.sql @@ -1,6 +1,6 @@ {{ config( - + alias='ccip_gas_daily', partition_by=['date_month'], materialized='incremental', @@ -10,7 +10,6 @@ ) }} -{% set incremental_interval = '7' %} {% set truncate_by = 'day' %} WITH @@ -24,7 +23,7 @@ WITH {{ ref('chainlink_base_ccip_transmitted_fulfilled') }} fulfilled {% if is_incremental() %} WHERE - fulfilled.block_time >= date_trunc('day', now() - interval '{{incremental_interval}}' day) + {{ incremental_predicate('fulfilled.block_time') }} {% endif %} GROUP BY 1, 2 @@ -41,7 +40,7 @@ WITH {{ ref('chainlink_base_ccip_transmitted_reverted') }} reverted {% if is_incremental() %} WHERE - reverted.block_time >= date_trunc('day', now() - interval '{{incremental_interval}}' day) + {{ incremental_predicate('reverted.block_time') }} {% endif %} GROUP BY 1, 2 @@ -53,7 +52,7 @@ WITH COALESCE( fulfilled.date_start, reverted.date_start - ) AS "date_start", + ) AS "date_start", COALESCE( fulfilled.node_address, reverted.node_address @@ -86,7 +85,7 @@ WITH FROM ccip_gas_daily_meta LEFT JOIN {{ ref('chainlink_base_ccip_operator_meta') }} ccip_operator_meta ON ccip_operator_meta.node_address = ccip_gas_daily_meta.node_address ) -SELECT +SELECT blockchain, date_start, date_month, @@ -97,7 +96,7 @@ SELECT reverted_token_amount, reverted_usd_amount, total_token_amount, - total_usd_amount + total_usd_amount FROM ccip_gas_daily ORDER BY diff --git a/daily_spellbook/models/chainlink/base/chainlink_base_ccip_nop_reward_daily.sql b/daily_spellbook/models/chainlink/base/chainlink_base_ccip_nop_reward_daily.sql index 92819a50f29..c370cb7cf12 100644 --- a/daily_spellbook/models/chainlink/base/chainlink_base_ccip_nop_reward_daily.sql +++ b/daily_spellbook/models/chainlink/base/chainlink_base_ccip_nop_reward_daily.sql @@ -1,6 +1,6 @@ {{ config( - + alias='ccip_nop_reward_daily', partition_by = ['date_month'], materialized = 'incremental', @@ -10,7 +10,6 @@ ) }} -{% set incremental_interval = '7' %} WITH link_usd_daily AS ( @@ -20,7 +19,7 @@ WITH FROM {{ source('prices', 'usd') }} price WHERE - price.symbol = 'LINK' + price.symbol = 'LINK' GROUP BY 1 ORDER BY @@ -38,22 +37,22 @@ FROM {{ref('chainlink_base_ccip_nop_paid_logs')}} nop_logs LEFT JOIN {{ref('chainlink_base_ccip_admin_meta')}} admin_meta ON admin_meta.admin_address = nop_logs.nop_address {% if is_incremental() %} - WHERE block_time >= date_trunc('day', now() - interval '{{incremental_interval}}' day) -{% endif %} + WHERE {{ incremental_predicate('block_time') }} +{% endif %} GROUP BY 2, 4 ORDER BY 2, 4 ), nop_reward_daily AS ( - SELECT + SELECT nop_paid.date_start, cast(date_trunc('month', nop_paid.date_start) as date) as date_month, nop_paid.operator_name, - nop_paid.nop_address, + nop_paid.nop_address, nop_paid.token_amount as token_amount, (nop_paid.token_amount * lud.usd_amount) as usd_amount - FROM + FROM nop_paid LEFT JOIN link_usd_daily lud ON lud.date_start = nop_paid.date_start ORDER BY date_start @@ -66,7 +65,7 @@ SELECT nop_address, token_amount, usd_amount -FROM +FROM nop_reward_daily ORDER BY 2, 5 diff --git a/daily_spellbook/models/chainlink/base/chainlink_base_ccip_request_daily.sql b/daily_spellbook/models/chainlink/base/chainlink_base_ccip_request_daily.sql index c5f45f3ee13..0389beefa7c 100644 --- a/daily_spellbook/models/chainlink/base/chainlink_base_ccip_request_daily.sql +++ b/daily_spellbook/models/chainlink/base/chainlink_base_ccip_request_daily.sql @@ -9,7 +9,6 @@ ) }} -{% set incremental_interval = '7' %} WITH ethereum_agg AS ( @@ -23,7 +22,7 @@ ethereum_agg AS ( WHERE eth.date_start = date_series.date_start {% if is_incremental() %} - AND eth.block_time >= date_trunc('day', now() - interval '{{incremental_interval}}' day) + AND {{ incremental_predicate('eth.block_time') }} {% endif %} ) AS fulfilled_requests, ( @@ -34,7 +33,7 @@ ethereum_agg AS ( WHERE rev.date_start = date_series.date_start {% if is_incremental() %} - AND rev.block_time >= date_trunc('day', now() - interval '{{incremental_interval}}' day) + AND {{ incremental_predicate('rev.block_time') }} {% endif %} ) AS reverted_requests FROM @@ -52,7 +51,7 @@ ethereum_agg AS ( ) AS seq CROSS JOIN UNNEST (seq.date_sequence) AS t (date_start) {% if is_incremental() %} - WHERE date_start >= date_trunc('day', now() - interval '{{incremental_interval}}' day) + WHERE {{ incremental_predicate('date_start') }} {% endif %} ) date_series ), @@ -67,7 +66,7 @@ ethereum_agg AS ( FROM ethereum_agg ) -SELECT +SELECT ccip_request_daily.blockchain, date_start, date_month, diff --git a/daily_spellbook/models/chainlink/base/chainlink_base_ccip_reverted_transactions.sql b/daily_spellbook/models/chainlink/base/chainlink_base_ccip_reverted_transactions.sql index 849f1dda792..7fbefe6500a 100644 --- a/daily_spellbook/models/chainlink/base/chainlink_base_ccip_reverted_transactions.sql +++ b/daily_spellbook/models/chainlink/base/chainlink_base_ccip_reverted_transactions.sql @@ -8,7 +8,6 @@ ) }} -{% set incremental_interval = '7' %} WITH ccip_reverted_transactions AS ( @@ -23,12 +22,12 @@ WITH LEFT JOIN {{ source('base', 'transactions') }} tx ON ccip_send_logs_v1.tx_hash = tx.hash {% if is_incremental() %} - AND tx.block_time >= date_trunc('day', now() - interval '{{incremental_interval}}' day) + AND {{ incremental_predicate('tx.block_time') }} {% endif %} WHERE tx.success = false {% if is_incremental() %} - AND ccip_send_logs_v1.block_time >= date_trunc('day', now() - interval '{{incremental_interval}}' day) + AND {{ incremental_predicate('ccip_send_logs_v1.block_time') }} {% endif %} UNION @@ -44,14 +43,14 @@ WITH LEFT JOIN {{ source('base', 'transactions') }} tx ON ccip_send_logs_v1_2.tx_hash = tx.hash {% if is_incremental() %} - AND tx.block_time >= date_trunc('day', now() - interval '{{incremental_interval}}' day) + AND {{ incremental_predicate('tx.block_time') }} {% endif %} WHERE tx.success = false {% if is_incremental() %} - AND ccip_send_logs_v1_2.block_time >= date_trunc('day', now() - interval '{{incremental_interval}}' day) + AND {{ incremental_predicate('ccip_send_logs_v1_2.block_time') }} {% endif %} - + ) SELECT 'base' as blockchain, diff --git a/daily_spellbook/models/chainlink/base/chainlink_base_ccip_reward_daily.sql b/daily_spellbook/models/chainlink/base/chainlink_base_ccip_reward_daily.sql index e9b1af33075..461ec3d28a8 100644 --- a/daily_spellbook/models/chainlink/base/chainlink_base_ccip_reward_daily.sql +++ b/daily_spellbook/models/chainlink/base/chainlink_base_ccip_reward_daily.sql @@ -9,7 +9,6 @@ ) }} -{% set incremental_interval = '7' %} WITH token_meta AS ( @@ -28,7 +27,7 @@ WITH {{ source('prices', 'usd') }} price JOIN token_meta ON price.symbol = token_meta.token_symbol {% if is_incremental() %} - WHERE price.minute >= date_trunc('day', now() - interval '{{incremental_interval}}' day) + WHERE {{ incremental_predicate('price.minute') }} {% endif %} GROUP BY 1, token_meta.token_symbol @@ -36,21 +35,21 @@ WITH 1 ), ccip_reward_daily AS ( - SELECT + SELECT ccip_send_requested_daily.date_start, - cast(date_trunc('month', ccip_send_requested_daily.date_start) as date) as date_month, + cast(date_trunc('month', ccip_send_requested_daily.date_start) as date) as date_month, SUM(ccip_send_requested_daily.fee_amount) as token_amount, SUM((ccip_send_requested_daily.fee_amount * tud.usd_amount)) as usd_amount, ccip_send_requested_daily.token as token - FROM + FROM {{ref('chainlink_base_ccip_send_requested_daily')}} ccip_send_requested_daily LEFT JOIN token_usd_daily tud ON tud.date_start = ccip_send_requested_daily.date_start AND tud.symbol = ccip_send_requested_daily.token {% if is_incremental() %} - WHERE ccip_send_requested_daily.date_start >= date_trunc('day', now() - interval '{{incremental_interval}}' day) - {% endif %} + WHERE {{ incremental_predicate('ccip_send_requested_daily.date_start') }} + {% endif %} GROUP BY 1, 5 ) - + SELECT 'base' as blockchain, date_start, @@ -58,7 +57,7 @@ SELECT token_amount, usd_amount, token -FROM +FROM ccip_reward_daily ORDER BY 2, 6 diff --git a/daily_spellbook/models/chainlink/base/chainlink_base_ccip_send_requested_daily.sql b/daily_spellbook/models/chainlink/base/chainlink_base_ccip_send_requested_daily.sql index f3a6d964d8e..3cd42a44c0e 100644 --- a/daily_spellbook/models/chainlink/base/chainlink_base_ccip_send_requested_daily.sql +++ b/daily_spellbook/models/chainlink/base/chainlink_base_ccip_send_requested_daily.sql @@ -1,6 +1,6 @@ {{ config( - + alias='ccip_send_requested_daily', partition_by=['date_month'], materialized='incremental', @@ -10,7 +10,6 @@ ) }} -{% set incremental_interval = '7' %} SELECT 'base' as blockchain, @@ -23,8 +22,8 @@ SELECT FROM {{ref('chainlink_base_ccip_send_requested')}} ccip_send_requested {% if is_incremental() %} - WHERE evt_block_time >= date_trunc('day', now() - interval '{{incremental_interval}}' day) -{% endif %} + WHERE {{ incremental_predicate('evt_block_time') }} +{% endif %} GROUP BY 2, 5, 6 ORDER BY diff --git a/daily_spellbook/models/chainlink/base/chainlink_base_ccip_transmitted_fulfilled.sql b/daily_spellbook/models/chainlink/base/chainlink_base_ccip_transmitted_fulfilled.sql index 1cf226421c0..0180d7dcf47 100644 --- a/daily_spellbook/models/chainlink/base/chainlink_base_ccip_transmitted_fulfilled.sql +++ b/daily_spellbook/models/chainlink/base/chainlink_base_ccip_transmitted_fulfilled.sql @@ -1,16 +1,16 @@ {{ config( - + alias='ccip_transmitted_fulfilled', partition_by=['date_month'], materialized='incremental', file_format='delta', incremental_strategy='merge', - unique_key=['tx_hash', 'tx_index', 'node_address'] + unique_key=['tx_hash', 'tx_index', 'node_address'], + incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.block_time')] ) }} -{% set incremental_interval = '7' %} WITH base_usd AS ( @@ -22,8 +22,8 @@ WITH WHERE symbol = 'ETH' {% if is_incremental() %} - AND minute >= date_trunc('day', now() - interval '{{incremental_interval}}' day) - {% endif %} + AND {{ incremental_predicate('minute') }} + {% endif %} ), ccip_fulfilled_transactions AS ( SELECT @@ -38,12 +38,12 @@ WITH {{ source('base', 'transactions') }} tx RIGHT JOIN {{ ref('chainlink_base_ccip_transmitted_logs') }} ccip_tx ON ccip_tx.tx_hash = tx.hash {% if is_incremental() %} - AND ccip_tx.block_time >= date_trunc('day', now() - interval '{{incremental_interval}}' day) + AND {{ incremental_predicate('ccip_tx.block_time') }} {% endif %} LEFT JOIN base_usd ON date_trunc('minute', tx.block_time) = base_usd.block_time {% if is_incremental() %} - WHERE tx.block_time >= date_trunc('day', now() - interval '{{incremental_interval}}' day) - {% endif %} + WHERE {{ incremental_predicate('tx.block_time') }} + {% endif %} GROUP BY tx.hash, tx.index, diff --git a/daily_spellbook/models/chainlink/base/chainlink_base_ccip_transmitted_reverted.sql b/daily_spellbook/models/chainlink/base/chainlink_base_ccip_transmitted_reverted.sql index 274d4036877..d206e053a9d 100644 --- a/daily_spellbook/models/chainlink/base/chainlink_base_ccip_transmitted_reverted.sql +++ b/daily_spellbook/models/chainlink/base/chainlink_base_ccip_transmitted_reverted.sql @@ -1,16 +1,16 @@ {{ config( - + alias='ccip_transmitted_reverted', partition_by=['date_month'], materialized='incremental', file_format='delta', incremental_strategy='merge', - unique_key=['tx_hash', 'tx_index', 'node_address'] + unique_key=['tx_hash', 'tx_index', 'node_address'], + incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.block_time')] ) }} -{% set incremental_interval = '7' %} WITH base_usd AS ( @@ -22,8 +22,8 @@ WITH WHERE symbol = 'ETH' {% if is_incremental() %} - AND minute >= date_trunc('day', now() - interval '{{incremental_interval}}' day) - {% endif %} + AND {{ incremental_predicate('minute') }} + {% endif %} ), ccip_reverted_transactions AS ( SELECT @@ -38,14 +38,14 @@ WITH {{ ref('chainlink_base_ccip_transmitted_logs') }} tx LEFT JOIN {{ source('base', 'transactions') }} tx2 ON tx2.hash = tx.tx_hash {% if is_incremental() %} - AND tx.block_time >= date_trunc('day', now() - interval '{{incremental_interval}}' day) + AND {{ incremental_predicate('tx.block_time') }} {% endif %} LEFT JOIN base_usd ON date_trunc('minute', tx.block_time) = base_usd.block_time WHERE tx2.success = false {% if is_incremental() %} - AND tx.block_time >= date_trunc('day', now() - interval '{{incremental_interval}}' day) - {% endif %} + AND {{ incremental_predicate('tx.block_time') }} + {% endif %} GROUP BY tx.tx_hash, tx.index, diff --git a/daily_spellbook/models/chainlink/bnb/chainlink_bnb_automation_fulfilled_transactions.sql b/daily_spellbook/models/chainlink/bnb/chainlink_bnb_automation_fulfilled_transactions.sql index 01f011908c4..568acd027ab 100644 --- a/daily_spellbook/models/chainlink/bnb/chainlink_bnb_automation_fulfilled_transactions.sql +++ b/daily_spellbook/models/chainlink/bnb/chainlink_bnb_automation_fulfilled_transactions.sql @@ -1,16 +1,16 @@ {{ config( - + alias='automation_fulfilled_transactions', partition_by=['date_month'], materialized='incremental', file_format='delta', incremental_strategy='merge', - unique_key=['tx_hash', 'tx_index', 'node_address'] + unique_key=['tx_hash', 'tx_index', 'node_address'], + incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.block_time')] ) }} -{% set incremental_interval = '7' %} WITH bnb_usd AS ( @@ -22,8 +22,8 @@ WITH WHERE symbol = 'BNB' {% if is_incremental() %} - AND minute >= date_trunc('day', now() - interval '{{incremental_interval}}' day) - {% endif %} + AND {{ incremental_predicate('minute') }} + {% endif %} ), automation_fulfilled_transactions AS ( SELECT @@ -38,12 +38,12 @@ WITH {{ source('bnb', 'transactions') }} tx RIGHT JOIN {{ ref('chainlink_bnb_automation_upkeep_performed_logs') }} automation_upkeep_performed_logs ON automation_upkeep_performed_logs.tx_hash = tx.hash {% if is_incremental() %} - AND automation_upkeep_performed_logs.block_time >= date_trunc('day', now() - interval '{{incremental_interval}}' day) + AND {{ incremental_predicate('automation_upkeep_performed_logs.block_time') }} {% endif %} LEFT JOIN bnb_usd ON date_trunc('minute', tx.block_time) = bnb_usd.block_time {% if is_incremental() %} - WHERE tx.block_time >= date_trunc('day', now() - interval '{{incremental_interval}}' day) - {% endif %} + WHERE {{ incremental_predicate('tx.block_time') }} + {% endif %} GROUP BY tx.hash, tx.index, diff --git a/daily_spellbook/models/chainlink/bnb/chainlink_bnb_automation_gas_daily.sql b/daily_spellbook/models/chainlink/bnb/chainlink_bnb_automation_gas_daily.sql index da050007033..2df28af40e4 100644 --- a/daily_spellbook/models/chainlink/bnb/chainlink_bnb_automation_gas_daily.sql +++ b/daily_spellbook/models/chainlink/bnb/chainlink_bnb_automation_gas_daily.sql @@ -1,6 +1,6 @@ {{ config( - + alias='automation_gas_daily', partition_by=['date_month'], materialized='incremental', @@ -10,7 +10,6 @@ ) }} -{% set incremental_interval = '7' %} {% set truncate_by = 'day' %} WITH @@ -24,7 +23,7 @@ WITH {{ ref('chainlink_bnb_automation_fulfilled_transactions') }} fulfilled {% if is_incremental() %} WHERE - fulfilled.block_time >= date_trunc('day', now() - interval '{{incremental_interval}}' day) + {{ incremental_predicate('fulfilled.block_time') }} {% endif %} GROUP BY 1, 2 @@ -41,7 +40,7 @@ WITH {{ ref('chainlink_bnb_automation_reverted_transactions') }} reverted {% if is_incremental() %} WHERE - reverted.block_time >= date_trunc('day', now() - interval '{{incremental_interval}}' day) + {{ incremental_predicate('reverted.block_time') }} {% endif %} GROUP BY 1, 2 @@ -53,7 +52,7 @@ WITH COALESCE( fulfilled.date_start, reverted.date_start - ) AS "date_start", + ) AS "date_start", COALESCE( fulfilled.node_address, reverted.node_address @@ -86,7 +85,7 @@ WITH FROM automation_gas_daily_meta LEFT JOIN {{ ref('chainlink_bnb_automation_meta') }} automation_meta ON automation_meta.keeper_address = automation_gas_daily_meta.node_address ) -SELECT +SELECT blockchain, date_start, date_month, @@ -97,7 +96,7 @@ SELECT reverted_token_amount, reverted_usd_amount, total_token_amount, - total_usd_amount + total_usd_amount FROM automation_gas_daily ORDER BY diff --git a/daily_spellbook/models/chainlink/bnb/chainlink_bnb_automation_performed_daily.sql b/daily_spellbook/models/chainlink/bnb/chainlink_bnb_automation_performed_daily.sql index 7e90cf589b2..3291166df9b 100644 --- a/daily_spellbook/models/chainlink/bnb/chainlink_bnb_automation_performed_daily.sql +++ b/daily_spellbook/models/chainlink/bnb/chainlink_bnb_automation_performed_daily.sql @@ -1,16 +1,16 @@ {{ config( - + alias='automation_performed_daily', partition_by=['date_month'], materialized='incremental', file_format='delta', incremental_strategy='merge', - unique_key=['date_start', 'keeper_address'] + unique_key=['date_start', 'keeper_address'], + incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.date_month')] ) }} -{% set incremental_interval = '7' %} SELECT 'bnb' as blockchain, @@ -22,8 +22,8 @@ SELECT FROM {{ref('chainlink_bnb_automation_performed')}} automation_performed {% if is_incremental() %} - WHERE evt_block_time >= date_trunc('day', now() - interval '{{incremental_interval}}' day) -{% endif %} + WHERE {{ incremental_predicate('evt_block_time') }} +{% endif %} GROUP BY 2, 4 ORDER BY diff --git a/daily_spellbook/models/chainlink/bnb/chainlink_bnb_automation_request_daily.sql b/daily_spellbook/models/chainlink/bnb/chainlink_bnb_automation_request_daily.sql index 9cd9b90a149..0e496f16587 100644 --- a/daily_spellbook/models/chainlink/bnb/chainlink_bnb_automation_request_daily.sql +++ b/daily_spellbook/models/chainlink/bnb/chainlink_bnb_automation_request_daily.sql @@ -1,6 +1,6 @@ {{ config( - + alias='automation_request_daily', partition_by=['date_month'], materialized='incremental', @@ -10,7 +10,6 @@ ) }} -{% set incremental_interval = '7' %} {% set truncate_by = 'day' %} WITH @@ -19,7 +18,7 @@ WITH COALESCE( cast(date_trunc('{{truncate_by}}', fulfilled.block_time) as date), cast(date_trunc('{{truncate_by}}', reverted.block_time) as date) - ) AS "date_start", + ) AS "date_start", COALESCE( fulfilled.node_address, reverted.node_address @@ -34,8 +33,8 @@ WITH reverted.node_address = fulfilled.node_address {% if is_incremental() %} WHERE - fulfilled.block_time >= date_trunc('day', now() - interval '{{incremental_interval}}' day) - OR reverted.block_time >= date_trunc('day', now() - interval '{{incremental_interval}}' day) + {{ incremental_predicate('fulfilled.block_time') }} + OR {{ incremental_predicate('reverted.block_time') }} {% endif %} GROUP BY 1, 2 @@ -53,7 +52,7 @@ WITH total_requests FROM automation_request_daily_meta ) -SELECT +SELECT automation_request_daily.blockchain, date_start, date_month, diff --git a/daily_spellbook/models/chainlink/bnb/chainlink_bnb_automation_reverted_transactions.sql b/daily_spellbook/models/chainlink/bnb/chainlink_bnb_automation_reverted_transactions.sql index 1641887db91..ab947bca453 100644 --- a/daily_spellbook/models/chainlink/bnb/chainlink_bnb_automation_reverted_transactions.sql +++ b/daily_spellbook/models/chainlink/bnb/chainlink_bnb_automation_reverted_transactions.sql @@ -1,16 +1,16 @@ {{ config( - + alias='automation_reverted_transactions', partition_by=['date_month'], materialized='incremental', file_format='delta', incremental_strategy='merge', - unique_key=['tx_hash', 'tx_index', 'node_address'] + unique_key=['tx_hash', 'tx_index', 'node_address'], + incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.block_time')] ) }} -{% set incremental_interval = '7' %} WITH bnb_usd AS ( @@ -22,8 +22,8 @@ WITH WHERE symbol = 'BNB' {% if is_incremental() %} - AND minute >= date_trunc('day', now() - interval '{{incremental_interval}}' day) - {% endif %} + AND {{ incremental_predicate('minute') }} + {% endif %} ), automation_reverted_transactions AS ( SELECT @@ -40,8 +40,8 @@ WITH WHERE success = false {% if is_incremental() %} - AND tx.block_time >= date_trunc('day', now() - interval '{{incremental_interval}}' day) - {% endif %} + AND {{ incremental_predicate('tx.block_time') }} + {% endif %} GROUP BY tx.hash, tx.index, diff --git a/daily_spellbook/models/chainlink/bnb/chainlink_bnb_automation_reward_daily.sql b/daily_spellbook/models/chainlink/bnb/chainlink_bnb_automation_reward_daily.sql index 932758a865d..f4b016c47ee 100644 --- a/daily_spellbook/models/chainlink/bnb/chainlink_bnb_automation_reward_daily.sql +++ b/daily_spellbook/models/chainlink/bnb/chainlink_bnb_automation_reward_daily.sql @@ -1,6 +1,6 @@ {{ config( - + alias='automation_reward_daily', partition_by = ['date_month'], materialized = 'incremental', @@ -10,7 +10,6 @@ ) }} -{% set incremental_interval = '7' %} WITH link_usd_daily AS ( @@ -20,21 +19,21 @@ WITH FROM {{ source('prices', 'usd') }} price WHERE - price.symbol = 'LINK' + price.symbol = 'LINK' GROUP BY 1 ORDER BY 1 ), automation_reward_daily AS ( - SELECT + SELECT automation_performed_daily.date_start, cast(date_trunc('month', automation_performed_daily.date_start) as date) as date_month, automation_performed_daily.operator_name, - automation_performed_daily.keeper_address, + automation_performed_daily.keeper_address, automation_performed_daily.token_amount as token_amount, (automation_performed_daily.token_amount * lud.usd_amount) as usd_amount - FROM + FROM {{ref('chainlink_bnb_automation_performed_daily')}} automation_performed_daily LEFT JOIN link_usd_daily lud ON lud.date_start = automation_performed_daily.date_start ORDER BY date_start @@ -47,7 +46,7 @@ SELECT keeper_address, token_amount, usd_amount -FROM +FROM automation_reward_daily ORDER BY 2, 5 diff --git a/daily_spellbook/models/chainlink/bnb/chainlink_bnb_ccip_fulfilled_transactions.sql b/daily_spellbook/models/chainlink/bnb/chainlink_bnb_ccip_fulfilled_transactions.sql index abedc8129a5..fbe61225718 100644 --- a/daily_spellbook/models/chainlink/bnb/chainlink_bnb_ccip_fulfilled_transactions.sql +++ b/daily_spellbook/models/chainlink/bnb/chainlink_bnb_ccip_fulfilled_transactions.sql @@ -8,7 +8,6 @@ ) }} -{% set incremental_interval = '7' %} WITH ccip_fulfilled_transactions AS ( @@ -23,12 +22,12 @@ WITH LEFT JOIN {{ source('bnb', 'transactions') }} tx ON ccip_send_logs_v1.tx_hash = tx.hash {% if is_incremental() %} - AND tx.block_time >= date_trunc('day', now() - interval '{{incremental_interval}}' day) + AND {{ incremental_predicate('tx.block_time') }} {% endif %} WHERE tx.success = true {% if is_incremental() %} - AND ccip_send_logs_v1.block_time >= date_trunc('day', now() - interval '{{incremental_interval}}' day) + AND {{ incremental_predicate('ccip_send_logs_v1.block_time') }} {% endif %} UNION @@ -44,14 +43,14 @@ WITH LEFT JOIN {{ source('bnb', 'transactions') }} tx ON ccip_send_logs_v1_2.tx_hash = tx.hash {% if is_incremental() %} - AND tx.block_time >= date_trunc('day', now() - interval '{{incremental_interval}}' day) + AND {{ incremental_predicate('tx.block_time') }} {% endif %} WHERE tx.success = true {% if is_incremental() %} - AND ccip_send_logs_v1_2.block_time >= date_trunc('day', now() - interval '{{incremental_interval}}' day) + AND {{ incremental_predicate('ccip_send_logs_v1_2.block_time') }} {% endif %} - + ) SELECT 'bnb' as blockchain, diff --git a/daily_spellbook/models/chainlink/bnb/chainlink_bnb_ccip_gas_daily.sql b/daily_spellbook/models/chainlink/bnb/chainlink_bnb_ccip_gas_daily.sql index 3e27ebfa72f..e2cca345b73 100644 --- a/daily_spellbook/models/chainlink/bnb/chainlink_bnb_ccip_gas_daily.sql +++ b/daily_spellbook/models/chainlink/bnb/chainlink_bnb_ccip_gas_daily.sql @@ -1,6 +1,6 @@ {{ config( - + alias='ccip_gas_daily', partition_by=['date_month'], materialized='incremental', @@ -10,7 +10,6 @@ ) }} -{% set incremental_interval = '7' %} {% set truncate_by = 'day' %} WITH @@ -24,7 +23,7 @@ WITH {{ ref('chainlink_bnb_ccip_transmitted_fulfilled') }} fulfilled {% if is_incremental() %} WHERE - fulfilled.block_time >= date_trunc('day', now() - interval '{{incremental_interval}}' day) + {{ incremental_predicate('fulfilled.block_time') }} {% endif %} GROUP BY 1, 2 @@ -41,7 +40,7 @@ WITH {{ ref('chainlink_bnb_ccip_transmitted_reverted') }} reverted {% if is_incremental() %} WHERE - reverted.block_time >= date_trunc('day', now() - interval '{{incremental_interval}}' day) + {{ incremental_predicate('reverted.block_time') }} {% endif %} GROUP BY 1, 2 @@ -53,7 +52,7 @@ WITH COALESCE( fulfilled.date_start, reverted.date_start - ) AS "date_start", + ) AS "date_start", COALESCE( fulfilled.node_address, reverted.node_address @@ -86,7 +85,7 @@ WITH FROM ccip_gas_daily_meta LEFT JOIN {{ ref('chainlink_bnb_ccip_operator_meta') }} ccip_operator_meta ON ccip_operator_meta.node_address = ccip_gas_daily_meta.node_address ) -SELECT +SELECT blockchain, date_start, date_month, @@ -97,7 +96,7 @@ SELECT reverted_token_amount, reverted_usd_amount, total_token_amount, - total_usd_amount + total_usd_amount FROM ccip_gas_daily ORDER BY diff --git a/daily_spellbook/models/chainlink/bnb/chainlink_bnb_ccip_nop_reward_daily.sql b/daily_spellbook/models/chainlink/bnb/chainlink_bnb_ccip_nop_reward_daily.sql index 294c0c7bddc..b47a1d1999b 100644 --- a/daily_spellbook/models/chainlink/bnb/chainlink_bnb_ccip_nop_reward_daily.sql +++ b/daily_spellbook/models/chainlink/bnb/chainlink_bnb_ccip_nop_reward_daily.sql @@ -1,6 +1,6 @@ {{ config( - + alias='ccip_nop_reward_daily', partition_by = ['date_month'], materialized = 'incremental', @@ -10,7 +10,6 @@ ) }} -{% set incremental_interval = '7' %} WITH link_usd_daily AS ( @@ -20,7 +19,7 @@ WITH FROM {{ source('prices', 'usd') }} price WHERE - price.symbol = 'LINK' + price.symbol = 'LINK' GROUP BY 1 ORDER BY @@ -38,22 +37,22 @@ FROM {{ref('chainlink_bnb_ccip_nop_paid_logs')}} nop_logs LEFT JOIN {{ref('chainlink_bnb_ccip_admin_meta')}} admin_meta ON admin_meta.admin_address = nop_logs.nop_address {% if is_incremental() %} - WHERE block_time >= date_trunc('day', now() - interval '{{incremental_interval}}' day) -{% endif %} + WHERE {{ incremental_predicate('block_time') }} +{% endif %} GROUP BY 2, 4 ORDER BY 2, 4 ), nop_reward_daily AS ( - SELECT + SELECT nop_paid.date_start, cast(date_trunc('month', nop_paid.date_start) as date) as date_month, nop_paid.operator_name, - nop_paid.nop_address, + nop_paid.nop_address, nop_paid.token_amount as token_amount, (nop_paid.token_amount * lud.usd_amount) as usd_amount - FROM + FROM nop_paid LEFT JOIN link_usd_daily lud ON lud.date_start = nop_paid.date_start ORDER BY date_start @@ -66,7 +65,7 @@ SELECT nop_address, token_amount, usd_amount -FROM +FROM nop_reward_daily ORDER BY 2, 5 diff --git a/daily_spellbook/models/chainlink/bnb/chainlink_bnb_ccip_request_daily.sql b/daily_spellbook/models/chainlink/bnb/chainlink_bnb_ccip_request_daily.sql index 52a5f0dfe7e..48744597352 100644 --- a/daily_spellbook/models/chainlink/bnb/chainlink_bnb_ccip_request_daily.sql +++ b/daily_spellbook/models/chainlink/bnb/chainlink_bnb_ccip_request_daily.sql @@ -9,7 +9,6 @@ ) }} -{% set incremental_interval = '7' %} WITH ethereum_agg AS ( @@ -23,7 +22,7 @@ ethereum_agg AS ( WHERE eth.date_start = date_series.date_start {% if is_incremental() %} - AND eth.block_time >= date_trunc('day', now() - interval '{{incremental_interval}}' day) + AND {{ incremental_predicate('eth.block_time') }} {% endif %} ) AS fulfilled_requests, ( @@ -34,7 +33,7 @@ ethereum_agg AS ( WHERE rev.date_start = date_series.date_start {% if is_incremental() %} - AND rev.block_time >= date_trunc('day', now() - interval '{{incremental_interval}}' day) + AND {{ incremental_predicate('rev.block_time') }} {% endif %} ) AS reverted_requests FROM @@ -52,7 +51,7 @@ ethereum_agg AS ( ) AS seq CROSS JOIN UNNEST (seq.date_sequence) AS t (date_start) {% if is_incremental() %} - WHERE date_start >= date_trunc('day', now() - interval '{{incremental_interval}}' day) + WHERE {{ incremental_predicate('date_start') }} {% endif %} ) date_series ), @@ -67,7 +66,7 @@ ethereum_agg AS ( FROM ethereum_agg ) -SELECT +SELECT ccip_request_daily.blockchain, date_start, date_month, diff --git a/daily_spellbook/models/chainlink/bnb/chainlink_bnb_ccip_reverted_transactions.sql b/daily_spellbook/models/chainlink/bnb/chainlink_bnb_ccip_reverted_transactions.sql index d9d0e06f0fc..740acee1abb 100644 --- a/daily_spellbook/models/chainlink/bnb/chainlink_bnb_ccip_reverted_transactions.sql +++ b/daily_spellbook/models/chainlink/bnb/chainlink_bnb_ccip_reverted_transactions.sql @@ -8,7 +8,6 @@ ) }} -{% set incremental_interval = '7' %} WITH ccip_reverted_transactions AS ( @@ -23,12 +22,12 @@ WITH LEFT JOIN {{ source('bnb', 'transactions') }} tx ON ccip_send_logs_v1.tx_hash = tx.hash {% if is_incremental() %} - AND tx.block_time >= date_trunc('day', now() - interval '{{incremental_interval}}' day) + AND {{ incremental_predicate('tx.block_time') }} {% endif %} WHERE tx.success = false {% if is_incremental() %} - AND ccip_send_logs_v1.block_time >= date_trunc('day', now() - interval '{{incremental_interval}}' day) + AND {{ incremental_predicate('ccip_send_logs_v1.block_time') }} {% endif %} UNION @@ -44,14 +43,14 @@ WITH LEFT JOIN {{ source('bnb', 'transactions') }} tx ON ccip_send_logs_v1_2.tx_hash = tx.hash {% if is_incremental() %} - AND tx.block_time >= date_trunc('day', now() - interval '{{incremental_interval}}' day) + AND {{ incremental_predicate('tx.block_time') }} {% endif %} WHERE tx.success = false {% if is_incremental() %} - AND ccip_send_logs_v1_2.block_time >= date_trunc('day', now() - interval '{{incremental_interval}}' day) + AND {{ incremental_predicate('ccip_send_logs_v1_2.block_time') }} {% endif %} - + ) SELECT 'bnb' as blockchain, diff --git a/daily_spellbook/models/chainlink/bnb/chainlink_bnb_ccip_reward_daily.sql b/daily_spellbook/models/chainlink/bnb/chainlink_bnb_ccip_reward_daily.sql index 9dbcd09bbae..b79390a7d18 100644 --- a/daily_spellbook/models/chainlink/bnb/chainlink_bnb_ccip_reward_daily.sql +++ b/daily_spellbook/models/chainlink/bnb/chainlink_bnb_ccip_reward_daily.sql @@ -9,7 +9,6 @@ ) }} -{% set incremental_interval = '7' %} WITH token_meta AS ( @@ -28,7 +27,7 @@ WITH {{ source('prices', 'usd') }} price JOIN token_meta ON price.symbol = token_meta.token_symbol {% if is_incremental() %} - WHERE price.minute >= date_trunc('day', now() - interval '{{incremental_interval}}' day) + WHERE {{ incremental_predicate('price.minute') }} {% endif %} GROUP BY 1, token_meta.token_symbol @@ -36,21 +35,21 @@ WITH 1 ), ccip_reward_daily AS ( - SELECT + SELECT ccip_send_requested_daily.date_start, - cast(date_trunc('month', ccip_send_requested_daily.date_start) as date) as date_month, + cast(date_trunc('month', ccip_send_requested_daily.date_start) as date) as date_month, SUM(ccip_send_requested_daily.fee_amount) as token_amount, SUM((ccip_send_requested_daily.fee_amount * tud.usd_amount)) as usd_amount, ccip_send_requested_daily.token as token - FROM + FROM {{ref('chainlink_bnb_ccip_send_requested_daily')}} ccip_send_requested_daily LEFT JOIN token_usd_daily tud ON tud.date_start = ccip_send_requested_daily.date_start AND tud.symbol = ccip_send_requested_daily.token {% if is_incremental() %} - WHERE ccip_send_requested_daily.date_start >= date_trunc('day', now() - interval '{{incremental_interval}}' day) - {% endif %} + WHERE {{ incremental_predicate('ccip_send_requested_daily.date_start') }} + {% endif %} GROUP BY 1, 5 ) - + SELECT 'bnb' as blockchain, date_start, @@ -58,7 +57,7 @@ SELECT token_amount, usd_amount, token -FROM +FROM ccip_reward_daily ORDER BY 2, 6 diff --git a/daily_spellbook/models/chainlink/bnb/chainlink_bnb_ccip_send_requested_daily.sql b/daily_spellbook/models/chainlink/bnb/chainlink_bnb_ccip_send_requested_daily.sql index 2c3085946f1..3318ab8d076 100644 --- a/daily_spellbook/models/chainlink/bnb/chainlink_bnb_ccip_send_requested_daily.sql +++ b/daily_spellbook/models/chainlink/bnb/chainlink_bnb_ccip_send_requested_daily.sql @@ -1,6 +1,6 @@ {{ config( - + alias='ccip_send_requested_daily', partition_by=['date_month'], materialized='incremental', @@ -10,7 +10,6 @@ ) }} -{% set incremental_interval = '7' %} SELECT 'bnb' as blockchain, @@ -23,8 +22,8 @@ SELECT FROM {{ref('chainlink_bnb_ccip_send_requested')}} ccip_send_requested {% if is_incremental() %} - WHERE evt_block_time >= date_trunc('day', now() - interval '{{incremental_interval}}' day) -{% endif %} + WHERE {{ incremental_predicate('evt_block_time') }} +{% endif %} GROUP BY 2, 5, 6 ORDER BY diff --git a/daily_spellbook/models/chainlink/bnb/chainlink_bnb_ccip_transmitted_fulfilled.sql b/daily_spellbook/models/chainlink/bnb/chainlink_bnb_ccip_transmitted_fulfilled.sql index 7253302a40d..a9ec6b37837 100644 --- a/daily_spellbook/models/chainlink/bnb/chainlink_bnb_ccip_transmitted_fulfilled.sql +++ b/daily_spellbook/models/chainlink/bnb/chainlink_bnb_ccip_transmitted_fulfilled.sql @@ -1,16 +1,16 @@ {{ config( - + alias='ccip_transmitted_fulfilled', partition_by=['date_month'], materialized='incremental', file_format='delta', incremental_strategy='merge', - unique_key=['tx_hash', 'tx_index', 'node_address'] + unique_key=['tx_hash', 'tx_index', 'node_address'], + incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.block_time')] ) }} -{% set incremental_interval = '7' %} WITH bnb_usd AS ( @@ -22,8 +22,8 @@ WITH WHERE symbol = 'BNB' {% if is_incremental() %} - AND minute >= date_trunc('day', now() - interval '{{incremental_interval}}' day) - {% endif %} + AND {{ incremental_predicate('minute') }} + {% endif %} ), ccip_fulfilled_transactions AS ( SELECT @@ -38,12 +38,12 @@ WITH {{ source('bnb', 'transactions') }} tx RIGHT JOIN {{ ref('chainlink_bnb_ccip_transmitted_logs') }} ccip_tx ON ccip_tx.tx_hash = tx.hash {% if is_incremental() %} - AND ccip_tx.block_time >= date_trunc('day', now() - interval '{{incremental_interval}}' day) + AND {{ incremental_predicate('ccip_tx.block_time') }} {% endif %} LEFT JOIN bnb_usd ON date_trunc('minute', tx.block_time) = bnb_usd.block_time {% if is_incremental() %} - WHERE tx.block_time >= date_trunc('day', now() - interval '{{incremental_interval}}' day) - {% endif %} + WHERE {{ incremental_predicate('tx.block_time') }} + {% endif %} GROUP BY tx.hash, tx.index, diff --git a/daily_spellbook/models/chainlink/bnb/chainlink_bnb_ccip_transmitted_reverted.sql b/daily_spellbook/models/chainlink/bnb/chainlink_bnb_ccip_transmitted_reverted.sql index 1b986e79427..edaa5755475 100644 --- a/daily_spellbook/models/chainlink/bnb/chainlink_bnb_ccip_transmitted_reverted.sql +++ b/daily_spellbook/models/chainlink/bnb/chainlink_bnb_ccip_transmitted_reverted.sql @@ -1,16 +1,16 @@ {{ config( - + alias='ccip_transmitted_reverted', partition_by=['date_month'], materialized='incremental', file_format='delta', incremental_strategy='merge', - unique_key=['tx_hash', 'tx_index', 'node_address'] + unique_key=['tx_hash', 'tx_index', 'node_address'], + incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.block_time')] ) }} -{% set incremental_interval = '7' %} WITH bnb_usd AS ( @@ -22,8 +22,8 @@ WITH WHERE symbol = 'BNB' {% if is_incremental() %} - AND minute >= date_trunc('day', now() - interval '{{incremental_interval}}' day) - {% endif %} + AND {{ incremental_predicate('minute') }} + {% endif %} ), ccip_reverted_transactions AS ( SELECT @@ -38,14 +38,14 @@ WITH {{ ref('chainlink_bnb_ccip_transmitted_logs') }} tx LEFT JOIN {{ source('bnb', 'transactions') }} tx2 ON tx2.hash = tx.tx_hash {% if is_incremental() %} - AND tx.block_time >= date_trunc('day', now() - interval '{{incremental_interval}}' day) + AND {{ incremental_predicate('tx.block_time') }} {% endif %} LEFT JOIN bnb_usd ON date_trunc('minute', tx.block_time) = bnb_usd.block_time WHERE tx2.success = false {% if is_incremental() %} - AND tx.block_time >= date_trunc('day', now() - interval '{{incremental_interval}}' day) - {% endif %} + AND {{ incremental_predicate('tx.block_time') }} + {% endif %} GROUP BY tx.tx_hash, tx.index, diff --git a/daily_spellbook/models/chainlink/bnb/chainlink_bnb_fm_fulfilled_transactions.sql b/daily_spellbook/models/chainlink/bnb/chainlink_bnb_fm_fulfilled_transactions.sql index 4a5317ed5e1..a926bc3c1b5 100644 --- a/daily_spellbook/models/chainlink/bnb/chainlink_bnb_fm_fulfilled_transactions.sql +++ b/daily_spellbook/models/chainlink/bnb/chainlink_bnb_fm_fulfilled_transactions.sql @@ -1,16 +1,16 @@ {{ config( - + alias='fm_fulfilled_transactions', partition_by=['date_month'], materialized='incremental', file_format='delta', incremental_strategy='merge', - unique_key=['tx_hash', 'tx_index', 'node_address'] + unique_key=['tx_hash', 'tx_index', 'node_address'], + incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.block_time')] ) }} -{% set incremental_interval = '7' %} WITH bnb_usd AS ( @@ -22,8 +22,8 @@ WITH WHERE symbol = 'BNB' {% if is_incremental() %} - AND minute >= date_trunc('day', now() - interval '{{incremental_interval}}' day) - {% endif %} + AND {{ incremental_predicate('minute') }} + {% endif %} ), fm_submission_transactions AS ( SELECT @@ -40,12 +40,12 @@ WITH {{ source('bnb', 'transactions') }} tx RIGHT JOIN {{ ref('chainlink_bnb_fm_gas_submission_logs') }} fm_gas_submission_logs ON fm_gas_submission_logs.tx_hash = tx.hash {% if is_incremental() %} - AND fm_gas_submission_logs.block_time >= date_trunc('day', now() - interval '{{incremental_interval}}' day) + AND {{ incremental_predicate('fm_gas_submission_logs.block_time') }} {% endif %} LEFT JOIN bnb_usd ON date_trunc('minute', tx.block_time) = bnb_usd.block_time {% if is_incremental() %} - WHERE tx.block_time >= date_trunc('day', now() - interval '{{incremental_interval}}' day) - {% endif %} + WHERE {{ incremental_predicate('tx.block_time') }} + {% endif %} GROUP BY tx.hash, tx.index, diff --git a/daily_spellbook/models/chainlink/bnb/chainlink_bnb_fm_gas_daily.sql b/daily_spellbook/models/chainlink/bnb/chainlink_bnb_fm_gas_daily.sql index c05f4b8722c..d6cc774968b 100644 --- a/daily_spellbook/models/chainlink/bnb/chainlink_bnb_fm_gas_daily.sql +++ b/daily_spellbook/models/chainlink/bnb/chainlink_bnb_fm_gas_daily.sql @@ -1,6 +1,6 @@ {{ config( - + alias='fm_gas_daily', partition_by=['date_month'], materialized='incremental', @@ -10,7 +10,6 @@ ) }} -{% set incremental_interval = '7' %} {% set truncate_by = 'day' %} WITH @@ -24,7 +23,7 @@ WITH {{ ref('chainlink_bnb_fm_fulfilled_transactions') }} fulfilled {% if is_incremental() %} WHERE - fulfilled.block_time >= date_trunc('day', now() - interval '{{incremental_interval}}' day) + {{ incremental_predicate('fulfilled.block_time') }} {% endif %} GROUP BY 1, 2 @@ -41,7 +40,7 @@ WITH {{ ref('chainlink_bnb_fm_reverted_transactions') }} reverted {% if is_incremental() %} WHERE - reverted.block_time >= date_trunc('day', now() - interval '{{incremental_interval}}' day) + {{ incremental_predicate('reverted.block_time') }} {% endif %} GROUP BY 1, 2 @@ -53,7 +52,7 @@ WITH COALESCE( fulfilled.date_start, reverted.date_start - ) AS "date_start", + ) AS "date_start", COALESCE( fulfilled.node_address, reverted.node_address @@ -86,7 +85,7 @@ WITH FROM fm_gas_daily_meta LEFT JOIN {{ ref('chainlink_bnb_ocr_operator_node_meta') }} fm_operator_node_meta ON fm_operator_node_meta.node_address = fm_gas_daily_meta.node_address ) -SELECT +SELECT blockchain, date_start, date_month, @@ -97,7 +96,7 @@ SELECT reverted_token_amount, reverted_usd_amount, total_token_amount, - total_usd_amount + total_usd_amount FROM fm_gas_daily ORDER BY diff --git a/daily_spellbook/models/chainlink/bnb/chainlink_bnb_fm_request_daily.sql b/daily_spellbook/models/chainlink/bnb/chainlink_bnb_fm_request_daily.sql index 8ac3c31413d..d0926d974da 100644 --- a/daily_spellbook/models/chainlink/bnb/chainlink_bnb_fm_request_daily.sql +++ b/daily_spellbook/models/chainlink/bnb/chainlink_bnb_fm_request_daily.sql @@ -1,6 +1,6 @@ {{ config( - + alias='fm_request_daily', partition_by=['date_month'], materialized='incremental', @@ -10,7 +10,6 @@ ) }} -{% set incremental_interval = '7' %} {% set truncate_by = 'day' %} WITH @@ -19,7 +18,7 @@ WITH COALESCE( cast(date_trunc('{{truncate_by}}', fulfilled.block_time) as date), cast(date_trunc('{{truncate_by}}', reverted.block_time) as date) - ) AS "date_start", + ) AS "date_start", COALESCE( fulfilled.node_address, reverted.node_address @@ -34,8 +33,8 @@ WITH reverted.node_address = fulfilled.node_address {% if is_incremental() %} WHERE - fulfilled.block_time >= date_trunc('day', now() - interval '{{incremental_interval}}' day) - AND reverted.block_time >= date_trunc('day', now() - interval '{{incremental_interval}}' day) + {{ incremental_predicate('fulfilled.block_time') }} + AND {{ incremental_predicate('reverted.block_time') }} {% endif %} GROUP BY 1, 2 @@ -55,7 +54,7 @@ WITH FROM fm_request_daily_meta LEFT JOIN {{ ref('chainlink_bnb_ocr_operator_node_meta') }} fm_operator_node_meta ON fm_operator_node_meta.node_address = fm_request_daily_meta.node_address ) -SELECT +SELECT blockchain, date_start, date_month, diff --git a/daily_spellbook/models/chainlink/bnb/chainlink_bnb_fm_reverted_transactions.sql b/daily_spellbook/models/chainlink/bnb/chainlink_bnb_fm_reverted_transactions.sql index c51efdfe9fa..fced8d9efd7 100644 --- a/daily_spellbook/models/chainlink/bnb/chainlink_bnb_fm_reverted_transactions.sql +++ b/daily_spellbook/models/chainlink/bnb/chainlink_bnb_fm_reverted_transactions.sql @@ -1,16 +1,16 @@ {{ config( - + alias='fm_reverted_transactions', partition_by=['date_month'], materialized='incremental', file_format='delta', incremental_strategy='merge', - unique_key=['tx_hash', 'tx_index', 'node_address'] + unique_key=['tx_hash', 'tx_index', 'node_address'], + incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.block_time')] ) }} -{% set incremental_interval = '7' %} WITH bnb_usd AS ( @@ -22,8 +22,8 @@ WITH WHERE symbol = 'BNB' {% if is_incremental() %} - AND minute >= date_trunc('day', now() - interval '{{incremental_interval}}' day) - {% endif %} + AND {{ incremental_predicate('minute') }} + {% endif %} ), fm_reverted_transactions AS ( SELECT @@ -42,8 +42,8 @@ WITH WHERE success = false {% if is_incremental() %} - AND tx.block_time >= date_trunc('day', now() - interval '{{incremental_interval}}' day) - {% endif %} + AND {{ incremental_predicate('tx.block_time') }} + {% endif %} GROUP BY tx.hash, tx.index, diff --git a/daily_spellbook/models/chainlink/bnb/chainlink_bnb_fm_reward_daily.sql b/daily_spellbook/models/chainlink/bnb/chainlink_bnb_fm_reward_daily.sql index 9832e754b2c..a483c1505d0 100644 --- a/daily_spellbook/models/chainlink/bnb/chainlink_bnb_fm_reward_daily.sql +++ b/daily_spellbook/models/chainlink/bnb/chainlink_bnb_fm_reward_daily.sql @@ -1,6 +1,6 @@ {{ config( - + alias='fm_reward_daily', partition_by = ['date_month'], materialized = 'incremental', @@ -10,7 +10,6 @@ ) }} -{% set incremental_interval = '7' %} WITH admin_address_meta as ( @@ -28,8 +27,8 @@ WITH WHERE price.symbol = 'LINK' {% if is_incremental() %} - AND price.minute >= date_trunc('day', now() - interval '{{incremental_interval}}' day) - {% endif %} + AND {{ incremental_predicate('price.minute') }} + {% endif %} GROUP BY 1 ORDER BY @@ -77,16 +76,16 @@ WITH 1, 2 ), fm_reward_daily AS ( - SELECT + SELECT payment_meta.date_start, cast(date_trunc('month', payment_meta.date_start) as date) as date_month, payment_meta.admin_address, - ocr_operator_admin_meta.operator_name, + ocr_operator_admin_meta.operator_name, COALESCE(fm_reward_evt_transfer_daily.token_amount / EXTRACT(DAY FROM next_payment_date - prev_payment_date), 0) as token_amount, (COALESCE(fm_reward_evt_transfer_daily.token_amount / EXTRACT(DAY FROM next_payment_date - prev_payment_date), 0) * payment_meta.usd_amount) as usd_amount - FROM + FROM payment_meta - LEFT JOIN + LEFT JOIN {{ref('chainlink_bnb_fm_reward_evt_transfer_daily')}} fm_reward_evt_transfer_daily ON payment_meta.next_payment_date = fm_reward_evt_transfer_daily.date_start AND payment_meta.admin_address = fm_reward_evt_transfer_daily.admin_address @@ -101,7 +100,7 @@ SELECT operator_name, token_amount, usd_amount -FROM +FROM fm_reward_daily ORDER BY 2, 4 diff --git a/daily_spellbook/models/chainlink/bnb/chainlink_bnb_fm_reward_evt_transfer_daily.sql b/daily_spellbook/models/chainlink/bnb/chainlink_bnb_fm_reward_evt_transfer_daily.sql index cad6f527eb3..ff44f616340 100644 --- a/daily_spellbook/models/chainlink/bnb/chainlink_bnb_fm_reward_evt_transfer_daily.sql +++ b/daily_spellbook/models/chainlink/bnb/chainlink_bnb_fm_reward_evt_transfer_daily.sql @@ -1,6 +1,6 @@ {{ config( - + alias='fm_reward_evt_transfer_daily', partition_by=['date_month'], materialized='incremental', @@ -10,7 +10,6 @@ ) }} -{% set incremental_interval = '7' %} SELECT 'bnb' as blockchain, @@ -23,8 +22,8 @@ FROM {{ref('chainlink_bnb_fm_reward_evt_transfer')}} fm_reward_evt_transfer LEFT JOIN {{ ref('chainlink_bnb_ocr_operator_admin_meta') }} fm_operator_admin_meta ON fm_operator_admin_meta.admin_address = fm_reward_evt_transfer.admin_address {% if is_incremental() %} - WHERE evt_block_time >= date_trunc('day', now() - interval '{{incremental_interval}}' day) -{% endif %} + WHERE {{ incremental_predicate('evt_block_time') }} +{% endif %} GROUP BY 2, 4 ORDER BY diff --git a/daily_spellbook/models/chainlink/bnb/chainlink_bnb_ocr_fulfilled_transactions.sql b/daily_spellbook/models/chainlink/bnb/chainlink_bnb_ocr_fulfilled_transactions.sql index 6e01dd2d5b2..dbfc5d9761f 100644 --- a/daily_spellbook/models/chainlink/bnb/chainlink_bnb_ocr_fulfilled_transactions.sql +++ b/daily_spellbook/models/chainlink/bnb/chainlink_bnb_ocr_fulfilled_transactions.sql @@ -1,12 +1,13 @@ {{ config( - + alias='ocr_fulfilled_transactions', partition_by=['date_month'], materialized='incremental', file_format='delta', incremental_strategy='merge', unique_key=['tx_hash', 'tx_index', 'node_address'], + incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.block_time')], post_hook='{{ expose_spells(\'["bnb"]\', "project", "chainlink", @@ -14,7 +15,6 @@ ) }} -{% set incremental_interval = '7' %} WITH bnb_usd AS ( @@ -26,8 +26,8 @@ WITH WHERE symbol = 'BNB' {% if is_incremental() %} - AND minute >= date_trunc('day', now() - interval '{{incremental_interval}}' day) - {% endif %} + AND {{ incremental_predicate('minute') }} + {% endif %} ), ocr_fulfilled_transactions AS ( SELECT @@ -43,8 +43,8 @@ WITH RIGHT JOIN {{ ref('chainlink_bnb_ocr_gas_transmission_logs') }} ocr_gas_transmission_logs ON ocr_gas_transmission_logs.tx_hash = tx.hash LEFT JOIN bnb_usd ON date_trunc('minute', tx.block_time) = bnb_usd.block_time {% if is_incremental() %} - WHERE tx.block_time >= date_trunc('day', now() - interval '{{incremental_interval}}' day) - {% endif %} + WHERE {{ incremental_predicate('tx.block_time') }} + {% endif %} GROUP BY tx.hash, tx.index, diff --git a/daily_spellbook/models/chainlink/bnb/chainlink_bnb_ocr_gas_daily.sql b/daily_spellbook/models/chainlink/bnb/chainlink_bnb_ocr_gas_daily.sql index 61662348e1a..c1220b91052 100644 --- a/daily_spellbook/models/chainlink/bnb/chainlink_bnb_ocr_gas_daily.sql +++ b/daily_spellbook/models/chainlink/bnb/chainlink_bnb_ocr_gas_daily.sql @@ -1,6 +1,6 @@ {{ config( - + alias='ocr_gas_daily', partition_by=['date_month'], materialized='incremental', @@ -14,7 +14,6 @@ ) }} -{% set incremental_interval = '7' %} {% set truncate_by = 'day' %} WITH @@ -28,7 +27,7 @@ WITH {{ ref('chainlink_bnb_ocr_fulfilled_transactions') }} fulfilled {% if is_incremental() %} WHERE - fulfilled.block_time >= date_trunc('day', now() - interval '{{incremental_interval}}' day) + {{ incremental_predicate('fulfilled.block_time') }} {% endif %} GROUP BY 1, 2 @@ -45,7 +44,7 @@ WITH {{ ref('chainlink_bnb_ocr_reverted_transactions') }} reverted {% if is_incremental() %} WHERE - reverted.block_time >= date_trunc('day', now() - interval '{{incremental_interval}}' day) + {{ incremental_predicate('reverted.block_time') }} {% endif %} GROUP BY 1, 2 @@ -57,7 +56,7 @@ WITH COALESCE( fulfilled.date_start, reverted.date_start - ) AS "date_start", + ) AS "date_start", COALESCE( fulfilled.node_address, reverted.node_address @@ -90,7 +89,7 @@ WITH FROM ocr_gas_daily_meta LEFT JOIN {{ ref('chainlink_bnb_ocr_operator_node_meta') }} ocr_operator_node_meta ON ocr_operator_node_meta.node_address = ocr_gas_daily_meta.node_address ) -SELECT +SELECT blockchain, date_start, date_month, @@ -101,7 +100,7 @@ SELECT reverted_token_amount, reverted_usd_amount, total_token_amount, - total_usd_amount + total_usd_amount FROM ocr_gas_daily ORDER BY diff --git a/daily_spellbook/models/chainlink/bnb/chainlink_bnb_ocr_request_daily.sql b/daily_spellbook/models/chainlink/bnb/chainlink_bnb_ocr_request_daily.sql index 2f36ba08638..1361090a653 100644 --- a/daily_spellbook/models/chainlink/bnb/chainlink_bnb_ocr_request_daily.sql +++ b/daily_spellbook/models/chainlink/bnb/chainlink_bnb_ocr_request_daily.sql @@ -1,6 +1,6 @@ {{ config( - + alias='ocr_request_daily', partition_by=['date_month'], materialized='incremental', @@ -14,7 +14,6 @@ ) }} -{% set incremental_interval = '7' %} {% set truncate_by = 'day' %} WITH @@ -23,7 +22,7 @@ WITH COALESCE( cast(date_trunc('{{truncate_by}}', fulfilled.block_time) as date), cast(date_trunc('{{truncate_by}}', reverted.block_time) as date) - ) AS "date_start", + ) AS "date_start", COALESCE( fulfilled.node_address, reverted.node_address @@ -38,8 +37,8 @@ WITH reverted.node_address = fulfilled.node_address {% if is_incremental() %} WHERE - fulfilled.block_time >= date_trunc('day', now() - interval '{{incremental_interval}}' day) - OR reverted.block_time >= date_trunc('day', now() - interval '{{incremental_interval}}' day) + {{ incremental_predicate('fulfilled.block_time') }} + OR {{ incremental_predicate('reverted.block_time') }} {% endif %} GROUP BY 1, 2 @@ -59,7 +58,7 @@ WITH FROM ocr_request_daily_meta LEFT JOIN {{ ref('chainlink_bnb_ocr_operator_node_meta') }} ocr_operator_node_meta ON ocr_operator_node_meta.node_address = ocr_request_daily_meta.node_address ) -SELECT +SELECT blockchain, date_start, date_month, diff --git a/daily_spellbook/models/chainlink/bnb/chainlink_bnb_ocr_reverted_transactions.sql b/daily_spellbook/models/chainlink/bnb/chainlink_bnb_ocr_reverted_transactions.sql index d0e41c7ee62..953501e8dc5 100644 --- a/daily_spellbook/models/chainlink/bnb/chainlink_bnb_ocr_reverted_transactions.sql +++ b/daily_spellbook/models/chainlink/bnb/chainlink_bnb_ocr_reverted_transactions.sql @@ -1,12 +1,13 @@ {{ config( - + alias='ocr_reverted_transactions', partition_by=['date_month'], materialized='incremental', file_format='delta', incremental_strategy='merge', unique_key=['tx_hash', 'tx_index', 'node_address'], + incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.block_time')], post_hook='{{ expose_spells(\'["bnb"]\', "project", "chainlink", @@ -14,7 +15,6 @@ ) }} -{% set incremental_interval = '7' %} WITH bnb_usd AS ( @@ -26,8 +26,8 @@ WITH WHERE symbol = 'BNB' {% if is_incremental() %} - AND minute >= date_trunc('day', now() - interval '{{incremental_interval}}' day) - {% endif %} + AND {{ incremental_predicate('minute') }} + {% endif %} ), ocr_reverted_transactions AS ( SELECT @@ -44,8 +44,8 @@ WITH WHERE success = false {% if is_incremental() %} - AND tx.block_time >= date_trunc('day', now() - interval '{{incremental_interval}}' day) - {% endif %} + AND {{ incremental_predicate('tx.block_time') }} + {% endif %} GROUP BY tx.hash, tx.index, diff --git a/daily_spellbook/models/chainlink/bnb/chainlink_bnb_ocr_reward_daily.sql b/daily_spellbook/models/chainlink/bnb/chainlink_bnb_ocr_reward_daily.sql index e4249f1051b..62ddbfd2404 100644 --- a/daily_spellbook/models/chainlink/bnb/chainlink_bnb_ocr_reward_daily.sql +++ b/daily_spellbook/models/chainlink/bnb/chainlink_bnb_ocr_reward_daily.sql @@ -1,6 +1,6 @@ {{ config( - + alias='ocr_reward_daily', partition_by = ['date_month'], materialized = 'incremental', @@ -14,7 +14,6 @@ ) }} -{% set incremental_interval = '7' %} WITH admin_address_meta as ( @@ -32,8 +31,8 @@ WITH WHERE price.symbol = 'LINK' {% if is_incremental() %} - AND price.minute >= date_trunc('day', now() - interval '{{incremental_interval}}' day) - {% endif %} + AND {{ incremental_predicate('price.minute') }} + {% endif %} GROUP BY 1 ORDER BY @@ -81,16 +80,16 @@ WITH 1, 2 ), ocr_reward_daily AS ( - SELECT + SELECT payment_meta.date_start, cast(date_trunc('month', payment_meta.date_start) as date) as date_month, payment_meta.admin_address, - ocr_operator_admin_meta.operator_name, + ocr_operator_admin_meta.operator_name, COALESCE(ocr_reward_evt_transfer_daily.token_amount / EXTRACT(DAY FROM next_payment_date - prev_payment_date), 0) as token_amount, (COALESCE(ocr_reward_evt_transfer_daily.token_amount / EXTRACT(DAY FROM next_payment_date - prev_payment_date), 0) * payment_meta.usd_amount) as usd_amount - FROM + FROM payment_meta - LEFT JOIN + LEFT JOIN {{ref('chainlink_bnb_ocr_reward_evt_transfer_daily')}} ocr_reward_evt_transfer_daily ON payment_meta.next_payment_date = ocr_reward_evt_transfer_daily.date_start AND payment_meta.admin_address = ocr_reward_evt_transfer_daily.admin_address @@ -105,7 +104,7 @@ SELECT operator_name, token_amount, usd_amount -FROM +FROM ocr_reward_daily ORDER BY 2, 4 diff --git a/daily_spellbook/models/chainlink/bnb/chainlink_bnb_ocr_reward_evt_transfer_daily.sql b/daily_spellbook/models/chainlink/bnb/chainlink_bnb_ocr_reward_evt_transfer_daily.sql index 6aa5d099b31..5e740f12ef2 100644 --- a/daily_spellbook/models/chainlink/bnb/chainlink_bnb_ocr_reward_evt_transfer_daily.sql +++ b/daily_spellbook/models/chainlink/bnb/chainlink_bnb_ocr_reward_evt_transfer_daily.sql @@ -1,6 +1,6 @@ {{ config( - + alias='ocr_reward_evt_transfer_daily', partition_by=['date_month'], materialized='incremental', @@ -14,7 +14,6 @@ ) }} -{% set incremental_interval = '7' %} SELECT 'bnb' as blockchain, @@ -27,8 +26,8 @@ FROM {{ref('chainlink_bnb_ocr_reward_evt_transfer')}} ocr_reward_evt_transfer LEFT JOIN {{ ref('chainlink_bnb_ocr_operator_admin_meta') }} ocr_operator_admin_meta ON ocr_operator_admin_meta.admin_address = ocr_reward_evt_transfer.admin_address {% if is_incremental() %} - WHERE evt_block_time >= date_trunc('day', now() - interval '{{incremental_interval}}' day) -{% endif %} + WHERE {{ incremental_predicate('evt_block_time') }} +{% endif %} GROUP BY 2, 4 ORDER BY diff --git a/daily_spellbook/models/chainlink/bnb/chainlink_bnb_price_feeds.sql b/daily_spellbook/models/chainlink/bnb/chainlink_bnb_price_feeds.sql index 49f1e6b30a7..f6e2b0f7df8 100644 --- a/daily_spellbook/models/chainlink/bnb/chainlink_bnb_price_feeds.sql +++ b/daily_spellbook/models/chainlink/bnb/chainlink_bnb_price_feeds.sql @@ -1,6 +1,6 @@ {{ config( - + alias='price_feeds', partition_by=['block_month'], materialized='incremental', @@ -14,7 +14,6 @@ ) }} -{% set incremental_interval = '7' %} {% set project_start_date = '2020-08-29' %} SELECT 'bnb' as blockchain, @@ -27,11 +26,11 @@ SELECT 'bnb' as blockchain, c.proxy_address, c.aggregator_address, c.oracle_price / POWER(10, 0) as underlying_token_price, - CASE + CASE WHEN cardinality(split(c.feed_name, ' / ')) = 1 THEN c.feed_name ELSE element_at(split(c.feed_name, ' / '), 1) END AS base, - CASE + CASE WHEN cardinality(split(c.feed_name, ' / ')) = 1 THEN NULL ELSE element_at(split(c.feed_name, ' / '), 2) END AS quote @@ -39,14 +38,14 @@ FROM ( SELECT l.block_time, - cast(date_trunc('day', l.block_time) as date) as block_date, - cast(date_trunc('month', l.block_time) as date) as block_month, + cast(date_trunc('day', l.block_time) as date) as block_date, + cast(date_trunc('month', l.block_time) as date) as block_month, l.block_number, cfa.feed_name, cfa.proxy_address, MAX(cfa.aggregator_address) as aggregator_address, AVG( - CAST(bytearray_to_uint256(bytearray_substring(l.topic1, 3, 64)) as DOUBLE) + CAST(bytearray_to_uint256(bytearray_substring(l.topic1, 3, 64)) as DOUBLE) / POWER(10, cfa.decimals) ) as oracle_price FROM @@ -56,10 +55,10 @@ FROM WHERE l.topic0 = 0x0559884fd3a460db3073b7fc896cc77986f16e378210ded43186175bf646fc5f {% if not is_incremental() %} - AND l.block_time >= cast('{{project_start_date}}' as date) + AND l.block_time >= cast('{{project_start_date}}' as date) {% endif %} {% if is_incremental() %} - AND l.block_time >= date_trunc('day', now() - interval '{{incremental_interval}}' day) + AND {{ incremental_predicate('l.block_time') }} {% endif %} GROUP BY 1, 2, 3, 4, 5, 6 diff --git a/daily_spellbook/models/chainlink/bnb/chainlink_bnb_price_feeds_hourly.sql b/daily_spellbook/models/chainlink/bnb/chainlink_bnb_price_feeds_hourly.sql index 43a5a33bc5a..6cac7c5ea85 100644 --- a/daily_spellbook/models/chainlink/bnb/chainlink_bnb_price_feeds_hourly.sql +++ b/daily_spellbook/models/chainlink/bnb/chainlink_bnb_price_feeds_hourly.sql @@ -1,6 +1,6 @@ {{ config( - + alias='price_feeds_hourly', partition_by=['block_month'], materialized='incremental', @@ -11,7 +11,6 @@ ) }} -{% set incremental_interval = '7' %} {% set project_start_date = '2019-10-01' %} WITH hourly_sequence_meta AS ( @@ -25,7 +24,7 @@ WITH hourly_sequence_meta AS ( AND price.minute >= timestamp '{{project_start_date}}' {% endif %} {% if is_incremental() %} - AND price.minute >= date_trunc('hour', now() - interval '{{incremental_interval}}' day) + AND {{ incremental_predicate('price.minute') }} {% endif %} GROUP BY 1 @@ -70,7 +69,7 @@ aggregated_price_feeds AS ( hourly_sequence.hr >= timestamp '{{project_start_date}}' {% endif %} {% if is_incremental() %} - hourly_sequence.hr >= date_trunc('hour', now() - interval '{{incremental_interval}}' day) + {{ incremental_predicate('hourly_sequence.hr') }} {% endif %} GROUP BY hourly_sequence.hr, hourly_sequence.feed_name, hourly_sequence.proxy_address, hourly_sequence.aggregator_address diff --git a/daily_spellbook/models/chainlink/bnb/chainlink_bnb_vrf_fulfilled_transactions.sql b/daily_spellbook/models/chainlink/bnb/chainlink_bnb_vrf_fulfilled_transactions.sql index 2706d2148fe..cffd014cf3f 100644 --- a/daily_spellbook/models/chainlink/bnb/chainlink_bnb_vrf_fulfilled_transactions.sql +++ b/daily_spellbook/models/chainlink/bnb/chainlink_bnb_vrf_fulfilled_transactions.sql @@ -1,12 +1,13 @@ {{ config( - + alias='vrf_fulfilled_transactions', partition_by=['date_month'], materialized='incremental', file_format='delta', incremental_strategy='merge', - unique_key=['tx_hash', 'tx_index', 'node_address'] + unique_key=['tx_hash', 'tx_index', 'node_address'], + incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.block_time')] ) }} @@ -22,7 +23,7 @@ WITH {% if is_incremental() %} AND {{ incremental_predicate('minute') }} - {% endif %} + {% endif %} ), vrf_fulfilled_transactions AS ( SELECT @@ -39,14 +40,14 @@ WITH {{ source('bnb', 'transactions') }} tx RIGHT JOIN {{ ref('chainlink_bnb_vrf_v1_random_fulfilled_logs') }} vrf_v1_logs ON vrf_v1_logs.tx_hash = tx.hash {% if is_incremental() %} - AND + AND {{ incremental_predicate('tx.block_time') }} {% endif %} LEFT JOIN bnb_usd ON date_trunc('minute', tx.block_time) = bnb_usd.block_time {% if is_incremental() %} WHERE {{ incremental_predicate('tx.block_time') }} - {% endif %} + {% endif %} GROUP BY tx.hash, tx.index, @@ -75,7 +76,7 @@ WITH {% if is_incremental() %} WHERE {{ incremental_predicate('tx.block_time') }} - {% endif %} + {% endif %} GROUP BY tx.hash, tx.index, diff --git a/daily_spellbook/models/chainlink/bnb/chainlink_bnb_vrf_gas_daily.sql b/daily_spellbook/models/chainlink/bnb/chainlink_bnb_vrf_gas_daily.sql index 5a5a13f7280..95caeb2477b 100644 --- a/daily_spellbook/models/chainlink/bnb/chainlink_bnb_vrf_gas_daily.sql +++ b/daily_spellbook/models/chainlink/bnb/chainlink_bnb_vrf_gas_daily.sql @@ -1,6 +1,6 @@ {{ config( - + alias='vrf_gas_daily', partition_by=['date_month'], materialized='incremental', @@ -10,7 +10,6 @@ ) }} -{% set incremental_interval = '7' %} {% set truncate_by = 'day' %} WITH @@ -24,7 +23,7 @@ WITH {{ ref('chainlink_bnb_vrf_fulfilled_transactions') }} fulfilled {% if is_incremental() %} WHERE - fulfilled.block_time >= date_trunc('day', now() - interval '{{incremental_interval}}' day) + {{ incremental_predicate('fulfilled.block_time') }} {% endif %} GROUP BY 1, 2 @@ -41,7 +40,7 @@ WITH {{ ref('chainlink_bnb_vrf_reverted_transactions') }} reverted {% if is_incremental() %} WHERE - reverted.block_time >= date_trunc('day', now() - interval '{{incremental_interval}}' day) + {{ incremental_predicate('reverted.block_time') }} {% endif %} GROUP BY 1, 2 @@ -53,7 +52,7 @@ WITH COALESCE( fulfilled.date_start, reverted.date_start - ) AS "date_start", + ) AS "date_start", COALESCE( fulfilled.node_address, reverted.node_address @@ -84,7 +83,7 @@ WITH fulfilled_usd_amount + reverted_usd_amount as total_usd_amount FROM vrf_gas_daily_meta ) -SELECT +SELECT blockchain, date_start, date_month, @@ -94,7 +93,7 @@ SELECT reverted_token_amount, reverted_usd_amount, total_token_amount, - total_usd_amount + total_usd_amount FROM vrf_gas_daily ORDER BY diff --git a/daily_spellbook/models/chainlink/bnb/chainlink_bnb_vrf_request_daily.sql b/daily_spellbook/models/chainlink/bnb/chainlink_bnb_vrf_request_daily.sql index 5e3918a5b0c..e0e7ba4a31c 100644 --- a/daily_spellbook/models/chainlink/bnb/chainlink_bnb_vrf_request_daily.sql +++ b/daily_spellbook/models/chainlink/bnb/chainlink_bnb_vrf_request_daily.sql @@ -1,6 +1,6 @@ {{ config( - + alias='vrf_request_daily', partition_by=['date_month'], materialized='incremental', @@ -10,7 +10,6 @@ ) }} -{% set incremental_interval = '7' %} {% set truncate_by = 'day' %} WITH @@ -19,7 +18,7 @@ WITH COALESCE( cast(date_trunc('{{truncate_by}}', fulfilled.block_time) as date), cast(date_trunc('{{truncate_by}}', reverted.block_time) as date) - ) AS "date_start", + ) AS "date_start", COALESCE( fulfilled.node_address, reverted.node_address @@ -34,8 +33,8 @@ WITH reverted.node_address = fulfilled.node_address {% if is_incremental() %} WHERE - fulfilled.block_time >= date_trunc('day', now() - interval '{{incremental_interval}}' day) - AND reverted.block_time >= date_trunc('day', now() - interval '{{incremental_interval}}' day) + {{ incremental_predicate('fulfilled.block_time') }} + AND {{ incremental_predicate('reverted.block_time') }} {% endif %} GROUP BY 1, 2 @@ -53,7 +52,7 @@ WITH total_requests FROM vrf_request_daily_meta ) -SELECT +SELECT blockchain, date_start, date_month, diff --git a/daily_spellbook/models/chainlink/bnb/chainlink_bnb_vrf_request_fulfilled_daily.sql b/daily_spellbook/models/chainlink/bnb/chainlink_bnb_vrf_request_fulfilled_daily.sql index 95e384b574b..46714e3ecb3 100644 --- a/daily_spellbook/models/chainlink/bnb/chainlink_bnb_vrf_request_fulfilled_daily.sql +++ b/daily_spellbook/models/chainlink/bnb/chainlink_bnb_vrf_request_fulfilled_daily.sql @@ -1,6 +1,6 @@ {{ config( - + alias='vrf_request_fulfilled_daily', partition_by=['date_month'], materialized='incremental', @@ -10,7 +10,6 @@ ) }} -{% set incremental_interval = '7' %} SELECT 'bnb' as blockchain, @@ -21,8 +20,8 @@ SELECT FROM {{ref('chainlink_bnb_vrf_request_fulfilled')}} vrf_request_fulfilled {% if is_incremental() %} - WHERE evt_block_time >= date_trunc('day', now() - interval '{{incremental_interval}}' day) -{% endif %} + WHERE {{ incremental_predicate('evt_block_time') }} +{% endif %} GROUP BY 2, 4 ORDER BY diff --git a/daily_spellbook/models/chainlink/bnb/chainlink_bnb_vrf_reverted_transactions.sql b/daily_spellbook/models/chainlink/bnb/chainlink_bnb_vrf_reverted_transactions.sql index d23439937e0..e822392f482 100644 --- a/daily_spellbook/models/chainlink/bnb/chainlink_bnb_vrf_reverted_transactions.sql +++ b/daily_spellbook/models/chainlink/bnb/chainlink_bnb_vrf_reverted_transactions.sql @@ -1,16 +1,16 @@ {{ config( - + alias='vrf_reverted_transactions', partition_by=['date_month'], materialized='incremental', file_format='delta', incremental_strategy='merge', - unique_key=['tx_hash', 'tx_index', 'node_address'] + unique_key=['tx_hash', 'tx_index', 'node_address'], + incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.block_time')] ) }} -{% set incremental_interval = '7' %} WITH bnb_usd AS ( @@ -22,8 +22,8 @@ WITH WHERE symbol = 'BNB' {% if is_incremental() %} - AND minute >= date_trunc('day', now() - interval '{{incremental_interval}}' day) - {% endif %} + AND {{ incremental_predicate('minute') }} + {% endif %} ), vrf_reverted_transactions AS ( SELECT @@ -42,8 +42,8 @@ WITH WHERE success = false {% if is_incremental() %} - AND tx.block_time >= date_trunc('day', now() - interval '{{incremental_interval}}' day) - {% endif %} + AND {{ incremental_predicate('tx.block_time') }} + {% endif %} GROUP BY tx.hash, tx.index, diff --git a/daily_spellbook/models/chainlink/bnb/chainlink_bnb_vrf_reward_daily.sql b/daily_spellbook/models/chainlink/bnb/chainlink_bnb_vrf_reward_daily.sql index f67fa0bdf7f..0e0e0a3ea44 100644 --- a/daily_spellbook/models/chainlink/bnb/chainlink_bnb_vrf_reward_daily.sql +++ b/daily_spellbook/models/chainlink/bnb/chainlink_bnb_vrf_reward_daily.sql @@ -1,6 +1,6 @@ {{ config( - + alias='vrf_reward_daily', partition_by = ['date_month'], materialized = 'incremental', @@ -10,7 +10,6 @@ ) }} -{% set incremental_interval = '7' %} WITH link_usd_daily AS ( @@ -20,20 +19,20 @@ WITH FROM {{ source('prices', 'usd') }} price WHERE - price.symbol = 'LINK' + price.symbol = 'LINK' GROUP BY 1 ORDER BY 1 ), vrf_reward_daily AS ( - SELECT + SELECT vrf_daily.date_start, cast(date_trunc('month', vrf_daily.date_start) as date) as date_month, - vrf_daily.operator_address, + vrf_daily.operator_address, COALESCE(vrf_daily.token_amount, 0) as token_amount, COALESCE(vrf_daily.token_amount * lud.usd_amount, 0) as usd_amount - FROM + FROM {{ref('chainlink_bnb_vrf_request_fulfilled_daily')}} vrf_daily LEFT JOIN link_usd_daily lud ON lud.date_start = vrf_daily.date_start ORDER BY date_start @@ -45,7 +44,7 @@ SELECT operator_address, token_amount, usd_amount -FROM +FROM vrf_reward_daily ORDER BY 2, 4 diff --git a/daily_spellbook/models/chainlink/ethereum/chainlink_ethereum_automation_fulfilled_transactions.sql b/daily_spellbook/models/chainlink/ethereum/chainlink_ethereum_automation_fulfilled_transactions.sql index e61fc591dba..03738ce3686 100644 --- a/daily_spellbook/models/chainlink/ethereum/chainlink_ethereum_automation_fulfilled_transactions.sql +++ b/daily_spellbook/models/chainlink/ethereum/chainlink_ethereum_automation_fulfilled_transactions.sql @@ -1,16 +1,16 @@ {{ config( - + alias='automation_fulfilled_transactions', partition_by=['date_month'], materialized='incremental', file_format='delta', incremental_strategy='merge', - unique_key=['tx_hash', 'tx_index', 'node_address'] + unique_key=['tx_hash', 'tx_index', 'node_address'], + incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.block_time')] ) }} -{% set incremental_interval = '7' %} WITH ethereum_usd AS ( @@ -22,8 +22,8 @@ WITH WHERE symbol = 'ETH' {% if is_incremental() %} - AND minute >= date_trunc('day', now() - interval '{{incremental_interval}}' day) - {% endif %} + AND {{ incremental_predicate('minute') }} + {% endif %} ), automation_fulfilled_transactions AS ( SELECT @@ -38,12 +38,12 @@ WITH {{ source('ethereum', 'transactions') }} tx RIGHT JOIN {{ ref('chainlink_ethereum_automation_upkeep_performed_logs') }} automation_upkeep_performed_logs ON automation_upkeep_performed_logs.tx_hash = tx.hash {% if is_incremental() %} - AND automation_upkeep_performed_logs.block_time >= date_trunc('day', now() - interval '{{incremental_interval}}' day) + AND {{ incremental_predicate('automation_upkeep_performed_logs.block_time') }} {% endif %} LEFT JOIN ethereum_usd ON date_trunc('minute', tx.block_time) = ethereum_usd.block_time {% if is_incremental() %} - WHERE tx.block_time >= date_trunc('day', now() - interval '{{incremental_interval}}' day) - {% endif %} + WHERE {{ incremental_predicate('tx.block_time') }} + {% endif %} GROUP BY tx.hash, tx.index, diff --git a/daily_spellbook/models/chainlink/ethereum/chainlink_ethereum_automation_gas_daily.sql b/daily_spellbook/models/chainlink/ethereum/chainlink_ethereum_automation_gas_daily.sql index 35205e72b31..449e096bb39 100644 --- a/daily_spellbook/models/chainlink/ethereum/chainlink_ethereum_automation_gas_daily.sql +++ b/daily_spellbook/models/chainlink/ethereum/chainlink_ethereum_automation_gas_daily.sql @@ -1,6 +1,6 @@ {{ config( - + alias='automation_gas_daily', partition_by=['date_month'], materialized='incremental', @@ -10,7 +10,6 @@ ) }} -{% set incremental_interval = '7' %} {% set truncate_by = 'day' %} WITH @@ -24,7 +23,7 @@ WITH {{ ref('chainlink_ethereum_automation_fulfilled_transactions') }} fulfilled {% if is_incremental() %} WHERE - fulfilled.block_time >= date_trunc('day', now() - interval '{{incremental_interval}}' day) + {{ incremental_predicate('fulfilled.block_time') }} {% endif %} GROUP BY 1, 2 @@ -41,7 +40,7 @@ WITH {{ ref('chainlink_ethereum_automation_reverted_transactions') }} reverted {% if is_incremental() %} WHERE - reverted.block_time >= date_trunc('day', now() - interval '{{incremental_interval}}' day) + {{ incremental_predicate('reverted.block_time') }} {% endif %} GROUP BY 1, 2 @@ -53,7 +52,7 @@ WITH COALESCE( fulfilled.date_start, reverted.date_start - ) AS "date_start", + ) AS "date_start", COALESCE( fulfilled.node_address, reverted.node_address @@ -86,7 +85,7 @@ WITH FROM automation_gas_daily_meta LEFT JOIN {{ ref('chainlink_ethereum_automation_meta') }} automation_meta ON automation_meta.keeper_address = automation_gas_daily_meta.node_address ) -SELECT +SELECT blockchain, date_start, date_month, @@ -97,7 +96,7 @@ SELECT reverted_token_amount, reverted_usd_amount, total_token_amount, - total_usd_amount + total_usd_amount FROM automation_gas_daily ORDER BY diff --git a/daily_spellbook/models/chainlink/ethereum/chainlink_ethereum_automation_performed_daily.sql b/daily_spellbook/models/chainlink/ethereum/chainlink_ethereum_automation_performed_daily.sql index facf043d96b..a2a19fa6572 100644 --- a/daily_spellbook/models/chainlink/ethereum/chainlink_ethereum_automation_performed_daily.sql +++ b/daily_spellbook/models/chainlink/ethereum/chainlink_ethereum_automation_performed_daily.sql @@ -1,16 +1,16 @@ {{ config( - + alias='automation_performed_daily', partition_by=['date_month'], materialized='incremental', file_format='delta', incremental_strategy='merge', - unique_key=['date_start', 'keeper_address'] + unique_key=['date_start', 'keeper_address'], + incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.date_month')] ) }} -{% set incremental_interval = '7' %} SELECT 'ethereum' as blockchain, @@ -22,8 +22,8 @@ SELECT FROM {{ref('chainlink_ethereum_automation_performed')}} automation_performed {% if is_incremental() %} - WHERE evt_block_time >= date_trunc('day', now() - interval '{{incremental_interval}}' day) -{% endif %} + WHERE {{ incremental_predicate('evt_block_time') }} +{% endif %} GROUP BY 2, 4 ORDER BY diff --git a/daily_spellbook/models/chainlink/ethereum/chainlink_ethereum_automation_request_daily.sql b/daily_spellbook/models/chainlink/ethereum/chainlink_ethereum_automation_request_daily.sql index 6e7f3fee78a..4ad70b2013f 100644 --- a/daily_spellbook/models/chainlink/ethereum/chainlink_ethereum_automation_request_daily.sql +++ b/daily_spellbook/models/chainlink/ethereum/chainlink_ethereum_automation_request_daily.sql @@ -1,6 +1,6 @@ {{ config( - + alias='automation_request_daily', partition_by=['date_month'], materialized='incremental', @@ -10,7 +10,6 @@ ) }} -{% set incremental_interval = '7' %} {% set truncate_by = 'day' %} WITH @@ -19,7 +18,7 @@ WITH COALESCE( cast(date_trunc('{{truncate_by}}', fulfilled.block_time) as date), cast(date_trunc('{{truncate_by}}', reverted.block_time) as date) - ) AS "date_start", + ) AS "date_start", COALESCE( fulfilled.node_address, reverted.node_address @@ -34,8 +33,8 @@ WITH reverted.node_address = fulfilled.node_address {% if is_incremental() %} WHERE - fulfilled.block_time >= date_trunc('day', now() - interval '{{incremental_interval}}' day) - OR reverted.block_time >= date_trunc('day', now() - interval '{{incremental_interval}}' day) + {{ incremental_predicate('fulfilled.block_time') }} + OR {{ incremental_predicate('reverted.block_time') }} {% endif %} GROUP BY 1, 2 @@ -53,7 +52,7 @@ WITH total_requests FROM automation_request_daily_meta ) -SELECT +SELECT automation_request_daily.blockchain, date_start, date_month, diff --git a/daily_spellbook/models/chainlink/ethereum/chainlink_ethereum_automation_reverted_transactions.sql b/daily_spellbook/models/chainlink/ethereum/chainlink_ethereum_automation_reverted_transactions.sql index 4d36212adc5..393fa6ce773 100644 --- a/daily_spellbook/models/chainlink/ethereum/chainlink_ethereum_automation_reverted_transactions.sql +++ b/daily_spellbook/models/chainlink/ethereum/chainlink_ethereum_automation_reverted_transactions.sql @@ -1,16 +1,16 @@ {{ config( - + alias='automation_reverted_transactions', partition_by=['date_month'], materialized='incremental', file_format='delta', incremental_strategy='merge', - unique_key=['tx_hash', 'tx_index', 'node_address'] + unique_key=['tx_hash', 'tx_index', 'node_address'], + incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.block_time')] ) }} -{% set incremental_interval = '7' %} WITH ethereum_usd AS ( @@ -22,8 +22,8 @@ WITH WHERE symbol = 'ETH' {% if is_incremental() %} - AND minute >= date_trunc('day', now() - interval '{{incremental_interval}}' day) - {% endif %} + AND {{ incremental_predicate('minute') }} + {% endif %} ), automation_reverted_transactions AS ( SELECT @@ -40,8 +40,8 @@ WITH WHERE success = false {% if is_incremental() %} - AND tx.block_time >= date_trunc('day', now() - interval '{{incremental_interval}}' day) - {% endif %} + AND {{ incremental_predicate('tx.block_time') }} + {% endif %} GROUP BY tx.hash, tx.index, diff --git a/daily_spellbook/models/chainlink/ethereum/chainlink_ethereum_automation_reward_daily.sql b/daily_spellbook/models/chainlink/ethereum/chainlink_ethereum_automation_reward_daily.sql index 0c0adb7dab1..6a759eb51ad 100644 --- a/daily_spellbook/models/chainlink/ethereum/chainlink_ethereum_automation_reward_daily.sql +++ b/daily_spellbook/models/chainlink/ethereum/chainlink_ethereum_automation_reward_daily.sql @@ -1,6 +1,6 @@ {{ config( - + alias='automation_reward_daily', partition_by = ['date_month'], materialized = 'incremental', @@ -10,7 +10,6 @@ ) }} -{% set incremental_interval = '7' %} WITH link_usd_daily AS ( @@ -20,21 +19,21 @@ WITH FROM {{ source('prices', 'usd') }} price WHERE - price.symbol = 'LINK' + price.symbol = 'LINK' GROUP BY 1 ORDER BY 1 ), automation_reward_daily AS ( - SELECT + SELECT automation_performed_daily.date_start, cast(date_trunc('month', automation_performed_daily.date_start) as date) as date_month, automation_performed_daily.operator_name, - automation_performed_daily.keeper_address, + automation_performed_daily.keeper_address, automation_performed_daily.token_amount as token_amount, (automation_performed_daily.token_amount * lud.usd_amount) as usd_amount - FROM + FROM {{ref('chainlink_ethereum_automation_performed_daily')}} automation_performed_daily LEFT JOIN link_usd_daily lud ON lud.date_start = automation_performed_daily.date_start ORDER BY date_start @@ -47,7 +46,7 @@ SELECT keeper_address, token_amount, usd_amount -FROM +FROM automation_reward_daily ORDER BY 2, 5 diff --git a/daily_spellbook/models/chainlink/ethereum/chainlink_ethereum_ccip_fulfilled_transactions.sql b/daily_spellbook/models/chainlink/ethereum/chainlink_ethereum_ccip_fulfilled_transactions.sql index 19a300c628f..8f594cf6926 100644 --- a/daily_spellbook/models/chainlink/ethereum/chainlink_ethereum_ccip_fulfilled_transactions.sql +++ b/daily_spellbook/models/chainlink/ethereum/chainlink_ethereum_ccip_fulfilled_transactions.sql @@ -8,7 +8,6 @@ ) }} -{% set incremental_interval = '7' %} WITH ccip_fulfilled_transactions AS ( @@ -23,12 +22,12 @@ WITH LEFT JOIN {{ source('ethereum', 'transactions') }} tx ON ccip_send_logs_v1.tx_hash = tx.hash {% if is_incremental() %} - AND tx.block_time >= date_trunc('day', now() - interval '{{incremental_interval}}' day) + AND {{ incremental_predicate('tx.block_time') }} {% endif %} WHERE tx.success = true {% if is_incremental() %} - AND ccip_send_logs_v1.block_time >= date_trunc('day', now() - interval '{{incremental_interval}}' day) + AND {{ incremental_predicate('ccip_send_logs_v1.block_time') }} {% endif %} UNION @@ -44,14 +43,14 @@ WITH LEFT JOIN {{ source('ethereum', 'transactions') }} tx ON ccip_send_logs_v1_2.tx_hash = tx.hash {% if is_incremental() %} - AND tx.block_time >= date_trunc('day', now() - interval '{{incremental_interval}}' day) + AND {{ incremental_predicate('tx.block_time') }} {% endif %} WHERE tx.success = true {% if is_incremental() %} - AND ccip_send_logs_v1_2.block_time >= date_trunc('day', now() - interval '{{incremental_interval}}' day) + AND {{ incremental_predicate('ccip_send_logs_v1_2.block_time') }} {% endif %} - + ) SELECT 'ethereum' as blockchain, diff --git a/daily_spellbook/models/chainlink/ethereum/chainlink_ethereum_ccip_gas_daily.sql b/daily_spellbook/models/chainlink/ethereum/chainlink_ethereum_ccip_gas_daily.sql index 6b4f831b978..60709a47f9c 100644 --- a/daily_spellbook/models/chainlink/ethereum/chainlink_ethereum_ccip_gas_daily.sql +++ b/daily_spellbook/models/chainlink/ethereum/chainlink_ethereum_ccip_gas_daily.sql @@ -1,6 +1,6 @@ {{ config( - + alias='ccip_gas_daily', partition_by=['date_month'], materialized='incremental', @@ -10,7 +10,6 @@ ) }} -{% set incremental_interval = '7' %} {% set truncate_by = 'day' %} WITH @@ -24,7 +23,7 @@ WITH {{ ref('chainlink_ethereum_ccip_transmitted_fulfilled') }} fulfilled {% if is_incremental() %} WHERE - fulfilled.block_time >= date_trunc('day', now() - interval '{{incremental_interval}}' day) + {{ incremental_predicate('fulfilled.block_time') }} {% endif %} GROUP BY 1, 2 @@ -41,7 +40,7 @@ WITH {{ ref('chainlink_ethereum_ccip_transmitted_reverted') }} reverted {% if is_incremental() %} WHERE - reverted.block_time >= date_trunc('day', now() - interval '{{incremental_interval}}' day) + {{ incremental_predicate('reverted.block_time') }} {% endif %} GROUP BY 1, 2 @@ -53,7 +52,7 @@ WITH COALESCE( fulfilled.date_start, reverted.date_start - ) AS "date_start", + ) AS "date_start", COALESCE( fulfilled.node_address, reverted.node_address @@ -86,7 +85,7 @@ WITH FROM ccip_gas_daily_meta LEFT JOIN {{ ref('chainlink_ethereum_ccip_operator_meta') }} ccip_operator_meta ON ccip_operator_meta.node_address = ccip_gas_daily_meta.node_address ) -SELECT +SELECT blockchain, date_start, date_month, @@ -97,7 +96,7 @@ SELECT reverted_token_amount, reverted_usd_amount, total_token_amount, - total_usd_amount + total_usd_amount FROM ccip_gas_daily ORDER BY diff --git a/daily_spellbook/models/chainlink/ethereum/chainlink_ethereum_ccip_nop_reward_daily.sql b/daily_spellbook/models/chainlink/ethereum/chainlink_ethereum_ccip_nop_reward_daily.sql index 713455721eb..62af3bbaf3e 100644 --- a/daily_spellbook/models/chainlink/ethereum/chainlink_ethereum_ccip_nop_reward_daily.sql +++ b/daily_spellbook/models/chainlink/ethereum/chainlink_ethereum_ccip_nop_reward_daily.sql @@ -1,6 +1,6 @@ {{ config( - + alias='ccip_nop_reward_daily', partition_by = ['date_month'], materialized = 'incremental', @@ -10,7 +10,6 @@ ) }} -{% set incremental_interval = '7' %} WITH link_usd_daily AS ( @@ -20,7 +19,7 @@ WITH FROM {{ source('prices', 'usd') }} price WHERE - price.symbol = 'LINK' + price.symbol = 'LINK' GROUP BY 1 ORDER BY @@ -38,22 +37,22 @@ FROM {{ref('chainlink_ethereum_ccip_nop_paid_logs')}} nop_logs LEFT JOIN {{ref('chainlink_ethereum_ccip_admin_meta')}} admin_meta ON admin_meta.admin_address = nop_logs.nop_address {% if is_incremental() %} - WHERE block_time >= date_trunc('day', now() - interval '{{incremental_interval}}' day) -{% endif %} + WHERE {{ incremental_predicate('block_time') }} +{% endif %} GROUP BY 2, 4 ORDER BY 2, 4 ), nop_reward_daily AS ( - SELECT + SELECT nop_paid.date_start, cast(date_trunc('month', nop_paid.date_start) as date) as date_month, nop_paid.operator_name, - nop_paid.nop_address, + nop_paid.nop_address, nop_paid.token_amount as token_amount, (nop_paid.token_amount * lud.usd_amount) as usd_amount - FROM + FROM nop_paid LEFT JOIN link_usd_daily lud ON lud.date_start = nop_paid.date_start ORDER BY date_start @@ -66,7 +65,7 @@ SELECT nop_address, token_amount, usd_amount -FROM +FROM nop_reward_daily ORDER BY 2, 5 diff --git a/daily_spellbook/models/chainlink/ethereum/chainlink_ethereum_ccip_request_daily.sql b/daily_spellbook/models/chainlink/ethereum/chainlink_ethereum_ccip_request_daily.sql index 9765b5d5e80..4ec3dadf622 100644 --- a/daily_spellbook/models/chainlink/ethereum/chainlink_ethereum_ccip_request_daily.sql +++ b/daily_spellbook/models/chainlink/ethereum/chainlink_ethereum_ccip_request_daily.sql @@ -9,7 +9,6 @@ ) }} -{% set incremental_interval = '7' %} WITH ethereum_agg AS ( @@ -23,7 +22,7 @@ ethereum_agg AS ( WHERE eth.date_start = date_series.date_start {% if is_incremental() %} - AND eth.block_time >= date_trunc('day', now() - interval '{{incremental_interval}}' day) + AND {{ incremental_predicate('eth.block_time') }} {% endif %} ) AS fulfilled_requests, ( @@ -34,7 +33,7 @@ ethereum_agg AS ( WHERE rev.date_start = date_series.date_start {% if is_incremental() %} - AND rev.block_time >= date_trunc('day', now() - interval '{{incremental_interval}}' day) + AND {{ incremental_predicate('rev.block_time') }} {% endif %} ) AS reverted_requests FROM @@ -52,7 +51,7 @@ ethereum_agg AS ( ) AS seq CROSS JOIN UNNEST (seq.date_sequence) AS t (date_start) {% if is_incremental() %} - WHERE date_start >= date_trunc('day', now() - interval '{{incremental_interval}}' day) + WHERE {{ incremental_predicate('date_start') }} {% endif %} ) date_series ), @@ -67,7 +66,7 @@ ethereum_agg AS ( FROM ethereum_agg ) -SELECT +SELECT ccip_request_daily.blockchain, date_start, date_month, diff --git a/daily_spellbook/models/chainlink/ethereum/chainlink_ethereum_ccip_reverted_transactions.sql b/daily_spellbook/models/chainlink/ethereum/chainlink_ethereum_ccip_reverted_transactions.sql index 8c33c2e7661..93e6a9e78b1 100644 --- a/daily_spellbook/models/chainlink/ethereum/chainlink_ethereum_ccip_reverted_transactions.sql +++ b/daily_spellbook/models/chainlink/ethereum/chainlink_ethereum_ccip_reverted_transactions.sql @@ -8,7 +8,6 @@ ) }} -{% set incremental_interval = '7' %} WITH ccip_reverted_transactions AS ( @@ -23,12 +22,12 @@ WITH LEFT JOIN {{ source('ethereum', 'transactions') }} tx ON ccip_send_logs_v1.tx_hash = tx.hash {% if is_incremental() %} - AND tx.block_time >= date_trunc('day', now() - interval '{{incremental_interval}}' day) + AND {{ incremental_predicate('tx.block_time') }} {% endif %} WHERE tx.success = false {% if is_incremental() %} - AND ccip_send_logs_v1.block_time >= date_trunc('day', now() - interval '{{incremental_interval}}' day) + AND {{ incremental_predicate('ccip_send_logs_v1.block_time') }} {% endif %} UNION @@ -44,14 +43,14 @@ WITH LEFT JOIN {{ source('ethereum', 'transactions') }} tx ON ccip_send_logs_v1_2.tx_hash = tx.hash {% if is_incremental() %} - AND tx.block_time >= date_trunc('day', now() - interval '{{incremental_interval}}' day) + AND {{ incremental_predicate('tx.block_time') }} {% endif %} WHERE tx.success = false {% if is_incremental() %} - AND ccip_send_logs_v1_2.block_time >= date_trunc('day', now() - interval '{{incremental_interval}}' day) + AND {{ incremental_predicate('ccip_send_logs_v1_2.block_time') }} {% endif %} - + ) SELECT 'ethereum' as blockchain, diff --git a/daily_spellbook/models/chainlink/ethereum/chainlink_ethereum_ccip_reward_daily.sql b/daily_spellbook/models/chainlink/ethereum/chainlink_ethereum_ccip_reward_daily.sql index 3f5029c0a1e..adbe079a870 100644 --- a/daily_spellbook/models/chainlink/ethereum/chainlink_ethereum_ccip_reward_daily.sql +++ b/daily_spellbook/models/chainlink/ethereum/chainlink_ethereum_ccip_reward_daily.sql @@ -9,7 +9,6 @@ ) }} -{% set incremental_interval = '7' %} WITH token_meta AS ( @@ -28,7 +27,7 @@ WITH {{ source('prices', 'usd') }} price JOIN token_meta ON price.symbol = token_meta.token_symbol {% if is_incremental() %} - WHERE price.minute >= date_trunc('day', now() - interval '{{incremental_interval}}' day) + WHERE {{ incremental_predicate('price.minute') }} {% endif %} GROUP BY 1, token_meta.token_symbol @@ -36,21 +35,21 @@ WITH 1 ), ccip_reward_daily AS ( - SELECT + SELECT ccip_send_requested_daily.date_start, - cast(date_trunc('month', ccip_send_requested_daily.date_start) as date) as date_month, + cast(date_trunc('month', ccip_send_requested_daily.date_start) as date) as date_month, SUM(ccip_send_requested_daily.fee_amount) as token_amount, SUM((ccip_send_requested_daily.fee_amount * tud.usd_amount)) as usd_amount, ccip_send_requested_daily.token as token - FROM + FROM {{ref('chainlink_ethereum_ccip_send_requested_daily')}} ccip_send_requested_daily LEFT JOIN token_usd_daily tud ON tud.date_start = ccip_send_requested_daily.date_start AND tud.symbol = ccip_send_requested_daily.token {% if is_incremental() %} - WHERE ccip_send_requested_daily.date_start >= date_trunc('day', now() - interval '{{incremental_interval}}' day) - {% endif %} + WHERE {{ incremental_predicate('ccip_send_requested_daily.date_start') }} + {% endif %} GROUP BY 1, 5 ) - + SELECT 'ethereum' as blockchain, date_start, @@ -58,7 +57,7 @@ SELECT token_amount, usd_amount, token -FROM +FROM ccip_reward_daily ORDER BY 2, 6 diff --git a/daily_spellbook/models/chainlink/ethereum/chainlink_ethereum_ccip_send_requested_daily.sql b/daily_spellbook/models/chainlink/ethereum/chainlink_ethereum_ccip_send_requested_daily.sql index 1e3a6f06563..6fe5657ac85 100644 --- a/daily_spellbook/models/chainlink/ethereum/chainlink_ethereum_ccip_send_requested_daily.sql +++ b/daily_spellbook/models/chainlink/ethereum/chainlink_ethereum_ccip_send_requested_daily.sql @@ -1,6 +1,6 @@ {{ config( - + alias='ccip_send_requested_daily', partition_by=['date_month'], materialized='incremental', @@ -10,7 +10,6 @@ ) }} -{% set incremental_interval = '7' %} SELECT 'ethereum' as blockchain, @@ -23,8 +22,8 @@ SELECT FROM {{ref('chainlink_ethereum_ccip_send_requested')}} ccip_send_requested {% if is_incremental() %} - WHERE evt_block_time >= date_trunc('day', now() - interval '{{incremental_interval}}' day) -{% endif %} + WHERE {{ incremental_predicate('evt_block_time') }} +{% endif %} GROUP BY 2, 5, 6 ORDER BY diff --git a/daily_spellbook/models/chainlink/ethereum/chainlink_ethereum_ccip_transmitted_fulfilled.sql b/daily_spellbook/models/chainlink/ethereum/chainlink_ethereum_ccip_transmitted_fulfilled.sql index 7e8fc30ac1e..8f840609ad7 100644 --- a/daily_spellbook/models/chainlink/ethereum/chainlink_ethereum_ccip_transmitted_fulfilled.sql +++ b/daily_spellbook/models/chainlink/ethereum/chainlink_ethereum_ccip_transmitted_fulfilled.sql @@ -1,16 +1,16 @@ {{ config( - + alias='ccip_transmitted_fulfilled', partition_by=['date_month'], materialized='incremental', file_format='delta', incremental_strategy='merge', - unique_key=['tx_hash', 'tx_index', 'node_address'] + unique_key=['tx_hash', 'tx_index', 'node_address'], + incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.block_time')] ) }} -{% set incremental_interval = '7' %} WITH ethereum_usd AS ( @@ -22,8 +22,8 @@ WITH WHERE symbol = 'ETH' {% if is_incremental() %} - AND minute >= date_trunc('day', now() - interval '{{incremental_interval}}' day) - {% endif %} + AND {{ incremental_predicate('minute') }} + {% endif %} ), ccip_fulfilled_transactions AS ( SELECT @@ -38,12 +38,12 @@ WITH {{ source('ethereum', 'transactions') }} tx RIGHT JOIN {{ ref('chainlink_ethereum_ccip_transmitted_logs') }} ccip_tx ON ccip_tx.tx_hash = tx.hash {% if is_incremental() %} - AND ccip_tx.block_time >= date_trunc('day', now() - interval '{{incremental_interval}}' day) + AND {{ incremental_predicate('ccip_tx.block_time') }} {% endif %} LEFT JOIN ethereum_usd ON date_trunc('minute', tx.block_time) = ethereum_usd.block_time {% if is_incremental() %} - WHERE tx.block_time >= date_trunc('day', now() - interval '{{incremental_interval}}' day) - {% endif %} + WHERE {{ incremental_predicate('tx.block_time') }} + {% endif %} GROUP BY tx.hash, tx.index, diff --git a/daily_spellbook/models/chainlink/ethereum/chainlink_ethereum_ccip_transmitted_reverted.sql b/daily_spellbook/models/chainlink/ethereum/chainlink_ethereum_ccip_transmitted_reverted.sql index 73ef2000d99..ee9a1e865d8 100644 --- a/daily_spellbook/models/chainlink/ethereum/chainlink_ethereum_ccip_transmitted_reverted.sql +++ b/daily_spellbook/models/chainlink/ethereum/chainlink_ethereum_ccip_transmitted_reverted.sql @@ -1,16 +1,16 @@ {{ config( - + alias='ccip_transmitted_reverted', partition_by=['date_month'], materialized='incremental', file_format='delta', incremental_strategy='merge', - unique_key=['tx_hash', 'tx_index', 'node_address'] + unique_key=['tx_hash', 'tx_index', 'node_address'], + incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.block_time')] ) }} -{% set incremental_interval = '7' %} WITH ethereum_usd AS ( @@ -22,8 +22,8 @@ WITH WHERE symbol = 'ETH' {% if is_incremental() %} - AND minute >= date_trunc('day', now() - interval '{{incremental_interval}}' day) - {% endif %} + AND {{ incremental_predicate('minute') }} + {% endif %} ), ccip_reverted_transactions AS ( SELECT @@ -38,14 +38,14 @@ WITH {{ ref('chainlink_ethereum_ccip_transmitted_logs') }} tx LEFT JOIN {{ source('ethereum', 'transactions') }} tx2 ON tx2.hash = tx.tx_hash {% if is_incremental() %} - AND tx.block_time >= date_trunc('day', now() - interval '{{incremental_interval}}' day) + AND {{ incremental_predicate('tx.block_time') }} {% endif %} LEFT JOIN ethereum_usd ON date_trunc('minute', tx.block_time) = ethereum_usd.block_time WHERE tx2.success = false {% if is_incremental() %} - AND tx.block_time >= date_trunc('day', now() - interval '{{incremental_interval}}' day) - {% endif %} + AND {{ incremental_predicate('tx.block_time') }} + {% endif %} GROUP BY tx.tx_hash, tx.index, diff --git a/daily_spellbook/models/chainlink/ethereum/chainlink_ethereum_fm_fulfilled_transactions.sql b/daily_spellbook/models/chainlink/ethereum/chainlink_ethereum_fm_fulfilled_transactions.sql index 09bcfc78adf..208cb520519 100644 --- a/daily_spellbook/models/chainlink/ethereum/chainlink_ethereum_fm_fulfilled_transactions.sql +++ b/daily_spellbook/models/chainlink/ethereum/chainlink_ethereum_fm_fulfilled_transactions.sql @@ -1,16 +1,16 @@ {{ config( - + alias='fm_fulfilled_transactions', partition_by=['date_month'], materialized='incremental', file_format='delta', incremental_strategy='merge', - unique_key=['tx_hash', 'tx_index', 'node_address'] + unique_key=['tx_hash', 'tx_index', 'node_address'], + incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.block_time')] ) }} -{% set incremental_interval = '7' %} WITH ethereum_usd AS ( @@ -22,8 +22,8 @@ WITH WHERE symbol = 'ETH' {% if is_incremental() %} - AND minute >= date_trunc('day', now() - interval '{{incremental_interval}}' day) - {% endif %} + AND {{ incremental_predicate('minute') }} + {% endif %} ), fm_submission_transactions AS ( SELECT @@ -40,12 +40,12 @@ WITH {{ source('ethereum', 'transactions') }} tx RIGHT JOIN {{ ref('chainlink_ethereum_fm_gas_submission_logs') }} fm_gas_submission_logs ON fm_gas_submission_logs.tx_hash = tx.hash {% if is_incremental() %} - AND fm_gas_submission_logs.block_time >= date_trunc('day', now() - interval '{{incremental_interval}}' day) + AND {{ incremental_predicate('fm_gas_submission_logs.block_time') }} {% endif %} LEFT JOIN ethereum_usd ON date_trunc('minute', tx.block_time) = ethereum_usd.block_time {% if is_incremental() %} - WHERE tx.block_time >= date_trunc('day', now() - interval '{{incremental_interval}}' day) - {% endif %} + WHERE {{ incremental_predicate('tx.block_time') }} + {% endif %} GROUP BY tx.hash, tx.index, diff --git a/daily_spellbook/models/chainlink/ethereum/chainlink_ethereum_fm_gas_daily.sql b/daily_spellbook/models/chainlink/ethereum/chainlink_ethereum_fm_gas_daily.sql index b569f4fdcd7..dd9e3caeec3 100644 --- a/daily_spellbook/models/chainlink/ethereum/chainlink_ethereum_fm_gas_daily.sql +++ b/daily_spellbook/models/chainlink/ethereum/chainlink_ethereum_fm_gas_daily.sql @@ -1,6 +1,6 @@ {{ config( - + alias='fm_gas_daily', partition_by=['date_month'], materialized='incremental', @@ -10,7 +10,6 @@ ) }} -{% set incremental_interval = '7' %} {% set truncate_by = 'day' %} WITH @@ -24,7 +23,7 @@ WITH {{ ref('chainlink_ethereum_fm_fulfilled_transactions') }} fulfilled {% if is_incremental() %} WHERE - fulfilled.block_time >= date_trunc('day', now() - interval '{{incremental_interval}}' day) + {{ incremental_predicate('fulfilled.block_time') }} {% endif %} GROUP BY 1, 2 @@ -41,7 +40,7 @@ WITH {{ ref('chainlink_ethereum_fm_reverted_transactions') }} reverted {% if is_incremental() %} WHERE - reverted.block_time >= date_trunc('day', now() - interval '{{incremental_interval}}' day) + {{ incremental_predicate('reverted.block_time') }} {% endif %} GROUP BY 1, 2 @@ -53,7 +52,7 @@ WITH COALESCE( fulfilled.date_start, reverted.date_start - ) AS "date_start", + ) AS "date_start", COALESCE( fulfilled.node_address, reverted.node_address @@ -86,7 +85,7 @@ WITH FROM fm_gas_daily_meta LEFT JOIN {{ ref('chainlink_ethereum_ocr_operator_node_meta') }} fm_operator_node_meta ON fm_operator_node_meta.node_address = fm_gas_daily_meta.node_address ) -SELECT +SELECT blockchain, date_start, date_month, @@ -97,7 +96,7 @@ SELECT reverted_token_amount, reverted_usd_amount, total_token_amount, - total_usd_amount + total_usd_amount FROM fm_gas_daily ORDER BY diff --git a/daily_spellbook/models/chainlink/ethereum/chainlink_ethereum_fm_request_daily.sql b/daily_spellbook/models/chainlink/ethereum/chainlink_ethereum_fm_request_daily.sql index 63ddc961ff4..641ac060572 100644 --- a/daily_spellbook/models/chainlink/ethereum/chainlink_ethereum_fm_request_daily.sql +++ b/daily_spellbook/models/chainlink/ethereum/chainlink_ethereum_fm_request_daily.sql @@ -1,6 +1,6 @@ {{ config( - + alias='fm_request_daily', partition_by=['date_month'], materialized='incremental', @@ -10,7 +10,6 @@ ) }} -{% set incremental_interval = '7' %} {% set truncate_by = 'day' %} WITH @@ -19,7 +18,7 @@ WITH COALESCE( cast(date_trunc('{{truncate_by}}', fulfilled.block_time) as date), cast(date_trunc('{{truncate_by}}', reverted.block_time) as date) - ) AS "date_start", + ) AS "date_start", COALESCE( fulfilled.node_address, reverted.node_address @@ -34,8 +33,8 @@ WITH reverted.node_address = fulfilled.node_address {% if is_incremental() %} WHERE - fulfilled.block_time >= date_trunc('day', now() - interval '{{incremental_interval}}' day) - AND reverted.block_time >= date_trunc('day', now() - interval '{{incremental_interval}}' day) + {{ incremental_predicate('fulfilled.block_time') }} + AND {{ incremental_predicate('reverted.block_time') }} {% endif %} GROUP BY 1, 2 @@ -55,7 +54,7 @@ WITH FROM fm_request_daily_meta LEFT JOIN {{ ref('chainlink_ethereum_ocr_operator_node_meta') }} fm_operator_node_meta ON fm_operator_node_meta.node_address = fm_request_daily_meta.node_address ) -SELECT +SELECT blockchain, date_start, date_month, diff --git a/daily_spellbook/models/chainlink/ethereum/chainlink_ethereum_fm_reverted_transactions.sql b/daily_spellbook/models/chainlink/ethereum/chainlink_ethereum_fm_reverted_transactions.sql index addc78048ec..54a779f9484 100644 --- a/daily_spellbook/models/chainlink/ethereum/chainlink_ethereum_fm_reverted_transactions.sql +++ b/daily_spellbook/models/chainlink/ethereum/chainlink_ethereum_fm_reverted_transactions.sql @@ -1,16 +1,16 @@ {{ config( - + alias='fm_reverted_transactions', partition_by=['date_month'], materialized='incremental', file_format='delta', incremental_strategy='merge', - unique_key=['tx_hash', 'tx_index', 'node_address'] + unique_key=['tx_hash', 'tx_index', 'node_address'], + incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.block_time')] ) }} -{% set incremental_interval = '7' %} WITH ethereum_usd AS ( @@ -22,8 +22,8 @@ WITH WHERE symbol = 'ETH' {% if is_incremental() %} - AND minute >= date_trunc('day', now() - interval '{{incremental_interval}}' day) - {% endif %} + AND {{ incremental_predicate('minute') }} + {% endif %} ), fm_reverted_transactions AS ( SELECT @@ -42,8 +42,8 @@ WITH WHERE success = false {% if is_incremental() %} - AND tx.block_time >= date_trunc('day', now() - interval '{{incremental_interval}}' day) - {% endif %} + AND {{ incremental_predicate('tx.block_time') }} + {% endif %} GROUP BY tx.hash, tx.index, diff --git a/daily_spellbook/models/chainlink/ethereum/chainlink_ethereum_fm_reward_daily.sql b/daily_spellbook/models/chainlink/ethereum/chainlink_ethereum_fm_reward_daily.sql index 7de1d0b42b2..6871a14a41b 100644 --- a/daily_spellbook/models/chainlink/ethereum/chainlink_ethereum_fm_reward_daily.sql +++ b/daily_spellbook/models/chainlink/ethereum/chainlink_ethereum_fm_reward_daily.sql @@ -1,6 +1,6 @@ {{ config( - + alias='fm_reward_daily', partition_by = ['date_month'], materialized = 'incremental', @@ -10,7 +10,6 @@ ) }} -{% set incremental_interval = '7' %} WITH admin_address_meta as ( @@ -28,8 +27,8 @@ WITH WHERE price.symbol = 'LINK' {% if is_incremental() %} - AND price.minute >= date_trunc('day', now() - interval '{{incremental_interval}}' day) - {% endif %} + AND {{ incremental_predicate('price.minute') }} + {% endif %} GROUP BY 1 ORDER BY @@ -77,16 +76,16 @@ WITH 1, 2 ), fm_reward_daily AS ( - SELECT + SELECT payment_meta.date_start, cast(date_trunc('month', payment_meta.date_start) as date) as date_month, payment_meta.admin_address, - ocr_operator_admin_meta.operator_name, + ocr_operator_admin_meta.operator_name, COALESCE(fm_reward_evt_transfer_daily.token_amount / EXTRACT(DAY FROM next_payment_date - prev_payment_date), 0) as token_amount, (COALESCE(fm_reward_evt_transfer_daily.token_amount / EXTRACT(DAY FROM next_payment_date - prev_payment_date), 0) * payment_meta.usd_amount) as usd_amount - FROM + FROM payment_meta - LEFT JOIN + LEFT JOIN {{ref('chainlink_ethereum_fm_reward_evt_transfer_daily')}} fm_reward_evt_transfer_daily ON payment_meta.next_payment_date = fm_reward_evt_transfer_daily.date_start AND payment_meta.admin_address = fm_reward_evt_transfer_daily.admin_address @@ -101,7 +100,7 @@ SELECT operator_name, token_amount, usd_amount -FROM +FROM fm_reward_daily ORDER BY 2, 4 diff --git a/daily_spellbook/models/chainlink/ethereum/chainlink_ethereum_fm_reward_evt_transfer_daily.sql b/daily_spellbook/models/chainlink/ethereum/chainlink_ethereum_fm_reward_evt_transfer_daily.sql index 664247b6c7e..ab412196360 100644 --- a/daily_spellbook/models/chainlink/ethereum/chainlink_ethereum_fm_reward_evt_transfer_daily.sql +++ b/daily_spellbook/models/chainlink/ethereum/chainlink_ethereum_fm_reward_evt_transfer_daily.sql @@ -1,6 +1,6 @@ {{ config( - + alias='fm_reward_evt_transfer_daily', partition_by=['date_month'], materialized='incremental', @@ -10,7 +10,6 @@ ) }} -{% set incremental_interval = '7' %} SELECT 'ethereum' as blockchain, @@ -23,8 +22,8 @@ FROM {{ref('chainlink_ethereum_fm_reward_evt_transfer')}} fm_reward_evt_transfer LEFT JOIN {{ ref('chainlink_ethereum_ocr_operator_admin_meta') }} fm_operator_admin_meta ON fm_operator_admin_meta.admin_address = fm_reward_evt_transfer.admin_address {% if is_incremental() %} - WHERE evt_block_time >= date_trunc('day', now() - interval '{{incremental_interval}}' day) -{% endif %} + WHERE {{ incremental_predicate('evt_block_time') }} +{% endif %} GROUP BY 2, 4 ORDER BY diff --git a/daily_spellbook/models/chainlink/ethereum/chainlink_ethereum_ocr_fulfilled_transactions.sql b/daily_spellbook/models/chainlink/ethereum/chainlink_ethereum_ocr_fulfilled_transactions.sql index c1cabc7e612..3096c63ba42 100644 --- a/daily_spellbook/models/chainlink/ethereum/chainlink_ethereum_ocr_fulfilled_transactions.sql +++ b/daily_spellbook/models/chainlink/ethereum/chainlink_ethereum_ocr_fulfilled_transactions.sql @@ -1,12 +1,13 @@ {{ config( - + alias='ocr_fulfilled_transactions', partition_by=['date_month'], materialized='incremental', file_format='delta', incremental_strategy='merge', unique_key=['tx_hash', 'tx_index', 'node_address'], + incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.block_time')], post_hook='{{ expose_spells(\'["ethereum"]\', "project", "chainlink", @@ -14,7 +15,6 @@ ) }} -{% set incremental_interval = '7' %} WITH ethereum_usd AS ( @@ -26,8 +26,8 @@ WITH WHERE symbol = 'ETH' {% if is_incremental() %} - AND minute >= date_trunc('day', now() - interval '{{incremental_interval}}' day) - {% endif %} + AND {{ incremental_predicate('minute') }} + {% endif %} ), ocr_fulfilled_transactions AS ( SELECT @@ -43,8 +43,8 @@ WITH RIGHT JOIN {{ ref('chainlink_ethereum_ocr_gas_transmission_logs') }} ocr_gas_transmission_logs ON ocr_gas_transmission_logs.tx_hash = tx.hash LEFT JOIN ethereum_usd ON date_trunc('minute', tx.block_time) = ethereum_usd.block_time {% if is_incremental() %} - WHERE tx.block_time >= date_trunc('day', now() - interval '{{incremental_interval}}' day) - {% endif %} + WHERE {{ incremental_predicate('tx.block_time') }} + {% endif %} GROUP BY tx.hash, tx.index, diff --git a/daily_spellbook/models/chainlink/ethereum/chainlink_ethereum_ocr_gas_daily.sql b/daily_spellbook/models/chainlink/ethereum/chainlink_ethereum_ocr_gas_daily.sql index 07fbb57bb15..06a89f34dd4 100644 --- a/daily_spellbook/models/chainlink/ethereum/chainlink_ethereum_ocr_gas_daily.sql +++ b/daily_spellbook/models/chainlink/ethereum/chainlink_ethereum_ocr_gas_daily.sql @@ -1,6 +1,6 @@ {{ config( - + alias='ocr_gas_daily', partition_by=['date_month'], materialized='incremental', @@ -14,7 +14,6 @@ ) }} -{% set incremental_interval = '7' %} {% set truncate_by = 'day' %} WITH @@ -28,7 +27,7 @@ WITH {{ ref('chainlink_ethereum_ocr_fulfilled_transactions') }} fulfilled {% if is_incremental() %} WHERE - fulfilled.block_time >= date_trunc('day', now() - interval '{{incremental_interval}}' day) + {{ incremental_predicate('fulfilled.block_time') }} {% endif %} GROUP BY 1, 2 @@ -45,7 +44,7 @@ WITH {{ ref('chainlink_ethereum_ocr_reverted_transactions') }} reverted {% if is_incremental() %} WHERE - reverted.block_time >= date_trunc('day', now() - interval '{{incremental_interval}}' day) + {{ incremental_predicate('reverted.block_time') }} {% endif %} GROUP BY 1, 2 @@ -57,7 +56,7 @@ WITH COALESCE( fulfilled.date_start, reverted.date_start - ) AS "date_start", + ) AS "date_start", COALESCE( fulfilled.node_address, reverted.node_address @@ -90,7 +89,7 @@ WITH FROM ocr_gas_daily_meta LEFT JOIN {{ ref('chainlink_ethereum_ocr_operator_node_meta') }} ocr_operator_node_meta ON ocr_operator_node_meta.node_address = ocr_gas_daily_meta.node_address ) -SELECT +SELECT blockchain, date_start, date_month, @@ -101,7 +100,7 @@ SELECT reverted_token_amount, reverted_usd_amount, total_token_amount, - total_usd_amount + total_usd_amount FROM ocr_gas_daily ORDER BY diff --git a/daily_spellbook/models/chainlink/ethereum/chainlink_ethereum_ocr_request_daily.sql b/daily_spellbook/models/chainlink/ethereum/chainlink_ethereum_ocr_request_daily.sql index 557f10d5f6b..b45e20fefd5 100644 --- a/daily_spellbook/models/chainlink/ethereum/chainlink_ethereum_ocr_request_daily.sql +++ b/daily_spellbook/models/chainlink/ethereum/chainlink_ethereum_ocr_request_daily.sql @@ -1,6 +1,6 @@ {{ config( - + alias='ocr_request_daily', partition_by=['date_month'], materialized='incremental', @@ -14,7 +14,6 @@ ) }} -{% set incremental_interval = '7' %} {% set truncate_by = 'day' %} WITH @@ -23,7 +22,7 @@ WITH COALESCE( cast(date_trunc('{{truncate_by}}', fulfilled.block_time) as date), cast(date_trunc('{{truncate_by}}', reverted.block_time) as date) - ) AS "date_start", + ) AS "date_start", COALESCE( fulfilled.node_address, reverted.node_address @@ -38,8 +37,8 @@ WITH reverted.node_address = fulfilled.node_address {% if is_incremental() %} WHERE - fulfilled.block_time >= date_trunc('day', now() - interval '{{incremental_interval}}' day) - OR reverted.block_time >= date_trunc('day', now() - interval '{{incremental_interval}}' day) + {{ incremental_predicate('fulfilled.block_time') }} + OR {{ incremental_predicate('reverted.block_time') }} {% endif %} GROUP BY 1, 2 @@ -59,7 +58,7 @@ WITH FROM ocr_request_daily_meta LEFT JOIN {{ ref('chainlink_ethereum_ocr_operator_node_meta') }} ocr_operator_node_meta ON ocr_operator_node_meta.node_address = ocr_request_daily_meta.node_address ) -SELECT +SELECT blockchain, date_start, date_month, diff --git a/daily_spellbook/models/chainlink/ethereum/chainlink_ethereum_ocr_reverted_transactions.sql b/daily_spellbook/models/chainlink/ethereum/chainlink_ethereum_ocr_reverted_transactions.sql index 7533a3a7c48..2d95f1b0108 100644 --- a/daily_spellbook/models/chainlink/ethereum/chainlink_ethereum_ocr_reverted_transactions.sql +++ b/daily_spellbook/models/chainlink/ethereum/chainlink_ethereum_ocr_reverted_transactions.sql @@ -1,12 +1,13 @@ {{ config( - + alias='ocr_reverted_transactions', partition_by=['date_month'], materialized='incremental', file_format='delta', incremental_strategy='merge', unique_key=['tx_hash', 'tx_index', 'node_address'], + incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.block_time')], post_hook='{{ expose_spells(\'["ethereum"]\', "project", "chainlink", @@ -14,7 +15,6 @@ ) }} -{% set incremental_interval = '7' %} WITH ethereum_usd AS ( @@ -26,8 +26,8 @@ WITH WHERE symbol = 'ETH' {% if is_incremental() %} - AND minute >= date_trunc('day', now() - interval '{{incremental_interval}}' day) - {% endif %} + AND {{ incremental_predicate('minute') }} + {% endif %} ), ocr_reverted_transactions AS ( SELECT @@ -44,8 +44,8 @@ WITH WHERE success = false {% if is_incremental() %} - AND tx.block_time >= date_trunc('day', now() - interval '{{incremental_interval}}' day) - {% endif %} + AND {{ incremental_predicate('tx.block_time') }} + {% endif %} GROUP BY tx.hash, tx.index, diff --git a/daily_spellbook/models/chainlink/ethereum/chainlink_ethereum_ocr_reward_daily.sql b/daily_spellbook/models/chainlink/ethereum/chainlink_ethereum_ocr_reward_daily.sql index bd8f24f7c70..e8608e83a93 100644 --- a/daily_spellbook/models/chainlink/ethereum/chainlink_ethereum_ocr_reward_daily.sql +++ b/daily_spellbook/models/chainlink/ethereum/chainlink_ethereum_ocr_reward_daily.sql @@ -1,6 +1,6 @@ {{ config( - + alias='ocr_reward_daily', partition_by = ['date_month'], materialized = 'incremental', @@ -14,7 +14,6 @@ ) }} -{% set incremental_interval = '7' %} WITH admin_address_meta as ( @@ -32,8 +31,8 @@ WITH WHERE price.symbol = 'LINK' {% if is_incremental() %} - AND price.minute >= date_trunc('day', now() - interval '{{incremental_interval}}' day) - {% endif %} + AND {{ incremental_predicate('price.minute') }} + {% endif %} GROUP BY 1 ORDER BY @@ -81,16 +80,16 @@ WITH 1, 2 ), ocr_reward_daily AS ( - SELECT + SELECT payment_meta.date_start, cast(date_trunc('month', payment_meta.date_start) as date) as date_month, payment_meta.admin_address, - ocr_operator_admin_meta.operator_name, + ocr_operator_admin_meta.operator_name, COALESCE(ocr_reward_evt_transfer_daily.token_amount / EXTRACT(DAY FROM next_payment_date - prev_payment_date), 0) as token_amount, (COALESCE(ocr_reward_evt_transfer_daily.token_amount / EXTRACT(DAY FROM next_payment_date - prev_payment_date), 0) * payment_meta.usd_amount) as usd_amount - FROM + FROM payment_meta - LEFT JOIN + LEFT JOIN {{ref('chainlink_ethereum_ocr_reward_evt_transfer_daily')}} ocr_reward_evt_transfer_daily ON payment_meta.next_payment_date = ocr_reward_evt_transfer_daily.date_start AND payment_meta.admin_address = ocr_reward_evt_transfer_daily.admin_address @@ -105,7 +104,7 @@ SELECT operator_name, token_amount, usd_amount -FROM +FROM ocr_reward_daily ORDER BY 2, 4 diff --git a/daily_spellbook/models/chainlink/ethereum/chainlink_ethereum_ocr_reward_evt_transfer_daily.sql b/daily_spellbook/models/chainlink/ethereum/chainlink_ethereum_ocr_reward_evt_transfer_daily.sql index bf44aafb77b..ad1c4187142 100644 --- a/daily_spellbook/models/chainlink/ethereum/chainlink_ethereum_ocr_reward_evt_transfer_daily.sql +++ b/daily_spellbook/models/chainlink/ethereum/chainlink_ethereum_ocr_reward_evt_transfer_daily.sql @@ -1,6 +1,6 @@ {{ config( - + alias='ocr_reward_evt_transfer_daily', partition_by=['date_month'], materialized='incremental', @@ -14,7 +14,6 @@ ) }} -{% set incremental_interval = '7' %} SELECT 'ethereum' as blockchain, @@ -27,8 +26,8 @@ FROM {{ref('chainlink_ethereum_ocr_reward_evt_transfer')}} ocr_reward_evt_transfer LEFT JOIN {{ ref('chainlink_ethereum_ocr_operator_admin_meta') }} ocr_operator_admin_meta ON ocr_operator_admin_meta.admin_address = ocr_reward_evt_transfer.admin_address {% if is_incremental() %} - WHERE evt_block_time >= date_trunc('day', now() - interval '{{incremental_interval}}' day) -{% endif %} + WHERE {{ incremental_predicate('evt_block_time') }} +{% endif %} GROUP BY 2, 4 ORDER BY diff --git a/daily_spellbook/models/chainlink/ethereum/chainlink_ethereum_price_feeds.sql b/daily_spellbook/models/chainlink/ethereum/chainlink_ethereum_price_feeds.sql index 9849a0a8be2..623ddf4826a 100644 --- a/daily_spellbook/models/chainlink/ethereum/chainlink_ethereum_price_feeds.sql +++ b/daily_spellbook/models/chainlink/ethereum/chainlink_ethereum_price_feeds.sql @@ -1,6 +1,6 @@ {{ config( - + alias='price_feeds', partition_by=['block_month'], materialized='incremental', @@ -14,7 +14,6 @@ ) }} -{% set incremental_interval = '7' %} {% set project_start_date = '2015-07-30' %} SELECT 'ethereum' as blockchain, @@ -27,11 +26,11 @@ SELECT 'ethereum' as blockchain, c.proxy_address, c.aggregator_address, c.oracle_price / POWER(10, 0) as underlying_token_price, - CASE + CASE WHEN cardinality(split(c.feed_name, ' / ')) = 1 THEN c.feed_name ELSE element_at(split(c.feed_name, ' / '), 1) END AS base, - CASE + CASE WHEN cardinality(split(c.feed_name, ' / ')) = 1 THEN NULL ELSE element_at(split(c.feed_name, ' / '), 2) END AS quote @@ -39,14 +38,14 @@ FROM ( SELECT l.block_time, - cast(date_trunc('day', l.block_time) as date) as block_date, - cast(date_trunc('month', l.block_time) as date) as block_month, + cast(date_trunc('day', l.block_time) as date) as block_date, + cast(date_trunc('month', l.block_time) as date) as block_month, l.block_number, cfa.feed_name, cfa.proxy_address, MAX(cfa.aggregator_address) as aggregator_address, AVG( - CAST(bytearray_to_uint256(bytearray_substring(l.topic1, 3, 64)) as DOUBLE) + CAST(bytearray_to_uint256(bytearray_substring(l.topic1, 3, 64)) as DOUBLE) / POWER(10, cfa.decimals) ) as oracle_price FROM @@ -56,10 +55,10 @@ FROM WHERE l.topic0 = 0x0559884fd3a460db3073b7fc896cc77986f16e378210ded43186175bf646fc5f {% if not is_incremental() %} - AND l.block_time >= cast('{{project_start_date}}' as date) + AND l.block_time >= cast('{{project_start_date}}' as date) {% endif %} {% if is_incremental() %} - AND l.block_time >= date_trunc('day', now() - interval '{{incremental_interval}}' day) + AND {{ incremental_predicate('l.block_time') }} {% endif %} GROUP BY 1, 2, 3, 4, 5, 6 diff --git a/daily_spellbook/models/chainlink/ethereum/chainlink_ethereum_price_feeds_hourly.sql b/daily_spellbook/models/chainlink/ethereum/chainlink_ethereum_price_feeds_hourly.sql index 110cccd0d67..01785626419 100644 --- a/daily_spellbook/models/chainlink/ethereum/chainlink_ethereum_price_feeds_hourly.sql +++ b/daily_spellbook/models/chainlink/ethereum/chainlink_ethereum_price_feeds_hourly.sql @@ -1,6 +1,6 @@ {{ config( - + alias='price_feeds_hourly', partition_by=['block_month'], materialized='incremental', @@ -11,7 +11,6 @@ ) }} -{% set incremental_interval = '7' %} {% set project_start_date = '2019-10-01' %} WITH hourly_sequence_meta AS ( @@ -25,7 +24,7 @@ WITH hourly_sequence_meta AS ( AND price.minute >= timestamp '{{project_start_date}}' {% endif %} {% if is_incremental() %} - AND price.minute >= date_trunc('hour', now() - interval '{{incremental_interval}}' day) + AND {{ incremental_predicate('price.minute') }} {% endif %} GROUP BY 1 @@ -70,7 +69,7 @@ aggregated_price_feeds AS ( hourly_sequence.hr >= timestamp '{{project_start_date}}' {% endif %} {% if is_incremental() %} - hourly_sequence.hr >= date_trunc('hour', now() - interval '{{incremental_interval}}' day) + {{ incremental_predicate('hourly_sequence.hr') }} {% endif %} GROUP BY hourly_sequence.hr, hourly_sequence.feed_name, hourly_sequence.proxy_address, hourly_sequence.aggregator_address diff --git a/daily_spellbook/models/chainlink/ethereum/chainlink_ethereum_vrf_fulfilled_transactions.sql b/daily_spellbook/models/chainlink/ethereum/chainlink_ethereum_vrf_fulfilled_transactions.sql index 7b3495962d4..076cdb7e0da 100644 --- a/daily_spellbook/models/chainlink/ethereum/chainlink_ethereum_vrf_fulfilled_transactions.sql +++ b/daily_spellbook/models/chainlink/ethereum/chainlink_ethereum_vrf_fulfilled_transactions.sql @@ -1,12 +1,13 @@ {{ config( - + alias='vrf_fulfilled_transactions', partition_by=['date_month'], materialized='incremental', file_format='delta', incremental_strategy='merge', - unique_key=['tx_hash', 'tx_index', 'node_address'] + unique_key=['tx_hash', 'tx_index', 'node_address'], + incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.block_time')] ) }} @@ -22,7 +23,7 @@ WITH {% if is_incremental() %} AND {{ incremental_predicate('minute') }} - {% endif %} + {% endif %} ), vrf_fulfilled_transactions AS ( SELECT @@ -39,14 +40,14 @@ WITH {{ source('ethereum', 'transactions') }} tx RIGHT JOIN {{ ref('chainlink_ethereum_vrf_v1_random_fulfilled_logs') }} vrf_v1_logs ON vrf_v1_logs.tx_hash = tx.hash {% if is_incremental() %} - AND + AND {{ incremental_predicate('tx.block_time') }} {% endif %} LEFT JOIN ethereum_usd ON date_trunc('minute', tx.block_time) = ethereum_usd.block_time {% if is_incremental() %} WHERE {{ incremental_predicate('tx.block_time') }} - {% endif %} + {% endif %} GROUP BY tx.hash, tx.index, @@ -75,7 +76,7 @@ WITH {% if is_incremental() %} WHERE {{ incremental_predicate('tx.block_time') }} - {% endif %} + {% endif %} GROUP BY tx.hash, tx.index, diff --git a/daily_spellbook/models/chainlink/ethereum/chainlink_ethereum_vrf_gas_daily.sql b/daily_spellbook/models/chainlink/ethereum/chainlink_ethereum_vrf_gas_daily.sql index 199dbb3b615..4f050f7abb5 100644 --- a/daily_spellbook/models/chainlink/ethereum/chainlink_ethereum_vrf_gas_daily.sql +++ b/daily_spellbook/models/chainlink/ethereum/chainlink_ethereum_vrf_gas_daily.sql @@ -1,6 +1,6 @@ {{ config( - + alias='vrf_gas_daily', partition_by=['date_month'], materialized='incremental', @@ -10,7 +10,6 @@ ) }} -{% set incremental_interval = '7' %} {% set truncate_by = 'day' %} WITH @@ -24,7 +23,7 @@ WITH {{ ref('chainlink_ethereum_vrf_fulfilled_transactions') }} fulfilled {% if is_incremental() %} WHERE - fulfilled.block_time >= date_trunc('day', now() - interval '{{incremental_interval}}' day) + {{ incremental_predicate('fulfilled.block_time') }} {% endif %} GROUP BY 1, 2 @@ -41,7 +40,7 @@ WITH {{ ref('chainlink_ethereum_vrf_reverted_transactions') }} reverted {% if is_incremental() %} WHERE - reverted.block_time >= date_trunc('day', now() - interval '{{incremental_interval}}' day) + {{ incremental_predicate('reverted.block_time') }} {% endif %} GROUP BY 1, 2 @@ -53,7 +52,7 @@ WITH COALESCE( fulfilled.date_start, reverted.date_start - ) AS "date_start", + ) AS "date_start", COALESCE( fulfilled.node_address, reverted.node_address @@ -84,7 +83,7 @@ WITH fulfilled_usd_amount + reverted_usd_amount as total_usd_amount FROM vrf_gas_daily_meta ) -SELECT +SELECT blockchain, date_start, date_month, @@ -94,7 +93,7 @@ SELECT reverted_token_amount, reverted_usd_amount, total_token_amount, - total_usd_amount + total_usd_amount FROM vrf_gas_daily ORDER BY diff --git a/daily_spellbook/models/chainlink/ethereum/chainlink_ethereum_vrf_request_daily.sql b/daily_spellbook/models/chainlink/ethereum/chainlink_ethereum_vrf_request_daily.sql index 20bda8c9006..1015aef9a6a 100644 --- a/daily_spellbook/models/chainlink/ethereum/chainlink_ethereum_vrf_request_daily.sql +++ b/daily_spellbook/models/chainlink/ethereum/chainlink_ethereum_vrf_request_daily.sql @@ -1,6 +1,6 @@ {{ config( - + alias='vrf_request_daily', partition_by=['date_month'], materialized='incremental', @@ -10,7 +10,6 @@ ) }} -{% set incremental_interval = '7' %} {% set truncate_by = 'day' %} WITH @@ -19,7 +18,7 @@ WITH COALESCE( cast(date_trunc('{{truncate_by}}', fulfilled.block_time) as date), cast(date_trunc('{{truncate_by}}', reverted.block_time) as date) - ) AS "date_start", + ) AS "date_start", COALESCE( fulfilled.node_address, reverted.node_address @@ -34,8 +33,8 @@ WITH reverted.node_address = fulfilled.node_address {% if is_incremental() %} WHERE - fulfilled.block_time >= date_trunc('day', now() - interval '{{incremental_interval}}' day) - AND reverted.block_time >= date_trunc('day', now() - interval '{{incremental_interval}}' day) + {{ incremental_predicate('fulfilled.block_time') }} + AND {{ incremental_predicate('reverted.block_time') }} {% endif %} GROUP BY 1, 2 @@ -53,7 +52,7 @@ WITH total_requests FROM vrf_request_daily_meta ) -SELECT +SELECT blockchain, date_start, date_month, diff --git a/daily_spellbook/models/chainlink/ethereum/chainlink_ethereum_vrf_request_fulfilled_daily.sql b/daily_spellbook/models/chainlink/ethereum/chainlink_ethereum_vrf_request_fulfilled_daily.sql index 10a95e22010..5b6a038c914 100644 --- a/daily_spellbook/models/chainlink/ethereum/chainlink_ethereum_vrf_request_fulfilled_daily.sql +++ b/daily_spellbook/models/chainlink/ethereum/chainlink_ethereum_vrf_request_fulfilled_daily.sql @@ -1,6 +1,6 @@ {{ config( - + alias='vrf_request_fulfilled_daily', partition_by=['date_month'], materialized='incremental', @@ -10,7 +10,6 @@ ) }} -{% set incremental_interval = '7' %} SELECT 'ethereum' as blockchain, @@ -21,8 +20,8 @@ SELECT FROM {{ref('chainlink_ethereum_vrf_request_fulfilled')}} vrf_request_fulfilled {% if is_incremental() %} - WHERE evt_block_time >= date_trunc('day', now() - interval '{{incremental_interval}}' day) -{% endif %} + WHERE {{ incremental_predicate('evt_block_time') }} +{% endif %} GROUP BY 2, 4 ORDER BY diff --git a/daily_spellbook/models/chainlink/ethereum/chainlink_ethereum_vrf_reverted_transactions.sql b/daily_spellbook/models/chainlink/ethereum/chainlink_ethereum_vrf_reverted_transactions.sql index 12c0291c511..84bdacb944c 100644 --- a/daily_spellbook/models/chainlink/ethereum/chainlink_ethereum_vrf_reverted_transactions.sql +++ b/daily_spellbook/models/chainlink/ethereum/chainlink_ethereum_vrf_reverted_transactions.sql @@ -1,16 +1,16 @@ {{ config( - + alias='vrf_reverted_transactions', partition_by=['date_month'], materialized='incremental', file_format='delta', incremental_strategy='merge', - unique_key=['tx_hash', 'tx_index', 'node_address'] + unique_key=['tx_hash', 'tx_index', 'node_address'], + incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.block_time')] ) }} -{% set incremental_interval = '7' %} WITH ethereum_usd AS ( @@ -22,8 +22,8 @@ WITH WHERE symbol = 'ETH' {% if is_incremental() %} - AND minute >= date_trunc('day', now() - interval '{{incremental_interval}}' day) - {% endif %} + AND {{ incremental_predicate('minute') }} + {% endif %} ), vrf_reverted_transactions AS ( SELECT @@ -42,8 +42,8 @@ WITH WHERE success = false {% if is_incremental() %} - AND tx.block_time >= date_trunc('day', now() - interval '{{incremental_interval}}' day) - {% endif %} + AND {{ incremental_predicate('tx.block_time') }} + {% endif %} GROUP BY tx.hash, tx.index, diff --git a/daily_spellbook/models/chainlink/ethereum/chainlink_ethereum_vrf_reward_daily.sql b/daily_spellbook/models/chainlink/ethereum/chainlink_ethereum_vrf_reward_daily.sql index 7c6722e7ede..c032fc2c2ee 100644 --- a/daily_spellbook/models/chainlink/ethereum/chainlink_ethereum_vrf_reward_daily.sql +++ b/daily_spellbook/models/chainlink/ethereum/chainlink_ethereum_vrf_reward_daily.sql @@ -1,6 +1,6 @@ {{ config( - + alias='vrf_reward_daily', partition_by = ['date_month'], materialized = 'incremental', @@ -10,7 +10,6 @@ ) }} -{% set incremental_interval = '7' %} WITH link_usd_daily AS ( @@ -20,20 +19,20 @@ WITH FROM {{ source('prices', 'usd') }} price WHERE - price.symbol = 'LINK' + price.symbol = 'LINK' GROUP BY 1 ORDER BY 1 ), vrf_reward_daily AS ( - SELECT + SELECT vrf_daily.date_start, cast(date_trunc('month', vrf_daily.date_start) as date) as date_month, - vrf_daily.operator_address, + vrf_daily.operator_address, COALESCE(vrf_daily.token_amount, 0) as token_amount, COALESCE(vrf_daily.token_amount * lud.usd_amount, 0) as usd_amount - FROM + FROM {{ref('chainlink_ethereum_vrf_request_fulfilled_daily')}} vrf_daily LEFT JOIN link_usd_daily lud ON lud.date_start = vrf_daily.date_start ORDER BY date_start @@ -45,7 +44,7 @@ SELECT operator_address, token_amount, usd_amount -FROM +FROM vrf_reward_daily ORDER BY 2, 4 diff --git a/daily_spellbook/models/chainlink/fantom/chainlink_fantom_automation_fulfilled_transactions.sql b/daily_spellbook/models/chainlink/fantom/chainlink_fantom_automation_fulfilled_transactions.sql index 71cc444e744..9bcb397ae93 100644 --- a/daily_spellbook/models/chainlink/fantom/chainlink_fantom_automation_fulfilled_transactions.sql +++ b/daily_spellbook/models/chainlink/fantom/chainlink_fantom_automation_fulfilled_transactions.sql @@ -1,16 +1,16 @@ {{ config( - + alias='automation_fulfilled_transactions', partition_by=['date_month'], materialized='incremental', file_format='delta', incremental_strategy='merge', - unique_key=['tx_hash', 'tx_index', 'node_address'] + unique_key=['tx_hash', 'tx_index', 'node_address'], + incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.block_time')] ) }} -{% set incremental_interval = '7' %} WITH fantom_usd AS ( @@ -22,8 +22,8 @@ WITH WHERE symbol = 'FTM' {% if is_incremental() %} - AND minute >= date_trunc('day', now() - interval '{{incremental_interval}}' day) - {% endif %} + AND {{ incremental_predicate('minute') }} + {% endif %} ), automation_fulfilled_transactions AS ( SELECT @@ -38,12 +38,12 @@ WITH {{ source('fantom', 'transactions') }} tx RIGHT JOIN {{ ref('chainlink_fantom_automation_upkeep_performed_logs') }} automation_upkeep_performed_logs ON automation_upkeep_performed_logs.tx_hash = tx.hash {% if is_incremental() %} - AND automation_upkeep_performed_logs.block_time >= date_trunc('day', now() - interval '{{incremental_interval}}' day) + AND {{ incremental_predicate('automation_upkeep_performed_logs.block_time') }} {% endif %} LEFT JOIN fantom_usd ON date_trunc('minute', tx.block_time) = fantom_usd.block_time {% if is_incremental() %} - WHERE tx.block_time >= date_trunc('day', now() - interval '{{incremental_interval}}' day) - {% endif %} + WHERE {{ incremental_predicate('tx.block_time') }} + {% endif %} GROUP BY tx.hash, tx.index, diff --git a/daily_spellbook/models/chainlink/fantom/chainlink_fantom_automation_gas_daily.sql b/daily_spellbook/models/chainlink/fantom/chainlink_fantom_automation_gas_daily.sql index 5af4a889793..b39e0c6bffc 100644 --- a/daily_spellbook/models/chainlink/fantom/chainlink_fantom_automation_gas_daily.sql +++ b/daily_spellbook/models/chainlink/fantom/chainlink_fantom_automation_gas_daily.sql @@ -1,6 +1,6 @@ {{ config( - + alias='automation_gas_daily', partition_by=['date_month'], materialized='incremental', @@ -10,7 +10,6 @@ ) }} -{% set incremental_interval = '7' %} {% set truncate_by = 'day' %} WITH @@ -24,7 +23,7 @@ WITH {{ ref('chainlink_fantom_automation_fulfilled_transactions') }} fulfilled {% if is_incremental() %} WHERE - fulfilled.block_time >= date_trunc('day', now() - interval '{{incremental_interval}}' day) + {{ incremental_predicate('fulfilled.block_time') }} {% endif %} GROUP BY 1, 2 @@ -41,7 +40,7 @@ WITH {{ ref('chainlink_fantom_automation_reverted_transactions') }} reverted {% if is_incremental() %} WHERE - reverted.block_time >= date_trunc('day', now() - interval '{{incremental_interval}}' day) + {{ incremental_predicate('reverted.block_time') }} {% endif %} GROUP BY 1, 2 @@ -53,7 +52,7 @@ WITH COALESCE( fulfilled.date_start, reverted.date_start - ) AS "date_start", + ) AS "date_start", COALESCE( fulfilled.node_address, reverted.node_address @@ -86,7 +85,7 @@ WITH FROM automation_gas_daily_meta LEFT JOIN {{ ref('chainlink_fantom_automation_meta') }} automation_meta ON automation_meta.keeper_address = automation_gas_daily_meta.node_address ) -SELECT +SELECT blockchain, date_start, date_month, @@ -97,7 +96,7 @@ SELECT reverted_token_amount, reverted_usd_amount, total_token_amount, - total_usd_amount + total_usd_amount FROM automation_gas_daily ORDER BY diff --git a/daily_spellbook/models/chainlink/fantom/chainlink_fantom_automation_performed_daily.sql b/daily_spellbook/models/chainlink/fantom/chainlink_fantom_automation_performed_daily.sql index c932320083a..468a157de34 100644 --- a/daily_spellbook/models/chainlink/fantom/chainlink_fantom_automation_performed_daily.sql +++ b/daily_spellbook/models/chainlink/fantom/chainlink_fantom_automation_performed_daily.sql @@ -1,16 +1,16 @@ {{ config( - + alias='automation_performed_daily', partition_by=['date_month'], materialized='incremental', file_format='delta', incremental_strategy='merge', - unique_key=['date_start', 'keeper_address'] + unique_key=['date_start', 'keeper_address'], + incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.date_month')] ) }} -{% set incremental_interval = '7' %} SELECT 'fantom' as blockchain, @@ -22,8 +22,8 @@ SELECT FROM {{ref('chainlink_fantom_automation_performed')}} automation_performed {% if is_incremental() %} - WHERE evt_block_time >= date_trunc('day', now() - interval '{{incremental_interval}}' day) -{% endif %} + WHERE {{ incremental_predicate('evt_block_time') }} +{% endif %} GROUP BY 2, 4 ORDER BY diff --git a/daily_spellbook/models/chainlink/fantom/chainlink_fantom_automation_request_daily.sql b/daily_spellbook/models/chainlink/fantom/chainlink_fantom_automation_request_daily.sql index d201df8f6af..f4cb4200191 100644 --- a/daily_spellbook/models/chainlink/fantom/chainlink_fantom_automation_request_daily.sql +++ b/daily_spellbook/models/chainlink/fantom/chainlink_fantom_automation_request_daily.sql @@ -1,6 +1,6 @@ {{ config( - + alias='automation_request_daily', partition_by=['date_month'], materialized='incremental', @@ -10,7 +10,6 @@ ) }} -{% set incremental_interval = '7' %} {% set truncate_by = 'day' %} WITH @@ -19,7 +18,7 @@ WITH COALESCE( cast(date_trunc('{{truncate_by}}', fulfilled.block_time) as date), cast(date_trunc('{{truncate_by}}', reverted.block_time) as date) - ) AS "date_start", + ) AS "date_start", COALESCE( fulfilled.node_address, reverted.node_address @@ -34,8 +33,8 @@ WITH reverted.node_address = fulfilled.node_address {% if is_incremental() %} WHERE - fulfilled.block_time >= date_trunc('day', now() - interval '{{incremental_interval}}' day) - OR reverted.block_time >= date_trunc('day', now() - interval '{{incremental_interval}}' day) + {{ incremental_predicate('fulfilled.block_time') }} + OR {{ incremental_predicate('reverted.block_time') }} {% endif %} GROUP BY 1, 2 @@ -53,7 +52,7 @@ WITH total_requests FROM automation_request_daily_meta ) -SELECT +SELECT automation_request_daily.blockchain, date_start, date_month, diff --git a/daily_spellbook/models/chainlink/fantom/chainlink_fantom_automation_reverted_transactions.sql b/daily_spellbook/models/chainlink/fantom/chainlink_fantom_automation_reverted_transactions.sql index 537eebdfd4c..2073e81c7dc 100644 --- a/daily_spellbook/models/chainlink/fantom/chainlink_fantom_automation_reverted_transactions.sql +++ b/daily_spellbook/models/chainlink/fantom/chainlink_fantom_automation_reverted_transactions.sql @@ -1,16 +1,16 @@ {{ config( - + alias='automation_reverted_transactions', partition_by=['date_month'], materialized='incremental', file_format='delta', incremental_strategy='merge', - unique_key=['tx_hash', 'tx_index', 'node_address'] + unique_key=['tx_hash', 'tx_index', 'node_address'], + incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.block_time')] ) }} -{% set incremental_interval = '7' %} WITH fantom_usd AS ( @@ -22,8 +22,8 @@ WITH WHERE symbol = 'FTM' {% if is_incremental() %} - AND minute >= date_trunc('day', now() - interval '{{incremental_interval}}' day) - {% endif %} + AND {{ incremental_predicate('minute') }} + {% endif %} ), automation_reverted_transactions AS ( SELECT @@ -40,8 +40,8 @@ WITH WHERE success = false {% if is_incremental() %} - AND tx.block_time >= date_trunc('day', now() - interval '{{incremental_interval}}' day) - {% endif %} + AND {{ incremental_predicate('tx.block_time') }} + {% endif %} GROUP BY tx.hash, tx.index, diff --git a/daily_spellbook/models/chainlink/fantom/chainlink_fantom_automation_reward_daily.sql b/daily_spellbook/models/chainlink/fantom/chainlink_fantom_automation_reward_daily.sql index cee42124c30..35c2f11cc08 100644 --- a/daily_spellbook/models/chainlink/fantom/chainlink_fantom_automation_reward_daily.sql +++ b/daily_spellbook/models/chainlink/fantom/chainlink_fantom_automation_reward_daily.sql @@ -1,6 +1,6 @@ {{ config( - + alias='automation_reward_daily', partition_by = ['date_month'], materialized = 'incremental', @@ -10,7 +10,6 @@ ) }} -{% set incremental_interval = '7' %} WITH link_usd_daily AS ( @@ -20,21 +19,21 @@ WITH FROM {{ source('prices', 'usd') }} price WHERE - price.symbol = 'LINK' + price.symbol = 'LINK' GROUP BY 1 ORDER BY 1 ), automation_reward_daily AS ( - SELECT + SELECT automation_performed_daily.date_start, cast(date_trunc('month', automation_performed_daily.date_start) as date) as date_month, automation_performed_daily.operator_name, - automation_performed_daily.keeper_address, + automation_performed_daily.keeper_address, automation_performed_daily.token_amount as token_amount, (automation_performed_daily.token_amount * lud.usd_amount) as usd_amount - FROM + FROM {{ref('chainlink_fantom_automation_performed_daily')}} automation_performed_daily LEFT JOIN link_usd_daily lud ON lud.date_start = automation_performed_daily.date_start ORDER BY date_start @@ -47,7 +46,7 @@ SELECT keeper_address, token_amount, usd_amount -FROM +FROM automation_reward_daily ORDER BY 2, 5 diff --git a/daily_spellbook/models/chainlink/fantom/chainlink_fantom_fm_fulfilled_transactions.sql b/daily_spellbook/models/chainlink/fantom/chainlink_fantom_fm_fulfilled_transactions.sql index a26bac9c46f..880feb281fe 100644 --- a/daily_spellbook/models/chainlink/fantom/chainlink_fantom_fm_fulfilled_transactions.sql +++ b/daily_spellbook/models/chainlink/fantom/chainlink_fantom_fm_fulfilled_transactions.sql @@ -1,16 +1,16 @@ {{ config( - + alias='fm_fulfilled_transactions', partition_by=['date_month'], materialized='incremental', file_format='delta', incremental_strategy='merge', - unique_key=['tx_hash', 'tx_index', 'node_address'] + unique_key=['tx_hash', 'tx_index', 'node_address'], + incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.block_time')] ) }} -{% set incremental_interval = '7' %} WITH fantom_usd AS ( @@ -22,8 +22,8 @@ WITH WHERE symbol = 'FTM' {% if is_incremental() %} - AND minute >= date_trunc('day', now() - interval '{{incremental_interval}}' day) - {% endif %} + AND {{ incremental_predicate('minute') }} + {% endif %} ), fm_submission_transactions AS ( SELECT @@ -40,12 +40,12 @@ WITH {{ source('fantom', 'transactions') }} tx RIGHT JOIN {{ ref('chainlink_fantom_fm_gas_submission_logs') }} fm_gas_submission_logs ON fm_gas_submission_logs.tx_hash = tx.hash {% if is_incremental() %} - AND fm_gas_submission_logs.block_time >= date_trunc('day', now() - interval '{{incremental_interval}}' day) + AND {{ incremental_predicate('fm_gas_submission_logs.block_time') }} {% endif %} LEFT JOIN fantom_usd ON date_trunc('minute', tx.block_time) = fantom_usd.block_time {% if is_incremental() %} - WHERE tx.block_time >= date_trunc('day', now() - interval '{{incremental_interval}}' day) - {% endif %} + WHERE {{ incremental_predicate('tx.block_time') }} + {% endif %} GROUP BY tx.hash, tx.index, diff --git a/daily_spellbook/models/chainlink/fantom/chainlink_fantom_fm_gas_daily.sql b/daily_spellbook/models/chainlink/fantom/chainlink_fantom_fm_gas_daily.sql index e83d34a11b0..d3593d33fd9 100644 --- a/daily_spellbook/models/chainlink/fantom/chainlink_fantom_fm_gas_daily.sql +++ b/daily_spellbook/models/chainlink/fantom/chainlink_fantom_fm_gas_daily.sql @@ -1,6 +1,6 @@ {{ config( - + alias='fm_gas_daily', partition_by=['date_month'], materialized='incremental', @@ -10,7 +10,6 @@ ) }} -{% set incremental_interval = '7' %} {% set truncate_by = 'day' %} WITH @@ -24,7 +23,7 @@ WITH {{ ref('chainlink_fantom_fm_fulfilled_transactions') }} fulfilled {% if is_incremental() %} WHERE - fulfilled.block_time >= date_trunc('day', now() - interval '{{incremental_interval}}' day) + {{ incremental_predicate('fulfilled.block_time') }} {% endif %} GROUP BY 1, 2 @@ -41,7 +40,7 @@ WITH {{ ref('chainlink_fantom_fm_reverted_transactions') }} reverted {% if is_incremental() %} WHERE - reverted.block_time >= date_trunc('day', now() - interval '{{incremental_interval}}' day) + {{ incremental_predicate('reverted.block_time') }} {% endif %} GROUP BY 1, 2 @@ -53,7 +52,7 @@ WITH COALESCE( fulfilled.date_start, reverted.date_start - ) AS "date_start", + ) AS "date_start", COALESCE( fulfilled.node_address, reverted.node_address @@ -86,7 +85,7 @@ WITH FROM fm_gas_daily_meta LEFT JOIN {{ ref('chainlink_fantom_ocr_operator_node_meta') }} fm_operator_node_meta ON fm_operator_node_meta.node_address = fm_gas_daily_meta.node_address ) -SELECT +SELECT blockchain, date_start, date_month, @@ -97,7 +96,7 @@ SELECT reverted_token_amount, reverted_usd_amount, total_token_amount, - total_usd_amount + total_usd_amount FROM fm_gas_daily ORDER BY diff --git a/daily_spellbook/models/chainlink/fantom/chainlink_fantom_fm_request_daily.sql b/daily_spellbook/models/chainlink/fantom/chainlink_fantom_fm_request_daily.sql index 89eb8a9395d..d86de8bb550 100644 --- a/daily_spellbook/models/chainlink/fantom/chainlink_fantom_fm_request_daily.sql +++ b/daily_spellbook/models/chainlink/fantom/chainlink_fantom_fm_request_daily.sql @@ -1,6 +1,6 @@ {{ config( - + alias='fm_request_daily', partition_by=['date_month'], materialized='incremental', @@ -10,7 +10,6 @@ ) }} -{% set incremental_interval = '7' %} {% set truncate_by = 'day' %} WITH @@ -19,7 +18,7 @@ WITH COALESCE( cast(date_trunc('{{truncate_by}}', fulfilled.block_time) as date), cast(date_trunc('{{truncate_by}}', reverted.block_time) as date) - ) AS "date_start", + ) AS "date_start", COALESCE( fulfilled.node_address, reverted.node_address @@ -34,8 +33,8 @@ WITH reverted.node_address = fulfilled.node_address {% if is_incremental() %} WHERE - fulfilled.block_time >= date_trunc('day', now() - interval '{{incremental_interval}}' day) - AND reverted.block_time >= date_trunc('day', now() - interval '{{incremental_interval}}' day) + {{ incremental_predicate('fulfilled.block_time') }} + AND {{ incremental_predicate('reverted.block_time') }} {% endif %} GROUP BY 1, 2 @@ -55,7 +54,7 @@ WITH FROM fm_request_daily_meta LEFT JOIN {{ ref('chainlink_fantom_ocr_operator_node_meta') }} fm_operator_node_meta ON fm_operator_node_meta.node_address = fm_request_daily_meta.node_address ) -SELECT +SELECT blockchain, date_start, date_month, diff --git a/daily_spellbook/models/chainlink/fantom/chainlink_fantom_fm_reverted_transactions.sql b/daily_spellbook/models/chainlink/fantom/chainlink_fantom_fm_reverted_transactions.sql index eb8044f2ddb..51c546bf8c2 100644 --- a/daily_spellbook/models/chainlink/fantom/chainlink_fantom_fm_reverted_transactions.sql +++ b/daily_spellbook/models/chainlink/fantom/chainlink_fantom_fm_reverted_transactions.sql @@ -1,16 +1,16 @@ {{ config( - + alias='fm_reverted_transactions', partition_by=['date_month'], materialized='incremental', file_format='delta', incremental_strategy='merge', - unique_key=['tx_hash', 'tx_index', 'node_address'] + unique_key=['tx_hash', 'tx_index', 'node_address'], + incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.block_time')] ) }} -{% set incremental_interval = '7' %} WITH fantom_usd AS ( @@ -22,8 +22,8 @@ WITH WHERE symbol = 'FTM' {% if is_incremental() %} - AND minute >= date_trunc('day', now() - interval '{{incremental_interval}}' day) - {% endif %} + AND {{ incremental_predicate('minute') }} + {% endif %} ), fm_reverted_transactions AS ( SELECT @@ -42,8 +42,8 @@ WITH WHERE success = false {% if is_incremental() %} - AND tx.block_time >= date_trunc('day', now() - interval '{{incremental_interval}}' day) - {% endif %} + AND {{ incremental_predicate('tx.block_time') }} + {% endif %} GROUP BY tx.hash, tx.index, diff --git a/daily_spellbook/models/chainlink/fantom/chainlink_fantom_fm_reward_daily.sql b/daily_spellbook/models/chainlink/fantom/chainlink_fantom_fm_reward_daily.sql index 3ce0e7cc214..42e070cb272 100644 --- a/daily_spellbook/models/chainlink/fantom/chainlink_fantom_fm_reward_daily.sql +++ b/daily_spellbook/models/chainlink/fantom/chainlink_fantom_fm_reward_daily.sql @@ -1,6 +1,6 @@ {{ config( - + alias='fm_reward_daily', partition_by = ['date_month'], materialized = 'incremental', @@ -10,7 +10,6 @@ ) }} -{% set incremental_interval = '7' %} WITH admin_address_meta as ( @@ -28,8 +27,8 @@ WITH WHERE price.symbol = 'LINK' {% if is_incremental() %} - AND price.minute >= date_trunc('day', now() - interval '{{incremental_interval}}' day) - {% endif %} + AND {{ incremental_predicate('price.minute') }} + {% endif %} GROUP BY 1 ORDER BY @@ -77,16 +76,16 @@ WITH 1, 2 ), fm_reward_daily AS ( - SELECT + SELECT payment_meta.date_start, cast(date_trunc('month', payment_meta.date_start) as date) as date_month, payment_meta.admin_address, - ocr_operator_admin_meta.operator_name, + ocr_operator_admin_meta.operator_name, COALESCE(fm_reward_evt_transfer_daily.token_amount / EXTRACT(DAY FROM next_payment_date - prev_payment_date), 0) as token_amount, (COALESCE(fm_reward_evt_transfer_daily.token_amount / EXTRACT(DAY FROM next_payment_date - prev_payment_date), 0) * payment_meta.usd_amount) as usd_amount - FROM + FROM payment_meta - LEFT JOIN + LEFT JOIN {{ref('chainlink_fantom_fm_reward_evt_transfer_daily')}} fm_reward_evt_transfer_daily ON payment_meta.next_payment_date = fm_reward_evt_transfer_daily.date_start AND payment_meta.admin_address = fm_reward_evt_transfer_daily.admin_address @@ -101,7 +100,7 @@ SELECT operator_name, token_amount, usd_amount -FROM +FROM fm_reward_daily ORDER BY 2, 4 diff --git a/daily_spellbook/models/chainlink/fantom/chainlink_fantom_fm_reward_evt_transfer_daily.sql b/daily_spellbook/models/chainlink/fantom/chainlink_fantom_fm_reward_evt_transfer_daily.sql index 1a0a559bc99..cf7cde453be 100644 --- a/daily_spellbook/models/chainlink/fantom/chainlink_fantom_fm_reward_evt_transfer_daily.sql +++ b/daily_spellbook/models/chainlink/fantom/chainlink_fantom_fm_reward_evt_transfer_daily.sql @@ -1,6 +1,6 @@ {{ config( - + alias='fm_reward_evt_transfer_daily', partition_by=['date_month'], materialized='incremental', @@ -10,7 +10,6 @@ ) }} -{% set incremental_interval = '7' %} SELECT 'fantom' as blockchain, @@ -23,8 +22,8 @@ FROM {{ref('chainlink_fantom_fm_reward_evt_transfer')}} fm_reward_evt_transfer LEFT JOIN {{ ref('chainlink_fantom_ocr_operator_admin_meta') }} fm_operator_admin_meta ON fm_operator_admin_meta.admin_address = fm_reward_evt_transfer.admin_address {% if is_incremental() %} - WHERE evt_block_time >= date_trunc('day', now() - interval '{{incremental_interval}}' day) -{% endif %} + WHERE {{ incremental_predicate('evt_block_time') }} +{% endif %} GROUP BY 2, 4 ORDER BY diff --git a/daily_spellbook/models/chainlink/fantom/chainlink_fantom_ocr_fulfilled_transactions.sql b/daily_spellbook/models/chainlink/fantom/chainlink_fantom_ocr_fulfilled_transactions.sql index 6950202841f..7257e5e8620 100644 --- a/daily_spellbook/models/chainlink/fantom/chainlink_fantom_ocr_fulfilled_transactions.sql +++ b/daily_spellbook/models/chainlink/fantom/chainlink_fantom_ocr_fulfilled_transactions.sql @@ -1,12 +1,13 @@ {{ config( - + alias='ocr_fulfilled_transactions', partition_by=['date_month'], materialized='incremental', file_format='delta', incremental_strategy='merge', unique_key=['tx_hash', 'tx_index', 'node_address'], + incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.block_time')], post_hook='{{ expose_spells(\'["fantom"]\', "project", "chainlink", @@ -14,7 +15,6 @@ ) }} -{% set incremental_interval = '7' %} WITH fantom_usd AS ( @@ -26,8 +26,8 @@ WITH WHERE symbol = 'FTM' {% if is_incremental() %} - AND minute >= date_trunc('day', now() - interval '{{incremental_interval}}' day) - {% endif %} + AND {{ incremental_predicate('minute') }} + {% endif %} ), ocr_fulfilled_transactions AS ( SELECT @@ -43,8 +43,8 @@ WITH RIGHT JOIN {{ ref('chainlink_fantom_ocr_gas_transmission_logs') }} ocr_gas_transmission_logs ON ocr_gas_transmission_logs.tx_hash = tx.hash LEFT JOIN fantom_usd ON date_trunc('minute', tx.block_time) = fantom_usd.block_time {% if is_incremental() %} - WHERE tx.block_time >= date_trunc('day', now() - interval '{{incremental_interval}}' day) - {% endif %} + WHERE {{ incremental_predicate('tx.block_time') }} + {% endif %} GROUP BY tx.hash, tx.index, diff --git a/daily_spellbook/models/chainlink/fantom/chainlink_fantom_ocr_gas_daily.sql b/daily_spellbook/models/chainlink/fantom/chainlink_fantom_ocr_gas_daily.sql index c2ff4b9c077..1df90fb6a0e 100644 --- a/daily_spellbook/models/chainlink/fantom/chainlink_fantom_ocr_gas_daily.sql +++ b/daily_spellbook/models/chainlink/fantom/chainlink_fantom_ocr_gas_daily.sql @@ -1,6 +1,6 @@ {{ config( - + alias='ocr_gas_daily', partition_by=['date_month'], materialized='incremental', @@ -14,7 +14,6 @@ ) }} -{% set incremental_interval = '7' %} {% set truncate_by = 'day' %} WITH @@ -28,7 +27,7 @@ WITH {{ ref('chainlink_fantom_ocr_fulfilled_transactions') }} fulfilled {% if is_incremental() %} WHERE - fulfilled.block_time >= date_trunc('day', now() - interval '{{incremental_interval}}' day) + {{ incremental_predicate('fulfilled.block_time') }} {% endif %} GROUP BY 1, 2 @@ -45,7 +44,7 @@ WITH {{ ref('chainlink_fantom_ocr_reverted_transactions') }} reverted {% if is_incremental() %} WHERE - reverted.block_time >= date_trunc('day', now() - interval '{{incremental_interval}}' day) + {{ incremental_predicate('reverted.block_time') }} {% endif %} GROUP BY 1, 2 @@ -57,7 +56,7 @@ WITH COALESCE( fulfilled.date_start, reverted.date_start - ) AS "date_start", + ) AS "date_start", COALESCE( fulfilled.node_address, reverted.node_address @@ -90,7 +89,7 @@ WITH FROM ocr_gas_daily_meta LEFT JOIN {{ ref('chainlink_fantom_ocr_operator_node_meta') }} ocr_operator_node_meta ON ocr_operator_node_meta.node_address = ocr_gas_daily_meta.node_address ) -SELECT +SELECT blockchain, date_start, date_month, @@ -101,7 +100,7 @@ SELECT reverted_token_amount, reverted_usd_amount, total_token_amount, - total_usd_amount + total_usd_amount FROM ocr_gas_daily ORDER BY diff --git a/daily_spellbook/models/chainlink/fantom/chainlink_fantom_ocr_request_daily.sql b/daily_spellbook/models/chainlink/fantom/chainlink_fantom_ocr_request_daily.sql index 43397f22ea9..c34b837354d 100644 --- a/daily_spellbook/models/chainlink/fantom/chainlink_fantom_ocr_request_daily.sql +++ b/daily_spellbook/models/chainlink/fantom/chainlink_fantom_ocr_request_daily.sql @@ -1,6 +1,6 @@ {{ config( - + alias='ocr_request_daily', partition_by=['date_month'], materialized='incremental', @@ -14,7 +14,6 @@ ) }} -{% set incremental_interval = '7' %} {% set truncate_by = 'day' %} WITH @@ -23,7 +22,7 @@ WITH COALESCE( cast(date_trunc('{{truncate_by}}', fulfilled.block_time) as date), cast(date_trunc('{{truncate_by}}', reverted.block_time) as date) - ) AS "date_start", + ) AS "date_start", COALESCE( fulfilled.node_address, reverted.node_address @@ -38,8 +37,8 @@ WITH reverted.node_address = fulfilled.node_address {% if is_incremental() %} WHERE - fulfilled.block_time >= date_trunc('day', now() - interval '{{incremental_interval}}' day) - OR reverted.block_time >= date_trunc('day', now() - interval '{{incremental_interval}}' day) + {{ incremental_predicate('fulfilled.block_time') }} + OR {{ incremental_predicate('reverted.block_time') }} {% endif %} GROUP BY 1, 2 @@ -59,7 +58,7 @@ WITH FROM ocr_request_daily_meta LEFT JOIN {{ ref('chainlink_fantom_ocr_operator_node_meta') }} ocr_operator_node_meta ON ocr_operator_node_meta.node_address = ocr_request_daily_meta.node_address ) -SELECT +SELECT blockchain, date_start, date_month, diff --git a/daily_spellbook/models/chainlink/fantom/chainlink_fantom_ocr_reverted_transactions.sql b/daily_spellbook/models/chainlink/fantom/chainlink_fantom_ocr_reverted_transactions.sql index 39edc82083d..9e38677cf6b 100644 --- a/daily_spellbook/models/chainlink/fantom/chainlink_fantom_ocr_reverted_transactions.sql +++ b/daily_spellbook/models/chainlink/fantom/chainlink_fantom_ocr_reverted_transactions.sql @@ -1,12 +1,13 @@ {{ config( - + alias='ocr_reverted_transactions', partition_by=['date_month'], materialized='incremental', file_format='delta', incremental_strategy='merge', unique_key=['tx_hash', 'tx_index', 'node_address'], + incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.block_time')], post_hook='{{ expose_spells(\'["fantom"]\', "project", "chainlink", @@ -14,7 +15,6 @@ ) }} -{% set incremental_interval = '7' %} WITH fantom_usd AS ( @@ -26,8 +26,8 @@ WITH WHERE symbol = 'FTM' {% if is_incremental() %} - AND minute >= date_trunc('day', now() - interval '{{incremental_interval}}' day) - {% endif %} + AND {{ incremental_predicate('minute') }} + {% endif %} ), ocr_reverted_transactions AS ( SELECT @@ -44,8 +44,8 @@ WITH WHERE success = false {% if is_incremental() %} - AND tx.block_time >= date_trunc('day', now() - interval '{{incremental_interval}}' day) - {% endif %} + AND {{ incremental_predicate('tx.block_time') }} + {% endif %} GROUP BY tx.hash, tx.index, diff --git a/daily_spellbook/models/chainlink/fantom/chainlink_fantom_ocr_reward_daily.sql b/daily_spellbook/models/chainlink/fantom/chainlink_fantom_ocr_reward_daily.sql index 5bf03768b02..c7fc5334776 100644 --- a/daily_spellbook/models/chainlink/fantom/chainlink_fantom_ocr_reward_daily.sql +++ b/daily_spellbook/models/chainlink/fantom/chainlink_fantom_ocr_reward_daily.sql @@ -1,6 +1,6 @@ {{ config( - + alias='ocr_reward_daily', partition_by = ['date_month'], materialized = 'incremental', @@ -14,7 +14,6 @@ ) }} -{% set incremental_interval = '7' %} WITH admin_address_meta as ( @@ -32,8 +31,8 @@ WITH WHERE price.symbol = 'LINK' {% if is_incremental() %} - AND price.minute >= date_trunc('day', now() - interval '{{incremental_interval}}' day) - {% endif %} + AND {{ incremental_predicate('price.minute') }} + {% endif %} GROUP BY 1 ORDER BY @@ -81,16 +80,16 @@ WITH 1, 2 ), ocr_reward_daily AS ( - SELECT + SELECT payment_meta.date_start, cast(date_trunc('month', payment_meta.date_start) as date) as date_month, payment_meta.admin_address, - ocr_operator_admin_meta.operator_name, + ocr_operator_admin_meta.operator_name, COALESCE(ocr_reward_evt_transfer_daily.token_amount / EXTRACT(DAY FROM next_payment_date - prev_payment_date), 0) as token_amount, (COALESCE(ocr_reward_evt_transfer_daily.token_amount / EXTRACT(DAY FROM next_payment_date - prev_payment_date), 0) * payment_meta.usd_amount) as usd_amount - FROM + FROM payment_meta - LEFT JOIN + LEFT JOIN {{ref('chainlink_fantom_ocr_reward_evt_transfer_daily')}} ocr_reward_evt_transfer_daily ON payment_meta.next_payment_date = ocr_reward_evt_transfer_daily.date_start AND payment_meta.admin_address = ocr_reward_evt_transfer_daily.admin_address @@ -105,7 +104,7 @@ SELECT operator_name, token_amount, usd_amount -FROM +FROM ocr_reward_daily ORDER BY 2, 4 diff --git a/daily_spellbook/models/chainlink/fantom/chainlink_fantom_ocr_reward_evt_transfer_daily.sql b/daily_spellbook/models/chainlink/fantom/chainlink_fantom_ocr_reward_evt_transfer_daily.sql index a5c659402d7..59bbeed9b68 100644 --- a/daily_spellbook/models/chainlink/fantom/chainlink_fantom_ocr_reward_evt_transfer_daily.sql +++ b/daily_spellbook/models/chainlink/fantom/chainlink_fantom_ocr_reward_evt_transfer_daily.sql @@ -1,6 +1,6 @@ {{ config( - + alias='ocr_reward_evt_transfer_daily', partition_by=['date_month'], materialized='incremental', @@ -14,7 +14,6 @@ ) }} -{% set incremental_interval = '7' %} SELECT 'fantom' as blockchain, @@ -27,8 +26,8 @@ FROM {{ref('chainlink_fantom_ocr_reward_evt_transfer')}} ocr_reward_evt_transfer LEFT JOIN {{ ref('chainlink_fantom_ocr_operator_admin_meta') }} ocr_operator_admin_meta ON ocr_operator_admin_meta.admin_address = ocr_reward_evt_transfer.admin_address {% if is_incremental() %} - WHERE evt_block_time >= date_trunc('day', now() - interval '{{incremental_interval}}' day) -{% endif %} + WHERE {{ incremental_predicate('evt_block_time') }} +{% endif %} GROUP BY 2, 4 ORDER BY diff --git a/daily_spellbook/models/chainlink/fantom/chainlink_fantom_price_feeds.sql b/daily_spellbook/models/chainlink/fantom/chainlink_fantom_price_feeds.sql index b63d3f76706..ef688539641 100644 --- a/daily_spellbook/models/chainlink/fantom/chainlink_fantom_price_feeds.sql +++ b/daily_spellbook/models/chainlink/fantom/chainlink_fantom_price_feeds.sql @@ -1,6 +1,6 @@ {{ config( - + alias='price_feeds', partition_by=['block_month'], materialized='incremental', @@ -14,7 +14,6 @@ ) }} -{% set incremental_interval = '7' %} {% set project_start_date = '2019-12-28' %} SELECT 'fantom' as blockchain, @@ -27,11 +26,11 @@ SELECT 'fantom' as blockchain, c.proxy_address, c.aggregator_address, c.oracle_price / POWER(10, 0) as underlying_token_price, - CASE + CASE WHEN cardinality(split(c.feed_name, ' / ')) = 1 THEN c.feed_name ELSE element_at(split(c.feed_name, ' / '), 1) END AS base, - CASE + CASE WHEN cardinality(split(c.feed_name, ' / ')) = 1 THEN NULL ELSE element_at(split(c.feed_name, ' / '), 2) END AS quote @@ -39,14 +38,14 @@ FROM ( SELECT l.block_time, - cast(date_trunc('day', l.block_time) as date) as block_date, - cast(date_trunc('month', l.block_time) as date) as block_month, + cast(date_trunc('day', l.block_time) as date) as block_date, + cast(date_trunc('month', l.block_time) as date) as block_month, l.block_number, cfa.feed_name, cfa.proxy_address, MAX(cfa.aggregator_address) as aggregator_address, AVG( - CAST(bytearray_to_uint256(bytearray_substring(l.topic1, 3, 64)) as DOUBLE) + CAST(bytearray_to_uint256(bytearray_substring(l.topic1, 3, 64)) as DOUBLE) / POWER(10, cfa.decimals) ) as oracle_price FROM @@ -56,10 +55,10 @@ FROM WHERE l.topic0 = 0x0559884fd3a460db3073b7fc896cc77986f16e378210ded43186175bf646fc5f {% if not is_incremental() %} - AND l.block_time >= cast('{{project_start_date}}' as date) + AND l.block_time >= cast('{{project_start_date}}' as date) {% endif %} {% if is_incremental() %} - AND l.block_time >= date_trunc('day', now() - interval '{{incremental_interval}}' day) + AND {{ incremental_predicate('l.block_time') }} {% endif %} GROUP BY 1, 2, 3, 4, 5, 6 diff --git a/daily_spellbook/models/chainlink/fantom/chainlink_fantom_price_feeds_hourly.sql b/daily_spellbook/models/chainlink/fantom/chainlink_fantom_price_feeds_hourly.sql index 0b180bb1f4a..002b6607f8f 100644 --- a/daily_spellbook/models/chainlink/fantom/chainlink_fantom_price_feeds_hourly.sql +++ b/daily_spellbook/models/chainlink/fantom/chainlink_fantom_price_feeds_hourly.sql @@ -1,6 +1,6 @@ {{ config( - + alias='price_feeds_hourly', partition_by=['block_month'], materialized='incremental', @@ -11,7 +11,6 @@ ) }} -{% set incremental_interval = '7' %} {% set project_start_date = '2019-10-01' %} WITH hourly_sequence_meta AS ( @@ -25,7 +24,7 @@ WITH hourly_sequence_meta AS ( AND price.minute >= timestamp '{{project_start_date}}' {% endif %} {% if is_incremental() %} - AND price.minute >= date_trunc('hour', now() - interval '{{incremental_interval}}' day) + AND {{ incremental_predicate('price.minute') }} {% endif %} GROUP BY 1 @@ -70,7 +69,7 @@ aggregated_price_feeds AS ( hourly_sequence.hr >= timestamp '{{project_start_date}}' {% endif %} {% if is_incremental() %} - hourly_sequence.hr >= date_trunc('hour', now() - interval '{{incremental_interval}}' day) + {{ incremental_predicate('hourly_sequence.hr') }} {% endif %} GROUP BY hourly_sequence.hr, hourly_sequence.feed_name, hourly_sequence.proxy_address, hourly_sequence.aggregator_address diff --git a/daily_spellbook/models/chainlink/fantom/chainlink_fantom_vrf_fulfilled_transactions.sql b/daily_spellbook/models/chainlink/fantom/chainlink_fantom_vrf_fulfilled_transactions.sql index 162382d45b4..6bf7a88861e 100644 --- a/daily_spellbook/models/chainlink/fantom/chainlink_fantom_vrf_fulfilled_transactions.sql +++ b/daily_spellbook/models/chainlink/fantom/chainlink_fantom_vrf_fulfilled_transactions.sql @@ -1,12 +1,13 @@ {{ config( - + alias='vrf_fulfilled_transactions', partition_by=['date_month'], materialized='incremental', file_format='delta', incremental_strategy='merge', - unique_key=['tx_hash', 'tx_index', 'node_address'] + unique_key=['tx_hash', 'tx_index', 'node_address'], + incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.block_time')] ) }} @@ -22,7 +23,7 @@ WITH {% if is_incremental() %} AND {{ incremental_predicate('minute') }} - {% endif %} + {% endif %} ), vrf_fulfilled_transactions AS ( SELECT @@ -44,7 +45,7 @@ WITH {% if is_incremental() %} WHERE {{ incremental_predicate('tx.block_time') }} - {% endif %} + {% endif %} GROUP BY tx.hash, tx.index, @@ -71,7 +72,7 @@ WITH {% if is_incremental() %} WHERE {{ incremental_predicate('tx.block_time') }} - {% endif %} + {% endif %} GROUP BY tx.hash, tx.index, diff --git a/daily_spellbook/models/chainlink/fantom/chainlink_fantom_vrf_gas_daily.sql b/daily_spellbook/models/chainlink/fantom/chainlink_fantom_vrf_gas_daily.sql index 5a05d88528e..a16dfea86e4 100644 --- a/daily_spellbook/models/chainlink/fantom/chainlink_fantom_vrf_gas_daily.sql +++ b/daily_spellbook/models/chainlink/fantom/chainlink_fantom_vrf_gas_daily.sql @@ -1,6 +1,6 @@ {{ config( - + alias='vrf_gas_daily', partition_by=['date_month'], materialized='incremental', @@ -10,7 +10,6 @@ ) }} -{% set incremental_interval = '7' %} {% set truncate_by = 'day' %} WITH @@ -24,7 +23,7 @@ WITH {{ ref('chainlink_fantom_vrf_fulfilled_transactions') }} fulfilled {% if is_incremental() %} WHERE - fulfilled.block_time >= date_trunc('day', now() - interval '{{incremental_interval}}' day) + {{ incremental_predicate('fulfilled.block_time') }} {% endif %} GROUP BY 1, 2 @@ -41,7 +40,7 @@ WITH {{ ref('chainlink_fantom_vrf_reverted_transactions') }} reverted {% if is_incremental() %} WHERE - reverted.block_time >= date_trunc('day', now() - interval '{{incremental_interval}}' day) + {{ incremental_predicate('reverted.block_time') }} {% endif %} GROUP BY 1, 2 @@ -53,7 +52,7 @@ WITH COALESCE( fulfilled.date_start, reverted.date_start - ) AS "date_start", + ) AS "date_start", COALESCE( fulfilled.node_address, reverted.node_address @@ -84,7 +83,7 @@ WITH fulfilled_usd_amount + reverted_usd_amount as total_usd_amount FROM vrf_gas_daily_meta ) -SELECT +SELECT blockchain, date_start, date_month, @@ -94,7 +93,7 @@ SELECT reverted_token_amount, reverted_usd_amount, total_token_amount, - total_usd_amount + total_usd_amount FROM vrf_gas_daily ORDER BY diff --git a/daily_spellbook/models/chainlink/fantom/chainlink_fantom_vrf_request_daily.sql b/daily_spellbook/models/chainlink/fantom/chainlink_fantom_vrf_request_daily.sql index 82dd031219d..1131ed0618f 100644 --- a/daily_spellbook/models/chainlink/fantom/chainlink_fantom_vrf_request_daily.sql +++ b/daily_spellbook/models/chainlink/fantom/chainlink_fantom_vrf_request_daily.sql @@ -1,6 +1,6 @@ {{ config( - + alias='vrf_request_daily', partition_by=['date_month'], materialized='incremental', @@ -10,7 +10,6 @@ ) }} -{% set incremental_interval = '7' %} {% set truncate_by = 'day' %} WITH @@ -19,7 +18,7 @@ WITH COALESCE( cast(date_trunc('{{truncate_by}}', fulfilled.block_time) as date), cast(date_trunc('{{truncate_by}}', reverted.block_time) as date) - ) AS "date_start", + ) AS "date_start", COALESCE( fulfilled.node_address, reverted.node_address @@ -34,8 +33,8 @@ WITH reverted.node_address = fulfilled.node_address {% if is_incremental() %} WHERE - fulfilled.block_time >= date_trunc('day', now() - interval '{{incremental_interval}}' day) - AND reverted.block_time >= date_trunc('day', now() - interval '{{incremental_interval}}' day) + {{ incremental_predicate('fulfilled.block_time') }} + AND {{ incremental_predicate('reverted.block_time') }} {% endif %} GROUP BY 1, 2 @@ -53,7 +52,7 @@ WITH total_requests FROM vrf_request_daily_meta ) -SELECT +SELECT blockchain, date_start, date_month, diff --git a/daily_spellbook/models/chainlink/fantom/chainlink_fantom_vrf_request_fulfilled_daily.sql b/daily_spellbook/models/chainlink/fantom/chainlink_fantom_vrf_request_fulfilled_daily.sql index 8c43ab339e9..dba04306e19 100644 --- a/daily_spellbook/models/chainlink/fantom/chainlink_fantom_vrf_request_fulfilled_daily.sql +++ b/daily_spellbook/models/chainlink/fantom/chainlink_fantom_vrf_request_fulfilled_daily.sql @@ -1,6 +1,6 @@ {{ config( - + alias='vrf_request_fulfilled_daily', partition_by=['date_month'], materialized='incremental', @@ -10,7 +10,6 @@ ) }} -{% set incremental_interval = '7' %} SELECT 'fantom' as blockchain, @@ -21,8 +20,8 @@ SELECT FROM {{ref('chainlink_fantom_vrf_request_fulfilled')}} vrf_request_fulfilled {% if is_incremental() %} - WHERE evt_block_time >= date_trunc('day', now() - interval '{{incremental_interval}}' day) -{% endif %} + WHERE {{ incremental_predicate('evt_block_time') }} +{% endif %} GROUP BY 2, 4 ORDER BY diff --git a/daily_spellbook/models/chainlink/fantom/chainlink_fantom_vrf_reverted_transactions.sql b/daily_spellbook/models/chainlink/fantom/chainlink_fantom_vrf_reverted_transactions.sql index 30798cb6377..f52f2456e1e 100644 --- a/daily_spellbook/models/chainlink/fantom/chainlink_fantom_vrf_reverted_transactions.sql +++ b/daily_spellbook/models/chainlink/fantom/chainlink_fantom_vrf_reverted_transactions.sql @@ -1,16 +1,16 @@ {{ config( - + alias='vrf_reverted_transactions', partition_by=['date_month'], materialized='incremental', file_format='delta', incremental_strategy='merge', - unique_key=['tx_hash', 'tx_index', 'node_address'] + unique_key=['tx_hash', 'tx_index', 'node_address'], + incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.block_time')] ) }} -{% set incremental_interval = '7' %} WITH fantom_usd AS ( @@ -22,8 +22,8 @@ WITH WHERE symbol = 'FTM' {% if is_incremental() %} - AND minute >= date_trunc('day', now() - interval '{{incremental_interval}}' day) - {% endif %} + AND {{ incremental_predicate('minute') }} + {% endif %} ), vrf_reverted_transactions AS ( SELECT @@ -42,8 +42,8 @@ WITH WHERE success = false {% if is_incremental() %} - AND tx.block_time >= date_trunc('day', now() - interval '{{incremental_interval}}' day) - {% endif %} + AND {{ incremental_predicate('tx.block_time') }} + {% endif %} GROUP BY tx.hash, tx.index, diff --git a/daily_spellbook/models/chainlink/fantom/chainlink_fantom_vrf_reward_daily.sql b/daily_spellbook/models/chainlink/fantom/chainlink_fantom_vrf_reward_daily.sql index dca7f658f09..4d0a3736e8e 100644 --- a/daily_spellbook/models/chainlink/fantom/chainlink_fantom_vrf_reward_daily.sql +++ b/daily_spellbook/models/chainlink/fantom/chainlink_fantom_vrf_reward_daily.sql @@ -1,6 +1,6 @@ {{ config( - + alias='vrf_reward_daily', partition_by = ['date_month'], materialized = 'incremental', @@ -10,7 +10,6 @@ ) }} -{% set incremental_interval = '7' %} WITH link_usd_daily AS ( @@ -20,20 +19,20 @@ WITH FROM {{ source('prices', 'usd') }} price WHERE - price.symbol = 'LINK' + price.symbol = 'LINK' GROUP BY 1 ORDER BY 1 ), vrf_reward_daily AS ( - SELECT + SELECT vrf_daily.date_start, cast(date_trunc('month', vrf_daily.date_start) as date) as date_month, - vrf_daily.operator_address, + vrf_daily.operator_address, COALESCE(vrf_daily.token_amount, 0) as token_amount, COALESCE(vrf_daily.token_amount * lud.usd_amount, 0) as usd_amount - FROM + FROM {{ref('chainlink_fantom_vrf_request_fulfilled_daily')}} vrf_daily LEFT JOIN link_usd_daily lud ON lud.date_start = vrf_daily.date_start ORDER BY date_start @@ -45,7 +44,7 @@ SELECT operator_address, token_amount, usd_amount -FROM +FROM vrf_reward_daily ORDER BY 2, 4 diff --git a/daily_spellbook/models/chainlink/gnosis/chainlink_gnosis_fm_fulfilled_transactions.sql b/daily_spellbook/models/chainlink/gnosis/chainlink_gnosis_fm_fulfilled_transactions.sql index 776fda83a41..5c4c3866117 100644 --- a/daily_spellbook/models/chainlink/gnosis/chainlink_gnosis_fm_fulfilled_transactions.sql +++ b/daily_spellbook/models/chainlink/gnosis/chainlink_gnosis_fm_fulfilled_transactions.sql @@ -1,16 +1,16 @@ {{ config( - + alias='fm_fulfilled_transactions', partition_by=['date_month'], materialized='incremental', file_format='delta', incremental_strategy='merge', - unique_key=['tx_hash', 'tx_index', 'node_address'] + unique_key=['tx_hash', 'tx_index', 'node_address'], + incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.block_time')] ) }} -{% set incremental_interval = '7' %} WITH gnosis_usd AS ( @@ -22,8 +22,8 @@ WITH WHERE symbol = 'XDAI' {% if is_incremental() %} - AND minute >= date_trunc('day', now() - interval '{{incremental_interval}}' day) - {% endif %} + AND {{ incremental_predicate('minute') }} + {% endif %} ), fm_submission_transactions AS ( SELECT @@ -40,12 +40,12 @@ WITH {{ source('gnosis', 'transactions') }} tx RIGHT JOIN {{ ref('chainlink_gnosis_fm_gas_submission_logs') }} fm_gas_submission_logs ON fm_gas_submission_logs.tx_hash = tx.hash {% if is_incremental() %} - AND fm_gas_submission_logs.block_time >= date_trunc('day', now() - interval '{{incremental_interval}}' day) + AND {{ incremental_predicate('fm_gas_submission_logs.block_time') }} {% endif %} LEFT JOIN gnosis_usd ON date_trunc('minute', tx.block_time) = gnosis_usd.block_time {% if is_incremental() %} - WHERE tx.block_time >= date_trunc('day', now() - interval '{{incremental_interval}}' day) - {% endif %} + WHERE {{ incremental_predicate('tx.block_time') }} + {% endif %} GROUP BY tx.hash, tx.index, diff --git a/daily_spellbook/models/chainlink/gnosis/chainlink_gnosis_fm_gas_daily.sql b/daily_spellbook/models/chainlink/gnosis/chainlink_gnosis_fm_gas_daily.sql index 3cbb8de22e5..da30d0e6917 100644 --- a/daily_spellbook/models/chainlink/gnosis/chainlink_gnosis_fm_gas_daily.sql +++ b/daily_spellbook/models/chainlink/gnosis/chainlink_gnosis_fm_gas_daily.sql @@ -1,6 +1,6 @@ {{ config( - + alias='fm_gas_daily', partition_by=['date_month'], materialized='incremental', @@ -10,7 +10,6 @@ ) }} -{% set incremental_interval = '7' %} {% set truncate_by = 'day' %} WITH @@ -24,7 +23,7 @@ WITH {{ ref('chainlink_gnosis_fm_fulfilled_transactions') }} fulfilled {% if is_incremental() %} WHERE - fulfilled.block_time >= date_trunc('day', now() - interval '{{incremental_interval}}' day) + {{ incremental_predicate('fulfilled.block_time') }} {% endif %} GROUP BY 1, 2 @@ -41,7 +40,7 @@ WITH {{ ref('chainlink_gnosis_fm_reverted_transactions') }} reverted {% if is_incremental() %} WHERE - reverted.block_time >= date_trunc('day', now() - interval '{{incremental_interval}}' day) + {{ incremental_predicate('reverted.block_time') }} {% endif %} GROUP BY 1, 2 @@ -53,7 +52,7 @@ WITH COALESCE( fulfilled.date_start, reverted.date_start - ) AS "date_start", + ) AS "date_start", COALESCE( fulfilled.node_address, reverted.node_address @@ -86,7 +85,7 @@ WITH FROM fm_gas_daily_meta LEFT JOIN {{ ref('chainlink_gnosis_ocr_operator_node_meta') }} fm_operator_node_meta ON fm_operator_node_meta.node_address = fm_gas_daily_meta.node_address ) -SELECT +SELECT blockchain, date_start, date_month, @@ -97,7 +96,7 @@ SELECT reverted_token_amount, reverted_usd_amount, total_token_amount, - total_usd_amount + total_usd_amount FROM fm_gas_daily ORDER BY diff --git a/daily_spellbook/models/chainlink/gnosis/chainlink_gnosis_fm_request_daily.sql b/daily_spellbook/models/chainlink/gnosis/chainlink_gnosis_fm_request_daily.sql index f14dec0727f..74c2c19c145 100644 --- a/daily_spellbook/models/chainlink/gnosis/chainlink_gnosis_fm_request_daily.sql +++ b/daily_spellbook/models/chainlink/gnosis/chainlink_gnosis_fm_request_daily.sql @@ -1,6 +1,6 @@ {{ config( - + alias='fm_request_daily', partition_by=['date_month'], materialized='incremental', @@ -10,7 +10,6 @@ ) }} -{% set incremental_interval = '7' %} {% set truncate_by = 'day' %} WITH @@ -19,7 +18,7 @@ WITH COALESCE( cast(date_trunc('{{truncate_by}}', fulfilled.block_time) as date), cast(date_trunc('{{truncate_by}}', reverted.block_time) as date) - ) AS "date_start", + ) AS "date_start", COALESCE( fulfilled.node_address, reverted.node_address @@ -34,8 +33,8 @@ WITH reverted.node_address = fulfilled.node_address {% if is_incremental() %} WHERE - fulfilled.block_time >= date_trunc('day', now() - interval '{{incremental_interval}}' day) - AND reverted.block_time >= date_trunc('day', now() - interval '{{incremental_interval}}' day) + {{ incremental_predicate('fulfilled.block_time') }} + AND {{ incremental_predicate('reverted.block_time') }} {% endif %} GROUP BY 1, 2 @@ -55,7 +54,7 @@ WITH FROM fm_request_daily_meta LEFT JOIN {{ ref('chainlink_gnosis_ocr_operator_node_meta') }} fm_operator_node_meta ON fm_operator_node_meta.node_address = fm_request_daily_meta.node_address ) -SELECT +SELECT blockchain, date_start, date_month, diff --git a/daily_spellbook/models/chainlink/gnosis/chainlink_gnosis_fm_reverted_transactions.sql b/daily_spellbook/models/chainlink/gnosis/chainlink_gnosis_fm_reverted_transactions.sql index 7b3db834e7b..769356358b1 100644 --- a/daily_spellbook/models/chainlink/gnosis/chainlink_gnosis_fm_reverted_transactions.sql +++ b/daily_spellbook/models/chainlink/gnosis/chainlink_gnosis_fm_reverted_transactions.sql @@ -1,16 +1,16 @@ {{ config( - + alias='fm_reverted_transactions', partition_by=['date_month'], materialized='incremental', file_format='delta', incremental_strategy='merge', - unique_key=['tx_hash', 'tx_index', 'node_address'] + unique_key=['tx_hash', 'tx_index', 'node_address'], + incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.block_time')] ) }} -{% set incremental_interval = '7' %} WITH gnosis_usd AS ( @@ -22,8 +22,8 @@ WITH WHERE symbol = 'XDAI' {% if is_incremental() %} - AND minute >= date_trunc('day', now() - interval '{{incremental_interval}}' day) - {% endif %} + AND {{ incremental_predicate('minute') }} + {% endif %} ), fm_reverted_transactions AS ( SELECT @@ -42,8 +42,8 @@ WITH WHERE success = false {% if is_incremental() %} - AND tx.block_time >= date_trunc('day', now() - interval '{{incremental_interval}}' day) - {% endif %} + AND {{ incremental_predicate('tx.block_time') }} + {% endif %} GROUP BY tx.hash, tx.index, diff --git a/daily_spellbook/models/chainlink/gnosis/chainlink_gnosis_fm_reward_daily.sql b/daily_spellbook/models/chainlink/gnosis/chainlink_gnosis_fm_reward_daily.sql index ed0f66ec022..7b36d984e27 100644 --- a/daily_spellbook/models/chainlink/gnosis/chainlink_gnosis_fm_reward_daily.sql +++ b/daily_spellbook/models/chainlink/gnosis/chainlink_gnosis_fm_reward_daily.sql @@ -1,6 +1,6 @@ {{ config( - + alias='fm_reward_daily', partition_by = ['date_month'], materialized = 'incremental', @@ -10,7 +10,6 @@ ) }} -{% set incremental_interval = '7' %} WITH admin_address_meta as ( @@ -28,8 +27,8 @@ WITH WHERE price.symbol = 'LINK' {% if is_incremental() %} - AND price.minute >= date_trunc('day', now() - interval '{{incremental_interval}}' day) - {% endif %} + AND {{ incremental_predicate('price.minute') }} + {% endif %} GROUP BY 1 ORDER BY @@ -77,16 +76,16 @@ WITH 1, 2 ), fm_reward_daily AS ( - SELECT + SELECT payment_meta.date_start, cast(date_trunc('month', payment_meta.date_start) as date) as date_month, payment_meta.admin_address, - ocr_operator_admin_meta.operator_name, + ocr_operator_admin_meta.operator_name, COALESCE(fm_reward_evt_transfer_daily.token_amount / EXTRACT(DAY FROM next_payment_date - prev_payment_date), 0) as token_amount, (COALESCE(fm_reward_evt_transfer_daily.token_amount / EXTRACT(DAY FROM next_payment_date - prev_payment_date), 0) * payment_meta.usd_amount) as usd_amount - FROM + FROM payment_meta - LEFT JOIN + LEFT JOIN {{ref('chainlink_gnosis_fm_reward_evt_transfer_daily')}} fm_reward_evt_transfer_daily ON payment_meta.next_payment_date = fm_reward_evt_transfer_daily.date_start AND payment_meta.admin_address = fm_reward_evt_transfer_daily.admin_address @@ -101,7 +100,7 @@ SELECT operator_name, token_amount, usd_amount -FROM +FROM fm_reward_daily ORDER BY 2, 4 diff --git a/daily_spellbook/models/chainlink/gnosis/chainlink_gnosis_fm_reward_evt_transfer_daily.sql b/daily_spellbook/models/chainlink/gnosis/chainlink_gnosis_fm_reward_evt_transfer_daily.sql index 62c6ffeeea7..243885f30ee 100644 --- a/daily_spellbook/models/chainlink/gnosis/chainlink_gnosis_fm_reward_evt_transfer_daily.sql +++ b/daily_spellbook/models/chainlink/gnosis/chainlink_gnosis_fm_reward_evt_transfer_daily.sql @@ -1,6 +1,6 @@ {{ config( - + alias='fm_reward_evt_transfer_daily', partition_by=['date_month'], materialized='incremental', @@ -10,7 +10,6 @@ ) }} -{% set incremental_interval = '7' %} SELECT 'gnosis' as blockchain, @@ -23,8 +22,8 @@ FROM {{ref('chainlink_gnosis_fm_reward_evt_transfer')}} fm_reward_evt_transfer LEFT JOIN {{ ref('chainlink_gnosis_ocr_operator_admin_meta') }} fm_operator_admin_meta ON fm_operator_admin_meta.admin_address = fm_reward_evt_transfer.admin_address {% if is_incremental() %} - WHERE evt_block_time >= date_trunc('day', now() - interval '{{incremental_interval}}' day) -{% endif %} + WHERE {{ incremental_predicate('evt_block_time') }} +{% endif %} GROUP BY 2, 4 ORDER BY diff --git a/daily_spellbook/models/chainlink/gnosis/chainlink_gnosis_ocr_fulfilled_transactions.sql b/daily_spellbook/models/chainlink/gnosis/chainlink_gnosis_ocr_fulfilled_transactions.sql index a08c4423068..56fc8c4456b 100644 --- a/daily_spellbook/models/chainlink/gnosis/chainlink_gnosis_ocr_fulfilled_transactions.sql +++ b/daily_spellbook/models/chainlink/gnosis/chainlink_gnosis_ocr_fulfilled_transactions.sql @@ -1,12 +1,13 @@ {{ config( - + alias='ocr_fulfilled_transactions', partition_by=['date_month'], materialized='incremental', file_format='delta', incremental_strategy='merge', unique_key=['tx_hash', 'tx_index', 'node_address'], + incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.block_time')], post_hook='{{ expose_spells(\'["gnosis"]\', "project", "chainlink", @@ -14,7 +15,6 @@ ) }} -{% set incremental_interval = '7' %} WITH gnosis_usd AS ( @@ -26,8 +26,8 @@ WITH WHERE symbol = 'XDAI' {% if is_incremental() %} - AND minute >= date_trunc('day', now() - interval '{{incremental_interval}}' day) - {% endif %} + AND {{ incremental_predicate('minute') }} + {% endif %} ), ocr_fulfilled_transactions AS ( SELECT @@ -43,8 +43,8 @@ WITH RIGHT JOIN {{ ref('chainlink_gnosis_ocr_gas_transmission_logs') }} ocr_gas_transmission_logs ON ocr_gas_transmission_logs.tx_hash = tx.hash LEFT JOIN gnosis_usd ON date_trunc('minute', tx.block_time) = gnosis_usd.block_time {% if is_incremental() %} - WHERE tx.block_time >= date_trunc('day', now() - interval '{{incremental_interval}}' day) - {% endif %} + WHERE {{ incremental_predicate('tx.block_time') }} + {% endif %} GROUP BY tx.hash, tx.index, diff --git a/daily_spellbook/models/chainlink/gnosis/chainlink_gnosis_ocr_gas_daily.sql b/daily_spellbook/models/chainlink/gnosis/chainlink_gnosis_ocr_gas_daily.sql index 4a059fa1085..f48c27f1db7 100644 --- a/daily_spellbook/models/chainlink/gnosis/chainlink_gnosis_ocr_gas_daily.sql +++ b/daily_spellbook/models/chainlink/gnosis/chainlink_gnosis_ocr_gas_daily.sql @@ -1,6 +1,6 @@ {{ config( - + alias='ocr_gas_daily', partition_by=['date_month'], materialized='incremental', @@ -14,7 +14,6 @@ ) }} -{% set incremental_interval = '7' %} {% set truncate_by = 'day' %} WITH @@ -28,7 +27,7 @@ WITH {{ ref('chainlink_gnosis_ocr_fulfilled_transactions') }} fulfilled {% if is_incremental() %} WHERE - fulfilled.block_time >= date_trunc('day', now() - interval '{{incremental_interval}}' day) + {{ incremental_predicate('fulfilled.block_time') }} {% endif %} GROUP BY 1, 2 @@ -45,7 +44,7 @@ WITH {{ ref('chainlink_gnosis_ocr_reverted_transactions') }} reverted {% if is_incremental() %} WHERE - reverted.block_time >= date_trunc('day', now() - interval '{{incremental_interval}}' day) + {{ incremental_predicate('reverted.block_time') }} {% endif %} GROUP BY 1, 2 @@ -57,7 +56,7 @@ WITH COALESCE( fulfilled.date_start, reverted.date_start - ) AS "date_start", + ) AS "date_start", COALESCE( fulfilled.node_address, reverted.node_address @@ -90,7 +89,7 @@ WITH FROM ocr_gas_daily_meta LEFT JOIN {{ ref('chainlink_gnosis_ocr_operator_node_meta') }} ocr_operator_node_meta ON ocr_operator_node_meta.node_address = ocr_gas_daily_meta.node_address ) -SELECT +SELECT blockchain, date_start, date_month, @@ -101,7 +100,7 @@ SELECT reverted_token_amount, reverted_usd_amount, total_token_amount, - total_usd_amount + total_usd_amount FROM ocr_gas_daily ORDER BY diff --git a/daily_spellbook/models/chainlink/gnosis/chainlink_gnosis_ocr_request_daily.sql b/daily_spellbook/models/chainlink/gnosis/chainlink_gnosis_ocr_request_daily.sql index b314cf64f5c..b76183f8ef8 100644 --- a/daily_spellbook/models/chainlink/gnosis/chainlink_gnosis_ocr_request_daily.sql +++ b/daily_spellbook/models/chainlink/gnosis/chainlink_gnosis_ocr_request_daily.sql @@ -1,6 +1,6 @@ {{ config( - + alias='ocr_request_daily', partition_by=['date_month'], materialized='incremental', @@ -14,7 +14,6 @@ ) }} -{% set incremental_interval = '7' %} {% set truncate_by = 'day' %} WITH @@ -23,7 +22,7 @@ WITH COALESCE( cast(date_trunc('{{truncate_by}}', fulfilled.block_time) as date), cast(date_trunc('{{truncate_by}}', reverted.block_time) as date) - ) AS "date_start", + ) AS "date_start", COALESCE( fulfilled.node_address, reverted.node_address @@ -38,8 +37,8 @@ WITH reverted.node_address = fulfilled.node_address {% if is_incremental() %} WHERE - fulfilled.block_time >= date_trunc('day', now() - interval '{{incremental_interval}}' day) - OR reverted.block_time >= date_trunc('day', now() - interval '{{incremental_interval}}' day) + {{ incremental_predicate('fulfilled.block_time') }} + OR {{ incremental_predicate('reverted.block_time') }} {% endif %} GROUP BY 1, 2 @@ -59,7 +58,7 @@ WITH FROM ocr_request_daily_meta LEFT JOIN {{ ref('chainlink_gnosis_ocr_operator_node_meta') }} ocr_operator_node_meta ON ocr_operator_node_meta.node_address = ocr_request_daily_meta.node_address ) -SELECT +SELECT blockchain, date_start, date_month, diff --git a/daily_spellbook/models/chainlink/gnosis/chainlink_gnosis_ocr_reverted_transactions.sql b/daily_spellbook/models/chainlink/gnosis/chainlink_gnosis_ocr_reverted_transactions.sql index a7d874de40b..9a8b34d1563 100644 --- a/daily_spellbook/models/chainlink/gnosis/chainlink_gnosis_ocr_reverted_transactions.sql +++ b/daily_spellbook/models/chainlink/gnosis/chainlink_gnosis_ocr_reverted_transactions.sql @@ -1,12 +1,13 @@ {{ config( - + alias='ocr_reverted_transactions', partition_by=['date_month'], materialized='incremental', file_format='delta', incremental_strategy='merge', unique_key=['tx_hash', 'tx_index', 'node_address'], + incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.block_time')], post_hook='{{ expose_spells(\'["gnosis"]\', "project", "chainlink", @@ -14,7 +15,6 @@ ) }} -{% set incremental_interval = '7' %} WITH gnosis_usd AS ( @@ -26,8 +26,8 @@ WITH WHERE symbol = 'XDAI' {% if is_incremental() %} - AND minute >= date_trunc('day', now() - interval '{{incremental_interval}}' day) - {% endif %} + AND {{ incremental_predicate('minute') }} + {% endif %} ), ocr_reverted_transactions AS ( SELECT @@ -44,8 +44,8 @@ WITH WHERE success = false {% if is_incremental() %} - AND tx.block_time >= date_trunc('day', now() - interval '{{incremental_interval}}' day) - {% endif %} + AND {{ incremental_predicate('tx.block_time') }} + {% endif %} GROUP BY tx.hash, tx.index, diff --git a/daily_spellbook/models/chainlink/gnosis/chainlink_gnosis_ocr_reward_daily.sql b/daily_spellbook/models/chainlink/gnosis/chainlink_gnosis_ocr_reward_daily.sql index 61246871f78..6e5278575b2 100644 --- a/daily_spellbook/models/chainlink/gnosis/chainlink_gnosis_ocr_reward_daily.sql +++ b/daily_spellbook/models/chainlink/gnosis/chainlink_gnosis_ocr_reward_daily.sql @@ -1,6 +1,6 @@ {{ config( - + alias='ocr_reward_daily', partition_by = ['date_month'], materialized = 'incremental', @@ -14,7 +14,6 @@ ) }} -{% set incremental_interval = '7' %} WITH admin_address_meta as ( @@ -32,8 +31,8 @@ WITH WHERE price.symbol = 'LINK' {% if is_incremental() %} - AND price.minute >= date_trunc('day', now() - interval '{{incremental_interval}}' day) - {% endif %} + AND {{ incremental_predicate('price.minute') }} + {% endif %} GROUP BY 1 ORDER BY @@ -81,16 +80,16 @@ WITH 1, 2 ), ocr_reward_daily AS ( - SELECT + SELECT payment_meta.date_start, cast(date_trunc('month', payment_meta.date_start) as date) as date_month, payment_meta.admin_address, - ocr_operator_admin_meta.operator_name, + ocr_operator_admin_meta.operator_name, COALESCE(ocr_reward_evt_transfer_daily.token_amount / EXTRACT(DAY FROM next_payment_date - prev_payment_date), 0) as token_amount, (COALESCE(ocr_reward_evt_transfer_daily.token_amount / EXTRACT(DAY FROM next_payment_date - prev_payment_date), 0) * payment_meta.usd_amount) as usd_amount - FROM + FROM payment_meta - LEFT JOIN + LEFT JOIN {{ref('chainlink_gnosis_ocr_reward_evt_transfer_daily')}} ocr_reward_evt_transfer_daily ON payment_meta.next_payment_date = ocr_reward_evt_transfer_daily.date_start AND payment_meta.admin_address = ocr_reward_evt_transfer_daily.admin_address @@ -105,7 +104,7 @@ SELECT operator_name, token_amount, usd_amount -FROM +FROM ocr_reward_daily ORDER BY 2, 4 diff --git a/daily_spellbook/models/chainlink/gnosis/chainlink_gnosis_ocr_reward_evt_transfer_daily.sql b/daily_spellbook/models/chainlink/gnosis/chainlink_gnosis_ocr_reward_evt_transfer_daily.sql index 7622d830cad..29dadec4ff3 100644 --- a/daily_spellbook/models/chainlink/gnosis/chainlink_gnosis_ocr_reward_evt_transfer_daily.sql +++ b/daily_spellbook/models/chainlink/gnosis/chainlink_gnosis_ocr_reward_evt_transfer_daily.sql @@ -1,6 +1,6 @@ {{ config( - + alias='ocr_reward_evt_transfer_daily', partition_by=['date_month'], materialized='incremental', @@ -14,7 +14,6 @@ ) }} -{% set incremental_interval = '7' %} SELECT 'gnosis' as blockchain, @@ -27,8 +26,8 @@ FROM {{ref('chainlink_gnosis_ocr_reward_evt_transfer')}} ocr_reward_evt_transfer LEFT JOIN {{ ref('chainlink_gnosis_ocr_operator_admin_meta') }} ocr_operator_admin_meta ON ocr_operator_admin_meta.admin_address = ocr_reward_evt_transfer.admin_address {% if is_incremental() %} - WHERE evt_block_time >= date_trunc('day', now() - interval '{{incremental_interval}}' day) -{% endif %} + WHERE {{ incremental_predicate('evt_block_time') }} +{% endif %} GROUP BY 2, 4 ORDER BY diff --git a/daily_spellbook/models/chainlink/gnosis/chainlink_gnosis_price_feeds.sql b/daily_spellbook/models/chainlink/gnosis/chainlink_gnosis_price_feeds.sql index 998e9e90d67..a60f2493607 100644 --- a/daily_spellbook/models/chainlink/gnosis/chainlink_gnosis_price_feeds.sql +++ b/daily_spellbook/models/chainlink/gnosis/chainlink_gnosis_price_feeds.sql @@ -1,6 +1,6 @@ {{ config( - + alias='price_feeds', partition_by=['block_month'], materialized='incremental', @@ -14,7 +14,6 @@ ) }} -{% set incremental_interval = '7' %} {% set project_start_date = '2019-10-01' %} SELECT 'gnosis' as blockchain, @@ -27,11 +26,11 @@ SELECT 'gnosis' as blockchain, c.proxy_address, c.aggregator_address, c.oracle_price / POWER(10, 0) as underlying_token_price, - CASE + CASE WHEN cardinality(split(c.feed_name, ' / ')) = 1 THEN c.feed_name ELSE element_at(split(c.feed_name, ' / '), 1) END AS base, - CASE + CASE WHEN cardinality(split(c.feed_name, ' / ')) = 1 THEN NULL ELSE element_at(split(c.feed_name, ' / '), 2) END AS quote @@ -39,14 +38,14 @@ FROM ( SELECT l.block_time, - cast(date_trunc('day', l.block_time) as date) as block_date, - cast(date_trunc('month', l.block_time) as date) as block_month, + cast(date_trunc('day', l.block_time) as date) as block_date, + cast(date_trunc('month', l.block_time) as date) as block_month, l.block_number, cfa.feed_name, cfa.proxy_address, MAX(cfa.aggregator_address) as aggregator_address, AVG( - CAST(bytearray_to_uint256(bytearray_substring(l.topic1, 3, 64)) as DOUBLE) + CAST(bytearray_to_uint256(bytearray_substring(l.topic1, 3, 64)) as DOUBLE) / POWER(10, cfa.decimals) ) as oracle_price FROM @@ -56,10 +55,10 @@ FROM WHERE l.topic0 = 0x0559884fd3a460db3073b7fc896cc77986f16e378210ded43186175bf646fc5f {% if not is_incremental() %} - AND l.block_time >= cast('{{project_start_date}}' as date) + AND l.block_time >= cast('{{project_start_date}}' as date) {% endif %} {% if is_incremental() %} - AND l.block_time >= date_trunc('day', now() - interval '{{incremental_interval}}' day) + AND {{ incremental_predicate('l.block_time') }} {% endif %} GROUP BY 1, 2, 3, 4, 5, 6 diff --git a/daily_spellbook/models/chainlink/gnosis/chainlink_gnosis_price_feeds_hourly.sql b/daily_spellbook/models/chainlink/gnosis/chainlink_gnosis_price_feeds_hourly.sql index bf517047347..1816ffaca93 100644 --- a/daily_spellbook/models/chainlink/gnosis/chainlink_gnosis_price_feeds_hourly.sql +++ b/daily_spellbook/models/chainlink/gnosis/chainlink_gnosis_price_feeds_hourly.sql @@ -1,6 +1,6 @@ {{ config( - + alias='price_feeds_hourly', partition_by=['block_month'], materialized='incremental', @@ -11,7 +11,6 @@ ) }} -{% set incremental_interval = '7' %} {% set project_start_date = '2019-10-01' %} WITH hourly_sequence_meta AS ( @@ -25,7 +24,7 @@ WITH hourly_sequence_meta AS ( AND price.minute >= timestamp '{{project_start_date}}' {% endif %} {% if is_incremental() %} - AND price.minute >= date_trunc('hour', now() - interval '{{incremental_interval}}' day) + AND {{ incremental_predicate('price.minute') }} {% endif %} GROUP BY 1 @@ -70,7 +69,7 @@ aggregated_price_feeds AS ( hourly_sequence.hr >= timestamp '{{project_start_date}}' {% endif %} {% if is_incremental() %} - hourly_sequence.hr >= date_trunc('hour', now() - interval '{{incremental_interval}}' day) + {{ incremental_predicate('hourly_sequence.hr') }} {% endif %} GROUP BY hourly_sequence.hr, hourly_sequence.feed_name, hourly_sequence.proxy_address, hourly_sequence.aggregator_address diff --git a/daily_spellbook/models/chainlink/optimism/chainlink_optimism_ccip_fulfilled_transactions.sql b/daily_spellbook/models/chainlink/optimism/chainlink_optimism_ccip_fulfilled_transactions.sql index 2bac49ed959..c70c1515207 100644 --- a/daily_spellbook/models/chainlink/optimism/chainlink_optimism_ccip_fulfilled_transactions.sql +++ b/daily_spellbook/models/chainlink/optimism/chainlink_optimism_ccip_fulfilled_transactions.sql @@ -8,7 +8,6 @@ ) }} -{% set incremental_interval = '7' %} WITH ccip_fulfilled_transactions AS ( @@ -23,12 +22,12 @@ WITH LEFT JOIN {{ source('optimism', 'transactions') }} tx ON ccip_send_logs_v1.tx_hash = tx.hash {% if is_incremental() %} - AND tx.block_time >= date_trunc('day', now() - interval '{{incremental_interval}}' day) + AND {{ incremental_predicate('tx.block_time') }} {% endif %} WHERE tx.success = true {% if is_incremental() %} - AND ccip_send_logs_v1.block_time >= date_trunc('day', now() - interval '{{incremental_interval}}' day) + AND {{ incremental_predicate('ccip_send_logs_v1.block_time') }} {% endif %} UNION @@ -44,14 +43,14 @@ WITH LEFT JOIN {{ source('optimism', 'transactions') }} tx ON ccip_send_logs_v1_2.tx_hash = tx.hash {% if is_incremental() %} - AND tx.block_time >= date_trunc('day', now() - interval '{{incremental_interval}}' day) + AND {{ incremental_predicate('tx.block_time') }} {% endif %} WHERE tx.success = true {% if is_incremental() %} - AND ccip_send_logs_v1_2.block_time >= date_trunc('day', now() - interval '{{incremental_interval}}' day) + AND {{ incremental_predicate('ccip_send_logs_v1_2.block_time') }} {% endif %} - + ) SELECT 'optimism' as blockchain, diff --git a/daily_spellbook/models/chainlink/optimism/chainlink_optimism_ccip_gas_daily.sql b/daily_spellbook/models/chainlink/optimism/chainlink_optimism_ccip_gas_daily.sql index de0036d1fdf..d59944f788d 100644 --- a/daily_spellbook/models/chainlink/optimism/chainlink_optimism_ccip_gas_daily.sql +++ b/daily_spellbook/models/chainlink/optimism/chainlink_optimism_ccip_gas_daily.sql @@ -1,6 +1,6 @@ {{ config( - + alias='ccip_gas_daily', partition_by=['date_month'], materialized='incremental', @@ -10,7 +10,6 @@ ) }} -{% set incremental_interval = '7' %} {% set truncate_by = 'day' %} WITH @@ -24,7 +23,7 @@ WITH {{ ref('chainlink_optimism_ccip_transmitted_fulfilled') }} fulfilled {% if is_incremental() %} WHERE - fulfilled.block_time >= date_trunc('day', now() - interval '{{incremental_interval}}' day) + {{ incremental_predicate('fulfilled.block_time') }} {% endif %} GROUP BY 1, 2 @@ -41,7 +40,7 @@ WITH {{ ref('chainlink_optimism_ccip_transmitted_reverted') }} reverted {% if is_incremental() %} WHERE - reverted.block_time >= date_trunc('day', now() - interval '{{incremental_interval}}' day) + {{ incremental_predicate('reverted.block_time') }} {% endif %} GROUP BY 1, 2 @@ -53,7 +52,7 @@ WITH COALESCE( fulfilled.date_start, reverted.date_start - ) AS "date_start", + ) AS "date_start", COALESCE( fulfilled.node_address, reverted.node_address @@ -86,7 +85,7 @@ WITH FROM ccip_gas_daily_meta LEFT JOIN {{ ref('chainlink_optimism_ccip_operator_meta') }} ccip_operator_meta ON ccip_operator_meta.node_address = ccip_gas_daily_meta.node_address ) -SELECT +SELECT blockchain, date_start, date_month, @@ -97,7 +96,7 @@ SELECT reverted_token_amount, reverted_usd_amount, total_token_amount, - total_usd_amount + total_usd_amount FROM ccip_gas_daily ORDER BY diff --git a/daily_spellbook/models/chainlink/optimism/chainlink_optimism_ccip_nop_reward_daily.sql b/daily_spellbook/models/chainlink/optimism/chainlink_optimism_ccip_nop_reward_daily.sql index 18a1c6a5457..d9c8bbd40a6 100644 --- a/daily_spellbook/models/chainlink/optimism/chainlink_optimism_ccip_nop_reward_daily.sql +++ b/daily_spellbook/models/chainlink/optimism/chainlink_optimism_ccip_nop_reward_daily.sql @@ -1,6 +1,6 @@ {{ config( - + alias='ccip_nop_reward_daily', partition_by = ['date_month'], materialized = 'incremental', @@ -10,7 +10,6 @@ ) }} -{% set incremental_interval = '7' %} WITH link_usd_daily AS ( @@ -20,7 +19,7 @@ WITH FROM {{ source('prices', 'usd') }} price WHERE - price.symbol = 'LINK' + price.symbol = 'LINK' GROUP BY 1 ORDER BY @@ -38,22 +37,22 @@ FROM {{ref('chainlink_optimism_ccip_nop_paid_logs')}} nop_logs LEFT JOIN {{ref('chainlink_optimism_ccip_admin_meta')}} admin_meta ON admin_meta.admin_address = nop_logs.nop_address {% if is_incremental() %} - WHERE block_time >= date_trunc('day', now() - interval '{{incremental_interval}}' day) -{% endif %} + WHERE {{ incremental_predicate('block_time') }} +{% endif %} GROUP BY 2, 4 ORDER BY 2, 4 ), nop_reward_daily AS ( - SELECT + SELECT nop_paid.date_start, cast(date_trunc('month', nop_paid.date_start) as date) as date_month, nop_paid.operator_name, - nop_paid.nop_address, + nop_paid.nop_address, nop_paid.token_amount as token_amount, (nop_paid.token_amount * lud.usd_amount) as usd_amount - FROM + FROM nop_paid LEFT JOIN link_usd_daily lud ON lud.date_start = nop_paid.date_start ORDER BY date_start @@ -66,7 +65,7 @@ SELECT nop_address, token_amount, usd_amount -FROM +FROM nop_reward_daily ORDER BY 2, 5 diff --git a/daily_spellbook/models/chainlink/optimism/chainlink_optimism_ccip_request_daily.sql b/daily_spellbook/models/chainlink/optimism/chainlink_optimism_ccip_request_daily.sql index d286c4911a6..df596936776 100644 --- a/daily_spellbook/models/chainlink/optimism/chainlink_optimism_ccip_request_daily.sql +++ b/daily_spellbook/models/chainlink/optimism/chainlink_optimism_ccip_request_daily.sql @@ -9,7 +9,6 @@ ) }} -{% set incremental_interval = '7' %} WITH ethereum_agg AS ( @@ -23,7 +22,7 @@ ethereum_agg AS ( WHERE eth.date_start = date_series.date_start {% if is_incremental() %} - AND eth.block_time >= date_trunc('day', now() - interval '{{incremental_interval}}' day) + AND {{ incremental_predicate('eth.block_time') }} {% endif %} ) AS fulfilled_requests, ( @@ -34,7 +33,7 @@ ethereum_agg AS ( WHERE rev.date_start = date_series.date_start {% if is_incremental() %} - AND rev.block_time >= date_trunc('day', now() - interval '{{incremental_interval}}' day) + AND {{ incremental_predicate('rev.block_time') }} {% endif %} ) AS reverted_requests FROM @@ -52,7 +51,7 @@ ethereum_agg AS ( ) AS seq CROSS JOIN UNNEST (seq.date_sequence) AS t (date_start) {% if is_incremental() %} - WHERE date_start >= date_trunc('day', now() - interval '{{incremental_interval}}' day) + WHERE {{ incremental_predicate('date_start') }} {% endif %} ) date_series ), @@ -67,7 +66,7 @@ ethereum_agg AS ( FROM ethereum_agg ) -SELECT +SELECT ccip_request_daily.blockchain, date_start, date_month, diff --git a/daily_spellbook/models/chainlink/optimism/chainlink_optimism_ccip_reverted_transactions.sql b/daily_spellbook/models/chainlink/optimism/chainlink_optimism_ccip_reverted_transactions.sql index c10dab32580..a9e8745bffc 100644 --- a/daily_spellbook/models/chainlink/optimism/chainlink_optimism_ccip_reverted_transactions.sql +++ b/daily_spellbook/models/chainlink/optimism/chainlink_optimism_ccip_reverted_transactions.sql @@ -8,7 +8,6 @@ ) }} -{% set incremental_interval = '7' %} WITH ccip_reverted_transactions AS ( @@ -23,12 +22,12 @@ WITH LEFT JOIN {{ source('optimism', 'transactions') }} tx ON ccip_send_logs_v1.tx_hash = tx.hash {% if is_incremental() %} - AND tx.block_time >= date_trunc('day', now() - interval '{{incremental_interval}}' day) + AND {{ incremental_predicate('tx.block_time') }} {% endif %} WHERE tx.success = false {% if is_incremental() %} - AND ccip_send_logs_v1.block_time >= date_trunc('day', now() - interval '{{incremental_interval}}' day) + AND {{ incremental_predicate('ccip_send_logs_v1.block_time') }} {% endif %} UNION @@ -44,14 +43,14 @@ WITH LEFT JOIN {{ source('optimism', 'transactions') }} tx ON ccip_send_logs_v1_2.tx_hash = tx.hash {% if is_incremental() %} - AND tx.block_time >= date_trunc('day', now() - interval '{{incremental_interval}}' day) + AND {{ incremental_predicate('tx.block_time') }} {% endif %} WHERE tx.success = false {% if is_incremental() %} - AND ccip_send_logs_v1_2.block_time >= date_trunc('day', now() - interval '{{incremental_interval}}' day) + AND {{ incremental_predicate('ccip_send_logs_v1_2.block_time') }} {% endif %} - + ) SELECT 'optimism' as blockchain, diff --git a/daily_spellbook/models/chainlink/optimism/chainlink_optimism_ccip_reward_daily.sql b/daily_spellbook/models/chainlink/optimism/chainlink_optimism_ccip_reward_daily.sql index 3c51a26df85..cf199c6aff3 100644 --- a/daily_spellbook/models/chainlink/optimism/chainlink_optimism_ccip_reward_daily.sql +++ b/daily_spellbook/models/chainlink/optimism/chainlink_optimism_ccip_reward_daily.sql @@ -9,7 +9,6 @@ ) }} -{% set incremental_interval = '7' %} WITH token_meta AS ( @@ -28,7 +27,7 @@ WITH {{ source('prices', 'usd') }} price JOIN token_meta ON price.symbol = token_meta.token_symbol {% if is_incremental() %} - WHERE price.minute >= date_trunc('day', now() - interval '{{incremental_interval}}' day) + WHERE {{ incremental_predicate('price.minute') }} {% endif %} GROUP BY 1, token_meta.token_symbol @@ -36,21 +35,21 @@ WITH 1 ), ccip_reward_daily AS ( - SELECT + SELECT ccip_send_requested_daily.date_start, - cast(date_trunc('month', ccip_send_requested_daily.date_start) as date) as date_month, + cast(date_trunc('month', ccip_send_requested_daily.date_start) as date) as date_month, SUM(ccip_send_requested_daily.fee_amount) as token_amount, SUM((ccip_send_requested_daily.fee_amount * tud.usd_amount)) as usd_amount, ccip_send_requested_daily.token as token - FROM + FROM {{ref('chainlink_optimism_ccip_send_requested_daily')}} ccip_send_requested_daily LEFT JOIN token_usd_daily tud ON tud.date_start = ccip_send_requested_daily.date_start AND tud.symbol = ccip_send_requested_daily.token {% if is_incremental() %} - WHERE ccip_send_requested_daily.date_start >= date_trunc('day', now() - interval '{{incremental_interval}}' day) - {% endif %} + WHERE {{ incremental_predicate('ccip_send_requested_daily.date_start') }} + {% endif %} GROUP BY 1, 5 ) - + SELECT 'optimism' as blockchain, date_start, @@ -58,7 +57,7 @@ SELECT token_amount, usd_amount, token -FROM +FROM ccip_reward_daily ORDER BY 2, 6 diff --git a/daily_spellbook/models/chainlink/optimism/chainlink_optimism_ccip_send_requested_daily.sql b/daily_spellbook/models/chainlink/optimism/chainlink_optimism_ccip_send_requested_daily.sql index e58114879c2..6d63b02cf4e 100644 --- a/daily_spellbook/models/chainlink/optimism/chainlink_optimism_ccip_send_requested_daily.sql +++ b/daily_spellbook/models/chainlink/optimism/chainlink_optimism_ccip_send_requested_daily.sql @@ -1,6 +1,6 @@ {{ config( - + alias='ccip_send_requested_daily', partition_by=['date_month'], materialized='incremental', @@ -10,7 +10,6 @@ ) }} -{% set incremental_interval = '7' %} SELECT 'optimism' as blockchain, @@ -23,8 +22,8 @@ SELECT FROM {{ref('chainlink_optimism_ccip_send_requested')}} ccip_send_requested {% if is_incremental() %} - WHERE evt_block_time >= date_trunc('day', now() - interval '{{incremental_interval}}' day) -{% endif %} + WHERE {{ incremental_predicate('evt_block_time') }} +{% endif %} GROUP BY 2, 5, 6 ORDER BY diff --git a/daily_spellbook/models/chainlink/optimism/chainlink_optimism_ccip_transmitted_fulfilled.sql b/daily_spellbook/models/chainlink/optimism/chainlink_optimism_ccip_transmitted_fulfilled.sql index 4732d3c8562..9e761894bfb 100644 --- a/daily_spellbook/models/chainlink/optimism/chainlink_optimism_ccip_transmitted_fulfilled.sql +++ b/daily_spellbook/models/chainlink/optimism/chainlink_optimism_ccip_transmitted_fulfilled.sql @@ -1,16 +1,16 @@ {{ config( - + alias='ccip_transmitted_fulfilled', partition_by=['date_month'], materialized='incremental', file_format='delta', incremental_strategy='merge', - unique_key=['tx_hash', 'tx_index', 'node_address'] + unique_key=['tx_hash', 'tx_index', 'node_address'], + incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.block_time')] ) }} -{% set incremental_interval = '7' %} WITH optimism_usd AS ( @@ -22,8 +22,8 @@ WITH WHERE symbol = 'ETH' {% if is_incremental() %} - AND minute >= date_trunc('day', now() - interval '{{incremental_interval}}' day) - {% endif %} + AND {{ incremental_predicate('minute') }} + {% endif %} ), ccip_fulfilled_transactions AS ( SELECT @@ -38,12 +38,12 @@ WITH {{ source('optimism', 'transactions') }} tx RIGHT JOIN {{ ref('chainlink_optimism_ccip_transmitted_logs') }} ccip_tx ON ccip_tx.tx_hash = tx.hash {% if is_incremental() %} - AND ccip_tx.block_time >= date_trunc('day', now() - interval '{{incremental_interval}}' day) + AND {{ incremental_predicate('ccip_tx.block_time') }} {% endif %} LEFT JOIN optimism_usd ON date_trunc('minute', tx.block_time) = optimism_usd.block_time {% if is_incremental() %} - WHERE tx.block_time >= date_trunc('day', now() - interval '{{incremental_interval}}' day) - {% endif %} + WHERE {{ incremental_predicate('tx.block_time') }} + {% endif %} GROUP BY tx.hash, tx.index, diff --git a/daily_spellbook/models/chainlink/optimism/chainlink_optimism_ccip_transmitted_reverted.sql b/daily_spellbook/models/chainlink/optimism/chainlink_optimism_ccip_transmitted_reverted.sql index aaf4946174b..7cc82dd959f 100644 --- a/daily_spellbook/models/chainlink/optimism/chainlink_optimism_ccip_transmitted_reverted.sql +++ b/daily_spellbook/models/chainlink/optimism/chainlink_optimism_ccip_transmitted_reverted.sql @@ -1,16 +1,16 @@ {{ config( - + alias='ccip_transmitted_reverted', partition_by=['date_month'], materialized='incremental', file_format='delta', incremental_strategy='merge', - unique_key=['tx_hash', 'tx_index', 'node_address'] + unique_key=['tx_hash', 'tx_index', 'node_address'], + incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.block_time')] ) }} -{% set incremental_interval = '7' %} WITH optimism_usd AS ( @@ -22,8 +22,8 @@ WITH WHERE symbol = 'ETH' {% if is_incremental() %} - AND minute >= date_trunc('day', now() - interval '{{incremental_interval}}' day) - {% endif %} + AND {{ incremental_predicate('minute') }} + {% endif %} ), ccip_reverted_transactions AS ( SELECT @@ -38,14 +38,14 @@ WITH {{ ref('chainlink_optimism_ccip_transmitted_logs') }} tx LEFT JOIN {{ source('optimism', 'transactions') }} tx2 ON tx2.hash = tx.tx_hash {% if is_incremental() %} - AND tx.block_time >= date_trunc('day', now() - interval '{{incremental_interval}}' day) + AND {{ incremental_predicate('tx.block_time') }} {% endif %} LEFT JOIN optimism_usd ON date_trunc('minute', tx.block_time) = optimism_usd.block_time WHERE tx2.success = false {% if is_incremental() %} - AND tx.block_time >= date_trunc('day', now() - interval '{{incremental_interval}}' day) - {% endif %} + AND {{ incremental_predicate('tx.block_time') }} + {% endif %} GROUP BY tx.tx_hash, tx.index, diff --git a/daily_spellbook/models/chainlink/optimism/chainlink_optimism_fm_fulfilled_transactions.sql b/daily_spellbook/models/chainlink/optimism/chainlink_optimism_fm_fulfilled_transactions.sql index 3770f6f40f7..ac2b1dc5557 100644 --- a/daily_spellbook/models/chainlink/optimism/chainlink_optimism_fm_fulfilled_transactions.sql +++ b/daily_spellbook/models/chainlink/optimism/chainlink_optimism_fm_fulfilled_transactions.sql @@ -1,16 +1,16 @@ {{ config( - + alias='fm_fulfilled_transactions', partition_by=['date_month'], materialized='incremental', file_format='delta', incremental_strategy='merge', - unique_key=['tx_hash', 'tx_index', 'node_address'] + unique_key=['tx_hash', 'tx_index', 'node_address'], + incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.block_time')] ) }} -{% set incremental_interval = '7' %} WITH optimism_usd AS ( @@ -22,8 +22,8 @@ WITH WHERE symbol = 'ETH' {% if is_incremental() %} - AND minute >= date_trunc('day', now() - interval '{{incremental_interval}}' day) - {% endif %} + AND {{ incremental_predicate('minute') }} + {% endif %} ), fm_submission_transactions AS ( SELECT @@ -40,12 +40,12 @@ WITH {{ source('optimism', 'transactions') }} tx RIGHT JOIN {{ ref('chainlink_optimism_fm_gas_submission_logs') }} fm_gas_submission_logs ON fm_gas_submission_logs.tx_hash = tx.hash {% if is_incremental() %} - AND fm_gas_submission_logs.block_time >= date_trunc('day', now() - interval '{{incremental_interval}}' day) + AND {{ incremental_predicate('fm_gas_submission_logs.block_time') }} {% endif %} LEFT JOIN optimism_usd ON date_trunc('minute', tx.block_time) = optimism_usd.block_time {% if is_incremental() %} - WHERE tx.block_time >= date_trunc('day', now() - interval '{{incremental_interval}}' day) - {% endif %} + WHERE {{ incremental_predicate('tx.block_time') }} + {% endif %} GROUP BY tx.hash, tx.index, diff --git a/daily_spellbook/models/chainlink/optimism/chainlink_optimism_fm_gas_daily.sql b/daily_spellbook/models/chainlink/optimism/chainlink_optimism_fm_gas_daily.sql index b73a9b0ecbb..212122310d0 100644 --- a/daily_spellbook/models/chainlink/optimism/chainlink_optimism_fm_gas_daily.sql +++ b/daily_spellbook/models/chainlink/optimism/chainlink_optimism_fm_gas_daily.sql @@ -1,6 +1,6 @@ {{ config( - + alias='fm_gas_daily', partition_by=['date_month'], materialized='incremental', @@ -10,7 +10,6 @@ ) }} -{% set incremental_interval = '7' %} {% set truncate_by = 'day' %} WITH @@ -24,7 +23,7 @@ WITH {{ ref('chainlink_optimism_fm_fulfilled_transactions') }} fulfilled {% if is_incremental() %} WHERE - fulfilled.block_time >= date_trunc('day', now() - interval '{{incremental_interval}}' day) + {{ incremental_predicate('fulfilled.block_time') }} {% endif %} GROUP BY 1, 2 @@ -41,7 +40,7 @@ WITH {{ ref('chainlink_optimism_fm_reverted_transactions') }} reverted {% if is_incremental() %} WHERE - reverted.block_time >= date_trunc('day', now() - interval '{{incremental_interval}}' day) + {{ incremental_predicate('reverted.block_time') }} {% endif %} GROUP BY 1, 2 @@ -53,7 +52,7 @@ WITH COALESCE( fulfilled.date_start, reverted.date_start - ) AS "date_start", + ) AS "date_start", COALESCE( fulfilled.node_address, reverted.node_address @@ -86,7 +85,7 @@ WITH FROM fm_gas_daily_meta LEFT JOIN {{ ref('chainlink_optimism_ocr_operator_node_meta') }} fm_operator_node_meta ON fm_operator_node_meta.node_address = fm_gas_daily_meta.node_address ) -SELECT +SELECT blockchain, date_start, date_month, @@ -97,7 +96,7 @@ SELECT reverted_token_amount, reverted_usd_amount, total_token_amount, - total_usd_amount + total_usd_amount FROM fm_gas_daily ORDER BY diff --git a/daily_spellbook/models/chainlink/optimism/chainlink_optimism_fm_request_daily.sql b/daily_spellbook/models/chainlink/optimism/chainlink_optimism_fm_request_daily.sql index 0f91fd460e5..b90635f547f 100644 --- a/daily_spellbook/models/chainlink/optimism/chainlink_optimism_fm_request_daily.sql +++ b/daily_spellbook/models/chainlink/optimism/chainlink_optimism_fm_request_daily.sql @@ -1,6 +1,6 @@ {{ config( - + alias='fm_request_daily', partition_by=['date_month'], materialized='incremental', @@ -10,7 +10,6 @@ ) }} -{% set incremental_interval = '7' %} {% set truncate_by = 'day' %} WITH @@ -19,7 +18,7 @@ WITH COALESCE( cast(date_trunc('{{truncate_by}}', fulfilled.block_time) as date), cast(date_trunc('{{truncate_by}}', reverted.block_time) as date) - ) AS "date_start", + ) AS "date_start", COALESCE( fulfilled.node_address, reverted.node_address @@ -34,8 +33,8 @@ WITH reverted.node_address = fulfilled.node_address {% if is_incremental() %} WHERE - fulfilled.block_time >= date_trunc('day', now() - interval '{{incremental_interval}}' day) - AND reverted.block_time >= date_trunc('day', now() - interval '{{incremental_interval}}' day) + {{ incremental_predicate('fulfilled.block_time') }} + AND {{ incremental_predicate('reverted.block_time') }} {% endif %} GROUP BY 1, 2 @@ -55,7 +54,7 @@ WITH FROM fm_request_daily_meta LEFT JOIN {{ ref('chainlink_optimism_ocr_operator_node_meta') }} fm_operator_node_meta ON fm_operator_node_meta.node_address = fm_request_daily_meta.node_address ) -SELECT +SELECT blockchain, date_start, date_month, diff --git a/daily_spellbook/models/chainlink/optimism/chainlink_optimism_fm_reverted_transactions.sql b/daily_spellbook/models/chainlink/optimism/chainlink_optimism_fm_reverted_transactions.sql index 0ce69f332c8..5d688888fb0 100644 --- a/daily_spellbook/models/chainlink/optimism/chainlink_optimism_fm_reverted_transactions.sql +++ b/daily_spellbook/models/chainlink/optimism/chainlink_optimism_fm_reverted_transactions.sql @@ -1,16 +1,16 @@ {{ config( - + alias='fm_reverted_transactions', partition_by=['date_month'], materialized='incremental', file_format='delta', incremental_strategy='merge', - unique_key=['tx_hash', 'tx_index', 'node_address'] + unique_key=['tx_hash', 'tx_index', 'node_address'], + incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.block_time')] ) }} -{% set incremental_interval = '7' %} WITH optimism_usd AS ( @@ -22,8 +22,8 @@ WITH WHERE symbol = 'ETH' {% if is_incremental() %} - AND minute >= date_trunc('day', now() - interval '{{incremental_interval}}' day) - {% endif %} + AND {{ incremental_predicate('minute') }} + {% endif %} ), fm_reverted_transactions AS ( SELECT @@ -42,8 +42,8 @@ WITH WHERE success = false {% if is_incremental() %} - AND tx.block_time >= date_trunc('day', now() - interval '{{incremental_interval}}' day) - {% endif %} + AND {{ incremental_predicate('tx.block_time') }} + {% endif %} GROUP BY tx.hash, tx.index, diff --git a/daily_spellbook/models/chainlink/optimism/chainlink_optimism_fm_reward_daily.sql b/daily_spellbook/models/chainlink/optimism/chainlink_optimism_fm_reward_daily.sql index 06ac1a9e197..80619928fe8 100644 --- a/daily_spellbook/models/chainlink/optimism/chainlink_optimism_fm_reward_daily.sql +++ b/daily_spellbook/models/chainlink/optimism/chainlink_optimism_fm_reward_daily.sql @@ -1,6 +1,6 @@ {{ config( - + alias='fm_reward_daily', partition_by = ['date_month'], materialized = 'incremental', @@ -10,7 +10,6 @@ ) }} -{% set incremental_interval = '7' %} WITH admin_address_meta as ( @@ -28,8 +27,8 @@ WITH WHERE price.symbol = 'LINK' {% if is_incremental() %} - AND price.minute >= date_trunc('day', now() - interval '{{incremental_interval}}' day) - {% endif %} + AND {{ incremental_predicate('price.minute') }} + {% endif %} GROUP BY 1 ORDER BY @@ -77,16 +76,16 @@ WITH 1, 2 ), fm_reward_daily AS ( - SELECT + SELECT payment_meta.date_start, cast(date_trunc('month', payment_meta.date_start) as date) as date_month, payment_meta.admin_address, - ocr_operator_admin_meta.operator_name, + ocr_operator_admin_meta.operator_name, COALESCE(fm_reward_evt_transfer_daily.token_amount / EXTRACT(DAY FROM next_payment_date - prev_payment_date), 0) as token_amount, (COALESCE(fm_reward_evt_transfer_daily.token_amount / EXTRACT(DAY FROM next_payment_date - prev_payment_date), 0) * payment_meta.usd_amount) as usd_amount - FROM + FROM payment_meta - LEFT JOIN + LEFT JOIN {{ref('chainlink_optimism_fm_reward_evt_transfer_daily')}} fm_reward_evt_transfer_daily ON payment_meta.next_payment_date = fm_reward_evt_transfer_daily.date_start AND payment_meta.admin_address = fm_reward_evt_transfer_daily.admin_address @@ -101,7 +100,7 @@ SELECT operator_name, token_amount, usd_amount -FROM +FROM fm_reward_daily ORDER BY 2, 4 diff --git a/daily_spellbook/models/chainlink/optimism/chainlink_optimism_fm_reward_evt_transfer_daily.sql b/daily_spellbook/models/chainlink/optimism/chainlink_optimism_fm_reward_evt_transfer_daily.sql index 80fb7bef96b..a96fa4ab589 100644 --- a/daily_spellbook/models/chainlink/optimism/chainlink_optimism_fm_reward_evt_transfer_daily.sql +++ b/daily_spellbook/models/chainlink/optimism/chainlink_optimism_fm_reward_evt_transfer_daily.sql @@ -1,6 +1,6 @@ {{ config( - + alias='fm_reward_evt_transfer_daily', partition_by=['date_month'], materialized='incremental', @@ -10,7 +10,6 @@ ) }} -{% set incremental_interval = '7' %} SELECT 'optimism' as blockchain, @@ -23,8 +22,8 @@ FROM {{ref('chainlink_optimism_fm_reward_evt_transfer')}} fm_reward_evt_transfer LEFT JOIN {{ ref('chainlink_optimism_ocr_operator_admin_meta') }} fm_operator_admin_meta ON fm_operator_admin_meta.admin_address = fm_reward_evt_transfer.admin_address {% if is_incremental() %} - WHERE evt_block_time >= date_trunc('day', now() - interval '{{incremental_interval}}' day) -{% endif %} + WHERE {{ incremental_predicate('evt_block_time') }} +{% endif %} GROUP BY 2, 4 ORDER BY diff --git a/daily_spellbook/models/chainlink/optimism/chainlink_optimism_ocr_fulfilled_transactions.sql b/daily_spellbook/models/chainlink/optimism/chainlink_optimism_ocr_fulfilled_transactions.sql index a57c161fb34..830f78eaaa1 100644 --- a/daily_spellbook/models/chainlink/optimism/chainlink_optimism_ocr_fulfilled_transactions.sql +++ b/daily_spellbook/models/chainlink/optimism/chainlink_optimism_ocr_fulfilled_transactions.sql @@ -1,12 +1,13 @@ {{ config( - + alias='ocr_fulfilled_transactions', partition_by=['date_month'], materialized='incremental', file_format='delta', incremental_strategy='merge', unique_key=['tx_hash', 'tx_index', 'node_address'], + incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.block_time')], post_hook='{{ expose_spells(\'["optimism"]\', "project", "chainlink", @@ -14,7 +15,6 @@ ) }} -{% set incremental_interval = '7' %} WITH optimism_usd AS ( @@ -26,8 +26,8 @@ WITH WHERE symbol = 'ETH' {% if is_incremental() %} - AND minute >= date_trunc('day', now() - interval '{{incremental_interval}}' day) - {% endif %} + AND {{ incremental_predicate('minute') }} + {% endif %} ), ocr_fulfilled_transactions AS ( SELECT @@ -45,8 +45,8 @@ WITH RIGHT JOIN {{ ref('chainlink_optimism_ocr_gas_transmission_logs') }} ocr_gas_transmission_logs ON ocr_gas_transmission_logs.tx_hash = tx.hash LEFT JOIN optimism_usd ON date_trunc('minute', tx.block_time) = optimism_usd.block_time {% if is_incremental() %} - WHERE tx.block_time >= date_trunc('day', now() - interval '{{incremental_interval}}' day) - {% endif %} + WHERE {{ incremental_predicate('tx.block_time') }} + {% endif %} GROUP BY tx.hash, tx.index, diff --git a/daily_spellbook/models/chainlink/optimism/chainlink_optimism_ocr_gas_daily.sql b/daily_spellbook/models/chainlink/optimism/chainlink_optimism_ocr_gas_daily.sql index 135097f1451..77c9bb8f543 100644 --- a/daily_spellbook/models/chainlink/optimism/chainlink_optimism_ocr_gas_daily.sql +++ b/daily_spellbook/models/chainlink/optimism/chainlink_optimism_ocr_gas_daily.sql @@ -1,6 +1,6 @@ {{ config( - + alias='ocr_gas_daily', partition_by=['date_month'], materialized='incremental', @@ -14,7 +14,6 @@ ) }} -{% set incremental_interval = '7' %} {% set truncate_by = 'day' %} WITH @@ -28,7 +27,7 @@ WITH {{ ref('chainlink_optimism_ocr_fulfilled_transactions') }} fulfilled {% if is_incremental() %} WHERE - fulfilled.block_time >= date_trunc('day', now() - interval '{{incremental_interval}}' day) + {{ incremental_predicate('fulfilled.block_time') }} {% endif %} GROUP BY 1, 2 @@ -45,7 +44,7 @@ WITH {{ ref('chainlink_optimism_ocr_reverted_transactions') }} reverted {% if is_incremental() %} WHERE - reverted.block_time >= date_trunc('day', now() - interval '{{incremental_interval}}' day) + {{ incremental_predicate('reverted.block_time') }} {% endif %} GROUP BY 1, 2 @@ -57,7 +56,7 @@ WITH COALESCE( fulfilled.date_start, reverted.date_start - ) AS "date_start", + ) AS "date_start", COALESCE( fulfilled.node_address, reverted.node_address @@ -90,7 +89,7 @@ WITH FROM ocr_gas_daily_meta LEFT JOIN {{ ref('chainlink_optimism_ocr_operator_node_meta') }} ocr_operator_node_meta ON ocr_operator_node_meta.node_address = ocr_gas_daily_meta.node_address ) -SELECT +SELECT blockchain, date_start, date_month, @@ -101,7 +100,7 @@ SELECT reverted_token_amount, reverted_usd_amount, total_token_amount, - total_usd_amount + total_usd_amount FROM ocr_gas_daily ORDER BY diff --git a/daily_spellbook/models/chainlink/optimism/chainlink_optimism_ocr_request_daily.sql b/daily_spellbook/models/chainlink/optimism/chainlink_optimism_ocr_request_daily.sql index 042b5aad9d9..4bcdb81dde2 100644 --- a/daily_spellbook/models/chainlink/optimism/chainlink_optimism_ocr_request_daily.sql +++ b/daily_spellbook/models/chainlink/optimism/chainlink_optimism_ocr_request_daily.sql @@ -1,6 +1,6 @@ {{ config( - + alias='ocr_request_daily', partition_by=['date_month'], materialized='incremental', @@ -14,7 +14,6 @@ ) }} -{% set incremental_interval = '7' %} {% set truncate_by = 'day' %} WITH @@ -23,7 +22,7 @@ WITH COALESCE( cast(date_trunc('{{truncate_by}}', fulfilled.block_time) as date), cast(date_trunc('{{truncate_by}}', reverted.block_time) as date) - ) AS "date_start", + ) AS "date_start", COALESCE( fulfilled.node_address, reverted.node_address @@ -38,8 +37,8 @@ WITH reverted.node_address = fulfilled.node_address {% if is_incremental() %} WHERE - fulfilled.block_time >= date_trunc('day', now() - interval '{{incremental_interval}}' day) - OR reverted.block_time >= date_trunc('day', now() - interval '{{incremental_interval}}' day) + {{ incremental_predicate('fulfilled.block_time') }} + OR {{ incremental_predicate('reverted.block_time') }} {% endif %} GROUP BY 1, 2 @@ -59,7 +58,7 @@ WITH FROM ocr_request_daily_meta LEFT JOIN {{ ref('chainlink_optimism_ocr_operator_node_meta') }} ocr_operator_node_meta ON ocr_operator_node_meta.node_address = ocr_request_daily_meta.node_address ) -SELECT +SELECT blockchain, date_start, date_month, diff --git a/daily_spellbook/models/chainlink/optimism/chainlink_optimism_ocr_reverted_transactions.sql b/daily_spellbook/models/chainlink/optimism/chainlink_optimism_ocr_reverted_transactions.sql index 0a70e4ebe18..e6c40bee945 100644 --- a/daily_spellbook/models/chainlink/optimism/chainlink_optimism_ocr_reverted_transactions.sql +++ b/daily_spellbook/models/chainlink/optimism/chainlink_optimism_ocr_reverted_transactions.sql @@ -1,12 +1,13 @@ {{ config( - + alias='ocr_reverted_transactions', partition_by=['date_month'], materialized='incremental', file_format='delta', incremental_strategy='merge', unique_key=['tx_hash', 'tx_index', 'node_address'], + incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.block_time')], post_hook='{{ expose_spells(\'["optimism"]\', "project", "chainlink", @@ -14,7 +15,6 @@ ) }} -{% set incremental_interval = '7' %} WITH optimism_usd AS ( @@ -26,8 +26,8 @@ WITH WHERE symbol = 'ETH' {% if is_incremental() %} - AND minute >= date_trunc('day', now() - interval '{{incremental_interval}}' day) - {% endif %} + AND {{ incremental_predicate('minute') }} + {% endif %} ), ocr_reverted_transactions AS ( SELECT @@ -46,8 +46,8 @@ WITH WHERE success = false {% if is_incremental() %} - AND tx.block_time >= date_trunc('day', now() - interval '{{incremental_interval}}' day) - {% endif %} + AND {{ incremental_predicate('tx.block_time') }} + {% endif %} GROUP BY tx.hash, tx.index, diff --git a/daily_spellbook/models/chainlink/optimism/chainlink_optimism_ocr_reward_daily.sql b/daily_spellbook/models/chainlink/optimism/chainlink_optimism_ocr_reward_daily.sql index 11958abab1c..3ab184de6ec 100644 --- a/daily_spellbook/models/chainlink/optimism/chainlink_optimism_ocr_reward_daily.sql +++ b/daily_spellbook/models/chainlink/optimism/chainlink_optimism_ocr_reward_daily.sql @@ -1,6 +1,6 @@ {{ config( - + alias='ocr_reward_daily', partition_by = ['date_month'], materialized = 'incremental', @@ -14,7 +14,6 @@ ) }} -{% set incremental_interval = '7' %} WITH admin_address_meta as ( @@ -32,8 +31,8 @@ WITH WHERE price.symbol = 'LINK' {% if is_incremental() %} - AND price.minute >= date_trunc('day', now() - interval '{{incremental_interval}}' day) - {% endif %} + AND {{ incremental_predicate('price.minute') }} + {% endif %} GROUP BY 1 ORDER BY @@ -81,16 +80,16 @@ WITH 1, 2 ), ocr_reward_daily AS ( - SELECT + SELECT payment_meta.date_start, cast(date_trunc('month', payment_meta.date_start) as date) as date_month, payment_meta.admin_address, - ocr_operator_admin_meta.operator_name, + ocr_operator_admin_meta.operator_name, COALESCE(ocr_reward_evt_transfer_daily.token_amount / EXTRACT(DAY FROM next_payment_date - prev_payment_date), 0) as token_amount, (COALESCE(ocr_reward_evt_transfer_daily.token_amount / EXTRACT(DAY FROM next_payment_date - prev_payment_date), 0) * payment_meta.usd_amount) as usd_amount - FROM + FROM payment_meta - LEFT JOIN + LEFT JOIN {{ref('chainlink_optimism_ocr_reward_evt_transfer_daily')}} ocr_reward_evt_transfer_daily ON payment_meta.next_payment_date = ocr_reward_evt_transfer_daily.date_start AND payment_meta.admin_address = ocr_reward_evt_transfer_daily.admin_address @@ -105,7 +104,7 @@ SELECT operator_name, token_amount, usd_amount -FROM +FROM ocr_reward_daily ORDER BY 2, 4 diff --git a/daily_spellbook/models/chainlink/optimism/chainlink_optimism_ocr_reward_evt_transfer_daily.sql b/daily_spellbook/models/chainlink/optimism/chainlink_optimism_ocr_reward_evt_transfer_daily.sql index 4598b4a8c4d..9942ce58d55 100644 --- a/daily_spellbook/models/chainlink/optimism/chainlink_optimism_ocr_reward_evt_transfer_daily.sql +++ b/daily_spellbook/models/chainlink/optimism/chainlink_optimism_ocr_reward_evt_transfer_daily.sql @@ -1,6 +1,6 @@ {{ config( - + alias='ocr_reward_evt_transfer_daily', partition_by=['date_month'], materialized='incremental', @@ -14,7 +14,6 @@ ) }} -{% set incremental_interval = '7' %} SELECT 'optimism' as blockchain, @@ -27,8 +26,8 @@ FROM {{ref('chainlink_optimism_ocr_reward_evt_transfer')}} ocr_reward_evt_transfer LEFT JOIN {{ ref('chainlink_optimism_ocr_operator_admin_meta') }} ocr_operator_admin_meta ON ocr_operator_admin_meta.admin_address = ocr_reward_evt_transfer.admin_address {% if is_incremental() %} - WHERE evt_block_time >= date_trunc('day', now() - interval '{{incremental_interval}}' day) -{% endif %} + WHERE {{ incremental_predicate('evt_block_time') }} +{% endif %} GROUP BY 2, 4 ORDER BY diff --git a/daily_spellbook/models/chainlink/optimism/chainlink_optimism_price_feeds.sql b/daily_spellbook/models/chainlink/optimism/chainlink_optimism_price_feeds.sql index 1b6e18e3a8f..a79fadcd706 100644 --- a/daily_spellbook/models/chainlink/optimism/chainlink_optimism_price_feeds.sql +++ b/daily_spellbook/models/chainlink/optimism/chainlink_optimism_price_feeds.sql @@ -1,6 +1,6 @@ {{ config( - + alias='price_feeds', partition_by=['block_month'], materialized='incremental', @@ -14,7 +14,6 @@ ) }} -{% set incremental_interval = '7' %} {% set project_start_date = '2021-06-23' %} SELECT 'optimism' as blockchain, @@ -59,7 +58,7 @@ FROM AND l.block_time >= cast('{{project_start_date}}' as date) {% endif %} {% if is_incremental() %} - AND l.block_time >= date_trunc('day', now() - interval '{{incremental_interval}}' day) + AND {{ incremental_predicate('l.block_time') }} {% endif %} GROUP BY 1, 2, 3, 4, 5, 6 diff --git a/daily_spellbook/models/chainlink/optimism/chainlink_optimism_price_feeds_hourly.sql b/daily_spellbook/models/chainlink/optimism/chainlink_optimism_price_feeds_hourly.sql index e1d82419a62..27cce164ee9 100644 --- a/daily_spellbook/models/chainlink/optimism/chainlink_optimism_price_feeds_hourly.sql +++ b/daily_spellbook/models/chainlink/optimism/chainlink_optimism_price_feeds_hourly.sql @@ -1,6 +1,6 @@ {{ config( - + alias='price_feeds_hourly', partition_by=['block_month'], materialized='incremental', @@ -11,7 +11,6 @@ ) }} -{% set incremental_interval = '7' %} {% set project_start_date = '2019-10-01' %} WITH hourly_sequence_meta AS ( @@ -25,7 +24,7 @@ WITH hourly_sequence_meta AS ( AND price.minute >= timestamp '{{project_start_date}}' {% endif %} {% if is_incremental() %} - AND price.minute >= date_trunc('hour', now() - interval '{{incremental_interval}}' day) + AND {{ incremental_predicate('price.minute') }} {% endif %} GROUP BY 1 @@ -70,7 +69,7 @@ aggregated_price_feeds AS ( hourly_sequence.hr >= timestamp '{{project_start_date}}' {% endif %} {% if is_incremental() %} - hourly_sequence.hr >= date_trunc('hour', now() - interval '{{incremental_interval}}' day) + {{ incremental_predicate('hourly_sequence.hr') }} {% endif %} GROUP BY hourly_sequence.hr, hourly_sequence.feed_name, hourly_sequence.proxy_address, hourly_sequence.aggregator_address diff --git a/daily_spellbook/models/chainlink/polygon/chainlink_polygon_automation_fulfilled_transactions.sql b/daily_spellbook/models/chainlink/polygon/chainlink_polygon_automation_fulfilled_transactions.sql index 80a745dd320..57a53d4997b 100644 --- a/daily_spellbook/models/chainlink/polygon/chainlink_polygon_automation_fulfilled_transactions.sql +++ b/daily_spellbook/models/chainlink/polygon/chainlink_polygon_automation_fulfilled_transactions.sql @@ -1,16 +1,16 @@ {{ config( - + alias='automation_fulfilled_transactions', partition_by=['date_month'], materialized='incremental', file_format='delta', incremental_strategy='merge', - unique_key=['tx_hash', 'tx_index', 'node_address'] + unique_key=['tx_hash', 'tx_index', 'node_address'], + incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.block_time')] ) }} -{% set incremental_interval = '7' %} WITH polygon_usd AS ( @@ -22,8 +22,8 @@ WITH WHERE symbol = 'MATIC' {% if is_incremental() %} - AND minute >= date_trunc('day', now() - interval '{{incremental_interval}}' day) - {% endif %} + AND {{ incremental_predicate('minute') }} + {% endif %} ), automation_fulfilled_transactions AS ( SELECT @@ -38,12 +38,12 @@ WITH {{ source('polygon', 'transactions') }} tx RIGHT JOIN {{ ref('chainlink_polygon_automation_upkeep_performed_logs') }} automation_upkeep_performed_logs ON automation_upkeep_performed_logs.tx_hash = tx.hash {% if is_incremental() %} - AND automation_upkeep_performed_logs.block_time >= date_trunc('day', now() - interval '{{incremental_interval}}' day) + AND {{ incremental_predicate('automation_upkeep_performed_logs.block_time') }} {% endif %} LEFT JOIN polygon_usd ON date_trunc('minute', tx.block_time) = polygon_usd.block_time {% if is_incremental() %} - WHERE tx.block_time >= date_trunc('day', now() - interval '{{incremental_interval}}' day) - {% endif %} + WHERE {{ incremental_predicate('tx.block_time') }} + {% endif %} GROUP BY tx.hash, tx.index, diff --git a/daily_spellbook/models/chainlink/polygon/chainlink_polygon_automation_gas_daily.sql b/daily_spellbook/models/chainlink/polygon/chainlink_polygon_automation_gas_daily.sql index b9785d62c88..98c94774394 100644 --- a/daily_spellbook/models/chainlink/polygon/chainlink_polygon_automation_gas_daily.sql +++ b/daily_spellbook/models/chainlink/polygon/chainlink_polygon_automation_gas_daily.sql @@ -1,6 +1,6 @@ {{ config( - + alias='automation_gas_daily', partition_by=['date_month'], materialized='incremental', @@ -10,7 +10,6 @@ ) }} -{% set incremental_interval = '7' %} {% set truncate_by = 'day' %} WITH @@ -24,7 +23,7 @@ WITH {{ ref('chainlink_polygon_automation_fulfilled_transactions') }} fulfilled {% if is_incremental() %} WHERE - fulfilled.block_time >= date_trunc('day', now() - interval '{{incremental_interval}}' day) + {{ incremental_predicate('fulfilled.block_time') }} {% endif %} GROUP BY 1, 2 @@ -41,7 +40,7 @@ WITH {{ ref('chainlink_polygon_automation_reverted_transactions') }} reverted {% if is_incremental() %} WHERE - reverted.block_time >= date_trunc('day', now() - interval '{{incremental_interval}}' day) + {{ incremental_predicate('reverted.block_time') }} {% endif %} GROUP BY 1, 2 @@ -53,7 +52,7 @@ WITH COALESCE( fulfilled.date_start, reverted.date_start - ) AS "date_start", + ) AS "date_start", COALESCE( fulfilled.node_address, reverted.node_address @@ -86,7 +85,7 @@ WITH FROM automation_gas_daily_meta LEFT JOIN {{ ref('chainlink_polygon_automation_meta') }} automation_meta ON automation_meta.keeper_address = automation_gas_daily_meta.node_address ) -SELECT +SELECT blockchain, date_start, date_month, @@ -97,7 +96,7 @@ SELECT reverted_token_amount, reverted_usd_amount, total_token_amount, - total_usd_amount + total_usd_amount FROM automation_gas_daily ORDER BY diff --git a/daily_spellbook/models/chainlink/polygon/chainlink_polygon_automation_performed_daily.sql b/daily_spellbook/models/chainlink/polygon/chainlink_polygon_automation_performed_daily.sql index c827dbb68e3..b2745aa9403 100644 --- a/daily_spellbook/models/chainlink/polygon/chainlink_polygon_automation_performed_daily.sql +++ b/daily_spellbook/models/chainlink/polygon/chainlink_polygon_automation_performed_daily.sql @@ -1,16 +1,16 @@ {{ config( - + alias='automation_performed_daily', partition_by=['date_month'], materialized='incremental', file_format='delta', incremental_strategy='merge', - unique_key=['date_start', 'keeper_address'] + unique_key=['date_start', 'keeper_address'], + incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.date_month')] ) }} -{% set incremental_interval = '7' %} SELECT 'polygon' as blockchain, @@ -22,8 +22,8 @@ SELECT FROM {{ref('chainlink_polygon_automation_performed')}} automation_performed {% if is_incremental() %} - WHERE evt_block_time >= date_trunc('day', now() - interval '{{incremental_interval}}' day) -{% endif %} + WHERE {{ incremental_predicate('evt_block_time') }} +{% endif %} GROUP BY 2, 4 ORDER BY diff --git a/daily_spellbook/models/chainlink/polygon/chainlink_polygon_automation_request_daily.sql b/daily_spellbook/models/chainlink/polygon/chainlink_polygon_automation_request_daily.sql index 2c51899d195..3a2e9faeb22 100644 --- a/daily_spellbook/models/chainlink/polygon/chainlink_polygon_automation_request_daily.sql +++ b/daily_spellbook/models/chainlink/polygon/chainlink_polygon_automation_request_daily.sql @@ -1,6 +1,6 @@ {{ config( - + alias='automation_request_daily', partition_by=['date_month'], materialized='incremental', @@ -10,7 +10,6 @@ ) }} -{% set incremental_interval = '7' %} {% set truncate_by = 'day' %} WITH @@ -19,7 +18,7 @@ WITH COALESCE( cast(date_trunc('{{truncate_by}}', fulfilled.block_time) as date), cast(date_trunc('{{truncate_by}}', reverted.block_time) as date) - ) AS "date_start", + ) AS "date_start", COALESCE( fulfilled.node_address, reverted.node_address @@ -34,8 +33,8 @@ WITH reverted.node_address = fulfilled.node_address {% if is_incremental() %} WHERE - fulfilled.block_time >= date_trunc('day', now() - interval '{{incremental_interval}}' day) - OR reverted.block_time >= date_trunc('day', now() - interval '{{incremental_interval}}' day) + {{ incremental_predicate('fulfilled.block_time') }} + OR {{ incremental_predicate('reverted.block_time') }} {% endif %} GROUP BY 1, 2 @@ -53,7 +52,7 @@ WITH total_requests FROM automation_request_daily_meta ) -SELECT +SELECT automation_request_daily.blockchain, date_start, date_month, diff --git a/daily_spellbook/models/chainlink/polygon/chainlink_polygon_automation_reverted_transactions.sql b/daily_spellbook/models/chainlink/polygon/chainlink_polygon_automation_reverted_transactions.sql index 8170308cda0..342fb4306d9 100644 --- a/daily_spellbook/models/chainlink/polygon/chainlink_polygon_automation_reverted_transactions.sql +++ b/daily_spellbook/models/chainlink/polygon/chainlink_polygon_automation_reverted_transactions.sql @@ -1,16 +1,16 @@ {{ config( - + alias='automation_reverted_transactions', partition_by=['date_month'], materialized='incremental', file_format='delta', incremental_strategy='merge', - unique_key=['tx_hash', 'tx_index', 'node_address'] + unique_key=['tx_hash', 'tx_index', 'node_address'], + incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.block_time')] ) }} -{% set incremental_interval = '7' %} WITH polygon_usd AS ( @@ -22,8 +22,8 @@ WITH WHERE symbol = 'MATIC' {% if is_incremental() %} - AND minute >= date_trunc('day', now() - interval '{{incremental_interval}}' day) - {% endif %} + AND {{ incremental_predicate('minute') }} + {% endif %} ), automation_reverted_transactions AS ( SELECT @@ -40,8 +40,8 @@ WITH WHERE success = false {% if is_incremental() %} - AND tx.block_time >= date_trunc('day', now() - interval '{{incremental_interval}}' day) - {% endif %} + AND {{ incremental_predicate('tx.block_time') }} + {% endif %} GROUP BY tx.hash, tx.index, diff --git a/daily_spellbook/models/chainlink/polygon/chainlink_polygon_automation_reward_daily.sql b/daily_spellbook/models/chainlink/polygon/chainlink_polygon_automation_reward_daily.sql index 98248dee2bd..d69db2ce6b6 100644 --- a/daily_spellbook/models/chainlink/polygon/chainlink_polygon_automation_reward_daily.sql +++ b/daily_spellbook/models/chainlink/polygon/chainlink_polygon_automation_reward_daily.sql @@ -1,6 +1,6 @@ {{ config( - + alias='automation_reward_daily', partition_by = ['date_month'], materialized = 'incremental', @@ -10,7 +10,6 @@ ) }} -{% set incremental_interval = '7' %} WITH link_usd_daily AS ( @@ -20,21 +19,21 @@ WITH FROM {{ source('prices', 'usd') }} price WHERE - price.symbol = 'LINK' + price.symbol = 'LINK' GROUP BY 1 ORDER BY 1 ), automation_reward_daily AS ( - SELECT + SELECT automation_performed_daily.date_start, cast(date_trunc('month', automation_performed_daily.date_start) as date) as date_month, automation_performed_daily.operator_name, - automation_performed_daily.keeper_address, + automation_performed_daily.keeper_address, automation_performed_daily.token_amount as token_amount, (automation_performed_daily.token_amount * lud.usd_amount) as usd_amount - FROM + FROM {{ref('chainlink_polygon_automation_performed_daily')}} automation_performed_daily LEFT JOIN link_usd_daily lud ON lud.date_start = automation_performed_daily.date_start ORDER BY date_start @@ -47,7 +46,7 @@ SELECT keeper_address, token_amount, usd_amount -FROM +FROM automation_reward_daily ORDER BY 2, 5 diff --git a/daily_spellbook/models/chainlink/polygon/chainlink_polygon_ccip_fulfilled_transactions.sql b/daily_spellbook/models/chainlink/polygon/chainlink_polygon_ccip_fulfilled_transactions.sql index dc3785b0de5..a37b9fbef93 100644 --- a/daily_spellbook/models/chainlink/polygon/chainlink_polygon_ccip_fulfilled_transactions.sql +++ b/daily_spellbook/models/chainlink/polygon/chainlink_polygon_ccip_fulfilled_transactions.sql @@ -8,7 +8,6 @@ ) }} -{% set incremental_interval = '7' %} WITH ccip_fulfilled_transactions AS ( @@ -23,12 +22,12 @@ WITH LEFT JOIN {{ source('polygon', 'transactions') }} tx ON ccip_send_logs_v1.tx_hash = tx.hash {% if is_incremental() %} - AND tx.block_time >= date_trunc('day', now() - interval '{{incremental_interval}}' day) + AND {{ incremental_predicate('tx.block_time') }} {% endif %} WHERE tx.success = true {% if is_incremental() %} - AND ccip_send_logs_v1.block_time >= date_trunc('day', now() - interval '{{incremental_interval}}' day) + AND {{ incremental_predicate('ccip_send_logs_v1.block_time') }} {% endif %} UNION @@ -44,14 +43,14 @@ WITH LEFT JOIN {{ source('polygon', 'transactions') }} tx ON ccip_send_logs_v1_2.tx_hash = tx.hash {% if is_incremental() %} - AND tx.block_time >= date_trunc('day', now() - interval '{{incremental_interval}}' day) + AND {{ incremental_predicate('tx.block_time') }} {% endif %} WHERE tx.success = true {% if is_incremental() %} - AND ccip_send_logs_v1_2.block_time >= date_trunc('day', now() - interval '{{incremental_interval}}' day) + AND {{ incremental_predicate('ccip_send_logs_v1_2.block_time') }} {% endif %} - + ) SELECT 'polygon' as blockchain, diff --git a/daily_spellbook/models/chainlink/polygon/chainlink_polygon_ccip_gas_daily.sql b/daily_spellbook/models/chainlink/polygon/chainlink_polygon_ccip_gas_daily.sql index b56c25ec6fd..139ff72cc36 100644 --- a/daily_spellbook/models/chainlink/polygon/chainlink_polygon_ccip_gas_daily.sql +++ b/daily_spellbook/models/chainlink/polygon/chainlink_polygon_ccip_gas_daily.sql @@ -1,6 +1,6 @@ {{ config( - + alias='ccip_gas_daily', partition_by=['date_month'], materialized='incremental', @@ -10,7 +10,6 @@ ) }} -{% set incremental_interval = '7' %} {% set truncate_by = 'day' %} WITH @@ -24,7 +23,7 @@ WITH {{ ref('chainlink_polygon_ccip_transmitted_fulfilled') }} fulfilled {% if is_incremental() %} WHERE - fulfilled.block_time >= date_trunc('day', now() - interval '{{incremental_interval}}' day) + {{ incremental_predicate('fulfilled.block_time') }} {% endif %} GROUP BY 1, 2 @@ -41,7 +40,7 @@ WITH {{ ref('chainlink_polygon_ccip_transmitted_reverted') }} reverted {% if is_incremental() %} WHERE - reverted.block_time >= date_trunc('day', now() - interval '{{incremental_interval}}' day) + {{ incremental_predicate('reverted.block_time') }} {% endif %} GROUP BY 1, 2 @@ -53,7 +52,7 @@ WITH COALESCE( fulfilled.date_start, reverted.date_start - ) AS "date_start", + ) AS "date_start", COALESCE( fulfilled.node_address, reverted.node_address @@ -86,7 +85,7 @@ WITH FROM ccip_gas_daily_meta LEFT JOIN {{ ref('chainlink_polygon_ccip_operator_meta') }} ccip_operator_meta ON ccip_operator_meta.node_address = ccip_gas_daily_meta.node_address ) -SELECT +SELECT blockchain, date_start, date_month, @@ -97,7 +96,7 @@ SELECT reverted_token_amount, reverted_usd_amount, total_token_amount, - total_usd_amount + total_usd_amount FROM ccip_gas_daily ORDER BY diff --git a/daily_spellbook/models/chainlink/polygon/chainlink_polygon_ccip_nop_reward_daily.sql b/daily_spellbook/models/chainlink/polygon/chainlink_polygon_ccip_nop_reward_daily.sql index b7a50a2f5d9..24fb721ce53 100644 --- a/daily_spellbook/models/chainlink/polygon/chainlink_polygon_ccip_nop_reward_daily.sql +++ b/daily_spellbook/models/chainlink/polygon/chainlink_polygon_ccip_nop_reward_daily.sql @@ -1,6 +1,6 @@ {{ config( - + alias='ccip_nop_reward_daily', partition_by = ['date_month'], materialized = 'incremental', @@ -10,7 +10,6 @@ ) }} -{% set incremental_interval = '7' %} WITH link_usd_daily AS ( @@ -20,7 +19,7 @@ WITH FROM {{ source('prices', 'usd') }} price WHERE - price.symbol = 'LINK' + price.symbol = 'LINK' GROUP BY 1 ORDER BY @@ -38,22 +37,22 @@ FROM {{ref('chainlink_polygon_ccip_nop_paid_logs')}} nop_logs LEFT JOIN {{ref('chainlink_polygon_ccip_admin_meta')}} admin_meta ON admin_meta.admin_address = nop_logs.nop_address {% if is_incremental() %} - WHERE block_time >= date_trunc('day', now() - interval '{{incremental_interval}}' day) -{% endif %} + WHERE {{ incremental_predicate('block_time') }} +{% endif %} GROUP BY 2, 4 ORDER BY 2, 4 ), nop_reward_daily AS ( - SELECT + SELECT nop_paid.date_start, cast(date_trunc('month', nop_paid.date_start) as date) as date_month, nop_paid.operator_name, - nop_paid.nop_address, + nop_paid.nop_address, nop_paid.token_amount as token_amount, (nop_paid.token_amount * lud.usd_amount) as usd_amount - FROM + FROM nop_paid LEFT JOIN link_usd_daily lud ON lud.date_start = nop_paid.date_start ORDER BY date_start @@ -66,7 +65,7 @@ SELECT nop_address, token_amount, usd_amount -FROM +FROM nop_reward_daily ORDER BY 2, 5 diff --git a/daily_spellbook/models/chainlink/polygon/chainlink_polygon_ccip_request_daily.sql b/daily_spellbook/models/chainlink/polygon/chainlink_polygon_ccip_request_daily.sql index a903c1f9a15..9918e9c8dc6 100644 --- a/daily_spellbook/models/chainlink/polygon/chainlink_polygon_ccip_request_daily.sql +++ b/daily_spellbook/models/chainlink/polygon/chainlink_polygon_ccip_request_daily.sql @@ -9,7 +9,6 @@ ) }} -{% set incremental_interval = '7' %} WITH ethereum_agg AS ( @@ -23,7 +22,7 @@ ethereum_agg AS ( WHERE eth.date_start = date_series.date_start {% if is_incremental() %} - AND eth.block_time >= date_trunc('day', now() - interval '{{incremental_interval}}' day) + AND {{ incremental_predicate('eth.block_time') }} {% endif %} ) AS fulfilled_requests, ( @@ -34,7 +33,7 @@ ethereum_agg AS ( WHERE rev.date_start = date_series.date_start {% if is_incremental() %} - AND rev.block_time >= date_trunc('day', now() - interval '{{incremental_interval}}' day) + AND {{ incremental_predicate('rev.block_time') }} {% endif %} ) AS reverted_requests FROM @@ -52,7 +51,7 @@ ethereum_agg AS ( ) AS seq CROSS JOIN UNNEST (seq.date_sequence) AS t (date_start) {% if is_incremental() %} - WHERE date_start >= date_trunc('day', now() - interval '{{incremental_interval}}' day) + WHERE {{ incremental_predicate('date_start') }} {% endif %} ) date_series ), @@ -67,7 +66,7 @@ ethereum_agg AS ( FROM ethereum_agg ) -SELECT +SELECT ccip_request_daily.blockchain, date_start, date_month, diff --git a/daily_spellbook/models/chainlink/polygon/chainlink_polygon_ccip_reverted_transactions.sql b/daily_spellbook/models/chainlink/polygon/chainlink_polygon_ccip_reverted_transactions.sql index 2a7487a4a29..d1efd787ddc 100644 --- a/daily_spellbook/models/chainlink/polygon/chainlink_polygon_ccip_reverted_transactions.sql +++ b/daily_spellbook/models/chainlink/polygon/chainlink_polygon_ccip_reverted_transactions.sql @@ -8,7 +8,6 @@ ) }} -{% set incremental_interval = '7' %} WITH ccip_reverted_transactions AS ( @@ -23,12 +22,12 @@ WITH LEFT JOIN {{ source('polygon', 'transactions') }} tx ON ccip_send_logs_v1.tx_hash = tx.hash {% if is_incremental() %} - AND tx.block_time >= date_trunc('day', now() - interval '{{incremental_interval}}' day) + AND {{ incremental_predicate('tx.block_time') }} {% endif %} WHERE tx.success = false {% if is_incremental() %} - AND ccip_send_logs_v1.block_time >= date_trunc('day', now() - interval '{{incremental_interval}}' day) + AND {{ incremental_predicate('ccip_send_logs_v1.block_time') }} {% endif %} UNION @@ -44,14 +43,14 @@ WITH LEFT JOIN {{ source('polygon', 'transactions') }} tx ON ccip_send_logs_v1_2.tx_hash = tx.hash {% if is_incremental() %} - AND tx.block_time >= date_trunc('day', now() - interval '{{incremental_interval}}' day) + AND {{ incremental_predicate('tx.block_time') }} {% endif %} WHERE tx.success = false {% if is_incremental() %} - AND ccip_send_logs_v1_2.block_time >= date_trunc('day', now() - interval '{{incremental_interval}}' day) + AND {{ incremental_predicate('ccip_send_logs_v1_2.block_time') }} {% endif %} - + ) SELECT 'polygon' as blockchain, diff --git a/daily_spellbook/models/chainlink/polygon/chainlink_polygon_ccip_reward_daily.sql b/daily_spellbook/models/chainlink/polygon/chainlink_polygon_ccip_reward_daily.sql index f02352cdd56..071c71ffa3f 100644 --- a/daily_spellbook/models/chainlink/polygon/chainlink_polygon_ccip_reward_daily.sql +++ b/daily_spellbook/models/chainlink/polygon/chainlink_polygon_ccip_reward_daily.sql @@ -9,7 +9,6 @@ ) }} -{% set incremental_interval = '7' %} WITH token_meta AS ( @@ -28,7 +27,7 @@ WITH {{ source('prices', 'usd') }} price JOIN token_meta ON price.symbol = token_meta.token_symbol {% if is_incremental() %} - WHERE price.minute >= date_trunc('day', now() - interval '{{incremental_interval}}' day) + WHERE {{ incremental_predicate('price.minute') }} {% endif %} GROUP BY 1, token_meta.token_symbol @@ -36,21 +35,21 @@ WITH 1 ), ccip_reward_daily AS ( - SELECT + SELECT ccip_send_requested_daily.date_start, - cast(date_trunc('month', ccip_send_requested_daily.date_start) as date) as date_month, + cast(date_trunc('month', ccip_send_requested_daily.date_start) as date) as date_month, SUM(ccip_send_requested_daily.fee_amount) as token_amount, SUM((ccip_send_requested_daily.fee_amount * tud.usd_amount)) as usd_amount, ccip_send_requested_daily.token as token - FROM + FROM {{ref('chainlink_polygon_ccip_send_requested_daily')}} ccip_send_requested_daily LEFT JOIN token_usd_daily tud ON tud.date_start = ccip_send_requested_daily.date_start AND tud.symbol = ccip_send_requested_daily.token {% if is_incremental() %} - WHERE ccip_send_requested_daily.date_start >= date_trunc('day', now() - interval '{{incremental_interval}}' day) - {% endif %} + WHERE {{ incremental_predicate('ccip_send_requested_daily.date_start') }} + {% endif %} GROUP BY 1, 5 ) - + SELECT 'polygon' as blockchain, date_start, @@ -58,7 +57,7 @@ SELECT token_amount, usd_amount, token -FROM +FROM ccip_reward_daily ORDER BY 2, 6 diff --git a/daily_spellbook/models/chainlink/polygon/chainlink_polygon_ccip_send_requested_daily.sql b/daily_spellbook/models/chainlink/polygon/chainlink_polygon_ccip_send_requested_daily.sql index 8cf5eaff4ae..0dcd3bbe14a 100644 --- a/daily_spellbook/models/chainlink/polygon/chainlink_polygon_ccip_send_requested_daily.sql +++ b/daily_spellbook/models/chainlink/polygon/chainlink_polygon_ccip_send_requested_daily.sql @@ -1,6 +1,6 @@ {{ config( - + alias='ccip_send_requested_daily', partition_by=['date_month'], materialized='incremental', @@ -10,7 +10,6 @@ ) }} -{% set incremental_interval = '7' %} SELECT 'polygon' as blockchain, @@ -23,8 +22,8 @@ SELECT FROM {{ref('chainlink_polygon_ccip_send_requested')}} ccip_send_requested {% if is_incremental() %} - WHERE evt_block_time >= date_trunc('day', now() - interval '{{incremental_interval}}' day) -{% endif %} + WHERE {{ incremental_predicate('evt_block_time') }} +{% endif %} GROUP BY 2, 5, 6 ORDER BY diff --git a/daily_spellbook/models/chainlink/polygon/chainlink_polygon_ccip_transmitted_fulfilled.sql b/daily_spellbook/models/chainlink/polygon/chainlink_polygon_ccip_transmitted_fulfilled.sql index 5b855a09df1..b7b8e03f99e 100644 --- a/daily_spellbook/models/chainlink/polygon/chainlink_polygon_ccip_transmitted_fulfilled.sql +++ b/daily_spellbook/models/chainlink/polygon/chainlink_polygon_ccip_transmitted_fulfilled.sql @@ -1,16 +1,16 @@ {{ config( - + alias='ccip_transmitted_fulfilled', partition_by=['date_month'], materialized='incremental', file_format='delta', incremental_strategy='merge', - unique_key=['tx_hash', 'tx_index', 'node_address'] + unique_key=['tx_hash', 'tx_index', 'node_address'], + incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.block_time')] ) }} -{% set incremental_interval = '7' %} WITH polygon_usd AS ( @@ -22,8 +22,8 @@ WITH WHERE symbol = 'MATIC' {% if is_incremental() %} - AND minute >= date_trunc('day', now() - interval '{{incremental_interval}}' day) - {% endif %} + AND {{ incremental_predicate('minute') }} + {% endif %} ), ccip_fulfilled_transactions AS ( SELECT @@ -38,12 +38,12 @@ WITH {{ source('polygon', 'transactions') }} tx RIGHT JOIN {{ ref('chainlink_polygon_ccip_transmitted_logs') }} ccip_tx ON ccip_tx.tx_hash = tx.hash {% if is_incremental() %} - AND ccip_tx.block_time >= date_trunc('day', now() - interval '{{incremental_interval}}' day) + AND {{ incremental_predicate('ccip_tx.block_time') }} {% endif %} LEFT JOIN polygon_usd ON date_trunc('minute', tx.block_time) = polygon_usd.block_time {% if is_incremental() %} - WHERE tx.block_time >= date_trunc('day', now() - interval '{{incremental_interval}}' day) - {% endif %} + WHERE {{ incremental_predicate('tx.block_time') }} + {% endif %} GROUP BY tx.hash, tx.index, diff --git a/daily_spellbook/models/chainlink/polygon/chainlink_polygon_ccip_transmitted_reverted.sql b/daily_spellbook/models/chainlink/polygon/chainlink_polygon_ccip_transmitted_reverted.sql index f269c225fff..4958fc5fe6f 100644 --- a/daily_spellbook/models/chainlink/polygon/chainlink_polygon_ccip_transmitted_reverted.sql +++ b/daily_spellbook/models/chainlink/polygon/chainlink_polygon_ccip_transmitted_reverted.sql @@ -1,16 +1,16 @@ {{ config( - + alias='ccip_transmitted_reverted', partition_by=['date_month'], materialized='incremental', file_format='delta', incremental_strategy='merge', - unique_key=['tx_hash', 'tx_index', 'node_address'] + unique_key=['tx_hash', 'tx_index', 'node_address'], + incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.block_time')] ) }} -{% set incremental_interval = '7' %} WITH polygon_usd AS ( @@ -22,8 +22,8 @@ WITH WHERE symbol = 'MATIC' {% if is_incremental() %} - AND minute >= date_trunc('day', now() - interval '{{incremental_interval}}' day) - {% endif %} + AND {{ incremental_predicate('minute') }} + {% endif %} ), ccip_reverted_transactions AS ( SELECT @@ -38,14 +38,14 @@ WITH {{ ref('chainlink_polygon_ccip_transmitted_logs') }} tx LEFT JOIN {{ source('polygon', 'transactions') }} tx2 ON tx2.hash = tx.tx_hash {% if is_incremental() %} - AND tx.block_time >= date_trunc('day', now() - interval '{{incremental_interval}}' day) + AND {{ incremental_predicate('tx.block_time') }} {% endif %} LEFT JOIN polygon_usd ON date_trunc('minute', tx.block_time) = polygon_usd.block_time WHERE tx2.success = false {% if is_incremental() %} - AND tx.block_time >= date_trunc('day', now() - interval '{{incremental_interval}}' day) - {% endif %} + AND {{ incremental_predicate('tx.block_time') }} + {% endif %} GROUP BY tx.tx_hash, tx.index, diff --git a/daily_spellbook/models/chainlink/polygon/chainlink_polygon_fm_fulfilled_transactions.sql b/daily_spellbook/models/chainlink/polygon/chainlink_polygon_fm_fulfilled_transactions.sql index ea311f8522f..8ca917a388d 100644 --- a/daily_spellbook/models/chainlink/polygon/chainlink_polygon_fm_fulfilled_transactions.sql +++ b/daily_spellbook/models/chainlink/polygon/chainlink_polygon_fm_fulfilled_transactions.sql @@ -1,16 +1,16 @@ {{ config( - + alias='fm_fulfilled_transactions', partition_by=['date_month'], materialized='incremental', file_format='delta', incremental_strategy='merge', - unique_key=['tx_hash', 'tx_index', 'node_address'] + unique_key=['tx_hash', 'tx_index', 'node_address'], + incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.block_time')] ) }} -{% set incremental_interval = '7' %} WITH polygon_usd AS ( @@ -22,8 +22,8 @@ WITH WHERE symbol = 'MATIC' {% if is_incremental() %} - AND minute >= date_trunc('day', now() - interval '{{incremental_interval}}' day) - {% endif %} + AND {{ incremental_predicate('minute') }} + {% endif %} ), fm_submission_transactions AS ( SELECT @@ -40,12 +40,12 @@ WITH {{ source('polygon', 'transactions') }} tx RIGHT JOIN {{ ref('chainlink_polygon_fm_gas_submission_logs') }} fm_gas_submission_logs ON fm_gas_submission_logs.tx_hash = tx.hash {% if is_incremental() %} - AND fm_gas_submission_logs.block_time >= date_trunc('day', now() - interval '{{incremental_interval}}' day) + AND {{ incremental_predicate('fm_gas_submission_logs.block_time') }} {% endif %} LEFT JOIN polygon_usd ON date_trunc('minute', tx.block_time) = polygon_usd.block_time {% if is_incremental() %} - WHERE tx.block_time >= date_trunc('day', now() - interval '{{incremental_interval}}' day) - {% endif %} + WHERE {{ incremental_predicate('tx.block_time') }} + {% endif %} GROUP BY tx.hash, tx.index, diff --git a/daily_spellbook/models/chainlink/polygon/chainlink_polygon_fm_gas_daily.sql b/daily_spellbook/models/chainlink/polygon/chainlink_polygon_fm_gas_daily.sql index 6ee688638df..7a6599b1264 100644 --- a/daily_spellbook/models/chainlink/polygon/chainlink_polygon_fm_gas_daily.sql +++ b/daily_spellbook/models/chainlink/polygon/chainlink_polygon_fm_gas_daily.sql @@ -1,6 +1,6 @@ {{ config( - + alias='fm_gas_daily', partition_by=['date_month'], materialized='incremental', @@ -10,7 +10,6 @@ ) }} -{% set incremental_interval = '7' %} {% set truncate_by = 'day' %} WITH @@ -24,7 +23,7 @@ WITH {{ ref('chainlink_polygon_fm_fulfilled_transactions') }} fulfilled {% if is_incremental() %} WHERE - fulfilled.block_time >= date_trunc('day', now() - interval '{{incremental_interval}}' day) + {{ incremental_predicate('fulfilled.block_time') }} {% endif %} GROUP BY 1, 2 @@ -41,7 +40,7 @@ WITH {{ ref('chainlink_polygon_fm_reverted_transactions') }} reverted {% if is_incremental() %} WHERE - reverted.block_time >= date_trunc('day', now() - interval '{{incremental_interval}}' day) + {{ incremental_predicate('reverted.block_time') }} {% endif %} GROUP BY 1, 2 @@ -53,7 +52,7 @@ WITH COALESCE( fulfilled.date_start, reverted.date_start - ) AS "date_start", + ) AS "date_start", COALESCE( fulfilled.node_address, reverted.node_address @@ -86,7 +85,7 @@ WITH FROM fm_gas_daily_meta LEFT JOIN {{ ref('chainlink_polygon_ocr_operator_node_meta') }} fm_operator_node_meta ON fm_operator_node_meta.node_address = fm_gas_daily_meta.node_address ) -SELECT +SELECT blockchain, date_start, date_month, @@ -97,7 +96,7 @@ SELECT reverted_token_amount, reverted_usd_amount, total_token_amount, - total_usd_amount + total_usd_amount FROM fm_gas_daily ORDER BY diff --git a/daily_spellbook/models/chainlink/polygon/chainlink_polygon_fm_request_daily.sql b/daily_spellbook/models/chainlink/polygon/chainlink_polygon_fm_request_daily.sql index ab4ffb037e0..726ef1ae4f1 100644 --- a/daily_spellbook/models/chainlink/polygon/chainlink_polygon_fm_request_daily.sql +++ b/daily_spellbook/models/chainlink/polygon/chainlink_polygon_fm_request_daily.sql @@ -1,6 +1,6 @@ {{ config( - + alias='fm_request_daily', partition_by=['date_month'], materialized='incremental', @@ -10,7 +10,6 @@ ) }} -{% set incremental_interval = '7' %} {% set truncate_by = 'day' %} WITH @@ -19,7 +18,7 @@ WITH COALESCE( cast(date_trunc('{{truncate_by}}', fulfilled.block_time) as date), cast(date_trunc('{{truncate_by}}', reverted.block_time) as date) - ) AS "date_start", + ) AS "date_start", COALESCE( fulfilled.node_address, reverted.node_address @@ -34,8 +33,8 @@ WITH reverted.node_address = fulfilled.node_address {% if is_incremental() %} WHERE - fulfilled.block_time >= date_trunc('day', now() - interval '{{incremental_interval}}' day) - AND reverted.block_time >= date_trunc('day', now() - interval '{{incremental_interval}}' day) + {{ incremental_predicate('fulfilled.block_time') }} + AND {{ incremental_predicate('reverted.block_time') }} {% endif %} GROUP BY 1, 2 @@ -55,7 +54,7 @@ WITH FROM fm_request_daily_meta LEFT JOIN {{ ref('chainlink_polygon_ocr_operator_node_meta') }} fm_operator_node_meta ON fm_operator_node_meta.node_address = fm_request_daily_meta.node_address ) -SELECT +SELECT blockchain, date_start, date_month, diff --git a/daily_spellbook/models/chainlink/polygon/chainlink_polygon_fm_reverted_transactions.sql b/daily_spellbook/models/chainlink/polygon/chainlink_polygon_fm_reverted_transactions.sql index 313cbe47a57..28fd771d299 100644 --- a/daily_spellbook/models/chainlink/polygon/chainlink_polygon_fm_reverted_transactions.sql +++ b/daily_spellbook/models/chainlink/polygon/chainlink_polygon_fm_reverted_transactions.sql @@ -1,16 +1,16 @@ {{ config( - + alias='fm_reverted_transactions', partition_by=['date_month'], materialized='incremental', file_format='delta', incremental_strategy='merge', - unique_key=['tx_hash', 'tx_index', 'node_address'] + unique_key=['tx_hash', 'tx_index', 'node_address'], + incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.block_time')] ) }} -{% set incremental_interval = '7' %} WITH polygon_usd AS ( @@ -22,8 +22,8 @@ WITH WHERE symbol = 'MATIC' {% if is_incremental() %} - AND minute >= date_trunc('day', now() - interval '{{incremental_interval}}' day) - {% endif %} + AND {{ incremental_predicate('minute') }} + {% endif %} ), fm_reverted_transactions AS ( SELECT @@ -42,8 +42,8 @@ WITH WHERE success = false {% if is_incremental() %} - AND tx.block_time >= date_trunc('day', now() - interval '{{incremental_interval}}' day) - {% endif %} + AND {{ incremental_predicate('tx.block_time') }} + {% endif %} GROUP BY tx.hash, tx.index, diff --git a/daily_spellbook/models/chainlink/polygon/chainlink_polygon_fm_reward_daily.sql b/daily_spellbook/models/chainlink/polygon/chainlink_polygon_fm_reward_daily.sql index ab083c4d4b9..c9c6f9d0458 100644 --- a/daily_spellbook/models/chainlink/polygon/chainlink_polygon_fm_reward_daily.sql +++ b/daily_spellbook/models/chainlink/polygon/chainlink_polygon_fm_reward_daily.sql @@ -1,6 +1,6 @@ {{ config( - + alias='fm_reward_daily', partition_by = ['date_month'], materialized = 'incremental', @@ -10,7 +10,6 @@ ) }} -{% set incremental_interval = '7' %} WITH admin_address_meta as ( @@ -28,8 +27,8 @@ WITH WHERE price.symbol = 'LINK' {% if is_incremental() %} - AND price.minute >= date_trunc('day', now() - interval '{{incremental_interval}}' day) - {% endif %} + AND {{ incremental_predicate('price.minute') }} + {% endif %} GROUP BY 1 ORDER BY @@ -77,16 +76,16 @@ WITH 1, 2 ), fm_reward_daily AS ( - SELECT + SELECT payment_meta.date_start, cast(date_trunc('month', payment_meta.date_start) as date) as date_month, payment_meta.admin_address, - ocr_operator_admin_meta.operator_name, + ocr_operator_admin_meta.operator_name, COALESCE(fm_reward_evt_transfer_daily.token_amount / EXTRACT(DAY FROM next_payment_date - prev_payment_date), 0) as token_amount, (COALESCE(fm_reward_evt_transfer_daily.token_amount / EXTRACT(DAY FROM next_payment_date - prev_payment_date), 0) * payment_meta.usd_amount) as usd_amount - FROM + FROM payment_meta - LEFT JOIN + LEFT JOIN {{ref('chainlink_polygon_fm_reward_evt_transfer_daily')}} fm_reward_evt_transfer_daily ON payment_meta.next_payment_date = fm_reward_evt_transfer_daily.date_start AND payment_meta.admin_address = fm_reward_evt_transfer_daily.admin_address @@ -101,7 +100,7 @@ SELECT operator_name, token_amount, usd_amount -FROM +FROM fm_reward_daily ORDER BY 2, 4 diff --git a/daily_spellbook/models/chainlink/polygon/chainlink_polygon_fm_reward_evt_transfer_daily.sql b/daily_spellbook/models/chainlink/polygon/chainlink_polygon_fm_reward_evt_transfer_daily.sql index 4e61fef1838..f2392c20dff 100644 --- a/daily_spellbook/models/chainlink/polygon/chainlink_polygon_fm_reward_evt_transfer_daily.sql +++ b/daily_spellbook/models/chainlink/polygon/chainlink_polygon_fm_reward_evt_transfer_daily.sql @@ -1,6 +1,6 @@ {{ config( - + alias='fm_reward_evt_transfer_daily', partition_by=['date_month'], materialized='incremental', @@ -10,7 +10,6 @@ ) }} -{% set incremental_interval = '7' %} SELECT 'polygon' as blockchain, @@ -23,8 +22,8 @@ FROM {{ref('chainlink_polygon_fm_reward_evt_transfer')}} fm_reward_evt_transfer LEFT JOIN {{ ref('chainlink_polygon_ocr_operator_admin_meta') }} fm_operator_admin_meta ON fm_operator_admin_meta.admin_address = fm_reward_evt_transfer.admin_address {% if is_incremental() %} - WHERE evt_block_time >= date_trunc('day', now() - interval '{{incremental_interval}}' day) -{% endif %} + WHERE {{ incremental_predicate('evt_block_time') }} +{% endif %} GROUP BY 2, 4 ORDER BY diff --git a/daily_spellbook/models/chainlink/polygon/chainlink_polygon_ocr_fulfilled_transactions.sql b/daily_spellbook/models/chainlink/polygon/chainlink_polygon_ocr_fulfilled_transactions.sql index b80e376a83f..86a87f48665 100644 --- a/daily_spellbook/models/chainlink/polygon/chainlink_polygon_ocr_fulfilled_transactions.sql +++ b/daily_spellbook/models/chainlink/polygon/chainlink_polygon_ocr_fulfilled_transactions.sql @@ -1,12 +1,13 @@ {{ config( - + alias='ocr_fulfilled_transactions', partition_by=['date_month'], materialized='incremental', file_format='delta', incremental_strategy='merge', unique_key=['tx_hash', 'tx_index', 'node_address'], + incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.block_time')], post_hook='{{ expose_spells(\'["polygon"]\', "project", "chainlink", @@ -14,7 +15,6 @@ ) }} -{% set incremental_interval = '7' %} WITH polygon_usd AS ( @@ -26,8 +26,8 @@ WITH WHERE symbol = 'MATIC' {% if is_incremental() %} - AND minute >= date_trunc('day', now() - interval '{{incremental_interval}}' day) - {% endif %} + AND {{ incremental_predicate('minute') }} + {% endif %} ), ocr_fulfilled_transactions AS ( SELECT @@ -43,8 +43,8 @@ WITH RIGHT JOIN {{ ref('chainlink_polygon_ocr_gas_transmission_logs') }} ocr_gas_transmission_logs ON ocr_gas_transmission_logs.tx_hash = tx.hash LEFT JOIN polygon_usd ON date_trunc('minute', tx.block_time) = polygon_usd.block_time {% if is_incremental() %} - WHERE tx.block_time >= date_trunc('day', now() - interval '{{incremental_interval}}' day) - {% endif %} + WHERE {{ incremental_predicate('tx.block_time') }} + {% endif %} GROUP BY tx.hash, tx.index, diff --git a/daily_spellbook/models/chainlink/polygon/chainlink_polygon_ocr_gas_daily.sql b/daily_spellbook/models/chainlink/polygon/chainlink_polygon_ocr_gas_daily.sql index cf19173d24f..6bd621bb0fb 100644 --- a/daily_spellbook/models/chainlink/polygon/chainlink_polygon_ocr_gas_daily.sql +++ b/daily_spellbook/models/chainlink/polygon/chainlink_polygon_ocr_gas_daily.sql @@ -1,6 +1,6 @@ {{ config( - + alias='ocr_gas_daily', partition_by=['date_month'], materialized='incremental', @@ -14,7 +14,6 @@ ) }} -{% set incremental_interval = '7' %} {% set truncate_by = 'day' %} WITH @@ -28,7 +27,7 @@ WITH {{ ref('chainlink_polygon_ocr_fulfilled_transactions') }} fulfilled {% if is_incremental() %} WHERE - fulfilled.block_time >= date_trunc('day', now() - interval '{{incremental_interval}}' day) + {{ incremental_predicate('fulfilled.block_time') }} {% endif %} GROUP BY 1, 2 @@ -45,7 +44,7 @@ WITH {{ ref('chainlink_polygon_ocr_reverted_transactions') }} reverted {% if is_incremental() %} WHERE - reverted.block_time >= date_trunc('day', now() - interval '{{incremental_interval}}' day) + {{ incremental_predicate('reverted.block_time') }} {% endif %} GROUP BY 1, 2 @@ -57,7 +56,7 @@ WITH COALESCE( fulfilled.date_start, reverted.date_start - ) AS "date_start", + ) AS "date_start", COALESCE( fulfilled.node_address, reverted.node_address @@ -90,7 +89,7 @@ WITH FROM ocr_gas_daily_meta LEFT JOIN {{ ref('chainlink_polygon_ocr_operator_node_meta') }} ocr_operator_node_meta ON ocr_operator_node_meta.node_address = ocr_gas_daily_meta.node_address ) -SELECT +SELECT blockchain, date_start, date_month, @@ -101,7 +100,7 @@ SELECT reverted_token_amount, reverted_usd_amount, total_token_amount, - total_usd_amount + total_usd_amount FROM ocr_gas_daily ORDER BY diff --git a/daily_spellbook/models/chainlink/polygon/chainlink_polygon_ocr_request_daily.sql b/daily_spellbook/models/chainlink/polygon/chainlink_polygon_ocr_request_daily.sql index 16e64dc7ba9..afb080bc97d 100644 --- a/daily_spellbook/models/chainlink/polygon/chainlink_polygon_ocr_request_daily.sql +++ b/daily_spellbook/models/chainlink/polygon/chainlink_polygon_ocr_request_daily.sql @@ -1,6 +1,6 @@ {{ config( - + alias='ocr_request_daily', partition_by=['date_month'], materialized='incremental', @@ -14,7 +14,6 @@ ) }} -{% set incremental_interval = '7' %} {% set truncate_by = 'day' %} WITH @@ -23,7 +22,7 @@ WITH COALESCE( cast(date_trunc('{{truncate_by}}', fulfilled.block_time) as date), cast(date_trunc('{{truncate_by}}', reverted.block_time) as date) - ) AS "date_start", + ) AS "date_start", COALESCE( fulfilled.node_address, reverted.node_address @@ -38,8 +37,8 @@ WITH reverted.node_address = fulfilled.node_address {% if is_incremental() %} WHERE - fulfilled.block_time >= date_trunc('day', now() - interval '{{incremental_interval}}' day) - OR reverted.block_time >= date_trunc('day', now() - interval '{{incremental_interval}}' day) + {{ incremental_predicate('fulfilled.block_time') }} + OR {{ incremental_predicate('reverted.block_time') }} {% endif %} GROUP BY 1, 2 @@ -59,7 +58,7 @@ WITH FROM ocr_request_daily_meta LEFT JOIN {{ ref('chainlink_polygon_ocr_operator_node_meta') }} ocr_operator_node_meta ON ocr_operator_node_meta.node_address = ocr_request_daily_meta.node_address ) -SELECT +SELECT blockchain, date_start, date_month, diff --git a/daily_spellbook/models/chainlink/polygon/chainlink_polygon_ocr_reverted_transactions.sql b/daily_spellbook/models/chainlink/polygon/chainlink_polygon_ocr_reverted_transactions.sql index 6003eecc97b..0259d75b74f 100644 --- a/daily_spellbook/models/chainlink/polygon/chainlink_polygon_ocr_reverted_transactions.sql +++ b/daily_spellbook/models/chainlink/polygon/chainlink_polygon_ocr_reverted_transactions.sql @@ -1,12 +1,13 @@ {{ config( - + alias='ocr_reverted_transactions', partition_by=['date_month'], materialized='incremental', file_format='delta', incremental_strategy='merge', unique_key=['tx_hash', 'tx_index', 'node_address'], + incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.block_time')], post_hook='{{ expose_spells(\'["polygon"]\', "project", "chainlink", @@ -14,7 +15,6 @@ ) }} -{% set incremental_interval = '7' %} WITH polygon_usd AS ( @@ -26,8 +26,8 @@ WITH WHERE symbol = 'MATIC' {% if is_incremental() %} - AND minute >= date_trunc('day', now() - interval '{{incremental_interval}}' day) - {% endif %} + AND {{ incremental_predicate('minute') }} + {% endif %} ), ocr_reverted_transactions AS ( SELECT @@ -44,8 +44,8 @@ WITH WHERE success = false {% if is_incremental() %} - AND tx.block_time >= date_trunc('day', now() - interval '{{incremental_interval}}' day) - {% endif %} + AND {{ incremental_predicate('tx.block_time') }} + {% endif %} GROUP BY tx.hash, tx.index, diff --git a/daily_spellbook/models/chainlink/polygon/chainlink_polygon_ocr_reward_daily.sql b/daily_spellbook/models/chainlink/polygon/chainlink_polygon_ocr_reward_daily.sql index 6577ae31df2..7a7f017ec14 100644 --- a/daily_spellbook/models/chainlink/polygon/chainlink_polygon_ocr_reward_daily.sql +++ b/daily_spellbook/models/chainlink/polygon/chainlink_polygon_ocr_reward_daily.sql @@ -1,6 +1,6 @@ {{ config( - + alias='ocr_reward_daily', partition_by = ['date_month'], materialized = 'incremental', @@ -14,7 +14,6 @@ ) }} -{% set incremental_interval = '7' %} WITH admin_address_meta as ( @@ -32,8 +31,8 @@ WITH WHERE price.symbol = 'LINK' {% if is_incremental() %} - AND price.minute >= date_trunc('day', now() - interval '{{incremental_interval}}' day) - {% endif %} + AND {{ incremental_predicate('price.minute') }} + {% endif %} GROUP BY 1 ORDER BY @@ -81,16 +80,16 @@ WITH 1, 2 ), ocr_reward_daily AS ( - SELECT + SELECT payment_meta.date_start, cast(date_trunc('month', payment_meta.date_start) as date) as date_month, payment_meta.admin_address, ocr_operator_admin_meta.operator_name, COALESCE((ocr_reward_evt_transfer_daily.token_amount + COALESCE(reconcile_daily.token_amount, 0)) / EXTRACT(DAY FROM next_payment_date - prev_payment_date), 0) as token_amount, (COALESCE((ocr_reward_evt_transfer_daily.token_amount + COALESCE(reconcile_daily.token_amount, 0)) / EXTRACT(DAY FROM next_payment_date - prev_payment_date), 0) * payment_meta.usd_amount) as usd_amount - FROM + FROM payment_meta - LEFT JOIN + LEFT JOIN {{ref('chainlink_polygon_ocr_reward_evt_transfer_daily')}} ocr_reward_evt_transfer_daily ON payment_meta.next_payment_date = ocr_reward_evt_transfer_daily.date_start AND payment_meta.admin_address = ocr_reward_evt_transfer_daily.admin_address @@ -109,7 +108,7 @@ SELECT operator_name, token_amount, usd_amount -FROM +FROM ocr_reward_daily ORDER BY 2, 4 diff --git a/daily_spellbook/models/chainlink/polygon/chainlink_polygon_ocr_reward_evt_transfer_daily.sql b/daily_spellbook/models/chainlink/polygon/chainlink_polygon_ocr_reward_evt_transfer_daily.sql index 32baabf6dbf..9173f321ea4 100644 --- a/daily_spellbook/models/chainlink/polygon/chainlink_polygon_ocr_reward_evt_transfer_daily.sql +++ b/daily_spellbook/models/chainlink/polygon/chainlink_polygon_ocr_reward_evt_transfer_daily.sql @@ -1,6 +1,6 @@ {{ config( - + alias='ocr_reward_evt_transfer_daily', partition_by=['date_month'], materialized='incremental', @@ -14,7 +14,6 @@ ) }} -{% set incremental_interval = '7' %} SELECT 'polygon' as blockchain, @@ -27,8 +26,8 @@ FROM {{ref('chainlink_polygon_ocr_reward_evt_transfer')}} ocr_reward_evt_transfer LEFT JOIN {{ ref('chainlink_polygon_ocr_operator_admin_meta') }} ocr_operator_admin_meta ON ocr_operator_admin_meta.admin_address = ocr_reward_evt_transfer.admin_address {% if is_incremental() %} - WHERE evt_block_time >= date_trunc('day', now() - interval '{{incremental_interval}}' day) -{% endif %} + WHERE {{ incremental_predicate('evt_block_time') }} +{% endif %} GROUP BY 2, 4 ORDER BY diff --git a/daily_spellbook/models/chainlink/polygon/chainlink_polygon_price_feeds.sql b/daily_spellbook/models/chainlink/polygon/chainlink_polygon_price_feeds.sql index d3d95f8d7c0..663e11af19d 100644 --- a/daily_spellbook/models/chainlink/polygon/chainlink_polygon_price_feeds.sql +++ b/daily_spellbook/models/chainlink/polygon/chainlink_polygon_price_feeds.sql @@ -1,6 +1,6 @@ {{ config( - + alias='price_feeds', partition_by=['block_month'], materialized='incremental', @@ -14,7 +14,6 @@ ) }} -{% set incremental_interval = '7' %} {% set project_start_date = '2020-10-26' %} SELECT 'polygon' as blockchain, @@ -59,7 +58,7 @@ FROM AND l.block_time >= cast('{{project_start_date}}' as date) {% endif %} {% if is_incremental() %} - AND l.block_time >= date_trunc('day', now() - interval '{{incremental_interval}}' day) + AND {{ incremental_predicate('l.block_time') }} {% endif %} GROUP BY 1, 2, 3, 4, 5, 6 diff --git a/daily_spellbook/models/chainlink/polygon/chainlink_polygon_price_feeds_hourly.sql b/daily_spellbook/models/chainlink/polygon/chainlink_polygon_price_feeds_hourly.sql index f2e60547b98..38c66c61549 100644 --- a/daily_spellbook/models/chainlink/polygon/chainlink_polygon_price_feeds_hourly.sql +++ b/daily_spellbook/models/chainlink/polygon/chainlink_polygon_price_feeds_hourly.sql @@ -1,6 +1,6 @@ {{ config( - + alias='price_feeds_hourly', partition_by=['block_month'], materialized='incremental', @@ -11,7 +11,6 @@ ) }} -{% set incremental_interval = '7' %} {% set project_start_date = '2019-10-01' %} WITH hourly_sequence_meta AS ( @@ -25,7 +24,7 @@ WITH hourly_sequence_meta AS ( AND price.minute >= timestamp '{{project_start_date}}' {% endif %} {% if is_incremental() %} - AND price.minute >= date_trunc('hour', now() - interval '{{incremental_interval}}' day) + AND {{ incremental_predicate('price.minute') }} {% endif %} GROUP BY 1 @@ -70,7 +69,7 @@ aggregated_price_feeds AS ( hourly_sequence.hr >= timestamp '{{project_start_date}}' {% endif %} {% if is_incremental() %} - hourly_sequence.hr >= date_trunc('hour', now() - interval '{{incremental_interval}}' day) + {{ incremental_predicate('hourly_sequence.hr') }} {% endif %} GROUP BY hourly_sequence.hr, hourly_sequence.feed_name, hourly_sequence.proxy_address, hourly_sequence.aggregator_address diff --git a/daily_spellbook/models/chainlink/polygon/chainlink_polygon_vrf_fulfilled_transactions.sql b/daily_spellbook/models/chainlink/polygon/chainlink_polygon_vrf_fulfilled_transactions.sql index 3e1f09c58f5..2730162334f 100644 --- a/daily_spellbook/models/chainlink/polygon/chainlink_polygon_vrf_fulfilled_transactions.sql +++ b/daily_spellbook/models/chainlink/polygon/chainlink_polygon_vrf_fulfilled_transactions.sql @@ -1,12 +1,13 @@ {{ config( - + alias='vrf_fulfilled_transactions', partition_by=['date_month'], materialized='incremental', file_format='delta', incremental_strategy='merge', - unique_key=['tx_hash', 'tx_index', 'node_address'] + unique_key=['tx_hash', 'tx_index', 'node_address'], + incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.block_time')] ) }} @@ -22,7 +23,7 @@ WITH {% if is_incremental() %} AND {{ incremental_predicate('minute') }} - {% endif %} + {% endif %} ), vrf_fulfilled_transactions AS ( SELECT @@ -39,14 +40,14 @@ WITH {{ source('polygon', 'transactions') }} tx RIGHT JOIN {{ ref('chainlink_polygon_vrf_v1_random_fulfilled_logs') }} vrf_v1_logs ON vrf_v1_logs.tx_hash = tx.hash {% if is_incremental() %} - AND + AND {{ incremental_predicate('tx.block_time') }} {% endif %} LEFT JOIN polygon_usd ON date_trunc('minute', tx.block_time) = polygon_usd.block_time {% if is_incremental() %} WHERE {{ incremental_predicate('tx.block_time') }} - {% endif %} + {% endif %} GROUP BY tx.hash, tx.index, @@ -75,7 +76,7 @@ WITH {% if is_incremental() %} WHERE {{ incremental_predicate('tx.block_time') }} - {% endif %} + {% endif %} GROUP BY tx.hash, tx.index, diff --git a/daily_spellbook/models/chainlink/polygon/chainlink_polygon_vrf_gas_daily.sql b/daily_spellbook/models/chainlink/polygon/chainlink_polygon_vrf_gas_daily.sql index f9fc5dafc3c..bbd5e1d915e 100644 --- a/daily_spellbook/models/chainlink/polygon/chainlink_polygon_vrf_gas_daily.sql +++ b/daily_spellbook/models/chainlink/polygon/chainlink_polygon_vrf_gas_daily.sql @@ -1,6 +1,6 @@ {{ config( - + alias='vrf_gas_daily', partition_by=['date_month'], materialized='incremental', @@ -10,7 +10,6 @@ ) }} -{% set incremental_interval = '7' %} {% set truncate_by = 'day' %} WITH @@ -24,7 +23,7 @@ WITH {{ ref('chainlink_polygon_vrf_fulfilled_transactions') }} fulfilled {% if is_incremental() %} WHERE - fulfilled.block_time >= date_trunc('day', now() - interval '{{incremental_interval}}' day) + {{ incremental_predicate('fulfilled.block_time') }} {% endif %} GROUP BY 1, 2 @@ -41,7 +40,7 @@ WITH {{ ref('chainlink_polygon_vrf_reverted_transactions') }} reverted {% if is_incremental() %} WHERE - reverted.block_time >= date_trunc('day', now() - interval '{{incremental_interval}}' day) + {{ incremental_predicate('reverted.block_time') }} {% endif %} GROUP BY 1, 2 @@ -53,7 +52,7 @@ WITH COALESCE( fulfilled.date_start, reverted.date_start - ) AS "date_start", + ) AS "date_start", COALESCE( fulfilled.node_address, reverted.node_address @@ -84,7 +83,7 @@ WITH fulfilled_usd_amount + reverted_usd_amount as total_usd_amount FROM vrf_gas_daily_meta ) -SELECT +SELECT blockchain, date_start, date_month, @@ -94,7 +93,7 @@ SELECT reverted_token_amount, reverted_usd_amount, total_token_amount, - total_usd_amount + total_usd_amount FROM vrf_gas_daily ORDER BY diff --git a/daily_spellbook/models/chainlink/polygon/chainlink_polygon_vrf_request_daily.sql b/daily_spellbook/models/chainlink/polygon/chainlink_polygon_vrf_request_daily.sql index 7023d81ef33..2e4ebfda2ef 100644 --- a/daily_spellbook/models/chainlink/polygon/chainlink_polygon_vrf_request_daily.sql +++ b/daily_spellbook/models/chainlink/polygon/chainlink_polygon_vrf_request_daily.sql @@ -1,6 +1,6 @@ {{ config( - + alias='vrf_request_daily', partition_by=['date_month'], materialized='incremental', @@ -10,7 +10,6 @@ ) }} -{% set incremental_interval = '7' %} {% set truncate_by = 'day' %} WITH @@ -19,7 +18,7 @@ WITH COALESCE( cast(date_trunc('{{truncate_by}}', fulfilled.block_time) as date), cast(date_trunc('{{truncate_by}}', reverted.block_time) as date) - ) AS "date_start", + ) AS "date_start", COALESCE( fulfilled.node_address, reverted.node_address @@ -34,8 +33,8 @@ WITH reverted.node_address = fulfilled.node_address {% if is_incremental() %} WHERE - fulfilled.block_time >= date_trunc('day', now() - interval '{{incremental_interval}}' day) - AND reverted.block_time >= date_trunc('day', now() - interval '{{incremental_interval}}' day) + {{ incremental_predicate('fulfilled.block_time') }} + AND {{ incremental_predicate('reverted.block_time') }} {% endif %} GROUP BY 1, 2 @@ -53,7 +52,7 @@ WITH total_requests FROM vrf_request_daily_meta ) -SELECT +SELECT blockchain, date_start, date_month, diff --git a/daily_spellbook/models/chainlink/polygon/chainlink_polygon_vrf_request_fulfilled_daily.sql b/daily_spellbook/models/chainlink/polygon/chainlink_polygon_vrf_request_fulfilled_daily.sql index f908f99d151..faf0bd6600b 100644 --- a/daily_spellbook/models/chainlink/polygon/chainlink_polygon_vrf_request_fulfilled_daily.sql +++ b/daily_spellbook/models/chainlink/polygon/chainlink_polygon_vrf_request_fulfilled_daily.sql @@ -1,6 +1,6 @@ {{ config( - + alias='vrf_request_fulfilled_daily', partition_by=['date_month'], materialized='incremental', @@ -10,7 +10,6 @@ ) }} -{% set incremental_interval = '7' %} SELECT 'polygon' as blockchain, @@ -21,8 +20,8 @@ SELECT FROM {{ref('chainlink_polygon_vrf_request_fulfilled')}} vrf_request_fulfilled {% if is_incremental() %} - WHERE evt_block_time >= date_trunc('day', now() - interval '{{incremental_interval}}' day) -{% endif %} + WHERE {{ incremental_predicate('evt_block_time') }} +{% endif %} GROUP BY 2, 4 ORDER BY diff --git a/daily_spellbook/models/chainlink/polygon/chainlink_polygon_vrf_reverted_transactions.sql b/daily_spellbook/models/chainlink/polygon/chainlink_polygon_vrf_reverted_transactions.sql index 80e9bf995b5..7e0fa6494a5 100644 --- a/daily_spellbook/models/chainlink/polygon/chainlink_polygon_vrf_reverted_transactions.sql +++ b/daily_spellbook/models/chainlink/polygon/chainlink_polygon_vrf_reverted_transactions.sql @@ -1,16 +1,16 @@ {{ config( - + alias='vrf_reverted_transactions', partition_by=['date_month'], materialized='incremental', file_format='delta', incremental_strategy='merge', - unique_key=['tx_hash', 'tx_index', 'node_address'] + unique_key=['tx_hash', 'tx_index', 'node_address'], + incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.block_time')] ) }} -{% set incremental_interval = '7' %} WITH polygon_usd AS ( @@ -22,8 +22,8 @@ WITH WHERE symbol = 'MATIC' {% if is_incremental() %} - AND minute >= date_trunc('day', now() - interval '{{incremental_interval}}' day) - {% endif %} + AND {{ incremental_predicate('minute') }} + {% endif %} ), vrf_reverted_transactions AS ( SELECT @@ -42,8 +42,8 @@ WITH WHERE success = false {% if is_incremental() %} - AND tx.block_time >= date_trunc('day', now() - interval '{{incremental_interval}}' day) - {% endif %} + AND {{ incremental_predicate('tx.block_time') }} + {% endif %} GROUP BY tx.hash, tx.index, diff --git a/daily_spellbook/models/chainlink/polygon/chainlink_polygon_vrf_reward_daily.sql b/daily_spellbook/models/chainlink/polygon/chainlink_polygon_vrf_reward_daily.sql index f45b46d6eb2..828f89931be 100644 --- a/daily_spellbook/models/chainlink/polygon/chainlink_polygon_vrf_reward_daily.sql +++ b/daily_spellbook/models/chainlink/polygon/chainlink_polygon_vrf_reward_daily.sql @@ -1,6 +1,6 @@ {{ config( - + alias='vrf_reward_daily', partition_by = ['date_month'], materialized = 'incremental', @@ -10,7 +10,6 @@ ) }} -{% set incremental_interval = '7' %} WITH link_usd_daily AS ( @@ -20,20 +19,20 @@ WITH FROM {{ source('prices', 'usd') }} price WHERE - price.symbol = 'LINK' + price.symbol = 'LINK' GROUP BY 1 ORDER BY 1 ), vrf_reward_daily AS ( - SELECT + SELECT vrf_daily.date_start, cast(date_trunc('month', vrf_daily.date_start) as date) as date_month, - vrf_daily.operator_address, + vrf_daily.operator_address, COALESCE(vrf_daily.token_amount, 0) as token_amount, COALESCE(vrf_daily.token_amount * lud.usd_amount, 0) as usd_amount - FROM + FROM {{ref('chainlink_polygon_vrf_request_fulfilled_daily')}} vrf_daily LEFT JOIN link_usd_daily lud ON lud.date_start = vrf_daily.date_start ORDER BY date_start @@ -45,7 +44,7 @@ SELECT operator_address, token_amount, usd_amount -FROM +FROM vrf_reward_daily ORDER BY 2, 4 From 724f6343de48498d045e07fcba6349a73110282b Mon Sep 17 00:00:00 2001 From: jeff-dude <102681548+jeff-dude@users.noreply.github.com> Date: Tue, 4 Jun 2024 15:10:04 -0400 Subject: [PATCH 038/149] Revert "Organize Balancer Spells into folders (#6005)" (#6074) This reverts commit c1b5417a186c4701e452fcaeea1ebebaea625653. --- dbt_project.yml | 13 + .../balancer/balancer_bpt_supply_macro.sql | 34 +- ...l_token_supply_changes_daily_agg_macro.sql | 37 - ...lancer_pool_token_supply_changes_macro.sql | 130 ---- ..._token_balance_changes_daily_agg_macro.sql | 184 ----- .../balancer_token_balance_changes_macro.sql | 169 ----- .../balancer/{trades => }/balancer_trades.sql | 0 models/_project/balancer/balances/_schema.yml | 98 --- .../balancer/balances/arbitrum/_schema.yml | 100 --- ...ncer_v2_arbitrum_token_balance_changes.sql | 16 - ...2_arbitrum_token_balance_changes_daily.sql | 17 - .../balancer/balances/avalanche_c/_schema.yml | 100 --- ...r_v2_avalanche_c_token_balance_changes.sql | 16 - ...valanche_c_token_balance_changes_daily.sql | 17 - .../balancer_token_balance_changes.sql | 46 -- .../balancer_token_balance_changes_daily.sql | 43 -- .../balancer/balances/base/_schema.yml | 100 --- ...balancer_v2_base_token_balance_changes.sql | 16 - ...er_v2_base_token_balance_changes_daily.sql | 17 - .../balancer/balances/ethereum/_schema.yml | 131 ---- ...ncer_v2_ethereum_token_balance_changes.sql | 16 - ...2_ethereum_token_balance_changes_daily.sql | 17 - .../balancer/balances/gnosis/_schema.yml | 100 --- ...lancer_v2_gnosis_token_balance_changes.sql | 16 - ..._v2_gnosis_token_balance_changes_daily.sql | 17 - .../balancer/balances/optimism/_schema.yml | 100 --- ...ncer_v2_optimism_token_balance_changes.sql | 16 - ...2_optimism_token_balance_changes_daily.sql | 17 - .../balancer/balances/polygon/_schema.yml | 100 --- ...ancer_v2_polygon_token_balance_changes.sql | 16 - ...v2_polygon_token_balance_changes_daily.sql | 17 - .../balancer/balances/zkevm/_schema.yml | 100 --- ...alancer_v2_zkevm_token_balance_changes.sql | 16 - ...r_v2_zkevm_token_balance_changes_daily.sql | 17 - models/_project/balancer/bpt/_schema.yml | 176 ----- .../balancer/bpt/arbitrum/_schema.yml | 178 ----- ...alancer_v2_arbitrum_bpt_supply_changes.sql | 20 - ...r_v2_arbitrum_bpt_supply_changes_daily.sql | 17 - .../balancer/bpt/avalanche_c/_schema.yml | 178 ----- ...ncer_v2_avalanche_c_bpt_supply_changes.sql | 20 - ...2_avalanche_c_bpt_supply_changes_daily.sql | 17 - .../bpt/balancer_bpt_supply_changes.sql | 44 -- .../bpt/balancer_bpt_supply_changes_daily.sql | 38 - models/_project/balancer/bpt/base/_schema.yml | 178 ----- .../balancer_v2_base_bpt_supply_changes.sql | 20 - ...ancer_v2_base_bpt_supply_changes_daily.sql | 17 - .../balancer/bpt/ethereum/_schema.yml | 178 ----- ...alancer_v2_ethereum_bpt_supply_changes.sql | 20 - ...r_v2_ethereum_bpt_supply_changes_daily.sql | 17 - .../_project/balancer/bpt/gnosis/_schema.yml | 178 ----- .../balancer_v2_gnosis_bpt_supply_changes.sql | 20 - ...cer_v2_gnosis_bpt_supply_changes_daily.sql | 17 - .../balancer/bpt/optimism/_schema.yml | 178 ----- ...alancer_v2_optimism_bpt_supply_changes.sql | 20 - ...r_v2_optimism_bpt_supply_changes_daily.sql | 17 - .../_project/balancer/bpt/polygon/_schema.yml | 178 ----- ...balancer_v2_polygon_bpt_supply_changes.sql | 20 - ...er_v2_polygon_bpt_supply_changes_daily.sql | 17 - .../_project/balancer/bpt/zkevm/_schema.yml | 178 ----- .../balancer_v2_zkevm_bpt_supply_changes.sql | 20 - ...ncer_v2_zkevm_bpt_supply_changes_daily.sql | 17 - .../_project/balancer/flashloans/_schema.yml | 35 - .../balancer/flashloans/arbitrum/_schema.yml | 36 - .../flashloans/avalanche_c/_schema.yml | 36 - .../balancer/flashloans/base/_schema.yml | 36 - .../balancer/flashloans/ethereum/_schema.yml | 36 - .../balancer/flashloans/gnosis/_schema.yml | 36 - .../balancer/flashloans/optimism/_schema.yml | 36 - .../balancer/flashloans/polygon/_schema.yml | 36 - .../balancer/flashloans/zkevm/_schema.yml | 36 - .../_project/balancer/liquidity/_schema.yml | 60 -- .../balancer/liquidity/arbitrum/_schema.yml | 58 -- .../liquidity/avalanche_c/_schema.yml | 58 -- .../balancer/liquidity/base/_schema.yml | 58 -- .../balancer/liquidity/ethereum/_schema.yml | 96 --- .../balancer/liquidity/gnosis/_schema.yml | 58 -- .../balancer/liquidity/optimism/_schema.yml | 58 -- .../balancer/liquidity/polygon/_schema.yml | 58 -- .../balancer/liquidity/zkevm/_schema.yml | 58 -- models/_project/balancer/pools/_schema.yml | 173 ----- .../balancer/pools/arbitrum/_schema.yml | 105 --- .../balancer/pools/avalanche_c/_schema.yml | 105 --- .../_project/balancer/pools/base/_schema.yml | 105 --- .../balancer/pools/ethereum/_schema.yml | 149 ---- .../balancer/pools/gnosis/_schema.yml | 105 --- .../balancer/pools/optimism/_schema.yml | 146 ---- .../balancer/pools/polygon/_schema.yml | 128 ---- .../_project/balancer/pools/zkevm/_schema.yml | 105 --- .../balancer/protocol_fee/_schema.yml | 61 -- .../protocol_fee/arbitrum/_schema.yml | 61 -- .../protocol_fee/avalanche_c/_schema.yml | 61 -- .../balancer/protocol_fee/base/_schema.yml | 61 -- .../protocol_fee/ethereum/_schema.yml | 61 -- .../balancer/protocol_fee/gnosis/_schema.yml | 61 -- .../protocol_fee/optimism/_schema.yml | 61 -- .../balancer/protocol_fee/polygon/_schema.yml | 61 -- .../balancer/protocol_fee/zkevm/_schema.yml | 61 -- models/_project/balancer/support/_schema.yml | 56 -- .../balancer/trades/arbitrum/_schema.yml | 149 ---- .../balancer/trades/avalanche_c/_schema.yml | 149 ---- .../_project/balancer/trades/base/_schema.yml | 149 ---- .../balancer/trades/ethereum/_schema.yml | 145 ---- .../balancer/trades/gnosis/_schema.yml | 149 ---- .../balancer/trades/optimism/_schema.yml | 149 ---- .../balancer/trades/polygon/_schema.yml | 149 ---- .../balancer/trades/zkevm/_schema.yml | 110 --- .../balancer/vebal/ethereum/_schema.yml | 91 --- ...balancer_arbitrum_pools_tokens_weights.sql | 0 .../arbitrum/balancer_arbitrum_schema.yml | 432 ++++++++++++ .../arbitrum/balancer_arbitrum_trades.sql | 0 .../balancer_v2_arbitrum_bpt_prices.sql | 0 .../balancer_v2_arbitrum_bpt_supply.sql | 0 .../balancer_v2_arbitrum_flashloans.sql | 4 + .../balancer_v2_arbitrum_liquidity.sql | 6 +- .../balancer_v2_arbitrum_pools_fees.sql | 11 +- ...ancer_v2_arbitrum_pools_tokens_weights.sql | 1 + .../balancer_v2_arbitrum_protocol_fee.sql | 0 .../arbitrum/balancer_v2_arbitrum_trades.sql | 6 +- .../balancer_v2_arbitrum_transfers_bpt.sql | 0 ...ancer_avalanche_c_pools_tokens_weights.sql | 0 .../balancer_avalanche_c_schema.yml | 405 +++++++++++ .../balancer_avalanche_c_trades.sql | 0 .../balancer_v2_avalanche_c_bpt_prices.sql | 0 .../balancer_v2_avalanche_c_bpt_supply.sql | 0 .../balancer_v2_avalanche_c_flashloans.sql | 4 + .../balancer_v2_avalanche_c_liquidity.sql | 6 +- .../balancer_v2_avalanche_c_pools_fees.sql | 9 +- ...er_v2_avalanche_c_pools_tokens_weights.sql | 1 + .../balancer_v2_avalanche_c_protocol_fee.sql | 0 .../balancer_v2_avalanche_c_trades.sql | 8 +- .../balancer_v2_avalanche_c_transfers_bpt.sql | 0 .../bpt => balancer}/balancer_bpt_prices.sql | 8 +- .../bpt => balancer}/balancer_bpt_supply.sql | 8 +- .../balancer_flashloans.sql | 11 +- .../balancer_gauge_mappings.sql | 7 +- .../balancer_liquidity.sql | 9 +- .../balancer_pools_fees.sql | 9 +- .../balancer_pools_metrics_daily.sql | 0 .../balancer_pools_tokens_weights.sql | 8 +- .../balancer_protocol_fee.sql | 8 +- models/balancer/balancer_schema.yml | 365 ++++++++++ .../balancer_single_recipient_gauges.sql | 0 .../balancer_token_whitelist.sql | 0 .../balancer_transfers_bpt.sql | 8 +- .../balancer_base_pools_tokens_weights.sql | 0 models/balancer/base/balancer_base_schema.yml | 405 +++++++++++ .../base/balancer_base_trades.sql | 0 .../base/balancer_v2_base_bpt_prices.sql | 0 .../base/balancer_v2_base_bpt_supply.sql | 0 .../base/balancer_v2_base_flashloans.sql | 4 + .../base/balancer_v2_base_liquidity.sql | 6 +- .../base/balancer_v2_base_pools_fees.sql | 9 +- .../balancer_v2_base_pools_tokens_weights.sql | 1 + .../base/balancer_v2_base_protocol_fee.sql | 0 .../base/balancer_v2_base_trades.sql | 6 +- .../base/balancer_v2_base_transfers_bpt.sql | 0 .../ethereum/balancer_ethereum_balances.sql | 11 +- ...balancer_ethereum_pools_tokens_weights.sql | 0 .../ethereum/balancer_ethereum_schema.yml | 665 ++++++++++++++++++ .../ethereum/balancer_ethereum_trades.sql | 0 .../balancer_ethereum_vebal_balances_day.sql | 7 +- .../balancer_ethereum_vebal_slopes.sql | 9 +- .../balancer_ethereum_vebal_votes.sql | 8 +- .../balancer_v1_ethereum_liquidity.sql | 6 +- ...ancer_v1_ethereum_pools_tokens_weights.sql | 7 +- .../ethereum/balancer_v1_ethereum_trades.sql | 0 .../balancer_v2_ethereum_bpt_prices.sql | 0 .../balancer_v2_ethereum_bpt_supply.sql | 0 .../balancer_v2_ethereum_flashloans.sql | 4 + .../ethereum/balancer_v2_ethereum_lbps.sql | 0 .../balancer_v2_ethereum_liquidity.sql | 6 +- .../balancer_v2_ethereum_pools_fees.sql | 7 +- ...ancer_v2_ethereum_pools_tokens_weights.sql | 1 + .../balancer_v2_ethereum_protocol_fee.sql | 0 .../ethereum/balancer_v2_ethereum_trades.sql | 6 +- .../balancer_v2_ethereum_transfers_bpt.sql | 0 .../balancer_gnosis_pools_tokens_weights.sql | 0 .../gnosis/balancer_gnosis_schema.yml | 404 +++++++++++ .../gnosis/balancer_gnosis_trades.sql | 0 .../gnosis/balancer_v2_gnosis_bpt_prices.sql | 0 .../gnosis/balancer_v2_gnosis_bpt_supply.sql | 0 .../gnosis/balancer_v2_gnosis_flashloans.sql | 4 + .../gnosis/balancer_v2_gnosis_liquidity.sql | 6 +- .../gnosis/balancer_v2_gnosis_pools_fees.sql | 9 +- ...alancer_v2_gnosis_pools_tokens_weights.sql | 1 + .../balancer_v2_gnosis_protocol_fee.sql | 0 .../gnosis/balancer_v2_gnosis_trades.sql | 6 +- .../balancer_v2_gnosis_transfers_bpt.sql | 0 .../balancer_optimism_gauge_mappings.sql | 7 +- ...balancer_optimism_pools_tokens_weights.sql | 3 +- .../optimism/balancer_optimism_schema.yml | 464 ++++++++++++ .../optimism/balancer_optimism_trades.sql | 0 .../balancer_v2_optimism_bpt_prices.sql | 0 .../balancer_v2_optimism_bpt_supply.sql | 0 .../balancer_v2_optimism_flashloans.sql | 4 + .../balancer_v2_optimism_liquidity.sql | 6 +- .../balancer_v2_optimism_pools_fees.sql | 9 +- ...ancer_v2_optimism_pools_tokens_weights.sql | 1 + .../balancer_v2_optimism_protocol_fee.sql | 0 .../optimism/balancer_v2_optimism_trades.sql | 6 +- .../balancer_v2_optimism_transfers_bpt.sql | 0 .../balancer_polygon_pools_tokens_weights.sql | 0 .../polygon/balancer_polygon_schema.yml | 454 ++++++++++++ .../polygon/balancer_polygon_trades.sql | 0 .../balancer_v2_polygon_bpt_prices.sql | 0 .../balancer_v2_polygon_bpt_supply.sql | 0 .../balancer_v2_polygon_flashloans.sql | 4 + .../polygon/balancer_v2_polygon_lbps.sql | 0 .../polygon/balancer_v2_polygon_liquidity.sql | 6 +- .../balancer_v2_polygon_pools_fees.sql | 9 +- ...lancer_v2_polygon_pools_tokens_weights.sql | 1 + .../balancer_v2_polygon_protocol_fee.sql | 0 .../polygon/balancer_v2_polygon_trades.sql | 6 +- .../balancer_v2_polygon_transfers_bpt.sql | 0 .../zkevm/balancer_v2_zkevm_bpt_prices.sql | 0 .../zkevm/balancer_v2_zkevm_bpt_supply.sql | 0 .../zkevm/balancer_v2_zkevm_flashloans.sql | 4 + .../zkevm/balancer_v2_zkevm_liquidity.sql | 6 +- .../zkevm/balancer_v2_zkevm_pools_fees.sql | 6 +- ...balancer_v2_zkevm_pools_tokens_weights.sql | 0 .../zkevm/balancer_v2_zkevm_protocol_fee.sql | 0 .../zkevm/balancer_v2_zkevm_trades.sql | 6 +- .../zkevm/balancer_v2_zkevm_transfers_bpt.sql | 0 .../balancer_zkevm_pools_tokens_weights.sql | 0 .../balancer/zkevm/balancer_zkevm_schema.yml | 431 ++++++++++++ .../zkevm/balancer_zkevm_trades.sql | 0 226 files changed, 4295 insertions(+), 7748 deletions(-) delete mode 100644 macros/models/_project/balancer/balancer_pool_token_supply_changes_daily_agg_macro.sql delete mode 100644 macros/models/_project/balancer/balancer_pool_token_supply_changes_macro.sql delete mode 100644 macros/models/_project/balancer/balancer_token_balance_changes_daily_agg_macro.sql delete mode 100644 macros/models/_project/balancer/balancer_token_balance_changes_macro.sql rename models/_project/balancer/{trades => }/balancer_trades.sql (100%) delete mode 100644 models/_project/balancer/balances/_schema.yml delete mode 100644 models/_project/balancer/balances/arbitrum/_schema.yml delete mode 100644 models/_project/balancer/balances/arbitrum/balancer_v2_arbitrum_token_balance_changes.sql delete mode 100644 models/_project/balancer/balances/arbitrum/balancer_v2_arbitrum_token_balance_changes_daily.sql delete mode 100644 models/_project/balancer/balances/avalanche_c/_schema.yml delete mode 100644 models/_project/balancer/balances/avalanche_c/balancer_v2_avalanche_c_token_balance_changes.sql delete mode 100644 models/_project/balancer/balances/avalanche_c/balancer_v2_avalanche_c_token_balance_changes_daily.sql delete mode 100644 models/_project/balancer/balances/balancer_token_balance_changes.sql delete mode 100644 models/_project/balancer/balances/balancer_token_balance_changes_daily.sql delete mode 100644 models/_project/balancer/balances/base/_schema.yml delete mode 100644 models/_project/balancer/balances/base/balancer_v2_base_token_balance_changes.sql delete mode 100644 models/_project/balancer/balances/base/balancer_v2_base_token_balance_changes_daily.sql delete mode 100644 models/_project/balancer/balances/ethereum/_schema.yml delete mode 100644 models/_project/balancer/balances/ethereum/balancer_v2_ethereum_token_balance_changes.sql delete mode 100644 models/_project/balancer/balances/ethereum/balancer_v2_ethereum_token_balance_changes_daily.sql delete mode 100644 models/_project/balancer/balances/gnosis/_schema.yml delete mode 100644 models/_project/balancer/balances/gnosis/balancer_v2_gnosis_token_balance_changes.sql delete mode 100644 models/_project/balancer/balances/gnosis/balancer_v2_gnosis_token_balance_changes_daily.sql delete mode 100644 models/_project/balancer/balances/optimism/_schema.yml delete mode 100644 models/_project/balancer/balances/optimism/balancer_v2_optimism_token_balance_changes.sql delete mode 100644 models/_project/balancer/balances/optimism/balancer_v2_optimism_token_balance_changes_daily.sql delete mode 100644 models/_project/balancer/balances/polygon/_schema.yml delete mode 100644 models/_project/balancer/balances/polygon/balancer_v2_polygon_token_balance_changes.sql delete mode 100644 models/_project/balancer/balances/polygon/balancer_v2_polygon_token_balance_changes_daily.sql delete mode 100644 models/_project/balancer/balances/zkevm/_schema.yml delete mode 100644 models/_project/balancer/balances/zkevm/balancer_v2_zkevm_token_balance_changes.sql delete mode 100644 models/_project/balancer/balances/zkevm/balancer_v2_zkevm_token_balance_changes_daily.sql delete mode 100644 models/_project/balancer/bpt/_schema.yml delete mode 100644 models/_project/balancer/bpt/arbitrum/_schema.yml delete mode 100644 models/_project/balancer/bpt/arbitrum/balancer_v2_arbitrum_bpt_supply_changes.sql delete mode 100644 models/_project/balancer/bpt/arbitrum/balancer_v2_arbitrum_bpt_supply_changes_daily.sql delete mode 100644 models/_project/balancer/bpt/avalanche_c/_schema.yml delete mode 100644 models/_project/balancer/bpt/avalanche_c/balancer_v2_avalanche_c_bpt_supply_changes.sql delete mode 100644 models/_project/balancer/bpt/avalanche_c/balancer_v2_avalanche_c_bpt_supply_changes_daily.sql delete mode 100644 models/_project/balancer/bpt/balancer_bpt_supply_changes.sql delete mode 100644 models/_project/balancer/bpt/balancer_bpt_supply_changes_daily.sql delete mode 100644 models/_project/balancer/bpt/base/_schema.yml delete mode 100644 models/_project/balancer/bpt/base/balancer_v2_base_bpt_supply_changes.sql delete mode 100644 models/_project/balancer/bpt/base/balancer_v2_base_bpt_supply_changes_daily.sql delete mode 100644 models/_project/balancer/bpt/ethereum/_schema.yml delete mode 100644 models/_project/balancer/bpt/ethereum/balancer_v2_ethereum_bpt_supply_changes.sql delete mode 100644 models/_project/balancer/bpt/ethereum/balancer_v2_ethereum_bpt_supply_changes_daily.sql delete mode 100644 models/_project/balancer/bpt/gnosis/_schema.yml delete mode 100644 models/_project/balancer/bpt/gnosis/balancer_v2_gnosis_bpt_supply_changes.sql delete mode 100644 models/_project/balancer/bpt/gnosis/balancer_v2_gnosis_bpt_supply_changes_daily.sql delete mode 100644 models/_project/balancer/bpt/optimism/_schema.yml delete mode 100644 models/_project/balancer/bpt/optimism/balancer_v2_optimism_bpt_supply_changes.sql delete mode 100644 models/_project/balancer/bpt/optimism/balancer_v2_optimism_bpt_supply_changes_daily.sql delete mode 100644 models/_project/balancer/bpt/polygon/_schema.yml delete mode 100644 models/_project/balancer/bpt/polygon/balancer_v2_polygon_bpt_supply_changes.sql delete mode 100644 models/_project/balancer/bpt/polygon/balancer_v2_polygon_bpt_supply_changes_daily.sql delete mode 100644 models/_project/balancer/bpt/zkevm/_schema.yml delete mode 100644 models/_project/balancer/bpt/zkevm/balancer_v2_zkevm_bpt_supply_changes.sql delete mode 100644 models/_project/balancer/bpt/zkevm/balancer_v2_zkevm_bpt_supply_changes_daily.sql delete mode 100644 models/_project/balancer/flashloans/_schema.yml delete mode 100644 models/_project/balancer/flashloans/arbitrum/_schema.yml delete mode 100644 models/_project/balancer/flashloans/avalanche_c/_schema.yml delete mode 100644 models/_project/balancer/flashloans/base/_schema.yml delete mode 100644 models/_project/balancer/flashloans/ethereum/_schema.yml delete mode 100644 models/_project/balancer/flashloans/gnosis/_schema.yml delete mode 100644 models/_project/balancer/flashloans/optimism/_schema.yml delete mode 100644 models/_project/balancer/flashloans/polygon/_schema.yml delete mode 100644 models/_project/balancer/flashloans/zkevm/_schema.yml delete mode 100644 models/_project/balancer/liquidity/_schema.yml delete mode 100644 models/_project/balancer/liquidity/arbitrum/_schema.yml delete mode 100644 models/_project/balancer/liquidity/avalanche_c/_schema.yml delete mode 100644 models/_project/balancer/liquidity/base/_schema.yml delete mode 100644 models/_project/balancer/liquidity/ethereum/_schema.yml delete mode 100644 models/_project/balancer/liquidity/gnosis/_schema.yml delete mode 100644 models/_project/balancer/liquidity/optimism/_schema.yml delete mode 100644 models/_project/balancer/liquidity/polygon/_schema.yml delete mode 100644 models/_project/balancer/liquidity/zkevm/_schema.yml delete mode 100644 models/_project/balancer/pools/_schema.yml delete mode 100644 models/_project/balancer/pools/arbitrum/_schema.yml delete mode 100644 models/_project/balancer/pools/avalanche_c/_schema.yml delete mode 100644 models/_project/balancer/pools/base/_schema.yml delete mode 100644 models/_project/balancer/pools/ethereum/_schema.yml delete mode 100644 models/_project/balancer/pools/gnosis/_schema.yml delete mode 100644 models/_project/balancer/pools/optimism/_schema.yml delete mode 100644 models/_project/balancer/pools/polygon/_schema.yml delete mode 100644 models/_project/balancer/pools/zkevm/_schema.yml delete mode 100644 models/_project/balancer/protocol_fee/_schema.yml delete mode 100644 models/_project/balancer/protocol_fee/arbitrum/_schema.yml delete mode 100644 models/_project/balancer/protocol_fee/avalanche_c/_schema.yml delete mode 100644 models/_project/balancer/protocol_fee/base/_schema.yml delete mode 100644 models/_project/balancer/protocol_fee/ethereum/_schema.yml delete mode 100644 models/_project/balancer/protocol_fee/gnosis/_schema.yml delete mode 100644 models/_project/balancer/protocol_fee/optimism/_schema.yml delete mode 100644 models/_project/balancer/protocol_fee/polygon/_schema.yml delete mode 100644 models/_project/balancer/protocol_fee/zkevm/_schema.yml delete mode 100644 models/_project/balancer/support/_schema.yml delete mode 100644 models/_project/balancer/trades/arbitrum/_schema.yml delete mode 100644 models/_project/balancer/trades/avalanche_c/_schema.yml delete mode 100644 models/_project/balancer/trades/base/_schema.yml delete mode 100644 models/_project/balancer/trades/ethereum/_schema.yml delete mode 100644 models/_project/balancer/trades/gnosis/_schema.yml delete mode 100644 models/_project/balancer/trades/optimism/_schema.yml delete mode 100644 models/_project/balancer/trades/polygon/_schema.yml delete mode 100644 models/_project/balancer/trades/zkevm/_schema.yml delete mode 100644 models/_project/balancer/vebal/ethereum/_schema.yml rename models/{_project/balancer/pools => balancer}/arbitrum/balancer_arbitrum_pools_tokens_weights.sql (100%) create mode 100644 models/balancer/arbitrum/balancer_arbitrum_schema.yml rename models/{_project/balancer/trades => balancer}/arbitrum/balancer_arbitrum_trades.sql (100%) rename models/{_project/balancer/bpt => balancer}/arbitrum/balancer_v2_arbitrum_bpt_prices.sql (100%) rename models/{_project/balancer/bpt => balancer}/arbitrum/balancer_v2_arbitrum_bpt_supply.sql (100%) rename models/{_project/balancer/flashloans => balancer}/arbitrum/balancer_v2_arbitrum_flashloans.sql (88%) rename models/{_project/balancer/liquidity => balancer}/arbitrum/balancer_v2_arbitrum_liquidity.sql (52%) rename models/{_project/balancer/pools => balancer}/arbitrum/balancer_v2_arbitrum_pools_fees.sql (75%) rename models/{_project/balancer/pools => balancer}/arbitrum/balancer_v2_arbitrum_pools_tokens_weights.sql (99%) rename models/{_project/balancer/protocol_fee => balancer}/arbitrum/balancer_v2_arbitrum_protocol_fee.sql (100%) rename models/{_project/balancer/trades => balancer}/arbitrum/balancer_v2_arbitrum_trades.sql (94%) rename models/{_project/balancer/bpt => balancer}/arbitrum/balancer_v2_arbitrum_transfers_bpt.sql (100%) rename models/{_project/balancer/pools => balancer}/avalanche_c/balancer_avalanche_c_pools_tokens_weights.sql (100%) create mode 100644 models/balancer/avalanche_c/balancer_avalanche_c_schema.yml rename models/{_project/balancer/trades => balancer}/avalanche_c/balancer_avalanche_c_trades.sql (100%) rename models/{_project/balancer/bpt => balancer}/avalanche_c/balancer_v2_avalanche_c_bpt_prices.sql (100%) rename models/{_project/balancer/bpt => balancer}/avalanche_c/balancer_v2_avalanche_c_bpt_supply.sql (100%) rename models/{_project/balancer/flashloans => balancer}/avalanche_c/balancer_v2_avalanche_c_flashloans.sql (88%) rename models/{_project/balancer/liquidity => balancer}/avalanche_c/balancer_v2_avalanche_c_liquidity.sql (53%) rename models/{_project/balancer/pools => balancer}/avalanche_c/balancer_v2_avalanche_c_pools_fees.sql (77%) rename models/{_project/balancer/pools => balancer}/avalanche_c/balancer_v2_avalanche_c_pools_tokens_weights.sql (99%) rename models/{_project/balancer/protocol_fee => balancer}/avalanche_c/balancer_v2_avalanche_c_protocol_fee.sql (100%) rename models/{_project/balancer/trades => balancer}/avalanche_c/balancer_v2_avalanche_c_trades.sql (94%) rename models/{_project/balancer/bpt => balancer}/avalanche_c/balancer_v2_avalanche_c_transfers_bpt.sql (100%) rename models/{_project/balancer/bpt => balancer}/balancer_bpt_prices.sql (69%) rename models/{_project/balancer/bpt => balancer}/balancer_bpt_supply.sql (68%) rename models/{_project/balancer/flashloans => balancer}/balancer_flashloans.sql (69%) rename models/{_project/balancer/pools => balancer}/balancer_gauge_mappings.sql (78%) rename models/{_project/balancer/liquidity => balancer}/balancer_liquidity.sql (74%) rename models/{_project/balancer/pools => balancer}/balancer_pools_fees.sql (69%) rename models/{_project/balancer/pools => balancer}/balancer_pools_metrics_daily.sql (100%) rename models/{_project/balancer/pools => balancer}/balancer_pools_tokens_weights.sql (71%) rename models/{_project/balancer/protocol_fee => balancer}/balancer_protocol_fee.sql (75%) create mode 100644 models/balancer/balancer_schema.yml rename models/{_project/balancer/support => balancer}/balancer_single_recipient_gauges.sql (100%) rename models/{_project/balancer/support => balancer}/balancer_token_whitelist.sql (100%) rename models/{_project/balancer/bpt => balancer}/balancer_transfers_bpt.sql (70%) rename models/{_project/balancer/pools => balancer}/base/balancer_base_pools_tokens_weights.sql (100%) create mode 100644 models/balancer/base/balancer_base_schema.yml rename models/{_project/balancer/trades => balancer}/base/balancer_base_trades.sql (100%) rename models/{_project/balancer/bpt => balancer}/base/balancer_v2_base_bpt_prices.sql (100%) rename models/{_project/balancer/bpt => balancer}/base/balancer_v2_base_bpt_supply.sql (100%) rename models/{_project/balancer/flashloans => balancer}/base/balancer_v2_base_flashloans.sql (88%) rename models/{_project/balancer/liquidity => balancer}/base/balancer_v2_base_liquidity.sql (51%) rename models/{_project/balancer/pools => balancer}/base/balancer_v2_base_pools_fees.sql (77%) rename models/{_project/balancer/pools => balancer}/base/balancer_v2_base_pools_tokens_weights.sql (99%) rename models/{_project/balancer/protocol_fee => balancer}/base/balancer_v2_base_protocol_fee.sql (100%) rename models/{_project/balancer/trades => balancer}/base/balancer_v2_base_trades.sql (94%) rename models/{_project/balancer/bpt => balancer}/base/balancer_v2_base_transfers_bpt.sql (100%) rename models/{_project/balancer/balances => balancer}/ethereum/balancer_ethereum_balances.sql (88%) rename models/{_project/balancer/pools => balancer}/ethereum/balancer_ethereum_pools_tokens_weights.sql (100%) create mode 100644 models/balancer/ethereum/balancer_ethereum_schema.yml rename models/{_project/balancer/trades => balancer}/ethereum/balancer_ethereum_trades.sql (100%) rename models/{_project/balancer/vebal => balancer}/ethereum/balancer_ethereum_vebal_balances_day.sql (94%) rename models/{_project/balancer/vebal => balancer}/ethereum/balancer_ethereum_vebal_slopes.sql (93%) rename models/{_project/balancer/vebal => balancer}/ethereum/balancer_ethereum_vebal_votes.sql (92%) rename models/{_project/balancer/liquidity => balancer}/ethereum/balancer_v1_ethereum_liquidity.sql (92%) rename models/{_project/balancer/pools => balancer}/ethereum/balancer_v1_ethereum_pools_tokens_weights.sql (93%) rename models/{_project/balancer/trades => balancer}/ethereum/balancer_v1_ethereum_trades.sql (100%) rename models/{_project/balancer/bpt => balancer}/ethereum/balancer_v2_ethereum_bpt_prices.sql (100%) rename models/{_project/balancer/bpt => balancer}/ethereum/balancer_v2_ethereum_bpt_supply.sql (100%) rename models/{_project/balancer/flashloans => balancer}/ethereum/balancer_v2_ethereum_flashloans.sql (88%) rename models/{_project/balancer/pools => balancer}/ethereum/balancer_v2_ethereum_lbps.sql (100%) rename models/{_project/balancer/liquidity => balancer}/ethereum/balancer_v2_ethereum_liquidity.sql (52%) rename models/{_project/balancer/pools => balancer}/ethereum/balancer_v2_ethereum_pools_fees.sql (78%) rename models/{_project/balancer/pools => balancer}/ethereum/balancer_v2_ethereum_pools_tokens_weights.sql (99%) rename models/{_project/balancer/protocol_fee => balancer}/ethereum/balancer_v2_ethereum_protocol_fee.sql (100%) rename models/{_project/balancer/trades => balancer}/ethereum/balancer_v2_ethereum_trades.sql (94%) rename models/{_project/balancer/bpt => balancer}/ethereum/balancer_v2_ethereum_transfers_bpt.sql (100%) rename models/{_project/balancer/pools => balancer}/gnosis/balancer_gnosis_pools_tokens_weights.sql (100%) create mode 100644 models/balancer/gnosis/balancer_gnosis_schema.yml rename models/{_project/balancer/trades => balancer}/gnosis/balancer_gnosis_trades.sql (100%) rename models/{_project/balancer/bpt => balancer}/gnosis/balancer_v2_gnosis_bpt_prices.sql (100%) rename models/{_project/balancer/bpt => balancer}/gnosis/balancer_v2_gnosis_bpt_supply.sql (100%) rename models/{_project/balancer/flashloans => balancer}/gnosis/balancer_v2_gnosis_flashloans.sql (88%) rename models/{_project/balancer/liquidity => balancer}/gnosis/balancer_v2_gnosis_liquidity.sql (51%) rename models/{_project/balancer/pools => balancer}/gnosis/balancer_v2_gnosis_pools_fees.sql (77%) rename models/{_project/balancer/pools => balancer}/gnosis/balancer_v2_gnosis_pools_tokens_weights.sql (99%) rename models/{_project/balancer/protocol_fee => balancer}/gnosis/balancer_v2_gnosis_protocol_fee.sql (100%) rename models/{_project/balancer/trades => balancer}/gnosis/balancer_v2_gnosis_trades.sql (94%) rename models/{_project/balancer/bpt => balancer}/gnosis/balancer_v2_gnosis_transfers_bpt.sql (100%) rename models/{_project/balancer/pools => balancer}/optimism/balancer_optimism_gauge_mappings.sql (87%) rename models/{_project/balancer/pools => balancer}/optimism/balancer_optimism_pools_tokens_weights.sql (86%) create mode 100644 models/balancer/optimism/balancer_optimism_schema.yml rename models/{_project/balancer/trades => balancer}/optimism/balancer_optimism_trades.sql (100%) rename models/{_project/balancer/bpt => balancer}/optimism/balancer_v2_optimism_bpt_prices.sql (100%) rename models/{_project/balancer/bpt => balancer}/optimism/balancer_v2_optimism_bpt_supply.sql (100%) rename models/{_project/balancer/flashloans => balancer}/optimism/balancer_v2_optimism_flashloans.sql (88%) rename models/{_project/balancer/liquidity => balancer}/optimism/balancer_v2_optimism_liquidity.sql (52%) rename models/{_project/balancer/pools => balancer}/optimism/balancer_v2_optimism_pools_fees.sql (77%) rename models/{_project/balancer/pools => balancer}/optimism/balancer_v2_optimism_pools_tokens_weights.sql (99%) rename models/{_project/balancer/protocol_fee => balancer}/optimism/balancer_v2_optimism_protocol_fee.sql (100%) rename models/{_project/balancer/trades => balancer}/optimism/balancer_v2_optimism_trades.sql (94%) rename models/{_project/balancer/bpt => balancer}/optimism/balancer_v2_optimism_transfers_bpt.sql (100%) rename models/{_project/balancer/pools => balancer}/polygon/balancer_polygon_pools_tokens_weights.sql (100%) create mode 100644 models/balancer/polygon/balancer_polygon_schema.yml rename models/{_project/balancer/trades => balancer}/polygon/balancer_polygon_trades.sql (100%) rename models/{_project/balancer/bpt => balancer}/polygon/balancer_v2_polygon_bpt_prices.sql (100%) rename models/{_project/balancer/bpt => balancer}/polygon/balancer_v2_polygon_bpt_supply.sql (100%) rename models/{_project/balancer/flashloans => balancer}/polygon/balancer_v2_polygon_flashloans.sql (88%) rename models/{_project/balancer/pools => balancer}/polygon/balancer_v2_polygon_lbps.sql (100%) rename models/{_project/balancer/liquidity => balancer}/polygon/balancer_v2_polygon_liquidity.sql (52%) rename models/{_project/balancer/pools => balancer}/polygon/balancer_v2_polygon_pools_fees.sql (77%) rename models/{_project/balancer/pools => balancer}/polygon/balancer_v2_polygon_pools_tokens_weights.sql (99%) rename models/{_project/balancer/protocol_fee => balancer}/polygon/balancer_v2_polygon_protocol_fee.sql (100%) rename models/{_project/balancer/trades => balancer}/polygon/balancer_v2_polygon_trades.sql (94%) rename models/{_project/balancer/bpt => balancer}/polygon/balancer_v2_polygon_transfers_bpt.sql (100%) rename models/{_project/balancer/bpt => balancer}/zkevm/balancer_v2_zkevm_bpt_prices.sql (100%) rename models/{_project/balancer/bpt => balancer}/zkevm/balancer_v2_zkevm_bpt_supply.sql (100%) rename models/{_project/balancer/flashloans => balancer}/zkevm/balancer_v2_zkevm_flashloans.sql (88%) rename models/{_project/balancer/liquidity => balancer}/zkevm/balancer_v2_zkevm_liquidity.sql (51%) rename models/{_project/balancer/pools => balancer}/zkevm/balancer_v2_zkevm_pools_fees.sql (82%) rename models/{_project/balancer/pools => balancer}/zkevm/balancer_v2_zkevm_pools_tokens_weights.sql (100%) rename models/{_project/balancer/protocol_fee => balancer}/zkevm/balancer_v2_zkevm_protocol_fee.sql (100%) rename models/{_project/balancer/trades => balancer}/zkevm/balancer_v2_zkevm_trades.sql (94%) rename models/{_project/balancer/bpt => balancer}/zkevm/balancer_v2_zkevm_transfers_bpt.sql (100%) rename models/{_project/balancer/pools => balancer}/zkevm/balancer_zkevm_pools_tokens_weights.sql (100%) create mode 100644 models/balancer/zkevm/balancer_zkevm_schema.yml rename models/{_project/balancer/trades => balancer}/zkevm/balancer_zkevm_trades.sql (100%) diff --git a/dbt_project.yml b/dbt_project.yml index 1daa6f7fd4a..05730532ba4 100644 --- a/dbt_project.yml +++ b/dbt_project.yml @@ -71,6 +71,19 @@ models: optimism: +schema: aave_optimism + balancer: + +schema: balancer + arbitrum: + +schema: balancer_arbitrum + ethereum: + +schema: balancer_ethereum + polygon: + +schema: balancer_polygon + optimism: + +schema: balancer_optimism + gnosis: + +schema: balancer_gnosis + ens: +schema: ens ethereum: diff --git a/macros/models/_project/balancer/balancer_bpt_supply_macro.sql b/macros/models/_project/balancer/balancer_bpt_supply_macro.sql index 1b1dab0a80a..60cf5a6e4bc 100644 --- a/macros/models/_project/balancer/balancer_bpt_supply_macro.sql +++ b/macros/models/_project/balancer/balancer_bpt_supply_macro.sql @@ -79,12 +79,12 @@ WITH pool_labels AS ( joins AS ( SELECT DATE_TRUNC('day', evt_block_time) AS block_date, - tokenOut, + tokenOut AS token, pool_type, CASE WHEN pool_type IN ('weighted') THEN 0 ELSE SUM(amountOut / POWER(10, 18)) - END AS ajoins + END AS amount FROM {{ source('balancer_v2_' + blockchain, 'Vault_evt_Swap') }} LEFT JOIN pool_labels ON BYTEARRAY_SUBSTRING(poolId, 1, 20) = address WHERE tokenOut = BYTEARRAY_SUBSTRING(poolId, 1, 20) @@ -94,25 +94,37 @@ WITH pool_labels AS ( exits AS ( SELECT DATE_TRUNC('day', evt_block_time) AS block_date, - tokenIn, + tokenIn AS token, pool_type, CASE WHEN pool_type IN ('weighted') THEN 0 - ELSE SUM(amountIn / POWER(10, 18)) - END AS aexits + ELSE SUM( -amountIn / POWER(10, 18)) + END AS amount FROM {{ source('balancer_v2_' + blockchain, 'Vault_evt_Swap') }} LEFT JOIN pool_labels ON BYTEARRAY_SUBSTRING(poolId, 1, 20) = address WHERE tokenIn = BYTEARRAY_SUBSTRING(poolId, 1, 20) GROUP BY 1, 2, 3 ), + joins_and_exits_1 AS ( + SELECT + * + FROM joins + + UNION ALL + + SELECT + * + FROM exits + ), + joins_and_exits AS ( SELECT - j.block_date, - j.tokenOut AS bpt, - SUM(COALESCE(ajoins, 0) - COALESCE(aexits, 0)) OVER (PARTITION BY j.tokenOut ORDER BY j.block_date ASC) AS adelta - FROM joins j - FULL OUTER JOIN exits e ON j.block_date = e.block_date AND e.tokenIn = j.tokenOut + block_date, + token AS bpt, + LEAD(block_date, 1, NOW()) OVER (PARTITION BY token ORDER BY block_date) AS day_of_next_change, + SUM(amount) OVER (PARTITION BY token ORDER BY block_date ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW) AS adelta + FROM joins_and_exits_1 ), calendar AS ( @@ -130,7 +142,7 @@ WITH pool_labels AS ( COALESCE(SUM(b.supply - COALESCE(preminted_bpts, 0) + COALESCE(adelta, 0)),0) AS supply FROM calendar c LEFT JOIN balances b ON b.day <= c.day AND c.day < b.day_of_next_change - LEFT JOIN joins_and_exits j ON c.day = j.block_date AND b.token = j.bpt + LEFT JOIN joins_and_exits j ON j.block_date <= c.day AND c.day < j.day_of_next_change AND b.token = j.bpt LEFT JOIN premints p ON b.token = p.bpt LEFT JOIN pool_labels l ON b.token = l.address WHERE l.pool_type IN ('weighted', 'LBP', 'investment', 'stable', 'linear', 'ECLP', 'managed', 'FX') diff --git a/macros/models/_project/balancer/balancer_pool_token_supply_changes_daily_agg_macro.sql b/macros/models/_project/balancer/balancer_pool_token_supply_changes_daily_agg_macro.sql deleted file mode 100644 index d94bbccf741..00000000000 --- a/macros/models/_project/balancer/balancer_pool_token_supply_changes_daily_agg_macro.sql +++ /dev/null @@ -1,37 +0,0 @@ -{% macro - bpt_supply_changes_daily_agg_macro( - blockchain, version - ) -%} -WITH - daily_balance AS ( - SELECT - block_date, - blockchain, - pool_type, - pool_symbol, - token_address, - LEAD(block_date, 1, NOW()) OVER (PARTITION BY token_address ORDER BY block_date) AS day_of_next_change, - SUM(delta_amount) AS daily_amount - FROM {{ ref('balancer_bpt_supply_changes') }} - WHERE blockchain = '{{blockchain}}' - GROUP BY 1, 2, 3, 4, 5 - ), - - calendar AS ( - SELECT date_sequence AS day - FROM unnest(sequence(date('2021-04-21'), date(now()), interval '1' day)) as t(date_sequence) - ) - - SELECT - c.day AS block_date, - '{{blockchain}}' as blockchain, - '{{version}}' AS version, - b.pool_type, - b.pool_symbol, - b.token_address, - b.daily_amount AS daily_delta - FROM calendar c - LEFT JOIN daily_balance b ON b.block_date = c.day - WHERE b.token_address IS NOT NULL - {% endmacro %} \ No newline at end of file diff --git a/macros/models/_project/balancer/balancer_pool_token_supply_changes_macro.sql b/macros/models/_project/balancer/balancer_pool_token_supply_changes_macro.sql deleted file mode 100644 index 5b876cca011..00000000000 --- a/macros/models/_project/balancer/balancer_pool_token_supply_changes_macro.sql +++ /dev/null @@ -1,130 +0,0 @@ -{% macro - bpt_supply_changes_macro( - blockchain, version - ) -%} -WITH pool_labels AS ( - SELECT - address, - name, - pool_type - FROM {{ ref('labels_balancer_v2_pools') }} - WHERE blockchain = '{{blockchain}}' - ), - - -- Extract mints and burns from transfers - transfers AS ( - SELECT - t.evt_block_time, - t.evt_block_number, - t.evt_tx_hash, - t.evt_index, - t.contract_address AS token, - CASE - WHEN t."from" = 0x0000000000000000000000000000000000000000 - THEN 'mint' - WHEN t.to = 0x0000000000000000000000000000000000000000 - THEN 'burn' - END AS label, - l.pool_type, - l.name, - CASE - WHEN t."from" = 0x0000000000000000000000000000000000000000 - THEN value - WHEN t.to = 0x0000000000000000000000000000000000000000 - THEN - value - ELSE 0 - END AS amount - FROM {{ ref('balancer_transfers_bpt') }} t - LEFT JOIN pool_labels l ON t.contract_address = l.address - WHERE t.blockchain = '{{blockchain}}' - AND t.version = '{{version}}' - {% if is_incremental() %} - AND {{ incremental_predicate('t.evt_block_time') }} - {% endif %} - ), - - -- Calculating Joins(mint) and Exits(burn) via Swap - joins AS ( - SELECT - s.evt_block_time, - s.evt_block_number, - s.evt_tx_hash, - s.evt_index, - s.tokenOut AS token, - 'join' AS label, - l.pool_type, - l.name, - CASE WHEN l.pool_type IN ('weighted') - THEN 0 - ELSE s.amountOut - END AS amount - FROM {{ source('balancer_v2_' + blockchain, 'Vault_evt_Swap') }} s - LEFT JOIN pool_labels l ON BYTEARRAY_SUBSTRING(s.poolId, 1, 20) = l.address - WHERE tokenOut = BYTEARRAY_SUBSTRING(s.poolId, 1, 20) - {% if is_incremental() %} - AND {{ incremental_predicate('s. evt_block_time') }} - {% endif %} - - ), - - exits AS ( - SELECT - s.evt_block_time, - s.evt_block_number, - s.evt_tx_hash, - s.evt_index, - s.tokenIn AS token, - 'exit' AS label, - l.pool_type, - l.name, - CASE WHEN l.pool_type IN ('weighted') - THEN 0 - ELSE - s.amountIn - END AS amount - FROM {{ source('balancer_v2_' + blockchain, 'Vault_evt_Swap') }} s - LEFT JOIN pool_labels l ON BYTEARRAY_SUBSTRING(s.poolId, 1, 20) = l.address - WHERE tokenIn = BYTEARRAY_SUBSTRING(s.poolId, 1, 20) - {% if is_incremental() %} - AND {{ incremental_predicate('s. evt_block_time') }} - {% endif %} - ) - - SELECT - date_trunc('day', evt_block_time) AS block_date, - evt_block_time, - evt_block_number, - '{{blockchain}}' AS blockchain, - evt_tx_hash, - evt_index, - pool_type, - name AS pool_symbol, - '{{version}}' AS version, - label, - token AS token_address, - amount AS delta_amount_raw, - amount / POWER (10, 18) AS delta_amount --18 decimals standard for BPTs - FROM - ( - SELECT - * - FROM joins - - UNION ALL - - SELECT - * - FROM exits - - UNION ALL - - SELECT - * - FROM transfers - WHERE label IS NOT NULL - ) - {% if is_incremental() %} - WHERE {{ incremental_predicate('evt_block_time') }} - {% endif %} - - {% endmacro %} \ No newline at end of file diff --git a/macros/models/_project/balancer/balancer_token_balance_changes_daily_agg_macro.sql b/macros/models/_project/balancer/balancer_token_balance_changes_daily_agg_macro.sql deleted file mode 100644 index 7500f5d7e82..00000000000 --- a/macros/models/_project/balancer/balancer_token_balance_changes_daily_agg_macro.sql +++ /dev/null @@ -1,184 +0,0 @@ -{% macro - balancer_token_balance_changes_daily_agg_macro( - blockchain, version - ) -%} -WITH - prices AS ( - SELECT - date_trunc('day', minute) AS day, - contract_address AS token, - decimals, - AVG(price) AS price - FROM {{ source('prices', 'usd') }} - WHERE blockchain = '{{blockchain}}' - {% if is_incremental() %} - WHERE {{ incremental_predicate('minute') }} - {% endif %} - GROUP BY 1, 2, 3 - ), - - dex_prices_1 AS ( - SELECT - date_trunc('day', HOUR) AS DAY, - contract_address AS token, - approx_percentile(median_price, 0.5) AS price, - sum(sample_size) AS sample_size - FROM {{ ref('dex_prices') }} - {% if is_incremental() %} - WHERE {{ incremental_predicate('hour') }} - {% endif %} - GROUP BY 1, 2 - HAVING sum(sample_size) > 3 - ), - - dex_prices_2 AS( - SELECT - day, - token, - price, - lag(price) OVER(PARTITION BY token ORDER BY day) AS previous_price - FROM dex_prices_1 - ), - - dex_prices AS ( - SELECT - day, - token, - price, - LEAD(DAY, 1, NOW()) OVER (PARTITION BY token ORDER BY DAY) AS day_of_next_change - FROM dex_prices_2 - WHERE (price < previous_price * 1e4 AND price > previous_price / 1e4) - ), - - bpt_prices AS( - SELECT DISTINCT - day, - contract_address AS token, - decimals, - bpt_price - FROM {{ ref('balancer_bpt_prices') }} - WHERE blockchain = '{{blockchain}}' - {% if is_incremental() %} - AND {{ incremental_predicate('day') }} - {% endif %} - AND version = '{{version}}' - ), - - eth_prices AS ( - SELECT - DATE_TRUNC('day', minute) as day, - AVG(price) as eth_price - FROM {{ source('prices', 'usd') }} - WHERE symbol = 'ETH' - {% if is_incremental() %} - WHERE {{ incremental_predicate('minute') }} - {% endif %} - GROUP BY 1 - ), - - gyro_prices AS ( - SELECT - token_address, - decimals, - price - FROM {{ ref('gyroscope_gyro_tokens') }} - WHERE blockchain = '{{blockchain}}' - ), - - daily_balance AS ( - SELECT - block_date, - pool_id, - pool_symbol, - pool_type, - token_address, - token_symbol, - LEAD(block_date, 1, NOW()) OVER (PARTITION BY token_address, pool_id ORDER BY block_date) AS day_of_next_change, - SUM(delta_amount) AS daily_amount - FROM {{ ref('balancer_token_balance_changes') }} - WHERE blockchain = '{{blockchain}}' - GROUP BY 1, 2, 3, 4, 5, 6 - ), - - calendar AS ( - SELECT date_sequence AS day - FROM unnest(sequence(date('2021-04-21'), date(now()), interval '1' day)) as t(date_sequence) - ), - - daily_usd_balance AS ( - SELECT - c.day AS block_date, - '{{blockchain}}"' as blockchain, - b.pool_id, - b.pool_symbol, - b.pool_type, - b.token_address, - b.token_symbol, - daily_amount, - daily_amount * COALESCE(p1.price, p2.price, p3.bpt_price, p4.price, 0) AS daily_amount_usd - FROM calendar c - LEFT JOIN daily_balance b ON b.block_date <= c.day - AND c.day < b.day_of_next_change - LEFT JOIN prices p1 ON p1.day = b.block_date - AND p1.token = b.token_address - LEFT JOIN dex_prices p2 ON p2.day <= c.day - AND c.day < p2.day_of_next_change - AND p2.token = b.token_address - LEFT JOIN bpt_prices p3 ON p3.day = b.block_date - AND p3.token = b.token_address - LEFT JOIN gyro_prices p4 ON p4.token_address = b.token_address - WHERE b.token_address != BYTEARRAY_SUBSTRING(b.pool_id, 1, 20) - ), - - weighted_pool_amount_estimates AS ( - SELECT - b.block_date, - b.pool_id, - q.name, - pool_type, - ROW_NUMBER() OVER (PARTITION BY b.block_date, b.pool_id ORDER BY SUM(b.daily_amount_usd) ASC) AS pricing_count, --to avoid double count in pools with multiple pricing assets - SUM(b.daily_amount_usd) / COALESCE(SUM(w.normalized_weight), 1) AS weighted_daily_amount_usd - FROM daily_usd_balance b - LEFT JOIN {{ ref('balancer_pools_tokens_weights') }} w ON b.pool_id = w.pool_id - AND b.token_address = w.token_address - AND b.daily_amount_usd > 0 - LEFT JOIN {{ ref('balancer_token_whitelist') }} q ON b.token_address = q.address - AND b.blockchain = q.chain - WHERE q.name IS NOT NULL - AND b.pool_type = 'weighted' -- filters for weighted pools with pricing assets - AND w.blockchain = '{{blockchain}}' - AND w.version = '2' - GROUP BY 1, 2, 3, 4 - ), - - weighted_pool_amount_estimates_2 AS( - SELECT e.block_date, - e.pool_id, - SUM(e.weighted_daily_amount_usd) / MAX(e.pricing_count) AS weighted_daily_amount_usd - FROM weighted_pool_amount_estimates e - GROUP BY 1,2 - ) - - SELECT - c.block_date, - c.pool_id, - BYTEARRAY_SUBSTRING(c.pool_id, 1, 20) AS pool_address, - c.pool_symbol, - '2' AS version, - 'ethereum' AS blockchain, - c.pool_type, - c.token_address, - c.token_symbol, - c.daily_amount AS daily_delta, - COALESCE(b.weighted_daily_amount_usd * w.normalized_weight, c.daily_amount_usd) AS daily_delta_usd, - COALESCE(b.weighted_daily_amount_usd * w.normalized_weight, c.daily_amount_usd)/e.eth_price AS daily_delta_eth - FROM daily_usd_balance c - FULL OUTER JOIN weighted_pool_amount_estimates_2 b ON c.block_date = b.block_date - AND c.pool_id = b.pool_id - LEFT JOIN {{ ref('balancer_pools_tokens_weights') }} w ON b.pool_id = w.pool_id - AND w.blockchain = 'ethereum' - AND w.version = '2' - AND w.token_address = c.token_address - LEFT JOIN eth_prices e ON e.day = c.block_date - {% endmacro %} \ No newline at end of file diff --git a/macros/models/_project/balancer/balancer_token_balance_changes_macro.sql b/macros/models/_project/balancer/balancer_token_balance_changes_macro.sql deleted file mode 100644 index b16c9bf038e..00000000000 --- a/macros/models/_project/balancer/balancer_token_balance_changes_macro.sql +++ /dev/null @@ -1,169 +0,0 @@ -{% macro - balancer_token_balance_changes_macro( - blockchain, version - ) -%} -WITH pool_labels AS ( - SELECT - address AS pool_id, - name AS pool_symbol, - pool_type - FROM {{ ref('labels_balancer_v2_pools') }} - WHERE blockchain = '{{blockchain}}' - ), - - swaps_changes AS ( - SELECT - evt_block_time, - evt_block_number, - evt_tx_hash, - evt_index, - pool_id, - token, - SUM(COALESCE(delta, INT256 '0')) AS delta - FROM - ( - SELECT - evt_block_time, - evt_block_number, - evt_tx_hash, - evt_index, - poolId AS pool_id, - tokenIn AS token, - CAST(amountIn as int256) AS delta - FROM {{ source('balancer_v2_' + blockchain, 'Vault_evt_Swap') }} - {% if is_incremental() %} - WHERE {{ incremental_predicate('evt_block_time') }} - {% endif %} - - UNION ALL - - SELECT - evt_block_time, - evt_block_number, - evt_tx_hash, - evt_index, - poolId AS pool_id, - tokenOut AS token, - -CAST(amountOut AS int256) AS delta - FROM {{ source('balancer_v2_' + blockchain, 'Vault_evt_Swap') }} - {% if is_incremental() %} - WHERE {{ incremental_predicate('evt_block_time') }} - {% endif %} - ) swaps - GROUP BY 1, 2, 3, 4, 5, 6 - ), - - zipped_balance_changes AS ( - SELECT - evt_block_time, - evt_block_number, - evt_tx_hash, - evt_index, - poolId AS pool_id, - t.tokens, - d.deltas, - p.protocolFeeAmounts - FROM {{ source('balancer_v2_' + blockchain, 'Vault_evt_PoolBalanceChanged') }} - CROSS JOIN UNNEST (tokens) WITH ORDINALITY as t(tokens,i) - CROSS JOIN UNNEST (deltas) WITH ORDINALITY as d(deltas,i) - CROSS JOIN UNNEST (protocolFeeAmounts) WITH ORDINALITY as p(protocolFeeAmounts,i) - WHERE t.i = d.i - AND d.i = p.i - {% if is_incremental() %} - AND {{ incremental_predicate('evt_block_time') }} - {% endif %} - ), - - balances_changes AS ( - SELECT - evt_block_time, - evt_block_number, - evt_tx_hash, - evt_index, - pool_id, - tokens AS token, - deltas - CAST(protocolFeeAmounts as int256) AS delta - FROM zipped_balance_changes - ), - - managed_changes AS ( - SELECT - evt_block_time, - evt_block_number, - evt_tx_hash, - evt_index, - poolId AS pool_id, - token, - cashDelta + managedDelta AS delta - FROM {{ source('balancer_v2_' + blockchain, 'Vault_evt_PoolBalanceManaged') }} - {% if is_incremental() %} - WHERE {{ incremental_predicate('evt_block_time') }} - {% endif %} - ) - - - SELECT - date_trunc('day', b.evt_block_time) AS block_date, - b.evt_block_time, - b.evt_block_number, - '{{blockchain}}' AS blockchain, - b.evt_tx_hash, - b.evt_index, - b.pool_id, - BYTEARRAY_SUBSTRING(b.pool_id, 1, 20) AS pool_address, - p.pool_symbol, - p.pool_type, - '{{version}}' AS version, - b.token AS token_address, - t.symbol AS token_symbol, - b.amount AS delta_amount_raw, - CASE WHEN BYTEARRAY_SUBSTRING(b.pool_id, 1, 20) = b.token - THEN amount / POWER (10, 18) --for Balancer Pool Tokens - ELSE amount / POWER (10, COALESCE(t.decimals, 0)) - END AS delta_amount - FROM - ( - SELECT - evt_block_time, - evt_block_number, - evt_tx_hash, - evt_index, - pool_id, - token, - COALESCE(delta, INT256 '0') AS amount - FROM balances_changes - - UNION ALL - - SELECT - evt_block_time, - evt_block_number, - evt_tx_hash, - evt_index, - pool_id, - token, - delta AS amount - FROM - swaps_changes - - UNION ALL - - SELECT - evt_block_time, - evt_block_number, - evt_tx_hash, - evt_index, - pool_id, - token, - CAST(delta AS int256) AS amount - FROM managed_changes - ) b - LEFT JOIN {{ source('tokens', 'erc20') }} t ON t.contract_address = b.token - AND blockchain = '{{blockchain}}' - LEFT JOIN pool_labels p ON p.pool_id = BYTEARRAY_SUBSTRING(b.pool_id, 1, 20) - {% if is_incremental() %} - WHERE {{ incremental_predicate('evt_block_time') }} - {% endif %} - - {% endmacro %} \ No newline at end of file diff --git a/models/_project/balancer/trades/balancer_trades.sql b/models/_project/balancer/balancer_trades.sql similarity index 100% rename from models/_project/balancer/trades/balancer_trades.sql rename to models/_project/balancer/balancer_trades.sql diff --git a/models/_project/balancer/balances/_schema.yml b/models/_project/balancer/balances/_schema.yml deleted file mode 100644 index 9d8b84cf3a1..00000000000 --- a/models/_project/balancer/balances/_schema.yml +++ /dev/null @@ -1,98 +0,0 @@ -version: 2 - -models: - - name: balancer_token_balance_changes - meta: - blockchain: arbitrum, avalanche_c, base, ethereum, gnosis, optimism, polygon, zkevm - contributors: viniabussafi - config: - tags: ['arbitrum', 'avalanche_c', 'base', 'ethereum', 'gnosis', 'optimism', 'polygon', 'zkevm', 'bpt', 'supply', 'changes'] - description: > - Token Balance Changes on Balancer Pools. - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - block_date - - evt_tx_hash - - evt_index - - token_address - columns: - - &block_date - name: block_date - description: "UTC event block date of each DEX trade" - - &evt_block_time - name: evt_block_time - description: 'Block time of transfer event' - - &evt_block_number - name: evt_block_number - description: 'Block number of transfer event' - - &blockchain - name: blockchain - description: "Blockchain" - - &evt_tx_hash - name: evt_tx_hash - description: 'Transaction hash of transfer event' - - &evt_index - name: evt_index - description: 'Event index' - - &pool_id - name: pool_id - description: "Unique encoded identifier that refers to each pool" - - &pool_address - name: pool_address - description: "Pool address" - - &pool_symbol - name: pool_symbol - description: "Token symbols, followed by their respective weights, if applicable" - - &pool_type - name: pool_type - description: "Pool attributes, determined by the pool's factory" - - &version - name: version - description: "Version of Balancer where the liquidity pool used in transaction is deployed" - - &token_address - name: token_address - description: "Contract address of the token" - - &token_symbol - name: token_symbol - description: "Token symbol" - - &delta_amount_raw - name: delta_amount_raw - description: "Raw value of the transaction at the time of execution in the original currency" - - &delta_amount - name: delta_amount - description: "Normalized value of the transaction at the time of execution in the original currency" - - - name: balancer_token_balance_changes_daily - meta: - blockchain: arbitrum, avalanche_c, base, ethereum, gnosis, optimism, polygon, zkevm - contributors: viniabussafi - config: - tags: ['arbitrum', 'avalanche_c', 'base', 'ethereum', 'gnosis', 'optimism', 'polygon', 'zkevm', 'bpt', 'supply', 'changes'] - description: > - Token Balance Changes on Balancer Pools, grouped by day. - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - block_date - - pool_id - - token_address - columns: - - *block_date - - *pool_id - - *pool_address - - *pool_symbol - - *version - - *blockchain - - *pool_type - - *token_address - - *token_symbol - - &daily_delta - name: daily_delta - description: "Daily total impact on token balance" - - &daily_delta_usd - name: daily_delta_usd - description: "Daily total impact on token balance, in USD" - - &daily_delta_eth - name: daily_delta_eth - description: "Daily total impact on token balance, in eth" \ No newline at end of file diff --git a/models/_project/balancer/balances/arbitrum/_schema.yml b/models/_project/balancer/balances/arbitrum/_schema.yml deleted file mode 100644 index ff5e07ed5d8..00000000000 --- a/models/_project/balancer/balances/arbitrum/_schema.yml +++ /dev/null @@ -1,100 +0,0 @@ -version: 2 - -models: - - name: balancer_v2_arbitrum_token_balance_changes - meta: - blockchain: arbitrum - project: balancer_v2 - contributors: viniabussafi - config: - tags: ['arbitrum', 'bpt', 'supply', 'changes'] - description: > - Token Balance Changes on Balancer Pools. - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - block_date - - evt_tx_hash - - evt_index - - token_address - columns: - - &block_date - name: block_date - description: "UTC event block date of each DEX trade" - - &evt_block_time - name: evt_block_time - description: 'Block time of transfer event' - - &evt_block_number - name: evt_block_number - description: 'Block number of transfer event' - - &blockchain - name: blockchain - description: "Blockchain" - - &evt_tx_hash - name: evt_tx_hash - description: 'Transaction hash of transfer event' - - &evt_index - name: evt_index - description: 'Event index' - - &pool_id - name: pool_id - description: "Unique encoded identifier that refers to each pool" - - &pool_address - name: pool_address - description: "Pool address" - - &pool_symbol - name: pool_symbol - description: "Token symbols, followed by their respective weights, if applicable" - - &pool_type - name: pool_type - description: "Pool attributes, determined by the pool's factory" - - &version - name: version - description: "Version of Balancer where the liquidity pool used in transaction is deployed" - - &token_address - name: token_address - description: "Contract address of the token" - - &token_symbol - name: token_symbol - description: "Token symbol" - - &delta_amount_raw - name: delta_amount_raw - description: "Raw value of the transaction at the time of execution in the original currency" - - &delta_amount - name: delta_amount - description: "Normalized value of the transaction at the time of execution in the original currency" - - - name: balancer_v2_arbitrum_token_balance_changes_daily - meta: - blockchain: arbitrum - project: balancer_v2 - contributors: viniabussafi - config: - tags: ['arbitrum', 'bpt', 'supply', 'changes'] - description: > - Token Balance Changes on Balancer Pools, grouped by day. - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - block_date - - pool_id - - token_address - columns: - - *block_date - - *pool_id - - *pool_address - - *pool_symbol - - *version - - *blockchain - - *pool_type - - *token_address - - *token_symbol - - &daily_delta - name: daily_delta - description: "Daily total impact on token balance" - - &daily_delta_usd - name: daily_delta_usd - description: "Daily total impact on token balance, in USD" - - &daily_delta_eth - name: daily_delta_eth - description: "Daily total impact on token balance, in eth" \ No newline at end of file diff --git a/models/_project/balancer/balances/arbitrum/balancer_v2_arbitrum_token_balance_changes.sql b/models/_project/balancer/balances/arbitrum/balancer_v2_arbitrum_token_balance_changes.sql deleted file mode 100644 index ca58f713377..00000000000 --- a/models/_project/balancer/balances/arbitrum/balancer_v2_arbitrum_token_balance_changes.sql +++ /dev/null @@ -1,16 +0,0 @@ -{% set blockchain = 'arbitrum' %} - -{{ config( - schema = 'balancer_v2_arbitrum', - alias = 'token_balance_changes', - materialized = 'table', - file_format = 'delta' - ) -}} - -{{ - balancer_token_balance_changes_macro( - blockchain = blockchain, - version = '2' - ) -}} \ No newline at end of file diff --git a/models/_project/balancer/balances/arbitrum/balancer_v2_arbitrum_token_balance_changes_daily.sql b/models/_project/balancer/balances/arbitrum/balancer_v2_arbitrum_token_balance_changes_daily.sql deleted file mode 100644 index c35d7b60259..00000000000 --- a/models/_project/balancer/balances/arbitrum/balancer_v2_arbitrum_token_balance_changes_daily.sql +++ /dev/null @@ -1,17 +0,0 @@ -{% set blockchain = 'arbitrum' %} - -{{ - config( - schema = 'balancer_v2_arbitrum', - alias = 'token_balance_changes_daily', - materialized = 'table', - file_format = 'delta' - ) -}} - -{{ - balancer_token_balance_changes_daily_agg_macro( - blockchain = blockchain, - version = '2' - ) -}} \ No newline at end of file diff --git a/models/_project/balancer/balances/avalanche_c/_schema.yml b/models/_project/balancer/balances/avalanche_c/_schema.yml deleted file mode 100644 index e341729e2fa..00000000000 --- a/models/_project/balancer/balances/avalanche_c/_schema.yml +++ /dev/null @@ -1,100 +0,0 @@ -version: 2 - -models: - - name: balancer_v2_avalanche_c_token_balance_changes - meta: - blockchain: avalanche_c - project: balancer_v2 - contributors: viniabussafi - config: - tags: ['avalanche_c', 'bpt', 'supply', 'changes'] - description: > - Token Balance Changes on Balancer Pools. - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - block_date - - evt_tx_hash - - evt_index - - token_address - columns: - - &block_date - name: block_date - description: "UTC event block date of each DEX trade" - - &evt_block_time - name: evt_block_time - description: 'Block time of transfer event' - - &evt_block_number - name: evt_block_number - description: 'Block number of transfer event' - - &blockchain - name: blockchain - description: "Blockchain" - - &evt_tx_hash - name: evt_tx_hash - description: 'Transaction hash of transfer event' - - &evt_index - name: evt_index - description: 'Event index' - - &pool_id - name: pool_id - description: "Unique encoded identifier that refers to each pool" - - &pool_address - name: pool_address - description: "Pool address" - - &pool_symbol - name: pool_symbol - description: "Token symbols, followed by their respective weights, if applicable" - - &pool_type - name: pool_type - description: "Pool attributes, determined by the pool's factory" - - &version - name: version - description: "Version of Balancer where the liquidity pool used in transaction is deployed" - - &token_address - name: token_address - description: "Contract address of the token" - - &token_symbol - name: token_symbol - description: "Token symbol" - - &delta_amount_raw - name: delta_amount_raw - description: "Raw value of the transaction at the time of execution in the original currency" - - &delta_amount - name: delta_amount - description: "Normalized value of the transaction at the time of execution in the original currency" - - - name: balancer_v2_avalanche_c_token_balance_changes_daily - meta: - blockchain: avalanche_c - project: balancer_v2 - contributors: viniabussafi - config: - tags: ['avalanche_c', 'bpt', 'supply', 'changes'] - description: > - Token Balance Changes on Balancer Pools, grouped by day. - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - block_date - - pool_id - - token_address - columns: - - *block_date - - *pool_id - - *pool_address - - *pool_symbol - - *version - - *blockchain - - *pool_type - - *token_address - - *token_symbol - - &daily_delta - name: daily_delta - description: "Daily total impact on token balance" - - &daily_delta_usd - name: daily_delta_usd - description: "Daily total impact on token balance, in USD" - - &daily_delta_eth - name: daily_delta_eth - description: "Daily total impact on token balance, in eth" \ No newline at end of file diff --git a/models/_project/balancer/balances/avalanche_c/balancer_v2_avalanche_c_token_balance_changes.sql b/models/_project/balancer/balances/avalanche_c/balancer_v2_avalanche_c_token_balance_changes.sql deleted file mode 100644 index ab55e6e99f1..00000000000 --- a/models/_project/balancer/balances/avalanche_c/balancer_v2_avalanche_c_token_balance_changes.sql +++ /dev/null @@ -1,16 +0,0 @@ -{% set blockchain = 'avalanche_c' %} - -{{ config( - schema = 'balancer_v2_avalanche_c', - alias = 'token_balance_changes', - materialized = 'table', - file_format = 'delta' - ) -}} - -{{ - balancer_token_balance_changes_macro( - blockchain = blockchain, - version = '2' - ) -}} \ No newline at end of file diff --git a/models/_project/balancer/balances/avalanche_c/balancer_v2_avalanche_c_token_balance_changes_daily.sql b/models/_project/balancer/balances/avalanche_c/balancer_v2_avalanche_c_token_balance_changes_daily.sql deleted file mode 100644 index 35ed123547e..00000000000 --- a/models/_project/balancer/balances/avalanche_c/balancer_v2_avalanche_c_token_balance_changes_daily.sql +++ /dev/null @@ -1,17 +0,0 @@ -{% set blockchain = 'avalanche_c' %} - -{{ - config( - schema = 'balancer_v2_avalanche_c', - alias = 'token_balance_changes_daily', - materialized = 'table', - file_format = 'delta' - ) -}} - -{{ - balancer_token_balance_changes_daily_agg_macro( - blockchain = blockchain, - version = '2' - ) -}} \ No newline at end of file diff --git a/models/_project/balancer/balances/balancer_token_balance_changes.sql b/models/_project/balancer/balances/balancer_token_balance_changes.sql deleted file mode 100644 index 7f531a769f3..00000000000 --- a/models/_project/balancer/balances/balancer_token_balance_changes.sql +++ /dev/null @@ -1,46 +0,0 @@ -{{ config( - schema = 'balancer', - alias = 'token_balance_changes', - post_hook='{{ expose_spells(blockchains = \'["arbitrum", "avalanche_c", "base", "ethereum", "gnosis", "optimism", "polygon", "zkevm"]\', - spell_type = "project", - spell_name = "balancer", - contributors = \'["viniabussafi"]\') }}' - ) -}} - -{% set balancer_models = [ - ref('balancer_v2_arbitrum_token_balance_changes'), - ref('balancer_v2_avalanche_c_token_balance_changes'), - ref('balancer_v2_base_token_balance_changes'), - ref('balancer_v2_ethereum_token_balance_changes'), - ref('balancer_v2_gnosis_token_balance_changes'), - ref('balancer_v2_optimism_token_balance_changes'), - ref('balancer_v2_polygon_token_balance_changes'), - ref('balancer_v2_zkevm_token_balance_changes') -] %} - -SELECT * -FROM ( - {% for model in balancer_models %} - SELECT - block_date - , evt_block_time - , evt_block_number - , blockchain - , evt_tx_hash - , evt_index - , pool_id - , pool_address - , pool_symbol - , pool_type - , version - , token_address - , token_symbol - , delta_amount_raw - , delta_amount - FROM {{ model }} - {% if not loop.last %} - UNION ALL - {% endif %} - {% endfor %} -) \ No newline at end of file diff --git a/models/_project/balancer/balances/balancer_token_balance_changes_daily.sql b/models/_project/balancer/balances/balancer_token_balance_changes_daily.sql deleted file mode 100644 index 8e199a25708..00000000000 --- a/models/_project/balancer/balances/balancer_token_balance_changes_daily.sql +++ /dev/null @@ -1,43 +0,0 @@ -{{ config( - schema = 'balancer', - alias = 'token_balance_changes_daily', - post_hook='{{ expose_spells(blockchains = \'["arbitrum", "avalanche_c", "base", "ethereum", "gnosis", "optimism", "polygon", "zkevm"]\', - spell_type = "project", - spell_name = "balancer", - contributors = \'["viniabussafi"]\') }}' - ) -}} - -{% set balancer_models = [ - ref('balancer_v2_arbitrum_token_balance_changes_daily'), - ref('balancer_v2_avalanche_c_token_balance_changes_daily'), - ref('balancer_v2_base_token_balance_changes_daily'), - ref('balancer_v2_ethereum_token_balance_changes_daily'), - ref('balancer_v2_gnosis_token_balance_changes_daily'), - ref('balancer_v2_optimism_token_balance_changes_daily'), - ref('balancer_v2_polygon_token_balance_changes_daily'), - ref('balancer_v2_zkevm_token_balance_changes_daily') -] %} - -SELECT * -FROM ( - {% for model in balancer_models %} - SELECT - block_date - , pool_id - , pool_address - , pool_symbol - , version - , blockchain - , pool_type - , token_address - , token_symbol - , daily_delta - , daily_delta_usd - , daily_delta_eth - FROM {{ model }} - {% if not loop.last %} - UNION ALL - {% endif %} - {% endfor %} -) \ No newline at end of file diff --git a/models/_project/balancer/balances/base/_schema.yml b/models/_project/balancer/balances/base/_schema.yml deleted file mode 100644 index 89a11b3e539..00000000000 --- a/models/_project/balancer/balances/base/_schema.yml +++ /dev/null @@ -1,100 +0,0 @@ -version: 2 - -models: - - name: balancer_v2_base_token_balance_changes - meta: - blockchain: base - project: balancer_v2 - contributors: viniabussafi - config: - tags: ['base', 'bpt', 'supply', 'changes'] - description: > - Token Balance Changes on Balancer Pools. - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - block_date - - evt_tx_hash - - evt_index - - token_address - columns: - - &block_date - name: block_date - description: "UTC event block date of each DEX trade" - - &evt_block_time - name: evt_block_time - description: 'Block time of transfer event' - - &evt_block_number - name: evt_block_number - description: 'Block number of transfer event' - - &blockchain - name: blockchain - description: "Blockchain" - - &evt_tx_hash - name: evt_tx_hash - description: 'Transaction hash of transfer event' - - &evt_index - name: evt_index - description: 'Event index' - - &pool_id - name: pool_id - description: "Unique encoded identifier that refers to each pool" - - &pool_address - name: pool_address - description: "Pool address" - - &pool_symbol - name: pool_symbol - description: "Token symbols, followed by their respective weights, if applicable" - - &pool_type - name: pool_type - description: "Pool attributes, determined by the pool's factory" - - &version - name: version - description: "Version of Balancer where the liquidity pool used in transaction is deployed" - - &token_address - name: token_address - description: "Contract address of the token" - - &token_symbol - name: token_symbol - description: "Token symbol" - - &delta_amount_raw - name: delta_amount_raw - description: "Raw value of the transaction at the time of execution in the original currency" - - &delta_amount - name: delta_amount - description: "Normalized value of the transaction at the time of execution in the original currency" - - - name: balancer_v2_base_token_balance_changes_daily - meta: - blockchain: base - project: balancer_v2 - contributors: viniabussafi - config: - tags: ['base', 'bpt', 'supply', 'changes'] - description: > - Token Balance Changes on Balancer Pools, grouped by day. - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - block_date - - pool_id - - token_address - columns: - - *block_date - - *pool_id - - *pool_address - - *pool_symbol - - *version - - *blockchain - - *pool_type - - *token_address - - *token_symbol - - &daily_delta - name: daily_delta - description: "Daily total impact on token balance" - - &daily_delta_usd - name: daily_delta_usd - description: "Daily total impact on token balance, in USD" - - &daily_delta_eth - name: daily_delta_eth - description: "Daily total impact on token balance, in eth" \ No newline at end of file diff --git a/models/_project/balancer/balances/base/balancer_v2_base_token_balance_changes.sql b/models/_project/balancer/balances/base/balancer_v2_base_token_balance_changes.sql deleted file mode 100644 index 1f35750f21d..00000000000 --- a/models/_project/balancer/balances/base/balancer_v2_base_token_balance_changes.sql +++ /dev/null @@ -1,16 +0,0 @@ -{% set blockchain = 'base' %} - -{{ config( - schema = 'balancer_v2_base', - alias = 'token_balance_changes', - materialized = 'table', - file_format = 'delta' - ) -}} - -{{ - balancer_token_balance_changes_macro( - blockchain = blockchain, - version = '2' - ) -}} \ No newline at end of file diff --git a/models/_project/balancer/balances/base/balancer_v2_base_token_balance_changes_daily.sql b/models/_project/balancer/balances/base/balancer_v2_base_token_balance_changes_daily.sql deleted file mode 100644 index fe24b712bee..00000000000 --- a/models/_project/balancer/balances/base/balancer_v2_base_token_balance_changes_daily.sql +++ /dev/null @@ -1,17 +0,0 @@ -{% set blockchain = 'base' %} - -{{ - config( - schema = 'balancer_v2_base', - alias = 'token_balance_changes_daily', - materialized = 'table', - file_format = 'delta' - ) -}} - -{{ - balancer_token_balance_changes_daily_agg_macro( - blockchain = blockchain, - version = '2' - ) -}} \ No newline at end of file diff --git a/models/_project/balancer/balances/ethereum/_schema.yml b/models/_project/balancer/balances/ethereum/_schema.yml deleted file mode 100644 index dab33f52016..00000000000 --- a/models/_project/balancer/balances/ethereum/_schema.yml +++ /dev/null @@ -1,131 +0,0 @@ -version: 2 - -models: - - name: balancer_ethereum_balances - meta: - blockchain: ethereum - project: balancer - contributors: jacektrocinski, metacrypto, viniabussafi - config: - tags: ['ethereum', 'balancer', 'balances'] - description: > - ERC20 token rolling sum balances on Balancer, an automated portfolio manager and trading platform. - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - day - - pool - - token - columns: - - &day - name: day - description: "UTC event block time truncated to the day mark" - tests: - - not_null - - &pool - name: pool - description: "Balancer pool contract address" - - &token - name: token - description: "Token contract address" - - &cumulative_amount - name: cumulative_amount - description: "Balance of a token" - - - name: balancer_v2_ethereum_token_balance_changes - meta: - blockchain: ethereum - project: balancer_v2 - contributors: viniabussafi - config: - tags: ['ethereum', 'bpt', 'supply', 'changes'] - description: > - Token Balance Changes on Balancer Pools. - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - block_date - - evt_tx_hash - - evt_index - - token_address - columns: - - &block_date - name: block_date - description: "UTC event block date of each DEX trade" - - &evt_block_time - name: evt_block_time - description: "Block time of transfer event" - - &evt_block_number - name: evt_block_number - description: "Block number of transfer event" - - &blockchain - name: blockchain - description: "Blockchain" - - &evt_tx_hash - name: evt_tx_hash - description: "Transaction hash of transfer event" - - &evt_index - name: evt_index - description: "Event index" - - &pool_id - name: pool_id - description: "Unique encoded identifier that refers to each pool" - - &pool_address - name: pool_address - description: "Pool address" - - &pool_symbol - name: pool_symbol - description: "Token symbols, followed by their respective weights, if applicable" - - &pool_type - name: pool_type - description: "Pool attributes, determined by the pool's factory" - - &version - name: version - description: "Version of Balancer where the liquidity pool used in transaction is deployed" - - &token_address - name: token_address - description: "Contract address of the token" - - &token_symbol - name: token_symbol - description: "Token symbol" - - &delta_amount_raw - name: delta_amount_raw - description: "Raw value of the transaction at the time of execution in the original currency" - - &delta_amount - name: delta_amount - description: "Normalized value of the transaction at the time of execution in the original currency" - - - name: balancer_v2_ethereum_token_balance_changes_daily - meta: - blockchain: ethereum - project: balancer_v2 - contributors: viniabussafi - config: - tags: ['ethereum', 'bpt', 'supply', 'changes'] - description: > - Token Balance Changes on Balancer Pools, grouped by day. - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - block_date - - pool_id - - token_address - columns: - - *block_date - - *pool_id - - *pool_address - - *pool_symbol - - *version - - *blockchain - - *pool_type - - *token_address - - *token_symbol - - &daily_delta - name: daily_delta - description: "Daily total impact on token balance" - - &daily_delta_usd - name: daily_delta_usd - description: "Daily total impact on token balance, in USD" - - &daily_delta_eth - name: daily_delta_eth - description: "Daily total impact on token balance, in ETH" \ No newline at end of file diff --git a/models/_project/balancer/balances/ethereum/balancer_v2_ethereum_token_balance_changes.sql b/models/_project/balancer/balances/ethereum/balancer_v2_ethereum_token_balance_changes.sql deleted file mode 100644 index 12b1a61ad46..00000000000 --- a/models/_project/balancer/balances/ethereum/balancer_v2_ethereum_token_balance_changes.sql +++ /dev/null @@ -1,16 +0,0 @@ -{% set blockchain = 'ethereum' %} - -{{ config( - schema = 'balancer_v2_ethereum', - alias = 'token_balance_changes', - materialized = 'table', - file_format = 'delta' - ) -}} - -{{ - balancer_token_balance_changes_macro( - blockchain = blockchain, - version = '2' - ) -}} \ No newline at end of file diff --git a/models/_project/balancer/balances/ethereum/balancer_v2_ethereum_token_balance_changes_daily.sql b/models/_project/balancer/balances/ethereum/balancer_v2_ethereum_token_balance_changes_daily.sql deleted file mode 100644 index 44aeb0ee7b8..00000000000 --- a/models/_project/balancer/balances/ethereum/balancer_v2_ethereum_token_balance_changes_daily.sql +++ /dev/null @@ -1,17 +0,0 @@ -{% set blockchain = 'ethereum' %} - -{{ - config( - schema = 'balancer_v2_ethereum', - alias = 'token_balance_changes_daily', - materialized = 'table', - file_format = 'delta' - ) -}} - -{{ - balancer_token_balance_changes_daily_agg_macro( - blockchain = blockchain, - version = '2' - ) -}} \ No newline at end of file diff --git a/models/_project/balancer/balances/gnosis/_schema.yml b/models/_project/balancer/balances/gnosis/_schema.yml deleted file mode 100644 index 9fdd91e45e3..00000000000 --- a/models/_project/balancer/balances/gnosis/_schema.yml +++ /dev/null @@ -1,100 +0,0 @@ -version: 2 - -models: - - name: balancer_v2_gnosis_token_balance_changes - meta: - blockchain: gnosis - project: balancer_v2 - contributors: viniabussafi - config: - tags: ['gnosis', 'bpt', 'supply', 'changes'] - description: > - Token Balance Changes on Balancer Pools. - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - block_date - - evt_tx_hash - - evt_index - - token_address - columns: - - &block_date - name: block_date - description: "UTC event block date of each DEX trade" - - &evt_block_time - name: evt_block_time - description: 'Block time of transfer event' - - &evt_block_number - name: evt_block_number - description: 'Block number of transfer event' - - &blockchain - name: blockchain - description: "Blockchain" - - &evt_tx_hash - name: evt_tx_hash - description: 'Transaction hash of transfer event' - - &evt_index - name: evt_index - description: 'Event index' - - &pool_id - name: pool_id - description: "Unique encoded identifier that refers to each pool" - - &pool_address - name: pool_address - description: "Pool address" - - &pool_symbol - name: pool_symbol - description: "Token symbols, followed by their respective weights, if applicable" - - &pool_type - name: pool_type - description: "Pool attributes, determined by the pool's factory" - - &version - name: version - description: "Version of Balancer where the liquidity pool used in transaction is deployed" - - &token_address - name: token_address - description: "Contract address of the token" - - &token_symbol - name: token_symbol - description: "Token symbol" - - &delta_amount_raw - name: delta_amount_raw - description: "Raw value of the transaction at the time of execution in the original currency" - - &delta_amount - name: delta_amount - description: "Normalized value of the transaction at the time of execution in the original currency" - - - name: balancer_v2_gnosis_token_balance_changes_daily - meta: - blockchain: gnosis - project: balancer_v2 - contributors: viniabussafi - config: - tags: ['gnosis', 'bpt', 'supply', 'changes'] - description: > - Token Balance Changes on Balancer Pools, grouped by day. - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - block_date - - pool_id - - token_address - columns: - - *block_date - - *pool_id - - *pool_address - - *pool_symbol - - *version - - *blockchain - - *pool_type - - *token_address - - *token_symbol - - &daily_delta - name: daily_delta - description: "Daily total impact on token balance" - - &daily_delta_usd - name: daily_delta_usd - description: "Daily total impact on token balance, in USD" - - &daily_delta_eth - name: daily_delta_eth - description: "Daily total impact on token balance, in eth" \ No newline at end of file diff --git a/models/_project/balancer/balances/gnosis/balancer_v2_gnosis_token_balance_changes.sql b/models/_project/balancer/balances/gnosis/balancer_v2_gnosis_token_balance_changes.sql deleted file mode 100644 index e3e0177541d..00000000000 --- a/models/_project/balancer/balances/gnosis/balancer_v2_gnosis_token_balance_changes.sql +++ /dev/null @@ -1,16 +0,0 @@ -{% set blockchain = 'gnosis' %} - -{{ config( - schema = 'balancer_v2_gnosis', - alias = 'token_balance_changes', - materialized = 'table', - file_format = 'delta' - ) -}} - -{{ - balancer_token_balance_changes_macro( - blockchain = blockchain, - version = '2' - ) -}} \ No newline at end of file diff --git a/models/_project/balancer/balances/gnosis/balancer_v2_gnosis_token_balance_changes_daily.sql b/models/_project/balancer/balances/gnosis/balancer_v2_gnosis_token_balance_changes_daily.sql deleted file mode 100644 index 434e9b096fb..00000000000 --- a/models/_project/balancer/balances/gnosis/balancer_v2_gnosis_token_balance_changes_daily.sql +++ /dev/null @@ -1,17 +0,0 @@ -{% set blockchain = 'gnosis' %} - -{{ - config( - schema = 'balancer_v2_gnosis', - alias = 'token_balance_changes_daily', - materialized = 'table', - file_format = 'delta' - ) -}} - -{{ - balancer_token_balance_changes_daily_agg_macro( - blockchain = blockchain, - version = '2' - ) -}} \ No newline at end of file diff --git a/models/_project/balancer/balances/optimism/_schema.yml b/models/_project/balancer/balances/optimism/_schema.yml deleted file mode 100644 index 952aefc44ee..00000000000 --- a/models/_project/balancer/balances/optimism/_schema.yml +++ /dev/null @@ -1,100 +0,0 @@ -version: 2 - -models: - - name: balancer_v2_optimism_token_balance_changes - meta: - blockchain: optimism - project: balancer_v2 - contributors: viniabussafi - config: - tags: ['optimism', 'bpt', 'supply', 'changes'] - description: > - Token Balance Changes on Balancer Pools. - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - block_date - - evt_tx_hash - - evt_index - - token_address - columns: - - &block_date - name: block_date - description: "UTC event block date of each DEX trade" - - &evt_block_time - name: evt_block_time - description: 'Block time of transfer event' - - &evt_block_number - name: evt_block_number - description: 'Block number of transfer event' - - &blockchain - name: blockchain - description: "Blockchain" - - &evt_tx_hash - name: evt_tx_hash - description: 'Transaction hash of transfer event' - - &evt_index - name: evt_index - description: 'Event index' - - &pool_id - name: pool_id - description: "Unique encoded identifier that refers to each pool" - - &pool_address - name: pool_address - description: "Pool address" - - &pool_symbol - name: pool_symbol - description: "Token symbols, followed by their respective weights, if applicable" - - &pool_type - name: pool_type - description: "Pool attributes, determined by the pool's factory" - - &version - name: version - description: "Version of Balancer where the liquidity pool used in transaction is deployed" - - &token_address - name: token_address - description: "Contract address of the token" - - &token_symbol - name: token_symbol - description: "Token symbol" - - &delta_amount_raw - name: delta_amount_raw - description: "Raw value of the transaction at the time of execution in the original currency" - - &delta_amount - name: delta_amount - description: "Normalized value of the transaction at the time of execution in the original currency" - - - name: balancer_v2_optimism_token_balance_changes_daily - meta: - blockchain: optimism - project: balancer_v2 - contributors: viniabussafi - config: - tags: ['optimism', 'bpt', 'supply', 'changes'] - description: > - Token Balance Changes on Balancer Pools, grouped by day. - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - block_date - - pool_id - - token_address - columns: - - *block_date - - *pool_id - - *pool_address - - *pool_symbol - - *version - - *blockchain - - *pool_type - - *token_address - - *token_symbol - - &daily_delta - name: daily_delta - description: "Daily total impact on token balance" - - &daily_delta_usd - name: daily_delta_usd - description: "Daily total impact on token balance, in USD" - - &daily_delta_eth - name: daily_delta_eth - description: "Daily total impact on token balance, in eth" \ No newline at end of file diff --git a/models/_project/balancer/balances/optimism/balancer_v2_optimism_token_balance_changes.sql b/models/_project/balancer/balances/optimism/balancer_v2_optimism_token_balance_changes.sql deleted file mode 100644 index 39fd96a795d..00000000000 --- a/models/_project/balancer/balances/optimism/balancer_v2_optimism_token_balance_changes.sql +++ /dev/null @@ -1,16 +0,0 @@ -{% set blockchain = 'optimism' %} - -{{ config( - schema = 'balancer_v2_optimism', - alias = 'token_balance_changes', - materialized = 'table', - file_format = 'delta' - ) -}} - -{{ - balancer_token_balance_changes_macro( - blockchain = blockchain, - version = '2' - ) -}} \ No newline at end of file diff --git a/models/_project/balancer/balances/optimism/balancer_v2_optimism_token_balance_changes_daily.sql b/models/_project/balancer/balances/optimism/balancer_v2_optimism_token_balance_changes_daily.sql deleted file mode 100644 index ac9db7d6bd7..00000000000 --- a/models/_project/balancer/balances/optimism/balancer_v2_optimism_token_balance_changes_daily.sql +++ /dev/null @@ -1,17 +0,0 @@ -{% set blockchain = 'optimism' %} - -{{ - config( - schema = 'balancer_v2_optimism', - alias = 'token_balance_changes_daily', - materialized = 'table', - file_format = 'delta' - ) -}} - -{{ - balancer_token_balance_changes_daily_agg_macro( - blockchain = blockchain, - version = '2' - ) -}} \ No newline at end of file diff --git a/models/_project/balancer/balances/polygon/_schema.yml b/models/_project/balancer/balances/polygon/_schema.yml deleted file mode 100644 index 70c27f9cac4..00000000000 --- a/models/_project/balancer/balances/polygon/_schema.yml +++ /dev/null @@ -1,100 +0,0 @@ -version: 2 - -models: - - name: balancer_v2_polygon_token_balance_changes - meta: - blockchain: polygon - project: balancer_v2 - contributors: viniabussafi - config: - tags: ['polygon', 'bpt', 'supply', 'changes'] - description: > - Token Balance Changes on Balancer Pools. - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - block_date - - evt_tx_hash - - evt_index - - token_address - columns: - - &block_date - name: block_date - description: "UTC event block date of each DEX trade" - - &evt_block_time - name: evt_block_time - description: 'Block time of transfer event' - - &evt_block_number - name: evt_block_number - description: 'Block number of transfer event' - - &blockchain - name: blockchain - description: "Blockchain" - - &evt_tx_hash - name: evt_tx_hash - description: 'Transaction hash of transfer event' - - &evt_index - name: evt_index - description: 'Event index' - - &pool_id - name: pool_id - description: "Unique encoded identifier that refers to each pool" - - &pool_address - name: pool_address - description: "Pool address" - - &pool_symbol - name: pool_symbol - description: "Token symbols, followed by their respective weights, if applicable" - - &pool_type - name: pool_type - description: "Pool attributes, determined by the pool's factory" - - &version - name: version - description: "Version of Balancer where the liquidity pool used in transaction is deployed" - - &token_address - name: token_address - description: "Contract address of the token" - - &token_symbol - name: token_symbol - description: "Token symbol" - - &delta_amount_raw - name: delta_amount_raw - description: "Raw value of the transaction at the time of execution in the original currency" - - &delta_amount - name: delta_amount - description: "Normalized value of the transaction at the time of execution in the original currency" - - - name: balancer_v2_polygon_token_balance_changes_daily - meta: - blockchain: polygon - project: balancer_v2 - contributors: viniabussafi - config: - tags: ['polygon', 'bpt', 'supply', 'changes'] - description: > - Token Balance Changes on Balancer Pools, grouped by day. - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - block_date - - pool_id - - token_address - columns: - - *block_date - - *pool_id - - *pool_address - - *pool_symbol - - *version - - *blockchain - - *pool_type - - *token_address - - *token_symbol - - &daily_delta - name: daily_delta - description: "Daily total impact on token balance" - - &daily_delta_usd - name: daily_delta_usd - description: "Daily total impact on token balance, in USD" - - &daily_delta_eth - name: daily_delta_eth - description: "Daily total impact on token balance, in eth" \ No newline at end of file diff --git a/models/_project/balancer/balances/polygon/balancer_v2_polygon_token_balance_changes.sql b/models/_project/balancer/balances/polygon/balancer_v2_polygon_token_balance_changes.sql deleted file mode 100644 index efbac69046b..00000000000 --- a/models/_project/balancer/balances/polygon/balancer_v2_polygon_token_balance_changes.sql +++ /dev/null @@ -1,16 +0,0 @@ -{% set blockchain = 'polygon' %} - -{{ config( - schema = 'balancer_v2_polygon', - alias = 'token_balance_changes', - materialized = 'table', - file_format = 'delta' - ) -}} - -{{ - balancer_token_balance_changes_macro( - blockchain = blockchain, - version = '2' - ) -}} \ No newline at end of file diff --git a/models/_project/balancer/balances/polygon/balancer_v2_polygon_token_balance_changes_daily.sql b/models/_project/balancer/balances/polygon/balancer_v2_polygon_token_balance_changes_daily.sql deleted file mode 100644 index fa318aaec80..00000000000 --- a/models/_project/balancer/balances/polygon/balancer_v2_polygon_token_balance_changes_daily.sql +++ /dev/null @@ -1,17 +0,0 @@ -{% set blockchain = 'polygon' %} - -{{ - config( - schema = 'balancer_v2_polygon', - alias = 'token_balance_changes_daily', - materialized = 'table', - file_format = 'delta' - ) -}} - -{{ - balancer_token_balance_changes_daily_agg_macro( - blockchain = blockchain, - version = '2' - ) -}} \ No newline at end of file diff --git a/models/_project/balancer/balances/zkevm/_schema.yml b/models/_project/balancer/balances/zkevm/_schema.yml deleted file mode 100644 index 3fae28a259a..00000000000 --- a/models/_project/balancer/balances/zkevm/_schema.yml +++ /dev/null @@ -1,100 +0,0 @@ -version: 2 - -models: - - name: balancer_v2_zkevm_token_balance_changes - meta: - blockchain: zkevm - project: balancer_v2 - contributors: viniabussafi - config: - tags: ['zkevm', 'bpt', 'supply', 'changes'] - description: > - Token Balance Changes on Balancer Pools. - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - block_date - - evt_tx_hash - - evt_index - - token_address - columns: - - &block_date - name: block_date - description: "UTC event block date of each DEX trade" - - &evt_block_time - name: evt_block_time - description: 'Block time of transfer event' - - &evt_block_number - name: evt_block_number - description: 'Block number of transfer event' - - &blockchain - name: blockchain - description: "Blockchain" - - &evt_tx_hash - name: evt_tx_hash - description: 'Transaction hash of transfer event' - - &evt_index - name: evt_index - description: 'Event index' - - &pool_id - name: pool_id - description: "Unique encoded identifier that refers to each pool" - - &pool_address - name: pool_address - description: "Pool address" - - &pool_symbol - name: pool_symbol - description: "Token symbols, followed by their respective weights, if applicable" - - &pool_type - name: pool_type - description: "Pool attributes, determined by the pool's factory" - - &version - name: version - description: "Version of Balancer where the liquidity pool used in transaction is deployed" - - &token_address - name: token_address - description: "Contract address of the token" - - &token_symbol - name: token_symbol - description: "Token symbol" - - &delta_amount_raw - name: delta_amount_raw - description: "Raw value of the transaction at the time of execution in the original currency" - - &delta_amount - name: delta_amount - description: "Normalized value of the transaction at the time of execution in the original currency" - - - name: balancer_v2_zkevm_token_balance_changes_daily - meta: - blockchain: zkevm - project: balancer_v2 - contributors: viniabussafi - config: - tags: ['zkevm', 'bpt', 'supply', 'changes'] - description: > - Token Balance Changes on Balancer Pools, grouped by day. - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - block_date - - pool_id - - token_address - columns: - - *block_date - - *pool_id - - *pool_address - - *pool_symbol - - *version - - *blockchain - - *pool_type - - *token_address - - *token_symbol - - &daily_delta - name: daily_delta - description: "Daily total impact on token balance" - - &daily_delta_usd - name: daily_delta_usd - description: "Daily total impact on token balance, in USD" - - &daily_delta_eth - name: daily_delta_eth - description: "Daily total impact on token balance, in eth" \ No newline at end of file diff --git a/models/_project/balancer/balances/zkevm/balancer_v2_zkevm_token_balance_changes.sql b/models/_project/balancer/balances/zkevm/balancer_v2_zkevm_token_balance_changes.sql deleted file mode 100644 index 80eff1513b7..00000000000 --- a/models/_project/balancer/balances/zkevm/balancer_v2_zkevm_token_balance_changes.sql +++ /dev/null @@ -1,16 +0,0 @@ -{% set blockchain = 'zkevm' %} - -{{ config( - schema = 'balancer_v2_zkevm', - alias = 'token_balance_changes', - materialized = 'table', - file_format = 'delta' - ) -}} - -{{ - balancer_token_balance_changes_macro( - blockchain = blockchain, - version = '2' - ) -}} \ No newline at end of file diff --git a/models/_project/balancer/balances/zkevm/balancer_v2_zkevm_token_balance_changes_daily.sql b/models/_project/balancer/balances/zkevm/balancer_v2_zkevm_token_balance_changes_daily.sql deleted file mode 100644 index 9bd7cabbb72..00000000000 --- a/models/_project/balancer/balances/zkevm/balancer_v2_zkevm_token_balance_changes_daily.sql +++ /dev/null @@ -1,17 +0,0 @@ -{% set blockchain = 'zkevm' %} - -{{ - config( - schema = 'balancer_v2_zkevm', - alias = 'token_balance_changes_daily', - materialized = 'table', - file_format = 'delta' - ) -}} - -{{ - balancer_token_balance_changes_daily_agg_macro( - blockchain = blockchain, - version = '2' - ) -}} \ No newline at end of file diff --git a/models/_project/balancer/bpt/_schema.yml b/models/_project/balancer/bpt/_schema.yml deleted file mode 100644 index 4afa2327ca2..00000000000 --- a/models/_project/balancer/bpt/_schema.yml +++ /dev/null @@ -1,176 +0,0 @@ -version: 2 - -models: - - name: balancer_transfers_bpt - meta: - blockchain: arbitrum, avalanche_c, base, ethereum, gnosis, optimism, polygon, zkevmn - contributors: victorstefenon, thetroyharris, viniabussafi - config: - tags: ['arbitrum', 'avalanche_c', 'base', 'ethereum', 'gnosis', 'optimism', 'polygon', 'zkevm', 'bpt', 'transfers'] - description: > - Balancer Pool Token (BPT) transfer logs on Balancer, an automated portfolio manager and trading platform. - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - evt_tx_hash - - evt_index - - block_date - columns: - - &blockchain - name: blockchain - description: "Blockchain" - - &version - name: version - description: "Version of Balancer where the liquidity pool used in transaction is deployed" - - &contract_address - name: contract_address - description: 'zkevm address for the liquidity pool used in transaction' - - &block_date - name: block_date - description: "UTC event block date of each DEX trade" - - &block_month - name: block_month - description: "UTC event block month of each DEX trade" - - &evt_tx_hash - name: evt_tx_hash - description: 'Transaction hash of transfer event' - - &evt_index - name: evt_index - description: 'Event index' - - &evt_block_time - name: evt_block_time - description: 'Block time of transfer event' - - &evt_block_number - name: evt_block_number - description: 'Block number of transfer event' - - &from - name: from - description: 'Address of BPT provider of transfer event' - - &to - name: to - description: 'Address of BPT receiver of transfer event' - - &value - name: value - description: 'Amount of BPT transferred in transfer event' - - - name: balancer_bpt_prices - meta: - blockchain: arbitrum, avalanche_c, base, ethereum, gnosis, optimism, polygon, zkevm - sector: dex - contributors: thetroyharris, victorstefenon, viniabussafi - config: - tags: ['balancer', 'amm', 'dex', 'bpt', 'prices', 'ethereum', 'arbitrum', 'optimism', 'polygon', 'gnosis', 'avalanche_c', 'base', 'zkevm'] - description: > - Balancer Pool Token (BPT) hourly median price by pool on Balancer, an automated portfolio manager and trading platform. - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - blockchain - - day - - contract_address - columns: - - *blockchain - - &day - name: day - description: "Block date in UTC" - - *version - - &decimals - name: decimals - description: "Token decimals. 18, by default, on BPTs" - - *contract_address - - &bpt_price - name: bpt_price - description: "Price of the BPT" - - - - name: balancer_bpt_supply - meta: - blockchain: arbitrum, avalanche_c, base, ethereum, gnosis, optimism, polygon, zkevm - contributors: thetroyharris, viniabussafi - config: - tags: ['arbitrum', 'avalanche_c', 'base', 'ethereum', 'gnosis', 'optimism', 'polygon', 'zkevm', 'bpt'] - description: > - The Balancer Pool Token (BPT) supply over time of ComposableStablePools versions 4+ - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - day - - blockchain - - token_address - columns: - - *day - - &pool_type - name: pool_type - description: "Pool attributes, determined by the pool's factory" - - *version - - *blockchain - - &token_address - name: token_address - description: "Contract address of the BPT" - - &supply - name: supply - description: "Supply of the BPT, discounted of premints" - - - name: balancer_bpt_supply_changes - meta: - blockchain: arbitrum, avalanche_c, base, ethereum, gnosis, optimism, polygon, zkevm - contributors: viniabussafi - config: - tags: ['arbitrum', 'avalanche_c', 'base', 'ethereum', 'gnosis', 'optimism', 'polygon', 'zkevm', 'bpt', 'supply', 'changes'] - description: > - Balancer Pool Token (BPT) supply change events. - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - block_date - - evt_tx_hash - - evt_index - - label - columns: - - *block_date - - *evt_block_time - - *evt_block_number - - *blockchain - - *evt_tx_hash - - *evt_index - - *pool_type - - &pool_symbol - name: pool_symbol - description: "Token symbols, followed by their respective weights, if applicable" - - *version - - &label - name: label - description: "Nature of the transaction (Join/Exit via swap or Mint/Burn via transfer)" - - *token_address - - &delta_amount_raw - name: delta_amount_raw - description: "Raw value of the transaction on token supply at the time of execution in the original currency" - - &delta_amount - name: delta_amount - description: "Normalized value of the transaction on token supply at the time of execution in the original currency" - - - - name: balancer_bpt_supply_changes_daily - meta: - blockchain: arbitrum, avalanche_c, base, ethereum, gnosis, optimism, polygon, zkevm - contributors: viniabussafi - config: - tags: ['arbitrum', 'avalanche_c', 'base', 'ethereum', 'gnosis', 'optimism', 'polygon', 'zkevm', 'bpt', 'supply', 'changes'] - description: > - Balancer Pool Token (BPT) supply change events. grouped by day - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - block_date - - blockchain - - token_address - columns: - - *block_date - - *blockchain - - *pool_type - - *pool_symbol - - *version - - *token_address - - &daily_delta - name: daily_delta - description: "Daily total impact on BPT supply" \ No newline at end of file diff --git a/models/_project/balancer/bpt/arbitrum/_schema.yml b/models/_project/balancer/bpt/arbitrum/_schema.yml deleted file mode 100644 index c32bee8b667..00000000000 --- a/models/_project/balancer/bpt/arbitrum/_schema.yml +++ /dev/null @@ -1,178 +0,0 @@ -version: 2 - -models: - - name: balancer_v2_arbitrum_transfers_bpt - meta: - blockchain: arbitrum - project: balancer_v2 - contributors: victorstefenon, thetroyharris, viniabussafi - config: - tags: ['arbitrum', 'bpt', 'transfers'] - description: > - Balancer Pool Token (BPT) transfer logs on Balancer, an automated portfolio manager and trading platform, on Arbitrum. - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - evt_tx_hash - - evt_index - - block_date - columns: - - &blockchain - name: blockchain - description: "Blockchain" - - &version - name: version - description: "Version of Balancer where the liquidity pool used in transaction is deployed" - - &contract_address - name: contract_address - description: 'Arbitrum address for the liquidity pool used in transaction' - - &block_date - name: block_date - description: "UTC event block date of each DEX trade" - - &block_month - name: block_month - description: "UTC event block month of each DEX trade" - - &evt_tx_hash - name: evt_tx_hash - description: 'Transaction hash of transfer event' - - &evt_index - name: evt_index - description: 'Event index' - - &evt_block_time - name: evt_block_time - description: 'Block time of transfer event' - - &evt_block_number - name: evt_block_number - description: 'Block number of transfer event' - - &from - name: from - description: 'Address of BPT provider of transfer event' - - &to - name: to - description: 'Address of BPT receiver of transfer event' - - &value - name: value - description: 'Amount of BPT transferred in transfer event' - - - name: balancer_v2_arbitrum_bpt_prices - meta: - blockchain: arbitrum - project: balancer_v2 - contributors: victorstefenon, thetroyharris, viniabussafi - config: - tags: ['arbitrum', 'bpt', 'prices'] - description: > - Balancer Pool Token (BPT) daily price by pool on Balancer, an automated portfolio manager and trading platform. - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - blockchain - - day - - contract_address - columns: - - *blockchain - - &day - name: day - description: "Block date in UTC" - - *version - - &decimals - name: decimals - description: "Token decimals. 18, by default, on BPTs" - - *contract_address - - &bpt_price - name: bpt_price - description: "Price of the BPT" - - - name: balancer_v2_arbitrum_bpt_supply - meta: - blockchain: arbitrum - project: balancer_v2 - contributors: thetroyharris, viniabussafi - config: - tags: ['arbitrum', 'bpt', 'supply'] - description: > - Balancer Pool Token (BPT) supply by pool on Balancer, an automated portfolio manager and trading platform. - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - day - - blockchain - - token_address - columns: - - *day - - &pool_type - name: pool_type - description: "Pool attributes, determined by the pool's factory" - - *version - - *blockchain - - &token_address - name: token_address - description: "Contract address of the BPT" - - &supply - name: supply - description: "Supply of the BPT, discounted of premints" - - - name: balancer_v2_arbitrum_bpt_supply_changes - meta: - blockchain: arbitrum - project: balancer_v2 - contributors: viniabussafi - config: - tags: ['arbitrum', 'bpt', 'supply', 'changes'] - description: > - Balancer Pool Token (BPT) supply change events. - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - block_date - - evt_tx_hash - - evt_index - - label - columns: - - *block_date - - *evt_block_time - - *evt_block_number - - *blockchain - - *evt_tx_hash - - *evt_index - - *pool_type - - &pool_symbol - name: pool_symbol - description: "Token symbols, followed by their respective weights, if applicable" - - *version - - &label - name: label - description: "Nature of the transaction (Join/Exit via swap or Mint/Burn via transfer)" - - *token_address - - &delta_amount_raw - name: delta_amount_raw - description: "Raw value of the transaction on token supply at the time of execution in the original currency" - - &delta_amount - name: delta_amount - description: "Normalized value of the transaction on token supply at the time of execution in the original currency" - - - name: balancer_v2_arbitrum_bpt_supply_changes_daily - meta: - blockchain: arbitrum - project: balancer_v2 - contributors: viniabussafi - config: - tags: ['arbitrum', 'bpt', 'supply', 'changes'] - description: > - Balancer Pool Token (BPT) supply change events. grouped by day - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - block_date - - blockchain - - token_address - columns: - - *block_date - - *blockchain - - *pool_type - - *pool_symbol - - *version - - *token_address - - &daily_delta - name: daily_delta - description: "Daily total impact on BPT supply" \ No newline at end of file diff --git a/models/_project/balancer/bpt/arbitrum/balancer_v2_arbitrum_bpt_supply_changes.sql b/models/_project/balancer/bpt/arbitrum/balancer_v2_arbitrum_bpt_supply_changes.sql deleted file mode 100644 index b30224001c3..00000000000 --- a/models/_project/balancer/bpt/arbitrum/balancer_v2_arbitrum_bpt_supply_changes.sql +++ /dev/null @@ -1,20 +0,0 @@ -{% set blockchain = 'arbitrum' %} - -{{ - config( - schema = 'balancer_v2_arbitrum', - alias = 'bpt_supply_changes', - materialized = 'incremental', - file_format = 'delta', - incremental_strategy = 'merge', - unique_key = ['block_date', 'evt_tx_hash', 'evt_index', 'label'], - incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.evt_block_time')] - ) -}} - -{{ - bpt_supply_changes_macro( - blockchain = blockchain, - version = '2' - ) -}} \ No newline at end of file diff --git a/models/_project/balancer/bpt/arbitrum/balancer_v2_arbitrum_bpt_supply_changes_daily.sql b/models/_project/balancer/bpt/arbitrum/balancer_v2_arbitrum_bpt_supply_changes_daily.sql deleted file mode 100644 index df606a75ceb..00000000000 --- a/models/_project/balancer/bpt/arbitrum/balancer_v2_arbitrum_bpt_supply_changes_daily.sql +++ /dev/null @@ -1,17 +0,0 @@ -{% set blockchain = 'ethereum' %} - -{{ - config( - schema = 'balancer_v2_ethereum', - alias = 'bpt_supply_changes_daily', - materialized = 'table', - file_format = 'delta' - ) -}} - -{{ - bpt_supply_changes_daily_agg_macro( - blockchain = blockchain, - version = '2' - ) -}} \ No newline at end of file diff --git a/models/_project/balancer/bpt/avalanche_c/_schema.yml b/models/_project/balancer/bpt/avalanche_c/_schema.yml deleted file mode 100644 index 8bde08a0ad8..00000000000 --- a/models/_project/balancer/bpt/avalanche_c/_schema.yml +++ /dev/null @@ -1,178 +0,0 @@ -version: 2 - -models: - - name: balancer_v2_avalanche_c_transfers_bpt - meta: - blockchain: avalanche_c - project: balancer_v2 - contributors: victorstefenon, thetroyharris, viniabussafi - config: - tags: ['avalanche_c', 'bpt', 'transfers'] - description: > - Balancer Pool Token (BPT) transfer logs on Balancer, an automated portfolio manager and trading platform, on avalanche_c. - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - evt_tx_hash - - evt_index - - block_date - columns: - - &blockchain - name: blockchain - description: "Blockchain" - - &version - name: version - description: "Version of Balancer where the liquidity pool used in transaction is deployed" - - &contract_address - name: contract_address - description: 'avalanche_c address for the liquidity pool used in transaction' - - &block_date - name: block_date - description: "UTC event block date of each DEX trade" - - &block_month - name: block_month - description: "UTC event block month of each DEX trade" - - &evt_tx_hash - name: evt_tx_hash - description: 'Transaction hash of transfer event' - - &evt_index - name: evt_index - description: 'Event index' - - &evt_block_time - name: evt_block_time - description: 'Block time of transfer event' - - &evt_block_number - name: evt_block_number - description: 'Block number of transfer event' - - &from - name: from - description: 'Address of BPT provider of transfer event' - - &to - name: to - description: 'Address of BPT receiver of transfer event' - - &value - name: value - description: 'Amount of BPT transferred in transfer event' - - - name: balancer_v2_avalanche_c_bpt_prices - meta: - blockchain: avalanche_c - project: balancer_v2 - contributors: victorstefenon, thetroyharris, viniabussafi - config: - tags: ['avalanche_c', 'bpt', 'prices'] - description: > - Balancer Pool Token (BPT) daily price by pool on Balancer, an automated portfolio manager and trading platform. - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - blockchain - - day - - contract_address - columns: - - *blockchain - - &day - name: day - description: "Block date in UTC" - - *version - - &decimals - name: decimals - description: "Token decimals. 18, by default, on BPTs" - - *contract_address - - &bpt_price - name: bpt_price - description: "Price of the BPT" - - - name: balancer_v2_avalanche_c_bpt_supply - meta: - blockchain: avalanche_c - project: balancer_v2 - contributors: thetroyharris, viniabussafi - config: - tags: ['avalanche_c', 'bpt', 'supply'] - description: > - Balancer Pool Token (BPT) supply by pool on Balancer, an automated portfolio manager and trading platform. - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - day - - blockchain - - token_address - columns: - - *day - - &pool_type - name: pool_type - description: "Pool attributes, determined by the pool's factory" - - *version - - *blockchain - - &token_address - name: token_address - description: "Contract address of the BPT" - - &supply - name: supply - description: "Supply of the BPT, discounted of premints" - - - name: balancer_v2_avalanche_c_bpt_supply_changes - meta: - blockchain: avalanche_c - project: balancer_v2 - contributors: viniabussafi - config: - tags: ['avalanche_c', 'bpt', 'supply', 'changes'] - description: > - Balancer Pool Token (BPT) supply change events. - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - block_date - - evt_tx_hash - - evt_index - - label - columns: - - *block_date - - *evt_block_time - - *evt_block_number - - *blockchain - - *evt_tx_hash - - *evt_index - - *pool_type - - &pool_symbol - name: pool_symbol - description: "Token symbols, followed by their respective weights, if applicable" - - *version - - &label - name: label - description: "Nature of the transaction (Join/Exit via swap or Mint/Burn via transfer)" - - *token_address - - &delta_amount_raw - name: delta_amount_raw - description: "Raw value of the transaction on token supply at the time of execution in the original currency" - - &delta_amount - name: delta_amount - description: "Normalized value of the transaction on token supply at the time of execution in the original currency" - - - name: balancer_v2_avalanche_c_bpt_supply_changes_daily - meta: - blockchain: avalanche_c - project: balancer_v2 - contributors: viniabussafi - config: - tags: ['avalanche_c', 'bpt', 'supply', 'changes'] - description: > - Balancer Pool Token (BPT) supply change events. grouped by day - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - block_date - - blockchain - - token_address - columns: - - *block_date - - *blockchain - - *pool_type - - *pool_symbol - - *version - - *token_address - - &daily_delta - name: daily_delta - description: "Daily total impact on BPT supply" \ No newline at end of file diff --git a/models/_project/balancer/bpt/avalanche_c/balancer_v2_avalanche_c_bpt_supply_changes.sql b/models/_project/balancer/bpt/avalanche_c/balancer_v2_avalanche_c_bpt_supply_changes.sql deleted file mode 100644 index db1052cb8d8..00000000000 --- a/models/_project/balancer/bpt/avalanche_c/balancer_v2_avalanche_c_bpt_supply_changes.sql +++ /dev/null @@ -1,20 +0,0 @@ -{% set blockchain = 'avalanche_c' %} - -{{ - config( - schema = 'balancer_v2_avalanche_c', - alias = 'bpt_supply_changes', - materialized = 'incremental', - file_format = 'delta', - incremental_strategy = 'merge', - unique_key = ['block_date', 'evt_tx_hash', 'evt_index', 'label'], - incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.evt_block_time')] - ) -}} - -{{ - bpt_supply_changes_macro( - blockchain = blockchain, - version = '2' - ) -}} \ No newline at end of file diff --git a/models/_project/balancer/bpt/avalanche_c/balancer_v2_avalanche_c_bpt_supply_changes_daily.sql b/models/_project/balancer/bpt/avalanche_c/balancer_v2_avalanche_c_bpt_supply_changes_daily.sql deleted file mode 100644 index 5ce53b4aa92..00000000000 --- a/models/_project/balancer/bpt/avalanche_c/balancer_v2_avalanche_c_bpt_supply_changes_daily.sql +++ /dev/null @@ -1,17 +0,0 @@ -{% set blockchain = 'avalanche_c' %} - -{{ - config( - schema = 'balancer_v2_avalanche_c', - alias = 'bpt_supply_changes_daily', - materialized = 'table', - file_format = 'delta' - ) -}} - -{{ - bpt_supply_changes_daily_agg_macro( - blockchain = blockchain, - version = '2' - ) -}} \ No newline at end of file diff --git a/models/_project/balancer/bpt/balancer_bpt_supply_changes.sql b/models/_project/balancer/bpt/balancer_bpt_supply_changes.sql deleted file mode 100644 index e46a587b3b0..00000000000 --- a/models/_project/balancer/bpt/balancer_bpt_supply_changes.sql +++ /dev/null @@ -1,44 +0,0 @@ -{{ config( - schema = 'balancer', - alias = 'bpt_supply_changes', - post_hook='{{ expose_spells(blockchains = \'["arbitrum", "avalanche_c", "base", "ethereum", "gnosis", "optimism", "polygon", "zkevm"]\', - spell_type = "project", - spell_name = "balancer", - contributors = \'["viniabussafi"]\') }}' - ) -}} - -{% set balancer_models = [ - ref('balancer_v2_arbitrum_bpt_supply_changes'), - ref('balancer_v2_avalanche_c_bpt_supply_changes'), - ref('balancer_v2_base_bpt_supply_changes'), - ref('balancer_v2_ethereum_bpt_supply_changes'), - ref('balancer_v2_gnosis_bpt_supply_changes'), - ref('balancer_v2_optimism_bpt_supply_changes'), - ref('balancer_v2_polygon_bpt_supply_changes'), - ref('balancer_v2_zkevm_bpt_supply_changes') -] %} - -SELECT * -FROM ( - {% for model in balancer_models %} - SELECT - block_date - , evt_block_time - , evt_block_number - , blockchain - , evt_tx_hash - , evt_index - , pool_type - , pool_symbol - , version - , label - , token_address - , delta_amount_raw - , delta_amount - FROM {{ model }} - {% if not loop.last %} - UNION ALL - {% endif %} - {% endfor %} -) \ No newline at end of file diff --git a/models/_project/balancer/bpt/balancer_bpt_supply_changes_daily.sql b/models/_project/balancer/bpt/balancer_bpt_supply_changes_daily.sql deleted file mode 100644 index 5b593cef48a..00000000000 --- a/models/_project/balancer/bpt/balancer_bpt_supply_changes_daily.sql +++ /dev/null @@ -1,38 +0,0 @@ -{{ config( - schema = 'balancer', - alias = 'bpt_supply_changes_daily', - post_hook='{{ expose_spells(blockchains = \'["arbitrum", "avalanche_c", "base", "ethereum", "gnosis", "optimism", "polygon", "zkevm"]\', - spell_type = "project", - spell_name = "balancer", - contributors = \'["viniabussafi"]\') }}' - ) -}} - -{% set balancer_models = [ - ref('balancer_v2_arbitrum_bpt_supply_changes_daily'), - ref('balancer_v2_avalanche_c_bpt_supply_changes_daily'), - ref('balancer_v2_base_bpt_supply_changes_daily'), - ref('balancer_v2_ethereum_bpt_supply_changes_daily'), - ref('balancer_v2_gnosis_bpt_supply_changes_daily'), - ref('balancer_v2_optimism_bpt_supply_changes_daily'), - ref('balancer_v2_polygon_bpt_supply_changes_daily'), - ref('balancer_v2_zkevm_bpt_supply_changes_daily') -] %} - -SELECT * -FROM ( - {% for model in balancer_models %} - SELECT - block_date - , blockchain - , pool_type - , pool_symbol - , version - , token_address - , daily_delta - FROM {{ model }} - {% if not loop.last %} - UNION ALL - {% endif %} - {% endfor %} -) \ No newline at end of file diff --git a/models/_project/balancer/bpt/base/_schema.yml b/models/_project/balancer/bpt/base/_schema.yml deleted file mode 100644 index a32b805f7e2..00000000000 --- a/models/_project/balancer/bpt/base/_schema.yml +++ /dev/null @@ -1,178 +0,0 @@ -version: 2 - -models: - - name: balancer_v2_base_transfers_bpt - meta: - blockchain: base - project: balancer_v2 - contributors: victorstefenon, thetroyharris, viniabussafi - config: - tags: ['base', 'bpt', 'transfers'] - description: > - Balancer Pool Token (BPT) transfer logs on Balancer, an automated portfolio manager and trading platform, on base. - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - evt_tx_hash - - evt_index - - block_date - columns: - - &blockchain - name: blockchain - description: "Blockchain" - - &version - name: version - description: "Version of Balancer where the liquidity pool used in transaction is deployed" - - &contract_address - name: contract_address - description: 'base address for the liquidity pool used in transaction' - - &block_date - name: block_date - description: "UTC event block date of each DEX trade" - - &block_month - name: block_month - description: "UTC event block month of each DEX trade" - - &evt_tx_hash - name: evt_tx_hash - description: 'Transaction hash of transfer event' - - &evt_index - name: evt_index - description: 'Event index' - - &evt_block_time - name: evt_block_time - description: 'Block time of transfer event' - - &evt_block_number - name: evt_block_number - description: 'Block number of transfer event' - - &from - name: from - description: 'Address of BPT provider of transfer event' - - &to - name: to - description: 'Address of BPT receiver of transfer event' - - &value - name: value - description: 'Amount of BPT transferred in transfer event' - - - name: balancer_v2_base_bpt_prices - meta: - blockchain: base - project: balancer_v2 - contributors: victorstefenon, thetroyharris, viniabussafi - config: - tags: ['base', 'bpt', 'prices'] - description: > - Balancer Pool Token (BPT) daily price by pool on Balancer, an automated portfolio manager and trading platform. - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - blockchain - - day - - contract_address - columns: - - *blockchain - - &day - name: day - description: "Block date in UTC" - - *version - - &decimals - name: decimals - description: "Token decimals. 18, by default, on BPTs" - - *contract_address - - &bpt_price - name: bpt_price - description: "Price of the BPT" - - - name: balancer_v2_base_bpt_supply - meta: - blockchain: base - project: balancer_v2 - contributors: thetroyharris, viniabussafi - config: - tags: ['base', 'bpt', 'supply'] - description: > - Balancer Pool Token (BPT) supply by pool on Balancer, an automated portfolio manager and trading platform. - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - day - - blockchain - - token_address - columns: - - *day - - &pool_type - name: pool_type - description: "Pool attributes, determined by the pool's factory" - - *version - - *blockchain - - &token_address - name: token_address - description: "Contract address of the BPT" - - &supply - name: supply - description: "Supply of the BPT, discounted of premints" - - - name: balancer_v2_base_bpt_supply_changes - meta: - blockchain: base - project: balancer_v2 - contributors: viniabussafi - config: - tags: ['base', 'bpt', 'supply', 'changes'] - description: > - Balancer Pool Token (BPT) supply change events. - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - block_date - - evt_tx_hash - - evt_index - - label - columns: - - *block_date - - *evt_block_time - - *evt_block_number - - *blockchain - - *evt_tx_hash - - *evt_index - - *pool_type - - &pool_symbol - name: pool_symbol - description: "Token symbols, followed by their respective weights, if applicable" - - *version - - &label - name: label - description: "Nature of the transaction (Join/Exit via swap or Mint/Burn via transfer)" - - *token_address - - &delta_amount_raw - name: delta_amount_raw - description: "Raw value of the transaction on token supply at the time of execution in the original currency" - - &delta_amount - name: delta_amount - description: "Normalized value of the transaction on token supply at the time of execution in the original currency" - - - name: balancer_v2_base_bpt_supply_changes_daily - meta: - blockchain: base - project: balancer_v2 - contributors: viniabussafi - config: - tags: ['base', 'bpt', 'supply', 'changes'] - description: > - Balancer Pool Token (BPT) supply change events. grouped by day - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - block_date - - blockchain - - token_address - columns: - - *block_date - - *blockchain - - *pool_type - - *pool_symbol - - *version - - *token_address - - &daily_delta - name: daily_delta - description: "Daily total impact on BPT supply" \ No newline at end of file diff --git a/models/_project/balancer/bpt/base/balancer_v2_base_bpt_supply_changes.sql b/models/_project/balancer/bpt/base/balancer_v2_base_bpt_supply_changes.sql deleted file mode 100644 index 1d273f4e49e..00000000000 --- a/models/_project/balancer/bpt/base/balancer_v2_base_bpt_supply_changes.sql +++ /dev/null @@ -1,20 +0,0 @@ -{% set blockchain = 'base' %} - -{{ - config( - schema = 'balancer_v2_base', - alias = 'bpt_supply_changes', - materialized = 'incremental', - file_format = 'delta', - incremental_strategy = 'merge', - unique_key = ['block_date', 'evt_tx_hash', 'evt_index', 'label'], - incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.evt_block_time')] - ) -}} - -{{ - bpt_supply_changes_macro( - blockchain = blockchain, - version = '2' - ) -}} \ No newline at end of file diff --git a/models/_project/balancer/bpt/base/balancer_v2_base_bpt_supply_changes_daily.sql b/models/_project/balancer/bpt/base/balancer_v2_base_bpt_supply_changes_daily.sql deleted file mode 100644 index b90fdf94033..00000000000 --- a/models/_project/balancer/bpt/base/balancer_v2_base_bpt_supply_changes_daily.sql +++ /dev/null @@ -1,17 +0,0 @@ -{% set blockchain = 'base' %} - -{{ - config( - schema = 'balancer_v2_base', - alias = 'bpt_supply_changes_daily', - materialized = 'table', - file_format = 'delta' - ) -}} - -{{ - bpt_supply_changes_daily_agg_macro( - blockchain = blockchain, - version = '2' - ) -}} \ No newline at end of file diff --git a/models/_project/balancer/bpt/ethereum/_schema.yml b/models/_project/balancer/bpt/ethereum/_schema.yml deleted file mode 100644 index aa54846a5f3..00000000000 --- a/models/_project/balancer/bpt/ethereum/_schema.yml +++ /dev/null @@ -1,178 +0,0 @@ -version: 2 - -models: - - name: balancer_v2_ethereum_transfers_bpt - meta: - blockchain: ethereum - project: balancer_v2 - contributors: victorstefenon, thetroyharris, viniabussafi - config: - tags: ['ethereum', 'bpt', 'transfers'] - description: > - Balancer Pool Token (BPT) transfer logs on Balancer, an automated portfolio manager and trading platform, on ethereum. - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - evt_tx_hash - - evt_index - - block_date - columns: - - &blockchain - name: blockchain - description: "Blockchain" - - &version - name: version - description: "Version of Balancer where the liquidity pool used in transaction is deployed" - - &contract_address - name: contract_address - description: 'ethereum address for the liquidity pool used in transaction' - - &block_date - name: block_date - description: "UTC event block date of each DEX trade" - - &block_month - name: block_month - description: "UTC event block month of each DEX trade" - - &evt_tx_hash - name: evt_tx_hash - description: 'Transaction hash of transfer event' - - &evt_index - name: evt_index - description: 'Event index' - - &evt_block_time - name: evt_block_time - description: 'Block time of transfer event' - - &evt_block_number - name: evt_block_number - description: 'Block number of transfer event' - - &from - name: from - description: 'Address of BPT provider of transfer event' - - &to - name: to - description: 'Address of BPT receiver of transfer event' - - &value - name: value - description: 'Amount of BPT transferred in transfer event' - - - name: balancer_v2_ethereum_bpt_prices - meta: - blockchain: ethereum - project: balancer_v2 - contributors: victorstefenon, thetroyharris, viniabussafi - config: - tags: ['ethereum', 'bpt', 'prices'] - description: > - Balancer Pool Token (BPT) daily price by pool on Balancer, an automated portfolio manager and trading platform. - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - blockchain - - day - - contract_address - columns: - - *blockchain - - &day - name: day - description: "Block date in UTC" - - *version - - &decimals - name: decimals - description: "Token decimals. 18, by default, on BPTs" - - *contract_address - - &bpt_price - name: bpt_price - description: "Price of the BPT" - - - name: balancer_v2_ethereum_bpt_supply - meta: - blockchain: ethereum - project: balancer_v2 - contributors: thetroyharris, viniabussafi - config: - tags: ['ethereum', 'bpt', 'supply'] - description: > - Balancer Pool Token (BPT) supply by pool on Balancer, an automated portfolio manager and trading platform. - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - day - - blockchain - - token_address - columns: - - *day - - &pool_type - name: pool_type - description: "Pool attributes, determined by the pool's factory" - - *version - - *blockchain - - &token_address - name: token_address - description: "Contract address of the BPT" - - &supply - name: supply - description: "Supply of the BPT, discounted of premints" - - - name: balancer_v2_ethereum_bpt_supply_changes - meta: - blockchain: ethereum - project: balancer_v2 - contributors: viniabussafi - config: - tags: ['ethereum', 'bpt', 'supply', 'changes'] - description: > - Balancer Pool Token (BPT) supply change events. - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - block_date - - evt_tx_hash - - evt_index - - label - columns: - - *block_date - - *evt_block_time - - *evt_block_number - - *blockchain - - *evt_tx_hash - - *evt_index - - *pool_type - - &pool_symbol - name: pool_symbol - description: "Token symbols, followed by their respective weights, if applicable" - - *version - - &label - name: label - description: "Nature of the transaction (Join/Exit via swap or Mint/Burn via transfer)" - - *token_address - - &delta_amount_raw - name: delta_amount_raw - description: "Raw value of the transaction on token supply at the time of execution in the original currency" - - &delta_amount - name: delta_amount - description: "Normalized value of the transaction on token supply at the time of execution in the original currency" - - - name: balancer_v2_ethereum_bpt_supply_changes_daily - meta: - blockchain: ethereum - project: balancer_v2 - contributors: viniabussafi - config: - tags: ['ethereum', 'bpt', 'supply', 'changes'] - description: > - Balancer Pool Token (BPT) supply change events. grouped by day - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - block_date - - blockchain - - token_address - columns: - - *block_date - - *blockchain - - *pool_type - - *pool_symbol - - *version - - *token_address - - &daily_delta - name: daily_delta - description: "Daily total impact on BPT supply" \ No newline at end of file diff --git a/models/_project/balancer/bpt/ethereum/balancer_v2_ethereum_bpt_supply_changes.sql b/models/_project/balancer/bpt/ethereum/balancer_v2_ethereum_bpt_supply_changes.sql deleted file mode 100644 index 1fa7db6b904..00000000000 --- a/models/_project/balancer/bpt/ethereum/balancer_v2_ethereum_bpt_supply_changes.sql +++ /dev/null @@ -1,20 +0,0 @@ -{% set blockchain = 'ethereum' %} - -{{ - config( - schema = 'balancer_v2_ethereum', - alias = 'bpt_supply_changes', - materialized = 'incremental', - file_format = 'delta', - incremental_strategy = 'merge', - unique_key = ['block_date', 'evt_tx_hash', 'evt_index', 'label'], - incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.evt_block_time')] - ) -}} - -{{ - bpt_supply_changes_macro( - blockchain = blockchain, - version = '2' - ) -}} \ No newline at end of file diff --git a/models/_project/balancer/bpt/ethereum/balancer_v2_ethereum_bpt_supply_changes_daily.sql b/models/_project/balancer/bpt/ethereum/balancer_v2_ethereum_bpt_supply_changes_daily.sql deleted file mode 100644 index 74d3be91fdf..00000000000 --- a/models/_project/balancer/bpt/ethereum/balancer_v2_ethereum_bpt_supply_changes_daily.sql +++ /dev/null @@ -1,17 +0,0 @@ -{% set blockchain = 'arbitrum' %} - -{{ - config( - schema = 'balancer_v2_arbitrum', - alias = 'bpt_supply_changes_daily', - materialized = 'table', - file_format = 'delta' - ) -}} - -{{ - bpt_supply_changes_daily_agg_macro( - blockchain = blockchain, - version = '2' - ) -}} \ No newline at end of file diff --git a/models/_project/balancer/bpt/gnosis/_schema.yml b/models/_project/balancer/bpt/gnosis/_schema.yml deleted file mode 100644 index aae23d80a8a..00000000000 --- a/models/_project/balancer/bpt/gnosis/_schema.yml +++ /dev/null @@ -1,178 +0,0 @@ -version: 2 - -models: - - name: balancer_v2_gnosis_transfers_bpt - meta: - blockchain: gnosis - project: balancer_v2 - contributors: victorstefenon, thetroyharris, viniabussafi - config: - tags: ['gnosis', 'bpt', 'transfers'] - description: > - Balancer Pool Token (BPT) transfer logs on Balancer, an automated portfolio manager and trading platform, on gnosis. - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - evt_tx_hash - - evt_index - - block_date - columns: - - &blockchain - name: blockchain - description: "Blockchain" - - &version - name: version - description: "Version of Balancer where the liquidity pool used in transaction is deployed" - - &contract_address - name: contract_address - description: 'gnosis address for the liquidity pool used in transaction' - - &block_date - name: block_date - description: "UTC event block date of each DEX trade" - - &block_month - name: block_month - description: "UTC event block month of each DEX trade" - - &evt_tx_hash - name: evt_tx_hash - description: 'Transaction hash of transfer event' - - &evt_index - name: evt_index - description: 'Event index' - - &evt_block_time - name: evt_block_time - description: 'Block time of transfer event' - - &evt_block_number - name: evt_block_number - description: 'Block number of transfer event' - - &from - name: from - description: 'Address of BPT provider of transfer event' - - &to - name: to - description: 'Address of BPT receiver of transfer event' - - &value - name: value - description: 'Amount of BPT transferred in transfer event' - - - name: balancer_v2_gnosis_bpt_prices - meta: - blockchain: gnosis - project: balancer_v2 - contributors: victorstefenon, thetroyharris, viniabussafi - config: - tags: ['gnosis', 'bpt', 'prices'] - description: > - Balancer Pool Token (BPT) daily price by pool on Balancer, an automated portfolio manager and trading platform. - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - blockchain - - day - - contract_address - columns: - - *blockchain - - &day - name: day - description: "Block date in UTC" - - *version - - &decimals - name: decimals - description: "Token decimals. 18, by default, on BPTs" - - *contract_address - - &bpt_price - name: bpt_price - description: "Price of the BPT" - - - name: balancer_v2_gnosis_bpt_supply - meta: - blockchain: gnosis - project: balancer_v2 - contributors: thetroyharris, viniabussafi - config: - tags: ['gnosis', 'bpt', 'supply'] - description: > - Balancer Pool Token (BPT) supply by pool on Balancer, an automated portfolio manager and trading platform. - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - day - - blockchain - - token_address - columns: - - *day - - &pool_type - name: pool_type - description: "Pool attributes, determined by the pool's factory" - - *version - - *blockchain - - &token_address - name: token_address - description: "Contract address of the BPT" - - &supply - name: supply - description: "Supply of the BPT, discounted of premints" - - - name: balancer_v2_gnosis_bpt_supply_changes - meta: - blockchain: gnosis - project: balancer_v2 - contributors: viniabussafi - config: - tags: ['gnosis', 'bpt', 'supply', 'changes'] - description: > - Balancer Pool Token (BPT) supply change events. - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - block_date - - evt_tx_hash - - evt_index - - label - columns: - - *block_date - - *evt_block_time - - *evt_block_number - - *blockchain - - *evt_tx_hash - - *evt_index - - *pool_type - - &pool_symbol - name: pool_symbol - description: "Token symbols, followed by their respective weights, if applicable" - - *version - - &label - name: label - description: "Nature of the transaction (Join/Exit via swap or Mint/Burn via transfer)" - - *token_address - - &delta_amount_raw - name: delta_amount_raw - description: "Raw value of the transaction on token supply at the time of execution in the original currency" - - &delta_amount - name: delta_amount - description: "Normalized value of the transaction on token supply at the time of execution in the original currency" - - - name: balancer_v2_gnosis_bpt_supply_changes_daily - meta: - blockchain: gnosis - project: balancer_v2 - contributors: viniabussafi - config: - tags: ['gnosis', 'bpt', 'supply', 'changes'] - description: > - Balancer Pool Token (BPT) supply change events. grouped by day - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - block_date - - blockchain - - token_address - columns: - - *block_date - - *blockchain - - *pool_type - - *pool_symbol - - *version - - *token_address - - &daily_delta - name: daily_delta - description: "Daily total impact on BPT supply" \ No newline at end of file diff --git a/models/_project/balancer/bpt/gnosis/balancer_v2_gnosis_bpt_supply_changes.sql b/models/_project/balancer/bpt/gnosis/balancer_v2_gnosis_bpt_supply_changes.sql deleted file mode 100644 index fd1539a9495..00000000000 --- a/models/_project/balancer/bpt/gnosis/balancer_v2_gnosis_bpt_supply_changes.sql +++ /dev/null @@ -1,20 +0,0 @@ -{% set blockchain = 'gnosis' %} - -{{ - config( - schema = 'balancer_v2_gnosis', - alias = 'bpt_supply_changes', - materialized = 'incremental', - file_format = 'delta', - incremental_strategy = 'merge', - unique_key = ['block_date', 'evt_tx_hash', 'evt_index', 'label'], - incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.evt_block_time')] - ) -}} - -{{ - bpt_supply_changes_macro( - blockchain = blockchain, - version = '2' - ) -}} \ No newline at end of file diff --git a/models/_project/balancer/bpt/gnosis/balancer_v2_gnosis_bpt_supply_changes_daily.sql b/models/_project/balancer/bpt/gnosis/balancer_v2_gnosis_bpt_supply_changes_daily.sql deleted file mode 100644 index 516f2e2dc0c..00000000000 --- a/models/_project/balancer/bpt/gnosis/balancer_v2_gnosis_bpt_supply_changes_daily.sql +++ /dev/null @@ -1,17 +0,0 @@ -{% set blockchain = 'gnosis' %} - -{{ - config( - schema = 'balancer_v2_gnosis', - alias = 'bpt_supply_changes_daily', - materialized = 'table', - file_format = 'delta' - ) -}} - -{{ - bpt_supply_changes_daily_agg_macro( - blockchain = blockchain, - version = '2' - ) -}} \ No newline at end of file diff --git a/models/_project/balancer/bpt/optimism/_schema.yml b/models/_project/balancer/bpt/optimism/_schema.yml deleted file mode 100644 index 746fd32e9da..00000000000 --- a/models/_project/balancer/bpt/optimism/_schema.yml +++ /dev/null @@ -1,178 +0,0 @@ -version: 2 - -models: - - name: balancer_v2_optimism_transfers_bpt - meta: - blockchain: optimism - project: balancer_v2 - contributors: victorstefenon, thetroyharris, viniabussafi - config: - tags: ['optimism', 'bpt', 'transfers'] - description: > - Balancer Pool Token (BPT) transfer logs on Balancer, an automated portfolio manager and trading platform, on optimism. - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - evt_tx_hash - - evt_index - - block_date - columns: - - &blockchain - name: blockchain - description: "Blockchain" - - &version - name: version - description: "Version of Balancer where the liquidity pool used in transaction is deployed" - - &contract_address - name: contract_address - description: 'optimism address for the liquidity pool used in transaction' - - &block_date - name: block_date - description: "UTC event block date of each DEX trade" - - &block_month - name: block_month - description: "UTC event block month of each DEX trade" - - &evt_tx_hash - name: evt_tx_hash - description: 'Transaction hash of transfer event' - - &evt_index - name: evt_index - description: 'Event index' - - &evt_block_time - name: evt_block_time - description: 'Block time of transfer event' - - &evt_block_number - name: evt_block_number - description: 'Block number of transfer event' - - &from - name: from - description: 'Address of BPT provider of transfer event' - - &to - name: to - description: 'Address of BPT receiver of transfer event' - - &value - name: value - description: 'Amount of BPT transferred in transfer event' - - - name: balancer_v2_optimism_bpt_prices - meta: - blockchain: optimism - project: balancer_v2 - contributors: victorstefenon, thetroyharris, viniabussafi - config: - tags: ['optimism', 'bpt', 'prices'] - description: > - Balancer Pool Token (BPT) daily price by pool on Balancer, an automated portfolio manager and trading platform. - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - blockchain - - day - - contract_address - columns: - - *blockchain - - &day - name: day - description: "Block date in UTC" - - *version - - &decimals - name: decimals - description: "Token decimals. 18, by default, on BPTs" - - *contract_address - - &bpt_price - name: bpt_price - description: "Price of the BPT" - - - name: balancer_v2_optimism_bpt_supply - meta: - blockchain: optimism - project: balancer_v2 - contributors: thetroyharris, viniabussafi - config: - tags: ['optimism', 'bpt', 'supply'] - description: > - Balancer Pool Token (BPT) supply by pool on Balancer, an automated portfolio manager and trading platform. - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - day - - blockchain - - token_address - columns: - - *day - - &pool_type - name: pool_type - description: "Pool attributes, determined by the pool's factory" - - *version - - *blockchain - - &token_address - name: token_address - description: "Contract address of the BPT" - - &supply - name: supply - description: "Supply of the BPT, discounted of premints" - - - name: balancer_v2_optimism_bpt_supply_changes - meta: - blockchain: optimism - project: balancer_v2 - contributors: viniabussafi - config: - tags: ['optimism', 'bpt', 'supply', 'changes'] - description: > - Balancer Pool Token (BPT) supply change events. - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - block_date - - evt_tx_hash - - evt_index - - label - columns: - - *block_date - - *evt_block_time - - *evt_block_number - - *blockchain - - *evt_tx_hash - - *evt_index - - *pool_type - - &pool_symbol - name: pool_symbol - description: "Token symbols, followed by their respective weights, if applicable" - - *version - - &label - name: label - description: "Nature of the transaction (Join/Exit via swap or Mint/Burn via transfer)" - - *token_address - - &delta_amount_raw - name: delta_amount_raw - description: "Raw value of the transaction on token supply at the time of execution in the original currency" - - &delta_amount - name: delta_amount - description: "Normalized value of the transaction on token supply at the time of execution in the original currency" - - - name: balancer_v2_optimism_bpt_supply_changes_daily - meta: - blockchain: optimism - project: balancer_v2 - contributors: viniabussafi - config: - tags: ['optimism', 'bpt', 'supply', 'changes'] - description: > - Balancer Pool Token (BPT) supply change events. grouped by day - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - block_date - - blockchain - - token_address - columns: - - *block_date - - *blockchain - - *pool_type - - *pool_symbol - - *version - - *token_address - - &daily_delta - name: daily_delta - description: "Daily total impact on BPT supply" \ No newline at end of file diff --git a/models/_project/balancer/bpt/optimism/balancer_v2_optimism_bpt_supply_changes.sql b/models/_project/balancer/bpt/optimism/balancer_v2_optimism_bpt_supply_changes.sql deleted file mode 100644 index 225b00465db..00000000000 --- a/models/_project/balancer/bpt/optimism/balancer_v2_optimism_bpt_supply_changes.sql +++ /dev/null @@ -1,20 +0,0 @@ -{% set blockchain = 'optimism' %} - -{{ - config( - schema = 'balancer_v2_optimism', - alias = 'bpt_supply_changes', - materialized = 'incremental', - file_format = 'delta', - incremental_strategy = 'merge', - unique_key = ['block_date', 'evt_tx_hash', 'evt_index', 'label'], - incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.evt_block_time')] - ) -}} - -{{ - bpt_supply_changes_macro( - blockchain = blockchain, - version = '2' - ) -}} \ No newline at end of file diff --git a/models/_project/balancer/bpt/optimism/balancer_v2_optimism_bpt_supply_changes_daily.sql b/models/_project/balancer/bpt/optimism/balancer_v2_optimism_bpt_supply_changes_daily.sql deleted file mode 100644 index f816df8d206..00000000000 --- a/models/_project/balancer/bpt/optimism/balancer_v2_optimism_bpt_supply_changes_daily.sql +++ /dev/null @@ -1,17 +0,0 @@ -{% set blockchain = 'optimism' %} - -{{ - config( - schema = 'balancer_v2_optimism', - alias = 'bpt_supply_changes_daily', - materialized = 'table', - file_format = 'delta' - ) -}} - -{{ - bpt_supply_changes_daily_agg_macro( - blockchain = blockchain, - version = '2' - ) -}} \ No newline at end of file diff --git a/models/_project/balancer/bpt/polygon/_schema.yml b/models/_project/balancer/bpt/polygon/_schema.yml deleted file mode 100644 index 3e0b5c419f6..00000000000 --- a/models/_project/balancer/bpt/polygon/_schema.yml +++ /dev/null @@ -1,178 +0,0 @@ -version: 2 - -models: - - name: balancer_v2_polygon_transfers_bpt - meta: - blockchain: polygon - project: balancer_v2 - contributors: victorstefenon, thetroyharris, viniabussafi - config: - tags: ['polygon', 'bpt', 'transfers'] - description: > - Balancer Pool Token (BPT) transfer logs on Balancer, an automated portfolio manager and trading platform, on polygon. - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - evt_tx_hash - - evt_index - - block_date - columns: - - &blockchain - name: blockchain - description: "Blockchain" - - &version - name: version - description: "Version of Balancer where the liquidity pool used in transaction is deployed" - - &contract_address - name: contract_address - description: 'polygon address for the liquidity pool used in transaction' - - &block_date - name: block_date - description: "UTC event block date of each DEX trade" - - &block_month - name: block_month - description: "UTC event block month of each DEX trade" - - &evt_tx_hash - name: evt_tx_hash - description: 'Transaction hash of transfer event' - - &evt_index - name: evt_index - description: 'Event index' - - &evt_block_time - name: evt_block_time - description: 'Block time of transfer event' - - &evt_block_number - name: evt_block_number - description: 'Block number of transfer event' - - &from - name: from - description: 'Address of BPT provider of transfer event' - - &to - name: to - description: 'Address of BPT receiver of transfer event' - - &value - name: value - description: 'Amount of BPT transferred in transfer event' - - - name: balancer_v2_polygon_bpt_prices - meta: - blockchain: polygon - project: balancer_v2 - contributors: victorstefenon, thetroyharris, viniabussafi - config: - tags: ['polygon', 'bpt', 'prices'] - description: > - Balancer Pool Token (BPT) daily price by pool on Balancer, an automated portfolio manager and trading platform. - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - blockchain - - day - - contract_address - columns: - - *blockchain - - &day - name: day - description: "Block date in UTC" - - *version - - &decimals - name: decimals - description: "Token decimals. 18, by default, on BPTs" - - *contract_address - - &bpt_price - name: bpt_price - description: "Price of the BPT" - - - name: balancer_v2_polygon_bpt_supply - meta: - blockchain: polygon - project: balancer_v2 - contributors: thetroyharris, viniabussafi - config: - tags: ['polygon', 'bpt', 'supply'] - description: > - Balancer Pool Token (BPT) supply by pool on Balancer, an automated portfolio manager and trading platform. - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - day - - blockchain - - token_address - columns: - - *day - - &pool_type - name: pool_type - description: "Pool attributes, determined by the pool's factory" - - *version - - *blockchain - - &token_address - name: token_address - description: "Contract address of the BPT" - - &supply - name: supply - description: "Supply of the BPT, discounted of premints" - - - name: balancer_v2_polygon_bpt_supply_changes - meta: - blockchain: polygon - project: balancer_v2 - contributors: viniabussafi - config: - tags: ['polygon', 'bpt', 'supply', 'changes'] - description: > - Balancer Pool Token (BPT) supply change events. - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - block_date - - evt_tx_hash - - evt_index - - label - columns: - - *block_date - - *evt_block_time - - *evt_block_number - - *blockchain - - *evt_tx_hash - - *evt_index - - *pool_type - - &pool_symbol - name: pool_symbol - description: "Token symbols, followed by their respective weights, if applicable" - - *version - - &label - name: label - description: "Nature of the transaction (Join/Exit via swap or Mint/Burn via transfer)" - - *token_address - - &delta_amount_raw - name: delta_amount_raw - description: "Raw value of the transaction on token supply at the time of execution in the original currency" - - &delta_amount - name: delta_amount - description: "Normalized value of the transaction on token supply at the time of execution in the original currency" - - - name: balancer_v2_polygon_bpt_supply_changes_daily - meta: - blockchain: polygon - project: balancer_v2 - contributors: viniabussafi - config: - tags: ['polygon', 'bpt', 'supply', 'changes'] - description: > - Balancer Pool Token (BPT) supply change events. grouped by day - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - block_date - - blockchain - - token_address - columns: - - *block_date - - *blockchain - - *pool_type - - *pool_symbol - - *version - - *token_address - - &daily_delta - name: daily_delta - description: "Daily total impact on BPT supply" \ No newline at end of file diff --git a/models/_project/balancer/bpt/polygon/balancer_v2_polygon_bpt_supply_changes.sql b/models/_project/balancer/bpt/polygon/balancer_v2_polygon_bpt_supply_changes.sql deleted file mode 100644 index 7ff8034b96b..00000000000 --- a/models/_project/balancer/bpt/polygon/balancer_v2_polygon_bpt_supply_changes.sql +++ /dev/null @@ -1,20 +0,0 @@ -{% set blockchain = 'polygon' %} - -{{ - config( - schema = 'balancer_v2_polygon', - alias = 'bpt_supply_changes', - materialized = 'incremental', - file_format = 'delta', - incremental_strategy = 'merge', - unique_key = ['block_date', 'evt_tx_hash', 'evt_index', 'label'], - incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.evt_block_time')] - ) -}} - -{{ - bpt_supply_changes_macro( - blockchain = blockchain, - version = '2' - ) -}} \ No newline at end of file diff --git a/models/_project/balancer/bpt/polygon/balancer_v2_polygon_bpt_supply_changes_daily.sql b/models/_project/balancer/bpt/polygon/balancer_v2_polygon_bpt_supply_changes_daily.sql deleted file mode 100644 index 57615beb139..00000000000 --- a/models/_project/balancer/bpt/polygon/balancer_v2_polygon_bpt_supply_changes_daily.sql +++ /dev/null @@ -1,17 +0,0 @@ -{% set blockchain = 'polygon' %} - -{{ - config( - schema = 'balancer_v2_polygon', - alias = 'bpt_supply_changes_daily', - materialized = 'table', - file_format = 'delta' - ) -}} - -{{ - bpt_supply_changes_daily_agg_macro( - blockchain = blockchain, - version = '2' - ) -}} \ No newline at end of file diff --git a/models/_project/balancer/bpt/zkevm/_schema.yml b/models/_project/balancer/bpt/zkevm/_schema.yml deleted file mode 100644 index fbdd80ddb56..00000000000 --- a/models/_project/balancer/bpt/zkevm/_schema.yml +++ /dev/null @@ -1,178 +0,0 @@ -version: 2 - -models: - - name: balancer_v2_zkevm_transfers_bpt - meta: - blockchain: zkevm - project: balancer_v2 - contributors: victorstefenon, thetroyharris, viniabussafi - config: - tags: ['zkevm', 'bpt', 'transfers'] - description: > - Balancer Pool Token (BPT) transfer logs on Balancer, an automated portfolio manager and trading platform, on zkevm. - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - evt_tx_hash - - evt_index - - block_date - columns: - - &blockchain - name: blockchain - description: "Blockchain" - - &version - name: version - description: "Version of Balancer where the liquidity pool used in transaction is deployed" - - &contract_address - name: contract_address - description: 'zkevm address for the liquidity pool used in transaction' - - &block_date - name: block_date - description: "UTC event block date of each DEX trade" - - &block_month - name: block_month - description: "UTC event block month of each DEX trade" - - &evt_tx_hash - name: evt_tx_hash - description: 'Transaction hash of transfer event' - - &evt_index - name: evt_index - description: 'Event index' - - &evt_block_time - name: evt_block_time - description: 'Block time of transfer event' - - &evt_block_number - name: evt_block_number - description: 'Block number of transfer event' - - &from - name: from - description: 'Address of BPT provider of transfer event' - - &to - name: to - description: 'Address of BPT receiver of transfer event' - - &value - name: value - description: 'Amount of BPT transferred in transfer event' - - - name: balancer_v2_zkevm_bpt_prices - meta: - blockchain: zkevm - project: balancer_v2 - contributors: victorstefenon, thetroyharris, viniabussafi - config: - tags: ['zkevm', 'bpt', 'prices'] - description: > - Balancer Pool Token (BPT) daily price by pool on Balancer, an automated portfolio manager and trading platform. - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - blockchain - - day - - contract_address - columns: - - *blockchain - - &day - name: day - description: "Block date in UTC" - - *version - - &decimals - name: decimals - description: "Token decimals. 18, by default, on BPTs" - - *contract_address - - &bpt_price - name: bpt_price - description: "Price of the BPT" - - - name: balancer_v2_zkevm_bpt_supply - meta: - blockchain: zkevm - project: balancer_v2 - contributors: thetroyharris, viniabussafi - config: - tags: ['zkevm', 'bpt', 'supply'] - description: > - Balancer Pool Token (BPT) supply by pool on Balancer, an automated portfolio manager and trading platform. - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - day - - blockchain - - token_address - columns: - - *day - - &pool_type - name: pool_type - description: "Pool attributes, determined by the pool's factory" - - *version - - *blockchain - - &token_address - name: token_address - description: "Contract address of the BPT" - - &supply - name: supply - description: "Supply of the BPT, discounted of premints" - - - name: balancer_v2_zkevm_bpt_supply_changes - meta: - blockchain: zkevm - project: balancer_v2 - contributors: viniabussafi - config: - tags: ['zkevm', 'bpt', 'supply', 'changes'] - description: > - Balancer Pool Token (BPT) supply change events. - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - block_date - - evt_tx_hash - - evt_index - - label - columns: - - *block_date - - *evt_block_time - - *evt_block_number - - *blockchain - - *evt_tx_hash - - *evt_index - - *pool_type - - &pool_symbol - name: pool_symbol - description: "Token symbols, followed by their respective weights, if applicable" - - *version - - &label - name: label - description: "Nature of the transaction (Join/Exit via swap or Mint/Burn via transfer)" - - *token_address - - &delta_amount_raw - name: delta_amount_raw - description: "Raw value of the transaction on token supply at the time of execution in the original currency" - - &delta_amount - name: delta_amount - description: "Normalized value of the transaction on token supply at the time of execution in the original currency" - - - name: balancer_v2_zkevm_bpt_supply_changes_daily - meta: - blockchain: zkevm - project: balancer_v2 - contributors: viniabussafi - config: - tags: ['zkevm', 'bpt', 'supply', 'changes'] - description: > - Balancer Pool Token (BPT) supply change events. grouped by day - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - block_date - - blockchain - - token_address - columns: - - *block_date - - *blockchain - - *pool_type - - *pool_symbol - - *version - - *token_address - - &daily_delta - name: daily_delta - description: "Daily total impact on BPT supply" \ No newline at end of file diff --git a/models/_project/balancer/bpt/zkevm/balancer_v2_zkevm_bpt_supply_changes.sql b/models/_project/balancer/bpt/zkevm/balancer_v2_zkevm_bpt_supply_changes.sql deleted file mode 100644 index f11227e4013..00000000000 --- a/models/_project/balancer/bpt/zkevm/balancer_v2_zkevm_bpt_supply_changes.sql +++ /dev/null @@ -1,20 +0,0 @@ -{% set blockchain = 'zkevm' %} - -{{ - config( - schema = 'balancer_v2_zkevm', - alias = 'bpt_supply_changes', - materialized = 'incremental', - file_format = 'delta', - incremental_strategy = 'merge', - unique_key = ['block_date', 'evt_tx_hash', 'evt_index', 'label'], - incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.evt_block_time')] - ) -}} - -{{ - bpt_supply_changes_macro( - blockchain = blockchain, - version = '2' - ) -}} \ No newline at end of file diff --git a/models/_project/balancer/bpt/zkevm/balancer_v2_zkevm_bpt_supply_changes_daily.sql b/models/_project/balancer/bpt/zkevm/balancer_v2_zkevm_bpt_supply_changes_daily.sql deleted file mode 100644 index 4e548f4bcf7..00000000000 --- a/models/_project/balancer/bpt/zkevm/balancer_v2_zkevm_bpt_supply_changes_daily.sql +++ /dev/null @@ -1,17 +0,0 @@ -{% set blockchain = 'zkevm' %} - -{{ - config( - schema = 'balancer_v2_zkevm', - alias = 'bpt_supply_changes_daily', - materialized = 'table', - file_format = 'delta' - ) -}} - -{{ - bpt_supply_changes_daily_agg_macro( - blockchain = blockchain, - version = '2' - ) -}} \ No newline at end of file diff --git a/models/_project/balancer/flashloans/_schema.yml b/models/_project/balancer/flashloans/_schema.yml deleted file mode 100644 index 948574c1ad6..00000000000 --- a/models/_project/balancer/flashloans/_schema.yml +++ /dev/null @@ -1,35 +0,0 @@ -version: 2 - -models: - - name: balancer_flashloans - meta: - blockchain: arbitrum, avalanche_c, base, ethereum, gnosis, optimism, polygon, zkevm - sector: lending - contributors: hildobby, viniabussafi - config: - tags: ['ethereum', 'arbitrum', 'optimism', 'polygon', 'gnosis','avalanche_c', 'base', 'zkevm', 'flashloans'] - description: > - All Balancer flashloans - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - blockchain - - tx_hash - - evt_index - columns: - - name: blockchain - - name: project - - name: version - - name: block_time - - name: block_month - - name: block_number - - name: amount - - name: amount_usd - - name: tx_hash - - name: evt_index - - name: fee - - name: currency_contract - - name: currency_symbol - - name: recipient - - name: contract_address - \ No newline at end of file diff --git a/models/_project/balancer/flashloans/arbitrum/_schema.yml b/models/_project/balancer/flashloans/arbitrum/_schema.yml deleted file mode 100644 index 562e948bde1..00000000000 --- a/models/_project/balancer/flashloans/arbitrum/_schema.yml +++ /dev/null @@ -1,36 +0,0 @@ -version: 2 - -models: - - name: balancer_v2_arbitrum_flashloans - meta: - blockchain: arbitrum - sector: lending - contributors: hildobby, viniabussafi - config: - tags: ['arbitrum', 'flashloans'] - description: > - All Balancer v2 flashloans on Arbitrum - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - blockchain - - tx_hash - - evt_index - columns: - - name: blockchain - - name: project - - name: version - - name: block_time - - name: block_number - - name: amount - - name: amount_usd - - &tx_hash - name: tx_hash - description: "Tx. Hash" - - name: evt_index - - name: fee - - name: currency_contract - - name: currency_symbol - - name: recipient - - name: contract_address - - name: block_month \ No newline at end of file diff --git a/models/_project/balancer/flashloans/avalanche_c/_schema.yml b/models/_project/balancer/flashloans/avalanche_c/_schema.yml deleted file mode 100644 index 6a0a0a719f3..00000000000 --- a/models/_project/balancer/flashloans/avalanche_c/_schema.yml +++ /dev/null @@ -1,36 +0,0 @@ -version: 2 - -models: - - name: balancer_v2_avalanche_c_flashloans - meta: - blockchain: avalanche_c - sector: lending - contributors: hildobby, viniabussafi - config: - tags: ['avalanche_c', 'flashloans'] - description: > - All Balancer v2 flashloans on avalanche_c - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - blockchain - - tx_hash - - evt_index - columns: - - name: blockchain - - name: project - - name: version - - name: block_time - - name: block_number - - name: amount - - name: amount_usd - - &tx_hash - name: tx_hash - description: "Tx. Hash" - - name: evt_index - - name: fee - - name: currency_contract - - name: currency_symbol - - name: recipient - - name: contract_address - - name: block_month \ No newline at end of file diff --git a/models/_project/balancer/flashloans/base/_schema.yml b/models/_project/balancer/flashloans/base/_schema.yml deleted file mode 100644 index 3664ca0dbb5..00000000000 --- a/models/_project/balancer/flashloans/base/_schema.yml +++ /dev/null @@ -1,36 +0,0 @@ -version: 2 - -models: - - name: balancer_v2_base_flashloans - meta: - blockchain: base - sector: lending - contributors: hildobby, viniabussafi - config: - tags: ['base', 'flashloans'] - description: > - All Balancer v2 flashloans on base - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - blockchain - - tx_hash - - evt_index - columns: - - name: blockchain - - name: project - - name: version - - name: block_time - - name: block_number - - name: amount - - name: amount_usd - - &tx_hash - name: tx_hash - description: "Tx. Hash" - - name: evt_index - - name: fee - - name: currency_contract - - name: currency_symbol - - name: recipient - - name: contract_address - - name: block_month \ No newline at end of file diff --git a/models/_project/balancer/flashloans/ethereum/_schema.yml b/models/_project/balancer/flashloans/ethereum/_schema.yml deleted file mode 100644 index 48e15def9f8..00000000000 --- a/models/_project/balancer/flashloans/ethereum/_schema.yml +++ /dev/null @@ -1,36 +0,0 @@ -version: 2 - -models: - - name: balancer_v2_ethereum_flashloans - meta: - blockchain: ethereum - sector: lending - contributors: hildobby, viniabussafi - config: - tags: ['ethereum', 'flashloans'] - description: > - All Balancer v2 flashloans on ethereum - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - blockchain - - tx_hash - - evt_index - columns: - - name: blockchain - - name: project - - name: version - - name: block_time - - name: block_number - - name: amount - - name: amount_usd - - &tx_hash - name: tx_hash - description: "Tx. Hash" - - name: evt_index - - name: fee - - name: currency_contract - - name: currency_symbol - - name: recipient - - name: contract_address - - name: block_month \ No newline at end of file diff --git a/models/_project/balancer/flashloans/gnosis/_schema.yml b/models/_project/balancer/flashloans/gnosis/_schema.yml deleted file mode 100644 index a7db5e36011..00000000000 --- a/models/_project/balancer/flashloans/gnosis/_schema.yml +++ /dev/null @@ -1,36 +0,0 @@ -version: 2 - -models: - - name: balancer_v2_gnosis_flashloans - meta: - blockchain: gnosis - sector: lending - contributors: hildobby, viniabussafi - config: - tags: ['gnosis', 'flashloans'] - description: > - All Balancer v2 flashloans on gnosis - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - blockchain - - tx_hash - - evt_index - columns: - - name: blockchain - - name: project - - name: version - - name: block_time - - name: block_number - - name: amount - - name: amount_usd - - &tx_hash - name: tx_hash - description: "Tx. Hash" - - name: evt_index - - name: fee - - name: currency_contract - - name: currency_symbol - - name: recipient - - name: contract_address - - name: block_month \ No newline at end of file diff --git a/models/_project/balancer/flashloans/optimism/_schema.yml b/models/_project/balancer/flashloans/optimism/_schema.yml deleted file mode 100644 index 64a96dc514f..00000000000 --- a/models/_project/balancer/flashloans/optimism/_schema.yml +++ /dev/null @@ -1,36 +0,0 @@ -version: 2 - -models: - - name: balancer_v2_optimism_flashloans - meta: - blockchain: optimism - sector: lending - contributors: hildobby, viniabussafi - config: - tags: ['optimism', 'flashloans'] - description: > - All Balancer v2 flashloans on optimism - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - blockchain - - tx_hash - - evt_index - columns: - - name: blockchain - - name: project - - name: version - - name: block_time - - name: block_number - - name: amount - - name: amount_usd - - &tx_hash - name: tx_hash - description: "Tx. Hash" - - name: evt_index - - name: fee - - name: currency_contract - - name: currency_symbol - - name: recipient - - name: contract_address - - name: block_month \ No newline at end of file diff --git a/models/_project/balancer/flashloans/polygon/_schema.yml b/models/_project/balancer/flashloans/polygon/_schema.yml deleted file mode 100644 index 305a7252c6c..00000000000 --- a/models/_project/balancer/flashloans/polygon/_schema.yml +++ /dev/null @@ -1,36 +0,0 @@ -version: 2 - -models: - - name: balancer_v2_polygon_flashloans - meta: - blockchain: polygon - sector: lending - contributors: hildobby, viniabussafi - config: - tags: ['polygon', 'flashloans'] - description: > - All Balancer v2 flashloans on polygon - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - blockchain - - tx_hash - - evt_index - columns: - - name: blockchain - - name: project - - name: version - - name: block_time - - name: block_number - - name: amount - - name: amount_usd - - &tx_hash - name: tx_hash - description: "Tx. Hash" - - name: evt_index - - name: fee - - name: currency_contract - - name: currency_symbol - - name: recipient - - name: contract_address - - name: block_month \ No newline at end of file diff --git a/models/_project/balancer/flashloans/zkevm/_schema.yml b/models/_project/balancer/flashloans/zkevm/_schema.yml deleted file mode 100644 index feb6c20d41b..00000000000 --- a/models/_project/balancer/flashloans/zkevm/_schema.yml +++ /dev/null @@ -1,36 +0,0 @@ -version: 2 - -models: - - name: balancer_v2_zkevm_flashloans - meta: - blockchain: zkevm - sector: lending - contributors: hildobby, viniabussafi - config: - tags: ['zkevm', 'flashloans'] - description: > - All Balancer v2 flashloans on zkevm - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - blockchain - - tx_hash - - evt_index - columns: - - name: blockchain - - name: project - - name: version - - name: block_time - - name: block_number - - name: amount - - name: amount_usd - - &tx_hash - name: tx_hash - description: "Tx. Hash" - - name: evt_index - - name: fee - - name: currency_contract - - name: currency_symbol - - name: recipient - - name: contract_address - - name: block_month \ No newline at end of file diff --git a/models/_project/balancer/liquidity/_schema.yml b/models/_project/balancer/liquidity/_schema.yml deleted file mode 100644 index b014ad151e4..00000000000 --- a/models/_project/balancer/liquidity/_schema.yml +++ /dev/null @@ -1,60 +0,0 @@ -version: 2 - -models: - - name: balancer_liquidity - meta: - blockchain: arbitrum, avalanche_c, base, ethereum, gnosis, optimism, polygon, zkevm - project: balancer - contributors: viniabussafi - config: - tags: ['balancer', 'amm', 'dex', 'liquidity', 'ethereum', 'arbitrum', 'optimism', 'polygon', 'avalanche_c', 'base', 'zkevm'] - description: > - Liquidity by token on Balancer, an automated portfolio manager and trading platform. - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - day - - pool_id - - blockchain - - token_address - - token_symbol - columns: - - &day - name: day - description: "Block date in UTC" - - &pool_id - name: pool_id - description: "Unique encoded identifier that refers to each pool" - - &pool_address - name: pool_address - description: "Pool address" - - &pool_symbol - name: pool_symbol - description: "Token symbols, followed by their respective weights, if applicable" - - &version - name: version - description: "Version of the project" - - &blockchain - name: blockchain - description: "Blockchain" - - &pool_type - name: pool_type - description: "Pool attributes, determined by the pool's factory" - - &token_address - name: token_address - description: "Contract address of the token" - - &token_symbol - name: token_symbol - description: "Token symbol" - - name: token_balance_raw - description: 'Raw balance of the token in the pool in the original currency' - - name: token_balance - description: 'Scaled balance of the token in the pool in the original currency' - - name: protocol_liquidity_usd - description: 'Liquidity of the token in the pool in USD, except BPTs' - - name: protocol_liquidity_eth - description: 'Liquidity of the token in the pool in ETH, except BPTs' - - name: pool_liquidity_usd - description: 'Liquidity of the token in the pool in USD, including BPTs' - - name: pool_liquidity_eth - description: 'Liquidity of the token in the pool in ETH, including BPTs' \ No newline at end of file diff --git a/models/_project/balancer/liquidity/arbitrum/_schema.yml b/models/_project/balancer/liquidity/arbitrum/_schema.yml deleted file mode 100644 index ca88eb050b8..00000000000 --- a/models/_project/balancer/liquidity/arbitrum/_schema.yml +++ /dev/null @@ -1,58 +0,0 @@ -version: 2 - -models: - - name: balancer_v2_arbitrum_liquidity - meta: - blockchain: arbitrum - project: balancer_v2 - contributors: victorstefenon, viniabussafi, thetroyharris - config: - tags: ['arbitrum', 'balancer', 'pools', 'liquidity'] - description: > - Balancer v2 pools liquidity by token in Arbitrum. - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - day - - pool_id - - token_address - columns: - - &day - name: day - description: "Block date in UTC" - - &pool_id - name: pool_id - description: "Unique encoded identifier that refers to each pool" - - &pool_address - name: pool_address - description: "Pool address" - - &pool_symbol - name: pool_symbol - description: "Token symbols, followed by their respective weights, if applicable" - - &version - name: version - description: "Version of the project" - - &blockchain - name: blockchain - description: "Blockchain" - - &pool_type - name: pool_type - description: "Pool attributes, determined by the pool's factory" - - &token_address - name: token_address - description: "Contract address of the token" - - &token_symbol - name: token_symbol - description: "Token symbol" - - name: token_balance_raw - description: 'Raw balance of the token in the pool in the original currency' - - name: token_balance - description: 'Scaled balance of the token in the pool in the original currency' - - name: protocol_liquidity_usd - description: 'Liquidity of the token in the pool in USD, except BPTs' - - name: protocol_liquidity_eth - description: 'Liquidity of the token in the pool in ETH, except BPTs' - - name: pool_liquidity_usd - description: 'Liquidity of the token in the pool in USD, including BPTs' - - name: pool_liquidity_eth - description: 'Liquidity of the token in the pool in ETH, including BPTs' \ No newline at end of file diff --git a/models/_project/balancer/liquidity/avalanche_c/_schema.yml b/models/_project/balancer/liquidity/avalanche_c/_schema.yml deleted file mode 100644 index cd5e9580b08..00000000000 --- a/models/_project/balancer/liquidity/avalanche_c/_schema.yml +++ /dev/null @@ -1,58 +0,0 @@ -version: 2 - -models: - - name: balancer_v2_avalanche_c_liquidity - meta: - blockchain: avalanche_c - project: balancer_v2 - contributors: victorstefenon, viniabussafi, thetroyharris - config: - tags: ['avalanche_c', 'balancer', 'pools', 'liquidity'] - description: > - Balancer v2 pools liquidity by token in Arbitrum. - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - day - - pool_id - - token_address - columns: - - &day - name: day - description: "Block date in UTC" - - &pool_id - name: pool_id - description: "Unique encoded identifier that refers to each pool" - - &pool_address - name: pool_address - description: "Pool address" - - &pool_symbol - name: pool_symbol - description: "Token symbols, followed by their respective weights, if applicable" - - &version - name: version - description: "Version of the project" - - &blockchain - name: blockchain - description: "Blockchain" - - &pool_type - name: pool_type - description: "Pool attributes, determined by the pool's factory" - - &token_address - name: token_address - description: "Contract address of the token" - - &token_symbol - name: token_symbol - description: "Token symbol" - - name: token_balance_raw - description: 'Raw balance of the token in the pool in the original currency' - - name: token_balance - description: 'Scaled balance of the token in the pool in the original currency' - - name: protocol_liquidity_usd - description: 'Liquidity of the token in the pool in USD, except BPTs' - - name: protocol_liquidity_eth - description: 'Liquidity of the token in the pool in ETH, except BPTs' - - name: pool_liquidity_usd - description: 'Liquidity of the token in the pool in USD, including BPTs' - - name: pool_liquidity_eth - description: 'Liquidity of the token in the pool in ETH, including BPTs' \ No newline at end of file diff --git a/models/_project/balancer/liquidity/base/_schema.yml b/models/_project/balancer/liquidity/base/_schema.yml deleted file mode 100644 index d4b57b38164..00000000000 --- a/models/_project/balancer/liquidity/base/_schema.yml +++ /dev/null @@ -1,58 +0,0 @@ -version: 2 - -models: - - name: balancer_v2_base_liquidity - meta: - blockchain: base - project: balancer_v2 - contributors: victorstefenon, viniabussafi, thetroyharris - config: - tags: ['base', 'balancer', 'pools', 'liquidity'] - description: > - Balancer v2 pools liquidity by token in Arbitrum. - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - day - - pool_id - - token_address - columns: - - &day - name: day - description: "Block date in UTC" - - &pool_id - name: pool_id - description: "Unique encoded identifier that refers to each pool" - - &pool_address - name: pool_address - description: "Pool address" - - &pool_symbol - name: pool_symbol - description: "Token symbols, followed by their respective weights, if applicable" - - &version - name: version - description: "Version of the project" - - &blockchain - name: blockchain - description: "Blockchain" - - &pool_type - name: pool_type - description: "Pool attributes, determined by the pool's factory" - - &token_address - name: token_address - description: "Contract address of the token" - - &token_symbol - name: token_symbol - description: "Token symbol" - - name: token_balance_raw - description: 'Raw balance of the token in the pool in the original currency' - - name: token_balance - description: 'Scaled balance of the token in the pool in the original currency' - - name: protocol_liquidity_usd - description: 'Liquidity of the token in the pool in USD, except BPTs' - - name: protocol_liquidity_eth - description: 'Liquidity of the token in the pool in ETH, except BPTs' - - name: pool_liquidity_usd - description: 'Liquidity of the token in the pool in USD, including BPTs' - - name: pool_liquidity_eth - description: 'Liquidity of the token in the pool in ETH, including BPTs' \ No newline at end of file diff --git a/models/_project/balancer/liquidity/ethereum/_schema.yml b/models/_project/balancer/liquidity/ethereum/_schema.yml deleted file mode 100644 index 42866a2e449..00000000000 --- a/models/_project/balancer/liquidity/ethereum/_schema.yml +++ /dev/null @@ -1,96 +0,0 @@ -version: 2 - -models: - - name: balancer_v2_ethereum_liquidity - meta: - blockchain: ethereum - project: balancer_v2 - contributors: victorstefenon, viniabussafi, thetroyharris - config: - tags: ['ethereum', 'balancer', 'pools', 'liquidity'] - description: > - Balancer v2 pools liquidity by token in Ethereum. - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - day - - pool_id - - token_address - columns: - - &day - name: day - description: "Block date in UTC" - - &pool_id - name: pool_id - description: "Unique encoded identifier that refers to each pool" - - &pool_address - name: pool_address - description: "Pool address" - - &pool_symbol - name: pool_symbol - description: "Token symbols, followed by their respective weights, if applicable" - - &version - name: version - description: "Version of the project" - - &blockchain - name: blockchain - description: "Blockchain" - - &pool_type - name: pool_type - description: "Pool attributes, determined by the pool's factory" - - &token_address - name: token_address - description: "Contract address of the token" - - &token_symbol - name: token_symbol - description: "Token symbol" - - &token_balance_raw - name: token_balance_raw - description: 'Raw balance of the token in the pool in the original currency' - - &token_balance - name: token_balance - description: 'Scaled balance of the token in the pool in the original currency' - - &protocol_liquidity_usd - name: protocol_liquidity_usd - description: 'Liquidity of the token in the pool in USD, except BPTs' - - &protocol_liquidity_eth - name: protocol_liquidity_eth - description: 'Liquidity of the token in the pool in ETH, except BPTs' - - &pool_liquidity_usd - name: pool_liquidity_usd - description: 'Liquidity of the token in the pool in USD, including BPTs' - - &pool_liquidity_eth - name: pool_liquidity_eth - description: 'Liquidity of the token in the pool in ETH, including BPTs' - - - name: balancer_v1_ethereum_liquidity - meta: - blockchain: ethereum - project: balancer_v1 - contributors: markusbkoch, mendesfabio, victorstefenon, viniabussafi, thetroyharris - config: - tags: ['ethereum', 'balancer', 'pools', 'liquidity'] - description: > - Balancer v1 pools liquidity by token in Ethereum. - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - day - - pool_id - - token_address - columns: - - *day - - *pool_id - - *pool_address - - *pool_symbol - - *version - - *blockchain - - *pool_type - - *token_address - - *token_symbol - - *token_balance_raw - - *token_balance - - *protocol_liquidity_usd - - *protocol_liquidity_eth - - *pool_liquidity_usd - - *pool_liquidity_eth \ No newline at end of file diff --git a/models/_project/balancer/liquidity/gnosis/_schema.yml b/models/_project/balancer/liquidity/gnosis/_schema.yml deleted file mode 100644 index d21460430ab..00000000000 --- a/models/_project/balancer/liquidity/gnosis/_schema.yml +++ /dev/null @@ -1,58 +0,0 @@ -version: 2 - -models: - - name: balancer_v2_gnosis_liquidity - meta: - blockchain: gnosis - project: balancer_v2 - contributors: victorstefenon, viniabussafi, thetroyharris - config: - tags: ['gnosis', 'balancer', 'pools', 'liquidity'] - description: > - Balancer v2 pools liquidity by token in Arbitrum. - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - day - - pool_id - - token_address - columns: - - &day - name: day - description: "Block date in UTC" - - &pool_id - name: pool_id - description: "Unique encoded identifier that refers to each pool" - - &pool_address - name: pool_address - description: "Pool address" - - &pool_symbol - name: pool_symbol - description: "Token symbols, followed by their respective weights, if applicable" - - &version - name: version - description: "Version of the project" - - &blockchain - name: blockchain - description: "Blockchain" - - &pool_type - name: pool_type - description: "Pool attributes, determined by the pool's factory" - - &token_address - name: token_address - description: "Contract address of the token" - - &token_symbol - name: token_symbol - description: "Token symbol" - - name: token_balance_raw - description: 'Raw balance of the token in the pool in the original currency' - - name: token_balance - description: 'Scaled balance of the token in the pool in the original currency' - - name: protocol_liquidity_usd - description: 'Liquidity of the token in the pool in USD, except BPTs' - - name: protocol_liquidity_eth - description: 'Liquidity of the token in the pool in ETH, except BPTs' - - name: pool_liquidity_usd - description: 'Liquidity of the token in the pool in USD, including BPTs' - - name: pool_liquidity_eth - description: 'Liquidity of the token in the pool in ETH, including BPTs' \ No newline at end of file diff --git a/models/_project/balancer/liquidity/optimism/_schema.yml b/models/_project/balancer/liquidity/optimism/_schema.yml deleted file mode 100644 index d41d2cb3e49..00000000000 --- a/models/_project/balancer/liquidity/optimism/_schema.yml +++ /dev/null @@ -1,58 +0,0 @@ -version: 2 - -models: - - name: balancer_v2_optimism_liquidity - meta: - blockchain: optimism - project: balancer_v2 - contributors: victorstefenon, viniabussafi, thetroyharris - config: - tags: ['optimism', 'balancer', 'pools', 'liquidity'] - description: > - Balancer v2 pools liquidity by token in Arbitrum. - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - day - - pool_id - - token_address - columns: - - &day - name: day - description: "Block date in UTC" - - &pool_id - name: pool_id - description: "Unique encoded identifier that refers to each pool" - - &pool_address - name: pool_address - description: "Pool address" - - &pool_symbol - name: pool_symbol - description: "Token symbols, followed by their respective weights, if applicable" - - &version - name: version - description: "Version of the project" - - &blockchain - name: blockchain - description: "Blockchain" - - &pool_type - name: pool_type - description: "Pool attributes, determined by the pool's factory" - - &token_address - name: token_address - description: "Contract address of the token" - - &token_symbol - name: token_symbol - description: "Token symbol" - - name: token_balance_raw - description: 'Raw balance of the token in the pool in the original currency' - - name: token_balance - description: 'Scaled balance of the token in the pool in the original currency' - - name: protocol_liquidity_usd - description: 'Liquidity of the token in the pool in USD, except BPTs' - - name: protocol_liquidity_eth - description: 'Liquidity of the token in the pool in ETH, except BPTs' - - name: pool_liquidity_usd - description: 'Liquidity of the token in the pool in USD, including BPTs' - - name: pool_liquidity_eth - description: 'Liquidity of the token in the pool in ETH, including BPTs' \ No newline at end of file diff --git a/models/_project/balancer/liquidity/polygon/_schema.yml b/models/_project/balancer/liquidity/polygon/_schema.yml deleted file mode 100644 index 5054f2a9740..00000000000 --- a/models/_project/balancer/liquidity/polygon/_schema.yml +++ /dev/null @@ -1,58 +0,0 @@ -version: 2 - -models: - - name: balancer_v2_polygon_liquidity - meta: - blockchain: polygon - project: balancer_v2 - contributors: victorstefenon, viniabussafi, thetroyharris - config: - tags: ['polygon', 'balancer', 'pools', 'liquidity'] - description: > - Balancer v2 pools liquidity by token in Arbitrum. - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - day - - pool_id - - token_address - columns: - - &day - name: day - description: "Block date in UTC" - - &pool_id - name: pool_id - description: "Unique encoded identifier that refers to each pool" - - &pool_address - name: pool_address - description: "Pool address" - - &pool_symbol - name: pool_symbol - description: "Token symbols, followed by their respective weights, if applicable" - - &version - name: version - description: "Version of the project" - - &blockchain - name: blockchain - description: "Blockchain" - - &pool_type - name: pool_type - description: "Pool attributes, determined by the pool's factory" - - &token_address - name: token_address - description: "Contract address of the token" - - &token_symbol - name: token_symbol - description: "Token symbol" - - name: token_balance_raw - description: 'Raw balance of the token in the pool in the original currency' - - name: token_balance - description: 'Scaled balance of the token in the pool in the original currency' - - name: protocol_liquidity_usd - description: 'Liquidity of the token in the pool in USD, except BPTs' - - name: protocol_liquidity_eth - description: 'Liquidity of the token in the pool in ETH, except BPTs' - - name: pool_liquidity_usd - description: 'Liquidity of the token in the pool in USD, including BPTs' - - name: pool_liquidity_eth - description: 'Liquidity of the token in the pool in ETH, including BPTs' \ No newline at end of file diff --git a/models/_project/balancer/liquidity/zkevm/_schema.yml b/models/_project/balancer/liquidity/zkevm/_schema.yml deleted file mode 100644 index 67f36eb3b21..00000000000 --- a/models/_project/balancer/liquidity/zkevm/_schema.yml +++ /dev/null @@ -1,58 +0,0 @@ -version: 2 - -models: - - name: balancer_v2_zkevm_liquidity - meta: - blockchain: zkevm - project: balancer_v2 - contributors: victorstefenon, viniabussafi, thetroyharris - config: - tags: ['zkevm', 'balancer', 'pools', 'liquidity'] - description: > - Balancer v2 pools liquidity by token in Arbitrum. - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - day - - pool_id - - token_address - columns: - - &day - name: day - description: "Block date in UTC" - - &pool_id - name: pool_id - description: "Unique encoded identifier that refers to each pool" - - &pool_address - name: pool_address - description: "Pool address" - - &pool_symbol - name: pool_symbol - description: "Token symbols, followed by their respective weights, if applicable" - - &version - name: version - description: "Version of the project" - - &blockchain - name: blockchain - description: "Blockchain" - - &pool_type - name: pool_type - description: "Pool attributes, determined by the pool's factory" - - &token_address - name: token_address - description: "Contract address of the token" - - &token_symbol - name: token_symbol - description: "Token symbol" - - name: token_balance_raw - description: 'Raw balance of the token in the pool in the original currency' - - name: token_balance - description: 'Scaled balance of the token in the pool in the original currency' - - name: protocol_liquidity_usd - description: 'Liquidity of the token in the pool in USD, except BPTs' - - name: protocol_liquidity_eth - description: 'Liquidity of the token in the pool in ETH, except BPTs' - - name: pool_liquidity_usd - description: 'Liquidity of the token in the pool in USD, including BPTs' - - name: pool_liquidity_eth - description: 'Liquidity of the token in the pool in ETH, including BPTs' \ No newline at end of file diff --git a/models/_project/balancer/pools/_schema.yml b/models/_project/balancer/pools/_schema.yml deleted file mode 100644 index 65c86555a7c..00000000000 --- a/models/_project/balancer/pools/_schema.yml +++ /dev/null @@ -1,173 +0,0 @@ -version: 2 - -models: - - name: balancer_pools_fees - meta: - blockchain: arbitrum, avalanche_c, base, ethereum, gnosis, optimism, polygon, zkevm - contributors: jacektrocinski, thetroyharris, viniabussafi - config: - tags: ['arbitrum', 'avalanche_c', 'base', 'ethereum', 'gnosis', 'optimism', 'polygon', 'zkevm', 'pools', 'fees'] - description: > - Balancer v2 swap fees stored at the pool level. - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - blockchain - - block_number - - tx_hash - - index - columns: - - &blockchain - name: blockchain - description: "Blockchain" - - &version - name: version - description: "Version of Balancer where the liquidity pool used in transaction is deployed" - - &contract_address - name: contract_address - description: 'zkevm address for the liquidity pool used in transaction' - tests: - - not_null - - &tx_hash - name: tx_hash - description: 'Transaction hash' - tests: - - not_null - - &index - name: index - description: 'Event Index' - tests: - - not_null - - &tx_index - name: tx_index - description: 'Transaction Index' - tests: - - not_null - - &block_time - name: block_time - description: 'Block time in UTC' - tests: - - not_null - - &block_number - name: block_number - description: 'Event Block Number' - tests: - - not_null - - &swap_fee_percentage - name: swap_fee_percentage - description: 'Swap fees for the pool, values are returned with 18 decimals (1e18 meaning 100%)' - tests: - - not_null - - - name: balancer_pools_tokens_weights - meta: - blockchain: arbitrum, avalanche_c, base, ethereum, gnosis, optimism, polygon, 'zkevm' - contributors: jacektrocinski, viniabussafi - config: - tags: ['arbitrum', 'avalanche_c', 'base', 'ethereum', 'gnosis', 'optimism', 'polygon', 'zkevm', 'bpt', 'transfers'] - description: > - Token weights in Balancer pools. - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - blockchain - - pool_id - - token_address - columns: - - *blockchain - - *version - - &pool_id - name: pool_id - description: 'Unique encoded identifier that refers to each pool' - tests: - - not_null - - &token_address - name: token_address - description: 'Contract address for the token' - - &normalized_weight - name: normalized_weight - description: 'Weight of the token in the pool.' - - - - name: balancer_pools_metrics_daily - meta: - blockchain: arbitrum, avalanche_c, base, ethereum, gnosis, optimism, polygon, zkevm - contributors: viniabussafi, metacrypto - config: - tags: ['arbitrum', 'avalanche_c', 'base', 'ethereum', 'gnosis', 'optimism', 'polygon', 'zkevm', 'balancer', 'pool', 'stats', 'volume', 'tvl', 'fee'] - description: > - This spell aggregates data from the trades, liquidity and protocol fees spells, by day and pool, while also displaying some basic information about the pool - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - block_date - - blockchain - - project - - version - - project_contract_address - columns: - - *blockchain - - &project - name: project - description: "Project name (balancer)" - - *version - - &block_date - name: block_date - description: "Block date in UTC" - - &project_contract_address - name: project_contract_address - description: "Pool address" - - &pool_symbol - name: pool_symbol - description: "Token symbols, followed by their respective weights, if applicable" - - &pool_type - name: pool_type - description: "Pool attributes, determined by the pool's factory" - - &swap_amount_usd - name: swap_amount_usd - description: "Daily swap volume on a pool, in USD" - - &tvl_usd - name: tvl_usd - description: "Total Value Locked on a pool, in USD" - - &tvl_eth - name: tvl_eth - description: "Total Value Locked on a pool, in eth" - - &fee_amount_usd - name: fee_amount_usd - description: "Daily fees collected on a pool, in USD" - - - name: balancer_gauge_mappings - meta: - blockchain: optimism - sector: dex - contributors: msilb7 - config: - tags: ['balancer', 'amm', 'trades', 'dex', 'incentives'] - description: > - Gauge to Pool mappings for balancer on all chains - columns: - - *blockchain - - *version - - &pool_contract - name: pool_contract - description: "Address of the liquidity pool contract" - - *pool_id - - &incentives_contract - name: incentives_contract - description: "Address of the contract where incentives are stored and emitted." - - &incentives_type - name: incentives_type - description: "Description of the incentives address type." - - &evt_block_time - name: evt_block_time - description: "Block time in UTC" - - &evt_block_number - name: evt_block_number - description: 'Event Block Number' - - *contract_address - - &evt_tx_hash - name: evt_tx_hash - description: 'Transaction hash' - - &evt_index - name: evT_index - description: 'Event Index' \ No newline at end of file diff --git a/models/_project/balancer/pools/arbitrum/_schema.yml b/models/_project/balancer/pools/arbitrum/_schema.yml deleted file mode 100644 index fd04cb90077..00000000000 --- a/models/_project/balancer/pools/arbitrum/_schema.yml +++ /dev/null @@ -1,105 +0,0 @@ -version: 2 - -models: - - name: balancer_v2_arbitrum_pools_fees - meta: - blockchain: arbitrum - project: balancer_v2 - contributors: jacektrocinski, thetroyharris, viniabussafi - config: - tags: ['arbitrum', 'balancer', 'pools_fees'] - description: > - Balancer v2 swap fees stored at the pool level. - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - block_number - - tx_hash - - index - columns: - - &blockchain - name: blockchain - description: "Blockchain" - - &version - name: version - description: "Version of Balancer where the liquidity pool used in transaction is deployed" - - &contract_address - name: contract_address - description: 'Arbitrum address for the liquidity pool used in transaction' - tests: - - not_null - - &tx_hash - name: tx_hash - description: 'Transaction hash' - tests: - - not_null - - &index - name: index - description: 'Event Index' - tests: - - not_null - - &tx_index - name: tx_index - description: 'Transaction Index' - tests: - - not_null - - &block_time - name: block_time - description: 'Block time in UTC' - tests: - - not_null - - &block_number - name: block_number - description: 'Event Block Number' - tests: - - not_null - - &swap_fee_percentage - name: swap_fee_percentage - description: 'Swap fees for the pool, values are returned with 18 decimals (1e18 meaning 100%)' - tests: - - not_null - - - name: balancer_arbitrum_pools_tokens_weights - meta: - blockchain: arbitrum - project: balancer - contributors: jacektrocinski, viniabussafi - config: - tags: ['arbitrum', 'balancer', 'pools', 'tokens', 'weights'] - description: > - Token weights in Balancer pools. - columns: - - *blockchain - - *version - - &pool_id - name: pool_id - description: 'Unique encoded identifier that refers to each pool' - tests: - - not_null - - &token_address - name: token_address - description: 'Contract address for the token' - - &normalized_weight - name: normalized_weight - description: 'Weight of the token in the pool.' - - - name: balancer_v2_arbitrum_pools_tokens_weights - meta: - blockchain: arbitrum - project: balancer - contributors: jacektrocinski, viniabussafi - config: - tags: ['arbitrum', 'balancer', 'pools', 'tokens', 'weights'] - description: > - Token weights in Balancer v2 pools. - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - pool_id - - token_address - columns: - - *blockchain - - *version - - *pool_id - - *token_address - - *normalized_weight \ No newline at end of file diff --git a/models/_project/balancer/pools/avalanche_c/_schema.yml b/models/_project/balancer/pools/avalanche_c/_schema.yml deleted file mode 100644 index 2c5082a751c..00000000000 --- a/models/_project/balancer/pools/avalanche_c/_schema.yml +++ /dev/null @@ -1,105 +0,0 @@ -version: 2 - -models: - - name: balancer_v2_avalanche_c_pools_fees - meta: - blockchain: avalanche_c - project: balancer_v2 - contributors: jacektrocinski, thetroyharris, viniabussafi - config: - tags: ['avalanche_c', 'balancer', 'pools_fees'] - description: > - Balancer v2 swap fees stored at the pool level. - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - block_number - - tx_hash - - index - columns: - - &blockchain - name: blockchain - description: "Blockchain" - - &version - name: version - description: "Version of Balancer where the liquidity pool used in transaction is deployed" - - &contract_address - name: contract_address - description: 'avalanche_c address for the liquidity pool used in transaction' - tests: - - not_null - - &tx_hash - name: tx_hash - description: 'Transaction hash' - tests: - - not_null - - &index - name: index - description: 'Event Index' - tests: - - not_null - - &tx_index - name: tx_index - description: 'Transaction Index' - tests: - - not_null - - &block_time - name: block_time - description: 'Block time in UTC' - tests: - - not_null - - &block_number - name: block_number - description: 'Event Block Number' - tests: - - not_null - - &swap_fee_percentage - name: swap_fee_percentage - description: 'Swap fees for the pool, values are returned with 18 decimals (1e18 meaning 100%)' - tests: - - not_null - - - name: balancer_avalanche_c_pools_tokens_weights - meta: - blockchain: avalanche_c - project: balancer - contributors: jacektrocinski, viniabussafi - config: - tags: ['avalanche_c', 'balancer', 'pools', 'tokens', 'weights'] - description: > - Token weights in Balancer pools. - columns: - - *blockchain - - *version - - &pool_id - name: pool_id - description: 'Unique encoded identifier that refers to each pool' - tests: - - not_null - - &token_address - name: token_address - description: 'Contract address for the token' - - &normalized_weight - name: normalized_weight - description: 'Weight of the token in the pool.' - - - name: balancer_v2_avalanche_c_pools_tokens_weights - meta: - blockchain: avalanche_c - project: balancer - contributors: jacektrocinski, viniabussafi - config: - tags: ['avalanche_c', 'balancer', 'pools', 'tokens', 'weights'] - description: > - Token weights in Balancer v2 pools. - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - pool_id - - token_address - columns: - - *blockchain - - *version - - *pool_id - - *token_address - - *normalized_weight \ No newline at end of file diff --git a/models/_project/balancer/pools/base/_schema.yml b/models/_project/balancer/pools/base/_schema.yml deleted file mode 100644 index 0949d82f17c..00000000000 --- a/models/_project/balancer/pools/base/_schema.yml +++ /dev/null @@ -1,105 +0,0 @@ -version: 2 - -models: - - name: balancer_v2_base_pools_fees - meta: - blockchain: base - project: balancer_v2 - contributors: jacektrocinski, thetroyharris, viniabussafi - config: - tags: ['base', 'balancer', 'pools_fees'] - description: > - Balancer v2 swap fees stored at the pool level. - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - block_number - - tx_hash - - index - columns: - - &blockchain - name: blockchain - description: "Blockchain" - - &version - name: version - description: "Version of Balancer where the liquidity pool used in transaction is deployed" - - &contract_address - name: contract_address - description: 'base address for the liquidity pool used in transaction' - tests: - - not_null - - &tx_hash - name: tx_hash - description: 'Transaction hash' - tests: - - not_null - - &index - name: index - description: 'Event Index' - tests: - - not_null - - &tx_index - name: tx_index - description: 'Transaction Index' - tests: - - not_null - - &block_time - name: block_time - description: 'Block time in UTC' - tests: - - not_null - - &block_number - name: block_number - description: 'Event Block Number' - tests: - - not_null - - &swap_fee_percentage - name: swap_fee_percentage - description: 'Swap fees for the pool, values are returned with 18 decimals (1e18 meaning 100%)' - tests: - - not_null - - - name: balancer_base_pools_tokens_weights - meta: - blockchain: base - project: balancer - contributors: jacektrocinski, viniabussafi - config: - tags: ['base', 'balancer', 'pools', 'tokens', 'weights'] - description: > - Token weights in Balancer pools. - columns: - - *blockchain - - *version - - &pool_id - name: pool_id - description: 'Unique encoded identifier that refers to each pool' - tests: - - not_null - - &token_address - name: token_address - description: 'Contract address for the token' - - &normalized_weight - name: normalized_weight - description: 'Weight of the token in the pool.' - - - name: balancer_v2_base_pools_tokens_weights - meta: - blockchain: base - project: balancer - contributors: jacektrocinski, viniabussafi - config: - tags: ['base', 'balancer', 'pools', 'tokens', 'weights'] - description: > - Token weights in Balancer v2 pools. - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - pool_id - - token_address - columns: - - *blockchain - - *version - - *pool_id - - *token_address - - *normalized_weight \ No newline at end of file diff --git a/models/_project/balancer/pools/ethereum/_schema.yml b/models/_project/balancer/pools/ethereum/_schema.yml deleted file mode 100644 index ea4a24ef8c8..00000000000 --- a/models/_project/balancer/pools/ethereum/_schema.yml +++ /dev/null @@ -1,149 +0,0 @@ -version: 2 - -models: - - name: balancer_v2_ethereum_pools_fees - meta: - blockchain: ethereum - project: balancer_v2 - contributors: jacektrocinski, thetroyharris, viniabussafi - config: - tags: ['ethereum', 'balancer', 'pools', 'fees'] - description: > - Balancer v2 swap fees stored at the pool level. - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - block_number - - tx_hash - - index - columns: - - &blockchain - name: blockchain - description: "Blockchain" - - &version - name: version - description: "Version of Balancer where the liquidity pool used in transaction is deployed" - - &contract_address - name: contract_address - description: 'zkevm address for the liquidity pool used in transaction' - tests: - - not_null - - &tx_hash - name: tx_hash - description: 'Transaction hash' - tests: - - not_null - - &index - name: index - description: 'Event Index' - tests: - - not_null - - &tx_index - name: tx_index - description: 'Transaction Index' - tests: - - not_null - - &block_time - name: block_time - description: 'Block time in UTC' - tests: - - not_null - - &block_number - name: block_number - description: 'Event Block Number' - tests: - - not_null - - &swap_fee_percentage - name: swap_fee_percentage - description: 'Swap fees for the pool, values are returned with 18 decimals (1e18 meaning 100%)' - tests: - - not_null - - - name: balancer_ethereum_pools_tokens_weights - meta: - blockchain: ethereum - project: balancer - contributors: jacektrocinski, viniabussafi - config: - tags: ['ethereum', 'balancer', 'pools', 'tokens', 'weights'] - description: > - Token weights in Balancer pools. - columns: - - *blockchain - - *version - - &pool_id - name: pool_id - description: 'Unique encoded identifier that refers to each pool' - tests: - - not_null - - &token_address - name: token_address - description: 'Contract address for the token' - - &normalized_weight - name: normalized_weight - description: 'Weight of the token in the pool.' - - - name: balancer_v1_ethereum_pools_tokens_weights - meta: - blockchain: ethereum - project: balancer - contributors: jacektrocinski, viniabussafi - config: - tags: ['ethereum', 'balancer', 'pools', 'tokens', 'weights'] - description: > - Token weights in Balancer v1 pools. - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - pool_id - - token_address - columns: - - *blockchain - - *version - - *pool_id - - *token_address - - *normalized_weight - - - name: balancer_v2_ethereum_pools_tokens_weights - meta: - blockchain: ethereum - project: balancer - contributors: jacektrocinski, viniabussafi - config: - tags: ['ethereum', 'balancer', 'pools', 'tokens', 'weights'] - description: > - Token weights in Balancer v2 pools. - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - pool_id - - token_address - columns: - - *blockchain - - *version - - *pool_id - - *token_address - - *normalized_weight - - - name: balancer_v2_ethereum_lbps - meta: - blockchain: ethereum - project: balancer_v2 - contributors: stefenon - config: - tags: ['ethereum', 'balancer', 'lbp'] - description: > - Record of the Liquidity Boostrapping Pools (LBP) of Balancer, an automated portfolio manager and trading platform, on Ethereum. - columns: - - name: name - description: "Name of the LBP" - - name: pool_id - description: "ID of the LBP" - - name: token_sold - description: "Contract address of the token sold by the LBP" - - name: token_symbol - description: "Symbol of the token sold by the LBP" - - name: start_time - description: "LBP start time" - - name: end_time - description: "LBP end time" \ No newline at end of file diff --git a/models/_project/balancer/pools/gnosis/_schema.yml b/models/_project/balancer/pools/gnosis/_schema.yml deleted file mode 100644 index ac61b0140a4..00000000000 --- a/models/_project/balancer/pools/gnosis/_schema.yml +++ /dev/null @@ -1,105 +0,0 @@ -version: 2 - -models: - - name: balancer_v2_gnosis_pools_fees - meta: - blockchain: gnosis - project: balancer_v2 - contributors: jacektrocinski, thetroyharris, viniabussafi - config: - tags: ['gnosis', 'balancer', 'pools_fees'] - description: > - Balancer v2 swap fees stored at the pool level. - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - block_number - - tx_hash - - index - columns: - - &blockchain - name: blockchain - description: "Blockchain" - - &version - name: version - description: "Version of Balancer where the liquidity pool used in transaction is deployed" - - &contract_address - name: contract_address - description: 'gnosis address for the liquidity pool used in transaction' - tests: - - not_null - - &tx_hash - name: tx_hash - description: 'Transaction hash' - tests: - - not_null - - &index - name: index - description: 'Event Index' - tests: - - not_null - - &tx_index - name: tx_index - description: 'Transaction Index' - tests: - - not_null - - &block_time - name: block_time - description: 'Block time in UTC' - tests: - - not_null - - &block_number - name: block_number - description: 'Event Block Number' - tests: - - not_null - - &swap_fee_percentage - name: swap_fee_percentage - description: 'Swap fees for the pool, values are returned with 18 decimals (1e18 meaning 100%)' - tests: - - not_null - - - name: balancer_gnosis_pools_tokens_weights - meta: - blockchain: gnosis - project: balancer - contributors: jacektrocinski, viniabussafi - config: - tags: ['gnosis', 'balancer', 'pools', 'tokens', 'weights'] - description: > - Token weights in Balancer pools. - columns: - - *blockchain - - *version - - &pool_id - name: pool_id - description: 'Unique encoded identifier that refers to each pool' - tests: - - not_null - - &token_address - name: token_address - description: 'Contract address for the token' - - &normalized_weight - name: normalized_weight - description: 'Weight of the token in the pool.' - - - name: balancer_v2_gnosis_pools_tokens_weights - meta: - blockchain: gnosis - project: balancer - contributors: jacektrocinski, viniabussafi - config: - tags: ['gnosis', 'balancer', 'pools', 'tokens', 'weights'] - description: > - Token weights in Balancer v2 pools. - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - pool_id - - token_address - columns: - - *blockchain - - *version - - *pool_id - - *token_address - - *normalized_weight \ No newline at end of file diff --git a/models/_project/balancer/pools/optimism/_schema.yml b/models/_project/balancer/pools/optimism/_schema.yml deleted file mode 100644 index 289820cd3bc..00000000000 --- a/models/_project/balancer/pools/optimism/_schema.yml +++ /dev/null @@ -1,146 +0,0 @@ -version: 2 - -models: - - name: balancer_v2_optimism_pools_fees - meta: - blockchain: optimism - project: balancer_v2 - contributors: jacektrocinski, thetroyharris, viniabussafi - config: - tags: ['optimism', 'balancer', 'pools_fees'] - description: > - Balancer v2 swap fees stored at the pool level. - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - block_number - - tx_hash - - index - columns: - - &blockchain - name: blockchain - description: "Blockchain" - - &version - name: version - description: "Version of Balancer where the liquidity pool used in transaction is deployed" - - &contract_address - name: contract_address - description: 'optimism address for the liquidity pool used in transaction' - tests: - - not_null - - &tx_hash - name: tx_hash - description: 'Transaction hash' - tests: - - not_null - - &index - name: index - description: 'Event Index' - tests: - - not_null - - &tx_index - name: tx_index - description: 'Transaction Index' - tests: - - not_null - - &block_time - name: block_time - description: 'Block time in UTC' - tests: - - not_null - - &block_number - name: block_number - description: 'Event Block Number' - tests: - - not_null - - &swap_fee_percentage - name: swap_fee_percentage - description: 'Swap fees for the pool, values are returned with 18 decimals (1e18 meaning 100%)' - tests: - - not_null - - - name: balancer_optimism_pools_tokens_weights - meta: - blockchain: optimism - project: balancer - contributors: jacektrocinski, viniabussafi - config: - tags: ['optimism', 'balancer', 'pools', 'tokens', 'weights'] - description: > - Token weights in Balancer pools. - columns: - - *blockchain - - *version - - &pool_id - name: pool_id - description: 'Unique encoded identifier that refers to each pool' - tests: - - not_null - - &token_address - name: token_address - description: 'Contract address for the token' - - &normalized_weight - name: normalized_weight - description: 'Weight of the token in the pool.' - - - name: balancer_v2_optimism_pools_tokens_weights - meta: - blockchain: optimism - project: balancer - contributors: jacektrocinski, viniabussafi - config: - tags: ['optimism', 'balancer', 'pools', 'tokens', 'weights'] - description: > - Token weights in Balancer v2 pools. - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - pool_id - - token_address - columns: - - *blockchain - - *version - - *pool_id - - *token_address - - *normalized_weight - - - name: balancer_optimism_gauge_mappings - meta: - blockchain: optimism - project: balancer - contributors: msilb7 - config: - tags: ['optimism', 'balancer', 'gauges', 'incentives'] - description: > - Balancer gauge to pool mappings on Optimism. - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - pool_contract - - incentives_contract - columns: - - *blockchain - - *version - - &pool_contract - name: pool_contract - description: "Address of the liquidity pool contract" - - *pool_id - - &incentives_contract - name: incentives_contract - description: "Address of the contract where incentives are stored and emitted." - - &incentives_type - name: incentives_type - description: "Description of the incentives address type." - - &evt_block_time - name: evt_block_time - description: "Block time in UTC" - - &evt_block_number - name: evt_block_number - description: 'Event Block Number' - - *contract_address - - &evt_tx_hash - name: evt_tx_hash - description: 'Transaction hash' - - &evt_index - name: evT_index - description: 'Event Index' \ No newline at end of file diff --git a/models/_project/balancer/pools/polygon/_schema.yml b/models/_project/balancer/pools/polygon/_schema.yml deleted file mode 100644 index 40929f01c30..00000000000 --- a/models/_project/balancer/pools/polygon/_schema.yml +++ /dev/null @@ -1,128 +0,0 @@ -version: 2 - -models: - - name: balancer_v2_polygon_pools_fees - meta: - blockchain: polygon - project: balancer_v2 - contributors: jacektrocinski, thetroyharris, viniabussafi - config: - tags: ['polygon', 'balancer', 'pools', 'fees'] - description: > - Balancer v2 swap fees stored at the pool level. - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - block_number - - tx_hash - - index - columns: - - &blockchain - name: blockchain - description: "Blockchain" - - &version - name: version - description: "Version of Balancer where the liquidity pool used in transaction is deployed" - - &contract_address - name: contract_address - description: 'zkevm address for the liquidity pool used in transaction' - tests: - - not_null - - &tx_hash - name: tx_hash - description: 'Transaction hash' - tests: - - not_null - - &index - name: index - description: 'Event Index' - tests: - - not_null - - &tx_index - name: tx_index - description: 'Transaction Index' - tests: - - not_null - - &block_time - name: block_time - description: 'Block time in UTC' - tests: - - not_null - - &block_number - name: block_number - description: 'Event Block Number' - tests: - - not_null - - &swap_fee_percentage - name: swap_fee_percentage - description: 'Swap fees for the pool, values are returned with 18 decimals (1e18 meaning 100%)' - tests: - - not_null - - - name: balancer_polygon_pools_tokens_weights - meta: - blockchain: polygon - project: balancer - contributors: jacektrocinski, viniabussafi - config: - tags: ['polygon', 'balancer', 'pools', 'tokens', 'weights'] - description: > - Token weights in Balancer pools. - columns: - - *blockchain - - *version - - &pool_id - name: pool_id - description: 'Unique encoded identifier that refers to each pool' - tests: - - not_null - - &token_address - name: token_address - description: 'Contract address for the token' - - &normalized_weight - name: normalized_weight - description: 'Weight of the token in the pool.' - - - name: balancer_v2_polygon_pools_tokens_weights - meta: - blockchain: polygon - project: balancer - contributors: jacektrocinski, viniabussafi - config: - tags: ['polygon', 'balancer', 'pools', 'tokens', 'weights'] - description: > - Token weights in Balancer v2 pools. - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - pool_id - - token_address - columns: - - *blockchain - - *version - - *pool_id - - *token_address - - *normalized_weight - - - name: balancer_v2_polygon_lbps - meta: - blockchain: polygon - project: balancer_v2 - contributors: stefenon - config: - tags: ['polygon', 'balancer', 'lbp'] - description: > - Record of the Liquidity Boostrapping Pools (LBP) of Balancer, an automated portfolio manager and trading platform, on polygon. - columns: - - name: name - description: "Name of the LBP" - - name: pool_id - description: "ID of the LBP" - - name: token_sold - description: "Contract address of the token sold by the LBP" - - name: token_symbol - description: "Symbol of the token sold by the LBP" - - name: start_time - description: "LBP start time" - - name: end_time - description: "LBP end time" \ No newline at end of file diff --git a/models/_project/balancer/pools/zkevm/_schema.yml b/models/_project/balancer/pools/zkevm/_schema.yml deleted file mode 100644 index 03f7ab4e6be..00000000000 --- a/models/_project/balancer/pools/zkevm/_schema.yml +++ /dev/null @@ -1,105 +0,0 @@ -version: 2 - -models: - - name: balancer_v2_zkevm_pools_fees - meta: - blockchain: zkevm - project: balancer_v2 - contributors: jacektrocinski, thetroyharris, viniabussafi - config: - tags: ['zkevm', 'balancer', 'pools_fees'] - description: > - Balancer v2 swap fees stored at the pool level. - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - block_number - - tx_hash - - index - columns: - - &blockchain - name: blockchain - description: "Blockchain" - - &version - name: version - description: "Version of Balancer where the liquidity pool used in transaction is deployed" - - &contract_address - name: contract_address - description: 'zkevm address for the liquidity pool used in transaction' - tests: - - not_null - - &tx_hash - name: tx_hash - description: 'Transaction hash' - tests: - - not_null - - &index - name: index - description: 'Event Index' - tests: - - not_null - - &tx_index - name: tx_index - description: 'Transaction Index' - tests: - - not_null - - &block_time - name: block_time - description: 'Block time in UTC' - tests: - - not_null - - &block_number - name: block_number - description: 'Event Block Number' - tests: - - not_null - - &swap_fee_percentage - name: swap_fee_percentage - description: 'Swap fees for the pool, values are returned with 18 decimals (1e18 meaning 100%)' - tests: - - not_null - - - name: balancer_zkevm_pools_tokens_weights - meta: - blockchain: zkevm - project: balancer - contributors: jacektrocinski, viniabussafi - config: - tags: ['zkevm', 'balancer', 'pools', 'tokens', 'weights'] - description: > - Token weights in Balancer pools. - columns: - - *blockchain - - *version - - &pool_id - name: pool_id - description: 'Unique encoded identifier that refers to each pool' - tests: - - not_null - - &token_address - name: token_address - description: 'Contract address for the token' - - &normalized_weight - name: normalized_weight - description: 'Weight of the token in the pool.' - - - name: balancer_v2_zkevm_pools_tokens_weights - meta: - blockchain: zkevm - project: balancer - contributors: jacektrocinski, viniabussafi - config: - tags: ['zkevm', 'balancer', 'pools', 'tokens', 'weights'] - description: > - Token weights in Balancer v2 pools. - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - pool_id - - token_address - columns: - - *blockchain - - *version - - *pool_id - - *token_address - - *normalized_weight \ No newline at end of file diff --git a/models/_project/balancer/protocol_fee/_schema.yml b/models/_project/balancer/protocol_fee/_schema.yml deleted file mode 100644 index ddc320d1692..00000000000 --- a/models/_project/balancer/protocol_fee/_schema.yml +++ /dev/null @@ -1,61 +0,0 @@ -version: 2 - -models: - - name: balancer_protocol_fee - meta: - blockchain: arbitrum, avalanche_c, base, ethereum, gnosis, optimism, polygon, zkevm - project: balancer - contributors: viniabussafi - config: - tags: ['arbitrum', 'avalanche_c', 'base', 'ethereum', 'gnosis', 'optimism', 'polygon', 'zkevm', 'fees'] - description: > - Daily Protocol Fee collected and Revenue by pool on Balancer, an automated portfolio manager and trading platform. - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - day - - pool_id - - token_address - columns: - - &day - name: day - description: "Block date in UTC" - - &pool_id - name: pool_id - description: "Unique encoded identifier that refers to each pool" - - &pool_address - name: pool_address - description: "Pool address" - - &pool_symbol - name: pool_symbol - description: "Token symbols, followed by their respective weights, if applicable" - - &version - name: version - description: "Version of the project" - - &blockchain - name: blockchain - description: "Blockchain" - - &pool_type - name: pool_type - description: "Pool attributes, determined by the pool's factory" - - &token_address - name: token_address - description: "Contract address of the token in which protocol fees were collected" - - &token_symbol - name: token_symbol - description: Token symbol of the token in which protocol fees were collected" - - &token_amount_raw - name: token_amount_raw - description: "Raw amount of fees of the token in the pool at time of execution in the original currency" - - &token_amount - name: token_amount - description: "Normalized amount of fees of the token in the pool at time of execution in the original currency" - - &protocol_fee_collected_usd - name: protocol_fee_collected_usd - description: "USD value of the collected fee" - - &treasury_share - name: treasury_share - description: "Share of total fee that is directed to Balancer DAO's treasury, as per BIPs 19, 161 and 371" - - &treasury_revenue_usd - name: treasury_revenue_usd - description: "USD value of fee directed to Balancer DAO's treasury" \ No newline at end of file diff --git a/models/_project/balancer/protocol_fee/arbitrum/_schema.yml b/models/_project/balancer/protocol_fee/arbitrum/_schema.yml deleted file mode 100644 index b529565a645..00000000000 --- a/models/_project/balancer/protocol_fee/arbitrum/_schema.yml +++ /dev/null @@ -1,61 +0,0 @@ -version: 2 - -models: - - name: balancer_v2_arbitrum_protocol_fee - meta: - blockchain: arbitrum - project: balancer_v2 - contributors: viniabussafi - config: - tags: ['arbitrum', 'protocol', 'fees'] - description: > - Daily Protocol Fee collected and Treasury Revenue by pool on Balancer, an automated portfolio manager and trading platform. - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - day - - pool_id - - token_address - columns: - - &day - name: day - description: "Block date in UTC" - - &pool_id - name: pool_id - description: "Unique encoded identifier that refers to each pool" - - &pool_address - name: pool_address - description: "Pool address" - - &pool_symbol - name: pool_symbol - description: "Token symbols, followed by their respective weights, if applicable" - - &version - name: version - description: "Version of the project" - - &blockchain - name: blockchain - description: "Blockchain" - - &pool_type - name: pool_type - description: "Pool attributes, determined by the pool's factory" - - &token_address - name: token_address - description: "Contract address of the token in which protocol fees were collected" - - &token_symbol - name: token_symbol - description: Token symbol of the token in which protocol fees were collected" - - &token_amount_raw - name: token_amount_raw - description: "Raw amount of fees of the token in the pool at time of execution in the original currency" - - &token_amount - name: token_amount - description: "Normalized amount of fees of the token in the pool at time of execution in the original currency" - - &protocol_fee_collected_usd - name: protocol_fee_collected_usd - description: "USD value of the collected fee" - - &treasury_share - name: treasury_share - description: "Share of total fee that is directed to Balancer DAO's treasury, as per BIPs 19, 161 and 371" - - &treasury_revenue_usd - name: treasury_revenue_usd - description: "USD value of fee directed to Balancer DAO's treasury" \ No newline at end of file diff --git a/models/_project/balancer/protocol_fee/avalanche_c/_schema.yml b/models/_project/balancer/protocol_fee/avalanche_c/_schema.yml deleted file mode 100644 index 536823df10d..00000000000 --- a/models/_project/balancer/protocol_fee/avalanche_c/_schema.yml +++ /dev/null @@ -1,61 +0,0 @@ -version: 2 - -models: - - name: balancer_v2_avalanche_c_protocol_fee - meta: - blockchain: avalanche_c - project: balancer_v2 - contributors: viniabussafi - config: - tags: ['avalanche_c', 'revenue', 'fees'] - description: > - Daily Protocol Fee collected and Revenue by pool on Balancer, an automated portfolio manager and trading platform. - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - day - - pool_id - - token_address - columns: - - &day - name: day - description: "Block date in UTC" - - &pool_id - name: pool_id - description: "Unique encoded identifier that refers to each pool" - - &pool_address - name: pool_address - description: "Pool address" - - &pool_symbol - name: pool_symbol - description: "Token symbols, followed by their respective weights, if applicable" - - &version - name: version - description: "Version of the project" - - &blockchain - name: blockchain - description: "Blockchain" - - &pool_type - name: pool_type - description: "Pool attributes, determined by the pool's factory" - - &token_address - name: token_address - description: "Contract address of the token in which protocol fees were collected" - - &token_symbol - name: token_symbol - description: Token symbol of the token in which protocol fees were collected" - - &token_amount_raw - name: token_amount_raw - description: "Raw amount of fees of the token in the pool at time of execution in the original currency" - - &token_amount - name: token_amount - description: "Normalized amount of fees of the token in the pool at time of execution in the original currency" - - &protocol_fee_collected_usd - name: protocol_fee_collected_usd - description: "USD value of the collected fee" - - &treasury_share - name: treasury_share - description: "Share of total fee that is directed to Balancer DAO's treasury, as per BIPs 19, 161 and 371" - - &treasury_revenue_usd - name: treasury_revenue_usd - description: "USD value of fee directed to Balancer DAO's treasury" \ No newline at end of file diff --git a/models/_project/balancer/protocol_fee/base/_schema.yml b/models/_project/balancer/protocol_fee/base/_schema.yml deleted file mode 100644 index cebb1c312e9..00000000000 --- a/models/_project/balancer/protocol_fee/base/_schema.yml +++ /dev/null @@ -1,61 +0,0 @@ -version: 2 - -models: - - name: balancer_v2_base_protocol_fee - meta: - blockchain: base - project: balancer_v2 - contributors: viniabussafi - config: - tags: ['base', 'revenue', 'fees'] - description: > - Daily Protocol Fee collected and Revenue by pool on Balancer, an automated portfolio manager and trading platform. - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - day - - pool_id - - token_address - columns: - - &day - name: day - description: "Block date in UTC" - - &pool_id - name: pool_id - description: "Unique encoded identifier that refers to each pool" - - &pool_address - name: pool_address - description: "Pool address" - - &pool_symbol - name: pool_symbol - description: "Token symbols, followed by their respective weights, if applicable" - - &version - name: version - description: "Version of the project" - - &blockchain - name: blockchain - description: "Blockchain" - - &pool_type - name: pool_type - description: "Pool attributes, determined by the pool's factory" - - &token_address - name: token_address - description: "Contract address of the token in which protocol fees were collected" - - &token_symbol - name: token_symbol - description: Token symbol of the token in which protocol fees were collected" - - &token_amount_raw - name: token_amount_raw - description: "Raw amount of fees of the token in the pool at time of execution in the original currency" - - &token_amount - name: token_amount - description: "Normalized amount of fees of the token in the pool at time of execution in the original currency" - - &protocol_fee_collected_usd - name: protocol_fee_collected_usd - description: "USD value of the collected fee" - - &treasury_share - name: treasury_share - description: "Share of total fee that is directed to Balancer DAO's treasury, as per BIPs 19, 161 and 371" - - &treasury_revenue_usd - name: treasury_revenue_usd - description: "USD value of fee directed to Balancer DAO's treasury" \ No newline at end of file diff --git a/models/_project/balancer/protocol_fee/ethereum/_schema.yml b/models/_project/balancer/protocol_fee/ethereum/_schema.yml deleted file mode 100644 index b6830c20e7e..00000000000 --- a/models/_project/balancer/protocol_fee/ethereum/_schema.yml +++ /dev/null @@ -1,61 +0,0 @@ -version: 2 - -models: - - name: balancer_v2_ethereum_protocol_fee - meta: - blockchain: ethereum - project: balancer_v2 - contributors: viniabussafi - config: - tags: ['ethereum', 'revenue', 'fees'] - description: > - Daily Protocol Fee collected and Revenue by pool on Balancer, an automated portfolio manager and trading platform. - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - day - - pool_id - - token_address - columns: - - &day - name: day - description: "Block date in UTC" - - &pool_id - name: pool_id - description: "Unique encoded identifier that refers to each pool" - - &pool_address - name: pool_address - description: "Pool address" - - &pool_symbol - name: pool_symbol - description: "Token symbols, followed by their respective weights, if applicable" - - &version - name: version - description: "Version of the project" - - &blockchain - name: blockchain - description: "Blockchain" - - &pool_type - name: pool_type - description: "Pool attributes, determined by the pool's factory" - - &token_address - name: token_address - description: "Contract address of the token in which protocol fees were collected" - - &token_symbol - name: token_symbol - description: Token symbol of the token in which protocol fees were collected" - - &token_amount_raw - name: token_amount_raw - description: "Raw amount of fees of the token in the pool at time of execution in the original currency" - - &token_amount - name: token_amount - description: "Normalized amount of fees of the token in the pool at time of execution in the original currency" - - &protocol_fee_collected_usd - name: protocol_fee_collected_usd - description: "USD value of the collected fee" - - &treasury_share - name: treasury_share - description: "Share of total fee that is directed to Balancer DAO's treasury, as per BIPs 19, 161 and 371" - - &treasury_revenue_usd - name: treasury_revenue_usd - description: "USD value of fee directed to Balancer DAO's treasury" \ No newline at end of file diff --git a/models/_project/balancer/protocol_fee/gnosis/_schema.yml b/models/_project/balancer/protocol_fee/gnosis/_schema.yml deleted file mode 100644 index defa5e74781..00000000000 --- a/models/_project/balancer/protocol_fee/gnosis/_schema.yml +++ /dev/null @@ -1,61 +0,0 @@ -version: 2 - -models: - - name: balancer_v2_gnosis_protocol_fee - meta: - blockchain: gnosis - project: balancer_v2 - contributors: viniabussafi - config: - tags: ['gnosis', 'revenue', 'fees'] - description: > - Daily Protocol Fee collected and Revenue by pool on Balancer, an automated portfolio manager and trading platform. - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - day - - pool_id - - token_address - columns: - - &day - name: day - description: "Block date in UTC" - - &pool_id - name: pool_id - description: "Unique encoded identifier that refers to each pool" - - &pool_address - name: pool_address - description: "Pool address" - - &pool_symbol - name: pool_symbol - description: "Token symbols, followed by their respective weights, if applicable" - - &version - name: version - description: "Version of the project" - - &blockchain - name: blockchain - description: "Blockchain" - - &pool_type - name: pool_type - description: "Pool attributes, determined by the pool's factory" - - &token_address - name: token_address - description: "Contract address of the token in which protocol fees were collected" - - &token_symbol - name: token_symbol - description: Token symbol of the token in which protocol fees were collected" - - &token_amount_raw - name: token_amount_raw - description: "Raw amount of fees of the token in the pool at time of execution in the original currency" - - &token_amount - name: token_amount - description: "Normalized amount of fees of the token in the pool at time of execution in the original currency" - - &protocol_fee_collected_usd - name: protocol_fee_collected_usd - description: "USD value of the collected fee" - - &treasury_share - name: treasury_share - description: "Share of total fee that is directed to Balancer DAO's treasury, as per BIPs 19, 161 and 371" - - &treasury_revenue_usd - name: treasury_revenue_usd - description: "USD value of fee directed to Balancer DAO's treasury" \ No newline at end of file diff --git a/models/_project/balancer/protocol_fee/optimism/_schema.yml b/models/_project/balancer/protocol_fee/optimism/_schema.yml deleted file mode 100644 index 6b096a72bc6..00000000000 --- a/models/_project/balancer/protocol_fee/optimism/_schema.yml +++ /dev/null @@ -1,61 +0,0 @@ -version: 2 - -models: - - name: balancer_v2_optimism_protocol_fee - meta: - blockchain: optimism - project: balancer_v2 - contributors: viniabussafi - config: - tags: ['optimism', 'revenue', 'fees'] - description: > - Daily Protocol Fee collected and Revenue by pool on Balancer, an automated portfolio manager and trading platform. - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - day - - pool_id - - token_address - columns: - - &day - name: day - description: "Block date in UTC" - - &pool_id - name: pool_id - description: "Unique encoded identifier that refers to each pool" - - &pool_address - name: pool_address - description: "Pool address" - - &pool_symbol - name: pool_symbol - description: "Token symbols, followed by their respective weights, if applicable" - - &version - name: version - description: "Version of the project" - - &blockchain - name: blockchain - description: "Blockchain" - - &pool_type - name: pool_type - description: "Pool attributes, determined by the pool's factory" - - &token_address - name: token_address - description: "Contract address of the token in which protocol fees were collected" - - &token_symbol - name: token_symbol - description: Token symbol of the token in which protocol fees were collected" - - &token_amount_raw - name: token_amount_raw - description: "Raw amount of fees of the token in the pool at time of execution in the original currency" - - &token_amount - name: token_amount - description: "Normalized amount of fees of the token in the pool at time of execution in the original currency" - - &protocol_fee_collected_usd - name: protocol_fee_collected_usd - description: "USD value of the collected fee" - - &treasury_share - name: treasury_share - description: "Share of total fee that is directed to Balancer DAO's treasury, as per BIPs 19, 161 and 371" - - &treasury_revenue_usd - name: treasury_revenue_usd - description: "USD value of fee directed to Balancer DAO's treasury" \ No newline at end of file diff --git a/models/_project/balancer/protocol_fee/polygon/_schema.yml b/models/_project/balancer/protocol_fee/polygon/_schema.yml deleted file mode 100644 index b541beceb65..00000000000 --- a/models/_project/balancer/protocol_fee/polygon/_schema.yml +++ /dev/null @@ -1,61 +0,0 @@ -version: 2 - -models: - - name: balancer_v2_polygon_protocol_fee - meta: - blockchain: polygon - project: balancer_v2 - contributors: viniabussafi - config: - tags: ['polygon', 'revenue', 'fees'] - description: > - Daily Protocol Fee collected and Revenue by pool on Balancer, an automated portfolio manager and trading platform. - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - day - - pool_id - - token_address - columns: - - &day - name: day - description: "Block date in UTC" - - &pool_id - name: pool_id - description: "Unique encoded identifier that refers to each pool" - - &pool_address - name: pool_address - description: "Pool address" - - &pool_symbol - name: pool_symbol - description: "Token symbols, followed by their respective weights, if applicable" - - &version - name: version - description: "Version of the project" - - &blockchain - name: blockchain - description: "Blockchain" - - &pool_type - name: pool_type - description: "Pool attributes, determined by the pool's factory" - - &token_address - name: token_address - description: "Contract address of the token in which protocol fees were collected" - - &token_symbol - name: token_symbol - description: Token symbol of the token in which protocol fees were collected" - - &token_amount_raw - name: token_amount_raw - description: "Raw amount of fees of the token in the pool at time of execution in the original currency" - - &token_amount - name: token_amount - description: "Normalized amount of fees of the token in the pool at time of execution in the original currency" - - &protocol_fee_collected_usd - name: protocol_fee_collected_usd - description: "USD value of the collected fee" - - &treasury_share - name: treasury_share - description: "Share of total fee that is directed to Balancer DAO's treasury, as per BIPs 19, 161 and 371" - - &treasury_revenue_usd - name: treasury_revenue_usd - description: "USD value of fee directed to Balancer DAO's treasury" \ No newline at end of file diff --git a/models/_project/balancer/protocol_fee/zkevm/_schema.yml b/models/_project/balancer/protocol_fee/zkevm/_schema.yml deleted file mode 100644 index b8c5d67a600..00000000000 --- a/models/_project/balancer/protocol_fee/zkevm/_schema.yml +++ /dev/null @@ -1,61 +0,0 @@ -version: 2 - -models: - - name: balancer_v2_zkevm_protocol_fee - meta: - blockchain: zkevm - project: balancer_v2 - contributors: viniabussafi - config: - tags: ['zkevm', 'revenue', 'fees'] - description: > - Daily Protocol Fee collected and Revenue by pool on Balancer, an automated portfolio manager and trading platform. - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - day - - pool_id - - token_address - columns: - - &day - name: day - description: "Block date in UTC" - - &pool_id - name: pool_id - description: "Unique encoded identifier that refers to each pool" - - &pool_address - name: pool_address - description: "Pool address" - - &pool_symbol - name: pool_symbol - description: "Token symbols, followed by their respective weights, if applicable" - - &version - name: version - description: "Version of the project" - - &blockchain - name: blockchain - description: "Blockchain" - - &pool_type - name: pool_type - description: "Pool attributes, determined by the pool's factory" - - &token_address - name: token_address - description: "Contract address of the token in which protocol fees were collected" - - &token_symbol - name: token_symbol - description: Token symbol of the token in which protocol fees were collected" - - &token_amount_raw - name: token_amount_raw - description: "Raw amount of fees of the token in the pool at time of execution in the original currency" - - &token_amount - name: token_amount - description: "Normalized amount of fees of the token in the pool at time of execution in the original currency" - - &protocol_fee_collected_usd - name: protocol_fee_collected_usd - description: "USD value of the collected fee" - - &treasury_share - name: treasury_share - description: "Share of total fee that is directed to Balancer DAO's treasury, as per BIPs 19, 161 and 371" - - &treasury_revenue_usd - name: treasury_revenue_usd - description: "USD value of fee directed to Balancer DAO's treasury" \ No newline at end of file diff --git a/models/_project/balancer/support/_schema.yml b/models/_project/balancer/support/_schema.yml deleted file mode 100644 index fbb445cf773..00000000000 --- a/models/_project/balancer/support/_schema.yml +++ /dev/null @@ -1,56 +0,0 @@ -version: 2 - -models: - - name: balancer_token_whitelist - meta: - blockchain: arbitrum, avalanche_c, base, ethereum, gnosis, optimism, polygon, 'zkevm' - contributors: viniabussafi - config: - tags: ['arbitrum', 'avalanche_c', 'base', 'ethereum', 'gnosis', 'optimism', 'polygon', 'zkevm'] - description: > - These tokens are whitelisted to be used as pricing assets on liquidity calculations for weighted pools, due to the trustability of their data. - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - address - - name - - chain - columns: - - &address - name: address - description: "Token address" - - &name - name: name - description: "Token symbol" - - &chain - name: chain - description: "Token blockchain" - - - name: balancer_single_recipient_gauges - meta: - blockchain: ethereum - contributors: viniabussafi - config: - tags: ['ethereum', 'gauges'] - description: > - These gauges are deployed by the SingleRecipientGauge contract and this mapping manually links each gauge to it's correspondent pool and project - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - gauge_address - - pool_id - - project - - blockchain - columns: - - &gauge_address - name: gauge_address - descripton: "Gauge address" - - &pool_id - name: pool_id - description: "Unique encoded identifier that refers to each pool to which each gauge directs incentives" - - &project - name: project - description: "ve8020 project for each gauge" - - &blockchain - name: blockchain - description: "Blockchain" \ No newline at end of file diff --git a/models/_project/balancer/trades/arbitrum/_schema.yml b/models/_project/balancer/trades/arbitrum/_schema.yml deleted file mode 100644 index 09ef97905b8..00000000000 --- a/models/_project/balancer/trades/arbitrum/_schema.yml +++ /dev/null @@ -1,149 +0,0 @@ -version: 2 - -models: - - name: balancer_arbitrum_trades - meta: - blockchain: arbitrum - sector: dex - contributors: bizzyvinci, viniabussafi - config: - tags: ['balancer', 'arbitrum', 'amm', 'trades', 'dex'] - description: > - DEX trades on balancer on arbitrum - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - block_date - - blockchain - - project - - version - - tx_hash - - evt_index - - check_dex_seed: - blockchain: arbitrum - project: balancer - version: 2 - columns: - - &blockchain - name: blockchain - description: "Blockchain" - - &project - name: project - description: "Project name (balancer)" - - &version - name: version - description: "Version of the project" - - &block_month - name: block_month - description: "Block month in UTC" - - &block_date - name: block_date - description: "Block date in UTC" - - &block_time - name: block_time - description: 'Block time in UTC' - - &block_number - name: block_number - description: 'Block number' - - &token_bought_symbol - name: token_bought_symbol - description: "Token symbol for token bought in the trade" - - &token_sold_symbol - name: token_sold_symbol - description: "Token symbol for token sold in the trade" - - &token_pair - name: token_pair - description: "Token symbol pair for each token involved in the trade" - - &token_bought_amount - name: token_bought_amount - description: "Value of the token bought at time of execution in the original currency" - - &token_sold_amount - name: token_sold_amount - description: "Value of the token sold at time of execution in the original currency" - - &token_bought_amount_raw - name: token_bought_amount_raw - description: "Raw value of the token bought at time of execution in the original currency" - - &token_sold_amount_raw - name: token_sold_amount_raw - description: "Raw value of the token sold at time of execution in the original currency" - - &amount_usd - name: amount_usd - description: "USD value of the trade at time of execution" - - &token_bought_address - name: token_bought_address - description: "Contract address of the token bought" - - &token_sold_address - name: token_sold_address - description: "Contract address of the token sold" - - &taker - name: taker - description: "Address of trader who purchased a token" - - &maker - name: maker - description: "Address of trader who sold a token" - - &pool_id - name: pool_id - description: "Unique encoded identifier that refers to each pool" - - &swap_fee - name: swap_fee - description: 'Swap fee' - - &project_contract_address - name: project_contract_address - description: "Pool address" - - &pool_symbol - name: pool_symbol - description: "Token symbols, followed by their respective weights, if applicable" - - &pool_type - name: pool_type - description: "Pool attributes, determined by the pool's factory" - - &tx_hash - name: tx_hash - description: "Tx. Hash" - - &tx_from - name: tx_from - description: "transaction.from" - - &tx_to - name: tx_to - description: "transaction.to" - - &evt_index - name: evt_index - description: 'Event index' - - - name: balancer_v2_arbitrum_trades - meta: - blockchain: arbitrum - sector: dex - contributors: bizzyvinci, thetroyharris, tomfutago, viniabussafi - config: - tags: [ 'balancer', 'arbitrum', 'amm', 'trades', 'dex', 'beta' ] - description: > - DEX trades on balancer v2 on arbitrum - columns: - - *blockchain - - *project - - *version - - *block_month - - *block_date - - *block_time - - *block_number - - *token_bought_symbol - - *token_sold_symbol - - *token_pair - - *token_bought_amount - - *token_sold_amount - - *token_bought_amount_raw - - *token_sold_amount_raw - - *amount_usd - - *token_bought_address - - *token_sold_address - - *taker - - *maker - - *project_contract_address - - *pool_symbol - - *pool_type - - *pool_id - - *swap_fee - - *tx_hash - - *tx_from - - *tx_to - - *evt_index \ No newline at end of file diff --git a/models/_project/balancer/trades/avalanche_c/_schema.yml b/models/_project/balancer/trades/avalanche_c/_schema.yml deleted file mode 100644 index 86aca24b807..00000000000 --- a/models/_project/balancer/trades/avalanche_c/_schema.yml +++ /dev/null @@ -1,149 +0,0 @@ -version: 2 - -models: - - name: balancer_avalanche_c_trades - meta: - blockchain: avalanche_c - sector: dex - contributors: bizzyvinci, viniabussafi - config: - tags: ['balancer', 'avalanche_c', 'amm', 'trades', 'dex'] - description: > - DEX trades on balancer on avalanche_c - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - block_date - - blockchain - - project - - version - - tx_hash - - evt_index - - check_dex_seed: - blockchain: avalanche_c - project: balancer - version: 2 - columns: - - &blockchain - name: blockchain - description: "Blockchain" - - &project - name: project - description: "Project name (balancer)" - - &version - name: version - description: "Version of the project" - - &block_month - name: block_month - description: "Block month in UTC" - - &block_date - name: block_date - description: "Block date in UTC" - - &block_time - name: block_time - description: 'Block time in UTC' - - &block_number - name: block_number - description: 'Block number' - - &token_bought_symbol - name: token_bought_symbol - description: "Token symbol for token bought in the trade" - - &token_sold_symbol - name: token_sold_symbol - description: "Token symbol for token sold in the trade" - - &token_pair - name: token_pair - description: "Token symbol pair for each token involved in the trade" - - &token_bought_amount - name: token_bought_amount - description: "Value of the token bought at time of execution in the original currency" - - &token_sold_amount - name: token_sold_amount - description: "Value of the token sold at time of execution in the original currency" - - &token_bought_amount_raw - name: token_bought_amount_raw - description: "Raw value of the token bought at time of execution in the original currency" - - &token_sold_amount_raw - name: token_sold_amount_raw - description: "Raw value of the token sold at time of execution in the original currency" - - &amount_usd - name: amount_usd - description: "USD value of the trade at time of execution" - - &token_bought_address - name: token_bought_address - description: "Contract address of the token bought" - - &token_sold_address - name: token_sold_address - description: "Contract address of the token sold" - - &taker - name: taker - description: "Address of trader who purchased a token" - - &maker - name: maker - description: "Address of trader who sold a token" - - &pool_id - name: pool_id - description: "Unique encoded identifier that refers to each pool" - - &swap_fee - name: swap_fee - description: 'Swap fee' - - &project_contract_address - name: project_contract_address - description: "Pool address" - - &pool_symbol - name: pool_symbol - description: "Token symbols, followed by their respective weights, if applicable" - - &pool_type - name: pool_type - description: "Pool attributes, determined by the pool's factory" - - &tx_hash - name: tx_hash - description: "Tx. Hash" - - &tx_from - name: tx_from - description: "transaction.from" - - &tx_to - name: tx_to - description: "transaction.to" - - &evt_index - name: evt_index - description: 'Event index' - - - name: balancer_v2_avalanche_c_trades - meta: - blockchain: avalanche_c - sector: dex - contributors: bizzyvinci, thetroyharris, tomfutago, viniabussafi - config: - tags: [ 'balancer', 'avalanche_c', 'amm', 'trades', 'dex', 'beta' ] - description: > - DEX trades on balancer v2 on avalanche_c - columns: - - *blockchain - - *project - - *version - - *block_month - - *block_date - - *block_time - - *block_number - - *token_bought_symbol - - *token_sold_symbol - - *token_pair - - *token_bought_amount - - *token_sold_amount - - *token_bought_amount_raw - - *token_sold_amount_raw - - *amount_usd - - *token_bought_address - - *token_sold_address - - *taker - - *maker - - *project_contract_address - - *pool_symbol - - *pool_type - - *pool_id - - *swap_fee - - *tx_hash - - *tx_from - - *tx_to - - *evt_index \ No newline at end of file diff --git a/models/_project/balancer/trades/base/_schema.yml b/models/_project/balancer/trades/base/_schema.yml deleted file mode 100644 index 4a0bd85156f..00000000000 --- a/models/_project/balancer/trades/base/_schema.yml +++ /dev/null @@ -1,149 +0,0 @@ -version: 2 - -models: - - name: balancer_base_trades - meta: - blockchain: base - sector: dex - contributors: bizzyvinci, viniabussafi - config: - tags: ['balancer', 'base', 'amm', 'trades', 'dex'] - description: > - DEX trades on balancer on base - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - block_date - - blockchain - - project - - version - - tx_hash - - evt_index - - check_dex_seed: - blockchain: base - project: balancer - version: 2 - columns: - - &blockchain - name: blockchain - description: "Blockchain" - - &project - name: project - description: "Project name (balancer)" - - &version - name: version - description: "Version of the project" - - &block_month - name: block_month - description: "Block month in UTC" - - &block_date - name: block_date - description: "Block date in UTC" - - &block_time - name: block_time - description: 'Block time in UTC' - - &block_number - name: block_number - description: 'Block number' - - &token_bought_symbol - name: token_bought_symbol - description: "Token symbol for token bought in the trade" - - &token_sold_symbol - name: token_sold_symbol - description: "Token symbol for token sold in the trade" - - &token_pair - name: token_pair - description: "Token symbol pair for each token involved in the trade" - - &token_bought_amount - name: token_bought_amount - description: "Value of the token bought at time of execution in the original currency" - - &token_sold_amount - name: token_sold_amount - description: "Value of the token sold at time of execution in the original currency" - - &token_bought_amount_raw - name: token_bought_amount_raw - description: "Raw value of the token bought at time of execution in the original currency" - - &token_sold_amount_raw - name: token_sold_amount_raw - description: "Raw value of the token sold at time of execution in the original currency" - - &amount_usd - name: amount_usd - description: "USD value of the trade at time of execution" - - &token_bought_address - name: token_bought_address - description: "Contract address of the token bought" - - &token_sold_address - name: token_sold_address - description: "Contract address of the token sold" - - &taker - name: taker - description: "Address of trader who purchased a token" - - &maker - name: maker - description: "Address of trader who sold a token" - - &pool_id - name: pool_id - description: "Unique encoded identifier that refers to each pool" - - &swap_fee - name: swap_fee - description: 'Swap fee' - - &project_contract_address - name: project_contract_address - description: "Pool address" - - &pool_symbol - name: pool_symbol - description: "Token symbols, followed by their respective weights, if applicable" - - &pool_type - name: pool_type - description: "Pool attributes, determined by the pool's factory" - - &tx_hash - name: tx_hash - description: "Tx. Hash" - - &tx_from - name: tx_from - description: "transaction.from" - - &tx_to - name: tx_to - description: "transaction.to" - - &evt_index - name: evt_index - description: 'Event index' - - - name: balancer_v2_base_trades - meta: - blockchain: base - sector: dex - contributors: bizzyvinci, thetroyharris, tomfutago, viniabussafi - config: - tags: [ 'balancer', 'base', 'amm', 'trades', 'dex', 'beta' ] - description: > - DEX trades on balancer v2 on base - columns: - - *blockchain - - *project - - *version - - *block_month - - *block_date - - *block_time - - *block_number - - *token_bought_symbol - - *token_sold_symbol - - *token_pair - - *token_bought_amount - - *token_sold_amount - - *token_bought_amount_raw - - *token_sold_amount_raw - - *amount_usd - - *token_bought_address - - *token_sold_address - - *taker - - *maker - - *project_contract_address - - *pool_symbol - - *pool_type - - *pool_id - - *swap_fee - - *tx_hash - - *tx_from - - *tx_to - - *evt_index \ No newline at end of file diff --git a/models/_project/balancer/trades/ethereum/_schema.yml b/models/_project/balancer/trades/ethereum/_schema.yml deleted file mode 100644 index 42d29d7e17d..00000000000 --- a/models/_project/balancer/trades/ethereum/_schema.yml +++ /dev/null @@ -1,145 +0,0 @@ -version: 2 - -models: - - name: balancer_ethereum_trades - meta: - blockchain: ethereum - sector: dex - contributors: bizzyvinci, thetroyharris, viniabussafi - config: - tags: ['balancer', 'ethereum', 'amm', 'trades', 'dex'] - description: > - DEX trades on balancer on ethereum - columns: - - &blockchain - name: blockchain - description: "Blockchain" - - &project - name: project - description: "Project name (balancer)" - - &version - name: version - description: "Version of the project" - - &block_month - name: block_month - description: "Block month in UTC" - - &block_date - name: block_date - description: "Block date in UTC" - - &block_time - name: block_time - description: 'Block time in UTC' - - &block_number - name: block_number - description: 'Block number' - - &token_bought_symbol - name: token_bought_symbol - description: "Token symbol for token bought in the trade" - - &token_sold_symbol - name: token_sold_symbol - description: "Token symbol for token sold in the trade" - - &token_pair - name: token_pair - description: "Token symbol pair for each token involved in the trade" - - &token_bought_amount - name: token_bought_amount - description: "Value of the token bought at time of execution in the original currency" - - &token_sold_amount - name: token_sold_amount - description: "Value of the token sold at time of execution in the original currency" - - &token_bought_amount_raw - name: token_bought_amount_raw - description: "Raw value of the token bought at time of execution in the original currency" - - &token_sold_amount_raw - name: token_sold_amount_raw - description: "Raw value of the token sold at time of execution in the original currency" - - &amount_usd - name: amount_usd - description: "USD value of the trade at time of execution" - - &token_bought_address - name: token_bought_address - description: "Contract address of the token bought" - - &token_sold_address - name: token_sold_address - description: "Contract address of the token sold" - - &taker - name: taker - description: "Address of trader who purchased a token" - - &maker - name: maker - description: "Address of trader who sold a token" - - &pool_id - name: pool_id - description: "Unique encoded identifier that refers to each pool" - - &swap_fee - name: swap_fee - description: 'Swap fee' - - &project_contract_address - name: project_contract_address - description: "Pool address" - - &pool_symbol - name: pool_symbol - description: "Token symbols, followed by their respective weights, if applicable" - - &pool_type - name: pool_type - description: "Pool attributes, determined by the pool's factory" - - &tx_hash - name: tx_hash - description: "Tx. Hash" - - &tx_from - name: tx_from - description: "transaction.from" - - &tx_to - name: tx_to - description: "transaction.to" - - &evt_index - name: evt_index - description: 'Event index' - - - name: balancer_v1_ethereum_trades - meta: - blockchain: ethereum - sector: dex - contributors: bizzyvinci, thetroyharris, viniabussafi - config: - tags: [ 'balancer', 'ethereum', 'amm', 'trades', 'dex' ] - description: > - DEX trades on balancer v1 on ethereum - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - block_time - - tx_hash - - evt_index - - check_dex_seed: - blockchain: ethereum - project: balancer - version: 1 - columns: - - *blockchain - - *project - - *version - - *block_month - - *block_date - - *block_time - - *token_bought_symbol - - *token_sold_symbol - - *token_pair - - *token_bought_amount - - *token_sold_amount - - *token_bought_amount_raw - - *token_sold_amount_raw - - *amount_usd - - *token_bought_address - - *token_sold_address - - *taker - - *maker - - *pool_id - - *swap_fee - - *project_contract_address - - *pool_symbol - - *pool_type - - *tx_hash - - *tx_from - - *tx_to - - *evt_index \ No newline at end of file diff --git a/models/_project/balancer/trades/gnosis/_schema.yml b/models/_project/balancer/trades/gnosis/_schema.yml deleted file mode 100644 index ae5ae4065a2..00000000000 --- a/models/_project/balancer/trades/gnosis/_schema.yml +++ /dev/null @@ -1,149 +0,0 @@ -version: 2 - -models: - - name: balancer_gnosis_trades - meta: - blockchain: gnosis - sector: dex - contributors: bizzyvinci, viniabussafi - config: - tags: ['balancer', 'gnosis', 'amm', 'trades', 'dex'] - description: > - DEX trades on balancer on gnosis - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - block_date - - blockchain - - project - - version - - tx_hash - - evt_index - - check_dex_seed: - blockchain: gnosis - project: balancer - version: 2 - columns: - - &blockchain - name: blockchain - description: "Blockchain" - - &project - name: project - description: "Project name (balancer)" - - &version - name: version - description: "Version of the project" - - &block_month - name: block_month - description: "Block month in UTC" - - &block_date - name: block_date - description: "Block date in UTC" - - &block_time - name: block_time - description: 'Block time in UTC' - - &block_number - name: block_number - description: 'Block number' - - &token_bought_symbol - name: token_bought_symbol - description: "Token symbol for token bought in the trade" - - &token_sold_symbol - name: token_sold_symbol - description: "Token symbol for token sold in the trade" - - &token_pair - name: token_pair - description: "Token symbol pair for each token involved in the trade" - - &token_bought_amount - name: token_bought_amount - description: "Value of the token bought at time of execution in the original currency" - - &token_sold_amount - name: token_sold_amount - description: "Value of the token sold at time of execution in the original currency" - - &token_bought_amount_raw - name: token_bought_amount_raw - description: "Raw value of the token bought at time of execution in the original currency" - - &token_sold_amount_raw - name: token_sold_amount_raw - description: "Raw value of the token sold at time of execution in the original currency" - - &amount_usd - name: amount_usd - description: "USD value of the trade at time of execution" - - &token_bought_address - name: token_bought_address - description: "Contract address of the token bought" - - &token_sold_address - name: token_sold_address - description: "Contract address of the token sold" - - &taker - name: taker - description: "Address of trader who purchased a token" - - &maker - name: maker - description: "Address of trader who sold a token" - - &pool_id - name: pool_id - description: "Unique encoded identifier that refers to each pool" - - &swap_fee - name: swap_fee - description: 'Swap fee' - - &project_contract_address - name: project_contract_address - description: "Pool address" - - &pool_symbol - name: pool_symbol - description: "Token symbols, followed by their respective weights, if applicable" - - &pool_type - name: pool_type - description: "Pool attributes, determined by the pool's factory" - - &tx_hash - name: tx_hash - description: "Tx. Hash" - - &tx_from - name: tx_from - description: "transaction.from" - - &tx_to - name: tx_to - description: "transaction.to" - - &evt_index - name: evt_index - description: 'Event index' - - - name: balancer_v2_gnosis_trades - meta: - blockchain: gnosis - sector: dex - contributors: bizzyvinci, thetroyharris, tomfutago, viniabussafi - config: - tags: [ 'balancer', 'gnosis', 'amm', 'trades', 'dex', 'beta' ] - description: > - DEX trades on balancer v2 on gnosis - columns: - - *blockchain - - *project - - *version - - *block_month - - *block_date - - *block_time - - *block_number - - *token_bought_symbol - - *token_sold_symbol - - *token_pair - - *token_bought_amount - - *token_sold_amount - - *token_bought_amount_raw - - *token_sold_amount_raw - - *amount_usd - - *token_bought_address - - *token_sold_address - - *taker - - *maker - - *project_contract_address - - *pool_symbol - - *pool_type - - *pool_id - - *swap_fee - - *tx_hash - - *tx_from - - *tx_to - - *evt_index \ No newline at end of file diff --git a/models/_project/balancer/trades/optimism/_schema.yml b/models/_project/balancer/trades/optimism/_schema.yml deleted file mode 100644 index 481a7f9073b..00000000000 --- a/models/_project/balancer/trades/optimism/_schema.yml +++ /dev/null @@ -1,149 +0,0 @@ -version: 2 - -models: - - name: balancer_optimism_trades - meta: - blockchain: optimism - sector: dex - contributors: bizzyvinci, viniabussafi - config: - tags: ['balancer', 'optimism', 'amm', 'trades', 'dex'] - description: > - DEX trades on balancer on optimism - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - block_date - - blockchain - - project - - version - - tx_hash - - evt_index - - check_dex_seed: - blockchain: optimism - project: balancer - version: 2 - columns: - - &blockchain - name: blockchain - description: "Blockchain" - - &project - name: project - description: "Project name (balancer)" - - &version - name: version - description: "Version of the project" - - &block_month - name: block_month - description: "Block month in UTC" - - &block_date - name: block_date - description: "Block date in UTC" - - &block_time - name: block_time - description: 'Block time in UTC' - - &block_number - name: block_number - description: 'Block number' - - &token_bought_symbol - name: token_bought_symbol - description: "Token symbol for token bought in the trade" - - &token_sold_symbol - name: token_sold_symbol - description: "Token symbol for token sold in the trade" - - &token_pair - name: token_pair - description: "Token symbol pair for each token involved in the trade" - - &token_bought_amount - name: token_bought_amount - description: "Value of the token bought at time of execution in the original currency" - - &token_sold_amount - name: token_sold_amount - description: "Value of the token sold at time of execution in the original currency" - - &token_bought_amount_raw - name: token_bought_amount_raw - description: "Raw value of the token bought at time of execution in the original currency" - - &token_sold_amount_raw - name: token_sold_amount_raw - description: "Raw value of the token sold at time of execution in the original currency" - - &amount_usd - name: amount_usd - description: "USD value of the trade at time of execution" - - &token_bought_address - name: token_bought_address - description: "Contract address of the token bought" - - &token_sold_address - name: token_sold_address - description: "Contract address of the token sold" - - &taker - name: taker - description: "Address of trader who purchased a token" - - &maker - name: maker - description: "Address of trader who sold a token" - - &pool_id - name: pool_id - description: "Unique encoded identifier that refers to each pool" - - &swap_fee - name: swap_fee - description: 'Swap fee' - - &project_contract_address - name: project_contract_address - description: "Pool address" - - &pool_symbol - name: pool_symbol - description: "Token symbols, followed by their respective weights, if applicable" - - &pool_type - name: pool_type - description: "Pool attributes, determined by the pool's factory" - - &tx_hash - name: tx_hash - description: "Tx. Hash" - - &tx_from - name: tx_from - description: "transaction.from" - - &tx_to - name: tx_to - description: "transaction.to" - - &evt_index - name: evt_index - description: 'Event index' - - - name: balancer_v2_optimism_trades - meta: - blockchain: optimism - sector: dex - contributors: bizzyvinci, thetroyharris, tomfutago, viniabussafi - config: - tags: [ 'balancer', 'optimism', 'amm', 'trades', 'dex', 'beta' ] - description: > - DEX trades on balancer v2 on optimism - columns: - - *blockchain - - *project - - *version - - *block_month - - *block_date - - *block_time - - *block_number - - *token_bought_symbol - - *token_sold_symbol - - *token_pair - - *token_bought_amount - - *token_sold_amount - - *token_bought_amount_raw - - *token_sold_amount_raw - - *amount_usd - - *token_bought_address - - *token_sold_address - - *taker - - *maker - - *project_contract_address - - *pool_symbol - - *pool_type - - *pool_id - - *swap_fee - - *tx_hash - - *tx_from - - *tx_to - - *evt_index \ No newline at end of file diff --git a/models/_project/balancer/trades/polygon/_schema.yml b/models/_project/balancer/trades/polygon/_schema.yml deleted file mode 100644 index c0dfa6ac51b..00000000000 --- a/models/_project/balancer/trades/polygon/_schema.yml +++ /dev/null @@ -1,149 +0,0 @@ -version: 2 - -models: - - name: balancer_polygon_trades - meta: - blockchain: polygon - sector: dex - contributors: bizzyvinci, viniabussafi - config: - tags: ['balancer', 'polygon', 'amm', 'trades', 'dex'] - description: > - DEX trades on balancer on polygon - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - block_date - - blockchain - - project - - version - - tx_hash - - evt_index - - check_dex_seed: - blockchain: polygon - project: balancer - version: 2 - columns: - - &blockchain - name: blockchain - description: "Blockchain" - - &project - name: project - description: "Project name (balancer)" - - &version - name: version - description: "Version of the project" - - &block_month - name: block_month - description: "Block month in UTC" - - &block_date - name: block_date - description: "Block date in UTC" - - &block_time - name: block_time - description: 'Block time in UTC' - - &block_number - name: block_number - description: 'Block number' - - &token_bought_symbol - name: token_bought_symbol - description: "Token symbol for token bought in the trade" - - &token_sold_symbol - name: token_sold_symbol - description: "Token symbol for token sold in the trade" - - &token_pair - name: token_pair - description: "Token symbol pair for each token involved in the trade" - - &token_bought_amount - name: token_bought_amount - description: "Value of the token bought at time of execution in the original currency" - - &token_sold_amount - name: token_sold_amount - description: "Value of the token sold at time of execution in the original currency" - - &token_bought_amount_raw - name: token_bought_amount_raw - description: "Raw value of the token bought at time of execution in the original currency" - - &token_sold_amount_raw - name: token_sold_amount_raw - description: "Raw value of the token sold at time of execution in the original currency" - - &amount_usd - name: amount_usd - description: "USD value of the trade at time of execution" - - &token_bought_address - name: token_bought_address - description: "Contract address of the token bought" - - &token_sold_address - name: token_sold_address - description: "Contract address of the token sold" - - &taker - name: taker - description: "Address of trader who purchased a token" - - &maker - name: maker - description: "Address of trader who sold a token" - - &pool_id - name: pool_id - description: "Unique encoded identifier that refers to each pool" - - &swap_fee - name: swap_fee - description: 'Swap fee' - - &project_contract_address - name: project_contract_address - description: "Pool address" - - &pool_symbol - name: pool_symbol - description: "Token symbols, followed by their respective weights, if applicable" - - &pool_type - name: pool_type - description: "Pool attributes, determined by the pool's factory" - - &tx_hash - name: tx_hash - description: "Tx. Hash" - - &tx_from - name: tx_from - description: "transaction.from" - - &tx_to - name: tx_to - description: "transaction.to" - - &evt_index - name: evt_index - description: 'Event index' - - - name: balancer_v2_polygon_trades - meta: - blockchain: polygon - sector: dex - contributors: bizzyvinci, thetroyharris, tomfutago, viniabussafi - config: - tags: [ 'balancer', 'polygon', 'amm', 'trades', 'dex', 'beta' ] - description: > - DEX trades on balancer v2 on polygon - columns: - - *blockchain - - *project - - *version - - *block_month - - *block_date - - *block_time - - *block_number - - *token_bought_symbol - - *token_sold_symbol - - *token_pair - - *token_bought_amount - - *token_sold_amount - - *token_bought_amount_raw - - *token_sold_amount_raw - - *amount_usd - - *token_bought_address - - *token_sold_address - - *taker - - *maker - - *project_contract_address - - *pool_symbol - - *pool_type - - *pool_id - - *swap_fee - - *tx_hash - - *tx_from - - *tx_to - - *evt_index \ No newline at end of file diff --git a/models/_project/balancer/trades/zkevm/_schema.yml b/models/_project/balancer/trades/zkevm/_schema.yml deleted file mode 100644 index 80f42ffe980..00000000000 --- a/models/_project/balancer/trades/zkevm/_schema.yml +++ /dev/null @@ -1,110 +0,0 @@ -version: 2 - -models: - - name: balancer_zkevm_trades - meta: - blockchain: zkevm - sector: dex - contributors: bizzyvinci, viniabussafi - config: - tags: ['balancer', 'zkevm', 'amm', 'trades', 'dex'] - description: > - DEX trades on balancer on zkevm - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - block_date - - blockchain - - project - - version - - tx_hash - - evt_index - - check_dex_seed: - blockchain: zkevm - project: balancer - version: 2 - columns: - - &blockchain - name: blockchain - description: "Blockchain" - - &project - name: project - description: "Project name (balancer)" - - &version - name: version - description: "Version of the project" - - &block_month - name: block_month - description: "Block month in UTC" - - &block_date - name: block_date - description: "Block date in UTC" - - &block_time - name: block_time - description: 'Block time in UTC' - - &block_number - name: block_number - description: 'Block number' - - &token_bought_symbol - name: token_bought_symbol - description: "Token symbol for token bought in the trade" - - &token_sold_symbol - name: token_sold_symbol - description: "Token symbol for token sold in the trade" - - &token_pair - name: token_pair - description: "Token symbol pair for each token involved in the trade" - - &token_bought_amount - name: token_bought_amount - description: "Value of the token bought at time of execution in the original currency" - - &token_sold_amount - name: token_sold_amount - description: "Value of the token sold at time of execution in the original currency" - - &token_bought_amount_raw - name: token_bought_amount_raw - description: "Raw value of the token bought at time of execution in the original currency" - - &token_sold_amount_raw - name: token_sold_amount_raw - description: "Raw value of the token sold at time of execution in the original currency" - - &amount_usd - name: amount_usd - description: "USD value of the trade at time of execution" - - &token_bought_address - name: token_bought_address - description: "Contract address of the token bought" - - &token_sold_address - name: token_sold_address - description: "Contract address of the token sold" - - &taker - name: taker - description: "Address of trader who purchased a token" - - &maker - name: maker - description: "Address of trader who sold a token" - - &pool_id - name: pool_id - description: "Unique encoded identifier that refers to each pool" - - &swap_fee - name: swap_fee - description: 'Swap fee' - - &project_contract_address - name: project_contract_address - description: "Pool address" - - &pool_symbol - name: pool_symbol - description: "Token symbols, followed by their respective weights, if applicable" - - &pool_type - name: pool_type - description: "Pool attributes, determined by the pool's factory" - - &tx_hash - name: tx_hash - description: "Tx. Hash" - - &tx_from - name: tx_from - description: "transaction.from" - - &tx_to - name: tx_to - description: "transaction.to" - - &evt_index - name: evt_index - description: 'Event index' \ No newline at end of file diff --git a/models/_project/balancer/vebal/ethereum/_schema.yml b/models/_project/balancer/vebal/ethereum/_schema.yml deleted file mode 100644 index ab2ba4d4bdf..00000000000 --- a/models/_project/balancer/vebal/ethereum/_schema.yml +++ /dev/null @@ -1,91 +0,0 @@ -version: 2 - -models: - - name: balancer_ethereum_vebal_balances_day - meta: - blockchain: ethereum - project: balancer - contributors: markusbkoch, mendesfabio, victorstefenon, viniabussafi - config: - tags: ['balancer', 'ethereum', 'vebal', 'day'] - description: > - Daily balances of veBAL per wallet - Depends on veBAL_call_create_lock, veBAL_evt_Deposit and veBAL_evt_Withdraw - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - day - - wallet_address - columns: - - name: day - - name: wallet_address - description: "Address of the wallet holding the veBAL" - - name: bpt_balance - description: "Amount of BPT held in the veBAL lock" - - name: vebal_balance - description: "Amount of veBAL" - - name: lock_time - description: "Amount of time the BPT was locked for at the last time the lock was updated" - - - name: balancer_ethereum_vebal_slopes - meta: - blockchain: ethereum - project: balancer - contributors: markusbkoch, mendesfabio, victorstefenon, viniabussafi - config: - tags: ['balancer', 'ethereum', 'vebal', 'slope'] - description: > - Slope and bias of veBAL per wallet after each balance update - Depends on veBAL_call_create_lock, veBAL_evt_Deposit and veBAL_evt_Withdraw - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - block_number - - wallet_address - columns: - - name: block_number - - name: block_time - - name: block_timestamp - description: "Block timestamp" - - name: wallet_address - description: "Address of the wallet holding the veBAL" - - name: bpt_balance - description: "Amount of BPT held in the veBAL lock" - - name: unlocked_at - description: "Timestamp at which B-80BAL-20WETH BPT can be unlocked" - - name: slope - description: "veBAL decay rate (per second)" - - name: bias - description: "veBAL balance at the moment user locks or re-locks" - - name: block_date - description: "Block time trunc to date" - - - name: balancer_ethereum_vebal_votes - meta: - blockchain: ethereum - project: balancer - contributors: markusbkoch, mendesfabio, stefenon, viniabussafi - config: - tags: ['balancer', 'ethereum', 'vebal', 'votes'] - description: > - Records of votes for Balancer gauges by provider at each voting round - Depends on GaugeController_evt_VoteForGauge and the vebal_slopes spell - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - round_id - - gauge - - provider - columns: - - name: round_id - description: "ID of the voting round" - - name: start_date - description: "Day of the voting round start date" - - name: end_date - description: "Day of the voting round end date" - - name: gauge - description: "Address of the gauge which provider votes for" - - name: provider - description: "Address of the wallet which voted for the gauge" - - name: vote - description: "Weight of the vote performed by the provider for the gauge" \ No newline at end of file diff --git a/models/_project/balancer/pools/arbitrum/balancer_arbitrum_pools_tokens_weights.sql b/models/balancer/arbitrum/balancer_arbitrum_pools_tokens_weights.sql similarity index 100% rename from models/_project/balancer/pools/arbitrum/balancer_arbitrum_pools_tokens_weights.sql rename to models/balancer/arbitrum/balancer_arbitrum_pools_tokens_weights.sql diff --git a/models/balancer/arbitrum/balancer_arbitrum_schema.yml b/models/balancer/arbitrum/balancer_arbitrum_schema.yml new file mode 100644 index 00000000000..c533ff3ff10 --- /dev/null +++ b/models/balancer/arbitrum/balancer_arbitrum_schema.yml @@ -0,0 +1,432 @@ +version: 2 + +models: + - name: balancer_v2_arbitrum_pools_fees + meta: + blockchain: arbitrum + project: balancer_v2 + contributors: jacektrocinski, thetroyharris, viniabussafi + config: + tags: ['arbitrum', 'balancer', 'pools_fees'] + description: > + Balancer v2 swap fees stored at the pool level. + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - block_number + - tx_hash + - index + columns: + - name: blockchain + - name: version + - &contract_address + name: contract_address + description: 'Arbitrum address for the liquidity pool used in transaction' + tests: + - not_null + - &tx_hash + name: tx_hash + description: 'Transaction hash' + tests: + - not_null + - &index + name: index + description: '' + tests: + - not_null + - &tx_index + name: tx_index + description: '' + tests: + - not_null + - &block_time + name: block_time + description: 'Block time in UTC' + tests: + - not_null + - &block_number + name: block_number + description: '' + tests: + - not_null + - &swap_fee_percentage + name: swap_fee_percentage + description: 'Swap fees for the pool, values are returned with 18 decimals (1e18 meaning 100%)' + tests: + - not_null + + - name: balancer_v2_arbitrum_transfers_bpt + meta: + blockchain: arbitrum + project: balancer_v2 + contributors: victorstefenon, thetroyharris, viniabussafi + config: + tags: ['arbitrum', 'bpt', 'transfers'] + description: > + Balancer Pool Token (BPT) transfer logs on Balancer, an automated portfolio manager and trading platform, on Arbitrum. + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - evt_tx_hash + - evt_index + - block_date + columns: + - &blockchain + name: blockchain + description: "Blockchain" + - name: version + - *contract_address + - &block_date + name: block_date + description: "UTC event block date of each DEX trade" + - &block_month + name: block_month + description: "UTC event block month of each DEX trade" + - &evt_tx_hash + name: evt_tx_hash + description: 'Transaction hash of transfer event' + - &evt_index + name: evt_index + description: 'Event index' + - &evt_block_time + name: evt_block_time + description: 'Block time of transfer event' + - &evt_block_number + name: evt_block_number + description: 'Block number of transfer event' + - &from + name: from + description: 'Address of BPT provider of transfer event' + - &to + name: to + description: 'Address of BPT receiver of transfer event' + - &value + name: value + description: 'Amount of BPT transferred in transfer event' + + - name: balancer_arbitrum_pools_tokens_weights + meta: + blockchain: arbitrum + project: balancer + contributors: jacektrocinski, viniabussafi + config: + tags: ['arbitrum', 'balancer', 'pools', 'tokens', 'weights'] + description: > + Token weights in Balancer pools. + columns: + - *blockchain + - name: version + - &pool_id + name: pool_id + description: 'Unique encoded identifier that refers to each pool' + tests: + - not_null + - &token_address + name: token_address + description: 'Contract address for the token' + - &normalized_weight + name: normalized_weight + description: 'Weight of the token in the pool.' + + - name: balancer_v2_arbitrum_pools_tokens_weights + meta: + blockchain: arbitrum + project: balancer + contributors: jacektrocinski, viniabussafi + config: + tags: ['arbitrum', 'balancer', 'pools', 'tokens', 'weights'] + description: > + Token weights in Balancer v2 pools. + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - pool_id + - token_address + columns: + - *blockchain + - name: version + - *pool_id + - *token_address + - *normalized_weight + + - name: balancer_arbitrum_trades + meta: + blockchain: arbitrum + sector: dex + contributors: bizzyvinci + config: + tags: ['balancer', 'arbitrum', 'amm', 'trades', 'dex'] + description: > + DEX trades on balancer on arbitrum + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - block_date + - blockchain + - project + - version + - tx_hash + - evt_index + - check_dex_seed: + blockchain: arbitrum + project: balancer + version: 2 + columns: + - *blockchain + - &project + name: project + description: "Project name (balancer)" + - &version + name: version + description: "Version of the project" + - *block_month + - *block_date + - *block_time + - &token_bought_symbol + name: token_bought_symbol + description: "Token symbol for token bought in the trade" + - &token_sold_symbol + name: token_sold_symbol + description: "Token symbol for token sold in the trade" + - &token_pair + name: token_pair + description: "Token symbol pair for each token involved in the trade" + - &token_bought_amount + name: token_bought_amount + description: "Value of the token bought at time of execution in the original currency" + - &token_sold_amount + name: token_sold_amount + description: "Value of the token sold at time of execution in the original currency" + - &token_bought_amount_raw + name: token_bought_amount_raw + description: "Raw value of the token bought at time of execution in the original currency" + - &token_sold_amount_raw + name: token_sold_amount_raw + description: "Raw value of the token sold at time of execution in the original currency" + - &amount_usd + name: amount_usd + description: "USD value of the trade at time of execution" + - &token_bought_address + name: token_bought_address + description: "Contract address of the token bought" + - &token_sold_address + name: token_sold_address + description: "Contract address of the token sold" + - &taker + name: taker + description: "Address of trader who purchased a token" + - &maker + name: maker + description: "Address of trader who sold a token" + - *pool_id + - &swap_fee + name: swap_fee + description: 'Swap fee' + - &project_contract_address + name: project_contract_address + description: "Pool address" + - name: pool_symbol + - name: pool_type + - *tx_hash + - &tx_from + name: tx_from + description: "transaction.from" + - &tx_to + name: tx_to + description: "transaction.to" + - *evt_index + + - name: balancer_v2_arbitrum_trades + meta: + blockchain: arbitrum + sector: dex + contributors: bizzyvinci, thetroyharris, tomfutago, viniabussafi + config: + tags: [ 'balancer', 'arbitrum', 'amm', 'trades', 'dex', 'beta' ] + description: > + DEX trades on balancer v2 on arbitrum + columns: + - *blockchain + - *project + - *version + - *block_month + - *block_date + - *block_time + - *block_number + - *token_bought_symbol + - *token_sold_symbol + - *token_pair + - *token_bought_amount + - *token_sold_amount + - *token_bought_amount_raw + - *token_sold_amount_raw + - *amount_usd + - *token_bought_address + - *token_sold_address + - *taker + - *maker + - *project_contract_address + - name: pool_symbol + - name: pool_type + - *pool_id + - *swap_fee + - *tx_hash + - *tx_from + - *tx_to + - *evt_index + + - name: balancer_v2_arbitrum_liquidity + meta: + blockchain: arbitrum + project: balancer_v2 + contributors: victorstefenon, viniabussafi, thetroyharris + config: + tags: ['arbitrum', 'balancer', 'pools', 'liquidity'] + description: > + Balancer v2 pools liquidity by token in Arbitrum. + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - day + - pool_id + - token_address + columns: + - name: day + description: 'UTC event block time truncated to the day mark' + - *pool_id + - name: pool_address + - name: pool_symbol + description: 'Symbol of the pool, consisting of the symbol of its tokens and their respective weights' + - name: version + description: 'Version of Balancer in which pool was deployed' + - name: blockchain + description: 'Blockchain in which pool was deployed' + - *token_address + - name: token_symbol + description: 'Symbol of the token' + - name: token_balance_raw + description: 'Raw balance of the token in the pool' + - name: token_balance + description: 'Scaled balance of the token in the pool' + - name: protocol_liquidity_usd + description: 'Liquidity of the token in the pool in USD, except BPTs' + - name: protocol_liquidity_eth + description: 'Liquidity of the token in the pool in ETH, except BPTs' + - name: pool_liquidity_usd + description: 'Liquidity of the token in the pool in USD, including BPTs' + - name: pool_liquidity_eth + description: 'Liquidity of the token in the pool in ETH, including BPTs' + + + - name: balancer_v2_arbitrum_flashloans + meta: + blockchain: arbitrum + sector: lending + contributors: hildobby + config: + tags: ['arbitrum', 'flashloans'] + description: > + All Balancer v2 flashloans on Arbitrum + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - blockchain + - tx_hash + - evt_index + columns: + - name: blockchain + - name: project + - name: version + - name: block_time + - name: block_number + - name: amount + - name: amount_usd + - name: tx_hash + - name: evt_index + - name: fee + - name: currency_contract + - name: currency_symbol + - name: recipient + - name: contract_address + - name: block_month + + - name: balancer_v2_arbitrum_bpt_prices + meta: + blockchain: arbitrum + project: balancer_v2 + contributors: victorstefenon, thetroyharris, viniabussafi + config: + tags: ['arbitrum', 'bpt', 'prices'] + description: > + Balancer Pool Token (BPT) daily price by pool on Balancer, an automated portfolio manager and trading platform. + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - blockchain + - day + - contract_address + columns: + - name: blockchain + - name: day + - name: version + - name: decimals + - name: contract_address + - name: bpt_price + + - name: balancer_v2_arbitrum_protocol_fee + meta: + blockchain: arbitrum + project: balancer_v2 + contributors: viniabussafi + config: + tags: ['arbitrum', 'revenue', 'fees'] + description: > + Daily Protocol Fee collected and Revenue by pool on Balancer, an automated portfolio manager and trading platform. + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - day + - pool_id + - token_address + columns: + - name: day + - name: pool_id + - name: pool_address + - name: pool_symbol + - name: version + - name: blockchain + - name: token_address + - name: token_symbol + - name: token_amount_raw + description: "Raw amount of revenues of the token in the pool" + - name: token_amount + description: "Amount of revenues of the token in the pool" + - name: protocol_fee_collected_usd + description: "Fee collected in the pool in USD" + - name: treasury_share + description: "Share of total revenue that is directed to Balancer DAO's treasury, as per BIPs 19, 161 and 371" + - name: treasury_revenue_usd + description: "Total revenue directed to Balancer DAO's treasury" + + - name: balancer_v2_arbitrum_bpt_supply + meta: + blockchain: arbiturm + project: balancer_v2 + contributors: thetroyharris, viniabussafi + config: + tags: ['arbiturm', 'bpt', 'supply'] + description: > + Balancer Pool Token (BPT) supply for ComposableStablePools versions 4 and 5. + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - day + - blockchain + - token_address + columns: + - name: day + - name: pool_type + - name: version + - name: blockchain + - name: token_address + - name: supply \ No newline at end of file diff --git a/models/_project/balancer/trades/arbitrum/balancer_arbitrum_trades.sql b/models/balancer/arbitrum/balancer_arbitrum_trades.sql similarity index 100% rename from models/_project/balancer/trades/arbitrum/balancer_arbitrum_trades.sql rename to models/balancer/arbitrum/balancer_arbitrum_trades.sql diff --git a/models/_project/balancer/bpt/arbitrum/balancer_v2_arbitrum_bpt_prices.sql b/models/balancer/arbitrum/balancer_v2_arbitrum_bpt_prices.sql similarity index 100% rename from models/_project/balancer/bpt/arbitrum/balancer_v2_arbitrum_bpt_prices.sql rename to models/balancer/arbitrum/balancer_v2_arbitrum_bpt_prices.sql diff --git a/models/_project/balancer/bpt/arbitrum/balancer_v2_arbitrum_bpt_supply.sql b/models/balancer/arbitrum/balancer_v2_arbitrum_bpt_supply.sql similarity index 100% rename from models/_project/balancer/bpt/arbitrum/balancer_v2_arbitrum_bpt_supply.sql rename to models/balancer/arbitrum/balancer_v2_arbitrum_bpt_supply.sql diff --git a/models/_project/balancer/flashloans/arbitrum/balancer_v2_arbitrum_flashloans.sql b/models/balancer/arbitrum/balancer_v2_arbitrum_flashloans.sql similarity index 88% rename from models/_project/balancer/flashloans/arbitrum/balancer_v2_arbitrum_flashloans.sql rename to models/balancer/arbitrum/balancer_v2_arbitrum_flashloans.sql index bf21ac0ece7..52ec11d81ee 100644 --- a/models/_project/balancer/flashloans/arbitrum/balancer_v2_arbitrum_flashloans.sql +++ b/models/balancer/arbitrum/balancer_v2_arbitrum_flashloans.sql @@ -6,6 +6,10 @@ , file_format = 'delta' , incremental_strategy = 'merge' , unique_key = ['tx_hash', 'evt_index'] + , post_hook='{{ expose_spells(\'["arbitrum"]\', + "project", + "balancer_v2", + \'["hildobby"]\') }}' ) }} diff --git a/models/_project/balancer/liquidity/arbitrum/balancer_v2_arbitrum_liquidity.sql b/models/balancer/arbitrum/balancer_v2_arbitrum_liquidity.sql similarity index 52% rename from models/_project/balancer/liquidity/arbitrum/balancer_v2_arbitrum_liquidity.sql rename to models/balancer/arbitrum/balancer_v2_arbitrum_liquidity.sql index c32f49c73ac..c78ddea2ad7 100644 --- a/models/_project/balancer/liquidity/arbitrum/balancer_v2_arbitrum_liquidity.sql +++ b/models/balancer/arbitrum/balancer_v2_arbitrum_liquidity.sql @@ -6,7 +6,11 @@ schema = 'balancer_v2_arbitrum', alias = 'liquidity', materialized = 'table', - file_format = 'delta' + file_format = 'delta', + post_hook="{{ expose_spells('[\"" + blockchain + '"]' + '\', + "project", + "balancer_v2", + \'["stefenon", "viniabussafi"]\') }}' ) }} diff --git a/models/_project/balancer/pools/arbitrum/balancer_v2_arbitrum_pools_fees.sql b/models/balancer/arbitrum/balancer_v2_arbitrum_pools_fees.sql similarity index 75% rename from models/_project/balancer/pools/arbitrum/balancer_v2_arbitrum_pools_fees.sql rename to models/balancer/arbitrum/balancer_v2_arbitrum_pools_fees.sql index 39b5671f202..105650c0b9b 100644 --- a/models/_project/balancer/pools/arbitrum/balancer_v2_arbitrum_pools_fees.sql +++ b/models/balancer/arbitrum/balancer_v2_arbitrum_pools_fees.sql @@ -1,12 +1,17 @@ {{ config( - schema = 'balancer_v2_arbitrum', + schema = 'balancer_v2_arbitrum', + alias = 'pools_fees', materialized = 'incremental', file_format = 'delta', incremental_strategy = 'merge', - unique_key = ['block_number', 'tx_hash', 'index'] - ) + unique_key = ['block_number', 'tx_hash', 'index'], + post_hook='{{ expose_spells(\'["arbitrum"]\', + "project", + "balancer_v2", + \'["metacrypto", "jacektrocinski", "thetroyharris", "viniabussafi"]\') }}' + )  }} {% set event_signature = '0xa9ba3ffe0b6c366b81232caab38605a0699ad5398d6cce76f91ee809e322dafc' %} diff --git a/models/_project/balancer/pools/arbitrum/balancer_v2_arbitrum_pools_tokens_weights.sql b/models/balancer/arbitrum/balancer_v2_arbitrum_pools_tokens_weights.sql similarity index 99% rename from models/_project/balancer/pools/arbitrum/balancer_v2_arbitrum_pools_tokens_weights.sql rename to models/balancer/arbitrum/balancer_v2_arbitrum_pools_tokens_weights.sql index ae20e0126b1..16ee7481c9b 100644 --- a/models/_project/balancer/pools/arbitrum/balancer_v2_arbitrum_pools_tokens_weights.sql +++ b/models/balancer/arbitrum/balancer_v2_arbitrum_pools_tokens_weights.sql @@ -2,6 +2,7 @@ config( schema='balancer_v2_arbitrum', alias = 'pools_tokens_weights', + materialized = 'incremental', file_format = 'delta', incremental_strategy = 'merge', diff --git a/models/_project/balancer/protocol_fee/arbitrum/balancer_v2_arbitrum_protocol_fee.sql b/models/balancer/arbitrum/balancer_v2_arbitrum_protocol_fee.sql similarity index 100% rename from models/_project/balancer/protocol_fee/arbitrum/balancer_v2_arbitrum_protocol_fee.sql rename to models/balancer/arbitrum/balancer_v2_arbitrum_protocol_fee.sql diff --git a/models/_project/balancer/trades/arbitrum/balancer_v2_arbitrum_trades.sql b/models/balancer/arbitrum/balancer_v2_arbitrum_trades.sql similarity index 94% rename from models/_project/balancer/trades/arbitrum/balancer_v2_arbitrum_trades.sql rename to models/balancer/arbitrum/balancer_v2_arbitrum_trades.sql index 2baa6afd2b2..750f467f653 100644 --- a/models/_project/balancer/trades/arbitrum/balancer_v2_arbitrum_trades.sql +++ b/models/balancer/arbitrum/balancer_v2_arbitrum_trades.sql @@ -4,9 +4,9 @@ alias = 'trades', materialized = 'view', post_hook = '{{ expose_spells(\'["arbitrum"]\', - spell_type = "project", - spell_name = "balancer", - contributors = \'["mendesfabio", "jacektrocinski", "thetroyharris", "tomfutago", "viniabussafi"]\') }}' + "project", + "balancer_v2", + \'["mendesfabio", "jacektrocinski", "thetroyharris", "tomfutago", "viniabussafi"]\') }}' ) }} diff --git a/models/_project/balancer/bpt/arbitrum/balancer_v2_arbitrum_transfers_bpt.sql b/models/balancer/arbitrum/balancer_v2_arbitrum_transfers_bpt.sql similarity index 100% rename from models/_project/balancer/bpt/arbitrum/balancer_v2_arbitrum_transfers_bpt.sql rename to models/balancer/arbitrum/balancer_v2_arbitrum_transfers_bpt.sql diff --git a/models/_project/balancer/pools/avalanche_c/balancer_avalanche_c_pools_tokens_weights.sql b/models/balancer/avalanche_c/balancer_avalanche_c_pools_tokens_weights.sql similarity index 100% rename from models/_project/balancer/pools/avalanche_c/balancer_avalanche_c_pools_tokens_weights.sql rename to models/balancer/avalanche_c/balancer_avalanche_c_pools_tokens_weights.sql diff --git a/models/balancer/avalanche_c/balancer_avalanche_c_schema.yml b/models/balancer/avalanche_c/balancer_avalanche_c_schema.yml new file mode 100644 index 00000000000..93cc2e87629 --- /dev/null +++ b/models/balancer/avalanche_c/balancer_avalanche_c_schema.yml @@ -0,0 +1,405 @@ +version: 2 + +models: + + - name: balancer_avalanche_c_trades + meta: + blockchain: avalanche_c + sector: dex + contributors: bizzyvinci + config: + tags: ['balancer', 'avalanche_c', 'amm', 'trades', 'dex'] + description: > + DEX trades on balancer on avalanche_c + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - block_date + - blockchain + - project + - version + - tx_hash + - evt_index + - check_dex_seed: + blockchain: avalanche_c + project: balancer + version: 2 + columns: + - &blockchain + name: blockchain + description: "Blockchain" + - &project + name: project + description: "Project name (balancer)" + - &version + name: version + description: "Version of the project" + - &block_month + name: block_month + description: "Block month in UTC" + - &block_date + name: block_date + description: "Block date in UTC" + - &block_time + name: block_time + description: 'Block time in UTC' + - &token_bought_symbol + name: token_bought_symbol + description: "Token symbol for token bought in the trade" + - &token_sold_symbol + name: token_sold_symbol + description: "Token symbol for token sold in the trade" + - &token_pair + name: token_pair + description: "Token symbol pair for each token involved in the trade" + - &token_bought_amount + name: token_bought_amount + description: "Value of the token bought at time of execution in the original currency" + - &token_sold_amount + name: token_sold_amount + description: "Value of the token sold at time of execution in the original currency" + - &token_bought_amount_raw + name: token_bought_amount_raw + description: "Raw value of the token bought at time of execution in the original currency" + - &token_sold_amount_raw + name: token_sold_amount_raw + description: "Raw value of the token sold at time of execution in the original currency" + - &amount_usd + name: amount_usd + description: "USD value of the trade at time of execution" + - &token_bought_address + name: token_bought_address + description: "Contract address of the token bought" + - &token_sold_address + name: token_sold_address + description: "Contract address of the token sold" + - &taker + name: taker + description: "Address of trader who purchased a token" + - &maker + name: maker + description: "Address of trader who sold a token" + - &pool_id + name: pool_id + description: 'Unique encoded identifier that refers to each pool' + - &swap_fee + name: swap_fee + description: 'Swap fee' + - &project_contract_address + name: project_contract_address + description: "Pool address" + - name: pool_symbol + - name: pool_type + - &tx_hash + name: tx_hash + description: "Transaction hash" + - &tx_from + name: tx_from + description: "transaction.from" + - &tx_to + name: tx_to + description: "transaction.to" + - &evt_index + name: evt_index + description: "Event index" + + - name: balancer_v2_avalanche_c_trades + meta: + blockchain: avalanche_c + sector: dex + contributors: bizzyvinci, thetroyharris, tomfutago, viniabussafi + config: + tags: [ 'balancer', 'avalanche_c', 'amm', 'trades', 'dex', 'beta' ] + description: > + DEX trades on balancer v2 on avalanche_c + columns: + - *blockchain + - *project + - *version + - *block_month + - *block_date + - *block_time + - name: block_number + - *token_bought_symbol + - *token_sold_symbol + - *token_pair + - *token_bought_amount + - *token_sold_amount + - *token_bought_amount_raw + - *token_sold_amount_raw + - *amount_usd + - *token_bought_address + - *token_sold_address + - *taker + - *maker + - *project_contract_address + - name: pool_symbol + - name: pool_type + - *pool_id + - *swap_fee + - *tx_hash + - *tx_from + - *tx_to + - *evt_index + + - name: balancer_avalanche_c_pools_tokens_weights + meta: + blockchain: avalanche_c + project: balancer + contributors: jacektrocinski, viniabussafi + config: + tags: ['avalanche_c', 'balancer', 'pools', 'tokens', 'weights'] + description: > + Token weights in Balancer pools. + columns: + - *blockchain + - name: version + - *pool_id + - &token_address + name: token_address + description: 'Contract address for the token' + - &normalized_weight + name: normalized_weight + description: 'Weight of the token in the pool.' + + - name: balancer_v2_avalanche_c_pools_tokens_weights + meta: + blockchain: avalanche_c + project: balancer + contributors: jacektrocinski, viniabussafi + config: + tags: ['avalanche_c', 'balancer', 'pools', 'tokens', 'weights'] + description: > + Token weights in Balancer v2 pools. + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - pool_id + - token_address + columns: + - *blockchain + - name: version + - *pool_id + - *token_address + - *normalized_weight + + - name: balancer_v2_avalanche_c_liquidity + meta: + blockchain: avalanche_c + project: balancer_v2 + contributors: victorstefenon, viniabussafi, thetroyharris + config: + tags: ['avalanche_c', 'balancer', 'pools', 'liquidity'] + description: > + Balancer v2 pools liquidity by token in avalanche_c. + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - day + - pool_id + - token_address + columns: + - name: day + description: 'UTC event block time truncated to the day mark' + - *pool_id + - name: pool_address + - name: pool_symbol + description: 'Symbol of the pool, consisting of the symbol of its tokens and their respective weights' + - name: version + description: 'Version of Balancer in which pool was deployed' + - name: blockchain + description: 'Blockchain in which pool was deployed' + - *token_address + - name: token_symbol + description: 'Symbol of the token' + - name: token_balance_raw + description: 'Raw balance of the token in the pool' + - name: token_balance + description: 'Scaled balance of the token in the pool' + - name: protocol_liquidity_usd + description: 'Liquidity of the token in the pool in USD, except BPTs' + - name: protocol_liquidity_eth + description: 'Liquidity of the token in the pool in ETH, except BPTs' + - name: pool_liquidity_usd + description: 'Liquidity of the token in the pool in USD, including BPTs' + - name: pool_liquidity_eth + description: 'Liquidity of the token in the pool in ETH, including BPTs' + + + - name: balancer_v2_avalanche_c_bpt_prices + meta: + blockchain: avalanche_c + project: balancer_v2 + contributors: victorstefenon, thetroyharris, viniabussafi + config: + tags: ['avalanche_c', 'bpt', 'prices'] + description: > + Balancer Pool Token (BPT) hourly median price by pool on Balancer, an automated portfolio manager and trading platform. + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - blockchain + - day + - contract_address + columns: + - name: blockchain + - name: day + - name: version + - name: decimals + - name: contract_address + - name: bpt_price + + - name: balancer_v2_avalanche_c_transfers_bpt + meta: + blockchain: avalanche_c + project: balancer_v2 + contributors: victorstefenon, thetroyharris, viniabussafi + config: + tags: ['avalanche_c', 'bpt', 'transfers'] + description: > + Balancer Pool Token (BPT) transfer logs on Balancer, an automated portfolio manager and trading platform, on Avalanche C Chain. + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - evt_tx_hash + - evt_index + - block_date + columns: + - name: blockchain + - name: version + - name: contract_address + - name: block_date + - name: block_month + - name: evt_tx_hash + - name: evt_index + - &evt_block_time + name: evt_block_time + description: 'Block time of transfer event' + - &evt_block_number + name: evt_block_number + description: 'Block number of transfer event' + - &from + name: from + description: 'Address of BPT provider of transfer event' + - &to + name: to + description: 'Address of BPT receiver of transfer event' + - &value + name: value + description: 'Amount of BPT transferred in transfer event' + + - name: balancer_v2_avalanche_c_pools_fees + meta: + blockchain: avalanche_c + project: balancer_v2 + contributors: jacektrocinski, thetroyharris, viniabussafi + config: + tags: ['avalanche_c', 'balancer', 'pools', 'fees'] + description: > + Balancer v2 swap fees stored at the pool level. + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - block_number + - tx_hash + - index + columns: + - name: blockchain + - name: version + - name: contract_address + - name: tx_hash + - name: index + - name: tx_index + - name: block_time + - name: block_number + - name: swap_fee_percentage + + - name: balancer_v2_avalanche_c_flashloans + meta: + blockchain: avalanche_c + sector: lending + contributors: hildobby, viniabussafi + config: + tags: ['avalanche_c', 'flashloans'] + description: > + All Balancer v2 flashloans on avalanche_c + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - blockchain + - tx_hash + - evt_index + columns: + - name: blockchain + - name: project + - name: version + - name: block_time + - name: block_number + - name: amount + - name: amount_usd + - name: tx_hash + - name: evt_index + - name: fee + - name: currency_contract + - name: currency_symbol + - name: recipient + - name: contract_address + - name: block_month + + - name: balancer_v2_avalanche_c_protocol_fee + meta: + blockchain: avalanche_c + project: balancer_v2 + contributors: viniabussafi + config: + tags: ['avalanche_c', 'revenue', 'fees'] + description: > + Daily Protocol Fee collected and Revenue by pool on Balancer, an automated portfolio manager and trading platform. + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - day + - pool_id + - token_address + columns: + - name: day + - name: pool_id + - name: pool_address + - name: pool_symbol + - name: version + - name: blockchain + - name: token_address + - name: token_symbol + - name: token_amount_raw + description: "Raw amount of revenues of the token in the pool" + - name: token_amount + description: "Amount of revenues of the token in the pool" + - name: protocol_fee_collected_usd + description: "Fee collected in the pool in USD" + - name: treasury_share + description: "Share of total revenue that is directed to Balancer DAO's treasury, as per BIPs 19, 161 and 371" + - name: treasury_revenue_usd + description: "Total revenue directed to Balancer DAO's treasury" + + - name: balancer_v2_avalanche_c_bpt_supply + meta: + blockchain: avalanche_c + project: balancer_v2 + contributors: thetroyharris, viniabussafi + config: + tags: ['avalanche_c', 'bpt', 'supply'] + description: > + Balancer Pool Token (BPT) supply for ComposableStablePools versions 4 and 5. + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - day + - blockchain + - token_address + columns: + - name: day + - name: pool_type + - name: version + - name: blockchain + - name: token_address + - name: supply \ No newline at end of file diff --git a/models/_project/balancer/trades/avalanche_c/balancer_avalanche_c_trades.sql b/models/balancer/avalanche_c/balancer_avalanche_c_trades.sql similarity index 100% rename from models/_project/balancer/trades/avalanche_c/balancer_avalanche_c_trades.sql rename to models/balancer/avalanche_c/balancer_avalanche_c_trades.sql diff --git a/models/_project/balancer/bpt/avalanche_c/balancer_v2_avalanche_c_bpt_prices.sql b/models/balancer/avalanche_c/balancer_v2_avalanche_c_bpt_prices.sql similarity index 100% rename from models/_project/balancer/bpt/avalanche_c/balancer_v2_avalanche_c_bpt_prices.sql rename to models/balancer/avalanche_c/balancer_v2_avalanche_c_bpt_prices.sql diff --git a/models/_project/balancer/bpt/avalanche_c/balancer_v2_avalanche_c_bpt_supply.sql b/models/balancer/avalanche_c/balancer_v2_avalanche_c_bpt_supply.sql similarity index 100% rename from models/_project/balancer/bpt/avalanche_c/balancer_v2_avalanche_c_bpt_supply.sql rename to models/balancer/avalanche_c/balancer_v2_avalanche_c_bpt_supply.sql diff --git a/models/_project/balancer/flashloans/avalanche_c/balancer_v2_avalanche_c_flashloans.sql b/models/balancer/avalanche_c/balancer_v2_avalanche_c_flashloans.sql similarity index 88% rename from models/_project/balancer/flashloans/avalanche_c/balancer_v2_avalanche_c_flashloans.sql rename to models/balancer/avalanche_c/balancer_v2_avalanche_c_flashloans.sql index d4ec0d2e79d..eca6b3b0809 100644 --- a/models/_project/balancer/flashloans/avalanche_c/balancer_v2_avalanche_c_flashloans.sql +++ b/models/balancer/avalanche_c/balancer_v2_avalanche_c_flashloans.sql @@ -6,6 +6,10 @@ , file_format = 'delta' , incremental_strategy = 'merge' , unique_key = ['tx_hash', 'evt_index'] + , post_hook='{{ expose_spells(\'["avalanche_c"]\', + "project", + "balancer_v2", + \'["hildobby", "viniabussafi"]\') }}' ) }} diff --git a/models/_project/balancer/liquidity/avalanche_c/balancer_v2_avalanche_c_liquidity.sql b/models/balancer/avalanche_c/balancer_v2_avalanche_c_liquidity.sql similarity index 53% rename from models/_project/balancer/liquidity/avalanche_c/balancer_v2_avalanche_c_liquidity.sql rename to models/balancer/avalanche_c/balancer_v2_avalanche_c_liquidity.sql index 30e2856d411..15b3912d3ee 100644 --- a/models/_project/balancer/liquidity/avalanche_c/balancer_v2_avalanche_c_liquidity.sql +++ b/models/balancer/avalanche_c/balancer_v2_avalanche_c_liquidity.sql @@ -6,7 +6,11 @@ schema = 'balancer_v2_avalanche_c', alias = 'liquidity', materialized = 'table', - file_format = 'delta' + file_format = 'delta', + post_hook="{{ expose_spells('[\"" + blockchain + '"]' + '\', + "project", + "balancer_v2", + \'["stefenon", "viniabussafi"]\') }}' ) }} diff --git a/models/_project/balancer/pools/avalanche_c/balancer_v2_avalanche_c_pools_fees.sql b/models/balancer/avalanche_c/balancer_v2_avalanche_c_pools_fees.sql similarity index 77% rename from models/_project/balancer/pools/avalanche_c/balancer_v2_avalanche_c_pools_fees.sql rename to models/balancer/avalanche_c/balancer_v2_avalanche_c_pools_fees.sql index e3aae2cdf1a..1b52e13c114 100644 --- a/models/_project/balancer/pools/avalanche_c/balancer_v2_avalanche_c_pools_fees.sql +++ b/models/balancer/avalanche_c/balancer_v2_avalanche_c_pools_fees.sql @@ -1,12 +1,17 @@ {{ config( schema = 'balancer_v2_avalanche_c', + alias = 'pools_fees', materialized = 'incremental', file_format = 'delta', incremental_strategy = 'merge', - unique_key = ['block_number', 'tx_hash', 'index'] - ) + unique_key = ['block_number', 'tx_hash', 'index'], + post_hook='{{ expose_spells(\'["avalanche_c"]\', + "project", + "balancer_v2", + \'["metacrypto", "jacektrocinski", "thetroyharris", "viniabussafi"]\') }}' + )  }} {% set event_signature = '0xa9ba3ffe0b6c366b81232caab38605a0699ad5398d6cce76f91ee809e322dafc' %} diff --git a/models/_project/balancer/pools/avalanche_c/balancer_v2_avalanche_c_pools_tokens_weights.sql b/models/balancer/avalanche_c/balancer_v2_avalanche_c_pools_tokens_weights.sql similarity index 99% rename from models/_project/balancer/pools/avalanche_c/balancer_v2_avalanche_c_pools_tokens_weights.sql rename to models/balancer/avalanche_c/balancer_v2_avalanche_c_pools_tokens_weights.sql index 48bbb28e693..730b6b327f5 100644 --- a/models/_project/balancer/pools/avalanche_c/balancer_v2_avalanche_c_pools_tokens_weights.sql +++ b/models/balancer/avalanche_c/balancer_v2_avalanche_c_pools_tokens_weights.sql @@ -2,6 +2,7 @@ config( schema='balancer_v2_avalanche_c', alias = 'pools_tokens_weights', + materialized = 'incremental', file_format = 'delta', incremental_strategy = 'merge', diff --git a/models/_project/balancer/protocol_fee/avalanche_c/balancer_v2_avalanche_c_protocol_fee.sql b/models/balancer/avalanche_c/balancer_v2_avalanche_c_protocol_fee.sql similarity index 100% rename from models/_project/balancer/protocol_fee/avalanche_c/balancer_v2_avalanche_c_protocol_fee.sql rename to models/balancer/avalanche_c/balancer_v2_avalanche_c_protocol_fee.sql diff --git a/models/_project/balancer/trades/avalanche_c/balancer_v2_avalanche_c_trades.sql b/models/balancer/avalanche_c/balancer_v2_avalanche_c_trades.sql similarity index 94% rename from models/_project/balancer/trades/avalanche_c/balancer_v2_avalanche_c_trades.sql rename to models/balancer/avalanche_c/balancer_v2_avalanche_c_trades.sql index d1a0eb61af5..54dfd905dbc 100644 --- a/models/_project/balancer/trades/avalanche_c/balancer_v2_avalanche_c_trades.sql +++ b/models/balancer/avalanche_c/balancer_v2_avalanche_c_trades.sql @@ -4,10 +4,10 @@ alias = 'trades', materialized = 'view', post_hook = '{{ expose_spells(\'["avalanche_c"]\', - spell_type = "project", - spell_name = "balancer", - contributors = \'["mendesfabio", "jacektrocinski", "thetroyharris", "tomfutago", "viniabussafi"]\') }}' - ) + "project", + "balancer_v2", + \'["mendesfabio", "jacektrocinski", "thetroyharris", "tomfutago", "viniabussafi"]\') }}' + ) }} WITH diff --git a/models/_project/balancer/bpt/avalanche_c/balancer_v2_avalanche_c_transfers_bpt.sql b/models/balancer/avalanche_c/balancer_v2_avalanche_c_transfers_bpt.sql similarity index 100% rename from models/_project/balancer/bpt/avalanche_c/balancer_v2_avalanche_c_transfers_bpt.sql rename to models/balancer/avalanche_c/balancer_v2_avalanche_c_transfers_bpt.sql diff --git a/models/_project/balancer/bpt/balancer_bpt_prices.sql b/models/balancer/balancer_bpt_prices.sql similarity index 69% rename from models/_project/balancer/bpt/balancer_bpt_prices.sql rename to models/balancer/balancer_bpt_prices.sql index 0a1180a8013..ad8502801b9 100644 --- a/models/_project/balancer/bpt/balancer_bpt_prices.sql +++ b/models/balancer/balancer_bpt_prices.sql @@ -1,10 +1,10 @@ {{ config( schema = 'balancer', alias = 'bpt_prices', - post_hook='{{ expose_spells(blockchains = \'["arbitrum", "avalanche_c", "base", "ethereum", "gnosis", "optimism", "polygon", "zkevm"]\', - spell_type = "project", - spell_name = "balancer", - contributors = \'["thetroyharris", "viniabussafi"]\') }}' + post_hook='{{ expose_spells(\'["ethereum", "arbitrum", "polygon", "gnosis", "optimism","avalanche_c", "base", "zkevm"]\', + "project", + "balancer", + \'["thetroyharris", "viniabussafi"]\') }}' ) }} diff --git a/models/_project/balancer/bpt/balancer_bpt_supply.sql b/models/balancer/balancer_bpt_supply.sql similarity index 68% rename from models/_project/balancer/bpt/balancer_bpt_supply.sql rename to models/balancer/balancer_bpt_supply.sql index e43ef846b55..a15ed33c911 100644 --- a/models/_project/balancer/bpt/balancer_bpt_supply.sql +++ b/models/balancer/balancer_bpt_supply.sql @@ -1,10 +1,10 @@ {{ config( schema = 'balancer', alias = 'bpt_supply', - post_hook = '{{ expose_spells(blockchains = \'["arbitrum", "avalanche_c", "base", "ethereum", "gnosis", "optimism", "polygon", "zkevm"]\', - spell_type = "project", - spell_name = "balancer", - contributors = \'["thetroyharris", "viniabussafi"]\') }}' + post_hook = '{{ expose_spells(\'["arbitrum", "avalanche_c", "base", "ethereum", "gnosis", "optimism", "polygon", "zkevm"]\', + "project", + "balancer", + \'["thetroyharris", "viniabussafi"]\') }}' ) }} diff --git a/models/_project/balancer/flashloans/balancer_flashloans.sql b/models/balancer/balancer_flashloans.sql similarity index 69% rename from models/_project/balancer/flashloans/balancer_flashloans.sql rename to models/balancer/balancer_flashloans.sql index 19f69ad6231..bf79fcbf7f9 100644 --- a/models/_project/balancer/flashloans/balancer_flashloans.sql +++ b/models/balancer/balancer_flashloans.sql @@ -1,10 +1,10 @@ {{ config( - schema = 'balancer', + alias = 'flashloans', - post_hook='{{ expose_spells(blockchains = \'["arbitrum", "avalanche_c", "base", "ethereum", "gnosis", "optimism", "polygon", "zkevm"]\', - spell_type = "project", - spell_name = "balancer", - contributors = \'["hildobby", "viniabussafi"]\') }}' + post_hook='{{ expose_spells(\'["ethereum","arbitrum", "optimism", "polygon", "gnosis", "avalanche_c", "base", "zkevm"]\', + "project", + "balancer", + \'["hildobby", "viniabussafi"]\') }}' ) }} @@ -19,6 +19,7 @@ ref('balancer_v2_ethereum_flashloans') , ref('balancer_v2_zkevm_flashloans') ] %} + SELECT * FROM ( {% for flash_model in balancer_models %} diff --git a/models/_project/balancer/pools/balancer_gauge_mappings.sql b/models/balancer/balancer_gauge_mappings.sql similarity index 78% rename from models/_project/balancer/pools/balancer_gauge_mappings.sql rename to models/balancer/balancer_gauge_mappings.sql index 0ad73a0a700..b764f659dde 100644 --- a/models/_project/balancer/pools/balancer_gauge_mappings.sql +++ b/models/balancer/balancer_gauge_mappings.sql @@ -1,10 +1,11 @@ {{ config( schema = 'balancer', + alias = 'gauge_mappings', post_hook='{{ expose_spells(\'["optimism"]\', - spell_type = "project", - spell_name = "balancer", - contributors = \'["msilb7"]\') }}' + "project", + "balancer", + \'["msilb7"]\') }}' ) }} diff --git a/models/_project/balancer/liquidity/balancer_liquidity.sql b/models/balancer/balancer_liquidity.sql similarity index 74% rename from models/_project/balancer/liquidity/balancer_liquidity.sql rename to models/balancer/balancer_liquidity.sql index 57fb1122ef5..0f003bc5d6d 100644 --- a/models/_project/balancer/liquidity/balancer_liquidity.sql +++ b/models/balancer/balancer_liquidity.sql @@ -2,10 +2,11 @@ schema = 'balancer', alias = 'liquidity', - post_hook='{{ expose_spells(blockchains = \'["arbitrum", "avalanche_c", "base", "ethereum", "gnosis", "optimism", "polygon", "zkevm"]\', - spell_type = "project", - spell_name = "balancer", - contributors = \'["viniabussafi"]\') }}' + post_hook='{{ expose_spells(\'["ethereum","arbitrum", "optimism", "polygon", "gnosis","avalanche_c", "base", "zkevm" + ]\', + "project", + "balancer", + \'["viniabussafi"]\') }}' ) }} diff --git a/models/_project/balancer/pools/balancer_pools_fees.sql b/models/balancer/balancer_pools_fees.sql similarity index 69% rename from models/_project/balancer/pools/balancer_pools_fees.sql rename to models/balancer/balancer_pools_fees.sql index 2a54b518ec1..e638f381024 100644 --- a/models/_project/balancer/pools/balancer_pools_fees.sql +++ b/models/balancer/balancer_pools_fees.sql @@ -1,10 +1,11 @@ {{ config( schema = 'balancer', + alias = 'pools_fees', - post_hook='{{ expose_spells(blockchains = \'["arbitrum", "avalanche_c", "base", "ethereum", "gnosis", "optimism", "polygon", "zkevm"]\', - spell_type = "project", - spell_name = "balancer", - contributors = \'["thetroyharris", "viniabussafi"]\') }}' + post_hook='{{ expose_spells(\'["arbitrum", "avalanche_c", "base", "ethereum", "gnosis", "optimism", "polygon", "zkevm"]\', + "project", + "balancer", + \'["thetroyharris", "viniabussafi"]\') }}' ) }} diff --git a/models/_project/balancer/pools/balancer_pools_metrics_daily.sql b/models/balancer/balancer_pools_metrics_daily.sql similarity index 100% rename from models/_project/balancer/pools/balancer_pools_metrics_daily.sql rename to models/balancer/balancer_pools_metrics_daily.sql diff --git a/models/_project/balancer/pools/balancer_pools_tokens_weights.sql b/models/balancer/balancer_pools_tokens_weights.sql similarity index 71% rename from models/_project/balancer/pools/balancer_pools_tokens_weights.sql rename to models/balancer/balancer_pools_tokens_weights.sql index d2e50c49ce9..95a71d1c294 100644 --- a/models/_project/balancer/pools/balancer_pools_tokens_weights.sql +++ b/models/balancer/balancer_pools_tokens_weights.sql @@ -1,10 +1,10 @@ {{ config( schema = 'balancer', alias = 'pools_tokens_weights', - post_hook='{{ expose_spells(blockchains = \'["arbitrum", "avalanche_c", "base", "ethereum", "gnosis", "optimism", "polygon", "zkevm"]\', - spell_type = "project", - spell_name = "balancer", - contributors = \'["viniabussafi"]\') }}' + post_hook='{{ expose_spells(\'["arbitrum", "avalanche_c", "base", "ethereum", "gnosis", "optimism", "polygon"]\', + "project", + "balancer", + \'["viniabussafi"]\') }}' ) }} diff --git a/models/_project/balancer/protocol_fee/balancer_protocol_fee.sql b/models/balancer/balancer_protocol_fee.sql similarity index 75% rename from models/_project/balancer/protocol_fee/balancer_protocol_fee.sql rename to models/balancer/balancer_protocol_fee.sql index 37fef24dc85..d871a6aef89 100644 --- a/models/_project/balancer/protocol_fee/balancer_protocol_fee.sql +++ b/models/balancer/balancer_protocol_fee.sql @@ -1,10 +1,10 @@ {{ config( schema = 'balancer', alias = 'protocol_fee', - post_hook='{{ expose_spells(blockchains = \'["arbitrum", "avalanche_c", "base", "ethereum", "gnosis", "optimism", "polygon", "zkevm"]\', - spell_type = "project", - spell_name = "balancer", - contributors = \'["viniabussafi"]\') }}' + post_hook='{{ expose_spells(\'["ethereum", "arbitrum", "polygon", "gnosis", "optimism","avalanche_c", "base"]\', + "project", + "balancer", + \'["viniabussafi"]\') }}' ) }} diff --git a/models/balancer/balancer_schema.yml b/models/balancer/balancer_schema.yml new file mode 100644 index 00000000000..5e7fb29a97b --- /dev/null +++ b/models/balancer/balancer_schema.yml @@ -0,0 +1,365 @@ +version: 2 + +models: + - name: balancer_gauge_mappings + meta: + blockchain: optimism + sector: dex + contributors: msilb7 + config: + tags: ['balancer', 'amm', 'trades', 'dex', 'incentives'] + description: > + Gauge to Pool mappings for balancer on all chains + columns: + - &blockchain + name: blockchain + description: "Blockchain" + - &project + name: project + description: "Project name (balancer)" + - &version + name: version + description: "Version of the project" + - &pool_contract + name: pool_contract + description: "Address of the liquidity pool contract" + - &pool_id + name: pool_id + description: "Pool id" + - &incentives_contract + name: incentives_contract + description: "Address of the contract where incentives are stored and emitted." + - &incentives_type + name: incentives_type + description: "Description of the incentives address type." + - &evt_block_time + name: evt_block_time + description: 'Block time in UTC' + - &evt_block_number + name: evt_block_number + description: 'Block Number' + - &contract_address + name: contract_address + description: 'Gauge Creator Contract Address' + - &evt_tx_hash + name: evt_tx_hash + description: 'Tx Hash' + - &evt_index + name: evt_index + description: 'Event index' + + - name: balancer_flashloans + meta: + blockchain: ethereum, arbitrum, optimism, polygon, gnosis + sector: lending + contributors: hildobby + config: + tags: ['ethereum', 'arbitrum', 'optimism', 'polygon', 'gnosis','avalanche_c', 'base', 'flashloans'] + description: > + All Balancer flashloans + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - blockchain + - tx_hash + - evt_index + columns: + - name: blockchain + - name: project + - name: version + - name: block_time + - name: block_month + - name: block_number + - name: amount + - name: amount_usd + - name: tx_hash + - name: evt_index + - name: fee + - name: currency_contract + - name: currency_symbol + - name: recipient + - name: contract_address + - name: block_month + + - name: balancer_bpt_prices + meta: + blockchain: ethereum, arbitrum, optimism, polygon, gnosis, avalanche_c, base + sector: dex + contributors: thetroyharris, victorstefenon, viniabussafi + config: + tags: ['balancer', 'amm', 'dex', 'bpt', 'prices', 'ethereum', 'arbitrum', 'optimism', 'polygon', 'gnosis', 'avalanche_c', 'base'] + description: > + Balancer Pool Token (BPT) hourly median price by pool on Balancer, an automated portfolio manager and trading platform. + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - blockchain + - day + - contract_address + columns: + - name: blockchain + - name: day + - name: version + - name: decimals + - name: contract_address + - name: pool_type + - name: bpt_price + + - name: balancer_liquidity + meta: + blockchain: ethereum, arbitrum, optimism, polygon, gnosis, avalanche_c, base + project: balancer + contributors: viniabussafi + config: + tags: ['balancer', 'amm', 'dex', 'liquidity', 'ethereum', 'arbitrum', 'optimism', 'polygon', 'avalanche_c', 'base'] + description: > + Liquidity by token on Balancer, an automated portfolio manager and trading platform. + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - day + - pool_id + - blockchain + - token_address + - token_symbol + columns: + - name: day + description: 'UTC event block time truncated to the day mark' + - *pool_id + - name: pool_address + - name: pool_symbol + description: 'Symbol of the pool, consisting of the symbol of its tokens and their respective weights' + - name: version + description: 'Version of Balancer in which pool was deployed' + - name: blockchain + description: 'Blockchain in which pool was deployed' + - name: pool_type + - name: token_address + - name: token_symbol + description: 'Symbol of the token' + - name: token_balance_raw + description: 'Raw balance of the token in the pool' + - name: token_balance + description: 'Scaled balance of the token in the pool' + - name: protocol_liquidity_usd + description: 'Liquidity of the token in the pool in USD, except BPTs' + - name: protocol_liquidity_eth + description: 'Liquidity of the token in the pool in ETH, except BPTs' + - name: pool_liquidity_usd + description: 'Liquidity of the token in the pool in USD, including BPTs' + - name: pool_liquidity_eth + description: 'Liquidity of the token in the pool in ETH, including BPTs' + + + - name: balancer_transfers_bpt + meta: + blockchain: arbitrum, avalanche_c, base, ethereum, gnosis, optimism, polygon + contributors: victorstefenon, thetroyharris, viniabussafi + config: + tags: ['arbitrum', 'avalanche_c', 'base', 'ethereum', 'gnosis', 'optimism', 'polygon', 'bpt', 'transfers'] + description: > + Balancer Pool Token (BPT) transfer logs on Balancer, an automated portfolio manager and trading platform. + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - evt_tx_hash + - evt_index + - block_date + columns: + - *blockchain + - name: version + - *contract_address + - &block_date + name: block_date + description: "Block date in UTC" + - *evt_tx_hash + - *evt_index + - *evt_block_time + - *evt_block_number + - &from + name: from + description: 'Address of BPT provider of transfer event' + - &to + name: to + description: 'Address of BPT receiver of transfer event' + - &value + name: value + description: 'Amount of BPT transferred in transfer event' + + - name: balancer_pools_fees + meta: + blockchain: arbitrum, avalanche_c, base, ethereum, gnosis, optimism, polygon + contributors: jacektrocinski, thetroyharris, viniabussafi + config: + tags: ['arbitrum', 'avalanche_c', 'base', 'ethereum', 'gnosis', 'optimism', 'polygon', 'bpt', 'transfers'] + description: > + Balancer v2 swap fees stored at the pool level. + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - blockchain + - block_number + - tx_hash + - index + columns: + - name: blockchain + - name: version + - name: contract_address + - name: tx_hash + - name: index + - name: tx_index + - name: block_time + - name: block_number + - name: swap_fee_percentage + + - name: balancer_protocol_fee + meta: + blockchain: arbitrum, avalanche_c, base, ethereum, gnosis, optimism, polygon + project: balancer + contributors: viniabussafi + config: + tags: ['arbitrum', 'avalanche_c', 'base', 'ethereum', 'gnosis', 'optimism', 'polygon', 'revenue', 'fees'] + description: > + Daily Protocol Fee collected and Revenue by pool on Balancer, an automated portfolio manager and trading platform. + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - day + - pool_id + - token_address + columns: + - name: day + - *pool_id + - name: pool_address + - name: pool_symbol + - *version + - *blockchain + - name: pool_type + - name: token_address + - name: token_symbol + - name: token_amount_raw + description: "Raw amount of revenues of the token in the pool" + - name: token_amount + description: "Amount of revenues of the token in the pool" + - name: protocol_fee_collected_usd + description: "Fee collected in the pool in USD" + - name: treasury_share + description: "Share of total revenue that is directed to Balancer DAO's treasury, as per BIPs 19, 161 and 371" + - name: treasury_revenue_usd + description: "Total revenue directed to Balancer DAO's treasury" + + - name: balancer_bpt_supply + meta: + blockchain: arbitrum, avalanche_c, base, ethereum, gnosis, optimism, polygon + contributors: thetroyharris, viniabussafi + config: + tags: ['arbitrum', 'avalanche_c', 'base', 'ethereum', 'gnosis', 'optimism', 'polygon', 'bpt'] + description: > + The Balancer Pool Token (BPT) supply over time of ComposableStablePools versions 4+ + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - day + - blockchain + - token_address + columns: + - name: day + - name: pool_type + - name: version + - name: blockchain + - name: token_address + - name: supply + + - name: balancer_token_whitelist + meta: + blockchain: arbitrum, avalanche_c, base, ethereum, gnosis, optimism, polygon + contributors: viniabussafi + config: + tags: ['arbitrum', 'avalanche_c', 'base', 'ethereum', 'gnosis', 'optimism', 'polygon', 'bpt'] + description: > + These tokens are whitelisted to be used as pricing assets on liquidity calculations for weighted pools, due to the trustability of their data. + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - address + - name + - chain + columns: + - name: address + - name: name + - name: chain + + - name: balancer_pools_tokens_weights + meta: + blockchain: arbitrum, avalanche_c, base, ethereum, gnosis, optimism, polygon + contributors: jacektrocinski, viniabussafi + config: + tags: ['arbitrum', 'avalanche_c', 'base', 'ethereum', 'gnosis', 'optimism', 'polygon', 'bpt', 'transfers'] + description: > + Token weights in Balancer pools. + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - blockchain + - pool_id + - token_address + columns: + - *blockchain + - name: version + - *pool_id + - name: token_address + - name: normalized_weight + + - name: balancer_single_recipient_gauges + meta: + blockchain: ethereum + contributors: viniabussafi + config: + tags: ['ethereum', 'gauges'] + description: > + These gauges are deployed by the SingleRecipientGauge contract and this mapping manually links each gauge to it's correspondent pool and project + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - gauge_address + - pool_id + - project + - blockchain + columns: + - name: gauge_address + - name: pool_id + - name: project + - name: blockchain + + - name: balancer_pools_metrics_daily + meta: + blockchain: arbitrum, avalanche_c, base, ethereum, gnosis, optimism, polygon, zkevm + contributors: viniabussafi, metacrypto + config: + tags: ['arbitrum', 'avalanche_c', 'base', 'ethereum', 'gnosis', 'optimism', 'polygon', 'zkevm', 'balancer', 'pool', 'stats', 'volume', 'tvl', 'fee'] + description: > + This spell aggregates data from the trades, liquidity and protocol fees spells, by day and pool, while also displaying some basic information about the pool + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - block_date + - blockchain + - project + - version + - project_contract_address + columns: + - name: blockchain + - name: project + - name: version + - name: block_date + - name: project_contract_address + - name: pool_symbol + - name: pool_type + - name: swap_amount_usd + description: "Daily swap volume on a pool, in USD" + - name: tvl_usd + description: "Total Value Locked on a pool, in USD" + - name: tvl_eth + description: "Total Value Locked on a pool, in eth" + - name: fee_amount_usd + description: "Daily fees collected on a pool, in USD" \ No newline at end of file diff --git a/models/_project/balancer/support/balancer_single_recipient_gauges.sql b/models/balancer/balancer_single_recipient_gauges.sql similarity index 100% rename from models/_project/balancer/support/balancer_single_recipient_gauges.sql rename to models/balancer/balancer_single_recipient_gauges.sql diff --git a/models/_project/balancer/support/balancer_token_whitelist.sql b/models/balancer/balancer_token_whitelist.sql similarity index 100% rename from models/_project/balancer/support/balancer_token_whitelist.sql rename to models/balancer/balancer_token_whitelist.sql diff --git a/models/_project/balancer/bpt/balancer_transfers_bpt.sql b/models/balancer/balancer_transfers_bpt.sql similarity index 70% rename from models/_project/balancer/bpt/balancer_transfers_bpt.sql rename to models/balancer/balancer_transfers_bpt.sql index dda9c32ecb1..bd6fe9064c5 100644 --- a/models/_project/balancer/bpt/balancer_transfers_bpt.sql +++ b/models/balancer/balancer_transfers_bpt.sql @@ -1,10 +1,10 @@ {{ config( schema = 'balancer', alias = 'transfers_bpt', - post_hook='{{ expose_spells(blockchains = \'["arbitrum", "avalanche_c", "base", "ethereum", "gnosis", "optimism", "polygon", "zkevm"]\', - spell_type = "project", - spell_name = "balancer", - contributors = \'["thetroyharris", "victorstefenon", "viniabussafi"]\') }}' + post_hook='{{ expose_spells(\'["arbitrum", "avalanche_c", "base", "ethereum", "gnosis", "optimism", "polygon", "zkevm"]\', + "project", + "balancer", + \'["thetroyharris", "victorstefenon", "viniabussafi"]\') }}' ) }} diff --git a/models/_project/balancer/pools/base/balancer_base_pools_tokens_weights.sql b/models/balancer/base/balancer_base_pools_tokens_weights.sql similarity index 100% rename from models/_project/balancer/pools/base/balancer_base_pools_tokens_weights.sql rename to models/balancer/base/balancer_base_pools_tokens_weights.sql diff --git a/models/balancer/base/balancer_base_schema.yml b/models/balancer/base/balancer_base_schema.yml new file mode 100644 index 00000000000..d6e170e5536 --- /dev/null +++ b/models/balancer/base/balancer_base_schema.yml @@ -0,0 +1,405 @@ +version: 2 + +models: + + - name: balancer_base_trades + meta: + blockchain: base + sector: dex + contributors: bizzyvinci + config: + tags: ['balancer', 'base', 'amm', 'trades', 'dex'] + description: > + DEX trades on balancer on base + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - block_date + - blockchain + - project + - version + - tx_hash + - evt_index + - check_dex_seed: + blockchain: base + project: balancer + version: 2 + columns: + - &blockchain + name: blockchain + description: "Blockchain" + - &project + name: project + description: "Project name (balancer)" + - &version + name: version + description: "Version of the project" + - &block_month + name: block_month + description: "Block month in UTC" + - &block_date + name: block_date + description: "Block date in UTC" + - &block_time + name: block_time + description: 'Block time in UTC' + - &token_bought_symbol + name: token_bought_symbol + description: "Token symbol for token bought in the trade" + - &token_sold_symbol + name: token_sold_symbol + description: "Token symbol for token sold in the trade" + - &token_pair + name: token_pair + description: "Token symbol pair for each token involved in the trade" + - &token_bought_amount + name: token_bought_amount + description: "Value of the token bought at time of execution in the original currency" + - &token_sold_amount + name: token_sold_amount + description: "Value of the token sold at time of execution in the original currency" + - &token_bought_amount_raw + name: token_bought_amount_raw + description: "Raw value of the token bought at time of execution in the original currency" + - &token_sold_amount_raw + name: token_sold_amount_raw + description: "Raw value of the token sold at time of execution in the original currency" + - &amount_usd + name: amount_usd + description: "USD value of the trade at time of execution" + - &token_bought_address + name: token_bought_address + description: "Contract address of the token bought" + - &token_sold_address + name: token_sold_address + description: "Contract address of the token sold" + - &taker + name: taker + description: "Address of trader who purchased a token" + - &maker + name: maker + description: "Address of trader who sold a token" + - &pool_id + name: pool_id + description: 'Unique encoded identifier that refers to each pool' + - &swap_fee + name: swap_fee + description: 'Swap fee' + - &project_contract_address + name: project_contract_address + description: "Pool address" + - name: pool_symbol + - name: pool_type + - &tx_hash + name: tx_hash + description: "Transaction hash" + - &tx_from + name: tx_from + description: "transaction.from" + - &tx_to + name: tx_to + description: "transaction.to" + - &evt_index + name: evt_index + description: "Event index" + + - name: balancer_v2_base_trades + meta: + blockchain: base + sector: dex + contributors: bizzyvinci, thetroyharris, tomfutago, viniabussafi + config: + tags: [ 'balancer', 'base', 'amm', 'trades', 'dex', 'beta' ] + description: > + DEX trades on balancer v2 on base + columns: + - *blockchain + - *project + - *version + - *block_month + - *block_date + - *block_time + - name: block_number + - *token_bought_symbol + - *token_sold_symbol + - *token_pair + - *token_bought_amount + - *token_sold_amount + - *token_bought_amount_raw + - *token_sold_amount_raw + - *amount_usd + - *token_bought_address + - *token_sold_address + - *taker + - *maker + - *project_contract_address + - name: pool_symbol + - name: pool_type + - *pool_id + - *swap_fee + - *tx_hash + - *tx_from + - *tx_to + - *evt_index + + - name: balancer_v2_base_pools_fees + meta: + blockchain: base + project: balancer_v2 + contributors: jacektrocinski, thetroyharris, viniabussafi + config: + tags: ['base', 'balancer', 'pools', 'fees'] + description: > + Balancer v2 swap fees stored at the pool level. + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - block_number + - tx_hash + - index + columns: + - name: blockchain + - name: version + - name: contract_address + - name: tx_hash + - name: index + - name: tx_index + - name: block_time + - name: block_number + - name: swap_fee_percentage + + - name: balancer_base_pools_tokens_weights + meta: + blockchain: base + project: balancer + contributors: jacektrocinski, viniabussafi + config: + tags: ['base', 'balancer', 'pools', 'tokens', 'weights'] + description: > + Token weights in Balancer pools. + columns: + - *blockchain + - name: version + - *pool_id + - &token_address + name: token_address + description: 'Contract address for the token' + - &normalized_weight + name: normalized_weight + description: 'Weight of the token in the pool.' + + - name: balancer_v2_base_pools_tokens_weights + meta: + blockchain: base + project: balancer + contributors: jacektrocinski, viniabussafi + config: + tags: ['base', 'balancer', 'pools', 'tokens', 'weights'] + description: > + Token weights in Balancer v2 pools. + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - pool_id + - token_address + columns: + - *blockchain + - name: version + - *pool_id + - *token_address + - *normalized_weight + + - name: balancer_v2_base_liquidity + meta: + blockchain: base + project: balancer_v2 + contributors: victorstefenon, viniabussafi, thetroyharris + config: + tags: ['base', 'balancer', 'pools', 'liquidity'] + description: > + Balancer v2 pools liquidity by token in base. + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - day + - pool_id + - token_address + columns: + - name: day + description: 'UTC event block time truncated to the day mark' + - *pool_id + - name: pool_address + - name: pool_symbol + description: 'Symbol of the pool, consisting of the symbol of its tokens and their respective weights' + - name: version + description: 'Version of Balancer in which pool was deployed' + - name: blockchain + description: 'Blockchain in which pool was deployed' + - *token_address + - name: token_symbol + description: 'Symbol of the token' + - name: token_balance_raw + description: 'Raw balance of the token in the pool' + - name: token_balance + description: 'Scaled balance of the token in the pool' + - name: protocol_liquidity_usd + description: 'Liquidity of the token in the pool in USD, except BPTs' + - name: protocol_liquidity_eth + description: 'Liquidity of the token in the pool in ETH, except BPTs' + - name: pool_liquidity_usd + description: 'Liquidity of the token in the pool in USD, including BPTs' + - name: pool_liquidity_eth + description: 'Liquidity of the token in the pool in ETH, including BPTs' + + + - name: balancer_v2_base_bpt_prices + meta: + blockchain: base + project: balancer_v2 + contributors: victorstefenon, thetroyharris, viniabussafi + config: + tags: ['base', 'bpt', 'prices'] + description: > + Balancer Pool Token (BPT) hourly median price by pool on Balancer, an automated portfolio manager and trading platform. + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - blockchain + - day + - contract_address + columns: + - name: blockchain + - name: day + - name: version + - name: decimals + - name: contract_address + - name: bpt_price + + - name: balancer_v2_base_transfers_bpt + meta: + blockchain: base + project: balancer_v2 + contributors: victorstefenon, thetroyharris, viniabussafi + config: + tags: ['base', 'bpt', 'transfers'] + description: > + Balancer Pool Token (BPT) transfer logs on Balancer, an automated portfolio manager and trading platform, on Base. + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - evt_tx_hash + - evt_index + - block_date + columns: + - name: blockchain + - name: version + - name: contract_address + - name: block_date + - name: block_month + - name: evt_tx_hash + - name: evt_index + - &evt_block_time + name: evt_block_time + description: 'Block time of transfer event' + - &evt_block_number + name: evt_block_number + description: 'Block number of transfer event' + - &from + name: from + description: 'Address of BPT provider of transfer event' + - &to + name: to + description: 'Address of BPT receiver of transfer event' + - &value + name: value + description: 'Amount of BPT transferred in transfer event' + + - name: balancer_v2_base_flashloans + meta: + blockchain: base + sector: lending + contributors: hildobby, viniabussafi + config: + tags: ['base', 'flashloans'] + description: > + All Balancer v2 flashloans on base + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - blockchain + - tx_hash + - evt_index + columns: + - name: blockchain + - name: project + - name: version + - name: block_time + - name: block_number + - name: amount + - name: amount_usd + - name: tx_hash + - name: evt_index + - name: fee + - name: currency_contract + - name: currency_symbol + - name: recipient + - name: contract_address + - name: block_month + + - name: balancer_v2_base_protocol_fee + meta: + blockchain: base + project: balancer_v2 + contributors: viniabussafi + config: + tags: ['base', 'revenue', 'fees'] + description: > + Daily Protocol Fee collected and Revenue by pool on Balancer, an automated portfolio manager and trading platform. + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - day + - pool_id + - token_address + columns: + - name: day + - name: pool_id + - name: pool_address + - name: pool_symbol + - name: version + - name: blockchain + - name: token_address + - name: token_symbol + - name: token_amount_raw + description: "Raw amount of revenues of the token in the pool" + - name: token_amount + description: "Amount of revenues of the token in the pool" + - name: protocol_fee_collected_usd + description: "Fee collected in the pool in USD" + - name: treasury_share + description: "Share of total revenue that is directed to Balancer DAO's treasury, as per BIPs 19, 161 and 371" + - name: treasury_revenue_usd + description: "Total revenue directed to Balancer DAO's treasury" + + - name: balancer_v2_base_bpt_supply + meta: + blockchain: base + project: balancer_v2 + contributors: thetroyharris, viniabussafi + config: + tags: ['base', 'bpt', 'supply'] + description: > + Balancer Pool Token (BPT) supply for ComposableStablePools versions 4 and 5. + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - day + - blockchain + - token_address + columns: + - name: day + - name: pool_type + - name: version + - name: blockchain + - name: token_address + - name: supply \ No newline at end of file diff --git a/models/_project/balancer/trades/base/balancer_base_trades.sql b/models/balancer/base/balancer_base_trades.sql similarity index 100% rename from models/_project/balancer/trades/base/balancer_base_trades.sql rename to models/balancer/base/balancer_base_trades.sql diff --git a/models/_project/balancer/bpt/base/balancer_v2_base_bpt_prices.sql b/models/balancer/base/balancer_v2_base_bpt_prices.sql similarity index 100% rename from models/_project/balancer/bpt/base/balancer_v2_base_bpt_prices.sql rename to models/balancer/base/balancer_v2_base_bpt_prices.sql diff --git a/models/_project/balancer/bpt/base/balancer_v2_base_bpt_supply.sql b/models/balancer/base/balancer_v2_base_bpt_supply.sql similarity index 100% rename from models/_project/balancer/bpt/base/balancer_v2_base_bpt_supply.sql rename to models/balancer/base/balancer_v2_base_bpt_supply.sql diff --git a/models/_project/balancer/flashloans/base/balancer_v2_base_flashloans.sql b/models/balancer/base/balancer_v2_base_flashloans.sql similarity index 88% rename from models/_project/balancer/flashloans/base/balancer_v2_base_flashloans.sql rename to models/balancer/base/balancer_v2_base_flashloans.sql index da8cb9d2ae1..9438b88cf9c 100644 --- a/models/_project/balancer/flashloans/base/balancer_v2_base_flashloans.sql +++ b/models/balancer/base/balancer_v2_base_flashloans.sql @@ -6,6 +6,10 @@ , file_format = 'delta' , incremental_strategy = 'merge' , unique_key = ['tx_hash', 'evt_index'] + , post_hook='{{ expose_spells(\'["base"]\', + "project", + "balancer_v2", + \'["hildobby", "viniabussafi"]\') }}' ) }} diff --git a/models/_project/balancer/liquidity/base/balancer_v2_base_liquidity.sql b/models/balancer/base/balancer_v2_base_liquidity.sql similarity index 51% rename from models/_project/balancer/liquidity/base/balancer_v2_base_liquidity.sql rename to models/balancer/base/balancer_v2_base_liquidity.sql index 20f257ad753..10b08a41262 100644 --- a/models/_project/balancer/liquidity/base/balancer_v2_base_liquidity.sql +++ b/models/balancer/base/balancer_v2_base_liquidity.sql @@ -6,7 +6,11 @@ schema = 'balancer_v2_base', alias = 'liquidity', materialized = 'table', - file_format = 'delta' + file_format = 'delta', + post_hook="{{ expose_spells('[\"" + blockchain + '"]' + '\', + "project", + "balancer_v2", + \'["stefenon", "viniabussafi"]\') }}' ) }} diff --git a/models/_project/balancer/pools/base/balancer_v2_base_pools_fees.sql b/models/balancer/base/balancer_v2_base_pools_fees.sql similarity index 77% rename from models/_project/balancer/pools/base/balancer_v2_base_pools_fees.sql rename to models/balancer/base/balancer_v2_base_pools_fees.sql index c4029cb33d6..7aaf2ef8939 100644 --- a/models/_project/balancer/pools/base/balancer_v2_base_pools_fees.sql +++ b/models/balancer/base/balancer_v2_base_pools_fees.sql @@ -1,12 +1,17 @@ {{ config( schema = 'balancer_v2_base', + alias = 'pools_fees', materialized = 'incremental', file_format = 'delta', incremental_strategy = 'merge', - unique_key = ['block_number', 'tx_hash', 'index'] - ) + unique_key = ['block_number', 'tx_hash', 'index'], + post_hook='{{ expose_spells(\'["base"]\', + "project", + "balancer_v2", + \'["metacrypto", "jacektrocinski", "thetroyharris", "viniabussafi"]\') }}' + )  }} {% set event_signature = '0xa9ba3ffe0b6c366b81232caab38605a0699ad5398d6cce76f91ee809e322dafc' %} diff --git a/models/_project/balancer/pools/base/balancer_v2_base_pools_tokens_weights.sql b/models/balancer/base/balancer_v2_base_pools_tokens_weights.sql similarity index 99% rename from models/_project/balancer/pools/base/balancer_v2_base_pools_tokens_weights.sql rename to models/balancer/base/balancer_v2_base_pools_tokens_weights.sql index 531e3214489..29086428514 100644 --- a/models/_project/balancer/pools/base/balancer_v2_base_pools_tokens_weights.sql +++ b/models/balancer/base/balancer_v2_base_pools_tokens_weights.sql @@ -2,6 +2,7 @@ config( schema='balancer_v2_base', alias = 'pools_tokens_weights', + materialized = 'incremental', file_format = 'delta', incremental_strategy = 'merge', diff --git a/models/_project/balancer/protocol_fee/base/balancer_v2_base_protocol_fee.sql b/models/balancer/base/balancer_v2_base_protocol_fee.sql similarity index 100% rename from models/_project/balancer/protocol_fee/base/balancer_v2_base_protocol_fee.sql rename to models/balancer/base/balancer_v2_base_protocol_fee.sql diff --git a/models/_project/balancer/trades/base/balancer_v2_base_trades.sql b/models/balancer/base/balancer_v2_base_trades.sql similarity index 94% rename from models/_project/balancer/trades/base/balancer_v2_base_trades.sql rename to models/balancer/base/balancer_v2_base_trades.sql index b94589a490a..ccf037af146 100644 --- a/models/_project/balancer/trades/base/balancer_v2_base_trades.sql +++ b/models/balancer/base/balancer_v2_base_trades.sql @@ -4,9 +4,9 @@ alias = 'trades', materialized = 'view', post_hook = '{{ expose_spells(\'["base"]\', - spell_type = "project", - spell_name = "balancer", - contributors = \'["mendesfabio", "jacektrocinski", "thetroyharris", "tomfutago", "viniabussafi"]\') }}' + "project", + "balancer_v2", + \'["mendesfabio", "jacektrocinski", "thetroyharris", "tomfutago", "viniabussafi"]\') }}' ) }} diff --git a/models/_project/balancer/bpt/base/balancer_v2_base_transfers_bpt.sql b/models/balancer/base/balancer_v2_base_transfers_bpt.sql similarity index 100% rename from models/_project/balancer/bpt/base/balancer_v2_base_transfers_bpt.sql rename to models/balancer/base/balancer_v2_base_transfers_bpt.sql diff --git a/models/_project/balancer/balances/ethereum/balancer_ethereum_balances.sql b/models/balancer/ethereum/balancer_ethereum_balances.sql similarity index 88% rename from models/_project/balancer/balances/ethereum/balancer_ethereum_balances.sql rename to models/balancer/ethereum/balancer_ethereum_balances.sql index aa584c6c39d..bddec24d0bf 100644 --- a/models/_project/balancer/balances/ethereum/balancer_ethereum_balances.sql +++ b/models/balancer/ethereum/balancer_ethereum_balances.sql @@ -1,11 +1,11 @@ {{ config( - schema = 'balancer_ethereum', alias = 'balances', + post_hook='{{ expose_spells(\'["ethereum"]\', - spell_type = "project", - spell_name = "balancer", - contributors = \'["metacrypto", "jacektrocinski", "viniabussafi"]\') }}' + "project", + "balancer", + \'["metacrypto", "jacektrocinski", "viniabussafi"]\') }}' )  }} @@ -72,4 +72,5 @@ running_cumulative_balance_by_token AS ( LEFT JOIN cumulative_balance_by_token b ON b.day <= c.day AND c.day < b.day_of_next_change ) -SELECT * FROM running_cumulative_balance_by_token \ No newline at end of file +SELECT * FROM running_cumulative_balance_by_token + diff --git a/models/_project/balancer/pools/ethereum/balancer_ethereum_pools_tokens_weights.sql b/models/balancer/ethereum/balancer_ethereum_pools_tokens_weights.sql similarity index 100% rename from models/_project/balancer/pools/ethereum/balancer_ethereum_pools_tokens_weights.sql rename to models/balancer/ethereum/balancer_ethereum_pools_tokens_weights.sql diff --git a/models/balancer/ethereum/balancer_ethereum_schema.yml b/models/balancer/ethereum/balancer_ethereum_schema.yml new file mode 100644 index 00000000000..d2f899d1c61 --- /dev/null +++ b/models/balancer/ethereum/balancer_ethereum_schema.yml @@ -0,0 +1,665 @@ +version: 2 + +models: + - name: balancer_v2_ethereum_pools_fees + meta: + blockchain: ethereum + project: balancer_v2 + contributors: jacektrocinski, thetroyharris, viniabussafi + config: + tags: ['ethereum', 'balancer', 'pools', 'fees'] + description: > + Balancer v2 swap fees stored at the pool level. + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - block_number + - tx_hash + - index + columns: + - name: blockchain + - name: version + - &contract_address + name: contract_address + description: "Ethereum address for the liquidity pool used in transaction" + tests: + - not_null + - &tx_hash + name: tx_hash + description: "Transaction hash" + tests: + - not_null + - &index + name: index + description: "" + tests: + - not_null + - &tx_index + name: tx_index + description: "" + tests: + - not_null + - &block_time + name: block_time + description: "Block time in UTC" + tests: + - not_null + - &block_number + name: block_number + description: "Block number" + tests: + - not_null + - &swap_fee_percentage + name: swap_fee_percentage + description: "Swap fees for the pool, values are returned with 18 decimals (1e18 meaning 100%)" + tests: + - not_null + + - name: balancer_ethereum_balances + meta: + blockchain: ethereum + project: balancer + contributors: jacektrocinski + config: + tags: ['ethereum', 'balancer', 'balances'] + description: > + ERC20 token rolling sum balances on Balancer, an automated portfolio manager and trading platform. + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - day + - pool + - token + columns: + - &day + name: day + description: "UTC event block time truncated to the day mark" + tests: + - not_null + - &pool + name: pool + description: "Balancer pool contract address" + - &token + name: token + description: "Token contract address" + - &cumulative_amount + name: cumulative_amount + description: "Balance of a token" + + - name: balancer_v2_ethereum_transfers_bpt + meta: + blockchain: ethereum + project: balancer_v2 + contributors: victorstefenon, thetroyharris, viniabussafi + config: + tags: ['ethereum', 'bpt', 'transfers'] + description: > + Balancer Pool Token (BPT) transfer logs on Balancer, an automated portfolio manager and trading platform, on Ethereum. + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - evt_tx_hash + - evt_index + - block_date + columns: + - &blockchain + name: blockchain + description: "Blockchain" + - name: version + - *contract_address + - &block_date + name: block_date + description: "UTC event block date" + - &block_month + name: block_month + description: "UTC event block month" + - &evt_tx_hash + name: evt_tx_hash + description: "Transaction hash of transfer event" + - &evt_index + name: evt_index + description: "Event index" + - &evt_block_time + name: evt_block_time + description: "Block time of transfer event" + - &evt_block_number + name: evt_block_number + description: "Block number of transfer event" + - &from + name: from + description: "Address of BPT provider of transfer event" + - &to + name: to + description: "Address of BPT receiver of transfer event" + - &value + name: value + description: "Amount of BPT transferred in transfer event" + + - name: balancer_ethereum_pools_tokens_weights + meta: + blockchain: ethereum + project: balancer + contributors: jacektrocinski, viniabussafi + config: + tags: ['ethereum', 'balancer', 'pools', 'tokens', 'weights'] + description: > + Token weights in Balancer pools. + columns: + - *blockchain + - name: version + - &pool_id + name: pool_id + description: "Unique encoded identifier that refers to each pool" + - &token_address + name: token_address + description: "Contract address for the token" + - &normalized_weight + name: normalized_weight + description: "Weight of the token in the pool." + + - name: balancer_v1_ethereum_pools_tokens_weights + meta: + blockchain: ethereum + project: balancer + contributors: jacektrocinski, viniabussafi + config: + tags: ['ethereum', 'balancer', 'pools', 'tokens', 'weights'] + description: > + Token weights in Balancer v1 pools. + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - pool_id + - token_address + columns: + - *blockchain + - name: version + - *pool_id + - *token_address + - *normalized_weight + + - name: balancer_v2_ethereum_pools_tokens_weights + meta: + blockchain: ethereum + project: balancer + contributors: jacektrocinski, viniabussafi + config: + tags: ['ethereum', 'balancer', 'pools', 'tokens', 'weights'] + description: > + Token weights in Balancer v2 pools. + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - pool_id + - token_address + columns: + - *blockchain + - name: version + - *pool_id + - *token_address + - *normalized_weight + + - name: balancer_ethereum_vebal_balances_day + meta: + blockchain: ethereum + project: balancer + contibutors: markusbkoch, mendesfabio, victorstefenon + config: + tags: ['balancer', 'ethereum', 'vebal', 'day', 'markusbkoch', 'mendesfabio'] + description: > + Daily balances of veBAL per wallet + Depends on veBAL_call_create_lock, veBAL_evt_Deposit and veBAL_evt_Withdraw + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - day + - wallet_address + columns: + - *day + - name: wallet_address + description: "Address of the wallet holding the veBAL" + - name: bpt_balance + description: "Amount of BPT held in the veBAL lock" + - name: vebal_balance + description: "Amount of veBAL" + - name: lock_time + description: "Amount of time the BPT was locked for at the last time the lock was updated" + + - name: balancer_ethereum_vebal_slopes + meta: + blockchain: ethereum + project: balancer + contibutors: markusbkoch, mendesfabio, victorstefenon + config: + tags: ['balancer', 'ethereum', 'vebal', 'slope', 'markusbkoch', 'mendesfabio', 'victorstefenon'] + description: > + Slope and bias of veBAL per wallet after each balance update + Depends on veBAL_call_create_lock, veBAL_evt_Deposit and veBAL_evt_Withdraw + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - block_number + - wallet_address + columns: + - *block_number + - *block_time + - name: block_timestamp + description: "Block timestamp" + - name: wallet_address + description: "Address of the wallet holding the veBAL" + - name: bpt_balance + description: "Amount of BPT held in the veBAL lock" + - name: unlocked_at + description: "Timestamp at which B-80BAL-20WETH BPT can be unlocked" + - name: slope + description: "veBAL decay rate (per second)" + - name: bias + description: "veBAL balance at the moment user locks or re-locks" + - name: block_date + description: "Block time trunc to date" + + - name: balancer_ethereum_trades + meta: + blockchain: ethereum + sector: dex + contributors: bizzyvinci, thetroyharris + config: + tags: ['balancer', 'ethereum', 'amm', 'trades', 'dex'] + description: > + DEX trades on balancer on ethereum + columns: + - *blockchain + - &project + name: project + description: "Project name (balancer)" + - &version + name: version + description: "Version of the project" + - *block_month + - *block_date + - *block_time + - &token_bought_symbol + name: token_bought_symbol + description: "Token symbol for token bought in the trade" + - &token_sold_symbol + name: token_sold_symbol + description: "Token symbol for token sold in the trade" + - &token_pair + name: token_pair + description: "Token symbol pair for each token involved in the trade" + - &token_bought_amount + name: token_bought_amount + description: "Value of the token bought at time of execution in the original currency" + - &token_sold_amount + name: token_sold_amount + description: "Value of the token sold at time of execution in the original currency" + - &token_bought_amount_raw + name: token_bought_amount_raw + description: "Raw value of the token bought at time of execution in the original currency" + - &token_sold_amount_raw + name: token_sold_amount_raw + description: "Raw value of the token sold at time of execution in the original currency" + - &amount_usd + name: amount_usd + description: "USD value of the trade at time of execution" + - &token_bought_address + name: token_bought_address + description: "Contract address of the token bought" + - &token_sold_address + name: token_sold_address + description: "Contract address of the token sold" + - &taker + name: taker + description: "Address of trader who purchased a token" + - &maker + name: maker + description: "Address of trader who sold a token" + - *pool_id + - &swap_fee + name: swap_fee + description: 'Swap fee' + - &project_contract_address + name: project_contract_address + description: "Pool address" + - name: pool_symbol + - name: pool_type + - *tx_hash + - &tx_from + name: tx_from + description: "transaction.from" + - &tx_to + name: tx_to + description: "transaction.to" + - *evt_index + + - name: balancer_v1_ethereum_trades + meta: + blockchain: ethereum + sector: dex + contributors: bizzyvinci, thetroyharris, viniabussafi + config: + tags: [ 'balancer', 'ethereum', 'amm', 'trades', 'dex' ] + description: > + DEX trades on balancer v1 on ethereum + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - block_time + - tx_hash + - evt_index + - check_dex_seed: + blockchain: ethereum + project: balancer + version: 1 + columns: + - *blockchain + - *project + - *version + - *block_month + - *block_date + - *block_time + - *token_bought_symbol + - *token_sold_symbol + - *token_pair + - *token_bought_amount + - *token_sold_amount + - *token_bought_amount_raw + - *token_sold_amount_raw + - *amount_usd + - *token_bought_address + - *token_sold_address + - *taker + - *maker + - *pool_id + - *swap_fee + - *project_contract_address + - name: pool_symbol + - name: pool_type + - *tx_hash + - *tx_from + - *tx_to + - *evt_index + + - name: balancer_v2_ethereum_trades + meta: + blockchain: ethereum + sector: dex + contributors: bizzyvinci, thetroyharris, tomfutago, viniabussafi + config: + tags: [ 'balancer', 'ethereum', 'amm', 'trades', 'dex', 'beta' ] + description: > + DEX trades on balancer v2 on ethereum + columns: + - *blockchain + - *project + - *version + - *block_month + - *block_date + - *block_time + - *block_number + - *token_bought_symbol + - *token_sold_symbol + - *token_pair + - *token_bought_amount + - *token_sold_amount + - *token_bought_amount_raw + - *token_sold_amount_raw + - *amount_usd + - *token_bought_address + - *token_sold_address + - *taker + - *maker + - *project_contract_address + - name: pool_symbol + - name: pool_type + - *pool_id + - *swap_fee + - *tx_hash + - *tx_from + - *tx_to + - *evt_index + + - name: balancer_v2_ethereum_liquidity + meta: + blockchain: ethereum + project: balancer_v2 + contributors: victorstefenon, viniabussafi, thetroyharris + config: + tags: ['ethereum', 'balancer', 'pools', 'liquidity'] + description: > + Balancer v2 pools liquidity by token in Ethereum. + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - day + - pool_id + - token_address + columns: + - name: day + description: 'UTC event block time truncated to the day mark' + - *pool_id + - name: pool_address + - name: pool_symbol + description: 'Symbol of the pool, consisting of the symbol of its tokens and their respective weights' + - name: version + description: 'Version of Balancer in which pool was deployed' + - name: blockchain + description: 'Blockchain in which pool was deployed' + - *token_address + - name: token_symbol + description: 'Symbol of the token' + - name: token_balance_raw + description: 'Raw balance of the token in the pool' + - name: token_balance + description: 'Scaled balance of the token in the pool' + - name: protocol_liquidity_usd + description: 'Liquidity of the token in the pool in USD, except BPTs' + - name: protocol_liquidity_eth + description: 'Liquidity of the token in the pool in ETH, except BPTs' + - name: pool_liquidity_usd + description: 'Liquidity of the token in the pool in USD, including BPTs' + - name: pool_liquidity_eth + description: 'Liquidity of the token in the pool in ETH, including BPTs' + + - name: balancer_ethereum_vebal_votes + meta: + blockchain: ethereum + project: balancer + contibutors: markusbkoch, mendesfabio, stefenon + config: + tags: ['balancer', 'ethereum', 'vebal', 'votes', 'markusbkoch', 'mendesfabio', 'stefenon'] + description: > + Records of votes for Balancer gauges by provider at each voting round + Depends on GaugeController_evt_VoteForGauge and the vebal_slopes spell + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - round_id + - gauge + - provider + columns: + - name: round_id + description: "ID of the voting round" + - name: start_date + description: "Day of the voting round start date" + - name: end_date + description: "Day of the voting round end date" + - name: gauge + description: "Address of the gauge which provider votes for" + - name: provider + description: "Address of the wallet which voted for the gauge" + - name: vote + description: "Weight of the vote performed by the provider for the gauge" + + - name: balancer_v2_ethereum_lbps + meta: + blockchain: ethereum + project: balancer_v2 + contributors: stefenon + config: + tags: ['ethereum', 'balancer', 'lbp'] + description: > + Record of the Liquidity Boostrapping Pools (LBP) of Balancer, an automated portfolio manager and trading platform, on Ethereum. + columns: + - name: name + description: "Name of the LBP" + - name: pool_id + description: "ID of the LBP" + - name: token_sold + description: "Contract address of the token sold by the LBP" + - name: token_symbol + description: "Symbol of the token sold by the LBP" + - name: start_time + description: "LBP start time" + - name: end_time + description: "LBP end time" + + - name: balancer_v1_ethereum_liquidity + meta: + blockchain: ethereum + project: balancer_v1 + contributors: markusbkoch, mendesfabio, victorstefenon, viniabussafi, thetroyharris + config: + tags: ['ethereum', 'balancer', 'pools', 'liquidity'] + description: > + Balancer v1 pools liquidity by token in Ethereum. + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - day + - pool_id + - token_address + columns: + - name: day + description: "UTC event block time truncated to the day mark" + - *pool_id + - name: pool_address + - name: pool_symbol + description: "Symbol of the pool, consisting of the symbol of its tokens and their respective weights" + - name: version + description: "Version of Balancer in which pool was deployed" + - *blockchain + - *token_address + - name: token_symbol + description: "Symbol of the token" + - name: token_balance_raw + description: "Raw balance of the token in the pool" + - name: token_balance + description: "Scaled balance of the token in the pool" + - name: protocol_liquidity_usd + description: "Liquidity of the token in the pool in USD, except BPTs" + - name: pool_liquidity_usd + description: "Liquidity of the token in the pool in USD, including BPTs" + + - name: balancer_v2_ethereum_flashloans + meta: + blockchain: ethereum + sector: lending + contributors: hildobby + config: + tags: ['ethereum', 'flashloans'] + description: > + All Balancer flashloans on Ethereum + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - blockchain + - tx_hash + - evt_index + columns: + - name: blockchain + - name: project + - name: version + - name: block_time + - name: block_number + - name: amount + - name: amount_usd + - name: tx_hash + - name: evt_index + - name: fee + - name: currency_contract + - name: currency_symbol + - name: recipient + - name: contract_address + - name: block_month + + - name: balancer_v2_ethereum_bpt_prices + meta: + blockchain: ethereum + project: balancer_v2 + contributors: victorstefenon, thetroyharris, viniabussafi + config: + tags: ['ethereum', 'bpt', 'prices'] + description: > + Balancer Pool Token (BPT) hourly median price by pool on Balancer, an automated portfolio manager and trading platform. + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - blockchain + - day + - contract_address + columns: + - name: blockchain + - name: day + - name: version + - name: decimals + - name: contract_address + - name: bpt_price + + - name: balancer_v2_ethereum_protocol_fee + meta: + blockchain: ethereum + project: balancer_v2 + contributors: viniabussafi + config: + tags: ['ethereum', 'revenue', 'fees'] + description: > + Daily Protocol Fee collected and Revenue by pool on Balancer, an automated portfolio manager and trading platform. + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - day + - pool_id + - token_address + columns: + - name: day + - name: pool_id + - name: pool_address + - name: pool_symbol + - name: version + - name: blockchain + - name: token_address + - name: token_symbol + - name: token_amount_raw + description: "Raw amount of revenues of the token in the pool" + - name: token_amount + description: "Amount of revenues of the token in the pool" + - name: protocol_fee_collected_usd + description: "Fee collected in the pool in USD" + - name: treasury_share + description: "Share of total revenue that is directed to Balancer DAO's treasury, as per BIPs 19, 161 and 371" + - name: treasury_revenue_usd + description: "Total revenue directed to Balancer DAO's treasury" + + - name: balancer_v2_ethereum_bpt_supply + meta: + blockchain: ethereum + project: balancer_v2 + contributors: thetroyharris, viniabussafi + config: + tags: ['ethereum', 'bpt', 'supply'] + description: > + Balancer Pool Token (BPT) supply for ComposableStablePools versions 4 and 5. + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - day + - blockchain + - token_address + columns: + - name: day + - name: pool_type + - name: version + - name: blockchain + - name: token_address + - name: supply \ No newline at end of file diff --git a/models/_project/balancer/trades/ethereum/balancer_ethereum_trades.sql b/models/balancer/ethereum/balancer_ethereum_trades.sql similarity index 100% rename from models/_project/balancer/trades/ethereum/balancer_ethereum_trades.sql rename to models/balancer/ethereum/balancer_ethereum_trades.sql diff --git a/models/_project/balancer/vebal/ethereum/balancer_ethereum_vebal_balances_day.sql b/models/balancer/ethereum/balancer_ethereum_vebal_balances_day.sql similarity index 94% rename from models/_project/balancer/vebal/ethereum/balancer_ethereum_vebal_balances_day.sql rename to models/balancer/ethereum/balancer_ethereum_vebal_balances_day.sql index dbeb8065ba9..31df281cbcf 100644 --- a/models/_project/balancer/vebal/ethereum/balancer_ethereum_vebal_balances_day.sql +++ b/models/balancer/ethereum/balancer_ethereum_vebal_balances_day.sql @@ -1,11 +1,12 @@ {{ config( schema="balancer_ethereum", + alias = 'vebal_balances_day', post_hook='{{ expose_spells(\'["ethereum"]\', - spell_type = "project", - spell_name = "balancer", - contributors = \'["markusbkoch", "mendesfabio", "stefenon", "viniabussafi"]\') }}' + "project", + "balancer", + \'["markusbkoch", "mendesfabio", "stefenon", "viniabussafi"]\') }}' ) }} diff --git a/models/_project/balancer/vebal/ethereum/balancer_ethereum_vebal_slopes.sql b/models/balancer/ethereum/balancer_ethereum_vebal_slopes.sql similarity index 93% rename from models/_project/balancer/vebal/ethereum/balancer_ethereum_vebal_slopes.sql rename to models/balancer/ethereum/balancer_ethereum_vebal_slopes.sql index bf49f4f5471..7f549cd9a81 100644 --- a/models/_project/balancer/vebal/ethereum/balancer_ethereum_vebal_slopes.sql +++ b/models/balancer/ethereum/balancer_ethereum_vebal_slopes.sql @@ -1,11 +1,12 @@ {{ config( - schema="balancer_ethereum", + schema="balancer_ethereum", + alias = 'vebal_slopes', post_hook='{{ expose_spells(\'["ethereum"]\', - spell_type = "project", - spell_name = "balancer", - contributors = \'["markusbkoch", "mendesfabio", "stefenon", "viniabussafi"]\') }}' + "project", + "balancer", + \'["markusbkoch", "mendesfabio", "stefenon", "viniabussafi"]\') }}' ) }} diff --git a/models/_project/balancer/vebal/ethereum/balancer_ethereum_vebal_votes.sql b/models/balancer/ethereum/balancer_ethereum_vebal_votes.sql similarity index 92% rename from models/_project/balancer/vebal/ethereum/balancer_ethereum_vebal_votes.sql rename to models/balancer/ethereum/balancer_ethereum_vebal_votes.sql index d52c0fe757f..17929d1105c 100644 --- a/models/_project/balancer/vebal/ethereum/balancer_ethereum_vebal_votes.sql +++ b/models/balancer/ethereum/balancer_ethereum_vebal_votes.sql @@ -1,13 +1,13 @@ {{ config( - schema = 'balancer_ethereum', + alias = 'vebal_votes', materialized = 'table', file_format = 'delta', post_hook='{{ expose_spells(\'["ethereum"]\', - spell_type = "project", - spell_name = "balancer", - contributors = \'["markusbkoch", "mendesfabio", "stefenon", "viniabussafi"]\') }}' + "project", + "balancer", + \'["markusbkoch", "mendesfabio", "stefenon", "viniabussafi"]\') }}' ) }} diff --git a/models/_project/balancer/liquidity/ethereum/balancer_v1_ethereum_liquidity.sql b/models/balancer/ethereum/balancer_v1_ethereum_liquidity.sql similarity index 92% rename from models/_project/balancer/liquidity/ethereum/balancer_v1_ethereum_liquidity.sql rename to models/balancer/ethereum/balancer_v1_ethereum_liquidity.sql index b433278b8db..31601ee7cdd 100644 --- a/models/_project/balancer/liquidity/ethereum/balancer_v1_ethereum_liquidity.sql +++ b/models/balancer/ethereum/balancer_v1_ethereum_liquidity.sql @@ -3,7 +3,11 @@ schema='balancer_v1_ethereum', alias = 'liquidity', materialized = 'table', - file_format = 'delta' + file_format = 'delta', + post_hook='{{ expose_spells(\'["ethereum"]\', + "project", + "balancer_v1", + \'["stefenon", "viniabussafi"]\') }}' ) }} diff --git a/models/_project/balancer/pools/ethereum/balancer_v1_ethereum_pools_tokens_weights.sql b/models/balancer/ethereum/balancer_v1_ethereum_pools_tokens_weights.sql similarity index 93% rename from models/_project/balancer/pools/ethereum/balancer_v1_ethereum_pools_tokens_weights.sql rename to models/balancer/ethereum/balancer_v1_ethereum_pools_tokens_weights.sql index eb0bd2626f6..01b031110e7 100644 --- a/models/_project/balancer/pools/ethereum/balancer_v1_ethereum_pools_tokens_weights.sql +++ b/models/balancer/ethereum/balancer_v1_ethereum_pools_tokens_weights.sql @@ -2,10 +2,15 @@ config( schema='balancer_v1_ethereum', alias = 'pools_tokens_weights', + materialized = 'incremental', file_format = 'delta', incremental_strategy = 'merge', - unique_key = ['pool_id', 'token_address'] + unique_key = ['pool_id', 'token_address'], + post_hook='{{ expose_spells(\'["ethereum"]\', + "project", + "balancer_v1", + \'["metacrypto", "jacektrocinski"]\') }}' ) }} diff --git a/models/_project/balancer/trades/ethereum/balancer_v1_ethereum_trades.sql b/models/balancer/ethereum/balancer_v1_ethereum_trades.sql similarity index 100% rename from models/_project/balancer/trades/ethereum/balancer_v1_ethereum_trades.sql rename to models/balancer/ethereum/balancer_v1_ethereum_trades.sql diff --git a/models/_project/balancer/bpt/ethereum/balancer_v2_ethereum_bpt_prices.sql b/models/balancer/ethereum/balancer_v2_ethereum_bpt_prices.sql similarity index 100% rename from models/_project/balancer/bpt/ethereum/balancer_v2_ethereum_bpt_prices.sql rename to models/balancer/ethereum/balancer_v2_ethereum_bpt_prices.sql diff --git a/models/_project/balancer/bpt/ethereum/balancer_v2_ethereum_bpt_supply.sql b/models/balancer/ethereum/balancer_v2_ethereum_bpt_supply.sql similarity index 100% rename from models/_project/balancer/bpt/ethereum/balancer_v2_ethereum_bpt_supply.sql rename to models/balancer/ethereum/balancer_v2_ethereum_bpt_supply.sql diff --git a/models/_project/balancer/flashloans/ethereum/balancer_v2_ethereum_flashloans.sql b/models/balancer/ethereum/balancer_v2_ethereum_flashloans.sql similarity index 88% rename from models/_project/balancer/flashloans/ethereum/balancer_v2_ethereum_flashloans.sql rename to models/balancer/ethereum/balancer_v2_ethereum_flashloans.sql index 652ad476e88..cdbd54e0a7c 100644 --- a/models/_project/balancer/flashloans/ethereum/balancer_v2_ethereum_flashloans.sql +++ b/models/balancer/ethereum/balancer_v2_ethereum_flashloans.sql @@ -6,6 +6,10 @@ , file_format = 'delta' , incremental_strategy = 'merge' , unique_key = ['tx_hash', 'evt_index'] + , post_hook='{{ expose_spells(\'["ethereum"]\', + "project", + "balancer_v2", + \'["hildobby"]\') }}' ) }} diff --git a/models/_project/balancer/pools/ethereum/balancer_v2_ethereum_lbps.sql b/models/balancer/ethereum/balancer_v2_ethereum_lbps.sql similarity index 100% rename from models/_project/balancer/pools/ethereum/balancer_v2_ethereum_lbps.sql rename to models/balancer/ethereum/balancer_v2_ethereum_lbps.sql diff --git a/models/_project/balancer/liquidity/ethereum/balancer_v2_ethereum_liquidity.sql b/models/balancer/ethereum/balancer_v2_ethereum_liquidity.sql similarity index 52% rename from models/_project/balancer/liquidity/ethereum/balancer_v2_ethereum_liquidity.sql rename to models/balancer/ethereum/balancer_v2_ethereum_liquidity.sql index 54efdce06c3..56ccd353f93 100644 --- a/models/_project/balancer/liquidity/ethereum/balancer_v2_ethereum_liquidity.sql +++ b/models/balancer/ethereum/balancer_v2_ethereum_liquidity.sql @@ -6,7 +6,11 @@ schema = 'balancer_v2_ethereum', alias = 'liquidity', materialized = 'table', - file_format = 'delta' + file_format = 'delta', + post_hook="{{ expose_spells('[\"" + blockchain + '"]' + '\', + "project", + "balancer_v2", + \'["stefenon", "viniabussafi"]\') }}' ) }} diff --git a/models/_project/balancer/pools/ethereum/balancer_v2_ethereum_pools_fees.sql b/models/balancer/ethereum/balancer_v2_ethereum_pools_fees.sql similarity index 78% rename from models/_project/balancer/pools/ethereum/balancer_v2_ethereum_pools_fees.sql rename to models/balancer/ethereum/balancer_v2_ethereum_pools_fees.sql index 8e6041c0a42..08bee4948e9 100644 --- a/models/_project/balancer/pools/ethereum/balancer_v2_ethereum_pools_fees.sql +++ b/models/balancer/ethereum/balancer_v2_ethereum_pools_fees.sql @@ -1,11 +1,16 @@ {{ config( schema = 'balancer_v2_ethereum', + alias = 'pools_fees', materialized = 'incremental', file_format = 'delta', incremental_strategy = 'merge', - unique_key = ['block_number', 'tx_hash', 'index'] + unique_key = ['block_number', 'tx_hash', 'index'], + post_hook='{{ expose_spells(\'["ethereum"]\', + "project", + "balancer_v2", + \'["metacrypto", "jacektrocinski", "thetroyharris", "viniabussafi"]\') }}' )  }} diff --git a/models/_project/balancer/pools/ethereum/balancer_v2_ethereum_pools_tokens_weights.sql b/models/balancer/ethereum/balancer_v2_ethereum_pools_tokens_weights.sql similarity index 99% rename from models/_project/balancer/pools/ethereum/balancer_v2_ethereum_pools_tokens_weights.sql rename to models/balancer/ethereum/balancer_v2_ethereum_pools_tokens_weights.sql index 3fe74c18771..fd0cfd29bb6 100644 --- a/models/_project/balancer/pools/ethereum/balancer_v2_ethereum_pools_tokens_weights.sql +++ b/models/balancer/ethereum/balancer_v2_ethereum_pools_tokens_weights.sql @@ -2,6 +2,7 @@ config( schema='balancer_v2_ethereum', alias = 'pools_tokens_weights', + materialized = 'incremental', file_format = 'delta', incremental_strategy = 'merge', diff --git a/models/_project/balancer/protocol_fee/ethereum/balancer_v2_ethereum_protocol_fee.sql b/models/balancer/ethereum/balancer_v2_ethereum_protocol_fee.sql similarity index 100% rename from models/_project/balancer/protocol_fee/ethereum/balancer_v2_ethereum_protocol_fee.sql rename to models/balancer/ethereum/balancer_v2_ethereum_protocol_fee.sql diff --git a/models/_project/balancer/trades/ethereum/balancer_v2_ethereum_trades.sql b/models/balancer/ethereum/balancer_v2_ethereum_trades.sql similarity index 94% rename from models/_project/balancer/trades/ethereum/balancer_v2_ethereum_trades.sql rename to models/balancer/ethereum/balancer_v2_ethereum_trades.sql index dfb4c2439bf..3fe902cf12b 100644 --- a/models/_project/balancer/trades/ethereum/balancer_v2_ethereum_trades.sql +++ b/models/balancer/ethereum/balancer_v2_ethereum_trades.sql @@ -4,9 +4,9 @@ alias = 'trades', materialized = 'view', post_hook = '{{ expose_spells(\'["ethereum"]\', - spell_type = "project", - spell_name = "balancer", - contributors = \'["mendesfabio", "jacektrocinski", "thetroyharris", "tomfutago", "viniabussafi"]\') }}' + "project", + "balancer_v2", + \'["mendesfabio", "jacektrocinski", "thetroyharris", "tomfutago", "viniabussafi"]\') }}' ) }} diff --git a/models/_project/balancer/bpt/ethereum/balancer_v2_ethereum_transfers_bpt.sql b/models/balancer/ethereum/balancer_v2_ethereum_transfers_bpt.sql similarity index 100% rename from models/_project/balancer/bpt/ethereum/balancer_v2_ethereum_transfers_bpt.sql rename to models/balancer/ethereum/balancer_v2_ethereum_transfers_bpt.sql diff --git a/models/_project/balancer/pools/gnosis/balancer_gnosis_pools_tokens_weights.sql b/models/balancer/gnosis/balancer_gnosis_pools_tokens_weights.sql similarity index 100% rename from models/_project/balancer/pools/gnosis/balancer_gnosis_pools_tokens_weights.sql rename to models/balancer/gnosis/balancer_gnosis_pools_tokens_weights.sql diff --git a/models/balancer/gnosis/balancer_gnosis_schema.yml b/models/balancer/gnosis/balancer_gnosis_schema.yml new file mode 100644 index 00000000000..a9ef89846ef --- /dev/null +++ b/models/balancer/gnosis/balancer_gnosis_schema.yml @@ -0,0 +1,404 @@ +version: 2 + +models: + - name: balancer_gnosis_trades + meta: + blockchain: gnosis + sector: dex + contributors: bizzyvinci + config: + tags: ['balancer', 'gnosis', 'amm', 'trades', 'dex'] + description: > + DEX trades on balancer on gnosis + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - block_date + - blockchain + - project + - version + - tx_hash + - evt_index + - check_dex_seed: + blockchain: gnosis + project: balancer + version: 2 + columns: + - &blockchain + name: blockchain + description: "Blockchain" + - &project + name: project + description: "Project name (balancer)" + - &version + name: version + description: "Version of the project" + - &block_month + name: block_month + description: "Block month in UTC" + - &block_date + name: block_date + description: "Block date in UTC" + - &block_time + name: block_time + description: 'Block time in UTC' + - &token_bought_symbol + name: token_bought_symbol + description: "Token symbol for token bought in the trade" + - &token_sold_symbol + name: token_sold_symbol + description: "Token symbol for token sold in the trade" + - &token_pair + name: token_pair + description: "Token symbol pair for each token involved in the trade" + - &token_bought_amount + name: token_bought_amount + description: "Value of the token bought at time of execution in the original currency" + - &token_sold_amount + name: token_sold_amount + description: "Value of the token sold at time of execution in the original currency" + - &token_bought_amount_raw + name: token_bought_amount_raw + description: "Raw value of the token bought at time of execution in the original currency" + - &token_sold_amount_raw + name: token_sold_amount_raw + description: "Raw value of the token sold at time of execution in the original currency" + - &amount_usd + name: amount_usd + description: "USD value of the trade at time of execution" + - &token_bought_address + name: token_bought_address + description: "Contract address of the token bought" + - &token_sold_address + name: token_sold_address + description: "Contract address of the token sold" + - &taker + name: taker + description: "Address of trader who purchased a token" + - &maker + name: maker + description: "Address of trader who sold a token" + - &pool_id + name: pool_id + description: 'Unique encoded identifier that refers to each pool' + - &swap_fee + name: swap_fee + description: 'Swap fee' + - &project_contract_address + name: project_contract_address + description: "Pool address" + - name: pool_symbol + - name: pool_type + - &tx_hash + name: tx_hash + description: "Transaction hash" + - &tx_from + name: tx_from + description: "transaction.from" + - &tx_to + name: tx_to + description: "transaction.to" + - &evt_index + name: evt_index + description: "Event index" + + - name: balancer_v2_gnosis_flashloans + meta: + blockchain: gnosis + sector: lending + contributors: hildobby + config: + tags: ['gnosis', 'flashloans'] + description: > + All Balancer flashloans on Gnosis + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - blockchain + - tx_hash + - evt_index + columns: + - name: blockchain + - name: project + - name: version + - name: block_time + - name: block_number + - name: amount + - name: amount_usd + - name: tx_hash + - name: evt_index + - name: fee + - name: currency_contract + - name: currency_symbol + - name: recipient + - name: contract_address + - name: block_month + + - name: balancer_v2_gnosis_bpt_prices + meta: + blockchain: gnosis + project: balancer_v2 + contributors: thetroyharris, viniabussafi + config: + tags: ['gnosis', 'bpt', 'prices'] + description: > + Balancer Pool Token (BPT) hourly median price by pool on Balancer, an automated portfolio manager and trading platform. + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - blockchain + - day + - contract_address + columns: + - name: blockchain + - name: day + - name: version + - name: decimals + - name: contract_address + - name: bpt_price + + - name: balancer_v2_gnosis_pools_fees + meta: + blockchain: gnosis + project: balancer_v2 + contributors: jacektrocinski, thetroyharris, viniabussafi + config: + tags: ['gnosis', 'balancer', 'pools_fees'] + description: > + Balancer v2 swap fees stored at the pool level. + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - block_number + - tx_hash + - index + columns: + - name: blockchain + - name: version + - name: contract_address + - name: tx_hash + - name: index + - name: tx_index + - name: block_time + - name: block_number + - name: swap_fee_percentage + + - name: balancer_v2_gnosis_trades + meta: + blockchain: gnosis + sector: dex + contributors: bizzyvinci, thetroyharris, tomfutago, viniabussafi + config: + tags: [ 'balancer', 'gnosis', 'amm', 'trades', 'dex', 'beta' ] + description: > + DEX trades on balancer v2 on gnosis + columns: + - *blockchain + - *project + - *version + - *block_month + - *block_date + - *block_time + - name: block_number + - *token_bought_symbol + - *token_sold_symbol + - *token_pair + - *token_bought_amount + - *token_sold_amount + - *token_bought_amount_raw + - *token_sold_amount_raw + - *amount_usd + - *token_bought_address + - *token_sold_address + - *taker + - *maker + - *project_contract_address + - name: pool_symbol + - name: pool_type + - *pool_id + - *swap_fee + - *tx_hash + - *tx_from + - *tx_to + - *evt_index + + - name: balancer_v2_gnosis_liquidity + meta: + blockchain: gnosis + project: balancer_v2 + contributors: victorstefenon, viniabussafi, thetroyharris + config: + tags: ['gnosis', 'balancer', 'pools', 'liquidity'] + description: > + Balancer v2 pools liquidity by token in Gnosis. + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - day + - pool_id + - token_address + columns: + - name: day + description: 'UTC event block time truncated to the day mark' + - *pool_id + - name: pool_address + - name: pool_symbol + description: 'Symbol of the pool, consisting of the symbol of its tokens and their respective weights' + - name: version + description: 'Version of Balancer in which pool was deployed' + - name: blockchain + description: 'Blockchain in which pool was deployed' + - name: token_address + - name: token_symbol + description: 'Symbol of the token' + - name: token_balance_raw + description: 'Raw balance of the token in the pool' + - name: token_balance + description: 'Scaled balance of the token in the pool' + - name: protocol_liquidity_usd + description: 'Liquidity of the token in the pool in USD, except BPTs' + - name: protocol_liquidity_eth + description: 'Liquidity of the token in the pool in ETH, except BPTs' + - name: pool_liquidity_usd + description: 'Liquidity of the token in the pool in USD, including BPTs' + - name: pool_liquidity_eth + description: 'Liquidity of the token in the pool in ETH, including BPTs' + + + - name: balancer_gnosis_pools_tokens_weights + meta: + blockchain: gnosis + project: balancer + contributors: jacektrocinski, viniabussafi + config: + tags: ['gnosis', 'balancer', 'pools', 'tokens', 'weights'] + description: > + Token weights in Balancer pools. + columns: + - *blockchain + - name: version + - *pool_id + - &token_address + name: token_address + description: 'Contract address for the token' + - &normalized_weight + name: normalized_weight + description: 'Weight of the token in the pool.' + + - name: balancer_v2_gnosis_pools_tokens_weights + meta: + blockchain: gnosis + project: balancer + contributors: metacrypto, jacektrocinski, viniabussafi + config: + tags: ['gnosis', 'balancer', 'pools', 'tokens', 'weights'] + description: > + Token weights in Balancer v2 pools. + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - pool_id + - token_address + columns: + - *blockchain + - name: version + - *pool_id + - *token_address + - *normalized_weight + + - name: balancer_v2_gnosis_transfers_bpt + meta: + blockchain: gnosis + project: balancer_v2 + contributors: victorstefenon, thetroyharris, viniabussafi + config: + tags: ['gnosis', 'bpt', 'transfers'] + description: > + Balancer Pool Token (BPT) transfer logs on Balancer, an automated portfolio manager and trading platform, on Gnosis. + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - evt_tx_hash + - evt_index + - block_date + columns: + - name: blockchain + - name: version + - name: contract_address + - name: block_date + - name: block_month + - name: evt_tx_hash + - name: evt_index + - &evt_block_time + name: evt_block_time + description: 'Block time of transfer event' + - &evt_block_number + name: evt_block_number + description: 'Block number of transfer event' + - &from + name: from + description: 'Address of BPT provider of transfer event' + - &to + name: to + description: 'Address of BPT receiver of transfer event' + - &value + name: value + description: 'Amount of BPT transferred in transfer event' + + - name: balancer_v2_gnosis_protocol_fee + meta: + blockchain: gnosis + project: balancer_v2 + contributors: viniabussafi + config: + tags: ['gnosis', 'revenue', 'fees'] + description: > + Daily Protocol Fee collected and Revenue by pool on Balancer, an automated portfolio manager and trading platform. + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - day + - pool_id + - token_address + columns: + - name: day + - name: pool_id + - name: pool_address + - name: pool_symbol + - name: version + - name: blockchain + - name: token_address + - name: token_symbol + - name: token_amount_raw + description: "Raw amount of revenues of the token in the pool" + - name: token_amount + description: "Amount of revenues of the token in the pool" + - name: protocol_fee_collected_usd + description: "Fee collected in the pool in USD" + - name: treasury_share + description: "Share of total revenue that is directed to Balancer DAO's treasury, as per BIPs 19, 161 and 371" + - name: treasury_revenue + description: "Total revenue directed to Balancer DAO's treasury" + + - name: balancer_v2_gnosis_bpt_supply + meta: + blockchain: gnosis + project: balancer_v2 + contributors: thetroyharris, viniabussafi + config: + tags: ['gnosis', 'bpt', 'supply'] + description: > + Balancer Pool Token (BPT) supply for ComposableStablePools versions 4 and 5. + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - day + - blockchain + - token_address + columns: + - name: day + - name: pool_type + - name: version + - name: blockchain + - name: token_address + - name: supply \ No newline at end of file diff --git a/models/_project/balancer/trades/gnosis/balancer_gnosis_trades.sql b/models/balancer/gnosis/balancer_gnosis_trades.sql similarity index 100% rename from models/_project/balancer/trades/gnosis/balancer_gnosis_trades.sql rename to models/balancer/gnosis/balancer_gnosis_trades.sql diff --git a/models/_project/balancer/bpt/gnosis/balancer_v2_gnosis_bpt_prices.sql b/models/balancer/gnosis/balancer_v2_gnosis_bpt_prices.sql similarity index 100% rename from models/_project/balancer/bpt/gnosis/balancer_v2_gnosis_bpt_prices.sql rename to models/balancer/gnosis/balancer_v2_gnosis_bpt_prices.sql diff --git a/models/_project/balancer/bpt/gnosis/balancer_v2_gnosis_bpt_supply.sql b/models/balancer/gnosis/balancer_v2_gnosis_bpt_supply.sql similarity index 100% rename from models/_project/balancer/bpt/gnosis/balancer_v2_gnosis_bpt_supply.sql rename to models/balancer/gnosis/balancer_v2_gnosis_bpt_supply.sql diff --git a/models/_project/balancer/flashloans/gnosis/balancer_v2_gnosis_flashloans.sql b/models/balancer/gnosis/balancer_v2_gnosis_flashloans.sql similarity index 88% rename from models/_project/balancer/flashloans/gnosis/balancer_v2_gnosis_flashloans.sql rename to models/balancer/gnosis/balancer_v2_gnosis_flashloans.sql index f8d11b83452..7a4dd71de65 100644 --- a/models/_project/balancer/flashloans/gnosis/balancer_v2_gnosis_flashloans.sql +++ b/models/balancer/gnosis/balancer_v2_gnosis_flashloans.sql @@ -6,6 +6,10 @@ , file_format = 'delta' , incremental_strategy = 'merge' , unique_key = ['tx_hash', 'evt_index'] + , post_hook='{{ expose_spells(\'["gnosis"]\', + "project", + "balancer_v2", + \'["hildobby"]\') }}' ) }} diff --git a/models/_project/balancer/liquidity/gnosis/balancer_v2_gnosis_liquidity.sql b/models/balancer/gnosis/balancer_v2_gnosis_liquidity.sql similarity index 51% rename from models/_project/balancer/liquidity/gnosis/balancer_v2_gnosis_liquidity.sql rename to models/balancer/gnosis/balancer_v2_gnosis_liquidity.sql index fc5885a24e0..478f1b6c77f 100644 --- a/models/_project/balancer/liquidity/gnosis/balancer_v2_gnosis_liquidity.sql +++ b/models/balancer/gnosis/balancer_v2_gnosis_liquidity.sql @@ -6,7 +6,11 @@ schema = 'balancer_v2_gnosis', alias = 'liquidity', materialized = 'table', - file_format = 'delta' + file_format = 'delta', + post_hook="{{ expose_spells('[\"" + blockchain + '"]' + '\', + "project", + "balancer_v2", + \'["stefenon", "viniabussafi"]\') }}' ) }} diff --git a/models/_project/balancer/pools/gnosis/balancer_v2_gnosis_pools_fees.sql b/models/balancer/gnosis/balancer_v2_gnosis_pools_fees.sql similarity index 77% rename from models/_project/balancer/pools/gnosis/balancer_v2_gnosis_pools_fees.sql rename to models/balancer/gnosis/balancer_v2_gnosis_pools_fees.sql index 086072fc70b..de1a7618af6 100644 --- a/models/_project/balancer/pools/gnosis/balancer_v2_gnosis_pools_fees.sql +++ b/models/balancer/gnosis/balancer_v2_gnosis_pools_fees.sql @@ -1,12 +1,17 @@ {{ config( schema = 'balancer_v2_gnosis', + alias = 'pools_fees', materialized = 'incremental', file_format = 'delta', incremental_strategy = 'merge', - unique_key = ['block_number', 'tx_hash', 'index'] - ) + unique_key = ['block_number', 'tx_hash', 'index'], + post_hook='{{ expose_spells(\'["gnosis"]\', + "project", + "balancer_v2", + \'["metacrypto", "jacektrocinski", "thetroyharris", "viniabussafi"]\') }}' + )  }} {% set event_signature = '0xa9ba3ffe0b6c366b81232caab38605a0699ad5398d6cce76f91ee809e322dafc' %} diff --git a/models/_project/balancer/pools/gnosis/balancer_v2_gnosis_pools_tokens_weights.sql b/models/balancer/gnosis/balancer_v2_gnosis_pools_tokens_weights.sql similarity index 99% rename from models/_project/balancer/pools/gnosis/balancer_v2_gnosis_pools_tokens_weights.sql rename to models/balancer/gnosis/balancer_v2_gnosis_pools_tokens_weights.sql index a4b0a7688a8..ee2bef6e0a7 100644 --- a/models/_project/balancer/pools/gnosis/balancer_v2_gnosis_pools_tokens_weights.sql +++ b/models/balancer/gnosis/balancer_v2_gnosis_pools_tokens_weights.sql @@ -2,6 +2,7 @@ config( schema='balancer_v2_gnosis', alias = 'pools_tokens_weights', + materialized = 'incremental', file_format = 'delta', incremental_strategy = 'merge', diff --git a/models/_project/balancer/protocol_fee/gnosis/balancer_v2_gnosis_protocol_fee.sql b/models/balancer/gnosis/balancer_v2_gnosis_protocol_fee.sql similarity index 100% rename from models/_project/balancer/protocol_fee/gnosis/balancer_v2_gnosis_protocol_fee.sql rename to models/balancer/gnosis/balancer_v2_gnosis_protocol_fee.sql diff --git a/models/_project/balancer/trades/gnosis/balancer_v2_gnosis_trades.sql b/models/balancer/gnosis/balancer_v2_gnosis_trades.sql similarity index 94% rename from models/_project/balancer/trades/gnosis/balancer_v2_gnosis_trades.sql rename to models/balancer/gnosis/balancer_v2_gnosis_trades.sql index 090b5b9e737..c895c351328 100644 --- a/models/_project/balancer/trades/gnosis/balancer_v2_gnosis_trades.sql +++ b/models/balancer/gnosis/balancer_v2_gnosis_trades.sql @@ -4,9 +4,9 @@ alias = 'trades', materialized = 'view', post_hook = '{{ expose_spells(\'["gnosis"]\', - spell_type = "project", - spell_name = "balancer", - contributors = \'["mendesfabio", "jacektrocinski", "thetroyharris", "tomfutago", "viniabussafi"]\') }}' + "project", + "balancer_v2", + \'["mendesfabio", "jacektrocinski", "thetroyharris", "tomfutago", "viniabussafi"]\') }}' ) }} diff --git a/models/_project/balancer/bpt/gnosis/balancer_v2_gnosis_transfers_bpt.sql b/models/balancer/gnosis/balancer_v2_gnosis_transfers_bpt.sql similarity index 100% rename from models/_project/balancer/bpt/gnosis/balancer_v2_gnosis_transfers_bpt.sql rename to models/balancer/gnosis/balancer_v2_gnosis_transfers_bpt.sql diff --git a/models/_project/balancer/pools/optimism/balancer_optimism_gauge_mappings.sql b/models/balancer/optimism/balancer_optimism_gauge_mappings.sql similarity index 87% rename from models/_project/balancer/pools/optimism/balancer_optimism_gauge_mappings.sql rename to models/balancer/optimism/balancer_optimism_gauge_mappings.sql index 10ecdde4e86..382424a91be 100644 --- a/models/_project/balancer/pools/optimism/balancer_optimism_gauge_mappings.sql +++ b/models/balancer/optimism/balancer_optimism_gauge_mappings.sql @@ -1,15 +1,16 @@ {{ config( schema = 'balancer_optimism', + alias = 'gauge_mappings', materialized = 'incremental', file_format = 'delta', incremental_strategy = 'merge', unique_key = ['pool_contract', 'incentives_contract'], post_hook='{{ expose_spells(\'["optimism"]\', - spell_type = "project", - spell_name = "balancer", - contributors = \'["msilb7"]\') }}' + "project", + "balancer", + \'["msilb7"]\') }}' )  }} diff --git a/models/_project/balancer/pools/optimism/balancer_optimism_pools_tokens_weights.sql b/models/balancer/optimism/balancer_optimism_pools_tokens_weights.sql similarity index 86% rename from models/_project/balancer/pools/optimism/balancer_optimism_pools_tokens_weights.sql rename to models/balancer/optimism/balancer_optimism_pools_tokens_weights.sql index 204da50aa15..b6bdf48de02 100644 --- a/models/_project/balancer/pools/optimism/balancer_optimism_pools_tokens_weights.sql +++ b/models/balancer/optimism/balancer_optimism_pools_tokens_weights.sql @@ -1,6 +1,7 @@ {{ config( schema = 'balancer_optimism', - alias = 'pools_tokens_weights' + alias = 'pools_tokens_weights', + ) }} diff --git a/models/balancer/optimism/balancer_optimism_schema.yml b/models/balancer/optimism/balancer_optimism_schema.yml new file mode 100644 index 00000000000..bb4c52fbe0e --- /dev/null +++ b/models/balancer/optimism/balancer_optimism_schema.yml @@ -0,0 +1,464 @@ +version: 2 + +models: + - name: balancer_v2_optimism_pools_fees + meta: + blockchain: optimism + project: balancer_v2 + contributors: jacektrocinski, thetroyharris, viniabussafi + config: + tags: ['optimism', 'balancer', 'pools_fees'] + description: > + Balancer v2 swap fees stored at the pool level. + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - block_number + - tx_hash + - index + columns: + - name: blockchain + - name: version + - &contract_address + name: contract_address + description: 'Optimism address for the liquidity pool used in transaction' + tests: + - not_null + - &tx_hash + name: tx_hash + description: 'Transaction hash' + tests: + - not_null + - &index + name: index + description: '' + tests: + - not_null + - &tx_index + name: tx_index + description: '' + tests: + - not_null + - &block_time + name: block_time + description: 'Block time in UTC' + tests: + - not_null + - &block_number + name: block_number + description: 'Block number' + tests: + - not_null + - &swap_fee_percentage + name: swap_fee_percentage + description: 'Swap fees for the pool, values are returned with 18 decimals (1e18 meaning 100%)' + tests: + - not_null + + - name: balancer_v2_optimism_transfers_bpt + meta: + blockchain: optimism + project: balancer_v2 + contributors: victorstefenon, thetroyharris, viniabussafi + config: + tags: ['optimism', 'bpt', 'transfers'] + description: > + Balancer Pool Token (BPT) transfer logs on Balancer, an automated portfolio manager and trading platform, on Optimism. + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - evt_tx_hash + - evt_index + - block_date + columns: + - &blockchain + name: blockchain + description: "Blockchain" + - name: version + - *contract_address + - &block_date + name: block_date + description: "UTC event block date of each DEX trade" + - &block_month + name: block_month + description: "UTC event block month of each DEX trade" + - &evt_tx_hash + name: evt_tx_hash + description: 'Transaction hash of transfer event' + - &evt_index + name: evt_index + description: 'Event index' + - &evt_block_time + name: evt_block_time + description: 'Block time of transfer event' + - &evt_block_number + name: evt_block_number + description: 'Block number of transfer event' + - &from + name: from + description: 'Address of BPT provider of transfer event' + - &to + name: to + description: 'Address of BPT receiver of transfer event' + - &value + name: value + description: 'Amount of BPT transferred in transfer event' + + - name: balancer_optimism_pools_tokens_weights + meta: + blockchain: optimism + project: balancer + contributors: jacektrocinski, viniabussafi + config: + tags: ['optimism', 'balancer', 'pools', 'tokens', 'weights'] + description: > + Token weights in Balancer pools. + columns: + - *blockchain + - name: version + - &pool_id + name: pool_id + description: 'Unique encoded identifier that refers to each pool' + tests: + - not_null + - &token_address + name: token_address + description: 'Contract address for the token' + - &normalized_weight + name: normalized_weight + description: 'Weight of the token in the pool.' + + - name: balancer_v2_optimism_pools_tokens_weights + meta: + blockchain: optimism + project: balancer + contributors: jacektrocinski, viniabussafi + config: + tags: ['optimism', 'balancer', 'pools', 'tokens', 'weights'] + description: > + Token weights in Balancer v2 pools. + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - pool_id + - token_address + columns: + - *blockchain + - name: version + - *pool_id + - *token_address + - *normalized_weight + + - name: balancer_optimism_trades + meta: + blockchain: optimism + sector: dex + contributors: bizzyvinci + config: + tags: ['balancer', 'optimism', 'amm', 'trades', 'dex'] + description: > + DEX trades on balancer on optimism + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - block_date + - blockchain + - project + - version + - tx_hash + - evt_index + - check_dex_seed: + blockchain: optimism + project: balancer + version: 2 + columns: + - *blockchain + - &project + name: project + description: "Project name (balancer)" + - &version + name: version + description: "Version of the project" + - *block_month + - *block_date + - *block_time + - &token_bought_symbol + name: token_bought_symbol + description: "Token symbol for token bought in the trade" + - &token_sold_symbol + name: token_sold_symbol + description: "Token symbol for token sold in the trade" + - &token_pair + name: token_pair + description: "Token symbol pair for each token involved in the trade" + - &token_bought_amount + name: token_bought_amount + description: "Value of the token bought at time of execution in the original currency" + - &token_sold_amount + name: token_sold_amount + description: "Value of the token sold at time of execution in the original currency" + - &token_bought_amount_raw + name: token_bought_amount_raw + description: "Raw value of the token bought at time of execution in the original currency" + - &token_sold_amount_raw + name: token_sold_amount_raw + description: "Raw value of the token sold at time of execution in the original currency" + - &amount_usd + name: amount_usd + description: "USD value of the trade at time of execution" + - &token_bought_address + name: token_bought_address + description: "Contract address of the token bought" + - &token_sold_address + name: token_sold_address + description: "Contract address of the token sold" + - &taker + name: taker + description: "Address of trader who purchased a token" + - &maker + name: maker + description: "Address of trader who sold a token" + - *pool_id + - &swap_fee + name: swap_fee + description: 'Swap fee' + - &project_contract_address + name: project_contract_address + description: "Pool address" + - name: pool_symbol + - name: pool_type + - *tx_hash + - &tx_from + name: tx_from + description: "transaction.from" + - &tx_to + name: tx_to + description: "transaction.to" + - *evt_index + + - name: balancer_v2_optimism_liquidity + meta: + blockchain: optimism + project: balancer_v2 + contributors: victorstefenon, viniabussafi, thetroyharris + config: + tags: ['optimism', 'balancer', 'pools', 'liquidity'] + description: > + Balancer v2 pools liquidity by token in Optimism. + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - day + - pool_id + - token_address + columns: + - name: day + description: 'UTC event block time truncated to the day mark' + - *pool_id + - name: pool_address + - name: pool_symbol + description: 'Symbol of the pool, consisting of the symbol of its tokens and their respective weights' + - name: version + description: 'Version of Balancer in which pool was deployed' + - name: blockchain + description: 'Blockchain in which pool was deployed' + - *token_address + - name: token_symbol + description: 'Symbol of the token' + - name: token_balance_raw + description: 'Raw balance of the token in the pool' + - name: token_balance + description: 'Scaled balance of the token in the pool' + - name: protocol_liquidity_usd + description: 'Liquidity of the token in the pool in USD, except BPTs' + - name: protocol_liquidity_eth + description: 'Liquidity of the token in the pool in ETH, except BPTs' + - name: pool_liquidity_usd + description: 'Liquidity of the token in the pool in USD, including BPTs' + - name: pool_liquidity_eth + description: 'Liquidity of the token in the pool in ETH, including BPTs' + + - name: balancer_optimism_gauge_mappings + meta: + blockchain: optimism + project: balancer + contributors: msilb7 + config: + tags: ['optimism', 'balancer', 'gauges', 'incentives'] + description: > + Balancer gauge to pool mappings on Optimism. + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - pool_contract + - incentives_contract + columns: + - *blockchain + - *version + - &pool_contract + name: pool_contract + description: "Address of the liquidity pool contract" + - *pool_id + - &incentives_contract + name: incentives_contract + description: "Address of the contract where incentives are stored and emitted." + - &incentives_type + name: incentives_type + description: "Description of the incentives address type." + - *evt_block_time + - *evt_block_number + - *contract_address + - *evt_tx_hash + - *evt_index + + - name: balancer_v2_optimism_flashloans + meta: + blockchain: optimism + sector: lending + contributors: hildobby + config: + tags: ['optimism', 'flashloans'] + description: > + All Balancer flashloans on Optimism + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - blockchain + - tx_hash + - evt_index + columns: + - name: blockchain + - name: project + - name: version + - name: block_time + - name: block_number + - name: amount + - name: amount_usd + - name: tx_hash + - name: evt_index + - name: fee + - name: currency_contract + - name: currency_symbol + - name: recipient + - name: contract_address + - name: block_month + + - name: balancer_v2_optimism_bpt_prices + meta: + blockchain: optimism + project: balancer_v2 + contributors: victorstefenon, thetroyharris, viniabussafi + config: + tags: ['optimism', 'bpt', 'prices'] + description: > + Balancer Pool Token (BPT) hourly median price by pool on Balancer, an automated portfolio manager and trading platform. + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - blockchain + - day + - contract_address + columns: + - name: blockchain + - name: day + - name: version + - name: decimals + - name: contract_address + - name: bpt_price + + - name: balancer_v2_optimism_trades + meta: + blockchain: optimism + sector: dex + contributors: bizzyvinci, thetroyharris, tomfutago, viniabussafi + config: + tags: [ 'balancer', 'optimism', 'amm', 'trades', 'dex', 'beta' ] + description: > + DEX trades on balancer v2 on optimism + columns: + - *blockchain + - *project + - *version + - *block_month + - *block_date + - *block_time + - name: block_number + - *token_bought_symbol + - *token_sold_symbol + - *token_pair + - *token_bought_amount + - *token_sold_amount + - *token_bought_amount_raw + - *token_sold_amount_raw + - *amount_usd + - *token_bought_address + - *token_sold_address + - *taker + - *maker + - *project_contract_address + - name: pool_symbol + - name: pool_type + - *pool_id + - *swap_fee + - *tx_hash + - *tx_from + - *tx_to + - *evt_index + + - name: balancer_v2_optimism_protocol_fee + meta: + blockchain: optimism + project: balancer_v2 + contributors: viniabussafi + config: + tags: ['optimism', 'revenue', 'fees'] + description: > + Daily Protocol Fee collected and Revenue by pool on Balancer, an automated portfolio manager and trading platform. + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - day + - pool_id + - token_address + columns: + - name: day + - name: pool_id + - name: pool_address + - name: pool_symbol + - name: version + - name: blockchain + - name: token_address + - name: token_symbol + - name: token_amount_raw + description: "Raw amount of revenues of the token in the pool" + - name: token_amount + description: "Amount of revenues of the token in the pool" + - name: protocol_fee_collected_usd + description: "Fee collected in the pool in USD" + - name: treasury_share + description: "Share of total revenue that is directed to Balancer DAO's treasury, as per BIPs 19, 161 and 371" + - name: treasury_revenue_usd + description: "Total revenue directed to Balancer DAO's treasury" + + - name: balancer_v2_optimism_bpt_supply + meta: + blockchain: optimism + project: balancer_v2 + contributors: thetroyharris, viniabussafi + config: + tags: ['optimism', 'bpt', 'supply'] + description: > + Balancer Pool Token (BPT) supply for ComposableStablePools versions 4 and 5. + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - day + - blockchain + - token_address + columns: + - name: day + - name: pool_type + - name: version + - name: blockchain + - name: token_address + - name: supply \ No newline at end of file diff --git a/models/_project/balancer/trades/optimism/balancer_optimism_trades.sql b/models/balancer/optimism/balancer_optimism_trades.sql similarity index 100% rename from models/_project/balancer/trades/optimism/balancer_optimism_trades.sql rename to models/balancer/optimism/balancer_optimism_trades.sql diff --git a/models/_project/balancer/bpt/optimism/balancer_v2_optimism_bpt_prices.sql b/models/balancer/optimism/balancer_v2_optimism_bpt_prices.sql similarity index 100% rename from models/_project/balancer/bpt/optimism/balancer_v2_optimism_bpt_prices.sql rename to models/balancer/optimism/balancer_v2_optimism_bpt_prices.sql diff --git a/models/_project/balancer/bpt/optimism/balancer_v2_optimism_bpt_supply.sql b/models/balancer/optimism/balancer_v2_optimism_bpt_supply.sql similarity index 100% rename from models/_project/balancer/bpt/optimism/balancer_v2_optimism_bpt_supply.sql rename to models/balancer/optimism/balancer_v2_optimism_bpt_supply.sql diff --git a/models/_project/balancer/flashloans/optimism/balancer_v2_optimism_flashloans.sql b/models/balancer/optimism/balancer_v2_optimism_flashloans.sql similarity index 88% rename from models/_project/balancer/flashloans/optimism/balancer_v2_optimism_flashloans.sql rename to models/balancer/optimism/balancer_v2_optimism_flashloans.sql index c7036fcc2ac..9908e24f7b3 100644 --- a/models/_project/balancer/flashloans/optimism/balancer_v2_optimism_flashloans.sql +++ b/models/balancer/optimism/balancer_v2_optimism_flashloans.sql @@ -6,6 +6,10 @@ , file_format = 'delta' , incremental_strategy = 'merge' , unique_key = ['tx_hash', 'evt_index'] + , post_hook='{{ expose_spells(\'["optimism"]\', + "project", + "balancer_v2", + \'["hildobby"]\') }}' ) }} diff --git a/models/_project/balancer/liquidity/optimism/balancer_v2_optimism_liquidity.sql b/models/balancer/optimism/balancer_v2_optimism_liquidity.sql similarity index 52% rename from models/_project/balancer/liquidity/optimism/balancer_v2_optimism_liquidity.sql rename to models/balancer/optimism/balancer_v2_optimism_liquidity.sql index b34e0e3557a..d9e8ac55868 100644 --- a/models/_project/balancer/liquidity/optimism/balancer_v2_optimism_liquidity.sql +++ b/models/balancer/optimism/balancer_v2_optimism_liquidity.sql @@ -6,7 +6,11 @@ schema = 'balancer_v2_optimism', alias = 'liquidity', materialized = 'table', - file_format = 'delta' + file_format = 'delta', + post_hook="{{ expose_spells('[\"" + blockchain + '"]' + '\', + "project", + "balancer_v2", + \'["stefenon", "viniabussafi"]\') }}' ) }} diff --git a/models/_project/balancer/pools/optimism/balancer_v2_optimism_pools_fees.sql b/models/balancer/optimism/balancer_v2_optimism_pools_fees.sql similarity index 77% rename from models/_project/balancer/pools/optimism/balancer_v2_optimism_pools_fees.sql rename to models/balancer/optimism/balancer_v2_optimism_pools_fees.sql index 7cde533a681..adeeb98918e 100644 --- a/models/_project/balancer/pools/optimism/balancer_v2_optimism_pools_fees.sql +++ b/models/balancer/optimism/balancer_v2_optimism_pools_fees.sql @@ -1,12 +1,17 @@ {{ config( schema = 'balancer_v2_optimism', + alias = 'pools_fees', materialized = 'incremental', file_format = 'delta', incremental_strategy = 'merge', - unique_key = ['block_number', 'tx_hash', 'index'] - ) + unique_key = ['block_number', 'tx_hash', 'index'], + post_hook='{{ expose_spells(\'["optimism"]\', + "project", + "balancer_v2", + \'["metacrypto", "jacektrocinski", "thetroyharris", "viniabussafi"]\') }}' + )  }} {% set event_signature = '0xa9ba3ffe0b6c366b81232caab38605a0699ad5398d6cce76f91ee809e322dafc' %} diff --git a/models/_project/balancer/pools/optimism/balancer_v2_optimism_pools_tokens_weights.sql b/models/balancer/optimism/balancer_v2_optimism_pools_tokens_weights.sql similarity index 99% rename from models/_project/balancer/pools/optimism/balancer_v2_optimism_pools_tokens_weights.sql rename to models/balancer/optimism/balancer_v2_optimism_pools_tokens_weights.sql index 0888c1c2a0b..74220656f88 100644 --- a/models/_project/balancer/pools/optimism/balancer_v2_optimism_pools_tokens_weights.sql +++ b/models/balancer/optimism/balancer_v2_optimism_pools_tokens_weights.sql @@ -2,6 +2,7 @@ config( schema='balancer_v2_optimism', alias = 'pools_tokens_weights', + materialized = 'incremental', file_format = 'delta', incremental_strategy = 'merge', diff --git a/models/_project/balancer/protocol_fee/optimism/balancer_v2_optimism_protocol_fee.sql b/models/balancer/optimism/balancer_v2_optimism_protocol_fee.sql similarity index 100% rename from models/_project/balancer/protocol_fee/optimism/balancer_v2_optimism_protocol_fee.sql rename to models/balancer/optimism/balancer_v2_optimism_protocol_fee.sql diff --git a/models/_project/balancer/trades/optimism/balancer_v2_optimism_trades.sql b/models/balancer/optimism/balancer_v2_optimism_trades.sql similarity index 94% rename from models/_project/balancer/trades/optimism/balancer_v2_optimism_trades.sql rename to models/balancer/optimism/balancer_v2_optimism_trades.sql index b53e845ddd6..03327617f4f 100644 --- a/models/_project/balancer/trades/optimism/balancer_v2_optimism_trades.sql +++ b/models/balancer/optimism/balancer_v2_optimism_trades.sql @@ -4,9 +4,9 @@ alias = 'trades', materialized = 'view', post_hook = '{{ expose_spells(\'["optimism"]\', - spell_type = "project", - spell_name = "balancer", - contributors = \'["mendesfabio", "jacektrocinski", "thetroyharris", "tomfutago", "viniabussafi"]\') }}' + "project", + "balancer_v2", + \'["mendesfabio", "jacektrocinski", "thetroyharris", "tomfutago", "viniabussafi"]\') }}' ) }} diff --git a/models/_project/balancer/bpt/optimism/balancer_v2_optimism_transfers_bpt.sql b/models/balancer/optimism/balancer_v2_optimism_transfers_bpt.sql similarity index 100% rename from models/_project/balancer/bpt/optimism/balancer_v2_optimism_transfers_bpt.sql rename to models/balancer/optimism/balancer_v2_optimism_transfers_bpt.sql diff --git a/models/_project/balancer/pools/polygon/balancer_polygon_pools_tokens_weights.sql b/models/balancer/polygon/balancer_polygon_pools_tokens_weights.sql similarity index 100% rename from models/_project/balancer/pools/polygon/balancer_polygon_pools_tokens_weights.sql rename to models/balancer/polygon/balancer_polygon_pools_tokens_weights.sql diff --git a/models/balancer/polygon/balancer_polygon_schema.yml b/models/balancer/polygon/balancer_polygon_schema.yml new file mode 100644 index 00000000000..4f2bbd24412 --- /dev/null +++ b/models/balancer/polygon/balancer_polygon_schema.yml @@ -0,0 +1,454 @@ +version: 2 + +models: + - name: balancer_v2_polygon_pools_fees + meta: + blockchain: polygon + project: balancer_v2 + contributors: jacektrocinski, thetroyharris, viniabussafi + config: + tags: ['polygon', 'balancer', 'pools_fees'] + description: > + Balancer v2 swap fees stored at the pool level. + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - block_number + - tx_hash + - index + columns: + - name: blockchain + - name: version + - &contract_address + name: contract_address + description: 'Polygon address for the liquidity pool used in transaction' + tests: + - not_null + - &tx_hash + name: tx_hash + description: 'Transaction hash' + tests: + - not_null + - &index + name: index + description: '' + tests: + - not_null + - &tx_index + name: tx_index + description: '' + tests: + - not_null + - &block_time + name: block_time + description: '' + tests: + - not_null + - &block_number + name: block_number + description: 'Block number' + tests: + - not_null + - &swap_fee_percentage + name: swap_fee_percentage + description: 'Swap fees for the pool, values are returned with 18 decimals (1e18 meaning 100%)' + tests: + - not_null + + - name: balancer_v2_polygon_transfers_bpt + meta: + blockchain: polygon + project: balancer_v2 + contributors: victorstefenon, thetroyharris, viniabussafi + config: + tags: ['polygon', 'bpt', 'transfers'] + description: > + Balancer Pool Token (BPT) transfer logs on Balancer, an automated portfolio manager and trading platform, on Polygon. + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - evt_tx_hash + - evt_index + - block_date + columns: + - &blockchain + name: blockchain + description: "Blockchain" + - name: version + - *contract_address + - &block_date + name: block_date + description: "UTC event block date of each DEX trade" + - &block_month + name: block_month + description: "UTC event block month of each DEX trade" + - &evt_tx_hash + name: evt_tx_hash + description: 'Transaction hash of transfer event' + - &evt_index + name: evt_index + description: 'Event index' + - &evt_block_time + name: evt_block_time + description: 'Block time of transfer event' + - &evt_block_number + name: evt_block_number + description: 'Block number of transfer event' + - &from + name: from + description: 'Address of BPT provider of transfer event' + - &to + name: to + description: 'Address of BPT receiver of transfer event' + - &value + name: value + description: 'Amount of BPT transferred in transfer event' + + - name: balancer_polygon_pools_tokens_weights + meta: + blockchain: polygon + project: balancer + contributors: jacektrocinski, viniabussafi + config: + tags: ['polygon', 'balancer', 'pools', 'tokens', 'weights'] + description: > + Token weights in Balancer pools. + columns: + - *blockchain + - name: version + - &pool_id + name: pool_id + description: 'Unique encoded identifier that refers to each pool' + tests: + - not_null + - &token_address + name: token_address + description: 'Contract address for the token' + - &normalized_weight + name: normalized_weight + description: 'Weight of the token in the pool.' + + - name: balancer_v2_polygon_pools_tokens_weights + meta: + blockchain: polygon + project: balancer + contributors: jacektrocinski, viniabussafi + config: + tags: ['polygon', 'balancer', 'pools', 'tokens', 'weights'] + description: > + Token weights in Balancer v2 pools. + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - pool_id + - token_address + columns: + - *blockchain + - name: version + - *pool_id + - *token_address + - *normalized_weight + + - name: balancer_polygon_trades + meta: + blockchain: polygon + sector: dex + contributors: bizzyvinci + config: + tags: ['balancer', 'polygon', 'amm', 'trades', 'dex'] + description: > + DEX trades on balancer on polygon + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - block_date + - blockchain + - project + - version + - tx_hash + - evt_index + - check_dex_seed: + blockchain: polygon + project: balancer + version: 2 + columns: + - *blockchain + - &project + name: project + description: "Project name (balancer)" + - &version + name: version + description: "Version of the project" + - *block_month + - *block_date + - *block_time + - &token_bought_symbol + name: token_bought_symbol + description: "Token symbol for token bought in the trade" + - &token_sold_symbol + name: token_sold_symbol + description: "Token symbol for token sold in the trade" + - &token_pair + name: token_pair + description: "Token symbol pair for each token involved in the trade" + - &token_bought_amount + name: token_bought_amount + description: "Value of the token bought at time of execution in the original currency" + - &token_sold_amount + name: token_sold_amount + description: "Value of the token sold at time of execution in the original currency" + - &token_bought_amount_raw + name: token_bought_amount_raw + description: "Raw value of the token bought at time of execution in the original currency" + - &token_sold_amount_raw + name: token_sold_amount_raw + description: "Raw value of the token sold at time of execution in the original currency" + - &amount_usd + name: amount_usd + description: "USD value of the trade at time of execution" + - &token_bought_address + name: token_bought_address + description: "Contract address of the token bought" + - &token_sold_address + name: token_sold_address + description: "Contract address of the token sold" + - &taker + name: taker + description: "Address of trader who purchased a token" + - &maker + name: maker + description: "Address of trader who sold a token" + - *pool_id + - &swap_fee + name: swap_fee + description: 'Swap fee' + - &project_contract_address + name: project_contract_address + description: "Pool address" + - name: pool_symbol + - name: pool_type + - *tx_hash + - &tx_from + name: tx_from + description: "transaction.from" + - &tx_to + name: tx_to + description: "transaction.to" + - *evt_index + + - name: balancer_v2_polygon_liquidity + meta: + blockchain: polygon + project: balancer_v2 + contributors: victorstefenon, viniabussafi, thetroyharris + config: + tags: ['polygon', 'balancer', 'pools', 'liquidity'] + description: > + Balancer v2 pools liquidity by token in Polygon. + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - day + - pool_id + - token_address + columns: + - name: day + description: 'UTC event block time truncated to the day mark' + - *pool_id + - name: pool_address + - name: pool_symbol + description: 'Symbol of the pool, consisting of the symbol of its tokens and their respective weights' + - name: version + description: 'Version of Balancer in which pool was deployed' + - name: blockchain + description: 'Blockchain in which pool was deployed' + - *token_address + - name: token_symbol + description: 'Symbol of the token' + - name: token_balance_raw + description: 'Raw balance of the token in the pool' + - name: token_balance + description: 'Scaled balance of the token in the pool' + - name: protocol_liquidity_usd + description: 'Liquidity of the token in the pool in USD, except BPTs' + - name: protocol_liquidity_eth + description: 'Liquidity of the token in the pool in ETH, except BPTs' + - name: pool_liquidity_usd + description: 'Liquidity of the token in the pool in USD, including BPTs' + - name: pool_liquidity_eth + description: 'Liquidity of the token in the pool in ETH, including BPTs' + + - name: balancer_v2_polygon_lbps + meta: + blockchain: polygon + project: balancer_v2 + contributors: stefenon + config: + tags: ['polygon', 'balancer', 'lbp'] + description: > + Record of the Liquidity Boostrapping Pools (LBP) of Balancer, an automated portfolio manager and trading platform, on Polygon. + columns: + - name: name + description: 'Name of the LBP' + - name: pool_id + description: 'ID of the LBP' + - name: token_sold + description: 'Contract address of the token sold by the LBP' + - name: token_symbol + description: 'Symbol of the token sold by the LBP' + - name: start_time + description: 'LBP start time' + - name: end_time + description: 'LBP end time' + + - name: balancer_v2_polygon_flashloans + meta: + blockchain: polygon + sector: lending + contributors: hildobby + config: + tags: ['polygon', 'flashloans'] + description: > + All Balancer flashloans on Polygon + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - blockchain + - tx_hash + - evt_index + columns: + - name: blockchain + - name: project + - name: version + - name: block_time + - name: block_number + - name: amount + - name: amount_usd + - name: tx_hash + - name: evt_index + - name: fee + - name: currency_contract + - name: currency_symbol + - name: recipient + - name: contract_address + - name: block_month + + - name: balancer_v2_polygon_bpt_prices + meta: + blockchain: polygon + project: balancer_v2 + contributors: victorstefenon, thetroyharris, viniabussafi + config: + tags: ['polygon', 'bpt', 'prices'] + description: > + Balancer Pool Token (BPT) hourly median price by pool on Balancer, an automated portfolio manager and trading platform. + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - blockchain + - day + - contract_address + columns: + - name: blockchain + - name: day + - name: version + - name: decimals + - name: contract_address + - name: bpt_price + + - name: balancer_v2_polygon_trades + meta: + blockchain: polygon + sector: dex + contributors: bizzyvinci, thetroyharris, tomfutago, viniabussafi + config: + tags: [ 'balancer', 'polygon', 'amm', 'trades', 'dex', 'beta' ] + description: > + DEX trades on balancer v2 on polygon + columns: + - *blockchain + - *project + - *version + - *block_month + - *block_date + - *block_time + - name: block_number + - *token_bought_symbol + - *token_sold_symbol + - *token_pair + - *token_bought_amount + - *token_sold_amount + - *token_bought_amount_raw + - *token_sold_amount_raw + - *amount_usd + - *token_bought_address + - *token_sold_address + - *taker + - *maker + - *project_contract_address + - name: pool_symbol + - name: pool_type + - *pool_id + - *swap_fee + - *tx_hash + - *tx_from + - *tx_to + - *evt_index + + - name: balancer_v2_polygon_protocol_fee + meta: + blockchain: polygon + project: balancer_v2 + contributors: viniabussafi + config: + tags: ['polygon', 'revenue', 'fees'] + description: > + Daily Protocol Fee collected and Revenue by pool on Balancer, an automated portfolio manager and trading platform. + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - day + - pool_id + - token_address + columns: + - name: day + - name: pool_id + - name: pool_address + - name: pool_symbol + - name: version + - name: blockchain + - name: token_address + - name: token_symbol + - name: token_amount_raw + description: "Raw amount of revenues of the token in the pool" + - name: token_amount + description: "Amount of revenues of the token in the pool" + - name: protocol_fee_collected_usd + description: "Fee collected in the pool in USD" + - name: treasury_share + description: "Share of total revenue that is directed to Balancer DAO's treasury, as per BIPs 19, 161 and 371" + - name: treasury_revenue_usd + description: "Total revenue directed to Balancer DAO's treasury" + + - name: balancer_v2_polygon_bpt_supply + meta: + blockchain: polygon + project: balancer_v2 + contributors: thetroyharris, viniabussafi + config: + tags: ['polygon', 'bpt', 'supply'] + description: > + Balancer Pool Token (BPT) supply for ComposableStablePools versions 4 and 5. + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - day + - blockchain + - token_address + columns: + - name: day + - name: pool_type + - name: version + - name: blockchain + - name: token_address + - name: supply \ No newline at end of file diff --git a/models/_project/balancer/trades/polygon/balancer_polygon_trades.sql b/models/balancer/polygon/balancer_polygon_trades.sql similarity index 100% rename from models/_project/balancer/trades/polygon/balancer_polygon_trades.sql rename to models/balancer/polygon/balancer_polygon_trades.sql diff --git a/models/_project/balancer/bpt/polygon/balancer_v2_polygon_bpt_prices.sql b/models/balancer/polygon/balancer_v2_polygon_bpt_prices.sql similarity index 100% rename from models/_project/balancer/bpt/polygon/balancer_v2_polygon_bpt_prices.sql rename to models/balancer/polygon/balancer_v2_polygon_bpt_prices.sql diff --git a/models/_project/balancer/bpt/polygon/balancer_v2_polygon_bpt_supply.sql b/models/balancer/polygon/balancer_v2_polygon_bpt_supply.sql similarity index 100% rename from models/_project/balancer/bpt/polygon/balancer_v2_polygon_bpt_supply.sql rename to models/balancer/polygon/balancer_v2_polygon_bpt_supply.sql diff --git a/models/_project/balancer/flashloans/polygon/balancer_v2_polygon_flashloans.sql b/models/balancer/polygon/balancer_v2_polygon_flashloans.sql similarity index 88% rename from models/_project/balancer/flashloans/polygon/balancer_v2_polygon_flashloans.sql rename to models/balancer/polygon/balancer_v2_polygon_flashloans.sql index 392c3866d89..0f0cb1d9982 100644 --- a/models/_project/balancer/flashloans/polygon/balancer_v2_polygon_flashloans.sql +++ b/models/balancer/polygon/balancer_v2_polygon_flashloans.sql @@ -6,6 +6,10 @@ , file_format = 'delta' , incremental_strategy = 'merge' , unique_key = ['tx_hash', 'evt_index'] + , post_hook='{{ expose_spells(\'["polygon"]\', + "project", + "balancer_v2", + \'["hildobby"]\') }}' ) }} diff --git a/models/_project/balancer/pools/polygon/balancer_v2_polygon_lbps.sql b/models/balancer/polygon/balancer_v2_polygon_lbps.sql similarity index 100% rename from models/_project/balancer/pools/polygon/balancer_v2_polygon_lbps.sql rename to models/balancer/polygon/balancer_v2_polygon_lbps.sql diff --git a/models/_project/balancer/liquidity/polygon/balancer_v2_polygon_liquidity.sql b/models/balancer/polygon/balancer_v2_polygon_liquidity.sql similarity index 52% rename from models/_project/balancer/liquidity/polygon/balancer_v2_polygon_liquidity.sql rename to models/balancer/polygon/balancer_v2_polygon_liquidity.sql index 3f0c521ade6..f830e2df02c 100644 --- a/models/_project/balancer/liquidity/polygon/balancer_v2_polygon_liquidity.sql +++ b/models/balancer/polygon/balancer_v2_polygon_liquidity.sql @@ -6,7 +6,11 @@ schema = 'balancer_v2_polygon', alias = 'liquidity', materialized = 'table', - file_format = 'delta' + file_format = 'delta', + post_hook="{{ expose_spells('[\"" + blockchain + '"]' + '\', + "project", + "balancer_v2", + \'["stefenon", "viniabussafi"]\') }}' ) }} diff --git a/models/_project/balancer/pools/polygon/balancer_v2_polygon_pools_fees.sql b/models/balancer/polygon/balancer_v2_polygon_pools_fees.sql similarity index 77% rename from models/_project/balancer/pools/polygon/balancer_v2_polygon_pools_fees.sql rename to models/balancer/polygon/balancer_v2_polygon_pools_fees.sql index 586839b9ff9..556cb0003af 100644 --- a/models/_project/balancer/pools/polygon/balancer_v2_polygon_pools_fees.sql +++ b/models/balancer/polygon/balancer_v2_polygon_pools_fees.sql @@ -1,12 +1,17 @@ {{ config( schema = 'balancer_v2_polygon', + alias = 'pools_fees', materialized = 'incremental', file_format = 'delta', incremental_strategy = 'merge', - unique_key = ['block_number', 'tx_hash', 'index'] - ) + unique_key = ['block_number', 'tx_hash', 'index'], + post_hook='{{ expose_spells(\'["polygon"]\', + "project", + "balancer_v2", + \'["metacrypto", "jacektrocinski", "thetroyharris", "viniabussafi"]\') }}' + )  }} {% set event_signature = '0xa9ba3ffe0b6c366b81232caab38605a0699ad5398d6cce76f91ee809e322dafc' %} diff --git a/models/_project/balancer/pools/polygon/balancer_v2_polygon_pools_tokens_weights.sql b/models/balancer/polygon/balancer_v2_polygon_pools_tokens_weights.sql similarity index 99% rename from models/_project/balancer/pools/polygon/balancer_v2_polygon_pools_tokens_weights.sql rename to models/balancer/polygon/balancer_v2_polygon_pools_tokens_weights.sql index 20023ba61c3..afc223ecb81 100644 --- a/models/_project/balancer/pools/polygon/balancer_v2_polygon_pools_tokens_weights.sql +++ b/models/balancer/polygon/balancer_v2_polygon_pools_tokens_weights.sql @@ -2,6 +2,7 @@ config( schema='balancer_v2_polygon', alias = 'pools_tokens_weights', + materialized = 'incremental', file_format = 'delta', incremental_strategy = 'merge', diff --git a/models/_project/balancer/protocol_fee/polygon/balancer_v2_polygon_protocol_fee.sql b/models/balancer/polygon/balancer_v2_polygon_protocol_fee.sql similarity index 100% rename from models/_project/balancer/protocol_fee/polygon/balancer_v2_polygon_protocol_fee.sql rename to models/balancer/polygon/balancer_v2_polygon_protocol_fee.sql diff --git a/models/_project/balancer/trades/polygon/balancer_v2_polygon_trades.sql b/models/balancer/polygon/balancer_v2_polygon_trades.sql similarity index 94% rename from models/_project/balancer/trades/polygon/balancer_v2_polygon_trades.sql rename to models/balancer/polygon/balancer_v2_polygon_trades.sql index 37b12105abe..a17dabab52d 100644 --- a/models/_project/balancer/trades/polygon/balancer_v2_polygon_trades.sql +++ b/models/balancer/polygon/balancer_v2_polygon_trades.sql @@ -4,9 +4,9 @@ alias = 'trades', materialized = 'view', post_hook = '{{ expose_spells(\'["polygon"]\', - spell_type = "project", - spell_name = "balancer", - contributors = \'["mendesfabio", "jacektrocinski", "thetroyharris", "tomfutago", "viniabussafi"]\') }}' + "project", + "balancer_v2", + \'["mendesfabio", "jacektrocinski", "thetroyharris", "tomfutago", "viniabussafi"]\') }}' ) }} diff --git a/models/_project/balancer/bpt/polygon/balancer_v2_polygon_transfers_bpt.sql b/models/balancer/polygon/balancer_v2_polygon_transfers_bpt.sql similarity index 100% rename from models/_project/balancer/bpt/polygon/balancer_v2_polygon_transfers_bpt.sql rename to models/balancer/polygon/balancer_v2_polygon_transfers_bpt.sql diff --git a/models/_project/balancer/bpt/zkevm/balancer_v2_zkevm_bpt_prices.sql b/models/balancer/zkevm/balancer_v2_zkevm_bpt_prices.sql similarity index 100% rename from models/_project/balancer/bpt/zkevm/balancer_v2_zkevm_bpt_prices.sql rename to models/balancer/zkevm/balancer_v2_zkevm_bpt_prices.sql diff --git a/models/_project/balancer/bpt/zkevm/balancer_v2_zkevm_bpt_supply.sql b/models/balancer/zkevm/balancer_v2_zkevm_bpt_supply.sql similarity index 100% rename from models/_project/balancer/bpt/zkevm/balancer_v2_zkevm_bpt_supply.sql rename to models/balancer/zkevm/balancer_v2_zkevm_bpt_supply.sql diff --git a/models/_project/balancer/flashloans/zkevm/balancer_v2_zkevm_flashloans.sql b/models/balancer/zkevm/balancer_v2_zkevm_flashloans.sql similarity index 88% rename from models/_project/balancer/flashloans/zkevm/balancer_v2_zkevm_flashloans.sql rename to models/balancer/zkevm/balancer_v2_zkevm_flashloans.sql index 3e1d9d1a6f5..a11355919f7 100644 --- a/models/_project/balancer/flashloans/zkevm/balancer_v2_zkevm_flashloans.sql +++ b/models/balancer/zkevm/balancer_v2_zkevm_flashloans.sql @@ -6,6 +6,10 @@ , file_format = 'delta' , incremental_strategy = 'merge' , unique_key = ['tx_hash', 'evt_index'] + , post_hook='{{ expose_spells(\'["zkevm"]\', + "project", + "balancer_v2", + \'["hildobby", "viniabussafi"]\') }}' ) }} diff --git a/models/_project/balancer/liquidity/zkevm/balancer_v2_zkevm_liquidity.sql b/models/balancer/zkevm/balancer_v2_zkevm_liquidity.sql similarity index 51% rename from models/_project/balancer/liquidity/zkevm/balancer_v2_zkevm_liquidity.sql rename to models/balancer/zkevm/balancer_v2_zkevm_liquidity.sql index 737b858ca3c..f3fd420bb39 100644 --- a/models/_project/balancer/liquidity/zkevm/balancer_v2_zkevm_liquidity.sql +++ b/models/balancer/zkevm/balancer_v2_zkevm_liquidity.sql @@ -6,7 +6,11 @@ schema = 'balancer_v2_zkevm', alias = 'liquidity', materialized = 'table', - file_format = 'delta' + file_format = 'delta', + post_hook="{{ expose_spells('[\"" + blockchain + '"]' + '\', + "project", + "balancer_v2", + \'["stefenon", "viniabussafi"]\') }}' ) }} diff --git a/models/_project/balancer/pools/zkevm/balancer_v2_zkevm_pools_fees.sql b/models/balancer/zkevm/balancer_v2_zkevm_pools_fees.sql similarity index 82% rename from models/_project/balancer/pools/zkevm/balancer_v2_zkevm_pools_fees.sql rename to models/balancer/zkevm/balancer_v2_zkevm_pools_fees.sql index 87bf3434eba..a92e4c5c00c 100644 --- a/models/_project/balancer/pools/zkevm/balancer_v2_zkevm_pools_fees.sql +++ b/models/balancer/zkevm/balancer_v2_zkevm_pools_fees.sql @@ -6,7 +6,11 @@ file_format = 'delta', incremental_strategy = 'merge', unique_key = ['block_number', 'tx_hash', 'index'], - ) + post_hook='{{ expose_spells(\'["zkevm"]\', + "project", + "balancer_v2", + \'["metacrypto", "jacektrocinski", "thetroyharris", "viniabussafi"]\') }}' + )  }} {% set event_signature = '0xa9ba3ffe0b6c366b81232caab38605a0699ad5398d6cce76f91ee809e322dafc' %} diff --git a/models/_project/balancer/pools/zkevm/balancer_v2_zkevm_pools_tokens_weights.sql b/models/balancer/zkevm/balancer_v2_zkevm_pools_tokens_weights.sql similarity index 100% rename from models/_project/balancer/pools/zkevm/balancer_v2_zkevm_pools_tokens_weights.sql rename to models/balancer/zkevm/balancer_v2_zkevm_pools_tokens_weights.sql diff --git a/models/_project/balancer/protocol_fee/zkevm/balancer_v2_zkevm_protocol_fee.sql b/models/balancer/zkevm/balancer_v2_zkevm_protocol_fee.sql similarity index 100% rename from models/_project/balancer/protocol_fee/zkevm/balancer_v2_zkevm_protocol_fee.sql rename to models/balancer/zkevm/balancer_v2_zkevm_protocol_fee.sql diff --git a/models/_project/balancer/trades/zkevm/balancer_v2_zkevm_trades.sql b/models/balancer/zkevm/balancer_v2_zkevm_trades.sql similarity index 94% rename from models/_project/balancer/trades/zkevm/balancer_v2_zkevm_trades.sql rename to models/balancer/zkevm/balancer_v2_zkevm_trades.sql index 36cc38e4a44..340fbe1dbd8 100644 --- a/models/_project/balancer/trades/zkevm/balancer_v2_zkevm_trades.sql +++ b/models/balancer/zkevm/balancer_v2_zkevm_trades.sql @@ -4,9 +4,9 @@ alias = 'trades', materialized = 'view', post_hook = '{{ expose_spells(\'["zkevm"]\', - spell_type = "project", - spell_name = "balancer", - contributors = \'["mendesfabio", "jacektrocinski", "thetroyharris", "tomfutago", "viniabussafi"]\') }}' + "project", + "balancer_v2", + \'["mendesfabio", "jacektrocinski", "thetroyharris", "tomfutago", "viniabussafi"]\') }}' ) }} diff --git a/models/_project/balancer/bpt/zkevm/balancer_v2_zkevm_transfers_bpt.sql b/models/balancer/zkevm/balancer_v2_zkevm_transfers_bpt.sql similarity index 100% rename from models/_project/balancer/bpt/zkevm/balancer_v2_zkevm_transfers_bpt.sql rename to models/balancer/zkevm/balancer_v2_zkevm_transfers_bpt.sql diff --git a/models/_project/balancer/pools/zkevm/balancer_zkevm_pools_tokens_weights.sql b/models/balancer/zkevm/balancer_zkevm_pools_tokens_weights.sql similarity index 100% rename from models/_project/balancer/pools/zkevm/balancer_zkevm_pools_tokens_weights.sql rename to models/balancer/zkevm/balancer_zkevm_pools_tokens_weights.sql diff --git a/models/balancer/zkevm/balancer_zkevm_schema.yml b/models/balancer/zkevm/balancer_zkevm_schema.yml new file mode 100644 index 00000000000..a573e89563d --- /dev/null +++ b/models/balancer/zkevm/balancer_zkevm_schema.yml @@ -0,0 +1,431 @@ +version: 2 + +models: + - name: balancer_v2_zkevm_pools_fees + meta: + blockchain: zkevm + project: balancer_v2 + contributors: jacektrocinski, thetroyharris, viniabussafi + config: + tags: ['zkevm', 'balancer', 'pools_fees'] + description: > + Balancer v2 swap fees stored at the pool level. + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - block_number + - tx_hash + - index + columns: + - name: blockchain + - name: version + - &contract_address + name: contract_address + description: 'zkevm address for the liquidity pool used in transaction' + tests: + - not_null + - &tx_hash + name: tx_hash + description: 'Transaction hash' + tests: + - not_null + - &index + name: index + description: '' + tests: + - not_null + - &tx_index + name: tx_index + description: '' + tests: + - not_null + - &block_time + name: block_time + description: '' + tests: + - not_null + - &block_number + name: block_number + description: 'Block number' + tests: + - not_null + - &swap_fee_percentage + name: swap_fee_percentage + description: 'Swap fees for the pool, values are returned with 18 decimals (1e18 meaning 100%)' + tests: + - not_null + + - name: balancer_v2_zkevm_transfers_bpt + meta: + blockchain: zkevm + project: balancer_v2 + contributors: victorstefenon, thetroyharris, viniabussafi + config: + tags: ['zkevm', 'bpt', 'transfers'] + description: > + Balancer Pool Token (BPT) transfer logs on Balancer, an automated portfolio manager and trading platform, on Polygon. + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - evt_tx_hash + - evt_index + - block_date + columns: + - &blockchain + name: blockchain + description: "Blockchain" + - name: version + - *contract_address + - &block_date + name: block_date + description: "UTC event block date of each DEX trade" + - &block_month + name: block_month + description: "UTC event block month of each DEX trade" + - &evt_tx_hash + name: evt_tx_hash + description: 'Transaction hash of transfer event' + - &evt_index + name: evt_index + description: 'Event index' + - &evt_block_time + name: evt_block_time + description: 'Block time of transfer event' + - &evt_block_number + name: evt_block_number + description: 'Block number of transfer event' + - &from + name: from + description: 'Address of BPT provider of transfer event' + - &to + name: to + description: 'Address of BPT receiver of transfer event' + - &value + name: value + description: 'Amount of BPT transferred in transfer event' + + - name: balancer_zkevm_pools_tokens_weights + meta: + blockchain: zkevm + project: balancer + contributors: jacektrocinski, viniabussafi + config: + tags: ['zkevm', 'balancer', 'pools', 'tokens', 'weights'] + description: > + Token weights in Balancer pools. + columns: + - name: blockchain + - name: version + - &pool_id + name: pool_id + description: 'Unique encoded identifier that refers to each pool' + tests: + - not_null + - &token_address + name: token_address + description: 'Contract address for the token' + - &normalized_weight + name: normalized_weight + description: 'Weight of the token in the pool.' + + - name: balancer_v2_zkevm_pools_tokens_weights + meta: + blockchain: zkevm + project: balancer + contributors: jacektrocinski, viniabussafi + config: + tags: ['zkevm', 'balancer', 'pools', 'tokens', 'weights'] + description: > + Token weights in Balancer v2 pools. + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - pool_id + - token_address + columns: + - name: blockchain + - name: version + - name: pool_id + - name: token_address + - name: normalized_weight + + - name: balancer_zkevm_trades + meta: + blockchain: zkevm + sector: dex + contributors: bizzyvinci, viniabussafi + config: + tags: ['balancer', 'zkevm', 'amm', 'trades', 'dex'] + description: > + DEX trades on balancer on zkevm + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - block_date + - blockchain + - project + - version + - tx_hash + - evt_index + - check_dex_seed: + blockchain: zkevm + project: balancer + version: 2 + columns: + - name: blockchain + - &project + name: project + description: "Project name (balancer)" + - &version + name: version + description: "Version of the project" + - name: block_month + - name: block_date + - name: block_time + - &token_bought_symbol + name: token_bought_symbol + description: "Token symbol for token bought in the trade" + - &token_sold_symbol + name: token_sold_symbol + description: "Token symbol for token sold in the trade" + - &token_pair + name: token_pair + description: "Token symbol pair for each token involved in the trade" + - &token_bought_amount + name: token_bought_amount + description: "Value of the token bought at time of execution in the original currency" + - &token_sold_amount + name: token_sold_amount + description: "Value of the token sold at time of execution in the original currency" + - &token_bought_amount_raw + name: token_bought_amount_raw + description: "Raw value of the token bought at time of execution in the original currency" + - &token_sold_amount_raw + name: token_sold_amount_raw + description: "Raw value of the token sold at time of execution in the original currency" + - &amount_usd + name: amount_usd + description: "USD value of the trade at time of execution" + - &token_bought_address + name: token_bought_address + description: "Contract address of the token bought" + - &token_sold_address + name: token_sold_address + description: "Contract address of the token sold" + - &taker + name: taker + description: "Address of trader who purchased a token" + - &maker + name: maker + description: "Address of trader who sold a token" + - name: pool_id + - &swap_fee + name: swap_fee + description: 'Swap fee' + - &project_contract_address + name: project_contract_address + description: "Pool address" + - name: pool_symbol + - name: pool_type + - name: tx_hash + - &tx_from + name: tx_from + description: "transaction.from" + - &tx_to + name: tx_to + description: "transaction.to" + - name: evt_index + + - name: balancer_v2_zkevm_liquidity + meta: + blockchain: zkevm + project: balancer_v2 + contributors: victorstefenon, viniabussafi, thetroyharris + config: + tags: ['zkevm', 'balancer', 'pools', 'liquidity'] + description: > + Balancer v2 pools liquidity by token in zkevm. + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - day + - pool_id + - token_address + columns: + - name: day + description: 'UTC event block time truncated to the day mark' + - name: pool_id + - name: pool_address + - name: pool_symbol + description: 'Symbol of the pool, consisting of the symbol of its tokens and their respective weights' + - name: version + description: 'Version of Balancer in which pool was deployed' + - name: blockchain + description: 'Blockchain in which pool was deployed' + - name: token_address + - name: token_symbol + description: 'Symbol of the token' + - name: token_balance_raw + description: 'Raw balance of the token in the pool' + - name: token_balance + description: 'Scaled balance of the token in the pool' + - name: protocol_liquidity_usd + description: 'Liquidity of the token in the pool in USD, except BPTs' + - name: protocol_liquidity_eth + description: 'Liquidity of the token in the pool in ETH, except BPTs' + - name: pool_liquidity_usd + description: 'Liquidity of the token in the pool in USD, including BPTs' + - name: pool_liquidity_eth + description: 'Liquidity of the token in the pool in ETH, including BPTs' + + - name: balancer_v2_zkevm_flashloans + meta: + blockchain: zkevm + sector: lending + contributors: hildobby, viniabussafi + config: + tags: ['zkevm', 'flashloans'] + description: > + All Balancer flashloans on zkevm + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - blockchain + - tx_hash + - evt_index + columns: + - name: blockchain + - name: project + - name: version + - name: block_time + - name: block_number + - name: amount + - name: amount_usd + - name: tx_hash + - name: evt_index + - name: fee + - name: currency_contract + - name: currency_symbol + - name: recipient + - name: contract_address + - name: block_month + + - name: balancer_v2_zkevm_bpt_prices + meta: + blockchain: zkevm + project: balancer_v2 + contributors: victorstefenon, thetroyharris, viniabussafi + config: + tags: ['zkevm', 'bpt', 'prices'] + description: > + Balancer Pool Token (BPT) hourly median price by pool on Balancer, an automated portfolio manager and trading platform. + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - blockchain + - day + - contract_address + columns: + - name: blockchain + - name: day + - name: version + - name: decimals + - name: contract_address + - name: bpt_price + + - name: balancer_v2_zkevm_trades + meta: + blockchain: zkevm + sector: dex + contributors: bizzyvinci, thetroyharris, tomfutago, viniabussafi + config: + tags: [ 'balancer', 'zkevm', 'amm', 'trades', 'dex', 'beta' ] + description: > + DEX trades on balancer v2 on zkevm + columns: + - name: blockchain + - name: project + - name: version + - name: block_month + - name: block_date + - name: block_time + - name: block_number + - name: token_bought_symbol + - name: token_sold_symbol + - name: token_pair + - name: token_bought_amount + - name: token_sold_amount + - name: token_bought_amount_raw + - name: token_sold_amount_raw + - name: amount_usd + - name: token_bought_address + - name: token_sold_address + - name: taker + - name: maker + - name: project_contract_address + - name: pool_symbol + - name: pool_type + - name: pool_id + - name: swap_fee + - name: tx_hash + - name: tx_from + - name: tx_to + - name: evt_index + + - name: balancer_v2_zkevm_protocol_fee + meta: + blockchain: zkevm + project: balancer_v2 + contributors: viniabussafi + config: + tags: ['zkevm', 'revenue', 'fees'] + description: > + Daily Protocol Fee collected and Revenue by pool on Balancer, an automated portfolio manager and trading platform. + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - day + - pool_id + - token_address + columns: + - name: day + - name: pool_id + - name: pool_address + - name: pool_symbol + - name: version + - name: blockchain + - name: token_address + - name: token_symbol + - name: token_amount_raw + description: "Raw amount of revenues of the token in the pool" + - name: token_amount + description: "Amount of revenues of the token in the pool" + - name: protocol_fee_collected_usd + description: "Fee collected in the pool in USD" + - name: treasury_share + description: "Share of total revenue that is directed to Balancer DAO's treasury, as per BIPs 19, 161 and 371" + - name: treasury_revenue_usd + description: "Total revenue directed to Balancer DAO's treasury" + + - name: balancer_v2_zkevm_bpt_supply + meta: + blockchain: zkevm + project: balancer_v2 + contributors: thetroyharris, viniabussafi + config: + tags: ['zkevm', 'bpt', 'supply'] + description: > + Balancer Pool Token (BPT) supply for ComposableStablePools versions 4 and 5. + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - day + - blockchain + - token_address + columns: + - name: day + - name: pool_type + - name: version + - name: blockchain + - name: token_address + - name: supply diff --git a/models/_project/balancer/trades/zkevm/balancer_zkevm_trades.sql b/models/balancer/zkevm/balancer_zkevm_trades.sql similarity index 100% rename from models/_project/balancer/trades/zkevm/balancer_zkevm_trades.sql rename to models/balancer/zkevm/balancer_zkevm_trades.sql From 8e1ef8576c68892f780e742392538bd1feaa7b42 Mon Sep 17 00:00:00 2001 From: jeff-dude <102681548+jeff-dude@users.noreply.github.com> Date: Tue, 4 Jun 2024 15:11:45 -0400 Subject: [PATCH 039/149] Revert "Revert "Organize Balancer Spells into folders (#6005)" (#6074)" (#6075) This reverts commit 724f6343de48498d045e07fcba6349a73110282b. --- dbt_project.yml | 13 - .../balancer/balancer_bpt_supply_macro.sql | 34 +- ...l_token_supply_changes_daily_agg_macro.sql | 37 + ...lancer_pool_token_supply_changes_macro.sql | 130 ++++ ..._token_balance_changes_daily_agg_macro.sql | 184 +++++ .../balancer_token_balance_changes_macro.sql | 169 +++++ models/_project/balancer/balances/_schema.yml | 98 +++ .../balancer/balances/arbitrum/_schema.yml | 100 +++ ...ncer_v2_arbitrum_token_balance_changes.sql | 16 + ...2_arbitrum_token_balance_changes_daily.sql | 17 + .../balancer/balances/avalanche_c/_schema.yml | 100 +++ ...r_v2_avalanche_c_token_balance_changes.sql | 16 + ...valanche_c_token_balance_changes_daily.sql | 17 + .../balancer_token_balance_changes.sql | 46 ++ .../balancer_token_balance_changes_daily.sql | 43 ++ .../balancer/balances/base/_schema.yml | 100 +++ ...balancer_v2_base_token_balance_changes.sql | 16 + ...er_v2_base_token_balance_changes_daily.sql | 17 + .../balancer/balances/ethereum/_schema.yml | 131 ++++ .../ethereum/balancer_ethereum_balances.sql | 11 +- ...ncer_v2_ethereum_token_balance_changes.sql | 16 + ...2_ethereum_token_balance_changes_daily.sql | 17 + .../balancer/balances/gnosis/_schema.yml | 100 +++ ...lancer_v2_gnosis_token_balance_changes.sql | 16 + ..._v2_gnosis_token_balance_changes_daily.sql | 17 + .../balancer/balances/optimism/_schema.yml | 100 +++ ...ncer_v2_optimism_token_balance_changes.sql | 16 + ...2_optimism_token_balance_changes_daily.sql | 17 + .../balancer/balances/polygon/_schema.yml | 100 +++ ...ancer_v2_polygon_token_balance_changes.sql | 16 + ...v2_polygon_token_balance_changes_daily.sql | 17 + .../balancer/balances/zkevm/_schema.yml | 100 +++ ...alancer_v2_zkevm_token_balance_changes.sql | 16 + ...r_v2_zkevm_token_balance_changes_daily.sql | 17 + models/_project/balancer/bpt/_schema.yml | 176 +++++ .../balancer/bpt/arbitrum/_schema.yml | 178 +++++ .../balancer_v2_arbitrum_bpt_prices.sql | 0 .../balancer_v2_arbitrum_bpt_supply.sql | 0 ...alancer_v2_arbitrum_bpt_supply_changes.sql | 20 + ...r_v2_arbitrum_bpt_supply_changes_daily.sql | 17 + .../balancer_v2_arbitrum_transfers_bpt.sql | 0 .../balancer/bpt/avalanche_c/_schema.yml | 178 +++++ .../balancer_v2_avalanche_c_bpt_prices.sql | 0 .../balancer_v2_avalanche_c_bpt_supply.sql | 0 ...ncer_v2_avalanche_c_bpt_supply_changes.sql | 20 + ...2_avalanche_c_bpt_supply_changes_daily.sql | 17 + .../balancer_v2_avalanche_c_transfers_bpt.sql | 0 .../balancer/bpt}/balancer_bpt_prices.sql | 8 +- .../balancer/bpt}/balancer_bpt_supply.sql | 8 +- .../bpt/balancer_bpt_supply_changes.sql | 44 ++ .../bpt/balancer_bpt_supply_changes_daily.sql | 38 + .../balancer/bpt}/balancer_transfers_bpt.sql | 8 +- models/_project/balancer/bpt/base/_schema.yml | 178 +++++ .../bpt}/base/balancer_v2_base_bpt_prices.sql | 0 .../bpt}/base/balancer_v2_base_bpt_supply.sql | 0 .../balancer_v2_base_bpt_supply_changes.sql | 20 + ...ancer_v2_base_bpt_supply_changes_daily.sql | 17 + .../base/balancer_v2_base_transfers_bpt.sql | 0 .../balancer/bpt/ethereum/_schema.yml | 178 +++++ .../balancer_v2_ethereum_bpt_prices.sql | 0 .../balancer_v2_ethereum_bpt_supply.sql | 0 ...alancer_v2_ethereum_bpt_supply_changes.sql | 20 + ...r_v2_ethereum_bpt_supply_changes_daily.sql | 17 + .../balancer_v2_ethereum_transfers_bpt.sql | 0 .../_project/balancer/bpt/gnosis/_schema.yml | 178 +++++ .../gnosis/balancer_v2_gnosis_bpt_prices.sql | 0 .../gnosis/balancer_v2_gnosis_bpt_supply.sql | 0 .../balancer_v2_gnosis_bpt_supply_changes.sql | 20 + ...cer_v2_gnosis_bpt_supply_changes_daily.sql | 17 + .../balancer_v2_gnosis_transfers_bpt.sql | 0 .../balancer/bpt/optimism/_schema.yml | 178 +++++ .../balancer_v2_optimism_bpt_prices.sql | 0 .../balancer_v2_optimism_bpt_supply.sql | 0 ...alancer_v2_optimism_bpt_supply_changes.sql | 20 + ...r_v2_optimism_bpt_supply_changes_daily.sql | 17 + .../balancer_v2_optimism_transfers_bpt.sql | 0 .../_project/balancer/bpt/polygon/_schema.yml | 178 +++++ .../balancer_v2_polygon_bpt_prices.sql | 0 .../balancer_v2_polygon_bpt_supply.sql | 0 ...balancer_v2_polygon_bpt_supply_changes.sql | 20 + ...er_v2_polygon_bpt_supply_changes_daily.sql | 17 + .../balancer_v2_polygon_transfers_bpt.sql | 0 .../_project/balancer/bpt/zkevm/_schema.yml | 178 +++++ .../zkevm/balancer_v2_zkevm_bpt_prices.sql | 0 .../zkevm/balancer_v2_zkevm_bpt_supply.sql | 0 .../balancer_v2_zkevm_bpt_supply_changes.sql | 20 + ...ncer_v2_zkevm_bpt_supply_changes_daily.sql | 17 + .../zkevm/balancer_v2_zkevm_transfers_bpt.sql | 0 .../_project/balancer/flashloans/_schema.yml | 35 + .../balancer/flashloans/arbitrum/_schema.yml | 36 + .../balancer_v2_arbitrum_flashloans.sql | 4 - .../flashloans/avalanche_c/_schema.yml | 36 + .../balancer_v2_avalanche_c_flashloans.sql | 4 - .../flashloans}/balancer_flashloans.sql | 11 +- .../balancer/flashloans/base/_schema.yml | 36 + .../base/balancer_v2_base_flashloans.sql | 4 - .../balancer/flashloans/ethereum/_schema.yml | 36 + .../balancer_v2_ethereum_flashloans.sql | 4 - .../balancer/flashloans/gnosis/_schema.yml | 36 + .../gnosis/balancer_v2_gnosis_flashloans.sql | 4 - .../balancer/flashloans/optimism/_schema.yml | 36 + .../balancer_v2_optimism_flashloans.sql | 4 - .../balancer/flashloans/polygon/_schema.yml | 36 + .../balancer_v2_polygon_flashloans.sql | 4 - .../balancer/flashloans/zkevm/_schema.yml | 36 + .../zkevm/balancer_v2_zkevm_flashloans.sql | 4 - .../_project/balancer/liquidity/_schema.yml | 60 ++ .../balancer/liquidity/arbitrum/_schema.yml | 58 ++ .../balancer_v2_arbitrum_liquidity.sql | 6 +- .../liquidity/avalanche_c/_schema.yml | 58 ++ .../balancer_v2_avalanche_c_liquidity.sql | 6 +- .../liquidity}/balancer_liquidity.sql | 9 +- .../balancer/liquidity/base/_schema.yml | 58 ++ .../base/balancer_v2_base_liquidity.sql | 6 +- .../balancer/liquidity/ethereum/_schema.yml | 96 +++ .../balancer_v1_ethereum_liquidity.sql | 6 +- .../balancer_v2_ethereum_liquidity.sql | 6 +- .../balancer/liquidity/gnosis/_schema.yml | 58 ++ .../gnosis/balancer_v2_gnosis_liquidity.sql | 6 +- .../balancer/liquidity/optimism/_schema.yml | 58 ++ .../balancer_v2_optimism_liquidity.sql | 6 +- .../balancer/liquidity/polygon/_schema.yml | 58 ++ .../polygon/balancer_v2_polygon_liquidity.sql | 6 +- .../balancer/liquidity/zkevm/_schema.yml | 58 ++ .../zkevm/balancer_v2_zkevm_liquidity.sql | 6 +- models/_project/balancer/pools/_schema.yml | 173 +++++ .../balancer/pools/arbitrum/_schema.yml | 105 +++ ...balancer_arbitrum_pools_tokens_weights.sql | 0 .../balancer_v2_arbitrum_pools_fees.sql | 11 +- ...ancer_v2_arbitrum_pools_tokens_weights.sql | 1 - .../balancer/pools/avalanche_c/_schema.yml | 105 +++ ...ancer_avalanche_c_pools_tokens_weights.sql | 0 .../balancer_v2_avalanche_c_pools_fees.sql | 9 +- ...er_v2_avalanche_c_pools_tokens_weights.sql | 1 - .../pools}/balancer_gauge_mappings.sql | 7 +- .../balancer/pools}/balancer_pools_fees.sql | 9 +- .../pools}/balancer_pools_metrics_daily.sql | 0 .../pools}/balancer_pools_tokens_weights.sql | 8 +- .../_project/balancer/pools/base/_schema.yml | 105 +++ .../balancer_base_pools_tokens_weights.sql | 0 .../base/balancer_v2_base_pools_fees.sql | 9 +- .../balancer_v2_base_pools_tokens_weights.sql | 1 - .../balancer/pools/ethereum/_schema.yml | 149 ++++ ...balancer_ethereum_pools_tokens_weights.sql | 0 ...ancer_v1_ethereum_pools_tokens_weights.sql | 7 +- .../ethereum/balancer_v2_ethereum_lbps.sql | 0 .../balancer_v2_ethereum_pools_fees.sql | 7 +- ...ancer_v2_ethereum_pools_tokens_weights.sql | 1 - .../balancer/pools/gnosis/_schema.yml | 105 +++ .../balancer_gnosis_pools_tokens_weights.sql | 0 .../gnosis/balancer_v2_gnosis_pools_fees.sql | 9 +- ...alancer_v2_gnosis_pools_tokens_weights.sql | 1 - .../balancer/pools/optimism/_schema.yml | 146 ++++ .../balancer_optimism_gauge_mappings.sql | 7 +- ...balancer_optimism_pools_tokens_weights.sql | 3 +- .../balancer_v2_optimism_pools_fees.sql | 9 +- ...ancer_v2_optimism_pools_tokens_weights.sql | 1 - .../balancer/pools/polygon/_schema.yml | 128 ++++ .../balancer_polygon_pools_tokens_weights.sql | 0 .../polygon/balancer_v2_polygon_lbps.sql | 0 .../balancer_v2_polygon_pools_fees.sql | 9 +- ...lancer_v2_polygon_pools_tokens_weights.sql | 1 - .../_project/balancer/pools/zkevm/_schema.yml | 105 +++ .../zkevm/balancer_v2_zkevm_pools_fees.sql | 6 +- ...balancer_v2_zkevm_pools_tokens_weights.sql | 0 .../balancer_zkevm_pools_tokens_weights.sql | 0 .../balancer/protocol_fee/_schema.yml | 61 ++ .../protocol_fee/arbitrum/_schema.yml | 61 ++ .../balancer_v2_arbitrum_protocol_fee.sql | 0 .../protocol_fee/avalanche_c/_schema.yml | 61 ++ .../balancer_v2_avalanche_c_protocol_fee.sql | 0 .../protocol_fee}/balancer_protocol_fee.sql | 8 +- .../balancer/protocol_fee/base/_schema.yml | 61 ++ .../base/balancer_v2_base_protocol_fee.sql | 0 .../protocol_fee/ethereum/_schema.yml | 61 ++ .../balancer_v2_ethereum_protocol_fee.sql | 0 .../balancer/protocol_fee/gnosis/_schema.yml | 61 ++ .../balancer_v2_gnosis_protocol_fee.sql | 0 .../protocol_fee/optimism/_schema.yml | 61 ++ .../balancer_v2_optimism_protocol_fee.sql | 0 .../balancer/protocol_fee/polygon/_schema.yml | 61 ++ .../balancer_v2_polygon_protocol_fee.sql | 0 .../balancer/protocol_fee/zkevm/_schema.yml | 61 ++ .../zkevm/balancer_v2_zkevm_protocol_fee.sql | 0 models/_project/balancer/support/_schema.yml | 56 ++ .../balancer_single_recipient_gauges.sql | 0 .../support}/balancer_token_whitelist.sql | 0 .../balancer/trades/arbitrum/_schema.yml | 149 ++++ .../arbitrum/balancer_arbitrum_trades.sql | 0 .../arbitrum/balancer_v2_arbitrum_trades.sql | 6 +- .../balancer/trades/avalanche_c/_schema.yml | 149 ++++ .../balancer_avalanche_c_trades.sql | 0 .../balancer_v2_avalanche_c_trades.sql | 8 +- .../balancer/{ => trades}/balancer_trades.sql | 0 .../_project/balancer/trades/base/_schema.yml | 149 ++++ .../trades}/base/balancer_base_trades.sql | 0 .../trades}/base/balancer_v2_base_trades.sql | 6 +- .../balancer/trades/ethereum/_schema.yml | 145 ++++ .../ethereum/balancer_ethereum_trades.sql | 0 .../ethereum/balancer_v1_ethereum_trades.sql | 0 .../ethereum/balancer_v2_ethereum_trades.sql | 6 +- .../balancer/trades/gnosis/_schema.yml | 149 ++++ .../trades}/gnosis/balancer_gnosis_trades.sql | 0 .../gnosis/balancer_v2_gnosis_trades.sql | 6 +- .../balancer/trades/optimism/_schema.yml | 149 ++++ .../optimism/balancer_optimism_trades.sql | 0 .../optimism/balancer_v2_optimism_trades.sql | 6 +- .../balancer/trades/polygon/_schema.yml | 149 ++++ .../polygon/balancer_polygon_trades.sql | 0 .../polygon/balancer_v2_polygon_trades.sql | 6 +- .../balancer/trades/zkevm/_schema.yml | 110 +++ .../zkevm/balancer_v2_zkevm_trades.sql | 6 +- .../trades}/zkevm/balancer_zkevm_trades.sql | 0 .../balancer/vebal/ethereum/_schema.yml | 91 +++ .../balancer_ethereum_vebal_balances_day.sql | 7 +- .../balancer_ethereum_vebal_slopes.sql | 9 +- .../balancer_ethereum_vebal_votes.sql | 8 +- .../arbitrum/balancer_arbitrum_schema.yml | 432 ------------ .../balancer_avalanche_c_schema.yml | 405 ----------- models/balancer/balancer_schema.yml | 365 ---------- models/balancer/base/balancer_base_schema.yml | 405 ----------- .../ethereum/balancer_ethereum_schema.yml | 665 ------------------ .../gnosis/balancer_gnosis_schema.yml | 404 ----------- .../optimism/balancer_optimism_schema.yml | 464 ------------ .../polygon/balancer_polygon_schema.yml | 454 ------------ .../balancer/zkevm/balancer_zkevm_schema.yml | 431 ------------ 226 files changed, 7748 insertions(+), 4295 deletions(-) create mode 100644 macros/models/_project/balancer/balancer_pool_token_supply_changes_daily_agg_macro.sql create mode 100644 macros/models/_project/balancer/balancer_pool_token_supply_changes_macro.sql create mode 100644 macros/models/_project/balancer/balancer_token_balance_changes_daily_agg_macro.sql create mode 100644 macros/models/_project/balancer/balancer_token_balance_changes_macro.sql create mode 100644 models/_project/balancer/balances/_schema.yml create mode 100644 models/_project/balancer/balances/arbitrum/_schema.yml create mode 100644 models/_project/balancer/balances/arbitrum/balancer_v2_arbitrum_token_balance_changes.sql create mode 100644 models/_project/balancer/balances/arbitrum/balancer_v2_arbitrum_token_balance_changes_daily.sql create mode 100644 models/_project/balancer/balances/avalanche_c/_schema.yml create mode 100644 models/_project/balancer/balances/avalanche_c/balancer_v2_avalanche_c_token_balance_changes.sql create mode 100644 models/_project/balancer/balances/avalanche_c/balancer_v2_avalanche_c_token_balance_changes_daily.sql create mode 100644 models/_project/balancer/balances/balancer_token_balance_changes.sql create mode 100644 models/_project/balancer/balances/balancer_token_balance_changes_daily.sql create mode 100644 models/_project/balancer/balances/base/_schema.yml create mode 100644 models/_project/balancer/balances/base/balancer_v2_base_token_balance_changes.sql create mode 100644 models/_project/balancer/balances/base/balancer_v2_base_token_balance_changes_daily.sql create mode 100644 models/_project/balancer/balances/ethereum/_schema.yml rename models/{balancer => _project/balancer/balances}/ethereum/balancer_ethereum_balances.sql (88%) create mode 100644 models/_project/balancer/balances/ethereum/balancer_v2_ethereum_token_balance_changes.sql create mode 100644 models/_project/balancer/balances/ethereum/balancer_v2_ethereum_token_balance_changes_daily.sql create mode 100644 models/_project/balancer/balances/gnosis/_schema.yml create mode 100644 models/_project/balancer/balances/gnosis/balancer_v2_gnosis_token_balance_changes.sql create mode 100644 models/_project/balancer/balances/gnosis/balancer_v2_gnosis_token_balance_changes_daily.sql create mode 100644 models/_project/balancer/balances/optimism/_schema.yml create mode 100644 models/_project/balancer/balances/optimism/balancer_v2_optimism_token_balance_changes.sql create mode 100644 models/_project/balancer/balances/optimism/balancer_v2_optimism_token_balance_changes_daily.sql create mode 100644 models/_project/balancer/balances/polygon/_schema.yml create mode 100644 models/_project/balancer/balances/polygon/balancer_v2_polygon_token_balance_changes.sql create mode 100644 models/_project/balancer/balances/polygon/balancer_v2_polygon_token_balance_changes_daily.sql create mode 100644 models/_project/balancer/balances/zkevm/_schema.yml create mode 100644 models/_project/balancer/balances/zkevm/balancer_v2_zkevm_token_balance_changes.sql create mode 100644 models/_project/balancer/balances/zkevm/balancer_v2_zkevm_token_balance_changes_daily.sql create mode 100644 models/_project/balancer/bpt/_schema.yml create mode 100644 models/_project/balancer/bpt/arbitrum/_schema.yml rename models/{balancer => _project/balancer/bpt}/arbitrum/balancer_v2_arbitrum_bpt_prices.sql (100%) rename models/{balancer => _project/balancer/bpt}/arbitrum/balancer_v2_arbitrum_bpt_supply.sql (100%) create mode 100644 models/_project/balancer/bpt/arbitrum/balancer_v2_arbitrum_bpt_supply_changes.sql create mode 100644 models/_project/balancer/bpt/arbitrum/balancer_v2_arbitrum_bpt_supply_changes_daily.sql rename models/{balancer => _project/balancer/bpt}/arbitrum/balancer_v2_arbitrum_transfers_bpt.sql (100%) create mode 100644 models/_project/balancer/bpt/avalanche_c/_schema.yml rename models/{balancer => _project/balancer/bpt}/avalanche_c/balancer_v2_avalanche_c_bpt_prices.sql (100%) rename models/{balancer => _project/balancer/bpt}/avalanche_c/balancer_v2_avalanche_c_bpt_supply.sql (100%) create mode 100644 models/_project/balancer/bpt/avalanche_c/balancer_v2_avalanche_c_bpt_supply_changes.sql create mode 100644 models/_project/balancer/bpt/avalanche_c/balancer_v2_avalanche_c_bpt_supply_changes_daily.sql rename models/{balancer => _project/balancer/bpt}/avalanche_c/balancer_v2_avalanche_c_transfers_bpt.sql (100%) rename models/{balancer => _project/balancer/bpt}/balancer_bpt_prices.sql (69%) rename models/{balancer => _project/balancer/bpt}/balancer_bpt_supply.sql (68%) create mode 100644 models/_project/balancer/bpt/balancer_bpt_supply_changes.sql create mode 100644 models/_project/balancer/bpt/balancer_bpt_supply_changes_daily.sql rename models/{balancer => _project/balancer/bpt}/balancer_transfers_bpt.sql (70%) create mode 100644 models/_project/balancer/bpt/base/_schema.yml rename models/{balancer => _project/balancer/bpt}/base/balancer_v2_base_bpt_prices.sql (100%) rename models/{balancer => _project/balancer/bpt}/base/balancer_v2_base_bpt_supply.sql (100%) create mode 100644 models/_project/balancer/bpt/base/balancer_v2_base_bpt_supply_changes.sql create mode 100644 models/_project/balancer/bpt/base/balancer_v2_base_bpt_supply_changes_daily.sql rename models/{balancer => _project/balancer/bpt}/base/balancer_v2_base_transfers_bpt.sql (100%) create mode 100644 models/_project/balancer/bpt/ethereum/_schema.yml rename models/{balancer => _project/balancer/bpt}/ethereum/balancer_v2_ethereum_bpt_prices.sql (100%) rename models/{balancer => _project/balancer/bpt}/ethereum/balancer_v2_ethereum_bpt_supply.sql (100%) create mode 100644 models/_project/balancer/bpt/ethereum/balancer_v2_ethereum_bpt_supply_changes.sql create mode 100644 models/_project/balancer/bpt/ethereum/balancer_v2_ethereum_bpt_supply_changes_daily.sql rename models/{balancer => _project/balancer/bpt}/ethereum/balancer_v2_ethereum_transfers_bpt.sql (100%) create mode 100644 models/_project/balancer/bpt/gnosis/_schema.yml rename models/{balancer => _project/balancer/bpt}/gnosis/balancer_v2_gnosis_bpt_prices.sql (100%) rename models/{balancer => _project/balancer/bpt}/gnosis/balancer_v2_gnosis_bpt_supply.sql (100%) create mode 100644 models/_project/balancer/bpt/gnosis/balancer_v2_gnosis_bpt_supply_changes.sql create mode 100644 models/_project/balancer/bpt/gnosis/balancer_v2_gnosis_bpt_supply_changes_daily.sql rename models/{balancer => _project/balancer/bpt}/gnosis/balancer_v2_gnosis_transfers_bpt.sql (100%) create mode 100644 models/_project/balancer/bpt/optimism/_schema.yml rename models/{balancer => _project/balancer/bpt}/optimism/balancer_v2_optimism_bpt_prices.sql (100%) rename models/{balancer => _project/balancer/bpt}/optimism/balancer_v2_optimism_bpt_supply.sql (100%) create mode 100644 models/_project/balancer/bpt/optimism/balancer_v2_optimism_bpt_supply_changes.sql create mode 100644 models/_project/balancer/bpt/optimism/balancer_v2_optimism_bpt_supply_changes_daily.sql rename models/{balancer => _project/balancer/bpt}/optimism/balancer_v2_optimism_transfers_bpt.sql (100%) create mode 100644 models/_project/balancer/bpt/polygon/_schema.yml rename models/{balancer => _project/balancer/bpt}/polygon/balancer_v2_polygon_bpt_prices.sql (100%) rename models/{balancer => _project/balancer/bpt}/polygon/balancer_v2_polygon_bpt_supply.sql (100%) create mode 100644 models/_project/balancer/bpt/polygon/balancer_v2_polygon_bpt_supply_changes.sql create mode 100644 models/_project/balancer/bpt/polygon/balancer_v2_polygon_bpt_supply_changes_daily.sql rename models/{balancer => _project/balancer/bpt}/polygon/balancer_v2_polygon_transfers_bpt.sql (100%) create mode 100644 models/_project/balancer/bpt/zkevm/_schema.yml rename models/{balancer => _project/balancer/bpt}/zkevm/balancer_v2_zkevm_bpt_prices.sql (100%) rename models/{balancer => _project/balancer/bpt}/zkevm/balancer_v2_zkevm_bpt_supply.sql (100%) create mode 100644 models/_project/balancer/bpt/zkevm/balancer_v2_zkevm_bpt_supply_changes.sql create mode 100644 models/_project/balancer/bpt/zkevm/balancer_v2_zkevm_bpt_supply_changes_daily.sql rename models/{balancer => _project/balancer/bpt}/zkevm/balancer_v2_zkevm_transfers_bpt.sql (100%) create mode 100644 models/_project/balancer/flashloans/_schema.yml create mode 100644 models/_project/balancer/flashloans/arbitrum/_schema.yml rename models/{balancer => _project/balancer/flashloans}/arbitrum/balancer_v2_arbitrum_flashloans.sql (88%) create mode 100644 models/_project/balancer/flashloans/avalanche_c/_schema.yml rename models/{balancer => _project/balancer/flashloans}/avalanche_c/balancer_v2_avalanche_c_flashloans.sql (88%) rename models/{balancer => _project/balancer/flashloans}/balancer_flashloans.sql (69%) create mode 100644 models/_project/balancer/flashloans/base/_schema.yml rename models/{balancer => _project/balancer/flashloans}/base/balancer_v2_base_flashloans.sql (88%) create mode 100644 models/_project/balancer/flashloans/ethereum/_schema.yml rename models/{balancer => _project/balancer/flashloans}/ethereum/balancer_v2_ethereum_flashloans.sql (88%) create mode 100644 models/_project/balancer/flashloans/gnosis/_schema.yml rename models/{balancer => _project/balancer/flashloans}/gnosis/balancer_v2_gnosis_flashloans.sql (88%) create mode 100644 models/_project/balancer/flashloans/optimism/_schema.yml rename models/{balancer => _project/balancer/flashloans}/optimism/balancer_v2_optimism_flashloans.sql (88%) create mode 100644 models/_project/balancer/flashloans/polygon/_schema.yml rename models/{balancer => _project/balancer/flashloans}/polygon/balancer_v2_polygon_flashloans.sql (88%) create mode 100644 models/_project/balancer/flashloans/zkevm/_schema.yml rename models/{balancer => _project/balancer/flashloans}/zkevm/balancer_v2_zkevm_flashloans.sql (88%) create mode 100644 models/_project/balancer/liquidity/_schema.yml create mode 100644 models/_project/balancer/liquidity/arbitrum/_schema.yml rename models/{balancer => _project/balancer/liquidity}/arbitrum/balancer_v2_arbitrum_liquidity.sql (52%) create mode 100644 models/_project/balancer/liquidity/avalanche_c/_schema.yml rename models/{balancer => _project/balancer/liquidity}/avalanche_c/balancer_v2_avalanche_c_liquidity.sql (53%) rename models/{balancer => _project/balancer/liquidity}/balancer_liquidity.sql (74%) create mode 100644 models/_project/balancer/liquidity/base/_schema.yml rename models/{balancer => _project/balancer/liquidity}/base/balancer_v2_base_liquidity.sql (51%) create mode 100644 models/_project/balancer/liquidity/ethereum/_schema.yml rename models/{balancer => _project/balancer/liquidity}/ethereum/balancer_v1_ethereum_liquidity.sql (92%) rename models/{balancer => _project/balancer/liquidity}/ethereum/balancer_v2_ethereum_liquidity.sql (52%) create mode 100644 models/_project/balancer/liquidity/gnosis/_schema.yml rename models/{balancer => _project/balancer/liquidity}/gnosis/balancer_v2_gnosis_liquidity.sql (51%) create mode 100644 models/_project/balancer/liquidity/optimism/_schema.yml rename models/{balancer => _project/balancer/liquidity}/optimism/balancer_v2_optimism_liquidity.sql (52%) create mode 100644 models/_project/balancer/liquidity/polygon/_schema.yml rename models/{balancer => _project/balancer/liquidity}/polygon/balancer_v2_polygon_liquidity.sql (52%) create mode 100644 models/_project/balancer/liquidity/zkevm/_schema.yml rename models/{balancer => _project/balancer/liquidity}/zkevm/balancer_v2_zkevm_liquidity.sql (51%) create mode 100644 models/_project/balancer/pools/_schema.yml create mode 100644 models/_project/balancer/pools/arbitrum/_schema.yml rename models/{balancer => _project/balancer/pools}/arbitrum/balancer_arbitrum_pools_tokens_weights.sql (100%) rename models/{balancer => _project/balancer/pools}/arbitrum/balancer_v2_arbitrum_pools_fees.sql (75%) rename models/{balancer => _project/balancer/pools}/arbitrum/balancer_v2_arbitrum_pools_tokens_weights.sql (99%) create mode 100644 models/_project/balancer/pools/avalanche_c/_schema.yml rename models/{balancer => _project/balancer/pools}/avalanche_c/balancer_avalanche_c_pools_tokens_weights.sql (100%) rename models/{balancer => _project/balancer/pools}/avalanche_c/balancer_v2_avalanche_c_pools_fees.sql (77%) rename models/{balancer => _project/balancer/pools}/avalanche_c/balancer_v2_avalanche_c_pools_tokens_weights.sql (99%) rename models/{balancer => _project/balancer/pools}/balancer_gauge_mappings.sql (78%) rename models/{balancer => _project/balancer/pools}/balancer_pools_fees.sql (69%) rename models/{balancer => _project/balancer/pools}/balancer_pools_metrics_daily.sql (100%) rename models/{balancer => _project/balancer/pools}/balancer_pools_tokens_weights.sql (71%) create mode 100644 models/_project/balancer/pools/base/_schema.yml rename models/{balancer => _project/balancer/pools}/base/balancer_base_pools_tokens_weights.sql (100%) rename models/{balancer => _project/balancer/pools}/base/balancer_v2_base_pools_fees.sql (77%) rename models/{balancer => _project/balancer/pools}/base/balancer_v2_base_pools_tokens_weights.sql (99%) create mode 100644 models/_project/balancer/pools/ethereum/_schema.yml rename models/{balancer => _project/balancer/pools}/ethereum/balancer_ethereum_pools_tokens_weights.sql (100%) rename models/{balancer => _project/balancer/pools}/ethereum/balancer_v1_ethereum_pools_tokens_weights.sql (93%) rename models/{balancer => _project/balancer/pools}/ethereum/balancer_v2_ethereum_lbps.sql (100%) rename models/{balancer => _project/balancer/pools}/ethereum/balancer_v2_ethereum_pools_fees.sql (78%) rename models/{balancer => _project/balancer/pools}/ethereum/balancer_v2_ethereum_pools_tokens_weights.sql (99%) create mode 100644 models/_project/balancer/pools/gnosis/_schema.yml rename models/{balancer => _project/balancer/pools}/gnosis/balancer_gnosis_pools_tokens_weights.sql (100%) rename models/{balancer => _project/balancer/pools}/gnosis/balancer_v2_gnosis_pools_fees.sql (77%) rename models/{balancer => _project/balancer/pools}/gnosis/balancer_v2_gnosis_pools_tokens_weights.sql (99%) create mode 100644 models/_project/balancer/pools/optimism/_schema.yml rename models/{balancer => _project/balancer/pools}/optimism/balancer_optimism_gauge_mappings.sql (87%) rename models/{balancer => _project/balancer/pools}/optimism/balancer_optimism_pools_tokens_weights.sql (86%) rename models/{balancer => _project/balancer/pools}/optimism/balancer_v2_optimism_pools_fees.sql (77%) rename models/{balancer => _project/balancer/pools}/optimism/balancer_v2_optimism_pools_tokens_weights.sql (99%) create mode 100644 models/_project/balancer/pools/polygon/_schema.yml rename models/{balancer => _project/balancer/pools}/polygon/balancer_polygon_pools_tokens_weights.sql (100%) rename models/{balancer => _project/balancer/pools}/polygon/balancer_v2_polygon_lbps.sql (100%) rename models/{balancer => _project/balancer/pools}/polygon/balancer_v2_polygon_pools_fees.sql (77%) rename models/{balancer => _project/balancer/pools}/polygon/balancer_v2_polygon_pools_tokens_weights.sql (99%) create mode 100644 models/_project/balancer/pools/zkevm/_schema.yml rename models/{balancer => _project/balancer/pools}/zkevm/balancer_v2_zkevm_pools_fees.sql (82%) rename models/{balancer => _project/balancer/pools}/zkevm/balancer_v2_zkevm_pools_tokens_weights.sql (100%) rename models/{balancer => _project/balancer/pools}/zkevm/balancer_zkevm_pools_tokens_weights.sql (100%) create mode 100644 models/_project/balancer/protocol_fee/_schema.yml create mode 100644 models/_project/balancer/protocol_fee/arbitrum/_schema.yml rename models/{balancer => _project/balancer/protocol_fee}/arbitrum/balancer_v2_arbitrum_protocol_fee.sql (100%) create mode 100644 models/_project/balancer/protocol_fee/avalanche_c/_schema.yml rename models/{balancer => _project/balancer/protocol_fee}/avalanche_c/balancer_v2_avalanche_c_protocol_fee.sql (100%) rename models/{balancer => _project/balancer/protocol_fee}/balancer_protocol_fee.sql (75%) create mode 100644 models/_project/balancer/protocol_fee/base/_schema.yml rename models/{balancer => _project/balancer/protocol_fee}/base/balancer_v2_base_protocol_fee.sql (100%) create mode 100644 models/_project/balancer/protocol_fee/ethereum/_schema.yml rename models/{balancer => _project/balancer/protocol_fee}/ethereum/balancer_v2_ethereum_protocol_fee.sql (100%) create mode 100644 models/_project/balancer/protocol_fee/gnosis/_schema.yml rename models/{balancer => _project/balancer/protocol_fee}/gnosis/balancer_v2_gnosis_protocol_fee.sql (100%) create mode 100644 models/_project/balancer/protocol_fee/optimism/_schema.yml rename models/{balancer => _project/balancer/protocol_fee}/optimism/balancer_v2_optimism_protocol_fee.sql (100%) create mode 100644 models/_project/balancer/protocol_fee/polygon/_schema.yml rename models/{balancer => _project/balancer/protocol_fee}/polygon/balancer_v2_polygon_protocol_fee.sql (100%) create mode 100644 models/_project/balancer/protocol_fee/zkevm/_schema.yml rename models/{balancer => _project/balancer/protocol_fee}/zkevm/balancer_v2_zkevm_protocol_fee.sql (100%) create mode 100644 models/_project/balancer/support/_schema.yml rename models/{balancer => _project/balancer/support}/balancer_single_recipient_gauges.sql (100%) rename models/{balancer => _project/balancer/support}/balancer_token_whitelist.sql (100%) create mode 100644 models/_project/balancer/trades/arbitrum/_schema.yml rename models/{balancer => _project/balancer/trades}/arbitrum/balancer_arbitrum_trades.sql (100%) rename models/{balancer => _project/balancer/trades}/arbitrum/balancer_v2_arbitrum_trades.sql (94%) create mode 100644 models/_project/balancer/trades/avalanche_c/_schema.yml rename models/{balancer => _project/balancer/trades}/avalanche_c/balancer_avalanche_c_trades.sql (100%) rename models/{balancer => _project/balancer/trades}/avalanche_c/balancer_v2_avalanche_c_trades.sql (94%) rename models/_project/balancer/{ => trades}/balancer_trades.sql (100%) create mode 100644 models/_project/balancer/trades/base/_schema.yml rename models/{balancer => _project/balancer/trades}/base/balancer_base_trades.sql (100%) rename models/{balancer => _project/balancer/trades}/base/balancer_v2_base_trades.sql (94%) create mode 100644 models/_project/balancer/trades/ethereum/_schema.yml rename models/{balancer => _project/balancer/trades}/ethereum/balancer_ethereum_trades.sql (100%) rename models/{balancer => _project/balancer/trades}/ethereum/balancer_v1_ethereum_trades.sql (100%) rename models/{balancer => _project/balancer/trades}/ethereum/balancer_v2_ethereum_trades.sql (94%) create mode 100644 models/_project/balancer/trades/gnosis/_schema.yml rename models/{balancer => _project/balancer/trades}/gnosis/balancer_gnosis_trades.sql (100%) rename models/{balancer => _project/balancer/trades}/gnosis/balancer_v2_gnosis_trades.sql (94%) create mode 100644 models/_project/balancer/trades/optimism/_schema.yml rename models/{balancer => _project/balancer/trades}/optimism/balancer_optimism_trades.sql (100%) rename models/{balancer => _project/balancer/trades}/optimism/balancer_v2_optimism_trades.sql (94%) create mode 100644 models/_project/balancer/trades/polygon/_schema.yml rename models/{balancer => _project/balancer/trades}/polygon/balancer_polygon_trades.sql (100%) rename models/{balancer => _project/balancer/trades}/polygon/balancer_v2_polygon_trades.sql (94%) create mode 100644 models/_project/balancer/trades/zkevm/_schema.yml rename models/{balancer => _project/balancer/trades}/zkevm/balancer_v2_zkevm_trades.sql (94%) rename models/{balancer => _project/balancer/trades}/zkevm/balancer_zkevm_trades.sql (100%) create mode 100644 models/_project/balancer/vebal/ethereum/_schema.yml rename models/{balancer => _project/balancer/vebal}/ethereum/balancer_ethereum_vebal_balances_day.sql (94%) rename models/{balancer => _project/balancer/vebal}/ethereum/balancer_ethereum_vebal_slopes.sql (93%) rename models/{balancer => _project/balancer/vebal}/ethereum/balancer_ethereum_vebal_votes.sql (92%) delete mode 100644 models/balancer/arbitrum/balancer_arbitrum_schema.yml delete mode 100644 models/balancer/avalanche_c/balancer_avalanche_c_schema.yml delete mode 100644 models/balancer/balancer_schema.yml delete mode 100644 models/balancer/base/balancer_base_schema.yml delete mode 100644 models/balancer/ethereum/balancer_ethereum_schema.yml delete mode 100644 models/balancer/gnosis/balancer_gnosis_schema.yml delete mode 100644 models/balancer/optimism/balancer_optimism_schema.yml delete mode 100644 models/balancer/polygon/balancer_polygon_schema.yml delete mode 100644 models/balancer/zkevm/balancer_zkevm_schema.yml diff --git a/dbt_project.yml b/dbt_project.yml index 05730532ba4..1daa6f7fd4a 100644 --- a/dbt_project.yml +++ b/dbt_project.yml @@ -71,19 +71,6 @@ models: optimism: +schema: aave_optimism - balancer: - +schema: balancer - arbitrum: - +schema: balancer_arbitrum - ethereum: - +schema: balancer_ethereum - polygon: - +schema: balancer_polygon - optimism: - +schema: balancer_optimism - gnosis: - +schema: balancer_gnosis - ens: +schema: ens ethereum: diff --git a/macros/models/_project/balancer/balancer_bpt_supply_macro.sql b/macros/models/_project/balancer/balancer_bpt_supply_macro.sql index 60cf5a6e4bc..1b1dab0a80a 100644 --- a/macros/models/_project/balancer/balancer_bpt_supply_macro.sql +++ b/macros/models/_project/balancer/balancer_bpt_supply_macro.sql @@ -79,12 +79,12 @@ WITH pool_labels AS ( joins AS ( SELECT DATE_TRUNC('day', evt_block_time) AS block_date, - tokenOut AS token, + tokenOut, pool_type, CASE WHEN pool_type IN ('weighted') THEN 0 ELSE SUM(amountOut / POWER(10, 18)) - END AS amount + END AS ajoins FROM {{ source('balancer_v2_' + blockchain, 'Vault_evt_Swap') }} LEFT JOIN pool_labels ON BYTEARRAY_SUBSTRING(poolId, 1, 20) = address WHERE tokenOut = BYTEARRAY_SUBSTRING(poolId, 1, 20) @@ -94,37 +94,25 @@ WITH pool_labels AS ( exits AS ( SELECT DATE_TRUNC('day', evt_block_time) AS block_date, - tokenIn AS token, + tokenIn, pool_type, CASE WHEN pool_type IN ('weighted') THEN 0 - ELSE SUM( -amountIn / POWER(10, 18)) - END AS amount + ELSE SUM(amountIn / POWER(10, 18)) + END AS aexits FROM {{ source('balancer_v2_' + blockchain, 'Vault_evt_Swap') }} LEFT JOIN pool_labels ON BYTEARRAY_SUBSTRING(poolId, 1, 20) = address WHERE tokenIn = BYTEARRAY_SUBSTRING(poolId, 1, 20) GROUP BY 1, 2, 3 ), - joins_and_exits_1 AS ( - SELECT - * - FROM joins - - UNION ALL - - SELECT - * - FROM exits - ), - joins_and_exits AS ( SELECT - block_date, - token AS bpt, - LEAD(block_date, 1, NOW()) OVER (PARTITION BY token ORDER BY block_date) AS day_of_next_change, - SUM(amount) OVER (PARTITION BY token ORDER BY block_date ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW) AS adelta - FROM joins_and_exits_1 + j.block_date, + j.tokenOut AS bpt, + SUM(COALESCE(ajoins, 0) - COALESCE(aexits, 0)) OVER (PARTITION BY j.tokenOut ORDER BY j.block_date ASC) AS adelta + FROM joins j + FULL OUTER JOIN exits e ON j.block_date = e.block_date AND e.tokenIn = j.tokenOut ), calendar AS ( @@ -142,7 +130,7 @@ WITH pool_labels AS ( COALESCE(SUM(b.supply - COALESCE(preminted_bpts, 0) + COALESCE(adelta, 0)),0) AS supply FROM calendar c LEFT JOIN balances b ON b.day <= c.day AND c.day < b.day_of_next_change - LEFT JOIN joins_and_exits j ON j.block_date <= c.day AND c.day < j.day_of_next_change AND b.token = j.bpt + LEFT JOIN joins_and_exits j ON c.day = j.block_date AND b.token = j.bpt LEFT JOIN premints p ON b.token = p.bpt LEFT JOIN pool_labels l ON b.token = l.address WHERE l.pool_type IN ('weighted', 'LBP', 'investment', 'stable', 'linear', 'ECLP', 'managed', 'FX') diff --git a/macros/models/_project/balancer/balancer_pool_token_supply_changes_daily_agg_macro.sql b/macros/models/_project/balancer/balancer_pool_token_supply_changes_daily_agg_macro.sql new file mode 100644 index 00000000000..d94bbccf741 --- /dev/null +++ b/macros/models/_project/balancer/balancer_pool_token_supply_changes_daily_agg_macro.sql @@ -0,0 +1,37 @@ +{% macro + bpt_supply_changes_daily_agg_macro( + blockchain, version + ) +%} +WITH + daily_balance AS ( + SELECT + block_date, + blockchain, + pool_type, + pool_symbol, + token_address, + LEAD(block_date, 1, NOW()) OVER (PARTITION BY token_address ORDER BY block_date) AS day_of_next_change, + SUM(delta_amount) AS daily_amount + FROM {{ ref('balancer_bpt_supply_changes') }} + WHERE blockchain = '{{blockchain}}' + GROUP BY 1, 2, 3, 4, 5 + ), + + calendar AS ( + SELECT date_sequence AS day + FROM unnest(sequence(date('2021-04-21'), date(now()), interval '1' day)) as t(date_sequence) + ) + + SELECT + c.day AS block_date, + '{{blockchain}}' as blockchain, + '{{version}}' AS version, + b.pool_type, + b.pool_symbol, + b.token_address, + b.daily_amount AS daily_delta + FROM calendar c + LEFT JOIN daily_balance b ON b.block_date = c.day + WHERE b.token_address IS NOT NULL + {% endmacro %} \ No newline at end of file diff --git a/macros/models/_project/balancer/balancer_pool_token_supply_changes_macro.sql b/macros/models/_project/balancer/balancer_pool_token_supply_changes_macro.sql new file mode 100644 index 00000000000..5b876cca011 --- /dev/null +++ b/macros/models/_project/balancer/balancer_pool_token_supply_changes_macro.sql @@ -0,0 +1,130 @@ +{% macro + bpt_supply_changes_macro( + blockchain, version + ) +%} +WITH pool_labels AS ( + SELECT + address, + name, + pool_type + FROM {{ ref('labels_balancer_v2_pools') }} + WHERE blockchain = '{{blockchain}}' + ), + + -- Extract mints and burns from transfers + transfers AS ( + SELECT + t.evt_block_time, + t.evt_block_number, + t.evt_tx_hash, + t.evt_index, + t.contract_address AS token, + CASE + WHEN t."from" = 0x0000000000000000000000000000000000000000 + THEN 'mint' + WHEN t.to = 0x0000000000000000000000000000000000000000 + THEN 'burn' + END AS label, + l.pool_type, + l.name, + CASE + WHEN t."from" = 0x0000000000000000000000000000000000000000 + THEN value + WHEN t.to = 0x0000000000000000000000000000000000000000 + THEN - value + ELSE 0 + END AS amount + FROM {{ ref('balancer_transfers_bpt') }} t + LEFT JOIN pool_labels l ON t.contract_address = l.address + WHERE t.blockchain = '{{blockchain}}' + AND t.version = '{{version}}' + {% if is_incremental() %} + AND {{ incremental_predicate('t.evt_block_time') }} + {% endif %} + ), + + -- Calculating Joins(mint) and Exits(burn) via Swap + joins AS ( + SELECT + s.evt_block_time, + s.evt_block_number, + s.evt_tx_hash, + s.evt_index, + s.tokenOut AS token, + 'join' AS label, + l.pool_type, + l.name, + CASE WHEN l.pool_type IN ('weighted') + THEN 0 + ELSE s.amountOut + END AS amount + FROM {{ source('balancer_v2_' + blockchain, 'Vault_evt_Swap') }} s + LEFT JOIN pool_labels l ON BYTEARRAY_SUBSTRING(s.poolId, 1, 20) = l.address + WHERE tokenOut = BYTEARRAY_SUBSTRING(s.poolId, 1, 20) + {% if is_incremental() %} + AND {{ incremental_predicate('s. evt_block_time') }} + {% endif %} + + ), + + exits AS ( + SELECT + s.evt_block_time, + s.evt_block_number, + s.evt_tx_hash, + s.evt_index, + s.tokenIn AS token, + 'exit' AS label, + l.pool_type, + l.name, + CASE WHEN l.pool_type IN ('weighted') + THEN 0 + ELSE - s.amountIn + END AS amount + FROM {{ source('balancer_v2_' + blockchain, 'Vault_evt_Swap') }} s + LEFT JOIN pool_labels l ON BYTEARRAY_SUBSTRING(s.poolId, 1, 20) = l.address + WHERE tokenIn = BYTEARRAY_SUBSTRING(s.poolId, 1, 20) + {% if is_incremental() %} + AND {{ incremental_predicate('s. evt_block_time') }} + {% endif %} + ) + + SELECT + date_trunc('day', evt_block_time) AS block_date, + evt_block_time, + evt_block_number, + '{{blockchain}}' AS blockchain, + evt_tx_hash, + evt_index, + pool_type, + name AS pool_symbol, + '{{version}}' AS version, + label, + token AS token_address, + amount AS delta_amount_raw, + amount / POWER (10, 18) AS delta_amount --18 decimals standard for BPTs + FROM + ( + SELECT + * + FROM joins + + UNION ALL + + SELECT + * + FROM exits + + UNION ALL + + SELECT + * + FROM transfers + WHERE label IS NOT NULL + ) + {% if is_incremental() %} + WHERE {{ incremental_predicate('evt_block_time') }} + {% endif %} + + {% endmacro %} \ No newline at end of file diff --git a/macros/models/_project/balancer/balancer_token_balance_changes_daily_agg_macro.sql b/macros/models/_project/balancer/balancer_token_balance_changes_daily_agg_macro.sql new file mode 100644 index 00000000000..7500f5d7e82 --- /dev/null +++ b/macros/models/_project/balancer/balancer_token_balance_changes_daily_agg_macro.sql @@ -0,0 +1,184 @@ +{% macro + balancer_token_balance_changes_daily_agg_macro( + blockchain, version + ) +%} +WITH + prices AS ( + SELECT + date_trunc('day', minute) AS day, + contract_address AS token, + decimals, + AVG(price) AS price + FROM {{ source('prices', 'usd') }} + WHERE blockchain = '{{blockchain}}' + {% if is_incremental() %} + WHERE {{ incremental_predicate('minute') }} + {% endif %} + GROUP BY 1, 2, 3 + ), + + dex_prices_1 AS ( + SELECT + date_trunc('day', HOUR) AS DAY, + contract_address AS token, + approx_percentile(median_price, 0.5) AS price, + sum(sample_size) AS sample_size + FROM {{ ref('dex_prices') }} + {% if is_incremental() %} + WHERE {{ incremental_predicate('hour') }} + {% endif %} + GROUP BY 1, 2 + HAVING sum(sample_size) > 3 + ), + + dex_prices_2 AS( + SELECT + day, + token, + price, + lag(price) OVER(PARTITION BY token ORDER BY day) AS previous_price + FROM dex_prices_1 + ), + + dex_prices AS ( + SELECT + day, + token, + price, + LEAD(DAY, 1, NOW()) OVER (PARTITION BY token ORDER BY DAY) AS day_of_next_change + FROM dex_prices_2 + WHERE (price < previous_price * 1e4 AND price > previous_price / 1e4) + ), + + bpt_prices AS( + SELECT DISTINCT + day, + contract_address AS token, + decimals, + bpt_price + FROM {{ ref('balancer_bpt_prices') }} + WHERE blockchain = '{{blockchain}}' + {% if is_incremental() %} + AND {{ incremental_predicate('day') }} + {% endif %} + AND version = '{{version}}' + ), + + eth_prices AS ( + SELECT + DATE_TRUNC('day', minute) as day, + AVG(price) as eth_price + FROM {{ source('prices', 'usd') }} + WHERE symbol = 'ETH' + {% if is_incremental() %} + WHERE {{ incremental_predicate('minute') }} + {% endif %} + GROUP BY 1 + ), + + gyro_prices AS ( + SELECT + token_address, + decimals, + price + FROM {{ ref('gyroscope_gyro_tokens') }} + WHERE blockchain = '{{blockchain}}' + ), + + daily_balance AS ( + SELECT + block_date, + pool_id, + pool_symbol, + pool_type, + token_address, + token_symbol, + LEAD(block_date, 1, NOW()) OVER (PARTITION BY token_address, pool_id ORDER BY block_date) AS day_of_next_change, + SUM(delta_amount) AS daily_amount + FROM {{ ref('balancer_token_balance_changes') }} + WHERE blockchain = '{{blockchain}}' + GROUP BY 1, 2, 3, 4, 5, 6 + ), + + calendar AS ( + SELECT date_sequence AS day + FROM unnest(sequence(date('2021-04-21'), date(now()), interval '1' day)) as t(date_sequence) + ), + + daily_usd_balance AS ( + SELECT + c.day AS block_date, + '{{blockchain}}"' as blockchain, + b.pool_id, + b.pool_symbol, + b.pool_type, + b.token_address, + b.token_symbol, + daily_amount, + daily_amount * COALESCE(p1.price, p2.price, p3.bpt_price, p4.price, 0) AS daily_amount_usd + FROM calendar c + LEFT JOIN daily_balance b ON b.block_date <= c.day + AND c.day < b.day_of_next_change + LEFT JOIN prices p1 ON p1.day = b.block_date + AND p1.token = b.token_address + LEFT JOIN dex_prices p2 ON p2.day <= c.day + AND c.day < p2.day_of_next_change + AND p2.token = b.token_address + LEFT JOIN bpt_prices p3 ON p3.day = b.block_date + AND p3.token = b.token_address + LEFT JOIN gyro_prices p4 ON p4.token_address = b.token_address + WHERE b.token_address != BYTEARRAY_SUBSTRING(b.pool_id, 1, 20) + ), + + weighted_pool_amount_estimates AS ( + SELECT + b.block_date, + b.pool_id, + q.name, + pool_type, + ROW_NUMBER() OVER (PARTITION BY b.block_date, b.pool_id ORDER BY SUM(b.daily_amount_usd) ASC) AS pricing_count, --to avoid double count in pools with multiple pricing assets + SUM(b.daily_amount_usd) / COALESCE(SUM(w.normalized_weight), 1) AS weighted_daily_amount_usd + FROM daily_usd_balance b + LEFT JOIN {{ ref('balancer_pools_tokens_weights') }} w ON b.pool_id = w.pool_id + AND b.token_address = w.token_address + AND b.daily_amount_usd > 0 + LEFT JOIN {{ ref('balancer_token_whitelist') }} q ON b.token_address = q.address + AND b.blockchain = q.chain + WHERE q.name IS NOT NULL + AND b.pool_type = 'weighted' -- filters for weighted pools with pricing assets + AND w.blockchain = '{{blockchain}}' + AND w.version = '2' + GROUP BY 1, 2, 3, 4 + ), + + weighted_pool_amount_estimates_2 AS( + SELECT e.block_date, + e.pool_id, + SUM(e.weighted_daily_amount_usd) / MAX(e.pricing_count) AS weighted_daily_amount_usd + FROM weighted_pool_amount_estimates e + GROUP BY 1,2 + ) + + SELECT + c.block_date, + c.pool_id, + BYTEARRAY_SUBSTRING(c.pool_id, 1, 20) AS pool_address, + c.pool_symbol, + '2' AS version, + 'ethereum' AS blockchain, + c.pool_type, + c.token_address, + c.token_symbol, + c.daily_amount AS daily_delta, + COALESCE(b.weighted_daily_amount_usd * w.normalized_weight, c.daily_amount_usd) AS daily_delta_usd, + COALESCE(b.weighted_daily_amount_usd * w.normalized_weight, c.daily_amount_usd)/e.eth_price AS daily_delta_eth + FROM daily_usd_balance c + FULL OUTER JOIN weighted_pool_amount_estimates_2 b ON c.block_date = b.block_date + AND c.pool_id = b.pool_id + LEFT JOIN {{ ref('balancer_pools_tokens_weights') }} w ON b.pool_id = w.pool_id + AND w.blockchain = 'ethereum' + AND w.version = '2' + AND w.token_address = c.token_address + LEFT JOIN eth_prices e ON e.day = c.block_date + {% endmacro %} \ No newline at end of file diff --git a/macros/models/_project/balancer/balancer_token_balance_changes_macro.sql b/macros/models/_project/balancer/balancer_token_balance_changes_macro.sql new file mode 100644 index 00000000000..b16c9bf038e --- /dev/null +++ b/macros/models/_project/balancer/balancer_token_balance_changes_macro.sql @@ -0,0 +1,169 @@ +{% macro + balancer_token_balance_changes_macro( + blockchain, version + ) +%} +WITH pool_labels AS ( + SELECT + address AS pool_id, + name AS pool_symbol, + pool_type + FROM {{ ref('labels_balancer_v2_pools') }} + WHERE blockchain = '{{blockchain}}' + ), + + swaps_changes AS ( + SELECT + evt_block_time, + evt_block_number, + evt_tx_hash, + evt_index, + pool_id, + token, + SUM(COALESCE(delta, INT256 '0')) AS delta + FROM + ( + SELECT + evt_block_time, + evt_block_number, + evt_tx_hash, + evt_index, + poolId AS pool_id, + tokenIn AS token, + CAST(amountIn as int256) AS delta + FROM {{ source('balancer_v2_' + blockchain, 'Vault_evt_Swap') }} + {% if is_incremental() %} + WHERE {{ incremental_predicate('evt_block_time') }} + {% endif %} + + UNION ALL + + SELECT + evt_block_time, + evt_block_number, + evt_tx_hash, + evt_index, + poolId AS pool_id, + tokenOut AS token, + -CAST(amountOut AS int256) AS delta + FROM {{ source('balancer_v2_' + blockchain, 'Vault_evt_Swap') }} + {% if is_incremental() %} + WHERE {{ incremental_predicate('evt_block_time') }} + {% endif %} + ) swaps + GROUP BY 1, 2, 3, 4, 5, 6 + ), + + zipped_balance_changes AS ( + SELECT + evt_block_time, + evt_block_number, + evt_tx_hash, + evt_index, + poolId AS pool_id, + t.tokens, + d.deltas, + p.protocolFeeAmounts + FROM {{ source('balancer_v2_' + blockchain, 'Vault_evt_PoolBalanceChanged') }} + CROSS JOIN UNNEST (tokens) WITH ORDINALITY as t(tokens,i) + CROSS JOIN UNNEST (deltas) WITH ORDINALITY as d(deltas,i) + CROSS JOIN UNNEST (protocolFeeAmounts) WITH ORDINALITY as p(protocolFeeAmounts,i) + WHERE t.i = d.i + AND d.i = p.i + {% if is_incremental() %} + AND {{ incremental_predicate('evt_block_time') }} + {% endif %} + ), + + balances_changes AS ( + SELECT + evt_block_time, + evt_block_number, + evt_tx_hash, + evt_index, + pool_id, + tokens AS token, + deltas - CAST(protocolFeeAmounts as int256) AS delta + FROM zipped_balance_changes + ), + + managed_changes AS ( + SELECT + evt_block_time, + evt_block_number, + evt_tx_hash, + evt_index, + poolId AS pool_id, + token, + cashDelta + managedDelta AS delta + FROM {{ source('balancer_v2_' + blockchain, 'Vault_evt_PoolBalanceManaged') }} + {% if is_incremental() %} + WHERE {{ incremental_predicate('evt_block_time') }} + {% endif %} + ) + + + SELECT + date_trunc('day', b.evt_block_time) AS block_date, + b.evt_block_time, + b.evt_block_number, + '{{blockchain}}' AS blockchain, + b.evt_tx_hash, + b.evt_index, + b.pool_id, + BYTEARRAY_SUBSTRING(b.pool_id, 1, 20) AS pool_address, + p.pool_symbol, + p.pool_type, + '{{version}}' AS version, + b.token AS token_address, + t.symbol AS token_symbol, + b.amount AS delta_amount_raw, + CASE WHEN BYTEARRAY_SUBSTRING(b.pool_id, 1, 20) = b.token + THEN amount / POWER (10, 18) --for Balancer Pool Tokens + ELSE amount / POWER (10, COALESCE(t.decimals, 0)) + END AS delta_amount + FROM + ( + SELECT + evt_block_time, + evt_block_number, + evt_tx_hash, + evt_index, + pool_id, + token, + COALESCE(delta, INT256 '0') AS amount + FROM balances_changes + + UNION ALL + + SELECT + evt_block_time, + evt_block_number, + evt_tx_hash, + evt_index, + pool_id, + token, + delta AS amount + FROM + swaps_changes + + UNION ALL + + SELECT + evt_block_time, + evt_block_number, + evt_tx_hash, + evt_index, + pool_id, + token, + CAST(delta AS int256) AS amount + FROM managed_changes + ) b + LEFT JOIN {{ source('tokens', 'erc20') }} t ON t.contract_address = b.token + AND blockchain = '{{blockchain}}' + LEFT JOIN pool_labels p ON p.pool_id = BYTEARRAY_SUBSTRING(b.pool_id, 1, 20) + {% if is_incremental() %} + WHERE {{ incremental_predicate('evt_block_time') }} + {% endif %} + + {% endmacro %} \ No newline at end of file diff --git a/models/_project/balancer/balances/_schema.yml b/models/_project/balancer/balances/_schema.yml new file mode 100644 index 00000000000..9d8b84cf3a1 --- /dev/null +++ b/models/_project/balancer/balances/_schema.yml @@ -0,0 +1,98 @@ +version: 2 + +models: + - name: balancer_token_balance_changes + meta: + blockchain: arbitrum, avalanche_c, base, ethereum, gnosis, optimism, polygon, zkevm + contributors: viniabussafi + config: + tags: ['arbitrum', 'avalanche_c', 'base', 'ethereum', 'gnosis', 'optimism', 'polygon', 'zkevm', 'bpt', 'supply', 'changes'] + description: > + Token Balance Changes on Balancer Pools. + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - block_date + - evt_tx_hash + - evt_index + - token_address + columns: + - &block_date + name: block_date + description: "UTC event block date of each DEX trade" + - &evt_block_time + name: evt_block_time + description: 'Block time of transfer event' + - &evt_block_number + name: evt_block_number + description: 'Block number of transfer event' + - &blockchain + name: blockchain + description: "Blockchain" + - &evt_tx_hash + name: evt_tx_hash + description: 'Transaction hash of transfer event' + - &evt_index + name: evt_index + description: 'Event index' + - &pool_id + name: pool_id + description: "Unique encoded identifier that refers to each pool" + - &pool_address + name: pool_address + description: "Pool address" + - &pool_symbol + name: pool_symbol + description: "Token symbols, followed by their respective weights, if applicable" + - &pool_type + name: pool_type + description: "Pool attributes, determined by the pool's factory" + - &version + name: version + description: "Version of Balancer where the liquidity pool used in transaction is deployed" + - &token_address + name: token_address + description: "Contract address of the token" + - &token_symbol + name: token_symbol + description: "Token symbol" + - &delta_amount_raw + name: delta_amount_raw + description: "Raw value of the transaction at the time of execution in the original currency" + - &delta_amount + name: delta_amount + description: "Normalized value of the transaction at the time of execution in the original currency" + + - name: balancer_token_balance_changes_daily + meta: + blockchain: arbitrum, avalanche_c, base, ethereum, gnosis, optimism, polygon, zkevm + contributors: viniabussafi + config: + tags: ['arbitrum', 'avalanche_c', 'base', 'ethereum', 'gnosis', 'optimism', 'polygon', 'zkevm', 'bpt', 'supply', 'changes'] + description: > + Token Balance Changes on Balancer Pools, grouped by day. + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - block_date + - pool_id + - token_address + columns: + - *block_date + - *pool_id + - *pool_address + - *pool_symbol + - *version + - *blockchain + - *pool_type + - *token_address + - *token_symbol + - &daily_delta + name: daily_delta + description: "Daily total impact on token balance" + - &daily_delta_usd + name: daily_delta_usd + description: "Daily total impact on token balance, in USD" + - &daily_delta_eth + name: daily_delta_eth + description: "Daily total impact on token balance, in eth" \ No newline at end of file diff --git a/models/_project/balancer/balances/arbitrum/_schema.yml b/models/_project/balancer/balances/arbitrum/_schema.yml new file mode 100644 index 00000000000..ff5e07ed5d8 --- /dev/null +++ b/models/_project/balancer/balances/arbitrum/_schema.yml @@ -0,0 +1,100 @@ +version: 2 + +models: + - name: balancer_v2_arbitrum_token_balance_changes + meta: + blockchain: arbitrum + project: balancer_v2 + contributors: viniabussafi + config: + tags: ['arbitrum', 'bpt', 'supply', 'changes'] + description: > + Token Balance Changes on Balancer Pools. + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - block_date + - evt_tx_hash + - evt_index + - token_address + columns: + - &block_date + name: block_date + description: "UTC event block date of each DEX trade" + - &evt_block_time + name: evt_block_time + description: 'Block time of transfer event' + - &evt_block_number + name: evt_block_number + description: 'Block number of transfer event' + - &blockchain + name: blockchain + description: "Blockchain" + - &evt_tx_hash + name: evt_tx_hash + description: 'Transaction hash of transfer event' + - &evt_index + name: evt_index + description: 'Event index' + - &pool_id + name: pool_id + description: "Unique encoded identifier that refers to each pool" + - &pool_address + name: pool_address + description: "Pool address" + - &pool_symbol + name: pool_symbol + description: "Token symbols, followed by their respective weights, if applicable" + - &pool_type + name: pool_type + description: "Pool attributes, determined by the pool's factory" + - &version + name: version + description: "Version of Balancer where the liquidity pool used in transaction is deployed" + - &token_address + name: token_address + description: "Contract address of the token" + - &token_symbol + name: token_symbol + description: "Token symbol" + - &delta_amount_raw + name: delta_amount_raw + description: "Raw value of the transaction at the time of execution in the original currency" + - &delta_amount + name: delta_amount + description: "Normalized value of the transaction at the time of execution in the original currency" + + - name: balancer_v2_arbitrum_token_balance_changes_daily + meta: + blockchain: arbitrum + project: balancer_v2 + contributors: viniabussafi + config: + tags: ['arbitrum', 'bpt', 'supply', 'changes'] + description: > + Token Balance Changes on Balancer Pools, grouped by day. + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - block_date + - pool_id + - token_address + columns: + - *block_date + - *pool_id + - *pool_address + - *pool_symbol + - *version + - *blockchain + - *pool_type + - *token_address + - *token_symbol + - &daily_delta + name: daily_delta + description: "Daily total impact on token balance" + - &daily_delta_usd + name: daily_delta_usd + description: "Daily total impact on token balance, in USD" + - &daily_delta_eth + name: daily_delta_eth + description: "Daily total impact on token balance, in eth" \ No newline at end of file diff --git a/models/_project/balancer/balances/arbitrum/balancer_v2_arbitrum_token_balance_changes.sql b/models/_project/balancer/balances/arbitrum/balancer_v2_arbitrum_token_balance_changes.sql new file mode 100644 index 00000000000..ca58f713377 --- /dev/null +++ b/models/_project/balancer/balances/arbitrum/balancer_v2_arbitrum_token_balance_changes.sql @@ -0,0 +1,16 @@ +{% set blockchain = 'arbitrum' %} + +{{ config( + schema = 'balancer_v2_arbitrum', + alias = 'token_balance_changes', + materialized = 'table', + file_format = 'delta' + ) +}} + +{{ + balancer_token_balance_changes_macro( + blockchain = blockchain, + version = '2' + ) +}} \ No newline at end of file diff --git a/models/_project/balancer/balances/arbitrum/balancer_v2_arbitrum_token_balance_changes_daily.sql b/models/_project/balancer/balances/arbitrum/balancer_v2_arbitrum_token_balance_changes_daily.sql new file mode 100644 index 00000000000..c35d7b60259 --- /dev/null +++ b/models/_project/balancer/balances/arbitrum/balancer_v2_arbitrum_token_balance_changes_daily.sql @@ -0,0 +1,17 @@ +{% set blockchain = 'arbitrum' %} + +{{ + config( + schema = 'balancer_v2_arbitrum', + alias = 'token_balance_changes_daily', + materialized = 'table', + file_format = 'delta' + ) +}} + +{{ + balancer_token_balance_changes_daily_agg_macro( + blockchain = blockchain, + version = '2' + ) +}} \ No newline at end of file diff --git a/models/_project/balancer/balances/avalanche_c/_schema.yml b/models/_project/balancer/balances/avalanche_c/_schema.yml new file mode 100644 index 00000000000..e341729e2fa --- /dev/null +++ b/models/_project/balancer/balances/avalanche_c/_schema.yml @@ -0,0 +1,100 @@ +version: 2 + +models: + - name: balancer_v2_avalanche_c_token_balance_changes + meta: + blockchain: avalanche_c + project: balancer_v2 + contributors: viniabussafi + config: + tags: ['avalanche_c', 'bpt', 'supply', 'changes'] + description: > + Token Balance Changes on Balancer Pools. + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - block_date + - evt_tx_hash + - evt_index + - token_address + columns: + - &block_date + name: block_date + description: "UTC event block date of each DEX trade" + - &evt_block_time + name: evt_block_time + description: 'Block time of transfer event' + - &evt_block_number + name: evt_block_number + description: 'Block number of transfer event' + - &blockchain + name: blockchain + description: "Blockchain" + - &evt_tx_hash + name: evt_tx_hash + description: 'Transaction hash of transfer event' + - &evt_index + name: evt_index + description: 'Event index' + - &pool_id + name: pool_id + description: "Unique encoded identifier that refers to each pool" + - &pool_address + name: pool_address + description: "Pool address" + - &pool_symbol + name: pool_symbol + description: "Token symbols, followed by their respective weights, if applicable" + - &pool_type + name: pool_type + description: "Pool attributes, determined by the pool's factory" + - &version + name: version + description: "Version of Balancer where the liquidity pool used in transaction is deployed" + - &token_address + name: token_address + description: "Contract address of the token" + - &token_symbol + name: token_symbol + description: "Token symbol" + - &delta_amount_raw + name: delta_amount_raw + description: "Raw value of the transaction at the time of execution in the original currency" + - &delta_amount + name: delta_amount + description: "Normalized value of the transaction at the time of execution in the original currency" + + - name: balancer_v2_avalanche_c_token_balance_changes_daily + meta: + blockchain: avalanche_c + project: balancer_v2 + contributors: viniabussafi + config: + tags: ['avalanche_c', 'bpt', 'supply', 'changes'] + description: > + Token Balance Changes on Balancer Pools, grouped by day. + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - block_date + - pool_id + - token_address + columns: + - *block_date + - *pool_id + - *pool_address + - *pool_symbol + - *version + - *blockchain + - *pool_type + - *token_address + - *token_symbol + - &daily_delta + name: daily_delta + description: "Daily total impact on token balance" + - &daily_delta_usd + name: daily_delta_usd + description: "Daily total impact on token balance, in USD" + - &daily_delta_eth + name: daily_delta_eth + description: "Daily total impact on token balance, in eth" \ No newline at end of file diff --git a/models/_project/balancer/balances/avalanche_c/balancer_v2_avalanche_c_token_balance_changes.sql b/models/_project/balancer/balances/avalanche_c/balancer_v2_avalanche_c_token_balance_changes.sql new file mode 100644 index 00000000000..ab55e6e99f1 --- /dev/null +++ b/models/_project/balancer/balances/avalanche_c/balancer_v2_avalanche_c_token_balance_changes.sql @@ -0,0 +1,16 @@ +{% set blockchain = 'avalanche_c' %} + +{{ config( + schema = 'balancer_v2_avalanche_c', + alias = 'token_balance_changes', + materialized = 'table', + file_format = 'delta' + ) +}} + +{{ + balancer_token_balance_changes_macro( + blockchain = blockchain, + version = '2' + ) +}} \ No newline at end of file diff --git a/models/_project/balancer/balances/avalanche_c/balancer_v2_avalanche_c_token_balance_changes_daily.sql b/models/_project/balancer/balances/avalanche_c/balancer_v2_avalanche_c_token_balance_changes_daily.sql new file mode 100644 index 00000000000..35ed123547e --- /dev/null +++ b/models/_project/balancer/balances/avalanche_c/balancer_v2_avalanche_c_token_balance_changes_daily.sql @@ -0,0 +1,17 @@ +{% set blockchain = 'avalanche_c' %} + +{{ + config( + schema = 'balancer_v2_avalanche_c', + alias = 'token_balance_changes_daily', + materialized = 'table', + file_format = 'delta' + ) +}} + +{{ + balancer_token_balance_changes_daily_agg_macro( + blockchain = blockchain, + version = '2' + ) +}} \ No newline at end of file diff --git a/models/_project/balancer/balances/balancer_token_balance_changes.sql b/models/_project/balancer/balances/balancer_token_balance_changes.sql new file mode 100644 index 00000000000..7f531a769f3 --- /dev/null +++ b/models/_project/balancer/balances/balancer_token_balance_changes.sql @@ -0,0 +1,46 @@ +{{ config( + schema = 'balancer', + alias = 'token_balance_changes', + post_hook='{{ expose_spells(blockchains = \'["arbitrum", "avalanche_c", "base", "ethereum", "gnosis", "optimism", "polygon", "zkevm"]\', + spell_type = "project", + spell_name = "balancer", + contributors = \'["viniabussafi"]\') }}' + ) +}} + +{% set balancer_models = [ + ref('balancer_v2_arbitrum_token_balance_changes'), + ref('balancer_v2_avalanche_c_token_balance_changes'), + ref('balancer_v2_base_token_balance_changes'), + ref('balancer_v2_ethereum_token_balance_changes'), + ref('balancer_v2_gnosis_token_balance_changes'), + ref('balancer_v2_optimism_token_balance_changes'), + ref('balancer_v2_polygon_token_balance_changes'), + ref('balancer_v2_zkevm_token_balance_changes') +] %} + +SELECT * +FROM ( + {% for model in balancer_models %} + SELECT + block_date + , evt_block_time + , evt_block_number + , blockchain + , evt_tx_hash + , evt_index + , pool_id + , pool_address + , pool_symbol + , pool_type + , version + , token_address + , token_symbol + , delta_amount_raw + , delta_amount + FROM {{ model }} + {% if not loop.last %} + UNION ALL + {% endif %} + {% endfor %} +) \ No newline at end of file diff --git a/models/_project/balancer/balances/balancer_token_balance_changes_daily.sql b/models/_project/balancer/balances/balancer_token_balance_changes_daily.sql new file mode 100644 index 00000000000..8e199a25708 --- /dev/null +++ b/models/_project/balancer/balances/balancer_token_balance_changes_daily.sql @@ -0,0 +1,43 @@ +{{ config( + schema = 'balancer', + alias = 'token_balance_changes_daily', + post_hook='{{ expose_spells(blockchains = \'["arbitrum", "avalanche_c", "base", "ethereum", "gnosis", "optimism", "polygon", "zkevm"]\', + spell_type = "project", + spell_name = "balancer", + contributors = \'["viniabussafi"]\') }}' + ) +}} + +{% set balancer_models = [ + ref('balancer_v2_arbitrum_token_balance_changes_daily'), + ref('balancer_v2_avalanche_c_token_balance_changes_daily'), + ref('balancer_v2_base_token_balance_changes_daily'), + ref('balancer_v2_ethereum_token_balance_changes_daily'), + ref('balancer_v2_gnosis_token_balance_changes_daily'), + ref('balancer_v2_optimism_token_balance_changes_daily'), + ref('balancer_v2_polygon_token_balance_changes_daily'), + ref('balancer_v2_zkevm_token_balance_changes_daily') +] %} + +SELECT * +FROM ( + {% for model in balancer_models %} + SELECT + block_date + , pool_id + , pool_address + , pool_symbol + , version + , blockchain + , pool_type + , token_address + , token_symbol + , daily_delta + , daily_delta_usd + , daily_delta_eth + FROM {{ model }} + {% if not loop.last %} + UNION ALL + {% endif %} + {% endfor %} +) \ No newline at end of file diff --git a/models/_project/balancer/balances/base/_schema.yml b/models/_project/balancer/balances/base/_schema.yml new file mode 100644 index 00000000000..89a11b3e539 --- /dev/null +++ b/models/_project/balancer/balances/base/_schema.yml @@ -0,0 +1,100 @@ +version: 2 + +models: + - name: balancer_v2_base_token_balance_changes + meta: + blockchain: base + project: balancer_v2 + contributors: viniabussafi + config: + tags: ['base', 'bpt', 'supply', 'changes'] + description: > + Token Balance Changes on Balancer Pools. + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - block_date + - evt_tx_hash + - evt_index + - token_address + columns: + - &block_date + name: block_date + description: "UTC event block date of each DEX trade" + - &evt_block_time + name: evt_block_time + description: 'Block time of transfer event' + - &evt_block_number + name: evt_block_number + description: 'Block number of transfer event' + - &blockchain + name: blockchain + description: "Blockchain" + - &evt_tx_hash + name: evt_tx_hash + description: 'Transaction hash of transfer event' + - &evt_index + name: evt_index + description: 'Event index' + - &pool_id + name: pool_id + description: "Unique encoded identifier that refers to each pool" + - &pool_address + name: pool_address + description: "Pool address" + - &pool_symbol + name: pool_symbol + description: "Token symbols, followed by their respective weights, if applicable" + - &pool_type + name: pool_type + description: "Pool attributes, determined by the pool's factory" + - &version + name: version + description: "Version of Balancer where the liquidity pool used in transaction is deployed" + - &token_address + name: token_address + description: "Contract address of the token" + - &token_symbol + name: token_symbol + description: "Token symbol" + - &delta_amount_raw + name: delta_amount_raw + description: "Raw value of the transaction at the time of execution in the original currency" + - &delta_amount + name: delta_amount + description: "Normalized value of the transaction at the time of execution in the original currency" + + - name: balancer_v2_base_token_balance_changes_daily + meta: + blockchain: base + project: balancer_v2 + contributors: viniabussafi + config: + tags: ['base', 'bpt', 'supply', 'changes'] + description: > + Token Balance Changes on Balancer Pools, grouped by day. + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - block_date + - pool_id + - token_address + columns: + - *block_date + - *pool_id + - *pool_address + - *pool_symbol + - *version + - *blockchain + - *pool_type + - *token_address + - *token_symbol + - &daily_delta + name: daily_delta + description: "Daily total impact on token balance" + - &daily_delta_usd + name: daily_delta_usd + description: "Daily total impact on token balance, in USD" + - &daily_delta_eth + name: daily_delta_eth + description: "Daily total impact on token balance, in eth" \ No newline at end of file diff --git a/models/_project/balancer/balances/base/balancer_v2_base_token_balance_changes.sql b/models/_project/balancer/balances/base/balancer_v2_base_token_balance_changes.sql new file mode 100644 index 00000000000..1f35750f21d --- /dev/null +++ b/models/_project/balancer/balances/base/balancer_v2_base_token_balance_changes.sql @@ -0,0 +1,16 @@ +{% set blockchain = 'base' %} + +{{ config( + schema = 'balancer_v2_base', + alias = 'token_balance_changes', + materialized = 'table', + file_format = 'delta' + ) +}} + +{{ + balancer_token_balance_changes_macro( + blockchain = blockchain, + version = '2' + ) +}} \ No newline at end of file diff --git a/models/_project/balancer/balances/base/balancer_v2_base_token_balance_changes_daily.sql b/models/_project/balancer/balances/base/balancer_v2_base_token_balance_changes_daily.sql new file mode 100644 index 00000000000..fe24b712bee --- /dev/null +++ b/models/_project/balancer/balances/base/balancer_v2_base_token_balance_changes_daily.sql @@ -0,0 +1,17 @@ +{% set blockchain = 'base' %} + +{{ + config( + schema = 'balancer_v2_base', + alias = 'token_balance_changes_daily', + materialized = 'table', + file_format = 'delta' + ) +}} + +{{ + balancer_token_balance_changes_daily_agg_macro( + blockchain = blockchain, + version = '2' + ) +}} \ No newline at end of file diff --git a/models/_project/balancer/balances/ethereum/_schema.yml b/models/_project/balancer/balances/ethereum/_schema.yml new file mode 100644 index 00000000000..dab33f52016 --- /dev/null +++ b/models/_project/balancer/balances/ethereum/_schema.yml @@ -0,0 +1,131 @@ +version: 2 + +models: + - name: balancer_ethereum_balances + meta: + blockchain: ethereum + project: balancer + contributors: jacektrocinski, metacrypto, viniabussafi + config: + tags: ['ethereum', 'balancer', 'balances'] + description: > + ERC20 token rolling sum balances on Balancer, an automated portfolio manager and trading platform. + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - day + - pool + - token + columns: + - &day + name: day + description: "UTC event block time truncated to the day mark" + tests: + - not_null + - &pool + name: pool + description: "Balancer pool contract address" + - &token + name: token + description: "Token contract address" + - &cumulative_amount + name: cumulative_amount + description: "Balance of a token" + + - name: balancer_v2_ethereum_token_balance_changes + meta: + blockchain: ethereum + project: balancer_v2 + contributors: viniabussafi + config: + tags: ['ethereum', 'bpt', 'supply', 'changes'] + description: > + Token Balance Changes on Balancer Pools. + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - block_date + - evt_tx_hash + - evt_index + - token_address + columns: + - &block_date + name: block_date + description: "UTC event block date of each DEX trade" + - &evt_block_time + name: evt_block_time + description: "Block time of transfer event" + - &evt_block_number + name: evt_block_number + description: "Block number of transfer event" + - &blockchain + name: blockchain + description: "Blockchain" + - &evt_tx_hash + name: evt_tx_hash + description: "Transaction hash of transfer event" + - &evt_index + name: evt_index + description: "Event index" + - &pool_id + name: pool_id + description: "Unique encoded identifier that refers to each pool" + - &pool_address + name: pool_address + description: "Pool address" + - &pool_symbol + name: pool_symbol + description: "Token symbols, followed by their respective weights, if applicable" + - &pool_type + name: pool_type + description: "Pool attributes, determined by the pool's factory" + - &version + name: version + description: "Version of Balancer where the liquidity pool used in transaction is deployed" + - &token_address + name: token_address + description: "Contract address of the token" + - &token_symbol + name: token_symbol + description: "Token symbol" + - &delta_amount_raw + name: delta_amount_raw + description: "Raw value of the transaction at the time of execution in the original currency" + - &delta_amount + name: delta_amount + description: "Normalized value of the transaction at the time of execution in the original currency" + + - name: balancer_v2_ethereum_token_balance_changes_daily + meta: + blockchain: ethereum + project: balancer_v2 + contributors: viniabussafi + config: + tags: ['ethereum', 'bpt', 'supply', 'changes'] + description: > + Token Balance Changes on Balancer Pools, grouped by day. + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - block_date + - pool_id + - token_address + columns: + - *block_date + - *pool_id + - *pool_address + - *pool_symbol + - *version + - *blockchain + - *pool_type + - *token_address + - *token_symbol + - &daily_delta + name: daily_delta + description: "Daily total impact on token balance" + - &daily_delta_usd + name: daily_delta_usd + description: "Daily total impact on token balance, in USD" + - &daily_delta_eth + name: daily_delta_eth + description: "Daily total impact on token balance, in ETH" \ No newline at end of file diff --git a/models/balancer/ethereum/balancer_ethereum_balances.sql b/models/_project/balancer/balances/ethereum/balancer_ethereum_balances.sql similarity index 88% rename from models/balancer/ethereum/balancer_ethereum_balances.sql rename to models/_project/balancer/balances/ethereum/balancer_ethereum_balances.sql index bddec24d0bf..aa584c6c39d 100644 --- a/models/balancer/ethereum/balancer_ethereum_balances.sql +++ b/models/_project/balancer/balances/ethereum/balancer_ethereum_balances.sql @@ -1,11 +1,11 @@ {{ config( + schema = 'balancer_ethereum', alias = 'balances', - post_hook='{{ expose_spells(\'["ethereum"]\', - "project", - "balancer", - \'["metacrypto", "jacektrocinski", "viniabussafi"]\') }}' + spell_type = "project", + spell_name = "balancer", + contributors = \'["metacrypto", "jacektrocinski", "viniabussafi"]\') }}' )  }} @@ -72,5 +72,4 @@ running_cumulative_balance_by_token AS ( LEFT JOIN cumulative_balance_by_token b ON b.day <= c.day AND c.day < b.day_of_next_change ) -SELECT * FROM running_cumulative_balance_by_token - +SELECT * FROM running_cumulative_balance_by_token \ No newline at end of file diff --git a/models/_project/balancer/balances/ethereum/balancer_v2_ethereum_token_balance_changes.sql b/models/_project/balancer/balances/ethereum/balancer_v2_ethereum_token_balance_changes.sql new file mode 100644 index 00000000000..12b1a61ad46 --- /dev/null +++ b/models/_project/balancer/balances/ethereum/balancer_v2_ethereum_token_balance_changes.sql @@ -0,0 +1,16 @@ +{% set blockchain = 'ethereum' %} + +{{ config( + schema = 'balancer_v2_ethereum', + alias = 'token_balance_changes', + materialized = 'table', + file_format = 'delta' + ) +}} + +{{ + balancer_token_balance_changes_macro( + blockchain = blockchain, + version = '2' + ) +}} \ No newline at end of file diff --git a/models/_project/balancer/balances/ethereum/balancer_v2_ethereum_token_balance_changes_daily.sql b/models/_project/balancer/balances/ethereum/balancer_v2_ethereum_token_balance_changes_daily.sql new file mode 100644 index 00000000000..44aeb0ee7b8 --- /dev/null +++ b/models/_project/balancer/balances/ethereum/balancer_v2_ethereum_token_balance_changes_daily.sql @@ -0,0 +1,17 @@ +{% set blockchain = 'ethereum' %} + +{{ + config( + schema = 'balancer_v2_ethereum', + alias = 'token_balance_changes_daily', + materialized = 'table', + file_format = 'delta' + ) +}} + +{{ + balancer_token_balance_changes_daily_agg_macro( + blockchain = blockchain, + version = '2' + ) +}} \ No newline at end of file diff --git a/models/_project/balancer/balances/gnosis/_schema.yml b/models/_project/balancer/balances/gnosis/_schema.yml new file mode 100644 index 00000000000..9fdd91e45e3 --- /dev/null +++ b/models/_project/balancer/balances/gnosis/_schema.yml @@ -0,0 +1,100 @@ +version: 2 + +models: + - name: balancer_v2_gnosis_token_balance_changes + meta: + blockchain: gnosis + project: balancer_v2 + contributors: viniabussafi + config: + tags: ['gnosis', 'bpt', 'supply', 'changes'] + description: > + Token Balance Changes on Balancer Pools. + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - block_date + - evt_tx_hash + - evt_index + - token_address + columns: + - &block_date + name: block_date + description: "UTC event block date of each DEX trade" + - &evt_block_time + name: evt_block_time + description: 'Block time of transfer event' + - &evt_block_number + name: evt_block_number + description: 'Block number of transfer event' + - &blockchain + name: blockchain + description: "Blockchain" + - &evt_tx_hash + name: evt_tx_hash + description: 'Transaction hash of transfer event' + - &evt_index + name: evt_index + description: 'Event index' + - &pool_id + name: pool_id + description: "Unique encoded identifier that refers to each pool" + - &pool_address + name: pool_address + description: "Pool address" + - &pool_symbol + name: pool_symbol + description: "Token symbols, followed by their respective weights, if applicable" + - &pool_type + name: pool_type + description: "Pool attributes, determined by the pool's factory" + - &version + name: version + description: "Version of Balancer where the liquidity pool used in transaction is deployed" + - &token_address + name: token_address + description: "Contract address of the token" + - &token_symbol + name: token_symbol + description: "Token symbol" + - &delta_amount_raw + name: delta_amount_raw + description: "Raw value of the transaction at the time of execution in the original currency" + - &delta_amount + name: delta_amount + description: "Normalized value of the transaction at the time of execution in the original currency" + + - name: balancer_v2_gnosis_token_balance_changes_daily + meta: + blockchain: gnosis + project: balancer_v2 + contributors: viniabussafi + config: + tags: ['gnosis', 'bpt', 'supply', 'changes'] + description: > + Token Balance Changes on Balancer Pools, grouped by day. + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - block_date + - pool_id + - token_address + columns: + - *block_date + - *pool_id + - *pool_address + - *pool_symbol + - *version + - *blockchain + - *pool_type + - *token_address + - *token_symbol + - &daily_delta + name: daily_delta + description: "Daily total impact on token balance" + - &daily_delta_usd + name: daily_delta_usd + description: "Daily total impact on token balance, in USD" + - &daily_delta_eth + name: daily_delta_eth + description: "Daily total impact on token balance, in eth" \ No newline at end of file diff --git a/models/_project/balancer/balances/gnosis/balancer_v2_gnosis_token_balance_changes.sql b/models/_project/balancer/balances/gnosis/balancer_v2_gnosis_token_balance_changes.sql new file mode 100644 index 00000000000..e3e0177541d --- /dev/null +++ b/models/_project/balancer/balances/gnosis/balancer_v2_gnosis_token_balance_changes.sql @@ -0,0 +1,16 @@ +{% set blockchain = 'gnosis' %} + +{{ config( + schema = 'balancer_v2_gnosis', + alias = 'token_balance_changes', + materialized = 'table', + file_format = 'delta' + ) +}} + +{{ + balancer_token_balance_changes_macro( + blockchain = blockchain, + version = '2' + ) +}} \ No newline at end of file diff --git a/models/_project/balancer/balances/gnosis/balancer_v2_gnosis_token_balance_changes_daily.sql b/models/_project/balancer/balances/gnosis/balancer_v2_gnosis_token_balance_changes_daily.sql new file mode 100644 index 00000000000..434e9b096fb --- /dev/null +++ b/models/_project/balancer/balances/gnosis/balancer_v2_gnosis_token_balance_changes_daily.sql @@ -0,0 +1,17 @@ +{% set blockchain = 'gnosis' %} + +{{ + config( + schema = 'balancer_v2_gnosis', + alias = 'token_balance_changes_daily', + materialized = 'table', + file_format = 'delta' + ) +}} + +{{ + balancer_token_balance_changes_daily_agg_macro( + blockchain = blockchain, + version = '2' + ) +}} \ No newline at end of file diff --git a/models/_project/balancer/balances/optimism/_schema.yml b/models/_project/balancer/balances/optimism/_schema.yml new file mode 100644 index 00000000000..952aefc44ee --- /dev/null +++ b/models/_project/balancer/balances/optimism/_schema.yml @@ -0,0 +1,100 @@ +version: 2 + +models: + - name: balancer_v2_optimism_token_balance_changes + meta: + blockchain: optimism + project: balancer_v2 + contributors: viniabussafi + config: + tags: ['optimism', 'bpt', 'supply', 'changes'] + description: > + Token Balance Changes on Balancer Pools. + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - block_date + - evt_tx_hash + - evt_index + - token_address + columns: + - &block_date + name: block_date + description: "UTC event block date of each DEX trade" + - &evt_block_time + name: evt_block_time + description: 'Block time of transfer event' + - &evt_block_number + name: evt_block_number + description: 'Block number of transfer event' + - &blockchain + name: blockchain + description: "Blockchain" + - &evt_tx_hash + name: evt_tx_hash + description: 'Transaction hash of transfer event' + - &evt_index + name: evt_index + description: 'Event index' + - &pool_id + name: pool_id + description: "Unique encoded identifier that refers to each pool" + - &pool_address + name: pool_address + description: "Pool address" + - &pool_symbol + name: pool_symbol + description: "Token symbols, followed by their respective weights, if applicable" + - &pool_type + name: pool_type + description: "Pool attributes, determined by the pool's factory" + - &version + name: version + description: "Version of Balancer where the liquidity pool used in transaction is deployed" + - &token_address + name: token_address + description: "Contract address of the token" + - &token_symbol + name: token_symbol + description: "Token symbol" + - &delta_amount_raw + name: delta_amount_raw + description: "Raw value of the transaction at the time of execution in the original currency" + - &delta_amount + name: delta_amount + description: "Normalized value of the transaction at the time of execution in the original currency" + + - name: balancer_v2_optimism_token_balance_changes_daily + meta: + blockchain: optimism + project: balancer_v2 + contributors: viniabussafi + config: + tags: ['optimism', 'bpt', 'supply', 'changes'] + description: > + Token Balance Changes on Balancer Pools, grouped by day. + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - block_date + - pool_id + - token_address + columns: + - *block_date + - *pool_id + - *pool_address + - *pool_symbol + - *version + - *blockchain + - *pool_type + - *token_address + - *token_symbol + - &daily_delta + name: daily_delta + description: "Daily total impact on token balance" + - &daily_delta_usd + name: daily_delta_usd + description: "Daily total impact on token balance, in USD" + - &daily_delta_eth + name: daily_delta_eth + description: "Daily total impact on token balance, in eth" \ No newline at end of file diff --git a/models/_project/balancer/balances/optimism/balancer_v2_optimism_token_balance_changes.sql b/models/_project/balancer/balances/optimism/balancer_v2_optimism_token_balance_changes.sql new file mode 100644 index 00000000000..39fd96a795d --- /dev/null +++ b/models/_project/balancer/balances/optimism/balancer_v2_optimism_token_balance_changes.sql @@ -0,0 +1,16 @@ +{% set blockchain = 'optimism' %} + +{{ config( + schema = 'balancer_v2_optimism', + alias = 'token_balance_changes', + materialized = 'table', + file_format = 'delta' + ) +}} + +{{ + balancer_token_balance_changes_macro( + blockchain = blockchain, + version = '2' + ) +}} \ No newline at end of file diff --git a/models/_project/balancer/balances/optimism/balancer_v2_optimism_token_balance_changes_daily.sql b/models/_project/balancer/balances/optimism/balancer_v2_optimism_token_balance_changes_daily.sql new file mode 100644 index 00000000000..ac9db7d6bd7 --- /dev/null +++ b/models/_project/balancer/balances/optimism/balancer_v2_optimism_token_balance_changes_daily.sql @@ -0,0 +1,17 @@ +{% set blockchain = 'optimism' %} + +{{ + config( + schema = 'balancer_v2_optimism', + alias = 'token_balance_changes_daily', + materialized = 'table', + file_format = 'delta' + ) +}} + +{{ + balancer_token_balance_changes_daily_agg_macro( + blockchain = blockchain, + version = '2' + ) +}} \ No newline at end of file diff --git a/models/_project/balancer/balances/polygon/_schema.yml b/models/_project/balancer/balances/polygon/_schema.yml new file mode 100644 index 00000000000..70c27f9cac4 --- /dev/null +++ b/models/_project/balancer/balances/polygon/_schema.yml @@ -0,0 +1,100 @@ +version: 2 + +models: + - name: balancer_v2_polygon_token_balance_changes + meta: + blockchain: polygon + project: balancer_v2 + contributors: viniabussafi + config: + tags: ['polygon', 'bpt', 'supply', 'changes'] + description: > + Token Balance Changes on Balancer Pools. + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - block_date + - evt_tx_hash + - evt_index + - token_address + columns: + - &block_date + name: block_date + description: "UTC event block date of each DEX trade" + - &evt_block_time + name: evt_block_time + description: 'Block time of transfer event' + - &evt_block_number + name: evt_block_number + description: 'Block number of transfer event' + - &blockchain + name: blockchain + description: "Blockchain" + - &evt_tx_hash + name: evt_tx_hash + description: 'Transaction hash of transfer event' + - &evt_index + name: evt_index + description: 'Event index' + - &pool_id + name: pool_id + description: "Unique encoded identifier that refers to each pool" + - &pool_address + name: pool_address + description: "Pool address" + - &pool_symbol + name: pool_symbol + description: "Token symbols, followed by their respective weights, if applicable" + - &pool_type + name: pool_type + description: "Pool attributes, determined by the pool's factory" + - &version + name: version + description: "Version of Balancer where the liquidity pool used in transaction is deployed" + - &token_address + name: token_address + description: "Contract address of the token" + - &token_symbol + name: token_symbol + description: "Token symbol" + - &delta_amount_raw + name: delta_amount_raw + description: "Raw value of the transaction at the time of execution in the original currency" + - &delta_amount + name: delta_amount + description: "Normalized value of the transaction at the time of execution in the original currency" + + - name: balancer_v2_polygon_token_balance_changes_daily + meta: + blockchain: polygon + project: balancer_v2 + contributors: viniabussafi + config: + tags: ['polygon', 'bpt', 'supply', 'changes'] + description: > + Token Balance Changes on Balancer Pools, grouped by day. + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - block_date + - pool_id + - token_address + columns: + - *block_date + - *pool_id + - *pool_address + - *pool_symbol + - *version + - *blockchain + - *pool_type + - *token_address + - *token_symbol + - &daily_delta + name: daily_delta + description: "Daily total impact on token balance" + - &daily_delta_usd + name: daily_delta_usd + description: "Daily total impact on token balance, in USD" + - &daily_delta_eth + name: daily_delta_eth + description: "Daily total impact on token balance, in eth" \ No newline at end of file diff --git a/models/_project/balancer/balances/polygon/balancer_v2_polygon_token_balance_changes.sql b/models/_project/balancer/balances/polygon/balancer_v2_polygon_token_balance_changes.sql new file mode 100644 index 00000000000..efbac69046b --- /dev/null +++ b/models/_project/balancer/balances/polygon/balancer_v2_polygon_token_balance_changes.sql @@ -0,0 +1,16 @@ +{% set blockchain = 'polygon' %} + +{{ config( + schema = 'balancer_v2_polygon', + alias = 'token_balance_changes', + materialized = 'table', + file_format = 'delta' + ) +}} + +{{ + balancer_token_balance_changes_macro( + blockchain = blockchain, + version = '2' + ) +}} \ No newline at end of file diff --git a/models/_project/balancer/balances/polygon/balancer_v2_polygon_token_balance_changes_daily.sql b/models/_project/balancer/balances/polygon/balancer_v2_polygon_token_balance_changes_daily.sql new file mode 100644 index 00000000000..fa318aaec80 --- /dev/null +++ b/models/_project/balancer/balances/polygon/balancer_v2_polygon_token_balance_changes_daily.sql @@ -0,0 +1,17 @@ +{% set blockchain = 'polygon' %} + +{{ + config( + schema = 'balancer_v2_polygon', + alias = 'token_balance_changes_daily', + materialized = 'table', + file_format = 'delta' + ) +}} + +{{ + balancer_token_balance_changes_daily_agg_macro( + blockchain = blockchain, + version = '2' + ) +}} \ No newline at end of file diff --git a/models/_project/balancer/balances/zkevm/_schema.yml b/models/_project/balancer/balances/zkevm/_schema.yml new file mode 100644 index 00000000000..3fae28a259a --- /dev/null +++ b/models/_project/balancer/balances/zkevm/_schema.yml @@ -0,0 +1,100 @@ +version: 2 + +models: + - name: balancer_v2_zkevm_token_balance_changes + meta: + blockchain: zkevm + project: balancer_v2 + contributors: viniabussafi + config: + tags: ['zkevm', 'bpt', 'supply', 'changes'] + description: > + Token Balance Changes on Balancer Pools. + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - block_date + - evt_tx_hash + - evt_index + - token_address + columns: + - &block_date + name: block_date + description: "UTC event block date of each DEX trade" + - &evt_block_time + name: evt_block_time + description: 'Block time of transfer event' + - &evt_block_number + name: evt_block_number + description: 'Block number of transfer event' + - &blockchain + name: blockchain + description: "Blockchain" + - &evt_tx_hash + name: evt_tx_hash + description: 'Transaction hash of transfer event' + - &evt_index + name: evt_index + description: 'Event index' + - &pool_id + name: pool_id + description: "Unique encoded identifier that refers to each pool" + - &pool_address + name: pool_address + description: "Pool address" + - &pool_symbol + name: pool_symbol + description: "Token symbols, followed by their respective weights, if applicable" + - &pool_type + name: pool_type + description: "Pool attributes, determined by the pool's factory" + - &version + name: version + description: "Version of Balancer where the liquidity pool used in transaction is deployed" + - &token_address + name: token_address + description: "Contract address of the token" + - &token_symbol + name: token_symbol + description: "Token symbol" + - &delta_amount_raw + name: delta_amount_raw + description: "Raw value of the transaction at the time of execution in the original currency" + - &delta_amount + name: delta_amount + description: "Normalized value of the transaction at the time of execution in the original currency" + + - name: balancer_v2_zkevm_token_balance_changes_daily + meta: + blockchain: zkevm + project: balancer_v2 + contributors: viniabussafi + config: + tags: ['zkevm', 'bpt', 'supply', 'changes'] + description: > + Token Balance Changes on Balancer Pools, grouped by day. + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - block_date + - pool_id + - token_address + columns: + - *block_date + - *pool_id + - *pool_address + - *pool_symbol + - *version + - *blockchain + - *pool_type + - *token_address + - *token_symbol + - &daily_delta + name: daily_delta + description: "Daily total impact on token balance" + - &daily_delta_usd + name: daily_delta_usd + description: "Daily total impact on token balance, in USD" + - &daily_delta_eth + name: daily_delta_eth + description: "Daily total impact on token balance, in eth" \ No newline at end of file diff --git a/models/_project/balancer/balances/zkevm/balancer_v2_zkevm_token_balance_changes.sql b/models/_project/balancer/balances/zkevm/balancer_v2_zkevm_token_balance_changes.sql new file mode 100644 index 00000000000..80eff1513b7 --- /dev/null +++ b/models/_project/balancer/balances/zkevm/balancer_v2_zkevm_token_balance_changes.sql @@ -0,0 +1,16 @@ +{% set blockchain = 'zkevm' %} + +{{ config( + schema = 'balancer_v2_zkevm', + alias = 'token_balance_changes', + materialized = 'table', + file_format = 'delta' + ) +}} + +{{ + balancer_token_balance_changes_macro( + blockchain = blockchain, + version = '2' + ) +}} \ No newline at end of file diff --git a/models/_project/balancer/balances/zkevm/balancer_v2_zkevm_token_balance_changes_daily.sql b/models/_project/balancer/balances/zkevm/balancer_v2_zkevm_token_balance_changes_daily.sql new file mode 100644 index 00000000000..9bd7cabbb72 --- /dev/null +++ b/models/_project/balancer/balances/zkevm/balancer_v2_zkevm_token_balance_changes_daily.sql @@ -0,0 +1,17 @@ +{% set blockchain = 'zkevm' %} + +{{ + config( + schema = 'balancer_v2_zkevm', + alias = 'token_balance_changes_daily', + materialized = 'table', + file_format = 'delta' + ) +}} + +{{ + balancer_token_balance_changes_daily_agg_macro( + blockchain = blockchain, + version = '2' + ) +}} \ No newline at end of file diff --git a/models/_project/balancer/bpt/_schema.yml b/models/_project/balancer/bpt/_schema.yml new file mode 100644 index 00000000000..4afa2327ca2 --- /dev/null +++ b/models/_project/balancer/bpt/_schema.yml @@ -0,0 +1,176 @@ +version: 2 + +models: + - name: balancer_transfers_bpt + meta: + blockchain: arbitrum, avalanche_c, base, ethereum, gnosis, optimism, polygon, zkevmn + contributors: victorstefenon, thetroyharris, viniabussafi + config: + tags: ['arbitrum', 'avalanche_c', 'base', 'ethereum', 'gnosis', 'optimism', 'polygon', 'zkevm', 'bpt', 'transfers'] + description: > + Balancer Pool Token (BPT) transfer logs on Balancer, an automated portfolio manager and trading platform. + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - evt_tx_hash + - evt_index + - block_date + columns: + - &blockchain + name: blockchain + description: "Blockchain" + - &version + name: version + description: "Version of Balancer where the liquidity pool used in transaction is deployed" + - &contract_address + name: contract_address + description: 'zkevm address for the liquidity pool used in transaction' + - &block_date + name: block_date + description: "UTC event block date of each DEX trade" + - &block_month + name: block_month + description: "UTC event block month of each DEX trade" + - &evt_tx_hash + name: evt_tx_hash + description: 'Transaction hash of transfer event' + - &evt_index + name: evt_index + description: 'Event index' + - &evt_block_time + name: evt_block_time + description: 'Block time of transfer event' + - &evt_block_number + name: evt_block_number + description: 'Block number of transfer event' + - &from + name: from + description: 'Address of BPT provider of transfer event' + - &to + name: to + description: 'Address of BPT receiver of transfer event' + - &value + name: value + description: 'Amount of BPT transferred in transfer event' + + - name: balancer_bpt_prices + meta: + blockchain: arbitrum, avalanche_c, base, ethereum, gnosis, optimism, polygon, zkevm + sector: dex + contributors: thetroyharris, victorstefenon, viniabussafi + config: + tags: ['balancer', 'amm', 'dex', 'bpt', 'prices', 'ethereum', 'arbitrum', 'optimism', 'polygon', 'gnosis', 'avalanche_c', 'base', 'zkevm'] + description: > + Balancer Pool Token (BPT) hourly median price by pool on Balancer, an automated portfolio manager and trading platform. + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - blockchain + - day + - contract_address + columns: + - *blockchain + - &day + name: day + description: "Block date in UTC" + - *version + - &decimals + name: decimals + description: "Token decimals. 18, by default, on BPTs" + - *contract_address + - &bpt_price + name: bpt_price + description: "Price of the BPT" + + + - name: balancer_bpt_supply + meta: + blockchain: arbitrum, avalanche_c, base, ethereum, gnosis, optimism, polygon, zkevm + contributors: thetroyharris, viniabussafi + config: + tags: ['arbitrum', 'avalanche_c', 'base', 'ethereum', 'gnosis', 'optimism', 'polygon', 'zkevm', 'bpt'] + description: > + The Balancer Pool Token (BPT) supply over time of ComposableStablePools versions 4+ + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - day + - blockchain + - token_address + columns: + - *day + - &pool_type + name: pool_type + description: "Pool attributes, determined by the pool's factory" + - *version + - *blockchain + - &token_address + name: token_address + description: "Contract address of the BPT" + - &supply + name: supply + description: "Supply of the BPT, discounted of premints" + + - name: balancer_bpt_supply_changes + meta: + blockchain: arbitrum, avalanche_c, base, ethereum, gnosis, optimism, polygon, zkevm + contributors: viniabussafi + config: + tags: ['arbitrum', 'avalanche_c', 'base', 'ethereum', 'gnosis', 'optimism', 'polygon', 'zkevm', 'bpt', 'supply', 'changes'] + description: > + Balancer Pool Token (BPT) supply change events. + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - block_date + - evt_tx_hash + - evt_index + - label + columns: + - *block_date + - *evt_block_time + - *evt_block_number + - *blockchain + - *evt_tx_hash + - *evt_index + - *pool_type + - &pool_symbol + name: pool_symbol + description: "Token symbols, followed by their respective weights, if applicable" + - *version + - &label + name: label + description: "Nature of the transaction (Join/Exit via swap or Mint/Burn via transfer)" + - *token_address + - &delta_amount_raw + name: delta_amount_raw + description: "Raw value of the transaction on token supply at the time of execution in the original currency" + - &delta_amount + name: delta_amount + description: "Normalized value of the transaction on token supply at the time of execution in the original currency" + + + - name: balancer_bpt_supply_changes_daily + meta: + blockchain: arbitrum, avalanche_c, base, ethereum, gnosis, optimism, polygon, zkevm + contributors: viniabussafi + config: + tags: ['arbitrum', 'avalanche_c', 'base', 'ethereum', 'gnosis', 'optimism', 'polygon', 'zkevm', 'bpt', 'supply', 'changes'] + description: > + Balancer Pool Token (BPT) supply change events. grouped by day + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - block_date + - blockchain + - token_address + columns: + - *block_date + - *blockchain + - *pool_type + - *pool_symbol + - *version + - *token_address + - &daily_delta + name: daily_delta + description: "Daily total impact on BPT supply" \ No newline at end of file diff --git a/models/_project/balancer/bpt/arbitrum/_schema.yml b/models/_project/balancer/bpt/arbitrum/_schema.yml new file mode 100644 index 00000000000..c32bee8b667 --- /dev/null +++ b/models/_project/balancer/bpt/arbitrum/_schema.yml @@ -0,0 +1,178 @@ +version: 2 + +models: + - name: balancer_v2_arbitrum_transfers_bpt + meta: + blockchain: arbitrum + project: balancer_v2 + contributors: victorstefenon, thetroyharris, viniabussafi + config: + tags: ['arbitrum', 'bpt', 'transfers'] + description: > + Balancer Pool Token (BPT) transfer logs on Balancer, an automated portfolio manager and trading platform, on Arbitrum. + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - evt_tx_hash + - evt_index + - block_date + columns: + - &blockchain + name: blockchain + description: "Blockchain" + - &version + name: version + description: "Version of Balancer where the liquidity pool used in transaction is deployed" + - &contract_address + name: contract_address + description: 'Arbitrum address for the liquidity pool used in transaction' + - &block_date + name: block_date + description: "UTC event block date of each DEX trade" + - &block_month + name: block_month + description: "UTC event block month of each DEX trade" + - &evt_tx_hash + name: evt_tx_hash + description: 'Transaction hash of transfer event' + - &evt_index + name: evt_index + description: 'Event index' + - &evt_block_time + name: evt_block_time + description: 'Block time of transfer event' + - &evt_block_number + name: evt_block_number + description: 'Block number of transfer event' + - &from + name: from + description: 'Address of BPT provider of transfer event' + - &to + name: to + description: 'Address of BPT receiver of transfer event' + - &value + name: value + description: 'Amount of BPT transferred in transfer event' + + - name: balancer_v2_arbitrum_bpt_prices + meta: + blockchain: arbitrum + project: balancer_v2 + contributors: victorstefenon, thetroyharris, viniabussafi + config: + tags: ['arbitrum', 'bpt', 'prices'] + description: > + Balancer Pool Token (BPT) daily price by pool on Balancer, an automated portfolio manager and trading platform. + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - blockchain + - day + - contract_address + columns: + - *blockchain + - &day + name: day + description: "Block date in UTC" + - *version + - &decimals + name: decimals + description: "Token decimals. 18, by default, on BPTs" + - *contract_address + - &bpt_price + name: bpt_price + description: "Price of the BPT" + + - name: balancer_v2_arbitrum_bpt_supply + meta: + blockchain: arbitrum + project: balancer_v2 + contributors: thetroyharris, viniabussafi + config: + tags: ['arbitrum', 'bpt', 'supply'] + description: > + Balancer Pool Token (BPT) supply by pool on Balancer, an automated portfolio manager and trading platform. + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - day + - blockchain + - token_address + columns: + - *day + - &pool_type + name: pool_type + description: "Pool attributes, determined by the pool's factory" + - *version + - *blockchain + - &token_address + name: token_address + description: "Contract address of the BPT" + - &supply + name: supply + description: "Supply of the BPT, discounted of premints" + + - name: balancer_v2_arbitrum_bpt_supply_changes + meta: + blockchain: arbitrum + project: balancer_v2 + contributors: viniabussafi + config: + tags: ['arbitrum', 'bpt', 'supply', 'changes'] + description: > + Balancer Pool Token (BPT) supply change events. + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - block_date + - evt_tx_hash + - evt_index + - label + columns: + - *block_date + - *evt_block_time + - *evt_block_number + - *blockchain + - *evt_tx_hash + - *evt_index + - *pool_type + - &pool_symbol + name: pool_symbol + description: "Token symbols, followed by their respective weights, if applicable" + - *version + - &label + name: label + description: "Nature of the transaction (Join/Exit via swap or Mint/Burn via transfer)" + - *token_address + - &delta_amount_raw + name: delta_amount_raw + description: "Raw value of the transaction on token supply at the time of execution in the original currency" + - &delta_amount + name: delta_amount + description: "Normalized value of the transaction on token supply at the time of execution in the original currency" + + - name: balancer_v2_arbitrum_bpt_supply_changes_daily + meta: + blockchain: arbitrum + project: balancer_v2 + contributors: viniabussafi + config: + tags: ['arbitrum', 'bpt', 'supply', 'changes'] + description: > + Balancer Pool Token (BPT) supply change events. grouped by day + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - block_date + - blockchain + - token_address + columns: + - *block_date + - *blockchain + - *pool_type + - *pool_symbol + - *version + - *token_address + - &daily_delta + name: daily_delta + description: "Daily total impact on BPT supply" \ No newline at end of file diff --git a/models/balancer/arbitrum/balancer_v2_arbitrum_bpt_prices.sql b/models/_project/balancer/bpt/arbitrum/balancer_v2_arbitrum_bpt_prices.sql similarity index 100% rename from models/balancer/arbitrum/balancer_v2_arbitrum_bpt_prices.sql rename to models/_project/balancer/bpt/arbitrum/balancer_v2_arbitrum_bpt_prices.sql diff --git a/models/balancer/arbitrum/balancer_v2_arbitrum_bpt_supply.sql b/models/_project/balancer/bpt/arbitrum/balancer_v2_arbitrum_bpt_supply.sql similarity index 100% rename from models/balancer/arbitrum/balancer_v2_arbitrum_bpt_supply.sql rename to models/_project/balancer/bpt/arbitrum/balancer_v2_arbitrum_bpt_supply.sql diff --git a/models/_project/balancer/bpt/arbitrum/balancer_v2_arbitrum_bpt_supply_changes.sql b/models/_project/balancer/bpt/arbitrum/balancer_v2_arbitrum_bpt_supply_changes.sql new file mode 100644 index 00000000000..b30224001c3 --- /dev/null +++ b/models/_project/balancer/bpt/arbitrum/balancer_v2_arbitrum_bpt_supply_changes.sql @@ -0,0 +1,20 @@ +{% set blockchain = 'arbitrum' %} + +{{ + config( + schema = 'balancer_v2_arbitrum', + alias = 'bpt_supply_changes', + materialized = 'incremental', + file_format = 'delta', + incremental_strategy = 'merge', + unique_key = ['block_date', 'evt_tx_hash', 'evt_index', 'label'], + incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.evt_block_time')] + ) +}} + +{{ + bpt_supply_changes_macro( + blockchain = blockchain, + version = '2' + ) +}} \ No newline at end of file diff --git a/models/_project/balancer/bpt/arbitrum/balancer_v2_arbitrum_bpt_supply_changes_daily.sql b/models/_project/balancer/bpt/arbitrum/balancer_v2_arbitrum_bpt_supply_changes_daily.sql new file mode 100644 index 00000000000..df606a75ceb --- /dev/null +++ b/models/_project/balancer/bpt/arbitrum/balancer_v2_arbitrum_bpt_supply_changes_daily.sql @@ -0,0 +1,17 @@ +{% set blockchain = 'ethereum' %} + +{{ + config( + schema = 'balancer_v2_ethereum', + alias = 'bpt_supply_changes_daily', + materialized = 'table', + file_format = 'delta' + ) +}} + +{{ + bpt_supply_changes_daily_agg_macro( + blockchain = blockchain, + version = '2' + ) +}} \ No newline at end of file diff --git a/models/balancer/arbitrum/balancer_v2_arbitrum_transfers_bpt.sql b/models/_project/balancer/bpt/arbitrum/balancer_v2_arbitrum_transfers_bpt.sql similarity index 100% rename from models/balancer/arbitrum/balancer_v2_arbitrum_transfers_bpt.sql rename to models/_project/balancer/bpt/arbitrum/balancer_v2_arbitrum_transfers_bpt.sql diff --git a/models/_project/balancer/bpt/avalanche_c/_schema.yml b/models/_project/balancer/bpt/avalanche_c/_schema.yml new file mode 100644 index 00000000000..8bde08a0ad8 --- /dev/null +++ b/models/_project/balancer/bpt/avalanche_c/_schema.yml @@ -0,0 +1,178 @@ +version: 2 + +models: + - name: balancer_v2_avalanche_c_transfers_bpt + meta: + blockchain: avalanche_c + project: balancer_v2 + contributors: victorstefenon, thetroyharris, viniabussafi + config: + tags: ['avalanche_c', 'bpt', 'transfers'] + description: > + Balancer Pool Token (BPT) transfer logs on Balancer, an automated portfolio manager and trading platform, on avalanche_c. + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - evt_tx_hash + - evt_index + - block_date + columns: + - &blockchain + name: blockchain + description: "Blockchain" + - &version + name: version + description: "Version of Balancer where the liquidity pool used in transaction is deployed" + - &contract_address + name: contract_address + description: 'avalanche_c address for the liquidity pool used in transaction' + - &block_date + name: block_date + description: "UTC event block date of each DEX trade" + - &block_month + name: block_month + description: "UTC event block month of each DEX trade" + - &evt_tx_hash + name: evt_tx_hash + description: 'Transaction hash of transfer event' + - &evt_index + name: evt_index + description: 'Event index' + - &evt_block_time + name: evt_block_time + description: 'Block time of transfer event' + - &evt_block_number + name: evt_block_number + description: 'Block number of transfer event' + - &from + name: from + description: 'Address of BPT provider of transfer event' + - &to + name: to + description: 'Address of BPT receiver of transfer event' + - &value + name: value + description: 'Amount of BPT transferred in transfer event' + + - name: balancer_v2_avalanche_c_bpt_prices + meta: + blockchain: avalanche_c + project: balancer_v2 + contributors: victorstefenon, thetroyharris, viniabussafi + config: + tags: ['avalanche_c', 'bpt', 'prices'] + description: > + Balancer Pool Token (BPT) daily price by pool on Balancer, an automated portfolio manager and trading platform. + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - blockchain + - day + - contract_address + columns: + - *blockchain + - &day + name: day + description: "Block date in UTC" + - *version + - &decimals + name: decimals + description: "Token decimals. 18, by default, on BPTs" + - *contract_address + - &bpt_price + name: bpt_price + description: "Price of the BPT" + + - name: balancer_v2_avalanche_c_bpt_supply + meta: + blockchain: avalanche_c + project: balancer_v2 + contributors: thetroyharris, viniabussafi + config: + tags: ['avalanche_c', 'bpt', 'supply'] + description: > + Balancer Pool Token (BPT) supply by pool on Balancer, an automated portfolio manager and trading platform. + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - day + - blockchain + - token_address + columns: + - *day + - &pool_type + name: pool_type + description: "Pool attributes, determined by the pool's factory" + - *version + - *blockchain + - &token_address + name: token_address + description: "Contract address of the BPT" + - &supply + name: supply + description: "Supply of the BPT, discounted of premints" + + - name: balancer_v2_avalanche_c_bpt_supply_changes + meta: + blockchain: avalanche_c + project: balancer_v2 + contributors: viniabussafi + config: + tags: ['avalanche_c', 'bpt', 'supply', 'changes'] + description: > + Balancer Pool Token (BPT) supply change events. + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - block_date + - evt_tx_hash + - evt_index + - label + columns: + - *block_date + - *evt_block_time + - *evt_block_number + - *blockchain + - *evt_tx_hash + - *evt_index + - *pool_type + - &pool_symbol + name: pool_symbol + description: "Token symbols, followed by their respective weights, if applicable" + - *version + - &label + name: label + description: "Nature of the transaction (Join/Exit via swap or Mint/Burn via transfer)" + - *token_address + - &delta_amount_raw + name: delta_amount_raw + description: "Raw value of the transaction on token supply at the time of execution in the original currency" + - &delta_amount + name: delta_amount + description: "Normalized value of the transaction on token supply at the time of execution in the original currency" + + - name: balancer_v2_avalanche_c_bpt_supply_changes_daily + meta: + blockchain: avalanche_c + project: balancer_v2 + contributors: viniabussafi + config: + tags: ['avalanche_c', 'bpt', 'supply', 'changes'] + description: > + Balancer Pool Token (BPT) supply change events. grouped by day + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - block_date + - blockchain + - token_address + columns: + - *block_date + - *blockchain + - *pool_type + - *pool_symbol + - *version + - *token_address + - &daily_delta + name: daily_delta + description: "Daily total impact on BPT supply" \ No newline at end of file diff --git a/models/balancer/avalanche_c/balancer_v2_avalanche_c_bpt_prices.sql b/models/_project/balancer/bpt/avalanche_c/balancer_v2_avalanche_c_bpt_prices.sql similarity index 100% rename from models/balancer/avalanche_c/balancer_v2_avalanche_c_bpt_prices.sql rename to models/_project/balancer/bpt/avalanche_c/balancer_v2_avalanche_c_bpt_prices.sql diff --git a/models/balancer/avalanche_c/balancer_v2_avalanche_c_bpt_supply.sql b/models/_project/balancer/bpt/avalanche_c/balancer_v2_avalanche_c_bpt_supply.sql similarity index 100% rename from models/balancer/avalanche_c/balancer_v2_avalanche_c_bpt_supply.sql rename to models/_project/balancer/bpt/avalanche_c/balancer_v2_avalanche_c_bpt_supply.sql diff --git a/models/_project/balancer/bpt/avalanche_c/balancer_v2_avalanche_c_bpt_supply_changes.sql b/models/_project/balancer/bpt/avalanche_c/balancer_v2_avalanche_c_bpt_supply_changes.sql new file mode 100644 index 00000000000..db1052cb8d8 --- /dev/null +++ b/models/_project/balancer/bpt/avalanche_c/balancer_v2_avalanche_c_bpt_supply_changes.sql @@ -0,0 +1,20 @@ +{% set blockchain = 'avalanche_c' %} + +{{ + config( + schema = 'balancer_v2_avalanche_c', + alias = 'bpt_supply_changes', + materialized = 'incremental', + file_format = 'delta', + incremental_strategy = 'merge', + unique_key = ['block_date', 'evt_tx_hash', 'evt_index', 'label'], + incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.evt_block_time')] + ) +}} + +{{ + bpt_supply_changes_macro( + blockchain = blockchain, + version = '2' + ) +}} \ No newline at end of file diff --git a/models/_project/balancer/bpt/avalanche_c/balancer_v2_avalanche_c_bpt_supply_changes_daily.sql b/models/_project/balancer/bpt/avalanche_c/balancer_v2_avalanche_c_bpt_supply_changes_daily.sql new file mode 100644 index 00000000000..5ce53b4aa92 --- /dev/null +++ b/models/_project/balancer/bpt/avalanche_c/balancer_v2_avalanche_c_bpt_supply_changes_daily.sql @@ -0,0 +1,17 @@ +{% set blockchain = 'avalanche_c' %} + +{{ + config( + schema = 'balancer_v2_avalanche_c', + alias = 'bpt_supply_changes_daily', + materialized = 'table', + file_format = 'delta' + ) +}} + +{{ + bpt_supply_changes_daily_agg_macro( + blockchain = blockchain, + version = '2' + ) +}} \ No newline at end of file diff --git a/models/balancer/avalanche_c/balancer_v2_avalanche_c_transfers_bpt.sql b/models/_project/balancer/bpt/avalanche_c/balancer_v2_avalanche_c_transfers_bpt.sql similarity index 100% rename from models/balancer/avalanche_c/balancer_v2_avalanche_c_transfers_bpt.sql rename to models/_project/balancer/bpt/avalanche_c/balancer_v2_avalanche_c_transfers_bpt.sql diff --git a/models/balancer/balancer_bpt_prices.sql b/models/_project/balancer/bpt/balancer_bpt_prices.sql similarity index 69% rename from models/balancer/balancer_bpt_prices.sql rename to models/_project/balancer/bpt/balancer_bpt_prices.sql index ad8502801b9..0a1180a8013 100644 --- a/models/balancer/balancer_bpt_prices.sql +++ b/models/_project/balancer/bpt/balancer_bpt_prices.sql @@ -1,10 +1,10 @@ {{ config( schema = 'balancer', alias = 'bpt_prices', - post_hook='{{ expose_spells(\'["ethereum", "arbitrum", "polygon", "gnosis", "optimism","avalanche_c", "base", "zkevm"]\', - "project", - "balancer", - \'["thetroyharris", "viniabussafi"]\') }}' + post_hook='{{ expose_spells(blockchains = \'["arbitrum", "avalanche_c", "base", "ethereum", "gnosis", "optimism", "polygon", "zkevm"]\', + spell_type = "project", + spell_name = "balancer", + contributors = \'["thetroyharris", "viniabussafi"]\') }}' ) }} diff --git a/models/balancer/balancer_bpt_supply.sql b/models/_project/balancer/bpt/balancer_bpt_supply.sql similarity index 68% rename from models/balancer/balancer_bpt_supply.sql rename to models/_project/balancer/bpt/balancer_bpt_supply.sql index a15ed33c911..e43ef846b55 100644 --- a/models/balancer/balancer_bpt_supply.sql +++ b/models/_project/balancer/bpt/balancer_bpt_supply.sql @@ -1,10 +1,10 @@ {{ config( schema = 'balancer', alias = 'bpt_supply', - post_hook = '{{ expose_spells(\'["arbitrum", "avalanche_c", "base", "ethereum", "gnosis", "optimism", "polygon", "zkevm"]\', - "project", - "balancer", - \'["thetroyharris", "viniabussafi"]\') }}' + post_hook = '{{ expose_spells(blockchains = \'["arbitrum", "avalanche_c", "base", "ethereum", "gnosis", "optimism", "polygon", "zkevm"]\', + spell_type = "project", + spell_name = "balancer", + contributors = \'["thetroyharris", "viniabussafi"]\') }}' ) }} diff --git a/models/_project/balancer/bpt/balancer_bpt_supply_changes.sql b/models/_project/balancer/bpt/balancer_bpt_supply_changes.sql new file mode 100644 index 00000000000..e46a587b3b0 --- /dev/null +++ b/models/_project/balancer/bpt/balancer_bpt_supply_changes.sql @@ -0,0 +1,44 @@ +{{ config( + schema = 'balancer', + alias = 'bpt_supply_changes', + post_hook='{{ expose_spells(blockchains = \'["arbitrum", "avalanche_c", "base", "ethereum", "gnosis", "optimism", "polygon", "zkevm"]\', + spell_type = "project", + spell_name = "balancer", + contributors = \'["viniabussafi"]\') }}' + ) +}} + +{% set balancer_models = [ + ref('balancer_v2_arbitrum_bpt_supply_changes'), + ref('balancer_v2_avalanche_c_bpt_supply_changes'), + ref('balancer_v2_base_bpt_supply_changes'), + ref('balancer_v2_ethereum_bpt_supply_changes'), + ref('balancer_v2_gnosis_bpt_supply_changes'), + ref('balancer_v2_optimism_bpt_supply_changes'), + ref('balancer_v2_polygon_bpt_supply_changes'), + ref('balancer_v2_zkevm_bpt_supply_changes') +] %} + +SELECT * +FROM ( + {% for model in balancer_models %} + SELECT + block_date + , evt_block_time + , evt_block_number + , blockchain + , evt_tx_hash + , evt_index + , pool_type + , pool_symbol + , version + , label + , token_address + , delta_amount_raw + , delta_amount + FROM {{ model }} + {% if not loop.last %} + UNION ALL + {% endif %} + {% endfor %} +) \ No newline at end of file diff --git a/models/_project/balancer/bpt/balancer_bpt_supply_changes_daily.sql b/models/_project/balancer/bpt/balancer_bpt_supply_changes_daily.sql new file mode 100644 index 00000000000..5b593cef48a --- /dev/null +++ b/models/_project/balancer/bpt/balancer_bpt_supply_changes_daily.sql @@ -0,0 +1,38 @@ +{{ config( + schema = 'balancer', + alias = 'bpt_supply_changes_daily', + post_hook='{{ expose_spells(blockchains = \'["arbitrum", "avalanche_c", "base", "ethereum", "gnosis", "optimism", "polygon", "zkevm"]\', + spell_type = "project", + spell_name = "balancer", + contributors = \'["viniabussafi"]\') }}' + ) +}} + +{% set balancer_models = [ + ref('balancer_v2_arbitrum_bpt_supply_changes_daily'), + ref('balancer_v2_avalanche_c_bpt_supply_changes_daily'), + ref('balancer_v2_base_bpt_supply_changes_daily'), + ref('balancer_v2_ethereum_bpt_supply_changes_daily'), + ref('balancer_v2_gnosis_bpt_supply_changes_daily'), + ref('balancer_v2_optimism_bpt_supply_changes_daily'), + ref('balancer_v2_polygon_bpt_supply_changes_daily'), + ref('balancer_v2_zkevm_bpt_supply_changes_daily') +] %} + +SELECT * +FROM ( + {% for model in balancer_models %} + SELECT + block_date + , blockchain + , pool_type + , pool_symbol + , version + , token_address + , daily_delta + FROM {{ model }} + {% if not loop.last %} + UNION ALL + {% endif %} + {% endfor %} +) \ No newline at end of file diff --git a/models/balancer/balancer_transfers_bpt.sql b/models/_project/balancer/bpt/balancer_transfers_bpt.sql similarity index 70% rename from models/balancer/balancer_transfers_bpt.sql rename to models/_project/balancer/bpt/balancer_transfers_bpt.sql index bd6fe9064c5..dda9c32ecb1 100644 --- a/models/balancer/balancer_transfers_bpt.sql +++ b/models/_project/balancer/bpt/balancer_transfers_bpt.sql @@ -1,10 +1,10 @@ {{ config( schema = 'balancer', alias = 'transfers_bpt', - post_hook='{{ expose_spells(\'["arbitrum", "avalanche_c", "base", "ethereum", "gnosis", "optimism", "polygon", "zkevm"]\', - "project", - "balancer", - \'["thetroyharris", "victorstefenon", "viniabussafi"]\') }}' + post_hook='{{ expose_spells(blockchains = \'["arbitrum", "avalanche_c", "base", "ethereum", "gnosis", "optimism", "polygon", "zkevm"]\', + spell_type = "project", + spell_name = "balancer", + contributors = \'["thetroyharris", "victorstefenon", "viniabussafi"]\') }}' ) }} diff --git a/models/_project/balancer/bpt/base/_schema.yml b/models/_project/balancer/bpt/base/_schema.yml new file mode 100644 index 00000000000..a32b805f7e2 --- /dev/null +++ b/models/_project/balancer/bpt/base/_schema.yml @@ -0,0 +1,178 @@ +version: 2 + +models: + - name: balancer_v2_base_transfers_bpt + meta: + blockchain: base + project: balancer_v2 + contributors: victorstefenon, thetroyharris, viniabussafi + config: + tags: ['base', 'bpt', 'transfers'] + description: > + Balancer Pool Token (BPT) transfer logs on Balancer, an automated portfolio manager and trading platform, on base. + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - evt_tx_hash + - evt_index + - block_date + columns: + - &blockchain + name: blockchain + description: "Blockchain" + - &version + name: version + description: "Version of Balancer where the liquidity pool used in transaction is deployed" + - &contract_address + name: contract_address + description: 'base address for the liquidity pool used in transaction' + - &block_date + name: block_date + description: "UTC event block date of each DEX trade" + - &block_month + name: block_month + description: "UTC event block month of each DEX trade" + - &evt_tx_hash + name: evt_tx_hash + description: 'Transaction hash of transfer event' + - &evt_index + name: evt_index + description: 'Event index' + - &evt_block_time + name: evt_block_time + description: 'Block time of transfer event' + - &evt_block_number + name: evt_block_number + description: 'Block number of transfer event' + - &from + name: from + description: 'Address of BPT provider of transfer event' + - &to + name: to + description: 'Address of BPT receiver of transfer event' + - &value + name: value + description: 'Amount of BPT transferred in transfer event' + + - name: balancer_v2_base_bpt_prices + meta: + blockchain: base + project: balancer_v2 + contributors: victorstefenon, thetroyharris, viniabussafi + config: + tags: ['base', 'bpt', 'prices'] + description: > + Balancer Pool Token (BPT) daily price by pool on Balancer, an automated portfolio manager and trading platform. + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - blockchain + - day + - contract_address + columns: + - *blockchain + - &day + name: day + description: "Block date in UTC" + - *version + - &decimals + name: decimals + description: "Token decimals. 18, by default, on BPTs" + - *contract_address + - &bpt_price + name: bpt_price + description: "Price of the BPT" + + - name: balancer_v2_base_bpt_supply + meta: + blockchain: base + project: balancer_v2 + contributors: thetroyharris, viniabussafi + config: + tags: ['base', 'bpt', 'supply'] + description: > + Balancer Pool Token (BPT) supply by pool on Balancer, an automated portfolio manager and trading platform. + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - day + - blockchain + - token_address + columns: + - *day + - &pool_type + name: pool_type + description: "Pool attributes, determined by the pool's factory" + - *version + - *blockchain + - &token_address + name: token_address + description: "Contract address of the BPT" + - &supply + name: supply + description: "Supply of the BPT, discounted of premints" + + - name: balancer_v2_base_bpt_supply_changes + meta: + blockchain: base + project: balancer_v2 + contributors: viniabussafi + config: + tags: ['base', 'bpt', 'supply', 'changes'] + description: > + Balancer Pool Token (BPT) supply change events. + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - block_date + - evt_tx_hash + - evt_index + - label + columns: + - *block_date + - *evt_block_time + - *evt_block_number + - *blockchain + - *evt_tx_hash + - *evt_index + - *pool_type + - &pool_symbol + name: pool_symbol + description: "Token symbols, followed by their respective weights, if applicable" + - *version + - &label + name: label + description: "Nature of the transaction (Join/Exit via swap or Mint/Burn via transfer)" + - *token_address + - &delta_amount_raw + name: delta_amount_raw + description: "Raw value of the transaction on token supply at the time of execution in the original currency" + - &delta_amount + name: delta_amount + description: "Normalized value of the transaction on token supply at the time of execution in the original currency" + + - name: balancer_v2_base_bpt_supply_changes_daily + meta: + blockchain: base + project: balancer_v2 + contributors: viniabussafi + config: + tags: ['base', 'bpt', 'supply', 'changes'] + description: > + Balancer Pool Token (BPT) supply change events. grouped by day + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - block_date + - blockchain + - token_address + columns: + - *block_date + - *blockchain + - *pool_type + - *pool_symbol + - *version + - *token_address + - &daily_delta + name: daily_delta + description: "Daily total impact on BPT supply" \ No newline at end of file diff --git a/models/balancer/base/balancer_v2_base_bpt_prices.sql b/models/_project/balancer/bpt/base/balancer_v2_base_bpt_prices.sql similarity index 100% rename from models/balancer/base/balancer_v2_base_bpt_prices.sql rename to models/_project/balancer/bpt/base/balancer_v2_base_bpt_prices.sql diff --git a/models/balancer/base/balancer_v2_base_bpt_supply.sql b/models/_project/balancer/bpt/base/balancer_v2_base_bpt_supply.sql similarity index 100% rename from models/balancer/base/balancer_v2_base_bpt_supply.sql rename to models/_project/balancer/bpt/base/balancer_v2_base_bpt_supply.sql diff --git a/models/_project/balancer/bpt/base/balancer_v2_base_bpt_supply_changes.sql b/models/_project/balancer/bpt/base/balancer_v2_base_bpt_supply_changes.sql new file mode 100644 index 00000000000..1d273f4e49e --- /dev/null +++ b/models/_project/balancer/bpt/base/balancer_v2_base_bpt_supply_changes.sql @@ -0,0 +1,20 @@ +{% set blockchain = 'base' %} + +{{ + config( + schema = 'balancer_v2_base', + alias = 'bpt_supply_changes', + materialized = 'incremental', + file_format = 'delta', + incremental_strategy = 'merge', + unique_key = ['block_date', 'evt_tx_hash', 'evt_index', 'label'], + incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.evt_block_time')] + ) +}} + +{{ + bpt_supply_changes_macro( + blockchain = blockchain, + version = '2' + ) +}} \ No newline at end of file diff --git a/models/_project/balancer/bpt/base/balancer_v2_base_bpt_supply_changes_daily.sql b/models/_project/balancer/bpt/base/balancer_v2_base_bpt_supply_changes_daily.sql new file mode 100644 index 00000000000..b90fdf94033 --- /dev/null +++ b/models/_project/balancer/bpt/base/balancer_v2_base_bpt_supply_changes_daily.sql @@ -0,0 +1,17 @@ +{% set blockchain = 'base' %} + +{{ + config( + schema = 'balancer_v2_base', + alias = 'bpt_supply_changes_daily', + materialized = 'table', + file_format = 'delta' + ) +}} + +{{ + bpt_supply_changes_daily_agg_macro( + blockchain = blockchain, + version = '2' + ) +}} \ No newline at end of file diff --git a/models/balancer/base/balancer_v2_base_transfers_bpt.sql b/models/_project/balancer/bpt/base/balancer_v2_base_transfers_bpt.sql similarity index 100% rename from models/balancer/base/balancer_v2_base_transfers_bpt.sql rename to models/_project/balancer/bpt/base/balancer_v2_base_transfers_bpt.sql diff --git a/models/_project/balancer/bpt/ethereum/_schema.yml b/models/_project/balancer/bpt/ethereum/_schema.yml new file mode 100644 index 00000000000..aa54846a5f3 --- /dev/null +++ b/models/_project/balancer/bpt/ethereum/_schema.yml @@ -0,0 +1,178 @@ +version: 2 + +models: + - name: balancer_v2_ethereum_transfers_bpt + meta: + blockchain: ethereum + project: balancer_v2 + contributors: victorstefenon, thetroyharris, viniabussafi + config: + tags: ['ethereum', 'bpt', 'transfers'] + description: > + Balancer Pool Token (BPT) transfer logs on Balancer, an automated portfolio manager and trading platform, on ethereum. + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - evt_tx_hash + - evt_index + - block_date + columns: + - &blockchain + name: blockchain + description: "Blockchain" + - &version + name: version + description: "Version of Balancer where the liquidity pool used in transaction is deployed" + - &contract_address + name: contract_address + description: 'ethereum address for the liquidity pool used in transaction' + - &block_date + name: block_date + description: "UTC event block date of each DEX trade" + - &block_month + name: block_month + description: "UTC event block month of each DEX trade" + - &evt_tx_hash + name: evt_tx_hash + description: 'Transaction hash of transfer event' + - &evt_index + name: evt_index + description: 'Event index' + - &evt_block_time + name: evt_block_time + description: 'Block time of transfer event' + - &evt_block_number + name: evt_block_number + description: 'Block number of transfer event' + - &from + name: from + description: 'Address of BPT provider of transfer event' + - &to + name: to + description: 'Address of BPT receiver of transfer event' + - &value + name: value + description: 'Amount of BPT transferred in transfer event' + + - name: balancer_v2_ethereum_bpt_prices + meta: + blockchain: ethereum + project: balancer_v2 + contributors: victorstefenon, thetroyharris, viniabussafi + config: + tags: ['ethereum', 'bpt', 'prices'] + description: > + Balancer Pool Token (BPT) daily price by pool on Balancer, an automated portfolio manager and trading platform. + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - blockchain + - day + - contract_address + columns: + - *blockchain + - &day + name: day + description: "Block date in UTC" + - *version + - &decimals + name: decimals + description: "Token decimals. 18, by default, on BPTs" + - *contract_address + - &bpt_price + name: bpt_price + description: "Price of the BPT" + + - name: balancer_v2_ethereum_bpt_supply + meta: + blockchain: ethereum + project: balancer_v2 + contributors: thetroyharris, viniabussafi + config: + tags: ['ethereum', 'bpt', 'supply'] + description: > + Balancer Pool Token (BPT) supply by pool on Balancer, an automated portfolio manager and trading platform. + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - day + - blockchain + - token_address + columns: + - *day + - &pool_type + name: pool_type + description: "Pool attributes, determined by the pool's factory" + - *version + - *blockchain + - &token_address + name: token_address + description: "Contract address of the BPT" + - &supply + name: supply + description: "Supply of the BPT, discounted of premints" + + - name: balancer_v2_ethereum_bpt_supply_changes + meta: + blockchain: ethereum + project: balancer_v2 + contributors: viniabussafi + config: + tags: ['ethereum', 'bpt', 'supply', 'changes'] + description: > + Balancer Pool Token (BPT) supply change events. + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - block_date + - evt_tx_hash + - evt_index + - label + columns: + - *block_date + - *evt_block_time + - *evt_block_number + - *blockchain + - *evt_tx_hash + - *evt_index + - *pool_type + - &pool_symbol + name: pool_symbol + description: "Token symbols, followed by their respective weights, if applicable" + - *version + - &label + name: label + description: "Nature of the transaction (Join/Exit via swap or Mint/Burn via transfer)" + - *token_address + - &delta_amount_raw + name: delta_amount_raw + description: "Raw value of the transaction on token supply at the time of execution in the original currency" + - &delta_amount + name: delta_amount + description: "Normalized value of the transaction on token supply at the time of execution in the original currency" + + - name: balancer_v2_ethereum_bpt_supply_changes_daily + meta: + blockchain: ethereum + project: balancer_v2 + contributors: viniabussafi + config: + tags: ['ethereum', 'bpt', 'supply', 'changes'] + description: > + Balancer Pool Token (BPT) supply change events. grouped by day + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - block_date + - blockchain + - token_address + columns: + - *block_date + - *blockchain + - *pool_type + - *pool_symbol + - *version + - *token_address + - &daily_delta + name: daily_delta + description: "Daily total impact on BPT supply" \ No newline at end of file diff --git a/models/balancer/ethereum/balancer_v2_ethereum_bpt_prices.sql b/models/_project/balancer/bpt/ethereum/balancer_v2_ethereum_bpt_prices.sql similarity index 100% rename from models/balancer/ethereum/balancer_v2_ethereum_bpt_prices.sql rename to models/_project/balancer/bpt/ethereum/balancer_v2_ethereum_bpt_prices.sql diff --git a/models/balancer/ethereum/balancer_v2_ethereum_bpt_supply.sql b/models/_project/balancer/bpt/ethereum/balancer_v2_ethereum_bpt_supply.sql similarity index 100% rename from models/balancer/ethereum/balancer_v2_ethereum_bpt_supply.sql rename to models/_project/balancer/bpt/ethereum/balancer_v2_ethereum_bpt_supply.sql diff --git a/models/_project/balancer/bpt/ethereum/balancer_v2_ethereum_bpt_supply_changes.sql b/models/_project/balancer/bpt/ethereum/balancer_v2_ethereum_bpt_supply_changes.sql new file mode 100644 index 00000000000..1fa7db6b904 --- /dev/null +++ b/models/_project/balancer/bpt/ethereum/balancer_v2_ethereum_bpt_supply_changes.sql @@ -0,0 +1,20 @@ +{% set blockchain = 'ethereum' %} + +{{ + config( + schema = 'balancer_v2_ethereum', + alias = 'bpt_supply_changes', + materialized = 'incremental', + file_format = 'delta', + incremental_strategy = 'merge', + unique_key = ['block_date', 'evt_tx_hash', 'evt_index', 'label'], + incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.evt_block_time')] + ) +}} + +{{ + bpt_supply_changes_macro( + blockchain = blockchain, + version = '2' + ) +}} \ No newline at end of file diff --git a/models/_project/balancer/bpt/ethereum/balancer_v2_ethereum_bpt_supply_changes_daily.sql b/models/_project/balancer/bpt/ethereum/balancer_v2_ethereum_bpt_supply_changes_daily.sql new file mode 100644 index 00000000000..74d3be91fdf --- /dev/null +++ b/models/_project/balancer/bpt/ethereum/balancer_v2_ethereum_bpt_supply_changes_daily.sql @@ -0,0 +1,17 @@ +{% set blockchain = 'arbitrum' %} + +{{ + config( + schema = 'balancer_v2_arbitrum', + alias = 'bpt_supply_changes_daily', + materialized = 'table', + file_format = 'delta' + ) +}} + +{{ + bpt_supply_changes_daily_agg_macro( + blockchain = blockchain, + version = '2' + ) +}} \ No newline at end of file diff --git a/models/balancer/ethereum/balancer_v2_ethereum_transfers_bpt.sql b/models/_project/balancer/bpt/ethereum/balancer_v2_ethereum_transfers_bpt.sql similarity index 100% rename from models/balancer/ethereum/balancer_v2_ethereum_transfers_bpt.sql rename to models/_project/balancer/bpt/ethereum/balancer_v2_ethereum_transfers_bpt.sql diff --git a/models/_project/balancer/bpt/gnosis/_schema.yml b/models/_project/balancer/bpt/gnosis/_schema.yml new file mode 100644 index 00000000000..aae23d80a8a --- /dev/null +++ b/models/_project/balancer/bpt/gnosis/_schema.yml @@ -0,0 +1,178 @@ +version: 2 + +models: + - name: balancer_v2_gnosis_transfers_bpt + meta: + blockchain: gnosis + project: balancer_v2 + contributors: victorstefenon, thetroyharris, viniabussafi + config: + tags: ['gnosis', 'bpt', 'transfers'] + description: > + Balancer Pool Token (BPT) transfer logs on Balancer, an automated portfolio manager and trading platform, on gnosis. + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - evt_tx_hash + - evt_index + - block_date + columns: + - &blockchain + name: blockchain + description: "Blockchain" + - &version + name: version + description: "Version of Balancer where the liquidity pool used in transaction is deployed" + - &contract_address + name: contract_address + description: 'gnosis address for the liquidity pool used in transaction' + - &block_date + name: block_date + description: "UTC event block date of each DEX trade" + - &block_month + name: block_month + description: "UTC event block month of each DEX trade" + - &evt_tx_hash + name: evt_tx_hash + description: 'Transaction hash of transfer event' + - &evt_index + name: evt_index + description: 'Event index' + - &evt_block_time + name: evt_block_time + description: 'Block time of transfer event' + - &evt_block_number + name: evt_block_number + description: 'Block number of transfer event' + - &from + name: from + description: 'Address of BPT provider of transfer event' + - &to + name: to + description: 'Address of BPT receiver of transfer event' + - &value + name: value + description: 'Amount of BPT transferred in transfer event' + + - name: balancer_v2_gnosis_bpt_prices + meta: + blockchain: gnosis + project: balancer_v2 + contributors: victorstefenon, thetroyharris, viniabussafi + config: + tags: ['gnosis', 'bpt', 'prices'] + description: > + Balancer Pool Token (BPT) daily price by pool on Balancer, an automated portfolio manager and trading platform. + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - blockchain + - day + - contract_address + columns: + - *blockchain + - &day + name: day + description: "Block date in UTC" + - *version + - &decimals + name: decimals + description: "Token decimals. 18, by default, on BPTs" + - *contract_address + - &bpt_price + name: bpt_price + description: "Price of the BPT" + + - name: balancer_v2_gnosis_bpt_supply + meta: + blockchain: gnosis + project: balancer_v2 + contributors: thetroyharris, viniabussafi + config: + tags: ['gnosis', 'bpt', 'supply'] + description: > + Balancer Pool Token (BPT) supply by pool on Balancer, an automated portfolio manager and trading platform. + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - day + - blockchain + - token_address + columns: + - *day + - &pool_type + name: pool_type + description: "Pool attributes, determined by the pool's factory" + - *version + - *blockchain + - &token_address + name: token_address + description: "Contract address of the BPT" + - &supply + name: supply + description: "Supply of the BPT, discounted of premints" + + - name: balancer_v2_gnosis_bpt_supply_changes + meta: + blockchain: gnosis + project: balancer_v2 + contributors: viniabussafi + config: + tags: ['gnosis', 'bpt', 'supply', 'changes'] + description: > + Balancer Pool Token (BPT) supply change events. + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - block_date + - evt_tx_hash + - evt_index + - label + columns: + - *block_date + - *evt_block_time + - *evt_block_number + - *blockchain + - *evt_tx_hash + - *evt_index + - *pool_type + - &pool_symbol + name: pool_symbol + description: "Token symbols, followed by their respective weights, if applicable" + - *version + - &label + name: label + description: "Nature of the transaction (Join/Exit via swap or Mint/Burn via transfer)" + - *token_address + - &delta_amount_raw + name: delta_amount_raw + description: "Raw value of the transaction on token supply at the time of execution in the original currency" + - &delta_amount + name: delta_amount + description: "Normalized value of the transaction on token supply at the time of execution in the original currency" + + - name: balancer_v2_gnosis_bpt_supply_changes_daily + meta: + blockchain: gnosis + project: balancer_v2 + contributors: viniabussafi + config: + tags: ['gnosis', 'bpt', 'supply', 'changes'] + description: > + Balancer Pool Token (BPT) supply change events. grouped by day + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - block_date + - blockchain + - token_address + columns: + - *block_date + - *blockchain + - *pool_type + - *pool_symbol + - *version + - *token_address + - &daily_delta + name: daily_delta + description: "Daily total impact on BPT supply" \ No newline at end of file diff --git a/models/balancer/gnosis/balancer_v2_gnosis_bpt_prices.sql b/models/_project/balancer/bpt/gnosis/balancer_v2_gnosis_bpt_prices.sql similarity index 100% rename from models/balancer/gnosis/balancer_v2_gnosis_bpt_prices.sql rename to models/_project/balancer/bpt/gnosis/balancer_v2_gnosis_bpt_prices.sql diff --git a/models/balancer/gnosis/balancer_v2_gnosis_bpt_supply.sql b/models/_project/balancer/bpt/gnosis/balancer_v2_gnosis_bpt_supply.sql similarity index 100% rename from models/balancer/gnosis/balancer_v2_gnosis_bpt_supply.sql rename to models/_project/balancer/bpt/gnosis/balancer_v2_gnosis_bpt_supply.sql diff --git a/models/_project/balancer/bpt/gnosis/balancer_v2_gnosis_bpt_supply_changes.sql b/models/_project/balancer/bpt/gnosis/balancer_v2_gnosis_bpt_supply_changes.sql new file mode 100644 index 00000000000..fd1539a9495 --- /dev/null +++ b/models/_project/balancer/bpt/gnosis/balancer_v2_gnosis_bpt_supply_changes.sql @@ -0,0 +1,20 @@ +{% set blockchain = 'gnosis' %} + +{{ + config( + schema = 'balancer_v2_gnosis', + alias = 'bpt_supply_changes', + materialized = 'incremental', + file_format = 'delta', + incremental_strategy = 'merge', + unique_key = ['block_date', 'evt_tx_hash', 'evt_index', 'label'], + incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.evt_block_time')] + ) +}} + +{{ + bpt_supply_changes_macro( + blockchain = blockchain, + version = '2' + ) +}} \ No newline at end of file diff --git a/models/_project/balancer/bpt/gnosis/balancer_v2_gnosis_bpt_supply_changes_daily.sql b/models/_project/balancer/bpt/gnosis/balancer_v2_gnosis_bpt_supply_changes_daily.sql new file mode 100644 index 00000000000..516f2e2dc0c --- /dev/null +++ b/models/_project/balancer/bpt/gnosis/balancer_v2_gnosis_bpt_supply_changes_daily.sql @@ -0,0 +1,17 @@ +{% set blockchain = 'gnosis' %} + +{{ + config( + schema = 'balancer_v2_gnosis', + alias = 'bpt_supply_changes_daily', + materialized = 'table', + file_format = 'delta' + ) +}} + +{{ + bpt_supply_changes_daily_agg_macro( + blockchain = blockchain, + version = '2' + ) +}} \ No newline at end of file diff --git a/models/balancer/gnosis/balancer_v2_gnosis_transfers_bpt.sql b/models/_project/balancer/bpt/gnosis/balancer_v2_gnosis_transfers_bpt.sql similarity index 100% rename from models/balancer/gnosis/balancer_v2_gnosis_transfers_bpt.sql rename to models/_project/balancer/bpt/gnosis/balancer_v2_gnosis_transfers_bpt.sql diff --git a/models/_project/balancer/bpt/optimism/_schema.yml b/models/_project/balancer/bpt/optimism/_schema.yml new file mode 100644 index 00000000000..746fd32e9da --- /dev/null +++ b/models/_project/balancer/bpt/optimism/_schema.yml @@ -0,0 +1,178 @@ +version: 2 + +models: + - name: balancer_v2_optimism_transfers_bpt + meta: + blockchain: optimism + project: balancer_v2 + contributors: victorstefenon, thetroyharris, viniabussafi + config: + tags: ['optimism', 'bpt', 'transfers'] + description: > + Balancer Pool Token (BPT) transfer logs on Balancer, an automated portfolio manager and trading platform, on optimism. + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - evt_tx_hash + - evt_index + - block_date + columns: + - &blockchain + name: blockchain + description: "Blockchain" + - &version + name: version + description: "Version of Balancer where the liquidity pool used in transaction is deployed" + - &contract_address + name: contract_address + description: 'optimism address for the liquidity pool used in transaction' + - &block_date + name: block_date + description: "UTC event block date of each DEX trade" + - &block_month + name: block_month + description: "UTC event block month of each DEX trade" + - &evt_tx_hash + name: evt_tx_hash + description: 'Transaction hash of transfer event' + - &evt_index + name: evt_index + description: 'Event index' + - &evt_block_time + name: evt_block_time + description: 'Block time of transfer event' + - &evt_block_number + name: evt_block_number + description: 'Block number of transfer event' + - &from + name: from + description: 'Address of BPT provider of transfer event' + - &to + name: to + description: 'Address of BPT receiver of transfer event' + - &value + name: value + description: 'Amount of BPT transferred in transfer event' + + - name: balancer_v2_optimism_bpt_prices + meta: + blockchain: optimism + project: balancer_v2 + contributors: victorstefenon, thetroyharris, viniabussafi + config: + tags: ['optimism', 'bpt', 'prices'] + description: > + Balancer Pool Token (BPT) daily price by pool on Balancer, an automated portfolio manager and trading platform. + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - blockchain + - day + - contract_address + columns: + - *blockchain + - &day + name: day + description: "Block date in UTC" + - *version + - &decimals + name: decimals + description: "Token decimals. 18, by default, on BPTs" + - *contract_address + - &bpt_price + name: bpt_price + description: "Price of the BPT" + + - name: balancer_v2_optimism_bpt_supply + meta: + blockchain: optimism + project: balancer_v2 + contributors: thetroyharris, viniabussafi + config: + tags: ['optimism', 'bpt', 'supply'] + description: > + Balancer Pool Token (BPT) supply by pool on Balancer, an automated portfolio manager and trading platform. + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - day + - blockchain + - token_address + columns: + - *day + - &pool_type + name: pool_type + description: "Pool attributes, determined by the pool's factory" + - *version + - *blockchain + - &token_address + name: token_address + description: "Contract address of the BPT" + - &supply + name: supply + description: "Supply of the BPT, discounted of premints" + + - name: balancer_v2_optimism_bpt_supply_changes + meta: + blockchain: optimism + project: balancer_v2 + contributors: viniabussafi + config: + tags: ['optimism', 'bpt', 'supply', 'changes'] + description: > + Balancer Pool Token (BPT) supply change events. + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - block_date + - evt_tx_hash + - evt_index + - label + columns: + - *block_date + - *evt_block_time + - *evt_block_number + - *blockchain + - *evt_tx_hash + - *evt_index + - *pool_type + - &pool_symbol + name: pool_symbol + description: "Token symbols, followed by their respective weights, if applicable" + - *version + - &label + name: label + description: "Nature of the transaction (Join/Exit via swap or Mint/Burn via transfer)" + - *token_address + - &delta_amount_raw + name: delta_amount_raw + description: "Raw value of the transaction on token supply at the time of execution in the original currency" + - &delta_amount + name: delta_amount + description: "Normalized value of the transaction on token supply at the time of execution in the original currency" + + - name: balancer_v2_optimism_bpt_supply_changes_daily + meta: + blockchain: optimism + project: balancer_v2 + contributors: viniabussafi + config: + tags: ['optimism', 'bpt', 'supply', 'changes'] + description: > + Balancer Pool Token (BPT) supply change events. grouped by day + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - block_date + - blockchain + - token_address + columns: + - *block_date + - *blockchain + - *pool_type + - *pool_symbol + - *version + - *token_address + - &daily_delta + name: daily_delta + description: "Daily total impact on BPT supply" \ No newline at end of file diff --git a/models/balancer/optimism/balancer_v2_optimism_bpt_prices.sql b/models/_project/balancer/bpt/optimism/balancer_v2_optimism_bpt_prices.sql similarity index 100% rename from models/balancer/optimism/balancer_v2_optimism_bpt_prices.sql rename to models/_project/balancer/bpt/optimism/balancer_v2_optimism_bpt_prices.sql diff --git a/models/balancer/optimism/balancer_v2_optimism_bpt_supply.sql b/models/_project/balancer/bpt/optimism/balancer_v2_optimism_bpt_supply.sql similarity index 100% rename from models/balancer/optimism/balancer_v2_optimism_bpt_supply.sql rename to models/_project/balancer/bpt/optimism/balancer_v2_optimism_bpt_supply.sql diff --git a/models/_project/balancer/bpt/optimism/balancer_v2_optimism_bpt_supply_changes.sql b/models/_project/balancer/bpt/optimism/balancer_v2_optimism_bpt_supply_changes.sql new file mode 100644 index 00000000000..225b00465db --- /dev/null +++ b/models/_project/balancer/bpt/optimism/balancer_v2_optimism_bpt_supply_changes.sql @@ -0,0 +1,20 @@ +{% set blockchain = 'optimism' %} + +{{ + config( + schema = 'balancer_v2_optimism', + alias = 'bpt_supply_changes', + materialized = 'incremental', + file_format = 'delta', + incremental_strategy = 'merge', + unique_key = ['block_date', 'evt_tx_hash', 'evt_index', 'label'], + incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.evt_block_time')] + ) +}} + +{{ + bpt_supply_changes_macro( + blockchain = blockchain, + version = '2' + ) +}} \ No newline at end of file diff --git a/models/_project/balancer/bpt/optimism/balancer_v2_optimism_bpt_supply_changes_daily.sql b/models/_project/balancer/bpt/optimism/balancer_v2_optimism_bpt_supply_changes_daily.sql new file mode 100644 index 00000000000..f816df8d206 --- /dev/null +++ b/models/_project/balancer/bpt/optimism/balancer_v2_optimism_bpt_supply_changes_daily.sql @@ -0,0 +1,17 @@ +{% set blockchain = 'optimism' %} + +{{ + config( + schema = 'balancer_v2_optimism', + alias = 'bpt_supply_changes_daily', + materialized = 'table', + file_format = 'delta' + ) +}} + +{{ + bpt_supply_changes_daily_agg_macro( + blockchain = blockchain, + version = '2' + ) +}} \ No newline at end of file diff --git a/models/balancer/optimism/balancer_v2_optimism_transfers_bpt.sql b/models/_project/balancer/bpt/optimism/balancer_v2_optimism_transfers_bpt.sql similarity index 100% rename from models/balancer/optimism/balancer_v2_optimism_transfers_bpt.sql rename to models/_project/balancer/bpt/optimism/balancer_v2_optimism_transfers_bpt.sql diff --git a/models/_project/balancer/bpt/polygon/_schema.yml b/models/_project/balancer/bpt/polygon/_schema.yml new file mode 100644 index 00000000000..3e0b5c419f6 --- /dev/null +++ b/models/_project/balancer/bpt/polygon/_schema.yml @@ -0,0 +1,178 @@ +version: 2 + +models: + - name: balancer_v2_polygon_transfers_bpt + meta: + blockchain: polygon + project: balancer_v2 + contributors: victorstefenon, thetroyharris, viniabussafi + config: + tags: ['polygon', 'bpt', 'transfers'] + description: > + Balancer Pool Token (BPT) transfer logs on Balancer, an automated portfolio manager and trading platform, on polygon. + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - evt_tx_hash + - evt_index + - block_date + columns: + - &blockchain + name: blockchain + description: "Blockchain" + - &version + name: version + description: "Version of Balancer where the liquidity pool used in transaction is deployed" + - &contract_address + name: contract_address + description: 'polygon address for the liquidity pool used in transaction' + - &block_date + name: block_date + description: "UTC event block date of each DEX trade" + - &block_month + name: block_month + description: "UTC event block month of each DEX trade" + - &evt_tx_hash + name: evt_tx_hash + description: 'Transaction hash of transfer event' + - &evt_index + name: evt_index + description: 'Event index' + - &evt_block_time + name: evt_block_time + description: 'Block time of transfer event' + - &evt_block_number + name: evt_block_number + description: 'Block number of transfer event' + - &from + name: from + description: 'Address of BPT provider of transfer event' + - &to + name: to + description: 'Address of BPT receiver of transfer event' + - &value + name: value + description: 'Amount of BPT transferred in transfer event' + + - name: balancer_v2_polygon_bpt_prices + meta: + blockchain: polygon + project: balancer_v2 + contributors: victorstefenon, thetroyharris, viniabussafi + config: + tags: ['polygon', 'bpt', 'prices'] + description: > + Balancer Pool Token (BPT) daily price by pool on Balancer, an automated portfolio manager and trading platform. + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - blockchain + - day + - contract_address + columns: + - *blockchain + - &day + name: day + description: "Block date in UTC" + - *version + - &decimals + name: decimals + description: "Token decimals. 18, by default, on BPTs" + - *contract_address + - &bpt_price + name: bpt_price + description: "Price of the BPT" + + - name: balancer_v2_polygon_bpt_supply + meta: + blockchain: polygon + project: balancer_v2 + contributors: thetroyharris, viniabussafi + config: + tags: ['polygon', 'bpt', 'supply'] + description: > + Balancer Pool Token (BPT) supply by pool on Balancer, an automated portfolio manager and trading platform. + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - day + - blockchain + - token_address + columns: + - *day + - &pool_type + name: pool_type + description: "Pool attributes, determined by the pool's factory" + - *version + - *blockchain + - &token_address + name: token_address + description: "Contract address of the BPT" + - &supply + name: supply + description: "Supply of the BPT, discounted of premints" + + - name: balancer_v2_polygon_bpt_supply_changes + meta: + blockchain: polygon + project: balancer_v2 + contributors: viniabussafi + config: + tags: ['polygon', 'bpt', 'supply', 'changes'] + description: > + Balancer Pool Token (BPT) supply change events. + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - block_date + - evt_tx_hash + - evt_index + - label + columns: + - *block_date + - *evt_block_time + - *evt_block_number + - *blockchain + - *evt_tx_hash + - *evt_index + - *pool_type + - &pool_symbol + name: pool_symbol + description: "Token symbols, followed by their respective weights, if applicable" + - *version + - &label + name: label + description: "Nature of the transaction (Join/Exit via swap or Mint/Burn via transfer)" + - *token_address + - &delta_amount_raw + name: delta_amount_raw + description: "Raw value of the transaction on token supply at the time of execution in the original currency" + - &delta_amount + name: delta_amount + description: "Normalized value of the transaction on token supply at the time of execution in the original currency" + + - name: balancer_v2_polygon_bpt_supply_changes_daily + meta: + blockchain: polygon + project: balancer_v2 + contributors: viniabussafi + config: + tags: ['polygon', 'bpt', 'supply', 'changes'] + description: > + Balancer Pool Token (BPT) supply change events. grouped by day + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - block_date + - blockchain + - token_address + columns: + - *block_date + - *blockchain + - *pool_type + - *pool_symbol + - *version + - *token_address + - &daily_delta + name: daily_delta + description: "Daily total impact on BPT supply" \ No newline at end of file diff --git a/models/balancer/polygon/balancer_v2_polygon_bpt_prices.sql b/models/_project/balancer/bpt/polygon/balancer_v2_polygon_bpt_prices.sql similarity index 100% rename from models/balancer/polygon/balancer_v2_polygon_bpt_prices.sql rename to models/_project/balancer/bpt/polygon/balancer_v2_polygon_bpt_prices.sql diff --git a/models/balancer/polygon/balancer_v2_polygon_bpt_supply.sql b/models/_project/balancer/bpt/polygon/balancer_v2_polygon_bpt_supply.sql similarity index 100% rename from models/balancer/polygon/balancer_v2_polygon_bpt_supply.sql rename to models/_project/balancer/bpt/polygon/balancer_v2_polygon_bpt_supply.sql diff --git a/models/_project/balancer/bpt/polygon/balancer_v2_polygon_bpt_supply_changes.sql b/models/_project/balancer/bpt/polygon/balancer_v2_polygon_bpt_supply_changes.sql new file mode 100644 index 00000000000..7ff8034b96b --- /dev/null +++ b/models/_project/balancer/bpt/polygon/balancer_v2_polygon_bpt_supply_changes.sql @@ -0,0 +1,20 @@ +{% set blockchain = 'polygon' %} + +{{ + config( + schema = 'balancer_v2_polygon', + alias = 'bpt_supply_changes', + materialized = 'incremental', + file_format = 'delta', + incremental_strategy = 'merge', + unique_key = ['block_date', 'evt_tx_hash', 'evt_index', 'label'], + incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.evt_block_time')] + ) +}} + +{{ + bpt_supply_changes_macro( + blockchain = blockchain, + version = '2' + ) +}} \ No newline at end of file diff --git a/models/_project/balancer/bpt/polygon/balancer_v2_polygon_bpt_supply_changes_daily.sql b/models/_project/balancer/bpt/polygon/balancer_v2_polygon_bpt_supply_changes_daily.sql new file mode 100644 index 00000000000..57615beb139 --- /dev/null +++ b/models/_project/balancer/bpt/polygon/balancer_v2_polygon_bpt_supply_changes_daily.sql @@ -0,0 +1,17 @@ +{% set blockchain = 'polygon' %} + +{{ + config( + schema = 'balancer_v2_polygon', + alias = 'bpt_supply_changes_daily', + materialized = 'table', + file_format = 'delta' + ) +}} + +{{ + bpt_supply_changes_daily_agg_macro( + blockchain = blockchain, + version = '2' + ) +}} \ No newline at end of file diff --git a/models/balancer/polygon/balancer_v2_polygon_transfers_bpt.sql b/models/_project/balancer/bpt/polygon/balancer_v2_polygon_transfers_bpt.sql similarity index 100% rename from models/balancer/polygon/balancer_v2_polygon_transfers_bpt.sql rename to models/_project/balancer/bpt/polygon/balancer_v2_polygon_transfers_bpt.sql diff --git a/models/_project/balancer/bpt/zkevm/_schema.yml b/models/_project/balancer/bpt/zkevm/_schema.yml new file mode 100644 index 00000000000..fbdd80ddb56 --- /dev/null +++ b/models/_project/balancer/bpt/zkevm/_schema.yml @@ -0,0 +1,178 @@ +version: 2 + +models: + - name: balancer_v2_zkevm_transfers_bpt + meta: + blockchain: zkevm + project: balancer_v2 + contributors: victorstefenon, thetroyharris, viniabussafi + config: + tags: ['zkevm', 'bpt', 'transfers'] + description: > + Balancer Pool Token (BPT) transfer logs on Balancer, an automated portfolio manager and trading platform, on zkevm. + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - evt_tx_hash + - evt_index + - block_date + columns: + - &blockchain + name: blockchain + description: "Blockchain" + - &version + name: version + description: "Version of Balancer where the liquidity pool used in transaction is deployed" + - &contract_address + name: contract_address + description: 'zkevm address for the liquidity pool used in transaction' + - &block_date + name: block_date + description: "UTC event block date of each DEX trade" + - &block_month + name: block_month + description: "UTC event block month of each DEX trade" + - &evt_tx_hash + name: evt_tx_hash + description: 'Transaction hash of transfer event' + - &evt_index + name: evt_index + description: 'Event index' + - &evt_block_time + name: evt_block_time + description: 'Block time of transfer event' + - &evt_block_number + name: evt_block_number + description: 'Block number of transfer event' + - &from + name: from + description: 'Address of BPT provider of transfer event' + - &to + name: to + description: 'Address of BPT receiver of transfer event' + - &value + name: value + description: 'Amount of BPT transferred in transfer event' + + - name: balancer_v2_zkevm_bpt_prices + meta: + blockchain: zkevm + project: balancer_v2 + contributors: victorstefenon, thetroyharris, viniabussafi + config: + tags: ['zkevm', 'bpt', 'prices'] + description: > + Balancer Pool Token (BPT) daily price by pool on Balancer, an automated portfolio manager and trading platform. + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - blockchain + - day + - contract_address + columns: + - *blockchain + - &day + name: day + description: "Block date in UTC" + - *version + - &decimals + name: decimals + description: "Token decimals. 18, by default, on BPTs" + - *contract_address + - &bpt_price + name: bpt_price + description: "Price of the BPT" + + - name: balancer_v2_zkevm_bpt_supply + meta: + blockchain: zkevm + project: balancer_v2 + contributors: thetroyharris, viniabussafi + config: + tags: ['zkevm', 'bpt', 'supply'] + description: > + Balancer Pool Token (BPT) supply by pool on Balancer, an automated portfolio manager and trading platform. + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - day + - blockchain + - token_address + columns: + - *day + - &pool_type + name: pool_type + description: "Pool attributes, determined by the pool's factory" + - *version + - *blockchain + - &token_address + name: token_address + description: "Contract address of the BPT" + - &supply + name: supply + description: "Supply of the BPT, discounted of premints" + + - name: balancer_v2_zkevm_bpt_supply_changes + meta: + blockchain: zkevm + project: balancer_v2 + contributors: viniabussafi + config: + tags: ['zkevm', 'bpt', 'supply', 'changes'] + description: > + Balancer Pool Token (BPT) supply change events. + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - block_date + - evt_tx_hash + - evt_index + - label + columns: + - *block_date + - *evt_block_time + - *evt_block_number + - *blockchain + - *evt_tx_hash + - *evt_index + - *pool_type + - &pool_symbol + name: pool_symbol + description: "Token symbols, followed by their respective weights, if applicable" + - *version + - &label + name: label + description: "Nature of the transaction (Join/Exit via swap or Mint/Burn via transfer)" + - *token_address + - &delta_amount_raw + name: delta_amount_raw + description: "Raw value of the transaction on token supply at the time of execution in the original currency" + - &delta_amount + name: delta_amount + description: "Normalized value of the transaction on token supply at the time of execution in the original currency" + + - name: balancer_v2_zkevm_bpt_supply_changes_daily + meta: + blockchain: zkevm + project: balancer_v2 + contributors: viniabussafi + config: + tags: ['zkevm', 'bpt', 'supply', 'changes'] + description: > + Balancer Pool Token (BPT) supply change events. grouped by day + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - block_date + - blockchain + - token_address + columns: + - *block_date + - *blockchain + - *pool_type + - *pool_symbol + - *version + - *token_address + - &daily_delta + name: daily_delta + description: "Daily total impact on BPT supply" \ No newline at end of file diff --git a/models/balancer/zkevm/balancer_v2_zkevm_bpt_prices.sql b/models/_project/balancer/bpt/zkevm/balancer_v2_zkevm_bpt_prices.sql similarity index 100% rename from models/balancer/zkevm/balancer_v2_zkevm_bpt_prices.sql rename to models/_project/balancer/bpt/zkevm/balancer_v2_zkevm_bpt_prices.sql diff --git a/models/balancer/zkevm/balancer_v2_zkevm_bpt_supply.sql b/models/_project/balancer/bpt/zkevm/balancer_v2_zkevm_bpt_supply.sql similarity index 100% rename from models/balancer/zkevm/balancer_v2_zkevm_bpt_supply.sql rename to models/_project/balancer/bpt/zkevm/balancer_v2_zkevm_bpt_supply.sql diff --git a/models/_project/balancer/bpt/zkevm/balancer_v2_zkevm_bpt_supply_changes.sql b/models/_project/balancer/bpt/zkevm/balancer_v2_zkevm_bpt_supply_changes.sql new file mode 100644 index 00000000000..f11227e4013 --- /dev/null +++ b/models/_project/balancer/bpt/zkevm/balancer_v2_zkevm_bpt_supply_changes.sql @@ -0,0 +1,20 @@ +{% set blockchain = 'zkevm' %} + +{{ + config( + schema = 'balancer_v2_zkevm', + alias = 'bpt_supply_changes', + materialized = 'incremental', + file_format = 'delta', + incremental_strategy = 'merge', + unique_key = ['block_date', 'evt_tx_hash', 'evt_index', 'label'], + incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.evt_block_time')] + ) +}} + +{{ + bpt_supply_changes_macro( + blockchain = blockchain, + version = '2' + ) +}} \ No newline at end of file diff --git a/models/_project/balancer/bpt/zkevm/balancer_v2_zkevm_bpt_supply_changes_daily.sql b/models/_project/balancer/bpt/zkevm/balancer_v2_zkevm_bpt_supply_changes_daily.sql new file mode 100644 index 00000000000..4e548f4bcf7 --- /dev/null +++ b/models/_project/balancer/bpt/zkevm/balancer_v2_zkevm_bpt_supply_changes_daily.sql @@ -0,0 +1,17 @@ +{% set blockchain = 'zkevm' %} + +{{ + config( + schema = 'balancer_v2_zkevm', + alias = 'bpt_supply_changes_daily', + materialized = 'table', + file_format = 'delta' + ) +}} + +{{ + bpt_supply_changes_daily_agg_macro( + blockchain = blockchain, + version = '2' + ) +}} \ No newline at end of file diff --git a/models/balancer/zkevm/balancer_v2_zkevm_transfers_bpt.sql b/models/_project/balancer/bpt/zkevm/balancer_v2_zkevm_transfers_bpt.sql similarity index 100% rename from models/balancer/zkevm/balancer_v2_zkevm_transfers_bpt.sql rename to models/_project/balancer/bpt/zkevm/balancer_v2_zkevm_transfers_bpt.sql diff --git a/models/_project/balancer/flashloans/_schema.yml b/models/_project/balancer/flashloans/_schema.yml new file mode 100644 index 00000000000..948574c1ad6 --- /dev/null +++ b/models/_project/balancer/flashloans/_schema.yml @@ -0,0 +1,35 @@ +version: 2 + +models: + - name: balancer_flashloans + meta: + blockchain: arbitrum, avalanche_c, base, ethereum, gnosis, optimism, polygon, zkevm + sector: lending + contributors: hildobby, viniabussafi + config: + tags: ['ethereum', 'arbitrum', 'optimism', 'polygon', 'gnosis','avalanche_c', 'base', 'zkevm', 'flashloans'] + description: > + All Balancer flashloans + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - blockchain + - tx_hash + - evt_index + columns: + - name: blockchain + - name: project + - name: version + - name: block_time + - name: block_month + - name: block_number + - name: amount + - name: amount_usd + - name: tx_hash + - name: evt_index + - name: fee + - name: currency_contract + - name: currency_symbol + - name: recipient + - name: contract_address + \ No newline at end of file diff --git a/models/_project/balancer/flashloans/arbitrum/_schema.yml b/models/_project/balancer/flashloans/arbitrum/_schema.yml new file mode 100644 index 00000000000..562e948bde1 --- /dev/null +++ b/models/_project/balancer/flashloans/arbitrum/_schema.yml @@ -0,0 +1,36 @@ +version: 2 + +models: + - name: balancer_v2_arbitrum_flashloans + meta: + blockchain: arbitrum + sector: lending + contributors: hildobby, viniabussafi + config: + tags: ['arbitrum', 'flashloans'] + description: > + All Balancer v2 flashloans on Arbitrum + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - blockchain + - tx_hash + - evt_index + columns: + - name: blockchain + - name: project + - name: version + - name: block_time + - name: block_number + - name: amount + - name: amount_usd + - &tx_hash + name: tx_hash + description: "Tx. Hash" + - name: evt_index + - name: fee + - name: currency_contract + - name: currency_symbol + - name: recipient + - name: contract_address + - name: block_month \ No newline at end of file diff --git a/models/balancer/arbitrum/balancer_v2_arbitrum_flashloans.sql b/models/_project/balancer/flashloans/arbitrum/balancer_v2_arbitrum_flashloans.sql similarity index 88% rename from models/balancer/arbitrum/balancer_v2_arbitrum_flashloans.sql rename to models/_project/balancer/flashloans/arbitrum/balancer_v2_arbitrum_flashloans.sql index 52ec11d81ee..bf21ac0ece7 100644 --- a/models/balancer/arbitrum/balancer_v2_arbitrum_flashloans.sql +++ b/models/_project/balancer/flashloans/arbitrum/balancer_v2_arbitrum_flashloans.sql @@ -6,10 +6,6 @@ , file_format = 'delta' , incremental_strategy = 'merge' , unique_key = ['tx_hash', 'evt_index'] - , post_hook='{{ expose_spells(\'["arbitrum"]\', - "project", - "balancer_v2", - \'["hildobby"]\') }}' ) }} diff --git a/models/_project/balancer/flashloans/avalanche_c/_schema.yml b/models/_project/balancer/flashloans/avalanche_c/_schema.yml new file mode 100644 index 00000000000..6a0a0a719f3 --- /dev/null +++ b/models/_project/balancer/flashloans/avalanche_c/_schema.yml @@ -0,0 +1,36 @@ +version: 2 + +models: + - name: balancer_v2_avalanche_c_flashloans + meta: + blockchain: avalanche_c + sector: lending + contributors: hildobby, viniabussafi + config: + tags: ['avalanche_c', 'flashloans'] + description: > + All Balancer v2 flashloans on avalanche_c + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - blockchain + - tx_hash + - evt_index + columns: + - name: blockchain + - name: project + - name: version + - name: block_time + - name: block_number + - name: amount + - name: amount_usd + - &tx_hash + name: tx_hash + description: "Tx. Hash" + - name: evt_index + - name: fee + - name: currency_contract + - name: currency_symbol + - name: recipient + - name: contract_address + - name: block_month \ No newline at end of file diff --git a/models/balancer/avalanche_c/balancer_v2_avalanche_c_flashloans.sql b/models/_project/balancer/flashloans/avalanche_c/balancer_v2_avalanche_c_flashloans.sql similarity index 88% rename from models/balancer/avalanche_c/balancer_v2_avalanche_c_flashloans.sql rename to models/_project/balancer/flashloans/avalanche_c/balancer_v2_avalanche_c_flashloans.sql index eca6b3b0809..d4ec0d2e79d 100644 --- a/models/balancer/avalanche_c/balancer_v2_avalanche_c_flashloans.sql +++ b/models/_project/balancer/flashloans/avalanche_c/balancer_v2_avalanche_c_flashloans.sql @@ -6,10 +6,6 @@ , file_format = 'delta' , incremental_strategy = 'merge' , unique_key = ['tx_hash', 'evt_index'] - , post_hook='{{ expose_spells(\'["avalanche_c"]\', - "project", - "balancer_v2", - \'["hildobby", "viniabussafi"]\') }}' ) }} diff --git a/models/balancer/balancer_flashloans.sql b/models/_project/balancer/flashloans/balancer_flashloans.sql similarity index 69% rename from models/balancer/balancer_flashloans.sql rename to models/_project/balancer/flashloans/balancer_flashloans.sql index bf79fcbf7f9..19f69ad6231 100644 --- a/models/balancer/balancer_flashloans.sql +++ b/models/_project/balancer/flashloans/balancer_flashloans.sql @@ -1,10 +1,10 @@ {{ config( - + schema = 'balancer', alias = 'flashloans', - post_hook='{{ expose_spells(\'["ethereum","arbitrum", "optimism", "polygon", "gnosis", "avalanche_c", "base", "zkevm"]\', - "project", - "balancer", - \'["hildobby", "viniabussafi"]\') }}' + post_hook='{{ expose_spells(blockchains = \'["arbitrum", "avalanche_c", "base", "ethereum", "gnosis", "optimism", "polygon", "zkevm"]\', + spell_type = "project", + spell_name = "balancer", + contributors = \'["hildobby", "viniabussafi"]\') }}' ) }} @@ -19,7 +19,6 @@ ref('balancer_v2_ethereum_flashloans') , ref('balancer_v2_zkevm_flashloans') ] %} - SELECT * FROM ( {% for flash_model in balancer_models %} diff --git a/models/_project/balancer/flashloans/base/_schema.yml b/models/_project/balancer/flashloans/base/_schema.yml new file mode 100644 index 00000000000..3664ca0dbb5 --- /dev/null +++ b/models/_project/balancer/flashloans/base/_schema.yml @@ -0,0 +1,36 @@ +version: 2 + +models: + - name: balancer_v2_base_flashloans + meta: + blockchain: base + sector: lending + contributors: hildobby, viniabussafi + config: + tags: ['base', 'flashloans'] + description: > + All Balancer v2 flashloans on base + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - blockchain + - tx_hash + - evt_index + columns: + - name: blockchain + - name: project + - name: version + - name: block_time + - name: block_number + - name: amount + - name: amount_usd + - &tx_hash + name: tx_hash + description: "Tx. Hash" + - name: evt_index + - name: fee + - name: currency_contract + - name: currency_symbol + - name: recipient + - name: contract_address + - name: block_month \ No newline at end of file diff --git a/models/balancer/base/balancer_v2_base_flashloans.sql b/models/_project/balancer/flashloans/base/balancer_v2_base_flashloans.sql similarity index 88% rename from models/balancer/base/balancer_v2_base_flashloans.sql rename to models/_project/balancer/flashloans/base/balancer_v2_base_flashloans.sql index 9438b88cf9c..da8cb9d2ae1 100644 --- a/models/balancer/base/balancer_v2_base_flashloans.sql +++ b/models/_project/balancer/flashloans/base/balancer_v2_base_flashloans.sql @@ -6,10 +6,6 @@ , file_format = 'delta' , incremental_strategy = 'merge' , unique_key = ['tx_hash', 'evt_index'] - , post_hook='{{ expose_spells(\'["base"]\', - "project", - "balancer_v2", - \'["hildobby", "viniabussafi"]\') }}' ) }} diff --git a/models/_project/balancer/flashloans/ethereum/_schema.yml b/models/_project/balancer/flashloans/ethereum/_schema.yml new file mode 100644 index 00000000000..48e15def9f8 --- /dev/null +++ b/models/_project/balancer/flashloans/ethereum/_schema.yml @@ -0,0 +1,36 @@ +version: 2 + +models: + - name: balancer_v2_ethereum_flashloans + meta: + blockchain: ethereum + sector: lending + contributors: hildobby, viniabussafi + config: + tags: ['ethereum', 'flashloans'] + description: > + All Balancer v2 flashloans on ethereum + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - blockchain + - tx_hash + - evt_index + columns: + - name: blockchain + - name: project + - name: version + - name: block_time + - name: block_number + - name: amount + - name: amount_usd + - &tx_hash + name: tx_hash + description: "Tx. Hash" + - name: evt_index + - name: fee + - name: currency_contract + - name: currency_symbol + - name: recipient + - name: contract_address + - name: block_month \ No newline at end of file diff --git a/models/balancer/ethereum/balancer_v2_ethereum_flashloans.sql b/models/_project/balancer/flashloans/ethereum/balancer_v2_ethereum_flashloans.sql similarity index 88% rename from models/balancer/ethereum/balancer_v2_ethereum_flashloans.sql rename to models/_project/balancer/flashloans/ethereum/balancer_v2_ethereum_flashloans.sql index cdbd54e0a7c..652ad476e88 100644 --- a/models/balancer/ethereum/balancer_v2_ethereum_flashloans.sql +++ b/models/_project/balancer/flashloans/ethereum/balancer_v2_ethereum_flashloans.sql @@ -6,10 +6,6 @@ , file_format = 'delta' , incremental_strategy = 'merge' , unique_key = ['tx_hash', 'evt_index'] - , post_hook='{{ expose_spells(\'["ethereum"]\', - "project", - "balancer_v2", - \'["hildobby"]\') }}' ) }} diff --git a/models/_project/balancer/flashloans/gnosis/_schema.yml b/models/_project/balancer/flashloans/gnosis/_schema.yml new file mode 100644 index 00000000000..a7db5e36011 --- /dev/null +++ b/models/_project/balancer/flashloans/gnosis/_schema.yml @@ -0,0 +1,36 @@ +version: 2 + +models: + - name: balancer_v2_gnosis_flashloans + meta: + blockchain: gnosis + sector: lending + contributors: hildobby, viniabussafi + config: + tags: ['gnosis', 'flashloans'] + description: > + All Balancer v2 flashloans on gnosis + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - blockchain + - tx_hash + - evt_index + columns: + - name: blockchain + - name: project + - name: version + - name: block_time + - name: block_number + - name: amount + - name: amount_usd + - &tx_hash + name: tx_hash + description: "Tx. Hash" + - name: evt_index + - name: fee + - name: currency_contract + - name: currency_symbol + - name: recipient + - name: contract_address + - name: block_month \ No newline at end of file diff --git a/models/balancer/gnosis/balancer_v2_gnosis_flashloans.sql b/models/_project/balancer/flashloans/gnosis/balancer_v2_gnosis_flashloans.sql similarity index 88% rename from models/balancer/gnosis/balancer_v2_gnosis_flashloans.sql rename to models/_project/balancer/flashloans/gnosis/balancer_v2_gnosis_flashloans.sql index 7a4dd71de65..f8d11b83452 100644 --- a/models/balancer/gnosis/balancer_v2_gnosis_flashloans.sql +++ b/models/_project/balancer/flashloans/gnosis/balancer_v2_gnosis_flashloans.sql @@ -6,10 +6,6 @@ , file_format = 'delta' , incremental_strategy = 'merge' , unique_key = ['tx_hash', 'evt_index'] - , post_hook='{{ expose_spells(\'["gnosis"]\', - "project", - "balancer_v2", - \'["hildobby"]\') }}' ) }} diff --git a/models/_project/balancer/flashloans/optimism/_schema.yml b/models/_project/balancer/flashloans/optimism/_schema.yml new file mode 100644 index 00000000000..64a96dc514f --- /dev/null +++ b/models/_project/balancer/flashloans/optimism/_schema.yml @@ -0,0 +1,36 @@ +version: 2 + +models: + - name: balancer_v2_optimism_flashloans + meta: + blockchain: optimism + sector: lending + contributors: hildobby, viniabussafi + config: + tags: ['optimism', 'flashloans'] + description: > + All Balancer v2 flashloans on optimism + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - blockchain + - tx_hash + - evt_index + columns: + - name: blockchain + - name: project + - name: version + - name: block_time + - name: block_number + - name: amount + - name: amount_usd + - &tx_hash + name: tx_hash + description: "Tx. Hash" + - name: evt_index + - name: fee + - name: currency_contract + - name: currency_symbol + - name: recipient + - name: contract_address + - name: block_month \ No newline at end of file diff --git a/models/balancer/optimism/balancer_v2_optimism_flashloans.sql b/models/_project/balancer/flashloans/optimism/balancer_v2_optimism_flashloans.sql similarity index 88% rename from models/balancer/optimism/balancer_v2_optimism_flashloans.sql rename to models/_project/balancer/flashloans/optimism/balancer_v2_optimism_flashloans.sql index 9908e24f7b3..c7036fcc2ac 100644 --- a/models/balancer/optimism/balancer_v2_optimism_flashloans.sql +++ b/models/_project/balancer/flashloans/optimism/balancer_v2_optimism_flashloans.sql @@ -6,10 +6,6 @@ , file_format = 'delta' , incremental_strategy = 'merge' , unique_key = ['tx_hash', 'evt_index'] - , post_hook='{{ expose_spells(\'["optimism"]\', - "project", - "balancer_v2", - \'["hildobby"]\') }}' ) }} diff --git a/models/_project/balancer/flashloans/polygon/_schema.yml b/models/_project/balancer/flashloans/polygon/_schema.yml new file mode 100644 index 00000000000..305a7252c6c --- /dev/null +++ b/models/_project/balancer/flashloans/polygon/_schema.yml @@ -0,0 +1,36 @@ +version: 2 + +models: + - name: balancer_v2_polygon_flashloans + meta: + blockchain: polygon + sector: lending + contributors: hildobby, viniabussafi + config: + tags: ['polygon', 'flashloans'] + description: > + All Balancer v2 flashloans on polygon + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - blockchain + - tx_hash + - evt_index + columns: + - name: blockchain + - name: project + - name: version + - name: block_time + - name: block_number + - name: amount + - name: amount_usd + - &tx_hash + name: tx_hash + description: "Tx. Hash" + - name: evt_index + - name: fee + - name: currency_contract + - name: currency_symbol + - name: recipient + - name: contract_address + - name: block_month \ No newline at end of file diff --git a/models/balancer/polygon/balancer_v2_polygon_flashloans.sql b/models/_project/balancer/flashloans/polygon/balancer_v2_polygon_flashloans.sql similarity index 88% rename from models/balancer/polygon/balancer_v2_polygon_flashloans.sql rename to models/_project/balancer/flashloans/polygon/balancer_v2_polygon_flashloans.sql index 0f0cb1d9982..392c3866d89 100644 --- a/models/balancer/polygon/balancer_v2_polygon_flashloans.sql +++ b/models/_project/balancer/flashloans/polygon/balancer_v2_polygon_flashloans.sql @@ -6,10 +6,6 @@ , file_format = 'delta' , incremental_strategy = 'merge' , unique_key = ['tx_hash', 'evt_index'] - , post_hook='{{ expose_spells(\'["polygon"]\', - "project", - "balancer_v2", - \'["hildobby"]\') }}' ) }} diff --git a/models/_project/balancer/flashloans/zkevm/_schema.yml b/models/_project/balancer/flashloans/zkevm/_schema.yml new file mode 100644 index 00000000000..feb6c20d41b --- /dev/null +++ b/models/_project/balancer/flashloans/zkevm/_schema.yml @@ -0,0 +1,36 @@ +version: 2 + +models: + - name: balancer_v2_zkevm_flashloans + meta: + blockchain: zkevm + sector: lending + contributors: hildobby, viniabussafi + config: + tags: ['zkevm', 'flashloans'] + description: > + All Balancer v2 flashloans on zkevm + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - blockchain + - tx_hash + - evt_index + columns: + - name: blockchain + - name: project + - name: version + - name: block_time + - name: block_number + - name: amount + - name: amount_usd + - &tx_hash + name: tx_hash + description: "Tx. Hash" + - name: evt_index + - name: fee + - name: currency_contract + - name: currency_symbol + - name: recipient + - name: contract_address + - name: block_month \ No newline at end of file diff --git a/models/balancer/zkevm/balancer_v2_zkevm_flashloans.sql b/models/_project/balancer/flashloans/zkevm/balancer_v2_zkevm_flashloans.sql similarity index 88% rename from models/balancer/zkevm/balancer_v2_zkevm_flashloans.sql rename to models/_project/balancer/flashloans/zkevm/balancer_v2_zkevm_flashloans.sql index a11355919f7..3e1d9d1a6f5 100644 --- a/models/balancer/zkevm/balancer_v2_zkevm_flashloans.sql +++ b/models/_project/balancer/flashloans/zkevm/balancer_v2_zkevm_flashloans.sql @@ -6,10 +6,6 @@ , file_format = 'delta' , incremental_strategy = 'merge' , unique_key = ['tx_hash', 'evt_index'] - , post_hook='{{ expose_spells(\'["zkevm"]\', - "project", - "balancer_v2", - \'["hildobby", "viniabussafi"]\') }}' ) }} diff --git a/models/_project/balancer/liquidity/_schema.yml b/models/_project/balancer/liquidity/_schema.yml new file mode 100644 index 00000000000..b014ad151e4 --- /dev/null +++ b/models/_project/balancer/liquidity/_schema.yml @@ -0,0 +1,60 @@ +version: 2 + +models: + - name: balancer_liquidity + meta: + blockchain: arbitrum, avalanche_c, base, ethereum, gnosis, optimism, polygon, zkevm + project: balancer + contributors: viniabussafi + config: + tags: ['balancer', 'amm', 'dex', 'liquidity', 'ethereum', 'arbitrum', 'optimism', 'polygon', 'avalanche_c', 'base', 'zkevm'] + description: > + Liquidity by token on Balancer, an automated portfolio manager and trading platform. + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - day + - pool_id + - blockchain + - token_address + - token_symbol + columns: + - &day + name: day + description: "Block date in UTC" + - &pool_id + name: pool_id + description: "Unique encoded identifier that refers to each pool" + - &pool_address + name: pool_address + description: "Pool address" + - &pool_symbol + name: pool_symbol + description: "Token symbols, followed by their respective weights, if applicable" + - &version + name: version + description: "Version of the project" + - &blockchain + name: blockchain + description: "Blockchain" + - &pool_type + name: pool_type + description: "Pool attributes, determined by the pool's factory" + - &token_address + name: token_address + description: "Contract address of the token" + - &token_symbol + name: token_symbol + description: "Token symbol" + - name: token_balance_raw + description: 'Raw balance of the token in the pool in the original currency' + - name: token_balance + description: 'Scaled balance of the token in the pool in the original currency' + - name: protocol_liquidity_usd + description: 'Liquidity of the token in the pool in USD, except BPTs' + - name: protocol_liquidity_eth + description: 'Liquidity of the token in the pool in ETH, except BPTs' + - name: pool_liquidity_usd + description: 'Liquidity of the token in the pool in USD, including BPTs' + - name: pool_liquidity_eth + description: 'Liquidity of the token in the pool in ETH, including BPTs' \ No newline at end of file diff --git a/models/_project/balancer/liquidity/arbitrum/_schema.yml b/models/_project/balancer/liquidity/arbitrum/_schema.yml new file mode 100644 index 00000000000..ca88eb050b8 --- /dev/null +++ b/models/_project/balancer/liquidity/arbitrum/_schema.yml @@ -0,0 +1,58 @@ +version: 2 + +models: + - name: balancer_v2_arbitrum_liquidity + meta: + blockchain: arbitrum + project: balancer_v2 + contributors: victorstefenon, viniabussafi, thetroyharris + config: + tags: ['arbitrum', 'balancer', 'pools', 'liquidity'] + description: > + Balancer v2 pools liquidity by token in Arbitrum. + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - day + - pool_id + - token_address + columns: + - &day + name: day + description: "Block date in UTC" + - &pool_id + name: pool_id + description: "Unique encoded identifier that refers to each pool" + - &pool_address + name: pool_address + description: "Pool address" + - &pool_symbol + name: pool_symbol + description: "Token symbols, followed by their respective weights, if applicable" + - &version + name: version + description: "Version of the project" + - &blockchain + name: blockchain + description: "Blockchain" + - &pool_type + name: pool_type + description: "Pool attributes, determined by the pool's factory" + - &token_address + name: token_address + description: "Contract address of the token" + - &token_symbol + name: token_symbol + description: "Token symbol" + - name: token_balance_raw + description: 'Raw balance of the token in the pool in the original currency' + - name: token_balance + description: 'Scaled balance of the token in the pool in the original currency' + - name: protocol_liquidity_usd + description: 'Liquidity of the token in the pool in USD, except BPTs' + - name: protocol_liquidity_eth + description: 'Liquidity of the token in the pool in ETH, except BPTs' + - name: pool_liquidity_usd + description: 'Liquidity of the token in the pool in USD, including BPTs' + - name: pool_liquidity_eth + description: 'Liquidity of the token in the pool in ETH, including BPTs' \ No newline at end of file diff --git a/models/balancer/arbitrum/balancer_v2_arbitrum_liquidity.sql b/models/_project/balancer/liquidity/arbitrum/balancer_v2_arbitrum_liquidity.sql similarity index 52% rename from models/balancer/arbitrum/balancer_v2_arbitrum_liquidity.sql rename to models/_project/balancer/liquidity/arbitrum/balancer_v2_arbitrum_liquidity.sql index c78ddea2ad7..c32f49c73ac 100644 --- a/models/balancer/arbitrum/balancer_v2_arbitrum_liquidity.sql +++ b/models/_project/balancer/liquidity/arbitrum/balancer_v2_arbitrum_liquidity.sql @@ -6,11 +6,7 @@ schema = 'balancer_v2_arbitrum', alias = 'liquidity', materialized = 'table', - file_format = 'delta', - post_hook="{{ expose_spells('[\"" + blockchain + '"]' + '\', - "project", - "balancer_v2", - \'["stefenon", "viniabussafi"]\') }}' + file_format = 'delta' ) }} diff --git a/models/_project/balancer/liquidity/avalanche_c/_schema.yml b/models/_project/balancer/liquidity/avalanche_c/_schema.yml new file mode 100644 index 00000000000..cd5e9580b08 --- /dev/null +++ b/models/_project/balancer/liquidity/avalanche_c/_schema.yml @@ -0,0 +1,58 @@ +version: 2 + +models: + - name: balancer_v2_avalanche_c_liquidity + meta: + blockchain: avalanche_c + project: balancer_v2 + contributors: victorstefenon, viniabussafi, thetroyharris + config: + tags: ['avalanche_c', 'balancer', 'pools', 'liquidity'] + description: > + Balancer v2 pools liquidity by token in Arbitrum. + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - day + - pool_id + - token_address + columns: + - &day + name: day + description: "Block date in UTC" + - &pool_id + name: pool_id + description: "Unique encoded identifier that refers to each pool" + - &pool_address + name: pool_address + description: "Pool address" + - &pool_symbol + name: pool_symbol + description: "Token symbols, followed by their respective weights, if applicable" + - &version + name: version + description: "Version of the project" + - &blockchain + name: blockchain + description: "Blockchain" + - &pool_type + name: pool_type + description: "Pool attributes, determined by the pool's factory" + - &token_address + name: token_address + description: "Contract address of the token" + - &token_symbol + name: token_symbol + description: "Token symbol" + - name: token_balance_raw + description: 'Raw balance of the token in the pool in the original currency' + - name: token_balance + description: 'Scaled balance of the token in the pool in the original currency' + - name: protocol_liquidity_usd + description: 'Liquidity of the token in the pool in USD, except BPTs' + - name: protocol_liquidity_eth + description: 'Liquidity of the token in the pool in ETH, except BPTs' + - name: pool_liquidity_usd + description: 'Liquidity of the token in the pool in USD, including BPTs' + - name: pool_liquidity_eth + description: 'Liquidity of the token in the pool in ETH, including BPTs' \ No newline at end of file diff --git a/models/balancer/avalanche_c/balancer_v2_avalanche_c_liquidity.sql b/models/_project/balancer/liquidity/avalanche_c/balancer_v2_avalanche_c_liquidity.sql similarity index 53% rename from models/balancer/avalanche_c/balancer_v2_avalanche_c_liquidity.sql rename to models/_project/balancer/liquidity/avalanche_c/balancer_v2_avalanche_c_liquidity.sql index 15b3912d3ee..30e2856d411 100644 --- a/models/balancer/avalanche_c/balancer_v2_avalanche_c_liquidity.sql +++ b/models/_project/balancer/liquidity/avalanche_c/balancer_v2_avalanche_c_liquidity.sql @@ -6,11 +6,7 @@ schema = 'balancer_v2_avalanche_c', alias = 'liquidity', materialized = 'table', - file_format = 'delta', - post_hook="{{ expose_spells('[\"" + blockchain + '"]' + '\', - "project", - "balancer_v2", - \'["stefenon", "viniabussafi"]\') }}' + file_format = 'delta' ) }} diff --git a/models/balancer/balancer_liquidity.sql b/models/_project/balancer/liquidity/balancer_liquidity.sql similarity index 74% rename from models/balancer/balancer_liquidity.sql rename to models/_project/balancer/liquidity/balancer_liquidity.sql index 0f003bc5d6d..57fb1122ef5 100644 --- a/models/balancer/balancer_liquidity.sql +++ b/models/_project/balancer/liquidity/balancer_liquidity.sql @@ -2,11 +2,10 @@ schema = 'balancer', alias = 'liquidity', - post_hook='{{ expose_spells(\'["ethereum","arbitrum", "optimism", "polygon", "gnosis","avalanche_c", "base", "zkevm" - ]\', - "project", - "balancer", - \'["viniabussafi"]\') }}' + post_hook='{{ expose_spells(blockchains = \'["arbitrum", "avalanche_c", "base", "ethereum", "gnosis", "optimism", "polygon", "zkevm"]\', + spell_type = "project", + spell_name = "balancer", + contributors = \'["viniabussafi"]\') }}' ) }} diff --git a/models/_project/balancer/liquidity/base/_schema.yml b/models/_project/balancer/liquidity/base/_schema.yml new file mode 100644 index 00000000000..d4b57b38164 --- /dev/null +++ b/models/_project/balancer/liquidity/base/_schema.yml @@ -0,0 +1,58 @@ +version: 2 + +models: + - name: balancer_v2_base_liquidity + meta: + blockchain: base + project: balancer_v2 + contributors: victorstefenon, viniabussafi, thetroyharris + config: + tags: ['base', 'balancer', 'pools', 'liquidity'] + description: > + Balancer v2 pools liquidity by token in Arbitrum. + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - day + - pool_id + - token_address + columns: + - &day + name: day + description: "Block date in UTC" + - &pool_id + name: pool_id + description: "Unique encoded identifier that refers to each pool" + - &pool_address + name: pool_address + description: "Pool address" + - &pool_symbol + name: pool_symbol + description: "Token symbols, followed by their respective weights, if applicable" + - &version + name: version + description: "Version of the project" + - &blockchain + name: blockchain + description: "Blockchain" + - &pool_type + name: pool_type + description: "Pool attributes, determined by the pool's factory" + - &token_address + name: token_address + description: "Contract address of the token" + - &token_symbol + name: token_symbol + description: "Token symbol" + - name: token_balance_raw + description: 'Raw balance of the token in the pool in the original currency' + - name: token_balance + description: 'Scaled balance of the token in the pool in the original currency' + - name: protocol_liquidity_usd + description: 'Liquidity of the token in the pool in USD, except BPTs' + - name: protocol_liquidity_eth + description: 'Liquidity of the token in the pool in ETH, except BPTs' + - name: pool_liquidity_usd + description: 'Liquidity of the token in the pool in USD, including BPTs' + - name: pool_liquidity_eth + description: 'Liquidity of the token in the pool in ETH, including BPTs' \ No newline at end of file diff --git a/models/balancer/base/balancer_v2_base_liquidity.sql b/models/_project/balancer/liquidity/base/balancer_v2_base_liquidity.sql similarity index 51% rename from models/balancer/base/balancer_v2_base_liquidity.sql rename to models/_project/balancer/liquidity/base/balancer_v2_base_liquidity.sql index 10b08a41262..20f257ad753 100644 --- a/models/balancer/base/balancer_v2_base_liquidity.sql +++ b/models/_project/balancer/liquidity/base/balancer_v2_base_liquidity.sql @@ -6,11 +6,7 @@ schema = 'balancer_v2_base', alias = 'liquidity', materialized = 'table', - file_format = 'delta', - post_hook="{{ expose_spells('[\"" + blockchain + '"]' + '\', - "project", - "balancer_v2", - \'["stefenon", "viniabussafi"]\') }}' + file_format = 'delta' ) }} diff --git a/models/_project/balancer/liquidity/ethereum/_schema.yml b/models/_project/balancer/liquidity/ethereum/_schema.yml new file mode 100644 index 00000000000..42866a2e449 --- /dev/null +++ b/models/_project/balancer/liquidity/ethereum/_schema.yml @@ -0,0 +1,96 @@ +version: 2 + +models: + - name: balancer_v2_ethereum_liquidity + meta: + blockchain: ethereum + project: balancer_v2 + contributors: victorstefenon, viniabussafi, thetroyharris + config: + tags: ['ethereum', 'balancer', 'pools', 'liquidity'] + description: > + Balancer v2 pools liquidity by token in Ethereum. + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - day + - pool_id + - token_address + columns: + - &day + name: day + description: "Block date in UTC" + - &pool_id + name: pool_id + description: "Unique encoded identifier that refers to each pool" + - &pool_address + name: pool_address + description: "Pool address" + - &pool_symbol + name: pool_symbol + description: "Token symbols, followed by their respective weights, if applicable" + - &version + name: version + description: "Version of the project" + - &blockchain + name: blockchain + description: "Blockchain" + - &pool_type + name: pool_type + description: "Pool attributes, determined by the pool's factory" + - &token_address + name: token_address + description: "Contract address of the token" + - &token_symbol + name: token_symbol + description: "Token symbol" + - &token_balance_raw + name: token_balance_raw + description: 'Raw balance of the token in the pool in the original currency' + - &token_balance + name: token_balance + description: 'Scaled balance of the token in the pool in the original currency' + - &protocol_liquidity_usd + name: protocol_liquidity_usd + description: 'Liquidity of the token in the pool in USD, except BPTs' + - &protocol_liquidity_eth + name: protocol_liquidity_eth + description: 'Liquidity of the token in the pool in ETH, except BPTs' + - &pool_liquidity_usd + name: pool_liquidity_usd + description: 'Liquidity of the token in the pool in USD, including BPTs' + - &pool_liquidity_eth + name: pool_liquidity_eth + description: 'Liquidity of the token in the pool in ETH, including BPTs' + + - name: balancer_v1_ethereum_liquidity + meta: + blockchain: ethereum + project: balancer_v1 + contributors: markusbkoch, mendesfabio, victorstefenon, viniabussafi, thetroyharris + config: + tags: ['ethereum', 'balancer', 'pools', 'liquidity'] + description: > + Balancer v1 pools liquidity by token in Ethereum. + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - day + - pool_id + - token_address + columns: + - *day + - *pool_id + - *pool_address + - *pool_symbol + - *version + - *blockchain + - *pool_type + - *token_address + - *token_symbol + - *token_balance_raw + - *token_balance + - *protocol_liquidity_usd + - *protocol_liquidity_eth + - *pool_liquidity_usd + - *pool_liquidity_eth \ No newline at end of file diff --git a/models/balancer/ethereum/balancer_v1_ethereum_liquidity.sql b/models/_project/balancer/liquidity/ethereum/balancer_v1_ethereum_liquidity.sql similarity index 92% rename from models/balancer/ethereum/balancer_v1_ethereum_liquidity.sql rename to models/_project/balancer/liquidity/ethereum/balancer_v1_ethereum_liquidity.sql index 31601ee7cdd..b433278b8db 100644 --- a/models/balancer/ethereum/balancer_v1_ethereum_liquidity.sql +++ b/models/_project/balancer/liquidity/ethereum/balancer_v1_ethereum_liquidity.sql @@ -3,11 +3,7 @@ schema='balancer_v1_ethereum', alias = 'liquidity', materialized = 'table', - file_format = 'delta', - post_hook='{{ expose_spells(\'["ethereum"]\', - "project", - "balancer_v1", - \'["stefenon", "viniabussafi"]\') }}' + file_format = 'delta' ) }} diff --git a/models/balancer/ethereum/balancer_v2_ethereum_liquidity.sql b/models/_project/balancer/liquidity/ethereum/balancer_v2_ethereum_liquidity.sql similarity index 52% rename from models/balancer/ethereum/balancer_v2_ethereum_liquidity.sql rename to models/_project/balancer/liquidity/ethereum/balancer_v2_ethereum_liquidity.sql index 56ccd353f93..54efdce06c3 100644 --- a/models/balancer/ethereum/balancer_v2_ethereum_liquidity.sql +++ b/models/_project/balancer/liquidity/ethereum/balancer_v2_ethereum_liquidity.sql @@ -6,11 +6,7 @@ schema = 'balancer_v2_ethereum', alias = 'liquidity', materialized = 'table', - file_format = 'delta', - post_hook="{{ expose_spells('[\"" + blockchain + '"]' + '\', - "project", - "balancer_v2", - \'["stefenon", "viniabussafi"]\') }}' + file_format = 'delta' ) }} diff --git a/models/_project/balancer/liquidity/gnosis/_schema.yml b/models/_project/balancer/liquidity/gnosis/_schema.yml new file mode 100644 index 00000000000..d21460430ab --- /dev/null +++ b/models/_project/balancer/liquidity/gnosis/_schema.yml @@ -0,0 +1,58 @@ +version: 2 + +models: + - name: balancer_v2_gnosis_liquidity + meta: + blockchain: gnosis + project: balancer_v2 + contributors: victorstefenon, viniabussafi, thetroyharris + config: + tags: ['gnosis', 'balancer', 'pools', 'liquidity'] + description: > + Balancer v2 pools liquidity by token in Arbitrum. + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - day + - pool_id + - token_address + columns: + - &day + name: day + description: "Block date in UTC" + - &pool_id + name: pool_id + description: "Unique encoded identifier that refers to each pool" + - &pool_address + name: pool_address + description: "Pool address" + - &pool_symbol + name: pool_symbol + description: "Token symbols, followed by their respective weights, if applicable" + - &version + name: version + description: "Version of the project" + - &blockchain + name: blockchain + description: "Blockchain" + - &pool_type + name: pool_type + description: "Pool attributes, determined by the pool's factory" + - &token_address + name: token_address + description: "Contract address of the token" + - &token_symbol + name: token_symbol + description: "Token symbol" + - name: token_balance_raw + description: 'Raw balance of the token in the pool in the original currency' + - name: token_balance + description: 'Scaled balance of the token in the pool in the original currency' + - name: protocol_liquidity_usd + description: 'Liquidity of the token in the pool in USD, except BPTs' + - name: protocol_liquidity_eth + description: 'Liquidity of the token in the pool in ETH, except BPTs' + - name: pool_liquidity_usd + description: 'Liquidity of the token in the pool in USD, including BPTs' + - name: pool_liquidity_eth + description: 'Liquidity of the token in the pool in ETH, including BPTs' \ No newline at end of file diff --git a/models/balancer/gnosis/balancer_v2_gnosis_liquidity.sql b/models/_project/balancer/liquidity/gnosis/balancer_v2_gnosis_liquidity.sql similarity index 51% rename from models/balancer/gnosis/balancer_v2_gnosis_liquidity.sql rename to models/_project/balancer/liquidity/gnosis/balancer_v2_gnosis_liquidity.sql index 478f1b6c77f..fc5885a24e0 100644 --- a/models/balancer/gnosis/balancer_v2_gnosis_liquidity.sql +++ b/models/_project/balancer/liquidity/gnosis/balancer_v2_gnosis_liquidity.sql @@ -6,11 +6,7 @@ schema = 'balancer_v2_gnosis', alias = 'liquidity', materialized = 'table', - file_format = 'delta', - post_hook="{{ expose_spells('[\"" + blockchain + '"]' + '\', - "project", - "balancer_v2", - \'["stefenon", "viniabussafi"]\') }}' + file_format = 'delta' ) }} diff --git a/models/_project/balancer/liquidity/optimism/_schema.yml b/models/_project/balancer/liquidity/optimism/_schema.yml new file mode 100644 index 00000000000..d41d2cb3e49 --- /dev/null +++ b/models/_project/balancer/liquidity/optimism/_schema.yml @@ -0,0 +1,58 @@ +version: 2 + +models: + - name: balancer_v2_optimism_liquidity + meta: + blockchain: optimism + project: balancer_v2 + contributors: victorstefenon, viniabussafi, thetroyharris + config: + tags: ['optimism', 'balancer', 'pools', 'liquidity'] + description: > + Balancer v2 pools liquidity by token in Arbitrum. + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - day + - pool_id + - token_address + columns: + - &day + name: day + description: "Block date in UTC" + - &pool_id + name: pool_id + description: "Unique encoded identifier that refers to each pool" + - &pool_address + name: pool_address + description: "Pool address" + - &pool_symbol + name: pool_symbol + description: "Token symbols, followed by their respective weights, if applicable" + - &version + name: version + description: "Version of the project" + - &blockchain + name: blockchain + description: "Blockchain" + - &pool_type + name: pool_type + description: "Pool attributes, determined by the pool's factory" + - &token_address + name: token_address + description: "Contract address of the token" + - &token_symbol + name: token_symbol + description: "Token symbol" + - name: token_balance_raw + description: 'Raw balance of the token in the pool in the original currency' + - name: token_balance + description: 'Scaled balance of the token in the pool in the original currency' + - name: protocol_liquidity_usd + description: 'Liquidity of the token in the pool in USD, except BPTs' + - name: protocol_liquidity_eth + description: 'Liquidity of the token in the pool in ETH, except BPTs' + - name: pool_liquidity_usd + description: 'Liquidity of the token in the pool in USD, including BPTs' + - name: pool_liquidity_eth + description: 'Liquidity of the token in the pool in ETH, including BPTs' \ No newline at end of file diff --git a/models/balancer/optimism/balancer_v2_optimism_liquidity.sql b/models/_project/balancer/liquidity/optimism/balancer_v2_optimism_liquidity.sql similarity index 52% rename from models/balancer/optimism/balancer_v2_optimism_liquidity.sql rename to models/_project/balancer/liquidity/optimism/balancer_v2_optimism_liquidity.sql index d9e8ac55868..b34e0e3557a 100644 --- a/models/balancer/optimism/balancer_v2_optimism_liquidity.sql +++ b/models/_project/balancer/liquidity/optimism/balancer_v2_optimism_liquidity.sql @@ -6,11 +6,7 @@ schema = 'balancer_v2_optimism', alias = 'liquidity', materialized = 'table', - file_format = 'delta', - post_hook="{{ expose_spells('[\"" + blockchain + '"]' + '\', - "project", - "balancer_v2", - \'["stefenon", "viniabussafi"]\') }}' + file_format = 'delta' ) }} diff --git a/models/_project/balancer/liquidity/polygon/_schema.yml b/models/_project/balancer/liquidity/polygon/_schema.yml new file mode 100644 index 00000000000..5054f2a9740 --- /dev/null +++ b/models/_project/balancer/liquidity/polygon/_schema.yml @@ -0,0 +1,58 @@ +version: 2 + +models: + - name: balancer_v2_polygon_liquidity + meta: + blockchain: polygon + project: balancer_v2 + contributors: victorstefenon, viniabussafi, thetroyharris + config: + tags: ['polygon', 'balancer', 'pools', 'liquidity'] + description: > + Balancer v2 pools liquidity by token in Arbitrum. + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - day + - pool_id + - token_address + columns: + - &day + name: day + description: "Block date in UTC" + - &pool_id + name: pool_id + description: "Unique encoded identifier that refers to each pool" + - &pool_address + name: pool_address + description: "Pool address" + - &pool_symbol + name: pool_symbol + description: "Token symbols, followed by their respective weights, if applicable" + - &version + name: version + description: "Version of the project" + - &blockchain + name: blockchain + description: "Blockchain" + - &pool_type + name: pool_type + description: "Pool attributes, determined by the pool's factory" + - &token_address + name: token_address + description: "Contract address of the token" + - &token_symbol + name: token_symbol + description: "Token symbol" + - name: token_balance_raw + description: 'Raw balance of the token in the pool in the original currency' + - name: token_balance + description: 'Scaled balance of the token in the pool in the original currency' + - name: protocol_liquidity_usd + description: 'Liquidity of the token in the pool in USD, except BPTs' + - name: protocol_liquidity_eth + description: 'Liquidity of the token in the pool in ETH, except BPTs' + - name: pool_liquidity_usd + description: 'Liquidity of the token in the pool in USD, including BPTs' + - name: pool_liquidity_eth + description: 'Liquidity of the token in the pool in ETH, including BPTs' \ No newline at end of file diff --git a/models/balancer/polygon/balancer_v2_polygon_liquidity.sql b/models/_project/balancer/liquidity/polygon/balancer_v2_polygon_liquidity.sql similarity index 52% rename from models/balancer/polygon/balancer_v2_polygon_liquidity.sql rename to models/_project/balancer/liquidity/polygon/balancer_v2_polygon_liquidity.sql index f830e2df02c..3f0c521ade6 100644 --- a/models/balancer/polygon/balancer_v2_polygon_liquidity.sql +++ b/models/_project/balancer/liquidity/polygon/balancer_v2_polygon_liquidity.sql @@ -6,11 +6,7 @@ schema = 'balancer_v2_polygon', alias = 'liquidity', materialized = 'table', - file_format = 'delta', - post_hook="{{ expose_spells('[\"" + blockchain + '"]' + '\', - "project", - "balancer_v2", - \'["stefenon", "viniabussafi"]\') }}' + file_format = 'delta' ) }} diff --git a/models/_project/balancer/liquidity/zkevm/_schema.yml b/models/_project/balancer/liquidity/zkevm/_schema.yml new file mode 100644 index 00000000000..67f36eb3b21 --- /dev/null +++ b/models/_project/balancer/liquidity/zkevm/_schema.yml @@ -0,0 +1,58 @@ +version: 2 + +models: + - name: balancer_v2_zkevm_liquidity + meta: + blockchain: zkevm + project: balancer_v2 + contributors: victorstefenon, viniabussafi, thetroyharris + config: + tags: ['zkevm', 'balancer', 'pools', 'liquidity'] + description: > + Balancer v2 pools liquidity by token in Arbitrum. + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - day + - pool_id + - token_address + columns: + - &day + name: day + description: "Block date in UTC" + - &pool_id + name: pool_id + description: "Unique encoded identifier that refers to each pool" + - &pool_address + name: pool_address + description: "Pool address" + - &pool_symbol + name: pool_symbol + description: "Token symbols, followed by their respective weights, if applicable" + - &version + name: version + description: "Version of the project" + - &blockchain + name: blockchain + description: "Blockchain" + - &pool_type + name: pool_type + description: "Pool attributes, determined by the pool's factory" + - &token_address + name: token_address + description: "Contract address of the token" + - &token_symbol + name: token_symbol + description: "Token symbol" + - name: token_balance_raw + description: 'Raw balance of the token in the pool in the original currency' + - name: token_balance + description: 'Scaled balance of the token in the pool in the original currency' + - name: protocol_liquidity_usd + description: 'Liquidity of the token in the pool in USD, except BPTs' + - name: protocol_liquidity_eth + description: 'Liquidity of the token in the pool in ETH, except BPTs' + - name: pool_liquidity_usd + description: 'Liquidity of the token in the pool in USD, including BPTs' + - name: pool_liquidity_eth + description: 'Liquidity of the token in the pool in ETH, including BPTs' \ No newline at end of file diff --git a/models/balancer/zkevm/balancer_v2_zkevm_liquidity.sql b/models/_project/balancer/liquidity/zkevm/balancer_v2_zkevm_liquidity.sql similarity index 51% rename from models/balancer/zkevm/balancer_v2_zkevm_liquidity.sql rename to models/_project/balancer/liquidity/zkevm/balancer_v2_zkevm_liquidity.sql index f3fd420bb39..737b858ca3c 100644 --- a/models/balancer/zkevm/balancer_v2_zkevm_liquidity.sql +++ b/models/_project/balancer/liquidity/zkevm/balancer_v2_zkevm_liquidity.sql @@ -6,11 +6,7 @@ schema = 'balancer_v2_zkevm', alias = 'liquidity', materialized = 'table', - file_format = 'delta', - post_hook="{{ expose_spells('[\"" + blockchain + '"]' + '\', - "project", - "balancer_v2", - \'["stefenon", "viniabussafi"]\') }}' + file_format = 'delta' ) }} diff --git a/models/_project/balancer/pools/_schema.yml b/models/_project/balancer/pools/_schema.yml new file mode 100644 index 00000000000..65c86555a7c --- /dev/null +++ b/models/_project/balancer/pools/_schema.yml @@ -0,0 +1,173 @@ +version: 2 + +models: + - name: balancer_pools_fees + meta: + blockchain: arbitrum, avalanche_c, base, ethereum, gnosis, optimism, polygon, zkevm + contributors: jacektrocinski, thetroyharris, viniabussafi + config: + tags: ['arbitrum', 'avalanche_c', 'base', 'ethereum', 'gnosis', 'optimism', 'polygon', 'zkevm', 'pools', 'fees'] + description: > + Balancer v2 swap fees stored at the pool level. + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - blockchain + - block_number + - tx_hash + - index + columns: + - &blockchain + name: blockchain + description: "Blockchain" + - &version + name: version + description: "Version of Balancer where the liquidity pool used in transaction is deployed" + - &contract_address + name: contract_address + description: 'zkevm address for the liquidity pool used in transaction' + tests: + - not_null + - &tx_hash + name: tx_hash + description: 'Transaction hash' + tests: + - not_null + - &index + name: index + description: 'Event Index' + tests: + - not_null + - &tx_index + name: tx_index + description: 'Transaction Index' + tests: + - not_null + - &block_time + name: block_time + description: 'Block time in UTC' + tests: + - not_null + - &block_number + name: block_number + description: 'Event Block Number' + tests: + - not_null + - &swap_fee_percentage + name: swap_fee_percentage + description: 'Swap fees for the pool, values are returned with 18 decimals (1e18 meaning 100%)' + tests: + - not_null + + - name: balancer_pools_tokens_weights + meta: + blockchain: arbitrum, avalanche_c, base, ethereum, gnosis, optimism, polygon, 'zkevm' + contributors: jacektrocinski, viniabussafi + config: + tags: ['arbitrum', 'avalanche_c', 'base', 'ethereum', 'gnosis', 'optimism', 'polygon', 'zkevm', 'bpt', 'transfers'] + description: > + Token weights in Balancer pools. + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - blockchain + - pool_id + - token_address + columns: + - *blockchain + - *version + - &pool_id + name: pool_id + description: 'Unique encoded identifier that refers to each pool' + tests: + - not_null + - &token_address + name: token_address + description: 'Contract address for the token' + - &normalized_weight + name: normalized_weight + description: 'Weight of the token in the pool.' + + + - name: balancer_pools_metrics_daily + meta: + blockchain: arbitrum, avalanche_c, base, ethereum, gnosis, optimism, polygon, zkevm + contributors: viniabussafi, metacrypto + config: + tags: ['arbitrum', 'avalanche_c', 'base', 'ethereum', 'gnosis', 'optimism', 'polygon', 'zkevm', 'balancer', 'pool', 'stats', 'volume', 'tvl', 'fee'] + description: > + This spell aggregates data from the trades, liquidity and protocol fees spells, by day and pool, while also displaying some basic information about the pool + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - block_date + - blockchain + - project + - version + - project_contract_address + columns: + - *blockchain + - &project + name: project + description: "Project name (balancer)" + - *version + - &block_date + name: block_date + description: "Block date in UTC" + - &project_contract_address + name: project_contract_address + description: "Pool address" + - &pool_symbol + name: pool_symbol + description: "Token symbols, followed by their respective weights, if applicable" + - &pool_type + name: pool_type + description: "Pool attributes, determined by the pool's factory" + - &swap_amount_usd + name: swap_amount_usd + description: "Daily swap volume on a pool, in USD" + - &tvl_usd + name: tvl_usd + description: "Total Value Locked on a pool, in USD" + - &tvl_eth + name: tvl_eth + description: "Total Value Locked on a pool, in eth" + - &fee_amount_usd + name: fee_amount_usd + description: "Daily fees collected on a pool, in USD" + + - name: balancer_gauge_mappings + meta: + blockchain: optimism + sector: dex + contributors: msilb7 + config: + tags: ['balancer', 'amm', 'trades', 'dex', 'incentives'] + description: > + Gauge to Pool mappings for balancer on all chains + columns: + - *blockchain + - *version + - &pool_contract + name: pool_contract + description: "Address of the liquidity pool contract" + - *pool_id + - &incentives_contract + name: incentives_contract + description: "Address of the contract where incentives are stored and emitted." + - &incentives_type + name: incentives_type + description: "Description of the incentives address type." + - &evt_block_time + name: evt_block_time + description: "Block time in UTC" + - &evt_block_number + name: evt_block_number + description: 'Event Block Number' + - *contract_address + - &evt_tx_hash + name: evt_tx_hash + description: 'Transaction hash' + - &evt_index + name: evT_index + description: 'Event Index' \ No newline at end of file diff --git a/models/_project/balancer/pools/arbitrum/_schema.yml b/models/_project/balancer/pools/arbitrum/_schema.yml new file mode 100644 index 00000000000..fd04cb90077 --- /dev/null +++ b/models/_project/balancer/pools/arbitrum/_schema.yml @@ -0,0 +1,105 @@ +version: 2 + +models: + - name: balancer_v2_arbitrum_pools_fees + meta: + blockchain: arbitrum + project: balancer_v2 + contributors: jacektrocinski, thetroyharris, viniabussafi + config: + tags: ['arbitrum', 'balancer', 'pools_fees'] + description: > + Balancer v2 swap fees stored at the pool level. + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - block_number + - tx_hash + - index + columns: + - &blockchain + name: blockchain + description: "Blockchain" + - &version + name: version + description: "Version of Balancer where the liquidity pool used in transaction is deployed" + - &contract_address + name: contract_address + description: 'Arbitrum address for the liquidity pool used in transaction' + tests: + - not_null + - &tx_hash + name: tx_hash + description: 'Transaction hash' + tests: + - not_null + - &index + name: index + description: 'Event Index' + tests: + - not_null + - &tx_index + name: tx_index + description: 'Transaction Index' + tests: + - not_null + - &block_time + name: block_time + description: 'Block time in UTC' + tests: + - not_null + - &block_number + name: block_number + description: 'Event Block Number' + tests: + - not_null + - &swap_fee_percentage + name: swap_fee_percentage + description: 'Swap fees for the pool, values are returned with 18 decimals (1e18 meaning 100%)' + tests: + - not_null + + - name: balancer_arbitrum_pools_tokens_weights + meta: + blockchain: arbitrum + project: balancer + contributors: jacektrocinski, viniabussafi + config: + tags: ['arbitrum', 'balancer', 'pools', 'tokens', 'weights'] + description: > + Token weights in Balancer pools. + columns: + - *blockchain + - *version + - &pool_id + name: pool_id + description: 'Unique encoded identifier that refers to each pool' + tests: + - not_null + - &token_address + name: token_address + description: 'Contract address for the token' + - &normalized_weight + name: normalized_weight + description: 'Weight of the token in the pool.' + + - name: balancer_v2_arbitrum_pools_tokens_weights + meta: + blockchain: arbitrum + project: balancer + contributors: jacektrocinski, viniabussafi + config: + tags: ['arbitrum', 'balancer', 'pools', 'tokens', 'weights'] + description: > + Token weights in Balancer v2 pools. + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - pool_id + - token_address + columns: + - *blockchain + - *version + - *pool_id + - *token_address + - *normalized_weight \ No newline at end of file diff --git a/models/balancer/arbitrum/balancer_arbitrum_pools_tokens_weights.sql b/models/_project/balancer/pools/arbitrum/balancer_arbitrum_pools_tokens_weights.sql similarity index 100% rename from models/balancer/arbitrum/balancer_arbitrum_pools_tokens_weights.sql rename to models/_project/balancer/pools/arbitrum/balancer_arbitrum_pools_tokens_weights.sql diff --git a/models/balancer/arbitrum/balancer_v2_arbitrum_pools_fees.sql b/models/_project/balancer/pools/arbitrum/balancer_v2_arbitrum_pools_fees.sql similarity index 75% rename from models/balancer/arbitrum/balancer_v2_arbitrum_pools_fees.sql rename to models/_project/balancer/pools/arbitrum/balancer_v2_arbitrum_pools_fees.sql index 105650c0b9b..39b5671f202 100644 --- a/models/balancer/arbitrum/balancer_v2_arbitrum_pools_fees.sql +++ b/models/_project/balancer/pools/arbitrum/balancer_v2_arbitrum_pools_fees.sql @@ -1,17 +1,12 @@ {{ config( - schema = 'balancer_v2_arbitrum', - + schema = 'balancer_v2_arbitrum', alias = 'pools_fees', materialized = 'incremental', file_format = 'delta', incremental_strategy = 'merge', - unique_key = ['block_number', 'tx_hash', 'index'], - post_hook='{{ expose_spells(\'["arbitrum"]\', - "project", - "balancer_v2", - \'["metacrypto", "jacektrocinski", "thetroyharris", "viniabussafi"]\') }}' - )  + unique_key = ['block_number', 'tx_hash', 'index'] + ) }} {% set event_signature = '0xa9ba3ffe0b6c366b81232caab38605a0699ad5398d6cce76f91ee809e322dafc' %} diff --git a/models/balancer/arbitrum/balancer_v2_arbitrum_pools_tokens_weights.sql b/models/_project/balancer/pools/arbitrum/balancer_v2_arbitrum_pools_tokens_weights.sql similarity index 99% rename from models/balancer/arbitrum/balancer_v2_arbitrum_pools_tokens_weights.sql rename to models/_project/balancer/pools/arbitrum/balancer_v2_arbitrum_pools_tokens_weights.sql index 16ee7481c9b..ae20e0126b1 100644 --- a/models/balancer/arbitrum/balancer_v2_arbitrum_pools_tokens_weights.sql +++ b/models/_project/balancer/pools/arbitrum/balancer_v2_arbitrum_pools_tokens_weights.sql @@ -2,7 +2,6 @@ config( schema='balancer_v2_arbitrum', alias = 'pools_tokens_weights', - materialized = 'incremental', file_format = 'delta', incremental_strategy = 'merge', diff --git a/models/_project/balancer/pools/avalanche_c/_schema.yml b/models/_project/balancer/pools/avalanche_c/_schema.yml new file mode 100644 index 00000000000..2c5082a751c --- /dev/null +++ b/models/_project/balancer/pools/avalanche_c/_schema.yml @@ -0,0 +1,105 @@ +version: 2 + +models: + - name: balancer_v2_avalanche_c_pools_fees + meta: + blockchain: avalanche_c + project: balancer_v2 + contributors: jacektrocinski, thetroyharris, viniabussafi + config: + tags: ['avalanche_c', 'balancer', 'pools_fees'] + description: > + Balancer v2 swap fees stored at the pool level. + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - block_number + - tx_hash + - index + columns: + - &blockchain + name: blockchain + description: "Blockchain" + - &version + name: version + description: "Version of Balancer where the liquidity pool used in transaction is deployed" + - &contract_address + name: contract_address + description: 'avalanche_c address for the liquidity pool used in transaction' + tests: + - not_null + - &tx_hash + name: tx_hash + description: 'Transaction hash' + tests: + - not_null + - &index + name: index + description: 'Event Index' + tests: + - not_null + - &tx_index + name: tx_index + description: 'Transaction Index' + tests: + - not_null + - &block_time + name: block_time + description: 'Block time in UTC' + tests: + - not_null + - &block_number + name: block_number + description: 'Event Block Number' + tests: + - not_null + - &swap_fee_percentage + name: swap_fee_percentage + description: 'Swap fees for the pool, values are returned with 18 decimals (1e18 meaning 100%)' + tests: + - not_null + + - name: balancer_avalanche_c_pools_tokens_weights + meta: + blockchain: avalanche_c + project: balancer + contributors: jacektrocinski, viniabussafi + config: + tags: ['avalanche_c', 'balancer', 'pools', 'tokens', 'weights'] + description: > + Token weights in Balancer pools. + columns: + - *blockchain + - *version + - &pool_id + name: pool_id + description: 'Unique encoded identifier that refers to each pool' + tests: + - not_null + - &token_address + name: token_address + description: 'Contract address for the token' + - &normalized_weight + name: normalized_weight + description: 'Weight of the token in the pool.' + + - name: balancer_v2_avalanche_c_pools_tokens_weights + meta: + blockchain: avalanche_c + project: balancer + contributors: jacektrocinski, viniabussafi + config: + tags: ['avalanche_c', 'balancer', 'pools', 'tokens', 'weights'] + description: > + Token weights in Balancer v2 pools. + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - pool_id + - token_address + columns: + - *blockchain + - *version + - *pool_id + - *token_address + - *normalized_weight \ No newline at end of file diff --git a/models/balancer/avalanche_c/balancer_avalanche_c_pools_tokens_weights.sql b/models/_project/balancer/pools/avalanche_c/balancer_avalanche_c_pools_tokens_weights.sql similarity index 100% rename from models/balancer/avalanche_c/balancer_avalanche_c_pools_tokens_weights.sql rename to models/_project/balancer/pools/avalanche_c/balancer_avalanche_c_pools_tokens_weights.sql diff --git a/models/balancer/avalanche_c/balancer_v2_avalanche_c_pools_fees.sql b/models/_project/balancer/pools/avalanche_c/balancer_v2_avalanche_c_pools_fees.sql similarity index 77% rename from models/balancer/avalanche_c/balancer_v2_avalanche_c_pools_fees.sql rename to models/_project/balancer/pools/avalanche_c/balancer_v2_avalanche_c_pools_fees.sql index 1b52e13c114..e3aae2cdf1a 100644 --- a/models/balancer/avalanche_c/balancer_v2_avalanche_c_pools_fees.sql +++ b/models/_project/balancer/pools/avalanche_c/balancer_v2_avalanche_c_pools_fees.sql @@ -1,17 +1,12 @@ {{ config( schema = 'balancer_v2_avalanche_c', - alias = 'pools_fees', materialized = 'incremental', file_format = 'delta', incremental_strategy = 'merge', - unique_key = ['block_number', 'tx_hash', 'index'], - post_hook='{{ expose_spells(\'["avalanche_c"]\', - "project", - "balancer_v2", - \'["metacrypto", "jacektrocinski", "thetroyharris", "viniabussafi"]\') }}' - )  + unique_key = ['block_number', 'tx_hash', 'index'] + ) }} {% set event_signature = '0xa9ba3ffe0b6c366b81232caab38605a0699ad5398d6cce76f91ee809e322dafc' %} diff --git a/models/balancer/avalanche_c/balancer_v2_avalanche_c_pools_tokens_weights.sql b/models/_project/balancer/pools/avalanche_c/balancer_v2_avalanche_c_pools_tokens_weights.sql similarity index 99% rename from models/balancer/avalanche_c/balancer_v2_avalanche_c_pools_tokens_weights.sql rename to models/_project/balancer/pools/avalanche_c/balancer_v2_avalanche_c_pools_tokens_weights.sql index 730b6b327f5..48bbb28e693 100644 --- a/models/balancer/avalanche_c/balancer_v2_avalanche_c_pools_tokens_weights.sql +++ b/models/_project/balancer/pools/avalanche_c/balancer_v2_avalanche_c_pools_tokens_weights.sql @@ -2,7 +2,6 @@ config( schema='balancer_v2_avalanche_c', alias = 'pools_tokens_weights', - materialized = 'incremental', file_format = 'delta', incremental_strategy = 'merge', diff --git a/models/balancer/balancer_gauge_mappings.sql b/models/_project/balancer/pools/balancer_gauge_mappings.sql similarity index 78% rename from models/balancer/balancer_gauge_mappings.sql rename to models/_project/balancer/pools/balancer_gauge_mappings.sql index b764f659dde..0ad73a0a700 100644 --- a/models/balancer/balancer_gauge_mappings.sql +++ b/models/_project/balancer/pools/balancer_gauge_mappings.sql @@ -1,11 +1,10 @@ {{ config( schema = 'balancer', - alias = 'gauge_mappings', post_hook='{{ expose_spells(\'["optimism"]\', - "project", - "balancer", - \'["msilb7"]\') }}' + spell_type = "project", + spell_name = "balancer", + contributors = \'["msilb7"]\') }}' ) }} diff --git a/models/balancer/balancer_pools_fees.sql b/models/_project/balancer/pools/balancer_pools_fees.sql similarity index 69% rename from models/balancer/balancer_pools_fees.sql rename to models/_project/balancer/pools/balancer_pools_fees.sql index e638f381024..2a54b518ec1 100644 --- a/models/balancer/balancer_pools_fees.sql +++ b/models/_project/balancer/pools/balancer_pools_fees.sql @@ -1,11 +1,10 @@ {{ config( schema = 'balancer', - alias = 'pools_fees', - post_hook='{{ expose_spells(\'["arbitrum", "avalanche_c", "base", "ethereum", "gnosis", "optimism", "polygon", "zkevm"]\', - "project", - "balancer", - \'["thetroyharris", "viniabussafi"]\') }}' + post_hook='{{ expose_spells(blockchains = \'["arbitrum", "avalanche_c", "base", "ethereum", "gnosis", "optimism", "polygon", "zkevm"]\', + spell_type = "project", + spell_name = "balancer", + contributors = \'["thetroyharris", "viniabussafi"]\') }}' ) }} diff --git a/models/balancer/balancer_pools_metrics_daily.sql b/models/_project/balancer/pools/balancer_pools_metrics_daily.sql similarity index 100% rename from models/balancer/balancer_pools_metrics_daily.sql rename to models/_project/balancer/pools/balancer_pools_metrics_daily.sql diff --git a/models/balancer/balancer_pools_tokens_weights.sql b/models/_project/balancer/pools/balancer_pools_tokens_weights.sql similarity index 71% rename from models/balancer/balancer_pools_tokens_weights.sql rename to models/_project/balancer/pools/balancer_pools_tokens_weights.sql index 95a71d1c294..d2e50c49ce9 100644 --- a/models/balancer/balancer_pools_tokens_weights.sql +++ b/models/_project/balancer/pools/balancer_pools_tokens_weights.sql @@ -1,10 +1,10 @@ {{ config( schema = 'balancer', alias = 'pools_tokens_weights', - post_hook='{{ expose_spells(\'["arbitrum", "avalanche_c", "base", "ethereum", "gnosis", "optimism", "polygon"]\', - "project", - "balancer", - \'["viniabussafi"]\') }}' + post_hook='{{ expose_spells(blockchains = \'["arbitrum", "avalanche_c", "base", "ethereum", "gnosis", "optimism", "polygon", "zkevm"]\', + spell_type = "project", + spell_name = "balancer", + contributors = \'["viniabussafi"]\') }}' ) }} diff --git a/models/_project/balancer/pools/base/_schema.yml b/models/_project/balancer/pools/base/_schema.yml new file mode 100644 index 00000000000..0949d82f17c --- /dev/null +++ b/models/_project/balancer/pools/base/_schema.yml @@ -0,0 +1,105 @@ +version: 2 + +models: + - name: balancer_v2_base_pools_fees + meta: + blockchain: base + project: balancer_v2 + contributors: jacektrocinski, thetroyharris, viniabussafi + config: + tags: ['base', 'balancer', 'pools_fees'] + description: > + Balancer v2 swap fees stored at the pool level. + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - block_number + - tx_hash + - index + columns: + - &blockchain + name: blockchain + description: "Blockchain" + - &version + name: version + description: "Version of Balancer where the liquidity pool used in transaction is deployed" + - &contract_address + name: contract_address + description: 'base address for the liquidity pool used in transaction' + tests: + - not_null + - &tx_hash + name: tx_hash + description: 'Transaction hash' + tests: + - not_null + - &index + name: index + description: 'Event Index' + tests: + - not_null + - &tx_index + name: tx_index + description: 'Transaction Index' + tests: + - not_null + - &block_time + name: block_time + description: 'Block time in UTC' + tests: + - not_null + - &block_number + name: block_number + description: 'Event Block Number' + tests: + - not_null + - &swap_fee_percentage + name: swap_fee_percentage + description: 'Swap fees for the pool, values are returned with 18 decimals (1e18 meaning 100%)' + tests: + - not_null + + - name: balancer_base_pools_tokens_weights + meta: + blockchain: base + project: balancer + contributors: jacektrocinski, viniabussafi + config: + tags: ['base', 'balancer', 'pools', 'tokens', 'weights'] + description: > + Token weights in Balancer pools. + columns: + - *blockchain + - *version + - &pool_id + name: pool_id + description: 'Unique encoded identifier that refers to each pool' + tests: + - not_null + - &token_address + name: token_address + description: 'Contract address for the token' + - &normalized_weight + name: normalized_weight + description: 'Weight of the token in the pool.' + + - name: balancer_v2_base_pools_tokens_weights + meta: + blockchain: base + project: balancer + contributors: jacektrocinski, viniabussafi + config: + tags: ['base', 'balancer', 'pools', 'tokens', 'weights'] + description: > + Token weights in Balancer v2 pools. + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - pool_id + - token_address + columns: + - *blockchain + - *version + - *pool_id + - *token_address + - *normalized_weight \ No newline at end of file diff --git a/models/balancer/base/balancer_base_pools_tokens_weights.sql b/models/_project/balancer/pools/base/balancer_base_pools_tokens_weights.sql similarity index 100% rename from models/balancer/base/balancer_base_pools_tokens_weights.sql rename to models/_project/balancer/pools/base/balancer_base_pools_tokens_weights.sql diff --git a/models/balancer/base/balancer_v2_base_pools_fees.sql b/models/_project/balancer/pools/base/balancer_v2_base_pools_fees.sql similarity index 77% rename from models/balancer/base/balancer_v2_base_pools_fees.sql rename to models/_project/balancer/pools/base/balancer_v2_base_pools_fees.sql index 7aaf2ef8939..c4029cb33d6 100644 --- a/models/balancer/base/balancer_v2_base_pools_fees.sql +++ b/models/_project/balancer/pools/base/balancer_v2_base_pools_fees.sql @@ -1,17 +1,12 @@ {{ config( schema = 'balancer_v2_base', - alias = 'pools_fees', materialized = 'incremental', file_format = 'delta', incremental_strategy = 'merge', - unique_key = ['block_number', 'tx_hash', 'index'], - post_hook='{{ expose_spells(\'["base"]\', - "project", - "balancer_v2", - \'["metacrypto", "jacektrocinski", "thetroyharris", "viniabussafi"]\') }}' - )  + unique_key = ['block_number', 'tx_hash', 'index'] + ) }} {% set event_signature = '0xa9ba3ffe0b6c366b81232caab38605a0699ad5398d6cce76f91ee809e322dafc' %} diff --git a/models/balancer/base/balancer_v2_base_pools_tokens_weights.sql b/models/_project/balancer/pools/base/balancer_v2_base_pools_tokens_weights.sql similarity index 99% rename from models/balancer/base/balancer_v2_base_pools_tokens_weights.sql rename to models/_project/balancer/pools/base/balancer_v2_base_pools_tokens_weights.sql index 29086428514..531e3214489 100644 --- a/models/balancer/base/balancer_v2_base_pools_tokens_weights.sql +++ b/models/_project/balancer/pools/base/balancer_v2_base_pools_tokens_weights.sql @@ -2,7 +2,6 @@ config( schema='balancer_v2_base', alias = 'pools_tokens_weights', - materialized = 'incremental', file_format = 'delta', incremental_strategy = 'merge', diff --git a/models/_project/balancer/pools/ethereum/_schema.yml b/models/_project/balancer/pools/ethereum/_schema.yml new file mode 100644 index 00000000000..ea4a24ef8c8 --- /dev/null +++ b/models/_project/balancer/pools/ethereum/_schema.yml @@ -0,0 +1,149 @@ +version: 2 + +models: + - name: balancer_v2_ethereum_pools_fees + meta: + blockchain: ethereum + project: balancer_v2 + contributors: jacektrocinski, thetroyharris, viniabussafi + config: + tags: ['ethereum', 'balancer', 'pools', 'fees'] + description: > + Balancer v2 swap fees stored at the pool level. + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - block_number + - tx_hash + - index + columns: + - &blockchain + name: blockchain + description: "Blockchain" + - &version + name: version + description: "Version of Balancer where the liquidity pool used in transaction is deployed" + - &contract_address + name: contract_address + description: 'zkevm address for the liquidity pool used in transaction' + tests: + - not_null + - &tx_hash + name: tx_hash + description: 'Transaction hash' + tests: + - not_null + - &index + name: index + description: 'Event Index' + tests: + - not_null + - &tx_index + name: tx_index + description: 'Transaction Index' + tests: + - not_null + - &block_time + name: block_time + description: 'Block time in UTC' + tests: + - not_null + - &block_number + name: block_number + description: 'Event Block Number' + tests: + - not_null + - &swap_fee_percentage + name: swap_fee_percentage + description: 'Swap fees for the pool, values are returned with 18 decimals (1e18 meaning 100%)' + tests: + - not_null + + - name: balancer_ethereum_pools_tokens_weights + meta: + blockchain: ethereum + project: balancer + contributors: jacektrocinski, viniabussafi + config: + tags: ['ethereum', 'balancer', 'pools', 'tokens', 'weights'] + description: > + Token weights in Balancer pools. + columns: + - *blockchain + - *version + - &pool_id + name: pool_id + description: 'Unique encoded identifier that refers to each pool' + tests: + - not_null + - &token_address + name: token_address + description: 'Contract address for the token' + - &normalized_weight + name: normalized_weight + description: 'Weight of the token in the pool.' + + - name: balancer_v1_ethereum_pools_tokens_weights + meta: + blockchain: ethereum + project: balancer + contributors: jacektrocinski, viniabussafi + config: + tags: ['ethereum', 'balancer', 'pools', 'tokens', 'weights'] + description: > + Token weights in Balancer v1 pools. + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - pool_id + - token_address + columns: + - *blockchain + - *version + - *pool_id + - *token_address + - *normalized_weight + + - name: balancer_v2_ethereum_pools_tokens_weights + meta: + blockchain: ethereum + project: balancer + contributors: jacektrocinski, viniabussafi + config: + tags: ['ethereum', 'balancer', 'pools', 'tokens', 'weights'] + description: > + Token weights in Balancer v2 pools. + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - pool_id + - token_address + columns: + - *blockchain + - *version + - *pool_id + - *token_address + - *normalized_weight + + - name: balancer_v2_ethereum_lbps + meta: + blockchain: ethereum + project: balancer_v2 + contributors: stefenon + config: + tags: ['ethereum', 'balancer', 'lbp'] + description: > + Record of the Liquidity Boostrapping Pools (LBP) of Balancer, an automated portfolio manager and trading platform, on Ethereum. + columns: + - name: name + description: "Name of the LBP" + - name: pool_id + description: "ID of the LBP" + - name: token_sold + description: "Contract address of the token sold by the LBP" + - name: token_symbol + description: "Symbol of the token sold by the LBP" + - name: start_time + description: "LBP start time" + - name: end_time + description: "LBP end time" \ No newline at end of file diff --git a/models/balancer/ethereum/balancer_ethereum_pools_tokens_weights.sql b/models/_project/balancer/pools/ethereum/balancer_ethereum_pools_tokens_weights.sql similarity index 100% rename from models/balancer/ethereum/balancer_ethereum_pools_tokens_weights.sql rename to models/_project/balancer/pools/ethereum/balancer_ethereum_pools_tokens_weights.sql diff --git a/models/balancer/ethereum/balancer_v1_ethereum_pools_tokens_weights.sql b/models/_project/balancer/pools/ethereum/balancer_v1_ethereum_pools_tokens_weights.sql similarity index 93% rename from models/balancer/ethereum/balancer_v1_ethereum_pools_tokens_weights.sql rename to models/_project/balancer/pools/ethereum/balancer_v1_ethereum_pools_tokens_weights.sql index 01b031110e7..eb0bd2626f6 100644 --- a/models/balancer/ethereum/balancer_v1_ethereum_pools_tokens_weights.sql +++ b/models/_project/balancer/pools/ethereum/balancer_v1_ethereum_pools_tokens_weights.sql @@ -2,15 +2,10 @@ config( schema='balancer_v1_ethereum', alias = 'pools_tokens_weights', - materialized = 'incremental', file_format = 'delta', incremental_strategy = 'merge', - unique_key = ['pool_id', 'token_address'], - post_hook='{{ expose_spells(\'["ethereum"]\', - "project", - "balancer_v1", - \'["metacrypto", "jacektrocinski"]\') }}' + unique_key = ['pool_id', 'token_address'] ) }} diff --git a/models/balancer/ethereum/balancer_v2_ethereum_lbps.sql b/models/_project/balancer/pools/ethereum/balancer_v2_ethereum_lbps.sql similarity index 100% rename from models/balancer/ethereum/balancer_v2_ethereum_lbps.sql rename to models/_project/balancer/pools/ethereum/balancer_v2_ethereum_lbps.sql diff --git a/models/balancer/ethereum/balancer_v2_ethereum_pools_fees.sql b/models/_project/balancer/pools/ethereum/balancer_v2_ethereum_pools_fees.sql similarity index 78% rename from models/balancer/ethereum/balancer_v2_ethereum_pools_fees.sql rename to models/_project/balancer/pools/ethereum/balancer_v2_ethereum_pools_fees.sql index 08bee4948e9..8e6041c0a42 100644 --- a/models/balancer/ethereum/balancer_v2_ethereum_pools_fees.sql +++ b/models/_project/balancer/pools/ethereum/balancer_v2_ethereum_pools_fees.sql @@ -1,16 +1,11 @@ {{ config( schema = 'balancer_v2_ethereum', - alias = 'pools_fees', materialized = 'incremental', file_format = 'delta', incremental_strategy = 'merge', - unique_key = ['block_number', 'tx_hash', 'index'], - post_hook='{{ expose_spells(\'["ethereum"]\', - "project", - "balancer_v2", - \'["metacrypto", "jacektrocinski", "thetroyharris", "viniabussafi"]\') }}' + unique_key = ['block_number', 'tx_hash', 'index'] )  }} diff --git a/models/balancer/ethereum/balancer_v2_ethereum_pools_tokens_weights.sql b/models/_project/balancer/pools/ethereum/balancer_v2_ethereum_pools_tokens_weights.sql similarity index 99% rename from models/balancer/ethereum/balancer_v2_ethereum_pools_tokens_weights.sql rename to models/_project/balancer/pools/ethereum/balancer_v2_ethereum_pools_tokens_weights.sql index fd0cfd29bb6..3fe74c18771 100644 --- a/models/balancer/ethereum/balancer_v2_ethereum_pools_tokens_weights.sql +++ b/models/_project/balancer/pools/ethereum/balancer_v2_ethereum_pools_tokens_weights.sql @@ -2,7 +2,6 @@ config( schema='balancer_v2_ethereum', alias = 'pools_tokens_weights', - materialized = 'incremental', file_format = 'delta', incremental_strategy = 'merge', diff --git a/models/_project/balancer/pools/gnosis/_schema.yml b/models/_project/balancer/pools/gnosis/_schema.yml new file mode 100644 index 00000000000..ac61b0140a4 --- /dev/null +++ b/models/_project/balancer/pools/gnosis/_schema.yml @@ -0,0 +1,105 @@ +version: 2 + +models: + - name: balancer_v2_gnosis_pools_fees + meta: + blockchain: gnosis + project: balancer_v2 + contributors: jacektrocinski, thetroyharris, viniabussafi + config: + tags: ['gnosis', 'balancer', 'pools_fees'] + description: > + Balancer v2 swap fees stored at the pool level. + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - block_number + - tx_hash + - index + columns: + - &blockchain + name: blockchain + description: "Blockchain" + - &version + name: version + description: "Version of Balancer where the liquidity pool used in transaction is deployed" + - &contract_address + name: contract_address + description: 'gnosis address for the liquidity pool used in transaction' + tests: + - not_null + - &tx_hash + name: tx_hash + description: 'Transaction hash' + tests: + - not_null + - &index + name: index + description: 'Event Index' + tests: + - not_null + - &tx_index + name: tx_index + description: 'Transaction Index' + tests: + - not_null + - &block_time + name: block_time + description: 'Block time in UTC' + tests: + - not_null + - &block_number + name: block_number + description: 'Event Block Number' + tests: + - not_null + - &swap_fee_percentage + name: swap_fee_percentage + description: 'Swap fees for the pool, values are returned with 18 decimals (1e18 meaning 100%)' + tests: + - not_null + + - name: balancer_gnosis_pools_tokens_weights + meta: + blockchain: gnosis + project: balancer + contributors: jacektrocinski, viniabussafi + config: + tags: ['gnosis', 'balancer', 'pools', 'tokens', 'weights'] + description: > + Token weights in Balancer pools. + columns: + - *blockchain + - *version + - &pool_id + name: pool_id + description: 'Unique encoded identifier that refers to each pool' + tests: + - not_null + - &token_address + name: token_address + description: 'Contract address for the token' + - &normalized_weight + name: normalized_weight + description: 'Weight of the token in the pool.' + + - name: balancer_v2_gnosis_pools_tokens_weights + meta: + blockchain: gnosis + project: balancer + contributors: jacektrocinski, viniabussafi + config: + tags: ['gnosis', 'balancer', 'pools', 'tokens', 'weights'] + description: > + Token weights in Balancer v2 pools. + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - pool_id + - token_address + columns: + - *blockchain + - *version + - *pool_id + - *token_address + - *normalized_weight \ No newline at end of file diff --git a/models/balancer/gnosis/balancer_gnosis_pools_tokens_weights.sql b/models/_project/balancer/pools/gnosis/balancer_gnosis_pools_tokens_weights.sql similarity index 100% rename from models/balancer/gnosis/balancer_gnosis_pools_tokens_weights.sql rename to models/_project/balancer/pools/gnosis/balancer_gnosis_pools_tokens_weights.sql diff --git a/models/balancer/gnosis/balancer_v2_gnosis_pools_fees.sql b/models/_project/balancer/pools/gnosis/balancer_v2_gnosis_pools_fees.sql similarity index 77% rename from models/balancer/gnosis/balancer_v2_gnosis_pools_fees.sql rename to models/_project/balancer/pools/gnosis/balancer_v2_gnosis_pools_fees.sql index de1a7618af6..086072fc70b 100644 --- a/models/balancer/gnosis/balancer_v2_gnosis_pools_fees.sql +++ b/models/_project/balancer/pools/gnosis/balancer_v2_gnosis_pools_fees.sql @@ -1,17 +1,12 @@ {{ config( schema = 'balancer_v2_gnosis', - alias = 'pools_fees', materialized = 'incremental', file_format = 'delta', incremental_strategy = 'merge', - unique_key = ['block_number', 'tx_hash', 'index'], - post_hook='{{ expose_spells(\'["gnosis"]\', - "project", - "balancer_v2", - \'["metacrypto", "jacektrocinski", "thetroyharris", "viniabussafi"]\') }}' - )  + unique_key = ['block_number', 'tx_hash', 'index'] + ) }} {% set event_signature = '0xa9ba3ffe0b6c366b81232caab38605a0699ad5398d6cce76f91ee809e322dafc' %} diff --git a/models/balancer/gnosis/balancer_v2_gnosis_pools_tokens_weights.sql b/models/_project/balancer/pools/gnosis/balancer_v2_gnosis_pools_tokens_weights.sql similarity index 99% rename from models/balancer/gnosis/balancer_v2_gnosis_pools_tokens_weights.sql rename to models/_project/balancer/pools/gnosis/balancer_v2_gnosis_pools_tokens_weights.sql index ee2bef6e0a7..a4b0a7688a8 100644 --- a/models/balancer/gnosis/balancer_v2_gnosis_pools_tokens_weights.sql +++ b/models/_project/balancer/pools/gnosis/balancer_v2_gnosis_pools_tokens_weights.sql @@ -2,7 +2,6 @@ config( schema='balancer_v2_gnosis', alias = 'pools_tokens_weights', - materialized = 'incremental', file_format = 'delta', incremental_strategy = 'merge', diff --git a/models/_project/balancer/pools/optimism/_schema.yml b/models/_project/balancer/pools/optimism/_schema.yml new file mode 100644 index 00000000000..289820cd3bc --- /dev/null +++ b/models/_project/balancer/pools/optimism/_schema.yml @@ -0,0 +1,146 @@ +version: 2 + +models: + - name: balancer_v2_optimism_pools_fees + meta: + blockchain: optimism + project: balancer_v2 + contributors: jacektrocinski, thetroyharris, viniabussafi + config: + tags: ['optimism', 'balancer', 'pools_fees'] + description: > + Balancer v2 swap fees stored at the pool level. + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - block_number + - tx_hash + - index + columns: + - &blockchain + name: blockchain + description: "Blockchain" + - &version + name: version + description: "Version of Balancer where the liquidity pool used in transaction is deployed" + - &contract_address + name: contract_address + description: 'optimism address for the liquidity pool used in transaction' + tests: + - not_null + - &tx_hash + name: tx_hash + description: 'Transaction hash' + tests: + - not_null + - &index + name: index + description: 'Event Index' + tests: + - not_null + - &tx_index + name: tx_index + description: 'Transaction Index' + tests: + - not_null + - &block_time + name: block_time + description: 'Block time in UTC' + tests: + - not_null + - &block_number + name: block_number + description: 'Event Block Number' + tests: + - not_null + - &swap_fee_percentage + name: swap_fee_percentage + description: 'Swap fees for the pool, values are returned with 18 decimals (1e18 meaning 100%)' + tests: + - not_null + + - name: balancer_optimism_pools_tokens_weights + meta: + blockchain: optimism + project: balancer + contributors: jacektrocinski, viniabussafi + config: + tags: ['optimism', 'balancer', 'pools', 'tokens', 'weights'] + description: > + Token weights in Balancer pools. + columns: + - *blockchain + - *version + - &pool_id + name: pool_id + description: 'Unique encoded identifier that refers to each pool' + tests: + - not_null + - &token_address + name: token_address + description: 'Contract address for the token' + - &normalized_weight + name: normalized_weight + description: 'Weight of the token in the pool.' + + - name: balancer_v2_optimism_pools_tokens_weights + meta: + blockchain: optimism + project: balancer + contributors: jacektrocinski, viniabussafi + config: + tags: ['optimism', 'balancer', 'pools', 'tokens', 'weights'] + description: > + Token weights in Balancer v2 pools. + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - pool_id + - token_address + columns: + - *blockchain + - *version + - *pool_id + - *token_address + - *normalized_weight + + - name: balancer_optimism_gauge_mappings + meta: + blockchain: optimism + project: balancer + contributors: msilb7 + config: + tags: ['optimism', 'balancer', 'gauges', 'incentives'] + description: > + Balancer gauge to pool mappings on Optimism. + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - pool_contract + - incentives_contract + columns: + - *blockchain + - *version + - &pool_contract + name: pool_contract + description: "Address of the liquidity pool contract" + - *pool_id + - &incentives_contract + name: incentives_contract + description: "Address of the contract where incentives are stored and emitted." + - &incentives_type + name: incentives_type + description: "Description of the incentives address type." + - &evt_block_time + name: evt_block_time + description: "Block time in UTC" + - &evt_block_number + name: evt_block_number + description: 'Event Block Number' + - *contract_address + - &evt_tx_hash + name: evt_tx_hash + description: 'Transaction hash' + - &evt_index + name: evT_index + description: 'Event Index' \ No newline at end of file diff --git a/models/balancer/optimism/balancer_optimism_gauge_mappings.sql b/models/_project/balancer/pools/optimism/balancer_optimism_gauge_mappings.sql similarity index 87% rename from models/balancer/optimism/balancer_optimism_gauge_mappings.sql rename to models/_project/balancer/pools/optimism/balancer_optimism_gauge_mappings.sql index 382424a91be..10ecdde4e86 100644 --- a/models/balancer/optimism/balancer_optimism_gauge_mappings.sql +++ b/models/_project/balancer/pools/optimism/balancer_optimism_gauge_mappings.sql @@ -1,16 +1,15 @@ {{ config( schema = 'balancer_optimism', - alias = 'gauge_mappings', materialized = 'incremental', file_format = 'delta', incremental_strategy = 'merge', unique_key = ['pool_contract', 'incentives_contract'], post_hook='{{ expose_spells(\'["optimism"]\', - "project", - "balancer", - \'["msilb7"]\') }}' + spell_type = "project", + spell_name = "balancer", + contributors = \'["msilb7"]\') }}' )  }} diff --git a/models/balancer/optimism/balancer_optimism_pools_tokens_weights.sql b/models/_project/balancer/pools/optimism/balancer_optimism_pools_tokens_weights.sql similarity index 86% rename from models/balancer/optimism/balancer_optimism_pools_tokens_weights.sql rename to models/_project/balancer/pools/optimism/balancer_optimism_pools_tokens_weights.sql index b6bdf48de02..204da50aa15 100644 --- a/models/balancer/optimism/balancer_optimism_pools_tokens_weights.sql +++ b/models/_project/balancer/pools/optimism/balancer_optimism_pools_tokens_weights.sql @@ -1,7 +1,6 @@ {{ config( schema = 'balancer_optimism', - alias = 'pools_tokens_weights', - + alias = 'pools_tokens_weights' ) }} diff --git a/models/balancer/optimism/balancer_v2_optimism_pools_fees.sql b/models/_project/balancer/pools/optimism/balancer_v2_optimism_pools_fees.sql similarity index 77% rename from models/balancer/optimism/balancer_v2_optimism_pools_fees.sql rename to models/_project/balancer/pools/optimism/balancer_v2_optimism_pools_fees.sql index adeeb98918e..7cde533a681 100644 --- a/models/balancer/optimism/balancer_v2_optimism_pools_fees.sql +++ b/models/_project/balancer/pools/optimism/balancer_v2_optimism_pools_fees.sql @@ -1,17 +1,12 @@ {{ config( schema = 'balancer_v2_optimism', - alias = 'pools_fees', materialized = 'incremental', file_format = 'delta', incremental_strategy = 'merge', - unique_key = ['block_number', 'tx_hash', 'index'], - post_hook='{{ expose_spells(\'["optimism"]\', - "project", - "balancer_v2", - \'["metacrypto", "jacektrocinski", "thetroyharris", "viniabussafi"]\') }}' - )  + unique_key = ['block_number', 'tx_hash', 'index'] + ) }} {% set event_signature = '0xa9ba3ffe0b6c366b81232caab38605a0699ad5398d6cce76f91ee809e322dafc' %} diff --git a/models/balancer/optimism/balancer_v2_optimism_pools_tokens_weights.sql b/models/_project/balancer/pools/optimism/balancer_v2_optimism_pools_tokens_weights.sql similarity index 99% rename from models/balancer/optimism/balancer_v2_optimism_pools_tokens_weights.sql rename to models/_project/balancer/pools/optimism/balancer_v2_optimism_pools_tokens_weights.sql index 74220656f88..0888c1c2a0b 100644 --- a/models/balancer/optimism/balancer_v2_optimism_pools_tokens_weights.sql +++ b/models/_project/balancer/pools/optimism/balancer_v2_optimism_pools_tokens_weights.sql @@ -2,7 +2,6 @@ config( schema='balancer_v2_optimism', alias = 'pools_tokens_weights', - materialized = 'incremental', file_format = 'delta', incremental_strategy = 'merge', diff --git a/models/_project/balancer/pools/polygon/_schema.yml b/models/_project/balancer/pools/polygon/_schema.yml new file mode 100644 index 00000000000..40929f01c30 --- /dev/null +++ b/models/_project/balancer/pools/polygon/_schema.yml @@ -0,0 +1,128 @@ +version: 2 + +models: + - name: balancer_v2_polygon_pools_fees + meta: + blockchain: polygon + project: balancer_v2 + contributors: jacektrocinski, thetroyharris, viniabussafi + config: + tags: ['polygon', 'balancer', 'pools', 'fees'] + description: > + Balancer v2 swap fees stored at the pool level. + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - block_number + - tx_hash + - index + columns: + - &blockchain + name: blockchain + description: "Blockchain" + - &version + name: version + description: "Version of Balancer where the liquidity pool used in transaction is deployed" + - &contract_address + name: contract_address + description: 'zkevm address for the liquidity pool used in transaction' + tests: + - not_null + - &tx_hash + name: tx_hash + description: 'Transaction hash' + tests: + - not_null + - &index + name: index + description: 'Event Index' + tests: + - not_null + - &tx_index + name: tx_index + description: 'Transaction Index' + tests: + - not_null + - &block_time + name: block_time + description: 'Block time in UTC' + tests: + - not_null + - &block_number + name: block_number + description: 'Event Block Number' + tests: + - not_null + - &swap_fee_percentage + name: swap_fee_percentage + description: 'Swap fees for the pool, values are returned with 18 decimals (1e18 meaning 100%)' + tests: + - not_null + + - name: balancer_polygon_pools_tokens_weights + meta: + blockchain: polygon + project: balancer + contributors: jacektrocinski, viniabussafi + config: + tags: ['polygon', 'balancer', 'pools', 'tokens', 'weights'] + description: > + Token weights in Balancer pools. + columns: + - *blockchain + - *version + - &pool_id + name: pool_id + description: 'Unique encoded identifier that refers to each pool' + tests: + - not_null + - &token_address + name: token_address + description: 'Contract address for the token' + - &normalized_weight + name: normalized_weight + description: 'Weight of the token in the pool.' + + - name: balancer_v2_polygon_pools_tokens_weights + meta: + blockchain: polygon + project: balancer + contributors: jacektrocinski, viniabussafi + config: + tags: ['polygon', 'balancer', 'pools', 'tokens', 'weights'] + description: > + Token weights in Balancer v2 pools. + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - pool_id + - token_address + columns: + - *blockchain + - *version + - *pool_id + - *token_address + - *normalized_weight + + - name: balancer_v2_polygon_lbps + meta: + blockchain: polygon + project: balancer_v2 + contributors: stefenon + config: + tags: ['polygon', 'balancer', 'lbp'] + description: > + Record of the Liquidity Boostrapping Pools (LBP) of Balancer, an automated portfolio manager and trading platform, on polygon. + columns: + - name: name + description: "Name of the LBP" + - name: pool_id + description: "ID of the LBP" + - name: token_sold + description: "Contract address of the token sold by the LBP" + - name: token_symbol + description: "Symbol of the token sold by the LBP" + - name: start_time + description: "LBP start time" + - name: end_time + description: "LBP end time" \ No newline at end of file diff --git a/models/balancer/polygon/balancer_polygon_pools_tokens_weights.sql b/models/_project/balancer/pools/polygon/balancer_polygon_pools_tokens_weights.sql similarity index 100% rename from models/balancer/polygon/balancer_polygon_pools_tokens_weights.sql rename to models/_project/balancer/pools/polygon/balancer_polygon_pools_tokens_weights.sql diff --git a/models/balancer/polygon/balancer_v2_polygon_lbps.sql b/models/_project/balancer/pools/polygon/balancer_v2_polygon_lbps.sql similarity index 100% rename from models/balancer/polygon/balancer_v2_polygon_lbps.sql rename to models/_project/balancer/pools/polygon/balancer_v2_polygon_lbps.sql diff --git a/models/balancer/polygon/balancer_v2_polygon_pools_fees.sql b/models/_project/balancer/pools/polygon/balancer_v2_polygon_pools_fees.sql similarity index 77% rename from models/balancer/polygon/balancer_v2_polygon_pools_fees.sql rename to models/_project/balancer/pools/polygon/balancer_v2_polygon_pools_fees.sql index 556cb0003af..586839b9ff9 100644 --- a/models/balancer/polygon/balancer_v2_polygon_pools_fees.sql +++ b/models/_project/balancer/pools/polygon/balancer_v2_polygon_pools_fees.sql @@ -1,17 +1,12 @@ {{ config( schema = 'balancer_v2_polygon', - alias = 'pools_fees', materialized = 'incremental', file_format = 'delta', incremental_strategy = 'merge', - unique_key = ['block_number', 'tx_hash', 'index'], - post_hook='{{ expose_spells(\'["polygon"]\', - "project", - "balancer_v2", - \'["metacrypto", "jacektrocinski", "thetroyharris", "viniabussafi"]\') }}' - )  + unique_key = ['block_number', 'tx_hash', 'index'] + ) }} {% set event_signature = '0xa9ba3ffe0b6c366b81232caab38605a0699ad5398d6cce76f91ee809e322dafc' %} diff --git a/models/balancer/polygon/balancer_v2_polygon_pools_tokens_weights.sql b/models/_project/balancer/pools/polygon/balancer_v2_polygon_pools_tokens_weights.sql similarity index 99% rename from models/balancer/polygon/balancer_v2_polygon_pools_tokens_weights.sql rename to models/_project/balancer/pools/polygon/balancer_v2_polygon_pools_tokens_weights.sql index afc223ecb81..20023ba61c3 100644 --- a/models/balancer/polygon/balancer_v2_polygon_pools_tokens_weights.sql +++ b/models/_project/balancer/pools/polygon/balancer_v2_polygon_pools_tokens_weights.sql @@ -2,7 +2,6 @@ config( schema='balancer_v2_polygon', alias = 'pools_tokens_weights', - materialized = 'incremental', file_format = 'delta', incremental_strategy = 'merge', diff --git a/models/_project/balancer/pools/zkevm/_schema.yml b/models/_project/balancer/pools/zkevm/_schema.yml new file mode 100644 index 00000000000..03f7ab4e6be --- /dev/null +++ b/models/_project/balancer/pools/zkevm/_schema.yml @@ -0,0 +1,105 @@ +version: 2 + +models: + - name: balancer_v2_zkevm_pools_fees + meta: + blockchain: zkevm + project: balancer_v2 + contributors: jacektrocinski, thetroyharris, viniabussafi + config: + tags: ['zkevm', 'balancer', 'pools_fees'] + description: > + Balancer v2 swap fees stored at the pool level. + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - block_number + - tx_hash + - index + columns: + - &blockchain + name: blockchain + description: "Blockchain" + - &version + name: version + description: "Version of Balancer where the liquidity pool used in transaction is deployed" + - &contract_address + name: contract_address + description: 'zkevm address for the liquidity pool used in transaction' + tests: + - not_null + - &tx_hash + name: tx_hash + description: 'Transaction hash' + tests: + - not_null + - &index + name: index + description: 'Event Index' + tests: + - not_null + - &tx_index + name: tx_index + description: 'Transaction Index' + tests: + - not_null + - &block_time + name: block_time + description: 'Block time in UTC' + tests: + - not_null + - &block_number + name: block_number + description: 'Event Block Number' + tests: + - not_null + - &swap_fee_percentage + name: swap_fee_percentage + description: 'Swap fees for the pool, values are returned with 18 decimals (1e18 meaning 100%)' + tests: + - not_null + + - name: balancer_zkevm_pools_tokens_weights + meta: + blockchain: zkevm + project: balancer + contributors: jacektrocinski, viniabussafi + config: + tags: ['zkevm', 'balancer', 'pools', 'tokens', 'weights'] + description: > + Token weights in Balancer pools. + columns: + - *blockchain + - *version + - &pool_id + name: pool_id + description: 'Unique encoded identifier that refers to each pool' + tests: + - not_null + - &token_address + name: token_address + description: 'Contract address for the token' + - &normalized_weight + name: normalized_weight + description: 'Weight of the token in the pool.' + + - name: balancer_v2_zkevm_pools_tokens_weights + meta: + blockchain: zkevm + project: balancer + contributors: jacektrocinski, viniabussafi + config: + tags: ['zkevm', 'balancer', 'pools', 'tokens', 'weights'] + description: > + Token weights in Balancer v2 pools. + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - pool_id + - token_address + columns: + - *blockchain + - *version + - *pool_id + - *token_address + - *normalized_weight \ No newline at end of file diff --git a/models/balancer/zkevm/balancer_v2_zkevm_pools_fees.sql b/models/_project/balancer/pools/zkevm/balancer_v2_zkevm_pools_fees.sql similarity index 82% rename from models/balancer/zkevm/balancer_v2_zkevm_pools_fees.sql rename to models/_project/balancer/pools/zkevm/balancer_v2_zkevm_pools_fees.sql index a92e4c5c00c..87bf3434eba 100644 --- a/models/balancer/zkevm/balancer_v2_zkevm_pools_fees.sql +++ b/models/_project/balancer/pools/zkevm/balancer_v2_zkevm_pools_fees.sql @@ -6,11 +6,7 @@ file_format = 'delta', incremental_strategy = 'merge', unique_key = ['block_number', 'tx_hash', 'index'], - post_hook='{{ expose_spells(\'["zkevm"]\', - "project", - "balancer_v2", - \'["metacrypto", "jacektrocinski", "thetroyharris", "viniabussafi"]\') }}' - )  + ) }} {% set event_signature = '0xa9ba3ffe0b6c366b81232caab38605a0699ad5398d6cce76f91ee809e322dafc' %} diff --git a/models/balancer/zkevm/balancer_v2_zkevm_pools_tokens_weights.sql b/models/_project/balancer/pools/zkevm/balancer_v2_zkevm_pools_tokens_weights.sql similarity index 100% rename from models/balancer/zkevm/balancer_v2_zkevm_pools_tokens_weights.sql rename to models/_project/balancer/pools/zkevm/balancer_v2_zkevm_pools_tokens_weights.sql diff --git a/models/balancer/zkevm/balancer_zkevm_pools_tokens_weights.sql b/models/_project/balancer/pools/zkevm/balancer_zkevm_pools_tokens_weights.sql similarity index 100% rename from models/balancer/zkevm/balancer_zkevm_pools_tokens_weights.sql rename to models/_project/balancer/pools/zkevm/balancer_zkevm_pools_tokens_weights.sql diff --git a/models/_project/balancer/protocol_fee/_schema.yml b/models/_project/balancer/protocol_fee/_schema.yml new file mode 100644 index 00000000000..ddc320d1692 --- /dev/null +++ b/models/_project/balancer/protocol_fee/_schema.yml @@ -0,0 +1,61 @@ +version: 2 + +models: + - name: balancer_protocol_fee + meta: + blockchain: arbitrum, avalanche_c, base, ethereum, gnosis, optimism, polygon, zkevm + project: balancer + contributors: viniabussafi + config: + tags: ['arbitrum', 'avalanche_c', 'base', 'ethereum', 'gnosis', 'optimism', 'polygon', 'zkevm', 'fees'] + description: > + Daily Protocol Fee collected and Revenue by pool on Balancer, an automated portfolio manager and trading platform. + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - day + - pool_id + - token_address + columns: + - &day + name: day + description: "Block date in UTC" + - &pool_id + name: pool_id + description: "Unique encoded identifier that refers to each pool" + - &pool_address + name: pool_address + description: "Pool address" + - &pool_symbol + name: pool_symbol + description: "Token symbols, followed by their respective weights, if applicable" + - &version + name: version + description: "Version of the project" + - &blockchain + name: blockchain + description: "Blockchain" + - &pool_type + name: pool_type + description: "Pool attributes, determined by the pool's factory" + - &token_address + name: token_address + description: "Contract address of the token in which protocol fees were collected" + - &token_symbol + name: token_symbol + description: Token symbol of the token in which protocol fees were collected" + - &token_amount_raw + name: token_amount_raw + description: "Raw amount of fees of the token in the pool at time of execution in the original currency" + - &token_amount + name: token_amount + description: "Normalized amount of fees of the token in the pool at time of execution in the original currency" + - &protocol_fee_collected_usd + name: protocol_fee_collected_usd + description: "USD value of the collected fee" + - &treasury_share + name: treasury_share + description: "Share of total fee that is directed to Balancer DAO's treasury, as per BIPs 19, 161 and 371" + - &treasury_revenue_usd + name: treasury_revenue_usd + description: "USD value of fee directed to Balancer DAO's treasury" \ No newline at end of file diff --git a/models/_project/balancer/protocol_fee/arbitrum/_schema.yml b/models/_project/balancer/protocol_fee/arbitrum/_schema.yml new file mode 100644 index 00000000000..b529565a645 --- /dev/null +++ b/models/_project/balancer/protocol_fee/arbitrum/_schema.yml @@ -0,0 +1,61 @@ +version: 2 + +models: + - name: balancer_v2_arbitrum_protocol_fee + meta: + blockchain: arbitrum + project: balancer_v2 + contributors: viniabussafi + config: + tags: ['arbitrum', 'protocol', 'fees'] + description: > + Daily Protocol Fee collected and Treasury Revenue by pool on Balancer, an automated portfolio manager and trading platform. + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - day + - pool_id + - token_address + columns: + - &day + name: day + description: "Block date in UTC" + - &pool_id + name: pool_id + description: "Unique encoded identifier that refers to each pool" + - &pool_address + name: pool_address + description: "Pool address" + - &pool_symbol + name: pool_symbol + description: "Token symbols, followed by their respective weights, if applicable" + - &version + name: version + description: "Version of the project" + - &blockchain + name: blockchain + description: "Blockchain" + - &pool_type + name: pool_type + description: "Pool attributes, determined by the pool's factory" + - &token_address + name: token_address + description: "Contract address of the token in which protocol fees were collected" + - &token_symbol + name: token_symbol + description: Token symbol of the token in which protocol fees were collected" + - &token_amount_raw + name: token_amount_raw + description: "Raw amount of fees of the token in the pool at time of execution in the original currency" + - &token_amount + name: token_amount + description: "Normalized amount of fees of the token in the pool at time of execution in the original currency" + - &protocol_fee_collected_usd + name: protocol_fee_collected_usd + description: "USD value of the collected fee" + - &treasury_share + name: treasury_share + description: "Share of total fee that is directed to Balancer DAO's treasury, as per BIPs 19, 161 and 371" + - &treasury_revenue_usd + name: treasury_revenue_usd + description: "USD value of fee directed to Balancer DAO's treasury" \ No newline at end of file diff --git a/models/balancer/arbitrum/balancer_v2_arbitrum_protocol_fee.sql b/models/_project/balancer/protocol_fee/arbitrum/balancer_v2_arbitrum_protocol_fee.sql similarity index 100% rename from models/balancer/arbitrum/balancer_v2_arbitrum_protocol_fee.sql rename to models/_project/balancer/protocol_fee/arbitrum/balancer_v2_arbitrum_protocol_fee.sql diff --git a/models/_project/balancer/protocol_fee/avalanche_c/_schema.yml b/models/_project/balancer/protocol_fee/avalanche_c/_schema.yml new file mode 100644 index 00000000000..536823df10d --- /dev/null +++ b/models/_project/balancer/protocol_fee/avalanche_c/_schema.yml @@ -0,0 +1,61 @@ +version: 2 + +models: + - name: balancer_v2_avalanche_c_protocol_fee + meta: + blockchain: avalanche_c + project: balancer_v2 + contributors: viniabussafi + config: + tags: ['avalanche_c', 'revenue', 'fees'] + description: > + Daily Protocol Fee collected and Revenue by pool on Balancer, an automated portfolio manager and trading platform. + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - day + - pool_id + - token_address + columns: + - &day + name: day + description: "Block date in UTC" + - &pool_id + name: pool_id + description: "Unique encoded identifier that refers to each pool" + - &pool_address + name: pool_address + description: "Pool address" + - &pool_symbol + name: pool_symbol + description: "Token symbols, followed by their respective weights, if applicable" + - &version + name: version + description: "Version of the project" + - &blockchain + name: blockchain + description: "Blockchain" + - &pool_type + name: pool_type + description: "Pool attributes, determined by the pool's factory" + - &token_address + name: token_address + description: "Contract address of the token in which protocol fees were collected" + - &token_symbol + name: token_symbol + description: Token symbol of the token in which protocol fees were collected" + - &token_amount_raw + name: token_amount_raw + description: "Raw amount of fees of the token in the pool at time of execution in the original currency" + - &token_amount + name: token_amount + description: "Normalized amount of fees of the token in the pool at time of execution in the original currency" + - &protocol_fee_collected_usd + name: protocol_fee_collected_usd + description: "USD value of the collected fee" + - &treasury_share + name: treasury_share + description: "Share of total fee that is directed to Balancer DAO's treasury, as per BIPs 19, 161 and 371" + - &treasury_revenue_usd + name: treasury_revenue_usd + description: "USD value of fee directed to Balancer DAO's treasury" \ No newline at end of file diff --git a/models/balancer/avalanche_c/balancer_v2_avalanche_c_protocol_fee.sql b/models/_project/balancer/protocol_fee/avalanche_c/balancer_v2_avalanche_c_protocol_fee.sql similarity index 100% rename from models/balancer/avalanche_c/balancer_v2_avalanche_c_protocol_fee.sql rename to models/_project/balancer/protocol_fee/avalanche_c/balancer_v2_avalanche_c_protocol_fee.sql diff --git a/models/balancer/balancer_protocol_fee.sql b/models/_project/balancer/protocol_fee/balancer_protocol_fee.sql similarity index 75% rename from models/balancer/balancer_protocol_fee.sql rename to models/_project/balancer/protocol_fee/balancer_protocol_fee.sql index d871a6aef89..37fef24dc85 100644 --- a/models/balancer/balancer_protocol_fee.sql +++ b/models/_project/balancer/protocol_fee/balancer_protocol_fee.sql @@ -1,10 +1,10 @@ {{ config( schema = 'balancer', alias = 'protocol_fee', - post_hook='{{ expose_spells(\'["ethereum", "arbitrum", "polygon", "gnosis", "optimism","avalanche_c", "base"]\', - "project", - "balancer", - \'["viniabussafi"]\') }}' + post_hook='{{ expose_spells(blockchains = \'["arbitrum", "avalanche_c", "base", "ethereum", "gnosis", "optimism", "polygon", "zkevm"]\', + spell_type = "project", + spell_name = "balancer", + contributors = \'["viniabussafi"]\') }}' ) }} diff --git a/models/_project/balancer/protocol_fee/base/_schema.yml b/models/_project/balancer/protocol_fee/base/_schema.yml new file mode 100644 index 00000000000..cebb1c312e9 --- /dev/null +++ b/models/_project/balancer/protocol_fee/base/_schema.yml @@ -0,0 +1,61 @@ +version: 2 + +models: + - name: balancer_v2_base_protocol_fee + meta: + blockchain: base + project: balancer_v2 + contributors: viniabussafi + config: + tags: ['base', 'revenue', 'fees'] + description: > + Daily Protocol Fee collected and Revenue by pool on Balancer, an automated portfolio manager and trading platform. + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - day + - pool_id + - token_address + columns: + - &day + name: day + description: "Block date in UTC" + - &pool_id + name: pool_id + description: "Unique encoded identifier that refers to each pool" + - &pool_address + name: pool_address + description: "Pool address" + - &pool_symbol + name: pool_symbol + description: "Token symbols, followed by their respective weights, if applicable" + - &version + name: version + description: "Version of the project" + - &blockchain + name: blockchain + description: "Blockchain" + - &pool_type + name: pool_type + description: "Pool attributes, determined by the pool's factory" + - &token_address + name: token_address + description: "Contract address of the token in which protocol fees were collected" + - &token_symbol + name: token_symbol + description: Token symbol of the token in which protocol fees were collected" + - &token_amount_raw + name: token_amount_raw + description: "Raw amount of fees of the token in the pool at time of execution in the original currency" + - &token_amount + name: token_amount + description: "Normalized amount of fees of the token in the pool at time of execution in the original currency" + - &protocol_fee_collected_usd + name: protocol_fee_collected_usd + description: "USD value of the collected fee" + - &treasury_share + name: treasury_share + description: "Share of total fee that is directed to Balancer DAO's treasury, as per BIPs 19, 161 and 371" + - &treasury_revenue_usd + name: treasury_revenue_usd + description: "USD value of fee directed to Balancer DAO's treasury" \ No newline at end of file diff --git a/models/balancer/base/balancer_v2_base_protocol_fee.sql b/models/_project/balancer/protocol_fee/base/balancer_v2_base_protocol_fee.sql similarity index 100% rename from models/balancer/base/balancer_v2_base_protocol_fee.sql rename to models/_project/balancer/protocol_fee/base/balancer_v2_base_protocol_fee.sql diff --git a/models/_project/balancer/protocol_fee/ethereum/_schema.yml b/models/_project/balancer/protocol_fee/ethereum/_schema.yml new file mode 100644 index 00000000000..b6830c20e7e --- /dev/null +++ b/models/_project/balancer/protocol_fee/ethereum/_schema.yml @@ -0,0 +1,61 @@ +version: 2 + +models: + - name: balancer_v2_ethereum_protocol_fee + meta: + blockchain: ethereum + project: balancer_v2 + contributors: viniabussafi + config: + tags: ['ethereum', 'revenue', 'fees'] + description: > + Daily Protocol Fee collected and Revenue by pool on Balancer, an automated portfolio manager and trading platform. + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - day + - pool_id + - token_address + columns: + - &day + name: day + description: "Block date in UTC" + - &pool_id + name: pool_id + description: "Unique encoded identifier that refers to each pool" + - &pool_address + name: pool_address + description: "Pool address" + - &pool_symbol + name: pool_symbol + description: "Token symbols, followed by their respective weights, if applicable" + - &version + name: version + description: "Version of the project" + - &blockchain + name: blockchain + description: "Blockchain" + - &pool_type + name: pool_type + description: "Pool attributes, determined by the pool's factory" + - &token_address + name: token_address + description: "Contract address of the token in which protocol fees were collected" + - &token_symbol + name: token_symbol + description: Token symbol of the token in which protocol fees were collected" + - &token_amount_raw + name: token_amount_raw + description: "Raw amount of fees of the token in the pool at time of execution in the original currency" + - &token_amount + name: token_amount + description: "Normalized amount of fees of the token in the pool at time of execution in the original currency" + - &protocol_fee_collected_usd + name: protocol_fee_collected_usd + description: "USD value of the collected fee" + - &treasury_share + name: treasury_share + description: "Share of total fee that is directed to Balancer DAO's treasury, as per BIPs 19, 161 and 371" + - &treasury_revenue_usd + name: treasury_revenue_usd + description: "USD value of fee directed to Balancer DAO's treasury" \ No newline at end of file diff --git a/models/balancer/ethereum/balancer_v2_ethereum_protocol_fee.sql b/models/_project/balancer/protocol_fee/ethereum/balancer_v2_ethereum_protocol_fee.sql similarity index 100% rename from models/balancer/ethereum/balancer_v2_ethereum_protocol_fee.sql rename to models/_project/balancer/protocol_fee/ethereum/balancer_v2_ethereum_protocol_fee.sql diff --git a/models/_project/balancer/protocol_fee/gnosis/_schema.yml b/models/_project/balancer/protocol_fee/gnosis/_schema.yml new file mode 100644 index 00000000000..defa5e74781 --- /dev/null +++ b/models/_project/balancer/protocol_fee/gnosis/_schema.yml @@ -0,0 +1,61 @@ +version: 2 + +models: + - name: balancer_v2_gnosis_protocol_fee + meta: + blockchain: gnosis + project: balancer_v2 + contributors: viniabussafi + config: + tags: ['gnosis', 'revenue', 'fees'] + description: > + Daily Protocol Fee collected and Revenue by pool on Balancer, an automated portfolio manager and trading platform. + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - day + - pool_id + - token_address + columns: + - &day + name: day + description: "Block date in UTC" + - &pool_id + name: pool_id + description: "Unique encoded identifier that refers to each pool" + - &pool_address + name: pool_address + description: "Pool address" + - &pool_symbol + name: pool_symbol + description: "Token symbols, followed by their respective weights, if applicable" + - &version + name: version + description: "Version of the project" + - &blockchain + name: blockchain + description: "Blockchain" + - &pool_type + name: pool_type + description: "Pool attributes, determined by the pool's factory" + - &token_address + name: token_address + description: "Contract address of the token in which protocol fees were collected" + - &token_symbol + name: token_symbol + description: Token symbol of the token in which protocol fees were collected" + - &token_amount_raw + name: token_amount_raw + description: "Raw amount of fees of the token in the pool at time of execution in the original currency" + - &token_amount + name: token_amount + description: "Normalized amount of fees of the token in the pool at time of execution in the original currency" + - &protocol_fee_collected_usd + name: protocol_fee_collected_usd + description: "USD value of the collected fee" + - &treasury_share + name: treasury_share + description: "Share of total fee that is directed to Balancer DAO's treasury, as per BIPs 19, 161 and 371" + - &treasury_revenue_usd + name: treasury_revenue_usd + description: "USD value of fee directed to Balancer DAO's treasury" \ No newline at end of file diff --git a/models/balancer/gnosis/balancer_v2_gnosis_protocol_fee.sql b/models/_project/balancer/protocol_fee/gnosis/balancer_v2_gnosis_protocol_fee.sql similarity index 100% rename from models/balancer/gnosis/balancer_v2_gnosis_protocol_fee.sql rename to models/_project/balancer/protocol_fee/gnosis/balancer_v2_gnosis_protocol_fee.sql diff --git a/models/_project/balancer/protocol_fee/optimism/_schema.yml b/models/_project/balancer/protocol_fee/optimism/_schema.yml new file mode 100644 index 00000000000..6b096a72bc6 --- /dev/null +++ b/models/_project/balancer/protocol_fee/optimism/_schema.yml @@ -0,0 +1,61 @@ +version: 2 + +models: + - name: balancer_v2_optimism_protocol_fee + meta: + blockchain: optimism + project: balancer_v2 + contributors: viniabussafi + config: + tags: ['optimism', 'revenue', 'fees'] + description: > + Daily Protocol Fee collected and Revenue by pool on Balancer, an automated portfolio manager and trading platform. + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - day + - pool_id + - token_address + columns: + - &day + name: day + description: "Block date in UTC" + - &pool_id + name: pool_id + description: "Unique encoded identifier that refers to each pool" + - &pool_address + name: pool_address + description: "Pool address" + - &pool_symbol + name: pool_symbol + description: "Token symbols, followed by their respective weights, if applicable" + - &version + name: version + description: "Version of the project" + - &blockchain + name: blockchain + description: "Blockchain" + - &pool_type + name: pool_type + description: "Pool attributes, determined by the pool's factory" + - &token_address + name: token_address + description: "Contract address of the token in which protocol fees were collected" + - &token_symbol + name: token_symbol + description: Token symbol of the token in which protocol fees were collected" + - &token_amount_raw + name: token_amount_raw + description: "Raw amount of fees of the token in the pool at time of execution in the original currency" + - &token_amount + name: token_amount + description: "Normalized amount of fees of the token in the pool at time of execution in the original currency" + - &protocol_fee_collected_usd + name: protocol_fee_collected_usd + description: "USD value of the collected fee" + - &treasury_share + name: treasury_share + description: "Share of total fee that is directed to Balancer DAO's treasury, as per BIPs 19, 161 and 371" + - &treasury_revenue_usd + name: treasury_revenue_usd + description: "USD value of fee directed to Balancer DAO's treasury" \ No newline at end of file diff --git a/models/balancer/optimism/balancer_v2_optimism_protocol_fee.sql b/models/_project/balancer/protocol_fee/optimism/balancer_v2_optimism_protocol_fee.sql similarity index 100% rename from models/balancer/optimism/balancer_v2_optimism_protocol_fee.sql rename to models/_project/balancer/protocol_fee/optimism/balancer_v2_optimism_protocol_fee.sql diff --git a/models/_project/balancer/protocol_fee/polygon/_schema.yml b/models/_project/balancer/protocol_fee/polygon/_schema.yml new file mode 100644 index 00000000000..b541beceb65 --- /dev/null +++ b/models/_project/balancer/protocol_fee/polygon/_schema.yml @@ -0,0 +1,61 @@ +version: 2 + +models: + - name: balancer_v2_polygon_protocol_fee + meta: + blockchain: polygon + project: balancer_v2 + contributors: viniabussafi + config: + tags: ['polygon', 'revenue', 'fees'] + description: > + Daily Protocol Fee collected and Revenue by pool on Balancer, an automated portfolio manager and trading platform. + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - day + - pool_id + - token_address + columns: + - &day + name: day + description: "Block date in UTC" + - &pool_id + name: pool_id + description: "Unique encoded identifier that refers to each pool" + - &pool_address + name: pool_address + description: "Pool address" + - &pool_symbol + name: pool_symbol + description: "Token symbols, followed by their respective weights, if applicable" + - &version + name: version + description: "Version of the project" + - &blockchain + name: blockchain + description: "Blockchain" + - &pool_type + name: pool_type + description: "Pool attributes, determined by the pool's factory" + - &token_address + name: token_address + description: "Contract address of the token in which protocol fees were collected" + - &token_symbol + name: token_symbol + description: Token symbol of the token in which protocol fees were collected" + - &token_amount_raw + name: token_amount_raw + description: "Raw amount of fees of the token in the pool at time of execution in the original currency" + - &token_amount + name: token_amount + description: "Normalized amount of fees of the token in the pool at time of execution in the original currency" + - &protocol_fee_collected_usd + name: protocol_fee_collected_usd + description: "USD value of the collected fee" + - &treasury_share + name: treasury_share + description: "Share of total fee that is directed to Balancer DAO's treasury, as per BIPs 19, 161 and 371" + - &treasury_revenue_usd + name: treasury_revenue_usd + description: "USD value of fee directed to Balancer DAO's treasury" \ No newline at end of file diff --git a/models/balancer/polygon/balancer_v2_polygon_protocol_fee.sql b/models/_project/balancer/protocol_fee/polygon/balancer_v2_polygon_protocol_fee.sql similarity index 100% rename from models/balancer/polygon/balancer_v2_polygon_protocol_fee.sql rename to models/_project/balancer/protocol_fee/polygon/balancer_v2_polygon_protocol_fee.sql diff --git a/models/_project/balancer/protocol_fee/zkevm/_schema.yml b/models/_project/balancer/protocol_fee/zkevm/_schema.yml new file mode 100644 index 00000000000..b8c5d67a600 --- /dev/null +++ b/models/_project/balancer/protocol_fee/zkevm/_schema.yml @@ -0,0 +1,61 @@ +version: 2 + +models: + - name: balancer_v2_zkevm_protocol_fee + meta: + blockchain: zkevm + project: balancer_v2 + contributors: viniabussafi + config: + tags: ['zkevm', 'revenue', 'fees'] + description: > + Daily Protocol Fee collected and Revenue by pool on Balancer, an automated portfolio manager and trading platform. + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - day + - pool_id + - token_address + columns: + - &day + name: day + description: "Block date in UTC" + - &pool_id + name: pool_id + description: "Unique encoded identifier that refers to each pool" + - &pool_address + name: pool_address + description: "Pool address" + - &pool_symbol + name: pool_symbol + description: "Token symbols, followed by their respective weights, if applicable" + - &version + name: version + description: "Version of the project" + - &blockchain + name: blockchain + description: "Blockchain" + - &pool_type + name: pool_type + description: "Pool attributes, determined by the pool's factory" + - &token_address + name: token_address + description: "Contract address of the token in which protocol fees were collected" + - &token_symbol + name: token_symbol + description: Token symbol of the token in which protocol fees were collected" + - &token_amount_raw + name: token_amount_raw + description: "Raw amount of fees of the token in the pool at time of execution in the original currency" + - &token_amount + name: token_amount + description: "Normalized amount of fees of the token in the pool at time of execution in the original currency" + - &protocol_fee_collected_usd + name: protocol_fee_collected_usd + description: "USD value of the collected fee" + - &treasury_share + name: treasury_share + description: "Share of total fee that is directed to Balancer DAO's treasury, as per BIPs 19, 161 and 371" + - &treasury_revenue_usd + name: treasury_revenue_usd + description: "USD value of fee directed to Balancer DAO's treasury" \ No newline at end of file diff --git a/models/balancer/zkevm/balancer_v2_zkevm_protocol_fee.sql b/models/_project/balancer/protocol_fee/zkevm/balancer_v2_zkevm_protocol_fee.sql similarity index 100% rename from models/balancer/zkevm/balancer_v2_zkevm_protocol_fee.sql rename to models/_project/balancer/protocol_fee/zkevm/balancer_v2_zkevm_protocol_fee.sql diff --git a/models/_project/balancer/support/_schema.yml b/models/_project/balancer/support/_schema.yml new file mode 100644 index 00000000000..fbb445cf773 --- /dev/null +++ b/models/_project/balancer/support/_schema.yml @@ -0,0 +1,56 @@ +version: 2 + +models: + - name: balancer_token_whitelist + meta: + blockchain: arbitrum, avalanche_c, base, ethereum, gnosis, optimism, polygon, 'zkevm' + contributors: viniabussafi + config: + tags: ['arbitrum', 'avalanche_c', 'base', 'ethereum', 'gnosis', 'optimism', 'polygon', 'zkevm'] + description: > + These tokens are whitelisted to be used as pricing assets on liquidity calculations for weighted pools, due to the trustability of their data. + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - address + - name + - chain + columns: + - &address + name: address + description: "Token address" + - &name + name: name + description: "Token symbol" + - &chain + name: chain + description: "Token blockchain" + + - name: balancer_single_recipient_gauges + meta: + blockchain: ethereum + contributors: viniabussafi + config: + tags: ['ethereum', 'gauges'] + description: > + These gauges are deployed by the SingleRecipientGauge contract and this mapping manually links each gauge to it's correspondent pool and project + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - gauge_address + - pool_id + - project + - blockchain + columns: + - &gauge_address + name: gauge_address + descripton: "Gauge address" + - &pool_id + name: pool_id + description: "Unique encoded identifier that refers to each pool to which each gauge directs incentives" + - &project + name: project + description: "ve8020 project for each gauge" + - &blockchain + name: blockchain + description: "Blockchain" \ No newline at end of file diff --git a/models/balancer/balancer_single_recipient_gauges.sql b/models/_project/balancer/support/balancer_single_recipient_gauges.sql similarity index 100% rename from models/balancer/balancer_single_recipient_gauges.sql rename to models/_project/balancer/support/balancer_single_recipient_gauges.sql diff --git a/models/balancer/balancer_token_whitelist.sql b/models/_project/balancer/support/balancer_token_whitelist.sql similarity index 100% rename from models/balancer/balancer_token_whitelist.sql rename to models/_project/balancer/support/balancer_token_whitelist.sql diff --git a/models/_project/balancer/trades/arbitrum/_schema.yml b/models/_project/balancer/trades/arbitrum/_schema.yml new file mode 100644 index 00000000000..09ef97905b8 --- /dev/null +++ b/models/_project/balancer/trades/arbitrum/_schema.yml @@ -0,0 +1,149 @@ +version: 2 + +models: + - name: balancer_arbitrum_trades + meta: + blockchain: arbitrum + sector: dex + contributors: bizzyvinci, viniabussafi + config: + tags: ['balancer', 'arbitrum', 'amm', 'trades', 'dex'] + description: > + DEX trades on balancer on arbitrum + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - block_date + - blockchain + - project + - version + - tx_hash + - evt_index + - check_dex_seed: + blockchain: arbitrum + project: balancer + version: 2 + columns: + - &blockchain + name: blockchain + description: "Blockchain" + - &project + name: project + description: "Project name (balancer)" + - &version + name: version + description: "Version of the project" + - &block_month + name: block_month + description: "Block month in UTC" + - &block_date + name: block_date + description: "Block date in UTC" + - &block_time + name: block_time + description: 'Block time in UTC' + - &block_number + name: block_number + description: 'Block number' + - &token_bought_symbol + name: token_bought_symbol + description: "Token symbol for token bought in the trade" + - &token_sold_symbol + name: token_sold_symbol + description: "Token symbol for token sold in the trade" + - &token_pair + name: token_pair + description: "Token symbol pair for each token involved in the trade" + - &token_bought_amount + name: token_bought_amount + description: "Value of the token bought at time of execution in the original currency" + - &token_sold_amount + name: token_sold_amount + description: "Value of the token sold at time of execution in the original currency" + - &token_bought_amount_raw + name: token_bought_amount_raw + description: "Raw value of the token bought at time of execution in the original currency" + - &token_sold_amount_raw + name: token_sold_amount_raw + description: "Raw value of the token sold at time of execution in the original currency" + - &amount_usd + name: amount_usd + description: "USD value of the trade at time of execution" + - &token_bought_address + name: token_bought_address + description: "Contract address of the token bought" + - &token_sold_address + name: token_sold_address + description: "Contract address of the token sold" + - &taker + name: taker + description: "Address of trader who purchased a token" + - &maker + name: maker + description: "Address of trader who sold a token" + - &pool_id + name: pool_id + description: "Unique encoded identifier that refers to each pool" + - &swap_fee + name: swap_fee + description: 'Swap fee' + - &project_contract_address + name: project_contract_address + description: "Pool address" + - &pool_symbol + name: pool_symbol + description: "Token symbols, followed by their respective weights, if applicable" + - &pool_type + name: pool_type + description: "Pool attributes, determined by the pool's factory" + - &tx_hash + name: tx_hash + description: "Tx. Hash" + - &tx_from + name: tx_from + description: "transaction.from" + - &tx_to + name: tx_to + description: "transaction.to" + - &evt_index + name: evt_index + description: 'Event index' + + - name: balancer_v2_arbitrum_trades + meta: + blockchain: arbitrum + sector: dex + contributors: bizzyvinci, thetroyharris, tomfutago, viniabussafi + config: + tags: [ 'balancer', 'arbitrum', 'amm', 'trades', 'dex', 'beta' ] + description: > + DEX trades on balancer v2 on arbitrum + columns: + - *blockchain + - *project + - *version + - *block_month + - *block_date + - *block_time + - *block_number + - *token_bought_symbol + - *token_sold_symbol + - *token_pair + - *token_bought_amount + - *token_sold_amount + - *token_bought_amount_raw + - *token_sold_amount_raw + - *amount_usd + - *token_bought_address + - *token_sold_address + - *taker + - *maker + - *project_contract_address + - *pool_symbol + - *pool_type + - *pool_id + - *swap_fee + - *tx_hash + - *tx_from + - *tx_to + - *evt_index \ No newline at end of file diff --git a/models/balancer/arbitrum/balancer_arbitrum_trades.sql b/models/_project/balancer/trades/arbitrum/balancer_arbitrum_trades.sql similarity index 100% rename from models/balancer/arbitrum/balancer_arbitrum_trades.sql rename to models/_project/balancer/trades/arbitrum/balancer_arbitrum_trades.sql diff --git a/models/balancer/arbitrum/balancer_v2_arbitrum_trades.sql b/models/_project/balancer/trades/arbitrum/balancer_v2_arbitrum_trades.sql similarity index 94% rename from models/balancer/arbitrum/balancer_v2_arbitrum_trades.sql rename to models/_project/balancer/trades/arbitrum/balancer_v2_arbitrum_trades.sql index 750f467f653..2baa6afd2b2 100644 --- a/models/balancer/arbitrum/balancer_v2_arbitrum_trades.sql +++ b/models/_project/balancer/trades/arbitrum/balancer_v2_arbitrum_trades.sql @@ -4,9 +4,9 @@ alias = 'trades', materialized = 'view', post_hook = '{{ expose_spells(\'["arbitrum"]\', - "project", - "balancer_v2", - \'["mendesfabio", "jacektrocinski", "thetroyharris", "tomfutago", "viniabussafi"]\') }}' + spell_type = "project", + spell_name = "balancer", + contributors = \'["mendesfabio", "jacektrocinski", "thetroyharris", "tomfutago", "viniabussafi"]\') }}' ) }} diff --git a/models/_project/balancer/trades/avalanche_c/_schema.yml b/models/_project/balancer/trades/avalanche_c/_schema.yml new file mode 100644 index 00000000000..86aca24b807 --- /dev/null +++ b/models/_project/balancer/trades/avalanche_c/_schema.yml @@ -0,0 +1,149 @@ +version: 2 + +models: + - name: balancer_avalanche_c_trades + meta: + blockchain: avalanche_c + sector: dex + contributors: bizzyvinci, viniabussafi + config: + tags: ['balancer', 'avalanche_c', 'amm', 'trades', 'dex'] + description: > + DEX trades on balancer on avalanche_c + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - block_date + - blockchain + - project + - version + - tx_hash + - evt_index + - check_dex_seed: + blockchain: avalanche_c + project: balancer + version: 2 + columns: + - &blockchain + name: blockchain + description: "Blockchain" + - &project + name: project + description: "Project name (balancer)" + - &version + name: version + description: "Version of the project" + - &block_month + name: block_month + description: "Block month in UTC" + - &block_date + name: block_date + description: "Block date in UTC" + - &block_time + name: block_time + description: 'Block time in UTC' + - &block_number + name: block_number + description: 'Block number' + - &token_bought_symbol + name: token_bought_symbol + description: "Token symbol for token bought in the trade" + - &token_sold_symbol + name: token_sold_symbol + description: "Token symbol for token sold in the trade" + - &token_pair + name: token_pair + description: "Token symbol pair for each token involved in the trade" + - &token_bought_amount + name: token_bought_amount + description: "Value of the token bought at time of execution in the original currency" + - &token_sold_amount + name: token_sold_amount + description: "Value of the token sold at time of execution in the original currency" + - &token_bought_amount_raw + name: token_bought_amount_raw + description: "Raw value of the token bought at time of execution in the original currency" + - &token_sold_amount_raw + name: token_sold_amount_raw + description: "Raw value of the token sold at time of execution in the original currency" + - &amount_usd + name: amount_usd + description: "USD value of the trade at time of execution" + - &token_bought_address + name: token_bought_address + description: "Contract address of the token bought" + - &token_sold_address + name: token_sold_address + description: "Contract address of the token sold" + - &taker + name: taker + description: "Address of trader who purchased a token" + - &maker + name: maker + description: "Address of trader who sold a token" + - &pool_id + name: pool_id + description: "Unique encoded identifier that refers to each pool" + - &swap_fee + name: swap_fee + description: 'Swap fee' + - &project_contract_address + name: project_contract_address + description: "Pool address" + - &pool_symbol + name: pool_symbol + description: "Token symbols, followed by their respective weights, if applicable" + - &pool_type + name: pool_type + description: "Pool attributes, determined by the pool's factory" + - &tx_hash + name: tx_hash + description: "Tx. Hash" + - &tx_from + name: tx_from + description: "transaction.from" + - &tx_to + name: tx_to + description: "transaction.to" + - &evt_index + name: evt_index + description: 'Event index' + + - name: balancer_v2_avalanche_c_trades + meta: + blockchain: avalanche_c + sector: dex + contributors: bizzyvinci, thetroyharris, tomfutago, viniabussafi + config: + tags: [ 'balancer', 'avalanche_c', 'amm', 'trades', 'dex', 'beta' ] + description: > + DEX trades on balancer v2 on avalanche_c + columns: + - *blockchain + - *project + - *version + - *block_month + - *block_date + - *block_time + - *block_number + - *token_bought_symbol + - *token_sold_symbol + - *token_pair + - *token_bought_amount + - *token_sold_amount + - *token_bought_amount_raw + - *token_sold_amount_raw + - *amount_usd + - *token_bought_address + - *token_sold_address + - *taker + - *maker + - *project_contract_address + - *pool_symbol + - *pool_type + - *pool_id + - *swap_fee + - *tx_hash + - *tx_from + - *tx_to + - *evt_index \ No newline at end of file diff --git a/models/balancer/avalanche_c/balancer_avalanche_c_trades.sql b/models/_project/balancer/trades/avalanche_c/balancer_avalanche_c_trades.sql similarity index 100% rename from models/balancer/avalanche_c/balancer_avalanche_c_trades.sql rename to models/_project/balancer/trades/avalanche_c/balancer_avalanche_c_trades.sql diff --git a/models/balancer/avalanche_c/balancer_v2_avalanche_c_trades.sql b/models/_project/balancer/trades/avalanche_c/balancer_v2_avalanche_c_trades.sql similarity index 94% rename from models/balancer/avalanche_c/balancer_v2_avalanche_c_trades.sql rename to models/_project/balancer/trades/avalanche_c/balancer_v2_avalanche_c_trades.sql index 54dfd905dbc..d1a0eb61af5 100644 --- a/models/balancer/avalanche_c/balancer_v2_avalanche_c_trades.sql +++ b/models/_project/balancer/trades/avalanche_c/balancer_v2_avalanche_c_trades.sql @@ -4,10 +4,10 @@ alias = 'trades', materialized = 'view', post_hook = '{{ expose_spells(\'["avalanche_c"]\', - "project", - "balancer_v2", - \'["mendesfabio", "jacektrocinski", "thetroyharris", "tomfutago", "viniabussafi"]\') }}' - ) + spell_type = "project", + spell_name = "balancer", + contributors = \'["mendesfabio", "jacektrocinski", "thetroyharris", "tomfutago", "viniabussafi"]\') }}' + ) }} WITH diff --git a/models/_project/balancer/balancer_trades.sql b/models/_project/balancer/trades/balancer_trades.sql similarity index 100% rename from models/_project/balancer/balancer_trades.sql rename to models/_project/balancer/trades/balancer_trades.sql diff --git a/models/_project/balancer/trades/base/_schema.yml b/models/_project/balancer/trades/base/_schema.yml new file mode 100644 index 00000000000..4a0bd85156f --- /dev/null +++ b/models/_project/balancer/trades/base/_schema.yml @@ -0,0 +1,149 @@ +version: 2 + +models: + - name: balancer_base_trades + meta: + blockchain: base + sector: dex + contributors: bizzyvinci, viniabussafi + config: + tags: ['balancer', 'base', 'amm', 'trades', 'dex'] + description: > + DEX trades on balancer on base + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - block_date + - blockchain + - project + - version + - tx_hash + - evt_index + - check_dex_seed: + blockchain: base + project: balancer + version: 2 + columns: + - &blockchain + name: blockchain + description: "Blockchain" + - &project + name: project + description: "Project name (balancer)" + - &version + name: version + description: "Version of the project" + - &block_month + name: block_month + description: "Block month in UTC" + - &block_date + name: block_date + description: "Block date in UTC" + - &block_time + name: block_time + description: 'Block time in UTC' + - &block_number + name: block_number + description: 'Block number' + - &token_bought_symbol + name: token_bought_symbol + description: "Token symbol for token bought in the trade" + - &token_sold_symbol + name: token_sold_symbol + description: "Token symbol for token sold in the trade" + - &token_pair + name: token_pair + description: "Token symbol pair for each token involved in the trade" + - &token_bought_amount + name: token_bought_amount + description: "Value of the token bought at time of execution in the original currency" + - &token_sold_amount + name: token_sold_amount + description: "Value of the token sold at time of execution in the original currency" + - &token_bought_amount_raw + name: token_bought_amount_raw + description: "Raw value of the token bought at time of execution in the original currency" + - &token_sold_amount_raw + name: token_sold_amount_raw + description: "Raw value of the token sold at time of execution in the original currency" + - &amount_usd + name: amount_usd + description: "USD value of the trade at time of execution" + - &token_bought_address + name: token_bought_address + description: "Contract address of the token bought" + - &token_sold_address + name: token_sold_address + description: "Contract address of the token sold" + - &taker + name: taker + description: "Address of trader who purchased a token" + - &maker + name: maker + description: "Address of trader who sold a token" + - &pool_id + name: pool_id + description: "Unique encoded identifier that refers to each pool" + - &swap_fee + name: swap_fee + description: 'Swap fee' + - &project_contract_address + name: project_contract_address + description: "Pool address" + - &pool_symbol + name: pool_symbol + description: "Token symbols, followed by their respective weights, if applicable" + - &pool_type + name: pool_type + description: "Pool attributes, determined by the pool's factory" + - &tx_hash + name: tx_hash + description: "Tx. Hash" + - &tx_from + name: tx_from + description: "transaction.from" + - &tx_to + name: tx_to + description: "transaction.to" + - &evt_index + name: evt_index + description: 'Event index' + + - name: balancer_v2_base_trades + meta: + blockchain: base + sector: dex + contributors: bizzyvinci, thetroyharris, tomfutago, viniabussafi + config: + tags: [ 'balancer', 'base', 'amm', 'trades', 'dex', 'beta' ] + description: > + DEX trades on balancer v2 on base + columns: + - *blockchain + - *project + - *version + - *block_month + - *block_date + - *block_time + - *block_number + - *token_bought_symbol + - *token_sold_symbol + - *token_pair + - *token_bought_amount + - *token_sold_amount + - *token_bought_amount_raw + - *token_sold_amount_raw + - *amount_usd + - *token_bought_address + - *token_sold_address + - *taker + - *maker + - *project_contract_address + - *pool_symbol + - *pool_type + - *pool_id + - *swap_fee + - *tx_hash + - *tx_from + - *tx_to + - *evt_index \ No newline at end of file diff --git a/models/balancer/base/balancer_base_trades.sql b/models/_project/balancer/trades/base/balancer_base_trades.sql similarity index 100% rename from models/balancer/base/balancer_base_trades.sql rename to models/_project/balancer/trades/base/balancer_base_trades.sql diff --git a/models/balancer/base/balancer_v2_base_trades.sql b/models/_project/balancer/trades/base/balancer_v2_base_trades.sql similarity index 94% rename from models/balancer/base/balancer_v2_base_trades.sql rename to models/_project/balancer/trades/base/balancer_v2_base_trades.sql index ccf037af146..b94589a490a 100644 --- a/models/balancer/base/balancer_v2_base_trades.sql +++ b/models/_project/balancer/trades/base/balancer_v2_base_trades.sql @@ -4,9 +4,9 @@ alias = 'trades', materialized = 'view', post_hook = '{{ expose_spells(\'["base"]\', - "project", - "balancer_v2", - \'["mendesfabio", "jacektrocinski", "thetroyharris", "tomfutago", "viniabussafi"]\') }}' + spell_type = "project", + spell_name = "balancer", + contributors = \'["mendesfabio", "jacektrocinski", "thetroyharris", "tomfutago", "viniabussafi"]\') }}' ) }} diff --git a/models/_project/balancer/trades/ethereum/_schema.yml b/models/_project/balancer/trades/ethereum/_schema.yml new file mode 100644 index 00000000000..42d29d7e17d --- /dev/null +++ b/models/_project/balancer/trades/ethereum/_schema.yml @@ -0,0 +1,145 @@ +version: 2 + +models: + - name: balancer_ethereum_trades + meta: + blockchain: ethereum + sector: dex + contributors: bizzyvinci, thetroyharris, viniabussafi + config: + tags: ['balancer', 'ethereum', 'amm', 'trades', 'dex'] + description: > + DEX trades on balancer on ethereum + columns: + - &blockchain + name: blockchain + description: "Blockchain" + - &project + name: project + description: "Project name (balancer)" + - &version + name: version + description: "Version of the project" + - &block_month + name: block_month + description: "Block month in UTC" + - &block_date + name: block_date + description: "Block date in UTC" + - &block_time + name: block_time + description: 'Block time in UTC' + - &block_number + name: block_number + description: 'Block number' + - &token_bought_symbol + name: token_bought_symbol + description: "Token symbol for token bought in the trade" + - &token_sold_symbol + name: token_sold_symbol + description: "Token symbol for token sold in the trade" + - &token_pair + name: token_pair + description: "Token symbol pair for each token involved in the trade" + - &token_bought_amount + name: token_bought_amount + description: "Value of the token bought at time of execution in the original currency" + - &token_sold_amount + name: token_sold_amount + description: "Value of the token sold at time of execution in the original currency" + - &token_bought_amount_raw + name: token_bought_amount_raw + description: "Raw value of the token bought at time of execution in the original currency" + - &token_sold_amount_raw + name: token_sold_amount_raw + description: "Raw value of the token sold at time of execution in the original currency" + - &amount_usd + name: amount_usd + description: "USD value of the trade at time of execution" + - &token_bought_address + name: token_bought_address + description: "Contract address of the token bought" + - &token_sold_address + name: token_sold_address + description: "Contract address of the token sold" + - &taker + name: taker + description: "Address of trader who purchased a token" + - &maker + name: maker + description: "Address of trader who sold a token" + - &pool_id + name: pool_id + description: "Unique encoded identifier that refers to each pool" + - &swap_fee + name: swap_fee + description: 'Swap fee' + - &project_contract_address + name: project_contract_address + description: "Pool address" + - &pool_symbol + name: pool_symbol + description: "Token symbols, followed by their respective weights, if applicable" + - &pool_type + name: pool_type + description: "Pool attributes, determined by the pool's factory" + - &tx_hash + name: tx_hash + description: "Tx. Hash" + - &tx_from + name: tx_from + description: "transaction.from" + - &tx_to + name: tx_to + description: "transaction.to" + - &evt_index + name: evt_index + description: 'Event index' + + - name: balancer_v1_ethereum_trades + meta: + blockchain: ethereum + sector: dex + contributors: bizzyvinci, thetroyharris, viniabussafi + config: + tags: [ 'balancer', 'ethereum', 'amm', 'trades', 'dex' ] + description: > + DEX trades on balancer v1 on ethereum + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - block_time + - tx_hash + - evt_index + - check_dex_seed: + blockchain: ethereum + project: balancer + version: 1 + columns: + - *blockchain + - *project + - *version + - *block_month + - *block_date + - *block_time + - *token_bought_symbol + - *token_sold_symbol + - *token_pair + - *token_bought_amount + - *token_sold_amount + - *token_bought_amount_raw + - *token_sold_amount_raw + - *amount_usd + - *token_bought_address + - *token_sold_address + - *taker + - *maker + - *pool_id + - *swap_fee + - *project_contract_address + - *pool_symbol + - *pool_type + - *tx_hash + - *tx_from + - *tx_to + - *evt_index \ No newline at end of file diff --git a/models/balancer/ethereum/balancer_ethereum_trades.sql b/models/_project/balancer/trades/ethereum/balancer_ethereum_trades.sql similarity index 100% rename from models/balancer/ethereum/balancer_ethereum_trades.sql rename to models/_project/balancer/trades/ethereum/balancer_ethereum_trades.sql diff --git a/models/balancer/ethereum/balancer_v1_ethereum_trades.sql b/models/_project/balancer/trades/ethereum/balancer_v1_ethereum_trades.sql similarity index 100% rename from models/balancer/ethereum/balancer_v1_ethereum_trades.sql rename to models/_project/balancer/trades/ethereum/balancer_v1_ethereum_trades.sql diff --git a/models/balancer/ethereum/balancer_v2_ethereum_trades.sql b/models/_project/balancer/trades/ethereum/balancer_v2_ethereum_trades.sql similarity index 94% rename from models/balancer/ethereum/balancer_v2_ethereum_trades.sql rename to models/_project/balancer/trades/ethereum/balancer_v2_ethereum_trades.sql index 3fe902cf12b..dfb4c2439bf 100644 --- a/models/balancer/ethereum/balancer_v2_ethereum_trades.sql +++ b/models/_project/balancer/trades/ethereum/balancer_v2_ethereum_trades.sql @@ -4,9 +4,9 @@ alias = 'trades', materialized = 'view', post_hook = '{{ expose_spells(\'["ethereum"]\', - "project", - "balancer_v2", - \'["mendesfabio", "jacektrocinski", "thetroyharris", "tomfutago", "viniabussafi"]\') }}' + spell_type = "project", + spell_name = "balancer", + contributors = \'["mendesfabio", "jacektrocinski", "thetroyharris", "tomfutago", "viniabussafi"]\') }}' ) }} diff --git a/models/_project/balancer/trades/gnosis/_schema.yml b/models/_project/balancer/trades/gnosis/_schema.yml new file mode 100644 index 00000000000..ae5ae4065a2 --- /dev/null +++ b/models/_project/balancer/trades/gnosis/_schema.yml @@ -0,0 +1,149 @@ +version: 2 + +models: + - name: balancer_gnosis_trades + meta: + blockchain: gnosis + sector: dex + contributors: bizzyvinci, viniabussafi + config: + tags: ['balancer', 'gnosis', 'amm', 'trades', 'dex'] + description: > + DEX trades on balancer on gnosis + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - block_date + - blockchain + - project + - version + - tx_hash + - evt_index + - check_dex_seed: + blockchain: gnosis + project: balancer + version: 2 + columns: + - &blockchain + name: blockchain + description: "Blockchain" + - &project + name: project + description: "Project name (balancer)" + - &version + name: version + description: "Version of the project" + - &block_month + name: block_month + description: "Block month in UTC" + - &block_date + name: block_date + description: "Block date in UTC" + - &block_time + name: block_time + description: 'Block time in UTC' + - &block_number + name: block_number + description: 'Block number' + - &token_bought_symbol + name: token_bought_symbol + description: "Token symbol for token bought in the trade" + - &token_sold_symbol + name: token_sold_symbol + description: "Token symbol for token sold in the trade" + - &token_pair + name: token_pair + description: "Token symbol pair for each token involved in the trade" + - &token_bought_amount + name: token_bought_amount + description: "Value of the token bought at time of execution in the original currency" + - &token_sold_amount + name: token_sold_amount + description: "Value of the token sold at time of execution in the original currency" + - &token_bought_amount_raw + name: token_bought_amount_raw + description: "Raw value of the token bought at time of execution in the original currency" + - &token_sold_amount_raw + name: token_sold_amount_raw + description: "Raw value of the token sold at time of execution in the original currency" + - &amount_usd + name: amount_usd + description: "USD value of the trade at time of execution" + - &token_bought_address + name: token_bought_address + description: "Contract address of the token bought" + - &token_sold_address + name: token_sold_address + description: "Contract address of the token sold" + - &taker + name: taker + description: "Address of trader who purchased a token" + - &maker + name: maker + description: "Address of trader who sold a token" + - &pool_id + name: pool_id + description: "Unique encoded identifier that refers to each pool" + - &swap_fee + name: swap_fee + description: 'Swap fee' + - &project_contract_address + name: project_contract_address + description: "Pool address" + - &pool_symbol + name: pool_symbol + description: "Token symbols, followed by their respective weights, if applicable" + - &pool_type + name: pool_type + description: "Pool attributes, determined by the pool's factory" + - &tx_hash + name: tx_hash + description: "Tx. Hash" + - &tx_from + name: tx_from + description: "transaction.from" + - &tx_to + name: tx_to + description: "transaction.to" + - &evt_index + name: evt_index + description: 'Event index' + + - name: balancer_v2_gnosis_trades + meta: + blockchain: gnosis + sector: dex + contributors: bizzyvinci, thetroyharris, tomfutago, viniabussafi + config: + tags: [ 'balancer', 'gnosis', 'amm', 'trades', 'dex', 'beta' ] + description: > + DEX trades on balancer v2 on gnosis + columns: + - *blockchain + - *project + - *version + - *block_month + - *block_date + - *block_time + - *block_number + - *token_bought_symbol + - *token_sold_symbol + - *token_pair + - *token_bought_amount + - *token_sold_amount + - *token_bought_amount_raw + - *token_sold_amount_raw + - *amount_usd + - *token_bought_address + - *token_sold_address + - *taker + - *maker + - *project_contract_address + - *pool_symbol + - *pool_type + - *pool_id + - *swap_fee + - *tx_hash + - *tx_from + - *tx_to + - *evt_index \ No newline at end of file diff --git a/models/balancer/gnosis/balancer_gnosis_trades.sql b/models/_project/balancer/trades/gnosis/balancer_gnosis_trades.sql similarity index 100% rename from models/balancer/gnosis/balancer_gnosis_trades.sql rename to models/_project/balancer/trades/gnosis/balancer_gnosis_trades.sql diff --git a/models/balancer/gnosis/balancer_v2_gnosis_trades.sql b/models/_project/balancer/trades/gnosis/balancer_v2_gnosis_trades.sql similarity index 94% rename from models/balancer/gnosis/balancer_v2_gnosis_trades.sql rename to models/_project/balancer/trades/gnosis/balancer_v2_gnosis_trades.sql index c895c351328..090b5b9e737 100644 --- a/models/balancer/gnosis/balancer_v2_gnosis_trades.sql +++ b/models/_project/balancer/trades/gnosis/balancer_v2_gnosis_trades.sql @@ -4,9 +4,9 @@ alias = 'trades', materialized = 'view', post_hook = '{{ expose_spells(\'["gnosis"]\', - "project", - "balancer_v2", - \'["mendesfabio", "jacektrocinski", "thetroyharris", "tomfutago", "viniabussafi"]\') }}' + spell_type = "project", + spell_name = "balancer", + contributors = \'["mendesfabio", "jacektrocinski", "thetroyharris", "tomfutago", "viniabussafi"]\') }}' ) }} diff --git a/models/_project/balancer/trades/optimism/_schema.yml b/models/_project/balancer/trades/optimism/_schema.yml new file mode 100644 index 00000000000..481a7f9073b --- /dev/null +++ b/models/_project/balancer/trades/optimism/_schema.yml @@ -0,0 +1,149 @@ +version: 2 + +models: + - name: balancer_optimism_trades + meta: + blockchain: optimism + sector: dex + contributors: bizzyvinci, viniabussafi + config: + tags: ['balancer', 'optimism', 'amm', 'trades', 'dex'] + description: > + DEX trades on balancer on optimism + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - block_date + - blockchain + - project + - version + - tx_hash + - evt_index + - check_dex_seed: + blockchain: optimism + project: balancer + version: 2 + columns: + - &blockchain + name: blockchain + description: "Blockchain" + - &project + name: project + description: "Project name (balancer)" + - &version + name: version + description: "Version of the project" + - &block_month + name: block_month + description: "Block month in UTC" + - &block_date + name: block_date + description: "Block date in UTC" + - &block_time + name: block_time + description: 'Block time in UTC' + - &block_number + name: block_number + description: 'Block number' + - &token_bought_symbol + name: token_bought_symbol + description: "Token symbol for token bought in the trade" + - &token_sold_symbol + name: token_sold_symbol + description: "Token symbol for token sold in the trade" + - &token_pair + name: token_pair + description: "Token symbol pair for each token involved in the trade" + - &token_bought_amount + name: token_bought_amount + description: "Value of the token bought at time of execution in the original currency" + - &token_sold_amount + name: token_sold_amount + description: "Value of the token sold at time of execution in the original currency" + - &token_bought_amount_raw + name: token_bought_amount_raw + description: "Raw value of the token bought at time of execution in the original currency" + - &token_sold_amount_raw + name: token_sold_amount_raw + description: "Raw value of the token sold at time of execution in the original currency" + - &amount_usd + name: amount_usd + description: "USD value of the trade at time of execution" + - &token_bought_address + name: token_bought_address + description: "Contract address of the token bought" + - &token_sold_address + name: token_sold_address + description: "Contract address of the token sold" + - &taker + name: taker + description: "Address of trader who purchased a token" + - &maker + name: maker + description: "Address of trader who sold a token" + - &pool_id + name: pool_id + description: "Unique encoded identifier that refers to each pool" + - &swap_fee + name: swap_fee + description: 'Swap fee' + - &project_contract_address + name: project_contract_address + description: "Pool address" + - &pool_symbol + name: pool_symbol + description: "Token symbols, followed by their respective weights, if applicable" + - &pool_type + name: pool_type + description: "Pool attributes, determined by the pool's factory" + - &tx_hash + name: tx_hash + description: "Tx. Hash" + - &tx_from + name: tx_from + description: "transaction.from" + - &tx_to + name: tx_to + description: "transaction.to" + - &evt_index + name: evt_index + description: 'Event index' + + - name: balancer_v2_optimism_trades + meta: + blockchain: optimism + sector: dex + contributors: bizzyvinci, thetroyharris, tomfutago, viniabussafi + config: + tags: [ 'balancer', 'optimism', 'amm', 'trades', 'dex', 'beta' ] + description: > + DEX trades on balancer v2 on optimism + columns: + - *blockchain + - *project + - *version + - *block_month + - *block_date + - *block_time + - *block_number + - *token_bought_symbol + - *token_sold_symbol + - *token_pair + - *token_bought_amount + - *token_sold_amount + - *token_bought_amount_raw + - *token_sold_amount_raw + - *amount_usd + - *token_bought_address + - *token_sold_address + - *taker + - *maker + - *project_contract_address + - *pool_symbol + - *pool_type + - *pool_id + - *swap_fee + - *tx_hash + - *tx_from + - *tx_to + - *evt_index \ No newline at end of file diff --git a/models/balancer/optimism/balancer_optimism_trades.sql b/models/_project/balancer/trades/optimism/balancer_optimism_trades.sql similarity index 100% rename from models/balancer/optimism/balancer_optimism_trades.sql rename to models/_project/balancer/trades/optimism/balancer_optimism_trades.sql diff --git a/models/balancer/optimism/balancer_v2_optimism_trades.sql b/models/_project/balancer/trades/optimism/balancer_v2_optimism_trades.sql similarity index 94% rename from models/balancer/optimism/balancer_v2_optimism_trades.sql rename to models/_project/balancer/trades/optimism/balancer_v2_optimism_trades.sql index 03327617f4f..b53e845ddd6 100644 --- a/models/balancer/optimism/balancer_v2_optimism_trades.sql +++ b/models/_project/balancer/trades/optimism/balancer_v2_optimism_trades.sql @@ -4,9 +4,9 @@ alias = 'trades', materialized = 'view', post_hook = '{{ expose_spells(\'["optimism"]\', - "project", - "balancer_v2", - \'["mendesfabio", "jacektrocinski", "thetroyharris", "tomfutago", "viniabussafi"]\') }}' + spell_type = "project", + spell_name = "balancer", + contributors = \'["mendesfabio", "jacektrocinski", "thetroyharris", "tomfutago", "viniabussafi"]\') }}' ) }} diff --git a/models/_project/balancer/trades/polygon/_schema.yml b/models/_project/balancer/trades/polygon/_schema.yml new file mode 100644 index 00000000000..c0dfa6ac51b --- /dev/null +++ b/models/_project/balancer/trades/polygon/_schema.yml @@ -0,0 +1,149 @@ +version: 2 + +models: + - name: balancer_polygon_trades + meta: + blockchain: polygon + sector: dex + contributors: bizzyvinci, viniabussafi + config: + tags: ['balancer', 'polygon', 'amm', 'trades', 'dex'] + description: > + DEX trades on balancer on polygon + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - block_date + - blockchain + - project + - version + - tx_hash + - evt_index + - check_dex_seed: + blockchain: polygon + project: balancer + version: 2 + columns: + - &blockchain + name: blockchain + description: "Blockchain" + - &project + name: project + description: "Project name (balancer)" + - &version + name: version + description: "Version of the project" + - &block_month + name: block_month + description: "Block month in UTC" + - &block_date + name: block_date + description: "Block date in UTC" + - &block_time + name: block_time + description: 'Block time in UTC' + - &block_number + name: block_number + description: 'Block number' + - &token_bought_symbol + name: token_bought_symbol + description: "Token symbol for token bought in the trade" + - &token_sold_symbol + name: token_sold_symbol + description: "Token symbol for token sold in the trade" + - &token_pair + name: token_pair + description: "Token symbol pair for each token involved in the trade" + - &token_bought_amount + name: token_bought_amount + description: "Value of the token bought at time of execution in the original currency" + - &token_sold_amount + name: token_sold_amount + description: "Value of the token sold at time of execution in the original currency" + - &token_bought_amount_raw + name: token_bought_amount_raw + description: "Raw value of the token bought at time of execution in the original currency" + - &token_sold_amount_raw + name: token_sold_amount_raw + description: "Raw value of the token sold at time of execution in the original currency" + - &amount_usd + name: amount_usd + description: "USD value of the trade at time of execution" + - &token_bought_address + name: token_bought_address + description: "Contract address of the token bought" + - &token_sold_address + name: token_sold_address + description: "Contract address of the token sold" + - &taker + name: taker + description: "Address of trader who purchased a token" + - &maker + name: maker + description: "Address of trader who sold a token" + - &pool_id + name: pool_id + description: "Unique encoded identifier that refers to each pool" + - &swap_fee + name: swap_fee + description: 'Swap fee' + - &project_contract_address + name: project_contract_address + description: "Pool address" + - &pool_symbol + name: pool_symbol + description: "Token symbols, followed by their respective weights, if applicable" + - &pool_type + name: pool_type + description: "Pool attributes, determined by the pool's factory" + - &tx_hash + name: tx_hash + description: "Tx. Hash" + - &tx_from + name: tx_from + description: "transaction.from" + - &tx_to + name: tx_to + description: "transaction.to" + - &evt_index + name: evt_index + description: 'Event index' + + - name: balancer_v2_polygon_trades + meta: + blockchain: polygon + sector: dex + contributors: bizzyvinci, thetroyharris, tomfutago, viniabussafi + config: + tags: [ 'balancer', 'polygon', 'amm', 'trades', 'dex', 'beta' ] + description: > + DEX trades on balancer v2 on polygon + columns: + - *blockchain + - *project + - *version + - *block_month + - *block_date + - *block_time + - *block_number + - *token_bought_symbol + - *token_sold_symbol + - *token_pair + - *token_bought_amount + - *token_sold_amount + - *token_bought_amount_raw + - *token_sold_amount_raw + - *amount_usd + - *token_bought_address + - *token_sold_address + - *taker + - *maker + - *project_contract_address + - *pool_symbol + - *pool_type + - *pool_id + - *swap_fee + - *tx_hash + - *tx_from + - *tx_to + - *evt_index \ No newline at end of file diff --git a/models/balancer/polygon/balancer_polygon_trades.sql b/models/_project/balancer/trades/polygon/balancer_polygon_trades.sql similarity index 100% rename from models/balancer/polygon/balancer_polygon_trades.sql rename to models/_project/balancer/trades/polygon/balancer_polygon_trades.sql diff --git a/models/balancer/polygon/balancer_v2_polygon_trades.sql b/models/_project/balancer/trades/polygon/balancer_v2_polygon_trades.sql similarity index 94% rename from models/balancer/polygon/balancer_v2_polygon_trades.sql rename to models/_project/balancer/trades/polygon/balancer_v2_polygon_trades.sql index a17dabab52d..37b12105abe 100644 --- a/models/balancer/polygon/balancer_v2_polygon_trades.sql +++ b/models/_project/balancer/trades/polygon/balancer_v2_polygon_trades.sql @@ -4,9 +4,9 @@ alias = 'trades', materialized = 'view', post_hook = '{{ expose_spells(\'["polygon"]\', - "project", - "balancer_v2", - \'["mendesfabio", "jacektrocinski", "thetroyharris", "tomfutago", "viniabussafi"]\') }}' + spell_type = "project", + spell_name = "balancer", + contributors = \'["mendesfabio", "jacektrocinski", "thetroyharris", "tomfutago", "viniabussafi"]\') }}' ) }} diff --git a/models/_project/balancer/trades/zkevm/_schema.yml b/models/_project/balancer/trades/zkevm/_schema.yml new file mode 100644 index 00000000000..80f42ffe980 --- /dev/null +++ b/models/_project/balancer/trades/zkevm/_schema.yml @@ -0,0 +1,110 @@ +version: 2 + +models: + - name: balancer_zkevm_trades + meta: + blockchain: zkevm + sector: dex + contributors: bizzyvinci, viniabussafi + config: + tags: ['balancer', 'zkevm', 'amm', 'trades', 'dex'] + description: > + DEX trades on balancer on zkevm + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - block_date + - blockchain + - project + - version + - tx_hash + - evt_index + - check_dex_seed: + blockchain: zkevm + project: balancer + version: 2 + columns: + - &blockchain + name: blockchain + description: "Blockchain" + - &project + name: project + description: "Project name (balancer)" + - &version + name: version + description: "Version of the project" + - &block_month + name: block_month + description: "Block month in UTC" + - &block_date + name: block_date + description: "Block date in UTC" + - &block_time + name: block_time + description: 'Block time in UTC' + - &block_number + name: block_number + description: 'Block number' + - &token_bought_symbol + name: token_bought_symbol + description: "Token symbol for token bought in the trade" + - &token_sold_symbol + name: token_sold_symbol + description: "Token symbol for token sold in the trade" + - &token_pair + name: token_pair + description: "Token symbol pair for each token involved in the trade" + - &token_bought_amount + name: token_bought_amount + description: "Value of the token bought at time of execution in the original currency" + - &token_sold_amount + name: token_sold_amount + description: "Value of the token sold at time of execution in the original currency" + - &token_bought_amount_raw + name: token_bought_amount_raw + description: "Raw value of the token bought at time of execution in the original currency" + - &token_sold_amount_raw + name: token_sold_amount_raw + description: "Raw value of the token sold at time of execution in the original currency" + - &amount_usd + name: amount_usd + description: "USD value of the trade at time of execution" + - &token_bought_address + name: token_bought_address + description: "Contract address of the token bought" + - &token_sold_address + name: token_sold_address + description: "Contract address of the token sold" + - &taker + name: taker + description: "Address of trader who purchased a token" + - &maker + name: maker + description: "Address of trader who sold a token" + - &pool_id + name: pool_id + description: "Unique encoded identifier that refers to each pool" + - &swap_fee + name: swap_fee + description: 'Swap fee' + - &project_contract_address + name: project_contract_address + description: "Pool address" + - &pool_symbol + name: pool_symbol + description: "Token symbols, followed by their respective weights, if applicable" + - &pool_type + name: pool_type + description: "Pool attributes, determined by the pool's factory" + - &tx_hash + name: tx_hash + description: "Tx. Hash" + - &tx_from + name: tx_from + description: "transaction.from" + - &tx_to + name: tx_to + description: "transaction.to" + - &evt_index + name: evt_index + description: 'Event index' \ No newline at end of file diff --git a/models/balancer/zkevm/balancer_v2_zkevm_trades.sql b/models/_project/balancer/trades/zkevm/balancer_v2_zkevm_trades.sql similarity index 94% rename from models/balancer/zkevm/balancer_v2_zkevm_trades.sql rename to models/_project/balancer/trades/zkevm/balancer_v2_zkevm_trades.sql index 340fbe1dbd8..36cc38e4a44 100644 --- a/models/balancer/zkevm/balancer_v2_zkevm_trades.sql +++ b/models/_project/balancer/trades/zkevm/balancer_v2_zkevm_trades.sql @@ -4,9 +4,9 @@ alias = 'trades', materialized = 'view', post_hook = '{{ expose_spells(\'["zkevm"]\', - "project", - "balancer_v2", - \'["mendesfabio", "jacektrocinski", "thetroyharris", "tomfutago", "viniabussafi"]\') }}' + spell_type = "project", + spell_name = "balancer", + contributors = \'["mendesfabio", "jacektrocinski", "thetroyharris", "tomfutago", "viniabussafi"]\') }}' ) }} diff --git a/models/balancer/zkevm/balancer_zkevm_trades.sql b/models/_project/balancer/trades/zkevm/balancer_zkevm_trades.sql similarity index 100% rename from models/balancer/zkevm/balancer_zkevm_trades.sql rename to models/_project/balancer/trades/zkevm/balancer_zkevm_trades.sql diff --git a/models/_project/balancer/vebal/ethereum/_schema.yml b/models/_project/balancer/vebal/ethereum/_schema.yml new file mode 100644 index 00000000000..ab2ba4d4bdf --- /dev/null +++ b/models/_project/balancer/vebal/ethereum/_schema.yml @@ -0,0 +1,91 @@ +version: 2 + +models: + - name: balancer_ethereum_vebal_balances_day + meta: + blockchain: ethereum + project: balancer + contributors: markusbkoch, mendesfabio, victorstefenon, viniabussafi + config: + tags: ['balancer', 'ethereum', 'vebal', 'day'] + description: > + Daily balances of veBAL per wallet + Depends on veBAL_call_create_lock, veBAL_evt_Deposit and veBAL_evt_Withdraw + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - day + - wallet_address + columns: + - name: day + - name: wallet_address + description: "Address of the wallet holding the veBAL" + - name: bpt_balance + description: "Amount of BPT held in the veBAL lock" + - name: vebal_balance + description: "Amount of veBAL" + - name: lock_time + description: "Amount of time the BPT was locked for at the last time the lock was updated" + + - name: balancer_ethereum_vebal_slopes + meta: + blockchain: ethereum + project: balancer + contributors: markusbkoch, mendesfabio, victorstefenon, viniabussafi + config: + tags: ['balancer', 'ethereum', 'vebal', 'slope'] + description: > + Slope and bias of veBAL per wallet after each balance update + Depends on veBAL_call_create_lock, veBAL_evt_Deposit and veBAL_evt_Withdraw + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - block_number + - wallet_address + columns: + - name: block_number + - name: block_time + - name: block_timestamp + description: "Block timestamp" + - name: wallet_address + description: "Address of the wallet holding the veBAL" + - name: bpt_balance + description: "Amount of BPT held in the veBAL lock" + - name: unlocked_at + description: "Timestamp at which B-80BAL-20WETH BPT can be unlocked" + - name: slope + description: "veBAL decay rate (per second)" + - name: bias + description: "veBAL balance at the moment user locks or re-locks" + - name: block_date + description: "Block time trunc to date" + + - name: balancer_ethereum_vebal_votes + meta: + blockchain: ethereum + project: balancer + contributors: markusbkoch, mendesfabio, stefenon, viniabussafi + config: + tags: ['balancer', 'ethereum', 'vebal', 'votes'] + description: > + Records of votes for Balancer gauges by provider at each voting round + Depends on GaugeController_evt_VoteForGauge and the vebal_slopes spell + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - round_id + - gauge + - provider + columns: + - name: round_id + description: "ID of the voting round" + - name: start_date + description: "Day of the voting round start date" + - name: end_date + description: "Day of the voting round end date" + - name: gauge + description: "Address of the gauge which provider votes for" + - name: provider + description: "Address of the wallet which voted for the gauge" + - name: vote + description: "Weight of the vote performed by the provider for the gauge" \ No newline at end of file diff --git a/models/balancer/ethereum/balancer_ethereum_vebal_balances_day.sql b/models/_project/balancer/vebal/ethereum/balancer_ethereum_vebal_balances_day.sql similarity index 94% rename from models/balancer/ethereum/balancer_ethereum_vebal_balances_day.sql rename to models/_project/balancer/vebal/ethereum/balancer_ethereum_vebal_balances_day.sql index 31df281cbcf..dbeb8065ba9 100644 --- a/models/balancer/ethereum/balancer_ethereum_vebal_balances_day.sql +++ b/models/_project/balancer/vebal/ethereum/balancer_ethereum_vebal_balances_day.sql @@ -1,12 +1,11 @@ {{ config( schema="balancer_ethereum", - alias = 'vebal_balances_day', post_hook='{{ expose_spells(\'["ethereum"]\', - "project", - "balancer", - \'["markusbkoch", "mendesfabio", "stefenon", "viniabussafi"]\') }}' + spell_type = "project", + spell_name = "balancer", + contributors = \'["markusbkoch", "mendesfabio", "stefenon", "viniabussafi"]\') }}' ) }} diff --git a/models/balancer/ethereum/balancer_ethereum_vebal_slopes.sql b/models/_project/balancer/vebal/ethereum/balancer_ethereum_vebal_slopes.sql similarity index 93% rename from models/balancer/ethereum/balancer_ethereum_vebal_slopes.sql rename to models/_project/balancer/vebal/ethereum/balancer_ethereum_vebal_slopes.sql index 7f549cd9a81..bf49f4f5471 100644 --- a/models/balancer/ethereum/balancer_ethereum_vebal_slopes.sql +++ b/models/_project/balancer/vebal/ethereum/balancer_ethereum_vebal_slopes.sql @@ -1,12 +1,11 @@ {{ config( - schema="balancer_ethereum", - + schema="balancer_ethereum", alias = 'vebal_slopes', post_hook='{{ expose_spells(\'["ethereum"]\', - "project", - "balancer", - \'["markusbkoch", "mendesfabio", "stefenon", "viniabussafi"]\') }}' + spell_type = "project", + spell_name = "balancer", + contributors = \'["markusbkoch", "mendesfabio", "stefenon", "viniabussafi"]\') }}' ) }} diff --git a/models/balancer/ethereum/balancer_ethereum_vebal_votes.sql b/models/_project/balancer/vebal/ethereum/balancer_ethereum_vebal_votes.sql similarity index 92% rename from models/balancer/ethereum/balancer_ethereum_vebal_votes.sql rename to models/_project/balancer/vebal/ethereum/balancer_ethereum_vebal_votes.sql index 17929d1105c..d52c0fe757f 100644 --- a/models/balancer/ethereum/balancer_ethereum_vebal_votes.sql +++ b/models/_project/balancer/vebal/ethereum/balancer_ethereum_vebal_votes.sql @@ -1,13 +1,13 @@ {{ config( - + schema = 'balancer_ethereum', alias = 'vebal_votes', materialized = 'table', file_format = 'delta', post_hook='{{ expose_spells(\'["ethereum"]\', - "project", - "balancer", - \'["markusbkoch", "mendesfabio", "stefenon", "viniabussafi"]\') }}' + spell_type = "project", + spell_name = "balancer", + contributors = \'["markusbkoch", "mendesfabio", "stefenon", "viniabussafi"]\') }}' ) }} diff --git a/models/balancer/arbitrum/balancer_arbitrum_schema.yml b/models/balancer/arbitrum/balancer_arbitrum_schema.yml deleted file mode 100644 index c533ff3ff10..00000000000 --- a/models/balancer/arbitrum/balancer_arbitrum_schema.yml +++ /dev/null @@ -1,432 +0,0 @@ -version: 2 - -models: - - name: balancer_v2_arbitrum_pools_fees - meta: - blockchain: arbitrum - project: balancer_v2 - contributors: jacektrocinski, thetroyharris, viniabussafi - config: - tags: ['arbitrum', 'balancer', 'pools_fees'] - description: > - Balancer v2 swap fees stored at the pool level. - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - block_number - - tx_hash - - index - columns: - - name: blockchain - - name: version - - &contract_address - name: contract_address - description: 'Arbitrum address for the liquidity pool used in transaction' - tests: - - not_null - - &tx_hash - name: tx_hash - description: 'Transaction hash' - tests: - - not_null - - &index - name: index - description: '' - tests: - - not_null - - &tx_index - name: tx_index - description: '' - tests: - - not_null - - &block_time - name: block_time - description: 'Block time in UTC' - tests: - - not_null - - &block_number - name: block_number - description: '' - tests: - - not_null - - &swap_fee_percentage - name: swap_fee_percentage - description: 'Swap fees for the pool, values are returned with 18 decimals (1e18 meaning 100%)' - tests: - - not_null - - - name: balancer_v2_arbitrum_transfers_bpt - meta: - blockchain: arbitrum - project: balancer_v2 - contributors: victorstefenon, thetroyharris, viniabussafi - config: - tags: ['arbitrum', 'bpt', 'transfers'] - description: > - Balancer Pool Token (BPT) transfer logs on Balancer, an automated portfolio manager and trading platform, on Arbitrum. - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - evt_tx_hash - - evt_index - - block_date - columns: - - &blockchain - name: blockchain - description: "Blockchain" - - name: version - - *contract_address - - &block_date - name: block_date - description: "UTC event block date of each DEX trade" - - &block_month - name: block_month - description: "UTC event block month of each DEX trade" - - &evt_tx_hash - name: evt_tx_hash - description: 'Transaction hash of transfer event' - - &evt_index - name: evt_index - description: 'Event index' - - &evt_block_time - name: evt_block_time - description: 'Block time of transfer event' - - &evt_block_number - name: evt_block_number - description: 'Block number of transfer event' - - &from - name: from - description: 'Address of BPT provider of transfer event' - - &to - name: to - description: 'Address of BPT receiver of transfer event' - - &value - name: value - description: 'Amount of BPT transferred in transfer event' - - - name: balancer_arbitrum_pools_tokens_weights - meta: - blockchain: arbitrum - project: balancer - contributors: jacektrocinski, viniabussafi - config: - tags: ['arbitrum', 'balancer', 'pools', 'tokens', 'weights'] - description: > - Token weights in Balancer pools. - columns: - - *blockchain - - name: version - - &pool_id - name: pool_id - description: 'Unique encoded identifier that refers to each pool' - tests: - - not_null - - &token_address - name: token_address - description: 'Contract address for the token' - - &normalized_weight - name: normalized_weight - description: 'Weight of the token in the pool.' - - - name: balancer_v2_arbitrum_pools_tokens_weights - meta: - blockchain: arbitrum - project: balancer - contributors: jacektrocinski, viniabussafi - config: - tags: ['arbitrum', 'balancer', 'pools', 'tokens', 'weights'] - description: > - Token weights in Balancer v2 pools. - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - pool_id - - token_address - columns: - - *blockchain - - name: version - - *pool_id - - *token_address - - *normalized_weight - - - name: balancer_arbitrum_trades - meta: - blockchain: arbitrum - sector: dex - contributors: bizzyvinci - config: - tags: ['balancer', 'arbitrum', 'amm', 'trades', 'dex'] - description: > - DEX trades on balancer on arbitrum - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - block_date - - blockchain - - project - - version - - tx_hash - - evt_index - - check_dex_seed: - blockchain: arbitrum - project: balancer - version: 2 - columns: - - *blockchain - - &project - name: project - description: "Project name (balancer)" - - &version - name: version - description: "Version of the project" - - *block_month - - *block_date - - *block_time - - &token_bought_symbol - name: token_bought_symbol - description: "Token symbol for token bought in the trade" - - &token_sold_symbol - name: token_sold_symbol - description: "Token symbol for token sold in the trade" - - &token_pair - name: token_pair - description: "Token symbol pair for each token involved in the trade" - - &token_bought_amount - name: token_bought_amount - description: "Value of the token bought at time of execution in the original currency" - - &token_sold_amount - name: token_sold_amount - description: "Value of the token sold at time of execution in the original currency" - - &token_bought_amount_raw - name: token_bought_amount_raw - description: "Raw value of the token bought at time of execution in the original currency" - - &token_sold_amount_raw - name: token_sold_amount_raw - description: "Raw value of the token sold at time of execution in the original currency" - - &amount_usd - name: amount_usd - description: "USD value of the trade at time of execution" - - &token_bought_address - name: token_bought_address - description: "Contract address of the token bought" - - &token_sold_address - name: token_sold_address - description: "Contract address of the token sold" - - &taker - name: taker - description: "Address of trader who purchased a token" - - &maker - name: maker - description: "Address of trader who sold a token" - - *pool_id - - &swap_fee - name: swap_fee - description: 'Swap fee' - - &project_contract_address - name: project_contract_address - description: "Pool address" - - name: pool_symbol - - name: pool_type - - *tx_hash - - &tx_from - name: tx_from - description: "transaction.from" - - &tx_to - name: tx_to - description: "transaction.to" - - *evt_index - - - name: balancer_v2_arbitrum_trades - meta: - blockchain: arbitrum - sector: dex - contributors: bizzyvinci, thetroyharris, tomfutago, viniabussafi - config: - tags: [ 'balancer', 'arbitrum', 'amm', 'trades', 'dex', 'beta' ] - description: > - DEX trades on balancer v2 on arbitrum - columns: - - *blockchain - - *project - - *version - - *block_month - - *block_date - - *block_time - - *block_number - - *token_bought_symbol - - *token_sold_symbol - - *token_pair - - *token_bought_amount - - *token_sold_amount - - *token_bought_amount_raw - - *token_sold_amount_raw - - *amount_usd - - *token_bought_address - - *token_sold_address - - *taker - - *maker - - *project_contract_address - - name: pool_symbol - - name: pool_type - - *pool_id - - *swap_fee - - *tx_hash - - *tx_from - - *tx_to - - *evt_index - - - name: balancer_v2_arbitrum_liquidity - meta: - blockchain: arbitrum - project: balancer_v2 - contributors: victorstefenon, viniabussafi, thetroyharris - config: - tags: ['arbitrum', 'balancer', 'pools', 'liquidity'] - description: > - Balancer v2 pools liquidity by token in Arbitrum. - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - day - - pool_id - - token_address - columns: - - name: day - description: 'UTC event block time truncated to the day mark' - - *pool_id - - name: pool_address - - name: pool_symbol - description: 'Symbol of the pool, consisting of the symbol of its tokens and their respective weights' - - name: version - description: 'Version of Balancer in which pool was deployed' - - name: blockchain - description: 'Blockchain in which pool was deployed' - - *token_address - - name: token_symbol - description: 'Symbol of the token' - - name: token_balance_raw - description: 'Raw balance of the token in the pool' - - name: token_balance - description: 'Scaled balance of the token in the pool' - - name: protocol_liquidity_usd - description: 'Liquidity of the token in the pool in USD, except BPTs' - - name: protocol_liquidity_eth - description: 'Liquidity of the token in the pool in ETH, except BPTs' - - name: pool_liquidity_usd - description: 'Liquidity of the token in the pool in USD, including BPTs' - - name: pool_liquidity_eth - description: 'Liquidity of the token in the pool in ETH, including BPTs' - - - - name: balancer_v2_arbitrum_flashloans - meta: - blockchain: arbitrum - sector: lending - contributors: hildobby - config: - tags: ['arbitrum', 'flashloans'] - description: > - All Balancer v2 flashloans on Arbitrum - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - blockchain - - tx_hash - - evt_index - columns: - - name: blockchain - - name: project - - name: version - - name: block_time - - name: block_number - - name: amount - - name: amount_usd - - name: tx_hash - - name: evt_index - - name: fee - - name: currency_contract - - name: currency_symbol - - name: recipient - - name: contract_address - - name: block_month - - - name: balancer_v2_arbitrum_bpt_prices - meta: - blockchain: arbitrum - project: balancer_v2 - contributors: victorstefenon, thetroyharris, viniabussafi - config: - tags: ['arbitrum', 'bpt', 'prices'] - description: > - Balancer Pool Token (BPT) daily price by pool on Balancer, an automated portfolio manager and trading platform. - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - blockchain - - day - - contract_address - columns: - - name: blockchain - - name: day - - name: version - - name: decimals - - name: contract_address - - name: bpt_price - - - name: balancer_v2_arbitrum_protocol_fee - meta: - blockchain: arbitrum - project: balancer_v2 - contributors: viniabussafi - config: - tags: ['arbitrum', 'revenue', 'fees'] - description: > - Daily Protocol Fee collected and Revenue by pool on Balancer, an automated portfolio manager and trading platform. - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - day - - pool_id - - token_address - columns: - - name: day - - name: pool_id - - name: pool_address - - name: pool_symbol - - name: version - - name: blockchain - - name: token_address - - name: token_symbol - - name: token_amount_raw - description: "Raw amount of revenues of the token in the pool" - - name: token_amount - description: "Amount of revenues of the token in the pool" - - name: protocol_fee_collected_usd - description: "Fee collected in the pool in USD" - - name: treasury_share - description: "Share of total revenue that is directed to Balancer DAO's treasury, as per BIPs 19, 161 and 371" - - name: treasury_revenue_usd - description: "Total revenue directed to Balancer DAO's treasury" - - - name: balancer_v2_arbitrum_bpt_supply - meta: - blockchain: arbiturm - project: balancer_v2 - contributors: thetroyharris, viniabussafi - config: - tags: ['arbiturm', 'bpt', 'supply'] - description: > - Balancer Pool Token (BPT) supply for ComposableStablePools versions 4 and 5. - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - day - - blockchain - - token_address - columns: - - name: day - - name: pool_type - - name: version - - name: blockchain - - name: token_address - - name: supply \ No newline at end of file diff --git a/models/balancer/avalanche_c/balancer_avalanche_c_schema.yml b/models/balancer/avalanche_c/balancer_avalanche_c_schema.yml deleted file mode 100644 index 93cc2e87629..00000000000 --- a/models/balancer/avalanche_c/balancer_avalanche_c_schema.yml +++ /dev/null @@ -1,405 +0,0 @@ -version: 2 - -models: - - - name: balancer_avalanche_c_trades - meta: - blockchain: avalanche_c - sector: dex - contributors: bizzyvinci - config: - tags: ['balancer', 'avalanche_c', 'amm', 'trades', 'dex'] - description: > - DEX trades on balancer on avalanche_c - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - block_date - - blockchain - - project - - version - - tx_hash - - evt_index - - check_dex_seed: - blockchain: avalanche_c - project: balancer - version: 2 - columns: - - &blockchain - name: blockchain - description: "Blockchain" - - &project - name: project - description: "Project name (balancer)" - - &version - name: version - description: "Version of the project" - - &block_month - name: block_month - description: "Block month in UTC" - - &block_date - name: block_date - description: "Block date in UTC" - - &block_time - name: block_time - description: 'Block time in UTC' - - &token_bought_symbol - name: token_bought_symbol - description: "Token symbol for token bought in the trade" - - &token_sold_symbol - name: token_sold_symbol - description: "Token symbol for token sold in the trade" - - &token_pair - name: token_pair - description: "Token symbol pair for each token involved in the trade" - - &token_bought_amount - name: token_bought_amount - description: "Value of the token bought at time of execution in the original currency" - - &token_sold_amount - name: token_sold_amount - description: "Value of the token sold at time of execution in the original currency" - - &token_bought_amount_raw - name: token_bought_amount_raw - description: "Raw value of the token bought at time of execution in the original currency" - - &token_sold_amount_raw - name: token_sold_amount_raw - description: "Raw value of the token sold at time of execution in the original currency" - - &amount_usd - name: amount_usd - description: "USD value of the trade at time of execution" - - &token_bought_address - name: token_bought_address - description: "Contract address of the token bought" - - &token_sold_address - name: token_sold_address - description: "Contract address of the token sold" - - &taker - name: taker - description: "Address of trader who purchased a token" - - &maker - name: maker - description: "Address of trader who sold a token" - - &pool_id - name: pool_id - description: 'Unique encoded identifier that refers to each pool' - - &swap_fee - name: swap_fee - description: 'Swap fee' - - &project_contract_address - name: project_contract_address - description: "Pool address" - - name: pool_symbol - - name: pool_type - - &tx_hash - name: tx_hash - description: "Transaction hash" - - &tx_from - name: tx_from - description: "transaction.from" - - &tx_to - name: tx_to - description: "transaction.to" - - &evt_index - name: evt_index - description: "Event index" - - - name: balancer_v2_avalanche_c_trades - meta: - blockchain: avalanche_c - sector: dex - contributors: bizzyvinci, thetroyharris, tomfutago, viniabussafi - config: - tags: [ 'balancer', 'avalanche_c', 'amm', 'trades', 'dex', 'beta' ] - description: > - DEX trades on balancer v2 on avalanche_c - columns: - - *blockchain - - *project - - *version - - *block_month - - *block_date - - *block_time - - name: block_number - - *token_bought_symbol - - *token_sold_symbol - - *token_pair - - *token_bought_amount - - *token_sold_amount - - *token_bought_amount_raw - - *token_sold_amount_raw - - *amount_usd - - *token_bought_address - - *token_sold_address - - *taker - - *maker - - *project_contract_address - - name: pool_symbol - - name: pool_type - - *pool_id - - *swap_fee - - *tx_hash - - *tx_from - - *tx_to - - *evt_index - - - name: balancer_avalanche_c_pools_tokens_weights - meta: - blockchain: avalanche_c - project: balancer - contributors: jacektrocinski, viniabussafi - config: - tags: ['avalanche_c', 'balancer', 'pools', 'tokens', 'weights'] - description: > - Token weights in Balancer pools. - columns: - - *blockchain - - name: version - - *pool_id - - &token_address - name: token_address - description: 'Contract address for the token' - - &normalized_weight - name: normalized_weight - description: 'Weight of the token in the pool.' - - - name: balancer_v2_avalanche_c_pools_tokens_weights - meta: - blockchain: avalanche_c - project: balancer - contributors: jacektrocinski, viniabussafi - config: - tags: ['avalanche_c', 'balancer', 'pools', 'tokens', 'weights'] - description: > - Token weights in Balancer v2 pools. - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - pool_id - - token_address - columns: - - *blockchain - - name: version - - *pool_id - - *token_address - - *normalized_weight - - - name: balancer_v2_avalanche_c_liquidity - meta: - blockchain: avalanche_c - project: balancer_v2 - contributors: victorstefenon, viniabussafi, thetroyharris - config: - tags: ['avalanche_c', 'balancer', 'pools', 'liquidity'] - description: > - Balancer v2 pools liquidity by token in avalanche_c. - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - day - - pool_id - - token_address - columns: - - name: day - description: 'UTC event block time truncated to the day mark' - - *pool_id - - name: pool_address - - name: pool_symbol - description: 'Symbol of the pool, consisting of the symbol of its tokens and their respective weights' - - name: version - description: 'Version of Balancer in which pool was deployed' - - name: blockchain - description: 'Blockchain in which pool was deployed' - - *token_address - - name: token_symbol - description: 'Symbol of the token' - - name: token_balance_raw - description: 'Raw balance of the token in the pool' - - name: token_balance - description: 'Scaled balance of the token in the pool' - - name: protocol_liquidity_usd - description: 'Liquidity of the token in the pool in USD, except BPTs' - - name: protocol_liquidity_eth - description: 'Liquidity of the token in the pool in ETH, except BPTs' - - name: pool_liquidity_usd - description: 'Liquidity of the token in the pool in USD, including BPTs' - - name: pool_liquidity_eth - description: 'Liquidity of the token in the pool in ETH, including BPTs' - - - - name: balancer_v2_avalanche_c_bpt_prices - meta: - blockchain: avalanche_c - project: balancer_v2 - contributors: victorstefenon, thetroyharris, viniabussafi - config: - tags: ['avalanche_c', 'bpt', 'prices'] - description: > - Balancer Pool Token (BPT) hourly median price by pool on Balancer, an automated portfolio manager and trading platform. - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - blockchain - - day - - contract_address - columns: - - name: blockchain - - name: day - - name: version - - name: decimals - - name: contract_address - - name: bpt_price - - - name: balancer_v2_avalanche_c_transfers_bpt - meta: - blockchain: avalanche_c - project: balancer_v2 - contributors: victorstefenon, thetroyharris, viniabussafi - config: - tags: ['avalanche_c', 'bpt', 'transfers'] - description: > - Balancer Pool Token (BPT) transfer logs on Balancer, an automated portfolio manager and trading platform, on Avalanche C Chain. - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - evt_tx_hash - - evt_index - - block_date - columns: - - name: blockchain - - name: version - - name: contract_address - - name: block_date - - name: block_month - - name: evt_tx_hash - - name: evt_index - - &evt_block_time - name: evt_block_time - description: 'Block time of transfer event' - - &evt_block_number - name: evt_block_number - description: 'Block number of transfer event' - - &from - name: from - description: 'Address of BPT provider of transfer event' - - &to - name: to - description: 'Address of BPT receiver of transfer event' - - &value - name: value - description: 'Amount of BPT transferred in transfer event' - - - name: balancer_v2_avalanche_c_pools_fees - meta: - blockchain: avalanche_c - project: balancer_v2 - contributors: jacektrocinski, thetroyharris, viniabussafi - config: - tags: ['avalanche_c', 'balancer', 'pools', 'fees'] - description: > - Balancer v2 swap fees stored at the pool level. - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - block_number - - tx_hash - - index - columns: - - name: blockchain - - name: version - - name: contract_address - - name: tx_hash - - name: index - - name: tx_index - - name: block_time - - name: block_number - - name: swap_fee_percentage - - - name: balancer_v2_avalanche_c_flashloans - meta: - blockchain: avalanche_c - sector: lending - contributors: hildobby, viniabussafi - config: - tags: ['avalanche_c', 'flashloans'] - description: > - All Balancer v2 flashloans on avalanche_c - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - blockchain - - tx_hash - - evt_index - columns: - - name: blockchain - - name: project - - name: version - - name: block_time - - name: block_number - - name: amount - - name: amount_usd - - name: tx_hash - - name: evt_index - - name: fee - - name: currency_contract - - name: currency_symbol - - name: recipient - - name: contract_address - - name: block_month - - - name: balancer_v2_avalanche_c_protocol_fee - meta: - blockchain: avalanche_c - project: balancer_v2 - contributors: viniabussafi - config: - tags: ['avalanche_c', 'revenue', 'fees'] - description: > - Daily Protocol Fee collected and Revenue by pool on Balancer, an automated portfolio manager and trading platform. - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - day - - pool_id - - token_address - columns: - - name: day - - name: pool_id - - name: pool_address - - name: pool_symbol - - name: version - - name: blockchain - - name: token_address - - name: token_symbol - - name: token_amount_raw - description: "Raw amount of revenues of the token in the pool" - - name: token_amount - description: "Amount of revenues of the token in the pool" - - name: protocol_fee_collected_usd - description: "Fee collected in the pool in USD" - - name: treasury_share - description: "Share of total revenue that is directed to Balancer DAO's treasury, as per BIPs 19, 161 and 371" - - name: treasury_revenue_usd - description: "Total revenue directed to Balancer DAO's treasury" - - - name: balancer_v2_avalanche_c_bpt_supply - meta: - blockchain: avalanche_c - project: balancer_v2 - contributors: thetroyharris, viniabussafi - config: - tags: ['avalanche_c', 'bpt', 'supply'] - description: > - Balancer Pool Token (BPT) supply for ComposableStablePools versions 4 and 5. - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - day - - blockchain - - token_address - columns: - - name: day - - name: pool_type - - name: version - - name: blockchain - - name: token_address - - name: supply \ No newline at end of file diff --git a/models/balancer/balancer_schema.yml b/models/balancer/balancer_schema.yml deleted file mode 100644 index 5e7fb29a97b..00000000000 --- a/models/balancer/balancer_schema.yml +++ /dev/null @@ -1,365 +0,0 @@ -version: 2 - -models: - - name: balancer_gauge_mappings - meta: - blockchain: optimism - sector: dex - contributors: msilb7 - config: - tags: ['balancer', 'amm', 'trades', 'dex', 'incentives'] - description: > - Gauge to Pool mappings for balancer on all chains - columns: - - &blockchain - name: blockchain - description: "Blockchain" - - &project - name: project - description: "Project name (balancer)" - - &version - name: version - description: "Version of the project" - - &pool_contract - name: pool_contract - description: "Address of the liquidity pool contract" - - &pool_id - name: pool_id - description: "Pool id" - - &incentives_contract - name: incentives_contract - description: "Address of the contract where incentives are stored and emitted." - - &incentives_type - name: incentives_type - description: "Description of the incentives address type." - - &evt_block_time - name: evt_block_time - description: 'Block time in UTC' - - &evt_block_number - name: evt_block_number - description: 'Block Number' - - &contract_address - name: contract_address - description: 'Gauge Creator Contract Address' - - &evt_tx_hash - name: evt_tx_hash - description: 'Tx Hash' - - &evt_index - name: evt_index - description: 'Event index' - - - name: balancer_flashloans - meta: - blockchain: ethereum, arbitrum, optimism, polygon, gnosis - sector: lending - contributors: hildobby - config: - tags: ['ethereum', 'arbitrum', 'optimism', 'polygon', 'gnosis','avalanche_c', 'base', 'flashloans'] - description: > - All Balancer flashloans - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - blockchain - - tx_hash - - evt_index - columns: - - name: blockchain - - name: project - - name: version - - name: block_time - - name: block_month - - name: block_number - - name: amount - - name: amount_usd - - name: tx_hash - - name: evt_index - - name: fee - - name: currency_contract - - name: currency_symbol - - name: recipient - - name: contract_address - - name: block_month - - - name: balancer_bpt_prices - meta: - blockchain: ethereum, arbitrum, optimism, polygon, gnosis, avalanche_c, base - sector: dex - contributors: thetroyharris, victorstefenon, viniabussafi - config: - tags: ['balancer', 'amm', 'dex', 'bpt', 'prices', 'ethereum', 'arbitrum', 'optimism', 'polygon', 'gnosis', 'avalanche_c', 'base'] - description: > - Balancer Pool Token (BPT) hourly median price by pool on Balancer, an automated portfolio manager and trading platform. - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - blockchain - - day - - contract_address - columns: - - name: blockchain - - name: day - - name: version - - name: decimals - - name: contract_address - - name: pool_type - - name: bpt_price - - - name: balancer_liquidity - meta: - blockchain: ethereum, arbitrum, optimism, polygon, gnosis, avalanche_c, base - project: balancer - contributors: viniabussafi - config: - tags: ['balancer', 'amm', 'dex', 'liquidity', 'ethereum', 'arbitrum', 'optimism', 'polygon', 'avalanche_c', 'base'] - description: > - Liquidity by token on Balancer, an automated portfolio manager and trading platform. - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - day - - pool_id - - blockchain - - token_address - - token_symbol - columns: - - name: day - description: 'UTC event block time truncated to the day mark' - - *pool_id - - name: pool_address - - name: pool_symbol - description: 'Symbol of the pool, consisting of the symbol of its tokens and their respective weights' - - name: version - description: 'Version of Balancer in which pool was deployed' - - name: blockchain - description: 'Blockchain in which pool was deployed' - - name: pool_type - - name: token_address - - name: token_symbol - description: 'Symbol of the token' - - name: token_balance_raw - description: 'Raw balance of the token in the pool' - - name: token_balance - description: 'Scaled balance of the token in the pool' - - name: protocol_liquidity_usd - description: 'Liquidity of the token in the pool in USD, except BPTs' - - name: protocol_liquidity_eth - description: 'Liquidity of the token in the pool in ETH, except BPTs' - - name: pool_liquidity_usd - description: 'Liquidity of the token in the pool in USD, including BPTs' - - name: pool_liquidity_eth - description: 'Liquidity of the token in the pool in ETH, including BPTs' - - - - name: balancer_transfers_bpt - meta: - blockchain: arbitrum, avalanche_c, base, ethereum, gnosis, optimism, polygon - contributors: victorstefenon, thetroyharris, viniabussafi - config: - tags: ['arbitrum', 'avalanche_c', 'base', 'ethereum', 'gnosis', 'optimism', 'polygon', 'bpt', 'transfers'] - description: > - Balancer Pool Token (BPT) transfer logs on Balancer, an automated portfolio manager and trading platform. - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - evt_tx_hash - - evt_index - - block_date - columns: - - *blockchain - - name: version - - *contract_address - - &block_date - name: block_date - description: "Block date in UTC" - - *evt_tx_hash - - *evt_index - - *evt_block_time - - *evt_block_number - - &from - name: from - description: 'Address of BPT provider of transfer event' - - &to - name: to - description: 'Address of BPT receiver of transfer event' - - &value - name: value - description: 'Amount of BPT transferred in transfer event' - - - name: balancer_pools_fees - meta: - blockchain: arbitrum, avalanche_c, base, ethereum, gnosis, optimism, polygon - contributors: jacektrocinski, thetroyharris, viniabussafi - config: - tags: ['arbitrum', 'avalanche_c', 'base', 'ethereum', 'gnosis', 'optimism', 'polygon', 'bpt', 'transfers'] - description: > - Balancer v2 swap fees stored at the pool level. - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - blockchain - - block_number - - tx_hash - - index - columns: - - name: blockchain - - name: version - - name: contract_address - - name: tx_hash - - name: index - - name: tx_index - - name: block_time - - name: block_number - - name: swap_fee_percentage - - - name: balancer_protocol_fee - meta: - blockchain: arbitrum, avalanche_c, base, ethereum, gnosis, optimism, polygon - project: balancer - contributors: viniabussafi - config: - tags: ['arbitrum', 'avalanche_c', 'base', 'ethereum', 'gnosis', 'optimism', 'polygon', 'revenue', 'fees'] - description: > - Daily Protocol Fee collected and Revenue by pool on Balancer, an automated portfolio manager and trading platform. - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - day - - pool_id - - token_address - columns: - - name: day - - *pool_id - - name: pool_address - - name: pool_symbol - - *version - - *blockchain - - name: pool_type - - name: token_address - - name: token_symbol - - name: token_amount_raw - description: "Raw amount of revenues of the token in the pool" - - name: token_amount - description: "Amount of revenues of the token in the pool" - - name: protocol_fee_collected_usd - description: "Fee collected in the pool in USD" - - name: treasury_share - description: "Share of total revenue that is directed to Balancer DAO's treasury, as per BIPs 19, 161 and 371" - - name: treasury_revenue_usd - description: "Total revenue directed to Balancer DAO's treasury" - - - name: balancer_bpt_supply - meta: - blockchain: arbitrum, avalanche_c, base, ethereum, gnosis, optimism, polygon - contributors: thetroyharris, viniabussafi - config: - tags: ['arbitrum', 'avalanche_c', 'base', 'ethereum', 'gnosis', 'optimism', 'polygon', 'bpt'] - description: > - The Balancer Pool Token (BPT) supply over time of ComposableStablePools versions 4+ - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - day - - blockchain - - token_address - columns: - - name: day - - name: pool_type - - name: version - - name: blockchain - - name: token_address - - name: supply - - - name: balancer_token_whitelist - meta: - blockchain: arbitrum, avalanche_c, base, ethereum, gnosis, optimism, polygon - contributors: viniabussafi - config: - tags: ['arbitrum', 'avalanche_c', 'base', 'ethereum', 'gnosis', 'optimism', 'polygon', 'bpt'] - description: > - These tokens are whitelisted to be used as pricing assets on liquidity calculations for weighted pools, due to the trustability of their data. - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - address - - name - - chain - columns: - - name: address - - name: name - - name: chain - - - name: balancer_pools_tokens_weights - meta: - blockchain: arbitrum, avalanche_c, base, ethereum, gnosis, optimism, polygon - contributors: jacektrocinski, viniabussafi - config: - tags: ['arbitrum', 'avalanche_c', 'base', 'ethereum', 'gnosis', 'optimism', 'polygon', 'bpt', 'transfers'] - description: > - Token weights in Balancer pools. - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - blockchain - - pool_id - - token_address - columns: - - *blockchain - - name: version - - *pool_id - - name: token_address - - name: normalized_weight - - - name: balancer_single_recipient_gauges - meta: - blockchain: ethereum - contributors: viniabussafi - config: - tags: ['ethereum', 'gauges'] - description: > - These gauges are deployed by the SingleRecipientGauge contract and this mapping manually links each gauge to it's correspondent pool and project - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - gauge_address - - pool_id - - project - - blockchain - columns: - - name: gauge_address - - name: pool_id - - name: project - - name: blockchain - - - name: balancer_pools_metrics_daily - meta: - blockchain: arbitrum, avalanche_c, base, ethereum, gnosis, optimism, polygon, zkevm - contributors: viniabussafi, metacrypto - config: - tags: ['arbitrum', 'avalanche_c', 'base', 'ethereum', 'gnosis', 'optimism', 'polygon', 'zkevm', 'balancer', 'pool', 'stats', 'volume', 'tvl', 'fee'] - description: > - This spell aggregates data from the trades, liquidity and protocol fees spells, by day and pool, while also displaying some basic information about the pool - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - block_date - - blockchain - - project - - version - - project_contract_address - columns: - - name: blockchain - - name: project - - name: version - - name: block_date - - name: project_contract_address - - name: pool_symbol - - name: pool_type - - name: swap_amount_usd - description: "Daily swap volume on a pool, in USD" - - name: tvl_usd - description: "Total Value Locked on a pool, in USD" - - name: tvl_eth - description: "Total Value Locked on a pool, in eth" - - name: fee_amount_usd - description: "Daily fees collected on a pool, in USD" \ No newline at end of file diff --git a/models/balancer/base/balancer_base_schema.yml b/models/balancer/base/balancer_base_schema.yml deleted file mode 100644 index d6e170e5536..00000000000 --- a/models/balancer/base/balancer_base_schema.yml +++ /dev/null @@ -1,405 +0,0 @@ -version: 2 - -models: - - - name: balancer_base_trades - meta: - blockchain: base - sector: dex - contributors: bizzyvinci - config: - tags: ['balancer', 'base', 'amm', 'trades', 'dex'] - description: > - DEX trades on balancer on base - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - block_date - - blockchain - - project - - version - - tx_hash - - evt_index - - check_dex_seed: - blockchain: base - project: balancer - version: 2 - columns: - - &blockchain - name: blockchain - description: "Blockchain" - - &project - name: project - description: "Project name (balancer)" - - &version - name: version - description: "Version of the project" - - &block_month - name: block_month - description: "Block month in UTC" - - &block_date - name: block_date - description: "Block date in UTC" - - &block_time - name: block_time - description: 'Block time in UTC' - - &token_bought_symbol - name: token_bought_symbol - description: "Token symbol for token bought in the trade" - - &token_sold_symbol - name: token_sold_symbol - description: "Token symbol for token sold in the trade" - - &token_pair - name: token_pair - description: "Token symbol pair for each token involved in the trade" - - &token_bought_amount - name: token_bought_amount - description: "Value of the token bought at time of execution in the original currency" - - &token_sold_amount - name: token_sold_amount - description: "Value of the token sold at time of execution in the original currency" - - &token_bought_amount_raw - name: token_bought_amount_raw - description: "Raw value of the token bought at time of execution in the original currency" - - &token_sold_amount_raw - name: token_sold_amount_raw - description: "Raw value of the token sold at time of execution in the original currency" - - &amount_usd - name: amount_usd - description: "USD value of the trade at time of execution" - - &token_bought_address - name: token_bought_address - description: "Contract address of the token bought" - - &token_sold_address - name: token_sold_address - description: "Contract address of the token sold" - - &taker - name: taker - description: "Address of trader who purchased a token" - - &maker - name: maker - description: "Address of trader who sold a token" - - &pool_id - name: pool_id - description: 'Unique encoded identifier that refers to each pool' - - &swap_fee - name: swap_fee - description: 'Swap fee' - - &project_contract_address - name: project_contract_address - description: "Pool address" - - name: pool_symbol - - name: pool_type - - &tx_hash - name: tx_hash - description: "Transaction hash" - - &tx_from - name: tx_from - description: "transaction.from" - - &tx_to - name: tx_to - description: "transaction.to" - - &evt_index - name: evt_index - description: "Event index" - - - name: balancer_v2_base_trades - meta: - blockchain: base - sector: dex - contributors: bizzyvinci, thetroyharris, tomfutago, viniabussafi - config: - tags: [ 'balancer', 'base', 'amm', 'trades', 'dex', 'beta' ] - description: > - DEX trades on balancer v2 on base - columns: - - *blockchain - - *project - - *version - - *block_month - - *block_date - - *block_time - - name: block_number - - *token_bought_symbol - - *token_sold_symbol - - *token_pair - - *token_bought_amount - - *token_sold_amount - - *token_bought_amount_raw - - *token_sold_amount_raw - - *amount_usd - - *token_bought_address - - *token_sold_address - - *taker - - *maker - - *project_contract_address - - name: pool_symbol - - name: pool_type - - *pool_id - - *swap_fee - - *tx_hash - - *tx_from - - *tx_to - - *evt_index - - - name: balancer_v2_base_pools_fees - meta: - blockchain: base - project: balancer_v2 - contributors: jacektrocinski, thetroyharris, viniabussafi - config: - tags: ['base', 'balancer', 'pools', 'fees'] - description: > - Balancer v2 swap fees stored at the pool level. - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - block_number - - tx_hash - - index - columns: - - name: blockchain - - name: version - - name: contract_address - - name: tx_hash - - name: index - - name: tx_index - - name: block_time - - name: block_number - - name: swap_fee_percentage - - - name: balancer_base_pools_tokens_weights - meta: - blockchain: base - project: balancer - contributors: jacektrocinski, viniabussafi - config: - tags: ['base', 'balancer', 'pools', 'tokens', 'weights'] - description: > - Token weights in Balancer pools. - columns: - - *blockchain - - name: version - - *pool_id - - &token_address - name: token_address - description: 'Contract address for the token' - - &normalized_weight - name: normalized_weight - description: 'Weight of the token in the pool.' - - - name: balancer_v2_base_pools_tokens_weights - meta: - blockchain: base - project: balancer - contributors: jacektrocinski, viniabussafi - config: - tags: ['base', 'balancer', 'pools', 'tokens', 'weights'] - description: > - Token weights in Balancer v2 pools. - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - pool_id - - token_address - columns: - - *blockchain - - name: version - - *pool_id - - *token_address - - *normalized_weight - - - name: balancer_v2_base_liquidity - meta: - blockchain: base - project: balancer_v2 - contributors: victorstefenon, viniabussafi, thetroyharris - config: - tags: ['base', 'balancer', 'pools', 'liquidity'] - description: > - Balancer v2 pools liquidity by token in base. - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - day - - pool_id - - token_address - columns: - - name: day - description: 'UTC event block time truncated to the day mark' - - *pool_id - - name: pool_address - - name: pool_symbol - description: 'Symbol of the pool, consisting of the symbol of its tokens and their respective weights' - - name: version - description: 'Version of Balancer in which pool was deployed' - - name: blockchain - description: 'Blockchain in which pool was deployed' - - *token_address - - name: token_symbol - description: 'Symbol of the token' - - name: token_balance_raw - description: 'Raw balance of the token in the pool' - - name: token_balance - description: 'Scaled balance of the token in the pool' - - name: protocol_liquidity_usd - description: 'Liquidity of the token in the pool in USD, except BPTs' - - name: protocol_liquidity_eth - description: 'Liquidity of the token in the pool in ETH, except BPTs' - - name: pool_liquidity_usd - description: 'Liquidity of the token in the pool in USD, including BPTs' - - name: pool_liquidity_eth - description: 'Liquidity of the token in the pool in ETH, including BPTs' - - - - name: balancer_v2_base_bpt_prices - meta: - blockchain: base - project: balancer_v2 - contributors: victorstefenon, thetroyharris, viniabussafi - config: - tags: ['base', 'bpt', 'prices'] - description: > - Balancer Pool Token (BPT) hourly median price by pool on Balancer, an automated portfolio manager and trading platform. - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - blockchain - - day - - contract_address - columns: - - name: blockchain - - name: day - - name: version - - name: decimals - - name: contract_address - - name: bpt_price - - - name: balancer_v2_base_transfers_bpt - meta: - blockchain: base - project: balancer_v2 - contributors: victorstefenon, thetroyharris, viniabussafi - config: - tags: ['base', 'bpt', 'transfers'] - description: > - Balancer Pool Token (BPT) transfer logs on Balancer, an automated portfolio manager and trading platform, on Base. - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - evt_tx_hash - - evt_index - - block_date - columns: - - name: blockchain - - name: version - - name: contract_address - - name: block_date - - name: block_month - - name: evt_tx_hash - - name: evt_index - - &evt_block_time - name: evt_block_time - description: 'Block time of transfer event' - - &evt_block_number - name: evt_block_number - description: 'Block number of transfer event' - - &from - name: from - description: 'Address of BPT provider of transfer event' - - &to - name: to - description: 'Address of BPT receiver of transfer event' - - &value - name: value - description: 'Amount of BPT transferred in transfer event' - - - name: balancer_v2_base_flashloans - meta: - blockchain: base - sector: lending - contributors: hildobby, viniabussafi - config: - tags: ['base', 'flashloans'] - description: > - All Balancer v2 flashloans on base - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - blockchain - - tx_hash - - evt_index - columns: - - name: blockchain - - name: project - - name: version - - name: block_time - - name: block_number - - name: amount - - name: amount_usd - - name: tx_hash - - name: evt_index - - name: fee - - name: currency_contract - - name: currency_symbol - - name: recipient - - name: contract_address - - name: block_month - - - name: balancer_v2_base_protocol_fee - meta: - blockchain: base - project: balancer_v2 - contributors: viniabussafi - config: - tags: ['base', 'revenue', 'fees'] - description: > - Daily Protocol Fee collected and Revenue by pool on Balancer, an automated portfolio manager and trading platform. - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - day - - pool_id - - token_address - columns: - - name: day - - name: pool_id - - name: pool_address - - name: pool_symbol - - name: version - - name: blockchain - - name: token_address - - name: token_symbol - - name: token_amount_raw - description: "Raw amount of revenues of the token in the pool" - - name: token_amount - description: "Amount of revenues of the token in the pool" - - name: protocol_fee_collected_usd - description: "Fee collected in the pool in USD" - - name: treasury_share - description: "Share of total revenue that is directed to Balancer DAO's treasury, as per BIPs 19, 161 and 371" - - name: treasury_revenue_usd - description: "Total revenue directed to Balancer DAO's treasury" - - - name: balancer_v2_base_bpt_supply - meta: - blockchain: base - project: balancer_v2 - contributors: thetroyharris, viniabussafi - config: - tags: ['base', 'bpt', 'supply'] - description: > - Balancer Pool Token (BPT) supply for ComposableStablePools versions 4 and 5. - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - day - - blockchain - - token_address - columns: - - name: day - - name: pool_type - - name: version - - name: blockchain - - name: token_address - - name: supply \ No newline at end of file diff --git a/models/balancer/ethereum/balancer_ethereum_schema.yml b/models/balancer/ethereum/balancer_ethereum_schema.yml deleted file mode 100644 index d2f899d1c61..00000000000 --- a/models/balancer/ethereum/balancer_ethereum_schema.yml +++ /dev/null @@ -1,665 +0,0 @@ -version: 2 - -models: - - name: balancer_v2_ethereum_pools_fees - meta: - blockchain: ethereum - project: balancer_v2 - contributors: jacektrocinski, thetroyharris, viniabussafi - config: - tags: ['ethereum', 'balancer', 'pools', 'fees'] - description: > - Balancer v2 swap fees stored at the pool level. - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - block_number - - tx_hash - - index - columns: - - name: blockchain - - name: version - - &contract_address - name: contract_address - description: "Ethereum address for the liquidity pool used in transaction" - tests: - - not_null - - &tx_hash - name: tx_hash - description: "Transaction hash" - tests: - - not_null - - &index - name: index - description: "" - tests: - - not_null - - &tx_index - name: tx_index - description: "" - tests: - - not_null - - &block_time - name: block_time - description: "Block time in UTC" - tests: - - not_null - - &block_number - name: block_number - description: "Block number" - tests: - - not_null - - &swap_fee_percentage - name: swap_fee_percentage - description: "Swap fees for the pool, values are returned with 18 decimals (1e18 meaning 100%)" - tests: - - not_null - - - name: balancer_ethereum_balances - meta: - blockchain: ethereum - project: balancer - contributors: jacektrocinski - config: - tags: ['ethereum', 'balancer', 'balances'] - description: > - ERC20 token rolling sum balances on Balancer, an automated portfolio manager and trading platform. - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - day - - pool - - token - columns: - - &day - name: day - description: "UTC event block time truncated to the day mark" - tests: - - not_null - - &pool - name: pool - description: "Balancer pool contract address" - - &token - name: token - description: "Token contract address" - - &cumulative_amount - name: cumulative_amount - description: "Balance of a token" - - - name: balancer_v2_ethereum_transfers_bpt - meta: - blockchain: ethereum - project: balancer_v2 - contributors: victorstefenon, thetroyharris, viniabussafi - config: - tags: ['ethereum', 'bpt', 'transfers'] - description: > - Balancer Pool Token (BPT) transfer logs on Balancer, an automated portfolio manager and trading platform, on Ethereum. - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - evt_tx_hash - - evt_index - - block_date - columns: - - &blockchain - name: blockchain - description: "Blockchain" - - name: version - - *contract_address - - &block_date - name: block_date - description: "UTC event block date" - - &block_month - name: block_month - description: "UTC event block month" - - &evt_tx_hash - name: evt_tx_hash - description: "Transaction hash of transfer event" - - &evt_index - name: evt_index - description: "Event index" - - &evt_block_time - name: evt_block_time - description: "Block time of transfer event" - - &evt_block_number - name: evt_block_number - description: "Block number of transfer event" - - &from - name: from - description: "Address of BPT provider of transfer event" - - &to - name: to - description: "Address of BPT receiver of transfer event" - - &value - name: value - description: "Amount of BPT transferred in transfer event" - - - name: balancer_ethereum_pools_tokens_weights - meta: - blockchain: ethereum - project: balancer - contributors: jacektrocinski, viniabussafi - config: - tags: ['ethereum', 'balancer', 'pools', 'tokens', 'weights'] - description: > - Token weights in Balancer pools. - columns: - - *blockchain - - name: version - - &pool_id - name: pool_id - description: "Unique encoded identifier that refers to each pool" - - &token_address - name: token_address - description: "Contract address for the token" - - &normalized_weight - name: normalized_weight - description: "Weight of the token in the pool." - - - name: balancer_v1_ethereum_pools_tokens_weights - meta: - blockchain: ethereum - project: balancer - contributors: jacektrocinski, viniabussafi - config: - tags: ['ethereum', 'balancer', 'pools', 'tokens', 'weights'] - description: > - Token weights in Balancer v1 pools. - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - pool_id - - token_address - columns: - - *blockchain - - name: version - - *pool_id - - *token_address - - *normalized_weight - - - name: balancer_v2_ethereum_pools_tokens_weights - meta: - blockchain: ethereum - project: balancer - contributors: jacektrocinski, viniabussafi - config: - tags: ['ethereum', 'balancer', 'pools', 'tokens', 'weights'] - description: > - Token weights in Balancer v2 pools. - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - pool_id - - token_address - columns: - - *blockchain - - name: version - - *pool_id - - *token_address - - *normalized_weight - - - name: balancer_ethereum_vebal_balances_day - meta: - blockchain: ethereum - project: balancer - contibutors: markusbkoch, mendesfabio, victorstefenon - config: - tags: ['balancer', 'ethereum', 'vebal', 'day', 'markusbkoch', 'mendesfabio'] - description: > - Daily balances of veBAL per wallet - Depends on veBAL_call_create_lock, veBAL_evt_Deposit and veBAL_evt_Withdraw - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - day - - wallet_address - columns: - - *day - - name: wallet_address - description: "Address of the wallet holding the veBAL" - - name: bpt_balance - description: "Amount of BPT held in the veBAL lock" - - name: vebal_balance - description: "Amount of veBAL" - - name: lock_time - description: "Amount of time the BPT was locked for at the last time the lock was updated" - - - name: balancer_ethereum_vebal_slopes - meta: - blockchain: ethereum - project: balancer - contibutors: markusbkoch, mendesfabio, victorstefenon - config: - tags: ['balancer', 'ethereum', 'vebal', 'slope', 'markusbkoch', 'mendesfabio', 'victorstefenon'] - description: > - Slope and bias of veBAL per wallet after each balance update - Depends on veBAL_call_create_lock, veBAL_evt_Deposit and veBAL_evt_Withdraw - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - block_number - - wallet_address - columns: - - *block_number - - *block_time - - name: block_timestamp - description: "Block timestamp" - - name: wallet_address - description: "Address of the wallet holding the veBAL" - - name: bpt_balance - description: "Amount of BPT held in the veBAL lock" - - name: unlocked_at - description: "Timestamp at which B-80BAL-20WETH BPT can be unlocked" - - name: slope - description: "veBAL decay rate (per second)" - - name: bias - description: "veBAL balance at the moment user locks or re-locks" - - name: block_date - description: "Block time trunc to date" - - - name: balancer_ethereum_trades - meta: - blockchain: ethereum - sector: dex - contributors: bizzyvinci, thetroyharris - config: - tags: ['balancer', 'ethereum', 'amm', 'trades', 'dex'] - description: > - DEX trades on balancer on ethereum - columns: - - *blockchain - - &project - name: project - description: "Project name (balancer)" - - &version - name: version - description: "Version of the project" - - *block_month - - *block_date - - *block_time - - &token_bought_symbol - name: token_bought_symbol - description: "Token symbol for token bought in the trade" - - &token_sold_symbol - name: token_sold_symbol - description: "Token symbol for token sold in the trade" - - &token_pair - name: token_pair - description: "Token symbol pair for each token involved in the trade" - - &token_bought_amount - name: token_bought_amount - description: "Value of the token bought at time of execution in the original currency" - - &token_sold_amount - name: token_sold_amount - description: "Value of the token sold at time of execution in the original currency" - - &token_bought_amount_raw - name: token_bought_amount_raw - description: "Raw value of the token bought at time of execution in the original currency" - - &token_sold_amount_raw - name: token_sold_amount_raw - description: "Raw value of the token sold at time of execution in the original currency" - - &amount_usd - name: amount_usd - description: "USD value of the trade at time of execution" - - &token_bought_address - name: token_bought_address - description: "Contract address of the token bought" - - &token_sold_address - name: token_sold_address - description: "Contract address of the token sold" - - &taker - name: taker - description: "Address of trader who purchased a token" - - &maker - name: maker - description: "Address of trader who sold a token" - - *pool_id - - &swap_fee - name: swap_fee - description: 'Swap fee' - - &project_contract_address - name: project_contract_address - description: "Pool address" - - name: pool_symbol - - name: pool_type - - *tx_hash - - &tx_from - name: tx_from - description: "transaction.from" - - &tx_to - name: tx_to - description: "transaction.to" - - *evt_index - - - name: balancer_v1_ethereum_trades - meta: - blockchain: ethereum - sector: dex - contributors: bizzyvinci, thetroyharris, viniabussafi - config: - tags: [ 'balancer', 'ethereum', 'amm', 'trades', 'dex' ] - description: > - DEX trades on balancer v1 on ethereum - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - block_time - - tx_hash - - evt_index - - check_dex_seed: - blockchain: ethereum - project: balancer - version: 1 - columns: - - *blockchain - - *project - - *version - - *block_month - - *block_date - - *block_time - - *token_bought_symbol - - *token_sold_symbol - - *token_pair - - *token_bought_amount - - *token_sold_amount - - *token_bought_amount_raw - - *token_sold_amount_raw - - *amount_usd - - *token_bought_address - - *token_sold_address - - *taker - - *maker - - *pool_id - - *swap_fee - - *project_contract_address - - name: pool_symbol - - name: pool_type - - *tx_hash - - *tx_from - - *tx_to - - *evt_index - - - name: balancer_v2_ethereum_trades - meta: - blockchain: ethereum - sector: dex - contributors: bizzyvinci, thetroyharris, tomfutago, viniabussafi - config: - tags: [ 'balancer', 'ethereum', 'amm', 'trades', 'dex', 'beta' ] - description: > - DEX trades on balancer v2 on ethereum - columns: - - *blockchain - - *project - - *version - - *block_month - - *block_date - - *block_time - - *block_number - - *token_bought_symbol - - *token_sold_symbol - - *token_pair - - *token_bought_amount - - *token_sold_amount - - *token_bought_amount_raw - - *token_sold_amount_raw - - *amount_usd - - *token_bought_address - - *token_sold_address - - *taker - - *maker - - *project_contract_address - - name: pool_symbol - - name: pool_type - - *pool_id - - *swap_fee - - *tx_hash - - *tx_from - - *tx_to - - *evt_index - - - name: balancer_v2_ethereum_liquidity - meta: - blockchain: ethereum - project: balancer_v2 - contributors: victorstefenon, viniabussafi, thetroyharris - config: - tags: ['ethereum', 'balancer', 'pools', 'liquidity'] - description: > - Balancer v2 pools liquidity by token in Ethereum. - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - day - - pool_id - - token_address - columns: - - name: day - description: 'UTC event block time truncated to the day mark' - - *pool_id - - name: pool_address - - name: pool_symbol - description: 'Symbol of the pool, consisting of the symbol of its tokens and their respective weights' - - name: version - description: 'Version of Balancer in which pool was deployed' - - name: blockchain - description: 'Blockchain in which pool was deployed' - - *token_address - - name: token_symbol - description: 'Symbol of the token' - - name: token_balance_raw - description: 'Raw balance of the token in the pool' - - name: token_balance - description: 'Scaled balance of the token in the pool' - - name: protocol_liquidity_usd - description: 'Liquidity of the token in the pool in USD, except BPTs' - - name: protocol_liquidity_eth - description: 'Liquidity of the token in the pool in ETH, except BPTs' - - name: pool_liquidity_usd - description: 'Liquidity of the token in the pool in USD, including BPTs' - - name: pool_liquidity_eth - description: 'Liquidity of the token in the pool in ETH, including BPTs' - - - name: balancer_ethereum_vebal_votes - meta: - blockchain: ethereum - project: balancer - contibutors: markusbkoch, mendesfabio, stefenon - config: - tags: ['balancer', 'ethereum', 'vebal', 'votes', 'markusbkoch', 'mendesfabio', 'stefenon'] - description: > - Records of votes for Balancer gauges by provider at each voting round - Depends on GaugeController_evt_VoteForGauge and the vebal_slopes spell - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - round_id - - gauge - - provider - columns: - - name: round_id - description: "ID of the voting round" - - name: start_date - description: "Day of the voting round start date" - - name: end_date - description: "Day of the voting round end date" - - name: gauge - description: "Address of the gauge which provider votes for" - - name: provider - description: "Address of the wallet which voted for the gauge" - - name: vote - description: "Weight of the vote performed by the provider for the gauge" - - - name: balancer_v2_ethereum_lbps - meta: - blockchain: ethereum - project: balancer_v2 - contributors: stefenon - config: - tags: ['ethereum', 'balancer', 'lbp'] - description: > - Record of the Liquidity Boostrapping Pools (LBP) of Balancer, an automated portfolio manager and trading platform, on Ethereum. - columns: - - name: name - description: "Name of the LBP" - - name: pool_id - description: "ID of the LBP" - - name: token_sold - description: "Contract address of the token sold by the LBP" - - name: token_symbol - description: "Symbol of the token sold by the LBP" - - name: start_time - description: "LBP start time" - - name: end_time - description: "LBP end time" - - - name: balancer_v1_ethereum_liquidity - meta: - blockchain: ethereum - project: balancer_v1 - contributors: markusbkoch, mendesfabio, victorstefenon, viniabussafi, thetroyharris - config: - tags: ['ethereum', 'balancer', 'pools', 'liquidity'] - description: > - Balancer v1 pools liquidity by token in Ethereum. - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - day - - pool_id - - token_address - columns: - - name: day - description: "UTC event block time truncated to the day mark" - - *pool_id - - name: pool_address - - name: pool_symbol - description: "Symbol of the pool, consisting of the symbol of its tokens and their respective weights" - - name: version - description: "Version of Balancer in which pool was deployed" - - *blockchain - - *token_address - - name: token_symbol - description: "Symbol of the token" - - name: token_balance_raw - description: "Raw balance of the token in the pool" - - name: token_balance - description: "Scaled balance of the token in the pool" - - name: protocol_liquidity_usd - description: "Liquidity of the token in the pool in USD, except BPTs" - - name: pool_liquidity_usd - description: "Liquidity of the token in the pool in USD, including BPTs" - - - name: balancer_v2_ethereum_flashloans - meta: - blockchain: ethereum - sector: lending - contributors: hildobby - config: - tags: ['ethereum', 'flashloans'] - description: > - All Balancer flashloans on Ethereum - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - blockchain - - tx_hash - - evt_index - columns: - - name: blockchain - - name: project - - name: version - - name: block_time - - name: block_number - - name: amount - - name: amount_usd - - name: tx_hash - - name: evt_index - - name: fee - - name: currency_contract - - name: currency_symbol - - name: recipient - - name: contract_address - - name: block_month - - - name: balancer_v2_ethereum_bpt_prices - meta: - blockchain: ethereum - project: balancer_v2 - contributors: victorstefenon, thetroyharris, viniabussafi - config: - tags: ['ethereum', 'bpt', 'prices'] - description: > - Balancer Pool Token (BPT) hourly median price by pool on Balancer, an automated portfolio manager and trading platform. - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - blockchain - - day - - contract_address - columns: - - name: blockchain - - name: day - - name: version - - name: decimals - - name: contract_address - - name: bpt_price - - - name: balancer_v2_ethereum_protocol_fee - meta: - blockchain: ethereum - project: balancer_v2 - contributors: viniabussafi - config: - tags: ['ethereum', 'revenue', 'fees'] - description: > - Daily Protocol Fee collected and Revenue by pool on Balancer, an automated portfolio manager and trading platform. - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - day - - pool_id - - token_address - columns: - - name: day - - name: pool_id - - name: pool_address - - name: pool_symbol - - name: version - - name: blockchain - - name: token_address - - name: token_symbol - - name: token_amount_raw - description: "Raw amount of revenues of the token in the pool" - - name: token_amount - description: "Amount of revenues of the token in the pool" - - name: protocol_fee_collected_usd - description: "Fee collected in the pool in USD" - - name: treasury_share - description: "Share of total revenue that is directed to Balancer DAO's treasury, as per BIPs 19, 161 and 371" - - name: treasury_revenue_usd - description: "Total revenue directed to Balancer DAO's treasury" - - - name: balancer_v2_ethereum_bpt_supply - meta: - blockchain: ethereum - project: balancer_v2 - contributors: thetroyharris, viniabussafi - config: - tags: ['ethereum', 'bpt', 'supply'] - description: > - Balancer Pool Token (BPT) supply for ComposableStablePools versions 4 and 5. - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - day - - blockchain - - token_address - columns: - - name: day - - name: pool_type - - name: version - - name: blockchain - - name: token_address - - name: supply \ No newline at end of file diff --git a/models/balancer/gnosis/balancer_gnosis_schema.yml b/models/balancer/gnosis/balancer_gnosis_schema.yml deleted file mode 100644 index a9ef89846ef..00000000000 --- a/models/balancer/gnosis/balancer_gnosis_schema.yml +++ /dev/null @@ -1,404 +0,0 @@ -version: 2 - -models: - - name: balancer_gnosis_trades - meta: - blockchain: gnosis - sector: dex - contributors: bizzyvinci - config: - tags: ['balancer', 'gnosis', 'amm', 'trades', 'dex'] - description: > - DEX trades on balancer on gnosis - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - block_date - - blockchain - - project - - version - - tx_hash - - evt_index - - check_dex_seed: - blockchain: gnosis - project: balancer - version: 2 - columns: - - &blockchain - name: blockchain - description: "Blockchain" - - &project - name: project - description: "Project name (balancer)" - - &version - name: version - description: "Version of the project" - - &block_month - name: block_month - description: "Block month in UTC" - - &block_date - name: block_date - description: "Block date in UTC" - - &block_time - name: block_time - description: 'Block time in UTC' - - &token_bought_symbol - name: token_bought_symbol - description: "Token symbol for token bought in the trade" - - &token_sold_symbol - name: token_sold_symbol - description: "Token symbol for token sold in the trade" - - &token_pair - name: token_pair - description: "Token symbol pair for each token involved in the trade" - - &token_bought_amount - name: token_bought_amount - description: "Value of the token bought at time of execution in the original currency" - - &token_sold_amount - name: token_sold_amount - description: "Value of the token sold at time of execution in the original currency" - - &token_bought_amount_raw - name: token_bought_amount_raw - description: "Raw value of the token bought at time of execution in the original currency" - - &token_sold_amount_raw - name: token_sold_amount_raw - description: "Raw value of the token sold at time of execution in the original currency" - - &amount_usd - name: amount_usd - description: "USD value of the trade at time of execution" - - &token_bought_address - name: token_bought_address - description: "Contract address of the token bought" - - &token_sold_address - name: token_sold_address - description: "Contract address of the token sold" - - &taker - name: taker - description: "Address of trader who purchased a token" - - &maker - name: maker - description: "Address of trader who sold a token" - - &pool_id - name: pool_id - description: 'Unique encoded identifier that refers to each pool' - - &swap_fee - name: swap_fee - description: 'Swap fee' - - &project_contract_address - name: project_contract_address - description: "Pool address" - - name: pool_symbol - - name: pool_type - - &tx_hash - name: tx_hash - description: "Transaction hash" - - &tx_from - name: tx_from - description: "transaction.from" - - &tx_to - name: tx_to - description: "transaction.to" - - &evt_index - name: evt_index - description: "Event index" - - - name: balancer_v2_gnosis_flashloans - meta: - blockchain: gnosis - sector: lending - contributors: hildobby - config: - tags: ['gnosis', 'flashloans'] - description: > - All Balancer flashloans on Gnosis - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - blockchain - - tx_hash - - evt_index - columns: - - name: blockchain - - name: project - - name: version - - name: block_time - - name: block_number - - name: amount - - name: amount_usd - - name: tx_hash - - name: evt_index - - name: fee - - name: currency_contract - - name: currency_symbol - - name: recipient - - name: contract_address - - name: block_month - - - name: balancer_v2_gnosis_bpt_prices - meta: - blockchain: gnosis - project: balancer_v2 - contributors: thetroyharris, viniabussafi - config: - tags: ['gnosis', 'bpt', 'prices'] - description: > - Balancer Pool Token (BPT) hourly median price by pool on Balancer, an automated portfolio manager and trading platform. - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - blockchain - - day - - contract_address - columns: - - name: blockchain - - name: day - - name: version - - name: decimals - - name: contract_address - - name: bpt_price - - - name: balancer_v2_gnosis_pools_fees - meta: - blockchain: gnosis - project: balancer_v2 - contributors: jacektrocinski, thetroyharris, viniabussafi - config: - tags: ['gnosis', 'balancer', 'pools_fees'] - description: > - Balancer v2 swap fees stored at the pool level. - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - block_number - - tx_hash - - index - columns: - - name: blockchain - - name: version - - name: contract_address - - name: tx_hash - - name: index - - name: tx_index - - name: block_time - - name: block_number - - name: swap_fee_percentage - - - name: balancer_v2_gnosis_trades - meta: - blockchain: gnosis - sector: dex - contributors: bizzyvinci, thetroyharris, tomfutago, viniabussafi - config: - tags: [ 'balancer', 'gnosis', 'amm', 'trades', 'dex', 'beta' ] - description: > - DEX trades on balancer v2 on gnosis - columns: - - *blockchain - - *project - - *version - - *block_month - - *block_date - - *block_time - - name: block_number - - *token_bought_symbol - - *token_sold_symbol - - *token_pair - - *token_bought_amount - - *token_sold_amount - - *token_bought_amount_raw - - *token_sold_amount_raw - - *amount_usd - - *token_bought_address - - *token_sold_address - - *taker - - *maker - - *project_contract_address - - name: pool_symbol - - name: pool_type - - *pool_id - - *swap_fee - - *tx_hash - - *tx_from - - *tx_to - - *evt_index - - - name: balancer_v2_gnosis_liquidity - meta: - blockchain: gnosis - project: balancer_v2 - contributors: victorstefenon, viniabussafi, thetroyharris - config: - tags: ['gnosis', 'balancer', 'pools', 'liquidity'] - description: > - Balancer v2 pools liquidity by token in Gnosis. - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - day - - pool_id - - token_address - columns: - - name: day - description: 'UTC event block time truncated to the day mark' - - *pool_id - - name: pool_address - - name: pool_symbol - description: 'Symbol of the pool, consisting of the symbol of its tokens and their respective weights' - - name: version - description: 'Version of Balancer in which pool was deployed' - - name: blockchain - description: 'Blockchain in which pool was deployed' - - name: token_address - - name: token_symbol - description: 'Symbol of the token' - - name: token_balance_raw - description: 'Raw balance of the token in the pool' - - name: token_balance - description: 'Scaled balance of the token in the pool' - - name: protocol_liquidity_usd - description: 'Liquidity of the token in the pool in USD, except BPTs' - - name: protocol_liquidity_eth - description: 'Liquidity of the token in the pool in ETH, except BPTs' - - name: pool_liquidity_usd - description: 'Liquidity of the token in the pool in USD, including BPTs' - - name: pool_liquidity_eth - description: 'Liquidity of the token in the pool in ETH, including BPTs' - - - - name: balancer_gnosis_pools_tokens_weights - meta: - blockchain: gnosis - project: balancer - contributors: jacektrocinski, viniabussafi - config: - tags: ['gnosis', 'balancer', 'pools', 'tokens', 'weights'] - description: > - Token weights in Balancer pools. - columns: - - *blockchain - - name: version - - *pool_id - - &token_address - name: token_address - description: 'Contract address for the token' - - &normalized_weight - name: normalized_weight - description: 'Weight of the token in the pool.' - - - name: balancer_v2_gnosis_pools_tokens_weights - meta: - blockchain: gnosis - project: balancer - contributors: metacrypto, jacektrocinski, viniabussafi - config: - tags: ['gnosis', 'balancer', 'pools', 'tokens', 'weights'] - description: > - Token weights in Balancer v2 pools. - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - pool_id - - token_address - columns: - - *blockchain - - name: version - - *pool_id - - *token_address - - *normalized_weight - - - name: balancer_v2_gnosis_transfers_bpt - meta: - blockchain: gnosis - project: balancer_v2 - contributors: victorstefenon, thetroyharris, viniabussafi - config: - tags: ['gnosis', 'bpt', 'transfers'] - description: > - Balancer Pool Token (BPT) transfer logs on Balancer, an automated portfolio manager and trading platform, on Gnosis. - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - evt_tx_hash - - evt_index - - block_date - columns: - - name: blockchain - - name: version - - name: contract_address - - name: block_date - - name: block_month - - name: evt_tx_hash - - name: evt_index - - &evt_block_time - name: evt_block_time - description: 'Block time of transfer event' - - &evt_block_number - name: evt_block_number - description: 'Block number of transfer event' - - &from - name: from - description: 'Address of BPT provider of transfer event' - - &to - name: to - description: 'Address of BPT receiver of transfer event' - - &value - name: value - description: 'Amount of BPT transferred in transfer event' - - - name: balancer_v2_gnosis_protocol_fee - meta: - blockchain: gnosis - project: balancer_v2 - contributors: viniabussafi - config: - tags: ['gnosis', 'revenue', 'fees'] - description: > - Daily Protocol Fee collected and Revenue by pool on Balancer, an automated portfolio manager and trading platform. - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - day - - pool_id - - token_address - columns: - - name: day - - name: pool_id - - name: pool_address - - name: pool_symbol - - name: version - - name: blockchain - - name: token_address - - name: token_symbol - - name: token_amount_raw - description: "Raw amount of revenues of the token in the pool" - - name: token_amount - description: "Amount of revenues of the token in the pool" - - name: protocol_fee_collected_usd - description: "Fee collected in the pool in USD" - - name: treasury_share - description: "Share of total revenue that is directed to Balancer DAO's treasury, as per BIPs 19, 161 and 371" - - name: treasury_revenue - description: "Total revenue directed to Balancer DAO's treasury" - - - name: balancer_v2_gnosis_bpt_supply - meta: - blockchain: gnosis - project: balancer_v2 - contributors: thetroyharris, viniabussafi - config: - tags: ['gnosis', 'bpt', 'supply'] - description: > - Balancer Pool Token (BPT) supply for ComposableStablePools versions 4 and 5. - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - day - - blockchain - - token_address - columns: - - name: day - - name: pool_type - - name: version - - name: blockchain - - name: token_address - - name: supply \ No newline at end of file diff --git a/models/balancer/optimism/balancer_optimism_schema.yml b/models/balancer/optimism/balancer_optimism_schema.yml deleted file mode 100644 index bb4c52fbe0e..00000000000 --- a/models/balancer/optimism/balancer_optimism_schema.yml +++ /dev/null @@ -1,464 +0,0 @@ -version: 2 - -models: - - name: balancer_v2_optimism_pools_fees - meta: - blockchain: optimism - project: balancer_v2 - contributors: jacektrocinski, thetroyharris, viniabussafi - config: - tags: ['optimism', 'balancer', 'pools_fees'] - description: > - Balancer v2 swap fees stored at the pool level. - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - block_number - - tx_hash - - index - columns: - - name: blockchain - - name: version - - &contract_address - name: contract_address - description: 'Optimism address for the liquidity pool used in transaction' - tests: - - not_null - - &tx_hash - name: tx_hash - description: 'Transaction hash' - tests: - - not_null - - &index - name: index - description: '' - tests: - - not_null - - &tx_index - name: tx_index - description: '' - tests: - - not_null - - &block_time - name: block_time - description: 'Block time in UTC' - tests: - - not_null - - &block_number - name: block_number - description: 'Block number' - tests: - - not_null - - &swap_fee_percentage - name: swap_fee_percentage - description: 'Swap fees for the pool, values are returned with 18 decimals (1e18 meaning 100%)' - tests: - - not_null - - - name: balancer_v2_optimism_transfers_bpt - meta: - blockchain: optimism - project: balancer_v2 - contributors: victorstefenon, thetroyharris, viniabussafi - config: - tags: ['optimism', 'bpt', 'transfers'] - description: > - Balancer Pool Token (BPT) transfer logs on Balancer, an automated portfolio manager and trading platform, on Optimism. - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - evt_tx_hash - - evt_index - - block_date - columns: - - &blockchain - name: blockchain - description: "Blockchain" - - name: version - - *contract_address - - &block_date - name: block_date - description: "UTC event block date of each DEX trade" - - &block_month - name: block_month - description: "UTC event block month of each DEX trade" - - &evt_tx_hash - name: evt_tx_hash - description: 'Transaction hash of transfer event' - - &evt_index - name: evt_index - description: 'Event index' - - &evt_block_time - name: evt_block_time - description: 'Block time of transfer event' - - &evt_block_number - name: evt_block_number - description: 'Block number of transfer event' - - &from - name: from - description: 'Address of BPT provider of transfer event' - - &to - name: to - description: 'Address of BPT receiver of transfer event' - - &value - name: value - description: 'Amount of BPT transferred in transfer event' - - - name: balancer_optimism_pools_tokens_weights - meta: - blockchain: optimism - project: balancer - contributors: jacektrocinski, viniabussafi - config: - tags: ['optimism', 'balancer', 'pools', 'tokens', 'weights'] - description: > - Token weights in Balancer pools. - columns: - - *blockchain - - name: version - - &pool_id - name: pool_id - description: 'Unique encoded identifier that refers to each pool' - tests: - - not_null - - &token_address - name: token_address - description: 'Contract address for the token' - - &normalized_weight - name: normalized_weight - description: 'Weight of the token in the pool.' - - - name: balancer_v2_optimism_pools_tokens_weights - meta: - blockchain: optimism - project: balancer - contributors: jacektrocinski, viniabussafi - config: - tags: ['optimism', 'balancer', 'pools', 'tokens', 'weights'] - description: > - Token weights in Balancer v2 pools. - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - pool_id - - token_address - columns: - - *blockchain - - name: version - - *pool_id - - *token_address - - *normalized_weight - - - name: balancer_optimism_trades - meta: - blockchain: optimism - sector: dex - contributors: bizzyvinci - config: - tags: ['balancer', 'optimism', 'amm', 'trades', 'dex'] - description: > - DEX trades on balancer on optimism - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - block_date - - blockchain - - project - - version - - tx_hash - - evt_index - - check_dex_seed: - blockchain: optimism - project: balancer - version: 2 - columns: - - *blockchain - - &project - name: project - description: "Project name (balancer)" - - &version - name: version - description: "Version of the project" - - *block_month - - *block_date - - *block_time - - &token_bought_symbol - name: token_bought_symbol - description: "Token symbol for token bought in the trade" - - &token_sold_symbol - name: token_sold_symbol - description: "Token symbol for token sold in the trade" - - &token_pair - name: token_pair - description: "Token symbol pair for each token involved in the trade" - - &token_bought_amount - name: token_bought_amount - description: "Value of the token bought at time of execution in the original currency" - - &token_sold_amount - name: token_sold_amount - description: "Value of the token sold at time of execution in the original currency" - - &token_bought_amount_raw - name: token_bought_amount_raw - description: "Raw value of the token bought at time of execution in the original currency" - - &token_sold_amount_raw - name: token_sold_amount_raw - description: "Raw value of the token sold at time of execution in the original currency" - - &amount_usd - name: amount_usd - description: "USD value of the trade at time of execution" - - &token_bought_address - name: token_bought_address - description: "Contract address of the token bought" - - &token_sold_address - name: token_sold_address - description: "Contract address of the token sold" - - &taker - name: taker - description: "Address of trader who purchased a token" - - &maker - name: maker - description: "Address of trader who sold a token" - - *pool_id - - &swap_fee - name: swap_fee - description: 'Swap fee' - - &project_contract_address - name: project_contract_address - description: "Pool address" - - name: pool_symbol - - name: pool_type - - *tx_hash - - &tx_from - name: tx_from - description: "transaction.from" - - &tx_to - name: tx_to - description: "transaction.to" - - *evt_index - - - name: balancer_v2_optimism_liquidity - meta: - blockchain: optimism - project: balancer_v2 - contributors: victorstefenon, viniabussafi, thetroyharris - config: - tags: ['optimism', 'balancer', 'pools', 'liquidity'] - description: > - Balancer v2 pools liquidity by token in Optimism. - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - day - - pool_id - - token_address - columns: - - name: day - description: 'UTC event block time truncated to the day mark' - - *pool_id - - name: pool_address - - name: pool_symbol - description: 'Symbol of the pool, consisting of the symbol of its tokens and their respective weights' - - name: version - description: 'Version of Balancer in which pool was deployed' - - name: blockchain - description: 'Blockchain in which pool was deployed' - - *token_address - - name: token_symbol - description: 'Symbol of the token' - - name: token_balance_raw - description: 'Raw balance of the token in the pool' - - name: token_balance - description: 'Scaled balance of the token in the pool' - - name: protocol_liquidity_usd - description: 'Liquidity of the token in the pool in USD, except BPTs' - - name: protocol_liquidity_eth - description: 'Liquidity of the token in the pool in ETH, except BPTs' - - name: pool_liquidity_usd - description: 'Liquidity of the token in the pool in USD, including BPTs' - - name: pool_liquidity_eth - description: 'Liquidity of the token in the pool in ETH, including BPTs' - - - name: balancer_optimism_gauge_mappings - meta: - blockchain: optimism - project: balancer - contributors: msilb7 - config: - tags: ['optimism', 'balancer', 'gauges', 'incentives'] - description: > - Balancer gauge to pool mappings on Optimism. - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - pool_contract - - incentives_contract - columns: - - *blockchain - - *version - - &pool_contract - name: pool_contract - description: "Address of the liquidity pool contract" - - *pool_id - - &incentives_contract - name: incentives_contract - description: "Address of the contract where incentives are stored and emitted." - - &incentives_type - name: incentives_type - description: "Description of the incentives address type." - - *evt_block_time - - *evt_block_number - - *contract_address - - *evt_tx_hash - - *evt_index - - - name: balancer_v2_optimism_flashloans - meta: - blockchain: optimism - sector: lending - contributors: hildobby - config: - tags: ['optimism', 'flashloans'] - description: > - All Balancer flashloans on Optimism - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - blockchain - - tx_hash - - evt_index - columns: - - name: blockchain - - name: project - - name: version - - name: block_time - - name: block_number - - name: amount - - name: amount_usd - - name: tx_hash - - name: evt_index - - name: fee - - name: currency_contract - - name: currency_symbol - - name: recipient - - name: contract_address - - name: block_month - - - name: balancer_v2_optimism_bpt_prices - meta: - blockchain: optimism - project: balancer_v2 - contributors: victorstefenon, thetroyharris, viniabussafi - config: - tags: ['optimism', 'bpt', 'prices'] - description: > - Balancer Pool Token (BPT) hourly median price by pool on Balancer, an automated portfolio manager and trading platform. - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - blockchain - - day - - contract_address - columns: - - name: blockchain - - name: day - - name: version - - name: decimals - - name: contract_address - - name: bpt_price - - - name: balancer_v2_optimism_trades - meta: - blockchain: optimism - sector: dex - contributors: bizzyvinci, thetroyharris, tomfutago, viniabussafi - config: - tags: [ 'balancer', 'optimism', 'amm', 'trades', 'dex', 'beta' ] - description: > - DEX trades on balancer v2 on optimism - columns: - - *blockchain - - *project - - *version - - *block_month - - *block_date - - *block_time - - name: block_number - - *token_bought_symbol - - *token_sold_symbol - - *token_pair - - *token_bought_amount - - *token_sold_amount - - *token_bought_amount_raw - - *token_sold_amount_raw - - *amount_usd - - *token_bought_address - - *token_sold_address - - *taker - - *maker - - *project_contract_address - - name: pool_symbol - - name: pool_type - - *pool_id - - *swap_fee - - *tx_hash - - *tx_from - - *tx_to - - *evt_index - - - name: balancer_v2_optimism_protocol_fee - meta: - blockchain: optimism - project: balancer_v2 - contributors: viniabussafi - config: - tags: ['optimism', 'revenue', 'fees'] - description: > - Daily Protocol Fee collected and Revenue by pool on Balancer, an automated portfolio manager and trading platform. - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - day - - pool_id - - token_address - columns: - - name: day - - name: pool_id - - name: pool_address - - name: pool_symbol - - name: version - - name: blockchain - - name: token_address - - name: token_symbol - - name: token_amount_raw - description: "Raw amount of revenues of the token in the pool" - - name: token_amount - description: "Amount of revenues of the token in the pool" - - name: protocol_fee_collected_usd - description: "Fee collected in the pool in USD" - - name: treasury_share - description: "Share of total revenue that is directed to Balancer DAO's treasury, as per BIPs 19, 161 and 371" - - name: treasury_revenue_usd - description: "Total revenue directed to Balancer DAO's treasury" - - - name: balancer_v2_optimism_bpt_supply - meta: - blockchain: optimism - project: balancer_v2 - contributors: thetroyharris, viniabussafi - config: - tags: ['optimism', 'bpt', 'supply'] - description: > - Balancer Pool Token (BPT) supply for ComposableStablePools versions 4 and 5. - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - day - - blockchain - - token_address - columns: - - name: day - - name: pool_type - - name: version - - name: blockchain - - name: token_address - - name: supply \ No newline at end of file diff --git a/models/balancer/polygon/balancer_polygon_schema.yml b/models/balancer/polygon/balancer_polygon_schema.yml deleted file mode 100644 index 4f2bbd24412..00000000000 --- a/models/balancer/polygon/balancer_polygon_schema.yml +++ /dev/null @@ -1,454 +0,0 @@ -version: 2 - -models: - - name: balancer_v2_polygon_pools_fees - meta: - blockchain: polygon - project: balancer_v2 - contributors: jacektrocinski, thetroyharris, viniabussafi - config: - tags: ['polygon', 'balancer', 'pools_fees'] - description: > - Balancer v2 swap fees stored at the pool level. - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - block_number - - tx_hash - - index - columns: - - name: blockchain - - name: version - - &contract_address - name: contract_address - description: 'Polygon address for the liquidity pool used in transaction' - tests: - - not_null - - &tx_hash - name: tx_hash - description: 'Transaction hash' - tests: - - not_null - - &index - name: index - description: '' - tests: - - not_null - - &tx_index - name: tx_index - description: '' - tests: - - not_null - - &block_time - name: block_time - description: '' - tests: - - not_null - - &block_number - name: block_number - description: 'Block number' - tests: - - not_null - - &swap_fee_percentage - name: swap_fee_percentage - description: 'Swap fees for the pool, values are returned with 18 decimals (1e18 meaning 100%)' - tests: - - not_null - - - name: balancer_v2_polygon_transfers_bpt - meta: - blockchain: polygon - project: balancer_v2 - contributors: victorstefenon, thetroyharris, viniabussafi - config: - tags: ['polygon', 'bpt', 'transfers'] - description: > - Balancer Pool Token (BPT) transfer logs on Balancer, an automated portfolio manager and trading platform, on Polygon. - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - evt_tx_hash - - evt_index - - block_date - columns: - - &blockchain - name: blockchain - description: "Blockchain" - - name: version - - *contract_address - - &block_date - name: block_date - description: "UTC event block date of each DEX trade" - - &block_month - name: block_month - description: "UTC event block month of each DEX trade" - - &evt_tx_hash - name: evt_tx_hash - description: 'Transaction hash of transfer event' - - &evt_index - name: evt_index - description: 'Event index' - - &evt_block_time - name: evt_block_time - description: 'Block time of transfer event' - - &evt_block_number - name: evt_block_number - description: 'Block number of transfer event' - - &from - name: from - description: 'Address of BPT provider of transfer event' - - &to - name: to - description: 'Address of BPT receiver of transfer event' - - &value - name: value - description: 'Amount of BPT transferred in transfer event' - - - name: balancer_polygon_pools_tokens_weights - meta: - blockchain: polygon - project: balancer - contributors: jacektrocinski, viniabussafi - config: - tags: ['polygon', 'balancer', 'pools', 'tokens', 'weights'] - description: > - Token weights in Balancer pools. - columns: - - *blockchain - - name: version - - &pool_id - name: pool_id - description: 'Unique encoded identifier that refers to each pool' - tests: - - not_null - - &token_address - name: token_address - description: 'Contract address for the token' - - &normalized_weight - name: normalized_weight - description: 'Weight of the token in the pool.' - - - name: balancer_v2_polygon_pools_tokens_weights - meta: - blockchain: polygon - project: balancer - contributors: jacektrocinski, viniabussafi - config: - tags: ['polygon', 'balancer', 'pools', 'tokens', 'weights'] - description: > - Token weights in Balancer v2 pools. - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - pool_id - - token_address - columns: - - *blockchain - - name: version - - *pool_id - - *token_address - - *normalized_weight - - - name: balancer_polygon_trades - meta: - blockchain: polygon - sector: dex - contributors: bizzyvinci - config: - tags: ['balancer', 'polygon', 'amm', 'trades', 'dex'] - description: > - DEX trades on balancer on polygon - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - block_date - - blockchain - - project - - version - - tx_hash - - evt_index - - check_dex_seed: - blockchain: polygon - project: balancer - version: 2 - columns: - - *blockchain - - &project - name: project - description: "Project name (balancer)" - - &version - name: version - description: "Version of the project" - - *block_month - - *block_date - - *block_time - - &token_bought_symbol - name: token_bought_symbol - description: "Token symbol for token bought in the trade" - - &token_sold_symbol - name: token_sold_symbol - description: "Token symbol for token sold in the trade" - - &token_pair - name: token_pair - description: "Token symbol pair for each token involved in the trade" - - &token_bought_amount - name: token_bought_amount - description: "Value of the token bought at time of execution in the original currency" - - &token_sold_amount - name: token_sold_amount - description: "Value of the token sold at time of execution in the original currency" - - &token_bought_amount_raw - name: token_bought_amount_raw - description: "Raw value of the token bought at time of execution in the original currency" - - &token_sold_amount_raw - name: token_sold_amount_raw - description: "Raw value of the token sold at time of execution in the original currency" - - &amount_usd - name: amount_usd - description: "USD value of the trade at time of execution" - - &token_bought_address - name: token_bought_address - description: "Contract address of the token bought" - - &token_sold_address - name: token_sold_address - description: "Contract address of the token sold" - - &taker - name: taker - description: "Address of trader who purchased a token" - - &maker - name: maker - description: "Address of trader who sold a token" - - *pool_id - - &swap_fee - name: swap_fee - description: 'Swap fee' - - &project_contract_address - name: project_contract_address - description: "Pool address" - - name: pool_symbol - - name: pool_type - - *tx_hash - - &tx_from - name: tx_from - description: "transaction.from" - - &tx_to - name: tx_to - description: "transaction.to" - - *evt_index - - - name: balancer_v2_polygon_liquidity - meta: - blockchain: polygon - project: balancer_v2 - contributors: victorstefenon, viniabussafi, thetroyharris - config: - tags: ['polygon', 'balancer', 'pools', 'liquidity'] - description: > - Balancer v2 pools liquidity by token in Polygon. - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - day - - pool_id - - token_address - columns: - - name: day - description: 'UTC event block time truncated to the day mark' - - *pool_id - - name: pool_address - - name: pool_symbol - description: 'Symbol of the pool, consisting of the symbol of its tokens and their respective weights' - - name: version - description: 'Version of Balancer in which pool was deployed' - - name: blockchain - description: 'Blockchain in which pool was deployed' - - *token_address - - name: token_symbol - description: 'Symbol of the token' - - name: token_balance_raw - description: 'Raw balance of the token in the pool' - - name: token_balance - description: 'Scaled balance of the token in the pool' - - name: protocol_liquidity_usd - description: 'Liquidity of the token in the pool in USD, except BPTs' - - name: protocol_liquidity_eth - description: 'Liquidity of the token in the pool in ETH, except BPTs' - - name: pool_liquidity_usd - description: 'Liquidity of the token in the pool in USD, including BPTs' - - name: pool_liquidity_eth - description: 'Liquidity of the token in the pool in ETH, including BPTs' - - - name: balancer_v2_polygon_lbps - meta: - blockchain: polygon - project: balancer_v2 - contributors: stefenon - config: - tags: ['polygon', 'balancer', 'lbp'] - description: > - Record of the Liquidity Boostrapping Pools (LBP) of Balancer, an automated portfolio manager and trading platform, on Polygon. - columns: - - name: name - description: 'Name of the LBP' - - name: pool_id - description: 'ID of the LBP' - - name: token_sold - description: 'Contract address of the token sold by the LBP' - - name: token_symbol - description: 'Symbol of the token sold by the LBP' - - name: start_time - description: 'LBP start time' - - name: end_time - description: 'LBP end time' - - - name: balancer_v2_polygon_flashloans - meta: - blockchain: polygon - sector: lending - contributors: hildobby - config: - tags: ['polygon', 'flashloans'] - description: > - All Balancer flashloans on Polygon - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - blockchain - - tx_hash - - evt_index - columns: - - name: blockchain - - name: project - - name: version - - name: block_time - - name: block_number - - name: amount - - name: amount_usd - - name: tx_hash - - name: evt_index - - name: fee - - name: currency_contract - - name: currency_symbol - - name: recipient - - name: contract_address - - name: block_month - - - name: balancer_v2_polygon_bpt_prices - meta: - blockchain: polygon - project: balancer_v2 - contributors: victorstefenon, thetroyharris, viniabussafi - config: - tags: ['polygon', 'bpt', 'prices'] - description: > - Balancer Pool Token (BPT) hourly median price by pool on Balancer, an automated portfolio manager and trading platform. - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - blockchain - - day - - contract_address - columns: - - name: blockchain - - name: day - - name: version - - name: decimals - - name: contract_address - - name: bpt_price - - - name: balancer_v2_polygon_trades - meta: - blockchain: polygon - sector: dex - contributors: bizzyvinci, thetroyharris, tomfutago, viniabussafi - config: - tags: [ 'balancer', 'polygon', 'amm', 'trades', 'dex', 'beta' ] - description: > - DEX trades on balancer v2 on polygon - columns: - - *blockchain - - *project - - *version - - *block_month - - *block_date - - *block_time - - name: block_number - - *token_bought_symbol - - *token_sold_symbol - - *token_pair - - *token_bought_amount - - *token_sold_amount - - *token_bought_amount_raw - - *token_sold_amount_raw - - *amount_usd - - *token_bought_address - - *token_sold_address - - *taker - - *maker - - *project_contract_address - - name: pool_symbol - - name: pool_type - - *pool_id - - *swap_fee - - *tx_hash - - *tx_from - - *tx_to - - *evt_index - - - name: balancer_v2_polygon_protocol_fee - meta: - blockchain: polygon - project: balancer_v2 - contributors: viniabussafi - config: - tags: ['polygon', 'revenue', 'fees'] - description: > - Daily Protocol Fee collected and Revenue by pool on Balancer, an automated portfolio manager and trading platform. - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - day - - pool_id - - token_address - columns: - - name: day - - name: pool_id - - name: pool_address - - name: pool_symbol - - name: version - - name: blockchain - - name: token_address - - name: token_symbol - - name: token_amount_raw - description: "Raw amount of revenues of the token in the pool" - - name: token_amount - description: "Amount of revenues of the token in the pool" - - name: protocol_fee_collected_usd - description: "Fee collected in the pool in USD" - - name: treasury_share - description: "Share of total revenue that is directed to Balancer DAO's treasury, as per BIPs 19, 161 and 371" - - name: treasury_revenue_usd - description: "Total revenue directed to Balancer DAO's treasury" - - - name: balancer_v2_polygon_bpt_supply - meta: - blockchain: polygon - project: balancer_v2 - contributors: thetroyharris, viniabussafi - config: - tags: ['polygon', 'bpt', 'supply'] - description: > - Balancer Pool Token (BPT) supply for ComposableStablePools versions 4 and 5. - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - day - - blockchain - - token_address - columns: - - name: day - - name: pool_type - - name: version - - name: blockchain - - name: token_address - - name: supply \ No newline at end of file diff --git a/models/balancer/zkevm/balancer_zkevm_schema.yml b/models/balancer/zkevm/balancer_zkevm_schema.yml deleted file mode 100644 index a573e89563d..00000000000 --- a/models/balancer/zkevm/balancer_zkevm_schema.yml +++ /dev/null @@ -1,431 +0,0 @@ -version: 2 - -models: - - name: balancer_v2_zkevm_pools_fees - meta: - blockchain: zkevm - project: balancer_v2 - contributors: jacektrocinski, thetroyharris, viniabussafi - config: - tags: ['zkevm', 'balancer', 'pools_fees'] - description: > - Balancer v2 swap fees stored at the pool level. - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - block_number - - tx_hash - - index - columns: - - name: blockchain - - name: version - - &contract_address - name: contract_address - description: 'zkevm address for the liquidity pool used in transaction' - tests: - - not_null - - &tx_hash - name: tx_hash - description: 'Transaction hash' - tests: - - not_null - - &index - name: index - description: '' - tests: - - not_null - - &tx_index - name: tx_index - description: '' - tests: - - not_null - - &block_time - name: block_time - description: '' - tests: - - not_null - - &block_number - name: block_number - description: 'Block number' - tests: - - not_null - - &swap_fee_percentage - name: swap_fee_percentage - description: 'Swap fees for the pool, values are returned with 18 decimals (1e18 meaning 100%)' - tests: - - not_null - - - name: balancer_v2_zkevm_transfers_bpt - meta: - blockchain: zkevm - project: balancer_v2 - contributors: victorstefenon, thetroyharris, viniabussafi - config: - tags: ['zkevm', 'bpt', 'transfers'] - description: > - Balancer Pool Token (BPT) transfer logs on Balancer, an automated portfolio manager and trading platform, on Polygon. - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - evt_tx_hash - - evt_index - - block_date - columns: - - &blockchain - name: blockchain - description: "Blockchain" - - name: version - - *contract_address - - &block_date - name: block_date - description: "UTC event block date of each DEX trade" - - &block_month - name: block_month - description: "UTC event block month of each DEX trade" - - &evt_tx_hash - name: evt_tx_hash - description: 'Transaction hash of transfer event' - - &evt_index - name: evt_index - description: 'Event index' - - &evt_block_time - name: evt_block_time - description: 'Block time of transfer event' - - &evt_block_number - name: evt_block_number - description: 'Block number of transfer event' - - &from - name: from - description: 'Address of BPT provider of transfer event' - - &to - name: to - description: 'Address of BPT receiver of transfer event' - - &value - name: value - description: 'Amount of BPT transferred in transfer event' - - - name: balancer_zkevm_pools_tokens_weights - meta: - blockchain: zkevm - project: balancer - contributors: jacektrocinski, viniabussafi - config: - tags: ['zkevm', 'balancer', 'pools', 'tokens', 'weights'] - description: > - Token weights in Balancer pools. - columns: - - name: blockchain - - name: version - - &pool_id - name: pool_id - description: 'Unique encoded identifier that refers to each pool' - tests: - - not_null - - &token_address - name: token_address - description: 'Contract address for the token' - - &normalized_weight - name: normalized_weight - description: 'Weight of the token in the pool.' - - - name: balancer_v2_zkevm_pools_tokens_weights - meta: - blockchain: zkevm - project: balancer - contributors: jacektrocinski, viniabussafi - config: - tags: ['zkevm', 'balancer', 'pools', 'tokens', 'weights'] - description: > - Token weights in Balancer v2 pools. - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - pool_id - - token_address - columns: - - name: blockchain - - name: version - - name: pool_id - - name: token_address - - name: normalized_weight - - - name: balancer_zkevm_trades - meta: - blockchain: zkevm - sector: dex - contributors: bizzyvinci, viniabussafi - config: - tags: ['balancer', 'zkevm', 'amm', 'trades', 'dex'] - description: > - DEX trades on balancer on zkevm - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - block_date - - blockchain - - project - - version - - tx_hash - - evt_index - - check_dex_seed: - blockchain: zkevm - project: balancer - version: 2 - columns: - - name: blockchain - - &project - name: project - description: "Project name (balancer)" - - &version - name: version - description: "Version of the project" - - name: block_month - - name: block_date - - name: block_time - - &token_bought_symbol - name: token_bought_symbol - description: "Token symbol for token bought in the trade" - - &token_sold_symbol - name: token_sold_symbol - description: "Token symbol for token sold in the trade" - - &token_pair - name: token_pair - description: "Token symbol pair for each token involved in the trade" - - &token_bought_amount - name: token_bought_amount - description: "Value of the token bought at time of execution in the original currency" - - &token_sold_amount - name: token_sold_amount - description: "Value of the token sold at time of execution in the original currency" - - &token_bought_amount_raw - name: token_bought_amount_raw - description: "Raw value of the token bought at time of execution in the original currency" - - &token_sold_amount_raw - name: token_sold_amount_raw - description: "Raw value of the token sold at time of execution in the original currency" - - &amount_usd - name: amount_usd - description: "USD value of the trade at time of execution" - - &token_bought_address - name: token_bought_address - description: "Contract address of the token bought" - - &token_sold_address - name: token_sold_address - description: "Contract address of the token sold" - - &taker - name: taker - description: "Address of trader who purchased a token" - - &maker - name: maker - description: "Address of trader who sold a token" - - name: pool_id - - &swap_fee - name: swap_fee - description: 'Swap fee' - - &project_contract_address - name: project_contract_address - description: "Pool address" - - name: pool_symbol - - name: pool_type - - name: tx_hash - - &tx_from - name: tx_from - description: "transaction.from" - - &tx_to - name: tx_to - description: "transaction.to" - - name: evt_index - - - name: balancer_v2_zkevm_liquidity - meta: - blockchain: zkevm - project: balancer_v2 - contributors: victorstefenon, viniabussafi, thetroyharris - config: - tags: ['zkevm', 'balancer', 'pools', 'liquidity'] - description: > - Balancer v2 pools liquidity by token in zkevm. - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - day - - pool_id - - token_address - columns: - - name: day - description: 'UTC event block time truncated to the day mark' - - name: pool_id - - name: pool_address - - name: pool_symbol - description: 'Symbol of the pool, consisting of the symbol of its tokens and their respective weights' - - name: version - description: 'Version of Balancer in which pool was deployed' - - name: blockchain - description: 'Blockchain in which pool was deployed' - - name: token_address - - name: token_symbol - description: 'Symbol of the token' - - name: token_balance_raw - description: 'Raw balance of the token in the pool' - - name: token_balance - description: 'Scaled balance of the token in the pool' - - name: protocol_liquidity_usd - description: 'Liquidity of the token in the pool in USD, except BPTs' - - name: protocol_liquidity_eth - description: 'Liquidity of the token in the pool in ETH, except BPTs' - - name: pool_liquidity_usd - description: 'Liquidity of the token in the pool in USD, including BPTs' - - name: pool_liquidity_eth - description: 'Liquidity of the token in the pool in ETH, including BPTs' - - - name: balancer_v2_zkevm_flashloans - meta: - blockchain: zkevm - sector: lending - contributors: hildobby, viniabussafi - config: - tags: ['zkevm', 'flashloans'] - description: > - All Balancer flashloans on zkevm - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - blockchain - - tx_hash - - evt_index - columns: - - name: blockchain - - name: project - - name: version - - name: block_time - - name: block_number - - name: amount - - name: amount_usd - - name: tx_hash - - name: evt_index - - name: fee - - name: currency_contract - - name: currency_symbol - - name: recipient - - name: contract_address - - name: block_month - - - name: balancer_v2_zkevm_bpt_prices - meta: - blockchain: zkevm - project: balancer_v2 - contributors: victorstefenon, thetroyharris, viniabussafi - config: - tags: ['zkevm', 'bpt', 'prices'] - description: > - Balancer Pool Token (BPT) hourly median price by pool on Balancer, an automated portfolio manager and trading platform. - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - blockchain - - day - - contract_address - columns: - - name: blockchain - - name: day - - name: version - - name: decimals - - name: contract_address - - name: bpt_price - - - name: balancer_v2_zkevm_trades - meta: - blockchain: zkevm - sector: dex - contributors: bizzyvinci, thetroyharris, tomfutago, viniabussafi - config: - tags: [ 'balancer', 'zkevm', 'amm', 'trades', 'dex', 'beta' ] - description: > - DEX trades on balancer v2 on zkevm - columns: - - name: blockchain - - name: project - - name: version - - name: block_month - - name: block_date - - name: block_time - - name: block_number - - name: token_bought_symbol - - name: token_sold_symbol - - name: token_pair - - name: token_bought_amount - - name: token_sold_amount - - name: token_bought_amount_raw - - name: token_sold_amount_raw - - name: amount_usd - - name: token_bought_address - - name: token_sold_address - - name: taker - - name: maker - - name: project_contract_address - - name: pool_symbol - - name: pool_type - - name: pool_id - - name: swap_fee - - name: tx_hash - - name: tx_from - - name: tx_to - - name: evt_index - - - name: balancer_v2_zkevm_protocol_fee - meta: - blockchain: zkevm - project: balancer_v2 - contributors: viniabussafi - config: - tags: ['zkevm', 'revenue', 'fees'] - description: > - Daily Protocol Fee collected and Revenue by pool on Balancer, an automated portfolio manager and trading platform. - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - day - - pool_id - - token_address - columns: - - name: day - - name: pool_id - - name: pool_address - - name: pool_symbol - - name: version - - name: blockchain - - name: token_address - - name: token_symbol - - name: token_amount_raw - description: "Raw amount of revenues of the token in the pool" - - name: token_amount - description: "Amount of revenues of the token in the pool" - - name: protocol_fee_collected_usd - description: "Fee collected in the pool in USD" - - name: treasury_share - description: "Share of total revenue that is directed to Balancer DAO's treasury, as per BIPs 19, 161 and 371" - - name: treasury_revenue_usd - description: "Total revenue directed to Balancer DAO's treasury" - - - name: balancer_v2_zkevm_bpt_supply - meta: - blockchain: zkevm - project: balancer_v2 - contributors: thetroyharris, viniabussafi - config: - tags: ['zkevm', 'bpt', 'supply'] - description: > - Balancer Pool Token (BPT) supply for ComposableStablePools versions 4 and 5. - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - day - - blockchain - - token_address - columns: - - name: day - - name: pool_type - - name: version - - name: blockchain - - name: token_address - - name: supply From f1b6ee8c174a01f8bb1d9013a936f091f3075644 Mon Sep 17 00:00:00 2001 From: jeff-dude <102681548+jeff-dude@users.noreply.github.com> Date: Tue, 4 Jun 2024 15:11:56 -0400 Subject: [PATCH 040/149] fix incremental predicates which caused dupes (#6073) --- .../chainlink_avalanche_c_automation_performed_daily.sql | 2 +- .../bnb/chainlink_bnb_automation_performed_daily.sql | 2 +- .../chainlink_ethereum_automation_performed_daily.sql | 2 +- .../fantom/chainlink_fantom_automation_performed_daily.sql | 2 +- .../polygon/chainlink_polygon_automation_performed_daily.sql | 2 +- models/oneinch/ethereum/oneinch_ethereum_airdrop_claims.sql | 4 ++-- 6 files changed, 7 insertions(+), 7 deletions(-) diff --git a/daily_spellbook/models/chainlink/avalanche_c/chainlink_avalanche_c_automation_performed_daily.sql b/daily_spellbook/models/chainlink/avalanche_c/chainlink_avalanche_c_automation_performed_daily.sql index cd7edf3f436..23c28bf3dda 100644 --- a/daily_spellbook/models/chainlink/avalanche_c/chainlink_avalanche_c_automation_performed_daily.sql +++ b/daily_spellbook/models/chainlink/avalanche_c/chainlink_avalanche_c_automation_performed_daily.sql @@ -7,7 +7,7 @@ file_format='delta', incremental_strategy='merge', unique_key=['date_start', 'keeper_address'], - incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.date_month')] + incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.date_start')] ) }} diff --git a/daily_spellbook/models/chainlink/bnb/chainlink_bnb_automation_performed_daily.sql b/daily_spellbook/models/chainlink/bnb/chainlink_bnb_automation_performed_daily.sql index 3291166df9b..5e2e9d92ab7 100644 --- a/daily_spellbook/models/chainlink/bnb/chainlink_bnb_automation_performed_daily.sql +++ b/daily_spellbook/models/chainlink/bnb/chainlink_bnb_automation_performed_daily.sql @@ -7,7 +7,7 @@ file_format='delta', incremental_strategy='merge', unique_key=['date_start', 'keeper_address'], - incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.date_month')] + incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.date_start')] ) }} diff --git a/daily_spellbook/models/chainlink/ethereum/chainlink_ethereum_automation_performed_daily.sql b/daily_spellbook/models/chainlink/ethereum/chainlink_ethereum_automation_performed_daily.sql index a2a19fa6572..465522f931e 100644 --- a/daily_spellbook/models/chainlink/ethereum/chainlink_ethereum_automation_performed_daily.sql +++ b/daily_spellbook/models/chainlink/ethereum/chainlink_ethereum_automation_performed_daily.sql @@ -7,7 +7,7 @@ file_format='delta', incremental_strategy='merge', unique_key=['date_start', 'keeper_address'], - incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.date_month')] + incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.date_start')] ) }} diff --git a/daily_spellbook/models/chainlink/fantom/chainlink_fantom_automation_performed_daily.sql b/daily_spellbook/models/chainlink/fantom/chainlink_fantom_automation_performed_daily.sql index 468a157de34..9e7b07e4449 100644 --- a/daily_spellbook/models/chainlink/fantom/chainlink_fantom_automation_performed_daily.sql +++ b/daily_spellbook/models/chainlink/fantom/chainlink_fantom_automation_performed_daily.sql @@ -7,7 +7,7 @@ file_format='delta', incremental_strategy='merge', unique_key=['date_start', 'keeper_address'], - incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.date_month')] + incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.date_start')] ) }} diff --git a/daily_spellbook/models/chainlink/polygon/chainlink_polygon_automation_performed_daily.sql b/daily_spellbook/models/chainlink/polygon/chainlink_polygon_automation_performed_daily.sql index b2745aa9403..bd1224ba357 100644 --- a/daily_spellbook/models/chainlink/polygon/chainlink_polygon_automation_performed_daily.sql +++ b/daily_spellbook/models/chainlink/polygon/chainlink_polygon_automation_performed_daily.sql @@ -7,7 +7,7 @@ file_format='delta', incremental_strategy='merge', unique_key=['date_start', 'keeper_address'], - incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.date_month')] + incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.date_start')] ) }} diff --git a/models/oneinch/ethereum/oneinch_ethereum_airdrop_claims.sql b/models/oneinch/ethereum/oneinch_ethereum_airdrop_claims.sql index 57a5bb0d1e9..cc83033c280 100644 --- a/models/oneinch/ethereum/oneinch_ethereum_airdrop_claims.sql +++ b/models/oneinch/ethereum/oneinch_ethereum_airdrop_claims.sql @@ -46,8 +46,8 @@ LEFT JOIN {{ ref('prices_usd_forward_fill') }} pu ON pu.blockchain = 'ethereum' AND pu.contract_address= {{oinch_token_address}} AND pu.minute=date_trunc('minute', t.evt_block_time) {% if is_incremental() %} - AND pu.minute >= date_trunc('day', now() - interval '7' Day) + AND {{incremental_predicate('pu.minute')}} {% endif %} {% if is_incremental() %} -WHERE t.evt_block_time >= date_trunc('day', now() - interval '7' Day) +WHERE {{incremental_predicate('t.evt_block_time')}} {% endif %} \ No newline at end of file From b615dd740359aa2c856afa0129f0d029d683094a Mon Sep 17 00:00:00 2001 From: jeff-dude <102681548+jeff-dude@users.noreply.github.com> Date: Tue, 4 Jun 2024 15:35:40 -0400 Subject: [PATCH 041/149] Revert "Revert "Revert "Organize Balancer Spells into folders (#6005)" (#6074)" (#6075)" (#6077) This reverts commit 8e1ef8576c68892f780e742392538bd1feaa7b42. --- dbt_project.yml | 13 + .../balancer/balancer_bpt_supply_macro.sql | 34 +- ...l_token_supply_changes_daily_agg_macro.sql | 37 - ...lancer_pool_token_supply_changes_macro.sql | 130 ---- ..._token_balance_changes_daily_agg_macro.sql | 184 ----- .../balancer_token_balance_changes_macro.sql | 169 ----- .../balancer/{trades => }/balancer_trades.sql | 0 models/_project/balancer/balances/_schema.yml | 98 --- .../balancer/balances/arbitrum/_schema.yml | 100 --- ...ncer_v2_arbitrum_token_balance_changes.sql | 16 - ...2_arbitrum_token_balance_changes_daily.sql | 17 - .../balancer/balances/avalanche_c/_schema.yml | 100 --- ...r_v2_avalanche_c_token_balance_changes.sql | 16 - ...valanche_c_token_balance_changes_daily.sql | 17 - .../balancer_token_balance_changes.sql | 46 -- .../balancer_token_balance_changes_daily.sql | 43 -- .../balancer/balances/base/_schema.yml | 100 --- ...balancer_v2_base_token_balance_changes.sql | 16 - ...er_v2_base_token_balance_changes_daily.sql | 17 - .../balancer/balances/ethereum/_schema.yml | 131 ---- ...ncer_v2_ethereum_token_balance_changes.sql | 16 - ...2_ethereum_token_balance_changes_daily.sql | 17 - .../balancer/balances/gnosis/_schema.yml | 100 --- ...lancer_v2_gnosis_token_balance_changes.sql | 16 - ..._v2_gnosis_token_balance_changes_daily.sql | 17 - .../balancer/balances/optimism/_schema.yml | 100 --- ...ncer_v2_optimism_token_balance_changes.sql | 16 - ...2_optimism_token_balance_changes_daily.sql | 17 - .../balancer/balances/polygon/_schema.yml | 100 --- ...ancer_v2_polygon_token_balance_changes.sql | 16 - ...v2_polygon_token_balance_changes_daily.sql | 17 - .../balancer/balances/zkevm/_schema.yml | 100 --- ...alancer_v2_zkevm_token_balance_changes.sql | 16 - ...r_v2_zkevm_token_balance_changes_daily.sql | 17 - models/_project/balancer/bpt/_schema.yml | 176 ----- .../balancer/bpt/arbitrum/_schema.yml | 178 ----- ...alancer_v2_arbitrum_bpt_supply_changes.sql | 20 - ...r_v2_arbitrum_bpt_supply_changes_daily.sql | 17 - .../balancer/bpt/avalanche_c/_schema.yml | 178 ----- ...ncer_v2_avalanche_c_bpt_supply_changes.sql | 20 - ...2_avalanche_c_bpt_supply_changes_daily.sql | 17 - .../bpt/balancer_bpt_supply_changes.sql | 44 -- .../bpt/balancer_bpt_supply_changes_daily.sql | 38 - models/_project/balancer/bpt/base/_schema.yml | 178 ----- .../balancer_v2_base_bpt_supply_changes.sql | 20 - ...ancer_v2_base_bpt_supply_changes_daily.sql | 17 - .../balancer/bpt/ethereum/_schema.yml | 178 ----- ...alancer_v2_ethereum_bpt_supply_changes.sql | 20 - ...r_v2_ethereum_bpt_supply_changes_daily.sql | 17 - .../_project/balancer/bpt/gnosis/_schema.yml | 178 ----- .../balancer_v2_gnosis_bpt_supply_changes.sql | 20 - ...cer_v2_gnosis_bpt_supply_changes_daily.sql | 17 - .../balancer/bpt/optimism/_schema.yml | 178 ----- ...alancer_v2_optimism_bpt_supply_changes.sql | 20 - ...r_v2_optimism_bpt_supply_changes_daily.sql | 17 - .../_project/balancer/bpt/polygon/_schema.yml | 178 ----- ...balancer_v2_polygon_bpt_supply_changes.sql | 20 - ...er_v2_polygon_bpt_supply_changes_daily.sql | 17 - .../_project/balancer/bpt/zkevm/_schema.yml | 178 ----- .../balancer_v2_zkevm_bpt_supply_changes.sql | 20 - ...ncer_v2_zkevm_bpt_supply_changes_daily.sql | 17 - .../_project/balancer/flashloans/_schema.yml | 35 - .../balancer/flashloans/arbitrum/_schema.yml | 36 - .../flashloans/avalanche_c/_schema.yml | 36 - .../balancer/flashloans/base/_schema.yml | 36 - .../balancer/flashloans/ethereum/_schema.yml | 36 - .../balancer/flashloans/gnosis/_schema.yml | 36 - .../balancer/flashloans/optimism/_schema.yml | 36 - .../balancer/flashloans/polygon/_schema.yml | 36 - .../balancer/flashloans/zkevm/_schema.yml | 36 - .../_project/balancer/liquidity/_schema.yml | 60 -- .../balancer/liquidity/arbitrum/_schema.yml | 58 -- .../liquidity/avalanche_c/_schema.yml | 58 -- .../balancer/liquidity/base/_schema.yml | 58 -- .../balancer/liquidity/ethereum/_schema.yml | 96 --- .../balancer/liquidity/gnosis/_schema.yml | 58 -- .../balancer/liquidity/optimism/_schema.yml | 58 -- .../balancer/liquidity/polygon/_schema.yml | 58 -- .../balancer/liquidity/zkevm/_schema.yml | 58 -- models/_project/balancer/pools/_schema.yml | 173 ----- .../balancer/pools/arbitrum/_schema.yml | 105 --- .../balancer/pools/avalanche_c/_schema.yml | 105 --- .../_project/balancer/pools/base/_schema.yml | 105 --- .../balancer/pools/ethereum/_schema.yml | 149 ---- .../balancer/pools/gnosis/_schema.yml | 105 --- .../balancer/pools/optimism/_schema.yml | 146 ---- .../balancer/pools/polygon/_schema.yml | 128 ---- .../_project/balancer/pools/zkevm/_schema.yml | 105 --- .../balancer/protocol_fee/_schema.yml | 61 -- .../protocol_fee/arbitrum/_schema.yml | 61 -- .../protocol_fee/avalanche_c/_schema.yml | 61 -- .../balancer/protocol_fee/base/_schema.yml | 61 -- .../protocol_fee/ethereum/_schema.yml | 61 -- .../balancer/protocol_fee/gnosis/_schema.yml | 61 -- .../protocol_fee/optimism/_schema.yml | 61 -- .../balancer/protocol_fee/polygon/_schema.yml | 61 -- .../balancer/protocol_fee/zkevm/_schema.yml | 61 -- models/_project/balancer/support/_schema.yml | 56 -- .../balancer/trades/arbitrum/_schema.yml | 149 ---- .../balancer/trades/avalanche_c/_schema.yml | 149 ---- .../_project/balancer/trades/base/_schema.yml | 149 ---- .../balancer/trades/ethereum/_schema.yml | 145 ---- .../balancer/trades/gnosis/_schema.yml | 149 ---- .../balancer/trades/optimism/_schema.yml | 149 ---- .../balancer/trades/polygon/_schema.yml | 149 ---- .../balancer/trades/zkevm/_schema.yml | 110 --- .../balancer/vebal/ethereum/_schema.yml | 91 --- ...balancer_arbitrum_pools_tokens_weights.sql | 0 .../arbitrum/balancer_arbitrum_schema.yml | 432 ++++++++++++ .../arbitrum/balancer_arbitrum_trades.sql | 0 .../balancer_v2_arbitrum_bpt_prices.sql | 0 .../balancer_v2_arbitrum_bpt_supply.sql | 0 .../balancer_v2_arbitrum_flashloans.sql | 4 + .../balancer_v2_arbitrum_liquidity.sql | 6 +- .../balancer_v2_arbitrum_pools_fees.sql | 11 +- ...ancer_v2_arbitrum_pools_tokens_weights.sql | 1 + .../balancer_v2_arbitrum_protocol_fee.sql | 0 .../arbitrum/balancer_v2_arbitrum_trades.sql | 6 +- .../balancer_v2_arbitrum_transfers_bpt.sql | 0 ...ancer_avalanche_c_pools_tokens_weights.sql | 0 .../balancer_avalanche_c_schema.yml | 405 +++++++++++ .../balancer_avalanche_c_trades.sql | 0 .../balancer_v2_avalanche_c_bpt_prices.sql | 0 .../balancer_v2_avalanche_c_bpt_supply.sql | 0 .../balancer_v2_avalanche_c_flashloans.sql | 4 + .../balancer_v2_avalanche_c_liquidity.sql | 6 +- .../balancer_v2_avalanche_c_pools_fees.sql | 9 +- ...er_v2_avalanche_c_pools_tokens_weights.sql | 1 + .../balancer_v2_avalanche_c_protocol_fee.sql | 0 .../balancer_v2_avalanche_c_trades.sql | 8 +- .../balancer_v2_avalanche_c_transfers_bpt.sql | 0 .../bpt => balancer}/balancer_bpt_prices.sql | 8 +- .../bpt => balancer}/balancer_bpt_supply.sql | 8 +- .../balancer_flashloans.sql | 11 +- .../balancer_gauge_mappings.sql | 7 +- .../balancer_liquidity.sql | 9 +- .../balancer_pools_fees.sql | 9 +- .../balancer_pools_metrics_daily.sql | 0 .../balancer_pools_tokens_weights.sql | 8 +- .../balancer_protocol_fee.sql | 8 +- models/balancer/balancer_schema.yml | 365 ++++++++++ .../balancer_single_recipient_gauges.sql | 0 .../balancer_token_whitelist.sql | 0 .../balancer_transfers_bpt.sql | 8 +- .../balancer_base_pools_tokens_weights.sql | 0 models/balancer/base/balancer_base_schema.yml | 405 +++++++++++ .../base/balancer_base_trades.sql | 0 .../base/balancer_v2_base_bpt_prices.sql | 0 .../base/balancer_v2_base_bpt_supply.sql | 0 .../base/balancer_v2_base_flashloans.sql | 4 + .../base/balancer_v2_base_liquidity.sql | 6 +- .../base/balancer_v2_base_pools_fees.sql | 9 +- .../balancer_v2_base_pools_tokens_weights.sql | 1 + .../base/balancer_v2_base_protocol_fee.sql | 0 .../base/balancer_v2_base_trades.sql | 6 +- .../base/balancer_v2_base_transfers_bpt.sql | 0 .../ethereum/balancer_ethereum_balances.sql | 11 +- ...balancer_ethereum_pools_tokens_weights.sql | 0 .../ethereum/balancer_ethereum_schema.yml | 665 ++++++++++++++++++ .../ethereum/balancer_ethereum_trades.sql | 0 .../balancer_ethereum_vebal_balances_day.sql | 7 +- .../balancer_ethereum_vebal_slopes.sql | 9 +- .../balancer_ethereum_vebal_votes.sql | 8 +- .../balancer_v1_ethereum_liquidity.sql | 6 +- ...ancer_v1_ethereum_pools_tokens_weights.sql | 7 +- .../ethereum/balancer_v1_ethereum_trades.sql | 0 .../balancer_v2_ethereum_bpt_prices.sql | 0 .../balancer_v2_ethereum_bpt_supply.sql | 0 .../balancer_v2_ethereum_flashloans.sql | 4 + .../ethereum/balancer_v2_ethereum_lbps.sql | 0 .../balancer_v2_ethereum_liquidity.sql | 6 +- .../balancer_v2_ethereum_pools_fees.sql | 7 +- ...ancer_v2_ethereum_pools_tokens_weights.sql | 1 + .../balancer_v2_ethereum_protocol_fee.sql | 0 .../ethereum/balancer_v2_ethereum_trades.sql | 6 +- .../balancer_v2_ethereum_transfers_bpt.sql | 0 .../balancer_gnosis_pools_tokens_weights.sql | 0 .../gnosis/balancer_gnosis_schema.yml | 404 +++++++++++ .../gnosis/balancer_gnosis_trades.sql | 0 .../gnosis/balancer_v2_gnosis_bpt_prices.sql | 0 .../gnosis/balancer_v2_gnosis_bpt_supply.sql | 0 .../gnosis/balancer_v2_gnosis_flashloans.sql | 4 + .../gnosis/balancer_v2_gnosis_liquidity.sql | 6 +- .../gnosis/balancer_v2_gnosis_pools_fees.sql | 9 +- ...alancer_v2_gnosis_pools_tokens_weights.sql | 1 + .../balancer_v2_gnosis_protocol_fee.sql | 0 .../gnosis/balancer_v2_gnosis_trades.sql | 6 +- .../balancer_v2_gnosis_transfers_bpt.sql | 0 .../balancer_optimism_gauge_mappings.sql | 7 +- ...balancer_optimism_pools_tokens_weights.sql | 3 +- .../optimism/balancer_optimism_schema.yml | 464 ++++++++++++ .../optimism/balancer_optimism_trades.sql | 0 .../balancer_v2_optimism_bpt_prices.sql | 0 .../balancer_v2_optimism_bpt_supply.sql | 0 .../balancer_v2_optimism_flashloans.sql | 4 + .../balancer_v2_optimism_liquidity.sql | 6 +- .../balancer_v2_optimism_pools_fees.sql | 9 +- ...ancer_v2_optimism_pools_tokens_weights.sql | 1 + .../balancer_v2_optimism_protocol_fee.sql | 0 .../optimism/balancer_v2_optimism_trades.sql | 6 +- .../balancer_v2_optimism_transfers_bpt.sql | 0 .../balancer_polygon_pools_tokens_weights.sql | 0 .../polygon/balancer_polygon_schema.yml | 454 ++++++++++++ .../polygon/balancer_polygon_trades.sql | 0 .../balancer_v2_polygon_bpt_prices.sql | 0 .../balancer_v2_polygon_bpt_supply.sql | 0 .../balancer_v2_polygon_flashloans.sql | 4 + .../polygon/balancer_v2_polygon_lbps.sql | 0 .../polygon/balancer_v2_polygon_liquidity.sql | 6 +- .../balancer_v2_polygon_pools_fees.sql | 9 +- ...lancer_v2_polygon_pools_tokens_weights.sql | 1 + .../balancer_v2_polygon_protocol_fee.sql | 0 .../polygon/balancer_v2_polygon_trades.sql | 6 +- .../balancer_v2_polygon_transfers_bpt.sql | 0 .../zkevm/balancer_v2_zkevm_bpt_prices.sql | 0 .../zkevm/balancer_v2_zkevm_bpt_supply.sql | 0 .../zkevm/balancer_v2_zkevm_flashloans.sql | 4 + .../zkevm/balancer_v2_zkevm_liquidity.sql | 6 +- .../zkevm/balancer_v2_zkevm_pools_fees.sql | 6 +- ...balancer_v2_zkevm_pools_tokens_weights.sql | 0 .../zkevm/balancer_v2_zkevm_protocol_fee.sql | 0 .../zkevm/balancer_v2_zkevm_trades.sql | 6 +- .../zkevm/balancer_v2_zkevm_transfers_bpt.sql | 0 .../balancer_zkevm_pools_tokens_weights.sql | 0 .../balancer/zkevm/balancer_zkevm_schema.yml | 431 ++++++++++++ .../zkevm/balancer_zkevm_trades.sql | 0 226 files changed, 4295 insertions(+), 7748 deletions(-) delete mode 100644 macros/models/_project/balancer/balancer_pool_token_supply_changes_daily_agg_macro.sql delete mode 100644 macros/models/_project/balancer/balancer_pool_token_supply_changes_macro.sql delete mode 100644 macros/models/_project/balancer/balancer_token_balance_changes_daily_agg_macro.sql delete mode 100644 macros/models/_project/balancer/balancer_token_balance_changes_macro.sql rename models/_project/balancer/{trades => }/balancer_trades.sql (100%) delete mode 100644 models/_project/balancer/balances/_schema.yml delete mode 100644 models/_project/balancer/balances/arbitrum/_schema.yml delete mode 100644 models/_project/balancer/balances/arbitrum/balancer_v2_arbitrum_token_balance_changes.sql delete mode 100644 models/_project/balancer/balances/arbitrum/balancer_v2_arbitrum_token_balance_changes_daily.sql delete mode 100644 models/_project/balancer/balances/avalanche_c/_schema.yml delete mode 100644 models/_project/balancer/balances/avalanche_c/balancer_v2_avalanche_c_token_balance_changes.sql delete mode 100644 models/_project/balancer/balances/avalanche_c/balancer_v2_avalanche_c_token_balance_changes_daily.sql delete mode 100644 models/_project/balancer/balances/balancer_token_balance_changes.sql delete mode 100644 models/_project/balancer/balances/balancer_token_balance_changes_daily.sql delete mode 100644 models/_project/balancer/balances/base/_schema.yml delete mode 100644 models/_project/balancer/balances/base/balancer_v2_base_token_balance_changes.sql delete mode 100644 models/_project/balancer/balances/base/balancer_v2_base_token_balance_changes_daily.sql delete mode 100644 models/_project/balancer/balances/ethereum/_schema.yml delete mode 100644 models/_project/balancer/balances/ethereum/balancer_v2_ethereum_token_balance_changes.sql delete mode 100644 models/_project/balancer/balances/ethereum/balancer_v2_ethereum_token_balance_changes_daily.sql delete mode 100644 models/_project/balancer/balances/gnosis/_schema.yml delete mode 100644 models/_project/balancer/balances/gnosis/balancer_v2_gnosis_token_balance_changes.sql delete mode 100644 models/_project/balancer/balances/gnosis/balancer_v2_gnosis_token_balance_changes_daily.sql delete mode 100644 models/_project/balancer/balances/optimism/_schema.yml delete mode 100644 models/_project/balancer/balances/optimism/balancer_v2_optimism_token_balance_changes.sql delete mode 100644 models/_project/balancer/balances/optimism/balancer_v2_optimism_token_balance_changes_daily.sql delete mode 100644 models/_project/balancer/balances/polygon/_schema.yml delete mode 100644 models/_project/balancer/balances/polygon/balancer_v2_polygon_token_balance_changes.sql delete mode 100644 models/_project/balancer/balances/polygon/balancer_v2_polygon_token_balance_changes_daily.sql delete mode 100644 models/_project/balancer/balances/zkevm/_schema.yml delete mode 100644 models/_project/balancer/balances/zkevm/balancer_v2_zkevm_token_balance_changes.sql delete mode 100644 models/_project/balancer/balances/zkevm/balancer_v2_zkevm_token_balance_changes_daily.sql delete mode 100644 models/_project/balancer/bpt/_schema.yml delete mode 100644 models/_project/balancer/bpt/arbitrum/_schema.yml delete mode 100644 models/_project/balancer/bpt/arbitrum/balancer_v2_arbitrum_bpt_supply_changes.sql delete mode 100644 models/_project/balancer/bpt/arbitrum/balancer_v2_arbitrum_bpt_supply_changes_daily.sql delete mode 100644 models/_project/balancer/bpt/avalanche_c/_schema.yml delete mode 100644 models/_project/balancer/bpt/avalanche_c/balancer_v2_avalanche_c_bpt_supply_changes.sql delete mode 100644 models/_project/balancer/bpt/avalanche_c/balancer_v2_avalanche_c_bpt_supply_changes_daily.sql delete mode 100644 models/_project/balancer/bpt/balancer_bpt_supply_changes.sql delete mode 100644 models/_project/balancer/bpt/balancer_bpt_supply_changes_daily.sql delete mode 100644 models/_project/balancer/bpt/base/_schema.yml delete mode 100644 models/_project/balancer/bpt/base/balancer_v2_base_bpt_supply_changes.sql delete mode 100644 models/_project/balancer/bpt/base/balancer_v2_base_bpt_supply_changes_daily.sql delete mode 100644 models/_project/balancer/bpt/ethereum/_schema.yml delete mode 100644 models/_project/balancer/bpt/ethereum/balancer_v2_ethereum_bpt_supply_changes.sql delete mode 100644 models/_project/balancer/bpt/ethereum/balancer_v2_ethereum_bpt_supply_changes_daily.sql delete mode 100644 models/_project/balancer/bpt/gnosis/_schema.yml delete mode 100644 models/_project/balancer/bpt/gnosis/balancer_v2_gnosis_bpt_supply_changes.sql delete mode 100644 models/_project/balancer/bpt/gnosis/balancer_v2_gnosis_bpt_supply_changes_daily.sql delete mode 100644 models/_project/balancer/bpt/optimism/_schema.yml delete mode 100644 models/_project/balancer/bpt/optimism/balancer_v2_optimism_bpt_supply_changes.sql delete mode 100644 models/_project/balancer/bpt/optimism/balancer_v2_optimism_bpt_supply_changes_daily.sql delete mode 100644 models/_project/balancer/bpt/polygon/_schema.yml delete mode 100644 models/_project/balancer/bpt/polygon/balancer_v2_polygon_bpt_supply_changes.sql delete mode 100644 models/_project/balancer/bpt/polygon/balancer_v2_polygon_bpt_supply_changes_daily.sql delete mode 100644 models/_project/balancer/bpt/zkevm/_schema.yml delete mode 100644 models/_project/balancer/bpt/zkevm/balancer_v2_zkevm_bpt_supply_changes.sql delete mode 100644 models/_project/balancer/bpt/zkevm/balancer_v2_zkevm_bpt_supply_changes_daily.sql delete mode 100644 models/_project/balancer/flashloans/_schema.yml delete mode 100644 models/_project/balancer/flashloans/arbitrum/_schema.yml delete mode 100644 models/_project/balancer/flashloans/avalanche_c/_schema.yml delete mode 100644 models/_project/balancer/flashloans/base/_schema.yml delete mode 100644 models/_project/balancer/flashloans/ethereum/_schema.yml delete mode 100644 models/_project/balancer/flashloans/gnosis/_schema.yml delete mode 100644 models/_project/balancer/flashloans/optimism/_schema.yml delete mode 100644 models/_project/balancer/flashloans/polygon/_schema.yml delete mode 100644 models/_project/balancer/flashloans/zkevm/_schema.yml delete mode 100644 models/_project/balancer/liquidity/_schema.yml delete mode 100644 models/_project/balancer/liquidity/arbitrum/_schema.yml delete mode 100644 models/_project/balancer/liquidity/avalanche_c/_schema.yml delete mode 100644 models/_project/balancer/liquidity/base/_schema.yml delete mode 100644 models/_project/balancer/liquidity/ethereum/_schema.yml delete mode 100644 models/_project/balancer/liquidity/gnosis/_schema.yml delete mode 100644 models/_project/balancer/liquidity/optimism/_schema.yml delete mode 100644 models/_project/balancer/liquidity/polygon/_schema.yml delete mode 100644 models/_project/balancer/liquidity/zkevm/_schema.yml delete mode 100644 models/_project/balancer/pools/_schema.yml delete mode 100644 models/_project/balancer/pools/arbitrum/_schema.yml delete mode 100644 models/_project/balancer/pools/avalanche_c/_schema.yml delete mode 100644 models/_project/balancer/pools/base/_schema.yml delete mode 100644 models/_project/balancer/pools/ethereum/_schema.yml delete mode 100644 models/_project/balancer/pools/gnosis/_schema.yml delete mode 100644 models/_project/balancer/pools/optimism/_schema.yml delete mode 100644 models/_project/balancer/pools/polygon/_schema.yml delete mode 100644 models/_project/balancer/pools/zkevm/_schema.yml delete mode 100644 models/_project/balancer/protocol_fee/_schema.yml delete mode 100644 models/_project/balancer/protocol_fee/arbitrum/_schema.yml delete mode 100644 models/_project/balancer/protocol_fee/avalanche_c/_schema.yml delete mode 100644 models/_project/balancer/protocol_fee/base/_schema.yml delete mode 100644 models/_project/balancer/protocol_fee/ethereum/_schema.yml delete mode 100644 models/_project/balancer/protocol_fee/gnosis/_schema.yml delete mode 100644 models/_project/balancer/protocol_fee/optimism/_schema.yml delete mode 100644 models/_project/balancer/protocol_fee/polygon/_schema.yml delete mode 100644 models/_project/balancer/protocol_fee/zkevm/_schema.yml delete mode 100644 models/_project/balancer/support/_schema.yml delete mode 100644 models/_project/balancer/trades/arbitrum/_schema.yml delete mode 100644 models/_project/balancer/trades/avalanche_c/_schema.yml delete mode 100644 models/_project/balancer/trades/base/_schema.yml delete mode 100644 models/_project/balancer/trades/ethereum/_schema.yml delete mode 100644 models/_project/balancer/trades/gnosis/_schema.yml delete mode 100644 models/_project/balancer/trades/optimism/_schema.yml delete mode 100644 models/_project/balancer/trades/polygon/_schema.yml delete mode 100644 models/_project/balancer/trades/zkevm/_schema.yml delete mode 100644 models/_project/balancer/vebal/ethereum/_schema.yml rename models/{_project/balancer/pools => balancer}/arbitrum/balancer_arbitrum_pools_tokens_weights.sql (100%) create mode 100644 models/balancer/arbitrum/balancer_arbitrum_schema.yml rename models/{_project/balancer/trades => balancer}/arbitrum/balancer_arbitrum_trades.sql (100%) rename models/{_project/balancer/bpt => balancer}/arbitrum/balancer_v2_arbitrum_bpt_prices.sql (100%) rename models/{_project/balancer/bpt => balancer}/arbitrum/balancer_v2_arbitrum_bpt_supply.sql (100%) rename models/{_project/balancer/flashloans => balancer}/arbitrum/balancer_v2_arbitrum_flashloans.sql (88%) rename models/{_project/balancer/liquidity => balancer}/arbitrum/balancer_v2_arbitrum_liquidity.sql (52%) rename models/{_project/balancer/pools => balancer}/arbitrum/balancer_v2_arbitrum_pools_fees.sql (75%) rename models/{_project/balancer/pools => balancer}/arbitrum/balancer_v2_arbitrum_pools_tokens_weights.sql (99%) rename models/{_project/balancer/protocol_fee => balancer}/arbitrum/balancer_v2_arbitrum_protocol_fee.sql (100%) rename models/{_project/balancer/trades => balancer}/arbitrum/balancer_v2_arbitrum_trades.sql (94%) rename models/{_project/balancer/bpt => balancer}/arbitrum/balancer_v2_arbitrum_transfers_bpt.sql (100%) rename models/{_project/balancer/pools => balancer}/avalanche_c/balancer_avalanche_c_pools_tokens_weights.sql (100%) create mode 100644 models/balancer/avalanche_c/balancer_avalanche_c_schema.yml rename models/{_project/balancer/trades => balancer}/avalanche_c/balancer_avalanche_c_trades.sql (100%) rename models/{_project/balancer/bpt => balancer}/avalanche_c/balancer_v2_avalanche_c_bpt_prices.sql (100%) rename models/{_project/balancer/bpt => balancer}/avalanche_c/balancer_v2_avalanche_c_bpt_supply.sql (100%) rename models/{_project/balancer/flashloans => balancer}/avalanche_c/balancer_v2_avalanche_c_flashloans.sql (88%) rename models/{_project/balancer/liquidity => balancer}/avalanche_c/balancer_v2_avalanche_c_liquidity.sql (53%) rename models/{_project/balancer/pools => balancer}/avalanche_c/balancer_v2_avalanche_c_pools_fees.sql (77%) rename models/{_project/balancer/pools => balancer}/avalanche_c/balancer_v2_avalanche_c_pools_tokens_weights.sql (99%) rename models/{_project/balancer/protocol_fee => balancer}/avalanche_c/balancer_v2_avalanche_c_protocol_fee.sql (100%) rename models/{_project/balancer/trades => balancer}/avalanche_c/balancer_v2_avalanche_c_trades.sql (94%) rename models/{_project/balancer/bpt => balancer}/avalanche_c/balancer_v2_avalanche_c_transfers_bpt.sql (100%) rename models/{_project/balancer/bpt => balancer}/balancer_bpt_prices.sql (69%) rename models/{_project/balancer/bpt => balancer}/balancer_bpt_supply.sql (68%) rename models/{_project/balancer/flashloans => balancer}/balancer_flashloans.sql (69%) rename models/{_project/balancer/pools => balancer}/balancer_gauge_mappings.sql (78%) rename models/{_project/balancer/liquidity => balancer}/balancer_liquidity.sql (74%) rename models/{_project/balancer/pools => balancer}/balancer_pools_fees.sql (69%) rename models/{_project/balancer/pools => balancer}/balancer_pools_metrics_daily.sql (100%) rename models/{_project/balancer/pools => balancer}/balancer_pools_tokens_weights.sql (71%) rename models/{_project/balancer/protocol_fee => balancer}/balancer_protocol_fee.sql (75%) create mode 100644 models/balancer/balancer_schema.yml rename models/{_project/balancer/support => balancer}/balancer_single_recipient_gauges.sql (100%) rename models/{_project/balancer/support => balancer}/balancer_token_whitelist.sql (100%) rename models/{_project/balancer/bpt => balancer}/balancer_transfers_bpt.sql (70%) rename models/{_project/balancer/pools => balancer}/base/balancer_base_pools_tokens_weights.sql (100%) create mode 100644 models/balancer/base/balancer_base_schema.yml rename models/{_project/balancer/trades => balancer}/base/balancer_base_trades.sql (100%) rename models/{_project/balancer/bpt => balancer}/base/balancer_v2_base_bpt_prices.sql (100%) rename models/{_project/balancer/bpt => balancer}/base/balancer_v2_base_bpt_supply.sql (100%) rename models/{_project/balancer/flashloans => balancer}/base/balancer_v2_base_flashloans.sql (88%) rename models/{_project/balancer/liquidity => balancer}/base/balancer_v2_base_liquidity.sql (51%) rename models/{_project/balancer/pools => balancer}/base/balancer_v2_base_pools_fees.sql (77%) rename models/{_project/balancer/pools => balancer}/base/balancer_v2_base_pools_tokens_weights.sql (99%) rename models/{_project/balancer/protocol_fee => balancer}/base/balancer_v2_base_protocol_fee.sql (100%) rename models/{_project/balancer/trades => balancer}/base/balancer_v2_base_trades.sql (94%) rename models/{_project/balancer/bpt => balancer}/base/balancer_v2_base_transfers_bpt.sql (100%) rename models/{_project/balancer/balances => balancer}/ethereum/balancer_ethereum_balances.sql (88%) rename models/{_project/balancer/pools => balancer}/ethereum/balancer_ethereum_pools_tokens_weights.sql (100%) create mode 100644 models/balancer/ethereum/balancer_ethereum_schema.yml rename models/{_project/balancer/trades => balancer}/ethereum/balancer_ethereum_trades.sql (100%) rename models/{_project/balancer/vebal => balancer}/ethereum/balancer_ethereum_vebal_balances_day.sql (94%) rename models/{_project/balancer/vebal => balancer}/ethereum/balancer_ethereum_vebal_slopes.sql (93%) rename models/{_project/balancer/vebal => balancer}/ethereum/balancer_ethereum_vebal_votes.sql (92%) rename models/{_project/balancer/liquidity => balancer}/ethereum/balancer_v1_ethereum_liquidity.sql (92%) rename models/{_project/balancer/pools => balancer}/ethereum/balancer_v1_ethereum_pools_tokens_weights.sql (93%) rename models/{_project/balancer/trades => balancer}/ethereum/balancer_v1_ethereum_trades.sql (100%) rename models/{_project/balancer/bpt => balancer}/ethereum/balancer_v2_ethereum_bpt_prices.sql (100%) rename models/{_project/balancer/bpt => balancer}/ethereum/balancer_v2_ethereum_bpt_supply.sql (100%) rename models/{_project/balancer/flashloans => balancer}/ethereum/balancer_v2_ethereum_flashloans.sql (88%) rename models/{_project/balancer/pools => balancer}/ethereum/balancer_v2_ethereum_lbps.sql (100%) rename models/{_project/balancer/liquidity => balancer}/ethereum/balancer_v2_ethereum_liquidity.sql (52%) rename models/{_project/balancer/pools => balancer}/ethereum/balancer_v2_ethereum_pools_fees.sql (78%) rename models/{_project/balancer/pools => balancer}/ethereum/balancer_v2_ethereum_pools_tokens_weights.sql (99%) rename models/{_project/balancer/protocol_fee => balancer}/ethereum/balancer_v2_ethereum_protocol_fee.sql (100%) rename models/{_project/balancer/trades => balancer}/ethereum/balancer_v2_ethereum_trades.sql (94%) rename models/{_project/balancer/bpt => balancer}/ethereum/balancer_v2_ethereum_transfers_bpt.sql (100%) rename models/{_project/balancer/pools => balancer}/gnosis/balancer_gnosis_pools_tokens_weights.sql (100%) create mode 100644 models/balancer/gnosis/balancer_gnosis_schema.yml rename models/{_project/balancer/trades => balancer}/gnosis/balancer_gnosis_trades.sql (100%) rename models/{_project/balancer/bpt => balancer}/gnosis/balancer_v2_gnosis_bpt_prices.sql (100%) rename models/{_project/balancer/bpt => balancer}/gnosis/balancer_v2_gnosis_bpt_supply.sql (100%) rename models/{_project/balancer/flashloans => balancer}/gnosis/balancer_v2_gnosis_flashloans.sql (88%) rename models/{_project/balancer/liquidity => balancer}/gnosis/balancer_v2_gnosis_liquidity.sql (51%) rename models/{_project/balancer/pools => balancer}/gnosis/balancer_v2_gnosis_pools_fees.sql (77%) rename models/{_project/balancer/pools => balancer}/gnosis/balancer_v2_gnosis_pools_tokens_weights.sql (99%) rename models/{_project/balancer/protocol_fee => balancer}/gnosis/balancer_v2_gnosis_protocol_fee.sql (100%) rename models/{_project/balancer/trades => balancer}/gnosis/balancer_v2_gnosis_trades.sql (94%) rename models/{_project/balancer/bpt => balancer}/gnosis/balancer_v2_gnosis_transfers_bpt.sql (100%) rename models/{_project/balancer/pools => balancer}/optimism/balancer_optimism_gauge_mappings.sql (87%) rename models/{_project/balancer/pools => balancer}/optimism/balancer_optimism_pools_tokens_weights.sql (86%) create mode 100644 models/balancer/optimism/balancer_optimism_schema.yml rename models/{_project/balancer/trades => balancer}/optimism/balancer_optimism_trades.sql (100%) rename models/{_project/balancer/bpt => balancer}/optimism/balancer_v2_optimism_bpt_prices.sql (100%) rename models/{_project/balancer/bpt => balancer}/optimism/balancer_v2_optimism_bpt_supply.sql (100%) rename models/{_project/balancer/flashloans => balancer}/optimism/balancer_v2_optimism_flashloans.sql (88%) rename models/{_project/balancer/liquidity => balancer}/optimism/balancer_v2_optimism_liquidity.sql (52%) rename models/{_project/balancer/pools => balancer}/optimism/balancer_v2_optimism_pools_fees.sql (77%) rename models/{_project/balancer/pools => balancer}/optimism/balancer_v2_optimism_pools_tokens_weights.sql (99%) rename models/{_project/balancer/protocol_fee => balancer}/optimism/balancer_v2_optimism_protocol_fee.sql (100%) rename models/{_project/balancer/trades => balancer}/optimism/balancer_v2_optimism_trades.sql (94%) rename models/{_project/balancer/bpt => balancer}/optimism/balancer_v2_optimism_transfers_bpt.sql (100%) rename models/{_project/balancer/pools => balancer}/polygon/balancer_polygon_pools_tokens_weights.sql (100%) create mode 100644 models/balancer/polygon/balancer_polygon_schema.yml rename models/{_project/balancer/trades => balancer}/polygon/balancer_polygon_trades.sql (100%) rename models/{_project/balancer/bpt => balancer}/polygon/balancer_v2_polygon_bpt_prices.sql (100%) rename models/{_project/balancer/bpt => balancer}/polygon/balancer_v2_polygon_bpt_supply.sql (100%) rename models/{_project/balancer/flashloans => balancer}/polygon/balancer_v2_polygon_flashloans.sql (88%) rename models/{_project/balancer/pools => balancer}/polygon/balancer_v2_polygon_lbps.sql (100%) rename models/{_project/balancer/liquidity => balancer}/polygon/balancer_v2_polygon_liquidity.sql (52%) rename models/{_project/balancer/pools => balancer}/polygon/balancer_v2_polygon_pools_fees.sql (77%) rename models/{_project/balancer/pools => balancer}/polygon/balancer_v2_polygon_pools_tokens_weights.sql (99%) rename models/{_project/balancer/protocol_fee => balancer}/polygon/balancer_v2_polygon_protocol_fee.sql (100%) rename models/{_project/balancer/trades => balancer}/polygon/balancer_v2_polygon_trades.sql (94%) rename models/{_project/balancer/bpt => balancer}/polygon/balancer_v2_polygon_transfers_bpt.sql (100%) rename models/{_project/balancer/bpt => balancer}/zkevm/balancer_v2_zkevm_bpt_prices.sql (100%) rename models/{_project/balancer/bpt => balancer}/zkevm/balancer_v2_zkevm_bpt_supply.sql (100%) rename models/{_project/balancer/flashloans => balancer}/zkevm/balancer_v2_zkevm_flashloans.sql (88%) rename models/{_project/balancer/liquidity => balancer}/zkevm/balancer_v2_zkevm_liquidity.sql (51%) rename models/{_project/balancer/pools => balancer}/zkevm/balancer_v2_zkevm_pools_fees.sql (82%) rename models/{_project/balancer/pools => balancer}/zkevm/balancer_v2_zkevm_pools_tokens_weights.sql (100%) rename models/{_project/balancer/protocol_fee => balancer}/zkevm/balancer_v2_zkevm_protocol_fee.sql (100%) rename models/{_project/balancer/trades => balancer}/zkevm/balancer_v2_zkevm_trades.sql (94%) rename models/{_project/balancer/bpt => balancer}/zkevm/balancer_v2_zkevm_transfers_bpt.sql (100%) rename models/{_project/balancer/pools => balancer}/zkevm/balancer_zkevm_pools_tokens_weights.sql (100%) create mode 100644 models/balancer/zkevm/balancer_zkevm_schema.yml rename models/{_project/balancer/trades => balancer}/zkevm/balancer_zkevm_trades.sql (100%) diff --git a/dbt_project.yml b/dbt_project.yml index 1daa6f7fd4a..05730532ba4 100644 --- a/dbt_project.yml +++ b/dbt_project.yml @@ -71,6 +71,19 @@ models: optimism: +schema: aave_optimism + balancer: + +schema: balancer + arbitrum: + +schema: balancer_arbitrum + ethereum: + +schema: balancer_ethereum + polygon: + +schema: balancer_polygon + optimism: + +schema: balancer_optimism + gnosis: + +schema: balancer_gnosis + ens: +schema: ens ethereum: diff --git a/macros/models/_project/balancer/balancer_bpt_supply_macro.sql b/macros/models/_project/balancer/balancer_bpt_supply_macro.sql index 1b1dab0a80a..60cf5a6e4bc 100644 --- a/macros/models/_project/balancer/balancer_bpt_supply_macro.sql +++ b/macros/models/_project/balancer/balancer_bpt_supply_macro.sql @@ -79,12 +79,12 @@ WITH pool_labels AS ( joins AS ( SELECT DATE_TRUNC('day', evt_block_time) AS block_date, - tokenOut, + tokenOut AS token, pool_type, CASE WHEN pool_type IN ('weighted') THEN 0 ELSE SUM(amountOut / POWER(10, 18)) - END AS ajoins + END AS amount FROM {{ source('balancer_v2_' + blockchain, 'Vault_evt_Swap') }} LEFT JOIN pool_labels ON BYTEARRAY_SUBSTRING(poolId, 1, 20) = address WHERE tokenOut = BYTEARRAY_SUBSTRING(poolId, 1, 20) @@ -94,25 +94,37 @@ WITH pool_labels AS ( exits AS ( SELECT DATE_TRUNC('day', evt_block_time) AS block_date, - tokenIn, + tokenIn AS token, pool_type, CASE WHEN pool_type IN ('weighted') THEN 0 - ELSE SUM(amountIn / POWER(10, 18)) - END AS aexits + ELSE SUM( -amountIn / POWER(10, 18)) + END AS amount FROM {{ source('balancer_v2_' + blockchain, 'Vault_evt_Swap') }} LEFT JOIN pool_labels ON BYTEARRAY_SUBSTRING(poolId, 1, 20) = address WHERE tokenIn = BYTEARRAY_SUBSTRING(poolId, 1, 20) GROUP BY 1, 2, 3 ), + joins_and_exits_1 AS ( + SELECT + * + FROM joins + + UNION ALL + + SELECT + * + FROM exits + ), + joins_and_exits AS ( SELECT - j.block_date, - j.tokenOut AS bpt, - SUM(COALESCE(ajoins, 0) - COALESCE(aexits, 0)) OVER (PARTITION BY j.tokenOut ORDER BY j.block_date ASC) AS adelta - FROM joins j - FULL OUTER JOIN exits e ON j.block_date = e.block_date AND e.tokenIn = j.tokenOut + block_date, + token AS bpt, + LEAD(block_date, 1, NOW()) OVER (PARTITION BY token ORDER BY block_date) AS day_of_next_change, + SUM(amount) OVER (PARTITION BY token ORDER BY block_date ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW) AS adelta + FROM joins_and_exits_1 ), calendar AS ( @@ -130,7 +142,7 @@ WITH pool_labels AS ( COALESCE(SUM(b.supply - COALESCE(preminted_bpts, 0) + COALESCE(adelta, 0)),0) AS supply FROM calendar c LEFT JOIN balances b ON b.day <= c.day AND c.day < b.day_of_next_change - LEFT JOIN joins_and_exits j ON c.day = j.block_date AND b.token = j.bpt + LEFT JOIN joins_and_exits j ON j.block_date <= c.day AND c.day < j.day_of_next_change AND b.token = j.bpt LEFT JOIN premints p ON b.token = p.bpt LEFT JOIN pool_labels l ON b.token = l.address WHERE l.pool_type IN ('weighted', 'LBP', 'investment', 'stable', 'linear', 'ECLP', 'managed', 'FX') diff --git a/macros/models/_project/balancer/balancer_pool_token_supply_changes_daily_agg_macro.sql b/macros/models/_project/balancer/balancer_pool_token_supply_changes_daily_agg_macro.sql deleted file mode 100644 index d94bbccf741..00000000000 --- a/macros/models/_project/balancer/balancer_pool_token_supply_changes_daily_agg_macro.sql +++ /dev/null @@ -1,37 +0,0 @@ -{% macro - bpt_supply_changes_daily_agg_macro( - blockchain, version - ) -%} -WITH - daily_balance AS ( - SELECT - block_date, - blockchain, - pool_type, - pool_symbol, - token_address, - LEAD(block_date, 1, NOW()) OVER (PARTITION BY token_address ORDER BY block_date) AS day_of_next_change, - SUM(delta_amount) AS daily_amount - FROM {{ ref('balancer_bpt_supply_changes') }} - WHERE blockchain = '{{blockchain}}' - GROUP BY 1, 2, 3, 4, 5 - ), - - calendar AS ( - SELECT date_sequence AS day - FROM unnest(sequence(date('2021-04-21'), date(now()), interval '1' day)) as t(date_sequence) - ) - - SELECT - c.day AS block_date, - '{{blockchain}}' as blockchain, - '{{version}}' AS version, - b.pool_type, - b.pool_symbol, - b.token_address, - b.daily_amount AS daily_delta - FROM calendar c - LEFT JOIN daily_balance b ON b.block_date = c.day - WHERE b.token_address IS NOT NULL - {% endmacro %} \ No newline at end of file diff --git a/macros/models/_project/balancer/balancer_pool_token_supply_changes_macro.sql b/macros/models/_project/balancer/balancer_pool_token_supply_changes_macro.sql deleted file mode 100644 index 5b876cca011..00000000000 --- a/macros/models/_project/balancer/balancer_pool_token_supply_changes_macro.sql +++ /dev/null @@ -1,130 +0,0 @@ -{% macro - bpt_supply_changes_macro( - blockchain, version - ) -%} -WITH pool_labels AS ( - SELECT - address, - name, - pool_type - FROM {{ ref('labels_balancer_v2_pools') }} - WHERE blockchain = '{{blockchain}}' - ), - - -- Extract mints and burns from transfers - transfers AS ( - SELECT - t.evt_block_time, - t.evt_block_number, - t.evt_tx_hash, - t.evt_index, - t.contract_address AS token, - CASE - WHEN t."from" = 0x0000000000000000000000000000000000000000 - THEN 'mint' - WHEN t.to = 0x0000000000000000000000000000000000000000 - THEN 'burn' - END AS label, - l.pool_type, - l.name, - CASE - WHEN t."from" = 0x0000000000000000000000000000000000000000 - THEN value - WHEN t.to = 0x0000000000000000000000000000000000000000 - THEN - value - ELSE 0 - END AS amount - FROM {{ ref('balancer_transfers_bpt') }} t - LEFT JOIN pool_labels l ON t.contract_address = l.address - WHERE t.blockchain = '{{blockchain}}' - AND t.version = '{{version}}' - {% if is_incremental() %} - AND {{ incremental_predicate('t.evt_block_time') }} - {% endif %} - ), - - -- Calculating Joins(mint) and Exits(burn) via Swap - joins AS ( - SELECT - s.evt_block_time, - s.evt_block_number, - s.evt_tx_hash, - s.evt_index, - s.tokenOut AS token, - 'join' AS label, - l.pool_type, - l.name, - CASE WHEN l.pool_type IN ('weighted') - THEN 0 - ELSE s.amountOut - END AS amount - FROM {{ source('balancer_v2_' + blockchain, 'Vault_evt_Swap') }} s - LEFT JOIN pool_labels l ON BYTEARRAY_SUBSTRING(s.poolId, 1, 20) = l.address - WHERE tokenOut = BYTEARRAY_SUBSTRING(s.poolId, 1, 20) - {% if is_incremental() %} - AND {{ incremental_predicate('s. evt_block_time') }} - {% endif %} - - ), - - exits AS ( - SELECT - s.evt_block_time, - s.evt_block_number, - s.evt_tx_hash, - s.evt_index, - s.tokenIn AS token, - 'exit' AS label, - l.pool_type, - l.name, - CASE WHEN l.pool_type IN ('weighted') - THEN 0 - ELSE - s.amountIn - END AS amount - FROM {{ source('balancer_v2_' + blockchain, 'Vault_evt_Swap') }} s - LEFT JOIN pool_labels l ON BYTEARRAY_SUBSTRING(s.poolId, 1, 20) = l.address - WHERE tokenIn = BYTEARRAY_SUBSTRING(s.poolId, 1, 20) - {% if is_incremental() %} - AND {{ incremental_predicate('s. evt_block_time') }} - {% endif %} - ) - - SELECT - date_trunc('day', evt_block_time) AS block_date, - evt_block_time, - evt_block_number, - '{{blockchain}}' AS blockchain, - evt_tx_hash, - evt_index, - pool_type, - name AS pool_symbol, - '{{version}}' AS version, - label, - token AS token_address, - amount AS delta_amount_raw, - amount / POWER (10, 18) AS delta_amount --18 decimals standard for BPTs - FROM - ( - SELECT - * - FROM joins - - UNION ALL - - SELECT - * - FROM exits - - UNION ALL - - SELECT - * - FROM transfers - WHERE label IS NOT NULL - ) - {% if is_incremental() %} - WHERE {{ incremental_predicate('evt_block_time') }} - {% endif %} - - {% endmacro %} \ No newline at end of file diff --git a/macros/models/_project/balancer/balancer_token_balance_changes_daily_agg_macro.sql b/macros/models/_project/balancer/balancer_token_balance_changes_daily_agg_macro.sql deleted file mode 100644 index 7500f5d7e82..00000000000 --- a/macros/models/_project/balancer/balancer_token_balance_changes_daily_agg_macro.sql +++ /dev/null @@ -1,184 +0,0 @@ -{% macro - balancer_token_balance_changes_daily_agg_macro( - blockchain, version - ) -%} -WITH - prices AS ( - SELECT - date_trunc('day', minute) AS day, - contract_address AS token, - decimals, - AVG(price) AS price - FROM {{ source('prices', 'usd') }} - WHERE blockchain = '{{blockchain}}' - {% if is_incremental() %} - WHERE {{ incremental_predicate('minute') }} - {% endif %} - GROUP BY 1, 2, 3 - ), - - dex_prices_1 AS ( - SELECT - date_trunc('day', HOUR) AS DAY, - contract_address AS token, - approx_percentile(median_price, 0.5) AS price, - sum(sample_size) AS sample_size - FROM {{ ref('dex_prices') }} - {% if is_incremental() %} - WHERE {{ incremental_predicate('hour') }} - {% endif %} - GROUP BY 1, 2 - HAVING sum(sample_size) > 3 - ), - - dex_prices_2 AS( - SELECT - day, - token, - price, - lag(price) OVER(PARTITION BY token ORDER BY day) AS previous_price - FROM dex_prices_1 - ), - - dex_prices AS ( - SELECT - day, - token, - price, - LEAD(DAY, 1, NOW()) OVER (PARTITION BY token ORDER BY DAY) AS day_of_next_change - FROM dex_prices_2 - WHERE (price < previous_price * 1e4 AND price > previous_price / 1e4) - ), - - bpt_prices AS( - SELECT DISTINCT - day, - contract_address AS token, - decimals, - bpt_price - FROM {{ ref('balancer_bpt_prices') }} - WHERE blockchain = '{{blockchain}}' - {% if is_incremental() %} - AND {{ incremental_predicate('day') }} - {% endif %} - AND version = '{{version}}' - ), - - eth_prices AS ( - SELECT - DATE_TRUNC('day', minute) as day, - AVG(price) as eth_price - FROM {{ source('prices', 'usd') }} - WHERE symbol = 'ETH' - {% if is_incremental() %} - WHERE {{ incremental_predicate('minute') }} - {% endif %} - GROUP BY 1 - ), - - gyro_prices AS ( - SELECT - token_address, - decimals, - price - FROM {{ ref('gyroscope_gyro_tokens') }} - WHERE blockchain = '{{blockchain}}' - ), - - daily_balance AS ( - SELECT - block_date, - pool_id, - pool_symbol, - pool_type, - token_address, - token_symbol, - LEAD(block_date, 1, NOW()) OVER (PARTITION BY token_address, pool_id ORDER BY block_date) AS day_of_next_change, - SUM(delta_amount) AS daily_amount - FROM {{ ref('balancer_token_balance_changes') }} - WHERE blockchain = '{{blockchain}}' - GROUP BY 1, 2, 3, 4, 5, 6 - ), - - calendar AS ( - SELECT date_sequence AS day - FROM unnest(sequence(date('2021-04-21'), date(now()), interval '1' day)) as t(date_sequence) - ), - - daily_usd_balance AS ( - SELECT - c.day AS block_date, - '{{blockchain}}"' as blockchain, - b.pool_id, - b.pool_symbol, - b.pool_type, - b.token_address, - b.token_symbol, - daily_amount, - daily_amount * COALESCE(p1.price, p2.price, p3.bpt_price, p4.price, 0) AS daily_amount_usd - FROM calendar c - LEFT JOIN daily_balance b ON b.block_date <= c.day - AND c.day < b.day_of_next_change - LEFT JOIN prices p1 ON p1.day = b.block_date - AND p1.token = b.token_address - LEFT JOIN dex_prices p2 ON p2.day <= c.day - AND c.day < p2.day_of_next_change - AND p2.token = b.token_address - LEFT JOIN bpt_prices p3 ON p3.day = b.block_date - AND p3.token = b.token_address - LEFT JOIN gyro_prices p4 ON p4.token_address = b.token_address - WHERE b.token_address != BYTEARRAY_SUBSTRING(b.pool_id, 1, 20) - ), - - weighted_pool_amount_estimates AS ( - SELECT - b.block_date, - b.pool_id, - q.name, - pool_type, - ROW_NUMBER() OVER (PARTITION BY b.block_date, b.pool_id ORDER BY SUM(b.daily_amount_usd) ASC) AS pricing_count, --to avoid double count in pools with multiple pricing assets - SUM(b.daily_amount_usd) / COALESCE(SUM(w.normalized_weight), 1) AS weighted_daily_amount_usd - FROM daily_usd_balance b - LEFT JOIN {{ ref('balancer_pools_tokens_weights') }} w ON b.pool_id = w.pool_id - AND b.token_address = w.token_address - AND b.daily_amount_usd > 0 - LEFT JOIN {{ ref('balancer_token_whitelist') }} q ON b.token_address = q.address - AND b.blockchain = q.chain - WHERE q.name IS NOT NULL - AND b.pool_type = 'weighted' -- filters for weighted pools with pricing assets - AND w.blockchain = '{{blockchain}}' - AND w.version = '2' - GROUP BY 1, 2, 3, 4 - ), - - weighted_pool_amount_estimates_2 AS( - SELECT e.block_date, - e.pool_id, - SUM(e.weighted_daily_amount_usd) / MAX(e.pricing_count) AS weighted_daily_amount_usd - FROM weighted_pool_amount_estimates e - GROUP BY 1,2 - ) - - SELECT - c.block_date, - c.pool_id, - BYTEARRAY_SUBSTRING(c.pool_id, 1, 20) AS pool_address, - c.pool_symbol, - '2' AS version, - 'ethereum' AS blockchain, - c.pool_type, - c.token_address, - c.token_symbol, - c.daily_amount AS daily_delta, - COALESCE(b.weighted_daily_amount_usd * w.normalized_weight, c.daily_amount_usd) AS daily_delta_usd, - COALESCE(b.weighted_daily_amount_usd * w.normalized_weight, c.daily_amount_usd)/e.eth_price AS daily_delta_eth - FROM daily_usd_balance c - FULL OUTER JOIN weighted_pool_amount_estimates_2 b ON c.block_date = b.block_date - AND c.pool_id = b.pool_id - LEFT JOIN {{ ref('balancer_pools_tokens_weights') }} w ON b.pool_id = w.pool_id - AND w.blockchain = 'ethereum' - AND w.version = '2' - AND w.token_address = c.token_address - LEFT JOIN eth_prices e ON e.day = c.block_date - {% endmacro %} \ No newline at end of file diff --git a/macros/models/_project/balancer/balancer_token_balance_changes_macro.sql b/macros/models/_project/balancer/balancer_token_balance_changes_macro.sql deleted file mode 100644 index b16c9bf038e..00000000000 --- a/macros/models/_project/balancer/balancer_token_balance_changes_macro.sql +++ /dev/null @@ -1,169 +0,0 @@ -{% macro - balancer_token_balance_changes_macro( - blockchain, version - ) -%} -WITH pool_labels AS ( - SELECT - address AS pool_id, - name AS pool_symbol, - pool_type - FROM {{ ref('labels_balancer_v2_pools') }} - WHERE blockchain = '{{blockchain}}' - ), - - swaps_changes AS ( - SELECT - evt_block_time, - evt_block_number, - evt_tx_hash, - evt_index, - pool_id, - token, - SUM(COALESCE(delta, INT256 '0')) AS delta - FROM - ( - SELECT - evt_block_time, - evt_block_number, - evt_tx_hash, - evt_index, - poolId AS pool_id, - tokenIn AS token, - CAST(amountIn as int256) AS delta - FROM {{ source('balancer_v2_' + blockchain, 'Vault_evt_Swap') }} - {% if is_incremental() %} - WHERE {{ incremental_predicate('evt_block_time') }} - {% endif %} - - UNION ALL - - SELECT - evt_block_time, - evt_block_number, - evt_tx_hash, - evt_index, - poolId AS pool_id, - tokenOut AS token, - -CAST(amountOut AS int256) AS delta - FROM {{ source('balancer_v2_' + blockchain, 'Vault_evt_Swap') }} - {% if is_incremental() %} - WHERE {{ incremental_predicate('evt_block_time') }} - {% endif %} - ) swaps - GROUP BY 1, 2, 3, 4, 5, 6 - ), - - zipped_balance_changes AS ( - SELECT - evt_block_time, - evt_block_number, - evt_tx_hash, - evt_index, - poolId AS pool_id, - t.tokens, - d.deltas, - p.protocolFeeAmounts - FROM {{ source('balancer_v2_' + blockchain, 'Vault_evt_PoolBalanceChanged') }} - CROSS JOIN UNNEST (tokens) WITH ORDINALITY as t(tokens,i) - CROSS JOIN UNNEST (deltas) WITH ORDINALITY as d(deltas,i) - CROSS JOIN UNNEST (protocolFeeAmounts) WITH ORDINALITY as p(protocolFeeAmounts,i) - WHERE t.i = d.i - AND d.i = p.i - {% if is_incremental() %} - AND {{ incremental_predicate('evt_block_time') }} - {% endif %} - ), - - balances_changes AS ( - SELECT - evt_block_time, - evt_block_number, - evt_tx_hash, - evt_index, - pool_id, - tokens AS token, - deltas - CAST(protocolFeeAmounts as int256) AS delta - FROM zipped_balance_changes - ), - - managed_changes AS ( - SELECT - evt_block_time, - evt_block_number, - evt_tx_hash, - evt_index, - poolId AS pool_id, - token, - cashDelta + managedDelta AS delta - FROM {{ source('balancer_v2_' + blockchain, 'Vault_evt_PoolBalanceManaged') }} - {% if is_incremental() %} - WHERE {{ incremental_predicate('evt_block_time') }} - {% endif %} - ) - - - SELECT - date_trunc('day', b.evt_block_time) AS block_date, - b.evt_block_time, - b.evt_block_number, - '{{blockchain}}' AS blockchain, - b.evt_tx_hash, - b.evt_index, - b.pool_id, - BYTEARRAY_SUBSTRING(b.pool_id, 1, 20) AS pool_address, - p.pool_symbol, - p.pool_type, - '{{version}}' AS version, - b.token AS token_address, - t.symbol AS token_symbol, - b.amount AS delta_amount_raw, - CASE WHEN BYTEARRAY_SUBSTRING(b.pool_id, 1, 20) = b.token - THEN amount / POWER (10, 18) --for Balancer Pool Tokens - ELSE amount / POWER (10, COALESCE(t.decimals, 0)) - END AS delta_amount - FROM - ( - SELECT - evt_block_time, - evt_block_number, - evt_tx_hash, - evt_index, - pool_id, - token, - COALESCE(delta, INT256 '0') AS amount - FROM balances_changes - - UNION ALL - - SELECT - evt_block_time, - evt_block_number, - evt_tx_hash, - evt_index, - pool_id, - token, - delta AS amount - FROM - swaps_changes - - UNION ALL - - SELECT - evt_block_time, - evt_block_number, - evt_tx_hash, - evt_index, - pool_id, - token, - CAST(delta AS int256) AS amount - FROM managed_changes - ) b - LEFT JOIN {{ source('tokens', 'erc20') }} t ON t.contract_address = b.token - AND blockchain = '{{blockchain}}' - LEFT JOIN pool_labels p ON p.pool_id = BYTEARRAY_SUBSTRING(b.pool_id, 1, 20) - {% if is_incremental() %} - WHERE {{ incremental_predicate('evt_block_time') }} - {% endif %} - - {% endmacro %} \ No newline at end of file diff --git a/models/_project/balancer/trades/balancer_trades.sql b/models/_project/balancer/balancer_trades.sql similarity index 100% rename from models/_project/balancer/trades/balancer_trades.sql rename to models/_project/balancer/balancer_trades.sql diff --git a/models/_project/balancer/balances/_schema.yml b/models/_project/balancer/balances/_schema.yml deleted file mode 100644 index 9d8b84cf3a1..00000000000 --- a/models/_project/balancer/balances/_schema.yml +++ /dev/null @@ -1,98 +0,0 @@ -version: 2 - -models: - - name: balancer_token_balance_changes - meta: - blockchain: arbitrum, avalanche_c, base, ethereum, gnosis, optimism, polygon, zkevm - contributors: viniabussafi - config: - tags: ['arbitrum', 'avalanche_c', 'base', 'ethereum', 'gnosis', 'optimism', 'polygon', 'zkevm', 'bpt', 'supply', 'changes'] - description: > - Token Balance Changes on Balancer Pools. - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - block_date - - evt_tx_hash - - evt_index - - token_address - columns: - - &block_date - name: block_date - description: "UTC event block date of each DEX trade" - - &evt_block_time - name: evt_block_time - description: 'Block time of transfer event' - - &evt_block_number - name: evt_block_number - description: 'Block number of transfer event' - - &blockchain - name: blockchain - description: "Blockchain" - - &evt_tx_hash - name: evt_tx_hash - description: 'Transaction hash of transfer event' - - &evt_index - name: evt_index - description: 'Event index' - - &pool_id - name: pool_id - description: "Unique encoded identifier that refers to each pool" - - &pool_address - name: pool_address - description: "Pool address" - - &pool_symbol - name: pool_symbol - description: "Token symbols, followed by their respective weights, if applicable" - - &pool_type - name: pool_type - description: "Pool attributes, determined by the pool's factory" - - &version - name: version - description: "Version of Balancer where the liquidity pool used in transaction is deployed" - - &token_address - name: token_address - description: "Contract address of the token" - - &token_symbol - name: token_symbol - description: "Token symbol" - - &delta_amount_raw - name: delta_amount_raw - description: "Raw value of the transaction at the time of execution in the original currency" - - &delta_amount - name: delta_amount - description: "Normalized value of the transaction at the time of execution in the original currency" - - - name: balancer_token_balance_changes_daily - meta: - blockchain: arbitrum, avalanche_c, base, ethereum, gnosis, optimism, polygon, zkevm - contributors: viniabussafi - config: - tags: ['arbitrum', 'avalanche_c', 'base', 'ethereum', 'gnosis', 'optimism', 'polygon', 'zkevm', 'bpt', 'supply', 'changes'] - description: > - Token Balance Changes on Balancer Pools, grouped by day. - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - block_date - - pool_id - - token_address - columns: - - *block_date - - *pool_id - - *pool_address - - *pool_symbol - - *version - - *blockchain - - *pool_type - - *token_address - - *token_symbol - - &daily_delta - name: daily_delta - description: "Daily total impact on token balance" - - &daily_delta_usd - name: daily_delta_usd - description: "Daily total impact on token balance, in USD" - - &daily_delta_eth - name: daily_delta_eth - description: "Daily total impact on token balance, in eth" \ No newline at end of file diff --git a/models/_project/balancer/balances/arbitrum/_schema.yml b/models/_project/balancer/balances/arbitrum/_schema.yml deleted file mode 100644 index ff5e07ed5d8..00000000000 --- a/models/_project/balancer/balances/arbitrum/_schema.yml +++ /dev/null @@ -1,100 +0,0 @@ -version: 2 - -models: - - name: balancer_v2_arbitrum_token_balance_changes - meta: - blockchain: arbitrum - project: balancer_v2 - contributors: viniabussafi - config: - tags: ['arbitrum', 'bpt', 'supply', 'changes'] - description: > - Token Balance Changes on Balancer Pools. - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - block_date - - evt_tx_hash - - evt_index - - token_address - columns: - - &block_date - name: block_date - description: "UTC event block date of each DEX trade" - - &evt_block_time - name: evt_block_time - description: 'Block time of transfer event' - - &evt_block_number - name: evt_block_number - description: 'Block number of transfer event' - - &blockchain - name: blockchain - description: "Blockchain" - - &evt_tx_hash - name: evt_tx_hash - description: 'Transaction hash of transfer event' - - &evt_index - name: evt_index - description: 'Event index' - - &pool_id - name: pool_id - description: "Unique encoded identifier that refers to each pool" - - &pool_address - name: pool_address - description: "Pool address" - - &pool_symbol - name: pool_symbol - description: "Token symbols, followed by their respective weights, if applicable" - - &pool_type - name: pool_type - description: "Pool attributes, determined by the pool's factory" - - &version - name: version - description: "Version of Balancer where the liquidity pool used in transaction is deployed" - - &token_address - name: token_address - description: "Contract address of the token" - - &token_symbol - name: token_symbol - description: "Token symbol" - - &delta_amount_raw - name: delta_amount_raw - description: "Raw value of the transaction at the time of execution in the original currency" - - &delta_amount - name: delta_amount - description: "Normalized value of the transaction at the time of execution in the original currency" - - - name: balancer_v2_arbitrum_token_balance_changes_daily - meta: - blockchain: arbitrum - project: balancer_v2 - contributors: viniabussafi - config: - tags: ['arbitrum', 'bpt', 'supply', 'changes'] - description: > - Token Balance Changes on Balancer Pools, grouped by day. - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - block_date - - pool_id - - token_address - columns: - - *block_date - - *pool_id - - *pool_address - - *pool_symbol - - *version - - *blockchain - - *pool_type - - *token_address - - *token_symbol - - &daily_delta - name: daily_delta - description: "Daily total impact on token balance" - - &daily_delta_usd - name: daily_delta_usd - description: "Daily total impact on token balance, in USD" - - &daily_delta_eth - name: daily_delta_eth - description: "Daily total impact on token balance, in eth" \ No newline at end of file diff --git a/models/_project/balancer/balances/arbitrum/balancer_v2_arbitrum_token_balance_changes.sql b/models/_project/balancer/balances/arbitrum/balancer_v2_arbitrum_token_balance_changes.sql deleted file mode 100644 index ca58f713377..00000000000 --- a/models/_project/balancer/balances/arbitrum/balancer_v2_arbitrum_token_balance_changes.sql +++ /dev/null @@ -1,16 +0,0 @@ -{% set blockchain = 'arbitrum' %} - -{{ config( - schema = 'balancer_v2_arbitrum', - alias = 'token_balance_changes', - materialized = 'table', - file_format = 'delta' - ) -}} - -{{ - balancer_token_balance_changes_macro( - blockchain = blockchain, - version = '2' - ) -}} \ No newline at end of file diff --git a/models/_project/balancer/balances/arbitrum/balancer_v2_arbitrum_token_balance_changes_daily.sql b/models/_project/balancer/balances/arbitrum/balancer_v2_arbitrum_token_balance_changes_daily.sql deleted file mode 100644 index c35d7b60259..00000000000 --- a/models/_project/balancer/balances/arbitrum/balancer_v2_arbitrum_token_balance_changes_daily.sql +++ /dev/null @@ -1,17 +0,0 @@ -{% set blockchain = 'arbitrum' %} - -{{ - config( - schema = 'balancer_v2_arbitrum', - alias = 'token_balance_changes_daily', - materialized = 'table', - file_format = 'delta' - ) -}} - -{{ - balancer_token_balance_changes_daily_agg_macro( - blockchain = blockchain, - version = '2' - ) -}} \ No newline at end of file diff --git a/models/_project/balancer/balances/avalanche_c/_schema.yml b/models/_project/balancer/balances/avalanche_c/_schema.yml deleted file mode 100644 index e341729e2fa..00000000000 --- a/models/_project/balancer/balances/avalanche_c/_schema.yml +++ /dev/null @@ -1,100 +0,0 @@ -version: 2 - -models: - - name: balancer_v2_avalanche_c_token_balance_changes - meta: - blockchain: avalanche_c - project: balancer_v2 - contributors: viniabussafi - config: - tags: ['avalanche_c', 'bpt', 'supply', 'changes'] - description: > - Token Balance Changes on Balancer Pools. - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - block_date - - evt_tx_hash - - evt_index - - token_address - columns: - - &block_date - name: block_date - description: "UTC event block date of each DEX trade" - - &evt_block_time - name: evt_block_time - description: 'Block time of transfer event' - - &evt_block_number - name: evt_block_number - description: 'Block number of transfer event' - - &blockchain - name: blockchain - description: "Blockchain" - - &evt_tx_hash - name: evt_tx_hash - description: 'Transaction hash of transfer event' - - &evt_index - name: evt_index - description: 'Event index' - - &pool_id - name: pool_id - description: "Unique encoded identifier that refers to each pool" - - &pool_address - name: pool_address - description: "Pool address" - - &pool_symbol - name: pool_symbol - description: "Token symbols, followed by their respective weights, if applicable" - - &pool_type - name: pool_type - description: "Pool attributes, determined by the pool's factory" - - &version - name: version - description: "Version of Balancer where the liquidity pool used in transaction is deployed" - - &token_address - name: token_address - description: "Contract address of the token" - - &token_symbol - name: token_symbol - description: "Token symbol" - - &delta_amount_raw - name: delta_amount_raw - description: "Raw value of the transaction at the time of execution in the original currency" - - &delta_amount - name: delta_amount - description: "Normalized value of the transaction at the time of execution in the original currency" - - - name: balancer_v2_avalanche_c_token_balance_changes_daily - meta: - blockchain: avalanche_c - project: balancer_v2 - contributors: viniabussafi - config: - tags: ['avalanche_c', 'bpt', 'supply', 'changes'] - description: > - Token Balance Changes on Balancer Pools, grouped by day. - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - block_date - - pool_id - - token_address - columns: - - *block_date - - *pool_id - - *pool_address - - *pool_symbol - - *version - - *blockchain - - *pool_type - - *token_address - - *token_symbol - - &daily_delta - name: daily_delta - description: "Daily total impact on token balance" - - &daily_delta_usd - name: daily_delta_usd - description: "Daily total impact on token balance, in USD" - - &daily_delta_eth - name: daily_delta_eth - description: "Daily total impact on token balance, in eth" \ No newline at end of file diff --git a/models/_project/balancer/balances/avalanche_c/balancer_v2_avalanche_c_token_balance_changes.sql b/models/_project/balancer/balances/avalanche_c/balancer_v2_avalanche_c_token_balance_changes.sql deleted file mode 100644 index ab55e6e99f1..00000000000 --- a/models/_project/balancer/balances/avalanche_c/balancer_v2_avalanche_c_token_balance_changes.sql +++ /dev/null @@ -1,16 +0,0 @@ -{% set blockchain = 'avalanche_c' %} - -{{ config( - schema = 'balancer_v2_avalanche_c', - alias = 'token_balance_changes', - materialized = 'table', - file_format = 'delta' - ) -}} - -{{ - balancer_token_balance_changes_macro( - blockchain = blockchain, - version = '2' - ) -}} \ No newline at end of file diff --git a/models/_project/balancer/balances/avalanche_c/balancer_v2_avalanche_c_token_balance_changes_daily.sql b/models/_project/balancer/balances/avalanche_c/balancer_v2_avalanche_c_token_balance_changes_daily.sql deleted file mode 100644 index 35ed123547e..00000000000 --- a/models/_project/balancer/balances/avalanche_c/balancer_v2_avalanche_c_token_balance_changes_daily.sql +++ /dev/null @@ -1,17 +0,0 @@ -{% set blockchain = 'avalanche_c' %} - -{{ - config( - schema = 'balancer_v2_avalanche_c', - alias = 'token_balance_changes_daily', - materialized = 'table', - file_format = 'delta' - ) -}} - -{{ - balancer_token_balance_changes_daily_agg_macro( - blockchain = blockchain, - version = '2' - ) -}} \ No newline at end of file diff --git a/models/_project/balancer/balances/balancer_token_balance_changes.sql b/models/_project/balancer/balances/balancer_token_balance_changes.sql deleted file mode 100644 index 7f531a769f3..00000000000 --- a/models/_project/balancer/balances/balancer_token_balance_changes.sql +++ /dev/null @@ -1,46 +0,0 @@ -{{ config( - schema = 'balancer', - alias = 'token_balance_changes', - post_hook='{{ expose_spells(blockchains = \'["arbitrum", "avalanche_c", "base", "ethereum", "gnosis", "optimism", "polygon", "zkevm"]\', - spell_type = "project", - spell_name = "balancer", - contributors = \'["viniabussafi"]\') }}' - ) -}} - -{% set balancer_models = [ - ref('balancer_v2_arbitrum_token_balance_changes'), - ref('balancer_v2_avalanche_c_token_balance_changes'), - ref('balancer_v2_base_token_balance_changes'), - ref('balancer_v2_ethereum_token_balance_changes'), - ref('balancer_v2_gnosis_token_balance_changes'), - ref('balancer_v2_optimism_token_balance_changes'), - ref('balancer_v2_polygon_token_balance_changes'), - ref('balancer_v2_zkevm_token_balance_changes') -] %} - -SELECT * -FROM ( - {% for model in balancer_models %} - SELECT - block_date - , evt_block_time - , evt_block_number - , blockchain - , evt_tx_hash - , evt_index - , pool_id - , pool_address - , pool_symbol - , pool_type - , version - , token_address - , token_symbol - , delta_amount_raw - , delta_amount - FROM {{ model }} - {% if not loop.last %} - UNION ALL - {% endif %} - {% endfor %} -) \ No newline at end of file diff --git a/models/_project/balancer/balances/balancer_token_balance_changes_daily.sql b/models/_project/balancer/balances/balancer_token_balance_changes_daily.sql deleted file mode 100644 index 8e199a25708..00000000000 --- a/models/_project/balancer/balances/balancer_token_balance_changes_daily.sql +++ /dev/null @@ -1,43 +0,0 @@ -{{ config( - schema = 'balancer', - alias = 'token_balance_changes_daily', - post_hook='{{ expose_spells(blockchains = \'["arbitrum", "avalanche_c", "base", "ethereum", "gnosis", "optimism", "polygon", "zkevm"]\', - spell_type = "project", - spell_name = "balancer", - contributors = \'["viniabussafi"]\') }}' - ) -}} - -{% set balancer_models = [ - ref('balancer_v2_arbitrum_token_balance_changes_daily'), - ref('balancer_v2_avalanche_c_token_balance_changes_daily'), - ref('balancer_v2_base_token_balance_changes_daily'), - ref('balancer_v2_ethereum_token_balance_changes_daily'), - ref('balancer_v2_gnosis_token_balance_changes_daily'), - ref('balancer_v2_optimism_token_balance_changes_daily'), - ref('balancer_v2_polygon_token_balance_changes_daily'), - ref('balancer_v2_zkevm_token_balance_changes_daily') -] %} - -SELECT * -FROM ( - {% for model in balancer_models %} - SELECT - block_date - , pool_id - , pool_address - , pool_symbol - , version - , blockchain - , pool_type - , token_address - , token_symbol - , daily_delta - , daily_delta_usd - , daily_delta_eth - FROM {{ model }} - {% if not loop.last %} - UNION ALL - {% endif %} - {% endfor %} -) \ No newline at end of file diff --git a/models/_project/balancer/balances/base/_schema.yml b/models/_project/balancer/balances/base/_schema.yml deleted file mode 100644 index 89a11b3e539..00000000000 --- a/models/_project/balancer/balances/base/_schema.yml +++ /dev/null @@ -1,100 +0,0 @@ -version: 2 - -models: - - name: balancer_v2_base_token_balance_changes - meta: - blockchain: base - project: balancer_v2 - contributors: viniabussafi - config: - tags: ['base', 'bpt', 'supply', 'changes'] - description: > - Token Balance Changes on Balancer Pools. - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - block_date - - evt_tx_hash - - evt_index - - token_address - columns: - - &block_date - name: block_date - description: "UTC event block date of each DEX trade" - - &evt_block_time - name: evt_block_time - description: 'Block time of transfer event' - - &evt_block_number - name: evt_block_number - description: 'Block number of transfer event' - - &blockchain - name: blockchain - description: "Blockchain" - - &evt_tx_hash - name: evt_tx_hash - description: 'Transaction hash of transfer event' - - &evt_index - name: evt_index - description: 'Event index' - - &pool_id - name: pool_id - description: "Unique encoded identifier that refers to each pool" - - &pool_address - name: pool_address - description: "Pool address" - - &pool_symbol - name: pool_symbol - description: "Token symbols, followed by their respective weights, if applicable" - - &pool_type - name: pool_type - description: "Pool attributes, determined by the pool's factory" - - &version - name: version - description: "Version of Balancer where the liquidity pool used in transaction is deployed" - - &token_address - name: token_address - description: "Contract address of the token" - - &token_symbol - name: token_symbol - description: "Token symbol" - - &delta_amount_raw - name: delta_amount_raw - description: "Raw value of the transaction at the time of execution in the original currency" - - &delta_amount - name: delta_amount - description: "Normalized value of the transaction at the time of execution in the original currency" - - - name: balancer_v2_base_token_balance_changes_daily - meta: - blockchain: base - project: balancer_v2 - contributors: viniabussafi - config: - tags: ['base', 'bpt', 'supply', 'changes'] - description: > - Token Balance Changes on Balancer Pools, grouped by day. - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - block_date - - pool_id - - token_address - columns: - - *block_date - - *pool_id - - *pool_address - - *pool_symbol - - *version - - *blockchain - - *pool_type - - *token_address - - *token_symbol - - &daily_delta - name: daily_delta - description: "Daily total impact on token balance" - - &daily_delta_usd - name: daily_delta_usd - description: "Daily total impact on token balance, in USD" - - &daily_delta_eth - name: daily_delta_eth - description: "Daily total impact on token balance, in eth" \ No newline at end of file diff --git a/models/_project/balancer/balances/base/balancer_v2_base_token_balance_changes.sql b/models/_project/balancer/balances/base/balancer_v2_base_token_balance_changes.sql deleted file mode 100644 index 1f35750f21d..00000000000 --- a/models/_project/balancer/balances/base/balancer_v2_base_token_balance_changes.sql +++ /dev/null @@ -1,16 +0,0 @@ -{% set blockchain = 'base' %} - -{{ config( - schema = 'balancer_v2_base', - alias = 'token_balance_changes', - materialized = 'table', - file_format = 'delta' - ) -}} - -{{ - balancer_token_balance_changes_macro( - blockchain = blockchain, - version = '2' - ) -}} \ No newline at end of file diff --git a/models/_project/balancer/balances/base/balancer_v2_base_token_balance_changes_daily.sql b/models/_project/balancer/balances/base/balancer_v2_base_token_balance_changes_daily.sql deleted file mode 100644 index fe24b712bee..00000000000 --- a/models/_project/balancer/balances/base/balancer_v2_base_token_balance_changes_daily.sql +++ /dev/null @@ -1,17 +0,0 @@ -{% set blockchain = 'base' %} - -{{ - config( - schema = 'balancer_v2_base', - alias = 'token_balance_changes_daily', - materialized = 'table', - file_format = 'delta' - ) -}} - -{{ - balancer_token_balance_changes_daily_agg_macro( - blockchain = blockchain, - version = '2' - ) -}} \ No newline at end of file diff --git a/models/_project/balancer/balances/ethereum/_schema.yml b/models/_project/balancer/balances/ethereum/_schema.yml deleted file mode 100644 index dab33f52016..00000000000 --- a/models/_project/balancer/balances/ethereum/_schema.yml +++ /dev/null @@ -1,131 +0,0 @@ -version: 2 - -models: - - name: balancer_ethereum_balances - meta: - blockchain: ethereum - project: balancer - contributors: jacektrocinski, metacrypto, viniabussafi - config: - tags: ['ethereum', 'balancer', 'balances'] - description: > - ERC20 token rolling sum balances on Balancer, an automated portfolio manager and trading platform. - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - day - - pool - - token - columns: - - &day - name: day - description: "UTC event block time truncated to the day mark" - tests: - - not_null - - &pool - name: pool - description: "Balancer pool contract address" - - &token - name: token - description: "Token contract address" - - &cumulative_amount - name: cumulative_amount - description: "Balance of a token" - - - name: balancer_v2_ethereum_token_balance_changes - meta: - blockchain: ethereum - project: balancer_v2 - contributors: viniabussafi - config: - tags: ['ethereum', 'bpt', 'supply', 'changes'] - description: > - Token Balance Changes on Balancer Pools. - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - block_date - - evt_tx_hash - - evt_index - - token_address - columns: - - &block_date - name: block_date - description: "UTC event block date of each DEX trade" - - &evt_block_time - name: evt_block_time - description: "Block time of transfer event" - - &evt_block_number - name: evt_block_number - description: "Block number of transfer event" - - &blockchain - name: blockchain - description: "Blockchain" - - &evt_tx_hash - name: evt_tx_hash - description: "Transaction hash of transfer event" - - &evt_index - name: evt_index - description: "Event index" - - &pool_id - name: pool_id - description: "Unique encoded identifier that refers to each pool" - - &pool_address - name: pool_address - description: "Pool address" - - &pool_symbol - name: pool_symbol - description: "Token symbols, followed by their respective weights, if applicable" - - &pool_type - name: pool_type - description: "Pool attributes, determined by the pool's factory" - - &version - name: version - description: "Version of Balancer where the liquidity pool used in transaction is deployed" - - &token_address - name: token_address - description: "Contract address of the token" - - &token_symbol - name: token_symbol - description: "Token symbol" - - &delta_amount_raw - name: delta_amount_raw - description: "Raw value of the transaction at the time of execution in the original currency" - - &delta_amount - name: delta_amount - description: "Normalized value of the transaction at the time of execution in the original currency" - - - name: balancer_v2_ethereum_token_balance_changes_daily - meta: - blockchain: ethereum - project: balancer_v2 - contributors: viniabussafi - config: - tags: ['ethereum', 'bpt', 'supply', 'changes'] - description: > - Token Balance Changes on Balancer Pools, grouped by day. - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - block_date - - pool_id - - token_address - columns: - - *block_date - - *pool_id - - *pool_address - - *pool_symbol - - *version - - *blockchain - - *pool_type - - *token_address - - *token_symbol - - &daily_delta - name: daily_delta - description: "Daily total impact on token balance" - - &daily_delta_usd - name: daily_delta_usd - description: "Daily total impact on token balance, in USD" - - &daily_delta_eth - name: daily_delta_eth - description: "Daily total impact on token balance, in ETH" \ No newline at end of file diff --git a/models/_project/balancer/balances/ethereum/balancer_v2_ethereum_token_balance_changes.sql b/models/_project/balancer/balances/ethereum/balancer_v2_ethereum_token_balance_changes.sql deleted file mode 100644 index 12b1a61ad46..00000000000 --- a/models/_project/balancer/balances/ethereum/balancer_v2_ethereum_token_balance_changes.sql +++ /dev/null @@ -1,16 +0,0 @@ -{% set blockchain = 'ethereum' %} - -{{ config( - schema = 'balancer_v2_ethereum', - alias = 'token_balance_changes', - materialized = 'table', - file_format = 'delta' - ) -}} - -{{ - balancer_token_balance_changes_macro( - blockchain = blockchain, - version = '2' - ) -}} \ No newline at end of file diff --git a/models/_project/balancer/balances/ethereum/balancer_v2_ethereum_token_balance_changes_daily.sql b/models/_project/balancer/balances/ethereum/balancer_v2_ethereum_token_balance_changes_daily.sql deleted file mode 100644 index 44aeb0ee7b8..00000000000 --- a/models/_project/balancer/balances/ethereum/balancer_v2_ethereum_token_balance_changes_daily.sql +++ /dev/null @@ -1,17 +0,0 @@ -{% set blockchain = 'ethereum' %} - -{{ - config( - schema = 'balancer_v2_ethereum', - alias = 'token_balance_changes_daily', - materialized = 'table', - file_format = 'delta' - ) -}} - -{{ - balancer_token_balance_changes_daily_agg_macro( - blockchain = blockchain, - version = '2' - ) -}} \ No newline at end of file diff --git a/models/_project/balancer/balances/gnosis/_schema.yml b/models/_project/balancer/balances/gnosis/_schema.yml deleted file mode 100644 index 9fdd91e45e3..00000000000 --- a/models/_project/balancer/balances/gnosis/_schema.yml +++ /dev/null @@ -1,100 +0,0 @@ -version: 2 - -models: - - name: balancer_v2_gnosis_token_balance_changes - meta: - blockchain: gnosis - project: balancer_v2 - contributors: viniabussafi - config: - tags: ['gnosis', 'bpt', 'supply', 'changes'] - description: > - Token Balance Changes on Balancer Pools. - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - block_date - - evt_tx_hash - - evt_index - - token_address - columns: - - &block_date - name: block_date - description: "UTC event block date of each DEX trade" - - &evt_block_time - name: evt_block_time - description: 'Block time of transfer event' - - &evt_block_number - name: evt_block_number - description: 'Block number of transfer event' - - &blockchain - name: blockchain - description: "Blockchain" - - &evt_tx_hash - name: evt_tx_hash - description: 'Transaction hash of transfer event' - - &evt_index - name: evt_index - description: 'Event index' - - &pool_id - name: pool_id - description: "Unique encoded identifier that refers to each pool" - - &pool_address - name: pool_address - description: "Pool address" - - &pool_symbol - name: pool_symbol - description: "Token symbols, followed by their respective weights, if applicable" - - &pool_type - name: pool_type - description: "Pool attributes, determined by the pool's factory" - - &version - name: version - description: "Version of Balancer where the liquidity pool used in transaction is deployed" - - &token_address - name: token_address - description: "Contract address of the token" - - &token_symbol - name: token_symbol - description: "Token symbol" - - &delta_amount_raw - name: delta_amount_raw - description: "Raw value of the transaction at the time of execution in the original currency" - - &delta_amount - name: delta_amount - description: "Normalized value of the transaction at the time of execution in the original currency" - - - name: balancer_v2_gnosis_token_balance_changes_daily - meta: - blockchain: gnosis - project: balancer_v2 - contributors: viniabussafi - config: - tags: ['gnosis', 'bpt', 'supply', 'changes'] - description: > - Token Balance Changes on Balancer Pools, grouped by day. - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - block_date - - pool_id - - token_address - columns: - - *block_date - - *pool_id - - *pool_address - - *pool_symbol - - *version - - *blockchain - - *pool_type - - *token_address - - *token_symbol - - &daily_delta - name: daily_delta - description: "Daily total impact on token balance" - - &daily_delta_usd - name: daily_delta_usd - description: "Daily total impact on token balance, in USD" - - &daily_delta_eth - name: daily_delta_eth - description: "Daily total impact on token balance, in eth" \ No newline at end of file diff --git a/models/_project/balancer/balances/gnosis/balancer_v2_gnosis_token_balance_changes.sql b/models/_project/balancer/balances/gnosis/balancer_v2_gnosis_token_balance_changes.sql deleted file mode 100644 index e3e0177541d..00000000000 --- a/models/_project/balancer/balances/gnosis/balancer_v2_gnosis_token_balance_changes.sql +++ /dev/null @@ -1,16 +0,0 @@ -{% set blockchain = 'gnosis' %} - -{{ config( - schema = 'balancer_v2_gnosis', - alias = 'token_balance_changes', - materialized = 'table', - file_format = 'delta' - ) -}} - -{{ - balancer_token_balance_changes_macro( - blockchain = blockchain, - version = '2' - ) -}} \ No newline at end of file diff --git a/models/_project/balancer/balances/gnosis/balancer_v2_gnosis_token_balance_changes_daily.sql b/models/_project/balancer/balances/gnosis/balancer_v2_gnosis_token_balance_changes_daily.sql deleted file mode 100644 index 434e9b096fb..00000000000 --- a/models/_project/balancer/balances/gnosis/balancer_v2_gnosis_token_balance_changes_daily.sql +++ /dev/null @@ -1,17 +0,0 @@ -{% set blockchain = 'gnosis' %} - -{{ - config( - schema = 'balancer_v2_gnosis', - alias = 'token_balance_changes_daily', - materialized = 'table', - file_format = 'delta' - ) -}} - -{{ - balancer_token_balance_changes_daily_agg_macro( - blockchain = blockchain, - version = '2' - ) -}} \ No newline at end of file diff --git a/models/_project/balancer/balances/optimism/_schema.yml b/models/_project/balancer/balances/optimism/_schema.yml deleted file mode 100644 index 952aefc44ee..00000000000 --- a/models/_project/balancer/balances/optimism/_schema.yml +++ /dev/null @@ -1,100 +0,0 @@ -version: 2 - -models: - - name: balancer_v2_optimism_token_balance_changes - meta: - blockchain: optimism - project: balancer_v2 - contributors: viniabussafi - config: - tags: ['optimism', 'bpt', 'supply', 'changes'] - description: > - Token Balance Changes on Balancer Pools. - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - block_date - - evt_tx_hash - - evt_index - - token_address - columns: - - &block_date - name: block_date - description: "UTC event block date of each DEX trade" - - &evt_block_time - name: evt_block_time - description: 'Block time of transfer event' - - &evt_block_number - name: evt_block_number - description: 'Block number of transfer event' - - &blockchain - name: blockchain - description: "Blockchain" - - &evt_tx_hash - name: evt_tx_hash - description: 'Transaction hash of transfer event' - - &evt_index - name: evt_index - description: 'Event index' - - &pool_id - name: pool_id - description: "Unique encoded identifier that refers to each pool" - - &pool_address - name: pool_address - description: "Pool address" - - &pool_symbol - name: pool_symbol - description: "Token symbols, followed by their respective weights, if applicable" - - &pool_type - name: pool_type - description: "Pool attributes, determined by the pool's factory" - - &version - name: version - description: "Version of Balancer where the liquidity pool used in transaction is deployed" - - &token_address - name: token_address - description: "Contract address of the token" - - &token_symbol - name: token_symbol - description: "Token symbol" - - &delta_amount_raw - name: delta_amount_raw - description: "Raw value of the transaction at the time of execution in the original currency" - - &delta_amount - name: delta_amount - description: "Normalized value of the transaction at the time of execution in the original currency" - - - name: balancer_v2_optimism_token_balance_changes_daily - meta: - blockchain: optimism - project: balancer_v2 - contributors: viniabussafi - config: - tags: ['optimism', 'bpt', 'supply', 'changes'] - description: > - Token Balance Changes on Balancer Pools, grouped by day. - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - block_date - - pool_id - - token_address - columns: - - *block_date - - *pool_id - - *pool_address - - *pool_symbol - - *version - - *blockchain - - *pool_type - - *token_address - - *token_symbol - - &daily_delta - name: daily_delta - description: "Daily total impact on token balance" - - &daily_delta_usd - name: daily_delta_usd - description: "Daily total impact on token balance, in USD" - - &daily_delta_eth - name: daily_delta_eth - description: "Daily total impact on token balance, in eth" \ No newline at end of file diff --git a/models/_project/balancer/balances/optimism/balancer_v2_optimism_token_balance_changes.sql b/models/_project/balancer/balances/optimism/balancer_v2_optimism_token_balance_changes.sql deleted file mode 100644 index 39fd96a795d..00000000000 --- a/models/_project/balancer/balances/optimism/balancer_v2_optimism_token_balance_changes.sql +++ /dev/null @@ -1,16 +0,0 @@ -{% set blockchain = 'optimism' %} - -{{ config( - schema = 'balancer_v2_optimism', - alias = 'token_balance_changes', - materialized = 'table', - file_format = 'delta' - ) -}} - -{{ - balancer_token_balance_changes_macro( - blockchain = blockchain, - version = '2' - ) -}} \ No newline at end of file diff --git a/models/_project/balancer/balances/optimism/balancer_v2_optimism_token_balance_changes_daily.sql b/models/_project/balancer/balances/optimism/balancer_v2_optimism_token_balance_changes_daily.sql deleted file mode 100644 index ac9db7d6bd7..00000000000 --- a/models/_project/balancer/balances/optimism/balancer_v2_optimism_token_balance_changes_daily.sql +++ /dev/null @@ -1,17 +0,0 @@ -{% set blockchain = 'optimism' %} - -{{ - config( - schema = 'balancer_v2_optimism', - alias = 'token_balance_changes_daily', - materialized = 'table', - file_format = 'delta' - ) -}} - -{{ - balancer_token_balance_changes_daily_agg_macro( - blockchain = blockchain, - version = '2' - ) -}} \ No newline at end of file diff --git a/models/_project/balancer/balances/polygon/_schema.yml b/models/_project/balancer/balances/polygon/_schema.yml deleted file mode 100644 index 70c27f9cac4..00000000000 --- a/models/_project/balancer/balances/polygon/_schema.yml +++ /dev/null @@ -1,100 +0,0 @@ -version: 2 - -models: - - name: balancer_v2_polygon_token_balance_changes - meta: - blockchain: polygon - project: balancer_v2 - contributors: viniabussafi - config: - tags: ['polygon', 'bpt', 'supply', 'changes'] - description: > - Token Balance Changes on Balancer Pools. - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - block_date - - evt_tx_hash - - evt_index - - token_address - columns: - - &block_date - name: block_date - description: "UTC event block date of each DEX trade" - - &evt_block_time - name: evt_block_time - description: 'Block time of transfer event' - - &evt_block_number - name: evt_block_number - description: 'Block number of transfer event' - - &blockchain - name: blockchain - description: "Blockchain" - - &evt_tx_hash - name: evt_tx_hash - description: 'Transaction hash of transfer event' - - &evt_index - name: evt_index - description: 'Event index' - - &pool_id - name: pool_id - description: "Unique encoded identifier that refers to each pool" - - &pool_address - name: pool_address - description: "Pool address" - - &pool_symbol - name: pool_symbol - description: "Token symbols, followed by their respective weights, if applicable" - - &pool_type - name: pool_type - description: "Pool attributes, determined by the pool's factory" - - &version - name: version - description: "Version of Balancer where the liquidity pool used in transaction is deployed" - - &token_address - name: token_address - description: "Contract address of the token" - - &token_symbol - name: token_symbol - description: "Token symbol" - - &delta_amount_raw - name: delta_amount_raw - description: "Raw value of the transaction at the time of execution in the original currency" - - &delta_amount - name: delta_amount - description: "Normalized value of the transaction at the time of execution in the original currency" - - - name: balancer_v2_polygon_token_balance_changes_daily - meta: - blockchain: polygon - project: balancer_v2 - contributors: viniabussafi - config: - tags: ['polygon', 'bpt', 'supply', 'changes'] - description: > - Token Balance Changes on Balancer Pools, grouped by day. - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - block_date - - pool_id - - token_address - columns: - - *block_date - - *pool_id - - *pool_address - - *pool_symbol - - *version - - *blockchain - - *pool_type - - *token_address - - *token_symbol - - &daily_delta - name: daily_delta - description: "Daily total impact on token balance" - - &daily_delta_usd - name: daily_delta_usd - description: "Daily total impact on token balance, in USD" - - &daily_delta_eth - name: daily_delta_eth - description: "Daily total impact on token balance, in eth" \ No newline at end of file diff --git a/models/_project/balancer/balances/polygon/balancer_v2_polygon_token_balance_changes.sql b/models/_project/balancer/balances/polygon/balancer_v2_polygon_token_balance_changes.sql deleted file mode 100644 index efbac69046b..00000000000 --- a/models/_project/balancer/balances/polygon/balancer_v2_polygon_token_balance_changes.sql +++ /dev/null @@ -1,16 +0,0 @@ -{% set blockchain = 'polygon' %} - -{{ config( - schema = 'balancer_v2_polygon', - alias = 'token_balance_changes', - materialized = 'table', - file_format = 'delta' - ) -}} - -{{ - balancer_token_balance_changes_macro( - blockchain = blockchain, - version = '2' - ) -}} \ No newline at end of file diff --git a/models/_project/balancer/balances/polygon/balancer_v2_polygon_token_balance_changes_daily.sql b/models/_project/balancer/balances/polygon/balancer_v2_polygon_token_balance_changes_daily.sql deleted file mode 100644 index fa318aaec80..00000000000 --- a/models/_project/balancer/balances/polygon/balancer_v2_polygon_token_balance_changes_daily.sql +++ /dev/null @@ -1,17 +0,0 @@ -{% set blockchain = 'polygon' %} - -{{ - config( - schema = 'balancer_v2_polygon', - alias = 'token_balance_changes_daily', - materialized = 'table', - file_format = 'delta' - ) -}} - -{{ - balancer_token_balance_changes_daily_agg_macro( - blockchain = blockchain, - version = '2' - ) -}} \ No newline at end of file diff --git a/models/_project/balancer/balances/zkevm/_schema.yml b/models/_project/balancer/balances/zkevm/_schema.yml deleted file mode 100644 index 3fae28a259a..00000000000 --- a/models/_project/balancer/balances/zkevm/_schema.yml +++ /dev/null @@ -1,100 +0,0 @@ -version: 2 - -models: - - name: balancer_v2_zkevm_token_balance_changes - meta: - blockchain: zkevm - project: balancer_v2 - contributors: viniabussafi - config: - tags: ['zkevm', 'bpt', 'supply', 'changes'] - description: > - Token Balance Changes on Balancer Pools. - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - block_date - - evt_tx_hash - - evt_index - - token_address - columns: - - &block_date - name: block_date - description: "UTC event block date of each DEX trade" - - &evt_block_time - name: evt_block_time - description: 'Block time of transfer event' - - &evt_block_number - name: evt_block_number - description: 'Block number of transfer event' - - &blockchain - name: blockchain - description: "Blockchain" - - &evt_tx_hash - name: evt_tx_hash - description: 'Transaction hash of transfer event' - - &evt_index - name: evt_index - description: 'Event index' - - &pool_id - name: pool_id - description: "Unique encoded identifier that refers to each pool" - - &pool_address - name: pool_address - description: "Pool address" - - &pool_symbol - name: pool_symbol - description: "Token symbols, followed by their respective weights, if applicable" - - &pool_type - name: pool_type - description: "Pool attributes, determined by the pool's factory" - - &version - name: version - description: "Version of Balancer where the liquidity pool used in transaction is deployed" - - &token_address - name: token_address - description: "Contract address of the token" - - &token_symbol - name: token_symbol - description: "Token symbol" - - &delta_amount_raw - name: delta_amount_raw - description: "Raw value of the transaction at the time of execution in the original currency" - - &delta_amount - name: delta_amount - description: "Normalized value of the transaction at the time of execution in the original currency" - - - name: balancer_v2_zkevm_token_balance_changes_daily - meta: - blockchain: zkevm - project: balancer_v2 - contributors: viniabussafi - config: - tags: ['zkevm', 'bpt', 'supply', 'changes'] - description: > - Token Balance Changes on Balancer Pools, grouped by day. - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - block_date - - pool_id - - token_address - columns: - - *block_date - - *pool_id - - *pool_address - - *pool_symbol - - *version - - *blockchain - - *pool_type - - *token_address - - *token_symbol - - &daily_delta - name: daily_delta - description: "Daily total impact on token balance" - - &daily_delta_usd - name: daily_delta_usd - description: "Daily total impact on token balance, in USD" - - &daily_delta_eth - name: daily_delta_eth - description: "Daily total impact on token balance, in eth" \ No newline at end of file diff --git a/models/_project/balancer/balances/zkevm/balancer_v2_zkevm_token_balance_changes.sql b/models/_project/balancer/balances/zkevm/balancer_v2_zkevm_token_balance_changes.sql deleted file mode 100644 index 80eff1513b7..00000000000 --- a/models/_project/balancer/balances/zkevm/balancer_v2_zkevm_token_balance_changes.sql +++ /dev/null @@ -1,16 +0,0 @@ -{% set blockchain = 'zkevm' %} - -{{ config( - schema = 'balancer_v2_zkevm', - alias = 'token_balance_changes', - materialized = 'table', - file_format = 'delta' - ) -}} - -{{ - balancer_token_balance_changes_macro( - blockchain = blockchain, - version = '2' - ) -}} \ No newline at end of file diff --git a/models/_project/balancer/balances/zkevm/balancer_v2_zkevm_token_balance_changes_daily.sql b/models/_project/balancer/balances/zkevm/balancer_v2_zkevm_token_balance_changes_daily.sql deleted file mode 100644 index 9bd7cabbb72..00000000000 --- a/models/_project/balancer/balances/zkevm/balancer_v2_zkevm_token_balance_changes_daily.sql +++ /dev/null @@ -1,17 +0,0 @@ -{% set blockchain = 'zkevm' %} - -{{ - config( - schema = 'balancer_v2_zkevm', - alias = 'token_balance_changes_daily', - materialized = 'table', - file_format = 'delta' - ) -}} - -{{ - balancer_token_balance_changes_daily_agg_macro( - blockchain = blockchain, - version = '2' - ) -}} \ No newline at end of file diff --git a/models/_project/balancer/bpt/_schema.yml b/models/_project/balancer/bpt/_schema.yml deleted file mode 100644 index 4afa2327ca2..00000000000 --- a/models/_project/balancer/bpt/_schema.yml +++ /dev/null @@ -1,176 +0,0 @@ -version: 2 - -models: - - name: balancer_transfers_bpt - meta: - blockchain: arbitrum, avalanche_c, base, ethereum, gnosis, optimism, polygon, zkevmn - contributors: victorstefenon, thetroyharris, viniabussafi - config: - tags: ['arbitrum', 'avalanche_c', 'base', 'ethereum', 'gnosis', 'optimism', 'polygon', 'zkevm', 'bpt', 'transfers'] - description: > - Balancer Pool Token (BPT) transfer logs on Balancer, an automated portfolio manager and trading platform. - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - evt_tx_hash - - evt_index - - block_date - columns: - - &blockchain - name: blockchain - description: "Blockchain" - - &version - name: version - description: "Version of Balancer where the liquidity pool used in transaction is deployed" - - &contract_address - name: contract_address - description: 'zkevm address for the liquidity pool used in transaction' - - &block_date - name: block_date - description: "UTC event block date of each DEX trade" - - &block_month - name: block_month - description: "UTC event block month of each DEX trade" - - &evt_tx_hash - name: evt_tx_hash - description: 'Transaction hash of transfer event' - - &evt_index - name: evt_index - description: 'Event index' - - &evt_block_time - name: evt_block_time - description: 'Block time of transfer event' - - &evt_block_number - name: evt_block_number - description: 'Block number of transfer event' - - &from - name: from - description: 'Address of BPT provider of transfer event' - - &to - name: to - description: 'Address of BPT receiver of transfer event' - - &value - name: value - description: 'Amount of BPT transferred in transfer event' - - - name: balancer_bpt_prices - meta: - blockchain: arbitrum, avalanche_c, base, ethereum, gnosis, optimism, polygon, zkevm - sector: dex - contributors: thetroyharris, victorstefenon, viniabussafi - config: - tags: ['balancer', 'amm', 'dex', 'bpt', 'prices', 'ethereum', 'arbitrum', 'optimism', 'polygon', 'gnosis', 'avalanche_c', 'base', 'zkevm'] - description: > - Balancer Pool Token (BPT) hourly median price by pool on Balancer, an automated portfolio manager and trading platform. - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - blockchain - - day - - contract_address - columns: - - *blockchain - - &day - name: day - description: "Block date in UTC" - - *version - - &decimals - name: decimals - description: "Token decimals. 18, by default, on BPTs" - - *contract_address - - &bpt_price - name: bpt_price - description: "Price of the BPT" - - - - name: balancer_bpt_supply - meta: - blockchain: arbitrum, avalanche_c, base, ethereum, gnosis, optimism, polygon, zkevm - contributors: thetroyharris, viniabussafi - config: - tags: ['arbitrum', 'avalanche_c', 'base', 'ethereum', 'gnosis', 'optimism', 'polygon', 'zkevm', 'bpt'] - description: > - The Balancer Pool Token (BPT) supply over time of ComposableStablePools versions 4+ - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - day - - blockchain - - token_address - columns: - - *day - - &pool_type - name: pool_type - description: "Pool attributes, determined by the pool's factory" - - *version - - *blockchain - - &token_address - name: token_address - description: "Contract address of the BPT" - - &supply - name: supply - description: "Supply of the BPT, discounted of premints" - - - name: balancer_bpt_supply_changes - meta: - blockchain: arbitrum, avalanche_c, base, ethereum, gnosis, optimism, polygon, zkevm - contributors: viniabussafi - config: - tags: ['arbitrum', 'avalanche_c', 'base', 'ethereum', 'gnosis', 'optimism', 'polygon', 'zkevm', 'bpt', 'supply', 'changes'] - description: > - Balancer Pool Token (BPT) supply change events. - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - block_date - - evt_tx_hash - - evt_index - - label - columns: - - *block_date - - *evt_block_time - - *evt_block_number - - *blockchain - - *evt_tx_hash - - *evt_index - - *pool_type - - &pool_symbol - name: pool_symbol - description: "Token symbols, followed by their respective weights, if applicable" - - *version - - &label - name: label - description: "Nature of the transaction (Join/Exit via swap or Mint/Burn via transfer)" - - *token_address - - &delta_amount_raw - name: delta_amount_raw - description: "Raw value of the transaction on token supply at the time of execution in the original currency" - - &delta_amount - name: delta_amount - description: "Normalized value of the transaction on token supply at the time of execution in the original currency" - - - - name: balancer_bpt_supply_changes_daily - meta: - blockchain: arbitrum, avalanche_c, base, ethereum, gnosis, optimism, polygon, zkevm - contributors: viniabussafi - config: - tags: ['arbitrum', 'avalanche_c', 'base', 'ethereum', 'gnosis', 'optimism', 'polygon', 'zkevm', 'bpt', 'supply', 'changes'] - description: > - Balancer Pool Token (BPT) supply change events. grouped by day - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - block_date - - blockchain - - token_address - columns: - - *block_date - - *blockchain - - *pool_type - - *pool_symbol - - *version - - *token_address - - &daily_delta - name: daily_delta - description: "Daily total impact on BPT supply" \ No newline at end of file diff --git a/models/_project/balancer/bpt/arbitrum/_schema.yml b/models/_project/balancer/bpt/arbitrum/_schema.yml deleted file mode 100644 index c32bee8b667..00000000000 --- a/models/_project/balancer/bpt/arbitrum/_schema.yml +++ /dev/null @@ -1,178 +0,0 @@ -version: 2 - -models: - - name: balancer_v2_arbitrum_transfers_bpt - meta: - blockchain: arbitrum - project: balancer_v2 - contributors: victorstefenon, thetroyharris, viniabussafi - config: - tags: ['arbitrum', 'bpt', 'transfers'] - description: > - Balancer Pool Token (BPT) transfer logs on Balancer, an automated portfolio manager and trading platform, on Arbitrum. - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - evt_tx_hash - - evt_index - - block_date - columns: - - &blockchain - name: blockchain - description: "Blockchain" - - &version - name: version - description: "Version of Balancer where the liquidity pool used in transaction is deployed" - - &contract_address - name: contract_address - description: 'Arbitrum address for the liquidity pool used in transaction' - - &block_date - name: block_date - description: "UTC event block date of each DEX trade" - - &block_month - name: block_month - description: "UTC event block month of each DEX trade" - - &evt_tx_hash - name: evt_tx_hash - description: 'Transaction hash of transfer event' - - &evt_index - name: evt_index - description: 'Event index' - - &evt_block_time - name: evt_block_time - description: 'Block time of transfer event' - - &evt_block_number - name: evt_block_number - description: 'Block number of transfer event' - - &from - name: from - description: 'Address of BPT provider of transfer event' - - &to - name: to - description: 'Address of BPT receiver of transfer event' - - &value - name: value - description: 'Amount of BPT transferred in transfer event' - - - name: balancer_v2_arbitrum_bpt_prices - meta: - blockchain: arbitrum - project: balancer_v2 - contributors: victorstefenon, thetroyharris, viniabussafi - config: - tags: ['arbitrum', 'bpt', 'prices'] - description: > - Balancer Pool Token (BPT) daily price by pool on Balancer, an automated portfolio manager and trading platform. - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - blockchain - - day - - contract_address - columns: - - *blockchain - - &day - name: day - description: "Block date in UTC" - - *version - - &decimals - name: decimals - description: "Token decimals. 18, by default, on BPTs" - - *contract_address - - &bpt_price - name: bpt_price - description: "Price of the BPT" - - - name: balancer_v2_arbitrum_bpt_supply - meta: - blockchain: arbitrum - project: balancer_v2 - contributors: thetroyharris, viniabussafi - config: - tags: ['arbitrum', 'bpt', 'supply'] - description: > - Balancer Pool Token (BPT) supply by pool on Balancer, an automated portfolio manager and trading platform. - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - day - - blockchain - - token_address - columns: - - *day - - &pool_type - name: pool_type - description: "Pool attributes, determined by the pool's factory" - - *version - - *blockchain - - &token_address - name: token_address - description: "Contract address of the BPT" - - &supply - name: supply - description: "Supply of the BPT, discounted of premints" - - - name: balancer_v2_arbitrum_bpt_supply_changes - meta: - blockchain: arbitrum - project: balancer_v2 - contributors: viniabussafi - config: - tags: ['arbitrum', 'bpt', 'supply', 'changes'] - description: > - Balancer Pool Token (BPT) supply change events. - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - block_date - - evt_tx_hash - - evt_index - - label - columns: - - *block_date - - *evt_block_time - - *evt_block_number - - *blockchain - - *evt_tx_hash - - *evt_index - - *pool_type - - &pool_symbol - name: pool_symbol - description: "Token symbols, followed by their respective weights, if applicable" - - *version - - &label - name: label - description: "Nature of the transaction (Join/Exit via swap or Mint/Burn via transfer)" - - *token_address - - &delta_amount_raw - name: delta_amount_raw - description: "Raw value of the transaction on token supply at the time of execution in the original currency" - - &delta_amount - name: delta_amount - description: "Normalized value of the transaction on token supply at the time of execution in the original currency" - - - name: balancer_v2_arbitrum_bpt_supply_changes_daily - meta: - blockchain: arbitrum - project: balancer_v2 - contributors: viniabussafi - config: - tags: ['arbitrum', 'bpt', 'supply', 'changes'] - description: > - Balancer Pool Token (BPT) supply change events. grouped by day - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - block_date - - blockchain - - token_address - columns: - - *block_date - - *blockchain - - *pool_type - - *pool_symbol - - *version - - *token_address - - &daily_delta - name: daily_delta - description: "Daily total impact on BPT supply" \ No newline at end of file diff --git a/models/_project/balancer/bpt/arbitrum/balancer_v2_arbitrum_bpt_supply_changes.sql b/models/_project/balancer/bpt/arbitrum/balancer_v2_arbitrum_bpt_supply_changes.sql deleted file mode 100644 index b30224001c3..00000000000 --- a/models/_project/balancer/bpt/arbitrum/balancer_v2_arbitrum_bpt_supply_changes.sql +++ /dev/null @@ -1,20 +0,0 @@ -{% set blockchain = 'arbitrum' %} - -{{ - config( - schema = 'balancer_v2_arbitrum', - alias = 'bpt_supply_changes', - materialized = 'incremental', - file_format = 'delta', - incremental_strategy = 'merge', - unique_key = ['block_date', 'evt_tx_hash', 'evt_index', 'label'], - incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.evt_block_time')] - ) -}} - -{{ - bpt_supply_changes_macro( - blockchain = blockchain, - version = '2' - ) -}} \ No newline at end of file diff --git a/models/_project/balancer/bpt/arbitrum/balancer_v2_arbitrum_bpt_supply_changes_daily.sql b/models/_project/balancer/bpt/arbitrum/balancer_v2_arbitrum_bpt_supply_changes_daily.sql deleted file mode 100644 index df606a75ceb..00000000000 --- a/models/_project/balancer/bpt/arbitrum/balancer_v2_arbitrum_bpt_supply_changes_daily.sql +++ /dev/null @@ -1,17 +0,0 @@ -{% set blockchain = 'ethereum' %} - -{{ - config( - schema = 'balancer_v2_ethereum', - alias = 'bpt_supply_changes_daily', - materialized = 'table', - file_format = 'delta' - ) -}} - -{{ - bpt_supply_changes_daily_agg_macro( - blockchain = blockchain, - version = '2' - ) -}} \ No newline at end of file diff --git a/models/_project/balancer/bpt/avalanche_c/_schema.yml b/models/_project/balancer/bpt/avalanche_c/_schema.yml deleted file mode 100644 index 8bde08a0ad8..00000000000 --- a/models/_project/balancer/bpt/avalanche_c/_schema.yml +++ /dev/null @@ -1,178 +0,0 @@ -version: 2 - -models: - - name: balancer_v2_avalanche_c_transfers_bpt - meta: - blockchain: avalanche_c - project: balancer_v2 - contributors: victorstefenon, thetroyharris, viniabussafi - config: - tags: ['avalanche_c', 'bpt', 'transfers'] - description: > - Balancer Pool Token (BPT) transfer logs on Balancer, an automated portfolio manager and trading platform, on avalanche_c. - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - evt_tx_hash - - evt_index - - block_date - columns: - - &blockchain - name: blockchain - description: "Blockchain" - - &version - name: version - description: "Version of Balancer where the liquidity pool used in transaction is deployed" - - &contract_address - name: contract_address - description: 'avalanche_c address for the liquidity pool used in transaction' - - &block_date - name: block_date - description: "UTC event block date of each DEX trade" - - &block_month - name: block_month - description: "UTC event block month of each DEX trade" - - &evt_tx_hash - name: evt_tx_hash - description: 'Transaction hash of transfer event' - - &evt_index - name: evt_index - description: 'Event index' - - &evt_block_time - name: evt_block_time - description: 'Block time of transfer event' - - &evt_block_number - name: evt_block_number - description: 'Block number of transfer event' - - &from - name: from - description: 'Address of BPT provider of transfer event' - - &to - name: to - description: 'Address of BPT receiver of transfer event' - - &value - name: value - description: 'Amount of BPT transferred in transfer event' - - - name: balancer_v2_avalanche_c_bpt_prices - meta: - blockchain: avalanche_c - project: balancer_v2 - contributors: victorstefenon, thetroyharris, viniabussafi - config: - tags: ['avalanche_c', 'bpt', 'prices'] - description: > - Balancer Pool Token (BPT) daily price by pool on Balancer, an automated portfolio manager and trading platform. - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - blockchain - - day - - contract_address - columns: - - *blockchain - - &day - name: day - description: "Block date in UTC" - - *version - - &decimals - name: decimals - description: "Token decimals. 18, by default, on BPTs" - - *contract_address - - &bpt_price - name: bpt_price - description: "Price of the BPT" - - - name: balancer_v2_avalanche_c_bpt_supply - meta: - blockchain: avalanche_c - project: balancer_v2 - contributors: thetroyharris, viniabussafi - config: - tags: ['avalanche_c', 'bpt', 'supply'] - description: > - Balancer Pool Token (BPT) supply by pool on Balancer, an automated portfolio manager and trading platform. - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - day - - blockchain - - token_address - columns: - - *day - - &pool_type - name: pool_type - description: "Pool attributes, determined by the pool's factory" - - *version - - *blockchain - - &token_address - name: token_address - description: "Contract address of the BPT" - - &supply - name: supply - description: "Supply of the BPT, discounted of premints" - - - name: balancer_v2_avalanche_c_bpt_supply_changes - meta: - blockchain: avalanche_c - project: balancer_v2 - contributors: viniabussafi - config: - tags: ['avalanche_c', 'bpt', 'supply', 'changes'] - description: > - Balancer Pool Token (BPT) supply change events. - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - block_date - - evt_tx_hash - - evt_index - - label - columns: - - *block_date - - *evt_block_time - - *evt_block_number - - *blockchain - - *evt_tx_hash - - *evt_index - - *pool_type - - &pool_symbol - name: pool_symbol - description: "Token symbols, followed by their respective weights, if applicable" - - *version - - &label - name: label - description: "Nature of the transaction (Join/Exit via swap or Mint/Burn via transfer)" - - *token_address - - &delta_amount_raw - name: delta_amount_raw - description: "Raw value of the transaction on token supply at the time of execution in the original currency" - - &delta_amount - name: delta_amount - description: "Normalized value of the transaction on token supply at the time of execution in the original currency" - - - name: balancer_v2_avalanche_c_bpt_supply_changes_daily - meta: - blockchain: avalanche_c - project: balancer_v2 - contributors: viniabussafi - config: - tags: ['avalanche_c', 'bpt', 'supply', 'changes'] - description: > - Balancer Pool Token (BPT) supply change events. grouped by day - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - block_date - - blockchain - - token_address - columns: - - *block_date - - *blockchain - - *pool_type - - *pool_symbol - - *version - - *token_address - - &daily_delta - name: daily_delta - description: "Daily total impact on BPT supply" \ No newline at end of file diff --git a/models/_project/balancer/bpt/avalanche_c/balancer_v2_avalanche_c_bpt_supply_changes.sql b/models/_project/balancer/bpt/avalanche_c/balancer_v2_avalanche_c_bpt_supply_changes.sql deleted file mode 100644 index db1052cb8d8..00000000000 --- a/models/_project/balancer/bpt/avalanche_c/balancer_v2_avalanche_c_bpt_supply_changes.sql +++ /dev/null @@ -1,20 +0,0 @@ -{% set blockchain = 'avalanche_c' %} - -{{ - config( - schema = 'balancer_v2_avalanche_c', - alias = 'bpt_supply_changes', - materialized = 'incremental', - file_format = 'delta', - incremental_strategy = 'merge', - unique_key = ['block_date', 'evt_tx_hash', 'evt_index', 'label'], - incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.evt_block_time')] - ) -}} - -{{ - bpt_supply_changes_macro( - blockchain = blockchain, - version = '2' - ) -}} \ No newline at end of file diff --git a/models/_project/balancer/bpt/avalanche_c/balancer_v2_avalanche_c_bpt_supply_changes_daily.sql b/models/_project/balancer/bpt/avalanche_c/balancer_v2_avalanche_c_bpt_supply_changes_daily.sql deleted file mode 100644 index 5ce53b4aa92..00000000000 --- a/models/_project/balancer/bpt/avalanche_c/balancer_v2_avalanche_c_bpt_supply_changes_daily.sql +++ /dev/null @@ -1,17 +0,0 @@ -{% set blockchain = 'avalanche_c' %} - -{{ - config( - schema = 'balancer_v2_avalanche_c', - alias = 'bpt_supply_changes_daily', - materialized = 'table', - file_format = 'delta' - ) -}} - -{{ - bpt_supply_changes_daily_agg_macro( - blockchain = blockchain, - version = '2' - ) -}} \ No newline at end of file diff --git a/models/_project/balancer/bpt/balancer_bpt_supply_changes.sql b/models/_project/balancer/bpt/balancer_bpt_supply_changes.sql deleted file mode 100644 index e46a587b3b0..00000000000 --- a/models/_project/balancer/bpt/balancer_bpt_supply_changes.sql +++ /dev/null @@ -1,44 +0,0 @@ -{{ config( - schema = 'balancer', - alias = 'bpt_supply_changes', - post_hook='{{ expose_spells(blockchains = \'["arbitrum", "avalanche_c", "base", "ethereum", "gnosis", "optimism", "polygon", "zkevm"]\', - spell_type = "project", - spell_name = "balancer", - contributors = \'["viniabussafi"]\') }}' - ) -}} - -{% set balancer_models = [ - ref('balancer_v2_arbitrum_bpt_supply_changes'), - ref('balancer_v2_avalanche_c_bpt_supply_changes'), - ref('balancer_v2_base_bpt_supply_changes'), - ref('balancer_v2_ethereum_bpt_supply_changes'), - ref('balancer_v2_gnosis_bpt_supply_changes'), - ref('balancer_v2_optimism_bpt_supply_changes'), - ref('balancer_v2_polygon_bpt_supply_changes'), - ref('balancer_v2_zkevm_bpt_supply_changes') -] %} - -SELECT * -FROM ( - {% for model in balancer_models %} - SELECT - block_date - , evt_block_time - , evt_block_number - , blockchain - , evt_tx_hash - , evt_index - , pool_type - , pool_symbol - , version - , label - , token_address - , delta_amount_raw - , delta_amount - FROM {{ model }} - {% if not loop.last %} - UNION ALL - {% endif %} - {% endfor %} -) \ No newline at end of file diff --git a/models/_project/balancer/bpt/balancer_bpt_supply_changes_daily.sql b/models/_project/balancer/bpt/balancer_bpt_supply_changes_daily.sql deleted file mode 100644 index 5b593cef48a..00000000000 --- a/models/_project/balancer/bpt/balancer_bpt_supply_changes_daily.sql +++ /dev/null @@ -1,38 +0,0 @@ -{{ config( - schema = 'balancer', - alias = 'bpt_supply_changes_daily', - post_hook='{{ expose_spells(blockchains = \'["arbitrum", "avalanche_c", "base", "ethereum", "gnosis", "optimism", "polygon", "zkevm"]\', - spell_type = "project", - spell_name = "balancer", - contributors = \'["viniabussafi"]\') }}' - ) -}} - -{% set balancer_models = [ - ref('balancer_v2_arbitrum_bpt_supply_changes_daily'), - ref('balancer_v2_avalanche_c_bpt_supply_changes_daily'), - ref('balancer_v2_base_bpt_supply_changes_daily'), - ref('balancer_v2_ethereum_bpt_supply_changes_daily'), - ref('balancer_v2_gnosis_bpt_supply_changes_daily'), - ref('balancer_v2_optimism_bpt_supply_changes_daily'), - ref('balancer_v2_polygon_bpt_supply_changes_daily'), - ref('balancer_v2_zkevm_bpt_supply_changes_daily') -] %} - -SELECT * -FROM ( - {% for model in balancer_models %} - SELECT - block_date - , blockchain - , pool_type - , pool_symbol - , version - , token_address - , daily_delta - FROM {{ model }} - {% if not loop.last %} - UNION ALL - {% endif %} - {% endfor %} -) \ No newline at end of file diff --git a/models/_project/balancer/bpt/base/_schema.yml b/models/_project/balancer/bpt/base/_schema.yml deleted file mode 100644 index a32b805f7e2..00000000000 --- a/models/_project/balancer/bpt/base/_schema.yml +++ /dev/null @@ -1,178 +0,0 @@ -version: 2 - -models: - - name: balancer_v2_base_transfers_bpt - meta: - blockchain: base - project: balancer_v2 - contributors: victorstefenon, thetroyharris, viniabussafi - config: - tags: ['base', 'bpt', 'transfers'] - description: > - Balancer Pool Token (BPT) transfer logs on Balancer, an automated portfolio manager and trading platform, on base. - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - evt_tx_hash - - evt_index - - block_date - columns: - - &blockchain - name: blockchain - description: "Blockchain" - - &version - name: version - description: "Version of Balancer where the liquidity pool used in transaction is deployed" - - &contract_address - name: contract_address - description: 'base address for the liquidity pool used in transaction' - - &block_date - name: block_date - description: "UTC event block date of each DEX trade" - - &block_month - name: block_month - description: "UTC event block month of each DEX trade" - - &evt_tx_hash - name: evt_tx_hash - description: 'Transaction hash of transfer event' - - &evt_index - name: evt_index - description: 'Event index' - - &evt_block_time - name: evt_block_time - description: 'Block time of transfer event' - - &evt_block_number - name: evt_block_number - description: 'Block number of transfer event' - - &from - name: from - description: 'Address of BPT provider of transfer event' - - &to - name: to - description: 'Address of BPT receiver of transfer event' - - &value - name: value - description: 'Amount of BPT transferred in transfer event' - - - name: balancer_v2_base_bpt_prices - meta: - blockchain: base - project: balancer_v2 - contributors: victorstefenon, thetroyharris, viniabussafi - config: - tags: ['base', 'bpt', 'prices'] - description: > - Balancer Pool Token (BPT) daily price by pool on Balancer, an automated portfolio manager and trading platform. - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - blockchain - - day - - contract_address - columns: - - *blockchain - - &day - name: day - description: "Block date in UTC" - - *version - - &decimals - name: decimals - description: "Token decimals. 18, by default, on BPTs" - - *contract_address - - &bpt_price - name: bpt_price - description: "Price of the BPT" - - - name: balancer_v2_base_bpt_supply - meta: - blockchain: base - project: balancer_v2 - contributors: thetroyharris, viniabussafi - config: - tags: ['base', 'bpt', 'supply'] - description: > - Balancer Pool Token (BPT) supply by pool on Balancer, an automated portfolio manager and trading platform. - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - day - - blockchain - - token_address - columns: - - *day - - &pool_type - name: pool_type - description: "Pool attributes, determined by the pool's factory" - - *version - - *blockchain - - &token_address - name: token_address - description: "Contract address of the BPT" - - &supply - name: supply - description: "Supply of the BPT, discounted of premints" - - - name: balancer_v2_base_bpt_supply_changes - meta: - blockchain: base - project: balancer_v2 - contributors: viniabussafi - config: - tags: ['base', 'bpt', 'supply', 'changes'] - description: > - Balancer Pool Token (BPT) supply change events. - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - block_date - - evt_tx_hash - - evt_index - - label - columns: - - *block_date - - *evt_block_time - - *evt_block_number - - *blockchain - - *evt_tx_hash - - *evt_index - - *pool_type - - &pool_symbol - name: pool_symbol - description: "Token symbols, followed by their respective weights, if applicable" - - *version - - &label - name: label - description: "Nature of the transaction (Join/Exit via swap or Mint/Burn via transfer)" - - *token_address - - &delta_amount_raw - name: delta_amount_raw - description: "Raw value of the transaction on token supply at the time of execution in the original currency" - - &delta_amount - name: delta_amount - description: "Normalized value of the transaction on token supply at the time of execution in the original currency" - - - name: balancer_v2_base_bpt_supply_changes_daily - meta: - blockchain: base - project: balancer_v2 - contributors: viniabussafi - config: - tags: ['base', 'bpt', 'supply', 'changes'] - description: > - Balancer Pool Token (BPT) supply change events. grouped by day - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - block_date - - blockchain - - token_address - columns: - - *block_date - - *blockchain - - *pool_type - - *pool_symbol - - *version - - *token_address - - &daily_delta - name: daily_delta - description: "Daily total impact on BPT supply" \ No newline at end of file diff --git a/models/_project/balancer/bpt/base/balancer_v2_base_bpt_supply_changes.sql b/models/_project/balancer/bpt/base/balancer_v2_base_bpt_supply_changes.sql deleted file mode 100644 index 1d273f4e49e..00000000000 --- a/models/_project/balancer/bpt/base/balancer_v2_base_bpt_supply_changes.sql +++ /dev/null @@ -1,20 +0,0 @@ -{% set blockchain = 'base' %} - -{{ - config( - schema = 'balancer_v2_base', - alias = 'bpt_supply_changes', - materialized = 'incremental', - file_format = 'delta', - incremental_strategy = 'merge', - unique_key = ['block_date', 'evt_tx_hash', 'evt_index', 'label'], - incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.evt_block_time')] - ) -}} - -{{ - bpt_supply_changes_macro( - blockchain = blockchain, - version = '2' - ) -}} \ No newline at end of file diff --git a/models/_project/balancer/bpt/base/balancer_v2_base_bpt_supply_changes_daily.sql b/models/_project/balancer/bpt/base/balancer_v2_base_bpt_supply_changes_daily.sql deleted file mode 100644 index b90fdf94033..00000000000 --- a/models/_project/balancer/bpt/base/balancer_v2_base_bpt_supply_changes_daily.sql +++ /dev/null @@ -1,17 +0,0 @@ -{% set blockchain = 'base' %} - -{{ - config( - schema = 'balancer_v2_base', - alias = 'bpt_supply_changes_daily', - materialized = 'table', - file_format = 'delta' - ) -}} - -{{ - bpt_supply_changes_daily_agg_macro( - blockchain = blockchain, - version = '2' - ) -}} \ No newline at end of file diff --git a/models/_project/balancer/bpt/ethereum/_schema.yml b/models/_project/balancer/bpt/ethereum/_schema.yml deleted file mode 100644 index aa54846a5f3..00000000000 --- a/models/_project/balancer/bpt/ethereum/_schema.yml +++ /dev/null @@ -1,178 +0,0 @@ -version: 2 - -models: - - name: balancer_v2_ethereum_transfers_bpt - meta: - blockchain: ethereum - project: balancer_v2 - contributors: victorstefenon, thetroyharris, viniabussafi - config: - tags: ['ethereum', 'bpt', 'transfers'] - description: > - Balancer Pool Token (BPT) transfer logs on Balancer, an automated portfolio manager and trading platform, on ethereum. - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - evt_tx_hash - - evt_index - - block_date - columns: - - &blockchain - name: blockchain - description: "Blockchain" - - &version - name: version - description: "Version of Balancer where the liquidity pool used in transaction is deployed" - - &contract_address - name: contract_address - description: 'ethereum address for the liquidity pool used in transaction' - - &block_date - name: block_date - description: "UTC event block date of each DEX trade" - - &block_month - name: block_month - description: "UTC event block month of each DEX trade" - - &evt_tx_hash - name: evt_tx_hash - description: 'Transaction hash of transfer event' - - &evt_index - name: evt_index - description: 'Event index' - - &evt_block_time - name: evt_block_time - description: 'Block time of transfer event' - - &evt_block_number - name: evt_block_number - description: 'Block number of transfer event' - - &from - name: from - description: 'Address of BPT provider of transfer event' - - &to - name: to - description: 'Address of BPT receiver of transfer event' - - &value - name: value - description: 'Amount of BPT transferred in transfer event' - - - name: balancer_v2_ethereum_bpt_prices - meta: - blockchain: ethereum - project: balancer_v2 - contributors: victorstefenon, thetroyharris, viniabussafi - config: - tags: ['ethereum', 'bpt', 'prices'] - description: > - Balancer Pool Token (BPT) daily price by pool on Balancer, an automated portfolio manager and trading platform. - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - blockchain - - day - - contract_address - columns: - - *blockchain - - &day - name: day - description: "Block date in UTC" - - *version - - &decimals - name: decimals - description: "Token decimals. 18, by default, on BPTs" - - *contract_address - - &bpt_price - name: bpt_price - description: "Price of the BPT" - - - name: balancer_v2_ethereum_bpt_supply - meta: - blockchain: ethereum - project: balancer_v2 - contributors: thetroyharris, viniabussafi - config: - tags: ['ethereum', 'bpt', 'supply'] - description: > - Balancer Pool Token (BPT) supply by pool on Balancer, an automated portfolio manager and trading platform. - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - day - - blockchain - - token_address - columns: - - *day - - &pool_type - name: pool_type - description: "Pool attributes, determined by the pool's factory" - - *version - - *blockchain - - &token_address - name: token_address - description: "Contract address of the BPT" - - &supply - name: supply - description: "Supply of the BPT, discounted of premints" - - - name: balancer_v2_ethereum_bpt_supply_changes - meta: - blockchain: ethereum - project: balancer_v2 - contributors: viniabussafi - config: - tags: ['ethereum', 'bpt', 'supply', 'changes'] - description: > - Balancer Pool Token (BPT) supply change events. - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - block_date - - evt_tx_hash - - evt_index - - label - columns: - - *block_date - - *evt_block_time - - *evt_block_number - - *blockchain - - *evt_tx_hash - - *evt_index - - *pool_type - - &pool_symbol - name: pool_symbol - description: "Token symbols, followed by their respective weights, if applicable" - - *version - - &label - name: label - description: "Nature of the transaction (Join/Exit via swap or Mint/Burn via transfer)" - - *token_address - - &delta_amount_raw - name: delta_amount_raw - description: "Raw value of the transaction on token supply at the time of execution in the original currency" - - &delta_amount - name: delta_amount - description: "Normalized value of the transaction on token supply at the time of execution in the original currency" - - - name: balancer_v2_ethereum_bpt_supply_changes_daily - meta: - blockchain: ethereum - project: balancer_v2 - contributors: viniabussafi - config: - tags: ['ethereum', 'bpt', 'supply', 'changes'] - description: > - Balancer Pool Token (BPT) supply change events. grouped by day - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - block_date - - blockchain - - token_address - columns: - - *block_date - - *blockchain - - *pool_type - - *pool_symbol - - *version - - *token_address - - &daily_delta - name: daily_delta - description: "Daily total impact on BPT supply" \ No newline at end of file diff --git a/models/_project/balancer/bpt/ethereum/balancer_v2_ethereum_bpt_supply_changes.sql b/models/_project/balancer/bpt/ethereum/balancer_v2_ethereum_bpt_supply_changes.sql deleted file mode 100644 index 1fa7db6b904..00000000000 --- a/models/_project/balancer/bpt/ethereum/balancer_v2_ethereum_bpt_supply_changes.sql +++ /dev/null @@ -1,20 +0,0 @@ -{% set blockchain = 'ethereum' %} - -{{ - config( - schema = 'balancer_v2_ethereum', - alias = 'bpt_supply_changes', - materialized = 'incremental', - file_format = 'delta', - incremental_strategy = 'merge', - unique_key = ['block_date', 'evt_tx_hash', 'evt_index', 'label'], - incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.evt_block_time')] - ) -}} - -{{ - bpt_supply_changes_macro( - blockchain = blockchain, - version = '2' - ) -}} \ No newline at end of file diff --git a/models/_project/balancer/bpt/ethereum/balancer_v2_ethereum_bpt_supply_changes_daily.sql b/models/_project/balancer/bpt/ethereum/balancer_v2_ethereum_bpt_supply_changes_daily.sql deleted file mode 100644 index 74d3be91fdf..00000000000 --- a/models/_project/balancer/bpt/ethereum/balancer_v2_ethereum_bpt_supply_changes_daily.sql +++ /dev/null @@ -1,17 +0,0 @@ -{% set blockchain = 'arbitrum' %} - -{{ - config( - schema = 'balancer_v2_arbitrum', - alias = 'bpt_supply_changes_daily', - materialized = 'table', - file_format = 'delta' - ) -}} - -{{ - bpt_supply_changes_daily_agg_macro( - blockchain = blockchain, - version = '2' - ) -}} \ No newline at end of file diff --git a/models/_project/balancer/bpt/gnosis/_schema.yml b/models/_project/balancer/bpt/gnosis/_schema.yml deleted file mode 100644 index aae23d80a8a..00000000000 --- a/models/_project/balancer/bpt/gnosis/_schema.yml +++ /dev/null @@ -1,178 +0,0 @@ -version: 2 - -models: - - name: balancer_v2_gnosis_transfers_bpt - meta: - blockchain: gnosis - project: balancer_v2 - contributors: victorstefenon, thetroyharris, viniabussafi - config: - tags: ['gnosis', 'bpt', 'transfers'] - description: > - Balancer Pool Token (BPT) transfer logs on Balancer, an automated portfolio manager and trading platform, on gnosis. - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - evt_tx_hash - - evt_index - - block_date - columns: - - &blockchain - name: blockchain - description: "Blockchain" - - &version - name: version - description: "Version of Balancer where the liquidity pool used in transaction is deployed" - - &contract_address - name: contract_address - description: 'gnosis address for the liquidity pool used in transaction' - - &block_date - name: block_date - description: "UTC event block date of each DEX trade" - - &block_month - name: block_month - description: "UTC event block month of each DEX trade" - - &evt_tx_hash - name: evt_tx_hash - description: 'Transaction hash of transfer event' - - &evt_index - name: evt_index - description: 'Event index' - - &evt_block_time - name: evt_block_time - description: 'Block time of transfer event' - - &evt_block_number - name: evt_block_number - description: 'Block number of transfer event' - - &from - name: from - description: 'Address of BPT provider of transfer event' - - &to - name: to - description: 'Address of BPT receiver of transfer event' - - &value - name: value - description: 'Amount of BPT transferred in transfer event' - - - name: balancer_v2_gnosis_bpt_prices - meta: - blockchain: gnosis - project: balancer_v2 - contributors: victorstefenon, thetroyharris, viniabussafi - config: - tags: ['gnosis', 'bpt', 'prices'] - description: > - Balancer Pool Token (BPT) daily price by pool on Balancer, an automated portfolio manager and trading platform. - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - blockchain - - day - - contract_address - columns: - - *blockchain - - &day - name: day - description: "Block date in UTC" - - *version - - &decimals - name: decimals - description: "Token decimals. 18, by default, on BPTs" - - *contract_address - - &bpt_price - name: bpt_price - description: "Price of the BPT" - - - name: balancer_v2_gnosis_bpt_supply - meta: - blockchain: gnosis - project: balancer_v2 - contributors: thetroyharris, viniabussafi - config: - tags: ['gnosis', 'bpt', 'supply'] - description: > - Balancer Pool Token (BPT) supply by pool on Balancer, an automated portfolio manager and trading platform. - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - day - - blockchain - - token_address - columns: - - *day - - &pool_type - name: pool_type - description: "Pool attributes, determined by the pool's factory" - - *version - - *blockchain - - &token_address - name: token_address - description: "Contract address of the BPT" - - &supply - name: supply - description: "Supply of the BPT, discounted of premints" - - - name: balancer_v2_gnosis_bpt_supply_changes - meta: - blockchain: gnosis - project: balancer_v2 - contributors: viniabussafi - config: - tags: ['gnosis', 'bpt', 'supply', 'changes'] - description: > - Balancer Pool Token (BPT) supply change events. - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - block_date - - evt_tx_hash - - evt_index - - label - columns: - - *block_date - - *evt_block_time - - *evt_block_number - - *blockchain - - *evt_tx_hash - - *evt_index - - *pool_type - - &pool_symbol - name: pool_symbol - description: "Token symbols, followed by their respective weights, if applicable" - - *version - - &label - name: label - description: "Nature of the transaction (Join/Exit via swap or Mint/Burn via transfer)" - - *token_address - - &delta_amount_raw - name: delta_amount_raw - description: "Raw value of the transaction on token supply at the time of execution in the original currency" - - &delta_amount - name: delta_amount - description: "Normalized value of the transaction on token supply at the time of execution in the original currency" - - - name: balancer_v2_gnosis_bpt_supply_changes_daily - meta: - blockchain: gnosis - project: balancer_v2 - contributors: viniabussafi - config: - tags: ['gnosis', 'bpt', 'supply', 'changes'] - description: > - Balancer Pool Token (BPT) supply change events. grouped by day - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - block_date - - blockchain - - token_address - columns: - - *block_date - - *blockchain - - *pool_type - - *pool_symbol - - *version - - *token_address - - &daily_delta - name: daily_delta - description: "Daily total impact on BPT supply" \ No newline at end of file diff --git a/models/_project/balancer/bpt/gnosis/balancer_v2_gnosis_bpt_supply_changes.sql b/models/_project/balancer/bpt/gnosis/balancer_v2_gnosis_bpt_supply_changes.sql deleted file mode 100644 index fd1539a9495..00000000000 --- a/models/_project/balancer/bpt/gnosis/balancer_v2_gnosis_bpt_supply_changes.sql +++ /dev/null @@ -1,20 +0,0 @@ -{% set blockchain = 'gnosis' %} - -{{ - config( - schema = 'balancer_v2_gnosis', - alias = 'bpt_supply_changes', - materialized = 'incremental', - file_format = 'delta', - incremental_strategy = 'merge', - unique_key = ['block_date', 'evt_tx_hash', 'evt_index', 'label'], - incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.evt_block_time')] - ) -}} - -{{ - bpt_supply_changes_macro( - blockchain = blockchain, - version = '2' - ) -}} \ No newline at end of file diff --git a/models/_project/balancer/bpt/gnosis/balancer_v2_gnosis_bpt_supply_changes_daily.sql b/models/_project/balancer/bpt/gnosis/balancer_v2_gnosis_bpt_supply_changes_daily.sql deleted file mode 100644 index 516f2e2dc0c..00000000000 --- a/models/_project/balancer/bpt/gnosis/balancer_v2_gnosis_bpt_supply_changes_daily.sql +++ /dev/null @@ -1,17 +0,0 @@ -{% set blockchain = 'gnosis' %} - -{{ - config( - schema = 'balancer_v2_gnosis', - alias = 'bpt_supply_changes_daily', - materialized = 'table', - file_format = 'delta' - ) -}} - -{{ - bpt_supply_changes_daily_agg_macro( - blockchain = blockchain, - version = '2' - ) -}} \ No newline at end of file diff --git a/models/_project/balancer/bpt/optimism/_schema.yml b/models/_project/balancer/bpt/optimism/_schema.yml deleted file mode 100644 index 746fd32e9da..00000000000 --- a/models/_project/balancer/bpt/optimism/_schema.yml +++ /dev/null @@ -1,178 +0,0 @@ -version: 2 - -models: - - name: balancer_v2_optimism_transfers_bpt - meta: - blockchain: optimism - project: balancer_v2 - contributors: victorstefenon, thetroyharris, viniabussafi - config: - tags: ['optimism', 'bpt', 'transfers'] - description: > - Balancer Pool Token (BPT) transfer logs on Balancer, an automated portfolio manager and trading platform, on optimism. - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - evt_tx_hash - - evt_index - - block_date - columns: - - &blockchain - name: blockchain - description: "Blockchain" - - &version - name: version - description: "Version of Balancer where the liquidity pool used in transaction is deployed" - - &contract_address - name: contract_address - description: 'optimism address for the liquidity pool used in transaction' - - &block_date - name: block_date - description: "UTC event block date of each DEX trade" - - &block_month - name: block_month - description: "UTC event block month of each DEX trade" - - &evt_tx_hash - name: evt_tx_hash - description: 'Transaction hash of transfer event' - - &evt_index - name: evt_index - description: 'Event index' - - &evt_block_time - name: evt_block_time - description: 'Block time of transfer event' - - &evt_block_number - name: evt_block_number - description: 'Block number of transfer event' - - &from - name: from - description: 'Address of BPT provider of transfer event' - - &to - name: to - description: 'Address of BPT receiver of transfer event' - - &value - name: value - description: 'Amount of BPT transferred in transfer event' - - - name: balancer_v2_optimism_bpt_prices - meta: - blockchain: optimism - project: balancer_v2 - contributors: victorstefenon, thetroyharris, viniabussafi - config: - tags: ['optimism', 'bpt', 'prices'] - description: > - Balancer Pool Token (BPT) daily price by pool on Balancer, an automated portfolio manager and trading platform. - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - blockchain - - day - - contract_address - columns: - - *blockchain - - &day - name: day - description: "Block date in UTC" - - *version - - &decimals - name: decimals - description: "Token decimals. 18, by default, on BPTs" - - *contract_address - - &bpt_price - name: bpt_price - description: "Price of the BPT" - - - name: balancer_v2_optimism_bpt_supply - meta: - blockchain: optimism - project: balancer_v2 - contributors: thetroyharris, viniabussafi - config: - tags: ['optimism', 'bpt', 'supply'] - description: > - Balancer Pool Token (BPT) supply by pool on Balancer, an automated portfolio manager and trading platform. - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - day - - blockchain - - token_address - columns: - - *day - - &pool_type - name: pool_type - description: "Pool attributes, determined by the pool's factory" - - *version - - *blockchain - - &token_address - name: token_address - description: "Contract address of the BPT" - - &supply - name: supply - description: "Supply of the BPT, discounted of premints" - - - name: balancer_v2_optimism_bpt_supply_changes - meta: - blockchain: optimism - project: balancer_v2 - contributors: viniabussafi - config: - tags: ['optimism', 'bpt', 'supply', 'changes'] - description: > - Balancer Pool Token (BPT) supply change events. - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - block_date - - evt_tx_hash - - evt_index - - label - columns: - - *block_date - - *evt_block_time - - *evt_block_number - - *blockchain - - *evt_tx_hash - - *evt_index - - *pool_type - - &pool_symbol - name: pool_symbol - description: "Token symbols, followed by their respective weights, if applicable" - - *version - - &label - name: label - description: "Nature of the transaction (Join/Exit via swap or Mint/Burn via transfer)" - - *token_address - - &delta_amount_raw - name: delta_amount_raw - description: "Raw value of the transaction on token supply at the time of execution in the original currency" - - &delta_amount - name: delta_amount - description: "Normalized value of the transaction on token supply at the time of execution in the original currency" - - - name: balancer_v2_optimism_bpt_supply_changes_daily - meta: - blockchain: optimism - project: balancer_v2 - contributors: viniabussafi - config: - tags: ['optimism', 'bpt', 'supply', 'changes'] - description: > - Balancer Pool Token (BPT) supply change events. grouped by day - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - block_date - - blockchain - - token_address - columns: - - *block_date - - *blockchain - - *pool_type - - *pool_symbol - - *version - - *token_address - - &daily_delta - name: daily_delta - description: "Daily total impact on BPT supply" \ No newline at end of file diff --git a/models/_project/balancer/bpt/optimism/balancer_v2_optimism_bpt_supply_changes.sql b/models/_project/balancer/bpt/optimism/balancer_v2_optimism_bpt_supply_changes.sql deleted file mode 100644 index 225b00465db..00000000000 --- a/models/_project/balancer/bpt/optimism/balancer_v2_optimism_bpt_supply_changes.sql +++ /dev/null @@ -1,20 +0,0 @@ -{% set blockchain = 'optimism' %} - -{{ - config( - schema = 'balancer_v2_optimism', - alias = 'bpt_supply_changes', - materialized = 'incremental', - file_format = 'delta', - incremental_strategy = 'merge', - unique_key = ['block_date', 'evt_tx_hash', 'evt_index', 'label'], - incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.evt_block_time')] - ) -}} - -{{ - bpt_supply_changes_macro( - blockchain = blockchain, - version = '2' - ) -}} \ No newline at end of file diff --git a/models/_project/balancer/bpt/optimism/balancer_v2_optimism_bpt_supply_changes_daily.sql b/models/_project/balancer/bpt/optimism/balancer_v2_optimism_bpt_supply_changes_daily.sql deleted file mode 100644 index f816df8d206..00000000000 --- a/models/_project/balancer/bpt/optimism/balancer_v2_optimism_bpt_supply_changes_daily.sql +++ /dev/null @@ -1,17 +0,0 @@ -{% set blockchain = 'optimism' %} - -{{ - config( - schema = 'balancer_v2_optimism', - alias = 'bpt_supply_changes_daily', - materialized = 'table', - file_format = 'delta' - ) -}} - -{{ - bpt_supply_changes_daily_agg_macro( - blockchain = blockchain, - version = '2' - ) -}} \ No newline at end of file diff --git a/models/_project/balancer/bpt/polygon/_schema.yml b/models/_project/balancer/bpt/polygon/_schema.yml deleted file mode 100644 index 3e0b5c419f6..00000000000 --- a/models/_project/balancer/bpt/polygon/_schema.yml +++ /dev/null @@ -1,178 +0,0 @@ -version: 2 - -models: - - name: balancer_v2_polygon_transfers_bpt - meta: - blockchain: polygon - project: balancer_v2 - contributors: victorstefenon, thetroyharris, viniabussafi - config: - tags: ['polygon', 'bpt', 'transfers'] - description: > - Balancer Pool Token (BPT) transfer logs on Balancer, an automated portfolio manager and trading platform, on polygon. - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - evt_tx_hash - - evt_index - - block_date - columns: - - &blockchain - name: blockchain - description: "Blockchain" - - &version - name: version - description: "Version of Balancer where the liquidity pool used in transaction is deployed" - - &contract_address - name: contract_address - description: 'polygon address for the liquidity pool used in transaction' - - &block_date - name: block_date - description: "UTC event block date of each DEX trade" - - &block_month - name: block_month - description: "UTC event block month of each DEX trade" - - &evt_tx_hash - name: evt_tx_hash - description: 'Transaction hash of transfer event' - - &evt_index - name: evt_index - description: 'Event index' - - &evt_block_time - name: evt_block_time - description: 'Block time of transfer event' - - &evt_block_number - name: evt_block_number - description: 'Block number of transfer event' - - &from - name: from - description: 'Address of BPT provider of transfer event' - - &to - name: to - description: 'Address of BPT receiver of transfer event' - - &value - name: value - description: 'Amount of BPT transferred in transfer event' - - - name: balancer_v2_polygon_bpt_prices - meta: - blockchain: polygon - project: balancer_v2 - contributors: victorstefenon, thetroyharris, viniabussafi - config: - tags: ['polygon', 'bpt', 'prices'] - description: > - Balancer Pool Token (BPT) daily price by pool on Balancer, an automated portfolio manager and trading platform. - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - blockchain - - day - - contract_address - columns: - - *blockchain - - &day - name: day - description: "Block date in UTC" - - *version - - &decimals - name: decimals - description: "Token decimals. 18, by default, on BPTs" - - *contract_address - - &bpt_price - name: bpt_price - description: "Price of the BPT" - - - name: balancer_v2_polygon_bpt_supply - meta: - blockchain: polygon - project: balancer_v2 - contributors: thetroyharris, viniabussafi - config: - tags: ['polygon', 'bpt', 'supply'] - description: > - Balancer Pool Token (BPT) supply by pool on Balancer, an automated portfolio manager and trading platform. - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - day - - blockchain - - token_address - columns: - - *day - - &pool_type - name: pool_type - description: "Pool attributes, determined by the pool's factory" - - *version - - *blockchain - - &token_address - name: token_address - description: "Contract address of the BPT" - - &supply - name: supply - description: "Supply of the BPT, discounted of premints" - - - name: balancer_v2_polygon_bpt_supply_changes - meta: - blockchain: polygon - project: balancer_v2 - contributors: viniabussafi - config: - tags: ['polygon', 'bpt', 'supply', 'changes'] - description: > - Balancer Pool Token (BPT) supply change events. - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - block_date - - evt_tx_hash - - evt_index - - label - columns: - - *block_date - - *evt_block_time - - *evt_block_number - - *blockchain - - *evt_tx_hash - - *evt_index - - *pool_type - - &pool_symbol - name: pool_symbol - description: "Token symbols, followed by their respective weights, if applicable" - - *version - - &label - name: label - description: "Nature of the transaction (Join/Exit via swap or Mint/Burn via transfer)" - - *token_address - - &delta_amount_raw - name: delta_amount_raw - description: "Raw value of the transaction on token supply at the time of execution in the original currency" - - &delta_amount - name: delta_amount - description: "Normalized value of the transaction on token supply at the time of execution in the original currency" - - - name: balancer_v2_polygon_bpt_supply_changes_daily - meta: - blockchain: polygon - project: balancer_v2 - contributors: viniabussafi - config: - tags: ['polygon', 'bpt', 'supply', 'changes'] - description: > - Balancer Pool Token (BPT) supply change events. grouped by day - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - block_date - - blockchain - - token_address - columns: - - *block_date - - *blockchain - - *pool_type - - *pool_symbol - - *version - - *token_address - - &daily_delta - name: daily_delta - description: "Daily total impact on BPT supply" \ No newline at end of file diff --git a/models/_project/balancer/bpt/polygon/balancer_v2_polygon_bpt_supply_changes.sql b/models/_project/balancer/bpt/polygon/balancer_v2_polygon_bpt_supply_changes.sql deleted file mode 100644 index 7ff8034b96b..00000000000 --- a/models/_project/balancer/bpt/polygon/balancer_v2_polygon_bpt_supply_changes.sql +++ /dev/null @@ -1,20 +0,0 @@ -{% set blockchain = 'polygon' %} - -{{ - config( - schema = 'balancer_v2_polygon', - alias = 'bpt_supply_changes', - materialized = 'incremental', - file_format = 'delta', - incremental_strategy = 'merge', - unique_key = ['block_date', 'evt_tx_hash', 'evt_index', 'label'], - incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.evt_block_time')] - ) -}} - -{{ - bpt_supply_changes_macro( - blockchain = blockchain, - version = '2' - ) -}} \ No newline at end of file diff --git a/models/_project/balancer/bpt/polygon/balancer_v2_polygon_bpt_supply_changes_daily.sql b/models/_project/balancer/bpt/polygon/balancer_v2_polygon_bpt_supply_changes_daily.sql deleted file mode 100644 index 57615beb139..00000000000 --- a/models/_project/balancer/bpt/polygon/balancer_v2_polygon_bpt_supply_changes_daily.sql +++ /dev/null @@ -1,17 +0,0 @@ -{% set blockchain = 'polygon' %} - -{{ - config( - schema = 'balancer_v2_polygon', - alias = 'bpt_supply_changes_daily', - materialized = 'table', - file_format = 'delta' - ) -}} - -{{ - bpt_supply_changes_daily_agg_macro( - blockchain = blockchain, - version = '2' - ) -}} \ No newline at end of file diff --git a/models/_project/balancer/bpt/zkevm/_schema.yml b/models/_project/balancer/bpt/zkevm/_schema.yml deleted file mode 100644 index fbdd80ddb56..00000000000 --- a/models/_project/balancer/bpt/zkevm/_schema.yml +++ /dev/null @@ -1,178 +0,0 @@ -version: 2 - -models: - - name: balancer_v2_zkevm_transfers_bpt - meta: - blockchain: zkevm - project: balancer_v2 - contributors: victorstefenon, thetroyharris, viniabussafi - config: - tags: ['zkevm', 'bpt', 'transfers'] - description: > - Balancer Pool Token (BPT) transfer logs on Balancer, an automated portfolio manager and trading platform, on zkevm. - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - evt_tx_hash - - evt_index - - block_date - columns: - - &blockchain - name: blockchain - description: "Blockchain" - - &version - name: version - description: "Version of Balancer where the liquidity pool used in transaction is deployed" - - &contract_address - name: contract_address - description: 'zkevm address for the liquidity pool used in transaction' - - &block_date - name: block_date - description: "UTC event block date of each DEX trade" - - &block_month - name: block_month - description: "UTC event block month of each DEX trade" - - &evt_tx_hash - name: evt_tx_hash - description: 'Transaction hash of transfer event' - - &evt_index - name: evt_index - description: 'Event index' - - &evt_block_time - name: evt_block_time - description: 'Block time of transfer event' - - &evt_block_number - name: evt_block_number - description: 'Block number of transfer event' - - &from - name: from - description: 'Address of BPT provider of transfer event' - - &to - name: to - description: 'Address of BPT receiver of transfer event' - - &value - name: value - description: 'Amount of BPT transferred in transfer event' - - - name: balancer_v2_zkevm_bpt_prices - meta: - blockchain: zkevm - project: balancer_v2 - contributors: victorstefenon, thetroyharris, viniabussafi - config: - tags: ['zkevm', 'bpt', 'prices'] - description: > - Balancer Pool Token (BPT) daily price by pool on Balancer, an automated portfolio manager and trading platform. - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - blockchain - - day - - contract_address - columns: - - *blockchain - - &day - name: day - description: "Block date in UTC" - - *version - - &decimals - name: decimals - description: "Token decimals. 18, by default, on BPTs" - - *contract_address - - &bpt_price - name: bpt_price - description: "Price of the BPT" - - - name: balancer_v2_zkevm_bpt_supply - meta: - blockchain: zkevm - project: balancer_v2 - contributors: thetroyharris, viniabussafi - config: - tags: ['zkevm', 'bpt', 'supply'] - description: > - Balancer Pool Token (BPT) supply by pool on Balancer, an automated portfolio manager and trading platform. - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - day - - blockchain - - token_address - columns: - - *day - - &pool_type - name: pool_type - description: "Pool attributes, determined by the pool's factory" - - *version - - *blockchain - - &token_address - name: token_address - description: "Contract address of the BPT" - - &supply - name: supply - description: "Supply of the BPT, discounted of premints" - - - name: balancer_v2_zkevm_bpt_supply_changes - meta: - blockchain: zkevm - project: balancer_v2 - contributors: viniabussafi - config: - tags: ['zkevm', 'bpt', 'supply', 'changes'] - description: > - Balancer Pool Token (BPT) supply change events. - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - block_date - - evt_tx_hash - - evt_index - - label - columns: - - *block_date - - *evt_block_time - - *evt_block_number - - *blockchain - - *evt_tx_hash - - *evt_index - - *pool_type - - &pool_symbol - name: pool_symbol - description: "Token symbols, followed by their respective weights, if applicable" - - *version - - &label - name: label - description: "Nature of the transaction (Join/Exit via swap or Mint/Burn via transfer)" - - *token_address - - &delta_amount_raw - name: delta_amount_raw - description: "Raw value of the transaction on token supply at the time of execution in the original currency" - - &delta_amount - name: delta_amount - description: "Normalized value of the transaction on token supply at the time of execution in the original currency" - - - name: balancer_v2_zkevm_bpt_supply_changes_daily - meta: - blockchain: zkevm - project: balancer_v2 - contributors: viniabussafi - config: - tags: ['zkevm', 'bpt', 'supply', 'changes'] - description: > - Balancer Pool Token (BPT) supply change events. grouped by day - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - block_date - - blockchain - - token_address - columns: - - *block_date - - *blockchain - - *pool_type - - *pool_symbol - - *version - - *token_address - - &daily_delta - name: daily_delta - description: "Daily total impact on BPT supply" \ No newline at end of file diff --git a/models/_project/balancer/bpt/zkevm/balancer_v2_zkevm_bpt_supply_changes.sql b/models/_project/balancer/bpt/zkevm/balancer_v2_zkevm_bpt_supply_changes.sql deleted file mode 100644 index f11227e4013..00000000000 --- a/models/_project/balancer/bpt/zkevm/balancer_v2_zkevm_bpt_supply_changes.sql +++ /dev/null @@ -1,20 +0,0 @@ -{% set blockchain = 'zkevm' %} - -{{ - config( - schema = 'balancer_v2_zkevm', - alias = 'bpt_supply_changes', - materialized = 'incremental', - file_format = 'delta', - incremental_strategy = 'merge', - unique_key = ['block_date', 'evt_tx_hash', 'evt_index', 'label'], - incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.evt_block_time')] - ) -}} - -{{ - bpt_supply_changes_macro( - blockchain = blockchain, - version = '2' - ) -}} \ No newline at end of file diff --git a/models/_project/balancer/bpt/zkevm/balancer_v2_zkevm_bpt_supply_changes_daily.sql b/models/_project/balancer/bpt/zkevm/balancer_v2_zkevm_bpt_supply_changes_daily.sql deleted file mode 100644 index 4e548f4bcf7..00000000000 --- a/models/_project/balancer/bpt/zkevm/balancer_v2_zkevm_bpt_supply_changes_daily.sql +++ /dev/null @@ -1,17 +0,0 @@ -{% set blockchain = 'zkevm' %} - -{{ - config( - schema = 'balancer_v2_zkevm', - alias = 'bpt_supply_changes_daily', - materialized = 'table', - file_format = 'delta' - ) -}} - -{{ - bpt_supply_changes_daily_agg_macro( - blockchain = blockchain, - version = '2' - ) -}} \ No newline at end of file diff --git a/models/_project/balancer/flashloans/_schema.yml b/models/_project/balancer/flashloans/_schema.yml deleted file mode 100644 index 948574c1ad6..00000000000 --- a/models/_project/balancer/flashloans/_schema.yml +++ /dev/null @@ -1,35 +0,0 @@ -version: 2 - -models: - - name: balancer_flashloans - meta: - blockchain: arbitrum, avalanche_c, base, ethereum, gnosis, optimism, polygon, zkevm - sector: lending - contributors: hildobby, viniabussafi - config: - tags: ['ethereum', 'arbitrum', 'optimism', 'polygon', 'gnosis','avalanche_c', 'base', 'zkevm', 'flashloans'] - description: > - All Balancer flashloans - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - blockchain - - tx_hash - - evt_index - columns: - - name: blockchain - - name: project - - name: version - - name: block_time - - name: block_month - - name: block_number - - name: amount - - name: amount_usd - - name: tx_hash - - name: evt_index - - name: fee - - name: currency_contract - - name: currency_symbol - - name: recipient - - name: contract_address - \ No newline at end of file diff --git a/models/_project/balancer/flashloans/arbitrum/_schema.yml b/models/_project/balancer/flashloans/arbitrum/_schema.yml deleted file mode 100644 index 562e948bde1..00000000000 --- a/models/_project/balancer/flashloans/arbitrum/_schema.yml +++ /dev/null @@ -1,36 +0,0 @@ -version: 2 - -models: - - name: balancer_v2_arbitrum_flashloans - meta: - blockchain: arbitrum - sector: lending - contributors: hildobby, viniabussafi - config: - tags: ['arbitrum', 'flashloans'] - description: > - All Balancer v2 flashloans on Arbitrum - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - blockchain - - tx_hash - - evt_index - columns: - - name: blockchain - - name: project - - name: version - - name: block_time - - name: block_number - - name: amount - - name: amount_usd - - &tx_hash - name: tx_hash - description: "Tx. Hash" - - name: evt_index - - name: fee - - name: currency_contract - - name: currency_symbol - - name: recipient - - name: contract_address - - name: block_month \ No newline at end of file diff --git a/models/_project/balancer/flashloans/avalanche_c/_schema.yml b/models/_project/balancer/flashloans/avalanche_c/_schema.yml deleted file mode 100644 index 6a0a0a719f3..00000000000 --- a/models/_project/balancer/flashloans/avalanche_c/_schema.yml +++ /dev/null @@ -1,36 +0,0 @@ -version: 2 - -models: - - name: balancer_v2_avalanche_c_flashloans - meta: - blockchain: avalanche_c - sector: lending - contributors: hildobby, viniabussafi - config: - tags: ['avalanche_c', 'flashloans'] - description: > - All Balancer v2 flashloans on avalanche_c - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - blockchain - - tx_hash - - evt_index - columns: - - name: blockchain - - name: project - - name: version - - name: block_time - - name: block_number - - name: amount - - name: amount_usd - - &tx_hash - name: tx_hash - description: "Tx. Hash" - - name: evt_index - - name: fee - - name: currency_contract - - name: currency_symbol - - name: recipient - - name: contract_address - - name: block_month \ No newline at end of file diff --git a/models/_project/balancer/flashloans/base/_schema.yml b/models/_project/balancer/flashloans/base/_schema.yml deleted file mode 100644 index 3664ca0dbb5..00000000000 --- a/models/_project/balancer/flashloans/base/_schema.yml +++ /dev/null @@ -1,36 +0,0 @@ -version: 2 - -models: - - name: balancer_v2_base_flashloans - meta: - blockchain: base - sector: lending - contributors: hildobby, viniabussafi - config: - tags: ['base', 'flashloans'] - description: > - All Balancer v2 flashloans on base - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - blockchain - - tx_hash - - evt_index - columns: - - name: blockchain - - name: project - - name: version - - name: block_time - - name: block_number - - name: amount - - name: amount_usd - - &tx_hash - name: tx_hash - description: "Tx. Hash" - - name: evt_index - - name: fee - - name: currency_contract - - name: currency_symbol - - name: recipient - - name: contract_address - - name: block_month \ No newline at end of file diff --git a/models/_project/balancer/flashloans/ethereum/_schema.yml b/models/_project/balancer/flashloans/ethereum/_schema.yml deleted file mode 100644 index 48e15def9f8..00000000000 --- a/models/_project/balancer/flashloans/ethereum/_schema.yml +++ /dev/null @@ -1,36 +0,0 @@ -version: 2 - -models: - - name: balancer_v2_ethereum_flashloans - meta: - blockchain: ethereum - sector: lending - contributors: hildobby, viniabussafi - config: - tags: ['ethereum', 'flashloans'] - description: > - All Balancer v2 flashloans on ethereum - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - blockchain - - tx_hash - - evt_index - columns: - - name: blockchain - - name: project - - name: version - - name: block_time - - name: block_number - - name: amount - - name: amount_usd - - &tx_hash - name: tx_hash - description: "Tx. Hash" - - name: evt_index - - name: fee - - name: currency_contract - - name: currency_symbol - - name: recipient - - name: contract_address - - name: block_month \ No newline at end of file diff --git a/models/_project/balancer/flashloans/gnosis/_schema.yml b/models/_project/balancer/flashloans/gnosis/_schema.yml deleted file mode 100644 index a7db5e36011..00000000000 --- a/models/_project/balancer/flashloans/gnosis/_schema.yml +++ /dev/null @@ -1,36 +0,0 @@ -version: 2 - -models: - - name: balancer_v2_gnosis_flashloans - meta: - blockchain: gnosis - sector: lending - contributors: hildobby, viniabussafi - config: - tags: ['gnosis', 'flashloans'] - description: > - All Balancer v2 flashloans on gnosis - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - blockchain - - tx_hash - - evt_index - columns: - - name: blockchain - - name: project - - name: version - - name: block_time - - name: block_number - - name: amount - - name: amount_usd - - &tx_hash - name: tx_hash - description: "Tx. Hash" - - name: evt_index - - name: fee - - name: currency_contract - - name: currency_symbol - - name: recipient - - name: contract_address - - name: block_month \ No newline at end of file diff --git a/models/_project/balancer/flashloans/optimism/_schema.yml b/models/_project/balancer/flashloans/optimism/_schema.yml deleted file mode 100644 index 64a96dc514f..00000000000 --- a/models/_project/balancer/flashloans/optimism/_schema.yml +++ /dev/null @@ -1,36 +0,0 @@ -version: 2 - -models: - - name: balancer_v2_optimism_flashloans - meta: - blockchain: optimism - sector: lending - contributors: hildobby, viniabussafi - config: - tags: ['optimism', 'flashloans'] - description: > - All Balancer v2 flashloans on optimism - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - blockchain - - tx_hash - - evt_index - columns: - - name: blockchain - - name: project - - name: version - - name: block_time - - name: block_number - - name: amount - - name: amount_usd - - &tx_hash - name: tx_hash - description: "Tx. Hash" - - name: evt_index - - name: fee - - name: currency_contract - - name: currency_symbol - - name: recipient - - name: contract_address - - name: block_month \ No newline at end of file diff --git a/models/_project/balancer/flashloans/polygon/_schema.yml b/models/_project/balancer/flashloans/polygon/_schema.yml deleted file mode 100644 index 305a7252c6c..00000000000 --- a/models/_project/balancer/flashloans/polygon/_schema.yml +++ /dev/null @@ -1,36 +0,0 @@ -version: 2 - -models: - - name: balancer_v2_polygon_flashloans - meta: - blockchain: polygon - sector: lending - contributors: hildobby, viniabussafi - config: - tags: ['polygon', 'flashloans'] - description: > - All Balancer v2 flashloans on polygon - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - blockchain - - tx_hash - - evt_index - columns: - - name: blockchain - - name: project - - name: version - - name: block_time - - name: block_number - - name: amount - - name: amount_usd - - &tx_hash - name: tx_hash - description: "Tx. Hash" - - name: evt_index - - name: fee - - name: currency_contract - - name: currency_symbol - - name: recipient - - name: contract_address - - name: block_month \ No newline at end of file diff --git a/models/_project/balancer/flashloans/zkevm/_schema.yml b/models/_project/balancer/flashloans/zkevm/_schema.yml deleted file mode 100644 index feb6c20d41b..00000000000 --- a/models/_project/balancer/flashloans/zkevm/_schema.yml +++ /dev/null @@ -1,36 +0,0 @@ -version: 2 - -models: - - name: balancer_v2_zkevm_flashloans - meta: - blockchain: zkevm - sector: lending - contributors: hildobby, viniabussafi - config: - tags: ['zkevm', 'flashloans'] - description: > - All Balancer v2 flashloans on zkevm - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - blockchain - - tx_hash - - evt_index - columns: - - name: blockchain - - name: project - - name: version - - name: block_time - - name: block_number - - name: amount - - name: amount_usd - - &tx_hash - name: tx_hash - description: "Tx. Hash" - - name: evt_index - - name: fee - - name: currency_contract - - name: currency_symbol - - name: recipient - - name: contract_address - - name: block_month \ No newline at end of file diff --git a/models/_project/balancer/liquidity/_schema.yml b/models/_project/balancer/liquidity/_schema.yml deleted file mode 100644 index b014ad151e4..00000000000 --- a/models/_project/balancer/liquidity/_schema.yml +++ /dev/null @@ -1,60 +0,0 @@ -version: 2 - -models: - - name: balancer_liquidity - meta: - blockchain: arbitrum, avalanche_c, base, ethereum, gnosis, optimism, polygon, zkevm - project: balancer - contributors: viniabussafi - config: - tags: ['balancer', 'amm', 'dex', 'liquidity', 'ethereum', 'arbitrum', 'optimism', 'polygon', 'avalanche_c', 'base', 'zkevm'] - description: > - Liquidity by token on Balancer, an automated portfolio manager and trading platform. - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - day - - pool_id - - blockchain - - token_address - - token_symbol - columns: - - &day - name: day - description: "Block date in UTC" - - &pool_id - name: pool_id - description: "Unique encoded identifier that refers to each pool" - - &pool_address - name: pool_address - description: "Pool address" - - &pool_symbol - name: pool_symbol - description: "Token symbols, followed by their respective weights, if applicable" - - &version - name: version - description: "Version of the project" - - &blockchain - name: blockchain - description: "Blockchain" - - &pool_type - name: pool_type - description: "Pool attributes, determined by the pool's factory" - - &token_address - name: token_address - description: "Contract address of the token" - - &token_symbol - name: token_symbol - description: "Token symbol" - - name: token_balance_raw - description: 'Raw balance of the token in the pool in the original currency' - - name: token_balance - description: 'Scaled balance of the token in the pool in the original currency' - - name: protocol_liquidity_usd - description: 'Liquidity of the token in the pool in USD, except BPTs' - - name: protocol_liquidity_eth - description: 'Liquidity of the token in the pool in ETH, except BPTs' - - name: pool_liquidity_usd - description: 'Liquidity of the token in the pool in USD, including BPTs' - - name: pool_liquidity_eth - description: 'Liquidity of the token in the pool in ETH, including BPTs' \ No newline at end of file diff --git a/models/_project/balancer/liquidity/arbitrum/_schema.yml b/models/_project/balancer/liquidity/arbitrum/_schema.yml deleted file mode 100644 index ca88eb050b8..00000000000 --- a/models/_project/balancer/liquidity/arbitrum/_schema.yml +++ /dev/null @@ -1,58 +0,0 @@ -version: 2 - -models: - - name: balancer_v2_arbitrum_liquidity - meta: - blockchain: arbitrum - project: balancer_v2 - contributors: victorstefenon, viniabussafi, thetroyharris - config: - tags: ['arbitrum', 'balancer', 'pools', 'liquidity'] - description: > - Balancer v2 pools liquidity by token in Arbitrum. - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - day - - pool_id - - token_address - columns: - - &day - name: day - description: "Block date in UTC" - - &pool_id - name: pool_id - description: "Unique encoded identifier that refers to each pool" - - &pool_address - name: pool_address - description: "Pool address" - - &pool_symbol - name: pool_symbol - description: "Token symbols, followed by their respective weights, if applicable" - - &version - name: version - description: "Version of the project" - - &blockchain - name: blockchain - description: "Blockchain" - - &pool_type - name: pool_type - description: "Pool attributes, determined by the pool's factory" - - &token_address - name: token_address - description: "Contract address of the token" - - &token_symbol - name: token_symbol - description: "Token symbol" - - name: token_balance_raw - description: 'Raw balance of the token in the pool in the original currency' - - name: token_balance - description: 'Scaled balance of the token in the pool in the original currency' - - name: protocol_liquidity_usd - description: 'Liquidity of the token in the pool in USD, except BPTs' - - name: protocol_liquidity_eth - description: 'Liquidity of the token in the pool in ETH, except BPTs' - - name: pool_liquidity_usd - description: 'Liquidity of the token in the pool in USD, including BPTs' - - name: pool_liquidity_eth - description: 'Liquidity of the token in the pool in ETH, including BPTs' \ No newline at end of file diff --git a/models/_project/balancer/liquidity/avalanche_c/_schema.yml b/models/_project/balancer/liquidity/avalanche_c/_schema.yml deleted file mode 100644 index cd5e9580b08..00000000000 --- a/models/_project/balancer/liquidity/avalanche_c/_schema.yml +++ /dev/null @@ -1,58 +0,0 @@ -version: 2 - -models: - - name: balancer_v2_avalanche_c_liquidity - meta: - blockchain: avalanche_c - project: balancer_v2 - contributors: victorstefenon, viniabussafi, thetroyharris - config: - tags: ['avalanche_c', 'balancer', 'pools', 'liquidity'] - description: > - Balancer v2 pools liquidity by token in Arbitrum. - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - day - - pool_id - - token_address - columns: - - &day - name: day - description: "Block date in UTC" - - &pool_id - name: pool_id - description: "Unique encoded identifier that refers to each pool" - - &pool_address - name: pool_address - description: "Pool address" - - &pool_symbol - name: pool_symbol - description: "Token symbols, followed by their respective weights, if applicable" - - &version - name: version - description: "Version of the project" - - &blockchain - name: blockchain - description: "Blockchain" - - &pool_type - name: pool_type - description: "Pool attributes, determined by the pool's factory" - - &token_address - name: token_address - description: "Contract address of the token" - - &token_symbol - name: token_symbol - description: "Token symbol" - - name: token_balance_raw - description: 'Raw balance of the token in the pool in the original currency' - - name: token_balance - description: 'Scaled balance of the token in the pool in the original currency' - - name: protocol_liquidity_usd - description: 'Liquidity of the token in the pool in USD, except BPTs' - - name: protocol_liquidity_eth - description: 'Liquidity of the token in the pool in ETH, except BPTs' - - name: pool_liquidity_usd - description: 'Liquidity of the token in the pool in USD, including BPTs' - - name: pool_liquidity_eth - description: 'Liquidity of the token in the pool in ETH, including BPTs' \ No newline at end of file diff --git a/models/_project/balancer/liquidity/base/_schema.yml b/models/_project/balancer/liquidity/base/_schema.yml deleted file mode 100644 index d4b57b38164..00000000000 --- a/models/_project/balancer/liquidity/base/_schema.yml +++ /dev/null @@ -1,58 +0,0 @@ -version: 2 - -models: - - name: balancer_v2_base_liquidity - meta: - blockchain: base - project: balancer_v2 - contributors: victorstefenon, viniabussafi, thetroyharris - config: - tags: ['base', 'balancer', 'pools', 'liquidity'] - description: > - Balancer v2 pools liquidity by token in Arbitrum. - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - day - - pool_id - - token_address - columns: - - &day - name: day - description: "Block date in UTC" - - &pool_id - name: pool_id - description: "Unique encoded identifier that refers to each pool" - - &pool_address - name: pool_address - description: "Pool address" - - &pool_symbol - name: pool_symbol - description: "Token symbols, followed by their respective weights, if applicable" - - &version - name: version - description: "Version of the project" - - &blockchain - name: blockchain - description: "Blockchain" - - &pool_type - name: pool_type - description: "Pool attributes, determined by the pool's factory" - - &token_address - name: token_address - description: "Contract address of the token" - - &token_symbol - name: token_symbol - description: "Token symbol" - - name: token_balance_raw - description: 'Raw balance of the token in the pool in the original currency' - - name: token_balance - description: 'Scaled balance of the token in the pool in the original currency' - - name: protocol_liquidity_usd - description: 'Liquidity of the token in the pool in USD, except BPTs' - - name: protocol_liquidity_eth - description: 'Liquidity of the token in the pool in ETH, except BPTs' - - name: pool_liquidity_usd - description: 'Liquidity of the token in the pool in USD, including BPTs' - - name: pool_liquidity_eth - description: 'Liquidity of the token in the pool in ETH, including BPTs' \ No newline at end of file diff --git a/models/_project/balancer/liquidity/ethereum/_schema.yml b/models/_project/balancer/liquidity/ethereum/_schema.yml deleted file mode 100644 index 42866a2e449..00000000000 --- a/models/_project/balancer/liquidity/ethereum/_schema.yml +++ /dev/null @@ -1,96 +0,0 @@ -version: 2 - -models: - - name: balancer_v2_ethereum_liquidity - meta: - blockchain: ethereum - project: balancer_v2 - contributors: victorstefenon, viniabussafi, thetroyharris - config: - tags: ['ethereum', 'balancer', 'pools', 'liquidity'] - description: > - Balancer v2 pools liquidity by token in Ethereum. - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - day - - pool_id - - token_address - columns: - - &day - name: day - description: "Block date in UTC" - - &pool_id - name: pool_id - description: "Unique encoded identifier that refers to each pool" - - &pool_address - name: pool_address - description: "Pool address" - - &pool_symbol - name: pool_symbol - description: "Token symbols, followed by their respective weights, if applicable" - - &version - name: version - description: "Version of the project" - - &blockchain - name: blockchain - description: "Blockchain" - - &pool_type - name: pool_type - description: "Pool attributes, determined by the pool's factory" - - &token_address - name: token_address - description: "Contract address of the token" - - &token_symbol - name: token_symbol - description: "Token symbol" - - &token_balance_raw - name: token_balance_raw - description: 'Raw balance of the token in the pool in the original currency' - - &token_balance - name: token_balance - description: 'Scaled balance of the token in the pool in the original currency' - - &protocol_liquidity_usd - name: protocol_liquidity_usd - description: 'Liquidity of the token in the pool in USD, except BPTs' - - &protocol_liquidity_eth - name: protocol_liquidity_eth - description: 'Liquidity of the token in the pool in ETH, except BPTs' - - &pool_liquidity_usd - name: pool_liquidity_usd - description: 'Liquidity of the token in the pool in USD, including BPTs' - - &pool_liquidity_eth - name: pool_liquidity_eth - description: 'Liquidity of the token in the pool in ETH, including BPTs' - - - name: balancer_v1_ethereum_liquidity - meta: - blockchain: ethereum - project: balancer_v1 - contributors: markusbkoch, mendesfabio, victorstefenon, viniabussafi, thetroyharris - config: - tags: ['ethereum', 'balancer', 'pools', 'liquidity'] - description: > - Balancer v1 pools liquidity by token in Ethereum. - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - day - - pool_id - - token_address - columns: - - *day - - *pool_id - - *pool_address - - *pool_symbol - - *version - - *blockchain - - *pool_type - - *token_address - - *token_symbol - - *token_balance_raw - - *token_balance - - *protocol_liquidity_usd - - *protocol_liquidity_eth - - *pool_liquidity_usd - - *pool_liquidity_eth \ No newline at end of file diff --git a/models/_project/balancer/liquidity/gnosis/_schema.yml b/models/_project/balancer/liquidity/gnosis/_schema.yml deleted file mode 100644 index d21460430ab..00000000000 --- a/models/_project/balancer/liquidity/gnosis/_schema.yml +++ /dev/null @@ -1,58 +0,0 @@ -version: 2 - -models: - - name: balancer_v2_gnosis_liquidity - meta: - blockchain: gnosis - project: balancer_v2 - contributors: victorstefenon, viniabussafi, thetroyharris - config: - tags: ['gnosis', 'balancer', 'pools', 'liquidity'] - description: > - Balancer v2 pools liquidity by token in Arbitrum. - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - day - - pool_id - - token_address - columns: - - &day - name: day - description: "Block date in UTC" - - &pool_id - name: pool_id - description: "Unique encoded identifier that refers to each pool" - - &pool_address - name: pool_address - description: "Pool address" - - &pool_symbol - name: pool_symbol - description: "Token symbols, followed by their respective weights, if applicable" - - &version - name: version - description: "Version of the project" - - &blockchain - name: blockchain - description: "Blockchain" - - &pool_type - name: pool_type - description: "Pool attributes, determined by the pool's factory" - - &token_address - name: token_address - description: "Contract address of the token" - - &token_symbol - name: token_symbol - description: "Token symbol" - - name: token_balance_raw - description: 'Raw balance of the token in the pool in the original currency' - - name: token_balance - description: 'Scaled balance of the token in the pool in the original currency' - - name: protocol_liquidity_usd - description: 'Liquidity of the token in the pool in USD, except BPTs' - - name: protocol_liquidity_eth - description: 'Liquidity of the token in the pool in ETH, except BPTs' - - name: pool_liquidity_usd - description: 'Liquidity of the token in the pool in USD, including BPTs' - - name: pool_liquidity_eth - description: 'Liquidity of the token in the pool in ETH, including BPTs' \ No newline at end of file diff --git a/models/_project/balancer/liquidity/optimism/_schema.yml b/models/_project/balancer/liquidity/optimism/_schema.yml deleted file mode 100644 index d41d2cb3e49..00000000000 --- a/models/_project/balancer/liquidity/optimism/_schema.yml +++ /dev/null @@ -1,58 +0,0 @@ -version: 2 - -models: - - name: balancer_v2_optimism_liquidity - meta: - blockchain: optimism - project: balancer_v2 - contributors: victorstefenon, viniabussafi, thetroyharris - config: - tags: ['optimism', 'balancer', 'pools', 'liquidity'] - description: > - Balancer v2 pools liquidity by token in Arbitrum. - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - day - - pool_id - - token_address - columns: - - &day - name: day - description: "Block date in UTC" - - &pool_id - name: pool_id - description: "Unique encoded identifier that refers to each pool" - - &pool_address - name: pool_address - description: "Pool address" - - &pool_symbol - name: pool_symbol - description: "Token symbols, followed by their respective weights, if applicable" - - &version - name: version - description: "Version of the project" - - &blockchain - name: blockchain - description: "Blockchain" - - &pool_type - name: pool_type - description: "Pool attributes, determined by the pool's factory" - - &token_address - name: token_address - description: "Contract address of the token" - - &token_symbol - name: token_symbol - description: "Token symbol" - - name: token_balance_raw - description: 'Raw balance of the token in the pool in the original currency' - - name: token_balance - description: 'Scaled balance of the token in the pool in the original currency' - - name: protocol_liquidity_usd - description: 'Liquidity of the token in the pool in USD, except BPTs' - - name: protocol_liquidity_eth - description: 'Liquidity of the token in the pool in ETH, except BPTs' - - name: pool_liquidity_usd - description: 'Liquidity of the token in the pool in USD, including BPTs' - - name: pool_liquidity_eth - description: 'Liquidity of the token in the pool in ETH, including BPTs' \ No newline at end of file diff --git a/models/_project/balancer/liquidity/polygon/_schema.yml b/models/_project/balancer/liquidity/polygon/_schema.yml deleted file mode 100644 index 5054f2a9740..00000000000 --- a/models/_project/balancer/liquidity/polygon/_schema.yml +++ /dev/null @@ -1,58 +0,0 @@ -version: 2 - -models: - - name: balancer_v2_polygon_liquidity - meta: - blockchain: polygon - project: balancer_v2 - contributors: victorstefenon, viniabussafi, thetroyharris - config: - tags: ['polygon', 'balancer', 'pools', 'liquidity'] - description: > - Balancer v2 pools liquidity by token in Arbitrum. - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - day - - pool_id - - token_address - columns: - - &day - name: day - description: "Block date in UTC" - - &pool_id - name: pool_id - description: "Unique encoded identifier that refers to each pool" - - &pool_address - name: pool_address - description: "Pool address" - - &pool_symbol - name: pool_symbol - description: "Token symbols, followed by their respective weights, if applicable" - - &version - name: version - description: "Version of the project" - - &blockchain - name: blockchain - description: "Blockchain" - - &pool_type - name: pool_type - description: "Pool attributes, determined by the pool's factory" - - &token_address - name: token_address - description: "Contract address of the token" - - &token_symbol - name: token_symbol - description: "Token symbol" - - name: token_balance_raw - description: 'Raw balance of the token in the pool in the original currency' - - name: token_balance - description: 'Scaled balance of the token in the pool in the original currency' - - name: protocol_liquidity_usd - description: 'Liquidity of the token in the pool in USD, except BPTs' - - name: protocol_liquidity_eth - description: 'Liquidity of the token in the pool in ETH, except BPTs' - - name: pool_liquidity_usd - description: 'Liquidity of the token in the pool in USD, including BPTs' - - name: pool_liquidity_eth - description: 'Liquidity of the token in the pool in ETH, including BPTs' \ No newline at end of file diff --git a/models/_project/balancer/liquidity/zkevm/_schema.yml b/models/_project/balancer/liquidity/zkevm/_schema.yml deleted file mode 100644 index 67f36eb3b21..00000000000 --- a/models/_project/balancer/liquidity/zkevm/_schema.yml +++ /dev/null @@ -1,58 +0,0 @@ -version: 2 - -models: - - name: balancer_v2_zkevm_liquidity - meta: - blockchain: zkevm - project: balancer_v2 - contributors: victorstefenon, viniabussafi, thetroyharris - config: - tags: ['zkevm', 'balancer', 'pools', 'liquidity'] - description: > - Balancer v2 pools liquidity by token in Arbitrum. - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - day - - pool_id - - token_address - columns: - - &day - name: day - description: "Block date in UTC" - - &pool_id - name: pool_id - description: "Unique encoded identifier that refers to each pool" - - &pool_address - name: pool_address - description: "Pool address" - - &pool_symbol - name: pool_symbol - description: "Token symbols, followed by their respective weights, if applicable" - - &version - name: version - description: "Version of the project" - - &blockchain - name: blockchain - description: "Blockchain" - - &pool_type - name: pool_type - description: "Pool attributes, determined by the pool's factory" - - &token_address - name: token_address - description: "Contract address of the token" - - &token_symbol - name: token_symbol - description: "Token symbol" - - name: token_balance_raw - description: 'Raw balance of the token in the pool in the original currency' - - name: token_balance - description: 'Scaled balance of the token in the pool in the original currency' - - name: protocol_liquidity_usd - description: 'Liquidity of the token in the pool in USD, except BPTs' - - name: protocol_liquidity_eth - description: 'Liquidity of the token in the pool in ETH, except BPTs' - - name: pool_liquidity_usd - description: 'Liquidity of the token in the pool in USD, including BPTs' - - name: pool_liquidity_eth - description: 'Liquidity of the token in the pool in ETH, including BPTs' \ No newline at end of file diff --git a/models/_project/balancer/pools/_schema.yml b/models/_project/balancer/pools/_schema.yml deleted file mode 100644 index 65c86555a7c..00000000000 --- a/models/_project/balancer/pools/_schema.yml +++ /dev/null @@ -1,173 +0,0 @@ -version: 2 - -models: - - name: balancer_pools_fees - meta: - blockchain: arbitrum, avalanche_c, base, ethereum, gnosis, optimism, polygon, zkevm - contributors: jacektrocinski, thetroyharris, viniabussafi - config: - tags: ['arbitrum', 'avalanche_c', 'base', 'ethereum', 'gnosis', 'optimism', 'polygon', 'zkevm', 'pools', 'fees'] - description: > - Balancer v2 swap fees stored at the pool level. - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - blockchain - - block_number - - tx_hash - - index - columns: - - &blockchain - name: blockchain - description: "Blockchain" - - &version - name: version - description: "Version of Balancer where the liquidity pool used in transaction is deployed" - - &contract_address - name: contract_address - description: 'zkevm address for the liquidity pool used in transaction' - tests: - - not_null - - &tx_hash - name: tx_hash - description: 'Transaction hash' - tests: - - not_null - - &index - name: index - description: 'Event Index' - tests: - - not_null - - &tx_index - name: tx_index - description: 'Transaction Index' - tests: - - not_null - - &block_time - name: block_time - description: 'Block time in UTC' - tests: - - not_null - - &block_number - name: block_number - description: 'Event Block Number' - tests: - - not_null - - &swap_fee_percentage - name: swap_fee_percentage - description: 'Swap fees for the pool, values are returned with 18 decimals (1e18 meaning 100%)' - tests: - - not_null - - - name: balancer_pools_tokens_weights - meta: - blockchain: arbitrum, avalanche_c, base, ethereum, gnosis, optimism, polygon, 'zkevm' - contributors: jacektrocinski, viniabussafi - config: - tags: ['arbitrum', 'avalanche_c', 'base', 'ethereum', 'gnosis', 'optimism', 'polygon', 'zkevm', 'bpt', 'transfers'] - description: > - Token weights in Balancer pools. - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - blockchain - - pool_id - - token_address - columns: - - *blockchain - - *version - - &pool_id - name: pool_id - description: 'Unique encoded identifier that refers to each pool' - tests: - - not_null - - &token_address - name: token_address - description: 'Contract address for the token' - - &normalized_weight - name: normalized_weight - description: 'Weight of the token in the pool.' - - - - name: balancer_pools_metrics_daily - meta: - blockchain: arbitrum, avalanche_c, base, ethereum, gnosis, optimism, polygon, zkevm - contributors: viniabussafi, metacrypto - config: - tags: ['arbitrum', 'avalanche_c', 'base', 'ethereum', 'gnosis', 'optimism', 'polygon', 'zkevm', 'balancer', 'pool', 'stats', 'volume', 'tvl', 'fee'] - description: > - This spell aggregates data from the trades, liquidity and protocol fees spells, by day and pool, while also displaying some basic information about the pool - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - block_date - - blockchain - - project - - version - - project_contract_address - columns: - - *blockchain - - &project - name: project - description: "Project name (balancer)" - - *version - - &block_date - name: block_date - description: "Block date in UTC" - - &project_contract_address - name: project_contract_address - description: "Pool address" - - &pool_symbol - name: pool_symbol - description: "Token symbols, followed by their respective weights, if applicable" - - &pool_type - name: pool_type - description: "Pool attributes, determined by the pool's factory" - - &swap_amount_usd - name: swap_amount_usd - description: "Daily swap volume on a pool, in USD" - - &tvl_usd - name: tvl_usd - description: "Total Value Locked on a pool, in USD" - - &tvl_eth - name: tvl_eth - description: "Total Value Locked on a pool, in eth" - - &fee_amount_usd - name: fee_amount_usd - description: "Daily fees collected on a pool, in USD" - - - name: balancer_gauge_mappings - meta: - blockchain: optimism - sector: dex - contributors: msilb7 - config: - tags: ['balancer', 'amm', 'trades', 'dex', 'incentives'] - description: > - Gauge to Pool mappings for balancer on all chains - columns: - - *blockchain - - *version - - &pool_contract - name: pool_contract - description: "Address of the liquidity pool contract" - - *pool_id - - &incentives_contract - name: incentives_contract - description: "Address of the contract where incentives are stored and emitted." - - &incentives_type - name: incentives_type - description: "Description of the incentives address type." - - &evt_block_time - name: evt_block_time - description: "Block time in UTC" - - &evt_block_number - name: evt_block_number - description: 'Event Block Number' - - *contract_address - - &evt_tx_hash - name: evt_tx_hash - description: 'Transaction hash' - - &evt_index - name: evT_index - description: 'Event Index' \ No newline at end of file diff --git a/models/_project/balancer/pools/arbitrum/_schema.yml b/models/_project/balancer/pools/arbitrum/_schema.yml deleted file mode 100644 index fd04cb90077..00000000000 --- a/models/_project/balancer/pools/arbitrum/_schema.yml +++ /dev/null @@ -1,105 +0,0 @@ -version: 2 - -models: - - name: balancer_v2_arbitrum_pools_fees - meta: - blockchain: arbitrum - project: balancer_v2 - contributors: jacektrocinski, thetroyharris, viniabussafi - config: - tags: ['arbitrum', 'balancer', 'pools_fees'] - description: > - Balancer v2 swap fees stored at the pool level. - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - block_number - - tx_hash - - index - columns: - - &blockchain - name: blockchain - description: "Blockchain" - - &version - name: version - description: "Version of Balancer where the liquidity pool used in transaction is deployed" - - &contract_address - name: contract_address - description: 'Arbitrum address for the liquidity pool used in transaction' - tests: - - not_null - - &tx_hash - name: tx_hash - description: 'Transaction hash' - tests: - - not_null - - &index - name: index - description: 'Event Index' - tests: - - not_null - - &tx_index - name: tx_index - description: 'Transaction Index' - tests: - - not_null - - &block_time - name: block_time - description: 'Block time in UTC' - tests: - - not_null - - &block_number - name: block_number - description: 'Event Block Number' - tests: - - not_null - - &swap_fee_percentage - name: swap_fee_percentage - description: 'Swap fees for the pool, values are returned with 18 decimals (1e18 meaning 100%)' - tests: - - not_null - - - name: balancer_arbitrum_pools_tokens_weights - meta: - blockchain: arbitrum - project: balancer - contributors: jacektrocinski, viniabussafi - config: - tags: ['arbitrum', 'balancer', 'pools', 'tokens', 'weights'] - description: > - Token weights in Balancer pools. - columns: - - *blockchain - - *version - - &pool_id - name: pool_id - description: 'Unique encoded identifier that refers to each pool' - tests: - - not_null - - &token_address - name: token_address - description: 'Contract address for the token' - - &normalized_weight - name: normalized_weight - description: 'Weight of the token in the pool.' - - - name: balancer_v2_arbitrum_pools_tokens_weights - meta: - blockchain: arbitrum - project: balancer - contributors: jacektrocinski, viniabussafi - config: - tags: ['arbitrum', 'balancer', 'pools', 'tokens', 'weights'] - description: > - Token weights in Balancer v2 pools. - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - pool_id - - token_address - columns: - - *blockchain - - *version - - *pool_id - - *token_address - - *normalized_weight \ No newline at end of file diff --git a/models/_project/balancer/pools/avalanche_c/_schema.yml b/models/_project/balancer/pools/avalanche_c/_schema.yml deleted file mode 100644 index 2c5082a751c..00000000000 --- a/models/_project/balancer/pools/avalanche_c/_schema.yml +++ /dev/null @@ -1,105 +0,0 @@ -version: 2 - -models: - - name: balancer_v2_avalanche_c_pools_fees - meta: - blockchain: avalanche_c - project: balancer_v2 - contributors: jacektrocinski, thetroyharris, viniabussafi - config: - tags: ['avalanche_c', 'balancer', 'pools_fees'] - description: > - Balancer v2 swap fees stored at the pool level. - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - block_number - - tx_hash - - index - columns: - - &blockchain - name: blockchain - description: "Blockchain" - - &version - name: version - description: "Version of Balancer where the liquidity pool used in transaction is deployed" - - &contract_address - name: contract_address - description: 'avalanche_c address for the liquidity pool used in transaction' - tests: - - not_null - - &tx_hash - name: tx_hash - description: 'Transaction hash' - tests: - - not_null - - &index - name: index - description: 'Event Index' - tests: - - not_null - - &tx_index - name: tx_index - description: 'Transaction Index' - tests: - - not_null - - &block_time - name: block_time - description: 'Block time in UTC' - tests: - - not_null - - &block_number - name: block_number - description: 'Event Block Number' - tests: - - not_null - - &swap_fee_percentage - name: swap_fee_percentage - description: 'Swap fees for the pool, values are returned with 18 decimals (1e18 meaning 100%)' - tests: - - not_null - - - name: balancer_avalanche_c_pools_tokens_weights - meta: - blockchain: avalanche_c - project: balancer - contributors: jacektrocinski, viniabussafi - config: - tags: ['avalanche_c', 'balancer', 'pools', 'tokens', 'weights'] - description: > - Token weights in Balancer pools. - columns: - - *blockchain - - *version - - &pool_id - name: pool_id - description: 'Unique encoded identifier that refers to each pool' - tests: - - not_null - - &token_address - name: token_address - description: 'Contract address for the token' - - &normalized_weight - name: normalized_weight - description: 'Weight of the token in the pool.' - - - name: balancer_v2_avalanche_c_pools_tokens_weights - meta: - blockchain: avalanche_c - project: balancer - contributors: jacektrocinski, viniabussafi - config: - tags: ['avalanche_c', 'balancer', 'pools', 'tokens', 'weights'] - description: > - Token weights in Balancer v2 pools. - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - pool_id - - token_address - columns: - - *blockchain - - *version - - *pool_id - - *token_address - - *normalized_weight \ No newline at end of file diff --git a/models/_project/balancer/pools/base/_schema.yml b/models/_project/balancer/pools/base/_schema.yml deleted file mode 100644 index 0949d82f17c..00000000000 --- a/models/_project/balancer/pools/base/_schema.yml +++ /dev/null @@ -1,105 +0,0 @@ -version: 2 - -models: - - name: balancer_v2_base_pools_fees - meta: - blockchain: base - project: balancer_v2 - contributors: jacektrocinski, thetroyharris, viniabussafi - config: - tags: ['base', 'balancer', 'pools_fees'] - description: > - Balancer v2 swap fees stored at the pool level. - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - block_number - - tx_hash - - index - columns: - - &blockchain - name: blockchain - description: "Blockchain" - - &version - name: version - description: "Version of Balancer where the liquidity pool used in transaction is deployed" - - &contract_address - name: contract_address - description: 'base address for the liquidity pool used in transaction' - tests: - - not_null - - &tx_hash - name: tx_hash - description: 'Transaction hash' - tests: - - not_null - - &index - name: index - description: 'Event Index' - tests: - - not_null - - &tx_index - name: tx_index - description: 'Transaction Index' - tests: - - not_null - - &block_time - name: block_time - description: 'Block time in UTC' - tests: - - not_null - - &block_number - name: block_number - description: 'Event Block Number' - tests: - - not_null - - &swap_fee_percentage - name: swap_fee_percentage - description: 'Swap fees for the pool, values are returned with 18 decimals (1e18 meaning 100%)' - tests: - - not_null - - - name: balancer_base_pools_tokens_weights - meta: - blockchain: base - project: balancer - contributors: jacektrocinski, viniabussafi - config: - tags: ['base', 'balancer', 'pools', 'tokens', 'weights'] - description: > - Token weights in Balancer pools. - columns: - - *blockchain - - *version - - &pool_id - name: pool_id - description: 'Unique encoded identifier that refers to each pool' - tests: - - not_null - - &token_address - name: token_address - description: 'Contract address for the token' - - &normalized_weight - name: normalized_weight - description: 'Weight of the token in the pool.' - - - name: balancer_v2_base_pools_tokens_weights - meta: - blockchain: base - project: balancer - contributors: jacektrocinski, viniabussafi - config: - tags: ['base', 'balancer', 'pools', 'tokens', 'weights'] - description: > - Token weights in Balancer v2 pools. - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - pool_id - - token_address - columns: - - *blockchain - - *version - - *pool_id - - *token_address - - *normalized_weight \ No newline at end of file diff --git a/models/_project/balancer/pools/ethereum/_schema.yml b/models/_project/balancer/pools/ethereum/_schema.yml deleted file mode 100644 index ea4a24ef8c8..00000000000 --- a/models/_project/balancer/pools/ethereum/_schema.yml +++ /dev/null @@ -1,149 +0,0 @@ -version: 2 - -models: - - name: balancer_v2_ethereum_pools_fees - meta: - blockchain: ethereum - project: balancer_v2 - contributors: jacektrocinski, thetroyharris, viniabussafi - config: - tags: ['ethereum', 'balancer', 'pools', 'fees'] - description: > - Balancer v2 swap fees stored at the pool level. - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - block_number - - tx_hash - - index - columns: - - &blockchain - name: blockchain - description: "Blockchain" - - &version - name: version - description: "Version of Balancer where the liquidity pool used in transaction is deployed" - - &contract_address - name: contract_address - description: 'zkevm address for the liquidity pool used in transaction' - tests: - - not_null - - &tx_hash - name: tx_hash - description: 'Transaction hash' - tests: - - not_null - - &index - name: index - description: 'Event Index' - tests: - - not_null - - &tx_index - name: tx_index - description: 'Transaction Index' - tests: - - not_null - - &block_time - name: block_time - description: 'Block time in UTC' - tests: - - not_null - - &block_number - name: block_number - description: 'Event Block Number' - tests: - - not_null - - &swap_fee_percentage - name: swap_fee_percentage - description: 'Swap fees for the pool, values are returned with 18 decimals (1e18 meaning 100%)' - tests: - - not_null - - - name: balancer_ethereum_pools_tokens_weights - meta: - blockchain: ethereum - project: balancer - contributors: jacektrocinski, viniabussafi - config: - tags: ['ethereum', 'balancer', 'pools', 'tokens', 'weights'] - description: > - Token weights in Balancer pools. - columns: - - *blockchain - - *version - - &pool_id - name: pool_id - description: 'Unique encoded identifier that refers to each pool' - tests: - - not_null - - &token_address - name: token_address - description: 'Contract address for the token' - - &normalized_weight - name: normalized_weight - description: 'Weight of the token in the pool.' - - - name: balancer_v1_ethereum_pools_tokens_weights - meta: - blockchain: ethereum - project: balancer - contributors: jacektrocinski, viniabussafi - config: - tags: ['ethereum', 'balancer', 'pools', 'tokens', 'weights'] - description: > - Token weights in Balancer v1 pools. - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - pool_id - - token_address - columns: - - *blockchain - - *version - - *pool_id - - *token_address - - *normalized_weight - - - name: balancer_v2_ethereum_pools_tokens_weights - meta: - blockchain: ethereum - project: balancer - contributors: jacektrocinski, viniabussafi - config: - tags: ['ethereum', 'balancer', 'pools', 'tokens', 'weights'] - description: > - Token weights in Balancer v2 pools. - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - pool_id - - token_address - columns: - - *blockchain - - *version - - *pool_id - - *token_address - - *normalized_weight - - - name: balancer_v2_ethereum_lbps - meta: - blockchain: ethereum - project: balancer_v2 - contributors: stefenon - config: - tags: ['ethereum', 'balancer', 'lbp'] - description: > - Record of the Liquidity Boostrapping Pools (LBP) of Balancer, an automated portfolio manager and trading platform, on Ethereum. - columns: - - name: name - description: "Name of the LBP" - - name: pool_id - description: "ID of the LBP" - - name: token_sold - description: "Contract address of the token sold by the LBP" - - name: token_symbol - description: "Symbol of the token sold by the LBP" - - name: start_time - description: "LBP start time" - - name: end_time - description: "LBP end time" \ No newline at end of file diff --git a/models/_project/balancer/pools/gnosis/_schema.yml b/models/_project/balancer/pools/gnosis/_schema.yml deleted file mode 100644 index ac61b0140a4..00000000000 --- a/models/_project/balancer/pools/gnosis/_schema.yml +++ /dev/null @@ -1,105 +0,0 @@ -version: 2 - -models: - - name: balancer_v2_gnosis_pools_fees - meta: - blockchain: gnosis - project: balancer_v2 - contributors: jacektrocinski, thetroyharris, viniabussafi - config: - tags: ['gnosis', 'balancer', 'pools_fees'] - description: > - Balancer v2 swap fees stored at the pool level. - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - block_number - - tx_hash - - index - columns: - - &blockchain - name: blockchain - description: "Blockchain" - - &version - name: version - description: "Version of Balancer where the liquidity pool used in transaction is deployed" - - &contract_address - name: contract_address - description: 'gnosis address for the liquidity pool used in transaction' - tests: - - not_null - - &tx_hash - name: tx_hash - description: 'Transaction hash' - tests: - - not_null - - &index - name: index - description: 'Event Index' - tests: - - not_null - - &tx_index - name: tx_index - description: 'Transaction Index' - tests: - - not_null - - &block_time - name: block_time - description: 'Block time in UTC' - tests: - - not_null - - &block_number - name: block_number - description: 'Event Block Number' - tests: - - not_null - - &swap_fee_percentage - name: swap_fee_percentage - description: 'Swap fees for the pool, values are returned with 18 decimals (1e18 meaning 100%)' - tests: - - not_null - - - name: balancer_gnosis_pools_tokens_weights - meta: - blockchain: gnosis - project: balancer - contributors: jacektrocinski, viniabussafi - config: - tags: ['gnosis', 'balancer', 'pools', 'tokens', 'weights'] - description: > - Token weights in Balancer pools. - columns: - - *blockchain - - *version - - &pool_id - name: pool_id - description: 'Unique encoded identifier that refers to each pool' - tests: - - not_null - - &token_address - name: token_address - description: 'Contract address for the token' - - &normalized_weight - name: normalized_weight - description: 'Weight of the token in the pool.' - - - name: balancer_v2_gnosis_pools_tokens_weights - meta: - blockchain: gnosis - project: balancer - contributors: jacektrocinski, viniabussafi - config: - tags: ['gnosis', 'balancer', 'pools', 'tokens', 'weights'] - description: > - Token weights in Balancer v2 pools. - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - pool_id - - token_address - columns: - - *blockchain - - *version - - *pool_id - - *token_address - - *normalized_weight \ No newline at end of file diff --git a/models/_project/balancer/pools/optimism/_schema.yml b/models/_project/balancer/pools/optimism/_schema.yml deleted file mode 100644 index 289820cd3bc..00000000000 --- a/models/_project/balancer/pools/optimism/_schema.yml +++ /dev/null @@ -1,146 +0,0 @@ -version: 2 - -models: - - name: balancer_v2_optimism_pools_fees - meta: - blockchain: optimism - project: balancer_v2 - contributors: jacektrocinski, thetroyharris, viniabussafi - config: - tags: ['optimism', 'balancer', 'pools_fees'] - description: > - Balancer v2 swap fees stored at the pool level. - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - block_number - - tx_hash - - index - columns: - - &blockchain - name: blockchain - description: "Blockchain" - - &version - name: version - description: "Version of Balancer where the liquidity pool used in transaction is deployed" - - &contract_address - name: contract_address - description: 'optimism address for the liquidity pool used in transaction' - tests: - - not_null - - &tx_hash - name: tx_hash - description: 'Transaction hash' - tests: - - not_null - - &index - name: index - description: 'Event Index' - tests: - - not_null - - &tx_index - name: tx_index - description: 'Transaction Index' - tests: - - not_null - - &block_time - name: block_time - description: 'Block time in UTC' - tests: - - not_null - - &block_number - name: block_number - description: 'Event Block Number' - tests: - - not_null - - &swap_fee_percentage - name: swap_fee_percentage - description: 'Swap fees for the pool, values are returned with 18 decimals (1e18 meaning 100%)' - tests: - - not_null - - - name: balancer_optimism_pools_tokens_weights - meta: - blockchain: optimism - project: balancer - contributors: jacektrocinski, viniabussafi - config: - tags: ['optimism', 'balancer', 'pools', 'tokens', 'weights'] - description: > - Token weights in Balancer pools. - columns: - - *blockchain - - *version - - &pool_id - name: pool_id - description: 'Unique encoded identifier that refers to each pool' - tests: - - not_null - - &token_address - name: token_address - description: 'Contract address for the token' - - &normalized_weight - name: normalized_weight - description: 'Weight of the token in the pool.' - - - name: balancer_v2_optimism_pools_tokens_weights - meta: - blockchain: optimism - project: balancer - contributors: jacektrocinski, viniabussafi - config: - tags: ['optimism', 'balancer', 'pools', 'tokens', 'weights'] - description: > - Token weights in Balancer v2 pools. - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - pool_id - - token_address - columns: - - *blockchain - - *version - - *pool_id - - *token_address - - *normalized_weight - - - name: balancer_optimism_gauge_mappings - meta: - blockchain: optimism - project: balancer - contributors: msilb7 - config: - tags: ['optimism', 'balancer', 'gauges', 'incentives'] - description: > - Balancer gauge to pool mappings on Optimism. - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - pool_contract - - incentives_contract - columns: - - *blockchain - - *version - - &pool_contract - name: pool_contract - description: "Address of the liquidity pool contract" - - *pool_id - - &incentives_contract - name: incentives_contract - description: "Address of the contract where incentives are stored and emitted." - - &incentives_type - name: incentives_type - description: "Description of the incentives address type." - - &evt_block_time - name: evt_block_time - description: "Block time in UTC" - - &evt_block_number - name: evt_block_number - description: 'Event Block Number' - - *contract_address - - &evt_tx_hash - name: evt_tx_hash - description: 'Transaction hash' - - &evt_index - name: evT_index - description: 'Event Index' \ No newline at end of file diff --git a/models/_project/balancer/pools/polygon/_schema.yml b/models/_project/balancer/pools/polygon/_schema.yml deleted file mode 100644 index 40929f01c30..00000000000 --- a/models/_project/balancer/pools/polygon/_schema.yml +++ /dev/null @@ -1,128 +0,0 @@ -version: 2 - -models: - - name: balancer_v2_polygon_pools_fees - meta: - blockchain: polygon - project: balancer_v2 - contributors: jacektrocinski, thetroyharris, viniabussafi - config: - tags: ['polygon', 'balancer', 'pools', 'fees'] - description: > - Balancer v2 swap fees stored at the pool level. - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - block_number - - tx_hash - - index - columns: - - &blockchain - name: blockchain - description: "Blockchain" - - &version - name: version - description: "Version of Balancer where the liquidity pool used in transaction is deployed" - - &contract_address - name: contract_address - description: 'zkevm address for the liquidity pool used in transaction' - tests: - - not_null - - &tx_hash - name: tx_hash - description: 'Transaction hash' - tests: - - not_null - - &index - name: index - description: 'Event Index' - tests: - - not_null - - &tx_index - name: tx_index - description: 'Transaction Index' - tests: - - not_null - - &block_time - name: block_time - description: 'Block time in UTC' - tests: - - not_null - - &block_number - name: block_number - description: 'Event Block Number' - tests: - - not_null - - &swap_fee_percentage - name: swap_fee_percentage - description: 'Swap fees for the pool, values are returned with 18 decimals (1e18 meaning 100%)' - tests: - - not_null - - - name: balancer_polygon_pools_tokens_weights - meta: - blockchain: polygon - project: balancer - contributors: jacektrocinski, viniabussafi - config: - tags: ['polygon', 'balancer', 'pools', 'tokens', 'weights'] - description: > - Token weights in Balancer pools. - columns: - - *blockchain - - *version - - &pool_id - name: pool_id - description: 'Unique encoded identifier that refers to each pool' - tests: - - not_null - - &token_address - name: token_address - description: 'Contract address for the token' - - &normalized_weight - name: normalized_weight - description: 'Weight of the token in the pool.' - - - name: balancer_v2_polygon_pools_tokens_weights - meta: - blockchain: polygon - project: balancer - contributors: jacektrocinski, viniabussafi - config: - tags: ['polygon', 'balancer', 'pools', 'tokens', 'weights'] - description: > - Token weights in Balancer v2 pools. - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - pool_id - - token_address - columns: - - *blockchain - - *version - - *pool_id - - *token_address - - *normalized_weight - - - name: balancer_v2_polygon_lbps - meta: - blockchain: polygon - project: balancer_v2 - contributors: stefenon - config: - tags: ['polygon', 'balancer', 'lbp'] - description: > - Record of the Liquidity Boostrapping Pools (LBP) of Balancer, an automated portfolio manager and trading platform, on polygon. - columns: - - name: name - description: "Name of the LBP" - - name: pool_id - description: "ID of the LBP" - - name: token_sold - description: "Contract address of the token sold by the LBP" - - name: token_symbol - description: "Symbol of the token sold by the LBP" - - name: start_time - description: "LBP start time" - - name: end_time - description: "LBP end time" \ No newline at end of file diff --git a/models/_project/balancer/pools/zkevm/_schema.yml b/models/_project/balancer/pools/zkevm/_schema.yml deleted file mode 100644 index 03f7ab4e6be..00000000000 --- a/models/_project/balancer/pools/zkevm/_schema.yml +++ /dev/null @@ -1,105 +0,0 @@ -version: 2 - -models: - - name: balancer_v2_zkevm_pools_fees - meta: - blockchain: zkevm - project: balancer_v2 - contributors: jacektrocinski, thetroyharris, viniabussafi - config: - tags: ['zkevm', 'balancer', 'pools_fees'] - description: > - Balancer v2 swap fees stored at the pool level. - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - block_number - - tx_hash - - index - columns: - - &blockchain - name: blockchain - description: "Blockchain" - - &version - name: version - description: "Version of Balancer where the liquidity pool used in transaction is deployed" - - &contract_address - name: contract_address - description: 'zkevm address for the liquidity pool used in transaction' - tests: - - not_null - - &tx_hash - name: tx_hash - description: 'Transaction hash' - tests: - - not_null - - &index - name: index - description: 'Event Index' - tests: - - not_null - - &tx_index - name: tx_index - description: 'Transaction Index' - tests: - - not_null - - &block_time - name: block_time - description: 'Block time in UTC' - tests: - - not_null - - &block_number - name: block_number - description: 'Event Block Number' - tests: - - not_null - - &swap_fee_percentage - name: swap_fee_percentage - description: 'Swap fees for the pool, values are returned with 18 decimals (1e18 meaning 100%)' - tests: - - not_null - - - name: balancer_zkevm_pools_tokens_weights - meta: - blockchain: zkevm - project: balancer - contributors: jacektrocinski, viniabussafi - config: - tags: ['zkevm', 'balancer', 'pools', 'tokens', 'weights'] - description: > - Token weights in Balancer pools. - columns: - - *blockchain - - *version - - &pool_id - name: pool_id - description: 'Unique encoded identifier that refers to each pool' - tests: - - not_null - - &token_address - name: token_address - description: 'Contract address for the token' - - &normalized_weight - name: normalized_weight - description: 'Weight of the token in the pool.' - - - name: balancer_v2_zkevm_pools_tokens_weights - meta: - blockchain: zkevm - project: balancer - contributors: jacektrocinski, viniabussafi - config: - tags: ['zkevm', 'balancer', 'pools', 'tokens', 'weights'] - description: > - Token weights in Balancer v2 pools. - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - pool_id - - token_address - columns: - - *blockchain - - *version - - *pool_id - - *token_address - - *normalized_weight \ No newline at end of file diff --git a/models/_project/balancer/protocol_fee/_schema.yml b/models/_project/balancer/protocol_fee/_schema.yml deleted file mode 100644 index ddc320d1692..00000000000 --- a/models/_project/balancer/protocol_fee/_schema.yml +++ /dev/null @@ -1,61 +0,0 @@ -version: 2 - -models: - - name: balancer_protocol_fee - meta: - blockchain: arbitrum, avalanche_c, base, ethereum, gnosis, optimism, polygon, zkevm - project: balancer - contributors: viniabussafi - config: - tags: ['arbitrum', 'avalanche_c', 'base', 'ethereum', 'gnosis', 'optimism', 'polygon', 'zkevm', 'fees'] - description: > - Daily Protocol Fee collected and Revenue by pool on Balancer, an automated portfolio manager and trading platform. - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - day - - pool_id - - token_address - columns: - - &day - name: day - description: "Block date in UTC" - - &pool_id - name: pool_id - description: "Unique encoded identifier that refers to each pool" - - &pool_address - name: pool_address - description: "Pool address" - - &pool_symbol - name: pool_symbol - description: "Token symbols, followed by their respective weights, if applicable" - - &version - name: version - description: "Version of the project" - - &blockchain - name: blockchain - description: "Blockchain" - - &pool_type - name: pool_type - description: "Pool attributes, determined by the pool's factory" - - &token_address - name: token_address - description: "Contract address of the token in which protocol fees were collected" - - &token_symbol - name: token_symbol - description: Token symbol of the token in which protocol fees were collected" - - &token_amount_raw - name: token_amount_raw - description: "Raw amount of fees of the token in the pool at time of execution in the original currency" - - &token_amount - name: token_amount - description: "Normalized amount of fees of the token in the pool at time of execution in the original currency" - - &protocol_fee_collected_usd - name: protocol_fee_collected_usd - description: "USD value of the collected fee" - - &treasury_share - name: treasury_share - description: "Share of total fee that is directed to Balancer DAO's treasury, as per BIPs 19, 161 and 371" - - &treasury_revenue_usd - name: treasury_revenue_usd - description: "USD value of fee directed to Balancer DAO's treasury" \ No newline at end of file diff --git a/models/_project/balancer/protocol_fee/arbitrum/_schema.yml b/models/_project/balancer/protocol_fee/arbitrum/_schema.yml deleted file mode 100644 index b529565a645..00000000000 --- a/models/_project/balancer/protocol_fee/arbitrum/_schema.yml +++ /dev/null @@ -1,61 +0,0 @@ -version: 2 - -models: - - name: balancer_v2_arbitrum_protocol_fee - meta: - blockchain: arbitrum - project: balancer_v2 - contributors: viniabussafi - config: - tags: ['arbitrum', 'protocol', 'fees'] - description: > - Daily Protocol Fee collected and Treasury Revenue by pool on Balancer, an automated portfolio manager and trading platform. - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - day - - pool_id - - token_address - columns: - - &day - name: day - description: "Block date in UTC" - - &pool_id - name: pool_id - description: "Unique encoded identifier that refers to each pool" - - &pool_address - name: pool_address - description: "Pool address" - - &pool_symbol - name: pool_symbol - description: "Token symbols, followed by their respective weights, if applicable" - - &version - name: version - description: "Version of the project" - - &blockchain - name: blockchain - description: "Blockchain" - - &pool_type - name: pool_type - description: "Pool attributes, determined by the pool's factory" - - &token_address - name: token_address - description: "Contract address of the token in which protocol fees were collected" - - &token_symbol - name: token_symbol - description: Token symbol of the token in which protocol fees were collected" - - &token_amount_raw - name: token_amount_raw - description: "Raw amount of fees of the token in the pool at time of execution in the original currency" - - &token_amount - name: token_amount - description: "Normalized amount of fees of the token in the pool at time of execution in the original currency" - - &protocol_fee_collected_usd - name: protocol_fee_collected_usd - description: "USD value of the collected fee" - - &treasury_share - name: treasury_share - description: "Share of total fee that is directed to Balancer DAO's treasury, as per BIPs 19, 161 and 371" - - &treasury_revenue_usd - name: treasury_revenue_usd - description: "USD value of fee directed to Balancer DAO's treasury" \ No newline at end of file diff --git a/models/_project/balancer/protocol_fee/avalanche_c/_schema.yml b/models/_project/balancer/protocol_fee/avalanche_c/_schema.yml deleted file mode 100644 index 536823df10d..00000000000 --- a/models/_project/balancer/protocol_fee/avalanche_c/_schema.yml +++ /dev/null @@ -1,61 +0,0 @@ -version: 2 - -models: - - name: balancer_v2_avalanche_c_protocol_fee - meta: - blockchain: avalanche_c - project: balancer_v2 - contributors: viniabussafi - config: - tags: ['avalanche_c', 'revenue', 'fees'] - description: > - Daily Protocol Fee collected and Revenue by pool on Balancer, an automated portfolio manager and trading platform. - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - day - - pool_id - - token_address - columns: - - &day - name: day - description: "Block date in UTC" - - &pool_id - name: pool_id - description: "Unique encoded identifier that refers to each pool" - - &pool_address - name: pool_address - description: "Pool address" - - &pool_symbol - name: pool_symbol - description: "Token symbols, followed by their respective weights, if applicable" - - &version - name: version - description: "Version of the project" - - &blockchain - name: blockchain - description: "Blockchain" - - &pool_type - name: pool_type - description: "Pool attributes, determined by the pool's factory" - - &token_address - name: token_address - description: "Contract address of the token in which protocol fees were collected" - - &token_symbol - name: token_symbol - description: Token symbol of the token in which protocol fees were collected" - - &token_amount_raw - name: token_amount_raw - description: "Raw amount of fees of the token in the pool at time of execution in the original currency" - - &token_amount - name: token_amount - description: "Normalized amount of fees of the token in the pool at time of execution in the original currency" - - &protocol_fee_collected_usd - name: protocol_fee_collected_usd - description: "USD value of the collected fee" - - &treasury_share - name: treasury_share - description: "Share of total fee that is directed to Balancer DAO's treasury, as per BIPs 19, 161 and 371" - - &treasury_revenue_usd - name: treasury_revenue_usd - description: "USD value of fee directed to Balancer DAO's treasury" \ No newline at end of file diff --git a/models/_project/balancer/protocol_fee/base/_schema.yml b/models/_project/balancer/protocol_fee/base/_schema.yml deleted file mode 100644 index cebb1c312e9..00000000000 --- a/models/_project/balancer/protocol_fee/base/_schema.yml +++ /dev/null @@ -1,61 +0,0 @@ -version: 2 - -models: - - name: balancer_v2_base_protocol_fee - meta: - blockchain: base - project: balancer_v2 - contributors: viniabussafi - config: - tags: ['base', 'revenue', 'fees'] - description: > - Daily Protocol Fee collected and Revenue by pool on Balancer, an automated portfolio manager and trading platform. - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - day - - pool_id - - token_address - columns: - - &day - name: day - description: "Block date in UTC" - - &pool_id - name: pool_id - description: "Unique encoded identifier that refers to each pool" - - &pool_address - name: pool_address - description: "Pool address" - - &pool_symbol - name: pool_symbol - description: "Token symbols, followed by their respective weights, if applicable" - - &version - name: version - description: "Version of the project" - - &blockchain - name: blockchain - description: "Blockchain" - - &pool_type - name: pool_type - description: "Pool attributes, determined by the pool's factory" - - &token_address - name: token_address - description: "Contract address of the token in which protocol fees were collected" - - &token_symbol - name: token_symbol - description: Token symbol of the token in which protocol fees were collected" - - &token_amount_raw - name: token_amount_raw - description: "Raw amount of fees of the token in the pool at time of execution in the original currency" - - &token_amount - name: token_amount - description: "Normalized amount of fees of the token in the pool at time of execution in the original currency" - - &protocol_fee_collected_usd - name: protocol_fee_collected_usd - description: "USD value of the collected fee" - - &treasury_share - name: treasury_share - description: "Share of total fee that is directed to Balancer DAO's treasury, as per BIPs 19, 161 and 371" - - &treasury_revenue_usd - name: treasury_revenue_usd - description: "USD value of fee directed to Balancer DAO's treasury" \ No newline at end of file diff --git a/models/_project/balancer/protocol_fee/ethereum/_schema.yml b/models/_project/balancer/protocol_fee/ethereum/_schema.yml deleted file mode 100644 index b6830c20e7e..00000000000 --- a/models/_project/balancer/protocol_fee/ethereum/_schema.yml +++ /dev/null @@ -1,61 +0,0 @@ -version: 2 - -models: - - name: balancer_v2_ethereum_protocol_fee - meta: - blockchain: ethereum - project: balancer_v2 - contributors: viniabussafi - config: - tags: ['ethereum', 'revenue', 'fees'] - description: > - Daily Protocol Fee collected and Revenue by pool on Balancer, an automated portfolio manager and trading platform. - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - day - - pool_id - - token_address - columns: - - &day - name: day - description: "Block date in UTC" - - &pool_id - name: pool_id - description: "Unique encoded identifier that refers to each pool" - - &pool_address - name: pool_address - description: "Pool address" - - &pool_symbol - name: pool_symbol - description: "Token symbols, followed by their respective weights, if applicable" - - &version - name: version - description: "Version of the project" - - &blockchain - name: blockchain - description: "Blockchain" - - &pool_type - name: pool_type - description: "Pool attributes, determined by the pool's factory" - - &token_address - name: token_address - description: "Contract address of the token in which protocol fees were collected" - - &token_symbol - name: token_symbol - description: Token symbol of the token in which protocol fees were collected" - - &token_amount_raw - name: token_amount_raw - description: "Raw amount of fees of the token in the pool at time of execution in the original currency" - - &token_amount - name: token_amount - description: "Normalized amount of fees of the token in the pool at time of execution in the original currency" - - &protocol_fee_collected_usd - name: protocol_fee_collected_usd - description: "USD value of the collected fee" - - &treasury_share - name: treasury_share - description: "Share of total fee that is directed to Balancer DAO's treasury, as per BIPs 19, 161 and 371" - - &treasury_revenue_usd - name: treasury_revenue_usd - description: "USD value of fee directed to Balancer DAO's treasury" \ No newline at end of file diff --git a/models/_project/balancer/protocol_fee/gnosis/_schema.yml b/models/_project/balancer/protocol_fee/gnosis/_schema.yml deleted file mode 100644 index defa5e74781..00000000000 --- a/models/_project/balancer/protocol_fee/gnosis/_schema.yml +++ /dev/null @@ -1,61 +0,0 @@ -version: 2 - -models: - - name: balancer_v2_gnosis_protocol_fee - meta: - blockchain: gnosis - project: balancer_v2 - contributors: viniabussafi - config: - tags: ['gnosis', 'revenue', 'fees'] - description: > - Daily Protocol Fee collected and Revenue by pool on Balancer, an automated portfolio manager and trading platform. - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - day - - pool_id - - token_address - columns: - - &day - name: day - description: "Block date in UTC" - - &pool_id - name: pool_id - description: "Unique encoded identifier that refers to each pool" - - &pool_address - name: pool_address - description: "Pool address" - - &pool_symbol - name: pool_symbol - description: "Token symbols, followed by their respective weights, if applicable" - - &version - name: version - description: "Version of the project" - - &blockchain - name: blockchain - description: "Blockchain" - - &pool_type - name: pool_type - description: "Pool attributes, determined by the pool's factory" - - &token_address - name: token_address - description: "Contract address of the token in which protocol fees were collected" - - &token_symbol - name: token_symbol - description: Token symbol of the token in which protocol fees were collected" - - &token_amount_raw - name: token_amount_raw - description: "Raw amount of fees of the token in the pool at time of execution in the original currency" - - &token_amount - name: token_amount - description: "Normalized amount of fees of the token in the pool at time of execution in the original currency" - - &protocol_fee_collected_usd - name: protocol_fee_collected_usd - description: "USD value of the collected fee" - - &treasury_share - name: treasury_share - description: "Share of total fee that is directed to Balancer DAO's treasury, as per BIPs 19, 161 and 371" - - &treasury_revenue_usd - name: treasury_revenue_usd - description: "USD value of fee directed to Balancer DAO's treasury" \ No newline at end of file diff --git a/models/_project/balancer/protocol_fee/optimism/_schema.yml b/models/_project/balancer/protocol_fee/optimism/_schema.yml deleted file mode 100644 index 6b096a72bc6..00000000000 --- a/models/_project/balancer/protocol_fee/optimism/_schema.yml +++ /dev/null @@ -1,61 +0,0 @@ -version: 2 - -models: - - name: balancer_v2_optimism_protocol_fee - meta: - blockchain: optimism - project: balancer_v2 - contributors: viniabussafi - config: - tags: ['optimism', 'revenue', 'fees'] - description: > - Daily Protocol Fee collected and Revenue by pool on Balancer, an automated portfolio manager and trading platform. - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - day - - pool_id - - token_address - columns: - - &day - name: day - description: "Block date in UTC" - - &pool_id - name: pool_id - description: "Unique encoded identifier that refers to each pool" - - &pool_address - name: pool_address - description: "Pool address" - - &pool_symbol - name: pool_symbol - description: "Token symbols, followed by their respective weights, if applicable" - - &version - name: version - description: "Version of the project" - - &blockchain - name: blockchain - description: "Blockchain" - - &pool_type - name: pool_type - description: "Pool attributes, determined by the pool's factory" - - &token_address - name: token_address - description: "Contract address of the token in which protocol fees were collected" - - &token_symbol - name: token_symbol - description: Token symbol of the token in which protocol fees were collected" - - &token_amount_raw - name: token_amount_raw - description: "Raw amount of fees of the token in the pool at time of execution in the original currency" - - &token_amount - name: token_amount - description: "Normalized amount of fees of the token in the pool at time of execution in the original currency" - - &protocol_fee_collected_usd - name: protocol_fee_collected_usd - description: "USD value of the collected fee" - - &treasury_share - name: treasury_share - description: "Share of total fee that is directed to Balancer DAO's treasury, as per BIPs 19, 161 and 371" - - &treasury_revenue_usd - name: treasury_revenue_usd - description: "USD value of fee directed to Balancer DAO's treasury" \ No newline at end of file diff --git a/models/_project/balancer/protocol_fee/polygon/_schema.yml b/models/_project/balancer/protocol_fee/polygon/_schema.yml deleted file mode 100644 index b541beceb65..00000000000 --- a/models/_project/balancer/protocol_fee/polygon/_schema.yml +++ /dev/null @@ -1,61 +0,0 @@ -version: 2 - -models: - - name: balancer_v2_polygon_protocol_fee - meta: - blockchain: polygon - project: balancer_v2 - contributors: viniabussafi - config: - tags: ['polygon', 'revenue', 'fees'] - description: > - Daily Protocol Fee collected and Revenue by pool on Balancer, an automated portfolio manager and trading platform. - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - day - - pool_id - - token_address - columns: - - &day - name: day - description: "Block date in UTC" - - &pool_id - name: pool_id - description: "Unique encoded identifier that refers to each pool" - - &pool_address - name: pool_address - description: "Pool address" - - &pool_symbol - name: pool_symbol - description: "Token symbols, followed by their respective weights, if applicable" - - &version - name: version - description: "Version of the project" - - &blockchain - name: blockchain - description: "Blockchain" - - &pool_type - name: pool_type - description: "Pool attributes, determined by the pool's factory" - - &token_address - name: token_address - description: "Contract address of the token in which protocol fees were collected" - - &token_symbol - name: token_symbol - description: Token symbol of the token in which protocol fees were collected" - - &token_amount_raw - name: token_amount_raw - description: "Raw amount of fees of the token in the pool at time of execution in the original currency" - - &token_amount - name: token_amount - description: "Normalized amount of fees of the token in the pool at time of execution in the original currency" - - &protocol_fee_collected_usd - name: protocol_fee_collected_usd - description: "USD value of the collected fee" - - &treasury_share - name: treasury_share - description: "Share of total fee that is directed to Balancer DAO's treasury, as per BIPs 19, 161 and 371" - - &treasury_revenue_usd - name: treasury_revenue_usd - description: "USD value of fee directed to Balancer DAO's treasury" \ No newline at end of file diff --git a/models/_project/balancer/protocol_fee/zkevm/_schema.yml b/models/_project/balancer/protocol_fee/zkevm/_schema.yml deleted file mode 100644 index b8c5d67a600..00000000000 --- a/models/_project/balancer/protocol_fee/zkevm/_schema.yml +++ /dev/null @@ -1,61 +0,0 @@ -version: 2 - -models: - - name: balancer_v2_zkevm_protocol_fee - meta: - blockchain: zkevm - project: balancer_v2 - contributors: viniabussafi - config: - tags: ['zkevm', 'revenue', 'fees'] - description: > - Daily Protocol Fee collected and Revenue by pool on Balancer, an automated portfolio manager and trading platform. - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - day - - pool_id - - token_address - columns: - - &day - name: day - description: "Block date in UTC" - - &pool_id - name: pool_id - description: "Unique encoded identifier that refers to each pool" - - &pool_address - name: pool_address - description: "Pool address" - - &pool_symbol - name: pool_symbol - description: "Token symbols, followed by their respective weights, if applicable" - - &version - name: version - description: "Version of the project" - - &blockchain - name: blockchain - description: "Blockchain" - - &pool_type - name: pool_type - description: "Pool attributes, determined by the pool's factory" - - &token_address - name: token_address - description: "Contract address of the token in which protocol fees were collected" - - &token_symbol - name: token_symbol - description: Token symbol of the token in which protocol fees were collected" - - &token_amount_raw - name: token_amount_raw - description: "Raw amount of fees of the token in the pool at time of execution in the original currency" - - &token_amount - name: token_amount - description: "Normalized amount of fees of the token in the pool at time of execution in the original currency" - - &protocol_fee_collected_usd - name: protocol_fee_collected_usd - description: "USD value of the collected fee" - - &treasury_share - name: treasury_share - description: "Share of total fee that is directed to Balancer DAO's treasury, as per BIPs 19, 161 and 371" - - &treasury_revenue_usd - name: treasury_revenue_usd - description: "USD value of fee directed to Balancer DAO's treasury" \ No newline at end of file diff --git a/models/_project/balancer/support/_schema.yml b/models/_project/balancer/support/_schema.yml deleted file mode 100644 index fbb445cf773..00000000000 --- a/models/_project/balancer/support/_schema.yml +++ /dev/null @@ -1,56 +0,0 @@ -version: 2 - -models: - - name: balancer_token_whitelist - meta: - blockchain: arbitrum, avalanche_c, base, ethereum, gnosis, optimism, polygon, 'zkevm' - contributors: viniabussafi - config: - tags: ['arbitrum', 'avalanche_c', 'base', 'ethereum', 'gnosis', 'optimism', 'polygon', 'zkevm'] - description: > - These tokens are whitelisted to be used as pricing assets on liquidity calculations for weighted pools, due to the trustability of their data. - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - address - - name - - chain - columns: - - &address - name: address - description: "Token address" - - &name - name: name - description: "Token symbol" - - &chain - name: chain - description: "Token blockchain" - - - name: balancer_single_recipient_gauges - meta: - blockchain: ethereum - contributors: viniabussafi - config: - tags: ['ethereum', 'gauges'] - description: > - These gauges are deployed by the SingleRecipientGauge contract and this mapping manually links each gauge to it's correspondent pool and project - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - gauge_address - - pool_id - - project - - blockchain - columns: - - &gauge_address - name: gauge_address - descripton: "Gauge address" - - &pool_id - name: pool_id - description: "Unique encoded identifier that refers to each pool to which each gauge directs incentives" - - &project - name: project - description: "ve8020 project for each gauge" - - &blockchain - name: blockchain - description: "Blockchain" \ No newline at end of file diff --git a/models/_project/balancer/trades/arbitrum/_schema.yml b/models/_project/balancer/trades/arbitrum/_schema.yml deleted file mode 100644 index 09ef97905b8..00000000000 --- a/models/_project/balancer/trades/arbitrum/_schema.yml +++ /dev/null @@ -1,149 +0,0 @@ -version: 2 - -models: - - name: balancer_arbitrum_trades - meta: - blockchain: arbitrum - sector: dex - contributors: bizzyvinci, viniabussafi - config: - tags: ['balancer', 'arbitrum', 'amm', 'trades', 'dex'] - description: > - DEX trades on balancer on arbitrum - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - block_date - - blockchain - - project - - version - - tx_hash - - evt_index - - check_dex_seed: - blockchain: arbitrum - project: balancer - version: 2 - columns: - - &blockchain - name: blockchain - description: "Blockchain" - - &project - name: project - description: "Project name (balancer)" - - &version - name: version - description: "Version of the project" - - &block_month - name: block_month - description: "Block month in UTC" - - &block_date - name: block_date - description: "Block date in UTC" - - &block_time - name: block_time - description: 'Block time in UTC' - - &block_number - name: block_number - description: 'Block number' - - &token_bought_symbol - name: token_bought_symbol - description: "Token symbol for token bought in the trade" - - &token_sold_symbol - name: token_sold_symbol - description: "Token symbol for token sold in the trade" - - &token_pair - name: token_pair - description: "Token symbol pair for each token involved in the trade" - - &token_bought_amount - name: token_bought_amount - description: "Value of the token bought at time of execution in the original currency" - - &token_sold_amount - name: token_sold_amount - description: "Value of the token sold at time of execution in the original currency" - - &token_bought_amount_raw - name: token_bought_amount_raw - description: "Raw value of the token bought at time of execution in the original currency" - - &token_sold_amount_raw - name: token_sold_amount_raw - description: "Raw value of the token sold at time of execution in the original currency" - - &amount_usd - name: amount_usd - description: "USD value of the trade at time of execution" - - &token_bought_address - name: token_bought_address - description: "Contract address of the token bought" - - &token_sold_address - name: token_sold_address - description: "Contract address of the token sold" - - &taker - name: taker - description: "Address of trader who purchased a token" - - &maker - name: maker - description: "Address of trader who sold a token" - - &pool_id - name: pool_id - description: "Unique encoded identifier that refers to each pool" - - &swap_fee - name: swap_fee - description: 'Swap fee' - - &project_contract_address - name: project_contract_address - description: "Pool address" - - &pool_symbol - name: pool_symbol - description: "Token symbols, followed by their respective weights, if applicable" - - &pool_type - name: pool_type - description: "Pool attributes, determined by the pool's factory" - - &tx_hash - name: tx_hash - description: "Tx. Hash" - - &tx_from - name: tx_from - description: "transaction.from" - - &tx_to - name: tx_to - description: "transaction.to" - - &evt_index - name: evt_index - description: 'Event index' - - - name: balancer_v2_arbitrum_trades - meta: - blockchain: arbitrum - sector: dex - contributors: bizzyvinci, thetroyharris, tomfutago, viniabussafi - config: - tags: [ 'balancer', 'arbitrum', 'amm', 'trades', 'dex', 'beta' ] - description: > - DEX trades on balancer v2 on arbitrum - columns: - - *blockchain - - *project - - *version - - *block_month - - *block_date - - *block_time - - *block_number - - *token_bought_symbol - - *token_sold_symbol - - *token_pair - - *token_bought_amount - - *token_sold_amount - - *token_bought_amount_raw - - *token_sold_amount_raw - - *amount_usd - - *token_bought_address - - *token_sold_address - - *taker - - *maker - - *project_contract_address - - *pool_symbol - - *pool_type - - *pool_id - - *swap_fee - - *tx_hash - - *tx_from - - *tx_to - - *evt_index \ No newline at end of file diff --git a/models/_project/balancer/trades/avalanche_c/_schema.yml b/models/_project/balancer/trades/avalanche_c/_schema.yml deleted file mode 100644 index 86aca24b807..00000000000 --- a/models/_project/balancer/trades/avalanche_c/_schema.yml +++ /dev/null @@ -1,149 +0,0 @@ -version: 2 - -models: - - name: balancer_avalanche_c_trades - meta: - blockchain: avalanche_c - sector: dex - contributors: bizzyvinci, viniabussafi - config: - tags: ['balancer', 'avalanche_c', 'amm', 'trades', 'dex'] - description: > - DEX trades on balancer on avalanche_c - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - block_date - - blockchain - - project - - version - - tx_hash - - evt_index - - check_dex_seed: - blockchain: avalanche_c - project: balancer - version: 2 - columns: - - &blockchain - name: blockchain - description: "Blockchain" - - &project - name: project - description: "Project name (balancer)" - - &version - name: version - description: "Version of the project" - - &block_month - name: block_month - description: "Block month in UTC" - - &block_date - name: block_date - description: "Block date in UTC" - - &block_time - name: block_time - description: 'Block time in UTC' - - &block_number - name: block_number - description: 'Block number' - - &token_bought_symbol - name: token_bought_symbol - description: "Token symbol for token bought in the trade" - - &token_sold_symbol - name: token_sold_symbol - description: "Token symbol for token sold in the trade" - - &token_pair - name: token_pair - description: "Token symbol pair for each token involved in the trade" - - &token_bought_amount - name: token_bought_amount - description: "Value of the token bought at time of execution in the original currency" - - &token_sold_amount - name: token_sold_amount - description: "Value of the token sold at time of execution in the original currency" - - &token_bought_amount_raw - name: token_bought_amount_raw - description: "Raw value of the token bought at time of execution in the original currency" - - &token_sold_amount_raw - name: token_sold_amount_raw - description: "Raw value of the token sold at time of execution in the original currency" - - &amount_usd - name: amount_usd - description: "USD value of the trade at time of execution" - - &token_bought_address - name: token_bought_address - description: "Contract address of the token bought" - - &token_sold_address - name: token_sold_address - description: "Contract address of the token sold" - - &taker - name: taker - description: "Address of trader who purchased a token" - - &maker - name: maker - description: "Address of trader who sold a token" - - &pool_id - name: pool_id - description: "Unique encoded identifier that refers to each pool" - - &swap_fee - name: swap_fee - description: 'Swap fee' - - &project_contract_address - name: project_contract_address - description: "Pool address" - - &pool_symbol - name: pool_symbol - description: "Token symbols, followed by their respective weights, if applicable" - - &pool_type - name: pool_type - description: "Pool attributes, determined by the pool's factory" - - &tx_hash - name: tx_hash - description: "Tx. Hash" - - &tx_from - name: tx_from - description: "transaction.from" - - &tx_to - name: tx_to - description: "transaction.to" - - &evt_index - name: evt_index - description: 'Event index' - - - name: balancer_v2_avalanche_c_trades - meta: - blockchain: avalanche_c - sector: dex - contributors: bizzyvinci, thetroyharris, tomfutago, viniabussafi - config: - tags: [ 'balancer', 'avalanche_c', 'amm', 'trades', 'dex', 'beta' ] - description: > - DEX trades on balancer v2 on avalanche_c - columns: - - *blockchain - - *project - - *version - - *block_month - - *block_date - - *block_time - - *block_number - - *token_bought_symbol - - *token_sold_symbol - - *token_pair - - *token_bought_amount - - *token_sold_amount - - *token_bought_amount_raw - - *token_sold_amount_raw - - *amount_usd - - *token_bought_address - - *token_sold_address - - *taker - - *maker - - *project_contract_address - - *pool_symbol - - *pool_type - - *pool_id - - *swap_fee - - *tx_hash - - *tx_from - - *tx_to - - *evt_index \ No newline at end of file diff --git a/models/_project/balancer/trades/base/_schema.yml b/models/_project/balancer/trades/base/_schema.yml deleted file mode 100644 index 4a0bd85156f..00000000000 --- a/models/_project/balancer/trades/base/_schema.yml +++ /dev/null @@ -1,149 +0,0 @@ -version: 2 - -models: - - name: balancer_base_trades - meta: - blockchain: base - sector: dex - contributors: bizzyvinci, viniabussafi - config: - tags: ['balancer', 'base', 'amm', 'trades', 'dex'] - description: > - DEX trades on balancer on base - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - block_date - - blockchain - - project - - version - - tx_hash - - evt_index - - check_dex_seed: - blockchain: base - project: balancer - version: 2 - columns: - - &blockchain - name: blockchain - description: "Blockchain" - - &project - name: project - description: "Project name (balancer)" - - &version - name: version - description: "Version of the project" - - &block_month - name: block_month - description: "Block month in UTC" - - &block_date - name: block_date - description: "Block date in UTC" - - &block_time - name: block_time - description: 'Block time in UTC' - - &block_number - name: block_number - description: 'Block number' - - &token_bought_symbol - name: token_bought_symbol - description: "Token symbol for token bought in the trade" - - &token_sold_symbol - name: token_sold_symbol - description: "Token symbol for token sold in the trade" - - &token_pair - name: token_pair - description: "Token symbol pair for each token involved in the trade" - - &token_bought_amount - name: token_bought_amount - description: "Value of the token bought at time of execution in the original currency" - - &token_sold_amount - name: token_sold_amount - description: "Value of the token sold at time of execution in the original currency" - - &token_bought_amount_raw - name: token_bought_amount_raw - description: "Raw value of the token bought at time of execution in the original currency" - - &token_sold_amount_raw - name: token_sold_amount_raw - description: "Raw value of the token sold at time of execution in the original currency" - - &amount_usd - name: amount_usd - description: "USD value of the trade at time of execution" - - &token_bought_address - name: token_bought_address - description: "Contract address of the token bought" - - &token_sold_address - name: token_sold_address - description: "Contract address of the token sold" - - &taker - name: taker - description: "Address of trader who purchased a token" - - &maker - name: maker - description: "Address of trader who sold a token" - - &pool_id - name: pool_id - description: "Unique encoded identifier that refers to each pool" - - &swap_fee - name: swap_fee - description: 'Swap fee' - - &project_contract_address - name: project_contract_address - description: "Pool address" - - &pool_symbol - name: pool_symbol - description: "Token symbols, followed by their respective weights, if applicable" - - &pool_type - name: pool_type - description: "Pool attributes, determined by the pool's factory" - - &tx_hash - name: tx_hash - description: "Tx. Hash" - - &tx_from - name: tx_from - description: "transaction.from" - - &tx_to - name: tx_to - description: "transaction.to" - - &evt_index - name: evt_index - description: 'Event index' - - - name: balancer_v2_base_trades - meta: - blockchain: base - sector: dex - contributors: bizzyvinci, thetroyharris, tomfutago, viniabussafi - config: - tags: [ 'balancer', 'base', 'amm', 'trades', 'dex', 'beta' ] - description: > - DEX trades on balancer v2 on base - columns: - - *blockchain - - *project - - *version - - *block_month - - *block_date - - *block_time - - *block_number - - *token_bought_symbol - - *token_sold_symbol - - *token_pair - - *token_bought_amount - - *token_sold_amount - - *token_bought_amount_raw - - *token_sold_amount_raw - - *amount_usd - - *token_bought_address - - *token_sold_address - - *taker - - *maker - - *project_contract_address - - *pool_symbol - - *pool_type - - *pool_id - - *swap_fee - - *tx_hash - - *tx_from - - *tx_to - - *evt_index \ No newline at end of file diff --git a/models/_project/balancer/trades/ethereum/_schema.yml b/models/_project/balancer/trades/ethereum/_schema.yml deleted file mode 100644 index 42d29d7e17d..00000000000 --- a/models/_project/balancer/trades/ethereum/_schema.yml +++ /dev/null @@ -1,145 +0,0 @@ -version: 2 - -models: - - name: balancer_ethereum_trades - meta: - blockchain: ethereum - sector: dex - contributors: bizzyvinci, thetroyharris, viniabussafi - config: - tags: ['balancer', 'ethereum', 'amm', 'trades', 'dex'] - description: > - DEX trades on balancer on ethereum - columns: - - &blockchain - name: blockchain - description: "Blockchain" - - &project - name: project - description: "Project name (balancer)" - - &version - name: version - description: "Version of the project" - - &block_month - name: block_month - description: "Block month in UTC" - - &block_date - name: block_date - description: "Block date in UTC" - - &block_time - name: block_time - description: 'Block time in UTC' - - &block_number - name: block_number - description: 'Block number' - - &token_bought_symbol - name: token_bought_symbol - description: "Token symbol for token bought in the trade" - - &token_sold_symbol - name: token_sold_symbol - description: "Token symbol for token sold in the trade" - - &token_pair - name: token_pair - description: "Token symbol pair for each token involved in the trade" - - &token_bought_amount - name: token_bought_amount - description: "Value of the token bought at time of execution in the original currency" - - &token_sold_amount - name: token_sold_amount - description: "Value of the token sold at time of execution in the original currency" - - &token_bought_amount_raw - name: token_bought_amount_raw - description: "Raw value of the token bought at time of execution in the original currency" - - &token_sold_amount_raw - name: token_sold_amount_raw - description: "Raw value of the token sold at time of execution in the original currency" - - &amount_usd - name: amount_usd - description: "USD value of the trade at time of execution" - - &token_bought_address - name: token_bought_address - description: "Contract address of the token bought" - - &token_sold_address - name: token_sold_address - description: "Contract address of the token sold" - - &taker - name: taker - description: "Address of trader who purchased a token" - - &maker - name: maker - description: "Address of trader who sold a token" - - &pool_id - name: pool_id - description: "Unique encoded identifier that refers to each pool" - - &swap_fee - name: swap_fee - description: 'Swap fee' - - &project_contract_address - name: project_contract_address - description: "Pool address" - - &pool_symbol - name: pool_symbol - description: "Token symbols, followed by their respective weights, if applicable" - - &pool_type - name: pool_type - description: "Pool attributes, determined by the pool's factory" - - &tx_hash - name: tx_hash - description: "Tx. Hash" - - &tx_from - name: tx_from - description: "transaction.from" - - &tx_to - name: tx_to - description: "transaction.to" - - &evt_index - name: evt_index - description: 'Event index' - - - name: balancer_v1_ethereum_trades - meta: - blockchain: ethereum - sector: dex - contributors: bizzyvinci, thetroyharris, viniabussafi - config: - tags: [ 'balancer', 'ethereum', 'amm', 'trades', 'dex' ] - description: > - DEX trades on balancer v1 on ethereum - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - block_time - - tx_hash - - evt_index - - check_dex_seed: - blockchain: ethereum - project: balancer - version: 1 - columns: - - *blockchain - - *project - - *version - - *block_month - - *block_date - - *block_time - - *token_bought_symbol - - *token_sold_symbol - - *token_pair - - *token_bought_amount - - *token_sold_amount - - *token_bought_amount_raw - - *token_sold_amount_raw - - *amount_usd - - *token_bought_address - - *token_sold_address - - *taker - - *maker - - *pool_id - - *swap_fee - - *project_contract_address - - *pool_symbol - - *pool_type - - *tx_hash - - *tx_from - - *tx_to - - *evt_index \ No newline at end of file diff --git a/models/_project/balancer/trades/gnosis/_schema.yml b/models/_project/balancer/trades/gnosis/_schema.yml deleted file mode 100644 index ae5ae4065a2..00000000000 --- a/models/_project/balancer/trades/gnosis/_schema.yml +++ /dev/null @@ -1,149 +0,0 @@ -version: 2 - -models: - - name: balancer_gnosis_trades - meta: - blockchain: gnosis - sector: dex - contributors: bizzyvinci, viniabussafi - config: - tags: ['balancer', 'gnosis', 'amm', 'trades', 'dex'] - description: > - DEX trades on balancer on gnosis - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - block_date - - blockchain - - project - - version - - tx_hash - - evt_index - - check_dex_seed: - blockchain: gnosis - project: balancer - version: 2 - columns: - - &blockchain - name: blockchain - description: "Blockchain" - - &project - name: project - description: "Project name (balancer)" - - &version - name: version - description: "Version of the project" - - &block_month - name: block_month - description: "Block month in UTC" - - &block_date - name: block_date - description: "Block date in UTC" - - &block_time - name: block_time - description: 'Block time in UTC' - - &block_number - name: block_number - description: 'Block number' - - &token_bought_symbol - name: token_bought_symbol - description: "Token symbol for token bought in the trade" - - &token_sold_symbol - name: token_sold_symbol - description: "Token symbol for token sold in the trade" - - &token_pair - name: token_pair - description: "Token symbol pair for each token involved in the trade" - - &token_bought_amount - name: token_bought_amount - description: "Value of the token bought at time of execution in the original currency" - - &token_sold_amount - name: token_sold_amount - description: "Value of the token sold at time of execution in the original currency" - - &token_bought_amount_raw - name: token_bought_amount_raw - description: "Raw value of the token bought at time of execution in the original currency" - - &token_sold_amount_raw - name: token_sold_amount_raw - description: "Raw value of the token sold at time of execution in the original currency" - - &amount_usd - name: amount_usd - description: "USD value of the trade at time of execution" - - &token_bought_address - name: token_bought_address - description: "Contract address of the token bought" - - &token_sold_address - name: token_sold_address - description: "Contract address of the token sold" - - &taker - name: taker - description: "Address of trader who purchased a token" - - &maker - name: maker - description: "Address of trader who sold a token" - - &pool_id - name: pool_id - description: "Unique encoded identifier that refers to each pool" - - &swap_fee - name: swap_fee - description: 'Swap fee' - - &project_contract_address - name: project_contract_address - description: "Pool address" - - &pool_symbol - name: pool_symbol - description: "Token symbols, followed by their respective weights, if applicable" - - &pool_type - name: pool_type - description: "Pool attributes, determined by the pool's factory" - - &tx_hash - name: tx_hash - description: "Tx. Hash" - - &tx_from - name: tx_from - description: "transaction.from" - - &tx_to - name: tx_to - description: "transaction.to" - - &evt_index - name: evt_index - description: 'Event index' - - - name: balancer_v2_gnosis_trades - meta: - blockchain: gnosis - sector: dex - contributors: bizzyvinci, thetroyharris, tomfutago, viniabussafi - config: - tags: [ 'balancer', 'gnosis', 'amm', 'trades', 'dex', 'beta' ] - description: > - DEX trades on balancer v2 on gnosis - columns: - - *blockchain - - *project - - *version - - *block_month - - *block_date - - *block_time - - *block_number - - *token_bought_symbol - - *token_sold_symbol - - *token_pair - - *token_bought_amount - - *token_sold_amount - - *token_bought_amount_raw - - *token_sold_amount_raw - - *amount_usd - - *token_bought_address - - *token_sold_address - - *taker - - *maker - - *project_contract_address - - *pool_symbol - - *pool_type - - *pool_id - - *swap_fee - - *tx_hash - - *tx_from - - *tx_to - - *evt_index \ No newline at end of file diff --git a/models/_project/balancer/trades/optimism/_schema.yml b/models/_project/balancer/trades/optimism/_schema.yml deleted file mode 100644 index 481a7f9073b..00000000000 --- a/models/_project/balancer/trades/optimism/_schema.yml +++ /dev/null @@ -1,149 +0,0 @@ -version: 2 - -models: - - name: balancer_optimism_trades - meta: - blockchain: optimism - sector: dex - contributors: bizzyvinci, viniabussafi - config: - tags: ['balancer', 'optimism', 'amm', 'trades', 'dex'] - description: > - DEX trades on balancer on optimism - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - block_date - - blockchain - - project - - version - - tx_hash - - evt_index - - check_dex_seed: - blockchain: optimism - project: balancer - version: 2 - columns: - - &blockchain - name: blockchain - description: "Blockchain" - - &project - name: project - description: "Project name (balancer)" - - &version - name: version - description: "Version of the project" - - &block_month - name: block_month - description: "Block month in UTC" - - &block_date - name: block_date - description: "Block date in UTC" - - &block_time - name: block_time - description: 'Block time in UTC' - - &block_number - name: block_number - description: 'Block number' - - &token_bought_symbol - name: token_bought_symbol - description: "Token symbol for token bought in the trade" - - &token_sold_symbol - name: token_sold_symbol - description: "Token symbol for token sold in the trade" - - &token_pair - name: token_pair - description: "Token symbol pair for each token involved in the trade" - - &token_bought_amount - name: token_bought_amount - description: "Value of the token bought at time of execution in the original currency" - - &token_sold_amount - name: token_sold_amount - description: "Value of the token sold at time of execution in the original currency" - - &token_bought_amount_raw - name: token_bought_amount_raw - description: "Raw value of the token bought at time of execution in the original currency" - - &token_sold_amount_raw - name: token_sold_amount_raw - description: "Raw value of the token sold at time of execution in the original currency" - - &amount_usd - name: amount_usd - description: "USD value of the trade at time of execution" - - &token_bought_address - name: token_bought_address - description: "Contract address of the token bought" - - &token_sold_address - name: token_sold_address - description: "Contract address of the token sold" - - &taker - name: taker - description: "Address of trader who purchased a token" - - &maker - name: maker - description: "Address of trader who sold a token" - - &pool_id - name: pool_id - description: "Unique encoded identifier that refers to each pool" - - &swap_fee - name: swap_fee - description: 'Swap fee' - - &project_contract_address - name: project_contract_address - description: "Pool address" - - &pool_symbol - name: pool_symbol - description: "Token symbols, followed by their respective weights, if applicable" - - &pool_type - name: pool_type - description: "Pool attributes, determined by the pool's factory" - - &tx_hash - name: tx_hash - description: "Tx. Hash" - - &tx_from - name: tx_from - description: "transaction.from" - - &tx_to - name: tx_to - description: "transaction.to" - - &evt_index - name: evt_index - description: 'Event index' - - - name: balancer_v2_optimism_trades - meta: - blockchain: optimism - sector: dex - contributors: bizzyvinci, thetroyharris, tomfutago, viniabussafi - config: - tags: [ 'balancer', 'optimism', 'amm', 'trades', 'dex', 'beta' ] - description: > - DEX trades on balancer v2 on optimism - columns: - - *blockchain - - *project - - *version - - *block_month - - *block_date - - *block_time - - *block_number - - *token_bought_symbol - - *token_sold_symbol - - *token_pair - - *token_bought_amount - - *token_sold_amount - - *token_bought_amount_raw - - *token_sold_amount_raw - - *amount_usd - - *token_bought_address - - *token_sold_address - - *taker - - *maker - - *project_contract_address - - *pool_symbol - - *pool_type - - *pool_id - - *swap_fee - - *tx_hash - - *tx_from - - *tx_to - - *evt_index \ No newline at end of file diff --git a/models/_project/balancer/trades/polygon/_schema.yml b/models/_project/balancer/trades/polygon/_schema.yml deleted file mode 100644 index c0dfa6ac51b..00000000000 --- a/models/_project/balancer/trades/polygon/_schema.yml +++ /dev/null @@ -1,149 +0,0 @@ -version: 2 - -models: - - name: balancer_polygon_trades - meta: - blockchain: polygon - sector: dex - contributors: bizzyvinci, viniabussafi - config: - tags: ['balancer', 'polygon', 'amm', 'trades', 'dex'] - description: > - DEX trades on balancer on polygon - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - block_date - - blockchain - - project - - version - - tx_hash - - evt_index - - check_dex_seed: - blockchain: polygon - project: balancer - version: 2 - columns: - - &blockchain - name: blockchain - description: "Blockchain" - - &project - name: project - description: "Project name (balancer)" - - &version - name: version - description: "Version of the project" - - &block_month - name: block_month - description: "Block month in UTC" - - &block_date - name: block_date - description: "Block date in UTC" - - &block_time - name: block_time - description: 'Block time in UTC' - - &block_number - name: block_number - description: 'Block number' - - &token_bought_symbol - name: token_bought_symbol - description: "Token symbol for token bought in the trade" - - &token_sold_symbol - name: token_sold_symbol - description: "Token symbol for token sold in the trade" - - &token_pair - name: token_pair - description: "Token symbol pair for each token involved in the trade" - - &token_bought_amount - name: token_bought_amount - description: "Value of the token bought at time of execution in the original currency" - - &token_sold_amount - name: token_sold_amount - description: "Value of the token sold at time of execution in the original currency" - - &token_bought_amount_raw - name: token_bought_amount_raw - description: "Raw value of the token bought at time of execution in the original currency" - - &token_sold_amount_raw - name: token_sold_amount_raw - description: "Raw value of the token sold at time of execution in the original currency" - - &amount_usd - name: amount_usd - description: "USD value of the trade at time of execution" - - &token_bought_address - name: token_bought_address - description: "Contract address of the token bought" - - &token_sold_address - name: token_sold_address - description: "Contract address of the token sold" - - &taker - name: taker - description: "Address of trader who purchased a token" - - &maker - name: maker - description: "Address of trader who sold a token" - - &pool_id - name: pool_id - description: "Unique encoded identifier that refers to each pool" - - &swap_fee - name: swap_fee - description: 'Swap fee' - - &project_contract_address - name: project_contract_address - description: "Pool address" - - &pool_symbol - name: pool_symbol - description: "Token symbols, followed by their respective weights, if applicable" - - &pool_type - name: pool_type - description: "Pool attributes, determined by the pool's factory" - - &tx_hash - name: tx_hash - description: "Tx. Hash" - - &tx_from - name: tx_from - description: "transaction.from" - - &tx_to - name: tx_to - description: "transaction.to" - - &evt_index - name: evt_index - description: 'Event index' - - - name: balancer_v2_polygon_trades - meta: - blockchain: polygon - sector: dex - contributors: bizzyvinci, thetroyharris, tomfutago, viniabussafi - config: - tags: [ 'balancer', 'polygon', 'amm', 'trades', 'dex', 'beta' ] - description: > - DEX trades on balancer v2 on polygon - columns: - - *blockchain - - *project - - *version - - *block_month - - *block_date - - *block_time - - *block_number - - *token_bought_symbol - - *token_sold_symbol - - *token_pair - - *token_bought_amount - - *token_sold_amount - - *token_bought_amount_raw - - *token_sold_amount_raw - - *amount_usd - - *token_bought_address - - *token_sold_address - - *taker - - *maker - - *project_contract_address - - *pool_symbol - - *pool_type - - *pool_id - - *swap_fee - - *tx_hash - - *tx_from - - *tx_to - - *evt_index \ No newline at end of file diff --git a/models/_project/balancer/trades/zkevm/_schema.yml b/models/_project/balancer/trades/zkevm/_schema.yml deleted file mode 100644 index 80f42ffe980..00000000000 --- a/models/_project/balancer/trades/zkevm/_schema.yml +++ /dev/null @@ -1,110 +0,0 @@ -version: 2 - -models: - - name: balancer_zkevm_trades - meta: - blockchain: zkevm - sector: dex - contributors: bizzyvinci, viniabussafi - config: - tags: ['balancer', 'zkevm', 'amm', 'trades', 'dex'] - description: > - DEX trades on balancer on zkevm - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - block_date - - blockchain - - project - - version - - tx_hash - - evt_index - - check_dex_seed: - blockchain: zkevm - project: balancer - version: 2 - columns: - - &blockchain - name: blockchain - description: "Blockchain" - - &project - name: project - description: "Project name (balancer)" - - &version - name: version - description: "Version of the project" - - &block_month - name: block_month - description: "Block month in UTC" - - &block_date - name: block_date - description: "Block date in UTC" - - &block_time - name: block_time - description: 'Block time in UTC' - - &block_number - name: block_number - description: 'Block number' - - &token_bought_symbol - name: token_bought_symbol - description: "Token symbol for token bought in the trade" - - &token_sold_symbol - name: token_sold_symbol - description: "Token symbol for token sold in the trade" - - &token_pair - name: token_pair - description: "Token symbol pair for each token involved in the trade" - - &token_bought_amount - name: token_bought_amount - description: "Value of the token bought at time of execution in the original currency" - - &token_sold_amount - name: token_sold_amount - description: "Value of the token sold at time of execution in the original currency" - - &token_bought_amount_raw - name: token_bought_amount_raw - description: "Raw value of the token bought at time of execution in the original currency" - - &token_sold_amount_raw - name: token_sold_amount_raw - description: "Raw value of the token sold at time of execution in the original currency" - - &amount_usd - name: amount_usd - description: "USD value of the trade at time of execution" - - &token_bought_address - name: token_bought_address - description: "Contract address of the token bought" - - &token_sold_address - name: token_sold_address - description: "Contract address of the token sold" - - &taker - name: taker - description: "Address of trader who purchased a token" - - &maker - name: maker - description: "Address of trader who sold a token" - - &pool_id - name: pool_id - description: "Unique encoded identifier that refers to each pool" - - &swap_fee - name: swap_fee - description: 'Swap fee' - - &project_contract_address - name: project_contract_address - description: "Pool address" - - &pool_symbol - name: pool_symbol - description: "Token symbols, followed by their respective weights, if applicable" - - &pool_type - name: pool_type - description: "Pool attributes, determined by the pool's factory" - - &tx_hash - name: tx_hash - description: "Tx. Hash" - - &tx_from - name: tx_from - description: "transaction.from" - - &tx_to - name: tx_to - description: "transaction.to" - - &evt_index - name: evt_index - description: 'Event index' \ No newline at end of file diff --git a/models/_project/balancer/vebal/ethereum/_schema.yml b/models/_project/balancer/vebal/ethereum/_schema.yml deleted file mode 100644 index ab2ba4d4bdf..00000000000 --- a/models/_project/balancer/vebal/ethereum/_schema.yml +++ /dev/null @@ -1,91 +0,0 @@ -version: 2 - -models: - - name: balancer_ethereum_vebal_balances_day - meta: - blockchain: ethereum - project: balancer - contributors: markusbkoch, mendesfabio, victorstefenon, viniabussafi - config: - tags: ['balancer', 'ethereum', 'vebal', 'day'] - description: > - Daily balances of veBAL per wallet - Depends on veBAL_call_create_lock, veBAL_evt_Deposit and veBAL_evt_Withdraw - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - day - - wallet_address - columns: - - name: day - - name: wallet_address - description: "Address of the wallet holding the veBAL" - - name: bpt_balance - description: "Amount of BPT held in the veBAL lock" - - name: vebal_balance - description: "Amount of veBAL" - - name: lock_time - description: "Amount of time the BPT was locked for at the last time the lock was updated" - - - name: balancer_ethereum_vebal_slopes - meta: - blockchain: ethereum - project: balancer - contributors: markusbkoch, mendesfabio, victorstefenon, viniabussafi - config: - tags: ['balancer', 'ethereum', 'vebal', 'slope'] - description: > - Slope and bias of veBAL per wallet after each balance update - Depends on veBAL_call_create_lock, veBAL_evt_Deposit and veBAL_evt_Withdraw - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - block_number - - wallet_address - columns: - - name: block_number - - name: block_time - - name: block_timestamp - description: "Block timestamp" - - name: wallet_address - description: "Address of the wallet holding the veBAL" - - name: bpt_balance - description: "Amount of BPT held in the veBAL lock" - - name: unlocked_at - description: "Timestamp at which B-80BAL-20WETH BPT can be unlocked" - - name: slope - description: "veBAL decay rate (per second)" - - name: bias - description: "veBAL balance at the moment user locks or re-locks" - - name: block_date - description: "Block time trunc to date" - - - name: balancer_ethereum_vebal_votes - meta: - blockchain: ethereum - project: balancer - contributors: markusbkoch, mendesfabio, stefenon, viniabussafi - config: - tags: ['balancer', 'ethereum', 'vebal', 'votes'] - description: > - Records of votes for Balancer gauges by provider at each voting round - Depends on GaugeController_evt_VoteForGauge and the vebal_slopes spell - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - round_id - - gauge - - provider - columns: - - name: round_id - description: "ID of the voting round" - - name: start_date - description: "Day of the voting round start date" - - name: end_date - description: "Day of the voting round end date" - - name: gauge - description: "Address of the gauge which provider votes for" - - name: provider - description: "Address of the wallet which voted for the gauge" - - name: vote - description: "Weight of the vote performed by the provider for the gauge" \ No newline at end of file diff --git a/models/_project/balancer/pools/arbitrum/balancer_arbitrum_pools_tokens_weights.sql b/models/balancer/arbitrum/balancer_arbitrum_pools_tokens_weights.sql similarity index 100% rename from models/_project/balancer/pools/arbitrum/balancer_arbitrum_pools_tokens_weights.sql rename to models/balancer/arbitrum/balancer_arbitrum_pools_tokens_weights.sql diff --git a/models/balancer/arbitrum/balancer_arbitrum_schema.yml b/models/balancer/arbitrum/balancer_arbitrum_schema.yml new file mode 100644 index 00000000000..c533ff3ff10 --- /dev/null +++ b/models/balancer/arbitrum/balancer_arbitrum_schema.yml @@ -0,0 +1,432 @@ +version: 2 + +models: + - name: balancer_v2_arbitrum_pools_fees + meta: + blockchain: arbitrum + project: balancer_v2 + contributors: jacektrocinski, thetroyharris, viniabussafi + config: + tags: ['arbitrum', 'balancer', 'pools_fees'] + description: > + Balancer v2 swap fees stored at the pool level. + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - block_number + - tx_hash + - index + columns: + - name: blockchain + - name: version + - &contract_address + name: contract_address + description: 'Arbitrum address for the liquidity pool used in transaction' + tests: + - not_null + - &tx_hash + name: tx_hash + description: 'Transaction hash' + tests: + - not_null + - &index + name: index + description: '' + tests: + - not_null + - &tx_index + name: tx_index + description: '' + tests: + - not_null + - &block_time + name: block_time + description: 'Block time in UTC' + tests: + - not_null + - &block_number + name: block_number + description: '' + tests: + - not_null + - &swap_fee_percentage + name: swap_fee_percentage + description: 'Swap fees for the pool, values are returned with 18 decimals (1e18 meaning 100%)' + tests: + - not_null + + - name: balancer_v2_arbitrum_transfers_bpt + meta: + blockchain: arbitrum + project: balancer_v2 + contributors: victorstefenon, thetroyharris, viniabussafi + config: + tags: ['arbitrum', 'bpt', 'transfers'] + description: > + Balancer Pool Token (BPT) transfer logs on Balancer, an automated portfolio manager and trading platform, on Arbitrum. + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - evt_tx_hash + - evt_index + - block_date + columns: + - &blockchain + name: blockchain + description: "Blockchain" + - name: version + - *contract_address + - &block_date + name: block_date + description: "UTC event block date of each DEX trade" + - &block_month + name: block_month + description: "UTC event block month of each DEX trade" + - &evt_tx_hash + name: evt_tx_hash + description: 'Transaction hash of transfer event' + - &evt_index + name: evt_index + description: 'Event index' + - &evt_block_time + name: evt_block_time + description: 'Block time of transfer event' + - &evt_block_number + name: evt_block_number + description: 'Block number of transfer event' + - &from + name: from + description: 'Address of BPT provider of transfer event' + - &to + name: to + description: 'Address of BPT receiver of transfer event' + - &value + name: value + description: 'Amount of BPT transferred in transfer event' + + - name: balancer_arbitrum_pools_tokens_weights + meta: + blockchain: arbitrum + project: balancer + contributors: jacektrocinski, viniabussafi + config: + tags: ['arbitrum', 'balancer', 'pools', 'tokens', 'weights'] + description: > + Token weights in Balancer pools. + columns: + - *blockchain + - name: version + - &pool_id + name: pool_id + description: 'Unique encoded identifier that refers to each pool' + tests: + - not_null + - &token_address + name: token_address + description: 'Contract address for the token' + - &normalized_weight + name: normalized_weight + description: 'Weight of the token in the pool.' + + - name: balancer_v2_arbitrum_pools_tokens_weights + meta: + blockchain: arbitrum + project: balancer + contributors: jacektrocinski, viniabussafi + config: + tags: ['arbitrum', 'balancer', 'pools', 'tokens', 'weights'] + description: > + Token weights in Balancer v2 pools. + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - pool_id + - token_address + columns: + - *blockchain + - name: version + - *pool_id + - *token_address + - *normalized_weight + + - name: balancer_arbitrum_trades + meta: + blockchain: arbitrum + sector: dex + contributors: bizzyvinci + config: + tags: ['balancer', 'arbitrum', 'amm', 'trades', 'dex'] + description: > + DEX trades on balancer on arbitrum + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - block_date + - blockchain + - project + - version + - tx_hash + - evt_index + - check_dex_seed: + blockchain: arbitrum + project: balancer + version: 2 + columns: + - *blockchain + - &project + name: project + description: "Project name (balancer)" + - &version + name: version + description: "Version of the project" + - *block_month + - *block_date + - *block_time + - &token_bought_symbol + name: token_bought_symbol + description: "Token symbol for token bought in the trade" + - &token_sold_symbol + name: token_sold_symbol + description: "Token symbol for token sold in the trade" + - &token_pair + name: token_pair + description: "Token symbol pair for each token involved in the trade" + - &token_bought_amount + name: token_bought_amount + description: "Value of the token bought at time of execution in the original currency" + - &token_sold_amount + name: token_sold_amount + description: "Value of the token sold at time of execution in the original currency" + - &token_bought_amount_raw + name: token_bought_amount_raw + description: "Raw value of the token bought at time of execution in the original currency" + - &token_sold_amount_raw + name: token_sold_amount_raw + description: "Raw value of the token sold at time of execution in the original currency" + - &amount_usd + name: amount_usd + description: "USD value of the trade at time of execution" + - &token_bought_address + name: token_bought_address + description: "Contract address of the token bought" + - &token_sold_address + name: token_sold_address + description: "Contract address of the token sold" + - &taker + name: taker + description: "Address of trader who purchased a token" + - &maker + name: maker + description: "Address of trader who sold a token" + - *pool_id + - &swap_fee + name: swap_fee + description: 'Swap fee' + - &project_contract_address + name: project_contract_address + description: "Pool address" + - name: pool_symbol + - name: pool_type + - *tx_hash + - &tx_from + name: tx_from + description: "transaction.from" + - &tx_to + name: tx_to + description: "transaction.to" + - *evt_index + + - name: balancer_v2_arbitrum_trades + meta: + blockchain: arbitrum + sector: dex + contributors: bizzyvinci, thetroyharris, tomfutago, viniabussafi + config: + tags: [ 'balancer', 'arbitrum', 'amm', 'trades', 'dex', 'beta' ] + description: > + DEX trades on balancer v2 on arbitrum + columns: + - *blockchain + - *project + - *version + - *block_month + - *block_date + - *block_time + - *block_number + - *token_bought_symbol + - *token_sold_symbol + - *token_pair + - *token_bought_amount + - *token_sold_amount + - *token_bought_amount_raw + - *token_sold_amount_raw + - *amount_usd + - *token_bought_address + - *token_sold_address + - *taker + - *maker + - *project_contract_address + - name: pool_symbol + - name: pool_type + - *pool_id + - *swap_fee + - *tx_hash + - *tx_from + - *tx_to + - *evt_index + + - name: balancer_v2_arbitrum_liquidity + meta: + blockchain: arbitrum + project: balancer_v2 + contributors: victorstefenon, viniabussafi, thetroyharris + config: + tags: ['arbitrum', 'balancer', 'pools', 'liquidity'] + description: > + Balancer v2 pools liquidity by token in Arbitrum. + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - day + - pool_id + - token_address + columns: + - name: day + description: 'UTC event block time truncated to the day mark' + - *pool_id + - name: pool_address + - name: pool_symbol + description: 'Symbol of the pool, consisting of the symbol of its tokens and their respective weights' + - name: version + description: 'Version of Balancer in which pool was deployed' + - name: blockchain + description: 'Blockchain in which pool was deployed' + - *token_address + - name: token_symbol + description: 'Symbol of the token' + - name: token_balance_raw + description: 'Raw balance of the token in the pool' + - name: token_balance + description: 'Scaled balance of the token in the pool' + - name: protocol_liquidity_usd + description: 'Liquidity of the token in the pool in USD, except BPTs' + - name: protocol_liquidity_eth + description: 'Liquidity of the token in the pool in ETH, except BPTs' + - name: pool_liquidity_usd + description: 'Liquidity of the token in the pool in USD, including BPTs' + - name: pool_liquidity_eth + description: 'Liquidity of the token in the pool in ETH, including BPTs' + + + - name: balancer_v2_arbitrum_flashloans + meta: + blockchain: arbitrum + sector: lending + contributors: hildobby + config: + tags: ['arbitrum', 'flashloans'] + description: > + All Balancer v2 flashloans on Arbitrum + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - blockchain + - tx_hash + - evt_index + columns: + - name: blockchain + - name: project + - name: version + - name: block_time + - name: block_number + - name: amount + - name: amount_usd + - name: tx_hash + - name: evt_index + - name: fee + - name: currency_contract + - name: currency_symbol + - name: recipient + - name: contract_address + - name: block_month + + - name: balancer_v2_arbitrum_bpt_prices + meta: + blockchain: arbitrum + project: balancer_v2 + contributors: victorstefenon, thetroyharris, viniabussafi + config: + tags: ['arbitrum', 'bpt', 'prices'] + description: > + Balancer Pool Token (BPT) daily price by pool on Balancer, an automated portfolio manager and trading platform. + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - blockchain + - day + - contract_address + columns: + - name: blockchain + - name: day + - name: version + - name: decimals + - name: contract_address + - name: bpt_price + + - name: balancer_v2_arbitrum_protocol_fee + meta: + blockchain: arbitrum + project: balancer_v2 + contributors: viniabussafi + config: + tags: ['arbitrum', 'revenue', 'fees'] + description: > + Daily Protocol Fee collected and Revenue by pool on Balancer, an automated portfolio manager and trading platform. + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - day + - pool_id + - token_address + columns: + - name: day + - name: pool_id + - name: pool_address + - name: pool_symbol + - name: version + - name: blockchain + - name: token_address + - name: token_symbol + - name: token_amount_raw + description: "Raw amount of revenues of the token in the pool" + - name: token_amount + description: "Amount of revenues of the token in the pool" + - name: protocol_fee_collected_usd + description: "Fee collected in the pool in USD" + - name: treasury_share + description: "Share of total revenue that is directed to Balancer DAO's treasury, as per BIPs 19, 161 and 371" + - name: treasury_revenue_usd + description: "Total revenue directed to Balancer DAO's treasury" + + - name: balancer_v2_arbitrum_bpt_supply + meta: + blockchain: arbiturm + project: balancer_v2 + contributors: thetroyharris, viniabussafi + config: + tags: ['arbiturm', 'bpt', 'supply'] + description: > + Balancer Pool Token (BPT) supply for ComposableStablePools versions 4 and 5. + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - day + - blockchain + - token_address + columns: + - name: day + - name: pool_type + - name: version + - name: blockchain + - name: token_address + - name: supply \ No newline at end of file diff --git a/models/_project/balancer/trades/arbitrum/balancer_arbitrum_trades.sql b/models/balancer/arbitrum/balancer_arbitrum_trades.sql similarity index 100% rename from models/_project/balancer/trades/arbitrum/balancer_arbitrum_trades.sql rename to models/balancer/arbitrum/balancer_arbitrum_trades.sql diff --git a/models/_project/balancer/bpt/arbitrum/balancer_v2_arbitrum_bpt_prices.sql b/models/balancer/arbitrum/balancer_v2_arbitrum_bpt_prices.sql similarity index 100% rename from models/_project/balancer/bpt/arbitrum/balancer_v2_arbitrum_bpt_prices.sql rename to models/balancer/arbitrum/balancer_v2_arbitrum_bpt_prices.sql diff --git a/models/_project/balancer/bpt/arbitrum/balancer_v2_arbitrum_bpt_supply.sql b/models/balancer/arbitrum/balancer_v2_arbitrum_bpt_supply.sql similarity index 100% rename from models/_project/balancer/bpt/arbitrum/balancer_v2_arbitrum_bpt_supply.sql rename to models/balancer/arbitrum/balancer_v2_arbitrum_bpt_supply.sql diff --git a/models/_project/balancer/flashloans/arbitrum/balancer_v2_arbitrum_flashloans.sql b/models/balancer/arbitrum/balancer_v2_arbitrum_flashloans.sql similarity index 88% rename from models/_project/balancer/flashloans/arbitrum/balancer_v2_arbitrum_flashloans.sql rename to models/balancer/arbitrum/balancer_v2_arbitrum_flashloans.sql index bf21ac0ece7..52ec11d81ee 100644 --- a/models/_project/balancer/flashloans/arbitrum/balancer_v2_arbitrum_flashloans.sql +++ b/models/balancer/arbitrum/balancer_v2_arbitrum_flashloans.sql @@ -6,6 +6,10 @@ , file_format = 'delta' , incremental_strategy = 'merge' , unique_key = ['tx_hash', 'evt_index'] + , post_hook='{{ expose_spells(\'["arbitrum"]\', + "project", + "balancer_v2", + \'["hildobby"]\') }}' ) }} diff --git a/models/_project/balancer/liquidity/arbitrum/balancer_v2_arbitrum_liquidity.sql b/models/balancer/arbitrum/balancer_v2_arbitrum_liquidity.sql similarity index 52% rename from models/_project/balancer/liquidity/arbitrum/balancer_v2_arbitrum_liquidity.sql rename to models/balancer/arbitrum/balancer_v2_arbitrum_liquidity.sql index c32f49c73ac..c78ddea2ad7 100644 --- a/models/_project/balancer/liquidity/arbitrum/balancer_v2_arbitrum_liquidity.sql +++ b/models/balancer/arbitrum/balancer_v2_arbitrum_liquidity.sql @@ -6,7 +6,11 @@ schema = 'balancer_v2_arbitrum', alias = 'liquidity', materialized = 'table', - file_format = 'delta' + file_format = 'delta', + post_hook="{{ expose_spells('[\"" + blockchain + '"]' + '\', + "project", + "balancer_v2", + \'["stefenon", "viniabussafi"]\') }}' ) }} diff --git a/models/_project/balancer/pools/arbitrum/balancer_v2_arbitrum_pools_fees.sql b/models/balancer/arbitrum/balancer_v2_arbitrum_pools_fees.sql similarity index 75% rename from models/_project/balancer/pools/arbitrum/balancer_v2_arbitrum_pools_fees.sql rename to models/balancer/arbitrum/balancer_v2_arbitrum_pools_fees.sql index 39b5671f202..105650c0b9b 100644 --- a/models/_project/balancer/pools/arbitrum/balancer_v2_arbitrum_pools_fees.sql +++ b/models/balancer/arbitrum/balancer_v2_arbitrum_pools_fees.sql @@ -1,12 +1,17 @@ {{ config( - schema = 'balancer_v2_arbitrum', + schema = 'balancer_v2_arbitrum', + alias = 'pools_fees', materialized = 'incremental', file_format = 'delta', incremental_strategy = 'merge', - unique_key = ['block_number', 'tx_hash', 'index'] - ) + unique_key = ['block_number', 'tx_hash', 'index'], + post_hook='{{ expose_spells(\'["arbitrum"]\', + "project", + "balancer_v2", + \'["metacrypto", "jacektrocinski", "thetroyharris", "viniabussafi"]\') }}' + )  }} {% set event_signature = '0xa9ba3ffe0b6c366b81232caab38605a0699ad5398d6cce76f91ee809e322dafc' %} diff --git a/models/_project/balancer/pools/arbitrum/balancer_v2_arbitrum_pools_tokens_weights.sql b/models/balancer/arbitrum/balancer_v2_arbitrum_pools_tokens_weights.sql similarity index 99% rename from models/_project/balancer/pools/arbitrum/balancer_v2_arbitrum_pools_tokens_weights.sql rename to models/balancer/arbitrum/balancer_v2_arbitrum_pools_tokens_weights.sql index ae20e0126b1..16ee7481c9b 100644 --- a/models/_project/balancer/pools/arbitrum/balancer_v2_arbitrum_pools_tokens_weights.sql +++ b/models/balancer/arbitrum/balancer_v2_arbitrum_pools_tokens_weights.sql @@ -2,6 +2,7 @@ config( schema='balancer_v2_arbitrum', alias = 'pools_tokens_weights', + materialized = 'incremental', file_format = 'delta', incremental_strategy = 'merge', diff --git a/models/_project/balancer/protocol_fee/arbitrum/balancer_v2_arbitrum_protocol_fee.sql b/models/balancer/arbitrum/balancer_v2_arbitrum_protocol_fee.sql similarity index 100% rename from models/_project/balancer/protocol_fee/arbitrum/balancer_v2_arbitrum_protocol_fee.sql rename to models/balancer/arbitrum/balancer_v2_arbitrum_protocol_fee.sql diff --git a/models/_project/balancer/trades/arbitrum/balancer_v2_arbitrum_trades.sql b/models/balancer/arbitrum/balancer_v2_arbitrum_trades.sql similarity index 94% rename from models/_project/balancer/trades/arbitrum/balancer_v2_arbitrum_trades.sql rename to models/balancer/arbitrum/balancer_v2_arbitrum_trades.sql index 2baa6afd2b2..750f467f653 100644 --- a/models/_project/balancer/trades/arbitrum/balancer_v2_arbitrum_trades.sql +++ b/models/balancer/arbitrum/balancer_v2_arbitrum_trades.sql @@ -4,9 +4,9 @@ alias = 'trades', materialized = 'view', post_hook = '{{ expose_spells(\'["arbitrum"]\', - spell_type = "project", - spell_name = "balancer", - contributors = \'["mendesfabio", "jacektrocinski", "thetroyharris", "tomfutago", "viniabussafi"]\') }}' + "project", + "balancer_v2", + \'["mendesfabio", "jacektrocinski", "thetroyharris", "tomfutago", "viniabussafi"]\') }}' ) }} diff --git a/models/_project/balancer/bpt/arbitrum/balancer_v2_arbitrum_transfers_bpt.sql b/models/balancer/arbitrum/balancer_v2_arbitrum_transfers_bpt.sql similarity index 100% rename from models/_project/balancer/bpt/arbitrum/balancer_v2_arbitrum_transfers_bpt.sql rename to models/balancer/arbitrum/balancer_v2_arbitrum_transfers_bpt.sql diff --git a/models/_project/balancer/pools/avalanche_c/balancer_avalanche_c_pools_tokens_weights.sql b/models/balancer/avalanche_c/balancer_avalanche_c_pools_tokens_weights.sql similarity index 100% rename from models/_project/balancer/pools/avalanche_c/balancer_avalanche_c_pools_tokens_weights.sql rename to models/balancer/avalanche_c/balancer_avalanche_c_pools_tokens_weights.sql diff --git a/models/balancer/avalanche_c/balancer_avalanche_c_schema.yml b/models/balancer/avalanche_c/balancer_avalanche_c_schema.yml new file mode 100644 index 00000000000..93cc2e87629 --- /dev/null +++ b/models/balancer/avalanche_c/balancer_avalanche_c_schema.yml @@ -0,0 +1,405 @@ +version: 2 + +models: + + - name: balancer_avalanche_c_trades + meta: + blockchain: avalanche_c + sector: dex + contributors: bizzyvinci + config: + tags: ['balancer', 'avalanche_c', 'amm', 'trades', 'dex'] + description: > + DEX trades on balancer on avalanche_c + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - block_date + - blockchain + - project + - version + - tx_hash + - evt_index + - check_dex_seed: + blockchain: avalanche_c + project: balancer + version: 2 + columns: + - &blockchain + name: blockchain + description: "Blockchain" + - &project + name: project + description: "Project name (balancer)" + - &version + name: version + description: "Version of the project" + - &block_month + name: block_month + description: "Block month in UTC" + - &block_date + name: block_date + description: "Block date in UTC" + - &block_time + name: block_time + description: 'Block time in UTC' + - &token_bought_symbol + name: token_bought_symbol + description: "Token symbol for token bought in the trade" + - &token_sold_symbol + name: token_sold_symbol + description: "Token symbol for token sold in the trade" + - &token_pair + name: token_pair + description: "Token symbol pair for each token involved in the trade" + - &token_bought_amount + name: token_bought_amount + description: "Value of the token bought at time of execution in the original currency" + - &token_sold_amount + name: token_sold_amount + description: "Value of the token sold at time of execution in the original currency" + - &token_bought_amount_raw + name: token_bought_amount_raw + description: "Raw value of the token bought at time of execution in the original currency" + - &token_sold_amount_raw + name: token_sold_amount_raw + description: "Raw value of the token sold at time of execution in the original currency" + - &amount_usd + name: amount_usd + description: "USD value of the trade at time of execution" + - &token_bought_address + name: token_bought_address + description: "Contract address of the token bought" + - &token_sold_address + name: token_sold_address + description: "Contract address of the token sold" + - &taker + name: taker + description: "Address of trader who purchased a token" + - &maker + name: maker + description: "Address of trader who sold a token" + - &pool_id + name: pool_id + description: 'Unique encoded identifier that refers to each pool' + - &swap_fee + name: swap_fee + description: 'Swap fee' + - &project_contract_address + name: project_contract_address + description: "Pool address" + - name: pool_symbol + - name: pool_type + - &tx_hash + name: tx_hash + description: "Transaction hash" + - &tx_from + name: tx_from + description: "transaction.from" + - &tx_to + name: tx_to + description: "transaction.to" + - &evt_index + name: evt_index + description: "Event index" + + - name: balancer_v2_avalanche_c_trades + meta: + blockchain: avalanche_c + sector: dex + contributors: bizzyvinci, thetroyharris, tomfutago, viniabussafi + config: + tags: [ 'balancer', 'avalanche_c', 'amm', 'trades', 'dex', 'beta' ] + description: > + DEX trades on balancer v2 on avalanche_c + columns: + - *blockchain + - *project + - *version + - *block_month + - *block_date + - *block_time + - name: block_number + - *token_bought_symbol + - *token_sold_symbol + - *token_pair + - *token_bought_amount + - *token_sold_amount + - *token_bought_amount_raw + - *token_sold_amount_raw + - *amount_usd + - *token_bought_address + - *token_sold_address + - *taker + - *maker + - *project_contract_address + - name: pool_symbol + - name: pool_type + - *pool_id + - *swap_fee + - *tx_hash + - *tx_from + - *tx_to + - *evt_index + + - name: balancer_avalanche_c_pools_tokens_weights + meta: + blockchain: avalanche_c + project: balancer + contributors: jacektrocinski, viniabussafi + config: + tags: ['avalanche_c', 'balancer', 'pools', 'tokens', 'weights'] + description: > + Token weights in Balancer pools. + columns: + - *blockchain + - name: version + - *pool_id + - &token_address + name: token_address + description: 'Contract address for the token' + - &normalized_weight + name: normalized_weight + description: 'Weight of the token in the pool.' + + - name: balancer_v2_avalanche_c_pools_tokens_weights + meta: + blockchain: avalanche_c + project: balancer + contributors: jacektrocinski, viniabussafi + config: + tags: ['avalanche_c', 'balancer', 'pools', 'tokens', 'weights'] + description: > + Token weights in Balancer v2 pools. + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - pool_id + - token_address + columns: + - *blockchain + - name: version + - *pool_id + - *token_address + - *normalized_weight + + - name: balancer_v2_avalanche_c_liquidity + meta: + blockchain: avalanche_c + project: balancer_v2 + contributors: victorstefenon, viniabussafi, thetroyharris + config: + tags: ['avalanche_c', 'balancer', 'pools', 'liquidity'] + description: > + Balancer v2 pools liquidity by token in avalanche_c. + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - day + - pool_id + - token_address + columns: + - name: day + description: 'UTC event block time truncated to the day mark' + - *pool_id + - name: pool_address + - name: pool_symbol + description: 'Symbol of the pool, consisting of the symbol of its tokens and their respective weights' + - name: version + description: 'Version of Balancer in which pool was deployed' + - name: blockchain + description: 'Blockchain in which pool was deployed' + - *token_address + - name: token_symbol + description: 'Symbol of the token' + - name: token_balance_raw + description: 'Raw balance of the token in the pool' + - name: token_balance + description: 'Scaled balance of the token in the pool' + - name: protocol_liquidity_usd + description: 'Liquidity of the token in the pool in USD, except BPTs' + - name: protocol_liquidity_eth + description: 'Liquidity of the token in the pool in ETH, except BPTs' + - name: pool_liquidity_usd + description: 'Liquidity of the token in the pool in USD, including BPTs' + - name: pool_liquidity_eth + description: 'Liquidity of the token in the pool in ETH, including BPTs' + + + - name: balancer_v2_avalanche_c_bpt_prices + meta: + blockchain: avalanche_c + project: balancer_v2 + contributors: victorstefenon, thetroyharris, viniabussafi + config: + tags: ['avalanche_c', 'bpt', 'prices'] + description: > + Balancer Pool Token (BPT) hourly median price by pool on Balancer, an automated portfolio manager and trading platform. + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - blockchain + - day + - contract_address + columns: + - name: blockchain + - name: day + - name: version + - name: decimals + - name: contract_address + - name: bpt_price + + - name: balancer_v2_avalanche_c_transfers_bpt + meta: + blockchain: avalanche_c + project: balancer_v2 + contributors: victorstefenon, thetroyharris, viniabussafi + config: + tags: ['avalanche_c', 'bpt', 'transfers'] + description: > + Balancer Pool Token (BPT) transfer logs on Balancer, an automated portfolio manager and trading platform, on Avalanche C Chain. + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - evt_tx_hash + - evt_index + - block_date + columns: + - name: blockchain + - name: version + - name: contract_address + - name: block_date + - name: block_month + - name: evt_tx_hash + - name: evt_index + - &evt_block_time + name: evt_block_time + description: 'Block time of transfer event' + - &evt_block_number + name: evt_block_number + description: 'Block number of transfer event' + - &from + name: from + description: 'Address of BPT provider of transfer event' + - &to + name: to + description: 'Address of BPT receiver of transfer event' + - &value + name: value + description: 'Amount of BPT transferred in transfer event' + + - name: balancer_v2_avalanche_c_pools_fees + meta: + blockchain: avalanche_c + project: balancer_v2 + contributors: jacektrocinski, thetroyharris, viniabussafi + config: + tags: ['avalanche_c', 'balancer', 'pools', 'fees'] + description: > + Balancer v2 swap fees stored at the pool level. + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - block_number + - tx_hash + - index + columns: + - name: blockchain + - name: version + - name: contract_address + - name: tx_hash + - name: index + - name: tx_index + - name: block_time + - name: block_number + - name: swap_fee_percentage + + - name: balancer_v2_avalanche_c_flashloans + meta: + blockchain: avalanche_c + sector: lending + contributors: hildobby, viniabussafi + config: + tags: ['avalanche_c', 'flashloans'] + description: > + All Balancer v2 flashloans on avalanche_c + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - blockchain + - tx_hash + - evt_index + columns: + - name: blockchain + - name: project + - name: version + - name: block_time + - name: block_number + - name: amount + - name: amount_usd + - name: tx_hash + - name: evt_index + - name: fee + - name: currency_contract + - name: currency_symbol + - name: recipient + - name: contract_address + - name: block_month + + - name: balancer_v2_avalanche_c_protocol_fee + meta: + blockchain: avalanche_c + project: balancer_v2 + contributors: viniabussafi + config: + tags: ['avalanche_c', 'revenue', 'fees'] + description: > + Daily Protocol Fee collected and Revenue by pool on Balancer, an automated portfolio manager and trading platform. + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - day + - pool_id + - token_address + columns: + - name: day + - name: pool_id + - name: pool_address + - name: pool_symbol + - name: version + - name: blockchain + - name: token_address + - name: token_symbol + - name: token_amount_raw + description: "Raw amount of revenues of the token in the pool" + - name: token_amount + description: "Amount of revenues of the token in the pool" + - name: protocol_fee_collected_usd + description: "Fee collected in the pool in USD" + - name: treasury_share + description: "Share of total revenue that is directed to Balancer DAO's treasury, as per BIPs 19, 161 and 371" + - name: treasury_revenue_usd + description: "Total revenue directed to Balancer DAO's treasury" + + - name: balancer_v2_avalanche_c_bpt_supply + meta: + blockchain: avalanche_c + project: balancer_v2 + contributors: thetroyharris, viniabussafi + config: + tags: ['avalanche_c', 'bpt', 'supply'] + description: > + Balancer Pool Token (BPT) supply for ComposableStablePools versions 4 and 5. + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - day + - blockchain + - token_address + columns: + - name: day + - name: pool_type + - name: version + - name: blockchain + - name: token_address + - name: supply \ No newline at end of file diff --git a/models/_project/balancer/trades/avalanche_c/balancer_avalanche_c_trades.sql b/models/balancer/avalanche_c/balancer_avalanche_c_trades.sql similarity index 100% rename from models/_project/balancer/trades/avalanche_c/balancer_avalanche_c_trades.sql rename to models/balancer/avalanche_c/balancer_avalanche_c_trades.sql diff --git a/models/_project/balancer/bpt/avalanche_c/balancer_v2_avalanche_c_bpt_prices.sql b/models/balancer/avalanche_c/balancer_v2_avalanche_c_bpt_prices.sql similarity index 100% rename from models/_project/balancer/bpt/avalanche_c/balancer_v2_avalanche_c_bpt_prices.sql rename to models/balancer/avalanche_c/balancer_v2_avalanche_c_bpt_prices.sql diff --git a/models/_project/balancer/bpt/avalanche_c/balancer_v2_avalanche_c_bpt_supply.sql b/models/balancer/avalanche_c/balancer_v2_avalanche_c_bpt_supply.sql similarity index 100% rename from models/_project/balancer/bpt/avalanche_c/balancer_v2_avalanche_c_bpt_supply.sql rename to models/balancer/avalanche_c/balancer_v2_avalanche_c_bpt_supply.sql diff --git a/models/_project/balancer/flashloans/avalanche_c/balancer_v2_avalanche_c_flashloans.sql b/models/balancer/avalanche_c/balancer_v2_avalanche_c_flashloans.sql similarity index 88% rename from models/_project/balancer/flashloans/avalanche_c/balancer_v2_avalanche_c_flashloans.sql rename to models/balancer/avalanche_c/balancer_v2_avalanche_c_flashloans.sql index d4ec0d2e79d..eca6b3b0809 100644 --- a/models/_project/balancer/flashloans/avalanche_c/balancer_v2_avalanche_c_flashloans.sql +++ b/models/balancer/avalanche_c/balancer_v2_avalanche_c_flashloans.sql @@ -6,6 +6,10 @@ , file_format = 'delta' , incremental_strategy = 'merge' , unique_key = ['tx_hash', 'evt_index'] + , post_hook='{{ expose_spells(\'["avalanche_c"]\', + "project", + "balancer_v2", + \'["hildobby", "viniabussafi"]\') }}' ) }} diff --git a/models/_project/balancer/liquidity/avalanche_c/balancer_v2_avalanche_c_liquidity.sql b/models/balancer/avalanche_c/balancer_v2_avalanche_c_liquidity.sql similarity index 53% rename from models/_project/balancer/liquidity/avalanche_c/balancer_v2_avalanche_c_liquidity.sql rename to models/balancer/avalanche_c/balancer_v2_avalanche_c_liquidity.sql index 30e2856d411..15b3912d3ee 100644 --- a/models/_project/balancer/liquidity/avalanche_c/balancer_v2_avalanche_c_liquidity.sql +++ b/models/balancer/avalanche_c/balancer_v2_avalanche_c_liquidity.sql @@ -6,7 +6,11 @@ schema = 'balancer_v2_avalanche_c', alias = 'liquidity', materialized = 'table', - file_format = 'delta' + file_format = 'delta', + post_hook="{{ expose_spells('[\"" + blockchain + '"]' + '\', + "project", + "balancer_v2", + \'["stefenon", "viniabussafi"]\') }}' ) }} diff --git a/models/_project/balancer/pools/avalanche_c/balancer_v2_avalanche_c_pools_fees.sql b/models/balancer/avalanche_c/balancer_v2_avalanche_c_pools_fees.sql similarity index 77% rename from models/_project/balancer/pools/avalanche_c/balancer_v2_avalanche_c_pools_fees.sql rename to models/balancer/avalanche_c/balancer_v2_avalanche_c_pools_fees.sql index e3aae2cdf1a..1b52e13c114 100644 --- a/models/_project/balancer/pools/avalanche_c/balancer_v2_avalanche_c_pools_fees.sql +++ b/models/balancer/avalanche_c/balancer_v2_avalanche_c_pools_fees.sql @@ -1,12 +1,17 @@ {{ config( schema = 'balancer_v2_avalanche_c', + alias = 'pools_fees', materialized = 'incremental', file_format = 'delta', incremental_strategy = 'merge', - unique_key = ['block_number', 'tx_hash', 'index'] - ) + unique_key = ['block_number', 'tx_hash', 'index'], + post_hook='{{ expose_spells(\'["avalanche_c"]\', + "project", + "balancer_v2", + \'["metacrypto", "jacektrocinski", "thetroyharris", "viniabussafi"]\') }}' + )  }} {% set event_signature = '0xa9ba3ffe0b6c366b81232caab38605a0699ad5398d6cce76f91ee809e322dafc' %} diff --git a/models/_project/balancer/pools/avalanche_c/balancer_v2_avalanche_c_pools_tokens_weights.sql b/models/balancer/avalanche_c/balancer_v2_avalanche_c_pools_tokens_weights.sql similarity index 99% rename from models/_project/balancer/pools/avalanche_c/balancer_v2_avalanche_c_pools_tokens_weights.sql rename to models/balancer/avalanche_c/balancer_v2_avalanche_c_pools_tokens_weights.sql index 48bbb28e693..730b6b327f5 100644 --- a/models/_project/balancer/pools/avalanche_c/balancer_v2_avalanche_c_pools_tokens_weights.sql +++ b/models/balancer/avalanche_c/balancer_v2_avalanche_c_pools_tokens_weights.sql @@ -2,6 +2,7 @@ config( schema='balancer_v2_avalanche_c', alias = 'pools_tokens_weights', + materialized = 'incremental', file_format = 'delta', incremental_strategy = 'merge', diff --git a/models/_project/balancer/protocol_fee/avalanche_c/balancer_v2_avalanche_c_protocol_fee.sql b/models/balancer/avalanche_c/balancer_v2_avalanche_c_protocol_fee.sql similarity index 100% rename from models/_project/balancer/protocol_fee/avalanche_c/balancer_v2_avalanche_c_protocol_fee.sql rename to models/balancer/avalanche_c/balancer_v2_avalanche_c_protocol_fee.sql diff --git a/models/_project/balancer/trades/avalanche_c/balancer_v2_avalanche_c_trades.sql b/models/balancer/avalanche_c/balancer_v2_avalanche_c_trades.sql similarity index 94% rename from models/_project/balancer/trades/avalanche_c/balancer_v2_avalanche_c_trades.sql rename to models/balancer/avalanche_c/balancer_v2_avalanche_c_trades.sql index d1a0eb61af5..54dfd905dbc 100644 --- a/models/_project/balancer/trades/avalanche_c/balancer_v2_avalanche_c_trades.sql +++ b/models/balancer/avalanche_c/balancer_v2_avalanche_c_trades.sql @@ -4,10 +4,10 @@ alias = 'trades', materialized = 'view', post_hook = '{{ expose_spells(\'["avalanche_c"]\', - spell_type = "project", - spell_name = "balancer", - contributors = \'["mendesfabio", "jacektrocinski", "thetroyharris", "tomfutago", "viniabussafi"]\') }}' - ) + "project", + "balancer_v2", + \'["mendesfabio", "jacektrocinski", "thetroyharris", "tomfutago", "viniabussafi"]\') }}' + ) }} WITH diff --git a/models/_project/balancer/bpt/avalanche_c/balancer_v2_avalanche_c_transfers_bpt.sql b/models/balancer/avalanche_c/balancer_v2_avalanche_c_transfers_bpt.sql similarity index 100% rename from models/_project/balancer/bpt/avalanche_c/balancer_v2_avalanche_c_transfers_bpt.sql rename to models/balancer/avalanche_c/balancer_v2_avalanche_c_transfers_bpt.sql diff --git a/models/_project/balancer/bpt/balancer_bpt_prices.sql b/models/balancer/balancer_bpt_prices.sql similarity index 69% rename from models/_project/balancer/bpt/balancer_bpt_prices.sql rename to models/balancer/balancer_bpt_prices.sql index 0a1180a8013..ad8502801b9 100644 --- a/models/_project/balancer/bpt/balancer_bpt_prices.sql +++ b/models/balancer/balancer_bpt_prices.sql @@ -1,10 +1,10 @@ {{ config( schema = 'balancer', alias = 'bpt_prices', - post_hook='{{ expose_spells(blockchains = \'["arbitrum", "avalanche_c", "base", "ethereum", "gnosis", "optimism", "polygon", "zkevm"]\', - spell_type = "project", - spell_name = "balancer", - contributors = \'["thetroyharris", "viniabussafi"]\') }}' + post_hook='{{ expose_spells(\'["ethereum", "arbitrum", "polygon", "gnosis", "optimism","avalanche_c", "base", "zkevm"]\', + "project", + "balancer", + \'["thetroyharris", "viniabussafi"]\') }}' ) }} diff --git a/models/_project/balancer/bpt/balancer_bpt_supply.sql b/models/balancer/balancer_bpt_supply.sql similarity index 68% rename from models/_project/balancer/bpt/balancer_bpt_supply.sql rename to models/balancer/balancer_bpt_supply.sql index e43ef846b55..a15ed33c911 100644 --- a/models/_project/balancer/bpt/balancer_bpt_supply.sql +++ b/models/balancer/balancer_bpt_supply.sql @@ -1,10 +1,10 @@ {{ config( schema = 'balancer', alias = 'bpt_supply', - post_hook = '{{ expose_spells(blockchains = \'["arbitrum", "avalanche_c", "base", "ethereum", "gnosis", "optimism", "polygon", "zkevm"]\', - spell_type = "project", - spell_name = "balancer", - contributors = \'["thetroyharris", "viniabussafi"]\') }}' + post_hook = '{{ expose_spells(\'["arbitrum", "avalanche_c", "base", "ethereum", "gnosis", "optimism", "polygon", "zkevm"]\', + "project", + "balancer", + \'["thetroyharris", "viniabussafi"]\') }}' ) }} diff --git a/models/_project/balancer/flashloans/balancer_flashloans.sql b/models/balancer/balancer_flashloans.sql similarity index 69% rename from models/_project/balancer/flashloans/balancer_flashloans.sql rename to models/balancer/balancer_flashloans.sql index 19f69ad6231..bf79fcbf7f9 100644 --- a/models/_project/balancer/flashloans/balancer_flashloans.sql +++ b/models/balancer/balancer_flashloans.sql @@ -1,10 +1,10 @@ {{ config( - schema = 'balancer', + alias = 'flashloans', - post_hook='{{ expose_spells(blockchains = \'["arbitrum", "avalanche_c", "base", "ethereum", "gnosis", "optimism", "polygon", "zkevm"]\', - spell_type = "project", - spell_name = "balancer", - contributors = \'["hildobby", "viniabussafi"]\') }}' + post_hook='{{ expose_spells(\'["ethereum","arbitrum", "optimism", "polygon", "gnosis", "avalanche_c", "base", "zkevm"]\', + "project", + "balancer", + \'["hildobby", "viniabussafi"]\') }}' ) }} @@ -19,6 +19,7 @@ ref('balancer_v2_ethereum_flashloans') , ref('balancer_v2_zkevm_flashloans') ] %} + SELECT * FROM ( {% for flash_model in balancer_models %} diff --git a/models/_project/balancer/pools/balancer_gauge_mappings.sql b/models/balancer/balancer_gauge_mappings.sql similarity index 78% rename from models/_project/balancer/pools/balancer_gauge_mappings.sql rename to models/balancer/balancer_gauge_mappings.sql index 0ad73a0a700..b764f659dde 100644 --- a/models/_project/balancer/pools/balancer_gauge_mappings.sql +++ b/models/balancer/balancer_gauge_mappings.sql @@ -1,10 +1,11 @@ {{ config( schema = 'balancer', + alias = 'gauge_mappings', post_hook='{{ expose_spells(\'["optimism"]\', - spell_type = "project", - spell_name = "balancer", - contributors = \'["msilb7"]\') }}' + "project", + "balancer", + \'["msilb7"]\') }}' ) }} diff --git a/models/_project/balancer/liquidity/balancer_liquidity.sql b/models/balancer/balancer_liquidity.sql similarity index 74% rename from models/_project/balancer/liquidity/balancer_liquidity.sql rename to models/balancer/balancer_liquidity.sql index 57fb1122ef5..0f003bc5d6d 100644 --- a/models/_project/balancer/liquidity/balancer_liquidity.sql +++ b/models/balancer/balancer_liquidity.sql @@ -2,10 +2,11 @@ schema = 'balancer', alias = 'liquidity', - post_hook='{{ expose_spells(blockchains = \'["arbitrum", "avalanche_c", "base", "ethereum", "gnosis", "optimism", "polygon", "zkevm"]\', - spell_type = "project", - spell_name = "balancer", - contributors = \'["viniabussafi"]\') }}' + post_hook='{{ expose_spells(\'["ethereum","arbitrum", "optimism", "polygon", "gnosis","avalanche_c", "base", "zkevm" + ]\', + "project", + "balancer", + \'["viniabussafi"]\') }}' ) }} diff --git a/models/_project/balancer/pools/balancer_pools_fees.sql b/models/balancer/balancer_pools_fees.sql similarity index 69% rename from models/_project/balancer/pools/balancer_pools_fees.sql rename to models/balancer/balancer_pools_fees.sql index 2a54b518ec1..e638f381024 100644 --- a/models/_project/balancer/pools/balancer_pools_fees.sql +++ b/models/balancer/balancer_pools_fees.sql @@ -1,10 +1,11 @@ {{ config( schema = 'balancer', + alias = 'pools_fees', - post_hook='{{ expose_spells(blockchains = \'["arbitrum", "avalanche_c", "base", "ethereum", "gnosis", "optimism", "polygon", "zkevm"]\', - spell_type = "project", - spell_name = "balancer", - contributors = \'["thetroyharris", "viniabussafi"]\') }}' + post_hook='{{ expose_spells(\'["arbitrum", "avalanche_c", "base", "ethereum", "gnosis", "optimism", "polygon", "zkevm"]\', + "project", + "balancer", + \'["thetroyharris", "viniabussafi"]\') }}' ) }} diff --git a/models/_project/balancer/pools/balancer_pools_metrics_daily.sql b/models/balancer/balancer_pools_metrics_daily.sql similarity index 100% rename from models/_project/balancer/pools/balancer_pools_metrics_daily.sql rename to models/balancer/balancer_pools_metrics_daily.sql diff --git a/models/_project/balancer/pools/balancer_pools_tokens_weights.sql b/models/balancer/balancer_pools_tokens_weights.sql similarity index 71% rename from models/_project/balancer/pools/balancer_pools_tokens_weights.sql rename to models/balancer/balancer_pools_tokens_weights.sql index d2e50c49ce9..95a71d1c294 100644 --- a/models/_project/balancer/pools/balancer_pools_tokens_weights.sql +++ b/models/balancer/balancer_pools_tokens_weights.sql @@ -1,10 +1,10 @@ {{ config( schema = 'balancer', alias = 'pools_tokens_weights', - post_hook='{{ expose_spells(blockchains = \'["arbitrum", "avalanche_c", "base", "ethereum", "gnosis", "optimism", "polygon", "zkevm"]\', - spell_type = "project", - spell_name = "balancer", - contributors = \'["viniabussafi"]\') }}' + post_hook='{{ expose_spells(\'["arbitrum", "avalanche_c", "base", "ethereum", "gnosis", "optimism", "polygon"]\', + "project", + "balancer", + \'["viniabussafi"]\') }}' ) }} diff --git a/models/_project/balancer/protocol_fee/balancer_protocol_fee.sql b/models/balancer/balancer_protocol_fee.sql similarity index 75% rename from models/_project/balancer/protocol_fee/balancer_protocol_fee.sql rename to models/balancer/balancer_protocol_fee.sql index 37fef24dc85..d871a6aef89 100644 --- a/models/_project/balancer/protocol_fee/balancer_protocol_fee.sql +++ b/models/balancer/balancer_protocol_fee.sql @@ -1,10 +1,10 @@ {{ config( schema = 'balancer', alias = 'protocol_fee', - post_hook='{{ expose_spells(blockchains = \'["arbitrum", "avalanche_c", "base", "ethereum", "gnosis", "optimism", "polygon", "zkevm"]\', - spell_type = "project", - spell_name = "balancer", - contributors = \'["viniabussafi"]\') }}' + post_hook='{{ expose_spells(\'["ethereum", "arbitrum", "polygon", "gnosis", "optimism","avalanche_c", "base"]\', + "project", + "balancer", + \'["viniabussafi"]\') }}' ) }} diff --git a/models/balancer/balancer_schema.yml b/models/balancer/balancer_schema.yml new file mode 100644 index 00000000000..5e7fb29a97b --- /dev/null +++ b/models/balancer/balancer_schema.yml @@ -0,0 +1,365 @@ +version: 2 + +models: + - name: balancer_gauge_mappings + meta: + blockchain: optimism + sector: dex + contributors: msilb7 + config: + tags: ['balancer', 'amm', 'trades', 'dex', 'incentives'] + description: > + Gauge to Pool mappings for balancer on all chains + columns: + - &blockchain + name: blockchain + description: "Blockchain" + - &project + name: project + description: "Project name (balancer)" + - &version + name: version + description: "Version of the project" + - &pool_contract + name: pool_contract + description: "Address of the liquidity pool contract" + - &pool_id + name: pool_id + description: "Pool id" + - &incentives_contract + name: incentives_contract + description: "Address of the contract where incentives are stored and emitted." + - &incentives_type + name: incentives_type + description: "Description of the incentives address type." + - &evt_block_time + name: evt_block_time + description: 'Block time in UTC' + - &evt_block_number + name: evt_block_number + description: 'Block Number' + - &contract_address + name: contract_address + description: 'Gauge Creator Contract Address' + - &evt_tx_hash + name: evt_tx_hash + description: 'Tx Hash' + - &evt_index + name: evt_index + description: 'Event index' + + - name: balancer_flashloans + meta: + blockchain: ethereum, arbitrum, optimism, polygon, gnosis + sector: lending + contributors: hildobby + config: + tags: ['ethereum', 'arbitrum', 'optimism', 'polygon', 'gnosis','avalanche_c', 'base', 'flashloans'] + description: > + All Balancer flashloans + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - blockchain + - tx_hash + - evt_index + columns: + - name: blockchain + - name: project + - name: version + - name: block_time + - name: block_month + - name: block_number + - name: amount + - name: amount_usd + - name: tx_hash + - name: evt_index + - name: fee + - name: currency_contract + - name: currency_symbol + - name: recipient + - name: contract_address + - name: block_month + + - name: balancer_bpt_prices + meta: + blockchain: ethereum, arbitrum, optimism, polygon, gnosis, avalanche_c, base + sector: dex + contributors: thetroyharris, victorstefenon, viniabussafi + config: + tags: ['balancer', 'amm', 'dex', 'bpt', 'prices', 'ethereum', 'arbitrum', 'optimism', 'polygon', 'gnosis', 'avalanche_c', 'base'] + description: > + Balancer Pool Token (BPT) hourly median price by pool on Balancer, an automated portfolio manager and trading platform. + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - blockchain + - day + - contract_address + columns: + - name: blockchain + - name: day + - name: version + - name: decimals + - name: contract_address + - name: pool_type + - name: bpt_price + + - name: balancer_liquidity + meta: + blockchain: ethereum, arbitrum, optimism, polygon, gnosis, avalanche_c, base + project: balancer + contributors: viniabussafi + config: + tags: ['balancer', 'amm', 'dex', 'liquidity', 'ethereum', 'arbitrum', 'optimism', 'polygon', 'avalanche_c', 'base'] + description: > + Liquidity by token on Balancer, an automated portfolio manager and trading platform. + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - day + - pool_id + - blockchain + - token_address + - token_symbol + columns: + - name: day + description: 'UTC event block time truncated to the day mark' + - *pool_id + - name: pool_address + - name: pool_symbol + description: 'Symbol of the pool, consisting of the symbol of its tokens and their respective weights' + - name: version + description: 'Version of Balancer in which pool was deployed' + - name: blockchain + description: 'Blockchain in which pool was deployed' + - name: pool_type + - name: token_address + - name: token_symbol + description: 'Symbol of the token' + - name: token_balance_raw + description: 'Raw balance of the token in the pool' + - name: token_balance + description: 'Scaled balance of the token in the pool' + - name: protocol_liquidity_usd + description: 'Liquidity of the token in the pool in USD, except BPTs' + - name: protocol_liquidity_eth + description: 'Liquidity of the token in the pool in ETH, except BPTs' + - name: pool_liquidity_usd + description: 'Liquidity of the token in the pool in USD, including BPTs' + - name: pool_liquidity_eth + description: 'Liquidity of the token in the pool in ETH, including BPTs' + + + - name: balancer_transfers_bpt + meta: + blockchain: arbitrum, avalanche_c, base, ethereum, gnosis, optimism, polygon + contributors: victorstefenon, thetroyharris, viniabussafi + config: + tags: ['arbitrum', 'avalanche_c', 'base', 'ethereum', 'gnosis', 'optimism', 'polygon', 'bpt', 'transfers'] + description: > + Balancer Pool Token (BPT) transfer logs on Balancer, an automated portfolio manager and trading platform. + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - evt_tx_hash + - evt_index + - block_date + columns: + - *blockchain + - name: version + - *contract_address + - &block_date + name: block_date + description: "Block date in UTC" + - *evt_tx_hash + - *evt_index + - *evt_block_time + - *evt_block_number + - &from + name: from + description: 'Address of BPT provider of transfer event' + - &to + name: to + description: 'Address of BPT receiver of transfer event' + - &value + name: value + description: 'Amount of BPT transferred in transfer event' + + - name: balancer_pools_fees + meta: + blockchain: arbitrum, avalanche_c, base, ethereum, gnosis, optimism, polygon + contributors: jacektrocinski, thetroyharris, viniabussafi + config: + tags: ['arbitrum', 'avalanche_c', 'base', 'ethereum', 'gnosis', 'optimism', 'polygon', 'bpt', 'transfers'] + description: > + Balancer v2 swap fees stored at the pool level. + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - blockchain + - block_number + - tx_hash + - index + columns: + - name: blockchain + - name: version + - name: contract_address + - name: tx_hash + - name: index + - name: tx_index + - name: block_time + - name: block_number + - name: swap_fee_percentage + + - name: balancer_protocol_fee + meta: + blockchain: arbitrum, avalanche_c, base, ethereum, gnosis, optimism, polygon + project: balancer + contributors: viniabussafi + config: + tags: ['arbitrum', 'avalanche_c', 'base', 'ethereum', 'gnosis', 'optimism', 'polygon', 'revenue', 'fees'] + description: > + Daily Protocol Fee collected and Revenue by pool on Balancer, an automated portfolio manager and trading platform. + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - day + - pool_id + - token_address + columns: + - name: day + - *pool_id + - name: pool_address + - name: pool_symbol + - *version + - *blockchain + - name: pool_type + - name: token_address + - name: token_symbol + - name: token_amount_raw + description: "Raw amount of revenues of the token in the pool" + - name: token_amount + description: "Amount of revenues of the token in the pool" + - name: protocol_fee_collected_usd + description: "Fee collected in the pool in USD" + - name: treasury_share + description: "Share of total revenue that is directed to Balancer DAO's treasury, as per BIPs 19, 161 and 371" + - name: treasury_revenue_usd + description: "Total revenue directed to Balancer DAO's treasury" + + - name: balancer_bpt_supply + meta: + blockchain: arbitrum, avalanche_c, base, ethereum, gnosis, optimism, polygon + contributors: thetroyharris, viniabussafi + config: + tags: ['arbitrum', 'avalanche_c', 'base', 'ethereum', 'gnosis', 'optimism', 'polygon', 'bpt'] + description: > + The Balancer Pool Token (BPT) supply over time of ComposableStablePools versions 4+ + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - day + - blockchain + - token_address + columns: + - name: day + - name: pool_type + - name: version + - name: blockchain + - name: token_address + - name: supply + + - name: balancer_token_whitelist + meta: + blockchain: arbitrum, avalanche_c, base, ethereum, gnosis, optimism, polygon + contributors: viniabussafi + config: + tags: ['arbitrum', 'avalanche_c', 'base', 'ethereum', 'gnosis', 'optimism', 'polygon', 'bpt'] + description: > + These tokens are whitelisted to be used as pricing assets on liquidity calculations for weighted pools, due to the trustability of their data. + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - address + - name + - chain + columns: + - name: address + - name: name + - name: chain + + - name: balancer_pools_tokens_weights + meta: + blockchain: arbitrum, avalanche_c, base, ethereum, gnosis, optimism, polygon + contributors: jacektrocinski, viniabussafi + config: + tags: ['arbitrum', 'avalanche_c', 'base', 'ethereum', 'gnosis', 'optimism', 'polygon', 'bpt', 'transfers'] + description: > + Token weights in Balancer pools. + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - blockchain + - pool_id + - token_address + columns: + - *blockchain + - name: version + - *pool_id + - name: token_address + - name: normalized_weight + + - name: balancer_single_recipient_gauges + meta: + blockchain: ethereum + contributors: viniabussafi + config: + tags: ['ethereum', 'gauges'] + description: > + These gauges are deployed by the SingleRecipientGauge contract and this mapping manually links each gauge to it's correspondent pool and project + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - gauge_address + - pool_id + - project + - blockchain + columns: + - name: gauge_address + - name: pool_id + - name: project + - name: blockchain + + - name: balancer_pools_metrics_daily + meta: + blockchain: arbitrum, avalanche_c, base, ethereum, gnosis, optimism, polygon, zkevm + contributors: viniabussafi, metacrypto + config: + tags: ['arbitrum', 'avalanche_c', 'base', 'ethereum', 'gnosis', 'optimism', 'polygon', 'zkevm', 'balancer', 'pool', 'stats', 'volume', 'tvl', 'fee'] + description: > + This spell aggregates data from the trades, liquidity and protocol fees spells, by day and pool, while also displaying some basic information about the pool + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - block_date + - blockchain + - project + - version + - project_contract_address + columns: + - name: blockchain + - name: project + - name: version + - name: block_date + - name: project_contract_address + - name: pool_symbol + - name: pool_type + - name: swap_amount_usd + description: "Daily swap volume on a pool, in USD" + - name: tvl_usd + description: "Total Value Locked on a pool, in USD" + - name: tvl_eth + description: "Total Value Locked on a pool, in eth" + - name: fee_amount_usd + description: "Daily fees collected on a pool, in USD" \ No newline at end of file diff --git a/models/_project/balancer/support/balancer_single_recipient_gauges.sql b/models/balancer/balancer_single_recipient_gauges.sql similarity index 100% rename from models/_project/balancer/support/balancer_single_recipient_gauges.sql rename to models/balancer/balancer_single_recipient_gauges.sql diff --git a/models/_project/balancer/support/balancer_token_whitelist.sql b/models/balancer/balancer_token_whitelist.sql similarity index 100% rename from models/_project/balancer/support/balancer_token_whitelist.sql rename to models/balancer/balancer_token_whitelist.sql diff --git a/models/_project/balancer/bpt/balancer_transfers_bpt.sql b/models/balancer/balancer_transfers_bpt.sql similarity index 70% rename from models/_project/balancer/bpt/balancer_transfers_bpt.sql rename to models/balancer/balancer_transfers_bpt.sql index dda9c32ecb1..bd6fe9064c5 100644 --- a/models/_project/balancer/bpt/balancer_transfers_bpt.sql +++ b/models/balancer/balancer_transfers_bpt.sql @@ -1,10 +1,10 @@ {{ config( schema = 'balancer', alias = 'transfers_bpt', - post_hook='{{ expose_spells(blockchains = \'["arbitrum", "avalanche_c", "base", "ethereum", "gnosis", "optimism", "polygon", "zkevm"]\', - spell_type = "project", - spell_name = "balancer", - contributors = \'["thetroyharris", "victorstefenon", "viniabussafi"]\') }}' + post_hook='{{ expose_spells(\'["arbitrum", "avalanche_c", "base", "ethereum", "gnosis", "optimism", "polygon", "zkevm"]\', + "project", + "balancer", + \'["thetroyharris", "victorstefenon", "viniabussafi"]\') }}' ) }} diff --git a/models/_project/balancer/pools/base/balancer_base_pools_tokens_weights.sql b/models/balancer/base/balancer_base_pools_tokens_weights.sql similarity index 100% rename from models/_project/balancer/pools/base/balancer_base_pools_tokens_weights.sql rename to models/balancer/base/balancer_base_pools_tokens_weights.sql diff --git a/models/balancer/base/balancer_base_schema.yml b/models/balancer/base/balancer_base_schema.yml new file mode 100644 index 00000000000..d6e170e5536 --- /dev/null +++ b/models/balancer/base/balancer_base_schema.yml @@ -0,0 +1,405 @@ +version: 2 + +models: + + - name: balancer_base_trades + meta: + blockchain: base + sector: dex + contributors: bizzyvinci + config: + tags: ['balancer', 'base', 'amm', 'trades', 'dex'] + description: > + DEX trades on balancer on base + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - block_date + - blockchain + - project + - version + - tx_hash + - evt_index + - check_dex_seed: + blockchain: base + project: balancer + version: 2 + columns: + - &blockchain + name: blockchain + description: "Blockchain" + - &project + name: project + description: "Project name (balancer)" + - &version + name: version + description: "Version of the project" + - &block_month + name: block_month + description: "Block month in UTC" + - &block_date + name: block_date + description: "Block date in UTC" + - &block_time + name: block_time + description: 'Block time in UTC' + - &token_bought_symbol + name: token_bought_symbol + description: "Token symbol for token bought in the trade" + - &token_sold_symbol + name: token_sold_symbol + description: "Token symbol for token sold in the trade" + - &token_pair + name: token_pair + description: "Token symbol pair for each token involved in the trade" + - &token_bought_amount + name: token_bought_amount + description: "Value of the token bought at time of execution in the original currency" + - &token_sold_amount + name: token_sold_amount + description: "Value of the token sold at time of execution in the original currency" + - &token_bought_amount_raw + name: token_bought_amount_raw + description: "Raw value of the token bought at time of execution in the original currency" + - &token_sold_amount_raw + name: token_sold_amount_raw + description: "Raw value of the token sold at time of execution in the original currency" + - &amount_usd + name: amount_usd + description: "USD value of the trade at time of execution" + - &token_bought_address + name: token_bought_address + description: "Contract address of the token bought" + - &token_sold_address + name: token_sold_address + description: "Contract address of the token sold" + - &taker + name: taker + description: "Address of trader who purchased a token" + - &maker + name: maker + description: "Address of trader who sold a token" + - &pool_id + name: pool_id + description: 'Unique encoded identifier that refers to each pool' + - &swap_fee + name: swap_fee + description: 'Swap fee' + - &project_contract_address + name: project_contract_address + description: "Pool address" + - name: pool_symbol + - name: pool_type + - &tx_hash + name: tx_hash + description: "Transaction hash" + - &tx_from + name: tx_from + description: "transaction.from" + - &tx_to + name: tx_to + description: "transaction.to" + - &evt_index + name: evt_index + description: "Event index" + + - name: balancer_v2_base_trades + meta: + blockchain: base + sector: dex + contributors: bizzyvinci, thetroyharris, tomfutago, viniabussafi + config: + tags: [ 'balancer', 'base', 'amm', 'trades', 'dex', 'beta' ] + description: > + DEX trades on balancer v2 on base + columns: + - *blockchain + - *project + - *version + - *block_month + - *block_date + - *block_time + - name: block_number + - *token_bought_symbol + - *token_sold_symbol + - *token_pair + - *token_bought_amount + - *token_sold_amount + - *token_bought_amount_raw + - *token_sold_amount_raw + - *amount_usd + - *token_bought_address + - *token_sold_address + - *taker + - *maker + - *project_contract_address + - name: pool_symbol + - name: pool_type + - *pool_id + - *swap_fee + - *tx_hash + - *tx_from + - *tx_to + - *evt_index + + - name: balancer_v2_base_pools_fees + meta: + blockchain: base + project: balancer_v2 + contributors: jacektrocinski, thetroyharris, viniabussafi + config: + tags: ['base', 'balancer', 'pools', 'fees'] + description: > + Balancer v2 swap fees stored at the pool level. + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - block_number + - tx_hash + - index + columns: + - name: blockchain + - name: version + - name: contract_address + - name: tx_hash + - name: index + - name: tx_index + - name: block_time + - name: block_number + - name: swap_fee_percentage + + - name: balancer_base_pools_tokens_weights + meta: + blockchain: base + project: balancer + contributors: jacektrocinski, viniabussafi + config: + tags: ['base', 'balancer', 'pools', 'tokens', 'weights'] + description: > + Token weights in Balancer pools. + columns: + - *blockchain + - name: version + - *pool_id + - &token_address + name: token_address + description: 'Contract address for the token' + - &normalized_weight + name: normalized_weight + description: 'Weight of the token in the pool.' + + - name: balancer_v2_base_pools_tokens_weights + meta: + blockchain: base + project: balancer + contributors: jacektrocinski, viniabussafi + config: + tags: ['base', 'balancer', 'pools', 'tokens', 'weights'] + description: > + Token weights in Balancer v2 pools. + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - pool_id + - token_address + columns: + - *blockchain + - name: version + - *pool_id + - *token_address + - *normalized_weight + + - name: balancer_v2_base_liquidity + meta: + blockchain: base + project: balancer_v2 + contributors: victorstefenon, viniabussafi, thetroyharris + config: + tags: ['base', 'balancer', 'pools', 'liquidity'] + description: > + Balancer v2 pools liquidity by token in base. + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - day + - pool_id + - token_address + columns: + - name: day + description: 'UTC event block time truncated to the day mark' + - *pool_id + - name: pool_address + - name: pool_symbol + description: 'Symbol of the pool, consisting of the symbol of its tokens and their respective weights' + - name: version + description: 'Version of Balancer in which pool was deployed' + - name: blockchain + description: 'Blockchain in which pool was deployed' + - *token_address + - name: token_symbol + description: 'Symbol of the token' + - name: token_balance_raw + description: 'Raw balance of the token in the pool' + - name: token_balance + description: 'Scaled balance of the token in the pool' + - name: protocol_liquidity_usd + description: 'Liquidity of the token in the pool in USD, except BPTs' + - name: protocol_liquidity_eth + description: 'Liquidity of the token in the pool in ETH, except BPTs' + - name: pool_liquidity_usd + description: 'Liquidity of the token in the pool in USD, including BPTs' + - name: pool_liquidity_eth + description: 'Liquidity of the token in the pool in ETH, including BPTs' + + + - name: balancer_v2_base_bpt_prices + meta: + blockchain: base + project: balancer_v2 + contributors: victorstefenon, thetroyharris, viniabussafi + config: + tags: ['base', 'bpt', 'prices'] + description: > + Balancer Pool Token (BPT) hourly median price by pool on Balancer, an automated portfolio manager and trading platform. + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - blockchain + - day + - contract_address + columns: + - name: blockchain + - name: day + - name: version + - name: decimals + - name: contract_address + - name: bpt_price + + - name: balancer_v2_base_transfers_bpt + meta: + blockchain: base + project: balancer_v2 + contributors: victorstefenon, thetroyharris, viniabussafi + config: + tags: ['base', 'bpt', 'transfers'] + description: > + Balancer Pool Token (BPT) transfer logs on Balancer, an automated portfolio manager and trading platform, on Base. + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - evt_tx_hash + - evt_index + - block_date + columns: + - name: blockchain + - name: version + - name: contract_address + - name: block_date + - name: block_month + - name: evt_tx_hash + - name: evt_index + - &evt_block_time + name: evt_block_time + description: 'Block time of transfer event' + - &evt_block_number + name: evt_block_number + description: 'Block number of transfer event' + - &from + name: from + description: 'Address of BPT provider of transfer event' + - &to + name: to + description: 'Address of BPT receiver of transfer event' + - &value + name: value + description: 'Amount of BPT transferred in transfer event' + + - name: balancer_v2_base_flashloans + meta: + blockchain: base + sector: lending + contributors: hildobby, viniabussafi + config: + tags: ['base', 'flashloans'] + description: > + All Balancer v2 flashloans on base + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - blockchain + - tx_hash + - evt_index + columns: + - name: blockchain + - name: project + - name: version + - name: block_time + - name: block_number + - name: amount + - name: amount_usd + - name: tx_hash + - name: evt_index + - name: fee + - name: currency_contract + - name: currency_symbol + - name: recipient + - name: contract_address + - name: block_month + + - name: balancer_v2_base_protocol_fee + meta: + blockchain: base + project: balancer_v2 + contributors: viniabussafi + config: + tags: ['base', 'revenue', 'fees'] + description: > + Daily Protocol Fee collected and Revenue by pool on Balancer, an automated portfolio manager and trading platform. + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - day + - pool_id + - token_address + columns: + - name: day + - name: pool_id + - name: pool_address + - name: pool_symbol + - name: version + - name: blockchain + - name: token_address + - name: token_symbol + - name: token_amount_raw + description: "Raw amount of revenues of the token in the pool" + - name: token_amount + description: "Amount of revenues of the token in the pool" + - name: protocol_fee_collected_usd + description: "Fee collected in the pool in USD" + - name: treasury_share + description: "Share of total revenue that is directed to Balancer DAO's treasury, as per BIPs 19, 161 and 371" + - name: treasury_revenue_usd + description: "Total revenue directed to Balancer DAO's treasury" + + - name: balancer_v2_base_bpt_supply + meta: + blockchain: base + project: balancer_v2 + contributors: thetroyharris, viniabussafi + config: + tags: ['base', 'bpt', 'supply'] + description: > + Balancer Pool Token (BPT) supply for ComposableStablePools versions 4 and 5. + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - day + - blockchain + - token_address + columns: + - name: day + - name: pool_type + - name: version + - name: blockchain + - name: token_address + - name: supply \ No newline at end of file diff --git a/models/_project/balancer/trades/base/balancer_base_trades.sql b/models/balancer/base/balancer_base_trades.sql similarity index 100% rename from models/_project/balancer/trades/base/balancer_base_trades.sql rename to models/balancer/base/balancer_base_trades.sql diff --git a/models/_project/balancer/bpt/base/balancer_v2_base_bpt_prices.sql b/models/balancer/base/balancer_v2_base_bpt_prices.sql similarity index 100% rename from models/_project/balancer/bpt/base/balancer_v2_base_bpt_prices.sql rename to models/balancer/base/balancer_v2_base_bpt_prices.sql diff --git a/models/_project/balancer/bpt/base/balancer_v2_base_bpt_supply.sql b/models/balancer/base/balancer_v2_base_bpt_supply.sql similarity index 100% rename from models/_project/balancer/bpt/base/balancer_v2_base_bpt_supply.sql rename to models/balancer/base/balancer_v2_base_bpt_supply.sql diff --git a/models/_project/balancer/flashloans/base/balancer_v2_base_flashloans.sql b/models/balancer/base/balancer_v2_base_flashloans.sql similarity index 88% rename from models/_project/balancer/flashloans/base/balancer_v2_base_flashloans.sql rename to models/balancer/base/balancer_v2_base_flashloans.sql index da8cb9d2ae1..9438b88cf9c 100644 --- a/models/_project/balancer/flashloans/base/balancer_v2_base_flashloans.sql +++ b/models/balancer/base/balancer_v2_base_flashloans.sql @@ -6,6 +6,10 @@ , file_format = 'delta' , incremental_strategy = 'merge' , unique_key = ['tx_hash', 'evt_index'] + , post_hook='{{ expose_spells(\'["base"]\', + "project", + "balancer_v2", + \'["hildobby", "viniabussafi"]\') }}' ) }} diff --git a/models/_project/balancer/liquidity/base/balancer_v2_base_liquidity.sql b/models/balancer/base/balancer_v2_base_liquidity.sql similarity index 51% rename from models/_project/balancer/liquidity/base/balancer_v2_base_liquidity.sql rename to models/balancer/base/balancer_v2_base_liquidity.sql index 20f257ad753..10b08a41262 100644 --- a/models/_project/balancer/liquidity/base/balancer_v2_base_liquidity.sql +++ b/models/balancer/base/balancer_v2_base_liquidity.sql @@ -6,7 +6,11 @@ schema = 'balancer_v2_base', alias = 'liquidity', materialized = 'table', - file_format = 'delta' + file_format = 'delta', + post_hook="{{ expose_spells('[\"" + blockchain + '"]' + '\', + "project", + "balancer_v2", + \'["stefenon", "viniabussafi"]\') }}' ) }} diff --git a/models/_project/balancer/pools/base/balancer_v2_base_pools_fees.sql b/models/balancer/base/balancer_v2_base_pools_fees.sql similarity index 77% rename from models/_project/balancer/pools/base/balancer_v2_base_pools_fees.sql rename to models/balancer/base/balancer_v2_base_pools_fees.sql index c4029cb33d6..7aaf2ef8939 100644 --- a/models/_project/balancer/pools/base/balancer_v2_base_pools_fees.sql +++ b/models/balancer/base/balancer_v2_base_pools_fees.sql @@ -1,12 +1,17 @@ {{ config( schema = 'balancer_v2_base', + alias = 'pools_fees', materialized = 'incremental', file_format = 'delta', incremental_strategy = 'merge', - unique_key = ['block_number', 'tx_hash', 'index'] - ) + unique_key = ['block_number', 'tx_hash', 'index'], + post_hook='{{ expose_spells(\'["base"]\', + "project", + "balancer_v2", + \'["metacrypto", "jacektrocinski", "thetroyharris", "viniabussafi"]\') }}' + )  }} {% set event_signature = '0xa9ba3ffe0b6c366b81232caab38605a0699ad5398d6cce76f91ee809e322dafc' %} diff --git a/models/_project/balancer/pools/base/balancer_v2_base_pools_tokens_weights.sql b/models/balancer/base/balancer_v2_base_pools_tokens_weights.sql similarity index 99% rename from models/_project/balancer/pools/base/balancer_v2_base_pools_tokens_weights.sql rename to models/balancer/base/balancer_v2_base_pools_tokens_weights.sql index 531e3214489..29086428514 100644 --- a/models/_project/balancer/pools/base/balancer_v2_base_pools_tokens_weights.sql +++ b/models/balancer/base/balancer_v2_base_pools_tokens_weights.sql @@ -2,6 +2,7 @@ config( schema='balancer_v2_base', alias = 'pools_tokens_weights', + materialized = 'incremental', file_format = 'delta', incremental_strategy = 'merge', diff --git a/models/_project/balancer/protocol_fee/base/balancer_v2_base_protocol_fee.sql b/models/balancer/base/balancer_v2_base_protocol_fee.sql similarity index 100% rename from models/_project/balancer/protocol_fee/base/balancer_v2_base_protocol_fee.sql rename to models/balancer/base/balancer_v2_base_protocol_fee.sql diff --git a/models/_project/balancer/trades/base/balancer_v2_base_trades.sql b/models/balancer/base/balancer_v2_base_trades.sql similarity index 94% rename from models/_project/balancer/trades/base/balancer_v2_base_trades.sql rename to models/balancer/base/balancer_v2_base_trades.sql index b94589a490a..ccf037af146 100644 --- a/models/_project/balancer/trades/base/balancer_v2_base_trades.sql +++ b/models/balancer/base/balancer_v2_base_trades.sql @@ -4,9 +4,9 @@ alias = 'trades', materialized = 'view', post_hook = '{{ expose_spells(\'["base"]\', - spell_type = "project", - spell_name = "balancer", - contributors = \'["mendesfabio", "jacektrocinski", "thetroyharris", "tomfutago", "viniabussafi"]\') }}' + "project", + "balancer_v2", + \'["mendesfabio", "jacektrocinski", "thetroyharris", "tomfutago", "viniabussafi"]\') }}' ) }} diff --git a/models/_project/balancer/bpt/base/balancer_v2_base_transfers_bpt.sql b/models/balancer/base/balancer_v2_base_transfers_bpt.sql similarity index 100% rename from models/_project/balancer/bpt/base/balancer_v2_base_transfers_bpt.sql rename to models/balancer/base/balancer_v2_base_transfers_bpt.sql diff --git a/models/_project/balancer/balances/ethereum/balancer_ethereum_balances.sql b/models/balancer/ethereum/balancer_ethereum_balances.sql similarity index 88% rename from models/_project/balancer/balances/ethereum/balancer_ethereum_balances.sql rename to models/balancer/ethereum/balancer_ethereum_balances.sql index aa584c6c39d..bddec24d0bf 100644 --- a/models/_project/balancer/balances/ethereum/balancer_ethereum_balances.sql +++ b/models/balancer/ethereum/balancer_ethereum_balances.sql @@ -1,11 +1,11 @@ {{ config( - schema = 'balancer_ethereum', alias = 'balances', + post_hook='{{ expose_spells(\'["ethereum"]\', - spell_type = "project", - spell_name = "balancer", - contributors = \'["metacrypto", "jacektrocinski", "viniabussafi"]\') }}' + "project", + "balancer", + \'["metacrypto", "jacektrocinski", "viniabussafi"]\') }}' )  }} @@ -72,4 +72,5 @@ running_cumulative_balance_by_token AS ( LEFT JOIN cumulative_balance_by_token b ON b.day <= c.day AND c.day < b.day_of_next_change ) -SELECT * FROM running_cumulative_balance_by_token \ No newline at end of file +SELECT * FROM running_cumulative_balance_by_token + diff --git a/models/_project/balancer/pools/ethereum/balancer_ethereum_pools_tokens_weights.sql b/models/balancer/ethereum/balancer_ethereum_pools_tokens_weights.sql similarity index 100% rename from models/_project/balancer/pools/ethereum/balancer_ethereum_pools_tokens_weights.sql rename to models/balancer/ethereum/balancer_ethereum_pools_tokens_weights.sql diff --git a/models/balancer/ethereum/balancer_ethereum_schema.yml b/models/balancer/ethereum/balancer_ethereum_schema.yml new file mode 100644 index 00000000000..d2f899d1c61 --- /dev/null +++ b/models/balancer/ethereum/balancer_ethereum_schema.yml @@ -0,0 +1,665 @@ +version: 2 + +models: + - name: balancer_v2_ethereum_pools_fees + meta: + blockchain: ethereum + project: balancer_v2 + contributors: jacektrocinski, thetroyharris, viniabussafi + config: + tags: ['ethereum', 'balancer', 'pools', 'fees'] + description: > + Balancer v2 swap fees stored at the pool level. + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - block_number + - tx_hash + - index + columns: + - name: blockchain + - name: version + - &contract_address + name: contract_address + description: "Ethereum address for the liquidity pool used in transaction" + tests: + - not_null + - &tx_hash + name: tx_hash + description: "Transaction hash" + tests: + - not_null + - &index + name: index + description: "" + tests: + - not_null + - &tx_index + name: tx_index + description: "" + tests: + - not_null + - &block_time + name: block_time + description: "Block time in UTC" + tests: + - not_null + - &block_number + name: block_number + description: "Block number" + tests: + - not_null + - &swap_fee_percentage + name: swap_fee_percentage + description: "Swap fees for the pool, values are returned with 18 decimals (1e18 meaning 100%)" + tests: + - not_null + + - name: balancer_ethereum_balances + meta: + blockchain: ethereum + project: balancer + contributors: jacektrocinski + config: + tags: ['ethereum', 'balancer', 'balances'] + description: > + ERC20 token rolling sum balances on Balancer, an automated portfolio manager and trading platform. + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - day + - pool + - token + columns: + - &day + name: day + description: "UTC event block time truncated to the day mark" + tests: + - not_null + - &pool + name: pool + description: "Balancer pool contract address" + - &token + name: token + description: "Token contract address" + - &cumulative_amount + name: cumulative_amount + description: "Balance of a token" + + - name: balancer_v2_ethereum_transfers_bpt + meta: + blockchain: ethereum + project: balancer_v2 + contributors: victorstefenon, thetroyharris, viniabussafi + config: + tags: ['ethereum', 'bpt', 'transfers'] + description: > + Balancer Pool Token (BPT) transfer logs on Balancer, an automated portfolio manager and trading platform, on Ethereum. + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - evt_tx_hash + - evt_index + - block_date + columns: + - &blockchain + name: blockchain + description: "Blockchain" + - name: version + - *contract_address + - &block_date + name: block_date + description: "UTC event block date" + - &block_month + name: block_month + description: "UTC event block month" + - &evt_tx_hash + name: evt_tx_hash + description: "Transaction hash of transfer event" + - &evt_index + name: evt_index + description: "Event index" + - &evt_block_time + name: evt_block_time + description: "Block time of transfer event" + - &evt_block_number + name: evt_block_number + description: "Block number of transfer event" + - &from + name: from + description: "Address of BPT provider of transfer event" + - &to + name: to + description: "Address of BPT receiver of transfer event" + - &value + name: value + description: "Amount of BPT transferred in transfer event" + + - name: balancer_ethereum_pools_tokens_weights + meta: + blockchain: ethereum + project: balancer + contributors: jacektrocinski, viniabussafi + config: + tags: ['ethereum', 'balancer', 'pools', 'tokens', 'weights'] + description: > + Token weights in Balancer pools. + columns: + - *blockchain + - name: version + - &pool_id + name: pool_id + description: "Unique encoded identifier that refers to each pool" + - &token_address + name: token_address + description: "Contract address for the token" + - &normalized_weight + name: normalized_weight + description: "Weight of the token in the pool." + + - name: balancer_v1_ethereum_pools_tokens_weights + meta: + blockchain: ethereum + project: balancer + contributors: jacektrocinski, viniabussafi + config: + tags: ['ethereum', 'balancer', 'pools', 'tokens', 'weights'] + description: > + Token weights in Balancer v1 pools. + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - pool_id + - token_address + columns: + - *blockchain + - name: version + - *pool_id + - *token_address + - *normalized_weight + + - name: balancer_v2_ethereum_pools_tokens_weights + meta: + blockchain: ethereum + project: balancer + contributors: jacektrocinski, viniabussafi + config: + tags: ['ethereum', 'balancer', 'pools', 'tokens', 'weights'] + description: > + Token weights in Balancer v2 pools. + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - pool_id + - token_address + columns: + - *blockchain + - name: version + - *pool_id + - *token_address + - *normalized_weight + + - name: balancer_ethereum_vebal_balances_day + meta: + blockchain: ethereum + project: balancer + contibutors: markusbkoch, mendesfabio, victorstefenon + config: + tags: ['balancer', 'ethereum', 'vebal', 'day', 'markusbkoch', 'mendesfabio'] + description: > + Daily balances of veBAL per wallet + Depends on veBAL_call_create_lock, veBAL_evt_Deposit and veBAL_evt_Withdraw + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - day + - wallet_address + columns: + - *day + - name: wallet_address + description: "Address of the wallet holding the veBAL" + - name: bpt_balance + description: "Amount of BPT held in the veBAL lock" + - name: vebal_balance + description: "Amount of veBAL" + - name: lock_time + description: "Amount of time the BPT was locked for at the last time the lock was updated" + + - name: balancer_ethereum_vebal_slopes + meta: + blockchain: ethereum + project: balancer + contibutors: markusbkoch, mendesfabio, victorstefenon + config: + tags: ['balancer', 'ethereum', 'vebal', 'slope', 'markusbkoch', 'mendesfabio', 'victorstefenon'] + description: > + Slope and bias of veBAL per wallet after each balance update + Depends on veBAL_call_create_lock, veBAL_evt_Deposit and veBAL_evt_Withdraw + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - block_number + - wallet_address + columns: + - *block_number + - *block_time + - name: block_timestamp + description: "Block timestamp" + - name: wallet_address + description: "Address of the wallet holding the veBAL" + - name: bpt_balance + description: "Amount of BPT held in the veBAL lock" + - name: unlocked_at + description: "Timestamp at which B-80BAL-20WETH BPT can be unlocked" + - name: slope + description: "veBAL decay rate (per second)" + - name: bias + description: "veBAL balance at the moment user locks or re-locks" + - name: block_date + description: "Block time trunc to date" + + - name: balancer_ethereum_trades + meta: + blockchain: ethereum + sector: dex + contributors: bizzyvinci, thetroyharris + config: + tags: ['balancer', 'ethereum', 'amm', 'trades', 'dex'] + description: > + DEX trades on balancer on ethereum + columns: + - *blockchain + - &project + name: project + description: "Project name (balancer)" + - &version + name: version + description: "Version of the project" + - *block_month + - *block_date + - *block_time + - &token_bought_symbol + name: token_bought_symbol + description: "Token symbol for token bought in the trade" + - &token_sold_symbol + name: token_sold_symbol + description: "Token symbol for token sold in the trade" + - &token_pair + name: token_pair + description: "Token symbol pair for each token involved in the trade" + - &token_bought_amount + name: token_bought_amount + description: "Value of the token bought at time of execution in the original currency" + - &token_sold_amount + name: token_sold_amount + description: "Value of the token sold at time of execution in the original currency" + - &token_bought_amount_raw + name: token_bought_amount_raw + description: "Raw value of the token bought at time of execution in the original currency" + - &token_sold_amount_raw + name: token_sold_amount_raw + description: "Raw value of the token sold at time of execution in the original currency" + - &amount_usd + name: amount_usd + description: "USD value of the trade at time of execution" + - &token_bought_address + name: token_bought_address + description: "Contract address of the token bought" + - &token_sold_address + name: token_sold_address + description: "Contract address of the token sold" + - &taker + name: taker + description: "Address of trader who purchased a token" + - &maker + name: maker + description: "Address of trader who sold a token" + - *pool_id + - &swap_fee + name: swap_fee + description: 'Swap fee' + - &project_contract_address + name: project_contract_address + description: "Pool address" + - name: pool_symbol + - name: pool_type + - *tx_hash + - &tx_from + name: tx_from + description: "transaction.from" + - &tx_to + name: tx_to + description: "transaction.to" + - *evt_index + + - name: balancer_v1_ethereum_trades + meta: + blockchain: ethereum + sector: dex + contributors: bizzyvinci, thetroyharris, viniabussafi + config: + tags: [ 'balancer', 'ethereum', 'amm', 'trades', 'dex' ] + description: > + DEX trades on balancer v1 on ethereum + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - block_time + - tx_hash + - evt_index + - check_dex_seed: + blockchain: ethereum + project: balancer + version: 1 + columns: + - *blockchain + - *project + - *version + - *block_month + - *block_date + - *block_time + - *token_bought_symbol + - *token_sold_symbol + - *token_pair + - *token_bought_amount + - *token_sold_amount + - *token_bought_amount_raw + - *token_sold_amount_raw + - *amount_usd + - *token_bought_address + - *token_sold_address + - *taker + - *maker + - *pool_id + - *swap_fee + - *project_contract_address + - name: pool_symbol + - name: pool_type + - *tx_hash + - *tx_from + - *tx_to + - *evt_index + + - name: balancer_v2_ethereum_trades + meta: + blockchain: ethereum + sector: dex + contributors: bizzyvinci, thetroyharris, tomfutago, viniabussafi + config: + tags: [ 'balancer', 'ethereum', 'amm', 'trades', 'dex', 'beta' ] + description: > + DEX trades on balancer v2 on ethereum + columns: + - *blockchain + - *project + - *version + - *block_month + - *block_date + - *block_time + - *block_number + - *token_bought_symbol + - *token_sold_symbol + - *token_pair + - *token_bought_amount + - *token_sold_amount + - *token_bought_amount_raw + - *token_sold_amount_raw + - *amount_usd + - *token_bought_address + - *token_sold_address + - *taker + - *maker + - *project_contract_address + - name: pool_symbol + - name: pool_type + - *pool_id + - *swap_fee + - *tx_hash + - *tx_from + - *tx_to + - *evt_index + + - name: balancer_v2_ethereum_liquidity + meta: + blockchain: ethereum + project: balancer_v2 + contributors: victorstefenon, viniabussafi, thetroyharris + config: + tags: ['ethereum', 'balancer', 'pools', 'liquidity'] + description: > + Balancer v2 pools liquidity by token in Ethereum. + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - day + - pool_id + - token_address + columns: + - name: day + description: 'UTC event block time truncated to the day mark' + - *pool_id + - name: pool_address + - name: pool_symbol + description: 'Symbol of the pool, consisting of the symbol of its tokens and their respective weights' + - name: version + description: 'Version of Balancer in which pool was deployed' + - name: blockchain + description: 'Blockchain in which pool was deployed' + - *token_address + - name: token_symbol + description: 'Symbol of the token' + - name: token_balance_raw + description: 'Raw balance of the token in the pool' + - name: token_balance + description: 'Scaled balance of the token in the pool' + - name: protocol_liquidity_usd + description: 'Liquidity of the token in the pool in USD, except BPTs' + - name: protocol_liquidity_eth + description: 'Liquidity of the token in the pool in ETH, except BPTs' + - name: pool_liquidity_usd + description: 'Liquidity of the token in the pool in USD, including BPTs' + - name: pool_liquidity_eth + description: 'Liquidity of the token in the pool in ETH, including BPTs' + + - name: balancer_ethereum_vebal_votes + meta: + blockchain: ethereum + project: balancer + contibutors: markusbkoch, mendesfabio, stefenon + config: + tags: ['balancer', 'ethereum', 'vebal', 'votes', 'markusbkoch', 'mendesfabio', 'stefenon'] + description: > + Records of votes for Balancer gauges by provider at each voting round + Depends on GaugeController_evt_VoteForGauge and the vebal_slopes spell + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - round_id + - gauge + - provider + columns: + - name: round_id + description: "ID of the voting round" + - name: start_date + description: "Day of the voting round start date" + - name: end_date + description: "Day of the voting round end date" + - name: gauge + description: "Address of the gauge which provider votes for" + - name: provider + description: "Address of the wallet which voted for the gauge" + - name: vote + description: "Weight of the vote performed by the provider for the gauge" + + - name: balancer_v2_ethereum_lbps + meta: + blockchain: ethereum + project: balancer_v2 + contributors: stefenon + config: + tags: ['ethereum', 'balancer', 'lbp'] + description: > + Record of the Liquidity Boostrapping Pools (LBP) of Balancer, an automated portfolio manager and trading platform, on Ethereum. + columns: + - name: name + description: "Name of the LBP" + - name: pool_id + description: "ID of the LBP" + - name: token_sold + description: "Contract address of the token sold by the LBP" + - name: token_symbol + description: "Symbol of the token sold by the LBP" + - name: start_time + description: "LBP start time" + - name: end_time + description: "LBP end time" + + - name: balancer_v1_ethereum_liquidity + meta: + blockchain: ethereum + project: balancer_v1 + contributors: markusbkoch, mendesfabio, victorstefenon, viniabussafi, thetroyharris + config: + tags: ['ethereum', 'balancer', 'pools', 'liquidity'] + description: > + Balancer v1 pools liquidity by token in Ethereum. + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - day + - pool_id + - token_address + columns: + - name: day + description: "UTC event block time truncated to the day mark" + - *pool_id + - name: pool_address + - name: pool_symbol + description: "Symbol of the pool, consisting of the symbol of its tokens and their respective weights" + - name: version + description: "Version of Balancer in which pool was deployed" + - *blockchain + - *token_address + - name: token_symbol + description: "Symbol of the token" + - name: token_balance_raw + description: "Raw balance of the token in the pool" + - name: token_balance + description: "Scaled balance of the token in the pool" + - name: protocol_liquidity_usd + description: "Liquidity of the token in the pool in USD, except BPTs" + - name: pool_liquidity_usd + description: "Liquidity of the token in the pool in USD, including BPTs" + + - name: balancer_v2_ethereum_flashloans + meta: + blockchain: ethereum + sector: lending + contributors: hildobby + config: + tags: ['ethereum', 'flashloans'] + description: > + All Balancer flashloans on Ethereum + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - blockchain + - tx_hash + - evt_index + columns: + - name: blockchain + - name: project + - name: version + - name: block_time + - name: block_number + - name: amount + - name: amount_usd + - name: tx_hash + - name: evt_index + - name: fee + - name: currency_contract + - name: currency_symbol + - name: recipient + - name: contract_address + - name: block_month + + - name: balancer_v2_ethereum_bpt_prices + meta: + blockchain: ethereum + project: balancer_v2 + contributors: victorstefenon, thetroyharris, viniabussafi + config: + tags: ['ethereum', 'bpt', 'prices'] + description: > + Balancer Pool Token (BPT) hourly median price by pool on Balancer, an automated portfolio manager and trading platform. + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - blockchain + - day + - contract_address + columns: + - name: blockchain + - name: day + - name: version + - name: decimals + - name: contract_address + - name: bpt_price + + - name: balancer_v2_ethereum_protocol_fee + meta: + blockchain: ethereum + project: balancer_v2 + contributors: viniabussafi + config: + tags: ['ethereum', 'revenue', 'fees'] + description: > + Daily Protocol Fee collected and Revenue by pool on Balancer, an automated portfolio manager and trading platform. + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - day + - pool_id + - token_address + columns: + - name: day + - name: pool_id + - name: pool_address + - name: pool_symbol + - name: version + - name: blockchain + - name: token_address + - name: token_symbol + - name: token_amount_raw + description: "Raw amount of revenues of the token in the pool" + - name: token_amount + description: "Amount of revenues of the token in the pool" + - name: protocol_fee_collected_usd + description: "Fee collected in the pool in USD" + - name: treasury_share + description: "Share of total revenue that is directed to Balancer DAO's treasury, as per BIPs 19, 161 and 371" + - name: treasury_revenue_usd + description: "Total revenue directed to Balancer DAO's treasury" + + - name: balancer_v2_ethereum_bpt_supply + meta: + blockchain: ethereum + project: balancer_v2 + contributors: thetroyharris, viniabussafi + config: + tags: ['ethereum', 'bpt', 'supply'] + description: > + Balancer Pool Token (BPT) supply for ComposableStablePools versions 4 and 5. + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - day + - blockchain + - token_address + columns: + - name: day + - name: pool_type + - name: version + - name: blockchain + - name: token_address + - name: supply \ No newline at end of file diff --git a/models/_project/balancer/trades/ethereum/balancer_ethereum_trades.sql b/models/balancer/ethereum/balancer_ethereum_trades.sql similarity index 100% rename from models/_project/balancer/trades/ethereum/balancer_ethereum_trades.sql rename to models/balancer/ethereum/balancer_ethereum_trades.sql diff --git a/models/_project/balancer/vebal/ethereum/balancer_ethereum_vebal_balances_day.sql b/models/balancer/ethereum/balancer_ethereum_vebal_balances_day.sql similarity index 94% rename from models/_project/balancer/vebal/ethereum/balancer_ethereum_vebal_balances_day.sql rename to models/balancer/ethereum/balancer_ethereum_vebal_balances_day.sql index dbeb8065ba9..31df281cbcf 100644 --- a/models/_project/balancer/vebal/ethereum/balancer_ethereum_vebal_balances_day.sql +++ b/models/balancer/ethereum/balancer_ethereum_vebal_balances_day.sql @@ -1,11 +1,12 @@ {{ config( schema="balancer_ethereum", + alias = 'vebal_balances_day', post_hook='{{ expose_spells(\'["ethereum"]\', - spell_type = "project", - spell_name = "balancer", - contributors = \'["markusbkoch", "mendesfabio", "stefenon", "viniabussafi"]\') }}' + "project", + "balancer", + \'["markusbkoch", "mendesfabio", "stefenon", "viniabussafi"]\') }}' ) }} diff --git a/models/_project/balancer/vebal/ethereum/balancer_ethereum_vebal_slopes.sql b/models/balancer/ethereum/balancer_ethereum_vebal_slopes.sql similarity index 93% rename from models/_project/balancer/vebal/ethereum/balancer_ethereum_vebal_slopes.sql rename to models/balancer/ethereum/balancer_ethereum_vebal_slopes.sql index bf49f4f5471..7f549cd9a81 100644 --- a/models/_project/balancer/vebal/ethereum/balancer_ethereum_vebal_slopes.sql +++ b/models/balancer/ethereum/balancer_ethereum_vebal_slopes.sql @@ -1,11 +1,12 @@ {{ config( - schema="balancer_ethereum", + schema="balancer_ethereum", + alias = 'vebal_slopes', post_hook='{{ expose_spells(\'["ethereum"]\', - spell_type = "project", - spell_name = "balancer", - contributors = \'["markusbkoch", "mendesfabio", "stefenon", "viniabussafi"]\') }}' + "project", + "balancer", + \'["markusbkoch", "mendesfabio", "stefenon", "viniabussafi"]\') }}' ) }} diff --git a/models/_project/balancer/vebal/ethereum/balancer_ethereum_vebal_votes.sql b/models/balancer/ethereum/balancer_ethereum_vebal_votes.sql similarity index 92% rename from models/_project/balancer/vebal/ethereum/balancer_ethereum_vebal_votes.sql rename to models/balancer/ethereum/balancer_ethereum_vebal_votes.sql index d52c0fe757f..17929d1105c 100644 --- a/models/_project/balancer/vebal/ethereum/balancer_ethereum_vebal_votes.sql +++ b/models/balancer/ethereum/balancer_ethereum_vebal_votes.sql @@ -1,13 +1,13 @@ {{ config( - schema = 'balancer_ethereum', + alias = 'vebal_votes', materialized = 'table', file_format = 'delta', post_hook='{{ expose_spells(\'["ethereum"]\', - spell_type = "project", - spell_name = "balancer", - contributors = \'["markusbkoch", "mendesfabio", "stefenon", "viniabussafi"]\') }}' + "project", + "balancer", + \'["markusbkoch", "mendesfabio", "stefenon", "viniabussafi"]\') }}' ) }} diff --git a/models/_project/balancer/liquidity/ethereum/balancer_v1_ethereum_liquidity.sql b/models/balancer/ethereum/balancer_v1_ethereum_liquidity.sql similarity index 92% rename from models/_project/balancer/liquidity/ethereum/balancer_v1_ethereum_liquidity.sql rename to models/balancer/ethereum/balancer_v1_ethereum_liquidity.sql index b433278b8db..31601ee7cdd 100644 --- a/models/_project/balancer/liquidity/ethereum/balancer_v1_ethereum_liquidity.sql +++ b/models/balancer/ethereum/balancer_v1_ethereum_liquidity.sql @@ -3,7 +3,11 @@ schema='balancer_v1_ethereum', alias = 'liquidity', materialized = 'table', - file_format = 'delta' + file_format = 'delta', + post_hook='{{ expose_spells(\'["ethereum"]\', + "project", + "balancer_v1", + \'["stefenon", "viniabussafi"]\') }}' ) }} diff --git a/models/_project/balancer/pools/ethereum/balancer_v1_ethereum_pools_tokens_weights.sql b/models/balancer/ethereum/balancer_v1_ethereum_pools_tokens_weights.sql similarity index 93% rename from models/_project/balancer/pools/ethereum/balancer_v1_ethereum_pools_tokens_weights.sql rename to models/balancer/ethereum/balancer_v1_ethereum_pools_tokens_weights.sql index eb0bd2626f6..01b031110e7 100644 --- a/models/_project/balancer/pools/ethereum/balancer_v1_ethereum_pools_tokens_weights.sql +++ b/models/balancer/ethereum/balancer_v1_ethereum_pools_tokens_weights.sql @@ -2,10 +2,15 @@ config( schema='balancer_v1_ethereum', alias = 'pools_tokens_weights', + materialized = 'incremental', file_format = 'delta', incremental_strategy = 'merge', - unique_key = ['pool_id', 'token_address'] + unique_key = ['pool_id', 'token_address'], + post_hook='{{ expose_spells(\'["ethereum"]\', + "project", + "balancer_v1", + \'["metacrypto", "jacektrocinski"]\') }}' ) }} diff --git a/models/_project/balancer/trades/ethereum/balancer_v1_ethereum_trades.sql b/models/balancer/ethereum/balancer_v1_ethereum_trades.sql similarity index 100% rename from models/_project/balancer/trades/ethereum/balancer_v1_ethereum_trades.sql rename to models/balancer/ethereum/balancer_v1_ethereum_trades.sql diff --git a/models/_project/balancer/bpt/ethereum/balancer_v2_ethereum_bpt_prices.sql b/models/balancer/ethereum/balancer_v2_ethereum_bpt_prices.sql similarity index 100% rename from models/_project/balancer/bpt/ethereum/balancer_v2_ethereum_bpt_prices.sql rename to models/balancer/ethereum/balancer_v2_ethereum_bpt_prices.sql diff --git a/models/_project/balancer/bpt/ethereum/balancer_v2_ethereum_bpt_supply.sql b/models/balancer/ethereum/balancer_v2_ethereum_bpt_supply.sql similarity index 100% rename from models/_project/balancer/bpt/ethereum/balancer_v2_ethereum_bpt_supply.sql rename to models/balancer/ethereum/balancer_v2_ethereum_bpt_supply.sql diff --git a/models/_project/balancer/flashloans/ethereum/balancer_v2_ethereum_flashloans.sql b/models/balancer/ethereum/balancer_v2_ethereum_flashloans.sql similarity index 88% rename from models/_project/balancer/flashloans/ethereum/balancer_v2_ethereum_flashloans.sql rename to models/balancer/ethereum/balancer_v2_ethereum_flashloans.sql index 652ad476e88..cdbd54e0a7c 100644 --- a/models/_project/balancer/flashloans/ethereum/balancer_v2_ethereum_flashloans.sql +++ b/models/balancer/ethereum/balancer_v2_ethereum_flashloans.sql @@ -6,6 +6,10 @@ , file_format = 'delta' , incremental_strategy = 'merge' , unique_key = ['tx_hash', 'evt_index'] + , post_hook='{{ expose_spells(\'["ethereum"]\', + "project", + "balancer_v2", + \'["hildobby"]\') }}' ) }} diff --git a/models/_project/balancer/pools/ethereum/balancer_v2_ethereum_lbps.sql b/models/balancer/ethereum/balancer_v2_ethereum_lbps.sql similarity index 100% rename from models/_project/balancer/pools/ethereum/balancer_v2_ethereum_lbps.sql rename to models/balancer/ethereum/balancer_v2_ethereum_lbps.sql diff --git a/models/_project/balancer/liquidity/ethereum/balancer_v2_ethereum_liquidity.sql b/models/balancer/ethereum/balancer_v2_ethereum_liquidity.sql similarity index 52% rename from models/_project/balancer/liquidity/ethereum/balancer_v2_ethereum_liquidity.sql rename to models/balancer/ethereum/balancer_v2_ethereum_liquidity.sql index 54efdce06c3..56ccd353f93 100644 --- a/models/_project/balancer/liquidity/ethereum/balancer_v2_ethereum_liquidity.sql +++ b/models/balancer/ethereum/balancer_v2_ethereum_liquidity.sql @@ -6,7 +6,11 @@ schema = 'balancer_v2_ethereum', alias = 'liquidity', materialized = 'table', - file_format = 'delta' + file_format = 'delta', + post_hook="{{ expose_spells('[\"" + blockchain + '"]' + '\', + "project", + "balancer_v2", + \'["stefenon", "viniabussafi"]\') }}' ) }} diff --git a/models/_project/balancer/pools/ethereum/balancer_v2_ethereum_pools_fees.sql b/models/balancer/ethereum/balancer_v2_ethereum_pools_fees.sql similarity index 78% rename from models/_project/balancer/pools/ethereum/balancer_v2_ethereum_pools_fees.sql rename to models/balancer/ethereum/balancer_v2_ethereum_pools_fees.sql index 8e6041c0a42..08bee4948e9 100644 --- a/models/_project/balancer/pools/ethereum/balancer_v2_ethereum_pools_fees.sql +++ b/models/balancer/ethereum/balancer_v2_ethereum_pools_fees.sql @@ -1,11 +1,16 @@ {{ config( schema = 'balancer_v2_ethereum', + alias = 'pools_fees', materialized = 'incremental', file_format = 'delta', incremental_strategy = 'merge', - unique_key = ['block_number', 'tx_hash', 'index'] + unique_key = ['block_number', 'tx_hash', 'index'], + post_hook='{{ expose_spells(\'["ethereum"]\', + "project", + "balancer_v2", + \'["metacrypto", "jacektrocinski", "thetroyharris", "viniabussafi"]\') }}' )  }} diff --git a/models/_project/balancer/pools/ethereum/balancer_v2_ethereum_pools_tokens_weights.sql b/models/balancer/ethereum/balancer_v2_ethereum_pools_tokens_weights.sql similarity index 99% rename from models/_project/balancer/pools/ethereum/balancer_v2_ethereum_pools_tokens_weights.sql rename to models/balancer/ethereum/balancer_v2_ethereum_pools_tokens_weights.sql index 3fe74c18771..fd0cfd29bb6 100644 --- a/models/_project/balancer/pools/ethereum/balancer_v2_ethereum_pools_tokens_weights.sql +++ b/models/balancer/ethereum/balancer_v2_ethereum_pools_tokens_weights.sql @@ -2,6 +2,7 @@ config( schema='balancer_v2_ethereum', alias = 'pools_tokens_weights', + materialized = 'incremental', file_format = 'delta', incremental_strategy = 'merge', diff --git a/models/_project/balancer/protocol_fee/ethereum/balancer_v2_ethereum_protocol_fee.sql b/models/balancer/ethereum/balancer_v2_ethereum_protocol_fee.sql similarity index 100% rename from models/_project/balancer/protocol_fee/ethereum/balancer_v2_ethereum_protocol_fee.sql rename to models/balancer/ethereum/balancer_v2_ethereum_protocol_fee.sql diff --git a/models/_project/balancer/trades/ethereum/balancer_v2_ethereum_trades.sql b/models/balancer/ethereum/balancer_v2_ethereum_trades.sql similarity index 94% rename from models/_project/balancer/trades/ethereum/balancer_v2_ethereum_trades.sql rename to models/balancer/ethereum/balancer_v2_ethereum_trades.sql index dfb4c2439bf..3fe902cf12b 100644 --- a/models/_project/balancer/trades/ethereum/balancer_v2_ethereum_trades.sql +++ b/models/balancer/ethereum/balancer_v2_ethereum_trades.sql @@ -4,9 +4,9 @@ alias = 'trades', materialized = 'view', post_hook = '{{ expose_spells(\'["ethereum"]\', - spell_type = "project", - spell_name = "balancer", - contributors = \'["mendesfabio", "jacektrocinski", "thetroyharris", "tomfutago", "viniabussafi"]\') }}' + "project", + "balancer_v2", + \'["mendesfabio", "jacektrocinski", "thetroyharris", "tomfutago", "viniabussafi"]\') }}' ) }} diff --git a/models/_project/balancer/bpt/ethereum/balancer_v2_ethereum_transfers_bpt.sql b/models/balancer/ethereum/balancer_v2_ethereum_transfers_bpt.sql similarity index 100% rename from models/_project/balancer/bpt/ethereum/balancer_v2_ethereum_transfers_bpt.sql rename to models/balancer/ethereum/balancer_v2_ethereum_transfers_bpt.sql diff --git a/models/_project/balancer/pools/gnosis/balancer_gnosis_pools_tokens_weights.sql b/models/balancer/gnosis/balancer_gnosis_pools_tokens_weights.sql similarity index 100% rename from models/_project/balancer/pools/gnosis/balancer_gnosis_pools_tokens_weights.sql rename to models/balancer/gnosis/balancer_gnosis_pools_tokens_weights.sql diff --git a/models/balancer/gnosis/balancer_gnosis_schema.yml b/models/balancer/gnosis/balancer_gnosis_schema.yml new file mode 100644 index 00000000000..a9ef89846ef --- /dev/null +++ b/models/balancer/gnosis/balancer_gnosis_schema.yml @@ -0,0 +1,404 @@ +version: 2 + +models: + - name: balancer_gnosis_trades + meta: + blockchain: gnosis + sector: dex + contributors: bizzyvinci + config: + tags: ['balancer', 'gnosis', 'amm', 'trades', 'dex'] + description: > + DEX trades on balancer on gnosis + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - block_date + - blockchain + - project + - version + - tx_hash + - evt_index + - check_dex_seed: + blockchain: gnosis + project: balancer + version: 2 + columns: + - &blockchain + name: blockchain + description: "Blockchain" + - &project + name: project + description: "Project name (balancer)" + - &version + name: version + description: "Version of the project" + - &block_month + name: block_month + description: "Block month in UTC" + - &block_date + name: block_date + description: "Block date in UTC" + - &block_time + name: block_time + description: 'Block time in UTC' + - &token_bought_symbol + name: token_bought_symbol + description: "Token symbol for token bought in the trade" + - &token_sold_symbol + name: token_sold_symbol + description: "Token symbol for token sold in the trade" + - &token_pair + name: token_pair + description: "Token symbol pair for each token involved in the trade" + - &token_bought_amount + name: token_bought_amount + description: "Value of the token bought at time of execution in the original currency" + - &token_sold_amount + name: token_sold_amount + description: "Value of the token sold at time of execution in the original currency" + - &token_bought_amount_raw + name: token_bought_amount_raw + description: "Raw value of the token bought at time of execution in the original currency" + - &token_sold_amount_raw + name: token_sold_amount_raw + description: "Raw value of the token sold at time of execution in the original currency" + - &amount_usd + name: amount_usd + description: "USD value of the trade at time of execution" + - &token_bought_address + name: token_bought_address + description: "Contract address of the token bought" + - &token_sold_address + name: token_sold_address + description: "Contract address of the token sold" + - &taker + name: taker + description: "Address of trader who purchased a token" + - &maker + name: maker + description: "Address of trader who sold a token" + - &pool_id + name: pool_id + description: 'Unique encoded identifier that refers to each pool' + - &swap_fee + name: swap_fee + description: 'Swap fee' + - &project_contract_address + name: project_contract_address + description: "Pool address" + - name: pool_symbol + - name: pool_type + - &tx_hash + name: tx_hash + description: "Transaction hash" + - &tx_from + name: tx_from + description: "transaction.from" + - &tx_to + name: tx_to + description: "transaction.to" + - &evt_index + name: evt_index + description: "Event index" + + - name: balancer_v2_gnosis_flashloans + meta: + blockchain: gnosis + sector: lending + contributors: hildobby + config: + tags: ['gnosis', 'flashloans'] + description: > + All Balancer flashloans on Gnosis + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - blockchain + - tx_hash + - evt_index + columns: + - name: blockchain + - name: project + - name: version + - name: block_time + - name: block_number + - name: amount + - name: amount_usd + - name: tx_hash + - name: evt_index + - name: fee + - name: currency_contract + - name: currency_symbol + - name: recipient + - name: contract_address + - name: block_month + + - name: balancer_v2_gnosis_bpt_prices + meta: + blockchain: gnosis + project: balancer_v2 + contributors: thetroyharris, viniabussafi + config: + tags: ['gnosis', 'bpt', 'prices'] + description: > + Balancer Pool Token (BPT) hourly median price by pool on Balancer, an automated portfolio manager and trading platform. + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - blockchain + - day + - contract_address + columns: + - name: blockchain + - name: day + - name: version + - name: decimals + - name: contract_address + - name: bpt_price + + - name: balancer_v2_gnosis_pools_fees + meta: + blockchain: gnosis + project: balancer_v2 + contributors: jacektrocinski, thetroyharris, viniabussafi + config: + tags: ['gnosis', 'balancer', 'pools_fees'] + description: > + Balancer v2 swap fees stored at the pool level. + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - block_number + - tx_hash + - index + columns: + - name: blockchain + - name: version + - name: contract_address + - name: tx_hash + - name: index + - name: tx_index + - name: block_time + - name: block_number + - name: swap_fee_percentage + + - name: balancer_v2_gnosis_trades + meta: + blockchain: gnosis + sector: dex + contributors: bizzyvinci, thetroyharris, tomfutago, viniabussafi + config: + tags: [ 'balancer', 'gnosis', 'amm', 'trades', 'dex', 'beta' ] + description: > + DEX trades on balancer v2 on gnosis + columns: + - *blockchain + - *project + - *version + - *block_month + - *block_date + - *block_time + - name: block_number + - *token_bought_symbol + - *token_sold_symbol + - *token_pair + - *token_bought_amount + - *token_sold_amount + - *token_bought_amount_raw + - *token_sold_amount_raw + - *amount_usd + - *token_bought_address + - *token_sold_address + - *taker + - *maker + - *project_contract_address + - name: pool_symbol + - name: pool_type + - *pool_id + - *swap_fee + - *tx_hash + - *tx_from + - *tx_to + - *evt_index + + - name: balancer_v2_gnosis_liquidity + meta: + blockchain: gnosis + project: balancer_v2 + contributors: victorstefenon, viniabussafi, thetroyharris + config: + tags: ['gnosis', 'balancer', 'pools', 'liquidity'] + description: > + Balancer v2 pools liquidity by token in Gnosis. + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - day + - pool_id + - token_address + columns: + - name: day + description: 'UTC event block time truncated to the day mark' + - *pool_id + - name: pool_address + - name: pool_symbol + description: 'Symbol of the pool, consisting of the symbol of its tokens and their respective weights' + - name: version + description: 'Version of Balancer in which pool was deployed' + - name: blockchain + description: 'Blockchain in which pool was deployed' + - name: token_address + - name: token_symbol + description: 'Symbol of the token' + - name: token_balance_raw + description: 'Raw balance of the token in the pool' + - name: token_balance + description: 'Scaled balance of the token in the pool' + - name: protocol_liquidity_usd + description: 'Liquidity of the token in the pool in USD, except BPTs' + - name: protocol_liquidity_eth + description: 'Liquidity of the token in the pool in ETH, except BPTs' + - name: pool_liquidity_usd + description: 'Liquidity of the token in the pool in USD, including BPTs' + - name: pool_liquidity_eth + description: 'Liquidity of the token in the pool in ETH, including BPTs' + + + - name: balancer_gnosis_pools_tokens_weights + meta: + blockchain: gnosis + project: balancer + contributors: jacektrocinski, viniabussafi + config: + tags: ['gnosis', 'balancer', 'pools', 'tokens', 'weights'] + description: > + Token weights in Balancer pools. + columns: + - *blockchain + - name: version + - *pool_id + - &token_address + name: token_address + description: 'Contract address for the token' + - &normalized_weight + name: normalized_weight + description: 'Weight of the token in the pool.' + + - name: balancer_v2_gnosis_pools_tokens_weights + meta: + blockchain: gnosis + project: balancer + contributors: metacrypto, jacektrocinski, viniabussafi + config: + tags: ['gnosis', 'balancer', 'pools', 'tokens', 'weights'] + description: > + Token weights in Balancer v2 pools. + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - pool_id + - token_address + columns: + - *blockchain + - name: version + - *pool_id + - *token_address + - *normalized_weight + + - name: balancer_v2_gnosis_transfers_bpt + meta: + blockchain: gnosis + project: balancer_v2 + contributors: victorstefenon, thetroyharris, viniabussafi + config: + tags: ['gnosis', 'bpt', 'transfers'] + description: > + Balancer Pool Token (BPT) transfer logs on Balancer, an automated portfolio manager and trading platform, on Gnosis. + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - evt_tx_hash + - evt_index + - block_date + columns: + - name: blockchain + - name: version + - name: contract_address + - name: block_date + - name: block_month + - name: evt_tx_hash + - name: evt_index + - &evt_block_time + name: evt_block_time + description: 'Block time of transfer event' + - &evt_block_number + name: evt_block_number + description: 'Block number of transfer event' + - &from + name: from + description: 'Address of BPT provider of transfer event' + - &to + name: to + description: 'Address of BPT receiver of transfer event' + - &value + name: value + description: 'Amount of BPT transferred in transfer event' + + - name: balancer_v2_gnosis_protocol_fee + meta: + blockchain: gnosis + project: balancer_v2 + contributors: viniabussafi + config: + tags: ['gnosis', 'revenue', 'fees'] + description: > + Daily Protocol Fee collected and Revenue by pool on Balancer, an automated portfolio manager and trading platform. + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - day + - pool_id + - token_address + columns: + - name: day + - name: pool_id + - name: pool_address + - name: pool_symbol + - name: version + - name: blockchain + - name: token_address + - name: token_symbol + - name: token_amount_raw + description: "Raw amount of revenues of the token in the pool" + - name: token_amount + description: "Amount of revenues of the token in the pool" + - name: protocol_fee_collected_usd + description: "Fee collected in the pool in USD" + - name: treasury_share + description: "Share of total revenue that is directed to Balancer DAO's treasury, as per BIPs 19, 161 and 371" + - name: treasury_revenue + description: "Total revenue directed to Balancer DAO's treasury" + + - name: balancer_v2_gnosis_bpt_supply + meta: + blockchain: gnosis + project: balancer_v2 + contributors: thetroyharris, viniabussafi + config: + tags: ['gnosis', 'bpt', 'supply'] + description: > + Balancer Pool Token (BPT) supply for ComposableStablePools versions 4 and 5. + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - day + - blockchain + - token_address + columns: + - name: day + - name: pool_type + - name: version + - name: blockchain + - name: token_address + - name: supply \ No newline at end of file diff --git a/models/_project/balancer/trades/gnosis/balancer_gnosis_trades.sql b/models/balancer/gnosis/balancer_gnosis_trades.sql similarity index 100% rename from models/_project/balancer/trades/gnosis/balancer_gnosis_trades.sql rename to models/balancer/gnosis/balancer_gnosis_trades.sql diff --git a/models/_project/balancer/bpt/gnosis/balancer_v2_gnosis_bpt_prices.sql b/models/balancer/gnosis/balancer_v2_gnosis_bpt_prices.sql similarity index 100% rename from models/_project/balancer/bpt/gnosis/balancer_v2_gnosis_bpt_prices.sql rename to models/balancer/gnosis/balancer_v2_gnosis_bpt_prices.sql diff --git a/models/_project/balancer/bpt/gnosis/balancer_v2_gnosis_bpt_supply.sql b/models/balancer/gnosis/balancer_v2_gnosis_bpt_supply.sql similarity index 100% rename from models/_project/balancer/bpt/gnosis/balancer_v2_gnosis_bpt_supply.sql rename to models/balancer/gnosis/balancer_v2_gnosis_bpt_supply.sql diff --git a/models/_project/balancer/flashloans/gnosis/balancer_v2_gnosis_flashloans.sql b/models/balancer/gnosis/balancer_v2_gnosis_flashloans.sql similarity index 88% rename from models/_project/balancer/flashloans/gnosis/balancer_v2_gnosis_flashloans.sql rename to models/balancer/gnosis/balancer_v2_gnosis_flashloans.sql index f8d11b83452..7a4dd71de65 100644 --- a/models/_project/balancer/flashloans/gnosis/balancer_v2_gnosis_flashloans.sql +++ b/models/balancer/gnosis/balancer_v2_gnosis_flashloans.sql @@ -6,6 +6,10 @@ , file_format = 'delta' , incremental_strategy = 'merge' , unique_key = ['tx_hash', 'evt_index'] + , post_hook='{{ expose_spells(\'["gnosis"]\', + "project", + "balancer_v2", + \'["hildobby"]\') }}' ) }} diff --git a/models/_project/balancer/liquidity/gnosis/balancer_v2_gnosis_liquidity.sql b/models/balancer/gnosis/balancer_v2_gnosis_liquidity.sql similarity index 51% rename from models/_project/balancer/liquidity/gnosis/balancer_v2_gnosis_liquidity.sql rename to models/balancer/gnosis/balancer_v2_gnosis_liquidity.sql index fc5885a24e0..478f1b6c77f 100644 --- a/models/_project/balancer/liquidity/gnosis/balancer_v2_gnosis_liquidity.sql +++ b/models/balancer/gnosis/balancer_v2_gnosis_liquidity.sql @@ -6,7 +6,11 @@ schema = 'balancer_v2_gnosis', alias = 'liquidity', materialized = 'table', - file_format = 'delta' + file_format = 'delta', + post_hook="{{ expose_spells('[\"" + blockchain + '"]' + '\', + "project", + "balancer_v2", + \'["stefenon", "viniabussafi"]\') }}' ) }} diff --git a/models/_project/balancer/pools/gnosis/balancer_v2_gnosis_pools_fees.sql b/models/balancer/gnosis/balancer_v2_gnosis_pools_fees.sql similarity index 77% rename from models/_project/balancer/pools/gnosis/balancer_v2_gnosis_pools_fees.sql rename to models/balancer/gnosis/balancer_v2_gnosis_pools_fees.sql index 086072fc70b..de1a7618af6 100644 --- a/models/_project/balancer/pools/gnosis/balancer_v2_gnosis_pools_fees.sql +++ b/models/balancer/gnosis/balancer_v2_gnosis_pools_fees.sql @@ -1,12 +1,17 @@ {{ config( schema = 'balancer_v2_gnosis', + alias = 'pools_fees', materialized = 'incremental', file_format = 'delta', incremental_strategy = 'merge', - unique_key = ['block_number', 'tx_hash', 'index'] - ) + unique_key = ['block_number', 'tx_hash', 'index'], + post_hook='{{ expose_spells(\'["gnosis"]\', + "project", + "balancer_v2", + \'["metacrypto", "jacektrocinski", "thetroyharris", "viniabussafi"]\') }}' + )  }} {% set event_signature = '0xa9ba3ffe0b6c366b81232caab38605a0699ad5398d6cce76f91ee809e322dafc' %} diff --git a/models/_project/balancer/pools/gnosis/balancer_v2_gnosis_pools_tokens_weights.sql b/models/balancer/gnosis/balancer_v2_gnosis_pools_tokens_weights.sql similarity index 99% rename from models/_project/balancer/pools/gnosis/balancer_v2_gnosis_pools_tokens_weights.sql rename to models/balancer/gnosis/balancer_v2_gnosis_pools_tokens_weights.sql index a4b0a7688a8..ee2bef6e0a7 100644 --- a/models/_project/balancer/pools/gnosis/balancer_v2_gnosis_pools_tokens_weights.sql +++ b/models/balancer/gnosis/balancer_v2_gnosis_pools_tokens_weights.sql @@ -2,6 +2,7 @@ config( schema='balancer_v2_gnosis', alias = 'pools_tokens_weights', + materialized = 'incremental', file_format = 'delta', incremental_strategy = 'merge', diff --git a/models/_project/balancer/protocol_fee/gnosis/balancer_v2_gnosis_protocol_fee.sql b/models/balancer/gnosis/balancer_v2_gnosis_protocol_fee.sql similarity index 100% rename from models/_project/balancer/protocol_fee/gnosis/balancer_v2_gnosis_protocol_fee.sql rename to models/balancer/gnosis/balancer_v2_gnosis_protocol_fee.sql diff --git a/models/_project/balancer/trades/gnosis/balancer_v2_gnosis_trades.sql b/models/balancer/gnosis/balancer_v2_gnosis_trades.sql similarity index 94% rename from models/_project/balancer/trades/gnosis/balancer_v2_gnosis_trades.sql rename to models/balancer/gnosis/balancer_v2_gnosis_trades.sql index 090b5b9e737..c895c351328 100644 --- a/models/_project/balancer/trades/gnosis/balancer_v2_gnosis_trades.sql +++ b/models/balancer/gnosis/balancer_v2_gnosis_trades.sql @@ -4,9 +4,9 @@ alias = 'trades', materialized = 'view', post_hook = '{{ expose_spells(\'["gnosis"]\', - spell_type = "project", - spell_name = "balancer", - contributors = \'["mendesfabio", "jacektrocinski", "thetroyharris", "tomfutago", "viniabussafi"]\') }}' + "project", + "balancer_v2", + \'["mendesfabio", "jacektrocinski", "thetroyharris", "tomfutago", "viniabussafi"]\') }}' ) }} diff --git a/models/_project/balancer/bpt/gnosis/balancer_v2_gnosis_transfers_bpt.sql b/models/balancer/gnosis/balancer_v2_gnosis_transfers_bpt.sql similarity index 100% rename from models/_project/balancer/bpt/gnosis/balancer_v2_gnosis_transfers_bpt.sql rename to models/balancer/gnosis/balancer_v2_gnosis_transfers_bpt.sql diff --git a/models/_project/balancer/pools/optimism/balancer_optimism_gauge_mappings.sql b/models/balancer/optimism/balancer_optimism_gauge_mappings.sql similarity index 87% rename from models/_project/balancer/pools/optimism/balancer_optimism_gauge_mappings.sql rename to models/balancer/optimism/balancer_optimism_gauge_mappings.sql index 10ecdde4e86..382424a91be 100644 --- a/models/_project/balancer/pools/optimism/balancer_optimism_gauge_mappings.sql +++ b/models/balancer/optimism/balancer_optimism_gauge_mappings.sql @@ -1,15 +1,16 @@ {{ config( schema = 'balancer_optimism', + alias = 'gauge_mappings', materialized = 'incremental', file_format = 'delta', incremental_strategy = 'merge', unique_key = ['pool_contract', 'incentives_contract'], post_hook='{{ expose_spells(\'["optimism"]\', - spell_type = "project", - spell_name = "balancer", - contributors = \'["msilb7"]\') }}' + "project", + "balancer", + \'["msilb7"]\') }}' )  }} diff --git a/models/_project/balancer/pools/optimism/balancer_optimism_pools_tokens_weights.sql b/models/balancer/optimism/balancer_optimism_pools_tokens_weights.sql similarity index 86% rename from models/_project/balancer/pools/optimism/balancer_optimism_pools_tokens_weights.sql rename to models/balancer/optimism/balancer_optimism_pools_tokens_weights.sql index 204da50aa15..b6bdf48de02 100644 --- a/models/_project/balancer/pools/optimism/balancer_optimism_pools_tokens_weights.sql +++ b/models/balancer/optimism/balancer_optimism_pools_tokens_weights.sql @@ -1,6 +1,7 @@ {{ config( schema = 'balancer_optimism', - alias = 'pools_tokens_weights' + alias = 'pools_tokens_weights', + ) }} diff --git a/models/balancer/optimism/balancer_optimism_schema.yml b/models/balancer/optimism/balancer_optimism_schema.yml new file mode 100644 index 00000000000..bb4c52fbe0e --- /dev/null +++ b/models/balancer/optimism/balancer_optimism_schema.yml @@ -0,0 +1,464 @@ +version: 2 + +models: + - name: balancer_v2_optimism_pools_fees + meta: + blockchain: optimism + project: balancer_v2 + contributors: jacektrocinski, thetroyharris, viniabussafi + config: + tags: ['optimism', 'balancer', 'pools_fees'] + description: > + Balancer v2 swap fees stored at the pool level. + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - block_number + - tx_hash + - index + columns: + - name: blockchain + - name: version + - &contract_address + name: contract_address + description: 'Optimism address for the liquidity pool used in transaction' + tests: + - not_null + - &tx_hash + name: tx_hash + description: 'Transaction hash' + tests: + - not_null + - &index + name: index + description: '' + tests: + - not_null + - &tx_index + name: tx_index + description: '' + tests: + - not_null + - &block_time + name: block_time + description: 'Block time in UTC' + tests: + - not_null + - &block_number + name: block_number + description: 'Block number' + tests: + - not_null + - &swap_fee_percentage + name: swap_fee_percentage + description: 'Swap fees for the pool, values are returned with 18 decimals (1e18 meaning 100%)' + tests: + - not_null + + - name: balancer_v2_optimism_transfers_bpt + meta: + blockchain: optimism + project: balancer_v2 + contributors: victorstefenon, thetroyharris, viniabussafi + config: + tags: ['optimism', 'bpt', 'transfers'] + description: > + Balancer Pool Token (BPT) transfer logs on Balancer, an automated portfolio manager and trading platform, on Optimism. + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - evt_tx_hash + - evt_index + - block_date + columns: + - &blockchain + name: blockchain + description: "Blockchain" + - name: version + - *contract_address + - &block_date + name: block_date + description: "UTC event block date of each DEX trade" + - &block_month + name: block_month + description: "UTC event block month of each DEX trade" + - &evt_tx_hash + name: evt_tx_hash + description: 'Transaction hash of transfer event' + - &evt_index + name: evt_index + description: 'Event index' + - &evt_block_time + name: evt_block_time + description: 'Block time of transfer event' + - &evt_block_number + name: evt_block_number + description: 'Block number of transfer event' + - &from + name: from + description: 'Address of BPT provider of transfer event' + - &to + name: to + description: 'Address of BPT receiver of transfer event' + - &value + name: value + description: 'Amount of BPT transferred in transfer event' + + - name: balancer_optimism_pools_tokens_weights + meta: + blockchain: optimism + project: balancer + contributors: jacektrocinski, viniabussafi + config: + tags: ['optimism', 'balancer', 'pools', 'tokens', 'weights'] + description: > + Token weights in Balancer pools. + columns: + - *blockchain + - name: version + - &pool_id + name: pool_id + description: 'Unique encoded identifier that refers to each pool' + tests: + - not_null + - &token_address + name: token_address + description: 'Contract address for the token' + - &normalized_weight + name: normalized_weight + description: 'Weight of the token in the pool.' + + - name: balancer_v2_optimism_pools_tokens_weights + meta: + blockchain: optimism + project: balancer + contributors: jacektrocinski, viniabussafi + config: + tags: ['optimism', 'balancer', 'pools', 'tokens', 'weights'] + description: > + Token weights in Balancer v2 pools. + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - pool_id + - token_address + columns: + - *blockchain + - name: version + - *pool_id + - *token_address + - *normalized_weight + + - name: balancer_optimism_trades + meta: + blockchain: optimism + sector: dex + contributors: bizzyvinci + config: + tags: ['balancer', 'optimism', 'amm', 'trades', 'dex'] + description: > + DEX trades on balancer on optimism + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - block_date + - blockchain + - project + - version + - tx_hash + - evt_index + - check_dex_seed: + blockchain: optimism + project: balancer + version: 2 + columns: + - *blockchain + - &project + name: project + description: "Project name (balancer)" + - &version + name: version + description: "Version of the project" + - *block_month + - *block_date + - *block_time + - &token_bought_symbol + name: token_bought_symbol + description: "Token symbol for token bought in the trade" + - &token_sold_symbol + name: token_sold_symbol + description: "Token symbol for token sold in the trade" + - &token_pair + name: token_pair + description: "Token symbol pair for each token involved in the trade" + - &token_bought_amount + name: token_bought_amount + description: "Value of the token bought at time of execution in the original currency" + - &token_sold_amount + name: token_sold_amount + description: "Value of the token sold at time of execution in the original currency" + - &token_bought_amount_raw + name: token_bought_amount_raw + description: "Raw value of the token bought at time of execution in the original currency" + - &token_sold_amount_raw + name: token_sold_amount_raw + description: "Raw value of the token sold at time of execution in the original currency" + - &amount_usd + name: amount_usd + description: "USD value of the trade at time of execution" + - &token_bought_address + name: token_bought_address + description: "Contract address of the token bought" + - &token_sold_address + name: token_sold_address + description: "Contract address of the token sold" + - &taker + name: taker + description: "Address of trader who purchased a token" + - &maker + name: maker + description: "Address of trader who sold a token" + - *pool_id + - &swap_fee + name: swap_fee + description: 'Swap fee' + - &project_contract_address + name: project_contract_address + description: "Pool address" + - name: pool_symbol + - name: pool_type + - *tx_hash + - &tx_from + name: tx_from + description: "transaction.from" + - &tx_to + name: tx_to + description: "transaction.to" + - *evt_index + + - name: balancer_v2_optimism_liquidity + meta: + blockchain: optimism + project: balancer_v2 + contributors: victorstefenon, viniabussafi, thetroyharris + config: + tags: ['optimism', 'balancer', 'pools', 'liquidity'] + description: > + Balancer v2 pools liquidity by token in Optimism. + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - day + - pool_id + - token_address + columns: + - name: day + description: 'UTC event block time truncated to the day mark' + - *pool_id + - name: pool_address + - name: pool_symbol + description: 'Symbol of the pool, consisting of the symbol of its tokens and their respective weights' + - name: version + description: 'Version of Balancer in which pool was deployed' + - name: blockchain + description: 'Blockchain in which pool was deployed' + - *token_address + - name: token_symbol + description: 'Symbol of the token' + - name: token_balance_raw + description: 'Raw balance of the token in the pool' + - name: token_balance + description: 'Scaled balance of the token in the pool' + - name: protocol_liquidity_usd + description: 'Liquidity of the token in the pool in USD, except BPTs' + - name: protocol_liquidity_eth + description: 'Liquidity of the token in the pool in ETH, except BPTs' + - name: pool_liquidity_usd + description: 'Liquidity of the token in the pool in USD, including BPTs' + - name: pool_liquidity_eth + description: 'Liquidity of the token in the pool in ETH, including BPTs' + + - name: balancer_optimism_gauge_mappings + meta: + blockchain: optimism + project: balancer + contributors: msilb7 + config: + tags: ['optimism', 'balancer', 'gauges', 'incentives'] + description: > + Balancer gauge to pool mappings on Optimism. + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - pool_contract + - incentives_contract + columns: + - *blockchain + - *version + - &pool_contract + name: pool_contract + description: "Address of the liquidity pool contract" + - *pool_id + - &incentives_contract + name: incentives_contract + description: "Address of the contract where incentives are stored and emitted." + - &incentives_type + name: incentives_type + description: "Description of the incentives address type." + - *evt_block_time + - *evt_block_number + - *contract_address + - *evt_tx_hash + - *evt_index + + - name: balancer_v2_optimism_flashloans + meta: + blockchain: optimism + sector: lending + contributors: hildobby + config: + tags: ['optimism', 'flashloans'] + description: > + All Balancer flashloans on Optimism + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - blockchain + - tx_hash + - evt_index + columns: + - name: blockchain + - name: project + - name: version + - name: block_time + - name: block_number + - name: amount + - name: amount_usd + - name: tx_hash + - name: evt_index + - name: fee + - name: currency_contract + - name: currency_symbol + - name: recipient + - name: contract_address + - name: block_month + + - name: balancer_v2_optimism_bpt_prices + meta: + blockchain: optimism + project: balancer_v2 + contributors: victorstefenon, thetroyharris, viniabussafi + config: + tags: ['optimism', 'bpt', 'prices'] + description: > + Balancer Pool Token (BPT) hourly median price by pool on Balancer, an automated portfolio manager and trading platform. + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - blockchain + - day + - contract_address + columns: + - name: blockchain + - name: day + - name: version + - name: decimals + - name: contract_address + - name: bpt_price + + - name: balancer_v2_optimism_trades + meta: + blockchain: optimism + sector: dex + contributors: bizzyvinci, thetroyharris, tomfutago, viniabussafi + config: + tags: [ 'balancer', 'optimism', 'amm', 'trades', 'dex', 'beta' ] + description: > + DEX trades on balancer v2 on optimism + columns: + - *blockchain + - *project + - *version + - *block_month + - *block_date + - *block_time + - name: block_number + - *token_bought_symbol + - *token_sold_symbol + - *token_pair + - *token_bought_amount + - *token_sold_amount + - *token_bought_amount_raw + - *token_sold_amount_raw + - *amount_usd + - *token_bought_address + - *token_sold_address + - *taker + - *maker + - *project_contract_address + - name: pool_symbol + - name: pool_type + - *pool_id + - *swap_fee + - *tx_hash + - *tx_from + - *tx_to + - *evt_index + + - name: balancer_v2_optimism_protocol_fee + meta: + blockchain: optimism + project: balancer_v2 + contributors: viniabussafi + config: + tags: ['optimism', 'revenue', 'fees'] + description: > + Daily Protocol Fee collected and Revenue by pool on Balancer, an automated portfolio manager and trading platform. + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - day + - pool_id + - token_address + columns: + - name: day + - name: pool_id + - name: pool_address + - name: pool_symbol + - name: version + - name: blockchain + - name: token_address + - name: token_symbol + - name: token_amount_raw + description: "Raw amount of revenues of the token in the pool" + - name: token_amount + description: "Amount of revenues of the token in the pool" + - name: protocol_fee_collected_usd + description: "Fee collected in the pool in USD" + - name: treasury_share + description: "Share of total revenue that is directed to Balancer DAO's treasury, as per BIPs 19, 161 and 371" + - name: treasury_revenue_usd + description: "Total revenue directed to Balancer DAO's treasury" + + - name: balancer_v2_optimism_bpt_supply + meta: + blockchain: optimism + project: balancer_v2 + contributors: thetroyharris, viniabussafi + config: + tags: ['optimism', 'bpt', 'supply'] + description: > + Balancer Pool Token (BPT) supply for ComposableStablePools versions 4 and 5. + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - day + - blockchain + - token_address + columns: + - name: day + - name: pool_type + - name: version + - name: blockchain + - name: token_address + - name: supply \ No newline at end of file diff --git a/models/_project/balancer/trades/optimism/balancer_optimism_trades.sql b/models/balancer/optimism/balancer_optimism_trades.sql similarity index 100% rename from models/_project/balancer/trades/optimism/balancer_optimism_trades.sql rename to models/balancer/optimism/balancer_optimism_trades.sql diff --git a/models/_project/balancer/bpt/optimism/balancer_v2_optimism_bpt_prices.sql b/models/balancer/optimism/balancer_v2_optimism_bpt_prices.sql similarity index 100% rename from models/_project/balancer/bpt/optimism/balancer_v2_optimism_bpt_prices.sql rename to models/balancer/optimism/balancer_v2_optimism_bpt_prices.sql diff --git a/models/_project/balancer/bpt/optimism/balancer_v2_optimism_bpt_supply.sql b/models/balancer/optimism/balancer_v2_optimism_bpt_supply.sql similarity index 100% rename from models/_project/balancer/bpt/optimism/balancer_v2_optimism_bpt_supply.sql rename to models/balancer/optimism/balancer_v2_optimism_bpt_supply.sql diff --git a/models/_project/balancer/flashloans/optimism/balancer_v2_optimism_flashloans.sql b/models/balancer/optimism/balancer_v2_optimism_flashloans.sql similarity index 88% rename from models/_project/balancer/flashloans/optimism/balancer_v2_optimism_flashloans.sql rename to models/balancer/optimism/balancer_v2_optimism_flashloans.sql index c7036fcc2ac..9908e24f7b3 100644 --- a/models/_project/balancer/flashloans/optimism/balancer_v2_optimism_flashloans.sql +++ b/models/balancer/optimism/balancer_v2_optimism_flashloans.sql @@ -6,6 +6,10 @@ , file_format = 'delta' , incremental_strategy = 'merge' , unique_key = ['tx_hash', 'evt_index'] + , post_hook='{{ expose_spells(\'["optimism"]\', + "project", + "balancer_v2", + \'["hildobby"]\') }}' ) }} diff --git a/models/_project/balancer/liquidity/optimism/balancer_v2_optimism_liquidity.sql b/models/balancer/optimism/balancer_v2_optimism_liquidity.sql similarity index 52% rename from models/_project/balancer/liquidity/optimism/balancer_v2_optimism_liquidity.sql rename to models/balancer/optimism/balancer_v2_optimism_liquidity.sql index b34e0e3557a..d9e8ac55868 100644 --- a/models/_project/balancer/liquidity/optimism/balancer_v2_optimism_liquidity.sql +++ b/models/balancer/optimism/balancer_v2_optimism_liquidity.sql @@ -6,7 +6,11 @@ schema = 'balancer_v2_optimism', alias = 'liquidity', materialized = 'table', - file_format = 'delta' + file_format = 'delta', + post_hook="{{ expose_spells('[\"" + blockchain + '"]' + '\', + "project", + "balancer_v2", + \'["stefenon", "viniabussafi"]\') }}' ) }} diff --git a/models/_project/balancer/pools/optimism/balancer_v2_optimism_pools_fees.sql b/models/balancer/optimism/balancer_v2_optimism_pools_fees.sql similarity index 77% rename from models/_project/balancer/pools/optimism/balancer_v2_optimism_pools_fees.sql rename to models/balancer/optimism/balancer_v2_optimism_pools_fees.sql index 7cde533a681..adeeb98918e 100644 --- a/models/_project/balancer/pools/optimism/balancer_v2_optimism_pools_fees.sql +++ b/models/balancer/optimism/balancer_v2_optimism_pools_fees.sql @@ -1,12 +1,17 @@ {{ config( schema = 'balancer_v2_optimism', + alias = 'pools_fees', materialized = 'incremental', file_format = 'delta', incremental_strategy = 'merge', - unique_key = ['block_number', 'tx_hash', 'index'] - ) + unique_key = ['block_number', 'tx_hash', 'index'], + post_hook='{{ expose_spells(\'["optimism"]\', + "project", + "balancer_v2", + \'["metacrypto", "jacektrocinski", "thetroyharris", "viniabussafi"]\') }}' + )  }} {% set event_signature = '0xa9ba3ffe0b6c366b81232caab38605a0699ad5398d6cce76f91ee809e322dafc' %} diff --git a/models/_project/balancer/pools/optimism/balancer_v2_optimism_pools_tokens_weights.sql b/models/balancer/optimism/balancer_v2_optimism_pools_tokens_weights.sql similarity index 99% rename from models/_project/balancer/pools/optimism/balancer_v2_optimism_pools_tokens_weights.sql rename to models/balancer/optimism/balancer_v2_optimism_pools_tokens_weights.sql index 0888c1c2a0b..74220656f88 100644 --- a/models/_project/balancer/pools/optimism/balancer_v2_optimism_pools_tokens_weights.sql +++ b/models/balancer/optimism/balancer_v2_optimism_pools_tokens_weights.sql @@ -2,6 +2,7 @@ config( schema='balancer_v2_optimism', alias = 'pools_tokens_weights', + materialized = 'incremental', file_format = 'delta', incremental_strategy = 'merge', diff --git a/models/_project/balancer/protocol_fee/optimism/balancer_v2_optimism_protocol_fee.sql b/models/balancer/optimism/balancer_v2_optimism_protocol_fee.sql similarity index 100% rename from models/_project/balancer/protocol_fee/optimism/balancer_v2_optimism_protocol_fee.sql rename to models/balancer/optimism/balancer_v2_optimism_protocol_fee.sql diff --git a/models/_project/balancer/trades/optimism/balancer_v2_optimism_trades.sql b/models/balancer/optimism/balancer_v2_optimism_trades.sql similarity index 94% rename from models/_project/balancer/trades/optimism/balancer_v2_optimism_trades.sql rename to models/balancer/optimism/balancer_v2_optimism_trades.sql index b53e845ddd6..03327617f4f 100644 --- a/models/_project/balancer/trades/optimism/balancer_v2_optimism_trades.sql +++ b/models/balancer/optimism/balancer_v2_optimism_trades.sql @@ -4,9 +4,9 @@ alias = 'trades', materialized = 'view', post_hook = '{{ expose_spells(\'["optimism"]\', - spell_type = "project", - spell_name = "balancer", - contributors = \'["mendesfabio", "jacektrocinski", "thetroyharris", "tomfutago", "viniabussafi"]\') }}' + "project", + "balancer_v2", + \'["mendesfabio", "jacektrocinski", "thetroyharris", "tomfutago", "viniabussafi"]\') }}' ) }} diff --git a/models/_project/balancer/bpt/optimism/balancer_v2_optimism_transfers_bpt.sql b/models/balancer/optimism/balancer_v2_optimism_transfers_bpt.sql similarity index 100% rename from models/_project/balancer/bpt/optimism/balancer_v2_optimism_transfers_bpt.sql rename to models/balancer/optimism/balancer_v2_optimism_transfers_bpt.sql diff --git a/models/_project/balancer/pools/polygon/balancer_polygon_pools_tokens_weights.sql b/models/balancer/polygon/balancer_polygon_pools_tokens_weights.sql similarity index 100% rename from models/_project/balancer/pools/polygon/balancer_polygon_pools_tokens_weights.sql rename to models/balancer/polygon/balancer_polygon_pools_tokens_weights.sql diff --git a/models/balancer/polygon/balancer_polygon_schema.yml b/models/balancer/polygon/balancer_polygon_schema.yml new file mode 100644 index 00000000000..4f2bbd24412 --- /dev/null +++ b/models/balancer/polygon/balancer_polygon_schema.yml @@ -0,0 +1,454 @@ +version: 2 + +models: + - name: balancer_v2_polygon_pools_fees + meta: + blockchain: polygon + project: balancer_v2 + contributors: jacektrocinski, thetroyharris, viniabussafi + config: + tags: ['polygon', 'balancer', 'pools_fees'] + description: > + Balancer v2 swap fees stored at the pool level. + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - block_number + - tx_hash + - index + columns: + - name: blockchain + - name: version + - &contract_address + name: contract_address + description: 'Polygon address for the liquidity pool used in transaction' + tests: + - not_null + - &tx_hash + name: tx_hash + description: 'Transaction hash' + tests: + - not_null + - &index + name: index + description: '' + tests: + - not_null + - &tx_index + name: tx_index + description: '' + tests: + - not_null + - &block_time + name: block_time + description: '' + tests: + - not_null + - &block_number + name: block_number + description: 'Block number' + tests: + - not_null + - &swap_fee_percentage + name: swap_fee_percentage + description: 'Swap fees for the pool, values are returned with 18 decimals (1e18 meaning 100%)' + tests: + - not_null + + - name: balancer_v2_polygon_transfers_bpt + meta: + blockchain: polygon + project: balancer_v2 + contributors: victorstefenon, thetroyharris, viniabussafi + config: + tags: ['polygon', 'bpt', 'transfers'] + description: > + Balancer Pool Token (BPT) transfer logs on Balancer, an automated portfolio manager and trading platform, on Polygon. + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - evt_tx_hash + - evt_index + - block_date + columns: + - &blockchain + name: blockchain + description: "Blockchain" + - name: version + - *contract_address + - &block_date + name: block_date + description: "UTC event block date of each DEX trade" + - &block_month + name: block_month + description: "UTC event block month of each DEX trade" + - &evt_tx_hash + name: evt_tx_hash + description: 'Transaction hash of transfer event' + - &evt_index + name: evt_index + description: 'Event index' + - &evt_block_time + name: evt_block_time + description: 'Block time of transfer event' + - &evt_block_number + name: evt_block_number + description: 'Block number of transfer event' + - &from + name: from + description: 'Address of BPT provider of transfer event' + - &to + name: to + description: 'Address of BPT receiver of transfer event' + - &value + name: value + description: 'Amount of BPT transferred in transfer event' + + - name: balancer_polygon_pools_tokens_weights + meta: + blockchain: polygon + project: balancer + contributors: jacektrocinski, viniabussafi + config: + tags: ['polygon', 'balancer', 'pools', 'tokens', 'weights'] + description: > + Token weights in Balancer pools. + columns: + - *blockchain + - name: version + - &pool_id + name: pool_id + description: 'Unique encoded identifier that refers to each pool' + tests: + - not_null + - &token_address + name: token_address + description: 'Contract address for the token' + - &normalized_weight + name: normalized_weight + description: 'Weight of the token in the pool.' + + - name: balancer_v2_polygon_pools_tokens_weights + meta: + blockchain: polygon + project: balancer + contributors: jacektrocinski, viniabussafi + config: + tags: ['polygon', 'balancer', 'pools', 'tokens', 'weights'] + description: > + Token weights in Balancer v2 pools. + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - pool_id + - token_address + columns: + - *blockchain + - name: version + - *pool_id + - *token_address + - *normalized_weight + + - name: balancer_polygon_trades + meta: + blockchain: polygon + sector: dex + contributors: bizzyvinci + config: + tags: ['balancer', 'polygon', 'amm', 'trades', 'dex'] + description: > + DEX trades on balancer on polygon + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - block_date + - blockchain + - project + - version + - tx_hash + - evt_index + - check_dex_seed: + blockchain: polygon + project: balancer + version: 2 + columns: + - *blockchain + - &project + name: project + description: "Project name (balancer)" + - &version + name: version + description: "Version of the project" + - *block_month + - *block_date + - *block_time + - &token_bought_symbol + name: token_bought_symbol + description: "Token symbol for token bought in the trade" + - &token_sold_symbol + name: token_sold_symbol + description: "Token symbol for token sold in the trade" + - &token_pair + name: token_pair + description: "Token symbol pair for each token involved in the trade" + - &token_bought_amount + name: token_bought_amount + description: "Value of the token bought at time of execution in the original currency" + - &token_sold_amount + name: token_sold_amount + description: "Value of the token sold at time of execution in the original currency" + - &token_bought_amount_raw + name: token_bought_amount_raw + description: "Raw value of the token bought at time of execution in the original currency" + - &token_sold_amount_raw + name: token_sold_amount_raw + description: "Raw value of the token sold at time of execution in the original currency" + - &amount_usd + name: amount_usd + description: "USD value of the trade at time of execution" + - &token_bought_address + name: token_bought_address + description: "Contract address of the token bought" + - &token_sold_address + name: token_sold_address + description: "Contract address of the token sold" + - &taker + name: taker + description: "Address of trader who purchased a token" + - &maker + name: maker + description: "Address of trader who sold a token" + - *pool_id + - &swap_fee + name: swap_fee + description: 'Swap fee' + - &project_contract_address + name: project_contract_address + description: "Pool address" + - name: pool_symbol + - name: pool_type + - *tx_hash + - &tx_from + name: tx_from + description: "transaction.from" + - &tx_to + name: tx_to + description: "transaction.to" + - *evt_index + + - name: balancer_v2_polygon_liquidity + meta: + blockchain: polygon + project: balancer_v2 + contributors: victorstefenon, viniabussafi, thetroyharris + config: + tags: ['polygon', 'balancer', 'pools', 'liquidity'] + description: > + Balancer v2 pools liquidity by token in Polygon. + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - day + - pool_id + - token_address + columns: + - name: day + description: 'UTC event block time truncated to the day mark' + - *pool_id + - name: pool_address + - name: pool_symbol + description: 'Symbol of the pool, consisting of the symbol of its tokens and their respective weights' + - name: version + description: 'Version of Balancer in which pool was deployed' + - name: blockchain + description: 'Blockchain in which pool was deployed' + - *token_address + - name: token_symbol + description: 'Symbol of the token' + - name: token_balance_raw + description: 'Raw balance of the token in the pool' + - name: token_balance + description: 'Scaled balance of the token in the pool' + - name: protocol_liquidity_usd + description: 'Liquidity of the token in the pool in USD, except BPTs' + - name: protocol_liquidity_eth + description: 'Liquidity of the token in the pool in ETH, except BPTs' + - name: pool_liquidity_usd + description: 'Liquidity of the token in the pool in USD, including BPTs' + - name: pool_liquidity_eth + description: 'Liquidity of the token in the pool in ETH, including BPTs' + + - name: balancer_v2_polygon_lbps + meta: + blockchain: polygon + project: balancer_v2 + contributors: stefenon + config: + tags: ['polygon', 'balancer', 'lbp'] + description: > + Record of the Liquidity Boostrapping Pools (LBP) of Balancer, an automated portfolio manager and trading platform, on Polygon. + columns: + - name: name + description: 'Name of the LBP' + - name: pool_id + description: 'ID of the LBP' + - name: token_sold + description: 'Contract address of the token sold by the LBP' + - name: token_symbol + description: 'Symbol of the token sold by the LBP' + - name: start_time + description: 'LBP start time' + - name: end_time + description: 'LBP end time' + + - name: balancer_v2_polygon_flashloans + meta: + blockchain: polygon + sector: lending + contributors: hildobby + config: + tags: ['polygon', 'flashloans'] + description: > + All Balancer flashloans on Polygon + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - blockchain + - tx_hash + - evt_index + columns: + - name: blockchain + - name: project + - name: version + - name: block_time + - name: block_number + - name: amount + - name: amount_usd + - name: tx_hash + - name: evt_index + - name: fee + - name: currency_contract + - name: currency_symbol + - name: recipient + - name: contract_address + - name: block_month + + - name: balancer_v2_polygon_bpt_prices + meta: + blockchain: polygon + project: balancer_v2 + contributors: victorstefenon, thetroyharris, viniabussafi + config: + tags: ['polygon', 'bpt', 'prices'] + description: > + Balancer Pool Token (BPT) hourly median price by pool on Balancer, an automated portfolio manager and trading platform. + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - blockchain + - day + - contract_address + columns: + - name: blockchain + - name: day + - name: version + - name: decimals + - name: contract_address + - name: bpt_price + + - name: balancer_v2_polygon_trades + meta: + blockchain: polygon + sector: dex + contributors: bizzyvinci, thetroyharris, tomfutago, viniabussafi + config: + tags: [ 'balancer', 'polygon', 'amm', 'trades', 'dex', 'beta' ] + description: > + DEX trades on balancer v2 on polygon + columns: + - *blockchain + - *project + - *version + - *block_month + - *block_date + - *block_time + - name: block_number + - *token_bought_symbol + - *token_sold_symbol + - *token_pair + - *token_bought_amount + - *token_sold_amount + - *token_bought_amount_raw + - *token_sold_amount_raw + - *amount_usd + - *token_bought_address + - *token_sold_address + - *taker + - *maker + - *project_contract_address + - name: pool_symbol + - name: pool_type + - *pool_id + - *swap_fee + - *tx_hash + - *tx_from + - *tx_to + - *evt_index + + - name: balancer_v2_polygon_protocol_fee + meta: + blockchain: polygon + project: balancer_v2 + contributors: viniabussafi + config: + tags: ['polygon', 'revenue', 'fees'] + description: > + Daily Protocol Fee collected and Revenue by pool on Balancer, an automated portfolio manager and trading platform. + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - day + - pool_id + - token_address + columns: + - name: day + - name: pool_id + - name: pool_address + - name: pool_symbol + - name: version + - name: blockchain + - name: token_address + - name: token_symbol + - name: token_amount_raw + description: "Raw amount of revenues of the token in the pool" + - name: token_amount + description: "Amount of revenues of the token in the pool" + - name: protocol_fee_collected_usd + description: "Fee collected in the pool in USD" + - name: treasury_share + description: "Share of total revenue that is directed to Balancer DAO's treasury, as per BIPs 19, 161 and 371" + - name: treasury_revenue_usd + description: "Total revenue directed to Balancer DAO's treasury" + + - name: balancer_v2_polygon_bpt_supply + meta: + blockchain: polygon + project: balancer_v2 + contributors: thetroyharris, viniabussafi + config: + tags: ['polygon', 'bpt', 'supply'] + description: > + Balancer Pool Token (BPT) supply for ComposableStablePools versions 4 and 5. + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - day + - blockchain + - token_address + columns: + - name: day + - name: pool_type + - name: version + - name: blockchain + - name: token_address + - name: supply \ No newline at end of file diff --git a/models/_project/balancer/trades/polygon/balancer_polygon_trades.sql b/models/balancer/polygon/balancer_polygon_trades.sql similarity index 100% rename from models/_project/balancer/trades/polygon/balancer_polygon_trades.sql rename to models/balancer/polygon/balancer_polygon_trades.sql diff --git a/models/_project/balancer/bpt/polygon/balancer_v2_polygon_bpt_prices.sql b/models/balancer/polygon/balancer_v2_polygon_bpt_prices.sql similarity index 100% rename from models/_project/balancer/bpt/polygon/balancer_v2_polygon_bpt_prices.sql rename to models/balancer/polygon/balancer_v2_polygon_bpt_prices.sql diff --git a/models/_project/balancer/bpt/polygon/balancer_v2_polygon_bpt_supply.sql b/models/balancer/polygon/balancer_v2_polygon_bpt_supply.sql similarity index 100% rename from models/_project/balancer/bpt/polygon/balancer_v2_polygon_bpt_supply.sql rename to models/balancer/polygon/balancer_v2_polygon_bpt_supply.sql diff --git a/models/_project/balancer/flashloans/polygon/balancer_v2_polygon_flashloans.sql b/models/balancer/polygon/balancer_v2_polygon_flashloans.sql similarity index 88% rename from models/_project/balancer/flashloans/polygon/balancer_v2_polygon_flashloans.sql rename to models/balancer/polygon/balancer_v2_polygon_flashloans.sql index 392c3866d89..0f0cb1d9982 100644 --- a/models/_project/balancer/flashloans/polygon/balancer_v2_polygon_flashloans.sql +++ b/models/balancer/polygon/balancer_v2_polygon_flashloans.sql @@ -6,6 +6,10 @@ , file_format = 'delta' , incremental_strategy = 'merge' , unique_key = ['tx_hash', 'evt_index'] + , post_hook='{{ expose_spells(\'["polygon"]\', + "project", + "balancer_v2", + \'["hildobby"]\') }}' ) }} diff --git a/models/_project/balancer/pools/polygon/balancer_v2_polygon_lbps.sql b/models/balancer/polygon/balancer_v2_polygon_lbps.sql similarity index 100% rename from models/_project/balancer/pools/polygon/balancer_v2_polygon_lbps.sql rename to models/balancer/polygon/balancer_v2_polygon_lbps.sql diff --git a/models/_project/balancer/liquidity/polygon/balancer_v2_polygon_liquidity.sql b/models/balancer/polygon/balancer_v2_polygon_liquidity.sql similarity index 52% rename from models/_project/balancer/liquidity/polygon/balancer_v2_polygon_liquidity.sql rename to models/balancer/polygon/balancer_v2_polygon_liquidity.sql index 3f0c521ade6..f830e2df02c 100644 --- a/models/_project/balancer/liquidity/polygon/balancer_v2_polygon_liquidity.sql +++ b/models/balancer/polygon/balancer_v2_polygon_liquidity.sql @@ -6,7 +6,11 @@ schema = 'balancer_v2_polygon', alias = 'liquidity', materialized = 'table', - file_format = 'delta' + file_format = 'delta', + post_hook="{{ expose_spells('[\"" + blockchain + '"]' + '\', + "project", + "balancer_v2", + \'["stefenon", "viniabussafi"]\') }}' ) }} diff --git a/models/_project/balancer/pools/polygon/balancer_v2_polygon_pools_fees.sql b/models/balancer/polygon/balancer_v2_polygon_pools_fees.sql similarity index 77% rename from models/_project/balancer/pools/polygon/balancer_v2_polygon_pools_fees.sql rename to models/balancer/polygon/balancer_v2_polygon_pools_fees.sql index 586839b9ff9..556cb0003af 100644 --- a/models/_project/balancer/pools/polygon/balancer_v2_polygon_pools_fees.sql +++ b/models/balancer/polygon/balancer_v2_polygon_pools_fees.sql @@ -1,12 +1,17 @@ {{ config( schema = 'balancer_v2_polygon', + alias = 'pools_fees', materialized = 'incremental', file_format = 'delta', incremental_strategy = 'merge', - unique_key = ['block_number', 'tx_hash', 'index'] - ) + unique_key = ['block_number', 'tx_hash', 'index'], + post_hook='{{ expose_spells(\'["polygon"]\', + "project", + "balancer_v2", + \'["metacrypto", "jacektrocinski", "thetroyharris", "viniabussafi"]\') }}' + )  }} {% set event_signature = '0xa9ba3ffe0b6c366b81232caab38605a0699ad5398d6cce76f91ee809e322dafc' %} diff --git a/models/_project/balancer/pools/polygon/balancer_v2_polygon_pools_tokens_weights.sql b/models/balancer/polygon/balancer_v2_polygon_pools_tokens_weights.sql similarity index 99% rename from models/_project/balancer/pools/polygon/balancer_v2_polygon_pools_tokens_weights.sql rename to models/balancer/polygon/balancer_v2_polygon_pools_tokens_weights.sql index 20023ba61c3..afc223ecb81 100644 --- a/models/_project/balancer/pools/polygon/balancer_v2_polygon_pools_tokens_weights.sql +++ b/models/balancer/polygon/balancer_v2_polygon_pools_tokens_weights.sql @@ -2,6 +2,7 @@ config( schema='balancer_v2_polygon', alias = 'pools_tokens_weights', + materialized = 'incremental', file_format = 'delta', incremental_strategy = 'merge', diff --git a/models/_project/balancer/protocol_fee/polygon/balancer_v2_polygon_protocol_fee.sql b/models/balancer/polygon/balancer_v2_polygon_protocol_fee.sql similarity index 100% rename from models/_project/balancer/protocol_fee/polygon/balancer_v2_polygon_protocol_fee.sql rename to models/balancer/polygon/balancer_v2_polygon_protocol_fee.sql diff --git a/models/_project/balancer/trades/polygon/balancer_v2_polygon_trades.sql b/models/balancer/polygon/balancer_v2_polygon_trades.sql similarity index 94% rename from models/_project/balancer/trades/polygon/balancer_v2_polygon_trades.sql rename to models/balancer/polygon/balancer_v2_polygon_trades.sql index 37b12105abe..a17dabab52d 100644 --- a/models/_project/balancer/trades/polygon/balancer_v2_polygon_trades.sql +++ b/models/balancer/polygon/balancer_v2_polygon_trades.sql @@ -4,9 +4,9 @@ alias = 'trades', materialized = 'view', post_hook = '{{ expose_spells(\'["polygon"]\', - spell_type = "project", - spell_name = "balancer", - contributors = \'["mendesfabio", "jacektrocinski", "thetroyharris", "tomfutago", "viniabussafi"]\') }}' + "project", + "balancer_v2", + \'["mendesfabio", "jacektrocinski", "thetroyharris", "tomfutago", "viniabussafi"]\') }}' ) }} diff --git a/models/_project/balancer/bpt/polygon/balancer_v2_polygon_transfers_bpt.sql b/models/balancer/polygon/balancer_v2_polygon_transfers_bpt.sql similarity index 100% rename from models/_project/balancer/bpt/polygon/balancer_v2_polygon_transfers_bpt.sql rename to models/balancer/polygon/balancer_v2_polygon_transfers_bpt.sql diff --git a/models/_project/balancer/bpt/zkevm/balancer_v2_zkevm_bpt_prices.sql b/models/balancer/zkevm/balancer_v2_zkevm_bpt_prices.sql similarity index 100% rename from models/_project/balancer/bpt/zkevm/balancer_v2_zkevm_bpt_prices.sql rename to models/balancer/zkevm/balancer_v2_zkevm_bpt_prices.sql diff --git a/models/_project/balancer/bpt/zkevm/balancer_v2_zkevm_bpt_supply.sql b/models/balancer/zkevm/balancer_v2_zkevm_bpt_supply.sql similarity index 100% rename from models/_project/balancer/bpt/zkevm/balancer_v2_zkevm_bpt_supply.sql rename to models/balancer/zkevm/balancer_v2_zkevm_bpt_supply.sql diff --git a/models/_project/balancer/flashloans/zkevm/balancer_v2_zkevm_flashloans.sql b/models/balancer/zkevm/balancer_v2_zkevm_flashloans.sql similarity index 88% rename from models/_project/balancer/flashloans/zkevm/balancer_v2_zkevm_flashloans.sql rename to models/balancer/zkevm/balancer_v2_zkevm_flashloans.sql index 3e1d9d1a6f5..a11355919f7 100644 --- a/models/_project/balancer/flashloans/zkevm/balancer_v2_zkevm_flashloans.sql +++ b/models/balancer/zkevm/balancer_v2_zkevm_flashloans.sql @@ -6,6 +6,10 @@ , file_format = 'delta' , incremental_strategy = 'merge' , unique_key = ['tx_hash', 'evt_index'] + , post_hook='{{ expose_spells(\'["zkevm"]\', + "project", + "balancer_v2", + \'["hildobby", "viniabussafi"]\') }}' ) }} diff --git a/models/_project/balancer/liquidity/zkevm/balancer_v2_zkevm_liquidity.sql b/models/balancer/zkevm/balancer_v2_zkevm_liquidity.sql similarity index 51% rename from models/_project/balancer/liquidity/zkevm/balancer_v2_zkevm_liquidity.sql rename to models/balancer/zkevm/balancer_v2_zkevm_liquidity.sql index 737b858ca3c..f3fd420bb39 100644 --- a/models/_project/balancer/liquidity/zkevm/balancer_v2_zkevm_liquidity.sql +++ b/models/balancer/zkevm/balancer_v2_zkevm_liquidity.sql @@ -6,7 +6,11 @@ schema = 'balancer_v2_zkevm', alias = 'liquidity', materialized = 'table', - file_format = 'delta' + file_format = 'delta', + post_hook="{{ expose_spells('[\"" + blockchain + '"]' + '\', + "project", + "balancer_v2", + \'["stefenon", "viniabussafi"]\') }}' ) }} diff --git a/models/_project/balancer/pools/zkevm/balancer_v2_zkevm_pools_fees.sql b/models/balancer/zkevm/balancer_v2_zkevm_pools_fees.sql similarity index 82% rename from models/_project/balancer/pools/zkevm/balancer_v2_zkevm_pools_fees.sql rename to models/balancer/zkevm/balancer_v2_zkevm_pools_fees.sql index 87bf3434eba..a92e4c5c00c 100644 --- a/models/_project/balancer/pools/zkevm/balancer_v2_zkevm_pools_fees.sql +++ b/models/balancer/zkevm/balancer_v2_zkevm_pools_fees.sql @@ -6,7 +6,11 @@ file_format = 'delta', incremental_strategy = 'merge', unique_key = ['block_number', 'tx_hash', 'index'], - ) + post_hook='{{ expose_spells(\'["zkevm"]\', + "project", + "balancer_v2", + \'["metacrypto", "jacektrocinski", "thetroyharris", "viniabussafi"]\') }}' + )  }} {% set event_signature = '0xa9ba3ffe0b6c366b81232caab38605a0699ad5398d6cce76f91ee809e322dafc' %} diff --git a/models/_project/balancer/pools/zkevm/balancer_v2_zkevm_pools_tokens_weights.sql b/models/balancer/zkevm/balancer_v2_zkevm_pools_tokens_weights.sql similarity index 100% rename from models/_project/balancer/pools/zkevm/balancer_v2_zkevm_pools_tokens_weights.sql rename to models/balancer/zkevm/balancer_v2_zkevm_pools_tokens_weights.sql diff --git a/models/_project/balancer/protocol_fee/zkevm/balancer_v2_zkevm_protocol_fee.sql b/models/balancer/zkevm/balancer_v2_zkevm_protocol_fee.sql similarity index 100% rename from models/_project/balancer/protocol_fee/zkevm/balancer_v2_zkevm_protocol_fee.sql rename to models/balancer/zkevm/balancer_v2_zkevm_protocol_fee.sql diff --git a/models/_project/balancer/trades/zkevm/balancer_v2_zkevm_trades.sql b/models/balancer/zkevm/balancer_v2_zkevm_trades.sql similarity index 94% rename from models/_project/balancer/trades/zkevm/balancer_v2_zkevm_trades.sql rename to models/balancer/zkevm/balancer_v2_zkevm_trades.sql index 36cc38e4a44..340fbe1dbd8 100644 --- a/models/_project/balancer/trades/zkevm/balancer_v2_zkevm_trades.sql +++ b/models/balancer/zkevm/balancer_v2_zkevm_trades.sql @@ -4,9 +4,9 @@ alias = 'trades', materialized = 'view', post_hook = '{{ expose_spells(\'["zkevm"]\', - spell_type = "project", - spell_name = "balancer", - contributors = \'["mendesfabio", "jacektrocinski", "thetroyharris", "tomfutago", "viniabussafi"]\') }}' + "project", + "balancer_v2", + \'["mendesfabio", "jacektrocinski", "thetroyharris", "tomfutago", "viniabussafi"]\') }}' ) }} diff --git a/models/_project/balancer/bpt/zkevm/balancer_v2_zkevm_transfers_bpt.sql b/models/balancer/zkevm/balancer_v2_zkevm_transfers_bpt.sql similarity index 100% rename from models/_project/balancer/bpt/zkevm/balancer_v2_zkevm_transfers_bpt.sql rename to models/balancer/zkevm/balancer_v2_zkevm_transfers_bpt.sql diff --git a/models/_project/balancer/pools/zkevm/balancer_zkevm_pools_tokens_weights.sql b/models/balancer/zkevm/balancer_zkevm_pools_tokens_weights.sql similarity index 100% rename from models/_project/balancer/pools/zkevm/balancer_zkevm_pools_tokens_weights.sql rename to models/balancer/zkevm/balancer_zkevm_pools_tokens_weights.sql diff --git a/models/balancer/zkevm/balancer_zkevm_schema.yml b/models/balancer/zkevm/balancer_zkevm_schema.yml new file mode 100644 index 00000000000..a573e89563d --- /dev/null +++ b/models/balancer/zkevm/balancer_zkevm_schema.yml @@ -0,0 +1,431 @@ +version: 2 + +models: + - name: balancer_v2_zkevm_pools_fees + meta: + blockchain: zkevm + project: balancer_v2 + contributors: jacektrocinski, thetroyharris, viniabussafi + config: + tags: ['zkevm', 'balancer', 'pools_fees'] + description: > + Balancer v2 swap fees stored at the pool level. + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - block_number + - tx_hash + - index + columns: + - name: blockchain + - name: version + - &contract_address + name: contract_address + description: 'zkevm address for the liquidity pool used in transaction' + tests: + - not_null + - &tx_hash + name: tx_hash + description: 'Transaction hash' + tests: + - not_null + - &index + name: index + description: '' + tests: + - not_null + - &tx_index + name: tx_index + description: '' + tests: + - not_null + - &block_time + name: block_time + description: '' + tests: + - not_null + - &block_number + name: block_number + description: 'Block number' + tests: + - not_null + - &swap_fee_percentage + name: swap_fee_percentage + description: 'Swap fees for the pool, values are returned with 18 decimals (1e18 meaning 100%)' + tests: + - not_null + + - name: balancer_v2_zkevm_transfers_bpt + meta: + blockchain: zkevm + project: balancer_v2 + contributors: victorstefenon, thetroyharris, viniabussafi + config: + tags: ['zkevm', 'bpt', 'transfers'] + description: > + Balancer Pool Token (BPT) transfer logs on Balancer, an automated portfolio manager and trading platform, on Polygon. + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - evt_tx_hash + - evt_index + - block_date + columns: + - &blockchain + name: blockchain + description: "Blockchain" + - name: version + - *contract_address + - &block_date + name: block_date + description: "UTC event block date of each DEX trade" + - &block_month + name: block_month + description: "UTC event block month of each DEX trade" + - &evt_tx_hash + name: evt_tx_hash + description: 'Transaction hash of transfer event' + - &evt_index + name: evt_index + description: 'Event index' + - &evt_block_time + name: evt_block_time + description: 'Block time of transfer event' + - &evt_block_number + name: evt_block_number + description: 'Block number of transfer event' + - &from + name: from + description: 'Address of BPT provider of transfer event' + - &to + name: to + description: 'Address of BPT receiver of transfer event' + - &value + name: value + description: 'Amount of BPT transferred in transfer event' + + - name: balancer_zkevm_pools_tokens_weights + meta: + blockchain: zkevm + project: balancer + contributors: jacektrocinski, viniabussafi + config: + tags: ['zkevm', 'balancer', 'pools', 'tokens', 'weights'] + description: > + Token weights in Balancer pools. + columns: + - name: blockchain + - name: version + - &pool_id + name: pool_id + description: 'Unique encoded identifier that refers to each pool' + tests: + - not_null + - &token_address + name: token_address + description: 'Contract address for the token' + - &normalized_weight + name: normalized_weight + description: 'Weight of the token in the pool.' + + - name: balancer_v2_zkevm_pools_tokens_weights + meta: + blockchain: zkevm + project: balancer + contributors: jacektrocinski, viniabussafi + config: + tags: ['zkevm', 'balancer', 'pools', 'tokens', 'weights'] + description: > + Token weights in Balancer v2 pools. + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - pool_id + - token_address + columns: + - name: blockchain + - name: version + - name: pool_id + - name: token_address + - name: normalized_weight + + - name: balancer_zkevm_trades + meta: + blockchain: zkevm + sector: dex + contributors: bizzyvinci, viniabussafi + config: + tags: ['balancer', 'zkevm', 'amm', 'trades', 'dex'] + description: > + DEX trades on balancer on zkevm + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - block_date + - blockchain + - project + - version + - tx_hash + - evt_index + - check_dex_seed: + blockchain: zkevm + project: balancer + version: 2 + columns: + - name: blockchain + - &project + name: project + description: "Project name (balancer)" + - &version + name: version + description: "Version of the project" + - name: block_month + - name: block_date + - name: block_time + - &token_bought_symbol + name: token_bought_symbol + description: "Token symbol for token bought in the trade" + - &token_sold_symbol + name: token_sold_symbol + description: "Token symbol for token sold in the trade" + - &token_pair + name: token_pair + description: "Token symbol pair for each token involved in the trade" + - &token_bought_amount + name: token_bought_amount + description: "Value of the token bought at time of execution in the original currency" + - &token_sold_amount + name: token_sold_amount + description: "Value of the token sold at time of execution in the original currency" + - &token_bought_amount_raw + name: token_bought_amount_raw + description: "Raw value of the token bought at time of execution in the original currency" + - &token_sold_amount_raw + name: token_sold_amount_raw + description: "Raw value of the token sold at time of execution in the original currency" + - &amount_usd + name: amount_usd + description: "USD value of the trade at time of execution" + - &token_bought_address + name: token_bought_address + description: "Contract address of the token bought" + - &token_sold_address + name: token_sold_address + description: "Contract address of the token sold" + - &taker + name: taker + description: "Address of trader who purchased a token" + - &maker + name: maker + description: "Address of trader who sold a token" + - name: pool_id + - &swap_fee + name: swap_fee + description: 'Swap fee' + - &project_contract_address + name: project_contract_address + description: "Pool address" + - name: pool_symbol + - name: pool_type + - name: tx_hash + - &tx_from + name: tx_from + description: "transaction.from" + - &tx_to + name: tx_to + description: "transaction.to" + - name: evt_index + + - name: balancer_v2_zkevm_liquidity + meta: + blockchain: zkevm + project: balancer_v2 + contributors: victorstefenon, viniabussafi, thetroyharris + config: + tags: ['zkevm', 'balancer', 'pools', 'liquidity'] + description: > + Balancer v2 pools liquidity by token in zkevm. + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - day + - pool_id + - token_address + columns: + - name: day + description: 'UTC event block time truncated to the day mark' + - name: pool_id + - name: pool_address + - name: pool_symbol + description: 'Symbol of the pool, consisting of the symbol of its tokens and their respective weights' + - name: version + description: 'Version of Balancer in which pool was deployed' + - name: blockchain + description: 'Blockchain in which pool was deployed' + - name: token_address + - name: token_symbol + description: 'Symbol of the token' + - name: token_balance_raw + description: 'Raw balance of the token in the pool' + - name: token_balance + description: 'Scaled balance of the token in the pool' + - name: protocol_liquidity_usd + description: 'Liquidity of the token in the pool in USD, except BPTs' + - name: protocol_liquidity_eth + description: 'Liquidity of the token in the pool in ETH, except BPTs' + - name: pool_liquidity_usd + description: 'Liquidity of the token in the pool in USD, including BPTs' + - name: pool_liquidity_eth + description: 'Liquidity of the token in the pool in ETH, including BPTs' + + - name: balancer_v2_zkevm_flashloans + meta: + blockchain: zkevm + sector: lending + contributors: hildobby, viniabussafi + config: + tags: ['zkevm', 'flashloans'] + description: > + All Balancer flashloans on zkevm + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - blockchain + - tx_hash + - evt_index + columns: + - name: blockchain + - name: project + - name: version + - name: block_time + - name: block_number + - name: amount + - name: amount_usd + - name: tx_hash + - name: evt_index + - name: fee + - name: currency_contract + - name: currency_symbol + - name: recipient + - name: contract_address + - name: block_month + + - name: balancer_v2_zkevm_bpt_prices + meta: + blockchain: zkevm + project: balancer_v2 + contributors: victorstefenon, thetroyharris, viniabussafi + config: + tags: ['zkevm', 'bpt', 'prices'] + description: > + Balancer Pool Token (BPT) hourly median price by pool on Balancer, an automated portfolio manager and trading platform. + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - blockchain + - day + - contract_address + columns: + - name: blockchain + - name: day + - name: version + - name: decimals + - name: contract_address + - name: bpt_price + + - name: balancer_v2_zkevm_trades + meta: + blockchain: zkevm + sector: dex + contributors: bizzyvinci, thetroyharris, tomfutago, viniabussafi + config: + tags: [ 'balancer', 'zkevm', 'amm', 'trades', 'dex', 'beta' ] + description: > + DEX trades on balancer v2 on zkevm + columns: + - name: blockchain + - name: project + - name: version + - name: block_month + - name: block_date + - name: block_time + - name: block_number + - name: token_bought_symbol + - name: token_sold_symbol + - name: token_pair + - name: token_bought_amount + - name: token_sold_amount + - name: token_bought_amount_raw + - name: token_sold_amount_raw + - name: amount_usd + - name: token_bought_address + - name: token_sold_address + - name: taker + - name: maker + - name: project_contract_address + - name: pool_symbol + - name: pool_type + - name: pool_id + - name: swap_fee + - name: tx_hash + - name: tx_from + - name: tx_to + - name: evt_index + + - name: balancer_v2_zkevm_protocol_fee + meta: + blockchain: zkevm + project: balancer_v2 + contributors: viniabussafi + config: + tags: ['zkevm', 'revenue', 'fees'] + description: > + Daily Protocol Fee collected and Revenue by pool on Balancer, an automated portfolio manager and trading platform. + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - day + - pool_id + - token_address + columns: + - name: day + - name: pool_id + - name: pool_address + - name: pool_symbol + - name: version + - name: blockchain + - name: token_address + - name: token_symbol + - name: token_amount_raw + description: "Raw amount of revenues of the token in the pool" + - name: token_amount + description: "Amount of revenues of the token in the pool" + - name: protocol_fee_collected_usd + description: "Fee collected in the pool in USD" + - name: treasury_share + description: "Share of total revenue that is directed to Balancer DAO's treasury, as per BIPs 19, 161 and 371" + - name: treasury_revenue_usd + description: "Total revenue directed to Balancer DAO's treasury" + + - name: balancer_v2_zkevm_bpt_supply + meta: + blockchain: zkevm + project: balancer_v2 + contributors: thetroyharris, viniabussafi + config: + tags: ['zkevm', 'bpt', 'supply'] + description: > + Balancer Pool Token (BPT) supply for ComposableStablePools versions 4 and 5. + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - day + - blockchain + - token_address + columns: + - name: day + - name: pool_type + - name: version + - name: blockchain + - name: token_address + - name: supply diff --git a/models/_project/balancer/trades/zkevm/balancer_zkevm_trades.sql b/models/balancer/zkevm/balancer_zkevm_trades.sql similarity index 100% rename from models/_project/balancer/trades/zkevm/balancer_zkevm_trades.sql rename to models/balancer/zkevm/balancer_zkevm_trades.sql From 0fc9e393192fa034fb248ac1250cbce49bf51601 Mon Sep 17 00:00:00 2001 From: kaiblade Date: Wed, 5 Jun 2024 06:13:36 +0100 Subject: [PATCH 042/149] [EASY] Dedupe Optimism delegates model (#6071) * Deduped delegates model * Deduped delegates model * Deduped delegates model --------- Co-authored-by: Alan Ghobadi --- .../governance/optimism/op_governance_optimism_delegates.sql | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/models/op/governance/optimism/op_governance_optimism_delegates.sql b/models/op/governance/optimism/op_governance_optimism_delegates.sql index b53a0cfe360..fa52673cbb0 100644 --- a/models/op/governance/optimism/op_governance_optimism_delegates.sql +++ b/models/op/governance/optimism/op_governance_optimism_delegates.sql @@ -106,3 +106,7 @@ FROM OP_delegates_table_raw SELECT * FROM OP_delegates_table + +GROUP BY block_time, tx_hash, evt_index, delegate, current_voting_power, previous_voting_power, +power_diff,voting_power_change, total_voting_power, voting_power_share, number_of_delegators, +total_delegators, total_delegators_share From 2d48ae79938979f5c63e056ad131c248371307d0 Mon Sep 17 00:00:00 2001 From: Alan Ghobadi Date: Wed, 5 Jun 2024 07:56:54 +0200 Subject: [PATCH 043/149] Move address_optimism, optimism_attestationstation and op (#6055) * Move op folder to daily spellbook * Move addresses_optimism * Move optimism_attestationstation * Add sources and update * Add incremental_predicates * cleanup schemas * fix main spellbook sources * clean up sources in new format * refs --> sources * Add missing sources * Exclude model due to duplicates * drop comment --------- Co-authored-by: jeff-dude --- .../addresses_optimism_fee_vaults.sql | 3 +- .../addresses_optimism_grants_funding.sql | 11 +- .../optimism/addresses_optimism_schema.yml | 0 .../op_governance_optimism_delegates.sql | 35 ++--- ...overnance_optimism_delegates_addresses.sql | 0 .../op_governance_optimism_delegators.sql | 0 .../op_governance_optimism_schema.yml | 0 .../op_governance_optimism_voting_power.sql | 0 .../op_chains_optimism_chain_list.sql | 4 +- .../op_chains/op_chains_optimism_schema.yml | 0 .../op_token_optimism_inflation_schedule.sql | 0 .../op_token_optimism_initial_allocations.sql | 0 .../optimism/op_token_optimism_metadata.sql | 0 .../optimism/op_token_optimism_schema.yml | 0 .../optimism/op_optimism_airdrop_1_claims.sql | 7 +- .../op/optimism/op_optimism_schema.yml | 0 .../models}/op/readme.md | 0 .../op_retropgf_optimism_recipients.sql | 0 ...op_retropgf_optimism_round2_recipients.sql | 0 .../op_retropgf_optimism_round2_voters.sql | 0 .../optimism/op_retropgf_optimism_schema.yml | 0 .../optimism/op_retropgf_optimism_voters.sql | 0 ...ions_optimism_all_distributions_labels.sql | 4 +- ...s_optimism_foundation_wallet_approvals.sql | 23 +-- ...ns_optimism_other_distributions_claims.sql | 45 +++--- ...oken_distributions_optimism_other_tags.sql | 5 +- ...ibutions_optimism_project_name_mapping.sql | 1 + ...distributions_optimism_project_wallets.sql | 20 +-- ...istributions_optimism_transfer_mapping.sql | 141 +++++++++--------- .../op_token_distributions_schema.yml | 0 ...ism_attestationstation_optimism_events.sql | 2 +- ...ism_attestationstation_optimism_schema.yml | 0 dbt_project.yml | 19 --- .../optimism/airdrop_optimism_claims.sql | 4 +- .../op_retropgf/labels_op_retropgf.sql | 4 +- .../labels_project_wallets.sql | 4 +- .../l2_fee_vaults/labels_l2_fee_vaults.sql | 4 +- sources/_subprojects/spellbook/_sources.yml | 19 ++- 38 files changed, 180 insertions(+), 175 deletions(-) rename {models => daily_spellbook/models}/addresses/optimism/addresses_optimism_fee_vaults.sql (86%) rename {models => daily_spellbook/models}/addresses/optimism/addresses_optimism_grants_funding.sql (99%) rename {models => daily_spellbook/models}/addresses/optimism/addresses_optimism_schema.yml (100%) rename {models => daily_spellbook/models}/op/governance/optimism/op_governance_optimism_delegates.sql (88%) rename {models => daily_spellbook/models}/op/governance/optimism/op_governance_optimism_delegates_addresses.sql (100%) rename {models => daily_spellbook/models}/op/governance/optimism/op_governance_optimism_delegators.sql (100%) rename {models => daily_spellbook/models}/op/governance/optimism/op_governance_optimism_schema.yml (100%) rename {models => daily_spellbook/models}/op/governance/optimism/op_governance_optimism_voting_power.sql (100%) rename {models => daily_spellbook/models}/op/op_chains/op_chains_optimism_chain_list.sql (95%) rename {models => daily_spellbook/models}/op/op_chains/op_chains_optimism_schema.yml (100%) rename {models => daily_spellbook/models}/op/op_token/optimism/op_token_optimism_inflation_schedule.sql (100%) rename {models => daily_spellbook/models}/op/op_token/optimism/op_token_optimism_initial_allocations.sql (100%) rename {models => daily_spellbook/models}/op/op_token/optimism/op_token_optimism_metadata.sql (100%) rename {models => daily_spellbook/models}/op/op_token/optimism/op_token_optimism_schema.yml (100%) rename {models => daily_spellbook/models}/op/optimism/op_optimism_airdrop_1_claims.sql (87%) rename {models => daily_spellbook/models}/op/optimism/op_optimism_schema.yml (100%) rename {models => daily_spellbook/models}/op/readme.md (100%) rename {models => daily_spellbook/models}/op/retropgf/optimism/op_retropgf_optimism_recipients.sql (100%) rename {models => daily_spellbook/models}/op/retropgf/optimism/op_retropgf_optimism_round2_recipients.sql (100%) rename {models => daily_spellbook/models}/op/retropgf/optimism/op_retropgf_optimism_round2_voters.sql (100%) rename {models => daily_spellbook/models}/op/retropgf/optimism/op_retropgf_optimism_schema.yml (100%) rename {models => daily_spellbook/models}/op/retropgf/optimism/op_retropgf_optimism_voters.sql (100%) rename {models => daily_spellbook/models}/op/token_distributions/optimism/op_token_distributions_optimism_all_distributions_labels.sql (92%) rename {models => daily_spellbook/models}/op/token_distributions/optimism/op_token_distributions_optimism_foundation_wallet_approvals.sql (83%) rename {models => daily_spellbook/models}/op/token_distributions/optimism/op_token_distributions_optimism_other_distributions_claims.sql (83%) rename {models => daily_spellbook/models}/op/token_distributions/optimism/op_token_distributions_optimism_other_tags.sql (97%) rename {models => daily_spellbook/models}/op/token_distributions/optimism/op_token_distributions_optimism_project_name_mapping.sql (97%) rename {models => daily_spellbook/models}/op/token_distributions/optimism/op_token_distributions_optimism_project_wallets.sql (98%) rename {models => daily_spellbook/models}/op/token_distributions/optimism/op_token_distributions_optimism_transfer_mapping.sql (84%) rename {models => daily_spellbook/models}/op/token_distributions/optimism/op_token_distributions_schema.yml (100%) rename {models/optimism_attestationstation => daily_spellbook/models}/optimism/optimism_attestationstation_optimism_events.sql (97%) rename {models/optimism_attestationstation => daily_spellbook/models}/optimism/optimism_attestationstation_optimism_schema.yml (100%) diff --git a/models/addresses/optimism/addresses_optimism_fee_vaults.sql b/daily_spellbook/models/addresses/optimism/addresses_optimism_fee_vaults.sql similarity index 86% rename from models/addresses/optimism/addresses_optimism_fee_vaults.sql rename to daily_spellbook/models/addresses/optimism/addresses_optimism_fee_vaults.sql index 00cc41d316b..fb3099d162f 100644 --- a/models/addresses/optimism/addresses_optimism_fee_vaults.sql +++ b/daily_spellbook/models/addresses/optimism/addresses_optimism_fee_vaults.sql @@ -1,7 +1,8 @@ {{config( tags = ['static'], + schema = 'addresses_optimism', alias = 'fee_vaults', - post_hook='{{ expose_spells(\'["optimism"]\', + post_hook='{{ expose_spells(\'["optimism"]\', "sector", "addresses", \'["msilb7"]\') }}')}} diff --git a/models/addresses/optimism/addresses_optimism_grants_funding.sql b/daily_spellbook/models/addresses/optimism/addresses_optimism_grants_funding.sql similarity index 99% rename from models/addresses/optimism/addresses_optimism_grants_funding.sql rename to daily_spellbook/models/addresses/optimism/addresses_optimism_grants_funding.sql index 6e239d047e2..145a3d7a2cb 100644 --- a/models/addresses/optimism/addresses_optimism_grants_funding.sql +++ b/daily_spellbook/models/addresses/optimism/addresses_optimism_grants_funding.sql @@ -1,10 +1,11 @@ {{config( - tags = ['static'], - alias = 'grants_funding', + tags = ['static'], + schema = 'addresses_optimism', + alias = 'grants_funding', post_hook='{{ expose_spells(\'["optimism"]\', - "sector", - "addresses", - \'["msilb7", "chuxin"]\') }}')}} + "sector", + "addresses", + \'["msilb7", "chuxin"]\') }}')}} /* Sourced from Public Distributions Tracker: https://docs.google.com/spreadsheets/d/1Ul8iMTsOFUKUmqz6MK0zpgt8Ki8tFtoWKGlwXj-Op34/edit#gid=590972026 diff --git a/models/addresses/optimism/addresses_optimism_schema.yml b/daily_spellbook/models/addresses/optimism/addresses_optimism_schema.yml similarity index 100% rename from models/addresses/optimism/addresses_optimism_schema.yml rename to daily_spellbook/models/addresses/optimism/addresses_optimism_schema.yml diff --git a/models/op/governance/optimism/op_governance_optimism_delegates.sql b/daily_spellbook/models/op/governance/optimism/op_governance_optimism_delegates.sql similarity index 88% rename from models/op/governance/optimism/op_governance_optimism_delegates.sql rename to daily_spellbook/models/op/governance/optimism/op_governance_optimism_delegates.sql index fa52673cbb0..5f8b35bd390 100644 --- a/models/op/governance/optimism/op_governance_optimism_delegates.sql +++ b/daily_spellbook/models/op/governance/optimism/op_governance_optimism_delegates.sql @@ -1,6 +1,7 @@ {{ config( schema = 'op_governance_optimism' , alias = 'delegates' + , tags=['prod_exclude'] , post_hook='{{ expose_spells(\'["optimism"]\', "project", "op_governance", @@ -16,43 +17,43 @@ FROM {{ ref('op_governance_optimism_voting_power') }} ), voting_power_share_data AS -(SELECT *, +(SELECT *, (CAST(newBalance AS DOUBLE)/CAST(total_voting_power AS DOUBLE)) * 100 AS voting_power_share FROM rolling_voting_power ), combined_delegator_count AS -(SELECT tx_hash, -block_time, +(SELECT tx_hash, +block_time, block_number, evt_index, -fromDelegate AS delegate, +fromDelegate AS delegate, -1 AS delegator_count FROM {{ ref('op_governance_optimism_delegators') }} WHERE fromDelegate != 0x0000000000000000000000000000000000000000 AND CAST(block_time AS DATE) >= DATE'2022-05-26' -UNION +UNION -SELECT tx_hash, -block_time, +SELECT tx_hash, +block_time, block_number, -evt_index, -toDelegate AS delegate, +evt_index, +toDelegate AS delegate, 1 AS delegator_count FROM {{ ref('op_governance_optimism_delegators') }} WHERE CAST(block_time AS DATE) >= DATE'2022-05-26' ), delegator_count_data AS -(SELECT tx_hash, block_time, block_number, evt_index, delegate, +(SELECT tx_hash, block_time, block_number, evt_index, delegate, SUM(delegator_count) OVER (PARTITION BY delegate ORDER BY block_time) AS number_of_delegators, SUM(delegator_count) OVER (ORDER BY block_time) AS total_delegators FROM combined_delegator_count ), voting_power_delegators_data AS -(SELECT power.*, del.number_of_delegators, +(SELECT power.*, del.number_of_delegators, del.total_delegators FROM voting_power_share_data power LEFT JOIN delegator_count_data del @@ -62,13 +63,13 @@ AND power.block_number = del.block_number ), voting_power_delegators_data_revised AS -(SELECT +(SELECT tx_hash, -block_time, +block_time, block_number, evt_index, delegate, -newBalance, +newBalance, previousBalance, power_diff, (CASE @@ -83,7 +84,7 @@ FROM voting_power_delegators_data ), OP_delegates_table_raw AS -(SELECT block_time, +(SELECT block_time, tx_hash, evt_index, delegate, @@ -96,10 +97,10 @@ voting_power_share, COALESCE(number_of_delegators,1) AS number_of_delegators, total_delegators FROM voting_power_delegators_data_revised -), +), OP_delegates_table AS -(SELECT *, +(SELECT *, (CAST(number_of_delegators AS DOUBLE) / CAST(total_delegators AS DOUBLE))*100 AS total_delegators_share FROM OP_delegates_table_raw ) diff --git a/models/op/governance/optimism/op_governance_optimism_delegates_addresses.sql b/daily_spellbook/models/op/governance/optimism/op_governance_optimism_delegates_addresses.sql similarity index 100% rename from models/op/governance/optimism/op_governance_optimism_delegates_addresses.sql rename to daily_spellbook/models/op/governance/optimism/op_governance_optimism_delegates_addresses.sql diff --git a/models/op/governance/optimism/op_governance_optimism_delegators.sql b/daily_spellbook/models/op/governance/optimism/op_governance_optimism_delegators.sql similarity index 100% rename from models/op/governance/optimism/op_governance_optimism_delegators.sql rename to daily_spellbook/models/op/governance/optimism/op_governance_optimism_delegators.sql diff --git a/models/op/governance/optimism/op_governance_optimism_schema.yml b/daily_spellbook/models/op/governance/optimism/op_governance_optimism_schema.yml similarity index 100% rename from models/op/governance/optimism/op_governance_optimism_schema.yml rename to daily_spellbook/models/op/governance/optimism/op_governance_optimism_schema.yml diff --git a/models/op/governance/optimism/op_governance_optimism_voting_power.sql b/daily_spellbook/models/op/governance/optimism/op_governance_optimism_voting_power.sql similarity index 100% rename from models/op/governance/optimism/op_governance_optimism_voting_power.sql rename to daily_spellbook/models/op/governance/optimism/op_governance_optimism_voting_power.sql diff --git a/models/op/op_chains/op_chains_optimism_chain_list.sql b/daily_spellbook/models/op/op_chains/op_chains_optimism_chain_list.sql similarity index 95% rename from models/op/op_chains/op_chains_optimism_chain_list.sql rename to daily_spellbook/models/op/op_chains/op_chains_optimism_chain_list.sql index 66d491ba1ec..6fddfcdf86e 100644 --- a/models/op/op_chains/op_chains_optimism_chain_list.sql +++ b/daily_spellbook/models/op/op_chains/op_chains_optimism_chain_list.sql @@ -22,7 +22,7 @@ WITH chain_names AS ( {% endfor %} ) -SELECT +SELECT c.chain_dune_name as blockchain, cast(i.name as varchar) as blockchain_name, cast(i.chain_id as int) AS chain_id, @@ -30,5 +30,5 @@ SELECT c.is_superchain FROM chain_names c - LEFT JOIN {{ ref('evms_info') }} i + LEFT JOIN {{ source('evms', 'info') }} i ON i.blockchain = c.chain_dune_name \ No newline at end of file diff --git a/models/op/op_chains/op_chains_optimism_schema.yml b/daily_spellbook/models/op/op_chains/op_chains_optimism_schema.yml similarity index 100% rename from models/op/op_chains/op_chains_optimism_schema.yml rename to daily_spellbook/models/op/op_chains/op_chains_optimism_schema.yml diff --git a/models/op/op_token/optimism/op_token_optimism_inflation_schedule.sql b/daily_spellbook/models/op/op_token/optimism/op_token_optimism_inflation_schedule.sql similarity index 100% rename from models/op/op_token/optimism/op_token_optimism_inflation_schedule.sql rename to daily_spellbook/models/op/op_token/optimism/op_token_optimism_inflation_schedule.sql diff --git a/models/op/op_token/optimism/op_token_optimism_initial_allocations.sql b/daily_spellbook/models/op/op_token/optimism/op_token_optimism_initial_allocations.sql similarity index 100% rename from models/op/op_token/optimism/op_token_optimism_initial_allocations.sql rename to daily_spellbook/models/op/op_token/optimism/op_token_optimism_initial_allocations.sql diff --git a/models/op/op_token/optimism/op_token_optimism_metadata.sql b/daily_spellbook/models/op/op_token/optimism/op_token_optimism_metadata.sql similarity index 100% rename from models/op/op_token/optimism/op_token_optimism_metadata.sql rename to daily_spellbook/models/op/op_token/optimism/op_token_optimism_metadata.sql diff --git a/models/op/op_token/optimism/op_token_optimism_schema.yml b/daily_spellbook/models/op/op_token/optimism/op_token_optimism_schema.yml similarity index 100% rename from models/op/op_token/optimism/op_token_optimism_schema.yml rename to daily_spellbook/models/op/op_token/optimism/op_token_optimism_schema.yml diff --git a/models/op/optimism/op_optimism_airdrop_1_claims.sql b/daily_spellbook/models/op/optimism/op_optimism_airdrop_1_claims.sql similarity index 87% rename from models/op/optimism/op_optimism_airdrop_1_claims.sql rename to daily_spellbook/models/op/optimism/op_optimism_airdrop_1_claims.sql index c34bddf6046..1f5d096e9a7 100644 --- a/models/op/optimism/op_optimism_airdrop_1_claims.sql +++ b/daily_spellbook/models/op/optimism/op_optimism_airdrop_1_claims.sql @@ -1,6 +1,5 @@ {{ config( - schema = 'op_optimism', alias = 'airdrop_1_claims', materialized = 'incremental', @@ -41,12 +40,12 @@ SELECT 'optimism' AS blockchain , 'OP' AS token_symbol , t.evt_index FROM {{ source('op_optimism', 'MerkleDistributor_evt_Claimed') }} t -LEFT JOIN {{ ref('prices_usd_forward_fill') }} pu ON pu.blockchain = 'optimism' +LEFT JOIN {{ source('prices', 'usd_forward_fill') }} pu ON pu.blockchain = 'optimism' AND pu.contract_address= {{op_token_address}} AND pu.minute=date_trunc('minute', t.evt_block_time) {% if is_incremental() %} - AND pu.minute >= date_trunc('day', now() - interval '7' Day) + AND {{ incremental_predicate('pu.minute') }} {% endif %} {% if is_incremental() %} -WHERE t.evt_block_time >= date_trunc('day', now() - interval '7' Day) +WHERE {{ incremental_predicate('t.evt_block_time') }} {% endif %} \ No newline at end of file diff --git a/models/op/optimism/op_optimism_schema.yml b/daily_spellbook/models/op/optimism/op_optimism_schema.yml similarity index 100% rename from models/op/optimism/op_optimism_schema.yml rename to daily_spellbook/models/op/optimism/op_optimism_schema.yml diff --git a/models/op/readme.md b/daily_spellbook/models/op/readme.md similarity index 100% rename from models/op/readme.md rename to daily_spellbook/models/op/readme.md diff --git a/models/op/retropgf/optimism/op_retropgf_optimism_recipients.sql b/daily_spellbook/models/op/retropgf/optimism/op_retropgf_optimism_recipients.sql similarity index 100% rename from models/op/retropgf/optimism/op_retropgf_optimism_recipients.sql rename to daily_spellbook/models/op/retropgf/optimism/op_retropgf_optimism_recipients.sql diff --git a/models/op/retropgf/optimism/op_retropgf_optimism_round2_recipients.sql b/daily_spellbook/models/op/retropgf/optimism/op_retropgf_optimism_round2_recipients.sql similarity index 100% rename from models/op/retropgf/optimism/op_retropgf_optimism_round2_recipients.sql rename to daily_spellbook/models/op/retropgf/optimism/op_retropgf_optimism_round2_recipients.sql diff --git a/models/op/retropgf/optimism/op_retropgf_optimism_round2_voters.sql b/daily_spellbook/models/op/retropgf/optimism/op_retropgf_optimism_round2_voters.sql similarity index 100% rename from models/op/retropgf/optimism/op_retropgf_optimism_round2_voters.sql rename to daily_spellbook/models/op/retropgf/optimism/op_retropgf_optimism_round2_voters.sql diff --git a/models/op/retropgf/optimism/op_retropgf_optimism_schema.yml b/daily_spellbook/models/op/retropgf/optimism/op_retropgf_optimism_schema.yml similarity index 100% rename from models/op/retropgf/optimism/op_retropgf_optimism_schema.yml rename to daily_spellbook/models/op/retropgf/optimism/op_retropgf_optimism_schema.yml diff --git a/models/op/retropgf/optimism/op_retropgf_optimism_voters.sql b/daily_spellbook/models/op/retropgf/optimism/op_retropgf_optimism_voters.sql similarity index 100% rename from models/op/retropgf/optimism/op_retropgf_optimism_voters.sql rename to daily_spellbook/models/op/retropgf/optimism/op_retropgf_optimism_voters.sql diff --git a/models/op/token_distributions/optimism/op_token_distributions_optimism_all_distributions_labels.sql b/daily_spellbook/models/op/token_distributions/optimism/op_token_distributions_optimism_all_distributions_labels.sql similarity index 92% rename from models/op/token_distributions/optimism/op_token_distributions_optimism_all_distributions_labels.sql rename to daily_spellbook/models/op/token_distributions/optimism/op_token_distributions_optimism_all_distributions_labels.sql index f733db73e3c..6932b451967 100644 --- a/models/op/token_distributions/optimism/op_token_distributions_optimism_all_distributions_labels.sql +++ b/daily_spellbook/models/op/token_distributions/optimism/op_token_distributions_optimism_all_distributions_labels.sql @@ -1,6 +1,6 @@ {{ config( + schema = 'op_token_distributions_optimism', alias = 'all_distributions_labels', - post_hook='{{ expose_spells(\'["optimism"]\', "project", "op_token_distributions", @@ -35,7 +35,7 @@ WITH all_labels AS ( , distinct_name AS proposal_name , cex_name AS address_descriptor , cex_name AS project_name - FROM {{ ref('cex_optimism_addresses') }} + FROM {{ source('cex_optimism', 'addresses') }} WHERE address NOT IN (SELECT address FROM {{ ref('op_token_distributions_optimism_project_wallets') }}) ) diff --git a/models/op/token_distributions/optimism/op_token_distributions_optimism_foundation_wallet_approvals.sql b/daily_spellbook/models/op/token_distributions/optimism/op_token_distributions_optimism_foundation_wallet_approvals.sql similarity index 83% rename from models/op/token_distributions/optimism/op_token_distributions_optimism_foundation_wallet_approvals.sql rename to daily_spellbook/models/op/token_distributions/optimism/op_token_distributions_optimism_foundation_wallet_approvals.sql index 9659e38ce1f..13433153e80 100644 --- a/models/op/token_distributions/optimism/op_token_distributions_optimism_foundation_wallet_approvals.sql +++ b/daily_spellbook/models/op/token_distributions/optimism/op_token_distributions_optimism_foundation_wallet_approvals.sql @@ -1,10 +1,11 @@ {{ config( + schema = 'op_token_distributions_optimism', alias = 'foundation_wallet_approvals', - partition_by = ['block_date'], materialized = 'incremental', file_format = 'delta', incremental_strategy = 'merge', + incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.block_date')], unique_key = ['block_date', 'evt_block_time', 'evt_block_number', 'evt_tx_hash', 'evt_index'], post_hook='{{ expose_spells(\'["optimism"]\', "project", @@ -24,11 +25,11 @@ WITH project_labels AS ( - SELECT - address, - project_name, - label, - address_descriptor + SELECT + address, + project_name, + label, + address_descriptor FROM {{ ref('op_token_distributions_optimism_project_wallets') }} WHERE label IS NOT NULL GROUP BY 1, 2, 3, 4 @@ -40,7 +41,7 @@ SELECT a.evt_block_time, a.evt_block_number, a.evt_tx_hash, a.evt_index, a.spender AS project_address, al.project_name, - t."from" AS tx_from_address, t.to AS tx_to_address, + t."from" AS tx_from_address, t.to AS tx_to_address, cast(a.value as double)/cast(1e18 as double) AS op_approved_to_project @@ -48,8 +49,8 @@ FROM {{ source('erc20_optimism', 'evt_Approval') }} a INNER JOIN {{ source('optimism', 'transactions') }} t ON t.hash = a.evt_tx_hash AND t.block_number = a.evt_block_number - {% if is_incremental() %} - AND t.block_time >= date_trunc('day', now() - interval '7' day) + {% if is_incremental() %} + AND {{ incremental_predicate('t.block_time') }} {% else %} AND t.block_time >= cast( '{{approvals_start_date}}' as date ) {% endif %} @@ -60,8 +61,8 @@ FROM {{ source('erc20_optimism', 'evt_Approval') }} a WHERE a.contract_address = {{op_token_address}} --OP Token AND owner in (SELECT address FROM project_labels WHERE label = '{{foundation_label}}' AND address_descriptor = '{{grants_descriptor}}') - {% if is_incremental() %} - AND a.evt_block_time >= date_trunc('day', now() - interval '7' day) + {% if is_incremental() %} + AND {{ incremental_predicate('a.evt_block_time') }} {% else %} AND a.evt_block_time >= cast( '{{approvals_start_date}}' as date ) {% endif %} diff --git a/models/op/token_distributions/optimism/op_token_distributions_optimism_other_distributions_claims.sql b/daily_spellbook/models/op/token_distributions/optimism/op_token_distributions_optimism_other_distributions_claims.sql similarity index 83% rename from models/op/token_distributions/optimism/op_token_distributions_optimism_other_distributions_claims.sql rename to daily_spellbook/models/op/token_distributions/optimism/op_token_distributions_optimism_other_distributions_claims.sql index b4e15293eb7..c633215ba9b 100644 --- a/models/op/token_distributions/optimism/op_token_distributions_optimism_other_distributions_claims.sql +++ b/daily_spellbook/models/op/token_distributions/optimism/op_token_distributions_optimism_other_distributions_claims.sql @@ -1,10 +1,11 @@ {{ config( + schema = 'op_token_distributions_optimism', alias = 'other_distributions_claims', - partition_by = ['block_date'], materialized = 'incremental', file_format = 'delta', incremental_strategy = 'merge', + incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.block_date')], unique_key = ['block_date', 'evt_block_time', 'evt_block_number', 'evt_tx_hash', 'evt_index'], post_hook='{{ expose_spells(\'["optimism"]\', "project", @@ -24,32 +25,32 @@ WITH all_labels AS ( SELECT address, label, proposal_name, address_descriptor, project_name FROM {{ ref('op_token_distributions_optimism_all_distributions_labels') }} ) -, aave_lm_claims AS ( +, aave_lm_claims AS ( SELECT CAST(DATE_TRUNC('day',evt_block_time) as date) AS block_date, - evt_block_time, evt_block_number, evt_index, + evt_block_time, evt_block_number, evt_index, tx_to_address, tx_from_address, - evt_tx_hash, from_label, from_type, from_name, + evt_tx_hash, from_label, from_type, from_name, to_type, to_label, to_name, op_amount_decimal, tx_method, MIN(evt_tfer_index) AS min_evt_tfer_index, MAX(evt_tfer_index) AS max_evt_tfer_index, - + (array_agg( CASE WHEN claim_rank_asc = 1 THEN from_address ELSE NULL END - ) filter (where + ) filter (where CASE WHEN claim_rank_asc = 1 THEN from_address ELSE NULL END is not NULL))[1] as from_address, - + (array_agg( CASE WHEN claim_rank_asc = 1 THEN to_address ELSE NULL END - ) filter (where + ) filter (where CASE WHEN claim_rank_asc = 1 THEN to_address ELSE NULL END is not NULL))[1] as to_address FROM ( - SELECT - DATE_TRUNC('day',r.evt_block_time) AS block_date, + SELECT + DATE_TRUNC('day',r.evt_block_time) AS block_date, r.evt_block_time, r.evt_block_number, r.evt_index, tf."from" AS from_address, tf.to AS to_address, tx.to AS tx_to_address, tx."from" AS tx_from_address, r.evt_tx_hash, - 'Project' as from_label, 'Partner Fund' AS from_type, 'Aave' AS from_name, + 'Project' as from_label, 'Partner Fund' AS from_type, 'Aave' AS from_name, tf.to as user_address ,'Aave - Liquidity Mining' AS to_type ,COALESCE( @@ -60,18 +61,18 @@ FROM ( --get last , tf.evt_index AS evt_tfer_index , bytearray_substring(tx.data, 1, 4) AS tx_method - + ,ROW_NUMBER() OVER (PARTITION BY r.evt_tx_hash, r.evt_index ORDER BY tf.evt_index DESC) AS claim_rank_desc ,ROW_NUMBER() OVER (PARTITION BY r.evt_tx_hash, r.evt_index ORDER BY tf.evt_index ASC) AS claim_rank_asc - + FROM {{ source('aave_v3_optimism','RewardsController_evt_RewardsClaimed') }} r inner JOIN {{ source('erc20_optimism', 'evt_transfer') }} tf ON tf.evt_tx_hash = r.evt_tx_hash AND tf.evt_block_number = r.evt_block_number AND tf.contract_address = r.reward AND value = amount - {% if is_incremental() %} - and tf.evt_block_time >= date_trunc('day', now() - interval '7' day) + {% if is_incremental() %} + and {{ incremental_predicate('tf.evt_block_time') }} {% else %} and tf.evt_block_time >= cast('{{op_token_launch_date}}' as date) {% endif %} @@ -84,25 +85,25 @@ FROM ( ON tx.hash = tf.evt_tx_hash AND tx.block_number = tf.evt_block_number AND lbl_to.label IS NULL -- don't try if we have a label on the to transfer - {% if is_incremental() %} - AND tx.block_time >= date_trunc('day', now() - interval '7' day) + {% if is_incremental() %} + AND {{ incremental_predicate('tx.block_time') }} {% else %} AND tx.block_time >= cast('{{op_token_launch_date}}' as date) {% endif %} - + WHERE reward = {{op_token_address}} --OP Token and cast(amount as double)/cast(1e18 as double) > 0 AND lbl_from.label = '{{foundation_label}}' - {% if is_incremental() %} - and r.evt_block_time >= date_trunc('day', now() - interval '7' day) + {% if is_incremental() %} + and {{ incremental_predicate('r.evt_block_time') }} {% endif %} ) a GROUP BY - evt_block_time, evt_block_number, evt_index, + evt_block_time, evt_block_number, evt_index, tx_to_address, tx_from_address, - evt_tx_hash, from_label, from_type, from_name, + evt_tx_hash, from_label, from_type, from_name, to_type, to_label, to_name, op_amount_decimal, tx_method ) diff --git a/models/op/token_distributions/optimism/op_token_distributions_optimism_other_tags.sql b/daily_spellbook/models/op/token_distributions/optimism/op_token_distributions_optimism_other_tags.sql similarity index 97% rename from models/op/token_distributions/optimism/op_token_distributions_optimism_other_tags.sql rename to daily_spellbook/models/op/token_distributions/optimism/op_token_distributions_optimism_other_tags.sql index 226099e5bf5..d254f69a5f2 100644 --- a/models/op/token_distributions/optimism/op_token_distributions_optimism_other_tags.sql +++ b/daily_spellbook/models/op/token_distributions/optimism/op_token_distributions_optimism_other_tags.sql @@ -1,4 +1,5 @@ {{ config( + schema = 'op_token_distributions_optimism', alias = 'other_tags', tags = [ 'static'] ) @@ -44,7 +45,7 @@ FROM (values ,('0x574a21fe5ea9666dbca804c9d69d8caf21d5322b', 'Rubicon LP') ,('0x1111111254760f7ab3f16433eea9304126dcd199', '1inch Swap') ,('0x1111111254EEB25477B68fb85Ed929f73A960582', '1inch Swap') - + ) a (address, address_name) ) b WHERE rnk = 1 --check to prevent duplicates @@ -56,6 +57,6 @@ FROM ( FROM tagged_wallets UNION ALL SELECT 'Other',address, cex_name - FROM {{ ref('cex_optimism_addresses') }} + FROM {{ source('cex_optimism', 'addresses') }} ) WHERE address NOT IN (SELECT address FROM {{ ref('op_token_distributions_optimism_project_wallets') }}) --not already tagged diff --git a/models/op/token_distributions/optimism/op_token_distributions_optimism_project_name_mapping.sql b/daily_spellbook/models/op/token_distributions/optimism/op_token_distributions_optimism_project_name_mapping.sql similarity index 97% rename from models/op/token_distributions/optimism/op_token_distributions_optimism_project_name_mapping.sql rename to daily_spellbook/models/op/token_distributions/optimism/op_token_distributions_optimism_project_name_mapping.sql index 407cebdb262..63121af81d0 100644 --- a/models/op/token_distributions/optimism/op_token_distributions_optimism_project_name_mapping.sql +++ b/daily_spellbook/models/op/token_distributions/optimism/op_token_distributions_optimism_project_name_mapping.sql @@ -1,6 +1,7 @@ -- Map governance proposal names to Dune project names {{ config( tags = ['static'], + schema = 'op_token_distributions_optimism', alias = 'project_name_mapping' ) }} diff --git a/models/op/token_distributions/optimism/op_token_distributions_optimism_project_wallets.sql b/daily_spellbook/models/op/token_distributions/optimism/op_token_distributions_optimism_project_wallets.sql similarity index 98% rename from models/op/token_distributions/optimism/op_token_distributions_optimism_project_wallets.sql rename to daily_spellbook/models/op/token_distributions/optimism/op_token_distributions_optimism_project_wallets.sql index 7c3cc3b0df1..793a101ff84 100644 --- a/models/op/token_distributions/optimism/op_token_distributions_optimism_project_wallets.sql +++ b/daily_spellbook/models/op/token_distributions/optimism/op_token_distributions_optimism_project_wallets.sql @@ -1,5 +1,5 @@ {{ config( - + schema = 'op_token_distributions_optimism', alias = 'project_wallets', post_hook='{{ expose_spells(\'["optimism"]\', "project", @@ -88,7 +88,7 @@ FROM (values --quix - should come from CB ,(0x5Ad4A019F77e82940f6Dd15A5215362AF061A742,'Quix','Distributor') - + --suspected grants multisigs ,(0x5a06d52f38965904cf15c3f55286263ab9a237d7, 'Perpetual Protocol','Grants Wallet') --guessing ,(0xC69a2d7e3De31542aB9ba1e80F9F5d68e49f78e6, 'Lyra','Lyra Grants DAO') @@ -103,7 +103,7 @@ FROM (values ) a (address, proposal_name, address_descriptor) ) b WHERE rnk = 1 --check to prevent duplicates - AND address NOT IN (SELECT address FROM {{ref('cex_optimism_addresses')}} ) --make sure we don't accidently catch a CEX + AND address NOT IN (SELECT address FROM {{source('cex_optimism', 'addresses')}} ) --make sure we don't accidently catch a CEX ) @@ -191,7 +191,7 @@ FROM (values ,(0x3ee85ac7c0e1799af6f4e582de485fcdfb12855a, 'Rocket Pool', 'WETH/rETH: Beethoven X') ,(0xdd5bfe292e377308abb58a211a572bd9732b62b7, 'Rocket Pool', 'sWETH/rETH: Velodrome') ,(0x4bae082f810fa888364600efda0bf9f5c6e5e315, 'Rocket Pool', 'vWETH/rETH: Velodrome') - ,(0xE01A297289f0aE9e745DdDC61F139537ab733710, 'Overnight', 'USD+/USDC: Velodrome') + ,(0xE01A297289f0aE9e745DdDC61F139537ab733710, 'Overnight', 'USD+/USDC: Velodrome') ,(0x8801b45390095f7632C02392C4489985e0607E82, 'Overnight', 'BPT-USD+: Beethoven X') ,(0xB66D278b843dBE76ee73Da61182fF97100f97920, 'Overnight', 'USD+/DOLA: Velodrome') ,(0x41a7540ec8cb3afafe16a834abe0863f22016ec0, 'Overnight', 'USD+/LUSD: Velodrome') @@ -262,12 +262,12 @@ FROM (values --grants deployed ,(0xC98786D5A7a03C1e74AffCb97fF7eF8a710DA09B, 'Karma', 'Karma - Grant') - - + + ) a (address, proposal_name, address_descriptor) ) b WHERE rnk = 1 --check to prvent duplicates - AND address NOT IN (SELECT address FROM {{ref('cex_optimism_addresses')}}) --make sure we don't accidently catch a CEX + AND address NOT IN (SELECT address FROM {{source('cex_optimism', 'addresses')}}) --make sure we don't accidently catch a CEX ) SELECT @@ -277,11 +277,11 @@ SELECT , concat_ws(',', ARRAY_AGG(DISTINCT fin.label) ) AS label , concat_ws(',', ARRAY_AGG(DISTINCT fin.proposal_name) ) AS proposal_name , concat_ws(',', ARRAY_AGG(DISTINCT fin.address_descriptor) ) address_descriptor - , concat_ws(',', ARRAY_AGG(DISTINCT + , concat_ws(',', ARRAY_AGG(DISTINCT COALESCE(pnm.project_name, fin.proposal_name) ) ) AS project_name FROM ( - SELECT address, label, proposal_name, address_descriptor, ROW_NUMBER() OVER(PARTITION BY address ORDER BY rnk ASC) AS choice_rank + SELECT address, label, proposal_name, address_descriptor, ROW_NUMBER() OVER(PARTITION BY address ORDER BY rnk ASC) AS choice_rank FROM ( -- Pull known project wallets SELECT address, category AS label, proposal_name, funding_source AS address_descriptor, 1 as rnk @@ -304,7 +304,7 @@ FROM ( ) do_choice_rank ) fin -LEFT JOIN {{ ref('op_token_distributions_optimism_project_name_mapping') }} pnm +LEFT JOIN {{ ref('op_token_distributions_optimism_project_name_mapping') }} pnm ON trim(lower(pnm.proposal_name)) = trim(lower(fin.proposal_name)) GROUP BY fin.address diff --git a/models/op/token_distributions/optimism/op_token_distributions_optimism_transfer_mapping.sql b/daily_spellbook/models/op/token_distributions/optimism/op_token_distributions_optimism_transfer_mapping.sql similarity index 84% rename from models/op/token_distributions/optimism/op_token_distributions_optimism_transfer_mapping.sql rename to daily_spellbook/models/op/token_distributions/optimism/op_token_distributions_optimism_transfer_mapping.sql index 833fec1b722..b7bfa8587cc 100644 --- a/models/op/token_distributions/optimism/op_token_distributions_optimism_transfer_mapping.sql +++ b/daily_spellbook/models/op/token_distributions/optimism/op_token_distributions_optimism_transfer_mapping.sql @@ -1,5 +1,6 @@ {{ config( tags = ['prod_exclude'], + schema = 'op_token_distributions_optimism', alias = 'transfer_mapping', partition_by = ['block_date'], materialized = 'incremental', @@ -34,51 +35,51 @@ WITH all_labels AS ( WITH tfers AS ( -- transfers out SELECT - evt_block_time, - evt_block_number, + evt_block_time, + evt_block_number, evt_index, - tf."from" AS from_address, - tf.to AS to_address, - tx.to AS tx_to_address, - tx."from" AS tx_from_address, + tf."from" AS from_address, + tf.to AS to_address, + tx.to AS tx_to_address, + tx."from" AS tx_from_address, evt_tx_hash, - + COALESCE( lbl_from_util_tx.address_descriptor ,lbl_from.address_descriptor - ) + ) AS from_type, --override if to an incentive tx address COALESCE( lbl_to.address_descriptor ,'Other' ) AS to_type, - + COALESCE( - lbl_from_util_tx.label + lbl_from_util_tx.label ,lbl_from.label - ) + ) AS from_label, --override if to an incentive tx address COALESCE( lbl_to.label - , 'Other') + , 'Other') AS to_label, - + COALESCE( lbl_from_util_tx.project_name ,lbl_from.project_name - ) + ) AS from_name, --override if to an incentive tx address COALESCE( lbl_to.project_name ,'Other' ) AS to_name, - + cast(tf.value as double)/cast( 1e18 as double) AS op_amount_decimal, evt_index AS evt_tfer_index, - + bytearray_substring(tx.data, 1, 4) AS tx_method - + FROM {{source('erc20_optimism','evt_transfer') }} tf -- We want either the send or receiver to be the foundation or a project (also includes utility transfers) INNER JOIN all_labels lbl_from @@ -86,41 +87,41 @@ WITH all_labels AS ( -- if the recipient is in this list to, then we track it LEFT JOIN all_labels lbl_to ON lbl_to.address = tf.to - - + + LEFT JOIN {{ source('optimism','transactions') }} tx ON tx.hash = tf.evt_tx_hash AND tx.block_number = tf.evt_block_number - {% if is_incremental() %} - and tx.block_time >= date_trunc('day', now() - interval '7' day) + {% if is_incremental() %} + and {{ incremental_predicate('tx.block_time') }} {% else %} AND tx.block_time >= cast('{{op_token_launch_date}}' as date) {% endif %} - + LEFT JOIN disperse_contracts dc ON tx.to = dc.address - + LEFT JOIN all_labels lbl_from_util_tx ON lbl_from_util_tx.address = tx."from" --label of the transaction sender AND dc.address IS NOT NULL --we have a disperse - + -- LEFT JOIN tx_labels txl -- ON txl.tx_hash = tf.evt_tx_hash - + WHERE tf.contract_address = {{op_token_address}} --exclude Wintermute funding tfers AND NOT (tf."from" = 0x2501c477d0a35545a387aa4a3eee4292a9a8b3f0 and tf.to IN (0x4f3a120e72c76c22ae802d129f599bfdbc31cb81 ,0x51d3a2f94e60cbecdce05ab41b61d7ce5240b8ff) ) - {% if is_incremental() %} - and tf.evt_block_time >= date_trunc('day', now() - interval '7' day) + {% if is_incremental() %} + and {{ incremental_predicate('tf.evt_block_time') }} {% else %} AND tf.evt_block_time >= cast('{{op_token_launch_date}}' as date) {% endif %} - + -- For CEXs, exclude CEX to CEX or CEX withdrawals - AND 1= ( + AND 1= ( CASE WHEN lbl_from.label != 'CEX' THEN 1 --when not a CEX, keep it WHEN lbl_from.label = 'CEX' AND lbl_to.label = 'CEX' THEN 0 @@ -144,51 +145,51 @@ WITH all_labels AS ( ) GROUP BY 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17 --get uniques b/c of duplicated receiver addresses - + ) SELECT - evt_block_time, - evt_block_number, + evt_block_time, + evt_block_number, evt_index, - from_address, - to_address, - tx_to_address, - tx_from_address, + from_address, + to_address, + tx_to_address, + tx_from_address, evt_tx_hash, - from_type, - to_type, - from_label, - from_name, - to_label, - o.to_name, - op_amount_decimal, + from_type, + to_type, + from_label, + from_name, + to_label, + o.to_name, + op_amount_decimal, tx_method FROM {{ ref('op_token_distributions_optimism_other_distributions_claims') }} o - {% if is_incremental() %} - where o.evt_block_time >= date_trunc('day', now() - interval '7' day) + {% if is_incremental() %} + where {{ incremental_predicate('o.evt_block_time') }} {% endif %} UNION ALL - + SELECT - t.evt_block_time, - t.evt_block_number, + t.evt_block_time, + t.evt_block_number, t.evt_index, - t.from_address, - t.to_address, - t.tx_to_address, - t.tx_from_address, + t.from_address, + t.to_address, + t.tx_to_address, + t.tx_from_address, t.evt_tx_hash, - t.from_type, - t.to_type, - t.from_label, - t.from_name, - t.to_label, - t.to_name, - t.op_amount_decimal, + t.from_type, + t.to_type, + t.from_label, + t.from_name, + t.to_label, + t.to_name, + t.op_amount_decimal, t.tx_method - + FROM tfers t LEFT JOIN {{ ref('op_token_distributions_optimism_other_distributions_claims') }} o --don't double count - at the amount level b/c there could be multiple claims in one tx ON t.evt_block_number = o.evt_block_number @@ -199,8 +200,8 @@ WITH all_labels AS ( OR t.evt_tfer_index = o.max_evt_tfer_index ) - {% if is_incremental() %} - and o.evt_block_time >= date_trunc('day', now() - interval '7' day) + {% if is_incremental() %} + and {{ incremental_predicate('o.evt_block_time') }} {% endif %} WHERE o.evt_block_number IS NULL ) @@ -208,7 +209,7 @@ WITH all_labels AS ( , distributions AS ( -SELECT +SELECT evt_block_time, evt_block_number, evt_index, evt_tx_hash -- , from_address, to_address @@ -221,24 +222,24 @@ SELECT -- Assume 'Other' addresses (i.e. an unknown address) are end users. CASE WHEN to_label LIKE '%Other%' THEN op_amount_decimal ELSE 0 END AS op_claimed, - + -- When tokens go to a 'Deployed' address, we assume deployed. Or to an end user from an address we don't already know to be deployed. CASE WHEN ( to_label LIKE '%Other%' OR to_label LIKE '%Deployed%') AND from_label NOT LIKE '%Deployed%' THEN op_amount_decimal WHEN (from_name != to_name) AND from_label LIKE '%Project%' AND to_label LIKE '%Project%' THEN op_amount_decimal --handle for distirbutions to other projects (i.e. Uniswap to Gamma) ELSE 0 END AS op_deployed, - + -- When from the foundation grants wallets to a project, we mark as "op to project" CASE WHEN from_label = '{{foundation_label}}' AND from_type = '{{grants_descriptor}}' AND to_label LIKE '%Project%' THEN op_amount_decimal ELSE 0 END AS op_to_project, - + -- Tokens being transferred between projects (i.e. Uniswap to Gamma) CASE WHEN from_label LIKE '%Project%' AND to_label LIKE '%Project%' AND from_name != to_name THEN op_amount_decimal ELSE 0 END AS op_between_projects, - + -- Tokens going from being deployed back to the project CASE WHEN from_label NOT LIKE '%Project%' and to_label LIKE '%Project%' AND from_name = to_name THEN op_amount_decimal --Projects Clawback @@ -260,14 +261,14 @@ SELECT CASE WHEN from_label = '{{foundation_label}}' AND from_type = '{{grants_descriptor}}' AND to_label = 'RetroPGF' THEN op_amount_decimal ELSE 0 END AS op_for_retropgf - + FROM outgoing_distributions od ) -SELECT +SELECT cast(DATE_TRUNC('day',evt_block_time) AS date) AS block_date , evt_block_time, evt_block_number, evt_index, evt_tx_hash -- @@ -292,7 +293,7 @@ SELECT -- , d.to_name AS og_to_name --keep original name in case we want it , d.from_name AS og_from_name --keep original name in case we want it - + FROM distributions d -- read in other tags LEFT JOIN {{ ref('op_token_distributions_optimism_other_tags') }} dto diff --git a/models/op/token_distributions/optimism/op_token_distributions_schema.yml b/daily_spellbook/models/op/token_distributions/optimism/op_token_distributions_schema.yml similarity index 100% rename from models/op/token_distributions/optimism/op_token_distributions_schema.yml rename to daily_spellbook/models/op/token_distributions/optimism/op_token_distributions_schema.yml diff --git a/models/optimism_attestationstation/optimism/optimism_attestationstation_optimism_events.sql b/daily_spellbook/models/optimism/optimism_attestationstation_optimism_events.sql similarity index 97% rename from models/optimism_attestationstation/optimism/optimism_attestationstation_optimism_events.sql rename to daily_spellbook/models/optimism/optimism_attestationstation_optimism_events.sql index be710156547..1fd25348d37 100644 --- a/models/optimism_attestationstation/optimism/optimism_attestationstation_optimism_events.sql +++ b/daily_spellbook/models/optimism/optimism_attestationstation_optimism_events.sql @@ -1,6 +1,6 @@ {{ config( + schema = 'optimism_attestationstation_optimism', alias = 'events', - partition_by = ['block_date'], materialized = 'incremental', file_format = 'delta', diff --git a/models/optimism_attestationstation/optimism/optimism_attestationstation_optimism_schema.yml b/daily_spellbook/models/optimism/optimism_attestationstation_optimism_schema.yml similarity index 100% rename from models/optimism_attestationstation/optimism/optimism_attestationstation_optimism_schema.yml rename to daily_spellbook/models/optimism/optimism_attestationstation_optimism_schema.yml diff --git a/dbt_project.yml b/dbt_project.yml index 05730532ba4..e78dd134444 100644 --- a/dbt_project.yml +++ b/dbt_project.yml @@ -414,8 +414,6 @@ models: +schema: addresses ethereum: +schema: addresses_ethereum - optimism: - +schema: addresses_optimism addresses_summary: +schema: addresses_summary @@ -862,18 +860,6 @@ models: optimism: +schema: ovm_optimism - op: - +schema: op - token_distributions: - +schema: op_token_distributions - optimism: - +schema: op_token_distributions_optimism - op_chains: - +schema: op_chains - op_token: - optimism: - +schema: op_token_optimism - rubicon: +schema: rubicon optimism: @@ -916,11 +902,6 @@ models: ethereum: +schema: dydx_ethereum - optimism_attestationstation: - +schema: optimism_attestationstation - optimism: - +schema: optimism_attestationstation_optimism - lido: +schema: lido accounting: diff --git a/models/airdrop/optimism/airdrop_optimism_claims.sql b/models/airdrop/optimism/airdrop_optimism_claims.sql index 5ed4f1a9d8e..ae8b4207a93 100644 --- a/models/airdrop/optimism/airdrop_optimism_claims.sql +++ b/models/airdrop/optimism/airdrop_optimism_claims.sql @@ -1,5 +1,5 @@ {{ config( - + schema = 'airdrop_optimism', alias = 'claims', post_hook='{{ expose_spells(\'["optimism"]\', "sector", @@ -10,7 +10,7 @@ {% set airdrop_claims_models = [ - ref('op_optimism_airdrop_1_claims') + source('op_optimism', 'airdrop_1_claims') ,ref('velodrome_optimism_airdrop_claims') ] %} diff --git a/models/labels/addresses/__single_category_labels__/op_retropgf/labels_op_retropgf.sql b/models/labels/addresses/__single_category_labels__/op_retropgf/labels_op_retropgf.sql index 1fbe40815e6..eefcb6fbd07 100644 --- a/models/labels/addresses/__single_category_labels__/op_retropgf/labels_op_retropgf.sql +++ b/models/labels/addresses/__single_category_labels__/op_retropgf/labels_op_retropgf.sql @@ -18,7 +18,7 @@ SELECT blockchain, 'op_retropgf_recipients' as model_name, 'identifier' as label_type -FROM {{ ref('op_retropgf_optimism_recipients') }} +FROM {{ source('op_retropgf_optimism', 'recipients') }} UNION ALL @@ -33,4 +33,4 @@ SELECT blockchain, 'op_retropgf_voters' as model_name, 'identifier' as label_type -FROM {{ ref('op_retropgf_optimism_voters') }} \ No newline at end of file +FROM {{ source('op_retropgf_optimism', 'voters') }} \ No newline at end of file diff --git a/models/labels/addresses/__single_category_labels__/project_wallets/labels_project_wallets.sql b/models/labels/addresses/__single_category_labels__/project_wallets/labels_project_wallets.sql index 3a0ac72f8e3..cad31f15386 100644 --- a/models/labels/addresses/__single_category_labels__/project_wallets/labels_project_wallets.sql +++ b/models/labels/addresses/__single_category_labels__/project_wallets/labels_project_wallets.sql @@ -1,5 +1,5 @@ {{config( - + alias = 'project_wallets', post_hook='{{ expose_spells(\'["optimism"]\', "sector", @@ -20,7 +20,7 @@ SELECT 'project_wallets' AS model_name, 'identifier' AS label_type -FROM {{ ref('addresses_optimism_grants_funding') }} +FROM {{ source('addresses_optimism', 'grants_funding') }} GROUP BY 1,2,3 -- UNION ALL diff --git a/models/labels/addresses/infrastructure/identifier/l2_fee_vaults/labels_l2_fee_vaults.sql b/models/labels/addresses/infrastructure/identifier/l2_fee_vaults/labels_l2_fee_vaults.sql index 176f7b0c618..1304e9bc8eb 100644 --- a/models/labels/addresses/infrastructure/identifier/l2_fee_vaults/labels_l2_fee_vaults.sql +++ b/models/labels/addresses/infrastructure/identifier/l2_fee_vaults/labels_l2_fee_vaults.sql @@ -1,5 +1,5 @@ {{config( - + alias = 'l2_fee_vaults', post_hook='{{ expose_spells(\'["optimism"]\', "sector", @@ -18,4 +18,4 @@ SELECT 'optimism' AS blockchain , 'l2_fee_vaults' AS model_name , 'identifier' AS label_type -FROM {{ ref('addresses_optimism_fee_vaults') }} +FROM {{ source('addresses_optimism', 'fee_vaults') }} diff --git a/sources/_subprojects/spellbook/_sources.yml b/sources/_subprojects/spellbook/_sources.yml index dacbe372c60..16c7d4e99ec 100644 --- a/sources/_subprojects/spellbook/_sources.yml +++ b/sources/_subprojects/spellbook/_sources.yml @@ -46,4 +46,21 @@ sources: - name: standard_bridge_flows - name: uniswap_v3_optimism tables: - - name: ovm1_pool_mapping \ No newline at end of file + - name: ovm1_pool_mapping + - name: op_optimism + tables: + - name: airdrop_1_claims + - name: cex_optimism + tables: + - name: addresses + - name: prices + tables: + - name: usd_forward_fill + - name: op_retropgf_optimism + tables: + - name: recipients + - name: voters + - name: addresses_optimism + tables: + - name: fee_vaults + - name: grants_funding From 262e3185ddc4a4cf4efc3e4b2c94605e39784dcb Mon Sep 17 00:00:00 2001 From: Alan Ghobadi Date: Wed, 5 Jun 2024 09:35:29 +0200 Subject: [PATCH 044/149] Materialize dex raw pools (#6082) * Materialize dex raw pools * Add incremental predicate --- models/dex/dex_raw_pools.sql | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/models/dex/dex_raw_pools.sql b/models/dex/dex_raw_pools.sql index 2a2567f8dae..c17bb91010f 100644 --- a/models/dex/dex_raw_pools.sql +++ b/models/dex/dex_raw_pools.sql @@ -1,8 +1,10 @@ {{ config( schema='dex', alias = 'raw_pools', - materialized = 'view', + materialized = 'incremental', file_format = 'delta', + incremental_strategy = 'merge', + incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.creation_block_time')], unique_key = ['blockchain', 'pool'], post_hook='{{ expose_spells(\'["ethereum", "polygon", "bnb", "avalanche_c", "gnosis", "fantom", "optimism", "arbitrum", "celo", "base", "zksync", "zora"]\', "sector", @@ -17,6 +19,9 @@ select * from {{ ref('dex_raw_pool_creations') }} where (blockchain, pool) not in ( select blockchain, pool from {{ ref('dex_raw_pool_initializations') }} - group by blockchain, pool + group by blockchain, pool having count(*) > 1 -) \ No newline at end of file +) +{% if is_incremental() %} + and {{incremental_predicate('creation_block_time')}} +{% endif %} From 8cf1c597bc471073700585ea1a8a3c0e83789971 Mon Sep 17 00:00:00 2001 From: Alan Ghobadi Date: Wed, 5 Jun 2024 14:09:03 +0200 Subject: [PATCH 045/149] Remove prod_exclude tag (#6087) --- .../governance/optimism/op_governance_optimism_delegates.sql | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/daily_spellbook/models/op/governance/optimism/op_governance_optimism_delegates.sql b/daily_spellbook/models/op/governance/optimism/op_governance_optimism_delegates.sql index 5f8b35bd390..4a6f8d0463a 100644 --- a/daily_spellbook/models/op/governance/optimism/op_governance_optimism_delegates.sql +++ b/daily_spellbook/models/op/governance/optimism/op_governance_optimism_delegates.sql @@ -1,7 +1,6 @@ {{ config( schema = 'op_governance_optimism' , alias = 'delegates' - , tags=['prod_exclude'] , post_hook='{{ expose_spells(\'["optimism"]\', "project", "op_governance", @@ -109,5 +108,5 @@ SELECT * FROM OP_delegates_table GROUP BY block_time, tx_hash, evt_index, delegate, current_voting_power, previous_voting_power, -power_diff,voting_power_change, total_voting_power, voting_power_share, number_of_delegators, +power_diff,voting_power_change, total_voting_power, voting_power_share, number_of_delegators, total_delegators, total_delegators_share From 0bacdedadec6c249e0833bbd00fca88a9441fa60 Mon Sep 17 00:00:00 2001 From: jeff-dude <102681548+jeff-dude@users.noreply.github.com> Date: Wed, 5 Jun 2024 09:31:52 -0400 Subject: [PATCH 046/149] Revert "Revert "Revert "Revert "Organize Balancer Spells into folders (#6005)" (#6074)" (#6075)" (#6077)" (#6078) This reverts commit b615dd740359aa2c856afa0129f0d029d683094a. --- dbt_project.yml | 13 - .../balancer/balancer_bpt_supply_macro.sql | 34 +- ...l_token_supply_changes_daily_agg_macro.sql | 37 + ...lancer_pool_token_supply_changes_macro.sql | 130 ++++ ..._token_balance_changes_daily_agg_macro.sql | 184 +++++ .../balancer_token_balance_changes_macro.sql | 169 +++++ models/_project/balancer/balances/_schema.yml | 98 +++ .../balancer/balances/arbitrum/_schema.yml | 100 +++ ...ncer_v2_arbitrum_token_balance_changes.sql | 16 + ...2_arbitrum_token_balance_changes_daily.sql | 17 + .../balancer/balances/avalanche_c/_schema.yml | 100 +++ ...r_v2_avalanche_c_token_balance_changes.sql | 16 + ...valanche_c_token_balance_changes_daily.sql | 17 + .../balancer_token_balance_changes.sql | 46 ++ .../balancer_token_balance_changes_daily.sql | 43 ++ .../balancer/balances/base/_schema.yml | 100 +++ ...balancer_v2_base_token_balance_changes.sql | 16 + ...er_v2_base_token_balance_changes_daily.sql | 17 + .../balancer/balances/ethereum/_schema.yml | 131 ++++ .../ethereum/balancer_ethereum_balances.sql | 11 +- ...ncer_v2_ethereum_token_balance_changes.sql | 16 + ...2_ethereum_token_balance_changes_daily.sql | 17 + .../balancer/balances/gnosis/_schema.yml | 100 +++ ...lancer_v2_gnosis_token_balance_changes.sql | 16 + ..._v2_gnosis_token_balance_changes_daily.sql | 17 + .../balancer/balances/optimism/_schema.yml | 100 +++ ...ncer_v2_optimism_token_balance_changes.sql | 16 + ...2_optimism_token_balance_changes_daily.sql | 17 + .../balancer/balances/polygon/_schema.yml | 100 +++ ...ancer_v2_polygon_token_balance_changes.sql | 16 + ...v2_polygon_token_balance_changes_daily.sql | 17 + .../balancer/balances/zkevm/_schema.yml | 100 +++ ...alancer_v2_zkevm_token_balance_changes.sql | 16 + ...r_v2_zkevm_token_balance_changes_daily.sql | 17 + models/_project/balancer/bpt/_schema.yml | 176 +++++ .../balancer/bpt/arbitrum/_schema.yml | 178 +++++ .../balancer_v2_arbitrum_bpt_prices.sql | 0 .../balancer_v2_arbitrum_bpt_supply.sql | 0 ...alancer_v2_arbitrum_bpt_supply_changes.sql | 20 + ...r_v2_arbitrum_bpt_supply_changes_daily.sql | 17 + .../balancer_v2_arbitrum_transfers_bpt.sql | 0 .../balancer/bpt/avalanche_c/_schema.yml | 178 +++++ .../balancer_v2_avalanche_c_bpt_prices.sql | 0 .../balancer_v2_avalanche_c_bpt_supply.sql | 0 ...ncer_v2_avalanche_c_bpt_supply_changes.sql | 20 + ...2_avalanche_c_bpt_supply_changes_daily.sql | 17 + .../balancer_v2_avalanche_c_transfers_bpt.sql | 0 .../balancer/bpt}/balancer_bpt_prices.sql | 8 +- .../balancer/bpt}/balancer_bpt_supply.sql | 8 +- .../bpt/balancer_bpt_supply_changes.sql | 44 ++ .../bpt/balancer_bpt_supply_changes_daily.sql | 38 + .../balancer/bpt}/balancer_transfers_bpt.sql | 8 +- models/_project/balancer/bpt/base/_schema.yml | 178 +++++ .../bpt}/base/balancer_v2_base_bpt_prices.sql | 0 .../bpt}/base/balancer_v2_base_bpt_supply.sql | 0 .../balancer_v2_base_bpt_supply_changes.sql | 20 + ...ancer_v2_base_bpt_supply_changes_daily.sql | 17 + .../base/balancer_v2_base_transfers_bpt.sql | 0 .../balancer/bpt/ethereum/_schema.yml | 178 +++++ .../balancer_v2_ethereum_bpt_prices.sql | 0 .../balancer_v2_ethereum_bpt_supply.sql | 0 ...alancer_v2_ethereum_bpt_supply_changes.sql | 20 + ...r_v2_ethereum_bpt_supply_changes_daily.sql | 17 + .../balancer_v2_ethereum_transfers_bpt.sql | 0 .../_project/balancer/bpt/gnosis/_schema.yml | 178 +++++ .../gnosis/balancer_v2_gnosis_bpt_prices.sql | 0 .../gnosis/balancer_v2_gnosis_bpt_supply.sql | 0 .../balancer_v2_gnosis_bpt_supply_changes.sql | 20 + ...cer_v2_gnosis_bpt_supply_changes_daily.sql | 17 + .../balancer_v2_gnosis_transfers_bpt.sql | 0 .../balancer/bpt/optimism/_schema.yml | 178 +++++ .../balancer_v2_optimism_bpt_prices.sql | 0 .../balancer_v2_optimism_bpt_supply.sql | 0 ...alancer_v2_optimism_bpt_supply_changes.sql | 20 + ...r_v2_optimism_bpt_supply_changes_daily.sql | 17 + .../balancer_v2_optimism_transfers_bpt.sql | 0 .../_project/balancer/bpt/polygon/_schema.yml | 178 +++++ .../balancer_v2_polygon_bpt_prices.sql | 0 .../balancer_v2_polygon_bpt_supply.sql | 0 ...balancer_v2_polygon_bpt_supply_changes.sql | 20 + ...er_v2_polygon_bpt_supply_changes_daily.sql | 17 + .../balancer_v2_polygon_transfers_bpt.sql | 0 .../_project/balancer/bpt/zkevm/_schema.yml | 178 +++++ .../zkevm/balancer_v2_zkevm_bpt_prices.sql | 0 .../zkevm/balancer_v2_zkevm_bpt_supply.sql | 0 .../balancer_v2_zkevm_bpt_supply_changes.sql | 20 + ...ncer_v2_zkevm_bpt_supply_changes_daily.sql | 17 + .../zkevm/balancer_v2_zkevm_transfers_bpt.sql | 0 .../_project/balancer/flashloans/_schema.yml | 35 + .../balancer/flashloans/arbitrum/_schema.yml | 36 + .../balancer_v2_arbitrum_flashloans.sql | 4 - .../flashloans/avalanche_c/_schema.yml | 36 + .../balancer_v2_avalanche_c_flashloans.sql | 4 - .../flashloans}/balancer_flashloans.sql | 11 +- .../balancer/flashloans/base/_schema.yml | 36 + .../base/balancer_v2_base_flashloans.sql | 4 - .../balancer/flashloans/ethereum/_schema.yml | 36 + .../balancer_v2_ethereum_flashloans.sql | 4 - .../balancer/flashloans/gnosis/_schema.yml | 36 + .../gnosis/balancer_v2_gnosis_flashloans.sql | 4 - .../balancer/flashloans/optimism/_schema.yml | 36 + .../balancer_v2_optimism_flashloans.sql | 4 - .../balancer/flashloans/polygon/_schema.yml | 36 + .../balancer_v2_polygon_flashloans.sql | 4 - .../balancer/flashloans/zkevm/_schema.yml | 36 + .../zkevm/balancer_v2_zkevm_flashloans.sql | 4 - .../_project/balancer/liquidity/_schema.yml | 60 ++ .../balancer/liquidity/arbitrum/_schema.yml | 58 ++ .../balancer_v2_arbitrum_liquidity.sql | 6 +- .../liquidity/avalanche_c/_schema.yml | 58 ++ .../balancer_v2_avalanche_c_liquidity.sql | 6 +- .../liquidity}/balancer_liquidity.sql | 9 +- .../balancer/liquidity/base/_schema.yml | 58 ++ .../base/balancer_v2_base_liquidity.sql | 6 +- .../balancer/liquidity/ethereum/_schema.yml | 96 +++ .../balancer_v1_ethereum_liquidity.sql | 6 +- .../balancer_v2_ethereum_liquidity.sql | 6 +- .../balancer/liquidity/gnosis/_schema.yml | 58 ++ .../gnosis/balancer_v2_gnosis_liquidity.sql | 6 +- .../balancer/liquidity/optimism/_schema.yml | 58 ++ .../balancer_v2_optimism_liquidity.sql | 6 +- .../balancer/liquidity/polygon/_schema.yml | 58 ++ .../polygon/balancer_v2_polygon_liquidity.sql | 6 +- .../balancer/liquidity/zkevm/_schema.yml | 58 ++ .../zkevm/balancer_v2_zkevm_liquidity.sql | 6 +- models/_project/balancer/pools/_schema.yml | 173 +++++ .../balancer/pools/arbitrum/_schema.yml | 105 +++ ...balancer_arbitrum_pools_tokens_weights.sql | 0 .../balancer_v2_arbitrum_pools_fees.sql | 11 +- ...ancer_v2_arbitrum_pools_tokens_weights.sql | 1 - .../balancer/pools/avalanche_c/_schema.yml | 105 +++ ...ancer_avalanche_c_pools_tokens_weights.sql | 0 .../balancer_v2_avalanche_c_pools_fees.sql | 9 +- ...er_v2_avalanche_c_pools_tokens_weights.sql | 1 - .../pools}/balancer_gauge_mappings.sql | 7 +- .../balancer/pools}/balancer_pools_fees.sql | 9 +- .../pools}/balancer_pools_metrics_daily.sql | 0 .../pools}/balancer_pools_tokens_weights.sql | 8 +- .../_project/balancer/pools/base/_schema.yml | 105 +++ .../balancer_base_pools_tokens_weights.sql | 0 .../base/balancer_v2_base_pools_fees.sql | 9 +- .../balancer_v2_base_pools_tokens_weights.sql | 1 - .../balancer/pools/ethereum/_schema.yml | 149 ++++ ...balancer_ethereum_pools_tokens_weights.sql | 0 ...ancer_v1_ethereum_pools_tokens_weights.sql | 7 +- .../ethereum/balancer_v2_ethereum_lbps.sql | 0 .../balancer_v2_ethereum_pools_fees.sql | 7 +- ...ancer_v2_ethereum_pools_tokens_weights.sql | 1 - .../balancer/pools/gnosis/_schema.yml | 105 +++ .../balancer_gnosis_pools_tokens_weights.sql | 0 .../gnosis/balancer_v2_gnosis_pools_fees.sql | 9 +- ...alancer_v2_gnosis_pools_tokens_weights.sql | 1 - .../balancer/pools/optimism/_schema.yml | 146 ++++ .../balancer_optimism_gauge_mappings.sql | 7 +- ...balancer_optimism_pools_tokens_weights.sql | 3 +- .../balancer_v2_optimism_pools_fees.sql | 9 +- ...ancer_v2_optimism_pools_tokens_weights.sql | 1 - .../balancer/pools/polygon/_schema.yml | 128 ++++ .../balancer_polygon_pools_tokens_weights.sql | 0 .../polygon/balancer_v2_polygon_lbps.sql | 0 .../balancer_v2_polygon_pools_fees.sql | 9 +- ...lancer_v2_polygon_pools_tokens_weights.sql | 1 - .../_project/balancer/pools/zkevm/_schema.yml | 105 +++ .../zkevm/balancer_v2_zkevm_pools_fees.sql | 6 +- ...balancer_v2_zkevm_pools_tokens_weights.sql | 0 .../balancer_zkevm_pools_tokens_weights.sql | 0 .../balancer/protocol_fee/_schema.yml | 61 ++ .../protocol_fee/arbitrum/_schema.yml | 61 ++ .../balancer_v2_arbitrum_protocol_fee.sql | 0 .../protocol_fee/avalanche_c/_schema.yml | 61 ++ .../balancer_v2_avalanche_c_protocol_fee.sql | 0 .../protocol_fee}/balancer_protocol_fee.sql | 8 +- .../balancer/protocol_fee/base/_schema.yml | 61 ++ .../base/balancer_v2_base_protocol_fee.sql | 0 .../protocol_fee/ethereum/_schema.yml | 61 ++ .../balancer_v2_ethereum_protocol_fee.sql | 0 .../balancer/protocol_fee/gnosis/_schema.yml | 61 ++ .../balancer_v2_gnosis_protocol_fee.sql | 0 .../protocol_fee/optimism/_schema.yml | 61 ++ .../balancer_v2_optimism_protocol_fee.sql | 0 .../balancer/protocol_fee/polygon/_schema.yml | 61 ++ .../balancer_v2_polygon_protocol_fee.sql | 0 .../balancer/protocol_fee/zkevm/_schema.yml | 61 ++ .../zkevm/balancer_v2_zkevm_protocol_fee.sql | 0 models/_project/balancer/support/_schema.yml | 56 ++ .../balancer_single_recipient_gauges.sql | 0 .../support}/balancer_token_whitelist.sql | 0 .../balancer/trades/arbitrum/_schema.yml | 149 ++++ .../arbitrum/balancer_arbitrum_trades.sql | 0 .../arbitrum/balancer_v2_arbitrum_trades.sql | 6 +- .../balancer/trades/avalanche_c/_schema.yml | 149 ++++ .../balancer_avalanche_c_trades.sql | 0 .../balancer_v2_avalanche_c_trades.sql | 8 +- .../balancer/{ => trades}/balancer_trades.sql | 0 .../_project/balancer/trades/base/_schema.yml | 149 ++++ .../trades}/base/balancer_base_trades.sql | 0 .../trades}/base/balancer_v2_base_trades.sql | 6 +- .../balancer/trades/ethereum/_schema.yml | 145 ++++ .../ethereum/balancer_ethereum_trades.sql | 0 .../ethereum/balancer_v1_ethereum_trades.sql | 0 .../ethereum/balancer_v2_ethereum_trades.sql | 6 +- .../balancer/trades/gnosis/_schema.yml | 149 ++++ .../trades}/gnosis/balancer_gnosis_trades.sql | 0 .../gnosis/balancer_v2_gnosis_trades.sql | 6 +- .../balancer/trades/optimism/_schema.yml | 149 ++++ .../optimism/balancer_optimism_trades.sql | 0 .../optimism/balancer_v2_optimism_trades.sql | 6 +- .../balancer/trades/polygon/_schema.yml | 149 ++++ .../polygon/balancer_polygon_trades.sql | 0 .../polygon/balancer_v2_polygon_trades.sql | 6 +- .../balancer/trades/zkevm/_schema.yml | 110 +++ .../zkevm/balancer_v2_zkevm_trades.sql | 6 +- .../trades}/zkevm/balancer_zkevm_trades.sql | 0 .../balancer/vebal/ethereum/_schema.yml | 91 +++ .../balancer_ethereum_vebal_balances_day.sql | 7 +- .../balancer_ethereum_vebal_slopes.sql | 9 +- .../balancer_ethereum_vebal_votes.sql | 8 +- .../arbitrum/balancer_arbitrum_schema.yml | 432 ------------ .../balancer_avalanche_c_schema.yml | 405 ----------- models/balancer/balancer_schema.yml | 365 ---------- models/balancer/base/balancer_base_schema.yml | 405 ----------- .../ethereum/balancer_ethereum_schema.yml | 665 ------------------ .../gnosis/balancer_gnosis_schema.yml | 404 ----------- .../optimism/balancer_optimism_schema.yml | 464 ------------ .../polygon/balancer_polygon_schema.yml | 454 ------------ .../balancer/zkevm/balancer_zkevm_schema.yml | 431 ------------ 226 files changed, 7748 insertions(+), 4295 deletions(-) create mode 100644 macros/models/_project/balancer/balancer_pool_token_supply_changes_daily_agg_macro.sql create mode 100644 macros/models/_project/balancer/balancer_pool_token_supply_changes_macro.sql create mode 100644 macros/models/_project/balancer/balancer_token_balance_changes_daily_agg_macro.sql create mode 100644 macros/models/_project/balancer/balancer_token_balance_changes_macro.sql create mode 100644 models/_project/balancer/balances/_schema.yml create mode 100644 models/_project/balancer/balances/arbitrum/_schema.yml create mode 100644 models/_project/balancer/balances/arbitrum/balancer_v2_arbitrum_token_balance_changes.sql create mode 100644 models/_project/balancer/balances/arbitrum/balancer_v2_arbitrum_token_balance_changes_daily.sql create mode 100644 models/_project/balancer/balances/avalanche_c/_schema.yml create mode 100644 models/_project/balancer/balances/avalanche_c/balancer_v2_avalanche_c_token_balance_changes.sql create mode 100644 models/_project/balancer/balances/avalanche_c/balancer_v2_avalanche_c_token_balance_changes_daily.sql create mode 100644 models/_project/balancer/balances/balancer_token_balance_changes.sql create mode 100644 models/_project/balancer/balances/balancer_token_balance_changes_daily.sql create mode 100644 models/_project/balancer/balances/base/_schema.yml create mode 100644 models/_project/balancer/balances/base/balancer_v2_base_token_balance_changes.sql create mode 100644 models/_project/balancer/balances/base/balancer_v2_base_token_balance_changes_daily.sql create mode 100644 models/_project/balancer/balances/ethereum/_schema.yml rename models/{balancer => _project/balancer/balances}/ethereum/balancer_ethereum_balances.sql (88%) create mode 100644 models/_project/balancer/balances/ethereum/balancer_v2_ethereum_token_balance_changes.sql create mode 100644 models/_project/balancer/balances/ethereum/balancer_v2_ethereum_token_balance_changes_daily.sql create mode 100644 models/_project/balancer/balances/gnosis/_schema.yml create mode 100644 models/_project/balancer/balances/gnosis/balancer_v2_gnosis_token_balance_changes.sql create mode 100644 models/_project/balancer/balances/gnosis/balancer_v2_gnosis_token_balance_changes_daily.sql create mode 100644 models/_project/balancer/balances/optimism/_schema.yml create mode 100644 models/_project/balancer/balances/optimism/balancer_v2_optimism_token_balance_changes.sql create mode 100644 models/_project/balancer/balances/optimism/balancer_v2_optimism_token_balance_changes_daily.sql create mode 100644 models/_project/balancer/balances/polygon/_schema.yml create mode 100644 models/_project/balancer/balances/polygon/balancer_v2_polygon_token_balance_changes.sql create mode 100644 models/_project/balancer/balances/polygon/balancer_v2_polygon_token_balance_changes_daily.sql create mode 100644 models/_project/balancer/balances/zkevm/_schema.yml create mode 100644 models/_project/balancer/balances/zkevm/balancer_v2_zkevm_token_balance_changes.sql create mode 100644 models/_project/balancer/balances/zkevm/balancer_v2_zkevm_token_balance_changes_daily.sql create mode 100644 models/_project/balancer/bpt/_schema.yml create mode 100644 models/_project/balancer/bpt/arbitrum/_schema.yml rename models/{balancer => _project/balancer/bpt}/arbitrum/balancer_v2_arbitrum_bpt_prices.sql (100%) rename models/{balancer => _project/balancer/bpt}/arbitrum/balancer_v2_arbitrum_bpt_supply.sql (100%) create mode 100644 models/_project/balancer/bpt/arbitrum/balancer_v2_arbitrum_bpt_supply_changes.sql create mode 100644 models/_project/balancer/bpt/arbitrum/balancer_v2_arbitrum_bpt_supply_changes_daily.sql rename models/{balancer => _project/balancer/bpt}/arbitrum/balancer_v2_arbitrum_transfers_bpt.sql (100%) create mode 100644 models/_project/balancer/bpt/avalanche_c/_schema.yml rename models/{balancer => _project/balancer/bpt}/avalanche_c/balancer_v2_avalanche_c_bpt_prices.sql (100%) rename models/{balancer => _project/balancer/bpt}/avalanche_c/balancer_v2_avalanche_c_bpt_supply.sql (100%) create mode 100644 models/_project/balancer/bpt/avalanche_c/balancer_v2_avalanche_c_bpt_supply_changes.sql create mode 100644 models/_project/balancer/bpt/avalanche_c/balancer_v2_avalanche_c_bpt_supply_changes_daily.sql rename models/{balancer => _project/balancer/bpt}/avalanche_c/balancer_v2_avalanche_c_transfers_bpt.sql (100%) rename models/{balancer => _project/balancer/bpt}/balancer_bpt_prices.sql (69%) rename models/{balancer => _project/balancer/bpt}/balancer_bpt_supply.sql (68%) create mode 100644 models/_project/balancer/bpt/balancer_bpt_supply_changes.sql create mode 100644 models/_project/balancer/bpt/balancer_bpt_supply_changes_daily.sql rename models/{balancer => _project/balancer/bpt}/balancer_transfers_bpt.sql (70%) create mode 100644 models/_project/balancer/bpt/base/_schema.yml rename models/{balancer => _project/balancer/bpt}/base/balancer_v2_base_bpt_prices.sql (100%) rename models/{balancer => _project/balancer/bpt}/base/balancer_v2_base_bpt_supply.sql (100%) create mode 100644 models/_project/balancer/bpt/base/balancer_v2_base_bpt_supply_changes.sql create mode 100644 models/_project/balancer/bpt/base/balancer_v2_base_bpt_supply_changes_daily.sql rename models/{balancer => _project/balancer/bpt}/base/balancer_v2_base_transfers_bpt.sql (100%) create mode 100644 models/_project/balancer/bpt/ethereum/_schema.yml rename models/{balancer => _project/balancer/bpt}/ethereum/balancer_v2_ethereum_bpt_prices.sql (100%) rename models/{balancer => _project/balancer/bpt}/ethereum/balancer_v2_ethereum_bpt_supply.sql (100%) create mode 100644 models/_project/balancer/bpt/ethereum/balancer_v2_ethereum_bpt_supply_changes.sql create mode 100644 models/_project/balancer/bpt/ethereum/balancer_v2_ethereum_bpt_supply_changes_daily.sql rename models/{balancer => _project/balancer/bpt}/ethereum/balancer_v2_ethereum_transfers_bpt.sql (100%) create mode 100644 models/_project/balancer/bpt/gnosis/_schema.yml rename models/{balancer => _project/balancer/bpt}/gnosis/balancer_v2_gnosis_bpt_prices.sql (100%) rename models/{balancer => _project/balancer/bpt}/gnosis/balancer_v2_gnosis_bpt_supply.sql (100%) create mode 100644 models/_project/balancer/bpt/gnosis/balancer_v2_gnosis_bpt_supply_changes.sql create mode 100644 models/_project/balancer/bpt/gnosis/balancer_v2_gnosis_bpt_supply_changes_daily.sql rename models/{balancer => _project/balancer/bpt}/gnosis/balancer_v2_gnosis_transfers_bpt.sql (100%) create mode 100644 models/_project/balancer/bpt/optimism/_schema.yml rename models/{balancer => _project/balancer/bpt}/optimism/balancer_v2_optimism_bpt_prices.sql (100%) rename models/{balancer => _project/balancer/bpt}/optimism/balancer_v2_optimism_bpt_supply.sql (100%) create mode 100644 models/_project/balancer/bpt/optimism/balancer_v2_optimism_bpt_supply_changes.sql create mode 100644 models/_project/balancer/bpt/optimism/balancer_v2_optimism_bpt_supply_changes_daily.sql rename models/{balancer => _project/balancer/bpt}/optimism/balancer_v2_optimism_transfers_bpt.sql (100%) create mode 100644 models/_project/balancer/bpt/polygon/_schema.yml rename models/{balancer => _project/balancer/bpt}/polygon/balancer_v2_polygon_bpt_prices.sql (100%) rename models/{balancer => _project/balancer/bpt}/polygon/balancer_v2_polygon_bpt_supply.sql (100%) create mode 100644 models/_project/balancer/bpt/polygon/balancer_v2_polygon_bpt_supply_changes.sql create mode 100644 models/_project/balancer/bpt/polygon/balancer_v2_polygon_bpt_supply_changes_daily.sql rename models/{balancer => _project/balancer/bpt}/polygon/balancer_v2_polygon_transfers_bpt.sql (100%) create mode 100644 models/_project/balancer/bpt/zkevm/_schema.yml rename models/{balancer => _project/balancer/bpt}/zkevm/balancer_v2_zkevm_bpt_prices.sql (100%) rename models/{balancer => _project/balancer/bpt}/zkevm/balancer_v2_zkevm_bpt_supply.sql (100%) create mode 100644 models/_project/balancer/bpt/zkevm/balancer_v2_zkevm_bpt_supply_changes.sql create mode 100644 models/_project/balancer/bpt/zkevm/balancer_v2_zkevm_bpt_supply_changes_daily.sql rename models/{balancer => _project/balancer/bpt}/zkevm/balancer_v2_zkevm_transfers_bpt.sql (100%) create mode 100644 models/_project/balancer/flashloans/_schema.yml create mode 100644 models/_project/balancer/flashloans/arbitrum/_schema.yml rename models/{balancer => _project/balancer/flashloans}/arbitrum/balancer_v2_arbitrum_flashloans.sql (88%) create mode 100644 models/_project/balancer/flashloans/avalanche_c/_schema.yml rename models/{balancer => _project/balancer/flashloans}/avalanche_c/balancer_v2_avalanche_c_flashloans.sql (88%) rename models/{balancer => _project/balancer/flashloans}/balancer_flashloans.sql (69%) create mode 100644 models/_project/balancer/flashloans/base/_schema.yml rename models/{balancer => _project/balancer/flashloans}/base/balancer_v2_base_flashloans.sql (88%) create mode 100644 models/_project/balancer/flashloans/ethereum/_schema.yml rename models/{balancer => _project/balancer/flashloans}/ethereum/balancer_v2_ethereum_flashloans.sql (88%) create mode 100644 models/_project/balancer/flashloans/gnosis/_schema.yml rename models/{balancer => _project/balancer/flashloans}/gnosis/balancer_v2_gnosis_flashloans.sql (88%) create mode 100644 models/_project/balancer/flashloans/optimism/_schema.yml rename models/{balancer => _project/balancer/flashloans}/optimism/balancer_v2_optimism_flashloans.sql (88%) create mode 100644 models/_project/balancer/flashloans/polygon/_schema.yml rename models/{balancer => _project/balancer/flashloans}/polygon/balancer_v2_polygon_flashloans.sql (88%) create mode 100644 models/_project/balancer/flashloans/zkevm/_schema.yml rename models/{balancer => _project/balancer/flashloans}/zkevm/balancer_v2_zkevm_flashloans.sql (88%) create mode 100644 models/_project/balancer/liquidity/_schema.yml create mode 100644 models/_project/balancer/liquidity/arbitrum/_schema.yml rename models/{balancer => _project/balancer/liquidity}/arbitrum/balancer_v2_arbitrum_liquidity.sql (52%) create mode 100644 models/_project/balancer/liquidity/avalanche_c/_schema.yml rename models/{balancer => _project/balancer/liquidity}/avalanche_c/balancer_v2_avalanche_c_liquidity.sql (53%) rename models/{balancer => _project/balancer/liquidity}/balancer_liquidity.sql (74%) create mode 100644 models/_project/balancer/liquidity/base/_schema.yml rename models/{balancer => _project/balancer/liquidity}/base/balancer_v2_base_liquidity.sql (51%) create mode 100644 models/_project/balancer/liquidity/ethereum/_schema.yml rename models/{balancer => _project/balancer/liquidity}/ethereum/balancer_v1_ethereum_liquidity.sql (92%) rename models/{balancer => _project/balancer/liquidity}/ethereum/balancer_v2_ethereum_liquidity.sql (52%) create mode 100644 models/_project/balancer/liquidity/gnosis/_schema.yml rename models/{balancer => _project/balancer/liquidity}/gnosis/balancer_v2_gnosis_liquidity.sql (51%) create mode 100644 models/_project/balancer/liquidity/optimism/_schema.yml rename models/{balancer => _project/balancer/liquidity}/optimism/balancer_v2_optimism_liquidity.sql (52%) create mode 100644 models/_project/balancer/liquidity/polygon/_schema.yml rename models/{balancer => _project/balancer/liquidity}/polygon/balancer_v2_polygon_liquidity.sql (52%) create mode 100644 models/_project/balancer/liquidity/zkevm/_schema.yml rename models/{balancer => _project/balancer/liquidity}/zkevm/balancer_v2_zkevm_liquidity.sql (51%) create mode 100644 models/_project/balancer/pools/_schema.yml create mode 100644 models/_project/balancer/pools/arbitrum/_schema.yml rename models/{balancer => _project/balancer/pools}/arbitrum/balancer_arbitrum_pools_tokens_weights.sql (100%) rename models/{balancer => _project/balancer/pools}/arbitrum/balancer_v2_arbitrum_pools_fees.sql (75%) rename models/{balancer => _project/balancer/pools}/arbitrum/balancer_v2_arbitrum_pools_tokens_weights.sql (99%) create mode 100644 models/_project/balancer/pools/avalanche_c/_schema.yml rename models/{balancer => _project/balancer/pools}/avalanche_c/balancer_avalanche_c_pools_tokens_weights.sql (100%) rename models/{balancer => _project/balancer/pools}/avalanche_c/balancer_v2_avalanche_c_pools_fees.sql (77%) rename models/{balancer => _project/balancer/pools}/avalanche_c/balancer_v2_avalanche_c_pools_tokens_weights.sql (99%) rename models/{balancer => _project/balancer/pools}/balancer_gauge_mappings.sql (78%) rename models/{balancer => _project/balancer/pools}/balancer_pools_fees.sql (69%) rename models/{balancer => _project/balancer/pools}/balancer_pools_metrics_daily.sql (100%) rename models/{balancer => _project/balancer/pools}/balancer_pools_tokens_weights.sql (71%) create mode 100644 models/_project/balancer/pools/base/_schema.yml rename models/{balancer => _project/balancer/pools}/base/balancer_base_pools_tokens_weights.sql (100%) rename models/{balancer => _project/balancer/pools}/base/balancer_v2_base_pools_fees.sql (77%) rename models/{balancer => _project/balancer/pools}/base/balancer_v2_base_pools_tokens_weights.sql (99%) create mode 100644 models/_project/balancer/pools/ethereum/_schema.yml rename models/{balancer => _project/balancer/pools}/ethereum/balancer_ethereum_pools_tokens_weights.sql (100%) rename models/{balancer => _project/balancer/pools}/ethereum/balancer_v1_ethereum_pools_tokens_weights.sql (93%) rename models/{balancer => _project/balancer/pools}/ethereum/balancer_v2_ethereum_lbps.sql (100%) rename models/{balancer => _project/balancer/pools}/ethereum/balancer_v2_ethereum_pools_fees.sql (78%) rename models/{balancer => _project/balancer/pools}/ethereum/balancer_v2_ethereum_pools_tokens_weights.sql (99%) create mode 100644 models/_project/balancer/pools/gnosis/_schema.yml rename models/{balancer => _project/balancer/pools}/gnosis/balancer_gnosis_pools_tokens_weights.sql (100%) rename models/{balancer => _project/balancer/pools}/gnosis/balancer_v2_gnosis_pools_fees.sql (77%) rename models/{balancer => _project/balancer/pools}/gnosis/balancer_v2_gnosis_pools_tokens_weights.sql (99%) create mode 100644 models/_project/balancer/pools/optimism/_schema.yml rename models/{balancer => _project/balancer/pools}/optimism/balancer_optimism_gauge_mappings.sql (87%) rename models/{balancer => _project/balancer/pools}/optimism/balancer_optimism_pools_tokens_weights.sql (86%) rename models/{balancer => _project/balancer/pools}/optimism/balancer_v2_optimism_pools_fees.sql (77%) rename models/{balancer => _project/balancer/pools}/optimism/balancer_v2_optimism_pools_tokens_weights.sql (99%) create mode 100644 models/_project/balancer/pools/polygon/_schema.yml rename models/{balancer => _project/balancer/pools}/polygon/balancer_polygon_pools_tokens_weights.sql (100%) rename models/{balancer => _project/balancer/pools}/polygon/balancer_v2_polygon_lbps.sql (100%) rename models/{balancer => _project/balancer/pools}/polygon/balancer_v2_polygon_pools_fees.sql (77%) rename models/{balancer => _project/balancer/pools}/polygon/balancer_v2_polygon_pools_tokens_weights.sql (99%) create mode 100644 models/_project/balancer/pools/zkevm/_schema.yml rename models/{balancer => _project/balancer/pools}/zkevm/balancer_v2_zkevm_pools_fees.sql (82%) rename models/{balancer => _project/balancer/pools}/zkevm/balancer_v2_zkevm_pools_tokens_weights.sql (100%) rename models/{balancer => _project/balancer/pools}/zkevm/balancer_zkevm_pools_tokens_weights.sql (100%) create mode 100644 models/_project/balancer/protocol_fee/_schema.yml create mode 100644 models/_project/balancer/protocol_fee/arbitrum/_schema.yml rename models/{balancer => _project/balancer/protocol_fee}/arbitrum/balancer_v2_arbitrum_protocol_fee.sql (100%) create mode 100644 models/_project/balancer/protocol_fee/avalanche_c/_schema.yml rename models/{balancer => _project/balancer/protocol_fee}/avalanche_c/balancer_v2_avalanche_c_protocol_fee.sql (100%) rename models/{balancer => _project/balancer/protocol_fee}/balancer_protocol_fee.sql (75%) create mode 100644 models/_project/balancer/protocol_fee/base/_schema.yml rename models/{balancer => _project/balancer/protocol_fee}/base/balancer_v2_base_protocol_fee.sql (100%) create mode 100644 models/_project/balancer/protocol_fee/ethereum/_schema.yml rename models/{balancer => _project/balancer/protocol_fee}/ethereum/balancer_v2_ethereum_protocol_fee.sql (100%) create mode 100644 models/_project/balancer/protocol_fee/gnosis/_schema.yml rename models/{balancer => _project/balancer/protocol_fee}/gnosis/balancer_v2_gnosis_protocol_fee.sql (100%) create mode 100644 models/_project/balancer/protocol_fee/optimism/_schema.yml rename models/{balancer => _project/balancer/protocol_fee}/optimism/balancer_v2_optimism_protocol_fee.sql (100%) create mode 100644 models/_project/balancer/protocol_fee/polygon/_schema.yml rename models/{balancer => _project/balancer/protocol_fee}/polygon/balancer_v2_polygon_protocol_fee.sql (100%) create mode 100644 models/_project/balancer/protocol_fee/zkevm/_schema.yml rename models/{balancer => _project/balancer/protocol_fee}/zkevm/balancer_v2_zkevm_protocol_fee.sql (100%) create mode 100644 models/_project/balancer/support/_schema.yml rename models/{balancer => _project/balancer/support}/balancer_single_recipient_gauges.sql (100%) rename models/{balancer => _project/balancer/support}/balancer_token_whitelist.sql (100%) create mode 100644 models/_project/balancer/trades/arbitrum/_schema.yml rename models/{balancer => _project/balancer/trades}/arbitrum/balancer_arbitrum_trades.sql (100%) rename models/{balancer => _project/balancer/trades}/arbitrum/balancer_v2_arbitrum_trades.sql (94%) create mode 100644 models/_project/balancer/trades/avalanche_c/_schema.yml rename models/{balancer => _project/balancer/trades}/avalanche_c/balancer_avalanche_c_trades.sql (100%) rename models/{balancer => _project/balancer/trades}/avalanche_c/balancer_v2_avalanche_c_trades.sql (94%) rename models/_project/balancer/{ => trades}/balancer_trades.sql (100%) create mode 100644 models/_project/balancer/trades/base/_schema.yml rename models/{balancer => _project/balancer/trades}/base/balancer_base_trades.sql (100%) rename models/{balancer => _project/balancer/trades}/base/balancer_v2_base_trades.sql (94%) create mode 100644 models/_project/balancer/trades/ethereum/_schema.yml rename models/{balancer => _project/balancer/trades}/ethereum/balancer_ethereum_trades.sql (100%) rename models/{balancer => _project/balancer/trades}/ethereum/balancer_v1_ethereum_trades.sql (100%) rename models/{balancer => _project/balancer/trades}/ethereum/balancer_v2_ethereum_trades.sql (94%) create mode 100644 models/_project/balancer/trades/gnosis/_schema.yml rename models/{balancer => _project/balancer/trades}/gnosis/balancer_gnosis_trades.sql (100%) rename models/{balancer => _project/balancer/trades}/gnosis/balancer_v2_gnosis_trades.sql (94%) create mode 100644 models/_project/balancer/trades/optimism/_schema.yml rename models/{balancer => _project/balancer/trades}/optimism/balancer_optimism_trades.sql (100%) rename models/{balancer => _project/balancer/trades}/optimism/balancer_v2_optimism_trades.sql (94%) create mode 100644 models/_project/balancer/trades/polygon/_schema.yml rename models/{balancer => _project/balancer/trades}/polygon/balancer_polygon_trades.sql (100%) rename models/{balancer => _project/balancer/trades}/polygon/balancer_v2_polygon_trades.sql (94%) create mode 100644 models/_project/balancer/trades/zkevm/_schema.yml rename models/{balancer => _project/balancer/trades}/zkevm/balancer_v2_zkevm_trades.sql (94%) rename models/{balancer => _project/balancer/trades}/zkevm/balancer_zkevm_trades.sql (100%) create mode 100644 models/_project/balancer/vebal/ethereum/_schema.yml rename models/{balancer => _project/balancer/vebal}/ethereum/balancer_ethereum_vebal_balances_day.sql (94%) rename models/{balancer => _project/balancer/vebal}/ethereum/balancer_ethereum_vebal_slopes.sql (93%) rename models/{balancer => _project/balancer/vebal}/ethereum/balancer_ethereum_vebal_votes.sql (92%) delete mode 100644 models/balancer/arbitrum/balancer_arbitrum_schema.yml delete mode 100644 models/balancer/avalanche_c/balancer_avalanche_c_schema.yml delete mode 100644 models/balancer/balancer_schema.yml delete mode 100644 models/balancer/base/balancer_base_schema.yml delete mode 100644 models/balancer/ethereum/balancer_ethereum_schema.yml delete mode 100644 models/balancer/gnosis/balancer_gnosis_schema.yml delete mode 100644 models/balancer/optimism/balancer_optimism_schema.yml delete mode 100644 models/balancer/polygon/balancer_polygon_schema.yml delete mode 100644 models/balancer/zkevm/balancer_zkevm_schema.yml diff --git a/dbt_project.yml b/dbt_project.yml index e78dd134444..a3617d0357f 100644 --- a/dbt_project.yml +++ b/dbt_project.yml @@ -71,19 +71,6 @@ models: optimism: +schema: aave_optimism - balancer: - +schema: balancer - arbitrum: - +schema: balancer_arbitrum - ethereum: - +schema: balancer_ethereum - polygon: - +schema: balancer_polygon - optimism: - +schema: balancer_optimism - gnosis: - +schema: balancer_gnosis - ens: +schema: ens ethereum: diff --git a/macros/models/_project/balancer/balancer_bpt_supply_macro.sql b/macros/models/_project/balancer/balancer_bpt_supply_macro.sql index 60cf5a6e4bc..1b1dab0a80a 100644 --- a/macros/models/_project/balancer/balancer_bpt_supply_macro.sql +++ b/macros/models/_project/balancer/balancer_bpt_supply_macro.sql @@ -79,12 +79,12 @@ WITH pool_labels AS ( joins AS ( SELECT DATE_TRUNC('day', evt_block_time) AS block_date, - tokenOut AS token, + tokenOut, pool_type, CASE WHEN pool_type IN ('weighted') THEN 0 ELSE SUM(amountOut / POWER(10, 18)) - END AS amount + END AS ajoins FROM {{ source('balancer_v2_' + blockchain, 'Vault_evt_Swap') }} LEFT JOIN pool_labels ON BYTEARRAY_SUBSTRING(poolId, 1, 20) = address WHERE tokenOut = BYTEARRAY_SUBSTRING(poolId, 1, 20) @@ -94,37 +94,25 @@ WITH pool_labels AS ( exits AS ( SELECT DATE_TRUNC('day', evt_block_time) AS block_date, - tokenIn AS token, + tokenIn, pool_type, CASE WHEN pool_type IN ('weighted') THEN 0 - ELSE SUM( -amountIn / POWER(10, 18)) - END AS amount + ELSE SUM(amountIn / POWER(10, 18)) + END AS aexits FROM {{ source('balancer_v2_' + blockchain, 'Vault_evt_Swap') }} LEFT JOIN pool_labels ON BYTEARRAY_SUBSTRING(poolId, 1, 20) = address WHERE tokenIn = BYTEARRAY_SUBSTRING(poolId, 1, 20) GROUP BY 1, 2, 3 ), - joins_and_exits_1 AS ( - SELECT - * - FROM joins - - UNION ALL - - SELECT - * - FROM exits - ), - joins_and_exits AS ( SELECT - block_date, - token AS bpt, - LEAD(block_date, 1, NOW()) OVER (PARTITION BY token ORDER BY block_date) AS day_of_next_change, - SUM(amount) OVER (PARTITION BY token ORDER BY block_date ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW) AS adelta - FROM joins_and_exits_1 + j.block_date, + j.tokenOut AS bpt, + SUM(COALESCE(ajoins, 0) - COALESCE(aexits, 0)) OVER (PARTITION BY j.tokenOut ORDER BY j.block_date ASC) AS adelta + FROM joins j + FULL OUTER JOIN exits e ON j.block_date = e.block_date AND e.tokenIn = j.tokenOut ), calendar AS ( @@ -142,7 +130,7 @@ WITH pool_labels AS ( COALESCE(SUM(b.supply - COALESCE(preminted_bpts, 0) + COALESCE(adelta, 0)),0) AS supply FROM calendar c LEFT JOIN balances b ON b.day <= c.day AND c.day < b.day_of_next_change - LEFT JOIN joins_and_exits j ON j.block_date <= c.day AND c.day < j.day_of_next_change AND b.token = j.bpt + LEFT JOIN joins_and_exits j ON c.day = j.block_date AND b.token = j.bpt LEFT JOIN premints p ON b.token = p.bpt LEFT JOIN pool_labels l ON b.token = l.address WHERE l.pool_type IN ('weighted', 'LBP', 'investment', 'stable', 'linear', 'ECLP', 'managed', 'FX') diff --git a/macros/models/_project/balancer/balancer_pool_token_supply_changes_daily_agg_macro.sql b/macros/models/_project/balancer/balancer_pool_token_supply_changes_daily_agg_macro.sql new file mode 100644 index 00000000000..d94bbccf741 --- /dev/null +++ b/macros/models/_project/balancer/balancer_pool_token_supply_changes_daily_agg_macro.sql @@ -0,0 +1,37 @@ +{% macro + bpt_supply_changes_daily_agg_macro( + blockchain, version + ) +%} +WITH + daily_balance AS ( + SELECT + block_date, + blockchain, + pool_type, + pool_symbol, + token_address, + LEAD(block_date, 1, NOW()) OVER (PARTITION BY token_address ORDER BY block_date) AS day_of_next_change, + SUM(delta_amount) AS daily_amount + FROM {{ ref('balancer_bpt_supply_changes') }} + WHERE blockchain = '{{blockchain}}' + GROUP BY 1, 2, 3, 4, 5 + ), + + calendar AS ( + SELECT date_sequence AS day + FROM unnest(sequence(date('2021-04-21'), date(now()), interval '1' day)) as t(date_sequence) + ) + + SELECT + c.day AS block_date, + '{{blockchain}}' as blockchain, + '{{version}}' AS version, + b.pool_type, + b.pool_symbol, + b.token_address, + b.daily_amount AS daily_delta + FROM calendar c + LEFT JOIN daily_balance b ON b.block_date = c.day + WHERE b.token_address IS NOT NULL + {% endmacro %} \ No newline at end of file diff --git a/macros/models/_project/balancer/balancer_pool_token_supply_changes_macro.sql b/macros/models/_project/balancer/balancer_pool_token_supply_changes_macro.sql new file mode 100644 index 00000000000..5b876cca011 --- /dev/null +++ b/macros/models/_project/balancer/balancer_pool_token_supply_changes_macro.sql @@ -0,0 +1,130 @@ +{% macro + bpt_supply_changes_macro( + blockchain, version + ) +%} +WITH pool_labels AS ( + SELECT + address, + name, + pool_type + FROM {{ ref('labels_balancer_v2_pools') }} + WHERE blockchain = '{{blockchain}}' + ), + + -- Extract mints and burns from transfers + transfers AS ( + SELECT + t.evt_block_time, + t.evt_block_number, + t.evt_tx_hash, + t.evt_index, + t.contract_address AS token, + CASE + WHEN t."from" = 0x0000000000000000000000000000000000000000 + THEN 'mint' + WHEN t.to = 0x0000000000000000000000000000000000000000 + THEN 'burn' + END AS label, + l.pool_type, + l.name, + CASE + WHEN t."from" = 0x0000000000000000000000000000000000000000 + THEN value + WHEN t.to = 0x0000000000000000000000000000000000000000 + THEN - value + ELSE 0 + END AS amount + FROM {{ ref('balancer_transfers_bpt') }} t + LEFT JOIN pool_labels l ON t.contract_address = l.address + WHERE t.blockchain = '{{blockchain}}' + AND t.version = '{{version}}' + {% if is_incremental() %} + AND {{ incremental_predicate('t.evt_block_time') }} + {% endif %} + ), + + -- Calculating Joins(mint) and Exits(burn) via Swap + joins AS ( + SELECT + s.evt_block_time, + s.evt_block_number, + s.evt_tx_hash, + s.evt_index, + s.tokenOut AS token, + 'join' AS label, + l.pool_type, + l.name, + CASE WHEN l.pool_type IN ('weighted') + THEN 0 + ELSE s.amountOut + END AS amount + FROM {{ source('balancer_v2_' + blockchain, 'Vault_evt_Swap') }} s + LEFT JOIN pool_labels l ON BYTEARRAY_SUBSTRING(s.poolId, 1, 20) = l.address + WHERE tokenOut = BYTEARRAY_SUBSTRING(s.poolId, 1, 20) + {% if is_incremental() %} + AND {{ incremental_predicate('s. evt_block_time') }} + {% endif %} + + ), + + exits AS ( + SELECT + s.evt_block_time, + s.evt_block_number, + s.evt_tx_hash, + s.evt_index, + s.tokenIn AS token, + 'exit' AS label, + l.pool_type, + l.name, + CASE WHEN l.pool_type IN ('weighted') + THEN 0 + ELSE - s.amountIn + END AS amount + FROM {{ source('balancer_v2_' + blockchain, 'Vault_evt_Swap') }} s + LEFT JOIN pool_labels l ON BYTEARRAY_SUBSTRING(s.poolId, 1, 20) = l.address + WHERE tokenIn = BYTEARRAY_SUBSTRING(s.poolId, 1, 20) + {% if is_incremental() %} + AND {{ incremental_predicate('s. evt_block_time') }} + {% endif %} + ) + + SELECT + date_trunc('day', evt_block_time) AS block_date, + evt_block_time, + evt_block_number, + '{{blockchain}}' AS blockchain, + evt_tx_hash, + evt_index, + pool_type, + name AS pool_symbol, + '{{version}}' AS version, + label, + token AS token_address, + amount AS delta_amount_raw, + amount / POWER (10, 18) AS delta_amount --18 decimals standard for BPTs + FROM + ( + SELECT + * + FROM joins + + UNION ALL + + SELECT + * + FROM exits + + UNION ALL + + SELECT + * + FROM transfers + WHERE label IS NOT NULL + ) + {% if is_incremental() %} + WHERE {{ incremental_predicate('evt_block_time') }} + {% endif %} + + {% endmacro %} \ No newline at end of file diff --git a/macros/models/_project/balancer/balancer_token_balance_changes_daily_agg_macro.sql b/macros/models/_project/balancer/balancer_token_balance_changes_daily_agg_macro.sql new file mode 100644 index 00000000000..7500f5d7e82 --- /dev/null +++ b/macros/models/_project/balancer/balancer_token_balance_changes_daily_agg_macro.sql @@ -0,0 +1,184 @@ +{% macro + balancer_token_balance_changes_daily_agg_macro( + blockchain, version + ) +%} +WITH + prices AS ( + SELECT + date_trunc('day', minute) AS day, + contract_address AS token, + decimals, + AVG(price) AS price + FROM {{ source('prices', 'usd') }} + WHERE blockchain = '{{blockchain}}' + {% if is_incremental() %} + WHERE {{ incremental_predicate('minute') }} + {% endif %} + GROUP BY 1, 2, 3 + ), + + dex_prices_1 AS ( + SELECT + date_trunc('day', HOUR) AS DAY, + contract_address AS token, + approx_percentile(median_price, 0.5) AS price, + sum(sample_size) AS sample_size + FROM {{ ref('dex_prices') }} + {% if is_incremental() %} + WHERE {{ incremental_predicate('hour') }} + {% endif %} + GROUP BY 1, 2 + HAVING sum(sample_size) > 3 + ), + + dex_prices_2 AS( + SELECT + day, + token, + price, + lag(price) OVER(PARTITION BY token ORDER BY day) AS previous_price + FROM dex_prices_1 + ), + + dex_prices AS ( + SELECT + day, + token, + price, + LEAD(DAY, 1, NOW()) OVER (PARTITION BY token ORDER BY DAY) AS day_of_next_change + FROM dex_prices_2 + WHERE (price < previous_price * 1e4 AND price > previous_price / 1e4) + ), + + bpt_prices AS( + SELECT DISTINCT + day, + contract_address AS token, + decimals, + bpt_price + FROM {{ ref('balancer_bpt_prices') }} + WHERE blockchain = '{{blockchain}}' + {% if is_incremental() %} + AND {{ incremental_predicate('day') }} + {% endif %} + AND version = '{{version}}' + ), + + eth_prices AS ( + SELECT + DATE_TRUNC('day', minute) as day, + AVG(price) as eth_price + FROM {{ source('prices', 'usd') }} + WHERE symbol = 'ETH' + {% if is_incremental() %} + WHERE {{ incremental_predicate('minute') }} + {% endif %} + GROUP BY 1 + ), + + gyro_prices AS ( + SELECT + token_address, + decimals, + price + FROM {{ ref('gyroscope_gyro_tokens') }} + WHERE blockchain = '{{blockchain}}' + ), + + daily_balance AS ( + SELECT + block_date, + pool_id, + pool_symbol, + pool_type, + token_address, + token_symbol, + LEAD(block_date, 1, NOW()) OVER (PARTITION BY token_address, pool_id ORDER BY block_date) AS day_of_next_change, + SUM(delta_amount) AS daily_amount + FROM {{ ref('balancer_token_balance_changes') }} + WHERE blockchain = '{{blockchain}}' + GROUP BY 1, 2, 3, 4, 5, 6 + ), + + calendar AS ( + SELECT date_sequence AS day + FROM unnest(sequence(date('2021-04-21'), date(now()), interval '1' day)) as t(date_sequence) + ), + + daily_usd_balance AS ( + SELECT + c.day AS block_date, + '{{blockchain}}"' as blockchain, + b.pool_id, + b.pool_symbol, + b.pool_type, + b.token_address, + b.token_symbol, + daily_amount, + daily_amount * COALESCE(p1.price, p2.price, p3.bpt_price, p4.price, 0) AS daily_amount_usd + FROM calendar c + LEFT JOIN daily_balance b ON b.block_date <= c.day + AND c.day < b.day_of_next_change + LEFT JOIN prices p1 ON p1.day = b.block_date + AND p1.token = b.token_address + LEFT JOIN dex_prices p2 ON p2.day <= c.day + AND c.day < p2.day_of_next_change + AND p2.token = b.token_address + LEFT JOIN bpt_prices p3 ON p3.day = b.block_date + AND p3.token = b.token_address + LEFT JOIN gyro_prices p4 ON p4.token_address = b.token_address + WHERE b.token_address != BYTEARRAY_SUBSTRING(b.pool_id, 1, 20) + ), + + weighted_pool_amount_estimates AS ( + SELECT + b.block_date, + b.pool_id, + q.name, + pool_type, + ROW_NUMBER() OVER (PARTITION BY b.block_date, b.pool_id ORDER BY SUM(b.daily_amount_usd) ASC) AS pricing_count, --to avoid double count in pools with multiple pricing assets + SUM(b.daily_amount_usd) / COALESCE(SUM(w.normalized_weight), 1) AS weighted_daily_amount_usd + FROM daily_usd_balance b + LEFT JOIN {{ ref('balancer_pools_tokens_weights') }} w ON b.pool_id = w.pool_id + AND b.token_address = w.token_address + AND b.daily_amount_usd > 0 + LEFT JOIN {{ ref('balancer_token_whitelist') }} q ON b.token_address = q.address + AND b.blockchain = q.chain + WHERE q.name IS NOT NULL + AND b.pool_type = 'weighted' -- filters for weighted pools with pricing assets + AND w.blockchain = '{{blockchain}}' + AND w.version = '2' + GROUP BY 1, 2, 3, 4 + ), + + weighted_pool_amount_estimates_2 AS( + SELECT e.block_date, + e.pool_id, + SUM(e.weighted_daily_amount_usd) / MAX(e.pricing_count) AS weighted_daily_amount_usd + FROM weighted_pool_amount_estimates e + GROUP BY 1,2 + ) + + SELECT + c.block_date, + c.pool_id, + BYTEARRAY_SUBSTRING(c.pool_id, 1, 20) AS pool_address, + c.pool_symbol, + '2' AS version, + 'ethereum' AS blockchain, + c.pool_type, + c.token_address, + c.token_symbol, + c.daily_amount AS daily_delta, + COALESCE(b.weighted_daily_amount_usd * w.normalized_weight, c.daily_amount_usd) AS daily_delta_usd, + COALESCE(b.weighted_daily_amount_usd * w.normalized_weight, c.daily_amount_usd)/e.eth_price AS daily_delta_eth + FROM daily_usd_balance c + FULL OUTER JOIN weighted_pool_amount_estimates_2 b ON c.block_date = b.block_date + AND c.pool_id = b.pool_id + LEFT JOIN {{ ref('balancer_pools_tokens_weights') }} w ON b.pool_id = w.pool_id + AND w.blockchain = 'ethereum' + AND w.version = '2' + AND w.token_address = c.token_address + LEFT JOIN eth_prices e ON e.day = c.block_date + {% endmacro %} \ No newline at end of file diff --git a/macros/models/_project/balancer/balancer_token_balance_changes_macro.sql b/macros/models/_project/balancer/balancer_token_balance_changes_macro.sql new file mode 100644 index 00000000000..b16c9bf038e --- /dev/null +++ b/macros/models/_project/balancer/balancer_token_balance_changes_macro.sql @@ -0,0 +1,169 @@ +{% macro + balancer_token_balance_changes_macro( + blockchain, version + ) +%} +WITH pool_labels AS ( + SELECT + address AS pool_id, + name AS pool_symbol, + pool_type + FROM {{ ref('labels_balancer_v2_pools') }} + WHERE blockchain = '{{blockchain}}' + ), + + swaps_changes AS ( + SELECT + evt_block_time, + evt_block_number, + evt_tx_hash, + evt_index, + pool_id, + token, + SUM(COALESCE(delta, INT256 '0')) AS delta + FROM + ( + SELECT + evt_block_time, + evt_block_number, + evt_tx_hash, + evt_index, + poolId AS pool_id, + tokenIn AS token, + CAST(amountIn as int256) AS delta + FROM {{ source('balancer_v2_' + blockchain, 'Vault_evt_Swap') }} + {% if is_incremental() %} + WHERE {{ incremental_predicate('evt_block_time') }} + {% endif %} + + UNION ALL + + SELECT + evt_block_time, + evt_block_number, + evt_tx_hash, + evt_index, + poolId AS pool_id, + tokenOut AS token, + -CAST(amountOut AS int256) AS delta + FROM {{ source('balancer_v2_' + blockchain, 'Vault_evt_Swap') }} + {% if is_incremental() %} + WHERE {{ incremental_predicate('evt_block_time') }} + {% endif %} + ) swaps + GROUP BY 1, 2, 3, 4, 5, 6 + ), + + zipped_balance_changes AS ( + SELECT + evt_block_time, + evt_block_number, + evt_tx_hash, + evt_index, + poolId AS pool_id, + t.tokens, + d.deltas, + p.protocolFeeAmounts + FROM {{ source('balancer_v2_' + blockchain, 'Vault_evt_PoolBalanceChanged') }} + CROSS JOIN UNNEST (tokens) WITH ORDINALITY as t(tokens,i) + CROSS JOIN UNNEST (deltas) WITH ORDINALITY as d(deltas,i) + CROSS JOIN UNNEST (protocolFeeAmounts) WITH ORDINALITY as p(protocolFeeAmounts,i) + WHERE t.i = d.i + AND d.i = p.i + {% if is_incremental() %} + AND {{ incremental_predicate('evt_block_time') }} + {% endif %} + ), + + balances_changes AS ( + SELECT + evt_block_time, + evt_block_number, + evt_tx_hash, + evt_index, + pool_id, + tokens AS token, + deltas - CAST(protocolFeeAmounts as int256) AS delta + FROM zipped_balance_changes + ), + + managed_changes AS ( + SELECT + evt_block_time, + evt_block_number, + evt_tx_hash, + evt_index, + poolId AS pool_id, + token, + cashDelta + managedDelta AS delta + FROM {{ source('balancer_v2_' + blockchain, 'Vault_evt_PoolBalanceManaged') }} + {% if is_incremental() %} + WHERE {{ incremental_predicate('evt_block_time') }} + {% endif %} + ) + + + SELECT + date_trunc('day', b.evt_block_time) AS block_date, + b.evt_block_time, + b.evt_block_number, + '{{blockchain}}' AS blockchain, + b.evt_tx_hash, + b.evt_index, + b.pool_id, + BYTEARRAY_SUBSTRING(b.pool_id, 1, 20) AS pool_address, + p.pool_symbol, + p.pool_type, + '{{version}}' AS version, + b.token AS token_address, + t.symbol AS token_symbol, + b.amount AS delta_amount_raw, + CASE WHEN BYTEARRAY_SUBSTRING(b.pool_id, 1, 20) = b.token + THEN amount / POWER (10, 18) --for Balancer Pool Tokens + ELSE amount / POWER (10, COALESCE(t.decimals, 0)) + END AS delta_amount + FROM + ( + SELECT + evt_block_time, + evt_block_number, + evt_tx_hash, + evt_index, + pool_id, + token, + COALESCE(delta, INT256 '0') AS amount + FROM balances_changes + + UNION ALL + + SELECT + evt_block_time, + evt_block_number, + evt_tx_hash, + evt_index, + pool_id, + token, + delta AS amount + FROM + swaps_changes + + UNION ALL + + SELECT + evt_block_time, + evt_block_number, + evt_tx_hash, + evt_index, + pool_id, + token, + CAST(delta AS int256) AS amount + FROM managed_changes + ) b + LEFT JOIN {{ source('tokens', 'erc20') }} t ON t.contract_address = b.token + AND blockchain = '{{blockchain}}' + LEFT JOIN pool_labels p ON p.pool_id = BYTEARRAY_SUBSTRING(b.pool_id, 1, 20) + {% if is_incremental() %} + WHERE {{ incremental_predicate('evt_block_time') }} + {% endif %} + + {% endmacro %} \ No newline at end of file diff --git a/models/_project/balancer/balances/_schema.yml b/models/_project/balancer/balances/_schema.yml new file mode 100644 index 00000000000..9d8b84cf3a1 --- /dev/null +++ b/models/_project/balancer/balances/_schema.yml @@ -0,0 +1,98 @@ +version: 2 + +models: + - name: balancer_token_balance_changes + meta: + blockchain: arbitrum, avalanche_c, base, ethereum, gnosis, optimism, polygon, zkevm + contributors: viniabussafi + config: + tags: ['arbitrum', 'avalanche_c', 'base', 'ethereum', 'gnosis', 'optimism', 'polygon', 'zkevm', 'bpt', 'supply', 'changes'] + description: > + Token Balance Changes on Balancer Pools. + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - block_date + - evt_tx_hash + - evt_index + - token_address + columns: + - &block_date + name: block_date + description: "UTC event block date of each DEX trade" + - &evt_block_time + name: evt_block_time + description: 'Block time of transfer event' + - &evt_block_number + name: evt_block_number + description: 'Block number of transfer event' + - &blockchain + name: blockchain + description: "Blockchain" + - &evt_tx_hash + name: evt_tx_hash + description: 'Transaction hash of transfer event' + - &evt_index + name: evt_index + description: 'Event index' + - &pool_id + name: pool_id + description: "Unique encoded identifier that refers to each pool" + - &pool_address + name: pool_address + description: "Pool address" + - &pool_symbol + name: pool_symbol + description: "Token symbols, followed by their respective weights, if applicable" + - &pool_type + name: pool_type + description: "Pool attributes, determined by the pool's factory" + - &version + name: version + description: "Version of Balancer where the liquidity pool used in transaction is deployed" + - &token_address + name: token_address + description: "Contract address of the token" + - &token_symbol + name: token_symbol + description: "Token symbol" + - &delta_amount_raw + name: delta_amount_raw + description: "Raw value of the transaction at the time of execution in the original currency" + - &delta_amount + name: delta_amount + description: "Normalized value of the transaction at the time of execution in the original currency" + + - name: balancer_token_balance_changes_daily + meta: + blockchain: arbitrum, avalanche_c, base, ethereum, gnosis, optimism, polygon, zkevm + contributors: viniabussafi + config: + tags: ['arbitrum', 'avalanche_c', 'base', 'ethereum', 'gnosis', 'optimism', 'polygon', 'zkevm', 'bpt', 'supply', 'changes'] + description: > + Token Balance Changes on Balancer Pools, grouped by day. + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - block_date + - pool_id + - token_address + columns: + - *block_date + - *pool_id + - *pool_address + - *pool_symbol + - *version + - *blockchain + - *pool_type + - *token_address + - *token_symbol + - &daily_delta + name: daily_delta + description: "Daily total impact on token balance" + - &daily_delta_usd + name: daily_delta_usd + description: "Daily total impact on token balance, in USD" + - &daily_delta_eth + name: daily_delta_eth + description: "Daily total impact on token balance, in eth" \ No newline at end of file diff --git a/models/_project/balancer/balances/arbitrum/_schema.yml b/models/_project/balancer/balances/arbitrum/_schema.yml new file mode 100644 index 00000000000..ff5e07ed5d8 --- /dev/null +++ b/models/_project/balancer/balances/arbitrum/_schema.yml @@ -0,0 +1,100 @@ +version: 2 + +models: + - name: balancer_v2_arbitrum_token_balance_changes + meta: + blockchain: arbitrum + project: balancer_v2 + contributors: viniabussafi + config: + tags: ['arbitrum', 'bpt', 'supply', 'changes'] + description: > + Token Balance Changes on Balancer Pools. + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - block_date + - evt_tx_hash + - evt_index + - token_address + columns: + - &block_date + name: block_date + description: "UTC event block date of each DEX trade" + - &evt_block_time + name: evt_block_time + description: 'Block time of transfer event' + - &evt_block_number + name: evt_block_number + description: 'Block number of transfer event' + - &blockchain + name: blockchain + description: "Blockchain" + - &evt_tx_hash + name: evt_tx_hash + description: 'Transaction hash of transfer event' + - &evt_index + name: evt_index + description: 'Event index' + - &pool_id + name: pool_id + description: "Unique encoded identifier that refers to each pool" + - &pool_address + name: pool_address + description: "Pool address" + - &pool_symbol + name: pool_symbol + description: "Token symbols, followed by their respective weights, if applicable" + - &pool_type + name: pool_type + description: "Pool attributes, determined by the pool's factory" + - &version + name: version + description: "Version of Balancer where the liquidity pool used in transaction is deployed" + - &token_address + name: token_address + description: "Contract address of the token" + - &token_symbol + name: token_symbol + description: "Token symbol" + - &delta_amount_raw + name: delta_amount_raw + description: "Raw value of the transaction at the time of execution in the original currency" + - &delta_amount + name: delta_amount + description: "Normalized value of the transaction at the time of execution in the original currency" + + - name: balancer_v2_arbitrum_token_balance_changes_daily + meta: + blockchain: arbitrum + project: balancer_v2 + contributors: viniabussafi + config: + tags: ['arbitrum', 'bpt', 'supply', 'changes'] + description: > + Token Balance Changes on Balancer Pools, grouped by day. + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - block_date + - pool_id + - token_address + columns: + - *block_date + - *pool_id + - *pool_address + - *pool_symbol + - *version + - *blockchain + - *pool_type + - *token_address + - *token_symbol + - &daily_delta + name: daily_delta + description: "Daily total impact on token balance" + - &daily_delta_usd + name: daily_delta_usd + description: "Daily total impact on token balance, in USD" + - &daily_delta_eth + name: daily_delta_eth + description: "Daily total impact on token balance, in eth" \ No newline at end of file diff --git a/models/_project/balancer/balances/arbitrum/balancer_v2_arbitrum_token_balance_changes.sql b/models/_project/balancer/balances/arbitrum/balancer_v2_arbitrum_token_balance_changes.sql new file mode 100644 index 00000000000..ca58f713377 --- /dev/null +++ b/models/_project/balancer/balances/arbitrum/balancer_v2_arbitrum_token_balance_changes.sql @@ -0,0 +1,16 @@ +{% set blockchain = 'arbitrum' %} + +{{ config( + schema = 'balancer_v2_arbitrum', + alias = 'token_balance_changes', + materialized = 'table', + file_format = 'delta' + ) +}} + +{{ + balancer_token_balance_changes_macro( + blockchain = blockchain, + version = '2' + ) +}} \ No newline at end of file diff --git a/models/_project/balancer/balances/arbitrum/balancer_v2_arbitrum_token_balance_changes_daily.sql b/models/_project/balancer/balances/arbitrum/balancer_v2_arbitrum_token_balance_changes_daily.sql new file mode 100644 index 00000000000..c35d7b60259 --- /dev/null +++ b/models/_project/balancer/balances/arbitrum/balancer_v2_arbitrum_token_balance_changes_daily.sql @@ -0,0 +1,17 @@ +{% set blockchain = 'arbitrum' %} + +{{ + config( + schema = 'balancer_v2_arbitrum', + alias = 'token_balance_changes_daily', + materialized = 'table', + file_format = 'delta' + ) +}} + +{{ + balancer_token_balance_changes_daily_agg_macro( + blockchain = blockchain, + version = '2' + ) +}} \ No newline at end of file diff --git a/models/_project/balancer/balances/avalanche_c/_schema.yml b/models/_project/balancer/balances/avalanche_c/_schema.yml new file mode 100644 index 00000000000..e341729e2fa --- /dev/null +++ b/models/_project/balancer/balances/avalanche_c/_schema.yml @@ -0,0 +1,100 @@ +version: 2 + +models: + - name: balancer_v2_avalanche_c_token_balance_changes + meta: + blockchain: avalanche_c + project: balancer_v2 + contributors: viniabussafi + config: + tags: ['avalanche_c', 'bpt', 'supply', 'changes'] + description: > + Token Balance Changes on Balancer Pools. + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - block_date + - evt_tx_hash + - evt_index + - token_address + columns: + - &block_date + name: block_date + description: "UTC event block date of each DEX trade" + - &evt_block_time + name: evt_block_time + description: 'Block time of transfer event' + - &evt_block_number + name: evt_block_number + description: 'Block number of transfer event' + - &blockchain + name: blockchain + description: "Blockchain" + - &evt_tx_hash + name: evt_tx_hash + description: 'Transaction hash of transfer event' + - &evt_index + name: evt_index + description: 'Event index' + - &pool_id + name: pool_id + description: "Unique encoded identifier that refers to each pool" + - &pool_address + name: pool_address + description: "Pool address" + - &pool_symbol + name: pool_symbol + description: "Token symbols, followed by their respective weights, if applicable" + - &pool_type + name: pool_type + description: "Pool attributes, determined by the pool's factory" + - &version + name: version + description: "Version of Balancer where the liquidity pool used in transaction is deployed" + - &token_address + name: token_address + description: "Contract address of the token" + - &token_symbol + name: token_symbol + description: "Token symbol" + - &delta_amount_raw + name: delta_amount_raw + description: "Raw value of the transaction at the time of execution in the original currency" + - &delta_amount + name: delta_amount + description: "Normalized value of the transaction at the time of execution in the original currency" + + - name: balancer_v2_avalanche_c_token_balance_changes_daily + meta: + blockchain: avalanche_c + project: balancer_v2 + contributors: viniabussafi + config: + tags: ['avalanche_c', 'bpt', 'supply', 'changes'] + description: > + Token Balance Changes on Balancer Pools, grouped by day. + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - block_date + - pool_id + - token_address + columns: + - *block_date + - *pool_id + - *pool_address + - *pool_symbol + - *version + - *blockchain + - *pool_type + - *token_address + - *token_symbol + - &daily_delta + name: daily_delta + description: "Daily total impact on token balance" + - &daily_delta_usd + name: daily_delta_usd + description: "Daily total impact on token balance, in USD" + - &daily_delta_eth + name: daily_delta_eth + description: "Daily total impact on token balance, in eth" \ No newline at end of file diff --git a/models/_project/balancer/balances/avalanche_c/balancer_v2_avalanche_c_token_balance_changes.sql b/models/_project/balancer/balances/avalanche_c/balancer_v2_avalanche_c_token_balance_changes.sql new file mode 100644 index 00000000000..ab55e6e99f1 --- /dev/null +++ b/models/_project/balancer/balances/avalanche_c/balancer_v2_avalanche_c_token_balance_changes.sql @@ -0,0 +1,16 @@ +{% set blockchain = 'avalanche_c' %} + +{{ config( + schema = 'balancer_v2_avalanche_c', + alias = 'token_balance_changes', + materialized = 'table', + file_format = 'delta' + ) +}} + +{{ + balancer_token_balance_changes_macro( + blockchain = blockchain, + version = '2' + ) +}} \ No newline at end of file diff --git a/models/_project/balancer/balances/avalanche_c/balancer_v2_avalanche_c_token_balance_changes_daily.sql b/models/_project/balancer/balances/avalanche_c/balancer_v2_avalanche_c_token_balance_changes_daily.sql new file mode 100644 index 00000000000..35ed123547e --- /dev/null +++ b/models/_project/balancer/balances/avalanche_c/balancer_v2_avalanche_c_token_balance_changes_daily.sql @@ -0,0 +1,17 @@ +{% set blockchain = 'avalanche_c' %} + +{{ + config( + schema = 'balancer_v2_avalanche_c', + alias = 'token_balance_changes_daily', + materialized = 'table', + file_format = 'delta' + ) +}} + +{{ + balancer_token_balance_changes_daily_agg_macro( + blockchain = blockchain, + version = '2' + ) +}} \ No newline at end of file diff --git a/models/_project/balancer/balances/balancer_token_balance_changes.sql b/models/_project/balancer/balances/balancer_token_balance_changes.sql new file mode 100644 index 00000000000..7f531a769f3 --- /dev/null +++ b/models/_project/balancer/balances/balancer_token_balance_changes.sql @@ -0,0 +1,46 @@ +{{ config( + schema = 'balancer', + alias = 'token_balance_changes', + post_hook='{{ expose_spells(blockchains = \'["arbitrum", "avalanche_c", "base", "ethereum", "gnosis", "optimism", "polygon", "zkevm"]\', + spell_type = "project", + spell_name = "balancer", + contributors = \'["viniabussafi"]\') }}' + ) +}} + +{% set balancer_models = [ + ref('balancer_v2_arbitrum_token_balance_changes'), + ref('balancer_v2_avalanche_c_token_balance_changes'), + ref('balancer_v2_base_token_balance_changes'), + ref('balancer_v2_ethereum_token_balance_changes'), + ref('balancer_v2_gnosis_token_balance_changes'), + ref('balancer_v2_optimism_token_balance_changes'), + ref('balancer_v2_polygon_token_balance_changes'), + ref('balancer_v2_zkevm_token_balance_changes') +] %} + +SELECT * +FROM ( + {% for model in balancer_models %} + SELECT + block_date + , evt_block_time + , evt_block_number + , blockchain + , evt_tx_hash + , evt_index + , pool_id + , pool_address + , pool_symbol + , pool_type + , version + , token_address + , token_symbol + , delta_amount_raw + , delta_amount + FROM {{ model }} + {% if not loop.last %} + UNION ALL + {% endif %} + {% endfor %} +) \ No newline at end of file diff --git a/models/_project/balancer/balances/balancer_token_balance_changes_daily.sql b/models/_project/balancer/balances/balancer_token_balance_changes_daily.sql new file mode 100644 index 00000000000..8e199a25708 --- /dev/null +++ b/models/_project/balancer/balances/balancer_token_balance_changes_daily.sql @@ -0,0 +1,43 @@ +{{ config( + schema = 'balancer', + alias = 'token_balance_changes_daily', + post_hook='{{ expose_spells(blockchains = \'["arbitrum", "avalanche_c", "base", "ethereum", "gnosis", "optimism", "polygon", "zkevm"]\', + spell_type = "project", + spell_name = "balancer", + contributors = \'["viniabussafi"]\') }}' + ) +}} + +{% set balancer_models = [ + ref('balancer_v2_arbitrum_token_balance_changes_daily'), + ref('balancer_v2_avalanche_c_token_balance_changes_daily'), + ref('balancer_v2_base_token_balance_changes_daily'), + ref('balancer_v2_ethereum_token_balance_changes_daily'), + ref('balancer_v2_gnosis_token_balance_changes_daily'), + ref('balancer_v2_optimism_token_balance_changes_daily'), + ref('balancer_v2_polygon_token_balance_changes_daily'), + ref('balancer_v2_zkevm_token_balance_changes_daily') +] %} + +SELECT * +FROM ( + {% for model in balancer_models %} + SELECT + block_date + , pool_id + , pool_address + , pool_symbol + , version + , blockchain + , pool_type + , token_address + , token_symbol + , daily_delta + , daily_delta_usd + , daily_delta_eth + FROM {{ model }} + {% if not loop.last %} + UNION ALL + {% endif %} + {% endfor %} +) \ No newline at end of file diff --git a/models/_project/balancer/balances/base/_schema.yml b/models/_project/balancer/balances/base/_schema.yml new file mode 100644 index 00000000000..89a11b3e539 --- /dev/null +++ b/models/_project/balancer/balances/base/_schema.yml @@ -0,0 +1,100 @@ +version: 2 + +models: + - name: balancer_v2_base_token_balance_changes + meta: + blockchain: base + project: balancer_v2 + contributors: viniabussafi + config: + tags: ['base', 'bpt', 'supply', 'changes'] + description: > + Token Balance Changes on Balancer Pools. + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - block_date + - evt_tx_hash + - evt_index + - token_address + columns: + - &block_date + name: block_date + description: "UTC event block date of each DEX trade" + - &evt_block_time + name: evt_block_time + description: 'Block time of transfer event' + - &evt_block_number + name: evt_block_number + description: 'Block number of transfer event' + - &blockchain + name: blockchain + description: "Blockchain" + - &evt_tx_hash + name: evt_tx_hash + description: 'Transaction hash of transfer event' + - &evt_index + name: evt_index + description: 'Event index' + - &pool_id + name: pool_id + description: "Unique encoded identifier that refers to each pool" + - &pool_address + name: pool_address + description: "Pool address" + - &pool_symbol + name: pool_symbol + description: "Token symbols, followed by their respective weights, if applicable" + - &pool_type + name: pool_type + description: "Pool attributes, determined by the pool's factory" + - &version + name: version + description: "Version of Balancer where the liquidity pool used in transaction is deployed" + - &token_address + name: token_address + description: "Contract address of the token" + - &token_symbol + name: token_symbol + description: "Token symbol" + - &delta_amount_raw + name: delta_amount_raw + description: "Raw value of the transaction at the time of execution in the original currency" + - &delta_amount + name: delta_amount + description: "Normalized value of the transaction at the time of execution in the original currency" + + - name: balancer_v2_base_token_balance_changes_daily + meta: + blockchain: base + project: balancer_v2 + contributors: viniabussafi + config: + tags: ['base', 'bpt', 'supply', 'changes'] + description: > + Token Balance Changes on Balancer Pools, grouped by day. + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - block_date + - pool_id + - token_address + columns: + - *block_date + - *pool_id + - *pool_address + - *pool_symbol + - *version + - *blockchain + - *pool_type + - *token_address + - *token_symbol + - &daily_delta + name: daily_delta + description: "Daily total impact on token balance" + - &daily_delta_usd + name: daily_delta_usd + description: "Daily total impact on token balance, in USD" + - &daily_delta_eth + name: daily_delta_eth + description: "Daily total impact on token balance, in eth" \ No newline at end of file diff --git a/models/_project/balancer/balances/base/balancer_v2_base_token_balance_changes.sql b/models/_project/balancer/balances/base/balancer_v2_base_token_balance_changes.sql new file mode 100644 index 00000000000..1f35750f21d --- /dev/null +++ b/models/_project/balancer/balances/base/balancer_v2_base_token_balance_changes.sql @@ -0,0 +1,16 @@ +{% set blockchain = 'base' %} + +{{ config( + schema = 'balancer_v2_base', + alias = 'token_balance_changes', + materialized = 'table', + file_format = 'delta' + ) +}} + +{{ + balancer_token_balance_changes_macro( + blockchain = blockchain, + version = '2' + ) +}} \ No newline at end of file diff --git a/models/_project/balancer/balances/base/balancer_v2_base_token_balance_changes_daily.sql b/models/_project/balancer/balances/base/balancer_v2_base_token_balance_changes_daily.sql new file mode 100644 index 00000000000..fe24b712bee --- /dev/null +++ b/models/_project/balancer/balances/base/balancer_v2_base_token_balance_changes_daily.sql @@ -0,0 +1,17 @@ +{% set blockchain = 'base' %} + +{{ + config( + schema = 'balancer_v2_base', + alias = 'token_balance_changes_daily', + materialized = 'table', + file_format = 'delta' + ) +}} + +{{ + balancer_token_balance_changes_daily_agg_macro( + blockchain = blockchain, + version = '2' + ) +}} \ No newline at end of file diff --git a/models/_project/balancer/balances/ethereum/_schema.yml b/models/_project/balancer/balances/ethereum/_schema.yml new file mode 100644 index 00000000000..dab33f52016 --- /dev/null +++ b/models/_project/balancer/balances/ethereum/_schema.yml @@ -0,0 +1,131 @@ +version: 2 + +models: + - name: balancer_ethereum_balances + meta: + blockchain: ethereum + project: balancer + contributors: jacektrocinski, metacrypto, viniabussafi + config: + tags: ['ethereum', 'balancer', 'balances'] + description: > + ERC20 token rolling sum balances on Balancer, an automated portfolio manager and trading platform. + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - day + - pool + - token + columns: + - &day + name: day + description: "UTC event block time truncated to the day mark" + tests: + - not_null + - &pool + name: pool + description: "Balancer pool contract address" + - &token + name: token + description: "Token contract address" + - &cumulative_amount + name: cumulative_amount + description: "Balance of a token" + + - name: balancer_v2_ethereum_token_balance_changes + meta: + blockchain: ethereum + project: balancer_v2 + contributors: viniabussafi + config: + tags: ['ethereum', 'bpt', 'supply', 'changes'] + description: > + Token Balance Changes on Balancer Pools. + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - block_date + - evt_tx_hash + - evt_index + - token_address + columns: + - &block_date + name: block_date + description: "UTC event block date of each DEX trade" + - &evt_block_time + name: evt_block_time + description: "Block time of transfer event" + - &evt_block_number + name: evt_block_number + description: "Block number of transfer event" + - &blockchain + name: blockchain + description: "Blockchain" + - &evt_tx_hash + name: evt_tx_hash + description: "Transaction hash of transfer event" + - &evt_index + name: evt_index + description: "Event index" + - &pool_id + name: pool_id + description: "Unique encoded identifier that refers to each pool" + - &pool_address + name: pool_address + description: "Pool address" + - &pool_symbol + name: pool_symbol + description: "Token symbols, followed by their respective weights, if applicable" + - &pool_type + name: pool_type + description: "Pool attributes, determined by the pool's factory" + - &version + name: version + description: "Version of Balancer where the liquidity pool used in transaction is deployed" + - &token_address + name: token_address + description: "Contract address of the token" + - &token_symbol + name: token_symbol + description: "Token symbol" + - &delta_amount_raw + name: delta_amount_raw + description: "Raw value of the transaction at the time of execution in the original currency" + - &delta_amount + name: delta_amount + description: "Normalized value of the transaction at the time of execution in the original currency" + + - name: balancer_v2_ethereum_token_balance_changes_daily + meta: + blockchain: ethereum + project: balancer_v2 + contributors: viniabussafi + config: + tags: ['ethereum', 'bpt', 'supply', 'changes'] + description: > + Token Balance Changes on Balancer Pools, grouped by day. + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - block_date + - pool_id + - token_address + columns: + - *block_date + - *pool_id + - *pool_address + - *pool_symbol + - *version + - *blockchain + - *pool_type + - *token_address + - *token_symbol + - &daily_delta + name: daily_delta + description: "Daily total impact on token balance" + - &daily_delta_usd + name: daily_delta_usd + description: "Daily total impact on token balance, in USD" + - &daily_delta_eth + name: daily_delta_eth + description: "Daily total impact on token balance, in ETH" \ No newline at end of file diff --git a/models/balancer/ethereum/balancer_ethereum_balances.sql b/models/_project/balancer/balances/ethereum/balancer_ethereum_balances.sql similarity index 88% rename from models/balancer/ethereum/balancer_ethereum_balances.sql rename to models/_project/balancer/balances/ethereum/balancer_ethereum_balances.sql index bddec24d0bf..aa584c6c39d 100644 --- a/models/balancer/ethereum/balancer_ethereum_balances.sql +++ b/models/_project/balancer/balances/ethereum/balancer_ethereum_balances.sql @@ -1,11 +1,11 @@ {{ config( + schema = 'balancer_ethereum', alias = 'balances', - post_hook='{{ expose_spells(\'["ethereum"]\', - "project", - "balancer", - \'["metacrypto", "jacektrocinski", "viniabussafi"]\') }}' + spell_type = "project", + spell_name = "balancer", + contributors = \'["metacrypto", "jacektrocinski", "viniabussafi"]\') }}' )  }} @@ -72,5 +72,4 @@ running_cumulative_balance_by_token AS ( LEFT JOIN cumulative_balance_by_token b ON b.day <= c.day AND c.day < b.day_of_next_change ) -SELECT * FROM running_cumulative_balance_by_token - +SELECT * FROM running_cumulative_balance_by_token \ No newline at end of file diff --git a/models/_project/balancer/balances/ethereum/balancer_v2_ethereum_token_balance_changes.sql b/models/_project/balancer/balances/ethereum/balancer_v2_ethereum_token_balance_changes.sql new file mode 100644 index 00000000000..12b1a61ad46 --- /dev/null +++ b/models/_project/balancer/balances/ethereum/balancer_v2_ethereum_token_balance_changes.sql @@ -0,0 +1,16 @@ +{% set blockchain = 'ethereum' %} + +{{ config( + schema = 'balancer_v2_ethereum', + alias = 'token_balance_changes', + materialized = 'table', + file_format = 'delta' + ) +}} + +{{ + balancer_token_balance_changes_macro( + blockchain = blockchain, + version = '2' + ) +}} \ No newline at end of file diff --git a/models/_project/balancer/balances/ethereum/balancer_v2_ethereum_token_balance_changes_daily.sql b/models/_project/balancer/balances/ethereum/balancer_v2_ethereum_token_balance_changes_daily.sql new file mode 100644 index 00000000000..44aeb0ee7b8 --- /dev/null +++ b/models/_project/balancer/balances/ethereum/balancer_v2_ethereum_token_balance_changes_daily.sql @@ -0,0 +1,17 @@ +{% set blockchain = 'ethereum' %} + +{{ + config( + schema = 'balancer_v2_ethereum', + alias = 'token_balance_changes_daily', + materialized = 'table', + file_format = 'delta' + ) +}} + +{{ + balancer_token_balance_changes_daily_agg_macro( + blockchain = blockchain, + version = '2' + ) +}} \ No newline at end of file diff --git a/models/_project/balancer/balances/gnosis/_schema.yml b/models/_project/balancer/balances/gnosis/_schema.yml new file mode 100644 index 00000000000..9fdd91e45e3 --- /dev/null +++ b/models/_project/balancer/balances/gnosis/_schema.yml @@ -0,0 +1,100 @@ +version: 2 + +models: + - name: balancer_v2_gnosis_token_balance_changes + meta: + blockchain: gnosis + project: balancer_v2 + contributors: viniabussafi + config: + tags: ['gnosis', 'bpt', 'supply', 'changes'] + description: > + Token Balance Changes on Balancer Pools. + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - block_date + - evt_tx_hash + - evt_index + - token_address + columns: + - &block_date + name: block_date + description: "UTC event block date of each DEX trade" + - &evt_block_time + name: evt_block_time + description: 'Block time of transfer event' + - &evt_block_number + name: evt_block_number + description: 'Block number of transfer event' + - &blockchain + name: blockchain + description: "Blockchain" + - &evt_tx_hash + name: evt_tx_hash + description: 'Transaction hash of transfer event' + - &evt_index + name: evt_index + description: 'Event index' + - &pool_id + name: pool_id + description: "Unique encoded identifier that refers to each pool" + - &pool_address + name: pool_address + description: "Pool address" + - &pool_symbol + name: pool_symbol + description: "Token symbols, followed by their respective weights, if applicable" + - &pool_type + name: pool_type + description: "Pool attributes, determined by the pool's factory" + - &version + name: version + description: "Version of Balancer where the liquidity pool used in transaction is deployed" + - &token_address + name: token_address + description: "Contract address of the token" + - &token_symbol + name: token_symbol + description: "Token symbol" + - &delta_amount_raw + name: delta_amount_raw + description: "Raw value of the transaction at the time of execution in the original currency" + - &delta_amount + name: delta_amount + description: "Normalized value of the transaction at the time of execution in the original currency" + + - name: balancer_v2_gnosis_token_balance_changes_daily + meta: + blockchain: gnosis + project: balancer_v2 + contributors: viniabussafi + config: + tags: ['gnosis', 'bpt', 'supply', 'changes'] + description: > + Token Balance Changes on Balancer Pools, grouped by day. + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - block_date + - pool_id + - token_address + columns: + - *block_date + - *pool_id + - *pool_address + - *pool_symbol + - *version + - *blockchain + - *pool_type + - *token_address + - *token_symbol + - &daily_delta + name: daily_delta + description: "Daily total impact on token balance" + - &daily_delta_usd + name: daily_delta_usd + description: "Daily total impact on token balance, in USD" + - &daily_delta_eth + name: daily_delta_eth + description: "Daily total impact on token balance, in eth" \ No newline at end of file diff --git a/models/_project/balancer/balances/gnosis/balancer_v2_gnosis_token_balance_changes.sql b/models/_project/balancer/balances/gnosis/balancer_v2_gnosis_token_balance_changes.sql new file mode 100644 index 00000000000..e3e0177541d --- /dev/null +++ b/models/_project/balancer/balances/gnosis/balancer_v2_gnosis_token_balance_changes.sql @@ -0,0 +1,16 @@ +{% set blockchain = 'gnosis' %} + +{{ config( + schema = 'balancer_v2_gnosis', + alias = 'token_balance_changes', + materialized = 'table', + file_format = 'delta' + ) +}} + +{{ + balancer_token_balance_changes_macro( + blockchain = blockchain, + version = '2' + ) +}} \ No newline at end of file diff --git a/models/_project/balancer/balances/gnosis/balancer_v2_gnosis_token_balance_changes_daily.sql b/models/_project/balancer/balances/gnosis/balancer_v2_gnosis_token_balance_changes_daily.sql new file mode 100644 index 00000000000..434e9b096fb --- /dev/null +++ b/models/_project/balancer/balances/gnosis/balancer_v2_gnosis_token_balance_changes_daily.sql @@ -0,0 +1,17 @@ +{% set blockchain = 'gnosis' %} + +{{ + config( + schema = 'balancer_v2_gnosis', + alias = 'token_balance_changes_daily', + materialized = 'table', + file_format = 'delta' + ) +}} + +{{ + balancer_token_balance_changes_daily_agg_macro( + blockchain = blockchain, + version = '2' + ) +}} \ No newline at end of file diff --git a/models/_project/balancer/balances/optimism/_schema.yml b/models/_project/balancer/balances/optimism/_schema.yml new file mode 100644 index 00000000000..952aefc44ee --- /dev/null +++ b/models/_project/balancer/balances/optimism/_schema.yml @@ -0,0 +1,100 @@ +version: 2 + +models: + - name: balancer_v2_optimism_token_balance_changes + meta: + blockchain: optimism + project: balancer_v2 + contributors: viniabussafi + config: + tags: ['optimism', 'bpt', 'supply', 'changes'] + description: > + Token Balance Changes on Balancer Pools. + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - block_date + - evt_tx_hash + - evt_index + - token_address + columns: + - &block_date + name: block_date + description: "UTC event block date of each DEX trade" + - &evt_block_time + name: evt_block_time + description: 'Block time of transfer event' + - &evt_block_number + name: evt_block_number + description: 'Block number of transfer event' + - &blockchain + name: blockchain + description: "Blockchain" + - &evt_tx_hash + name: evt_tx_hash + description: 'Transaction hash of transfer event' + - &evt_index + name: evt_index + description: 'Event index' + - &pool_id + name: pool_id + description: "Unique encoded identifier that refers to each pool" + - &pool_address + name: pool_address + description: "Pool address" + - &pool_symbol + name: pool_symbol + description: "Token symbols, followed by their respective weights, if applicable" + - &pool_type + name: pool_type + description: "Pool attributes, determined by the pool's factory" + - &version + name: version + description: "Version of Balancer where the liquidity pool used in transaction is deployed" + - &token_address + name: token_address + description: "Contract address of the token" + - &token_symbol + name: token_symbol + description: "Token symbol" + - &delta_amount_raw + name: delta_amount_raw + description: "Raw value of the transaction at the time of execution in the original currency" + - &delta_amount + name: delta_amount + description: "Normalized value of the transaction at the time of execution in the original currency" + + - name: balancer_v2_optimism_token_balance_changes_daily + meta: + blockchain: optimism + project: balancer_v2 + contributors: viniabussafi + config: + tags: ['optimism', 'bpt', 'supply', 'changes'] + description: > + Token Balance Changes on Balancer Pools, grouped by day. + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - block_date + - pool_id + - token_address + columns: + - *block_date + - *pool_id + - *pool_address + - *pool_symbol + - *version + - *blockchain + - *pool_type + - *token_address + - *token_symbol + - &daily_delta + name: daily_delta + description: "Daily total impact on token balance" + - &daily_delta_usd + name: daily_delta_usd + description: "Daily total impact on token balance, in USD" + - &daily_delta_eth + name: daily_delta_eth + description: "Daily total impact on token balance, in eth" \ No newline at end of file diff --git a/models/_project/balancer/balances/optimism/balancer_v2_optimism_token_balance_changes.sql b/models/_project/balancer/balances/optimism/balancer_v2_optimism_token_balance_changes.sql new file mode 100644 index 00000000000..39fd96a795d --- /dev/null +++ b/models/_project/balancer/balances/optimism/balancer_v2_optimism_token_balance_changes.sql @@ -0,0 +1,16 @@ +{% set blockchain = 'optimism' %} + +{{ config( + schema = 'balancer_v2_optimism', + alias = 'token_balance_changes', + materialized = 'table', + file_format = 'delta' + ) +}} + +{{ + balancer_token_balance_changes_macro( + blockchain = blockchain, + version = '2' + ) +}} \ No newline at end of file diff --git a/models/_project/balancer/balances/optimism/balancer_v2_optimism_token_balance_changes_daily.sql b/models/_project/balancer/balances/optimism/balancer_v2_optimism_token_balance_changes_daily.sql new file mode 100644 index 00000000000..ac9db7d6bd7 --- /dev/null +++ b/models/_project/balancer/balances/optimism/balancer_v2_optimism_token_balance_changes_daily.sql @@ -0,0 +1,17 @@ +{% set blockchain = 'optimism' %} + +{{ + config( + schema = 'balancer_v2_optimism', + alias = 'token_balance_changes_daily', + materialized = 'table', + file_format = 'delta' + ) +}} + +{{ + balancer_token_balance_changes_daily_agg_macro( + blockchain = blockchain, + version = '2' + ) +}} \ No newline at end of file diff --git a/models/_project/balancer/balances/polygon/_schema.yml b/models/_project/balancer/balances/polygon/_schema.yml new file mode 100644 index 00000000000..70c27f9cac4 --- /dev/null +++ b/models/_project/balancer/balances/polygon/_schema.yml @@ -0,0 +1,100 @@ +version: 2 + +models: + - name: balancer_v2_polygon_token_balance_changes + meta: + blockchain: polygon + project: balancer_v2 + contributors: viniabussafi + config: + tags: ['polygon', 'bpt', 'supply', 'changes'] + description: > + Token Balance Changes on Balancer Pools. + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - block_date + - evt_tx_hash + - evt_index + - token_address + columns: + - &block_date + name: block_date + description: "UTC event block date of each DEX trade" + - &evt_block_time + name: evt_block_time + description: 'Block time of transfer event' + - &evt_block_number + name: evt_block_number + description: 'Block number of transfer event' + - &blockchain + name: blockchain + description: "Blockchain" + - &evt_tx_hash + name: evt_tx_hash + description: 'Transaction hash of transfer event' + - &evt_index + name: evt_index + description: 'Event index' + - &pool_id + name: pool_id + description: "Unique encoded identifier that refers to each pool" + - &pool_address + name: pool_address + description: "Pool address" + - &pool_symbol + name: pool_symbol + description: "Token symbols, followed by their respective weights, if applicable" + - &pool_type + name: pool_type + description: "Pool attributes, determined by the pool's factory" + - &version + name: version + description: "Version of Balancer where the liquidity pool used in transaction is deployed" + - &token_address + name: token_address + description: "Contract address of the token" + - &token_symbol + name: token_symbol + description: "Token symbol" + - &delta_amount_raw + name: delta_amount_raw + description: "Raw value of the transaction at the time of execution in the original currency" + - &delta_amount + name: delta_amount + description: "Normalized value of the transaction at the time of execution in the original currency" + + - name: balancer_v2_polygon_token_balance_changes_daily + meta: + blockchain: polygon + project: balancer_v2 + contributors: viniabussafi + config: + tags: ['polygon', 'bpt', 'supply', 'changes'] + description: > + Token Balance Changes on Balancer Pools, grouped by day. + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - block_date + - pool_id + - token_address + columns: + - *block_date + - *pool_id + - *pool_address + - *pool_symbol + - *version + - *blockchain + - *pool_type + - *token_address + - *token_symbol + - &daily_delta + name: daily_delta + description: "Daily total impact on token balance" + - &daily_delta_usd + name: daily_delta_usd + description: "Daily total impact on token balance, in USD" + - &daily_delta_eth + name: daily_delta_eth + description: "Daily total impact on token balance, in eth" \ No newline at end of file diff --git a/models/_project/balancer/balances/polygon/balancer_v2_polygon_token_balance_changes.sql b/models/_project/balancer/balances/polygon/balancer_v2_polygon_token_balance_changes.sql new file mode 100644 index 00000000000..efbac69046b --- /dev/null +++ b/models/_project/balancer/balances/polygon/balancer_v2_polygon_token_balance_changes.sql @@ -0,0 +1,16 @@ +{% set blockchain = 'polygon' %} + +{{ config( + schema = 'balancer_v2_polygon', + alias = 'token_balance_changes', + materialized = 'table', + file_format = 'delta' + ) +}} + +{{ + balancer_token_balance_changes_macro( + blockchain = blockchain, + version = '2' + ) +}} \ No newline at end of file diff --git a/models/_project/balancer/balances/polygon/balancer_v2_polygon_token_balance_changes_daily.sql b/models/_project/balancer/balances/polygon/balancer_v2_polygon_token_balance_changes_daily.sql new file mode 100644 index 00000000000..fa318aaec80 --- /dev/null +++ b/models/_project/balancer/balances/polygon/balancer_v2_polygon_token_balance_changes_daily.sql @@ -0,0 +1,17 @@ +{% set blockchain = 'polygon' %} + +{{ + config( + schema = 'balancer_v2_polygon', + alias = 'token_balance_changes_daily', + materialized = 'table', + file_format = 'delta' + ) +}} + +{{ + balancer_token_balance_changes_daily_agg_macro( + blockchain = blockchain, + version = '2' + ) +}} \ No newline at end of file diff --git a/models/_project/balancer/balances/zkevm/_schema.yml b/models/_project/balancer/balances/zkevm/_schema.yml new file mode 100644 index 00000000000..3fae28a259a --- /dev/null +++ b/models/_project/balancer/balances/zkevm/_schema.yml @@ -0,0 +1,100 @@ +version: 2 + +models: + - name: balancer_v2_zkevm_token_balance_changes + meta: + blockchain: zkevm + project: balancer_v2 + contributors: viniabussafi + config: + tags: ['zkevm', 'bpt', 'supply', 'changes'] + description: > + Token Balance Changes on Balancer Pools. + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - block_date + - evt_tx_hash + - evt_index + - token_address + columns: + - &block_date + name: block_date + description: "UTC event block date of each DEX trade" + - &evt_block_time + name: evt_block_time + description: 'Block time of transfer event' + - &evt_block_number + name: evt_block_number + description: 'Block number of transfer event' + - &blockchain + name: blockchain + description: "Blockchain" + - &evt_tx_hash + name: evt_tx_hash + description: 'Transaction hash of transfer event' + - &evt_index + name: evt_index + description: 'Event index' + - &pool_id + name: pool_id + description: "Unique encoded identifier that refers to each pool" + - &pool_address + name: pool_address + description: "Pool address" + - &pool_symbol + name: pool_symbol + description: "Token symbols, followed by their respective weights, if applicable" + - &pool_type + name: pool_type + description: "Pool attributes, determined by the pool's factory" + - &version + name: version + description: "Version of Balancer where the liquidity pool used in transaction is deployed" + - &token_address + name: token_address + description: "Contract address of the token" + - &token_symbol + name: token_symbol + description: "Token symbol" + - &delta_amount_raw + name: delta_amount_raw + description: "Raw value of the transaction at the time of execution in the original currency" + - &delta_amount + name: delta_amount + description: "Normalized value of the transaction at the time of execution in the original currency" + + - name: balancer_v2_zkevm_token_balance_changes_daily + meta: + blockchain: zkevm + project: balancer_v2 + contributors: viniabussafi + config: + tags: ['zkevm', 'bpt', 'supply', 'changes'] + description: > + Token Balance Changes on Balancer Pools, grouped by day. + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - block_date + - pool_id + - token_address + columns: + - *block_date + - *pool_id + - *pool_address + - *pool_symbol + - *version + - *blockchain + - *pool_type + - *token_address + - *token_symbol + - &daily_delta + name: daily_delta + description: "Daily total impact on token balance" + - &daily_delta_usd + name: daily_delta_usd + description: "Daily total impact on token balance, in USD" + - &daily_delta_eth + name: daily_delta_eth + description: "Daily total impact on token balance, in eth" \ No newline at end of file diff --git a/models/_project/balancer/balances/zkevm/balancer_v2_zkevm_token_balance_changes.sql b/models/_project/balancer/balances/zkevm/balancer_v2_zkevm_token_balance_changes.sql new file mode 100644 index 00000000000..80eff1513b7 --- /dev/null +++ b/models/_project/balancer/balances/zkevm/balancer_v2_zkevm_token_balance_changes.sql @@ -0,0 +1,16 @@ +{% set blockchain = 'zkevm' %} + +{{ config( + schema = 'balancer_v2_zkevm', + alias = 'token_balance_changes', + materialized = 'table', + file_format = 'delta' + ) +}} + +{{ + balancer_token_balance_changes_macro( + blockchain = blockchain, + version = '2' + ) +}} \ No newline at end of file diff --git a/models/_project/balancer/balances/zkevm/balancer_v2_zkevm_token_balance_changes_daily.sql b/models/_project/balancer/balances/zkevm/balancer_v2_zkevm_token_balance_changes_daily.sql new file mode 100644 index 00000000000..9bd7cabbb72 --- /dev/null +++ b/models/_project/balancer/balances/zkevm/balancer_v2_zkevm_token_balance_changes_daily.sql @@ -0,0 +1,17 @@ +{% set blockchain = 'zkevm' %} + +{{ + config( + schema = 'balancer_v2_zkevm', + alias = 'token_balance_changes_daily', + materialized = 'table', + file_format = 'delta' + ) +}} + +{{ + balancer_token_balance_changes_daily_agg_macro( + blockchain = blockchain, + version = '2' + ) +}} \ No newline at end of file diff --git a/models/_project/balancer/bpt/_schema.yml b/models/_project/balancer/bpt/_schema.yml new file mode 100644 index 00000000000..4afa2327ca2 --- /dev/null +++ b/models/_project/balancer/bpt/_schema.yml @@ -0,0 +1,176 @@ +version: 2 + +models: + - name: balancer_transfers_bpt + meta: + blockchain: arbitrum, avalanche_c, base, ethereum, gnosis, optimism, polygon, zkevmn + contributors: victorstefenon, thetroyharris, viniabussafi + config: + tags: ['arbitrum', 'avalanche_c', 'base', 'ethereum', 'gnosis', 'optimism', 'polygon', 'zkevm', 'bpt', 'transfers'] + description: > + Balancer Pool Token (BPT) transfer logs on Balancer, an automated portfolio manager and trading platform. + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - evt_tx_hash + - evt_index + - block_date + columns: + - &blockchain + name: blockchain + description: "Blockchain" + - &version + name: version + description: "Version of Balancer where the liquidity pool used in transaction is deployed" + - &contract_address + name: contract_address + description: 'zkevm address for the liquidity pool used in transaction' + - &block_date + name: block_date + description: "UTC event block date of each DEX trade" + - &block_month + name: block_month + description: "UTC event block month of each DEX trade" + - &evt_tx_hash + name: evt_tx_hash + description: 'Transaction hash of transfer event' + - &evt_index + name: evt_index + description: 'Event index' + - &evt_block_time + name: evt_block_time + description: 'Block time of transfer event' + - &evt_block_number + name: evt_block_number + description: 'Block number of transfer event' + - &from + name: from + description: 'Address of BPT provider of transfer event' + - &to + name: to + description: 'Address of BPT receiver of transfer event' + - &value + name: value + description: 'Amount of BPT transferred in transfer event' + + - name: balancer_bpt_prices + meta: + blockchain: arbitrum, avalanche_c, base, ethereum, gnosis, optimism, polygon, zkevm + sector: dex + contributors: thetroyharris, victorstefenon, viniabussafi + config: + tags: ['balancer', 'amm', 'dex', 'bpt', 'prices', 'ethereum', 'arbitrum', 'optimism', 'polygon', 'gnosis', 'avalanche_c', 'base', 'zkevm'] + description: > + Balancer Pool Token (BPT) hourly median price by pool on Balancer, an automated portfolio manager and trading platform. + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - blockchain + - day + - contract_address + columns: + - *blockchain + - &day + name: day + description: "Block date in UTC" + - *version + - &decimals + name: decimals + description: "Token decimals. 18, by default, on BPTs" + - *contract_address + - &bpt_price + name: bpt_price + description: "Price of the BPT" + + + - name: balancer_bpt_supply + meta: + blockchain: arbitrum, avalanche_c, base, ethereum, gnosis, optimism, polygon, zkevm + contributors: thetroyharris, viniabussafi + config: + tags: ['arbitrum', 'avalanche_c', 'base', 'ethereum', 'gnosis', 'optimism', 'polygon', 'zkevm', 'bpt'] + description: > + The Balancer Pool Token (BPT) supply over time of ComposableStablePools versions 4+ + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - day + - blockchain + - token_address + columns: + - *day + - &pool_type + name: pool_type + description: "Pool attributes, determined by the pool's factory" + - *version + - *blockchain + - &token_address + name: token_address + description: "Contract address of the BPT" + - &supply + name: supply + description: "Supply of the BPT, discounted of premints" + + - name: balancer_bpt_supply_changes + meta: + blockchain: arbitrum, avalanche_c, base, ethereum, gnosis, optimism, polygon, zkevm + contributors: viniabussafi + config: + tags: ['arbitrum', 'avalanche_c', 'base', 'ethereum', 'gnosis', 'optimism', 'polygon', 'zkevm', 'bpt', 'supply', 'changes'] + description: > + Balancer Pool Token (BPT) supply change events. + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - block_date + - evt_tx_hash + - evt_index + - label + columns: + - *block_date + - *evt_block_time + - *evt_block_number + - *blockchain + - *evt_tx_hash + - *evt_index + - *pool_type + - &pool_symbol + name: pool_symbol + description: "Token symbols, followed by their respective weights, if applicable" + - *version + - &label + name: label + description: "Nature of the transaction (Join/Exit via swap or Mint/Burn via transfer)" + - *token_address + - &delta_amount_raw + name: delta_amount_raw + description: "Raw value of the transaction on token supply at the time of execution in the original currency" + - &delta_amount + name: delta_amount + description: "Normalized value of the transaction on token supply at the time of execution in the original currency" + + + - name: balancer_bpt_supply_changes_daily + meta: + blockchain: arbitrum, avalanche_c, base, ethereum, gnosis, optimism, polygon, zkevm + contributors: viniabussafi + config: + tags: ['arbitrum', 'avalanche_c', 'base', 'ethereum', 'gnosis', 'optimism', 'polygon', 'zkevm', 'bpt', 'supply', 'changes'] + description: > + Balancer Pool Token (BPT) supply change events. grouped by day + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - block_date + - blockchain + - token_address + columns: + - *block_date + - *blockchain + - *pool_type + - *pool_symbol + - *version + - *token_address + - &daily_delta + name: daily_delta + description: "Daily total impact on BPT supply" \ No newline at end of file diff --git a/models/_project/balancer/bpt/arbitrum/_schema.yml b/models/_project/balancer/bpt/arbitrum/_schema.yml new file mode 100644 index 00000000000..c32bee8b667 --- /dev/null +++ b/models/_project/balancer/bpt/arbitrum/_schema.yml @@ -0,0 +1,178 @@ +version: 2 + +models: + - name: balancer_v2_arbitrum_transfers_bpt + meta: + blockchain: arbitrum + project: balancer_v2 + contributors: victorstefenon, thetroyharris, viniabussafi + config: + tags: ['arbitrum', 'bpt', 'transfers'] + description: > + Balancer Pool Token (BPT) transfer logs on Balancer, an automated portfolio manager and trading platform, on Arbitrum. + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - evt_tx_hash + - evt_index + - block_date + columns: + - &blockchain + name: blockchain + description: "Blockchain" + - &version + name: version + description: "Version of Balancer where the liquidity pool used in transaction is deployed" + - &contract_address + name: contract_address + description: 'Arbitrum address for the liquidity pool used in transaction' + - &block_date + name: block_date + description: "UTC event block date of each DEX trade" + - &block_month + name: block_month + description: "UTC event block month of each DEX trade" + - &evt_tx_hash + name: evt_tx_hash + description: 'Transaction hash of transfer event' + - &evt_index + name: evt_index + description: 'Event index' + - &evt_block_time + name: evt_block_time + description: 'Block time of transfer event' + - &evt_block_number + name: evt_block_number + description: 'Block number of transfer event' + - &from + name: from + description: 'Address of BPT provider of transfer event' + - &to + name: to + description: 'Address of BPT receiver of transfer event' + - &value + name: value + description: 'Amount of BPT transferred in transfer event' + + - name: balancer_v2_arbitrum_bpt_prices + meta: + blockchain: arbitrum + project: balancer_v2 + contributors: victorstefenon, thetroyharris, viniabussafi + config: + tags: ['arbitrum', 'bpt', 'prices'] + description: > + Balancer Pool Token (BPT) daily price by pool on Balancer, an automated portfolio manager and trading platform. + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - blockchain + - day + - contract_address + columns: + - *blockchain + - &day + name: day + description: "Block date in UTC" + - *version + - &decimals + name: decimals + description: "Token decimals. 18, by default, on BPTs" + - *contract_address + - &bpt_price + name: bpt_price + description: "Price of the BPT" + + - name: balancer_v2_arbitrum_bpt_supply + meta: + blockchain: arbitrum + project: balancer_v2 + contributors: thetroyharris, viniabussafi + config: + tags: ['arbitrum', 'bpt', 'supply'] + description: > + Balancer Pool Token (BPT) supply by pool on Balancer, an automated portfolio manager and trading platform. + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - day + - blockchain + - token_address + columns: + - *day + - &pool_type + name: pool_type + description: "Pool attributes, determined by the pool's factory" + - *version + - *blockchain + - &token_address + name: token_address + description: "Contract address of the BPT" + - &supply + name: supply + description: "Supply of the BPT, discounted of premints" + + - name: balancer_v2_arbitrum_bpt_supply_changes + meta: + blockchain: arbitrum + project: balancer_v2 + contributors: viniabussafi + config: + tags: ['arbitrum', 'bpt', 'supply', 'changes'] + description: > + Balancer Pool Token (BPT) supply change events. + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - block_date + - evt_tx_hash + - evt_index + - label + columns: + - *block_date + - *evt_block_time + - *evt_block_number + - *blockchain + - *evt_tx_hash + - *evt_index + - *pool_type + - &pool_symbol + name: pool_symbol + description: "Token symbols, followed by their respective weights, if applicable" + - *version + - &label + name: label + description: "Nature of the transaction (Join/Exit via swap or Mint/Burn via transfer)" + - *token_address + - &delta_amount_raw + name: delta_amount_raw + description: "Raw value of the transaction on token supply at the time of execution in the original currency" + - &delta_amount + name: delta_amount + description: "Normalized value of the transaction on token supply at the time of execution in the original currency" + + - name: balancer_v2_arbitrum_bpt_supply_changes_daily + meta: + blockchain: arbitrum + project: balancer_v2 + contributors: viniabussafi + config: + tags: ['arbitrum', 'bpt', 'supply', 'changes'] + description: > + Balancer Pool Token (BPT) supply change events. grouped by day + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - block_date + - blockchain + - token_address + columns: + - *block_date + - *blockchain + - *pool_type + - *pool_symbol + - *version + - *token_address + - &daily_delta + name: daily_delta + description: "Daily total impact on BPT supply" \ No newline at end of file diff --git a/models/balancer/arbitrum/balancer_v2_arbitrum_bpt_prices.sql b/models/_project/balancer/bpt/arbitrum/balancer_v2_arbitrum_bpt_prices.sql similarity index 100% rename from models/balancer/arbitrum/balancer_v2_arbitrum_bpt_prices.sql rename to models/_project/balancer/bpt/arbitrum/balancer_v2_arbitrum_bpt_prices.sql diff --git a/models/balancer/arbitrum/balancer_v2_arbitrum_bpt_supply.sql b/models/_project/balancer/bpt/arbitrum/balancer_v2_arbitrum_bpt_supply.sql similarity index 100% rename from models/balancer/arbitrum/balancer_v2_arbitrum_bpt_supply.sql rename to models/_project/balancer/bpt/arbitrum/balancer_v2_arbitrum_bpt_supply.sql diff --git a/models/_project/balancer/bpt/arbitrum/balancer_v2_arbitrum_bpt_supply_changes.sql b/models/_project/balancer/bpt/arbitrum/balancer_v2_arbitrum_bpt_supply_changes.sql new file mode 100644 index 00000000000..b30224001c3 --- /dev/null +++ b/models/_project/balancer/bpt/arbitrum/balancer_v2_arbitrum_bpt_supply_changes.sql @@ -0,0 +1,20 @@ +{% set blockchain = 'arbitrum' %} + +{{ + config( + schema = 'balancer_v2_arbitrum', + alias = 'bpt_supply_changes', + materialized = 'incremental', + file_format = 'delta', + incremental_strategy = 'merge', + unique_key = ['block_date', 'evt_tx_hash', 'evt_index', 'label'], + incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.evt_block_time')] + ) +}} + +{{ + bpt_supply_changes_macro( + blockchain = blockchain, + version = '2' + ) +}} \ No newline at end of file diff --git a/models/_project/balancer/bpt/arbitrum/balancer_v2_arbitrum_bpt_supply_changes_daily.sql b/models/_project/balancer/bpt/arbitrum/balancer_v2_arbitrum_bpt_supply_changes_daily.sql new file mode 100644 index 00000000000..df606a75ceb --- /dev/null +++ b/models/_project/balancer/bpt/arbitrum/balancer_v2_arbitrum_bpt_supply_changes_daily.sql @@ -0,0 +1,17 @@ +{% set blockchain = 'ethereum' %} + +{{ + config( + schema = 'balancer_v2_ethereum', + alias = 'bpt_supply_changes_daily', + materialized = 'table', + file_format = 'delta' + ) +}} + +{{ + bpt_supply_changes_daily_agg_macro( + blockchain = blockchain, + version = '2' + ) +}} \ No newline at end of file diff --git a/models/balancer/arbitrum/balancer_v2_arbitrum_transfers_bpt.sql b/models/_project/balancer/bpt/arbitrum/balancer_v2_arbitrum_transfers_bpt.sql similarity index 100% rename from models/balancer/arbitrum/balancer_v2_arbitrum_transfers_bpt.sql rename to models/_project/balancer/bpt/arbitrum/balancer_v2_arbitrum_transfers_bpt.sql diff --git a/models/_project/balancer/bpt/avalanche_c/_schema.yml b/models/_project/balancer/bpt/avalanche_c/_schema.yml new file mode 100644 index 00000000000..8bde08a0ad8 --- /dev/null +++ b/models/_project/balancer/bpt/avalanche_c/_schema.yml @@ -0,0 +1,178 @@ +version: 2 + +models: + - name: balancer_v2_avalanche_c_transfers_bpt + meta: + blockchain: avalanche_c + project: balancer_v2 + contributors: victorstefenon, thetroyharris, viniabussafi + config: + tags: ['avalanche_c', 'bpt', 'transfers'] + description: > + Balancer Pool Token (BPT) transfer logs on Balancer, an automated portfolio manager and trading platform, on avalanche_c. + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - evt_tx_hash + - evt_index + - block_date + columns: + - &blockchain + name: blockchain + description: "Blockchain" + - &version + name: version + description: "Version of Balancer where the liquidity pool used in transaction is deployed" + - &contract_address + name: contract_address + description: 'avalanche_c address for the liquidity pool used in transaction' + - &block_date + name: block_date + description: "UTC event block date of each DEX trade" + - &block_month + name: block_month + description: "UTC event block month of each DEX trade" + - &evt_tx_hash + name: evt_tx_hash + description: 'Transaction hash of transfer event' + - &evt_index + name: evt_index + description: 'Event index' + - &evt_block_time + name: evt_block_time + description: 'Block time of transfer event' + - &evt_block_number + name: evt_block_number + description: 'Block number of transfer event' + - &from + name: from + description: 'Address of BPT provider of transfer event' + - &to + name: to + description: 'Address of BPT receiver of transfer event' + - &value + name: value + description: 'Amount of BPT transferred in transfer event' + + - name: balancer_v2_avalanche_c_bpt_prices + meta: + blockchain: avalanche_c + project: balancer_v2 + contributors: victorstefenon, thetroyharris, viniabussafi + config: + tags: ['avalanche_c', 'bpt', 'prices'] + description: > + Balancer Pool Token (BPT) daily price by pool on Balancer, an automated portfolio manager and trading platform. + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - blockchain + - day + - contract_address + columns: + - *blockchain + - &day + name: day + description: "Block date in UTC" + - *version + - &decimals + name: decimals + description: "Token decimals. 18, by default, on BPTs" + - *contract_address + - &bpt_price + name: bpt_price + description: "Price of the BPT" + + - name: balancer_v2_avalanche_c_bpt_supply + meta: + blockchain: avalanche_c + project: balancer_v2 + contributors: thetroyharris, viniabussafi + config: + tags: ['avalanche_c', 'bpt', 'supply'] + description: > + Balancer Pool Token (BPT) supply by pool on Balancer, an automated portfolio manager and trading platform. + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - day + - blockchain + - token_address + columns: + - *day + - &pool_type + name: pool_type + description: "Pool attributes, determined by the pool's factory" + - *version + - *blockchain + - &token_address + name: token_address + description: "Contract address of the BPT" + - &supply + name: supply + description: "Supply of the BPT, discounted of premints" + + - name: balancer_v2_avalanche_c_bpt_supply_changes + meta: + blockchain: avalanche_c + project: balancer_v2 + contributors: viniabussafi + config: + tags: ['avalanche_c', 'bpt', 'supply', 'changes'] + description: > + Balancer Pool Token (BPT) supply change events. + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - block_date + - evt_tx_hash + - evt_index + - label + columns: + - *block_date + - *evt_block_time + - *evt_block_number + - *blockchain + - *evt_tx_hash + - *evt_index + - *pool_type + - &pool_symbol + name: pool_symbol + description: "Token symbols, followed by their respective weights, if applicable" + - *version + - &label + name: label + description: "Nature of the transaction (Join/Exit via swap or Mint/Burn via transfer)" + - *token_address + - &delta_amount_raw + name: delta_amount_raw + description: "Raw value of the transaction on token supply at the time of execution in the original currency" + - &delta_amount + name: delta_amount + description: "Normalized value of the transaction on token supply at the time of execution in the original currency" + + - name: balancer_v2_avalanche_c_bpt_supply_changes_daily + meta: + blockchain: avalanche_c + project: balancer_v2 + contributors: viniabussafi + config: + tags: ['avalanche_c', 'bpt', 'supply', 'changes'] + description: > + Balancer Pool Token (BPT) supply change events. grouped by day + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - block_date + - blockchain + - token_address + columns: + - *block_date + - *blockchain + - *pool_type + - *pool_symbol + - *version + - *token_address + - &daily_delta + name: daily_delta + description: "Daily total impact on BPT supply" \ No newline at end of file diff --git a/models/balancer/avalanche_c/balancer_v2_avalanche_c_bpt_prices.sql b/models/_project/balancer/bpt/avalanche_c/balancer_v2_avalanche_c_bpt_prices.sql similarity index 100% rename from models/balancer/avalanche_c/balancer_v2_avalanche_c_bpt_prices.sql rename to models/_project/balancer/bpt/avalanche_c/balancer_v2_avalanche_c_bpt_prices.sql diff --git a/models/balancer/avalanche_c/balancer_v2_avalanche_c_bpt_supply.sql b/models/_project/balancer/bpt/avalanche_c/balancer_v2_avalanche_c_bpt_supply.sql similarity index 100% rename from models/balancer/avalanche_c/balancer_v2_avalanche_c_bpt_supply.sql rename to models/_project/balancer/bpt/avalanche_c/balancer_v2_avalanche_c_bpt_supply.sql diff --git a/models/_project/balancer/bpt/avalanche_c/balancer_v2_avalanche_c_bpt_supply_changes.sql b/models/_project/balancer/bpt/avalanche_c/balancer_v2_avalanche_c_bpt_supply_changes.sql new file mode 100644 index 00000000000..db1052cb8d8 --- /dev/null +++ b/models/_project/balancer/bpt/avalanche_c/balancer_v2_avalanche_c_bpt_supply_changes.sql @@ -0,0 +1,20 @@ +{% set blockchain = 'avalanche_c' %} + +{{ + config( + schema = 'balancer_v2_avalanche_c', + alias = 'bpt_supply_changes', + materialized = 'incremental', + file_format = 'delta', + incremental_strategy = 'merge', + unique_key = ['block_date', 'evt_tx_hash', 'evt_index', 'label'], + incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.evt_block_time')] + ) +}} + +{{ + bpt_supply_changes_macro( + blockchain = blockchain, + version = '2' + ) +}} \ No newline at end of file diff --git a/models/_project/balancer/bpt/avalanche_c/balancer_v2_avalanche_c_bpt_supply_changes_daily.sql b/models/_project/balancer/bpt/avalanche_c/balancer_v2_avalanche_c_bpt_supply_changes_daily.sql new file mode 100644 index 00000000000..5ce53b4aa92 --- /dev/null +++ b/models/_project/balancer/bpt/avalanche_c/balancer_v2_avalanche_c_bpt_supply_changes_daily.sql @@ -0,0 +1,17 @@ +{% set blockchain = 'avalanche_c' %} + +{{ + config( + schema = 'balancer_v2_avalanche_c', + alias = 'bpt_supply_changes_daily', + materialized = 'table', + file_format = 'delta' + ) +}} + +{{ + bpt_supply_changes_daily_agg_macro( + blockchain = blockchain, + version = '2' + ) +}} \ No newline at end of file diff --git a/models/balancer/avalanche_c/balancer_v2_avalanche_c_transfers_bpt.sql b/models/_project/balancer/bpt/avalanche_c/balancer_v2_avalanche_c_transfers_bpt.sql similarity index 100% rename from models/balancer/avalanche_c/balancer_v2_avalanche_c_transfers_bpt.sql rename to models/_project/balancer/bpt/avalanche_c/balancer_v2_avalanche_c_transfers_bpt.sql diff --git a/models/balancer/balancer_bpt_prices.sql b/models/_project/balancer/bpt/balancer_bpt_prices.sql similarity index 69% rename from models/balancer/balancer_bpt_prices.sql rename to models/_project/balancer/bpt/balancer_bpt_prices.sql index ad8502801b9..0a1180a8013 100644 --- a/models/balancer/balancer_bpt_prices.sql +++ b/models/_project/balancer/bpt/balancer_bpt_prices.sql @@ -1,10 +1,10 @@ {{ config( schema = 'balancer', alias = 'bpt_prices', - post_hook='{{ expose_spells(\'["ethereum", "arbitrum", "polygon", "gnosis", "optimism","avalanche_c", "base", "zkevm"]\', - "project", - "balancer", - \'["thetroyharris", "viniabussafi"]\') }}' + post_hook='{{ expose_spells(blockchains = \'["arbitrum", "avalanche_c", "base", "ethereum", "gnosis", "optimism", "polygon", "zkevm"]\', + spell_type = "project", + spell_name = "balancer", + contributors = \'["thetroyharris", "viniabussafi"]\') }}' ) }} diff --git a/models/balancer/balancer_bpt_supply.sql b/models/_project/balancer/bpt/balancer_bpt_supply.sql similarity index 68% rename from models/balancer/balancer_bpt_supply.sql rename to models/_project/balancer/bpt/balancer_bpt_supply.sql index a15ed33c911..e43ef846b55 100644 --- a/models/balancer/balancer_bpt_supply.sql +++ b/models/_project/balancer/bpt/balancer_bpt_supply.sql @@ -1,10 +1,10 @@ {{ config( schema = 'balancer', alias = 'bpt_supply', - post_hook = '{{ expose_spells(\'["arbitrum", "avalanche_c", "base", "ethereum", "gnosis", "optimism", "polygon", "zkevm"]\', - "project", - "balancer", - \'["thetroyharris", "viniabussafi"]\') }}' + post_hook = '{{ expose_spells(blockchains = \'["arbitrum", "avalanche_c", "base", "ethereum", "gnosis", "optimism", "polygon", "zkevm"]\', + spell_type = "project", + spell_name = "balancer", + contributors = \'["thetroyharris", "viniabussafi"]\') }}' ) }} diff --git a/models/_project/balancer/bpt/balancer_bpt_supply_changes.sql b/models/_project/balancer/bpt/balancer_bpt_supply_changes.sql new file mode 100644 index 00000000000..e46a587b3b0 --- /dev/null +++ b/models/_project/balancer/bpt/balancer_bpt_supply_changes.sql @@ -0,0 +1,44 @@ +{{ config( + schema = 'balancer', + alias = 'bpt_supply_changes', + post_hook='{{ expose_spells(blockchains = \'["arbitrum", "avalanche_c", "base", "ethereum", "gnosis", "optimism", "polygon", "zkevm"]\', + spell_type = "project", + spell_name = "balancer", + contributors = \'["viniabussafi"]\') }}' + ) +}} + +{% set balancer_models = [ + ref('balancer_v2_arbitrum_bpt_supply_changes'), + ref('balancer_v2_avalanche_c_bpt_supply_changes'), + ref('balancer_v2_base_bpt_supply_changes'), + ref('balancer_v2_ethereum_bpt_supply_changes'), + ref('balancer_v2_gnosis_bpt_supply_changes'), + ref('balancer_v2_optimism_bpt_supply_changes'), + ref('balancer_v2_polygon_bpt_supply_changes'), + ref('balancer_v2_zkevm_bpt_supply_changes') +] %} + +SELECT * +FROM ( + {% for model in balancer_models %} + SELECT + block_date + , evt_block_time + , evt_block_number + , blockchain + , evt_tx_hash + , evt_index + , pool_type + , pool_symbol + , version + , label + , token_address + , delta_amount_raw + , delta_amount + FROM {{ model }} + {% if not loop.last %} + UNION ALL + {% endif %} + {% endfor %} +) \ No newline at end of file diff --git a/models/_project/balancer/bpt/balancer_bpt_supply_changes_daily.sql b/models/_project/balancer/bpt/balancer_bpt_supply_changes_daily.sql new file mode 100644 index 00000000000..5b593cef48a --- /dev/null +++ b/models/_project/balancer/bpt/balancer_bpt_supply_changes_daily.sql @@ -0,0 +1,38 @@ +{{ config( + schema = 'balancer', + alias = 'bpt_supply_changes_daily', + post_hook='{{ expose_spells(blockchains = \'["arbitrum", "avalanche_c", "base", "ethereum", "gnosis", "optimism", "polygon", "zkevm"]\', + spell_type = "project", + spell_name = "balancer", + contributors = \'["viniabussafi"]\') }}' + ) +}} + +{% set balancer_models = [ + ref('balancer_v2_arbitrum_bpt_supply_changes_daily'), + ref('balancer_v2_avalanche_c_bpt_supply_changes_daily'), + ref('balancer_v2_base_bpt_supply_changes_daily'), + ref('balancer_v2_ethereum_bpt_supply_changes_daily'), + ref('balancer_v2_gnosis_bpt_supply_changes_daily'), + ref('balancer_v2_optimism_bpt_supply_changes_daily'), + ref('balancer_v2_polygon_bpt_supply_changes_daily'), + ref('balancer_v2_zkevm_bpt_supply_changes_daily') +] %} + +SELECT * +FROM ( + {% for model in balancer_models %} + SELECT + block_date + , blockchain + , pool_type + , pool_symbol + , version + , token_address + , daily_delta + FROM {{ model }} + {% if not loop.last %} + UNION ALL + {% endif %} + {% endfor %} +) \ No newline at end of file diff --git a/models/balancer/balancer_transfers_bpt.sql b/models/_project/balancer/bpt/balancer_transfers_bpt.sql similarity index 70% rename from models/balancer/balancer_transfers_bpt.sql rename to models/_project/balancer/bpt/balancer_transfers_bpt.sql index bd6fe9064c5..dda9c32ecb1 100644 --- a/models/balancer/balancer_transfers_bpt.sql +++ b/models/_project/balancer/bpt/balancer_transfers_bpt.sql @@ -1,10 +1,10 @@ {{ config( schema = 'balancer', alias = 'transfers_bpt', - post_hook='{{ expose_spells(\'["arbitrum", "avalanche_c", "base", "ethereum", "gnosis", "optimism", "polygon", "zkevm"]\', - "project", - "balancer", - \'["thetroyharris", "victorstefenon", "viniabussafi"]\') }}' + post_hook='{{ expose_spells(blockchains = \'["arbitrum", "avalanche_c", "base", "ethereum", "gnosis", "optimism", "polygon", "zkevm"]\', + spell_type = "project", + spell_name = "balancer", + contributors = \'["thetroyharris", "victorstefenon", "viniabussafi"]\') }}' ) }} diff --git a/models/_project/balancer/bpt/base/_schema.yml b/models/_project/balancer/bpt/base/_schema.yml new file mode 100644 index 00000000000..a32b805f7e2 --- /dev/null +++ b/models/_project/balancer/bpt/base/_schema.yml @@ -0,0 +1,178 @@ +version: 2 + +models: + - name: balancer_v2_base_transfers_bpt + meta: + blockchain: base + project: balancer_v2 + contributors: victorstefenon, thetroyharris, viniabussafi + config: + tags: ['base', 'bpt', 'transfers'] + description: > + Balancer Pool Token (BPT) transfer logs on Balancer, an automated portfolio manager and trading platform, on base. + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - evt_tx_hash + - evt_index + - block_date + columns: + - &blockchain + name: blockchain + description: "Blockchain" + - &version + name: version + description: "Version of Balancer where the liquidity pool used in transaction is deployed" + - &contract_address + name: contract_address + description: 'base address for the liquidity pool used in transaction' + - &block_date + name: block_date + description: "UTC event block date of each DEX trade" + - &block_month + name: block_month + description: "UTC event block month of each DEX trade" + - &evt_tx_hash + name: evt_tx_hash + description: 'Transaction hash of transfer event' + - &evt_index + name: evt_index + description: 'Event index' + - &evt_block_time + name: evt_block_time + description: 'Block time of transfer event' + - &evt_block_number + name: evt_block_number + description: 'Block number of transfer event' + - &from + name: from + description: 'Address of BPT provider of transfer event' + - &to + name: to + description: 'Address of BPT receiver of transfer event' + - &value + name: value + description: 'Amount of BPT transferred in transfer event' + + - name: balancer_v2_base_bpt_prices + meta: + blockchain: base + project: balancer_v2 + contributors: victorstefenon, thetroyharris, viniabussafi + config: + tags: ['base', 'bpt', 'prices'] + description: > + Balancer Pool Token (BPT) daily price by pool on Balancer, an automated portfolio manager and trading platform. + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - blockchain + - day + - contract_address + columns: + - *blockchain + - &day + name: day + description: "Block date in UTC" + - *version + - &decimals + name: decimals + description: "Token decimals. 18, by default, on BPTs" + - *contract_address + - &bpt_price + name: bpt_price + description: "Price of the BPT" + + - name: balancer_v2_base_bpt_supply + meta: + blockchain: base + project: balancer_v2 + contributors: thetroyharris, viniabussafi + config: + tags: ['base', 'bpt', 'supply'] + description: > + Balancer Pool Token (BPT) supply by pool on Balancer, an automated portfolio manager and trading platform. + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - day + - blockchain + - token_address + columns: + - *day + - &pool_type + name: pool_type + description: "Pool attributes, determined by the pool's factory" + - *version + - *blockchain + - &token_address + name: token_address + description: "Contract address of the BPT" + - &supply + name: supply + description: "Supply of the BPT, discounted of premints" + + - name: balancer_v2_base_bpt_supply_changes + meta: + blockchain: base + project: balancer_v2 + contributors: viniabussafi + config: + tags: ['base', 'bpt', 'supply', 'changes'] + description: > + Balancer Pool Token (BPT) supply change events. + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - block_date + - evt_tx_hash + - evt_index + - label + columns: + - *block_date + - *evt_block_time + - *evt_block_number + - *blockchain + - *evt_tx_hash + - *evt_index + - *pool_type + - &pool_symbol + name: pool_symbol + description: "Token symbols, followed by their respective weights, if applicable" + - *version + - &label + name: label + description: "Nature of the transaction (Join/Exit via swap or Mint/Burn via transfer)" + - *token_address + - &delta_amount_raw + name: delta_amount_raw + description: "Raw value of the transaction on token supply at the time of execution in the original currency" + - &delta_amount + name: delta_amount + description: "Normalized value of the transaction on token supply at the time of execution in the original currency" + + - name: balancer_v2_base_bpt_supply_changes_daily + meta: + blockchain: base + project: balancer_v2 + contributors: viniabussafi + config: + tags: ['base', 'bpt', 'supply', 'changes'] + description: > + Balancer Pool Token (BPT) supply change events. grouped by day + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - block_date + - blockchain + - token_address + columns: + - *block_date + - *blockchain + - *pool_type + - *pool_symbol + - *version + - *token_address + - &daily_delta + name: daily_delta + description: "Daily total impact on BPT supply" \ No newline at end of file diff --git a/models/balancer/base/balancer_v2_base_bpt_prices.sql b/models/_project/balancer/bpt/base/balancer_v2_base_bpt_prices.sql similarity index 100% rename from models/balancer/base/balancer_v2_base_bpt_prices.sql rename to models/_project/balancer/bpt/base/balancer_v2_base_bpt_prices.sql diff --git a/models/balancer/base/balancer_v2_base_bpt_supply.sql b/models/_project/balancer/bpt/base/balancer_v2_base_bpt_supply.sql similarity index 100% rename from models/balancer/base/balancer_v2_base_bpt_supply.sql rename to models/_project/balancer/bpt/base/balancer_v2_base_bpt_supply.sql diff --git a/models/_project/balancer/bpt/base/balancer_v2_base_bpt_supply_changes.sql b/models/_project/balancer/bpt/base/balancer_v2_base_bpt_supply_changes.sql new file mode 100644 index 00000000000..1d273f4e49e --- /dev/null +++ b/models/_project/balancer/bpt/base/balancer_v2_base_bpt_supply_changes.sql @@ -0,0 +1,20 @@ +{% set blockchain = 'base' %} + +{{ + config( + schema = 'balancer_v2_base', + alias = 'bpt_supply_changes', + materialized = 'incremental', + file_format = 'delta', + incremental_strategy = 'merge', + unique_key = ['block_date', 'evt_tx_hash', 'evt_index', 'label'], + incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.evt_block_time')] + ) +}} + +{{ + bpt_supply_changes_macro( + blockchain = blockchain, + version = '2' + ) +}} \ No newline at end of file diff --git a/models/_project/balancer/bpt/base/balancer_v2_base_bpt_supply_changes_daily.sql b/models/_project/balancer/bpt/base/balancer_v2_base_bpt_supply_changes_daily.sql new file mode 100644 index 00000000000..b90fdf94033 --- /dev/null +++ b/models/_project/balancer/bpt/base/balancer_v2_base_bpt_supply_changes_daily.sql @@ -0,0 +1,17 @@ +{% set blockchain = 'base' %} + +{{ + config( + schema = 'balancer_v2_base', + alias = 'bpt_supply_changes_daily', + materialized = 'table', + file_format = 'delta' + ) +}} + +{{ + bpt_supply_changes_daily_agg_macro( + blockchain = blockchain, + version = '2' + ) +}} \ No newline at end of file diff --git a/models/balancer/base/balancer_v2_base_transfers_bpt.sql b/models/_project/balancer/bpt/base/balancer_v2_base_transfers_bpt.sql similarity index 100% rename from models/balancer/base/balancer_v2_base_transfers_bpt.sql rename to models/_project/balancer/bpt/base/balancer_v2_base_transfers_bpt.sql diff --git a/models/_project/balancer/bpt/ethereum/_schema.yml b/models/_project/balancer/bpt/ethereum/_schema.yml new file mode 100644 index 00000000000..aa54846a5f3 --- /dev/null +++ b/models/_project/balancer/bpt/ethereum/_schema.yml @@ -0,0 +1,178 @@ +version: 2 + +models: + - name: balancer_v2_ethereum_transfers_bpt + meta: + blockchain: ethereum + project: balancer_v2 + contributors: victorstefenon, thetroyharris, viniabussafi + config: + tags: ['ethereum', 'bpt', 'transfers'] + description: > + Balancer Pool Token (BPT) transfer logs on Balancer, an automated portfolio manager and trading platform, on ethereum. + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - evt_tx_hash + - evt_index + - block_date + columns: + - &blockchain + name: blockchain + description: "Blockchain" + - &version + name: version + description: "Version of Balancer where the liquidity pool used in transaction is deployed" + - &contract_address + name: contract_address + description: 'ethereum address for the liquidity pool used in transaction' + - &block_date + name: block_date + description: "UTC event block date of each DEX trade" + - &block_month + name: block_month + description: "UTC event block month of each DEX trade" + - &evt_tx_hash + name: evt_tx_hash + description: 'Transaction hash of transfer event' + - &evt_index + name: evt_index + description: 'Event index' + - &evt_block_time + name: evt_block_time + description: 'Block time of transfer event' + - &evt_block_number + name: evt_block_number + description: 'Block number of transfer event' + - &from + name: from + description: 'Address of BPT provider of transfer event' + - &to + name: to + description: 'Address of BPT receiver of transfer event' + - &value + name: value + description: 'Amount of BPT transferred in transfer event' + + - name: balancer_v2_ethereum_bpt_prices + meta: + blockchain: ethereum + project: balancer_v2 + contributors: victorstefenon, thetroyharris, viniabussafi + config: + tags: ['ethereum', 'bpt', 'prices'] + description: > + Balancer Pool Token (BPT) daily price by pool on Balancer, an automated portfolio manager and trading platform. + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - blockchain + - day + - contract_address + columns: + - *blockchain + - &day + name: day + description: "Block date in UTC" + - *version + - &decimals + name: decimals + description: "Token decimals. 18, by default, on BPTs" + - *contract_address + - &bpt_price + name: bpt_price + description: "Price of the BPT" + + - name: balancer_v2_ethereum_bpt_supply + meta: + blockchain: ethereum + project: balancer_v2 + contributors: thetroyharris, viniabussafi + config: + tags: ['ethereum', 'bpt', 'supply'] + description: > + Balancer Pool Token (BPT) supply by pool on Balancer, an automated portfolio manager and trading platform. + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - day + - blockchain + - token_address + columns: + - *day + - &pool_type + name: pool_type + description: "Pool attributes, determined by the pool's factory" + - *version + - *blockchain + - &token_address + name: token_address + description: "Contract address of the BPT" + - &supply + name: supply + description: "Supply of the BPT, discounted of premints" + + - name: balancer_v2_ethereum_bpt_supply_changes + meta: + blockchain: ethereum + project: balancer_v2 + contributors: viniabussafi + config: + tags: ['ethereum', 'bpt', 'supply', 'changes'] + description: > + Balancer Pool Token (BPT) supply change events. + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - block_date + - evt_tx_hash + - evt_index + - label + columns: + - *block_date + - *evt_block_time + - *evt_block_number + - *blockchain + - *evt_tx_hash + - *evt_index + - *pool_type + - &pool_symbol + name: pool_symbol + description: "Token symbols, followed by their respective weights, if applicable" + - *version + - &label + name: label + description: "Nature of the transaction (Join/Exit via swap or Mint/Burn via transfer)" + - *token_address + - &delta_amount_raw + name: delta_amount_raw + description: "Raw value of the transaction on token supply at the time of execution in the original currency" + - &delta_amount + name: delta_amount + description: "Normalized value of the transaction on token supply at the time of execution in the original currency" + + - name: balancer_v2_ethereum_bpt_supply_changes_daily + meta: + blockchain: ethereum + project: balancer_v2 + contributors: viniabussafi + config: + tags: ['ethereum', 'bpt', 'supply', 'changes'] + description: > + Balancer Pool Token (BPT) supply change events. grouped by day + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - block_date + - blockchain + - token_address + columns: + - *block_date + - *blockchain + - *pool_type + - *pool_symbol + - *version + - *token_address + - &daily_delta + name: daily_delta + description: "Daily total impact on BPT supply" \ No newline at end of file diff --git a/models/balancer/ethereum/balancer_v2_ethereum_bpt_prices.sql b/models/_project/balancer/bpt/ethereum/balancer_v2_ethereum_bpt_prices.sql similarity index 100% rename from models/balancer/ethereum/balancer_v2_ethereum_bpt_prices.sql rename to models/_project/balancer/bpt/ethereum/balancer_v2_ethereum_bpt_prices.sql diff --git a/models/balancer/ethereum/balancer_v2_ethereum_bpt_supply.sql b/models/_project/balancer/bpt/ethereum/balancer_v2_ethereum_bpt_supply.sql similarity index 100% rename from models/balancer/ethereum/balancer_v2_ethereum_bpt_supply.sql rename to models/_project/balancer/bpt/ethereum/balancer_v2_ethereum_bpt_supply.sql diff --git a/models/_project/balancer/bpt/ethereum/balancer_v2_ethereum_bpt_supply_changes.sql b/models/_project/balancer/bpt/ethereum/balancer_v2_ethereum_bpt_supply_changes.sql new file mode 100644 index 00000000000..1fa7db6b904 --- /dev/null +++ b/models/_project/balancer/bpt/ethereum/balancer_v2_ethereum_bpt_supply_changes.sql @@ -0,0 +1,20 @@ +{% set blockchain = 'ethereum' %} + +{{ + config( + schema = 'balancer_v2_ethereum', + alias = 'bpt_supply_changes', + materialized = 'incremental', + file_format = 'delta', + incremental_strategy = 'merge', + unique_key = ['block_date', 'evt_tx_hash', 'evt_index', 'label'], + incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.evt_block_time')] + ) +}} + +{{ + bpt_supply_changes_macro( + blockchain = blockchain, + version = '2' + ) +}} \ No newline at end of file diff --git a/models/_project/balancer/bpt/ethereum/balancer_v2_ethereum_bpt_supply_changes_daily.sql b/models/_project/balancer/bpt/ethereum/balancer_v2_ethereum_bpt_supply_changes_daily.sql new file mode 100644 index 00000000000..74d3be91fdf --- /dev/null +++ b/models/_project/balancer/bpt/ethereum/balancer_v2_ethereum_bpt_supply_changes_daily.sql @@ -0,0 +1,17 @@ +{% set blockchain = 'arbitrum' %} + +{{ + config( + schema = 'balancer_v2_arbitrum', + alias = 'bpt_supply_changes_daily', + materialized = 'table', + file_format = 'delta' + ) +}} + +{{ + bpt_supply_changes_daily_agg_macro( + blockchain = blockchain, + version = '2' + ) +}} \ No newline at end of file diff --git a/models/balancer/ethereum/balancer_v2_ethereum_transfers_bpt.sql b/models/_project/balancer/bpt/ethereum/balancer_v2_ethereum_transfers_bpt.sql similarity index 100% rename from models/balancer/ethereum/balancer_v2_ethereum_transfers_bpt.sql rename to models/_project/balancer/bpt/ethereum/balancer_v2_ethereum_transfers_bpt.sql diff --git a/models/_project/balancer/bpt/gnosis/_schema.yml b/models/_project/balancer/bpt/gnosis/_schema.yml new file mode 100644 index 00000000000..aae23d80a8a --- /dev/null +++ b/models/_project/balancer/bpt/gnosis/_schema.yml @@ -0,0 +1,178 @@ +version: 2 + +models: + - name: balancer_v2_gnosis_transfers_bpt + meta: + blockchain: gnosis + project: balancer_v2 + contributors: victorstefenon, thetroyharris, viniabussafi + config: + tags: ['gnosis', 'bpt', 'transfers'] + description: > + Balancer Pool Token (BPT) transfer logs on Balancer, an automated portfolio manager and trading platform, on gnosis. + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - evt_tx_hash + - evt_index + - block_date + columns: + - &blockchain + name: blockchain + description: "Blockchain" + - &version + name: version + description: "Version of Balancer where the liquidity pool used in transaction is deployed" + - &contract_address + name: contract_address + description: 'gnosis address for the liquidity pool used in transaction' + - &block_date + name: block_date + description: "UTC event block date of each DEX trade" + - &block_month + name: block_month + description: "UTC event block month of each DEX trade" + - &evt_tx_hash + name: evt_tx_hash + description: 'Transaction hash of transfer event' + - &evt_index + name: evt_index + description: 'Event index' + - &evt_block_time + name: evt_block_time + description: 'Block time of transfer event' + - &evt_block_number + name: evt_block_number + description: 'Block number of transfer event' + - &from + name: from + description: 'Address of BPT provider of transfer event' + - &to + name: to + description: 'Address of BPT receiver of transfer event' + - &value + name: value + description: 'Amount of BPT transferred in transfer event' + + - name: balancer_v2_gnosis_bpt_prices + meta: + blockchain: gnosis + project: balancer_v2 + contributors: victorstefenon, thetroyharris, viniabussafi + config: + tags: ['gnosis', 'bpt', 'prices'] + description: > + Balancer Pool Token (BPT) daily price by pool on Balancer, an automated portfolio manager and trading platform. + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - blockchain + - day + - contract_address + columns: + - *blockchain + - &day + name: day + description: "Block date in UTC" + - *version + - &decimals + name: decimals + description: "Token decimals. 18, by default, on BPTs" + - *contract_address + - &bpt_price + name: bpt_price + description: "Price of the BPT" + + - name: balancer_v2_gnosis_bpt_supply + meta: + blockchain: gnosis + project: balancer_v2 + contributors: thetroyharris, viniabussafi + config: + tags: ['gnosis', 'bpt', 'supply'] + description: > + Balancer Pool Token (BPT) supply by pool on Balancer, an automated portfolio manager and trading platform. + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - day + - blockchain + - token_address + columns: + - *day + - &pool_type + name: pool_type + description: "Pool attributes, determined by the pool's factory" + - *version + - *blockchain + - &token_address + name: token_address + description: "Contract address of the BPT" + - &supply + name: supply + description: "Supply of the BPT, discounted of premints" + + - name: balancer_v2_gnosis_bpt_supply_changes + meta: + blockchain: gnosis + project: balancer_v2 + contributors: viniabussafi + config: + tags: ['gnosis', 'bpt', 'supply', 'changes'] + description: > + Balancer Pool Token (BPT) supply change events. + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - block_date + - evt_tx_hash + - evt_index + - label + columns: + - *block_date + - *evt_block_time + - *evt_block_number + - *blockchain + - *evt_tx_hash + - *evt_index + - *pool_type + - &pool_symbol + name: pool_symbol + description: "Token symbols, followed by their respective weights, if applicable" + - *version + - &label + name: label + description: "Nature of the transaction (Join/Exit via swap or Mint/Burn via transfer)" + - *token_address + - &delta_amount_raw + name: delta_amount_raw + description: "Raw value of the transaction on token supply at the time of execution in the original currency" + - &delta_amount + name: delta_amount + description: "Normalized value of the transaction on token supply at the time of execution in the original currency" + + - name: balancer_v2_gnosis_bpt_supply_changes_daily + meta: + blockchain: gnosis + project: balancer_v2 + contributors: viniabussafi + config: + tags: ['gnosis', 'bpt', 'supply', 'changes'] + description: > + Balancer Pool Token (BPT) supply change events. grouped by day + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - block_date + - blockchain + - token_address + columns: + - *block_date + - *blockchain + - *pool_type + - *pool_symbol + - *version + - *token_address + - &daily_delta + name: daily_delta + description: "Daily total impact on BPT supply" \ No newline at end of file diff --git a/models/balancer/gnosis/balancer_v2_gnosis_bpt_prices.sql b/models/_project/balancer/bpt/gnosis/balancer_v2_gnosis_bpt_prices.sql similarity index 100% rename from models/balancer/gnosis/balancer_v2_gnosis_bpt_prices.sql rename to models/_project/balancer/bpt/gnosis/balancer_v2_gnosis_bpt_prices.sql diff --git a/models/balancer/gnosis/balancer_v2_gnosis_bpt_supply.sql b/models/_project/balancer/bpt/gnosis/balancer_v2_gnosis_bpt_supply.sql similarity index 100% rename from models/balancer/gnosis/balancer_v2_gnosis_bpt_supply.sql rename to models/_project/balancer/bpt/gnosis/balancer_v2_gnosis_bpt_supply.sql diff --git a/models/_project/balancer/bpt/gnosis/balancer_v2_gnosis_bpt_supply_changes.sql b/models/_project/balancer/bpt/gnosis/balancer_v2_gnosis_bpt_supply_changes.sql new file mode 100644 index 00000000000..fd1539a9495 --- /dev/null +++ b/models/_project/balancer/bpt/gnosis/balancer_v2_gnosis_bpt_supply_changes.sql @@ -0,0 +1,20 @@ +{% set blockchain = 'gnosis' %} + +{{ + config( + schema = 'balancer_v2_gnosis', + alias = 'bpt_supply_changes', + materialized = 'incremental', + file_format = 'delta', + incremental_strategy = 'merge', + unique_key = ['block_date', 'evt_tx_hash', 'evt_index', 'label'], + incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.evt_block_time')] + ) +}} + +{{ + bpt_supply_changes_macro( + blockchain = blockchain, + version = '2' + ) +}} \ No newline at end of file diff --git a/models/_project/balancer/bpt/gnosis/balancer_v2_gnosis_bpt_supply_changes_daily.sql b/models/_project/balancer/bpt/gnosis/balancer_v2_gnosis_bpt_supply_changes_daily.sql new file mode 100644 index 00000000000..516f2e2dc0c --- /dev/null +++ b/models/_project/balancer/bpt/gnosis/balancer_v2_gnosis_bpt_supply_changes_daily.sql @@ -0,0 +1,17 @@ +{% set blockchain = 'gnosis' %} + +{{ + config( + schema = 'balancer_v2_gnosis', + alias = 'bpt_supply_changes_daily', + materialized = 'table', + file_format = 'delta' + ) +}} + +{{ + bpt_supply_changes_daily_agg_macro( + blockchain = blockchain, + version = '2' + ) +}} \ No newline at end of file diff --git a/models/balancer/gnosis/balancer_v2_gnosis_transfers_bpt.sql b/models/_project/balancer/bpt/gnosis/balancer_v2_gnosis_transfers_bpt.sql similarity index 100% rename from models/balancer/gnosis/balancer_v2_gnosis_transfers_bpt.sql rename to models/_project/balancer/bpt/gnosis/balancer_v2_gnosis_transfers_bpt.sql diff --git a/models/_project/balancer/bpt/optimism/_schema.yml b/models/_project/balancer/bpt/optimism/_schema.yml new file mode 100644 index 00000000000..746fd32e9da --- /dev/null +++ b/models/_project/balancer/bpt/optimism/_schema.yml @@ -0,0 +1,178 @@ +version: 2 + +models: + - name: balancer_v2_optimism_transfers_bpt + meta: + blockchain: optimism + project: balancer_v2 + contributors: victorstefenon, thetroyharris, viniabussafi + config: + tags: ['optimism', 'bpt', 'transfers'] + description: > + Balancer Pool Token (BPT) transfer logs on Balancer, an automated portfolio manager and trading platform, on optimism. + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - evt_tx_hash + - evt_index + - block_date + columns: + - &blockchain + name: blockchain + description: "Blockchain" + - &version + name: version + description: "Version of Balancer where the liquidity pool used in transaction is deployed" + - &contract_address + name: contract_address + description: 'optimism address for the liquidity pool used in transaction' + - &block_date + name: block_date + description: "UTC event block date of each DEX trade" + - &block_month + name: block_month + description: "UTC event block month of each DEX trade" + - &evt_tx_hash + name: evt_tx_hash + description: 'Transaction hash of transfer event' + - &evt_index + name: evt_index + description: 'Event index' + - &evt_block_time + name: evt_block_time + description: 'Block time of transfer event' + - &evt_block_number + name: evt_block_number + description: 'Block number of transfer event' + - &from + name: from + description: 'Address of BPT provider of transfer event' + - &to + name: to + description: 'Address of BPT receiver of transfer event' + - &value + name: value + description: 'Amount of BPT transferred in transfer event' + + - name: balancer_v2_optimism_bpt_prices + meta: + blockchain: optimism + project: balancer_v2 + contributors: victorstefenon, thetroyharris, viniabussafi + config: + tags: ['optimism', 'bpt', 'prices'] + description: > + Balancer Pool Token (BPT) daily price by pool on Balancer, an automated portfolio manager and trading platform. + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - blockchain + - day + - contract_address + columns: + - *blockchain + - &day + name: day + description: "Block date in UTC" + - *version + - &decimals + name: decimals + description: "Token decimals. 18, by default, on BPTs" + - *contract_address + - &bpt_price + name: bpt_price + description: "Price of the BPT" + + - name: balancer_v2_optimism_bpt_supply + meta: + blockchain: optimism + project: balancer_v2 + contributors: thetroyharris, viniabussafi + config: + tags: ['optimism', 'bpt', 'supply'] + description: > + Balancer Pool Token (BPT) supply by pool on Balancer, an automated portfolio manager and trading platform. + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - day + - blockchain + - token_address + columns: + - *day + - &pool_type + name: pool_type + description: "Pool attributes, determined by the pool's factory" + - *version + - *blockchain + - &token_address + name: token_address + description: "Contract address of the BPT" + - &supply + name: supply + description: "Supply of the BPT, discounted of premints" + + - name: balancer_v2_optimism_bpt_supply_changes + meta: + blockchain: optimism + project: balancer_v2 + contributors: viniabussafi + config: + tags: ['optimism', 'bpt', 'supply', 'changes'] + description: > + Balancer Pool Token (BPT) supply change events. + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - block_date + - evt_tx_hash + - evt_index + - label + columns: + - *block_date + - *evt_block_time + - *evt_block_number + - *blockchain + - *evt_tx_hash + - *evt_index + - *pool_type + - &pool_symbol + name: pool_symbol + description: "Token symbols, followed by their respective weights, if applicable" + - *version + - &label + name: label + description: "Nature of the transaction (Join/Exit via swap or Mint/Burn via transfer)" + - *token_address + - &delta_amount_raw + name: delta_amount_raw + description: "Raw value of the transaction on token supply at the time of execution in the original currency" + - &delta_amount + name: delta_amount + description: "Normalized value of the transaction on token supply at the time of execution in the original currency" + + - name: balancer_v2_optimism_bpt_supply_changes_daily + meta: + blockchain: optimism + project: balancer_v2 + contributors: viniabussafi + config: + tags: ['optimism', 'bpt', 'supply', 'changes'] + description: > + Balancer Pool Token (BPT) supply change events. grouped by day + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - block_date + - blockchain + - token_address + columns: + - *block_date + - *blockchain + - *pool_type + - *pool_symbol + - *version + - *token_address + - &daily_delta + name: daily_delta + description: "Daily total impact on BPT supply" \ No newline at end of file diff --git a/models/balancer/optimism/balancer_v2_optimism_bpt_prices.sql b/models/_project/balancer/bpt/optimism/balancer_v2_optimism_bpt_prices.sql similarity index 100% rename from models/balancer/optimism/balancer_v2_optimism_bpt_prices.sql rename to models/_project/balancer/bpt/optimism/balancer_v2_optimism_bpt_prices.sql diff --git a/models/balancer/optimism/balancer_v2_optimism_bpt_supply.sql b/models/_project/balancer/bpt/optimism/balancer_v2_optimism_bpt_supply.sql similarity index 100% rename from models/balancer/optimism/balancer_v2_optimism_bpt_supply.sql rename to models/_project/balancer/bpt/optimism/balancer_v2_optimism_bpt_supply.sql diff --git a/models/_project/balancer/bpt/optimism/balancer_v2_optimism_bpt_supply_changes.sql b/models/_project/balancer/bpt/optimism/balancer_v2_optimism_bpt_supply_changes.sql new file mode 100644 index 00000000000..225b00465db --- /dev/null +++ b/models/_project/balancer/bpt/optimism/balancer_v2_optimism_bpt_supply_changes.sql @@ -0,0 +1,20 @@ +{% set blockchain = 'optimism' %} + +{{ + config( + schema = 'balancer_v2_optimism', + alias = 'bpt_supply_changes', + materialized = 'incremental', + file_format = 'delta', + incremental_strategy = 'merge', + unique_key = ['block_date', 'evt_tx_hash', 'evt_index', 'label'], + incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.evt_block_time')] + ) +}} + +{{ + bpt_supply_changes_macro( + blockchain = blockchain, + version = '2' + ) +}} \ No newline at end of file diff --git a/models/_project/balancer/bpt/optimism/balancer_v2_optimism_bpt_supply_changes_daily.sql b/models/_project/balancer/bpt/optimism/balancer_v2_optimism_bpt_supply_changes_daily.sql new file mode 100644 index 00000000000..f816df8d206 --- /dev/null +++ b/models/_project/balancer/bpt/optimism/balancer_v2_optimism_bpt_supply_changes_daily.sql @@ -0,0 +1,17 @@ +{% set blockchain = 'optimism' %} + +{{ + config( + schema = 'balancer_v2_optimism', + alias = 'bpt_supply_changes_daily', + materialized = 'table', + file_format = 'delta' + ) +}} + +{{ + bpt_supply_changes_daily_agg_macro( + blockchain = blockchain, + version = '2' + ) +}} \ No newline at end of file diff --git a/models/balancer/optimism/balancer_v2_optimism_transfers_bpt.sql b/models/_project/balancer/bpt/optimism/balancer_v2_optimism_transfers_bpt.sql similarity index 100% rename from models/balancer/optimism/balancer_v2_optimism_transfers_bpt.sql rename to models/_project/balancer/bpt/optimism/balancer_v2_optimism_transfers_bpt.sql diff --git a/models/_project/balancer/bpt/polygon/_schema.yml b/models/_project/balancer/bpt/polygon/_schema.yml new file mode 100644 index 00000000000..3e0b5c419f6 --- /dev/null +++ b/models/_project/balancer/bpt/polygon/_schema.yml @@ -0,0 +1,178 @@ +version: 2 + +models: + - name: balancer_v2_polygon_transfers_bpt + meta: + blockchain: polygon + project: balancer_v2 + contributors: victorstefenon, thetroyharris, viniabussafi + config: + tags: ['polygon', 'bpt', 'transfers'] + description: > + Balancer Pool Token (BPT) transfer logs on Balancer, an automated portfolio manager and trading platform, on polygon. + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - evt_tx_hash + - evt_index + - block_date + columns: + - &blockchain + name: blockchain + description: "Blockchain" + - &version + name: version + description: "Version of Balancer where the liquidity pool used in transaction is deployed" + - &contract_address + name: contract_address + description: 'polygon address for the liquidity pool used in transaction' + - &block_date + name: block_date + description: "UTC event block date of each DEX trade" + - &block_month + name: block_month + description: "UTC event block month of each DEX trade" + - &evt_tx_hash + name: evt_tx_hash + description: 'Transaction hash of transfer event' + - &evt_index + name: evt_index + description: 'Event index' + - &evt_block_time + name: evt_block_time + description: 'Block time of transfer event' + - &evt_block_number + name: evt_block_number + description: 'Block number of transfer event' + - &from + name: from + description: 'Address of BPT provider of transfer event' + - &to + name: to + description: 'Address of BPT receiver of transfer event' + - &value + name: value + description: 'Amount of BPT transferred in transfer event' + + - name: balancer_v2_polygon_bpt_prices + meta: + blockchain: polygon + project: balancer_v2 + contributors: victorstefenon, thetroyharris, viniabussafi + config: + tags: ['polygon', 'bpt', 'prices'] + description: > + Balancer Pool Token (BPT) daily price by pool on Balancer, an automated portfolio manager and trading platform. + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - blockchain + - day + - contract_address + columns: + - *blockchain + - &day + name: day + description: "Block date in UTC" + - *version + - &decimals + name: decimals + description: "Token decimals. 18, by default, on BPTs" + - *contract_address + - &bpt_price + name: bpt_price + description: "Price of the BPT" + + - name: balancer_v2_polygon_bpt_supply + meta: + blockchain: polygon + project: balancer_v2 + contributors: thetroyharris, viniabussafi + config: + tags: ['polygon', 'bpt', 'supply'] + description: > + Balancer Pool Token (BPT) supply by pool on Balancer, an automated portfolio manager and trading platform. + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - day + - blockchain + - token_address + columns: + - *day + - &pool_type + name: pool_type + description: "Pool attributes, determined by the pool's factory" + - *version + - *blockchain + - &token_address + name: token_address + description: "Contract address of the BPT" + - &supply + name: supply + description: "Supply of the BPT, discounted of premints" + + - name: balancer_v2_polygon_bpt_supply_changes + meta: + blockchain: polygon + project: balancer_v2 + contributors: viniabussafi + config: + tags: ['polygon', 'bpt', 'supply', 'changes'] + description: > + Balancer Pool Token (BPT) supply change events. + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - block_date + - evt_tx_hash + - evt_index + - label + columns: + - *block_date + - *evt_block_time + - *evt_block_number + - *blockchain + - *evt_tx_hash + - *evt_index + - *pool_type + - &pool_symbol + name: pool_symbol + description: "Token symbols, followed by their respective weights, if applicable" + - *version + - &label + name: label + description: "Nature of the transaction (Join/Exit via swap or Mint/Burn via transfer)" + - *token_address + - &delta_amount_raw + name: delta_amount_raw + description: "Raw value of the transaction on token supply at the time of execution in the original currency" + - &delta_amount + name: delta_amount + description: "Normalized value of the transaction on token supply at the time of execution in the original currency" + + - name: balancer_v2_polygon_bpt_supply_changes_daily + meta: + blockchain: polygon + project: balancer_v2 + contributors: viniabussafi + config: + tags: ['polygon', 'bpt', 'supply', 'changes'] + description: > + Balancer Pool Token (BPT) supply change events. grouped by day + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - block_date + - blockchain + - token_address + columns: + - *block_date + - *blockchain + - *pool_type + - *pool_symbol + - *version + - *token_address + - &daily_delta + name: daily_delta + description: "Daily total impact on BPT supply" \ No newline at end of file diff --git a/models/balancer/polygon/balancer_v2_polygon_bpt_prices.sql b/models/_project/balancer/bpt/polygon/balancer_v2_polygon_bpt_prices.sql similarity index 100% rename from models/balancer/polygon/balancer_v2_polygon_bpt_prices.sql rename to models/_project/balancer/bpt/polygon/balancer_v2_polygon_bpt_prices.sql diff --git a/models/balancer/polygon/balancer_v2_polygon_bpt_supply.sql b/models/_project/balancer/bpt/polygon/balancer_v2_polygon_bpt_supply.sql similarity index 100% rename from models/balancer/polygon/balancer_v2_polygon_bpt_supply.sql rename to models/_project/balancer/bpt/polygon/balancer_v2_polygon_bpt_supply.sql diff --git a/models/_project/balancer/bpt/polygon/balancer_v2_polygon_bpt_supply_changes.sql b/models/_project/balancer/bpt/polygon/balancer_v2_polygon_bpt_supply_changes.sql new file mode 100644 index 00000000000..7ff8034b96b --- /dev/null +++ b/models/_project/balancer/bpt/polygon/balancer_v2_polygon_bpt_supply_changes.sql @@ -0,0 +1,20 @@ +{% set blockchain = 'polygon' %} + +{{ + config( + schema = 'balancer_v2_polygon', + alias = 'bpt_supply_changes', + materialized = 'incremental', + file_format = 'delta', + incremental_strategy = 'merge', + unique_key = ['block_date', 'evt_tx_hash', 'evt_index', 'label'], + incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.evt_block_time')] + ) +}} + +{{ + bpt_supply_changes_macro( + blockchain = blockchain, + version = '2' + ) +}} \ No newline at end of file diff --git a/models/_project/balancer/bpt/polygon/balancer_v2_polygon_bpt_supply_changes_daily.sql b/models/_project/balancer/bpt/polygon/balancer_v2_polygon_bpt_supply_changes_daily.sql new file mode 100644 index 00000000000..57615beb139 --- /dev/null +++ b/models/_project/balancer/bpt/polygon/balancer_v2_polygon_bpt_supply_changes_daily.sql @@ -0,0 +1,17 @@ +{% set blockchain = 'polygon' %} + +{{ + config( + schema = 'balancer_v2_polygon', + alias = 'bpt_supply_changes_daily', + materialized = 'table', + file_format = 'delta' + ) +}} + +{{ + bpt_supply_changes_daily_agg_macro( + blockchain = blockchain, + version = '2' + ) +}} \ No newline at end of file diff --git a/models/balancer/polygon/balancer_v2_polygon_transfers_bpt.sql b/models/_project/balancer/bpt/polygon/balancer_v2_polygon_transfers_bpt.sql similarity index 100% rename from models/balancer/polygon/balancer_v2_polygon_transfers_bpt.sql rename to models/_project/balancer/bpt/polygon/balancer_v2_polygon_transfers_bpt.sql diff --git a/models/_project/balancer/bpt/zkevm/_schema.yml b/models/_project/balancer/bpt/zkevm/_schema.yml new file mode 100644 index 00000000000..fbdd80ddb56 --- /dev/null +++ b/models/_project/balancer/bpt/zkevm/_schema.yml @@ -0,0 +1,178 @@ +version: 2 + +models: + - name: balancer_v2_zkevm_transfers_bpt + meta: + blockchain: zkevm + project: balancer_v2 + contributors: victorstefenon, thetroyharris, viniabussafi + config: + tags: ['zkevm', 'bpt', 'transfers'] + description: > + Balancer Pool Token (BPT) transfer logs on Balancer, an automated portfolio manager and trading platform, on zkevm. + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - evt_tx_hash + - evt_index + - block_date + columns: + - &blockchain + name: blockchain + description: "Blockchain" + - &version + name: version + description: "Version of Balancer where the liquidity pool used in transaction is deployed" + - &contract_address + name: contract_address + description: 'zkevm address for the liquidity pool used in transaction' + - &block_date + name: block_date + description: "UTC event block date of each DEX trade" + - &block_month + name: block_month + description: "UTC event block month of each DEX trade" + - &evt_tx_hash + name: evt_tx_hash + description: 'Transaction hash of transfer event' + - &evt_index + name: evt_index + description: 'Event index' + - &evt_block_time + name: evt_block_time + description: 'Block time of transfer event' + - &evt_block_number + name: evt_block_number + description: 'Block number of transfer event' + - &from + name: from + description: 'Address of BPT provider of transfer event' + - &to + name: to + description: 'Address of BPT receiver of transfer event' + - &value + name: value + description: 'Amount of BPT transferred in transfer event' + + - name: balancer_v2_zkevm_bpt_prices + meta: + blockchain: zkevm + project: balancer_v2 + contributors: victorstefenon, thetroyharris, viniabussafi + config: + tags: ['zkevm', 'bpt', 'prices'] + description: > + Balancer Pool Token (BPT) daily price by pool on Balancer, an automated portfolio manager and trading platform. + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - blockchain + - day + - contract_address + columns: + - *blockchain + - &day + name: day + description: "Block date in UTC" + - *version + - &decimals + name: decimals + description: "Token decimals. 18, by default, on BPTs" + - *contract_address + - &bpt_price + name: bpt_price + description: "Price of the BPT" + + - name: balancer_v2_zkevm_bpt_supply + meta: + blockchain: zkevm + project: balancer_v2 + contributors: thetroyharris, viniabussafi + config: + tags: ['zkevm', 'bpt', 'supply'] + description: > + Balancer Pool Token (BPT) supply by pool on Balancer, an automated portfolio manager and trading platform. + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - day + - blockchain + - token_address + columns: + - *day + - &pool_type + name: pool_type + description: "Pool attributes, determined by the pool's factory" + - *version + - *blockchain + - &token_address + name: token_address + description: "Contract address of the BPT" + - &supply + name: supply + description: "Supply of the BPT, discounted of premints" + + - name: balancer_v2_zkevm_bpt_supply_changes + meta: + blockchain: zkevm + project: balancer_v2 + contributors: viniabussafi + config: + tags: ['zkevm', 'bpt', 'supply', 'changes'] + description: > + Balancer Pool Token (BPT) supply change events. + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - block_date + - evt_tx_hash + - evt_index + - label + columns: + - *block_date + - *evt_block_time + - *evt_block_number + - *blockchain + - *evt_tx_hash + - *evt_index + - *pool_type + - &pool_symbol + name: pool_symbol + description: "Token symbols, followed by their respective weights, if applicable" + - *version + - &label + name: label + description: "Nature of the transaction (Join/Exit via swap or Mint/Burn via transfer)" + - *token_address + - &delta_amount_raw + name: delta_amount_raw + description: "Raw value of the transaction on token supply at the time of execution in the original currency" + - &delta_amount + name: delta_amount + description: "Normalized value of the transaction on token supply at the time of execution in the original currency" + + - name: balancer_v2_zkevm_bpt_supply_changes_daily + meta: + blockchain: zkevm + project: balancer_v2 + contributors: viniabussafi + config: + tags: ['zkevm', 'bpt', 'supply', 'changes'] + description: > + Balancer Pool Token (BPT) supply change events. grouped by day + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - block_date + - blockchain + - token_address + columns: + - *block_date + - *blockchain + - *pool_type + - *pool_symbol + - *version + - *token_address + - &daily_delta + name: daily_delta + description: "Daily total impact on BPT supply" \ No newline at end of file diff --git a/models/balancer/zkevm/balancer_v2_zkevm_bpt_prices.sql b/models/_project/balancer/bpt/zkevm/balancer_v2_zkevm_bpt_prices.sql similarity index 100% rename from models/balancer/zkevm/balancer_v2_zkevm_bpt_prices.sql rename to models/_project/balancer/bpt/zkevm/balancer_v2_zkevm_bpt_prices.sql diff --git a/models/balancer/zkevm/balancer_v2_zkevm_bpt_supply.sql b/models/_project/balancer/bpt/zkevm/balancer_v2_zkevm_bpt_supply.sql similarity index 100% rename from models/balancer/zkevm/balancer_v2_zkevm_bpt_supply.sql rename to models/_project/balancer/bpt/zkevm/balancer_v2_zkevm_bpt_supply.sql diff --git a/models/_project/balancer/bpt/zkevm/balancer_v2_zkevm_bpt_supply_changes.sql b/models/_project/balancer/bpt/zkevm/balancer_v2_zkevm_bpt_supply_changes.sql new file mode 100644 index 00000000000..f11227e4013 --- /dev/null +++ b/models/_project/balancer/bpt/zkevm/balancer_v2_zkevm_bpt_supply_changes.sql @@ -0,0 +1,20 @@ +{% set blockchain = 'zkevm' %} + +{{ + config( + schema = 'balancer_v2_zkevm', + alias = 'bpt_supply_changes', + materialized = 'incremental', + file_format = 'delta', + incremental_strategy = 'merge', + unique_key = ['block_date', 'evt_tx_hash', 'evt_index', 'label'], + incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.evt_block_time')] + ) +}} + +{{ + bpt_supply_changes_macro( + blockchain = blockchain, + version = '2' + ) +}} \ No newline at end of file diff --git a/models/_project/balancer/bpt/zkevm/balancer_v2_zkevm_bpt_supply_changes_daily.sql b/models/_project/balancer/bpt/zkevm/balancer_v2_zkevm_bpt_supply_changes_daily.sql new file mode 100644 index 00000000000..4e548f4bcf7 --- /dev/null +++ b/models/_project/balancer/bpt/zkevm/balancer_v2_zkevm_bpt_supply_changes_daily.sql @@ -0,0 +1,17 @@ +{% set blockchain = 'zkevm' %} + +{{ + config( + schema = 'balancer_v2_zkevm', + alias = 'bpt_supply_changes_daily', + materialized = 'table', + file_format = 'delta' + ) +}} + +{{ + bpt_supply_changes_daily_agg_macro( + blockchain = blockchain, + version = '2' + ) +}} \ No newline at end of file diff --git a/models/balancer/zkevm/balancer_v2_zkevm_transfers_bpt.sql b/models/_project/balancer/bpt/zkevm/balancer_v2_zkevm_transfers_bpt.sql similarity index 100% rename from models/balancer/zkevm/balancer_v2_zkevm_transfers_bpt.sql rename to models/_project/balancer/bpt/zkevm/balancer_v2_zkevm_transfers_bpt.sql diff --git a/models/_project/balancer/flashloans/_schema.yml b/models/_project/balancer/flashloans/_schema.yml new file mode 100644 index 00000000000..948574c1ad6 --- /dev/null +++ b/models/_project/balancer/flashloans/_schema.yml @@ -0,0 +1,35 @@ +version: 2 + +models: + - name: balancer_flashloans + meta: + blockchain: arbitrum, avalanche_c, base, ethereum, gnosis, optimism, polygon, zkevm + sector: lending + contributors: hildobby, viniabussafi + config: + tags: ['ethereum', 'arbitrum', 'optimism', 'polygon', 'gnosis','avalanche_c', 'base', 'zkevm', 'flashloans'] + description: > + All Balancer flashloans + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - blockchain + - tx_hash + - evt_index + columns: + - name: blockchain + - name: project + - name: version + - name: block_time + - name: block_month + - name: block_number + - name: amount + - name: amount_usd + - name: tx_hash + - name: evt_index + - name: fee + - name: currency_contract + - name: currency_symbol + - name: recipient + - name: contract_address + \ No newline at end of file diff --git a/models/_project/balancer/flashloans/arbitrum/_schema.yml b/models/_project/balancer/flashloans/arbitrum/_schema.yml new file mode 100644 index 00000000000..562e948bde1 --- /dev/null +++ b/models/_project/balancer/flashloans/arbitrum/_schema.yml @@ -0,0 +1,36 @@ +version: 2 + +models: + - name: balancer_v2_arbitrum_flashloans + meta: + blockchain: arbitrum + sector: lending + contributors: hildobby, viniabussafi + config: + tags: ['arbitrum', 'flashloans'] + description: > + All Balancer v2 flashloans on Arbitrum + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - blockchain + - tx_hash + - evt_index + columns: + - name: blockchain + - name: project + - name: version + - name: block_time + - name: block_number + - name: amount + - name: amount_usd + - &tx_hash + name: tx_hash + description: "Tx. Hash" + - name: evt_index + - name: fee + - name: currency_contract + - name: currency_symbol + - name: recipient + - name: contract_address + - name: block_month \ No newline at end of file diff --git a/models/balancer/arbitrum/balancer_v2_arbitrum_flashloans.sql b/models/_project/balancer/flashloans/arbitrum/balancer_v2_arbitrum_flashloans.sql similarity index 88% rename from models/balancer/arbitrum/balancer_v2_arbitrum_flashloans.sql rename to models/_project/balancer/flashloans/arbitrum/balancer_v2_arbitrum_flashloans.sql index 52ec11d81ee..bf21ac0ece7 100644 --- a/models/balancer/arbitrum/balancer_v2_arbitrum_flashloans.sql +++ b/models/_project/balancer/flashloans/arbitrum/balancer_v2_arbitrum_flashloans.sql @@ -6,10 +6,6 @@ , file_format = 'delta' , incremental_strategy = 'merge' , unique_key = ['tx_hash', 'evt_index'] - , post_hook='{{ expose_spells(\'["arbitrum"]\', - "project", - "balancer_v2", - \'["hildobby"]\') }}' ) }} diff --git a/models/_project/balancer/flashloans/avalanche_c/_schema.yml b/models/_project/balancer/flashloans/avalanche_c/_schema.yml new file mode 100644 index 00000000000..6a0a0a719f3 --- /dev/null +++ b/models/_project/balancer/flashloans/avalanche_c/_schema.yml @@ -0,0 +1,36 @@ +version: 2 + +models: + - name: balancer_v2_avalanche_c_flashloans + meta: + blockchain: avalanche_c + sector: lending + contributors: hildobby, viniabussafi + config: + tags: ['avalanche_c', 'flashloans'] + description: > + All Balancer v2 flashloans on avalanche_c + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - blockchain + - tx_hash + - evt_index + columns: + - name: blockchain + - name: project + - name: version + - name: block_time + - name: block_number + - name: amount + - name: amount_usd + - &tx_hash + name: tx_hash + description: "Tx. Hash" + - name: evt_index + - name: fee + - name: currency_contract + - name: currency_symbol + - name: recipient + - name: contract_address + - name: block_month \ No newline at end of file diff --git a/models/balancer/avalanche_c/balancer_v2_avalanche_c_flashloans.sql b/models/_project/balancer/flashloans/avalanche_c/balancer_v2_avalanche_c_flashloans.sql similarity index 88% rename from models/balancer/avalanche_c/balancer_v2_avalanche_c_flashloans.sql rename to models/_project/balancer/flashloans/avalanche_c/balancer_v2_avalanche_c_flashloans.sql index eca6b3b0809..d4ec0d2e79d 100644 --- a/models/balancer/avalanche_c/balancer_v2_avalanche_c_flashloans.sql +++ b/models/_project/balancer/flashloans/avalanche_c/balancer_v2_avalanche_c_flashloans.sql @@ -6,10 +6,6 @@ , file_format = 'delta' , incremental_strategy = 'merge' , unique_key = ['tx_hash', 'evt_index'] - , post_hook='{{ expose_spells(\'["avalanche_c"]\', - "project", - "balancer_v2", - \'["hildobby", "viniabussafi"]\') }}' ) }} diff --git a/models/balancer/balancer_flashloans.sql b/models/_project/balancer/flashloans/balancer_flashloans.sql similarity index 69% rename from models/balancer/balancer_flashloans.sql rename to models/_project/balancer/flashloans/balancer_flashloans.sql index bf79fcbf7f9..19f69ad6231 100644 --- a/models/balancer/balancer_flashloans.sql +++ b/models/_project/balancer/flashloans/balancer_flashloans.sql @@ -1,10 +1,10 @@ {{ config( - + schema = 'balancer', alias = 'flashloans', - post_hook='{{ expose_spells(\'["ethereum","arbitrum", "optimism", "polygon", "gnosis", "avalanche_c", "base", "zkevm"]\', - "project", - "balancer", - \'["hildobby", "viniabussafi"]\') }}' + post_hook='{{ expose_spells(blockchains = \'["arbitrum", "avalanche_c", "base", "ethereum", "gnosis", "optimism", "polygon", "zkevm"]\', + spell_type = "project", + spell_name = "balancer", + contributors = \'["hildobby", "viniabussafi"]\') }}' ) }} @@ -19,7 +19,6 @@ ref('balancer_v2_ethereum_flashloans') , ref('balancer_v2_zkevm_flashloans') ] %} - SELECT * FROM ( {% for flash_model in balancer_models %} diff --git a/models/_project/balancer/flashloans/base/_schema.yml b/models/_project/balancer/flashloans/base/_schema.yml new file mode 100644 index 00000000000..3664ca0dbb5 --- /dev/null +++ b/models/_project/balancer/flashloans/base/_schema.yml @@ -0,0 +1,36 @@ +version: 2 + +models: + - name: balancer_v2_base_flashloans + meta: + blockchain: base + sector: lending + contributors: hildobby, viniabussafi + config: + tags: ['base', 'flashloans'] + description: > + All Balancer v2 flashloans on base + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - blockchain + - tx_hash + - evt_index + columns: + - name: blockchain + - name: project + - name: version + - name: block_time + - name: block_number + - name: amount + - name: amount_usd + - &tx_hash + name: tx_hash + description: "Tx. Hash" + - name: evt_index + - name: fee + - name: currency_contract + - name: currency_symbol + - name: recipient + - name: contract_address + - name: block_month \ No newline at end of file diff --git a/models/balancer/base/balancer_v2_base_flashloans.sql b/models/_project/balancer/flashloans/base/balancer_v2_base_flashloans.sql similarity index 88% rename from models/balancer/base/balancer_v2_base_flashloans.sql rename to models/_project/balancer/flashloans/base/balancer_v2_base_flashloans.sql index 9438b88cf9c..da8cb9d2ae1 100644 --- a/models/balancer/base/balancer_v2_base_flashloans.sql +++ b/models/_project/balancer/flashloans/base/balancer_v2_base_flashloans.sql @@ -6,10 +6,6 @@ , file_format = 'delta' , incremental_strategy = 'merge' , unique_key = ['tx_hash', 'evt_index'] - , post_hook='{{ expose_spells(\'["base"]\', - "project", - "balancer_v2", - \'["hildobby", "viniabussafi"]\') }}' ) }} diff --git a/models/_project/balancer/flashloans/ethereum/_schema.yml b/models/_project/balancer/flashloans/ethereum/_schema.yml new file mode 100644 index 00000000000..48e15def9f8 --- /dev/null +++ b/models/_project/balancer/flashloans/ethereum/_schema.yml @@ -0,0 +1,36 @@ +version: 2 + +models: + - name: balancer_v2_ethereum_flashloans + meta: + blockchain: ethereum + sector: lending + contributors: hildobby, viniabussafi + config: + tags: ['ethereum', 'flashloans'] + description: > + All Balancer v2 flashloans on ethereum + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - blockchain + - tx_hash + - evt_index + columns: + - name: blockchain + - name: project + - name: version + - name: block_time + - name: block_number + - name: amount + - name: amount_usd + - &tx_hash + name: tx_hash + description: "Tx. Hash" + - name: evt_index + - name: fee + - name: currency_contract + - name: currency_symbol + - name: recipient + - name: contract_address + - name: block_month \ No newline at end of file diff --git a/models/balancer/ethereum/balancer_v2_ethereum_flashloans.sql b/models/_project/balancer/flashloans/ethereum/balancer_v2_ethereum_flashloans.sql similarity index 88% rename from models/balancer/ethereum/balancer_v2_ethereum_flashloans.sql rename to models/_project/balancer/flashloans/ethereum/balancer_v2_ethereum_flashloans.sql index cdbd54e0a7c..652ad476e88 100644 --- a/models/balancer/ethereum/balancer_v2_ethereum_flashloans.sql +++ b/models/_project/balancer/flashloans/ethereum/balancer_v2_ethereum_flashloans.sql @@ -6,10 +6,6 @@ , file_format = 'delta' , incremental_strategy = 'merge' , unique_key = ['tx_hash', 'evt_index'] - , post_hook='{{ expose_spells(\'["ethereum"]\', - "project", - "balancer_v2", - \'["hildobby"]\') }}' ) }} diff --git a/models/_project/balancer/flashloans/gnosis/_schema.yml b/models/_project/balancer/flashloans/gnosis/_schema.yml new file mode 100644 index 00000000000..a7db5e36011 --- /dev/null +++ b/models/_project/balancer/flashloans/gnosis/_schema.yml @@ -0,0 +1,36 @@ +version: 2 + +models: + - name: balancer_v2_gnosis_flashloans + meta: + blockchain: gnosis + sector: lending + contributors: hildobby, viniabussafi + config: + tags: ['gnosis', 'flashloans'] + description: > + All Balancer v2 flashloans on gnosis + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - blockchain + - tx_hash + - evt_index + columns: + - name: blockchain + - name: project + - name: version + - name: block_time + - name: block_number + - name: amount + - name: amount_usd + - &tx_hash + name: tx_hash + description: "Tx. Hash" + - name: evt_index + - name: fee + - name: currency_contract + - name: currency_symbol + - name: recipient + - name: contract_address + - name: block_month \ No newline at end of file diff --git a/models/balancer/gnosis/balancer_v2_gnosis_flashloans.sql b/models/_project/balancer/flashloans/gnosis/balancer_v2_gnosis_flashloans.sql similarity index 88% rename from models/balancer/gnosis/balancer_v2_gnosis_flashloans.sql rename to models/_project/balancer/flashloans/gnosis/balancer_v2_gnosis_flashloans.sql index 7a4dd71de65..f8d11b83452 100644 --- a/models/balancer/gnosis/balancer_v2_gnosis_flashloans.sql +++ b/models/_project/balancer/flashloans/gnosis/balancer_v2_gnosis_flashloans.sql @@ -6,10 +6,6 @@ , file_format = 'delta' , incremental_strategy = 'merge' , unique_key = ['tx_hash', 'evt_index'] - , post_hook='{{ expose_spells(\'["gnosis"]\', - "project", - "balancer_v2", - \'["hildobby"]\') }}' ) }} diff --git a/models/_project/balancer/flashloans/optimism/_schema.yml b/models/_project/balancer/flashloans/optimism/_schema.yml new file mode 100644 index 00000000000..64a96dc514f --- /dev/null +++ b/models/_project/balancer/flashloans/optimism/_schema.yml @@ -0,0 +1,36 @@ +version: 2 + +models: + - name: balancer_v2_optimism_flashloans + meta: + blockchain: optimism + sector: lending + contributors: hildobby, viniabussafi + config: + tags: ['optimism', 'flashloans'] + description: > + All Balancer v2 flashloans on optimism + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - blockchain + - tx_hash + - evt_index + columns: + - name: blockchain + - name: project + - name: version + - name: block_time + - name: block_number + - name: amount + - name: amount_usd + - &tx_hash + name: tx_hash + description: "Tx. Hash" + - name: evt_index + - name: fee + - name: currency_contract + - name: currency_symbol + - name: recipient + - name: contract_address + - name: block_month \ No newline at end of file diff --git a/models/balancer/optimism/balancer_v2_optimism_flashloans.sql b/models/_project/balancer/flashloans/optimism/balancer_v2_optimism_flashloans.sql similarity index 88% rename from models/balancer/optimism/balancer_v2_optimism_flashloans.sql rename to models/_project/balancer/flashloans/optimism/balancer_v2_optimism_flashloans.sql index 9908e24f7b3..c7036fcc2ac 100644 --- a/models/balancer/optimism/balancer_v2_optimism_flashloans.sql +++ b/models/_project/balancer/flashloans/optimism/balancer_v2_optimism_flashloans.sql @@ -6,10 +6,6 @@ , file_format = 'delta' , incremental_strategy = 'merge' , unique_key = ['tx_hash', 'evt_index'] - , post_hook='{{ expose_spells(\'["optimism"]\', - "project", - "balancer_v2", - \'["hildobby"]\') }}' ) }} diff --git a/models/_project/balancer/flashloans/polygon/_schema.yml b/models/_project/balancer/flashloans/polygon/_schema.yml new file mode 100644 index 00000000000..305a7252c6c --- /dev/null +++ b/models/_project/balancer/flashloans/polygon/_schema.yml @@ -0,0 +1,36 @@ +version: 2 + +models: + - name: balancer_v2_polygon_flashloans + meta: + blockchain: polygon + sector: lending + contributors: hildobby, viniabussafi + config: + tags: ['polygon', 'flashloans'] + description: > + All Balancer v2 flashloans on polygon + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - blockchain + - tx_hash + - evt_index + columns: + - name: blockchain + - name: project + - name: version + - name: block_time + - name: block_number + - name: amount + - name: amount_usd + - &tx_hash + name: tx_hash + description: "Tx. Hash" + - name: evt_index + - name: fee + - name: currency_contract + - name: currency_symbol + - name: recipient + - name: contract_address + - name: block_month \ No newline at end of file diff --git a/models/balancer/polygon/balancer_v2_polygon_flashloans.sql b/models/_project/balancer/flashloans/polygon/balancer_v2_polygon_flashloans.sql similarity index 88% rename from models/balancer/polygon/balancer_v2_polygon_flashloans.sql rename to models/_project/balancer/flashloans/polygon/balancer_v2_polygon_flashloans.sql index 0f0cb1d9982..392c3866d89 100644 --- a/models/balancer/polygon/balancer_v2_polygon_flashloans.sql +++ b/models/_project/balancer/flashloans/polygon/balancer_v2_polygon_flashloans.sql @@ -6,10 +6,6 @@ , file_format = 'delta' , incremental_strategy = 'merge' , unique_key = ['tx_hash', 'evt_index'] - , post_hook='{{ expose_spells(\'["polygon"]\', - "project", - "balancer_v2", - \'["hildobby"]\') }}' ) }} diff --git a/models/_project/balancer/flashloans/zkevm/_schema.yml b/models/_project/balancer/flashloans/zkevm/_schema.yml new file mode 100644 index 00000000000..feb6c20d41b --- /dev/null +++ b/models/_project/balancer/flashloans/zkevm/_schema.yml @@ -0,0 +1,36 @@ +version: 2 + +models: + - name: balancer_v2_zkevm_flashloans + meta: + blockchain: zkevm + sector: lending + contributors: hildobby, viniabussafi + config: + tags: ['zkevm', 'flashloans'] + description: > + All Balancer v2 flashloans on zkevm + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - blockchain + - tx_hash + - evt_index + columns: + - name: blockchain + - name: project + - name: version + - name: block_time + - name: block_number + - name: amount + - name: amount_usd + - &tx_hash + name: tx_hash + description: "Tx. Hash" + - name: evt_index + - name: fee + - name: currency_contract + - name: currency_symbol + - name: recipient + - name: contract_address + - name: block_month \ No newline at end of file diff --git a/models/balancer/zkevm/balancer_v2_zkevm_flashloans.sql b/models/_project/balancer/flashloans/zkevm/balancer_v2_zkevm_flashloans.sql similarity index 88% rename from models/balancer/zkevm/balancer_v2_zkevm_flashloans.sql rename to models/_project/balancer/flashloans/zkevm/balancer_v2_zkevm_flashloans.sql index a11355919f7..3e1d9d1a6f5 100644 --- a/models/balancer/zkevm/balancer_v2_zkevm_flashloans.sql +++ b/models/_project/balancer/flashloans/zkevm/balancer_v2_zkevm_flashloans.sql @@ -6,10 +6,6 @@ , file_format = 'delta' , incremental_strategy = 'merge' , unique_key = ['tx_hash', 'evt_index'] - , post_hook='{{ expose_spells(\'["zkevm"]\', - "project", - "balancer_v2", - \'["hildobby", "viniabussafi"]\') }}' ) }} diff --git a/models/_project/balancer/liquidity/_schema.yml b/models/_project/balancer/liquidity/_schema.yml new file mode 100644 index 00000000000..b014ad151e4 --- /dev/null +++ b/models/_project/balancer/liquidity/_schema.yml @@ -0,0 +1,60 @@ +version: 2 + +models: + - name: balancer_liquidity + meta: + blockchain: arbitrum, avalanche_c, base, ethereum, gnosis, optimism, polygon, zkevm + project: balancer + contributors: viniabussafi + config: + tags: ['balancer', 'amm', 'dex', 'liquidity', 'ethereum', 'arbitrum', 'optimism', 'polygon', 'avalanche_c', 'base', 'zkevm'] + description: > + Liquidity by token on Balancer, an automated portfolio manager and trading platform. + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - day + - pool_id + - blockchain + - token_address + - token_symbol + columns: + - &day + name: day + description: "Block date in UTC" + - &pool_id + name: pool_id + description: "Unique encoded identifier that refers to each pool" + - &pool_address + name: pool_address + description: "Pool address" + - &pool_symbol + name: pool_symbol + description: "Token symbols, followed by their respective weights, if applicable" + - &version + name: version + description: "Version of the project" + - &blockchain + name: blockchain + description: "Blockchain" + - &pool_type + name: pool_type + description: "Pool attributes, determined by the pool's factory" + - &token_address + name: token_address + description: "Contract address of the token" + - &token_symbol + name: token_symbol + description: "Token symbol" + - name: token_balance_raw + description: 'Raw balance of the token in the pool in the original currency' + - name: token_balance + description: 'Scaled balance of the token in the pool in the original currency' + - name: protocol_liquidity_usd + description: 'Liquidity of the token in the pool in USD, except BPTs' + - name: protocol_liquidity_eth + description: 'Liquidity of the token in the pool in ETH, except BPTs' + - name: pool_liquidity_usd + description: 'Liquidity of the token in the pool in USD, including BPTs' + - name: pool_liquidity_eth + description: 'Liquidity of the token in the pool in ETH, including BPTs' \ No newline at end of file diff --git a/models/_project/balancer/liquidity/arbitrum/_schema.yml b/models/_project/balancer/liquidity/arbitrum/_schema.yml new file mode 100644 index 00000000000..ca88eb050b8 --- /dev/null +++ b/models/_project/balancer/liquidity/arbitrum/_schema.yml @@ -0,0 +1,58 @@ +version: 2 + +models: + - name: balancer_v2_arbitrum_liquidity + meta: + blockchain: arbitrum + project: balancer_v2 + contributors: victorstefenon, viniabussafi, thetroyharris + config: + tags: ['arbitrum', 'balancer', 'pools', 'liquidity'] + description: > + Balancer v2 pools liquidity by token in Arbitrum. + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - day + - pool_id + - token_address + columns: + - &day + name: day + description: "Block date in UTC" + - &pool_id + name: pool_id + description: "Unique encoded identifier that refers to each pool" + - &pool_address + name: pool_address + description: "Pool address" + - &pool_symbol + name: pool_symbol + description: "Token symbols, followed by their respective weights, if applicable" + - &version + name: version + description: "Version of the project" + - &blockchain + name: blockchain + description: "Blockchain" + - &pool_type + name: pool_type + description: "Pool attributes, determined by the pool's factory" + - &token_address + name: token_address + description: "Contract address of the token" + - &token_symbol + name: token_symbol + description: "Token symbol" + - name: token_balance_raw + description: 'Raw balance of the token in the pool in the original currency' + - name: token_balance + description: 'Scaled balance of the token in the pool in the original currency' + - name: protocol_liquidity_usd + description: 'Liquidity of the token in the pool in USD, except BPTs' + - name: protocol_liquidity_eth + description: 'Liquidity of the token in the pool in ETH, except BPTs' + - name: pool_liquidity_usd + description: 'Liquidity of the token in the pool in USD, including BPTs' + - name: pool_liquidity_eth + description: 'Liquidity of the token in the pool in ETH, including BPTs' \ No newline at end of file diff --git a/models/balancer/arbitrum/balancer_v2_arbitrum_liquidity.sql b/models/_project/balancer/liquidity/arbitrum/balancer_v2_arbitrum_liquidity.sql similarity index 52% rename from models/balancer/arbitrum/balancer_v2_arbitrum_liquidity.sql rename to models/_project/balancer/liquidity/arbitrum/balancer_v2_arbitrum_liquidity.sql index c78ddea2ad7..c32f49c73ac 100644 --- a/models/balancer/arbitrum/balancer_v2_arbitrum_liquidity.sql +++ b/models/_project/balancer/liquidity/arbitrum/balancer_v2_arbitrum_liquidity.sql @@ -6,11 +6,7 @@ schema = 'balancer_v2_arbitrum', alias = 'liquidity', materialized = 'table', - file_format = 'delta', - post_hook="{{ expose_spells('[\"" + blockchain + '"]' + '\', - "project", - "balancer_v2", - \'["stefenon", "viniabussafi"]\') }}' + file_format = 'delta' ) }} diff --git a/models/_project/balancer/liquidity/avalanche_c/_schema.yml b/models/_project/balancer/liquidity/avalanche_c/_schema.yml new file mode 100644 index 00000000000..cd5e9580b08 --- /dev/null +++ b/models/_project/balancer/liquidity/avalanche_c/_schema.yml @@ -0,0 +1,58 @@ +version: 2 + +models: + - name: balancer_v2_avalanche_c_liquidity + meta: + blockchain: avalanche_c + project: balancer_v2 + contributors: victorstefenon, viniabussafi, thetroyharris + config: + tags: ['avalanche_c', 'balancer', 'pools', 'liquidity'] + description: > + Balancer v2 pools liquidity by token in Arbitrum. + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - day + - pool_id + - token_address + columns: + - &day + name: day + description: "Block date in UTC" + - &pool_id + name: pool_id + description: "Unique encoded identifier that refers to each pool" + - &pool_address + name: pool_address + description: "Pool address" + - &pool_symbol + name: pool_symbol + description: "Token symbols, followed by their respective weights, if applicable" + - &version + name: version + description: "Version of the project" + - &blockchain + name: blockchain + description: "Blockchain" + - &pool_type + name: pool_type + description: "Pool attributes, determined by the pool's factory" + - &token_address + name: token_address + description: "Contract address of the token" + - &token_symbol + name: token_symbol + description: "Token symbol" + - name: token_balance_raw + description: 'Raw balance of the token in the pool in the original currency' + - name: token_balance + description: 'Scaled balance of the token in the pool in the original currency' + - name: protocol_liquidity_usd + description: 'Liquidity of the token in the pool in USD, except BPTs' + - name: protocol_liquidity_eth + description: 'Liquidity of the token in the pool in ETH, except BPTs' + - name: pool_liquidity_usd + description: 'Liquidity of the token in the pool in USD, including BPTs' + - name: pool_liquidity_eth + description: 'Liquidity of the token in the pool in ETH, including BPTs' \ No newline at end of file diff --git a/models/balancer/avalanche_c/balancer_v2_avalanche_c_liquidity.sql b/models/_project/balancer/liquidity/avalanche_c/balancer_v2_avalanche_c_liquidity.sql similarity index 53% rename from models/balancer/avalanche_c/balancer_v2_avalanche_c_liquidity.sql rename to models/_project/balancer/liquidity/avalanche_c/balancer_v2_avalanche_c_liquidity.sql index 15b3912d3ee..30e2856d411 100644 --- a/models/balancer/avalanche_c/balancer_v2_avalanche_c_liquidity.sql +++ b/models/_project/balancer/liquidity/avalanche_c/balancer_v2_avalanche_c_liquidity.sql @@ -6,11 +6,7 @@ schema = 'balancer_v2_avalanche_c', alias = 'liquidity', materialized = 'table', - file_format = 'delta', - post_hook="{{ expose_spells('[\"" + blockchain + '"]' + '\', - "project", - "balancer_v2", - \'["stefenon", "viniabussafi"]\') }}' + file_format = 'delta' ) }} diff --git a/models/balancer/balancer_liquidity.sql b/models/_project/balancer/liquidity/balancer_liquidity.sql similarity index 74% rename from models/balancer/balancer_liquidity.sql rename to models/_project/balancer/liquidity/balancer_liquidity.sql index 0f003bc5d6d..57fb1122ef5 100644 --- a/models/balancer/balancer_liquidity.sql +++ b/models/_project/balancer/liquidity/balancer_liquidity.sql @@ -2,11 +2,10 @@ schema = 'balancer', alias = 'liquidity', - post_hook='{{ expose_spells(\'["ethereum","arbitrum", "optimism", "polygon", "gnosis","avalanche_c", "base", "zkevm" - ]\', - "project", - "balancer", - \'["viniabussafi"]\') }}' + post_hook='{{ expose_spells(blockchains = \'["arbitrum", "avalanche_c", "base", "ethereum", "gnosis", "optimism", "polygon", "zkevm"]\', + spell_type = "project", + spell_name = "balancer", + contributors = \'["viniabussafi"]\') }}' ) }} diff --git a/models/_project/balancer/liquidity/base/_schema.yml b/models/_project/balancer/liquidity/base/_schema.yml new file mode 100644 index 00000000000..d4b57b38164 --- /dev/null +++ b/models/_project/balancer/liquidity/base/_schema.yml @@ -0,0 +1,58 @@ +version: 2 + +models: + - name: balancer_v2_base_liquidity + meta: + blockchain: base + project: balancer_v2 + contributors: victorstefenon, viniabussafi, thetroyharris + config: + tags: ['base', 'balancer', 'pools', 'liquidity'] + description: > + Balancer v2 pools liquidity by token in Arbitrum. + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - day + - pool_id + - token_address + columns: + - &day + name: day + description: "Block date in UTC" + - &pool_id + name: pool_id + description: "Unique encoded identifier that refers to each pool" + - &pool_address + name: pool_address + description: "Pool address" + - &pool_symbol + name: pool_symbol + description: "Token symbols, followed by their respective weights, if applicable" + - &version + name: version + description: "Version of the project" + - &blockchain + name: blockchain + description: "Blockchain" + - &pool_type + name: pool_type + description: "Pool attributes, determined by the pool's factory" + - &token_address + name: token_address + description: "Contract address of the token" + - &token_symbol + name: token_symbol + description: "Token symbol" + - name: token_balance_raw + description: 'Raw balance of the token in the pool in the original currency' + - name: token_balance + description: 'Scaled balance of the token in the pool in the original currency' + - name: protocol_liquidity_usd + description: 'Liquidity of the token in the pool in USD, except BPTs' + - name: protocol_liquidity_eth + description: 'Liquidity of the token in the pool in ETH, except BPTs' + - name: pool_liquidity_usd + description: 'Liquidity of the token in the pool in USD, including BPTs' + - name: pool_liquidity_eth + description: 'Liquidity of the token in the pool in ETH, including BPTs' \ No newline at end of file diff --git a/models/balancer/base/balancer_v2_base_liquidity.sql b/models/_project/balancer/liquidity/base/balancer_v2_base_liquidity.sql similarity index 51% rename from models/balancer/base/balancer_v2_base_liquidity.sql rename to models/_project/balancer/liquidity/base/balancer_v2_base_liquidity.sql index 10b08a41262..20f257ad753 100644 --- a/models/balancer/base/balancer_v2_base_liquidity.sql +++ b/models/_project/balancer/liquidity/base/balancer_v2_base_liquidity.sql @@ -6,11 +6,7 @@ schema = 'balancer_v2_base', alias = 'liquidity', materialized = 'table', - file_format = 'delta', - post_hook="{{ expose_spells('[\"" + blockchain + '"]' + '\', - "project", - "balancer_v2", - \'["stefenon", "viniabussafi"]\') }}' + file_format = 'delta' ) }} diff --git a/models/_project/balancer/liquidity/ethereum/_schema.yml b/models/_project/balancer/liquidity/ethereum/_schema.yml new file mode 100644 index 00000000000..42866a2e449 --- /dev/null +++ b/models/_project/balancer/liquidity/ethereum/_schema.yml @@ -0,0 +1,96 @@ +version: 2 + +models: + - name: balancer_v2_ethereum_liquidity + meta: + blockchain: ethereum + project: balancer_v2 + contributors: victorstefenon, viniabussafi, thetroyharris + config: + tags: ['ethereum', 'balancer', 'pools', 'liquidity'] + description: > + Balancer v2 pools liquidity by token in Ethereum. + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - day + - pool_id + - token_address + columns: + - &day + name: day + description: "Block date in UTC" + - &pool_id + name: pool_id + description: "Unique encoded identifier that refers to each pool" + - &pool_address + name: pool_address + description: "Pool address" + - &pool_symbol + name: pool_symbol + description: "Token symbols, followed by their respective weights, if applicable" + - &version + name: version + description: "Version of the project" + - &blockchain + name: blockchain + description: "Blockchain" + - &pool_type + name: pool_type + description: "Pool attributes, determined by the pool's factory" + - &token_address + name: token_address + description: "Contract address of the token" + - &token_symbol + name: token_symbol + description: "Token symbol" + - &token_balance_raw + name: token_balance_raw + description: 'Raw balance of the token in the pool in the original currency' + - &token_balance + name: token_balance + description: 'Scaled balance of the token in the pool in the original currency' + - &protocol_liquidity_usd + name: protocol_liquidity_usd + description: 'Liquidity of the token in the pool in USD, except BPTs' + - &protocol_liquidity_eth + name: protocol_liquidity_eth + description: 'Liquidity of the token in the pool in ETH, except BPTs' + - &pool_liquidity_usd + name: pool_liquidity_usd + description: 'Liquidity of the token in the pool in USD, including BPTs' + - &pool_liquidity_eth + name: pool_liquidity_eth + description: 'Liquidity of the token in the pool in ETH, including BPTs' + + - name: balancer_v1_ethereum_liquidity + meta: + blockchain: ethereum + project: balancer_v1 + contributors: markusbkoch, mendesfabio, victorstefenon, viniabussafi, thetroyharris + config: + tags: ['ethereum', 'balancer', 'pools', 'liquidity'] + description: > + Balancer v1 pools liquidity by token in Ethereum. + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - day + - pool_id + - token_address + columns: + - *day + - *pool_id + - *pool_address + - *pool_symbol + - *version + - *blockchain + - *pool_type + - *token_address + - *token_symbol + - *token_balance_raw + - *token_balance + - *protocol_liquidity_usd + - *protocol_liquidity_eth + - *pool_liquidity_usd + - *pool_liquidity_eth \ No newline at end of file diff --git a/models/balancer/ethereum/balancer_v1_ethereum_liquidity.sql b/models/_project/balancer/liquidity/ethereum/balancer_v1_ethereum_liquidity.sql similarity index 92% rename from models/balancer/ethereum/balancer_v1_ethereum_liquidity.sql rename to models/_project/balancer/liquidity/ethereum/balancer_v1_ethereum_liquidity.sql index 31601ee7cdd..b433278b8db 100644 --- a/models/balancer/ethereum/balancer_v1_ethereum_liquidity.sql +++ b/models/_project/balancer/liquidity/ethereum/balancer_v1_ethereum_liquidity.sql @@ -3,11 +3,7 @@ schema='balancer_v1_ethereum', alias = 'liquidity', materialized = 'table', - file_format = 'delta', - post_hook='{{ expose_spells(\'["ethereum"]\', - "project", - "balancer_v1", - \'["stefenon", "viniabussafi"]\') }}' + file_format = 'delta' ) }} diff --git a/models/balancer/ethereum/balancer_v2_ethereum_liquidity.sql b/models/_project/balancer/liquidity/ethereum/balancer_v2_ethereum_liquidity.sql similarity index 52% rename from models/balancer/ethereum/balancer_v2_ethereum_liquidity.sql rename to models/_project/balancer/liquidity/ethereum/balancer_v2_ethereum_liquidity.sql index 56ccd353f93..54efdce06c3 100644 --- a/models/balancer/ethereum/balancer_v2_ethereum_liquidity.sql +++ b/models/_project/balancer/liquidity/ethereum/balancer_v2_ethereum_liquidity.sql @@ -6,11 +6,7 @@ schema = 'balancer_v2_ethereum', alias = 'liquidity', materialized = 'table', - file_format = 'delta', - post_hook="{{ expose_spells('[\"" + blockchain + '"]' + '\', - "project", - "balancer_v2", - \'["stefenon", "viniabussafi"]\') }}' + file_format = 'delta' ) }} diff --git a/models/_project/balancer/liquidity/gnosis/_schema.yml b/models/_project/balancer/liquidity/gnosis/_schema.yml new file mode 100644 index 00000000000..d21460430ab --- /dev/null +++ b/models/_project/balancer/liquidity/gnosis/_schema.yml @@ -0,0 +1,58 @@ +version: 2 + +models: + - name: balancer_v2_gnosis_liquidity + meta: + blockchain: gnosis + project: balancer_v2 + contributors: victorstefenon, viniabussafi, thetroyharris + config: + tags: ['gnosis', 'balancer', 'pools', 'liquidity'] + description: > + Balancer v2 pools liquidity by token in Arbitrum. + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - day + - pool_id + - token_address + columns: + - &day + name: day + description: "Block date in UTC" + - &pool_id + name: pool_id + description: "Unique encoded identifier that refers to each pool" + - &pool_address + name: pool_address + description: "Pool address" + - &pool_symbol + name: pool_symbol + description: "Token symbols, followed by their respective weights, if applicable" + - &version + name: version + description: "Version of the project" + - &blockchain + name: blockchain + description: "Blockchain" + - &pool_type + name: pool_type + description: "Pool attributes, determined by the pool's factory" + - &token_address + name: token_address + description: "Contract address of the token" + - &token_symbol + name: token_symbol + description: "Token symbol" + - name: token_balance_raw + description: 'Raw balance of the token in the pool in the original currency' + - name: token_balance + description: 'Scaled balance of the token in the pool in the original currency' + - name: protocol_liquidity_usd + description: 'Liquidity of the token in the pool in USD, except BPTs' + - name: protocol_liquidity_eth + description: 'Liquidity of the token in the pool in ETH, except BPTs' + - name: pool_liquidity_usd + description: 'Liquidity of the token in the pool in USD, including BPTs' + - name: pool_liquidity_eth + description: 'Liquidity of the token in the pool in ETH, including BPTs' \ No newline at end of file diff --git a/models/balancer/gnosis/balancer_v2_gnosis_liquidity.sql b/models/_project/balancer/liquidity/gnosis/balancer_v2_gnosis_liquidity.sql similarity index 51% rename from models/balancer/gnosis/balancer_v2_gnosis_liquidity.sql rename to models/_project/balancer/liquidity/gnosis/balancer_v2_gnosis_liquidity.sql index 478f1b6c77f..fc5885a24e0 100644 --- a/models/balancer/gnosis/balancer_v2_gnosis_liquidity.sql +++ b/models/_project/balancer/liquidity/gnosis/balancer_v2_gnosis_liquidity.sql @@ -6,11 +6,7 @@ schema = 'balancer_v2_gnosis', alias = 'liquidity', materialized = 'table', - file_format = 'delta', - post_hook="{{ expose_spells('[\"" + blockchain + '"]' + '\', - "project", - "balancer_v2", - \'["stefenon", "viniabussafi"]\') }}' + file_format = 'delta' ) }} diff --git a/models/_project/balancer/liquidity/optimism/_schema.yml b/models/_project/balancer/liquidity/optimism/_schema.yml new file mode 100644 index 00000000000..d41d2cb3e49 --- /dev/null +++ b/models/_project/balancer/liquidity/optimism/_schema.yml @@ -0,0 +1,58 @@ +version: 2 + +models: + - name: balancer_v2_optimism_liquidity + meta: + blockchain: optimism + project: balancer_v2 + contributors: victorstefenon, viniabussafi, thetroyharris + config: + tags: ['optimism', 'balancer', 'pools', 'liquidity'] + description: > + Balancer v2 pools liquidity by token in Arbitrum. + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - day + - pool_id + - token_address + columns: + - &day + name: day + description: "Block date in UTC" + - &pool_id + name: pool_id + description: "Unique encoded identifier that refers to each pool" + - &pool_address + name: pool_address + description: "Pool address" + - &pool_symbol + name: pool_symbol + description: "Token symbols, followed by their respective weights, if applicable" + - &version + name: version + description: "Version of the project" + - &blockchain + name: blockchain + description: "Blockchain" + - &pool_type + name: pool_type + description: "Pool attributes, determined by the pool's factory" + - &token_address + name: token_address + description: "Contract address of the token" + - &token_symbol + name: token_symbol + description: "Token symbol" + - name: token_balance_raw + description: 'Raw balance of the token in the pool in the original currency' + - name: token_balance + description: 'Scaled balance of the token in the pool in the original currency' + - name: protocol_liquidity_usd + description: 'Liquidity of the token in the pool in USD, except BPTs' + - name: protocol_liquidity_eth + description: 'Liquidity of the token in the pool in ETH, except BPTs' + - name: pool_liquidity_usd + description: 'Liquidity of the token in the pool in USD, including BPTs' + - name: pool_liquidity_eth + description: 'Liquidity of the token in the pool in ETH, including BPTs' \ No newline at end of file diff --git a/models/balancer/optimism/balancer_v2_optimism_liquidity.sql b/models/_project/balancer/liquidity/optimism/balancer_v2_optimism_liquidity.sql similarity index 52% rename from models/balancer/optimism/balancer_v2_optimism_liquidity.sql rename to models/_project/balancer/liquidity/optimism/balancer_v2_optimism_liquidity.sql index d9e8ac55868..b34e0e3557a 100644 --- a/models/balancer/optimism/balancer_v2_optimism_liquidity.sql +++ b/models/_project/balancer/liquidity/optimism/balancer_v2_optimism_liquidity.sql @@ -6,11 +6,7 @@ schema = 'balancer_v2_optimism', alias = 'liquidity', materialized = 'table', - file_format = 'delta', - post_hook="{{ expose_spells('[\"" + blockchain + '"]' + '\', - "project", - "balancer_v2", - \'["stefenon", "viniabussafi"]\') }}' + file_format = 'delta' ) }} diff --git a/models/_project/balancer/liquidity/polygon/_schema.yml b/models/_project/balancer/liquidity/polygon/_schema.yml new file mode 100644 index 00000000000..5054f2a9740 --- /dev/null +++ b/models/_project/balancer/liquidity/polygon/_schema.yml @@ -0,0 +1,58 @@ +version: 2 + +models: + - name: balancer_v2_polygon_liquidity + meta: + blockchain: polygon + project: balancer_v2 + contributors: victorstefenon, viniabussafi, thetroyharris + config: + tags: ['polygon', 'balancer', 'pools', 'liquidity'] + description: > + Balancer v2 pools liquidity by token in Arbitrum. + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - day + - pool_id + - token_address + columns: + - &day + name: day + description: "Block date in UTC" + - &pool_id + name: pool_id + description: "Unique encoded identifier that refers to each pool" + - &pool_address + name: pool_address + description: "Pool address" + - &pool_symbol + name: pool_symbol + description: "Token symbols, followed by their respective weights, if applicable" + - &version + name: version + description: "Version of the project" + - &blockchain + name: blockchain + description: "Blockchain" + - &pool_type + name: pool_type + description: "Pool attributes, determined by the pool's factory" + - &token_address + name: token_address + description: "Contract address of the token" + - &token_symbol + name: token_symbol + description: "Token symbol" + - name: token_balance_raw + description: 'Raw balance of the token in the pool in the original currency' + - name: token_balance + description: 'Scaled balance of the token in the pool in the original currency' + - name: protocol_liquidity_usd + description: 'Liquidity of the token in the pool in USD, except BPTs' + - name: protocol_liquidity_eth + description: 'Liquidity of the token in the pool in ETH, except BPTs' + - name: pool_liquidity_usd + description: 'Liquidity of the token in the pool in USD, including BPTs' + - name: pool_liquidity_eth + description: 'Liquidity of the token in the pool in ETH, including BPTs' \ No newline at end of file diff --git a/models/balancer/polygon/balancer_v2_polygon_liquidity.sql b/models/_project/balancer/liquidity/polygon/balancer_v2_polygon_liquidity.sql similarity index 52% rename from models/balancer/polygon/balancer_v2_polygon_liquidity.sql rename to models/_project/balancer/liquidity/polygon/balancer_v2_polygon_liquidity.sql index f830e2df02c..3f0c521ade6 100644 --- a/models/balancer/polygon/balancer_v2_polygon_liquidity.sql +++ b/models/_project/balancer/liquidity/polygon/balancer_v2_polygon_liquidity.sql @@ -6,11 +6,7 @@ schema = 'balancer_v2_polygon', alias = 'liquidity', materialized = 'table', - file_format = 'delta', - post_hook="{{ expose_spells('[\"" + blockchain + '"]' + '\', - "project", - "balancer_v2", - \'["stefenon", "viniabussafi"]\') }}' + file_format = 'delta' ) }} diff --git a/models/_project/balancer/liquidity/zkevm/_schema.yml b/models/_project/balancer/liquidity/zkevm/_schema.yml new file mode 100644 index 00000000000..67f36eb3b21 --- /dev/null +++ b/models/_project/balancer/liquidity/zkevm/_schema.yml @@ -0,0 +1,58 @@ +version: 2 + +models: + - name: balancer_v2_zkevm_liquidity + meta: + blockchain: zkevm + project: balancer_v2 + contributors: victorstefenon, viniabussafi, thetroyharris + config: + tags: ['zkevm', 'balancer', 'pools', 'liquidity'] + description: > + Balancer v2 pools liquidity by token in Arbitrum. + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - day + - pool_id + - token_address + columns: + - &day + name: day + description: "Block date in UTC" + - &pool_id + name: pool_id + description: "Unique encoded identifier that refers to each pool" + - &pool_address + name: pool_address + description: "Pool address" + - &pool_symbol + name: pool_symbol + description: "Token symbols, followed by their respective weights, if applicable" + - &version + name: version + description: "Version of the project" + - &blockchain + name: blockchain + description: "Blockchain" + - &pool_type + name: pool_type + description: "Pool attributes, determined by the pool's factory" + - &token_address + name: token_address + description: "Contract address of the token" + - &token_symbol + name: token_symbol + description: "Token symbol" + - name: token_balance_raw + description: 'Raw balance of the token in the pool in the original currency' + - name: token_balance + description: 'Scaled balance of the token in the pool in the original currency' + - name: protocol_liquidity_usd + description: 'Liquidity of the token in the pool in USD, except BPTs' + - name: protocol_liquidity_eth + description: 'Liquidity of the token in the pool in ETH, except BPTs' + - name: pool_liquidity_usd + description: 'Liquidity of the token in the pool in USD, including BPTs' + - name: pool_liquidity_eth + description: 'Liquidity of the token in the pool in ETH, including BPTs' \ No newline at end of file diff --git a/models/balancer/zkevm/balancer_v2_zkevm_liquidity.sql b/models/_project/balancer/liquidity/zkevm/balancer_v2_zkevm_liquidity.sql similarity index 51% rename from models/balancer/zkevm/balancer_v2_zkevm_liquidity.sql rename to models/_project/balancer/liquidity/zkevm/balancer_v2_zkevm_liquidity.sql index f3fd420bb39..737b858ca3c 100644 --- a/models/balancer/zkevm/balancer_v2_zkevm_liquidity.sql +++ b/models/_project/balancer/liquidity/zkevm/balancer_v2_zkevm_liquidity.sql @@ -6,11 +6,7 @@ schema = 'balancer_v2_zkevm', alias = 'liquidity', materialized = 'table', - file_format = 'delta', - post_hook="{{ expose_spells('[\"" + blockchain + '"]' + '\', - "project", - "balancer_v2", - \'["stefenon", "viniabussafi"]\') }}' + file_format = 'delta' ) }} diff --git a/models/_project/balancer/pools/_schema.yml b/models/_project/balancer/pools/_schema.yml new file mode 100644 index 00000000000..65c86555a7c --- /dev/null +++ b/models/_project/balancer/pools/_schema.yml @@ -0,0 +1,173 @@ +version: 2 + +models: + - name: balancer_pools_fees + meta: + blockchain: arbitrum, avalanche_c, base, ethereum, gnosis, optimism, polygon, zkevm + contributors: jacektrocinski, thetroyharris, viniabussafi + config: + tags: ['arbitrum', 'avalanche_c', 'base', 'ethereum', 'gnosis', 'optimism', 'polygon', 'zkevm', 'pools', 'fees'] + description: > + Balancer v2 swap fees stored at the pool level. + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - blockchain + - block_number + - tx_hash + - index + columns: + - &blockchain + name: blockchain + description: "Blockchain" + - &version + name: version + description: "Version of Balancer where the liquidity pool used in transaction is deployed" + - &contract_address + name: contract_address + description: 'zkevm address for the liquidity pool used in transaction' + tests: + - not_null + - &tx_hash + name: tx_hash + description: 'Transaction hash' + tests: + - not_null + - &index + name: index + description: 'Event Index' + tests: + - not_null + - &tx_index + name: tx_index + description: 'Transaction Index' + tests: + - not_null + - &block_time + name: block_time + description: 'Block time in UTC' + tests: + - not_null + - &block_number + name: block_number + description: 'Event Block Number' + tests: + - not_null + - &swap_fee_percentage + name: swap_fee_percentage + description: 'Swap fees for the pool, values are returned with 18 decimals (1e18 meaning 100%)' + tests: + - not_null + + - name: balancer_pools_tokens_weights + meta: + blockchain: arbitrum, avalanche_c, base, ethereum, gnosis, optimism, polygon, 'zkevm' + contributors: jacektrocinski, viniabussafi + config: + tags: ['arbitrum', 'avalanche_c', 'base', 'ethereum', 'gnosis', 'optimism', 'polygon', 'zkevm', 'bpt', 'transfers'] + description: > + Token weights in Balancer pools. + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - blockchain + - pool_id + - token_address + columns: + - *blockchain + - *version + - &pool_id + name: pool_id + description: 'Unique encoded identifier that refers to each pool' + tests: + - not_null + - &token_address + name: token_address + description: 'Contract address for the token' + - &normalized_weight + name: normalized_weight + description: 'Weight of the token in the pool.' + + + - name: balancer_pools_metrics_daily + meta: + blockchain: arbitrum, avalanche_c, base, ethereum, gnosis, optimism, polygon, zkevm + contributors: viniabussafi, metacrypto + config: + tags: ['arbitrum', 'avalanche_c', 'base', 'ethereum', 'gnosis', 'optimism', 'polygon', 'zkevm', 'balancer', 'pool', 'stats', 'volume', 'tvl', 'fee'] + description: > + This spell aggregates data from the trades, liquidity and protocol fees spells, by day and pool, while also displaying some basic information about the pool + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - block_date + - blockchain + - project + - version + - project_contract_address + columns: + - *blockchain + - &project + name: project + description: "Project name (balancer)" + - *version + - &block_date + name: block_date + description: "Block date in UTC" + - &project_contract_address + name: project_contract_address + description: "Pool address" + - &pool_symbol + name: pool_symbol + description: "Token symbols, followed by their respective weights, if applicable" + - &pool_type + name: pool_type + description: "Pool attributes, determined by the pool's factory" + - &swap_amount_usd + name: swap_amount_usd + description: "Daily swap volume on a pool, in USD" + - &tvl_usd + name: tvl_usd + description: "Total Value Locked on a pool, in USD" + - &tvl_eth + name: tvl_eth + description: "Total Value Locked on a pool, in eth" + - &fee_amount_usd + name: fee_amount_usd + description: "Daily fees collected on a pool, in USD" + + - name: balancer_gauge_mappings + meta: + blockchain: optimism + sector: dex + contributors: msilb7 + config: + tags: ['balancer', 'amm', 'trades', 'dex', 'incentives'] + description: > + Gauge to Pool mappings for balancer on all chains + columns: + - *blockchain + - *version + - &pool_contract + name: pool_contract + description: "Address of the liquidity pool contract" + - *pool_id + - &incentives_contract + name: incentives_contract + description: "Address of the contract where incentives are stored and emitted." + - &incentives_type + name: incentives_type + description: "Description of the incentives address type." + - &evt_block_time + name: evt_block_time + description: "Block time in UTC" + - &evt_block_number + name: evt_block_number + description: 'Event Block Number' + - *contract_address + - &evt_tx_hash + name: evt_tx_hash + description: 'Transaction hash' + - &evt_index + name: evT_index + description: 'Event Index' \ No newline at end of file diff --git a/models/_project/balancer/pools/arbitrum/_schema.yml b/models/_project/balancer/pools/arbitrum/_schema.yml new file mode 100644 index 00000000000..fd04cb90077 --- /dev/null +++ b/models/_project/balancer/pools/arbitrum/_schema.yml @@ -0,0 +1,105 @@ +version: 2 + +models: + - name: balancer_v2_arbitrum_pools_fees + meta: + blockchain: arbitrum + project: balancer_v2 + contributors: jacektrocinski, thetroyharris, viniabussafi + config: + tags: ['arbitrum', 'balancer', 'pools_fees'] + description: > + Balancer v2 swap fees stored at the pool level. + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - block_number + - tx_hash + - index + columns: + - &blockchain + name: blockchain + description: "Blockchain" + - &version + name: version + description: "Version of Balancer where the liquidity pool used in transaction is deployed" + - &contract_address + name: contract_address + description: 'Arbitrum address for the liquidity pool used in transaction' + tests: + - not_null + - &tx_hash + name: tx_hash + description: 'Transaction hash' + tests: + - not_null + - &index + name: index + description: 'Event Index' + tests: + - not_null + - &tx_index + name: tx_index + description: 'Transaction Index' + tests: + - not_null + - &block_time + name: block_time + description: 'Block time in UTC' + tests: + - not_null + - &block_number + name: block_number + description: 'Event Block Number' + tests: + - not_null + - &swap_fee_percentage + name: swap_fee_percentage + description: 'Swap fees for the pool, values are returned with 18 decimals (1e18 meaning 100%)' + tests: + - not_null + + - name: balancer_arbitrum_pools_tokens_weights + meta: + blockchain: arbitrum + project: balancer + contributors: jacektrocinski, viniabussafi + config: + tags: ['arbitrum', 'balancer', 'pools', 'tokens', 'weights'] + description: > + Token weights in Balancer pools. + columns: + - *blockchain + - *version + - &pool_id + name: pool_id + description: 'Unique encoded identifier that refers to each pool' + tests: + - not_null + - &token_address + name: token_address + description: 'Contract address for the token' + - &normalized_weight + name: normalized_weight + description: 'Weight of the token in the pool.' + + - name: balancer_v2_arbitrum_pools_tokens_weights + meta: + blockchain: arbitrum + project: balancer + contributors: jacektrocinski, viniabussafi + config: + tags: ['arbitrum', 'balancer', 'pools', 'tokens', 'weights'] + description: > + Token weights in Balancer v2 pools. + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - pool_id + - token_address + columns: + - *blockchain + - *version + - *pool_id + - *token_address + - *normalized_weight \ No newline at end of file diff --git a/models/balancer/arbitrum/balancer_arbitrum_pools_tokens_weights.sql b/models/_project/balancer/pools/arbitrum/balancer_arbitrum_pools_tokens_weights.sql similarity index 100% rename from models/balancer/arbitrum/balancer_arbitrum_pools_tokens_weights.sql rename to models/_project/balancer/pools/arbitrum/balancer_arbitrum_pools_tokens_weights.sql diff --git a/models/balancer/arbitrum/balancer_v2_arbitrum_pools_fees.sql b/models/_project/balancer/pools/arbitrum/balancer_v2_arbitrum_pools_fees.sql similarity index 75% rename from models/balancer/arbitrum/balancer_v2_arbitrum_pools_fees.sql rename to models/_project/balancer/pools/arbitrum/balancer_v2_arbitrum_pools_fees.sql index 105650c0b9b..39b5671f202 100644 --- a/models/balancer/arbitrum/balancer_v2_arbitrum_pools_fees.sql +++ b/models/_project/balancer/pools/arbitrum/balancer_v2_arbitrum_pools_fees.sql @@ -1,17 +1,12 @@ {{ config( - schema = 'balancer_v2_arbitrum', - + schema = 'balancer_v2_arbitrum', alias = 'pools_fees', materialized = 'incremental', file_format = 'delta', incremental_strategy = 'merge', - unique_key = ['block_number', 'tx_hash', 'index'], - post_hook='{{ expose_spells(\'["arbitrum"]\', - "project", - "balancer_v2", - \'["metacrypto", "jacektrocinski", "thetroyharris", "viniabussafi"]\') }}' - )  + unique_key = ['block_number', 'tx_hash', 'index'] + ) }} {% set event_signature = '0xa9ba3ffe0b6c366b81232caab38605a0699ad5398d6cce76f91ee809e322dafc' %} diff --git a/models/balancer/arbitrum/balancer_v2_arbitrum_pools_tokens_weights.sql b/models/_project/balancer/pools/arbitrum/balancer_v2_arbitrum_pools_tokens_weights.sql similarity index 99% rename from models/balancer/arbitrum/balancer_v2_arbitrum_pools_tokens_weights.sql rename to models/_project/balancer/pools/arbitrum/balancer_v2_arbitrum_pools_tokens_weights.sql index 16ee7481c9b..ae20e0126b1 100644 --- a/models/balancer/arbitrum/balancer_v2_arbitrum_pools_tokens_weights.sql +++ b/models/_project/balancer/pools/arbitrum/balancer_v2_arbitrum_pools_tokens_weights.sql @@ -2,7 +2,6 @@ config( schema='balancer_v2_arbitrum', alias = 'pools_tokens_weights', - materialized = 'incremental', file_format = 'delta', incremental_strategy = 'merge', diff --git a/models/_project/balancer/pools/avalanche_c/_schema.yml b/models/_project/balancer/pools/avalanche_c/_schema.yml new file mode 100644 index 00000000000..2c5082a751c --- /dev/null +++ b/models/_project/balancer/pools/avalanche_c/_schema.yml @@ -0,0 +1,105 @@ +version: 2 + +models: + - name: balancer_v2_avalanche_c_pools_fees + meta: + blockchain: avalanche_c + project: balancer_v2 + contributors: jacektrocinski, thetroyharris, viniabussafi + config: + tags: ['avalanche_c', 'balancer', 'pools_fees'] + description: > + Balancer v2 swap fees stored at the pool level. + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - block_number + - tx_hash + - index + columns: + - &blockchain + name: blockchain + description: "Blockchain" + - &version + name: version + description: "Version of Balancer where the liquidity pool used in transaction is deployed" + - &contract_address + name: contract_address + description: 'avalanche_c address for the liquidity pool used in transaction' + tests: + - not_null + - &tx_hash + name: tx_hash + description: 'Transaction hash' + tests: + - not_null + - &index + name: index + description: 'Event Index' + tests: + - not_null + - &tx_index + name: tx_index + description: 'Transaction Index' + tests: + - not_null + - &block_time + name: block_time + description: 'Block time in UTC' + tests: + - not_null + - &block_number + name: block_number + description: 'Event Block Number' + tests: + - not_null + - &swap_fee_percentage + name: swap_fee_percentage + description: 'Swap fees for the pool, values are returned with 18 decimals (1e18 meaning 100%)' + tests: + - not_null + + - name: balancer_avalanche_c_pools_tokens_weights + meta: + blockchain: avalanche_c + project: balancer + contributors: jacektrocinski, viniabussafi + config: + tags: ['avalanche_c', 'balancer', 'pools', 'tokens', 'weights'] + description: > + Token weights in Balancer pools. + columns: + - *blockchain + - *version + - &pool_id + name: pool_id + description: 'Unique encoded identifier that refers to each pool' + tests: + - not_null + - &token_address + name: token_address + description: 'Contract address for the token' + - &normalized_weight + name: normalized_weight + description: 'Weight of the token in the pool.' + + - name: balancer_v2_avalanche_c_pools_tokens_weights + meta: + blockchain: avalanche_c + project: balancer + contributors: jacektrocinski, viniabussafi + config: + tags: ['avalanche_c', 'balancer', 'pools', 'tokens', 'weights'] + description: > + Token weights in Balancer v2 pools. + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - pool_id + - token_address + columns: + - *blockchain + - *version + - *pool_id + - *token_address + - *normalized_weight \ No newline at end of file diff --git a/models/balancer/avalanche_c/balancer_avalanche_c_pools_tokens_weights.sql b/models/_project/balancer/pools/avalanche_c/balancer_avalanche_c_pools_tokens_weights.sql similarity index 100% rename from models/balancer/avalanche_c/balancer_avalanche_c_pools_tokens_weights.sql rename to models/_project/balancer/pools/avalanche_c/balancer_avalanche_c_pools_tokens_weights.sql diff --git a/models/balancer/avalanche_c/balancer_v2_avalanche_c_pools_fees.sql b/models/_project/balancer/pools/avalanche_c/balancer_v2_avalanche_c_pools_fees.sql similarity index 77% rename from models/balancer/avalanche_c/balancer_v2_avalanche_c_pools_fees.sql rename to models/_project/balancer/pools/avalanche_c/balancer_v2_avalanche_c_pools_fees.sql index 1b52e13c114..e3aae2cdf1a 100644 --- a/models/balancer/avalanche_c/balancer_v2_avalanche_c_pools_fees.sql +++ b/models/_project/balancer/pools/avalanche_c/balancer_v2_avalanche_c_pools_fees.sql @@ -1,17 +1,12 @@ {{ config( schema = 'balancer_v2_avalanche_c', - alias = 'pools_fees', materialized = 'incremental', file_format = 'delta', incremental_strategy = 'merge', - unique_key = ['block_number', 'tx_hash', 'index'], - post_hook='{{ expose_spells(\'["avalanche_c"]\', - "project", - "balancer_v2", - \'["metacrypto", "jacektrocinski", "thetroyharris", "viniabussafi"]\') }}' - )  + unique_key = ['block_number', 'tx_hash', 'index'] + ) }} {% set event_signature = '0xa9ba3ffe0b6c366b81232caab38605a0699ad5398d6cce76f91ee809e322dafc' %} diff --git a/models/balancer/avalanche_c/balancer_v2_avalanche_c_pools_tokens_weights.sql b/models/_project/balancer/pools/avalanche_c/balancer_v2_avalanche_c_pools_tokens_weights.sql similarity index 99% rename from models/balancer/avalanche_c/balancer_v2_avalanche_c_pools_tokens_weights.sql rename to models/_project/balancer/pools/avalanche_c/balancer_v2_avalanche_c_pools_tokens_weights.sql index 730b6b327f5..48bbb28e693 100644 --- a/models/balancer/avalanche_c/balancer_v2_avalanche_c_pools_tokens_weights.sql +++ b/models/_project/balancer/pools/avalanche_c/balancer_v2_avalanche_c_pools_tokens_weights.sql @@ -2,7 +2,6 @@ config( schema='balancer_v2_avalanche_c', alias = 'pools_tokens_weights', - materialized = 'incremental', file_format = 'delta', incremental_strategy = 'merge', diff --git a/models/balancer/balancer_gauge_mappings.sql b/models/_project/balancer/pools/balancer_gauge_mappings.sql similarity index 78% rename from models/balancer/balancer_gauge_mappings.sql rename to models/_project/balancer/pools/balancer_gauge_mappings.sql index b764f659dde..0ad73a0a700 100644 --- a/models/balancer/balancer_gauge_mappings.sql +++ b/models/_project/balancer/pools/balancer_gauge_mappings.sql @@ -1,11 +1,10 @@ {{ config( schema = 'balancer', - alias = 'gauge_mappings', post_hook='{{ expose_spells(\'["optimism"]\', - "project", - "balancer", - \'["msilb7"]\') }}' + spell_type = "project", + spell_name = "balancer", + contributors = \'["msilb7"]\') }}' ) }} diff --git a/models/balancer/balancer_pools_fees.sql b/models/_project/balancer/pools/balancer_pools_fees.sql similarity index 69% rename from models/balancer/balancer_pools_fees.sql rename to models/_project/balancer/pools/balancer_pools_fees.sql index e638f381024..2a54b518ec1 100644 --- a/models/balancer/balancer_pools_fees.sql +++ b/models/_project/balancer/pools/balancer_pools_fees.sql @@ -1,11 +1,10 @@ {{ config( schema = 'balancer', - alias = 'pools_fees', - post_hook='{{ expose_spells(\'["arbitrum", "avalanche_c", "base", "ethereum", "gnosis", "optimism", "polygon", "zkevm"]\', - "project", - "balancer", - \'["thetroyharris", "viniabussafi"]\') }}' + post_hook='{{ expose_spells(blockchains = \'["arbitrum", "avalanche_c", "base", "ethereum", "gnosis", "optimism", "polygon", "zkevm"]\', + spell_type = "project", + spell_name = "balancer", + contributors = \'["thetroyharris", "viniabussafi"]\') }}' ) }} diff --git a/models/balancer/balancer_pools_metrics_daily.sql b/models/_project/balancer/pools/balancer_pools_metrics_daily.sql similarity index 100% rename from models/balancer/balancer_pools_metrics_daily.sql rename to models/_project/balancer/pools/balancer_pools_metrics_daily.sql diff --git a/models/balancer/balancer_pools_tokens_weights.sql b/models/_project/balancer/pools/balancer_pools_tokens_weights.sql similarity index 71% rename from models/balancer/balancer_pools_tokens_weights.sql rename to models/_project/balancer/pools/balancer_pools_tokens_weights.sql index 95a71d1c294..d2e50c49ce9 100644 --- a/models/balancer/balancer_pools_tokens_weights.sql +++ b/models/_project/balancer/pools/balancer_pools_tokens_weights.sql @@ -1,10 +1,10 @@ {{ config( schema = 'balancer', alias = 'pools_tokens_weights', - post_hook='{{ expose_spells(\'["arbitrum", "avalanche_c", "base", "ethereum", "gnosis", "optimism", "polygon"]\', - "project", - "balancer", - \'["viniabussafi"]\') }}' + post_hook='{{ expose_spells(blockchains = \'["arbitrum", "avalanche_c", "base", "ethereum", "gnosis", "optimism", "polygon", "zkevm"]\', + spell_type = "project", + spell_name = "balancer", + contributors = \'["viniabussafi"]\') }}' ) }} diff --git a/models/_project/balancer/pools/base/_schema.yml b/models/_project/balancer/pools/base/_schema.yml new file mode 100644 index 00000000000..0949d82f17c --- /dev/null +++ b/models/_project/balancer/pools/base/_schema.yml @@ -0,0 +1,105 @@ +version: 2 + +models: + - name: balancer_v2_base_pools_fees + meta: + blockchain: base + project: balancer_v2 + contributors: jacektrocinski, thetroyharris, viniabussafi + config: + tags: ['base', 'balancer', 'pools_fees'] + description: > + Balancer v2 swap fees stored at the pool level. + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - block_number + - tx_hash + - index + columns: + - &blockchain + name: blockchain + description: "Blockchain" + - &version + name: version + description: "Version of Balancer where the liquidity pool used in transaction is deployed" + - &contract_address + name: contract_address + description: 'base address for the liquidity pool used in transaction' + tests: + - not_null + - &tx_hash + name: tx_hash + description: 'Transaction hash' + tests: + - not_null + - &index + name: index + description: 'Event Index' + tests: + - not_null + - &tx_index + name: tx_index + description: 'Transaction Index' + tests: + - not_null + - &block_time + name: block_time + description: 'Block time in UTC' + tests: + - not_null + - &block_number + name: block_number + description: 'Event Block Number' + tests: + - not_null + - &swap_fee_percentage + name: swap_fee_percentage + description: 'Swap fees for the pool, values are returned with 18 decimals (1e18 meaning 100%)' + tests: + - not_null + + - name: balancer_base_pools_tokens_weights + meta: + blockchain: base + project: balancer + contributors: jacektrocinski, viniabussafi + config: + tags: ['base', 'balancer', 'pools', 'tokens', 'weights'] + description: > + Token weights in Balancer pools. + columns: + - *blockchain + - *version + - &pool_id + name: pool_id + description: 'Unique encoded identifier that refers to each pool' + tests: + - not_null + - &token_address + name: token_address + description: 'Contract address for the token' + - &normalized_weight + name: normalized_weight + description: 'Weight of the token in the pool.' + + - name: balancer_v2_base_pools_tokens_weights + meta: + blockchain: base + project: balancer + contributors: jacektrocinski, viniabussafi + config: + tags: ['base', 'balancer', 'pools', 'tokens', 'weights'] + description: > + Token weights in Balancer v2 pools. + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - pool_id + - token_address + columns: + - *blockchain + - *version + - *pool_id + - *token_address + - *normalized_weight \ No newline at end of file diff --git a/models/balancer/base/balancer_base_pools_tokens_weights.sql b/models/_project/balancer/pools/base/balancer_base_pools_tokens_weights.sql similarity index 100% rename from models/balancer/base/balancer_base_pools_tokens_weights.sql rename to models/_project/balancer/pools/base/balancer_base_pools_tokens_weights.sql diff --git a/models/balancer/base/balancer_v2_base_pools_fees.sql b/models/_project/balancer/pools/base/balancer_v2_base_pools_fees.sql similarity index 77% rename from models/balancer/base/balancer_v2_base_pools_fees.sql rename to models/_project/balancer/pools/base/balancer_v2_base_pools_fees.sql index 7aaf2ef8939..c4029cb33d6 100644 --- a/models/balancer/base/balancer_v2_base_pools_fees.sql +++ b/models/_project/balancer/pools/base/balancer_v2_base_pools_fees.sql @@ -1,17 +1,12 @@ {{ config( schema = 'balancer_v2_base', - alias = 'pools_fees', materialized = 'incremental', file_format = 'delta', incremental_strategy = 'merge', - unique_key = ['block_number', 'tx_hash', 'index'], - post_hook='{{ expose_spells(\'["base"]\', - "project", - "balancer_v2", - \'["metacrypto", "jacektrocinski", "thetroyharris", "viniabussafi"]\') }}' - )  + unique_key = ['block_number', 'tx_hash', 'index'] + ) }} {% set event_signature = '0xa9ba3ffe0b6c366b81232caab38605a0699ad5398d6cce76f91ee809e322dafc' %} diff --git a/models/balancer/base/balancer_v2_base_pools_tokens_weights.sql b/models/_project/balancer/pools/base/balancer_v2_base_pools_tokens_weights.sql similarity index 99% rename from models/balancer/base/balancer_v2_base_pools_tokens_weights.sql rename to models/_project/balancer/pools/base/balancer_v2_base_pools_tokens_weights.sql index 29086428514..531e3214489 100644 --- a/models/balancer/base/balancer_v2_base_pools_tokens_weights.sql +++ b/models/_project/balancer/pools/base/balancer_v2_base_pools_tokens_weights.sql @@ -2,7 +2,6 @@ config( schema='balancer_v2_base', alias = 'pools_tokens_weights', - materialized = 'incremental', file_format = 'delta', incremental_strategy = 'merge', diff --git a/models/_project/balancer/pools/ethereum/_schema.yml b/models/_project/balancer/pools/ethereum/_schema.yml new file mode 100644 index 00000000000..ea4a24ef8c8 --- /dev/null +++ b/models/_project/balancer/pools/ethereum/_schema.yml @@ -0,0 +1,149 @@ +version: 2 + +models: + - name: balancer_v2_ethereum_pools_fees + meta: + blockchain: ethereum + project: balancer_v2 + contributors: jacektrocinski, thetroyharris, viniabussafi + config: + tags: ['ethereum', 'balancer', 'pools', 'fees'] + description: > + Balancer v2 swap fees stored at the pool level. + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - block_number + - tx_hash + - index + columns: + - &blockchain + name: blockchain + description: "Blockchain" + - &version + name: version + description: "Version of Balancer where the liquidity pool used in transaction is deployed" + - &contract_address + name: contract_address + description: 'zkevm address for the liquidity pool used in transaction' + tests: + - not_null + - &tx_hash + name: tx_hash + description: 'Transaction hash' + tests: + - not_null + - &index + name: index + description: 'Event Index' + tests: + - not_null + - &tx_index + name: tx_index + description: 'Transaction Index' + tests: + - not_null + - &block_time + name: block_time + description: 'Block time in UTC' + tests: + - not_null + - &block_number + name: block_number + description: 'Event Block Number' + tests: + - not_null + - &swap_fee_percentage + name: swap_fee_percentage + description: 'Swap fees for the pool, values are returned with 18 decimals (1e18 meaning 100%)' + tests: + - not_null + + - name: balancer_ethereum_pools_tokens_weights + meta: + blockchain: ethereum + project: balancer + contributors: jacektrocinski, viniabussafi + config: + tags: ['ethereum', 'balancer', 'pools', 'tokens', 'weights'] + description: > + Token weights in Balancer pools. + columns: + - *blockchain + - *version + - &pool_id + name: pool_id + description: 'Unique encoded identifier that refers to each pool' + tests: + - not_null + - &token_address + name: token_address + description: 'Contract address for the token' + - &normalized_weight + name: normalized_weight + description: 'Weight of the token in the pool.' + + - name: balancer_v1_ethereum_pools_tokens_weights + meta: + blockchain: ethereum + project: balancer + contributors: jacektrocinski, viniabussafi + config: + tags: ['ethereum', 'balancer', 'pools', 'tokens', 'weights'] + description: > + Token weights in Balancer v1 pools. + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - pool_id + - token_address + columns: + - *blockchain + - *version + - *pool_id + - *token_address + - *normalized_weight + + - name: balancer_v2_ethereum_pools_tokens_weights + meta: + blockchain: ethereum + project: balancer + contributors: jacektrocinski, viniabussafi + config: + tags: ['ethereum', 'balancer', 'pools', 'tokens', 'weights'] + description: > + Token weights in Balancer v2 pools. + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - pool_id + - token_address + columns: + - *blockchain + - *version + - *pool_id + - *token_address + - *normalized_weight + + - name: balancer_v2_ethereum_lbps + meta: + blockchain: ethereum + project: balancer_v2 + contributors: stefenon + config: + tags: ['ethereum', 'balancer', 'lbp'] + description: > + Record of the Liquidity Boostrapping Pools (LBP) of Balancer, an automated portfolio manager and trading platform, on Ethereum. + columns: + - name: name + description: "Name of the LBP" + - name: pool_id + description: "ID of the LBP" + - name: token_sold + description: "Contract address of the token sold by the LBP" + - name: token_symbol + description: "Symbol of the token sold by the LBP" + - name: start_time + description: "LBP start time" + - name: end_time + description: "LBP end time" \ No newline at end of file diff --git a/models/balancer/ethereum/balancer_ethereum_pools_tokens_weights.sql b/models/_project/balancer/pools/ethereum/balancer_ethereum_pools_tokens_weights.sql similarity index 100% rename from models/balancer/ethereum/balancer_ethereum_pools_tokens_weights.sql rename to models/_project/balancer/pools/ethereum/balancer_ethereum_pools_tokens_weights.sql diff --git a/models/balancer/ethereum/balancer_v1_ethereum_pools_tokens_weights.sql b/models/_project/balancer/pools/ethereum/balancer_v1_ethereum_pools_tokens_weights.sql similarity index 93% rename from models/balancer/ethereum/balancer_v1_ethereum_pools_tokens_weights.sql rename to models/_project/balancer/pools/ethereum/balancer_v1_ethereum_pools_tokens_weights.sql index 01b031110e7..eb0bd2626f6 100644 --- a/models/balancer/ethereum/balancer_v1_ethereum_pools_tokens_weights.sql +++ b/models/_project/balancer/pools/ethereum/balancer_v1_ethereum_pools_tokens_weights.sql @@ -2,15 +2,10 @@ config( schema='balancer_v1_ethereum', alias = 'pools_tokens_weights', - materialized = 'incremental', file_format = 'delta', incremental_strategy = 'merge', - unique_key = ['pool_id', 'token_address'], - post_hook='{{ expose_spells(\'["ethereum"]\', - "project", - "balancer_v1", - \'["metacrypto", "jacektrocinski"]\') }}' + unique_key = ['pool_id', 'token_address'] ) }} diff --git a/models/balancer/ethereum/balancer_v2_ethereum_lbps.sql b/models/_project/balancer/pools/ethereum/balancer_v2_ethereum_lbps.sql similarity index 100% rename from models/balancer/ethereum/balancer_v2_ethereum_lbps.sql rename to models/_project/balancer/pools/ethereum/balancer_v2_ethereum_lbps.sql diff --git a/models/balancer/ethereum/balancer_v2_ethereum_pools_fees.sql b/models/_project/balancer/pools/ethereum/balancer_v2_ethereum_pools_fees.sql similarity index 78% rename from models/balancer/ethereum/balancer_v2_ethereum_pools_fees.sql rename to models/_project/balancer/pools/ethereum/balancer_v2_ethereum_pools_fees.sql index 08bee4948e9..8e6041c0a42 100644 --- a/models/balancer/ethereum/balancer_v2_ethereum_pools_fees.sql +++ b/models/_project/balancer/pools/ethereum/balancer_v2_ethereum_pools_fees.sql @@ -1,16 +1,11 @@ {{ config( schema = 'balancer_v2_ethereum', - alias = 'pools_fees', materialized = 'incremental', file_format = 'delta', incremental_strategy = 'merge', - unique_key = ['block_number', 'tx_hash', 'index'], - post_hook='{{ expose_spells(\'["ethereum"]\', - "project", - "balancer_v2", - \'["metacrypto", "jacektrocinski", "thetroyharris", "viniabussafi"]\') }}' + unique_key = ['block_number', 'tx_hash', 'index'] )  }} diff --git a/models/balancer/ethereum/balancer_v2_ethereum_pools_tokens_weights.sql b/models/_project/balancer/pools/ethereum/balancer_v2_ethereum_pools_tokens_weights.sql similarity index 99% rename from models/balancer/ethereum/balancer_v2_ethereum_pools_tokens_weights.sql rename to models/_project/balancer/pools/ethereum/balancer_v2_ethereum_pools_tokens_weights.sql index fd0cfd29bb6..3fe74c18771 100644 --- a/models/balancer/ethereum/balancer_v2_ethereum_pools_tokens_weights.sql +++ b/models/_project/balancer/pools/ethereum/balancer_v2_ethereum_pools_tokens_weights.sql @@ -2,7 +2,6 @@ config( schema='balancer_v2_ethereum', alias = 'pools_tokens_weights', - materialized = 'incremental', file_format = 'delta', incremental_strategy = 'merge', diff --git a/models/_project/balancer/pools/gnosis/_schema.yml b/models/_project/balancer/pools/gnosis/_schema.yml new file mode 100644 index 00000000000..ac61b0140a4 --- /dev/null +++ b/models/_project/balancer/pools/gnosis/_schema.yml @@ -0,0 +1,105 @@ +version: 2 + +models: + - name: balancer_v2_gnosis_pools_fees + meta: + blockchain: gnosis + project: balancer_v2 + contributors: jacektrocinski, thetroyharris, viniabussafi + config: + tags: ['gnosis', 'balancer', 'pools_fees'] + description: > + Balancer v2 swap fees stored at the pool level. + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - block_number + - tx_hash + - index + columns: + - &blockchain + name: blockchain + description: "Blockchain" + - &version + name: version + description: "Version of Balancer where the liquidity pool used in transaction is deployed" + - &contract_address + name: contract_address + description: 'gnosis address for the liquidity pool used in transaction' + tests: + - not_null + - &tx_hash + name: tx_hash + description: 'Transaction hash' + tests: + - not_null + - &index + name: index + description: 'Event Index' + tests: + - not_null + - &tx_index + name: tx_index + description: 'Transaction Index' + tests: + - not_null + - &block_time + name: block_time + description: 'Block time in UTC' + tests: + - not_null + - &block_number + name: block_number + description: 'Event Block Number' + tests: + - not_null + - &swap_fee_percentage + name: swap_fee_percentage + description: 'Swap fees for the pool, values are returned with 18 decimals (1e18 meaning 100%)' + tests: + - not_null + + - name: balancer_gnosis_pools_tokens_weights + meta: + blockchain: gnosis + project: balancer + contributors: jacektrocinski, viniabussafi + config: + tags: ['gnosis', 'balancer', 'pools', 'tokens', 'weights'] + description: > + Token weights in Balancer pools. + columns: + - *blockchain + - *version + - &pool_id + name: pool_id + description: 'Unique encoded identifier that refers to each pool' + tests: + - not_null + - &token_address + name: token_address + description: 'Contract address for the token' + - &normalized_weight + name: normalized_weight + description: 'Weight of the token in the pool.' + + - name: balancer_v2_gnosis_pools_tokens_weights + meta: + blockchain: gnosis + project: balancer + contributors: jacektrocinski, viniabussafi + config: + tags: ['gnosis', 'balancer', 'pools', 'tokens', 'weights'] + description: > + Token weights in Balancer v2 pools. + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - pool_id + - token_address + columns: + - *blockchain + - *version + - *pool_id + - *token_address + - *normalized_weight \ No newline at end of file diff --git a/models/balancer/gnosis/balancer_gnosis_pools_tokens_weights.sql b/models/_project/balancer/pools/gnosis/balancer_gnosis_pools_tokens_weights.sql similarity index 100% rename from models/balancer/gnosis/balancer_gnosis_pools_tokens_weights.sql rename to models/_project/balancer/pools/gnosis/balancer_gnosis_pools_tokens_weights.sql diff --git a/models/balancer/gnosis/balancer_v2_gnosis_pools_fees.sql b/models/_project/balancer/pools/gnosis/balancer_v2_gnosis_pools_fees.sql similarity index 77% rename from models/balancer/gnosis/balancer_v2_gnosis_pools_fees.sql rename to models/_project/balancer/pools/gnosis/balancer_v2_gnosis_pools_fees.sql index de1a7618af6..086072fc70b 100644 --- a/models/balancer/gnosis/balancer_v2_gnosis_pools_fees.sql +++ b/models/_project/balancer/pools/gnosis/balancer_v2_gnosis_pools_fees.sql @@ -1,17 +1,12 @@ {{ config( schema = 'balancer_v2_gnosis', - alias = 'pools_fees', materialized = 'incremental', file_format = 'delta', incremental_strategy = 'merge', - unique_key = ['block_number', 'tx_hash', 'index'], - post_hook='{{ expose_spells(\'["gnosis"]\', - "project", - "balancer_v2", - \'["metacrypto", "jacektrocinski", "thetroyharris", "viniabussafi"]\') }}' - )  + unique_key = ['block_number', 'tx_hash', 'index'] + ) }} {% set event_signature = '0xa9ba3ffe0b6c366b81232caab38605a0699ad5398d6cce76f91ee809e322dafc' %} diff --git a/models/balancer/gnosis/balancer_v2_gnosis_pools_tokens_weights.sql b/models/_project/balancer/pools/gnosis/balancer_v2_gnosis_pools_tokens_weights.sql similarity index 99% rename from models/balancer/gnosis/balancer_v2_gnosis_pools_tokens_weights.sql rename to models/_project/balancer/pools/gnosis/balancer_v2_gnosis_pools_tokens_weights.sql index ee2bef6e0a7..a4b0a7688a8 100644 --- a/models/balancer/gnosis/balancer_v2_gnosis_pools_tokens_weights.sql +++ b/models/_project/balancer/pools/gnosis/balancer_v2_gnosis_pools_tokens_weights.sql @@ -2,7 +2,6 @@ config( schema='balancer_v2_gnosis', alias = 'pools_tokens_weights', - materialized = 'incremental', file_format = 'delta', incremental_strategy = 'merge', diff --git a/models/_project/balancer/pools/optimism/_schema.yml b/models/_project/balancer/pools/optimism/_schema.yml new file mode 100644 index 00000000000..289820cd3bc --- /dev/null +++ b/models/_project/balancer/pools/optimism/_schema.yml @@ -0,0 +1,146 @@ +version: 2 + +models: + - name: balancer_v2_optimism_pools_fees + meta: + blockchain: optimism + project: balancer_v2 + contributors: jacektrocinski, thetroyharris, viniabussafi + config: + tags: ['optimism', 'balancer', 'pools_fees'] + description: > + Balancer v2 swap fees stored at the pool level. + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - block_number + - tx_hash + - index + columns: + - &blockchain + name: blockchain + description: "Blockchain" + - &version + name: version + description: "Version of Balancer where the liquidity pool used in transaction is deployed" + - &contract_address + name: contract_address + description: 'optimism address for the liquidity pool used in transaction' + tests: + - not_null + - &tx_hash + name: tx_hash + description: 'Transaction hash' + tests: + - not_null + - &index + name: index + description: 'Event Index' + tests: + - not_null + - &tx_index + name: tx_index + description: 'Transaction Index' + tests: + - not_null + - &block_time + name: block_time + description: 'Block time in UTC' + tests: + - not_null + - &block_number + name: block_number + description: 'Event Block Number' + tests: + - not_null + - &swap_fee_percentage + name: swap_fee_percentage + description: 'Swap fees for the pool, values are returned with 18 decimals (1e18 meaning 100%)' + tests: + - not_null + + - name: balancer_optimism_pools_tokens_weights + meta: + blockchain: optimism + project: balancer + contributors: jacektrocinski, viniabussafi + config: + tags: ['optimism', 'balancer', 'pools', 'tokens', 'weights'] + description: > + Token weights in Balancer pools. + columns: + - *blockchain + - *version + - &pool_id + name: pool_id + description: 'Unique encoded identifier that refers to each pool' + tests: + - not_null + - &token_address + name: token_address + description: 'Contract address for the token' + - &normalized_weight + name: normalized_weight + description: 'Weight of the token in the pool.' + + - name: balancer_v2_optimism_pools_tokens_weights + meta: + blockchain: optimism + project: balancer + contributors: jacektrocinski, viniabussafi + config: + tags: ['optimism', 'balancer', 'pools', 'tokens', 'weights'] + description: > + Token weights in Balancer v2 pools. + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - pool_id + - token_address + columns: + - *blockchain + - *version + - *pool_id + - *token_address + - *normalized_weight + + - name: balancer_optimism_gauge_mappings + meta: + blockchain: optimism + project: balancer + contributors: msilb7 + config: + tags: ['optimism', 'balancer', 'gauges', 'incentives'] + description: > + Balancer gauge to pool mappings on Optimism. + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - pool_contract + - incentives_contract + columns: + - *blockchain + - *version + - &pool_contract + name: pool_contract + description: "Address of the liquidity pool contract" + - *pool_id + - &incentives_contract + name: incentives_contract + description: "Address of the contract where incentives are stored and emitted." + - &incentives_type + name: incentives_type + description: "Description of the incentives address type." + - &evt_block_time + name: evt_block_time + description: "Block time in UTC" + - &evt_block_number + name: evt_block_number + description: 'Event Block Number' + - *contract_address + - &evt_tx_hash + name: evt_tx_hash + description: 'Transaction hash' + - &evt_index + name: evT_index + description: 'Event Index' \ No newline at end of file diff --git a/models/balancer/optimism/balancer_optimism_gauge_mappings.sql b/models/_project/balancer/pools/optimism/balancer_optimism_gauge_mappings.sql similarity index 87% rename from models/balancer/optimism/balancer_optimism_gauge_mappings.sql rename to models/_project/balancer/pools/optimism/balancer_optimism_gauge_mappings.sql index 382424a91be..10ecdde4e86 100644 --- a/models/balancer/optimism/balancer_optimism_gauge_mappings.sql +++ b/models/_project/balancer/pools/optimism/balancer_optimism_gauge_mappings.sql @@ -1,16 +1,15 @@ {{ config( schema = 'balancer_optimism', - alias = 'gauge_mappings', materialized = 'incremental', file_format = 'delta', incremental_strategy = 'merge', unique_key = ['pool_contract', 'incentives_contract'], post_hook='{{ expose_spells(\'["optimism"]\', - "project", - "balancer", - \'["msilb7"]\') }}' + spell_type = "project", + spell_name = "balancer", + contributors = \'["msilb7"]\') }}' )  }} diff --git a/models/balancer/optimism/balancer_optimism_pools_tokens_weights.sql b/models/_project/balancer/pools/optimism/balancer_optimism_pools_tokens_weights.sql similarity index 86% rename from models/balancer/optimism/balancer_optimism_pools_tokens_weights.sql rename to models/_project/balancer/pools/optimism/balancer_optimism_pools_tokens_weights.sql index b6bdf48de02..204da50aa15 100644 --- a/models/balancer/optimism/balancer_optimism_pools_tokens_weights.sql +++ b/models/_project/balancer/pools/optimism/balancer_optimism_pools_tokens_weights.sql @@ -1,7 +1,6 @@ {{ config( schema = 'balancer_optimism', - alias = 'pools_tokens_weights', - + alias = 'pools_tokens_weights' ) }} diff --git a/models/balancer/optimism/balancer_v2_optimism_pools_fees.sql b/models/_project/balancer/pools/optimism/balancer_v2_optimism_pools_fees.sql similarity index 77% rename from models/balancer/optimism/balancer_v2_optimism_pools_fees.sql rename to models/_project/balancer/pools/optimism/balancer_v2_optimism_pools_fees.sql index adeeb98918e..7cde533a681 100644 --- a/models/balancer/optimism/balancer_v2_optimism_pools_fees.sql +++ b/models/_project/balancer/pools/optimism/balancer_v2_optimism_pools_fees.sql @@ -1,17 +1,12 @@ {{ config( schema = 'balancer_v2_optimism', - alias = 'pools_fees', materialized = 'incremental', file_format = 'delta', incremental_strategy = 'merge', - unique_key = ['block_number', 'tx_hash', 'index'], - post_hook='{{ expose_spells(\'["optimism"]\', - "project", - "balancer_v2", - \'["metacrypto", "jacektrocinski", "thetroyharris", "viniabussafi"]\') }}' - )  + unique_key = ['block_number', 'tx_hash', 'index'] + ) }} {% set event_signature = '0xa9ba3ffe0b6c366b81232caab38605a0699ad5398d6cce76f91ee809e322dafc' %} diff --git a/models/balancer/optimism/balancer_v2_optimism_pools_tokens_weights.sql b/models/_project/balancer/pools/optimism/balancer_v2_optimism_pools_tokens_weights.sql similarity index 99% rename from models/balancer/optimism/balancer_v2_optimism_pools_tokens_weights.sql rename to models/_project/balancer/pools/optimism/balancer_v2_optimism_pools_tokens_weights.sql index 74220656f88..0888c1c2a0b 100644 --- a/models/balancer/optimism/balancer_v2_optimism_pools_tokens_weights.sql +++ b/models/_project/balancer/pools/optimism/balancer_v2_optimism_pools_tokens_weights.sql @@ -2,7 +2,6 @@ config( schema='balancer_v2_optimism', alias = 'pools_tokens_weights', - materialized = 'incremental', file_format = 'delta', incremental_strategy = 'merge', diff --git a/models/_project/balancer/pools/polygon/_schema.yml b/models/_project/balancer/pools/polygon/_schema.yml new file mode 100644 index 00000000000..40929f01c30 --- /dev/null +++ b/models/_project/balancer/pools/polygon/_schema.yml @@ -0,0 +1,128 @@ +version: 2 + +models: + - name: balancer_v2_polygon_pools_fees + meta: + blockchain: polygon + project: balancer_v2 + contributors: jacektrocinski, thetroyharris, viniabussafi + config: + tags: ['polygon', 'balancer', 'pools', 'fees'] + description: > + Balancer v2 swap fees stored at the pool level. + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - block_number + - tx_hash + - index + columns: + - &blockchain + name: blockchain + description: "Blockchain" + - &version + name: version + description: "Version of Balancer where the liquidity pool used in transaction is deployed" + - &contract_address + name: contract_address + description: 'zkevm address for the liquidity pool used in transaction' + tests: + - not_null + - &tx_hash + name: tx_hash + description: 'Transaction hash' + tests: + - not_null + - &index + name: index + description: 'Event Index' + tests: + - not_null + - &tx_index + name: tx_index + description: 'Transaction Index' + tests: + - not_null + - &block_time + name: block_time + description: 'Block time in UTC' + tests: + - not_null + - &block_number + name: block_number + description: 'Event Block Number' + tests: + - not_null + - &swap_fee_percentage + name: swap_fee_percentage + description: 'Swap fees for the pool, values are returned with 18 decimals (1e18 meaning 100%)' + tests: + - not_null + + - name: balancer_polygon_pools_tokens_weights + meta: + blockchain: polygon + project: balancer + contributors: jacektrocinski, viniabussafi + config: + tags: ['polygon', 'balancer', 'pools', 'tokens', 'weights'] + description: > + Token weights in Balancer pools. + columns: + - *blockchain + - *version + - &pool_id + name: pool_id + description: 'Unique encoded identifier that refers to each pool' + tests: + - not_null + - &token_address + name: token_address + description: 'Contract address for the token' + - &normalized_weight + name: normalized_weight + description: 'Weight of the token in the pool.' + + - name: balancer_v2_polygon_pools_tokens_weights + meta: + blockchain: polygon + project: balancer + contributors: jacektrocinski, viniabussafi + config: + tags: ['polygon', 'balancer', 'pools', 'tokens', 'weights'] + description: > + Token weights in Balancer v2 pools. + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - pool_id + - token_address + columns: + - *blockchain + - *version + - *pool_id + - *token_address + - *normalized_weight + + - name: balancer_v2_polygon_lbps + meta: + blockchain: polygon + project: balancer_v2 + contributors: stefenon + config: + tags: ['polygon', 'balancer', 'lbp'] + description: > + Record of the Liquidity Boostrapping Pools (LBP) of Balancer, an automated portfolio manager and trading platform, on polygon. + columns: + - name: name + description: "Name of the LBP" + - name: pool_id + description: "ID of the LBP" + - name: token_sold + description: "Contract address of the token sold by the LBP" + - name: token_symbol + description: "Symbol of the token sold by the LBP" + - name: start_time + description: "LBP start time" + - name: end_time + description: "LBP end time" \ No newline at end of file diff --git a/models/balancer/polygon/balancer_polygon_pools_tokens_weights.sql b/models/_project/balancer/pools/polygon/balancer_polygon_pools_tokens_weights.sql similarity index 100% rename from models/balancer/polygon/balancer_polygon_pools_tokens_weights.sql rename to models/_project/balancer/pools/polygon/balancer_polygon_pools_tokens_weights.sql diff --git a/models/balancer/polygon/balancer_v2_polygon_lbps.sql b/models/_project/balancer/pools/polygon/balancer_v2_polygon_lbps.sql similarity index 100% rename from models/balancer/polygon/balancer_v2_polygon_lbps.sql rename to models/_project/balancer/pools/polygon/balancer_v2_polygon_lbps.sql diff --git a/models/balancer/polygon/balancer_v2_polygon_pools_fees.sql b/models/_project/balancer/pools/polygon/balancer_v2_polygon_pools_fees.sql similarity index 77% rename from models/balancer/polygon/balancer_v2_polygon_pools_fees.sql rename to models/_project/balancer/pools/polygon/balancer_v2_polygon_pools_fees.sql index 556cb0003af..586839b9ff9 100644 --- a/models/balancer/polygon/balancer_v2_polygon_pools_fees.sql +++ b/models/_project/balancer/pools/polygon/balancer_v2_polygon_pools_fees.sql @@ -1,17 +1,12 @@ {{ config( schema = 'balancer_v2_polygon', - alias = 'pools_fees', materialized = 'incremental', file_format = 'delta', incremental_strategy = 'merge', - unique_key = ['block_number', 'tx_hash', 'index'], - post_hook='{{ expose_spells(\'["polygon"]\', - "project", - "balancer_v2", - \'["metacrypto", "jacektrocinski", "thetroyharris", "viniabussafi"]\') }}' - )  + unique_key = ['block_number', 'tx_hash', 'index'] + ) }} {% set event_signature = '0xa9ba3ffe0b6c366b81232caab38605a0699ad5398d6cce76f91ee809e322dafc' %} diff --git a/models/balancer/polygon/balancer_v2_polygon_pools_tokens_weights.sql b/models/_project/balancer/pools/polygon/balancer_v2_polygon_pools_tokens_weights.sql similarity index 99% rename from models/balancer/polygon/balancer_v2_polygon_pools_tokens_weights.sql rename to models/_project/balancer/pools/polygon/balancer_v2_polygon_pools_tokens_weights.sql index afc223ecb81..20023ba61c3 100644 --- a/models/balancer/polygon/balancer_v2_polygon_pools_tokens_weights.sql +++ b/models/_project/balancer/pools/polygon/balancer_v2_polygon_pools_tokens_weights.sql @@ -2,7 +2,6 @@ config( schema='balancer_v2_polygon', alias = 'pools_tokens_weights', - materialized = 'incremental', file_format = 'delta', incremental_strategy = 'merge', diff --git a/models/_project/balancer/pools/zkevm/_schema.yml b/models/_project/balancer/pools/zkevm/_schema.yml new file mode 100644 index 00000000000..03f7ab4e6be --- /dev/null +++ b/models/_project/balancer/pools/zkevm/_schema.yml @@ -0,0 +1,105 @@ +version: 2 + +models: + - name: balancer_v2_zkevm_pools_fees + meta: + blockchain: zkevm + project: balancer_v2 + contributors: jacektrocinski, thetroyharris, viniabussafi + config: + tags: ['zkevm', 'balancer', 'pools_fees'] + description: > + Balancer v2 swap fees stored at the pool level. + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - block_number + - tx_hash + - index + columns: + - &blockchain + name: blockchain + description: "Blockchain" + - &version + name: version + description: "Version of Balancer where the liquidity pool used in transaction is deployed" + - &contract_address + name: contract_address + description: 'zkevm address for the liquidity pool used in transaction' + tests: + - not_null + - &tx_hash + name: tx_hash + description: 'Transaction hash' + tests: + - not_null + - &index + name: index + description: 'Event Index' + tests: + - not_null + - &tx_index + name: tx_index + description: 'Transaction Index' + tests: + - not_null + - &block_time + name: block_time + description: 'Block time in UTC' + tests: + - not_null + - &block_number + name: block_number + description: 'Event Block Number' + tests: + - not_null + - &swap_fee_percentage + name: swap_fee_percentage + description: 'Swap fees for the pool, values are returned with 18 decimals (1e18 meaning 100%)' + tests: + - not_null + + - name: balancer_zkevm_pools_tokens_weights + meta: + blockchain: zkevm + project: balancer + contributors: jacektrocinski, viniabussafi + config: + tags: ['zkevm', 'balancer', 'pools', 'tokens', 'weights'] + description: > + Token weights in Balancer pools. + columns: + - *blockchain + - *version + - &pool_id + name: pool_id + description: 'Unique encoded identifier that refers to each pool' + tests: + - not_null + - &token_address + name: token_address + description: 'Contract address for the token' + - &normalized_weight + name: normalized_weight + description: 'Weight of the token in the pool.' + + - name: balancer_v2_zkevm_pools_tokens_weights + meta: + blockchain: zkevm + project: balancer + contributors: jacektrocinski, viniabussafi + config: + tags: ['zkevm', 'balancer', 'pools', 'tokens', 'weights'] + description: > + Token weights in Balancer v2 pools. + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - pool_id + - token_address + columns: + - *blockchain + - *version + - *pool_id + - *token_address + - *normalized_weight \ No newline at end of file diff --git a/models/balancer/zkevm/balancer_v2_zkevm_pools_fees.sql b/models/_project/balancer/pools/zkevm/balancer_v2_zkevm_pools_fees.sql similarity index 82% rename from models/balancer/zkevm/balancer_v2_zkevm_pools_fees.sql rename to models/_project/balancer/pools/zkevm/balancer_v2_zkevm_pools_fees.sql index a92e4c5c00c..87bf3434eba 100644 --- a/models/balancer/zkevm/balancer_v2_zkevm_pools_fees.sql +++ b/models/_project/balancer/pools/zkevm/balancer_v2_zkevm_pools_fees.sql @@ -6,11 +6,7 @@ file_format = 'delta', incremental_strategy = 'merge', unique_key = ['block_number', 'tx_hash', 'index'], - post_hook='{{ expose_spells(\'["zkevm"]\', - "project", - "balancer_v2", - \'["metacrypto", "jacektrocinski", "thetroyharris", "viniabussafi"]\') }}' - )  + ) }} {% set event_signature = '0xa9ba3ffe0b6c366b81232caab38605a0699ad5398d6cce76f91ee809e322dafc' %} diff --git a/models/balancer/zkevm/balancer_v2_zkevm_pools_tokens_weights.sql b/models/_project/balancer/pools/zkevm/balancer_v2_zkevm_pools_tokens_weights.sql similarity index 100% rename from models/balancer/zkevm/balancer_v2_zkevm_pools_tokens_weights.sql rename to models/_project/balancer/pools/zkevm/balancer_v2_zkevm_pools_tokens_weights.sql diff --git a/models/balancer/zkevm/balancer_zkevm_pools_tokens_weights.sql b/models/_project/balancer/pools/zkevm/balancer_zkevm_pools_tokens_weights.sql similarity index 100% rename from models/balancer/zkevm/balancer_zkevm_pools_tokens_weights.sql rename to models/_project/balancer/pools/zkevm/balancer_zkevm_pools_tokens_weights.sql diff --git a/models/_project/balancer/protocol_fee/_schema.yml b/models/_project/balancer/protocol_fee/_schema.yml new file mode 100644 index 00000000000..ddc320d1692 --- /dev/null +++ b/models/_project/balancer/protocol_fee/_schema.yml @@ -0,0 +1,61 @@ +version: 2 + +models: + - name: balancer_protocol_fee + meta: + blockchain: arbitrum, avalanche_c, base, ethereum, gnosis, optimism, polygon, zkevm + project: balancer + contributors: viniabussafi + config: + tags: ['arbitrum', 'avalanche_c', 'base', 'ethereum', 'gnosis', 'optimism', 'polygon', 'zkevm', 'fees'] + description: > + Daily Protocol Fee collected and Revenue by pool on Balancer, an automated portfolio manager and trading platform. + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - day + - pool_id + - token_address + columns: + - &day + name: day + description: "Block date in UTC" + - &pool_id + name: pool_id + description: "Unique encoded identifier that refers to each pool" + - &pool_address + name: pool_address + description: "Pool address" + - &pool_symbol + name: pool_symbol + description: "Token symbols, followed by their respective weights, if applicable" + - &version + name: version + description: "Version of the project" + - &blockchain + name: blockchain + description: "Blockchain" + - &pool_type + name: pool_type + description: "Pool attributes, determined by the pool's factory" + - &token_address + name: token_address + description: "Contract address of the token in which protocol fees were collected" + - &token_symbol + name: token_symbol + description: Token symbol of the token in which protocol fees were collected" + - &token_amount_raw + name: token_amount_raw + description: "Raw amount of fees of the token in the pool at time of execution in the original currency" + - &token_amount + name: token_amount + description: "Normalized amount of fees of the token in the pool at time of execution in the original currency" + - &protocol_fee_collected_usd + name: protocol_fee_collected_usd + description: "USD value of the collected fee" + - &treasury_share + name: treasury_share + description: "Share of total fee that is directed to Balancer DAO's treasury, as per BIPs 19, 161 and 371" + - &treasury_revenue_usd + name: treasury_revenue_usd + description: "USD value of fee directed to Balancer DAO's treasury" \ No newline at end of file diff --git a/models/_project/balancer/protocol_fee/arbitrum/_schema.yml b/models/_project/balancer/protocol_fee/arbitrum/_schema.yml new file mode 100644 index 00000000000..b529565a645 --- /dev/null +++ b/models/_project/balancer/protocol_fee/arbitrum/_schema.yml @@ -0,0 +1,61 @@ +version: 2 + +models: + - name: balancer_v2_arbitrum_protocol_fee + meta: + blockchain: arbitrum + project: balancer_v2 + contributors: viniabussafi + config: + tags: ['arbitrum', 'protocol', 'fees'] + description: > + Daily Protocol Fee collected and Treasury Revenue by pool on Balancer, an automated portfolio manager and trading platform. + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - day + - pool_id + - token_address + columns: + - &day + name: day + description: "Block date in UTC" + - &pool_id + name: pool_id + description: "Unique encoded identifier that refers to each pool" + - &pool_address + name: pool_address + description: "Pool address" + - &pool_symbol + name: pool_symbol + description: "Token symbols, followed by their respective weights, if applicable" + - &version + name: version + description: "Version of the project" + - &blockchain + name: blockchain + description: "Blockchain" + - &pool_type + name: pool_type + description: "Pool attributes, determined by the pool's factory" + - &token_address + name: token_address + description: "Contract address of the token in which protocol fees were collected" + - &token_symbol + name: token_symbol + description: Token symbol of the token in which protocol fees were collected" + - &token_amount_raw + name: token_amount_raw + description: "Raw amount of fees of the token in the pool at time of execution in the original currency" + - &token_amount + name: token_amount + description: "Normalized amount of fees of the token in the pool at time of execution in the original currency" + - &protocol_fee_collected_usd + name: protocol_fee_collected_usd + description: "USD value of the collected fee" + - &treasury_share + name: treasury_share + description: "Share of total fee that is directed to Balancer DAO's treasury, as per BIPs 19, 161 and 371" + - &treasury_revenue_usd + name: treasury_revenue_usd + description: "USD value of fee directed to Balancer DAO's treasury" \ No newline at end of file diff --git a/models/balancer/arbitrum/balancer_v2_arbitrum_protocol_fee.sql b/models/_project/balancer/protocol_fee/arbitrum/balancer_v2_arbitrum_protocol_fee.sql similarity index 100% rename from models/balancer/arbitrum/balancer_v2_arbitrum_protocol_fee.sql rename to models/_project/balancer/protocol_fee/arbitrum/balancer_v2_arbitrum_protocol_fee.sql diff --git a/models/_project/balancer/protocol_fee/avalanche_c/_schema.yml b/models/_project/balancer/protocol_fee/avalanche_c/_schema.yml new file mode 100644 index 00000000000..536823df10d --- /dev/null +++ b/models/_project/balancer/protocol_fee/avalanche_c/_schema.yml @@ -0,0 +1,61 @@ +version: 2 + +models: + - name: balancer_v2_avalanche_c_protocol_fee + meta: + blockchain: avalanche_c + project: balancer_v2 + contributors: viniabussafi + config: + tags: ['avalanche_c', 'revenue', 'fees'] + description: > + Daily Protocol Fee collected and Revenue by pool on Balancer, an automated portfolio manager and trading platform. + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - day + - pool_id + - token_address + columns: + - &day + name: day + description: "Block date in UTC" + - &pool_id + name: pool_id + description: "Unique encoded identifier that refers to each pool" + - &pool_address + name: pool_address + description: "Pool address" + - &pool_symbol + name: pool_symbol + description: "Token symbols, followed by their respective weights, if applicable" + - &version + name: version + description: "Version of the project" + - &blockchain + name: blockchain + description: "Blockchain" + - &pool_type + name: pool_type + description: "Pool attributes, determined by the pool's factory" + - &token_address + name: token_address + description: "Contract address of the token in which protocol fees were collected" + - &token_symbol + name: token_symbol + description: Token symbol of the token in which protocol fees were collected" + - &token_amount_raw + name: token_amount_raw + description: "Raw amount of fees of the token in the pool at time of execution in the original currency" + - &token_amount + name: token_amount + description: "Normalized amount of fees of the token in the pool at time of execution in the original currency" + - &protocol_fee_collected_usd + name: protocol_fee_collected_usd + description: "USD value of the collected fee" + - &treasury_share + name: treasury_share + description: "Share of total fee that is directed to Balancer DAO's treasury, as per BIPs 19, 161 and 371" + - &treasury_revenue_usd + name: treasury_revenue_usd + description: "USD value of fee directed to Balancer DAO's treasury" \ No newline at end of file diff --git a/models/balancer/avalanche_c/balancer_v2_avalanche_c_protocol_fee.sql b/models/_project/balancer/protocol_fee/avalanche_c/balancer_v2_avalanche_c_protocol_fee.sql similarity index 100% rename from models/balancer/avalanche_c/balancer_v2_avalanche_c_protocol_fee.sql rename to models/_project/balancer/protocol_fee/avalanche_c/balancer_v2_avalanche_c_protocol_fee.sql diff --git a/models/balancer/balancer_protocol_fee.sql b/models/_project/balancer/protocol_fee/balancer_protocol_fee.sql similarity index 75% rename from models/balancer/balancer_protocol_fee.sql rename to models/_project/balancer/protocol_fee/balancer_protocol_fee.sql index d871a6aef89..37fef24dc85 100644 --- a/models/balancer/balancer_protocol_fee.sql +++ b/models/_project/balancer/protocol_fee/balancer_protocol_fee.sql @@ -1,10 +1,10 @@ {{ config( schema = 'balancer', alias = 'protocol_fee', - post_hook='{{ expose_spells(\'["ethereum", "arbitrum", "polygon", "gnosis", "optimism","avalanche_c", "base"]\', - "project", - "balancer", - \'["viniabussafi"]\') }}' + post_hook='{{ expose_spells(blockchains = \'["arbitrum", "avalanche_c", "base", "ethereum", "gnosis", "optimism", "polygon", "zkevm"]\', + spell_type = "project", + spell_name = "balancer", + contributors = \'["viniabussafi"]\') }}' ) }} diff --git a/models/_project/balancer/protocol_fee/base/_schema.yml b/models/_project/balancer/protocol_fee/base/_schema.yml new file mode 100644 index 00000000000..cebb1c312e9 --- /dev/null +++ b/models/_project/balancer/protocol_fee/base/_schema.yml @@ -0,0 +1,61 @@ +version: 2 + +models: + - name: balancer_v2_base_protocol_fee + meta: + blockchain: base + project: balancer_v2 + contributors: viniabussafi + config: + tags: ['base', 'revenue', 'fees'] + description: > + Daily Protocol Fee collected and Revenue by pool on Balancer, an automated portfolio manager and trading platform. + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - day + - pool_id + - token_address + columns: + - &day + name: day + description: "Block date in UTC" + - &pool_id + name: pool_id + description: "Unique encoded identifier that refers to each pool" + - &pool_address + name: pool_address + description: "Pool address" + - &pool_symbol + name: pool_symbol + description: "Token symbols, followed by their respective weights, if applicable" + - &version + name: version + description: "Version of the project" + - &blockchain + name: blockchain + description: "Blockchain" + - &pool_type + name: pool_type + description: "Pool attributes, determined by the pool's factory" + - &token_address + name: token_address + description: "Contract address of the token in which protocol fees were collected" + - &token_symbol + name: token_symbol + description: Token symbol of the token in which protocol fees were collected" + - &token_amount_raw + name: token_amount_raw + description: "Raw amount of fees of the token in the pool at time of execution in the original currency" + - &token_amount + name: token_amount + description: "Normalized amount of fees of the token in the pool at time of execution in the original currency" + - &protocol_fee_collected_usd + name: protocol_fee_collected_usd + description: "USD value of the collected fee" + - &treasury_share + name: treasury_share + description: "Share of total fee that is directed to Balancer DAO's treasury, as per BIPs 19, 161 and 371" + - &treasury_revenue_usd + name: treasury_revenue_usd + description: "USD value of fee directed to Balancer DAO's treasury" \ No newline at end of file diff --git a/models/balancer/base/balancer_v2_base_protocol_fee.sql b/models/_project/balancer/protocol_fee/base/balancer_v2_base_protocol_fee.sql similarity index 100% rename from models/balancer/base/balancer_v2_base_protocol_fee.sql rename to models/_project/balancer/protocol_fee/base/balancer_v2_base_protocol_fee.sql diff --git a/models/_project/balancer/protocol_fee/ethereum/_schema.yml b/models/_project/balancer/protocol_fee/ethereum/_schema.yml new file mode 100644 index 00000000000..b6830c20e7e --- /dev/null +++ b/models/_project/balancer/protocol_fee/ethereum/_schema.yml @@ -0,0 +1,61 @@ +version: 2 + +models: + - name: balancer_v2_ethereum_protocol_fee + meta: + blockchain: ethereum + project: balancer_v2 + contributors: viniabussafi + config: + tags: ['ethereum', 'revenue', 'fees'] + description: > + Daily Protocol Fee collected and Revenue by pool on Balancer, an automated portfolio manager and trading platform. + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - day + - pool_id + - token_address + columns: + - &day + name: day + description: "Block date in UTC" + - &pool_id + name: pool_id + description: "Unique encoded identifier that refers to each pool" + - &pool_address + name: pool_address + description: "Pool address" + - &pool_symbol + name: pool_symbol + description: "Token symbols, followed by their respective weights, if applicable" + - &version + name: version + description: "Version of the project" + - &blockchain + name: blockchain + description: "Blockchain" + - &pool_type + name: pool_type + description: "Pool attributes, determined by the pool's factory" + - &token_address + name: token_address + description: "Contract address of the token in which protocol fees were collected" + - &token_symbol + name: token_symbol + description: Token symbol of the token in which protocol fees were collected" + - &token_amount_raw + name: token_amount_raw + description: "Raw amount of fees of the token in the pool at time of execution in the original currency" + - &token_amount + name: token_amount + description: "Normalized amount of fees of the token in the pool at time of execution in the original currency" + - &protocol_fee_collected_usd + name: protocol_fee_collected_usd + description: "USD value of the collected fee" + - &treasury_share + name: treasury_share + description: "Share of total fee that is directed to Balancer DAO's treasury, as per BIPs 19, 161 and 371" + - &treasury_revenue_usd + name: treasury_revenue_usd + description: "USD value of fee directed to Balancer DAO's treasury" \ No newline at end of file diff --git a/models/balancer/ethereum/balancer_v2_ethereum_protocol_fee.sql b/models/_project/balancer/protocol_fee/ethereum/balancer_v2_ethereum_protocol_fee.sql similarity index 100% rename from models/balancer/ethereum/balancer_v2_ethereum_protocol_fee.sql rename to models/_project/balancer/protocol_fee/ethereum/balancer_v2_ethereum_protocol_fee.sql diff --git a/models/_project/balancer/protocol_fee/gnosis/_schema.yml b/models/_project/balancer/protocol_fee/gnosis/_schema.yml new file mode 100644 index 00000000000..defa5e74781 --- /dev/null +++ b/models/_project/balancer/protocol_fee/gnosis/_schema.yml @@ -0,0 +1,61 @@ +version: 2 + +models: + - name: balancer_v2_gnosis_protocol_fee + meta: + blockchain: gnosis + project: balancer_v2 + contributors: viniabussafi + config: + tags: ['gnosis', 'revenue', 'fees'] + description: > + Daily Protocol Fee collected and Revenue by pool on Balancer, an automated portfolio manager and trading platform. + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - day + - pool_id + - token_address + columns: + - &day + name: day + description: "Block date in UTC" + - &pool_id + name: pool_id + description: "Unique encoded identifier that refers to each pool" + - &pool_address + name: pool_address + description: "Pool address" + - &pool_symbol + name: pool_symbol + description: "Token symbols, followed by their respective weights, if applicable" + - &version + name: version + description: "Version of the project" + - &blockchain + name: blockchain + description: "Blockchain" + - &pool_type + name: pool_type + description: "Pool attributes, determined by the pool's factory" + - &token_address + name: token_address + description: "Contract address of the token in which protocol fees were collected" + - &token_symbol + name: token_symbol + description: Token symbol of the token in which protocol fees were collected" + - &token_amount_raw + name: token_amount_raw + description: "Raw amount of fees of the token in the pool at time of execution in the original currency" + - &token_amount + name: token_amount + description: "Normalized amount of fees of the token in the pool at time of execution in the original currency" + - &protocol_fee_collected_usd + name: protocol_fee_collected_usd + description: "USD value of the collected fee" + - &treasury_share + name: treasury_share + description: "Share of total fee that is directed to Balancer DAO's treasury, as per BIPs 19, 161 and 371" + - &treasury_revenue_usd + name: treasury_revenue_usd + description: "USD value of fee directed to Balancer DAO's treasury" \ No newline at end of file diff --git a/models/balancer/gnosis/balancer_v2_gnosis_protocol_fee.sql b/models/_project/balancer/protocol_fee/gnosis/balancer_v2_gnosis_protocol_fee.sql similarity index 100% rename from models/balancer/gnosis/balancer_v2_gnosis_protocol_fee.sql rename to models/_project/balancer/protocol_fee/gnosis/balancer_v2_gnosis_protocol_fee.sql diff --git a/models/_project/balancer/protocol_fee/optimism/_schema.yml b/models/_project/balancer/protocol_fee/optimism/_schema.yml new file mode 100644 index 00000000000..6b096a72bc6 --- /dev/null +++ b/models/_project/balancer/protocol_fee/optimism/_schema.yml @@ -0,0 +1,61 @@ +version: 2 + +models: + - name: balancer_v2_optimism_protocol_fee + meta: + blockchain: optimism + project: balancer_v2 + contributors: viniabussafi + config: + tags: ['optimism', 'revenue', 'fees'] + description: > + Daily Protocol Fee collected and Revenue by pool on Balancer, an automated portfolio manager and trading platform. + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - day + - pool_id + - token_address + columns: + - &day + name: day + description: "Block date in UTC" + - &pool_id + name: pool_id + description: "Unique encoded identifier that refers to each pool" + - &pool_address + name: pool_address + description: "Pool address" + - &pool_symbol + name: pool_symbol + description: "Token symbols, followed by their respective weights, if applicable" + - &version + name: version + description: "Version of the project" + - &blockchain + name: blockchain + description: "Blockchain" + - &pool_type + name: pool_type + description: "Pool attributes, determined by the pool's factory" + - &token_address + name: token_address + description: "Contract address of the token in which protocol fees were collected" + - &token_symbol + name: token_symbol + description: Token symbol of the token in which protocol fees were collected" + - &token_amount_raw + name: token_amount_raw + description: "Raw amount of fees of the token in the pool at time of execution in the original currency" + - &token_amount + name: token_amount + description: "Normalized amount of fees of the token in the pool at time of execution in the original currency" + - &protocol_fee_collected_usd + name: protocol_fee_collected_usd + description: "USD value of the collected fee" + - &treasury_share + name: treasury_share + description: "Share of total fee that is directed to Balancer DAO's treasury, as per BIPs 19, 161 and 371" + - &treasury_revenue_usd + name: treasury_revenue_usd + description: "USD value of fee directed to Balancer DAO's treasury" \ No newline at end of file diff --git a/models/balancer/optimism/balancer_v2_optimism_protocol_fee.sql b/models/_project/balancer/protocol_fee/optimism/balancer_v2_optimism_protocol_fee.sql similarity index 100% rename from models/balancer/optimism/balancer_v2_optimism_protocol_fee.sql rename to models/_project/balancer/protocol_fee/optimism/balancer_v2_optimism_protocol_fee.sql diff --git a/models/_project/balancer/protocol_fee/polygon/_schema.yml b/models/_project/balancer/protocol_fee/polygon/_schema.yml new file mode 100644 index 00000000000..b541beceb65 --- /dev/null +++ b/models/_project/balancer/protocol_fee/polygon/_schema.yml @@ -0,0 +1,61 @@ +version: 2 + +models: + - name: balancer_v2_polygon_protocol_fee + meta: + blockchain: polygon + project: balancer_v2 + contributors: viniabussafi + config: + tags: ['polygon', 'revenue', 'fees'] + description: > + Daily Protocol Fee collected and Revenue by pool on Balancer, an automated portfolio manager and trading platform. + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - day + - pool_id + - token_address + columns: + - &day + name: day + description: "Block date in UTC" + - &pool_id + name: pool_id + description: "Unique encoded identifier that refers to each pool" + - &pool_address + name: pool_address + description: "Pool address" + - &pool_symbol + name: pool_symbol + description: "Token symbols, followed by their respective weights, if applicable" + - &version + name: version + description: "Version of the project" + - &blockchain + name: blockchain + description: "Blockchain" + - &pool_type + name: pool_type + description: "Pool attributes, determined by the pool's factory" + - &token_address + name: token_address + description: "Contract address of the token in which protocol fees were collected" + - &token_symbol + name: token_symbol + description: Token symbol of the token in which protocol fees were collected" + - &token_amount_raw + name: token_amount_raw + description: "Raw amount of fees of the token in the pool at time of execution in the original currency" + - &token_amount + name: token_amount + description: "Normalized amount of fees of the token in the pool at time of execution in the original currency" + - &protocol_fee_collected_usd + name: protocol_fee_collected_usd + description: "USD value of the collected fee" + - &treasury_share + name: treasury_share + description: "Share of total fee that is directed to Balancer DAO's treasury, as per BIPs 19, 161 and 371" + - &treasury_revenue_usd + name: treasury_revenue_usd + description: "USD value of fee directed to Balancer DAO's treasury" \ No newline at end of file diff --git a/models/balancer/polygon/balancer_v2_polygon_protocol_fee.sql b/models/_project/balancer/protocol_fee/polygon/balancer_v2_polygon_protocol_fee.sql similarity index 100% rename from models/balancer/polygon/balancer_v2_polygon_protocol_fee.sql rename to models/_project/balancer/protocol_fee/polygon/balancer_v2_polygon_protocol_fee.sql diff --git a/models/_project/balancer/protocol_fee/zkevm/_schema.yml b/models/_project/balancer/protocol_fee/zkevm/_schema.yml new file mode 100644 index 00000000000..b8c5d67a600 --- /dev/null +++ b/models/_project/balancer/protocol_fee/zkevm/_schema.yml @@ -0,0 +1,61 @@ +version: 2 + +models: + - name: balancer_v2_zkevm_protocol_fee + meta: + blockchain: zkevm + project: balancer_v2 + contributors: viniabussafi + config: + tags: ['zkevm', 'revenue', 'fees'] + description: > + Daily Protocol Fee collected and Revenue by pool on Balancer, an automated portfolio manager and trading platform. + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - day + - pool_id + - token_address + columns: + - &day + name: day + description: "Block date in UTC" + - &pool_id + name: pool_id + description: "Unique encoded identifier that refers to each pool" + - &pool_address + name: pool_address + description: "Pool address" + - &pool_symbol + name: pool_symbol + description: "Token symbols, followed by their respective weights, if applicable" + - &version + name: version + description: "Version of the project" + - &blockchain + name: blockchain + description: "Blockchain" + - &pool_type + name: pool_type + description: "Pool attributes, determined by the pool's factory" + - &token_address + name: token_address + description: "Contract address of the token in which protocol fees were collected" + - &token_symbol + name: token_symbol + description: Token symbol of the token in which protocol fees were collected" + - &token_amount_raw + name: token_amount_raw + description: "Raw amount of fees of the token in the pool at time of execution in the original currency" + - &token_amount + name: token_amount + description: "Normalized amount of fees of the token in the pool at time of execution in the original currency" + - &protocol_fee_collected_usd + name: protocol_fee_collected_usd + description: "USD value of the collected fee" + - &treasury_share + name: treasury_share + description: "Share of total fee that is directed to Balancer DAO's treasury, as per BIPs 19, 161 and 371" + - &treasury_revenue_usd + name: treasury_revenue_usd + description: "USD value of fee directed to Balancer DAO's treasury" \ No newline at end of file diff --git a/models/balancer/zkevm/balancer_v2_zkevm_protocol_fee.sql b/models/_project/balancer/protocol_fee/zkevm/balancer_v2_zkevm_protocol_fee.sql similarity index 100% rename from models/balancer/zkevm/balancer_v2_zkevm_protocol_fee.sql rename to models/_project/balancer/protocol_fee/zkevm/balancer_v2_zkevm_protocol_fee.sql diff --git a/models/_project/balancer/support/_schema.yml b/models/_project/balancer/support/_schema.yml new file mode 100644 index 00000000000..fbb445cf773 --- /dev/null +++ b/models/_project/balancer/support/_schema.yml @@ -0,0 +1,56 @@ +version: 2 + +models: + - name: balancer_token_whitelist + meta: + blockchain: arbitrum, avalanche_c, base, ethereum, gnosis, optimism, polygon, 'zkevm' + contributors: viniabussafi + config: + tags: ['arbitrum', 'avalanche_c', 'base', 'ethereum', 'gnosis', 'optimism', 'polygon', 'zkevm'] + description: > + These tokens are whitelisted to be used as pricing assets on liquidity calculations for weighted pools, due to the trustability of their data. + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - address + - name + - chain + columns: + - &address + name: address + description: "Token address" + - &name + name: name + description: "Token symbol" + - &chain + name: chain + description: "Token blockchain" + + - name: balancer_single_recipient_gauges + meta: + blockchain: ethereum + contributors: viniabussafi + config: + tags: ['ethereum', 'gauges'] + description: > + These gauges are deployed by the SingleRecipientGauge contract and this mapping manually links each gauge to it's correspondent pool and project + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - gauge_address + - pool_id + - project + - blockchain + columns: + - &gauge_address + name: gauge_address + descripton: "Gauge address" + - &pool_id + name: pool_id + description: "Unique encoded identifier that refers to each pool to which each gauge directs incentives" + - &project + name: project + description: "ve8020 project for each gauge" + - &blockchain + name: blockchain + description: "Blockchain" \ No newline at end of file diff --git a/models/balancer/balancer_single_recipient_gauges.sql b/models/_project/balancer/support/balancer_single_recipient_gauges.sql similarity index 100% rename from models/balancer/balancer_single_recipient_gauges.sql rename to models/_project/balancer/support/balancer_single_recipient_gauges.sql diff --git a/models/balancer/balancer_token_whitelist.sql b/models/_project/balancer/support/balancer_token_whitelist.sql similarity index 100% rename from models/balancer/balancer_token_whitelist.sql rename to models/_project/balancer/support/balancer_token_whitelist.sql diff --git a/models/_project/balancer/trades/arbitrum/_schema.yml b/models/_project/balancer/trades/arbitrum/_schema.yml new file mode 100644 index 00000000000..09ef97905b8 --- /dev/null +++ b/models/_project/balancer/trades/arbitrum/_schema.yml @@ -0,0 +1,149 @@ +version: 2 + +models: + - name: balancer_arbitrum_trades + meta: + blockchain: arbitrum + sector: dex + contributors: bizzyvinci, viniabussafi + config: + tags: ['balancer', 'arbitrum', 'amm', 'trades', 'dex'] + description: > + DEX trades on balancer on arbitrum + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - block_date + - blockchain + - project + - version + - tx_hash + - evt_index + - check_dex_seed: + blockchain: arbitrum + project: balancer + version: 2 + columns: + - &blockchain + name: blockchain + description: "Blockchain" + - &project + name: project + description: "Project name (balancer)" + - &version + name: version + description: "Version of the project" + - &block_month + name: block_month + description: "Block month in UTC" + - &block_date + name: block_date + description: "Block date in UTC" + - &block_time + name: block_time + description: 'Block time in UTC' + - &block_number + name: block_number + description: 'Block number' + - &token_bought_symbol + name: token_bought_symbol + description: "Token symbol for token bought in the trade" + - &token_sold_symbol + name: token_sold_symbol + description: "Token symbol for token sold in the trade" + - &token_pair + name: token_pair + description: "Token symbol pair for each token involved in the trade" + - &token_bought_amount + name: token_bought_amount + description: "Value of the token bought at time of execution in the original currency" + - &token_sold_amount + name: token_sold_amount + description: "Value of the token sold at time of execution in the original currency" + - &token_bought_amount_raw + name: token_bought_amount_raw + description: "Raw value of the token bought at time of execution in the original currency" + - &token_sold_amount_raw + name: token_sold_amount_raw + description: "Raw value of the token sold at time of execution in the original currency" + - &amount_usd + name: amount_usd + description: "USD value of the trade at time of execution" + - &token_bought_address + name: token_bought_address + description: "Contract address of the token bought" + - &token_sold_address + name: token_sold_address + description: "Contract address of the token sold" + - &taker + name: taker + description: "Address of trader who purchased a token" + - &maker + name: maker + description: "Address of trader who sold a token" + - &pool_id + name: pool_id + description: "Unique encoded identifier that refers to each pool" + - &swap_fee + name: swap_fee + description: 'Swap fee' + - &project_contract_address + name: project_contract_address + description: "Pool address" + - &pool_symbol + name: pool_symbol + description: "Token symbols, followed by their respective weights, if applicable" + - &pool_type + name: pool_type + description: "Pool attributes, determined by the pool's factory" + - &tx_hash + name: tx_hash + description: "Tx. Hash" + - &tx_from + name: tx_from + description: "transaction.from" + - &tx_to + name: tx_to + description: "transaction.to" + - &evt_index + name: evt_index + description: 'Event index' + + - name: balancer_v2_arbitrum_trades + meta: + blockchain: arbitrum + sector: dex + contributors: bizzyvinci, thetroyharris, tomfutago, viniabussafi + config: + tags: [ 'balancer', 'arbitrum', 'amm', 'trades', 'dex', 'beta' ] + description: > + DEX trades on balancer v2 on arbitrum + columns: + - *blockchain + - *project + - *version + - *block_month + - *block_date + - *block_time + - *block_number + - *token_bought_symbol + - *token_sold_symbol + - *token_pair + - *token_bought_amount + - *token_sold_amount + - *token_bought_amount_raw + - *token_sold_amount_raw + - *amount_usd + - *token_bought_address + - *token_sold_address + - *taker + - *maker + - *project_contract_address + - *pool_symbol + - *pool_type + - *pool_id + - *swap_fee + - *tx_hash + - *tx_from + - *tx_to + - *evt_index \ No newline at end of file diff --git a/models/balancer/arbitrum/balancer_arbitrum_trades.sql b/models/_project/balancer/trades/arbitrum/balancer_arbitrum_trades.sql similarity index 100% rename from models/balancer/arbitrum/balancer_arbitrum_trades.sql rename to models/_project/balancer/trades/arbitrum/balancer_arbitrum_trades.sql diff --git a/models/balancer/arbitrum/balancer_v2_arbitrum_trades.sql b/models/_project/balancer/trades/arbitrum/balancer_v2_arbitrum_trades.sql similarity index 94% rename from models/balancer/arbitrum/balancer_v2_arbitrum_trades.sql rename to models/_project/balancer/trades/arbitrum/balancer_v2_arbitrum_trades.sql index 750f467f653..2baa6afd2b2 100644 --- a/models/balancer/arbitrum/balancer_v2_arbitrum_trades.sql +++ b/models/_project/balancer/trades/arbitrum/balancer_v2_arbitrum_trades.sql @@ -4,9 +4,9 @@ alias = 'trades', materialized = 'view', post_hook = '{{ expose_spells(\'["arbitrum"]\', - "project", - "balancer_v2", - \'["mendesfabio", "jacektrocinski", "thetroyharris", "tomfutago", "viniabussafi"]\') }}' + spell_type = "project", + spell_name = "balancer", + contributors = \'["mendesfabio", "jacektrocinski", "thetroyharris", "tomfutago", "viniabussafi"]\') }}' ) }} diff --git a/models/_project/balancer/trades/avalanche_c/_schema.yml b/models/_project/balancer/trades/avalanche_c/_schema.yml new file mode 100644 index 00000000000..86aca24b807 --- /dev/null +++ b/models/_project/balancer/trades/avalanche_c/_schema.yml @@ -0,0 +1,149 @@ +version: 2 + +models: + - name: balancer_avalanche_c_trades + meta: + blockchain: avalanche_c + sector: dex + contributors: bizzyvinci, viniabussafi + config: + tags: ['balancer', 'avalanche_c', 'amm', 'trades', 'dex'] + description: > + DEX trades on balancer on avalanche_c + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - block_date + - blockchain + - project + - version + - tx_hash + - evt_index + - check_dex_seed: + blockchain: avalanche_c + project: balancer + version: 2 + columns: + - &blockchain + name: blockchain + description: "Blockchain" + - &project + name: project + description: "Project name (balancer)" + - &version + name: version + description: "Version of the project" + - &block_month + name: block_month + description: "Block month in UTC" + - &block_date + name: block_date + description: "Block date in UTC" + - &block_time + name: block_time + description: 'Block time in UTC' + - &block_number + name: block_number + description: 'Block number' + - &token_bought_symbol + name: token_bought_symbol + description: "Token symbol for token bought in the trade" + - &token_sold_symbol + name: token_sold_symbol + description: "Token symbol for token sold in the trade" + - &token_pair + name: token_pair + description: "Token symbol pair for each token involved in the trade" + - &token_bought_amount + name: token_bought_amount + description: "Value of the token bought at time of execution in the original currency" + - &token_sold_amount + name: token_sold_amount + description: "Value of the token sold at time of execution in the original currency" + - &token_bought_amount_raw + name: token_bought_amount_raw + description: "Raw value of the token bought at time of execution in the original currency" + - &token_sold_amount_raw + name: token_sold_amount_raw + description: "Raw value of the token sold at time of execution in the original currency" + - &amount_usd + name: amount_usd + description: "USD value of the trade at time of execution" + - &token_bought_address + name: token_bought_address + description: "Contract address of the token bought" + - &token_sold_address + name: token_sold_address + description: "Contract address of the token sold" + - &taker + name: taker + description: "Address of trader who purchased a token" + - &maker + name: maker + description: "Address of trader who sold a token" + - &pool_id + name: pool_id + description: "Unique encoded identifier that refers to each pool" + - &swap_fee + name: swap_fee + description: 'Swap fee' + - &project_contract_address + name: project_contract_address + description: "Pool address" + - &pool_symbol + name: pool_symbol + description: "Token symbols, followed by their respective weights, if applicable" + - &pool_type + name: pool_type + description: "Pool attributes, determined by the pool's factory" + - &tx_hash + name: tx_hash + description: "Tx. Hash" + - &tx_from + name: tx_from + description: "transaction.from" + - &tx_to + name: tx_to + description: "transaction.to" + - &evt_index + name: evt_index + description: 'Event index' + + - name: balancer_v2_avalanche_c_trades + meta: + blockchain: avalanche_c + sector: dex + contributors: bizzyvinci, thetroyharris, tomfutago, viniabussafi + config: + tags: [ 'balancer', 'avalanche_c', 'amm', 'trades', 'dex', 'beta' ] + description: > + DEX trades on balancer v2 on avalanche_c + columns: + - *blockchain + - *project + - *version + - *block_month + - *block_date + - *block_time + - *block_number + - *token_bought_symbol + - *token_sold_symbol + - *token_pair + - *token_bought_amount + - *token_sold_amount + - *token_bought_amount_raw + - *token_sold_amount_raw + - *amount_usd + - *token_bought_address + - *token_sold_address + - *taker + - *maker + - *project_contract_address + - *pool_symbol + - *pool_type + - *pool_id + - *swap_fee + - *tx_hash + - *tx_from + - *tx_to + - *evt_index \ No newline at end of file diff --git a/models/balancer/avalanche_c/balancer_avalanche_c_trades.sql b/models/_project/balancer/trades/avalanche_c/balancer_avalanche_c_trades.sql similarity index 100% rename from models/balancer/avalanche_c/balancer_avalanche_c_trades.sql rename to models/_project/balancer/trades/avalanche_c/balancer_avalanche_c_trades.sql diff --git a/models/balancer/avalanche_c/balancer_v2_avalanche_c_trades.sql b/models/_project/balancer/trades/avalanche_c/balancer_v2_avalanche_c_trades.sql similarity index 94% rename from models/balancer/avalanche_c/balancer_v2_avalanche_c_trades.sql rename to models/_project/balancer/trades/avalanche_c/balancer_v2_avalanche_c_trades.sql index 54dfd905dbc..d1a0eb61af5 100644 --- a/models/balancer/avalanche_c/balancer_v2_avalanche_c_trades.sql +++ b/models/_project/balancer/trades/avalanche_c/balancer_v2_avalanche_c_trades.sql @@ -4,10 +4,10 @@ alias = 'trades', materialized = 'view', post_hook = '{{ expose_spells(\'["avalanche_c"]\', - "project", - "balancer_v2", - \'["mendesfabio", "jacektrocinski", "thetroyharris", "tomfutago", "viniabussafi"]\') }}' - ) + spell_type = "project", + spell_name = "balancer", + contributors = \'["mendesfabio", "jacektrocinski", "thetroyharris", "tomfutago", "viniabussafi"]\') }}' + ) }} WITH diff --git a/models/_project/balancer/balancer_trades.sql b/models/_project/balancer/trades/balancer_trades.sql similarity index 100% rename from models/_project/balancer/balancer_trades.sql rename to models/_project/balancer/trades/balancer_trades.sql diff --git a/models/_project/balancer/trades/base/_schema.yml b/models/_project/balancer/trades/base/_schema.yml new file mode 100644 index 00000000000..4a0bd85156f --- /dev/null +++ b/models/_project/balancer/trades/base/_schema.yml @@ -0,0 +1,149 @@ +version: 2 + +models: + - name: balancer_base_trades + meta: + blockchain: base + sector: dex + contributors: bizzyvinci, viniabussafi + config: + tags: ['balancer', 'base', 'amm', 'trades', 'dex'] + description: > + DEX trades on balancer on base + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - block_date + - blockchain + - project + - version + - tx_hash + - evt_index + - check_dex_seed: + blockchain: base + project: balancer + version: 2 + columns: + - &blockchain + name: blockchain + description: "Blockchain" + - &project + name: project + description: "Project name (balancer)" + - &version + name: version + description: "Version of the project" + - &block_month + name: block_month + description: "Block month in UTC" + - &block_date + name: block_date + description: "Block date in UTC" + - &block_time + name: block_time + description: 'Block time in UTC' + - &block_number + name: block_number + description: 'Block number' + - &token_bought_symbol + name: token_bought_symbol + description: "Token symbol for token bought in the trade" + - &token_sold_symbol + name: token_sold_symbol + description: "Token symbol for token sold in the trade" + - &token_pair + name: token_pair + description: "Token symbol pair for each token involved in the trade" + - &token_bought_amount + name: token_bought_amount + description: "Value of the token bought at time of execution in the original currency" + - &token_sold_amount + name: token_sold_amount + description: "Value of the token sold at time of execution in the original currency" + - &token_bought_amount_raw + name: token_bought_amount_raw + description: "Raw value of the token bought at time of execution in the original currency" + - &token_sold_amount_raw + name: token_sold_amount_raw + description: "Raw value of the token sold at time of execution in the original currency" + - &amount_usd + name: amount_usd + description: "USD value of the trade at time of execution" + - &token_bought_address + name: token_bought_address + description: "Contract address of the token bought" + - &token_sold_address + name: token_sold_address + description: "Contract address of the token sold" + - &taker + name: taker + description: "Address of trader who purchased a token" + - &maker + name: maker + description: "Address of trader who sold a token" + - &pool_id + name: pool_id + description: "Unique encoded identifier that refers to each pool" + - &swap_fee + name: swap_fee + description: 'Swap fee' + - &project_contract_address + name: project_contract_address + description: "Pool address" + - &pool_symbol + name: pool_symbol + description: "Token symbols, followed by their respective weights, if applicable" + - &pool_type + name: pool_type + description: "Pool attributes, determined by the pool's factory" + - &tx_hash + name: tx_hash + description: "Tx. Hash" + - &tx_from + name: tx_from + description: "transaction.from" + - &tx_to + name: tx_to + description: "transaction.to" + - &evt_index + name: evt_index + description: 'Event index' + + - name: balancer_v2_base_trades + meta: + blockchain: base + sector: dex + contributors: bizzyvinci, thetroyharris, tomfutago, viniabussafi + config: + tags: [ 'balancer', 'base', 'amm', 'trades', 'dex', 'beta' ] + description: > + DEX trades on balancer v2 on base + columns: + - *blockchain + - *project + - *version + - *block_month + - *block_date + - *block_time + - *block_number + - *token_bought_symbol + - *token_sold_symbol + - *token_pair + - *token_bought_amount + - *token_sold_amount + - *token_bought_amount_raw + - *token_sold_amount_raw + - *amount_usd + - *token_bought_address + - *token_sold_address + - *taker + - *maker + - *project_contract_address + - *pool_symbol + - *pool_type + - *pool_id + - *swap_fee + - *tx_hash + - *tx_from + - *tx_to + - *evt_index \ No newline at end of file diff --git a/models/balancer/base/balancer_base_trades.sql b/models/_project/balancer/trades/base/balancer_base_trades.sql similarity index 100% rename from models/balancer/base/balancer_base_trades.sql rename to models/_project/balancer/trades/base/balancer_base_trades.sql diff --git a/models/balancer/base/balancer_v2_base_trades.sql b/models/_project/balancer/trades/base/balancer_v2_base_trades.sql similarity index 94% rename from models/balancer/base/balancer_v2_base_trades.sql rename to models/_project/balancer/trades/base/balancer_v2_base_trades.sql index ccf037af146..b94589a490a 100644 --- a/models/balancer/base/balancer_v2_base_trades.sql +++ b/models/_project/balancer/trades/base/balancer_v2_base_trades.sql @@ -4,9 +4,9 @@ alias = 'trades', materialized = 'view', post_hook = '{{ expose_spells(\'["base"]\', - "project", - "balancer_v2", - \'["mendesfabio", "jacektrocinski", "thetroyharris", "tomfutago", "viniabussafi"]\') }}' + spell_type = "project", + spell_name = "balancer", + contributors = \'["mendesfabio", "jacektrocinski", "thetroyharris", "tomfutago", "viniabussafi"]\') }}' ) }} diff --git a/models/_project/balancer/trades/ethereum/_schema.yml b/models/_project/balancer/trades/ethereum/_schema.yml new file mode 100644 index 00000000000..42d29d7e17d --- /dev/null +++ b/models/_project/balancer/trades/ethereum/_schema.yml @@ -0,0 +1,145 @@ +version: 2 + +models: + - name: balancer_ethereum_trades + meta: + blockchain: ethereum + sector: dex + contributors: bizzyvinci, thetroyharris, viniabussafi + config: + tags: ['balancer', 'ethereum', 'amm', 'trades', 'dex'] + description: > + DEX trades on balancer on ethereum + columns: + - &blockchain + name: blockchain + description: "Blockchain" + - &project + name: project + description: "Project name (balancer)" + - &version + name: version + description: "Version of the project" + - &block_month + name: block_month + description: "Block month in UTC" + - &block_date + name: block_date + description: "Block date in UTC" + - &block_time + name: block_time + description: 'Block time in UTC' + - &block_number + name: block_number + description: 'Block number' + - &token_bought_symbol + name: token_bought_symbol + description: "Token symbol for token bought in the trade" + - &token_sold_symbol + name: token_sold_symbol + description: "Token symbol for token sold in the trade" + - &token_pair + name: token_pair + description: "Token symbol pair for each token involved in the trade" + - &token_bought_amount + name: token_bought_amount + description: "Value of the token bought at time of execution in the original currency" + - &token_sold_amount + name: token_sold_amount + description: "Value of the token sold at time of execution in the original currency" + - &token_bought_amount_raw + name: token_bought_amount_raw + description: "Raw value of the token bought at time of execution in the original currency" + - &token_sold_amount_raw + name: token_sold_amount_raw + description: "Raw value of the token sold at time of execution in the original currency" + - &amount_usd + name: amount_usd + description: "USD value of the trade at time of execution" + - &token_bought_address + name: token_bought_address + description: "Contract address of the token bought" + - &token_sold_address + name: token_sold_address + description: "Contract address of the token sold" + - &taker + name: taker + description: "Address of trader who purchased a token" + - &maker + name: maker + description: "Address of trader who sold a token" + - &pool_id + name: pool_id + description: "Unique encoded identifier that refers to each pool" + - &swap_fee + name: swap_fee + description: 'Swap fee' + - &project_contract_address + name: project_contract_address + description: "Pool address" + - &pool_symbol + name: pool_symbol + description: "Token symbols, followed by their respective weights, if applicable" + - &pool_type + name: pool_type + description: "Pool attributes, determined by the pool's factory" + - &tx_hash + name: tx_hash + description: "Tx. Hash" + - &tx_from + name: tx_from + description: "transaction.from" + - &tx_to + name: tx_to + description: "transaction.to" + - &evt_index + name: evt_index + description: 'Event index' + + - name: balancer_v1_ethereum_trades + meta: + blockchain: ethereum + sector: dex + contributors: bizzyvinci, thetroyharris, viniabussafi + config: + tags: [ 'balancer', 'ethereum', 'amm', 'trades', 'dex' ] + description: > + DEX trades on balancer v1 on ethereum + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - block_time + - tx_hash + - evt_index + - check_dex_seed: + blockchain: ethereum + project: balancer + version: 1 + columns: + - *blockchain + - *project + - *version + - *block_month + - *block_date + - *block_time + - *token_bought_symbol + - *token_sold_symbol + - *token_pair + - *token_bought_amount + - *token_sold_amount + - *token_bought_amount_raw + - *token_sold_amount_raw + - *amount_usd + - *token_bought_address + - *token_sold_address + - *taker + - *maker + - *pool_id + - *swap_fee + - *project_contract_address + - *pool_symbol + - *pool_type + - *tx_hash + - *tx_from + - *tx_to + - *evt_index \ No newline at end of file diff --git a/models/balancer/ethereum/balancer_ethereum_trades.sql b/models/_project/balancer/trades/ethereum/balancer_ethereum_trades.sql similarity index 100% rename from models/balancer/ethereum/balancer_ethereum_trades.sql rename to models/_project/balancer/trades/ethereum/balancer_ethereum_trades.sql diff --git a/models/balancer/ethereum/balancer_v1_ethereum_trades.sql b/models/_project/balancer/trades/ethereum/balancer_v1_ethereum_trades.sql similarity index 100% rename from models/balancer/ethereum/balancer_v1_ethereum_trades.sql rename to models/_project/balancer/trades/ethereum/balancer_v1_ethereum_trades.sql diff --git a/models/balancer/ethereum/balancer_v2_ethereum_trades.sql b/models/_project/balancer/trades/ethereum/balancer_v2_ethereum_trades.sql similarity index 94% rename from models/balancer/ethereum/balancer_v2_ethereum_trades.sql rename to models/_project/balancer/trades/ethereum/balancer_v2_ethereum_trades.sql index 3fe902cf12b..dfb4c2439bf 100644 --- a/models/balancer/ethereum/balancer_v2_ethereum_trades.sql +++ b/models/_project/balancer/trades/ethereum/balancer_v2_ethereum_trades.sql @@ -4,9 +4,9 @@ alias = 'trades', materialized = 'view', post_hook = '{{ expose_spells(\'["ethereum"]\', - "project", - "balancer_v2", - \'["mendesfabio", "jacektrocinski", "thetroyharris", "tomfutago", "viniabussafi"]\') }}' + spell_type = "project", + spell_name = "balancer", + contributors = \'["mendesfabio", "jacektrocinski", "thetroyharris", "tomfutago", "viniabussafi"]\') }}' ) }} diff --git a/models/_project/balancer/trades/gnosis/_schema.yml b/models/_project/balancer/trades/gnosis/_schema.yml new file mode 100644 index 00000000000..ae5ae4065a2 --- /dev/null +++ b/models/_project/balancer/trades/gnosis/_schema.yml @@ -0,0 +1,149 @@ +version: 2 + +models: + - name: balancer_gnosis_trades + meta: + blockchain: gnosis + sector: dex + contributors: bizzyvinci, viniabussafi + config: + tags: ['balancer', 'gnosis', 'amm', 'trades', 'dex'] + description: > + DEX trades on balancer on gnosis + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - block_date + - blockchain + - project + - version + - tx_hash + - evt_index + - check_dex_seed: + blockchain: gnosis + project: balancer + version: 2 + columns: + - &blockchain + name: blockchain + description: "Blockchain" + - &project + name: project + description: "Project name (balancer)" + - &version + name: version + description: "Version of the project" + - &block_month + name: block_month + description: "Block month in UTC" + - &block_date + name: block_date + description: "Block date in UTC" + - &block_time + name: block_time + description: 'Block time in UTC' + - &block_number + name: block_number + description: 'Block number' + - &token_bought_symbol + name: token_bought_symbol + description: "Token symbol for token bought in the trade" + - &token_sold_symbol + name: token_sold_symbol + description: "Token symbol for token sold in the trade" + - &token_pair + name: token_pair + description: "Token symbol pair for each token involved in the trade" + - &token_bought_amount + name: token_bought_amount + description: "Value of the token bought at time of execution in the original currency" + - &token_sold_amount + name: token_sold_amount + description: "Value of the token sold at time of execution in the original currency" + - &token_bought_amount_raw + name: token_bought_amount_raw + description: "Raw value of the token bought at time of execution in the original currency" + - &token_sold_amount_raw + name: token_sold_amount_raw + description: "Raw value of the token sold at time of execution in the original currency" + - &amount_usd + name: amount_usd + description: "USD value of the trade at time of execution" + - &token_bought_address + name: token_bought_address + description: "Contract address of the token bought" + - &token_sold_address + name: token_sold_address + description: "Contract address of the token sold" + - &taker + name: taker + description: "Address of trader who purchased a token" + - &maker + name: maker + description: "Address of trader who sold a token" + - &pool_id + name: pool_id + description: "Unique encoded identifier that refers to each pool" + - &swap_fee + name: swap_fee + description: 'Swap fee' + - &project_contract_address + name: project_contract_address + description: "Pool address" + - &pool_symbol + name: pool_symbol + description: "Token symbols, followed by their respective weights, if applicable" + - &pool_type + name: pool_type + description: "Pool attributes, determined by the pool's factory" + - &tx_hash + name: tx_hash + description: "Tx. Hash" + - &tx_from + name: tx_from + description: "transaction.from" + - &tx_to + name: tx_to + description: "transaction.to" + - &evt_index + name: evt_index + description: 'Event index' + + - name: balancer_v2_gnosis_trades + meta: + blockchain: gnosis + sector: dex + contributors: bizzyvinci, thetroyharris, tomfutago, viniabussafi + config: + tags: [ 'balancer', 'gnosis', 'amm', 'trades', 'dex', 'beta' ] + description: > + DEX trades on balancer v2 on gnosis + columns: + - *blockchain + - *project + - *version + - *block_month + - *block_date + - *block_time + - *block_number + - *token_bought_symbol + - *token_sold_symbol + - *token_pair + - *token_bought_amount + - *token_sold_amount + - *token_bought_amount_raw + - *token_sold_amount_raw + - *amount_usd + - *token_bought_address + - *token_sold_address + - *taker + - *maker + - *project_contract_address + - *pool_symbol + - *pool_type + - *pool_id + - *swap_fee + - *tx_hash + - *tx_from + - *tx_to + - *evt_index \ No newline at end of file diff --git a/models/balancer/gnosis/balancer_gnosis_trades.sql b/models/_project/balancer/trades/gnosis/balancer_gnosis_trades.sql similarity index 100% rename from models/balancer/gnosis/balancer_gnosis_trades.sql rename to models/_project/balancer/trades/gnosis/balancer_gnosis_trades.sql diff --git a/models/balancer/gnosis/balancer_v2_gnosis_trades.sql b/models/_project/balancer/trades/gnosis/balancer_v2_gnosis_trades.sql similarity index 94% rename from models/balancer/gnosis/balancer_v2_gnosis_trades.sql rename to models/_project/balancer/trades/gnosis/balancer_v2_gnosis_trades.sql index c895c351328..090b5b9e737 100644 --- a/models/balancer/gnosis/balancer_v2_gnosis_trades.sql +++ b/models/_project/balancer/trades/gnosis/balancer_v2_gnosis_trades.sql @@ -4,9 +4,9 @@ alias = 'trades', materialized = 'view', post_hook = '{{ expose_spells(\'["gnosis"]\', - "project", - "balancer_v2", - \'["mendesfabio", "jacektrocinski", "thetroyharris", "tomfutago", "viniabussafi"]\') }}' + spell_type = "project", + spell_name = "balancer", + contributors = \'["mendesfabio", "jacektrocinski", "thetroyharris", "tomfutago", "viniabussafi"]\') }}' ) }} diff --git a/models/_project/balancer/trades/optimism/_schema.yml b/models/_project/balancer/trades/optimism/_schema.yml new file mode 100644 index 00000000000..481a7f9073b --- /dev/null +++ b/models/_project/balancer/trades/optimism/_schema.yml @@ -0,0 +1,149 @@ +version: 2 + +models: + - name: balancer_optimism_trades + meta: + blockchain: optimism + sector: dex + contributors: bizzyvinci, viniabussafi + config: + tags: ['balancer', 'optimism', 'amm', 'trades', 'dex'] + description: > + DEX trades on balancer on optimism + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - block_date + - blockchain + - project + - version + - tx_hash + - evt_index + - check_dex_seed: + blockchain: optimism + project: balancer + version: 2 + columns: + - &blockchain + name: blockchain + description: "Blockchain" + - &project + name: project + description: "Project name (balancer)" + - &version + name: version + description: "Version of the project" + - &block_month + name: block_month + description: "Block month in UTC" + - &block_date + name: block_date + description: "Block date in UTC" + - &block_time + name: block_time + description: 'Block time in UTC' + - &block_number + name: block_number + description: 'Block number' + - &token_bought_symbol + name: token_bought_symbol + description: "Token symbol for token bought in the trade" + - &token_sold_symbol + name: token_sold_symbol + description: "Token symbol for token sold in the trade" + - &token_pair + name: token_pair + description: "Token symbol pair for each token involved in the trade" + - &token_bought_amount + name: token_bought_amount + description: "Value of the token bought at time of execution in the original currency" + - &token_sold_amount + name: token_sold_amount + description: "Value of the token sold at time of execution in the original currency" + - &token_bought_amount_raw + name: token_bought_amount_raw + description: "Raw value of the token bought at time of execution in the original currency" + - &token_sold_amount_raw + name: token_sold_amount_raw + description: "Raw value of the token sold at time of execution in the original currency" + - &amount_usd + name: amount_usd + description: "USD value of the trade at time of execution" + - &token_bought_address + name: token_bought_address + description: "Contract address of the token bought" + - &token_sold_address + name: token_sold_address + description: "Contract address of the token sold" + - &taker + name: taker + description: "Address of trader who purchased a token" + - &maker + name: maker + description: "Address of trader who sold a token" + - &pool_id + name: pool_id + description: "Unique encoded identifier that refers to each pool" + - &swap_fee + name: swap_fee + description: 'Swap fee' + - &project_contract_address + name: project_contract_address + description: "Pool address" + - &pool_symbol + name: pool_symbol + description: "Token symbols, followed by their respective weights, if applicable" + - &pool_type + name: pool_type + description: "Pool attributes, determined by the pool's factory" + - &tx_hash + name: tx_hash + description: "Tx. Hash" + - &tx_from + name: tx_from + description: "transaction.from" + - &tx_to + name: tx_to + description: "transaction.to" + - &evt_index + name: evt_index + description: 'Event index' + + - name: balancer_v2_optimism_trades + meta: + blockchain: optimism + sector: dex + contributors: bizzyvinci, thetroyharris, tomfutago, viniabussafi + config: + tags: [ 'balancer', 'optimism', 'amm', 'trades', 'dex', 'beta' ] + description: > + DEX trades on balancer v2 on optimism + columns: + - *blockchain + - *project + - *version + - *block_month + - *block_date + - *block_time + - *block_number + - *token_bought_symbol + - *token_sold_symbol + - *token_pair + - *token_bought_amount + - *token_sold_amount + - *token_bought_amount_raw + - *token_sold_amount_raw + - *amount_usd + - *token_bought_address + - *token_sold_address + - *taker + - *maker + - *project_contract_address + - *pool_symbol + - *pool_type + - *pool_id + - *swap_fee + - *tx_hash + - *tx_from + - *tx_to + - *evt_index \ No newline at end of file diff --git a/models/balancer/optimism/balancer_optimism_trades.sql b/models/_project/balancer/trades/optimism/balancer_optimism_trades.sql similarity index 100% rename from models/balancer/optimism/balancer_optimism_trades.sql rename to models/_project/balancer/trades/optimism/balancer_optimism_trades.sql diff --git a/models/balancer/optimism/balancer_v2_optimism_trades.sql b/models/_project/balancer/trades/optimism/balancer_v2_optimism_trades.sql similarity index 94% rename from models/balancer/optimism/balancer_v2_optimism_trades.sql rename to models/_project/balancer/trades/optimism/balancer_v2_optimism_trades.sql index 03327617f4f..b53e845ddd6 100644 --- a/models/balancer/optimism/balancer_v2_optimism_trades.sql +++ b/models/_project/balancer/trades/optimism/balancer_v2_optimism_trades.sql @@ -4,9 +4,9 @@ alias = 'trades', materialized = 'view', post_hook = '{{ expose_spells(\'["optimism"]\', - "project", - "balancer_v2", - \'["mendesfabio", "jacektrocinski", "thetroyharris", "tomfutago", "viniabussafi"]\') }}' + spell_type = "project", + spell_name = "balancer", + contributors = \'["mendesfabio", "jacektrocinski", "thetroyharris", "tomfutago", "viniabussafi"]\') }}' ) }} diff --git a/models/_project/balancer/trades/polygon/_schema.yml b/models/_project/balancer/trades/polygon/_schema.yml new file mode 100644 index 00000000000..c0dfa6ac51b --- /dev/null +++ b/models/_project/balancer/trades/polygon/_schema.yml @@ -0,0 +1,149 @@ +version: 2 + +models: + - name: balancer_polygon_trades + meta: + blockchain: polygon + sector: dex + contributors: bizzyvinci, viniabussafi + config: + tags: ['balancer', 'polygon', 'amm', 'trades', 'dex'] + description: > + DEX trades on balancer on polygon + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - block_date + - blockchain + - project + - version + - tx_hash + - evt_index + - check_dex_seed: + blockchain: polygon + project: balancer + version: 2 + columns: + - &blockchain + name: blockchain + description: "Blockchain" + - &project + name: project + description: "Project name (balancer)" + - &version + name: version + description: "Version of the project" + - &block_month + name: block_month + description: "Block month in UTC" + - &block_date + name: block_date + description: "Block date in UTC" + - &block_time + name: block_time + description: 'Block time in UTC' + - &block_number + name: block_number + description: 'Block number' + - &token_bought_symbol + name: token_bought_symbol + description: "Token symbol for token bought in the trade" + - &token_sold_symbol + name: token_sold_symbol + description: "Token symbol for token sold in the trade" + - &token_pair + name: token_pair + description: "Token symbol pair for each token involved in the trade" + - &token_bought_amount + name: token_bought_amount + description: "Value of the token bought at time of execution in the original currency" + - &token_sold_amount + name: token_sold_amount + description: "Value of the token sold at time of execution in the original currency" + - &token_bought_amount_raw + name: token_bought_amount_raw + description: "Raw value of the token bought at time of execution in the original currency" + - &token_sold_amount_raw + name: token_sold_amount_raw + description: "Raw value of the token sold at time of execution in the original currency" + - &amount_usd + name: amount_usd + description: "USD value of the trade at time of execution" + - &token_bought_address + name: token_bought_address + description: "Contract address of the token bought" + - &token_sold_address + name: token_sold_address + description: "Contract address of the token sold" + - &taker + name: taker + description: "Address of trader who purchased a token" + - &maker + name: maker + description: "Address of trader who sold a token" + - &pool_id + name: pool_id + description: "Unique encoded identifier that refers to each pool" + - &swap_fee + name: swap_fee + description: 'Swap fee' + - &project_contract_address + name: project_contract_address + description: "Pool address" + - &pool_symbol + name: pool_symbol + description: "Token symbols, followed by their respective weights, if applicable" + - &pool_type + name: pool_type + description: "Pool attributes, determined by the pool's factory" + - &tx_hash + name: tx_hash + description: "Tx. Hash" + - &tx_from + name: tx_from + description: "transaction.from" + - &tx_to + name: tx_to + description: "transaction.to" + - &evt_index + name: evt_index + description: 'Event index' + + - name: balancer_v2_polygon_trades + meta: + blockchain: polygon + sector: dex + contributors: bizzyvinci, thetroyharris, tomfutago, viniabussafi + config: + tags: [ 'balancer', 'polygon', 'amm', 'trades', 'dex', 'beta' ] + description: > + DEX trades on balancer v2 on polygon + columns: + - *blockchain + - *project + - *version + - *block_month + - *block_date + - *block_time + - *block_number + - *token_bought_symbol + - *token_sold_symbol + - *token_pair + - *token_bought_amount + - *token_sold_amount + - *token_bought_amount_raw + - *token_sold_amount_raw + - *amount_usd + - *token_bought_address + - *token_sold_address + - *taker + - *maker + - *project_contract_address + - *pool_symbol + - *pool_type + - *pool_id + - *swap_fee + - *tx_hash + - *tx_from + - *tx_to + - *evt_index \ No newline at end of file diff --git a/models/balancer/polygon/balancer_polygon_trades.sql b/models/_project/balancer/trades/polygon/balancer_polygon_trades.sql similarity index 100% rename from models/balancer/polygon/balancer_polygon_trades.sql rename to models/_project/balancer/trades/polygon/balancer_polygon_trades.sql diff --git a/models/balancer/polygon/balancer_v2_polygon_trades.sql b/models/_project/balancer/trades/polygon/balancer_v2_polygon_trades.sql similarity index 94% rename from models/balancer/polygon/balancer_v2_polygon_trades.sql rename to models/_project/balancer/trades/polygon/balancer_v2_polygon_trades.sql index a17dabab52d..37b12105abe 100644 --- a/models/balancer/polygon/balancer_v2_polygon_trades.sql +++ b/models/_project/balancer/trades/polygon/balancer_v2_polygon_trades.sql @@ -4,9 +4,9 @@ alias = 'trades', materialized = 'view', post_hook = '{{ expose_spells(\'["polygon"]\', - "project", - "balancer_v2", - \'["mendesfabio", "jacektrocinski", "thetroyharris", "tomfutago", "viniabussafi"]\') }}' + spell_type = "project", + spell_name = "balancer", + contributors = \'["mendesfabio", "jacektrocinski", "thetroyharris", "tomfutago", "viniabussafi"]\') }}' ) }} diff --git a/models/_project/balancer/trades/zkevm/_schema.yml b/models/_project/balancer/trades/zkevm/_schema.yml new file mode 100644 index 00000000000..80f42ffe980 --- /dev/null +++ b/models/_project/balancer/trades/zkevm/_schema.yml @@ -0,0 +1,110 @@ +version: 2 + +models: + - name: balancer_zkevm_trades + meta: + blockchain: zkevm + sector: dex + contributors: bizzyvinci, viniabussafi + config: + tags: ['balancer', 'zkevm', 'amm', 'trades', 'dex'] + description: > + DEX trades on balancer on zkevm + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - block_date + - blockchain + - project + - version + - tx_hash + - evt_index + - check_dex_seed: + blockchain: zkevm + project: balancer + version: 2 + columns: + - &blockchain + name: blockchain + description: "Blockchain" + - &project + name: project + description: "Project name (balancer)" + - &version + name: version + description: "Version of the project" + - &block_month + name: block_month + description: "Block month in UTC" + - &block_date + name: block_date + description: "Block date in UTC" + - &block_time + name: block_time + description: 'Block time in UTC' + - &block_number + name: block_number + description: 'Block number' + - &token_bought_symbol + name: token_bought_symbol + description: "Token symbol for token bought in the trade" + - &token_sold_symbol + name: token_sold_symbol + description: "Token symbol for token sold in the trade" + - &token_pair + name: token_pair + description: "Token symbol pair for each token involved in the trade" + - &token_bought_amount + name: token_bought_amount + description: "Value of the token bought at time of execution in the original currency" + - &token_sold_amount + name: token_sold_amount + description: "Value of the token sold at time of execution in the original currency" + - &token_bought_amount_raw + name: token_bought_amount_raw + description: "Raw value of the token bought at time of execution in the original currency" + - &token_sold_amount_raw + name: token_sold_amount_raw + description: "Raw value of the token sold at time of execution in the original currency" + - &amount_usd + name: amount_usd + description: "USD value of the trade at time of execution" + - &token_bought_address + name: token_bought_address + description: "Contract address of the token bought" + - &token_sold_address + name: token_sold_address + description: "Contract address of the token sold" + - &taker + name: taker + description: "Address of trader who purchased a token" + - &maker + name: maker + description: "Address of trader who sold a token" + - &pool_id + name: pool_id + description: "Unique encoded identifier that refers to each pool" + - &swap_fee + name: swap_fee + description: 'Swap fee' + - &project_contract_address + name: project_contract_address + description: "Pool address" + - &pool_symbol + name: pool_symbol + description: "Token symbols, followed by their respective weights, if applicable" + - &pool_type + name: pool_type + description: "Pool attributes, determined by the pool's factory" + - &tx_hash + name: tx_hash + description: "Tx. Hash" + - &tx_from + name: tx_from + description: "transaction.from" + - &tx_to + name: tx_to + description: "transaction.to" + - &evt_index + name: evt_index + description: 'Event index' \ No newline at end of file diff --git a/models/balancer/zkevm/balancer_v2_zkevm_trades.sql b/models/_project/balancer/trades/zkevm/balancer_v2_zkevm_trades.sql similarity index 94% rename from models/balancer/zkevm/balancer_v2_zkevm_trades.sql rename to models/_project/balancer/trades/zkevm/balancer_v2_zkevm_trades.sql index 340fbe1dbd8..36cc38e4a44 100644 --- a/models/balancer/zkevm/balancer_v2_zkevm_trades.sql +++ b/models/_project/balancer/trades/zkevm/balancer_v2_zkevm_trades.sql @@ -4,9 +4,9 @@ alias = 'trades', materialized = 'view', post_hook = '{{ expose_spells(\'["zkevm"]\', - "project", - "balancer_v2", - \'["mendesfabio", "jacektrocinski", "thetroyharris", "tomfutago", "viniabussafi"]\') }}' + spell_type = "project", + spell_name = "balancer", + contributors = \'["mendesfabio", "jacektrocinski", "thetroyharris", "tomfutago", "viniabussafi"]\') }}' ) }} diff --git a/models/balancer/zkevm/balancer_zkevm_trades.sql b/models/_project/balancer/trades/zkevm/balancer_zkevm_trades.sql similarity index 100% rename from models/balancer/zkevm/balancer_zkevm_trades.sql rename to models/_project/balancer/trades/zkevm/balancer_zkevm_trades.sql diff --git a/models/_project/balancer/vebal/ethereum/_schema.yml b/models/_project/balancer/vebal/ethereum/_schema.yml new file mode 100644 index 00000000000..ab2ba4d4bdf --- /dev/null +++ b/models/_project/balancer/vebal/ethereum/_schema.yml @@ -0,0 +1,91 @@ +version: 2 + +models: + - name: balancer_ethereum_vebal_balances_day + meta: + blockchain: ethereum + project: balancer + contributors: markusbkoch, mendesfabio, victorstefenon, viniabussafi + config: + tags: ['balancer', 'ethereum', 'vebal', 'day'] + description: > + Daily balances of veBAL per wallet + Depends on veBAL_call_create_lock, veBAL_evt_Deposit and veBAL_evt_Withdraw + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - day + - wallet_address + columns: + - name: day + - name: wallet_address + description: "Address of the wallet holding the veBAL" + - name: bpt_balance + description: "Amount of BPT held in the veBAL lock" + - name: vebal_balance + description: "Amount of veBAL" + - name: lock_time + description: "Amount of time the BPT was locked for at the last time the lock was updated" + + - name: balancer_ethereum_vebal_slopes + meta: + blockchain: ethereum + project: balancer + contributors: markusbkoch, mendesfabio, victorstefenon, viniabussafi + config: + tags: ['balancer', 'ethereum', 'vebal', 'slope'] + description: > + Slope and bias of veBAL per wallet after each balance update + Depends on veBAL_call_create_lock, veBAL_evt_Deposit and veBAL_evt_Withdraw + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - block_number + - wallet_address + columns: + - name: block_number + - name: block_time + - name: block_timestamp + description: "Block timestamp" + - name: wallet_address + description: "Address of the wallet holding the veBAL" + - name: bpt_balance + description: "Amount of BPT held in the veBAL lock" + - name: unlocked_at + description: "Timestamp at which B-80BAL-20WETH BPT can be unlocked" + - name: slope + description: "veBAL decay rate (per second)" + - name: bias + description: "veBAL balance at the moment user locks or re-locks" + - name: block_date + description: "Block time trunc to date" + + - name: balancer_ethereum_vebal_votes + meta: + blockchain: ethereum + project: balancer + contributors: markusbkoch, mendesfabio, stefenon, viniabussafi + config: + tags: ['balancer', 'ethereum', 'vebal', 'votes'] + description: > + Records of votes for Balancer gauges by provider at each voting round + Depends on GaugeController_evt_VoteForGauge and the vebal_slopes spell + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - round_id + - gauge + - provider + columns: + - name: round_id + description: "ID of the voting round" + - name: start_date + description: "Day of the voting round start date" + - name: end_date + description: "Day of the voting round end date" + - name: gauge + description: "Address of the gauge which provider votes for" + - name: provider + description: "Address of the wallet which voted for the gauge" + - name: vote + description: "Weight of the vote performed by the provider for the gauge" \ No newline at end of file diff --git a/models/balancer/ethereum/balancer_ethereum_vebal_balances_day.sql b/models/_project/balancer/vebal/ethereum/balancer_ethereum_vebal_balances_day.sql similarity index 94% rename from models/balancer/ethereum/balancer_ethereum_vebal_balances_day.sql rename to models/_project/balancer/vebal/ethereum/balancer_ethereum_vebal_balances_day.sql index 31df281cbcf..dbeb8065ba9 100644 --- a/models/balancer/ethereum/balancer_ethereum_vebal_balances_day.sql +++ b/models/_project/balancer/vebal/ethereum/balancer_ethereum_vebal_balances_day.sql @@ -1,12 +1,11 @@ {{ config( schema="balancer_ethereum", - alias = 'vebal_balances_day', post_hook='{{ expose_spells(\'["ethereum"]\', - "project", - "balancer", - \'["markusbkoch", "mendesfabio", "stefenon", "viniabussafi"]\') }}' + spell_type = "project", + spell_name = "balancer", + contributors = \'["markusbkoch", "mendesfabio", "stefenon", "viniabussafi"]\') }}' ) }} diff --git a/models/balancer/ethereum/balancer_ethereum_vebal_slopes.sql b/models/_project/balancer/vebal/ethereum/balancer_ethereum_vebal_slopes.sql similarity index 93% rename from models/balancer/ethereum/balancer_ethereum_vebal_slopes.sql rename to models/_project/balancer/vebal/ethereum/balancer_ethereum_vebal_slopes.sql index 7f549cd9a81..bf49f4f5471 100644 --- a/models/balancer/ethereum/balancer_ethereum_vebal_slopes.sql +++ b/models/_project/balancer/vebal/ethereum/balancer_ethereum_vebal_slopes.sql @@ -1,12 +1,11 @@ {{ config( - schema="balancer_ethereum", - + schema="balancer_ethereum", alias = 'vebal_slopes', post_hook='{{ expose_spells(\'["ethereum"]\', - "project", - "balancer", - \'["markusbkoch", "mendesfabio", "stefenon", "viniabussafi"]\') }}' + spell_type = "project", + spell_name = "balancer", + contributors = \'["markusbkoch", "mendesfabio", "stefenon", "viniabussafi"]\') }}' ) }} diff --git a/models/balancer/ethereum/balancer_ethereum_vebal_votes.sql b/models/_project/balancer/vebal/ethereum/balancer_ethereum_vebal_votes.sql similarity index 92% rename from models/balancer/ethereum/balancer_ethereum_vebal_votes.sql rename to models/_project/balancer/vebal/ethereum/balancer_ethereum_vebal_votes.sql index 17929d1105c..d52c0fe757f 100644 --- a/models/balancer/ethereum/balancer_ethereum_vebal_votes.sql +++ b/models/_project/balancer/vebal/ethereum/balancer_ethereum_vebal_votes.sql @@ -1,13 +1,13 @@ {{ config( - + schema = 'balancer_ethereum', alias = 'vebal_votes', materialized = 'table', file_format = 'delta', post_hook='{{ expose_spells(\'["ethereum"]\', - "project", - "balancer", - \'["markusbkoch", "mendesfabio", "stefenon", "viniabussafi"]\') }}' + spell_type = "project", + spell_name = "balancer", + contributors = \'["markusbkoch", "mendesfabio", "stefenon", "viniabussafi"]\') }}' ) }} diff --git a/models/balancer/arbitrum/balancer_arbitrum_schema.yml b/models/balancer/arbitrum/balancer_arbitrum_schema.yml deleted file mode 100644 index c533ff3ff10..00000000000 --- a/models/balancer/arbitrum/balancer_arbitrum_schema.yml +++ /dev/null @@ -1,432 +0,0 @@ -version: 2 - -models: - - name: balancer_v2_arbitrum_pools_fees - meta: - blockchain: arbitrum - project: balancer_v2 - contributors: jacektrocinski, thetroyharris, viniabussafi - config: - tags: ['arbitrum', 'balancer', 'pools_fees'] - description: > - Balancer v2 swap fees stored at the pool level. - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - block_number - - tx_hash - - index - columns: - - name: blockchain - - name: version - - &contract_address - name: contract_address - description: 'Arbitrum address for the liquidity pool used in transaction' - tests: - - not_null - - &tx_hash - name: tx_hash - description: 'Transaction hash' - tests: - - not_null - - &index - name: index - description: '' - tests: - - not_null - - &tx_index - name: tx_index - description: '' - tests: - - not_null - - &block_time - name: block_time - description: 'Block time in UTC' - tests: - - not_null - - &block_number - name: block_number - description: '' - tests: - - not_null - - &swap_fee_percentage - name: swap_fee_percentage - description: 'Swap fees for the pool, values are returned with 18 decimals (1e18 meaning 100%)' - tests: - - not_null - - - name: balancer_v2_arbitrum_transfers_bpt - meta: - blockchain: arbitrum - project: balancer_v2 - contributors: victorstefenon, thetroyharris, viniabussafi - config: - tags: ['arbitrum', 'bpt', 'transfers'] - description: > - Balancer Pool Token (BPT) transfer logs on Balancer, an automated portfolio manager and trading platform, on Arbitrum. - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - evt_tx_hash - - evt_index - - block_date - columns: - - &blockchain - name: blockchain - description: "Blockchain" - - name: version - - *contract_address - - &block_date - name: block_date - description: "UTC event block date of each DEX trade" - - &block_month - name: block_month - description: "UTC event block month of each DEX trade" - - &evt_tx_hash - name: evt_tx_hash - description: 'Transaction hash of transfer event' - - &evt_index - name: evt_index - description: 'Event index' - - &evt_block_time - name: evt_block_time - description: 'Block time of transfer event' - - &evt_block_number - name: evt_block_number - description: 'Block number of transfer event' - - &from - name: from - description: 'Address of BPT provider of transfer event' - - &to - name: to - description: 'Address of BPT receiver of transfer event' - - &value - name: value - description: 'Amount of BPT transferred in transfer event' - - - name: balancer_arbitrum_pools_tokens_weights - meta: - blockchain: arbitrum - project: balancer - contributors: jacektrocinski, viniabussafi - config: - tags: ['arbitrum', 'balancer', 'pools', 'tokens', 'weights'] - description: > - Token weights in Balancer pools. - columns: - - *blockchain - - name: version - - &pool_id - name: pool_id - description: 'Unique encoded identifier that refers to each pool' - tests: - - not_null - - &token_address - name: token_address - description: 'Contract address for the token' - - &normalized_weight - name: normalized_weight - description: 'Weight of the token in the pool.' - - - name: balancer_v2_arbitrum_pools_tokens_weights - meta: - blockchain: arbitrum - project: balancer - contributors: jacektrocinski, viniabussafi - config: - tags: ['arbitrum', 'balancer', 'pools', 'tokens', 'weights'] - description: > - Token weights in Balancer v2 pools. - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - pool_id - - token_address - columns: - - *blockchain - - name: version - - *pool_id - - *token_address - - *normalized_weight - - - name: balancer_arbitrum_trades - meta: - blockchain: arbitrum - sector: dex - contributors: bizzyvinci - config: - tags: ['balancer', 'arbitrum', 'amm', 'trades', 'dex'] - description: > - DEX trades on balancer on arbitrum - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - block_date - - blockchain - - project - - version - - tx_hash - - evt_index - - check_dex_seed: - blockchain: arbitrum - project: balancer - version: 2 - columns: - - *blockchain - - &project - name: project - description: "Project name (balancer)" - - &version - name: version - description: "Version of the project" - - *block_month - - *block_date - - *block_time - - &token_bought_symbol - name: token_bought_symbol - description: "Token symbol for token bought in the trade" - - &token_sold_symbol - name: token_sold_symbol - description: "Token symbol for token sold in the trade" - - &token_pair - name: token_pair - description: "Token symbol pair for each token involved in the trade" - - &token_bought_amount - name: token_bought_amount - description: "Value of the token bought at time of execution in the original currency" - - &token_sold_amount - name: token_sold_amount - description: "Value of the token sold at time of execution in the original currency" - - &token_bought_amount_raw - name: token_bought_amount_raw - description: "Raw value of the token bought at time of execution in the original currency" - - &token_sold_amount_raw - name: token_sold_amount_raw - description: "Raw value of the token sold at time of execution in the original currency" - - &amount_usd - name: amount_usd - description: "USD value of the trade at time of execution" - - &token_bought_address - name: token_bought_address - description: "Contract address of the token bought" - - &token_sold_address - name: token_sold_address - description: "Contract address of the token sold" - - &taker - name: taker - description: "Address of trader who purchased a token" - - &maker - name: maker - description: "Address of trader who sold a token" - - *pool_id - - &swap_fee - name: swap_fee - description: 'Swap fee' - - &project_contract_address - name: project_contract_address - description: "Pool address" - - name: pool_symbol - - name: pool_type - - *tx_hash - - &tx_from - name: tx_from - description: "transaction.from" - - &tx_to - name: tx_to - description: "transaction.to" - - *evt_index - - - name: balancer_v2_arbitrum_trades - meta: - blockchain: arbitrum - sector: dex - contributors: bizzyvinci, thetroyharris, tomfutago, viniabussafi - config: - tags: [ 'balancer', 'arbitrum', 'amm', 'trades', 'dex', 'beta' ] - description: > - DEX trades on balancer v2 on arbitrum - columns: - - *blockchain - - *project - - *version - - *block_month - - *block_date - - *block_time - - *block_number - - *token_bought_symbol - - *token_sold_symbol - - *token_pair - - *token_bought_amount - - *token_sold_amount - - *token_bought_amount_raw - - *token_sold_amount_raw - - *amount_usd - - *token_bought_address - - *token_sold_address - - *taker - - *maker - - *project_contract_address - - name: pool_symbol - - name: pool_type - - *pool_id - - *swap_fee - - *tx_hash - - *tx_from - - *tx_to - - *evt_index - - - name: balancer_v2_arbitrum_liquidity - meta: - blockchain: arbitrum - project: balancer_v2 - contributors: victorstefenon, viniabussafi, thetroyharris - config: - tags: ['arbitrum', 'balancer', 'pools', 'liquidity'] - description: > - Balancer v2 pools liquidity by token in Arbitrum. - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - day - - pool_id - - token_address - columns: - - name: day - description: 'UTC event block time truncated to the day mark' - - *pool_id - - name: pool_address - - name: pool_symbol - description: 'Symbol of the pool, consisting of the symbol of its tokens and their respective weights' - - name: version - description: 'Version of Balancer in which pool was deployed' - - name: blockchain - description: 'Blockchain in which pool was deployed' - - *token_address - - name: token_symbol - description: 'Symbol of the token' - - name: token_balance_raw - description: 'Raw balance of the token in the pool' - - name: token_balance - description: 'Scaled balance of the token in the pool' - - name: protocol_liquidity_usd - description: 'Liquidity of the token in the pool in USD, except BPTs' - - name: protocol_liquidity_eth - description: 'Liquidity of the token in the pool in ETH, except BPTs' - - name: pool_liquidity_usd - description: 'Liquidity of the token in the pool in USD, including BPTs' - - name: pool_liquidity_eth - description: 'Liquidity of the token in the pool in ETH, including BPTs' - - - - name: balancer_v2_arbitrum_flashloans - meta: - blockchain: arbitrum - sector: lending - contributors: hildobby - config: - tags: ['arbitrum', 'flashloans'] - description: > - All Balancer v2 flashloans on Arbitrum - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - blockchain - - tx_hash - - evt_index - columns: - - name: blockchain - - name: project - - name: version - - name: block_time - - name: block_number - - name: amount - - name: amount_usd - - name: tx_hash - - name: evt_index - - name: fee - - name: currency_contract - - name: currency_symbol - - name: recipient - - name: contract_address - - name: block_month - - - name: balancer_v2_arbitrum_bpt_prices - meta: - blockchain: arbitrum - project: balancer_v2 - contributors: victorstefenon, thetroyharris, viniabussafi - config: - tags: ['arbitrum', 'bpt', 'prices'] - description: > - Balancer Pool Token (BPT) daily price by pool on Balancer, an automated portfolio manager and trading platform. - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - blockchain - - day - - contract_address - columns: - - name: blockchain - - name: day - - name: version - - name: decimals - - name: contract_address - - name: bpt_price - - - name: balancer_v2_arbitrum_protocol_fee - meta: - blockchain: arbitrum - project: balancer_v2 - contributors: viniabussafi - config: - tags: ['arbitrum', 'revenue', 'fees'] - description: > - Daily Protocol Fee collected and Revenue by pool on Balancer, an automated portfolio manager and trading platform. - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - day - - pool_id - - token_address - columns: - - name: day - - name: pool_id - - name: pool_address - - name: pool_symbol - - name: version - - name: blockchain - - name: token_address - - name: token_symbol - - name: token_amount_raw - description: "Raw amount of revenues of the token in the pool" - - name: token_amount - description: "Amount of revenues of the token in the pool" - - name: protocol_fee_collected_usd - description: "Fee collected in the pool in USD" - - name: treasury_share - description: "Share of total revenue that is directed to Balancer DAO's treasury, as per BIPs 19, 161 and 371" - - name: treasury_revenue_usd - description: "Total revenue directed to Balancer DAO's treasury" - - - name: balancer_v2_arbitrum_bpt_supply - meta: - blockchain: arbiturm - project: balancer_v2 - contributors: thetroyharris, viniabussafi - config: - tags: ['arbiturm', 'bpt', 'supply'] - description: > - Balancer Pool Token (BPT) supply for ComposableStablePools versions 4 and 5. - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - day - - blockchain - - token_address - columns: - - name: day - - name: pool_type - - name: version - - name: blockchain - - name: token_address - - name: supply \ No newline at end of file diff --git a/models/balancer/avalanche_c/balancer_avalanche_c_schema.yml b/models/balancer/avalanche_c/balancer_avalanche_c_schema.yml deleted file mode 100644 index 93cc2e87629..00000000000 --- a/models/balancer/avalanche_c/balancer_avalanche_c_schema.yml +++ /dev/null @@ -1,405 +0,0 @@ -version: 2 - -models: - - - name: balancer_avalanche_c_trades - meta: - blockchain: avalanche_c - sector: dex - contributors: bizzyvinci - config: - tags: ['balancer', 'avalanche_c', 'amm', 'trades', 'dex'] - description: > - DEX trades on balancer on avalanche_c - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - block_date - - blockchain - - project - - version - - tx_hash - - evt_index - - check_dex_seed: - blockchain: avalanche_c - project: balancer - version: 2 - columns: - - &blockchain - name: blockchain - description: "Blockchain" - - &project - name: project - description: "Project name (balancer)" - - &version - name: version - description: "Version of the project" - - &block_month - name: block_month - description: "Block month in UTC" - - &block_date - name: block_date - description: "Block date in UTC" - - &block_time - name: block_time - description: 'Block time in UTC' - - &token_bought_symbol - name: token_bought_symbol - description: "Token symbol for token bought in the trade" - - &token_sold_symbol - name: token_sold_symbol - description: "Token symbol for token sold in the trade" - - &token_pair - name: token_pair - description: "Token symbol pair for each token involved in the trade" - - &token_bought_amount - name: token_bought_amount - description: "Value of the token bought at time of execution in the original currency" - - &token_sold_amount - name: token_sold_amount - description: "Value of the token sold at time of execution in the original currency" - - &token_bought_amount_raw - name: token_bought_amount_raw - description: "Raw value of the token bought at time of execution in the original currency" - - &token_sold_amount_raw - name: token_sold_amount_raw - description: "Raw value of the token sold at time of execution in the original currency" - - &amount_usd - name: amount_usd - description: "USD value of the trade at time of execution" - - &token_bought_address - name: token_bought_address - description: "Contract address of the token bought" - - &token_sold_address - name: token_sold_address - description: "Contract address of the token sold" - - &taker - name: taker - description: "Address of trader who purchased a token" - - &maker - name: maker - description: "Address of trader who sold a token" - - &pool_id - name: pool_id - description: 'Unique encoded identifier that refers to each pool' - - &swap_fee - name: swap_fee - description: 'Swap fee' - - &project_contract_address - name: project_contract_address - description: "Pool address" - - name: pool_symbol - - name: pool_type - - &tx_hash - name: tx_hash - description: "Transaction hash" - - &tx_from - name: tx_from - description: "transaction.from" - - &tx_to - name: tx_to - description: "transaction.to" - - &evt_index - name: evt_index - description: "Event index" - - - name: balancer_v2_avalanche_c_trades - meta: - blockchain: avalanche_c - sector: dex - contributors: bizzyvinci, thetroyharris, tomfutago, viniabussafi - config: - tags: [ 'balancer', 'avalanche_c', 'amm', 'trades', 'dex', 'beta' ] - description: > - DEX trades on balancer v2 on avalanche_c - columns: - - *blockchain - - *project - - *version - - *block_month - - *block_date - - *block_time - - name: block_number - - *token_bought_symbol - - *token_sold_symbol - - *token_pair - - *token_bought_amount - - *token_sold_amount - - *token_bought_amount_raw - - *token_sold_amount_raw - - *amount_usd - - *token_bought_address - - *token_sold_address - - *taker - - *maker - - *project_contract_address - - name: pool_symbol - - name: pool_type - - *pool_id - - *swap_fee - - *tx_hash - - *tx_from - - *tx_to - - *evt_index - - - name: balancer_avalanche_c_pools_tokens_weights - meta: - blockchain: avalanche_c - project: balancer - contributors: jacektrocinski, viniabussafi - config: - tags: ['avalanche_c', 'balancer', 'pools', 'tokens', 'weights'] - description: > - Token weights in Balancer pools. - columns: - - *blockchain - - name: version - - *pool_id - - &token_address - name: token_address - description: 'Contract address for the token' - - &normalized_weight - name: normalized_weight - description: 'Weight of the token in the pool.' - - - name: balancer_v2_avalanche_c_pools_tokens_weights - meta: - blockchain: avalanche_c - project: balancer - contributors: jacektrocinski, viniabussafi - config: - tags: ['avalanche_c', 'balancer', 'pools', 'tokens', 'weights'] - description: > - Token weights in Balancer v2 pools. - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - pool_id - - token_address - columns: - - *blockchain - - name: version - - *pool_id - - *token_address - - *normalized_weight - - - name: balancer_v2_avalanche_c_liquidity - meta: - blockchain: avalanche_c - project: balancer_v2 - contributors: victorstefenon, viniabussafi, thetroyharris - config: - tags: ['avalanche_c', 'balancer', 'pools', 'liquidity'] - description: > - Balancer v2 pools liquidity by token in avalanche_c. - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - day - - pool_id - - token_address - columns: - - name: day - description: 'UTC event block time truncated to the day mark' - - *pool_id - - name: pool_address - - name: pool_symbol - description: 'Symbol of the pool, consisting of the symbol of its tokens and their respective weights' - - name: version - description: 'Version of Balancer in which pool was deployed' - - name: blockchain - description: 'Blockchain in which pool was deployed' - - *token_address - - name: token_symbol - description: 'Symbol of the token' - - name: token_balance_raw - description: 'Raw balance of the token in the pool' - - name: token_balance - description: 'Scaled balance of the token in the pool' - - name: protocol_liquidity_usd - description: 'Liquidity of the token in the pool in USD, except BPTs' - - name: protocol_liquidity_eth - description: 'Liquidity of the token in the pool in ETH, except BPTs' - - name: pool_liquidity_usd - description: 'Liquidity of the token in the pool in USD, including BPTs' - - name: pool_liquidity_eth - description: 'Liquidity of the token in the pool in ETH, including BPTs' - - - - name: balancer_v2_avalanche_c_bpt_prices - meta: - blockchain: avalanche_c - project: balancer_v2 - contributors: victorstefenon, thetroyharris, viniabussafi - config: - tags: ['avalanche_c', 'bpt', 'prices'] - description: > - Balancer Pool Token (BPT) hourly median price by pool on Balancer, an automated portfolio manager and trading platform. - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - blockchain - - day - - contract_address - columns: - - name: blockchain - - name: day - - name: version - - name: decimals - - name: contract_address - - name: bpt_price - - - name: balancer_v2_avalanche_c_transfers_bpt - meta: - blockchain: avalanche_c - project: balancer_v2 - contributors: victorstefenon, thetroyharris, viniabussafi - config: - tags: ['avalanche_c', 'bpt', 'transfers'] - description: > - Balancer Pool Token (BPT) transfer logs on Balancer, an automated portfolio manager and trading platform, on Avalanche C Chain. - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - evt_tx_hash - - evt_index - - block_date - columns: - - name: blockchain - - name: version - - name: contract_address - - name: block_date - - name: block_month - - name: evt_tx_hash - - name: evt_index - - &evt_block_time - name: evt_block_time - description: 'Block time of transfer event' - - &evt_block_number - name: evt_block_number - description: 'Block number of transfer event' - - &from - name: from - description: 'Address of BPT provider of transfer event' - - &to - name: to - description: 'Address of BPT receiver of transfer event' - - &value - name: value - description: 'Amount of BPT transferred in transfer event' - - - name: balancer_v2_avalanche_c_pools_fees - meta: - blockchain: avalanche_c - project: balancer_v2 - contributors: jacektrocinski, thetroyharris, viniabussafi - config: - tags: ['avalanche_c', 'balancer', 'pools', 'fees'] - description: > - Balancer v2 swap fees stored at the pool level. - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - block_number - - tx_hash - - index - columns: - - name: blockchain - - name: version - - name: contract_address - - name: tx_hash - - name: index - - name: tx_index - - name: block_time - - name: block_number - - name: swap_fee_percentage - - - name: balancer_v2_avalanche_c_flashloans - meta: - blockchain: avalanche_c - sector: lending - contributors: hildobby, viniabussafi - config: - tags: ['avalanche_c', 'flashloans'] - description: > - All Balancer v2 flashloans on avalanche_c - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - blockchain - - tx_hash - - evt_index - columns: - - name: blockchain - - name: project - - name: version - - name: block_time - - name: block_number - - name: amount - - name: amount_usd - - name: tx_hash - - name: evt_index - - name: fee - - name: currency_contract - - name: currency_symbol - - name: recipient - - name: contract_address - - name: block_month - - - name: balancer_v2_avalanche_c_protocol_fee - meta: - blockchain: avalanche_c - project: balancer_v2 - contributors: viniabussafi - config: - tags: ['avalanche_c', 'revenue', 'fees'] - description: > - Daily Protocol Fee collected and Revenue by pool on Balancer, an automated portfolio manager and trading platform. - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - day - - pool_id - - token_address - columns: - - name: day - - name: pool_id - - name: pool_address - - name: pool_symbol - - name: version - - name: blockchain - - name: token_address - - name: token_symbol - - name: token_amount_raw - description: "Raw amount of revenues of the token in the pool" - - name: token_amount - description: "Amount of revenues of the token in the pool" - - name: protocol_fee_collected_usd - description: "Fee collected in the pool in USD" - - name: treasury_share - description: "Share of total revenue that is directed to Balancer DAO's treasury, as per BIPs 19, 161 and 371" - - name: treasury_revenue_usd - description: "Total revenue directed to Balancer DAO's treasury" - - - name: balancer_v2_avalanche_c_bpt_supply - meta: - blockchain: avalanche_c - project: balancer_v2 - contributors: thetroyharris, viniabussafi - config: - tags: ['avalanche_c', 'bpt', 'supply'] - description: > - Balancer Pool Token (BPT) supply for ComposableStablePools versions 4 and 5. - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - day - - blockchain - - token_address - columns: - - name: day - - name: pool_type - - name: version - - name: blockchain - - name: token_address - - name: supply \ No newline at end of file diff --git a/models/balancer/balancer_schema.yml b/models/balancer/balancer_schema.yml deleted file mode 100644 index 5e7fb29a97b..00000000000 --- a/models/balancer/balancer_schema.yml +++ /dev/null @@ -1,365 +0,0 @@ -version: 2 - -models: - - name: balancer_gauge_mappings - meta: - blockchain: optimism - sector: dex - contributors: msilb7 - config: - tags: ['balancer', 'amm', 'trades', 'dex', 'incentives'] - description: > - Gauge to Pool mappings for balancer on all chains - columns: - - &blockchain - name: blockchain - description: "Blockchain" - - &project - name: project - description: "Project name (balancer)" - - &version - name: version - description: "Version of the project" - - &pool_contract - name: pool_contract - description: "Address of the liquidity pool contract" - - &pool_id - name: pool_id - description: "Pool id" - - &incentives_contract - name: incentives_contract - description: "Address of the contract where incentives are stored and emitted." - - &incentives_type - name: incentives_type - description: "Description of the incentives address type." - - &evt_block_time - name: evt_block_time - description: 'Block time in UTC' - - &evt_block_number - name: evt_block_number - description: 'Block Number' - - &contract_address - name: contract_address - description: 'Gauge Creator Contract Address' - - &evt_tx_hash - name: evt_tx_hash - description: 'Tx Hash' - - &evt_index - name: evt_index - description: 'Event index' - - - name: balancer_flashloans - meta: - blockchain: ethereum, arbitrum, optimism, polygon, gnosis - sector: lending - contributors: hildobby - config: - tags: ['ethereum', 'arbitrum', 'optimism', 'polygon', 'gnosis','avalanche_c', 'base', 'flashloans'] - description: > - All Balancer flashloans - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - blockchain - - tx_hash - - evt_index - columns: - - name: blockchain - - name: project - - name: version - - name: block_time - - name: block_month - - name: block_number - - name: amount - - name: amount_usd - - name: tx_hash - - name: evt_index - - name: fee - - name: currency_contract - - name: currency_symbol - - name: recipient - - name: contract_address - - name: block_month - - - name: balancer_bpt_prices - meta: - blockchain: ethereum, arbitrum, optimism, polygon, gnosis, avalanche_c, base - sector: dex - contributors: thetroyharris, victorstefenon, viniabussafi - config: - tags: ['balancer', 'amm', 'dex', 'bpt', 'prices', 'ethereum', 'arbitrum', 'optimism', 'polygon', 'gnosis', 'avalanche_c', 'base'] - description: > - Balancer Pool Token (BPT) hourly median price by pool on Balancer, an automated portfolio manager and trading platform. - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - blockchain - - day - - contract_address - columns: - - name: blockchain - - name: day - - name: version - - name: decimals - - name: contract_address - - name: pool_type - - name: bpt_price - - - name: balancer_liquidity - meta: - blockchain: ethereum, arbitrum, optimism, polygon, gnosis, avalanche_c, base - project: balancer - contributors: viniabussafi - config: - tags: ['balancer', 'amm', 'dex', 'liquidity', 'ethereum', 'arbitrum', 'optimism', 'polygon', 'avalanche_c', 'base'] - description: > - Liquidity by token on Balancer, an automated portfolio manager and trading platform. - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - day - - pool_id - - blockchain - - token_address - - token_symbol - columns: - - name: day - description: 'UTC event block time truncated to the day mark' - - *pool_id - - name: pool_address - - name: pool_symbol - description: 'Symbol of the pool, consisting of the symbol of its tokens and their respective weights' - - name: version - description: 'Version of Balancer in which pool was deployed' - - name: blockchain - description: 'Blockchain in which pool was deployed' - - name: pool_type - - name: token_address - - name: token_symbol - description: 'Symbol of the token' - - name: token_balance_raw - description: 'Raw balance of the token in the pool' - - name: token_balance - description: 'Scaled balance of the token in the pool' - - name: protocol_liquidity_usd - description: 'Liquidity of the token in the pool in USD, except BPTs' - - name: protocol_liquidity_eth - description: 'Liquidity of the token in the pool in ETH, except BPTs' - - name: pool_liquidity_usd - description: 'Liquidity of the token in the pool in USD, including BPTs' - - name: pool_liquidity_eth - description: 'Liquidity of the token in the pool in ETH, including BPTs' - - - - name: balancer_transfers_bpt - meta: - blockchain: arbitrum, avalanche_c, base, ethereum, gnosis, optimism, polygon - contributors: victorstefenon, thetroyharris, viniabussafi - config: - tags: ['arbitrum', 'avalanche_c', 'base', 'ethereum', 'gnosis', 'optimism', 'polygon', 'bpt', 'transfers'] - description: > - Balancer Pool Token (BPT) transfer logs on Balancer, an automated portfolio manager and trading platform. - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - evt_tx_hash - - evt_index - - block_date - columns: - - *blockchain - - name: version - - *contract_address - - &block_date - name: block_date - description: "Block date in UTC" - - *evt_tx_hash - - *evt_index - - *evt_block_time - - *evt_block_number - - &from - name: from - description: 'Address of BPT provider of transfer event' - - &to - name: to - description: 'Address of BPT receiver of transfer event' - - &value - name: value - description: 'Amount of BPT transferred in transfer event' - - - name: balancer_pools_fees - meta: - blockchain: arbitrum, avalanche_c, base, ethereum, gnosis, optimism, polygon - contributors: jacektrocinski, thetroyharris, viniabussafi - config: - tags: ['arbitrum', 'avalanche_c', 'base', 'ethereum', 'gnosis', 'optimism', 'polygon', 'bpt', 'transfers'] - description: > - Balancer v2 swap fees stored at the pool level. - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - blockchain - - block_number - - tx_hash - - index - columns: - - name: blockchain - - name: version - - name: contract_address - - name: tx_hash - - name: index - - name: tx_index - - name: block_time - - name: block_number - - name: swap_fee_percentage - - - name: balancer_protocol_fee - meta: - blockchain: arbitrum, avalanche_c, base, ethereum, gnosis, optimism, polygon - project: balancer - contributors: viniabussafi - config: - tags: ['arbitrum', 'avalanche_c', 'base', 'ethereum', 'gnosis', 'optimism', 'polygon', 'revenue', 'fees'] - description: > - Daily Protocol Fee collected and Revenue by pool on Balancer, an automated portfolio manager and trading platform. - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - day - - pool_id - - token_address - columns: - - name: day - - *pool_id - - name: pool_address - - name: pool_symbol - - *version - - *blockchain - - name: pool_type - - name: token_address - - name: token_symbol - - name: token_amount_raw - description: "Raw amount of revenues of the token in the pool" - - name: token_amount - description: "Amount of revenues of the token in the pool" - - name: protocol_fee_collected_usd - description: "Fee collected in the pool in USD" - - name: treasury_share - description: "Share of total revenue that is directed to Balancer DAO's treasury, as per BIPs 19, 161 and 371" - - name: treasury_revenue_usd - description: "Total revenue directed to Balancer DAO's treasury" - - - name: balancer_bpt_supply - meta: - blockchain: arbitrum, avalanche_c, base, ethereum, gnosis, optimism, polygon - contributors: thetroyharris, viniabussafi - config: - tags: ['arbitrum', 'avalanche_c', 'base', 'ethereum', 'gnosis', 'optimism', 'polygon', 'bpt'] - description: > - The Balancer Pool Token (BPT) supply over time of ComposableStablePools versions 4+ - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - day - - blockchain - - token_address - columns: - - name: day - - name: pool_type - - name: version - - name: blockchain - - name: token_address - - name: supply - - - name: balancer_token_whitelist - meta: - blockchain: arbitrum, avalanche_c, base, ethereum, gnosis, optimism, polygon - contributors: viniabussafi - config: - tags: ['arbitrum', 'avalanche_c', 'base', 'ethereum', 'gnosis', 'optimism', 'polygon', 'bpt'] - description: > - These tokens are whitelisted to be used as pricing assets on liquidity calculations for weighted pools, due to the trustability of their data. - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - address - - name - - chain - columns: - - name: address - - name: name - - name: chain - - - name: balancer_pools_tokens_weights - meta: - blockchain: arbitrum, avalanche_c, base, ethereum, gnosis, optimism, polygon - contributors: jacektrocinski, viniabussafi - config: - tags: ['arbitrum', 'avalanche_c', 'base', 'ethereum', 'gnosis', 'optimism', 'polygon', 'bpt', 'transfers'] - description: > - Token weights in Balancer pools. - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - blockchain - - pool_id - - token_address - columns: - - *blockchain - - name: version - - *pool_id - - name: token_address - - name: normalized_weight - - - name: balancer_single_recipient_gauges - meta: - blockchain: ethereum - contributors: viniabussafi - config: - tags: ['ethereum', 'gauges'] - description: > - These gauges are deployed by the SingleRecipientGauge contract and this mapping manually links each gauge to it's correspondent pool and project - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - gauge_address - - pool_id - - project - - blockchain - columns: - - name: gauge_address - - name: pool_id - - name: project - - name: blockchain - - - name: balancer_pools_metrics_daily - meta: - blockchain: arbitrum, avalanche_c, base, ethereum, gnosis, optimism, polygon, zkevm - contributors: viniabussafi, metacrypto - config: - tags: ['arbitrum', 'avalanche_c', 'base', 'ethereum', 'gnosis', 'optimism', 'polygon', 'zkevm', 'balancer', 'pool', 'stats', 'volume', 'tvl', 'fee'] - description: > - This spell aggregates data from the trades, liquidity and protocol fees spells, by day and pool, while also displaying some basic information about the pool - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - block_date - - blockchain - - project - - version - - project_contract_address - columns: - - name: blockchain - - name: project - - name: version - - name: block_date - - name: project_contract_address - - name: pool_symbol - - name: pool_type - - name: swap_amount_usd - description: "Daily swap volume on a pool, in USD" - - name: tvl_usd - description: "Total Value Locked on a pool, in USD" - - name: tvl_eth - description: "Total Value Locked on a pool, in eth" - - name: fee_amount_usd - description: "Daily fees collected on a pool, in USD" \ No newline at end of file diff --git a/models/balancer/base/balancer_base_schema.yml b/models/balancer/base/balancer_base_schema.yml deleted file mode 100644 index d6e170e5536..00000000000 --- a/models/balancer/base/balancer_base_schema.yml +++ /dev/null @@ -1,405 +0,0 @@ -version: 2 - -models: - - - name: balancer_base_trades - meta: - blockchain: base - sector: dex - contributors: bizzyvinci - config: - tags: ['balancer', 'base', 'amm', 'trades', 'dex'] - description: > - DEX trades on balancer on base - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - block_date - - blockchain - - project - - version - - tx_hash - - evt_index - - check_dex_seed: - blockchain: base - project: balancer - version: 2 - columns: - - &blockchain - name: blockchain - description: "Blockchain" - - &project - name: project - description: "Project name (balancer)" - - &version - name: version - description: "Version of the project" - - &block_month - name: block_month - description: "Block month in UTC" - - &block_date - name: block_date - description: "Block date in UTC" - - &block_time - name: block_time - description: 'Block time in UTC' - - &token_bought_symbol - name: token_bought_symbol - description: "Token symbol for token bought in the trade" - - &token_sold_symbol - name: token_sold_symbol - description: "Token symbol for token sold in the trade" - - &token_pair - name: token_pair - description: "Token symbol pair for each token involved in the trade" - - &token_bought_amount - name: token_bought_amount - description: "Value of the token bought at time of execution in the original currency" - - &token_sold_amount - name: token_sold_amount - description: "Value of the token sold at time of execution in the original currency" - - &token_bought_amount_raw - name: token_bought_amount_raw - description: "Raw value of the token bought at time of execution in the original currency" - - &token_sold_amount_raw - name: token_sold_amount_raw - description: "Raw value of the token sold at time of execution in the original currency" - - &amount_usd - name: amount_usd - description: "USD value of the trade at time of execution" - - &token_bought_address - name: token_bought_address - description: "Contract address of the token bought" - - &token_sold_address - name: token_sold_address - description: "Contract address of the token sold" - - &taker - name: taker - description: "Address of trader who purchased a token" - - &maker - name: maker - description: "Address of trader who sold a token" - - &pool_id - name: pool_id - description: 'Unique encoded identifier that refers to each pool' - - &swap_fee - name: swap_fee - description: 'Swap fee' - - &project_contract_address - name: project_contract_address - description: "Pool address" - - name: pool_symbol - - name: pool_type - - &tx_hash - name: tx_hash - description: "Transaction hash" - - &tx_from - name: tx_from - description: "transaction.from" - - &tx_to - name: tx_to - description: "transaction.to" - - &evt_index - name: evt_index - description: "Event index" - - - name: balancer_v2_base_trades - meta: - blockchain: base - sector: dex - contributors: bizzyvinci, thetroyharris, tomfutago, viniabussafi - config: - tags: [ 'balancer', 'base', 'amm', 'trades', 'dex', 'beta' ] - description: > - DEX trades on balancer v2 on base - columns: - - *blockchain - - *project - - *version - - *block_month - - *block_date - - *block_time - - name: block_number - - *token_bought_symbol - - *token_sold_symbol - - *token_pair - - *token_bought_amount - - *token_sold_amount - - *token_bought_amount_raw - - *token_sold_amount_raw - - *amount_usd - - *token_bought_address - - *token_sold_address - - *taker - - *maker - - *project_contract_address - - name: pool_symbol - - name: pool_type - - *pool_id - - *swap_fee - - *tx_hash - - *tx_from - - *tx_to - - *evt_index - - - name: balancer_v2_base_pools_fees - meta: - blockchain: base - project: balancer_v2 - contributors: jacektrocinski, thetroyharris, viniabussafi - config: - tags: ['base', 'balancer', 'pools', 'fees'] - description: > - Balancer v2 swap fees stored at the pool level. - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - block_number - - tx_hash - - index - columns: - - name: blockchain - - name: version - - name: contract_address - - name: tx_hash - - name: index - - name: tx_index - - name: block_time - - name: block_number - - name: swap_fee_percentage - - - name: balancer_base_pools_tokens_weights - meta: - blockchain: base - project: balancer - contributors: jacektrocinski, viniabussafi - config: - tags: ['base', 'balancer', 'pools', 'tokens', 'weights'] - description: > - Token weights in Balancer pools. - columns: - - *blockchain - - name: version - - *pool_id - - &token_address - name: token_address - description: 'Contract address for the token' - - &normalized_weight - name: normalized_weight - description: 'Weight of the token in the pool.' - - - name: balancer_v2_base_pools_tokens_weights - meta: - blockchain: base - project: balancer - contributors: jacektrocinski, viniabussafi - config: - tags: ['base', 'balancer', 'pools', 'tokens', 'weights'] - description: > - Token weights in Balancer v2 pools. - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - pool_id - - token_address - columns: - - *blockchain - - name: version - - *pool_id - - *token_address - - *normalized_weight - - - name: balancer_v2_base_liquidity - meta: - blockchain: base - project: balancer_v2 - contributors: victorstefenon, viniabussafi, thetroyharris - config: - tags: ['base', 'balancer', 'pools', 'liquidity'] - description: > - Balancer v2 pools liquidity by token in base. - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - day - - pool_id - - token_address - columns: - - name: day - description: 'UTC event block time truncated to the day mark' - - *pool_id - - name: pool_address - - name: pool_symbol - description: 'Symbol of the pool, consisting of the symbol of its tokens and their respective weights' - - name: version - description: 'Version of Balancer in which pool was deployed' - - name: blockchain - description: 'Blockchain in which pool was deployed' - - *token_address - - name: token_symbol - description: 'Symbol of the token' - - name: token_balance_raw - description: 'Raw balance of the token in the pool' - - name: token_balance - description: 'Scaled balance of the token in the pool' - - name: protocol_liquidity_usd - description: 'Liquidity of the token in the pool in USD, except BPTs' - - name: protocol_liquidity_eth - description: 'Liquidity of the token in the pool in ETH, except BPTs' - - name: pool_liquidity_usd - description: 'Liquidity of the token in the pool in USD, including BPTs' - - name: pool_liquidity_eth - description: 'Liquidity of the token in the pool in ETH, including BPTs' - - - - name: balancer_v2_base_bpt_prices - meta: - blockchain: base - project: balancer_v2 - contributors: victorstefenon, thetroyharris, viniabussafi - config: - tags: ['base', 'bpt', 'prices'] - description: > - Balancer Pool Token (BPT) hourly median price by pool on Balancer, an automated portfolio manager and trading platform. - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - blockchain - - day - - contract_address - columns: - - name: blockchain - - name: day - - name: version - - name: decimals - - name: contract_address - - name: bpt_price - - - name: balancer_v2_base_transfers_bpt - meta: - blockchain: base - project: balancer_v2 - contributors: victorstefenon, thetroyharris, viniabussafi - config: - tags: ['base', 'bpt', 'transfers'] - description: > - Balancer Pool Token (BPT) transfer logs on Balancer, an automated portfolio manager and trading platform, on Base. - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - evt_tx_hash - - evt_index - - block_date - columns: - - name: blockchain - - name: version - - name: contract_address - - name: block_date - - name: block_month - - name: evt_tx_hash - - name: evt_index - - &evt_block_time - name: evt_block_time - description: 'Block time of transfer event' - - &evt_block_number - name: evt_block_number - description: 'Block number of transfer event' - - &from - name: from - description: 'Address of BPT provider of transfer event' - - &to - name: to - description: 'Address of BPT receiver of transfer event' - - &value - name: value - description: 'Amount of BPT transferred in transfer event' - - - name: balancer_v2_base_flashloans - meta: - blockchain: base - sector: lending - contributors: hildobby, viniabussafi - config: - tags: ['base', 'flashloans'] - description: > - All Balancer v2 flashloans on base - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - blockchain - - tx_hash - - evt_index - columns: - - name: blockchain - - name: project - - name: version - - name: block_time - - name: block_number - - name: amount - - name: amount_usd - - name: tx_hash - - name: evt_index - - name: fee - - name: currency_contract - - name: currency_symbol - - name: recipient - - name: contract_address - - name: block_month - - - name: balancer_v2_base_protocol_fee - meta: - blockchain: base - project: balancer_v2 - contributors: viniabussafi - config: - tags: ['base', 'revenue', 'fees'] - description: > - Daily Protocol Fee collected and Revenue by pool on Balancer, an automated portfolio manager and trading platform. - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - day - - pool_id - - token_address - columns: - - name: day - - name: pool_id - - name: pool_address - - name: pool_symbol - - name: version - - name: blockchain - - name: token_address - - name: token_symbol - - name: token_amount_raw - description: "Raw amount of revenues of the token in the pool" - - name: token_amount - description: "Amount of revenues of the token in the pool" - - name: protocol_fee_collected_usd - description: "Fee collected in the pool in USD" - - name: treasury_share - description: "Share of total revenue that is directed to Balancer DAO's treasury, as per BIPs 19, 161 and 371" - - name: treasury_revenue_usd - description: "Total revenue directed to Balancer DAO's treasury" - - - name: balancer_v2_base_bpt_supply - meta: - blockchain: base - project: balancer_v2 - contributors: thetroyharris, viniabussafi - config: - tags: ['base', 'bpt', 'supply'] - description: > - Balancer Pool Token (BPT) supply for ComposableStablePools versions 4 and 5. - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - day - - blockchain - - token_address - columns: - - name: day - - name: pool_type - - name: version - - name: blockchain - - name: token_address - - name: supply \ No newline at end of file diff --git a/models/balancer/ethereum/balancer_ethereum_schema.yml b/models/balancer/ethereum/balancer_ethereum_schema.yml deleted file mode 100644 index d2f899d1c61..00000000000 --- a/models/balancer/ethereum/balancer_ethereum_schema.yml +++ /dev/null @@ -1,665 +0,0 @@ -version: 2 - -models: - - name: balancer_v2_ethereum_pools_fees - meta: - blockchain: ethereum - project: balancer_v2 - contributors: jacektrocinski, thetroyharris, viniabussafi - config: - tags: ['ethereum', 'balancer', 'pools', 'fees'] - description: > - Balancer v2 swap fees stored at the pool level. - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - block_number - - tx_hash - - index - columns: - - name: blockchain - - name: version - - &contract_address - name: contract_address - description: "Ethereum address for the liquidity pool used in transaction" - tests: - - not_null - - &tx_hash - name: tx_hash - description: "Transaction hash" - tests: - - not_null - - &index - name: index - description: "" - tests: - - not_null - - &tx_index - name: tx_index - description: "" - tests: - - not_null - - &block_time - name: block_time - description: "Block time in UTC" - tests: - - not_null - - &block_number - name: block_number - description: "Block number" - tests: - - not_null - - &swap_fee_percentage - name: swap_fee_percentage - description: "Swap fees for the pool, values are returned with 18 decimals (1e18 meaning 100%)" - tests: - - not_null - - - name: balancer_ethereum_balances - meta: - blockchain: ethereum - project: balancer - contributors: jacektrocinski - config: - tags: ['ethereum', 'balancer', 'balances'] - description: > - ERC20 token rolling sum balances on Balancer, an automated portfolio manager and trading platform. - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - day - - pool - - token - columns: - - &day - name: day - description: "UTC event block time truncated to the day mark" - tests: - - not_null - - &pool - name: pool - description: "Balancer pool contract address" - - &token - name: token - description: "Token contract address" - - &cumulative_amount - name: cumulative_amount - description: "Balance of a token" - - - name: balancer_v2_ethereum_transfers_bpt - meta: - blockchain: ethereum - project: balancer_v2 - contributors: victorstefenon, thetroyharris, viniabussafi - config: - tags: ['ethereum', 'bpt', 'transfers'] - description: > - Balancer Pool Token (BPT) transfer logs on Balancer, an automated portfolio manager and trading platform, on Ethereum. - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - evt_tx_hash - - evt_index - - block_date - columns: - - &blockchain - name: blockchain - description: "Blockchain" - - name: version - - *contract_address - - &block_date - name: block_date - description: "UTC event block date" - - &block_month - name: block_month - description: "UTC event block month" - - &evt_tx_hash - name: evt_tx_hash - description: "Transaction hash of transfer event" - - &evt_index - name: evt_index - description: "Event index" - - &evt_block_time - name: evt_block_time - description: "Block time of transfer event" - - &evt_block_number - name: evt_block_number - description: "Block number of transfer event" - - &from - name: from - description: "Address of BPT provider of transfer event" - - &to - name: to - description: "Address of BPT receiver of transfer event" - - &value - name: value - description: "Amount of BPT transferred in transfer event" - - - name: balancer_ethereum_pools_tokens_weights - meta: - blockchain: ethereum - project: balancer - contributors: jacektrocinski, viniabussafi - config: - tags: ['ethereum', 'balancer', 'pools', 'tokens', 'weights'] - description: > - Token weights in Balancer pools. - columns: - - *blockchain - - name: version - - &pool_id - name: pool_id - description: "Unique encoded identifier that refers to each pool" - - &token_address - name: token_address - description: "Contract address for the token" - - &normalized_weight - name: normalized_weight - description: "Weight of the token in the pool." - - - name: balancer_v1_ethereum_pools_tokens_weights - meta: - blockchain: ethereum - project: balancer - contributors: jacektrocinski, viniabussafi - config: - tags: ['ethereum', 'balancer', 'pools', 'tokens', 'weights'] - description: > - Token weights in Balancer v1 pools. - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - pool_id - - token_address - columns: - - *blockchain - - name: version - - *pool_id - - *token_address - - *normalized_weight - - - name: balancer_v2_ethereum_pools_tokens_weights - meta: - blockchain: ethereum - project: balancer - contributors: jacektrocinski, viniabussafi - config: - tags: ['ethereum', 'balancer', 'pools', 'tokens', 'weights'] - description: > - Token weights in Balancer v2 pools. - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - pool_id - - token_address - columns: - - *blockchain - - name: version - - *pool_id - - *token_address - - *normalized_weight - - - name: balancer_ethereum_vebal_balances_day - meta: - blockchain: ethereum - project: balancer - contibutors: markusbkoch, mendesfabio, victorstefenon - config: - tags: ['balancer', 'ethereum', 'vebal', 'day', 'markusbkoch', 'mendesfabio'] - description: > - Daily balances of veBAL per wallet - Depends on veBAL_call_create_lock, veBAL_evt_Deposit and veBAL_evt_Withdraw - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - day - - wallet_address - columns: - - *day - - name: wallet_address - description: "Address of the wallet holding the veBAL" - - name: bpt_balance - description: "Amount of BPT held in the veBAL lock" - - name: vebal_balance - description: "Amount of veBAL" - - name: lock_time - description: "Amount of time the BPT was locked for at the last time the lock was updated" - - - name: balancer_ethereum_vebal_slopes - meta: - blockchain: ethereum - project: balancer - contibutors: markusbkoch, mendesfabio, victorstefenon - config: - tags: ['balancer', 'ethereum', 'vebal', 'slope', 'markusbkoch', 'mendesfabio', 'victorstefenon'] - description: > - Slope and bias of veBAL per wallet after each balance update - Depends on veBAL_call_create_lock, veBAL_evt_Deposit and veBAL_evt_Withdraw - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - block_number - - wallet_address - columns: - - *block_number - - *block_time - - name: block_timestamp - description: "Block timestamp" - - name: wallet_address - description: "Address of the wallet holding the veBAL" - - name: bpt_balance - description: "Amount of BPT held in the veBAL lock" - - name: unlocked_at - description: "Timestamp at which B-80BAL-20WETH BPT can be unlocked" - - name: slope - description: "veBAL decay rate (per second)" - - name: bias - description: "veBAL balance at the moment user locks or re-locks" - - name: block_date - description: "Block time trunc to date" - - - name: balancer_ethereum_trades - meta: - blockchain: ethereum - sector: dex - contributors: bizzyvinci, thetroyharris - config: - tags: ['balancer', 'ethereum', 'amm', 'trades', 'dex'] - description: > - DEX trades on balancer on ethereum - columns: - - *blockchain - - &project - name: project - description: "Project name (balancer)" - - &version - name: version - description: "Version of the project" - - *block_month - - *block_date - - *block_time - - &token_bought_symbol - name: token_bought_symbol - description: "Token symbol for token bought in the trade" - - &token_sold_symbol - name: token_sold_symbol - description: "Token symbol for token sold in the trade" - - &token_pair - name: token_pair - description: "Token symbol pair for each token involved in the trade" - - &token_bought_amount - name: token_bought_amount - description: "Value of the token bought at time of execution in the original currency" - - &token_sold_amount - name: token_sold_amount - description: "Value of the token sold at time of execution in the original currency" - - &token_bought_amount_raw - name: token_bought_amount_raw - description: "Raw value of the token bought at time of execution in the original currency" - - &token_sold_amount_raw - name: token_sold_amount_raw - description: "Raw value of the token sold at time of execution in the original currency" - - &amount_usd - name: amount_usd - description: "USD value of the trade at time of execution" - - &token_bought_address - name: token_bought_address - description: "Contract address of the token bought" - - &token_sold_address - name: token_sold_address - description: "Contract address of the token sold" - - &taker - name: taker - description: "Address of trader who purchased a token" - - &maker - name: maker - description: "Address of trader who sold a token" - - *pool_id - - &swap_fee - name: swap_fee - description: 'Swap fee' - - &project_contract_address - name: project_contract_address - description: "Pool address" - - name: pool_symbol - - name: pool_type - - *tx_hash - - &tx_from - name: tx_from - description: "transaction.from" - - &tx_to - name: tx_to - description: "transaction.to" - - *evt_index - - - name: balancer_v1_ethereum_trades - meta: - blockchain: ethereum - sector: dex - contributors: bizzyvinci, thetroyharris, viniabussafi - config: - tags: [ 'balancer', 'ethereum', 'amm', 'trades', 'dex' ] - description: > - DEX trades on balancer v1 on ethereum - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - block_time - - tx_hash - - evt_index - - check_dex_seed: - blockchain: ethereum - project: balancer - version: 1 - columns: - - *blockchain - - *project - - *version - - *block_month - - *block_date - - *block_time - - *token_bought_symbol - - *token_sold_symbol - - *token_pair - - *token_bought_amount - - *token_sold_amount - - *token_bought_amount_raw - - *token_sold_amount_raw - - *amount_usd - - *token_bought_address - - *token_sold_address - - *taker - - *maker - - *pool_id - - *swap_fee - - *project_contract_address - - name: pool_symbol - - name: pool_type - - *tx_hash - - *tx_from - - *tx_to - - *evt_index - - - name: balancer_v2_ethereum_trades - meta: - blockchain: ethereum - sector: dex - contributors: bizzyvinci, thetroyharris, tomfutago, viniabussafi - config: - tags: [ 'balancer', 'ethereum', 'amm', 'trades', 'dex', 'beta' ] - description: > - DEX trades on balancer v2 on ethereum - columns: - - *blockchain - - *project - - *version - - *block_month - - *block_date - - *block_time - - *block_number - - *token_bought_symbol - - *token_sold_symbol - - *token_pair - - *token_bought_amount - - *token_sold_amount - - *token_bought_amount_raw - - *token_sold_amount_raw - - *amount_usd - - *token_bought_address - - *token_sold_address - - *taker - - *maker - - *project_contract_address - - name: pool_symbol - - name: pool_type - - *pool_id - - *swap_fee - - *tx_hash - - *tx_from - - *tx_to - - *evt_index - - - name: balancer_v2_ethereum_liquidity - meta: - blockchain: ethereum - project: balancer_v2 - contributors: victorstefenon, viniabussafi, thetroyharris - config: - tags: ['ethereum', 'balancer', 'pools', 'liquidity'] - description: > - Balancer v2 pools liquidity by token in Ethereum. - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - day - - pool_id - - token_address - columns: - - name: day - description: 'UTC event block time truncated to the day mark' - - *pool_id - - name: pool_address - - name: pool_symbol - description: 'Symbol of the pool, consisting of the symbol of its tokens and their respective weights' - - name: version - description: 'Version of Balancer in which pool was deployed' - - name: blockchain - description: 'Blockchain in which pool was deployed' - - *token_address - - name: token_symbol - description: 'Symbol of the token' - - name: token_balance_raw - description: 'Raw balance of the token in the pool' - - name: token_balance - description: 'Scaled balance of the token in the pool' - - name: protocol_liquidity_usd - description: 'Liquidity of the token in the pool in USD, except BPTs' - - name: protocol_liquidity_eth - description: 'Liquidity of the token in the pool in ETH, except BPTs' - - name: pool_liquidity_usd - description: 'Liquidity of the token in the pool in USD, including BPTs' - - name: pool_liquidity_eth - description: 'Liquidity of the token in the pool in ETH, including BPTs' - - - name: balancer_ethereum_vebal_votes - meta: - blockchain: ethereum - project: balancer - contibutors: markusbkoch, mendesfabio, stefenon - config: - tags: ['balancer', 'ethereum', 'vebal', 'votes', 'markusbkoch', 'mendesfabio', 'stefenon'] - description: > - Records of votes for Balancer gauges by provider at each voting round - Depends on GaugeController_evt_VoteForGauge and the vebal_slopes spell - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - round_id - - gauge - - provider - columns: - - name: round_id - description: "ID of the voting round" - - name: start_date - description: "Day of the voting round start date" - - name: end_date - description: "Day of the voting round end date" - - name: gauge - description: "Address of the gauge which provider votes for" - - name: provider - description: "Address of the wallet which voted for the gauge" - - name: vote - description: "Weight of the vote performed by the provider for the gauge" - - - name: balancer_v2_ethereum_lbps - meta: - blockchain: ethereum - project: balancer_v2 - contributors: stefenon - config: - tags: ['ethereum', 'balancer', 'lbp'] - description: > - Record of the Liquidity Boostrapping Pools (LBP) of Balancer, an automated portfolio manager and trading platform, on Ethereum. - columns: - - name: name - description: "Name of the LBP" - - name: pool_id - description: "ID of the LBP" - - name: token_sold - description: "Contract address of the token sold by the LBP" - - name: token_symbol - description: "Symbol of the token sold by the LBP" - - name: start_time - description: "LBP start time" - - name: end_time - description: "LBP end time" - - - name: balancer_v1_ethereum_liquidity - meta: - blockchain: ethereum - project: balancer_v1 - contributors: markusbkoch, mendesfabio, victorstefenon, viniabussafi, thetroyharris - config: - tags: ['ethereum', 'balancer', 'pools', 'liquidity'] - description: > - Balancer v1 pools liquidity by token in Ethereum. - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - day - - pool_id - - token_address - columns: - - name: day - description: "UTC event block time truncated to the day mark" - - *pool_id - - name: pool_address - - name: pool_symbol - description: "Symbol of the pool, consisting of the symbol of its tokens and their respective weights" - - name: version - description: "Version of Balancer in which pool was deployed" - - *blockchain - - *token_address - - name: token_symbol - description: "Symbol of the token" - - name: token_balance_raw - description: "Raw balance of the token in the pool" - - name: token_balance - description: "Scaled balance of the token in the pool" - - name: protocol_liquidity_usd - description: "Liquidity of the token in the pool in USD, except BPTs" - - name: pool_liquidity_usd - description: "Liquidity of the token in the pool in USD, including BPTs" - - - name: balancer_v2_ethereum_flashloans - meta: - blockchain: ethereum - sector: lending - contributors: hildobby - config: - tags: ['ethereum', 'flashloans'] - description: > - All Balancer flashloans on Ethereum - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - blockchain - - tx_hash - - evt_index - columns: - - name: blockchain - - name: project - - name: version - - name: block_time - - name: block_number - - name: amount - - name: amount_usd - - name: tx_hash - - name: evt_index - - name: fee - - name: currency_contract - - name: currency_symbol - - name: recipient - - name: contract_address - - name: block_month - - - name: balancer_v2_ethereum_bpt_prices - meta: - blockchain: ethereum - project: balancer_v2 - contributors: victorstefenon, thetroyharris, viniabussafi - config: - tags: ['ethereum', 'bpt', 'prices'] - description: > - Balancer Pool Token (BPT) hourly median price by pool on Balancer, an automated portfolio manager and trading platform. - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - blockchain - - day - - contract_address - columns: - - name: blockchain - - name: day - - name: version - - name: decimals - - name: contract_address - - name: bpt_price - - - name: balancer_v2_ethereum_protocol_fee - meta: - blockchain: ethereum - project: balancer_v2 - contributors: viniabussafi - config: - tags: ['ethereum', 'revenue', 'fees'] - description: > - Daily Protocol Fee collected and Revenue by pool on Balancer, an automated portfolio manager and trading platform. - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - day - - pool_id - - token_address - columns: - - name: day - - name: pool_id - - name: pool_address - - name: pool_symbol - - name: version - - name: blockchain - - name: token_address - - name: token_symbol - - name: token_amount_raw - description: "Raw amount of revenues of the token in the pool" - - name: token_amount - description: "Amount of revenues of the token in the pool" - - name: protocol_fee_collected_usd - description: "Fee collected in the pool in USD" - - name: treasury_share - description: "Share of total revenue that is directed to Balancer DAO's treasury, as per BIPs 19, 161 and 371" - - name: treasury_revenue_usd - description: "Total revenue directed to Balancer DAO's treasury" - - - name: balancer_v2_ethereum_bpt_supply - meta: - blockchain: ethereum - project: balancer_v2 - contributors: thetroyharris, viniabussafi - config: - tags: ['ethereum', 'bpt', 'supply'] - description: > - Balancer Pool Token (BPT) supply for ComposableStablePools versions 4 and 5. - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - day - - blockchain - - token_address - columns: - - name: day - - name: pool_type - - name: version - - name: blockchain - - name: token_address - - name: supply \ No newline at end of file diff --git a/models/balancer/gnosis/balancer_gnosis_schema.yml b/models/balancer/gnosis/balancer_gnosis_schema.yml deleted file mode 100644 index a9ef89846ef..00000000000 --- a/models/balancer/gnosis/balancer_gnosis_schema.yml +++ /dev/null @@ -1,404 +0,0 @@ -version: 2 - -models: - - name: balancer_gnosis_trades - meta: - blockchain: gnosis - sector: dex - contributors: bizzyvinci - config: - tags: ['balancer', 'gnosis', 'amm', 'trades', 'dex'] - description: > - DEX trades on balancer on gnosis - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - block_date - - blockchain - - project - - version - - tx_hash - - evt_index - - check_dex_seed: - blockchain: gnosis - project: balancer - version: 2 - columns: - - &blockchain - name: blockchain - description: "Blockchain" - - &project - name: project - description: "Project name (balancer)" - - &version - name: version - description: "Version of the project" - - &block_month - name: block_month - description: "Block month in UTC" - - &block_date - name: block_date - description: "Block date in UTC" - - &block_time - name: block_time - description: 'Block time in UTC' - - &token_bought_symbol - name: token_bought_symbol - description: "Token symbol for token bought in the trade" - - &token_sold_symbol - name: token_sold_symbol - description: "Token symbol for token sold in the trade" - - &token_pair - name: token_pair - description: "Token symbol pair for each token involved in the trade" - - &token_bought_amount - name: token_bought_amount - description: "Value of the token bought at time of execution in the original currency" - - &token_sold_amount - name: token_sold_amount - description: "Value of the token sold at time of execution in the original currency" - - &token_bought_amount_raw - name: token_bought_amount_raw - description: "Raw value of the token bought at time of execution in the original currency" - - &token_sold_amount_raw - name: token_sold_amount_raw - description: "Raw value of the token sold at time of execution in the original currency" - - &amount_usd - name: amount_usd - description: "USD value of the trade at time of execution" - - &token_bought_address - name: token_bought_address - description: "Contract address of the token bought" - - &token_sold_address - name: token_sold_address - description: "Contract address of the token sold" - - &taker - name: taker - description: "Address of trader who purchased a token" - - &maker - name: maker - description: "Address of trader who sold a token" - - &pool_id - name: pool_id - description: 'Unique encoded identifier that refers to each pool' - - &swap_fee - name: swap_fee - description: 'Swap fee' - - &project_contract_address - name: project_contract_address - description: "Pool address" - - name: pool_symbol - - name: pool_type - - &tx_hash - name: tx_hash - description: "Transaction hash" - - &tx_from - name: tx_from - description: "transaction.from" - - &tx_to - name: tx_to - description: "transaction.to" - - &evt_index - name: evt_index - description: "Event index" - - - name: balancer_v2_gnosis_flashloans - meta: - blockchain: gnosis - sector: lending - contributors: hildobby - config: - tags: ['gnosis', 'flashloans'] - description: > - All Balancer flashloans on Gnosis - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - blockchain - - tx_hash - - evt_index - columns: - - name: blockchain - - name: project - - name: version - - name: block_time - - name: block_number - - name: amount - - name: amount_usd - - name: tx_hash - - name: evt_index - - name: fee - - name: currency_contract - - name: currency_symbol - - name: recipient - - name: contract_address - - name: block_month - - - name: balancer_v2_gnosis_bpt_prices - meta: - blockchain: gnosis - project: balancer_v2 - contributors: thetroyharris, viniabussafi - config: - tags: ['gnosis', 'bpt', 'prices'] - description: > - Balancer Pool Token (BPT) hourly median price by pool on Balancer, an automated portfolio manager and trading platform. - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - blockchain - - day - - contract_address - columns: - - name: blockchain - - name: day - - name: version - - name: decimals - - name: contract_address - - name: bpt_price - - - name: balancer_v2_gnosis_pools_fees - meta: - blockchain: gnosis - project: balancer_v2 - contributors: jacektrocinski, thetroyharris, viniabussafi - config: - tags: ['gnosis', 'balancer', 'pools_fees'] - description: > - Balancer v2 swap fees stored at the pool level. - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - block_number - - tx_hash - - index - columns: - - name: blockchain - - name: version - - name: contract_address - - name: tx_hash - - name: index - - name: tx_index - - name: block_time - - name: block_number - - name: swap_fee_percentage - - - name: balancer_v2_gnosis_trades - meta: - blockchain: gnosis - sector: dex - contributors: bizzyvinci, thetroyharris, tomfutago, viniabussafi - config: - tags: [ 'balancer', 'gnosis', 'amm', 'trades', 'dex', 'beta' ] - description: > - DEX trades on balancer v2 on gnosis - columns: - - *blockchain - - *project - - *version - - *block_month - - *block_date - - *block_time - - name: block_number - - *token_bought_symbol - - *token_sold_symbol - - *token_pair - - *token_bought_amount - - *token_sold_amount - - *token_bought_amount_raw - - *token_sold_amount_raw - - *amount_usd - - *token_bought_address - - *token_sold_address - - *taker - - *maker - - *project_contract_address - - name: pool_symbol - - name: pool_type - - *pool_id - - *swap_fee - - *tx_hash - - *tx_from - - *tx_to - - *evt_index - - - name: balancer_v2_gnosis_liquidity - meta: - blockchain: gnosis - project: balancer_v2 - contributors: victorstefenon, viniabussafi, thetroyharris - config: - tags: ['gnosis', 'balancer', 'pools', 'liquidity'] - description: > - Balancer v2 pools liquidity by token in Gnosis. - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - day - - pool_id - - token_address - columns: - - name: day - description: 'UTC event block time truncated to the day mark' - - *pool_id - - name: pool_address - - name: pool_symbol - description: 'Symbol of the pool, consisting of the symbol of its tokens and their respective weights' - - name: version - description: 'Version of Balancer in which pool was deployed' - - name: blockchain - description: 'Blockchain in which pool was deployed' - - name: token_address - - name: token_symbol - description: 'Symbol of the token' - - name: token_balance_raw - description: 'Raw balance of the token in the pool' - - name: token_balance - description: 'Scaled balance of the token in the pool' - - name: protocol_liquidity_usd - description: 'Liquidity of the token in the pool in USD, except BPTs' - - name: protocol_liquidity_eth - description: 'Liquidity of the token in the pool in ETH, except BPTs' - - name: pool_liquidity_usd - description: 'Liquidity of the token in the pool in USD, including BPTs' - - name: pool_liquidity_eth - description: 'Liquidity of the token in the pool in ETH, including BPTs' - - - - name: balancer_gnosis_pools_tokens_weights - meta: - blockchain: gnosis - project: balancer - contributors: jacektrocinski, viniabussafi - config: - tags: ['gnosis', 'balancer', 'pools', 'tokens', 'weights'] - description: > - Token weights in Balancer pools. - columns: - - *blockchain - - name: version - - *pool_id - - &token_address - name: token_address - description: 'Contract address for the token' - - &normalized_weight - name: normalized_weight - description: 'Weight of the token in the pool.' - - - name: balancer_v2_gnosis_pools_tokens_weights - meta: - blockchain: gnosis - project: balancer - contributors: metacrypto, jacektrocinski, viniabussafi - config: - tags: ['gnosis', 'balancer', 'pools', 'tokens', 'weights'] - description: > - Token weights in Balancer v2 pools. - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - pool_id - - token_address - columns: - - *blockchain - - name: version - - *pool_id - - *token_address - - *normalized_weight - - - name: balancer_v2_gnosis_transfers_bpt - meta: - blockchain: gnosis - project: balancer_v2 - contributors: victorstefenon, thetroyharris, viniabussafi - config: - tags: ['gnosis', 'bpt', 'transfers'] - description: > - Balancer Pool Token (BPT) transfer logs on Balancer, an automated portfolio manager and trading platform, on Gnosis. - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - evt_tx_hash - - evt_index - - block_date - columns: - - name: blockchain - - name: version - - name: contract_address - - name: block_date - - name: block_month - - name: evt_tx_hash - - name: evt_index - - &evt_block_time - name: evt_block_time - description: 'Block time of transfer event' - - &evt_block_number - name: evt_block_number - description: 'Block number of transfer event' - - &from - name: from - description: 'Address of BPT provider of transfer event' - - &to - name: to - description: 'Address of BPT receiver of transfer event' - - &value - name: value - description: 'Amount of BPT transferred in transfer event' - - - name: balancer_v2_gnosis_protocol_fee - meta: - blockchain: gnosis - project: balancer_v2 - contributors: viniabussafi - config: - tags: ['gnosis', 'revenue', 'fees'] - description: > - Daily Protocol Fee collected and Revenue by pool on Balancer, an automated portfolio manager and trading platform. - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - day - - pool_id - - token_address - columns: - - name: day - - name: pool_id - - name: pool_address - - name: pool_symbol - - name: version - - name: blockchain - - name: token_address - - name: token_symbol - - name: token_amount_raw - description: "Raw amount of revenues of the token in the pool" - - name: token_amount - description: "Amount of revenues of the token in the pool" - - name: protocol_fee_collected_usd - description: "Fee collected in the pool in USD" - - name: treasury_share - description: "Share of total revenue that is directed to Balancer DAO's treasury, as per BIPs 19, 161 and 371" - - name: treasury_revenue - description: "Total revenue directed to Balancer DAO's treasury" - - - name: balancer_v2_gnosis_bpt_supply - meta: - blockchain: gnosis - project: balancer_v2 - contributors: thetroyharris, viniabussafi - config: - tags: ['gnosis', 'bpt', 'supply'] - description: > - Balancer Pool Token (BPT) supply for ComposableStablePools versions 4 and 5. - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - day - - blockchain - - token_address - columns: - - name: day - - name: pool_type - - name: version - - name: blockchain - - name: token_address - - name: supply \ No newline at end of file diff --git a/models/balancer/optimism/balancer_optimism_schema.yml b/models/balancer/optimism/balancer_optimism_schema.yml deleted file mode 100644 index bb4c52fbe0e..00000000000 --- a/models/balancer/optimism/balancer_optimism_schema.yml +++ /dev/null @@ -1,464 +0,0 @@ -version: 2 - -models: - - name: balancer_v2_optimism_pools_fees - meta: - blockchain: optimism - project: balancer_v2 - contributors: jacektrocinski, thetroyharris, viniabussafi - config: - tags: ['optimism', 'balancer', 'pools_fees'] - description: > - Balancer v2 swap fees stored at the pool level. - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - block_number - - tx_hash - - index - columns: - - name: blockchain - - name: version - - &contract_address - name: contract_address - description: 'Optimism address for the liquidity pool used in transaction' - tests: - - not_null - - &tx_hash - name: tx_hash - description: 'Transaction hash' - tests: - - not_null - - &index - name: index - description: '' - tests: - - not_null - - &tx_index - name: tx_index - description: '' - tests: - - not_null - - &block_time - name: block_time - description: 'Block time in UTC' - tests: - - not_null - - &block_number - name: block_number - description: 'Block number' - tests: - - not_null - - &swap_fee_percentage - name: swap_fee_percentage - description: 'Swap fees for the pool, values are returned with 18 decimals (1e18 meaning 100%)' - tests: - - not_null - - - name: balancer_v2_optimism_transfers_bpt - meta: - blockchain: optimism - project: balancer_v2 - contributors: victorstefenon, thetroyharris, viniabussafi - config: - tags: ['optimism', 'bpt', 'transfers'] - description: > - Balancer Pool Token (BPT) transfer logs on Balancer, an automated portfolio manager and trading platform, on Optimism. - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - evt_tx_hash - - evt_index - - block_date - columns: - - &blockchain - name: blockchain - description: "Blockchain" - - name: version - - *contract_address - - &block_date - name: block_date - description: "UTC event block date of each DEX trade" - - &block_month - name: block_month - description: "UTC event block month of each DEX trade" - - &evt_tx_hash - name: evt_tx_hash - description: 'Transaction hash of transfer event' - - &evt_index - name: evt_index - description: 'Event index' - - &evt_block_time - name: evt_block_time - description: 'Block time of transfer event' - - &evt_block_number - name: evt_block_number - description: 'Block number of transfer event' - - &from - name: from - description: 'Address of BPT provider of transfer event' - - &to - name: to - description: 'Address of BPT receiver of transfer event' - - &value - name: value - description: 'Amount of BPT transferred in transfer event' - - - name: balancer_optimism_pools_tokens_weights - meta: - blockchain: optimism - project: balancer - contributors: jacektrocinski, viniabussafi - config: - tags: ['optimism', 'balancer', 'pools', 'tokens', 'weights'] - description: > - Token weights in Balancer pools. - columns: - - *blockchain - - name: version - - &pool_id - name: pool_id - description: 'Unique encoded identifier that refers to each pool' - tests: - - not_null - - &token_address - name: token_address - description: 'Contract address for the token' - - &normalized_weight - name: normalized_weight - description: 'Weight of the token in the pool.' - - - name: balancer_v2_optimism_pools_tokens_weights - meta: - blockchain: optimism - project: balancer - contributors: jacektrocinski, viniabussafi - config: - tags: ['optimism', 'balancer', 'pools', 'tokens', 'weights'] - description: > - Token weights in Balancer v2 pools. - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - pool_id - - token_address - columns: - - *blockchain - - name: version - - *pool_id - - *token_address - - *normalized_weight - - - name: balancer_optimism_trades - meta: - blockchain: optimism - sector: dex - contributors: bizzyvinci - config: - tags: ['balancer', 'optimism', 'amm', 'trades', 'dex'] - description: > - DEX trades on balancer on optimism - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - block_date - - blockchain - - project - - version - - tx_hash - - evt_index - - check_dex_seed: - blockchain: optimism - project: balancer - version: 2 - columns: - - *blockchain - - &project - name: project - description: "Project name (balancer)" - - &version - name: version - description: "Version of the project" - - *block_month - - *block_date - - *block_time - - &token_bought_symbol - name: token_bought_symbol - description: "Token symbol for token bought in the trade" - - &token_sold_symbol - name: token_sold_symbol - description: "Token symbol for token sold in the trade" - - &token_pair - name: token_pair - description: "Token symbol pair for each token involved in the trade" - - &token_bought_amount - name: token_bought_amount - description: "Value of the token bought at time of execution in the original currency" - - &token_sold_amount - name: token_sold_amount - description: "Value of the token sold at time of execution in the original currency" - - &token_bought_amount_raw - name: token_bought_amount_raw - description: "Raw value of the token bought at time of execution in the original currency" - - &token_sold_amount_raw - name: token_sold_amount_raw - description: "Raw value of the token sold at time of execution in the original currency" - - &amount_usd - name: amount_usd - description: "USD value of the trade at time of execution" - - &token_bought_address - name: token_bought_address - description: "Contract address of the token bought" - - &token_sold_address - name: token_sold_address - description: "Contract address of the token sold" - - &taker - name: taker - description: "Address of trader who purchased a token" - - &maker - name: maker - description: "Address of trader who sold a token" - - *pool_id - - &swap_fee - name: swap_fee - description: 'Swap fee' - - &project_contract_address - name: project_contract_address - description: "Pool address" - - name: pool_symbol - - name: pool_type - - *tx_hash - - &tx_from - name: tx_from - description: "transaction.from" - - &tx_to - name: tx_to - description: "transaction.to" - - *evt_index - - - name: balancer_v2_optimism_liquidity - meta: - blockchain: optimism - project: balancer_v2 - contributors: victorstefenon, viniabussafi, thetroyharris - config: - tags: ['optimism', 'balancer', 'pools', 'liquidity'] - description: > - Balancer v2 pools liquidity by token in Optimism. - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - day - - pool_id - - token_address - columns: - - name: day - description: 'UTC event block time truncated to the day mark' - - *pool_id - - name: pool_address - - name: pool_symbol - description: 'Symbol of the pool, consisting of the symbol of its tokens and their respective weights' - - name: version - description: 'Version of Balancer in which pool was deployed' - - name: blockchain - description: 'Blockchain in which pool was deployed' - - *token_address - - name: token_symbol - description: 'Symbol of the token' - - name: token_balance_raw - description: 'Raw balance of the token in the pool' - - name: token_balance - description: 'Scaled balance of the token in the pool' - - name: protocol_liquidity_usd - description: 'Liquidity of the token in the pool in USD, except BPTs' - - name: protocol_liquidity_eth - description: 'Liquidity of the token in the pool in ETH, except BPTs' - - name: pool_liquidity_usd - description: 'Liquidity of the token in the pool in USD, including BPTs' - - name: pool_liquidity_eth - description: 'Liquidity of the token in the pool in ETH, including BPTs' - - - name: balancer_optimism_gauge_mappings - meta: - blockchain: optimism - project: balancer - contributors: msilb7 - config: - tags: ['optimism', 'balancer', 'gauges', 'incentives'] - description: > - Balancer gauge to pool mappings on Optimism. - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - pool_contract - - incentives_contract - columns: - - *blockchain - - *version - - &pool_contract - name: pool_contract - description: "Address of the liquidity pool contract" - - *pool_id - - &incentives_contract - name: incentives_contract - description: "Address of the contract where incentives are stored and emitted." - - &incentives_type - name: incentives_type - description: "Description of the incentives address type." - - *evt_block_time - - *evt_block_number - - *contract_address - - *evt_tx_hash - - *evt_index - - - name: balancer_v2_optimism_flashloans - meta: - blockchain: optimism - sector: lending - contributors: hildobby - config: - tags: ['optimism', 'flashloans'] - description: > - All Balancer flashloans on Optimism - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - blockchain - - tx_hash - - evt_index - columns: - - name: blockchain - - name: project - - name: version - - name: block_time - - name: block_number - - name: amount - - name: amount_usd - - name: tx_hash - - name: evt_index - - name: fee - - name: currency_contract - - name: currency_symbol - - name: recipient - - name: contract_address - - name: block_month - - - name: balancer_v2_optimism_bpt_prices - meta: - blockchain: optimism - project: balancer_v2 - contributors: victorstefenon, thetroyharris, viniabussafi - config: - tags: ['optimism', 'bpt', 'prices'] - description: > - Balancer Pool Token (BPT) hourly median price by pool on Balancer, an automated portfolio manager and trading platform. - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - blockchain - - day - - contract_address - columns: - - name: blockchain - - name: day - - name: version - - name: decimals - - name: contract_address - - name: bpt_price - - - name: balancer_v2_optimism_trades - meta: - blockchain: optimism - sector: dex - contributors: bizzyvinci, thetroyharris, tomfutago, viniabussafi - config: - tags: [ 'balancer', 'optimism', 'amm', 'trades', 'dex', 'beta' ] - description: > - DEX trades on balancer v2 on optimism - columns: - - *blockchain - - *project - - *version - - *block_month - - *block_date - - *block_time - - name: block_number - - *token_bought_symbol - - *token_sold_symbol - - *token_pair - - *token_bought_amount - - *token_sold_amount - - *token_bought_amount_raw - - *token_sold_amount_raw - - *amount_usd - - *token_bought_address - - *token_sold_address - - *taker - - *maker - - *project_contract_address - - name: pool_symbol - - name: pool_type - - *pool_id - - *swap_fee - - *tx_hash - - *tx_from - - *tx_to - - *evt_index - - - name: balancer_v2_optimism_protocol_fee - meta: - blockchain: optimism - project: balancer_v2 - contributors: viniabussafi - config: - tags: ['optimism', 'revenue', 'fees'] - description: > - Daily Protocol Fee collected and Revenue by pool on Balancer, an automated portfolio manager and trading platform. - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - day - - pool_id - - token_address - columns: - - name: day - - name: pool_id - - name: pool_address - - name: pool_symbol - - name: version - - name: blockchain - - name: token_address - - name: token_symbol - - name: token_amount_raw - description: "Raw amount of revenues of the token in the pool" - - name: token_amount - description: "Amount of revenues of the token in the pool" - - name: protocol_fee_collected_usd - description: "Fee collected in the pool in USD" - - name: treasury_share - description: "Share of total revenue that is directed to Balancer DAO's treasury, as per BIPs 19, 161 and 371" - - name: treasury_revenue_usd - description: "Total revenue directed to Balancer DAO's treasury" - - - name: balancer_v2_optimism_bpt_supply - meta: - blockchain: optimism - project: balancer_v2 - contributors: thetroyharris, viniabussafi - config: - tags: ['optimism', 'bpt', 'supply'] - description: > - Balancer Pool Token (BPT) supply for ComposableStablePools versions 4 and 5. - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - day - - blockchain - - token_address - columns: - - name: day - - name: pool_type - - name: version - - name: blockchain - - name: token_address - - name: supply \ No newline at end of file diff --git a/models/balancer/polygon/balancer_polygon_schema.yml b/models/balancer/polygon/balancer_polygon_schema.yml deleted file mode 100644 index 4f2bbd24412..00000000000 --- a/models/balancer/polygon/balancer_polygon_schema.yml +++ /dev/null @@ -1,454 +0,0 @@ -version: 2 - -models: - - name: balancer_v2_polygon_pools_fees - meta: - blockchain: polygon - project: balancer_v2 - contributors: jacektrocinski, thetroyharris, viniabussafi - config: - tags: ['polygon', 'balancer', 'pools_fees'] - description: > - Balancer v2 swap fees stored at the pool level. - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - block_number - - tx_hash - - index - columns: - - name: blockchain - - name: version - - &contract_address - name: contract_address - description: 'Polygon address for the liquidity pool used in transaction' - tests: - - not_null - - &tx_hash - name: tx_hash - description: 'Transaction hash' - tests: - - not_null - - &index - name: index - description: '' - tests: - - not_null - - &tx_index - name: tx_index - description: '' - tests: - - not_null - - &block_time - name: block_time - description: '' - tests: - - not_null - - &block_number - name: block_number - description: 'Block number' - tests: - - not_null - - &swap_fee_percentage - name: swap_fee_percentage - description: 'Swap fees for the pool, values are returned with 18 decimals (1e18 meaning 100%)' - tests: - - not_null - - - name: balancer_v2_polygon_transfers_bpt - meta: - blockchain: polygon - project: balancer_v2 - contributors: victorstefenon, thetroyharris, viniabussafi - config: - tags: ['polygon', 'bpt', 'transfers'] - description: > - Balancer Pool Token (BPT) transfer logs on Balancer, an automated portfolio manager and trading platform, on Polygon. - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - evt_tx_hash - - evt_index - - block_date - columns: - - &blockchain - name: blockchain - description: "Blockchain" - - name: version - - *contract_address - - &block_date - name: block_date - description: "UTC event block date of each DEX trade" - - &block_month - name: block_month - description: "UTC event block month of each DEX trade" - - &evt_tx_hash - name: evt_tx_hash - description: 'Transaction hash of transfer event' - - &evt_index - name: evt_index - description: 'Event index' - - &evt_block_time - name: evt_block_time - description: 'Block time of transfer event' - - &evt_block_number - name: evt_block_number - description: 'Block number of transfer event' - - &from - name: from - description: 'Address of BPT provider of transfer event' - - &to - name: to - description: 'Address of BPT receiver of transfer event' - - &value - name: value - description: 'Amount of BPT transferred in transfer event' - - - name: balancer_polygon_pools_tokens_weights - meta: - blockchain: polygon - project: balancer - contributors: jacektrocinski, viniabussafi - config: - tags: ['polygon', 'balancer', 'pools', 'tokens', 'weights'] - description: > - Token weights in Balancer pools. - columns: - - *blockchain - - name: version - - &pool_id - name: pool_id - description: 'Unique encoded identifier that refers to each pool' - tests: - - not_null - - &token_address - name: token_address - description: 'Contract address for the token' - - &normalized_weight - name: normalized_weight - description: 'Weight of the token in the pool.' - - - name: balancer_v2_polygon_pools_tokens_weights - meta: - blockchain: polygon - project: balancer - contributors: jacektrocinski, viniabussafi - config: - tags: ['polygon', 'balancer', 'pools', 'tokens', 'weights'] - description: > - Token weights in Balancer v2 pools. - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - pool_id - - token_address - columns: - - *blockchain - - name: version - - *pool_id - - *token_address - - *normalized_weight - - - name: balancer_polygon_trades - meta: - blockchain: polygon - sector: dex - contributors: bizzyvinci - config: - tags: ['balancer', 'polygon', 'amm', 'trades', 'dex'] - description: > - DEX trades on balancer on polygon - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - block_date - - blockchain - - project - - version - - tx_hash - - evt_index - - check_dex_seed: - blockchain: polygon - project: balancer - version: 2 - columns: - - *blockchain - - &project - name: project - description: "Project name (balancer)" - - &version - name: version - description: "Version of the project" - - *block_month - - *block_date - - *block_time - - &token_bought_symbol - name: token_bought_symbol - description: "Token symbol for token bought in the trade" - - &token_sold_symbol - name: token_sold_symbol - description: "Token symbol for token sold in the trade" - - &token_pair - name: token_pair - description: "Token symbol pair for each token involved in the trade" - - &token_bought_amount - name: token_bought_amount - description: "Value of the token bought at time of execution in the original currency" - - &token_sold_amount - name: token_sold_amount - description: "Value of the token sold at time of execution in the original currency" - - &token_bought_amount_raw - name: token_bought_amount_raw - description: "Raw value of the token bought at time of execution in the original currency" - - &token_sold_amount_raw - name: token_sold_amount_raw - description: "Raw value of the token sold at time of execution in the original currency" - - &amount_usd - name: amount_usd - description: "USD value of the trade at time of execution" - - &token_bought_address - name: token_bought_address - description: "Contract address of the token bought" - - &token_sold_address - name: token_sold_address - description: "Contract address of the token sold" - - &taker - name: taker - description: "Address of trader who purchased a token" - - &maker - name: maker - description: "Address of trader who sold a token" - - *pool_id - - &swap_fee - name: swap_fee - description: 'Swap fee' - - &project_contract_address - name: project_contract_address - description: "Pool address" - - name: pool_symbol - - name: pool_type - - *tx_hash - - &tx_from - name: tx_from - description: "transaction.from" - - &tx_to - name: tx_to - description: "transaction.to" - - *evt_index - - - name: balancer_v2_polygon_liquidity - meta: - blockchain: polygon - project: balancer_v2 - contributors: victorstefenon, viniabussafi, thetroyharris - config: - tags: ['polygon', 'balancer', 'pools', 'liquidity'] - description: > - Balancer v2 pools liquidity by token in Polygon. - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - day - - pool_id - - token_address - columns: - - name: day - description: 'UTC event block time truncated to the day mark' - - *pool_id - - name: pool_address - - name: pool_symbol - description: 'Symbol of the pool, consisting of the symbol of its tokens and their respective weights' - - name: version - description: 'Version of Balancer in which pool was deployed' - - name: blockchain - description: 'Blockchain in which pool was deployed' - - *token_address - - name: token_symbol - description: 'Symbol of the token' - - name: token_balance_raw - description: 'Raw balance of the token in the pool' - - name: token_balance - description: 'Scaled balance of the token in the pool' - - name: protocol_liquidity_usd - description: 'Liquidity of the token in the pool in USD, except BPTs' - - name: protocol_liquidity_eth - description: 'Liquidity of the token in the pool in ETH, except BPTs' - - name: pool_liquidity_usd - description: 'Liquidity of the token in the pool in USD, including BPTs' - - name: pool_liquidity_eth - description: 'Liquidity of the token in the pool in ETH, including BPTs' - - - name: balancer_v2_polygon_lbps - meta: - blockchain: polygon - project: balancer_v2 - contributors: stefenon - config: - tags: ['polygon', 'balancer', 'lbp'] - description: > - Record of the Liquidity Boostrapping Pools (LBP) of Balancer, an automated portfolio manager and trading platform, on Polygon. - columns: - - name: name - description: 'Name of the LBP' - - name: pool_id - description: 'ID of the LBP' - - name: token_sold - description: 'Contract address of the token sold by the LBP' - - name: token_symbol - description: 'Symbol of the token sold by the LBP' - - name: start_time - description: 'LBP start time' - - name: end_time - description: 'LBP end time' - - - name: balancer_v2_polygon_flashloans - meta: - blockchain: polygon - sector: lending - contributors: hildobby - config: - tags: ['polygon', 'flashloans'] - description: > - All Balancer flashloans on Polygon - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - blockchain - - tx_hash - - evt_index - columns: - - name: blockchain - - name: project - - name: version - - name: block_time - - name: block_number - - name: amount - - name: amount_usd - - name: tx_hash - - name: evt_index - - name: fee - - name: currency_contract - - name: currency_symbol - - name: recipient - - name: contract_address - - name: block_month - - - name: balancer_v2_polygon_bpt_prices - meta: - blockchain: polygon - project: balancer_v2 - contributors: victorstefenon, thetroyharris, viniabussafi - config: - tags: ['polygon', 'bpt', 'prices'] - description: > - Balancer Pool Token (BPT) hourly median price by pool on Balancer, an automated portfolio manager and trading platform. - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - blockchain - - day - - contract_address - columns: - - name: blockchain - - name: day - - name: version - - name: decimals - - name: contract_address - - name: bpt_price - - - name: balancer_v2_polygon_trades - meta: - blockchain: polygon - sector: dex - contributors: bizzyvinci, thetroyharris, tomfutago, viniabussafi - config: - tags: [ 'balancer', 'polygon', 'amm', 'trades', 'dex', 'beta' ] - description: > - DEX trades on balancer v2 on polygon - columns: - - *blockchain - - *project - - *version - - *block_month - - *block_date - - *block_time - - name: block_number - - *token_bought_symbol - - *token_sold_symbol - - *token_pair - - *token_bought_amount - - *token_sold_amount - - *token_bought_amount_raw - - *token_sold_amount_raw - - *amount_usd - - *token_bought_address - - *token_sold_address - - *taker - - *maker - - *project_contract_address - - name: pool_symbol - - name: pool_type - - *pool_id - - *swap_fee - - *tx_hash - - *tx_from - - *tx_to - - *evt_index - - - name: balancer_v2_polygon_protocol_fee - meta: - blockchain: polygon - project: balancer_v2 - contributors: viniabussafi - config: - tags: ['polygon', 'revenue', 'fees'] - description: > - Daily Protocol Fee collected and Revenue by pool on Balancer, an automated portfolio manager and trading platform. - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - day - - pool_id - - token_address - columns: - - name: day - - name: pool_id - - name: pool_address - - name: pool_symbol - - name: version - - name: blockchain - - name: token_address - - name: token_symbol - - name: token_amount_raw - description: "Raw amount of revenues of the token in the pool" - - name: token_amount - description: "Amount of revenues of the token in the pool" - - name: protocol_fee_collected_usd - description: "Fee collected in the pool in USD" - - name: treasury_share - description: "Share of total revenue that is directed to Balancer DAO's treasury, as per BIPs 19, 161 and 371" - - name: treasury_revenue_usd - description: "Total revenue directed to Balancer DAO's treasury" - - - name: balancer_v2_polygon_bpt_supply - meta: - blockchain: polygon - project: balancer_v2 - contributors: thetroyharris, viniabussafi - config: - tags: ['polygon', 'bpt', 'supply'] - description: > - Balancer Pool Token (BPT) supply for ComposableStablePools versions 4 and 5. - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - day - - blockchain - - token_address - columns: - - name: day - - name: pool_type - - name: version - - name: blockchain - - name: token_address - - name: supply \ No newline at end of file diff --git a/models/balancer/zkevm/balancer_zkevm_schema.yml b/models/balancer/zkevm/balancer_zkevm_schema.yml deleted file mode 100644 index a573e89563d..00000000000 --- a/models/balancer/zkevm/balancer_zkevm_schema.yml +++ /dev/null @@ -1,431 +0,0 @@ -version: 2 - -models: - - name: balancer_v2_zkevm_pools_fees - meta: - blockchain: zkevm - project: balancer_v2 - contributors: jacektrocinski, thetroyharris, viniabussafi - config: - tags: ['zkevm', 'balancer', 'pools_fees'] - description: > - Balancer v2 swap fees stored at the pool level. - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - block_number - - tx_hash - - index - columns: - - name: blockchain - - name: version - - &contract_address - name: contract_address - description: 'zkevm address for the liquidity pool used in transaction' - tests: - - not_null - - &tx_hash - name: tx_hash - description: 'Transaction hash' - tests: - - not_null - - &index - name: index - description: '' - tests: - - not_null - - &tx_index - name: tx_index - description: '' - tests: - - not_null - - &block_time - name: block_time - description: '' - tests: - - not_null - - &block_number - name: block_number - description: 'Block number' - tests: - - not_null - - &swap_fee_percentage - name: swap_fee_percentage - description: 'Swap fees for the pool, values are returned with 18 decimals (1e18 meaning 100%)' - tests: - - not_null - - - name: balancer_v2_zkevm_transfers_bpt - meta: - blockchain: zkevm - project: balancer_v2 - contributors: victorstefenon, thetroyharris, viniabussafi - config: - tags: ['zkevm', 'bpt', 'transfers'] - description: > - Balancer Pool Token (BPT) transfer logs on Balancer, an automated portfolio manager and trading platform, on Polygon. - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - evt_tx_hash - - evt_index - - block_date - columns: - - &blockchain - name: blockchain - description: "Blockchain" - - name: version - - *contract_address - - &block_date - name: block_date - description: "UTC event block date of each DEX trade" - - &block_month - name: block_month - description: "UTC event block month of each DEX trade" - - &evt_tx_hash - name: evt_tx_hash - description: 'Transaction hash of transfer event' - - &evt_index - name: evt_index - description: 'Event index' - - &evt_block_time - name: evt_block_time - description: 'Block time of transfer event' - - &evt_block_number - name: evt_block_number - description: 'Block number of transfer event' - - &from - name: from - description: 'Address of BPT provider of transfer event' - - &to - name: to - description: 'Address of BPT receiver of transfer event' - - &value - name: value - description: 'Amount of BPT transferred in transfer event' - - - name: balancer_zkevm_pools_tokens_weights - meta: - blockchain: zkevm - project: balancer - contributors: jacektrocinski, viniabussafi - config: - tags: ['zkevm', 'balancer', 'pools', 'tokens', 'weights'] - description: > - Token weights in Balancer pools. - columns: - - name: blockchain - - name: version - - &pool_id - name: pool_id - description: 'Unique encoded identifier that refers to each pool' - tests: - - not_null - - &token_address - name: token_address - description: 'Contract address for the token' - - &normalized_weight - name: normalized_weight - description: 'Weight of the token in the pool.' - - - name: balancer_v2_zkevm_pools_tokens_weights - meta: - blockchain: zkevm - project: balancer - contributors: jacektrocinski, viniabussafi - config: - tags: ['zkevm', 'balancer', 'pools', 'tokens', 'weights'] - description: > - Token weights in Balancer v2 pools. - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - pool_id - - token_address - columns: - - name: blockchain - - name: version - - name: pool_id - - name: token_address - - name: normalized_weight - - - name: balancer_zkevm_trades - meta: - blockchain: zkevm - sector: dex - contributors: bizzyvinci, viniabussafi - config: - tags: ['balancer', 'zkevm', 'amm', 'trades', 'dex'] - description: > - DEX trades on balancer on zkevm - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - block_date - - blockchain - - project - - version - - tx_hash - - evt_index - - check_dex_seed: - blockchain: zkevm - project: balancer - version: 2 - columns: - - name: blockchain - - &project - name: project - description: "Project name (balancer)" - - &version - name: version - description: "Version of the project" - - name: block_month - - name: block_date - - name: block_time - - &token_bought_symbol - name: token_bought_symbol - description: "Token symbol for token bought in the trade" - - &token_sold_symbol - name: token_sold_symbol - description: "Token symbol for token sold in the trade" - - &token_pair - name: token_pair - description: "Token symbol pair for each token involved in the trade" - - &token_bought_amount - name: token_bought_amount - description: "Value of the token bought at time of execution in the original currency" - - &token_sold_amount - name: token_sold_amount - description: "Value of the token sold at time of execution in the original currency" - - &token_bought_amount_raw - name: token_bought_amount_raw - description: "Raw value of the token bought at time of execution in the original currency" - - &token_sold_amount_raw - name: token_sold_amount_raw - description: "Raw value of the token sold at time of execution in the original currency" - - &amount_usd - name: amount_usd - description: "USD value of the trade at time of execution" - - &token_bought_address - name: token_bought_address - description: "Contract address of the token bought" - - &token_sold_address - name: token_sold_address - description: "Contract address of the token sold" - - &taker - name: taker - description: "Address of trader who purchased a token" - - &maker - name: maker - description: "Address of trader who sold a token" - - name: pool_id - - &swap_fee - name: swap_fee - description: 'Swap fee' - - &project_contract_address - name: project_contract_address - description: "Pool address" - - name: pool_symbol - - name: pool_type - - name: tx_hash - - &tx_from - name: tx_from - description: "transaction.from" - - &tx_to - name: tx_to - description: "transaction.to" - - name: evt_index - - - name: balancer_v2_zkevm_liquidity - meta: - blockchain: zkevm - project: balancer_v2 - contributors: victorstefenon, viniabussafi, thetroyharris - config: - tags: ['zkevm', 'balancer', 'pools', 'liquidity'] - description: > - Balancer v2 pools liquidity by token in zkevm. - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - day - - pool_id - - token_address - columns: - - name: day - description: 'UTC event block time truncated to the day mark' - - name: pool_id - - name: pool_address - - name: pool_symbol - description: 'Symbol of the pool, consisting of the symbol of its tokens and their respective weights' - - name: version - description: 'Version of Balancer in which pool was deployed' - - name: blockchain - description: 'Blockchain in which pool was deployed' - - name: token_address - - name: token_symbol - description: 'Symbol of the token' - - name: token_balance_raw - description: 'Raw balance of the token in the pool' - - name: token_balance - description: 'Scaled balance of the token in the pool' - - name: protocol_liquidity_usd - description: 'Liquidity of the token in the pool in USD, except BPTs' - - name: protocol_liquidity_eth - description: 'Liquidity of the token in the pool in ETH, except BPTs' - - name: pool_liquidity_usd - description: 'Liquidity of the token in the pool in USD, including BPTs' - - name: pool_liquidity_eth - description: 'Liquidity of the token in the pool in ETH, including BPTs' - - - name: balancer_v2_zkevm_flashloans - meta: - blockchain: zkevm - sector: lending - contributors: hildobby, viniabussafi - config: - tags: ['zkevm', 'flashloans'] - description: > - All Balancer flashloans on zkevm - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - blockchain - - tx_hash - - evt_index - columns: - - name: blockchain - - name: project - - name: version - - name: block_time - - name: block_number - - name: amount - - name: amount_usd - - name: tx_hash - - name: evt_index - - name: fee - - name: currency_contract - - name: currency_symbol - - name: recipient - - name: contract_address - - name: block_month - - - name: balancer_v2_zkevm_bpt_prices - meta: - blockchain: zkevm - project: balancer_v2 - contributors: victorstefenon, thetroyharris, viniabussafi - config: - tags: ['zkevm', 'bpt', 'prices'] - description: > - Balancer Pool Token (BPT) hourly median price by pool on Balancer, an automated portfolio manager and trading platform. - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - blockchain - - day - - contract_address - columns: - - name: blockchain - - name: day - - name: version - - name: decimals - - name: contract_address - - name: bpt_price - - - name: balancer_v2_zkevm_trades - meta: - blockchain: zkevm - sector: dex - contributors: bizzyvinci, thetroyharris, tomfutago, viniabussafi - config: - tags: [ 'balancer', 'zkevm', 'amm', 'trades', 'dex', 'beta' ] - description: > - DEX trades on balancer v2 on zkevm - columns: - - name: blockchain - - name: project - - name: version - - name: block_month - - name: block_date - - name: block_time - - name: block_number - - name: token_bought_symbol - - name: token_sold_symbol - - name: token_pair - - name: token_bought_amount - - name: token_sold_amount - - name: token_bought_amount_raw - - name: token_sold_amount_raw - - name: amount_usd - - name: token_bought_address - - name: token_sold_address - - name: taker - - name: maker - - name: project_contract_address - - name: pool_symbol - - name: pool_type - - name: pool_id - - name: swap_fee - - name: tx_hash - - name: tx_from - - name: tx_to - - name: evt_index - - - name: balancer_v2_zkevm_protocol_fee - meta: - blockchain: zkevm - project: balancer_v2 - contributors: viniabussafi - config: - tags: ['zkevm', 'revenue', 'fees'] - description: > - Daily Protocol Fee collected and Revenue by pool on Balancer, an automated portfolio manager and trading platform. - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - day - - pool_id - - token_address - columns: - - name: day - - name: pool_id - - name: pool_address - - name: pool_symbol - - name: version - - name: blockchain - - name: token_address - - name: token_symbol - - name: token_amount_raw - description: "Raw amount of revenues of the token in the pool" - - name: token_amount - description: "Amount of revenues of the token in the pool" - - name: protocol_fee_collected_usd - description: "Fee collected in the pool in USD" - - name: treasury_share - description: "Share of total revenue that is directed to Balancer DAO's treasury, as per BIPs 19, 161 and 371" - - name: treasury_revenue_usd - description: "Total revenue directed to Balancer DAO's treasury" - - - name: balancer_v2_zkevm_bpt_supply - meta: - blockchain: zkevm - project: balancer_v2 - contributors: thetroyharris, viniabussafi - config: - tags: ['zkevm', 'bpt', 'supply'] - description: > - Balancer Pool Token (BPT) supply for ComposableStablePools versions 4 and 5. - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - day - - blockchain - - token_address - columns: - - name: day - - name: pool_type - - name: version - - name: blockchain - - name: token_address - - name: supply From f4f1e59557b37288879808285bec0a079b839356 Mon Sep 17 00:00:00 2001 From: hildobby Date: Wed, 5 Jun 2024 15:32:16 +0200 Subject: [PATCH 047/149] add mantle and bl base sources (#6088) --- sources/_base_sources/blast_base_sources.yml | 404 ++++++++++++++++++ sources/_base_sources/mantle_base_sources.yml | 404 ++++++++++++++++++ 2 files changed, 808 insertions(+) create mode 100644 sources/_base_sources/blast_base_sources.yml create mode 100644 sources/_base_sources/mantle_base_sources.yml diff --git a/sources/_base_sources/blast_base_sources.yml b/sources/_base_sources/blast_base_sources.yml new file mode 100644 index 00000000000..b397dacf71d --- /dev/null +++ b/sources/_base_sources/blast_base_sources.yml @@ -0,0 +1,404 @@ +version: 2 + +sources: + # Base Tables + - name: blast + description: "blast raw tables including transactions, traces and logs." + freshness: + warn_after: { count: 12, period: hour } + tables: + - name: transactions + loaded_at_field: block_time + description: "A blast transaction refers to an action initiated by an externally-owned account (i.e., an account managed by a human, not a contract)." + columns: + - &block_date + name: block_date + description: "Block event date in UTC" + - &block_time + name: block_time + description: "Timestamp for block event time in UTC" + - &value + name: value + description: "Amount of blast transferred from sender to recipient" + - &block_number + name: block_number + description: "Block number" + - name: gas_limit + description: "Maximum amount of gas units that can be consumed by the transaction" + - name: gas_price + description: "Gas price denoted in gwei, which itself is a denomination of blast - each gwei is equal to 10-9 blast" + - name: gas_used + description: "Number of gas units consumed by the transaction" + - name: max_fee_per_gas + description: "Maximum amount of gas willing to be paid for the transaction" + - name: max_priority_fee_per_gas + description: "Maximum amount of gas to be included as a tip to the miner" + - name: base_fee_per_gas + description: "Market price for gas" + - name: nonce + description: "Number of confirmed transactions previously sent by this account" + - name: index + description: "Transaction index" + - &success + name: success + description: "Whether the transaction was completed successfully" + - &from + name: from + description: "Wallet address that initiated the transaction" + - &to + name: to + description: "Wallet address that received the transaction" + - &block_hash + name: block_hash + description: "Primary key of the block" + - name: data + description: "Any binary data payload" + - name: hash + description: "Primary key of the transaction" + tests: + - unique + - not_null + - name: type + description: "Transaction type" + - name: access_list + description: "Specifies a list of addresses and storage keys" + + - name: traces + loaded_at_field: block_time + description: "A blast trace is a small atomic action that modify the internal state of the Ethereum Virtual Machine. The three main trace types are call, create, and suicide." + columns: + - *block_date + - *block_time + - *block_number + - *value + - name: gas + description: "Amount of gas consumed by the trace" + - name: gas_used + description: "Number of gas units used by the trace" + - *block_hash + - name: success + description: "Whether the trace was completed successfully" + - &tx_index + name: tx_index + description: "Transaction index" + - name: subtraces + description: "Number of subtraces (i.e, number of calls at a particular level within a transaction)" + - name: error + description: "Error log" + - name: tx_success + description: "Whether the transaction was completed sucessfully" + - &tx_hash + name: tx_hash + description: "Primary key of the transaction" + - name: from + description: "Wallet address that initiated the trace" + - name: to + description: "Wallet address that received the trace" + - name: trace_address + description: "All returned traces, gives the exact location in the call trace" + - name: type + description: "Type of trace (e.g., call, create, suicide)" + - name: address + description: "Address of the trace creator" + - name: code + description: "Raw EVM code for the trace" + - name: call_type + description: "Hexadecimal representations of the trace's call type" + - name: input + description: "Input data for the trace" + - name: output + description: "Output data for the trace" + - name: refund_address + description: "Refund Address" + + - name: traces_decoded + loaded_at_field: block_time + description: "A blast trace is a small atomic action that modify the internal state of the Ethereum Virtual Machine. The three main trace types are call, create, and suicide. Decoded traces include additional information based on submitted smart contracts and their ABI" + columns: + - *block_date + - *block_time + - *block_number + - name: contract_name + description: "Name of the blast smart contract generating the log" + - name: function_name + description: "Name of the blast smart contract function generating the log" + - name: namespace + description: "Namespace of the blast smart contract generating the log" + - name: signature + description: "Signature of the event" + - name: to + description: "Wallet address that received the trace" + - name: trace_address + description: "All returned traces, gives the exact location in the call trace" + - *tx_hash + + - name: logs + loaded_at_field: block_time + description: "A blast log can be used to describe an event within a smart contract, like a token transfer or a change of ownership." + columns: + - *block_date + - *block_time + - *block_number + - *block_hash + - name: contract_address + description: "Address of the blast smart contract generating the log" + - name: topic1 + description: "Topics are 32-byte (256 bit) “words” that are used to describe what’s going on in an event. The first topic usually consists of the signature of the name of the event that occurred, including the types (uint256, string, etc.) of its parameters." + - name: topic2 + description: "Second topic" + - name: topic3 + description: "Third topic" + - name: topic4 + description: "Fourth topic" + - name: data + description: "Additional data for the log. Data is not searchable (while topics are), but is a lot cheaper and can include large or complicated data like arrays or strings." + - *tx_hash + - name: index + description: "Log index" + - *tx_index + + - name: logs_decoded + loaded_at_field: block_time + description: "A blast log can be used to describe an event within a smart contract, like a token transfer or a change of ownership. Those logs are decoded based on submitted smart contracts to make them human readable." + columns: + - *block_date + - *block_time + - *block_number + - name: index + description: "Log index" + - name: contract_address + description: "Address of the blast smart contract generating the log" + - name: contract_name + description: "Name of the blast smart contract generating the log" + - name: event_name + description: "Name of the blast smart contract event generating the log" + - name: namespace + description: "Namespace of the blast smart contract generating the log" + - name: signature + description: "Signature of the event" + - *tx_hash + + - name: blocks + freshness: + warn_after: { count: 1, period: day } + loaded_at_field: time + description: "Blocks are batches of transactions with a hash of the previous block in the chain. This links blocks together (in a chain) because hashes are cryptographically derived from the block data." + columns: + - name: base_fee_per_gas + - name: difficulty + - name: gas_limit + - name: gas_used + - name: hash + - name: miner + - name: nonce + - name: number + - name: parent_hash + - name: size + - name: time + - name: total_difficulty + + - name: contracts + freshness: + warn_after: { count: 1, period: day } + error_after: { count: 3, period: day } + loaded_at_field: created_at + description: "A view keeping track of what contracts are decoded on Dune on blast; contains information associated with the decoded contract such as namespace, name, address, ABI." + columns: + - name: abi + description: "ABI of the decoded contract" + - name: address + description: "Address of the decoded contract" + - name: from + description: "Address that created/deployed this contract" + - name: code + description: "Code for contract creation" + - name: name + description: "Name of the decoded contract" + - name: namespace + description: "Namesapce of the decoded contract" + - name: dynamic + description: "Boolean indicating whether the contract is dynamic or not" + - name: base + description: "Boolean indicating whether the contract is the base contract or not" + - name: factory + description: "Boolean indicating whether the contract is a factory contract or not" + - name: detection_source + description: "Detection source: 'factory', 'base', or 'dynamic'" + tests: + - accepted_values: + values: ["factory", "base", "dynamic"] + - name: created_at + description: "Timestamp for contract creation" + + - name: creation_traces + loaded_at_field: block_time + description: "blast creation traces" + columns: + - *block_time + - *block_number + - *tx_hash + - name: address + description: "Contract address created" + - name: from + description: "Contract creator address" + - name: code + description: "Contract code" + + # ERC Transfer Tables + - name: erc20_blast + description: "Transfers events for ERC20 tokens on blast." + tables: + - name: evt_transfer + loaded_at_field: evt_block_time + description: "Transfers events for ERC20 tokens on blast." + freshness: + warn_after: { count: 12, period: hour } + error_after: { count: 24, period: hour } + columns: + - name: contract_address + description: "ERC20 token contract address" + - &evt_tx_hash + name: evt_tx_hash + description: "Transaction hash of the event" + - &evt_index + name: evt_index + description: "Event index" + - &evt_block_time + name: evt_block_time + description: "Timestamp for block event time in UTC" + - &evt_block_number + name: evt_block_number + description: "Event block number" + - *from + - *to + - name: value + description: "Amount of ERC20 token transferred" + + - name: evt_approval + loaded_at_field: evt_block_time + description: "Approval events for ERC20 tokens on blast." + columns: + - name: contract_address + description: "ERC20 token contract address" + - *evt_tx_hash + - *evt_index + - *evt_block_time + - *evt_block_number + - name: approved + description: "Approved" + - name: owner + description: "Owner" + - name: spender + description: "Spender" + - name: value + description: "Amount of ERC20 token transferred" + + - name: erc1155_blast + description: "Transfers events for ERC1155 tokens on blast." + tables: + - name: evt_transfersingle + loaded_at_field: evt_block_time + description: "Single transfers events for ERC1155 tokens on blast." + columns: + - name: contract_address + description: "ERC1155 token contract address" + - *evt_tx_hash + - *evt_index + - *evt_block_time + - *evt_block_number + - name: operator + description: "Addresses authorized (or approved) by a NFT owner to spend all of his token Ids." + - *from + - *to + - name: id + description: "ERC1155 token ID" + - name: value + description: "Amount of ERC1155 token transferred" + + - name: evt_transferbatch + loaded_at_field: evt_block_time + description: "Batch transfers events for ERC1155 tokens on blast." + columns: + - name: contract_address + description: "ERC1155 token contract address" + - *evt_tx_hash + - *evt_index + - *evt_block_time + - *evt_block_number + - name: operator + description: "Addresses authorized (or approved) by a NFT owner to spend all of his token Ids." + - *from + - *to + - name: ids + description: "ERC1155 token IDs" + - name: values + description: "Amounts of ERC1155 token transferred" + + - name: evt_ApprovalForAll + loaded_at_field: evt_block_time + description: "Approval for all events for ERC1155 tokens on blast." + columns: + - name: contract_address + description: "ERC1155 token contract address" + - *evt_tx_hash + - *evt_index + - *evt_block_time + - *evt_block_number + - &approved + name: approved + description: "Is approved" + - &owner + name: owner + description: "Owner" + - name: account + description: "Account" + - &operator + name: operator + description: "Opperator" + + - name: erc721_blast + description: "Transfers events for ERC721 tokens on blast." + tables: + - name: evt_transfer + loaded_at_field: evt_block_time + description: "Transfers events for ERC721 tokens on blast." + columns: + - name: contract_address + description: "ERC721 token contract address" + - *evt_tx_hash + - *evt_index + - *evt_block_time + - *evt_block_number + - *from + - *to + - name: tokenId + description: "ERC721 token ID." + + - name: evt_Approval + loaded_at_field: evt_block_time + description: "Approval events for ERC721 tokens on blast." + columns: + - name: contract_address + description: "ERC721 token contract address" + - *evt_tx_hash + - *evt_index + - *evt_block_time + - *evt_block_number + - *approved + - *owner + - name: tokenId + description: "ERC721 token ID." + + - name: evt_ApprovalForAll + loaded_at_field: evt_block_time + description: "Approval for all events for ERC721 tokens on blast." + columns: + - name: contract_address + description: "ERC721 token contract address" + - *evt_tx_hash + - *evt_index + - *evt_block_time + - *evt_block_number + - *approved + - *owner + - *operator \ No newline at end of file diff --git a/sources/_base_sources/mantle_base_sources.yml b/sources/_base_sources/mantle_base_sources.yml new file mode 100644 index 00000000000..1ac91471183 --- /dev/null +++ b/sources/_base_sources/mantle_base_sources.yml @@ -0,0 +1,404 @@ +version: 2 + +sources: + # Base Tables + - name: mantle + description: "mantle raw tables including transactions, traces and logs." + freshness: + warn_after: { count: 12, period: hour } + tables: + - name: transactions + loaded_at_field: block_time + description: "A mantle transaction refers to an action initiated by an externally-owned account (i.e., an account managed by a human, not a contract)." + columns: + - &block_date + name: block_date + description: "Block event date in UTC" + - &block_time + name: block_time + description: "Timestamp for block event time in UTC" + - &value + name: value + description: "Amount of mantle transferred from sender to recipient" + - &block_number + name: block_number + description: "Block number" + - name: gas_limit + description: "Maximum amount of gas units that can be consumed by the transaction" + - name: gas_price + description: "Gas price denoted in gwei, which itself is a denomination of mantle - each gwei is equal to 10-9 mantle" + - name: gas_used + description: "Number of gas units consumed by the transaction" + - name: max_fee_per_gas + description: "Maximum amount of gas willing to be paid for the transaction" + - name: max_priority_fee_per_gas + description: "Maximum amount of gas to be included as a tip to the miner" + - name: base_fee_per_gas + description: "Market price for gas" + - name: nonce + description: "Number of confirmed transactions previously sent by this account" + - name: index + description: "Transaction index" + - &success + name: success + description: "Whether the transaction was completed successfully" + - &from + name: from + description: "Wallet address that initiated the transaction" + - &to + name: to + description: "Wallet address that received the transaction" + - &block_hash + name: block_hash + description: "Primary key of the block" + - name: data + description: "Any binary data payload" + - name: hash + description: "Primary key of the transaction" + tests: + - unique + - not_null + - name: type + description: "Transaction type" + - name: access_list + description: "Specifies a list of addresses and storage keys" + + - name: traces + loaded_at_field: block_time + description: "A mantle trace is a small atomic action that modify the internal state of the Ethereum Virtual Machine. The three main trace types are call, create, and suicide." + columns: + - *block_date + - *block_time + - *block_number + - *value + - name: gas + description: "Amount of gas consumed by the trace" + - name: gas_used + description: "Number of gas units used by the trace" + - *block_hash + - name: success + description: "Whether the trace was completed successfully" + - &tx_index + name: tx_index + description: "Transaction index" + - name: subtraces + description: "Number of subtraces (i.e, number of calls at a particular level within a transaction)" + - name: error + description: "Error log" + - name: tx_success + description: "Whether the transaction was completed sucessfully" + - &tx_hash + name: tx_hash + description: "Primary key of the transaction" + - name: from + description: "Wallet address that initiated the trace" + - name: to + description: "Wallet address that received the trace" + - name: trace_address + description: "All returned traces, gives the exact location in the call trace" + - name: type + description: "Type of trace (e.g., call, create, suicide)" + - name: address + description: "Address of the trace creator" + - name: code + description: "Raw EVM code for the trace" + - name: call_type + description: "Hexadecimal representations of the trace's call type" + - name: input + description: "Input data for the trace" + - name: output + description: "Output data for the trace" + - name: refund_address + description: "Refund Address" + + - name: traces_decoded + loaded_at_field: block_time + description: "A mantle trace is a small atomic action that modify the internal state of the Ethereum Virtual Machine. The three main trace types are call, create, and suicide. Decoded traces include additional information based on submitted smart contracts and their ABI" + columns: + - *block_date + - *block_time + - *block_number + - name: contract_name + description: "Name of the mantle smart contract generating the log" + - name: function_name + description: "Name of the mantle smart contract function generating the log" + - name: namespace + description: "Namespace of the mantle smart contract generating the log" + - name: signature + description: "Signature of the event" + - name: to + description: "Wallet address that received the trace" + - name: trace_address + description: "All returned traces, gives the exact location in the call trace" + - *tx_hash + + - name: logs + loaded_at_field: block_time + description: "A mantle log can be used to describe an event within a smart contract, like a token transfer or a change of ownership." + columns: + - *block_date + - *block_time + - *block_number + - *block_hash + - name: contract_address + description: "Address of the mantle smart contract generating the log" + - name: topic1 + description: "Topics are 32-byte (256 bit) “words” that are used to describe what’s going on in an event. The first topic usually consists of the signature of the name of the event that occurred, including the types (uint256, string, etc.) of its parameters." + - name: topic2 + description: "Second topic" + - name: topic3 + description: "Third topic" + - name: topic4 + description: "Fourth topic" + - name: data + description: "Additional data for the log. Data is not searchable (while topics are), but is a lot cheaper and can include large or complicated data like arrays or strings." + - *tx_hash + - name: index + description: "Log index" + - *tx_index + + - name: logs_decoded + loaded_at_field: block_time + description: "A mantle log can be used to describe an event within a smart contract, like a token transfer or a change of ownership. Those logs are decoded based on submitted smart contracts to make them human readable." + columns: + - *block_date + - *block_time + - *block_number + - name: index + description: "Log index" + - name: contract_address + description: "Address of the mantle smart contract generating the log" + - name: contract_name + description: "Name of the mantle smart contract generating the log" + - name: event_name + description: "Name of the mantle smart contract event generating the log" + - name: namespace + description: "Namespace of the mantle smart contract generating the log" + - name: signature + description: "Signature of the event" + - *tx_hash + + - name: blocks + freshness: + warn_after: { count: 1, period: day } + loaded_at_field: time + description: "Blocks are batches of transactions with a hash of the previous block in the chain. This links blocks together (in a chain) because hashes are cryptographically derived from the block data." + columns: + - name: base_fee_per_gas + - name: difficulty + - name: gas_limit + - name: gas_used + - name: hash + - name: miner + - name: nonce + - name: number + - name: parent_hash + - name: size + - name: time + - name: total_difficulty + + - name: contracts + freshness: + warn_after: { count: 1, period: day } + error_after: { count: 3, period: day } + loaded_at_field: created_at + description: "A view keeping track of what contracts are decoded on Dune on mantle; contains information associated with the decoded contract such as namespace, name, address, ABI." + columns: + - name: abi + description: "ABI of the decoded contract" + - name: address + description: "Address of the decoded contract" + - name: from + description: "Address that created/deployed this contract" + - name: code + description: "Code for contract creation" + - name: name + description: "Name of the decoded contract" + - name: namespace + description: "Namesapce of the decoded contract" + - name: dynamic + description: "Boolean indicating whether the contract is dynamic or not" + - name: base + description: "Boolean indicating whether the contract is the base contract or not" + - name: factory + description: "Boolean indicating whether the contract is a factory contract or not" + - name: detection_source + description: "Detection source: 'factory', 'base', or 'dynamic'" + tests: + - accepted_values: + values: ["factory", "base", "dynamic"] + - name: created_at + description: "Timestamp for contract creation" + + - name: creation_traces + loaded_at_field: block_time + description: "mantle creation traces" + columns: + - *block_time + - *block_number + - *tx_hash + - name: address + description: "Contract address created" + - name: from + description: "Contract creator address" + - name: code + description: "Contract code" + + # ERC Transfer Tables + - name: erc20_mantle + description: "Transfers events for ERC20 tokens on mantle." + tables: + - name: evt_transfer + loaded_at_field: evt_block_time + description: "Transfers events for ERC20 tokens on mantle." + freshness: + warn_after: { count: 12, period: hour } + error_after: { count: 24, period: hour } + columns: + - name: contract_address + description: "ERC20 token contract address" + - &evt_tx_hash + name: evt_tx_hash + description: "Transaction hash of the event" + - &evt_index + name: evt_index + description: "Event index" + - &evt_block_time + name: evt_block_time + description: "Timestamp for block event time in UTC" + - &evt_block_number + name: evt_block_number + description: "Event block number" + - *from + - *to + - name: value + description: "Amount of ERC20 token transferred" + + - name: evt_approval + loaded_at_field: evt_block_time + description: "Approval events for ERC20 tokens on mantle." + columns: + - name: contract_address + description: "ERC20 token contract address" + - *evt_tx_hash + - *evt_index + - *evt_block_time + - *evt_block_number + - name: approved + description: "Approved" + - name: owner + description: "Owner" + - name: spender + description: "Spender" + - name: value + description: "Amount of ERC20 token transferred" + + - name: erc1155_mantle + description: "Transfers events for ERC1155 tokens on mantle." + tables: + - name: evt_transfersingle + loaded_at_field: evt_block_time + description: "Single transfers events for ERC1155 tokens on mantle." + columns: + - name: contract_address + description: "ERC1155 token contract address" + - *evt_tx_hash + - *evt_index + - *evt_block_time + - *evt_block_number + - name: operator + description: "Addresses authorized (or approved) by a NFT owner to spend all of his token Ids." + - *from + - *to + - name: id + description: "ERC1155 token ID" + - name: value + description: "Amount of ERC1155 token transferred" + + - name: evt_transferbatch + loaded_at_field: evt_block_time + description: "Batch transfers events for ERC1155 tokens on mantle." + columns: + - name: contract_address + description: "ERC1155 token contract address" + - *evt_tx_hash + - *evt_index + - *evt_block_time + - *evt_block_number + - name: operator + description: "Addresses authorized (or approved) by a NFT owner to spend all of his token Ids." + - *from + - *to + - name: ids + description: "ERC1155 token IDs" + - name: values + description: "Amounts of ERC1155 token transferred" + + - name: evt_ApprovalForAll + loaded_at_field: evt_block_time + description: "Approval for all events for ERC1155 tokens on mantle." + columns: + - name: contract_address + description: "ERC1155 token contract address" + - *evt_tx_hash + - *evt_index + - *evt_block_time + - *evt_block_number + - &approved + name: approved + description: "Is approved" + - &owner + name: owner + description: "Owner" + - name: account + description: "Account" + - &operator + name: operator + description: "Opperator" + + - name: erc721_mantle + description: "Transfers events for ERC721 tokens on mantle." + tables: + - name: evt_transfer + loaded_at_field: evt_block_time + description: "Transfers events for ERC721 tokens on mantle." + columns: + - name: contract_address + description: "ERC721 token contract address" + - *evt_tx_hash + - *evt_index + - *evt_block_time + - *evt_block_number + - *from + - *to + - name: tokenId + description: "ERC721 token ID." + + - name: evt_Approval + loaded_at_field: evt_block_time + description: "Approval events for ERC721 tokens on mantle." + columns: + - name: contract_address + description: "ERC721 token contract address" + - *evt_tx_hash + - *evt_index + - *evt_block_time + - *evt_block_number + - *approved + - *owner + - name: tokenId + description: "ERC721 token ID." + + - name: evt_ApprovalForAll + loaded_at_field: evt_block_time + description: "Approval for all events for ERC721 tokens on mantle." + columns: + - name: contract_address + description: "ERC721 token contract address" + - *evt_tx_hash + - *evt_index + - *evt_block_time + - *evt_block_number + - *approved + - *owner + - *operator \ No newline at end of file From f52668d38d7093c0ca64ab4f160e9a51a4a1e4ae Mon Sep 17 00:00:00 2001 From: Rantum Date: Wed, 5 Jun 2024 06:33:30 -0700 Subject: [PATCH 048/149] 0x - update taker [base] (#6076) * initial Socialtokens view * Rename socialTokens to socialtokens.sql * Addded new tokens to list * Update socialtokens.sql * rmv social tokens file * add zeroex to dex_aggregator.trades * remove old branches * reset profiles.yml * remove * save * schema * undo trnsfesr changes * 2nd gasless function * try remove --- models/zeroex/base/zeroex_base_api_fills.sql | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/models/zeroex/base/zeroex_base_api_fills.sql b/models/zeroex/base/zeroex_base_api_fills.sql index 0d034d7d640..fc3f6009fc9 100644 --- a/models/zeroex/base/zeroex_base_api_fills.sql +++ b/models/zeroex/base/zeroex_base_api_fills.sql @@ -20,7 +20,7 @@ {% set zeroex_v3_start_date = '2019-12-01' %} {% set zeroex_v4_start_date = '2021-01-06' %} --- Test Query here: https://dune.com/queries/2755622 / https://dune.com/queries/2755822 +-- Test Query here: https://dune.com/queries/2834419 WITH zeroex_tx AS ( SELECT tx_hash, @@ -36,7 +36,7 @@ WITH zeroex_tx AS ( FROM (bytearray_position(INPUT, 0xfbc019a7 ) + 16) FOR 20) END AS affiliate_address, - case when (varbinary_position(input,0x3d8d4082) <> 0 ) then 1 else 0 end as is_gasless + case when (varbinary_position(input,0x3d8d4082) <> 0 or varbinary_position(input,0x4f948110) <> 0 ) then 1 else 0 end as is_gasless FROM {{ source('base', 'traces') }} tr WHERE tr.to IN ( -- exchange contract @@ -179,7 +179,7 @@ SELECT maker, CASE WHEN is_gasless = 1 then case when (varbinary_substring(data,177,19) ) = 0x00000000000000000000000000000000000000 then varbinary_substring(data,81,20) else (varbinary_substring(data,177,20) ) end - WHEN taker = 0xdef1c0ded9bec7f1a1670819833240f027b25eff THEN varbinary_substring(data,177,20) + WHEN taker = 0xdef1c0ded9bec7f1a1670819833240f027b25eff THEN tx."from" ELSE taker END AS taker, -- fix the user masked by ProxyContract issue taker_token, From 6ee3c085a9740938b0fd2abe0c6388c41409c5c3 Mon Sep 17 00:00:00 2001 From: Rantum Date: Wed, 5 Jun 2024 06:33:43 -0700 Subject: [PATCH 049/149] add new tokens to price list [ethereum] (#5919) * initial Socialtokens view * Rename socialTokens to socialtokens.sql * Addded new tokens to list * Update socialtokens.sql * rmv social tokens file * add zeroex to dex_aggregator.trades * remove old branches * reset profiles.yml * remove * save * schema * undo trnsfesr changes * add new eth tokens * remove bad tokens * comma * Remove dups --------- Co-authored-by: jeff-dude <102681548+jeff-dude@users.noreply.github.com> --- models/prices/ethereum/prices_ethereum_tokens.sql | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/models/prices/ethereum/prices_ethereum_tokens.sql b/models/prices/ethereum/prices_ethereum_tokens.sql index 2b4b3a38ca6..92871a6c600 100644 --- a/models/prices/ethereum/prices_ethereum_tokens.sql +++ b/models/prices/ethereum/prices_ethereum_tokens.sql @@ -1709,7 +1709,7 @@ FROM ('strk-starknet', 'ethereum', 'STRK',0xCa14007Eff0dB1f8135f4C25B34De49AB0d42766,18), ('ela-elastos', 'ethereum', 'ELA', 0xe6fd75ff38adca4b97fbcd938c86b98772431867,18), ('frxeth-frax-ether', 'ethereum', 'FRXETH',0x5e8422345238f34275888049021821e8e08caa1f,18), - --('cgpt-chaingpt', 'ethereum', 'CGPT',0x25931894a86d47441213199621f1f2994e1c39aa,18), --not in API + --('cgpt-chaingpt', 'ethereum', 'CGPT',0x25931894a86d47441213199621f1f2994e1c39aa,18), ('cswap-chainswap', 'ethereum', 'CSWAP',0xae41b275aaaf484b541a5881a2dded9515184cca,18), ('bobo-bobo-coin', 'ethereum', 'BOBO',0xb90b2a35c65dbc466b04240097ca756ad2005295,18), ('bvm-bvm', 'ethereum', 'BVM',0x069d89974f4edabde69450f9cf5cf7d8cbd2568d,18), @@ -1745,6 +1745,18 @@ FROM ('deal-stealth-deals', 'ethereum', 'DEAL', 0x7a771a90b8f2a10afd9a75b8e49d646d1139bb98, 18), ('susde-ethena-staked-usde', 'ethereum', 'SUSDE', 0x9d39a5de30e57443bff2a8307a4256c8797a3497, 18), ('prisma-prisma-governance-token', 'ethereum', 'PRISMA', 0xda47862a83dac0c112ba89c6abc2159b95afd71c, 18), + ('bonk-bonk-on-eth', 'ethereum', 'BONK', 0x4fbaf51b95b024d0d7cab575be2a1f0afedc9b64, 18), + ('zyn-zyncoin', 'ethereum', 'ZYN', 0x58cb30368ceb2d194740b144eab4c2da8a917dcb, 18), + ('nut6-nutcoin', 'ethereum', 'NUT', 0x473f4068073cd5b2ab0e4cc8e146f9edc6fb52cc, 18), + --('gswift-gameswift', 'ethereum', 'GSWIFT', 0x580e933d90091b9ce380740e3a4a39c67eb85b4c, 18), + ('nmt-netmind-token', 'ethereum', 'NMT', 0x03aa6298f1370642642415edc0db8b957783e8d6, 9), + ('simpson-homer', 'ethereum', 'SIMPSON', 0x44aAd22aFbB2606d7828Ca1f8f9E5af00e779AE1, 9), + ('pongo-pongo', 'ethereum', 'PONGO', 0x7c68e725b0b2ffcba8947fded4198c3d1db041e6, 9), + ('truf-truflation', 'ethereum', 'TRUF', 0x38c2a4a7330b22788374b8ff70bba513c8d848ca, 18 ), + ('pepecoin-pepecoin', 'ethereum', 'PEPECOIN', 0xa9e8acf069c58aec8825542845fd754e41a9489a, 18 ), + ('gpu-node-ai', 'ethereum', 'GPU', 0x1258d60b224c0c5cd888d37bbf31aa5fcfb7e870, 18 ), + ('doge20-dogecoin20', 'ethereum', 'DOGE20', 0x2541a36be4cd39286ed61a3e6afc2307602489d6, 18 ), + ('chad-chad-frog', 'ethereum', 'CHAD', 0x9e22b4f836a461ddc7765e5fad693688e76e6069, 9 ), ('rivus-rivusdao', 'ethereum', 'RIVUS', 0x60e254e35dd712394b3aba7a1d19114732e143dd, 18), ('dog-the-doge-nft', 'ethereum', 'DOG', 0xbaac2b4491727d78d2b78815144570b9f2fe8899, 18), ('tru-truefi', 'ethereum', 'TRU', 0x4c19596f5aaff459fa38b0f7ed92f11ae6543784, 8), From 1ca44da782b817f37ce36142b0802b73014b009a Mon Sep 17 00:00:00 2001 From: Rantum Date: Wed, 5 Jun 2024 06:33:53 -0700 Subject: [PATCH 050/149] add new tokens to price list [base] (#5918) * initial Socialtokens view * Rename socialTokens to socialtokens.sql * Addded new tokens to list * Update socialtokens.sql * rmv social tokens file * add zeroex to dex_aggregator.trades * remove old branches * reset profiles.yml * remove * save * schema * undo trnsfesr changes * add new base tokens * comman * comma * remove dups --------- Co-authored-by: jeff-dude <102681548+jeff-dude@users.noreply.github.com> --- models/prices/base/prices_base_tokens.sql | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/models/prices/base/prices_base_tokens.sql b/models/prices/base/prices_base_tokens.sql index 6d36546018e..e4e9a24c06d 100644 --- a/models/prices/base/prices_base_tokens.sql +++ b/models/prices/base/prices_base_tokens.sql @@ -96,6 +96,19 @@ FROM ('coinye-coinye-west', 'base', 'COINYE', 0x0028e1e60167b48a938b785aa5292917e7eaca8b, 18), ('trump-maga', 'base', 'TRUMP', 0x57f5fbd3de65dfc0bd3630f732969e5fb97e6d37, 9), ('weeth-wrapped-eeth', 'base', 'WEETH', 0x04c0599ae5a44757c0af6f9ec3b93da8976c150a, 18), + ('pola-pola', 'base', 'POLA', 0x76e7447bafa3f0acafc9692629b1d1bc937ca15d, 18), + ('jogeco-jogeco-dog', 'base', 'JOGECO', 0x92fb1b7d9730b2f1bd4e2e91368c1eb6fdd2a009, 9), + ('boshi-boshi', 'base', 'BOSHI', 0x33ad778e6c76237d843c52d7cafc972bb7cf8729, 18), + ('doomer-doomer-on-base-cto', 'base', 'DOOMER', 0xd3741ac9b3f280b0819191e4b30be4ecd990771e, 8), + ('rock-just-a-black-rock-on-base', 'base', 'ROCK', 0xece7b98bd817ee5b1f2f536daf34d0b6af8bb542, 18), + ('bloom-bloomer', 'base', 'BLOOM', 0xafb5d4d474693e68df500c9c682e6a2841f9661a, 18), + ('caw1-crow-with-knife', 'base', 'CAW', 0xdfbea88c4842d30c26669602888d746d30f9d60d, 18), + ('keren-keren', 'base', 'KEREN', 0x174e33ef2effa0a4893d97dda5db4044cc7993a3, 18), + ('mog-mog-coin', 'base', 'MOG', 0x2da56acb9ea78330f947bd57c54119debda7af71, 18), + ('carlo-carlo', 'base', 'CARLO', 0x38d513ec43dda20f323f26c7bef74c5cf80b6477, 18), + ('ski-ski-mask-dog', 'base', 'SKI', 0x768be13e1680b5ebe0024c42c896e3db59ec0149, 9), + ('kurbi-kurbi', 'base', 'KURBI', 0x653a143b8d15c565c6623d1f168cfbec1056d872, 9), + ('bord-base-lord', 'base', 'BORD', 0x160452f95612699d1a561a70eeeeede67c6812af, 18), ('rdnt-radiant-capital','base','RDNT',0xd722e55c1d9d9fa0021a5215cbb904b92b3dc5d4,18), ('well-moonwell', 'base', 'WELL', 0xff8adec2221f9f4d8dfbafa6b9a297d17603493d, 18), ('mochi3-mochi', 'base', 'MOCHI', 0xf6e932ca12afa26665dc4dde7e27be02a7c02e50, 18) From 7bb03f7994dbfff21dfc5af8cd939af408dbabee Mon Sep 17 00:00:00 2001 From: Alan Ghobadi Date: Wed, 5 Jun 2024 15:34:27 +0200 Subject: [PATCH 051/149] Add incremental filters on prices (#6086) --- .../arbitrum/zeroex_arbitrum_native_fills.sql | 6 +++++ models/zeroex/bnb/zeroex_bnb_native_fills.sql | 18 ++++++++++++++ .../ethereum/zeroex_ethereum_native_fills.sql | 24 +++++++++++++++++++ .../optimism/zeroex_optimism_native_fills.sql | 18 ++++++++++++++ .../polygon/zeroex_polygon_native_fills.sql | 24 +++++++++++++++++++ 5 files changed, 90 insertions(+) diff --git a/models/zeroex/arbitrum/zeroex_arbitrum_native_fills.sql b/models/zeroex/arbitrum/zeroex_arbitrum_native_fills.sql index e8206fb93fb..b6443dd96eb 100644 --- a/models/zeroex/arbitrum/zeroex_arbitrum_native_fills.sql +++ b/models/zeroex/arbitrum/zeroex_arbitrum_native_fills.sql @@ -57,6 +57,9 @@ WITH FROM {{ source('zeroex_arbitrum', 'ExchangeProxy_evt_LimitOrderFilled') }} fills LEFT JOIN {{ source('prices', 'usd') }} tp ON date_trunc('minute', evt_block_time) = tp.minute and tp.blockchain = 'arbitrum' + {% if is_incremental() %} + AND {{ incremental_predicate('tp.minute') }} + {% endif %} AND CASE -- set native token to wrapped version WHEN fills.takerToken = 0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee THEN 0x82af49447d8a07e3bd95bd0d56f35241523fbab1 @@ -64,6 +67,9 @@ WITH END = tp.contract_address LEFT JOIN {{ source('prices', 'usd') }} mp ON DATE_TRUNC('minute', evt_block_time) = mp.minute and mp.blockchain = 'arbitrum' + {% if is_incremental() %} + AND {{ incremental_predicate('mp.minute') }} + {% endif %} AND CASE -- set native token to wrapped version WHEN fills.makerToken = 0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee THEN 0x82af49447d8a07e3bd95bd0d56f35241523fbab1 diff --git a/models/zeroex/bnb/zeroex_bnb_native_fills.sql b/models/zeroex/bnb/zeroex_bnb_native_fills.sql index 4af8d4e490f..4a20b62ee56 100644 --- a/models/zeroex/bnb/zeroex_bnb_native_fills.sql +++ b/models/zeroex/bnb/zeroex_bnb_native_fills.sql @@ -44,6 +44,9 @@ WITH FROM {{ source('zeroex_bnb', 'ExchangeProxy_evt_LimitOrderFilled') }} fills LEFT JOIN {{ source('prices', 'usd') }} tp ON date_trunc('minute', evt_block_time) = tp.minute and tp.blockchain = 'bnb' + {% if is_incremental() %} + AND {{ incremental_predicate('tp.minute') }} + {% endif %} AND CASE -- set native token to wrapped version WHEN fills.takerToken = 0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee THEN 0xbb4cdb9cbd36b01bd1cbaebf2de08d9173bc095c @@ -51,6 +54,9 @@ WITH END = tp.contract_address LEFT JOIN {{ source('prices', 'usd') }} mp ON DATE_TRUNC('minute', evt_block_time) = mp.minute and mp.blockchain = 'bnb' + {% if is_incremental() %} + AND {{ incremental_predicate('mp.minute') }} + {% endif %} AND CASE -- set native token to wrapped version WHEN fills.makerToken = 0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee THEN 0xbb4cdb9cbd36b01bd1cbaebf2de08d9173bc095c @@ -92,6 +98,9 @@ WITH FROM {{ source('zeroex_bnb', 'ExchangeProxy_evt_RfqOrderFilled') }} fills LEFT JOIN {{ source('prices', 'usd') }} tp ON date_trunc('minute', evt_block_time) = tp.minute and tp.blockchain = 'bnb' + {% if is_incremental() %} + AND {{ incremental_predicate('tp.minute') }} + {% endif %} AND CASE -- set native token to wrapped version WHEN fills.takerToken = 0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee THEN 0xbb4cdb9cbd36b01bd1cbaebf2de08d9173bc095c @@ -99,6 +108,9 @@ WITH END = tp.contract_address LEFT JOIN {{ source('prices', 'usd') }} mp ON DATE_TRUNC('minute', evt_block_time) = mp.minute and mp.blockchain = 'bnb' + {% if is_incremental() %} + AND {{ incremental_predicate('mp.minute') }} + {% endif %} AND CASE -- set native token to wrapped version WHEN fills.makerToken = 0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee THEN 0xbb4cdb9cbd36b01bd1cbaebf2de08d9173bc095c @@ -140,6 +152,9 @@ WITH FROM {{ source('zeroex_bnb', 'ExchangeProxy_evt_OtcOrderFilled') }} fills LEFT JOIN {{ source('prices', 'usd') }} tp ON date_trunc('minute', evt_block_time) = tp.minute and tp.blockchain = 'bnb' + {% if is_incremental() %} + AND {{ incremental_predicate('tp.minute') }} + {% endif %} AND CASE -- set native token to wrapped version WHEN fills.takerToken = 0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee THEN 0xbb4cdb9cbd36b01bd1cbaebf2de08d9173bc095c @@ -147,6 +162,9 @@ WITH END = tp.contract_address LEFT JOIN {{ source('prices', 'usd') }} mp ON DATE_TRUNC('minute', evt_block_time) = mp.minute and mp.blockchain = 'bnb' + {% if is_incremental() %} + AND {{ incremental_predicate('mp.minute') }} + {% endif %} AND CASE -- set native token to wrapped version WHEN fills.makerToken = 0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee THEN 0xbb4cdb9cbd36b01bd1cbaebf2de08d9173bc095c diff --git a/models/zeroex/ethereum/zeroex_ethereum_native_fills.sql b/models/zeroex/ethereum/zeroex_ethereum_native_fills.sql index b5b78a708f9..6bf44060d48 100644 --- a/models/zeroex/ethereum/zeroex_ethereum_native_fills.sql +++ b/models/zeroex/ethereum/zeroex_ethereum_native_fills.sql @@ -54,6 +54,9 @@ WITH FROM {{ source('zeroex_v3_ethereum', 'Exchange_evt_Fill') }} fills LEFT JOIN {{ source('prices', 'usd') }} tp ON date_trunc('minute', evt_block_time) = tp.minute and tp.blockchain = 'ethereum' + {% if is_incremental() %} + AND {{ incremental_predicate('tp.minute') }} + {% endif %} AND CASE -- Set Deversifi ETHWrapper to WETH WHEN greatest(bytearray_substring(takerAssetData, 17, 20),bytearray_substring(takerAssetData, 245, 20)) IN (0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee) THEN 0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2 @@ -61,6 +64,9 @@ WITH END = tp.contract_address LEFT JOIN {{ source('prices', 'usd') }} mp ON DATE_TRUNC('minute', evt_block_time) = mp.minute and mp.blockchain = 'ethereum' + {% if is_incremental() %} + AND {{ incremental_predicate('mp.minute') }} + {% endif %} AND CASE -- Set Deversifi ETHWrapper to WETH WHEN greatest(bytearray_substring(makerAssetData, 17, 20),bytearray_substring(makerAssetData, 245, 20)) IN (0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee) THEN 0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2 @@ -115,6 +121,9 @@ WITH FROM {{ source('zeroex_v2_ethereum', 'Exchange2_1_evt_Fill') }} fills LEFT JOIN {{ source('prices', 'usd') }} tp ON date_trunc('minute', evt_block_time) = tp.minute and tp.blockchain = 'ethereum' + {% if is_incremental() %} + AND {{ incremental_predicate('tp.minute') }} + {% endif %} AND CASE -- Set Deversifi ETHWrapper to WETH WHEN greatest(bytearray_substring(takerAssetData, 17, 20),bytearray_substring(takerAssetData, 245, 20)) IN (0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee) THEN 0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2 @@ -122,6 +131,9 @@ WITH END = tp.contract_address LEFT JOIN {{ source('prices', 'usd') }} mp ON DATE_TRUNC('minute', evt_block_time) = mp.minute and mp.blockchain = 'ethereum' + {% if is_incremental() %} + AND {{ incremental_predicate('mp.minute') }} + {% endif %} AND CASE -- Set Deversifi ETHWrapper to WETH WHEN greatest(bytearray_substring(makerAssetData, 17, 20),bytearray_substring(makerAssetData, 245, 20)) IN (0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee) THEN 0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2 @@ -177,6 +189,9 @@ WITH FROM {{ source('zeroex_ethereum', 'ExchangeProxy_evt_LimitOrderFilled') }} fills LEFT JOIN {{ source('prices', 'usd') }} tp ON date_trunc('minute', evt_block_time) = tp.minute and tp.blockchain = 'ethereum' + {% if is_incremental() %} + AND {{ incremental_predicate('tp.minute') }} + {% endif %} AND CASE -- Set Deversifi ETHWrapper to WETH WHEN fills.takerToken IN (0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee) THEN 0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2 @@ -184,6 +199,9 @@ WITH END = tp.contract_address LEFT JOIN {{ source('prices', 'usd') }} mp ON DATE_TRUNC('minute', evt_block_time) = mp.minute and mp.blockchain = 'ethereum' + {% if is_incremental() %} + AND {{ incremental_predicate('mp.minute') }} + {% endif %} AND CASE -- Set Deversifi ETHWrapper to WETH WHEN fills.makerToken IN (0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee) THEN 0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2 @@ -296,6 +314,9 @@ WITH FROM {{ source('zeroex_ethereum', 'ExchangeProxy_evt_OtcOrderFilled') }} fills LEFT JOIN {{ source('prices', 'usd') }} tp ON date_trunc('minute', evt_block_time) = tp.minute and tp.blockchain = 'ethereum' + {% if is_incremental() %} + AND {{ incremental_predicate('tp.minute') }} + {% endif %} AND CASE -- Set Deversifi ETHWrapper to WETH WHEN fills.takerToken IN (0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee) THEN 0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2 @@ -303,6 +324,9 @@ WITH END = tp.contract_address LEFT JOIN {{ source('prices', 'usd') }} mp ON DATE_TRUNC('minute', evt_block_time) = mp.minute and mp.blockchain = 'ethereum' + {% if is_incremental() %} + AND {{ incremental_predicate('mp.minute') }} + {% endif %} AND CASE -- Set Deversifi ETHWrapper to WETH WHEN fills.makerToken IN (0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee) THEN 0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2 diff --git a/models/zeroex/optimism/zeroex_optimism_native_fills.sql b/models/zeroex/optimism/zeroex_optimism_native_fills.sql index a5d5de8d610..6543c86271f 100644 --- a/models/zeroex/optimism/zeroex_optimism_native_fills.sql +++ b/models/zeroex/optimism/zeroex_optimism_native_fills.sql @@ -56,6 +56,9 @@ WITH FROM {{ source('zeroex_optimism', 'ExchangeProxy_evt_LimitOrderFilled') }} fills LEFT JOIN {{ source('prices', 'usd') }} tp ON date_trunc('minute', evt_block_time) = tp.minute and tp.blockchain = 'optimism' + {% if is_incremental() %} + AND {{ incremental_predicate('tp.minute') }} + {% endif %} AND CASE -- Set Deversifi ETHWrapper to WETH WHEN fills.takerToken IN (0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee) THEN 0x4200000000000000000000000000000000000006 @@ -63,6 +66,9 @@ WITH END = tp.contract_address LEFT JOIN {{ source('prices', 'usd') }} mp ON DATE_TRUNC('minute', evt_block_time) = mp.minute and mp.blockchain = 'optimism' + {% if is_incremental() %} + AND {{ incremental_predicate('mp.minute') }} + {% endif %} AND CASE -- Set Deversifi ETHWrapper to WETH WHEN fills.makerToken IN (0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee) THEN 0x4200000000000000000000000000000000000006 @@ -116,6 +122,9 @@ WITH FROM {{ source('zeroex_optimism', 'ExchangeProxy_evt_RfqOrderFilled') }} fills LEFT JOIN {{ source('prices', 'usd') }} tp ON date_trunc('minute', evt_block_time) = tp.minute and tp.blockchain = 'optimism' + {% if is_incremental() %} + AND {{ incremental_predicate('tp.minute') }} + {% endif %} AND CASE -- Set Deversifi ETHWrapper to WETH WHEN fills.takerToken IN (0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee) THEN 0x4200000000000000000000000000000000000006 @@ -123,6 +132,9 @@ WITH END = tp.contract_address LEFT JOIN {{ source('prices', 'usd') }} mp ON DATE_TRUNC('minute', evt_block_time) = mp.minute and mp.blockchain = 'optimism' + {% if is_incremental() %} + AND {{ incremental_predicate('mp.minute') }} + {% endif %} AND CASE -- Set Deversifi ETHWrapper to WETH WHEN fills.makerToken IN (0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee) THEN 0x4200000000000000000000000000000000000006 @@ -175,6 +187,9 @@ WITH FROM {{ source('zeroex_optimism', 'ExchangeProxy_evt_OtcOrderFilled') }} fills LEFT JOIN {{ source('prices', 'usd') }} tp ON date_trunc('minute', evt_block_time) = tp.minute and tp.blockchain = 'optimism' + {% if is_incremental() %} + AND {{ incremental_predicate('tp.minute') }} + {% endif %} AND CASE -- Set Deversifi ETHWrapper to WETH WHEN fills.takerToken IN (0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee) THEN 0x4200000000000000000000000000000000000006 @@ -182,6 +197,9 @@ WITH END = tp.contract_address LEFT JOIN {{ source('prices', 'usd') }} mp ON DATE_TRUNC('minute', evt_block_time) = mp.minute and mp.blockchain = 'optimism' + {% if is_incremental() %} + AND {{ incremental_predicate('mp.minute') }} + {% endif %} AND CASE -- Set Deversifi ETHWrapper to WETH WHEN fills.makerToken IN (0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee) THEN 0x4200000000000000000000000000000000000006 diff --git a/models/zeroex/polygon/zeroex_polygon_native_fills.sql b/models/zeroex/polygon/zeroex_polygon_native_fills.sql index 686061f2904..2fb1d2b80bc 100644 --- a/models/zeroex/polygon/zeroex_polygon_native_fills.sql +++ b/models/zeroex/polygon/zeroex_polygon_native_fills.sql @@ -55,6 +55,9 @@ WITH FROM {{ source('zeroex_v3_polygon', 'Exchange_evt_Fill') }} fills LEFT JOIN {{ source('prices', 'usd') }} tp ON date_trunc('minute', evt_block_time) = tp.minute and tp.blockchain = 'polygon' + {% if is_incremental() %} + AND {{ incremental_predicate('tp.minute') }} + {% endif %} AND CASE -- Set Deversifi ETHWrapper to WETH WHEN bytearray_substring(fills.takerAssetData, 8, 10) IN (0x0000000000000000000000000000000000001010) THEN 0x0d500b1d8e8ef31e21c99d1db9a6444d3adf1270 @@ -62,6 +65,9 @@ WITH END = tp.contract_address LEFT JOIN {{ source('prices', 'usd') }} mp ON DATE_TRUNC('minute', evt_block_time) = mp.minute and mp.blockchain = 'polygon' + {% if is_incremental() %} + AND {{ incremental_predicate('mp.minute') }} + {% endif %} AND CASE -- Set Deversifi ETHWrapper to WETH WHEN bytearray_substring(fills.makerAssetData, 8, 10) IN (0x0000000000000000000000000000000000001010) THEN 0x0d500b1d8e8ef31e21c99d1db9a6444d3adf1270 @@ -119,6 +125,9 @@ WITH FROM {{ source('zeroex_polygon', 'ExchangeProxy_evt_LimitOrderFilled') }} fills LEFT JOIN {{ source('prices', 'usd') }} tp ON date_trunc('minute', evt_block_time) = tp.minute and tp.blockchain = 'polygon' + {% if is_incremental() %} + AND {{ incremental_predicate('tp.minute') }} + {% endif %} AND CASE -- Set Deversifi ETHWrapper to WETH WHEN fills.takerToken IN (0x0000000000000000000000000000000000001010) THEN 0x0d500b1d8e8ef31e21c99d1db9a6444d3adf1270 @@ -126,6 +135,9 @@ WITH END = tp.contract_address LEFT JOIN {{ source('prices', 'usd') }} mp ON DATE_TRUNC('minute', evt_block_time) = mp.minute and mp.blockchain = 'polygon' + {% if is_incremental() %} + AND {{ incremental_predicate('mp.minute') }} + {% endif %} AND CASE -- Set Deversifi ETHWrapper to WETH WHEN fills.makerToken IN (0x0000000000000000000000000000000000001010) THEN 0x0d500b1d8e8ef31e21c99d1db9a6444d3adf1270 @@ -180,6 +192,9 @@ WITH FROM {{ source('zeroex_polygon', 'ExchangeProxy_evt_RfqOrderFilled') }} fills LEFT JOIN {{ source('prices', 'usd') }} tp ON date_trunc('minute', evt_block_time) = tp.minute and tp.blockchain = 'polygon' + {% if is_incremental() %} + AND {{ incremental_predicate('tp.minute') }} + {% endif %} AND CASE -- Set Deversifi ETHWrapper to WETH WHEN fills.takerToken IN (0x0000000000000000000000000000000000001010) THEN 0x0d500b1d8e8ef31e21c99d1db9a6444d3adf1270 @@ -187,6 +202,9 @@ WITH END = tp.contract_address LEFT JOIN {{ source('prices', 'usd') }} mp ON DATE_TRUNC('minute', evt_block_time) = mp.minute and mp.blockchain = 'polygon' + {% if is_incremental() %} + AND {{ incremental_predicate('mp.minute') }} + {% endif %} AND CASE -- Set Deversifi ETHWrapper to WETH WHEN fills.makerToken IN (0x0000000000000000000000000000000000001010) THEN 0x0d500b1d8e8ef31e21c99d1db9a6444d3adf1270 @@ -240,6 +258,9 @@ WITH FROM {{ source('zeroex_polygon', 'ExchangeProxy_evt_OtcOrderFilled') }} fills LEFT JOIN {{ source('prices', 'usd') }} tp ON date_trunc('minute', evt_block_time) = tp.minute and tp.blockchain = 'polygon' + {% if is_incremental() %} + AND {{ incremental_predicate('tp.minute') }} + {% endif %} AND CASE -- Set Deversifi ETHWrapper to WETH WHEN fills.takerToken IN (0x0000000000000000000000000000000000001010) THEN 0x0d500b1d8e8ef31e21c99d1db9a6444d3adf1270 @@ -247,6 +268,9 @@ WITH END = tp.contract_address LEFT JOIN {{ source('prices', 'usd') }} mp ON DATE_TRUNC('minute', evt_block_time) = mp.minute and mp.blockchain = 'polygon' + {% if is_incremental() %} + AND {{ incremental_predicate('mp.minute') }} + {% endif %} AND CASE -- Set Deversifi ETHWrapper to WETH WHEN fills.makerToken IN (0x0000000000000000000000000000000000001010) THEN 0x0d500b1d8e8ef31e21c99d1db9a6444d3adf1270 From f0b7e70da405f3bff92fe182eba68b22c310dfb8 Mon Sep 17 00:00:00 2001 From: hildobby Date: Wed, 5 Jun 2024 15:35:26 +0200 Subject: [PATCH 052/149] Add stakers (#5996) * add bitpanda * fix --- .../staking_ethereum_entities_batch_contracts_tx_from.sql | 2 ++ 1 file changed, 2 insertions(+) diff --git a/models/staking/ethereum/entities/staking_ethereum_entities_batch_contracts_tx_from.sql b/models/staking/ethereum/entities/staking_ethereum_entities_batch_contracts_tx_from.sql index 9fdfc8f2620..790080cda36 100644 --- a/models/staking/ethereum/entities/staking_ethereum_entities_batch_contracts_tx_from.sql +++ b/models/staking/ethereum/entities/staking_ethereum_entities_batch_contracts_tx_from.sql @@ -13,6 +13,8 @@ WITH tagged_entities AS ( (0x617c8de5bde54ffbb8d92716cc947858ca38f582, 'MEV Protocol', 'Liquid Staking') , (0xcDBF58a9A9b54a2C43800c50C7192946dE858321, 'Bitpanda', 'CEX') , (0xb10edd6fa6067dba8d4326f1c8f0d1c791594f13, 'Bitpanda', 'CEX') + , (0xf197c6f2ac14d25ee2789a73e4847732c7f16bc9, 'Bitpanda', 'CEX') + , (0xba1951df0c0a52af23857c5ab48b4c43a57e7ed1, 'Golem Foundation', 'Staking Pool') , (0x70D5cCC14a1a264c05Ff48B3ec6751b0959541aA, 'Binance US', 'CEX') ) x (funds_origin, entity, category) From d33183b16945a6047108272f5fe8134e0836029c Mon Sep 17 00:00:00 2001 From: Alan Ghobadi Date: Wed, 5 Jun 2024 18:32:46 +0200 Subject: [PATCH 053/149] Zeroex api fills performance (#6089) * Filter on logs instead of txs * Add comment for future --- models/zeroex/bnb/zeroex_bnb_api_fills.sql | 1 + models/zeroex/polygon/zeroex_polygon_api_fills.sql | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/models/zeroex/bnb/zeroex_bnb_api_fills.sql b/models/zeroex/bnb/zeroex_bnb_api_fills.sql index f1300c783a9..a4b0a526244 100644 --- a/models/zeroex/bnb/zeroex_bnb_api_fills.sql +++ b/models/zeroex/bnb/zeroex_bnb_api_fills.sql @@ -347,6 +347,7 @@ uni_v2_swap as ( ) +-- TODO: this is really slow, need to optimize , uni_v2_pair_creation as ( SELECT bytearray_substring(data,13,20) as pair, diff --git a/models/zeroex/polygon/zeroex_polygon_api_fills.sql b/models/zeroex/polygon/zeroex_polygon_api_fills.sql index 1ce4f287866..0bc0afc1a94 100644 --- a/models/zeroex/polygon/zeroex_polygon_api_fills.sql +++ b/models/zeroex/polygon/zeroex_polygon_api_fills.sql @@ -173,7 +173,7 @@ ERC20BridgeTransfer AS ( WHERE topic0 = 0x349fc08071558d8e3aa92dec9396e4e9f2dfecd6bb9065759d1932e7da43b8a9 {% if is_incremental() %} - AND {{ incremental_predicate('zeroex_tx.block_time') }} + AND {{ incremental_predicate('logs.block_time') }} {% endif %} {% if not is_incremental() %} AND zeroex_tx.block_time >= cast('{{zeroex_v3_start_date}}' as date) From cf2f8047a7dc8dc3a20acb228ac4283b1e5329ca Mon Sep 17 00:00:00 2001 From: Huang Geyang Date: Thu, 6 Jun 2024 00:33:22 +0800 Subject: [PATCH 054/149] dbt_project.yml clean up (part 1) (#6011) * Remove duplicated key * Remove some schema for experiment * Fix some schema * Add schemas * Add schemas * Refactor daohaus * Add schemas * Fix abi * Refactor tigris * Add schema * Add schemas * Fix typo * Remove double type checking * Fix config block --------- Co-authored-by: jeff-dude <102681548+jeff-dude@users.noreply.github.com> Co-authored-by: jeff-dude --- dbt_project.yml | 263 ------------------ .../ethereum/balancer_ethereum_balances.sql | 6 +- .../flashloans/balancer_flashloans.sql | 2 +- .../balancer_ethereum_vebal_votes.sql | 2 +- models/aave/aave_flashloans.sql | 1 + .../ethereum/aave_ethereum_interest_rates.sql | 5 +- .../optimism/aave_optimism_interest_rates.sql | 5 +- .../{signatures_schema.yml => abi_schema.yml} | 2 +- .../{signatures.sql => abi_signatures.sql} | 0 .../addresses_summary_op_mainnet.sql | 2 +- models/airdrop/airdrop_claims.sql | 2 +- .../arbitrum/airdrop_arbitrum_claims.sql | 2 +- .../airdrop_avalanche_c_claims.sql | 2 +- models/airdrop/bnb/airdrop_bnb_claims.sql | 2 +- .../ethereum/airdrop_ethereum_claims.sql | 2 +- .../airdrop/gnosis/airdrop_gnosis_claims.sql | 2 +- .../ethereum/bend_dao_ethereum_lending.sql | 2 +- .../ethereum/bend_dao_ethereum_schema.yml | 2 +- .../gnosis/colony_gnosis_dao_addresses.sql | 2 +- models/daohaus/daohaus_dao_addresses.sql | 2 +- .../daohaus_ethereum_dao_addresses.sql | 2 +- .../gnosis/daohaus_gnosis_dao_addresses.sql | 2 +- .../bnb/ellipsis_finance_bnb_pool_tokens.sql | 2 +- .../emdx_avalanche_c_perpetual_trades.sql | 2 +- models/ens/ens_node_names.sql | 1 + models/ens/ens_resolver_latest.sql | 1 + models/ens/ens_resolver_records.sql | 1 + models/ens/ens_reverse_latest.sql | 1 + models/ens/ens_set_name_latest.sql | 3 +- models/ens/ens_view_expirations.sql | 2 +- models/ens/ens_view_registrations.sql | 1 + models/ens/ens_view_registries.sql | 4 +- models/ens/ens_view_renewals.sql | 2 +- .../ethereum/euler_ethereum_flashloans.sql | 3 +- models/evms/evms_blocks.sql | 2 +- models/evms/evms_contracts.sql | 2 +- models/evms/evms_creation_traces.sql | 2 +- models/evms/evms_erc1155_approvalsforall.sql | 2 +- models/evms/evms_erc1155_transfersbatch.sql | 2 +- models/evms/evms_erc1155_transferssingle.sql | 2 +- models/evms/evms_erc20_approvals.sql | 2 +- models/evms/evms_erc20_transfers.sql | 2 +- models/evms/evms_erc721_approvals.sql | 2 +- models/evms/evms_erc721_approvalsforall.sql | 2 +- models/evms/evms_erc721_transfers.sql | 2 +- models/evms/evms_info.sql | 1 + models/evms/evms_logs.sql | 2 +- models/evms/evms_logs_decoded.sql | 2 +- models/evms/evms_traces.sql | 2 +- models/evms/evms_traces_decoded.sql | 2 +- models/evms/evms_transactions.sql | 2 +- .../bnb/frax_finance_bnb_bribes.sql | 3 +- models/gas/gas_fees.sql | 2 +- .../ethereum/gitcoin_ethereum_donations.sql | 2 +- models/gitcoin/gitcoin_donations.sql | 2 +- models/gitcoin/gitcoin_grant_round_dates.sql | 3 +- .../polygon/gitcoin_polygon_donations.sql | 2 +- .../gmx/arbitrum/glp/gmx_arbitrum_glp_aum.sql | 1 + .../glp/gmx_arbitrum_glp_components.sql | 1 + .../glp/gmx_arbitrum_glp_components_base.sql | 1 + .../arbitrum/glp/gmx_arbitrum_glp_fees.sql | 1 + .../arbitrum/glp/gmx_arbitrum_glp_float.sql | 1 + .../gmx_arbitrum_perpetual_trades.sql | 2 +- .../vault/gmx_arbitrum_vault_balances.sql | 1 + .../glp/gmx_avalanche_c_glp_aum.sql | 1 + .../glp/gmx_avalanche_c_glp_components.sql | 1 + .../gmx_avalanche_c_perpetual_trades.sql | 2 +- models/gmx/gmx_perpetual_trades.sql | 2 +- ..._exchange_avalanche_c_perpetual_trades.sql | 2 +- ...omad_ethereum_view_bridge_transactions.sql | 2 +- .../arbitrum/paraswap_arbitrum_trades.sql | 1 + .../paraswap_avalanche_c_trades.sql | 1 + models/paraswap/bnb/paraswap_bnb_trades.sql | 1 + .../ethereum/paraswap_ethereum_trades.sql | 1 + .../fantom/paraswap_fantom_trades.sql | 1 + .../optimism/paraswap_optimism_trades.sql | 1 + models/paraswap/paraswap_trades.sql | 2 +- .../polygon/paraswap_polygon_trades.sql | 1 + .../fantom/spookyswap_fantom_pools.sql | 2 +- ...hiswap_optimism_pool_incentives_config.sql | 3 +- ...swap_optimism_pool_incentives_mappings.sql | 4 +- ...shiswap_optimism_pool_incentives_rates.sql | 3 +- .../syndicate_ethereum_dao_addresses.sql | 2 +- .../syndicate_polygon_dao_addresses.sql | 2 +- models/syndicate/syndicate_dao_addresses.sql | 2 +- ...is_arbitrum_events_contracts_positions.sql | 2 +- .../tigris_arbitrum_perpetual_trades.sql | 2 +- ...ris_polygon_events_contracts_positions.sql | 4 +- .../tigris_polygon_perpetual_trades.sql | 1 + models/tigris/tigris_options_trades.sql | 2 +- models/tigris/tigris_perpetual_trades.sql | 2 +- models/tigris/tigris_trades.sql | 2 +- .../arbitrum/timeswap_arbitrum_borrow.sql | 3 +- .../arbitrum/timeswap_arbitrum_lend.sql | 3 +- .../ethereum/timeswap_ethereum_borrow.sql | 3 +- .../ethereum/timeswap_ethereum_lend.sql | 3 +- .../polygon/timeswap_polygon_borrow.sql | 3 +- .../polygon/timeswap_polygon_lend.sql | 3 +- .../wigoswap/fantom/wigoswap_fantom_pools.sql | 2 +- models/zerion/zerion_trades.sql | 2 +- .../zodiac_ethereum_dao_addresses.sql | 2 +- 101 files changed, 120 insertions(+), 346 deletions(-) rename models/abi/{signatures_schema.yml => abi_schema.yml} (97%) rename models/abi/{signatures.sql => abi_signatures.sql} (100%) diff --git a/dbt_project.yml b/dbt_project.yml index a3617d0357f..e959f491c02 100644 --- a/dbt_project.yml +++ b/dbt_project.yml @@ -64,80 +64,9 @@ models: +schema: no_schema # this should be overridden in model specific configs +view_security: invoker - aave: - +schema: aave - ethereum: - +schema: aave_ethereum - optimism: - +schema: aave_optimism - - ens: - +schema: ens - ethereum: - +schema: ens_ethereum - - euler: - +schema: euler - ethereum: - +schema: euler_ethereum - - evms: - +schema: evms - - staking: - +schema: staking - ethereum: - +schema: staking_ethereum - dex: +schema: dex - airdrop: - +schema: airdrop - +materialized: table - ethereum: - +schema: airdrop_ethereum - optimism: - +schema: airdrop_optimism - arbitrum: - +schema: airdrop_arbitrum - avalanche_c: - +schema: airdrop_avalanche_c - bnb: - +schema: airdrop_bnb - gnosis: - +schema: airdrop_gnosis - - giveth: - +schema: giveth - gnosis: - +schema: giveth_gnosis - - ellipsis_finance: - +schema: ellipsis_finance - bnb: - +schema: ellipsis_finance_bnb - - arbitrum: - +schema: arbitrum - arbitrum: - +schema: arbitrum_arbitrum - - pangolin: - +schema: pangolin - avalanche_c: - +schema: pangolin_avalanche_c - - ampleforth: - +schema: ampleforth - ethereum: - +schema: ampleforth_ethereum - - velodrome: - +schema: velodrome - optimism: - +schema: velodrome_optimism - nft: +schema: nft ethereum: @@ -167,33 +96,6 @@ models: bitcoin: +schema: cex_bitcoin - compound: - +schema: compound - ethereum: - +schema: compound_ethereum - - gitcoin: - +schema: gitcoin - ethereum: - +schema: gitcoin_ethereum - polygon: - +schema: gitcoin_polygon - - blur: - +schema: blur - ethereum: - +schema: blur_ethereum - - looksrare: - +schema: looksrare - ethereum: - +schema: looksrare_ethereum - - x2y2: - +schema: x2y2 - ethereum: - +schema: x2y2_ethereum - uniswap: +schema: uniswap arbitrum: @@ -211,135 +113,6 @@ models: celo: +schema: uniswap_celo - timeswap: - +schema: timeswap - ethereum: - +schema: timeswap_ethereum - arbitrum: - +schema: timeswap_arbitrum - polygon: - +schema: timeswap_polygon - - paraswap: - +schema: paraswap - ethereum: - +schema: paraswap_ethereum - avalanche_c: - +schema: paraswap_avalanche_c - fantom: - +schema: paraswap_fantom - arbitrum: - +schema: paraswap_arbitrum - bnb: - +schema: paraswap_bnb - ethereum: - +schema: paraswap_ethereum - optimism: - +schema: paraswap_optimism - polygon: - +schema: paraswap_polygon - - opx_finance: - +schema: opx_finance - optimism: - +schema: opx_finance_optimism - - zodiac: - +schema: zodiac - ethereum: - +schema: zodiac_ethereum - - daohaus: - +schema: daohaus - ethereum: - +schema: daohaus_ethereum - gnosis: - +schema: daohaus_gnosis - - colony: - +schema: colony - gnosis: - +schema: colony_gnosis - - sushiswap: - optimism: - +schema: sushiswap_optimism - - zerion: - +schema: zerion - arbitrum: - +schema: zerion_arbitrum - avalanche_c: - +schema: zerion_avalanche_c - bnb: - +schema: zerion_bnb - gnosis: - +schema: zerion_gnosis - optimism: - +schema: zerion_optimism - polygon: - +schema: zerion_polygon - fantom: - +schema: zerion_fantom - - syndicate: - +schema: syndicate - ethereum: - +schema: syndicate_ethereum - polygon: - +schema: syndicate_polygon - - abi: - +schema: abi - - gas: - +schema: gas - ethereum: - +schema: gas_ethereum - bnb: - +schema: gas_bnb - avalanche_c: - +schema: gas_avalanche_c - optimism: - +schema: gas_optimism - arbitrum: - +schema: gas_arbitrum - polygon: - +schema: gas_polygon - fantom: - +schema: gas_fantom - gnosis: - +schema: gas_gnosis - - gmx: - +schema: gmx - arbitrum: - +schema: gmx_arbitrum - avalanche_c: - +schema: gmx_avalanche_c - - tigris: - +schema: tigris - arbitrum: - +schema: tigris_arbitrum - polygon: - +schema: tigris_polygon - - nomad: - +schema: nomad - ethereum: - +schema: nomad_ethereum - - wigoswap: - +schema: wigoswap - fantom: - +schema: wigoswap_fantom - - bend_dao: - +schema: bend_dao - ethereum: - +schema: bend_dao_ethereum - seaport: +schema: seaport ethereum: @@ -383,12 +156,6 @@ models: base: +schema: dodo_base - - spookyswap: - +schema: spookyswap - fantom: - +schema: spookyswap_fantom - labels: +schema: labels +materialized: table @@ -402,14 +169,6 @@ models: ethereum: +schema: addresses_ethereum - addresses_summary: - +schema: addresses_summary - - aztec: - +schema: aztec - ethereum: - +schema: aztec_ethereum - tokens: +schema: tokens +materialized: table @@ -628,23 +387,6 @@ models: polygon: +schema: kyberswap_polygon - hubble_exchange: - +schema: hubble_exchange - avalanche_c: - +schema: hubble_exchange_avalanche_c - - frax_finance: - +schema: frax_finance - +materialized: table - bnb: - +schema: frax_finance_bnb - +materialized: table - - emdx: - +schema: emdx - avalanche_c: - +schema: emdx_avalanche_c - hashflow: +schema: hashflow ethereum: @@ -791,11 +533,6 @@ models: ethereum: +schema: notional_ethereum - dydx: - +schema: dydx - ethereum: - +schema: dydx_ethereum - dappradar: +schema: dappradar ethereum: diff --git a/models/_project/balancer/balances/ethereum/balancer_ethereum_balances.sql b/models/_project/balancer/balances/ethereum/balancer_ethereum_balances.sql index aa584c6c39d..933945878eb 100644 --- a/models/_project/balancer/balances/ethereum/balancer_ethereum_balances.sql +++ b/models/_project/balancer/balances/ethereum/balancer_ethereum_balances.sql @@ -1,12 +1,12 @@ {{ config( - schema = 'balancer_ethereum', + schema = 'balancer_ethereum', alias = 'balances', - post_hook='{{ expose_spells(\'["ethereum"]\', + post_hook='{{ expose_spells(blockchains = \'["ethereum"]\', spell_type = "project", spell_name = "balancer", contributors = \'["metacrypto", "jacektrocinski", "viniabussafi"]\') }}' - )  + ) }} {% set balancer_contract = '0xba12222222228d8ba445958a75a0704d566bf2c8' %} diff --git a/models/_project/balancer/flashloans/balancer_flashloans.sql b/models/_project/balancer/flashloans/balancer_flashloans.sql index 19f69ad6231..745a41772e3 100644 --- a/models/_project/balancer/flashloans/balancer_flashloans.sql +++ b/models/_project/balancer/flashloans/balancer_flashloans.sql @@ -1,7 +1,7 @@ {{ config( schema = 'balancer', alias = 'flashloans', - post_hook='{{ expose_spells(blockchains = \'["arbitrum", "avalanche_c", "base", "ethereum", "gnosis", "optimism", "polygon", "zkevm"]\', + post_hook='{{ expose_spells(blockchains = \'["ethereum","arbitrum", "optimism", "polygon", "gnosis", "avalanche_c", "base", "zkevm"]\', spell_type = "project", spell_name = "balancer", contributors = \'["hildobby", "viniabussafi"]\') }}' diff --git a/models/_project/balancer/vebal/ethereum/balancer_ethereum_vebal_votes.sql b/models/_project/balancer/vebal/ethereum/balancer_ethereum_vebal_votes.sql index d52c0fe757f..0c619b96e5e 100644 --- a/models/_project/balancer/vebal/ethereum/balancer_ethereum_vebal_votes.sql +++ b/models/_project/balancer/vebal/ethereum/balancer_ethereum_vebal_votes.sql @@ -4,7 +4,7 @@ alias = 'vebal_votes', materialized = 'table', file_format = 'delta', - post_hook='{{ expose_spells(\'["ethereum"]\', + post_hook='{{ expose_spells(blockchains = \'["ethereum"]\', spell_type = "project", spell_name = "balancer", contributors = \'["markusbkoch", "mendesfabio", "stefenon", "viniabussafi"]\') }}' diff --git a/models/aave/aave_flashloans.sql b/models/aave/aave_flashloans.sql index 0f6c88eafd8..74c779d0337 100644 --- a/models/aave/aave_flashloans.sql +++ b/models/aave/aave_flashloans.sql @@ -1,5 +1,6 @@ {{ config( partition_by = ['block_month'] + , schema = 'aave' , alias = 'flashloans' , materialized = 'incremental' , file_format = 'delta' diff --git a/models/aave/ethereum/aave_ethereum_interest_rates.sql b/models/aave/ethereum/aave_ethereum_interest_rates.sql index 0737ea8ae2c..10994c3daa4 100644 --- a/models/aave/ethereum/aave_ethereum_interest_rates.sql +++ b/models/aave/ethereum/aave_ethereum_interest_rates.sql @@ -1,6 +1,7 @@ {{ config( - alias = 'interest' - , post_hook='{{ expose_spells(\'["ethereum"]\', + schema = 'aave_ethereum' + , alias = 'interest_rates' + , post_hook='{{ expose_spells(\'["ethereum"]\', "project", "aave", \'["batwayne", "chuxin"]\') }}' diff --git a/models/aave/optimism/aave_optimism_interest_rates.sql b/models/aave/optimism/aave_optimism_interest_rates.sql index d93fbfa64f1..80d1abc3729 100644 --- a/models/aave/optimism/aave_optimism_interest_rates.sql +++ b/models/aave/optimism/aave_optimism_interest_rates.sql @@ -1,6 +1,7 @@ {{ config( - alias = 'interest' - , post_hook='{{ expose_spells(\'["optimism"]\', + schema = 'aave_optimism' + , alias = 'interest_rates' + , post_hook='{{ expose_spells(\'["optimism"]\', "project", "aave", \'["batwayne", "chuxin"]\') }}' diff --git a/models/abi/signatures_schema.yml b/models/abi/abi_schema.yml similarity index 97% rename from models/abi/signatures_schema.yml rename to models/abi/abi_schema.yml index 1723ee21505..a94bada193a 100644 --- a/models/abi/signatures_schema.yml +++ b/models/abi/abi_schema.yml @@ -1,7 +1,7 @@ version: 2 models: - - name: signatures + - name: abi_signatures meta: blockchain: ['ethereum','optimism','polygon','arbitrum','avalanche_c','gnosis','bnb','fantom','celo','base'] sector: abi diff --git a/models/abi/signatures.sql b/models/abi/abi_signatures.sql similarity index 100% rename from models/abi/signatures.sql rename to models/abi/abi_signatures.sql diff --git a/models/addresses_summary/addresses_summary_op_mainnet.sql b/models/addresses_summary/addresses_summary_op_mainnet.sql index 4a6370c275d..9f086023743 100644 --- a/models/addresses_summary/addresses_summary_op_mainnet.sql +++ b/models/addresses_summary/addresses_summary_op_mainnet.sql @@ -1,5 +1,5 @@ {{ config( - + schema='addresses_summary', alias = 'op_mainnet', materialized='incremental', file_format = 'delta', diff --git a/models/airdrop/airdrop_claims.sql b/models/airdrop/airdrop_claims.sql index 3dc2f572f84..906271faa65 100644 --- a/models/airdrop/airdrop_claims.sql +++ b/models/airdrop/airdrop_claims.sql @@ -1,5 +1,5 @@ {{ config( - + schema = 'airdrop', alias = 'claims', materialized = 'incremental', file_format = 'delta', diff --git a/models/airdrop/arbitrum/airdrop_arbitrum_claims.sql b/models/airdrop/arbitrum/airdrop_arbitrum_claims.sql index 6efbf712cb4..0f08344055b 100644 --- a/models/airdrop/arbitrum/airdrop_arbitrum_claims.sql +++ b/models/airdrop/arbitrum/airdrop_arbitrum_claims.sql @@ -1,5 +1,5 @@ {{ config( - + schema = 'airdrop_arbitrum', alias = 'claims', post_hook='{{ expose_spells(\'["arbitrum"]\', "sector", diff --git a/models/airdrop/avalanche_c/airdrop_avalanche_c_claims.sql b/models/airdrop/avalanche_c/airdrop_avalanche_c_claims.sql index 9fed6c58de0..b0a9c6393ce 100644 --- a/models/airdrop/avalanche_c/airdrop_avalanche_c_claims.sql +++ b/models/airdrop/avalanche_c/airdrop_avalanche_c_claims.sql @@ -1,5 +1,5 @@ {{ config( - + schema = 'airdrop_avalanche_c', alias = 'claims', post_hook='{{ expose_spells(\'["avalanche_c"]\', "sector", diff --git a/models/airdrop/bnb/airdrop_bnb_claims.sql b/models/airdrop/bnb/airdrop_bnb_claims.sql index 120e0aafe3c..2e9c9793e54 100644 --- a/models/airdrop/bnb/airdrop_bnb_claims.sql +++ b/models/airdrop/bnb/airdrop_bnb_claims.sql @@ -1,5 +1,5 @@ {{ config( - + schema = 'airdrop_bnb', alias = 'claims', post_hook='{{ expose_spells(\'["bnb"]\', "sector", diff --git a/models/airdrop/ethereum/airdrop_ethereum_claims.sql b/models/airdrop/ethereum/airdrop_ethereum_claims.sql index 2950edf7744..b71c07d08ba 100644 --- a/models/airdrop/ethereum/airdrop_ethereum_claims.sql +++ b/models/airdrop/ethereum/airdrop_ethereum_claims.sql @@ -1,5 +1,5 @@ {{ config( - + schema = 'airdrop_ethereum', alias = 'claims', post_hook='{{ expose_spells(\'["ethereum"]\', "sector", diff --git a/models/airdrop/gnosis/airdrop_gnosis_claims.sql b/models/airdrop/gnosis/airdrop_gnosis_claims.sql index 971e30fd5a8..627c8b5acc7 100644 --- a/models/airdrop/gnosis/airdrop_gnosis_claims.sql +++ b/models/airdrop/gnosis/airdrop_gnosis_claims.sql @@ -1,5 +1,5 @@ {{ config( - + schema = 'airdrop_gnosis', alias = 'claims', post_hook='{{ expose_spells(\'["gnosis"]\', "sector", diff --git a/models/bend_dao/ethereum/bend_dao_ethereum_lending.sql b/models/bend_dao/ethereum/bend_dao_ethereum_lending.sql index a8601723cec..cd6846343c1 100644 --- a/models/bend_dao/ethereum/bend_dao_ethereum_lending.sql +++ b/models/bend_dao/ethereum/bend_dao_ethereum_lending.sql @@ -1,5 +1,5 @@ {{ config( - + schema = 'bend_dao_ethereum', alias = 'lending', partition_by = ['block_month'], materialized = 'incremental', diff --git a/models/bend_dao/ethereum/bend_dao_ethereum_schema.yml b/models/bend_dao/ethereum/bend_dao_ethereum_schema.yml index 8ce8214e023..37bf1b10e7f 100644 --- a/models/bend_dao/ethereum/bend_dao_ethereum_schema.yml +++ b/models/bend_dao/ethereum/bend_dao_ethereum_schema.yml @@ -27,7 +27,7 @@ models: - tx_hash - token_id check_columns: - - amount_original +# - amount_original - evt_type - borrower columns: diff --git a/models/colony/gnosis/colony_gnosis_dao_addresses.sql b/models/colony/gnosis/colony_gnosis_dao_addresses.sql index 6428df1acac..ab5d29a300f 100644 --- a/models/colony/gnosis/colony_gnosis_dao_addresses.sql +++ b/models/colony/gnosis/colony_gnosis_dao_addresses.sql @@ -1,6 +1,6 @@ {{ config( alias = 'dao_addresses', - + schema = 'colony_gnosis', partition_by = ['block_month'], materialized = 'incremental', file_format = 'delta', diff --git a/models/daohaus/daohaus_dao_addresses.sql b/models/daohaus/daohaus_dao_addresses.sql index 611d03a60b6..d5e218578a6 100644 --- a/models/daohaus/daohaus_dao_addresses.sql +++ b/models/daohaus/daohaus_dao_addresses.sql @@ -1,5 +1,5 @@ {{ config( - + schema = 'daohaus', alias = 'dao_addresses', materialized = 'view', file_format = 'delta', diff --git a/models/daohaus/ethereum/daohaus_ethereum_dao_addresses.sql b/models/daohaus/ethereum/daohaus_ethereum_dao_addresses.sql index 2a2aca650ca..20bf5112be4 100644 --- a/models/daohaus/ethereum/daohaus_ethereum_dao_addresses.sql +++ b/models/daohaus/ethereum/daohaus_ethereum_dao_addresses.sql @@ -1,6 +1,6 @@ {{ config( alias = 'dao_addresses', - + schema = 'daohaus_ethereum', partition_by = ['block_month'], materialized = 'incremental', file_format = 'delta', diff --git a/models/daohaus/gnosis/daohaus_gnosis_dao_addresses.sql b/models/daohaus/gnosis/daohaus_gnosis_dao_addresses.sql index 7b8472e0a75..29fc5449df7 100644 --- a/models/daohaus/gnosis/daohaus_gnosis_dao_addresses.sql +++ b/models/daohaus/gnosis/daohaus_gnosis_dao_addresses.sql @@ -1,6 +1,6 @@ {{ config( alias = 'dao_addresses', - + schema = 'daohaus_gnosis', partition_by = ['block_month'], materialized = 'incremental', file_format = 'delta', diff --git a/models/ellipsis_finance/bnb/ellipsis_finance_bnb_pool_tokens.sql b/models/ellipsis_finance/bnb/ellipsis_finance_bnb_pool_tokens.sql index c0448bec94f..4154219538f 100644 --- a/models/ellipsis_finance/bnb/ellipsis_finance_bnb_pool_tokens.sql +++ b/models/ellipsis_finance/bnb/ellipsis_finance_bnb_pool_tokens.sql @@ -1,5 +1,5 @@ {{ config( - + schema='ellipsis_finance_bnb', alias = 'pool_tokens', materialized = 'incremental', file_format = 'delta', diff --git a/models/emdx/avalanche_c/emdx_avalanche_c_perpetual_trades.sql b/models/emdx/avalanche_c/emdx_avalanche_c_perpetual_trades.sql index 62267758764..a32d2a677fd 100644 --- a/models/emdx/avalanche_c/emdx_avalanche_c_perpetual_trades.sql +++ b/models/emdx/avalanche_c/emdx_avalanche_c_perpetual_trades.sql @@ -1,5 +1,5 @@ {{ config( - + schema = 'emdx_avalanche_c', alias = 'perpetual_trades', partition_by = ['block_month'], materialized = 'incremental', diff --git a/models/ens/ens_node_names.sql b/models/ens/ens_node_names.sql index f3fc1941ee2..4879ee6ca7c 100644 --- a/models/ens/ens_node_names.sql +++ b/models/ens/ens_node_names.sql @@ -1,4 +1,5 @@ {{ config( + schema = 'ens', alias = 'node_names', materialized = 'incremental', file_format = 'delta', diff --git a/models/ens/ens_resolver_latest.sql b/models/ens/ens_resolver_latest.sql index 871c991d333..586346e7496 100644 --- a/models/ens/ens_resolver_latest.sql +++ b/models/ens/ens_resolver_latest.sql @@ -1,4 +1,5 @@ {{ config( + schema = 'ens', alias = 'resolver_latest', post_hook='{{ expose_spells(\'["ethereum"]\', diff --git a/models/ens/ens_resolver_records.sql b/models/ens/ens_resolver_records.sql index 1bc26131dce..a57efb8393b 100644 --- a/models/ens/ens_resolver_records.sql +++ b/models/ens/ens_resolver_records.sql @@ -1,4 +1,5 @@ {{ config( + schema = 'ens', alias = 'resolver_records', materialized = 'incremental', diff --git a/models/ens/ens_reverse_latest.sql b/models/ens/ens_reverse_latest.sql index e34a43d738f..6bfea20f297 100644 --- a/models/ens/ens_reverse_latest.sql +++ b/models/ens/ens_reverse_latest.sql @@ -1,4 +1,5 @@ {{ config( + schema = 'ens', alias = 'reverse_latest', materialized = 'incremental', diff --git a/models/ens/ens_set_name_latest.sql b/models/ens/ens_set_name_latest.sql index 4c77f6ecf87..224a0976f4a 100644 --- a/models/ens/ens_set_name_latest.sql +++ b/models/ens/ens_set_name_latest.sql @@ -1,6 +1,7 @@ {{ config( - alias = 'set_name_latest' + schema = 'ens' + ,alias = 'set_name_latest' ,materialized = 'table' ,file_format = 'delta' diff --git a/models/ens/ens_view_expirations.sql b/models/ens/ens_view_expirations.sql index 99e23143b2b..2d7c7f27de2 100644 --- a/models/ens/ens_view_expirations.sql +++ b/models/ens/ens_view_expirations.sql @@ -1,5 +1,5 @@ {{config( - + schema='ens', alias = 'view_expirations', post_hook='{{ expose_spells(\'["ethereum"]\', "project", diff --git a/models/ens/ens_view_registrations.sql b/models/ens/ens_view_registrations.sql index 6cfb6604d86..74db5cec76e 100644 --- a/models/ens/ens_view_registrations.sql +++ b/models/ens/ens_view_registrations.sql @@ -1,4 +1,5 @@ {{config( + schema = 'ens', alias = 'view_registrations', post_hook='{{ expose_spells(\'["ethereum"]\', diff --git a/models/ens/ens_view_registries.sql b/models/ens/ens_view_registries.sql index 67d7b15013e..959fdbd4248 100644 --- a/models/ens/ens_view_registries.sql +++ b/models/ens/ens_view_registries.sql @@ -1,6 +1,6 @@ {{config( - - alias = 'view_registries', + schema = 'ens', + alias = 'view_registries', post_hook='{{ expose_spells(\'["ethereum"]\', "project", "ens", diff --git a/models/ens/ens_view_renewals.sql b/models/ens/ens_view_renewals.sql index af0c7b5a610..ebd4c043a0c 100644 --- a/models/ens/ens_view_renewals.sql +++ b/models/ens/ens_view_renewals.sql @@ -1,5 +1,5 @@ {{config( - + schema = 'ens', alias = 'view_renewals', post_hook='{{ expose_spells(\'["ethereum"]\', "project", diff --git a/models/euler/ethereum/euler_ethereum_flashloans.sql b/models/euler/ethereum/euler_ethereum_flashloans.sql index b0f20d6c205..347e57ae958 100644 --- a/models/euler/ethereum/euler_ethereum_flashloans.sql +++ b/models/euler/ethereum/euler_ethereum_flashloans.sql @@ -1,5 +1,6 @@ {{ config( - alias = 'flashloans' + schema = 'euler_ethereum' + , alias = 'flashloans' , partition_by = ['block_month'] , materialized = 'incremental' , file_format = 'delta' diff --git a/models/evms/evms_blocks.sql b/models/evms/evms_blocks.sql index 1a4888f1306..def6f5e88c0 100644 --- a/models/evms/evms_blocks.sql +++ b/models/evms/evms_blocks.sql @@ -1,5 +1,5 @@ {{ config( - + schema='evms', alias = 'blocks', unique_key=['blockchain', 'number'], post_hook='{{ expose_spells(\'["ethereum", "polygon", "bnb", "avalanche_c", "gnosis", "fantom", "optimism", "arbitrum", "celo", "base", "goerli", "zksync", "zora", "scroll"]\', diff --git a/models/evms/evms_contracts.sql b/models/evms/evms_contracts.sql index 933d9149800..7780ff075ce 100644 --- a/models/evms/evms_contracts.sql +++ b/models/evms/evms_contracts.sql @@ -1,5 +1,5 @@ {{ config( - + schema='evms', alias = 'contracts', unique_key=['blockchain', 'address', 'created_at'], post_hook='{{ expose_spells(\'["ethereum", "polygon", "bnb", "avalanche_c", "gnosis", "fantom", "optimism", "arbitrum", "celo", "base", "goerli", "zksync", "zora", "scroll"]\', diff --git a/models/evms/evms_creation_traces.sql b/models/evms/evms_creation_traces.sql index 2387fb81a2f..73423299cd4 100644 --- a/models/evms/evms_creation_traces.sql +++ b/models/evms/evms_creation_traces.sql @@ -1,5 +1,5 @@ {{ config( - + schema='evms', alias = 'creation_traces', unique_key=['blockchain', 'tx_hash', 'evt_index'], post_hook='{{ expose_spells(\'["ethereum", "polygon", "bnb", "avalanche_c", "gnosis", "fantom", "optimism", "arbitrum", "celo", "base", "goerli", "zksync", "zora", "scroll"]\', diff --git a/models/evms/evms_erc1155_approvalsforall.sql b/models/evms/evms_erc1155_approvalsforall.sql index a35c691d240..666cd015993 100644 --- a/models/evms/evms_erc1155_approvalsforall.sql +++ b/models/evms/evms_erc1155_approvalsforall.sql @@ -1,5 +1,5 @@ {{ config( - + schema='evms', alias = 'erc1155_approvalsforall', unique_key=['blockchain', 'tx_hash', 'evt_index'], post_hook='{{ expose_spells(\'["ethereum", "polygon", "bnb", "avalanche_c", "gnosis", "fantom", "optimism", "arbitrum", "celo", "base", "goerli", "zksync", "zora", "scroll"]\', diff --git a/models/evms/evms_erc1155_transfersbatch.sql b/models/evms/evms_erc1155_transfersbatch.sql index 03f18bf92ee..907e3e463b5 100644 --- a/models/evms/evms_erc1155_transfersbatch.sql +++ b/models/evms/evms_erc1155_transfersbatch.sql @@ -1,5 +1,5 @@ {{ config( - + schema='evms', alias = 'erc1155_transfersbatch', unique_key=['blockchain', 'tx_hash', 'evt_index'], post_hook='{{ expose_spells(\'["ethereum", "polygon", "bnb", "avalanche_c", "gnosis", "fantom", "optimism", "arbitrum", "celo", "base", "goerli", "zksync", "zora", "scroll"]\', diff --git a/models/evms/evms_erc1155_transferssingle.sql b/models/evms/evms_erc1155_transferssingle.sql index 99c9b8f80af..c17a01a4fe8 100644 --- a/models/evms/evms_erc1155_transferssingle.sql +++ b/models/evms/evms_erc1155_transferssingle.sql @@ -1,5 +1,5 @@ {{ config( - + schema='evms', alias = 'erc1155_transferssingle', unique_key=['blockchain', 'tx_hash', 'evt_index'], post_hook='{{ expose_spells(\'["ethereum", "polygon", "bnb", "avalanche_c", "gnosis", "fantom", "optimism", "arbitrum", "celo", "base", "goerli", "zksync", "zora", "scroll"]\', diff --git a/models/evms/evms_erc20_approvals.sql b/models/evms/evms_erc20_approvals.sql index 99fc11440f3..38827e4848f 100644 --- a/models/evms/evms_erc20_approvals.sql +++ b/models/evms/evms_erc20_approvals.sql @@ -1,5 +1,5 @@ {{ config( - + schema='evms', alias = 'erc20_approvals', unique_key=['blockchain', 'tx_hash', 'evt_index'], post_hook='{{ expose_spells(\'["ethereum", "polygon", "bnb", "avalanche_c", "gnosis", "fantom", "optimism", "arbitrum", "celo", "base", "goerli", "zksync", "zora", "scroll"]\', diff --git a/models/evms/evms_erc20_transfers.sql b/models/evms/evms_erc20_transfers.sql index b043be9d9cf..59db0a8eaf0 100644 --- a/models/evms/evms_erc20_transfers.sql +++ b/models/evms/evms_erc20_transfers.sql @@ -1,5 +1,5 @@ {{ config( - + schema='evms', alias = 'erc20_transfers', unique_key=['blockchain', 'tx_hash', 'evt_index'], post_hook='{{ expose_spells(\'["ethereum", "polygon", "bnb", "avalanche_c", "gnosis", "fantom", "optimism", "arbitrum", "celo", "base", "goerli", "zksync", "zora", "scroll"]\', diff --git a/models/evms/evms_erc721_approvals.sql b/models/evms/evms_erc721_approvals.sql index 7b9a927b8a0..9e8b1465e08 100644 --- a/models/evms/evms_erc721_approvals.sql +++ b/models/evms/evms_erc721_approvals.sql @@ -1,5 +1,5 @@ {{ config( - + schema='evms', alias = 'erc721_approvals', unique_key=['blockchain', 'tx_hash', 'evt_index'], post_hook='{{ expose_spells(\'["ethereum", "polygon", "bnb", "avalanche_c", "gnosis", "fantom", "optimism", "arbitrum", "celo", "base", "goerli", "zksync", "zora", "scroll"]\', diff --git a/models/evms/evms_erc721_approvalsforall.sql b/models/evms/evms_erc721_approvalsforall.sql index 0bac19cb182..31b238d21a5 100644 --- a/models/evms/evms_erc721_approvalsforall.sql +++ b/models/evms/evms_erc721_approvalsforall.sql @@ -1,5 +1,5 @@ {{ config( - + schema='evms', alias = 'erc721_approvalsforall', unique_key=['blockchain', 'tx_hash', 'evt_index'], post_hook='{{ expose_spells(\'["ethereum", "polygon", "bnb", "avalanche_c", "gnosis", "fantom", "optimism", "arbitrum", "celo", "base", "goerli", "zksync", "zora", "scroll"]\', diff --git a/models/evms/evms_erc721_transfers.sql b/models/evms/evms_erc721_transfers.sql index 89a204bf60f..4e0b9fedcb1 100644 --- a/models/evms/evms_erc721_transfers.sql +++ b/models/evms/evms_erc721_transfers.sql @@ -1,5 +1,5 @@ {{ config( - + schema='evms', alias = 'erc721_transfers', unique_key=['blockchain', 'tx_hash', 'evt_index'], post_hook='{{ expose_spells(\'["ethereum", "polygon", "bnb", "avalanche_c", "gnosis", "fantom", "optimism", "arbitrum", "celo", "base", "goerli", "zksync", "zora", "scroll"]\', diff --git a/models/evms/evms_info.sql b/models/evms/evms_info.sql index e4a08bac732..a85cf05f6f5 100644 --- a/models/evms/evms_info.sql +++ b/models/evms/evms_info.sql @@ -1,4 +1,5 @@ {{ config( + schema='evms', tags = [ 'static'], alias = 'info', post_hook='{{ expose_spells(\'["ethereum", "polygon", "bnb", "avalanche_c", "gnosis", "fantom", "optimism", "arbitrum", "celo", "base", "goerli", "zksync", "zora", "scroll"]\', diff --git a/models/evms/evms_logs.sql b/models/evms/evms_logs.sql index 1bc4d654a67..0632fd86fa2 100644 --- a/models/evms/evms_logs.sql +++ b/models/evms/evms_logs.sql @@ -1,5 +1,5 @@ {{ config( - + schema='evms', alias = 'logs', unique_key=['blockchain', 'tx_hash'], post_hook='{{ expose_spells(\'["ethereum", "polygon", "bnb", "avalanche_c", "gnosis", "fantom", "optimism", "arbitrum", "celo", "base", "goerli", "zksync", "zora", "scroll"]\', diff --git a/models/evms/evms_logs_decoded.sql b/models/evms/evms_logs_decoded.sql index b8e6be6d4ef..2ece7f0b366 100644 --- a/models/evms/evms_logs_decoded.sql +++ b/models/evms/evms_logs_decoded.sql @@ -1,5 +1,5 @@ {{ config( - + schema='evms', alias = 'logs_decoded', unique_key=['blockchain', 'tx_hash'], post_hook='{{ expose_spells(\'["ethereum", "polygon", "bnb", "avalanche_c", "gnosis", "fantom", "optimism", "arbitrum", "celo", "base", "goerli", "zksync", "zora", "scroll"]\', diff --git a/models/evms/evms_traces.sql b/models/evms/evms_traces.sql index 7f03d36b88f..7657eeb9de4 100644 --- a/models/evms/evms_traces.sql +++ b/models/evms/evms_traces.sql @@ -1,5 +1,5 @@ {{ config( - + schema='evms', alias = 'traces', unique_key=['blockchain', 'tx_hash', 'evt_index'], post_hook='{{ expose_spells(\'["ethereum", "polygon", "bnb", "avalanche_c", "gnosis", "fantom", "optimism", "arbitrum", "celo", "base", "goerli", "zksync", "zora", "scroll"]\', diff --git a/models/evms/evms_traces_decoded.sql b/models/evms/evms_traces_decoded.sql index fa1e4e5b87b..69318066244 100644 --- a/models/evms/evms_traces_decoded.sql +++ b/models/evms/evms_traces_decoded.sql @@ -1,5 +1,5 @@ {{ config( - + schema='evms', alias = 'traces_decoded', unique_key=['blockchain', 'tx_hash', 'evt_index'], post_hook='{{ expose_spells(\'["ethereum", "polygon", "bnb", "avalanche_c", "gnosis", "fantom", "optimism", "arbitrum", "celo", "base", "goerli", "zksync", "zora", "scroll"]\', diff --git a/models/evms/evms_transactions.sql b/models/evms/evms_transactions.sql index ce8dffbac1a..413bc3cdd31 100644 --- a/models/evms/evms_transactions.sql +++ b/models/evms/evms_transactions.sql @@ -1,5 +1,5 @@ {{ config( - + schema='evms', alias = 'transactions', unique_key=['blockchain', 'tx_hash', 'evt_index'], post_hook='{{ expose_spells(\'["ethereum", "polygon", "bnb", "avalanche_c", "gnosis", "fantom", "optimism", "arbitrum", "celo", "base", "goerli", "zksync", "zora", "scroll"]\', diff --git a/models/frax_finance/bnb/frax_finance_bnb_bribes.sql b/models/frax_finance/bnb/frax_finance_bnb_bribes.sql index 4ebd73a166f..796f3bb20b0 100644 --- a/models/frax_finance/bnb/frax_finance_bnb_bribes.sql +++ b/models/frax_finance/bnb/frax_finance_bnb_bribes.sql @@ -1,7 +1,8 @@ {{ config( + schema = 'frax_finance_bnb', alias = 'bribes', materialized = 'table', - + file_format = 'delta', unique_key = ['week_start', 'week_end', 'contract_address'], post_hook = '{{ expose_spells(\'["bnb"]\', diff --git a/models/gas/gas_fees.sql b/models/gas/gas_fees.sql index e816bd209de..dfc5beb0a3e 100644 --- a/models/gas/gas_fees.sql +++ b/models/gas/gas_fees.sql @@ -1,5 +1,5 @@ {{ config( - + schema = 'gas', alias = 'fees', post_hook='{{ expose_spells(\'["ethereum","bnb","avalanche_c","optimism","arbitrum","zksync","zora","base","scroll"]\', "sector", diff --git a/models/gitcoin/ethereum/gitcoin_ethereum_donations.sql b/models/gitcoin/ethereum/gitcoin_ethereum_donations.sql index e35c056740b..b60b35aae70 100644 --- a/models/gitcoin/ethereum/gitcoin_ethereum_donations.sql +++ b/models/gitcoin/ethereum/gitcoin_ethereum_donations.sql @@ -1,5 +1,5 @@ {{ config( - + schema = 'gitcoin_ethereum', alias = 'donations', partition_by = ['block_month'], materialized = 'incremental', diff --git a/models/gitcoin/gitcoin_donations.sql b/models/gitcoin/gitcoin_donations.sql index 654f867d78d..de714c6a942 100644 --- a/models/gitcoin/gitcoin_donations.sql +++ b/models/gitcoin/gitcoin_donations.sql @@ -1,5 +1,5 @@ {{ config( - + schema = 'gitcoin', alias = 'donations', partition_by = ['block_month'], materialized = 'incremental', diff --git a/models/gitcoin/gitcoin_grant_round_dates.sql b/models/gitcoin/gitcoin_grant_round_dates.sql index 19a4b08278c..933f221ce13 100644 --- a/models/gitcoin/gitcoin_grant_round_dates.sql +++ b/models/gitcoin/gitcoin_grant_round_dates.sql @@ -1,5 +1,6 @@ {{ config( - alias = 'grant_round_dates' + schema = 'gitcoin' + , alias = 'grant_round_dates' , tags=['static'] ) }} diff --git a/models/gitcoin/polygon/gitcoin_polygon_donations.sql b/models/gitcoin/polygon/gitcoin_polygon_donations.sql index 58021bd4d8b..4553483a7cf 100644 --- a/models/gitcoin/polygon/gitcoin_polygon_donations.sql +++ b/models/gitcoin/polygon/gitcoin_polygon_donations.sql @@ -1,5 +1,5 @@ {{ config( - + schema = 'gitcoin_polygon', alias = 'donations', partition_by = ['block_month'], materialized = 'incremental', diff --git a/models/gmx/arbitrum/glp/gmx_arbitrum_glp_aum.sql b/models/gmx/arbitrum/glp/gmx_arbitrum_glp_aum.sql index 7bb37904a48..d72c7e59eee 100644 --- a/models/gmx/arbitrum/glp/gmx_arbitrum_glp_aum.sql +++ b/models/gmx/arbitrum/glp/gmx_arbitrum_glp_aum.sql @@ -1,5 +1,6 @@ {{ config( tags=['prod_exclude'], + schema = 'gmx_arbitrum', alias = 'glp_aum', partition_by = ['block_date'], materialized = 'incremental', diff --git a/models/gmx/arbitrum/glp/gmx_arbitrum_glp_components.sql b/models/gmx/arbitrum/glp/gmx_arbitrum_glp_components.sql index d5d53175b94..3b5913bde31 100644 --- a/models/gmx/arbitrum/glp/gmx_arbitrum_glp_components.sql +++ b/models/gmx/arbitrum/glp/gmx_arbitrum_glp_components.sql @@ -1,5 +1,6 @@ {{ config( tags=['prod_exclude'], + schema = 'gmx_arbitrum', alias = 'glp_components', partition_by = ['block_date'], materialized = 'incremental', diff --git a/models/gmx/arbitrum/glp/gmx_arbitrum_glp_components_base.sql b/models/gmx/arbitrum/glp/gmx_arbitrum_glp_components_base.sql index f04fa45f521..363dbcf96cd 100644 --- a/models/gmx/arbitrum/glp/gmx_arbitrum_glp_components_base.sql +++ b/models/gmx/arbitrum/glp/gmx_arbitrum_glp_components_base.sql @@ -1,5 +1,6 @@ {{ config( tags=['prod_exclude'], + schema = 'gmx_arbitrum', alias = 'glp_components_base', partition_by = ['block_date'], materialized = 'incremental', diff --git a/models/gmx/arbitrum/glp/gmx_arbitrum_glp_fees.sql b/models/gmx/arbitrum/glp/gmx_arbitrum_glp_fees.sql index 500dafaf9d4..4febf8c7140 100644 --- a/models/gmx/arbitrum/glp/gmx_arbitrum_glp_fees.sql +++ b/models/gmx/arbitrum/glp/gmx_arbitrum_glp_fees.sql @@ -1,5 +1,6 @@ {{ config( tags=['prod_exclude'], + schema = 'gmx_arbitrum', alias = 'glp_fees', partition_by = ['block_date'], materialized = 'incremental', diff --git a/models/gmx/arbitrum/glp/gmx_arbitrum_glp_float.sql b/models/gmx/arbitrum/glp/gmx_arbitrum_glp_float.sql index 9531c0179cb..5a6bd4690a2 100644 --- a/models/gmx/arbitrum/glp/gmx_arbitrum_glp_float.sql +++ b/models/gmx/arbitrum/glp/gmx_arbitrum_glp_float.sql @@ -1,5 +1,6 @@ {{ config( tags=['prod_exclude'], + schema = 'gmx_arbitrum', alias = 'glp_float', partition_by = ['block_date'], materialized = 'incremental', diff --git a/models/gmx/arbitrum/gmx_arbitrum_perpetual_trades.sql b/models/gmx/arbitrum/gmx_arbitrum_perpetual_trades.sql index 05069008326..f5de4e2f00f 100644 --- a/models/gmx/arbitrum/gmx_arbitrum_perpetual_trades.sql +++ b/models/gmx/arbitrum/gmx_arbitrum_perpetual_trades.sql @@ -1,5 +1,5 @@ {{ config( - + schema = 'gmx_arbitrum', alias = 'perpetual_trades', partition_by = ['block_month'], materialized = 'incremental', diff --git a/models/gmx/arbitrum/vault/gmx_arbitrum_vault_balances.sql b/models/gmx/arbitrum/vault/gmx_arbitrum_vault_balances.sql index 4d694856e23..ff161a50ef8 100644 --- a/models/gmx/arbitrum/vault/gmx_arbitrum_vault_balances.sql +++ b/models/gmx/arbitrum/vault/gmx_arbitrum_vault_balances.sql @@ -1,5 +1,6 @@ {{ config( tags=['prod_exclude'], + schema = 'gmx_arbitrum', alias = 'vault_balances', partition_by = ['block_date'], materialized = 'incremental', diff --git a/models/gmx/avalanche_c/glp/gmx_avalanche_c_glp_aum.sql b/models/gmx/avalanche_c/glp/gmx_avalanche_c_glp_aum.sql index 45ecebae53b..3800c11efc8 100644 --- a/models/gmx/avalanche_c/glp/gmx_avalanche_c_glp_aum.sql +++ b/models/gmx/avalanche_c/glp/gmx_avalanche_c_glp_aum.sql @@ -1,5 +1,6 @@ {{ config( tags=['prod_exclude'], + schema = 'gmx_avalanche_c', alias = 'glp_aum', partition_by = ['block_date'], materialized = 'incremental', diff --git a/models/gmx/avalanche_c/glp/gmx_avalanche_c_glp_components.sql b/models/gmx/avalanche_c/glp/gmx_avalanche_c_glp_components.sql index e5db4c87efb..b9d92b3ab42 100644 --- a/models/gmx/avalanche_c/glp/gmx_avalanche_c_glp_components.sql +++ b/models/gmx/avalanche_c/glp/gmx_avalanche_c_glp_components.sql @@ -1,5 +1,6 @@ {{ config( tags=['prod_exclude'], + schema = 'gmx_avalanche_c', alias = 'glp_components', materialized = 'incremental', partition_by = ['block_date'], diff --git a/models/gmx/avalanche_c/gmx_avalanche_c_perpetual_trades.sql b/models/gmx/avalanche_c/gmx_avalanche_c_perpetual_trades.sql index 760793c842d..09a13ae0333 100644 --- a/models/gmx/avalanche_c/gmx_avalanche_c_perpetual_trades.sql +++ b/models/gmx/avalanche_c/gmx_avalanche_c_perpetual_trades.sql @@ -1,5 +1,5 @@ {{ config( - + schema = 'gmx_avalanche_c', alias = 'perpetual_trades', partition_by = ['block_month'], materialized = 'incremental', diff --git a/models/gmx/gmx_perpetual_trades.sql b/models/gmx/gmx_perpetual_trades.sql index ebb424c5839..c6cee8de085 100644 --- a/models/gmx/gmx_perpetual_trades.sql +++ b/models/gmx/gmx_perpetual_trades.sql @@ -1,5 +1,5 @@ {{ config( - + schema = 'gmx', alias = 'perpetual_trades', post_hook='{{ expose_spells(\'["avalanche_c","arbitrum"]\', "project", diff --git a/models/hubble_exchange/avalanche_c/hubble_exchange_avalanche_c_perpetual_trades.sql b/models/hubble_exchange/avalanche_c/hubble_exchange_avalanche_c_perpetual_trades.sql index e9a4dfaea4f..14ad9006853 100644 --- a/models/hubble_exchange/avalanche_c/hubble_exchange_avalanche_c_perpetual_trades.sql +++ b/models/hubble_exchange/avalanche_c/hubble_exchange_avalanche_c_perpetual_trades.sql @@ -1,5 +1,5 @@ {{ config( - + schema = 'hubble_exchange_avalanche_c', alias = 'perpetual_trades', partition_by = ['block_month'], materialized = 'incremental', diff --git a/models/nomad/ethereum/nomad_ethereum_view_bridge_transactions.sql b/models/nomad/ethereum/nomad_ethereum_view_bridge_transactions.sql index a4fec2ba7f8..36d8db9e573 100644 --- a/models/nomad/ethereum/nomad_ethereum_view_bridge_transactions.sql +++ b/models/nomad/ethereum/nomad_ethereum_view_bridge_transactions.sql @@ -1,6 +1,6 @@ {{ config( - + schema='nomad_ethereum', alias='view_bridge_transactions', post_hook='{{ expose_spells(\'["ethereum"]\', "project", diff --git a/models/paraswap/arbitrum/paraswap_arbitrum_trades.sql b/models/paraswap/arbitrum/paraswap_arbitrum_trades.sql index 0095ceff518..4f60800cc5f 100644 --- a/models/paraswap/arbitrum/paraswap_arbitrum_trades.sql +++ b/models/paraswap/arbitrum/paraswap_arbitrum_trades.sql @@ -1,4 +1,5 @@ {{ config( + schema='paraswap_arbitrum', alias = 'trades', ) diff --git a/models/paraswap/avalanche_c/paraswap_avalanche_c_trades.sql b/models/paraswap/avalanche_c/paraswap_avalanche_c_trades.sql index 5c51a92b1d1..40dc6bae96f 100644 --- a/models/paraswap/avalanche_c/paraswap_avalanche_c_trades.sql +++ b/models/paraswap/avalanche_c/paraswap_avalanche_c_trades.sql @@ -1,4 +1,5 @@ {{ config( + schema='paraswap_avalanche_c', alias = 'trades', ) diff --git a/models/paraswap/bnb/paraswap_bnb_trades.sql b/models/paraswap/bnb/paraswap_bnb_trades.sql index d0e562773b5..d071b81c80e 100644 --- a/models/paraswap/bnb/paraswap_bnb_trades.sql +++ b/models/paraswap/bnb/paraswap_bnb_trades.sql @@ -1,4 +1,5 @@ {{ config( + schema='paraswap_bnb', alias = 'trades', ) diff --git a/models/paraswap/ethereum/paraswap_ethereum_trades.sql b/models/paraswap/ethereum/paraswap_ethereum_trades.sql index 003d65c50e6..916ebcf88cc 100644 --- a/models/paraswap/ethereum/paraswap_ethereum_trades.sql +++ b/models/paraswap/ethereum/paraswap_ethereum_trades.sql @@ -1,4 +1,5 @@ {{ config( + schema='paraswap_ethereum', alias = 'trades', ) diff --git a/models/paraswap/fantom/paraswap_fantom_trades.sql b/models/paraswap/fantom/paraswap_fantom_trades.sql index 97495319383..080b9834120 100644 --- a/models/paraswap/fantom/paraswap_fantom_trades.sql +++ b/models/paraswap/fantom/paraswap_fantom_trades.sql @@ -1,4 +1,5 @@ {{ config( + schema='paraswap_fantom', alias = 'trades', ) diff --git a/models/paraswap/optimism/paraswap_optimism_trades.sql b/models/paraswap/optimism/paraswap_optimism_trades.sql index 01a25f3c69b..16df89f560f 100644 --- a/models/paraswap/optimism/paraswap_optimism_trades.sql +++ b/models/paraswap/optimism/paraswap_optimism_trades.sql @@ -1,4 +1,5 @@ {{ config( + schema='paraswap_optimism', alias = 'trades', ) diff --git a/models/paraswap/paraswap_trades.sql b/models/paraswap/paraswap_trades.sql index c12ed95be7f..6c5d6cddccf 100644 --- a/models/paraswap/paraswap_trades.sql +++ b/models/paraswap/paraswap_trades.sql @@ -1,5 +1,5 @@ {{ config( - + schema='paraswap', alias = 'trades', post_hook='{{ expose_spells(\'["avalanche_c","fantom","arbitrum","bnb","ethereum","optimism","polygon","base"]\', "project", diff --git a/models/paraswap/polygon/paraswap_polygon_trades.sql b/models/paraswap/polygon/paraswap_polygon_trades.sql index 503dd278165..ad246eda3a0 100644 --- a/models/paraswap/polygon/paraswap_polygon_trades.sql +++ b/models/paraswap/polygon/paraswap_polygon_trades.sql @@ -1,4 +1,5 @@ {{ config( + schema='paraswap_polygon', alias = 'trades', ) diff --git a/models/spookyswap/fantom/spookyswap_fantom_pools.sql b/models/spookyswap/fantom/spookyswap_fantom_pools.sql index cc5222126b3..bb2e64d9c49 100644 --- a/models/spookyswap/fantom/spookyswap_fantom_pools.sql +++ b/models/spookyswap/fantom/spookyswap_fantom_pools.sql @@ -1,5 +1,5 @@ {{ config( - + schema = 'spookyswap_fantom', alias = 'pools', materialized = 'incremental', file_format = 'delta', diff --git a/models/sushiswap/optimism/sushiswap_optimism_pool_incentives_config.sql b/models/sushiswap/optimism/sushiswap_optimism_pool_incentives_config.sql index acd0441ed09..c5dcf1e3380 100644 --- a/models/sushiswap/optimism/sushiswap_optimism_pool_incentives_config.sql +++ b/models/sushiswap/optimism/sushiswap_optimism_pool_incentives_config.sql @@ -1,5 +1,6 @@ {{ config( - alias = 'pool_incentives_config' + schema = 'sushiswap_optimism' + , alias = 'pool_incentives_config' , tags=['static'] ) }} diff --git a/models/sushiswap/optimism/sushiswap_optimism_pool_incentives_mappings.sql b/models/sushiswap/optimism/sushiswap_optimism_pool_incentives_mappings.sql index 46496f81f5c..cd324dc44cc 100644 --- a/models/sushiswap/optimism/sushiswap_optimism_pool_incentives_mappings.sql +++ b/models/sushiswap/optimism/sushiswap_optimism_pool_incentives_mappings.sql @@ -1,6 +1,6 @@ {{ config( - - alias = 'pool_incentives_mappings' + schema = 'sushiswap_optimism' + , alias = 'pool_incentives_mappings' ) }} diff --git a/models/sushiswap/optimism/sushiswap_optimism_pool_incentives_rates.sql b/models/sushiswap/optimism/sushiswap_optimism_pool_incentives_rates.sql index 901bd31339a..e519dc79091 100644 --- a/models/sushiswap/optimism/sushiswap_optimism_pool_incentives_rates.sql +++ b/models/sushiswap/optimism/sushiswap_optimism_pool_incentives_rates.sql @@ -1,5 +1,6 @@ {{ config( - alias = 'pool_incentives_rates' + schema = 'sushiswap_optimism' + , alias = 'pool_incentives_rates' , materialized = 'table' ) }} diff --git a/models/syndicate/ethereum/syndicate_ethereum_dao_addresses.sql b/models/syndicate/ethereum/syndicate_ethereum_dao_addresses.sql index d3332d7eddc..09cb98186d3 100644 --- a/models/syndicate/ethereum/syndicate_ethereum_dao_addresses.sql +++ b/models/syndicate/ethereum/syndicate_ethereum_dao_addresses.sql @@ -1,6 +1,6 @@ {{ config( alias = 'dao_addresses', - + schema = 'syndicate_ethereum', partition_by = ['block_month'], materialized = 'incremental', file_format = 'delta', diff --git a/models/syndicate/polygon/syndicate_polygon_dao_addresses.sql b/models/syndicate/polygon/syndicate_polygon_dao_addresses.sql index 119e20f89a3..4356be6ba77 100644 --- a/models/syndicate/polygon/syndicate_polygon_dao_addresses.sql +++ b/models/syndicate/polygon/syndicate_polygon_dao_addresses.sql @@ -1,6 +1,6 @@ {{ config( alias = 'dao_addresses', - + schema = 'syndicate_polygon', partition_by = ['block_month'], materialized = 'incremental', file_format = 'delta', diff --git a/models/syndicate/syndicate_dao_addresses.sql b/models/syndicate/syndicate_dao_addresses.sql index 3975d40d074..78b94ff7c51 100644 --- a/models/syndicate/syndicate_dao_addresses.sql +++ b/models/syndicate/syndicate_dao_addresses.sql @@ -1,5 +1,5 @@ {{ config( - + schema = 'syndicate', alias = 'dao_addresses', materialized = 'view', file_format = 'delta', diff --git a/models/tigris/arbitrum/events/tigris_arbitrum_events_contracts_positions.sql b/models/tigris/arbitrum/events/tigris_arbitrum_events_contracts_positions.sql index c939a92b9ee..f1d218f8763 100644 --- a/models/tigris/arbitrum/events/tigris_arbitrum_events_contracts_positions.sql +++ b/models/tigris/arbitrum/events/tigris_arbitrum_events_contracts_positions.sql @@ -1,5 +1,5 @@ {{ config( - + schema = 'tigris_arbitrum', alias = 'events_contracts_positions' ) }} diff --git a/models/tigris/arbitrum/tigris_arbitrum_perpetual_trades.sql b/models/tigris/arbitrum/tigris_arbitrum_perpetual_trades.sql index 8664079623b..be276c97a4b 100644 --- a/models/tigris/arbitrum/tigris_arbitrum_perpetual_trades.sql +++ b/models/tigris/arbitrum/tigris_arbitrum_perpetual_trades.sql @@ -1,5 +1,5 @@ {{ config( - + schema = 'tigris_arbitrum', alias = 'perpetual_trades', partition_by = ['block_month'], materialized = 'incremental', diff --git a/models/tigris/polygon/events/tigris_polygon_events_contracts_positions.sql b/models/tigris/polygon/events/tigris_polygon_events_contracts_positions.sql index c919ba84251..ccfadfcf328 100644 --- a/models/tigris/polygon/events/tigris_polygon_events_contracts_positions.sql +++ b/models/tigris/polygon/events/tigris_polygon_events_contracts_positions.sql @@ -1,6 +1,6 @@ {{ config( - - alias = 'events_contracts_positions' + schema = 'tigris_polygon' + , alias = 'events_contracts_positions' ) }} diff --git a/models/tigris/polygon/tigris_polygon_perpetual_trades.sql b/models/tigris/polygon/tigris_polygon_perpetual_trades.sql index 45a42f6534a..9eed49533c5 100644 --- a/models/tigris/polygon/tigris_polygon_perpetual_trades.sql +++ b/models/tigris/polygon/tigris_polygon_perpetual_trades.sql @@ -1,4 +1,5 @@ {{ config( + schema = 'tigris_polygon', tags=['prod_exclude'], alias = 'perpetual_trades', partition_by = ['block_month'], diff --git a/models/tigris/tigris_options_trades.sql b/models/tigris/tigris_options_trades.sql index 8239e160de7..7d385cb921e 100644 --- a/models/tigris/tigris_options_trades.sql +++ b/models/tigris/tigris_options_trades.sql @@ -1,5 +1,5 @@ {{ config( - + schema = 'tigris', alias = 'options_trades', post_hook='{{ expose_spells(\'["arbitrum", "polygon"]\', "project", diff --git a/models/tigris/tigris_perpetual_trades.sql b/models/tigris/tigris_perpetual_trades.sql index 4674b17ada1..6af7c9eb98b 100644 --- a/models/tigris/tigris_perpetual_trades.sql +++ b/models/tigris/tigris_perpetual_trades.sql @@ -1,5 +1,5 @@ {{ config( - + schema = 'tigris', alias = 'perpetual_trades', post_hook='{{ expose_spells(\'["arbitrum", "polygon"]\', "project", diff --git a/models/tigris/tigris_trades.sql b/models/tigris/tigris_trades.sql index 1f867831550..0dcad30837f 100644 --- a/models/tigris/tigris_trades.sql +++ b/models/tigris/tigris_trades.sql @@ -1,5 +1,5 @@ {{ config( - + schema = 'tigris', alias = 'trades', post_hook='{{ expose_spells(\'["polygon","arbitrum"]\', "project", diff --git a/models/timeswap/arbitrum/timeswap_arbitrum_borrow.sql b/models/timeswap/arbitrum/timeswap_arbitrum_borrow.sql index 46967515e05..94f3241af8a 100644 --- a/models/timeswap/arbitrum/timeswap_arbitrum_borrow.sql +++ b/models/timeswap/arbitrum/timeswap_arbitrum_borrow.sql @@ -1,5 +1,6 @@ {{ config( - alias = 'borrow' + schema = 'timeswap_arbitrum' + ,alias = 'borrow' ,materialized = 'incremental' ,file_format = 'delta' ,incremental_strategy = 'merge' diff --git a/models/timeswap/arbitrum/timeswap_arbitrum_lend.sql b/models/timeswap/arbitrum/timeswap_arbitrum_lend.sql index 78a13ea28e5..163455e102a 100644 --- a/models/timeswap/arbitrum/timeswap_arbitrum_lend.sql +++ b/models/timeswap/arbitrum/timeswap_arbitrum_lend.sql @@ -1,5 +1,6 @@ {{ config( - alias = 'lend' + schema = 'timeswap_arbitrum' + ,alias = 'lend' ,materialized = 'incremental' ,file_format = 'delta' ,incremental_strategy = 'merge' diff --git a/models/timeswap/ethereum/timeswap_ethereum_borrow.sql b/models/timeswap/ethereum/timeswap_ethereum_borrow.sql index 28c20c81815..b30f2d05e20 100644 --- a/models/timeswap/ethereum/timeswap_ethereum_borrow.sql +++ b/models/timeswap/ethereum/timeswap_ethereum_borrow.sql @@ -1,5 +1,6 @@ {{ config( - alias = 'borrow' + schema = 'timeswap_ethereum' + ,alias = 'borrow' ,materialized = 'incremental' ,file_format = 'delta' ,incremental_strategy = 'merge' diff --git a/models/timeswap/ethereum/timeswap_ethereum_lend.sql b/models/timeswap/ethereum/timeswap_ethereum_lend.sql index 1af75e75079..5f9fc362b4c 100644 --- a/models/timeswap/ethereum/timeswap_ethereum_lend.sql +++ b/models/timeswap/ethereum/timeswap_ethereum_lend.sql @@ -1,5 +1,6 @@ {{ config( - alias = 'lend' + schema = 'timeswap_ethereum' + ,alias = 'lend' ,materialized = 'incremental' ,file_format = 'delta' ,incremental_strategy = 'merge' diff --git a/models/timeswap/polygon/timeswap_polygon_borrow.sql b/models/timeswap/polygon/timeswap_polygon_borrow.sql index 36641f967f3..b4d853c5c4d 100644 --- a/models/timeswap/polygon/timeswap_polygon_borrow.sql +++ b/models/timeswap/polygon/timeswap_polygon_borrow.sql @@ -1,5 +1,6 @@ {{ config( - alias = 'borrow' + schema = 'timeswap_polygon' + ,alias = 'borrow' ,materialized = 'incremental' ,file_format = 'delta' ,incremental_strategy = 'merge' diff --git a/models/timeswap/polygon/timeswap_polygon_lend.sql b/models/timeswap/polygon/timeswap_polygon_lend.sql index c62fdfb8ec0..7020ba43d33 100644 --- a/models/timeswap/polygon/timeswap_polygon_lend.sql +++ b/models/timeswap/polygon/timeswap_polygon_lend.sql @@ -1,5 +1,6 @@ {{ config( - alias = 'lend' + schema = 'timeswap_polygon' + ,alias = 'lend' ,materialized = 'incremental' ,file_format = 'delta' ,incremental_strategy = 'merge' diff --git a/models/wigoswap/fantom/wigoswap_fantom_pools.sql b/models/wigoswap/fantom/wigoswap_fantom_pools.sql index df208793e54..69f80e8109f 100644 --- a/models/wigoswap/fantom/wigoswap_fantom_pools.sql +++ b/models/wigoswap/fantom/wigoswap_fantom_pools.sql @@ -1,5 +1,5 @@ {{ config( - + schema = 'wigoswap_fantom', alias = 'pools', materialized = 'incremental', file_format = 'delta', diff --git a/models/zerion/zerion_trades.sql b/models/zerion/zerion_trades.sql index 499805d438e..5b5a6f28ab1 100644 --- a/models/zerion/zerion_trades.sql +++ b/models/zerion/zerion_trades.sql @@ -1,5 +1,5 @@ {{ config( - + schema = 'zerion', alias = 'trades', post_hook='{{ expose_spells(\'["bnb", "gnosis", "avalanche_c", "arbitrum", "optimism", "polygon"]\', "project", diff --git a/models/zodiac/ethereum/zodiac_ethereum_dao_addresses.sql b/models/zodiac/ethereum/zodiac_ethereum_dao_addresses.sql index 4a9d9465fd7..c41c85767aa 100644 --- a/models/zodiac/ethereum/zodiac_ethereum_dao_addresses.sql +++ b/models/zodiac/ethereum/zodiac_ethereum_dao_addresses.sql @@ -1,6 +1,6 @@ {{ config( alias = 'dao_addresses', - + schema = 'zodiac_ethereum', partition_by = ['block_month'], materialized = 'incremental', file_format = 'delta', From c10a21a883a4112503221e3932bdd78fbbbeef8c Mon Sep 17 00:00:00 2001 From: Andrew <47720952+andrewhong5297@users.noreply.github.com> Date: Wed, 5 Jun 2024 10:25:43 -0700 Subject: [PATCH 055/149] add pumpdotfun to dex trades (#6072) * test * add * add to view * fix schema * fix mint address * type nulls * remove ci * change * some schema changes --- models/dex/solana/dex_solana_schema.yml | 2 +- models/dex/solana/dex_solana_trades.sql | 1 + models/goosefx/solana/_schema.yml | 2 +- models/lifinity/schema.yml | 12 +- .../orca_whirlpool/orca_whirlpool_schema.yml | 2 +- models/phoenix/schema.yml | 12 +- .../solana/pumpdotfun_solana_trades.sql | 190 ++++++++++++++++++ models/pumpdotfun/solana/schema.yml | 117 +++++++++++ models/raydium/schema.yml | 12 +- 9 files changed, 329 insertions(+), 21 deletions(-) create mode 100644 models/pumpdotfun/solana/pumpdotfun_solana_trades.sql create mode 100644 models/pumpdotfun/solana/schema.yml diff --git a/models/dex/solana/dex_solana_schema.yml b/models/dex/solana/dex_solana_schema.yml index a6b19c8cd51..9bbcabd2184 100644 --- a/models/dex/solana/dex_solana_schema.yml +++ b/models/dex/solana/dex_solana_schema.yml @@ -76,7 +76,7 @@ models: description: "token associated address for the whirlpool, of the token sold" - &project_program_id name: project_program_id - description: "Project program id that the trade was executed on - like the whirlpool id" + description: "pool program id of the project" - &trader_id name: trader_id description: "id (address) of trader who purchased a token" diff --git a/models/dex/solana/dex_solana_trades.sql b/models/dex/solana/dex_solana_trades.sql index 8366cba7db9..64f55e6b047 100644 --- a/models/dex/solana/dex_solana_trades.sql +++ b/models/dex/solana/dex_solana_trades.sql @@ -20,6 +20,7 @@ , ref('meteora_v1_solana_trades') , ref('meteora_v2_solana_trades') , ref('goosefx_ssl_v2_solana_trades') + , ref('pumpdotfun_solana_trades') ] %} {% for dex in solana_dexes %} diff --git a/models/goosefx/solana/_schema.yml b/models/goosefx/solana/_schema.yml index 68d27b7998d..102b4cc12ff 100644 --- a/models/goosefx/solana/_schema.yml +++ b/models/goosefx/solana/_schema.yml @@ -80,7 +80,7 @@ models: description: "token associated address for the whirlpool, of the token sold" - &project_program_id name: project_program_id - description: "Project program id that the trade was executed on - like the whirlpool id" + description: "pool program id of the project" - &trader_id name: trader_id description: "id (address) of trader who purchased a token" diff --git a/models/lifinity/schema.yml b/models/lifinity/schema.yml index 475fe1408f7..338b9dcba93 100644 --- a/models/lifinity/schema.yml +++ b/models/lifinity/schema.yml @@ -35,7 +35,7 @@ models: description: "UTC event block time of each DEX trade" - &trade_source name: trade_source - description: "Was the trade a direct call to the whirlpool or did it go through another program like Jupiter (Dex Aggregator)" + description: "Was the trade a direct call to the dexor did it go through another program like Jupiter (Dex Aggregator)" - &token_bought_symbol name: token_bought_symbol description: "Token symbol for token bought in the trade" @@ -66,10 +66,10 @@ models: severity: warn - &fee_tier name: fee_tier - description: "Whirlpool fee tier (fee %)" + description: "dexfee tier (fee %)" - &fee_usd name: fee_usd - description: "Whirlpool fee usd paid on swap" + description: "dexfee usd paid on swap" - &token_bought_mint_address name: token_bought_address description: "token mint address of the token bought" @@ -78,13 +78,13 @@ models: description: "token mint address of the token sold" - &token_bought_vault name: token_bought_vault - description: "token associated address for the whirlpool, of the token bought" + description: "token associated address for thedex, of the token bought" - &token_sold_vault name: token_sold_vault - description: "token associated address for the whirlpool, of the token sold" + description: "token associated address for thedex, of the token sold" - &project_program_id name: project_program_id - description: "Project program id that the trade was executed on - like the whirlpool id" + description: "pool program id of the project" - &trader_id name: trader_id description: "id (address) of trader who purchased a token" diff --git a/models/orca_whirlpool/orca_whirlpool_schema.yml b/models/orca_whirlpool/orca_whirlpool_schema.yml index ce8e820fd61..f11c46e500a 100644 --- a/models/orca_whirlpool/orca_whirlpool_schema.yml +++ b/models/orca_whirlpool/orca_whirlpool_schema.yml @@ -84,7 +84,7 @@ models: description: "token associated address for the whirlpool, of the token sold" - &project_program_id name: project_program_id - description: "Project program id that the trade was executed on - like the whirlpool id" + description: "pool program id of the project" - &trader_id name: trader_id description: "id (address) of trader who purchased a token" diff --git a/models/phoenix/schema.yml b/models/phoenix/schema.yml index 461b7698344..7e43d0ee1ea 100644 --- a/models/phoenix/schema.yml +++ b/models/phoenix/schema.yml @@ -35,7 +35,7 @@ models: description: "UTC event block time of each DEX trade" - &trade_source name: trade_source - description: "Was the trade a direct call to the whirlpool or did it go through another program like Jupiter (Dex Aggregator)" + description: "Was the trade a direct call to the dexor did it go through another program like Jupiter (Dex Aggregator)" - &token_bought_symbol name: token_bought_symbol description: "Token symbol for token bought in the trade" @@ -66,10 +66,10 @@ models: severity: warn - &fee_tier name: fee_tier - description: "Whirlpool fee tier (fee %)" + description: "dexfee tier (fee %)" - &fee_usd name: fee_usd - description: "Whirlpool fee usd paid on swap" + description: "dexfee usd paid on swap" - &token_bought_mint_address name: token_bought_address description: "token mint address of the token bought" @@ -78,13 +78,13 @@ models: description: "token mint address of the token sold" - &token_bought_vault name: token_bought_vault - description: "token associated address for the whirlpool, of the token bought" + description: "token associated address for thedex, of the token bought" - &token_sold_vault name: token_sold_vault - description: "token associated address for the whirlpool, of the token sold" + description: "token associated address for thedex, of the token sold" - &project_program_id name: project_program_id - description: "Project program id that the trade was executed on - like the whirlpool id" + description: "pool program id of the project" - &trader_id name: trader_id description: "id (address) of trader who purchased a token" diff --git a/models/pumpdotfun/solana/pumpdotfun_solana_trades.sql b/models/pumpdotfun/solana/pumpdotfun_solana_trades.sql new file mode 100644 index 00000000000..fccddea59a0 --- /dev/null +++ b/models/pumpdotfun/solana/pumpdotfun_solana_trades.sql @@ -0,0 +1,190 @@ + {{ + config( + schema = 'pumpdotfun_solana', + alias = 'trades', + partition_by = ['block_month'], + materialized = 'incremental', + file_format = 'delta', + incremental_strategy = 'merge', + incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.block_time')], + unique_key = ['tx_id', 'outer_instruction_index', 'inner_instruction_index', 'tx_index','block_month'], + pre_hook='{{ enforce_join_distribution("PARTITIONED") }}', + post_hook='{{ expose_spells(\'["solana"]\', + "project", + "pumpdotfun_solana", + \'["ilemi"]\') }}') +}} + + +{% set project_start_date = '2024-01-14' %} --grabbed program deployed at time (account created at) + +with + bonding_curves as ( + SELECT + account_arguments[1] as token_mint_address + , account_arguments[3] as bonding_curve + , account_arguments[4] as bonding_curve_vault + FROM {{ source('solana','instruction_calls') }} + WHERE executing_account = '6EF8rrecthR5Dkzon8Nwu78hRvfCKubJ14M5uBEwF6P' + AND bytearray_substring(data,1,8) = 0x181ec828051c0777 --Create https://solscan.io/tx/2Vfq4gS9nq2jvpmZSxVXJ3uHGeheENXetwUus6KnhBzFu23Brqbt5EoNiTLds6jr72yZYGJ9YbMDG1BYKMRe3hSQ + and tx_success = true + {% if is_incremental() %} + AND {{incremental_predicate('block_time')}} + {% else %} + AND block_time >= TIMESTAMP '{{project_start_date}}' + -- and block_time >= now() - interval '7' day + {% endif %} + ) + + , swaps as ( + SELECT + to_base58(bytearray_substring(data,1+16,32)) as token_mint_address + , bytearray_to_uint256(bytearray_reverse(bytearray_substring(data,1+16+32,8))) as sol_amount + , bytearray_to_uint256(bytearray_reverse(bytearray_substring(data,1+16+32+8,8))) as token_amount + , bytearray_to_uint256(bytearray_reverse(bytearray_substring(data,1+16+32+8+8,1))) as is_buy + , to_base58(bytearray_substring(data,1+16+32+8+8+1,32)) as user + , bytearray_to_int256(bytearray_reverse(bytearray_substring(data,1+16+32+8+8+1+32,8))) as trade_timestamp + , bytearray_to_uint256(bytearray_reverse(bytearray_substring(data,1+16+32+8+8+1+32+8,8))) as sol_reserves + , bytearray_to_uint256(bytearray_reverse(bytearray_substring(data,1+16+32+8+8+1+32+8+8,8))) as token_reserves + , data + , tx_id + , tx_index + , block_time + , block_slot + , outer_instruction_index + , inner_instruction_index + , outer_executing_account + FROM {{ source('solana','instruction_calls') }} + WHERE executing_account = '6EF8rrecthR5Dkzon8Nwu78hRvfCKubJ14M5uBEwF6P' + AND bytearray_substring(data,1,16) = 0xe445a52e51cb9a1dbddb7fd34ee661ee --SwapEvent + and tx_success = true + {% if is_incremental() %} + AND {{incremental_predicate('block_time')}} + {% else %} + AND block_time >= TIMESTAMP '{{project_start_date}}' + -- and block_time >= now() - interval '7' day + {% endif %} + -- AND tx_id = '5782i58ZHCKSANgTi3WXL5vjFAWEVJuPMGAr6gjx2qqcRP6LLNRH2g6pb61tk44H7PC9ohFNCUKQVUAMd5vYeUns' + -- and block_slot = 269850397 + --buy https://solscan.io/tx/5782i58ZHCKSANgTi3WXL5vjFAWEVJuPMGAr6gjx2qqcRP6LLNRH2g6pb61tk44H7PC9ohFNCUKQVUAMd5vYeUns + --sell https://solscan.io/tx/4thHCu9SX166TP2cnjgwJ7mDSSMn5MBe8xLsTYzRLJmE7jPgwQatXh4ehh3At4xvVcgUefFzzsYVBaVwYyS1bA6v + ) + + , trades_base as ( + SELECT + sp.block_time + , 'pumpdotfun' as project + , 1 as version + , 'solana' as blockchain + , case when sp.outer_executing_account = '6EF8rrecthR5Dkzon8Nwu78hRvfCKubJ14M5uBEwF6P' then 'direct' + else sp.outer_executing_account + end as trade_source + ,case + when lower(tk.symbol) > lower(tk_sol.symbol) then concat(tk_sol.symbol, '-', tk.symbol) + else concat(tk.symbol, '-', tk_sol.symbol) + end as token_pair + --bought + , case when is_buy = 1 then COALESCE(tk.symbol, sp.token_mint_address) + else COALESCE(tk_sol.symbol, 'So11111111111111111111111111111111111111112') + end as token_bought_symbol + , case when is_buy = 1 then sp.token_mint_address + else 'So11111111111111111111111111111111111111112' + end as token_bought_mint_address + , case when is_buy = 1 then token_amount + else sol_amount + end as token_bought_amount_raw + , case when is_buy = 1 then token_amount/pow(10,tk.decimals) + else sol_amount/pow(10,tk_sol.decimals) + end as token_bought_amount + --sold + , case when is_buy = 0 then COALESCE(tk.symbol, sp.token_mint_address) + else COALESCE(tk_sol.symbol, 'So11111111111111111111111111111111111111112') + end as token_sold_symbol + , case when is_buy = 0 then sp.token_mint_address + else 'So11111111111111111111111111111111111111112' + end as token_sold_mint_address + , case when is_buy = 0 then token_amount + else sol_amount + end as token_sold_amount_raw + , case when is_buy = 0 then token_amount/pow(10,tk.decimals) + else sol_amount/pow(10,tk_sol.decimals) + end as token_sold_amount + , sp.sol_amount*0.01 as sol_fee_raw + , sp.sol_amount/pow(10,tk_sol.decimals)*0.01 as sol_fee + , cast(bc.bonding_curve as varchar) as pool_id + , '6EF8rrecthR5Dkzon8Nwu78hRvfCKubJ14M5uBEwF6P' as project_main_id + , sp.sol_reserves as sol_reserves_raw + , sp.sol_reserves/pow(10,tk_sol.decimals) as sol_reserves + , sp.token_reserves as token_reserves_raw + , sp.token_reserves/pow(10,tk.decimals) as token_reserves + , sp.user as trader_id + , sp.tx_id + , sp.outer_instruction_index + , sp.inner_instruction_index + , sp.tx_index + , sp.block_slot + , cast(case when is_buy = 1 then bc.bonding_curve --sol is just held on the curve account + else bonding_curve_vault + end as varchar) as token_bought_vault + , cast(case when is_buy = 0 then bc.bonding_curve --sol is just held on the curve account + else bonding_curve_vault + end as varchar) as token_sold_vault + FROM swaps sp + LEFT JOIN {{ ref('tokens_solana_fungible') }} tk ON tk.token_mint_address = sp.token_mint_address + LEFT JOIN {{ ref('tokens_solana_fungible') }} tk_sol ON tk_sol.token_mint_address = 'So11111111111111111111111111111111111111112' + LEFT JOIN bonding_curves bc ON bc.token_mint_address = sp.token_mint_address + ) + +SELECT + tb.blockchain + , tb.project + , tb.version + , CAST(date_trunc('month', tb.block_time) AS DATE) as block_month + , tb.block_time + , tb.token_pair + , tb.trade_source + , tb.token_bought_symbol + , tb.token_bought_amount + , tb.token_bought_amount_raw + , tb.token_sold_symbol + , tb.token_sold_amount + , tb.token_sold_amount_raw + , COALESCE(tb.token_sold_amount * p_sold.price, tb.token_bought_amount * p_bought.price) as amount_usd + , cast(null as double) as fee_tier + , sol_fee_raw + , sol_fee + , (case when tb.token_bought_mint_address = 'So11111111111111111111111111111111111111112' then p_bought.price + else p_sold.price + end) * sol_fee as fee_usd --fees are only in sol + , tb.token_sold_mint_address + , tb.token_bought_mint_address + , tb.sol_reserves_raw + , tb.sol_reserves + , tb.token_reserves_raw + , tb.token_reserves + , tb.token_sold_vault + , tb.token_bought_vault + , tb.pool_id as project_program_id + , tb.project_main_id + , tb.trader_id + , tb.tx_id + , tb.outer_instruction_index + , tb.inner_instruction_index + , tb.tx_index +FROM trades_base tb +LEFT JOIN {{ ref('prices_usd_forward_fill') }} p_bought ON p_bought.blockchain = 'solana' + AND date_trunc('minute', tb.block_time) = p_bought.minute + AND token_bought_mint_address = toBase58(p_bought.contract_address) + {% if is_incremental() %} + AND {{incremental_predicate('p_bought.minute')}} + {% else %} + AND p_bought.minute >= TIMESTAMP '{{project_start_date}}' + {% endif %} +LEFT JOIN {{ ref('prices_usd_forward_fill') }} p_sold ON p_sold.blockchain = 'solana' + AND date_trunc('minute', tb.block_time) = p_sold.minute + AND token_sold_mint_address = toBase58(p_sold.contract_address) + {% if is_incremental() %} + AND {{incremental_predicate('p_sold.minute')}} + {% else %} + AND p_sold.minute >= TIMESTAMP '{{project_start_date}}' + {% endif %} \ No newline at end of file diff --git a/models/pumpdotfun/solana/schema.yml b/models/pumpdotfun/solana/schema.yml new file mode 100644 index 00000000000..f0daad0b668 --- /dev/null +++ b/models/pumpdotfun/solana/schema.yml @@ -0,0 +1,117 @@ +version: 2 + +models: + - name: pumpdotfun_solana_trades + meta: + blockchain: solana + contributors: [ilemi] + config: + tags: ['solana','dex'] + description: > + all pumpdotfun dex trades on Solana + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - block_month + - tx_id + - outer_instruction_index + - inner_instruction_index + - tx_index + columns: + - &blockchain + name: blockchain + description: "Blockchain which the DEX is deployed" + - &project + name: project + description: "Project name of the DEX" + - &version + name: version + description: "Version of the contract built and deployed by the DEX project" + - &block_month + name: block_month + description: "UTC event block month of each DEX trade" + - &block_time + name: block_time + description: "UTC event block time of each DEX trade" + - &trade_source + name: trade_source + description: "Was the trade a direct call to the dex or did it go through another program like Jupiter (Dex Aggregator)" + - &token_bought_symbol + name: token_bought_symbol + description: "Token symbol for token bought in the trade" + - &token_sold_symbol + name: token_sold_symbol + description: "Token symbol for token sold in the trade" + - &token_pair + name: token_pair + description: "Token symbol pair for each token involved in the trade" + - &token_bought_amount + name: token_bought_amount + description: "Value of the token bought at time of execution in the original currency" + - &token_sold_amount + name: token_sold_amount + description: "Value of the token sold at time of execution in the original currency" + - &token_bought_amount_raw + name: token_bought_amount_raw + description: "Raw value of the token bought at time of execution in the original currency" + - &token_sold_amount_raw + name: token_sold_amount_raw + description: "Raw value of the token sold at time of execution in the original currency" + - &amount_usd + name: amount_usd + description: "USD value of the trade at time of execution" + tests: + - dbt_utils.accepted_range: + max_value: 1000000000 # $1b is an arbitrary number, intended to flag outlier amounts early + severity: warn + - &sol_reserves_raw + name: sol_reserves_raw + description: "sol raw reserves after swap" + - &token_reserves_raw + name: token_reserves_raw + description: "token raw reserves after swap" + - &sol_reserves + name: sol_reserves + description: "sol reserves after swap" + - &token_reserves + name: token_reserves + description: "token reserves after swap" + - &fee_tier + name: fee_tier + description: "fee tier (fee %)" + - &fee_usd + name: fee_usd + description: "sol fee usd paid on swap" + - &token_bought_mint_address + name: token_bought_address + description: "token mint address of the token bought" + - &token_sold_mint_address + name: token_sold_address + description: "token mint address of the token sold" + - &token_bought_vault + name: token_bought_vault + description: "token associated address for the dex, of the token bought" + - &token_sold_vault + name: token_sold_vault + description: "token associated address for the dex, of the token sold" + - &project_program_id + name: project_program_id + description: "pool program id of the project" + - &project_main_id + name: project_program_id + description: "main program id of the project" + - &trader_id + name: trader_id + description: "id (address) of trader who purchased a token" + - &tx_id + name: tx_id + description: "Unique transaction id value tied to each transaction on the DEX" + - &outer_instruction_index + name: outer_instruction_index + description: "top level instruction index for a given transaction id" + - &inner_instruction_index + name: inner_instruction_index + description: "inner instruction index for a given transaction id" + - &tx_index + name: tx_index + description: "index of the transaction in the block slot" \ No newline at end of file diff --git a/models/raydium/schema.yml b/models/raydium/schema.yml index e5a211161c3..4c57a6dc3d3 100644 --- a/models/raydium/schema.yml +++ b/models/raydium/schema.yml @@ -35,7 +35,7 @@ models: description: "UTC event block time of each DEX trade" - &trade_source name: trade_source - description: "Was the trade a direct call to the whirlpool or did it go through another program like Jupiter (Dex Aggregator)" + description: "Was the trade a direct call to the dexor did it go through another program like Jupiter (Dex Aggregator)" - &token_bought_symbol name: token_bought_symbol description: "Token symbol for token bought in the trade" @@ -66,10 +66,10 @@ models: severity: warn - &fee_tier name: fee_tier - description: "Whirlpool fee tier (fee %)" + description: "dexfee tier (fee %)" - &fee_usd name: fee_usd - description: "Whirlpool fee usd paid on swap" + description: "dexfee usd paid on swap" - &token_bought_mint_address name: token_bought_address description: "token mint address of the token bought" @@ -78,13 +78,13 @@ models: description: "token mint address of the token sold" - &token_bought_vault name: token_bought_vault - description: "token associated address for the whirlpool, of the token bought" + description: "token associated address for thedex, of the token bought" - &token_sold_vault name: token_sold_vault - description: "token associated address for the whirlpool, of the token sold" + description: "token associated address for thedex, of the token sold" - &project_program_id name: project_program_id - description: "Project program id that the trade was executed on - like the whirlpool id" + description: "pool program id of the project" - &trader_id name: trader_id description: "id (address) of trader who purchased a token" From 7e2f689d54e339321881000d28d6ced2e2e4de5a Mon Sep 17 00:00:00 2001 From: Andrew <47720952+andrewhong5297@users.noreply.github.com> Date: Wed, 5 Jun 2024 10:25:57 -0700 Subject: [PATCH 056/149] add jupiter aggregator swaps (#6070) * add aggregator swaps * add partition * test * add to dex * add more dexes * fix naming * Update pumpdotfun_solana_trades.sql * edit * does chaange * ?? * remove from this branch * remove dex trades ref * remove openbook dupe * remove ci * add incrementals --- .../jupiter_solana_aggregator_swaps.sql | 192 ++++++++++++++++++ .../jupiter_solana_perp_events_schema.yml | 50 ----- .../jupiter/solana/jupiter_solana_schema.yml | 107 ++++++++++ 3 files changed, 299 insertions(+), 50 deletions(-) create mode 100644 models/jupiter/solana/jupiter_solana_aggregator_swaps.sql delete mode 100644 models/jupiter/solana/jupiter_solana_perp_events_schema.yml create mode 100644 models/jupiter/solana/jupiter_solana_schema.yml diff --git a/models/jupiter/solana/jupiter_solana_aggregator_swaps.sql b/models/jupiter/solana/jupiter_solana_aggregator_swaps.sql new file mode 100644 index 00000000000..3a9e3a4570c --- /dev/null +++ b/models/jupiter/solana/jupiter_solana_aggregator_swaps.sql @@ -0,0 +1,192 @@ + {{ + config( + schema = 'jupiter_solana', + alias = 'aggregator_swaps', + partition_by = ['block_month'], + materialized='incremental', + file_format = 'delta', + incremental_strategy='merge', + incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.block_time')], + unique_key = ['log_index','tx_id','output_mint','input_mint'], + pre_hook='{{ enforce_join_distribution("PARTITIONED") }}', + post_hook='{{ expose_spells(\'["jupiter"]\', + "project", + "jupiter_solana", + \'["ilemi"]\') }}') +}} + +with + amms as ( + SELECT + * + FROM ( + --use this api https://station.jup.ag/api-v6/get-program-id-to-label + values + ('Invariant', 'HyaB3W9q6XdA5xwpU4XnSZV94htfmbmqJXZcEbRaJutt'), + ('Saber (Decimals)', 'DecZY86MU5Gj7kppfUCEmd4LbXXuyZH1yHaP2NTqdiZB'), + ('Balansol', 'D3BBjqUdCYuP18fNvvMbPAZ8DpcRi4io2EsYHQawJDag'), + ('Aldrin V2', 'CURVGoZn8zycx6FXwwevgBTB2gVvdbGTEpvMJDbgs2t4'), + ('Phoenix', 'PhoeNiXZ8ByJGLkxNfZRnkUfjvmuYqLR89jjFHGqdXY'), + ('StepN', 'Dooar9JkhdZ7J3LHN3A7YCuoGRUggXhQaG4kijfLGU2j'), + ('Sanctum', 'stkitrT1Uoy18Dk1fTrgPw8W6MVzoCfYoAFT4MLsmhq'), + ('Jupiter LO', 'jupoNjAxXgZ4rjzxzPMP4oxduvQsQtZzyknqvzYNrNu'), + ('Orca V2', '9W959DqEETiGZocYWCQPaJ6sBmUzgfxXfqGeTEdp3aQP'), + ('Dexlab', 'DSwpgjMvXhtGn6BsbqmacdBZyfLj6jSWf3HJpdJtmg6N'), + ('Clone', 'C1onEW2kPetmHmwe74YC1ESx3LnFEpVau6g2pg4fHycr'), + ('OpenBook','srmqPvymJeFKQ4zGQed1GFppgkRHL9kaELCbyksJtPX'), + ('OpenBookV2','opnb2LAfJYbRMAHHvqjCwQxanZn7ReEHp1k81EohpZb'), + ('Meteora', 'Eo7WjKq67rjJQSZxS6z3YkapzY3eMj6Xy8X5EQVn5UaB'), + ('Meteora', 'LBUZKhRxPF3XUpBCjp4YzTKgLccjZhTSDM9YuVaPwxo'), + ('Mercurial', 'MERLuDFBMmsHnsBPZw2sDQZHvXFMwp8EdjudcU2HKky'), + ('FluxBeam', 'FLUXubRmkEi2q6K3Y9kBPg9248ggaZVsoSFhtJHSrm1X'), + ('Raydium CLMM', 'CAMMCzo5YL8w4VFF8KVHrK22GGUsp5VTaW7grrKgrWqK'), + ('Raydium CP', 'CPMMoo8L3F4NbTegBCKVNunggL7H1ZpdTHKxQB5qKP1C'), + ('Aldrin', 'AMM55ShdkoGRB5jVYPjWziwk8m5MpwyDgsMWHaMSQWH6'), + ('Orca (Whirlpool)', 'whirLbMiicVdio4qvUfM5KAg6Ct8VwpYzGff3uctyCc'), + ('Orca V1', 'DjVE6JNiYqPL2QXyCUUh8rNjHrbz9hXHNYt99MQ59qw1'), + ('Crema', 'CLMM9tUoggJu2wagPkkqs9eFG4BWhVBZWkP1qv3Sp7tR'), + ('Helium Network', 'treaf4wWBBty3fHdyBpo35Mz84M8k3heKXmjmi9vFt5'), + ('Cropper Legacy', 'CTMAxxk34HjKWxQ3QLZK1HpaLXmBveao3ESePXbiyfzh'), + ('Saros', 'SSwapUtytfBdBn1b9NUGG6foMVPtcWgpRU32HToDUZr'), + ('Oasis', '9tKE7Mbmj4mxDjWatikzGAtkoWosiiZX9y6J4Hfm2R8H'), + ('Symmetry', '2KehYt3KsEQR53jYcxjbQp2d2kCp4AkuQW68atufRwSr'), + ('Raydium amm', '675kPX9MHTjS2zt1qfr1NYHuzeLXfQM9H24wFSUt1Mp8'), + ('Penguin', 'PSwapMdSai8tjrEXcxFeQth87xC4rRsa4VA5mhGhXkP'), + ('Lifinity v1', 'EewxydAPCCVuNEyrVN68PuSYdQ7wKn27V9Gjeoi8dy3S'), + ('Saber swap', 'SSwpkEEcbUqx4vtoEByFjSkhKdCT862DNVb52nZg1UZ'), + ('Marinade', 'MarBmsSgKXdrN1egZf5sqe1TMai9K1rChYNDJgjq7aD'), + ('Bonkswap', 'BSwp6bEBihVLdqJRKGgzjcGLHkcTuzmSo1TQkHepzH8p'), + ('Serum v3', '9xQeWvG816bUx9EPjHmaT23yvVM2ZWbrrpZb9PusVFin'), + ('Lifinity v2', '2wT8Yq49kHgDzXuPxZSaeLaH1qbmGXtEyPy64bL7aD3c'), + ('GooseFX SSL v2', 'GFXsSL5sSaDfNFQUYsHekbWBW1TsFdjDYzACh62tEHxn'), + ('Cropper', 'H8W3ctz92svYg6mkn1UtGfu2aQr2fnUFHM1RhScEtQDt'), + ('Sanctum Infinity', '5ocnV1qiCgaQR8Jb8xWnVbApfaygJ8tNoZfgPwsgx9kx'), + ('Token Swap', 'SwaPpA9LAaLfeLi3a68M4DjnLqgtticKg6CnyNwgAC8'), + ('Jupiter Perps', 'PERPHjGBqRHArX4DySjwM6UJHiR3sWAatqfdBS2qQJu') + ) as v(amm_name, amm) + ) + + + , jup_messages_logs as ( + --SwapEvent through log messages + with + hex_data as ( + SELECT + from_base64(split(l.logs, ' ')[3]) as hex_data + -- , split(logs, ' ')[3] as base64_data + , l.log_index_raw + , row_number() over (partition by t.id order by l.log_index_raw asc) as log_index + , t.id as tx_id + , t.block_slot + , t.block_time + , t.signer as tx_signer + , case when contains(t.account_keys, 'JUP5pEAZeHdHrLxh5UCwAbpjGwYKKoquCpda2hfP4u8') then 5 + when contains(t.account_keys, 'JUP4Fb2cqiRUcaTHdrPC8h2gNsA2ETXiPDD33WcGuJB') then 4 + end as jup_version + FROM {{ source('solana','transactions') }} t + LEFT JOIN unnest(log_messages) WITH ORDINALITY as l(logs, log_index_raw) ON true + WHERE success = True + AND any_match(account_keys, x->x IN ('JUP4Fb2cqiRUcaTHdrPC8h2gNsA2ETXiPDD33WcGuJB','JUP5pEAZeHdHrLxh5UCwAbpjGwYKKoquCpda2hfP4u8')) + AND REGEXP_LIKE(l.logs, 'Program data:.*|Program log.*') + AND try(from_base64(split(l.logs, ' ')[3])) is not null --valid hex + AND bytearray_substring(from_base64(split(l.logs, ' ')[3]), 1, 8) IN (0x516ce3becdd00ac4, 0x40c6cde8260871e2) --v4, v5 discriminator + {% if is_incremental() %} + AND {{ incremental_predicate('block_time') }} + {% endif %} + -- and block_time >= now() - interval '7' day --shorten CI + ) + + SELECT + a.amm_name + , toBase58(bytearray_substring(hex_data,1+8,32)) as amm + , toBase58(bytearray_substring(hex_data,1+40,32)) as input_mint + , bytearray_to_bigint(bytearray_reverse(bytearray_substring(hex_data,1+72,8))) as input_amount + , toBase58(bytearray_substring(hex_data,1+80,32)) as output_mint + , bytearray_to_bigint(bytearray_reverse(bytearray_substring(hex_data,1+112,8))) as output_amount + , log_index + , block_slot + , block_time + , tx_id + , tx_signer + , jup_version + FROM hex_data + JOIN amms a ON a.amm = toBase58(bytearray_substring(hex_data,1+8,32)) --only include amms that we are tracking. + ) + + , jup6_logs as ( + --uses event CPI + SELECT + a.amm_name + , toBase58(bytearray_substring(data,1+16,32)) as amm + , toBase58(bytearray_substring(data,1+48,32)) as input_mint + , bytearray_to_bigint(bytearray_reverse(bytearray_substring(data,1+80,8))) as input_amount + , toBase58(bytearray_substring(data,1+88,32)) as output_mint + , bytearray_to_bigint(bytearray_reverse(bytearray_substring(data,1+120,8))) as output_amount + , log_index + , block_slot + , block_time + , tx_id + , tx_signer + , 6 as jup_version + FROM ( + SELECT + * + , row_number() over (partition by tx_id order by outer_instruction_index asc, COALESCE(inner_instruction_index,0) asc) as log_index + FROM {{ source('solana','instruction_calls') }} + WHERE executing_account = 'JUP6LkbZbjS1jKKwapdHNy74zcZ3tLUZoi5QNyVTaV4' + AND bytearray_substring(data,1+8,8) = 0x40c6cde8260871e2 --SwapEvent https://solscan.io/account/JUP6LkbZbjS1jKKwapdHNy74zcZ3tLUZoi5QNyVTaV4#anchorProgramIDL + and tx_success = true + {% if is_incremental() %} + AND {{ incremental_predicate('block_time') }} + {% endif %} + -- and block_time >= now() - interval '7' day --shorten CI + ) l + JOIN amms a ON a.amm = toBase58(bytearray_substring(l.data,1+16,32)) --only include amms that we are tracking. + ) + +SELECT +l.amm +, l.amm_name +, case when input_mint > output_mint then tk_1.symbol || '-' || tk_2.symbol + else tk_2.symbol || '-' || tk_1.symbol + end as token_pair +, tk_1.symbol as input_symbol +, l.input_mint +, l.input_amount +, tk_1.decimals as input_decimals +, l.input_amount/pow(10,p_1.decimals)*p_1.price as input_usd +, tk_2.symbol as output_symbol +, l.output_mint +, l.output_amount +, l.output_amount/pow(10,p_2.decimals)*p_2.price as output_usd +, tk_2.decimals as output_decimals +, l.log_index +, l.tx_id +, l.block_slot +, l.block_time +, date_trunc('month', l.block_time) as block_month +, l.tx_signer +, l.jup_version +FROM ( + SELECT * FROM jup_messages_logs + WHERE input_amount > 0 and output_amount > 0 + UNION ALL + SELECT * FROM jup6_logs +) l +--tokens +LEFT JOIN {{ ref('tokens_solana_fungible') }} tk_1 ON tk_1.token_mint_address = l.input_mint +LEFT JOIN {{ ref('tokens_solana_fungible') }} tk_2 ON tk_2.token_mint_address = l.output_mint +LEFT JOIN {{ ref('prices_usd_forward_fill') }} p_1 ON p_1.blockchain = 'solana' + AND date_trunc('minute', l.block_time) = p_1.minute + AND l.input_mint = toBase58(p_1.contract_address) + {% if is_incremental() %} + AND {{ incremental_predicate('p_1.block_time') }} + {% endif %} +LEFT JOIN {{ ref('prices_usd_forward_fill') }} p_2 ON p_2.blockchain = 'solana' + AND date_trunc('minute', l.block_time) = p_2.minute + AND l.output_mint = toBase58(p_2.contract_address) + {% if is_incremental() %} + AND {{ incremental_predicate('p_2.block_time') }} + {% endif %} +WHERE l.input_mint not in ('4PfN9GDeF9yQ37qt9xCPsQ89qktp1skXfbsZ5Azk82Xi') +AND l.output_mint not in ('4PfN9GDeF9yQ37qt9xCPsQ89qktp1skXfbsZ5Azk82Xi') \ No newline at end of file diff --git a/models/jupiter/solana/jupiter_solana_perp_events_schema.yml b/models/jupiter/solana/jupiter_solana_perp_events_schema.yml deleted file mode 100644 index 258c368c002..00000000000 --- a/models/jupiter/solana/jupiter_solana_perp_events_schema.yml +++ /dev/null @@ -1,50 +0,0 @@ -version: 2 - -models: - - name: jupiter_solana_perp_events - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - position_change - - position_key - - tx_id - meta: - blockchain: solana - contributors: [ilemi] - config: - tags: ['solana','jupiter','perps'] - description: > - solana perp events - columns: - - name: position_change - description: position change (increase, decrease, liquidation) - - name: size_usd - description: size usd change during position change - - name: collateral_usd - description: collateral usd change during position change - - name: collateral_token - description: collateral token change during position change - - name: fee_usd - description: fee usd taken from position change - - name: price_usd - description: price usd change during position change - - name: liq_fee_usd - description: liquidation fee usd taken from position change - - name: pnl_direction - description: pnl direction (negative, positive as 0,1 respectively) - - name: pnl_usd - description: pnl usd change during position change - - name: owner - description: owner of the position - - name: position_key - description: account of the position - - name: position_side - description: position side (long, short as 1,2 respectively) - - name: custody_position_key - description: custody key of the token mint of position being taken on - - name: custody_collateral_key - description: custody key of the token mint of collateral being taken on - - name: block_slot - - name: block_time - - name: block_month - - name: tx_id \ No newline at end of file diff --git a/models/jupiter/solana/jupiter_solana_schema.yml b/models/jupiter/solana/jupiter_solana_schema.yml new file mode 100644 index 00000000000..09b6c404821 --- /dev/null +++ b/models/jupiter/solana/jupiter_solana_schema.yml @@ -0,0 +1,107 @@ +version: 2 + +models: + - name: jupiter_solana_perp_events + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - position_change + - position_key + - tx_id + meta: + blockchain: solana + contributors: [ilemi] + config: + tags: ['solana','jupiter','perps'] + description: > + solana perp events + columns: + - name: position_change + description: position change (increase, decrease, liquidation) + - name: size_usd + description: size usd change during position change + - name: collateral_usd + description: collateral usd change during position change + - name: collateral_token + description: collateral token change during position change + - name: fee_usd + description: fee usd taken from position change + - name: price_usd + description: price usd change during position change + - name: liq_fee_usd + description: liquidation fee usd taken from position change + - name: pnl_direction + description: pnl direction (negative, positive as 0,1 respectively) + - name: pnl_usd + description: pnl usd change during position change + - name: owner + description: owner of the position + - name: position_key + description: account of the position + - name: position_side + description: position side (long, short as 1,2 respectively) + - name: custody_position_key + description: custody key of the token mint of position being taken on + - name: custody_collateral_key + description: custody key of the token mint of collateral being taken on + - name: block_slot + - name: block_time + - name: block_month + - name: tx_id + + - name: jupiter_solana_aggregator_swaps + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - log_index + - input_mint + - output_mint + - tx_id + meta: + blockchain: solana + contributors: [ilemi] + config: + tags: ['solana','jupiter','swaps'] + description: > + solana aggregator swaps for jup v4, v5, and v6 + columns: + - name: amm + description: program id of amm routed through + - name: amm_name + description: name of amm routed through + - name: token_pair + description: token pair routed through + - name: input_symbol + description: symbol of token sold + - name: input_mint + description: token mint address of token sold + - name: input_amount + description: amount of token sold raw + - name: input_decimals + description: decimals of token sold + - name: input_usd + description: usd value of token sold + - name: output_symbol + description: symbol of token bought + - name: output_mint + description: token mint address of token bought + - name: output_amount + description: amount of token bought raw + - name: output_usd + description: usd value of token bought + - name: output_decimals + description: decimals of token bought + - name: log_index + description: ordering of the swap in the tx + - name: tx_id + description: id of the transaction + - name: block_slot + description: slot number of the transaction + - name: block_time + description: block time of the transaction + - name: block_month + description: block month of the transaction + - name: tx_signer + description: signer of the transactions + - name: jup_version + description: version of jupiter aggregator used for the swap \ No newline at end of file From 142f2eed640e7d027772778d9ef08c7f68753433 Mon Sep 17 00:00:00 2001 From: yy-analytics <103118737+yy-analytics@users.noreply.github.com> Date: Wed, 5 Jun 2024 22:56:18 +0530 Subject: [PATCH 057/149] Yield Yak swap and adapter swap tables (#6024) * Added macros and models to provide information related to YakSwap and YakAdapterSwap events * Added a tx_to_address field so that we can distinguish calls made directly to YakRouter versus as part of some other contract, and adjusted tx_fee calculation to overcome multiplication overflow error * Fixing incorrect cast of address columns to varchar * Update config block * Update config block * Added new lines between model definitions in schema, and added explicit materialized = 'view' line in some other models where it was missing --------- Co-authored-by: Huang Geyang --- .../yield_yak/yield_yak_yak_adapter_swaps.sql | 76 ++++++++++ .../yield_yak/yield_yak_yak_swaps.sql | 97 +++++++++++++ .../arbitrum/yield_yak_arbitrum_schema.yml | 129 ++++++++++++++++- .../yield_yak_arbitrum_yak_adapter_swaps.sql | 17 +++ .../arbitrum/yield_yak_arbitrum_yak_swaps.sql | 17 +++ .../yield_yak_avalanche_c_schema.yml | 129 ++++++++++++++++- ...ield_yak_avalanche_c_yak_adapter_swaps.sql | 17 +++ .../yield_yak_avalanche_c_yak_swaps.sql | 17 +++ models/yield_yak/yield_yak_balances.sql | 4 +- models/yield_yak/yield_yak_deposits.sql | 4 +- models/yield_yak/yield_yak_reinvests.sql | 4 +- models/yield_yak/yield_yak_schema.yml | 131 +++++++++++++++++- .../yield_yak/yield_yak_user_yrt_balances.sql | 4 +- models/yield_yak/yield_yak_withdraws.sql | 6 +- .../yield_yak/yield_yak_yak_adapter_swaps.sql | 52 +++++++ models/yield_yak/yield_yak_yak_swaps.sql | 48 +++++++ 16 files changed, 731 insertions(+), 21 deletions(-) create mode 100644 macros/models/_project/yield_yak/yield_yak_yak_adapter_swaps.sql create mode 100644 macros/models/_project/yield_yak/yield_yak_yak_swaps.sql create mode 100644 models/yield_yak/arbitrum/yield_yak_arbitrum_yak_adapter_swaps.sql create mode 100644 models/yield_yak/arbitrum/yield_yak_arbitrum_yak_swaps.sql create mode 100644 models/yield_yak/avalanche_c/yield_yak_avalanche_c_yak_adapter_swaps.sql create mode 100644 models/yield_yak/avalanche_c/yield_yak_avalanche_c_yak_swaps.sql create mode 100644 models/yield_yak/yield_yak_yak_adapter_swaps.sql create mode 100644 models/yield_yak/yield_yak_yak_swaps.sql diff --git a/macros/models/_project/yield_yak/yield_yak_yak_adapter_swaps.sql b/macros/models/_project/yield_yak/yield_yak_yak_adapter_swaps.sql new file mode 100644 index 00000000000..b3475d3e7ec --- /dev/null +++ b/macros/models/_project/yield_yak/yield_yak_yak_adapter_swaps.sql @@ -0,0 +1,76 @@ +{%- macro yield_yak_yak_adapter_swaps( + blockchain = null + ) +-%} + +{%- set namespace_blockchain = 'yield_yak_' + blockchain -%} + +WITH + +basic_yak_swaps AS ( + SELECT + s.contract_address AS yak_router_address + , s.evt_block_number AS block_number + , CAST(date_trunc('day', s.evt_block_time) AS date) AS block_date + , s.evt_block_time AS block_time + , t.index AS tx_index + , s.evt_tx_hash AS tx_hash + , t.to AS tx_to_address + , t.gas_used * ({% if blockchain == 'arbitrum' %}t.effective_gas_price{% else %}t.gas_price{% endif %} / 1e18) AS tx_fee + , s.evt_index + , COUNT(*) OVER (PARTITION BY s.evt_block_number, t.index) AS number_of_swaps_in_tx + , t."from" AS trader_address + , s._tokenIn AS token_in_address + , s._tokenOut AS token_out_address + , s._amountIn AS amount_in + , s._amountOut AS amount_out + -- The line below is needed so that in the next stage we correctly attribute the right YakAdapterSwap logs to the right YakSwap event (YakAdapterSwap events always come before the relevant YakSwap event) + , LAG(s.evt_index) OVER (PARTITION BY s.evt_tx_hash, s.evt_block_number ORDER BY s.evt_index) AS prev_yak_swap_index_in_tx + FROM {{ source(namespace_blockchain, 'YakRouter_evt_YakSwap') }} s + INNER JOIN {{ source(blockchain, 'transactions') }} t + ON t.hash = s.evt_tx_hash + AND t.block_number = s.evt_block_number + AND t.block_date = CAST(date_trunc('day', s.evt_block_time) AS date) + {%- if is_incremental() %} + AND {{ incremental_predicate('t.block_time') }} + WHERE + {{ incremental_predicate('s.evt_block_time') }} + {%- endif %} +) + +SELECT + '{{ blockchain }}' AS blockchain + , s.yak_router_address + , s.block_number + , s.block_date + , s.block_time + , s.tx_index + , s.tx_hash + , s.tx_to_address + , s.tx_fee + , s.evt_index AS swap_evt_index + , s.number_of_swaps_in_tx + , s.trader_address + , s.token_in_address AS swap_token_in_address + , s.token_out_address AS swap_token_out_address + , s.amount_in AS swap_amount_in + , s.amount_out AS swap_amount_out + , COUNT(*) OVER (PARTITION BY s.block_number, s.tx_index, s.evt_index) AS number_of_hops + , l.index AS adapter_evt_index + , l.contract_address AS adapter_address + , varbinary_substring(l.topic1, 13) AS adapter_token_in_address + , varbinary_substring(l.topic2, 13) AS adapter_token_out_address + , varbinary_to_uint256(varbinary_substring(l.data, 1, 32)) AS adapter_amount_in + , varbinary_to_uint256(varbinary_substring(l.data, 33, 32)) AS adapter_amount_out +FROM basic_yak_swaps s +INNER JOIN {{ source(blockchain, 'logs') }} l + ON l.tx_hash = s.tx_hash + AND l.block_number = s.block_number + AND l.index < s.evt_index + AND (s.prev_yak_swap_index_in_tx IS NULL OR l.index > s.prev_yak_swap_index_in_tx) -- this line and the one above is what makes sure the relevant YakAdapterSwap logs are paired with the right YakSwap event + AND l.topic0 = 0xe2bdbc6b7225eb0a972ac943c485a6cc05f7c6811838bce8903f23200fb744fa -- function signature for YakAdapterSwap(address,address,uint256,uint256) + {%- if is_incremental() %} + AND {{ incremental_predicate('l.block_time') }} + {%- endif %} + +{%- endmacro -%} \ No newline at end of file diff --git a/macros/models/_project/yield_yak/yield_yak_yak_swaps.sql b/macros/models/_project/yield_yak/yield_yak_yak_swaps.sql new file mode 100644 index 00000000000..f3a934472e9 --- /dev/null +++ b/macros/models/_project/yield_yak/yield_yak_yak_swaps.sql @@ -0,0 +1,97 @@ +{%- macro yield_yak_yak_swaps( + blockchain = null + ) +-%} + +{%- set namespace_blockchain = 'yield_yak_' + blockchain -%} + +WITH + +basic_yak_swaps AS ( + SELECT + s.contract_address AS yak_router_address + , s.evt_block_number AS block_number + , CAST(date_trunc('day', s.evt_block_time) AS date) AS block_date + , s.evt_block_time AS block_time + , t.index AS tx_index + , s.evt_tx_hash AS tx_hash + , t.to AS tx_to_address + , t.gas_used * ({% if blockchain == 'arbitrum' %}t.effective_gas_price{% else %}t.gas_price{% endif %} / 1e18) AS tx_fee + , s.evt_index + , COUNT(*) OVER (PARTITION BY s.evt_block_number, t.index) AS number_of_swaps_in_tx + , t."from" AS trader_address + , s._tokenIn AS swap_token_in_address + , s._tokenOut AS swap_token_out_address + , s._amountIn AS swap_amount_in + , s._amountOut AS swap_amount_out + -- The line below is needed so that in the next stage we correctly attribute the right YakAdapterSwap logs to the right YakSwap event (YakAdapterSwap events always come before the relevant YakSwap event) + , LAG(s.evt_index) OVER (PARTITION BY s.evt_tx_hash, s.evt_block_number ORDER BY s.evt_index) AS prev_yak_swap_index_in_tx + FROM {{ source(namespace_blockchain, 'YakRouter_evt_YakSwap') }} s + INNER JOIN {{ source(blockchain, 'transactions') }} t + ON t.hash = s.evt_tx_hash + AND t.block_number = s.evt_block_number + AND t.block_date = CAST(date_trunc('day', s.evt_block_time) AS date) + {%- if is_incremental() %} + AND {{ incremental_predicate('t.block_time') }} + WHERE + {{ incremental_predicate('s.evt_block_time') }} + {%- endif %} +) + +SELECT + '{{ blockchain }}' AS blockchain + , s.yak_router_address + , s.block_number + , s.block_date + , s.block_time + , s.tx_index + , s.tx_hash + , s.tx_to_address + , s.tx_fee + , s.evt_index + , s.number_of_swaps_in_tx + , s.tx_fee / s.number_of_swaps_in_tx AS tx_fee_per_swap + , s.trader_address + , s.swap_token_in_address + , s.swap_token_out_address + , s.swap_amount_in + , s.swap_amount_out + , COUNT(*) AS number_of_hops + , ARRAY_AGG( + json_object( + 'adapter_address': CAST(l.contract_address AS varchar), + 'adapter_token_in_address': CAST(varbinary_substring(l.topic1, 13) AS varchar), + 'adapter_token_out_address': CAST(varbinary_substring(l.topic2, 13) AS varchar), + 'adapter_amount_in': varbinary_to_uint256(varbinary_substring(l.data, 1, 32)), + 'adapter_amount_out': varbinary_to_uint256(varbinary_substring(l.data, 33, 32)) + ) ORDER BY l.index + ) AS yak_adapter_swaps +FROM basic_yak_swaps s +INNER JOIN {{ source(blockchain, 'logs') }} l + ON l.tx_hash = s.tx_hash + AND l.block_number = s.block_number + AND l.index < s.evt_index + AND (s.prev_yak_swap_index_in_tx IS NULL OR l.index > s.prev_yak_swap_index_in_tx) -- this line and the one above is what makes sure the relevant YakAdapterSwap logs are paired with the right YakSwap event + AND l.topic0 = 0xe2bdbc6b7225eb0a972ac943c485a6cc05f7c6811838bce8903f23200fb744fa -- function signature for YakAdapterSwap(address,address,uint256,uint256) + {%- if is_incremental() %} + AND {{ incremental_predicate('l.block_time') }} + {%- endif %} +GROUP BY + s.yak_router_address + , s.block_number + , s.block_date + , s.block_time + , s.tx_index + , s.tx_hash + , s.tx_to_address + , s.tx_fee + , s.evt_index + , s.number_of_swaps_in_tx + , s.tx_fee / s.number_of_swaps_in_tx + , s.trader_address + , s.swap_token_in_address + , s.swap_token_out_address + , s.swap_amount_in + , s.swap_amount_out + +{%- endmacro -%} \ No newline at end of file diff --git a/models/yield_yak/arbitrum/yield_yak_arbitrum_schema.yml b/models/yield_yak/arbitrum/yield_yak_arbitrum_schema.yml index 4c540a907a1..59f0de915c4 100644 --- a/models/yield_yak/arbitrum/yield_yak_arbitrum_schema.yml +++ b/models/yield_yak/arbitrum/yield_yak_arbitrum_schema.yml @@ -28,7 +28,7 @@ models: columns: - name: blockchain description: "Blockchain which the DEX is deployed" - - &project + - &project name: project description: "Project name of the DEX" - &version @@ -94,6 +94,7 @@ models: - &block_month name: block_month description: "UTC event block month of each DEX trade" + - name: yield_yak_arbitrum_deposits meta: blockchain: arbitrum @@ -118,26 +119,27 @@ models: description: "Address of the YRT smart contract / strategy" - &tx_hash name: tx_hash - description: "Transaction hash of the deposit/withdraw/reinvest" + description: "Transaction hash of the deposit/withdraw/reinvest/swap" - *evt_index - &tx_index name: tx_index description: "Index of the transaction within the block" - &block_time name: block_time - description: "UTC time of the deposit/withdraw/reinvest" + description: "UTC time of the deposit/withdraw/reinvest/swap" - &block_date name: block_date - description: "UTC event block date of the deposit/withdraw/reinvest" + description: "UTC event block date of the deposit/withdraw/reinvest/swap" - &block_number name: block_number - description: "Block number of the deposit/withdraw/reinvest" + description: "Block number of the deposit/withdraw/reinvest/swap" - &user_address name: user_address description: "Address of the wallet which made the deposit/withdraw/reinvest" - &deposit_amount name: deposit_amount description: "Amount of deposit tokens deposited into the strategy" + - name: yield_yak_arbitrum_withdraws meta: blockchain: arbitrum @@ -166,6 +168,7 @@ models: - &withdraw_amount name: withdraw_amount description: "Amount of deposit tokens withdrawn from the strategy" + - name: yield_yak_arbitrum_reinvests meta: blockchain: arbitrum @@ -208,6 +211,7 @@ models: - &recent_reinvest_info name: recent_reinvest_info description: "An array of the ratio growth and time between reinvests for the last 25 Reinvest events" + - name: yield_yak_arbitrum_balances meta: blockchain: arbitrum @@ -234,6 +238,7 @@ models: - &deposit_token_balance name: deposit_token_balance description: "Balance of deposit tokens held in the contract in the time window specified" + - name: yield_yak_arbitrum_user_yrt_balances meta: blockchain: arbitrum @@ -261,3 +266,117 @@ models: - &yrt_balance name: yrt_balance description: "Balance of YRT tokens held by the user_address in the time window specified" + + - name: yield_yak_arbitrum_yak_swaps + meta: + blockchain: arbitrum + project: yield_yak + contributors: angus_1 + config: + tags: ['arbitrum', 'yakswap', 'swaps', 'aggregator', 'yield_yak', 'dex'] + description: > + yield yak aggregator yak swaps on arbitrum + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - block_number + - tx_index + - evt_index + columns: + - *blockchain + - &yak_router_address + name: yak_router_address + description: "Address of the YakRouter contract which made the swap" + - *block_number + - *block_date + - *block_time + - *tx_index + - *tx_hash + - &tx_to_address + name: tx_to_address + description: "Address 'to' which this transaction was sent (i.e. which had a function called)" + - &tx_fee + name: tx_fee + description: "Transaction / gas cost in native token for the transaction calculated using (price * gas used)" + - *evt_index + - &number_of_swaps_in_tx + name: number_of_swaps_in_tx + description: "Count of the number of YakSwap events in this same transaction (used to divide the gas cost / tx fee)" + - &tx_fee_per_swap + name: tx_fee_per_swap + description: "Transaction fee divided per each Yak Swap event" + - &trader_address + name: trader_address + description: "Address which initiated the transaction" + - &swap_token_in_address + name: swap_token_in_address + description: "Address of the token being sold in the YakSwap event" + - &swap_token_out_address + name: swap_token_out_address + description: "Address of the token being bought in the YakSwap event" + - &swap_amount_in + name: swap_amount_in + description: "Amount of the sold token being swapped from / traded in the YakSwap event" + - &swap_amount_out + name: swap_amount_out + description: "Amount of the bought token being swapped to / bought in the YakSwap event" + - &number_of_hops + name: number_of_hops + description: "Number of steps/hops the YakSwap has gone through in order to get the desired token at the best rate" + - &yak_adapter_swaps + name: yak_adapter_swaps + description: "JSON array containing detailed information about the individual YakAdapterSwap events which make up this YakSwap" + + - name: yield_yak_arbitrum_yak_adapter_swaps + meta: + blockchain: arbitrum + project: yield_yak + contributors: angus_1 + config: + tags: ['arbitrum', 'yakswap', 'swaps', 'aggregator', 'yield_yak', 'dex', 'yakadapter'] + description: > + yield yak aggregator yak adapter swaps on arbitrum + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - block_number + - tx_index + - adapter_evt_index + columns: + - *blockchain + - *yak_router_address + - *block_number + - *block_date + - *block_time + - *tx_index + - *tx_hash + - *tx_to_address + - *tx_fee + - &swap_evt_index + name: swap_evt_index + description: "Index of the YakSwap event to which this YakAdapterSwap event is related" + - *number_of_swaps_in_tx + - *trader_address + - *swap_token_in_address + - *swap_token_out_address + - *swap_amount_in + - *swap_amount_out + - *number_of_hops + - &adapter_evt_index + name: adapter_evt_index + description: "Index of the YakAdapterSwap event in the transaction" + - &adapter_address + name: adapter_address + description: "Address of the adapter being used for this part of the YakSwap" + - &adapter_token_in_address + name: adapter_token_in_address + description: "Address of the token being sold in the YakAdapterSwap event" + - &adapter_token_out_address + name: adapter_token_out_address + description: "Address of the token being bought in the YakAdapterSwap event" + - &adapter_amount_in + name: adapter_amount_in + description: "Amount of the sold token being swapped from / traded in the YakAdapterSwap event" + - &adapter_amount_out + name: adapter_amount_out + description: "Amount of the bought token being swapped to / bought in the YakAdapterSwap event" \ No newline at end of file diff --git a/models/yield_yak/arbitrum/yield_yak_arbitrum_yak_adapter_swaps.sql b/models/yield_yak/arbitrum/yield_yak_arbitrum_yak_adapter_swaps.sql new file mode 100644 index 00000000000..94f2e2f2b51 --- /dev/null +++ b/models/yield_yak/arbitrum/yield_yak_arbitrum_yak_adapter_swaps.sql @@ -0,0 +1,17 @@ +{{ + config( + schema = 'yield_yak_arbitrum', + alias = 'yak_adapter_swaps', + materialized = 'incremental', + file_format = 'delta', + incremental_strategy = 'merge', + unique_key = ['block_number', 'tx_index', 'adapter_evt_index'], + incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.block_time')] + ) +}} + +{{ + yield_yak_yak_adapter_swaps( + blockchain = 'arbitrum' + ) +}} diff --git a/models/yield_yak/arbitrum/yield_yak_arbitrum_yak_swaps.sql b/models/yield_yak/arbitrum/yield_yak_arbitrum_yak_swaps.sql new file mode 100644 index 00000000000..4add00972c0 --- /dev/null +++ b/models/yield_yak/arbitrum/yield_yak_arbitrum_yak_swaps.sql @@ -0,0 +1,17 @@ +{{ + config( + schema = 'yield_yak_arbitrum', + alias = 'yak_swaps', + materialized = 'incremental', + file_format = 'delta', + incremental_strategy = 'merge', + unique_key = ['block_number', 'tx_index', 'evt_index'], + incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.block_time')] + ) +}} + +{{ + yield_yak_yak_swaps( + blockchain = 'arbitrum' + ) +}} diff --git a/models/yield_yak/avalanche_c/yield_yak_avalanche_c_schema.yml b/models/yield_yak/avalanche_c/yield_yak_avalanche_c_schema.yml index e925e28e937..5fd3590e28e 100644 --- a/models/yield_yak/avalanche_c/yield_yak_avalanche_c_schema.yml +++ b/models/yield_yak/avalanche_c/yield_yak_avalanche_c_schema.yml @@ -94,6 +94,7 @@ models: - &block_month name: block_month description: "UTC event block month of each DEX trade" + - name: yield_yak_avalanche_c_deposits meta: blockchain: avalanche_c @@ -118,26 +119,27 @@ models: description: "Address of the YRT smart contract / strategy" - &tx_hash name: tx_hash - description: "Transaction hash of the deposit/withdraw/reinvest" + description: "Transaction hash of the deposit/withdraw/reinvest/swap" - *evt_index - &tx_index name: tx_index description: "Index of the transaction within the block" - &block_time name: block_time - description: "UTC time of the deposit/withdraw/reinvest" + description: "UTC time of the deposit/withdraw/reinvest/swap" - &block_date name: block_date - description: "UTC event block date of the deposit/withdraw/reinvest" + description: "UTC event block date of the deposit/withdraw/reinvest/swap" - &block_number name: block_number - description: "Block number of the deposit/withdraw/reinvest" + description: "Block number of the deposit/withdraw/reinvest/swap" - &user_address name: user_address description: "Address of the wallet which made the deposit/withdraw/reinvest" - &deposit_amount name: deposit_amount description: "Amount of deposit tokens deposited into the strategy" + - name: yield_yak_avalanche_c_withdraws meta: blockchain: avalanche_c @@ -166,6 +168,7 @@ models: - &withdraw_amount name: withdraw_amount description: "Amount of deposit tokens withdrawn from the strategy" + - name: yield_yak_avalanche_c_reinvests meta: blockchain: avalanche_c @@ -208,6 +211,7 @@ models: - &recent_reinvest_info name: recent_reinvest_info description: "An array of the ratio growth and time between reinvests for the last 25 Reinvest events" + - name: yield_yak_avalanche_c_balances meta: blockchain: avalanche_c @@ -234,6 +238,7 @@ models: - &deposit_token_balance name: deposit_token_balance description: "Balance of deposit tokens held in the contract in the time window specified" + - name: yield_yak_avalanche_c_user_yrt_balances meta: blockchain: avalanche_c @@ -260,4 +265,118 @@ models: description: "UTC time until which the user held this balance of the contract_address YRT" - &yrt_balance name: yrt_balance - description: "Balance of YRT tokens held by the user_address in the time window specified" \ No newline at end of file + description: "Balance of YRT tokens held by the user_address in the time window specified" + + - name: yield_yak_avalanche_c_yak_swaps + meta: + blockchain: avalanche_c + project: yield_yak + contributors: angus_1 + config: + tags: ['avalanche_c', 'yakswap', 'swaps', 'aggregator', 'yield_yak', 'dex'] + description: > + yield yak aggregator yak swaps on avalanche_c + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - block_number + - tx_index + - evt_index + columns: + - *blockchain + - &yak_router_address + name: yak_router_address + description: "Address of the YakRouter contract which made the swap" + - *block_number + - *block_date + - *block_time + - *tx_index + - *tx_hash + - &tx_to_address + name: tx_to_address + description: "Address 'to' which this transaction was sent (i.e. which had a function called)" + - &tx_fee + name: tx_fee + description: "Transaction / gas cost in native token for the transaction calculated using (price * gas used)" + - *evt_index + - &number_of_swaps_in_tx + name: number_of_swaps_in_tx + description: "Count of the number of YakSwap events in this same transaction (used to divide the gas cost / tx fee)" + - &tx_fee_per_swap + name: tx_fee_per_swap + description: "Transaction fee divided per each Yak Swap event" + - &trader_address + name: trader_address + description: "Address which initiated the transaction" + - &swap_token_in_address + name: swap_token_in_address + description: "Address of the token being sold in the YakSwap event" + - &swap_token_out_address + name: swap_token_out_address + description: "Address of the token being bought in the YakSwap event" + - &swap_amount_in + name: swap_amount_in + description: "Amount of the sold token being swapped from / traded in the YakSwap event" + - &swap_amount_out + name: swap_amount_out + description: "Amount of the bought token being swapped to / bought in the YakSwap event" + - &number_of_hops + name: number_of_hops + description: "Number of steps/hops the YakSwap has gone through in order to get the desired token at the best rate" + - &yak_adapter_swaps + name: yak_adapter_swaps + description: "JSON array containing detailed information about the individual YakAdapterSwap events which make up this YakSwap" + + - name: yield_yak_avalanche_c_yak_adapter_swaps + meta: + blockchain: avalanche_c + project: yield_yak + contributors: angus_1 + config: + tags: ['avalanche_c', 'yakswap', 'swaps', 'aggregator', 'yield_yak', 'dex', 'yakadapter'] + description: > + yield yak aggregator yak adapter swaps on avalanche_c + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - block_number + - tx_index + - adapter_evt_index + columns: + - *blockchain + - *yak_router_address + - *block_number + - *block_date + - *block_time + - *tx_index + - *tx_hash + - *tx_to_address + - *tx_fee + - &swap_evt_index + name: swap_evt_index + description: "Index of the YakSwap event to which this YakAdapterSwap event is related" + - *number_of_swaps_in_tx + - *trader_address + - *swap_token_in_address + - *swap_token_out_address + - *swap_amount_in + - *swap_amount_out + - *number_of_hops + - &adapter_evt_index + name: adapter_evt_index + description: "Index of the YakAdapterSwap event in the transaction" + - &adapter_address + name: adapter_address + description: "Address of the adapter being used for this part of the YakSwap" + - &adapter_token_in_address + name: adapter_token_in_address + description: "Address of the token being sold in the YakAdapterSwap event" + - &adapter_token_out_address + name: adapter_token_out_address + description: "Address of the token being bought in the YakAdapterSwap event" + - &adapter_amount_in + name: adapter_amount_in + description: "Amount of the sold token being swapped from / traded in the YakAdapterSwap event" + - &adapter_amount_out + name: adapter_amount_out + description: "Amount of the bought token being swapped to / bought in the YakAdapterSwap event" \ No newline at end of file diff --git a/models/yield_yak/avalanche_c/yield_yak_avalanche_c_yak_adapter_swaps.sql b/models/yield_yak/avalanche_c/yield_yak_avalanche_c_yak_adapter_swaps.sql new file mode 100644 index 00000000000..181dd70b65f --- /dev/null +++ b/models/yield_yak/avalanche_c/yield_yak_avalanche_c_yak_adapter_swaps.sql @@ -0,0 +1,17 @@ +{{ + config( + schema = 'yield_yak_avalanche_c', + alias = 'yak_adapter_swaps', + materialized = 'incremental', + file_format = 'delta', + incremental_strategy = 'merge', + unique_key = ['block_number', 'tx_index', 'adapter_evt_index'], + incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.block_time')] + ) +}} + +{{ + yield_yak_yak_adapter_swaps( + blockchain = 'avalanche_c' + ) +}} diff --git a/models/yield_yak/avalanche_c/yield_yak_avalanche_c_yak_swaps.sql b/models/yield_yak/avalanche_c/yield_yak_avalanche_c_yak_swaps.sql new file mode 100644 index 00000000000..127edb233d4 --- /dev/null +++ b/models/yield_yak/avalanche_c/yield_yak_avalanche_c_yak_swaps.sql @@ -0,0 +1,17 @@ +{{ + config( + schema = 'yield_yak_avalanche_c', + alias = 'yak_swaps', + materialized = 'incremental', + file_format = 'delta', + incremental_strategy = 'merge', + unique_key = ['block_number', 'tx_index', 'evt_index'], + incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.block_time')] + ) +}} + +{{ + yield_yak_yak_swaps( + blockchain = 'avalanche_c' + ) +}} diff --git a/models/yield_yak/yield_yak_balances.sql b/models/yield_yak/yield_yak_balances.sql index 29bf55a7598..f59a70fb06f 100644 --- a/models/yield_yak/yield_yak_balances.sql +++ b/models/yield_yak/yield_yak_balances.sql @@ -1,6 +1,8 @@ -{{ config( +{{ + config( schema = 'yield_yak', alias = 'balances', + materialized = 'view', post_hook='{{ expose_spells( blockchains = \'["arbitrum", "avalanche_c"]\', spell_type = "project", diff --git a/models/yield_yak/yield_yak_deposits.sql b/models/yield_yak/yield_yak_deposits.sql index b7b0da9459c..1ffa9e4d63d 100644 --- a/models/yield_yak/yield_yak_deposits.sql +++ b/models/yield_yak/yield_yak_deposits.sql @@ -1,6 +1,8 @@ -{{ config( +{{ + config( schema = 'yield_yak', alias = 'deposits', + materialized = 'view', post_hook='{{ expose_spells( blockchains = \'["arbitrum", "avalanche_c"]\', spell_type = "project", diff --git a/models/yield_yak/yield_yak_reinvests.sql b/models/yield_yak/yield_yak_reinvests.sql index 02902de3516..96a862a26fb 100644 --- a/models/yield_yak/yield_yak_reinvests.sql +++ b/models/yield_yak/yield_yak_reinvests.sql @@ -1,6 +1,8 @@ -{{ config( +{{ + config( schema = 'yield_yak', alias = 'reinvests', + materialized = 'view', post_hook='{{ expose_spells( blockchains = \'["arbitrum", "avalanche_c"]\', spell_type = "project", diff --git a/models/yield_yak/yield_yak_schema.yml b/models/yield_yak/yield_yak_schema.yml index 7a635c53c92..1e949e89116 100644 --- a/models/yield_yak/yield_yak_schema.yml +++ b/models/yield_yak/yield_yak_schema.yml @@ -77,6 +77,7 @@ models: - &evt_index name: evt_index description: "The position of this event log within this transaction" + - name: yield_yak_deposits meta: blockchain: avalanche_c, arbitrum @@ -102,26 +103,27 @@ models: description: "Address of the YRT smart contract / strategy" - &tx_hash name: tx_hash - description: "Transaction hash of the deposit/withdraw/reinvest" + description: "Transaction hash of the deposit/withdraw/reinvest/swap" - *evt_index - &tx_index name: tx_index description: "Index of the transaction within the block" - &block_time name: block_time - description: "UTC time of the deposit/withdraw/reinvest" + description: "UTC time of the deposit/withdraw/reinvest/swap" - &block_date name: block_date - description: "UTC event block date of the deposit/withdraw/reinvest" + description: "UTC event block date of the deposit/withdraw/reinvest/swap" - &block_number name: block_number - description: "Block number of the deposit/withdraw/reinvest" + description: "Block number of the deposit/withdraw/reinvest/swap" - &user_address name: user_address description: "Address of the wallet which made the deposit/withdraw/reinvest" - &deposit_amount name: deposit_amount description: "Amount of deposit tokens deposited into the strategy" + - name: yield_yak_withdraws meta: blockchain: avalanche_c, arbitrum @@ -151,6 +153,7 @@ models: - &withdraw_amount name: withdraw_amount description: "Amount of deposit tokens withdrawn from the strategy" + - name: yield_yak_reinvests meta: blockchain: avalanche_c, arbitrum @@ -194,6 +197,7 @@ models: - &recent_reinvest_info name: recent_reinvest_info description: "An array of the ratio growth and time between reinvests for the last 25 Reinvest events" + - name: yield_yak_balances meta: blockchain: avalanche_c, arbitrum @@ -221,6 +225,7 @@ models: - &deposit_token_balance name: deposit_token_balance description: "Balance of deposit tokens held in the contract in the time window specified" + - name: yield_yak_user_yrt_balances meta: blockchain: avalanche_c, arbitrum @@ -248,4 +253,120 @@ models: description: "UTC time until which the user held this balance of the contract_address YRT" - &yrt_balance name: yrt_balance - description: "Balance of YRT tokens held by the user_address in the time window specified" \ No newline at end of file + description: "Balance of YRT tokens held by the user_address in the time window specified" + + - name: yield_yak_yak_swaps + meta: + blockchain: avalanche_c, arbitrum + project: yield_yak + contributors: angus_1 + config: + tags: ['avalanche_c', 'arbitrum', 'yakswap', 'swaps', 'aggregator', 'yield_yak', 'dex'] + description: > + yield yak aggregator yak swaps + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - blockchain + - block_number + - tx_index + - evt_index + columns: + - *blockchain + - &yak_router_address + name: yak_router_address + description: "Address of the YakRouter contract which made the swap" + - *block_number + - *block_date + - *block_time + - *tx_index + - *tx_hash + - &tx_to_address + name: tx_to_address + description: "Address 'to' which this transaction was sent (i.e. which had a function called)" + - &tx_fee + name: tx_fee + description: "Transaction / gas cost in native token for the transaction calculated using (price * gas used)" + - *evt_index + - &number_of_swaps_in_tx + name: number_of_swaps_in_tx + description: "Count of the number of YakSwap events in this same transaction (used to divide the gas cost / tx fee)" + - &tx_fee_per_swap + name: tx_fee_per_swap + description: "Transaction fee divided per each Yak Swap event" + - &trader_address + name: trader_address + description: "Address which initiated the transaction" + - &swap_token_in_address + name: swap_token_in_address + description: "Address of the token being sold in the YakSwap event" + - &swap_token_out_address + name: swap_token_out_address + description: "Address of the token being bought in the YakSwap event" + - &swap_amount_in + name: swap_amount_in + description: "Amount of the sold token being swapped from / traded in the YakSwap event" + - &swap_amount_out + name: swap_amount_out + description: "Amount of the bought token being swapped to / bought in the YakSwap event" + - &number_of_hops + name: number_of_hops + description: "Number of steps/hops the YakSwap has gone through in order to get the desired token at the best rate" + - &yak_adapter_swaps + name: yak_adapter_swaps + description: "JSON array containing detailed information about the individual YakAdapterSwap events which make up this YakSwap" + + - name: yield_yak_yak_adapter_swaps + meta: + blockchain: avalanche_c, arbitrum + project: yield_yak + contributors: angus_1 + config: + tags: ['avalanche_c', 'arbitrum', 'yakswap', 'swaps', 'aggregator', 'yield_yak', 'dex', 'yakadapter'] + description: > + yield yak aggregator yak adapter swaps + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - blockchain + - block_number + - tx_index + - adapter_evt_index + columns: + - *blockchain + - *yak_router_address + - *block_number + - *block_date + - *block_time + - *tx_index + - *tx_hash + - *tx_to_address + - *tx_fee + - &swap_evt_index + name: swap_evt_index + description: "Index of the YakSwap event to which this YakAdapterSwap event is related" + - *number_of_swaps_in_tx + - *trader_address + - *swap_token_in_address + - *swap_token_out_address + - *swap_amount_in + - *swap_amount_out + - *number_of_hops + - &adapter_evt_index + name: adapter_evt_index + description: "Index of the YakAdapterSwap event in the transaction" + - &adapter_address + name: adapter_address + description: "Address of the adapter being used for this part of the YakSwap" + - &adapter_token_in_address + name: adapter_token_in_address + description: "Address of the token being sold in the YakAdapterSwap event" + - &adapter_token_out_address + name: adapter_token_out_address + description: "Address of the token being bought in the YakAdapterSwap event" + - &adapter_amount_in + name: adapter_amount_in + description: "Amount of the sold token being swapped from / traded in the YakAdapterSwap event" + - &adapter_amount_out + name: adapter_amount_out + description: "Amount of the bought token being swapped to / bought in the YakAdapterSwap event" \ No newline at end of file diff --git a/models/yield_yak/yield_yak_user_yrt_balances.sql b/models/yield_yak/yield_yak_user_yrt_balances.sql index 135ba7adfc9..2aefcbc14ac 100644 --- a/models/yield_yak/yield_yak_user_yrt_balances.sql +++ b/models/yield_yak/yield_yak_user_yrt_balances.sql @@ -1,6 +1,8 @@ -{{ config( +{{ + config( schema = 'yield_yak', alias = 'user_yrt_balances', + materialized = 'view', post_hook='{{ expose_spells( blockchains = \'["arbitrum", "avalanche_c"]\', spell_type = "project", diff --git a/models/yield_yak/yield_yak_withdraws.sql b/models/yield_yak/yield_yak_withdraws.sql index eed0f12148a..dfbeb45136d 100644 --- a/models/yield_yak/yield_yak_withdraws.sql +++ b/models/yield_yak/yield_yak_withdraws.sql @@ -1,6 +1,8 @@ -{{ config( - schema = 'yield_yak', +{{ + config( + schema = 'yield_yak', alias = 'withdraws', + materialized = 'view', post_hook='{{ expose_spells( blockchains = \'["arbitrum", "avalanche_c"]\', spell_type = "project", diff --git a/models/yield_yak/yield_yak_yak_adapter_swaps.sql b/models/yield_yak/yield_yak_yak_adapter_swaps.sql new file mode 100644 index 00000000000..6ea6cb57de7 --- /dev/null +++ b/models/yield_yak/yield_yak_yak_adapter_swaps.sql @@ -0,0 +1,52 @@ +{{ + config( + schema = 'yield_yak', + alias = 'yak_adapter_swaps', + materialized = 'view', + post_hook='{{ expose_spells( + blockchains = \'["arbitrum", "avalanche_c"]\', + spell_type = "project", + spell_name = "yield_yak", + contributors = \'["angus_1"]\') }}' + ) +}} + +{%- set yield_yak_models = [ +ref('yield_yak_avalanche_c_yak_adapter_swaps') +,ref('yield_yak_arbitrum_yak_adapter_swaps') +] -%} + + +SELECT * +FROM ( + {%- for adapter_swaps_model in yield_yak_models %} + SELECT + blockchain + , yak_router_address + , block_number + , block_date + , block_time + , tx_index + , tx_hash + , tx_to_address + , tx_fee + , swap_evt_index + , number_of_swaps_in_tx + , trader_address + , swap_token_in_address + , swap_token_out_address + , swap_amount_in + , swap_amount_out + , number_of_hops + , adapter_evt_index + , adapter_address + , adapter_token_in_address + , adapter_token_out_address + , adapter_amount_in + , adapter_amount_out + FROM {{ adapter_swaps_model }} + {% if not loop.last -%} + UNION ALL + {%- endif -%} + {%- endfor %} +) diff --git a/models/yield_yak/yield_yak_yak_swaps.sql b/models/yield_yak/yield_yak_yak_swaps.sql new file mode 100644 index 00000000000..c1cadba616f --- /dev/null +++ b/models/yield_yak/yield_yak_yak_swaps.sql @@ -0,0 +1,48 @@ +{{ + config( + schema = 'yield_yak', + alias = 'yak_swaps', + materialized = 'view', + post_hook='{{ expose_spells( + blockchains = \'["arbitrum", "avalanche_c"]\', + spell_type = "project", + spell_name = "yield_yak", + contributors = \'["angus_1"]\') }}' + ) +}} + +{%- set yield_yak_models = [ +ref('yield_yak_avalanche_c_yak_swaps') +,ref('yield_yak_arbitrum_yak_swaps') +] -%} + + +SELECT * +FROM ( + {%- for swaps_model in yield_yak_models %} + SELECT + blockchain + , yak_router_address + , block_number + , block_date + , block_time + , tx_index + , tx_hash + , tx_to_address + , tx_fee + , evt_index + , number_of_swaps_in_tx + , tx_fee_per_swap + , trader_address + , swap_token_in_address + , swap_token_out_address + , swap_amount_in + , swap_amount_out + , number_of_hops + , yak_adapter_swaps + FROM {{ swaps_model }} + {% if not loop.last -%} + UNION ALL + {%- endif -%} + {%- endfor %} +) From 6c13fdea4dc5b57ba52332c1c089c84426aaf93e Mon Sep 17 00:00:00 2001 From: yy-analytics <103118737+yy-analytics@users.noreply.github.com> Date: Wed, 5 Jun 2024 22:56:52 +0530 Subject: [PATCH 058/149] Adding strategies and tokens (#6081) * Added a few new hard coded strategy contract names * Added tokens which are used in Yak Swap or as deposit tokens in strategies to the tokens model --------- Co-authored-by: Huang Geyang Co-authored-by: jeff-dude <102681548+jeff-dude@users.noreply.github.com> --- .../yield_yak/yield_yak_strategies.sql | 5 + .../yield_yak_avalanche_c_sources.yml | 40 +++ .../tokens/arbitrum/tokens_arbitrum_erc20.sql | 3 + .../avalanche_c/tokens_avalanche_c_erc20.sql | 334 ++++++++++++++++++ 4 files changed, 382 insertions(+) diff --git a/macros/models/_project/yield_yak/yield_yak_strategies.sql b/macros/models/_project/yield_yak/yield_yak_strategies.sql index a5f00be4707..81b77f14124 100644 --- a/macros/models/_project/yield_yak/yield_yak_strategies.sql +++ b/macros/models/_project/yield_yak/yield_yak_strategies.sql @@ -46,6 +46,8 @@ 'DexStrategySA', 'DexStrategySAWithSwap', 'DexStrategySAWithSwapV2', + 'DexStrategy', + 'DexStrategyV2', 'DexStrategyV3', 'DexStrategyV4', 'DexStrategyV5', @@ -73,6 +75,7 @@ 'HakuStrategyForLP', 'IceQueenStrategy', 'IceQueenStrategyV2', + 'IceQueenStrategyV2b', 'JoeLendingStrategyAvaxV1', 'JoeLendingStrategyV1', 'JoeLendingStrategyV2', @@ -93,6 +96,7 @@ 'MasterYakStrategyForSA', 'MemeRushStrategy', 'MoreMoneyStrategy', + 'OliveStrategyForLP', 'OliveStrategyForLPa', 'OliveStrategyForLPb', 'OliveStrategyForLPc', @@ -113,6 +117,7 @@ 'SynapseStrategy', 'UnipoolStrategyV1', 'UspPlatypusStrategy', + 'Vault', 'VectorStrategyForDexLP', 'VectorStrategyForSA', 'VectorStrategyForSAV2', diff --git a/sources/yield_yak/avalanche_c/yield_yak_avalanche_c_sources.yml b/sources/yield_yak/avalanche_c/yield_yak_avalanche_c_sources.yml index 96dd04e2865..7e04d4b2b00 100644 --- a/sources/yield_yak/avalanche_c/yield_yak_avalanche_c_sources.yml +++ b/sources/yield_yak/avalanche_c/yield_yak_avalanche_c_sources.yml @@ -336,6 +336,22 @@ sources: loaded_at_field: evt_block_time - name: DexStrategySAWithSwapV2_evt_Transfer loaded_at_field: evt_block_time + - name: DexStrategy_evt_Deposit + loaded_at_field: evt_block_time + - name: DexStrategy_evt_Withdraw + loaded_at_field: evt_block_time + - name: DexStrategy_evt_Reinvest + loaded_at_field: evt_block_time + - name: DexStrategy_evt_Transfer + loaded_at_field: evt_block_time + - name: DexStrategyV2_evt_Deposit + loaded_at_field: evt_block_time + - name: DexStrategyV2_evt_Withdraw + loaded_at_field: evt_block_time + - name: DexStrategyV2_evt_Reinvest + loaded_at_field: evt_block_time + - name: DexStrategyV2_evt_Transfer + loaded_at_field: evt_block_time - name: DexStrategyV3_evt_Deposit loaded_at_field: evt_block_time - name: DexStrategyV3_evt_Withdraw @@ -552,6 +568,14 @@ sources: loaded_at_field: evt_block_time - name: IceQueenStrategyV2_evt_Transfer loaded_at_field: evt_block_time + - name: IceQueenStrategyV2b_evt_Deposit + loaded_at_field: evt_block_time + - name: IceQueenStrategyV2b_evt_Withdraw + loaded_at_field: evt_block_time + - name: IceQueenStrategyV2b_evt_Reinvest + loaded_at_field: evt_block_time + - name: IceQueenStrategyV2b_evt_Transfer + loaded_at_field: evt_block_time - name: JoeLendingStrategyAvaxV1_evt_Deposit loaded_at_field: evt_block_time - name: JoeLendingStrategyAvaxV1_evt_Withdraw @@ -712,6 +736,14 @@ sources: loaded_at_field: evt_block_time - name: MoreMoneyStrategy_evt_Transfer loaded_at_field: evt_block_time + - name: OliveStrategyForLP_evt_Deposit + loaded_at_field: evt_block_time + - name: OliveStrategyForLP_evt_Withdraw + loaded_at_field: evt_block_time + - name: OliveStrategyForLP_evt_Reinvest + loaded_at_field: evt_block_time + - name: OliveStrategyForLP_evt_Transfer + loaded_at_field: evt_block_time - name: OliveStrategyForLPa_evt_Deposit loaded_at_field: evt_block_time - name: OliveStrategyForLPa_evt_Withdraw @@ -872,6 +904,14 @@ sources: loaded_at_field: evt_block_time - name: UspPlatypusStrategy_evt_Transfer loaded_at_field: evt_block_time + - name: Vault_evt_Deposit + loaded_at_field: evt_block_time + - name: Vault_evt_Withdraw + loaded_at_field: evt_block_time + - name: Vault_evt_Reinvest + loaded_at_field: evt_block_time + - name: Vault_evt_Transfer + loaded_at_field: evt_block_time - name: VectorStrategyForDexLP_evt_Deposit loaded_at_field: evt_block_time - name: VectorStrategyForDexLP_evt_Withdraw diff --git a/tokens/models/tokens/arbitrum/tokens_arbitrum_erc20.sql b/tokens/models/tokens/arbitrum/tokens_arbitrum_erc20.sql index 691be9433eb..d4a3a2f0814 100644 --- a/tokens/models/tokens/arbitrum/tokens_arbitrum_erc20.sql +++ b/tokens/models/tokens/arbitrum/tokens_arbitrum_erc20.sql @@ -75,4 +75,7 @@ FROM (VALUES , (0x8d66ff1845b1bacc6e87d867ca4680d05a349ca8, 'S*USDT', 6) , (0xba4a858d664ddb052158168db04afa3cff5cfcc8, 'PENDLE-LPT', 18) , (0xf9f9779d8ff604732eba9ad345e6a27ef5c2a9d6, 'PENDLE-LPT', 18) + , (0x4cb9a7ae498cedcbb5eae9f25736ae7d428c9d66, 'XAI', 18) + , (0x323665443cef804a3b5206103304bd4872ea4253, 'USDV', 6) + , (0x966570a84709d693463cdd69dcadb0121b2c9d26, 'taoUSD', 18) ) AS temp_table (contract_address, symbol, decimals) diff --git a/tokens/models/tokens/avalanche_c/tokens_avalanche_c_erc20.sql b/tokens/models/tokens/avalanche_c/tokens_avalanche_c_erc20.sql index 9cbdefb9dab..150667ba16c 100644 --- a/tokens/models/tokens/avalanche_c/tokens_avalanche_c_erc20.sql +++ b/tokens/models/tokens/avalanche_c/tokens_avalanche_c_erc20.sql @@ -29,4 +29,338 @@ FROM (VALUES , (0x298c5c64eba94b8dd425582e4266a882db6d9848, 'SaAVAXb', 18) , (0x9767203e89dcd34851240b3919d4900d3e5069f1, 'A4', 6) , (0x9fb1d52596c44603198fb0aee434fac3a679f702, 'jEUR', 18) + , (0x0088997d32ced9bf97bd1c7ca0a2a8d92d0ab5cd, 'ZERO-LP', 18) + , (0x00933c16e06b1d15958317c2793bc54394ae356c, 'sPGL', 18) + , (0x00979bd14bd5eb5c456c5478d3bf4b6e9212ba7d, 'JLP', 18) + , (0x017025f07b23bb30e1140db10d3fe7a1626cfdd0, 'JLP', 18) + , (0x03a5888726667fff1e753fc06b51dd1245e7371a, 'JLP', 18) + , (0x052af5b8ac73082d8c4c8202bb21f4531a51dc73, 'APT', 12) + , (0x061f9edb3858d2faa5f629f6ae34140c92229ea8, 'JLP', 18) + , (0x07099b26f36fcb7e086d5a879ec1261271319829, 'YSL', 18) + , (0x0717c121d012e46a429a488eba1db22ad1051fdd, 'vAMM-WETH.e/USDT.e', 18) + , (0x0751f9a49d921aa282257563c2041b9a0e00eb78, 'ZERO-LP', 18) + , (0x078e3dde72b3fef804a5d5dbb133d537f9d9805f, 'gondolaBTCPool', 18) + , (0x07ba1d6c1316d509c5f0a473c67aba6cee6b5032, 'PAC', 18) + , (0x083e14c8c0e122e374e4c6ff2169d8db7e6728be, 'PLP', 18) + , (0x0a081f54d81095d9f8093b5f394ec9b0ef058876, 'PGL', 18) + , (0x0a6f6f504245bdc36b47d72d8718c09d6c0461de, 'JLP', 18) + , (0x0b82a1ad2138e9f62454ac41b702b64e0b73d57b, 'sGLP', 18) + , (0x0b9753d73e1c62933e913e9c2c94f2ffa8236f6c, 'PGL', 18) + , (0x0c91a070f862666bbcce281346be45766d874d98, 'JLP', 18) + , (0x0d84595e8638dbc631076c51000b2d31120d8aa1, 'JLP', 18) + , (0x0f684770f97227d6889c5bbea0325adb905d7a20, 'BGL', 18) + , (0x0fcee9e2bfa151d9f365a64a521ef0c9b78923c8, 'PGL', 18) + , (0x107f59a1a067d464c10969759132d78b1844f946, 'Olive-LP', 18) + , (0x1197bd102b59c7c52c4b2cf328234fbe4517a718, 'GAI', 18) + , (0x11bbfa2fa3b995cea99d20dfa618fd32e252d8f2, 'JLP', 18) + , (0x1205f31718499dbf1fca446663b532ef87481fe1, 'S*USDC', 6) + , (0x13beb85d61035dc51480ab230ce1cbaa8cc551da, 'PGL', 18) + , (0x158ede7f02475aa067fa35f4ff26c6cd86129429, 'ZERO-LP', 18) + , (0x161f750b753c7120599d07c352607f458ecb918e, 'Lydia-LP', 18) + , (0x1643de2efb8e35374d796297a9f95f64c082a8ce, 'JLP', 18) + , (0x1718309e2ad61a945fcd242f28dc83339b5d6192, 'Lydia-LP', 18) + , (0x1784b2ff6841d46163fbf817b3feb98a0e163e0f, 'PGL', 18) + , (0x18947bf710e9dddea8f7c33e2c9b93a6482be6a2, 'vAMM-BTC.b/WAVAX', 18) + , (0x1a95f00ac4826d9a8fa6eb9f9900c39513f6b1ca, 'JLP', 18) + , (0x1a9bd67c82c0e8e47c3ad2fa772fcb9b7a831a37, 'PGL', 18) + , (0x1ab40b7d22c17b5bf7d33bd6d9be4f291bbc4003, 'ZERO-LP', 18) + , (0x1aeb1def5b064df8e4470e57af17df72961a9ef8, 'ELP', 18) + , (0x1bb665942381fb2e67c4dccb04e6cfe7f130e93c, 'PGL', 18) + , (0x1c26f0324e838ed2add2117a021cda692b8a4bef, 'BGL', 18) + , (0x1c739a43606794849750c50bc7c43fbbdacdf801, 'APT', 24) + , (0x1da20ac34187b2d9c74f729b85acb225d3341b25, 'YUSDCRV-f', 18) + , (0x1e42cfa68e44a4fcc28b06e9f76f27bc90071eb6, 'CRL', 18) + , (0x1f0bc5c91518d903c0c097bde9741746b4423008, 'HAKU-LP', 18) + , (0x1ffb6ffc629f5d820dcf578409c2d26a2998a140, 'PGL', 18) + , (0x2036c0eb5c42ef7f1ca06df57d07f79eb3a2e0c8, 'gondolaDAIPool', 18) + , (0x2071a39da7450d68e4f4902774203df208860da2, 'vAMM-GLCR/WAVAX', 18) + , (0x20abdc20758990b6afc90da2f2d30cd0aa3f73c6, 'JLP', 18) + , (0x212f0bd6d5b4dee213e8d6f286f98a0a1965d2a0, 'RIBBIT', 9) + , (0x224b49b3fc8ef9fb1515b633f6c2537e87315b6d, 'JLP', 18) + , (0x22897cf0da31e1f118649d9f6ad1809cabd84948, 'BabyCoq', 9) + , (0x230c4ad11510360ad0db564a889c33559a959487, 'JLP', 18) + , (0x239c1d2fb158113dc4b10133b66d7516207879c5, 'SKY', 18) + , (0x23ddca8de11eccd8000263f008a92e10dc1f21e8, 'JLP', 18) + , (0x2612da8fc26efbca3cc3f8fd543bcba72b10ab59, 'ELP', 18) + , (0x2652094acf87c246d47f8cbf444ae69a6f007f0e, 'sAMM-USDt/USDC', 18) + , (0x2656e72c5e07711e8d697c7b1009e31174c6df66, 'PGL', 18) + , (0x269fafdc9f362414b9c08adbb8a3106af5a2dc01, 'ELP', 18) + , (0x2774516897ac629ad3ed9dcac7e375dda78412b9, 'JLP', 18) + , (0x278f24a782b96be10f15df93487aec5331cfdff1, 'PGL', 18) + , (0x27f382534916520f178bf9e201db4cd8172cc7d2, 'ELP', 18) + , (0x28690ec942671ac8d9bc442b667ec338ede6dfd3, 'deUSDC', 6) + , (0x288ffb87fc69dc652f9b564faf05db7468013544, 'ELP', 18) + , (0x29e0120de4406e9b2e28b15937b67eae5e50c510, 'JLP', 18) + , (0x29e144ea1abac02b62be7afb877d1bbaca141295, 'HAKU-LP', 18) + , (0x29e38769f23701a2e4a8ef0492e19da4604be62c, 'S*USDt', 6) + , (0x29eeb257a2a6ecde2984acedf80a1b687f18ec91, 'LP-WAVAX', 18) + , (0x2a053b0818c5529c89b10ac819db1c5c439ccec4, 'ZERO-LP', 18) + , (0x2a0f65c76008ecbc469b0850454e57310e770557, 'PGL', 18) + , (0x2a350dbe2875b59b63a485cf4bdd6dfde879858f, 'Olive-LP', 18) + , (0x2ade4f6d462d60523235650160844bb6b46ac7d9, 'JLP', 18) + , (0x2c890961dd920975b71020389bd09a1aea8caa3a, 'BGL', 18) + , (0x2d16af2d7f1edb4bc5dbadf3fff04670b4bcd0bb, 'JLP', 18) + , (0x2d38bde22e044ea59688ca7cdd4f0b5307cc519a, 'JLP', 18) + , (0x2d560eee40979368162ca4ac7ec39c8421cc732b, 'Lydia-LP', 18) + , (0x2d7458ce77f4e0ff41d07cefcf7231a7803b7647, 'yyAvax', 18) + , (0x2ddfdd8e1bec473f07815fa3cfea3bba4d39f37e, 'LP-ggAVAX', 18) + , (0x2e00d3e28d056a0b99f79ecd24e1de14156d07f0, 'BGL', 18) + , (0x2f4c1f54d0ac8e8ef545a91f040fb4c35bb36097, 'YSL', 18) + , (0x2fd81391e30805cc7f2ec827013ce86dc591b806, 'JLP', 18) + , (0x30556acc64b7b8f37ae4ce8325dd279847f09926, 'JLP', 18) + , (0x3152e0dd889045595d7635d8fc41965cea6209f2, 'HAKU-LP', 18) + , (0x317598200315f454d1b5e5cccf07c2e2c6aee172, 'PGL', 18) + , (0x32833a12ed3fd5120429fb01564c98ce3c60fc1d, 'APT', 12) + , (0x32a199f6f7bf9e04c19190a9b285dddeca29303e, 'vAMM-WAVAX/EUROC', 18) + , (0x32e3f290cd0dbe930fa286f0c2a9a958b3a03e30, 'vAMM-GMX/USDC', 18) + , (0x340d732f44e2fb8d08719883f1c2ae088eb11682, 'PGL', 18) + , (0x3619844a06e539f020bca7adcd732ae0bab48d91, 'PGL', 18) + , (0x361b625c074c736ef2d959e983b4478aa23a5d19, 'JLP', 18) + , (0x38877c87909c88a1ae87d1b8f3d9fd5c1cabdc54, 'BGL', 18) + , (0x38918142779e2cd1189cbd9e932723c968363d1e, 'aHYPE', 18) + , (0x3a7387f8ba3ebffa4a0eccb1733e940ce2275d3f, 'AS4D', 18) + , (0x3b90a467f58631369903c2005457a3d28d47f3e5, 'JLP', 18) + , (0x3bc40d4307cd946157447cd55d70ee7495ba6140, 'JLP', 18) + , (0x3ce6d3b2c85c182a3e4db6833b2c509b3990660e, 'JLP', 18) + , (0x3da3b242f1ac6d7ed04fedbaf4c402dda4e1dcdd, 'JLP', 18) + , (0x3daf1c6268362214ebb064647555438c6f365f96, 'JLP', 18) + , (0x3e58308a97af12ad4affe6f688a8b7e8a8e459b1, 'ELP', 18) + , (0x3e6be71de004363379d864006aac37c9f55f8329, 'JLP', 18) + , (0x3e8cc8deabfea1943209a18479c66193d219ce92, 'BGL', 18) + , (0x3fbd7dd99ca32f98a56ddee57b6b96e1152668f5, 'ELP', 18) + , (0x3fcfbcb4b368222fcb4d9c314eca597489fe8605, 'sPGL', 18) + , (0x41ab86eecbd110a82ca602d032a461f453066f1e, 'JLP', 18) + , (0x42571ca6e3994629061de9e645bb722d9131c4a6, 'EGGS', 18) + , (0x42c45fe57927ab94f5ba5484483b67184aa82e5d, 'PGL', 18) + , (0x43b9c8dec26c2d21146466caacabf94fdbeac473, 'JLP', 18) + , (0x45c2755eefa0eb96ce15c2f6fdc48346da7f3a7e, 'ZERO-LP', 18) + , (0x465460f46969f2bf969432956491dee95a6ba493, 'JLP', 18) + , (0x47898dbf127205ea2e94a30b5291c9476e36f3ba, 'JLP', 18) + , (0x4b946c91c2b1a7d7c40fb3c130cdfbaf8389094d, 'JLP', 18) + , (0x4cdafe540cd6205c9c941d49c4b1a8d3916192d8, 'BGL', 18) + , (0x4cea032b4b3f59f31d6d52071258ee0d42b6cc7e, 'ZERO-LP', 18) + , (0x4da067e13974a4d32d342d86fbbbe4fb0f95f382, 'AC4D', 18) + , (0x4dc5291cdc7ad03342994e35d0ccc76de065a566, 'JLP', 18) + , (0x4dc5a6308338e540aa97faab7fd2e03876075413, 'gondolaUSDCe', 18) + , (0x4ee072c5946b4cdc00cbdeb4a4e54a03cf6d08d3, 'Lydia-LP', 18) + , (0x519de4668ea6661d1870928a3033a62dc2acc503, 'HAKU-LP', 18) + , (0x51e2b24996e23cc280a69359bdf6123b5d0a18f1, 'BGL', 18) + , (0x53b37b9a6631c462d74d65d61e1c056ea9daa637, 'PGL', 18) + , (0x53e3d3e77b3ed38fdc5156f6ef761d85012850c2, 'ELP', 18) + , (0x551d0b15423d391d89cb3c5e6fb1bf9b28495fe4, 'PGL', 18) + , (0x57cc32cd7f5a531953e9af25e1c9394093428082, 'Olive-LP', 18) + , (0x58128ab3ecbf703682ede72f341944bffe3524b9, 'Lydia-LP', 18) + , (0x586554828ee99811a8ef75029351179949762c26, 'sPGL', 18) + , (0x590673007ff2839818cb1155926758e5f969d821, 'Lydia-LP', 18) + , (0x59a566660024e8f7168cf9e578397e88cd6ba843, 'ZERO-LP', 18) + , (0x59aca469884fc6edea6b5607f5337fe16075073f, 'JLP', 18) + , (0x59e4e5501764a293b829902d9cf01967fa80eff2, 'JLP', 18) + , (0x5a2be3aa5ed59cc120c1aee2f03146de02dfc280, 'CRL', 18) + , (0x5a5df1a7d9a35188243115dd9b6ce3b59b7f3a46, 'vAMM-WAVAX/USDT.e', 18) + , (0x5bb52840da88ceed069ba610787c40ed425bb311, 'ZERO-LP', 18) + , (0x5bc783079e9a04c67436d6e712d5e73099c08f16, 'Lydia-LP', 18) + , (0x5cf419013c8e4e9049aa9be9836d40f5caaa18da, 'PBC', 18) + , (0x5edb69f59cdbe4f6e8dc9a880a66042b3553dd39, 'CRL', 18) + , (0x5f233a14e1315955f48c5750083d9a44b0df8b50, 'PGL', 18) + , (0x5fc70cf6a4a858cf4124013047e408367eba1ace, 'Lydia-LP', 18) + , (0x601e0f63be88a52b79dbac667d6b4a167ce39113, 'JLP', 18) + , (0x603efefc3ed65e3f5b6730c603b0cfb4426e0f4f, 'PGL', 18) + , (0x605cb4dcad3fd553f97fbaa72a6a0306f954282b, 'HAKU-LP', 18) + , (0x6075eccadfc2917d58062af55090b6bd3de258f5, 'HAKU-LP', 18) + , (0x60c4d65f18f99dc8c0abd1b5a9b79a1bde0baaa1, 'PGL', 18) + , (0x61268404ce4c36999a08274401bbea3d1d7f0092, 'JLP', 18) + , (0x6178de6e552055862cf5c56310763eec0145688d, 'APT', 24) + , (0x617a4edfcec09864ca9d052ebcbab67da273f4d4, 'CHECK', 18) + , (0x61810322b03d73a7dc137c7821e2565460277137, 'BGL', 18) + , (0x61925434024a8b0ab7ea9ff44e1af7a106cfdbfd, 'PLP', 18) + , (0x621207093d2e65bf3ac55dd8bf0351b980a63815, 'sPGL', 18) + , (0x66ab843d86ad296ed1953c179d9ce2bb587ff2aa, 'JLP', 18) + , (0x66b7cd2046c633196cfd061db21ca6a23ab9ba3a, 'SWORD', 18) + , (0x66d12e1cb13eabab21f1fb6628b1ef33c6ded5a7, 'JLP', 18) + , (0x672406491d0db6d8e924dec3f8645cd592f4f0e9, 'BGL', 18) + , (0x67eda35115d7fd6930f95513472629211d827fee, 'Lydia-LP', 18) + , (0x6c2038f09212dac0ad30be822f0eecfb29064814, 'YSL', 18) + , (0x6c2782d9632efd35e93d33e25ba75c118682954c, 'HAKU-LP', 18) + , (0x6c86ed0e9ce0d0597c90ffbebd6197dcfa9466fd, 'CRL', 18) + , (0x6cbfb991986ebbbc91bf21ceaa3cbf1bd82469cf, 'PGL', 18) + , (0x6d6ed4d8686437ba3a045a1f9af1c4ed267d96e1, 'BGL', 18) + , (0x6f6a5f63cc7b7ddcad76752e633d45f3d5efb0e2, 'HAKU-LP', 18) + , (0x7313835802c6e8ca2a6327e6478747b71440f7a4, 'PGL', 18) + , (0x73a5bc09387798ae890f7f2c084f38840d06d5a5, 'BGL', 18) + , (0x73e6cb72a79dea7ed75ef5ed6f8cff86c9128ef5, 'PGL', 18) + , (0x74b651eff97871ea99fcc14423e611d85eb0ea93, 'JLP', 18) + , (0x751089f1bf31b13fa0f0537ae78108088a2253bf, 'sPGL', 18) + , (0x752c59f22faaa861108649f4596034796c69bc3f, 'Lydia-LP', 18) + , (0x76a551fc28029639ab017742c224159a786f544f, 'JLP', 18) + , (0x76fbce48d9dce3d04bfac318d1fdeb3a78e903a9, 'Olive-LP', 18) + , (0x7943acd42c41a345841cb22bd846794a22d8682d, 'HAKU-LP', 18) + , (0x79c1b4ee613f29a8c0aae563ef445317d99a6906, 'Olive-LP', 18) + , (0x7a6131110b82dacbb5872c7d352bfe071ea6a17c, 'PGL', 18) + , (0x7a886b5b2f24ed0ec0b3c4a17b930e16d160bd17, 'PGL', 18) + , (0x7abab5474385918820dfbc7f35712084a91b583a, 'Lydia-LP', 18) + , (0x7be2c5b9dee94102cf3920bf7192010be04d806b, 'Lydia-LP', 18) + , (0x7ca8e6a11466f8542f2b65b845c77d425182cbde, 'JLP', 18) + , (0x7d0af740540d634daafe8af34187ec22915fbe5b, 'BGL', 18) + , (0x7f1e6a8730fec77f27daeecd82e1941518383a62, 'gondolaYAKPool', 18) + , (0x7fc2c728d622d9d878b919bf157f61f5fd51845f, 'JLP', 18) + , (0x805b7d20e92893ff4b68c83e40c1fc9a7a6162fa, 'Lydia-LP', 18) + , (0x80a62e8a45f6467b499ee7edad3fd7bef0c83026, 'STACK', 18) + , (0x80f1b5d3665a61a91f896c1f0790b4062966610e, 'S*USDT', 6) + , (0x81034a38a124a3290dc226798f34c6645b153a02, 'JLP', 18) + , (0x81e5b8a9704101f625ec325b3d12e717f199c5ac, 'CRL', 18) + , (0x824ca83923990b91836ea927c14c1fb1b1790b08, 'JLP', 18) + , (0x829a9f8894ef17f1523ec87a9f8e5e0cf5dc2003, 'JLP', 18) + , (0x8461681211b49c15e20b3cfd4c63be258878b7d9, 'PGL', 18) + , (0x856ea7383de9c799cb07079fb416fc97ca248300, 'APT', 14) + , (0x862905a82382db9405a40dcaa8ee9e8f4af52c89, 'JLP', 18) + , (0x86a6391d5d7c02245927e2dc0cbfa3e5f1b9abc7, 'weUSDC', 18) + , (0x86e5a2b7c0789292386dda043e05ef206890b5b6, 'CRL', 18) + , (0x87bbfc9dcb66caa8ce7582a3f17b60a25cd8a248, '$Td', 9) + , (0x8912a0fadf3588c6791e42310b549a7bc0047b0e, 'PGL', 18) + , (0x8a998bcd8d04e36cf5d28984f9979b6404471e51, 'PGL', 18) + , (0x8ad91c059dd4ad6879e1349dc3f0e3645a412667, 'BGL', 18) + , (0x8c28394ed230cd6caf0daa0e51680fd57826dee3, 'JLP', 18) + , (0x8c581306147afcf3b2591e97cccabdcec86ce5e7, 'BGL', 18) + , (0x8fb5bd3ac8efd05dacae82f512dd03e14aadab73, 'JLP', 18) + , (0x917546780c6042d111e9b025add88d49b4dfef0f, 'PLP', 18) + , (0x9182a23099903c75681416b63f5d0a17f5eb387a, 'YSL', 18) + , (0x91b62fb52c9fdf27ad18bbe1c4a8ff52df6104cc, 'JLP', 18) + , (0x91f0963873bbca2e58d21bb0941c0d859db3ca31, 'JLP', 18) + , (0x92dc558cb9f8d0473391283ead77b79b416877ca, 'PGL', 18) + , (0x939d6ed8a0f7fc90436ba6842d7372250a03fa7c, 'JLP', 18) + , (0x94231f103882033b6103785675038347693f9cd8, 'YSL', 18) + , (0x943edd46fb9573a0b0517c0ce010791bd5ca0a15, 'JLP', 18) + , (0x949d256691fef4d48c138783c3445f400386818c, 'WAVAXp', 4) + , (0x94df699f8aa08314cbdfcca7dd6cfaa5ab9e8e26, 'PGL', 18) + , (0x957c17a32a88028b3e0cfa995fca0c016b6b7ed9, 'ELP', 18) + , (0x960c66dda302f4a496d936f693e083b1e9ace306, 'LP-WAVAX', 18) + , (0x9613acd03dcb6ee2a03546dd7992d7df2aa62d9a, 'PGL', 18) + , (0x96bbdb6811d47b1199d444d507de623a905d63f3, 'JLP', 18) + , (0x97b4957df08e185502a0ac624f332c7f8967ee8d, 'PGL', 18) + , (0x982716379b2372d06df5c461e2c79b24ea80c370, 'ZERO-LP', 18) + , (0x983e459d81f83d57757e1ddfb1318def8a82c001, 'Lydia-LP', 18) + , (0x9988a27919e8872b24f2ccb1991bf0297b68a470, 'ATECH', 9) + , (0x9a166ae3d4c3c2a7febfae86d16896933f4e10a9, 'JLP', 18) + , (0x9a4e5e7fbb3bbf0f04b78354aafea877e346ae33, 'sGLP', 18) + , (0x9c396cf96319c8ef2b662af57dea6ee374b9959f, 'JLP', 18) + , (0x9cfb46d0b92ac83aaa9ed0913f3f01cdbe22176d, 'Lydia-LP', 18) + , (0x9d472e21f6589380b21c42674b3585c47b74c891, 'PGL', 18) + , (0x9d563aff8b0017868dba57eb3e04298c157d0af5, 'PGL', 18) + , (0x9de1c0ae73f900838036c7e1d8b96924332f9ff8, 'BGL', 18) + , (0x9ef0c12b787f90f59cbbe0b611b82d30cab92929, 'JLP', 18) + , (0x9fa6ab3d78984a69e712730a2227f20bcc8b5ad9, 'yyAVAX-WAVAX-BPT', 18) + , (0xa13403733db5c101490436cfff012f6ac93a6097, 'vAMM-YAK/WAVAX', 18) + , (0xa2cb068e205a8b99dac4a7c252a4ecffe836b547, 'PGL', 18) + , (0xa3a029224857bf467e896523e268a5fc005ce810, 'JLP', 18) + , (0xa3d9dadb140e2328e36d9122ef3f8085cfa3d2c2, 'PLP', 18) + , (0xa42be3db9aff3aee48167b240bfee5e1697e1281, 's3F', 18) + , (0xa57e0d32aa27d3b1d5aff6a8a786c6a4dadb818f, 'USDC-AM3D', 18) + , (0xa6908c7e3be8f4cd2eb704b5cb73583ebf56ee62, 'JLP', 18) + , (0xa6cab4b1019ee22309dca5ba62c3372a791dcb2e, 'K3C', 18) + , (0xa78f782fd56021025bf74da0851939ffe0d55a51, 'JLP', 18) + , (0xa964239892fb28b5565c70a51fd4106f29f47a52, 'JLP', 18) + , (0xac3757c2305d6d1ab30f46b9278d7946da2b92f7, 'PLP', 18) + , (0xad24a72ffe0466399e6f69b9332022a71408f10b, 'PGL', 18) + , (0xad3afde5b6b8c353078fd368f508c97d593353cc, 'JLP', 18) + , (0xad556e7dc377d9089c6564f9e8d275f5ee4da22d, 'AA3D', 18) + , (0xad786dfe6ac4a68dd3f9a5400ddee5dedd20d109, 'Olive-LP', 18) + , (0xada7a31b692e3abfccd02c3d7f8adc5944510291, 'S*USDC', 6) + , (0xadde8b6d687edad6f0835eba3bb04480f3010b08, 'BGL', 18) + , (0xae64d55a6f09e4263421737397d1fdfa71896a69, 'sGLP', 18) + , (0xaea2e71b631fa93683bcf256a8689dfa0e094fcd, '3poolV2-f', 18) + , (0xb057102268d2509581053576cc69386ed37f5a3f, 'CRL', 18) + , (0xb23ad5513c17f36d9669bbb95077abb31c8d1f3e, 'BGL', 18) + , (0xb26f0e66317846bd5fe0cbaa1d269f0efeb05c96, 'USDC-USDT-BPT', 18) + , (0xb39517659a29020684d7f3fbef3b852f7156661c, 'CRL', 18) + , (0xb3ec35716877c27fe677fc2f8b2bdf9c0a72bf61, 'PLP', 18) + , (0xb3f21fc59bc06209d5fb82c474f21582aef09a20, 'MONEY3CRV-f', 18) + , (0xb56770816d23dffc93deec1db313159f2a40a029, 'BGL', 18) + , (0xb5c9e891af3063004a441ba4fab4ca3d6deb5626, 'JLP', 18) + , (0xb74791cc65479132b52043b764bbb540439fdf02, 'Lydia-LP', 18) + , (0xb78c8238bd907c42be45aebdb4a8c8a5d7b49755, 'JLP', 18) + , (0xb835f15ed39a5c0e8e1a83df52c4ecd7cacd198e, 'PLP', 18) + , (0xb8361d0e3f3b0fc5e6071f3a3c3271223c49e3d9, 'JLP', 18) + , (0xb8d5e8a9247db183847c7d79af9c67f6aef759f7, 'JLP', 18) + , (0xba4f83989aed9456114cb452f29171abff92cf8a, 'fsBLP', 18) + , (0xbbc7fff833d27264aac8806389e02f717a5506c9, 'PGL', 18) + , (0xbbf8e4b9ad041ede1f5270caf5b7b41f0e55f719, 'JLP', 18) + , (0xbccebf064b8fcc0cb4df6c5d15f9f6fead3df88d, 'PGL', 18) + , (0xbcd81aaa76d9c1e3aed31c315761c0d9779751b5, 'Olive-LP', 18) + , (0xbdc7ef37283bc67d50886c4afb64877e3e83f869, 'JLP', 18) + , (0xbe1b87f47fde3f338aa3aa98b85435e1709dfd06, 'JLP', 18) + , (0xbe29d10ebdfbd5a82eb54d4db4a224c060bdbd96, 'gondolaTSD', 18) + , (0xbe39c025e88b4fa783e7f656f80c9d149ee4b862, 'JLP', 18) + , (0xbeae89c724b3ed54b255ef6b53017f1520bb130e, 'ZERO-LP', 18) + , (0xbeb0b5fbd99b8e7498a4063cb419646922f6eef8, 'JLP', 18) + , (0xbfc3c72bab7252341dc90a1e85797ebd8c79c338, 'Olive-LP', 18) + , (0xc013f541f55461cc039bcdba9c4dc3bdded6c828, 'PGL', 18) + , (0xc096ff2606152ed2a06dd12f15a3c0466aa5a9fa, 'LP-sAVAX', 18) + , (0xc0fbc4967259786c743361a5885ef49380473dcf, 'ALEPH', 18) + , (0xc13546b97b9b1b15372368dc06529d7191081f5b, 'ggAVAX-WAVAX-BPT', 18) + , (0xc154c5b9e4c04dced5c4bae18580c67d5b7a62a8, 'CRL', 18) + , (0xc161e4b11faf62584efcd2100ccb461a2dde64d1, 'AM3D', 18) + , (0xc289857a344512445d0623e010f008c24eb829ff, 'AVALANCHE', 18) + , (0xc37ecfa7bbf1df92da7c4a3d92d8cf8657d1ff7f, 'gondolaETHPool', 18) + , (0xc45893e0ee426a643e54829ee8c697995e5980ed, 'JLP', 18) + , (0xc48d93844b5fe60283425f6124ba3a741441a3c3, 'JLP', 18) + , (0xc5ab0c94bc88b98f55f4e21c1474f67ab2329cfd, 'PGL', 18) + , (0xc7c3201fd950b6d1173d91170a1dc0f8d86a1f14, 'CULT ', 18) + , (0xc8898e2eee8a1d08742bb3173311697966451f61, 'JLP', 18) + , (0xc91e49f165cab7e96ac7f7f460ebf2964cc4bb76, 'PGL', 18) + , (0xc992ab46428a5a2edeb8f44d946ce5642f97ef71, 'JLP', 18) + , (0xca80913550c15bacdb806b803d2c5f79283385f3, 'yyAVAX', 18) + , (0xca87bf3ec55372d9540437d7a86a7750b42c02f4, 'nUSD-LP', 18) + , (0xcc71de5254471a8669cde5443ec960e2519adf0d, 'JLP', 18) + , (0xcd5043292d99d63f42f0447d77e5ca048506bad6, 'xPARTY', 18) + , (0xcdfd91eea657cc2701117fe9711c9a4f61feed23, 'JLP', 18) + , (0xce8d21a303b28d8ce00c0807acfe99f9b761c880, 'PGL', 18) + , (0xcf35400a595efcf0af591d3aeb5a35cbcd120d54, 'PGL', 18) + , (0xcfc37a6ab183dd4aed08c204d1c2773c0b1bdf46, 'nUSD', 18) + , (0xd0945d9985f746317f19fa152a615ebac77ad534, 'CRL', 18) + , (0xd3566ec8cdf8cb4e66b9f958ddb47e225c51e58b, 'Olive-LP', 18) + , (0xd67234624ca82fa82a2a3010e42c165e9b1b7502, '$MUMU', 6) + , (0xd7624532b03947c5949e5c3edc4d74eb8d84d76d, 'FROST', 9) + , (0xd765b31399985f411a9667330764f62153b42c76, 'PGL', 18) + , (0xd7d4a4c67e9c1f5a913bc38e87e228f4b8820e8a, 'gondolaDAIeUSDTe', 18) + , (0xd895cc41d823f75ecdee52ea102928ca3b5c7099, 'PGL', 18) + , (0xd8b262c0676e13100b33590f10564b46eef652ad, 'PGL', 18) + , (0xdacde03d7ab4d81feddc3a20faa89abac9072ce2, 'USP', 18) + , (0xde1a11c331a0e45b9ba8fee04d4b51a745f1e4a4, 's3D', 18) + , (0xe15a55eb614910ce59288964df400fe99b774bb3, 'PGL', 18) + , (0xe1d895ff6721a77c16f4c53eeb43869da2dab02f, 'JLP', 18) + , (0xe1f75e2e74ba938abd6c3be18ccc5c7f71925c4b, 'PGL', 18) + , (0xe22a65204726f102d9e3539b85d3999dee2e421f, 'Lydia-LP', 18) + , (0xe2d7728a672410382102860ebecf1c917a4d6166, 'JLP', 18) + , (0xe4b269b61471d81898be034dab496910a5796154, 'ELP', 18) + , (0xe4b66ca7a32ddc21df3c1233866957573e7ec744, 'JLP', 18) + , (0xe4b9865c0866346ba3613ec122040a365637fb46, 'JLP', 18) + , (0xe5350ad10f9f9341cd5a761b845eff25ddafddba, 'Olive-LP', 18) + , (0xe586db7db75b87a3e84110a73b99960f5f106c6a, 'gondolaUSDTPool', 18) + , (0xe7417729ecb7e483479cb69936a017681dd81031, 'PGL', 18) + , (0xe8acf438b10a2c09f80aef3ef2858f8e758c98f9, 'PGL', 18) + , (0xe98d0f9ede480b7f027b9406c9f24eaa194ad717, 'PLP', 18) + , (0xe9dfcabaca5e45c0f3c151f97900511f3e73fb47, 'PGL', 18) + , (0xeac3778e5658667b72aebe8c71f97ed8b3b5887b, 'Lydia-LP', 18) + , (0xeaed05a7cbcfd0e3504e2cf545c70f291796eb26, 'ZERO-LP', 18) + , (0xebf50b8089a0c5e7c5de23f644fcd723818f65b3, 'JLP', 18) + , (0xecd6d33555183bc82264dbc8bebd77a1f02e421e, 'JLP', 18) + , (0xed7a2b4054757cfdb632af15ad528624f0fff3b0, 'PGL', 18) + , (0xee25009c093a06896acf29cf93386ecc00b1714b, 'JLP', 18) + , (0xeffff893f9423fdb7a5c010cef202ea5a52575a6, 'HAKU-LP', 18) + , (0xf1d9d971ab9231759d952b22223b4d76d8b181e5, 'Lydia-LP', 18) + , (0xf1e800ab9d0d1f6eaff54e00ad19710c41b154f2, 'YSL', 18) + , (0xf31a76d123dd6b10008f2f096ab0aafbd508a2de, 'ELP', 18) + , (0xf3336be3416916d26840f41780e0cbc861ef3b3c, 'JLP', 18) + , (0xf372ceae6b2f4a2c4a6c0550044a7eab914405ea, 'PGL', 18) + , (0xf54a719215622f602fca5bf5a6509734c3574a4c, 'Olive-LP', 18) + , (0xf57971383560715cccf94e0c639125ae0e955e60, 'JLP', 18) + , (0xf6240f39f9f82e7cafbe6ffe0bfaf1e2e4c5bdb4, 'aGAME', 18) + , (0xf812a978a08f370b9ab358a620377c0a261aa403, 'APT', 24) + , (0xf8ba19769aae90bef1d6b00aaee38204ed48976a, 'JLP', 18) + , (0xfba30990f79e1df3842bb8ac3d86b2454a760151, 'PGL', 18) + , (0xfba4edaad3248b03f1a3261ad06ad846a8e50765, 'Lydia-LP', 18) + , (0xfd2620c9cfcec7d152467633b3b0ca338d3d78cc, 'sAVAX-WAVAX-BPT', 18) + , (0xfdfe62182f63000b58c70bdd39566dec89d4006c, 'JLP', 18) + , (0xfebf47cf89f766e6c24317b17f862ba5d4d82f8c, 'ELP', 18) + , (0xffa26cb3458023c4b78c3d10f8bef4704c2fd198, 'HAKU-LP', 18) ) AS temp_table (contract_address, symbol, decimals) From 099a2ff8d89f34888587c70cff711a7b5f60e6f5 Mon Sep 17 00:00:00 2001 From: Alan Ghobadi Date: Wed, 5 Jun 2024 19:27:06 +0200 Subject: [PATCH 059/149] Chainlink performance improvements (#6085) * Add incremental predicate to vrf_request_fulfilled_daily * Add incremental predicates to ocr_reward_evt_transfer_daily --- .../chainlink_arbitrum_ocr_reward_evt_transfer_daily.sql | 1 + .../arbitrum/chainlink_arbitrum_vrf_request_fulfilled_daily.sql | 1 + .../chainlink_avalanche_c_ocr_reward_evt_transfer_daily.sql | 1 + .../chainlink_avalanche_c_vrf_request_fulfilled_daily.sql | 1 + .../bnb/chainlink_bnb_ocr_reward_evt_transfer_daily.sql | 1 + .../chainlink/bnb/chainlink_bnb_vrf_request_fulfilled_daily.sql | 1 + .../chainlink_ethereum_ocr_reward_evt_transfer_daily.sql | 1 + .../ethereum/chainlink_ethereum_vrf_request_fulfilled_daily.sql | 1 + .../fantom/chainlink_fantom_ocr_reward_evt_transfer_daily.sql | 1 + .../fantom/chainlink_fantom_vrf_request_fulfilled_daily.sql | 1 + .../gnosis/chainlink_gnosis_ocr_reward_evt_transfer_daily.sql | 1 + .../chainlink_optimism_ocr_reward_evt_transfer_daily.sql | 1 + .../polygon/chainlink_polygon_ocr_reward_evt_transfer_daily.sql | 1 + .../polygon/chainlink_polygon_vrf_request_fulfilled_daily.sql | 1 + 14 files changed, 14 insertions(+) diff --git a/daily_spellbook/models/chainlink/arbitrum/chainlink_arbitrum_ocr_reward_evt_transfer_daily.sql b/daily_spellbook/models/chainlink/arbitrum/chainlink_arbitrum_ocr_reward_evt_transfer_daily.sql index 80bb9c4edc8..b0e5198825e 100644 --- a/daily_spellbook/models/chainlink/arbitrum/chainlink_arbitrum_ocr_reward_evt_transfer_daily.sql +++ b/daily_spellbook/models/chainlink/arbitrum/chainlink_arbitrum_ocr_reward_evt_transfer_daily.sql @@ -6,6 +6,7 @@ materialized='incremental', file_format='delta', incremental_strategy='merge', + incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.date_start')], unique_key=['date_start', 'admin_address'], post_hook='{{ expose_spells(\'["arbitrum"]\', "project", diff --git a/daily_spellbook/models/chainlink/arbitrum/chainlink_arbitrum_vrf_request_fulfilled_daily.sql b/daily_spellbook/models/chainlink/arbitrum/chainlink_arbitrum_vrf_request_fulfilled_daily.sql index e0c4b09fa5e..25bcdffb9e1 100644 --- a/daily_spellbook/models/chainlink/arbitrum/chainlink_arbitrum_vrf_request_fulfilled_daily.sql +++ b/daily_spellbook/models/chainlink/arbitrum/chainlink_arbitrum_vrf_request_fulfilled_daily.sql @@ -6,6 +6,7 @@ materialized='incremental', file_format='delta', incremental_strategy='merge', + incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.date_start')], unique_key=['date_start', 'operator_address'] ) }} diff --git a/daily_spellbook/models/chainlink/avalanche_c/chainlink_avalanche_c_ocr_reward_evt_transfer_daily.sql b/daily_spellbook/models/chainlink/avalanche_c/chainlink_avalanche_c_ocr_reward_evt_transfer_daily.sql index afe031825c0..3102d16f564 100644 --- a/daily_spellbook/models/chainlink/avalanche_c/chainlink_avalanche_c_ocr_reward_evt_transfer_daily.sql +++ b/daily_spellbook/models/chainlink/avalanche_c/chainlink_avalanche_c_ocr_reward_evt_transfer_daily.sql @@ -6,6 +6,7 @@ materialized='incremental', file_format='delta', incremental_strategy='merge', + incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.date_start')], unique_key=['date_start', 'admin_address'], post_hook='{{ expose_spells(\'["avalanche_c"]\', "project", diff --git a/daily_spellbook/models/chainlink/avalanche_c/chainlink_avalanche_c_vrf_request_fulfilled_daily.sql b/daily_spellbook/models/chainlink/avalanche_c/chainlink_avalanche_c_vrf_request_fulfilled_daily.sql index 75fc552095d..a8396a08dd9 100644 --- a/daily_spellbook/models/chainlink/avalanche_c/chainlink_avalanche_c_vrf_request_fulfilled_daily.sql +++ b/daily_spellbook/models/chainlink/avalanche_c/chainlink_avalanche_c_vrf_request_fulfilled_daily.sql @@ -6,6 +6,7 @@ materialized='incremental', file_format='delta', incremental_strategy='merge', + incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.date_start')], unique_key=['date_start', 'operator_address'] ) }} diff --git a/daily_spellbook/models/chainlink/bnb/chainlink_bnb_ocr_reward_evt_transfer_daily.sql b/daily_spellbook/models/chainlink/bnb/chainlink_bnb_ocr_reward_evt_transfer_daily.sql index 5e740f12ef2..39ea75601c7 100644 --- a/daily_spellbook/models/chainlink/bnb/chainlink_bnb_ocr_reward_evt_transfer_daily.sql +++ b/daily_spellbook/models/chainlink/bnb/chainlink_bnb_ocr_reward_evt_transfer_daily.sql @@ -6,6 +6,7 @@ materialized='incremental', file_format='delta', incremental_strategy='merge', + incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.date_start')], unique_key=['date_start', 'admin_address'], post_hook='{{ expose_spells(\'["bnb"]\', "project", diff --git a/daily_spellbook/models/chainlink/bnb/chainlink_bnb_vrf_request_fulfilled_daily.sql b/daily_spellbook/models/chainlink/bnb/chainlink_bnb_vrf_request_fulfilled_daily.sql index 46714e3ecb3..c0d1d1a937a 100644 --- a/daily_spellbook/models/chainlink/bnb/chainlink_bnb_vrf_request_fulfilled_daily.sql +++ b/daily_spellbook/models/chainlink/bnb/chainlink_bnb_vrf_request_fulfilled_daily.sql @@ -6,6 +6,7 @@ materialized='incremental', file_format='delta', incremental_strategy='merge', + incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.date_start')], unique_key=['date_start', 'operator_address'] ) }} diff --git a/daily_spellbook/models/chainlink/ethereum/chainlink_ethereum_ocr_reward_evt_transfer_daily.sql b/daily_spellbook/models/chainlink/ethereum/chainlink_ethereum_ocr_reward_evt_transfer_daily.sql index ad1c4187142..ee474a45120 100644 --- a/daily_spellbook/models/chainlink/ethereum/chainlink_ethereum_ocr_reward_evt_transfer_daily.sql +++ b/daily_spellbook/models/chainlink/ethereum/chainlink_ethereum_ocr_reward_evt_transfer_daily.sql @@ -6,6 +6,7 @@ materialized='incremental', file_format='delta', incremental_strategy='merge', + incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.date_start')], unique_key=['date_start', 'admin_address'], post_hook='{{ expose_spells(\'["ethereum"]\', "project", diff --git a/daily_spellbook/models/chainlink/ethereum/chainlink_ethereum_vrf_request_fulfilled_daily.sql b/daily_spellbook/models/chainlink/ethereum/chainlink_ethereum_vrf_request_fulfilled_daily.sql index 5b6a038c914..dfb122c7aec 100644 --- a/daily_spellbook/models/chainlink/ethereum/chainlink_ethereum_vrf_request_fulfilled_daily.sql +++ b/daily_spellbook/models/chainlink/ethereum/chainlink_ethereum_vrf_request_fulfilled_daily.sql @@ -6,6 +6,7 @@ materialized='incremental', file_format='delta', incremental_strategy='merge', + incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.date_start')], unique_key=['date_start', 'operator_address'] ) }} diff --git a/daily_spellbook/models/chainlink/fantom/chainlink_fantom_ocr_reward_evt_transfer_daily.sql b/daily_spellbook/models/chainlink/fantom/chainlink_fantom_ocr_reward_evt_transfer_daily.sql index 59bbeed9b68..19207ee97e6 100644 --- a/daily_spellbook/models/chainlink/fantom/chainlink_fantom_ocr_reward_evt_transfer_daily.sql +++ b/daily_spellbook/models/chainlink/fantom/chainlink_fantom_ocr_reward_evt_transfer_daily.sql @@ -6,6 +6,7 @@ materialized='incremental', file_format='delta', incremental_strategy='merge', + incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.date_start')], unique_key=['date_start', 'admin_address'], post_hook='{{ expose_spells(\'["fantom"]\', "project", diff --git a/daily_spellbook/models/chainlink/fantom/chainlink_fantom_vrf_request_fulfilled_daily.sql b/daily_spellbook/models/chainlink/fantom/chainlink_fantom_vrf_request_fulfilled_daily.sql index dba04306e19..adf40ea1c46 100644 --- a/daily_spellbook/models/chainlink/fantom/chainlink_fantom_vrf_request_fulfilled_daily.sql +++ b/daily_spellbook/models/chainlink/fantom/chainlink_fantom_vrf_request_fulfilled_daily.sql @@ -6,6 +6,7 @@ materialized='incremental', file_format='delta', incremental_strategy='merge', + incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.date_start')], unique_key=['date_start', 'operator_address'] ) }} diff --git a/daily_spellbook/models/chainlink/gnosis/chainlink_gnosis_ocr_reward_evt_transfer_daily.sql b/daily_spellbook/models/chainlink/gnosis/chainlink_gnosis_ocr_reward_evt_transfer_daily.sql index 29dadec4ff3..f5d33a991c5 100644 --- a/daily_spellbook/models/chainlink/gnosis/chainlink_gnosis_ocr_reward_evt_transfer_daily.sql +++ b/daily_spellbook/models/chainlink/gnosis/chainlink_gnosis_ocr_reward_evt_transfer_daily.sql @@ -6,6 +6,7 @@ materialized='incremental', file_format='delta', incremental_strategy='merge', + incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.date_start')], unique_key=['date_start', 'admin_address'], post_hook='{{ expose_spells(\'["gnosis"]\', "project", diff --git a/daily_spellbook/models/chainlink/optimism/chainlink_optimism_ocr_reward_evt_transfer_daily.sql b/daily_spellbook/models/chainlink/optimism/chainlink_optimism_ocr_reward_evt_transfer_daily.sql index 9942ce58d55..49d31a5060c 100644 --- a/daily_spellbook/models/chainlink/optimism/chainlink_optimism_ocr_reward_evt_transfer_daily.sql +++ b/daily_spellbook/models/chainlink/optimism/chainlink_optimism_ocr_reward_evt_transfer_daily.sql @@ -6,6 +6,7 @@ materialized='incremental', file_format='delta', incremental_strategy='merge', + incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.date_start')], unique_key=['date_start', 'admin_address'], post_hook='{{ expose_spells(\'["optimism"]\', "project", diff --git a/daily_spellbook/models/chainlink/polygon/chainlink_polygon_ocr_reward_evt_transfer_daily.sql b/daily_spellbook/models/chainlink/polygon/chainlink_polygon_ocr_reward_evt_transfer_daily.sql index 9173f321ea4..15060ea0a73 100644 --- a/daily_spellbook/models/chainlink/polygon/chainlink_polygon_ocr_reward_evt_transfer_daily.sql +++ b/daily_spellbook/models/chainlink/polygon/chainlink_polygon_ocr_reward_evt_transfer_daily.sql @@ -6,6 +6,7 @@ materialized='incremental', file_format='delta', incremental_strategy='merge', + incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.date_start')], unique_key=['date_start', 'admin_address'], post_hook='{{ expose_spells(\'["polygon"]\', "project", diff --git a/daily_spellbook/models/chainlink/polygon/chainlink_polygon_vrf_request_fulfilled_daily.sql b/daily_spellbook/models/chainlink/polygon/chainlink_polygon_vrf_request_fulfilled_daily.sql index faf0bd6600b..78909aec049 100644 --- a/daily_spellbook/models/chainlink/polygon/chainlink_polygon_vrf_request_fulfilled_daily.sql +++ b/daily_spellbook/models/chainlink/polygon/chainlink_polygon_vrf_request_fulfilled_daily.sql @@ -6,6 +6,7 @@ materialized='incremental', file_format='delta', incremental_strategy='merge', + incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.date_start')], unique_key=['date_start', 'operator_address'] ) }} From 65434527b185162977e4257438567800d51c506e Mon Sep 17 00:00:00 2001 From: jeff-dude <102681548+jeff-dude@users.noreply.github.com> Date: Wed, 5 Jun 2024 15:17:52 -0400 Subject: [PATCH 060/149] fix incremental column (#6092) --- models/jupiter/solana/jupiter_solana_aggregator_swaps.sql | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/models/jupiter/solana/jupiter_solana_aggregator_swaps.sql b/models/jupiter/solana/jupiter_solana_aggregator_swaps.sql index 3a9e3a4570c..05974173d2c 100644 --- a/models/jupiter/solana/jupiter_solana_aggregator_swaps.sql +++ b/models/jupiter/solana/jupiter_solana_aggregator_swaps.sql @@ -180,13 +180,13 @@ LEFT JOIN {{ ref('prices_usd_forward_fill') }} p_1 ON p_1.blockchain = 'solana' AND date_trunc('minute', l.block_time) = p_1.minute AND l.input_mint = toBase58(p_1.contract_address) {% if is_incremental() %} - AND {{ incremental_predicate('p_1.block_time') }} + AND {{ incremental_predicate('p_1.minute') }} {% endif %} LEFT JOIN {{ ref('prices_usd_forward_fill') }} p_2 ON p_2.blockchain = 'solana' AND date_trunc('minute', l.block_time) = p_2.minute AND l.output_mint = toBase58(p_2.contract_address) {% if is_incremental() %} - AND {{ incremental_predicate('p_2.block_time') }} + AND {{ incremental_predicate('p_2.minute') }} {% endif %} WHERE l.input_mint not in ('4PfN9GDeF9yQ37qt9xCPsQ89qktp1skXfbsZ5Azk82Xi') AND l.output_mint not in ('4PfN9GDeF9yQ37qt9xCPsQ89qktp1skXfbsZ5Azk82Xi') \ No newline at end of file From c8059f90ac5c27b91b04b04a3f511ad83430dd30 Mon Sep 17 00:00:00 2001 From: hildobby Date: Wed, 5 Jun 2024 22:46:06 +0200 Subject: [PATCH 061/149] Create croscchain `cex.flows` (#6031) * create croscchain cex.flows * INCREASING CI TIMEOUT - UNDO BEFORE MERGE * Fix post_hook * add incremental predicate and undo CI timeout change * add target filter to chain level spells --------- Co-authored-by: Huang Geyang Co-authored-by: jeff-dude --- models/_sector/cex/flows/_schema.yml | 407 +-------------- models/_sector/cex/flows/cex_flows.sql | 64 +++ models/_sector/cex/flows/chains/_schema.yml | 476 ++++++++++++++++++ .../flows/{ => chains}/cex_arbitrum_flows.sql | 1 + .../{ => chains}/cex_avalanche_c_flows.sql | 1 + .../cex/flows/{ => chains}/cex_base_flows.sql | 1 + .../cex/flows/{ => chains}/cex_bnb_flows.sql | 1 + .../cex/flows/{ => chains}/cex_celo_flows.sql | 1 + .../flows/{ => chains}/cex_ethereum_flows.sql | 1 + .../flows/{ => chains}/cex_gnosis_flows.sql | 1 + .../flows/{ => chains}/cex_optimism_flows.sql | 1 + .../flows/{ => chains}/cex_polygon_flows.sql | 1 + .../flows/{ => chains}/cex_scroll_flows.sql | 1 + .../flows/{ => chains}/cex_zksync_flows.sql | 1 + .../cex/flows/{ => chains}/cex_zora_flows.sql | 1 + 15 files changed, 558 insertions(+), 401 deletions(-) create mode 100644 models/_sector/cex/flows/cex_flows.sql create mode 100644 models/_sector/cex/flows/chains/_schema.yml rename models/_sector/cex/flows/{ => chains}/cex_arbitrum_flows.sql (83%) rename models/_sector/cex/flows/{ => chains}/cex_avalanche_c_flows.sql (83%) rename models/_sector/cex/flows/{ => chains}/cex_base_flows.sql (83%) rename models/_sector/cex/flows/{ => chains}/cex_bnb_flows.sql (83%) rename models/_sector/cex/flows/{ => chains}/cex_celo_flows.sql (83%) rename models/_sector/cex/flows/{ => chains}/cex_ethereum_flows.sql (83%) rename models/_sector/cex/flows/{ => chains}/cex_gnosis_flows.sql (83%) rename models/_sector/cex/flows/{ => chains}/cex_optimism_flows.sql (83%) rename models/_sector/cex/flows/{ => chains}/cex_polygon_flows.sql (83%) rename models/_sector/cex/flows/{ => chains}/cex_scroll_flows.sql (83%) rename models/_sector/cex/flows/{ => chains}/cex_zksync_flows.sql (83%) rename models/_sector/cex/flows/{ => chains}/cex_zora_flows.sql (83%) diff --git a/models/_sector/cex/flows/_schema.yml b/models/_sector/cex/flows/_schema.yml index 41084dd6f17..0e6a29425b6 100644 --- a/models/_sector/cex/flows/_schema.yml +++ b/models/_sector/cex/flows/_schema.yml @@ -1,17 +1,18 @@ version: 2 models: - - name: cex_ethereum_flows + - name: cex_flows meta: - blockchain: ethereum + blockchain: ethereum, arbitrum, avalanche_c, base, bnb, celo, gnosis, gnosis, optimism, polygon, scroll, zksync, zora sector: cex contributors: hildobby config: - tags: ['cex','flows', 'ethereum'] - description: "All CEX-tied flows identified on Ethereum" + tags: ['cex','flows'] + description: "All CEX-tied flows identified across EVM chains" tests: - dbt_utils.unique_combination_of_columns: combination_of_columns: + - blockchain - flow_type - unique_key columns: @@ -77,400 +78,4 @@ models: description: "Event index" - &unique_key name: unique_key - description: "The transfer's unique key" - - - name: cex_arbitrum_flows - meta: - blockchain: arbitrum - sector: cex - contributors: hildobby - config: - tags: ['cex','flows', 'arbitrum'] - description: "All CEX-tied flows identified on Arbitrum" - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - flow_type - - unique_key - columns: - - *blockchain - - *block_month - - *block_time - - *block_number - - *cex_name - - *distinct_name - - *token_address - - *token_symbol - - *token_standard - - *flow_type - - *amount - - *amount_raw - - *amount_usd - - *from - - *to - - *tx_from - - *tx_to - - *tx_index - - *tx_hash - - *evt_index - - *unique_key - - - name: cex_avalanche_c_flows - meta: - blockchain: avalanche_c - sector: cex - contributors: hildobby - config: - tags: ['cex','flows', 'avalanche_c'] - description: "All CEX-tied flows identified on Avalanche" - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - flow_type - - unique_key - columns: - - *blockchain - - *block_month - - *block_time - - *block_number - - *cex_name - - *distinct_name - - *token_address - - *token_symbol - - *token_standard - - *flow_type - - *amount - - *amount_raw - - *amount_usd - - *from - - *to - - *tx_from - - *tx_to - - *tx_index - - *tx_hash - - *evt_index - - *unique_key - - - name: cex_base_flows - meta: - blockchain: base - sector: cex - contributors: hildobby - config: - tags: ['cex','flows', 'base'] - description: "All CEX-tied flows identified on Base" - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - flow_type - - unique_key - columns: - - *blockchain - - *block_month - - *block_time - - *block_number - - *cex_name - - *distinct_name - - *token_address - - *token_symbol - - *token_standard - - *flow_type - - *amount - - *amount_raw - - *amount_usd - - *from - - *to - - *tx_from - - *tx_to - - *tx_index - - *tx_hash - - *evt_index - - *unique_key - - - name: cex_bnb_flows - meta: - blockchain: bnb - sector: cex - contributors: hildobby - config: - tags: ['cex','flows', 'bnb'] - description: "All CEX-tied flows identified on BNB" - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - flow_type - - unique_key - columns: - - *blockchain - - *block_month - - *block_time - - *block_number - - *cex_name - - *distinct_name - - *token_address - - *token_symbol - - *token_standard - - *flow_type - - *amount - - *amount_raw - - *amount_usd - - *from - - *to - - *tx_from - - *tx_to - - *tx_index - - *tx_hash - - *evt_index - - *unique_key - - - name: cex_celo_flows - meta: - blockchain: celo - sector: cex - contributors: hildobby - config: - tags: ['cex','flows', 'celo'] - description: "All CEX-tied flows identified on Celo" - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - flow_type - - unique_key - columns: - - *blockchain - - *block_month - - *block_time - - *block_number - - *cex_name - - *distinct_name - - *token_address - - *token_symbol - - *token_standard - - *flow_type - - *amount - - *amount_raw - - *amount_usd - - *from - - *to - - *tx_from - - *tx_to - - *tx_index - - *tx_hash - - *evt_index - - *unique_key - - - name: cex_gnosis_flows - meta: - blockchain: gnosis - sector: cex - contributors: hildobby - config: - tags: ['cex','flows', 'gnosis'] - description: "All CEX-tied flows identified on Gnosis" - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - flow_type - - unique_key - columns: - - *blockchain - - *block_month - - *block_time - - *block_number - - *cex_name - - *distinct_name - - *token_address - - *token_symbol - - *token_standard - - *flow_type - - *amount - - *amount_raw - - *amount_usd - - *from - - *to - - *tx_from - - *tx_to - - *tx_index - - *tx_hash - - *evt_index - - *unique_key - - - name: cex_optimism_flows - meta: - blockchain: optimism - sector: cex - contributors: hildobby - config: - tags: ['cex','flows', 'optimism'] - description: "All CEX-tied flows identified on Optimism Mainnet" - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - flow_type - - unique_key - columns: - - *blockchain - - *block_month - - *block_time - - *block_number - - *cex_name - - *distinct_name - - *token_address - - *token_symbol - - *token_standard - - *flow_type - - *amount - - *amount_raw - - *amount_usd - - *from - - *to - - *tx_from - - *tx_to - - *tx_index - - *tx_hash - - *evt_index - - *unique_key - - - name: cex_polygon_flows - meta: - blockchain: polygon - sector: cex - contributors: hildobby - config: - tags: ['cex','flows', 'polygon'] - description: "All CEX-tied flows identified on Polygon" - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - flow_type - - unique_key - columns: - - *blockchain - - *block_month - - *block_time - - *block_number - - *cex_name - - *distinct_name - - *token_address - - *token_symbol - - *token_standard - - *flow_type - - *amount - - *amount_raw - - *amount_usd - - *from - - *to - - *tx_from - - *tx_to - - *tx_index - - *tx_hash - - *evt_index - - *unique_key - - - name: cex_scroll_flows - meta: - blockchain: scroll - sector: cex - contributors: hildobby - config: - tags: ['cex','flows', 'scroll'] - description: "All CEX-tied flows identified on Scroll" - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - flow_type - - unique_key - columns: - - *blockchain - - *block_month - - *block_time - - *block_number - - *cex_name - - *distinct_name - - *token_address - - *token_symbol - - *token_standard - - *flow_type - - *amount - - *amount_raw - - *amount_usd - - *from - - *to - - *tx_from - - *tx_to - - *tx_index - - *tx_hash - - *evt_index - - *unique_key - - - name: cex_zksync_flows - meta: - blockchain: zksync - sector: cex - contributors: hildobby - config: - tags: ['cex','flows', 'zksync'] - description: "All CEX-tied flows identified on zkSync" - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - flow_type - - unique_key - columns: - - *blockchain - - *block_month - - *block_time - - *block_number - - *cex_name - - *distinct_name - - *token_address - - *token_symbol - - *token_standard - - *flow_type - - *amount - - *amount_raw - - *amount_usd - - *from - - *to - - *tx_from - - *tx_to - - *tx_index - - *tx_hash - - *evt_index - - *unique_key - - - name: cex_zora_flows - meta: - blockchain: zora - sector: cex - contributors: hildobby - config: - tags: ['cex','flows', 'zora'] - description: "All CEX-tied flows identified on ZORA Network" - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - flow_type - - unique_key - columns: - - *blockchain - - *block_month - - *block_time - - *block_number - - *cex_name - - *distinct_name - - *token_address - - *token_symbol - - *token_standard - - *flow_type - - *amount - - *amount_raw - - *amount_usd - - *from - - *to - - *tx_from - - *tx_to - - *tx_index - - *tx_hash - - *evt_index - - *unique_key \ No newline at end of file + description: "The transfer's unique key" \ No newline at end of file diff --git a/models/_sector/cex/flows/cex_flows.sql b/models/_sector/cex/flows/cex_flows.sql new file mode 100644 index 00000000000..ba34484e291 --- /dev/null +++ b/models/_sector/cex/flows/cex_flows.sql @@ -0,0 +1,64 @@ +{{ config( + + schema='cex', + alias = 'flows', + materialized = 'incremental', + file_format = 'delta', + incremental_strategy = 'merge', + unique_key = ['blockchain', 'flow_type', 'unique_key'], + incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.block_time')], + post_hook='{{ expose_spells(blockchains = \'["ethereum", "bnb", "avalanche_c", "gnosis", "optimism", "arbitrum", "polygon", "base", "celo", "zora", "zksync", "scroll"]\', + spell_type = "sector", + spell_name = "cex", + contributors = \'["hildobby"]\') }}' + ) +}} + +{% set cex_models = [ + (ref('cex_arbitrum_flows')) + , (ref('cex_avalanche_c_flows')) + , (ref('cex_bnb_flows')) + , (ref('cex_ethereum_flows')) + , (ref('cex_gnosis_flows')) + , (ref('cex_optimism_flows')) + , (ref('cex_polygon_flows')) + , (ref('cex_base_flows')) + , (ref('cex_celo_flows')) + , (ref('cex_zora_flows')) + , (ref('cex_zksync_flows')) + , (ref('cex_scroll_flows')) +] %} + +SELECT * +FROM ( + {% for cex_model in cex_models %} + SELECT blockchain + , block_month + , block_time + , block_number + , cex_name + , distinct_name + , token_address + , token_symbol + , token_standard + , flow_type + , amount + , amount_raw + , amount_usd + , from + , to + , tx_from + , tx_to + , tx_index + , tx_hash + , evt_index + , unique_key + FROM {{ cex_model }} + {% if is_incremental() %} + WHERE {{ incremental_predicate('block_time') }} + {% endif %} + {% if not loop.last %} + UNION ALL + {% endif %} + {% endfor %} + ) \ No newline at end of file diff --git a/models/_sector/cex/flows/chains/_schema.yml b/models/_sector/cex/flows/chains/_schema.yml new file mode 100644 index 00000000000..41084dd6f17 --- /dev/null +++ b/models/_sector/cex/flows/chains/_schema.yml @@ -0,0 +1,476 @@ +version: 2 + +models: + - name: cex_ethereum_flows + meta: + blockchain: ethereum + sector: cex + contributors: hildobby + config: + tags: ['cex','flows', 'ethereum'] + description: "All CEX-tied flows identified on Ethereum" + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - flow_type + - unique_key + columns: + - &blockchain + name: blockchain + description: "Blockchain" + - &block_month + name: block_month + description: "Block month" + - &block_time + name: block_time + description: "Block time" + - &block_number + name: block_number + description: "Block number" + - &cex_name + name: cex_name + description: "Name of centralised exchange" + - &distinct_name + name: distinct_name + description: "Distinct name of centralised exchange address" + - &token_address + name: token_address + description: "Token address" + - &token_symbol + name: token_symbol + description: "Token symbol" + - &token_standard + name: token_standard + description: "Token standard" + - &flow_type + name: flow_type + description: "Flow type" + - &amount + name: amount + description: "Amount" + - &amount_raw + name: amount_raw + description: "Raw amount" + - &amount_usd + name: amount_usd + description: "USD amount" + - &from + name: from + description: "from address" + - &to + name: to + description: "to address" + - &tx_from + name: tx_from + description: "Address that executed the transaction" + - &tx_to + name: tx_to + description: "Address that the transaction points towards" + - &tx_index + name: tx_index + description: "Transaction index" + - &tx_hash + name: tx_hash + description: "Transaction hash" + - &evt_index + name: evt_index + description: "Event index" + - &unique_key + name: unique_key + description: "The transfer's unique key" + + - name: cex_arbitrum_flows + meta: + blockchain: arbitrum + sector: cex + contributors: hildobby + config: + tags: ['cex','flows', 'arbitrum'] + description: "All CEX-tied flows identified on Arbitrum" + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - flow_type + - unique_key + columns: + - *blockchain + - *block_month + - *block_time + - *block_number + - *cex_name + - *distinct_name + - *token_address + - *token_symbol + - *token_standard + - *flow_type + - *amount + - *amount_raw + - *amount_usd + - *from + - *to + - *tx_from + - *tx_to + - *tx_index + - *tx_hash + - *evt_index + - *unique_key + + - name: cex_avalanche_c_flows + meta: + blockchain: avalanche_c + sector: cex + contributors: hildobby + config: + tags: ['cex','flows', 'avalanche_c'] + description: "All CEX-tied flows identified on Avalanche" + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - flow_type + - unique_key + columns: + - *blockchain + - *block_month + - *block_time + - *block_number + - *cex_name + - *distinct_name + - *token_address + - *token_symbol + - *token_standard + - *flow_type + - *amount + - *amount_raw + - *amount_usd + - *from + - *to + - *tx_from + - *tx_to + - *tx_index + - *tx_hash + - *evt_index + - *unique_key + + - name: cex_base_flows + meta: + blockchain: base + sector: cex + contributors: hildobby + config: + tags: ['cex','flows', 'base'] + description: "All CEX-tied flows identified on Base" + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - flow_type + - unique_key + columns: + - *blockchain + - *block_month + - *block_time + - *block_number + - *cex_name + - *distinct_name + - *token_address + - *token_symbol + - *token_standard + - *flow_type + - *amount + - *amount_raw + - *amount_usd + - *from + - *to + - *tx_from + - *tx_to + - *tx_index + - *tx_hash + - *evt_index + - *unique_key + + - name: cex_bnb_flows + meta: + blockchain: bnb + sector: cex + contributors: hildobby + config: + tags: ['cex','flows', 'bnb'] + description: "All CEX-tied flows identified on BNB" + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - flow_type + - unique_key + columns: + - *blockchain + - *block_month + - *block_time + - *block_number + - *cex_name + - *distinct_name + - *token_address + - *token_symbol + - *token_standard + - *flow_type + - *amount + - *amount_raw + - *amount_usd + - *from + - *to + - *tx_from + - *tx_to + - *tx_index + - *tx_hash + - *evt_index + - *unique_key + + - name: cex_celo_flows + meta: + blockchain: celo + sector: cex + contributors: hildobby + config: + tags: ['cex','flows', 'celo'] + description: "All CEX-tied flows identified on Celo" + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - flow_type + - unique_key + columns: + - *blockchain + - *block_month + - *block_time + - *block_number + - *cex_name + - *distinct_name + - *token_address + - *token_symbol + - *token_standard + - *flow_type + - *amount + - *amount_raw + - *amount_usd + - *from + - *to + - *tx_from + - *tx_to + - *tx_index + - *tx_hash + - *evt_index + - *unique_key + + - name: cex_gnosis_flows + meta: + blockchain: gnosis + sector: cex + contributors: hildobby + config: + tags: ['cex','flows', 'gnosis'] + description: "All CEX-tied flows identified on Gnosis" + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - flow_type + - unique_key + columns: + - *blockchain + - *block_month + - *block_time + - *block_number + - *cex_name + - *distinct_name + - *token_address + - *token_symbol + - *token_standard + - *flow_type + - *amount + - *amount_raw + - *amount_usd + - *from + - *to + - *tx_from + - *tx_to + - *tx_index + - *tx_hash + - *evt_index + - *unique_key + + - name: cex_optimism_flows + meta: + blockchain: optimism + sector: cex + contributors: hildobby + config: + tags: ['cex','flows', 'optimism'] + description: "All CEX-tied flows identified on Optimism Mainnet" + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - flow_type + - unique_key + columns: + - *blockchain + - *block_month + - *block_time + - *block_number + - *cex_name + - *distinct_name + - *token_address + - *token_symbol + - *token_standard + - *flow_type + - *amount + - *amount_raw + - *amount_usd + - *from + - *to + - *tx_from + - *tx_to + - *tx_index + - *tx_hash + - *evt_index + - *unique_key + + - name: cex_polygon_flows + meta: + blockchain: polygon + sector: cex + contributors: hildobby + config: + tags: ['cex','flows', 'polygon'] + description: "All CEX-tied flows identified on Polygon" + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - flow_type + - unique_key + columns: + - *blockchain + - *block_month + - *block_time + - *block_number + - *cex_name + - *distinct_name + - *token_address + - *token_symbol + - *token_standard + - *flow_type + - *amount + - *amount_raw + - *amount_usd + - *from + - *to + - *tx_from + - *tx_to + - *tx_index + - *tx_hash + - *evt_index + - *unique_key + + - name: cex_scroll_flows + meta: + blockchain: scroll + sector: cex + contributors: hildobby + config: + tags: ['cex','flows', 'scroll'] + description: "All CEX-tied flows identified on Scroll" + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - flow_type + - unique_key + columns: + - *blockchain + - *block_month + - *block_time + - *block_number + - *cex_name + - *distinct_name + - *token_address + - *token_symbol + - *token_standard + - *flow_type + - *amount + - *amount_raw + - *amount_usd + - *from + - *to + - *tx_from + - *tx_to + - *tx_index + - *tx_hash + - *evt_index + - *unique_key + + - name: cex_zksync_flows + meta: + blockchain: zksync + sector: cex + contributors: hildobby + config: + tags: ['cex','flows', 'zksync'] + description: "All CEX-tied flows identified on zkSync" + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - flow_type + - unique_key + columns: + - *blockchain + - *block_month + - *block_time + - *block_number + - *cex_name + - *distinct_name + - *token_address + - *token_symbol + - *token_standard + - *flow_type + - *amount + - *amount_raw + - *amount_usd + - *from + - *to + - *tx_from + - *tx_to + - *tx_index + - *tx_hash + - *evt_index + - *unique_key + + - name: cex_zora_flows + meta: + blockchain: zora + sector: cex + contributors: hildobby + config: + tags: ['cex','flows', 'zora'] + description: "All CEX-tied flows identified on ZORA Network" + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - flow_type + - unique_key + columns: + - *blockchain + - *block_month + - *block_time + - *block_number + - *cex_name + - *distinct_name + - *token_address + - *token_symbol + - *token_standard + - *flow_type + - *amount + - *amount_raw + - *amount_usd + - *from + - *to + - *tx_from + - *tx_to + - *tx_index + - *tx_hash + - *evt_index + - *unique_key \ No newline at end of file diff --git a/models/_sector/cex/flows/cex_arbitrum_flows.sql b/models/_sector/cex/flows/chains/cex_arbitrum_flows.sql similarity index 83% rename from models/_sector/cex/flows/cex_arbitrum_flows.sql rename to models/_sector/cex/flows/chains/cex_arbitrum_flows.sql index 0a0fd1456e5..b09c7161823 100644 --- a/models/_sector/cex/flows/cex_arbitrum_flows.sql +++ b/models/_sector/cex/flows/chains/cex_arbitrum_flows.sql @@ -7,6 +7,7 @@ materialized = 'incremental', file_format = 'delta', incremental_strategy = 'merge', + incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.block_time')], unique_key = ['flow_type', 'unique_key'] ) }} diff --git a/models/_sector/cex/flows/cex_avalanche_c_flows.sql b/models/_sector/cex/flows/chains/cex_avalanche_c_flows.sql similarity index 83% rename from models/_sector/cex/flows/cex_avalanche_c_flows.sql rename to models/_sector/cex/flows/chains/cex_avalanche_c_flows.sql index 39f07fad814..22a0b2444ac 100644 --- a/models/_sector/cex/flows/cex_avalanche_c_flows.sql +++ b/models/_sector/cex/flows/chains/cex_avalanche_c_flows.sql @@ -7,6 +7,7 @@ materialized = 'incremental', file_format = 'delta', incremental_strategy = 'merge', + incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.block_time')], unique_key = ['flow_type', 'unique_key'] ) }} diff --git a/models/_sector/cex/flows/cex_base_flows.sql b/models/_sector/cex/flows/chains/cex_base_flows.sql similarity index 83% rename from models/_sector/cex/flows/cex_base_flows.sql rename to models/_sector/cex/flows/chains/cex_base_flows.sql index 99edd8dfebb..9b3fbf3715f 100644 --- a/models/_sector/cex/flows/cex_base_flows.sql +++ b/models/_sector/cex/flows/chains/cex_base_flows.sql @@ -7,6 +7,7 @@ materialized = 'incremental', file_format = 'delta', incremental_strategy = 'merge', + incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.block_time')], unique_key = ['flow_type', 'unique_key'] ) }} diff --git a/models/_sector/cex/flows/cex_bnb_flows.sql b/models/_sector/cex/flows/chains/cex_bnb_flows.sql similarity index 83% rename from models/_sector/cex/flows/cex_bnb_flows.sql rename to models/_sector/cex/flows/chains/cex_bnb_flows.sql index 3db0d5af385..6c0835a32e5 100644 --- a/models/_sector/cex/flows/cex_bnb_flows.sql +++ b/models/_sector/cex/flows/chains/cex_bnb_flows.sql @@ -7,6 +7,7 @@ materialized = 'incremental', file_format = 'delta', incremental_strategy = 'merge', + incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.block_time')], unique_key = ['flow_type', 'unique_key'] ) }} diff --git a/models/_sector/cex/flows/cex_celo_flows.sql b/models/_sector/cex/flows/chains/cex_celo_flows.sql similarity index 83% rename from models/_sector/cex/flows/cex_celo_flows.sql rename to models/_sector/cex/flows/chains/cex_celo_flows.sql index eda4e23032c..25652b74a4b 100644 --- a/models/_sector/cex/flows/cex_celo_flows.sql +++ b/models/_sector/cex/flows/chains/cex_celo_flows.sql @@ -7,6 +7,7 @@ materialized = 'incremental', file_format = 'delta', incremental_strategy = 'merge', + incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.block_time')], unique_key = ['flow_type', 'unique_key'] ) }} diff --git a/models/_sector/cex/flows/cex_ethereum_flows.sql b/models/_sector/cex/flows/chains/cex_ethereum_flows.sql similarity index 83% rename from models/_sector/cex/flows/cex_ethereum_flows.sql rename to models/_sector/cex/flows/chains/cex_ethereum_flows.sql index c472a6c5400..6e350105bed 100644 --- a/models/_sector/cex/flows/cex_ethereum_flows.sql +++ b/models/_sector/cex/flows/chains/cex_ethereum_flows.sql @@ -7,6 +7,7 @@ materialized = 'incremental', file_format = 'delta', incremental_strategy = 'merge', + incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.block_time')], unique_key = ['flow_type', 'unique_key'] ) }} diff --git a/models/_sector/cex/flows/cex_gnosis_flows.sql b/models/_sector/cex/flows/chains/cex_gnosis_flows.sql similarity index 83% rename from models/_sector/cex/flows/cex_gnosis_flows.sql rename to models/_sector/cex/flows/chains/cex_gnosis_flows.sql index 9b282a8dd9f..b23a4d23f8d 100644 --- a/models/_sector/cex/flows/cex_gnosis_flows.sql +++ b/models/_sector/cex/flows/chains/cex_gnosis_flows.sql @@ -7,6 +7,7 @@ materialized = 'incremental', file_format = 'delta', incremental_strategy = 'merge', + incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.block_time')], unique_key = ['flow_type', 'unique_key'] ) }} diff --git a/models/_sector/cex/flows/cex_optimism_flows.sql b/models/_sector/cex/flows/chains/cex_optimism_flows.sql similarity index 83% rename from models/_sector/cex/flows/cex_optimism_flows.sql rename to models/_sector/cex/flows/chains/cex_optimism_flows.sql index b2fa305c38f..f6b3927f014 100644 --- a/models/_sector/cex/flows/cex_optimism_flows.sql +++ b/models/_sector/cex/flows/chains/cex_optimism_flows.sql @@ -7,6 +7,7 @@ materialized = 'incremental', file_format = 'delta', incremental_strategy = 'merge', + incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.block_time')], unique_key = ['flow_type', 'unique_key'] ) }} diff --git a/models/_sector/cex/flows/cex_polygon_flows.sql b/models/_sector/cex/flows/chains/cex_polygon_flows.sql similarity index 83% rename from models/_sector/cex/flows/cex_polygon_flows.sql rename to models/_sector/cex/flows/chains/cex_polygon_flows.sql index 74ffd9291fb..a15b4e96faa 100644 --- a/models/_sector/cex/flows/cex_polygon_flows.sql +++ b/models/_sector/cex/flows/chains/cex_polygon_flows.sql @@ -7,6 +7,7 @@ materialized = 'incremental', file_format = 'delta', incremental_strategy = 'merge', + incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.block_time')], unique_key = ['flow_type', 'unique_key'] ) }} diff --git a/models/_sector/cex/flows/cex_scroll_flows.sql b/models/_sector/cex/flows/chains/cex_scroll_flows.sql similarity index 83% rename from models/_sector/cex/flows/cex_scroll_flows.sql rename to models/_sector/cex/flows/chains/cex_scroll_flows.sql index 6839cfad5c7..236543d1031 100644 --- a/models/_sector/cex/flows/cex_scroll_flows.sql +++ b/models/_sector/cex/flows/chains/cex_scroll_flows.sql @@ -7,6 +7,7 @@ materialized = 'incremental', file_format = 'delta', incremental_strategy = 'merge', + incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.block_time')], unique_key = ['flow_type', 'unique_key'] ) }} diff --git a/models/_sector/cex/flows/cex_zksync_flows.sql b/models/_sector/cex/flows/chains/cex_zksync_flows.sql similarity index 83% rename from models/_sector/cex/flows/cex_zksync_flows.sql rename to models/_sector/cex/flows/chains/cex_zksync_flows.sql index 26f591a037e..a73331e5938 100644 --- a/models/_sector/cex/flows/cex_zksync_flows.sql +++ b/models/_sector/cex/flows/chains/cex_zksync_flows.sql @@ -7,6 +7,7 @@ materialized = 'incremental', file_format = 'delta', incremental_strategy = 'merge', + incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.block_time')], unique_key = ['flow_type', 'unique_key'] ) }} diff --git a/models/_sector/cex/flows/cex_zora_flows.sql b/models/_sector/cex/flows/chains/cex_zora_flows.sql similarity index 83% rename from models/_sector/cex/flows/cex_zora_flows.sql rename to models/_sector/cex/flows/chains/cex_zora_flows.sql index 31fa979e527..d1cae1594da 100644 --- a/models/_sector/cex/flows/cex_zora_flows.sql +++ b/models/_sector/cex/flows/chains/cex_zora_flows.sql @@ -7,6 +7,7 @@ materialized = 'incremental', file_format = 'delta', incremental_strategy = 'merge', + incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.block_time')], unique_key = ['flow_type', 'unique_key'] ) }} From 91c2189301f044973a286377155038e60cb3e3c5 Mon Sep 17 00:00:00 2001 From: jeff-dude <102681548+jeff-dude@users.noreply.github.com> Date: Wed, 5 Jun 2024 17:59:32 -0400 Subject: [PATCH 062/149] fix cex flows column (#6094) --- models/_sector/cex/flows/cex_flows.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/models/_sector/cex/flows/cex_flows.sql b/models/_sector/cex/flows/cex_flows.sql index ba34484e291..1fb5941011b 100644 --- a/models/_sector/cex/flows/cex_flows.sql +++ b/models/_sector/cex/flows/cex_flows.sql @@ -45,7 +45,7 @@ FROM ( , amount , amount_raw , amount_usd - , from + , "from" , to , tx_from , tx_to From 47e05ced8d1dafe8d1ab40464382aca43ce2a637 Mon Sep 17 00:00:00 2001 From: hildobby Date: Thu, 6 Jun 2024 02:23:18 +0200 Subject: [PATCH 063/149] Add chains to `cex_{chain}.flows` (#5990) * add chains to cex flows * make a crosschain table * fid * merge + add incremental_predicates --- models/_sector/cex/flows/_schema.yml | 2 +- models/_sector/cex/flows/cex_flows.sql | 5 +- models/_sector/cex/flows/chains/_schema.yml | 108 ++++++++++++++++++ .../cex/flows/chains/cex_fantom_flows.sql | 19 +++ .../cex/flows/chains/cex_linea_flows.sql | 19 +++ .../cex/flows/chains/cex_zkevm_flows.sql | 19 +++ 6 files changed, 170 insertions(+), 2 deletions(-) create mode 100644 models/_sector/cex/flows/chains/cex_fantom_flows.sql create mode 100644 models/_sector/cex/flows/chains/cex_linea_flows.sql create mode 100644 models/_sector/cex/flows/chains/cex_zkevm_flows.sql diff --git a/models/_sector/cex/flows/_schema.yml b/models/_sector/cex/flows/_schema.yml index 0e6a29425b6..043e015f519 100644 --- a/models/_sector/cex/flows/_schema.yml +++ b/models/_sector/cex/flows/_schema.yml @@ -3,7 +3,7 @@ version: 2 models: - name: cex_flows meta: - blockchain: ethereum, arbitrum, avalanche_c, base, bnb, celo, gnosis, gnosis, optimism, polygon, scroll, zksync, zora + blockchain: arbitrum, avalanche_c, base, bnb, celo, ethereum, fantom, gnosis, linea, optimism, polygon, scroll, zkevm, zksync, zora sector: cex contributors: hildobby config: diff --git a/models/_sector/cex/flows/cex_flows.sql b/models/_sector/cex/flows/cex_flows.sql index 1fb5941011b..ec4320d43c0 100644 --- a/models/_sector/cex/flows/cex_flows.sql +++ b/models/_sector/cex/flows/cex_flows.sql @@ -7,7 +7,7 @@ incremental_strategy = 'merge', unique_key = ['blockchain', 'flow_type', 'unique_key'], incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.block_time')], - post_hook='{{ expose_spells(blockchains = \'["ethereum", "bnb", "avalanche_c", "gnosis", "optimism", "arbitrum", "polygon", "base", "celo", "zora", "zksync", "scroll"]\', + post_hook='{{ expose_spells(blockchains = \'["ethereum", "bnb", "avalanche_c", "gnosis", "optimism", "arbitrum", "polygon", "base", "celo", "zora", "zksync", "scroll", "fantom", "linea", "zkevm"]\', spell_type = "sector", spell_name = "cex", contributors = \'["hildobby"]\') }}' @@ -19,6 +19,7 @@ , (ref('cex_avalanche_c_flows')) , (ref('cex_bnb_flows')) , (ref('cex_ethereum_flows')) + , (ref('cex_fantom_flows')) , (ref('cex_gnosis_flows')) , (ref('cex_optimism_flows')) , (ref('cex_polygon_flows')) @@ -27,6 +28,8 @@ , (ref('cex_zora_flows')) , (ref('cex_zksync_flows')) , (ref('cex_scroll_flows')) + , (ref('cex_linea_flows')) + , (ref('cex_zkevm_flows')) ] %} SELECT * diff --git a/models/_sector/cex/flows/chains/_schema.yml b/models/_sector/cex/flows/chains/_schema.yml index 41084dd6f17..072dee29671 100644 --- a/models/_sector/cex/flows/chains/_schema.yml +++ b/models/_sector/cex/flows/chains/_schema.yml @@ -447,6 +447,114 @@ models: config: tags: ['cex','flows', 'zora'] description: "All CEX-tied flows identified on ZORA Network" + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - flow_type + - unique_key + columns: + - *blockchain + - *block_month + - *block_time + - *block_number + - *cex_name + - *distinct_name + - *token_address + - *token_symbol + - *token_standard + - *flow_type + - *amount + - *amount_raw + - *amount_usd + - *from + - *to + - *tx_from + - *tx_to + - *tx_index + - *tx_hash + - *evt_index + - *unique_key + + - name: cex_fantom_flows + meta: + blockchain: fantom + sector: cex + contributors: hildobby + config: + tags: ['cex','flows', 'fantom'] + description: "All CEX-tied flows identified on ZORA Network" + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - flow_type + - unique_key + columns: + - *blockchain + - *block_month + - *block_time + - *block_number + - *cex_name + - *distinct_name + - *token_address + - *token_symbol + - *token_standard + - *flow_type + - *amount + - *amount_raw + - *amount_usd + - *from + - *to + - *tx_from + - *tx_to + - *tx_index + - *tx_hash + - *evt_index + - *unique_key + + - name: cex_linea_flows + meta: + blockchain: linea + sector: cex + contributors: hildobby + config: + tags: ['cex','flows', 'linea'] + description: "All CEX-tied flows identified on ZORA Network" + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - flow_type + - unique_key + columns: + - *blockchain + - *block_month + - *block_time + - *block_number + - *cex_name + - *distinct_name + - *token_address + - *token_symbol + - *token_standard + - *flow_type + - *amount + - *amount_raw + - *amount_usd + - *from + - *to + - *tx_from + - *tx_to + - *tx_index + - *tx_hash + - *evt_index + - *unique_key + + - name: cex_zkevm_flows + meta: + blockchain: zkevm + sector: cex + contributors: hildobby + config: + tags: ['cex','flows', 'zkevm'] + description: "All CEX-tied flows identified on ZORA Network" tests: - dbt_utils.unique_combination_of_columns: combination_of_columns: diff --git a/models/_sector/cex/flows/chains/cex_fantom_flows.sql b/models/_sector/cex/flows/chains/cex_fantom_flows.sql new file mode 100644 index 00000000000..24633279b16 --- /dev/null +++ b/models/_sector/cex/flows/chains/cex_fantom_flows.sql @@ -0,0 +1,19 @@ +{% set blockchain = 'fantom' %} + +{{ config( + + schema = 'cex_' + blockchain, + alias = 'flows', + materialized = 'incremental', + file_format = 'delta', + incremental_strategy = 'merge', + incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.block_time')], + unique_key = ['flow_type', 'unique_key'] +) +}} + +{{cex_flows( + blockchain = blockchain + , transfers = ref('tokens_' + blockchain + '_transfers') + , addresses = ref('cex_' + blockchain + '_addresses') +)}} \ No newline at end of file diff --git a/models/_sector/cex/flows/chains/cex_linea_flows.sql b/models/_sector/cex/flows/chains/cex_linea_flows.sql new file mode 100644 index 00000000000..322e0221061 --- /dev/null +++ b/models/_sector/cex/flows/chains/cex_linea_flows.sql @@ -0,0 +1,19 @@ +{% set blockchain = 'linea' %} + +{{ config( + + schema = 'cex_' + blockchain, + alias = 'flows', + materialized = 'incremental', + file_format = 'delta', + incremental_strategy = 'merge', + incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.block_time')], + unique_key = ['flow_type', 'unique_key'] +) +}} + +{{cex_flows( + blockchain = blockchain + , transfers = ref('tokens_' + blockchain + '_transfers') + , addresses = ref('cex_' + blockchain + '_addresses') +)}} \ No newline at end of file diff --git a/models/_sector/cex/flows/chains/cex_zkevm_flows.sql b/models/_sector/cex/flows/chains/cex_zkevm_flows.sql new file mode 100644 index 00000000000..9e4466e1c6c --- /dev/null +++ b/models/_sector/cex/flows/chains/cex_zkevm_flows.sql @@ -0,0 +1,19 @@ +{% set blockchain = 'zkevm' %} + +{{ config( + + schema = 'cex_' + blockchain, + alias = 'flows', + materialized = 'incremental', + file_format = 'delta', + incremental_strategy = 'merge', + incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.block_time')], + unique_key = ['flow_type', 'unique_key'] +) +}} + +{{cex_flows( + blockchain = blockchain + , transfers = ref('tokens_' + blockchain + '_transfers') + , addresses = ref('cex_' + blockchain + '_addresses') +)}} \ No newline at end of file From 3ef2b140c0bff98980d7ca0174e1ded1ad14595e Mon Sep 17 00:00:00 2001 From: Alan Ghobadi Date: Thu, 6 Jun 2024 12:02:46 +0200 Subject: [PATCH 064/149] Add filter on prices for cow protocol batches (#6084) --- models/cow_protocol/ethereum/cow_protocol_ethereum_batches.sql | 3 +++ models/cow_protocol/gnosis/cow_protocol_gnosis_batches.sql | 3 +++ 2 files changed, 6 insertions(+) diff --git a/models/cow_protocol/ethereum/cow_protocol_ethereum_batches.sql b/models/cow_protocol/ethereum/cow_protocol_ethereum_batches.sql index f10cd5e28b0..9318c5d61fa 100644 --- a/models/cow_protocol/ethereum/cow_protocol_ethereum_batches.sql +++ b/models/cow_protocol/ethereum/cow_protocol_ethereum_batches.sql @@ -57,6 +57,9 @@ batch_values as ( from {{ ref('cow_protocol_ethereum_trades') }} left outer join {{ source('prices', 'usd') }} as p on p.contract_address = 0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2 + {% if is_incremental() %} + and {{ incremental_predicate('minute') }} + {% endif %} and p.minute = date_trunc('minute', block_time) and blockchain = 'ethereum' {% if is_incremental() %} diff --git a/models/cow_protocol/gnosis/cow_protocol_gnosis_batches.sql b/models/cow_protocol/gnosis/cow_protocol_gnosis_batches.sql index a1035548408..6aaad8388cc 100644 --- a/models/cow_protocol/gnosis/cow_protocol_gnosis_batches.sql +++ b/models/cow_protocol/gnosis/cow_protocol_gnosis_batches.sql @@ -56,6 +56,9 @@ batch_values as ( from {{ ref('cow_protocol_gnosis_trades') }} left outer join {{ source('prices', 'usd') }} as p on p.contract_address = 0xe91d153e0b41518a2ce8dd3d7944fa863463a97d + {% if is_incremental() %} + and {{ incremental_predicate('minute') }} + {% endif %} and p.minute = date_trunc('minute', block_time) and blockchain = 'gnosis' {% if is_incremental() %} From f0ce7ee637aefda75b067f639a415d303e77b2ac Mon Sep 17 00:00:00 2001 From: Andrew <47720952+andrewhong5297@users.noreply.github.com> Date: Thu, 6 Jun 2024 05:28:30 -0700 Subject: [PATCH 065/149] add token2022 into token transfers and fungible spells (#6050) * sol * add transfers * message * fix names * fix partition * no rest for the cluster * limit CI test history * ? * fix latest * boop * fix * 90 day * booop * fix * org * update * fix ambig * change * fee fixes * fix source * pain * gee gee * fix * add token version * add fee in * don't trust the decoded outputs * use uint instead * l * remove ci limit * add incremental to fungible * Use incremental predicate * move incremental filter up * fix * Revert "fix" This reverts commit 18389bc080585cf0bd1697ee49ba8c266e4b0750. --------- Co-authored-by: Alan Ghobadi --- .../tokens/solana/tokens_solana.sources.yml | 23 ++ .../tokens/solana/tokens_solana_fungible.sql | 158 ++++++++-- models/tokens/solana/tokens_solana_schema.yml | 11 +- .../tokens/solana/tokens_solana_transfers.sql | 279 ++++++++++++++++-- 4 files changed, 415 insertions(+), 56 deletions(-) diff --git a/models/tokens/solana/tokens_solana.sources.yml b/models/tokens/solana/tokens_solana.sources.yml index 0636d8254fe..5a17103eee3 100644 --- a/models/tokens/solana/tokens_solana.sources.yml +++ b/models/tokens/solana/tokens_solana.sources.yml @@ -24,6 +24,29 @@ sources: - name: spl_token_call_burnChecked loaded_at_field: call_block_time + - name: spl_token_2022_solana + description: "spl_token 2022 decoded tables" + freshness: # default freshness + warn_after: { count: 12, period: hour } + error_after: { count: 24, period: hour } + tables: + - name: spl_token_2022_call_initializeMint + loaded_at_field: call_block_time + - name: spl_token_2022_call_initializeMint2 + loaded_at_field: call_block_time + - name: spl_token_2022_call_transferFeeExtension + loaded_at_field: call_block_time + - name: spl_token_2022_call_transferChecked + loaded_at_field: call_block_time + - name: spl_token_2022_call_mintTo + loaded_at_field: call_block_time + - name: spl_token_2022_call_mintToChecked + loaded_at_field: call_block_time + - name: spl_token_2022_call_burn + loaded_at_field: call_block_time + - name: spl_token_2022_call_burnChecked + loaded_at_field: call_block_time + - name: mpl_token_metadata_solana description: "mpl metadata decoded tables" freshness: # default freshness diff --git a/models/tokens/solana/tokens_solana_fungible.sql b/models/tokens/solana/tokens_solana_fungible.sql index 5f26d007d6c..6a66471188c 100644 --- a/models/tokens/solana/tokens_solana_fungible.sql +++ b/models/tokens/solana/tokens_solana_fungible.sql @@ -1,7 +1,7 @@ {{ config ( alias = 'fungible', - + post_hook='{{ expose_spells(\'["solana"]\', "sector", "tokens", @@ -10,26 +10,32 @@ }} -with +with tokens as ( SELECT bytearray_to_bigint(bytearray_reverse(bytearray_substring(call_data, 2, 1))) as decimals , call_data , account_mint + , token_version , call_tx_id , call_block_time + , row_number() over (partition by account_mint order by call_block_time desc) as latest FROM ( - SELECT call_data, account_mint, call_tx_id, call_block_time FROM {{ source('spl_token_solana', 'spl_token_call_initializeMint') }} - UNION ALL - SELECT call_data, account_mint, call_tx_id, call_block_time FROM {{ source('spl_token_solana', 'spl_token_call_initializeMint2') }} + SELECT call_data, account_mint, call_tx_id, call_block_time, 'spl_token' as token_version FROM {{ source('spl_token_solana', 'spl_token_call_initializeMint') }} + UNION ALL + SELECT call_data, account_mint, call_tx_id, call_block_time, 'spl_token' as token_version FROM {{ source('spl_token_solana', 'spl_token_call_initializeMint2') }} + UNION ALL + SELECT call_data, account_mint, call_tx_id, call_block_time, 'token2022' as token_version FROM {{ source('spl_token_2022_solana', 'spl_token_2022_call_initializeMint') }} + UNION ALL + SELECT call_data, account_mint, call_tx_id, call_block_time, 'token2022' as token_version FROM {{ source('spl_token_2022_solana', 'spl_token_2022_call_initializeMint2') }} ) {% if is_incremental() %} - where call_block_time >= date_trunc('day', now() - interval '7' day) + where {{ incremental_predicate('call_block_time') }} {% endif %} ) - + , metadata as ( - SELECT + SELECT meta.call_tx_id , meta.call_block_slot , meta.call_block_time @@ -38,8 +44,10 @@ with , meta.account_mint , meta.call_block_time , master.account_edition as master_edition + , metadata_program + , row_number() over (partition by meta.account_mint order by meta.call_block_time desc) as latest FROM ( - SELECT + SELECT call_tx_id , call_outer_instruction_index , call_inner_instruction_index @@ -48,9 +56,10 @@ with , json_query(createMetadataAccountArgs, 'lax $.CreateMetadataAccountArgs.data.Data') as args , account_metadata , account_mint + , call_executing_account as metadata_program FROM {{ source('mpl_token_metadata_solana', 'mpl_token_metadata_call_CreateMetadataAccount') }} - UNION ALL - SELECT + UNION ALL + SELECT call_tx_id , call_outer_instruction_index , call_inner_instruction_index @@ -59,51 +68,143 @@ with , json_query(createMetadataAccountArgsV2, 'lax $.CreateMetadataAccountArgsV2.data.DataV2') as args , account_metadata , account_mint + , call_executing_account as metadata_program FROM {{ source('mpl_token_metadata_solana', 'mpl_token_metadata_call_CreateMetadataAccountV2') }} - UNION ALL - SELECT + UNION ALL + SELECT call_tx_id , call_outer_instruction_index - , call_inner_instruction_index + , call_inner_instruction_index , call_block_slot , call_block_time , json_query(createMetadataAccountArgsV3, 'lax $.CreateMetadataAccountArgsV3.data.DataV2') as args , account_metadata , account_mint - FROM {{ source('mpl_token_metadata_solana', 'mpl_token_metadata_call_CreateMetadataAccountV3') }} - ) meta + , call_executing_account as metadata_program + FROM {{ source('mpl_token_metadata_solana', 'mpl_token_metadata_call_CreateMetadataAccountV3') }} + ) meta LEFT JOIN ( - SELECT account_mintAuthority, account_edition, account_metadata FROM {{ source('mpl_token_metadata_solana', 'mpl_token_metadata_call_CreateMasterEdition') }} + SELECT account_mintAuthority, account_edition, account_metadata FROM {{ source('mpl_token_metadata_solana', 'mpl_token_metadata_call_CreateMasterEdition') }} UNION ALL SELECT account_mintAuthority, account_edition, account_metadata FROM {{ source('mpl_token_metadata_solana', 'mpl_token_metadata_call_CreateMasterEditionV3') }} ) master ON master.account_metadata = meta.account_metadata {% if is_incremental() %} - WHERE meta.call_block_time >= date_trunc('day', now() - interval '7' day) + WHERE {{ incremental_predicate('meta.call_block_time') }} + {% endif %} + ) + + , token2022_metadata as ( + --token2022 direct metadata extension + SELECT + from_utf8(bytearray_substring(data,1+8+4,bytearray_to_bigint(bytearray_reverse(bytearray_substring(data,1+8,4))))) as name + , from_utf8(bytearray_substring(data,1+8+4+bytearray_to_bigint(bytearray_reverse(bytearray_substring(data,1+8,4))) + 4 --start from end of name and end of length of symbol + , bytearray_to_bigint(bytearray_reverse(bytearray_substring(data,1+8+4+bytearray_to_bigint(bytearray_reverse(bytearray_substring(data,1+8,4))),4))) --get length of symbol from end of name + )) as symbol + , from_utf8(bytearray_substring(data,1+8+4+bytearray_to_bigint(bytearray_reverse(bytearray_substring(data,1+8,4))) + 4 --end of name and end of length of symbol + + bytearray_to_bigint(bytearray_reverse(bytearray_substring(data,1+8+4+bytearray_to_bigint(bytearray_reverse(bytearray_substring(data,1+8,4))),4))) + 4 --start from end of symbol and end of length of uri + , bytearray_to_bigint(bytearray_reverse(bytearray_substring(data,1+8+4+bytearray_to_bigint(bytearray_reverse(bytearray_substring(data,1+8,4))) + 4 + + bytearray_to_bigint(bytearray_reverse(bytearray_substring(data,1+8+4+bytearray_to_bigint(bytearray_reverse(bytearray_substring(data,1+8,4))),4))),4))) --get length of uri from end of symbol + )) as uri + , tx_id as metadata_tx + , account_arguments[3] as account_mint + , block_time + , executing_account as metadata_program + , row_number() over (partition by account_arguments[3] order by block_time desc) as latest + FROM {{ source('solana','instruction_calls') }} + WHERE executing_account = 'TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb' + AND bytearray_substring(data,1,1) = 0xd2 --deal with updateField later 0xdd + AND tx_success + {% if is_incremental() %} + AND {{ incremental_predicate('block_time') }} + {% endif %} + ) + + , token_metadata_other as ( + --some other metadata program (idk the owner) + SELECT + from_utf8(bytearray_substring(data,1+1+4,bytearray_to_bigint(bytearray_reverse(bytearray_substring(data,1+1,4))))) as name + , from_utf8(bytearray_substring(data,1+1+4+bytearray_to_bigint(bytearray_reverse(bytearray_substring(data,1+1,4))) + 4 --start from end of name and end of length of symbol + , bytearray_to_bigint(bytearray_reverse(bytearray_substring(data,1+1+4+bytearray_to_bigint(bytearray_reverse(bytearray_substring(data,1+1,4))),4))) --get length of symbol from end of name + )) as symbol + , from_utf8(bytearray_substring(data,1+1+4+bytearray_to_bigint(bytearray_reverse(bytearray_substring(data,1+1,4))) + 4 --end of name and end of length of symbol + + bytearray_to_bigint(bytearray_reverse(bytearray_substring(data,1+1+4+bytearray_to_bigint(bytearray_reverse(bytearray_substring(data,1+1,4))),4))) + 4 --start from end of symbol and end of length of uri + , bytearray_to_bigint(bytearray_reverse(bytearray_substring(data,1+1+4+bytearray_to_bigint(bytearray_reverse(bytearray_substring(data,1+1,4))) + 4 + + bytearray_to_bigint(bytearray_reverse(bytearray_substring(data,1+1+4+bytearray_to_bigint(bytearray_reverse(bytearray_substring(data,1+1,4))),4))),4))) --get length of uri from end of symbol + )) as uri + , tx_id as metadata_tx + , account_arguments[2] as account_mint + , block_time + , executing_account as metadata_program + , row_number() over (partition by account_arguments[2] order by block_time desc) as latest + FROM {{ source('solana','instruction_calls') }} + WHERE executing_account = 'META4s4fSmpkTbZoUsgC1oBnWB31vQcmnN8giPw51Zu' + AND bytearray_substring(data,1,1) = 0x21 + AND tx_success + {% if is_incremental() %} + AND {{ incremental_predicate('block_time') }} {% endif %} ) SELECT tk.account_mint as token_mint_address , tk.decimals - , trim(json_value(args, 'strict $.name'))as name - , trim(json_value(args, 'strict $.symbol')) as symbol - , trim(json_value(args, 'strict $.uri')) as token_uri + , coalesce(m22.name,mo.name,trim(json_value(args, 'strict $.name'))) as name + , coalesce(m22.symbol,mo.symbol,trim(json_value(args, 'strict $.symbol'))) as symbol + , coalesce(m22.uri,mo.uri,trim(json_value(args, 'strict $.uri'))) as token_uri , tk.call_block_time as created_at + , coalesce(m22.metadata_program,mo.metadata_program,m.metadata_program) as metadata_program + , tk.token_version + , tk.call_tx_id as init_tx FROM tokens tk -LEFT JOIN metadata m ON tk.account_mint = m.account_mint +LEFT JOIN token2022_metadata m22 ON tk.account_mint = m22.account_mint AND m22.latest = 1 +LEFT JOIN token_metadata_other mo ON tk.account_mint = mo.account_mint AND mo.latest = 1 +LEFT JOIN metadata m ON tk.account_mint = m.account_mint AND m.latest = 1 WHERE m.master_edition is null +AND tk.latest = 1 + +UNION ALL + +--token2022 wrapped sol https://solscan.io/tx/2L1o7sDMCMJ6PYqfNrnY6ozJC1DEx61pRYiLdfCCggxw81naQXsmHKDLn6EhJXmDmDSQ2eCKjUMjZAQuUsyNnYUv +SELECT + trim(token_mint_address) as token_mint_address + , decimals + , trim(name) as name + , trim(symbol) as symbol + , token_uri + , cast(created_at as timestamp) created_at + , metadata_program + , token_version + , init_tx +FROM +( + VALUES +( + '9pan9bMn5HatX4EJdBwg9VgCa7Uz5HL8N1m5D3NdXejP', + 9, + 'wrapped SOL', + 'SOL', + null, + '2023-08-02 00:00:00', + null, + 'token2022', + '2L1o7sDMCMJ6PYqfNrnY6ozJC1DEx61pRYiLdfCCggxw81naQXsmHKDLn6EhJXmDmDSQ2eCKjUMjZAQuUsyNnYUv' +) +) AS temp_table (token_mint_address, decimals, name, symbol, token_uri, created_at, metadata_program, token_version, init_tx) UNION ALL ---wrapped sol is special and doesn't have a init tx (that I can find) -SELECT +--old wrapped sol is special and doesn't have a init tx (that I can find) +SELECT trim(token_mint_address) as token_mint_address , decimals , trim(name) as name , trim(symbol) as symbol , token_uri , cast(created_at as timestamp) created_at -FROM + , metadata_program + , token_version + , init_tx +FROM ( VALUES ( @@ -112,6 +213,9 @@ FROM 'wrapped SOL', 'SOL', null, - '2021-01-31 00:00:00' + '2021-01-31 00:00:00', + null, + 'spl_token', + null ) -) AS temp_table (token_mint_address, decimals, name, symbol, token_uri, created_at) +) AS temp_table (token_mint_address, decimals, name, symbol, token_uri, created_at, metadata_program, token_version, init_tx) diff --git a/models/tokens/solana/tokens_solana_schema.yml b/models/tokens/solana/tokens_solana_schema.yml index ab3b17f52e5..29ac7ed40e8 100644 --- a/models/tokens/solana/tokens_solana_schema.yml +++ b/models/tokens/solana/tokens_solana_schema.yml @@ -19,8 +19,14 @@ models: description: "token symbol" - name: decimals description: "Number of decimals, refers to how divisible a token can be" + - name: metadata_program + description: program used for creating token metadata + - name: token_version + description: version of the token program used (spl_token, token2022) - name: created_at description: token mint created at + - name: init_tx + description: "transaction that initialized the mint" - name: tokens_solana_nft meta: @@ -72,7 +78,7 @@ models: config: tags: ['solana','transfers','erc20','nft','spl'] description: > - get all spl token transfers (will add in token2022 later) + get all spl token transfers columns: - name: block_time - name: block_date @@ -80,10 +86,13 @@ models: - name: action - name: token_mint_address - name: amount + - name: fee + - name: token_version - name: from_owner - name: to_owner - name: from_token_account - name: to_token_account + - name: token_version - name: tx_signer - name: tx_id - name: outer_instruction_index diff --git a/models/tokens/solana/tokens_solana_transfers.sql b/models/tokens/solana/tokens_solana_transfers.sql index a28903cf3d4..2bb1e5600d6 100644 --- a/models/tokens/solana/tokens_solana_transfers.sql +++ b/models/tokens/solana/tokens_solana_transfers.sql @@ -14,56 +14,279 @@ \'["ilemi"]\') }}') }} -SELECT - call_block_time as block_time - , cast (date_trunc('day', call_block_time) as date) as block_date - , call_block_slot as block_slot - , action - , amount - , COALESCE(tk_s.token_mint_address, tk_d.token_mint_address) as token_mint_address - , tk_s.token_balance_owner as from_owner - , tk_d.token_balance_owner as to_owner - , account_source as from_token_account - , account_destination as to_token_account - , call_tx_signer as tx_signer - , call_tx_id as tx_id - , call_outer_instruction_index as outer_instruction_index - , COALESCE(call_inner_instruction_index,0) as inner_instruction_index - , call_outer_executing_account as outer_executing_account -FROM ( - SELECT account_source, account_destination, amount, call_tx_id, call_block_time, call_block_slot, call_outer_executing_account, call_tx_signer, 'transfer' as action, call_outer_instruction_index, call_inner_instruction_index +with +token2022_fee_state as ( + --we need the fee basis points and maximum fee for token2022 transfers because the fee amount is not emitted in transferChecked + SELECT + call_account_arguments[1] as account_mint + , try(bytearray_to_uint256(bytearray_reverse(bytearray_substring(call_data, + 1+1+1+1+1+case when bytearray_substring(call_data,1+1+1,1) = 0x01 and bytearray_substring(call_data,1+1+1+32+1,1) = 0x01 + then 64 + when bytearray_substring(call_data,1+1+1,1) = 0x01 and bytearray_substring(call_data,1+1+1+32+1,1) = 0x00 + then 32 + when bytearray_substring(call_data,1+1+1,1) = 0x00 and bytearray_substring(call_data,1+1+1+1,1) = 0x01 + then 32 + when bytearray_substring(call_data,1+1+1,1) = 0x00 and bytearray_substring(call_data,1+1+1+1,1) = 0x00 + then 0 + end --variations of COPTION enums for first two arguments + ,2)))) as fee_basis + , try(bytearray_to_uint256(bytearray_reverse(bytearray_substring(call_data, + 1+1+1+1+1+case when bytearray_substring(call_data,1+1+1,1) = 0x01 and bytearray_substring(call_data,1+1+1+32+1,1) = 0x01 + then 64 + when bytearray_substring(call_data,1+1+1,1) = 0x01 and bytearray_substring(call_data,1+1+1+32+1,1) = 0x00 + then 32 + when bytearray_substring(call_data,1+1+1,1) = 0x00 and bytearray_substring(call_data,1+1+1+1,1) = 0x01 + then 32 + when bytearray_substring(call_data,1+1+1,1) = 0x00 and bytearray_substring(call_data,1+1+1+1,1) = 0x00 + then 0 + end + +2 + ,16)))) as fee_maximum + , call_block_time as fee_time + FROM {{ source('spl_token_2022_solana','spl_token_2022_call_transferFeeExtension') }} + WHERE bytearray_substring(call_data,1+1,1) = 0x00 --https://github.com/solana-labs/solana-program-library/blob/8f50c6fabc6ec87ada229e923030381f573e0aed/token/program-2022/src/extension/transfer_fee/instruction.rs#L38 + UNION ALL + SELECT + call_account_arguments[1] as account_mint + , try(bytearray_to_uint256(bytearray_reverse(bytearray_substring(call_data, + 1+1+1,2)))) as fee_basis + , try(bytearray_to_uint256(bytearray_reverse(bytearray_substring(call_data, + 1+1+1+2,16)))) as fee_maximum + , call_block_time as fee_time + FROM {{ source('spl_token_2022_solana','spl_token_2022_call_transferFeeExtension') }} + WHERE bytearray_substring(call_data,1+1,1) = 0x05 --https://github.com/solana-labs/solana-program-library/blob/8f50c6fabc6ec87ada229e923030381f573e0aed/token/program-2022/src/extension/transfer_fee/instruction.rs#L147 +) + +, base as ( + SELECT + account_source, account_destination + , bytearray_to_uint256(bytearray_reverse(bytearray_substring(call_data,1+1,8))) as amount + , call_tx_id, call_block_time, call_block_slot, call_outer_executing_account, call_tx_signer + , 'transfer' as action + , call_outer_instruction_index, call_inner_instruction_index + , null as fee + , 'spl_token' as token_version FROM {{ source('spl_token_solana','spl_token_call_transfer') }} + WHERE 1=1 + {% if is_incremental() %} + AND {{incremental_predicate('call_block_time')}} + {% endif %} UNION ALL - SELECT account_source, account_destination, amount, call_tx_id, call_block_time, call_block_slot, call_outer_executing_account, call_tx_signer, 'transfer' as action, call_outer_instruction_index, call_inner_instruction_index + SELECT + account_source, account_destination + , bytearray_to_uint256(bytearray_reverse(bytearray_substring(call_data,1+1,8))) as amount + , call_tx_id, call_block_time, call_block_slot, call_outer_executing_account, call_tx_signer + , 'transfer' as action + , call_outer_instruction_index, call_inner_instruction_index + , null as fee + , 'spl_token' as token_version FROM {{ source('spl_token_solana','spl_token_call_transferChecked') }} + WHERE 1=1 + {% if is_incremental() %} + AND {{incremental_predicate('call_block_time')}} + {% endif %} UNION ALL - SELECT null, account_account as account_destination, amount, call_tx_id, call_block_time, call_block_slot, call_outer_executing_account, call_tx_signer, 'mint' as action, call_outer_instruction_index, call_inner_instruction_index + SELECT + null as account_source, account_account as account_destination + , bytearray_to_uint256(bytearray_reverse(bytearray_substring(call_data,1+1,8))) as amount + , call_tx_id, call_block_time, call_block_slot, call_outer_executing_account, call_tx_signer + , 'mint' as action + , call_outer_instruction_index, call_inner_instruction_index + , null as fee + , 'spl_token' as token_version FROM {{ source('spl_token_solana','spl_token_call_mintTo') }} + WHERE 1=1 + {% if is_incremental() %} + AND {{incremental_predicate('call_block_time')}} + {% endif %} UNION ALL - SELECT null, account_account as account_destination, amount, call_tx_id, call_block_time, call_block_slot, call_outer_executing_account, call_tx_signer, 'mint' as action, call_outer_instruction_index, call_inner_instruction_index + SELECT + null as account_source, account_account as account_destination + , bytearray_to_uint256(bytearray_reverse(bytearray_substring(call_data,1+1,8))) as amount + , call_tx_id, call_block_time, call_block_slot, call_outer_executing_account, call_tx_signer + , 'mint' as action + , call_outer_instruction_index, call_inner_instruction_index + , null as fee + , 'spl_token' as token_version FROM {{ source('spl_token_solana','spl_token_call_mintToChecked') }} + WHERE 1=1 + {% if is_incremental() %} + AND {{incremental_predicate('call_block_time')}} + {% endif %} UNION ALL - SELECT account_account as account_source, null, amount, call_tx_id, call_block_time, call_block_slot, call_outer_executing_account, call_tx_signer, 'burn' as action, call_outer_instruction_index, call_inner_instruction_index + SELECT + account_account as account_source, null as account_destination + , bytearray_to_uint256(bytearray_reverse(bytearray_substring(call_data,1+1,8))) as amount + , call_tx_id, call_block_time, call_block_slot, call_outer_executing_account, call_tx_signer + , 'burn' as action + , call_outer_instruction_index, call_inner_instruction_index + , null as fee + , 'spl_token' as token_version FROM {{ source('spl_token_solana','spl_token_call_burn') }} + WHERE 1=1 + {% if is_incremental() %} + AND {{incremental_predicate('call_block_time')}} + {% endif %} UNION ALL - SELECT account_account as account_source, null, amount, call_tx_id, call_block_time, call_block_slot, call_outer_executing_account, call_tx_signer, 'burn' as action, call_outer_instruction_index, call_inner_instruction_index + SELECT + account_account as account_source, null as account_destination + , bytearray_to_uint256(bytearray_reverse(bytearray_substring(call_data,1+1,8))) as amount + , call_tx_id, call_block_time, call_block_slot, call_outer_executing_account, call_tx_signer + , 'burn' as action + , call_outer_instruction_index, call_inner_instruction_index + , null as fee + , 'spl_token' as token_version FROM {{ source('spl_token_solana','spl_token_call_burnChecked') }} -) tr + WHERE 1=1 + {% if is_incremental() %} + AND {{incremental_predicate('call_block_time')}} + {% endif %} + + --token2022. Most mint and account extensions still use the parent transferChecked instruction, hooks are excecuted after and interest-bearing is precalculated. + UNION ALL + + SELECT + account_source, account_destination, amount + , call_tx_id, call_block_time, call_block_slot, call_outer_executing_account, call_tx_signer + , action + , call_outer_instruction_index, call_inner_instruction_index + , fee + , token_version + FROM ( + SELECT + account_source, account_destination + , bytearray_to_uint256(bytearray_reverse(bytearray_substring(call_data,1+1,8))) as amount --note that interestbearing mints have a different amount methodology, to add later + , call_tx_id, call_block_time, call_block_slot, call_outer_executing_account, call_tx_signer + , 'transfer' as action + , call_outer_instruction_index, call_inner_instruction_index + , least( + cast(bytearray_to_uint256(bytearray_reverse(bytearray_substring(call_data,1+1,8))) as double) + *cast(f.fee_basis as double)/10000 + ,f.fee_maximum) as fee --we want to take the percent fee on total amount, but not exceed the maximum fee + , 'token2022' as token_version + , f.fee_time + , row_number() over (partition by tr.call_tx_id, tr.call_outer_instruction_index, tr.call_inner_instruction_index order by f.fee_time desc) as latest_fee + FROM {{ source('spl_token_2022_solana','spl_token_2022_call_transferChecked') }} tr + LEFT JOIN token2022_fee_state f ON tr.account_tokenMint = f.account_mint AND tr.call_block_time >= f.fee_time + WHERE 1=1 + {% if is_incremental() %} + AND {{incremental_predicate('tr.call_block_time')}} + {% endif %} + ) WHERE latest_fee = 1 + + UNION ALL + + SELECT + null as account_source, account_mintTo as account_destination + , bytearray_to_uint256(bytearray_reverse(bytearray_substring(call_data,1+1,8))) as amount + , call_tx_id, call_block_time, call_block_slot, call_outer_executing_account, call_tx_signer + , 'mint' as action + , call_outer_instruction_index, call_inner_instruction_index + , null as fee + , 'token2022' as token_version + FROM {{ source('spl_token_2022_solana','spl_token_2022_call_mintTo') }} + WHERE 1=1 + {% if is_incremental() %} + AND {{incremental_predicate('call_block_time')}} + {% endif %} + + UNION ALL + + SELECT + null as account_source, account_mintTo as account_destination + , bytearray_to_uint256(bytearray_reverse(bytearray_substring(call_data,1+1,8))) as amount + , call_tx_id, call_block_time, call_block_slot, call_outer_executing_account, call_tx_signer + , 'mint' as action + , call_outer_instruction_index, call_inner_instruction_index + , null as fee + , 'token2022' as token_version + FROM {{ source('spl_token_2022_solana','spl_token_2022_call_mintToChecked') }} + WHERE 1=1 + {% if is_incremental() %} + AND {{incremental_predicate('call_block_time')}} + {% endif %} + + UNION ALL + + SELECT + account_burnAccount as account_source, null as account_destination + , bytearray_to_uint256(bytearray_reverse(bytearray_substring(call_data,1+1,8))) as amount + , call_tx_id, call_block_time, call_block_slot, call_outer_executing_account, call_tx_signer + , 'burn' as action + , call_outer_instruction_index, call_inner_instruction_index + , null as fee + , 'token2022' as token_version + FROM {{ source('spl_token_2022_solana','spl_token_2022_call_burn') }} + WHERE 1=1 + {% if is_incremental() %} + AND {{incremental_predicate('call_block_time')}} + {% endif %} + + UNION ALL + + SELECT + account_burnAccount as account_source, null as account_destination + , bytearray_to_uint256(bytearray_reverse(bytearray_substring(call_data,1+1,8))) as amount + , call_tx_id, call_block_time, call_block_slot, call_outer_executing_account, call_tx_signer + , 'burn' as action + , call_outer_instruction_index, call_inner_instruction_index + , null as fee + , 'token2022' as token_version + FROM {{ source('spl_token_2022_solana','spl_token_2022_call_burnChecked') }} + WHERE 1=1 + {% if is_incremental() %} + AND {{incremental_predicate('call_block_time')}} + {% endif %} + + --token2022 transferFeeExtension has some extra complications. It's the only extension with its own transferChecked wrapper (confidential transfers will have this too) + UNION ALL + + SELECT + call_account_arguments[1] as account_source, call_account_arguments[3] as account_destination + , bytearray_to_uint256(bytearray_reverse(bytearray_substring(call_data,1+2,8))) as amount + , call_tx_id, call_block_time, call_block_slot, call_outer_executing_account, call_tx_signer + , 'transfer' as action + , call_outer_instruction_index, call_inner_instruction_index + , bytearray_to_uint256(bytearray_reverse(bytearray_substring(call_data, 1+2+8+1,8))) as fee + , 'token2022' as token_version + FROM {{ source('spl_token_2022_solana','spl_token_2022_call_transferFeeExtension') }} + WHERE bytearray_substring(call_data,1,2) = 0x1a01 --https://github.com/solana-labs/solana-program-library/blob/8f50c6fabc6ec87ada229e923030381f573e0aed/token/program-2022/src/extension/transfer_fee/instruction.rs#L284 + {% if is_incremental() %} + AND {{incremental_predicate('call_block_time')}} + {% endif %} +) + +SELECT + call_block_time as block_time + , cast (date_trunc('day', call_block_time) as date) as block_date + , call_block_slot as block_slot + , action + , amount + , fee + , COALESCE(tk_s.token_mint_address, tk_d.token_mint_address) as token_mint_address + , tk_s.token_balance_owner as from_owner + , tk_d.token_balance_owner as to_owner + , account_source as from_token_account + , account_destination as to_token_account + , token_version + , call_tx_signer as tx_signer + , call_tx_id as tx_id + , call_outer_instruction_index as outer_instruction_index + , COALESCE(call_inner_instruction_index,0) as inner_instruction_index + , call_outer_executing_account as outer_executing_account +FROM base tr --get token and accounts LEFT JOIN {{ ref('solana_utils_token_accounts') }} tk_s ON tk_s.address = tr.account_source LEFT JOIN {{ ref('solana_utils_token_accounts') }} tk_d ON tk_d.address = tr.account_destination WHERE 1=1 -{% if is_incremental() %} -AND {{incremental_predicate('call_block_time')}} -{% endif %} --- AND call_block_time > now() - interval '600' day \ No newline at end of file +-- AND call_block_time > now() - interval '90' day --for faster CI testing \ No newline at end of file From 2ce2175c6f85248c4615d60fb665067b0f9da756 Mon Sep 17 00:00:00 2001 From: jeff-dude <102681548+jeff-dude@users.noreply.github.com> Date: Thu, 6 Jun 2024 12:25:28 -0400 Subject: [PATCH 066/149] Revert "add token2022 into token transfers and fungible spells (#6050)" (#6105) This reverts commit f0ce7ee637aefda75b067f639a415d303e77b2ac. --- .../tokens/solana/tokens_solana.sources.yml | 23 -- .../tokens/solana/tokens_solana_fungible.sql | 158 ++-------- models/tokens/solana/tokens_solana_schema.yml | 11 +- .../tokens/solana/tokens_solana_transfers.sql | 279 ++---------------- 4 files changed, 56 insertions(+), 415 deletions(-) diff --git a/models/tokens/solana/tokens_solana.sources.yml b/models/tokens/solana/tokens_solana.sources.yml index 5a17103eee3..0636d8254fe 100644 --- a/models/tokens/solana/tokens_solana.sources.yml +++ b/models/tokens/solana/tokens_solana.sources.yml @@ -24,29 +24,6 @@ sources: - name: spl_token_call_burnChecked loaded_at_field: call_block_time - - name: spl_token_2022_solana - description: "spl_token 2022 decoded tables" - freshness: # default freshness - warn_after: { count: 12, period: hour } - error_after: { count: 24, period: hour } - tables: - - name: spl_token_2022_call_initializeMint - loaded_at_field: call_block_time - - name: spl_token_2022_call_initializeMint2 - loaded_at_field: call_block_time - - name: spl_token_2022_call_transferFeeExtension - loaded_at_field: call_block_time - - name: spl_token_2022_call_transferChecked - loaded_at_field: call_block_time - - name: spl_token_2022_call_mintTo - loaded_at_field: call_block_time - - name: spl_token_2022_call_mintToChecked - loaded_at_field: call_block_time - - name: spl_token_2022_call_burn - loaded_at_field: call_block_time - - name: spl_token_2022_call_burnChecked - loaded_at_field: call_block_time - - name: mpl_token_metadata_solana description: "mpl metadata decoded tables" freshness: # default freshness diff --git a/models/tokens/solana/tokens_solana_fungible.sql b/models/tokens/solana/tokens_solana_fungible.sql index 6a66471188c..5f26d007d6c 100644 --- a/models/tokens/solana/tokens_solana_fungible.sql +++ b/models/tokens/solana/tokens_solana_fungible.sql @@ -1,7 +1,7 @@ {{ config ( alias = 'fungible', - + post_hook='{{ expose_spells(\'["solana"]\', "sector", "tokens", @@ -10,32 +10,26 @@ }} -with +with tokens as ( SELECT bytearray_to_bigint(bytearray_reverse(bytearray_substring(call_data, 2, 1))) as decimals , call_data , account_mint - , token_version , call_tx_id , call_block_time - , row_number() over (partition by account_mint order by call_block_time desc) as latest FROM ( - SELECT call_data, account_mint, call_tx_id, call_block_time, 'spl_token' as token_version FROM {{ source('spl_token_solana', 'spl_token_call_initializeMint') }} - UNION ALL - SELECT call_data, account_mint, call_tx_id, call_block_time, 'spl_token' as token_version FROM {{ source('spl_token_solana', 'spl_token_call_initializeMint2') }} - UNION ALL - SELECT call_data, account_mint, call_tx_id, call_block_time, 'token2022' as token_version FROM {{ source('spl_token_2022_solana', 'spl_token_2022_call_initializeMint') }} - UNION ALL - SELECT call_data, account_mint, call_tx_id, call_block_time, 'token2022' as token_version FROM {{ source('spl_token_2022_solana', 'spl_token_2022_call_initializeMint2') }} + SELECT call_data, account_mint, call_tx_id, call_block_time FROM {{ source('spl_token_solana', 'spl_token_call_initializeMint') }} + UNION ALL + SELECT call_data, account_mint, call_tx_id, call_block_time FROM {{ source('spl_token_solana', 'spl_token_call_initializeMint2') }} ) {% if is_incremental() %} - where {{ incremental_predicate('call_block_time') }} + where call_block_time >= date_trunc('day', now() - interval '7' day) {% endif %} ) - + , metadata as ( - SELECT + SELECT meta.call_tx_id , meta.call_block_slot , meta.call_block_time @@ -44,10 +38,8 @@ with , meta.account_mint , meta.call_block_time , master.account_edition as master_edition - , metadata_program - , row_number() over (partition by meta.account_mint order by meta.call_block_time desc) as latest FROM ( - SELECT + SELECT call_tx_id , call_outer_instruction_index , call_inner_instruction_index @@ -56,10 +48,9 @@ with , json_query(createMetadataAccountArgs, 'lax $.CreateMetadataAccountArgs.data.Data') as args , account_metadata , account_mint - , call_executing_account as metadata_program FROM {{ source('mpl_token_metadata_solana', 'mpl_token_metadata_call_CreateMetadataAccount') }} - UNION ALL - SELECT + UNION ALL + SELECT call_tx_id , call_outer_instruction_index , call_inner_instruction_index @@ -68,143 +59,51 @@ with , json_query(createMetadataAccountArgsV2, 'lax $.CreateMetadataAccountArgsV2.data.DataV2') as args , account_metadata , account_mint - , call_executing_account as metadata_program FROM {{ source('mpl_token_metadata_solana', 'mpl_token_metadata_call_CreateMetadataAccountV2') }} - UNION ALL - SELECT + UNION ALL + SELECT call_tx_id , call_outer_instruction_index - , call_inner_instruction_index + , call_inner_instruction_index , call_block_slot , call_block_time , json_query(createMetadataAccountArgsV3, 'lax $.CreateMetadataAccountArgsV3.data.DataV2') as args , account_metadata , account_mint - , call_executing_account as metadata_program - FROM {{ source('mpl_token_metadata_solana', 'mpl_token_metadata_call_CreateMetadataAccountV3') }} - ) meta + FROM {{ source('mpl_token_metadata_solana', 'mpl_token_metadata_call_CreateMetadataAccountV3') }} + ) meta LEFT JOIN ( - SELECT account_mintAuthority, account_edition, account_metadata FROM {{ source('mpl_token_metadata_solana', 'mpl_token_metadata_call_CreateMasterEdition') }} + SELECT account_mintAuthority, account_edition, account_metadata FROM {{ source('mpl_token_metadata_solana', 'mpl_token_metadata_call_CreateMasterEdition') }} UNION ALL SELECT account_mintAuthority, account_edition, account_metadata FROM {{ source('mpl_token_metadata_solana', 'mpl_token_metadata_call_CreateMasterEditionV3') }} ) master ON master.account_metadata = meta.account_metadata {% if is_incremental() %} - WHERE {{ incremental_predicate('meta.call_block_time') }} - {% endif %} - ) - - , token2022_metadata as ( - --token2022 direct metadata extension - SELECT - from_utf8(bytearray_substring(data,1+8+4,bytearray_to_bigint(bytearray_reverse(bytearray_substring(data,1+8,4))))) as name - , from_utf8(bytearray_substring(data,1+8+4+bytearray_to_bigint(bytearray_reverse(bytearray_substring(data,1+8,4))) + 4 --start from end of name and end of length of symbol - , bytearray_to_bigint(bytearray_reverse(bytearray_substring(data,1+8+4+bytearray_to_bigint(bytearray_reverse(bytearray_substring(data,1+8,4))),4))) --get length of symbol from end of name - )) as symbol - , from_utf8(bytearray_substring(data,1+8+4+bytearray_to_bigint(bytearray_reverse(bytearray_substring(data,1+8,4))) + 4 --end of name and end of length of symbol - + bytearray_to_bigint(bytearray_reverse(bytearray_substring(data,1+8+4+bytearray_to_bigint(bytearray_reverse(bytearray_substring(data,1+8,4))),4))) + 4 --start from end of symbol and end of length of uri - , bytearray_to_bigint(bytearray_reverse(bytearray_substring(data,1+8+4+bytearray_to_bigint(bytearray_reverse(bytearray_substring(data,1+8,4))) + 4 - + bytearray_to_bigint(bytearray_reverse(bytearray_substring(data,1+8+4+bytearray_to_bigint(bytearray_reverse(bytearray_substring(data,1+8,4))),4))),4))) --get length of uri from end of symbol - )) as uri - , tx_id as metadata_tx - , account_arguments[3] as account_mint - , block_time - , executing_account as metadata_program - , row_number() over (partition by account_arguments[3] order by block_time desc) as latest - FROM {{ source('solana','instruction_calls') }} - WHERE executing_account = 'TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb' - AND bytearray_substring(data,1,1) = 0xd2 --deal with updateField later 0xdd - AND tx_success - {% if is_incremental() %} - AND {{ incremental_predicate('block_time') }} - {% endif %} - ) - - , token_metadata_other as ( - --some other metadata program (idk the owner) - SELECT - from_utf8(bytearray_substring(data,1+1+4,bytearray_to_bigint(bytearray_reverse(bytearray_substring(data,1+1,4))))) as name - , from_utf8(bytearray_substring(data,1+1+4+bytearray_to_bigint(bytearray_reverse(bytearray_substring(data,1+1,4))) + 4 --start from end of name and end of length of symbol - , bytearray_to_bigint(bytearray_reverse(bytearray_substring(data,1+1+4+bytearray_to_bigint(bytearray_reverse(bytearray_substring(data,1+1,4))),4))) --get length of symbol from end of name - )) as symbol - , from_utf8(bytearray_substring(data,1+1+4+bytearray_to_bigint(bytearray_reverse(bytearray_substring(data,1+1,4))) + 4 --end of name and end of length of symbol - + bytearray_to_bigint(bytearray_reverse(bytearray_substring(data,1+1+4+bytearray_to_bigint(bytearray_reverse(bytearray_substring(data,1+1,4))),4))) + 4 --start from end of symbol and end of length of uri - , bytearray_to_bigint(bytearray_reverse(bytearray_substring(data,1+1+4+bytearray_to_bigint(bytearray_reverse(bytearray_substring(data,1+1,4))) + 4 - + bytearray_to_bigint(bytearray_reverse(bytearray_substring(data,1+1+4+bytearray_to_bigint(bytearray_reverse(bytearray_substring(data,1+1,4))),4))),4))) --get length of uri from end of symbol - )) as uri - , tx_id as metadata_tx - , account_arguments[2] as account_mint - , block_time - , executing_account as metadata_program - , row_number() over (partition by account_arguments[2] order by block_time desc) as latest - FROM {{ source('solana','instruction_calls') }} - WHERE executing_account = 'META4s4fSmpkTbZoUsgC1oBnWB31vQcmnN8giPw51Zu' - AND bytearray_substring(data,1,1) = 0x21 - AND tx_success - {% if is_incremental() %} - AND {{ incremental_predicate('block_time') }} + WHERE meta.call_block_time >= date_trunc('day', now() - interval '7' day) {% endif %} ) SELECT tk.account_mint as token_mint_address , tk.decimals - , coalesce(m22.name,mo.name,trim(json_value(args, 'strict $.name'))) as name - , coalesce(m22.symbol,mo.symbol,trim(json_value(args, 'strict $.symbol'))) as symbol - , coalesce(m22.uri,mo.uri,trim(json_value(args, 'strict $.uri'))) as token_uri + , trim(json_value(args, 'strict $.name'))as name + , trim(json_value(args, 'strict $.symbol')) as symbol + , trim(json_value(args, 'strict $.uri')) as token_uri , tk.call_block_time as created_at - , coalesce(m22.metadata_program,mo.metadata_program,m.metadata_program) as metadata_program - , tk.token_version - , tk.call_tx_id as init_tx FROM tokens tk -LEFT JOIN token2022_metadata m22 ON tk.account_mint = m22.account_mint AND m22.latest = 1 -LEFT JOIN token_metadata_other mo ON tk.account_mint = mo.account_mint AND mo.latest = 1 -LEFT JOIN metadata m ON tk.account_mint = m.account_mint AND m.latest = 1 +LEFT JOIN metadata m ON tk.account_mint = m.account_mint WHERE m.master_edition is null -AND tk.latest = 1 - -UNION ALL - ---token2022 wrapped sol https://solscan.io/tx/2L1o7sDMCMJ6PYqfNrnY6ozJC1DEx61pRYiLdfCCggxw81naQXsmHKDLn6EhJXmDmDSQ2eCKjUMjZAQuUsyNnYUv -SELECT - trim(token_mint_address) as token_mint_address - , decimals - , trim(name) as name - , trim(symbol) as symbol - , token_uri - , cast(created_at as timestamp) created_at - , metadata_program - , token_version - , init_tx -FROM -( - VALUES -( - '9pan9bMn5HatX4EJdBwg9VgCa7Uz5HL8N1m5D3NdXejP', - 9, - 'wrapped SOL', - 'SOL', - null, - '2023-08-02 00:00:00', - null, - 'token2022', - '2L1o7sDMCMJ6PYqfNrnY6ozJC1DEx61pRYiLdfCCggxw81naQXsmHKDLn6EhJXmDmDSQ2eCKjUMjZAQuUsyNnYUv' -) -) AS temp_table (token_mint_address, decimals, name, symbol, token_uri, created_at, metadata_program, token_version, init_tx) UNION ALL ---old wrapped sol is special and doesn't have a init tx (that I can find) -SELECT +--wrapped sol is special and doesn't have a init tx (that I can find) +SELECT trim(token_mint_address) as token_mint_address , decimals , trim(name) as name , trim(symbol) as symbol , token_uri , cast(created_at as timestamp) created_at - , metadata_program - , token_version - , init_tx -FROM +FROM ( VALUES ( @@ -213,9 +112,6 @@ FROM 'wrapped SOL', 'SOL', null, - '2021-01-31 00:00:00', - null, - 'spl_token', - null + '2021-01-31 00:00:00' ) -) AS temp_table (token_mint_address, decimals, name, symbol, token_uri, created_at, metadata_program, token_version, init_tx) +) AS temp_table (token_mint_address, decimals, name, symbol, token_uri, created_at) diff --git a/models/tokens/solana/tokens_solana_schema.yml b/models/tokens/solana/tokens_solana_schema.yml index 29ac7ed40e8..ab3b17f52e5 100644 --- a/models/tokens/solana/tokens_solana_schema.yml +++ b/models/tokens/solana/tokens_solana_schema.yml @@ -19,14 +19,8 @@ models: description: "token symbol" - name: decimals description: "Number of decimals, refers to how divisible a token can be" - - name: metadata_program - description: program used for creating token metadata - - name: token_version - description: version of the token program used (spl_token, token2022) - name: created_at description: token mint created at - - name: init_tx - description: "transaction that initialized the mint" - name: tokens_solana_nft meta: @@ -78,7 +72,7 @@ models: config: tags: ['solana','transfers','erc20','nft','spl'] description: > - get all spl token transfers + get all spl token transfers (will add in token2022 later) columns: - name: block_time - name: block_date @@ -86,13 +80,10 @@ models: - name: action - name: token_mint_address - name: amount - - name: fee - - name: token_version - name: from_owner - name: to_owner - name: from_token_account - name: to_token_account - - name: token_version - name: tx_signer - name: tx_id - name: outer_instruction_index diff --git a/models/tokens/solana/tokens_solana_transfers.sql b/models/tokens/solana/tokens_solana_transfers.sql index 2bb1e5600d6..a28903cf3d4 100644 --- a/models/tokens/solana/tokens_solana_transfers.sql +++ b/models/tokens/solana/tokens_solana_transfers.sql @@ -14,279 +14,56 @@ \'["ilemi"]\') }}') }} -with -token2022_fee_state as ( - --we need the fee basis points and maximum fee for token2022 transfers because the fee amount is not emitted in transferChecked - SELECT - call_account_arguments[1] as account_mint - , try(bytearray_to_uint256(bytearray_reverse(bytearray_substring(call_data, - 1+1+1+1+1+case when bytearray_substring(call_data,1+1+1,1) = 0x01 and bytearray_substring(call_data,1+1+1+32+1,1) = 0x01 - then 64 - when bytearray_substring(call_data,1+1+1,1) = 0x01 and bytearray_substring(call_data,1+1+1+32+1,1) = 0x00 - then 32 - when bytearray_substring(call_data,1+1+1,1) = 0x00 and bytearray_substring(call_data,1+1+1+1,1) = 0x01 - then 32 - when bytearray_substring(call_data,1+1+1,1) = 0x00 and bytearray_substring(call_data,1+1+1+1,1) = 0x00 - then 0 - end --variations of COPTION enums for first two arguments - ,2)))) as fee_basis - , try(bytearray_to_uint256(bytearray_reverse(bytearray_substring(call_data, - 1+1+1+1+1+case when bytearray_substring(call_data,1+1+1,1) = 0x01 and bytearray_substring(call_data,1+1+1+32+1,1) = 0x01 - then 64 - when bytearray_substring(call_data,1+1+1,1) = 0x01 and bytearray_substring(call_data,1+1+1+32+1,1) = 0x00 - then 32 - when bytearray_substring(call_data,1+1+1,1) = 0x00 and bytearray_substring(call_data,1+1+1+1,1) = 0x01 - then 32 - when bytearray_substring(call_data,1+1+1,1) = 0x00 and bytearray_substring(call_data,1+1+1+1,1) = 0x00 - then 0 - end - +2 - ,16)))) as fee_maximum - , call_block_time as fee_time - FROM {{ source('spl_token_2022_solana','spl_token_2022_call_transferFeeExtension') }} - WHERE bytearray_substring(call_data,1+1,1) = 0x00 --https://github.com/solana-labs/solana-program-library/blob/8f50c6fabc6ec87ada229e923030381f573e0aed/token/program-2022/src/extension/transfer_fee/instruction.rs#L38 - UNION ALL - SELECT - call_account_arguments[1] as account_mint - , try(bytearray_to_uint256(bytearray_reverse(bytearray_substring(call_data, - 1+1+1,2)))) as fee_basis - , try(bytearray_to_uint256(bytearray_reverse(bytearray_substring(call_data, - 1+1+1+2,16)))) as fee_maximum - , call_block_time as fee_time - FROM {{ source('spl_token_2022_solana','spl_token_2022_call_transferFeeExtension') }} - WHERE bytearray_substring(call_data,1+1,1) = 0x05 --https://github.com/solana-labs/solana-program-library/blob/8f50c6fabc6ec87ada229e923030381f573e0aed/token/program-2022/src/extension/transfer_fee/instruction.rs#L147 -) - -, base as ( - SELECT - account_source, account_destination - , bytearray_to_uint256(bytearray_reverse(bytearray_substring(call_data,1+1,8))) as amount - , call_tx_id, call_block_time, call_block_slot, call_outer_executing_account, call_tx_signer - , 'transfer' as action - , call_outer_instruction_index, call_inner_instruction_index - , null as fee - , 'spl_token' as token_version +SELECT + call_block_time as block_time + , cast (date_trunc('day', call_block_time) as date) as block_date + , call_block_slot as block_slot + , action + , amount + , COALESCE(tk_s.token_mint_address, tk_d.token_mint_address) as token_mint_address + , tk_s.token_balance_owner as from_owner + , tk_d.token_balance_owner as to_owner + , account_source as from_token_account + , account_destination as to_token_account + , call_tx_signer as tx_signer + , call_tx_id as tx_id + , call_outer_instruction_index as outer_instruction_index + , COALESCE(call_inner_instruction_index,0) as inner_instruction_index + , call_outer_executing_account as outer_executing_account +FROM ( + SELECT account_source, account_destination, amount, call_tx_id, call_block_time, call_block_slot, call_outer_executing_account, call_tx_signer, 'transfer' as action, call_outer_instruction_index, call_inner_instruction_index FROM {{ source('spl_token_solana','spl_token_call_transfer') }} - WHERE 1=1 - {% if is_incremental() %} - AND {{incremental_predicate('call_block_time')}} - {% endif %} UNION ALL - SELECT - account_source, account_destination - , bytearray_to_uint256(bytearray_reverse(bytearray_substring(call_data,1+1,8))) as amount - , call_tx_id, call_block_time, call_block_slot, call_outer_executing_account, call_tx_signer - , 'transfer' as action - , call_outer_instruction_index, call_inner_instruction_index - , null as fee - , 'spl_token' as token_version + SELECT account_source, account_destination, amount, call_tx_id, call_block_time, call_block_slot, call_outer_executing_account, call_tx_signer, 'transfer' as action, call_outer_instruction_index, call_inner_instruction_index FROM {{ source('spl_token_solana','spl_token_call_transferChecked') }} - WHERE 1=1 - {% if is_incremental() %} - AND {{incremental_predicate('call_block_time')}} - {% endif %} UNION ALL - SELECT - null as account_source, account_account as account_destination - , bytearray_to_uint256(bytearray_reverse(bytearray_substring(call_data,1+1,8))) as amount - , call_tx_id, call_block_time, call_block_slot, call_outer_executing_account, call_tx_signer - , 'mint' as action - , call_outer_instruction_index, call_inner_instruction_index - , null as fee - , 'spl_token' as token_version + SELECT null, account_account as account_destination, amount, call_tx_id, call_block_time, call_block_slot, call_outer_executing_account, call_tx_signer, 'mint' as action, call_outer_instruction_index, call_inner_instruction_index FROM {{ source('spl_token_solana','spl_token_call_mintTo') }} - WHERE 1=1 - {% if is_incremental() %} - AND {{incremental_predicate('call_block_time')}} - {% endif %} UNION ALL - SELECT - null as account_source, account_account as account_destination - , bytearray_to_uint256(bytearray_reverse(bytearray_substring(call_data,1+1,8))) as amount - , call_tx_id, call_block_time, call_block_slot, call_outer_executing_account, call_tx_signer - , 'mint' as action - , call_outer_instruction_index, call_inner_instruction_index - , null as fee - , 'spl_token' as token_version + SELECT null, account_account as account_destination, amount, call_tx_id, call_block_time, call_block_slot, call_outer_executing_account, call_tx_signer, 'mint' as action, call_outer_instruction_index, call_inner_instruction_index FROM {{ source('spl_token_solana','spl_token_call_mintToChecked') }} - WHERE 1=1 - {% if is_incremental() %} - AND {{incremental_predicate('call_block_time')}} - {% endif %} UNION ALL - SELECT - account_account as account_source, null as account_destination - , bytearray_to_uint256(bytearray_reverse(bytearray_substring(call_data,1+1,8))) as amount - , call_tx_id, call_block_time, call_block_slot, call_outer_executing_account, call_tx_signer - , 'burn' as action - , call_outer_instruction_index, call_inner_instruction_index - , null as fee - , 'spl_token' as token_version + SELECT account_account as account_source, null, amount, call_tx_id, call_block_time, call_block_slot, call_outer_executing_account, call_tx_signer, 'burn' as action, call_outer_instruction_index, call_inner_instruction_index FROM {{ source('spl_token_solana','spl_token_call_burn') }} - WHERE 1=1 - {% if is_incremental() %} - AND {{incremental_predicate('call_block_time')}} - {% endif %} UNION ALL - SELECT - account_account as account_source, null as account_destination - , bytearray_to_uint256(bytearray_reverse(bytearray_substring(call_data,1+1,8))) as amount - , call_tx_id, call_block_time, call_block_slot, call_outer_executing_account, call_tx_signer - , 'burn' as action - , call_outer_instruction_index, call_inner_instruction_index - , null as fee - , 'spl_token' as token_version + SELECT account_account as account_source, null, amount, call_tx_id, call_block_time, call_block_slot, call_outer_executing_account, call_tx_signer, 'burn' as action, call_outer_instruction_index, call_inner_instruction_index FROM {{ source('spl_token_solana','spl_token_call_burnChecked') }} - WHERE 1=1 - {% if is_incremental() %} - AND {{incremental_predicate('call_block_time')}} - {% endif %} - - --token2022. Most mint and account extensions still use the parent transferChecked instruction, hooks are excecuted after and interest-bearing is precalculated. - UNION ALL - - SELECT - account_source, account_destination, amount - , call_tx_id, call_block_time, call_block_slot, call_outer_executing_account, call_tx_signer - , action - , call_outer_instruction_index, call_inner_instruction_index - , fee - , token_version - FROM ( - SELECT - account_source, account_destination - , bytearray_to_uint256(bytearray_reverse(bytearray_substring(call_data,1+1,8))) as amount --note that interestbearing mints have a different amount methodology, to add later - , call_tx_id, call_block_time, call_block_slot, call_outer_executing_account, call_tx_signer - , 'transfer' as action - , call_outer_instruction_index, call_inner_instruction_index - , least( - cast(bytearray_to_uint256(bytearray_reverse(bytearray_substring(call_data,1+1,8))) as double) - *cast(f.fee_basis as double)/10000 - ,f.fee_maximum) as fee --we want to take the percent fee on total amount, but not exceed the maximum fee - , 'token2022' as token_version - , f.fee_time - , row_number() over (partition by tr.call_tx_id, tr.call_outer_instruction_index, tr.call_inner_instruction_index order by f.fee_time desc) as latest_fee - FROM {{ source('spl_token_2022_solana','spl_token_2022_call_transferChecked') }} tr - LEFT JOIN token2022_fee_state f ON tr.account_tokenMint = f.account_mint AND tr.call_block_time >= f.fee_time - WHERE 1=1 - {% if is_incremental() %} - AND {{incremental_predicate('tr.call_block_time')}} - {% endif %} - ) WHERE latest_fee = 1 - - UNION ALL - - SELECT - null as account_source, account_mintTo as account_destination - , bytearray_to_uint256(bytearray_reverse(bytearray_substring(call_data,1+1,8))) as amount - , call_tx_id, call_block_time, call_block_slot, call_outer_executing_account, call_tx_signer - , 'mint' as action - , call_outer_instruction_index, call_inner_instruction_index - , null as fee - , 'token2022' as token_version - FROM {{ source('spl_token_2022_solana','spl_token_2022_call_mintTo') }} - WHERE 1=1 - {% if is_incremental() %} - AND {{incremental_predicate('call_block_time')}} - {% endif %} - - UNION ALL - - SELECT - null as account_source, account_mintTo as account_destination - , bytearray_to_uint256(bytearray_reverse(bytearray_substring(call_data,1+1,8))) as amount - , call_tx_id, call_block_time, call_block_slot, call_outer_executing_account, call_tx_signer - , 'mint' as action - , call_outer_instruction_index, call_inner_instruction_index - , null as fee - , 'token2022' as token_version - FROM {{ source('spl_token_2022_solana','spl_token_2022_call_mintToChecked') }} - WHERE 1=1 - {% if is_incremental() %} - AND {{incremental_predicate('call_block_time')}} - {% endif %} - - UNION ALL - - SELECT - account_burnAccount as account_source, null as account_destination - , bytearray_to_uint256(bytearray_reverse(bytearray_substring(call_data,1+1,8))) as amount - , call_tx_id, call_block_time, call_block_slot, call_outer_executing_account, call_tx_signer - , 'burn' as action - , call_outer_instruction_index, call_inner_instruction_index - , null as fee - , 'token2022' as token_version - FROM {{ source('spl_token_2022_solana','spl_token_2022_call_burn') }} - WHERE 1=1 - {% if is_incremental() %} - AND {{incremental_predicate('call_block_time')}} - {% endif %} - - UNION ALL - - SELECT - account_burnAccount as account_source, null as account_destination - , bytearray_to_uint256(bytearray_reverse(bytearray_substring(call_data,1+1,8))) as amount - , call_tx_id, call_block_time, call_block_slot, call_outer_executing_account, call_tx_signer - , 'burn' as action - , call_outer_instruction_index, call_inner_instruction_index - , null as fee - , 'token2022' as token_version - FROM {{ source('spl_token_2022_solana','spl_token_2022_call_burnChecked') }} - WHERE 1=1 - {% if is_incremental() %} - AND {{incremental_predicate('call_block_time')}} - {% endif %} - - --token2022 transferFeeExtension has some extra complications. It's the only extension with its own transferChecked wrapper (confidential transfers will have this too) - UNION ALL - - SELECT - call_account_arguments[1] as account_source, call_account_arguments[3] as account_destination - , bytearray_to_uint256(bytearray_reverse(bytearray_substring(call_data,1+2,8))) as amount - , call_tx_id, call_block_time, call_block_slot, call_outer_executing_account, call_tx_signer - , 'transfer' as action - , call_outer_instruction_index, call_inner_instruction_index - , bytearray_to_uint256(bytearray_reverse(bytearray_substring(call_data, 1+2+8+1,8))) as fee - , 'token2022' as token_version - FROM {{ source('spl_token_2022_solana','spl_token_2022_call_transferFeeExtension') }} - WHERE bytearray_substring(call_data,1,2) = 0x1a01 --https://github.com/solana-labs/solana-program-library/blob/8f50c6fabc6ec87ada229e923030381f573e0aed/token/program-2022/src/extension/transfer_fee/instruction.rs#L284 - {% if is_incremental() %} - AND {{incremental_predicate('call_block_time')}} - {% endif %} -) - -SELECT - call_block_time as block_time - , cast (date_trunc('day', call_block_time) as date) as block_date - , call_block_slot as block_slot - , action - , amount - , fee - , COALESCE(tk_s.token_mint_address, tk_d.token_mint_address) as token_mint_address - , tk_s.token_balance_owner as from_owner - , tk_d.token_balance_owner as to_owner - , account_source as from_token_account - , account_destination as to_token_account - , token_version - , call_tx_signer as tx_signer - , call_tx_id as tx_id - , call_outer_instruction_index as outer_instruction_index - , COALESCE(call_inner_instruction_index,0) as inner_instruction_index - , call_outer_executing_account as outer_executing_account -FROM base tr +) tr --get token and accounts LEFT JOIN {{ ref('solana_utils_token_accounts') }} tk_s ON tk_s.address = tr.account_source LEFT JOIN {{ ref('solana_utils_token_accounts') }} tk_d ON tk_d.address = tr.account_destination WHERE 1=1 --- AND call_block_time > now() - interval '90' day --for faster CI testing \ No newline at end of file +{% if is_incremental() %} +AND {{incremental_predicate('call_block_time')}} +{% endif %} +-- AND call_block_time > now() - interval '600' day \ No newline at end of file From cad8cb02b4ddc84f24583d2816c2aeb9c48198c5 Mon Sep 17 00:00:00 2001 From: hildobby Date: Thu, 6 Jun 2024 21:39:20 +0200 Subject: [PATCH 067/149] More stakers (#6047) * add puffer and 2 unknown clusters * rm dupes --- ..._ethereum_entities_depositor_addresses.sql | 138 ++++++++++++++++++ .../staking_ethereum_entities_schema.yml | 24 +-- .../ethereum/staking_ethereum_info.sql | 6 + .../ethereum/staking_ethereum_schema.yml | 4 +- 4 files changed, 158 insertions(+), 14 deletions(-) diff --git a/models/staking/ethereum/entities/staking_ethereum_entities_depositor_addresses.sql b/models/staking/ethereum/entities/staking_ethereum_entities_depositor_addresses.sql index c1dc3ea84de..dc9f6d245ed 100644 --- a/models/staking/ethereum/entities/staking_ethereum_entities_depositor_addresses.sql +++ b/models/staking/ethereum/entities/staking_ethereum_entities_depositor_addresses.sql @@ -119,6 +119,116 @@ FROM , (0xe8239B17034c372CDF8A5F8d3cCb7Cf1795c4572, 'RockX', 'RockX 2', 'Staking Pool') , (0xea674fdde714fd979de3edf0f56aa9716b898ec8, 'Ethermine', 'Ethermine', 'Staking Pool') , (0x25e821b7197b146f7713c3b89b6a4d83516b912d, 'ether.fi', 'ether.fi', 'Liquid Restaking') + , (0xe60ca7abf24de99af64e7d9057659ae2dbc2eb2c, 'Puffer Finance', 'Puffer Finance 1', 'Liquid Restaking') + , (0x53bdF36503864593406D8e0e9fe848f2cEB91817, 'Puffer Finance', 'Puffer Finance 2', 'Liquid Restaking') + , (0x4d7c3fc856ab52753b91a6c9213adf013309dd25, 'Puffer Finance', 'Puffer Finance 3', 'Liquid Restaking') + , (0xf831b40e80ffd364b0a08619666ee09df3a3f73a, 'Puffer Finance', 'Puffer Finance 4', 'Liquid Restaking') + , (0x6d069d7210A97a5F86150698Ccc8D750fcA2512f, 'Puffer Finance', 'Puffer Finance 5', 'Liquid Restaking') + , (0x175da1e44c8fbf124714a3bba5dc18a7e65664d6, 'Puffer Finance', 'Puffer Finance 6', 'Liquid Restaking') + , (0xf5d31b441b8f1c53c7c5beb80089fec228c531fb, 'Puffer Finance', 'Puffer Finance 7', 'Liquid Restaking') + , (0x1719e587d4Cb7e9F3a0e9351c83ADc48dC9e7bCF, 'Puffer Finance', 'Puffer Finance 8', 'Liquid Restaking') + , (0x73f23013c5a4c209de945cdc58595a4d53d23084, 'Puffer Finance', 'Puffer Finance 9', 'Liquid Restaking') + , (0xa4c78fdae426d16baa010acedeec87706ac3f76b, 'Puffer Finance', 'Puffer Finance 10', 'Liquid Restaking') + , (0x0e3AC3cD91889343B6F9D24Fda634E571BBCE643, 'Puffer Finance', 'Puffer Finance 11', 'Liquid Restaking') + , (0x59639aeee35c4108923fd16e66055b347fbeadd2, 'Puffer Finance', 'Puffer Finance 12', 'Liquid Restaking') + , (0xbb43dcafa77fb5d1888a087ce6a30c287981c391, 'Puffer Finance', 'Puffer Finance 13', 'Liquid Restaking') + , (0xc8c131befBeFE0bC0eD06C0C263335a01322D000, 'Puffer Finance', 'Puffer Finance 14', 'Liquid Restaking') + , (0xdd6859450e80665db854022e85fb0ed2f0240cb9, 'Puffer Finance', 'Puffer Finance 15', 'Liquid Restaking') + , (0xbca580b952801236322734bb146f3e27894f736e, 'Puffer Finance', 'Puffer Finance 16', 'Liquid Restaking') + , (0x6Ab300BA5C74d3F2AaC53F730fa16A9E1588B46c, 'Puffer Finance', 'Puffer Finance 17', 'Liquid Restaking') + , (0xe48e7102c03812dfa1fdf0bbe6dbba6dc70b0f33, 'Puffer Finance', 'Puffer Finance 18', 'Liquid Restaking') + , (0x48c09cad9d785e21210a4e84fcb0ff5a3a73c58d, 'Puffer Finance', 'Puffer Finance 19', 'Liquid Restaking') + , (0x0e54A434b0a8Fb4c7f549FBEc551638754736944, 'Puffer Finance', 'Puffer Finance 20', 'Liquid Restaking') + , (0xe859a34cdd097ac7e8167ad828ca9ad969925a6a, 'Puffer Finance', 'Puffer Finance 21', 'Liquid Restaking') + , (0x5fde1b2d371243edca74b77082d40e01c5f15b31, 'Puffer Finance', 'Puffer Finance 22', 'Liquid Restaking') + , (0x92223B7CaCCDCc1A1164F581BA41C9356482932e, 'Puffer Finance', 'Puffer Finance 23', 'Liquid Restaking') + , (0xc327e3152ef9784faf0190cfa2592ddea5455430, 'Puffer Finance', 'Puffer Finance 24', 'Liquid Restaking') + , (0xC06B5AEbE343336C382ef397c718f4dfdcEB3424, 'Puffer Finance', 'Puffer Finance 25', 'Liquid Restaking') + , (0x4cee5738cc8cc1ff262034c4ddcf42675504afa9, 'Puffer Finance', 'Puffer Finance 26', 'Liquid Restaking') + , (0x1c354702D52b3aCf46372fd3578CE7ba9170F70c, 'Puffer Finance', 'Puffer Finance 27', 'Liquid Restaking') + , (0x9afca71c47910fe300fe0419a621a29c79537337, 'Puffer Finance', 'Puffer Finance 28', 'Liquid Restaking') + , (0xaCc1C68400C589BBA01b8F1CAA2Cb82eE9f389a4, 'Puffer Finance', 'Puffer Finance 29', 'Liquid Restaking') + , (0x0c9e6af5ad0d4826d81b8d51c4f4c2044ad05763, 'Puffer Finance', 'Puffer Finance 30', 'Liquid Restaking') + , (0xEDdB5f8dbEEF8959208daA10B931BB060F90CD6E, 'Puffer Finance', 'Puffer Finance 31', 'Liquid Restaking') + , (0xf66a37b7d6e99b9af3d835d1b33c80abe339915d, 'Puffer Finance', 'Puffer Finance 32', 'Liquid Restaking') + , (0x62d9019E0CCd6c8257F64651640BCd1AE23BC61f, 'Puffer Finance', 'Puffer Finance 33', 'Liquid Restaking') + , (0x2ab60aa450c7f16afd70f27a789833ebc638a9d0, 'Puffer Finance', 'Puffer Finance 34', 'Liquid Restaking') + , (0x40dcF0463a9b7FD50a8D8c7D8601798E12Effd36, 'Puffer Finance', 'Puffer Finance 35', 'Liquid Restaking') + , (0xc6910530820b3b85053be0db2863f332d6f45792, 'Puffer Finance', 'Puffer Finance 36', 'Liquid Restaking') + , (0x9d64c17F8C0fE43173818f9BD42D68638d3eD127, 'Puffer Finance', 'Puffer Finance 37', 'Liquid Restaking') + , (0x4d92687163dcfd582bb9e103e9086904901b55f8, 'Puffer Finance', 'Puffer Finance 38', 'Liquid Restaking') + , (0x9C938360b31bDDeab8C1B372b14dBd7E6270c5a8, 'Puffer Finance', 'Puffer Finance 39', 'Liquid Restaking') + , (0xfbe7657e38fe774027978271603ec22d95c1eb54, 'Puffer Finance', 'Puffer Finance 40', 'Liquid Restaking') + , (0x9481dC8d24578256A38e9Fe094A4493fdcf72b4e, 'Puffer Finance', 'Puffer Finance 41', 'Liquid Restaking') + , (0xf22a3f429905f9faa2ebe5947fc2d58b6ecce440, 'Puffer Finance', 'Puffer Finance 42', 'Liquid Restaking') + , (0xeBD58Fd9125ADaA16dB719bCf85dCFf1Eb71FAAc, 'Puffer Finance', 'Puffer Finance 43', 'Liquid Restaking') + , (0x5a2b0b1a12af2b10c7d6a4ab612a667cb8ba278d, 'Puffer Finance', 'Puffer Finance 44', 'Liquid Restaking') + , (0x7CBab465543E4cCE8E81bf25732A4bac551cCC3c, 'Puffer Finance', 'Puffer Finance 45', 'Liquid Restaking') + , (0xfe80649dc2cb126dd10603be02f0d94afc364fc9, 'Puffer Finance', 'Puffer Finance 46', 'Liquid Restaking') + , (0x2aAc86bD3bc5baE447bBcAF5a201656a95fACE7C, 'Puffer Finance', 'Puffer Finance 47', 'Liquid Restaking') + , (0x2d8f1a00e3e768d679fa7bd6fe567faa70f726b2, 'Puffer Finance', 'Puffer Finance 48', 'Liquid Restaking') + , (0x95401f1B03C11E16840119556a495549953F47A6, 'Puffer Finance', 'Puffer Finance 49', 'Liquid Restaking') + , (0x3000ca8ae328ae3996ee22c30b609d8e2b701599, 'Puffer Finance', 'Puffer Finance 50', 'Liquid Restaking') + , (0x67e3020efd52b14be4158eb888611f6d6930e02a, 'Puffer Finance', 'Puffer Finance 51', 'Liquid Restaking') + , (0x7822be4356b5e633bb8a445952c3d35fdb642986, 'Puffer Finance', 'Puffer Finance 52', 'Liquid Restaking') + , (0x031f5c9a8c1af1eb5ad48b9f6ab4253a66c5d4b6, 'Puffer Finance', 'Puffer Finance 53', 'Liquid Restaking') + , (0xda2dcde31b020b6b6f8c02d2bf4821db22091750, 'Puffer Finance', 'Puffer Finance 54', 'Liquid Restaking') + , (0x21b5e2044f73b257cdbe3bdc402f02b404cbfbf1, 'Puffer Finance', 'Puffer Finance 55', 'Liquid Restaking') + , (0x32eec068c4d0578b94169726890d5395d4647dc4, 'Puffer Finance', 'Puffer Finance 56', 'Liquid Restaking') + , (0xd346547f70ef624b36d5ec284c6d27710920b712, 'Puffer Finance', 'Puffer Finance 57', 'Liquid Restaking') + , (0x70d8c06125145281710dd73de382b7c1938200ea, 'Puffer Finance', 'Puffer Finance 58', 'Liquid Restaking') + , (0xd52fcbb08732de26a99a7f0c0a50412820a4b683, 'Puffer Finance', 'Puffer Finance 59', 'Liquid Restaking') + , (0x55efc9f901a5ada996011276450f7320729223b0, 'Puffer Finance', 'Puffer Finance 60', 'Liquid Restaking') + , (0x970601aeecf72a18c3afddd29078fd89a4bc267e, 'Puffer Finance', 'Puffer Finance 61', 'Liquid Restaking') + , (0xc1102180394132f19b6a50a158ec313ceffc4a3a, 'Puffer Finance', 'Puffer Finance 62', 'Liquid Restaking') + , (0x779190349f31c7bba1db2da051f118bf3074a477, 'Puffer Finance', 'Puffer Finance 63', 'Liquid Restaking') + , (0xf2d65e8093201c1645b822f9849fe375ea96056a, 'Puffer Finance', 'Puffer Finance 64', 'Liquid Restaking') + , (0x3923eb2d93c84baf3fa60a277db720228647def7, 'Puffer Finance', 'Puffer Finance 65', 'Liquid Restaking') + , (0xb1ee744162e94cced7cab1d53d81664950e41c39, 'Puffer Finance', 'Puffer Finance 66', 'Liquid Restaking') + , (0xd7988e9347f0eaea570695e88acea9cc6b66be13, 'Puffer Finance', 'Puffer Finance 67', 'Liquid Restaking') + , (0x6c6f3c472b5180df84efc7d65e81f7950d87a3f6, 'Puffer Finance', 'Puffer Finance 68', 'Liquid Restaking') + , (0xdf762d0afc382850c5160e6a4d3cf521774032f9, 'Puffer Finance', 'Puffer Finance 69', 'Liquid Restaking') + , (0xca3964974bae15cb7d941b32712302b2b6c5d4ab, 'Puffer Finance', 'Puffer Finance 70', 'Liquid Restaking') + , (0xf8baa75b11d8dda80ad286254aac9d08edb505c1, 'Puffer Finance', 'Puffer Finance 71', 'Liquid Restaking') + , (0xb53d7bcbc30652ff35650246e3b591a064266b2b, 'Puffer Finance', 'Puffer Finance 72', 'Liquid Restaking') + , (0x57f514aab0ec72cdb9d2d01cae0dd6ecd4981ce1, 'Puffer Finance', 'Puffer Finance 73', 'Liquid Restaking') + , (0xfa33e7d1bdfcb213e0cffa6e981fcad12d1638fa, 'Puffer Finance', 'Puffer Finance 74', 'Liquid Restaking') + , (0x8e59e546b97eaaab54f9650c89dc3875556d9635, 'Puffer Finance', 'Puffer Finance 75', 'Liquid Restaking') + , (0x024d2378d80df4c6f49cb1f388d5a53d42c3e5fd, 'Puffer Finance', 'Puffer Finance 76', 'Liquid Restaking') + , (0x4bbe8d3bb39d30e1f29678ad0b3039b397c1d55f, 'Puffer Finance', 'Puffer Finance 77', 'Liquid Restaking') + , (0x8c81d590cc94ca2451c4bde24c598193da74a575, 'Puffer Finance', 'Puffer Finance 78', 'Liquid Restaking') + , (0x2a89d38a2fd5b3d90c6f3813d23e0c2ed33cd7e2, 'Puffer Finance', 'Puffer Finance 79', 'Liquid Restaking') + , (0x9ae3eb1948e70c7f9804e30a34e8c25e0dd8261d, 'Puffer Finance', 'Puffer Finance 80', 'Liquid Restaking') + , (0x5905361a292c4582139a9ceaec1a71ea950d0677, 'Puffer Finance', 'Puffer Finance 81', 'Liquid Restaking') + , (0x3c12e47bd31b7c72ab05b514abae4b5abe871072, 'Puffer Finance', 'Puffer Finance 82', 'Liquid Restaking') + , (0x4cda1525b7d6577a59b6325201b3a68939da91d8, 'Puffer Finance', 'Puffer Finance 83', 'Liquid Restaking') + , (0xe097f793464e4503616e55d28294bf0fb982d14f, 'Puffer Finance', 'Puffer Finance 84', 'Liquid Restaking') + , (0xb92ac33d59ec4f93787acc773ba6e26ef536749a, 'Puffer Finance', 'Puffer Finance 85', 'Liquid Restaking') + , (0xad3f79fdf705cda1e8d9d7c398a678ee6ebb2cab, 'Puffer Finance', 'Puffer Finance 86', 'Liquid Restaking') + , (0xdbe13208672a329ac8827d5752ba3e63253617aa, 'Puffer Finance', 'Puffer Finance 87', 'Liquid Restaking') + , (0x11d28e6a3a8513432af889b25318d9b94bcb0d99, 'Puffer Finance', 'Puffer Finance 88', 'Liquid Restaking') + , (0xd695b18944902c0a2c899aaa789e06d30e6b0c6c, 'Puffer Finance', 'Puffer Finance 89', 'Liquid Restaking') + , (0xec77866c71f19b694b2d1640b0dc8585a3555596, 'Puffer Finance', 'Puffer Finance 90', 'Liquid Restaking') + , (0x5fee3852b09fd5be7043ba5eca71e674ea80c3ff, 'Puffer Finance', 'Puffer Finance 91', 'Liquid Restaking') + , (0x00c89174d831744ab9f004fc8056f85152443acc, 'Puffer Finance', 'Puffer Finance 92', 'Liquid Restaking') + , (0x4e15b6331eadaa84750870e4e24b84780c88ff91, 'Puffer Finance', 'Puffer Finance 93', 'Liquid Restaking') + , (0x444595c69006f6ac6acbf55d362d3036f5b636aa, 'Puffer Finance', 'Puffer Finance 94', 'Liquid Restaking') + , (0xd44cf40b14249811a50dcb6dbd809e94e421929e, 'Puffer Finance', 'Puffer Finance 95', 'Liquid Restaking') + , (0x572c5dfcbbec6815978adf2a835a34e8f04156fb, 'Puffer Finance', 'Puffer Finance 96', 'Liquid Restaking') + , (0xfe41129f707591fda06bfa30df467351d09f1806, 'Puffer Finance', 'Puffer Finance 97', 'Liquid Restaking') + , (0x5cc1a39d0b448ece222a3e2891315b7d3c104d62, 'Puffer Finance', 'Puffer Finance 98', 'Liquid Restaking') + , (0xc360a5080719b3819531e6a9135d7062a9aa71a4, 'Puffer Finance', 'Puffer Finance 99', 'Liquid Restaking') + , (0xd96ffffb94f1484903c4022f128830f636c696ef, 'Puffer Finance', 'Puffer Finance 100', 'Liquid Restaking') + , (0x1d5b496c6992e6ebcf7a38a4097017fad76457a8, 'Puffer Finance', 'Puffer Finance 101', 'Liquid Restaking') + , (0x364942ade69dd27ec53092aece9b0604c1ec45ae, 'Puffer Finance', 'Puffer Finance 102', 'Liquid Restaking') + , (0x31710a5588cd7fadbf5002744ee433a3ec5bf75b, 'Puffer Finance', 'Puffer Finance 103', 'Liquid Restaking') + , (0x75408e3a95a0d4db54a11b171e591f706d991e7a, 'Puffer Finance', 'Puffer Finance 104', 'Liquid Restaking') + , (0xb25cfe029b6dcd87d5d9ae333e587b7a4873ce29, 'Puffer Finance', 'Puffer Finance 105', 'Liquid Restaking') + , (0xd338e780a5b900ac66d16c106f8babb47040e47b, 'Puffer Finance', 'Puffer Finance 106', 'Liquid Restaking') + , (0xdd86602cda86bfa8d26cadb8fdafccf325e35433, 'Puffer Finance', 'Puffer Finance 107', 'Liquid Restaking') + , (0x97f51ba27bdee65bb87ffe38e4a88c9c938272f7, 'Puffer Finance', 'Puffer Finance 108', 'Liquid Restaking') + , (0xe1e2cac176c707d83206d27b49ade82d94807212, 'Puffer Finance', 'Puffer Finance 109', 'Liquid Restaking') + , (0xdf8f9a7f1f8eb645dc3c95354d2c909c2fdaf0e3, 'Eigenpie', 'Eigenpie 1', 'Liquid Restaking') , (0x7ef5d450be41fcbc6191cb09789c5783da53f3fc, 'Copper.co', 'Copper.co', 'Staking Pool') , (0x44894aeee56c2dd589c1d5c8cb04b87576967f97, 'Upbit', 'Upbit 1', 'CEX') , (0xcf95237ce34d4b5bf1e7de4474ee1dcc01f24ca9, 'Upbit', 'Upbit 2', 'CEX') @@ -1560,5 +1670,33 @@ FROM , (0xb4c47c642ea41cb9ffce5f6c7a87bb6e3072b8a2, 'thedragon.eth', 'thedragon.eth', 'Solo Staker') , (0x2f4d0f57fdaaa562a4232ae3d812298fb470e810, 'momose.eth', 'momose.eth', 'Solo Staker') , (0x6dbd6a29aee4a273c5178dae7c48bc3d3deb1d7d, 'marioxnyc.eth', 'marioxnyc.eth', 'Solo Staker') + + , (0x005c382e661b2ebeeb8b87c132f6a7d722a4b864, 'Cluster 0x0f5b', 'Cluster 0x0f5b 1', NULL) + , (0x7e8eede00d0dce9a97673f143a4614a4a196eac5, 'Cluster 0x0f5b', 'Cluster 0x0f5b 2', NULL) + , (0xc372d454835ac654d43b99c7789cc1c32f364237, 'Cluster 0xc372', 'Cluster 0xc372 1', NULL) + , (0x71ca7a0253b28c93AaC910F9365A24d83af8c3B4, 'Cluster 0xc372', 'Cluster 0xc372 2', NULL) + , (0x995fc15a5dfcf41ed9c4534955e770f00cb7ff0f, 'Cluster 0xc372', 'Cluster 0xc372 3', NULL) + , (0x049e49c4d27b806c0b471495727e2c23de9273cd, 'Cluster 0xc372', 'Cluster 0xc372 4', NULL) + , (0xcb8e076163b03fed92b7a22dd7e39edfa31e1717, 'Cluster 0xc372', 'Cluster 0xc372 5', NULL) + , (0x265bc4ea57b5ab14b5c9b1f8bdbeea09707b4265, 'Cluster 0xc372', 'Cluster 0xc372 6', NULL) + , (0x275ff2628ec066a7d9d53b3af5d0f7813daaaf02, 'Cluster 0xc372', 'Cluster 0xc372 7', NULL) + , (0xb519f1d4e0cae24690b7320bae8f4ce7caaea8d7, 'Cluster 0xc372', 'Cluster 0xc372 8', NULL) + , (0xc9885f0f8163b2afc2247dd386f26ade8b6c6b45, 'Cluster 0xc372', 'Cluster 0xc372 9', NULL) + , (0x7e6609821961a169a62b43d6c2b83c24473dbc51, 'Cluster 0xc372', 'Cluster 0xc372 10', NULL) + , (0x7498702e4c26eefcf9a17d68bcf5ce2f7740ed80, 'Cluster 0xc372', 'Cluster 0xc372 11', NULL) + , (0xafe4c52fbe0d1d7dd690cd9298d889ba3f0c8761, 'Cluster 0xc372', 'Cluster 0xc372 12', NULL) + , (0x6E6c7B17A288F08b626E664F07c35294ef28489a, 'Cluster 0xc372', 'Cluster 0xc372 13', NULL) + , (0x03815b0efceec860a43e4e85f5bf8e2a4602606b, 'Cluster 0xc372', 'Cluster 0xc372 14', NULL) + , (0x82aac6595269ba312dcc306f3b67c4df710e214b, 'Cluster 0xc372', 'Cluster 0xc372 15', NULL) + , (0x84a379311768ac90fa299e956c144cab30bdcd17, 'Cluster 0xc372', 'Cluster 0xc372 15', NULL) + , (0xe5130785ee691e398d75f532d38736f431e92f9e, 'Cluster 0xc372', 'Cluster 0xc372 16', NULL) + , (0x5fa7dc7b49b931a6d588d54bb1d2d7b293eca0b5, 'Cluster 0xc372', 'Cluster 0xc372 17', NULL) + , (0x5b8c8d0e2eac1d8d640f7a28a528452523ea502b, 'Cluster 0xc372', 'Cluster 0xc372 18', NULL) + , (0x5b8f0834a70a5803f1059576e2c24965773b759c, 'Cluster 0xc372', 'Cluster 0xc372 19', NULL) + , (0x4b53c263b8925d9919e5cb5e8c4d3ceda86726c4, 'Cluster 0xc372', 'Cluster 0xc372 20', NULL) + , (0xc3467b8cf8224a63f4a21aa6900a9957a1a0b521, 'Cluster 0xc372', 'Cluster 0xc372 21', NULL) + , (0x2a10bdf67f462ab3f25801bb65e8bae26d504754, 'Cluster 0xc372', 'Cluster 0xc372 22', NULL) + , (0x681b67246b0d19e21ca065a90a94be3f01c6d4b1, 'Cluster 0xc372', 'Cluster 0xc372 23', NULL) + , (0x6be67d001066dcc10bb944faabd205e3f8de1f6b, 'Cluster 0xc372', 'Cluster 0xc372 24', NULL) ) x (depositor_address, entity, entity_unique_name, category) diff --git a/models/staking/ethereum/entities/staking_ethereum_entities_schema.yml b/models/staking/ethereum/entities/staking_ethereum_entities_schema.yml index 719684a870e..b057beb1b2f 100644 --- a/models/staking/ethereum/entities/staking_ethereum_entities_schema.yml +++ b/models/staking/ethereum/entities/staking_ethereum_entities_schema.yml @@ -26,7 +26,7 @@ models: description: "Category of entity" tests: - accepted_values: - values: ['CEX', 'Staking Pool', 'Liquid Staking', 'Liquid Restaking', 'Solo Staker', 'Batch Staking Contract', 'Others'] + values: ['CEX', 'Staking Pool', 'Liquid Staking', 'Liquid Restaking', 'Solo Staker', 'Batch Staking Contract', 'Others', NULL] - name: staking_ethereum_entities_coinbase meta: @@ -53,7 +53,7 @@ models: description: "Category of entity" tests: - accepted_values: - values: ['CEX', 'Staking Pool', 'Liquid Staking', 'Liquid Restaking', 'Solo Staker', 'Batch Staking Contract', 'Others'] + values: ['CEX', 'Staking Pool', 'Liquid Staking', 'Liquid Restaking', 'Solo Staker', 'Batch Staking Contract', 'Others', NULL] - name: staking_ethereum_entities_binance meta: @@ -80,7 +80,7 @@ models: description: "Category of entity" tests: - accepted_values: - values: ['CEX', 'Staking Pool', 'Liquid Staking', 'Liquid Restaking', 'Solo Staker', 'Batch Staking Contract', 'Others'] + values: ['CEX', 'Staking Pool', 'Liquid Staking', 'Liquid Restaking', 'Solo Staker', 'Batch Staking Contract', 'Others', NULL] - name: staking_ethereum_entities_bitcoin_suisse meta: @@ -107,7 +107,7 @@ models: description: "Category of entity" tests: - accepted_values: - values: ['CEX', 'Staking Pool', 'Liquid Staking', 'Liquid Restaking', 'Solo Staker', 'Batch Staking Contract', 'Others'] + values: ['CEX', 'Staking Pool', 'Liquid Staking', 'Liquid Restaking', 'Solo Staker', 'Batch Staking Contract', 'Others', NULL] - name: staking_ethereum_entities_batch_contracts_tx_from meta: @@ -134,7 +134,7 @@ models: description: "Category of entity" tests: - accepted_values: - values: ['CEX', 'Staking Pool', 'Liquid Staking', 'Liquid Restaking', 'Solo Staker', 'Batch Staking Contract', 'Others'] + values: ['CEX', 'Staking Pool', 'Liquid Staking', 'Liquid Restaking', 'Solo Staker', 'Batch Staking Contract', 'Others', NULL] - name: staking_ethereum_entities_batch_contracts_pubkey meta: @@ -161,7 +161,7 @@ models: description: "Category of entity" tests: - accepted_values: - values: ['CEX', 'Staking Pool', 'Liquid Staking', 'Liquid Restaking', 'Solo Staker', 'Batch Staking Contract', 'Others'] + values: ['CEX', 'Staking Pool', 'Liquid Staking', 'Liquid Restaking', 'Solo Staker', 'Batch Staking Contract', 'Others', NULL] - name: staking_ethereum_entities_withdrawal_credentials meta: @@ -188,7 +188,7 @@ models: description: "Category of entity" tests: - accepted_values: - values: ['CEX', 'Staking Pool', 'Liquid Staking', 'Liquid Restaking', 'Solo Staker', 'Batch Staking Contract', 'Others'] + values: ['CEX', 'Staking Pool', 'Liquid Staking', 'Liquid Restaking', 'Solo Staker', 'Batch Staking Contract', 'Others', NULL] - name: staking_ethereum_entities_depositor_addresses meta: @@ -215,7 +215,7 @@ models: description: "Category of entity" tests: - accepted_values: - values: ['CEX', 'Staking Pool', 'Liquid Staking', 'Liquid Restaking', 'Solo Staker', 'Batch Staking Contract', 'Others'] + values: ['CEX', 'Staking Pool', 'Liquid Staking', 'Liquid Restaking', 'Solo Staker', 'Batch Staking Contract', 'Others', NULL] - name: staking_ethereum_entities_tx_from_addresses meta: @@ -242,7 +242,7 @@ models: description: "Category of entity" tests: - accepted_values: - values: ['CEX', 'Staking Pool', 'Liquid Staking', 'Liquid Restaking', 'Solo Staker', 'Batch Staking Contract', 'Others'] + values: ['CEX', 'Staking Pool', 'Liquid Staking', 'Liquid Restaking', 'Solo Staker', 'Batch Staking Contract', 'Others', NULL] - name: staking_ethereum_entities_darma_capital meta: @@ -269,7 +269,7 @@ models: description: "Category of entity" tests: - accepted_values: - values: ['CEX', 'Staking Pool', 'Liquid Staking', 'Liquid Restaking', 'Solo Staker', 'Batch Staking Contract', 'Others'] + values: ['CEX', 'Staking Pool', 'Liquid Staking', 'Liquid Restaking', 'Solo Staker', 'Batch Staking Contract', 'Others', NULL] - name: staking_ethereum_entities_stakewise_v3 meta: @@ -296,7 +296,7 @@ models: description: "Category of entity" tests: - accepted_values: - values: ['CEX', 'Staking Pool', 'Liquid Staking', 'Liquid Restaking', 'Solo Staker', 'Batch Staking Contract', 'Others'] + values: ['CEX', 'Staking Pool', 'Liquid Staking', 'Liquid Restaking', 'Solo Staker', 'Batch Staking Contract', 'Others', NULL] - name: staking_ethereum_entities_chorusone meta: @@ -323,4 +323,4 @@ models: description: "Category of entity" tests: - accepted_values: - values: ['CEX', 'Staking Pool', 'Liquid Staking', 'Liquid Restaking', 'Solo Staker', 'Batch Staking Contract', 'Others'] \ No newline at end of file + values: ['CEX', 'Staking Pool', 'Liquid Staking', 'Liquid Restaking', 'Solo Staker', 'Batch Staking Contract', 'Others', NULL] \ No newline at end of file diff --git a/models/staking/ethereum/staking_ethereum_info.sql b/models/staking/ethereum/staking_ethereum_info.sql index 4ad8c7301f7..82d91f65fb3 100644 --- a/models/staking/ethereum/staking_ethereum_info.sql +++ b/models/staking/ethereum/staking_ethereum_info.sql @@ -130,4 +130,10 @@ FROM (VALUES , ('Galaxy Digital', 'GalaxyHQ') , ('Copper.co', 'CopperHQ') , ('Kelp DAO', 'KelpDAO') + , ('Puffer Finance', 'puffer_finance') + , ('Eigenpie', 'Eigenpiexyz_io') + + -- Unknown Clusters: + , ('Cluster 0x0f5b', 'etherscan.io/address/0x0f5b2f0d89f66b163e5e8e2ccf4de706c53a5060') + , ('Cluster 0xc372', 'etherscan.io/address/0xc372d454835ac654d43b99c7789cc1c32f364237') ) AS temp_table (entity, x_username) \ No newline at end of file diff --git a/models/staking/ethereum/staking_ethereum_schema.yml b/models/staking/ethereum/staking_ethereum_schema.yml index 5a9d4738634..d3eab2b7533 100644 --- a/models/staking/ethereum/staking_ethereum_schema.yml +++ b/models/staking/ethereum/staking_ethereum_schema.yml @@ -51,7 +51,7 @@ models: description: "Category of entity" tests: - accepted_values: - values: ['CEX', 'Staking Pool', 'Liquid Staking', 'Liquid Restaking', 'Solo Staker', 'Batch Staking Contract', 'Others'] + values: ['CEX', 'Staking Pool', 'Liquid Staking', 'Liquid Restaking', 'Solo Staker', 'Batch Staking Contract', 'Others', NULL] - name: sub_entity description: "Identified sub entity name" - name: sub_entity_unique_name @@ -60,7 +60,7 @@ models: description: "Category of sub entity" tests: - accepted_values: - values: ['CEX', 'Staking Pool', 'Liquid Staking', 'Liquid Restaking', 'Solo Staker', 'Batch Staking Contract', 'Others'] + values: ['CEX', 'Staking Pool', 'Liquid Staking', 'Liquid Restaking', 'Solo Staker', 'Batch Staking Contract', 'Others', NULL] - name: staking_ethereum_deposits meta: From b8b57255f0f900663466a826c8c4fae3c6af71c9 Mon Sep 17 00:00:00 2001 From: Alan Ghobadi Date: Fri, 7 Jun 2024 09:22:58 +0200 Subject: [PATCH 068/149] Don't materialize rolling (#6097) --- .../celo/erc20/transfers_celo_erc20_rolling_day.sql | 6 ------ .../celo/erc20/transfers_celo_erc20_rolling_hour.sql | 5 ----- 2 files changed, 11 deletions(-) diff --git a/models/transfers/celo/erc20/transfers_celo_erc20_rolling_day.sql b/models/transfers/celo/erc20/transfers_celo_erc20_rolling_day.sql index 6c155e0fa0a..9b995992cd1 100644 --- a/models/transfers/celo/erc20/transfers_celo_erc20_rolling_day.sql +++ b/models/transfers/celo/erc20/transfers_celo_erc20_rolling_day.sql @@ -2,12 +2,6 @@ config( alias = 'erc20_rolling_day', - partition_by = ['block_month'], - materialized = 'incremental', - file_format = 'delta', - incremental_strategy = 'merge', - incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.block_day')], - unique_key = ['wallet_address', 'token_address', 'block_day'], post_hook='{{ expose_spells(\'["celo"]\', "sector", "transfers", diff --git a/models/transfers/celo/erc20/transfers_celo_erc20_rolling_hour.sql b/models/transfers/celo/erc20/transfers_celo_erc20_rolling_hour.sql index 88ff7c0c44c..357d4a210a6 100644 --- a/models/transfers/celo/erc20/transfers_celo_erc20_rolling_hour.sql +++ b/models/transfers/celo/erc20/transfers_celo_erc20_rolling_hour.sql @@ -2,11 +2,6 @@ config( alias = 'erc20_rolling_hour', - partition_by = ['block_month'], - materialized = 'incremental', - file_format = 'delta', - incremental_strategy = 'merge',incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.block_hour')], - unique_key = ['wallet_address', 'token_address', 'block_hour'], post_hook='{{ expose_spells(\'["celo"]\', "sector", "transfers", From 4603bf5eb3e5915d1eb0a27423d94d55f029db7a Mon Sep 17 00:00:00 2001 From: Andrew <47720952+andrewhong5297@users.noreply.github.com> Date: Fri, 7 Jun 2024 05:43:59 -0700 Subject: [PATCH 069/149] Token 2022 fungible (add metadata model first (#6113) * 1 * 2 * add fees model * incremental * add sources * Fix comma --------- Co-authored-by: Alan Ghobadi --- .../tokens/solana/tokens_solana.sources.yml | 23 +++ .../solana/tokens_solana_fees_history.sql | 61 +++++++ .../tokens/solana/tokens_solana_fungible.sql | 158 +++++++++++++++--- models/tokens/solana/tokens_solana_schema.yml | 25 +++ 4 files changed, 240 insertions(+), 27 deletions(-) create mode 100644 models/tokens/solana/tokens_solana_fees_history.sql diff --git a/models/tokens/solana/tokens_solana.sources.yml b/models/tokens/solana/tokens_solana.sources.yml index 0636d8254fe..5a17103eee3 100644 --- a/models/tokens/solana/tokens_solana.sources.yml +++ b/models/tokens/solana/tokens_solana.sources.yml @@ -24,6 +24,29 @@ sources: - name: spl_token_call_burnChecked loaded_at_field: call_block_time + - name: spl_token_2022_solana + description: "spl_token 2022 decoded tables" + freshness: # default freshness + warn_after: { count: 12, period: hour } + error_after: { count: 24, period: hour } + tables: + - name: spl_token_2022_call_initializeMint + loaded_at_field: call_block_time + - name: spl_token_2022_call_initializeMint2 + loaded_at_field: call_block_time + - name: spl_token_2022_call_transferFeeExtension + loaded_at_field: call_block_time + - name: spl_token_2022_call_transferChecked + loaded_at_field: call_block_time + - name: spl_token_2022_call_mintTo + loaded_at_field: call_block_time + - name: spl_token_2022_call_mintToChecked + loaded_at_field: call_block_time + - name: spl_token_2022_call_burn + loaded_at_field: call_block_time + - name: spl_token_2022_call_burnChecked + loaded_at_field: call_block_time + - name: mpl_token_metadata_solana description: "mpl metadata decoded tables" freshness: # default freshness diff --git a/models/tokens/solana/tokens_solana_fees_history.sql b/models/tokens/solana/tokens_solana_fees_history.sql new file mode 100644 index 00000000000..0414ee66262 --- /dev/null +++ b/models/tokens/solana/tokens_solana_fees_history.sql @@ -0,0 +1,61 @@ + {{ + config( + schema = 'tokens_solana', + alias = 'fees_history', + materialized = 'incremental', + file_format = 'delta', + incremental_strategy = 'merge', + incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.fee_time')], + unique_key = ['account_mint','fee_time'], + post_hook='{{ expose_spells(\'["solana"]\', + "sector", + "tokens", + \'["ilemi"]\') }}') +}} + +--we need the fee basis points and maximum fee for token2022 transfers because the fee amount is not emitted in transferChecked +SELECT +call_account_arguments[1] as account_mint +, try(bytearray_to_uint256(bytearray_reverse(bytearray_substring(call_data, + 1+1+1+1+1+case when bytearray_substring(call_data,1+1+1,1) = 0x01 and bytearray_substring(call_data,1+1+1+32+1,1) = 0x01 + then 64 + when bytearray_substring(call_data,1+1+1,1) = 0x01 and bytearray_substring(call_data,1+1+1+32+1,1) = 0x00 + then 32 + when bytearray_substring(call_data,1+1+1,1) = 0x00 and bytearray_substring(call_data,1+1+1+1,1) = 0x01 + then 32 + when bytearray_substring(call_data,1+1+1,1) = 0x00 and bytearray_substring(call_data,1+1+1+1,1) = 0x00 + then 0 + end --variations of COPTION enums for first two arguments + ,2)))) as fee_basis +, try(bytearray_to_uint256(bytearray_reverse(bytearray_substring(call_data, + 1+1+1+1+1+case when bytearray_substring(call_data,1+1+1,1) = 0x01 and bytearray_substring(call_data,1+1+1+32+1,1) = 0x01 + then 64 + when bytearray_substring(call_data,1+1+1,1) = 0x01 and bytearray_substring(call_data,1+1+1+32+1,1) = 0x00 + then 32 + when bytearray_substring(call_data,1+1+1,1) = 0x00 and bytearray_substring(call_data,1+1+1+1,1) = 0x01 + then 32 + when bytearray_substring(call_data,1+1+1,1) = 0x00 and bytearray_substring(call_data,1+1+1+1,1) = 0x00 + then 0 + end + +2 + ,16)))) as fee_maximum +, call_block_time as fee_time +FROM {{ source('spl_token_2022_solana','spl_token_2022_call_transferFeeExtension') }} +WHERE bytearray_substring(call_data,1+1,1) = 0x00 --https://github.com/solana-labs/solana-program-library/blob/8f50c6fabc6ec87ada229e923030381f573e0aed/token/program-2022/src/extension/transfer_fee/instruction.rs#L38 +{% if is_incremental() %} +AND {{incremental_predicate('call_block_time')}} +{% endif %} + +UNION ALL +SELECT +call_account_arguments[1] as account_mint +, try(bytearray_to_uint256(bytearray_reverse(bytearray_substring(call_data, + 1+1+1,2)))) as fee_basis +, try(bytearray_to_uint256(bytearray_reverse(bytearray_substring(call_data, + 1+1+1+2,16)))) as fee_maximum +, call_block_time as fee_time +FROM {{ source('spl_token_2022_solana','spl_token_2022_call_transferFeeExtension') }} +WHERE bytearray_substring(call_data,1+1,1) = 0x05 --https://github.com/solana-labs/solana-program-library/blob/8f50c6fabc6ec87ada229e923030381f573e0aed/token/program-2022/src/extension/transfer_fee/instruction.rs#L147 +{% if is_incremental() %} +AND {{incremental_predicate('call_block_time')}} +{% endif %} \ No newline at end of file diff --git a/models/tokens/solana/tokens_solana_fungible.sql b/models/tokens/solana/tokens_solana_fungible.sql index 5f26d007d6c..6a66471188c 100644 --- a/models/tokens/solana/tokens_solana_fungible.sql +++ b/models/tokens/solana/tokens_solana_fungible.sql @@ -1,7 +1,7 @@ {{ config ( alias = 'fungible', - + post_hook='{{ expose_spells(\'["solana"]\', "sector", "tokens", @@ -10,26 +10,32 @@ }} -with +with tokens as ( SELECT bytearray_to_bigint(bytearray_reverse(bytearray_substring(call_data, 2, 1))) as decimals , call_data , account_mint + , token_version , call_tx_id , call_block_time + , row_number() over (partition by account_mint order by call_block_time desc) as latest FROM ( - SELECT call_data, account_mint, call_tx_id, call_block_time FROM {{ source('spl_token_solana', 'spl_token_call_initializeMint') }} - UNION ALL - SELECT call_data, account_mint, call_tx_id, call_block_time FROM {{ source('spl_token_solana', 'spl_token_call_initializeMint2') }} + SELECT call_data, account_mint, call_tx_id, call_block_time, 'spl_token' as token_version FROM {{ source('spl_token_solana', 'spl_token_call_initializeMint') }} + UNION ALL + SELECT call_data, account_mint, call_tx_id, call_block_time, 'spl_token' as token_version FROM {{ source('spl_token_solana', 'spl_token_call_initializeMint2') }} + UNION ALL + SELECT call_data, account_mint, call_tx_id, call_block_time, 'token2022' as token_version FROM {{ source('spl_token_2022_solana', 'spl_token_2022_call_initializeMint') }} + UNION ALL + SELECT call_data, account_mint, call_tx_id, call_block_time, 'token2022' as token_version FROM {{ source('spl_token_2022_solana', 'spl_token_2022_call_initializeMint2') }} ) {% if is_incremental() %} - where call_block_time >= date_trunc('day', now() - interval '7' day) + where {{ incremental_predicate('call_block_time') }} {% endif %} ) - + , metadata as ( - SELECT + SELECT meta.call_tx_id , meta.call_block_slot , meta.call_block_time @@ -38,8 +44,10 @@ with , meta.account_mint , meta.call_block_time , master.account_edition as master_edition + , metadata_program + , row_number() over (partition by meta.account_mint order by meta.call_block_time desc) as latest FROM ( - SELECT + SELECT call_tx_id , call_outer_instruction_index , call_inner_instruction_index @@ -48,9 +56,10 @@ with , json_query(createMetadataAccountArgs, 'lax $.CreateMetadataAccountArgs.data.Data') as args , account_metadata , account_mint + , call_executing_account as metadata_program FROM {{ source('mpl_token_metadata_solana', 'mpl_token_metadata_call_CreateMetadataAccount') }} - UNION ALL - SELECT + UNION ALL + SELECT call_tx_id , call_outer_instruction_index , call_inner_instruction_index @@ -59,51 +68,143 @@ with , json_query(createMetadataAccountArgsV2, 'lax $.CreateMetadataAccountArgsV2.data.DataV2') as args , account_metadata , account_mint + , call_executing_account as metadata_program FROM {{ source('mpl_token_metadata_solana', 'mpl_token_metadata_call_CreateMetadataAccountV2') }} - UNION ALL - SELECT + UNION ALL + SELECT call_tx_id , call_outer_instruction_index - , call_inner_instruction_index + , call_inner_instruction_index , call_block_slot , call_block_time , json_query(createMetadataAccountArgsV3, 'lax $.CreateMetadataAccountArgsV3.data.DataV2') as args , account_metadata , account_mint - FROM {{ source('mpl_token_metadata_solana', 'mpl_token_metadata_call_CreateMetadataAccountV3') }} - ) meta + , call_executing_account as metadata_program + FROM {{ source('mpl_token_metadata_solana', 'mpl_token_metadata_call_CreateMetadataAccountV3') }} + ) meta LEFT JOIN ( - SELECT account_mintAuthority, account_edition, account_metadata FROM {{ source('mpl_token_metadata_solana', 'mpl_token_metadata_call_CreateMasterEdition') }} + SELECT account_mintAuthority, account_edition, account_metadata FROM {{ source('mpl_token_metadata_solana', 'mpl_token_metadata_call_CreateMasterEdition') }} UNION ALL SELECT account_mintAuthority, account_edition, account_metadata FROM {{ source('mpl_token_metadata_solana', 'mpl_token_metadata_call_CreateMasterEditionV3') }} ) master ON master.account_metadata = meta.account_metadata {% if is_incremental() %} - WHERE meta.call_block_time >= date_trunc('day', now() - interval '7' day) + WHERE {{ incremental_predicate('meta.call_block_time') }} + {% endif %} + ) + + , token2022_metadata as ( + --token2022 direct metadata extension + SELECT + from_utf8(bytearray_substring(data,1+8+4,bytearray_to_bigint(bytearray_reverse(bytearray_substring(data,1+8,4))))) as name + , from_utf8(bytearray_substring(data,1+8+4+bytearray_to_bigint(bytearray_reverse(bytearray_substring(data,1+8,4))) + 4 --start from end of name and end of length of symbol + , bytearray_to_bigint(bytearray_reverse(bytearray_substring(data,1+8+4+bytearray_to_bigint(bytearray_reverse(bytearray_substring(data,1+8,4))),4))) --get length of symbol from end of name + )) as symbol + , from_utf8(bytearray_substring(data,1+8+4+bytearray_to_bigint(bytearray_reverse(bytearray_substring(data,1+8,4))) + 4 --end of name and end of length of symbol + + bytearray_to_bigint(bytearray_reverse(bytearray_substring(data,1+8+4+bytearray_to_bigint(bytearray_reverse(bytearray_substring(data,1+8,4))),4))) + 4 --start from end of symbol and end of length of uri + , bytearray_to_bigint(bytearray_reverse(bytearray_substring(data,1+8+4+bytearray_to_bigint(bytearray_reverse(bytearray_substring(data,1+8,4))) + 4 + + bytearray_to_bigint(bytearray_reverse(bytearray_substring(data,1+8+4+bytearray_to_bigint(bytearray_reverse(bytearray_substring(data,1+8,4))),4))),4))) --get length of uri from end of symbol + )) as uri + , tx_id as metadata_tx + , account_arguments[3] as account_mint + , block_time + , executing_account as metadata_program + , row_number() over (partition by account_arguments[3] order by block_time desc) as latest + FROM {{ source('solana','instruction_calls') }} + WHERE executing_account = 'TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb' + AND bytearray_substring(data,1,1) = 0xd2 --deal with updateField later 0xdd + AND tx_success + {% if is_incremental() %} + AND {{ incremental_predicate('block_time') }} + {% endif %} + ) + + , token_metadata_other as ( + --some other metadata program (idk the owner) + SELECT + from_utf8(bytearray_substring(data,1+1+4,bytearray_to_bigint(bytearray_reverse(bytearray_substring(data,1+1,4))))) as name + , from_utf8(bytearray_substring(data,1+1+4+bytearray_to_bigint(bytearray_reverse(bytearray_substring(data,1+1,4))) + 4 --start from end of name and end of length of symbol + , bytearray_to_bigint(bytearray_reverse(bytearray_substring(data,1+1+4+bytearray_to_bigint(bytearray_reverse(bytearray_substring(data,1+1,4))),4))) --get length of symbol from end of name + )) as symbol + , from_utf8(bytearray_substring(data,1+1+4+bytearray_to_bigint(bytearray_reverse(bytearray_substring(data,1+1,4))) + 4 --end of name and end of length of symbol + + bytearray_to_bigint(bytearray_reverse(bytearray_substring(data,1+1+4+bytearray_to_bigint(bytearray_reverse(bytearray_substring(data,1+1,4))),4))) + 4 --start from end of symbol and end of length of uri + , bytearray_to_bigint(bytearray_reverse(bytearray_substring(data,1+1+4+bytearray_to_bigint(bytearray_reverse(bytearray_substring(data,1+1,4))) + 4 + + bytearray_to_bigint(bytearray_reverse(bytearray_substring(data,1+1+4+bytearray_to_bigint(bytearray_reverse(bytearray_substring(data,1+1,4))),4))),4))) --get length of uri from end of symbol + )) as uri + , tx_id as metadata_tx + , account_arguments[2] as account_mint + , block_time + , executing_account as metadata_program + , row_number() over (partition by account_arguments[2] order by block_time desc) as latest + FROM {{ source('solana','instruction_calls') }} + WHERE executing_account = 'META4s4fSmpkTbZoUsgC1oBnWB31vQcmnN8giPw51Zu' + AND bytearray_substring(data,1,1) = 0x21 + AND tx_success + {% if is_incremental() %} + AND {{ incremental_predicate('block_time') }} {% endif %} ) SELECT tk.account_mint as token_mint_address , tk.decimals - , trim(json_value(args, 'strict $.name'))as name - , trim(json_value(args, 'strict $.symbol')) as symbol - , trim(json_value(args, 'strict $.uri')) as token_uri + , coalesce(m22.name,mo.name,trim(json_value(args, 'strict $.name'))) as name + , coalesce(m22.symbol,mo.symbol,trim(json_value(args, 'strict $.symbol'))) as symbol + , coalesce(m22.uri,mo.uri,trim(json_value(args, 'strict $.uri'))) as token_uri , tk.call_block_time as created_at + , coalesce(m22.metadata_program,mo.metadata_program,m.metadata_program) as metadata_program + , tk.token_version + , tk.call_tx_id as init_tx FROM tokens tk -LEFT JOIN metadata m ON tk.account_mint = m.account_mint +LEFT JOIN token2022_metadata m22 ON tk.account_mint = m22.account_mint AND m22.latest = 1 +LEFT JOIN token_metadata_other mo ON tk.account_mint = mo.account_mint AND mo.latest = 1 +LEFT JOIN metadata m ON tk.account_mint = m.account_mint AND m.latest = 1 WHERE m.master_edition is null +AND tk.latest = 1 + +UNION ALL + +--token2022 wrapped sol https://solscan.io/tx/2L1o7sDMCMJ6PYqfNrnY6ozJC1DEx61pRYiLdfCCggxw81naQXsmHKDLn6EhJXmDmDSQ2eCKjUMjZAQuUsyNnYUv +SELECT + trim(token_mint_address) as token_mint_address + , decimals + , trim(name) as name + , trim(symbol) as symbol + , token_uri + , cast(created_at as timestamp) created_at + , metadata_program + , token_version + , init_tx +FROM +( + VALUES +( + '9pan9bMn5HatX4EJdBwg9VgCa7Uz5HL8N1m5D3NdXejP', + 9, + 'wrapped SOL', + 'SOL', + null, + '2023-08-02 00:00:00', + null, + 'token2022', + '2L1o7sDMCMJ6PYqfNrnY6ozJC1DEx61pRYiLdfCCggxw81naQXsmHKDLn6EhJXmDmDSQ2eCKjUMjZAQuUsyNnYUv' +) +) AS temp_table (token_mint_address, decimals, name, symbol, token_uri, created_at, metadata_program, token_version, init_tx) UNION ALL ---wrapped sol is special and doesn't have a init tx (that I can find) -SELECT +--old wrapped sol is special and doesn't have a init tx (that I can find) +SELECT trim(token_mint_address) as token_mint_address , decimals , trim(name) as name , trim(symbol) as symbol , token_uri , cast(created_at as timestamp) created_at -FROM + , metadata_program + , token_version + , init_tx +FROM ( VALUES ( @@ -112,6 +213,9 @@ FROM 'wrapped SOL', 'SOL', null, - '2021-01-31 00:00:00' + '2021-01-31 00:00:00', + null, + 'spl_token', + null ) -) AS temp_table (token_mint_address, decimals, name, symbol, token_uri, created_at) +) AS temp_table (token_mint_address, decimals, name, symbol, token_uri, created_at, metadata_program, token_version, init_tx) diff --git a/models/tokens/solana/tokens_solana_schema.yml b/models/tokens/solana/tokens_solana_schema.yml index ab3b17f52e5..4a6bd1a599e 100644 --- a/models/tokens/solana/tokens_solana_schema.yml +++ b/models/tokens/solana/tokens_solana_schema.yml @@ -19,8 +19,33 @@ models: description: "token symbol" - name: decimals description: "Number of decimals, refers to how divisible a token can be" + - name: metadata_program + description: program used for creating token metadata + - name: token_version + description: version of the token program used (spl_token, token2022) - name: created_at description: token mint created at + - name: init_tx + description: "transaction that initialized the mint" + + - name: tokens_solana_fees_history + meta: + blockchain: solana + sector: tokens + project: fees + contributors: ilemi + config: + tags: ['table', 'metadata', 'fess', 'solana'] + description: "fee updates on token2022 tokens" + columns: + - name: account_mint + description: "fungible token mint address on Solana" + - name: fee_basis + description: basis points fee on transfers + - name: fee_maximum + description: maximum fee amount on a given transfer + - name: fee_time + description: fee update time - name: tokens_solana_nft meta: From d706940ee72bcc562f8ec09de354f72aac48f3e0 Mon Sep 17 00:00:00 2001 From: Alan Ghobadi Date: Mon, 10 Jun 2024 10:18:36 +0200 Subject: [PATCH 070/149] Exclude failing model (#6120) --- .../_sector/depin/polygon/platforms/geodnet_polygon_revenue.sql | 1 + 1 file changed, 1 insertion(+) diff --git a/models/_sector/depin/polygon/platforms/geodnet_polygon_revenue.sql b/models/_sector/depin/polygon/platforms/geodnet_polygon_revenue.sql index 40bc535abfd..54039ad513c 100644 --- a/models/_sector/depin/polygon/platforms/geodnet_polygon_revenue.sql +++ b/models/_sector/depin/polygon/platforms/geodnet_polygon_revenue.sql @@ -1,6 +1,7 @@ {{ config( schema = 'geodnet_polygon' , alias = 'revenue' + , tags=['prod_exclude'] , materialized = 'incremental' , file_format = 'delta' , incremental_strategy = 'merge' From 4e7b0c768e42a49edcb1693bd1c7169130393723 Mon Sep 17 00:00:00 2001 From: Alan Ghobadi Date: Mon, 10 Jun 2024 11:26:25 +0200 Subject: [PATCH 071/149] Lfinity performance: switch to inner joins (#6103) * Switch to inner joins * Change to LEFT join for tokens since it's daily * inner join token accounts on lifinity_v1 trades --- models/lifinity/lifinity_v1_trades.sql | 48 ++++++++++++------------- models/lifinity/lifinity_v2_trades.sql | 50 +++++++++++++------------- 2 files changed, 49 insertions(+), 49 deletions(-) diff --git a/models/lifinity/lifinity_v1_trades.sql b/models/lifinity/lifinity_v1_trades.sql index d37731fa30b..2332c86a102 100644 --- a/models/lifinity/lifinity_v1_trades.sql +++ b/models/lifinity/lifinity_v1_trades.sql @@ -1,6 +1,6 @@ {{ config( - + schema = 'lifinity_v1', alias = 'trades', partition_by = ['block_month'], @@ -22,7 +22,7 @@ WITH pools as ( -- we can get fees after they give us the right IDL for initializing the pool and updating configs -- https://solscan.io/tx/DNXYzbhFnY9PwT4iwXNMpQq42kafcPaxSSgxsZ6XFLACvVNfpEfbJHG6VjPKevnH3aT4nwqPy4WFmQu4Y4NrY3e - SELECT + SELECT tkA.symbol as tokenA_symbol , tkA.decimals as tokenA_decimals , mintA.token_mint_address as tokenA @@ -36,8 +36,8 @@ WITH , ip.account_arguments[3] as pool_mint_id , ip.tx_id as init_tx FROM {{ source('solana','instruction_calls') }} ip - LEFT JOIN {{ ref('solana_utils_token_accounts') }} mintA ON mintA.address = ip.account_arguments[4] - LEFT JOIN {{ ref('solana_utils_token_accounts') }} mintB ON mintB.address = ip.account_arguments[5] + INNER JOIN {{ ref('solana_utils_token_accounts') }} mintA ON mintA.address = ip.account_arguments[4] + INNER JOIN {{ ref('solana_utils_token_accounts') }} mintB ON mintB.address = ip.account_arguments[5] LEFT JOIN {{ ref('tokens_solana_fungible') }} tkA ON tkA.token_mint_address = mintA.token_mint_address LEFT JOIN {{ ref('tokens_solana_fungible') }} tkB ON tkB.token_mint_address = mintB.token_mint_address WHERE bytearray_substring(ip.data,1,8) = 0xafaf6d1f0d989bed @@ -46,9 +46,9 @@ WITH and cardinality(account_arguments) >= 5 --filter out broken cases/inits for now and block_time > TIMESTAMP '{{project_start_date}}' ) - + , all_swaps as ( - SELECT + SELECT sp.call_block_time as block_time , 'lifinity' as project , 1 as version @@ -60,9 +60,9 @@ WITH when lower(tokenA_symbol) > lower(tokenB_symbol) then concat(tokenB_symbol, '-', tokenA_symbol) else concat(tokenA_symbol, '-', tokenB_symbol) end as token_pair - , case when tk_1.token_mint_address = p.tokenA then COALESCE(tokenB_symbol, tokenB) + , case when tk_1.token_mint_address = p.tokenA then COALESCE(tokenB_symbol, tokenB) else COALESCE(tokenA_symbol, tokenA) - end as token_bought_symbol + end as token_bought_symbol -- token bought is always the second instruction (transfer) in the inner instructions , tr_2.amount as token_bought_amount_raw , tr_2.amount/pow(10,COALESCE(case when tk_1.token_mint_address = p.tokenA then p.tokenB_decimals else tokenA_decimals end,9)) as token_bought_amount @@ -80,26 +80,26 @@ WITH , case when tk_1.token_mint_address = p.tokenA then p.tokenB else p.tokenA end as token_bought_mint_address - , case when tk_1.token_mint_address = p.tokenA then p.tokenA + , case when tk_1.token_mint_address = p.tokenA then p.tokenA else p.tokenB end as token_sold_mint_address , case when tk_1.token_mint_address = p.tokenA then p.tokenBVault else p.tokenAVault end as token_bought_vault - , case when tk_1.token_mint_address = p.tokenA then p.tokenAVault + , case when tk_1.token_mint_address = p.tokenA then p.tokenAVault else p.tokenBVault end as token_sold_vault --swap out can be either 2nd or 3rd transfer, we need to filter for the first transfer out. , tr_2.call_inner_instruction_index as transfer_out_index - , row_number() over (partition by sp.call_tx_id, sp.call_outer_instruction_index, sp.call_inner_instruction_index + , row_number() over (partition by sp.call_tx_id, sp.call_outer_instruction_index, sp.call_inner_instruction_index order by COALESCE(tr_2.call_inner_instruction_index, 0) asc) as first_transfer_out FROM {{ source('lifinity_amm_solana', 'lifinity_amm_call_swap') }} sp INNER JOIN pools p ON sp.account_amm = p.pool_id --account 2 - INNER JOIN {{ source('spl_token_solana', 'spl_token_call_transfer') }} tr_1 - ON tr_1.call_tx_id = sp.call_tx_id - AND tr_1.call_outer_instruction_index = sp.call_outer_instruction_index - AND ((sp.call_is_inner = false AND tr_1.call_inner_instruction_index = 1) + INNER JOIN {{ source('spl_token_solana', 'spl_token_call_transfer') }} tr_1 + ON tr_1.call_tx_id = sp.call_tx_id + AND tr_1.call_outer_instruction_index = sp.call_outer_instruction_index + AND ((sp.call_is_inner = false AND tr_1.call_inner_instruction_index = 1) OR (sp.call_is_inner = true AND tr_1.call_inner_instruction_index = sp.call_inner_instruction_index + 1)) {% if is_incremental() %} AND {{incremental_predicate('tr_1.call_block_time')}} @@ -107,9 +107,9 @@ WITH AND tr_1.call_block_time >= TIMESTAMP '{{project_start_date}}' {% endif %} --swap out can be either 2nd or 3rd transfer. - INNER JOIN {{ source('spl_token_solana', 'spl_token_call_transfer') }} tr_2 - ON tr_2.call_tx_id = sp.call_tx_id - AND tr_2.call_outer_instruction_index = sp.call_outer_instruction_index + INNER JOIN {{ source('spl_token_solana', 'spl_token_call_transfer') }} tr_2 + ON tr_2.call_tx_id = sp.call_tx_id + AND tr_2.call_outer_instruction_index = sp.call_outer_instruction_index AND ((sp.call_is_inner = false AND (tr_2.call_inner_instruction_index = 2 OR tr_2.call_inner_instruction_index = 3)) OR (sp.call_is_inner = true AND (tr_2.call_inner_instruction_index = sp.call_inner_instruction_index + 2 OR tr_2.call_inner_instruction_index = sp.call_inner_instruction_index + 3)) ) @@ -127,10 +127,10 @@ WITH AND sp.call_block_time >= TIMESTAMP '{{project_start_date}}' {% endif %} ) - + SELECT tb.blockchain - , tb.project + , tb.project , tb.version , CAST(date_trunc('month', tb.block_time) AS DATE) as block_month , tb.block_time @@ -156,16 +156,16 @@ SELECT , tb.inner_instruction_index , tb.tx_index FROM all_swaps tb -LEFT JOIN {{ source('prices', 'usd') }} p_bought ON p_bought.blockchain = 'solana' - AND date_trunc('minute', tb.block_time) = p_bought.minute +LEFT JOIN {{ source('prices', 'usd') }} p_bought ON p_bought.blockchain = 'solana' + AND date_trunc('minute', tb.block_time) = p_bought.minute AND token_bought_mint_address = toBase58(p_bought.contract_address) {% if is_incremental() %} AND {{incremental_predicate('p_bought.minute')}} {% else %} AND p_bought.minute >= TIMESTAMP '{{project_start_date}}' {% endif %} -LEFT JOIN {{ source('prices', 'usd') }} p_sold ON p_sold.blockchain = 'solana' - AND date_trunc('minute', tb.block_time) = p_sold.minute +LEFT JOIN {{ source('prices', 'usd') }} p_sold ON p_sold.blockchain = 'solana' + AND date_trunc('minute', tb.block_time) = p_sold.minute AND token_sold_mint_address = toBase58(p_sold.contract_address) {% if is_incremental() %} AND {{incremental_predicate('p_sold.minute')}} diff --git a/models/lifinity/lifinity_v2_trades.sql b/models/lifinity/lifinity_v2_trades.sql index 14cf9b83fe0..b2fa65b9eba 100644 --- a/models/lifinity/lifinity_v2_trades.sql +++ b/models/lifinity/lifinity_v2_trades.sql @@ -1,6 +1,6 @@ {{ config( - + schema = 'lifinity_v2', alias = 'trades', partition_by = ['block_month'], @@ -18,11 +18,11 @@ {% set project_start_date = '2022-09-13' %} --grabbed program deployed at time (account created at) -WITH +WITH pools as ( -- we can get fees after they give us the right IDL for initializing the pool and updating configs -- https://solscan.io/tx/DNXYzbhFnY9PwT4iwXNMpQq42kafcPaxSSgxsZ6XFLACvVNfpEfbJHG6VjPKevnH3aT4nwqPy4WFmQu4Y4NrY3e - SELECT + SELECT tkA.symbol as tokenA_symbol , tkA.decimals as tokenA_decimals , mintA.token_mint_address as tokenA @@ -36,8 +36,8 @@ WITH , ip.account_arguments[3] as pool_mint_id , ip.tx_id as init_tx FROM {{ source('solana','instruction_calls') }} ip - LEFT JOIN {{ ref('solana_utils_token_accounts') }} mintA ON mintA.address = ip.account_arguments[4] - LEFT JOIN {{ ref('solana_utils_token_accounts') }} mintB ON mintB.address = ip.account_arguments[5] + INNER JOIN {{ ref('solana_utils_token_accounts') }} mintA ON mintA.address = ip.account_arguments[4] + INNER JOIN {{ ref('solana_utils_token_accounts') }} mintB ON mintB.address = ip.account_arguments[5] LEFT JOIN {{ ref('tokens_solana_fungible') }} tkA ON tkA.token_mint_address = mintA.token_mint_address LEFT JOIN {{ ref('tokens_solana_fungible') }} tkB ON tkB.token_mint_address = mintB.token_mint_address WHERE bytearray_substring(ip.data,1,8) = 0xafaf6d1f0d989bed @@ -46,9 +46,9 @@ WITH and cardinality(account_arguments) >= 5 --filter out broken cases/inits for now and block_time > TIMESTAMP '{{project_start_date}}' ) - + , all_swaps as ( - SELECT + SELECT sp.call_block_time as block_time , 'lifinity' as project , 2 as version @@ -60,9 +60,9 @@ WITH when lower(tokenA_symbol) > lower(tokenB_symbol) then concat(tokenB_symbol, '-', tokenA_symbol) else concat(tokenA_symbol, '-', tokenB_symbol) end as token_pair - , case when tk_1.token_mint_address = p.tokenA then COALESCE(tokenB_symbol, tokenB) + , case when tk_1.token_mint_address = p.tokenA then COALESCE(tokenB_symbol, tokenB) else COALESCE(tokenA_symbol, tokenA) - end as token_bought_symbol + end as token_bought_symbol -- token bought is always the second instruction (transfer) in the inner instructions , tr_2.amount as token_bought_amount_raw , tr_2.amount/pow(10,COALESCE(case when tk_1.token_mint_address = p.tokenA then p.tokenB_decimals else tokenA_decimals end,9)) as token_bought_amount @@ -80,26 +80,26 @@ WITH , case when tk_1.token_mint_address = p.tokenA then p.tokenB else p.tokenA end as token_bought_mint_address - , case when tk_1.token_mint_address = p.tokenA then p.tokenA + , case when tk_1.token_mint_address = p.tokenA then p.tokenA else p.tokenB end as token_sold_mint_address , case when tk_1.token_mint_address = p.tokenA then p.tokenBVault else p.tokenAVault end as token_bought_vault - , case when tk_1.token_mint_address = p.tokenA then p.tokenAVault + , case when tk_1.token_mint_address = p.tokenA then p.tokenAVault else p.tokenBVault end as token_sold_vault --swap out can be either 2nd or 3rd transfer, we need to filter for the first transfer out. , tr_2.call_inner_instruction_index as transfer_out_index - , row_number() over (partition by sp.call_tx_id, sp.call_outer_instruction_index, sp.call_inner_instruction_index + , row_number() over (partition by sp.call_tx_id, sp.call_outer_instruction_index, sp.call_inner_instruction_index order by COALESCE(tr_2.call_inner_instruction_index, 0) asc) as first_transfer_out FROM {{ source('lifinity_amm_v2_solana', 'lifinity_amm_v2_call_swap') }} sp INNER JOIN pools p ON sp.account_amm = p.pool_id --account 2 - INNER JOIN {{ source('spl_token_solana', 'spl_token_call_transfer') }} tr_1 - ON tr_1.call_tx_id = sp.call_tx_id - AND tr_1.call_outer_instruction_index = sp.call_outer_instruction_index - AND ((sp.call_is_inner = false AND tr_1.call_inner_instruction_index = 1) + INNER JOIN {{ source('spl_token_solana', 'spl_token_call_transfer') }} tr_1 + ON tr_1.call_tx_id = sp.call_tx_id + AND tr_1.call_outer_instruction_index = sp.call_outer_instruction_index + AND ((sp.call_is_inner = false AND tr_1.call_inner_instruction_index = 1) OR (sp.call_is_inner = true AND tr_1.call_inner_instruction_index = sp.call_inner_instruction_index + 1)) {% if is_incremental() %} AND {{incremental_predicate('tr_1.call_block_time')}} @@ -107,9 +107,9 @@ WITH AND tr_1.call_block_time >= TIMESTAMP '{{project_start_date}}' {% endif %} --swap out can be either 2nd or 3rd transfer. - INNER JOIN {{ source('spl_token_solana', 'spl_token_call_transfer') }} tr_2 - ON tr_2.call_tx_id = sp.call_tx_id - AND tr_2.call_outer_instruction_index = sp.call_outer_instruction_index + INNER JOIN {{ source('spl_token_solana', 'spl_token_call_transfer') }} tr_2 + ON tr_2.call_tx_id = sp.call_tx_id + AND tr_2.call_outer_instruction_index = sp.call_outer_instruction_index AND ((sp.call_is_inner = false AND (tr_2.call_inner_instruction_index = 2 OR tr_2.call_inner_instruction_index = 3)) OR (sp.call_is_inner = true AND (tr_2.call_inner_instruction_index = sp.call_inner_instruction_index + 2 OR tr_2.call_inner_instruction_index = sp.call_inner_instruction_index + 3)) ) @@ -127,10 +127,10 @@ WITH AND sp.call_block_time >= TIMESTAMP '{{project_start_date}}' {% endif %} ) - + SELECT tb.blockchain - , tb.project + , tb.project , tb.version , CAST(date_trunc('month', tb.block_time) AS DATE) as block_month , tb.block_time @@ -156,16 +156,16 @@ SELECT , tb.inner_instruction_index , tb.tx_index FROM all_swaps tb -LEFT JOIN {{ source('prices', 'usd') }} p_bought ON p_bought.blockchain = 'solana' - AND date_trunc('minute', tb.block_time) = p_bought.minute +LEFT JOIN {{ source('prices', 'usd') }} p_bought ON p_bought.blockchain = 'solana' + AND date_trunc('minute', tb.block_time) = p_bought.minute AND token_bought_mint_address = toBase58(p_bought.contract_address) {% if is_incremental() %} AND {{incremental_predicate('p_bought.minute')}} {% else %} AND p_bought.minute >= TIMESTAMP '{{project_start_date}}' {% endif %} -LEFT JOIN {{ source('prices', 'usd') }} p_sold ON p_sold.blockchain = 'solana' - AND date_trunc('minute', tb.block_time) = p_sold.minute +LEFT JOIN {{ source('prices', 'usd') }} p_sold ON p_sold.blockchain = 'solana' + AND date_trunc('minute', tb.block_time) = p_sold.minute AND token_sold_mint_address = toBase58(p_sold.contract_address) {% if is_incremental() %} AND {{incremental_predicate('p_sold.minute')}} From d06e7c7ef1ac4c12f47fad2d14846f30f4fb54c3 Mon Sep 17 00:00:00 2001 From: jeff-dude <102681548+jeff-dude@users.noreply.github.com> Date: Mon, 10 Jun 2024 07:57:56 -0400 Subject: [PATCH 072/149] add back changes for solana token 2022 (#6107) * add back changes for solana * moving * removing * removing * sources removed * Fix name * Update tokens_solana_transfers.sql * Try splitting up * Fxi typo * fix union * typeing * Try another split * Fix typo * Use correct path --------- Co-authored-by: Andrew <47720952+andrewhong5297@users.noreply.github.com> Co-authored-by: Alan Ghobadi --- models/tokens/solana/tokens_solana_schema.yml | 5 +- .../solana/tokens_solana_spl_transfers.sql | 131 ++++++++++++++++ ...ens_solana_spl_transfers_call_transfer.sql | 33 ++++ .../tokens_solana_token22_spl_transfers.sql | 145 ++++++++++++++++++ .../tokens/solana/tokens_solana_transfers.sql | 97 +++++++----- 5 files changed, 368 insertions(+), 43 deletions(-) create mode 100644 models/tokens/solana/tokens_solana_spl_transfers.sql create mode 100644 models/tokens/solana/tokens_solana_spl_transfers_call_transfer.sql create mode 100644 models/tokens/solana/tokens_solana_token22_spl_transfers.sql diff --git a/models/tokens/solana/tokens_solana_schema.yml b/models/tokens/solana/tokens_solana_schema.yml index 4a6bd1a599e..7242599a841 100644 --- a/models/tokens/solana/tokens_solana_schema.yml +++ b/models/tokens/solana/tokens_solana_schema.yml @@ -97,7 +97,7 @@ models: config: tags: ['solana','transfers','erc20','nft','spl'] description: > - get all spl token transfers (will add in token2022 later) + get all spl token transfers columns: - name: block_time - name: block_date @@ -105,10 +105,13 @@ models: - name: action - name: token_mint_address - name: amount + - name: fee + - name: token_version - name: from_owner - name: to_owner - name: from_token_account - name: to_token_account + - name: token_version - name: tx_signer - name: tx_id - name: outer_instruction_index diff --git a/models/tokens/solana/tokens_solana_spl_transfers.sql b/models/tokens/solana/tokens_solana_spl_transfers.sql new file mode 100644 index 00000000000..2f788049ac5 --- /dev/null +++ b/models/tokens/solana/tokens_solana_spl_transfers.sql @@ -0,0 +1,131 @@ + {{ + config( + schema = 'tokens_solana', + alias = 'spl_transfers', + materialized = 'incremental', + file_format = 'delta', + incremental_strategy = 'merge', + partition_by = ['block_date'], + incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.block_time')], + unique_key = ['tx_id','outer_instruction_index','inner_instruction_index', 'block_slot'] + ) +}} + + +WITH +base as ( + SELECT + account_source, account_destination + , bytearray_to_uint256(bytearray_reverse(bytearray_substring(call_data,1+1,8))) as amount + , call_tx_id, call_block_time, call_block_slot, call_outer_executing_account, call_tx_signer + , 'transfer' as action + , call_outer_instruction_index, call_inner_instruction_index + , cast(null as double) as fee + , 'spl_token' as token_version + FROM {{ source('spl_token_solana','spl_token_call_transferChecked') }} + WHERE 1=1 + {% if is_incremental() %} + AND {{incremental_predicate('call_block_time')}} + {% endif %} + + UNION ALL + + SELECT + null as account_source, account_account as account_destination + , bytearray_to_uint256(bytearray_reverse(bytearray_substring(call_data,1+1,8))) as amount + , call_tx_id, call_block_time, call_block_slot, call_outer_executing_account, call_tx_signer + , 'mint' as action + , call_outer_instruction_index, call_inner_instruction_index + , cast(null as double) as fee + , 'spl_token' as token_version + FROM {{ source('spl_token_solana','spl_token_call_mintTo') }} + WHERE 1=1 + {% if is_incremental() %} + AND {{incremental_predicate('call_block_time')}} + {% endif %} + + UNION ALL + + SELECT + null as account_source, account_account as account_destination + , bytearray_to_uint256(bytearray_reverse(bytearray_substring(call_data,1+1,8))) as amount + , call_tx_id, call_block_time, call_block_slot, call_outer_executing_account, call_tx_signer + , 'mint' as action + , call_outer_instruction_index, call_inner_instruction_index + , cast(null as double) as fee + , 'spl_token' as token_version + FROM {{ source('spl_token_solana','spl_token_call_mintToChecked') }} + WHERE 1=1 + {% if is_incremental() %} + AND {{incremental_predicate('call_block_time')}} + {% endif %} + + UNION ALL + + SELECT + account_account as account_source, null as account_destination + , bytearray_to_uint256(bytearray_reverse(bytearray_substring(call_data,1+1,8))) as amount + , call_tx_id, call_block_time, call_block_slot, call_outer_executing_account, call_tx_signer + , 'burn' as action + , call_outer_instruction_index, call_inner_instruction_index + , cast(null as double) as fee + , 'spl_token' as token_version + FROM {{ source('spl_token_solana','spl_token_call_burn') }} + WHERE 1=1 + {% if is_incremental() %} + AND {{incremental_predicate('call_block_time')}} + {% endif %} + + UNION ALL + + SELECT + account_account as account_source, null as account_destination + , bytearray_to_uint256(bytearray_reverse(bytearray_substring(call_data,1+1,8))) as amount + , call_tx_id, call_block_time, call_block_slot, call_outer_executing_account, call_tx_signer + , 'burn' as action + , call_outer_instruction_index, call_inner_instruction_index + , cast(null as double) as fee + , 'spl_token' as token_version + FROM {{ source('spl_token_solana','spl_token_call_burnChecked') }} + WHERE 1=1 + {% if is_incremental() %} + AND {{incremental_predicate('call_block_time')}} + {% endif %} +) + +SELECT + call_block_time as block_time + , cast (date_trunc('day', call_block_time) as date) as block_date + , call_block_slot as block_slot + , action + , amount + , fee + , account_source as from_token_account + , account_destination as to_token_account + , token_version + , call_tx_signer as tx_signer + , call_tx_id as tx_id + , call_outer_instruction_index as outer_instruction_index + , COALESCE(call_inner_instruction_index,0) as inner_instruction_index + , call_outer_executing_account as outer_executing_account +FROM base +UNION ALL +SELECT + block_time + , block_date + , block_slot + , action + , amount + , fee + , from_token_account + , to_token_account + , token_version + , tx_signer + , tx_id + , outer_instruction_index + , inner_instruction_index + , outer_executing_account + FROM {{ref('tokens_solana_spl_transfers_call_transfer')}} +{% if is_incremental() %} + AND {{incremental_predicate('call_block_time')}} + {% endif %} \ No newline at end of file diff --git a/models/tokens/solana/tokens_solana_spl_transfers_call_transfer.sql b/models/tokens/solana/tokens_solana_spl_transfers_call_transfer.sql new file mode 100644 index 00000000000..cc319990015 --- /dev/null +++ b/models/tokens/solana/tokens_solana_spl_transfers_call_transfer.sql @@ -0,0 +1,33 @@ + {{ + config( + schema = 'tokens_solana', + alias = 'spl_transfers_call_transfer', + materialized = 'incremental', + file_format = 'delta', + incremental_strategy = 'merge', + partition_by = ['block_date'], + incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.block_time')], + unique_key = ['tx_id','outer_instruction_index','inner_instruction_index', 'block_slot'] + ) +}} + +SELECT + call_block_time as block_time + , cast (date_trunc('day', call_block_time) as date) as block_date + , call_block_slot as block_slot + , 'transfer' as action + , bytearray_to_uint256(bytearray_reverse(bytearray_substring(call_data,1+1,8))) as amount + , cast(null as double) as fee + , account_source as from_token_account + , account_destination as to_token_account + , 'spl_token' as token_version + , call_tx_signer as tx_signer + , call_tx_id as tx_id + , call_outer_instruction_index as outer_instruction_index + , COALESCE(call_inner_instruction_index,0) as inner_instruction_index + , call_outer_executing_account as outer_executing_account +FROM {{ source('spl_token_solana','spl_token_call_transfer') }} +WHERE 1=1 +{% if is_incremental() %} +AND {{incremental_predicate('call_block_time')}} +{% endif %} diff --git a/models/tokens/solana/tokens_solana_token22_spl_transfers.sql b/models/tokens/solana/tokens_solana_token22_spl_transfers.sql new file mode 100644 index 00000000000..9ebc9bff9cb --- /dev/null +++ b/models/tokens/solana/tokens_solana_token22_spl_transfers.sql @@ -0,0 +1,145 @@ + {{ + config( + schema = 'tokens_solana', + alias = 'token22_spl_transfers', + materialized = 'incremental', + file_format = 'delta', + incremental_strategy = 'merge', + partition_by = ['block_date'], + incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.block_time')], + unique_key = ['tx_id','outer_instruction_index','inner_instruction_index', 'block_slot'] + ) +}} + + +WITH +base as ( + --token2022. Most mint and account extensions still use the parent transferChecked instruction, hooks are excecuted after and interest-bearing is precalculated. + SELECT + account_source, account_destination, amount + , call_tx_id, call_block_time, call_block_slot, call_outer_executing_account, call_tx_signer + , action + , call_outer_instruction_index, call_inner_instruction_index + , fee + , token_version + FROM ( + SELECT + account_source, account_destination + , bytearray_to_uint256(bytearray_reverse(bytearray_substring(call_data,1+1,8))) as amount --note that interestbearing mints have a different amount methodology, to add later + , call_tx_id, call_block_time, call_block_slot, call_outer_executing_account, call_tx_signer + , 'transfer' as action + , call_outer_instruction_index, call_inner_instruction_index + , least( + cast(bytearray_to_uint256(bytearray_reverse(bytearray_substring(call_data,1+1,8))) as double) + *cast(f.fee_basis as double)/10000 + ,f.fee_maximum) as fee --we want to take the percent fee on total amount, but not exceed the maximum fee + , 'token2022' as token_version + , f.fee_time + , row_number() over (partition by tr.call_tx_id, tr.call_outer_instruction_index, tr.call_inner_instruction_index order by f.fee_time desc) as latest_fee + FROM {{ source('spl_token_2022_solana','spl_token_2022_call_transferChecked') }} tr + LEFT JOIN {{ ref('tokens_solana_fees_history') }} f ON tr.account_tokenMint = f.account_mint AND tr.call_block_time >= f.fee_time + WHERE 1=1 + {% if is_incremental() %} + AND {{incremental_predicate('tr.call_block_time')}} + {% endif %} + ) WHERE latest_fee = 1 + + UNION ALL + + SELECT + null as account_source, account_mintTo as account_destination + , bytearray_to_uint256(bytearray_reverse(bytearray_substring(call_data,1+1,8))) as amount + , call_tx_id, call_block_time, call_block_slot, call_outer_executing_account, call_tx_signer + , 'mint' as action + , call_outer_instruction_index, call_inner_instruction_index + , null as fee + , 'token2022' as token_version + FROM {{ source('spl_token_2022_solana','spl_token_2022_call_mintTo') }} + WHERE 1=1 + {% if is_incremental() %} + AND {{incremental_predicate('call_block_time')}} + {% endif %} + + UNION ALL + + SELECT + null as account_source, account_mintTo as account_destination + , bytearray_to_uint256(bytearray_reverse(bytearray_substring(call_data,1+1,8))) as amount + , call_tx_id, call_block_time, call_block_slot, call_outer_executing_account, call_tx_signer + , 'mint' as action + , call_outer_instruction_index, call_inner_instruction_index + , null as fee + , 'token2022' as token_version + FROM {{ source('spl_token_2022_solana','spl_token_2022_call_mintToChecked') }} + WHERE 1=1 + {% if is_incremental() %} + AND {{incremental_predicate('call_block_time')}} + {% endif %} + + UNION ALL + + SELECT + account_burnAccount as account_source, null as account_destination + , bytearray_to_uint256(bytearray_reverse(bytearray_substring(call_data,1+1,8))) as amount + , call_tx_id, call_block_time, call_block_slot, call_outer_executing_account, call_tx_signer + , 'burn' as action + , call_outer_instruction_index, call_inner_instruction_index + , null as fee + , 'token2022' as token_version + FROM {{ source('spl_token_2022_solana','spl_token_2022_call_burn') }} + WHERE 1=1 + {% if is_incremental() %} + AND {{incremental_predicate('call_block_time')}} + {% endif %} + + UNION ALL + + SELECT + account_burnAccount as account_source, null as account_destination + , bytearray_to_uint256(bytearray_reverse(bytearray_substring(call_data,1+1,8))) as amount + , call_tx_id, call_block_time, call_block_slot, call_outer_executing_account, call_tx_signer + , 'burn' as action + , call_outer_instruction_index, call_inner_instruction_index + , null as fee + , 'token2022' as token_version + FROM {{ source('spl_token_2022_solana','spl_token_2022_call_burnChecked') }} + WHERE 1=1 + {% if is_incremental() %} + AND {{incremental_predicate('call_block_time')}} + {% endif %} + + --token2022 transferFeeExtension has some extra complications. It's the only extension with its own transferChecked wrapper (confidential transfers will have this too) + UNION ALL + + SELECT + call_account_arguments[1] as account_source, call_account_arguments[3] as account_destination + , bytearray_to_uint256(bytearray_reverse(bytearray_substring(call_data,1+2,8))) as amount + , call_tx_id, call_block_time, call_block_slot, call_outer_executing_account, call_tx_signer + , 'transfer' as action + , call_outer_instruction_index, call_inner_instruction_index + , bytearray_to_uint256(bytearray_reverse(bytearray_substring(call_data, 1+2+8+1,8))) as fee + , 'token2022' as token_version + FROM {{ source('spl_token_2022_solana','spl_token_2022_call_transferFeeExtension') }} + WHERE bytearray_substring(call_data,1,2) = 0x1a01 --https://github.com/solana-labs/solana-program-library/blob/8f50c6fabc6ec87ada229e923030381f573e0aed/token/program-2022/src/extension/transfer_fee/instruction.rs#L284 + {% if is_incremental() %} + AND {{incremental_predicate('call_block_time')}} + {% endif %} +) + +SELECT + call_block_time as block_time + , cast (date_trunc('day', call_block_time) as date) as block_date + , call_block_slot as block_slot + , action + , amount + , fee + , account_source as from_token_account + , account_destination as to_token_account + , token_version + , call_tx_signer as tx_signer + , call_tx_id as tx_id + , call_outer_instruction_index as outer_instruction_index + , COALESCE(call_inner_instruction_index,0) as inner_instruction_index + , call_outer_executing_account as outer_executing_account +FROM base tr +-- AND call_block_time > now() - interval '90' day --for faster CI testing \ No newline at end of file diff --git a/models/tokens/solana/tokens_solana_transfers.sql b/models/tokens/solana/tokens_solana_transfers.sql index a28903cf3d4..228ba1c332d 100644 --- a/models/tokens/solana/tokens_solana_transfers.sql +++ b/models/tokens/solana/tokens_solana_transfers.sql @@ -14,56 +14,69 @@ \'["ilemi"]\') }}') }} + +WITH +base as ( + SELECT + block_time, + , call_block_slot as block_slot + , action + , amount + , fee + , from_token_account + , to_token_account + , token_version + , tx_signer + , tx_id + , outer_instruction_index + , inner_instruction_index + , outer_executing_account +FROM {{ ref('tokens_solana_spl_transfers') }} +{% if is_incremental() %} +WHERE {{incremental_predicate('block_time')}} +{% endif %} +UNION ALL + SELECT + block_time, + , call_block_slot as block_slot + , action + , amount + , fee + , from_token_account + , to_token_account + , token_version + , tx_signer + , tx_id + , outer_instruction_index + , inner_instruction_index + , outer_executing_account +FROM {{ ref('tokens_solana_token22_spl_transfers') }} +{% if is_incremental() %} +WHERE {{incremental_predicate('block_time')}} +{% endif %} +) + SELECT call_block_time as block_time , cast (date_trunc('day', call_block_time) as date) as block_date , call_block_slot as block_slot , action , amount + , fee , COALESCE(tk_s.token_mint_address, tk_d.token_mint_address) as token_mint_address , tk_s.token_balance_owner as from_owner , tk_d.token_balance_owner as to_owner - , account_source as from_token_account - , account_destination as to_token_account - , call_tx_signer as tx_signer - , call_tx_id as tx_id - , call_outer_instruction_index as outer_instruction_index - , COALESCE(call_inner_instruction_index,0) as inner_instruction_index - , call_outer_executing_account as outer_executing_account -FROM ( - SELECT account_source, account_destination, amount, call_tx_id, call_block_time, call_block_slot, call_outer_executing_account, call_tx_signer, 'transfer' as action, call_outer_instruction_index, call_inner_instruction_index - FROM {{ source('spl_token_solana','spl_token_call_transfer') }} - - UNION ALL - - SELECT account_source, account_destination, amount, call_tx_id, call_block_time, call_block_slot, call_outer_executing_account, call_tx_signer, 'transfer' as action, call_outer_instruction_index, call_inner_instruction_index - FROM {{ source('spl_token_solana','spl_token_call_transferChecked') }} - - UNION ALL - - SELECT null, account_account as account_destination, amount, call_tx_id, call_block_time, call_block_slot, call_outer_executing_account, call_tx_signer, 'mint' as action, call_outer_instruction_index, call_inner_instruction_index - FROM {{ source('spl_token_solana','spl_token_call_mintTo') }} - - UNION ALL - - SELECT null, account_account as account_destination, amount, call_tx_id, call_block_time, call_block_slot, call_outer_executing_account, call_tx_signer, 'mint' as action, call_outer_instruction_index, call_inner_instruction_index - FROM {{ source('spl_token_solana','spl_token_call_mintToChecked') }} - - UNION ALL - - SELECT account_account as account_source, null, amount, call_tx_id, call_block_time, call_block_slot, call_outer_executing_account, call_tx_signer, 'burn' as action, call_outer_instruction_index, call_inner_instruction_index - FROM {{ source('spl_token_solana','spl_token_call_burn') }} - - UNION ALL - - SELECT account_account as account_source, null, amount, call_tx_id, call_block_time, call_block_slot, call_outer_executing_account, call_tx_signer, 'burn' as action, call_outer_instruction_index, call_inner_instruction_index - FROM {{ source('spl_token_solana','spl_token_call_burnChecked') }} -) tr + , from_token_account + , to_token_account + , token_version + , tx_signer + , tx_id + , outer_instruction_index + , inner_instruction_index + , outer_executing_account +FROM base tr --get token and accounts -LEFT JOIN {{ ref('solana_utils_token_accounts') }} tk_s ON tk_s.address = tr.account_source -LEFT JOIN {{ ref('solana_utils_token_accounts') }} tk_d ON tk_d.address = tr.account_destination +INNER JOIN {{ ref('solana_utils_token_accounts') }} tk_s ON tk_s.address = tr.account_source +INNER JOIN {{ ref('solana_utils_token_accounts') }} tk_d ON tk_d.address = tr.account_destination WHERE 1=1 -{% if is_incremental() %} -AND {{incremental_predicate('call_block_time')}} -{% endif %} --- AND call_block_time > now() - interval '600' day \ No newline at end of file +-- AND call_block_time > now() - interval '90' day --for faster CI testing \ No newline at end of file From 892638c6f0e58f2752c1eec97891ed8c5b430f87 Mon Sep 17 00:00:00 2001 From: Alan Ghobadi Date: Mon, 10 Jun 2024 14:35:51 +0200 Subject: [PATCH 073/149] Revert "add back changes for solana token 2022 (#6107)" (#6124) This reverts commit d06e7c7ef1ac4c12f47fad2d14846f30f4fb54c3. --- models/tokens/solana/tokens_solana_schema.yml | 5 +- .../solana/tokens_solana_spl_transfers.sql | 131 ---------------- ...ens_solana_spl_transfers_call_transfer.sql | 33 ---- .../tokens_solana_token22_spl_transfers.sql | 145 ------------------ .../tokens/solana/tokens_solana_transfers.sql | 97 +++++------- 5 files changed, 43 insertions(+), 368 deletions(-) delete mode 100644 models/tokens/solana/tokens_solana_spl_transfers.sql delete mode 100644 models/tokens/solana/tokens_solana_spl_transfers_call_transfer.sql delete mode 100644 models/tokens/solana/tokens_solana_token22_spl_transfers.sql diff --git a/models/tokens/solana/tokens_solana_schema.yml b/models/tokens/solana/tokens_solana_schema.yml index 7242599a841..4a6bd1a599e 100644 --- a/models/tokens/solana/tokens_solana_schema.yml +++ b/models/tokens/solana/tokens_solana_schema.yml @@ -97,7 +97,7 @@ models: config: tags: ['solana','transfers','erc20','nft','spl'] description: > - get all spl token transfers + get all spl token transfers (will add in token2022 later) columns: - name: block_time - name: block_date @@ -105,13 +105,10 @@ models: - name: action - name: token_mint_address - name: amount - - name: fee - - name: token_version - name: from_owner - name: to_owner - name: from_token_account - name: to_token_account - - name: token_version - name: tx_signer - name: tx_id - name: outer_instruction_index diff --git a/models/tokens/solana/tokens_solana_spl_transfers.sql b/models/tokens/solana/tokens_solana_spl_transfers.sql deleted file mode 100644 index 2f788049ac5..00000000000 --- a/models/tokens/solana/tokens_solana_spl_transfers.sql +++ /dev/null @@ -1,131 +0,0 @@ - {{ - config( - schema = 'tokens_solana', - alias = 'spl_transfers', - materialized = 'incremental', - file_format = 'delta', - incremental_strategy = 'merge', - partition_by = ['block_date'], - incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.block_time')], - unique_key = ['tx_id','outer_instruction_index','inner_instruction_index', 'block_slot'] - ) -}} - - -WITH -base as ( - SELECT - account_source, account_destination - , bytearray_to_uint256(bytearray_reverse(bytearray_substring(call_data,1+1,8))) as amount - , call_tx_id, call_block_time, call_block_slot, call_outer_executing_account, call_tx_signer - , 'transfer' as action - , call_outer_instruction_index, call_inner_instruction_index - , cast(null as double) as fee - , 'spl_token' as token_version - FROM {{ source('spl_token_solana','spl_token_call_transferChecked') }} - WHERE 1=1 - {% if is_incremental() %} - AND {{incremental_predicate('call_block_time')}} - {% endif %} - - UNION ALL - - SELECT - null as account_source, account_account as account_destination - , bytearray_to_uint256(bytearray_reverse(bytearray_substring(call_data,1+1,8))) as amount - , call_tx_id, call_block_time, call_block_slot, call_outer_executing_account, call_tx_signer - , 'mint' as action - , call_outer_instruction_index, call_inner_instruction_index - , cast(null as double) as fee - , 'spl_token' as token_version - FROM {{ source('spl_token_solana','spl_token_call_mintTo') }} - WHERE 1=1 - {% if is_incremental() %} - AND {{incremental_predicate('call_block_time')}} - {% endif %} - - UNION ALL - - SELECT - null as account_source, account_account as account_destination - , bytearray_to_uint256(bytearray_reverse(bytearray_substring(call_data,1+1,8))) as amount - , call_tx_id, call_block_time, call_block_slot, call_outer_executing_account, call_tx_signer - , 'mint' as action - , call_outer_instruction_index, call_inner_instruction_index - , cast(null as double) as fee - , 'spl_token' as token_version - FROM {{ source('spl_token_solana','spl_token_call_mintToChecked') }} - WHERE 1=1 - {% if is_incremental() %} - AND {{incremental_predicate('call_block_time')}} - {% endif %} - - UNION ALL - - SELECT - account_account as account_source, null as account_destination - , bytearray_to_uint256(bytearray_reverse(bytearray_substring(call_data,1+1,8))) as amount - , call_tx_id, call_block_time, call_block_slot, call_outer_executing_account, call_tx_signer - , 'burn' as action - , call_outer_instruction_index, call_inner_instruction_index - , cast(null as double) as fee - , 'spl_token' as token_version - FROM {{ source('spl_token_solana','spl_token_call_burn') }} - WHERE 1=1 - {% if is_incremental() %} - AND {{incremental_predicate('call_block_time')}} - {% endif %} - - UNION ALL - - SELECT - account_account as account_source, null as account_destination - , bytearray_to_uint256(bytearray_reverse(bytearray_substring(call_data,1+1,8))) as amount - , call_tx_id, call_block_time, call_block_slot, call_outer_executing_account, call_tx_signer - , 'burn' as action - , call_outer_instruction_index, call_inner_instruction_index - , cast(null as double) as fee - , 'spl_token' as token_version - FROM {{ source('spl_token_solana','spl_token_call_burnChecked') }} - WHERE 1=1 - {% if is_incremental() %} - AND {{incremental_predicate('call_block_time')}} - {% endif %} -) - -SELECT - call_block_time as block_time - , cast (date_trunc('day', call_block_time) as date) as block_date - , call_block_slot as block_slot - , action - , amount - , fee - , account_source as from_token_account - , account_destination as to_token_account - , token_version - , call_tx_signer as tx_signer - , call_tx_id as tx_id - , call_outer_instruction_index as outer_instruction_index - , COALESCE(call_inner_instruction_index,0) as inner_instruction_index - , call_outer_executing_account as outer_executing_account -FROM base -UNION ALL -SELECT - block_time - , block_date - , block_slot - , action - , amount - , fee - , from_token_account - , to_token_account - , token_version - , tx_signer - , tx_id - , outer_instruction_index - , inner_instruction_index - , outer_executing_account - FROM {{ref('tokens_solana_spl_transfers_call_transfer')}} -{% if is_incremental() %} - AND {{incremental_predicate('call_block_time')}} - {% endif %} \ No newline at end of file diff --git a/models/tokens/solana/tokens_solana_spl_transfers_call_transfer.sql b/models/tokens/solana/tokens_solana_spl_transfers_call_transfer.sql deleted file mode 100644 index cc319990015..00000000000 --- a/models/tokens/solana/tokens_solana_spl_transfers_call_transfer.sql +++ /dev/null @@ -1,33 +0,0 @@ - {{ - config( - schema = 'tokens_solana', - alias = 'spl_transfers_call_transfer', - materialized = 'incremental', - file_format = 'delta', - incremental_strategy = 'merge', - partition_by = ['block_date'], - incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.block_time')], - unique_key = ['tx_id','outer_instruction_index','inner_instruction_index', 'block_slot'] - ) -}} - -SELECT - call_block_time as block_time - , cast (date_trunc('day', call_block_time) as date) as block_date - , call_block_slot as block_slot - , 'transfer' as action - , bytearray_to_uint256(bytearray_reverse(bytearray_substring(call_data,1+1,8))) as amount - , cast(null as double) as fee - , account_source as from_token_account - , account_destination as to_token_account - , 'spl_token' as token_version - , call_tx_signer as tx_signer - , call_tx_id as tx_id - , call_outer_instruction_index as outer_instruction_index - , COALESCE(call_inner_instruction_index,0) as inner_instruction_index - , call_outer_executing_account as outer_executing_account -FROM {{ source('spl_token_solana','spl_token_call_transfer') }} -WHERE 1=1 -{% if is_incremental() %} -AND {{incremental_predicate('call_block_time')}} -{% endif %} diff --git a/models/tokens/solana/tokens_solana_token22_spl_transfers.sql b/models/tokens/solana/tokens_solana_token22_spl_transfers.sql deleted file mode 100644 index 9ebc9bff9cb..00000000000 --- a/models/tokens/solana/tokens_solana_token22_spl_transfers.sql +++ /dev/null @@ -1,145 +0,0 @@ - {{ - config( - schema = 'tokens_solana', - alias = 'token22_spl_transfers', - materialized = 'incremental', - file_format = 'delta', - incremental_strategy = 'merge', - partition_by = ['block_date'], - incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.block_time')], - unique_key = ['tx_id','outer_instruction_index','inner_instruction_index', 'block_slot'] - ) -}} - - -WITH -base as ( - --token2022. Most mint and account extensions still use the parent transferChecked instruction, hooks are excecuted after and interest-bearing is precalculated. - SELECT - account_source, account_destination, amount - , call_tx_id, call_block_time, call_block_slot, call_outer_executing_account, call_tx_signer - , action - , call_outer_instruction_index, call_inner_instruction_index - , fee - , token_version - FROM ( - SELECT - account_source, account_destination - , bytearray_to_uint256(bytearray_reverse(bytearray_substring(call_data,1+1,8))) as amount --note that interestbearing mints have a different amount methodology, to add later - , call_tx_id, call_block_time, call_block_slot, call_outer_executing_account, call_tx_signer - , 'transfer' as action - , call_outer_instruction_index, call_inner_instruction_index - , least( - cast(bytearray_to_uint256(bytearray_reverse(bytearray_substring(call_data,1+1,8))) as double) - *cast(f.fee_basis as double)/10000 - ,f.fee_maximum) as fee --we want to take the percent fee on total amount, but not exceed the maximum fee - , 'token2022' as token_version - , f.fee_time - , row_number() over (partition by tr.call_tx_id, tr.call_outer_instruction_index, tr.call_inner_instruction_index order by f.fee_time desc) as latest_fee - FROM {{ source('spl_token_2022_solana','spl_token_2022_call_transferChecked') }} tr - LEFT JOIN {{ ref('tokens_solana_fees_history') }} f ON tr.account_tokenMint = f.account_mint AND tr.call_block_time >= f.fee_time - WHERE 1=1 - {% if is_incremental() %} - AND {{incremental_predicate('tr.call_block_time')}} - {% endif %} - ) WHERE latest_fee = 1 - - UNION ALL - - SELECT - null as account_source, account_mintTo as account_destination - , bytearray_to_uint256(bytearray_reverse(bytearray_substring(call_data,1+1,8))) as amount - , call_tx_id, call_block_time, call_block_slot, call_outer_executing_account, call_tx_signer - , 'mint' as action - , call_outer_instruction_index, call_inner_instruction_index - , null as fee - , 'token2022' as token_version - FROM {{ source('spl_token_2022_solana','spl_token_2022_call_mintTo') }} - WHERE 1=1 - {% if is_incremental() %} - AND {{incremental_predicate('call_block_time')}} - {% endif %} - - UNION ALL - - SELECT - null as account_source, account_mintTo as account_destination - , bytearray_to_uint256(bytearray_reverse(bytearray_substring(call_data,1+1,8))) as amount - , call_tx_id, call_block_time, call_block_slot, call_outer_executing_account, call_tx_signer - , 'mint' as action - , call_outer_instruction_index, call_inner_instruction_index - , null as fee - , 'token2022' as token_version - FROM {{ source('spl_token_2022_solana','spl_token_2022_call_mintToChecked') }} - WHERE 1=1 - {% if is_incremental() %} - AND {{incremental_predicate('call_block_time')}} - {% endif %} - - UNION ALL - - SELECT - account_burnAccount as account_source, null as account_destination - , bytearray_to_uint256(bytearray_reverse(bytearray_substring(call_data,1+1,8))) as amount - , call_tx_id, call_block_time, call_block_slot, call_outer_executing_account, call_tx_signer - , 'burn' as action - , call_outer_instruction_index, call_inner_instruction_index - , null as fee - , 'token2022' as token_version - FROM {{ source('spl_token_2022_solana','spl_token_2022_call_burn') }} - WHERE 1=1 - {% if is_incremental() %} - AND {{incremental_predicate('call_block_time')}} - {% endif %} - - UNION ALL - - SELECT - account_burnAccount as account_source, null as account_destination - , bytearray_to_uint256(bytearray_reverse(bytearray_substring(call_data,1+1,8))) as amount - , call_tx_id, call_block_time, call_block_slot, call_outer_executing_account, call_tx_signer - , 'burn' as action - , call_outer_instruction_index, call_inner_instruction_index - , null as fee - , 'token2022' as token_version - FROM {{ source('spl_token_2022_solana','spl_token_2022_call_burnChecked') }} - WHERE 1=1 - {% if is_incremental() %} - AND {{incremental_predicate('call_block_time')}} - {% endif %} - - --token2022 transferFeeExtension has some extra complications. It's the only extension with its own transferChecked wrapper (confidential transfers will have this too) - UNION ALL - - SELECT - call_account_arguments[1] as account_source, call_account_arguments[3] as account_destination - , bytearray_to_uint256(bytearray_reverse(bytearray_substring(call_data,1+2,8))) as amount - , call_tx_id, call_block_time, call_block_slot, call_outer_executing_account, call_tx_signer - , 'transfer' as action - , call_outer_instruction_index, call_inner_instruction_index - , bytearray_to_uint256(bytearray_reverse(bytearray_substring(call_data, 1+2+8+1,8))) as fee - , 'token2022' as token_version - FROM {{ source('spl_token_2022_solana','spl_token_2022_call_transferFeeExtension') }} - WHERE bytearray_substring(call_data,1,2) = 0x1a01 --https://github.com/solana-labs/solana-program-library/blob/8f50c6fabc6ec87ada229e923030381f573e0aed/token/program-2022/src/extension/transfer_fee/instruction.rs#L284 - {% if is_incremental() %} - AND {{incremental_predicate('call_block_time')}} - {% endif %} -) - -SELECT - call_block_time as block_time - , cast (date_trunc('day', call_block_time) as date) as block_date - , call_block_slot as block_slot - , action - , amount - , fee - , account_source as from_token_account - , account_destination as to_token_account - , token_version - , call_tx_signer as tx_signer - , call_tx_id as tx_id - , call_outer_instruction_index as outer_instruction_index - , COALESCE(call_inner_instruction_index,0) as inner_instruction_index - , call_outer_executing_account as outer_executing_account -FROM base tr --- AND call_block_time > now() - interval '90' day --for faster CI testing \ No newline at end of file diff --git a/models/tokens/solana/tokens_solana_transfers.sql b/models/tokens/solana/tokens_solana_transfers.sql index 228ba1c332d..a28903cf3d4 100644 --- a/models/tokens/solana/tokens_solana_transfers.sql +++ b/models/tokens/solana/tokens_solana_transfers.sql @@ -14,69 +14,56 @@ \'["ilemi"]\') }}') }} - -WITH -base as ( - SELECT - block_time, - , call_block_slot as block_slot - , action - , amount - , fee - , from_token_account - , to_token_account - , token_version - , tx_signer - , tx_id - , outer_instruction_index - , inner_instruction_index - , outer_executing_account -FROM {{ ref('tokens_solana_spl_transfers') }} -{% if is_incremental() %} -WHERE {{incremental_predicate('block_time')}} -{% endif %} -UNION ALL - SELECT - block_time, - , call_block_slot as block_slot - , action - , amount - , fee - , from_token_account - , to_token_account - , token_version - , tx_signer - , tx_id - , outer_instruction_index - , inner_instruction_index - , outer_executing_account -FROM {{ ref('tokens_solana_token22_spl_transfers') }} -{% if is_incremental() %} -WHERE {{incremental_predicate('block_time')}} -{% endif %} -) - SELECT call_block_time as block_time , cast (date_trunc('day', call_block_time) as date) as block_date , call_block_slot as block_slot , action , amount - , fee , COALESCE(tk_s.token_mint_address, tk_d.token_mint_address) as token_mint_address , tk_s.token_balance_owner as from_owner , tk_d.token_balance_owner as to_owner - , from_token_account - , to_token_account - , token_version - , tx_signer - , tx_id - , outer_instruction_index - , inner_instruction_index - , outer_executing_account -FROM base tr + , account_source as from_token_account + , account_destination as to_token_account + , call_tx_signer as tx_signer + , call_tx_id as tx_id + , call_outer_instruction_index as outer_instruction_index + , COALESCE(call_inner_instruction_index,0) as inner_instruction_index + , call_outer_executing_account as outer_executing_account +FROM ( + SELECT account_source, account_destination, amount, call_tx_id, call_block_time, call_block_slot, call_outer_executing_account, call_tx_signer, 'transfer' as action, call_outer_instruction_index, call_inner_instruction_index + FROM {{ source('spl_token_solana','spl_token_call_transfer') }} + + UNION ALL + + SELECT account_source, account_destination, amount, call_tx_id, call_block_time, call_block_slot, call_outer_executing_account, call_tx_signer, 'transfer' as action, call_outer_instruction_index, call_inner_instruction_index + FROM {{ source('spl_token_solana','spl_token_call_transferChecked') }} + + UNION ALL + + SELECT null, account_account as account_destination, amount, call_tx_id, call_block_time, call_block_slot, call_outer_executing_account, call_tx_signer, 'mint' as action, call_outer_instruction_index, call_inner_instruction_index + FROM {{ source('spl_token_solana','spl_token_call_mintTo') }} + + UNION ALL + + SELECT null, account_account as account_destination, amount, call_tx_id, call_block_time, call_block_slot, call_outer_executing_account, call_tx_signer, 'mint' as action, call_outer_instruction_index, call_inner_instruction_index + FROM {{ source('spl_token_solana','spl_token_call_mintToChecked') }} + + UNION ALL + + SELECT account_account as account_source, null, amount, call_tx_id, call_block_time, call_block_slot, call_outer_executing_account, call_tx_signer, 'burn' as action, call_outer_instruction_index, call_inner_instruction_index + FROM {{ source('spl_token_solana','spl_token_call_burn') }} + + UNION ALL + + SELECT account_account as account_source, null, amount, call_tx_id, call_block_time, call_block_slot, call_outer_executing_account, call_tx_signer, 'burn' as action, call_outer_instruction_index, call_inner_instruction_index + FROM {{ source('spl_token_solana','spl_token_call_burnChecked') }} +) tr --get token and accounts -INNER JOIN {{ ref('solana_utils_token_accounts') }} tk_s ON tk_s.address = tr.account_source -INNER JOIN {{ ref('solana_utils_token_accounts') }} tk_d ON tk_d.address = tr.account_destination +LEFT JOIN {{ ref('solana_utils_token_accounts') }} tk_s ON tk_s.address = tr.account_source +LEFT JOIN {{ ref('solana_utils_token_accounts') }} tk_d ON tk_d.address = tr.account_destination WHERE 1=1 --- AND call_block_time > now() - interval '90' day --for faster CI testing \ No newline at end of file +{% if is_incremental() %} +AND {{incremental_predicate('call_block_time')}} +{% endif %} +-- AND call_block_time > now() - interval '600' day \ No newline at end of file From 3e18bfee4b1a499b9b40df730fa0d98d9fc6ecc9 Mon Sep 17 00:00:00 2001 From: Alan Ghobadi Date: Mon, 10 Jun 2024 15:53:55 +0200 Subject: [PATCH 074/149] Reapply "add back changes for solana token 2022 (#6107)" (#6124) (#6126) This reverts commit 892638c6f0e58f2752c1eec97891ed8c5b430f87. --- models/tokens/solana/tokens_solana_schema.yml | 5 +- .../solana/tokens_solana_spl_transfers.sql | 131 ++++++++++++++++ ...ens_solana_spl_transfers_call_transfer.sql | 33 ++++ .../tokens_solana_token22_spl_transfers.sql | 145 ++++++++++++++++++ .../tokens/solana/tokens_solana_transfers.sql | 97 +++++++----- 5 files changed, 368 insertions(+), 43 deletions(-) create mode 100644 models/tokens/solana/tokens_solana_spl_transfers.sql create mode 100644 models/tokens/solana/tokens_solana_spl_transfers_call_transfer.sql create mode 100644 models/tokens/solana/tokens_solana_token22_spl_transfers.sql diff --git a/models/tokens/solana/tokens_solana_schema.yml b/models/tokens/solana/tokens_solana_schema.yml index 4a6bd1a599e..7242599a841 100644 --- a/models/tokens/solana/tokens_solana_schema.yml +++ b/models/tokens/solana/tokens_solana_schema.yml @@ -97,7 +97,7 @@ models: config: tags: ['solana','transfers','erc20','nft','spl'] description: > - get all spl token transfers (will add in token2022 later) + get all spl token transfers columns: - name: block_time - name: block_date @@ -105,10 +105,13 @@ models: - name: action - name: token_mint_address - name: amount + - name: fee + - name: token_version - name: from_owner - name: to_owner - name: from_token_account - name: to_token_account + - name: token_version - name: tx_signer - name: tx_id - name: outer_instruction_index diff --git a/models/tokens/solana/tokens_solana_spl_transfers.sql b/models/tokens/solana/tokens_solana_spl_transfers.sql new file mode 100644 index 00000000000..2f788049ac5 --- /dev/null +++ b/models/tokens/solana/tokens_solana_spl_transfers.sql @@ -0,0 +1,131 @@ + {{ + config( + schema = 'tokens_solana', + alias = 'spl_transfers', + materialized = 'incremental', + file_format = 'delta', + incremental_strategy = 'merge', + partition_by = ['block_date'], + incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.block_time')], + unique_key = ['tx_id','outer_instruction_index','inner_instruction_index', 'block_slot'] + ) +}} + + +WITH +base as ( + SELECT + account_source, account_destination + , bytearray_to_uint256(bytearray_reverse(bytearray_substring(call_data,1+1,8))) as amount + , call_tx_id, call_block_time, call_block_slot, call_outer_executing_account, call_tx_signer + , 'transfer' as action + , call_outer_instruction_index, call_inner_instruction_index + , cast(null as double) as fee + , 'spl_token' as token_version + FROM {{ source('spl_token_solana','spl_token_call_transferChecked') }} + WHERE 1=1 + {% if is_incremental() %} + AND {{incremental_predicate('call_block_time')}} + {% endif %} + + UNION ALL + + SELECT + null as account_source, account_account as account_destination + , bytearray_to_uint256(bytearray_reverse(bytearray_substring(call_data,1+1,8))) as amount + , call_tx_id, call_block_time, call_block_slot, call_outer_executing_account, call_tx_signer + , 'mint' as action + , call_outer_instruction_index, call_inner_instruction_index + , cast(null as double) as fee + , 'spl_token' as token_version + FROM {{ source('spl_token_solana','spl_token_call_mintTo') }} + WHERE 1=1 + {% if is_incremental() %} + AND {{incremental_predicate('call_block_time')}} + {% endif %} + + UNION ALL + + SELECT + null as account_source, account_account as account_destination + , bytearray_to_uint256(bytearray_reverse(bytearray_substring(call_data,1+1,8))) as amount + , call_tx_id, call_block_time, call_block_slot, call_outer_executing_account, call_tx_signer + , 'mint' as action + , call_outer_instruction_index, call_inner_instruction_index + , cast(null as double) as fee + , 'spl_token' as token_version + FROM {{ source('spl_token_solana','spl_token_call_mintToChecked') }} + WHERE 1=1 + {% if is_incremental() %} + AND {{incremental_predicate('call_block_time')}} + {% endif %} + + UNION ALL + + SELECT + account_account as account_source, null as account_destination + , bytearray_to_uint256(bytearray_reverse(bytearray_substring(call_data,1+1,8))) as amount + , call_tx_id, call_block_time, call_block_slot, call_outer_executing_account, call_tx_signer + , 'burn' as action + , call_outer_instruction_index, call_inner_instruction_index + , cast(null as double) as fee + , 'spl_token' as token_version + FROM {{ source('spl_token_solana','spl_token_call_burn') }} + WHERE 1=1 + {% if is_incremental() %} + AND {{incremental_predicate('call_block_time')}} + {% endif %} + + UNION ALL + + SELECT + account_account as account_source, null as account_destination + , bytearray_to_uint256(bytearray_reverse(bytearray_substring(call_data,1+1,8))) as amount + , call_tx_id, call_block_time, call_block_slot, call_outer_executing_account, call_tx_signer + , 'burn' as action + , call_outer_instruction_index, call_inner_instruction_index + , cast(null as double) as fee + , 'spl_token' as token_version + FROM {{ source('spl_token_solana','spl_token_call_burnChecked') }} + WHERE 1=1 + {% if is_incremental() %} + AND {{incremental_predicate('call_block_time')}} + {% endif %} +) + +SELECT + call_block_time as block_time + , cast (date_trunc('day', call_block_time) as date) as block_date + , call_block_slot as block_slot + , action + , amount + , fee + , account_source as from_token_account + , account_destination as to_token_account + , token_version + , call_tx_signer as tx_signer + , call_tx_id as tx_id + , call_outer_instruction_index as outer_instruction_index + , COALESCE(call_inner_instruction_index,0) as inner_instruction_index + , call_outer_executing_account as outer_executing_account +FROM base +UNION ALL +SELECT + block_time + , block_date + , block_slot + , action + , amount + , fee + , from_token_account + , to_token_account + , token_version + , tx_signer + , tx_id + , outer_instruction_index + , inner_instruction_index + , outer_executing_account + FROM {{ref('tokens_solana_spl_transfers_call_transfer')}} +{% if is_incremental() %} + AND {{incremental_predicate('call_block_time')}} + {% endif %} \ No newline at end of file diff --git a/models/tokens/solana/tokens_solana_spl_transfers_call_transfer.sql b/models/tokens/solana/tokens_solana_spl_transfers_call_transfer.sql new file mode 100644 index 00000000000..cc319990015 --- /dev/null +++ b/models/tokens/solana/tokens_solana_spl_transfers_call_transfer.sql @@ -0,0 +1,33 @@ + {{ + config( + schema = 'tokens_solana', + alias = 'spl_transfers_call_transfer', + materialized = 'incremental', + file_format = 'delta', + incremental_strategy = 'merge', + partition_by = ['block_date'], + incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.block_time')], + unique_key = ['tx_id','outer_instruction_index','inner_instruction_index', 'block_slot'] + ) +}} + +SELECT + call_block_time as block_time + , cast (date_trunc('day', call_block_time) as date) as block_date + , call_block_slot as block_slot + , 'transfer' as action + , bytearray_to_uint256(bytearray_reverse(bytearray_substring(call_data,1+1,8))) as amount + , cast(null as double) as fee + , account_source as from_token_account + , account_destination as to_token_account + , 'spl_token' as token_version + , call_tx_signer as tx_signer + , call_tx_id as tx_id + , call_outer_instruction_index as outer_instruction_index + , COALESCE(call_inner_instruction_index,0) as inner_instruction_index + , call_outer_executing_account as outer_executing_account +FROM {{ source('spl_token_solana','spl_token_call_transfer') }} +WHERE 1=1 +{% if is_incremental() %} +AND {{incremental_predicate('call_block_time')}} +{% endif %} diff --git a/models/tokens/solana/tokens_solana_token22_spl_transfers.sql b/models/tokens/solana/tokens_solana_token22_spl_transfers.sql new file mode 100644 index 00000000000..9ebc9bff9cb --- /dev/null +++ b/models/tokens/solana/tokens_solana_token22_spl_transfers.sql @@ -0,0 +1,145 @@ + {{ + config( + schema = 'tokens_solana', + alias = 'token22_spl_transfers', + materialized = 'incremental', + file_format = 'delta', + incremental_strategy = 'merge', + partition_by = ['block_date'], + incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.block_time')], + unique_key = ['tx_id','outer_instruction_index','inner_instruction_index', 'block_slot'] + ) +}} + + +WITH +base as ( + --token2022. Most mint and account extensions still use the parent transferChecked instruction, hooks are excecuted after and interest-bearing is precalculated. + SELECT + account_source, account_destination, amount + , call_tx_id, call_block_time, call_block_slot, call_outer_executing_account, call_tx_signer + , action + , call_outer_instruction_index, call_inner_instruction_index + , fee + , token_version + FROM ( + SELECT + account_source, account_destination + , bytearray_to_uint256(bytearray_reverse(bytearray_substring(call_data,1+1,8))) as amount --note that interestbearing mints have a different amount methodology, to add later + , call_tx_id, call_block_time, call_block_slot, call_outer_executing_account, call_tx_signer + , 'transfer' as action + , call_outer_instruction_index, call_inner_instruction_index + , least( + cast(bytearray_to_uint256(bytearray_reverse(bytearray_substring(call_data,1+1,8))) as double) + *cast(f.fee_basis as double)/10000 + ,f.fee_maximum) as fee --we want to take the percent fee on total amount, but not exceed the maximum fee + , 'token2022' as token_version + , f.fee_time + , row_number() over (partition by tr.call_tx_id, tr.call_outer_instruction_index, tr.call_inner_instruction_index order by f.fee_time desc) as latest_fee + FROM {{ source('spl_token_2022_solana','spl_token_2022_call_transferChecked') }} tr + LEFT JOIN {{ ref('tokens_solana_fees_history') }} f ON tr.account_tokenMint = f.account_mint AND tr.call_block_time >= f.fee_time + WHERE 1=1 + {% if is_incremental() %} + AND {{incremental_predicate('tr.call_block_time')}} + {% endif %} + ) WHERE latest_fee = 1 + + UNION ALL + + SELECT + null as account_source, account_mintTo as account_destination + , bytearray_to_uint256(bytearray_reverse(bytearray_substring(call_data,1+1,8))) as amount + , call_tx_id, call_block_time, call_block_slot, call_outer_executing_account, call_tx_signer + , 'mint' as action + , call_outer_instruction_index, call_inner_instruction_index + , null as fee + , 'token2022' as token_version + FROM {{ source('spl_token_2022_solana','spl_token_2022_call_mintTo') }} + WHERE 1=1 + {% if is_incremental() %} + AND {{incremental_predicate('call_block_time')}} + {% endif %} + + UNION ALL + + SELECT + null as account_source, account_mintTo as account_destination + , bytearray_to_uint256(bytearray_reverse(bytearray_substring(call_data,1+1,8))) as amount + , call_tx_id, call_block_time, call_block_slot, call_outer_executing_account, call_tx_signer + , 'mint' as action + , call_outer_instruction_index, call_inner_instruction_index + , null as fee + , 'token2022' as token_version + FROM {{ source('spl_token_2022_solana','spl_token_2022_call_mintToChecked') }} + WHERE 1=1 + {% if is_incremental() %} + AND {{incremental_predicate('call_block_time')}} + {% endif %} + + UNION ALL + + SELECT + account_burnAccount as account_source, null as account_destination + , bytearray_to_uint256(bytearray_reverse(bytearray_substring(call_data,1+1,8))) as amount + , call_tx_id, call_block_time, call_block_slot, call_outer_executing_account, call_tx_signer + , 'burn' as action + , call_outer_instruction_index, call_inner_instruction_index + , null as fee + , 'token2022' as token_version + FROM {{ source('spl_token_2022_solana','spl_token_2022_call_burn') }} + WHERE 1=1 + {% if is_incremental() %} + AND {{incremental_predicate('call_block_time')}} + {% endif %} + + UNION ALL + + SELECT + account_burnAccount as account_source, null as account_destination + , bytearray_to_uint256(bytearray_reverse(bytearray_substring(call_data,1+1,8))) as amount + , call_tx_id, call_block_time, call_block_slot, call_outer_executing_account, call_tx_signer + , 'burn' as action + , call_outer_instruction_index, call_inner_instruction_index + , null as fee + , 'token2022' as token_version + FROM {{ source('spl_token_2022_solana','spl_token_2022_call_burnChecked') }} + WHERE 1=1 + {% if is_incremental() %} + AND {{incremental_predicate('call_block_time')}} + {% endif %} + + --token2022 transferFeeExtension has some extra complications. It's the only extension with its own transferChecked wrapper (confidential transfers will have this too) + UNION ALL + + SELECT + call_account_arguments[1] as account_source, call_account_arguments[3] as account_destination + , bytearray_to_uint256(bytearray_reverse(bytearray_substring(call_data,1+2,8))) as amount + , call_tx_id, call_block_time, call_block_slot, call_outer_executing_account, call_tx_signer + , 'transfer' as action + , call_outer_instruction_index, call_inner_instruction_index + , bytearray_to_uint256(bytearray_reverse(bytearray_substring(call_data, 1+2+8+1,8))) as fee + , 'token2022' as token_version + FROM {{ source('spl_token_2022_solana','spl_token_2022_call_transferFeeExtension') }} + WHERE bytearray_substring(call_data,1,2) = 0x1a01 --https://github.com/solana-labs/solana-program-library/blob/8f50c6fabc6ec87ada229e923030381f573e0aed/token/program-2022/src/extension/transfer_fee/instruction.rs#L284 + {% if is_incremental() %} + AND {{incremental_predicate('call_block_time')}} + {% endif %} +) + +SELECT + call_block_time as block_time + , cast (date_trunc('day', call_block_time) as date) as block_date + , call_block_slot as block_slot + , action + , amount + , fee + , account_source as from_token_account + , account_destination as to_token_account + , token_version + , call_tx_signer as tx_signer + , call_tx_id as tx_id + , call_outer_instruction_index as outer_instruction_index + , COALESCE(call_inner_instruction_index,0) as inner_instruction_index + , call_outer_executing_account as outer_executing_account +FROM base tr +-- AND call_block_time > now() - interval '90' day --for faster CI testing \ No newline at end of file diff --git a/models/tokens/solana/tokens_solana_transfers.sql b/models/tokens/solana/tokens_solana_transfers.sql index a28903cf3d4..228ba1c332d 100644 --- a/models/tokens/solana/tokens_solana_transfers.sql +++ b/models/tokens/solana/tokens_solana_transfers.sql @@ -14,56 +14,69 @@ \'["ilemi"]\') }}') }} + +WITH +base as ( + SELECT + block_time, + , call_block_slot as block_slot + , action + , amount + , fee + , from_token_account + , to_token_account + , token_version + , tx_signer + , tx_id + , outer_instruction_index + , inner_instruction_index + , outer_executing_account +FROM {{ ref('tokens_solana_spl_transfers') }} +{% if is_incremental() %} +WHERE {{incremental_predicate('block_time')}} +{% endif %} +UNION ALL + SELECT + block_time, + , call_block_slot as block_slot + , action + , amount + , fee + , from_token_account + , to_token_account + , token_version + , tx_signer + , tx_id + , outer_instruction_index + , inner_instruction_index + , outer_executing_account +FROM {{ ref('tokens_solana_token22_spl_transfers') }} +{% if is_incremental() %} +WHERE {{incremental_predicate('block_time')}} +{% endif %} +) + SELECT call_block_time as block_time , cast (date_trunc('day', call_block_time) as date) as block_date , call_block_slot as block_slot , action , amount + , fee , COALESCE(tk_s.token_mint_address, tk_d.token_mint_address) as token_mint_address , tk_s.token_balance_owner as from_owner , tk_d.token_balance_owner as to_owner - , account_source as from_token_account - , account_destination as to_token_account - , call_tx_signer as tx_signer - , call_tx_id as tx_id - , call_outer_instruction_index as outer_instruction_index - , COALESCE(call_inner_instruction_index,0) as inner_instruction_index - , call_outer_executing_account as outer_executing_account -FROM ( - SELECT account_source, account_destination, amount, call_tx_id, call_block_time, call_block_slot, call_outer_executing_account, call_tx_signer, 'transfer' as action, call_outer_instruction_index, call_inner_instruction_index - FROM {{ source('spl_token_solana','spl_token_call_transfer') }} - - UNION ALL - - SELECT account_source, account_destination, amount, call_tx_id, call_block_time, call_block_slot, call_outer_executing_account, call_tx_signer, 'transfer' as action, call_outer_instruction_index, call_inner_instruction_index - FROM {{ source('spl_token_solana','spl_token_call_transferChecked') }} - - UNION ALL - - SELECT null, account_account as account_destination, amount, call_tx_id, call_block_time, call_block_slot, call_outer_executing_account, call_tx_signer, 'mint' as action, call_outer_instruction_index, call_inner_instruction_index - FROM {{ source('spl_token_solana','spl_token_call_mintTo') }} - - UNION ALL - - SELECT null, account_account as account_destination, amount, call_tx_id, call_block_time, call_block_slot, call_outer_executing_account, call_tx_signer, 'mint' as action, call_outer_instruction_index, call_inner_instruction_index - FROM {{ source('spl_token_solana','spl_token_call_mintToChecked') }} - - UNION ALL - - SELECT account_account as account_source, null, amount, call_tx_id, call_block_time, call_block_slot, call_outer_executing_account, call_tx_signer, 'burn' as action, call_outer_instruction_index, call_inner_instruction_index - FROM {{ source('spl_token_solana','spl_token_call_burn') }} - - UNION ALL - - SELECT account_account as account_source, null, amount, call_tx_id, call_block_time, call_block_slot, call_outer_executing_account, call_tx_signer, 'burn' as action, call_outer_instruction_index, call_inner_instruction_index - FROM {{ source('spl_token_solana','spl_token_call_burnChecked') }} -) tr + , from_token_account + , to_token_account + , token_version + , tx_signer + , tx_id + , outer_instruction_index + , inner_instruction_index + , outer_executing_account +FROM base tr --get token and accounts -LEFT JOIN {{ ref('solana_utils_token_accounts') }} tk_s ON tk_s.address = tr.account_source -LEFT JOIN {{ ref('solana_utils_token_accounts') }} tk_d ON tk_d.address = tr.account_destination +INNER JOIN {{ ref('solana_utils_token_accounts') }} tk_s ON tk_s.address = tr.account_source +INNER JOIN {{ ref('solana_utils_token_accounts') }} tk_d ON tk_d.address = tr.account_destination WHERE 1=1 -{% if is_incremental() %} -AND {{incremental_predicate('call_block_time')}} -{% endif %} --- AND call_block_time > now() - interval '600' day \ No newline at end of file +-- AND call_block_time > now() - interval '90' day --for faster CI testing \ No newline at end of file From a4fd148f50f92b812c845b41b725bf311e4b294e Mon Sep 17 00:00:00 2001 From: Alan Ghobadi Date: Mon, 10 Jun 2024 16:50:39 +0200 Subject: [PATCH 075/149] Test without decoding amount manually (#6123) --- .../tokens/solana/tokens_solana_spl_transfers_call_transfer.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/models/tokens/solana/tokens_solana_spl_transfers_call_transfer.sql b/models/tokens/solana/tokens_solana_spl_transfers_call_transfer.sql index cc319990015..587baf5fa2e 100644 --- a/models/tokens/solana/tokens_solana_spl_transfers_call_transfer.sql +++ b/models/tokens/solana/tokens_solana_spl_transfers_call_transfer.sql @@ -16,7 +16,7 @@ SELECT , cast (date_trunc('day', call_block_time) as date) as block_date , call_block_slot as block_slot , 'transfer' as action - , bytearray_to_uint256(bytearray_reverse(bytearray_substring(call_data,1+1,8))) as amount + , amount , cast(null as double) as fee , account_source as from_token_account , account_destination as to_token_account From dcfb6725cf1de5629c04cb5e765df69ed581330e Mon Sep 17 00:00:00 2001 From: Alan Ghobadi Date: Mon, 10 Jun 2024 17:19:22 +0200 Subject: [PATCH 076/149] Add block_month and partition by it (#6127) --- .../solana/tokens_solana_spl_transfers_call_transfer.sql | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/models/tokens/solana/tokens_solana_spl_transfers_call_transfer.sql b/models/tokens/solana/tokens_solana_spl_transfers_call_transfer.sql index 587baf5fa2e..856c6c48de7 100644 --- a/models/tokens/solana/tokens_solana_spl_transfers_call_transfer.sql +++ b/models/tokens/solana/tokens_solana_spl_transfers_call_transfer.sql @@ -5,7 +5,7 @@ materialized = 'incremental', file_format = 'delta', incremental_strategy = 'merge', - partition_by = ['block_date'], + partition_by = ['block_month'], incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.block_time')], unique_key = ['tx_id','outer_instruction_index','inner_instruction_index', 'block_slot'] ) @@ -14,6 +14,7 @@ SELECT call_block_time as block_time , cast (date_trunc('day', call_block_time) as date) as block_date + , cast (date_trunc('month', call_block_time) as date) as block_month , call_block_slot as block_slot , 'transfer' as action , amount From 26dd8a1f3c4aab89598c88775c382d8424213cd5 Mon Sep 17 00:00:00 2001 From: Alan Ghobadi Date: Mon, 10 Jun 2024 17:57:18 +0200 Subject: [PATCH 077/149] Revert solana transfers (#6130) * Revert "Add block_month and partition by it (#6127)" This reverts commit dcfb6725cf1de5629c04cb5e765df69ed581330e. * Revert "Test without decoding amount manually (#6123)" This reverts commit a4fd148f50f92b812c845b41b725bf311e4b294e. * Revert "Reapply "add back changes for solana token 2022 (#6107)" (#6124) (#6126)" This reverts commit 3e18bfee4b1a499b9b40df730fa0d98d9fc6ecc9. --- models/tokens/solana/tokens_solana_schema.yml | 5 +- .../solana/tokens_solana_spl_transfers.sql | 131 ---------------- ...ens_solana_spl_transfers_call_transfer.sql | 34 ---- .../tokens_solana_token22_spl_transfers.sql | 145 ------------------ .../tokens/solana/tokens_solana_transfers.sql | 97 +++++------- 5 files changed, 43 insertions(+), 369 deletions(-) delete mode 100644 models/tokens/solana/tokens_solana_spl_transfers.sql delete mode 100644 models/tokens/solana/tokens_solana_spl_transfers_call_transfer.sql delete mode 100644 models/tokens/solana/tokens_solana_token22_spl_transfers.sql diff --git a/models/tokens/solana/tokens_solana_schema.yml b/models/tokens/solana/tokens_solana_schema.yml index 7242599a841..4a6bd1a599e 100644 --- a/models/tokens/solana/tokens_solana_schema.yml +++ b/models/tokens/solana/tokens_solana_schema.yml @@ -97,7 +97,7 @@ models: config: tags: ['solana','transfers','erc20','nft','spl'] description: > - get all spl token transfers + get all spl token transfers (will add in token2022 later) columns: - name: block_time - name: block_date @@ -105,13 +105,10 @@ models: - name: action - name: token_mint_address - name: amount - - name: fee - - name: token_version - name: from_owner - name: to_owner - name: from_token_account - name: to_token_account - - name: token_version - name: tx_signer - name: tx_id - name: outer_instruction_index diff --git a/models/tokens/solana/tokens_solana_spl_transfers.sql b/models/tokens/solana/tokens_solana_spl_transfers.sql deleted file mode 100644 index 2f788049ac5..00000000000 --- a/models/tokens/solana/tokens_solana_spl_transfers.sql +++ /dev/null @@ -1,131 +0,0 @@ - {{ - config( - schema = 'tokens_solana', - alias = 'spl_transfers', - materialized = 'incremental', - file_format = 'delta', - incremental_strategy = 'merge', - partition_by = ['block_date'], - incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.block_time')], - unique_key = ['tx_id','outer_instruction_index','inner_instruction_index', 'block_slot'] - ) -}} - - -WITH -base as ( - SELECT - account_source, account_destination - , bytearray_to_uint256(bytearray_reverse(bytearray_substring(call_data,1+1,8))) as amount - , call_tx_id, call_block_time, call_block_slot, call_outer_executing_account, call_tx_signer - , 'transfer' as action - , call_outer_instruction_index, call_inner_instruction_index - , cast(null as double) as fee - , 'spl_token' as token_version - FROM {{ source('spl_token_solana','spl_token_call_transferChecked') }} - WHERE 1=1 - {% if is_incremental() %} - AND {{incremental_predicate('call_block_time')}} - {% endif %} - - UNION ALL - - SELECT - null as account_source, account_account as account_destination - , bytearray_to_uint256(bytearray_reverse(bytearray_substring(call_data,1+1,8))) as amount - , call_tx_id, call_block_time, call_block_slot, call_outer_executing_account, call_tx_signer - , 'mint' as action - , call_outer_instruction_index, call_inner_instruction_index - , cast(null as double) as fee - , 'spl_token' as token_version - FROM {{ source('spl_token_solana','spl_token_call_mintTo') }} - WHERE 1=1 - {% if is_incremental() %} - AND {{incremental_predicate('call_block_time')}} - {% endif %} - - UNION ALL - - SELECT - null as account_source, account_account as account_destination - , bytearray_to_uint256(bytearray_reverse(bytearray_substring(call_data,1+1,8))) as amount - , call_tx_id, call_block_time, call_block_slot, call_outer_executing_account, call_tx_signer - , 'mint' as action - , call_outer_instruction_index, call_inner_instruction_index - , cast(null as double) as fee - , 'spl_token' as token_version - FROM {{ source('spl_token_solana','spl_token_call_mintToChecked') }} - WHERE 1=1 - {% if is_incremental() %} - AND {{incremental_predicate('call_block_time')}} - {% endif %} - - UNION ALL - - SELECT - account_account as account_source, null as account_destination - , bytearray_to_uint256(bytearray_reverse(bytearray_substring(call_data,1+1,8))) as amount - , call_tx_id, call_block_time, call_block_slot, call_outer_executing_account, call_tx_signer - , 'burn' as action - , call_outer_instruction_index, call_inner_instruction_index - , cast(null as double) as fee - , 'spl_token' as token_version - FROM {{ source('spl_token_solana','spl_token_call_burn') }} - WHERE 1=1 - {% if is_incremental() %} - AND {{incremental_predicate('call_block_time')}} - {% endif %} - - UNION ALL - - SELECT - account_account as account_source, null as account_destination - , bytearray_to_uint256(bytearray_reverse(bytearray_substring(call_data,1+1,8))) as amount - , call_tx_id, call_block_time, call_block_slot, call_outer_executing_account, call_tx_signer - , 'burn' as action - , call_outer_instruction_index, call_inner_instruction_index - , cast(null as double) as fee - , 'spl_token' as token_version - FROM {{ source('spl_token_solana','spl_token_call_burnChecked') }} - WHERE 1=1 - {% if is_incremental() %} - AND {{incremental_predicate('call_block_time')}} - {% endif %} -) - -SELECT - call_block_time as block_time - , cast (date_trunc('day', call_block_time) as date) as block_date - , call_block_slot as block_slot - , action - , amount - , fee - , account_source as from_token_account - , account_destination as to_token_account - , token_version - , call_tx_signer as tx_signer - , call_tx_id as tx_id - , call_outer_instruction_index as outer_instruction_index - , COALESCE(call_inner_instruction_index,0) as inner_instruction_index - , call_outer_executing_account as outer_executing_account -FROM base -UNION ALL -SELECT - block_time - , block_date - , block_slot - , action - , amount - , fee - , from_token_account - , to_token_account - , token_version - , tx_signer - , tx_id - , outer_instruction_index - , inner_instruction_index - , outer_executing_account - FROM {{ref('tokens_solana_spl_transfers_call_transfer')}} -{% if is_incremental() %} - AND {{incremental_predicate('call_block_time')}} - {% endif %} \ No newline at end of file diff --git a/models/tokens/solana/tokens_solana_spl_transfers_call_transfer.sql b/models/tokens/solana/tokens_solana_spl_transfers_call_transfer.sql deleted file mode 100644 index 856c6c48de7..00000000000 --- a/models/tokens/solana/tokens_solana_spl_transfers_call_transfer.sql +++ /dev/null @@ -1,34 +0,0 @@ - {{ - config( - schema = 'tokens_solana', - alias = 'spl_transfers_call_transfer', - materialized = 'incremental', - file_format = 'delta', - incremental_strategy = 'merge', - partition_by = ['block_month'], - incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.block_time')], - unique_key = ['tx_id','outer_instruction_index','inner_instruction_index', 'block_slot'] - ) -}} - -SELECT - call_block_time as block_time - , cast (date_trunc('day', call_block_time) as date) as block_date - , cast (date_trunc('month', call_block_time) as date) as block_month - , call_block_slot as block_slot - , 'transfer' as action - , amount - , cast(null as double) as fee - , account_source as from_token_account - , account_destination as to_token_account - , 'spl_token' as token_version - , call_tx_signer as tx_signer - , call_tx_id as tx_id - , call_outer_instruction_index as outer_instruction_index - , COALESCE(call_inner_instruction_index,0) as inner_instruction_index - , call_outer_executing_account as outer_executing_account -FROM {{ source('spl_token_solana','spl_token_call_transfer') }} -WHERE 1=1 -{% if is_incremental() %} -AND {{incremental_predicate('call_block_time')}} -{% endif %} diff --git a/models/tokens/solana/tokens_solana_token22_spl_transfers.sql b/models/tokens/solana/tokens_solana_token22_spl_transfers.sql deleted file mode 100644 index 9ebc9bff9cb..00000000000 --- a/models/tokens/solana/tokens_solana_token22_spl_transfers.sql +++ /dev/null @@ -1,145 +0,0 @@ - {{ - config( - schema = 'tokens_solana', - alias = 'token22_spl_transfers', - materialized = 'incremental', - file_format = 'delta', - incremental_strategy = 'merge', - partition_by = ['block_date'], - incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.block_time')], - unique_key = ['tx_id','outer_instruction_index','inner_instruction_index', 'block_slot'] - ) -}} - - -WITH -base as ( - --token2022. Most mint and account extensions still use the parent transferChecked instruction, hooks are excecuted after and interest-bearing is precalculated. - SELECT - account_source, account_destination, amount - , call_tx_id, call_block_time, call_block_slot, call_outer_executing_account, call_tx_signer - , action - , call_outer_instruction_index, call_inner_instruction_index - , fee - , token_version - FROM ( - SELECT - account_source, account_destination - , bytearray_to_uint256(bytearray_reverse(bytearray_substring(call_data,1+1,8))) as amount --note that interestbearing mints have a different amount methodology, to add later - , call_tx_id, call_block_time, call_block_slot, call_outer_executing_account, call_tx_signer - , 'transfer' as action - , call_outer_instruction_index, call_inner_instruction_index - , least( - cast(bytearray_to_uint256(bytearray_reverse(bytearray_substring(call_data,1+1,8))) as double) - *cast(f.fee_basis as double)/10000 - ,f.fee_maximum) as fee --we want to take the percent fee on total amount, but not exceed the maximum fee - , 'token2022' as token_version - , f.fee_time - , row_number() over (partition by tr.call_tx_id, tr.call_outer_instruction_index, tr.call_inner_instruction_index order by f.fee_time desc) as latest_fee - FROM {{ source('spl_token_2022_solana','spl_token_2022_call_transferChecked') }} tr - LEFT JOIN {{ ref('tokens_solana_fees_history') }} f ON tr.account_tokenMint = f.account_mint AND tr.call_block_time >= f.fee_time - WHERE 1=1 - {% if is_incremental() %} - AND {{incremental_predicate('tr.call_block_time')}} - {% endif %} - ) WHERE latest_fee = 1 - - UNION ALL - - SELECT - null as account_source, account_mintTo as account_destination - , bytearray_to_uint256(bytearray_reverse(bytearray_substring(call_data,1+1,8))) as amount - , call_tx_id, call_block_time, call_block_slot, call_outer_executing_account, call_tx_signer - , 'mint' as action - , call_outer_instruction_index, call_inner_instruction_index - , null as fee - , 'token2022' as token_version - FROM {{ source('spl_token_2022_solana','spl_token_2022_call_mintTo') }} - WHERE 1=1 - {% if is_incremental() %} - AND {{incremental_predicate('call_block_time')}} - {% endif %} - - UNION ALL - - SELECT - null as account_source, account_mintTo as account_destination - , bytearray_to_uint256(bytearray_reverse(bytearray_substring(call_data,1+1,8))) as amount - , call_tx_id, call_block_time, call_block_slot, call_outer_executing_account, call_tx_signer - , 'mint' as action - , call_outer_instruction_index, call_inner_instruction_index - , null as fee - , 'token2022' as token_version - FROM {{ source('spl_token_2022_solana','spl_token_2022_call_mintToChecked') }} - WHERE 1=1 - {% if is_incremental() %} - AND {{incremental_predicate('call_block_time')}} - {% endif %} - - UNION ALL - - SELECT - account_burnAccount as account_source, null as account_destination - , bytearray_to_uint256(bytearray_reverse(bytearray_substring(call_data,1+1,8))) as amount - , call_tx_id, call_block_time, call_block_slot, call_outer_executing_account, call_tx_signer - , 'burn' as action - , call_outer_instruction_index, call_inner_instruction_index - , null as fee - , 'token2022' as token_version - FROM {{ source('spl_token_2022_solana','spl_token_2022_call_burn') }} - WHERE 1=1 - {% if is_incremental() %} - AND {{incremental_predicate('call_block_time')}} - {% endif %} - - UNION ALL - - SELECT - account_burnAccount as account_source, null as account_destination - , bytearray_to_uint256(bytearray_reverse(bytearray_substring(call_data,1+1,8))) as amount - , call_tx_id, call_block_time, call_block_slot, call_outer_executing_account, call_tx_signer - , 'burn' as action - , call_outer_instruction_index, call_inner_instruction_index - , null as fee - , 'token2022' as token_version - FROM {{ source('spl_token_2022_solana','spl_token_2022_call_burnChecked') }} - WHERE 1=1 - {% if is_incremental() %} - AND {{incremental_predicate('call_block_time')}} - {% endif %} - - --token2022 transferFeeExtension has some extra complications. It's the only extension with its own transferChecked wrapper (confidential transfers will have this too) - UNION ALL - - SELECT - call_account_arguments[1] as account_source, call_account_arguments[3] as account_destination - , bytearray_to_uint256(bytearray_reverse(bytearray_substring(call_data,1+2,8))) as amount - , call_tx_id, call_block_time, call_block_slot, call_outer_executing_account, call_tx_signer - , 'transfer' as action - , call_outer_instruction_index, call_inner_instruction_index - , bytearray_to_uint256(bytearray_reverse(bytearray_substring(call_data, 1+2+8+1,8))) as fee - , 'token2022' as token_version - FROM {{ source('spl_token_2022_solana','spl_token_2022_call_transferFeeExtension') }} - WHERE bytearray_substring(call_data,1,2) = 0x1a01 --https://github.com/solana-labs/solana-program-library/blob/8f50c6fabc6ec87ada229e923030381f573e0aed/token/program-2022/src/extension/transfer_fee/instruction.rs#L284 - {% if is_incremental() %} - AND {{incremental_predicate('call_block_time')}} - {% endif %} -) - -SELECT - call_block_time as block_time - , cast (date_trunc('day', call_block_time) as date) as block_date - , call_block_slot as block_slot - , action - , amount - , fee - , account_source as from_token_account - , account_destination as to_token_account - , token_version - , call_tx_signer as tx_signer - , call_tx_id as tx_id - , call_outer_instruction_index as outer_instruction_index - , COALESCE(call_inner_instruction_index,0) as inner_instruction_index - , call_outer_executing_account as outer_executing_account -FROM base tr --- AND call_block_time > now() - interval '90' day --for faster CI testing \ No newline at end of file diff --git a/models/tokens/solana/tokens_solana_transfers.sql b/models/tokens/solana/tokens_solana_transfers.sql index 228ba1c332d..a28903cf3d4 100644 --- a/models/tokens/solana/tokens_solana_transfers.sql +++ b/models/tokens/solana/tokens_solana_transfers.sql @@ -14,69 +14,56 @@ \'["ilemi"]\') }}') }} - -WITH -base as ( - SELECT - block_time, - , call_block_slot as block_slot - , action - , amount - , fee - , from_token_account - , to_token_account - , token_version - , tx_signer - , tx_id - , outer_instruction_index - , inner_instruction_index - , outer_executing_account -FROM {{ ref('tokens_solana_spl_transfers') }} -{% if is_incremental() %} -WHERE {{incremental_predicate('block_time')}} -{% endif %} -UNION ALL - SELECT - block_time, - , call_block_slot as block_slot - , action - , amount - , fee - , from_token_account - , to_token_account - , token_version - , tx_signer - , tx_id - , outer_instruction_index - , inner_instruction_index - , outer_executing_account -FROM {{ ref('tokens_solana_token22_spl_transfers') }} -{% if is_incremental() %} -WHERE {{incremental_predicate('block_time')}} -{% endif %} -) - SELECT call_block_time as block_time , cast (date_trunc('day', call_block_time) as date) as block_date , call_block_slot as block_slot , action , amount - , fee , COALESCE(tk_s.token_mint_address, tk_d.token_mint_address) as token_mint_address , tk_s.token_balance_owner as from_owner , tk_d.token_balance_owner as to_owner - , from_token_account - , to_token_account - , token_version - , tx_signer - , tx_id - , outer_instruction_index - , inner_instruction_index - , outer_executing_account -FROM base tr + , account_source as from_token_account + , account_destination as to_token_account + , call_tx_signer as tx_signer + , call_tx_id as tx_id + , call_outer_instruction_index as outer_instruction_index + , COALESCE(call_inner_instruction_index,0) as inner_instruction_index + , call_outer_executing_account as outer_executing_account +FROM ( + SELECT account_source, account_destination, amount, call_tx_id, call_block_time, call_block_slot, call_outer_executing_account, call_tx_signer, 'transfer' as action, call_outer_instruction_index, call_inner_instruction_index + FROM {{ source('spl_token_solana','spl_token_call_transfer') }} + + UNION ALL + + SELECT account_source, account_destination, amount, call_tx_id, call_block_time, call_block_slot, call_outer_executing_account, call_tx_signer, 'transfer' as action, call_outer_instruction_index, call_inner_instruction_index + FROM {{ source('spl_token_solana','spl_token_call_transferChecked') }} + + UNION ALL + + SELECT null, account_account as account_destination, amount, call_tx_id, call_block_time, call_block_slot, call_outer_executing_account, call_tx_signer, 'mint' as action, call_outer_instruction_index, call_inner_instruction_index + FROM {{ source('spl_token_solana','spl_token_call_mintTo') }} + + UNION ALL + + SELECT null, account_account as account_destination, amount, call_tx_id, call_block_time, call_block_slot, call_outer_executing_account, call_tx_signer, 'mint' as action, call_outer_instruction_index, call_inner_instruction_index + FROM {{ source('spl_token_solana','spl_token_call_mintToChecked') }} + + UNION ALL + + SELECT account_account as account_source, null, amount, call_tx_id, call_block_time, call_block_slot, call_outer_executing_account, call_tx_signer, 'burn' as action, call_outer_instruction_index, call_inner_instruction_index + FROM {{ source('spl_token_solana','spl_token_call_burn') }} + + UNION ALL + + SELECT account_account as account_source, null, amount, call_tx_id, call_block_time, call_block_slot, call_outer_executing_account, call_tx_signer, 'burn' as action, call_outer_instruction_index, call_inner_instruction_index + FROM {{ source('spl_token_solana','spl_token_call_burnChecked') }} +) tr --get token and accounts -INNER JOIN {{ ref('solana_utils_token_accounts') }} tk_s ON tk_s.address = tr.account_source -INNER JOIN {{ ref('solana_utils_token_accounts') }} tk_d ON tk_d.address = tr.account_destination +LEFT JOIN {{ ref('solana_utils_token_accounts') }} tk_s ON tk_s.address = tr.account_source +LEFT JOIN {{ ref('solana_utils_token_accounts') }} tk_d ON tk_d.address = tr.account_destination WHERE 1=1 --- AND call_block_time > now() - interval '90' day --for faster CI testing \ No newline at end of file +{% if is_incremental() %} +AND {{incremental_predicate('call_block_time')}} +{% endif %} +-- AND call_block_time > now() - interval '600' day \ No newline at end of file From 514d4daf84cfd85b81cd2614ad0d0caa749c9eca Mon Sep 17 00:00:00 2001 From: jeff-dude <102681548+jeff-dude@users.noreply.github.com> Date: Mon, 10 Jun 2024 13:41:50 -0400 Subject: [PATCH 078/149] fix decimal on nmt (#6132) --- models/prices/ethereum/prices_ethereum_tokens.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/models/prices/ethereum/prices_ethereum_tokens.sql b/models/prices/ethereum/prices_ethereum_tokens.sql index 92871a6c600..fc3ec0a7981 100644 --- a/models/prices/ethereum/prices_ethereum_tokens.sql +++ b/models/prices/ethereum/prices_ethereum_tokens.sql @@ -1749,7 +1749,7 @@ FROM ('zyn-zyncoin', 'ethereum', 'ZYN', 0x58cb30368ceb2d194740b144eab4c2da8a917dcb, 18), ('nut6-nutcoin', 'ethereum', 'NUT', 0x473f4068073cd5b2ab0e4cc8e146f9edc6fb52cc, 18), --('gswift-gameswift', 'ethereum', 'GSWIFT', 0x580e933d90091b9ce380740e3a4a39c67eb85b4c, 18), - ('nmt-netmind-token', 'ethereum', 'NMT', 0x03aa6298f1370642642415edc0db8b957783e8d6, 9), + ('nmt-netmind-token', 'ethereum', 'NMT', 0x03aa6298f1370642642415edc0db8b957783e8d6, 18), ('simpson-homer', 'ethereum', 'SIMPSON', 0x44aAd22aFbB2606d7828Ca1f8f9E5af00e779AE1, 9), ('pongo-pongo', 'ethereum', 'PONGO', 0x7c68e725b0b2ffcba8947fded4198c3d1db041e6, 9), ('truf-truflation', 'ethereum', 'TRUF', 0x38c2a4a7330b22788374b8ff70bba513c8d848ca, 18 ), From fd6b7b592f244d7c2124a12d0e39b7bfe517c013 Mon Sep 17 00:00:00 2001 From: Mansi <122999960+IrishLatte19@users.noreply.github.com> Date: Mon, 10 Jun 2024 23:13:17 +0530 Subject: [PATCH 079/149] Update prices_arbitrum_tokens.sql (#6125) Added SLIZ Token --- models/prices/arbitrum/prices_arbitrum_tokens.sql | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/models/prices/arbitrum/prices_arbitrum_tokens.sql b/models/prices/arbitrum/prices_arbitrum_tokens.sql index bd90cb14f97..7a9e4e72e78 100644 --- a/models/prices/arbitrum/prices_arbitrum_tokens.sql +++ b/models/prices/arbitrum/prices_arbitrum_tokens.sql @@ -195,5 +195,6 @@ FROM ('yak-yield-yak','arbitrum','YAK',0x7f4db37d7beb31f445307782bc3da0f18df13696,18), ('ethx-stader-ethx','arbitrum','ETHX',0xed65c5085a18fa160af0313e60dcc7905e944dc7, 18), ('gyd-gyro-dollar','arbitrum','GYD',0xca5d8f8a8d49439357d3cf46ca2e720702f132b8, 18), - ('a51-a51-finance','arbitrum','A51',0xb3f13b0c61d65d67d7d6215d70c89533ee567a91, 18) + ('a51-a51-finance','arbitrum','A51',0xb3f13b0c61d65d67d7d6215d70c89533ee567a91, 18), + ('sliz-solidlizard-dex-token','arbitrum','SLIZ',0x463913D3a3D3D291667D53B8325c598Eb88D3B0e, 18) ) as temp (token_id, blockchain, symbol, contract_address, decimals) From 4d32478845b7a8d9a52873805767cf390b51e06a Mon Sep 17 00:00:00 2001 From: viniabussafi <131974393+viniabussafi@users.noreply.github.com> Date: Mon, 10 Jun 2024 18:43:39 +0100 Subject: [PATCH 080/149] add missing tokens (#6119) --- tokens/models/tokens/ethereum/tokens_ethereum_erc20.sql | 1 + tokens/models/tokens/polygon/tokens_polygon_erc20.sql | 1 + 2 files changed, 2 insertions(+) diff --git a/tokens/models/tokens/ethereum/tokens_ethereum_erc20.sql b/tokens/models/tokens/ethereum/tokens_ethereum_erc20.sql index 62ef16eec19..c705c19dd55 100644 --- a/tokens/models/tokens/ethereum/tokens_ethereum_erc20.sql +++ b/tokens/models/tokens/ethereum/tokens_ethereum_erc20.sql @@ -4561,4 +4561,5 @@ FROM (VALUES , ( 0xf1617882a71467534d14eee865922de1395c9e89, 'saETH', 18) , ( 0x9deb0fc809955b79c85e82918e8586d3b7d2695a, 'GOLD', 18) , ( 0x75e88b8c2d34a52a6d36deada664d7dc9116e4ef, 'ZRS', 18) + , ( 0x80ac24aA929eaF5013f6436cdA2a7ba190f5Cc0b, 'syrupUSDC', 6) ) AS temp_table (contract_address, symbol, decimals) diff --git a/tokens/models/tokens/polygon/tokens_polygon_erc20.sql b/tokens/models/tokens/polygon/tokens_polygon_erc20.sql index b06b1a94781..aeb41337634 100644 --- a/tokens/models/tokens/polygon/tokens_polygon_erc20.sql +++ b/tokens/models/tokens/polygon/tokens_polygon_erc20.sql @@ -44,4 +44,5 @@ FROM (VALUES , (0x416101d98df2187ddc0ff29b787ded19dd8c9740, 'MRK', 18) , (0x5d0270967bab81d0822e500b986cb6652186eaa9, 'AUC02', 18) , (0xc3323b6e71925b25943fb7369ee6769837e9c676, 'PORIGON', 18) + , (0x365e13f973bd62024be8a70a225684c58baad03c, 'MPM', 18) ) AS temp_table (contract_address, symbol, decimals) From 27e60246c6906990320355da61897f8239ce505c Mon Sep 17 00:00:00 2001 From: cheeky-gorilla <76262359+cheeky-gorilla@users.noreply.github.com> Date: Mon, 10 Jun 2024 10:45:00 -0700 Subject: [PATCH 081/149] Add TAIKO ERC-20 token to Ethereum mainnet (#6109) Co-authored-by: Huang Geyang Co-authored-by: jeff-dude <102681548+jeff-dude@users.noreply.github.com> --- tokens/models/tokens/ethereum/tokens_ethereum_erc20.sql | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tokens/models/tokens/ethereum/tokens_ethereum_erc20.sql b/tokens/models/tokens/ethereum/tokens_ethereum_erc20.sql index c705c19dd55..63279683be9 100644 --- a/tokens/models/tokens/ethereum/tokens_ethereum_erc20.sql +++ b/tokens/models/tokens/ethereum/tokens_ethereum_erc20.sql @@ -4560,6 +4560,7 @@ FROM (VALUES , ( 0xfc87753df5ef5c368b5fba8d4c5043b77e8c5b39, 'aETH', 18) , ( 0xf1617882a71467534d14eee865922de1395c9e89, 'saETH', 18) , ( 0x9deb0fc809955b79c85e82918e8586d3b7d2695a, 'GOLD', 18) - , ( 0x75e88b8c2d34a52a6d36deada664d7dc9116e4ef, 'ZRS', 18) + , ( 0x75e88b8c2d34a52a6d36deada664d7dc9116e4ef, 'ZRS', 18) + , ( 0x10dea67478c5f8c5e2d90e5e9b26dbe60c54d800, 'TAIKO', 18) , ( 0x80ac24aA929eaF5013f6436cdA2a7ba190f5Cc0b, 'syrupUSDC', 6) ) AS temp_table (contract_address, symbol, decimals) From 2572bcae207c3848e1fe7f68c80dae4249317a0d Mon Sep 17 00:00:00 2001 From: yy-analytics <103118737+yy-analytics@users.noreply.github.com> Date: Mon, 10 Jun 2024 23:15:33 +0530 Subject: [PATCH 082/149] New strategies for Yield Yak (#6096) * Added a couple of very new strategies following Arbitrum LTIPP launch * Adding an additional token on Arbitrum --------- Co-authored-by: Huang Geyang --- .../_project/yield_yak/yield_yak_strategies.sql | 2 ++ .../arbitrum/yield_yak_arbitrum_sources.yml | 16 ++++++++++++++++ .../tokens/arbitrum/tokens_arbitrum_erc20.sql | 1 + 3 files changed, 19 insertions(+) diff --git a/macros/models/_project/yield_yak/yield_yak_strategies.sql b/macros/models/_project/yield_yak/yield_yak_strategies.sql index 81b77f14124..b92627b1339 100644 --- a/macros/models/_project/yield_yak/yield_yak_strategies.sql +++ b/macros/models/_project/yield_yak/yield_yak_strategies.sql @@ -139,6 +139,8 @@ 'AutoPoolStrategy', 'BalancerDirectJoinStrategy', 'BoostedPendleStrategy', + 'BoostedStargateV2NativeStrategy', + 'BoostedStargateV2Strategy', 'CompoundingBets', 'CompoundingJoe', 'CompoundingYYStaking', diff --git a/sources/yield_yak/arbitrum/yield_yak_arbitrum_sources.yml b/sources/yield_yak/arbitrum/yield_yak_arbitrum_sources.yml index c377ef0e4df..c69dba81f87 100644 --- a/sources/yield_yak/arbitrum/yield_yak_arbitrum_sources.yml +++ b/sources/yield_yak/arbitrum/yield_yak_arbitrum_sources.yml @@ -44,6 +44,22 @@ sources: loaded_at_field: evt_block_time - name: BoostedPendleStrategy_evt_Transfer loaded_at_field: evt_block_time + - name: BoostedStargateV2NativeStrategy_evt_Deposit + loaded_at_field: evt_block_time + - name: BoostedStargateV2NativeStrategy_evt_Withdraw + loaded_at_field: evt_block_time + - name: BoostedStargateV2NativeStrategy_evt_Reinvest + loaded_at_field: evt_block_time + - name: BoostedStargateV2NativeStrategy_evt_Transfer + loaded_at_field: evt_block_time + - name: BoostedStargateV2Strategy_evt_Deposit + loaded_at_field: evt_block_time + - name: BoostedStargateV2Strategy_evt_Withdraw + loaded_at_field: evt_block_time + - name: BoostedStargateV2Strategy_evt_Reinvest + loaded_at_field: evt_block_time + - name: BoostedStargateV2Strategy_evt_Transfer + loaded_at_field: evt_block_time - name: CompoundingBets_evt_Deposit loaded_at_field: evt_block_time - name: CompoundingBets_evt_Withdraw diff --git a/tokens/models/tokens/arbitrum/tokens_arbitrum_erc20.sql b/tokens/models/tokens/arbitrum/tokens_arbitrum_erc20.sql index d4a3a2f0814..6068509c347 100644 --- a/tokens/models/tokens/arbitrum/tokens_arbitrum_erc20.sql +++ b/tokens/models/tokens/arbitrum/tokens_arbitrum_erc20.sql @@ -78,4 +78,5 @@ FROM (VALUES , (0x4cb9a7ae498cedcbb5eae9f25736ae7d428c9d66, 'XAI', 18) , (0x323665443cef804a3b5206103304bd4872ea4253, 'USDV', 6) , (0x966570a84709d693463cdd69dcadb0121b2c9d26, 'taoUSD', 18) + , (0x993614e1c8c9c5abe49462ce5702431978fd767f, 'S*ETH', 18) ) AS temp_table (contract_address, symbol, decimals) From aa9a9d730318bd8baf6f7a6417c639e56f452f71 Mon Sep 17 00:00:00 2001 From: Diogo Jorge <129539341+paganys@users.noreply.github.com> Date: Mon, 10 Jun 2024 18:51:02 +0100 Subject: [PATCH 083/149] add POWER and ZERO token metadata (#6106) * add POWER and ZERO token metadata * cleanup merge to main --------- Co-authored-by: jeff-dude <102681548+jeff-dude@users.noreply.github.com> --- tokens/models/tokens/ethereum/tokens_ethereum_erc20.sql | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tokens/models/tokens/ethereum/tokens_ethereum_erc20.sql b/tokens/models/tokens/ethereum/tokens_ethereum_erc20.sql index 63279683be9..f1f191477dc 100644 --- a/tokens/models/tokens/ethereum/tokens_ethereum_erc20.sql +++ b/tokens/models/tokens/ethereum/tokens_ethereum_erc20.sql @@ -4561,6 +4561,8 @@ FROM (VALUES , ( 0xf1617882a71467534d14eee865922de1395c9e89, 'saETH', 18) , ( 0x9deb0fc809955b79c85e82918e8586d3b7d2695a, 'GOLD', 18) , ( 0x75e88b8c2d34a52a6d36deada664d7dc9116e4ef, 'ZRS', 18) + , ( 0x5983B89FA184f14917013B9C3062afD9434C5b03, 'POWER', 0) + , ( 0x988567FE094570cCE1FFdA29D1f2d842B70492be, 'ZERO', 6) , ( 0x10dea67478c5f8c5e2d90e5e9b26dbe60c54d800, 'TAIKO', 18) , ( 0x80ac24aA929eaF5013f6436cdA2a7ba190f5Cc0b, 'syrupUSDC', 6) ) AS temp_table (contract_address, symbol, decimals) From 47f772f2ffe75c8b5d47c872bf6a0306e4d04c00 Mon Sep 17 00:00:00 2001 From: Conner Edgell Date: Mon, 10 Jun 2024 14:47:13 -0400 Subject: [PATCH 084/149] CHORE: add BET to base token list (#6129) --- models/prices/base/prices_base_tokens.sql | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/models/prices/base/prices_base_tokens.sql b/models/prices/base/prices_base_tokens.sql index e4e9a24c06d..a35974ec657 100644 --- a/models/prices/base/prices_base_tokens.sql +++ b/models/prices/base/prices_base_tokens.sql @@ -111,5 +111,6 @@ FROM ('bord-base-lord', 'base', 'BORD', 0x160452f95612699d1a561a70eeeeede67c6812af, 18), ('rdnt-radiant-capital','base','RDNT',0xd722e55c1d9d9fa0021a5215cbb904b92b3dc5d4,18), ('well-moonwell', 'base', 'WELL', 0xff8adec2221f9f4d8dfbafa6b9a297d17603493d, 18), - ('mochi3-mochi', 'base', 'MOCHI', 0xf6e932ca12afa26665dc4dde7e27be02a7c02e50, 18) + ('mochi3-mochi', 'base', 'MOCHI', 0xf6e932ca12afa26665dc4dde7e27be02a7c02e50, 18), + ('bet-betbase', 'base', 'BET', 0x80F6BcedD3d4fa1035285affA30e38f464Db3895, 18) ) as temp (token_id, blockchain, symbol, contract_address, decimals) From 4336ec06398a8f518e2bb8cb92525f63a310d016 Mon Sep 17 00:00:00 2001 From: max-morrow Date: Mon, 10 Jun 2024 21:47:23 +0300 Subject: [PATCH 085/149] 1inch-U24: hot fix - update fusion_accounts (#6121) * update fusion_accounts update fusion_accounts for fusion v2 calls * added incremental to lop calls --- .../oneinch/_meta/oneinch_fusion_accounts.sql | 75 +++++++++++++------ 1 file changed, 53 insertions(+), 22 deletions(-) diff --git a/models/oneinch/_meta/oneinch_fusion_accounts.sql b/models/oneinch/_meta/oneinch_fusion_accounts.sql index 23af99466e3..5ac8cae79f8 100644 --- a/models/oneinch/_meta/oneinch_fusion_accounts.sql +++ b/models/oneinch/_meta/oneinch_fusion_accounts.sql @@ -25,56 +25,87 @@ executors as ( ) , settlements as ( - select blockchain, contract_address - from {{ ref('oneinch_blockchains') }}, unnest(fusion_settlement_addresses) as t(contract_address) + select blockchain, settlement + from {{ ref('oneinch_blockchains') }}, unnest(fusion_settlement_addresses) as t(settlement) ) , evms_traces as ( {% for blockchain in oneinch_exposed_blockchains_list() %} - select '{{ blockchain }}' as blockchain, tx_hash, "from", "to" from {{ source(blockchain, 'traces') }} - {% if is_incremental() %} - where {{ incremental_predicate('block_time') }} - {% else %} - where block_time >= {{ project_start_date }} - {% endif %} + select + '{{ blockchain }}' as blockchain + , tx_hash + , "from" as resolver_executor + , "to" as settlement + from {{ source(blockchain, 'traces') }} + where + {% if is_incremental() %} + {{ incremental_predicate('block_time') }} + {% else %} + block_time >= {{ project_start_date }} + {% endif %} {% if not loop.last %} union all {% endif %} {% endfor %} ) -, evms_transactions as ( - {% for blockchain in oneinch_exposed_blockchains_list() %} - select '{{ blockchain }}' as blockchain, hash, "from", block_time from {{ source(blockchain, 'transactions') }} +, fusion as ( + select blockchain, tx_hash, call_from as resolver_executor + from {{ ref('oneinch_lop') }} + where {% if is_incremental() %} - where {{ incremental_predicate('block_time') }} + {{ incremental_predicate('block_time') }} {% else %} - where block_time >= {{ project_start_date }} + block_time >= {{ project_start_date }} {% endif %} - {% if not loop.last %} union all {% endif %} - {% endfor %} + and flags['fusion'] ) , calls as ( - select evms_traces.blockchain, executors.resolver_name, executors.resolver_address, evms_traces.tx_hash as hash + select blockchain, resolver_name, resolver_address, tx_hash from evms_traces - join executors on evms_traces.blockchain = executors.blockchain and evms_traces."from" = executors.resolver_executor - join settlements on evms_traces.blockchain = settlements.blockchain and evms_traces."to" = settlements.contract_address + join executors using(blockchain, resolver_executor) + join settlements using(blockchain, settlement) group by 1, 2, 3, 4 + + union all + + select blockchain, resolver_name, resolver_address, tx_hash + from fusion + join executors using(blockchain, resolver_executor) +) + +, evms_transactions as ( + {% for blockchain in oneinch_exposed_blockchains_list() %} + select + '{{ blockchain }}' as blockchain + , hash as tx_hash + , "from" as tx_from + , block_time + from {{ source(blockchain, 'transactions') }} + where + {% if is_incremental() %} + {{ incremental_predicate('block_time') }} + {% else %} + block_time >= {{ project_start_date }} + {% endif %} + {% if not loop.last %} union all {% endif %} + {% endfor %} ) , txs as ( select resolver_name - , evms_transactions."from" as resolver_eoa + , tx_from as resolver_eoa , resolver_address , blockchain - , max(block_time) latest_tx_at + , max(block_time) as latest_tx_at from evms_transactions - join calls using(blockchain, hash) + join calls using(blockchain, tx_hash) group by 1, 2, 3, 4 ) +-- output -- -select +select blockchain , resolver_eoa as address , max_by(resolver_address, latest_tx_at) as resolver_address From e50f7756e8c7ca5e933d61f06f85897695cad9b0 Mon Sep 17 00:00:00 2001 From: Alan Ghobadi Date: Tue, 11 Jun 2024 10:00:05 +0200 Subject: [PATCH 086/149] Revert "Revert solana transfers (#6130)" (#6131) This reverts commit 26dd8a1f3c4aab89598c88775c382d8424213cd5. --- models/tokens/solana/tokens_solana_schema.yml | 5 +- .../solana/tokens_solana_spl_transfers.sql | 131 ++++++++++++++++ ...ens_solana_spl_transfers_call_transfer.sql | 34 ++++ .../tokens_solana_token22_spl_transfers.sql | 145 ++++++++++++++++++ .../tokens/solana/tokens_solana_transfers.sql | 97 +++++++----- 5 files changed, 369 insertions(+), 43 deletions(-) create mode 100644 models/tokens/solana/tokens_solana_spl_transfers.sql create mode 100644 models/tokens/solana/tokens_solana_spl_transfers_call_transfer.sql create mode 100644 models/tokens/solana/tokens_solana_token22_spl_transfers.sql diff --git a/models/tokens/solana/tokens_solana_schema.yml b/models/tokens/solana/tokens_solana_schema.yml index 4a6bd1a599e..7242599a841 100644 --- a/models/tokens/solana/tokens_solana_schema.yml +++ b/models/tokens/solana/tokens_solana_schema.yml @@ -97,7 +97,7 @@ models: config: tags: ['solana','transfers','erc20','nft','spl'] description: > - get all spl token transfers (will add in token2022 later) + get all spl token transfers columns: - name: block_time - name: block_date @@ -105,10 +105,13 @@ models: - name: action - name: token_mint_address - name: amount + - name: fee + - name: token_version - name: from_owner - name: to_owner - name: from_token_account - name: to_token_account + - name: token_version - name: tx_signer - name: tx_id - name: outer_instruction_index diff --git a/models/tokens/solana/tokens_solana_spl_transfers.sql b/models/tokens/solana/tokens_solana_spl_transfers.sql new file mode 100644 index 00000000000..2f788049ac5 --- /dev/null +++ b/models/tokens/solana/tokens_solana_spl_transfers.sql @@ -0,0 +1,131 @@ + {{ + config( + schema = 'tokens_solana', + alias = 'spl_transfers', + materialized = 'incremental', + file_format = 'delta', + incremental_strategy = 'merge', + partition_by = ['block_date'], + incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.block_time')], + unique_key = ['tx_id','outer_instruction_index','inner_instruction_index', 'block_slot'] + ) +}} + + +WITH +base as ( + SELECT + account_source, account_destination + , bytearray_to_uint256(bytearray_reverse(bytearray_substring(call_data,1+1,8))) as amount + , call_tx_id, call_block_time, call_block_slot, call_outer_executing_account, call_tx_signer + , 'transfer' as action + , call_outer_instruction_index, call_inner_instruction_index + , cast(null as double) as fee + , 'spl_token' as token_version + FROM {{ source('spl_token_solana','spl_token_call_transferChecked') }} + WHERE 1=1 + {% if is_incremental() %} + AND {{incremental_predicate('call_block_time')}} + {% endif %} + + UNION ALL + + SELECT + null as account_source, account_account as account_destination + , bytearray_to_uint256(bytearray_reverse(bytearray_substring(call_data,1+1,8))) as amount + , call_tx_id, call_block_time, call_block_slot, call_outer_executing_account, call_tx_signer + , 'mint' as action + , call_outer_instruction_index, call_inner_instruction_index + , cast(null as double) as fee + , 'spl_token' as token_version + FROM {{ source('spl_token_solana','spl_token_call_mintTo') }} + WHERE 1=1 + {% if is_incremental() %} + AND {{incremental_predicate('call_block_time')}} + {% endif %} + + UNION ALL + + SELECT + null as account_source, account_account as account_destination + , bytearray_to_uint256(bytearray_reverse(bytearray_substring(call_data,1+1,8))) as amount + , call_tx_id, call_block_time, call_block_slot, call_outer_executing_account, call_tx_signer + , 'mint' as action + , call_outer_instruction_index, call_inner_instruction_index + , cast(null as double) as fee + , 'spl_token' as token_version + FROM {{ source('spl_token_solana','spl_token_call_mintToChecked') }} + WHERE 1=1 + {% if is_incremental() %} + AND {{incremental_predicate('call_block_time')}} + {% endif %} + + UNION ALL + + SELECT + account_account as account_source, null as account_destination + , bytearray_to_uint256(bytearray_reverse(bytearray_substring(call_data,1+1,8))) as amount + , call_tx_id, call_block_time, call_block_slot, call_outer_executing_account, call_tx_signer + , 'burn' as action + , call_outer_instruction_index, call_inner_instruction_index + , cast(null as double) as fee + , 'spl_token' as token_version + FROM {{ source('spl_token_solana','spl_token_call_burn') }} + WHERE 1=1 + {% if is_incremental() %} + AND {{incremental_predicate('call_block_time')}} + {% endif %} + + UNION ALL + + SELECT + account_account as account_source, null as account_destination + , bytearray_to_uint256(bytearray_reverse(bytearray_substring(call_data,1+1,8))) as amount + , call_tx_id, call_block_time, call_block_slot, call_outer_executing_account, call_tx_signer + , 'burn' as action + , call_outer_instruction_index, call_inner_instruction_index + , cast(null as double) as fee + , 'spl_token' as token_version + FROM {{ source('spl_token_solana','spl_token_call_burnChecked') }} + WHERE 1=1 + {% if is_incremental() %} + AND {{incremental_predicate('call_block_time')}} + {% endif %} +) + +SELECT + call_block_time as block_time + , cast (date_trunc('day', call_block_time) as date) as block_date + , call_block_slot as block_slot + , action + , amount + , fee + , account_source as from_token_account + , account_destination as to_token_account + , token_version + , call_tx_signer as tx_signer + , call_tx_id as tx_id + , call_outer_instruction_index as outer_instruction_index + , COALESCE(call_inner_instruction_index,0) as inner_instruction_index + , call_outer_executing_account as outer_executing_account +FROM base +UNION ALL +SELECT + block_time + , block_date + , block_slot + , action + , amount + , fee + , from_token_account + , to_token_account + , token_version + , tx_signer + , tx_id + , outer_instruction_index + , inner_instruction_index + , outer_executing_account + FROM {{ref('tokens_solana_spl_transfers_call_transfer')}} +{% if is_incremental() %} + AND {{incremental_predicate('call_block_time')}} + {% endif %} \ No newline at end of file diff --git a/models/tokens/solana/tokens_solana_spl_transfers_call_transfer.sql b/models/tokens/solana/tokens_solana_spl_transfers_call_transfer.sql new file mode 100644 index 00000000000..856c6c48de7 --- /dev/null +++ b/models/tokens/solana/tokens_solana_spl_transfers_call_transfer.sql @@ -0,0 +1,34 @@ + {{ + config( + schema = 'tokens_solana', + alias = 'spl_transfers_call_transfer', + materialized = 'incremental', + file_format = 'delta', + incremental_strategy = 'merge', + partition_by = ['block_month'], + incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.block_time')], + unique_key = ['tx_id','outer_instruction_index','inner_instruction_index', 'block_slot'] + ) +}} + +SELECT + call_block_time as block_time + , cast (date_trunc('day', call_block_time) as date) as block_date + , cast (date_trunc('month', call_block_time) as date) as block_month + , call_block_slot as block_slot + , 'transfer' as action + , amount + , cast(null as double) as fee + , account_source as from_token_account + , account_destination as to_token_account + , 'spl_token' as token_version + , call_tx_signer as tx_signer + , call_tx_id as tx_id + , call_outer_instruction_index as outer_instruction_index + , COALESCE(call_inner_instruction_index,0) as inner_instruction_index + , call_outer_executing_account as outer_executing_account +FROM {{ source('spl_token_solana','spl_token_call_transfer') }} +WHERE 1=1 +{% if is_incremental() %} +AND {{incremental_predicate('call_block_time')}} +{% endif %} diff --git a/models/tokens/solana/tokens_solana_token22_spl_transfers.sql b/models/tokens/solana/tokens_solana_token22_spl_transfers.sql new file mode 100644 index 00000000000..9ebc9bff9cb --- /dev/null +++ b/models/tokens/solana/tokens_solana_token22_spl_transfers.sql @@ -0,0 +1,145 @@ + {{ + config( + schema = 'tokens_solana', + alias = 'token22_spl_transfers', + materialized = 'incremental', + file_format = 'delta', + incremental_strategy = 'merge', + partition_by = ['block_date'], + incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.block_time')], + unique_key = ['tx_id','outer_instruction_index','inner_instruction_index', 'block_slot'] + ) +}} + + +WITH +base as ( + --token2022. Most mint and account extensions still use the parent transferChecked instruction, hooks are excecuted after and interest-bearing is precalculated. + SELECT + account_source, account_destination, amount + , call_tx_id, call_block_time, call_block_slot, call_outer_executing_account, call_tx_signer + , action + , call_outer_instruction_index, call_inner_instruction_index + , fee + , token_version + FROM ( + SELECT + account_source, account_destination + , bytearray_to_uint256(bytearray_reverse(bytearray_substring(call_data,1+1,8))) as amount --note that interestbearing mints have a different amount methodology, to add later + , call_tx_id, call_block_time, call_block_slot, call_outer_executing_account, call_tx_signer + , 'transfer' as action + , call_outer_instruction_index, call_inner_instruction_index + , least( + cast(bytearray_to_uint256(bytearray_reverse(bytearray_substring(call_data,1+1,8))) as double) + *cast(f.fee_basis as double)/10000 + ,f.fee_maximum) as fee --we want to take the percent fee on total amount, but not exceed the maximum fee + , 'token2022' as token_version + , f.fee_time + , row_number() over (partition by tr.call_tx_id, tr.call_outer_instruction_index, tr.call_inner_instruction_index order by f.fee_time desc) as latest_fee + FROM {{ source('spl_token_2022_solana','spl_token_2022_call_transferChecked') }} tr + LEFT JOIN {{ ref('tokens_solana_fees_history') }} f ON tr.account_tokenMint = f.account_mint AND tr.call_block_time >= f.fee_time + WHERE 1=1 + {% if is_incremental() %} + AND {{incremental_predicate('tr.call_block_time')}} + {% endif %} + ) WHERE latest_fee = 1 + + UNION ALL + + SELECT + null as account_source, account_mintTo as account_destination + , bytearray_to_uint256(bytearray_reverse(bytearray_substring(call_data,1+1,8))) as amount + , call_tx_id, call_block_time, call_block_slot, call_outer_executing_account, call_tx_signer + , 'mint' as action + , call_outer_instruction_index, call_inner_instruction_index + , null as fee + , 'token2022' as token_version + FROM {{ source('spl_token_2022_solana','spl_token_2022_call_mintTo') }} + WHERE 1=1 + {% if is_incremental() %} + AND {{incremental_predicate('call_block_time')}} + {% endif %} + + UNION ALL + + SELECT + null as account_source, account_mintTo as account_destination + , bytearray_to_uint256(bytearray_reverse(bytearray_substring(call_data,1+1,8))) as amount + , call_tx_id, call_block_time, call_block_slot, call_outer_executing_account, call_tx_signer + , 'mint' as action + , call_outer_instruction_index, call_inner_instruction_index + , null as fee + , 'token2022' as token_version + FROM {{ source('spl_token_2022_solana','spl_token_2022_call_mintToChecked') }} + WHERE 1=1 + {% if is_incremental() %} + AND {{incremental_predicate('call_block_time')}} + {% endif %} + + UNION ALL + + SELECT + account_burnAccount as account_source, null as account_destination + , bytearray_to_uint256(bytearray_reverse(bytearray_substring(call_data,1+1,8))) as amount + , call_tx_id, call_block_time, call_block_slot, call_outer_executing_account, call_tx_signer + , 'burn' as action + , call_outer_instruction_index, call_inner_instruction_index + , null as fee + , 'token2022' as token_version + FROM {{ source('spl_token_2022_solana','spl_token_2022_call_burn') }} + WHERE 1=1 + {% if is_incremental() %} + AND {{incremental_predicate('call_block_time')}} + {% endif %} + + UNION ALL + + SELECT + account_burnAccount as account_source, null as account_destination + , bytearray_to_uint256(bytearray_reverse(bytearray_substring(call_data,1+1,8))) as amount + , call_tx_id, call_block_time, call_block_slot, call_outer_executing_account, call_tx_signer + , 'burn' as action + , call_outer_instruction_index, call_inner_instruction_index + , null as fee + , 'token2022' as token_version + FROM {{ source('spl_token_2022_solana','spl_token_2022_call_burnChecked') }} + WHERE 1=1 + {% if is_incremental() %} + AND {{incremental_predicate('call_block_time')}} + {% endif %} + + --token2022 transferFeeExtension has some extra complications. It's the only extension with its own transferChecked wrapper (confidential transfers will have this too) + UNION ALL + + SELECT + call_account_arguments[1] as account_source, call_account_arguments[3] as account_destination + , bytearray_to_uint256(bytearray_reverse(bytearray_substring(call_data,1+2,8))) as amount + , call_tx_id, call_block_time, call_block_slot, call_outer_executing_account, call_tx_signer + , 'transfer' as action + , call_outer_instruction_index, call_inner_instruction_index + , bytearray_to_uint256(bytearray_reverse(bytearray_substring(call_data, 1+2+8+1,8))) as fee + , 'token2022' as token_version + FROM {{ source('spl_token_2022_solana','spl_token_2022_call_transferFeeExtension') }} + WHERE bytearray_substring(call_data,1,2) = 0x1a01 --https://github.com/solana-labs/solana-program-library/blob/8f50c6fabc6ec87ada229e923030381f573e0aed/token/program-2022/src/extension/transfer_fee/instruction.rs#L284 + {% if is_incremental() %} + AND {{incremental_predicate('call_block_time')}} + {% endif %} +) + +SELECT + call_block_time as block_time + , cast (date_trunc('day', call_block_time) as date) as block_date + , call_block_slot as block_slot + , action + , amount + , fee + , account_source as from_token_account + , account_destination as to_token_account + , token_version + , call_tx_signer as tx_signer + , call_tx_id as tx_id + , call_outer_instruction_index as outer_instruction_index + , COALESCE(call_inner_instruction_index,0) as inner_instruction_index + , call_outer_executing_account as outer_executing_account +FROM base tr +-- AND call_block_time > now() - interval '90' day --for faster CI testing \ No newline at end of file diff --git a/models/tokens/solana/tokens_solana_transfers.sql b/models/tokens/solana/tokens_solana_transfers.sql index a28903cf3d4..228ba1c332d 100644 --- a/models/tokens/solana/tokens_solana_transfers.sql +++ b/models/tokens/solana/tokens_solana_transfers.sql @@ -14,56 +14,69 @@ \'["ilemi"]\') }}') }} + +WITH +base as ( + SELECT + block_time, + , call_block_slot as block_slot + , action + , amount + , fee + , from_token_account + , to_token_account + , token_version + , tx_signer + , tx_id + , outer_instruction_index + , inner_instruction_index + , outer_executing_account +FROM {{ ref('tokens_solana_spl_transfers') }} +{% if is_incremental() %} +WHERE {{incremental_predicate('block_time')}} +{% endif %} +UNION ALL + SELECT + block_time, + , call_block_slot as block_slot + , action + , amount + , fee + , from_token_account + , to_token_account + , token_version + , tx_signer + , tx_id + , outer_instruction_index + , inner_instruction_index + , outer_executing_account +FROM {{ ref('tokens_solana_token22_spl_transfers') }} +{% if is_incremental() %} +WHERE {{incremental_predicate('block_time')}} +{% endif %} +) + SELECT call_block_time as block_time , cast (date_trunc('day', call_block_time) as date) as block_date , call_block_slot as block_slot , action , amount + , fee , COALESCE(tk_s.token_mint_address, tk_d.token_mint_address) as token_mint_address , tk_s.token_balance_owner as from_owner , tk_d.token_balance_owner as to_owner - , account_source as from_token_account - , account_destination as to_token_account - , call_tx_signer as tx_signer - , call_tx_id as tx_id - , call_outer_instruction_index as outer_instruction_index - , COALESCE(call_inner_instruction_index,0) as inner_instruction_index - , call_outer_executing_account as outer_executing_account -FROM ( - SELECT account_source, account_destination, amount, call_tx_id, call_block_time, call_block_slot, call_outer_executing_account, call_tx_signer, 'transfer' as action, call_outer_instruction_index, call_inner_instruction_index - FROM {{ source('spl_token_solana','spl_token_call_transfer') }} - - UNION ALL - - SELECT account_source, account_destination, amount, call_tx_id, call_block_time, call_block_slot, call_outer_executing_account, call_tx_signer, 'transfer' as action, call_outer_instruction_index, call_inner_instruction_index - FROM {{ source('spl_token_solana','spl_token_call_transferChecked') }} - - UNION ALL - - SELECT null, account_account as account_destination, amount, call_tx_id, call_block_time, call_block_slot, call_outer_executing_account, call_tx_signer, 'mint' as action, call_outer_instruction_index, call_inner_instruction_index - FROM {{ source('spl_token_solana','spl_token_call_mintTo') }} - - UNION ALL - - SELECT null, account_account as account_destination, amount, call_tx_id, call_block_time, call_block_slot, call_outer_executing_account, call_tx_signer, 'mint' as action, call_outer_instruction_index, call_inner_instruction_index - FROM {{ source('spl_token_solana','spl_token_call_mintToChecked') }} - - UNION ALL - - SELECT account_account as account_source, null, amount, call_tx_id, call_block_time, call_block_slot, call_outer_executing_account, call_tx_signer, 'burn' as action, call_outer_instruction_index, call_inner_instruction_index - FROM {{ source('spl_token_solana','spl_token_call_burn') }} - - UNION ALL - - SELECT account_account as account_source, null, amount, call_tx_id, call_block_time, call_block_slot, call_outer_executing_account, call_tx_signer, 'burn' as action, call_outer_instruction_index, call_inner_instruction_index - FROM {{ source('spl_token_solana','spl_token_call_burnChecked') }} -) tr + , from_token_account + , to_token_account + , token_version + , tx_signer + , tx_id + , outer_instruction_index + , inner_instruction_index + , outer_executing_account +FROM base tr --get token and accounts -LEFT JOIN {{ ref('solana_utils_token_accounts') }} tk_s ON tk_s.address = tr.account_source -LEFT JOIN {{ ref('solana_utils_token_accounts') }} tk_d ON tk_d.address = tr.account_destination +INNER JOIN {{ ref('solana_utils_token_accounts') }} tk_s ON tk_s.address = tr.account_source +INNER JOIN {{ ref('solana_utils_token_accounts') }} tk_d ON tk_d.address = tr.account_destination WHERE 1=1 -{% if is_incremental() %} -AND {{incremental_predicate('call_block_time')}} -{% endif %} --- AND call_block_time > now() - interval '600' day \ No newline at end of file +-- AND call_block_time > now() - interval '90' day --for faster CI testing \ No newline at end of file From 470648220f16c9485fa0a72c8e2420fa7cb65cea Mon Sep 17 00:00:00 2001 From: Alan Ghobadi Date: Tue, 11 Jun 2024 12:04:03 +0200 Subject: [PATCH 087/149] Reapply "Revert solana transfers (#6130)" (#6131) (#6136) This reverts commit e50f7756e8c7ca5e933d61f06f85897695cad9b0. --- models/tokens/solana/tokens_solana_schema.yml | 5 +- .../solana/tokens_solana_spl_transfers.sql | 131 ---------------- ...ens_solana_spl_transfers_call_transfer.sql | 34 ---- .../tokens_solana_token22_spl_transfers.sql | 145 ------------------ .../tokens/solana/tokens_solana_transfers.sql | 97 +++++------- 5 files changed, 43 insertions(+), 369 deletions(-) delete mode 100644 models/tokens/solana/tokens_solana_spl_transfers.sql delete mode 100644 models/tokens/solana/tokens_solana_spl_transfers_call_transfer.sql delete mode 100644 models/tokens/solana/tokens_solana_token22_spl_transfers.sql diff --git a/models/tokens/solana/tokens_solana_schema.yml b/models/tokens/solana/tokens_solana_schema.yml index 7242599a841..4a6bd1a599e 100644 --- a/models/tokens/solana/tokens_solana_schema.yml +++ b/models/tokens/solana/tokens_solana_schema.yml @@ -97,7 +97,7 @@ models: config: tags: ['solana','transfers','erc20','nft','spl'] description: > - get all spl token transfers + get all spl token transfers (will add in token2022 later) columns: - name: block_time - name: block_date @@ -105,13 +105,10 @@ models: - name: action - name: token_mint_address - name: amount - - name: fee - - name: token_version - name: from_owner - name: to_owner - name: from_token_account - name: to_token_account - - name: token_version - name: tx_signer - name: tx_id - name: outer_instruction_index diff --git a/models/tokens/solana/tokens_solana_spl_transfers.sql b/models/tokens/solana/tokens_solana_spl_transfers.sql deleted file mode 100644 index 2f788049ac5..00000000000 --- a/models/tokens/solana/tokens_solana_spl_transfers.sql +++ /dev/null @@ -1,131 +0,0 @@ - {{ - config( - schema = 'tokens_solana', - alias = 'spl_transfers', - materialized = 'incremental', - file_format = 'delta', - incremental_strategy = 'merge', - partition_by = ['block_date'], - incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.block_time')], - unique_key = ['tx_id','outer_instruction_index','inner_instruction_index', 'block_slot'] - ) -}} - - -WITH -base as ( - SELECT - account_source, account_destination - , bytearray_to_uint256(bytearray_reverse(bytearray_substring(call_data,1+1,8))) as amount - , call_tx_id, call_block_time, call_block_slot, call_outer_executing_account, call_tx_signer - , 'transfer' as action - , call_outer_instruction_index, call_inner_instruction_index - , cast(null as double) as fee - , 'spl_token' as token_version - FROM {{ source('spl_token_solana','spl_token_call_transferChecked') }} - WHERE 1=1 - {% if is_incremental() %} - AND {{incremental_predicate('call_block_time')}} - {% endif %} - - UNION ALL - - SELECT - null as account_source, account_account as account_destination - , bytearray_to_uint256(bytearray_reverse(bytearray_substring(call_data,1+1,8))) as amount - , call_tx_id, call_block_time, call_block_slot, call_outer_executing_account, call_tx_signer - , 'mint' as action - , call_outer_instruction_index, call_inner_instruction_index - , cast(null as double) as fee - , 'spl_token' as token_version - FROM {{ source('spl_token_solana','spl_token_call_mintTo') }} - WHERE 1=1 - {% if is_incremental() %} - AND {{incremental_predicate('call_block_time')}} - {% endif %} - - UNION ALL - - SELECT - null as account_source, account_account as account_destination - , bytearray_to_uint256(bytearray_reverse(bytearray_substring(call_data,1+1,8))) as amount - , call_tx_id, call_block_time, call_block_slot, call_outer_executing_account, call_tx_signer - , 'mint' as action - , call_outer_instruction_index, call_inner_instruction_index - , cast(null as double) as fee - , 'spl_token' as token_version - FROM {{ source('spl_token_solana','spl_token_call_mintToChecked') }} - WHERE 1=1 - {% if is_incremental() %} - AND {{incremental_predicate('call_block_time')}} - {% endif %} - - UNION ALL - - SELECT - account_account as account_source, null as account_destination - , bytearray_to_uint256(bytearray_reverse(bytearray_substring(call_data,1+1,8))) as amount - , call_tx_id, call_block_time, call_block_slot, call_outer_executing_account, call_tx_signer - , 'burn' as action - , call_outer_instruction_index, call_inner_instruction_index - , cast(null as double) as fee - , 'spl_token' as token_version - FROM {{ source('spl_token_solana','spl_token_call_burn') }} - WHERE 1=1 - {% if is_incremental() %} - AND {{incremental_predicate('call_block_time')}} - {% endif %} - - UNION ALL - - SELECT - account_account as account_source, null as account_destination - , bytearray_to_uint256(bytearray_reverse(bytearray_substring(call_data,1+1,8))) as amount - , call_tx_id, call_block_time, call_block_slot, call_outer_executing_account, call_tx_signer - , 'burn' as action - , call_outer_instruction_index, call_inner_instruction_index - , cast(null as double) as fee - , 'spl_token' as token_version - FROM {{ source('spl_token_solana','spl_token_call_burnChecked') }} - WHERE 1=1 - {% if is_incremental() %} - AND {{incremental_predicate('call_block_time')}} - {% endif %} -) - -SELECT - call_block_time as block_time - , cast (date_trunc('day', call_block_time) as date) as block_date - , call_block_slot as block_slot - , action - , amount - , fee - , account_source as from_token_account - , account_destination as to_token_account - , token_version - , call_tx_signer as tx_signer - , call_tx_id as tx_id - , call_outer_instruction_index as outer_instruction_index - , COALESCE(call_inner_instruction_index,0) as inner_instruction_index - , call_outer_executing_account as outer_executing_account -FROM base -UNION ALL -SELECT - block_time - , block_date - , block_slot - , action - , amount - , fee - , from_token_account - , to_token_account - , token_version - , tx_signer - , tx_id - , outer_instruction_index - , inner_instruction_index - , outer_executing_account - FROM {{ref('tokens_solana_spl_transfers_call_transfer')}} -{% if is_incremental() %} - AND {{incremental_predicate('call_block_time')}} - {% endif %} \ No newline at end of file diff --git a/models/tokens/solana/tokens_solana_spl_transfers_call_transfer.sql b/models/tokens/solana/tokens_solana_spl_transfers_call_transfer.sql deleted file mode 100644 index 856c6c48de7..00000000000 --- a/models/tokens/solana/tokens_solana_spl_transfers_call_transfer.sql +++ /dev/null @@ -1,34 +0,0 @@ - {{ - config( - schema = 'tokens_solana', - alias = 'spl_transfers_call_transfer', - materialized = 'incremental', - file_format = 'delta', - incremental_strategy = 'merge', - partition_by = ['block_month'], - incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.block_time')], - unique_key = ['tx_id','outer_instruction_index','inner_instruction_index', 'block_slot'] - ) -}} - -SELECT - call_block_time as block_time - , cast (date_trunc('day', call_block_time) as date) as block_date - , cast (date_trunc('month', call_block_time) as date) as block_month - , call_block_slot as block_slot - , 'transfer' as action - , amount - , cast(null as double) as fee - , account_source as from_token_account - , account_destination as to_token_account - , 'spl_token' as token_version - , call_tx_signer as tx_signer - , call_tx_id as tx_id - , call_outer_instruction_index as outer_instruction_index - , COALESCE(call_inner_instruction_index,0) as inner_instruction_index - , call_outer_executing_account as outer_executing_account -FROM {{ source('spl_token_solana','spl_token_call_transfer') }} -WHERE 1=1 -{% if is_incremental() %} -AND {{incremental_predicate('call_block_time')}} -{% endif %} diff --git a/models/tokens/solana/tokens_solana_token22_spl_transfers.sql b/models/tokens/solana/tokens_solana_token22_spl_transfers.sql deleted file mode 100644 index 9ebc9bff9cb..00000000000 --- a/models/tokens/solana/tokens_solana_token22_spl_transfers.sql +++ /dev/null @@ -1,145 +0,0 @@ - {{ - config( - schema = 'tokens_solana', - alias = 'token22_spl_transfers', - materialized = 'incremental', - file_format = 'delta', - incremental_strategy = 'merge', - partition_by = ['block_date'], - incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.block_time')], - unique_key = ['tx_id','outer_instruction_index','inner_instruction_index', 'block_slot'] - ) -}} - - -WITH -base as ( - --token2022. Most mint and account extensions still use the parent transferChecked instruction, hooks are excecuted after and interest-bearing is precalculated. - SELECT - account_source, account_destination, amount - , call_tx_id, call_block_time, call_block_slot, call_outer_executing_account, call_tx_signer - , action - , call_outer_instruction_index, call_inner_instruction_index - , fee - , token_version - FROM ( - SELECT - account_source, account_destination - , bytearray_to_uint256(bytearray_reverse(bytearray_substring(call_data,1+1,8))) as amount --note that interestbearing mints have a different amount methodology, to add later - , call_tx_id, call_block_time, call_block_slot, call_outer_executing_account, call_tx_signer - , 'transfer' as action - , call_outer_instruction_index, call_inner_instruction_index - , least( - cast(bytearray_to_uint256(bytearray_reverse(bytearray_substring(call_data,1+1,8))) as double) - *cast(f.fee_basis as double)/10000 - ,f.fee_maximum) as fee --we want to take the percent fee on total amount, but not exceed the maximum fee - , 'token2022' as token_version - , f.fee_time - , row_number() over (partition by tr.call_tx_id, tr.call_outer_instruction_index, tr.call_inner_instruction_index order by f.fee_time desc) as latest_fee - FROM {{ source('spl_token_2022_solana','spl_token_2022_call_transferChecked') }} tr - LEFT JOIN {{ ref('tokens_solana_fees_history') }} f ON tr.account_tokenMint = f.account_mint AND tr.call_block_time >= f.fee_time - WHERE 1=1 - {% if is_incremental() %} - AND {{incremental_predicate('tr.call_block_time')}} - {% endif %} - ) WHERE latest_fee = 1 - - UNION ALL - - SELECT - null as account_source, account_mintTo as account_destination - , bytearray_to_uint256(bytearray_reverse(bytearray_substring(call_data,1+1,8))) as amount - , call_tx_id, call_block_time, call_block_slot, call_outer_executing_account, call_tx_signer - , 'mint' as action - , call_outer_instruction_index, call_inner_instruction_index - , null as fee - , 'token2022' as token_version - FROM {{ source('spl_token_2022_solana','spl_token_2022_call_mintTo') }} - WHERE 1=1 - {% if is_incremental() %} - AND {{incremental_predicate('call_block_time')}} - {% endif %} - - UNION ALL - - SELECT - null as account_source, account_mintTo as account_destination - , bytearray_to_uint256(bytearray_reverse(bytearray_substring(call_data,1+1,8))) as amount - , call_tx_id, call_block_time, call_block_slot, call_outer_executing_account, call_tx_signer - , 'mint' as action - , call_outer_instruction_index, call_inner_instruction_index - , null as fee - , 'token2022' as token_version - FROM {{ source('spl_token_2022_solana','spl_token_2022_call_mintToChecked') }} - WHERE 1=1 - {% if is_incremental() %} - AND {{incremental_predicate('call_block_time')}} - {% endif %} - - UNION ALL - - SELECT - account_burnAccount as account_source, null as account_destination - , bytearray_to_uint256(bytearray_reverse(bytearray_substring(call_data,1+1,8))) as amount - , call_tx_id, call_block_time, call_block_slot, call_outer_executing_account, call_tx_signer - , 'burn' as action - , call_outer_instruction_index, call_inner_instruction_index - , null as fee - , 'token2022' as token_version - FROM {{ source('spl_token_2022_solana','spl_token_2022_call_burn') }} - WHERE 1=1 - {% if is_incremental() %} - AND {{incremental_predicate('call_block_time')}} - {% endif %} - - UNION ALL - - SELECT - account_burnAccount as account_source, null as account_destination - , bytearray_to_uint256(bytearray_reverse(bytearray_substring(call_data,1+1,8))) as amount - , call_tx_id, call_block_time, call_block_slot, call_outer_executing_account, call_tx_signer - , 'burn' as action - , call_outer_instruction_index, call_inner_instruction_index - , null as fee - , 'token2022' as token_version - FROM {{ source('spl_token_2022_solana','spl_token_2022_call_burnChecked') }} - WHERE 1=1 - {% if is_incremental() %} - AND {{incremental_predicate('call_block_time')}} - {% endif %} - - --token2022 transferFeeExtension has some extra complications. It's the only extension with its own transferChecked wrapper (confidential transfers will have this too) - UNION ALL - - SELECT - call_account_arguments[1] as account_source, call_account_arguments[3] as account_destination - , bytearray_to_uint256(bytearray_reverse(bytearray_substring(call_data,1+2,8))) as amount - , call_tx_id, call_block_time, call_block_slot, call_outer_executing_account, call_tx_signer - , 'transfer' as action - , call_outer_instruction_index, call_inner_instruction_index - , bytearray_to_uint256(bytearray_reverse(bytearray_substring(call_data, 1+2+8+1,8))) as fee - , 'token2022' as token_version - FROM {{ source('spl_token_2022_solana','spl_token_2022_call_transferFeeExtension') }} - WHERE bytearray_substring(call_data,1,2) = 0x1a01 --https://github.com/solana-labs/solana-program-library/blob/8f50c6fabc6ec87ada229e923030381f573e0aed/token/program-2022/src/extension/transfer_fee/instruction.rs#L284 - {% if is_incremental() %} - AND {{incremental_predicate('call_block_time')}} - {% endif %} -) - -SELECT - call_block_time as block_time - , cast (date_trunc('day', call_block_time) as date) as block_date - , call_block_slot as block_slot - , action - , amount - , fee - , account_source as from_token_account - , account_destination as to_token_account - , token_version - , call_tx_signer as tx_signer - , call_tx_id as tx_id - , call_outer_instruction_index as outer_instruction_index - , COALESCE(call_inner_instruction_index,0) as inner_instruction_index - , call_outer_executing_account as outer_executing_account -FROM base tr --- AND call_block_time > now() - interval '90' day --for faster CI testing \ No newline at end of file diff --git a/models/tokens/solana/tokens_solana_transfers.sql b/models/tokens/solana/tokens_solana_transfers.sql index 228ba1c332d..a28903cf3d4 100644 --- a/models/tokens/solana/tokens_solana_transfers.sql +++ b/models/tokens/solana/tokens_solana_transfers.sql @@ -14,69 +14,56 @@ \'["ilemi"]\') }}') }} - -WITH -base as ( - SELECT - block_time, - , call_block_slot as block_slot - , action - , amount - , fee - , from_token_account - , to_token_account - , token_version - , tx_signer - , tx_id - , outer_instruction_index - , inner_instruction_index - , outer_executing_account -FROM {{ ref('tokens_solana_spl_transfers') }} -{% if is_incremental() %} -WHERE {{incremental_predicate('block_time')}} -{% endif %} -UNION ALL - SELECT - block_time, - , call_block_slot as block_slot - , action - , amount - , fee - , from_token_account - , to_token_account - , token_version - , tx_signer - , tx_id - , outer_instruction_index - , inner_instruction_index - , outer_executing_account -FROM {{ ref('tokens_solana_token22_spl_transfers') }} -{% if is_incremental() %} -WHERE {{incremental_predicate('block_time')}} -{% endif %} -) - SELECT call_block_time as block_time , cast (date_trunc('day', call_block_time) as date) as block_date , call_block_slot as block_slot , action , amount - , fee , COALESCE(tk_s.token_mint_address, tk_d.token_mint_address) as token_mint_address , tk_s.token_balance_owner as from_owner , tk_d.token_balance_owner as to_owner - , from_token_account - , to_token_account - , token_version - , tx_signer - , tx_id - , outer_instruction_index - , inner_instruction_index - , outer_executing_account -FROM base tr + , account_source as from_token_account + , account_destination as to_token_account + , call_tx_signer as tx_signer + , call_tx_id as tx_id + , call_outer_instruction_index as outer_instruction_index + , COALESCE(call_inner_instruction_index,0) as inner_instruction_index + , call_outer_executing_account as outer_executing_account +FROM ( + SELECT account_source, account_destination, amount, call_tx_id, call_block_time, call_block_slot, call_outer_executing_account, call_tx_signer, 'transfer' as action, call_outer_instruction_index, call_inner_instruction_index + FROM {{ source('spl_token_solana','spl_token_call_transfer') }} + + UNION ALL + + SELECT account_source, account_destination, amount, call_tx_id, call_block_time, call_block_slot, call_outer_executing_account, call_tx_signer, 'transfer' as action, call_outer_instruction_index, call_inner_instruction_index + FROM {{ source('spl_token_solana','spl_token_call_transferChecked') }} + + UNION ALL + + SELECT null, account_account as account_destination, amount, call_tx_id, call_block_time, call_block_slot, call_outer_executing_account, call_tx_signer, 'mint' as action, call_outer_instruction_index, call_inner_instruction_index + FROM {{ source('spl_token_solana','spl_token_call_mintTo') }} + + UNION ALL + + SELECT null, account_account as account_destination, amount, call_tx_id, call_block_time, call_block_slot, call_outer_executing_account, call_tx_signer, 'mint' as action, call_outer_instruction_index, call_inner_instruction_index + FROM {{ source('spl_token_solana','spl_token_call_mintToChecked') }} + + UNION ALL + + SELECT account_account as account_source, null, amount, call_tx_id, call_block_time, call_block_slot, call_outer_executing_account, call_tx_signer, 'burn' as action, call_outer_instruction_index, call_inner_instruction_index + FROM {{ source('spl_token_solana','spl_token_call_burn') }} + + UNION ALL + + SELECT account_account as account_source, null, amount, call_tx_id, call_block_time, call_block_slot, call_outer_executing_account, call_tx_signer, 'burn' as action, call_outer_instruction_index, call_inner_instruction_index + FROM {{ source('spl_token_solana','spl_token_call_burnChecked') }} +) tr --get token and accounts -INNER JOIN {{ ref('solana_utils_token_accounts') }} tk_s ON tk_s.address = tr.account_source -INNER JOIN {{ ref('solana_utils_token_accounts') }} tk_d ON tk_d.address = tr.account_destination +LEFT JOIN {{ ref('solana_utils_token_accounts') }} tk_s ON tk_s.address = tr.account_source +LEFT JOIN {{ ref('solana_utils_token_accounts') }} tk_d ON tk_d.address = tr.account_destination WHERE 1=1 --- AND call_block_time > now() - interval '90' day --for faster CI testing \ No newline at end of file +{% if is_incremental() %} +AND {{incremental_predicate('call_block_time')}} +{% endif %} +-- AND call_block_time > now() - interval '600' day \ No newline at end of file From e6539425a31372e51098decb2cd1fb8451d289be Mon Sep 17 00:00:00 2001 From: Huang Geyang Date: Tue, 11 Jun 2024 22:50:21 +0800 Subject: [PATCH 088/149] Update trusted_tokens (#6068) * Add celo USDC * Update tokens * Add mental trusted tokens --- models/prices/prices_trusted_tokens.sql | 30 +++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/models/prices/prices_trusted_tokens.sql b/models/prices/prices_trusted_tokens.sql index 7a3e268a2d8..12dd5481e4a 100644 --- a/models/prices/prices_trusted_tokens.sql +++ b/models/prices/prices_trusted_tokens.sql @@ -42,9 +42,11 @@ FROM (VALUES ('arbitrum', 'USDC.e', 0xff970a61a04b1ca14834a43f5de4533ebddb5cc8), ('bnb', 'DAI', 0x1af3f329e8be154074d8769d1ffa4ee058b1dbc3), ('celo', 'cUSD', 0x765de816845861e75a25fca122bb6898b8b1282a), ('celo', 'CELO', 0x471ece3750da237f93b8e339c536989b8978a438), + ('celo', 'USDC', 0xceba9300f2b948710d2653dd7b07f33a8b32118c), ('celo', 'cEUR', 0xd8763cba276a3738e6de85b4b3bf5fded6d6ca73), ('celo', 'BTC', 0xd629eb00deced2a080b7ec630ef6ac117e614f1b), ('celo', 'BIFI', 0x639a647fbe20b6c8ac19e48e2de44ea792c62c5c), + ('celo', 'USD₮', 0x48065fbbe25f71c9282ddf5e1cd6d6a887483d5e), ('ethereum', 'WETH', 0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2), ('ethereum', 'USDT', 0xdac17f958d2ee523a2206206994597c13d831ec7), ('ethereum', 'USDC', 0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48), @@ -56,14 +58,30 @@ FROM (VALUES ('arbitrum', 'USDC.e', 0xff970a61a04b1ca14834a43f5de4533ebddb5cc8), ('fantom', 'WETH', 0x74b23882a30290451a17c44f4f05243b6b58c76d), ('fantom', 'DAI', 0x8d11ec38a3eb5e956b052f67da8bdc9bef8abf3e), ('fantom', 'WBTC', 0x321162cd933e2be498cd2267a90534a804051b11), + ('fantom', 'axlUSDC', 0x1b6382dbdea11d97f24495c9a90b7c88469134a4), + ('fantom', 'USDC', 0x28a92dde19d9989f39a49905d7c9c2fac7799bdf), ('gnosis', 'WXDAI', 0xe91d153e0b41518a2ce8dd3d7944fa863463a97d), ('gnosis', 'WETH', 0x6a023ccd1ff6f2045c3309768ead9e68f978f6e1), ('gnosis', 'USDC', 0xddafbb505ad214d7b80b1f830fccc89b60fb7a83), + ('gnosis', 'wstETH', 0x6c76971f98945ae98dd7d4dfca8711ebea946ea6), ('gnosis', 'GNO', 0x9c58bacc331c9aa871afd802db6379a98e80cedb), ('gnosis', 'USDT', 0x4ecaba5870353805a9f068101a40e0f32ed605c6), ('gnosis', 'WBTC', 0x8e5bbbb09ed1ebde8674cda39a0c169401db4252), ('gnosis', 'DAI', 0x44fa8e6f47987339850636f88629646662444217), ('gnosis', 'BUSD', 0xdd96b45877d0e8361a4ddb732da741e97f3191ff), + ('linea', 'WETH', 0xe5d7c2a44ffddf6b295a15c148167daaaf5cf34f), + ('linea', 'USDC', 0x176211869ca2b568f2a7d4ee941e073a821ee1ff), + ('linea', 'USDT', 0xa219439258ca9da29e9cc4ce5596924745e12b93), + ('linea', 'WBTC', 0x3aab2285ddcddad8edf438c1bab47e1a9d05a9b4), + ('linea', 'wstETH', 0xb5bedd42000b71fdde22d3ee8a79bd49a568fc8f), + ('mantle', 'USDT', 0x201eba5cc46d216ce6dc03f6a759e8e766e956ae), + ('mantle', 'WETH', 0xdeaddeaddeaddeaddeaddeaddeaddeaddead1111), + ('mantle', 'USDC', 0x09bc4e0d864854c6afb6eb9a9cdf58ac190d0df9), + ('mantle', 'mETH', 0xcda86a272531e8640cd7f1a92c01839911b90bb0), + ('mantle', 'MNT', 0xdeaddeaddeaddeaddeaddeaddeaddeaddead0000), + ('mantle', 'JOE', 0x371c7ec6d8039ff7933a2aa28eb827ffe1f52f07), + ('mantle', 'WMNT', 0x78c1b0c915c4faa5fffa6cabf0219da63d7f4cb8), + ('mantle', 'axlUSDC', 0xeb466342c4d449bc9f53a865d5cb90586f405215), ('optimism', 'USDC.e', 0x7f5c764cbc14f9669b88837ca1490cca17c31607), ('optimism', 'WETH', 0x4200000000000000000000000000000000000006), ('optimism', 'USDT', 0x94b008aa00579c1307b0ef2c499ad98a8ce58e58), @@ -73,12 +91,24 @@ FROM (VALUES ('arbitrum', 'USDC.e', 0xff970a61a04b1ca14834a43f5de4533ebddb5cc8), ('optimism', 'WBTC', 0x68f180fcce6836688e9084f035309e29bf0a2095), ('optimism', 'sUSD', 0x8c6f28f2f1a3c87f0f938b96d27520d9751ec8d9), ('optimism', 'wstETH', 0x1f32b1c2345538c0c6f582fcb022739c4a194ebb), + ('optimism', 'WLD', 0xdc6ff44d5d932cbd77b52e5612ba0529dc6226f1), ('polygon', 'USDC.e', 0x2791bca1f2de4661ed88a30c99a7a9449aa84174), ('polygon', 'USDT', 0xc2132d05d31c914a87c6611c10748aeb04b58e8f), ('polygon', 'WMATIC', 0x0d500b1d8e8ef31e21c99d1db9a6444d3adf1270), ('polygon', 'WETH', 0x7ceb23fd6bc0add59e62ac25578270cff1b9f619), ('polygon', 'DAI', 0x8f3cf7ad23cd3cadbd9735aff958023239c6a063), ('polygon', 'WBTC', 0x1bfd67037b42cf73acf2047067bd4f2c47d9bfd6), + ('polygon', 'USDC', 0x3c499c542cef5e3811e1192ce70d8cc03d5c3359), + ('scroll', 'USDC', 0x06efdbff2a14a7c8e15944d1f4a48f9f95f663a4), + ('scroll', 'WETH', 0x5300000000000000000000000000000000000004), + ('scroll', 'USDT', 0xf55bec9cafdbe8730f096aa55dad6d22d44099df), + ('scroll', 'WBTC', 0x3c1bca5a656e69edcd0d4e36bebb3fcdaca60cf1), + ('scroll', 'wstETH', 0xf610a9dfb7c89644979b4a0f27063e9e7d7cda32), + ('zkevm', 'WETH', 0x4f9a0e7fd2bf6067db6994cf12e4495df938e6e9), + ('zkevm', 'USDT', 0x1e4a5963abfd975d8c9021ce480b42188849d41d), + ('zkevm', 'USDC', 0x37eaa0ef3549a5bb7d431be78a3d99bd360d19e5), + ('zkevm', 'MATIC', 0xa2036f0538221a77a3937f1379699f44945018d0), + ('zkevm', 'rETH', 0xb23c20efce6e24acca0cef9b7b7aa196b84ec942), ('zksync', 'USDC.e', 0x3355df6d4c9c3035724fd0e3914de96a5a83aaf4), ('zksync', 'BUSD', 0x2039bb4116b4efc145ec4f0e2ea75012d6c0f181), ('zksync', 'WETH', 0x5aea5775959fbc2557cc8789bc1bf90a239d9a91), From f94d8568b5867a44104b152dc1c0aec0566dad44 Mon Sep 17 00:00:00 2001 From: yy-analytics <103118737+yy-analytics@users.noreply.github.com> Date: Tue, 11 Jun 2024 20:20:42 +0530 Subject: [PATCH 089/149] Yield strategies models and Mantle expansion (including tokens.erc20 for Mantle) (#6118) * Added new yield strategies view model * Replicated/expanded existing models for mantle chain * Refactored the Yield Yak trades models to make use of macros, plus small formatting changes * Added manual additions of tokens for mantle to tokens.erc20 model * Fixes for dbt compile, including adding forgotten sources and some miinor others * Spacing changes to re-trigger dbt tests in PR * Correction to seed entry --- .../yield_yak/yield_yak_strategies.sql | 13 + .../_project/yield_yak/yield_yak_trades.sql | 97 +++++ .../yield_yak/yield_yak_yield_strategies.sql | 21 + .../arbitrum/yield_yak_arbitrum_schema.yml | 28 +- .../arbitrum/yield_yak_arbitrum_trades.sql | 118 +---- .../yield_yak_arbitrum_yield_strategies.sql | 13 + .../yield_yak_avalanche_c_schema.yml | 28 +- .../yield_yak_avalanche_c_trades.sql | 121 +----- ...yield_yak_avalanche_c_yield_strategies.sql | 13 + .../mantle/yield_yak_mantle_balances.sql | 19 + .../mantle/yield_yak_mantle_deposits.sql | 18 + .../mantle/yield_yak_mantle_reinvests.sql | 17 + .../mantle/yield_yak_mantle_schema.yml | 408 ++++++++++++++++++ .../mantle/yield_yak_mantle_trades.sql | 19 + .../yield_yak_mantle_user_yrt_balances.sql | 17 + .../mantle/yield_yak_mantle_withdraws.sql | 18 + .../yield_yak_mantle_yak_adapter_swaps.sql | 17 + .../mantle/yield_yak_mantle_yak_swaps.sql | 17 + .../yield_yak_mantle_yield_strategies.sql | 13 + models/yield_yak/yield_yak_balances.sql | 7 +- models/yield_yak/yield_yak_deposits.sql | 7 +- models/yield_yak/yield_yak_reinvests.sql | 7 +- models/yield_yak/yield_yak_schema.yml | 61 ++- models/yield_yak/yield_yak_trades.sql | 78 ++-- .../yield_yak/yield_yak_user_yrt_balances.sql | 7 +- models/yield_yak/yield_yak_withdraws.sql | 7 +- .../yield_yak/yield_yak_yak_adapter_swaps.sql | 7 +- models/yield_yak/yield_yak_yak_swaps.sql | 7 +- .../yield_yak/yield_yak_yield_strategies.sql | 35 ++ seeds/dex/aggregator/dex_aggregator_seed.csv | 2 + .../arbitrum/yield_yak_arbitrum_sources.yml | 2 +- .../yield_yak_avalanche_c_sources.yml | 2 +- .../mantle/yield_yak_mantle_sources.yml | 70 +++ .../tokens/mantle/tokens_mantle_erc20.sql | 35 ++ .../tokens/mantle/tokens_mantle_schema.yml | 21 + tokens/models/tokens/tokens_erc20.sql | 7 +- tokens/models/tokens/tokens_schema.yml | 6 +- 37 files changed, 1093 insertions(+), 290 deletions(-) create mode 100644 macros/models/_project/yield_yak/yield_yak_trades.sql create mode 100644 macros/models/_project/yield_yak/yield_yak_yield_strategies.sql create mode 100644 models/yield_yak/arbitrum/yield_yak_arbitrum_yield_strategies.sql create mode 100644 models/yield_yak/avalanche_c/yield_yak_avalanche_c_yield_strategies.sql create mode 100644 models/yield_yak/mantle/yield_yak_mantle_balances.sql create mode 100644 models/yield_yak/mantle/yield_yak_mantle_deposits.sql create mode 100644 models/yield_yak/mantle/yield_yak_mantle_reinvests.sql create mode 100644 models/yield_yak/mantle/yield_yak_mantle_schema.yml create mode 100644 models/yield_yak/mantle/yield_yak_mantle_trades.sql create mode 100644 models/yield_yak/mantle/yield_yak_mantle_user_yrt_balances.sql create mode 100644 models/yield_yak/mantle/yield_yak_mantle_withdraws.sql create mode 100644 models/yield_yak/mantle/yield_yak_mantle_yak_adapter_swaps.sql create mode 100644 models/yield_yak/mantle/yield_yak_mantle_yak_swaps.sql create mode 100644 models/yield_yak/mantle/yield_yak_mantle_yield_strategies.sql create mode 100644 models/yield_yak/yield_yak_yield_strategies.sql create mode 100644 sources/yield_yak/mantle/yield_yak_mantle_sources.yml create mode 100644 tokens/models/tokens/mantle/tokens_mantle_erc20.sql create mode 100644 tokens/models/tokens/mantle/tokens_mantle_schema.yml diff --git a/macros/models/_project/yield_yak/yield_yak_strategies.sql b/macros/models/_project/yield_yak/yield_yak_strategies.sql index b92627b1339..677d70269d8 100644 --- a/macros/models/_project/yield_yak/yield_yak_strategies.sql +++ b/macros/models/_project/yield_yak/yield_yak_strategies.sql @@ -157,6 +157,19 @@ ]) }} +{% elif blockchain == 'mantle' %} + +{{ + return([ + 'CompoundingJoeMantle', + 'CompoundingMoe', + 'CompoundingYYStaking', + 'LendleStrategy', + 'MoeStrategy', + 'StargateV2Strategy' + ]) +}} + {% endif %} {% endmacro %} \ No newline at end of file diff --git a/macros/models/_project/yield_yak/yield_yak_trades.sql b/macros/models/_project/yield_yak/yield_yak_trades.sql new file mode 100644 index 00000000000..51178af13ec --- /dev/null +++ b/macros/models/_project/yield_yak/yield_yak_trades.sql @@ -0,0 +1,97 @@ +{%- macro yield_yak_trades( + blockchain = null, + project_start_date = '2021-09-15' + ) +-%} + +{%- set namespace_blockchain = 'yield_yak_' + blockchain -%} + +WITH dexs AS ( + SELECT + evt_block_time AS block_time + -- , '' AS taker commenting this as there's no trader in the event + , CAST(NULL as VARBINARY) AS maker + , _amountIn AS token_sold_amount_raw + , _amountOut AS token_bought_amount_raw + , CAST(NULL AS double) AS amount_usd + , _tokenIn AS token_sold_address + , _tokenOut AS token_bought_address + , contract_address As project_contract_address + , evt_tx_hash AS tx_hash + , ARRAY[-1] AS trace_address + , evt_index + FROM {{ source(namespace_blockchain, 'YakRouter_evt_YakSwap') }} + {%- if is_incremental() %} + WHERE {{ incremental_predicate('evt_block_time') }} + {%- endif %} +) + +SELECT + '{{ blockchain }}' AS blockchain + , 'yield_yak' AS project + , '1' AS version + , CAST(date_trunc('DAY', dexs.block_time) AS date) AS block_date + , CAST(date_trunc('MONTH', dexs.block_time) AS date) AS block_month + , dexs.block_time + , erc20a.symbol AS token_bought_symbol + , erc20b.symbol AS token_sold_symbol + , CASE + WHEN lower(erc20a.symbol) > lower(erc20b.symbol) THEN concat(erc20b.symbol, '-', erc20a.symbol) + ELSE concat(erc20a.symbol, '-', erc20b.symbol) + END AS token_pair + , dexs.token_bought_amount_raw / power(10, erc20a.decimals) AS token_bought_amount + , dexs.token_sold_amount_raw / power(10, erc20b.decimals) AS token_sold_amount + , dexs.token_bought_amount_raw AS token_bought_amount_raw + , dexs.token_sold_amount_raw AS token_sold_amount_raw + , COALESCE( + dexs.amount_usd, + (dexs.token_bought_amount_raw / power(10, p_bought.decimals)) * p_bought.price, + (dexs.token_sold_amount_raw / power(10, p_sold.decimals)) * p_sold.price + ) AS amount_usd + , dexs.token_bought_address + , dexs.token_sold_address + , tx."from" AS taker + , dexs.maker + , dexs.project_contract_address + , dexs.tx_hash + , tx."from" AS tx_from + , tx.to AS tx_to + , dexs.trace_address + , dexs.evt_index +FROM dexs +INNER JOIN {{ source(blockchain, 'transactions') }} tx + ON tx.hash = dexs.tx_hash + {%- if not is_incremental() %} + AND tx.block_time >= TIMESTAMP '{{ project_start_date }}' + {%- endif %} + {%- if is_incremental() %} + AND {{ incremental_predicate('tx.block_time') }} + {%- endif %} +LEFT JOIN {{ source('tokens', 'erc20') }} erc20a + ON erc20a.contract_address = dexs.token_bought_address + AND erc20a.blockchain = '{{ blockchain }}' +LEFT JOIN {{ source('tokens', 'erc20') }} erc20b + ON erc20b.contract_address = dexs.token_sold_address + AND erc20b.blockchain = '{{ blockchain }}' +LEFT JOIN {{ source('prices', 'usd') }} p_bought + ON p_bought.minute = date_trunc('minute', dexs.block_time) + AND p_bought.contract_address = dexs.token_bought_address + AND p_bought.blockchain = '{{ blockchain }}' + {%- if not is_incremental() %} + AND p_bought.minute >= TIMESTAMP '{{ project_start_date }}' + {%- endif %} + {%- if is_incremental() %} + AND {{ incremental_predicate('p_bought.minute') }} + {%- endif %} +LEFT JOIN {{ source('prices', 'usd') }} p_sold + ON p_sold.minute = date_trunc('minute', dexs.block_time) + AND p_sold.contract_address = dexs.token_sold_address + AND p_sold.blockchain = '{{ blockchain }}' + {%- if not is_incremental() %} + AND p_sold.minute >= TIMESTAMP '{{ project_start_date }}' + {%- endif %} + {%- if is_incremental() %} + AND {{ incremental_predicate('p_sold.minute') }} + {%- endif %} + +{%- endmacro -%} diff --git a/macros/models/_project/yield_yak/yield_yak_yield_strategies.sql b/macros/models/_project/yield_yak/yield_yak_yield_strategies.sql new file mode 100644 index 00000000000..6a342fefbe7 --- /dev/null +++ b/macros/models/_project/yield_yak/yield_yak_yield_strategies.sql @@ -0,0 +1,21 @@ +{%- macro yield_yak_yield_strategies( + blockchain = null + ) +-%} + +SELECT + '{{ blockchain }}' AS blockchain + , c.address AS contract_address + , c.name AS contract_name + , ct.block_time AS created_block_time + , ct.block_number AS created_block_number +FROM {{ source(blockchain, 'contracts') }} c +INNER JOIN {{ source(blockchain, 'creation_traces') }} ct + ON ct.address = c.address +WHERE + c.namespace = 'yield_yak' + -- This next line ensures we're only getting the contracts which have the required Reinvest, Deposit and Withdraw events + -- and are therefore the types of yield strategies in which we are interested for this macro. + AND cardinality(filter(c.abi, x -> json_extract_scalar(x, '$.name') IN ('Reinvest', 'Deposit', 'Withdraw') AND json_extract_scalar(x, '$.type') = 'event')) = 3 + +{%- endmacro -%} \ No newline at end of file diff --git a/models/yield_yak/arbitrum/yield_yak_arbitrum_schema.yml b/models/yield_yak/arbitrum/yield_yak_arbitrum_schema.yml index 59f0de915c4..156935e7a2d 100644 --- a/models/yield_yak/arbitrum/yield_yak_arbitrum_schema.yml +++ b/models/yield_yak/arbitrum/yield_yak_arbitrum_schema.yml @@ -379,4 +379,30 @@ models: description: "Amount of the sold token being swapped from / traded in the YakAdapterSwap event" - &adapter_amount_out name: adapter_amount_out - description: "Amount of the bought token being swapped to / bought in the YakAdapterSwap event" \ No newline at end of file + description: "Amount of the bought token being swapped to / bought in the YakAdapterSwap event" + + - name: yield_yak_arbitrum_yield_strategies + meta: + blockchain: arbitrum + project: yield_yak + contributors: angus_1 + config: + tags: ['arbitrum', 'yield_yak', 'strategies', 'yield'] + description: > + yield yak strategies on arbitrum + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - contract_address + columns: + - *blockchain + - *contract_address + - &contract_name + name: contract_name + description: "Name of the deployed contract" + - &created_block_time + name: created_block_time + description: "Timestamp at which the contract was deployed/created" + - &created_block_number + name: created_block_number + description: "Block number at which the contract was deployed/created" \ No newline at end of file diff --git a/models/yield_yak/arbitrum/yield_yak_arbitrum_trades.sql b/models/yield_yak/arbitrum/yield_yak_arbitrum_trades.sql index d977abf5550..302c0f43444 100644 --- a/models/yield_yak/arbitrum/yield_yak_arbitrum_trades.sql +++ b/models/yield_yak/arbitrum/yield_yak_arbitrum_trades.sql @@ -1,105 +1,19 @@ -{{ config( - schema = 'yield_yak_arbitrum', - alias = 'trades', - partition_by = ['block_month'], - materialized = 'incremental', - file_format = 'delta', - incremental_strategy = 'merge', - unique_key = ['block_date', 'blockchain', 'project', 'version', 'tx_hash', 'evt_index', 'trace_address'], - incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.block_time')] +{{ + config( + schema = 'yield_yak_arbitrum', + alias = 'trades', + partition_by = ['block_month'], + materialized = 'incremental', + file_format = 'delta', + incremental_strategy = 'merge', + unique_key = ['block_date', 'blockchain', 'project', 'version', 'tx_hash', 'evt_index', 'trace_address'], + incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.block_time')] ) }} - -{% set project_start_date = '2023-03-21' %} - -WITH - -dexs as ( - SELECT - evt_block_time as block_time, - -- '' as taker, commenting this as there's no trader in the event - CAST(NULL as VARBINARY) as maker, - _amountIn as token_sold_amount_raw, - _amountOut as token_bought_amount_raw, - CAST(NULL as double) as amount_usd, - _tokenIn as token_sold_address, - _tokenOut as token_bought_address, - contract_address as project_contract_address, - evt_tx_hash as tx_hash, - ARRAY[-1] AS trace_address, - evt_index - FROM - {{ source('yield_yak_arbitrum', 'YakRouter_evt_YakSwap') }} - {% if is_incremental() %} - WHERE {{incremental_predicate('evt_block_time')}} - {% endif %} -) - -SELECT - 'arbitrum' as blockchain, - 'yield_yak' as project, - '1' as version, - CAST(date_trunc('DAY', dexs.block_time) as date) as block_date, - CAST(date_trunc('MONTH', dexs.block_time) as date) as block_month, - dexs.block_time, - erc20a.symbol as token_bought_symbol, - erc20b.symbol as token_sold_symbol, - CASE - WHEN lower(erc20a.symbol) > lower(erc20b.symbol) THEN concat(erc20b.symbol, '-', erc20a.symbol) - ELSE concat(erc20a.symbol, '-', erc20b.symbol) - END as token_pair, - dexs.token_bought_amount_raw / power(10, erc20a.decimals) as token_bought_amount, - dexs.token_sold_amount_raw / power(10, erc20b.decimals) as token_sold_amount, - dexs.token_bought_amount_raw AS token_bought_amount_raw, - dexs.token_sold_amount_raw AS token_sold_amount_raw, - COALESCE( - dexs.amount_usd, - (dexs.token_bought_amount_raw / power(10, p_bought.decimals)) * p_bought.price, - (dexs.token_sold_amount_raw / power(10, p_sold.decimals)) * p_sold.price - ) as amount_usd, - dexs.token_bought_address, - dexs.token_sold_address, - tx."from" as taker, - dexs.maker, - dexs.project_contract_address, - dexs.tx_hash, - tx."from" as tx_from, - tx.to AS tx_to, - dexs.trace_address, - dexs.evt_index -FROM dexs -INNER JOIN {{ source('arbitrum', 'transactions') }} tx - ON tx.hash = dexs.tx_hash - {% if not is_incremental() %} - AND tx.block_time >= TIMESTAMP '{{project_start_date}}' - {% endif %} - {% if is_incremental() %} - AND {{incremental_predicate('tx.block_time')}} - {% endif %} -LEFT JOIN {{ source('tokens', 'erc20') }} erc20a - ON erc20a.contract_address = dexs.token_bought_address - AND erc20a.blockchain = 'arbitrum' -LEFT JOIN {{ source('tokens', 'erc20') }} erc20b - ON erc20b.contract_address = dexs.token_sold_address - AND erc20b.blockchain = 'arbitrum' -LEFT JOIN {{ source('prices', 'usd') }} p_bought - ON p_bought.minute = date_trunc('minute', dexs.block_time) - AND p_bought.contract_address = dexs.token_bought_address - AND p_bought.blockchain = 'arbitrum' - {% if not is_incremental() %} - AND p_bought.minute >= TIMESTAMP '{{project_start_date}}' - {% endif %} - {% if is_incremental() %} - AND {{incremental_predicate('p_bought.minute')}} - {% endif %} -LEFT JOIN {{ source('prices', 'usd') }} p_sold - ON p_sold.minute = date_trunc('minute', dexs.block_time) - AND p_sold.contract_address = dexs.token_sold_address - AND p_sold.blockchain = 'arbitrum' - {% if not is_incremental() %} - AND p_sold.minute >= TIMESTAMP '{{project_start_date}}' - {% endif %} - {% if is_incremental() %} - AND {{incremental_predicate('p_sold.minute')}} - {% endif %} \ No newline at end of file +{{ + yield_yak_trades( + blockchain = 'arbitrum', + project_start_date = '2023-03-21' + ) +}} \ No newline at end of file diff --git a/models/yield_yak/arbitrum/yield_yak_arbitrum_yield_strategies.sql b/models/yield_yak/arbitrum/yield_yak_arbitrum_yield_strategies.sql new file mode 100644 index 00000000000..9170aa3091a --- /dev/null +++ b/models/yield_yak/arbitrum/yield_yak_arbitrum_yield_strategies.sql @@ -0,0 +1,13 @@ +{{ + config( + schema = 'yield_yak_arbitrum', + alias = 'yield_strategies', + materialized = 'view' + ) +}} + +{{ + yield_yak_yield_strategies( + blockchain = 'arbitrum' + ) +}} diff --git a/models/yield_yak/avalanche_c/yield_yak_avalanche_c_schema.yml b/models/yield_yak/avalanche_c/yield_yak_avalanche_c_schema.yml index 5fd3590e28e..d19bfff1d08 100644 --- a/models/yield_yak/avalanche_c/yield_yak_avalanche_c_schema.yml +++ b/models/yield_yak/avalanche_c/yield_yak_avalanche_c_schema.yml @@ -379,4 +379,30 @@ models: description: "Amount of the sold token being swapped from / traded in the YakAdapterSwap event" - &adapter_amount_out name: adapter_amount_out - description: "Amount of the bought token being swapped to / bought in the YakAdapterSwap event" \ No newline at end of file + description: "Amount of the bought token being swapped to / bought in the YakAdapterSwap event" + + - name: yield_yak_avalanche_c_yield_strategies + meta: + blockchain: avalanche_c + project: yield_yak + contributors: angus_1 + config: + tags: ['avalanche_c', 'yield_yak', 'strategies', 'yield'] + description: > + yield yak strategies on avalanche_c + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - contract_address + columns: + - *blockchain + - *contract_address + - &contract_name + name: contract_name + description: "Name of the deployed contract" + - &created_block_time + name: created_block_time + description: "Timestamp at which the contract was deployed/created" + - &created_block_number + name: created_block_number + description: "Block number at which the contract was deployed/created" \ No newline at end of file diff --git a/models/yield_yak/avalanche_c/yield_yak_avalanche_c_trades.sql b/models/yield_yak/avalanche_c/yield_yak_avalanche_c_trades.sql index 4580ec5e790..2143f25532b 100644 --- a/models/yield_yak/avalanche_c/yield_yak_avalanche_c_trades.sql +++ b/models/yield_yak/avalanche_c/yield_yak_avalanche_c_trades.sql @@ -1,108 +1,19 @@ -{{ config( - - alias = 'trades', - partition_by = ['block_month'], - materialized = 'incremental', - file_format = 'delta', - incremental_strategy = 'merge', - unique_key = ['block_date', 'blockchain', 'project', 'version', 'tx_hash', 'evt_index', 'trace_address'], - post_hook='{{ expose_spells(\'["avalanche_c"]\', - "project", - "yield_yak", - \'["Henrystats"]\') }}' +{{ + config( + schema = 'yield_yak_avalanche_c', + alias = 'trades', + partition_by = ['block_month'], + materialized = 'incremental', + file_format = 'delta', + incremental_strategy = 'merge', + unique_key = ['block_date', 'blockchain', 'project', 'version', 'tx_hash', 'evt_index', 'trace_address'], + incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.block_time')] ) }} - -{% set project_start_date = '2021-09-15' %} - -WITH - -dexs as ( - SELECT - evt_block_time as block_time, - -- '' as taker, commenting this as there's no trader in the event - CAST(NULL as VARBINARY) as maker, - _amountIn as token_sold_amount_raw, - _amountOut as token_bought_amount_raw, - CAST(NULL as double) as amount_usd, - _tokenIn as token_sold_address, - _tokenOut as token_bought_address, - contract_address as project_contract_address, - evt_tx_hash as tx_hash, - ARRAY[-1] AS trace_address, - evt_index - FROM - {{ source('yield_yak_avalanche_c', 'YakRouter_evt_YakSwap') }} - {% if is_incremental() %} - WHERE evt_block_time >= date_trunc('day', now() - interval '7' Day) - {% endif %} -) - -SELECT - 'avalanche_c' as blockchain, - 'yield_yak' as project, - '1' as version, - CAST(date_trunc('DAY', dexs.block_time) as date) as block_date, - CAST(date_trunc('MONTH', dexs.block_time) as date) as block_month, - dexs.block_time, - erc20a.symbol as token_bought_symbol, - erc20b.symbol as token_sold_symbol, - CASE - WHEN lower(erc20a.symbol) > lower(erc20b.symbol) THEN concat(erc20b.symbol, '-', erc20a.symbol) - ELSE concat(erc20a.symbol, '-', erc20b.symbol) - END as token_pair, - dexs.token_bought_amount_raw / power(10, erc20a.decimals) as token_bought_amount, - dexs.token_sold_amount_raw / power(10, erc20b.decimals) as token_sold_amount, - dexs.token_bought_amount_raw AS token_bought_amount_raw, - dexs.token_sold_amount_raw AS token_sold_amount_raw, - COALESCE( - dexs.amount_usd, - (dexs.token_bought_amount_raw / power(10, p_bought.decimals)) * p_bought.price, - (dexs.token_sold_amount_raw / power(10, p_sold.decimals)) * p_sold.price - ) as amount_usd, - dexs.token_bought_address, - dexs.token_sold_address, - tx."from" as taker, - dexs.maker, - dexs.project_contract_address, - dexs.tx_hash, - tx."from" as tx_from, - tx.to AS tx_to, - dexs.trace_address, - dexs.evt_index -FROM dexs -INNER JOIN {{ source('avalanche_c', 'transactions') }} tx - ON tx.hash = dexs.tx_hash - {% if not is_incremental() %} - AND tx.block_time >= TIMESTAMP '{{project_start_date}}' - {% endif %} - {% if is_incremental() %} - AND tx.block_time >= date_trunc('day', now() - interval '7' Day) - {% endif %} -LEFT JOIN {{ source('tokens', 'erc20') }} erc20a - ON erc20a.contract_address = dexs.token_bought_address - AND erc20a.blockchain = 'avalanche_c' -LEFT JOIN {{ source('tokens', 'erc20') }} erc20b - ON erc20b.contract_address = dexs.token_sold_address - AND erc20b.blockchain = 'avalanche_c' -LEFT JOIN {{ source('prices', 'usd') }} p_bought - ON p_bought.minute = date_trunc('minute', dexs.block_time) - AND p_bought.contract_address = dexs.token_bought_address - AND p_bought.blockchain = 'avalanche_c' - {% if not is_incremental() %} - AND p_bought.minute >= TIMESTAMP '{{project_start_date}}' - {% endif %} - {% if is_incremental() %} - AND p_bought.minute >= date_trunc('day', now() - interval '7' Day) - {% endif %} -LEFT JOIN {{ source('prices', 'usd') }} p_sold - ON p_sold.minute = date_trunc('minute', dexs.block_time) - AND p_sold.contract_address = dexs.token_sold_address - AND p_sold.blockchain = 'avalanche_c' - {% if not is_incremental() %} - AND p_sold.minute >= TIMESTAMP '{{project_start_date}}' - {% endif %} - {% if is_incremental() %} - AND p_sold.minute >= date_trunc('day', now() - interval '7' Day) - {% endif %} \ No newline at end of file +{{ + yield_yak_trades( + blockchain = 'avalanche_c', + project_start_date = '2021-09-15' + ) +}} \ No newline at end of file diff --git a/models/yield_yak/avalanche_c/yield_yak_avalanche_c_yield_strategies.sql b/models/yield_yak/avalanche_c/yield_yak_avalanche_c_yield_strategies.sql new file mode 100644 index 00000000000..f2253079fe3 --- /dev/null +++ b/models/yield_yak/avalanche_c/yield_yak_avalanche_c_yield_strategies.sql @@ -0,0 +1,13 @@ +{{ + config( + schema = 'yield_yak_avalanche_c', + alias = 'yield_strategies', + materialized = 'view' + ) +}} + +{{ + yield_yak_yield_strategies( + blockchain = 'avalanche_c' + ) +}} diff --git a/models/yield_yak/mantle/yield_yak_mantle_balances.sql b/models/yield_yak/mantle/yield_yak_mantle_balances.sql new file mode 100644 index 00000000000..f549be89e14 --- /dev/null +++ b/models/yield_yak/mantle/yield_yak_mantle_balances.sql @@ -0,0 +1,19 @@ +{{ + config( + schema = 'yield_yak_mantle', + alias = 'balances', + materialized = 'incremental', + file_format = 'delta', + incremental_strategy = 'merge', + unique_key = ['contract_address', 'from_time'], + incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.to_time')] + ) +}} +-- depends_on: {{ ref('yield_yak_mantle_deposits') }} +-- depends_on: {{ ref('yield_yak_mantle_withdraws') }} +-- depends_on: {{ ref('yield_yak_mantle_reinvests') }} +{{ + yield_yak_balances( + blockchain = 'mantle' + ) +}} diff --git a/models/yield_yak/mantle/yield_yak_mantle_deposits.sql b/models/yield_yak/mantle/yield_yak_mantle_deposits.sql new file mode 100644 index 00000000000..127ffe0a9c3 --- /dev/null +++ b/models/yield_yak/mantle/yield_yak_mantle_deposits.sql @@ -0,0 +1,18 @@ +{{ + config( + schema = 'yield_yak_mantle', + alias = 'deposits', + materialized = 'incremental', + file_format = 'delta', + incremental_strategy = 'merge', + unique_key = ['block_number', 'tx_index', 'evt_index'], + incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.block_time')] + ) +}} + +{{ + yield_yak_deposits_withdraws( + blockchain = 'mantle', + event_name = 'Deposit' + ) +}} diff --git a/models/yield_yak/mantle/yield_yak_mantle_reinvests.sql b/models/yield_yak/mantle/yield_yak_mantle_reinvests.sql new file mode 100644 index 00000000000..abd51b54985 --- /dev/null +++ b/models/yield_yak/mantle/yield_yak_mantle_reinvests.sql @@ -0,0 +1,17 @@ +{{ + config( + schema = 'yield_yak_mantle', + alias = 'reinvests', + materialized = 'incremental', + file_format = 'delta', + incremental_strategy = 'merge', + unique_key = ['block_number', 'tx_index', 'evt_index'], + incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.block_time')] + ) +}} + +{{ + yield_yak_reinvests( + blockchain = 'mantle' + ) +}} diff --git a/models/yield_yak/mantle/yield_yak_mantle_schema.yml b/models/yield_yak/mantle/yield_yak_mantle_schema.yml new file mode 100644 index 00000000000..df0322029c1 --- /dev/null +++ b/models/yield_yak/mantle/yield_yak_mantle_schema.yml @@ -0,0 +1,408 @@ +version: 2 + +models: + - name: yield_yak_mantle_trades + meta: + blockchain: mantle + sector: dex + project: yield_yak + contributors: angus_1 + config: + tags: ['mantle','trades', 'aggregator', 'yield_yak','dex'] + description: > + yield yak aggregator trades on mantle + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - block_date + - blockchain + - project + - version + - tx_hash + - evt_index + - trace_address + - check_dex_aggregator_seed: + blockchain: mantle + project: yield_yak + version: 1 + columns: + - name: blockchain + description: "Blockchain which the DEX is deployed" + - &project + name: project + description: "Project name of the DEX" + - &version + name: version + description: "Version of the contract built and deployed by the DEX project" + - name: block_date + description: "UTC event block date of each DEX trade" + - name: block_time + description: "UTC event block time of each DEX trade" + - &token_bought_symbol + name: token_bought_symbol + description: "Token symbol for token bought in the transaction" + - &token_sold_symbol + name: token_sold_symbol + description: "Token symbol for token sold in the transaction" + - &token_pair + name: token_pair + description: "Token symbol pair for each token involved in the transaction" + - &token_bought_amount + name: token_bought_amount + description: "Value of the token bought at time of execution in the original currency" + - &token_sold_amount + name: token_sold_amount + description: "Value of the token sold at time of execution in the original currency" + - &token_bought_amount_raw + name: token_bought_amount_raw + description: "Raw value of the token bought at time of execution in the original currency" + - &token_sold_amount_raw + name: token_sold_amount_raw + description: "Raw value of the token sold at time of execution in the original currency" + - &amount_usd + name: amount_usd + description: "USD value of the trade at time of execution" + - &token_bought_address + name: token_bought_address + description: "Contract address of the token bought" + - &token_sold_address + name: token_sold_address + description: "Contract address of the token sold" + - &taker + name: taker + description: "Address of trader who purchased a token" + - &maker + name: maker + description: "Address of trader who sold a token" + - &project_contract_address + name: project_contract_address + description: "Project contract address which executed the trade on the blockchain" + - name: tx_hash + description: "Unique transaction hash value tied to each transaction on the DEX" + - &tx_from + name: tx_from + description: "Address which initiated the transaction" + - &tx_to + name: tx_to + description: "Address which received the transaction" + - &trace_address + name: trace_address + description: "" + - &evt_index + name: evt_index + description: "The position of this event log within this transaction" + - &block_month + name: block_month + description: "UTC event block month of each DEX trade" + + - name: yield_yak_mantle_deposits + meta: + blockchain: mantle + project: yield_yak + contributors: angus_1 + config: + tags: ['mantle', 'yield', 'aggregator', 'yield_yak', 'auto-compound', 'deposits'] + description: > + yield yak deposits on mantle + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - block_number + - tx_index + - evt_index + columns: + - &blockchain + name: blockchain + description: "Blockchain on which the YRT contract is deployed" + - &contract_address + name: contract_address + description: "Address of the YRT smart contract / strategy" + - &tx_hash + name: tx_hash + description: "Transaction hash of the deposit/withdraw/reinvest/swap" + - *evt_index + - &tx_index + name: tx_index + description: "Index of the transaction within the block" + - &block_time + name: block_time + description: "UTC time of the deposit/withdraw/reinvest/swap" + - &block_date + name: block_date + description: "UTC event block date of the deposit/withdraw/reinvest/swap" + - &block_number + name: block_number + description: "Block number of the deposit/withdraw/reinvest/swap" + - &user_address + name: user_address + description: "Address of the wallet which made the deposit/withdraw/reinvest" + - &deposit_amount + name: deposit_amount + description: "Amount of deposit tokens deposited into the strategy" + + - name: yield_yak_mantle_withdraws + meta: + blockchain: mantle + project: yield_yak + contributors: angus_1 + config: + tags: ['mantle', 'yield', 'aggregator', 'yield_yak', 'auto-compound', 'withdraws'] + description: > + yield yak withdraws on mantle + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - block_number + - tx_index + - evt_index + columns: + - *blockchain + - *contract_address + - *tx_hash + - *evt_index + - *tx_index + - *block_time + - *block_date + - *block_number + - *user_address + - &withdraw_amount + name: withdraw_amount + description: "Amount of deposit tokens withdrawn from the strategy" + + - name: yield_yak_mantle_reinvests + meta: + blockchain: mantle + project: yield_yak + contributors: angus_1 + config: + tags: ['mantle', 'yield', 'aggregator', 'yield_yak', 'auto-compound', 'reinvests'] + description: > + yield yak reinvests on mantle + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - block_number + - tx_index + - evt_index + columns: + - *blockchain + - *contract_address + - *tx_hash + - *evt_index + - *tx_index + - *block_time + - *block_date + - *block_number + - &reinvest_by_address + name: reinvest_by_address + description: "Address which triggered the transaction containing this Reinvest event" + - &new_total_deposits + name: new_total_deposits + description: "The total amount of deposit token in the strategy following the Reinvest event" + - &new_total_supply + name: new_total_supply + description: "The total supply of YRT following the Reinvest event" + - &apy + name: apy + description: "Annual Percentage Yield. Calculated using a weighted combination of recent Reinvest events" + - &ratio + name: ratio + description: "new_total_deposits / new_total_supply" + - &recent_reinvest_info + name: recent_reinvest_info + description: "An array of the ratio growth and time between reinvests for the last 25 Reinvest events" + + - name: yield_yak_mantle_balances + meta: + blockchain: mantle + project: yield_yak + contributors: angus_1 + config: + tags: ['mantle', 'yield', 'aggregator', 'yield_yak', 'auto-compound'] + description: > + yield yak vault/farm/pool balances on mantle as a temporal table + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - contract_address + - from_time + columns: + - *blockchain + - *contract_address + - &from_time + name: from_time + description: "UTC time from which the contract held this balance in its respective deposit token" + - &to_time + name: to_time + description: "UTC time until which the contract held this balance in its respective deposit token" + - &deposit_token_balance + name: deposit_token_balance + description: "Balance of deposit tokens held in the contract in the time window specified" + + - name: yield_yak_mantle_user_yrt_balances + meta: + blockchain: mantle + project: yield_yak + contributors: angus_1 + config: + tags: ['mantle', 'yield', 'aggregator', 'yield_yak', 'auto-compound'] + description: > + yield yak user-level YRT balances on mantle as a temporal table + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - user_address + - contract_address + - from_time + columns: + - *blockchain + - name: user_address + description: Address which holds the YRT + - *contract_address + - name: from_time + description: "UTC time from which the user held this balance of the contract_address YRT" + - name: to_time + description: "UTC time until which the user held this balance of the contract_address YRT" + - &yrt_balance + name: yrt_balance + description: "Balance of YRT tokens held by the user_address in the time window specified" + + - name: yield_yak_mantle_yak_swaps + meta: + blockchain: mantle + project: yield_yak + contributors: angus_1 + config: + tags: ['mantle', 'yakswap', 'swaps', 'aggregator', 'yield_yak', 'dex'] + description: > + yield yak aggregator yak swaps on mantle + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - block_number + - tx_index + - evt_index + columns: + - *blockchain + - &yak_router_address + name: yak_router_address + description: "Address of the YakRouter contract which made the swap" + - *block_number + - *block_date + - *block_time + - *tx_index + - *tx_hash + - &tx_to_address + name: tx_to_address + description: "Address 'to' which this transaction was sent (i.e. which had a function called)" + - &tx_fee + name: tx_fee + description: "Transaction / gas cost in native token for the transaction calculated using (price * gas used)" + - *evt_index + - &number_of_swaps_in_tx + name: number_of_swaps_in_tx + description: "Count of the number of YakSwap events in this same transaction (used to divide the gas cost / tx fee)" + - &tx_fee_per_swap + name: tx_fee_per_swap + description: "Transaction fee divided per each Yak Swap event" + - &trader_address + name: trader_address + description: "Address which initiated the transaction" + - &swap_token_in_address + name: swap_token_in_address + description: "Address of the token being sold in the YakSwap event" + - &swap_token_out_address + name: swap_token_out_address + description: "Address of the token being bought in the YakSwap event" + - &swap_amount_in + name: swap_amount_in + description: "Amount of the sold token being swapped from / traded in the YakSwap event" + - &swap_amount_out + name: swap_amount_out + description: "Amount of the bought token being swapped to / bought in the YakSwap event" + - &number_of_hops + name: number_of_hops + description: "Number of steps/hops the YakSwap has gone through in order to get the desired token at the best rate" + - &yak_adapter_swaps + name: yak_adapter_swaps + description: "JSON array containing detailed information about the individual YakAdapterSwap events which make up this YakSwap" + + - name: yield_yak_mantle_yak_adapter_swaps + meta: + blockchain: mantle + project: yield_yak + contributors: angus_1 + config: + tags: ['mantle', 'yakswap', 'swaps', 'aggregator', 'yield_yak', 'dex', 'yakadapter'] + description: > + yield yak aggregator yak adapter swaps on mantle + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - block_number + - tx_index + - adapter_evt_index + columns: + - *blockchain + - *yak_router_address + - *block_number + - *block_date + - *block_time + - *tx_index + - *tx_hash + - *tx_to_address + - *tx_fee + - &swap_evt_index + name: swap_evt_index + description: "Index of the YakSwap event to which this YakAdapterSwap event is related" + - *number_of_swaps_in_tx + - *trader_address + - *swap_token_in_address + - *swap_token_out_address + - *swap_amount_in + - *swap_amount_out + - *number_of_hops + - &adapter_evt_index + name: adapter_evt_index + description: "Index of the YakAdapterSwap event in the transaction" + - &adapter_address + name: adapter_address + description: "Address of the adapter being used for this part of the YakSwap" + - &adapter_token_in_address + name: adapter_token_in_address + description: "Address of the token being sold in the YakAdapterSwap event" + - &adapter_token_out_address + name: adapter_token_out_address + description: "Address of the token being bought in the YakAdapterSwap event" + - &adapter_amount_in + name: adapter_amount_in + description: "Amount of the sold token being swapped from / traded in the YakAdapterSwap event" + - &adapter_amount_out + name: adapter_amount_out + description: "Amount of the bought token being swapped to / bought in the YakAdapterSwap event" + + - name: yield_yak_mantle_yield_strategies + meta: + blockchain: mantle + project: yield_yak + contributors: angus_1 + config: + tags: ['mantle', 'yield_yak', 'strategies', 'yield'] + description: > + yield yak strategies on mantle + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - contract_address + columns: + - *blockchain + - *contract_address + - &contract_name + name: contract_name + description: "Name of the deployed contract" + - &created_block_time + name: created_block_time + description: "Timestamp at which the contract was deployed/created" + - &created_block_number + name: created_block_number + description: "Block number at which the contract was deployed/created" \ No newline at end of file diff --git a/models/yield_yak/mantle/yield_yak_mantle_trades.sql b/models/yield_yak/mantle/yield_yak_mantle_trades.sql new file mode 100644 index 00000000000..781dd174563 --- /dev/null +++ b/models/yield_yak/mantle/yield_yak_mantle_trades.sql @@ -0,0 +1,19 @@ +{{ + config( + schema = 'yield_yak_mantle', + alias = 'trades', + partition_by = ['block_month'], + materialized = 'incremental', + file_format = 'delta', + incremental_strategy = 'merge', + unique_key = ['block_date', 'blockchain', 'project', 'version', 'tx_hash', 'evt_index', 'trace_address'], + incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.block_time')] + ) +}} + +{{ + yield_yak_trades( + blockchain = 'mantle', + project_start_date = '2024-01-09' + ) +}} \ No newline at end of file diff --git a/models/yield_yak/mantle/yield_yak_mantle_user_yrt_balances.sql b/models/yield_yak/mantle/yield_yak_mantle_user_yrt_balances.sql new file mode 100644 index 00000000000..adbcf885e01 --- /dev/null +++ b/models/yield_yak/mantle/yield_yak_mantle_user_yrt_balances.sql @@ -0,0 +1,17 @@ +{{ + config( + schema = 'yield_yak_mantle', + alias = 'user_yrt_balances', + materialized = 'incremental', + file_format = 'delta', + incremental_strategy = 'merge', + unique_key = ['user_address', 'contract_address', 'from_time'], + incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.to_time')] + ) +}} + +{{ + yield_yak_user_yrt_balances( + blockchain = 'mantle' + ) +}} diff --git a/models/yield_yak/mantle/yield_yak_mantle_withdraws.sql b/models/yield_yak/mantle/yield_yak_mantle_withdraws.sql new file mode 100644 index 00000000000..6366b2f2ca7 --- /dev/null +++ b/models/yield_yak/mantle/yield_yak_mantle_withdraws.sql @@ -0,0 +1,18 @@ +{{ + config( + schema = 'yield_yak_mantle', + alias = 'withdraws', + materialized = 'incremental', + file_format = 'delta', + incremental_strategy = 'merge', + unique_key = ['block_number', 'tx_index', 'evt_index'], + incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.block_time')] + ) +}} + +{{ + yield_yak_deposits_withdraws( + blockchain = 'mantle', + event_name = 'Withdraw' + ) +}} diff --git a/models/yield_yak/mantle/yield_yak_mantle_yak_adapter_swaps.sql b/models/yield_yak/mantle/yield_yak_mantle_yak_adapter_swaps.sql new file mode 100644 index 00000000000..9b279acc19f --- /dev/null +++ b/models/yield_yak/mantle/yield_yak_mantle_yak_adapter_swaps.sql @@ -0,0 +1,17 @@ +{{ + config( + schema = 'yield_yak_mantle', + alias = 'yak_adapter_swaps', + materialized = 'incremental', + file_format = 'delta', + incremental_strategy = 'merge', + unique_key = ['block_number', 'tx_index', 'adapter_evt_index'], + incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.block_time')] + ) +}} + +{{ + yield_yak_yak_adapter_swaps( + blockchain = 'mantle' + ) +}} diff --git a/models/yield_yak/mantle/yield_yak_mantle_yak_swaps.sql b/models/yield_yak/mantle/yield_yak_mantle_yak_swaps.sql new file mode 100644 index 00000000000..bd2662df927 --- /dev/null +++ b/models/yield_yak/mantle/yield_yak_mantle_yak_swaps.sql @@ -0,0 +1,17 @@ +{{ + config( + schema = 'yield_yak_mantle', + alias = 'yak_swaps', + materialized = 'incremental', + file_format = 'delta', + incremental_strategy = 'merge', + unique_key = ['block_number', 'tx_index', 'evt_index'], + incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.block_time')] + ) +}} + +{{ + yield_yak_yak_swaps( + blockchain = 'mantle' + ) +}} diff --git a/models/yield_yak/mantle/yield_yak_mantle_yield_strategies.sql b/models/yield_yak/mantle/yield_yak_mantle_yield_strategies.sql new file mode 100644 index 00000000000..27184572282 --- /dev/null +++ b/models/yield_yak/mantle/yield_yak_mantle_yield_strategies.sql @@ -0,0 +1,13 @@ +{{ + config( + schema = 'yield_yak_mantle', + alias = 'yield_strategies', + materialized = 'view' + ) +}} + +{{ + yield_yak_yield_strategies( + blockchain = 'mantle' + ) +}} diff --git a/models/yield_yak/yield_yak_balances.sql b/models/yield_yak/yield_yak_balances.sql index f59a70fb06f..0c532283def 100644 --- a/models/yield_yak/yield_yak_balances.sql +++ b/models/yield_yak/yield_yak_balances.sql @@ -4,7 +4,7 @@ alias = 'balances', materialized = 'view', post_hook='{{ expose_spells( - blockchains = \'["arbitrum", "avalanche_c"]\', + blockchains = \'["arbitrum", "avalanche_c", "mantle"]\', spell_type = "project", spell_name = "yield_yak", contributors = \'["angus_1"]\') }}' @@ -12,8 +12,9 @@ }} {%- set yield_yak_models = [ -ref('yield_yak_avalanche_c_balances') -,ref('yield_yak_arbitrum_balances') + ref('yield_yak_avalanche_c_balances'), + ref('yield_yak_arbitrum_balances'), + ref('yield_yak_mantle_balances') ] -%} diff --git a/models/yield_yak/yield_yak_deposits.sql b/models/yield_yak/yield_yak_deposits.sql index 1ffa9e4d63d..5d14f59f99d 100644 --- a/models/yield_yak/yield_yak_deposits.sql +++ b/models/yield_yak/yield_yak_deposits.sql @@ -4,7 +4,7 @@ alias = 'deposits', materialized = 'view', post_hook='{{ expose_spells( - blockchains = \'["arbitrum", "avalanche_c"]\', + blockchains = \'["arbitrum", "avalanche_c", "mantle"]\', spell_type = "project", spell_name = "yield_yak", contributors = \'["angus_1"]\') }}' @@ -12,8 +12,9 @@ }} {%- set yield_yak_models = [ -ref('yield_yak_avalanche_c_deposits') -,ref('yield_yak_arbitrum_deposits') + ref('yield_yak_avalanche_c_deposits'), + ref('yield_yak_arbitrum_deposits'), + ref('yield_yak_mantle_deposits') ] -%} diff --git a/models/yield_yak/yield_yak_reinvests.sql b/models/yield_yak/yield_yak_reinvests.sql index 96a862a26fb..1d3a9e94f6c 100644 --- a/models/yield_yak/yield_yak_reinvests.sql +++ b/models/yield_yak/yield_yak_reinvests.sql @@ -4,7 +4,7 @@ alias = 'reinvests', materialized = 'view', post_hook='{{ expose_spells( - blockchains = \'["arbitrum", "avalanche_c"]\', + blockchains = \'["arbitrum", "avalanche_c", "mantle"]\', spell_type = "project", spell_name = "yield_yak", contributors = \'["angus_1"]\') }}' @@ -12,8 +12,9 @@ }} {%- set yield_yak_models = [ -ref('yield_yak_avalanche_c_reinvests') -,ref('yield_yak_arbitrum_reinvests') + ref('yield_yak_avalanche_c_reinvests'), + ref('yield_yak_arbitrum_reinvests'), + ref('yield_yak_mantle_reinvests') ] -%} diff --git a/models/yield_yak/yield_yak_schema.yml b/models/yield_yak/yield_yak_schema.yml index 1e949e89116..7062261dc57 100644 --- a/models/yield_yak/yield_yak_schema.yml +++ b/models/yield_yak/yield_yak_schema.yml @@ -3,12 +3,12 @@ version: 2 models: - name: yield_yak_trades meta: - blockchain: avalanche_c, arbitrum + blockchain: avalanche_c, arbitrum, mantle sector: dex project: yield_yak contributors: Henrystats, angus_1 config: - tags: ['avalanche_c', 'yield_yak','trades', 'dex', 'aggregator', 'Henrystats', 'angus_1', 'cross-chain', 'arbitrum'] + tags: ['avalanche_c', 'yield_yak','trades', 'dex', 'aggregator', 'Henrystats', 'angus_1', 'cross-chain', 'arbitrum', 'mantle'] description: > yield yak aggregator trades on all chains across all contracts and versions. This table will load dex trades downstream. columns: @@ -80,11 +80,11 @@ models: - name: yield_yak_deposits meta: - blockchain: avalanche_c, arbitrum + blockchain: avalanche_c, arbitrum, mantle project: yield_yak contributors: angus_1 config: - tags: ['avalanche_c', 'arbitrum', 'yield', 'aggregator', 'yield_yak', 'auto-compound', 'deposits'] + tags: ['avalanche_c', 'arbitrum', 'mantle', 'yield', 'aggregator', 'yield_yak', 'auto-compound', 'deposits'] description: > yield yak deposits tests: @@ -126,11 +126,11 @@ models: - name: yield_yak_withdraws meta: - blockchain: avalanche_c, arbitrum + blockchain: avalanche_c, arbitrum, mantle project: yield_yak contributors: angus_1 config: - tags: ['avalanche_c', 'arbitrum', 'yield', 'aggregator', 'yield_yak', 'auto-compound', 'withdraws'] + tags: ['avalanche_c', 'arbitrum', 'mantle', 'yield', 'aggregator', 'yield_yak', 'auto-compound', 'withdraws'] description: > yield yak withdraws tests: @@ -156,11 +156,11 @@ models: - name: yield_yak_reinvests meta: - blockchain: avalanche_c, arbitrum + blockchain: avalanche_c, arbitrum, mantle project: yield_yak contributors: angus_1 config: - tags: ['avalanche_c', 'arbitrum', 'yield', 'aggregator', 'yield_yak', 'auto-compound', 'reinvests'] + tags: ['avalanche_c', 'arbitrum', 'mantle', 'yield', 'aggregator', 'yield_yak', 'auto-compound', 'reinvests'] description: > yield yak reinvests tests: @@ -200,11 +200,11 @@ models: - name: yield_yak_balances meta: - blockchain: avalanche_c, arbitrum + blockchain: avalanche_c, arbitrum, mantle project: yield_yak contributors: angus_1 config: - tags: ['avalanche_c', 'arbitrum', 'yield', 'aggregator', 'yield_yak', 'auto-compound'] + tags: ['avalanche_c', 'arbitrum', 'mantle', 'yield', 'aggregator', 'yield_yak', 'auto-compound'] description: > yield yak vault/farm/pool balances as a temporal table tests: @@ -228,11 +228,11 @@ models: - name: yield_yak_user_yrt_balances meta: - blockchain: avalanche_c, arbitrum + blockchain: avalanche_c, arbitrum, mantle project: yield_yak contributors: angus_1 config: - tags: ['avalanche_c', 'arbitrum', 'yield', 'aggregator', 'yield_yak', 'auto-compound'] + tags: ['avalanche_c', 'arbitrum', 'mantle', 'yield', 'aggregator', 'yield_yak', 'auto-compound'] description: > yield yak user-level YRT balances as a temporal table tests: @@ -257,11 +257,11 @@ models: - name: yield_yak_yak_swaps meta: - blockchain: avalanche_c, arbitrum + blockchain: avalanche_c, arbitrum, mantle project: yield_yak contributors: angus_1 config: - tags: ['avalanche_c', 'arbitrum', 'yakswap', 'swaps', 'aggregator', 'yield_yak', 'dex'] + tags: ['avalanche_c', 'arbitrum', 'mantle', 'yakswap', 'swaps', 'aggregator', 'yield_yak', 'dex'] description: > yield yak aggregator yak swaps tests: @@ -318,11 +318,11 @@ models: - name: yield_yak_yak_adapter_swaps meta: - blockchain: avalanche_c, arbitrum + blockchain: avalanche_c, arbitrum, mantle project: yield_yak contributors: angus_1 config: - tags: ['avalanche_c', 'arbitrum', 'yakswap', 'swaps', 'aggregator', 'yield_yak', 'dex', 'yakadapter'] + tags: ['avalanche_c', 'arbitrum', 'mantle', 'yakswap', 'swaps', 'aggregator', 'yield_yak', 'dex', 'yakadapter'] description: > yield yak aggregator yak adapter swaps tests: @@ -369,4 +369,31 @@ models: description: "Amount of the sold token being swapped from / traded in the YakAdapterSwap event" - &adapter_amount_out name: adapter_amount_out - description: "Amount of the bought token being swapped to / bought in the YakAdapterSwap event" \ No newline at end of file + description: "Amount of the bought token being swapped to / bought in the YakAdapterSwap event" + + - name: yield_yak_yield_strategies + meta: + blockchain: avalanche_c, arbitrum, mantle + project: yield_yak + contributors: angus_1 + config: + tags: ['avalanche_c', 'arbitrum', 'mantle', 'yield_yak', 'strategies', 'yield'] + description: > + yield yak strategies on all chains + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - blockchain + - contract_address + columns: + - *blockchain + - *contract_address + - &contract_name + name: contract_name + description: "Name of the deployed contract" + - &created_block_time + name: created_block_time + description: "Timestamp at which the contract was deployed/created" + - &created_block_number + name: created_block_number + description: "Block number at which the contract was deployed/created" \ No newline at end of file diff --git a/models/yield_yak/yield_yak_trades.sql b/models/yield_yak/yield_yak_trades.sql index b114e6767a6..2a919012d32 100644 --- a/models/yield_yak/yield_yak_trades.sql +++ b/models/yield_yak/yield_yak_trades.sql @@ -1,46 +1,54 @@ -{{ config( - schema = 'yield_yak', - alias = 'trades' +{{ + config( + schema = 'yield_yak', + alias = 'trades', + materialized = 'view', + post_hook='{{ expose_spells( + blockchains = \'["arbitrum", "avalanche_c", "mantle"]\', + spell_type = "project", + spell_name = "yield_yak", + contributors = \'["angus_1", "Henrystats"]\') }}' ) }} -{% set yield_yak_models = [ -ref('yield_yak_avalanche_c_trades') -,ref('yield_yak_arbitrum_trades') -] %} +{%- set yield_yak_models = [ + ref('yield_yak_avalanche_c_trades'), + ref('yield_yak_arbitrum_trades'), + ref('yield_yak_mantle_trades') +] -%} SELECT * FROM ( - {% for dex_model in yield_yak_models %} + {%- for dex_model in yield_yak_models %} SELECT - blockchain, - project, - version, - block_month, - block_date, - block_time, - token_bought_symbol, - token_sold_symbol, - token_pair, - token_bought_amount, - token_sold_amount, - token_bought_amount_raw, - token_sold_amount_raw, - amount_usd, - token_bought_address, - token_sold_address, - taker, - maker, - project_contract_address, - tx_hash, - tx_from, - tx_to, - trace_address, - evt_index + blockchain + , project + , version + , block_month + , block_date + , block_time + , token_bought_symbol + , token_sold_symbol + , token_pair + , token_bought_amount + , token_sold_amount + , token_bought_amount_raw + , token_sold_amount_raw + , amount_usd + , token_bought_address + , token_sold_address + , taker + , maker + , project_contract_address + , tx_hash + , tx_from + , tx_to + , trace_address + , evt_index FROM {{ dex_model }} - {% if not loop.last %} + {% if not loop.last -%} UNION ALL - {% endif %} - {% endfor %} + {%- endif -%} + {%- endfor %} ) diff --git a/models/yield_yak/yield_yak_user_yrt_balances.sql b/models/yield_yak/yield_yak_user_yrt_balances.sql index 2aefcbc14ac..746e129a21c 100644 --- a/models/yield_yak/yield_yak_user_yrt_balances.sql +++ b/models/yield_yak/yield_yak_user_yrt_balances.sql @@ -4,7 +4,7 @@ alias = 'user_yrt_balances', materialized = 'view', post_hook='{{ expose_spells( - blockchains = \'["arbitrum", "avalanche_c"]\', + blockchains = \'["arbitrum", "avalanche_c", "mantle"]\', spell_type = "project", spell_name = "yield_yak", contributors = \'["angus_1"]\') }}' @@ -12,8 +12,9 @@ }} {%- set yield_yak_models = [ -ref('yield_yak_avalanche_c_user_yrt_balances') -,ref('yield_yak_arbitrum_user_yrt_balances') + ref('yield_yak_avalanche_c_user_yrt_balances'), + ref('yield_yak_arbitrum_user_yrt_balances'), + ref('yield_yak_mantle_user_yrt_balances') ] -%} diff --git a/models/yield_yak/yield_yak_withdraws.sql b/models/yield_yak/yield_yak_withdraws.sql index dfbeb45136d..51a620d994a 100644 --- a/models/yield_yak/yield_yak_withdraws.sql +++ b/models/yield_yak/yield_yak_withdraws.sql @@ -4,7 +4,7 @@ alias = 'withdraws', materialized = 'view', post_hook='{{ expose_spells( - blockchains = \'["arbitrum", "avalanche_c"]\', + blockchains = \'["arbitrum", "avalanche_c", "mantle"]\', spell_type = "project", spell_name = "yield_yak", contributors = \'["angus_1"]\') }}' @@ -12,8 +12,9 @@ }} {%- set yield_yak_models = [ -ref('yield_yak_avalanche_c_withdraws') -,ref('yield_yak_arbitrum_withdraws') + ref('yield_yak_avalanche_c_withdraws'), + ref('yield_yak_arbitrum_withdraws'), + ref('yield_yak_mantle_withdraws') ] -%} diff --git a/models/yield_yak/yield_yak_yak_adapter_swaps.sql b/models/yield_yak/yield_yak_yak_adapter_swaps.sql index 6ea6cb57de7..fc10ce2eb3a 100644 --- a/models/yield_yak/yield_yak_yak_adapter_swaps.sql +++ b/models/yield_yak/yield_yak_yak_adapter_swaps.sql @@ -4,7 +4,7 @@ alias = 'yak_adapter_swaps', materialized = 'view', post_hook='{{ expose_spells( - blockchains = \'["arbitrum", "avalanche_c"]\', + blockchains = \'["arbitrum", "avalanche_c", "mantle"]\', spell_type = "project", spell_name = "yield_yak", contributors = \'["angus_1"]\') }}' @@ -12,8 +12,9 @@ }} {%- set yield_yak_models = [ -ref('yield_yak_avalanche_c_yak_adapter_swaps') -,ref('yield_yak_arbitrum_yak_adapter_swaps') + ref('yield_yak_avalanche_c_yak_adapter_swaps'), + ref('yield_yak_arbitrum_yak_adapter_swaps'), + ref('yield_yak_mantle_yak_adapter_swaps') ] -%} diff --git a/models/yield_yak/yield_yak_yak_swaps.sql b/models/yield_yak/yield_yak_yak_swaps.sql index c1cadba616f..a2b2230daef 100644 --- a/models/yield_yak/yield_yak_yak_swaps.sql +++ b/models/yield_yak/yield_yak_yak_swaps.sql @@ -4,7 +4,7 @@ alias = 'yak_swaps', materialized = 'view', post_hook='{{ expose_spells( - blockchains = \'["arbitrum", "avalanche_c"]\', + blockchains = \'["arbitrum", "avalanche_c", "mantle"]\', spell_type = "project", spell_name = "yield_yak", contributors = \'["angus_1"]\') }}' @@ -12,8 +12,9 @@ }} {%- set yield_yak_models = [ -ref('yield_yak_avalanche_c_yak_swaps') -,ref('yield_yak_arbitrum_yak_swaps') + ref('yield_yak_avalanche_c_yak_swaps'), + ref('yield_yak_arbitrum_yak_swaps'), + ref('yield_yak_mantle_yak_swaps') ] -%} diff --git a/models/yield_yak/yield_yak_yield_strategies.sql b/models/yield_yak/yield_yak_yield_strategies.sql new file mode 100644 index 00000000000..17b06664ffc --- /dev/null +++ b/models/yield_yak/yield_yak_yield_strategies.sql @@ -0,0 +1,35 @@ +{{ + config( + schema = 'yield_yak', + alias = 'yield_strategies', + materialized = 'view', + post_hook='{{ expose_spells( + blockchains = \'["arbitrum", "avalanche_c", "mantle"]\', + spell_type = "project", + spell_name = "yield_yak", + contributors = \'["angus_1"]\') }}' + ) +}} + +{%- set yield_yak_models = [ + ref('yield_yak_avalanche_c_yield_strategies'), + ref('yield_yak_arbitrum_yield_strategies'), + ref('yield_yak_mantle_yield_strategies') +] -%} + + +SELECT * +FROM ( + {%- for strategy_model in yield_yak_models %} + SELECT + blockchain + , contract_address + , contract_name + , created_block_time + , created_block_number + FROM {{ strategy_model }} + {% if not loop.last -%} + UNION ALL + {%- endif -%} + {%- endfor %} +) diff --git a/seeds/dex/aggregator/dex_aggregator_seed.csv b/seeds/dex/aggregator/dex_aggregator_seed.csv index caf350e12df..43e23ce9007 100644 --- a/seeds/dex/aggregator/dex_aggregator_seed.csv +++ b/seeds/dex/aggregator/dex_aggregator_seed.csv @@ -3,6 +3,8 @@ avalanche_c,yield_yak,1,2023-01-17,0x84c005d0dba60131a638a0eaafee57bdcad502bf04c avalanche_c,yield_yak,1,2023-01-17,0xf0d9b16841b53a80cb6721fc136c4899bb8a4998bcb4804f0f4c70e079db3d24,16,-1,0x9702230a8ea53601f5cd2dc00fdbc13d4df4a8c7,76.042075,0x50b7545627a5162f82a992c33b87adc75187b218,0.0036 arbitrum,yield_yak,1,2024-01-10,0x4b5ee769576905155d3747078e2a74e0e20dddffc92c18b9ad66c05872891dbd,7,-1,0xfd086bc7cd5c481dcc9c85ebe478a1c0b69fcbb9,1771.006720,0xaf88d065e77c8cc2239327c5edb3a432268e5831,1771.449734 arbitrum,yield_yak,1,2024-01-10,0xd4ece02125262fc4da6c95e5afe93ced9a39d4d7b6b1aa64da7c7d24c79079b1,18,-1,0xaf88d065e77c8cc2239327c5edb3a432268e5831,189.586564,0x912ce59144191c1204e64559fe8253a0e49e6548,97.938232001832199721 +mantle,yield_yak,1,2024-06-03,0x51d8c2d916a640e95df55337bbe03cb86ff07cdf168839526927e537604f162e,12,-1,0x09bc4e0d864854c6afb6eb9a9cdf58ac190d0df9,774.289843,0xcda86a272531e8640cd7f1a92c01839911b90bb0,0.200000000000000000 +mantle,yield_yak,1,2024-06-03,0xe598e4fe07d1920bdbd78d59a677a0be244576ec527a6d82fc5a0b5240bd58fe,7,-1,0x201eba5cc46d216ce6dc03f6a759e8e766e956ae,774.492903,0xcda86a272531e8640cd7f1a92c01839911b90bb0,0.200000000000000000 fantom,openocean,2,2023-01-18,0xebcba4785782cb71a405b2cfe8bf1b0bc7a4ec5a430fc25b8d27cc6a3f509d6a,318,-1,0x21be370d5312f44cb42ce377bc9b8a0cef1a4c83,152.17069090909090909,0x74b23882a30290451a17c44f4f05243b6b58c76d,0.03 fantom,openocean,2,2023-01-19,0x51f72c8146b36aeccdf9c1714f600595ab48fd71e567dea57b5df8509a245dbe,22,-1,0x04068da6c83afcfa0e13ba15a6696662335d5b75,1185,0x8d11ec38a3eb5e956b052f67da8bdc9bef8abf3e,1185.53317946613 avalanche_c,openocean,2,2023-01-19,0x8c2cf5f93cfd9206c799076480e05f5b97b3076a4e7af8e19dd0b5d7c09da2f9,24,-1,0xc7198437980c041c805a1edcba50c1ce5db95118,1.514025,0x49d5c2bdffac6ce2bfdb6640f4f80f226bc10bab,0.001 diff --git a/sources/yield_yak/arbitrum/yield_yak_arbitrum_sources.yml b/sources/yield_yak/arbitrum/yield_yak_arbitrum_sources.yml index c69dba81f87..3e6428ed586 100644 --- a/sources/yield_yak/arbitrum/yield_yak_arbitrum_sources.yml +++ b/sources/yield_yak/arbitrum/yield_yak_arbitrum_sources.yml @@ -5,7 +5,7 @@ sources: freshness: warn_after: { count: 12, period: hour } description: > - Decoded event tables for swaps, deposits, withdraws and reinvests on yield yak + Decoded event tables for swaps, deposits, withdraws, reinvests and transfers on yield yak tables: - name: YakRouter_evt_YakSwap loaded_at_field: evt_block_time diff --git a/sources/yield_yak/avalanche_c/yield_yak_avalanche_c_sources.yml b/sources/yield_yak/avalanche_c/yield_yak_avalanche_c_sources.yml index 7e04d4b2b00..078e9f4891a 100644 --- a/sources/yield_yak/avalanche_c/yield_yak_avalanche_c_sources.yml +++ b/sources/yield_yak/avalanche_c/yield_yak_avalanche_c_sources.yml @@ -5,7 +5,7 @@ sources: freshness: warn_after: { count: 12, period: hour } description: > - Decoded event tables for swaps, deposits, withdraws and reinvests on yield yak + Decoded event tables for swaps, deposits, withdraws, reinvests and transfers on yield yak tables: - name: YakRouter_evt_YakSwap loaded_at_field: evt_block_time diff --git a/sources/yield_yak/mantle/yield_yak_mantle_sources.yml b/sources/yield_yak/mantle/yield_yak_mantle_sources.yml new file mode 100644 index 00000000000..9e761493733 --- /dev/null +++ b/sources/yield_yak/mantle/yield_yak_mantle_sources.yml @@ -0,0 +1,70 @@ +version: 2 + +sources: + - name: yield_yak_mantle + freshness: + warn_after: { count: 12, period: hour } + description: > + Decoded event tables for swaps, deposits, withdraws, reinvests and transfers on yield yak + tables: + - name: YakRouter_evt_YakSwap + loaded_at_field: evt_block_time + - name: YakRouter_call_swapNoSplitFromAVAX + loaded_at_field: call_block_time + - name: YakRouter_call_swapNoSplit + loaded_at_field: call_block_time + - name: YakRouter_call_swapNoSplitToAVAXWithPermit + loaded_at_field: call_block_time + - name: YakRouter_call_swapNoSplitWithPermit + loaded_at_field: call_block_time + - name: YakRouter_call_swapNoSplitToAVAX + loaded_at_field: call_block_time + # Now the strategies + - name: CompoundingJoeMantle_evt_Deposit + loaded_at_field: evt_block_time + - name: CompoundingJoeMantle_evt_Withdraw + loaded_at_field: evt_block_time + - name: CompoundingJoeMantle_evt_Reinvest + loaded_at_field: evt_block_time + - name: CompoundingJoeMantle_evt_Transfer + loaded_at_field: evt_block_time + - name: CompoundingMoe_evt_Deposit + loaded_at_field: evt_block_time + - name: CompoundingMoe_evt_Withdraw + loaded_at_field: evt_block_time + - name: CompoundingMoe_evt_Reinvest + loaded_at_field: evt_block_time + - name: CompoundingMoe_evt_Transfer + loaded_at_field: evt_block_time + - name: CompoundingYYStaking_evt_Deposit + loaded_at_field: evt_block_time + - name: CompoundingYYStaking_evt_Withdraw + loaded_at_field: evt_block_time + - name: CompoundingYYStaking_evt_Reinvest + loaded_at_field: evt_block_time + - name: CompoundingYYStaking_evt_Transfer + loaded_at_field: evt_block_time + - name: LendleStrategy_evt_Deposit + loaded_at_field: evt_block_time + - name: LendleStrategy_evt_Withdraw + loaded_at_field: evt_block_time + - name: LendleStrategy_evt_Reinvest + loaded_at_field: evt_block_time + - name: LendleStrategy_evt_Transfer + loaded_at_field: evt_block_time + - name: MoeStrategy_evt_Deposit + loaded_at_field: evt_block_time + - name: MoeStrategy_evt_Withdraw + loaded_at_field: evt_block_time + - name: MoeStrategy_evt_Reinvest + loaded_at_field: evt_block_time + - name: MoeStrategy_evt_Transfer + loaded_at_field: evt_block_time + - name: StargateV2Strategy_evt_Deposit + loaded_at_field: evt_block_time + - name: StargateV2Strategy_evt_Withdraw + loaded_at_field: evt_block_time + - name: StargateV2Strategy_evt_Reinvest + loaded_at_field: evt_block_time + - name: StargateV2Strategy_evt_Transfer + loaded_at_field: evt_block_time \ No newline at end of file diff --git a/tokens/models/tokens/mantle/tokens_mantle_erc20.sql b/tokens/models/tokens/mantle/tokens_mantle_erc20.sql new file mode 100644 index 00000000000..240682ad099 --- /dev/null +++ b/tokens/models/tokens/mantle/tokens_mantle_erc20.sql @@ -0,0 +1,35 @@ +{{ + config( + schema = 'tokens_mantle' + ,alias = 'erc20' + ,tags = ['static'] + ,materialized = 'table' + ) +}} + +SELECT + contract_address + , symbol + , decimals +FROM (VALUES + (0x19a414a6b1743315c731492cb9b7b559d7db9ab7, 'MoeLP', 18) + , (0x1a4d4aa3bd8587f6e05cc98cf87954f7d95c11c6, 'MoeLP', 18) + , (0x30ac02b4c99d140cde2a212ca807cbda35d4f6b5, 'MoeLP', 18) + , (0x33b1d7cfff71bba9dd987f96ad57e0a5f7db9ac5, 'MoeLP', 18) + , (0x347bb5065eadd5f7cb5fd0a696137d49f38ac6cb, 'MoeLP', 18) + , (0x371c7ec6d8039ff7933a2aa28eb827ffe1f52f07, 'JOE', 18) + , (0x4515a45337f461a11ff0fe8abf3c606ae5dc00c9, 'MOE', 18) + , (0x4a18891de69124d2853a4e27543edb7e2e001179, 'MoeLP', 18) + , (0x4e7685df06201521f35a182467feefe02c53d847, 'MoeLP', 18) + , (0x5126ac4145ed84ebe28cfb34bb6300bcef492bb7, 'MoeLP', 18) + , (0x562a1a3979a4a10ac2e060cfa4b53cad8011604a, 'MoeLP', 18) + , (0x763868612858358f62b05691db82ad35a9b3e110, 'MoeLP', 18) + , (0x7d35ba038df5afde64a1962683ffeb3e150637ff, 'MoeLP', 18) + , (0x86e3a987187fed135d6d9c114f1857d8144f01e1, 'MoeLP', 18) + , (0x8e3a13418743ab1a98434551937ea687e451b589, 'MoeLP', 18) + , (0xb1e695dc6ca41d0dc5030d7e316c879a47fd492a, 'MoeLP', 18) + , (0xb670d2b452d0ecc468cccfd532482d45dddde2a1, 'MoeLP', 18) + , (0xc1f43e45f86e7bfb92c3c309b0ef366f9ba33bfa, 'MoeLP', 18) + , (0xefc38c1b0d60725b824ebee8d431abfbf12bc953, 'MoeLP', 18) + , (0xfbea6da85f6554fe4d429e9f37f8ba54a9ac94c3, 'MoeLP', 18) +) AS temp_table (contract_address, symbol, decimals) diff --git a/tokens/models/tokens/mantle/tokens_mantle_schema.yml b/tokens/models/tokens/mantle/tokens_mantle_schema.yml new file mode 100644 index 00000000000..e278f6121aa --- /dev/null +++ b/tokens/models/tokens/mantle/tokens_mantle_schema.yml @@ -0,0 +1,21 @@ +version: 2 + +models: + - name: tokens_mantle_erc20 + meta: + blockchain: mantle + sector: tokens + project: erc20 + contributors: angus_1 + config: + tags: ['table', 'erc20'] + description: "ERC20 Token Addresses, Symbols and Decimals" + columns: + - name: contract_address + description: "ERC20 token contract address" + tests: + - unique + - name: symbol + description: "ERC20 token symbol" + - name: decimals + description: "Number of decimals, refers to how divisible an ERC20 token can be" \ No newline at end of file diff --git a/tokens/models/tokens/tokens_erc20.sql b/tokens/models/tokens/tokens_erc20.sql index 1f334bc282f..3163e392095 100644 --- a/tokens/models/tokens/tokens_erc20.sql +++ b/tokens/models/tokens/tokens_erc20.sql @@ -3,10 +3,10 @@ schema = 'tokens' ,alias = 'erc20' ,materialized = 'table' - ,post_hook='{{ expose_spells(\'["arbitrum","avalanche_c","base","bnb","celo","ethereum","fantom","gnosis","goerli","optimism","polygon","scroll","zkevm","zksync","zora","fuse"]\', + ,post_hook='{{ expose_spells(\'["arbitrum","avalanche_c","base","bnb","celo","ethereum","fantom","fuse","gnosis","goerli","mantle","optimism","polygon","scroll","zkevm","zksync","zora"]\', "sector", "tokens", - \'["bh2smith", "0xManny","hildobby","soispoke","dot2dotseurat","mtitus6","wuligy","lgingerich","0xRob","jeff-dude", "viniabussafi","IrishLatte19"]\') }}' + \'["bh2smith","0xManny","hildobby","soispoke","dot2dotseurat","mtitus6","wuligy","lgingerich","0xRob","jeff-dude","viniabussafi","IrishLatte19","angus_1"]\') }}' ) }} @@ -23,15 +23,16 @@ ,'tokens_celo': {'blockchain': 'celo', 'model': ref('tokens_celo_erc20')} ,'tokens_ethereum': {'blockchain': 'ethereum', 'model': ref('tokens_ethereum_erc20')} ,'tokens_fantom': {'blockchain': 'fantom', 'model': ref('tokens_fantom_erc20')} + ,'tokens_fuse': {'blockchain': 'fuse', 'model': ref('tokens_fuse_erc20')} ,'tokens_gnosis': {'blockchain': 'gnosis', 'model': ref('tokens_gnosis_erc20')} ,'tokens_goerli': {'blockchain': 'goerli', 'model': ref('tokens_goerli_erc20')} + ,'tokens_mantle': {'blockchain': 'mantle', 'model': ref('tokens_mantle_erc20')} ,'tokens_optimism': {'blockchain': 'optimism', 'model': ref('tokens_optimism_erc20')} ,'tokens_polygon': {'blockchain': 'polygon', 'model': ref('tokens_polygon_erc20')} ,'tokens_scroll': {'blockchain': 'scroll', 'model': ref('tokens_scroll_erc20')} ,'tokens_zkevm': {'blockchain': 'zkevm', 'model': ref('tokens_zkevm_erc20')} ,'tokens_zksync': {'blockchain': 'zksync', 'model': ref('tokens_zksync_erc20')} ,'tokens_zora': {'blockchain': 'zora', 'model': ref('tokens_zora_erc20')} - ,'tokens_fuse': {'blockchain': 'fuse', 'model': ref('tokens_fuse_erc20')} } %} with diff --git a/tokens/models/tokens/tokens_schema.yml b/tokens/models/tokens/tokens_schema.yml index 4d6b508ebbf..508bf99ea3d 100644 --- a/tokens/models/tokens/tokens_schema.yml +++ b/tokens/models/tokens/tokens_schema.yml @@ -3,11 +3,11 @@ version: 2 models: - name: tokens_erc20 meta: - blockchain: arbitrum, avalanche_c, bnb, ethereum, gnosis, optimism, fantom, polygon, base + blockchain: arbitrum, avalanche_c, bnb, ethereum, gnosis, mantle, optimism, fantom, polygon, base sector: tokens - contributors: hildobby, 0xManny, dot2dotseurat, soispoke, mtitus6, wuligy + contributors: hildobby, 0xManny, dot2dotseurat, soispoke, mtitus6, wuligy, angus_1 config: - tags: ['tokens','erc20', 'arbitrum', 'avalanche_c', 'bnb','ethereum', 'gnosis','optimism', 'fantom', 'base'] + tags: ['tokens','erc20', 'arbitrum', 'avalanche_c', 'bnb', 'ethereum', 'gnosis', 'mantle', 'optimism', 'fantom', 'base'] description: > Crosschain ERC20 tokens tests: From cd72e2fa88d7c8b6e9aa697458abed740da1f512 Mon Sep 17 00:00:00 2001 From: Huang Geyang Date: Tue, 11 Jun 2024 22:51:28 +0800 Subject: [PATCH 090/149] Add mantle prices feed (#6112) * Add prices_mantle.tokens * Add prices_mantle.tokens * Fix token-id * Fix quote * Add mantle support * Add and clasify tokens * finalize prices file --------- Co-authored-by: jeff-dude <102681548+jeff-dude@users.noreply.github.com> --- models/prices/mantle/prices_mantle_schema.yml | 29 ++++++++++++++++++ models/prices/mantle/prices_mantle_tokens.sql | 30 +++++++++++++++++++ models/prices/prices_tokens.sql | 3 +- scripts/token_checker.py | 3 +- 4 files changed, 63 insertions(+), 2 deletions(-) create mode 100644 models/prices/mantle/prices_mantle_schema.yml create mode 100644 models/prices/mantle/prices_mantle_tokens.sql diff --git a/models/prices/mantle/prices_mantle_schema.yml b/models/prices/mantle/prices_mantle_schema.yml new file mode 100644 index 00000000000..86821c761ca --- /dev/null +++ b/models/prices/mantle/prices_mantle_schema.yml @@ -0,0 +1,29 @@ +version: 2 + +models: + - name: prices_mantle_tokens + meta: + blockchain: mantle + sector: prices + contributors: hosuke + config: + tags: ['prices', 'tokens', 'usd', 'mantle'] + description: "Price tokens on mantle L2 chain" + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - contract_address + columns: + - name: token_id + description: "Id of the token at coinpaprika. This id is required to pull the price feed data. NOTE: Not all tokens are listed at coinpaprika - consider using price data from DEX sources in this case or submit a listing request at coinpaprika." + - name: blockchain + description: "Native blockchain of the token, if any" + tests: + - accepted_values: + values: [ "mantle" ] + - name: contract_address + description: "Contract address of the token, if any" + - name: symbol + description: "Token symbol" + - name: decimals + description: "Number of decimals for the token contract" \ No newline at end of file diff --git a/models/prices/mantle/prices_mantle_tokens.sql b/models/prices/mantle/prices_mantle_tokens.sql new file mode 100644 index 00000000000..9512910f1d8 --- /dev/null +++ b/models/prices/mantle/prices_mantle_tokens.sql @@ -0,0 +1,30 @@ +{{ config( + schema='prices_mantle', + alias='tokens', + materialized='table', + file_format='delta', + tags=['static'] + ) +}} + +SELECT + token_id, + blockchain, + symbol, + contract_address, + decimals +FROM +( + VALUES + ('mnt-mantle', 'mantle', 'MNT', 0xdeaddeaddeaddeaddeaddeaddeaddeaddead0000, 18), + ('mnt-mantle', 'mantle', 'WMNT', 0x78c1b0c915c4faa5fffa6cabf0219da63d7f4cb8, 18), + ('joe-trader-joe', 'mantle', 'JOE', 0x371c7ec6d8039ff7933a2aa28eb827ffe1f52f07, 18), + ('usdc-usd-coin', 'mantle', 'USDC', 0x09bc4e0d864854c6afb6eb9a9cdf58ac190d0df9, 6), + ('weth-weth', 'mantle', 'WETH', 0xdeaddeaddeaddeaddeaddeaddeaddeaddead1111, 18), + ('meth-meth', 'mantle', 'mETH', 0xcda86a272531e8640cd7f1a92c01839911b90bb0, 18), + ('usdt-tether', 'mantle', 'USDT', 0x201eba5cc46d216ce6dc03f6a759e8e766e956ae, 6), + ('axlusdc-axelar-wrapped-usdc', 'mantle', 'axlUSDC', 0xeb466342c4d449bc9f53a865d5cb90586f405215, 6), + ('stg-stargatetoken', 'mantle', 'STG', 0x8731d54e9d02c286767d56ac03e8037c07e01e98, 18), + ('pendle-pendle', 'mantle', 'PENDLE', 0xd27b18915e7acc8fd6ac75db6766a80f8d2f5729, 18), + ('ena-ethena', 'mantle', 'ENA', 0x58538e6a46e07434d7e7375bc268d3cb839c0133, 18) +) as temp (token_id, blockchain, symbol, contract_address, decimals) diff --git a/models/prices/prices_tokens.sql b/models/prices/prices_tokens.sql index ea4b2178472..316aeb00cf5 100644 --- a/models/prices/prices_tokens.sql +++ b/models/prices/prices_tokens.sql @@ -7,7 +7,7 @@ post_hook = '{{ expose_spells(\'["ethereum", "solana", "arbitrum", "gnosis", "optimism", "bnb", "avalanche_c", "polygon", "fantom", "celo", "base", "zksync", "zora", "bitcoin", "cardano"]\', "sector", "prices", - \'["aalan3", "jeff-dude", "umer_h_adil", "0xBoxer", "rantum", "lgingerich", "hildobby", "cryptokoryo", "0xRob"]\') }}' + \'["aalan3", "jeff-dude", "umer_h_adil", "0xBoxer", "rantum", "lgingerich", "hildobby", "cryptokoryo", "0xRob", "hosuke"]\') }}' ) }} @@ -31,6 +31,7 @@ ref('prices_native_tokens') ,ref('prices_scroll_tokens') ,ref('prices_linea_tokens') ,ref('prices_zkevm_tokens') +,ref('prices_mantle_tokens') ] %} diff --git a/scripts/token_checker.py b/scripts/token_checker.py index 4ecd610422b..893097a8c0e 100644 --- a/scripts/token_checker.py +++ b/scripts/token_checker.py @@ -24,7 +24,8 @@ def __init__(self): "celo": "celo-celo", "base": "base-base", "zksync": "zksync-zksync", - "zora": "eth-ethereum" + "zora": "eth-ethereum", + "mantle": "mnt-mantle" } self.tokens_by_id = self.get_tokens() self.contracts_by_chain = self.get_contracts() From 569b7ee354a8c068e6f11349b7a7886e4530f560 Mon Sep 17 00:00:00 2001 From: Bilbo Baggins <165852491+ibilbobaggins@users.noreply.github.com> Date: Tue, 11 Jun 2024 16:55:09 +0200 Subject: [PATCH 091/149] Add Solidly V3 to dex.trades (#6115) * Add Solidly V3 to dex.trades Only Optimism was available. Added missing chains: 1. Arbitrum 2. Base 3. Ethereum 4. Fantom * Remove extra blank line * Update seeds/_sector/dex/_schema.yml --------- Co-authored-by: Huang Geyang --- .../_sector/dex/trades/arbitrum/_schema.yml | 18 ++++++ .../arbitrum/dex_arbitrum_base_trades.sql | 1 + .../solidly_v3_arbitrum_base_trades.sql | 21 +++++++ models/_sector/dex/trades/base/_schema.yml | 1 + .../dex/trades/base/dex_base_base_trades.sql | 3 +- .../_sector/dex/trades/ethereum/_schema.yml | 18 ++++++ .../ethereum/dex_ethereum_base_trades.sql | 3 +- .../solidly_v3_ethereum_base_trades.sql | 21 +++++++ models/_sector/dex/trades/fantom/_schema.yml | 18 ++++++ .../trades/fantom/dex_fantom_base_trades.sql | 3 +- .../solidly_v3_fantom_base_trades.sql | 21 +++++++ seeds/_sector/dex/_schema.yml | 61 ++++++++++++++++++- .../solidly_v3_arbitrum_base_trades_seed.csv | 4 ++ .../dex/solidly_v3_base_base_trades_seed.csv | 4 ++ .../solidly_v3_ethereum_base_trades_seed.csv | 4 ++ .../solidly_v3_fantom_base_trades_seed.csv | 4 ++ .../_sector/dex/trades/arbitrum/_sources.yml | 7 ++- .../_sector/dex/trades/ethereum/_sources.yml | 5 ++ .../_sector/dex/trades/fantom/_sources.yml | 5 ++ .../_sector/dex/trades/optimism/_sources.yml | 2 +- 20 files changed, 218 insertions(+), 6 deletions(-) create mode 100644 models/_sector/dex/trades/arbitrum/platforms/solidly_v3_arbitrum_base_trades.sql create mode 100644 models/_sector/dex/trades/ethereum/platforms/solidly_v3_ethereum_base_trades.sql create mode 100644 models/_sector/dex/trades/fantom/platforms/solidly_v3_fantom_base_trades.sql create mode 100644 seeds/_sector/dex/solidly_v3_arbitrum_base_trades_seed.csv create mode 100644 seeds/_sector/dex/solidly_v3_base_base_trades_seed.csv create mode 100644 seeds/_sector/dex/solidly_v3_ethereum_base_trades_seed.csv create mode 100644 seeds/_sector/dex/solidly_v3_fantom_base_trades_seed.csv diff --git a/models/_sector/dex/trades/arbitrum/_schema.yml b/models/_sector/dex/trades/arbitrum/_schema.yml index 5cb626fbaa7..4c9e3f89d73 100644 --- a/models/_sector/dex/trades/arbitrum/_schema.yml +++ b/models/_sector/dex/trades/arbitrum/_schema.yml @@ -680,3 +680,21 @@ models: - evt_index - check_dex_base_trades_seed: seed_file: ref('wombat_exchange_arbitrum_base_trades_seed') + + - name: solidly_v3_arbitrum_base_trades + meta: + blockchain: arbitrum + sector: dex + project: solidly + contributors: SolidlyLabs + config: + tags: [ 'arbitrum', 'dex', 'trades', 'solidly' ] + description: "solidly v3 arbitrum base trades" + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - tx_hash + - evt_index + - check_dex_base_trades_seed: + seed_file: ref('solidly_v3_arbitrum_base_trades_seed') + diff --git a/models/_sector/dex/trades/arbitrum/dex_arbitrum_base_trades.sql b/models/_sector/dex/trades/arbitrum/dex_arbitrum_base_trades.sql index ae013b11123..f64e73dc37f 100644 --- a/models/_sector/dex/trades/arbitrum/dex_arbitrum_base_trades.sql +++ b/models/_sector/dex/trades/arbitrum/dex_arbitrum_base_trades.sql @@ -42,6 +42,7 @@ , ref('uniswap_v2_arbitrum_base_trades') , ref('auragi_arbitrum_base_trades') , ref('wombat_exchange_arbitrum_base_trades') + , ref('solidly_v3_arbitrum_base_trades') ] %} WITH base_union AS ( diff --git a/models/_sector/dex/trades/arbitrum/platforms/solidly_v3_arbitrum_base_trades.sql b/models/_sector/dex/trades/arbitrum/platforms/solidly_v3_arbitrum_base_trades.sql new file mode 100644 index 00000000000..a4bc03ada4e --- /dev/null +++ b/models/_sector/dex/trades/arbitrum/platforms/solidly_v3_arbitrum_base_trades.sql @@ -0,0 +1,21 @@ +{{ + config( + schema = 'solidly_v3_arbitrum', + alias = 'base_trades', + materialized = 'incremental', + file_format = 'delta', + incremental_strategy = 'merge', + unique_key = ['tx_hash', 'evt_index'], + incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.block_time')] + ) +}} + +{{ + uniswap_compatible_v3_trades( + blockchain = 'arbitrum', + project = 'solidly', + version = '3', + Pair_evt_Swap = source('solidly_v3_arbitrum', 'SolidlyV3Pool_evt_Swap'), + Factory_evt_PoolCreated = source('solidly_v3_arbitrum', 'SolidlyV3Factory_evt_PoolCreated') + ) +}} diff --git a/models/_sector/dex/trades/base/_schema.yml b/models/_sector/dex/trades/base/_schema.yml index ff2a1facc90..d4f9a7483eb 100644 --- a/models/_sector/dex/trades/base/_schema.yml +++ b/models/_sector/dex/trades/base/_schema.yml @@ -919,3 +919,4 @@ models: filter: version: - 1 + diff --git a/models/_sector/dex/trades/base/dex_base_base_trades.sql b/models/_sector/dex/trades/base/dex_base_base_trades.sql index e54d5a1d8f5..f4c6151640b 100644 --- a/models/_sector/dex/trades/base/dex_base_base_trades.sql +++ b/models/_sector/dex/trades/base/dex_base_base_trades.sql @@ -45,6 +45,7 @@ , ref('alienbase_base_base_trades') , ref('swapbased_base_base_trades') , ref('clipper_base_base_trades') + , ref('solidly_v3_base_base_trades') ] %} WITH base_union AS ( @@ -83,4 +84,4 @@ WITH base_union AS ( , blockchain = 'base' , columns = ['from', 'to', 'index'] ) -}} \ No newline at end of file +}} diff --git a/models/_sector/dex/trades/ethereum/_schema.yml b/models/_sector/dex/trades/ethereum/_schema.yml index 1e022c331a2..6f0d942e074 100644 --- a/models/_sector/dex/trades/ethereum/_schema.yml +++ b/models/_sector/dex/trades/ethereum/_schema.yml @@ -543,3 +543,21 @@ models: - Factory V2 - Factory V2 updated - Regular + + - name: solidly_v3_ethereum_base_trades + meta: + blockchain: ethereum + sector: dex + project: solidly + contributors: SolidlyLabs + config: + tags: [ 'ethereum', 'dex', 'trades', 'solidly' ] + description: "solidly v3 ethereum base trades" + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - tx_hash + - evt_index + - check_dex_base_trades_seed: + seed_file: ref('solidly_v3_ethereum_base_trades_seed') + diff --git a/models/_sector/dex/trades/ethereum/dex_ethereum_base_trades.sql b/models/_sector/dex/trades/ethereum/dex_ethereum_base_trades.sql index 20b466dbe0e..914ccc9914c 100644 --- a/models/_sector/dex/trades/ethereum/dex_ethereum_base_trades.sql +++ b/models/_sector/dex/trades/ethereum/dex_ethereum_base_trades.sql @@ -34,6 +34,7 @@ , ref('mstable_ethereum_base_trades') , ref('xchange_ethereum_base_trades') , ref('curvefi_ethereum_base_trades') + , ref('solidly_v3_ethereum_base_trades') ] %} WITH base_union AS ( @@ -72,4 +73,4 @@ WITH base_union AS ( , blockchain = 'ethereum' , columns = ['from', 'to', 'index'] ) -}} \ No newline at end of file +}} diff --git a/models/_sector/dex/trades/ethereum/platforms/solidly_v3_ethereum_base_trades.sql b/models/_sector/dex/trades/ethereum/platforms/solidly_v3_ethereum_base_trades.sql new file mode 100644 index 00000000000..0d583563c50 --- /dev/null +++ b/models/_sector/dex/trades/ethereum/platforms/solidly_v3_ethereum_base_trades.sql @@ -0,0 +1,21 @@ +{{ + config( + schema = 'solidly_v3_ethereum', + alias = 'base_trades', + materialized = 'incremental', + file_format = 'delta', + incremental_strategy = 'merge', + unique_key = ['tx_hash', 'evt_index'], + incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.block_time')] + ) +}} + +{{ + uniswap_compatible_v3_trades( + blockchain = 'ethereum', + project = 'solidly', + version = '3', + Pair_evt_Swap = source('solidly_ethereum', 'SolidlyV3Pool_evt_Swap'), + Factory_evt_PoolCreated = source('solidly_v3_ethereum', 'SolidlyV3Factory_evt_PoolCreated') + ) +}} diff --git a/models/_sector/dex/trades/fantom/_schema.yml b/models/_sector/dex/trades/fantom/_schema.yml index 33a411d0161..49d0f491023 100644 --- a/models/_sector/dex/trades/fantom/_schema.yml +++ b/models/_sector/dex/trades/fantom/_schema.yml @@ -186,3 +186,21 @@ models: - evt_index - check_dex_base_trades_seed: seed_file: ref('curvefi_fantom_base_trades_seed') + + - name: solidly_v3_fantom_base_trades + meta: + blockchain: fantom + sector: dex + project: solidly + contributors: SolidlyLabs + config: + tags: [ 'fantom', 'dex', 'trades', 'solidly' ] + description: "solidly v3 fantom base trades" + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - tx_hash + - evt_index + - check_dex_base_trades_seed: + seed_file: ref('solidly_v3_fantom_base_trades_seed') + diff --git a/models/_sector/dex/trades/fantom/dex_fantom_base_trades.sql b/models/_sector/dex/trades/fantom/dex_fantom_base_trades.sql index ad1106b6295..fbb56f4c046 100644 --- a/models/_sector/dex/trades/fantom/dex_fantom_base_trades.sql +++ b/models/_sector/dex/trades/fantom/dex_fantom_base_trades.sql @@ -16,6 +16,7 @@ , ref('openocean_fantom_base_trades') , ref('beethoven_x_fantom_base_trades') , ref('curvefi_fantom_base_trades') + , ref('solidly_v3_fantom_base_trades') ] %} WITH base_union AS ( @@ -54,4 +55,4 @@ WITH base_union AS ( , blockchain = 'fantom' , columns = ['from', 'to', 'index'] ) -}} \ No newline at end of file +}} diff --git a/models/_sector/dex/trades/fantom/platforms/solidly_v3_fantom_base_trades.sql b/models/_sector/dex/trades/fantom/platforms/solidly_v3_fantom_base_trades.sql new file mode 100644 index 00000000000..91ee0a2c56d --- /dev/null +++ b/models/_sector/dex/trades/fantom/platforms/solidly_v3_fantom_base_trades.sql @@ -0,0 +1,21 @@ +{{ + config( + schema = 'solidly_v3_fantom', + alias = 'base_trades', + materialized = 'incremental', + file_format = 'delta', + incremental_strategy = 'merge', + unique_key = ['tx_hash', 'evt_index'], + incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.block_time')] + ) +}} + +{{ + uniswap_compatible_v3_trades( + blockchain = 'fantom', + project = 'solidly', + version = '3', + Pair_evt_Swap = source('solidly_v3_fantom', 'SolidlyV3Pool_evt_Swap'), + Factory_evt_PoolCreated = source('solidly_v3_fantom', 'SolidlyV3Factory_evt_PoolCreated') + ) +}} diff --git a/seeds/_sector/dex/_schema.yml b/seeds/_sector/dex/_schema.yml index 2c6c8156c2e..b95109f38a6 100644 --- a/seeds/_sector/dex/_schema.yml +++ b/seeds/_sector/dex/_schema.yml @@ -2641,6 +2641,66 @@ seeds: token_sold_amount_raw: uint256 block_date: timestamp + - name: solidly_v3_arbitrum_base_trades_seed + config: + column_types: + blockchain: varchar + project: varchar + version: varchar + tx_hash: varbinary + evt_index: uint256 + block_number: uint256 + token_bought_address: varbinary + token_sold_address: varbinary + token_bought_amount_raw: uint256 + token_sold_amount_raw: uint256 + block_date: timestamp + + - name: solidly_v3_base_base_trades_seed + config: + column_types: + blockchain: varchar + project: varchar + version: varchar + tx_hash: varbinary + evt_index: uint256 + block_number: uint256 + token_bought_address: varbinary + token_sold_address: varbinary + token_bought_amount_raw: uint256 + token_sold_amount_raw: uint256 + block_date: timestamp + + - name: solidly_v3_ethereum_base_trades_seed + config: + column_types: + blockchain: varchar + project: varchar + version: varchar + tx_hash: varbinary + evt_index: uint256 + block_number: uint256 + token_bought_address: varbinary + token_sold_address: varbinary + token_bought_amount_raw: uint256 + token_sold_amount_raw: uint256 + block_date: timestamp + + - name: solidly_v3_fantom_base_trades_seed + config: + column_types: + blockchain: varchar + project: varchar + version: varchar + tx_hash: varbinary + evt_index: uint256 + block_number: uint256 + token_bought_address: varbinary + token_sold_address: varbinary + token_bought_amount_raw: uint256 + token_sold_amount_raw: uint256 + block_date: timestamp + - name: solidly_v3_optimism_base_trades_seed config: column_types: @@ -2655,7 +2715,6 @@ seeds: token_bought_amount_raw: uint256 token_sold_amount_raw: uint256 block_date: timestamp - - name: throne_exchange_v2_base_base_trades_seed config: diff --git a/seeds/_sector/dex/solidly_v3_arbitrum_base_trades_seed.csv b/seeds/_sector/dex/solidly_v3_arbitrum_base_trades_seed.csv new file mode 100644 index 00000000000..e51feaabe50 --- /dev/null +++ b/seeds/_sector/dex/solidly_v3_arbitrum_base_trades_seed.csv @@ -0,0 +1,4 @@ +blockchain,project,version,block_date,tx_hash,evt_index,token_bought_address,token_sold_address,block_number,token_bought_amount_raw,token_sold_amount_raw +arbitrum,solidly,3,2024-02-03 00:00,0x52c606cf45d6ed8fc2a4da3f60c03689f600304583fdd1785d72ec1fce91867a,0,0x82af49447d8a07e3bd95bd0d56f35241523fbab1,0x777cf5ba9c291a1a8f57ff14836f6f9dc5c0f9dd,176909487,36416857171863695,59387847732386017794 +arbitrum,solidly,3,2024-02-20 00:00,0xa13d2c0ac281d50be8df4d2e3de66b29d05cade284713e8c187e15859dad8773,3,0x82af49447d8a07e3bd95bd0d56f35241523fbab1,0x777cf5ba9c291a1a8f57ff14836f6f9dc5c0f9dd,182782312,22492992787274686,81464201443220691722 +arbitrum,solidly,3,2024-02-20 00:00,0x106440bdc160cbcc6399b52ba3eea82d189e241efe972872c2f82ed5a64789f8,1,0x82af49447d8a07e3bd95bd0d56f35241523fbab1,0x777cf5ba9c291a1a8f57ff14836f6f9dc5c0f9dd,182822978,6534900983689228,22422394504796743842 diff --git a/seeds/_sector/dex/solidly_v3_base_base_trades_seed.csv b/seeds/_sector/dex/solidly_v3_base_base_trades_seed.csv new file mode 100644 index 00000000000..19a55ab1cd3 --- /dev/null +++ b/seeds/_sector/dex/solidly_v3_base_base_trades_seed.csv @@ -0,0 +1,4 @@ +blockchain,project,version,block_date,tx_hash,evt_index,token_bought_address,token_sold_address,block_number,token_bought_amount_raw,token_sold_amount_raw +base,solidly,3,2024-06-10 00:00,0x706e92a6f8a93d017b4fdf60fc5a584bfea18a8638ec451c020d3df7573de64c,778,0x4200000000000000000000000000000000000006,0xd9aaec86b65d86f6a7b5b1b0c42ffa531710b6ca,15609599,22040269642169822,80932998 +base,solidly,3,2024-06-10 00:00,0x2c3e8953eef8bb916a0790f09c18b6a138224f23bc85a530261b71e759deab7e,97,0x833589fcd6edb6e08f4c7c32d4f71b54bda02913,0x4200000000000000000000000000000000000006,15607737,24639725,6716121101724876 +base,solidly,3,2024-06-10 00:00,0x2c3e8953eef8bb916a0790f09c18b6a138224f23bc85a530261b71e759deab7e,73,0xd9aaec86b65d86f6a7b5b1b0c42ffa531710b6ca,0x4200000000000000000000000000000000000006,15607737,43407460,11830085711227632 diff --git a/seeds/_sector/dex/solidly_v3_ethereum_base_trades_seed.csv b/seeds/_sector/dex/solidly_v3_ethereum_base_trades_seed.csv new file mode 100644 index 00000000000..3f625b227d0 --- /dev/null +++ b/seeds/_sector/dex/solidly_v3_ethereum_base_trades_seed.csv @@ -0,0 +1,4 @@ +blockchain,project,version,block_date,tx_hash,evt_index,token_bought_address,token_sold_address,block_number,token_bought_amount_raw,token_sold_amount_raw +ethereum,solidly,3,2024-06-10 00:00,0x20fa27abd1fe594fc8a5ce9bcd5570eb60aba66096edc6c91ef5c0a99a73fa6c,13,0xdac17f958d2ee523a2206206994597c13d831ec7,0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48,20060409,3000185944,3000000000 +ethereum,solidly,3,2024-06-10 00:00,0xcc56cb586f080bf4373a8bcc155eb196207371b1883afa79bfdf4c677ebfe322,184,0xdac17f958d2ee523a2206206994597c13d831ec7,0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2,20060404,416368244,113284585282640407 +ethereum,solidly,3,2024-06-10 00:00,0x0515f6832b29bc2a4bbc8783cd73d9de21b5c18fac995f4fd74227308c0e83a8,387,0x514910771af9ca656af840dff83e8264ecf986ca,0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2,20060407,8734073046064652081,37947785482442443 diff --git a/seeds/_sector/dex/solidly_v3_fantom_base_trades_seed.csv b/seeds/_sector/dex/solidly_v3_fantom_base_trades_seed.csv new file mode 100644 index 00000000000..596d3f9eceb --- /dev/null +++ b/seeds/_sector/dex/solidly_v3_fantom_base_trades_seed.csv @@ -0,0 +1,4 @@ +blockchain,project,version,block_date,tx_hash,evt_index,token_bought_address,token_sold_address,block_number,token_bought_amount_raw,token_sold_amount_raw +fantom,solidly,3,2024-06-07 00:00,0x462dc78dbf5a2b4ce5b6995d6a38d56531d3301b25a24b76de8f76f3c450fbe2,0,0x21be370d5312f44cb42ce377bc9b8a0cef1a4c83,0x777cf5ba9c291a1a8f57ff14836f6f9dc5c0f9dd,82468153,11044657622844009042,21850742643724726685 +fantom,solidly,3,2024-06-08 00:00,0x85c64e4ae23bcb6480f4fac1981bbae30a7181a5f3509b5cd87314582f0ca1d9,0,0x21be370d5312f44cb42ce377bc9b8a0cef1a4c83,0x777cf5ba9c291a1a8f57ff14836f6f9dc5c0f9dd,82468593,43457629613780119432,86051119761832979402 +fantom,solidly,3,2024-06-08 00:00,0xfeaa63121d70b7ac3a4dd50b7b11eaee7d40eb618f3a6b6e58ca6a7a0d9d0bb5,5,0x21be370d5312f44cb42ce377bc9b8a0cef1a4c83,0x777cf5ba9c291a1a8f57ff14836f6f9dc5c0f9dd,82468732,47097938059274277077,93393856598932340439 diff --git a/sources/_sector/dex/trades/arbitrum/_sources.yml b/sources/_sector/dex/trades/arbitrum/_sources.yml index 168a3438634..79ebffec9fc 100644 --- a/sources/_sector/dex/trades/arbitrum/_sources.yml +++ b/sources/_sector/dex/trades/arbitrum/_sources.yml @@ -133,4 +133,9 @@ sources: - name: PairFactory_evt_PairCreated - name: wombatexchange_arbitrum tables: - - name: CrossChainPool_evt_SwapV2 \ No newline at end of file + - name: CrossChainPool_evt_SwapV2 + - name: solidly_v3_arbitrum + tables: + - name: SolidlyV3Factory_evt_PoolCreated + - name: SolidlyV3Pool_evt_Swap + diff --git a/sources/_sector/dex/trades/ethereum/_sources.yml b/sources/_sector/dex/trades/ethereum/_sources.yml index 8e70e8f27a2..05709d757ad 100644 --- a/sources/_sector/dex/trades/ethereum/_sources.yml +++ b/sources/_sector/dex/trades/ethereum/_sources.yml @@ -107,3 +107,8 @@ sources: tables: - name: XchangePair_evt_Swap - name: XchangeFactory_evt_PairCreated + - name: solidly_v3_ethereum + tables: + - name: SolidlyV3Factory_evt_PoolCreated + - name: SolidlyV3Pool_evt_Swap + diff --git a/sources/_sector/dex/trades/fantom/_sources.yml b/sources/_sector/dex/trades/fantom/_sources.yml index 961a891be23..108677ae04a 100644 --- a/sources/_sector/dex/trades/fantom/_sources.yml +++ b/sources/_sector/dex/trades/fantom/_sources.yml @@ -36,3 +36,8 @@ sources: tables: - name: StableSwap_evt_TokenExchange - name: StableSwap_evt_TokenExchangeUnderlying + - name: solidly_v3_fantom + tables: + - name: SolidlyV3Factory_evt_PoolCreated + - name: SolidlyV3Pool_evt_Swap + diff --git a/sources/_sector/dex/trades/optimism/_sources.yml b/sources/_sector/dex/trades/optimism/_sources.yml index 413ef76e6cb..765fc08abd4 100644 --- a/sources/_sector/dex/trades/optimism/_sources.yml +++ b/sources/_sector/dex/trades/optimism/_sources.yml @@ -91,4 +91,4 @@ sources: - name: fraxswap_optimism tables: - name: FraxswapPair_evt_Swap - - name: FraxswapFactory_evt_PairCreated \ No newline at end of file + - name: FraxswapFactory_evt_PairCreated From fde65920833d52a6e9b3a42c81ba65c05ad69dab Mon Sep 17 00:00:00 2001 From: intensodefi Date: Tue, 11 Jun 2024 21:55:53 +0700 Subject: [PATCH 092/149] Add icecreamswap on Scroll v2 to dex.trades (#6117) * Add icecreamswap on Scroll v2 to dex.trades * fix model * fix model * update dex_info * commit * update * update seed --- models/_sector/dex/trades/scroll/_schema.yml | 20 ++++++++++++++++++- .../trades/scroll/dex_scroll_base_trades.sql | 1 + .../icecreamswap_v2_scroll_base_trades.sql | 20 +++++++++++++++++++ models/dex/dex_info.sql | 1 + seeds/_sector/dex/_schema.yml | 15 ++++++++++++++ ...cecreamswap_v2_scroll_base_trades_seed.csv | 3 +++ .../_sector/dex/trades/scroll/_sources.yml | 5 +++++ 7 files changed, 64 insertions(+), 1 deletion(-) create mode 100644 models/_sector/dex/trades/scroll/platforms/icecreamswap_v2_scroll_base_trades.sql create mode 100644 seeds/_sector/dex/icecreamswap_v2_scroll_base_trades_seed.csv diff --git a/models/_sector/dex/trades/scroll/_schema.yml b/models/_sector/dex/trades/scroll/_schema.yml index 171f0f923e3..7c0aa268a1b 100644 --- a/models/_sector/dex/trades/scroll/_schema.yml +++ b/models/_sector/dex/trades/scroll/_schema.yml @@ -105,4 +105,22 @@ models: - tx_hash - evt_index - check_dex_base_trades_seed: - seed_file: ref('nuri_scroll_base_trades_seed') \ No newline at end of file + seed_file: ref('nuri_scroll_base_trades_seed') + + - name: icecreamswap_v2_scroll_base_trades + meta: + blockchain: scroll + sector: dex + project: icecreamswap + contributors: intensodefi + config: + tags: [ 'scroll', 'dex', 'trades', 'icecreamswap' ] + description: "icecreamswap v2 scroll base trades" + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - tx_hash + - evt_index + - check_dex_base_trades_seed: + seed_file: ref('icecreamswap_v2_scroll_base_trades_seed') + diff --git a/models/_sector/dex/trades/scroll/dex_scroll_base_trades.sql b/models/_sector/dex/trades/scroll/dex_scroll_base_trades.sql index 6b303cf1ca7..76abe09b0ac 100644 --- a/models/_sector/dex/trades/scroll/dex_scroll_base_trades.sql +++ b/models/_sector/dex/trades/scroll/dex_scroll_base_trades.sql @@ -12,6 +12,7 @@ , ref('scrollswap_scroll_base_trades') , ref('syncswap_v1_scroll_base_trades') , ref('nuri_scroll_base_trades') + , ref('icecreamswap_v2_scroll_base_trades') ] %} WITH base_union AS ( diff --git a/models/_sector/dex/trades/scroll/platforms/icecreamswap_v2_scroll_base_trades.sql b/models/_sector/dex/trades/scroll/platforms/icecreamswap_v2_scroll_base_trades.sql new file mode 100644 index 00000000000..810264acca4 --- /dev/null +++ b/models/_sector/dex/trades/scroll/platforms/icecreamswap_v2_scroll_base_trades.sql @@ -0,0 +1,20 @@ +{{ config( + schema = 'icecreamswap_v2_scroll' + , alias = 'base_trades' + , materialized = 'incremental' + , file_format = 'delta' + , incremental_strategy = 'merge' + , unique_key = ['tx_hash', 'evt_index'] + , incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.block_time')] + ) +}} + +{{ + uniswap_compatible_v2_trades( + blockchain = 'scroll' + , project = 'icecreamswap' + , version = '2' + , Pair_evt_Swap = source('icecreamswap_v2_scroll', 'UniswapV2Pair_evt_Swap') + , Factory_evt_PairCreated = source('icecreamswap_v2_scroll', 'UniswapV2Factory_evt_PairCreated') + ) +}} \ No newline at end of file diff --git a/models/dex/dex_info.sql b/models/dex/dex_info.sql index 856046b6aac..85c78a54fe6 100644 --- a/models/dex/dex_info.sql +++ b/models/dex/dex_info.sql @@ -159,4 +159,5 @@ FROM (VALUES , ('lynex', 'Lynex', 'Direct', 'Lynex') , ('nile', 'Nile', 'Direct', 'Nile') , ('nuri', 'Nuri', 'Direct', 'nuriexchange') + , ('icecreamswap', 'IceCreamSwap', 'Direct', 'icecream_swap') ) AS temp_table (project, name, marketplace_type, x_username) diff --git a/seeds/_sector/dex/_schema.yml b/seeds/_sector/dex/_schema.yml index b95109f38a6..3b1f16b7d5b 100644 --- a/seeds/_sector/dex/_schema.yml +++ b/seeds/_sector/dex/_schema.yml @@ -3555,3 +3555,18 @@ seeds: token_bought_amount_raw: uint256 token_sold_amount_raw: uint256 block_date: timestamp + + - name: icecreamswap_v2_scroll_base_trades_seed + config: + column_types: + blockchain: varchar + project: varchar + version: varchar + tx_hash: varbinary + evt_index: uint256 + block_number: uint256 + token_bought_address: varbinary + token_sold_address: varbinary + token_bought_amount_raw: uint256 + token_sold_amount_raw: uint256 + block_date: timestamp diff --git a/seeds/_sector/dex/icecreamswap_v2_scroll_base_trades_seed.csv b/seeds/_sector/dex/icecreamswap_v2_scroll_base_trades_seed.csv new file mode 100644 index 00000000000..4a7d12ce769 --- /dev/null +++ b/seeds/_sector/dex/icecreamswap_v2_scroll_base_trades_seed.csv @@ -0,0 +1,3 @@ +blockchain,project,version,block_date,tx_hash,evt_index,token_bought_address,token_sold_address,block_number,token_bought_amount_raw,token_sold_amount_raw +scroll,icecreamswap,2,2024-06-08,0x1690ce888089c354603aa64c052831bebbf6a44083c0ea2fa87cd08791202743,5,0x40375C92d9FAf44d2f9db9Bd9ba41a3317a2404f,0x5300000000000000000000000000000000000004,6371161,9974969540567703,5672100000000 +scroll,icecreamswap,2,2024-06-08,0x0161b3bdd7a5b41c6aca80eb0688b0bc3fe776b0cb66b049977387b389a1c8a9,8,0x40375C92d9FAf44d2f9db9Bd9ba41a3317a2404f,0x5300000000000000000000000000000000000004,6370159,9279065977770801,5214790000000 \ No newline at end of file diff --git a/sources/_sector/dex/trades/scroll/_sources.yml b/sources/_sector/dex/trades/scroll/_sources.yml index dce53b7b0ff..285e9fbbf51 100644 --- a/sources/_sector/dex/trades/scroll/_sources.yml +++ b/sources/_sector/dex/trades/scroll/_sources.yml @@ -27,3 +27,8 @@ sources: tables: - name: ClPoolFactory_evt_PoolCreated - name: ClPool_evt_Swap + - name: icecreamswap_v2_scroll + tables: + - name: UniswapV2Factory_evt_PairCreated + - name: UniswapV2Pair_evt_Swap + From a1251c22a6e01b22fe8021ce81114a28633b99f7 Mon Sep 17 00:00:00 2001 From: viniabussafi <131974393+viniabussafi@users.noreply.github.com> Date: Tue, 11 Jun 2024 15:56:29 +0100 Subject: [PATCH 093/149] Update prices_arbitrum_tokens with osETH (#6135) * add missing tokens * add oseth to prices_arbitrum_tokens * Update tokens_ethereum_erc20.sql --------- Co-authored-by: Huang Geyang --- models/prices/arbitrum/prices_arbitrum_tokens.sql | 1 + 1 file changed, 1 insertion(+) diff --git a/models/prices/arbitrum/prices_arbitrum_tokens.sql b/models/prices/arbitrum/prices_arbitrum_tokens.sql index 7a9e4e72e78..c10ba51ebb5 100644 --- a/models/prices/arbitrum/prices_arbitrum_tokens.sql +++ b/models/prices/arbitrum/prices_arbitrum_tokens.sql @@ -196,5 +196,6 @@ FROM ('ethx-stader-ethx','arbitrum','ETHX',0xed65c5085a18fa160af0313e60dcc7905e944dc7, 18), ('gyd-gyro-dollar','arbitrum','GYD',0xca5d8f8a8d49439357d3cf46ca2e720702f132b8, 18), ('a51-a51-finance','arbitrum','A51',0xb3f13b0c61d65d67d7d6215d70c89533ee567a91, 18), + ('oseth-stakewise-staked-eth','arbitrum','osETH',0xf7d4e7273e5015c96728a6b02f31c505ee184603, 18), ('sliz-solidlizard-dex-token','arbitrum','SLIZ',0x463913D3a3D3D291667D53B8325c598Eb88D3B0e, 18) ) as temp (token_id, blockchain, symbol, contract_address, decimals) From d5e0e1b17d9e39accd29a2d28ab70380d412eded Mon Sep 17 00:00:00 2001 From: cheeky-gorilla <76262359+cheeky-gorilla@users.noreply.github.com> Date: Tue, 11 Jun 2024 07:56:52 -0700 Subject: [PATCH 094/149] Add TAIKO on Ethereum mainnet to prices.usd (#6133) https://coinpaprika.com/coin/taiko-taiko/ Co-authored-by: Huang Geyang --- models/prices/ethereum/prices_ethereum_tokens.sql | 1 + 1 file changed, 1 insertion(+) diff --git a/models/prices/ethereum/prices_ethereum_tokens.sql b/models/prices/ethereum/prices_ethereum_tokens.sql index fc3ec0a7981..ad5f7588f9c 100644 --- a/models/prices/ethereum/prices_ethereum_tokens.sql +++ b/models/prices/ethereum/prices_ethereum_tokens.sql @@ -347,6 +347,7 @@ FROM ('syn-synapse', 'ethereum', 'SYN', 0x0f2d719407fdbeff09d87557abb7232601fd9f29, 18), ('sync-sync-network', 'ethereum', 'SYNC', 0xb6ff96b8a8d214544ca0dbc9b33f7ad6503efd32, 18), ('t-threshold-network-token', 'ethereum', 'T', 0xcdf7028ceab81fa0c6971208e83fa7872994bee5, 18), + ('taiko-taiko', 'ethereum', 'TAIKO', 0x10dea67478c5f8c5e2d90e5e9b26dbe60c54d800, 18), ('tcr-tracer-dao', 'ethereum', 'TCR', 0xe38b72d6595fd3885d1d2f770aa23e94757f91a1, 8), ('tel-telcoin', 'ethereum', 'TEL', 0x467bccd9d29f223bce8043b84e8c8b282827790f, 2), ('temp-tempus', 'ethereum', 'TEMP', 0xa36fdbbae3c9d55a1d67ee5821d53b50b63a1ab9, 18), From 554566f947ff00414927240f0cae576bd1a61358 Mon Sep 17 00:00:00 2001 From: Kofi Date: Tue, 11 Jun 2024 16:59:11 +0200 Subject: [PATCH 095/149] Add iZiSwap on Scroll to dex.trades (#6111) * commit * commit --------- Co-authored-by: Huang Geyang Co-authored-by: jeff-dude <102681548+jeff-dude@users.noreply.github.com> --- models/_sector/dex/trades/scroll/_schema.yml | 20 +++++++++- .../trades/scroll/dex_scroll_base_trades.sql | 1 + .../platforms/iziswap_scroll_base_trades.sql | 38 +++++++++++++++++++ seeds/_sector/dex/_schema.yml | 15 ++++++++ .../dex/iziswap_scroll_base_trades_seed.csv | 6 +++ .../_sector/dex/trades/scroll/_sources.yml | 3 ++ 6 files changed, 81 insertions(+), 2 deletions(-) create mode 100644 models/_sector/dex/trades/scroll/platforms/iziswap_scroll_base_trades.sql create mode 100644 seeds/_sector/dex/iziswap_scroll_base_trades_seed.csv diff --git a/models/_sector/dex/trades/scroll/_schema.yml b/models/_sector/dex/trades/scroll/_schema.yml index 7c0aa268a1b..01f534fe3a9 100644 --- a/models/_sector/dex/trades/scroll/_schema.yml +++ b/models/_sector/dex/trades/scroll/_schema.yml @@ -107,6 +107,23 @@ models: - check_dex_base_trades_seed: seed_file: ref('nuri_scroll_base_trades_seed') + - name: iziswap_scroll_base_trades + meta: + blockchain: scroll + sector: dex + project: iziswap + contributors: niftytable + config: + tags: [ 'scroll', 'dex', 'trades', 'iziswap' ] + description: "Iziswap scroll base trades" + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - tx_hash + - evt_index + - check_dex_base_trades_seed: + seed_file: ref('iziswap_scroll_base_trades_seed') + - name: icecreamswap_v2_scroll_base_trades meta: blockchain: scroll @@ -122,5 +139,4 @@ models: - tx_hash - evt_index - check_dex_base_trades_seed: - seed_file: ref('icecreamswap_v2_scroll_base_trades_seed') - + seed_file: ref('icecreamswap_v2_scroll_base_trades_seed') \ No newline at end of file diff --git a/models/_sector/dex/trades/scroll/dex_scroll_base_trades.sql b/models/_sector/dex/trades/scroll/dex_scroll_base_trades.sql index 76abe09b0ac..0f42b249889 100644 --- a/models/_sector/dex/trades/scroll/dex_scroll_base_trades.sql +++ b/models/_sector/dex/trades/scroll/dex_scroll_base_trades.sql @@ -12,6 +12,7 @@ , ref('scrollswap_scroll_base_trades') , ref('syncswap_v1_scroll_base_trades') , ref('nuri_scroll_base_trades') + , ref('iziswap_scroll_base_trades') , ref('icecreamswap_v2_scroll_base_trades') ] %} diff --git a/models/_sector/dex/trades/scroll/platforms/iziswap_scroll_base_trades.sql b/models/_sector/dex/trades/scroll/platforms/iziswap_scroll_base_trades.sql new file mode 100644 index 00000000000..d426ade2b1c --- /dev/null +++ b/models/_sector/dex/trades/scroll/platforms/iziswap_scroll_base_trades.sql @@ -0,0 +1,38 @@ +{{ + config( + schema = 'iziswap_scroll', + alias = 'base_trades', + materialized = 'incremental', + file_format = 'delta', + incremental_strategy = 'merge', + unique_key = ['tx_hash', 'evt_index'], + incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.block_time')] + ) +}} + +{% set iziswap_start_date = "2023-10-13" %} + +SELECT + 'scroll' AS blockchain + , 'iziswap' AS project + , contract_address AS project_contract_address + , '1' AS version + , evt_tx_hash AS tx_hash + , evt_index + , evt_block_time AS block_time + , evt_block_number AS block_number + , CAST(DATE_TRUNC('month', evt_block_time) AS DATE) AS block_month + , CAST(DATE_TRUNC('day', evt_block_time) AS DATE) AS block_date + , CASE WHEN sellXEarnY THEN tokenY ELSE tokenX END AS token_bought_address + , CASE WHEN sellXEarnY THEN tokenX ELSE tokenY END AS token_sold_address + , CASE WHEN sellXEarnY THEN amountY ELSE amountX END AS token_bought_amount_raw + , CASE WHEN sellXEarnY THEN amountX ELSE amountY END AS token_sold_amount_raw + , CAST(evt_tx_from AS VARBINARY) AS taker + , CAST(evt_tx_to AS VARBINARY) AS maker +FROM {{ source('iziswap_scroll', 'iZiSwapPool_evt_Swap') }} +{% if is_incremental() %} +WHERE {{incremental_predicate('evt_block_time')}} +{% else %} +WHERE evt_block_time >= TIMESTAMP '{{iziswap_start_date}}' +{% endif %} + diff --git a/seeds/_sector/dex/_schema.yml b/seeds/_sector/dex/_schema.yml index 3b1f16b7d5b..0952f29d8ec 100644 --- a/seeds/_sector/dex/_schema.yml +++ b/seeds/_sector/dex/_schema.yml @@ -1034,6 +1034,21 @@ seeds: token_bought_amount_raw: uint256 token_sold_amount_raw: uint256 block_date: timestamp + + - name: iziswap_scroll_base_trades_seed + config: + column_types: + blockchain: varchar + project: varchar + version: varchar + tx_hash: varbinary + evt_index: uint256 + block_number: uint256 + token_bought_address: varbinary + token_sold_address: varbinary + token_bought_amount_raw: uint256 + token_sold_amount_raw: uint256 + block_date: timestamp - name: kyberswap_arbitrum_base_trades_seed config: diff --git a/seeds/_sector/dex/iziswap_scroll_base_trades_seed.csv b/seeds/_sector/dex/iziswap_scroll_base_trades_seed.csv new file mode 100644 index 00000000000..c550ddd6660 --- /dev/null +++ b/seeds/_sector/dex/iziswap_scroll_base_trades_seed.csv @@ -0,0 +1,6 @@ +blockchain,project,project_contract_address,version,tx_hash,evt_index,block_time,block_number,block_month,block_date,token_bought_address,token_sold_address,token_bought_amount_raw,token_sold_amount_raw,taker,maker +scroll,iziswap,0x8f8ed95b3b3ed2979d1ee528f38ca3e481a94dd9,1,0xb27f77dbb3e92ecab9494d715ede941ccff7d3f7b270a2965bb84e15340987c3,4,2023-10-14 03:53:56.000 UTC,44398,2023-10-01,2023-10-14,0x06efdbff2a14a7c8e15944d1f4a48f9f95f663a4,0x5300000000000000000000000000000000000004,158415,99999999985481,0x423f9b19db22337d249c1d85ee045700846953b3,0x2db0afd0045f3518c77ec6591a542e326befd3d7 +scroll,iziswap,0x8f8ed95b3b3ed2979d1ee528f38ca3e481a94dd9,1,0x3f53fd20ecc5a5a8808d04c7dd02a44f6abc5a8dfe421f75cf91313889f1b5a7,4,2023-10-14 05:10:53.000 UTC,44859,2023-10-01,2023-10-14,0x06efdbff2a14a7c8e15944d1f4a48f9f95f663a4,0x5300000000000000000000000000000000000004,15647,9999999981273,0x423f9b19db22337d249c1d85ee045700846953b3,0x2db0afd0045f3518c77ec6591a542e326befd3d7 +scroll,iziswap,0x8f8ed95b3b3ed2979d1ee528f38ca3e481a94dd9,1,0x4fcd216e38a4286f2a6f1abbaded95970f43700884504b29ddef53a77ac81b18,4,2023-10-14 11:46:52.000 UTC,48075,2023-10-01,2023-10-14,0x06efdbff2a14a7c8e15944d1f4a48f9f95f663a4,0x5300000000000000000000000000000000000004,154721,99999999978525,0x24aad630632a2ecdec7f0a813127fcf37ccaf992,0x2db0afd0045f3518c77ec6591a542e326befd3d7 +scroll,iziswap,0x8f8ed95b3b3ed2979d1ee528f38ca3e481a94dd9,1,0xfc7865bdf44e12d9e623a7f986ce5e01a5918a83a93e633a4829d538f43a0da2,4,2023-10-15 08:10:46.000 UTC,56097,2023-10-01,2023-10-15,0x06efdbff2a14a7c8e15944d1f4a48f9f95f663a4,0x5300000000000000000000000000000000000004,15296,9999999986775,0xdf08aaa381631eb6463a014b9305c091c453525c,0x2db0afd0045f3518c77ec6591a542e326befd3d7 +scroll,iziswap,0x8f8ed95b3b3ed2979d1ee528f38ca3e481a94dd9,1,0xdf6f0cc05b91b05076c87bd20b549639cf11e96ca2b31f28c3b5599263190b35,4,2023-10-15 12:20:10.000 UTC,58041,2023-10-01,2023-10-15,0x06efdbff2a14a7c8e15944d1f4a48f9f95f663a4,0x5300000000000000000000000000000000000004,563573,499999999991566,0xbec05fb06a81eb1517bbead2e74027de08d0e4ca,0x2db0afd0045f3518c77ec6591a542e326befd3d7 diff --git a/sources/_sector/dex/trades/scroll/_sources.yml b/sources/_sector/dex/trades/scroll/_sources.yml index 285e9fbbf51..4035cee9cd0 100644 --- a/sources/_sector/dex/trades/scroll/_sources.yml +++ b/sources/_sector/dex/trades/scroll/_sources.yml @@ -27,6 +27,9 @@ sources: tables: - name: ClPoolFactory_evt_PoolCreated - name: ClPool_evt_Swap + - name: iziswap_scroll + tables: + - name: iZiSwapPool_evt_Swap - name: icecreamswap_v2_scroll tables: - name: UniswapV2Factory_evt_PairCreated From e7df88a54228192568fae6e1e60bf6e31a0ec1e8 Mon Sep 17 00:00:00 2001 From: chef-seaweed <121569855+chef-seaweed@users.noreply.github.com> Date: Tue, 11 Jun 2024 23:00:13 +0800 Subject: [PATCH 096/149] Add Pancakeswap Linea Dex Trades (#6102) * Add PCS Linea Dex Trades * Update _schema.yml * Update _schema.yml --------- Co-authored-by: Huang Geyang --- models/_sector/dex/trades/linea/_schema.yml | 39 +++++++++++++++++++ .../trades/linea/dex_linea_base_trades.sql | 2 + .../pancakeswap_v2_linea_base_trades.sql | 21 ++++++++++ .../pancakeswap_v3_linea_base_trades.sql | 21 ++++++++++ seeds/_sector/dex/_schema.yml | 15 +++++++ .../pancakeswap_linea_base_trades_seed.csv | 7 ++++ sources/_sector/dex/trades/linea/_sources.yml | 8 ++++ 7 files changed, 113 insertions(+) create mode 100644 models/_sector/dex/trades/linea/platforms/pancakeswap_v2_linea_base_trades.sql create mode 100644 models/_sector/dex/trades/linea/platforms/pancakeswap_v3_linea_base_trades.sql create mode 100644 seeds/_sector/dex/pancakeswap_linea_base_trades_seed.csv diff --git a/models/_sector/dex/trades/linea/_schema.yml b/models/_sector/dex/trades/linea/_schema.yml index 60434748883..c98e569bd10 100644 --- a/models/_sector/dex/trades/linea/_schema.yml +++ b/models/_sector/dex/trades/linea/_schema.yml @@ -89,3 +89,42 @@ models: - evt_index - check_dex_base_trades_seed: seed_file: ref('secta_linea_base_trades_seed') + + - name: pancakeswap_v2_linea_base_trades + meta: + blockchain: linea + sector: dex + project: pancakeswap + contributors: chef_seaweed + config: + tags: [ 'linea', 'dex', 'trades', 'pancakeswap', 'uniswap', 'v2' ] + description: "Pancakeswap linea v2 base trades" + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - tx_hash + - evt_index + - check_dex_base_trades_seed: + seed_file: ref('pancakeswap_linea_base_trades_seed') + filter: + version: 2 + + + - name: pancakeswap_v3_linea_base_trades + meta: + blockchain: linea + sector: dex + project: pancakeswap + contributors: chef_seaweed + config: + tags: [ 'linea', 'dex', 'trades', 'pancakeswap' ] + description: "Pancakeswap V3 linea base trades" + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - tx_hash + - evt_index + - check_dex_base_trades_seed: + seed_file: ref('pancakeswap_linea_base_trades_seed') + filter: + version: 3 diff --git a/models/_sector/dex/trades/linea/dex_linea_base_trades.sql b/models/_sector/dex/trades/linea/dex_linea_base_trades.sql index ac6d330fdd8..fd743226c7c 100644 --- a/models/_sector/dex/trades/linea/dex_linea_base_trades.sql +++ b/models/_sector/dex/trades/linea/dex_linea_base_trades.sql @@ -11,6 +11,8 @@ , ref('nile_linea_base_trades') , ref('echodex_linea_base_trades') , ref('secta_linea_base_trades') + , ref('pancakeswap_v2_linea_base_trades') + , ref('pancakeswap_v3_linea_base_trades') ] %} WITH base_union AS ( diff --git a/models/_sector/dex/trades/linea/platforms/pancakeswap_v2_linea_base_trades.sql b/models/_sector/dex/trades/linea/platforms/pancakeswap_v2_linea_base_trades.sql new file mode 100644 index 00000000000..521f2f6335b --- /dev/null +++ b/models/_sector/dex/trades/linea/platforms/pancakeswap_v2_linea_base_trades.sql @@ -0,0 +1,21 @@ +{{ + config( + schema = 'pancakeswap_v2_linea', + alias = 'base_trades', + materialized = 'incremental', + file_format = 'delta', + incremental_strategy = 'merge', + unique_key = ['tx_hash', 'evt_index'], + incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.block_time')] + ) +}} + +{{ + uniswap_compatible_v2_trades( + blockchain = 'linea', + project = 'pancakeswap', + version = '2', + Pair_evt_Swap = source('pancakeswap_v2_linea', 'PancakePair_evt_Swap'), + Factory_evt_PairCreated = source('pancakeswap_v2_linea', 'PancakeFactory_evt_PairCreated') + ) +}} diff --git a/models/_sector/dex/trades/linea/platforms/pancakeswap_v3_linea_base_trades.sql b/models/_sector/dex/trades/linea/platforms/pancakeswap_v3_linea_base_trades.sql new file mode 100644 index 00000000000..afc69fe3133 --- /dev/null +++ b/models/_sector/dex/trades/linea/platforms/pancakeswap_v3_linea_base_trades.sql @@ -0,0 +1,21 @@ +{{ + config( + schema = 'pancakeswap_v3_linea', + alias = 'base_trades', + materialized = 'incremental', + file_format = 'delta', + incremental_strategy = 'merge', + unique_key = ['tx_hash', 'evt_index'], + incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.block_time')] + ) +}} + +{{ + uniswap_compatible_v3_trades( + blockchain = 'linea', + project = 'pancakeswap', + version = '3', + Pair_evt_Swap = source('pancakeswap_v3_linea', 'PancakeV3Pool_evt_Swap'), + Factory_evt_PoolCreated = source('pancakeswap_v3_linea', 'PancakeV3Factory_evt_PoolCreated') + ) +}} diff --git a/seeds/_sector/dex/_schema.yml b/seeds/_sector/dex/_schema.yml index 0952f29d8ec..6f7bd8e93f1 100644 --- a/seeds/_sector/dex/_schema.yml +++ b/seeds/_sector/dex/_schema.yml @@ -1425,6 +1425,21 @@ seeds: token_sold_amount_raw: uint256 block_date: timestamp + - name: pancakeswap_linea_base_trades_seed + config: + column_types: + blockchain: varchar + project: varchar + version: varchar + tx_hash: varbinary + evt_index: uint256 + block_number: uint256 + token_bought_address: varbinary + token_sold_address: varbinary + token_bought_amount_raw: uint256 + token_sold_amount_raw: uint256 + block_date: timestamp + - name: platypus_finance_avalanche_c_base_trades_seed config: column_types: diff --git a/seeds/_sector/dex/pancakeswap_linea_base_trades_seed.csv b/seeds/_sector/dex/pancakeswap_linea_base_trades_seed.csv new file mode 100644 index 00000000000..40e7f7f6a5d --- /dev/null +++ b/seeds/_sector/dex/pancakeswap_linea_base_trades_seed.csv @@ -0,0 +1,7 @@ +blockchain,project,version,block_date,tx_hash,evt_index,token_bought_address,token_sold_address,block_number,token_bought_amount_raw,token_sold_amount_raw +linea,pancakeswap,3,2024-06-06,0x423862c172e153d21a9189b1aa9a1e2c695fd40d3ee85f9af1b9d7564cd5e888,16,0x176211869ca2b568f2a7d4ee941e073a821ee1ff,0xe5d7c2a44ffddf6b295a15c148167daaaf5cf34f,5211888,496565,129359184767832 +linea,pancakeswap,3,2024-06-06,0x63de14f6bd76e0d75534ed2c96f3997e0f3160bf77be3e0fc5ea18aac9cb1de3,31,0x0d1e753a25ebda689453309112904807625befbe,0xe5d7c2a44ffddf6b295a15c148167daaaf5cf34f,5211829,12949937293941124297,10845214481693491 +linea,pancakeswap,3,2024-06-06,0x4a5497538310bd15e8d0718f24a0f84250cf24e384e3cff35cfc88ce9fba5bc5,66,0x3aab2285ddcddad8edf438c1bab47e1a9d05a9b4,0xe5d7c2a44ffddf6b295a15c148167daaaf5cf34f,5211830,48016,8900000000000000 +linea,pancakeswap,2,2024-06-06,0x88972ff1e3be8a0c3482fe343b6c0b2fa10f5f039a942c73f160fb89d06b08ef,4,0xe5d7c2a44ffddf6b295a15c148167daaaf5cf34f,0xd96536b77ae5500fe850add2253bcf640e7824c1,5209979,158345288962017321,93174475178374246432768 +linea,pancakeswap,2,2024-06-06,0x50ea22a95b93395bc9d435847c45275875ef06a7e658e4af0e55da15e0f1c2d4,7,0x3aab2285ddcddad8edf438c1bab47e1a9d05a9b4,0xe5d7c2a44ffddf6b295a15c148167daaaf5cf34f,5211323,1200,222040000000000 +linea,pancakeswap,2,2024-06-06,0x4887fe6d483b01674ed6183767a41854bc9ef8d0557200d17ffbc803e1071cba,13,0x176211869ca2b568f2a7d4ee941e073a821ee1ff,0xe5d7c2a44ffddf6b295a15c148167daaaf5cf34f,5210736,354102,92186250000000 \ No newline at end of file diff --git a/sources/_sector/dex/trades/linea/_sources.yml b/sources/_sector/dex/trades/linea/_sources.yml index 4943a591161..065727d0f1c 100644 --- a/sources/_sector/dex/trades/linea/_sources.yml +++ b/sources/_sector/dex/trades/linea/_sources.yml @@ -21,3 +21,11 @@ sources: tables: - name: SectaFactory_evt_PairCreated - name: SectaPair_evt_Swap + - name: pancakeswap_v2_linea + tables: + - name: PancakePair_evt_Swap + - name: PancakeFactory_evt_PairCreated + - name: pancakeswap_v3_linea + tables: + - name: PancakeV3Pool_evt_Swap + - name: PancakeV3Factory_evt_PoolCreated \ No newline at end of file From 8d4db5edf8a545b121705f817e13c8f88b70c357 Mon Sep 17 00:00:00 2001 From: hildobby Date: Tue, 11 Jun 2024 19:57:00 +0200 Subject: [PATCH 097/149] Blur & Fantasy trades (#6091) * create fantasy trades * make fantasy.trades view * fix * fix * fix * fix project name * add blur trades * fix * fix --------- Co-authored-by: Alan Ghobadi --- .../chains/blast/nft_blast_base_trades.sql | 51 ++++++++ .../trades/chains/blast/platforms/_schema.yml | 30 +++++ .../platforms/blur_blast_base_trades.sql | 115 ++++++++++++++++++ .../platforms/fantasy_blast_base_trades.sql | 94 ++++++++++++++ models/_sector/nft/trades/nft_base_trades.sql | 1 + models/_sector/nft/trades/nft_trades.sql | 2 +- .../nft/trades/platform_views/_schema.yml | 10 ++ .../platform_views/fantasy_trades_view.sql | 15 +++ models/_sector/nft/trades/schema.yml | 2 +- sources/_sector/nft/trades/blast_sources.yml | 13 ++ 10 files changed, 331 insertions(+), 2 deletions(-) create mode 100644 models/_sector/nft/trades/chains/blast/nft_blast_base_trades.sql create mode 100644 models/_sector/nft/trades/chains/blast/platforms/_schema.yml create mode 100644 models/_sector/nft/trades/chains/blast/platforms/blur_blast_base_trades.sql create mode 100644 models/_sector/nft/trades/chains/blast/platforms/fantasy_blast_base_trades.sql create mode 100644 models/_sector/nft/trades/platform_views/fantasy_trades_view.sql create mode 100644 sources/_sector/nft/trades/blast_sources.yml diff --git a/models/_sector/nft/trades/chains/blast/nft_blast_base_trades.sql b/models/_sector/nft/trades/chains/blast/nft_blast_base_trades.sql new file mode 100644 index 00000000000..a2f658caf11 --- /dev/null +++ b/models/_sector/nft/trades/chains/blast/nft_blast_base_trades.sql @@ -0,0 +1,51 @@ +{{ config( + schema = 'nft_blast', + alias = 'base_trades', + materialized = 'view' + ) +}} + + +{% set nft_models = [ + ref('fantasy_blast_base_trades') + , ref('blur_blast_base_trades') +] %} + + +SELECT * FROM ( +{% for nft_model in nft_models %} + SELECT + blockchain, + project, + project_version, + cast(date_trunc('day', block_time) as date) as block_date, + cast(date_trunc('month', block_time) as date) as block_month, + block_time, + block_number, + tx_hash, + project_contract_address, + trade_category, --buy/sell/swap + trade_type, --primary/secondary + buyer, + seller, + nft_contract_address, + nft_token_id, + nft_amount, -- always 1 for erc721 + price_raw, + currency_contract, + platform_fee_amount_raw, + royalty_fee_amount_raw, + platform_fee_address, -- optional + royalty_fee_address, -- optional + sub_tx_trade_id, + tx_from, + tx_to, + tx_data_marker, + row_number() over (partition by tx_hash, sub_tx_trade_id order by tx_hash) as duplicates_rank -- duplicates protection + FROM {{ nft_model }} + {% if not loop.last %} + UNION ALL + {% endif %} + {% endfor %} + ) +where duplicates_rank = 1 diff --git a/models/_sector/nft/trades/chains/blast/platforms/_schema.yml b/models/_sector/nft/trades/chains/blast/platforms/_schema.yml new file mode 100644 index 00000000000..44a07d83177 --- /dev/null +++ b/models/_sector/nft/trades/chains/blast/platforms/_schema.yml @@ -0,0 +1,30 @@ +version: 2 + +models: + - name: fantasy_blast_base_trades + meta: + blockchain: blast + sector: nft + project: fantasy + contributors: hildobby + config: + tags: ['blast', 'nft', 'trades', 'fantasy'] + description: "Fantasy base trades" + tests: + - check_columns_nft_base_trades + - dbt_utils.unique_combination_of_columns: + combination_of_columns: ['block_number','tx_hash','sub_tx_trade_id'] + + - name: blur_blast_base_trades + meta: + blockchain: blast + sector: nft + project: fantasy + contributors: hildobby + config: + tags: ['blast', 'nft', 'trades', 'blur'] + description: "Blur on blast base trades" + tests: + - check_columns_nft_base_trades + - dbt_utils.unique_combination_of_columns: + combination_of_columns: ['block_number','tx_hash','sub_tx_trade_id'] diff --git a/models/_sector/nft/trades/chains/blast/platforms/blur_blast_base_trades.sql b/models/_sector/nft/trades/chains/blast/platforms/blur_blast_base_trades.sql new file mode 100644 index 00000000000..9b9d78b2555 --- /dev/null +++ b/models/_sector/nft/trades/chains/blast/platforms/blur_blast_base_trades.sql @@ -0,0 +1,115 @@ +{{ config( + schema = 'blur_blast', + alias = 'base_trades', + materialized = 'incremental', + file_format = 'delta', + incremental_strategy = 'merge', + unique_key = ['block_number','tx_hash','sub_tx_trade_id'], + ) +}} + +{% set blur_blast_start_date = '2024-04-10' %} + +WITH blur_trades AS ( + SELECT evt_tx_hash AS tx_hash + , bytearray_to_uint256(bytearray_substring(cast(collectionPriceSide as varbinary),2,11)) AS price_raw + , evt_block_time AS block_time + , evt_block_number AS block_number + , NULL AS fee_side + , evt_index + , contract_address AS project_contract_address + , bytearray_to_bigint(bytearray_substring(cast(collectionPriceSide as varbinary),1,1)) AS order_type + , bytearray_substring(cast(collectionPriceSide as varbinary),13,20) AS nft_contract_address + , orderHash AS order_hash + , bytearray_to_uint256(bytearray_substring(cast(tokenIdListingIndexTrader as varbinary),1,11)) AS nft_token_id + , bytearray_substring(cast(tokenIdListingIndexTrader as varbinary),13,20) AS trader + , double '0' AS fee + , NULL AS royalty_fee_address + FROM {{ source('blur_blast','BlurExchangeV2_evt_Execution721Packed') }} + {% if is_incremental() %} + WHERE {{incremental_predicate('evt_block_time')}} + {% else %} + WHERE evt_block_time >= TIMESTAMP '{{blur_blast_start_date}}' + {% endif %} + + UNION ALL + + SELECT evt_tx_hash AS tx_hash + , bytearray_to_uint256(bytearray_substring(cast(collectionPriceSide as varbinary),2,11)) AS price_raw + , evt_block_time AS block_time + , evt_block_number AS block_number + , 'maker' AS fee_side + , evt_index + , contract_address AS project_contract_address + , bytearray_to_bigint(bytearray_substring(cast(collectionPriceSide as varbinary),1,1)) AS order_type + , bytearray_substring(cast(collectionPriceSide as varbinary),13,20) AS nft_contract_address + , orderHash AS order_hash + , bytearray_to_uint256(bytearray_substring(cast(tokenIdListingIndexTrader as varbinary),1,11)) AS nft_token_id + , bytearray_substring(cast(tokenIdListingIndexTrader as varbinary),13,20) AS trader + , CAST(bitwise_right_shift(makerFeeRecipientRate, 160) AS double)/10000 AS fee + , bytearray_substring(cast(makerFeeRecipientRate as varbinary),13,20) AS royalty_fee_address + FROM {{ source('blur_blast','BlurExchangeV2_evt_Execution721MakerFeePacked') }} + {% if is_incremental() %} + WHERE {{incremental_predicate('evt_block_time')}} + {% else %} + WHERE evt_block_time >= TIMESTAMP '{{blur_blast_start_date}}' + {% endif %} + + UNION ALL + + SELECT evt_tx_hash AS tx_hash + , bytearray_to_uint256(bytearray_substring(cast(collectionPriceSide as varbinary),2,11)) AS price_raw + , evt_block_time AS block_time + , evt_block_number AS block_number + , 'taker' AS fee_side + , evt_index + , contract_address AS project_contract_address + , bytearray_to_bigint(bytearray_substring(cast(collectionPriceSide as varbinary),1,1)) AS order_type + , bytearray_substring(cast(collectionPriceSide as varbinary),13,20) AS nft_contract_address + , orderHash AS order_hash + , bytearray_to_uint256(bytearray_substring(cast(tokenIdListingIndexTrader as varbinary),1,11)) AS nft_token_id + , bytearray_substring(cast(tokenIdListingIndexTrader as varbinary),13,20) AS trader + , CAST(bitwise_right_shift(takerFeeRecipientRate, 160) AS double)/10000 AS fee + , bytearray_substring(cast(takerFeeRecipientRate as varbinary),13,20) AS royalty_fee_address + FROM {{ source('blur_blast','BlurExchangeV2_evt_Execution721TakerFeePacked') }} + {% if is_incremental() %} + WHERE {{incremental_predicate('evt_block_time')}} + {% else %} + WHERE evt_block_time >= TIMESTAMP '{{blur_blast_start_date}}' + {% endif %} + ) + +, trades_final AS ( + SELECT 'blast' as blockchain + , 'blur' as project + , 'v2' as project_version + , bt.block_time + , bt.block_number + , bt.tx_hash + , bt.evt_index AS sub_tx_trade_id + , CASE WHEN bt.order_type = 1 THEN 'Sell' ELSE 'Buy' END AS trade_category + , 'secondary' AS trade_type + , CASE WHEN bt.order_type = 1 THEN bt.trader ELSE txs."from" END AS buyer + , CASE WHEN bt.order_type = 0 THEN bt.trader ELSE txs."from" END AS seller + , bt.nft_contract_address + , bt.nft_token_id AS nft_token_id + , UINT256 '1' AS nft_amount + , bt.price_raw + , CASE WHEN bt.order_type = 0 THEN 0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2 ELSE 0x0000000000a39bb272e79075ade125fd351887ac END AS currency_contract + , bt.project_contract_address + , uint256 '0' AS platform_fee_amount_raw + , CAST(NULL AS varbinary) AS platform_fee_address + , CAST(ROUND(bt.price_raw * bt.fee) AS UINT256) AS royalty_fee_amount_raw + , bt.royalty_fee_address + FROM blur_trades bt + -- todo: remove the join on transactions here + INNER JOIN {{ source('blast', 'transactions') }} txs ON txs.block_number=bt.block_number + AND txs.hash=bt.tx_hash + {% if is_incremental() %} + AND {{incremental_predicate('txs.block_time')}} + {% else %} + AND txs.block_time >= TIMESTAMP '{{blur_blast_start_date}}' + {% endif %} + ) + +{{ add_nft_tx_data('trades_final', 'blast') }} \ No newline at end of file diff --git a/models/_sector/nft/trades/chains/blast/platforms/fantasy_blast_base_trades.sql b/models/_sector/nft/trades/chains/blast/platforms/fantasy_blast_base_trades.sql new file mode 100644 index 00000000000..3bfb0c4ba7b --- /dev/null +++ b/models/_sector/nft/trades/chains/blast/platforms/fantasy_blast_base_trades.sql @@ -0,0 +1,94 @@ +{{ config( + schema = 'fantasy_blast', + alias = 'base_trades', + materialized = 'incremental', + file_format = 'delta', + incremental_strategy = 'merge', + unique_key = ['block_number','tx_hash','sub_tx_trade_id'] + ) +}} + +{% set project_start_date = '2024-05-01' %} + +WITH trades AS ( + SELECT evt_block_time AS block_time + , evt_block_date AS block_date + , CAST(JSON_EXTRACT_SCALAR(sell, '$.tokenId') AS UINT256) AS nft_token_id + , UINT256 '1' AS nft_amount + , 'Buy' AS trade_category + , from_hex(JSON_EXTRACT_SCALAR(sell, '$.trader')) AS seller + , buyer + , CAST(JSON_EXTRACT_SCALAR(sell, '$.price') AS UINT256) AS price_raw + , from_hex(JSON_EXTRACT_SCALAR(sell, '$.paymentToken')) AS currency_contract + , from_hex(JSON_EXTRACT_SCALAR(sell, '$.collection')) AS nft_contract_address + , evt_tx_hash AS tx_hash + , contract_address AS project_contract_address + , evt_block_number AS block_number + , evt_index AS sub_tx_trade_id + , evt_tx_from AS tx_from + , evt_tx_to AS tx_to + FROM {{ source('fantasy_blast', 'Exchange_evt_Buy')}} + {% if not is_incremental() %} + WHERE evt_block_time >= TIMESTAMP '{{project_start_date}}' + {% endif %} + {% if is_incremental() %} + WHERE {{ incremental_predicate('evt_block_time') }} + {% endif %} + + UNION ALL + + SELECT evt_block_time AS block_time + , evt_block_date AS block_date + , CAST(JSON_EXTRACT_SCALAR(buyOrder, '$.tokenId') AS UINT256) AS nft_token_id + , UINT256 '1' AS nft_amount + , 'Sell' AS trade_category + , seller + , from_hex(JSON_EXTRACT_SCALAR(buyOrder, '$.trader')) AS buyer + , CAST(JSON_EXTRACT_SCALAR(buyOrder, '$.price') AS UINT256) AS price_raw + , from_hex(JSON_EXTRACT_SCALAR(buyOrder, '$.paymentToken')) AS currency_contract + , from_hex(JSON_EXTRACT_SCALAR(buyOrder, '$.collection')) AS nft_contract_address + , evt_tx_hash AS tx_hash + , contract_address AS project_contract_address + , evt_block_number AS block_number + , evt_index AS sub_tx_trade_id + , evt_tx_from AS tx_from + , evt_tx_to AS tx_to + FROM {{ source('fantasy_blast', 'Exchange_evt_Sell')}} + {% if not is_incremental() %} + WHERE evt_block_time >= TIMESTAMP '{{project_start_date}}' + {% endif %} + {% if is_incremental() %} + WHERE {{ incremental_predicate('evt_block_time') }} + {% endif %} + ) + + , trades_final AS ( + SELECT 'blast' AS blockchain + , 'fantasy' AS project + , 'v1' AS project_version + , block_time + , block_date + , date_trunc('month', block_time) AS block_month + , nft_token_id + , 'secondary' AS trade_type + , nft_amount + , trade_category + , seller + , buyer + , price_raw + , currency_contract + , nft_contract_address + , tx_hash + , project_contract_address + , block_number + , sub_tx_trade_id + --, tx_from + --, tx_to + , CAST(0.015*CAST(price_raw AS double) AS UINT256) AS platform_fee_amount_raw + , CAST(0.015*CAST(price_raw AS double) AS UINT256) AS royalty_fee_amount_raw + , CAST(NULL AS VARBINARY) AS royalty_fee_address + , 0x8ab15fe88a00b03724ac91ee4ee1f998064f2e31 AS platform_fee_address + FROM trades + ) + +{{ add_nft_tx_data('trades_final', 'base') }} \ No newline at end of file diff --git a/models/_sector/nft/trades/nft_base_trades.sql b/models/_sector/nft/trades/nft_base_trades.sql index 94cfd80f831..3bef0549b6b 100644 --- a/models/_sector/nft/trades/nft_base_trades.sql +++ b/models/_sector/nft/trades/nft_base_trades.sql @@ -25,6 +25,7 @@ ,ref('nft_avalanche_c_base_trades') ,ref('nft_linea_base_trades') ,ref('nft_zora_base_trades') + ,ref('nft_blast_base_trades') ] %} with base_union as ( diff --git a/models/_sector/nft/trades/nft_trades.sql b/models/_sector/nft/trades/nft_trades.sql index 8c5309e4a52..d060f52e9f5 100644 --- a/models/_sector/nft/trades/nft_trades.sql +++ b/models/_sector/nft/trades/nft_trades.sql @@ -2,7 +2,7 @@ schema = 'nft', alias = 'trades', materialized = 'view', - post_hook='{{ expose_spells(\'["ethereum","solana","bnb","optimism","arbitrum","polygon","zksync"]\', + post_hook='{{ expose_spells(\'["ethereum","solana","bnb","optimism","arbitrum","polygon","zksync", "blast"]\', "sector", "nft", \'["soispoke","0xRob", "hildobby"]\') }}') diff --git a/models/_sector/nft/trades/platform_views/_schema.yml b/models/_sector/nft/trades/platform_views/_schema.yml index 8284bb447e8..b92f13aa9b3 100644 --- a/models/_sector/nft/trades/platform_views/_schema.yml +++ b/models/_sector/nft/trades/platform_views/_schema.yml @@ -251,3 +251,13 @@ models: tags: ['nft', 'trades', 'zora'] description: "NFT trades view for zora" + + - name: fantasy_trades_view + meta: + blockchain: ["blast"] + sector: nft + contributors: hildobby + config: + tags: ['nft', 'trades', 'blast'] + description: "NFT trades view for fantasy" + diff --git a/models/_sector/nft/trades/platform_views/fantasy_trades_view.sql b/models/_sector/nft/trades/platform_views/fantasy_trades_view.sql new file mode 100644 index 00000000000..61afe8ea2e5 --- /dev/null +++ b/models/_sector/nft/trades/platform_views/fantasy_trades_view.sql @@ -0,0 +1,15 @@ + +{{ config( + schema = 'fantasy', + alias = 'trades', + + materialized = 'view', + post_hook='{{ expose_spells(\'["blast"]\', + "project", + "fantasy", + \'["hildobby"]\') }}') +}} + +SELECT * +FROM {{ ref('nft_trades') }} +WHERE project = 'fantasy' diff --git a/models/_sector/nft/trades/schema.yml b/models/_sector/nft/trades/schema.yml index d500d467fd9..1578719454f 100644 --- a/models/_sector/nft/trades/schema.yml +++ b/models/_sector/nft/trades/schema.yml @@ -145,7 +145,7 @@ models: - name: nft_trades meta: - blockchain: ethereum, solana, bnb, optimism, arbitrum, polygon + blockchain: ethereum, solana, bnb, optimism, arbitrum, polygon, blast sector: nft contributors: soispoke, hildobby, ilemi, cat config: diff --git a/sources/_sector/nft/trades/blast_sources.yml b/sources/_sector/nft/trades/blast_sources.yml new file mode 100644 index 00000000000..d596cbc4534 --- /dev/null +++ b/sources/_sector/nft/trades/blast_sources.yml @@ -0,0 +1,13 @@ +version: 2 + +sources: + - name: blur_blast + tables: + - name: BlurExchangeV2_evt_Execution721Packed + - name: BlurExchangeV2_evt_Execution721MakerFeePacked + - name: BlurExchangeV2_evt_Execution721TakerFeePacked + + - name: fantasy_blast + tables: + - name: Exchange_evt_Buy + - name: Exchange_evt_Sell \ No newline at end of file From e8d6c5f01f1ec76c06af1b0864000591d2d4142d Mon Sep 17 00:00:00 2001 From: Eduard Gorkh <40689054+grkhr@users.noreply.github.com> Date: Tue, 11 Jun 2024 19:57:17 +0200 Subject: [PATCH 098/149] 1inch: project orders materialize (#6064) * Update oneinch_project_orders.sql * inc predicate * inc pred to config --- models/oneinch/oneinch_project_orders.sql | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/models/oneinch/oneinch_project_orders.sql b/models/oneinch/oneinch_project_orders.sql index 36c497c23de..e02589fd236 100644 --- a/models/oneinch/oneinch_project_orders.sql +++ b/models/oneinch/oneinch_project_orders.sql @@ -2,7 +2,11 @@ config( schema = 'oneinch', alias = 'project_orders', - materialized = 'view', + materialized = 'incremental', + file_format = 'delta', + 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'] ) }} @@ -73,6 +77,9 @@ orders as ( from {{ ref('oneinch_lop') }} where call_success ) + {% if is_incremental() %} + where {{ incremental_predicate('block_time') }} + {% endif %} ) , prices as ( From 4e7af7ab8df885875c74f2a58f06a5f735a4c269 Mon Sep 17 00:00:00 2001 From: tomfutago <35136350+tomfutago@users.noreply.github.com> Date: Tue, 11 Jun 2024 18:57:32 +0100 Subject: [PATCH 099/149] Nexus Mutual - capital pool tweaks (#6099) * tweaks * add avg_usdc_usd_price * fix usdc addition --------- Co-authored-by: Huang Geyang --- .../ethereum/capital_pool/_schema.yml | 8 ++++++ ...xusmutual_ethereum_capital_pool_latest.sql | 4 +++ ...xusmutual_ethereum_capital_pool_totals.sql | 25 ++++++++++++++++--- 3 files changed, 34 insertions(+), 3 deletions(-) diff --git a/models/nexusmutual/ethereum/capital_pool/_schema.yml b/models/nexusmutual/ethereum/capital_pool/_schema.yml index 9953ced90ee..84b850bfe58 100644 --- a/models/nexusmutual/ethereum/capital_pool/_schema.yml +++ b/models/nexusmutual/ethereum/capital_pool/_schema.yml @@ -75,6 +75,12 @@ models: - &avg_eth_usd_price name: avg_eth_usd_price description: "Daily average ETH/USD price" + - &avg_dai_usd_price + name: avg_dai_usd_price + description: "Daily average DAI/USD price" + - &avg_usdc_usd_price + name: avg_usdc_usd_price + description: "Daily average USDC/USD price" - &avg_capital_pool_eth_total name: avg_capital_pool_eth_total description: "Daily average Capital Pool total expressed in ETH" @@ -169,6 +175,8 @@ models: columns: - *block_date - *avg_eth_usd_price + - *avg_dai_usd_price + - *avg_usdc_usd_price - *avg_capital_pool_eth_total - *avg_capital_pool_usd_total - *eth_total diff --git a/models/nexusmutual/ethereum/capital_pool/nexusmutual_ethereum_capital_pool_latest.sql b/models/nexusmutual/ethereum/capital_pool/nexusmutual_ethereum_capital_pool_latest.sql index d91e40fb40a..fb952a11d3c 100644 --- a/models/nexusmutual/ethereum/capital_pool/nexusmutual_ethereum_capital_pool_latest.sql +++ b/models/nexusmutual/ethereum/capital_pool/nexusmutual_ethereum_capital_pool_latest.sql @@ -16,6 +16,8 @@ daily_running_totals as ( select block_date, avg_eth_usd_price, + avg_dai_usd_price, + avg_usdc_usd_price, -- Capital Pool avg_capital_pool_eth_total, avg_capital_pool_usd_total, @@ -58,6 +60,8 @@ daily_running_totals as ( select block_date, avg_eth_usd_price, + avg_dai_usd_price, + avg_usdc_usd_price, -- Capital Pool avg_capital_pool_eth_total, avg_capital_pool_usd_total, diff --git a/models/nexusmutual/ethereum/capital_pool/nexusmutual_ethereum_capital_pool_totals.sql b/models/nexusmutual/ethereum/capital_pool/nexusmutual_ethereum_capital_pool_totals.sql index a5557c2d1b4..6a08e2826b3 100644 --- a/models/nexusmutual/ethereum/capital_pool/nexusmutual_ethereum_capital_pool_totals.sql +++ b/models/nexusmutual/ethereum/capital_pool/nexusmutual_ethereum_capital_pool_totals.sql @@ -397,9 +397,24 @@ daily_running_totals as ( sum(coalesce(tt.dai_total, 0)) over (order by ds.block_date) as dai_total, sum(coalesce(tt.reth_total, 0)) over (order by ds.block_date) as reth_total, sum(coalesce(tt.usdc_total, 0)) over (order by ds.block_date) as usdc_total, - coalesce(steth_rt.steth_total, lag(steth_rt.steth_total) over (order by ds.block_date), 0) as steth_total, - coalesce(nxmty_rt.nxmty_total, lag(nxmty_rt.nxmty_total) over (order by ds.block_date), 0) as nxmty_total, - coalesce(nxmty_rt.nxmty_in_eth_total, lag(nxmty_rt.nxmty_in_eth_total) over (order by ds.block_date), 0) as nxmty_eth_total, + coalesce( + steth_rt.steth_total, + lag(steth_rt.steth_total, 1) over (order by ds.block_date), + lag(steth_rt.steth_total, 2) over (order by ds.block_date), + 0 + ) as steth_total, + coalesce( + nxmty_rt.nxmty_total, + lag(nxmty_rt.nxmty_total, 1) over (order by ds.block_date), + lag(nxmty_rt.nxmty_total, 2) over (order by ds.block_date), + 0 + ) as nxmty_total, + coalesce( + nxmty_rt.nxmty_in_eth_total, + lag(nxmty_rt.nxmty_in_eth_total, 1) over (order by ds.block_date), + lag(nxmty_rt.nxmty_in_eth_total, 2) over (order by ds.block_date), + 0 + ) as nxmty_eth_total, coalesce(cre.amount, 0) as cover_re_usdc_total, coalesce(aave_s.supplied_amount, 0) as aave_collateral_weth_total, -1 * coalesce(aave_b.borrowed_amount, 0) as aave_debt_usdc_total @@ -416,6 +431,8 @@ daily_running_totals_enriched as ( select drt.block_date, coalesce(p_avg_eth.price_usd, 0) as avg_eth_usd_price, + coalesce(p_avg_dai.price_usd, 0) as avg_dai_usd_price, + coalesce(p_avg_usdc.price_usd, 0) as avg_usdc_usd_price, -- ETH coalesce(drt.eth_total, 0) as eth_total, coalesce(drt.eth_total * p_avg_eth.price_usd, 0) as avg_eth_usd_total, @@ -458,6 +475,8 @@ daily_running_totals_enriched as ( select block_date, avg_eth_usd_price, + avg_dai_usd_price, + avg_usdc_usd_price, -- Capital Pool totals eth_total + nxmty_eth_total + steth_total + avg_dai_eth_total + avg_reth_eth_total + avg_usdc_eth_total + avg_cover_re_usdc_eth_total + aave_collateral_weth_total + avg_aave_debt_usdc_eth_total as avg_capital_pool_eth_total, From 304c59d1932cfcfbe689b87e9909f022482cc8d1 Mon Sep 17 00:00:00 2001 From: ppclunghe <90045511+ppclunghe@users.noreply.github.com> Date: Tue, 11 Jun 2024 20:15:40 +0200 Subject: [PATCH 100/149] lido liquidity updates (#6033) * lido liquidity updates * liquidity spell * zebra scroll pools * liquidity spell upd * zebra volume fix * zksync maverick pools * liquidity spell maverick upd * velo/aero cl pools * liquidity spell aero/velo upd * update according comments * zksync syncswap fixes * liquidity spell fix with zksync pools * Update post_hook --------- Co-authored-by: Huang Geyang --- models/lido/lido_liquidity.sql | 8 +- ...lido_liquidity_base_aerodrome_cl_pools.sql | 320 ++++++++++++++++++ .../lido_liquidity_base_uniswap_v3_pools.sql | 53 +-- ..._liquidity_optimism_velodrome_cl_pools.sql | 319 +++++++++++++++++ .../scroll/lido_liquidity_scroll_schema.yml | 64 ++++ .../lido_liquidity_scroll_syncswap_pools.sql | 285 ++++++++++++++++ .../lido_liquidity_scroll_zebra_pools.sql | 287 ++++++++++++++++ .../lido_liquidity_zksync_maverick_pools.sql | 253 ++++++++++++++ .../lido_liquidity_zksync_syncswap_pools.sql | 14 +- ...ido_liquidity_zksync_syncswap_v2_pools.sql | 286 ++++++++++++++++ .../base/lido_liquidity_base_sources.yml | 12 + .../lido_liquidity_optimism_sources.yml | 18 +- .../scroll/lido_liquidity_scroll_sources.yml | 24 ++ .../zksync/lido_liquidity_zksync_sources.yml | 23 ++ 14 files changed, 1916 insertions(+), 50 deletions(-) create mode 100644 models/lido/liquidity/base/lido_liquidity_base_aerodrome_cl_pools.sql create mode 100644 models/lido/liquidity/optimism/lido_liquidity_optimism_velodrome_cl_pools.sql create mode 100644 models/lido/liquidity/scroll/lido_liquidity_scroll_schema.yml create mode 100644 models/lido/liquidity/scroll/lido_liquidity_scroll_syncswap_pools.sql create mode 100644 models/lido/liquidity/scroll/lido_liquidity_scroll_zebra_pools.sql create mode 100644 models/lido/liquidity/zksync/lido_liquidity_zksync_maverick_pools.sql create mode 100644 models/lido/liquidity/zksync/lido_liquidity_zksync_syncswap_v2_pools.sql create mode 100644 sources/lido/liquidity/scroll/lido_liquidity_scroll_sources.yml diff --git a/models/lido/lido_liquidity.sql b/models/lido/lido_liquidity.sql index 9bbe73f1fd9..781f2e22b48 100644 --- a/models/lido/lido_liquidity.sql +++ b/models/lido/lido_liquidity.sql @@ -25,6 +25,7 @@ ref('lido_liquidity_optimism_balancer_pools'), ref('lido_liquidity_optimism_velodrome_pools'), ref('lido_liquidity_optimism_velodrome_v2_pools'), + ref('lido_liquidity_optimism_velodrome_cl_pools'), ref('lido_liquidity_polygon_balancer_pools'), ref('lido_liquidity_polygon_uniswap_v3_pools'), ref('lido_liquidity_polygon_kyberswap_v2_pools'), @@ -43,9 +44,14 @@ ref('lido_liquidity_ethereum_solidly_pools'), ref('lido_liquidity_base_kyberswap_pools'), ref('lido_liquidity_base_aerodrome_pools'), + ref('lido_liquidity_base_aerodrome_cl_pools'), ref('lido_liquidity_base_uniswap_v3_pools'), ref('lido_liquidity_zksync_syncswap_pools'), - ref('lido_liquidity_linea_syncswap_pools') + ref('lido_liquidity_zksync_syncswap_v2_pools'), + ref('lido_liquidity_zksync_maverick_pools'), + ref('lido_liquidity_linea_syncswap_pools'), + ref('lido_liquidity_scroll_syncswap_pools'), + ref('lido_liquidity_scroll_zebra_pools') ] %} {% set project_start_date = '2020-12-15'%} diff --git a/models/lido/liquidity/base/lido_liquidity_base_aerodrome_cl_pools.sql b/models/lido/liquidity/base/lido_liquidity_base_aerodrome_cl_pools.sql new file mode 100644 index 00000000000..70b7a73af2c --- /dev/null +++ b/models/lido/liquidity/base/lido_liquidity_base_aerodrome_cl_pools.sql @@ -0,0 +1,320 @@ +{{ config( + schema='lido_liquidity_base', + alias = 'aerodrome_cl', + materialized = 'incremental', + file_format = 'delta', + incremental_strategy = 'merge', + unique_key = ['pool', 'time'], + post_hook='{{ expose_spells(blockchains = \'["base"]\', + spell_type = "project", + spell_name = "lido_liquidity", + contributors = \'["pipistrella"]\') }}' + ) +}} + +{% set project_start_date = '2024-04-24' %} +with pools as ( +select pool AS address, + 'base' AS blockchain, + 'aerodrome' AS project, + 'CL' AS pool_type, * +from {{source('aerodrome_base', 'CLFactory_evt_PoolCreated')}} +where (token0 = 0xc1CBa3fCea344f92D9239c08C0568f6F2F0ee452 + OR token1 = 0xc1CBa3fCea344f92D9239c08C0568f6F2F0ee452) +) + + , pool_fee as ( +select pool, max(cast(f1.output_0 as double)/10000) as fee +from {{source('aerodrome_base','CLFactory_call_getSwapFee')}} f1 +where f1.call_block_time = (select max(f2.call_block_time) + from {{source('aerodrome_base','CLFactory_call_getSwapFee')}} f2 where f2.pool = f1.pool) +and f1. pool in (select address from pools) +group by 1 +) + +, tokens as ( + select distinct token + from ( + select token0 as token + from {{source('aerodrome_base','CLFactory_evt_PoolCreated')}} + where token1 = 0xc1CBa3fCea344f92D9239c08C0568f6F2F0ee452 + union all + select token1 + from {{source('aerodrome_base','CLFactory_evt_PoolCreated')}} + where token0 = 0xc1CBa3fCea344f92D9239c08C0568f6F2F0ee452 + union all + select 0xc1CBa3fCea344f92D9239c08C0568f6F2F0ee452 + ) t + ) + +, tokens_prices_daily as ( +select distinct + DATE_TRUNC('day', minute) AS time, + contract_address AS token, + symbol, + decimals, + AVG(price) AS price +FROM {{source('prices','usd')}} p +{% if not is_incremental() %} +WHERE DATE_TRUNC('day', p.minute) >= DATE '{{ project_start_date }}' +{% else %} +WHERE {{ incremental_predicate('p.minute') }} +{% endif %} + + and date_trunc('day', minute) < current_date + and blockchain = 'base' + and contract_address IN (select token from tokens) +group by 1,2,3,4 + +union all + +select distinct + DATE_TRUNC('day', minute), + contract_address AS token, + symbol, + decimals, + LAST_VALUE(price) OVER (PARTITION BY DATE_TRUNC('day', minute),contract_address ORDER BY minute NULLS FIRST range BETWEEN UNBOUNDED preceding AND UNBOUNDED following) AS price + FROM + {{source('prices','usd')}} + WHERE + DATE_TRUNC('day', minute) = current_date + and blockchain = 'base' + and contract_address IN (select token from tokens) + ) + + , wsteth_prices_hourly AS ( + SELECT distinct + DATE_TRUNC('hour', minute) time, + contract_address as token, + symbol, + decimals, + last_value(price) over (partition by DATE_TRUNC('hour', minute), contract_address ORDER BY minute range between unbounded preceding AND unbounded following) AS price + FROM {{source('prices','usd')}} p + {% if not is_incremental() %} + WHERE DATE_TRUNC('day', p.minute) >= DATE '{{ project_start_date }}' + {% else %} + WHERE {{ incremental_predicate('p.minute') }} + {% endif %} + and blockchain = 'base' and contract_address = 0xc1CBa3fCea344f92D9239c08C0568f6F2F0ee452 + +) + +, wsteth_prices_hourly_with_lead AS ( +select time, + lead(time, 1, date_trunc('hour', now() + interval '1' hour)) over (order by time) as next_time, + price +from wsteth_prices_hourly +) + +, mint_events AS ( + select DATE_TRUNC('day', m.evt_block_time) AS time, + m.contract_address AS pool, + cr.token0, + cr.token1, + SUM(CAST(amount0 AS DOUBLE)) AS amount0, + SUM(CAST(amount1 AS DOUBLE)) AS amount1 + from {{source('aerodrome_base','CLPool_evt_Mint')}} m + left join {{source('aerodrome_base','CLFactory_evt_PoolCreated')}} cr on m.contract_address = cr.pool + + {% if not is_incremental() %} + WHERE DATE_TRUNC('day', m.evt_block_time) >= DATE '{{ project_start_date }}' + {% else %} + WHERE {{ incremental_predicate('m.evt_block_time') }} + {% endif %} + + and m.contract_address in (select address from pools) + group by 1,2,3,4 + ) + + , collect_events as ( + select DATE_TRUNC('day', b.evt_block_time) AS time, + b.contract_address AS pool, + cr.token0, + cr.token1, + (-1)*SUM(CAST(amount0 AS DOUBLE)) AS amount0, + (-1)*SUM(CAST(amount1 AS DOUBLE)) AS amount1 + from {{source('aerodrome_base','CLPool_evt_Collect')}} b + left join {{source('aerodrome_base','CLFactory_evt_PoolCreated')}} cr on b.contract_address = cr.pool + + {% if not is_incremental() %} + WHERE DATE_TRUNC('day', b.evt_block_time) >= DATE '{{ project_start_date }}' + {% else %} + WHERE {{ incremental_predicate('b.evt_block_time') }} + {% endif %} + + and b.contract_address in (select address from pools) + group by 1,2,3,4 + + ) + +, swap_events as ( + select DATE_TRUNC('day', s.evt_block_time) AS time, + s.contract_address AS pool, + cr.token0, + cr.token1, + SUM(CAST(amount0 AS DOUBLE)) AS amount0, + SUM(CAST(amount1 AS DOUBLE)) AS amount1 + from {{source('aerodrome_base','CLPool_evt_Swap')}} s + left join {{source('aerodrome_base','CLFactory_evt_PoolCreated')}} cr on s.contract_address = cr.pool + + {% if not is_incremental() %} + WHERE DATE_TRUNC('day', s.evt_block_time) >= DATE '{{ project_start_date }}' + {% else %} + WHERE {{ incremental_predicate('s.evt_block_time') }} + {% endif %} + + and s.contract_address in (select address from pools) + group by 1,2,3,4 + +) +, fee_events as ( +select + DATE_TRUNC('day', s.evt_block_time) AS time, + s.contract_address AS pool, + cr.token0, + cr.token1, + (-1)*SUM(CAST(amount0 AS DOUBLE) ) AS amount0, + (-1)*SUM(CAST(amount1 AS DOUBLE) ) AS amount1 + from {{source('aerodrome_base','CLPool_evt_CollectFees')}} s + left join {{source('aerodrome_base','CLFactory_evt_PoolCreated')}} cr on s.contract_address = cr.pool + + {% if not is_incremental() %} + WHERE DATE_TRUNC('day', s.evt_block_time) >= DATE '{{ project_start_date }}' + {% else %} + WHERE {{ incremental_predicate('s.evt_block_time') }} + {% endif %} + and s.contract_address in (select address from pools) + group by 1,2,3,4 + ) + + , daily_delta_balance AS ( + +select time, pool, token0, token1, sum(amount0) as amount0, sum(amount1) as amount1 +from ( +select time, pool,token0, token1, amount0, amount1 +from mint_events + +union all + +select time, pool,token0, token1, amount0, amount1 +from swap_events + +union all + +select time, pool,token0, token1, amount0, amount1 +from collect_events + +union all + +select time, pool,token0, token1, amount0, amount1 +from fee_events +) group by 1,2,3,4 +) + +, daily_delta_balance_with_lead AS ( +select time, pool, token0, token1, amount0, amount1, +lead(time, 1, now()) over (partition by pool order by time) as next_time +from daily_delta_balance +) + + +, pool_liquidity as ( +SELECT b.time, + b.pool, + token0, + token1, + SUM(amount0) AS amount0, + SUM(amount1) AS amount1 +FROM daily_delta_balance_with_lead b +GROUP BY 1,2,3,4 +) + +, swap_events_hourly as ( + select DATE_TRUNC('hour', s.evt_block_time) AS time, + s.contract_address AS pool, + sum(case when cr.token0 = 0xc1CBa3fCea344f92D9239c08C0568f6F2F0ee452 then abs(CAST(amount0 AS DOUBLE)) + else abs(CAST(amount1 AS DOUBLE)) end) as wsteth_amount + from {{source('aerodrome_base', 'CLPool_evt_Swap')}} s + left join {{source('aerodrome_base','CLFactory_evt_PoolCreated')}} cr on s.contract_address = cr.pool + + {% if not is_incremental() %} + WHERE DATE_TRUNC('day', s.evt_block_time) >= DATE '{{ project_start_date }}' + {% else %} + WHERE {{ incremental_predicate('s.evt_block_time') }} + {% endif %} + + and s.contract_address in (select address from pools) +group by 1,2 +) + +, trading_volume_hourly AS ( + SELECT + s.time, + pool, + wsteth_amount, + p.price, + COALESCE((p.price * wsteth_amount) / CAST(POWER(10, 18) AS DOUBLE), 0) AS volume + FROM + swap_events_hourly AS s + LEFT JOIN wsteth_prices_hourly_with_lead AS p ON s.time >= p.time + AND s.time < p.next_time + ) + +, trading_volume AS ( + SELECT DISTINCT + DATE_TRUNC('day', time) AS time, + pool, + SUM(volume) AS volume + FROM trading_volume_hourly + GROUP BY 1, 2 + ) + +, all_metrics AS ( + SELECT + l.pool, + pools.blockchain, + pools.project, + f.fee, + pools.pool_type, + cast(l.time as date) as time, + CASE WHEN l.token0 = 0xc1CBa3fCea344f92D9239c08C0568f6F2F0ee452 THEN l.token0 ELSE l.token1 END AS main_token, + CASE WHEN l.token0 = 0xc1CBa3fCea344f92D9239c08C0568f6F2F0ee452 THEN p0.symbol ELSE p1.symbol END AS main_token_symbol, + CASE WHEN l.token0 = 0xc1CBa3fCea344f92D9239c08C0568f6F2F0ee452 THEN l.token1 ELSE l.token0 END AS paired_token, + CASE WHEN l.token0 = 0xc1CBa3fCea344f92D9239c08C0568f6F2F0ee452 THEN p1.symbol ELSE p0.symbol END AS paired_token_symbol, + CASE WHEN l.token0 = 0xc1CBa3fCea344f92D9239c08C0568f6F2F0ee452 THEN amount0/CAST(POWER(10,p0.decimals) as double) ELSE amount1/CAST(POWER(10,p1.decimals) as double) END AS main_token_reserve, + CASE WHEN l.token0 = 0xc1CBa3fCea344f92D9239c08C0568f6F2F0ee452 THEN amount1/CAST(POWER(10, p1.decimals) as double) ELSE amount0/CAST(POWER(10, p0.decimals) as double) END AS paired_token_reserve, + CASE WHEN l.token0 = 0xc1CBa3fCea344f92D9239c08C0568f6F2F0ee452 THEN p0.price ELSE p1.price END AS main_token_usd_price, + CASE WHEN l.token0 = 0xc1CBa3fCea344f92D9239c08C0568f6F2F0ee452 THEN p1.price ELSE p0.price END AS paired_token_usd_price, + coalesce(volume,0) AS trading_volume + FROM + pool_liquidity AS l + LEFT JOIN pools ON l.pool = pools.address + LEFT JOIN pool_fee f on l.pool = f.pool + LEFT JOIN tokens AS t0 ON l.token0 = t0.token + LEFT JOIN tokens AS t1 ON l.token1 = t1.token + LEFT JOIN tokens_prices_daily AS p0 ON l.time = p0.time + AND l.token0 = p0.token + LEFT JOIN tokens_prices_daily AS p1 ON l.time = p1.time + AND l.token1 = p1.token + LEFT JOIN trading_volume AS tv ON l.time = tv.time + AND l.pool = tv.pool + ) + + +select --CONCAT(CONCAT(CONCAT(CONCAT(CONCAT(blockchain,CONCAT(' ', project)) ,' '), coalesce(paired_token_symbol,'unknown')),':') , main_token_symbol, ' ', pool_type, ' ', format('%,.3f',round(coalesce(fee,0),4))) as pool_name, + blockchain||' '||project||' '||coalesce(paired_token_symbol,'unknown')||':'||main_token_symbol||' '||pool_type||' '||format('%,.3f',round(coalesce(fee,0),4)) as pool_name, + pool, + blockchain, + project, + fee, + time, + main_token, + main_token_symbol, + paired_token, + paired_token_symbol, + main_token_reserve, + paired_token_reserve, + main_token_usd_price, + paired_token_usd_price, + trading_volume +from all_metrics \ No newline at end of file diff --git a/models/lido/liquidity/base/lido_liquidity_base_uniswap_v3_pools.sql b/models/lido/liquidity/base/lido_liquidity_base_uniswap_v3_pools.sql index ff2bddb6449..3bb20d397c4 100644 --- a/models/lido/liquidity/base/lido_liquidity_base_uniswap_v3_pools.sql +++ b/models/lido/liquidity/base/lido_liquidity_base_uniswap_v3_pools.sql @@ -6,10 +6,10 @@ file_format = 'delta', incremental_strategy = 'merge', unique_key = ['pool', 'time'], - post_hook='{{ expose_spells(\'["optimism"]\', - "project", - "lido_liquidity", - \'["ppclunghe"]\') }}' + post_hook='{{ expose_spells(blockchains = \'["base"]\', + spell_type = "project", + spell_name = "lido_liquidity", + contributors = \'["pipistrella"]\') }}' ) }} @@ -63,7 +63,7 @@ with {% if not is_incremental() %} WHERE DATE_TRUNC('day', p.minute) >= DATE '{{ project_start_date }}' {% else %} - WHERE DATE_TRUNC('day', p.minute) >= DATE_TRUNC('day', NOW() - INTERVAL '1' day) + WHERE {{ incremental_predicate('p.minute') }} {% endif %} AND DATE_TRUNC('day', minute) < current_date AND blockchain = 'base' @@ -111,7 +111,7 @@ with {% if not is_incremental() %} WHERE DATE_TRUNC('day', p.minute) >= DATE '{{ project_start_date }}' {% else %} - WHERE DATE_TRUNC('day', p.minute) >= DATE_TRUNC('day', NOW() - INTERVAL '1' day) + WHERE {{ incremental_predicate('p.minute') }} {% endif %} AND blockchain = 'base' AND contract_address IN (SELECT address FROM tokens) @@ -133,7 +133,7 @@ with {% if not is_incremental() %} WHERE DATE_TRUNC('day', sw.evt_block_time) >= DATE '{{ project_start_date }}' {% else %} - WHERE DATE_TRUNC('day', sw.evt_block_time) >= DATE_TRUNC('day', NOW() - INTERVAL '1' day) + WHERE {{ incremental_predicate('sw.evt_block_time') }} {% endif %} and sw.contract_address IN ( SELECT @@ -162,7 +162,7 @@ with {% if not is_incremental() %} WHERE DATE_TRUNC('day', mt.evt_block_time) >= DATE '{{ project_start_date }}' {% else %} - WHERE DATE_TRUNC('day', mt.evt_block_time) >= DATE_TRUNC('day', NOW() - INTERVAL '1' day) + WHERE {{ incremental_predicate('mt.evt_block_time') }} {% endif %} and mt.contract_address IN ( SELECT @@ -193,7 +193,7 @@ with {% if not is_incremental() %} WHERE DATE_TRUNC('day', bn.evt_block_time) >= DATE '{{ project_start_date }}' {% else %} - WHERE DATE_TRUNC('day', bn.evt_block_time) >= DATE_TRUNC('day', NOW() - INTERVAL '1' day) + WHERE {{ incremental_predicate('bn.evt_block_time') }} {% endif %} and bn.contract_address IN ( SELECT @@ -223,7 +223,7 @@ with {% if not is_incremental() %} WHERE DATE_TRUNC('day', bn.evt_block_time) >= DATE '{{ project_start_date }}' {% else %} - WHERE DATE_TRUNC('day', bn.evt_block_time) >= DATE_TRUNC('day', NOW() - INTERVAL '1' day) + WHERE {{ incremental_predicate('bn.evt_block_time') }} {% endif %} and bn.contract_address IN ( SELECT @@ -320,7 +320,7 @@ with {% if not is_incremental() %} WHERE DATE_TRUNC('day', sw.evt_block_time) >= DATE '{{ project_start_date }}' {% else %} - WHERE DATE_TRUNC('day', sw.evt_block_time) >= DATE_TRUNC('day', NOW() - INTERVAL '1' day) + WHERE {{ incremental_predicate('sw.evt_block_time') }} {% endif %} GROUP BY 1, 2, 3, 4 @@ -389,36 +389,7 @@ with LEFT JOIN trading_volume AS tv ON l.time = tv.time AND l.pool = tv.pool ) SELECT - CONCAT( - CAST( - CONCAT( - CAST( - CONCAT( - CAST( - CONCAT( - CAST( - CONCAT( - CAST(blockchain AS VARCHAR), - CAST( - CONCAT(CAST(' ' AS VARCHAR), CAST(project AS VARCHAR)) AS VARCHAR - ) - ) AS VARCHAR - ), - CAST(' ' AS VARCHAR) - ) AS VARCHAR - ), - CAST( - COALESCE(paired_token_symbol, 'unknown') AS VARCHAR - ) - ) AS VARCHAR - ), - CAST(':' AS VARCHAR) - ) AS VARCHAR - ), - CAST(main_token_symbol AS VARCHAR), - CAST(' ' AS VARCHAR), - format('%,.3f',round(coalesce(fee,0),4)) - ) AS pool_name, + blockchain||' '||project||' '||COALESCE(paired_token_symbol, 'unknown')||':'||main_token_symbol||' '||format('%,.3f',round(coalesce(fee,0),4)) AS pool_name, * FROM all_metrics \ No newline at end of file diff --git a/models/lido/liquidity/optimism/lido_liquidity_optimism_velodrome_cl_pools.sql b/models/lido/liquidity/optimism/lido_liquidity_optimism_velodrome_cl_pools.sql new file mode 100644 index 00000000000..c1b4c093d87 --- /dev/null +++ b/models/lido/liquidity/optimism/lido_liquidity_optimism_velodrome_cl_pools.sql @@ -0,0 +1,319 @@ +{{ config( + schema='lido_liquidity_optimism', + alias = 'velodrome_cl', + materialized = 'incremental', + file_format = 'delta', + incremental_strategy = 'merge', + unique_key = ['pool', 'time'], + post_hook='{{ expose_spells(blockchains = \'["optimism"]\', + spell_type = "project", + spell_name = "lido_liquidity", + contributors = \'["pipistrella"]\') }}' + ) +}} + +{% set project_start_date = '2024-03-06' %} +with pools as ( +select pool AS address, + 'optimism' AS blockchain, + 'velodrome' AS project, + 'CL' AS pool_type, * +from {{source('velodrome_v2_optimism', 'CLFactory_evt_PoolCreated')}} +where (token0 = 0x1F32b1c2345538c0c6f582fCB022739c4A194Ebb + OR token1 = 0x1F32b1c2345538c0c6f582fCB022739c4A194Ebb) +) + + , pool_fee as ( +select pool, max(cast(f1.output_0 as double)/10000) as fee +from {{source('velodrome_v2_optimism','CLFactory_call_getSwapFee')}} f1 +where f1.call_block_time = (select max(f2.call_block_time) + from {{source('velodrome_v2_optimism','CLFactory_call_getSwapFee')}} f2 where f2.pool = f1.pool) +and f1. pool in (select address from pools) +group by 1 +) + +, tokens as ( + select distinct token + from ( + select token0 as token + from {{source('velodrome_v2_optimism','CLFactory_evt_PoolCreated')}} + where token1 = 0x1F32b1c2345538c0c6f582fCB022739c4A194Ebb + union all + select token1 + from {{source('velodrome_v2_optimism','CLFactory_evt_PoolCreated')}} + where token0 = 0x1F32b1c2345538c0c6f582fCB022739c4A194Ebb + union all + select 0x1F32b1c2345538c0c6f582fCB022739c4A194Ebb + ) t + ) + +, tokens_prices_daily as ( +select distinct + DATE_TRUNC('day', minute) AS time, + contract_address AS token, + symbol, + decimals, + AVG(price) AS price +FROM {{source('prices','usd')}} p +{% if not is_incremental() %} +WHERE DATE_TRUNC('day', p.minute) >= DATE '{{ project_start_date }}' +{% else %} +WHERE {{ incremental_predicate('p.minute') }} +{% endif %} + + and date_trunc('day', minute) < current_date + and blockchain = 'optimism' + and contract_address IN (select token from tokens) +group by 1,2,3,4 + +union all + +select distinct + DATE_TRUNC('day', minute), + contract_address AS token, + symbol, + decimals, + LAST_VALUE(price) OVER (PARTITION BY DATE_TRUNC('day', minute),contract_address ORDER BY minute NULLS FIRST range BETWEEN UNBOUNDED preceding AND UNBOUNDED following) AS price + FROM + {{source('prices','usd')}} + WHERE + DATE_TRUNC('day', minute) = current_date + and blockchain = 'optimism' + and contract_address IN (select token from tokens) + ) + + , wsteth_prices_hourly AS ( + SELECT distinct + DATE_TRUNC('hour', minute) time, + contract_address as token, + symbol, + decimals, + last_value(price) over (partition by DATE_TRUNC('hour', minute), contract_address ORDER BY minute range between unbounded preceding AND unbounded following) AS price + FROM {{source('prices','usd')}} p + {% if not is_incremental() %} + WHERE DATE_TRUNC('day', p.minute) >= DATE '{{ project_start_date }}' + {% else %} + WHERE {{ incremental_predicate('p.minute') }} + {% endif %} + and blockchain = 'optimism' and contract_address = 0x1F32b1c2345538c0c6f582fCB022739c4A194Ebb + +) + +, wsteth_prices_hourly_with_lead AS ( +select time, + lead(time, 1, date_trunc('hour', now() + interval '1' hour)) over (order by time) as next_time, + price +from wsteth_prices_hourly +) + +, mint_events AS ( + select DATE_TRUNC('day', m.evt_block_time) AS time, + m.contract_address AS pool, + cr.token0, + cr.token1, + SUM(CAST(amount0 AS DOUBLE)) AS amount0, + SUM(CAST(amount1 AS DOUBLE)) AS amount1 + from {{source('velodrome_v2_optimism','CLPool_evt_Mint')}} m + left join {{source('velodrome_v2_optimism','CLFactory_evt_PoolCreated')}} cr on m.contract_address = cr.pool + + {% if not is_incremental() %} + WHERE DATE_TRUNC('day', m.evt_block_time) >= DATE '{{ project_start_date }}' + {% else %} + WHERE {{ incremental_predicate('m.evt_block_time') }} + {% endif %} + + and m.contract_address in (select address from pools) + group by 1,2,3,4 + ) + + , collect_events as ( + select DATE_TRUNC('day', b.evt_block_time) AS time, + b.contract_address AS pool, + cr.token0, + cr.token1, + (-1)*SUM(CAST(amount0 AS DOUBLE)) AS amount0, + (-1)*SUM(CAST(amount1 AS DOUBLE)) AS amount1 + from {{source('velodrome_v2_optimism','CLPool_evt_Collect')}} b + left join {{source('velodrome_v2_optimism','CLFactory_evt_PoolCreated')}} cr on b.contract_address = cr.pool + + {% if not is_incremental() %} + WHERE DATE_TRUNC('day', b.evt_block_time) >= DATE '{{ project_start_date }}' + {% else %} + WHERE {{ incremental_predicate('b.evt_block_time') }} + {% endif %} + + and b.contract_address in (select address from pools) + group by 1,2,3,4 + + ) + +, swap_events as ( + select DATE_TRUNC('day', s.evt_block_time) AS time, + s.contract_address AS pool, + cr.token0, + cr.token1, + SUM(CAST(amount0 AS DOUBLE)) AS amount0, + SUM(CAST(amount1 AS DOUBLE)) AS amount1 + from {{source('velodrome_v2_optimism','CLPool_evt_Swap')}} s + left join {{source('velodrome_v2_optimism','CLFactory_evt_PoolCreated')}} cr on s.contract_address = cr.pool + + {% if not is_incremental() %} + WHERE DATE_TRUNC('day', s.evt_block_time) >= DATE '{{ project_start_date }}' + {% else %} + WHERE {{ incremental_predicate('s.evt_block_time') }} + {% endif %} + + and s.contract_address in (select address from pools) + group by 1,2,3,4 + +) +, fee_events as ( +select + DATE_TRUNC('day', s.evt_block_time) AS time, + s.contract_address AS pool, + cr.token0, + cr.token1, + (-1)*SUM(CAST(amount0 AS DOUBLE) ) AS amount0, + (-1)*SUM(CAST(amount1 AS DOUBLE) ) AS amount1 + from {{source('velodrome_v2_optimism','CLPool_evt_CollectFees')}} s + left join {{source('velodrome_v2_optimism','CLFactory_evt_PoolCreated')}} cr on s.contract_address = cr.pool + + {% if not is_incremental() %} + WHERE DATE_TRUNC('day', s.evt_block_time) >= DATE '{{ project_start_date }}' + {% else %} + WHERE {{ incremental_predicate('s.evt_block_time') }} + {% endif %} + and s.contract_address in (select address from pools) + group by 1,2,3,4 + ) + + , daily_delta_balance AS ( + +select time, pool, token0, token1, sum(amount0) as amount0, sum(amount1) as amount1 +from ( +select time, pool,token0, token1, amount0, amount1 +from mint_events + +union all + +select time, pool,token0, token1, amount0, amount1 +from swap_events + +union all + +select time, pool,token0, token1, amount0, amount1 +from collect_events + +union all + +select time, pool,token0, token1, amount0, amount1 +from fee_events +) group by 1,2,3,4 +) + +, daily_delta_balance_with_lead AS ( +select time, pool, token0, token1, amount0, amount1, +lead(time, 1, now()) over (partition by pool order by time) as next_time +from daily_delta_balance +) + + +, pool_liquidity as ( +SELECT b.time, + b.pool, + token0, + token1, + SUM(amount0) AS amount0, + SUM(amount1) AS amount1 +FROM daily_delta_balance_with_lead b +GROUP BY 1,2,3,4 +) + +, swap_events_hourly as ( + select DATE_TRUNC('hour', s.evt_block_time) AS time, + s.contract_address AS pool, + sum(case when cr.token0 = 0x1F32b1c2345538c0c6f582fCB022739c4A194Ebb then abs(CAST(amount0 AS DOUBLE)) + else abs(CAST(amount1 AS DOUBLE)) end) as wsteth_amount + from {{source('velodrome_v2_optimism', 'CLPool_evt_Swap')}} s + left join {{source('velodrome_v2_optimism','CLFactory_evt_PoolCreated')}} cr on s.contract_address = cr.pool + + {% if not is_incremental() %} + WHERE DATE_TRUNC('day', s.evt_block_time) >= DATE '{{ project_start_date }}' + {% else %} + WHERE {{ incremental_predicate('s.evt_block_time') }} + {% endif %} + + and s.contract_address in (select address from pools) +group by 1,2 +) + +, trading_volume_hourly AS ( + SELECT + s.time, + pool, + wsteth_amount, + p.price, + COALESCE((p.price * wsteth_amount) / CAST(POWER(10, 18) AS DOUBLE), 0) AS volume + FROM + swap_events_hourly AS s + LEFT JOIN wsteth_prices_hourly_with_lead AS p ON s.time >= p.time + AND s.time < p.next_time + ) + +, trading_volume AS ( + SELECT DISTINCT + DATE_TRUNC('day', time) AS time, + pool, + SUM(volume) AS volume + FROM trading_volume_hourly + GROUP BY 1, 2 + ) + +, all_metrics AS ( + SELECT + l.pool, + pools.blockchain, + pools.project, + f.fee, + pools.pool_type, + cast(l.time as date) as time, + CASE WHEN l.token0 = 0x1F32b1c2345538c0c6f582fCB022739c4A194Ebb THEN l.token0 ELSE l.token1 END AS main_token, + CASE WHEN l.token0 = 0x1F32b1c2345538c0c6f582fCB022739c4A194Ebb THEN p0.symbol ELSE p1.symbol END AS main_token_symbol, + CASE WHEN l.token0 = 0x1F32b1c2345538c0c6f582fCB022739c4A194Ebb THEN l.token1 ELSE l.token0 END AS paired_token, + CASE WHEN l.token0 = 0x1F32b1c2345538c0c6f582fCB022739c4A194Ebb THEN p1.symbol ELSE p0.symbol END AS paired_token_symbol, + CASE WHEN l.token0 = 0x1F32b1c2345538c0c6f582fCB022739c4A194Ebb THEN amount0/CAST(POWER(10,p0.decimals) as double) ELSE amount1/CAST(POWER(10,p1.decimals) as double) END AS main_token_reserve, + CASE WHEN l.token0 = 0x1F32b1c2345538c0c6f582fCB022739c4A194Ebb THEN amount1/CAST(POWER(10, p1.decimals) as double) ELSE amount0/CAST(POWER(10, p0.decimals) as double) END AS paired_token_reserve, + CASE WHEN l.token0 = 0x1F32b1c2345538c0c6f582fCB022739c4A194Ebb THEN p0.price ELSE p1.price END AS main_token_usd_price, + CASE WHEN l.token0 = 0x1F32b1c2345538c0c6f582fCB022739c4A194Ebb THEN p1.price ELSE p0.price END AS paired_token_usd_price, + coalesce(volume,0) AS trading_volume + FROM + pool_liquidity AS l + LEFT JOIN pools ON l.pool = pools.address + LEFT JOIN pool_fee f on l.pool = f.pool + LEFT JOIN tokens AS t0 ON l.token0 = t0.token + LEFT JOIN tokens AS t1 ON l.token1 = t1.token + LEFT JOIN tokens_prices_daily AS p0 ON l.time = p0.time + AND l.token0 = p0.token + LEFT JOIN tokens_prices_daily AS p1 ON l.time = p1.time + AND l.token1 = p1.token + LEFT JOIN trading_volume AS tv ON l.time = tv.time + AND l.pool = tv.pool + ) + + +select blockchain||' '||project||' '||coalesce(paired_token_symbol,'unknown')||':'||main_token_symbol||' '||pool_type||' '||format('%,.3f',round(coalesce(fee,0),4)) as pool_name, + pool, + blockchain, + project, + fee, + time, + main_token, + main_token_symbol, + paired_token, + paired_token_symbol, + main_token_reserve, + paired_token_reserve, + main_token_usd_price, + paired_token_usd_price, + trading_volume +from all_metrics \ No newline at end of file diff --git a/models/lido/liquidity/scroll/lido_liquidity_scroll_schema.yml b/models/lido/liquidity/scroll/lido_liquidity_scroll_schema.yml new file mode 100644 index 00000000000..0432acccca3 --- /dev/null +++ b/models/lido/liquidity/scroll/lido_liquidity_scroll_schema.yml @@ -0,0 +1,64 @@ +version: 2 + +models: + - name: lido_liquidity_scroll_syncswap_pools + meta: + blockchain: scroll + project: lido + contributors: pipistrella + config: + tags: ['zksync','lido','liquidity'] + description: + Lido wstETH liquidity pools on SyncSwap Scroll + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - pool + - blockchain + - time + columns: + - &pool_name + name: pool_name + description: "Liquidity pool's name consisting of the its blockchain, DEX project, symbols of tokens and fee value" + - &pool + name: pool + description: "Liquidity pool's address" + - &blockchain + name: blockchain + description: "Blockchain which the DEX is deployed" + - &project + name: project + description: "Project name of the DEX" + - &fee + name: fee + description: "Liquidity pool's trading fee" + - &time + name: time + description: "UTC event block date truncated to the day mark" + - &main_token + name: main_token + description: "Main token's address" + - &main_token_symbol + name: main_token_symbol + description: "Token symbol for main pool's token" + - &paired_token + name: paired_token + description: "Paired token's address" + - &paired_token_symbol + name: paired_token_symbol + description: "Token symbol for paired pool's token" + - &main_token_reserve + name: main_token_reserve + description: "Liquidity reserve of the main token in the pool" + - &paired_token_reserve + name: paired_token_reserve + description: "Liquidity reserve of the paired token in the pool" + - &main_token_usd_price + name: main_token_usd_price + description: "Price of the main token in the pool in USD" + - &paired_token_usd_price + name: paired_token_usd_price + description: "Price of the paired token in the pool in USD" + - &trading_volume + name: trading_volume + description: "USD value of the trade" \ No newline at end of file diff --git a/models/lido/liquidity/scroll/lido_liquidity_scroll_syncswap_pools.sql b/models/lido/liquidity/scroll/lido_liquidity_scroll_syncswap_pools.sql new file mode 100644 index 00000000000..33a6f7d992e --- /dev/null +++ b/models/lido/liquidity/scroll/lido_liquidity_scroll_syncswap_pools.sql @@ -0,0 +1,285 @@ +{{ config( + schema='lido_liquidity_scroll', + alias = 'syncswap_pools', + materialized = 'incremental', + file_format = 'delta', + incremental_strategy = 'merge', + unique_key = ['pool', 'time'], + post_hook='{{ expose_spells(blockchains = \'["scroll"]\', + spell_type = "project", + spell_name = "lido_liquidity", + contributors = \'["pipistrella"]\') }}' + ) +}} + +{% set project_start_date = '2023-10-15' %} + +with pools as ( +select pool AS address, + 'scroll' AS blockchain, + 'syncswap' AS project, + * +from {{source('syncswap_scroll','SyncSwapClassicPoolFactory_evt_PoolCreated')}} +where (token0 = 0xf610A9dfB7C89644979b4A0f27063E9e7d7Cda32 + OR token1 = 0xf610A9dfB7C89644979b4A0f27063E9e7d7Cda32) +) + +, tokens as ( + select distinct token + from ( + select token0 as token + from {{source('syncswap_scroll','SyncSwapClassicPoolFactory_evt_PoolCreated')}} + where token1 = 0xf610A9dfB7C89644979b4A0f27063E9e7d7Cda32 + union all + select token1 + from {{source('syncswap_scroll','SyncSwapClassicPoolFactory_evt_PoolCreated')}} + where token0 = 0xf610A9dfB7C89644979b4A0f27063E9e7d7Cda32 + union all + select 0xf610A9dfB7C89644979b4A0f27063E9e7d7Cda32 + ) t + ) + + , tokens_prices_daily as ( +select distinct + DATE_TRUNC('day', minute) AS time, + contract_address AS token, + symbol, + decimals, + AVG(price) AS price +FROM {{source('prices','usd')}} p +{% if not is_incremental() %} +WHERE DATE_TRUNC('day', p.minute) >= DATE '{{ project_start_date }}' +{% else %} +WHERE {{ incremental_predicate('p.minute') }} +{% endif %} + +and date_trunc('day', minute) < current_date +and blockchain = 'scroll' +and contract_address IN (select token from tokens) +group by 1,2,3,4 +union all +select distinct + DATE_TRUNC('day', minute), + contract_address AS token, + symbol, + decimals, + LAST_VALUE(price) OVER (PARTITION BY DATE_TRUNC('day', minute),contract_address ORDER BY minute NULLS FIRST range BETWEEN UNBOUNDED preceding AND UNBOUNDED following) AS price + FROM + {{source('prices','usd')}} + WHERE + DATE_TRUNC('day', minute) = current_date + and blockchain = 'scroll' + and contract_address IN (select token from tokens) + ) + + , wsteth_prices_hourly AS ( + SELECT distinct + DATE_TRUNC('hour', minute) time, + contract_address as token, + symbol, + decimals, + last_value(price) over (partition by DATE_TRUNC('hour', minute), contract_address ORDER BY minute range between unbounded preceding AND unbounded following) AS price + FROM {{ source('prices', 'usd') }} p + {% if not is_incremental() %} + WHERE DATE_TRUNC('day', p.minute) >= DATE '{{ project_start_date }}' + {% else %} + WHERE {{ incremental_predicate('p.minute') }} + {% endif %} + and blockchain = 'scroll' and contract_address = 0xf610A9dfB7C89644979b4A0f27063E9e7d7Cda32 + +) + +, wsteth_prices_hourly_with_lead AS ( +select time, + lead(time, 1, date_trunc('hour', now() + interval '1' hour)) over (order by time) as next_time, + price +from wsteth_prices_hourly +) + +, mint_events AS ( + select DATE_TRUNC('day', m.evt_block_time) AS time, + m.contract_address AS pool, + cr.token0, + cr.token1, + SUM(CAST(amount0 AS DOUBLE)) AS amount0, + SUM(CAST(amount1 AS DOUBLE)) AS amount1 + from {{source('syncswap_scroll','SyncSwapClassicPool_evt_Mint')}} m + left join {{source('syncswap_scroll','SyncSwapClassicPoolFactory_evt_PoolCreated')}} cr on m.contract_address = cr.pool + + {% if not is_incremental() %} + WHERE DATE_TRUNC('day', m.evt_block_time) >= DATE '{{ project_start_date }}' + {% else %} + WHERE {{ incremental_predicate('m.evt_block_time') }} + {% endif %} + + and m.contract_address in (select address from pools) + group by 1,2,3,4 + ) + + , burn_events as ( + select DATE_TRUNC('day', b.evt_block_time) AS time, + b.contract_address AS pool, + cr.token0, + cr.token1, + (-1)*SUM(CAST(amount0 AS DOUBLE)) AS amount0, + (-1)*SUM(CAST(amount1 AS DOUBLE)) AS amount1 + from {{source('syncswap_scroll','SyncSwapClassicPool_evt_Burn')}} b + left join {{source('syncswap_scroll','SyncSwapClassicPoolFactory_evt_PoolCreated')}} cr on b.contract_address = cr.pool + + {% if not is_incremental() %} + WHERE DATE_TRUNC('day', b.evt_block_time) >= DATE '{{ project_start_date }}' + {% else %} + WHERE {{ incremental_predicate('b.evt_block_time') }} + {% endif %} + + and b.contract_address in (select address from pools) + group by 1,2,3,4 + + ) + +, swap_events as ( + select DATE_TRUNC('day', s.evt_block_time) AS time, + s.contract_address AS pool, + cr.token0, + cr.token1, + SUM(CAST(amount0In AS DOUBLE) - CAST(amount0Out AS DOUBLE)) AS amount0, + SUM(CAST(amount1In AS DOUBLE) - CAST(amount1Out AS DOUBLE)) AS amount1 + from {{source('syncswap_scroll','SyncSwapClassicPool_evt_Swap')}} s + left join {{source('syncswap_scroll','SyncSwapClassicPoolFactory_evt_PoolCreated')}} cr on s.contract_address = cr.pool + + {% if not is_incremental() %} + WHERE DATE_TRUNC('day', s.evt_block_time) >= DATE '{{ project_start_date }}' + {% else %} + WHERE {{ incremental_predicate('s.evt_block_time') }} + {% endif %} + + and s.contract_address in (select address from pools) + group by 1,2,3,4 + +) + + , daily_delta_balance AS ( + +select time, pool, token0, token1, sum(amount0) as amount0, sum(amount1) as amount1 +from ( +select time, pool,token0, token1, amount0, amount1 +from mint_events + +union all + +select time, pool,token0, token1, amount0, amount1 +from swap_events + +union all + +select time, pool,token0, token1, amount0, amount1 +from burn_events + +) group by 1,2,3,4 +) + +, daily_delta_balance_with_lead AS ( +select time, pool, token0, token1, amount0, amount1, +lead(time, 1, now()) over (partition by pool order by time) as next_time +from daily_delta_balance +) + + +, pool_liquidity as ( +SELECT b.time, + b.pool, + token0, + token1, + SUM(amount0) AS amount0, + SUM(amount1) AS amount1 +FROM daily_delta_balance_with_lead b +GROUP BY 1,2,3,4 +) + +, swap_events_hourly as ( + select DATE_TRUNC('hour', s.evt_block_time) AS time, + s.contract_address AS pool, + sum(case when cr.token0 = 0xf610A9dfB7C89644979b4A0f27063E9e7d7Cda32 then CAST(amount0In AS DOUBLE) + CAST(amount0Out AS DOUBLE) + else CAST(amount1In AS DOUBLE) + CAST(amount1Out AS DOUBLE) end) as wsteth_amount + from {{source('syncswap_scroll','SyncSwapClassicPool_evt_Swap')}} s + left join {{source('syncswap_scroll','SyncSwapClassicPoolFactory_evt_PoolCreated')}} cr on s.contract_address = cr.pool + + {% if not is_incremental() %} + WHERE DATE_TRUNC('day', s.evt_block_time) >= DATE '{{ project_start_date }}' + {% else %} + WHERE {{ incremental_predicate('s.evt_block_time') }} + {% endif %} + + and s.contract_address in (select address from pools) +group by 1,2 +) + +, trading_volume_hourly AS ( + SELECT + s.time, + pool, + wsteth_amount, + p.price, + COALESCE((p.price * wsteth_amount) / CAST(POWER(10, 18) AS DOUBLE), 0) AS volume + FROM + swap_events_hourly AS s + LEFT JOIN wsteth_prices_hourly_with_lead AS p ON s.time >= p.time + AND s.time < p.next_time + ) + +, trading_volume AS ( + SELECT DISTINCT + DATE_TRUNC('day', time) AS time, + pool, + SUM(volume) AS volume + FROM trading_volume_hourly + GROUP BY 1, 2 + ) + +, all_metrics AS ( + SELECT + l.pool, + pools.blockchain, + pools.project, + 0.0 as fee, + '' as pool_type, + cast(l.time as date) as time, + CASE WHEN l.token0 = 0xf610A9dfB7C89644979b4A0f27063E9e7d7Cda32 THEN l.token0 ELSE l.token1 END AS main_token, + CASE WHEN l.token0 = 0xf610A9dfB7C89644979b4A0f27063E9e7d7Cda32 THEN p0.symbol ELSE p1.symbol END AS main_token_symbol, + CASE WHEN l.token0 = 0xf610A9dfB7C89644979b4A0f27063E9e7d7Cda32 THEN l.token1 ELSE l.token0 END AS paired_token, + CASE WHEN l.token0 = 0xf610A9dfB7C89644979b4A0f27063E9e7d7Cda32 THEN p1.symbol ELSE p0.symbol END AS paired_token_symbol, + CASE WHEN l.token0 = 0xf610A9dfB7C89644979b4A0f27063E9e7d7Cda32 THEN amount0/CAST(POWER(10,p0.decimals) as double) ELSE amount1/CAST(POWER(10,p1.decimals) as double) END AS main_token_reserve, + CASE WHEN l.token0 = 0xf610A9dfB7C89644979b4A0f27063E9e7d7Cda32 THEN amount1/CAST(POWER(10, p1.decimals) as double) ELSE amount0/CAST(POWER(10, p0.decimals) as double) END AS paired_token_reserve, + CASE WHEN l.token0 = 0xf610A9dfB7C89644979b4A0f27063E9e7d7Cda32 THEN p0.price ELSE p1.price END AS main_token_usd_price, + CASE WHEN l.token0 = 0xf610A9dfB7C89644979b4A0f27063E9e7d7Cda32 THEN p1.price ELSE p0.price END AS paired_token_usd_price, + coalesce(volume,0) AS trading_volume + FROM + pool_liquidity AS l + LEFT JOIN pools ON l.pool = pools.address + LEFT JOIN tokens AS t0 ON l.token0 = t0.token + LEFT JOIN tokens AS t1 ON l.token1 = t1.token + LEFT JOIN tokens_prices_daily AS p0 ON l.time = p0.time + AND l.token0 = p0.token + LEFT JOIN tokens_prices_daily AS p1 ON l.time = p1.time + AND l.token1 = p1.token + LEFT JOIN trading_volume AS tv ON l.time = tv.time + AND l.pool = tv.pool + ) + + +select blockchain||' '||project||' '||coalesce(paired_token_symbol,'unknown')||':'||main_token_symbol||' '||pool_type||' '||format('%,.3f',round(coalesce(fee,0),4)) as pool_name, + pool, + blockchain, + project, + fee, + time, + main_token, + main_token_symbol, + paired_token, + paired_token_symbol, + main_token_reserve, + paired_token_reserve, + main_token_usd_price, + paired_token_usd_price, + trading_volume +from all_metrics \ No newline at end of file diff --git a/models/lido/liquidity/scroll/lido_liquidity_scroll_zebra_pools.sql b/models/lido/liquidity/scroll/lido_liquidity_scroll_zebra_pools.sql new file mode 100644 index 00000000000..d97d696e628 --- /dev/null +++ b/models/lido/liquidity/scroll/lido_liquidity_scroll_zebra_pools.sql @@ -0,0 +1,287 @@ +{{ config( + schema='lido_liquidity_scroll', + alias = 'zebra_pools', + materialized = 'incremental', + file_format = 'delta', + incremental_strategy = 'merge', + unique_key = ['pool', 'time'], + post_hook='{{ expose_spells(blockchains = \'["scroll"]\', + spell_type = "project", + spell_name = "lido_liquidity", + contributors = \'["pipistrella"]\') }}' + ) +}} + +{% set project_start_date = '2023-11-20' %} + +with pools as ( +select pool AS address, + 'scroll' AS blockchain, + 'zebra' AS project, + 'v2' AS pool_type, + * +from {{source('zebra_scroll','ZebraV2Factory_evt_PoolCreated')}} +where (token0 = 0xf610A9dfB7C89644979b4A0f27063E9e7d7Cda32 + OR token1 = 0xf610A9dfB7C89644979b4A0f27063E9e7d7Cda32) +) + +, tokens as ( + select distinct token + from ( + select token0 as token + from {{source('zebra_scroll','ZebraV2Factory_evt_PoolCreated')}} + where token1 = 0xf610A9dfB7C89644979b4A0f27063E9e7d7Cda32 + union all + select token1 + from {{source('zebra_scroll','ZebraV2Factory_evt_PoolCreated')}} + where token0 = 0xf610A9dfB7C89644979b4A0f27063E9e7d7Cda32 + union all + select 0xf610A9dfB7C89644979b4A0f27063E9e7d7Cda32 + ) t + ) + + , tokens_prices_daily as ( +select distinct + DATE_TRUNC('day', minute) AS time, + contract_address AS token, + symbol, + decimals, + AVG(price) AS price +FROM {{source('prices','usd')}} p +{% if not is_incremental() %} +WHERE DATE_TRUNC('day', p.minute) >= DATE '{{ project_start_date }}' +{% else %} +WHERE {{ incremental_predicate('p.minute') }} +{% endif %} + + and date_trunc('day', minute) < current_date + and blockchain = 'scroll' + and contract_address IN (select token from tokens) +group by 1,2,3,4 +union all +select distinct + DATE_TRUNC('day', minute), + contract_address AS token, + symbol, + decimals, + LAST_VALUE(price) OVER (PARTITION BY DATE_TRUNC('day', minute),contract_address ORDER BY minute NULLS FIRST range BETWEEN UNBOUNDED preceding AND UNBOUNDED following) AS price + FROM + {{source('prices','usd')}} + WHERE + DATE_TRUNC('day', minute) = current_date + and blockchain = 'scroll' + and contract_address IN (select token from tokens) + ) + + , wsteth_prices_hourly AS ( + SELECT distinct + DATE_TRUNC('hour', minute) time, + contract_address as token, + symbol, + decimals, + last_value(price) over (partition by DATE_TRUNC('hour', minute), contract_address ORDER BY minute range between unbounded preceding AND unbounded following) AS price + FROM {{ source('prices', 'usd') }} p + {% if not is_incremental() %} + WHERE DATE_TRUNC('day', p.minute) >= DATE '{{ project_start_date }}' + {% else %} + WHERE {{ incremental_predicate('p.minute') }} + {% endif %} + + and blockchain = 'scroll' and contract_address = 0xf610A9dfB7C89644979b4A0f27063E9e7d7Cda32 + +) + +, wsteth_prices_hourly_with_lead AS ( +select time, + lead(time, 1, date_trunc('hour', now() + interval '1' hour)) over (order by time) as next_time, + price +from wsteth_prices_hourly +) + +, mint_events AS ( + select DATE_TRUNC('day', m.evt_block_time) AS time, + m.contract_address AS pool, + cr.token0, + cr.token1, + SUM(CAST(amount0 AS DOUBLE)) AS amount0, + SUM(CAST(amount1 AS DOUBLE)) AS amount1 + from {{source('zebra_scroll','ZebraV2Pool_evt_Mint')}} m + left join {{source('zebra_scroll','ZebraV2Factory_evt_PoolCreated')}} cr on m.contract_address = cr.pool + + {% if not is_incremental() %} + WHERE DATE_TRUNC('day', m.evt_block_time) >= DATE '{{ project_start_date }}' + {% else %} + WHERE {{ incremental_predicate('m.evt_block_time') }} + {% endif %} + + and m.contract_address in (select address from pools) + group by 1,2,3,4 + ) + + , burn_events as ( + select DATE_TRUNC('day', b.evt_block_time) AS time, + b.contract_address AS pool, + cr.token0, + cr.token1, + (-1)*SUM(CAST(amount0 AS DOUBLE)) AS amount0, + (-1)*SUM(CAST(amount1 AS DOUBLE)) AS amount1 + from {{source('zebra_scroll','ZebraV2Pool_evt_Burn')}} b + left join {{source('zebra_scroll','ZebraV2Factory_evt_PoolCreated')}} cr on b.contract_address = cr.pool + + {% if not is_incremental() %} + WHERE DATE_TRUNC('day', b.evt_block_time) >= DATE '{{ project_start_date }}' + {% else %} + WHERE {{ incremental_predicate('b.evt_block_time') }} + {% endif %} + + and b.contract_address in (select address from pools) + group by 1,2,3,4 + + ) + +, swap_events as ( + select DATE_TRUNC('day', s.evt_block_time) AS time, + s.contract_address AS pool, + cr.token0, + cr.token1, + SUM(CAST(amount0 AS DOUBLE)) AS amount0, + SUM(CAST(amount1 AS DOUBLE)) AS amount1 + from {{source('zebra_scroll','ZebraV2Pool_evt_Swap')}} s + left join {{source('zebra_scroll','ZebraV2Factory_evt_PoolCreated')}} cr on s.contract_address = cr.pool + + {% if not is_incremental() %} + WHERE DATE_TRUNC('day', s.evt_block_time) >= DATE '{{ project_start_date }}' + {% else %} + WHERE {{ incremental_predicate('s.evt_block_time') }} + {% endif %} + + and s.contract_address in (select address from pools) + group by 1,2,3,4 + +) + + , daily_delta_balance AS ( + +select time, pool, token0, token1, sum(amount0) as amount0, sum(amount1) as amount1 +from ( +select time, pool,token0, token1, amount0, amount1 +from mint_events + +union all + +select time, pool,token0, token1, amount0, amount1 +from swap_events + +union all + +select time, pool,token0, token1, amount0, amount1 +from burn_events + +) group by 1,2,3,4 +) + +, daily_delta_balance_with_lead AS ( +select time, pool, token0, token1, amount0, amount1, +lead(time, 1, now()) over (partition by pool order by time) as next_time +from daily_delta_balance +) + + +, pool_liquidity as ( +SELECT b.time, + b.pool, + token0, + token1, + SUM(amount0) AS amount0, + SUM(amount1) AS amount1 +FROM daily_delta_balance_with_lead b +GROUP BY 1,2,3,4 +) + +, swap_events_hourly as ( + select DATE_TRUNC('hour', s.evt_block_time) AS time, + s.contract_address AS pool, + sum(case when cr.token0 = 0xf610A9dfB7C89644979b4A0f27063E9e7d7Cda32 then ABS(CAST(amount0 AS DOUBLE)) + else ABS(CAST(amount1 AS DOUBLE)) end) as wsteth_amount + from {{source('zebra_scroll','ZebraV2Pool_evt_Swap')}} s + left join {{source('zebra_scroll','ZebraV2Factory_evt_PoolCreated')}} cr on s.contract_address = cr.pool + + {% if not is_incremental() %} + WHERE DATE_TRUNC('day', s.evt_block_time) >= DATE '{{ project_start_date }}' + {% else %} + WHERE {{ incremental_predicate('s.evt_block_time') }} + {% endif %} + + and s.contract_address in (select address from pools) +group by 1,2 +) + +, trading_volume_hourly AS ( + SELECT + s.time, + pool, + wsteth_amount, + p.price, + COALESCE((p.price * wsteth_amount) / CAST(POWER(10, 18) AS DOUBLE), 0) AS volume + FROM + swap_events_hourly AS s + LEFT JOIN wsteth_prices_hourly_with_lead AS p ON s.time >= p.time + AND s.time < p.next_time + ) + +, trading_volume AS ( + SELECT DISTINCT + DATE_TRUNC('day', time) AS time, + pool, + SUM(volume) AS volume + FROM trading_volume_hourly + GROUP BY 1, 2 + ) + +, all_metrics AS ( + SELECT + l.pool, + pools.blockchain, + pools.project, + 0.0 as fee, + '' as pool_type, + cast(l.time as date) as time, + CASE WHEN l.token0 = 0xf610A9dfB7C89644979b4A0f27063E9e7d7Cda32 THEN l.token0 ELSE l.token1 END AS main_token, + CASE WHEN l.token0 = 0xf610A9dfB7C89644979b4A0f27063E9e7d7Cda32 THEN p0.symbol ELSE p1.symbol END AS main_token_symbol, + CASE WHEN l.token0 = 0xf610A9dfB7C89644979b4A0f27063E9e7d7Cda32 THEN l.token1 ELSE l.token0 END AS paired_token, + CASE WHEN l.token0 = 0xf610A9dfB7C89644979b4A0f27063E9e7d7Cda32 THEN p1.symbol ELSE p0.symbol END AS paired_token_symbol, + CASE WHEN l.token0 = 0xf610A9dfB7C89644979b4A0f27063E9e7d7Cda32 THEN amount0/CAST(POWER(10,p0.decimals) as double) ELSE amount1/CAST(POWER(10,p1.decimals) as double) END AS main_token_reserve, + CASE WHEN l.token0 = 0xf610A9dfB7C89644979b4A0f27063E9e7d7Cda32 THEN amount1/CAST(POWER(10, p1.decimals) as double) ELSE amount0/CAST(POWER(10, p0.decimals) as double) END AS paired_token_reserve, + CASE WHEN l.token0 = 0xf610A9dfB7C89644979b4A0f27063E9e7d7Cda32 THEN p0.price ELSE p1.price END AS main_token_usd_price, + CASE WHEN l.token0 = 0xf610A9dfB7C89644979b4A0f27063E9e7d7Cda32 THEN p1.price ELSE p0.price END AS paired_token_usd_price, + coalesce(volume,0) AS trading_volume + FROM + pool_liquidity AS l + LEFT JOIN pools ON l.pool = pools.address + LEFT JOIN tokens AS t0 ON l.token0 = t0.token + LEFT JOIN tokens AS t1 ON l.token1 = t1.token + LEFT JOIN tokens_prices_daily AS p0 ON l.time = p0.time + AND l.token0 = p0.token + LEFT JOIN tokens_prices_daily AS p1 ON l.time = p1.time + AND l.token1 = p1.token + LEFT JOIN trading_volume AS tv ON l.time = tv.time + AND l.pool = tv.pool + ) + + +select blockchain||' '||project||' '||coalesce(paired_token_symbol,'unknown')||':'||main_token_symbol||' '||pool_type||' '||format('%,.3f',round(coalesce(fee,0),4)) as pool_name, + pool, + blockchain, + project, + fee, + time, + main_token, + main_token_symbol, + paired_token, + paired_token_symbol, + main_token_reserve, + paired_token_reserve, + main_token_usd_price, + paired_token_usd_price, + trading_volume +from all_metrics \ No newline at end of file diff --git a/models/lido/liquidity/zksync/lido_liquidity_zksync_maverick_pools.sql b/models/lido/liquidity/zksync/lido_liquidity_zksync_maverick_pools.sql new file mode 100644 index 00000000000..edd71fefe8c --- /dev/null +++ b/models/lido/liquidity/zksync/lido_liquidity_zksync_maverick_pools.sql @@ -0,0 +1,253 @@ +{{ config( + alias = 'maverick_pools_zksync', + materialized = 'incremental', + file_format = 'delta', + incremental_strategy = 'merge', + unique_key = ['pool', 'time'], + post_hook='{{ expose_spells(blockchains = \'["zksync"]\', + spell_type = "project", + spell_name = "lido_liquidity", + contributors = \'["pipistrella"]\') }}' + ) +}} + +{% set project_start_date = '2024-01-17' %} + +with + +pools as ( +select distinct poolAddress, tokenA, tokenB, cast(fee as double)/1e16 as fee +from {{source('maverick_v1_zksync','factory_evt_PoolCreated')}} +where tokenA = 0x703b52F2b28fEbcB60E1372858AF5b18849FE867 + or tokenB = 0x703b52F2b28fEbcB60E1372858AF5b18849FE867 +) + + +, tokens as ( +select distinct token as address +from ( +select tokenA as token +from {{source('maverick_v1_zksync','factory_evt_PoolCreated')}} +where tokenB = 0x703b52F2b28fEbcB60E1372858AF5b18849FE867 +union +select tokenB +from {{source('maverick_v1_zksync','factory_evt_PoolCreated')}} +where tokenA = 0x703b52F2b28fEbcB60E1372858AF5b18849FE867 +union +select 0x703b52F2b28fEbcB60E1372858AF5b18849FE867 +) t +) + +, tokens_prices_daily AS ( + SELECT distinct + DATE_TRUNC('day', minute) AS time, + contract_address as token, + symbol, + decimals, + avg(price) AS price + FROM {{source('prices','usd')}} p + {% if not is_incremental() %} + WHERE DATE_TRUNC('day', p.minute) >= DATE '{{ project_start_date }}' + {% else %} + WHERE {{ incremental_predicate('p.minute') }} + {% endif %} + and date_trunc('day', minute) < current_date + and blockchain = 'zksync' + and contract_address in (select address from tokens) + group by 1,2,3,4 + union all + SELECT distinct + DATE_TRUNC('day', minute), + contract_address as token, + symbol, + decimals, + last_value(price) over (partition by DATE_TRUNC('day', minute), contract_address ORDER BY minute range between unbounded preceding AND unbounded following) AS price + FROM {{source('prices','usd')}} + WHERE date_trunc('day', minute) = current_date + and blockchain = 'zksync' + and contract_address in (select address from tokens) +) + +, wsteth_prices_hourly as ( + select time, lead(time,1, DATE_TRUNC('hour', now() + interval '1' hour)) over (order by time) as next_time, price + from ( + SELECT distinct + DATE_TRUNC('hour', minute) time, + last_value(price) over (partition by DATE_TRUNC('hour', minute), contract_address ORDER BY minute range between unbounded preceding AND unbounded following) AS price + FROM {{source('prices','usd')}} p + {% if not is_incremental() %} + WHERE DATE_TRUNC('day', p.minute) >= DATE '{{ project_start_date }}' + {% else %} + WHERE {{ incremental_predicate('p.minute') }} + {% endif %} + and blockchain = 'zksync' + and contract_address = 0x703b52F2b28fEbcB60E1372858AF5b18849FE867 + ) p +) + +, swap_events as ( + select + date_trunc('day', sw.evt_block_time) as time, + sw.contract_address as pool, + cr.tokenA, cr.tokenB, + sum(case when tokenAIn then cast(amountIn as double) else (-1)*cast(amountOut as double) end) as amountA, + sum(case when tokenAIn then (-1)*cast(amountOut as double) else cast(amountIn as double) end) as amountB + from {{source('maverick_v1_zksync','pool_evt_Swap')}} sw + left join {{source('maverick_v1_zksync','factory_evt_PoolCreated')}} cr on sw.contract_address = cr.poolAddress + {% if not is_incremental() %} + WHERE DATE_TRUNC('day', sw.evt_block_time) >= DATE '{{ project_start_date }}' + {% else %} + WHERE {{ incremental_predicate('sw.evt_block_time') }} + {% endif %} + and sw.contract_address in (select poolAddress from pools) + group by 1,2,3,4 +) + +, addliquidity_events as ( + select date_trunc('day', call_block_time) as time, + a.contract_address as pool, + cr.tokenA, cr.tokenB, + sum(cast(output_tokenAAmount as double)) as amountA, + sum(cast(output_tokenBAmount as double)) as amountB +from {{source('maverick_v1_zksync','pool_call_addLiquidity')}} a +left join {{source('maverick_v1_zksync','factory_evt_PoolCreated')}} cr on a.contract_address = cr.poolAddress + {% if not is_incremental() %} + WHERE DATE_TRUNC('day', a.call_block_time) >= DATE '{{ project_start_date }}' + {% else %} + WHERE {{ incremental_predicate('a.call_block_time') }} + {% endif %} + and a.call_success + and a.contract_address in (select poolAddress from pools) +group by 1,2,3,4 +) + +, removeliquidity_events as ( +select date_trunc('day', call_block_time) as time, + a.contract_address as pool, + cr.tokenA, cr.tokenB, + (-1)*sum(cast(output_tokenAOut as double)) as amountA, + (-1)*sum(cast(output_tokenBOut as double)) as amountB +from {{source('maverick_v1_zksync','pool_call_removeLiquidity')}} a +left join {{source('maverick_v1_zksync','factory_evt_PoolCreated')}} cr on a.contract_address = cr.poolAddress + {% if not is_incremental() %} + WHERE DATE_TRUNC('day', a.call_block_time) >= DATE '{{ project_start_date }}' + {% else %} + WHERE {{ incremental_predicate('a.call_block_time') }} + {% endif %} + and a.call_success + and a.contract_address in (select poolAddress from pools) +group by 1,2,3,4 +) + +, daily_delta_balance AS ( + +select time, pool, tokenA, tokenB, sum(amountA) as amountA, sum(amountB) as amountB +from ( +select time, pool,tokenA, tokenB, amountA, amountB +from swap_events + +union all + +select time, pool,tokenA, tokenB, amountA, amountB +from addliquidity_events + +union all + +select time, pool,tokenA, tokenB, amountA, amountB +from removeliquidity_events + +) group by 1,2,3,4 +) + + +, pool_liquidity as ( +SELECT time, pools.fee, + pool, + b.tokenA, + b.tokenB, + coalesce((SUM(amountA)),0) AS amountA, + coalesce((SUM(amountB)),0) AS amountB +FROM daily_delta_balance b +left join pools on b.pool = pools.poolAddress +GROUP BY 1,2,3,4,5 +) + + + +, wsteth_traded_hourly as ( + select + date_trunc('hour', sw.evt_block_time) as time, + sw.contract_address as pool, + cr.tokenA, cr.tokenB, + sum(case when (cr.tokenA = 0x703b52F2b28fEbcB60E1372858AF5b18849FE867 and tokenAIn = true) then amountIn + when (cr.tokenA = 0x703b52F2b28fEbcB60E1372858AF5b18849FE867 and tokenAIn = false) then amountOut + when (cr.tokenA != 0x703b52F2b28fEbcB60E1372858AF5b18849FE867 and tokenAIn = true) then amountOut + when (cr.tokenA != 0x703b52F2b28fEbcB60E1372858AF5b18849FE867 and tokenAIn = false) then amountIn + end) as amount + from {{source('maverick_v1_zksync','pool_evt_Swap')}} sw + left join {{source('maverick_v1_zksync','factory_evt_PoolCreated')}} cr on sw.contract_address = cr.poolAddress + {% if not is_incremental() %} + WHERE DATE_TRUNC('day', sw.evt_block_time) >= DATE '{{ project_start_date }}' + {% else %} + WHERE {{ incremental_predicate('sw.evt_block_time') }} + {% endif %} + and sw.contract_address in (select poolAddress from pools) + group by 1,2,3,4 + +) + +, trading_volume_hourly as ( +select t.time, pool, t.amount*wp.price as volume_raw +from wsteth_traded_hourly t +left join wsteth_prices_hourly wp on date_trunc('hour',t.time) >= wp.time and date_trunc('hour',t.time) < wp.next_time +order by 1,2 +) + +, trading_volume as ( + select distinct date_trunc('day', time) as time + , pool + , sum(volume_raw)/1e18 as volume + from trading_volume_hourly + GROUP by 1,2 +) + +, all_metrics as ( +select + o.pool, + 'zksync' as blockchain, + 'maverick' as project, + format('%,.3f',round(coalesce(fee,0),4)) as fee, + cast(o.time as date) time, + case when o.tokenA = 0x703b52F2b28fEbcB60E1372858AF5b18849FE867 then o.tokenA else o.tokenB end as main_token, + case when o.tokenA = 0x703b52F2b28fEbcB60E1372858AF5b18849FE867 then pA.symbol else pB.symbol end as main_token_symbol, + case when o.tokenA = 0x703b52F2b28fEbcB60E1372858AF5b18849FE867 then o.tokenB else o.tokenA end as paired_token, + case when o.tokenA = 0x703b52F2b28fEbcB60E1372858AF5b18849FE867 then pB.symbol else pA.symbol end as paired_token_symbol, + case when o.tokenA = 0x703b52F2b28fEbcB60E1372858AF5b18849FE867 then amountA/power(10,pA.decimals) else amountB/power(10,pB.decimals) end as main_token_reserve, + case when o.tokenA = 0x703b52F2b28fEbcB60E1372858AF5b18849FE867 then amountB/power(10,pB.decimals) else amountA/power(10,pA.decimals) end as paired_token_reserve, + case when o.tokenA = 0x703b52F2b28fEbcB60E1372858AF5b18849FE867 then pA.price else pB.price end as main_token_usd_price, + case when o.tokenA = 0x703b52F2b28fEbcB60E1372858AF5b18849FE867 then pB.price else pA.price end as paired_token_usd_price, + coalesce(t.volume,0) as trading_volume +from pool_liquidity o +left join tokens_prices_daily pA on o.time = pA.time and o.tokenA = pA.token +left join tokens_prices_daily pB on o.time = pB.time and o.tokenB = pB.token +left join trading_volume t on o.time = t.time and o.pool = t.pool +) + + +select blockchain||' '||project||' '||coalesce(paired_token_symbol,'unknown')||':'||main_token_symbol||' '||fee||'('||cast(pool as varchar)||')' as pool_name, + pool, + blockchain, + project, + fee, + time, + main_token, + main_token_symbol, + paired_token, + paired_token_symbol, + main_token_reserve, + paired_token_reserve, + main_token_usd_price, + paired_token_usd_price, + trading_volume +from all_metrics + diff --git a/models/lido/liquidity/zksync/lido_liquidity_zksync_syncswap_pools.sql b/models/lido/liquidity/zksync/lido_liquidity_zksync_syncswap_pools.sql index 3114a6d43a9..6803b8e8f7f 100644 --- a/models/lido/liquidity/zksync/lido_liquidity_zksync_syncswap_pools.sql +++ b/models/lido/liquidity/zksync/lido_liquidity_zksync_syncswap_pools.sql @@ -12,7 +12,7 @@ ) }} -{% set project_start_date = '2024-02-10' %} +{% set project_start_date = '2024-01-01' %} with pools as ( select pool AS address, @@ -50,7 +50,7 @@ FROM {{source('prices','usd')}} p {% if not is_incremental() %} WHERE DATE_TRUNC('day', p.minute) >= DATE '{{ project_start_date }}' {% else %} -WHERE DATE_TRUNC('day', p.minute) >= DATE_TRUNC('day', NOW() - INTERVAL '1' day) +WHERE {{ incremental_predicate('p.minute') }} {% endif %} and date_trunc('day', minute) < current_date @@ -83,7 +83,7 @@ select distinct {% if not is_incremental() %} WHERE DATE_TRUNC('day', p.minute) >= DATE '{{ project_start_date }}' {% else %} - WHERE DATE_TRUNC('day', p.minute) >= DATE_TRUNC('day', NOW() - INTERVAL '1' day) + WHERE {{ incremental_predicate('p.minute') }} {% endif %} and blockchain = 'zksync' and contract_address = 0x703b52F2b28fEbcB60E1372858AF5b18849FE867 @@ -110,7 +110,7 @@ from wsteth_prices_hourly {% if not is_incremental() %} WHERE DATE_TRUNC('day', m.evt_block_time) >= DATE '{{ project_start_date }}' {% else %} - WHERE DATE_TRUNC('day', m.evt_block_time) >= DATE_TRUNC('day', NOW() - INTERVAL '1' day) + WHERE {{ incremental_predicate('m.evt_block_time') }} {% endif %} and m.contract_address in (select address from pools) @@ -130,7 +130,7 @@ from wsteth_prices_hourly {% if not is_incremental() %} WHERE DATE_TRUNC('day', b.evt_block_time) >= DATE '{{ project_start_date }}' {% else %} - WHERE DATE_TRUNC('day', b.evt_block_time) >= DATE_TRUNC('day', NOW() - INTERVAL '1' day) + WHERE {{ incremental_predicate('b.evt_block_time') }} {% endif %} and b.contract_address in (select address from pools) @@ -151,7 +151,7 @@ from wsteth_prices_hourly {% if not is_incremental() %} WHERE DATE_TRUNC('day', s.evt_block_time) >= DATE '{{ project_start_date }}' {% else %} - WHERE DATE_TRUNC('day', s.evt_block_time) >= DATE_TRUNC('day', NOW() - INTERVAL '1' day) + WHERE {{ incremental_predicate('s.evt_block_time') }} {% endif %} and s.contract_address in (select address from pools) @@ -208,7 +208,7 @@ GROUP BY 1,2,3,4 {% if not is_incremental() %} WHERE DATE_TRUNC('day', s.evt_block_time) >= DATE '{{ project_start_date }}' {% else %} - WHERE DATE_TRUNC('day', s.evt_block_time) >= DATE_TRUNC('day', NOW() - INTERVAL '1' day) + WHERE {{ incremental_predicate('s.evt_block_time') }} {% endif %} and s.contract_address in (select address from pools) diff --git a/models/lido/liquidity/zksync/lido_liquidity_zksync_syncswap_v2_pools.sql b/models/lido/liquidity/zksync/lido_liquidity_zksync_syncswap_v2_pools.sql new file mode 100644 index 00000000000..06403042175 --- /dev/null +++ b/models/lido/liquidity/zksync/lido_liquidity_zksync_syncswap_v2_pools.sql @@ -0,0 +1,286 @@ +{{ config( + schema='lido_liquidity_zksync', + alias = 'syncswap_v2_pools', + materialized = 'incremental', + file_format = 'delta', + incremental_strategy = 'merge', + unique_key = ['pool', 'time'], + post_hook='{{ expose_spells(blockchains = \'["zksync"]\', + spell_type = "project", + spell_name = "lido_liquidity", + contributors = \'["pipistrella"]\') }}' + ) +}} + +{% set project_start_date = '2024-01-01' %} + +with pools as ( +select pool AS address, + 'zksync' AS blockchain, + 'syncswap' AS project, + * +from {{source('syncswap_v2_zksync','SyncSwapAquaPoolFactory_evt_PoolCreated')}} +where (token0 = 0x703b52F2b28fEbcB60E1372858AF5b18849FE867 + OR token1 = 0x703b52F2b28fEbcB60E1372858AF5b18849FE867) +) + +, tokens as ( + select distinct token + from ( + select token0 as token + from {{source('syncswap_v2_zksync','SyncSwapAquaPoolFactory_evt_PoolCreated')}} + where token1 = 0x703b52F2b28fEbcB60E1372858AF5b18849FE867 + union all + select token1 + from {{source('syncswap_v2_zksync','SyncSwapAquaPoolFactory_evt_PoolCreated')}} + where token0 = 0x703b52F2b28fEbcB60E1372858AF5b18849FE867 + union all + select 0x703b52F2b28fEbcB60E1372858AF5b18849FE867 + ) t + ) + + , tokens_prices_daily as ( +select distinct + DATE_TRUNC('day', minute) AS time, + contract_address AS token, + symbol, + decimals, + AVG(price) AS price +FROM {{source('prices','usd')}} p +{% if not is_incremental() %} +WHERE DATE_TRUNC('day', p.minute) >= DATE '{{ project_start_date }}' +{% else %} +WHERE {{ incremental_predicate('p.minute') }} +{% endif %} + + and date_trunc('day', minute) < current_date + and blockchain = 'zksync' + and contract_address IN (select token from tokens) +group by 1,2,3,4 +union all +select distinct + DATE_TRUNC('day', minute), + contract_address AS token, + symbol, + decimals, + LAST_VALUE(price) OVER (PARTITION BY DATE_TRUNC('day', minute),contract_address ORDER BY minute NULLS FIRST range BETWEEN UNBOUNDED preceding AND UNBOUNDED following) AS price + FROM + {{source('prices','usd')}} + WHERE + DATE_TRUNC('day', minute) = current_date + and blockchain = 'zksync' + and contract_address IN (select token from tokens) + ) + + , wsteth_prices_hourly AS ( + SELECT distinct + DATE_TRUNC('hour', minute) time, + contract_address as token, + symbol, + decimals, + last_value(price) over (partition by DATE_TRUNC('hour', minute), contract_address ORDER BY minute range between unbounded preceding AND unbounded following) AS price + FROM {{ source('prices', 'usd') }} p + {% if not is_incremental() %} + WHERE DATE_TRUNC('day', p.minute) >= DATE '{{ project_start_date }}' + {% else %} + WHERE {{ incremental_predicate('p.minute') }} + {% endif %} + + and blockchain = 'zksync' and contract_address = 0x703b52F2b28fEbcB60E1372858AF5b18849FE867 + +) + +, wsteth_prices_hourly_with_lead AS ( +select time, + lead(time, 1, date_trunc('hour', now() + interval '1' hour)) over (order by time) as next_time, + price +from wsteth_prices_hourly +) + +, mint_events AS ( + select DATE_TRUNC('day', m.evt_block_time) AS time, + m.contract_address AS pool, + cr.token0, + cr.token1, + SUM(CAST(amount0 AS DOUBLE)) AS amount0, + SUM(CAST(amount1 AS DOUBLE)) AS amount1 + from {{source('syncswap_v2_zksync','SyncSwapAquaPool_evt_Mint')}} m + left join {{source('syncswap_v2_zksync','SyncSwapAquaPoolFactory_evt_PoolCreated')}} cr on m.contract_address = cr.pool + + {% if not is_incremental() %} + WHERE DATE_TRUNC('day', m.evt_block_time) >= DATE '{{ project_start_date }}' + {% else %} + WHERE {{ incremental_predicate('m.evt_block_time') }} + {% endif %} + + and m.contract_address in (select address from pools) + group by 1,2,3,4 + ) + + , burn_events as ( + select DATE_TRUNC('day', b.evt_block_time) AS time, + b.contract_address AS pool, + cr.token0, + cr.token1, + (-1)*SUM(CAST(amount0 AS DOUBLE)) AS amount0, + (-1)*SUM(CAST(amount1 AS DOUBLE)) AS amount1 + from {{source('syncswap_v2_zksync','SyncSwapAquaPool_evt_Burn')}} b + left join {{source('syncswap_v2_zksync','SyncSwapAquaPoolFactory_evt_PoolCreated')}} cr on b.contract_address = cr.pool + + {% if not is_incremental() %} + WHERE DATE_TRUNC('day', b.evt_block_time) >= DATE '{{ project_start_date }}' + {% else %} + WHERE {{ incremental_predicate('b.evt_block_time') }} + {% endif %} + + and b.contract_address in (select address from pools) + group by 1,2,3,4 + + ) + +, swap_events as ( + select DATE_TRUNC('day', s.evt_block_time) AS time, + s.contract_address AS pool, + cr.token0, + cr.token1, + SUM(CAST(amount0In AS DOUBLE) - CAST(amount0Out AS DOUBLE)) AS amount0, + SUM(CAST(amount1In AS DOUBLE) - CAST(amount1Out AS DOUBLE)) AS amount1 + from {{source('syncswap_v2_zksync','SyncSwapAquaPool_evt_Swap')}} s + left join {{source('syncswap_v2_zksync','SyncSwapAquaPoolFactory_evt_PoolCreated')}} cr on s.contract_address = cr.pool + + {% if not is_incremental() %} + WHERE DATE_TRUNC('day', s.evt_block_time) >= DATE '{{ project_start_date }}' + {% else %} + WHERE {{ incremental_predicate('s.evt_block_time') }} + {% endif %} + + and s.contract_address in (select address from pools) + group by 1,2,3,4 + +) + + , daily_delta_balance AS ( + +select time, pool, token0, token1, sum(amount0) as amount0, sum(amount1) as amount1 +from ( +select time, pool,token0, token1, amount0, amount1 +from mint_events + +union all + +select time, pool,token0, token1, amount0, amount1 +from swap_events + +union all + +select time, pool,token0, token1, amount0, amount1 +from burn_events + +) group by 1,2,3,4 +) + +, daily_delta_balance_with_lead AS ( +select time, pool, token0, token1, amount0, amount1, +lead(time, 1, now()) over (partition by pool order by time) as next_time +from daily_delta_balance +) + + +, pool_liquidity as ( +SELECT b.time, + b.pool, + token0, + token1, + SUM(amount0) AS amount0, + SUM(amount1) AS amount1 +FROM daily_delta_balance_with_lead b +GROUP BY 1,2,3,4 +) + +, swap_events_hourly as ( + select DATE_TRUNC('hour', s.evt_block_time) AS time, + s.contract_address AS pool, + sum(case when cr.token0 = 0x703b52F2b28fEbcB60E1372858AF5b18849FE867 then CAST(amount0In AS DOUBLE) + CAST(amount0Out AS DOUBLE) + else CAST(amount1In AS DOUBLE) + CAST(amount1Out AS DOUBLE) end) as wsteth_amount + from {{source('syncswap_v2_zksync','SyncSwapAquaPool_evt_Swap')}} s + left join {{source('syncswap_v2_zksync','SyncSwapAquaPoolFactory_evt_PoolCreated')}} cr on s.contract_address = cr.pool + + {% if not is_incremental() %} + WHERE DATE_TRUNC('day', s.evt_block_time) >= DATE '{{ project_start_date }}' + {% else %} + WHERE {{ incremental_predicate('s.evt_block_time') }} + {% endif %} + + and s.contract_address in (select address from pools) +group by 1,2 +) + +, trading_volume_hourly AS ( + SELECT + s.time, + pool, + wsteth_amount, + p.price, + COALESCE((p.price * wsteth_amount) / CAST(POWER(10, 18) AS DOUBLE), 0) AS volume + FROM + swap_events_hourly AS s + LEFT JOIN wsteth_prices_hourly_with_lead AS p ON s.time >= p.time + AND s.time < p.next_time + ) + +, trading_volume AS ( + SELECT DISTINCT + DATE_TRUNC('day', time) AS time, + pool, + SUM(volume) AS volume + FROM trading_volume_hourly + GROUP BY 1, 2 + ) + +, all_metrics AS ( + SELECT + l.pool, + pools.blockchain, + pools.project, + 0.0 as fee, + '' as pool_type, + cast(l.time as date) as time, + CASE WHEN l.token0 = 0x1F32b1c2345538c0c6f582fCB022739c4A194Ebb THEN l.token0 ELSE l.token1 END AS main_token, + CASE WHEN l.token0 = 0x1F32b1c2345538c0c6f582fCB022739c4A194Ebb THEN p0.symbol ELSE p1.symbol END AS main_token_symbol, + CASE WHEN l.token0 = 0x1F32b1c2345538c0c6f582fCB022739c4A194Ebb THEN l.token1 ELSE l.token0 END AS paired_token, + CASE WHEN l.token0 = 0x1F32b1c2345538c0c6f582fCB022739c4A194Ebb THEN p1.symbol ELSE p0.symbol END AS paired_token_symbol, + CASE WHEN l.token0 = 0x1F32b1c2345538c0c6f582fCB022739c4A194Ebb THEN amount0/CAST(POWER(10,p0.decimals) as double) ELSE amount1/CAST(POWER(10,p1.decimals) as double) END AS main_token_reserve, + CASE WHEN l.token0 = 0x1F32b1c2345538c0c6f582fCB022739c4A194Ebb THEN amount1/CAST(POWER(10, p1.decimals) as double) ELSE amount0/CAST(POWER(10, p0.decimals) as double) END AS paired_token_reserve, + CASE WHEN l.token0 = 0x1F32b1c2345538c0c6f582fCB022739c4A194Ebb THEN p0.price ELSE p1.price END AS main_token_usd_price, + CASE WHEN l.token0 = 0x1F32b1c2345538c0c6f582fCB022739c4A194Ebb THEN p1.price ELSE p0.price END AS paired_token_usd_price, + coalesce(volume,0) AS trading_volume + FROM + pool_liquidity AS l + LEFT JOIN pools ON l.pool = pools.address + LEFT JOIN tokens AS t0 ON l.token0 = t0.token + LEFT JOIN tokens AS t1 ON l.token1 = t1.token + LEFT JOIN tokens_prices_daily AS p0 ON l.time = p0.time + AND l.token0 = p0.token + LEFT JOIN tokens_prices_daily AS p1 ON l.time = p1.time + AND l.token1 = p1.token + LEFT JOIN trading_volume AS tv ON l.time = tv.time + AND l.pool = tv.pool + ) + + +select CONCAT(CONCAT(CONCAT(CONCAT(CONCAT(blockchain,CONCAT(' ', project)) ,' '), coalesce(paired_token_symbol,'unknown')),':') , main_token_symbol, ' ', pool_type, ' ', format('%,.3f',round(coalesce(fee,0),4))) as pool_name, + pool, + blockchain, + project, + fee, + time, + main_token, + main_token_symbol, + paired_token, + paired_token_symbol, + main_token_reserve, + paired_token_reserve, + main_token_usd_price, + paired_token_usd_price, + trading_volume +from all_metrics \ No newline at end of file diff --git a/sources/lido/liquidity/base/lido_liquidity_base_sources.yml b/sources/lido/liquidity/base/lido_liquidity_base_sources.yml index a366167ad62..3eadd717998 100644 --- a/sources/lido/liquidity/base/lido_liquidity_base_sources.yml +++ b/sources/lido/liquidity/base/lido_liquidity_base_sources.yml @@ -33,6 +33,18 @@ sources: loaded_at_field: call_block_time - name: Pool_evt_Fees loaded_at_field: evt_block_time + - name: CLPool_evt_Mint + loaded_at_field: evt_block_time + - name: CLPool_evt_Collect + loaded_at_field: evt_block_time + - name: CLFactory_call_getSwapFee + loaded_at_field: call_block_time + - name: CLFactory_evt_PoolCreated + loaded_at_field: evt_block_time + - name: CLPool_evt_Swap + loaded_at_field: evt_block_time + - name: CLPool_evt_CollectFees + loaded_at_field: evt_block_time - name: uniswap_v3_base description: "Base decoded tables related to Uniswap v3 contract" diff --git a/sources/lido/liquidity/optimism/lido_liquidity_optimism_sources.yml b/sources/lido/liquidity/optimism/lido_liquidity_optimism_sources.yml index 0f059a19134..42db1b0d392 100644 --- a/sources/lido/liquidity/optimism/lido_liquidity_optimism_sources.yml +++ b/sources/lido/liquidity/optimism/lido_liquidity_optimism_sources.yml @@ -90,5 +90,21 @@ sources: - name: Pool_evt_Fees loaded_at_field: evt_block_time - name: PoolFactory_call_getFee - loaded_at_field: call_block_time + loaded_at_field: call_block_time + - name: CLFactory_evt_PoolCreated + loaded_at_field: evt_block_time + - name: CLPool_evt_Mint + loaded_at_field: evt_block_time + - name: CLPool_evt_Collect + loaded_at_field: evt_block_time + - name: CLPool_evt_Fees + loaded_at_field: evt_block_time + - name: CLPoolFactory_call_getFee + loaded_at_field: call_block_time + - name: CLFactory_call_getSwapFee + loaded_at_field: call_block_time + - name: CLPool_evt_Swap + loaded_at_field: evt_block_time + - name: CLPool_evt_CollectFees + loaded_at_field: evt_block_time \ No newline at end of file diff --git a/sources/lido/liquidity/scroll/lido_liquidity_scroll_sources.yml b/sources/lido/liquidity/scroll/lido_liquidity_scroll_sources.yml new file mode 100644 index 00000000000..3f8563c0460 --- /dev/null +++ b/sources/lido/liquidity/scroll/lido_liquidity_scroll_sources.yml @@ -0,0 +1,24 @@ +version: 2 + +sources: + - name: syncswap_scroll + description: "Scroll decoded tables related to SyncSwap contract" + freshness: # default freshness + warn_after: { count: 12, period: hour } + error_after: { count: 24, period: hour } + tables: + - name: SyncSwapClassicPool_evt_Mint + loaded_at_field: evt_block_time + - name: SyncSwapClassicPool_evt_Burn + loaded_at_field: evt_block_time + + - name: zebra_scroll + description: "Scroll decoded tables related to Zebra DEX contract" + freshness: # default freshness + warn_after: { count: 12, period: hour } + error_after: { count: 24, period: hour } + tables: + - name: ZebraV2Pool_evt_Mint + loaded_at_field: evt_block_time + - name: ZebraV2Pool_evt_Burn + loaded_at_field: evt_block_time diff --git a/sources/lido/liquidity/zksync/lido_liquidity_zksync_sources.yml b/sources/lido/liquidity/zksync/lido_liquidity_zksync_sources.yml index aa5b7074bc4..34a1f4ca019 100644 --- a/sources/lido/liquidity/zksync/lido_liquidity_zksync_sources.yml +++ b/sources/lido/liquidity/zksync/lido_liquidity_zksync_sources.yml @@ -11,4 +11,27 @@ sources: loaded_at_field: evt_block_time - name: SyncSwapClassicPool_evt_Burn loaded_at_field: evt_block_time + + - name: syncswap_v2_zksync + description: "Zksync decoded tables related to SyncSwap V2 contract" + freshness: # default freshness + warn_after: { count: 12, period: hour } + error_after: { count: 24, period: hour } + tables: + - name: SyncSwapAquaPool_evt_Mint + loaded_at_field: evt_block_time + - name: SyncSwapAquaPool_evt_Burn + loaded_at_field: evt_block_time + + - name: maverick_v1_zksync + description: "Zksync decoded tables related to Maverick DEX contracts" + freshness: # default freshness + warn_after: { count: 12, period: hour } + error_after: { count: 24, period: hour } + tables: + - name: pool_call_addLiquidity + loaded_at_field: call_block_time + - name: pool_call_removeLiquidity + loaded_at_field: call_block_time + From 7610410224a4dd7db73de811f47685fff99ded9b Mon Sep 17 00:00:00 2001 From: disco chuck Date: Tue, 11 Jun 2024 13:16:13 -0500 Subject: [PATCH 101/149] Update tokens_avalanche_c_nft_curated.sql (#6141) adding Steady, ferdy fish, salvors, elements, DQN, Smol joes, black flag pirates, ferdy frends, sausagers, long long legacy --- .../avalanche_c/tokens_avalanche_c_nft_curated.sql | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/tokens/models/tokens/avalanche_c/tokens_avalanche_c_nft_curated.sql b/tokens/models/tokens/avalanche_c/tokens_avalanche_c_nft_curated.sql index f0febe1ca2d..8c42f44a161 100644 --- a/tokens/models/tokens/avalanche_c/tokens_avalanche_c_nft_curated.sql +++ b/tokens/models/tokens/avalanche_c/tokens_avalanche_c_nft_curated.sql @@ -9,6 +9,16 @@ SELECT contract_address, name, symbol FROM (VALUES + (0x7098b1918eb2aa13945b8a489975bbbf0d5dd79b, 'Long Long Legacy', 'LLL'), + (0xc732518034c5df52cdddf17486b9409bc7721e2c, 'Sausagers', 'MEAT'), + (0x00bf1594507ccf60b41ad64524d4aba23b059f4b, 'Ferdy Frends', 'FREN'), + (0xcf81b983b1888e131db9416baa5564ff675a6a12, 'Black Flag Pirates', 'BFPR'), + (0xb449701a5ebb1d660cb1d206a94f151f5a544a81, 'Smol Joes Season 2', 'SJ'), + (0x9b216c723f77a97abed00780865c070ad6e3dfb6, 'DQN', 'DQN'), + (0xe19b85a3440d5999a8363d386e3eacc088800b68, 'Elements', 'ELEMENTS'), + (0xf0ad42e8d11dd0a3f06f76ddb39279c797568cb0, 'ferdy fish', 'fdfh'), + (0xce4fee23ab35d0d9a4b6b644881ddd8adebeb300, 'The Salvors', 'SALVOR'), + (0xcdab7d987f0198edb440d014ed1e71256a0e3e7a, 'Steady', 'STDY'), (0x36335Bda9a1e4224671B3fDF3e599DFbe083a7c1, 'Walrus Anglers Club', 'WAC'), (0xdce4867e34f977619b296646b04bdb334b8f6950, 'Bananaz', 'NANAZ'), (0xddccc21fc45e96a04d4213e3b0b9e54498107702, 'Scourge Apes', 'SAPE'), From 587f8fbdeb23919f1fb9a17eedec7d8a4413737c Mon Sep 17 00:00:00 2001 From: mayonas Date: Tue, 11 Jun 2024 23:46:58 +0530 Subject: [PATCH 102/149] add blast to rollup economics (#6139) * add blast to rollup economics * fix sql --- .../ethereum/l1_blob_fees.sql | 6 ++-- .../rollup_economics/ethereum/l2_revenue.sql | 34 ++++++++++++++++++- 2 files changed, 37 insertions(+), 3 deletions(-) diff --git a/models/rollup_economics/ethereum/l1_blob_fees.sql b/models/rollup_economics/ethereum/l1_blob_fees.sql index 8a2c54f1e51..ba88a6036fe 100644 --- a/models/rollup_economics/ethereum/l1_blob_fees.sql +++ b/models/rollup_economics/ethereum/l1_blob_fees.sql @@ -8,7 +8,7 @@ post_hook='{{ expose_spells(\'["ethereum"]\', "project", "rollup_economics", - \'["niftytable"]\') }}' + \'["niftytable", "maybeYonas"]\') }}' )}} SELECT @@ -41,4 +41,6 @@ AND s.blob_submitter_label IN ('Arbitrum', 'Public Goods Network', 'OP Mainnet', 'Starknet', -'Mode') \ No newline at end of file +'Mode', +'Blast' +) \ No newline at end of file diff --git a/models/rollup_economics/ethereum/l2_revenue.sql b/models/rollup_economics/ethereum/l2_revenue.sql index c9494f2efbd..06b1fdc938b 100644 --- a/models/rollup_economics/ethereum/l2_revenue.sql +++ b/models/rollup_economics/ethereum/l2_revenue.sql @@ -9,7 +9,7 @@ post_hook='{{ expose_spells(\'["ethereum"]\', "project", "rollup_economics", - \'["niftytable"]\') }}' + \'["niftytable", "maybeYonas"]\') }}' )}} @@ -265,4 +265,36 @@ WHERE {% else %} AND t.block_time >= timestamp '2023-03-24' --when polygon zkevm launched {% endif %} +GROUP BY 1,2 + +UNION ALL +SELECT + date_trunc('day', t.block_time) AS day + , 'blast' AS name + , SUM( + CASE WHEN cast(t.gas_price as double) = cast(0 as double) THEN 0 + ELSE (l1_fee + (cast(t.gas_used as double) * cast(t.gas_price as double))) /POWER(10,18) + END + ) AS l2_rev + , SUM( + p.price * + (CASE WHEN cast(t.gas_price as double) = cast(0 as double) THEN 0 + ELSE (l1_fee + (cast(t.gas_used as double) * cast(t.gas_price as double))) /POWER(10,18) + END) + ) AS l2_rev_usd +FROM {{ source('blast','transactions') }} t +INNER JOIN {{ source('prices','usd') }} p + ON p.minute = date_trunc('minute', t.block_time) + AND p.blockchain is null + AND p.symbol = 'ETH' + {% if is_incremental() %} + AND {{incremental_predicate('p.minute')}} + {% endif %} +WHERE + 1 = 1 + {% if is_incremental() %} + AND {{incremental_predicate('t.block_time')}} + {% else %} + AND t.block_time >= timestamp '2022-01-01' + {% endif %} GROUP BY 1,2 \ No newline at end of file From c17c215bd43e516e1cdec6857b41a8cfc075136a Mon Sep 17 00:00:00 2001 From: whale_hunter <143016036+whalehunting@users.noreply.github.com> Date: Tue, 11 Jun 2024 20:59:33 +0200 Subject: [PATCH 103/149] chore(magnum): add new bot fee address (#6095) Co-authored-by: Huang Geyang --- .../solana/platforms/magnum_solana_bot_trades.sql | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/models/_sector/dex/bot_trades/solana/platforms/magnum_solana_bot_trades.sql b/models/_sector/dex/bot_trades/solana/platforms/magnum_solana_bot_trades.sql index 91f0abaeb6e..b1c7052d7df 100644 --- a/models/_sector/dex/bot_trades/solana/platforms/magnum_solana_bot_trades.sql +++ b/models/_sector/dex/bot_trades/solana/platforms/magnum_solana_bot_trades.sql @@ -11,7 +11,8 @@ }} {% set project_start_date = '2023-12-07' %} -{% set fee_receiver = 'CPixcsP8LEMeUoavaHG3bdkywR8s4mZXNN3mYUgbXFev' %} +{% set fee_receiver_1 = 'CPixcsP8LEMeUoavaHG3bdkywR8s4mZXNN3mYUgbXFev' %} +{% set fee_receiver_2 = '8dEe5BM7irAnHtJ6SSWwCRf7njgnyczS3jPrvJJs88U5' %} {% set wsol_token = 'So11111111111111111111111111111111111111112' %} WITH @@ -31,7 +32,10 @@ WITH {% endif %} AND tx_success AND balance_change > 0 - AND address = '{{fee_receiver}}' + AND ( + address = '{{fee_receiver_1}}' + OR address = '{{fee_receiver_2}}' + ) ), botTrades AS ( SELECT @@ -86,8 +90,10 @@ WITH {% endif %} ) WHERE - trades.trader_id != '{{fee_receiver}}' -- Exclude trades signed by FeeWallet - AND transactions.signer != '{{fee_receiver}}' -- Exclude trades signed by FeeWallet + trades.trader_id != '{{fee_receiver_1}}' -- Exclude trades signed by FeeWallet + AND trades.trader_id != '{{fee_receiver_2}}' -- Exclude trades signed by FeeWallet + AND transactions.signer != '{{fee_receiver_1}}' -- Exclude trades signed by FeeWallet + AND transactions.signer != '{{fee_receiver_2}}' -- Exclude trades signed by FeeWallet {% if is_incremental() %} AND {{ incremental_predicate('trades.block_time') }} {% else %} From ecfa89df8d183ab7fab7c493188c0f19ff79723e Mon Sep 17 00:00:00 2001 From: viniabussafi <131974393+viniabussafi@users.noreply.github.com> Date: Tue, 11 Jun 2024 22:02:26 +0100 Subject: [PATCH 104/149] Add pool_address and child_gauge_address to balancer gauge labels (#6138) * add pool_address and child gauge address to balancer gauge labels * fix schema * attempt * again * add controller * improve schemas * fix sources * fix typo * fix typo --- .../balancer_v2/labels_balancer_v2_gauges.sql | 3 ++ .../labels_balancer_v2_gauges_arbitrum.sql | 43 +++++++++++++++++- .../labels_balancer_v2_gauges_avalanche_c.sql | 37 ++++++++++++++- .../labels_balancer_v2_gauges_base.sql | 37 ++++++++++++++- .../labels_balancer_v2_gauges_ethereum.sql | 45 ++++++++++++++++++- .../labels_balancer_v2_gauges_gnosis.sql | 37 ++++++++++++++- .../labels_balancer_v2_gauges_optimism.sql | 43 +++++++++++++++++- .../labels_balancer_v2_gauges_polygon.sql | 43 +++++++++++++++++- .../labels_balancer_v2_gauges_zkevm.sql | 37 ++++++++++++++- .../balancer_v2/labels_balancer_v2_schema.yml | 33 ++++++++++++++ .../labels_balancer_v2_sources.yml | 13 +++++- 11 files changed, 359 insertions(+), 12 deletions(-) diff --git a/models/labels/addresses/__single_category_labels__/balancer_v2/labels_balancer_v2_gauges.sql b/models/labels/addresses/__single_category_labels__/balancer_v2/labels_balancer_v2_gauges.sql index 2741ef58094..cf8e359cbde 100644 --- a/models/labels/addresses/__single_category_labels__/balancer_v2/labels_balancer_v2_gauges.sql +++ b/models/labels/addresses/__single_category_labels__/balancer_v2/labels_balancer_v2_gauges.sql @@ -23,7 +23,10 @@ FROM ( SELECT blockchain , address + , pool_address + , child_gauge_address , name + , status , category , contributor , source diff --git a/models/labels/addresses/__single_category_labels__/balancer_v2/labels_balancer_v2_gauges_arbitrum.sql b/models/labels/addresses/__single_category_labels__/balancer_v2/labels_balancer_v2_gauges_arbitrum.sql index 5a621b11e6d..1fd767faeae 100644 --- a/models/labels/addresses/__single_category_labels__/balancer_v2/labels_balancer_v2_gauges_arbitrum.sql +++ b/models/labels/addresses/__single_category_labels__/balancer_v2/labels_balancer_v2_gauges_arbitrum.sql @@ -10,6 +10,8 @@ WITH reward_gauges AS( SELECT distinct 'arbitrum' AS blockchain, gauge.gauge AS address, + pools.address AS pool_address, + streamer.gauge AS child_gauge_address, 'arb:' || pools.name AS name, 'balancer_v2_gauges' AS category, 'balancerlabs' AS contributor, @@ -29,6 +31,8 @@ UNION ALL SELECT distinct 'arbitrum' AS blockchain, gauge.gauge AS address, + pools.address AS pool_address, + streamer.gauge AS child_gauge_address, 'arb:' || pools.name AS name, 'balancer_v2_gauges' AS category, 'balancerlabs' AS contributor, @@ -48,6 +52,8 @@ child_gauges AS( SELECT distinct 'arbitrum' AS blockchain, call.output_0 AS address, + pools.address AS pool_address, + child.output_0 AS child_gauge_address, 'arb:' || pools.name AS name, 'balancer_v2_gauges' AS category, 'balancerlabs' AS contributor, @@ -58,10 +64,43 @@ SELECT distinct 'identifier' AS label_type FROM {{ source('balancer_ethereum', 'CappedArbitrumRootGaugeFactory_call_create') }} call LEFT JOIN {{ source('balancer_arbitrum', 'ChildChainGaugeFactory_call_create') }} child ON child.output_0 = call.recipient - LEFT JOIN {{ ref('labels_balancer_v2_pools_arbitrum') }} pools ON pools.address = child.pool) + LEFT JOIN {{ ref('labels_balancer_v2_pools_arbitrum') }} pools ON pools.address = child.pool), +gauges AS( SELECT * FROM reward_gauges WHERE name IS NOT NULL UNION ALL SELECT * FROM child_gauges -WHERE name IS NOT NULL +WHERE name IS NOT NULL), + +controller AS( --to allow filtering for active gauges only +SELECT + c.evt_tx_hash, + c.evt_index, + c.evt_block_time, + c.evt_block_number, + c.addr AS address, + ROW_NUMBER() OVER (PARTITION BY g.pool_address ORDER BY evt_block_time DESC) AS rn +FROM {{ source('balancer_ethereum', 'GaugeController_evt_NewGauge') }} c +INNER JOIN gauges g ON g.address = c.addr +) + + SELECT + g.blockchain + , g.address + , g.pool_address + , g.child_gauge_address + , g.name + , CASE WHEN c.rn = 1 + THEN 'active' + ELSE 'inactive' + END AS status + , g.category + , g.contributor + , g.source + , g.created_at + , g.updated_at + , g.model_name + , g.label_type + FROM gauges g + INNER JOIN controller c ON g.address = c.address \ No newline at end of file diff --git a/models/labels/addresses/__single_category_labels__/balancer_v2/labels_balancer_v2_gauges_avalanche_c.sql b/models/labels/addresses/__single_category_labels__/balancer_v2/labels_balancer_v2_gauges_avalanche_c.sql index 97d6e516f39..0530e49c4b2 100644 --- a/models/labels/addresses/__single_category_labels__/balancer_v2/labels_balancer_v2_gauges_avalanche_c.sql +++ b/models/labels/addresses/__single_category_labels__/balancer_v2/labels_balancer_v2_gauges_avalanche_c.sql @@ -6,9 +6,12 @@ "labels", \'["viniabussafi"]\') }}')}} +WITH gauges AS( SELECT distinct 'avalanche_c' AS blockchain, call.output_0 AS address, + pools.address AS pool_address, + child.output_0 AS child_gauge_address, 'ava:' || pools.name AS name, 'balancer_v2_gauges' AS category, 'balancerlabs' AS contributor, @@ -19,4 +22,36 @@ SELECT distinct 'identifier' AS label_type FROM {{ source('balancer_ethereum', 'AvalancheRootGaugeFactory_call_create') }} call LEFT JOIN {{ source('balancer_avalanche_c', 'ChildChainGaugeFactory_call_create') }} child ON child.output_0 = call.recipient - LEFT JOIN {{ ref('labels_balancer_v2_pools_avalanche_c') }} pools ON pools.address = child.pool + LEFT JOIN {{ ref('labels_balancer_v2_pools_avalanche_c') }} pools ON pools.address = child.pool), + +controller AS( --to allow filtering for active gauges only +SELECT + c.evt_tx_hash, + c.evt_index, + c.evt_block_time, + c.evt_block_number, + c.addr AS address, + ROW_NUMBER() OVER (PARTITION BY g.pool_address ORDER BY evt_block_time DESC) AS rn +FROM {{ source('balancer_ethereum', 'GaugeController_evt_NewGauge') }} c +INNER JOIN gauges g ON g.address = c.addr +) + + SELECT + g.blockchain + , g.address + , g.pool_address + , g.child_gauge_address + , g.name + , CASE WHEN c.rn = 1 + THEN 'active' + ELSE 'inactive' + END AS status + , g.category + , g.contributor + , g.source + , g.created_at + , g.updated_at + , g.model_name + , g.label_type + FROM gauges g + INNER JOIN controller c ON g.address = c.address diff --git a/models/labels/addresses/__single_category_labels__/balancer_v2/labels_balancer_v2_gauges_base.sql b/models/labels/addresses/__single_category_labels__/balancer_v2/labels_balancer_v2_gauges_base.sql index 6eafc2426a6..add55152846 100644 --- a/models/labels/addresses/__single_category_labels__/balancer_v2/labels_balancer_v2_gauges_base.sql +++ b/models/labels/addresses/__single_category_labels__/balancer_v2/labels_balancer_v2_gauges_base.sql @@ -6,9 +6,12 @@ "labels", \'["viniabussafi"]\') }}')}} +WITH gauges AS( SELECT distinct 'base' AS blockchain, call.output_0 AS address, + pools.address AS pool_address, + child.output_0 AS child_gauge_address, 'base:' || pools.name AS name, 'balancer_v2_gauges' AS category, 'balancerlabs' AS contributor, @@ -19,4 +22,36 @@ SELECT distinct 'identifier' AS label_type FROM {{ source('balancer_ethereum', 'BaseRootGaugeFactory_call_create') }} call LEFT JOIN {{ source('balancer_base', 'ChildChainGaugeFactory_call_create') }} child ON child.output_0 = call.recipient - LEFT JOIN {{ ref('labels_balancer_v2_pools_base') }} pools ON pools.address = child.pool + LEFT JOIN {{ ref('labels_balancer_v2_pools_base') }} pools ON pools.address = child.pool), + +controller AS( --to allow filtering for active gauges only +SELECT + c.evt_tx_hash, + c.evt_index, + c.evt_block_time, + c.evt_block_number, + c.addr AS address, + ROW_NUMBER() OVER (PARTITION BY g.pool_address ORDER BY evt_block_time DESC) AS rn +FROM {{ source('balancer_ethereum', 'GaugeController_evt_NewGauge') }} c +INNER JOIN gauges g ON g.address = c.addr +) + + SELECT + g.blockchain + , g.address + , g.pool_address + , g.child_gauge_address + , g.name + , CASE WHEN c.rn = 1 + THEN 'active' + ELSE 'inactive' + END AS status + , g.category + , g.contributor + , g.source + , g.created_at + , g.updated_at + , g.model_name + , g.label_type + FROM gauges g + INNER JOIN controller c ON g.address = c.address diff --git a/models/labels/addresses/__single_category_labels__/balancer_v2/labels_balancer_v2_gauges_ethereum.sql b/models/labels/addresses/__single_category_labels__/balancer_v2/labels_balancer_v2_gauges_ethereum.sql index 7e5162cb410..2c59d996e2f 100644 --- a/models/labels/addresses/__single_category_labels__/balancer_v2/labels_balancer_v2_gauges_ethereum.sql +++ b/models/labels/addresses/__single_category_labels__/balancer_v2/labels_balancer_v2_gauges_ethereum.sql @@ -6,9 +6,12 @@ "labels", \'["jacektrocinski", "viniabussafi"]\') }}')}} +WITH gauges AS( SELECT 'ethereum' AS blockchain, gauge AS address, + pools.address AS pool_address, + CAST(NULL AS VARBINARY) AS child_gauge_address, 'eth:' || pools.name AS name, 'balancer_v2_gauges' AS category, 'balancerlabs' AS contributor, @@ -20,10 +23,14 @@ SELECT FROM {{ source('balancer_ethereum', 'LiquidityGaugeFactory_evt_GaugeCreated') }} gauge LEFT JOIN {{ ref('labels_balancer_v2_pools_ethereum') }} pools ON pools.address = gauge.pool + UNION ALL + SELECT 'ethereum' AS blockchain, gauge AS address, + pools.address AS pool_address, + CAST(NULL AS VARBINARY) AS child_gauge_address, 'eth:' || pools.name AS name, 'balancer_v2_gauges' AS category, 'balancerlabs' AS contributor, @@ -36,10 +43,14 @@ FROM {{ source('balancer_ethereum', 'CappedLiquidityGaugeFactory_evt_GaugeCreated') }} evt INNER JOIN {{ source('balancer_ethereum', 'CappedLiquidityGaugeFactory_call_create') }} call ON call.call_tx_hash = evt.evt_tx_hash LEFT JOIN {{ ref('labels_balancer_v2_pools_ethereum') }} pools ON pools.address = call.pool + UNION ALL + SELECT 'ethereum' AS blockchain, gauge_address AS address, + BYTEARRAY_SUBSTRING(pool_id, 1,20) AS pool_address, + CAST(NULL AS VARBINARY) AS child_gauge_address, 'eth:' || project AS name, 'balancer_v2_gauges' AS category, 'balancerlabs' AS contributor, @@ -51,4 +62,36 @@ SELECT FROM {{ ref('balancer_single_recipient_gauges') }} WHERE - blockchain = 'ethereum' + blockchain = 'ethereum'), + +controller AS( --to allow filtering for active gauges only +SELECT + c.evt_tx_hash, + c.evt_index, + c.evt_block_time, + c.evt_block_number, + c.addr AS address, + ROW_NUMBER() OVER (PARTITION BY g.pool_address ORDER BY evt_block_time DESC) AS rn +FROM {{ source('balancer_ethereum', 'GaugeController_evt_NewGauge') }} c +INNER JOIN gauges g ON g.address = c.addr +) + + SELECT + g.blockchain + , g.address + , g.pool_address + , g.child_gauge_address + , g.name + , CASE WHEN c.rn = 1 + THEN 'active' + ELSE 'inactive' + END AS status + , g.category + , g.contributor + , g.source + , g.created_at + , g.updated_at + , g.model_name + , g.label_type + FROM gauges g + INNER JOIN controller c ON g.address = c.address diff --git a/models/labels/addresses/__single_category_labels__/balancer_v2/labels_balancer_v2_gauges_gnosis.sql b/models/labels/addresses/__single_category_labels__/balancer_v2/labels_balancer_v2_gauges_gnosis.sql index 74ed6faa0e2..9d2555952b8 100644 --- a/models/labels/addresses/__single_category_labels__/balancer_v2/labels_balancer_v2_gauges_gnosis.sql +++ b/models/labels/addresses/__single_category_labels__/balancer_v2/labels_balancer_v2_gauges_gnosis.sql @@ -6,9 +6,12 @@ "labels", \'["viniabussafi"]\') }}')}} +WITH gauges AS( SELECT distinct 'gnosis' AS blockchain, call.output_0 AS address, + pools.address AS pool_address, + child.output_0 AS child_gauge_address, 'gno:' || pools.name AS name, 'balancer_v2_gauges' AS category, 'balancerlabs' AS contributor, @@ -19,4 +22,36 @@ SELECT distinct 'identifier' AS label_type FROM {{ source('balancer_ethereum', 'GnosisRootGaugeFactory_call_create') }} call LEFT JOIN {{ source('balancer_gnosis', 'ChildChainGaugeFactory_call_create') }} child ON child.output_0 = call.recipient - LEFT JOIN {{ ref('labels_balancer_v2_pools_gnosis') }} pools ON pools.address = child.pool + LEFT JOIN {{ ref('labels_balancer_v2_pools_gnosis') }} pools ON pools.address = child.pool), + +controller AS( --to allow filtering for active gauges only +SELECT + c.evt_tx_hash, + c.evt_index, + c.evt_block_time, + c.evt_block_number, + c.addr AS address, + ROW_NUMBER() OVER (PARTITION BY g.pool_address ORDER BY evt_block_time DESC) AS rn +FROM {{ source('balancer_ethereum', 'GaugeController_evt_NewGauge') }} c +INNER JOIN gauges g ON g.address = c.addr +) + + SELECT + g.blockchain + , g.address + , g.pool_address + , g.child_gauge_address + , g.name + , CASE WHEN c.rn = 1 + THEN 'active' + ELSE 'inactive' + END AS status + , g.category + , g.contributor + , g.source + , g.created_at + , g.updated_at + , g.model_name + , g.label_type + FROM gauges g + INNER JOIN controller c ON g.address = c.address diff --git a/models/labels/addresses/__single_category_labels__/balancer_v2/labels_balancer_v2_gauges_optimism.sql b/models/labels/addresses/__single_category_labels__/balancer_v2/labels_balancer_v2_gauges_optimism.sql index ceae74d1bea..2ea1ad0facf 100644 --- a/models/labels/addresses/__single_category_labels__/balancer_v2/labels_balancer_v2_gauges_optimism.sql +++ b/models/labels/addresses/__single_category_labels__/balancer_v2/labels_balancer_v2_gauges_optimism.sql @@ -10,6 +10,8 @@ WITH reward_gauges AS( SELECT 'optimism' AS blockchain, gauge.gauge AS address, + pools.address AS pool_address, + streamer.gauge AS child_gauge_address, 'op:' || pools.name AS name, 'balancer_v2_gauges' AS category, 'balancerlabs' AS contributor, @@ -28,6 +30,8 @@ UNION ALL SELECT 'optimism' AS blockchain, gauge.gauge AS address, + pools.address AS pool_address, + streamer.gauge AS child_gauge_address, 'op:' || pools.name AS name, 'balancer_v2_gauges' AS category, 'balancerlabs' AS contributor, @@ -46,6 +50,8 @@ child_gauges AS( SELECT distinct 'optimism' AS blockchain, call.output_0 AS address, + pools.address AS pool_address, + child.output_0 AS child_gauge_address, 'opt:' || pools.name AS name, 'balancer_v2_gauges' AS category, 'balancerlabs' AS contributor, @@ -56,10 +62,43 @@ SELECT distinct 'identifier' AS label_type FROM {{ source('balancer_ethereum', 'CappedOptimismRootGaugeFactory_call_create') }} call LEFT JOIN {{ source('balancer_optimism', 'ChildChainGaugeFactory_call_create') }} child ON child.output_0 = call.recipient - LEFT JOIN {{ ref('labels_balancer_v2_pools_optimism') }} pools ON pools.address = child.pool) + LEFT JOIN {{ ref('labels_balancer_v2_pools_optimism') }} pools ON pools.address = child.pool), +gauges AS( SELECT * FROM reward_gauges WHERE name IS NOT NULL UNION ALL SELECT * FROM child_gauges -WHERE name IS NOT NULL +WHERE name IS NOT NULL), + +controller AS( --to allow filtering for active gauges only +SELECT + c.evt_tx_hash, + c.evt_index, + c.evt_block_time, + c.evt_block_number, + c.addr AS address, + ROW_NUMBER() OVER (PARTITION BY g.pool_address ORDER BY evt_block_time DESC) AS rn +FROM {{ source('balancer_ethereum', 'GaugeController_evt_NewGauge') }} c +INNER JOIN gauges g ON g.address = c.addr +) + + SELECT + g.blockchain + , g.address + , g.pool_address + , g.child_gauge_address + , g.name + , CASE WHEN c.rn = 1 + THEN 'active' + ELSE 'inactive' + END AS status + , g.category + , g.contributor + , g.source + , g.created_at + , g.updated_at + , g.model_name + , g.label_type + FROM gauges g + INNER JOIN controller c ON g.address = c.address \ No newline at end of file diff --git a/models/labels/addresses/__single_category_labels__/balancer_v2/labels_balancer_v2_gauges_polygon.sql b/models/labels/addresses/__single_category_labels__/balancer_v2/labels_balancer_v2_gauges_polygon.sql index 1d15f003f2f..bc6fe7dfbf6 100644 --- a/models/labels/addresses/__single_category_labels__/balancer_v2/labels_balancer_v2_gauges_polygon.sql +++ b/models/labels/addresses/__single_category_labels__/balancer_v2/labels_balancer_v2_gauges_polygon.sql @@ -10,6 +10,8 @@ WITH reward_gauges AS( SELECT 'polygon' AS blockchain, gauge.gauge AS address, + pools.address AS pool_address, + streamer.gauge AS child_gauge_address, 'pol:' || pools.name AS name, 'balancer_v2_gauges' AS category, 'balancerlabs' AS contributor, @@ -28,6 +30,8 @@ UNION ALL SELECT 'polygon' AS blockchain, gauge.gauge AS address, + pools.address AS pool_address, + streamer.gauge AS child_gauge_address, 'pol:' || pools.name AS name, 'balancer_v2_gauges' AS category, 'balancerlabs' AS contributor, @@ -46,6 +50,8 @@ child_gauges AS( SELECT distinct 'polygon' AS blockchain, call.output_0 AS address, + pools.address AS pool_address, + child.output_0 AS child_gauge_address, 'pol:' || pools.name AS name, 'balancer_v2_gauges' AS category, 'balancerlabs' AS contributor, @@ -56,10 +62,43 @@ SELECT distinct 'identifier' AS label_type FROM {{ source('balancer_ethereum', 'CappedPolygonRootGaugeFactory_call_create') }} call LEFT JOIN {{ source('balancer_polygon', 'ChildChainGaugeFactory_call_create') }} child ON child.output_0 = call.recipient - LEFT JOIN {{ ref('labels_balancer_v2_pools_polygon') }} pools ON pools.address = child.pool) + LEFT JOIN {{ ref('labels_balancer_v2_pools_polygon') }} pools ON pools.address = child.pool), +gauges AS( SELECT * FROM reward_gauges WHERE name IS NOT NULL UNION ALL SELECT * FROM child_gauges -WHERE name IS NOT NULL +WHERE name IS NOT NULL), + +controller AS( --to allow filtering for active gauges only +SELECT + c.evt_tx_hash, + c.evt_index, + c.evt_block_time, + c.evt_block_number, + c.addr AS address, + ROW_NUMBER() OVER (PARTITION BY g.pool_address ORDER BY evt_block_time DESC) AS rn +FROM {{ source('balancer_ethereum', 'GaugeController_evt_NewGauge') }} c +INNER JOIN gauges g ON g.address = c.addr +) + + SELECT + g.blockchain + , g.address + , g.pool_address + , g.child_gauge_address + , g.name + , CASE WHEN c.rn = 1 + THEN 'active' + ELSE 'inactive' + END AS status + , g.category + , g.contributor + , g.source + , g.created_at + , g.updated_at + , g.model_name + , g.label_type + FROM gauges g + INNER JOIN controller c ON g.address = c.address \ No newline at end of file diff --git a/models/labels/addresses/__single_category_labels__/balancer_v2/labels_balancer_v2_gauges_zkevm.sql b/models/labels/addresses/__single_category_labels__/balancer_v2/labels_balancer_v2_gauges_zkevm.sql index 931d0659edb..81c415e8478 100644 --- a/models/labels/addresses/__single_category_labels__/balancer_v2/labels_balancer_v2_gauges_zkevm.sql +++ b/models/labels/addresses/__single_category_labels__/balancer_v2/labels_balancer_v2_gauges_zkevm.sql @@ -5,9 +5,12 @@ "labels", \'["jacektrocinski", "viniabussafi"]\') }}')}} +WITH gauges AS( SELECT distinct 'zkevm' AS blockchain, call.output_0 AS address, + pools.address AS pool_address, + child.output_0 AS child_gauge_address, 'zk:' || pools.name AS name, 'balancer_v2_gauges' AS category, 'balancerlabs' AS contributor, @@ -18,4 +21,36 @@ SELECT distinct 'identifier' AS label_type FROM {{ source('balancer_ethereum', 'PolygonZkEVMRootGaugeFactory_call_create') }} call LEFT JOIN {{ source('balancer_zkevm', 'ChildChainGaugeFactory_call_create') }} child ON child.output_0 = call.recipient - LEFT JOIN {{ ref('labels_balancer_v2_pools_zkevm') }} pools ON pools.address = child.pool + LEFT JOIN {{ ref('labels_balancer_v2_pools_zkevm') }} pools ON pools.address = child.pool), + +controller AS( --to allow filtering for active gauges only +SELECT + c.evt_tx_hash, + c.evt_index, + c.evt_block_time, + c.evt_block_number, + c.addr AS address, + ROW_NUMBER() OVER (PARTITION BY g.pool_address ORDER BY evt_block_time DESC) AS rn +FROM {{ source('balancer_ethereum', 'GaugeController_evt_NewGauge') }} c +INNER JOIN gauges g ON g.address = c.addr +) + + SELECT + g.blockchain + , g.address + , g.pool_address + , g.child_gauge_address + , g.name + , CASE WHEN c.rn = 1 + THEN 'active' + ELSE 'inactive' + END AS status + , g.category + , g.contributor + , g.source + , g.created_at + , g.updated_at + , g.model_name + , g.label_type + FROM gauges g + INNER JOIN controller c ON g.address = c.address \ No newline at end of file diff --git a/models/labels/addresses/__single_category_labels__/balancer_v2/labels_balancer_v2_schema.yml b/models/labels/addresses/__single_category_labels__/balancer_v2/labels_balancer_v2_schema.yml index a5f5cdb8cb6..99205695c3c 100644 --- a/models/labels/addresses/__single_category_labels__/balancer_v2/labels_balancer_v2_schema.yml +++ b/models/labels/addresses/__single_category_labels__/balancer_v2/labels_balancer_v2_schema.yml @@ -272,7 +272,16 @@ models: columns: - *blockchain - *address + - &pool_address + name: pool_address + description: "Address of the pool to which a Gauge belongs" + - &child_gauge_address + name: child_gauge_address + description: "Address of the Child Gauge on L2s, NULL if on mainnet" - *name + - &status + name: status + description: "Flag for whether a gauge is active or inactive" - *category - *contributor - *source @@ -297,7 +306,10 @@ models: columns: - *blockchain - *address + - *pool_address + - *child_gauge_address - *name + - *status - *category - *contributor - *source @@ -322,7 +334,10 @@ models: columns: - *blockchain - *address + - *pool_address + - *child_gauge_address - *name + - *status - *category - *contributor - *source @@ -347,7 +362,10 @@ models: columns: - *blockchain - *address + - *pool_address + - *child_gauge_address - *name + - *status - *category - *contributor - *source @@ -372,7 +390,10 @@ models: columns: - *blockchain - *address + - *pool_address + - *child_gauge_address - *name + - *status - *category - *contributor - *source @@ -397,7 +418,10 @@ models: columns: - *blockchain - *address + - *pool_address + - *child_gauge_address - *name + - *status - *category - *contributor - *source @@ -422,7 +446,10 @@ models: columns: - *blockchain - *address + - *pool_address + - *child_gauge_address - *name + - *status - *category - *contributor - *source @@ -447,7 +474,10 @@ models: columns: - *blockchain - *address + - *pool_address + - *child_gauge_address - *name + - *status - *category - *contributor - *source @@ -472,7 +502,10 @@ models: columns: - *blockchain - *address + - *pool_address + - *child_gauge_address - *name + - *status - *category - *contributor - *source diff --git a/sources/labels/addresses/__single_category_labels__/balancer_v2/labels_balancer_v2_sources.yml b/sources/labels/addresses/__single_category_labels__/balancer_v2/labels_balancer_v2_sources.yml index 700ce3cb4af..6fcf756e0d5 100644 --- a/sources/labels/addresses/__single_category_labels__/balancer_v2/labels_balancer_v2_sources.yml +++ b/sources/labels/addresses/__single_category_labels__/balancer_v2/labels_balancer_v2_sources.yml @@ -906,8 +906,19 @@ sources: - *call_block_number - *output_0 - name: recipient - - name: relativeWeightCap + - name: relativeWeightCap + - name: GaugeController_evt_NewGauge + columns: + - name: contract_address + - *evt_tx_hash + - *evt_index + - *evt_block_time + - *evt_block_number + - name: addr + - name: gauge_type + - name: weight + - name: balancer_polygon description: > Decoded tables related to Balancer, an automated portfolio manager and trading platform, on Polygon. From 081b6595dfe0b898f7bacfce6e6501f15962e765 Mon Sep 17 00:00:00 2001 From: Alan Ghobadi Date: Wed, 12 Jun 2024 10:39:23 +0200 Subject: [PATCH 105/149] Reapply solana transfers (#6136) (#6145) This reverts commit 470648220f16c9485fa0a72c8e2420fa7cb65cea. --- models/tokens/solana/tokens_solana_schema.yml | 5 +- .../solana/tokens_solana_spl_transfers.sql | 131 ++++++++++++++++ ...ens_solana_spl_transfers_call_transfer.sql | 34 ++++ .../tokens_solana_token22_spl_transfers.sql | 145 ++++++++++++++++++ .../tokens/solana/tokens_solana_transfers.sql | 97 +++++++----- 5 files changed, 369 insertions(+), 43 deletions(-) create mode 100644 models/tokens/solana/tokens_solana_spl_transfers.sql create mode 100644 models/tokens/solana/tokens_solana_spl_transfers_call_transfer.sql create mode 100644 models/tokens/solana/tokens_solana_token22_spl_transfers.sql diff --git a/models/tokens/solana/tokens_solana_schema.yml b/models/tokens/solana/tokens_solana_schema.yml index 4a6bd1a599e..7242599a841 100644 --- a/models/tokens/solana/tokens_solana_schema.yml +++ b/models/tokens/solana/tokens_solana_schema.yml @@ -97,7 +97,7 @@ models: config: tags: ['solana','transfers','erc20','nft','spl'] description: > - get all spl token transfers (will add in token2022 later) + get all spl token transfers columns: - name: block_time - name: block_date @@ -105,10 +105,13 @@ models: - name: action - name: token_mint_address - name: amount + - name: fee + - name: token_version - name: from_owner - name: to_owner - name: from_token_account - name: to_token_account + - name: token_version - name: tx_signer - name: tx_id - name: outer_instruction_index diff --git a/models/tokens/solana/tokens_solana_spl_transfers.sql b/models/tokens/solana/tokens_solana_spl_transfers.sql new file mode 100644 index 00000000000..2f788049ac5 --- /dev/null +++ b/models/tokens/solana/tokens_solana_spl_transfers.sql @@ -0,0 +1,131 @@ + {{ + config( + schema = 'tokens_solana', + alias = 'spl_transfers', + materialized = 'incremental', + file_format = 'delta', + incremental_strategy = 'merge', + partition_by = ['block_date'], + incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.block_time')], + unique_key = ['tx_id','outer_instruction_index','inner_instruction_index', 'block_slot'] + ) +}} + + +WITH +base as ( + SELECT + account_source, account_destination + , bytearray_to_uint256(bytearray_reverse(bytearray_substring(call_data,1+1,8))) as amount + , call_tx_id, call_block_time, call_block_slot, call_outer_executing_account, call_tx_signer + , 'transfer' as action + , call_outer_instruction_index, call_inner_instruction_index + , cast(null as double) as fee + , 'spl_token' as token_version + FROM {{ source('spl_token_solana','spl_token_call_transferChecked') }} + WHERE 1=1 + {% if is_incremental() %} + AND {{incremental_predicate('call_block_time')}} + {% endif %} + + UNION ALL + + SELECT + null as account_source, account_account as account_destination + , bytearray_to_uint256(bytearray_reverse(bytearray_substring(call_data,1+1,8))) as amount + , call_tx_id, call_block_time, call_block_slot, call_outer_executing_account, call_tx_signer + , 'mint' as action + , call_outer_instruction_index, call_inner_instruction_index + , cast(null as double) as fee + , 'spl_token' as token_version + FROM {{ source('spl_token_solana','spl_token_call_mintTo') }} + WHERE 1=1 + {% if is_incremental() %} + AND {{incremental_predicate('call_block_time')}} + {% endif %} + + UNION ALL + + SELECT + null as account_source, account_account as account_destination + , bytearray_to_uint256(bytearray_reverse(bytearray_substring(call_data,1+1,8))) as amount + , call_tx_id, call_block_time, call_block_slot, call_outer_executing_account, call_tx_signer + , 'mint' as action + , call_outer_instruction_index, call_inner_instruction_index + , cast(null as double) as fee + , 'spl_token' as token_version + FROM {{ source('spl_token_solana','spl_token_call_mintToChecked') }} + WHERE 1=1 + {% if is_incremental() %} + AND {{incremental_predicate('call_block_time')}} + {% endif %} + + UNION ALL + + SELECT + account_account as account_source, null as account_destination + , bytearray_to_uint256(bytearray_reverse(bytearray_substring(call_data,1+1,8))) as amount + , call_tx_id, call_block_time, call_block_slot, call_outer_executing_account, call_tx_signer + , 'burn' as action + , call_outer_instruction_index, call_inner_instruction_index + , cast(null as double) as fee + , 'spl_token' as token_version + FROM {{ source('spl_token_solana','spl_token_call_burn') }} + WHERE 1=1 + {% if is_incremental() %} + AND {{incremental_predicate('call_block_time')}} + {% endif %} + + UNION ALL + + SELECT + account_account as account_source, null as account_destination + , bytearray_to_uint256(bytearray_reverse(bytearray_substring(call_data,1+1,8))) as amount + , call_tx_id, call_block_time, call_block_slot, call_outer_executing_account, call_tx_signer + , 'burn' as action + , call_outer_instruction_index, call_inner_instruction_index + , cast(null as double) as fee + , 'spl_token' as token_version + FROM {{ source('spl_token_solana','spl_token_call_burnChecked') }} + WHERE 1=1 + {% if is_incremental() %} + AND {{incremental_predicate('call_block_time')}} + {% endif %} +) + +SELECT + call_block_time as block_time + , cast (date_trunc('day', call_block_time) as date) as block_date + , call_block_slot as block_slot + , action + , amount + , fee + , account_source as from_token_account + , account_destination as to_token_account + , token_version + , call_tx_signer as tx_signer + , call_tx_id as tx_id + , call_outer_instruction_index as outer_instruction_index + , COALESCE(call_inner_instruction_index,0) as inner_instruction_index + , call_outer_executing_account as outer_executing_account +FROM base +UNION ALL +SELECT + block_time + , block_date + , block_slot + , action + , amount + , fee + , from_token_account + , to_token_account + , token_version + , tx_signer + , tx_id + , outer_instruction_index + , inner_instruction_index + , outer_executing_account + FROM {{ref('tokens_solana_spl_transfers_call_transfer')}} +{% if is_incremental() %} + AND {{incremental_predicate('call_block_time')}} + {% endif %} \ No newline at end of file diff --git a/models/tokens/solana/tokens_solana_spl_transfers_call_transfer.sql b/models/tokens/solana/tokens_solana_spl_transfers_call_transfer.sql new file mode 100644 index 00000000000..856c6c48de7 --- /dev/null +++ b/models/tokens/solana/tokens_solana_spl_transfers_call_transfer.sql @@ -0,0 +1,34 @@ + {{ + config( + schema = 'tokens_solana', + alias = 'spl_transfers_call_transfer', + materialized = 'incremental', + file_format = 'delta', + incremental_strategy = 'merge', + partition_by = ['block_month'], + incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.block_time')], + unique_key = ['tx_id','outer_instruction_index','inner_instruction_index', 'block_slot'] + ) +}} + +SELECT + call_block_time as block_time + , cast (date_trunc('day', call_block_time) as date) as block_date + , cast (date_trunc('month', call_block_time) as date) as block_month + , call_block_slot as block_slot + , 'transfer' as action + , amount + , cast(null as double) as fee + , account_source as from_token_account + , account_destination as to_token_account + , 'spl_token' as token_version + , call_tx_signer as tx_signer + , call_tx_id as tx_id + , call_outer_instruction_index as outer_instruction_index + , COALESCE(call_inner_instruction_index,0) as inner_instruction_index + , call_outer_executing_account as outer_executing_account +FROM {{ source('spl_token_solana','spl_token_call_transfer') }} +WHERE 1=1 +{% if is_incremental() %} +AND {{incremental_predicate('call_block_time')}} +{% endif %} diff --git a/models/tokens/solana/tokens_solana_token22_spl_transfers.sql b/models/tokens/solana/tokens_solana_token22_spl_transfers.sql new file mode 100644 index 00000000000..9ebc9bff9cb --- /dev/null +++ b/models/tokens/solana/tokens_solana_token22_spl_transfers.sql @@ -0,0 +1,145 @@ + {{ + config( + schema = 'tokens_solana', + alias = 'token22_spl_transfers', + materialized = 'incremental', + file_format = 'delta', + incremental_strategy = 'merge', + partition_by = ['block_date'], + incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.block_time')], + unique_key = ['tx_id','outer_instruction_index','inner_instruction_index', 'block_slot'] + ) +}} + + +WITH +base as ( + --token2022. Most mint and account extensions still use the parent transferChecked instruction, hooks are excecuted after and interest-bearing is precalculated. + SELECT + account_source, account_destination, amount + , call_tx_id, call_block_time, call_block_slot, call_outer_executing_account, call_tx_signer + , action + , call_outer_instruction_index, call_inner_instruction_index + , fee + , token_version + FROM ( + SELECT + account_source, account_destination + , bytearray_to_uint256(bytearray_reverse(bytearray_substring(call_data,1+1,8))) as amount --note that interestbearing mints have a different amount methodology, to add later + , call_tx_id, call_block_time, call_block_slot, call_outer_executing_account, call_tx_signer + , 'transfer' as action + , call_outer_instruction_index, call_inner_instruction_index + , least( + cast(bytearray_to_uint256(bytearray_reverse(bytearray_substring(call_data,1+1,8))) as double) + *cast(f.fee_basis as double)/10000 + ,f.fee_maximum) as fee --we want to take the percent fee on total amount, but not exceed the maximum fee + , 'token2022' as token_version + , f.fee_time + , row_number() over (partition by tr.call_tx_id, tr.call_outer_instruction_index, tr.call_inner_instruction_index order by f.fee_time desc) as latest_fee + FROM {{ source('spl_token_2022_solana','spl_token_2022_call_transferChecked') }} tr + LEFT JOIN {{ ref('tokens_solana_fees_history') }} f ON tr.account_tokenMint = f.account_mint AND tr.call_block_time >= f.fee_time + WHERE 1=1 + {% if is_incremental() %} + AND {{incremental_predicate('tr.call_block_time')}} + {% endif %} + ) WHERE latest_fee = 1 + + UNION ALL + + SELECT + null as account_source, account_mintTo as account_destination + , bytearray_to_uint256(bytearray_reverse(bytearray_substring(call_data,1+1,8))) as amount + , call_tx_id, call_block_time, call_block_slot, call_outer_executing_account, call_tx_signer + , 'mint' as action + , call_outer_instruction_index, call_inner_instruction_index + , null as fee + , 'token2022' as token_version + FROM {{ source('spl_token_2022_solana','spl_token_2022_call_mintTo') }} + WHERE 1=1 + {% if is_incremental() %} + AND {{incremental_predicate('call_block_time')}} + {% endif %} + + UNION ALL + + SELECT + null as account_source, account_mintTo as account_destination + , bytearray_to_uint256(bytearray_reverse(bytearray_substring(call_data,1+1,8))) as amount + , call_tx_id, call_block_time, call_block_slot, call_outer_executing_account, call_tx_signer + , 'mint' as action + , call_outer_instruction_index, call_inner_instruction_index + , null as fee + , 'token2022' as token_version + FROM {{ source('spl_token_2022_solana','spl_token_2022_call_mintToChecked') }} + WHERE 1=1 + {% if is_incremental() %} + AND {{incremental_predicate('call_block_time')}} + {% endif %} + + UNION ALL + + SELECT + account_burnAccount as account_source, null as account_destination + , bytearray_to_uint256(bytearray_reverse(bytearray_substring(call_data,1+1,8))) as amount + , call_tx_id, call_block_time, call_block_slot, call_outer_executing_account, call_tx_signer + , 'burn' as action + , call_outer_instruction_index, call_inner_instruction_index + , null as fee + , 'token2022' as token_version + FROM {{ source('spl_token_2022_solana','spl_token_2022_call_burn') }} + WHERE 1=1 + {% if is_incremental() %} + AND {{incremental_predicate('call_block_time')}} + {% endif %} + + UNION ALL + + SELECT + account_burnAccount as account_source, null as account_destination + , bytearray_to_uint256(bytearray_reverse(bytearray_substring(call_data,1+1,8))) as amount + , call_tx_id, call_block_time, call_block_slot, call_outer_executing_account, call_tx_signer + , 'burn' as action + , call_outer_instruction_index, call_inner_instruction_index + , null as fee + , 'token2022' as token_version + FROM {{ source('spl_token_2022_solana','spl_token_2022_call_burnChecked') }} + WHERE 1=1 + {% if is_incremental() %} + AND {{incremental_predicate('call_block_time')}} + {% endif %} + + --token2022 transferFeeExtension has some extra complications. It's the only extension with its own transferChecked wrapper (confidential transfers will have this too) + UNION ALL + + SELECT + call_account_arguments[1] as account_source, call_account_arguments[3] as account_destination + , bytearray_to_uint256(bytearray_reverse(bytearray_substring(call_data,1+2,8))) as amount + , call_tx_id, call_block_time, call_block_slot, call_outer_executing_account, call_tx_signer + , 'transfer' as action + , call_outer_instruction_index, call_inner_instruction_index + , bytearray_to_uint256(bytearray_reverse(bytearray_substring(call_data, 1+2+8+1,8))) as fee + , 'token2022' as token_version + FROM {{ source('spl_token_2022_solana','spl_token_2022_call_transferFeeExtension') }} + WHERE bytearray_substring(call_data,1,2) = 0x1a01 --https://github.com/solana-labs/solana-program-library/blob/8f50c6fabc6ec87ada229e923030381f573e0aed/token/program-2022/src/extension/transfer_fee/instruction.rs#L284 + {% if is_incremental() %} + AND {{incremental_predicate('call_block_time')}} + {% endif %} +) + +SELECT + call_block_time as block_time + , cast (date_trunc('day', call_block_time) as date) as block_date + , call_block_slot as block_slot + , action + , amount + , fee + , account_source as from_token_account + , account_destination as to_token_account + , token_version + , call_tx_signer as tx_signer + , call_tx_id as tx_id + , call_outer_instruction_index as outer_instruction_index + , COALESCE(call_inner_instruction_index,0) as inner_instruction_index + , call_outer_executing_account as outer_executing_account +FROM base tr +-- AND call_block_time > now() - interval '90' day --for faster CI testing \ No newline at end of file diff --git a/models/tokens/solana/tokens_solana_transfers.sql b/models/tokens/solana/tokens_solana_transfers.sql index a28903cf3d4..228ba1c332d 100644 --- a/models/tokens/solana/tokens_solana_transfers.sql +++ b/models/tokens/solana/tokens_solana_transfers.sql @@ -14,56 +14,69 @@ \'["ilemi"]\') }}') }} + +WITH +base as ( + SELECT + block_time, + , call_block_slot as block_slot + , action + , amount + , fee + , from_token_account + , to_token_account + , token_version + , tx_signer + , tx_id + , outer_instruction_index + , inner_instruction_index + , outer_executing_account +FROM {{ ref('tokens_solana_spl_transfers') }} +{% if is_incremental() %} +WHERE {{incremental_predicate('block_time')}} +{% endif %} +UNION ALL + SELECT + block_time, + , call_block_slot as block_slot + , action + , amount + , fee + , from_token_account + , to_token_account + , token_version + , tx_signer + , tx_id + , outer_instruction_index + , inner_instruction_index + , outer_executing_account +FROM {{ ref('tokens_solana_token22_spl_transfers') }} +{% if is_incremental() %} +WHERE {{incremental_predicate('block_time')}} +{% endif %} +) + SELECT call_block_time as block_time , cast (date_trunc('day', call_block_time) as date) as block_date , call_block_slot as block_slot , action , amount + , fee , COALESCE(tk_s.token_mint_address, tk_d.token_mint_address) as token_mint_address , tk_s.token_balance_owner as from_owner , tk_d.token_balance_owner as to_owner - , account_source as from_token_account - , account_destination as to_token_account - , call_tx_signer as tx_signer - , call_tx_id as tx_id - , call_outer_instruction_index as outer_instruction_index - , COALESCE(call_inner_instruction_index,0) as inner_instruction_index - , call_outer_executing_account as outer_executing_account -FROM ( - SELECT account_source, account_destination, amount, call_tx_id, call_block_time, call_block_slot, call_outer_executing_account, call_tx_signer, 'transfer' as action, call_outer_instruction_index, call_inner_instruction_index - FROM {{ source('spl_token_solana','spl_token_call_transfer') }} - - UNION ALL - - SELECT account_source, account_destination, amount, call_tx_id, call_block_time, call_block_slot, call_outer_executing_account, call_tx_signer, 'transfer' as action, call_outer_instruction_index, call_inner_instruction_index - FROM {{ source('spl_token_solana','spl_token_call_transferChecked') }} - - UNION ALL - - SELECT null, account_account as account_destination, amount, call_tx_id, call_block_time, call_block_slot, call_outer_executing_account, call_tx_signer, 'mint' as action, call_outer_instruction_index, call_inner_instruction_index - FROM {{ source('spl_token_solana','spl_token_call_mintTo') }} - - UNION ALL - - SELECT null, account_account as account_destination, amount, call_tx_id, call_block_time, call_block_slot, call_outer_executing_account, call_tx_signer, 'mint' as action, call_outer_instruction_index, call_inner_instruction_index - FROM {{ source('spl_token_solana','spl_token_call_mintToChecked') }} - - UNION ALL - - SELECT account_account as account_source, null, amount, call_tx_id, call_block_time, call_block_slot, call_outer_executing_account, call_tx_signer, 'burn' as action, call_outer_instruction_index, call_inner_instruction_index - FROM {{ source('spl_token_solana','spl_token_call_burn') }} - - UNION ALL - - SELECT account_account as account_source, null, amount, call_tx_id, call_block_time, call_block_slot, call_outer_executing_account, call_tx_signer, 'burn' as action, call_outer_instruction_index, call_inner_instruction_index - FROM {{ source('spl_token_solana','spl_token_call_burnChecked') }} -) tr + , from_token_account + , to_token_account + , token_version + , tx_signer + , tx_id + , outer_instruction_index + , inner_instruction_index + , outer_executing_account +FROM base tr --get token and accounts -LEFT JOIN {{ ref('solana_utils_token_accounts') }} tk_s ON tk_s.address = tr.account_source -LEFT JOIN {{ ref('solana_utils_token_accounts') }} tk_d ON tk_d.address = tr.account_destination +INNER JOIN {{ ref('solana_utils_token_accounts') }} tk_s ON tk_s.address = tr.account_source +INNER JOIN {{ ref('solana_utils_token_accounts') }} tk_d ON tk_d.address = tr.account_destination WHERE 1=1 -{% if is_incremental() %} -AND {{incremental_predicate('call_block_time')}} -{% endif %} --- AND call_block_time > now() - interval '600' day \ No newline at end of file +-- AND call_block_time > now() - interval '90' day --for faster CI testing \ No newline at end of file From 0e511dd0dd8bb8895267ecb75bc094f938832f5b Mon Sep 17 00:00:00 2001 From: Alan Ghobadi Date: Wed, 12 Jun 2024 11:53:29 +0200 Subject: [PATCH 106/149] Fix comma (#6146) --- models/tokens/solana/tokens_solana_transfers.sql | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/models/tokens/solana/tokens_solana_transfers.sql b/models/tokens/solana/tokens_solana_transfers.sql index 228ba1c332d..1b960351e34 100644 --- a/models/tokens/solana/tokens_solana_transfers.sql +++ b/models/tokens/solana/tokens_solana_transfers.sql @@ -18,7 +18,7 @@ WITH base as ( SELECT - block_time, + block_time , call_block_slot as block_slot , action , amount @@ -37,7 +37,7 @@ WHERE {{incremental_predicate('block_time')}} {% endif %} UNION ALL SELECT - block_time, + block_time , call_block_slot as block_slot , action , amount From 0157ea277d390143c0168d91e55758332ac90ecf Mon Sep 17 00:00:00 2001 From: Alan Ghobadi Date: Wed, 12 Jun 2024 12:03:55 +0200 Subject: [PATCH 107/149] Fix another typo (#6147) --- models/tokens/solana/tokens_solana_transfers.sql | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/models/tokens/solana/tokens_solana_transfers.sql b/models/tokens/solana/tokens_solana_transfers.sql index 1b960351e34..e17db80c30a 100644 --- a/models/tokens/solana/tokens_solana_transfers.sql +++ b/models/tokens/solana/tokens_solana_transfers.sql @@ -19,7 +19,7 @@ WITH base as ( SELECT block_time - , call_block_slot as block_slot + , block_slot , action , amount , fee @@ -38,7 +38,7 @@ WHERE {{incremental_predicate('block_time')}} UNION ALL SELECT block_time - , call_block_slot as block_slot + , block_slot , action , amount , fee @@ -59,7 +59,7 @@ WHERE {{incremental_predicate('block_time')}} SELECT call_block_time as block_time , cast (date_trunc('day', call_block_time) as date) as block_date - , call_block_slot as block_slot + , block_slot , action , amount , fee From 9b6e70aeef110c0f77a710a8c92f8213d8d4631f Mon Sep 17 00:00:00 2001 From: Alan Ghobadi Date: Wed, 12 Jun 2024 12:11:59 +0200 Subject: [PATCH 108/149] Fix join (#6149) --- models/tokens/solana/tokens_solana_transfers.sql | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/models/tokens/solana/tokens_solana_transfers.sql b/models/tokens/solana/tokens_solana_transfers.sql index e17db80c30a..60f3a96b3a1 100644 --- a/models/tokens/solana/tokens_solana_transfers.sql +++ b/models/tokens/solana/tokens_solana_transfers.sql @@ -76,7 +76,7 @@ SELECT , outer_executing_account FROM base tr --get token and accounts -INNER JOIN {{ ref('solana_utils_token_accounts') }} tk_s ON tk_s.address = tr.account_source -INNER JOIN {{ ref('solana_utils_token_accounts') }} tk_d ON tk_d.address = tr.account_destination +INNER JOIN {{ ref('solana_utils_token_accounts') }} tk_s ON tk_s.address = tr.from_token_account +INNER JOIN {{ ref('solana_utils_token_accounts') }} tk_d ON tk_d.address = tr.to_token_account WHERE 1=1 -- AND call_block_time > now() - interval '90' day --for faster CI testing \ No newline at end of file From bd1bfee3231f30677c0158948122a982c1603de4 Mon Sep 17 00:00:00 2001 From: Alan Ghobadi Date: Wed, 12 Jun 2024 12:22:09 +0200 Subject: [PATCH 109/149] Use correct column name (#6150) --- models/tokens/solana/tokens_solana_transfers.sql | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/models/tokens/solana/tokens_solana_transfers.sql b/models/tokens/solana/tokens_solana_transfers.sql index 60f3a96b3a1..f4b586f81f7 100644 --- a/models/tokens/solana/tokens_solana_transfers.sql +++ b/models/tokens/solana/tokens_solana_transfers.sql @@ -57,8 +57,8 @@ WHERE {{incremental_predicate('block_time')}} ) SELECT - call_block_time as block_time - , cast (date_trunc('day', call_block_time) as date) as block_date + block_time + , cast (date_trunc('day', block_time) as date) as block_date , block_slot , action , amount From 11ac4798618f412ebb5118cc34d4396f480f84d1 Mon Sep 17 00:00:00 2001 From: Alan Ghobadi Date: Wed, 12 Jun 2024 17:46:03 +0200 Subject: [PATCH 110/149] Temporarily exclude lifinity (#6156) --- models/lifinity/lifinity_v1_trades.sql | 1 + models/lifinity/lifinity_v2_trades.sql | 1 + 2 files changed, 2 insertions(+) diff --git a/models/lifinity/lifinity_v1_trades.sql b/models/lifinity/lifinity_v1_trades.sql index 2332c86a102..8d5a4aea042 100644 --- a/models/lifinity/lifinity_v1_trades.sql +++ b/models/lifinity/lifinity_v1_trades.sql @@ -4,6 +4,7 @@ schema = 'lifinity_v1', alias = 'trades', partition_by = ['block_month'], + tags = ['prod_exclude'], materialized = 'incremental', file_format = 'delta', incremental_strategy = 'merge', diff --git a/models/lifinity/lifinity_v2_trades.sql b/models/lifinity/lifinity_v2_trades.sql index b2fa65b9eba..917574ab7c0 100644 --- a/models/lifinity/lifinity_v2_trades.sql +++ b/models/lifinity/lifinity_v2_trades.sql @@ -5,6 +5,7 @@ alias = 'trades', partition_by = ['block_month'], materialized = 'incremental', + tags = ['prod_exclude'], file_format = 'delta', incremental_strategy = 'merge', incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.block_time')], From 077a6f96fb2d854da831ab4a5ecf40cae0704d0c Mon Sep 17 00:00:00 2001 From: Alan Ghobadi Date: Wed, 12 Jun 2024 17:46:18 +0200 Subject: [PATCH 111/149] Solana spl transfers fix (#6157) * Use correct column * WHERE clause --- models/tokens/solana/tokens_solana_spl_transfers.sql | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/models/tokens/solana/tokens_solana_spl_transfers.sql b/models/tokens/solana/tokens_solana_spl_transfers.sql index 2f788049ac5..4e2cf7cf026 100644 --- a/models/tokens/solana/tokens_solana_spl_transfers.sql +++ b/models/tokens/solana/tokens_solana_spl_transfers.sql @@ -125,7 +125,7 @@ SELECT , outer_instruction_index , inner_instruction_index , outer_executing_account - FROM {{ref('tokens_solana_spl_transfers_call_transfer')}} +FROM {{ref('tokens_solana_spl_transfers_call_transfer')}} {% if is_incremental() %} - AND {{incremental_predicate('call_block_time')}} - {% endif %} \ No newline at end of file + WHERE {{incremental_predicate('block_time')}} +{% endif %} \ No newline at end of file From c1ac5d0cd1af578005f0828f7a96c7fd0288be0f Mon Sep 17 00:00:00 2001 From: hildobby Date: Wed, 12 Jun 2024 18:46:13 +0200 Subject: [PATCH 112/149] more cex addresses (#6049) * more cex addresses * add addresses * more * fix * fix * fix * fix * fix --------- Co-authored-by: Alan Ghobadi --- models/cex/cex_evms_addresses.sql | 101 ++++++++++++++++++++----- models/cex/tron/cex_tron_addresses.sql | 22 +++--- 2 files changed, 90 insertions(+), 33 deletions(-) diff --git a/models/cex/cex_evms_addresses.sql b/models/cex/cex_evms_addresses.sql index f12c69af4aa..8745308e4ec 100644 --- a/models/cex/cex_evms_addresses.sql +++ b/models/cex/cex_evms_addresses.sql @@ -157,6 +157,7 @@ FROM (VALUES , (0x904cc2b2694ffa78f04708d6f7de205108213126, 'Deribit', 'Deribit 8', 'hildobby', date '2023-04-06') , (0x63f41034871535cee49996cc47719891fe03dff9, 'Deribit', 'Deribit 9', 'hildobby', date '2023-04-06') , (0x58f56615180a8eea4c462235d9e215f72484b4a3, 'Deribit', 'Deribit 10', 'hildobby', date '2023-11-20') + , (0x9cf8d36f4aab14ef4975ac6c98f896865f0900c5, 'Deribit', 'Deribit 11', 'hildobby', date '2024-06-03') , (0xcfee6efec3471874022e205f4894733c42cbbf64, 'Deribit', 'Deribit Cold 1', 'hildobby', date '2023-11-20') , (0x9fae72d291949ed6fa8b74881328fdc123c645d3, 'Deribit', 'Deribit Celsuis Network Deposit', 'hildobby', date '2023-11-20') -- FTX @@ -190,6 +191,7 @@ FROM (VALUES , (0x23f4569002a5a07f0ecf688142eeb6bcd883eef8, 'Blockchain.com', 'Blockchain.com 4', 'hildobby', date '2023-09-12') , (0x46e0813dcb480517e3e73449761bdc596e424a79, 'Blockchain.com', 'Blockchain.com 5', 'hildobby', date '2023-09-12') , (0x9aa65464b4cfbe3dc2bdb3df412aee2b3de86687, 'Blockchain.com', 'Blockchain.com 6', 'hildobby', date '2023-11-20') + , (0xfc3e21f959551512d68b6b00f8931593d3106151, 'Blockchain.com', 'Blockchain.com 7', 'hildobby', date '2024-06-03') -- Coinbase , (0x71660c4005ba85c37ccec55d0c4493e66fe775d3, 'Coinbase', 'Coinbase 1', 'hildobby', date '2022-08-28') , (0x503828976d22510aad0201ac7ec88293211d23da, 'Coinbase', 'Coinbase 2', 'hildobby', date '2022-08-28') @@ -248,6 +250,7 @@ FROM (VALUES , (0x40ebc1ac8d4fedd2e144b75fe9c0420be82750c6, 'Coinbase', 'Coinbase 55', 'hildobby', date '2024-05-04') , (0x3dd87411a3754deea8cc52c4cf57e2fc254924cc, 'Coinbase', 'Coinbase 56', 'hildobby', date '2024-05-04') , (0x441cacfd43856409b163b90e094bb42aeb70a70e, 'Coinbase', 'Coinbase 57', 'hildobby', date '2024-05-25') + , (0xa14d57f5ea867572b0d239798d2c1dde13153902, 'Coinbase', 'Coinbase 58', 'hildobby', date '2024-05-25') , (0xa090e606e30bd747d4e6245a1517ebe430f0057e, 'Coinbase', 'Coinbase Miscellaneous', 'hildobby', date '2022-08-28') , (0xf6874c88757721a02f47592140905c4336dfbc61, 'Coinbase', 'Coinbase Commerce', 'hildobby', date '2022-08-28') , (0x881d4032abe4188e2237efcd27ab435e81fc6bb1, 'Coinbase', 'Coinbase Commerce 2', 'hildobby', date '2022-08-28') @@ -589,6 +592,7 @@ FROM (VALUES , (0xf881bcb3705926cea9c598ab05a837cf41a833a9, 'HTX', 'HTX 80', 'hildobby', date '2024-04-20') , (0x3c979fb790c86e361738ed17588c1e8b4c4cc49a, 'HTX', 'HTX 81', 'hildobby', date '2024-04-20') , (0xc9610be2843f1618edfedd0860dc43551c727061, 'HTX', 'HTX 82', 'hildobby', date '2024-05-25') + , (0xa91183d7dfcfe39d923071f5527552ab52da6d44, 'HTX', 'HTX 83', 'hildobby', date '2024-06-03') , (0x1d1e10e8c66b67692f4c002c0cb334de5d485e41, 'HTX', 'HTX Old Address 1', 'hildobby', date '2022-08-28') , (0x1b93129f05cc2e840135aab154223c75097b69bf, 'HTX', 'HTX Old Address 2', 'hildobby', date '2022-08-28') , (0xeb6d43fe241fb2320b5a3c9be9cdfd4dd8226451, 'HTX', 'HTX Old Address 3', 'hildobby', date '2022-08-28') @@ -754,8 +758,9 @@ FROM (VALUES , (0xa2f443492bbb1b041fceee5194e2bc133ecc6407, 'Kraken', 'Kraken 56', 'hildobby', date '2023-11-20') , (0x4b6f17856215eab57c29ebfa18b0a0f74a3627bb, 'Kraken', 'Kraken 57', 'hildobby', date '2024-04-04') , (0x8dfee7dbd859989bf3e80c4f64c42b7cd283671b, 'Kraken', 'Kraken 58', 'hildobby', date '2024-04-04') - , (0x3ff7215004fea03c2c745e0476e3f412050e04d1, 'Kraken', 'Kraken 59', 'hildobby', date '2025-05-25') - , (0x0ef6aeb825dc4c9983d551f8afefaae9d79165c6, 'Kraken', 'Kraken 60', 'hildobby', date '2025-05-25') + , (0x3ff7215004fea03c2c745e0476e3f412050e04d1, 'Kraken', 'Kraken 59', 'hildobby', date '2024-05-25') + , (0x0ef6aeb825dc4c9983d551f8afefaae9d79165c6, 'Kraken', 'Kraken 60', 'hildobby', date '2024-05-25') + , (0xa4a6a282a7fc7f939e01d62d884355d79f5046c1, 'Kraken', 'Kraken 61', 'hildobby', date '2024-06-03') , (0xe6a02eefc2612b13f2b3b914009576ce5495ec0e, 'Kraken', 'Kraken Withdrawals 1', 'hildobby', date '2023-11-20') , (0xe9f7ecae3a53d2a67105292894676b00d1fab785, 'Kraken', 'Kraken Hot Wallet', 'hildobby', date '2022-08-28') , (0xd4039ecc40aeda0582036437cf3ec02845da4c13, 'Kraken', 'Kraken ETH Staking', 'hildobby', date '2023-11-20') @@ -812,16 +817,18 @@ FROM (VALUES , (0x731309e453972598ea05d706c6ee6c3c21ab4d2a, 'Bitget', 'Bitget 12', 'hildobby', date '2024-04-20') , (0x842ea89f73add9e4fe963ae7929fdc1e80acdb52, 'Bitget', 'Bitget 13', 'hildobby', date '2024-04-20') , (0xb8cda8d72da558ef8f76a0d928f9652d2b003e2e, 'Bitget', 'Bitget 14', 'hildobby', date '2024-05-25') - , (0x0639556f03714a74a5feeaf5736a4a64ff70d206, 'Bitget', 'Bitget Hot 1', 'hildobby', date '2023-04-06') - , (0x97b9d2102a9a65a26e1ee82d59e42d1b73b68689, 'Bitget', 'Bitget Hot 2', 'hildobby', date '2023-04-06') - , (0x5bdf85216ec1e38d6458c870992a69e38e03f7ef, 'Bitget', 'Bitget Hot 3', 'hildobby', date '2023-04-06') - , (0xe2b406ec9227143a8830229eeb3eb6e24b5c60be, 'Bitget', 'Bitget Hot 4', 'hildobby', date '2023-04-06') - , (0xe6a421f24d330967a3af2f4cdb5c34067e7e4d75, 'Bitget', 'Bitget Hot 5', 'hildobby', date '2023-04-06') - , (0xe80623a9d41f2f05780d9cd9cea0f797fd53062a, 'Bitget', 'Bitget Hot 6', 'hildobby', date '2023-04-06') - , (0xf646d9b7d20babe204a89235774248ba18086dae, 'Bitget', 'Bitget Hot 7', 'hildobby', date '2023-04-06') - , (0x51971c86b04516062c1e708cdc048cb04fbe959f, 'Bitget', 'Bitget Hot 8', 'hildobby', date '2023-11-19') - , (0x149ded7438caf5e5bfdc507a6c25436214d445e1, 'Bitget', 'Bitget Hot 9', 'hildobby', date '2023-11-22') - , (0x1ab4973a48dc892cd9971ece8e01dcc7688f8f23, 'Bitget', 'Bitget Hot 10', 'hildobby', date '2023-03-13') + , (0x0639556f03714a74a5feeaf5736a4a64ff70d206, 'Bitget', 'Bitget 15', 'hildobby', date '2023-04-06') + , (0x97b9d2102a9a65a26e1ee82d59e42d1b73b68689, 'Bitget', 'Bitget 16', 'hildobby', date '2023-04-06') + , (0x5bdf85216ec1e38d6458c870992a69e38e03f7ef, 'Bitget', 'Bitget 17', 'hildobby', date '2023-04-06') + , (0xe2b406ec9227143a8830229eeb3eb6e24b5c60be, 'Bitget', 'Bitget 18', 'hildobby', date '2023-04-06') + , (0xe6a421f24d330967a3af2f4cdb5c34067e7e4d75, 'Bitget', 'Bitget 19', 'hildobby', date '2023-04-06') + , (0xe80623a9d41f2f05780d9cd9cea0f797fd53062a, 'Bitget', 'Bitget 20', 'hildobby', date '2023-04-06') + , (0xf646d9b7d20babe204a89235774248ba18086dae, 'Bitget', 'Bitget 21', 'hildobby', date '2023-04-06') + , (0x51971c86b04516062c1e708cdc048cb04fbe959f, 'Bitget', 'Bitget 22', 'hildobby', date '2023-11-19') + , (0x149ded7438caf5e5bfdc507a6c25436214d445e1, 'Bitget', 'Bitget 23', 'hildobby', date '2023-11-22') + , (0x1ab4973a48dc892cd9971ece8e01dcc7688f8f23, 'Bitget', 'Bitget 24', 'hildobby', date '2023-03-13') + , (0x7651fc1605a58fe9a99f1fe0d6db05d4182a9a93, 'Bitget', 'Bitget 25', 'hildobby', date '2024-06-03') + , (0x6a3f28c47542bd5811ae37ab358d5d7e3ab84127, 'Bitget', 'Bitget 26', 'hildobby', date '2024-06-03') , (0x3a7d1a8c3a8dc9d48a68e628432198a2ead4917c, 'Bitget', 'Bitget Proxy 1', 'hildobby', date '2023-11-22') -- Korbit , (0x0c01089aedc45ab0f43467cceca6b4d3e4170bea, 'Korbit', 'Korbit 1', 'hildobby', date '2023-04-06') @@ -917,12 +924,8 @@ FROM (VALUES , (0xa0b73e1ff0b80914ab6fe0444e65848c4c34450b, 'Crypto.com', 'Crypto.com 19', 'hildobby', date '2023-11-19') , (0x2c2301fdb0bfa06eaabaa0122cbceb2265337c25, 'Crypto.com', 'Crypto.com 20', 'hildobby', date '2024-05-27') , (0x8a161a996617f130d0f37478483afc8c1914db6d, 'Crypto.com', 'Crypto.com 21', 'hildobby', date '2024-05-27') + , (0x546553718b1b255742566f10a34d86fc22f02b1f, 'Crypto.com', 'Crypto.com Deployer', 'hildobby', date '2024-06-03') , (0xae45a8240147e6179ec7c9f92c5a18f9a97b3fca, 'Crypto.com', 'Crypto.com Deposit Funder', 'hildobby', date '2023-11-15') - , (0x3aa370aacf4cb08c7e1e7aa8e8ff9418d73c7e0f, 'Crypto.com', 'Crypto.com USDC-WETH', 'hildobby', date '2024-04-02') - , (0x9ef7e917fb41cc02f78a5c99b42f497ed8979350, 'Crypto.com', 'Crypto.com CRO-WETH', 'hildobby', date '2024-04-02') - , (0x35e8777ec43cb99e935588dcd0305268f06c1274, 'Crypto.com', 'Crypto.com CRO-USDC', 'hildobby', date '2024-04-02') - , (0x50cf1b844068f7dfe89f078fe6d82a7a4a73b180, 'Crypto.com', 'Crypto.com YFI-WETH', 'hildobby', date '2024-05-27') - , (0x4087d0e6e513f260de87408bee9334a5742cfdf4, 'Crypto.com', 'Crypto.com CRO-USDT', 'hildobby', date '2024-05-27') -- Wirex , (0x2f13d388b85e0ecd32e7c3d7f36d1053354ef104, 'Wirex', 'Wirex 1', 'hildobby', date '2023-11-19') , (0xe3f277382419535245a345e923898c2d43f7cbe5, 'Wirex', 'Wirex 2', 'hildobby', date '2023-11-19') @@ -969,6 +972,7 @@ FROM (VALUES , (0x8c128dba2cb66399341aa877315be1054be75da8, 'BitMart', 'BitMart 12', 'hildobby', date '2023-11-23') , (0x6d0d19bdddc5ed1dd501430c9621dd37ebd9062d, 'BitMart', 'BitMart 13', 'hildobby', date '2024-04-04') , (0x5c7bed3cca42e4562877ed88b9aa0f5898ed59b0, 'BitMart', 'BitMart 14', 'hildobby', date '2024-04-04') + , (0x11fc614e2218b479f94636c234bc352ee490efd1, 'BitMart', 'BitMart 15', 'hildobby', date '2024-06-03') , (0x1aac8bc17da523b9bc7470b0c9ed47a83760acef, 'BitMart', 'BitMart Deployer', 'hildobby', date '2023-11-16') , (0xf8f21a32648a540dd8e982ff47bef6be2e823f9e, 'BitMart', 'BitMart Deposit Funder 1', 'hildobby', date '2023-11-23') -- LAToken @@ -1047,6 +1051,7 @@ FROM (VALUES , (0x3fbe1f8fc5ddb27d428aa60f661eaaab0d2000ce, 'Bithumb', 'Bithumb 23', 'hildobby', date '2023-11-24') , (0x6fc48de8f167456b7aa27dd4ecfabba329ea623d, 'Bithumb', 'Bithumb 24', 'hildobby', date '2024-05-04') , (0xb08f3dc596fe40be860cee549b5c0a2f61de9f9f, 'Bithumb', 'Bithumb 25', 'hildobby', date '2024-05-25') + , (0x7be98e1d8f29d23338e61694007d50d67144c7ef, 'Bithumb', 'Bithumb 26', 'hildobby', date '2024-06-03') , (0x560e389a2b032319e742a59ae8bafa62671089fe, 'Bithumb', 'Bithumb Contract', 'hildobby', date '2023-11-16') , (0xbb5a0408fa54287b9074a2f47ab54c855e95ef82, 'Bithumb', 'Bithumb Old Address 1', 'hildobby', date '2022-08-28') , (0x5521a68d4f8253fc44bfb1490249369b3e299a4a, 'Bithumb', 'Bithumb Old Address 2', 'hildobby', date '2022-08-28') @@ -1058,10 +1063,12 @@ FROM (VALUES , (0x83761c6785427f5a27a07c92a9dcfa99947bc4ad, 'Bithumb', 'Bithumb Deposit Funder 4', 'hildobby', date '2023-11-24') , (0xa5dab3c7a3821f6440a10d634e766bfd2750e54e, 'Bithumb', 'Bithumb Deposit Funder 5', 'hildobby', date '2024-04-04') , (0xa84aa98ca1c5dbff58f825e28fad700653439d5f, 'Bithumb', 'Bithumb Deposit Funder 6', 'hildobby', date '2024-05-25') + , (0x3154f72f0a0b9023f1c18505c2b73f9cd1990cae, 'Bithumb', 'Bithumb Deployer 1', 'hildobby', date '2024-06-03') -- Bitso , (0x58b704065b7aff3ed351052f8560019e05925023, 'Bitso', 'Bitso 1', 'hildobby', date '2023-09-12') , (0x29d5527caa78f1946a409fa6acaf14a0a4a0274b, 'Bitso', 'Bitso 2', 'hildobby', date '2023-09-12') , (0x20beea119e70255a8c36e4009c94aedb1f8b8eea, 'Bitso', 'Bitso 3', 'hildobby', date '2024-05-04') + , (0xa01aa2196724a39290f465b3925e5dcafe7f2256, 'Bitso', 'Bitso 4', 'hildobby', date '2024-06-03') -- Stake.com , (0xdebfbe80c8aeba98a32968278463ccb639c6c4e3, 'Stake.com', 'Stake.com 1', 'hildobby', date '2023-11-15') , (0x974caa59e49682cda0ad2bbe82983419a2ecc400, 'Stake.com', 'Stake.com 2', 'hildobby', date '2023-11-15') @@ -1087,6 +1094,7 @@ FROM (VALUES -- BitPay , (0xf2a14015eaa3f9cc987f2c3b62fc93eee41aa5d0, 'BitPay', 'BitPay 1', 'hildobby', date '2023-11-17') , (0x2730ef3c0c180e7f7bcfca249c757421b208e333, 'BitPay', 'BitPay 2', 'hildobby', date '2023-11-17') + , (0x5763a2a8194e9bd0b8140abccb9171f005470324, 'BitPay', 'BitPay 3', 'hildobby', date '2024-06-03') , (0x34e158883efc81c5d92fde785fba48db738711ee, 'BitPay', 'BitPay Invoice 1', 'hildobby', date '2023-11-17') , (0x52de8d3febd3a06d3c627f59d56e6892b80dcf12, 'BitPay', 'BitPay Invoice 2', 'hildobby', date '2023-11-17') -- ChangeNOW @@ -1104,6 +1112,7 @@ FROM (VALUES , (0x7a3bea333246efcd74ebf5835987a5398eac10fe, 'ChangeNOW', 'ChangeNOW 12', 'hildobby', date '2023-11-20') , (0xd5b73fc035d4d679234323e0d891cab4a4f5a1ab, 'ChangeNOW', 'ChangeNOW 13', 'hildobby', date '2023-11-23') , (0x8f54972f4ca40bd3ffc8b085f6ece1739c40c65f, 'ChangeNOW', 'ChangeNOW 14', 'hildobby', date '2024-05-04') + , (0x3421230289980b8ea81781b170ef7d475673102b, 'ChangeNOW', 'ChangeNOW 15', 'hildobby', date '2024-06-03') , (0xa4e5961b58dbe487639929643dcb1dc3848daf5e, 'ChangeNOW', 'ChangeNOW Deposit Funder 1', 'hildobby', date '2023-11-15') , (0x4657f866a0d9b46f288893fff466e8d87c556b1a, 'ChangeNOW', 'ChangeNOW Deposit Funder 2', 'hildobby', date '2023-11-20') , (0x637c86b5f2c8399716964c702bcaeabc69b900df, 'ChangeNOW', 'ChangeNOW Deposit Funder 3', 'hildobby', date '2023-11-20') @@ -1177,6 +1186,7 @@ FROM (VALUES , (0x4fe6c1a64e7fbff55a6517ef85489ca187a91bbf, 'HitBTC', 'HitBTC 7', 'hildobby', date '2023-09-09') , (0x04ecc5ba3258840725fd808be0fae3430b8346f2, 'HitBTC', 'HitBTC 8', 'hildobby', date '2023-11-20') , (0x4c34ae54dc716808e94af3d1d638b8ea3a23fa9b, 'HitBTC', 'HitBTC 9', 'hildobby', date '2023-11-20') + , (0xf07232bc85d995c32c1edf1c985c84a8b7b0ded7, 'HitBTC', 'HitBTC 10', 'hildobby', date '2024-06-03') , (0xfdeda15e2922c5ed41fc1fdf36da2fb2623666b3, 'HitBTC', 'HitBTC Deposit Funder 1', 'hildobby', date '2023-08-31') , (0xad68942a95fdd56594aa5cf862b358790e37834c, 'HitBTC', 'HitBTC Deposit Funder 2', 'hildobby', date '2023-08-31') , (0x0113a6b755fbad36b4249fd63002e2035e401143, 'HitBTC', 'HitBTC Deposit Funder 3', 'hildobby', date '2023-08-31') @@ -1185,6 +1195,7 @@ FROM (VALUES , (0x9036b1eb7630d9a45720fd80d05d46262f460529, 'BTSE', 'BTSE 2', 'hildobby', date '2023-09-12') , (0xddaad971be05321fd541372cd710a7f0555972ed, 'BTSE', 'BTSE 3', 'hildobby', date '2023-11-20') , (0xde279a5cd86860cd3d039aa1b74bc29e74cabb12, 'BTSE', 'BTSE 4', 'hildobby', date '2024-01-04') + , (0x661bc014ba045a1918215cbe2af8121ada09638d, 'BTSE', 'BTSE 5', 'hildobby', date '2024-06-03') , (0x1619d743d7dc612e99d5d94ebd6b9695d46f0bf3, 'BTSE', 'BTSE WBTC Merchant', 'hildobby', date '2024-01-04') , (0xb0afffd6f6ad77f61927803ade6dbd47f1a1c356, 'BTSE', 'BTSE Cobo Deposit', 'hildobby', date '2023-11-20') -- Voyager @@ -1226,6 +1237,7 @@ FROM (VALUES , (0xbfc39b6f805a9e40e77291aff27aee3c96915bdd, 'Poloniex', 'Poloniex 5', 'hildobby', date '2023-11-17') , (0xdf21fa922215b1a56f5a6d6294e6e36c85a0acfb, 'Poloniex', 'Poloniex 6', 'hildobby', date '2023-11-17') , (0x8fca4ade3a517133ff23ca55cdaea29c78c990b8, 'Poloniex', 'Poloniex 7', 'hildobby', date '2024-04-04') + , (0x007abbe8057433641acb791d966d33a12cf82d01, 'Poloniex', 'Poloniex 8', 'hildobby', date '2024-06-03') , (0xb42b20ddbeabdc2a288be7ff847ff94fb48d2579, 'Poloniex', 'Poloniex Deposit Funder', 'hildobby', date '2023-09-09') , (0xaa9fa73dfe17ecaa2c89b39f0bb2779613c5fc3b, 'Poloniex', 'Poloniex BAT', 'hildobby', date '2022-08-28') , (0x2fa2bc2ce6a4f92952921a4caa46b3727d24a1ec, 'Poloniex', 'Poloniex BNT', 'hildobby', date '2022-08-28') @@ -1258,11 +1270,13 @@ FROM (VALUES , (0x264bd8291fae1d75db2c5f573b07faa6715997b5, 'Paxos', 'Paxos 4', 'hildobby', date '2023-11-15') , (0x7d766b06e7164be4196ee62e6036c9fcff68107d, 'Paxos', 'Paxos 5', 'hildobby', date '2023-11-15') , (0x41b309236c87b1bc6fa8eb865833e44158fa991a, 'Paxos', 'Paxos 6', 'hildobby', date '2024-05-04') + , (0x5195427ca88df768c298721da791b93ad11eca65, 'Paxos', 'Paxos Treasury 1', 'hildobby', date '2024-05-04') , (0x8a89e016750479dc1d7ad32ecffcecd76e118697, 'Paxos', 'Paxos Deposit Funder 1', 'hildobby', date '2023-11-23') -- DigiFinex , (0xe17ee7b3c676701c66b395a35f0df4c2276a344e, 'DigiFinex', 'DigiFinex 1', 'hildobby', date '2022-08-28') , (0xb2ca9495f3e1972801c12a964fa344a6630f427a, 'DigiFinex', 'DigiFinex 2', 'hildobby', date '2023-11-22') + , (0xb37640f5f7ef7b0fdcce2c0c053db4f976945647, 'DigiFinex', 'DigiFinex 3', 'hildobby', date '2024-06-03') , (0x3b73d7e1266e02a68185f5221a6718db04df6301, 'DigiFinex', 'DigiFinex Deployer 1', 'hildobby', date '2023-08-31') , (0x1b930c43526b09191a74175eaa47f2a650aeb73d, 'DigiFinex', 'DigiFinex Deployer 2', 'hildobby', date '2023-08-31') -- MEXC @@ -1356,6 +1370,7 @@ FROM (VALUES , (0xe9d2afff18f08375d5b7a8a804e272b6c81ceb9f, 'CoinTiger', 'CoinTiger 2', 'hildobby', date '2023-11-18') , (0xfbdeb87969f5610d006d1a4ed79308a5778e77e5, 'CoinTiger', 'CoinTiger 3', 'hildobby', date '2023-11-18') , (0x77f814f8ccba595b83c69e587b159e9887890639, 'CoinTiger', 'CoinTiger 4', 'hildobby', date '2024-05-25') + , (0x707c6f7d35798780cefce81b747392198566a186, 'CoinTiger', 'CoinTiger 5', 'hildobby', date '2024-06-03') , (0x0e58a7652143a0a275750e5ac57a4fb14eb4a18d, 'CoinTiger', 'CoinTiger Deposit Funder 1', 'hildobby', date '2023-11-23') -- CoinEx , (0xb9ee1e551f538a464e8f8c41e9904498505b49b0, 'CoinEx', 'CoinEx 1', 'hildobby', date '2022-08-28') @@ -1374,6 +1389,7 @@ FROM (VALUES , (0x85cf05f35b6d542ac1d777d3f8cfde57578696fc, 'CoinEx', 'CoinEx 14', 'hildobby', date '2024-04-20') , (0xda07f1603a1c514b2f4362f3eae7224a9cdefaf9, 'CoinEx', 'CoinEx 15', 'hildobby', date '2024-04-20') , (0xb55270a75d548de1f7b89ea571438e9745465644, 'CoinEx', 'CoinEx 16', 'hildobby', date '2024-05-04') + , (0x3339afcb8e237aa8aaf3e1040473173830efd09c, 'CoinEx', 'CoinEx 17', 'hildobby', date '2024-06-03') , (0x5cf44f2cb65af7d56b30719312ecd13151a0470b, 'CoinEx', 'CoinEx Deposit Funder 1', 'sankinyue', date '2023-09-13') , (0x1e450c2a1870a52606edd37ac0bf593dca9c1c3f, 'CoinEx', 'CoinEx Deposit Funder 2', 'sankinyue', date '2023-09-13') , (0x6fdbe6bec0b63334c0dc26623ca9c58dfc158c4e, 'CoinEx', 'CoinEx Deposit Funder 3', 'hildobby', date '2023-11-23') @@ -1399,6 +1415,7 @@ FROM (VALUES , (0x9bd376bfce4b97c6fae3f438d516ae1582168596, 'AscendEX', 'AscendEX 5', 'hildobby', date '2023-11-22') , (0x983873529f95132bd1812a3b52c98fb271d2f679, 'AscendEX', 'AscendEX 6', 'hildobby', date '2023-11-22') , (0x4240781a9ebdb2eb14a183466e8820978b7da4e2, 'AscendEX', 'AscendEX 7', 'hildobby', date '2023-11-22') + , (0x8fab0d3e5ee6ffdb73589c2c47dcd3802360694f, 'AscendEX', 'AscendEX 8', 'hildobby', date '2024-06-03') , (0x09344477fdc71748216a7b8bbe7f2013b893def8, 'AscendEX', 'AscendEX Deposit Funder 1', 'hildobby', date '2023-08-31') , (0x9715254754284a0b3e4c7bf8f57e790415041c1c, 'AscendEX', 'AscendEX Deposit Funder 2', 'hildobby', date '2023-11-22') -- CoinSpot @@ -1421,6 +1438,7 @@ FROM (VALUES , (0xdb6fdc30ab61c7cca742d4c13d1b035f3f82019a, 'CoinSpot', 'CoinSpot 17', 'hildobby', date '2023-11-22') , (0xeed86b90448c371eab47b7f16e294297c27e4f51, 'CoinSpot', 'CoinSpot 18', 'hildobby', date '2023-11-22') , (0x60f9e80d0d40b2958ac39006635de782096866c3, 'CoinSpot', 'CoinSpot 19', 'hildobby', date '2024-05-26') + , (0x32e567e8b527d3194c60ea3c6a5c009d58a0b36d, 'CoinSpot', 'CoinSpot 20', 'hildobby', date '2024-06-03') , (0x20312e96b1a0568ac31c6630844a962383cc66c2, 'CoinSpot', 'CoinSpot Deposit Funder 1', 'hildobby', date '2023-11-23') -- Liquid , (0xedbb72e6b3cf66a792bff7faac5ea769fe810517, 'Liquid', 'Liquid 1', 'hildobby', date '2022-08-28') @@ -1432,6 +1450,7 @@ FROM (VALUES , (0xccdfdc87341605200a3582ab52350fb4fb261ab0, 'Liquid', 'Liquid 7', 'hildobby', date '2023-11-22') , (0x9f571bb918e98b8deb462f14c54a3e36ad43627a, 'Liquid', 'Liquid 8', 'hildobby', date '2023-11-22') , (0x07445065963c2d563cd70ddf2aa49fc771e59a98, 'Liquid', 'Liquid 9', 'hildobby', date '2023-11-22') + , (0x8e01ef6a4d864698ff80b419fe9ec2e3c85e9e9e, 'Liquid', 'Liquid 10', 'hildobby', date '2024-06-03') , (0x618e75ac90b12c6049ba3b27f5d5f8651b0037f6, 'Liquid', 'Liquid QASH Token', 'hildobby', date '2023-11-22') , (0x3c0a69cbb7e0830f8fab41f11f75100f886998a6, 'Liquid', 'Liquid Celsuis Deposit', 'hildobby', date '2023-11-22') -- Tidex @@ -1515,6 +1534,7 @@ FROM (VALUES , (0xe4516477adacc6682cf18069475f676a5b5667f9, 'BingX', 'BingX 10', 'hildobby', date '2024-04-04') , (0x6c69fa64ec451b1bc5b5fbaa56cf648a281634be, 'BingX', 'BingX 11', 'hildobby', date '2024-04-04') , (0x1651d700cd4020334bd185ba4c6e0271ffc0c732, 'BingX', 'BingX 12', 'hildobby', date '2024-04-04') + , (0xed5e461999b1fedd00797a818edd75c727ed948f, 'BingX', 'BingX 13', 'hildobby', date '2024-06-03') , (0xb48c5ca99d33a8625e125f69ac8e07f3dffe34a0, 'BingX', 'BingX Deposit Funder 1', 'hildobby', date '2023-11-17') , (0xdec815281519f6cb080090317e0ba3e446fafe43, 'BingX', 'BingX Deposit Funder 2', 'hildobby', date '2024-05-04') -- Bitvavo @@ -1553,6 +1573,7 @@ FROM (VALUES , (0x8c54ebdd960056d2cff5998df5695daca1fc0190, 'BtcTurk', 'BtcTurk 7', 'hildobby', date '2023-11-23') , (0xd2589c4061bf45a9a5212846aa72c2ed46377145, 'BtcTurk', 'BtcTurk 8', 'hildobby', date '2023-11-23') , (0x16769e533352798deb664ba570230a758346ca1a, 'BtcTurk', 'BtcTurk 9', 'hildobby', date '2023-11-23') + , (0x2ee555c9006a9dc4674f01e0d4dfc58e013708f0, 'BtcTurk', 'BtcTurk 10', 'hildobby', date '2024-06-03') , (0x46f80018211d5cbbc988e853a8683501fca4ee9b, 'BtcTurk', 'BtcTurk Cold 1', 'hildobby', date '2023-11-23') , (0x9fcafcca8aec0367abb35fbd161c241f7b79891b, 'BtcTurk', 'BtcTurk Deprecated 1', 'hildobby', date '2023-11-23') -- Trade.io @@ -1626,6 +1647,11 @@ FROM (VALUES -- AltCoinTrader , (0xc58bb74606b73c5043b75d7aa25ebe1d5d4e7c72, 'AltCoinTrader', 'AltCoinTrader 1', 'hildobby', date '2023-11-24') , (0xff2e0c46c7673ccd00cb5b59dc1686229a483fc8, 'AltCoinTrader', 'AltCoinTrader 2', 'hildobby', date '2023-11-24') + , (0x1bc972db7b169c2d79719485803af1a23645108d, 'AltCoinTrader', 'AltCoinTrader 3', 'hildobby', date '2024-06-03') + , (0xa1495f85d30acab5126f5c1920cd9cb1ce265263, 'AltCoinTrader', 'AltCoinTrader 4', 'hildobby', date '2024-06-03') + , (0xe1336fa8165bc4dbadc7fb95718a3c9dcae23fdc, 'AltCoinTrader', 'AltCoinTrader 5', 'hildobby', date '2024-06-03') + , (0xa2fe6ec4244ee94853326f70893ce5ee20aa4ffb, 'AltCoinTrader', 'AltCoinTrader 6', 'hildobby', date '2024-06-03') + , (0xb56f9e1aecb821413c9f14822d3918a363d83226, 'AltCoinTrader', 'AltCoinTrader 7', 'hildobby', date '2024-06-03') , (0x87b7ba194ed714a871c91f6b9ba8dc8182ed3a5d, 'AltCoinTrader', 'AltCoinTrader Cold 1', 'hildobby', date '2023-11-24') , (0x2cf4e5b4fa8afa15f8dc7b5ada853e42776f3455, 'AltCoinTrader', 'AltCoinTrader Celsuis Deposit 1', 'hildobby', date '2023-11-24') , (0x0da044b16bb53ab6d6691e25b1ec7ad380fa5fa7, 'AltCoinTrader', 'AltCoinTrader Binance Deposit 1', 'hildobby', date '2023-11-24') @@ -1661,9 +1687,13 @@ FROM (VALUES -- Bitcoin Suisse , (0x7b4576d06d0ce1f83f9a9b76bf8077bffd34fcb1, 'Bitcoin Suisse', 'Bitcoin Suisse 1', 'hildobby', date '2023-11-23') , (0x3f262579e4332e1be2722684eaa1c1b111f7a8d8, 'Bitcoin Suisse', 'Bitcoin Suisse 2', 'hildobby', date '2024-05-27') + , (0x31dff0cf605f9719b9171f6049150595cc1240f1, 'Bitcoin Suisse', 'Bitcoin Suisse 3', 'hildobby', date '2024-06-01') + , (0xc2288b408dc872a1546f13e6ebfa9c94998316a2, 'Bitcoin Suisse', 'Bitcoin Suisse 4', 'hildobby', date '2024-06-01') + , (0xfcb7edb966d320c7f3ae1f751a8c86f30fa5ad37, 'Bitcoin Suisse', 'Bitcoin Suisse Binance Deposit 1', 'hildobby', date '2024-06-01') , (0x2a7077399b3e90f5392d55a1dc7046ad8d152348, 'Bitcoin Suisse', 'Bitcoin Suisse ETH Staking 1', 'hildobby', date '2023-11-23') -- Bitci , (0xe954b098b80d43fd66af4a58400c05e62b087b72, 'Bitci', 'Bitci 1', 'hildobby', date '2023-11-23') + , (0x7a91a362d4f2c9c4627688d5b7090bbb12e5715f, 'Bitci', 'Bitci 2', 'hildobby', date '2024-06-03') -- GMO Coin , (0x9c4fa4ee466dff080adccb12d39b99e83cdb1077, 'GMO Coin', 'GMO Coin 1', 'hildobby', date '2023-11-23') , (0xc39bdf685f289b1f261ee9b0b1b2bf9eae4c1980, 'GMO Coin', 'GMO Coin 2', 'hildobby', date '2023-11-23') @@ -1737,6 +1767,7 @@ FROM (VALUES , (0xb9c764114c5619a95d7f232594e3b8dddf95b9cf, 'Bitkub', 'Bitkub 5', 'hildobby', date '2023-09-12') , (0xca7404eed62a6976afc335fe08044b04dbb7e97d, 'Bitkub', 'Bitkub 6', 'hildobby', date '2023-09-12') , (0x6254b927ecc25ddd233aaecd5296d746b1c006b4, 'Bitkub', 'Bitkub 7', 'hildobby', date '2023-09-12') + , (0x79169e7818968cd0c6dbd8929f24d797cc1af9a1, 'Bitkub', 'Bitkub Multisig 1', 'hildobby', date '2024-06-03') , (0x9be7b0f285d04701f27682f591a60417c47d095a, 'Bitkub', 'Bitkub Deposit Funder 1', 'hildobby', date '2023-11-15') , (0x49876520c866d138dd749d6c2c33e4da5bfaec66, 'Bitkub', 'Bitkub Deposit Funder 2', 'hildobby', date '2023-11-23') -- Indodax @@ -1772,7 +1803,8 @@ FROM (VALUES , (0xf6ee635c28dda95a74ba989807000cbe00317d27, 'FixedFloat', 'FixedFloat 4', 'hildobby', date '2024-05-25') -- Bitrue , (0x6cc8dcbca746a6e4fdefb98e1d0df903b107fd21, 'Bitrue', 'Bitrue 1', 'hildobby', date '2022-08-28') - , (0xf4c62b4f8b7b1b1c4ba88bfd3a8ea392641516e9, 'Bitrue', 'Bitrue 2', 'hildobby', date '2023-11-23') + , (0xd205a958527f083f1b222061b4d60d147fec5044, 'Bitrue', 'Bitrue 2', 'hildobby', date '2024-06-03') + , (0xf4c62b4f8b7b1b1c4ba88bfd3a8ea392641516e9, 'Bitrue', 'Bitrue Deposit Funder 1', 'hildobby', date '2023-11-23') -- Coinmetro , (0xa270f3ad1a7a82e6a3157f12a900f1e25bc4fbfd, 'Coinmetro', 'Coinmetro 1', 'hildobby', date '2022-08-28') , (0x4cf2220105995f006813923019f02be1ccca8132, 'Coinmetro', 'Coinmetro 2', 'hildobby', date '2023-11-23') @@ -1815,6 +1847,7 @@ FROM (VALUES -- IDEX , (0x2a0c0dbecc7e4d658f48e01e3fa353f44050c208, 'IDEX', 'IDEX 1', 'hildobby', date '2023-09-08') , (0xa7a7899d944fe658c4b0a1803bab2f490bd3849e, 'IDEX', 'IDEX 2', 'hildobby', date '2023-09-08') + , (0x8af97264482b59c7aa11010907710dee6d8d8c6c, 'IDEX', 'IDEX 3', 'hildobby', date '2024-06-03') -- Flata Exchange , (0x14301566b9669b672878d86ff0b1d18dd58054e9, 'Flata Exchange', 'Flata Exchange', 'hildobby', date '2022-08-28') -- XT.com @@ -1823,6 +1856,7 @@ FROM (VALUES , (0xcab044b301d94875ac1502b73e54d63b0162c70f, 'XT.com', 'XT.com 3', 'hildobby', date '2024-05-04') , (0xb98486f2df13ba242f173ffcbff5c122b4d95a16, 'XT.com', 'XT.com 4', 'hildobby', date '2024-05-04') , (0xe0a616c3659be29567e08819772e6905307adf21, 'XT.com', 'XT.com 5', 'hildobby', date '2024-05-04') + , (0xe5b8ff1ca1c3ef2ac704783d6473ee5a9be7e02d, 'XT.com', 'XT.com 6', 'hildobby', date '2024-06-03') , (0x4fd7c9bdb194f3cf0589803d0a664a80e59ebfa6, 'XT.com', 'XT.com Deposit Funder 1', 'hildobby', date '2024-05-04') -- BitBase , (0x0d8824ca76e627e9cc8227faa3b3993986ce9e48, 'BitBase', 'BitBase 1', 'hildobby', date '2022-08-28') @@ -1861,6 +1895,7 @@ FROM (VALUES , (0x611f32e5d7f6640ecaf3e66759318abb9cbece64, 'CoinW', 'CoinW 18', 'hildobby', date '2024-04-20') , (0xbf2d58698a8a215f868cf24baba360c77266b466, 'CoinW', 'CoinW 19', 'hildobby', date '2024-04-20') , (0xe48a4e20be4ea888748c56bdcb632d960cbfb011, 'CoinW', 'CoinW 20', 'hildobby', date '2024-04-20') + , (0x3974d816a969908a82428384c728fbd8faffbfe1, 'CoinW', 'CoinW 21', 'hildobby', date '2024-06-03') , (0xdcc06bb2a55169a897e8b4148f151d7574eff66c, 'CoinW', 'CoinW Deposit Funder 1', 'hildobby', date '2023-11-23') , (0x83a0b03e76c88052cd7989edeab80aa4cacc66b5, 'CoinW', 'CoinW Deposit Funder 2', 'hildobby', date '2023-11-23') , (0x2ae40eeaf27a28d31eabb050dac2e0568c7b1a7e, 'CoinW', 'CoinW Deposit Funder 3', 'hildobby', date '2023-11-23') @@ -1894,6 +1929,7 @@ FROM (VALUES , (0x0000bf7f4e4b7fb2315fc6d5d0f8854c91dff1d8, 'Hoo.com', 'Hoo.com 12', 'hildobby', date '2023-11-23') , (0x4d4ffb448194504242267585f0ea6f9de6a96de3, 'Hoo.com', 'Hoo.com Deposit Funder 1', 'hildobby', date '2023-08-31') , (0x74a73578e56b43aa9c088e013c5b7bd91aa5221a, 'Hoo.com', 'Hoo.com Deposit Funder 2', 'hildobby', date '2023-11-24') + , (0x00ddb997c6b6015e187e9a242ff081df23c2dac8, 'Hoo.com', 'Hoo.com Deposit Funder 3', 'hildobby', date '2024-06-03') -- Sideshift , (0xcdd37ada79f589c15bd4f8fd2083dc88e34a2af2, 'Sideshift', 'Sideshift 1', 'hildobby', date '2023-11-16') , (0x6cf6a8488d70b1743134d6d69950cda60325a42f, 'Sideshift', 'Sideshift 2', 'hildobby', date '2023-11-16') @@ -1968,6 +2004,13 @@ FROM (VALUES , (0xde528ecec4f16cc20bfafad23b41388343c243c4, 'Bidesk', 'Bidesk 26', 'hildobby', date '2023-11-23') , (0xe05b4bdf83274545e64f4f19db75e64e6492a3b3, 'Bidesk', 'Bidesk 27', 'hildobby', date '2023-11-23') , (0x8d76166c22658a144c0211d87abf152e6a2d9d95, 'Bidesk', 'Bidesk 28', 'hildobby', date '2023-11-23') + , (0x5388cbdb0a5b760953fbbae2bd341c4a06b8dd79, 'Bidesk', 'Bidesk 29', 'hildobby', date '2024-06-03') + , (0x8c699a889413893ca1f03ba6405ae66c66f955e6, 'Bidesk', 'Bidesk 30', 'hildobby', date '2024-06-03') + , (0xf1f178e5cf884134a72d48d07f259894390ff1f9, 'Bidesk', 'Bidesk 31', 'hildobby', date '2024-06-03') + , (0x1f13246d1d34f5ae1c588dbea54248451801065f, 'Bidesk', 'Bidesk 32', 'hildobby', date '2024-06-03') + , (0x0c2f8e43cc0d7184d1057620994fa32f03f64a8d, 'Bidesk', 'Bidesk 33', 'hildobby', date '2024-06-03') + , (0x5d027af50ae06f210bc8ed64f183c248eb95eac8, 'Bidesk', 'Bidesk 34', 'hildobby', date '2024-06-03') + , (0x96c604c94dcc5e356d1818f321cec9826675964b, 'Bidesk', 'Bidesk 35', 'hildobby', date '2024-06-03') , (0x7423931617700331fa34d2df2b58ee809626625b, 'Bidesk', 'Bidesk Deposit Funder 1', 'hildobby', date '2023-11-23') -- Bitbee , (0x2b49ce21ad2004cfb3d0b51b2e8ec0406d632513, 'Bitbee', 'Bitbee 1', 'hildobby', date '2023-04-06') @@ -2144,6 +2187,7 @@ FROM (VALUES , (0x22bf0a4c4eff418b3306abfee20813d0b6e8dc74, 'SwissBorg', 'SwissBorg 12', 'hildobby', date '2024-04-20') , (0x67fe3293fc4e877f3cdc3f0ed93721a600f72bde, 'SwissBorg', 'SwissBorg 13', 'hildobby', date '2024-04-20') , (0xff4606bd3884554cdbdabd9b6e25e2fad4f6fc54, 'SwissBorg', 'SwissBorg 14', 'hildobby', date '2024-04-20') + , (0x0a52368d5a7e70d8c927f75ea6618c2c468031d4, 'SwissBorg', 'SwissBorg 15', 'hildobby', date '2024-06-03') , (0x43fda7708c97c4c40d5402c6392f0457f23c0b8e, 'SwissBorg', 'SwissBorg Deposit Funder 1', 'hildobby', date '2023-11-23') , (0xa5546c4bc006d23b60d690d3033b8df40cecc230, 'SwissBorg', 'SwissBorg Deposit Funder 2', 'hildobby', date '2023-11-23') , (0xcdf2bfd0ff20811c98471b331db19aabf3d3b972, 'SwissBorg', 'SwissBorg Deposit Funder 3', 'hildobby', date '2023-11-23') @@ -2168,6 +2212,7 @@ FROM (VALUES -- Freewallet , (0x7ed1e469fcb3ee19c0366d829e291451be638e59, 'Freewallet', 'Freewallet 1', 'hildobby', date '2023-09-09') , (0x6025d96932d378be7d0a46343b437678a126ecca, 'Freewallet', 'Freewallet 2', 'hildobby', date '2024-05-25') + , (0x4834e61f91ec2304cf51b590073f3c9ff8161446, 'Freewallet', 'Freewallet 3', 'hildobby', date '2024-06-03') , (0x8dd640228e1eb91e05d58206f3d9b0ccaf21bcf1, 'Freewallet', 'Freewallet Deposit Funder 1', 'hildobby', date '2024-05-25') -- Phemex , (0xf7d13c7dbec85ff86ee815f6dcbb3dedac78ca49, 'Phemex', 'Phemex 1', 'hildobby', date '2023-04-06') @@ -2220,6 +2265,7 @@ FROM (VALUES , (0xd7aed730a7c4cf8dfe313b16712af3406f6dca5b, 'MaskEX', 'MaskEX 32', 'hildobby', date '2023-11-22') , (0x6db133e840376555a5ad5c1d7616872ef57e7f13, 'MaskEX', 'MaskEX 33', 'hildobby', date '2023-11-22') , (0xdca6951b82e82af6aab4bb9e90ca00f5760370e1, 'MaskEX', 'MaskEX 34', 'hildobby', date '2023-11-22') + , (0x32fffc894503eba55af4c371fd50198e7356d780, 'MaskEX', 'MaskEX 35', 'hildobby', date '2024-06-03') -- Nexo , (0x00ee047a66d5cff27587a61559138c26b62f7ceb, 'Nexo', 'Nexo 1', 'hildobby', date '2023-09-09') , (0xffec0067f5a79cff07527f63d83dd5462ccf8ba4, 'Nexo', 'Nexo 2', 'hildobby', date '2023-09-09') @@ -2249,13 +2295,19 @@ FROM (VALUES -- Woo X , (0x03dd167d62e1dfc223ffd7b37fc8bf45fb973478, 'Woo X', 'Woo X 1', 'hildobby', date '2024-01-04') , (0x63dfe4e34a3bfc00eb0220786238a7c6cef8ffc4, 'Woo X', 'Woo X 2', 'hildobby', date '2023-04-07') - , (0xe505bf08c03cc0fa4e0fdfa2487e2c11085b3fd9, 'Woo x', 'Woo X 3', 'hildobby', date '2023-04-07') + , (0xe505bf08c03cc0fa4e0fdfa2487e2c11085b3fd9, 'Woo X', 'Woo X 3', 'hildobby', date '2023-04-07') , (0xea319fd75766f5180018f8e760f51c3d3c457496, 'Woo X', 'Woo X 4', 'hildobby', date '2023-04-07') + , (0x1e6dce7ce381774286abb8c9aac461bb7b1c4b05, 'Woo X', 'Woo X 5', 'hildobby', date '2024-06-03') + , (0xeef97691d3307b4e61522170f648ee2df1312fee, 'Woo X', 'Woo X 6', 'hildobby', date '2024-06-03') + , (0x594203e46e0b41b1edb54a551e7784c194d1335b, 'Woo X', 'Woo X 7', 'hildobby', date '2024-06-03') + , (0x607e062e3986a16283047beaed1a7dc3e220ff0e, 'Woo X', 'Woo X 8', 'hildobby', date '2024-06-03') , (0x0d83f81bc9f1e8252f87a4109bbf0d90171c81df, 'Woo X', 'Woo X Staking Cold 1', 'hildobby', date '2024-01-06') , (0x1326a1f39746726fdcfe88d83effe5451606ae85, 'Woo X', 'Woo X Liquidity Token Vault', 'hildobby', date '2024-01-04') , (0xf0b8660476ea1af0f363de8816e3e7cd1c8f1fde, 'Woo X', 'Woo X Ecosystem Token Vault', 'hildobby', date '2024-01-04') , (0xe2933566f172d08f8c90144fed5ae28e9d54b1ec, 'Woo X', 'Woo X Team', 'hildobby', date '2024-01-04') - , (0x15271e572267def474366bb683719cc59489efbe, 'Woo X', 'Woo X Treasury', 'hildobby', date '2024-01-04') + , (0x15271e572267def474366bb683719cc59489efbe, 'Woo X', 'Woo X Treasury 1', 'hildobby', date '2024-01-04') + , (0xd7d8bcae65537cb5079a4fb249b9fbb4526e4084, 'Woo X', 'Woo X Treasury 2', 'hildobby', date '2024-06-03') + , (0xe64eb20471491956338eedc0f98242bc3ad0c91b, 'Woo X', 'Woo X Deployer 1', 'hildobby', date '2024-06-03') -- FastEx , (0x85e1de87a7575c6581f7930f857a3813b66a14d8, 'FastEx', 'FastEx 1', 'hildobby', date '2023-11-23') , (0xc21a1d213f64fedea3415737cce2be37eb59be81, 'FastEx', 'FastEx 2', 'hildobby', date '2023-11-23') @@ -2300,6 +2352,7 @@ FROM (VALUES , (0x052ed0ad68ffc470386fdab82f7046e0b55fd663, 'Norwegian Block Exchange', 'Norwegian Block Exchange 4', 'hildobby', date '2023-11-22') , (0xfaccb74832546a745aab8dbd2d155dc67a222048, 'Norwegian Block Exchange', 'Norwegian Block Exchange 5', 'hildobby', date '2023-11-22') , (0x0d019414ac7dd7e8262ae7dc9efcc6bde050b0dd, 'Norwegian Block Exchange', 'Norwegian Block Exchange 6', 'hildobby', date '2023-11-22') + , (0x0d075ccd8fe8c5c8e28a308f66422db3456eb9cc, 'Norwegian Block Exchange', 'Norwegian Block Exchange 7', 'hildobby', date '2024-06-03') -- eXch.sc , (0xf1da173228fcf015f43f3ea15abbb51f0d8f1123, 'eXch.sc', 'eXch.sc 1', 'hildobby', date '2024-01-04') -- Tokenize Xchange @@ -2416,16 +2469,19 @@ FROM (VALUES , (0xab5a9fcb27e4f97e87a536e768b9cb49dc8b1a4f, 'Matrixport', 'Matrixport 3', 'hildobby', date '2024-01-04') -- Netcoins , (0x404460039499c774c48248552f802ce5dd482e32, 'Netcoins', 'Netcoins 1', 'hildobby', date '2024-01-04') + , (0xe3743d1bf4bdc86bf1faac0ffe325a23cf495ad7, 'Netcoins', 'Netcoins 2', 'hildobby', date '2024-06-03') , (0xba20996529d2722c4d9d800a7b20e96a0a235336, 'Netcoins', 'Netcoins MultiSig 1', 'hildobby', date '2024-01-04') -- Bullish , (0x367c42a6f261ec54ffbecf5f41c226be12a3dca0, 'Bullish', 'Bullish 1', 'hildobby', date '2024-01-04') , (0x100ae042ef0ea159ecc3513e9a378ff21f3829ba, 'Bullish', 'Bullish 2', 'hildobby', date '2024-01-04') + , (0x6908c23476d3c8aa59994662e95b40414b396bf0, 'Bullish', 'Bullish 3', 'hildobby', date '2024-06-03') , (0xa96853390c776ce8307b46b4d1a857ab310ab018, 'Bullish', 'Bullish MultiSig 1', 'hildobby', date '2024-01-04') , (0x756d64dc5edb56740fc617628dc832ddbcfd373c, 'Bullish', 'Bullish MultiSig 2', 'hildobby', date '2024-01-04') , (0xc08fb884576cc89957e9058ef11587c468c2952f, 'Bullish', 'Bullish Deployer 1', 'hildobby', date '2024-01-04') -- FalconX , (0x1157a2076b9bb22a85cc2c162f20fab3898f4101, 'FalconX', 'FalconX 1', 'hildobby', date '2024-01-04') , (0xe1ed4da4284924ddaf69983b4d813fb1be58c380, 'FalconX', 'FalconX 2', 'hildobby', date '2024-01-04') + , (0x9fc6bef0702cf47dcd2e5a42b48e19aed8732499, 'FalconX', 'FalconX 3', 'hildobby', date '2024-06-03') , (0xf2ef6ac0f00bc91b3cb5ffb621b64c69e87b4f77, 'FalconX', 'FalconX Deposit Funder 1', 'hildobby', date '2024-01-04') -- Simplex , (0x77300c71071eca35cb673a0b7571b2907deb77c7, 'Simplex', 'Simplex 1', 'hildobby', date '2024-01-04') @@ -2435,6 +2491,8 @@ FROM (VALUES -- AAX , (0x80edadf751946a71a0131a495bb7abbc75f46f6c, 'AAX', 'AAX 1', 'hildobby', date '2024-01-04') , (0xc25dc289edce5227cf15d42539824509e826b54d, 'AAX', 'AAX 2', 'hildobby', date '2024-01-04') + , (0x8dc11398263fff36eb91602a18877112ead2ede4, 'AAX', 'AAX 3', 'hildobby', date '2024-06-03') + , (0xa4ee5581fdcbaaf52c5edb65c8fbb7d3de78b838, 'AAX', 'AAX 4', 'hildobby', date '2024-06-03') , (0x4dca3852323ae417d4c7d735100a629130d50e90, 'AAX', 'AAX Deposit Funder 1', 'hildobby', date '2024-05-25') -- Abra , (0x0e0066aca9ef6b8102d8dbc66ab0091f9370a7cb, 'Abra', 'Abra 1', 'hildobby', date '2024-01-04') @@ -2515,6 +2573,9 @@ FROM (VALUES , (0x6a3528677e598b47952749b08469ce806c2524e7, 'Celsuis', 'Celsuis 5', 'hildobby', date '2023-11-15') , (0xf9d89dc506c55738379c44dc27205fd6f68e1974, 'Celsuis', 'Celsuis 6', 'hildobby', date '2023-11-15') , (0xdb31651967684a40a05c4ab8ec56fc32f060998d, 'Celsuis', 'Celsuis 7', 'hildobby', date '2023-11-18') + , (0x3473779fd4d366774fe7d2ceb089b30d94d7f1d1, 'Celsuis', 'Celsuis 8', 'hildobby', date '2024-06-03') + , (0xef22c14f46858d5ac61326497b056974167f2ee1, 'Celsuis', 'Celsuis Trading 1', 'hildobby', date '2024-06-03') + , (0x41318419cfa25396b47a94896ffa2c77c6434040, 'Celsuis', 'Celsuis Fireblocks Custody 1', 'hildobby', date '2024-06-03') , (0x1cedc0f3af8f9841b0a1f5c1a4ddc6e1a1629074, 'Celsuis', 'Celsuis Staked ETH 1', 'hildobby', date '2023-11-22') , (0xc602dc3fb4a966cd6aed233db2ae4a5e596fcc27, 'Celsuis', 'Celsuis ETH Withdrawal 1', 'hildobby', date '2023-11-23') , (0xcb8bbfa45541a95c1de883eb3606708cae9fd45c, 'Celsuis', 'Celsuis ETH Withdrawal 2', 'hildobby', date '2023-11-23') diff --git a/models/cex/tron/cex_tron_addresses.sql b/models/cex/tron/cex_tron_addresses.sql index 35225f7c749..85418104af0 100644 --- a/models/cex/tron/cex_tron_addresses.sql +++ b/models/cex/tron/cex_tron_addresses.sql @@ -41,6 +41,7 @@ FROM (VALUES , ('tron', 'TUAg5gcjbcsVUiVzeDv85xLZRLad1GiQTN', 'OKX', 'OKX 12', 'hildobby', date '2024-04-19') , ('tron', 'TwsBSqwEEgtKMnhcLDnJowP6YpJUTEykMV', 'OKX', 'OKX 13', 'hildobby', date '2024-04-19') , ('tron', 'TjAQmFFRmVqtnkceGvLJrMwUPgCUfLjciu', 'OKX', 'OKX 14', 'hildobby', date '2024-04-19') + , ('tron', 'TQ7wK19fhZZqLdj2Xcw2e6Ejs3cTZbfBbF', 'OKX', 'OKX 15', 'hildobby', date '2024-04-19') , ('tron', 'T3MK1iimdxRdWabcF7Zg7AR5T4nud4EkHB', 'Backpack', 'Backpack 1', 'hildobby', date '2024-04-19') , ('tron', 'TzEc71KxDpsmsKoucSSuuoGLv1drys1oP2', 'Backpack', 'Backpack 2', 'hildobby', date '2024-04-19') , ('tron', 'TPbExxiw99nMsDfWVjaweSPkMVQfZSVVZj', 'BitVenus', 'BitVenus 1', 'hildobby', date '2024-04-19') @@ -60,7 +61,6 @@ FROM (VALUES , ('tron', 'TBM2FK4KBEEsMVYjm4WAW2Q8Es2NKdmUB8', 'Bitget', 'Bitget 9', 'hildobby', date '2024-04-19') , ('tron', 'TCvfZC9h6fFXnF7KbHPgY4jgfen93VkfVW', 'Bitget', 'Bitget 10', 'hildobby', date '2024-04-19') , ('tron', 'TGp7SNzjrctsWNwaFFN2PNTh3b1Kgxdtib', 'Bitget', 'Bitget 11', 'hildobby', date '2024-04-19') - , ('tron', 'TZY5TjMKdV2KdHVmUNTN56pWhMc8TyjrXt', 'Bitstamp', 'Bitstamp 1', 'hildobby', date '2024-04-19') , ('tron', 'TB1WQmj63bHV9Qmuhp39WABzutphMAetSc', 'Bybit', 'Bybit 1', 'hildobby', date '2024-04-19') , ('tron', 'TBpr1tQ5kvoKMv85XsCESVavYo4oZZdWpY', 'Bybit', 'Bybit 2', 'hildobby', date '2024-04-19') , ('tron', 'TKFvdC4UC1vtCoHZgn8eviK34kormXaqJ7', 'Bybit', 'Bybit 3', 'hildobby', date '2024-04-19') @@ -82,11 +82,6 @@ FROM (VALUES , ('tron', 'TAWK8YMnn7yAfnQRyvjiBv9ksocFt9qNdR', 'CoinDCX', 'CoinDCX 11', 'hildobby', date '2024-04-19') , ('tron', 'TVayqwydqcX1sEuzmxfXz2fHJcuCNGwYVN', 'CoinDCX', 'CoinDCX 12', 'hildobby', date '2024-04-19') , ('tron', 'TVYH5Y4KstUfRNx1ZQbqgdtX1Jw3bMTKtJ', 'CoinDCX', 'CoinDCX 13', 'hildobby', date '2024-04-19') - , ('tron', 'T379Eh7xLqhRaUyBzurFKjsX7z8DTrfGZp', 'CoinDCX', 'CoinDCX 14', 'hildobby', date '2024-04-19') - , ('tron', 'ToJrAM7NxUYDmSMbKKCQ6f742ZemLiypqj', 'CoinDCX', 'CoinDCX 15', 'hildobby', date '2024-04-19') - , ('tron', 'TujdQLyf1XkyLaSrGNbkyNxg8qML3bpKWC', 'CoinDCX', 'CoinDCX 16', 'hildobby', date '2024-04-19') - , ('tron', 'Tr2j6dFTGWHmLUhVBUj8XvDBgdGGzgfSwe', 'CoinDCX', 'CoinDCX 17', 'hildobby', date '2024-04-19') - , ('tron', 'T5Zubx3kPtheJ5DB6QMEaadMQowhUcdRV6', 'CoinDCX', 'CoinDCX 18', 'hildobby', date '2024-04-19') , ('tron', 'TTMWTPp1vonsdYBuLey3x8k6PsAvZcdR1J', 'CoinEx', 'CoinEx 1', 'hildobby', date '2024-04-19') , ('tron', 'TFp4V3S9JqJyQAMMCewyn4aAaLueJwzS7H', 'CoinEx', 'CoinEx 2', 'hildobby', date '2024-04-19') , ('tron', 'TEdzoWmVaKnSjvbY33FNjkGogo5xKUkSRD', 'CoinW', 'CoinW 1', 'hildobby', date '2024-04-19') @@ -96,9 +91,8 @@ FROM (VALUES , ('tron', 'TPj7TCJ9rxdd243yQ3tc7iJzqcEYtupB4v', 'Fastex', 'Fastex 1', 'hildobby', date '2024-04-19') , ('tron', 'TBA6CypYJizwA9XdC7Ubgc5F1bxrQ7SqPt', 'Gate.io', 'Gate.io 1', 'hildobby', date '2024-04-19') , ('tron', 'TCYpJ6MMzd9ytoUvD82HnS58iV75QimPh6', 'Gate.io', 'Gate.io 2', 'hildobby', date '2024-04-19') - , ('tron', 'TFptbWaARrWTX5Yvy3gNG5Lm8BmhPx82Bt', 'Gate.io', 'Gate.io 3', 'hildobby', date '2024-04-19') - , ('tron', 'TAg3xfQCUdTcjJxSrPHVZJBsQprUEc5pRh', 'Gate.io', 'Gate.io 4', 'hildobby', date '2024-04-19') - , ('tron', 'TWZMeKfiTgbfEmPLdsUCQcZinwUfk25EBQ', 'HTX', 'HTX 1', 'hildobby', date '2024-04-19') + , ('tron', 'TFptbWaARrWTX5Yvy3gNG5Lm8BmhPx82Bt', 'WhiteBIT', 'WhiteBIT 1', 'hildobby', date '2024-04-19') + , ('tron', 'TT5iK8oqGEyRKJAnRwrLSZ4fM5y77F2LNT', 'HTX', 'HTX 1', 'hildobby', date '2024-04-19') , ('tron', 'TYh6mgoMNZTCsgpYHBz7gttEfrQmDMABub', 'HTX', 'HTX 2', 'hildobby', date '2024-04-19') , ('tron', 'TKgD8Qnx9Zw3DNvG6o83PkufnMbtEXis4T', 'HTX', 'HTX 3', 'hildobby', date '2024-04-19') , ('tron', 'TCQQjfccKdMi4CnPAzmZW5TALH4HbwceVb', 'HTX', 'HTX 4', 'hildobby', date '2024-04-19') @@ -116,8 +110,6 @@ FROM (VALUES , ('tron', 'TU1ZA8T2g8PvLK8BfM7N94xpmSSpyfxZoK', 'HTX', 'HTX 17', 'hildobby', date '2024-04-19') , ('tron', 'TFTWNgDBkQ5wQoP8RXpRznnHvAVV8x5jLu', 'HTX', 'HTX 18', 'hildobby', date '2024-04-19') , ('tron', 'TK86Qm97uM848dMk8G7xNbJB7zG1uW3h1n', 'HTX', 'HTX 19', 'hildobby', date '2024-04-19') - , ('tron', 'TT5iK8oqGEyRKJAnRwrLSZ4fM5y77F2LNT', 'HTX', 'HTX 20', 'hildobby', date '2024-04-19') - , ('tron', 'TLTOZT5LG3F5BLMFPJYGFWVCMU37EZI2AM', 'HTX', 'HTX 21', 'hildobby', date '2024-04-19') , ('tron', 'TS9b9boewmB6tq874PnVZrKPf4NZw9qHPi', 'Hotbit', 'Hotbit 1', 'hildobby', date '2024-04-19') , ('tron', 'TFPqi7KTRwi2tihwS5dp1QomHowp1x2f45', 'Hotbit', 'Hotbit 2', 'hildobby', date '2024-04-19') , ('tron', 'TKM9AYxWxRe7hESuWmKFXwcDjnb5cQK92E', 'Klever Exchange', 'Klever Exchange 1', 'hildobby', date '2024-04-19') @@ -128,7 +120,6 @@ FROM (VALUES , ('tron', 'TRYL7PKCG4b4xRCM554Q5J6o8f1UjUmfnY', 'KuCoin', 'KuCoin 3', 'hildobby', date '2024-04-19') , ('tron', 'TSGEXDSRMtzt9swPSgzr8MKefcgEawEdmb', 'KuCoin', 'KuCoin 4', 'hildobby', date '2024-04-19') , ('tron', 'TUpHuDkiCCmwaTZBHZvQdwWzGNm5t8J2b9', 'KuCoin', 'KuCoin 4', 'hildobby', date '2024-04-19') - , ('tron', 'T2BQ7FFYBXW2PEDVB6KBX2F3C77WXBJ2FP', 'KuCoin', 'KuCoin 6', 'hildobby', date '2024-04-19') , ('tron', 'TT2YwaJ8DXsrpycgBGDWEei1FUQm6YT85T', 'LAToken', 'LAToken 1', 'hildobby', date '2024-04-19') , ('tron', 'TUJrDuFr6ALjtZehcpFRKnBCCo79Gs76ww', 'LAToken', 'LAToken 2', 'hildobby', date '2024-04-19') , ('tron', 'TVNdyXbcJ5ZwwFsjnScrNXSv9d435guynT', 'LAToken', 'LAToken 3', 'hildobby', date '2024-04-19') @@ -152,10 +143,15 @@ FROM (VALUES , ('tron', 'TYp46EYRTHb2grSfjkDFFtakcgedXBHEhh', 'MaskEX', 'MaskEX 17', 'hildobby', date '2024-04-19') , ('tron', 'TYshj25EXjnPB7P5xRGLmFTNPV6HMoZyrq', 'MaskEX', 'MaskEX 18', 'hildobby', date '2024-04-19') , ('tron', 'TUiATx1SGs3TwwKY1atafMvYjrQD8KLiSk', 'MaskEX', 'MaskEX 19', 'hildobby', date '2024-04-19') - , ('tron', 'TQ7wK19fhZZqLdj2Xcw2e6Ejs3cTZbfBbF', 'OKCoin', 'OKCoin 1', 'hildobby', date '2024-04-19') , ('tron', 'TDZeVyGHgN5bErmWumuYRtXCrYMoUzKF7L', 'WOO X', 'WOO X 1', 'hildobby', date '2024-04-19') , ('tron', 'TSC2VZai39isPj5DzByYgaBtjpBHbDcTgd', 'WOO X', 'WOO X 2', 'hildobby', date '2024-04-19') , ('tron', 'TDjiAAzZGzTkDtEvEvoStN3JvriADT1qXr', 'B2BinPay', 'B2BinPay 1', 'hildobby', date '2024-05-04') , ('tron', 'TSjD7g8ZC29HQCLvKg5TLQMeXaxhNS8KLk', 'Bitpanda', 'Bitpanda 1', 'hildobby', date '2024-05-04') , ('tron', 'TWT3L694985N2sF8aCQpMbtpxCUgRPsfME', 'XT.com', 'XT.com 1', 'hildobby', date '2024-05-04') + , ('tron', 'TTU7icZN9VBs3ReUCVBUnwyvdU41hGJzbL', 'Bidesk', 'Bidesk 1', 'hildobby', date '2024-06-03') + , ('tron', 'TJsi3EFYUSFnSnVCmyH4yJYVdPg8fXRQJ3', 'Bidesk', 'Bidesk 2', 'hildobby', date '2024-06-03') + , ('tron', 'TAjUZpjqknS7qHGN2nwM8NxsbdcffP9dyd', 'Bidesk', 'Bidesk 3', 'hildobby', date '2024-06-03') + , ('tron', 'TJGyzWET16gyChHtnF5xPdhdp3RRN14QCY', 'Dex-Trade', 'Dex-Trade 1', 'hildobby', date '2024-06-03') + , ('tron', 'TUXdvJvxdt1WvXC8gJATFSqRCh5WDo6DP6', 'AAX', 'AAX 1', 'hildobby', date '2024-06-03') + , ('tron', 'THyNKgEdAKHia1XgA2nwnbL1FhABTqY1f3', 'AAX', 'AAX 2', 'hildobby', date '2024-06-03') ) AS x (blockchain, address, cex_name, distinct_name, added_by, added_date) From 0bec087426d98757bb890bbf5deeb3052a3776e3 Mon Sep 17 00:00:00 2001 From: Alan Ghobadi Date: Wed, 12 Jun 2024 20:35:04 +0200 Subject: [PATCH 113/149] Prices drop normie (#6158) * Drop normie from prices * Whitespace --- models/prices/base/prices_base_tokens.sql | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/models/prices/base/prices_base_tokens.sql b/models/prices/base/prices_base_tokens.sql index a35974ec657..97f3a0fde30 100644 --- a/models/prices/base/prices_base_tokens.sql +++ b/models/prices/base/prices_base_tokens.sql @@ -6,7 +6,7 @@ tags=['static'] ) }} -SELECT +SELECT token_id , blockchain , symbol @@ -75,7 +75,6 @@ FROM ('beni-beni', 'base', 'BENI', 0xde7a416ac821c77478340eebaa21b68297025ef3, 18), ('bunny-based-bunny', 'base', 'BUNNY', 0x75570e1189ffc1d63b3417cdf0889f87cd3e9bd1, 18), ('britt-britt', 'base', 'BRITT', 0x3b1228c3ede7e0898d57054cd9b8f812d24315c1, 9), - ('normie1-normie', 'base', 'NORMIE', 0x7f12d13b34f5f4f0a9449c16bcd42f0da47af200, 9), ('bshib2-based-shiba-inu', 'base', 'BSHIB', 0xfea9dcdc9e23a9068bf557ad5b186675c61d33ea, 18), ('mfercoin-mfercoin', 'base', 'mfercoin', 0xe3086852a4b125803c815a158249ae468a3254ca, 18), ('bsb-based-street-bets', 'base', 'BSB', 0x8a24d7260cd02d3dfd8eefb66bc17ad4b17d494c, 18), @@ -84,7 +83,7 @@ FROM ('fungi-fungi', 'base', 'FUNGI', 0x7d9ce55d54ff3feddb611fc63ff63ec01f26d15f, 9), ('dog-the-doge-nft', 'base', 'DOG', 0xafb89a09d82fbde58f18ac6437b3fc81724e4df6, 18), ('higher-higher', 'base', 'HIGHER', 0x0578d8a44db98b23bf096a382e016e29a5ce0ffe, 18), - --('stg-stargate-finance', 'base', 'STG', 0xe3b53af74a4bf62ae5511055290838050bf764df, 18), -- token_id not found in API + --('stg-stargate-finance', 'base', 'STG', 0xe3b53af74a4bf62ae5511055290838050bf764df, 18), -- token_id not found in API ('keycat-keyboard-cat-base', 'base', 'KEYCAT', 0x9a26f5433671751c3276a065f57e5a02d2817973, 18), ('briun-briun-armstrung', 'base', 'BRIUN', 0x8c81b4c816d66d36c4bf348bdec01dbcbc70e987, 18), ('benji-basenji', 'base', 'BENJI', 0xbc45647ea894030a4e9801ec03479739fa2485f0, 18), @@ -107,7 +106,7 @@ FROM ('mog-mog-coin', 'base', 'MOG', 0x2da56acb9ea78330f947bd57c54119debda7af71, 18), ('carlo-carlo', 'base', 'CARLO', 0x38d513ec43dda20f323f26c7bef74c5cf80b6477, 18), ('ski-ski-mask-dog', 'base', 'SKI', 0x768be13e1680b5ebe0024c42c896e3db59ec0149, 9), - ('kurbi-kurbi', 'base', 'KURBI', 0x653a143b8d15c565c6623d1f168cfbec1056d872, 9), + ('kurbi-kurbi', 'base', 'KURBI', 0x653a143b8d15c565c6623d1f168cfbec1056d872, 9), ('bord-base-lord', 'base', 'BORD', 0x160452f95612699d1a561a70eeeeede67c6812af, 18), ('rdnt-radiant-capital','base','RDNT',0xd722e55c1d9d9fa0021a5215cbb904b92b3dc5d4,18), ('well-moonwell', 'base', 'WELL', 0xff8adec2221f9f4d8dfbafa6b9a297d17603493d, 18), From 3ad715ec480bc95db77e95ed6f62628dec62999d Mon Sep 17 00:00:00 2001 From: Haris Angelidakis <64154020+harisang@users.noreply.github.com> Date: Wed, 12 Jun 2024 21:35:29 +0300 Subject: [PATCH 114/149] [CoW Protocol] Add Project Blanc solver (#6154) * add tsolver * add project blanc solver --------- Co-authored-by: jeff-dude <102681548+jeff-dude@users.noreply.github.com> --- models/cow_protocol/ethereum/cow_protocol_ethereum_solvers.sql | 2 ++ 1 file changed, 2 insertions(+) diff --git a/models/cow_protocol/ethereum/cow_protocol_ethereum_solvers.sql b/models/cow_protocol/ethereum/cow_protocol_ethereum_solvers.sql index 8a32d71f723..ed4ced91031 100644 --- a/models/cow_protocol/ethereum/cow_protocol_ethereum_solvers.sql +++ b/models/cow_protocol/ethereum/cow_protocol_ethereum_solvers.sql @@ -107,6 +107,8 @@ known_solver_metadata (address, environment, name) as ( (0x9528e8c42F7e109bADED964E2D927fD5B6ca71E9, 'prod', 'Odos'), (0x755BaE1cd46C9C27A3230AeF0CE923BDa13d29F7, 'prod', 'FractalSolver'), (0x8F70A86c1309d8B1F5BefC58948e7386Fd495875, 'prod', 'Tsolver'), + (0xbAda55BaBEE5D2B7F3B551f9da846838760E068C, 'prod', 'Project_Blanc'), + (0xa5559C2E1302c5Ce82582A6b1E4Aec562C2FbCf4, 'barn', 'Project_Blanc'), (0xa432cea087311d7cd07925d70f799eE94E7893a4, 'barn', 'Tsolver'), (0xAb11302CB4f7C417e527A4d39C22Aa9f04EdB07D, 'barn', 'FractalSolver'), (0xf13eaf9093a210EBdaBa581f5448ffA545EE2E65, 'barn', 'Odos'), From 65dfdf39da451ae27a9e35db8e75cd9d6f7f121c Mon Sep 17 00:00:00 2001 From: yy-analytics <103118737+yy-analytics@users.noreply.github.com> Date: Thu, 13 Jun 2024 00:06:21 +0530 Subject: [PATCH 115/149] Small mantle changes (#6144) * New tokens added to mantle * Add mantle to tokens.native * Update pubic macros with mantle info --------- Co-authored-by: Huang Geyang --- macros/public/all_evm_chains.sql | 3 ++- macros/public/get_chain_explorer.sql | 1 + macros/public/get_chain_explorer_address.sql | 1 + macros/public/get_chain_explorer_tx_hash.sql | 1 + tokens/models/tokens/mantle/tokens_mantle_erc20.sql | 2 ++ tokens/models/tokens/tokens_native.sql | 5 +++-- tokens/models/tokens/tokens_schema.yml | 4 ++-- 7 files changed, 12 insertions(+), 5 deletions(-) diff --git a/macros/public/all_evm_chains.sql b/macros/public/all_evm_chains.sql index 882d911063b..80ded79922a 100644 --- a/macros/public/all_evm_chains.sql +++ b/macros/public/all_evm_chains.sql @@ -12,7 +12,8 @@ 'base', 'zksync', 'zora', - 'scroll' + 'scroll', + 'mantle' ]) }} {% endmacro %} diff --git a/macros/public/get_chain_explorer.sql b/macros/public/get_chain_explorer.sql index c0b48fc33e7..144a24aead8 100644 --- a/macros/public/get_chain_explorer.sql +++ b/macros/public/get_chain_explorer.sql @@ -22,6 +22,7 @@ when 'zkevm' = chain_ then 'https://zkevm.polygonscan.com' when 'scroll' = chain_ then 'https://scrollscan.com' when 'zora' = chain_ then 'https://zora.superscan.network' + when 'mantle' = chain_ then 'https://explorer.mantle.xyz' else 'https://etherscan.io' end as explorer_url; {% endmacro %} diff --git a/macros/public/get_chain_explorer_address.sql b/macros/public/get_chain_explorer_address.sql index 2c1a9554a71..82064139656 100644 --- a/macros/public/get_chain_explorer_address.sql +++ b/macros/public/get_chain_explorer_address.sql @@ -22,6 +22,7 @@ when 'zkevm' = chain_ then 'https://zkevm.polygonscan.com' || CAST(column_ AS VARCHAR) when 'scroll' = chain_ then 'https://scrollscan.com' || CAST(column_ AS VARCHAR) when 'zora' = chain_ then 'https://zora.superscan.network' || CAST(column_ AS VARCHAR) + when 'mantle' = chain_ then 'https://explorer.mantle.xyz/address/' || CAST(column_ AS VARCHAR) else 'https://etherscan.io/address/' || CAST(column_ AS VARCHAR) end as explorer_address_url; {% endmacro %} diff --git a/macros/public/get_chain_explorer_tx_hash.sql b/macros/public/get_chain_explorer_tx_hash.sql index 8c879c2d3ae..f1fbaf393ef 100644 --- a/macros/public/get_chain_explorer_tx_hash.sql +++ b/macros/public/get_chain_explorer_tx_hash.sql @@ -22,6 +22,7 @@ when 'zkevm' = chain_ then 'https://zkevm.polygonscan.com' || CAST(hash_ AS VARCHAR) when 'scroll' = chain_ then 'https://scrollscan.com' || CAST(hash_ AS VARCHAR) when 'zora' = chain_ then 'https://zora.superscan.network' || CAST(hash_ AS VARCHAR) + when 'mantle' = chain_ then 'https://explorer.mantle.xyz/tx/' || CAST(hash_ AS VARCHAR) else 'https://etherscan.io/tx/' || CAST(hash_ AS VARCHAR) end as explorer_tx_hash_url; {% endmacro %} diff --git a/tokens/models/tokens/mantle/tokens_mantle_erc20.sql b/tokens/models/tokens/mantle/tokens_mantle_erc20.sql index 240682ad099..17b5de91b7d 100644 --- a/tokens/models/tokens/mantle/tokens_mantle_erc20.sql +++ b/tokens/models/tokens/mantle/tokens_mantle_erc20.sql @@ -32,4 +32,6 @@ FROM (VALUES , (0xc1f43e45f86e7bfb92c3c309b0ef366f9ba33bfa, 'MoeLP', 18) , (0xefc38c1b0d60725b824ebee8d431abfbf12bc953, 'MoeLP', 18) , (0xfbea6da85f6554fe4d429e9f37f8ba54a9ac94c3, 'MoeLP', 18) + , (0x5d131cb99ce5642f3d539417a187a93eeae48177, 'S*USDC', 6) + , (0xe1152564ed7b59e01915fc95bbf87cf9b6636fe6, 'S*USDT', 6) ) AS temp_table (contract_address, symbol, decimals) diff --git a/tokens/models/tokens/tokens_native.sql b/tokens/models/tokens/tokens_native.sql index 92ce8b5f2f2..4750d21234a 100644 --- a/tokens/models/tokens/tokens_native.sql +++ b/tokens/models/tokens/tokens_native.sql @@ -1,10 +1,10 @@ {{ config( alias='native', tags=['static'], - post_hook='{{ expose_spells(\'["arbitrum","avalanche_c","bnb","ethereum","optimism", "gnosis", "fantom", "polygon","solana", "celo", "zksync"]\', + post_hook='{{ expose_spells(\'["arbitrum","avalanche_c","bnb","ethereum","optimism", "gnosis", "fantom", "polygon","solana", "celo", "zksync", "mantle"]\', "sector", "tokens", - \'["0xManny","hildobby","soispoke","dot2dotseurat","mtitus6","wuligy","lgingerich"]\') }}')}} + \'["0xManny","hildobby","soispoke","dot2dotseurat","mtitus6","wuligy","lgingerich","angus_1"]\') }}')}} SELECT chain, symbol, price_symbol, price_address, decimals FROM (VALUES @@ -21,4 +21,5 @@ FROM (VALUES , ('solana', 'SOL', 'SOL', from_base58('so11111111111111111111111111111111111111112'), 18) --not sure if solana decimals are correct here , ('celo', 'CELO', 'CELO', 0x471ece3750da237f93b8e339c536989b8978a438, 18) , ('zksync', 'ETH', 'WETH', 0x000000000000000000000000000000000000800A, 18) + , ('mantle', 'MNT', 'WMNT', 0x78c1b0c915c4faa5fffa6cabf0219da63d7f4cb8, 18) ) AS temp_table (chain, symbol, price_symbol, price_address, decimals) diff --git a/tokens/models/tokens/tokens_schema.yml b/tokens/models/tokens/tokens_schema.yml index 508bf99ea3d..39a720d6628 100644 --- a/tokens/models/tokens/tokens_schema.yml +++ b/tokens/models/tokens/tokens_schema.yml @@ -26,11 +26,11 @@ models: - name: tokens_native meta: - blockchain: avalanche_c, bnb, ethereum, gnosis, optimism, ethereum, arbitrum, solana, fantom + blockchain: avalanche_c, bnb, ethereum, gnosis, optimism, ethereum, arbitrum, solana, fantom, mantle sector: tokens contributors: ilemi config: - tags: ['tokens','native', 'avalanche_c', 'bnb','ethereum', 'gnosis','optimism','ethereum','solana','arbitrum', 'fantom'] + tags: ['tokens','native', 'avalanche_c', 'bnb','ethereum', 'gnosis','optimism','ethereum','solana','arbitrum', 'fantom','mantle'] description: > The chain native token and symbol, and the prices.usd symbol/address that is closest. columns: From 64ddfa0200003ccac203c44b6263217fa90e48e9 Mon Sep 17 00:00:00 2001 From: Alan Ghobadi Date: Thu, 13 Jun 2024 07:53:19 +0200 Subject: [PATCH 116/149] Change to LEFT join (#6163) This is because accounts can get opened and closed in the same tx --- models/tokens/solana/tokens_solana_transfers.sql | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/models/tokens/solana/tokens_solana_transfers.sql b/models/tokens/solana/tokens_solana_transfers.sql index f4b586f81f7..7f850601d13 100644 --- a/models/tokens/solana/tokens_solana_transfers.sql +++ b/models/tokens/solana/tokens_solana_transfers.sql @@ -76,7 +76,7 @@ SELECT , outer_executing_account FROM base tr --get token and accounts -INNER JOIN {{ ref('solana_utils_token_accounts') }} tk_s ON tk_s.address = tr.from_token_account -INNER JOIN {{ ref('solana_utils_token_accounts') }} tk_d ON tk_d.address = tr.to_token_account +LEFT JOIN {{ ref('solana_utils_token_accounts') }} tk_s ON tk_s.address = tr.from_token_account +LEFT JOIN {{ ref('solana_utils_token_accounts') }} tk_d ON tk_d.address = tr.to_token_account WHERE 1=1 -- AND call_block_time > now() - interval '90' day --for faster CI testing \ No newline at end of file From feb280d6c1c96fccad48979a583a6b3c6a48c0ad Mon Sep 17 00:00:00 2001 From: Alan Ghobadi Date: Thu, 13 Jun 2024 08:14:40 +0200 Subject: [PATCH 117/149] Materialize solana_dex_trades (#6162) --- models/dex/solana/dex_solana_trades.sql | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/models/dex/solana/dex_solana_trades.sql b/models/dex/solana/dex_solana_trades.sql index 64f55e6b047..cfcd59b8e0c 100644 --- a/models/dex/solana/dex_solana_trades.sql +++ b/models/dex/solana/dex_solana_trades.sql @@ -3,7 +3,12 @@ schema = 'dex_solana', alias = 'trades', - materialized = 'view', + materialized = 'incremental', + file_format = 'delta', + incremental_strategy = 'merge', + partition_by = ['block_month'], + incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.block_time')], + unique_key = ['tx_id', 'outer_instruction_index', 'inner_instruction_index', 'tx_index','block_month'], post_hook='{{ expose_spells(\'["solana"]\', "project", "dex", @@ -19,7 +24,7 @@ , ref('lifinity_v2_trades') , ref('meteora_v1_solana_trades') , ref('meteora_v2_solana_trades') - , ref('goosefx_ssl_v2_solana_trades') + , ref('goosefx_ssl_v2_solana_trades') , ref('pumpdotfun_solana_trades') ] %} @@ -28,6 +33,7 @@ SELECT blockchain , project , version + , CAST(date_trunc('month', block_time) AS DATE) as block_month , block_time , trade_source , token_bought_symbol @@ -51,7 +57,9 @@ SELECT , inner_instruction_index , tx_index FROM {{ dex }} - +{% if is_incremental() %} +WHERE {{incremental_predicate('block_time')}} +{% endif %} {% if not loop.last %} UNION ALL {% endif %} From 284a307e5de7a1bcb6549ad2f582c9503930ea8b Mon Sep 17 00:00:00 2001 From: Alan Ghobadi Date: Thu, 13 Jun 2024 08:25:43 +0200 Subject: [PATCH 118/149] Materialize solana fungible tokens (#6164) --- models/tokens/solana/tokens_solana_fungible.sql | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/models/tokens/solana/tokens_solana_fungible.sql b/models/tokens/solana/tokens_solana_fungible.sql index 6a66471188c..d9de9176874 100644 --- a/models/tokens/solana/tokens_solana_fungible.sql +++ b/models/tokens/solana/tokens_solana_fungible.sql @@ -1,7 +1,8 @@ {{ config ( alias = 'fungible', - + schema = 'tokens_solana', + materialized = 'table', post_hook='{{ expose_spells(\'["solana"]\', "sector", "tokens", From ade86a3d7ffa613129ce4b38c6f04c8dd06290a1 Mon Sep 17 00:00:00 2001 From: jeff-dude <102681548+jeff-dude@users.noreply.github.com> Date: Thu, 13 Jun 2024 17:18:51 -0400 Subject: [PATCH 119/149] simplify `dbt compile` step in CI pipeline (#6168) * pick dummy model to test, no ci changes yet * remove profile override in compile * Revert "pick dummy model to test, no ci changes yet" This reverts commit 8851aa8b159a07ee822e3182a852b799883fdcab. --- .github/workflows/dbt_run.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/dbt_run.yml b/.github/workflows/dbt_run.yml index 6ef534a35b5..7183380f7a3 100644 --- a/.github/workflows/dbt_run.yml +++ b/.github/workflows/dbt_run.yml @@ -42,7 +42,7 @@ jobs: run: "./scripts/ensure_cluster.sh" - name: dbt compile to create manifest to compare to - run: "dbt --warn-error compile $PROFILE --project-dir ${PROJECT_DIR}" + run: "dbt --warn-error compile --project-dir ${PROJECT_DIR}" - name: check schemas run: | From 8aca70c71907831fe479d94c7fcaa575029b0618 Mon Sep 17 00:00:00 2001 From: 0xRob <83790096+0xRobin@users.noreply.github.com> Date: Fri, 14 Jun 2024 12:13:28 +0200 Subject: [PATCH 120/149] NFT dbt subproject (#6090) * Init NFT subproject * move out of subprojects folder * add NFT ci * rename CI run * fix ref * use sudo specific source * adapt seeds * adapt schema check * test like this * this should work? * put check_schema in a script * path syntax * move script location * make exec? * capture error * just running the plain command.. * Move blast * Add nft to commit manifest * Move bend dao lending schema * Fix schema --------- Co-authored-by: Alan Ghobadi --- .github/workflows/commit_manifest.yml | 2 +- .github/workflows/dbt_run.yml | 4 +- .github/workflows/nft.yml | 20 + daily_spellbook/tests/generic/check_seed.sql | 20 - .../compare_column_values_to_seed_values.sql | 22 - .../tests/generic/is_unique_filtered.sql | 13 - dbt_project.yml | 32 - docs/seeds/seed_overview.md | 2 +- .../check_column_types_macro.sql | 14 + .../check_seed_macro.sql | 12 + .../equal_rowcount_with_sources.sql | 0 .../test-helpers/check_column_types_macro.sql | 13 - macros/test-helpers/test_helpers_schema.yml | 5 - ...ino_upgrade_alienswap_base_base_trades.sql | 3 - ...ino_upgrade_tevaera_zksync_base_trades.sql | 3 - .../ethereum/bend_dao_ethereum_schema.yml | 115 -- .../cryptopunks_ethereum_current_bids.sql | 4 +- .../cryptopunks_ethereum_current_listings.sql | 4 +- ...topunks_ethereum_floor_price_over_time.sql | 4 +- ...ryptopunks_ethereum_listings_over_time.sql | 4 +- .../labels_op_chains_likely_bot_addresses.sql | 50 +- .../labels_op_chains_likely_bot_contracts.sql | 62 +- .../labels_optimism_likely_bot_addresses.sql | 48 +- .../labels_optimism_likely_bot_contracts.sql | 58 +- .../labels_token_standards_arbitrum.sql | 4 +- .../labels_token_standards_avalanche_c.sql | 4 +- .../labels_token_standards_bnb.sql | 4 +- .../labels_token_standards_ethereum.sql | 4 +- .../labels_token_standards_fantom.sql | 4 +- .../labels_token_standards_gnosis.sql | 4 +- .../labels_token_standards_goerli.sql | 4 +- .../labels_token_standards_optimism.sql | 4 +- .../labels_token_standards_polygon.sql | 4 +- .../labels_op_habitual_wash_traders.sql | 6 +- .../op_nft_traders/labels_op_nft_traders.sql | 10 +- .../labels_nft_users_platforms.sql | 4 +- .../labels_nft_smart_trader_roi_eth.sql | 18 +- .../labels_nft_traders_transactions.sql | 4 +- ...abels_nft_traders_transactions_current.sql | 4 +- .../labels_nft_traders_volume_usd.sql | 4 +- .../labels_nft_traders_volume_usd_current.sql | 4 +- models/nft/nft_schema.yml | 115 -- .../sudoswap_ethereum_pool_trades_agg_day.sql | 4 +- nft/README.md | 3 + nft/dbt_project.yml | 87 ++ .../nft => nft/macros}/add_nft_tx_data.sql | 0 .../nft => nft/macros}/enrich_nft_trades.sql | 8 +- .../nft => nft/macros}/nft_approvals.sql | 0 .../_sector/nft => nft/macros}/nft_mints.sql | 2 +- .../nft => nft/macros}/nft_transfers.sql | 0 .../nft => nft/macros}/nft_wash_trades.sql | 14 +- .../platforms/element_v1_base_trades.sql | 0 .../platforms/seaport_v3_fork_trades.sql | 0 .../macros}/platforms/seaport_v3_trades.sql | 0 .../platforms/seaport_v4_fork_trades.sql | 0 .../macros}/platforms/seaport_v4_trades.sql | 0 .../platforms/sudoswap_v2_base_trades.sql | 0 .../macros}/platforms/tofu_v1_base_trades.sql | 0 .../macros}/platforms/zonic_base_trades.sql | 0 .../macros}/platforms/zora_mints.sql | 10 +- .../nft => nft/macros}/port_to_old_schema.sql | 0 nft/models/_extra_sources.yml | 32 + .../models/_sector}/aggregators/_schema.yml | 0 .../_sector}/aggregators/chains/_schema.yml | 0 .../chains/nft_arbitrum_aggregators.sql | 0 .../chains/nft_avalanche_c_aggregators.sql | 0 .../chains/nft_bnb_aggregators.sql | 0 .../chains/nft_celo_aggregators.sql | 0 .../chains/nft_ethereum_aggregators.sql | 0 .../chains/nft_ethereum_aggregators_gem.sql | 0 .../nft_ethereum_aggregators_manual.sql | 0 .../nft_ethereum_aggregators_markers.sql | 0 .../chains/nft_optimism_aggregators.sql | 0 .../chains/nft_polygon_aggregators.sql | 0 .../_sector}/aggregators/nft_aggregators.sql | 0 .../models/_sector}/approvals/_schema.yml | 0 .../_sector}/approvals/chains/_schema.yml | 0 .../chains/nft_arbitrum_approvals.sql | 0 .../chains/nft_avalanche_c_approvals.sql | 0 .../approvals/chains/nft_base_approvals.sql | 0 .../approvals/chains/nft_bnb_approvals.sql | 0 .../approvals/chains/nft_celo_approvals.sql | 0 .../chains/nft_ethereum_approvals.sql | 0 .../approvals/chains/nft_fantom_approvals.sql | 0 .../approvals/chains/nft_gnosis_approvals.sql | 0 .../approvals/chains/nft_goerli_approvals.sql | 0 .../chains/nft_optimism_approvals.sql | 0 .../chains/nft_polygon_approvals.sql | 0 .../approvals/chains/nft_scroll_approvals.sql | 0 .../approvals/chains/nft_zksync_approvals.sql | 0 .../_sector}/approvals/nft_approvals.sql | 0 nft/models/_sector/lending/_schema.yml | 22 + .../_sector/lending/ethereum/_schema.yml | 60 +- .../astaria_ethereum_daily_deposits.sql | 4 +- .../ethereum/astaria_ethereum_events.sql | 230 ++-- .../ethereum/astaria_ethereum_lending.sql | 60 +- .../ethereum/bend_dao_ethereum_lending.sql | 8 +- .../models/_sector/lending}/nft_lending.sql | 4 +- .../models/_sector}/mints/_schema.yml | 0 .../models/_sector}/mints/native/_schema.yml | 0 .../mints/native/nft_base_native_mints.sql | 0 .../native/nft_ethereum_native_mints.sql | 0 .../native/nft_optimism_native_mints.sql | 0 .../mints/native/nft_zksync_native_mints.sql | 0 .../mints/native/nft_zora_native_mints.sql | 0 .../models/_sector}/mints/nft_mints.sql | 0 .../_sector}/mints/platforms/_schema.yml | 0 .../mints/platforms/zora_base_mints.sql | 0 .../mints/platforms/zora_ethereum_mints.sql | 0 .../mints/platforms/zora_goerli_mints.sql | 0 .../_sector}/mints/platforms/zora_mints.sql | 0 .../mints/platforms/zora_optimism_mints.sql | 0 .../mints/platforms/zora_zora_mints.sql | 6 +- .../models/_sector}/trades/MIGRATION.md | 0 .../models/_sector}/trades/chains/_schema.yml | 0 .../arbitrum/nft_arbitrum_base_trades.sql | 0 .../chains/arbitrum/platforms/_schema.yml | 0 .../element_arbitrum_base_trades.sql | 0 .../opensea_v3_arbitrum_base_trades.sql | 0 .../opensea_v4_arbitrum_base_trades.sql | 0 .../stealcam_arbitrum_base_trades.sql | 0 .../platforms/sudoswap_v2_arbitrum__pools.sql | 0 .../sudoswap_v2_arbitrum_base_trades.sql | 0 .../platforms/tofu_arbitrum_base_trades.sql | 0 .../trove_v1_arbitrum_base_trades.sql | 0 .../trove_v2_arbitrum_base_trades.sql | 0 .../platforms/zonic_arbitrum_base_trades.sql | 0 .../nft_avalanche_c_base_trades.sql | 0 .../chains/avalanche_c/platforms/_schema.yml | 0 .../campfire_avalanche_c_base_trades.sql | 0 .../chikn_avalanche_c_base_trades.sql | 0 .../element_avalanche_c_base_trades.sql | 0 .../hyperspace_avalanche_c_base_trades.sql | 0 .../joepegs_avalanche_c_base_trades.sql | 0 .../opensea_v3_avalanche_c_base_trades.sql | 0 .../opensea_v4_avalanche_c_base_trades.sql | 0 .../chains/base/nft_base_base_trades.sql | 0 .../trades/chains/base/platforms/_schema.yml | 0 .../platforms/alienswap_base_base_trades.sql | 0 .../platforms/element_base_base_trades.sql | 0 .../platforms/magiceden_base_base_trades.sql | 2 +- .../platforms/opensea_v4_base_base_trades.sql | 0 .../platforms/sudoswap_v2_base__pools.sql | 0 .../sudoswap_v2_base_base_trades.sql | 0 .../base/platforms/zonic_base_base_trades.sql | 0 .../chains/blast/nft_blast_base_trades.sql | 0 .../trades/chains/blast/platforms/_schema.yml | 0 .../platforms/blur_blast_base_trades.sql | 0 .../platforms/fantasy_blast_base_trades.sql | 0 .../trades/chains/bnb/nft_bnb_base_trades.sql | 0 .../trades/chains/bnb/platforms/_schema.yml | 0 .../bnb/platforms/element_bnb_base_trades.sql | 0 .../platforms/liquidifty_bnb_base_trades.sql | 0 .../bnb/platforms/nftb_bnb_base_trades.sql | 0 .../bnb/platforms/nftrade_bnb_base_trades.sql | 0 .../pancakeswap_nft_bnb_base_trades.sql | 0 .../bnb/platforms/tofu_bnb_base_trades.sql | 0 .../chains/celo/nft_celo_base_trades.sql | 0 .../trades/chains/celo/platforms/_schema.yml | 0 .../celo/platforms/tofu_celo_base_trades.sql | 0 .../ethereum/nft_ethereum_base_trades.sql | 0 .../chains/ethereum/platforms/_schema.yml | 0 .../archipelago_ethereum_base_trades.sql | 0 .../platforms/blur_ethereum_base_trades.sql | 0 .../blur_seaport_ethereum_base_trades.sql | 0 .../blur_v2_ethereum_base_trades.sql | 0 .../collectionswap_ethereum__pools.sql | 0 .../collectionswap_ethereum_base_trades.sql | 0 .../cryptopunks_ethereum_base_trades.sql | 0 .../element_ethereum_base_trades.sql | 0 .../foundation_ethereum_base_trades.sql | 0 .../liquidifty_ethereum_base_trades.sql | 0 ...looksrare_seaport_ethereum_base_trades.sql | 0 .../looksrare_v1_ethereum_base_trades.sql | 0 .../looksrare_v2_ethereum_base_trades.sql | 0 .../magiceden_ethereum_base_trades.sql | 0 .../opensea_v1_ethereum_base_trades.sql | 0 .../opensea_v3_ethereum_base_trades.sql | 0 .../opensea_v4_ethereum_base_trades.sql | 0 .../sudoswap_ethereum_base_trades.sql | 0 .../platforms/sudoswap_v2_ethereum__pools.sql | 0 .../sudoswap_v2_ethereum_base_trades.sql | 0 .../superrare_ethereum_base_trades.sql | 0 .../platforms/trove_ethereum_base_trades.sql | 0 .../platforms/x2y2_ethereum_base_trades.sql | 0 .../zora_v1_ethereum_base_trades.sql | 0 .../zora_v2_ethereum_base_trades.sql | 0 .../zora_v3_ethereum_base_trades.sql | 0 .../chains/linea/nft_linea_base_trades.sql | 0 .../trades/chains/linea/platforms/_schema.yml | 0 .../platforms/element_linea_base_trades.sql | 0 .../trades/chains/old/nft_old_base_trades.sql | 0 .../trades/chains/old/platforms/_schema.yml | 0 .../old/platforms/mooar_polygon_events.sql | 0 .../platforms/nftearth_optimism_events.sql | 0 .../platforms/oneplanet_polygon_events.sql | 0 .../old/platforms/quix_optimism_schema.yml | 0 .../quix_seaport_optimism_events.sql | 0 .../optimism/nft_optimism_base_trades.sql | 0 .../chains/optimism/platforms/_schema.yml | 0 .../element_optimism_base_trades.sql | 0 .../opensea_v3_optimism_base_trades.sql | 0 .../opensea_v4_optimism_base_trades.sql | 0 .../quix_v1_optimism_base_trades.sql | 2 +- .../quix_v2_optimism_base_trades.sql | 2 +- .../quix_v3_optimism_base_trades.sql | 2 +- .../quix_v4_optimism_base_trades.sql | 2 +- .../quix_v5_optimism_base_trades.sql | 2 +- .../platforms/tofu_optimism_base_trades.sql | 0 .../platforms/zonic_optimism_base_trades.sql | 0 .../polygon/nft_polygon_base_trades.sql | 0 .../chains/polygon/platforms/_schema.yml | 0 .../aavegotchi_polygon_base_trades.sql | 0 .../platforms/aurem_polygon_base_trades.sql | 0 .../decentraland_polygon_base_trades.sql | 0 .../platforms/dew_polygon_base_trades.sql | 0 .../platforms/element_polygon_base_trades.sql | 0 .../platforms/fractal_polygon_base_trades.sql | 0 .../magiceden_polygon_base_trades.sql | 0 .../magiceden_v2_polygon_base_trades.sql | 0 .../opensea_v2_polygon_base_trades.sql | 0 .../opensea_v3_polygon_base_trades.sql | 0 .../opensea_v4_polygon_base_trades.sql | 0 .../platforms/rarible_polygon_base_trades.sql | 0 .../platforms/tofu_polygon_base_trades.sql | 0 .../chains/scroll/nft_scroll_base_trades.sql | 0 .../chains/scroll/platforms/_schema.yml | 0 .../platforms/element_scroll_base_trades.sql | 0 .../platforms/zonic_scroll_base_trades.sql | 0 .../chains/solana/nft_solana_base_trades.sql | 0 .../chains/solana/nft_solana_old_trades.sql | 0 .../chains/solana/nft_solana_trades.sql | 0 .../solana/nft_solana_trades_schema.yml | 0 .../trades/chains/solana/old/_schema.yml | 0 .../solana/old/magiceden_solana_events.sql | 0 .../solana/old/opensea_solana_events.sql | 0 .../chains/solana/platforms/_schema.yml | 0 .../platforms/magiceden_mmm_solana_trades.sql | 6 +- .../platforms/magiceden_v2_solana_trades.sql | 10 +- .../platforms/magiceden_v3_solana_trades.sql | 0 .../platforms/tensorswap_v1_solana_trades.sql | 0 .../platforms/tensorswap_v2_solana_trades.sql | 0 .../chains/zksync/nft_zksync_base_trades.sql | 0 .../chains/zksync/platforms/_schema.yml | 0 .../platforms/element_zksync_base_trades.sql | 0 .../kreatorland_zksync_base_trades.sql | 0 .../mint_square_zksync_base_trades.sql | 0 .../platforms/tevaera_zksync_base_trades.sql | 0 .../zk_markets_zksync_base_trades.sql | 2 +- .../platforms/zonic_zksync_base_trades.sql | 0 .../chains/zora/nft_zora_base_trades.sql | 0 .../trades/chains/zora/platforms/_schema.yml | 0 .../platforms/opensea_v4_zora_base_trades.sql | 0 .../zora/platforms/zonic_zora_base_trades.sql | 0 .../trades/compatibility_views/nft_events.sql | 0 .../trades/compatibility_views/nft_fees.sql | 0 .../_sector}/trades/nft_base_trades.sql | 0 .../models/_sector}/trades/nft_trades.sql | 0 .../_sector}/trades/nft_trades_beta.sql | 0 .../trades/platform_views/_schema.yml | 0 .../platform_views/aavegotchi_trades_view.sql | 0 .../archipelago_trades_view.sql | 0 .../platform_views/blur_trades_view.sql | 0 .../collectionswap_trades_view.sql | 0 .../cryptopunks_trades_view.sql | 0 .../platform_views/element_trades_view.sql | 0 .../platform_views/fantasy_trades_view.sql | 2 +- .../platform_views/foundation_trades_view.sql | 0 .../platform_views/fractal_trades_view.sql | 0 .../platform_views/looksrare_trades_view.sql | 0 .../platform_views/magiceden_trades_view.sql | 0 .../platform_views/nftb_trades_view.sql | 0 .../platform_views/nftearth_trades_view.sql | 0 .../platform_views/nftrade_trades_view.sql | 0 .../platform_views/oneplanet_trades_view.sql | 0 .../platform_views/opensea_trades_view.sql | 0 .../pancakeswap_trades_view.sql | 0 .../platform_views/quix_trades_view.sql | 0 .../platform_views/rarible_trades_view.sql | 0 .../platform_views/stealcam_trades_view.sql | 0 .../platform_views/sudoswap_trades_view.sql | 0 .../platform_views/superrare_trades_view.sql | 0 .../platform_views/tofu_trades_view.sql | 0 .../platform_views/x2y2_trades_view.sql | 0 .../platform_views/zonic_trades_view.sql | 0 .../platform_views/zora_trades_view.sql | 0 .../models/_sector}/trades/schema.yml | 0 .../models/_sector}/transfers/_schema.yml | 0 .../chains/nft_arbitrum_transfers.sql | 0 .../chains/nft_avalanche_c_transfers.sql | 0 .../transfers/chains/nft_base_transfers.sql | 0 .../transfers/chains/nft_bnb_transfers.sql | 0 .../transfers/chains/nft_celo_transfers.sql | 0 .../chains/nft_ethereum_transfers.sql | 0 .../transfers/chains/nft_fantom_transfers.sql | 0 .../transfers/chains/nft_gnosis_transfers.sql | 0 .../transfers/chains/nft_goerli_transfers.sql | 0 .../chains/nft_optimism_transfers.sql | 0 .../chains/nft_polygon_transfers.sql | 0 .../transfers/chains/nft_scroll_transfers.sql | 0 .../transfers/chains/nft_zksync_transfers.sql | 0 .../transfers/chains/nft_zora_transfers.sql | 0 .../_sector}/transfers/nft_transfers.sql | 0 .../models/_sector}/wash_trades/_schema.yml | 10 +- .../chains/nft_arbitrum_wash_trades.sql | 0 .../chains/nft_avalanche_c_wash_trades.sql | 0 .../chains/nft_base_wash_trades.sql | 0 .../chains/nft_bnb_wash_trades.sql | 0 .../chains/nft_celo_wash_trades.sql | 0 .../chains/nft_ethereum_wash_trades.sql | 0 .../chains/nft_gnosis_wash_trades.sql | 0 .../chains/nft_optimism_wash_trades.sql | 0 .../chains/nft_polygon_wash_trades.sql | 0 .../chains/nft_scroll_wash_trades.sql | 0 .../chains/nft_zksync_wash_trades.sql | 0 .../chains/nft_zora_wash_trades.sql | 0 .../_sector}/wash_trades/nft_wash_trades.sql | 0 ...hereum_metadata_art_blocks_collections.sql | 11 +- ...reum_metadata_art_platform_collections.sql | 1 + .../nft_ethereum_metadata_braindrops.sql | 3 +- .../nft_ethereum_metadata_bright_moments.sql | 5 +- ...nft_ethereum_metadata_chromie_squiggle.sql | 3 +- .../nft_ethereum_metadata_cryptodickbutts.sql | 3 +- ...t_ethereum_metadata_fellowship_gallery.sql | 5 +- ...hereum_metadata_mirage_gallery_curated.sql | 5 +- .../nft_ethereum_metadata_proof_grails_i.sql | 3 +- .../nft_ethereum_metadata_proof_grails_ii.sql | 3 +- .../nft_ethereum_metadata_ringers.sql | 3 +- .../metadata/nft_ethereum_metadata_schema.yml | 0 .../nft_ethereum_metadata_terraforms.sql | 3 +- .../metadata/nft_ethereum_metadata_verse.sql | 5 +- .../nft_ethereum_collection_stats.sql | 0 .../ethereum/nft_ethereum_schema.yml | 0 .../ethereum/nft_ethereum_top_minters.sql | 4 +- .../ethereum/nft_ethereum_top_sales.sql | 0 .../ethereum/nft_ethereum_wallet_metrics.sql | 18 +- .../ethereum/nft_ethereum_wallet_pnl.sql | 0 .../nft_metrics}/nft_linked_addresses.sql | 0 .../nft_metrics}/nft_marketplaces_info.sql | 0 nft/models/nft_metrics/nft_schema.yml | 49 + .../arbitrum/seaport_arbitrum_base_pairs.sql | 8 +- .../arbitrum/seaport_arbitrum_schema.yml | 0 .../arbitrum/seaport_arbitrum_tagging.sql | 5 +- .../arbitrum/seaport_arbitrum_trades.sql | 2 +- .../seaport_avalanche_c_base_pairs.sql | 6 +- .../seaport_avalanche_c_schema.yml | 0 .../seaport_avalanche_c_tagging.sql | 5 +- .../seaport_avalanche_c_trades.sql | 2 +- .../seaport/base/seaport_base_schema.yml | 0 .../seaport/base/seaport_base_tagging.sql | 5 +- .../seaport/bnb/seaport_bnb_base_pairs.sql | 6 +- .../seaport/bnb/seaport_bnb_schema.yml | 0 .../seaport/bnb/seaport_bnb_tagging.sql | 5 +- .../seaport/bnb/seaport_bnb_trades.sql | 2 +- .../chains/seaport_arbitrum_traces.sql | 0 .../chains/seaport_avalanche_c_traces.sql | 0 .../seaport/chains/seaport_base_traces.sql | 0 .../seaport/chains/seaport_bnb_traces.sql | 0 .../chains/seaport_ethereum_traces.sql | 0 .../chains/seaport_optimism_traces.sql | 0 .../seaport/chains/seaport_polygon_traces.sql | 0 .../ethereum/seaport_ethereum_base_pairs.sql | 2 +- .../ethereum/seaport_ethereum_schema.yml | 0 .../ethereum/seaport_ethereum_tagging.sql | 5 +- .../ethereum/seaport_ethereum_trades.sql | 8 +- .../ethereum/seaport_v1_ethereum_trades.sql | 0 .../ethereum/seaport_v2_ethereum_trades.sql | 0 .../optimism/seaport_optimism_base_pairs.sql | 2 +- .../optimism/seaport_optimism_schema.yml | 0 .../optimism/seaport_optimism_tagging.sql | 5 +- .../optimism/seaport_optimism_trades.sql | 2 +- .../polygon/seaport_polygon_base_pairs.sql | 6 +- .../polygon/seaport_polygon_schema.yml | 0 .../polygon/seaport_polygon_tagging.sql | 5 +- .../polygon/seaport_polygon_trades.sql | 2 +- .../models}/seaport/seaport_schema.yml | 0 .../models}/seaport/seaport_tagging.sql | 3 +- .../models}/seaport/seaport_traces.sql | 4 +- nft/package-lock.yml | 4 + nft/packages.yml | 3 + nft/profiles.yml | 12 + {seeds => nft/seeds}/astaria/_schema.yml | 0 .../seeds}/astaria/astaria_lending_seed.csv | 0 .../seeds}/bend_dao/ethereum/_schema.yml | 0 .../ethereum/bend_dao_nft_lending.csv | 0 .../opensea_wyvern_trades_samples.csv | 0 .../seeds}/opensea/ethereum/schema.yml | 0 .../opensea_seaport_trades_samples.csv | 0 .../opensea_polygon_zeroex_trades_samples.csv | 0 .../seeds}/opensea/polygon/schema.yml | 0 {seeds => nft/seeds}/opensea/schema.yml | 0 .../solana/opensea_solana_trades_solscan.csv | 0 .../seeds}/opensea/solana/schema.yml | 0 {seeds => nft/seeds}/seaport/_schema.yml | 0 .../seaport_ethereum_transfers_postgres.csv | 0 ...rt_ethereum_view_transactions_postgres.csv | 0 .../seeds}/seaport/seaport_trades_seed.csv | 0 .../seeds/trades/base_trades}/_schema.yml | 27 +- .../alienswap_base_base_trades_seed.csv | 0 .../archipelago_ethereum_base_trades_seed.csv | 0 .../aurem_polygon_base_trades_seed.csv | 0 .../blur_ethereum_base_trades_seed.csv | 0 ...blur_seaport_ethereum_base_trades_seed.csv | 0 .../blur_v2_ethereum_base_trades_seed.csv | 0 .../campfire_avalanche_c_base_trades_seed.csv | 0 .../chikn_avalanche_c_base_trades_seed.csv | 0 ...llectionswap_ethereum_base_trades_seed.csv | 0 .../cryptopunks_ethereum_base_trades_seed.csv | 0 .../dew_polygon_base_trades_seed.csv | 0 .../element_arbitrum_base_trades_seed.csv | 0 .../element_base_base_trades_seed.csv | 0 .../element_ethereum_base_trades_seed.csv | 0 .../element_optimism_base_trades_seed.csv | 0 .../foundation_ethereum_base_trades_seed.csv | 0 ...yperspace_avalanche_c_base_trades_seed.csv | 0 .../joepegs_avalanche_c_base_trades_seed.csv | 0 ...rare_seaport_ethereum_base_trades_seed.csv | 0 ...looksrare_v1_ethereum_base_trades_seed.csv | 0 ...looksrare_v2_ethereum_base_trades_seed.csv | 0 .../mintsquare_zksync_base_trades_seed.csv | 0 .../trades/base_trades}/quix_events_seed.csv | 0 .../sudoswap_ethereum_base_trades_seed.csv | 0 .../sudoswap_v2_arbitrum_base_trades_seed.csv | 0 .../sudoswap_v2_base_base_trades_seed.csv | 0 .../sudoswap_v2_ethereum_base_trades_seed.csv | 0 .../superrare_ethereum_base_trades_seed.csv | 0 .../tevaera_zksync_base_trades_seed.csv | 0 .../x2y2_ethereum_base_trades_seed.csv | 0 .../zk_markets_zksync_base_trades_seed.csv | 0 .../zonic_arbitrum_base_trades_seed.csv | 0 .../zonic_base_base_trades_seed.csv | 0 .../zonic_zksync_base_trades_seed.csv | 0 .../zonic_zora_base_trades_seed.csv | 0 .../zora_v1_ethereum_base_trades_seed.csv | 0 .../zora_v2_ethereum_base_trades_seed.csv | 0 .../zora_v3_ethereum_base_trades_seed.csv | 0 .../seeds/trades/solana_trades}/_schema.yml | 5 + .../magiceden_mmm_solana_trades_seed.csv | 0 .../magiceden_solana_trades_solscan.csv | 0 .../magiceden_v2_solana_trades_seed.csv | 0 .../magiceden_v3_solana_trades_seed.csv | 0 .../tensorswap_v1_solana_trades_seed.csv | 0 .../tensorswap_v2_solana_trades_seed.csv | 0 .../tests}/check_nft_rowcount_blur.sql | 0 .../tests}/check_nft_rowcount_superrare.sql | 0 .../tests}/check_nft_rowcount_zora_v1.sql | 0 .../tests}/generic/check_seaport_seed.sql | 0 .../magiceden_solana_assert_samples.sql | 0 ...reum_aggregators_markers_no_collisions.sql | 0 .../nft_ethereum_collection_stats_test.sql | 0 .../tests}/nft_ethereum_native_mints_test.sql | 0 .../solana/opensea_solana_assert_samples.sql | 0 scripts/check_schema.sh | 22 + seeds/collectionswap/_schema.yml | 9 - ...collectionswap_ethereum_trades_samples.csv | 5 - .../ethereum/foundation_trades_samples.csv | 18 - .../polygon/fractal_polygon_sample_trades.csv | 3 - seeds/fractal/polygon/schema.yml | 11 - .../looksrare_ethereum_seed_schema.yml | 16 - .../looksrare_ethereum_trades_postgres.csv | 1002 ----------------- .../ethereum/looksrare_ethereum_v1_trades.csv | 11 - .../ethereum/looksrare_ethereum_v2_trades.csv | 11 - seeds/magiceden/polygon/_schema.yml | 15 - .../magiceden_polygon_sample_trades.csv | 26 - seeds/magiceden/solana/schema.yml | 7 - seeds/nftb/bnb/nftb_nft_trades_samples.csv | 4 - seeds/nftb/bnb/schema.yml | 10 - .../bnb/nftrade_nft_trades_samples.csv | 4 - seeds/nftrade/bnb/schema.yml | 10 - .../bnb/pancakeswap_nft_trades_samples.csv | 21 - seeds/pancakeswap/bnb/schema.yml | 10 - seeds/quix/schema.yml | 16 - seeds/trove/arbitrum/schema.yml | 19 - .../trove_v1_arbitrum_nft_samples.csv | 3 - .../trove_v2_arbitrum_nft_samples.csv | 5 - seeds/trove/ethereum/schema.yml | 10 - .../trove_ethereum_nft_trades_samples.csv | 3 - .../zeroex_api_fills_deduped_sample.csv | 12 +- seeds/zeroex/zeroex_api_fills_sample.csv | 4 +- seeds/zonic/schema.yml | 11 - seeds/zonic/zonic_events_seed.csv | 18 - sources/_subprojects/nft/_sources.yml | 17 + sources/_subprojects/spellbook/_sources.yml | 10 +- .../ethereum/sudoswap_ethereum_sources.yml | 1 + tests/generic/check_seed.sql | 20 - .../compare_column_values_to_seed_values.sql | 22 - tests/generic/equal_rowcount_with_sources.sql | 27 - tests/generic/is_unique_filtered.sql | 13 - 488 files changed, 846 insertions(+), 2160 deletions(-) create mode 100644 .github/workflows/nft.yml delete mode 100644 daily_spellbook/tests/generic/check_seed.sql delete mode 100644 daily_spellbook/tests/generic/compare_column_values_to_seed_values.sql delete mode 100644 daily_spellbook/tests/generic/is_unique_filtered.sql rename tests/generic/check_column_types.sql => macros/generic-tests/check_column_types_macro.sql (79%) rename macros/{test-helpers => generic-tests}/check_seed_macro.sql (91%) rename {daily_spellbook/tests/generic => macros/generic-tests}/equal_rowcount_with_sources.sql (100%) delete mode 100644 macros/test-helpers/check_column_types_macro.sql delete mode 100644 macros/test-helpers/test_helpers_schema.yml delete mode 100644 models/nft/nft_schema.yml create mode 100644 nft/README.md create mode 100644 nft/dbt_project.yml rename {macros/models/_sector/nft => nft/macros}/add_nft_tx_data.sql (100%) rename {macros/models/_sector/nft => nft/macros}/enrich_nft_trades.sql (96%) rename {macros/models/_sector/nft => nft/macros}/nft_approvals.sql (100%) rename {macros/models/_sector/nft => nft/macros}/nft_mints.sql (99%) rename {macros/models/_sector/nft => nft/macros}/nft_transfers.sql (100%) rename {macros/models/_sector/nft => nft/macros}/nft_wash_trades.sql (94%) rename {macros/models/_sector/nft => nft/macros}/platforms/element_v1_base_trades.sql (100%) rename {macros/models/_sector/nft => nft/macros}/platforms/seaport_v3_fork_trades.sql (100%) rename {macros/models/_sector/nft => nft/macros}/platforms/seaport_v3_trades.sql (100%) rename {macros/models/_sector/nft => nft/macros}/platforms/seaport_v4_fork_trades.sql (100%) rename {macros/models/_sector/nft => nft/macros}/platforms/seaport_v4_trades.sql (100%) rename {macros/models/_sector/nft => nft/macros}/platforms/sudoswap_v2_base_trades.sql (100%) rename {macros/models/_sector/nft => nft/macros}/platforms/tofu_v1_base_trades.sql (100%) rename {macros/models/_sector/nft => nft/macros}/platforms/zonic_base_trades.sql (100%) rename {macros/models/_sector/nft => nft/macros}/platforms/zora_mints.sql (90%) rename {macros/models/_sector/nft => nft/macros}/port_to_old_schema.sql (100%) create mode 100644 nft/models/_extra_sources.yml rename {models/_sector/nft => nft/models/_sector}/aggregators/_schema.yml (100%) rename {models/_sector/nft => nft/models/_sector}/aggregators/chains/_schema.yml (100%) rename {models/_sector/nft => nft/models/_sector}/aggregators/chains/nft_arbitrum_aggregators.sql (100%) rename {models/_sector/nft => nft/models/_sector}/aggregators/chains/nft_avalanche_c_aggregators.sql (100%) rename {models/_sector/nft => nft/models/_sector}/aggregators/chains/nft_bnb_aggregators.sql (100%) rename {models/_sector/nft => nft/models/_sector}/aggregators/chains/nft_celo_aggregators.sql (100%) rename {models/_sector/nft => nft/models/_sector}/aggregators/chains/nft_ethereum_aggregators.sql (100%) rename {models/_sector/nft => nft/models/_sector}/aggregators/chains/nft_ethereum_aggregators_gem.sql (100%) rename {models/_sector/nft => nft/models/_sector}/aggregators/chains/nft_ethereum_aggregators_manual.sql (100%) rename {models/_sector/nft => nft/models/_sector}/aggregators/chains/nft_ethereum_aggregators_markers.sql (100%) rename {models/_sector/nft => nft/models/_sector}/aggregators/chains/nft_optimism_aggregators.sql (100%) rename {models/_sector/nft => nft/models/_sector}/aggregators/chains/nft_polygon_aggregators.sql (100%) rename {models/_sector/nft => nft/models/_sector}/aggregators/nft_aggregators.sql (100%) rename {models/_sector/nft => nft/models/_sector}/approvals/_schema.yml (100%) rename {models/_sector/nft => nft/models/_sector}/approvals/chains/_schema.yml (100%) rename {models/_sector/nft => nft/models/_sector}/approvals/chains/nft_arbitrum_approvals.sql (100%) rename {models/_sector/nft => nft/models/_sector}/approvals/chains/nft_avalanche_c_approvals.sql (100%) rename {models/_sector/nft => nft/models/_sector}/approvals/chains/nft_base_approvals.sql (100%) rename {models/_sector/nft => nft/models/_sector}/approvals/chains/nft_bnb_approvals.sql (100%) rename {models/_sector/nft => nft/models/_sector}/approvals/chains/nft_celo_approvals.sql (100%) rename {models/_sector/nft => nft/models/_sector}/approvals/chains/nft_ethereum_approvals.sql (100%) rename {models/_sector/nft => nft/models/_sector}/approvals/chains/nft_fantom_approvals.sql (100%) rename {models/_sector/nft => nft/models/_sector}/approvals/chains/nft_gnosis_approvals.sql (100%) rename {models/_sector/nft => nft/models/_sector}/approvals/chains/nft_goerli_approvals.sql (100%) rename {models/_sector/nft => nft/models/_sector}/approvals/chains/nft_optimism_approvals.sql (100%) rename {models/_sector/nft => nft/models/_sector}/approvals/chains/nft_polygon_approvals.sql (100%) rename {models/_sector/nft => nft/models/_sector}/approvals/chains/nft_scroll_approvals.sql (100%) rename {models/_sector/nft => nft/models/_sector}/approvals/chains/nft_zksync_approvals.sql (100%) rename {models/_sector/nft => nft/models/_sector}/approvals/nft_approvals.sql (100%) create mode 100644 nft/models/_sector/lending/_schema.yml rename models/astaria/ethereum/astaria_ethereum_schema.yml => nft/models/_sector/lending/ethereum/_schema.yml (81%) rename {models/astaria => nft/models/_sector/lending}/ethereum/astaria_ethereum_daily_deposits.sql (97%) rename {models/astaria => nft/models/_sector/lending}/ethereum/astaria_ethereum_events.sql (68%) rename {models/astaria => nft/models/_sector/lending}/ethereum/astaria_ethereum_lending.sql (54%) rename {models/bend_dao => nft/models/_sector/lending}/ethereum/bend_dao_ethereum_lending.sql (93%) rename {models/nft => nft/models/_sector/lending}/nft_lending.sql (98%) rename {models/_sector/nft => nft/models/_sector}/mints/_schema.yml (100%) rename {models/_sector/nft => nft/models/_sector}/mints/native/_schema.yml (100%) rename {models/_sector/nft => nft/models/_sector}/mints/native/nft_base_native_mints.sql (100%) rename {models/_sector/nft => nft/models/_sector}/mints/native/nft_ethereum_native_mints.sql (100%) rename {models/_sector/nft => nft/models/_sector}/mints/native/nft_optimism_native_mints.sql (100%) rename {models/_sector/nft => nft/models/_sector}/mints/native/nft_zksync_native_mints.sql (100%) rename {models/_sector/nft => nft/models/_sector}/mints/native/nft_zora_native_mints.sql (100%) rename {models/_sector/nft => nft/models/_sector}/mints/nft_mints.sql (100%) rename {models/_sector/nft => nft/models/_sector}/mints/platforms/_schema.yml (100%) rename {models/_sector/nft => nft/models/_sector}/mints/platforms/zora_base_mints.sql (100%) rename {models/_sector/nft => nft/models/_sector}/mints/platforms/zora_ethereum_mints.sql (100%) rename {models/_sector/nft => nft/models/_sector}/mints/platforms/zora_goerli_mints.sql (100%) rename {models/_sector/nft => nft/models/_sector}/mints/platforms/zora_mints.sql (100%) rename {models/_sector/nft => nft/models/_sector}/mints/platforms/zora_optimism_mints.sql (100%) rename {models/_sector/nft => nft/models/_sector}/mints/platforms/zora_zora_mints.sql (94%) rename {models/_sector/nft => nft/models/_sector}/trades/MIGRATION.md (100%) rename {models/_sector/nft => nft/models/_sector}/trades/chains/_schema.yml (100%) rename {models/_sector/nft => nft/models/_sector}/trades/chains/arbitrum/nft_arbitrum_base_trades.sql (100%) rename {models/_sector/nft => nft/models/_sector}/trades/chains/arbitrum/platforms/_schema.yml (100%) rename {models/_sector/nft => nft/models/_sector}/trades/chains/arbitrum/platforms/element_arbitrum_base_trades.sql (100%) rename {models/_sector/nft => nft/models/_sector}/trades/chains/arbitrum/platforms/opensea_v3_arbitrum_base_trades.sql (100%) rename {models/_sector/nft => nft/models/_sector}/trades/chains/arbitrum/platforms/opensea_v4_arbitrum_base_trades.sql (100%) rename {models/_sector/nft => nft/models/_sector}/trades/chains/arbitrum/platforms/stealcam_arbitrum_base_trades.sql (100%) rename {models/_sector/nft => nft/models/_sector}/trades/chains/arbitrum/platforms/sudoswap_v2_arbitrum__pools.sql (100%) rename {models/_sector/nft => nft/models/_sector}/trades/chains/arbitrum/platforms/sudoswap_v2_arbitrum_base_trades.sql (100%) rename {models/_sector/nft => nft/models/_sector}/trades/chains/arbitrum/platforms/tofu_arbitrum_base_trades.sql (100%) rename {models/_sector/nft => nft/models/_sector}/trades/chains/arbitrum/platforms/trove_v1_arbitrum_base_trades.sql (100%) rename {models/_sector/nft => nft/models/_sector}/trades/chains/arbitrum/platforms/trove_v2_arbitrum_base_trades.sql (100%) rename {models/_sector/nft => nft/models/_sector}/trades/chains/arbitrum/platforms/zonic_arbitrum_base_trades.sql (100%) rename {models/_sector/nft => nft/models/_sector}/trades/chains/avalanche_c/nft_avalanche_c_base_trades.sql (100%) rename {models/_sector/nft => nft/models/_sector}/trades/chains/avalanche_c/platforms/_schema.yml (100%) rename {models/_sector/nft => nft/models/_sector}/trades/chains/avalanche_c/platforms/campfire_avalanche_c_base_trades.sql (100%) rename {models/_sector/nft => nft/models/_sector}/trades/chains/avalanche_c/platforms/chikn_avalanche_c_base_trades.sql (100%) rename {models/_sector/nft => nft/models/_sector}/trades/chains/avalanche_c/platforms/element_avalanche_c_base_trades.sql (100%) rename {models/_sector/nft => nft/models/_sector}/trades/chains/avalanche_c/platforms/hyperspace_avalanche_c_base_trades.sql (100%) rename {models/_sector/nft => nft/models/_sector}/trades/chains/avalanche_c/platforms/joepegs_avalanche_c_base_trades.sql (100%) rename {models/_sector/nft => nft/models/_sector}/trades/chains/avalanche_c/platforms/opensea_v3_avalanche_c_base_trades.sql (100%) rename {models/_sector/nft => nft/models/_sector}/trades/chains/avalanche_c/platforms/opensea_v4_avalanche_c_base_trades.sql (100%) rename {models/_sector/nft => nft/models/_sector}/trades/chains/base/nft_base_base_trades.sql (100%) rename {models/_sector/nft => nft/models/_sector}/trades/chains/base/platforms/_schema.yml (100%) rename {models/_sector/nft => nft/models/_sector}/trades/chains/base/platforms/alienswap_base_base_trades.sql (100%) rename {models/_sector/nft => nft/models/_sector}/trades/chains/base/platforms/element_base_base_trades.sql (100%) rename {models/_sector/nft => nft/models/_sector}/trades/chains/base/platforms/magiceden_base_base_trades.sql (99%) rename {models/_sector/nft => nft/models/_sector}/trades/chains/base/platforms/opensea_v4_base_base_trades.sql (100%) rename {models/_sector/nft => nft/models/_sector}/trades/chains/base/platforms/sudoswap_v2_base__pools.sql (100%) rename {models/_sector/nft => nft/models/_sector}/trades/chains/base/platforms/sudoswap_v2_base_base_trades.sql (100%) rename {models/_sector/nft => nft/models/_sector}/trades/chains/base/platforms/zonic_base_base_trades.sql (100%) rename {models/_sector/nft => nft/models/_sector}/trades/chains/blast/nft_blast_base_trades.sql (100%) rename {models/_sector/nft => nft/models/_sector}/trades/chains/blast/platforms/_schema.yml (100%) rename {models/_sector/nft => nft/models/_sector}/trades/chains/blast/platforms/blur_blast_base_trades.sql (100%) rename {models/_sector/nft => nft/models/_sector}/trades/chains/blast/platforms/fantasy_blast_base_trades.sql (100%) rename {models/_sector/nft => nft/models/_sector}/trades/chains/bnb/nft_bnb_base_trades.sql (100%) rename {models/_sector/nft => nft/models/_sector}/trades/chains/bnb/platforms/_schema.yml (100%) rename {models/_sector/nft => nft/models/_sector}/trades/chains/bnb/platforms/element_bnb_base_trades.sql (100%) rename {models/_sector/nft => nft/models/_sector}/trades/chains/bnb/platforms/liquidifty_bnb_base_trades.sql (100%) rename {models/_sector/nft => nft/models/_sector}/trades/chains/bnb/platforms/nftb_bnb_base_trades.sql (100%) rename {models/_sector/nft => nft/models/_sector}/trades/chains/bnb/platforms/nftrade_bnb_base_trades.sql (100%) rename {models/_sector/nft => nft/models/_sector}/trades/chains/bnb/platforms/pancakeswap_nft_bnb_base_trades.sql (100%) rename {models/_sector/nft => nft/models/_sector}/trades/chains/bnb/platforms/tofu_bnb_base_trades.sql (100%) rename {models/_sector/nft => nft/models/_sector}/trades/chains/celo/nft_celo_base_trades.sql (100%) rename {models/_sector/nft => nft/models/_sector}/trades/chains/celo/platforms/_schema.yml (100%) rename {models/_sector/nft => nft/models/_sector}/trades/chains/celo/platforms/tofu_celo_base_trades.sql (100%) rename {models/_sector/nft => nft/models/_sector}/trades/chains/ethereum/nft_ethereum_base_trades.sql (100%) rename {models/_sector/nft => nft/models/_sector}/trades/chains/ethereum/platforms/_schema.yml (100%) rename {models/_sector/nft => nft/models/_sector}/trades/chains/ethereum/platforms/archipelago_ethereum_base_trades.sql (100%) rename {models/_sector/nft => nft/models/_sector}/trades/chains/ethereum/platforms/blur_ethereum_base_trades.sql (100%) rename {models/_sector/nft => nft/models/_sector}/trades/chains/ethereum/platforms/blur_seaport_ethereum_base_trades.sql (100%) rename {models/_sector/nft => nft/models/_sector}/trades/chains/ethereum/platforms/blur_v2_ethereum_base_trades.sql (100%) rename {models/_sector/nft => nft/models/_sector}/trades/chains/ethereum/platforms/collectionswap_ethereum__pools.sql (100%) rename {models/_sector/nft => nft/models/_sector}/trades/chains/ethereum/platforms/collectionswap_ethereum_base_trades.sql (100%) rename {models/_sector/nft => nft/models/_sector}/trades/chains/ethereum/platforms/cryptopunks_ethereum_base_trades.sql (100%) rename {models/_sector/nft => nft/models/_sector}/trades/chains/ethereum/platforms/element_ethereum_base_trades.sql (100%) rename {models/_sector/nft => nft/models/_sector}/trades/chains/ethereum/platforms/foundation_ethereum_base_trades.sql (100%) rename {models/_sector/nft => nft/models/_sector}/trades/chains/ethereum/platforms/liquidifty_ethereum_base_trades.sql (100%) rename {models/_sector/nft => nft/models/_sector}/trades/chains/ethereum/platforms/looksrare_seaport_ethereum_base_trades.sql (100%) rename {models/_sector/nft => nft/models/_sector}/trades/chains/ethereum/platforms/looksrare_v1_ethereum_base_trades.sql (100%) rename {models/_sector/nft => nft/models/_sector}/trades/chains/ethereum/platforms/looksrare_v2_ethereum_base_trades.sql (100%) rename {models/_sector/nft => nft/models/_sector}/trades/chains/ethereum/platforms/magiceden_ethereum_base_trades.sql (100%) rename {models/_sector/nft => nft/models/_sector}/trades/chains/ethereum/platforms/opensea_v1_ethereum_base_trades.sql (100%) rename {models/_sector/nft => nft/models/_sector}/trades/chains/ethereum/platforms/opensea_v3_ethereum_base_trades.sql (100%) rename {models/_sector/nft => nft/models/_sector}/trades/chains/ethereum/platforms/opensea_v4_ethereum_base_trades.sql (100%) rename {models/_sector/nft => nft/models/_sector}/trades/chains/ethereum/platforms/sudoswap_ethereum_base_trades.sql (100%) rename {models/_sector/nft => nft/models/_sector}/trades/chains/ethereum/platforms/sudoswap_v2_ethereum__pools.sql (100%) rename {models/_sector/nft => nft/models/_sector}/trades/chains/ethereum/platforms/sudoswap_v2_ethereum_base_trades.sql (100%) rename {models/_sector/nft => nft/models/_sector}/trades/chains/ethereum/platforms/superrare_ethereum_base_trades.sql (100%) rename {models/_sector/nft => nft/models/_sector}/trades/chains/ethereum/platforms/trove_ethereum_base_trades.sql (100%) rename {models/_sector/nft => nft/models/_sector}/trades/chains/ethereum/platforms/x2y2_ethereum_base_trades.sql (100%) rename {models/_sector/nft => nft/models/_sector}/trades/chains/ethereum/platforms/zora_v1_ethereum_base_trades.sql (100%) rename {models/_sector/nft => nft/models/_sector}/trades/chains/ethereum/platforms/zora_v2_ethereum_base_trades.sql (100%) rename {models/_sector/nft => nft/models/_sector}/trades/chains/ethereum/platforms/zora_v3_ethereum_base_trades.sql (100%) rename {models/_sector/nft => nft/models/_sector}/trades/chains/linea/nft_linea_base_trades.sql (100%) rename {models/_sector/nft => nft/models/_sector}/trades/chains/linea/platforms/_schema.yml (100%) rename {models/_sector/nft => nft/models/_sector}/trades/chains/linea/platforms/element_linea_base_trades.sql (100%) rename {models/_sector/nft => nft/models/_sector}/trades/chains/old/nft_old_base_trades.sql (100%) rename {models/_sector/nft => nft/models/_sector}/trades/chains/old/platforms/_schema.yml (100%) rename {models/_sector/nft => nft/models/_sector}/trades/chains/old/platforms/mooar_polygon_events.sql (100%) rename {models/_sector/nft => nft/models/_sector}/trades/chains/old/platforms/nftearth_optimism_events.sql (100%) rename {models/_sector/nft => nft/models/_sector}/trades/chains/old/platforms/oneplanet_polygon_events.sql (100%) rename {models/_sector/nft => nft/models/_sector}/trades/chains/old/platforms/quix_optimism_schema.yml (100%) rename {models/_sector/nft => nft/models/_sector}/trades/chains/old/platforms/quix_seaport_optimism_events.sql (100%) rename {models/_sector/nft => nft/models/_sector}/trades/chains/optimism/nft_optimism_base_trades.sql (100%) rename {models/_sector/nft => nft/models/_sector}/trades/chains/optimism/platforms/_schema.yml (100%) rename {models/_sector/nft => nft/models/_sector}/trades/chains/optimism/platforms/element_optimism_base_trades.sql (100%) rename {models/_sector/nft => nft/models/_sector}/trades/chains/optimism/platforms/opensea_v3_optimism_base_trades.sql (100%) rename {models/_sector/nft => nft/models/_sector}/trades/chains/optimism/platforms/opensea_v4_optimism_base_trades.sql (100%) rename {models/_sector/nft => nft/models/_sector}/trades/chains/optimism/platforms/quix_v1_optimism_base_trades.sql (98%) rename {models/_sector/nft => nft/models/_sector}/trades/chains/optimism/platforms/quix_v2_optimism_base_trades.sql (98%) rename {models/_sector/nft => nft/models/_sector}/trades/chains/optimism/platforms/quix_v3_optimism_base_trades.sql (98%) rename {models/_sector/nft => nft/models/_sector}/trades/chains/optimism/platforms/quix_v4_optimism_base_trades.sql (98%) rename {models/_sector/nft => nft/models/_sector}/trades/chains/optimism/platforms/quix_v5_optimism_base_trades.sql (98%) rename {models/_sector/nft => nft/models/_sector}/trades/chains/optimism/platforms/tofu_optimism_base_trades.sql (100%) rename {models/_sector/nft => nft/models/_sector}/trades/chains/optimism/platforms/zonic_optimism_base_trades.sql (100%) rename {models/_sector/nft => nft/models/_sector}/trades/chains/polygon/nft_polygon_base_trades.sql (100%) rename {models/_sector/nft => nft/models/_sector}/trades/chains/polygon/platforms/_schema.yml (100%) rename {models/_sector/nft => nft/models/_sector}/trades/chains/polygon/platforms/aavegotchi_polygon_base_trades.sql (100%) rename {models/_sector/nft => nft/models/_sector}/trades/chains/polygon/platforms/aurem_polygon_base_trades.sql (100%) rename {models/_sector/nft => nft/models/_sector}/trades/chains/polygon/platforms/decentraland_polygon_base_trades.sql (100%) rename {models/_sector/nft => nft/models/_sector}/trades/chains/polygon/platforms/dew_polygon_base_trades.sql (100%) rename {models/_sector/nft => nft/models/_sector}/trades/chains/polygon/platforms/element_polygon_base_trades.sql (100%) rename {models/_sector/nft => nft/models/_sector}/trades/chains/polygon/platforms/fractal_polygon_base_trades.sql (100%) rename {models/_sector/nft => nft/models/_sector}/trades/chains/polygon/platforms/magiceden_polygon_base_trades.sql (100%) rename {models/_sector/nft => nft/models/_sector}/trades/chains/polygon/platforms/magiceden_v2_polygon_base_trades.sql (100%) rename {models/_sector/nft => nft/models/_sector}/trades/chains/polygon/platforms/opensea_v2_polygon_base_trades.sql (100%) rename {models/_sector/nft => nft/models/_sector}/trades/chains/polygon/platforms/opensea_v3_polygon_base_trades.sql (100%) rename {models/_sector/nft => nft/models/_sector}/trades/chains/polygon/platforms/opensea_v4_polygon_base_trades.sql (100%) rename {models/_sector/nft => nft/models/_sector}/trades/chains/polygon/platforms/rarible_polygon_base_trades.sql (100%) rename {models/_sector/nft => nft/models/_sector}/trades/chains/polygon/platforms/tofu_polygon_base_trades.sql (100%) rename {models/_sector/nft => nft/models/_sector}/trades/chains/scroll/nft_scroll_base_trades.sql (100%) rename {models/_sector/nft => nft/models/_sector}/trades/chains/scroll/platforms/_schema.yml (100%) rename {models/_sector/nft => nft/models/_sector}/trades/chains/scroll/platforms/element_scroll_base_trades.sql (100%) rename {models/_sector/nft => nft/models/_sector}/trades/chains/scroll/platforms/zonic_scroll_base_trades.sql (100%) rename {models/_sector/nft => nft/models/_sector}/trades/chains/solana/nft_solana_base_trades.sql (100%) rename {models/_sector/nft => nft/models/_sector}/trades/chains/solana/nft_solana_old_trades.sql (100%) rename {models/_sector/nft => nft/models/_sector}/trades/chains/solana/nft_solana_trades.sql (100%) rename {models/_sector/nft => nft/models/_sector}/trades/chains/solana/nft_solana_trades_schema.yml (100%) rename {models/_sector/nft => nft/models/_sector}/trades/chains/solana/old/_schema.yml (100%) rename {models/_sector/nft => nft/models/_sector}/trades/chains/solana/old/magiceden_solana_events.sql (100%) rename {models/_sector/nft => nft/models/_sector}/trades/chains/solana/old/opensea_solana_events.sql (100%) rename {models/_sector/nft => nft/models/_sector}/trades/chains/solana/platforms/_schema.yml (100%) rename {models/_sector/nft => nft/models/_sector}/trades/chains/solana/platforms/magiceden_mmm_solana_trades.sql (99%) rename {models/_sector/nft => nft/models/_sector}/trades/chains/solana/platforms/magiceden_v2_solana_trades.sql (99%) rename {models/_sector/nft => nft/models/_sector}/trades/chains/solana/platforms/magiceden_v3_solana_trades.sql (100%) rename {models/_sector/nft => nft/models/_sector}/trades/chains/solana/platforms/tensorswap_v1_solana_trades.sql (100%) rename {models/_sector/nft => nft/models/_sector}/trades/chains/solana/platforms/tensorswap_v2_solana_trades.sql (100%) rename {models/_sector/nft => nft/models/_sector}/trades/chains/zksync/nft_zksync_base_trades.sql (100%) rename {models/_sector/nft => nft/models/_sector}/trades/chains/zksync/platforms/_schema.yml (100%) rename {models/_sector/nft => nft/models/_sector}/trades/chains/zksync/platforms/element_zksync_base_trades.sql (100%) rename {models/_sector/nft => nft/models/_sector}/trades/chains/zksync/platforms/kreatorland_zksync_base_trades.sql (100%) rename {models/_sector/nft => nft/models/_sector}/trades/chains/zksync/platforms/mint_square_zksync_base_trades.sql (100%) rename {models/_sector/nft => nft/models/_sector}/trades/chains/zksync/platforms/tevaera_zksync_base_trades.sql (100%) rename {models/_sector/nft => nft/models/_sector}/trades/chains/zksync/platforms/zk_markets_zksync_base_trades.sql (98%) rename {models/_sector/nft => nft/models/_sector}/trades/chains/zksync/platforms/zonic_zksync_base_trades.sql (100%) rename {models/_sector/nft => nft/models/_sector}/trades/chains/zora/nft_zora_base_trades.sql (100%) rename {models/_sector/nft => nft/models/_sector}/trades/chains/zora/platforms/_schema.yml (100%) rename {models/_sector/nft => nft/models/_sector}/trades/chains/zora/platforms/opensea_v4_zora_base_trades.sql (100%) rename {models/_sector/nft => nft/models/_sector}/trades/chains/zora/platforms/zonic_zora_base_trades.sql (100%) rename {models/_sector/nft => nft/models/_sector}/trades/compatibility_views/nft_events.sql (100%) rename {models/_sector/nft => nft/models/_sector}/trades/compatibility_views/nft_fees.sql (100%) rename {models/_sector/nft => nft/models/_sector}/trades/nft_base_trades.sql (100%) rename {models/_sector/nft => nft/models/_sector}/trades/nft_trades.sql (100%) rename {models/_sector/nft => nft/models/_sector}/trades/nft_trades_beta.sql (100%) rename {models/_sector/nft => nft/models/_sector}/trades/platform_views/_schema.yml (100%) rename {models/_sector/nft => nft/models/_sector}/trades/platform_views/aavegotchi_trades_view.sql (100%) rename {models/_sector/nft => nft/models/_sector}/trades/platform_views/archipelago_trades_view.sql (100%) rename {models/_sector/nft => nft/models/_sector}/trades/platform_views/blur_trades_view.sql (100%) rename {models/_sector/nft => nft/models/_sector}/trades/platform_views/collectionswap_trades_view.sql (100%) rename {models/_sector/nft => nft/models/_sector}/trades/platform_views/cryptopunks_trades_view.sql (100%) rename {models/_sector/nft => nft/models/_sector}/trades/platform_views/element_trades_view.sql (100%) rename {models/_sector/nft => nft/models/_sector}/trades/platform_views/fantasy_trades_view.sql (97%) rename {models/_sector/nft => nft/models/_sector}/trades/platform_views/foundation_trades_view.sql (100%) rename {models/_sector/nft => nft/models/_sector}/trades/platform_views/fractal_trades_view.sql (100%) rename {models/_sector/nft => nft/models/_sector}/trades/platform_views/looksrare_trades_view.sql (100%) rename {models/_sector/nft => nft/models/_sector}/trades/platform_views/magiceden_trades_view.sql (100%) rename {models/_sector/nft => nft/models/_sector}/trades/platform_views/nftb_trades_view.sql (100%) rename {models/_sector/nft => nft/models/_sector}/trades/platform_views/nftearth_trades_view.sql (100%) rename {models/_sector/nft => nft/models/_sector}/trades/platform_views/nftrade_trades_view.sql (100%) rename {models/_sector/nft => nft/models/_sector}/trades/platform_views/oneplanet_trades_view.sql (100%) rename {models/_sector/nft => nft/models/_sector}/trades/platform_views/opensea_trades_view.sql (100%) rename {models/_sector/nft => nft/models/_sector}/trades/platform_views/pancakeswap_trades_view.sql (100%) rename {models/_sector/nft => nft/models/_sector}/trades/platform_views/quix_trades_view.sql (100%) rename {models/_sector/nft => nft/models/_sector}/trades/platform_views/rarible_trades_view.sql (100%) rename {models/_sector/nft => nft/models/_sector}/trades/platform_views/stealcam_trades_view.sql (100%) rename {models/_sector/nft => nft/models/_sector}/trades/platform_views/sudoswap_trades_view.sql (100%) rename {models/_sector/nft => nft/models/_sector}/trades/platform_views/superrare_trades_view.sql (100%) rename {models/_sector/nft => nft/models/_sector}/trades/platform_views/tofu_trades_view.sql (100%) rename {models/_sector/nft => nft/models/_sector}/trades/platform_views/x2y2_trades_view.sql (100%) rename {models/_sector/nft => nft/models/_sector}/trades/platform_views/zonic_trades_view.sql (100%) rename {models/_sector/nft => nft/models/_sector}/trades/platform_views/zora_trades_view.sql (100%) rename {models/_sector/nft => nft/models/_sector}/trades/schema.yml (100%) rename {models/_sector/nft => nft/models/_sector}/transfers/_schema.yml (100%) rename {models/_sector/nft => nft/models/_sector}/transfers/chains/nft_arbitrum_transfers.sql (100%) rename {models/_sector/nft => nft/models/_sector}/transfers/chains/nft_avalanche_c_transfers.sql (100%) rename {models/_sector/nft => nft/models/_sector}/transfers/chains/nft_base_transfers.sql (100%) rename {models/_sector/nft => nft/models/_sector}/transfers/chains/nft_bnb_transfers.sql (100%) rename {models/_sector/nft => nft/models/_sector}/transfers/chains/nft_celo_transfers.sql (100%) rename {models/_sector/nft => nft/models/_sector}/transfers/chains/nft_ethereum_transfers.sql (100%) rename {models/_sector/nft => nft/models/_sector}/transfers/chains/nft_fantom_transfers.sql (100%) rename {models/_sector/nft => nft/models/_sector}/transfers/chains/nft_gnosis_transfers.sql (100%) rename {models/_sector/nft => nft/models/_sector}/transfers/chains/nft_goerli_transfers.sql (100%) rename {models/_sector/nft => nft/models/_sector}/transfers/chains/nft_optimism_transfers.sql (100%) rename {models/_sector/nft => nft/models/_sector}/transfers/chains/nft_polygon_transfers.sql (100%) rename {models/_sector/nft => nft/models/_sector}/transfers/chains/nft_scroll_transfers.sql (100%) rename {models/_sector/nft => nft/models/_sector}/transfers/chains/nft_zksync_transfers.sql (100%) rename {models/_sector/nft => nft/models/_sector}/transfers/chains/nft_zora_transfers.sql (100%) rename {models/_sector/nft => nft/models/_sector}/transfers/nft_transfers.sql (100%) rename {models/_sector/nft => nft/models/_sector}/wash_trades/_schema.yml (97%) rename {models/_sector/nft => nft/models/_sector}/wash_trades/chains/nft_arbitrum_wash_trades.sql (100%) rename {models/_sector/nft => nft/models/_sector}/wash_trades/chains/nft_avalanche_c_wash_trades.sql (100%) rename {models/_sector/nft => nft/models/_sector}/wash_trades/chains/nft_base_wash_trades.sql (100%) rename {models/_sector/nft => nft/models/_sector}/wash_trades/chains/nft_bnb_wash_trades.sql (100%) rename {models/_sector/nft => nft/models/_sector}/wash_trades/chains/nft_celo_wash_trades.sql (100%) rename {models/_sector/nft => nft/models/_sector}/wash_trades/chains/nft_ethereum_wash_trades.sql (100%) rename {models/_sector/nft => nft/models/_sector}/wash_trades/chains/nft_gnosis_wash_trades.sql (100%) rename {models/_sector/nft => nft/models/_sector}/wash_trades/chains/nft_optimism_wash_trades.sql (100%) rename {models/_sector/nft => nft/models/_sector}/wash_trades/chains/nft_polygon_wash_trades.sql (100%) rename {models/_sector/nft => nft/models/_sector}/wash_trades/chains/nft_scroll_wash_trades.sql (100%) rename {models/_sector/nft => nft/models/_sector}/wash_trades/chains/nft_zksync_wash_trades.sql (100%) rename {models/_sector/nft => nft/models/_sector}/wash_trades/chains/nft_zora_wash_trades.sql (100%) rename {models/_sector/nft => nft/models/_sector}/wash_trades/nft_wash_trades.sql (100%) rename {models/nft => nft/models/nft_metrics}/ethereum/metadata/nft_ethereum_metadata_art_blocks_collections.sql (99%) rename {models/nft => nft/models/nft_metrics}/ethereum/metadata/nft_ethereum_metadata_art_platform_collections.sql (98%) rename {models/nft => nft/models/nft_metrics}/ethereum/metadata/nft_ethereum_metadata_braindrops.sql (97%) rename {models/nft => nft/models/nft_metrics}/ethereum/metadata/nft_ethereum_metadata_bright_moments.sql (98%) rename {models/nft => nft/models/nft_metrics}/ethereum/metadata/nft_ethereum_metadata_chromie_squiggle.sql (99%) rename {models/nft => nft/models/nft_metrics}/ethereum/metadata/nft_ethereum_metadata_cryptodickbutts.sql (99%) rename {models/nft => nft/models/nft_metrics}/ethereum/metadata/nft_ethereum_metadata_fellowship_gallery.sql (99%) rename {models/nft => nft/models/nft_metrics}/ethereum/metadata/nft_ethereum_metadata_mirage_gallery_curated.sql (97%) rename {models/nft => nft/models/nft_metrics}/ethereum/metadata/nft_ethereum_metadata_proof_grails_i.sql (99%) rename {models/nft => nft/models/nft_metrics}/ethereum/metadata/nft_ethereum_metadata_proof_grails_ii.sql (99%) rename {models/nft => nft/models/nft_metrics}/ethereum/metadata/nft_ethereum_metadata_ringers.sql (99%) rename {models/nft => nft/models/nft_metrics}/ethereum/metadata/nft_ethereum_metadata_schema.yml (100%) rename {models/nft => nft/models/nft_metrics}/ethereum/metadata/nft_ethereum_metadata_terraforms.sql (99%) rename {models/nft => nft/models/nft_metrics}/ethereum/metadata/nft_ethereum_metadata_verse.sql (91%) rename {models/nft => nft/models/nft_metrics}/ethereum/nft_ethereum_collection_stats.sql (100%) rename {models/nft => nft/models/nft_metrics}/ethereum/nft_ethereum_schema.yml (100%) rename {models/nft => nft/models/nft_metrics}/ethereum/nft_ethereum_top_minters.sql (97%) rename {models/nft => nft/models/nft_metrics}/ethereum/nft_ethereum_top_sales.sql (100%) rename {models/nft => nft/models/nft_metrics}/ethereum/nft_ethereum_wallet_metrics.sql (97%) rename {models/nft => nft/models/nft_metrics}/ethereum/nft_ethereum_wallet_pnl.sql (100%) rename {models/nft => nft/models/nft_metrics}/nft_linked_addresses.sql (100%) rename {models/nft => nft/models/nft_metrics}/nft_marketplaces_info.sql (100%) create mode 100644 nft/models/nft_metrics/nft_schema.yml rename {models => nft/models}/seaport/arbitrum/seaport_arbitrum_base_pairs.sql (98%) rename {models => nft/models}/seaport/arbitrum/seaport_arbitrum_schema.yml (100%) rename {models => nft/models}/seaport/arbitrum/seaport_arbitrum_tagging.sql (94%) rename {models => nft/models}/seaport/arbitrum/seaport_arbitrum_trades.sql (99%) rename {models => nft/models}/seaport/avalanche_c/seaport_avalanche_c_base_pairs.sql (98%) rename {models => nft/models}/seaport/avalanche_c/seaport_avalanche_c_schema.yml (100%) rename {models => nft/models}/seaport/avalanche_c/seaport_avalanche_c_tagging.sql (93%) rename {models => nft/models}/seaport/avalanche_c/seaport_avalanche_c_trades.sql (99%) rename {models => nft/models}/seaport/base/seaport_base_schema.yml (100%) rename {models => nft/models}/seaport/base/seaport_base_tagging.sql (92%) rename {models => nft/models}/seaport/bnb/seaport_bnb_base_pairs.sql (98%) rename {models => nft/models}/seaport/bnb/seaport_bnb_schema.yml (100%) rename {models => nft/models}/seaport/bnb/seaport_bnb_tagging.sql (94%) rename {models => nft/models}/seaport/bnb/seaport_bnb_trades.sql (99%) rename {models => nft/models}/seaport/chains/seaport_arbitrum_traces.sql (100%) rename {models => nft/models}/seaport/chains/seaport_avalanche_c_traces.sql (100%) rename {models => nft/models}/seaport/chains/seaport_base_traces.sql (100%) rename {models => nft/models}/seaport/chains/seaport_bnb_traces.sql (100%) rename {models => nft/models}/seaport/chains/seaport_ethereum_traces.sql (100%) rename {models => nft/models}/seaport/chains/seaport_optimism_traces.sql (100%) rename {models => nft/models}/seaport/chains/seaport_polygon_traces.sql (100%) rename {models => nft/models}/seaport/ethereum/seaport_ethereum_base_pairs.sql (99%) rename {models => nft/models}/seaport/ethereum/seaport_ethereum_schema.yml (100%) rename {models => nft/models}/seaport/ethereum/seaport_ethereum_tagging.sql (97%) rename {models => nft/models}/seaport/ethereum/seaport_ethereum_trades.sql (96%) rename {models => nft/models}/seaport/ethereum/seaport_v1_ethereum_trades.sql (100%) rename {models => nft/models}/seaport/ethereum/seaport_v2_ethereum_trades.sql (100%) rename {models => nft/models}/seaport/optimism/seaport_optimism_base_pairs.sql (99%) rename {models => nft/models}/seaport/optimism/seaport_optimism_schema.yml (100%) rename {models => nft/models}/seaport/optimism/seaport_optimism_tagging.sql (93%) rename {models => nft/models}/seaport/optimism/seaport_optimism_trades.sql (99%) rename {models => nft/models}/seaport/polygon/seaport_polygon_base_pairs.sql (98%) rename {models => nft/models}/seaport/polygon/seaport_polygon_schema.yml (100%) rename {models => nft/models}/seaport/polygon/seaport_polygon_tagging.sql (94%) rename {models => nft/models}/seaport/polygon/seaport_polygon_trades.sql (99%) rename {models => nft/models}/seaport/seaport_schema.yml (100%) rename {models => nft/models}/seaport/seaport_tagging.sql (96%) rename {models => nft/models}/seaport/seaport_traces.sql (97%) create mode 100644 nft/package-lock.yml create mode 100644 nft/packages.yml create mode 100644 nft/profiles.yml rename {seeds => nft/seeds}/astaria/_schema.yml (100%) rename {seeds => nft/seeds}/astaria/astaria_lending_seed.csv (100%) rename {seeds => nft/seeds}/bend_dao/ethereum/_schema.yml (100%) rename {seeds => nft/seeds}/bend_dao/ethereum/bend_dao_nft_lending.csv (100%) rename {seeds => nft/seeds}/opensea/ethereum/opensea_wyvern_trades_samples.csv (100%) rename {seeds => nft/seeds}/opensea/ethereum/schema.yml (100%) rename {seeds => nft/seeds}/opensea/opensea_seaport_trades_samples.csv (100%) rename {seeds => nft/seeds}/opensea/polygon/opensea_polygon_zeroex_trades_samples.csv (100%) rename {seeds => nft/seeds}/opensea/polygon/schema.yml (100%) rename {seeds => nft/seeds}/opensea/schema.yml (100%) rename {seeds => nft/seeds}/opensea/solana/opensea_solana_trades_solscan.csv (100%) rename {seeds => nft/seeds}/opensea/solana/schema.yml (100%) rename {seeds => nft/seeds}/seaport/_schema.yml (100%) rename {seeds => nft/seeds}/seaport/seaport_ethereum_transfers_postgres.csv (100%) rename {seeds => nft/seeds}/seaport/seaport_ethereum_view_transactions_postgres.csv (100%) rename {seeds => nft/seeds}/seaport/seaport_trades_seed.csv (100%) rename {seeds/_sector/nft => nft/seeds/trades/base_trades}/_schema.yml (96%) rename {seeds/_sector/nft => nft/seeds/trades/base_trades}/alienswap_base_base_trades_seed.csv (100%) rename {seeds/_sector/nft => nft/seeds/trades/base_trades}/archipelago_ethereum_base_trades_seed.csv (100%) rename {seeds/_sector/nft => nft/seeds/trades/base_trades}/aurem_polygon_base_trades_seed.csv (100%) rename {seeds/_sector/nft => nft/seeds/trades/base_trades}/blur_ethereum_base_trades_seed.csv (100%) rename {seeds/_sector/nft => nft/seeds/trades/base_trades}/blur_seaport_ethereum_base_trades_seed.csv (100%) rename {seeds/_sector/nft => nft/seeds/trades/base_trades}/blur_v2_ethereum_base_trades_seed.csv (100%) rename {seeds/_sector/nft => nft/seeds/trades/base_trades}/campfire_avalanche_c_base_trades_seed.csv (100%) rename {seeds/_sector/nft => nft/seeds/trades/base_trades}/chikn_avalanche_c_base_trades_seed.csv (100%) rename {seeds/_sector/nft => nft/seeds/trades/base_trades}/collectionswap_ethereum_base_trades_seed.csv (100%) rename {seeds/_sector/nft => nft/seeds/trades/base_trades}/cryptopunks_ethereum_base_trades_seed.csv (100%) rename {seeds/_sector/nft => nft/seeds/trades/base_trades}/dew_polygon_base_trades_seed.csv (100%) rename {seeds/_sector/nft => nft/seeds/trades/base_trades}/element_arbitrum_base_trades_seed.csv (100%) rename {seeds/_sector/nft => nft/seeds/trades/base_trades}/element_base_base_trades_seed.csv (100%) rename {seeds/_sector/nft => nft/seeds/trades/base_trades}/element_ethereum_base_trades_seed.csv (100%) rename {seeds/_sector/nft => nft/seeds/trades/base_trades}/element_optimism_base_trades_seed.csv (100%) rename {seeds/_sector/nft => nft/seeds/trades/base_trades}/foundation_ethereum_base_trades_seed.csv (100%) rename {seeds/_sector/nft => nft/seeds/trades/base_trades}/hyperspace_avalanche_c_base_trades_seed.csv (100%) rename {seeds/_sector/nft => nft/seeds/trades/base_trades}/joepegs_avalanche_c_base_trades_seed.csv (100%) rename {seeds/_sector/nft => nft/seeds/trades/base_trades}/looksrare_seaport_ethereum_base_trades_seed.csv (100%) rename {seeds/_sector/nft => nft/seeds/trades/base_trades}/looksrare_v1_ethereum_base_trades_seed.csv (100%) rename {seeds/_sector/nft => nft/seeds/trades/base_trades}/looksrare_v2_ethereum_base_trades_seed.csv (100%) rename {seeds/_sector/nft => nft/seeds/trades/base_trades}/mintsquare_zksync_base_trades_seed.csv (100%) rename {seeds/quix => nft/seeds/trades/base_trades}/quix_events_seed.csv (100%) rename {seeds/_sector/nft => nft/seeds/trades/base_trades}/sudoswap_ethereum_base_trades_seed.csv (100%) rename {seeds/_sector/nft => nft/seeds/trades/base_trades}/sudoswap_v2_arbitrum_base_trades_seed.csv (100%) rename {seeds/_sector/nft => nft/seeds/trades/base_trades}/sudoswap_v2_base_base_trades_seed.csv (100%) rename {seeds/_sector/nft => nft/seeds/trades/base_trades}/sudoswap_v2_ethereum_base_trades_seed.csv (100%) rename {seeds/_sector/nft => nft/seeds/trades/base_trades}/superrare_ethereum_base_trades_seed.csv (100%) rename {seeds/_sector/nft => nft/seeds/trades/base_trades}/tevaera_zksync_base_trades_seed.csv (100%) rename {seeds/_sector/nft => nft/seeds/trades/base_trades}/x2y2_ethereum_base_trades_seed.csv (100%) rename {seeds/_sector/nft => nft/seeds/trades/base_trades}/zk_markets_zksync_base_trades_seed.csv (100%) rename {seeds/_sector/nft => nft/seeds/trades/base_trades}/zonic_arbitrum_base_trades_seed.csv (100%) rename {seeds/_sector/nft => nft/seeds/trades/base_trades}/zonic_base_base_trades_seed.csv (100%) rename {seeds/_sector/nft => nft/seeds/trades/base_trades}/zonic_zksync_base_trades_seed.csv (100%) rename {seeds/_sector/nft => nft/seeds/trades/base_trades}/zonic_zora_base_trades_seed.csv (100%) rename {seeds/_sector/nft => nft/seeds/trades/base_trades}/zora_v1_ethereum_base_trades_seed.csv (100%) rename {seeds/_sector/nft => nft/seeds/trades/base_trades}/zora_v2_ethereum_base_trades_seed.csv (100%) rename {seeds/_sector/nft => nft/seeds/trades/base_trades}/zora_v3_ethereum_base_trades_seed.csv (100%) rename {seeds/_sector/nft/solana => nft/seeds/trades/solana_trades}/_schema.yml (95%) rename {seeds/_sector/nft/solana => nft/seeds/trades/solana_trades}/magiceden_mmm_solana_trades_seed.csv (100%) rename {seeds/magiceden/solana => nft/seeds/trades/solana_trades}/magiceden_solana_trades_solscan.csv (100%) rename {seeds/_sector/nft/solana => nft/seeds/trades/solana_trades}/magiceden_v2_solana_trades_seed.csv (100%) rename {seeds/_sector/nft/solana => nft/seeds/trades/solana_trades}/magiceden_v3_solana_trades_seed.csv (100%) rename {seeds/_sector/nft/solana => nft/seeds/trades/solana_trades}/tensorswap_v1_solana_trades_seed.csv (100%) rename {seeds/_sector/nft/solana => nft/seeds/trades/solana_trades}/tensorswap_v2_solana_trades_seed.csv (100%) rename {tests/_sector/nft => nft/tests}/check_nft_rowcount_blur.sql (100%) rename {tests/_sector/nft => nft/tests}/check_nft_rowcount_superrare.sql (100%) rename {tests/_sector/nft => nft/tests}/check_nft_rowcount_zora_v1.sql (100%) rename {tests => nft/tests}/generic/check_seaport_seed.sql (100%) rename {tests => nft/tests}/magiceden/solana/magiceden_solana_assert_samples.sql (100%) rename {tests/nft/ethereum => nft/tests}/nft_ethereum_aggregators_markers_no_collisions.sql (100%) rename {tests/nft/ethereum => nft/tests}/nft_ethereum_collection_stats_test.sql (100%) rename {tests/nft/ethereum => nft/tests}/nft_ethereum_native_mints_test.sql (100%) rename {tests => nft/tests}/opensea/solana/opensea_solana_assert_samples.sql (100%) create mode 100755 scripts/check_schema.sh delete mode 100644 seeds/collectionswap/_schema.yml delete mode 100644 seeds/collectionswap/collectionswap_ethereum_trades_samples.csv delete mode 100644 seeds/foundation/ethereum/foundation_trades_samples.csv delete mode 100644 seeds/fractal/polygon/fractal_polygon_sample_trades.csv delete mode 100644 seeds/fractal/polygon/schema.yml delete mode 100644 seeds/looksrare/ethereum/looksrare_ethereum_seed_schema.yml delete mode 100644 seeds/looksrare/ethereum/looksrare_ethereum_trades_postgres.csv delete mode 100644 seeds/looksrare/ethereum/looksrare_ethereum_v1_trades.csv delete mode 100644 seeds/looksrare/ethereum/looksrare_ethereum_v2_trades.csv delete mode 100644 seeds/magiceden/polygon/_schema.yml delete mode 100644 seeds/magiceden/polygon/magiceden_polygon_sample_trades.csv delete mode 100644 seeds/magiceden/solana/schema.yml delete mode 100644 seeds/nftb/bnb/nftb_nft_trades_samples.csv delete mode 100644 seeds/nftb/bnb/schema.yml delete mode 100644 seeds/nftrade/bnb/nftrade_nft_trades_samples.csv delete mode 100644 seeds/nftrade/bnb/schema.yml delete mode 100644 seeds/pancakeswap/bnb/pancakeswap_nft_trades_samples.csv delete mode 100644 seeds/pancakeswap/bnb/schema.yml delete mode 100644 seeds/quix/schema.yml delete mode 100644 seeds/trove/arbitrum/schema.yml delete mode 100644 seeds/trove/arbitrum/trove_v1_arbitrum_nft_samples.csv delete mode 100644 seeds/trove/arbitrum/trove_v2_arbitrum_nft_samples.csv delete mode 100644 seeds/trove/ethereum/schema.yml delete mode 100644 seeds/trove/ethereum/trove_ethereum_nft_trades_samples.csv delete mode 100644 seeds/zonic/schema.yml delete mode 100644 seeds/zonic/zonic_events_seed.csv create mode 100644 sources/_subprojects/nft/_sources.yml delete mode 100644 tests/generic/check_seed.sql delete mode 100644 tests/generic/compare_column_values_to_seed_values.sql delete mode 100644 tests/generic/equal_rowcount_with_sources.sql delete mode 100644 tests/generic/is_unique_filtered.sql diff --git a/.github/workflows/commit_manifest.yml b/.github/workflows/commit_manifest.yml index 1a8e63777d6..0942ff31823 100644 --- a/.github/workflows/commit_manifest.yml +++ b/.github/workflows/commit_manifest.yml @@ -15,7 +15,7 @@ jobs: runs-on: [ self-hosted, linux, spellbook-trino-ci ] strategy: matrix: - project: [ 'tokens', 'spellbook', 'daily_spellbook'] + project: [ 'tokens', 'spellbook', 'daily_spellbook', 'nft'] max-parallel: 1 steps: diff --git a/.github/workflows/dbt_run.yml b/.github/workflows/dbt_run.yml index 7183380f7a3..73edac44f15 100644 --- a/.github/workflows/dbt_run.yml +++ b/.github/workflows/dbt_run.yml @@ -45,9 +45,7 @@ jobs: run: "dbt --warn-error compile --project-dir ${PROJECT_DIR}" - name: check schemas - run: | - test=$(dbt --quiet --no-print ls $PROFILE --resource-type model --select state:modified,config.schema:no_schema --output path --state . --project-dir ${PROJECT_DIR}) - [[ -z "$test" ]] && { echo "Success: All models have a custom schema"; exit 0; } || { echo "Found models without custom schema:"; echo "$test"; exit 1; } + run: "./scripts/check_schema.sh" - name: dbt seed run: "dbt seed $PROFILE --select @state:modified --exclude tag:prod_exclude tag:remove --state . --project-dir ${PROJECT_DIR}" diff --git a/.github/workflows/nft.yml b/.github/workflows/nft.yml new file mode 100644 index 00000000000..a699b26bdbe --- /dev/null +++ b/.github/workflows/nft.yml @@ -0,0 +1,20 @@ +name: DBT NFT run + +on: + workflow_dispatch: + pull_request: + paths: + - nft/** + - .github/workflows/nft.yml + - .github/workflows/dbt_run.yml + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + +jobs: + dbt-run: + uses: ./.github/workflows/dbt_run.yml + with: + project: 'nft' + diff --git a/daily_spellbook/tests/generic/check_seed.sql b/daily_spellbook/tests/generic/check_seed.sql deleted file mode 100644 index b1af4ffb53e..00000000000 --- a/daily_spellbook/tests/generic/check_seed.sql +++ /dev/null @@ -1,20 +0,0 @@ --- this tests checks a model for every row in a seed file. --- you need to specify the matching columns and the columns to check for equality. --- filter: dictionary filter of column:value that is applied to the seed file --- actual implementation in macros/test-helpers/check_seed.sql -{% test check_seed(model, seed_file, match_columns=[], check_columns=[], filter=None) %} - {# - --jinja comment - -- potential dynamic approach, but requires db access -- ci setup to allow in future? - -- {%- set unique_columns = config.get('unique_key') -%} - -- {%- set seed_check_columns = dbt_utils.get_filtered_columns_in_relation(from=seed_file, except=unique_columns) -%} - -- {%- set seed_matching_columns = dbt_utils.get_filtered_columns_in_relation(from=seed_file, except=seed_check_columns) -%} - --jinja comment - #} - {{ config(severity = 'error') }} - {%- set seed_check_columns = check_columns -%} - {%- set seed_matching_columns = match_columns -%} - {%- set seed = seed_file -%} - {{ check_seed_macro(model,seed,seed_matching_columns,seed_check_columns,filter) }} - -{% endtest %} diff --git a/daily_spellbook/tests/generic/compare_column_values_to_seed_values.sql b/daily_spellbook/tests/generic/compare_column_values_to_seed_values.sql deleted file mode 100644 index 1073925bf62..00000000000 --- a/daily_spellbook/tests/generic/compare_column_values_to_seed_values.sql +++ /dev/null @@ -1,22 +0,0 @@ -{% test compare_column_values_to_seed_values(model, column_name, seed_file_location) %} - - with unit_test as - ( - select - seed.test_description, - case - when m.{{ column_name }} = seed.{{ column_name }} - then True - else False - end as generic_column_test - from {{ model }} m - join {{ seed_file_location }} seed - on m.tx_hash = seed.tx_hash - and m.block_number = seed.block_number - ) - - select test_description - from unit_test - where generic_column_test = False - -{% endtest %} diff --git a/daily_spellbook/tests/generic/is_unique_filtered.sql b/daily_spellbook/tests/generic/is_unique_filtered.sql deleted file mode 100644 index da19556226c..00000000000 --- a/daily_spellbook/tests/generic/is_unique_filtered.sql +++ /dev/null @@ -1,13 +0,0 @@ -{% test is_unique_filtered(model, column_name) %} - -select - {{ column_name }} as unique_field, - count(*) as n_records - -from {{ model }} -where {{ column_name }} is not null - and block_date >= NOW() - interval '2' day -group by {{ column_name }} -having count(*) > 1 - -{% endtest %} diff --git a/dbt_project.yml b/dbt_project.yml index e959f491c02..73cb2738b7e 100644 --- a/dbt_project.yml +++ b/dbt_project.yml @@ -67,16 +67,6 @@ models: dex: +schema: dex - nft: - +schema: nft - ethereum: - +schema: nft_ethereum - metadata: - +schema: nft_ethereum_metadata - +materialized: table - +file_format: delta - +tags: "static" - cex: +schema: cex arbitrum: @@ -113,23 +103,6 @@ models: celo: +schema: uniswap_celo - seaport: - +schema: seaport - ethereum: - +schema: seaport_ethereum - bnb: - +schema: seaport_bnb - arbitrum: - +schema: seaport_arbitrum - optimism: - +schema: seaport_optimism - avalanche_c: - +schema: seaport_avalanche_c - polygon: - +schema: seaport_polygon - base: - +schema: seaport_base - balances: +schema: balances ethereum: @@ -234,11 +207,6 @@ models: optimism: +schema: lifi_optimism - astaria: - +schema: astaria - ethereum: - +schema: astaria_ethereum - aragon: +schema: aragon ethereum: diff --git a/docs/seeds/seed_overview.md b/docs/seeds/seed_overview.md index 3d55a12d142..c649b173b64 100644 --- a/docs/seeds/seed_overview.md +++ b/docs/seeds/seed_overview.md @@ -14,7 +14,7 @@ Seeds will be required in these sector-level spell additions to ensure proper le 3. Within the [model schema file](/models/_sector/dex/trades/arbitrum/_schema.yml#L20-L23), call the [generic seed test](/tests/generic/check_dex_base_trades_seed.sql) with parameters necessary: - Seed file name. - Filter(s) for project versions, if the spell is split into versions per project. -4. Ultimately, following the above steps, the test query built and executed against seed files lives in the generic seed macro [here](/macros/test-helpers/check_seed_macro.sql). +4. Ultimately, following the above steps, the test query built and executed against seed files lives in the generic seed macro [here](/macros/generic-tests/check_seed_macro.sql). ## How Do I Track Seed Tests Running During Development? diff --git a/tests/generic/check_column_types.sql b/macros/generic-tests/check_column_types_macro.sql similarity index 79% rename from tests/generic/check_column_types.sql rename to macros/generic-tests/check_column_types_macro.sql index 348a26d608a..44c14c55813 100644 --- a/tests/generic/check_column_types.sql +++ b/macros/generic-tests/check_column_types_macro.sql @@ -1,3 +1,17 @@ +{% macro check_column_types_macro(model, column_types) %} +with test_sample as ( +select * from {{model}} limit 1 +) +, equality_checks as ( + {%- for col, col_type in column_types.items() %} + select '{{col}}' column_name, '{{col_type}}' as expected_type, typeof({{col}}) as actual_type + from test_sample + {% if not loop.last %}union all{% endif %} + {% endfor -%} +) +select * from equality_checks where not contains(split(expected_type,'/'),actual_type) +{% endmacro %} + -- this tests checks the column types of a model {% test check_column_types(model, column_types) %} {{ check_column_types_macro(model,column_types) }} diff --git a/macros/test-helpers/check_seed_macro.sql b/macros/generic-tests/check_seed_macro.sql similarity index 91% rename from macros/test-helpers/check_seed_macro.sql rename to macros/generic-tests/check_seed_macro.sql index 28fb50b19ca..de3ee38768c 100644 --- a/macros/test-helpers/check_seed_macro.sql +++ b/macros/generic-tests/check_seed_macro.sql @@ -1,6 +1,7 @@ -- this macro is used in generic tests that check a model for every row in a seed file. -- you need to specify the matching columns and the columns to check for equality. -- filter: dictionary filter of column:value that is applied to the seed file +-- below the macro you'll find the actual generic tests {% macro check_seed_macro(model, seed_file, seed_matching_columns=[], seed_check_columns=[], filter=None) %} @@ -102,3 +103,14 @@ -- equality check can be null so we have to check explicitly for nulls where equality_check is distinct from true {% endmacro %} + + +{% test check_seed(model, seed_file, match_columns=[], check_columns=[], filter=None) %} + + {{ config(severity = 'error') }} + {%- set seed_check_columns = check_columns -%} + {%- set seed_matching_columns = match_columns -%} + {%- set seed = seed_file -%} + {{ check_seed_macro(model,seed,seed_matching_columns,seed_check_columns,filter) }} + +{% endtest %} diff --git a/daily_spellbook/tests/generic/equal_rowcount_with_sources.sql b/macros/generic-tests/equal_rowcount_with_sources.sql similarity index 100% rename from daily_spellbook/tests/generic/equal_rowcount_with_sources.sql rename to macros/generic-tests/equal_rowcount_with_sources.sql diff --git a/macros/test-helpers/check_column_types_macro.sql b/macros/test-helpers/check_column_types_macro.sql deleted file mode 100644 index 4438c30af76..00000000000 --- a/macros/test-helpers/check_column_types_macro.sql +++ /dev/null @@ -1,13 +0,0 @@ -{% macro check_column_types_macro(model, column_types) %} -with test_sample as ( -select * from {{model}} limit 1 -) -, equality_checks as ( - {%- for col, col_type in column_types.items() %} - select '{{col}}' column_name, '{{col_type}}' as expected_type, typeof({{col}}) as actual_type - from test_sample - {% if not loop.last %}union all{% endif %} - {% endfor -%} -) -select * from equality_checks where not contains(split(expected_type,'/'),actual_type) -{% endmacro %} diff --git a/macros/test-helpers/test_helpers_schema.yml b/macros/test-helpers/test_helpers_schema.yml deleted file mode 100644 index 8cac069a30a..00000000000 --- a/macros/test-helpers/test_helpers_schema.yml +++ /dev/null @@ -1,5 +0,0 @@ -version: 2 - -macros: - - name: check_seed_macro - description: "Macro to be used in generic seed check tests. It checks if every row in a seed file is present in the model" diff --git a/models/_trino_upgrade/trino_upgrade_alienswap_base_base_trades.sql b/models/_trino_upgrade/trino_upgrade_alienswap_base_base_trades.sql index d5eaaecb079..f0d1feda5f9 100644 --- a/models/_trino_upgrade/trino_upgrade_alienswap_base_base_trades.sql +++ b/models/_trino_upgrade/trino_upgrade_alienswap_base_base_trades.sql @@ -45,6 +45,3 @@ FROM {{ source('alienswap_base','Alienswap_evt_OrderFulfilled') }} s WHERE s.evt_block_time >= timestamp '{{alienswap_usage_start_date}}' {% endif %} ) - --- this will be removed once tx_from and tx_to are available in the base event tables -{{ add_nft_tx_data('base_trades', 'base') }} diff --git a/models/_trino_upgrade/trino_upgrade_tevaera_zksync_base_trades.sql b/models/_trino_upgrade/trino_upgrade_tevaera_zksync_base_trades.sql index f50285558db..f5aced44d23 100644 --- a/models/_trino_upgrade/trino_upgrade_tevaera_zksync_base_trades.sql +++ b/models/_trino_upgrade/trino_upgrade_tevaera_zksync_base_trades.sql @@ -45,6 +45,3 @@ with base_trades as ( where s.evt_block_time >= timestamp '{{tevaera_usage_start_date}}' {% endif %} ) - --- this will be removed once tx_from and tx_to are available in the base event tables -{{ add_nft_tx_data('base_trades', 'zksync') }} diff --git a/models/bend_dao/ethereum/bend_dao_ethereum_schema.yml b/models/bend_dao/ethereum/bend_dao_ethereum_schema.yml index 37bf1b10e7f..70c03448d22 100644 --- a/models/bend_dao/ethereum/bend_dao_ethereum_schema.yml +++ b/models/bend_dao/ethereum/bend_dao_ethereum_schema.yml @@ -1,115 +1,6 @@ version: 2 models: - - name: bend_dao_ethereum_lending - meta: - blockchain: ethereum - project: bend_dao - contributors: [Henrystats] - config: - tags: ['ethereum','bend_dao','v1','lending'] - description: > - bend_dao lending (repay & borrow) on ethereum - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - block_date - - blockchain - - project - - version - - evt_type - - tx_hash - - evt_index - - check_seed: - seed_file: ref('bend_dao_nft_lending') - match_columns: - - block_number - - tx_hash - - token_id - check_columns: -# - amount_original - - evt_type - - borrower - columns: - - &blockchain - name: blockchain - description: "Blockchain" - - &project - name: project - description: "Project" - - &version - name: version - description: "Project version" - - &lending_category - name: lending_category - description: "Type of loans offered by the project, usually either pool to borrower or peer to peer" - - &block_time - name: block_time - description: "UTC event block time" - - &block_date - name: block_date - description: "UTC event block date" - - &block_month - name: block_month - description: "UTC event block month" - - &token_id - name: token_id - description: "NFT Token ID" - - &collection - name: collection - description: "NFT collection name" - - &amount_usd - name: amount_usd - description: "USD value of the trade at time of execution" - - &token_standard - name: token_standard - description: "Token standard" - - &evt_type - name: evt_type - description: "Event type (Borrow, Repay)" - - &borrower - name: borrower - description: "Address that took the loan" - - &lender - name: lender - description: "Address that faciliated the loan" - - &amount_original - name: amount_original - description: "Traded amount in original currency" - - &amount_raw - name: amount_raw - description: "Traded amount in original currency before decimals correction" - - &collateral_currency_symbol - name: collateral_currency_symbol - description: "Symbol of collateral currency used for loan" - - &collateral_currency_contract - name: collateral_currency_contract - description: "Contract address of collateral currency used for loan" - - &nft_contract_address - name: nft_contract_address - description: "NFT contract address" - - &project_contract_address - name: project_contract_address - description: "Contract address used by the project, in this case bend_dao contract" - - &tx_hash - name: tx_hash - description: "Transaction hash" - - &block_number - name: block_number - description: "Block number in which the transaction was executed " - - &tx_from - name: tx_from - description: "Address that initiated the transaction" - - &tx_to - name: tx_to - description: "Address that received the transaction" - - &evt_index - name: evt_index - description: "Index of the corresponding lending event" - - &lien_id - name: lien_id - description: "Unique loan id " - - name: bend_dao_ethereum_airdrop_claims meta: blockchain: ethereum @@ -126,10 +17,6 @@ models: - recipient - evt_index columns: - - *blockchain - - *block_time - - *block_number - - *project - &airdrop_number name: airdrop_number description: "Airdrop identifier number" @@ -139,7 +26,6 @@ models: - &contract_address name: contract_address description: "Contract addressed used" - - *tx_hash - name: amount_raw description: "Raw amount of tokens" - name: amount_original @@ -152,4 +38,3 @@ models: - &token_symbol name: token_symbol description: "Token symbol" - - *evt_index diff --git a/models/cryptopunks/ethereum/cryptopunks_ethereum_current_bids.sql b/models/cryptopunks/ethereum/cryptopunks_ethereum_current_bids.sql index e6535b5b8fe..b19f2361de5 100644 --- a/models/cryptopunks/ethereum/cryptopunks_ethereum_current_bids.sql +++ b/models/cryptopunks/ethereum/cryptopunks_ethereum_current_bids.sql @@ -1,5 +1,5 @@ {{ config( - + alias = 'current_bids', unique_key='punk_id', post_hook='{{ expose_spells(\'["ethereum"]\', @@ -51,7 +51,7 @@ with combined_events_table as ( , block_number , sub_tx_trade_id as evt_index , tx_hash - from {{ ref('cryptopunks_ethereum_base_trades') }} + from {{ source('nft', 'base_trades') }} WHERE project = 'cryptopunks' ) a ) diff --git a/models/cryptopunks/ethereum/cryptopunks_ethereum_current_listings.sql b/models/cryptopunks/ethereum/cryptopunks_ethereum_current_listings.sql index d3f33e775f3..cab18bf0558 100644 --- a/models/cryptopunks/ethereum/cryptopunks_ethereum_current_listings.sql +++ b/models/cryptopunks/ethereum/cryptopunks_ethereum_current_listings.sql @@ -1,5 +1,5 @@ {{ config( - + alias = 'current_listings', unique_key='punk_id', post_hook='{{ expose_spells(\'["ethereum"]\', @@ -33,7 +33,7 @@ with all_listing_events as ( , sub_tx_trade_id as evt_index , block_time as evt_block_time , tx_hash as evt_tx_hash - from {{ ref('cryptopunks_ethereum_base_trades') }} + from {{ source('nft', 'base_trades') }} where project = 'cryptopunks' ) , all_transfers as ( diff --git a/models/cryptopunks/ethereum/cryptopunks_ethereum_floor_price_over_time.sql b/models/cryptopunks/ethereum/cryptopunks_ethereum_floor_price_over_time.sql index 9e95cf3e3bb..d623474e4b6 100644 --- a/models/cryptopunks/ethereum/cryptopunks_ethereum_floor_price_over_time.sql +++ b/models/cryptopunks/ethereum/cryptopunks_ethereum_floor_price_over_time.sql @@ -1,5 +1,5 @@ {{ config( - + alias = 'floor_price_over_time', unique_key='day', post_hook='{{ expose_spells(\'["ethereum"]\', @@ -33,7 +33,7 @@ with all_listing_events as ( , sub_tx_trade_id as evt_index , block_time as evt_block_time , tx_hash as evt_tx_hash - from {{ ref('cryptopunks_ethereum_base_trades') }} + from {{ source('nft', 'base_trades') }} where project = 'cryptopunks' ) , all_transfers as ( diff --git a/models/cryptopunks/ethereum/cryptopunks_ethereum_listings_over_time.sql b/models/cryptopunks/ethereum/cryptopunks_ethereum_listings_over_time.sql index 09a0fb5e2ac..70fc9e7d03b 100644 --- a/models/cryptopunks/ethereum/cryptopunks_ethereum_listings_over_time.sql +++ b/models/cryptopunks/ethereum/cryptopunks_ethereum_listings_over_time.sql @@ -1,5 +1,5 @@ {{ config( - + alias = 'listings_over_time', unique_key='day', post_hook='{{ expose_spells(\'["ethereum"]\', @@ -33,7 +33,7 @@ with all_listing_events as ( , sub_tx_trade_id as evt_index , block_time as evt_block_time , tx_hash as evt_tx_hash - from {{ ref('cryptopunks_ethereum_base_trades') }} + from {{ source('nft', 'base_trades') }} where project = 'cryptopunks' ) , all_transfers as ( diff --git a/models/labels/addresses/__single_category_labels__/likely_bots/op_chains/labels_op_chains_likely_bot_addresses.sql b/models/labels/addresses/__single_category_labels__/likely_bots/op_chains/labels_op_chains_likely_bot_addresses.sql index 10218f55b3d..4ed7f9a141c 100644 --- a/models/labels/addresses/__single_category_labels__/likely_bots/op_chains/labels_op_chains_likely_bot_addresses.sql +++ b/models/labels/addresses/__single_category_labels__/likely_bots/op_chains/labels_op_chains_likely_bot_addresses.sql @@ -3,9 +3,9 @@ alias = 'op_chains_likely_bot_addresses', materialized ='table', partition_by = ['blockchain'], - post_hook='{{ expose_spells(\'["optimism","base","zora"]\', - "sector", - "labels", + post_hook='{{ expose_spells(\'["optimism","base","zora"]\', + "sector", + "labels", \'["msilb7"]\') }}' ) }} @@ -25,18 +25,18 @@ WITH sender_transfer_rates AS ( , MAX(block_time) AS max_block_time , COUNT(*) AS hr_txs , SUM(CASE WHEN to IN (SELECT address FROM {{ ref('labels_op_chains_likely_bot_contracts') }} WHERE name != 'chain ops bot' AND blockchain = '{{chain}}') THEN 1 ELSE 0 END) AS bot_concentration_txs - + , SUM(CASE WHEN EXISTS (SELECT 1 FROM {{ source('erc20_' + chain,'evt_transfer') }} r WHERE t.hash = r.evt_tx_hash AND t.block_number = r.evt_block_number) THEN 1 ELSE 0 END) AS num_erc20_tfer_txs - , SUM(CASE WHEN EXISTS (SELECT 1 FROM {{ ref('nft_' + chain + '_transfers') }} r WHERE t.hash = r.tx_hash AND t.block_number = r.block_number) THEN 1 ELSE 0 END) AS num_nft_tfer_txs + , SUM(CASE WHEN EXISTS (SELECT 1 FROM {{ source('nft_' + chain,'transfers') }} r WHERE t.hash = r.tx_hash AND t.block_number = r.block_number) THEN 1 ELSE 0 END) AS num_nft_tfer_txs - , SUM(CASE WHEN EXISTS (SELECT 1 FROM {{ source('erc20_' + chain,'evt_transfer') }} r WHERE t.hash = r.evt_tx_hash AND t.block_number = r.evt_block_number) THEN 1 - WHEN EXISTS (SELECT 1 FROM {{ ref('nft_' + chain + '_transfers') }} r WHERE t.hash = r.tx_hash AND t.block_number = r.block_number AND blockchain = '{{chain}}') THEN 1 + , SUM(CASE WHEN EXISTS (SELECT 1 FROM {{ source('erc20_' + chain,'evt_transfer') }} r WHERE t.hash = r.evt_tx_hash AND t.block_number = r.evt_block_number) THEN 1 + WHEN EXISTS (SELECT 1 FROM {{ source('nft_' + chain,'transfers') }} r WHERE t.hash = r.tx_hash AND t.block_number = r.block_number AND blockchain = '{{chain}}') THEN 1 ELSE 0 END) AS num_token_tfer_txs - + , SUM(CASE WHEN EXISTS (SELECT 1 FROM {{ ref('dex_trades') }} r WHERE t.hash = r.tx_hash AND t.block_time = r.block_time AND r.block_month = DATE_TRUNC('month',r.block_time) AND blockchain = '{{chain}}') THEN 1 ELSE 0 END) AS num_dex_trade_txs , SUM(CASE WHEN EXISTS (SELECT 1 FROM {{ ref('perpetual_trades') }} r WHERE t.hash = r.tx_hash AND t.block_time = r.block_time AND r.block_month = DATE_TRUNC('month',r.block_time) AND blockchain = '{{chain}}') THEN 1 ELSE 0 END) AS num_perp_trade_txs - , SUM(CASE WHEN EXISTS (SELECT 1 FROM {{ ref('nft_trades') }} r WHERE t.hash = r.tx_hash AND t.block_number = r.block_number AND r.block_month = DATE_TRUNC('month',r.block_time) AND blockchain = '{{chain}}') THEN 1 ELSE 0 END) AS num_nft_trade_txs - + , SUM(CASE WHEN EXISTS (SELECT 1 FROM {{ source('nft', 'trades') }} r WHERE t.hash = r.tx_hash AND t.block_number = r.block_number AND r.block_month = DATE_TRUNC('month',r.block_time) AND blockchain = '{{chain}}') THEN 1 ELSE 0 END) AS num_nft_trade_txs + FROM {{ source( chain ,'transactions') }} t GROUP BY 1,2,3 @@ -51,13 +51,13 @@ WITH sender_transfer_rates AS ( , first_pass_throughput_filter AS ( -- Filter down this list a bit to help with later mappings - SELECT + SELECT blockchain ,sender, DATE_TRUNC('week',hr) AS wk, SUM(hr_txs) AS wk_txs, MAX(hr_txs) AS max_hr_txs, SUM(bot_concentration_txs) AS bot_concentration_txs, cast(COUNT(*) as double) /cast(7.0*24.0 as double) AS pct_weekly_hours_active, MIN(min_block_time) AS min_block_time, MAX(max_block_time) AS max_block_time, - + SUM(num_erc20_tfer_txs) AS num_erc20_tfer_txs, SUM(num_nft_tfer_txs) AS num_nft_tfer_txs, SUM(num_token_tfer_txs) AS num_token_tfer_txs, @@ -81,7 +81,7 @@ SELECT *, cast(num_dex_trade_txs as double) / cast( num_txs as double) AS pct_dex_trade_txs, cast(num_perp_trade_txs as double) / cast( num_txs as double) AS pct_perp_trade_txs, -- perpetual.trades has some dunesql incompatability cast(num_nft_trade_txs as double) / cast( num_txs as double) AS pct_nft_trade_txs - + FROM ( SELECT blockchain @@ -92,7 +92,7 @@ FROM ( ,AVG(pct_weekly_hours_active) AS avg_pct_weekly_hours_active ,SUM(wk_txs) AS num_txs ,SUM(bot_concentration_txs) AS bot_concentration_txs - + ,cast(SUM(bot_concentration_txs) as double) / cast(SUM(wk_txs) as double) AS pct_bot_concentration_txs ,( cast( date_DIFF('second', MIN(min_block_time), MAX(max_block_time)) as double) / (60.0*60.0) ) AS txs_per_hour @@ -102,17 +102,17 @@ FROM ( ,SUM(num_dex_trade_txs) AS num_dex_trade_txs ,SUM(num_perp_trade_txs) AS num_perp_trade_txs ,SUM(num_nft_trade_txs) AS num_nft_trade_txs - + FROM first_pass_throughput_filter f GROUP BY 1,2 -- various cases to detect bots HAVING (MAX(wk_txs) >= 2000 AND MAX(max_hr_txs) >= 100) --frequency (gt 2k txs in one week and gt 100 txs in one hour) OR (MAX(wk_txs) >= 4000 AND MAX(max_hr_txs) >= 50) --frequency (gt 4k txs in one week and gt 50 txs in one hour) OR AVG(wk_txs) >= 1000 --frequency (avg 1k txs per week) - OR + OR ( - cast(COUNT(*) as double) / - ( cast( date_DIFF('second', MIN(min_block_time), MAX(max_block_time)) as double) / (60.0*60.0) ) >= 25 + cast(COUNT(*) as double) / + ( cast( date_DIFF('second', MIN(min_block_time), MAX(max_block_time)) as double) / (60.0*60.0) ) >= 25 AND SUM(wk_txs) >= 100 ) --frequency gt 25 txs per hour OR AVG(pct_weekly_hours_active) > 0.5 -- aliveness: transacting at least 50% of hours per week @@ -151,15 +151,15 @@ select sender AS address, 'likely bot types' AS category, CASE - WHEN pct_dex_trade_txs >= 0.5 THEN 'dex trade bot address' - WHEN pct_nft_trade_txs >= 0.5 THEN 'nft trade bot address' - WHEN pct_perp_trade_txs >= 0.5 THEN 'perp trade bot address' - WHEN pct_erc20_tfer_txs >= 0.5 THEN 'erc20 transfer bot address' - WHEN pct_nft_tfer_txs >= 0.5 THEN 'nft transfer bot address' - WHEN pct_token_tfer_txs >= 0.5 THEN 'other token transfer bot address' + WHEN pct_dex_trade_txs >= 0.5 THEN 'dex trade bot address' + WHEN pct_nft_trade_txs >= 0.5 THEN 'nft trade bot address' + WHEN pct_perp_trade_txs >= 0.5 THEN 'perp trade bot address' + WHEN pct_erc20_tfer_txs >= 0.5 THEN 'erc20 transfer bot address' + WHEN pct_nft_tfer_txs >= 0.5 THEN 'nft transfer bot address' + WHEN pct_token_tfer_txs >= 0.5 THEN 'other token transfer bot address' ELSE 'non-token bot address' END AS name from bot_addresses - ) a \ No newline at end of file + ) a diff --git a/models/labels/addresses/__single_category_labels__/likely_bots/op_chains/labels_op_chains_likely_bot_contracts.sql b/models/labels/addresses/__single_category_labels__/likely_bots/op_chains/labels_op_chains_likely_bot_contracts.sql index 18e526044ea..abc965152ee 100644 --- a/models/labels/addresses/__single_category_labels__/likely_bots/op_chains/labels_op_chains_likely_bot_contracts.sql +++ b/models/labels/addresses/__single_category_labels__/likely_bots/op_chains/labels_op_chains_likely_bot_contracts.sql @@ -3,9 +3,9 @@ alias = 'op_chains_likely_bot_contracts', materialized ='table', partition_by = ['blockchain'], - post_hook='{{ expose_spells(\'["optimism","base","zora"]\', - "sector", - "labels", + post_hook='{{ expose_spells(\'["optimism","base","zora"]\', + "sector", + "labels", \'["msilb7"]\') }}' ) }} @@ -25,54 +25,54 @@ SELECT *, FROM ( {% for chain in op_chains %} - SELECT + SELECT '{{chain}}' as blockchain, - to AS contract, + to AS contract, SUM(CASE WHEN EXISTS (SELECT 1 FROM {{ source('erc20_' + chain,'evt_transfer') }} r WHERE t.hash = r.evt_tx_hash AND t.block_number = r.evt_block_number) THEN 1 ELSE 0 END) AS num_erc20_tfer_txs, - SUM(CASE WHEN EXISTS (SELECT 1 FROM {{ ref('nft_' + chain + '_transfers') }} r WHERE t.hash = r.tx_hash AND t.block_number = r.block_number) THEN 1 ELSE 0 END) AS num_nft_tfer_txs, - - SUM(CASE WHEN EXISTS (SELECT 1 FROM {{ source('erc20_' + chain,'evt_transfer') }} r WHERE t.hash = r.evt_tx_hash AND t.block_number = r.evt_block_number) THEN 1 - WHEN EXISTS (SELECT 1 FROM {{ ref('nft_' + chain + '_transfers') }} r WHERE t.hash = r.tx_hash AND t.block_number = r.block_number ) THEN 1 + SUM(CASE WHEN EXISTS (SELECT 1 FROM {{ source('nft_' + chain,'transfers') }} r WHERE t.hash = r.tx_hash AND t.block_number = r.block_number) THEN 1 ELSE 0 END) AS num_nft_tfer_txs, + + SUM(CASE WHEN EXISTS (SELECT 1 FROM {{ source('erc20_' + chain,'evt_transfer') }} r WHERE t.hash = r.evt_tx_hash AND t.block_number = r.evt_block_number) THEN 1 + WHEN EXISTS (SELECT 1 FROM {{ source('nft_' + chain,'transfers') }} r WHERE t.hash = r.tx_hash AND t.block_number = r.block_number ) THEN 1 ELSE 0 END) AS num_token_tfer_txs, - + SUM(CASE WHEN EXISTS (SELECT 1 FROM {{ ref('dex_trades') }} r WHERE t.hash = r.tx_hash AND t.block_time = r.block_time AND r.block_month = DATE_TRUNC('month',r.block_time) AND blockchain = '{{chain}}') THEN 1 ELSE 0 END) AS num_dex_trade_txs, SUM(CASE WHEN EXISTS (SELECT 1 FROM {{ ref('perpetual_trades') }} r WHERE t.hash = r.tx_hash AND t.block_time = r.block_time AND r.block_month = DATE_TRUNC('month',r.block_time) AND blockchain = '{{chain}}') THEN 1 ELSE 0 END) AS num_perp_trade_txs, - SUM(CASE WHEN EXISTS (SELECT 1 FROM {{ ref('nft_trades') }} r WHERE t.hash = r.tx_hash AND t.block_number = r.block_number AND r.block_month = DATE_TRUNC('month',r.block_time) AND blockchain = '{{chain}}') THEN 1 ELSE 0 END) AS num_nft_trade_txs, + SUM(CASE WHEN EXISTS (SELECT 1 FROM {{ source('nft', 'trades') }} r WHERE t.hash = r.tx_hash AND t.block_number = r.block_number AND r.block_month = DATE_TRUNC('month',r.block_time) AND blockchain = '{{chain}}') THEN 1 ELSE 0 END) AS num_nft_trade_txs, COUNT(*) AS num_txs, COUNT(DISTINCT "from") AS num_senders, COUNT(*)/COUNT(DISTINCT "from") AS txs_per_sender, - - cast(cast(COUNT(*) as double)/cast(COUNT(DISTINCT "from") as double) as double) / - ( cast( date_DIFF('second', MIN(block_time), MAX(block_time)) as double) / (60.0*60.0) ) + + cast(cast(COUNT(*) as double)/cast(COUNT(DISTINCT "from") as double) as double) / + ( cast( date_DIFF('second', MIN(block_time), MAX(block_time)) as double) / (60.0*60.0) ) AS txs_per_addr_per_hour, - - cast(COUNT(*) as double) / - ( cast( date_DIFF('second', MIN(block_time), MAX(block_time)) as double) / (60.0*60.0) ) + + cast(COUNT(*) as double) / + ( cast( date_DIFF('second', MIN(block_time), MAX(block_time)) as double) / (60.0*60.0) ) AS txs_per_hour -- SUM( CASE WHEN substring(data from 1 for 10) = mode(substring(data from 1 for 10) THEN 1 ELSE 0 END) ) AS method_dupe FROM {{ source(chain ,'transactions') }} t GROUP BY 1,2 - + -- search for various potential bot indicators HAVING COUNT(*) >= 100 --prefilter, req 100 txs - AND + AND ( -- early bots: > 25 txs / hour per address ( - cast(cast(COUNT(*) as double)/cast(COUNT(DISTINCT "from") as double) as double) / - ( cast( date_DIFF('second', MIN(block_time), MAX(block_time)) as double) / (60.0*60.0) ) >= 25 + cast(cast(COUNT(*) as double)/cast(COUNT(DISTINCT "from") as double) as double) / + ( cast( date_DIFF('second', MIN(block_time), MAX(block_time)) as double) / (60.0*60.0) ) >= 25 ) OR -- established bots: less than 30 senders & > 2.5k txs & > 0.5 txs / hr (to make sure we don't accidently catch active multisigs) (COUNT(*) >= 2500 AND COUNT(DISTINCT "from") <=30 - AND cast(COUNT(*) as double) / + AND cast(COUNT(*) as double) / ( cast( date_DIFF('second', MIN(block_time), MAX(block_time)) as double) / (60.0*60.0) ) >= 0.5 ) - OR + OR -- wider distribution bots: > 2.5k txs and > 1k txs per sender & > 0.5 txs / hr (to make sure we don't accidently catch active multisigs) ( COUNT(*) >= 2500 AND cast(COUNT(*) as double)/cast(COUNT(DISTINCT "from") as double) >= 1000 - AND cast(COUNT(*) as double) / + AND cast(COUNT(*) as double) / ( cast( date_DIFF('second', MIN(block_time), MAX(block_time)) as double) / (60.0*60.0) ) >= 0.5 ) ) @@ -113,15 +113,15 @@ select contract AS address, 'likely bot types' AS category, CASE - WHEN pct_dex_trade_txs >= 0.5 THEN 'dex trade bot contract' - WHEN pct_nft_trade_txs >= 0.5 THEN 'nft trade bot contract' - WHEN pct_perp_trade_txs >= 0.5 THEN 'perp trade bot contract' - WHEN pct_erc20_tfer_txs >= 0.5 THEN 'erc20 transfer bot contract' - WHEN pct_nft_tfer_txs >= 0.5 THEN 'nft transfer bot contract' - WHEN pct_token_tfer_txs >= 0.5 THEN 'other token transfer bot contract' + WHEN pct_dex_trade_txs >= 0.5 THEN 'dex trade bot contract' + WHEN pct_nft_trade_txs >= 0.5 THEN 'nft trade bot contract' + WHEN pct_perp_trade_txs >= 0.5 THEN 'perp trade bot contract' + WHEN pct_erc20_tfer_txs >= 0.5 THEN 'erc20 transfer bot contract' + WHEN pct_nft_tfer_txs >= 0.5 THEN 'nft transfer bot contract' + WHEN pct_token_tfer_txs >= 0.5 THEN 'other token transfer bot contract' ELSE 'non-token bot contract' END AS name from first_contracts - ) a \ No newline at end of file + ) a diff --git a/models/labels/addresses/__single_category_labels__/likely_bots/optimism/labels_optimism_likely_bot_addresses.sql b/models/labels/addresses/__single_category_labels__/likely_bots/optimism/labels_optimism_likely_bot_addresses.sql index 56c1dd45ec6..7f1e2943510 100644 --- a/models/labels/addresses/__single_category_labels__/likely_bots/optimism/labels_optimism_likely_bot_addresses.sql +++ b/models/labels/addresses/__single_category_labels__/likely_bots/optimism/labels_optimism_likely_bot_addresses.sql @@ -1,10 +1,10 @@ {{ config( alias = 'likely_bot_addresses', - - post_hook='{{ expose_spells(\'["optimism"]\', - "sector", - "labels", + + post_hook='{{ expose_spells(\'["optimism"]\', + "sector", + "labels", \'["msilb7"]\') }}' ) }} @@ -20,18 +20,18 @@ WITH sender_transfer_rates AS ( , MAX(block_time) AS max_block_time , COUNT(*) AS hr_txs , SUM(CASE WHEN to IN (SELECT address FROM {{ ref('labels_optimism_likely_bot_contracts') }} WHERE name != 'chain ops bot') THEN 1 ELSE 0 END) AS bot_concentration_txs - + , SUM(CASE WHEN EXISTS (SELECT 1 FROM {{ source('erc20_optimism','evt_Transfer') }} r WHERE t.hash = r.evt_tx_hash AND t.block_number = r.evt_block_number) THEN 1 ELSE 0 END) AS num_erc20_tfer_txs - , SUM(CASE WHEN EXISTS (SELECT 1 FROM {{ ref('nft_transfers') }} r WHERE t.hash = r.tx_hash AND t.block_number = r.block_number AND blockchain = 'optimism') THEN 1 ELSE 0 END) AS num_nft_tfer_txs + , SUM(CASE WHEN EXISTS (SELECT 1 FROM {{ source('nft', 'transfers') }} r WHERE t.hash = r.tx_hash AND t.block_number = r.block_number AND blockchain = 'optimism') THEN 1 ELSE 0 END) AS num_nft_tfer_txs - , SUM(CASE WHEN EXISTS (SELECT 1 FROM {{ source('erc20_optimism','evt_Transfer') }} r WHERE t.hash = r.evt_tx_hash AND t.block_number = r.evt_block_number) THEN 1 - WHEN EXISTS (SELECT 1 FROM {{ ref('nft_transfers') }} r WHERE t.hash = r.tx_hash AND t.block_number = r.block_number AND blockchain = 'optimism') THEN 1 + , SUM(CASE WHEN EXISTS (SELECT 1 FROM {{ source('erc20_optimism','evt_Transfer') }} r WHERE t.hash = r.evt_tx_hash AND t.block_number = r.evt_block_number) THEN 1 + WHEN EXISTS (SELECT 1 FROM {{ source('nft', 'transfers') }} r WHERE t.hash = r.tx_hash AND t.block_number = r.block_number AND blockchain = 'optimism') THEN 1 ELSE 0 END) AS num_token_tfer_txs - + , 0 /*SUM(CASE WHEN EXISTS (SELECT 1 FROM [[ dex_trades ]] r WHERE t.hash = r.tx_hash AND t.block_time = r.block_time AND blockchain = 'optimism') THEN 1 ELSE 0 END)*/ AS num_dex_trade_txs , 0 /*SUM(CASE WHEN EXISTS (SELECT 1 FROM [[ perpetual_trades ]] r WHERE t.hash = r.tx_hash AND t.block_time = r.block_time AND blockchain = 'optimism') THEN 1 ELSE 0 END)*/ AS num_perp_trade_txs , 0 /*SUM(CASE WHEN EXISTS (SELECT 1 FROM [[ nft_trades ]] r WHERE t.hash = r.tx_hash AND t.block_number = r.block_number AND blockchain = 'optimism') THEN 1 ELSE 0 END)*/ AS num_nft_trade_txs - + FROM {{ source('optimism','transactions') }} t GROUP BY 1,2 @@ -45,7 +45,7 @@ WITH sender_transfer_rates AS ( cast(COUNT(*) as double) /cast(7.0*24.0 as double) AS pct_weekly_hours_active, MIN(min_block_time) AS min_block_time, MAX(max_block_time) AS max_block_time, - + SUM(num_erc20_tfer_txs) AS num_erc20_tfer_txs, SUM(num_nft_tfer_txs) AS num_nft_tfer_txs, SUM(num_token_tfer_txs) AS num_token_tfer_txs, @@ -69,7 +69,7 @@ SELECT *, cast(num_dex_trade_txs as double) / cast( num_txs as double) AS pct_dex_trade_txs, cast(num_perp_trade_txs as double) / cast( num_txs as double) AS pct_perp_trade_txs, -- perpetual.trades has some dunesql incompatability cast(num_nft_trade_txs as double) / cast( num_txs as double) AS pct_nft_trade_txs - + FROM ( SELECT sender, MAX(wk_txs) AS max_wk_txs, MAX(max_hr_txs) AS max_hr_txs, AVG(wk_txs) AS avg_wk_txs ,MIN(min_block_time) AS min_block_time @@ -78,7 +78,7 @@ FROM ( ,AVG(pct_weekly_hours_active) AS avg_pct_weekly_hours_active ,SUM(wk_txs) AS num_txs ,SUM(bot_concentration_txs) AS bot_concentration_txs - + ,cast(SUM(bot_concentration_txs) as double) / cast(SUM(wk_txs) as double) AS pct_bot_concentration_txs ,( cast( date_DIFF('second', MIN(min_block_time), MAX(max_block_time)) as double) / (60.0*60.0) ) AS txs_per_hour @@ -88,17 +88,17 @@ FROM ( ,SUM(num_dex_trade_txs) AS num_dex_trade_txs ,SUM(num_perp_trade_txs) AS num_perp_trade_txs ,SUM(num_nft_trade_txs) AS num_nft_trade_txs - + FROM first_pass_throughput_filter f GROUP BY 1 -- various cases to detect bots HAVING (MAX(wk_txs) >= 2000 AND MAX(max_hr_txs) >= 100) --frequency (gt 2k txs in one week and gt 100 txs in one hour) OR (MAX(wk_txs) >= 4000 AND MAX(max_hr_txs) >= 50) --frequency (gt 4k txs in one week and gt 50 txs in one hour) OR AVG(wk_txs) >= 1000 --frequency (avg 1k txs per week) - OR + OR ( - cast(COUNT(*) as double) / - ( cast( date_DIFF('second', MIN(min_block_time), MAX(max_block_time)) as double) / (60.0*60.0) ) >= 25 + cast(COUNT(*) as double) / + ( cast( date_DIFF('second', MIN(min_block_time), MAX(max_block_time)) as double) / (60.0*60.0) ) >= 25 AND SUM(wk_txs) >= 100 ) --frequency gt 25 txs per hour OR AVG(pct_weekly_hours_active) > 0.5 -- aliveness: transacting at least 50% of hours per week @@ -135,15 +135,15 @@ select sender AS address, 'likely bot types' AS category, CASE - WHEN pct_dex_trade_txs >= 0.5 THEN 'dex trade bot address' - WHEN pct_nft_trade_txs >= 0.5 THEN 'nft trade bot address' - WHEN pct_perp_trade_txs >= 0.5 THEN 'perp trade bot address' - WHEN pct_erc20_tfer_txs >= 0.5 THEN 'erc20 transfer bot address' - WHEN pct_nft_tfer_txs >= 0.5 THEN 'nft transfer bot address' - WHEN pct_token_tfer_txs >= 0.5 THEN 'other token transfer bot address' + WHEN pct_dex_trade_txs >= 0.5 THEN 'dex trade bot address' + WHEN pct_nft_trade_txs >= 0.5 THEN 'nft trade bot address' + WHEN pct_perp_trade_txs >= 0.5 THEN 'perp trade bot address' + WHEN pct_erc20_tfer_txs >= 0.5 THEN 'erc20 transfer bot address' + WHEN pct_nft_tfer_txs >= 0.5 THEN 'nft transfer bot address' + WHEN pct_token_tfer_txs >= 0.5 THEN 'other token transfer bot address' ELSE 'non-token bot address' END AS name from bot_addresses - ) a \ No newline at end of file + ) a diff --git a/models/labels/addresses/__single_category_labels__/likely_bots/optimism/labels_optimism_likely_bot_contracts.sql b/models/labels/addresses/__single_category_labels__/likely_bots/optimism/labels_optimism_likely_bot_contracts.sql index 1c3756bf393..59a0078896d 100644 --- a/models/labels/addresses/__single_category_labels__/likely_bots/optimism/labels_optimism_likely_bot_contracts.sql +++ b/models/labels/addresses/__single_category_labels__/likely_bots/optimism/labels_optimism_likely_bot_contracts.sql @@ -1,10 +1,10 @@ {{ config( alias = 'likely_bot_contracts', - - post_hook='{{ expose_spells(\'["optimism"]\', - "sector", - "labels", + + post_hook='{{ expose_spells(\'["optimism"]\', + "sector", + "labels", \'["msilb7"]\') }}' ) }} @@ -23,49 +23,49 @@ SELECT *, cast(num_nft_trade_txs as double) / cast( num_txs as double) AS pct_nft_trade_txs FROM ( - SELECT to AS contract, + SELECT to AS contract, SUM(CASE WHEN EXISTS (SELECT 1 FROM {{ source('erc20_optimism','evt_Transfer') }} r WHERE t.hash = r.evt_tx_hash AND t.block_number = r.evt_block_number) THEN 1 ELSE 0 END) AS num_erc20_tfer_txs, - SUM(CASE WHEN EXISTS (SELECT 1 FROM {{ ref('nft_transfers') }} r WHERE t.hash = r.tx_hash AND t.block_number = r.block_number AND blockchain = 'optimism') THEN 1 ELSE 0 END) AS num_nft_tfer_txs, - - SUM(CASE WHEN EXISTS (SELECT 1 FROM {{ source('erc20_optimism','evt_Transfer') }} r WHERE t.hash = r.evt_tx_hash AND t.block_number = r.evt_block_number) THEN 1 - WHEN EXISTS (SELECT 1 FROM {{ ref('nft_transfers') }} r WHERE t.hash = r.tx_hash AND t.block_number = r.block_number AND blockchain = 'optimism') THEN 1 + SUM(CASE WHEN EXISTS (SELECT 1 FROM {{ source('nft', 'transfers') }} r WHERE t.hash = r.tx_hash AND t.block_number = r.block_number AND blockchain = 'optimism') THEN 1 ELSE 0 END) AS num_nft_tfer_txs, + + SUM(CASE WHEN EXISTS (SELECT 1 FROM {{ source('erc20_optimism','evt_Transfer') }} r WHERE t.hash = r.evt_tx_hash AND t.block_number = r.evt_block_number) THEN 1 + WHEN EXISTS (SELECT 1 FROM {{ source('nft', 'transfers') }} r WHERE t.hash = r.tx_hash AND t.block_number = r.block_number AND blockchain = 'optimism') THEN 1 ELSE 0 END) AS num_token_tfer_txs, - + 0 /*SUM(CASE WHEN EXISTS (SELECT 1 FROM [[ dex_trades ]] r WHERE t.hash = r.tx_hash AND t.block_time = r.block_time AND blockchain = 'optimism') THEN 1 ELSE 0 END)*/ AS num_dex_trade_txs, 0 /*SUM(CASE WHEN EXISTS (SELECT 1 FROM [[ perpetual_trades ]] r WHERE t.hash = r.tx_hash AND t.block_time = r.block_time AND blockchain = 'optimism') THEN 1 ELSE 0 END)*/ AS num_perp_trade_txs, 0 /*SUM(CASE WHEN EXISTS (SELECT 1 FROM [[ nft_trades ]] r WHERE t.hash = r.tx_hash AND t.block_number = r.block_number AND blockchain = 'optimism') THEN 1 ELSE 0 END)*/ AS num_nft_trade_txs, COUNT(*) AS num_txs, COUNT(DISTINCT "from") AS num_senders, COUNT(*)/COUNT(DISTINCT "from") AS txs_per_sender, - - cast(cast(COUNT(*) as double)/cast(COUNT(DISTINCT "from") as double) as double) / - ( cast( date_DIFF('second', MIN(block_time), MAX(block_time)) as double) / (60.0*60.0) ) + + cast(cast(COUNT(*) as double)/cast(COUNT(DISTINCT "from") as double) as double) / + ( cast( date_DIFF('second', MIN(block_time), MAX(block_time)) as double) / (60.0*60.0) ) AS txs_per_addr_per_hour, - - cast(COUNT(*) as double) / - ( cast( date_DIFF('second', MIN(block_time), MAX(block_time)) as double) / (60.0*60.0) ) + + cast(COUNT(*) as double) / + ( cast( date_DIFF('second', MIN(block_time), MAX(block_time)) as double) / (60.0*60.0) ) AS txs_per_hour -- SUM( CASE WHEN substring(data from 1 for 10) = mode(substring(data from 1 for 10) THEN 1 ELSE 0 END) ) AS method_dupe FROM {{ source('optimism','transactions') }} t GROUP BY 1 - + -- search for various potential bot indicators HAVING -- early bots: > 25 txs / hour per address (COUNT(*) >= 100 AND - cast(cast(COUNT(*) as double)/cast(COUNT(DISTINCT "from") as double) as double) / - ( cast( date_DIFF('second', MIN(block_time), MAX(block_time)) as double) / (60.0*60.0) ) >= 25 + cast(cast(COUNT(*) as double)/cast(COUNT(DISTINCT "from") as double) as double) / + ( cast( date_DIFF('second', MIN(block_time), MAX(block_time)) as double) / (60.0*60.0) ) >= 25 ) OR -- established bots: less than 30 senders & > 2.5k txs & > 0.5 txs / hr (to make sure we don't accidently catch active multisigs) (COUNT(*) >= 2500 AND COUNT(DISTINCT "from") <=30 - AND cast(COUNT(*) as double) / + AND cast(COUNT(*) as double) / ( cast( date_DIFF('second', MIN(block_time), MAX(block_time)) as double) / (60.0*60.0) ) >= 0.5 ) - OR + OR -- wider distribution bots: > 2.5k txs and > 1k txs per sender & > 0.5 txs / hr (to make sure we don't accidently catch active multisigs) ( COUNT(*) >= 2500 AND cast(COUNT(*) as double)/cast(COUNT(DISTINCT "from") as double) >= 1000 - AND cast(COUNT(*) as double) / + AND cast(COUNT(*) as double) / ( cast( date_DIFF('second', MIN(block_time), MAX(block_time)) as double) / (60.0*60.0) ) >= 0.5 ) ) a @@ -99,15 +99,15 @@ select -- contract AS address, -- 'likely bot types' AS category, -- CASE - -- WHEN pct_dex_trade_txs >= 0.5 THEN 'dex trade bot contract' - -- WHEN pct_nft_trade_txs >= 0.5 THEN 'nft trade bot contract' - -- WHEN pct_perp_trade_txs >= 0.5 THEN 'perp trade bot contract' - -- WHEN pct_erc20_tfer_txs >= 0.5 THEN 'erc20 transfer bot contract' - -- WHEN pct_nft_tfer_txs >= 0.5 THEN 'nft transfer bot contract' - -- WHEN pct_token_tfer_txs >= 0.5 THEN 'other token transfer bot contract' + -- WHEN pct_dex_trade_txs >= 0.5 THEN 'dex trade bot contract' + -- WHEN pct_nft_trade_txs >= 0.5 THEN 'nft trade bot contract' + -- WHEN pct_perp_trade_txs >= 0.5 THEN 'perp trade bot contract' + -- WHEN pct_erc20_tfer_txs >= 0.5 THEN 'erc20 transfer bot contract' + -- WHEN pct_nft_tfer_txs >= 0.5 THEN 'nft transfer bot contract' + -- WHEN pct_token_tfer_txs >= 0.5 THEN 'other token transfer bot contract' -- ELSE 'non-token bot contract' -- END AS name -- from first_contracts - ) a \ No newline at end of file + ) a diff --git a/models/labels/addresses/infrastructure/token_standard/labels_token_standards_arbitrum.sql b/models/labels/addresses/infrastructure/token_standard/labels_token_standards_arbitrum.sql index 633af81356d..6034ed42214 100644 --- a/models/labels/addresses/infrastructure/token_standard/labels_token_standards_arbitrum.sql +++ b/models/labels/addresses/infrastructure/token_standard/labels_token_standards_arbitrum.sql @@ -35,10 +35,10 @@ SELECT distinct 'arbitrum' AS blockchain , NOW() AS updated_at , 'token_standard' AS model_name , 'persona' as label_type -FROM {{ ref('nft_arbitrum_transfers') }} nft +FROM {{ source('nft_arbitrum','transfers') }} nft {% if is_incremental() %} LEFT JOIN this t ON t.address = nft.contract_address WHERE t.address IS NULL AND nft.block_time >= date_trunc('day', now() - interval '7' day) -{% endif %} \ No newline at end of file +{% endif %} diff --git a/models/labels/addresses/infrastructure/token_standard/labels_token_standards_avalanche_c.sql b/models/labels/addresses/infrastructure/token_standard/labels_token_standards_avalanche_c.sql index b53bc6e347f..e296aabec82 100644 --- a/models/labels/addresses/infrastructure/token_standard/labels_token_standards_avalanche_c.sql +++ b/models/labels/addresses/infrastructure/token_standard/labels_token_standards_avalanche_c.sql @@ -35,10 +35,10 @@ SELECT distinct 'avalanche_c' AS blockchain , NOW() AS updated_at , 'token_standard' AS model_name , 'persona' as label_type -FROM {{ ref('nft_avalanche_c_transfers') }} nft +FROM {{ source('nft_avalanche_c','transfers')}} nft {% if is_incremental() %} LEFT JOIN this t ON t.address = nft.contract_address WHERE t.address IS NULL AND nft.block_time >= date_trunc('day', now() - interval '7' day) -{% endif %} \ No newline at end of file +{% endif %} diff --git a/models/labels/addresses/infrastructure/token_standard/labels_token_standards_bnb.sql b/models/labels/addresses/infrastructure/token_standard/labels_token_standards_bnb.sql index 4197ef44330..26b974a8131 100644 --- a/models/labels/addresses/infrastructure/token_standard/labels_token_standards_bnb.sql +++ b/models/labels/addresses/infrastructure/token_standard/labels_token_standards_bnb.sql @@ -35,10 +35,10 @@ SELECT distinct 'bnb' AS blockchain , NOW() AS updated_at , 'token_standard' AS model_name , 'persona' as label_type -FROM {{ ref('nft_bnb_transfers') }} nft +FROM {{ source('nft_bnb','transfers') }} nft {% if is_incremental() %} LEFT JOIN this t ON t.address = nft.contract_address WHERE t.address IS NULL AND nft.block_time >= date_trunc('day', now() - interval '7' day) -{% endif %} \ No newline at end of file +{% endif %} diff --git a/models/labels/addresses/infrastructure/token_standard/labels_token_standards_ethereum.sql b/models/labels/addresses/infrastructure/token_standard/labels_token_standards_ethereum.sql index a394ad4f738..a0f738aa8ca 100644 --- a/models/labels/addresses/infrastructure/token_standard/labels_token_standards_ethereum.sql +++ b/models/labels/addresses/infrastructure/token_standard/labels_token_standards_ethereum.sql @@ -35,10 +35,10 @@ SELECT distinct 'ethereum' AS blockchain , NOW() AS updated_at , 'token_standard' AS model_name , 'persona' as label_type -FROM {{ ref('nft_ethereum_transfers') }} nft +FROM {{ source('nft_ethereum','transfers') }} nft {% if is_incremental() %} LEFT JOIN this t ON t.address = nft.contract_address WHERE t.address IS NULL AND nft.block_time >= date_trunc('day', now() - interval '7' day) -{% endif %} \ No newline at end of file +{% endif %} diff --git a/models/labels/addresses/infrastructure/token_standard/labels_token_standards_fantom.sql b/models/labels/addresses/infrastructure/token_standard/labels_token_standards_fantom.sql index bf2a9a33448..58395d788eb 100644 --- a/models/labels/addresses/infrastructure/token_standard/labels_token_standards_fantom.sql +++ b/models/labels/addresses/infrastructure/token_standard/labels_token_standards_fantom.sql @@ -35,10 +35,10 @@ SELECT distinct 'fantom' AS blockchain , NOW() AS updated_at , 'token_standard' AS model_name , 'persona' as label_type -FROM {{ ref('nft_fantom_transfers') }} nft +FROM {{ source('nft_fantom','transfers') }} nft {% if is_incremental() %} LEFT JOIN this t ON t.address = nft.contract_address WHERE t.address IS NULL AND nft.block_time >= date_trunc('day', now() - interval '7' day) -{% endif %} \ No newline at end of file +{% endif %} diff --git a/models/labels/addresses/infrastructure/token_standard/labels_token_standards_gnosis.sql b/models/labels/addresses/infrastructure/token_standard/labels_token_standards_gnosis.sql index bd49518b807..aef3b6940f1 100644 --- a/models/labels/addresses/infrastructure/token_standard/labels_token_standards_gnosis.sql +++ b/models/labels/addresses/infrastructure/token_standard/labels_token_standards_gnosis.sql @@ -35,10 +35,10 @@ SELECT distinct 'gnosis' AS blockchain , NOW() AS updated_at , 'token_standard' AS model_name , 'persona' as label_type -FROM {{ ref('nft_gnosis_transfers') }} nft +FROM {{ source('nft_gnosis','transfers') }} nft {% if is_incremental() %} LEFT JOIN this t ON t.address = nft.contract_address WHERE t.address IS NULL AND nft.block_time >= date_trunc('day', now() - interval '7' day) -{% endif %} \ No newline at end of file +{% endif %} diff --git a/models/labels/addresses/infrastructure/token_standard/labels_token_standards_goerli.sql b/models/labels/addresses/infrastructure/token_standard/labels_token_standards_goerli.sql index f7de3421c66..0dc45e10a9e 100644 --- a/models/labels/addresses/infrastructure/token_standard/labels_token_standards_goerli.sql +++ b/models/labels/addresses/infrastructure/token_standard/labels_token_standards_goerli.sql @@ -35,10 +35,10 @@ SELECT distinct 'goerli' AS blockchain , NOW() AS updated_at , 'token_standard' AS model_name , 'persona' as label_type -FROM {{ ref('nft_goerli_transfers') }} nft +FROM {{ source('nft_goerli','transfers') }} nft {% if is_incremental() %} LEFT JOIN this t ON t.address = nft.contract_address WHERE t.address IS NULL AND nft.block_time >= date_trunc('day', now() - interval '7' day) -{% endif %} \ No newline at end of file +{% endif %} diff --git a/models/labels/addresses/infrastructure/token_standard/labels_token_standards_optimism.sql b/models/labels/addresses/infrastructure/token_standard/labels_token_standards_optimism.sql index cadd7582487..2c1ee476734 100644 --- a/models/labels/addresses/infrastructure/token_standard/labels_token_standards_optimism.sql +++ b/models/labels/addresses/infrastructure/token_standard/labels_token_standards_optimism.sql @@ -35,10 +35,10 @@ SELECT distinct 'optimism' AS blockchain , NOW() AS updated_at , 'token_standard' AS model_name , 'persona' as label_type -FROM {{ ref('nft_optimism_transfers') }} nft +FROM {{ source('nft_optimism', 'transfers') }} nft {% if is_incremental() %} LEFT JOIN this t ON t.address = nft.contract_address WHERE t.address IS NULL AND nft.block_time >= date_trunc('day', now() - interval '7' day) -{% endif %} \ No newline at end of file +{% endif %} diff --git a/models/labels/addresses/infrastructure/token_standard/labels_token_standards_polygon.sql b/models/labels/addresses/infrastructure/token_standard/labels_token_standards_polygon.sql index 5a86a2419fb..3a5da1e8635 100644 --- a/models/labels/addresses/infrastructure/token_standard/labels_token_standards_polygon.sql +++ b/models/labels/addresses/infrastructure/token_standard/labels_token_standards_polygon.sql @@ -35,10 +35,10 @@ SELECT distinct 'polygon' AS blockchain , NOW() AS updated_at , 'token_standard' AS model_name , 'persona' as label_type -FROM {{ ref('nft_polygon_transfers') }} nft +FROM {{ source('nft_polygon','transfers') }} nft {% if is_incremental() %} LEFT JOIN this t ON t.address = nft.contract_address WHERE t.address IS NULL AND nft.block_time >= date_trunc('day', now() - interval '7' day) -{% endif %} \ No newline at end of file +{% endif %} diff --git a/models/labels/addresses/nft/persona/op_nft_traders/labels_op_habitual_wash_traders.sql b/models/labels/addresses/nft/persona/op_nft_traders/labels_op_habitual_wash_traders.sql index 8184fee590a..da5ba74924d 100644 --- a/models/labels/addresses/nft/persona/op_nft_traders/labels_op_habitual_wash_traders.sql +++ b/models/labels/addresses/nft/persona/op_nft_traders/labels_op_habitual_wash_traders.sql @@ -5,13 +5,13 @@ WITH wash_trades_count AS (SELECT trader, COUNT(trader) AS trade_count FROM (SELECT buyer AS trader -FROM {{ ref('nft_optimism_wash_trades') }} +FROM {{ source('nft_optimism','wash_trades') }} WHERE is_wash_trade = true UNION ALL SELECT seller AS trader -FROM {{ ref('nft_optimism_wash_trades') }} +FROM {{ source('nft_optimism','wash_trades') }} WHERE is_wash_trade = true ) GROUP BY trader @@ -39,4 +39,4 @@ SELECT 'optimism' AS blockchain, 'op_habitual_wash_traders' AS model_name, 'persona' AS label_type FROM - nft_wash_traders \ No newline at end of file + nft_wash_traders diff --git a/models/labels/addresses/nft/persona/op_nft_traders/labels_op_nft_traders.sql b/models/labels/addresses/nft/persona/op_nft_traders/labels_op_nft_traders.sql index 1f9d3c8e8d8..139ed793d32 100644 --- a/models/labels/addresses/nft/persona/op_nft_traders/labels_op_nft_traders.sql +++ b/models/labels/addresses/nft/persona/op_nft_traders/labels_op_nft_traders.sql @@ -5,30 +5,30 @@ WITH nft_trades_raw AS (SELECT buyer AS trader -FROM {{ ref('nft_trades') }} +FROM {{ source('nft', 'trades') }} WHERE blockchain = 'optimism' UNION ALL SELECT seller AS trader -FROM {{ ref('nft_trades') }} +FROM {{ source('nft', 'trades') }} WHERE blockchain = 'optimism' ), nft_trades_count AS (SELECT trader, COUNT(trader) AS trades_count -FROM nft_trades_raw +FROM nft_trades_raw GROUP BY trader ), percentile_nft_trades AS -(SELECT approx_percentile (trades_count, 0.95) AS "0.95p", +(SELECT approx_percentile (trades_count, 0.95) AS "0.95p", approx_percentile(trades_count, 0.65) AS "0.65p" FROM nft_trades_count), nft_traders AS (SELECT trader AS address, -(CASE +(CASE WHEN trades_count >= (SELECT "0.95p" FROM percentile_nft_trades) THEN 'Elite NFT Trader' WHEN trades_count >= (SELECT "0.65p" FROM percentile_nft_trades) THEN 'Active NFT Trader' ELSE 'Normie NFT Trader' diff --git a/models/labels/addresses/nft/persona/trader_platforms/labels_nft_users_platforms.sql b/models/labels/addresses/nft/persona/trader_platforms/labels_nft_users_platforms.sql index 047930a0ae2..b7545a22aae 100644 --- a/models/labels/addresses/nft/persona/trader_platforms/labels_nft_users_platforms.sql +++ b/models/labels/addresses/nft/persona/trader_platforms/labels_nft_users_platforms.sql @@ -7,13 +7,13 @@ SELECT blockchain, project, buyer AS address -FROM {{ ref('nft_trades') }} +FROM {{ source('nft','trades') }} UNION SELECT blockchain, project, seller AS address -FROM {{ ref('nft_trades') }} +FROM {{ source('nft','trades') }} ) SELECT diff --git a/models/labels/addresses/nft/usage/smart_nft_trader/labels_nft_smart_trader_roi_eth.sql b/models/labels/addresses/nft/usage/smart_nft_trader/labels_nft_smart_trader_roi_eth.sql index 49e6aabeb76..d5f11dfe8b6 100644 --- a/models/labels/addresses/nft/usage/smart_nft_trader/labels_nft_smart_trader_roi_eth.sql +++ b/models/labels/addresses/nft/usage/smart_nft_trader/labels_nft_smart_trader_roi_eth.sql @@ -1,13 +1,13 @@ {{config( - + alias = 'nft_smart_trader_roi_eth' )}} -with +with aggregated_wallet_trading_stats AS ( - select * - from {{ref('nft_ethereum_wallet_metrics')}} + select * + from {{source('nft_ethereum','wallet_metrics')}} where trades_count >= 10 and unique_collections_traded >= 3 and spent_eth >= 1 @@ -15,15 +15,15 @@ aggregated_wallet_trading_stats AS ( and roi_eth > 0 ), - + aggregated_wallet_trading_stats_w_ranks AS ( select ROW_NUMBER() OVER (ORDER BY roi_eth_realized DESC) rank_roi, count(1) over () AS total_count, * from aggregated_wallet_trading_stats ), - - + + aggregated_wallet_trading_stats_w_label AS ( select 'ethereum' AS blockchain, wallet AS address, @@ -43,8 +43,8 @@ aggregated_wallet_trading_stats_w_label AS ( current_timestamp AS updated_at, 'nft_traders_roi' AS model_name, 'usage' AS label_type - -- uncomment line below to see stats on the trader - -- , * + -- uncomment line below to see stats on the trader + -- , * from aggregated_wallet_trading_stats_w_ranks order by roi_eth_realized desc ) diff --git a/models/labels/addresses/nft/usage/transaction_numbers/labels_nft_traders_transactions.sql b/models/labels/addresses/nft/usage/transaction_numbers/labels_nft_traders_transactions.sql index 61715394b42..4c9c2de7032 100644 --- a/models/labels/addresses/nft/usage/transaction_numbers/labels_nft_traders_transactions.sql +++ b/models/labels/addresses/nft/usage/transaction_numbers/labels_nft_traders_transactions.sql @@ -7,7 +7,7 @@ SELECT blockchain, tx_hash, buyer AS address -FROM {{ ref('nft_trades') }} +FROM {{ source('nft', 'trades') }} UNION @@ -15,7 +15,7 @@ SELECT blockchain, tx_hash, seller AS address -FROM {{ ref('nft_trades') }} +FROM {{ source('nft', 'trades') }} ), total as ( diff --git a/models/labels/addresses/nft/usage/transaction_numbers/labels_nft_traders_transactions_current.sql b/models/labels/addresses/nft/usage/transaction_numbers/labels_nft_traders_transactions_current.sql index 2c69d09ffd1..f83ac44e1ba 100644 --- a/models/labels/addresses/nft/usage/transaction_numbers/labels_nft_traders_transactions_current.sql +++ b/models/labels/addresses/nft/usage/transaction_numbers/labels_nft_traders_transactions_current.sql @@ -7,7 +7,7 @@ SELECT blockchain, tx_hash, buyer AS address -FROM {{ ref('nft_trades') }} +FROM {{ source('nft', 'trades') }} WHERE block_time > NOW() - interval '14' day UNION @@ -16,7 +16,7 @@ SELECT blockchain, tx_hash, seller AS address -FROM {{ ref('nft_trades') }} +FROM {{ source('nft', 'trades') }} WHERE block_time > NOW() - interval '14' day ), diff --git a/models/labels/addresses/nft/usage/transaction_volume/labels_nft_traders_volume_usd.sql b/models/labels/addresses/nft/usage/transaction_volume/labels_nft_traders_volume_usd.sql index c5f9902b9d4..6cf2472fd84 100644 --- a/models/labels/addresses/nft/usage/transaction_volume/labels_nft_traders_volume_usd.sql +++ b/models/labels/addresses/nft/usage/transaction_volume/labels_nft_traders_volume_usd.sql @@ -7,7 +7,7 @@ SELECT blockchain, amount_usd, buyer AS address -FROM {{ ref('nft_trades') }} +FROM {{ source('nft', 'trades') }} UNION @@ -15,7 +15,7 @@ SELECT blockchain, amount_usd, seller AS address -FROM {{ ref('nft_trades') }} +FROM {{ source('nft', 'trades') }} ), total as ( diff --git a/models/labels/addresses/nft/usage/transaction_volume/labels_nft_traders_volume_usd_current.sql b/models/labels/addresses/nft/usage/transaction_volume/labels_nft_traders_volume_usd_current.sql index b3cfa164f23..8f90357dd98 100644 --- a/models/labels/addresses/nft/usage/transaction_volume/labels_nft_traders_volume_usd_current.sql +++ b/models/labels/addresses/nft/usage/transaction_volume/labels_nft_traders_volume_usd_current.sql @@ -7,7 +7,7 @@ SELECT blockchain, amount_usd, buyer AS address -FROM {{ ref('nft_trades') }} +FROM {{ source('nft', 'trades') }} WHERE block_time > NOW() - interval '14' day UNION @@ -16,7 +16,7 @@ SELECT blockchain, amount_usd, seller AS address -FROM {{ ref('nft_trades') }} +FROM {{ source('nft', 'trades') }} WHERE block_time > NOW() - interval '14' day ), diff --git a/models/nft/nft_schema.yml b/models/nft/nft_schema.yml deleted file mode 100644 index b7f478788a5..00000000000 --- a/models/nft/nft_schema.yml +++ /dev/null @@ -1,115 +0,0 @@ -version: 2 - -models: - - name: nft_linked_addresses - meta: - blockchain: ethereum, solana - sector: nft - contributors: springzh, 0xRob - config: - tags: ['nft', 'opensea', 'looksrare', 'x2y2', 'magiceden', 'sudoswap', 'ethereum', 'solana', 'address'] - description: > - NFT linked addresses. Addresses that buy and sell NFTs from each other. By definition (master address < alt address) alphabetically. - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - blockchain - - master_address - - alternative_address - columns: - - name: blockchain - - name: master_address - description: "Master address" - - name: alternative_address - description: "Alternative address" - - name: last_interaction - description: "block_time of the last trade between the pair" - - - name: nft_lending - meta: - blockchain: ethereum - sector: nft - contributors: Henrystats - config: - tags: ['ethereum','nft', 'lending'] - description: > - nft lending events (repay & borrow) - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - block_date - - blockchain - - project - - version - - tx_hash - - evt_index - - lien_id - columns: - - name: blockchain - - name: project - - name: version - - &lending_category - name: lending_category - description: "Type of loans offered by the project, usually either pool to borrower or peer to peer" - - name: block_time - - &block_date - name: block_date - description: "UTC event block date" - - name: token_id - - name: collection - - name: amount_usd - description: "amount in USD" - - name: token_standard - - name: evt_type - - &borrower - name: borrower - description: "Address that took the loan" - - &lender - name: lender - description: "Address that faciliated the loan" - - name: amount_original - - name: amount_raw - - &collateral_currency_symbol - name: collateral_currency_symbol - description: "Symbol of collateral currency used for loan" - - &collateral_currency_contract - name: collateral_currency_contract - description: "Contract address of collateral currency used for loan" - - name: nft_contract_address - - name: project_contract_address - - name: tx_hash - - name: block_number - - name: tx_from - - name: tx_to - - &evt_index - name: evt_index - description: "Index of the corresponding lending event" - - &block_month - name: block_month - description: "UTC event block month" - - &lien_id - name: lien_id - description: "Unique loan id " - - - name: nft_marketplaces_info - meta: - blockchain: ethereum, polygon, bnb, avalanche_c, gnosis, optimism, arbitrum, fantom, goerli - sector: nft - contributors: hildobby - config: - tags: ['nft', 'ethereum', 'polygon', 'bnb', 'avalanche_c', 'gnosis', 'optimism', 'arbitrum', 'fantom', 'goerli', 'info'] - description: > - NFT marketplaces info - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - project - columns: - - name: project - description: "Marketplace codename" - - name: name - description: "Marketplace capitalised name" - - name: marketplace_type - description: "Type of marketplace" - - name: x_username - description: "Username on X" diff --git a/models/sudoswap/ethereum/sudoswap_ethereum_pool_trades_agg_day.sql b/models/sudoswap/ethereum/sudoswap_ethereum_pool_trades_agg_day.sql index 31e6385b221..736e5e97e8b 100644 --- a/models/sudoswap/ethereum/sudoswap_ethereum_pool_trades_agg_day.sql +++ b/models/sudoswap/ethereum/sudoswap_ethereum_pool_trades_agg_day.sql @@ -2,7 +2,7 @@ alias = 'pool_trades', materialized = 'incremental', schema = 'sudoswap_ethereum', - + file_format = 'delta', incremental_strategy = 'merge', unique_key = ['day', 'pool_address'], @@ -41,7 +41,7 @@ SELECT ELSE -1 * cast(nft_amount as int256) END ) AS nft_change_trading -FROM {{ ref('sudoswap_ethereum_base_trades') }} t +FROM {{ source('sudoswap_ethereum','base_trades') }} t LEFT JOIN {{ ref('prices_usd_forward_fill') }} usd ON usd.blockchain = null and usd.symbol = 'ETH' AND usd.minute = date_trunc('minute',t.block_time) diff --git a/nft/README.md b/nft/README.md new file mode 100644 index 00000000000..0b38ebded01 --- /dev/null +++ b/nft/README.md @@ -0,0 +1,3 @@ +## Daily Spellbook + +This is a DBT sub project for the all the NFT related models in spellbook. diff --git a/nft/dbt_project.yml b/nft/dbt_project.yml new file mode 100644 index 00000000000..2c16087c27d --- /dev/null +++ b/nft/dbt_project.yml @@ -0,0 +1,87 @@ +#Welcome to the NFT Spellbook! + +name: "nft" +version: "1.0.0" +config-version: 2 + +quoting: + database: false + schema: false + identifier: false + +# This setting configures which "profile" dbt uses for this project. +# profile: "spellbook-poc-tokens" +profile: "spellbook-local" + +vars: + DBT_ENV_CUSTOM_ENV_S3_BUCKET: "{{ env_var('DBT_ENV_CUSTOM_ENV_S3_BUCKET', 'local') }}" + DBT_ENV_INCREMENTAL_TIME: "{{ env_var('DBT_ENV_INCREMENTAL_TIME', '1') }}" + DBT_ENV_INCREMENTAL_TIME_UNIT: "{{ env_var('DBT_ENV_INCREMENTAL_TIME_UNIT', 'day') }}" + ETH_ERC20_ADDRESS: '0x0000000000000000000000000000000000000000' + +# These configurations specify where dbt should look for different types of files. +# You don't need to change these! +model-paths: ["models", "../sources"] +# ../tests/* should be added to a separate shared folder +test-paths: ["tests"] +seed-paths: ["seeds"] +macro-paths: ["../macros", "macros"] + +target-path: "target" # directory which will store compiled SQL files +clean-targets: # directories to be removed by `dbt clean` + - "target" + - "dbt_packages" + +# Configuring tests +# Full documentation: https://docs.getdbt.com/reference/test-configs +tests: + nft: + +store_failures: true # store failures for all tests + +# Configuring seeds +# Full documentation: https://docs.getdbt.com/reference/seed-configs +# For configuring individual seeds (e.g. overriding column types) we recommend a yml file nested in the same folder as the seed +# example: seeds/cryptopunks/schema.yml +seeds: + nft: + +schema: test_data + +# defining search order of macro invokation +dispatch: + - macro_namespace: dbt_utils + search_order: ['trino_utils', 'dbt_utils'] + +# Configuring models +# Full documentation: https://docs.getdbt.com/docs/configuring-models +models: + nft: + +post-hook: + - sql: "{{ set_trino_session_property(is_materialized(model), 'writer_scaling_min_data_processed', model.config.get('writer_min_size', '500MB')) }}" + transaction: true + - sql: "{{ set_trino_session_property(is_materialized(model), 'task_scale_writers_enabled', false) }}" + transaction: true + - sql: "{{ optimize_spell(this, model.config.materialized) }}" + transaction: true + - sql: "{{ mark_as_spell(this, model.config.materialized) }}" + transaction: true + +materialized: view + +schema: no_schema # this should be overriden in model specific configs + +view_security: invoker + + + seaport: + +schema: seaport + ethereum: + +schema: seaport_ethereum + bnb: + +schema: seaport_bnb + arbitrum: + +schema: seaport_arbitrum + optimism: + +schema: seaport_optimism + avalanche_c: + +schema: seaport_avalanche_c + polygon: + +schema: seaport_polygon + base: + +schema: seaport_base diff --git a/macros/models/_sector/nft/add_nft_tx_data.sql b/nft/macros/add_nft_tx_data.sql similarity index 100% rename from macros/models/_sector/nft/add_nft_tx_data.sql rename to nft/macros/add_nft_tx_data.sql diff --git a/macros/models/_sector/nft/enrich_nft_trades.sql b/nft/macros/enrich_nft_trades.sql similarity index 96% rename from macros/models/_sector/nft/enrich_nft_trades.sql rename to nft/macros/enrich_nft_trades.sql index 2d1dee8a940..a412c39117b 100644 --- a/macros/models/_sector/nft/enrich_nft_trades.sql +++ b/nft/macros/enrich_nft_trades.sql @@ -16,7 +16,7 @@ WITH prices_patch as ( ,minute ,price ,symbol - FROM {{ ref('prices_usd_forward_fill') }} + FROM {{ source('prices','usd_forward_fill') }} {% if is_incremental() %} WHERE {{incremental_predicate('minute')}} {% endif %} @@ -28,7 +28,7 @@ WITH prices_patch as ( ,minute ,price ,'ETH' as symbol - FROM {{ ref('prices_usd_forward_fill') }} + FROM {{ source('prices','usd_forward_fill') }} WHERE blockchain is null AND symbol = 'ETH' {% if is_incremental() %} AND {{incremental_predicate('minute')}} @@ -41,7 +41,7 @@ WITH prices_patch as ( ,minute ,price ,'ETH' as symbol - FROM {{ ref('prices_usd_forward_fill') }} + FROM {{ source('prices','usd_forward_fill') }} WHERE blockchain is null AND symbol = 'ETH' {% if is_incremental() %} AND {{incremental_predicate('minute')}} @@ -54,7 +54,7 @@ WITH prices_patch as ( ,minute ,price ,'ETH' as symbol - FROM {{ ref('prices_usd_forward_fill') }} + FROM {{ source('prices','usd_forward_fill') }} WHERE blockchain is null AND symbol = 'ETH' {% if is_incremental() %} AND {{incremental_predicate('minute')}} diff --git a/macros/models/_sector/nft/nft_approvals.sql b/nft/macros/nft_approvals.sql similarity index 100% rename from macros/models/_sector/nft/nft_approvals.sql rename to nft/macros/nft_approvals.sql diff --git a/macros/models/_sector/nft/nft_mints.sql b/nft/macros/nft_mints.sql similarity index 99% rename from macros/models/_sector/nft/nft_mints.sql rename to nft/macros/nft_mints.sql index 65246a5d326..3e81e82b55c 100644 --- a/macros/models/_sector/nft/nft_mints.sql +++ b/nft/macros/nft_mints.sql @@ -168,7 +168,7 @@ FROM AND nft_mints."from"= 0x0000000000000000000000000000000000000000 AND nft_mints.blockchain = '{{blockchain}}' {%- if blockchain == 'ethereum' %} - AND nft_mints.contract_address NOT IN (SELECT address FROM {{ ref('addresses_ethereum_defi') }}) + AND nft_mints.contract_address NOT IN (SELECT address FROM {{ source('addresses_ethereum','defi') }}) {%- endif -%} {%- if blockchain == 'optimism' %} -- to exclude bridged L1 NFT collections to L2 diff --git a/macros/models/_sector/nft/nft_transfers.sql b/nft/macros/nft_transfers.sql similarity index 100% rename from macros/models/_sector/nft/nft_transfers.sql rename to nft/macros/nft_transfers.sql diff --git a/macros/models/_sector/nft/nft_wash_trades.sql b/nft/macros/nft_wash_trades.sql similarity index 94% rename from macros/models/_sector/nft/nft_wash_trades.sql rename to nft/macros/nft_wash_trades.sql index 541d0e56aed..178fa105929 100644 --- a/macros/models/_sector/nft/nft_wash_trades.sql +++ b/nft/macros/nft_wash_trades.sql @@ -87,17 +87,17 @@ WITH filter_1 AS ( FROM {{ ref('nft_trades') }} nftt INNER JOIN {{ first_funded_by }} filter_funding_buyer ON filter_funding_buyer.address=nftt.buyer - AND filter_funding_buyer.first_funded_by NOT IN (SELECT DISTINCT address FROM {{ ref('labels_bridges') }}) - AND filter_funding_buyer.first_funded_by NOT IN (SELECT DISTINCT address FROM {{ ref('labels_cex') }}) - AND filter_funding_buyer.first_funded_by NOT IN (SELECT DISTINCT contract_address FROM {{ ref('tornado_cash_withdrawals') }}) + AND filter_funding_buyer.first_funded_by NOT IN (SELECT DISTINCT address FROM {{ source('labels','bridges') }}) + AND filter_funding_buyer.first_funded_by NOT IN (SELECT DISTINCT address FROM {{ source('labels','cex') }}) + AND filter_funding_buyer.first_funded_by NOT IN (SELECT DISTINCT contract_address FROM {{ source('tornado_cash','withdrawals') }}) {% if is_incremental() %} AND filter_funding_buyer.block_time >= date_trunc('day', NOW() - interval '7' day) {% endif %} INNER JOIN {{ first_funded_by }} filter_funding_seller ON filter_funding_seller.address=nftt.seller - AND filter_funding_seller.first_funded_by NOT IN (SELECT DISTINCT address FROM {{ ref('labels_bridges') }}) - AND filter_funding_seller.first_funded_by NOT IN (SELECT DISTINCT address FROM {{ ref('labels_cex') }}) - AND filter_funding_seller.first_funded_by NOT IN (SELECT DISTINCT contract_address FROM {{ ref('tornado_cash_withdrawals') }}) + AND filter_funding_seller.first_funded_by NOT IN (SELECT DISTINCT address FROM {{ source('labels','bridges') }}) + AND filter_funding_seller.first_funded_by NOT IN (SELECT DISTINCT address FROM {{ source('labels','cex') }}) + AND filter_funding_seller.first_funded_by NOT IN (SELECT DISTINCT contract_address FROM {{ source('tornado_cash','withdrawals') }}) AND nftt.blockchain='{{blockchain}}' AND nftt.unique_trade_id IS NOT NULL AND nftt.buyer IS NOT NULL @@ -112,7 +112,7 @@ WITH filter_1 AS ( SELECT unique_trade_id , true AS flashloan FROM {{ ref('nft_trades') }} nftt - INNER JOIN {{ ref('dex_flashloans') }} df ON df.blockchain='{{blockchain}}' + INNER JOIN {{ source('dex','flashloans') }} df ON df.blockchain='{{blockchain}}' AND df.block_time=nftt.block_time AND df.tx_hash=nftt.tx_hash AND nftt.blockchain='{{blockchain}}' diff --git a/macros/models/_sector/nft/platforms/element_v1_base_trades.sql b/nft/macros/platforms/element_v1_base_trades.sql similarity index 100% rename from macros/models/_sector/nft/platforms/element_v1_base_trades.sql rename to nft/macros/platforms/element_v1_base_trades.sql diff --git a/macros/models/_sector/nft/platforms/seaport_v3_fork_trades.sql b/nft/macros/platforms/seaport_v3_fork_trades.sql similarity index 100% rename from macros/models/_sector/nft/platforms/seaport_v3_fork_trades.sql rename to nft/macros/platforms/seaport_v3_fork_trades.sql diff --git a/macros/models/_sector/nft/platforms/seaport_v3_trades.sql b/nft/macros/platforms/seaport_v3_trades.sql similarity index 100% rename from macros/models/_sector/nft/platforms/seaport_v3_trades.sql rename to nft/macros/platforms/seaport_v3_trades.sql diff --git a/macros/models/_sector/nft/platforms/seaport_v4_fork_trades.sql b/nft/macros/platforms/seaport_v4_fork_trades.sql similarity index 100% rename from macros/models/_sector/nft/platforms/seaport_v4_fork_trades.sql rename to nft/macros/platforms/seaport_v4_fork_trades.sql diff --git a/macros/models/_sector/nft/platforms/seaport_v4_trades.sql b/nft/macros/platforms/seaport_v4_trades.sql similarity index 100% rename from macros/models/_sector/nft/platforms/seaport_v4_trades.sql rename to nft/macros/platforms/seaport_v4_trades.sql diff --git a/macros/models/_sector/nft/platforms/sudoswap_v2_base_trades.sql b/nft/macros/platforms/sudoswap_v2_base_trades.sql similarity index 100% rename from macros/models/_sector/nft/platforms/sudoswap_v2_base_trades.sql rename to nft/macros/platforms/sudoswap_v2_base_trades.sql diff --git a/macros/models/_sector/nft/platforms/tofu_v1_base_trades.sql b/nft/macros/platforms/tofu_v1_base_trades.sql similarity index 100% rename from macros/models/_sector/nft/platforms/tofu_v1_base_trades.sql rename to nft/macros/platforms/tofu_v1_base_trades.sql diff --git a/macros/models/_sector/nft/platforms/zonic_base_trades.sql b/nft/macros/platforms/zonic_base_trades.sql similarity index 100% rename from macros/models/_sector/nft/platforms/zonic_base_trades.sql rename to nft/macros/platforms/zonic_base_trades.sql diff --git a/macros/models/_sector/nft/platforms/zora_mints.sql b/nft/macros/platforms/zora_mints.sql similarity index 90% rename from macros/models/_sector/nft/platforms/zora_mints.sql rename to nft/macros/platforms/zora_mints.sql index ae18fe70fe4..2339d6d7db8 100644 --- a/macros/models/_sector/nft/platforms/zora_mints.sql +++ b/nft/macros/platforms/zora_mints.sql @@ -1,5 +1,5 @@ -{% macro - zora_mints(blockchain, wrapped_native_token_address, erc721_mints, erc1155_mints, transactions) +{% macro + zora_mints(blockchain, wrapped_native_token_address, erc721_mints, erc1155_mints, transactions) %} SELECT '{{blockchain}}' AS blockchain @@ -22,7 +22,7 @@ INNER JOIN {{transactions}} txs ON txs.block_number=mints.evt_block_number {% if is_incremental() %} AND {{incremental_predicate('txs.block_time')}} {% endif %} -INNER JOIN {{ ref('prices_usd_forward_fill') }} pu ON pu.blockchain='{{blockchain}}' +INNER JOIN {{ source('prices','usd_forward_fill') }} pu ON pu.blockchain='{{blockchain}}' AND pu.contract_address= {{wrapped_native_token_address}} AND pu.minute=date_trunc('minute', mints.evt_block_time) {% if is_incremental() %} @@ -55,7 +55,7 @@ INNER JOIN {{transactions}} txs ON txs.block_number=mints.evt_block_number {% if is_incremental() %} AND {{incremental_predicate('txs.block_time')}} {% endif %} -INNER JOIN {{ ref('prices_usd_forward_fill') }} pu ON pu.blockchain='{{blockchain}}' +INNER JOIN {{ source('prices','usd_forward_fill') }} pu ON pu.blockchain='{{blockchain}}' AND pu.contract_address= {{wrapped_native_token_address}} AND pu.minute=date_trunc('minute', mints.evt_block_time) {% if is_incremental() %} @@ -65,4 +65,4 @@ INNER JOIN {{ ref('prices_usd_forward_fill') }} pu ON pu.blockchain='{{blockchai WHERE {{incremental_predicate('mints.evt_block_time')}} {% endif %} -{% endmacro %} \ No newline at end of file +{% endmacro %} diff --git a/macros/models/_sector/nft/port_to_old_schema.sql b/nft/macros/port_to_old_schema.sql similarity index 100% rename from macros/models/_sector/nft/port_to_old_schema.sql rename to nft/macros/port_to_old_schema.sql diff --git a/nft/models/_extra_sources.yml b/nft/models/_extra_sources.yml new file mode 100644 index 00000000000..4e31d9241c9 --- /dev/null +++ b/nft/models/_extra_sources.yml @@ -0,0 +1,32 @@ +version: 2 + +sources: + # Extra sources that are needed in the NFT models but come from other subprojects, we should aim to keep this to a minimum + - name: addresses_ethereum + tables: + - name: defi + + - name: labels + tables: + - name: cex + - name: bridges + + - name: dex + tables: + - name: flashloans + + - name: tokens_base + tables: + - name: base_transfers + + - name: tokens_optimism + tables: + - name: base_transfers + + - name: tokens_zksync + tables: + - name: base_transfers + + - name: tornado_cash + tables: + - name: withdrawals diff --git a/models/_sector/nft/aggregators/_schema.yml b/nft/models/_sector/aggregators/_schema.yml similarity index 100% rename from models/_sector/nft/aggregators/_schema.yml rename to nft/models/_sector/aggregators/_schema.yml diff --git a/models/_sector/nft/aggregators/chains/_schema.yml b/nft/models/_sector/aggregators/chains/_schema.yml similarity index 100% rename from models/_sector/nft/aggregators/chains/_schema.yml rename to nft/models/_sector/aggregators/chains/_schema.yml diff --git a/models/_sector/nft/aggregators/chains/nft_arbitrum_aggregators.sql b/nft/models/_sector/aggregators/chains/nft_arbitrum_aggregators.sql similarity index 100% rename from models/_sector/nft/aggregators/chains/nft_arbitrum_aggregators.sql rename to nft/models/_sector/aggregators/chains/nft_arbitrum_aggregators.sql diff --git a/models/_sector/nft/aggregators/chains/nft_avalanche_c_aggregators.sql b/nft/models/_sector/aggregators/chains/nft_avalanche_c_aggregators.sql similarity index 100% rename from models/_sector/nft/aggregators/chains/nft_avalanche_c_aggregators.sql rename to nft/models/_sector/aggregators/chains/nft_avalanche_c_aggregators.sql diff --git a/models/_sector/nft/aggregators/chains/nft_bnb_aggregators.sql b/nft/models/_sector/aggregators/chains/nft_bnb_aggregators.sql similarity index 100% rename from models/_sector/nft/aggregators/chains/nft_bnb_aggregators.sql rename to nft/models/_sector/aggregators/chains/nft_bnb_aggregators.sql diff --git a/models/_sector/nft/aggregators/chains/nft_celo_aggregators.sql b/nft/models/_sector/aggregators/chains/nft_celo_aggregators.sql similarity index 100% rename from models/_sector/nft/aggregators/chains/nft_celo_aggregators.sql rename to nft/models/_sector/aggregators/chains/nft_celo_aggregators.sql diff --git a/models/_sector/nft/aggregators/chains/nft_ethereum_aggregators.sql b/nft/models/_sector/aggregators/chains/nft_ethereum_aggregators.sql similarity index 100% rename from models/_sector/nft/aggregators/chains/nft_ethereum_aggregators.sql rename to nft/models/_sector/aggregators/chains/nft_ethereum_aggregators.sql diff --git a/models/_sector/nft/aggregators/chains/nft_ethereum_aggregators_gem.sql b/nft/models/_sector/aggregators/chains/nft_ethereum_aggregators_gem.sql similarity index 100% rename from models/_sector/nft/aggregators/chains/nft_ethereum_aggregators_gem.sql rename to nft/models/_sector/aggregators/chains/nft_ethereum_aggregators_gem.sql diff --git a/models/_sector/nft/aggregators/chains/nft_ethereum_aggregators_manual.sql b/nft/models/_sector/aggregators/chains/nft_ethereum_aggregators_manual.sql similarity index 100% rename from models/_sector/nft/aggregators/chains/nft_ethereum_aggregators_manual.sql rename to nft/models/_sector/aggregators/chains/nft_ethereum_aggregators_manual.sql diff --git a/models/_sector/nft/aggregators/chains/nft_ethereum_aggregators_markers.sql b/nft/models/_sector/aggregators/chains/nft_ethereum_aggregators_markers.sql similarity index 100% rename from models/_sector/nft/aggregators/chains/nft_ethereum_aggregators_markers.sql rename to nft/models/_sector/aggregators/chains/nft_ethereum_aggregators_markers.sql diff --git a/models/_sector/nft/aggregators/chains/nft_optimism_aggregators.sql b/nft/models/_sector/aggregators/chains/nft_optimism_aggregators.sql similarity index 100% rename from models/_sector/nft/aggregators/chains/nft_optimism_aggregators.sql rename to nft/models/_sector/aggregators/chains/nft_optimism_aggregators.sql diff --git a/models/_sector/nft/aggregators/chains/nft_polygon_aggregators.sql b/nft/models/_sector/aggregators/chains/nft_polygon_aggregators.sql similarity index 100% rename from models/_sector/nft/aggregators/chains/nft_polygon_aggregators.sql rename to nft/models/_sector/aggregators/chains/nft_polygon_aggregators.sql diff --git a/models/_sector/nft/aggregators/nft_aggregators.sql b/nft/models/_sector/aggregators/nft_aggregators.sql similarity index 100% rename from models/_sector/nft/aggregators/nft_aggregators.sql rename to nft/models/_sector/aggregators/nft_aggregators.sql diff --git a/models/_sector/nft/approvals/_schema.yml b/nft/models/_sector/approvals/_schema.yml similarity index 100% rename from models/_sector/nft/approvals/_schema.yml rename to nft/models/_sector/approvals/_schema.yml diff --git a/models/_sector/nft/approvals/chains/_schema.yml b/nft/models/_sector/approvals/chains/_schema.yml similarity index 100% rename from models/_sector/nft/approvals/chains/_schema.yml rename to nft/models/_sector/approvals/chains/_schema.yml diff --git a/models/_sector/nft/approvals/chains/nft_arbitrum_approvals.sql b/nft/models/_sector/approvals/chains/nft_arbitrum_approvals.sql similarity index 100% rename from models/_sector/nft/approvals/chains/nft_arbitrum_approvals.sql rename to nft/models/_sector/approvals/chains/nft_arbitrum_approvals.sql diff --git a/models/_sector/nft/approvals/chains/nft_avalanche_c_approvals.sql b/nft/models/_sector/approvals/chains/nft_avalanche_c_approvals.sql similarity index 100% rename from models/_sector/nft/approvals/chains/nft_avalanche_c_approvals.sql rename to nft/models/_sector/approvals/chains/nft_avalanche_c_approvals.sql diff --git a/models/_sector/nft/approvals/chains/nft_base_approvals.sql b/nft/models/_sector/approvals/chains/nft_base_approvals.sql similarity index 100% rename from models/_sector/nft/approvals/chains/nft_base_approvals.sql rename to nft/models/_sector/approvals/chains/nft_base_approvals.sql diff --git a/models/_sector/nft/approvals/chains/nft_bnb_approvals.sql b/nft/models/_sector/approvals/chains/nft_bnb_approvals.sql similarity index 100% rename from models/_sector/nft/approvals/chains/nft_bnb_approvals.sql rename to nft/models/_sector/approvals/chains/nft_bnb_approvals.sql diff --git a/models/_sector/nft/approvals/chains/nft_celo_approvals.sql b/nft/models/_sector/approvals/chains/nft_celo_approvals.sql similarity index 100% rename from models/_sector/nft/approvals/chains/nft_celo_approvals.sql rename to nft/models/_sector/approvals/chains/nft_celo_approvals.sql diff --git a/models/_sector/nft/approvals/chains/nft_ethereum_approvals.sql b/nft/models/_sector/approvals/chains/nft_ethereum_approvals.sql similarity index 100% rename from models/_sector/nft/approvals/chains/nft_ethereum_approvals.sql rename to nft/models/_sector/approvals/chains/nft_ethereum_approvals.sql diff --git a/models/_sector/nft/approvals/chains/nft_fantom_approvals.sql b/nft/models/_sector/approvals/chains/nft_fantom_approvals.sql similarity index 100% rename from models/_sector/nft/approvals/chains/nft_fantom_approvals.sql rename to nft/models/_sector/approvals/chains/nft_fantom_approvals.sql diff --git a/models/_sector/nft/approvals/chains/nft_gnosis_approvals.sql b/nft/models/_sector/approvals/chains/nft_gnosis_approvals.sql similarity index 100% rename from models/_sector/nft/approvals/chains/nft_gnosis_approvals.sql rename to nft/models/_sector/approvals/chains/nft_gnosis_approvals.sql diff --git a/models/_sector/nft/approvals/chains/nft_goerli_approvals.sql b/nft/models/_sector/approvals/chains/nft_goerli_approvals.sql similarity index 100% rename from models/_sector/nft/approvals/chains/nft_goerli_approvals.sql rename to nft/models/_sector/approvals/chains/nft_goerli_approvals.sql diff --git a/models/_sector/nft/approvals/chains/nft_optimism_approvals.sql b/nft/models/_sector/approvals/chains/nft_optimism_approvals.sql similarity index 100% rename from models/_sector/nft/approvals/chains/nft_optimism_approvals.sql rename to nft/models/_sector/approvals/chains/nft_optimism_approvals.sql diff --git a/models/_sector/nft/approvals/chains/nft_polygon_approvals.sql b/nft/models/_sector/approvals/chains/nft_polygon_approvals.sql similarity index 100% rename from models/_sector/nft/approvals/chains/nft_polygon_approvals.sql rename to nft/models/_sector/approvals/chains/nft_polygon_approvals.sql diff --git a/models/_sector/nft/approvals/chains/nft_scroll_approvals.sql b/nft/models/_sector/approvals/chains/nft_scroll_approvals.sql similarity index 100% rename from models/_sector/nft/approvals/chains/nft_scroll_approvals.sql rename to nft/models/_sector/approvals/chains/nft_scroll_approvals.sql diff --git a/models/_sector/nft/approvals/chains/nft_zksync_approvals.sql b/nft/models/_sector/approvals/chains/nft_zksync_approvals.sql similarity index 100% rename from models/_sector/nft/approvals/chains/nft_zksync_approvals.sql rename to nft/models/_sector/approvals/chains/nft_zksync_approvals.sql diff --git a/models/_sector/nft/approvals/nft_approvals.sql b/nft/models/_sector/approvals/nft_approvals.sql similarity index 100% rename from models/_sector/nft/approvals/nft_approvals.sql rename to nft/models/_sector/approvals/nft_approvals.sql diff --git a/nft/models/_sector/lending/_schema.yml b/nft/models/_sector/lending/_schema.yml new file mode 100644 index 00000000000..30232b8f54b --- /dev/null +++ b/nft/models/_sector/lending/_schema.yml @@ -0,0 +1,22 @@ +version: 2 + +models: + - name: nft_lending + meta: + blockchain: ethereum + sector: nft + contributors: Henrystats + config: + tags: ['ethereum','nft', 'lending'] + description: > + nft lending events (repay & borrow) + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - block_date + - blockchain + - project + - version + - tx_hash + - evt_index + - lien_id diff --git a/models/astaria/ethereum/astaria_ethereum_schema.yml b/nft/models/_sector/lending/ethereum/_schema.yml similarity index 81% rename from models/astaria/ethereum/astaria_ethereum_schema.yml rename to nft/models/_sector/lending/ethereum/_schema.yml index 156cbb66013..78953851ed7 100644 --- a/models/astaria/ethereum/astaria_ethereum_schema.yml +++ b/nft/models/_sector/lending/ethereum/_schema.yml @@ -98,7 +98,7 @@ models: config: tags: ['ethereum','astaria','v1','lending'] description: > - Astaria collateral balances + Astaria collateral balances columns: - &day name: day @@ -204,4 +204,60 @@ models: description: "Address that received the transaction" - *evt_index - *lien_id - - *block_month \ No newline at end of file + - *block_month + + - name: bend_dao_ethereum_lending + meta: + blockchain: ethereum + project: bend_dao + contributors: [Henrystats] + config: + tags: ['ethereum','bend_dao','v1','lending'] + description: > + bend_dao lending (repay & borrow) on ethereum + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - block_date + - blockchain + - project + - version + - evt_type + - tx_hash + - evt_index + - check_seed: + seed_file: ref('bend_dao_nft_lending') + match_columns: + - block_number + - tx_hash + - token_id + check_columns: +# - amount_original + - evt_type + - borrower + columns: + - *blockchain + - *block_time + - *block_number + - *project + - *lending_category + - *block_date + - *block_month + - *token_id + - *collection + - *amount_usd + - *token_standard + - *evt_type + - *borrower + - *lender + - *amount_original + - *amount_raw + - *collateral_currency_symbol + - *collateral_currency_contract + - *nft_contract_address + - *project_contract_address + - *tx_hash + - *tx_from + - *tx_to + - *evt_index + - *lien_id diff --git a/models/astaria/ethereum/astaria_ethereum_daily_deposits.sql b/nft/models/_sector/lending/ethereum/astaria_ethereum_daily_deposits.sql similarity index 97% rename from models/astaria/ethereum/astaria_ethereum_daily_deposits.sql rename to nft/models/_sector/lending/ethereum/astaria_ethereum_daily_deposits.sql index de2e4405fb5..fd108f1ca15 100644 --- a/models/astaria/ethereum/astaria_ethereum_daily_deposits.sql +++ b/nft/models/_sector/lending/ethereum/astaria_ethereum_daily_deposits.sql @@ -1,5 +1,5 @@ {{ config( - + schema = 'astaria_ethereum', alias = 'daily_deposits' ) }} @@ -118,4 +118,4 @@ LEFT JOIN ON db.collateral_token_contract = nd.contract_address LEFT JOIN collateral_ids ci - ON db.collateral_token_id = ci.collateral_token_id AND db.collateral_token_contract = ci.collateral_token_contract \ No newline at end of file + ON db.collateral_token_id = ci.collateral_token_id AND db.collateral_token_contract = ci.collateral_token_contract diff --git a/models/astaria/ethereum/astaria_ethereum_events.sql b/nft/models/_sector/lending/ethereum/astaria_ethereum_events.sql similarity index 68% rename from models/astaria/ethereum/astaria_ethereum_events.sql rename to nft/models/_sector/lending/ethereum/astaria_ethereum_events.sql index be881550cc3..bc67fe484a6 100644 --- a/models/astaria/ethereum/astaria_ethereum_events.sql +++ b/nft/models/_sector/lending/ethereum/astaria_ethereum_events.sql @@ -1,15 +1,11 @@ {{ config( - + schema = 'astaria_ethereum', alias = 'events', partition_by = ['block_month'], materialized = 'incremental', file_format = 'delta', incremental_strategy = 'merge', - unique_key = ['block_date', 'blockchain', 'project', 'version', 'evt_type', 'evt_tx_hash', 'evt_index', 'lien_id'], - post_hook='{{ expose_spells(\'["ethereum"]\', - "project", - "astaria", - \'["Henrystats"]\') }}' + unique_key = ['block_date', 'blockchain', 'project', 'version', 'evt_type', 'evt_tx_hash', 'evt_index', 'lien_id'] ) }} @@ -19,7 +15,7 @@ WITH borrows_tmp as ( SELECT - *, + *, json_extract_scalar(JSON_PARSE(json_extract_scalar(stack, '$.lien')), '$.collateralType') AS lien_collateralType, from_hex(json_extract_scalar(JSON_PARSE(json_extract_scalar(stack, '$.lien')), '$.token')) AS lien_token, from_hex(json_extract_scalar(JSON_PARSE(json_extract_scalar(stack, '$.lien')), '$.vault')) AS lien_vault, @@ -39,31 +35,31 @@ borrows_tmp as ( {% if is_incremental() %} WHERE evt_block_time >= date_trunc('day', now() - interval '7' Day) {% endif %} -), +), borrows as ( - SELECT - 'borrow' as evt_type, - evt_tx_hash, - evt_block_number, - evt_index, - evt_block_time, + SELECT + 'borrow' as evt_type, + evt_tx_hash, + evt_block_number, + evt_index, + evt_block_time, et."from" as borrower, - lien_token, - er.symbol as lien_symbol, - lien_details_rate as lien_rate, - lien_details_duration as lien_duration, - CAST(point_amount as double)/1e18 as lien_amount, + lien_token, + er.symbol as lien_symbol, + lien_details_rate as lien_rate, + lien_details_duration as lien_duration, + CAST(point_amount as double)/1e18 as lien_amount, CAST(point_amount as double) as lien_amount_raw, - point_last as lien_start, - point_end as lien_end, - CAST(cl.output_lienId as VARCHAR) as lien_id, - CAST(lien_collateralId as VARCHAR) as lien_collateral_id, + point_last as lien_start, + point_end as lien_end, + CAST(cl.output_lienId as VARCHAR) as lien_id, + CAST(lien_collateralId as VARCHAR) as lien_collateral_id, b.contract_address - FROM - borrows_tmp b - INNER JOIN - {{ source('ethereum','transactions') }} et + FROM + borrows_tmp b + INNER JOIN + {{ source('ethereum','transactions') }} et ON b.evt_block_number = et.block_number AND b.evt_tx_hash = et.hash {% if not is_incremental() %} @@ -72,29 +68,29 @@ borrows as ( {% if is_incremental() %} AND et.block_time >= date_trunc('day', now() - interval '7' Day) {% endif %} - INNER JOIN - {{ source('astaria_v1_ethereum','LienToken_call_createLien') }} cl + INNER JOIN + {{ source('astaria_v1_ethereum','LienToken_call_createLien') }} cl ON b.evt_block_number = cl.call_block_number - AND b.evt_tx_hash = cl.call_tx_hash - AND cl.call_success = true + AND b.evt_tx_hash = cl.call_tx_hash + AND cl.call_success = true {% if is_incremental() %} AND cl.call_block_time >= date_trunc('day', now() - interval '7' Day) {% endif %} - INNER JOIN - {{ source('tokens_ethereum', 'erc20') }} er + INNER JOIN + {{ source('tokens_ethereum', 'erc20') }} er ON b.lien_token = er.contract_address -), +), borrows_join as ( - SELECT - evt_type, + SELECT + evt_type, evt_tx_hash, evt_block_number, evt_index, evt_block_time, borrower, lien_token, - lien_symbol, + lien_symbol, lien_rate, lien_duration, lien_amount, @@ -104,20 +100,20 @@ borrows_join as ( lien_id, lien_collateral_id, contract_address - FROM - borrows + FROM + borrows {% if is_incremental() %} - UNION + UNION - SELECT - evt_type, + SELECT + evt_type, evt_tx_hash, evt_block_number, evt_index, evt_block_time, borrower, lien_token, - lien_symbol, + lien_symbol, lien_rate, lien_duration, lien_amount, @@ -127,15 +123,15 @@ borrows_join as ( lien_id, lien_collateral_id, contract_address - FROM + FROM {{this}} {% endif %} -), +), repays_table as ( - SELECT - * - FROM + SELECT + * + FROM {{source('astaria_v1_ethereum', 'LienToken_evt_Payment')}} {% if is_incremental() %} WHERE evt_block_time >= date_trunc('day', now() - interval '7' Day) @@ -143,18 +139,18 @@ repays_table as ( ), repays_calls as ( - SELECT - * - FROM + SELECT + * + FROM {{source('astaria_v1_ethereum', 'LienToken_call_makePayment')}} - WHERE 1 = 1 - AND call_success = true -), + WHERE 1 = 1 + AND call_success = true +), liquidation_table as ( - SELECT - * - FROM + SELECT + * + FROM {{source('astaria_v1_ethereum', 'AstariaRouter_evt_Liquidation')}} {% if is_incremental() %} WHERE evt_block_time >= date_trunc('day', now() - interval '7' Day) @@ -162,84 +158,84 @@ liquidation_table as ( ), repays as ( - SELECT - 'repay' as evt_type, - r.evt_tx_hash, - r.evt_block_number, - r.evt_index, - r.evt_block_time, - b.borrower, - b.lien_token, - b.lien_symbol, - b.lien_rate, - b.lien_duration, - CAST(r.amount as double)/1e18 as lien_amount, + SELECT + 'repay' as evt_type, + r.evt_tx_hash, + r.evt_block_number, + r.evt_index, + r.evt_block_time, + b.borrower, + b.lien_token, + b.lien_symbol, + b.lien_rate, + b.lien_duration, + CAST(r.amount as double)/1e18 as lien_amount, CAST(r.amount as double) as lien_amount_raw, - b.lien_start, - b.lien_end, - CAST(r.lienId as VARCHAR) as lien_id, + b.lien_start, + b.lien_end, + CAST(r.lienId as VARCHAR) as lien_id, b.lien_collateral_id, r.contract_address - FROM - repays_table r - INNER JOIN - borrows_join b + FROM + repays_table r + INNER JOIN + borrows_join b ON b.evt_type = 'borrow' AND CAST(r.lienId as VARCHAR) = b.lien_id INNER JOIN ( - SELECT - MAX(b.evt_block_number) as borrow_block_number, + SELECT + MAX(b.evt_block_number) as borrow_block_number, r.evt_block_number, - CAST(r.lienId as VARCHAR) as lien_id - FROM - repays_table r - INNER JOIN - borrows_join b + CAST(r.lienId as VARCHAR) as lien_id + FROM + repays_table r + INNER JOIN + borrows_join b ON b.evt_type = 'borrow' AND CAST(r.lienId as VARCHAR) = b.lien_id AND r.evt_block_number >= b.evt_block_number WHERE r.evt_tx_hash IN (SELECT call_tx_hash FROM repays_calls ) - GROUP BY 2, 3 - ) a + GROUP BY 2, 3 + ) a ON CAST(r.lienId as VARCHAR) = a.lien_id AND b.evt_block_number = a.borrow_block_number AND r.evt_block_number = a.evt_block_number WHERE r.evt_tx_hash IN (SELECT call_tx_hash FROM repays_calls) -), +), liquidation as ( - SELECT - 'liquidation' as evt_type, + SELECT + 'liquidation' as evt_type, l.evt_tx_hash, l.evt_block_number, - l.evt_index, + l.evt_index, l.evt_block_time, - b.borrower, - b.lien_token, - b.lien_symbol, - b.lien_rate, - b.lien_duration, - b.lien_amount, + b.borrower, + b.lien_token, + b.lien_symbol, + b.lien_rate, + b.lien_duration, + b.lien_amount, b.lien_amount_raw, - b.lien_start, - b.lien_end, - CAST(l.lienId as VARCHAR) as lien_id, + b.lien_start, + b.lien_end, + CAST(l.lienId as VARCHAR) as lien_id, b.lien_collateral_id, l.contract_address - FROM - liquidation_table l - INNER JOIN - borrows_join b + FROM + liquidation_table l + INNER JOIN + borrows_join b ON CAST(l.lienId as VARCHAR) = b.lien_id AND b.evt_type = 'borrow' -), +), all_events as ( -SELECT * FROM borrows +SELECT * FROM borrows -UNION ALL +UNION ALL SELECT * FROM repays @@ -248,21 +244,21 @@ UNION ALL SELECT * FROM liquidation ) -SELECT - 'ethereum' as blockchain, +SELECT + 'ethereum' as blockchain, 'astaria' as project, - '0.5' as version, + '0.5' as version, CAST(date_trunc('DAY', ae.evt_block_time) AS date) as block_date, CAST(date_trunc('MONTH', ae.evt_block_time) AS date) as block_month, - ae.*, - d.nft_symbol, + ae.*, + d.nft_symbol, d.nft_token_standard, - d.collateral_token_contract as nft_contract_address, - CASE WHEN d.collateral_token_contract = 0x9ff70d528830e47154224dc5c185e4d052d0fb99 THEN 'Bad Trip' ELSE d.nft_collection END as nft_collection, - CAST(d.collateral_token_id as VARCHAR) as nft_token_id -FROM -all_events ae -INNER JOIN + d.collateral_token_contract as nft_contract_address, + CASE WHEN d.collateral_token_contract = 0x9ff70d528830e47154224dc5c185e4d052d0fb99 THEN 'Bad Trip' ELSE d.nft_collection END as nft_collection, + CAST(d.collateral_token_id as VARCHAR) as nft_token_id +FROM +all_events ae +INNER JOIN {{ ref('astaria_ethereum_daily_deposits') }} d ON ae.lien_collateral_id = CAST(d.collateral_id as VARCHAR) - AND CAST(date_trunc('DAY', ae.evt_block_time) AS date) = d.day \ No newline at end of file + AND CAST(date_trunc('DAY', ae.evt_block_time) AS date) = d.day diff --git a/models/astaria/ethereum/astaria_ethereum_lending.sql b/nft/models/_sector/lending/ethereum/astaria_ethereum_lending.sql similarity index 54% rename from models/astaria/ethereum/astaria_ethereum_lending.sql rename to nft/models/_sector/lending/ethereum/astaria_ethereum_lending.sql index 87eb5c06d05..65956364590 100644 --- a/models/astaria/ethereum/astaria_ethereum_lending.sql +++ b/nft/models/_sector/lending/ethereum/astaria_ethereum_lending.sql @@ -1,50 +1,46 @@ {{ config( - + schema = 'astaria_ethereum', alias = 'lending', partition_by = ['block_month'], materialized = 'incremental', file_format = 'delta', incremental_strategy = 'merge', - unique_key = ['block_date', 'blockchain', 'project', 'version', 'evt_type', 'tx_hash', 'evt_index', 'lien_id'], - post_hook='{{ expose_spells(\'["ethereum"]\', - "project", - "astaria", - \'["Henrystats"]\') }}' + unique_key = ['block_date', 'blockchain', 'project', 'version', 'evt_type', 'tx_hash', 'evt_index', 'lien_id'] ) }} {%- set project_start_date = '2023-08-25' %} -SELECT - ae.blockchain, - ae.project, - ae.version, +SELECT + ae.blockchain, + ae.project, + ae.version, 'Pool to Borrower' as lending_category, - ae.block_date, - ae.block_month, - ae.evt_block_time as block_time, - ae.evt_block_number as block_number, - ae.nft_token_id as token_id, - ae.nft_collection as collection, - ae.lien_amount * p.price as amount_usd, - ae.nft_token_standard as token_standard, - ae.evt_type, - ae.borrower, + ae.block_date, + ae.block_month, + ae.evt_block_time as block_time, + ae.evt_block_number as block_number, + ae.nft_token_id as token_id, + ae.nft_collection as collection, + ae.lien_amount * p.price as amount_usd, + ae.nft_token_standard as token_standard, + ae.evt_type, + ae.borrower, ae.contract_address as lender, - ae.lien_amount as amount_original, + ae.lien_amount as amount_original, ae.lien_amount_raw as amount_raw, ae.lien_symbol as collateral_currency_symbol, - ae.lien_token as collateral_currency_contract, - ae.nft_contract_address, - ae.contract_address as project_contract_address, - ae.evt_tx_hash as tx_hash, - et."from" as tx_from, - et."to" as tx_to, + ae.lien_token as collateral_currency_contract, + ae.nft_contract_address, + ae.contract_address as project_contract_address, + ae.evt_tx_hash as tx_hash, + et."from" as tx_from, + et."to" as tx_to, ae.lien_id, ae.evt_index -FROM -{{ ref('astaria_ethereum_events') }} ae -INNER JOIN +FROM +{{ ref('astaria_ethereum_events') }} ae +INNER JOIN {{ source('ethereum', 'transactions') }} et ON ae.evt_tx_hash = et.hash {% if not is_incremental() %} @@ -53,7 +49,7 @@ INNER JOIN {% if is_incremental() %} AND et.block_time >= date_trunc('day', now() - interval '7' Day) {% endif %} -LEFT JOIN +LEFT JOIN {{ source('prices', 'usd') }} p ON p.minute = date_trunc('minute', ae.evt_block_time) AND p.contract_address = ae.lien_token @@ -63,4 +59,4 @@ LEFT JOIN {% endif %} {% if is_incremental() %} AND p.minute >= date_trunc('day', now() - interval '7' Day) - {% endif %} \ No newline at end of file + {% endif %} diff --git a/models/bend_dao/ethereum/bend_dao_ethereum_lending.sql b/nft/models/_sector/lending/ethereum/bend_dao_ethereum_lending.sql similarity index 93% rename from models/bend_dao/ethereum/bend_dao_ethereum_lending.sql rename to nft/models/_sector/lending/ethereum/bend_dao_ethereum_lending.sql index cd6846343c1..f9231ac62db 100644 --- a/models/bend_dao/ethereum/bend_dao_ethereum_lending.sql +++ b/nft/models/_sector/lending/ethereum/bend_dao_ethereum_lending.sql @@ -5,11 +5,7 @@ materialized = 'incremental', file_format = 'delta', incremental_strategy = 'merge', - unique_key = ['block_date', 'blockchain', 'project', 'version', 'evt_type', 'tx_hash', 'evt_index'], - post_hook='{{ expose_spells(\'["ethereum"]\', - "project", - "bend_dao", - \'["Henrystats"]\') }}' + unique_key = ['block_date', 'blockchain', 'project', 'version', 'evt_type', 'tx_hash', 'evt_index'] ) }} @@ -122,4 +118,4 @@ LEFT JOIN {% endif %} {% if is_incremental() %} AND p.minute >= date_trunc('day', now() - interval '7' Day) - {% endif %} \ No newline at end of file + {% endif %} diff --git a/models/nft/nft_lending.sql b/nft/models/_sector/lending/nft_lending.sql similarity index 98% rename from models/nft/nft_lending.sql rename to nft/models/_sector/lending/nft_lending.sql index 3d0ff7bf186..148c176d812 100644 --- a/models/nft/nft_lending.sql +++ b/nft/models/_sector/lending/nft_lending.sql @@ -1,5 +1,5 @@ {{ config( - + schema = 'nft', alias = 'lending', partition_by = ['block_month'], materialized = 'incremental', @@ -57,4 +57,4 @@ FROM ( {% endif %} {% endfor %} -) \ No newline at end of file +) diff --git a/models/_sector/nft/mints/_schema.yml b/nft/models/_sector/mints/_schema.yml similarity index 100% rename from models/_sector/nft/mints/_schema.yml rename to nft/models/_sector/mints/_schema.yml diff --git a/models/_sector/nft/mints/native/_schema.yml b/nft/models/_sector/mints/native/_schema.yml similarity index 100% rename from models/_sector/nft/mints/native/_schema.yml rename to nft/models/_sector/mints/native/_schema.yml diff --git a/models/_sector/nft/mints/native/nft_base_native_mints.sql b/nft/models/_sector/mints/native/nft_base_native_mints.sql similarity index 100% rename from models/_sector/nft/mints/native/nft_base_native_mints.sql rename to nft/models/_sector/mints/native/nft_base_native_mints.sql diff --git a/models/_sector/nft/mints/native/nft_ethereum_native_mints.sql b/nft/models/_sector/mints/native/nft_ethereum_native_mints.sql similarity index 100% rename from models/_sector/nft/mints/native/nft_ethereum_native_mints.sql rename to nft/models/_sector/mints/native/nft_ethereum_native_mints.sql diff --git a/models/_sector/nft/mints/native/nft_optimism_native_mints.sql b/nft/models/_sector/mints/native/nft_optimism_native_mints.sql similarity index 100% rename from models/_sector/nft/mints/native/nft_optimism_native_mints.sql rename to nft/models/_sector/mints/native/nft_optimism_native_mints.sql diff --git a/models/_sector/nft/mints/native/nft_zksync_native_mints.sql b/nft/models/_sector/mints/native/nft_zksync_native_mints.sql similarity index 100% rename from models/_sector/nft/mints/native/nft_zksync_native_mints.sql rename to nft/models/_sector/mints/native/nft_zksync_native_mints.sql diff --git a/models/_sector/nft/mints/native/nft_zora_native_mints.sql b/nft/models/_sector/mints/native/nft_zora_native_mints.sql similarity index 100% rename from models/_sector/nft/mints/native/nft_zora_native_mints.sql rename to nft/models/_sector/mints/native/nft_zora_native_mints.sql diff --git a/models/_sector/nft/mints/nft_mints.sql b/nft/models/_sector/mints/nft_mints.sql similarity index 100% rename from models/_sector/nft/mints/nft_mints.sql rename to nft/models/_sector/mints/nft_mints.sql diff --git a/models/_sector/nft/mints/platforms/_schema.yml b/nft/models/_sector/mints/platforms/_schema.yml similarity index 100% rename from models/_sector/nft/mints/platforms/_schema.yml rename to nft/models/_sector/mints/platforms/_schema.yml diff --git a/models/_sector/nft/mints/platforms/zora_base_mints.sql b/nft/models/_sector/mints/platforms/zora_base_mints.sql similarity index 100% rename from models/_sector/nft/mints/platforms/zora_base_mints.sql rename to nft/models/_sector/mints/platforms/zora_base_mints.sql diff --git a/models/_sector/nft/mints/platforms/zora_ethereum_mints.sql b/nft/models/_sector/mints/platforms/zora_ethereum_mints.sql similarity index 100% rename from models/_sector/nft/mints/platforms/zora_ethereum_mints.sql rename to nft/models/_sector/mints/platforms/zora_ethereum_mints.sql diff --git a/models/_sector/nft/mints/platforms/zora_goerli_mints.sql b/nft/models/_sector/mints/platforms/zora_goerli_mints.sql similarity index 100% rename from models/_sector/nft/mints/platforms/zora_goerli_mints.sql rename to nft/models/_sector/mints/platforms/zora_goerli_mints.sql diff --git a/models/_sector/nft/mints/platforms/zora_mints.sql b/nft/models/_sector/mints/platforms/zora_mints.sql similarity index 100% rename from models/_sector/nft/mints/platforms/zora_mints.sql rename to nft/models/_sector/mints/platforms/zora_mints.sql diff --git a/models/_sector/nft/mints/platforms/zora_optimism_mints.sql b/nft/models/_sector/mints/platforms/zora_optimism_mints.sql similarity index 100% rename from models/_sector/nft/mints/platforms/zora_optimism_mints.sql rename to nft/models/_sector/mints/platforms/zora_optimism_mints.sql diff --git a/models/_sector/nft/mints/platforms/zora_zora_mints.sql b/nft/models/_sector/mints/platforms/zora_zora_mints.sql similarity index 94% rename from models/_sector/nft/mints/platforms/zora_zora_mints.sql rename to nft/models/_sector/mints/platforms/zora_zora_mints.sql index aa841748c18..5347f3a516d 100644 --- a/models/_sector/nft/mints/platforms/zora_zora_mints.sql +++ b/nft/models/_sector/mints/platforms/zora_zora_mints.sql @@ -47,7 +47,7 @@ INNER JOIN {{ source('zora', 'transactions')}} txs ON txs.block_number=nftt.bloc {% if is_incremental() %} AND {{incremental_predicate('txs.block_time')}} {% endif %} -INNER JOIN {{ ref('prices_usd_forward_fill') }} pu ON pu.blockchain='zora' +INNER JOIN {{ source('prices', 'usd_forward_fill') }} pu ON pu.blockchain='zora' AND pu.contract_address=0x4200000000000000000000000000000000000006 AND pu.minute=date_trunc('minute', nftt.block_time) {% if is_incremental() %} @@ -82,7 +82,7 @@ INNER JOIN {{ source('zora', 'transactions')}} txs ON txs.block_number=nftt.bloc {% if is_incremental() %} AND {{incremental_predicate('txs.block_time')}} {% endif %} -INNER JOIN {{ ref('prices_usd_forward_fill') }} pu ON pu.blockchain='zora' +INNER JOIN {{ source('prices', 'usd_forward_fill') }} pu ON pu.blockchain='zora' AND pu.contract_address=0x4200000000000000000000000000000000000006 AND pu.minute=date_trunc('minute', nftt.block_time) {% if is_incremental() %} @@ -91,4 +91,4 @@ INNER JOIN {{ ref('prices_usd_forward_fill') }} pu ON pu.blockchain='zora' WHERE nftt."from"=0x0000000000000000000000000000000000000000 {% if is_incremental() %} AND {{incremental_predicate('nftt.block_time')}} -{% endif %} \ No newline at end of file +{% endif %} diff --git a/models/_sector/nft/trades/MIGRATION.md b/nft/models/_sector/trades/MIGRATION.md similarity index 100% rename from models/_sector/nft/trades/MIGRATION.md rename to nft/models/_sector/trades/MIGRATION.md diff --git a/models/_sector/nft/trades/chains/_schema.yml b/nft/models/_sector/trades/chains/_schema.yml similarity index 100% rename from models/_sector/nft/trades/chains/_schema.yml rename to nft/models/_sector/trades/chains/_schema.yml diff --git a/models/_sector/nft/trades/chains/arbitrum/nft_arbitrum_base_trades.sql b/nft/models/_sector/trades/chains/arbitrum/nft_arbitrum_base_trades.sql similarity index 100% rename from models/_sector/nft/trades/chains/arbitrum/nft_arbitrum_base_trades.sql rename to nft/models/_sector/trades/chains/arbitrum/nft_arbitrum_base_trades.sql diff --git a/models/_sector/nft/trades/chains/arbitrum/platforms/_schema.yml b/nft/models/_sector/trades/chains/arbitrum/platforms/_schema.yml similarity index 100% rename from models/_sector/nft/trades/chains/arbitrum/platforms/_schema.yml rename to nft/models/_sector/trades/chains/arbitrum/platforms/_schema.yml diff --git a/models/_sector/nft/trades/chains/arbitrum/platforms/element_arbitrum_base_trades.sql b/nft/models/_sector/trades/chains/arbitrum/platforms/element_arbitrum_base_trades.sql similarity index 100% rename from models/_sector/nft/trades/chains/arbitrum/platforms/element_arbitrum_base_trades.sql rename to nft/models/_sector/trades/chains/arbitrum/platforms/element_arbitrum_base_trades.sql diff --git a/models/_sector/nft/trades/chains/arbitrum/platforms/opensea_v3_arbitrum_base_trades.sql b/nft/models/_sector/trades/chains/arbitrum/platforms/opensea_v3_arbitrum_base_trades.sql similarity index 100% rename from models/_sector/nft/trades/chains/arbitrum/platforms/opensea_v3_arbitrum_base_trades.sql rename to nft/models/_sector/trades/chains/arbitrum/platforms/opensea_v3_arbitrum_base_trades.sql diff --git a/models/_sector/nft/trades/chains/arbitrum/platforms/opensea_v4_arbitrum_base_trades.sql b/nft/models/_sector/trades/chains/arbitrum/platforms/opensea_v4_arbitrum_base_trades.sql similarity index 100% rename from models/_sector/nft/trades/chains/arbitrum/platforms/opensea_v4_arbitrum_base_trades.sql rename to nft/models/_sector/trades/chains/arbitrum/platforms/opensea_v4_arbitrum_base_trades.sql diff --git a/models/_sector/nft/trades/chains/arbitrum/platforms/stealcam_arbitrum_base_trades.sql b/nft/models/_sector/trades/chains/arbitrum/platforms/stealcam_arbitrum_base_trades.sql similarity index 100% rename from models/_sector/nft/trades/chains/arbitrum/platforms/stealcam_arbitrum_base_trades.sql rename to nft/models/_sector/trades/chains/arbitrum/platforms/stealcam_arbitrum_base_trades.sql diff --git a/models/_sector/nft/trades/chains/arbitrum/platforms/sudoswap_v2_arbitrum__pools.sql b/nft/models/_sector/trades/chains/arbitrum/platforms/sudoswap_v2_arbitrum__pools.sql similarity index 100% rename from models/_sector/nft/trades/chains/arbitrum/platforms/sudoswap_v2_arbitrum__pools.sql rename to nft/models/_sector/trades/chains/arbitrum/platforms/sudoswap_v2_arbitrum__pools.sql diff --git a/models/_sector/nft/trades/chains/arbitrum/platforms/sudoswap_v2_arbitrum_base_trades.sql b/nft/models/_sector/trades/chains/arbitrum/platforms/sudoswap_v2_arbitrum_base_trades.sql similarity index 100% rename from models/_sector/nft/trades/chains/arbitrum/platforms/sudoswap_v2_arbitrum_base_trades.sql rename to nft/models/_sector/trades/chains/arbitrum/platforms/sudoswap_v2_arbitrum_base_trades.sql diff --git a/models/_sector/nft/trades/chains/arbitrum/platforms/tofu_arbitrum_base_trades.sql b/nft/models/_sector/trades/chains/arbitrum/platforms/tofu_arbitrum_base_trades.sql similarity index 100% rename from models/_sector/nft/trades/chains/arbitrum/platforms/tofu_arbitrum_base_trades.sql rename to nft/models/_sector/trades/chains/arbitrum/platforms/tofu_arbitrum_base_trades.sql diff --git a/models/_sector/nft/trades/chains/arbitrum/platforms/trove_v1_arbitrum_base_trades.sql b/nft/models/_sector/trades/chains/arbitrum/platforms/trove_v1_arbitrum_base_trades.sql similarity index 100% rename from models/_sector/nft/trades/chains/arbitrum/platforms/trove_v1_arbitrum_base_trades.sql rename to nft/models/_sector/trades/chains/arbitrum/platforms/trove_v1_arbitrum_base_trades.sql diff --git a/models/_sector/nft/trades/chains/arbitrum/platforms/trove_v2_arbitrum_base_trades.sql b/nft/models/_sector/trades/chains/arbitrum/platforms/trove_v2_arbitrum_base_trades.sql similarity index 100% rename from models/_sector/nft/trades/chains/arbitrum/platforms/trove_v2_arbitrum_base_trades.sql rename to nft/models/_sector/trades/chains/arbitrum/platforms/trove_v2_arbitrum_base_trades.sql diff --git a/models/_sector/nft/trades/chains/arbitrum/platforms/zonic_arbitrum_base_trades.sql b/nft/models/_sector/trades/chains/arbitrum/platforms/zonic_arbitrum_base_trades.sql similarity index 100% rename from models/_sector/nft/trades/chains/arbitrum/platforms/zonic_arbitrum_base_trades.sql rename to nft/models/_sector/trades/chains/arbitrum/platforms/zonic_arbitrum_base_trades.sql diff --git a/models/_sector/nft/trades/chains/avalanche_c/nft_avalanche_c_base_trades.sql b/nft/models/_sector/trades/chains/avalanche_c/nft_avalanche_c_base_trades.sql similarity index 100% rename from models/_sector/nft/trades/chains/avalanche_c/nft_avalanche_c_base_trades.sql rename to nft/models/_sector/trades/chains/avalanche_c/nft_avalanche_c_base_trades.sql diff --git a/models/_sector/nft/trades/chains/avalanche_c/platforms/_schema.yml b/nft/models/_sector/trades/chains/avalanche_c/platforms/_schema.yml similarity index 100% rename from models/_sector/nft/trades/chains/avalanche_c/platforms/_schema.yml rename to nft/models/_sector/trades/chains/avalanche_c/platforms/_schema.yml diff --git a/models/_sector/nft/trades/chains/avalanche_c/platforms/campfire_avalanche_c_base_trades.sql b/nft/models/_sector/trades/chains/avalanche_c/platforms/campfire_avalanche_c_base_trades.sql similarity index 100% rename from models/_sector/nft/trades/chains/avalanche_c/platforms/campfire_avalanche_c_base_trades.sql rename to nft/models/_sector/trades/chains/avalanche_c/platforms/campfire_avalanche_c_base_trades.sql diff --git a/models/_sector/nft/trades/chains/avalanche_c/platforms/chikn_avalanche_c_base_trades.sql b/nft/models/_sector/trades/chains/avalanche_c/platforms/chikn_avalanche_c_base_trades.sql similarity index 100% rename from models/_sector/nft/trades/chains/avalanche_c/platforms/chikn_avalanche_c_base_trades.sql rename to nft/models/_sector/trades/chains/avalanche_c/platforms/chikn_avalanche_c_base_trades.sql diff --git a/models/_sector/nft/trades/chains/avalanche_c/platforms/element_avalanche_c_base_trades.sql b/nft/models/_sector/trades/chains/avalanche_c/platforms/element_avalanche_c_base_trades.sql similarity index 100% rename from models/_sector/nft/trades/chains/avalanche_c/platforms/element_avalanche_c_base_trades.sql rename to nft/models/_sector/trades/chains/avalanche_c/platforms/element_avalanche_c_base_trades.sql diff --git a/models/_sector/nft/trades/chains/avalanche_c/platforms/hyperspace_avalanche_c_base_trades.sql b/nft/models/_sector/trades/chains/avalanche_c/platforms/hyperspace_avalanche_c_base_trades.sql similarity index 100% rename from models/_sector/nft/trades/chains/avalanche_c/platforms/hyperspace_avalanche_c_base_trades.sql rename to nft/models/_sector/trades/chains/avalanche_c/platforms/hyperspace_avalanche_c_base_trades.sql diff --git a/models/_sector/nft/trades/chains/avalanche_c/platforms/joepegs_avalanche_c_base_trades.sql b/nft/models/_sector/trades/chains/avalanche_c/platforms/joepegs_avalanche_c_base_trades.sql similarity index 100% rename from models/_sector/nft/trades/chains/avalanche_c/platforms/joepegs_avalanche_c_base_trades.sql rename to nft/models/_sector/trades/chains/avalanche_c/platforms/joepegs_avalanche_c_base_trades.sql diff --git a/models/_sector/nft/trades/chains/avalanche_c/platforms/opensea_v3_avalanche_c_base_trades.sql b/nft/models/_sector/trades/chains/avalanche_c/platforms/opensea_v3_avalanche_c_base_trades.sql similarity index 100% rename from models/_sector/nft/trades/chains/avalanche_c/platforms/opensea_v3_avalanche_c_base_trades.sql rename to nft/models/_sector/trades/chains/avalanche_c/platforms/opensea_v3_avalanche_c_base_trades.sql diff --git a/models/_sector/nft/trades/chains/avalanche_c/platforms/opensea_v4_avalanche_c_base_trades.sql b/nft/models/_sector/trades/chains/avalanche_c/platforms/opensea_v4_avalanche_c_base_trades.sql similarity index 100% rename from models/_sector/nft/trades/chains/avalanche_c/platforms/opensea_v4_avalanche_c_base_trades.sql rename to nft/models/_sector/trades/chains/avalanche_c/platforms/opensea_v4_avalanche_c_base_trades.sql diff --git a/models/_sector/nft/trades/chains/base/nft_base_base_trades.sql b/nft/models/_sector/trades/chains/base/nft_base_base_trades.sql similarity index 100% rename from models/_sector/nft/trades/chains/base/nft_base_base_trades.sql rename to nft/models/_sector/trades/chains/base/nft_base_base_trades.sql diff --git a/models/_sector/nft/trades/chains/base/platforms/_schema.yml b/nft/models/_sector/trades/chains/base/platforms/_schema.yml similarity index 100% rename from models/_sector/nft/trades/chains/base/platforms/_schema.yml rename to nft/models/_sector/trades/chains/base/platforms/_schema.yml diff --git a/models/_sector/nft/trades/chains/base/platforms/alienswap_base_base_trades.sql b/nft/models/_sector/trades/chains/base/platforms/alienswap_base_base_trades.sql similarity index 100% rename from models/_sector/nft/trades/chains/base/platforms/alienswap_base_base_trades.sql rename to nft/models/_sector/trades/chains/base/platforms/alienswap_base_base_trades.sql diff --git a/models/_sector/nft/trades/chains/base/platforms/element_base_base_trades.sql b/nft/models/_sector/trades/chains/base/platforms/element_base_base_trades.sql similarity index 100% rename from models/_sector/nft/trades/chains/base/platforms/element_base_base_trades.sql rename to nft/models/_sector/trades/chains/base/platforms/element_base_base_trades.sql diff --git a/models/_sector/nft/trades/chains/base/platforms/magiceden_base_base_trades.sql b/nft/models/_sector/trades/chains/base/platforms/magiceden_base_base_trades.sql similarity index 99% rename from models/_sector/nft/trades/chains/base/platforms/magiceden_base_base_trades.sql rename to nft/models/_sector/trades/chains/base/platforms/magiceden_base_base_trades.sql index 2a2e35e39c1..7f6bec8363f 100644 --- a/models/_sector/nft/trades/chains/base/platforms/magiceden_base_base_trades.sql +++ b/nft/models/_sector/trades/chains/base/platforms/magiceden_base_base_trades.sql @@ -141,7 +141,7 @@ WITH trades AS ( , MAX_BY(tr.to, tr.amount_raw) FILTER (WHERE to != 0xca9337244b5f04cb946391bc8b8a980e988f9a6a) AS royalty_fee_address , SUM(tr.amount_raw) FILTER (WHERE to = 0xca9337244b5f04cb946391bc8b8a980e988f9a6a) AS platform_fee_amount_raw , SUM(tr.amount_raw) FILTER (WHERE to != 0xca9337244b5f04cb946391bc8b8a980e988f9a6a) AS royalty_fee_amount_raw - FROM {{ ref('tokens_base_base_transfers') }} tr + FROM {{ source('tokens_base','base_transfers') }} tr INNER JOIN bundled_whitelisted_trades wt ON tr.block_number=wt.block_number AND tr.tx_hash=wt.tx_hash AND tr.amount_raw > 0 diff --git a/models/_sector/nft/trades/chains/base/platforms/opensea_v4_base_base_trades.sql b/nft/models/_sector/trades/chains/base/platforms/opensea_v4_base_base_trades.sql similarity index 100% rename from models/_sector/nft/trades/chains/base/platforms/opensea_v4_base_base_trades.sql rename to nft/models/_sector/trades/chains/base/platforms/opensea_v4_base_base_trades.sql diff --git a/models/_sector/nft/trades/chains/base/platforms/sudoswap_v2_base__pools.sql b/nft/models/_sector/trades/chains/base/platforms/sudoswap_v2_base__pools.sql similarity index 100% rename from models/_sector/nft/trades/chains/base/platforms/sudoswap_v2_base__pools.sql rename to nft/models/_sector/trades/chains/base/platforms/sudoswap_v2_base__pools.sql diff --git a/models/_sector/nft/trades/chains/base/platforms/sudoswap_v2_base_base_trades.sql b/nft/models/_sector/trades/chains/base/platforms/sudoswap_v2_base_base_trades.sql similarity index 100% rename from models/_sector/nft/trades/chains/base/platforms/sudoswap_v2_base_base_trades.sql rename to nft/models/_sector/trades/chains/base/platforms/sudoswap_v2_base_base_trades.sql diff --git a/models/_sector/nft/trades/chains/base/platforms/zonic_base_base_trades.sql b/nft/models/_sector/trades/chains/base/platforms/zonic_base_base_trades.sql similarity index 100% rename from models/_sector/nft/trades/chains/base/platforms/zonic_base_base_trades.sql rename to nft/models/_sector/trades/chains/base/platforms/zonic_base_base_trades.sql diff --git a/models/_sector/nft/trades/chains/blast/nft_blast_base_trades.sql b/nft/models/_sector/trades/chains/blast/nft_blast_base_trades.sql similarity index 100% rename from models/_sector/nft/trades/chains/blast/nft_blast_base_trades.sql rename to nft/models/_sector/trades/chains/blast/nft_blast_base_trades.sql diff --git a/models/_sector/nft/trades/chains/blast/platforms/_schema.yml b/nft/models/_sector/trades/chains/blast/platforms/_schema.yml similarity index 100% rename from models/_sector/nft/trades/chains/blast/platforms/_schema.yml rename to nft/models/_sector/trades/chains/blast/platforms/_schema.yml diff --git a/models/_sector/nft/trades/chains/blast/platforms/blur_blast_base_trades.sql b/nft/models/_sector/trades/chains/blast/platforms/blur_blast_base_trades.sql similarity index 100% rename from models/_sector/nft/trades/chains/blast/platforms/blur_blast_base_trades.sql rename to nft/models/_sector/trades/chains/blast/platforms/blur_blast_base_trades.sql diff --git a/models/_sector/nft/trades/chains/blast/platforms/fantasy_blast_base_trades.sql b/nft/models/_sector/trades/chains/blast/platforms/fantasy_blast_base_trades.sql similarity index 100% rename from models/_sector/nft/trades/chains/blast/platforms/fantasy_blast_base_trades.sql rename to nft/models/_sector/trades/chains/blast/platforms/fantasy_blast_base_trades.sql diff --git a/models/_sector/nft/trades/chains/bnb/nft_bnb_base_trades.sql b/nft/models/_sector/trades/chains/bnb/nft_bnb_base_trades.sql similarity index 100% rename from models/_sector/nft/trades/chains/bnb/nft_bnb_base_trades.sql rename to nft/models/_sector/trades/chains/bnb/nft_bnb_base_trades.sql diff --git a/models/_sector/nft/trades/chains/bnb/platforms/_schema.yml b/nft/models/_sector/trades/chains/bnb/platforms/_schema.yml similarity index 100% rename from models/_sector/nft/trades/chains/bnb/platforms/_schema.yml rename to nft/models/_sector/trades/chains/bnb/platforms/_schema.yml diff --git a/models/_sector/nft/trades/chains/bnb/platforms/element_bnb_base_trades.sql b/nft/models/_sector/trades/chains/bnb/platforms/element_bnb_base_trades.sql similarity index 100% rename from models/_sector/nft/trades/chains/bnb/platforms/element_bnb_base_trades.sql rename to nft/models/_sector/trades/chains/bnb/platforms/element_bnb_base_trades.sql diff --git a/models/_sector/nft/trades/chains/bnb/platforms/liquidifty_bnb_base_trades.sql b/nft/models/_sector/trades/chains/bnb/platforms/liquidifty_bnb_base_trades.sql similarity index 100% rename from models/_sector/nft/trades/chains/bnb/platforms/liquidifty_bnb_base_trades.sql rename to nft/models/_sector/trades/chains/bnb/platforms/liquidifty_bnb_base_trades.sql diff --git a/models/_sector/nft/trades/chains/bnb/platforms/nftb_bnb_base_trades.sql b/nft/models/_sector/trades/chains/bnb/platforms/nftb_bnb_base_trades.sql similarity index 100% rename from models/_sector/nft/trades/chains/bnb/platforms/nftb_bnb_base_trades.sql rename to nft/models/_sector/trades/chains/bnb/platforms/nftb_bnb_base_trades.sql diff --git a/models/_sector/nft/trades/chains/bnb/platforms/nftrade_bnb_base_trades.sql b/nft/models/_sector/trades/chains/bnb/platforms/nftrade_bnb_base_trades.sql similarity index 100% rename from models/_sector/nft/trades/chains/bnb/platforms/nftrade_bnb_base_trades.sql rename to nft/models/_sector/trades/chains/bnb/platforms/nftrade_bnb_base_trades.sql diff --git a/models/_sector/nft/trades/chains/bnb/platforms/pancakeswap_nft_bnb_base_trades.sql b/nft/models/_sector/trades/chains/bnb/platforms/pancakeswap_nft_bnb_base_trades.sql similarity index 100% rename from models/_sector/nft/trades/chains/bnb/platforms/pancakeswap_nft_bnb_base_trades.sql rename to nft/models/_sector/trades/chains/bnb/platforms/pancakeswap_nft_bnb_base_trades.sql diff --git a/models/_sector/nft/trades/chains/bnb/platforms/tofu_bnb_base_trades.sql b/nft/models/_sector/trades/chains/bnb/platforms/tofu_bnb_base_trades.sql similarity index 100% rename from models/_sector/nft/trades/chains/bnb/platforms/tofu_bnb_base_trades.sql rename to nft/models/_sector/trades/chains/bnb/platforms/tofu_bnb_base_trades.sql diff --git a/models/_sector/nft/trades/chains/celo/nft_celo_base_trades.sql b/nft/models/_sector/trades/chains/celo/nft_celo_base_trades.sql similarity index 100% rename from models/_sector/nft/trades/chains/celo/nft_celo_base_trades.sql rename to nft/models/_sector/trades/chains/celo/nft_celo_base_trades.sql diff --git a/models/_sector/nft/trades/chains/celo/platforms/_schema.yml b/nft/models/_sector/trades/chains/celo/platforms/_schema.yml similarity index 100% rename from models/_sector/nft/trades/chains/celo/platforms/_schema.yml rename to nft/models/_sector/trades/chains/celo/platforms/_schema.yml diff --git a/models/_sector/nft/trades/chains/celo/platforms/tofu_celo_base_trades.sql b/nft/models/_sector/trades/chains/celo/platforms/tofu_celo_base_trades.sql similarity index 100% rename from models/_sector/nft/trades/chains/celo/platforms/tofu_celo_base_trades.sql rename to nft/models/_sector/trades/chains/celo/platforms/tofu_celo_base_trades.sql diff --git a/models/_sector/nft/trades/chains/ethereum/nft_ethereum_base_trades.sql b/nft/models/_sector/trades/chains/ethereum/nft_ethereum_base_trades.sql similarity index 100% rename from models/_sector/nft/trades/chains/ethereum/nft_ethereum_base_trades.sql rename to nft/models/_sector/trades/chains/ethereum/nft_ethereum_base_trades.sql diff --git a/models/_sector/nft/trades/chains/ethereum/platforms/_schema.yml b/nft/models/_sector/trades/chains/ethereum/platforms/_schema.yml similarity index 100% rename from models/_sector/nft/trades/chains/ethereum/platforms/_schema.yml rename to nft/models/_sector/trades/chains/ethereum/platforms/_schema.yml diff --git a/models/_sector/nft/trades/chains/ethereum/platforms/archipelago_ethereum_base_trades.sql b/nft/models/_sector/trades/chains/ethereum/platforms/archipelago_ethereum_base_trades.sql similarity index 100% rename from models/_sector/nft/trades/chains/ethereum/platforms/archipelago_ethereum_base_trades.sql rename to nft/models/_sector/trades/chains/ethereum/platforms/archipelago_ethereum_base_trades.sql diff --git a/models/_sector/nft/trades/chains/ethereum/platforms/blur_ethereum_base_trades.sql b/nft/models/_sector/trades/chains/ethereum/platforms/blur_ethereum_base_trades.sql similarity index 100% rename from models/_sector/nft/trades/chains/ethereum/platforms/blur_ethereum_base_trades.sql rename to nft/models/_sector/trades/chains/ethereum/platforms/blur_ethereum_base_trades.sql diff --git a/models/_sector/nft/trades/chains/ethereum/platforms/blur_seaport_ethereum_base_trades.sql b/nft/models/_sector/trades/chains/ethereum/platforms/blur_seaport_ethereum_base_trades.sql similarity index 100% rename from models/_sector/nft/trades/chains/ethereum/platforms/blur_seaport_ethereum_base_trades.sql rename to nft/models/_sector/trades/chains/ethereum/platforms/blur_seaport_ethereum_base_trades.sql diff --git a/models/_sector/nft/trades/chains/ethereum/platforms/blur_v2_ethereum_base_trades.sql b/nft/models/_sector/trades/chains/ethereum/platforms/blur_v2_ethereum_base_trades.sql similarity index 100% rename from models/_sector/nft/trades/chains/ethereum/platforms/blur_v2_ethereum_base_trades.sql rename to nft/models/_sector/trades/chains/ethereum/platforms/blur_v2_ethereum_base_trades.sql diff --git a/models/_sector/nft/trades/chains/ethereum/platforms/collectionswap_ethereum__pools.sql b/nft/models/_sector/trades/chains/ethereum/platforms/collectionswap_ethereum__pools.sql similarity index 100% rename from models/_sector/nft/trades/chains/ethereum/platforms/collectionswap_ethereum__pools.sql rename to nft/models/_sector/trades/chains/ethereum/platforms/collectionswap_ethereum__pools.sql diff --git a/models/_sector/nft/trades/chains/ethereum/platforms/collectionswap_ethereum_base_trades.sql b/nft/models/_sector/trades/chains/ethereum/platforms/collectionswap_ethereum_base_trades.sql similarity index 100% rename from models/_sector/nft/trades/chains/ethereum/platforms/collectionswap_ethereum_base_trades.sql rename to nft/models/_sector/trades/chains/ethereum/platforms/collectionswap_ethereum_base_trades.sql diff --git a/models/_sector/nft/trades/chains/ethereum/platforms/cryptopunks_ethereum_base_trades.sql b/nft/models/_sector/trades/chains/ethereum/platforms/cryptopunks_ethereum_base_trades.sql similarity index 100% rename from models/_sector/nft/trades/chains/ethereum/platforms/cryptopunks_ethereum_base_trades.sql rename to nft/models/_sector/trades/chains/ethereum/platforms/cryptopunks_ethereum_base_trades.sql diff --git a/models/_sector/nft/trades/chains/ethereum/platforms/element_ethereum_base_trades.sql b/nft/models/_sector/trades/chains/ethereum/platforms/element_ethereum_base_trades.sql similarity index 100% rename from models/_sector/nft/trades/chains/ethereum/platforms/element_ethereum_base_trades.sql rename to nft/models/_sector/trades/chains/ethereum/platforms/element_ethereum_base_trades.sql diff --git a/models/_sector/nft/trades/chains/ethereum/platforms/foundation_ethereum_base_trades.sql b/nft/models/_sector/trades/chains/ethereum/platforms/foundation_ethereum_base_trades.sql similarity index 100% rename from models/_sector/nft/trades/chains/ethereum/platforms/foundation_ethereum_base_trades.sql rename to nft/models/_sector/trades/chains/ethereum/platforms/foundation_ethereum_base_trades.sql diff --git a/models/_sector/nft/trades/chains/ethereum/platforms/liquidifty_ethereum_base_trades.sql b/nft/models/_sector/trades/chains/ethereum/platforms/liquidifty_ethereum_base_trades.sql similarity index 100% rename from models/_sector/nft/trades/chains/ethereum/platforms/liquidifty_ethereum_base_trades.sql rename to nft/models/_sector/trades/chains/ethereum/platforms/liquidifty_ethereum_base_trades.sql diff --git a/models/_sector/nft/trades/chains/ethereum/platforms/looksrare_seaport_ethereum_base_trades.sql b/nft/models/_sector/trades/chains/ethereum/platforms/looksrare_seaport_ethereum_base_trades.sql similarity index 100% rename from models/_sector/nft/trades/chains/ethereum/platforms/looksrare_seaport_ethereum_base_trades.sql rename to nft/models/_sector/trades/chains/ethereum/platforms/looksrare_seaport_ethereum_base_trades.sql diff --git a/models/_sector/nft/trades/chains/ethereum/platforms/looksrare_v1_ethereum_base_trades.sql b/nft/models/_sector/trades/chains/ethereum/platforms/looksrare_v1_ethereum_base_trades.sql similarity index 100% rename from models/_sector/nft/trades/chains/ethereum/platforms/looksrare_v1_ethereum_base_trades.sql rename to nft/models/_sector/trades/chains/ethereum/platforms/looksrare_v1_ethereum_base_trades.sql diff --git a/models/_sector/nft/trades/chains/ethereum/platforms/looksrare_v2_ethereum_base_trades.sql b/nft/models/_sector/trades/chains/ethereum/platforms/looksrare_v2_ethereum_base_trades.sql similarity index 100% rename from models/_sector/nft/trades/chains/ethereum/platforms/looksrare_v2_ethereum_base_trades.sql rename to nft/models/_sector/trades/chains/ethereum/platforms/looksrare_v2_ethereum_base_trades.sql diff --git a/models/_sector/nft/trades/chains/ethereum/platforms/magiceden_ethereum_base_trades.sql b/nft/models/_sector/trades/chains/ethereum/platforms/magiceden_ethereum_base_trades.sql similarity index 100% rename from models/_sector/nft/trades/chains/ethereum/platforms/magiceden_ethereum_base_trades.sql rename to nft/models/_sector/trades/chains/ethereum/platforms/magiceden_ethereum_base_trades.sql diff --git a/models/_sector/nft/trades/chains/ethereum/platforms/opensea_v1_ethereum_base_trades.sql b/nft/models/_sector/trades/chains/ethereum/platforms/opensea_v1_ethereum_base_trades.sql similarity index 100% rename from models/_sector/nft/trades/chains/ethereum/platforms/opensea_v1_ethereum_base_trades.sql rename to nft/models/_sector/trades/chains/ethereum/platforms/opensea_v1_ethereum_base_trades.sql diff --git a/models/_sector/nft/trades/chains/ethereum/platforms/opensea_v3_ethereum_base_trades.sql b/nft/models/_sector/trades/chains/ethereum/platforms/opensea_v3_ethereum_base_trades.sql similarity index 100% rename from models/_sector/nft/trades/chains/ethereum/platforms/opensea_v3_ethereum_base_trades.sql rename to nft/models/_sector/trades/chains/ethereum/platforms/opensea_v3_ethereum_base_trades.sql diff --git a/models/_sector/nft/trades/chains/ethereum/platforms/opensea_v4_ethereum_base_trades.sql b/nft/models/_sector/trades/chains/ethereum/platforms/opensea_v4_ethereum_base_trades.sql similarity index 100% rename from models/_sector/nft/trades/chains/ethereum/platforms/opensea_v4_ethereum_base_trades.sql rename to nft/models/_sector/trades/chains/ethereum/platforms/opensea_v4_ethereum_base_trades.sql diff --git a/models/_sector/nft/trades/chains/ethereum/platforms/sudoswap_ethereum_base_trades.sql b/nft/models/_sector/trades/chains/ethereum/platforms/sudoswap_ethereum_base_trades.sql similarity index 100% rename from models/_sector/nft/trades/chains/ethereum/platforms/sudoswap_ethereum_base_trades.sql rename to nft/models/_sector/trades/chains/ethereum/platforms/sudoswap_ethereum_base_trades.sql diff --git a/models/_sector/nft/trades/chains/ethereum/platforms/sudoswap_v2_ethereum__pools.sql b/nft/models/_sector/trades/chains/ethereum/platforms/sudoswap_v2_ethereum__pools.sql similarity index 100% rename from models/_sector/nft/trades/chains/ethereum/platforms/sudoswap_v2_ethereum__pools.sql rename to nft/models/_sector/trades/chains/ethereum/platforms/sudoswap_v2_ethereum__pools.sql diff --git a/models/_sector/nft/trades/chains/ethereum/platforms/sudoswap_v2_ethereum_base_trades.sql b/nft/models/_sector/trades/chains/ethereum/platforms/sudoswap_v2_ethereum_base_trades.sql similarity index 100% rename from models/_sector/nft/trades/chains/ethereum/platforms/sudoswap_v2_ethereum_base_trades.sql rename to nft/models/_sector/trades/chains/ethereum/platforms/sudoswap_v2_ethereum_base_trades.sql diff --git a/models/_sector/nft/trades/chains/ethereum/platforms/superrare_ethereum_base_trades.sql b/nft/models/_sector/trades/chains/ethereum/platforms/superrare_ethereum_base_trades.sql similarity index 100% rename from models/_sector/nft/trades/chains/ethereum/platforms/superrare_ethereum_base_trades.sql rename to nft/models/_sector/trades/chains/ethereum/platforms/superrare_ethereum_base_trades.sql diff --git a/models/_sector/nft/trades/chains/ethereum/platforms/trove_ethereum_base_trades.sql b/nft/models/_sector/trades/chains/ethereum/platforms/trove_ethereum_base_trades.sql similarity index 100% rename from models/_sector/nft/trades/chains/ethereum/platforms/trove_ethereum_base_trades.sql rename to nft/models/_sector/trades/chains/ethereum/platforms/trove_ethereum_base_trades.sql diff --git a/models/_sector/nft/trades/chains/ethereum/platforms/x2y2_ethereum_base_trades.sql b/nft/models/_sector/trades/chains/ethereum/platforms/x2y2_ethereum_base_trades.sql similarity index 100% rename from models/_sector/nft/trades/chains/ethereum/platforms/x2y2_ethereum_base_trades.sql rename to nft/models/_sector/trades/chains/ethereum/platforms/x2y2_ethereum_base_trades.sql diff --git a/models/_sector/nft/trades/chains/ethereum/platforms/zora_v1_ethereum_base_trades.sql b/nft/models/_sector/trades/chains/ethereum/platforms/zora_v1_ethereum_base_trades.sql similarity index 100% rename from models/_sector/nft/trades/chains/ethereum/platforms/zora_v1_ethereum_base_trades.sql rename to nft/models/_sector/trades/chains/ethereum/platforms/zora_v1_ethereum_base_trades.sql diff --git a/models/_sector/nft/trades/chains/ethereum/platforms/zora_v2_ethereum_base_trades.sql b/nft/models/_sector/trades/chains/ethereum/platforms/zora_v2_ethereum_base_trades.sql similarity index 100% rename from models/_sector/nft/trades/chains/ethereum/platforms/zora_v2_ethereum_base_trades.sql rename to nft/models/_sector/trades/chains/ethereum/platforms/zora_v2_ethereum_base_trades.sql diff --git a/models/_sector/nft/trades/chains/ethereum/platforms/zora_v3_ethereum_base_trades.sql b/nft/models/_sector/trades/chains/ethereum/platforms/zora_v3_ethereum_base_trades.sql similarity index 100% rename from models/_sector/nft/trades/chains/ethereum/platforms/zora_v3_ethereum_base_trades.sql rename to nft/models/_sector/trades/chains/ethereum/platforms/zora_v3_ethereum_base_trades.sql diff --git a/models/_sector/nft/trades/chains/linea/nft_linea_base_trades.sql b/nft/models/_sector/trades/chains/linea/nft_linea_base_trades.sql similarity index 100% rename from models/_sector/nft/trades/chains/linea/nft_linea_base_trades.sql rename to nft/models/_sector/trades/chains/linea/nft_linea_base_trades.sql diff --git a/models/_sector/nft/trades/chains/linea/platforms/_schema.yml b/nft/models/_sector/trades/chains/linea/platforms/_schema.yml similarity index 100% rename from models/_sector/nft/trades/chains/linea/platforms/_schema.yml rename to nft/models/_sector/trades/chains/linea/platforms/_schema.yml diff --git a/models/_sector/nft/trades/chains/linea/platforms/element_linea_base_trades.sql b/nft/models/_sector/trades/chains/linea/platforms/element_linea_base_trades.sql similarity index 100% rename from models/_sector/nft/trades/chains/linea/platforms/element_linea_base_trades.sql rename to nft/models/_sector/trades/chains/linea/platforms/element_linea_base_trades.sql diff --git a/models/_sector/nft/trades/chains/old/nft_old_base_trades.sql b/nft/models/_sector/trades/chains/old/nft_old_base_trades.sql similarity index 100% rename from models/_sector/nft/trades/chains/old/nft_old_base_trades.sql rename to nft/models/_sector/trades/chains/old/nft_old_base_trades.sql diff --git a/models/_sector/nft/trades/chains/old/platforms/_schema.yml b/nft/models/_sector/trades/chains/old/platforms/_schema.yml similarity index 100% rename from models/_sector/nft/trades/chains/old/platforms/_schema.yml rename to nft/models/_sector/trades/chains/old/platforms/_schema.yml diff --git a/models/_sector/nft/trades/chains/old/platforms/mooar_polygon_events.sql b/nft/models/_sector/trades/chains/old/platforms/mooar_polygon_events.sql similarity index 100% rename from models/_sector/nft/trades/chains/old/platforms/mooar_polygon_events.sql rename to nft/models/_sector/trades/chains/old/platforms/mooar_polygon_events.sql diff --git a/models/_sector/nft/trades/chains/old/platforms/nftearth_optimism_events.sql b/nft/models/_sector/trades/chains/old/platforms/nftearth_optimism_events.sql similarity index 100% rename from models/_sector/nft/trades/chains/old/platforms/nftearth_optimism_events.sql rename to nft/models/_sector/trades/chains/old/platforms/nftearth_optimism_events.sql diff --git a/models/_sector/nft/trades/chains/old/platforms/oneplanet_polygon_events.sql b/nft/models/_sector/trades/chains/old/platforms/oneplanet_polygon_events.sql similarity index 100% rename from models/_sector/nft/trades/chains/old/platforms/oneplanet_polygon_events.sql rename to nft/models/_sector/trades/chains/old/platforms/oneplanet_polygon_events.sql diff --git a/models/_sector/nft/trades/chains/old/platforms/quix_optimism_schema.yml b/nft/models/_sector/trades/chains/old/platforms/quix_optimism_schema.yml similarity index 100% rename from models/_sector/nft/trades/chains/old/platforms/quix_optimism_schema.yml rename to nft/models/_sector/trades/chains/old/platforms/quix_optimism_schema.yml diff --git a/models/_sector/nft/trades/chains/old/platforms/quix_seaport_optimism_events.sql b/nft/models/_sector/trades/chains/old/platforms/quix_seaport_optimism_events.sql similarity index 100% rename from models/_sector/nft/trades/chains/old/platforms/quix_seaport_optimism_events.sql rename to nft/models/_sector/trades/chains/old/platforms/quix_seaport_optimism_events.sql diff --git a/models/_sector/nft/trades/chains/optimism/nft_optimism_base_trades.sql b/nft/models/_sector/trades/chains/optimism/nft_optimism_base_trades.sql similarity index 100% rename from models/_sector/nft/trades/chains/optimism/nft_optimism_base_trades.sql rename to nft/models/_sector/trades/chains/optimism/nft_optimism_base_trades.sql diff --git a/models/_sector/nft/trades/chains/optimism/platforms/_schema.yml b/nft/models/_sector/trades/chains/optimism/platforms/_schema.yml similarity index 100% rename from models/_sector/nft/trades/chains/optimism/platforms/_schema.yml rename to nft/models/_sector/trades/chains/optimism/platforms/_schema.yml diff --git a/models/_sector/nft/trades/chains/optimism/platforms/element_optimism_base_trades.sql b/nft/models/_sector/trades/chains/optimism/platforms/element_optimism_base_trades.sql similarity index 100% rename from models/_sector/nft/trades/chains/optimism/platforms/element_optimism_base_trades.sql rename to nft/models/_sector/trades/chains/optimism/platforms/element_optimism_base_trades.sql diff --git a/models/_sector/nft/trades/chains/optimism/platforms/opensea_v3_optimism_base_trades.sql b/nft/models/_sector/trades/chains/optimism/platforms/opensea_v3_optimism_base_trades.sql similarity index 100% rename from models/_sector/nft/trades/chains/optimism/platforms/opensea_v3_optimism_base_trades.sql rename to nft/models/_sector/trades/chains/optimism/platforms/opensea_v3_optimism_base_trades.sql diff --git a/models/_sector/nft/trades/chains/optimism/platforms/opensea_v4_optimism_base_trades.sql b/nft/models/_sector/trades/chains/optimism/platforms/opensea_v4_optimism_base_trades.sql similarity index 100% rename from models/_sector/nft/trades/chains/optimism/platforms/opensea_v4_optimism_base_trades.sql rename to nft/models/_sector/trades/chains/optimism/platforms/opensea_v4_optimism_base_trades.sql diff --git a/models/_sector/nft/trades/chains/optimism/platforms/quix_v1_optimism_base_trades.sql b/nft/models/_sector/trades/chains/optimism/platforms/quix_v1_optimism_base_trades.sql similarity index 98% rename from models/_sector/nft/trades/chains/optimism/platforms/quix_v1_optimism_base_trades.sql rename to nft/models/_sector/trades/chains/optimism/platforms/quix_v1_optimism_base_trades.sql index 62d1aa1fe10..f2861b5780a 100644 --- a/models/_sector/nft/trades/chains/optimism/platforms/quix_v1_optimism_base_trades.sql +++ b/nft/models/_sector/trades/chains/optimism/platforms/quix_v1_optimism_base_trades.sql @@ -39,7 +39,7 @@ with events_raw as ( ,tr.amount_raw as value ,tr.to from events_raw as er - join {{ ref('tokens_optimism_base_transfers') }} as tr + join {{ source('tokens_optimism','base_transfers') }} as tr on er.tx_hash = tr.tx_hash and er.block_number = tr.block_number and tr.amount_raw > 0 diff --git a/models/_sector/nft/trades/chains/optimism/platforms/quix_v2_optimism_base_trades.sql b/nft/models/_sector/trades/chains/optimism/platforms/quix_v2_optimism_base_trades.sql similarity index 98% rename from models/_sector/nft/trades/chains/optimism/platforms/quix_v2_optimism_base_trades.sql rename to nft/models/_sector/trades/chains/optimism/platforms/quix_v2_optimism_base_trades.sql index 40f5bf45a29..7dc128e4bd0 100644 --- a/models/_sector/nft/trades/chains/optimism/platforms/quix_v2_optimism_base_trades.sql +++ b/nft/models/_sector/trades/chains/optimism/platforms/quix_v2_optimism_base_trades.sql @@ -79,7 +79,7 @@ with events_raw as ( ,cast(tr.amount_raw as uint256) as value ,tr.to from events_raw as er - join {{ ref('tokens_optimism_base_transfers') }} as tr + join {{ source('tokens_optimism','base_transfers') }} as tr on er.tx_hash = tr.tx_hash and er.block_number = tr.block_number and tr.amount_raw > 0 diff --git a/models/_sector/nft/trades/chains/optimism/platforms/quix_v3_optimism_base_trades.sql b/nft/models/_sector/trades/chains/optimism/platforms/quix_v3_optimism_base_trades.sql similarity index 98% rename from models/_sector/nft/trades/chains/optimism/platforms/quix_v3_optimism_base_trades.sql rename to nft/models/_sector/trades/chains/optimism/platforms/quix_v3_optimism_base_trades.sql index 44a38dc53b5..f1a6108dde8 100644 --- a/models/_sector/nft/trades/chains/optimism/platforms/quix_v3_optimism_base_trades.sql +++ b/nft/models/_sector/trades/chains/optimism/platforms/quix_v3_optimism_base_trades.sql @@ -79,7 +79,7 @@ with events_raw as ( ,cast(tr.amount_raw as uint256) as value ,tr.to from events_raw as er - join {{ ref('tokens_optimism_base_transfers') }} as tr + join {{ source('tokens_optimism','base_transfers') }} as tr on er.tx_hash = tr.tx_hash and er.block_number = tr.block_number and tr.amount_raw > 0 diff --git a/models/_sector/nft/trades/chains/optimism/platforms/quix_v4_optimism_base_trades.sql b/nft/models/_sector/trades/chains/optimism/platforms/quix_v4_optimism_base_trades.sql similarity index 98% rename from models/_sector/nft/trades/chains/optimism/platforms/quix_v4_optimism_base_trades.sql rename to nft/models/_sector/trades/chains/optimism/platforms/quix_v4_optimism_base_trades.sql index ea24e52ae13..73eace83804 100644 --- a/models/_sector/nft/trades/chains/optimism/platforms/quix_v4_optimism_base_trades.sql +++ b/nft/models/_sector/trades/chains/optimism/platforms/quix_v4_optimism_base_trades.sql @@ -81,7 +81,7 @@ with events_raw as ( ,er.evt_index ,er.evt_index - coalesce(tr.trace_address[1], 0) as ranking from events_raw as er - join {{ ref('tokens_optimism_base_transfers') }} as tr + join {{ source('tokens_optimism','base_transfers') }} as tr on er.tx_hash = tr.tx_hash and er.block_number = tr.block_number and tr.amount_raw > 0 diff --git a/models/_sector/nft/trades/chains/optimism/platforms/quix_v5_optimism_base_trades.sql b/nft/models/_sector/trades/chains/optimism/platforms/quix_v5_optimism_base_trades.sql similarity index 98% rename from models/_sector/nft/trades/chains/optimism/platforms/quix_v5_optimism_base_trades.sql rename to nft/models/_sector/trades/chains/optimism/platforms/quix_v5_optimism_base_trades.sql index 724135ba0ba..905ed19f5cd 100644 --- a/models/_sector/nft/trades/chains/optimism/platforms/quix_v5_optimism_base_trades.sql +++ b/nft/models/_sector/trades/chains/optimism/platforms/quix_v5_optimism_base_trades.sql @@ -41,7 +41,7 @@ with events_raw as ( ,er.evt_index ,er.evt_index - coalesce(tr.trace_address[1], 0) as ranking from events_raw as er - join {{ ref('tokens_optimism_base_transfers') }} as tr + join {{ source('tokens_optimism','base_transfers') }} as tr on er.tx_hash = tr.tx_hash and er.block_number = tr.block_number and tr.amount_raw > 0 diff --git a/models/_sector/nft/trades/chains/optimism/platforms/tofu_optimism_base_trades.sql b/nft/models/_sector/trades/chains/optimism/platforms/tofu_optimism_base_trades.sql similarity index 100% rename from models/_sector/nft/trades/chains/optimism/platforms/tofu_optimism_base_trades.sql rename to nft/models/_sector/trades/chains/optimism/platforms/tofu_optimism_base_trades.sql diff --git a/models/_sector/nft/trades/chains/optimism/platforms/zonic_optimism_base_trades.sql b/nft/models/_sector/trades/chains/optimism/platforms/zonic_optimism_base_trades.sql similarity index 100% rename from models/_sector/nft/trades/chains/optimism/platforms/zonic_optimism_base_trades.sql rename to nft/models/_sector/trades/chains/optimism/platforms/zonic_optimism_base_trades.sql diff --git a/models/_sector/nft/trades/chains/polygon/nft_polygon_base_trades.sql b/nft/models/_sector/trades/chains/polygon/nft_polygon_base_trades.sql similarity index 100% rename from models/_sector/nft/trades/chains/polygon/nft_polygon_base_trades.sql rename to nft/models/_sector/trades/chains/polygon/nft_polygon_base_trades.sql diff --git a/models/_sector/nft/trades/chains/polygon/platforms/_schema.yml b/nft/models/_sector/trades/chains/polygon/platforms/_schema.yml similarity index 100% rename from models/_sector/nft/trades/chains/polygon/platforms/_schema.yml rename to nft/models/_sector/trades/chains/polygon/platforms/_schema.yml diff --git a/models/_sector/nft/trades/chains/polygon/platforms/aavegotchi_polygon_base_trades.sql b/nft/models/_sector/trades/chains/polygon/platforms/aavegotchi_polygon_base_trades.sql similarity index 100% rename from models/_sector/nft/trades/chains/polygon/platforms/aavegotchi_polygon_base_trades.sql rename to nft/models/_sector/trades/chains/polygon/platforms/aavegotchi_polygon_base_trades.sql diff --git a/models/_sector/nft/trades/chains/polygon/platforms/aurem_polygon_base_trades.sql b/nft/models/_sector/trades/chains/polygon/platforms/aurem_polygon_base_trades.sql similarity index 100% rename from models/_sector/nft/trades/chains/polygon/platforms/aurem_polygon_base_trades.sql rename to nft/models/_sector/trades/chains/polygon/platforms/aurem_polygon_base_trades.sql diff --git a/models/_sector/nft/trades/chains/polygon/platforms/decentraland_polygon_base_trades.sql b/nft/models/_sector/trades/chains/polygon/platforms/decentraland_polygon_base_trades.sql similarity index 100% rename from models/_sector/nft/trades/chains/polygon/platforms/decentraland_polygon_base_trades.sql rename to nft/models/_sector/trades/chains/polygon/platforms/decentraland_polygon_base_trades.sql diff --git a/models/_sector/nft/trades/chains/polygon/platforms/dew_polygon_base_trades.sql b/nft/models/_sector/trades/chains/polygon/platforms/dew_polygon_base_trades.sql similarity index 100% rename from models/_sector/nft/trades/chains/polygon/platforms/dew_polygon_base_trades.sql rename to nft/models/_sector/trades/chains/polygon/platforms/dew_polygon_base_trades.sql diff --git a/models/_sector/nft/trades/chains/polygon/platforms/element_polygon_base_trades.sql b/nft/models/_sector/trades/chains/polygon/platforms/element_polygon_base_trades.sql similarity index 100% rename from models/_sector/nft/trades/chains/polygon/platforms/element_polygon_base_trades.sql rename to nft/models/_sector/trades/chains/polygon/platforms/element_polygon_base_trades.sql diff --git a/models/_sector/nft/trades/chains/polygon/platforms/fractal_polygon_base_trades.sql b/nft/models/_sector/trades/chains/polygon/platforms/fractal_polygon_base_trades.sql similarity index 100% rename from models/_sector/nft/trades/chains/polygon/platforms/fractal_polygon_base_trades.sql rename to nft/models/_sector/trades/chains/polygon/platforms/fractal_polygon_base_trades.sql diff --git a/models/_sector/nft/trades/chains/polygon/platforms/magiceden_polygon_base_trades.sql b/nft/models/_sector/trades/chains/polygon/platforms/magiceden_polygon_base_trades.sql similarity index 100% rename from models/_sector/nft/trades/chains/polygon/platforms/magiceden_polygon_base_trades.sql rename to nft/models/_sector/trades/chains/polygon/platforms/magiceden_polygon_base_trades.sql diff --git a/models/_sector/nft/trades/chains/polygon/platforms/magiceden_v2_polygon_base_trades.sql b/nft/models/_sector/trades/chains/polygon/platforms/magiceden_v2_polygon_base_trades.sql similarity index 100% rename from models/_sector/nft/trades/chains/polygon/platforms/magiceden_v2_polygon_base_trades.sql rename to nft/models/_sector/trades/chains/polygon/platforms/magiceden_v2_polygon_base_trades.sql diff --git a/models/_sector/nft/trades/chains/polygon/platforms/opensea_v2_polygon_base_trades.sql b/nft/models/_sector/trades/chains/polygon/platforms/opensea_v2_polygon_base_trades.sql similarity index 100% rename from models/_sector/nft/trades/chains/polygon/platforms/opensea_v2_polygon_base_trades.sql rename to nft/models/_sector/trades/chains/polygon/platforms/opensea_v2_polygon_base_trades.sql diff --git a/models/_sector/nft/trades/chains/polygon/platforms/opensea_v3_polygon_base_trades.sql b/nft/models/_sector/trades/chains/polygon/platforms/opensea_v3_polygon_base_trades.sql similarity index 100% rename from models/_sector/nft/trades/chains/polygon/platforms/opensea_v3_polygon_base_trades.sql rename to nft/models/_sector/trades/chains/polygon/platforms/opensea_v3_polygon_base_trades.sql diff --git a/models/_sector/nft/trades/chains/polygon/platforms/opensea_v4_polygon_base_trades.sql b/nft/models/_sector/trades/chains/polygon/platforms/opensea_v4_polygon_base_trades.sql similarity index 100% rename from models/_sector/nft/trades/chains/polygon/platforms/opensea_v4_polygon_base_trades.sql rename to nft/models/_sector/trades/chains/polygon/platforms/opensea_v4_polygon_base_trades.sql diff --git a/models/_sector/nft/trades/chains/polygon/platforms/rarible_polygon_base_trades.sql b/nft/models/_sector/trades/chains/polygon/platforms/rarible_polygon_base_trades.sql similarity index 100% rename from models/_sector/nft/trades/chains/polygon/platforms/rarible_polygon_base_trades.sql rename to nft/models/_sector/trades/chains/polygon/platforms/rarible_polygon_base_trades.sql diff --git a/models/_sector/nft/trades/chains/polygon/platforms/tofu_polygon_base_trades.sql b/nft/models/_sector/trades/chains/polygon/platforms/tofu_polygon_base_trades.sql similarity index 100% rename from models/_sector/nft/trades/chains/polygon/platforms/tofu_polygon_base_trades.sql rename to nft/models/_sector/trades/chains/polygon/platforms/tofu_polygon_base_trades.sql diff --git a/models/_sector/nft/trades/chains/scroll/nft_scroll_base_trades.sql b/nft/models/_sector/trades/chains/scroll/nft_scroll_base_trades.sql similarity index 100% rename from models/_sector/nft/trades/chains/scroll/nft_scroll_base_trades.sql rename to nft/models/_sector/trades/chains/scroll/nft_scroll_base_trades.sql diff --git a/models/_sector/nft/trades/chains/scroll/platforms/_schema.yml b/nft/models/_sector/trades/chains/scroll/platforms/_schema.yml similarity index 100% rename from models/_sector/nft/trades/chains/scroll/platforms/_schema.yml rename to nft/models/_sector/trades/chains/scroll/platforms/_schema.yml diff --git a/models/_sector/nft/trades/chains/scroll/platforms/element_scroll_base_trades.sql b/nft/models/_sector/trades/chains/scroll/platforms/element_scroll_base_trades.sql similarity index 100% rename from models/_sector/nft/trades/chains/scroll/platforms/element_scroll_base_trades.sql rename to nft/models/_sector/trades/chains/scroll/platforms/element_scroll_base_trades.sql diff --git a/models/_sector/nft/trades/chains/scroll/platforms/zonic_scroll_base_trades.sql b/nft/models/_sector/trades/chains/scroll/platforms/zonic_scroll_base_trades.sql similarity index 100% rename from models/_sector/nft/trades/chains/scroll/platforms/zonic_scroll_base_trades.sql rename to nft/models/_sector/trades/chains/scroll/platforms/zonic_scroll_base_trades.sql diff --git a/models/_sector/nft/trades/chains/solana/nft_solana_base_trades.sql b/nft/models/_sector/trades/chains/solana/nft_solana_base_trades.sql similarity index 100% rename from models/_sector/nft/trades/chains/solana/nft_solana_base_trades.sql rename to nft/models/_sector/trades/chains/solana/nft_solana_base_trades.sql diff --git a/models/_sector/nft/trades/chains/solana/nft_solana_old_trades.sql b/nft/models/_sector/trades/chains/solana/nft_solana_old_trades.sql similarity index 100% rename from models/_sector/nft/trades/chains/solana/nft_solana_old_trades.sql rename to nft/models/_sector/trades/chains/solana/nft_solana_old_trades.sql diff --git a/models/_sector/nft/trades/chains/solana/nft_solana_trades.sql b/nft/models/_sector/trades/chains/solana/nft_solana_trades.sql similarity index 100% rename from models/_sector/nft/trades/chains/solana/nft_solana_trades.sql rename to nft/models/_sector/trades/chains/solana/nft_solana_trades.sql diff --git a/models/_sector/nft/trades/chains/solana/nft_solana_trades_schema.yml b/nft/models/_sector/trades/chains/solana/nft_solana_trades_schema.yml similarity index 100% rename from models/_sector/nft/trades/chains/solana/nft_solana_trades_schema.yml rename to nft/models/_sector/trades/chains/solana/nft_solana_trades_schema.yml diff --git a/models/_sector/nft/trades/chains/solana/old/_schema.yml b/nft/models/_sector/trades/chains/solana/old/_schema.yml similarity index 100% rename from models/_sector/nft/trades/chains/solana/old/_schema.yml rename to nft/models/_sector/trades/chains/solana/old/_schema.yml diff --git a/models/_sector/nft/trades/chains/solana/old/magiceden_solana_events.sql b/nft/models/_sector/trades/chains/solana/old/magiceden_solana_events.sql similarity index 100% rename from models/_sector/nft/trades/chains/solana/old/magiceden_solana_events.sql rename to nft/models/_sector/trades/chains/solana/old/magiceden_solana_events.sql diff --git a/models/_sector/nft/trades/chains/solana/old/opensea_solana_events.sql b/nft/models/_sector/trades/chains/solana/old/opensea_solana_events.sql similarity index 100% rename from models/_sector/nft/trades/chains/solana/old/opensea_solana_events.sql rename to nft/models/_sector/trades/chains/solana/old/opensea_solana_events.sql diff --git a/models/_sector/nft/trades/chains/solana/platforms/_schema.yml b/nft/models/_sector/trades/chains/solana/platforms/_schema.yml similarity index 100% rename from models/_sector/nft/trades/chains/solana/platforms/_schema.yml rename to nft/models/_sector/trades/chains/solana/platforms/_schema.yml diff --git a/models/_sector/nft/trades/chains/solana/platforms/magiceden_mmm_solana_trades.sql b/nft/models/_sector/trades/chains/solana/platforms/magiceden_mmm_solana_trades.sql similarity index 99% rename from models/_sector/nft/trades/chains/solana/platforms/magiceden_mmm_solana_trades.sql rename to nft/models/_sector/trades/chains/solana/platforms/magiceden_mmm_solana_trades.sql index e57e8f006c7..de4fb53369b 100644 --- a/models/_sector/nft/trades/chains/solana/platforms/magiceden_mmm_solana_trades.sql +++ b/nft/models/_sector/trades/chains/solana/platforms/magiceden_mmm_solana_trades.sql @@ -1,7 +1,7 @@ {{ config( schema = 'magiceden_mmm_solana' - + , alias = 'trades' ,materialized = 'incremental' ,file_format = 'delta' @@ -146,7 +146,7 @@ with symbol, to_base58(contract_address) as token_mint_address from - {{ ref('prices_usd_latest') }} p + {{ source('prices', 'usd_latest') }} p where p.blockchain = 'solana' {% if is_incremental() %} @@ -513,7 +513,7 @@ with coalesce(t.inner_instruction_index, 0) as inner_instruction_index from trades t - left join {{ source('prices', 'usd') }} p ON p.blockchain = 'solana' + left join {{ source('prices', 'usd') }} p ON p.blockchain = 'solana' and to_base58(p.contract_address) = t.trade_token_mint and p.minute = date_trunc('minute', t.call_block_time) {% if is_incremental() %} diff --git a/models/_sector/nft/trades/chains/solana/platforms/magiceden_v2_solana_trades.sql b/nft/models/_sector/trades/chains/solana/platforms/magiceden_v2_solana_trades.sql similarity index 99% rename from models/_sector/nft/trades/chains/solana/platforms/magiceden_v2_solana_trades.sql rename to nft/models/_sector/trades/chains/solana/platforms/magiceden_v2_solana_trades.sql index 14e0faa122c..1284f92e7c2 100644 --- a/models/_sector/nft/trades/chains/solana/platforms/magiceden_v2_solana_trades.sql +++ b/nft/models/_sector/trades/chains/solana/platforms/magiceden_v2_solana_trades.sql @@ -1,7 +1,7 @@ {{ config( schema = 'magiceden_v2_solana' - + , alias = 'trades' ,materialized = 'incremental' ,file_format = 'delta' @@ -74,7 +74,7 @@ with SELECT symbol , to_base58(contract_address) as token_mint_address - FROM {{ ref('prices_usd_latest') }} p + FROM {{ source('prices', 'usd_latest') }} p WHERE p.blockchain = 'solana' {% if is_incremental() %} AND {{incremental_predicate('minute')}} @@ -84,7 +84,7 @@ with , trades as ( SELECT case when account_buyer = call_tx_signer then 'buy' else 'sell' end as trade_category - , case + , case when contains(trade.call_account_arguments, '3dgCCb15HMQSA4Pn3Tfii5vRk7aRqTH95LJjxzsG2Mug') then 'HXD' when pt.token_mint_address is not null then pt.symbol else 'SOL' @@ -260,8 +260,8 @@ with , t.outer_instruction_index , coalesce(t.inner_instruction_index,0) as inner_instruction_index FROM trades t - LEFT JOIN {{ source('prices', 'usd') }} p ON p.blockchain = 'solana' - and to_base58(p.contract_address) = t.trade_token_mint + LEFT JOIN {{ source('prices', 'usd') }} p ON p.blockchain = 'solana' + and to_base58(p.contract_address) = t.trade_token_mint and p.minute = date_trunc('minute', t.call_block_time) {% if is_incremental() %} and {{incremental_predicate('p.minute')}} diff --git a/models/_sector/nft/trades/chains/solana/platforms/magiceden_v3_solana_trades.sql b/nft/models/_sector/trades/chains/solana/platforms/magiceden_v3_solana_trades.sql similarity index 100% rename from models/_sector/nft/trades/chains/solana/platforms/magiceden_v3_solana_trades.sql rename to nft/models/_sector/trades/chains/solana/platforms/magiceden_v3_solana_trades.sql diff --git a/models/_sector/nft/trades/chains/solana/platforms/tensorswap_v1_solana_trades.sql b/nft/models/_sector/trades/chains/solana/platforms/tensorswap_v1_solana_trades.sql similarity index 100% rename from models/_sector/nft/trades/chains/solana/platforms/tensorswap_v1_solana_trades.sql rename to nft/models/_sector/trades/chains/solana/platforms/tensorswap_v1_solana_trades.sql diff --git a/models/_sector/nft/trades/chains/solana/platforms/tensorswap_v2_solana_trades.sql b/nft/models/_sector/trades/chains/solana/platforms/tensorswap_v2_solana_trades.sql similarity index 100% rename from models/_sector/nft/trades/chains/solana/platforms/tensorswap_v2_solana_trades.sql rename to nft/models/_sector/trades/chains/solana/platforms/tensorswap_v2_solana_trades.sql diff --git a/models/_sector/nft/trades/chains/zksync/nft_zksync_base_trades.sql b/nft/models/_sector/trades/chains/zksync/nft_zksync_base_trades.sql similarity index 100% rename from models/_sector/nft/trades/chains/zksync/nft_zksync_base_trades.sql rename to nft/models/_sector/trades/chains/zksync/nft_zksync_base_trades.sql diff --git a/models/_sector/nft/trades/chains/zksync/platforms/_schema.yml b/nft/models/_sector/trades/chains/zksync/platforms/_schema.yml similarity index 100% rename from models/_sector/nft/trades/chains/zksync/platforms/_schema.yml rename to nft/models/_sector/trades/chains/zksync/platforms/_schema.yml diff --git a/models/_sector/nft/trades/chains/zksync/platforms/element_zksync_base_trades.sql b/nft/models/_sector/trades/chains/zksync/platforms/element_zksync_base_trades.sql similarity index 100% rename from models/_sector/nft/trades/chains/zksync/platforms/element_zksync_base_trades.sql rename to nft/models/_sector/trades/chains/zksync/platforms/element_zksync_base_trades.sql diff --git a/models/_sector/nft/trades/chains/zksync/platforms/kreatorland_zksync_base_trades.sql b/nft/models/_sector/trades/chains/zksync/platforms/kreatorland_zksync_base_trades.sql similarity index 100% rename from models/_sector/nft/trades/chains/zksync/platforms/kreatorland_zksync_base_trades.sql rename to nft/models/_sector/trades/chains/zksync/platforms/kreatorland_zksync_base_trades.sql diff --git a/models/_sector/nft/trades/chains/zksync/platforms/mint_square_zksync_base_trades.sql b/nft/models/_sector/trades/chains/zksync/platforms/mint_square_zksync_base_trades.sql similarity index 100% rename from models/_sector/nft/trades/chains/zksync/platforms/mint_square_zksync_base_trades.sql rename to nft/models/_sector/trades/chains/zksync/platforms/mint_square_zksync_base_trades.sql diff --git a/models/_sector/nft/trades/chains/zksync/platforms/tevaera_zksync_base_trades.sql b/nft/models/_sector/trades/chains/zksync/platforms/tevaera_zksync_base_trades.sql similarity index 100% rename from models/_sector/nft/trades/chains/zksync/platforms/tevaera_zksync_base_trades.sql rename to nft/models/_sector/trades/chains/zksync/platforms/tevaera_zksync_base_trades.sql diff --git a/models/_sector/nft/trades/chains/zksync/platforms/zk_markets_zksync_base_trades.sql b/nft/models/_sector/trades/chains/zksync/platforms/zk_markets_zksync_base_trades.sql similarity index 98% rename from models/_sector/nft/trades/chains/zksync/platforms/zk_markets_zksync_base_trades.sql rename to nft/models/_sector/trades/chains/zksync/platforms/zk_markets_zksync_base_trades.sql index 9500fede2cb..2ec50384d7d 100644 --- a/models/_sector/nft/trades/chains/zksync/platforms/zk_markets_zksync_base_trades.sql +++ b/nft/models/_sector/trades/chains/zksync/platforms/zk_markets_zksync_base_trades.sql @@ -59,7 +59,7 @@ royalties as ( tc.evt_index, tc.evt_index - coalesce(tr.evt_index, element_at(tr.trace_address, 1), 0) as ranking from base_trades_combined as tc - join {{ ref('tokens_zksync_base_transfers') }} as tr + join {{ source('tokens_zksync','base_transfers') }} as tr on tc.block_number = tr.block_number and tc.tx_hash = tr.tx_hash where tr.amount_raw > 0 diff --git a/models/_sector/nft/trades/chains/zksync/platforms/zonic_zksync_base_trades.sql b/nft/models/_sector/trades/chains/zksync/platforms/zonic_zksync_base_trades.sql similarity index 100% rename from models/_sector/nft/trades/chains/zksync/platforms/zonic_zksync_base_trades.sql rename to nft/models/_sector/trades/chains/zksync/platforms/zonic_zksync_base_trades.sql diff --git a/models/_sector/nft/trades/chains/zora/nft_zora_base_trades.sql b/nft/models/_sector/trades/chains/zora/nft_zora_base_trades.sql similarity index 100% rename from models/_sector/nft/trades/chains/zora/nft_zora_base_trades.sql rename to nft/models/_sector/trades/chains/zora/nft_zora_base_trades.sql diff --git a/models/_sector/nft/trades/chains/zora/platforms/_schema.yml b/nft/models/_sector/trades/chains/zora/platforms/_schema.yml similarity index 100% rename from models/_sector/nft/trades/chains/zora/platforms/_schema.yml rename to nft/models/_sector/trades/chains/zora/platforms/_schema.yml diff --git a/models/_sector/nft/trades/chains/zora/platforms/opensea_v4_zora_base_trades.sql b/nft/models/_sector/trades/chains/zora/platforms/opensea_v4_zora_base_trades.sql similarity index 100% rename from models/_sector/nft/trades/chains/zora/platforms/opensea_v4_zora_base_trades.sql rename to nft/models/_sector/trades/chains/zora/platforms/opensea_v4_zora_base_trades.sql diff --git a/models/_sector/nft/trades/chains/zora/platforms/zonic_zora_base_trades.sql b/nft/models/_sector/trades/chains/zora/platforms/zonic_zora_base_trades.sql similarity index 100% rename from models/_sector/nft/trades/chains/zora/platforms/zonic_zora_base_trades.sql rename to nft/models/_sector/trades/chains/zora/platforms/zonic_zora_base_trades.sql diff --git a/models/_sector/nft/trades/compatibility_views/nft_events.sql b/nft/models/_sector/trades/compatibility_views/nft_events.sql similarity index 100% rename from models/_sector/nft/trades/compatibility_views/nft_events.sql rename to nft/models/_sector/trades/compatibility_views/nft_events.sql diff --git a/models/_sector/nft/trades/compatibility_views/nft_fees.sql b/nft/models/_sector/trades/compatibility_views/nft_fees.sql similarity index 100% rename from models/_sector/nft/trades/compatibility_views/nft_fees.sql rename to nft/models/_sector/trades/compatibility_views/nft_fees.sql diff --git a/models/_sector/nft/trades/nft_base_trades.sql b/nft/models/_sector/trades/nft_base_trades.sql similarity index 100% rename from models/_sector/nft/trades/nft_base_trades.sql rename to nft/models/_sector/trades/nft_base_trades.sql diff --git a/models/_sector/nft/trades/nft_trades.sql b/nft/models/_sector/trades/nft_trades.sql similarity index 100% rename from models/_sector/nft/trades/nft_trades.sql rename to nft/models/_sector/trades/nft_trades.sql diff --git a/models/_sector/nft/trades/nft_trades_beta.sql b/nft/models/_sector/trades/nft_trades_beta.sql similarity index 100% rename from models/_sector/nft/trades/nft_trades_beta.sql rename to nft/models/_sector/trades/nft_trades_beta.sql diff --git a/models/_sector/nft/trades/platform_views/_schema.yml b/nft/models/_sector/trades/platform_views/_schema.yml similarity index 100% rename from models/_sector/nft/trades/platform_views/_schema.yml rename to nft/models/_sector/trades/platform_views/_schema.yml diff --git a/models/_sector/nft/trades/platform_views/aavegotchi_trades_view.sql b/nft/models/_sector/trades/platform_views/aavegotchi_trades_view.sql similarity index 100% rename from models/_sector/nft/trades/platform_views/aavegotchi_trades_view.sql rename to nft/models/_sector/trades/platform_views/aavegotchi_trades_view.sql diff --git a/models/_sector/nft/trades/platform_views/archipelago_trades_view.sql b/nft/models/_sector/trades/platform_views/archipelago_trades_view.sql similarity index 100% rename from models/_sector/nft/trades/platform_views/archipelago_trades_view.sql rename to nft/models/_sector/trades/platform_views/archipelago_trades_view.sql diff --git a/models/_sector/nft/trades/platform_views/blur_trades_view.sql b/nft/models/_sector/trades/platform_views/blur_trades_view.sql similarity index 100% rename from models/_sector/nft/trades/platform_views/blur_trades_view.sql rename to nft/models/_sector/trades/platform_views/blur_trades_view.sql diff --git a/models/_sector/nft/trades/platform_views/collectionswap_trades_view.sql b/nft/models/_sector/trades/platform_views/collectionswap_trades_view.sql similarity index 100% rename from models/_sector/nft/trades/platform_views/collectionswap_trades_view.sql rename to nft/models/_sector/trades/platform_views/collectionswap_trades_view.sql diff --git a/models/_sector/nft/trades/platform_views/cryptopunks_trades_view.sql b/nft/models/_sector/trades/platform_views/cryptopunks_trades_view.sql similarity index 100% rename from models/_sector/nft/trades/platform_views/cryptopunks_trades_view.sql rename to nft/models/_sector/trades/platform_views/cryptopunks_trades_view.sql diff --git a/models/_sector/nft/trades/platform_views/element_trades_view.sql b/nft/models/_sector/trades/platform_views/element_trades_view.sql similarity index 100% rename from models/_sector/nft/trades/platform_views/element_trades_view.sql rename to nft/models/_sector/trades/platform_views/element_trades_view.sql diff --git a/models/_sector/nft/trades/platform_views/fantasy_trades_view.sql b/nft/models/_sector/trades/platform_views/fantasy_trades_view.sql similarity index 97% rename from models/_sector/nft/trades/platform_views/fantasy_trades_view.sql rename to nft/models/_sector/trades/platform_views/fantasy_trades_view.sql index 61afe8ea2e5..83612063701 100644 --- a/models/_sector/nft/trades/platform_views/fantasy_trades_view.sql +++ b/nft/models/_sector/trades/platform_views/fantasy_trades_view.sql @@ -2,7 +2,7 @@ {{ config( schema = 'fantasy', alias = 'trades', - + materialized = 'view', post_hook='{{ expose_spells(\'["blast"]\', "project", diff --git a/models/_sector/nft/trades/platform_views/foundation_trades_view.sql b/nft/models/_sector/trades/platform_views/foundation_trades_view.sql similarity index 100% rename from models/_sector/nft/trades/platform_views/foundation_trades_view.sql rename to nft/models/_sector/trades/platform_views/foundation_trades_view.sql diff --git a/models/_sector/nft/trades/platform_views/fractal_trades_view.sql b/nft/models/_sector/trades/platform_views/fractal_trades_view.sql similarity index 100% rename from models/_sector/nft/trades/platform_views/fractal_trades_view.sql rename to nft/models/_sector/trades/platform_views/fractal_trades_view.sql diff --git a/models/_sector/nft/trades/platform_views/looksrare_trades_view.sql b/nft/models/_sector/trades/platform_views/looksrare_trades_view.sql similarity index 100% rename from models/_sector/nft/trades/platform_views/looksrare_trades_view.sql rename to nft/models/_sector/trades/platform_views/looksrare_trades_view.sql diff --git a/models/_sector/nft/trades/platform_views/magiceden_trades_view.sql b/nft/models/_sector/trades/platform_views/magiceden_trades_view.sql similarity index 100% rename from models/_sector/nft/trades/platform_views/magiceden_trades_view.sql rename to nft/models/_sector/trades/platform_views/magiceden_trades_view.sql diff --git a/models/_sector/nft/trades/platform_views/nftb_trades_view.sql b/nft/models/_sector/trades/platform_views/nftb_trades_view.sql similarity index 100% rename from models/_sector/nft/trades/platform_views/nftb_trades_view.sql rename to nft/models/_sector/trades/platform_views/nftb_trades_view.sql diff --git a/models/_sector/nft/trades/platform_views/nftearth_trades_view.sql b/nft/models/_sector/trades/platform_views/nftearth_trades_view.sql similarity index 100% rename from models/_sector/nft/trades/platform_views/nftearth_trades_view.sql rename to nft/models/_sector/trades/platform_views/nftearth_trades_view.sql diff --git a/models/_sector/nft/trades/platform_views/nftrade_trades_view.sql b/nft/models/_sector/trades/platform_views/nftrade_trades_view.sql similarity index 100% rename from models/_sector/nft/trades/platform_views/nftrade_trades_view.sql rename to nft/models/_sector/trades/platform_views/nftrade_trades_view.sql diff --git a/models/_sector/nft/trades/platform_views/oneplanet_trades_view.sql b/nft/models/_sector/trades/platform_views/oneplanet_trades_view.sql similarity index 100% rename from models/_sector/nft/trades/platform_views/oneplanet_trades_view.sql rename to nft/models/_sector/trades/platform_views/oneplanet_trades_view.sql diff --git a/models/_sector/nft/trades/platform_views/opensea_trades_view.sql b/nft/models/_sector/trades/platform_views/opensea_trades_view.sql similarity index 100% rename from models/_sector/nft/trades/platform_views/opensea_trades_view.sql rename to nft/models/_sector/trades/platform_views/opensea_trades_view.sql diff --git a/models/_sector/nft/trades/platform_views/pancakeswap_trades_view.sql b/nft/models/_sector/trades/platform_views/pancakeswap_trades_view.sql similarity index 100% rename from models/_sector/nft/trades/platform_views/pancakeswap_trades_view.sql rename to nft/models/_sector/trades/platform_views/pancakeswap_trades_view.sql diff --git a/models/_sector/nft/trades/platform_views/quix_trades_view.sql b/nft/models/_sector/trades/platform_views/quix_trades_view.sql similarity index 100% rename from models/_sector/nft/trades/platform_views/quix_trades_view.sql rename to nft/models/_sector/trades/platform_views/quix_trades_view.sql diff --git a/models/_sector/nft/trades/platform_views/rarible_trades_view.sql b/nft/models/_sector/trades/platform_views/rarible_trades_view.sql similarity index 100% rename from models/_sector/nft/trades/platform_views/rarible_trades_view.sql rename to nft/models/_sector/trades/platform_views/rarible_trades_view.sql diff --git a/models/_sector/nft/trades/platform_views/stealcam_trades_view.sql b/nft/models/_sector/trades/platform_views/stealcam_trades_view.sql similarity index 100% rename from models/_sector/nft/trades/platform_views/stealcam_trades_view.sql rename to nft/models/_sector/trades/platform_views/stealcam_trades_view.sql diff --git a/models/_sector/nft/trades/platform_views/sudoswap_trades_view.sql b/nft/models/_sector/trades/platform_views/sudoswap_trades_view.sql similarity index 100% rename from models/_sector/nft/trades/platform_views/sudoswap_trades_view.sql rename to nft/models/_sector/trades/platform_views/sudoswap_trades_view.sql diff --git a/models/_sector/nft/trades/platform_views/superrare_trades_view.sql b/nft/models/_sector/trades/platform_views/superrare_trades_view.sql similarity index 100% rename from models/_sector/nft/trades/platform_views/superrare_trades_view.sql rename to nft/models/_sector/trades/platform_views/superrare_trades_view.sql diff --git a/models/_sector/nft/trades/platform_views/tofu_trades_view.sql b/nft/models/_sector/trades/platform_views/tofu_trades_view.sql similarity index 100% rename from models/_sector/nft/trades/platform_views/tofu_trades_view.sql rename to nft/models/_sector/trades/platform_views/tofu_trades_view.sql diff --git a/models/_sector/nft/trades/platform_views/x2y2_trades_view.sql b/nft/models/_sector/trades/platform_views/x2y2_trades_view.sql similarity index 100% rename from models/_sector/nft/trades/platform_views/x2y2_trades_view.sql rename to nft/models/_sector/trades/platform_views/x2y2_trades_view.sql diff --git a/models/_sector/nft/trades/platform_views/zonic_trades_view.sql b/nft/models/_sector/trades/platform_views/zonic_trades_view.sql similarity index 100% rename from models/_sector/nft/trades/platform_views/zonic_trades_view.sql rename to nft/models/_sector/trades/platform_views/zonic_trades_view.sql diff --git a/models/_sector/nft/trades/platform_views/zora_trades_view.sql b/nft/models/_sector/trades/platform_views/zora_trades_view.sql similarity index 100% rename from models/_sector/nft/trades/platform_views/zora_trades_view.sql rename to nft/models/_sector/trades/platform_views/zora_trades_view.sql diff --git a/models/_sector/nft/trades/schema.yml b/nft/models/_sector/trades/schema.yml similarity index 100% rename from models/_sector/nft/trades/schema.yml rename to nft/models/_sector/trades/schema.yml diff --git a/models/_sector/nft/transfers/_schema.yml b/nft/models/_sector/transfers/_schema.yml similarity index 100% rename from models/_sector/nft/transfers/_schema.yml rename to nft/models/_sector/transfers/_schema.yml diff --git a/models/_sector/nft/transfers/chains/nft_arbitrum_transfers.sql b/nft/models/_sector/transfers/chains/nft_arbitrum_transfers.sql similarity index 100% rename from models/_sector/nft/transfers/chains/nft_arbitrum_transfers.sql rename to nft/models/_sector/transfers/chains/nft_arbitrum_transfers.sql diff --git a/models/_sector/nft/transfers/chains/nft_avalanche_c_transfers.sql b/nft/models/_sector/transfers/chains/nft_avalanche_c_transfers.sql similarity index 100% rename from models/_sector/nft/transfers/chains/nft_avalanche_c_transfers.sql rename to nft/models/_sector/transfers/chains/nft_avalanche_c_transfers.sql diff --git a/models/_sector/nft/transfers/chains/nft_base_transfers.sql b/nft/models/_sector/transfers/chains/nft_base_transfers.sql similarity index 100% rename from models/_sector/nft/transfers/chains/nft_base_transfers.sql rename to nft/models/_sector/transfers/chains/nft_base_transfers.sql diff --git a/models/_sector/nft/transfers/chains/nft_bnb_transfers.sql b/nft/models/_sector/transfers/chains/nft_bnb_transfers.sql similarity index 100% rename from models/_sector/nft/transfers/chains/nft_bnb_transfers.sql rename to nft/models/_sector/transfers/chains/nft_bnb_transfers.sql diff --git a/models/_sector/nft/transfers/chains/nft_celo_transfers.sql b/nft/models/_sector/transfers/chains/nft_celo_transfers.sql similarity index 100% rename from models/_sector/nft/transfers/chains/nft_celo_transfers.sql rename to nft/models/_sector/transfers/chains/nft_celo_transfers.sql diff --git a/models/_sector/nft/transfers/chains/nft_ethereum_transfers.sql b/nft/models/_sector/transfers/chains/nft_ethereum_transfers.sql similarity index 100% rename from models/_sector/nft/transfers/chains/nft_ethereum_transfers.sql rename to nft/models/_sector/transfers/chains/nft_ethereum_transfers.sql diff --git a/models/_sector/nft/transfers/chains/nft_fantom_transfers.sql b/nft/models/_sector/transfers/chains/nft_fantom_transfers.sql similarity index 100% rename from models/_sector/nft/transfers/chains/nft_fantom_transfers.sql rename to nft/models/_sector/transfers/chains/nft_fantom_transfers.sql diff --git a/models/_sector/nft/transfers/chains/nft_gnosis_transfers.sql b/nft/models/_sector/transfers/chains/nft_gnosis_transfers.sql similarity index 100% rename from models/_sector/nft/transfers/chains/nft_gnosis_transfers.sql rename to nft/models/_sector/transfers/chains/nft_gnosis_transfers.sql diff --git a/models/_sector/nft/transfers/chains/nft_goerli_transfers.sql b/nft/models/_sector/transfers/chains/nft_goerli_transfers.sql similarity index 100% rename from models/_sector/nft/transfers/chains/nft_goerli_transfers.sql rename to nft/models/_sector/transfers/chains/nft_goerli_transfers.sql diff --git a/models/_sector/nft/transfers/chains/nft_optimism_transfers.sql b/nft/models/_sector/transfers/chains/nft_optimism_transfers.sql similarity index 100% rename from models/_sector/nft/transfers/chains/nft_optimism_transfers.sql rename to nft/models/_sector/transfers/chains/nft_optimism_transfers.sql diff --git a/models/_sector/nft/transfers/chains/nft_polygon_transfers.sql b/nft/models/_sector/transfers/chains/nft_polygon_transfers.sql similarity index 100% rename from models/_sector/nft/transfers/chains/nft_polygon_transfers.sql rename to nft/models/_sector/transfers/chains/nft_polygon_transfers.sql diff --git a/models/_sector/nft/transfers/chains/nft_scroll_transfers.sql b/nft/models/_sector/transfers/chains/nft_scroll_transfers.sql similarity index 100% rename from models/_sector/nft/transfers/chains/nft_scroll_transfers.sql rename to nft/models/_sector/transfers/chains/nft_scroll_transfers.sql diff --git a/models/_sector/nft/transfers/chains/nft_zksync_transfers.sql b/nft/models/_sector/transfers/chains/nft_zksync_transfers.sql similarity index 100% rename from models/_sector/nft/transfers/chains/nft_zksync_transfers.sql rename to nft/models/_sector/transfers/chains/nft_zksync_transfers.sql diff --git a/models/_sector/nft/transfers/chains/nft_zora_transfers.sql b/nft/models/_sector/transfers/chains/nft_zora_transfers.sql similarity index 100% rename from models/_sector/nft/transfers/chains/nft_zora_transfers.sql rename to nft/models/_sector/transfers/chains/nft_zora_transfers.sql diff --git a/models/_sector/nft/transfers/nft_transfers.sql b/nft/models/_sector/transfers/nft_transfers.sql similarity index 100% rename from models/_sector/nft/transfers/nft_transfers.sql rename to nft/models/_sector/transfers/nft_transfers.sql diff --git a/models/_sector/nft/wash_trades/_schema.yml b/nft/models/_sector/wash_trades/_schema.yml similarity index 97% rename from models/_sector/nft/wash_trades/_schema.yml rename to nft/models/_sector/wash_trades/_schema.yml index 55dabb1d328..cfb4f9c67e5 100644 --- a/models/_sector/nft/wash_trades/_schema.yml +++ b/nft/models/_sector/wash_trades/_schema.yml @@ -87,9 +87,11 @@ models: name: tx_to description: "Address that received the transaction" - &unique_trade_id - name: unique_trade_id - tests: - - is_unique_filtered + name: unique_trade_id + tests: + - unique: + config: + where: "unique_trade_id is not null and block_date >= NOW() - interval '2' day" - &buyer_first_funded_by name: buyer_first_funded_by description: "Which wallet first funded the buyer's wallet in ETH" @@ -258,4 +260,4 @@ models: NFT wash trades labelling columns: # only listing columns that have tests here for simplicity - - *unique_trade_id \ No newline at end of file + - *unique_trade_id diff --git a/models/_sector/nft/wash_trades/chains/nft_arbitrum_wash_trades.sql b/nft/models/_sector/wash_trades/chains/nft_arbitrum_wash_trades.sql similarity index 100% rename from models/_sector/nft/wash_trades/chains/nft_arbitrum_wash_trades.sql rename to nft/models/_sector/wash_trades/chains/nft_arbitrum_wash_trades.sql diff --git a/models/_sector/nft/wash_trades/chains/nft_avalanche_c_wash_trades.sql b/nft/models/_sector/wash_trades/chains/nft_avalanche_c_wash_trades.sql similarity index 100% rename from models/_sector/nft/wash_trades/chains/nft_avalanche_c_wash_trades.sql rename to nft/models/_sector/wash_trades/chains/nft_avalanche_c_wash_trades.sql diff --git a/models/_sector/nft/wash_trades/chains/nft_base_wash_trades.sql b/nft/models/_sector/wash_trades/chains/nft_base_wash_trades.sql similarity index 100% rename from models/_sector/nft/wash_trades/chains/nft_base_wash_trades.sql rename to nft/models/_sector/wash_trades/chains/nft_base_wash_trades.sql diff --git a/models/_sector/nft/wash_trades/chains/nft_bnb_wash_trades.sql b/nft/models/_sector/wash_trades/chains/nft_bnb_wash_trades.sql similarity index 100% rename from models/_sector/nft/wash_trades/chains/nft_bnb_wash_trades.sql rename to nft/models/_sector/wash_trades/chains/nft_bnb_wash_trades.sql diff --git a/models/_sector/nft/wash_trades/chains/nft_celo_wash_trades.sql b/nft/models/_sector/wash_trades/chains/nft_celo_wash_trades.sql similarity index 100% rename from models/_sector/nft/wash_trades/chains/nft_celo_wash_trades.sql rename to nft/models/_sector/wash_trades/chains/nft_celo_wash_trades.sql diff --git a/models/_sector/nft/wash_trades/chains/nft_ethereum_wash_trades.sql b/nft/models/_sector/wash_trades/chains/nft_ethereum_wash_trades.sql similarity index 100% rename from models/_sector/nft/wash_trades/chains/nft_ethereum_wash_trades.sql rename to nft/models/_sector/wash_trades/chains/nft_ethereum_wash_trades.sql diff --git a/models/_sector/nft/wash_trades/chains/nft_gnosis_wash_trades.sql b/nft/models/_sector/wash_trades/chains/nft_gnosis_wash_trades.sql similarity index 100% rename from models/_sector/nft/wash_trades/chains/nft_gnosis_wash_trades.sql rename to nft/models/_sector/wash_trades/chains/nft_gnosis_wash_trades.sql diff --git a/models/_sector/nft/wash_trades/chains/nft_optimism_wash_trades.sql b/nft/models/_sector/wash_trades/chains/nft_optimism_wash_trades.sql similarity index 100% rename from models/_sector/nft/wash_trades/chains/nft_optimism_wash_trades.sql rename to nft/models/_sector/wash_trades/chains/nft_optimism_wash_trades.sql diff --git a/models/_sector/nft/wash_trades/chains/nft_polygon_wash_trades.sql b/nft/models/_sector/wash_trades/chains/nft_polygon_wash_trades.sql similarity index 100% rename from models/_sector/nft/wash_trades/chains/nft_polygon_wash_trades.sql rename to nft/models/_sector/wash_trades/chains/nft_polygon_wash_trades.sql diff --git a/models/_sector/nft/wash_trades/chains/nft_scroll_wash_trades.sql b/nft/models/_sector/wash_trades/chains/nft_scroll_wash_trades.sql similarity index 100% rename from models/_sector/nft/wash_trades/chains/nft_scroll_wash_trades.sql rename to nft/models/_sector/wash_trades/chains/nft_scroll_wash_trades.sql diff --git a/models/_sector/nft/wash_trades/chains/nft_zksync_wash_trades.sql b/nft/models/_sector/wash_trades/chains/nft_zksync_wash_trades.sql similarity index 100% rename from models/_sector/nft/wash_trades/chains/nft_zksync_wash_trades.sql rename to nft/models/_sector/wash_trades/chains/nft_zksync_wash_trades.sql diff --git a/models/_sector/nft/wash_trades/chains/nft_zora_wash_trades.sql b/nft/models/_sector/wash_trades/chains/nft_zora_wash_trades.sql similarity index 100% rename from models/_sector/nft/wash_trades/chains/nft_zora_wash_trades.sql rename to nft/models/_sector/wash_trades/chains/nft_zora_wash_trades.sql diff --git a/models/_sector/nft/wash_trades/nft_wash_trades.sql b/nft/models/_sector/wash_trades/nft_wash_trades.sql similarity index 100% rename from models/_sector/nft/wash_trades/nft_wash_trades.sql rename to nft/models/_sector/wash_trades/nft_wash_trades.sql diff --git a/models/nft/ethereum/metadata/nft_ethereum_metadata_art_blocks_collections.sql b/nft/models/nft_metrics/ethereum/metadata/nft_ethereum_metadata_art_blocks_collections.sql similarity index 99% rename from models/nft/ethereum/metadata/nft_ethereum_metadata_art_blocks_collections.sql rename to nft/models/nft_metrics/ethereum/metadata/nft_ethereum_metadata_art_blocks_collections.sql index 40150b31ae5..328d77a88e3 100644 --- a/models/nft/ethereum/metadata/nft_ethereum_metadata_art_blocks_collections.sql +++ b/nft/models/nft_metrics/ethereum/metadata/nft_ethereum_metadata_art_blocks_collections.sql @@ -3,6 +3,7 @@ tags = ['static'] ,schema = 'nft_ethereum_metadata' ,alias = 'art_blocks_collections' + ,materialized = 'table' ) }} @@ -235,7 +236,7 @@ , (0xa7d8d9ef8d8ce8992df33d8b8cf4aebabd5bd270, 229, 1000000, 'Attraction', 'Jos Vromans', 'Factory', 'N/A', '0xa7d8d9ef8d8ce8992df33d8b8cf4aebabd5bd270-229') , (0xa7d8d9ef8d8ce8992df33d8b8cf4aebabd5bd270, 230, 1000000, 'Glow', 'Jason Ting', 'Playground', 'N/A', '0xa7d8d9ef8d8ce8992df33d8b8cf4aebabd5bd270-230') , (0xa7d8d9ef8d8ce8992df33d8b8cf4aebabd5bd270, 231, 1000000, 'Cushions', 'Devi Parikh', 'Factory', 'N/A', '0xa7d8d9ef8d8ce8992df33d8b8cf4aebabd5bd270-231') - , (0xa7d8d9ef8d8ce8992df33d8b8cf4aebabd5bd270, 232, 1000000, 'Jiometory No Compute', 'Samsy', 'Curated', '5', '0xa7d8d9ef8d8ce8992df33d8b8cf4aebabd5bd270-232') -- Jiometory No Compute - ジオメトリ ハ ケイサンサレマセン is full collection name - chracters not supported + , (0xa7d8d9ef8d8ce8992df33d8b8cf4aebabd5bd270, 232, 1000000, 'Jiometory No Compute', 'Samsy', 'Curated', '5', '0xa7d8d9ef8d8ce8992df33d8b8cf4aebabd5bd270-232') -- Jiometory No Compute - ジオメトリ ハ ケイサンサレマセン is full collection name - chracters not supported , (0xa7d8d9ef8d8ce8992df33d8b8cf4aebabd5bd270, 233, 1000000, 'Chimera', 'mpkoz', 'Curated', '6', '0xa7d8d9ef8d8ce8992df33d8b8cf4aebabd5bd270-233') , (0xa7d8d9ef8d8ce8992df33d8b8cf4aebabd5bd270, 234, 1000000, 'The Wrapture', 'Dmitri Cherniak', 'Playground', 'N/A', '0xa7d8d9ef8d8ce8992df33d8b8cf4aebabd5bd270-234') , (0xa7d8d9ef8d8ce8992df33d8b8cf4aebabd5bd270, 235, 1000000, 'Maps for grief', 'Louis-André Labadie', 'Factory', 'N/A', '0xa7d8d9ef8d8ce8992df33d8b8cf4aebabd5bd270-235') @@ -369,8 +370,8 @@ , (0xa7d8d9ef8d8ce8992df33d8b8cf4aebabd5bd270, 370, 1000000, 'Rectangles (for Herbert)', 'Jeff Davis', 'Playground', 'N/A', '0xa7d8d9ef8d8ce8992df33d8b8cf4aebabd5bd270-370') , (0xa7d8d9ef8d8ce8992df33d8b8cf4aebabd5bd270, 371, 1000000, 'JPEG', 'Jan Robert Leegte', 'Presents', 'N/A', '0xa7d8d9ef8d8ce8992df33d8b8cf4aebabd5bd270-371') , (0xa7d8d9ef8d8ce8992df33d8b8cf4aebabd5bd270, 373, 1000000, 'Intersections', 'Rafaël Rozendaal', 'Presents', 'N/A', '0xa7d8d9ef8d8ce8992df33d8b8cf4aebabd5bd270-373') - - + + -- switch to new contracts in October 2022 , (0x99a9b7c1116f9ceeb1652de04d5969cce509b069, 376, 1000000, 'Tide Predictor', 'LoVid', 'Curated', 'N/A', '0x99a9b7c1116f9ceeb1652de04d5969cce509b069-376') , (0x99a9b7c1116f9ceeb1652de04d5969cce509b069, 379, 1000000, 'ORI', 'James Merrill', 'Curated', 'N/A', '0x99a9b7c1116f9ceeb1652de04d5969cce509b069-379') @@ -417,5 +418,5 @@ , (0x64780ce53f6e966e18a22af13a2f97369580ec11,4,1000000,'New Worlds','Robert Whitman','Art Blocks x Pace','N/A','0x64780ce53f6e966e18a22af13a2f97369580ec11-4') ) as temp_table (contract_address, project_id, project_id_base_value, collection_name, artist_name, art_blocks_project_type, art_blocks_curated_season, art_collection_unique_id) - -order by project_id asc \ No newline at end of file + +order by project_id asc diff --git a/models/nft/ethereum/metadata/nft_ethereum_metadata_art_platform_collections.sql b/nft/models/nft_metrics/ethereum/metadata/nft_ethereum_metadata_art_platform_collections.sql similarity index 98% rename from models/nft/ethereum/metadata/nft_ethereum_metadata_art_platform_collections.sql rename to nft/models/nft_metrics/ethereum/metadata/nft_ethereum_metadata_art_platform_collections.sql index 09938eff896..2a79b57d21a 100644 --- a/models/nft/ethereum/metadata/nft_ethereum_metadata_art_platform_collections.sql +++ b/nft/models/nft_metrics/ethereum/metadata/nft_ethereum_metadata_art_platform_collections.sql @@ -2,6 +2,7 @@ tags = ['static'] ,schema = 'nft_ethereum_metadata' ,alias = 'art_platform_collections' + ,materialized = 'table' ) }} diff --git a/models/nft/ethereum/metadata/nft_ethereum_metadata_braindrops.sql b/nft/models/nft_metrics/ethereum/metadata/nft_ethereum_metadata_braindrops.sql similarity index 97% rename from models/nft/ethereum/metadata/nft_ethereum_metadata_braindrops.sql rename to nft/models/nft_metrics/ethereum/metadata/nft_ethereum_metadata_braindrops.sql index e77f0dcfcc4..f01199b74ac 100644 --- a/models/nft/ethereum/metadata/nft_ethereum_metadata_braindrops.sql +++ b/nft/models/nft_metrics/ethereum/metadata/nft_ethereum_metadata_braindrops.sql @@ -2,6 +2,7 @@ tags = ['static'] ,schema = 'nft_ethereum_metadata' ,alias = 'braindrops' + ,materialized = 'table' ) }} @@ -25,4 +26,4 @@ from (VALUES ) as temp_table (contract_address, project_id, project_id_base_value, collection_name, artist_name, art_collection_unique_id) -order by project_id asc +order by project_id asc diff --git a/models/nft/ethereum/metadata/nft_ethereum_metadata_bright_moments.sql b/nft/models/nft_metrics/ethereum/metadata/nft_ethereum_metadata_bright_moments.sql similarity index 98% rename from models/nft/ethereum/metadata/nft_ethereum_metadata_bright_moments.sql rename to nft/models/nft_metrics/ethereum/metadata/nft_ethereum_metadata_bright_moments.sql index 78d55e15963..5693db71886 100644 --- a/models/nft/ethereum/metadata/nft_ethereum_metadata_bright_moments.sql +++ b/nft/models/nft_metrics/ethereum/metadata/nft_ethereum_metadata_bright_moments.sql @@ -2,6 +2,7 @@ tags = ['static'] ,schema = 'nft_ethereum_metadata' ,alias = 'bright_moments' + ,materialized = 'table' ) }} @@ -43,5 +44,5 @@ from (VALUES ) as temp_table (contract_address, project_id, project_id_base_value, collection_name, artist_name, bright_moments_city, art_collection_unique_id) - -order by project_id asc \ No newline at end of file + +order by project_id asc diff --git a/models/nft/ethereum/metadata/nft_ethereum_metadata_chromie_squiggle.sql b/nft/models/nft_metrics/ethereum/metadata/nft_ethereum_metadata_chromie_squiggle.sql similarity index 99% rename from models/nft/ethereum/metadata/nft_ethereum_metadata_chromie_squiggle.sql rename to nft/models/nft_metrics/ethereum/metadata/nft_ethereum_metadata_chromie_squiggle.sql index 0661642bc3d..46962b84c80 100644 --- a/models/nft/ethereum/metadata/nft_ethereum_metadata_chromie_squiggle.sql +++ b/nft/models/nft_metrics/ethereum/metadata/nft_ethereum_metadata_chromie_squiggle.sql @@ -2,6 +2,7 @@ tags = ['static'] ,schema = 'nft_ethereum_metadata' ,alias = 'chromie_squiggle' + ,materialized = 'table' ) }} @@ -9742,4 +9743,4 @@ FROM (VALUES , (9732,'Forward',11,76,3,15,'Normal',59,200,'Bold','','') , (9733,'Reverse',12,81,3,12,'Normal',136,200,'Normal','','') - ) AS temp_table (token_id, color_direction, color_spread, end_color, height, segments, spectrum, start_color, steps_between, squiggle_type, day_zero, harmonic) \ No newline at end of file + ) AS temp_table (token_id, color_direction, color_spread, end_color, height, segments, spectrum, start_color, steps_between, squiggle_type, day_zero, harmonic) diff --git a/models/nft/ethereum/metadata/nft_ethereum_metadata_cryptodickbutts.sql b/nft/models/nft_metrics/ethereum/metadata/nft_ethereum_metadata_cryptodickbutts.sql similarity index 99% rename from models/nft/ethereum/metadata/nft_ethereum_metadata_cryptodickbutts.sql rename to nft/models/nft_metrics/ethereum/metadata/nft_ethereum_metadata_cryptodickbutts.sql index 77b963fd016..cc5870688c7 100644 --- a/models/nft/ethereum/metadata/nft_ethereum_metadata_cryptodickbutts.sql +++ b/nft/models/nft_metrics/ethereum/metadata/nft_ethereum_metadata_cryptodickbutts.sql @@ -2,6 +2,7 @@ tags = ['static'] ,schema = 'nft_ethereum_metadata' ,alias = 'cryptodickbutts' + ,materialized = 'table' ) }} @@ -5209,4 +5210,4 @@ FROM (VALUES (998,'Picnic Day','None','None','Tentacle','Blindfold','None','Cute Ears','','None','None','Basketball','Light','None','6'), (999,'Ocean Mist','Sash','None','Flame','Hippie','Boxing Glove','Bowl Cut','','None','None','Basketball','Dark','None','8') - ) AS temp_table (token_id,background,body,butt,dick,eyes,hand,hat,legendary,mouth,nose,shoes,skin,special,trait_count) \ No newline at end of file + ) AS temp_table (token_id,background,body,butt,dick,eyes,hand,hat,legendary,mouth,nose,shoes,skin,special,trait_count) diff --git a/models/nft/ethereum/metadata/nft_ethereum_metadata_fellowship_gallery.sql b/nft/models/nft_metrics/ethereum/metadata/nft_ethereum_metadata_fellowship_gallery.sql similarity index 99% rename from models/nft/ethereum/metadata/nft_ethereum_metadata_fellowship_gallery.sql rename to nft/models/nft_metrics/ethereum/metadata/nft_ethereum_metadata_fellowship_gallery.sql index 8cd1fc6b01b..b7d3aad1e38 100644 --- a/models/nft/ethereum/metadata/nft_ethereum_metadata_fellowship_gallery.sql +++ b/nft/models/nft_metrics/ethereum/metadata/nft_ethereum_metadata_fellowship_gallery.sql @@ -2,6 +2,7 @@ tags = ['static'] ,schema = 'nft_ethereum_metadata' ,alias = 'fellowship_gallery' + ,materialized = 'table' ) }} @@ -81,5 +82,5 @@ from (VALUES , (0x65cb92b2a4bf5f7827df387b65962154f4666dbb, 'Sharkification', 'Cristina De Middel', 'Foundation', 'https://foundation.app/collection/cm-s') ) as temp_table (contract_address, collection_name, artist_name, platform, website) - -order by artist_name asc, collection_name asc \ No newline at end of file + +order by artist_name asc, collection_name asc diff --git a/models/nft/ethereum/metadata/nft_ethereum_metadata_mirage_gallery_curated.sql b/nft/models/nft_metrics/ethereum/metadata/nft_ethereum_metadata_mirage_gallery_curated.sql similarity index 97% rename from models/nft/ethereum/metadata/nft_ethereum_metadata_mirage_gallery_curated.sql rename to nft/models/nft_metrics/ethereum/metadata/nft_ethereum_metadata_mirage_gallery_curated.sql index ca0cec1b11a..b6d313357a0 100644 --- a/models/nft/ethereum/metadata/nft_ethereum_metadata_mirage_gallery_curated.sql +++ b/nft/models/nft_metrics/ethereum/metadata/nft_ethereum_metadata_mirage_gallery_curated.sql @@ -2,6 +2,7 @@ tags = ['static'] ,schema = 'nft_ethereum_metadata' ,alias = 'mirage_gallery_curated' + ,materialized = 'table' ) }} @@ -20,5 +21,5 @@ from (VALUES , (0xb7ec7bbd2d2193b47027247fc666fb342d23c4b5, 11, 10000, 'Abstract (ART)chitecture', 'MrHabMo', 'Esquisse', '0xb7ec7bbd2d2193b47027247fc666fb342d23c4b5-11') ) as temp_table (contract_address, project_id, project_id_base_value, collection_name, artist_name, mirage_project_name, art_collection_unique_id) - -order by project_id asc + +order by project_id asc diff --git a/models/nft/ethereum/metadata/nft_ethereum_metadata_proof_grails_i.sql b/nft/models/nft_metrics/ethereum/metadata/nft_ethereum_metadata_proof_grails_i.sql similarity index 99% rename from models/nft/ethereum/metadata/nft_ethereum_metadata_proof_grails_i.sql rename to nft/models/nft_metrics/ethereum/metadata/nft_ethereum_metadata_proof_grails_i.sql index 5c8b0308086..58d775c6c21 100644 --- a/models/nft/ethereum/metadata/nft_ethereum_metadata_proof_grails_i.sql +++ b/nft/models/nft_metrics/ethereum/metadata/nft_ethereum_metadata_proof_grails_i.sql @@ -2,6 +2,7 @@ tags = ['static'] ,schema = 'nft_ethereum_metadata' ,alias = 'proof_grails_i' + ,materialized = 'table' ) }} select contract_address, project_id, project_id_base_value, collection_name, artist_name, grails_season, grail_id, art_collection_unique_id @@ -1045,4 +1046,4 @@ from (VALUES ) as temp_table (contract_address, project_id, project_id_base_value, collection_name, artist_name, grails_season, grail_id, art_collection_unique_id) -order by project_id asc +order by project_id asc diff --git a/models/nft/ethereum/metadata/nft_ethereum_metadata_proof_grails_ii.sql b/nft/models/nft_metrics/ethereum/metadata/nft_ethereum_metadata_proof_grails_ii.sql similarity index 99% rename from models/nft/ethereum/metadata/nft_ethereum_metadata_proof_grails_ii.sql rename to nft/models/nft_metrics/ethereum/metadata/nft_ethereum_metadata_proof_grails_ii.sql index 10e86d0a0d2..e93b805618d 100644 --- a/models/nft/ethereum/metadata/nft_ethereum_metadata_proof_grails_ii.sql +++ b/nft/models/nft_metrics/ethereum/metadata/nft_ethereum_metadata_proof_grails_ii.sql @@ -2,6 +2,7 @@ tags = ['static'] ,schema = 'nft_ethereum_metadata' ,alias = 'proof_grails_ii' + ,materialized = 'table' ) }} select contract_address, project_id, project_id_base_value, collection_name, artist_name, grails_season, grail_id, art_collection_unique_id @@ -1188,4 +1189,4 @@ from (VALUES ) as temp_table (contract_address, project_id, project_id_base_value, collection_name, artist_name, grails_season, grail_id, art_collection_unique_id) -order by project_id asc +order by project_id asc diff --git a/models/nft/ethereum/metadata/nft_ethereum_metadata_ringers.sql b/nft/models/nft_metrics/ethereum/metadata/nft_ethereum_metadata_ringers.sql similarity index 99% rename from models/nft/ethereum/metadata/nft_ethereum_metadata_ringers.sql rename to nft/models/nft_metrics/ethereum/metadata/nft_ethereum_metadata_ringers.sql index 43b47f33b39..930e6ae0272 100644 --- a/models/nft/ethereum/metadata/nft_ethereum_metadata_ringers.sql +++ b/nft/models/nft_metrics/ethereum/metadata/nft_ethereum_metadata_ringers.sql @@ -2,6 +2,7 @@ tags = ['static'] ,schema = 'nft_ethereum_metadata' ,alias = 'ringers' + ,materialized = 'table' ) }} @@ -1007,4 +1008,4 @@ FROM (VALUES (13000997,997,'Beige','White','N/A','Recursive grid','Bigger near center','Solid','Normal','Off-center','Loop',6,6,'',''), (13000998,998,'White','White','Blue','5x5 grid','Uniform','Bullseye','Normal','Balanced','Weave',25,13,'',''), (13000999,999,'White','Red','N/A','Recursive grid','Bigger near center','Solid','Normal','Balanced','Weave',41,22,'','') - ) AS temp_table (token_id, token_id_short, background, body, extra_color, peg_layout, peg_scaling, peg_style, size, wrap_orientation, wrap_style, peg_count, pegs_used, padded_pegs, dark_mode) \ No newline at end of file + ) AS temp_table (token_id, token_id_short, background, body, extra_color, peg_layout, peg_scaling, peg_style, size, wrap_orientation, wrap_style, peg_count, pegs_used, padded_pegs, dark_mode) diff --git a/models/nft/ethereum/metadata/nft_ethereum_metadata_schema.yml b/nft/models/nft_metrics/ethereum/metadata/nft_ethereum_metadata_schema.yml similarity index 100% rename from models/nft/ethereum/metadata/nft_ethereum_metadata_schema.yml rename to nft/models/nft_metrics/ethereum/metadata/nft_ethereum_metadata_schema.yml diff --git a/models/nft/ethereum/metadata/nft_ethereum_metadata_terraforms.sql b/nft/models/nft_metrics/ethereum/metadata/nft_ethereum_metadata_terraforms.sql similarity index 99% rename from models/nft/ethereum/metadata/nft_ethereum_metadata_terraforms.sql rename to nft/models/nft_metrics/ethereum/metadata/nft_ethereum_metadata_terraforms.sql index 3fd225028e3..035df8ffa2e 100644 --- a/models/nft/ethereum/metadata/nft_ethereum_metadata_terraforms.sql +++ b/nft/models/nft_metrics/ethereum/metadata/nft_ethereum_metadata_terraforms.sql @@ -2,6 +2,7 @@ tags = ['static'] ,schema = 'nft_ethereum_metadata' ,alias = 'terraforms' + ,materialized = 'table' ) }} @@ -9917,4 +9918,4 @@ FROM (VALUES (9908,'Origin','Flow',46,'Holo',23,8,14,44428,'','','',''), (9909,'Origin','Flow',21,'Dynacrypts',36,24,13,51891,'','','','') - ) AS temp_table (token_id, mode, chroma, biome, terraform_zone, x_coordinate, y_coordinate, terraform_level, question_marks, x_seed, y_seed, lith0, spine) \ No newline at end of file + ) AS temp_table (token_id, mode, chroma, biome, terraform_zone, x_coordinate, y_coordinate, terraform_level, question_marks, x_seed, y_seed, lith0, spine) diff --git a/models/nft/ethereum/metadata/nft_ethereum_metadata_verse.sql b/nft/models/nft_metrics/ethereum/metadata/nft_ethereum_metadata_verse.sql similarity index 91% rename from models/nft/ethereum/metadata/nft_ethereum_metadata_verse.sql rename to nft/models/nft_metrics/ethereum/metadata/nft_ethereum_metadata_verse.sql index 9aef97ae7a2..62fd93b5001 100644 --- a/models/nft/ethereum/metadata/nft_ethereum_metadata_verse.sql +++ b/nft/models/nft_metrics/ethereum/metadata/nft_ethereum_metadata_verse.sql @@ -2,6 +2,7 @@ tags = ['static'] ,schema = 'nft_ethereum_metadata' ,alias = 'verse' + ,materialized = 'table' ) }} @@ -12,5 +13,5 @@ from (VALUES , (0xbb5471c292065d3b01b2e81e299267221ae9a250, 1, 1000000, 'Co(r)ral', 'Phaust', '0xbb5471c292065d3b01b2e81e299267221ae9a250-1') ) as temp_table (contract_address, project_id, project_id_base_value, collection_name, artist_name, art_collection_unique_id) - -order by project_id asc \ No newline at end of file + +order by project_id asc diff --git a/models/nft/ethereum/nft_ethereum_collection_stats.sql b/nft/models/nft_metrics/ethereum/nft_ethereum_collection_stats.sql similarity index 100% rename from models/nft/ethereum/nft_ethereum_collection_stats.sql rename to nft/models/nft_metrics/ethereum/nft_ethereum_collection_stats.sql diff --git a/models/nft/ethereum/nft_ethereum_schema.yml b/nft/models/nft_metrics/ethereum/nft_ethereum_schema.yml similarity index 100% rename from models/nft/ethereum/nft_ethereum_schema.yml rename to nft/models/nft_metrics/ethereum/nft_ethereum_schema.yml diff --git a/models/nft/ethereum/nft_ethereum_top_minters.sql b/nft/models/nft_metrics/ethereum/nft_ethereum_top_minters.sql similarity index 97% rename from models/nft/ethereum/nft_ethereum_top_minters.sql rename to nft/models/nft_metrics/ethereum/nft_ethereum_top_minters.sql index e94978fd12e..d457dda4db1 100644 --- a/models/nft/ethereum/nft_ethereum_top_minters.sql +++ b/nft/models/nft_metrics/ethereum/nft_ethereum_top_minters.sql @@ -1,5 +1,5 @@ {{ config( - + schema = 'nft_ethereum', alias = 'top_minters', materialized='incremental', file_format = 'delta', @@ -59,4 +59,4 @@ WHERE AND amount_original IS NOT NULL GROUP BY 1, 2 -{% endif %} \ No newline at end of file +{% endif %} diff --git a/models/nft/ethereum/nft_ethereum_top_sales.sql b/nft/models/nft_metrics/ethereum/nft_ethereum_top_sales.sql similarity index 100% rename from models/nft/ethereum/nft_ethereum_top_sales.sql rename to nft/models/nft_metrics/ethereum/nft_ethereum_top_sales.sql diff --git a/models/nft/ethereum/nft_ethereum_wallet_metrics.sql b/nft/models/nft_metrics/ethereum/nft_ethereum_wallet_metrics.sql similarity index 97% rename from models/nft/ethereum/nft_ethereum_wallet_metrics.sql rename to nft/models/nft_metrics/ethereum/nft_ethereum_wallet_metrics.sql index b8c9916b636..aca3ea0e2f8 100644 --- a/models/nft/ethereum/nft_ethereum_wallet_metrics.sql +++ b/nft/models/nft_metrics/ethereum/nft_ethereum_wallet_metrics.sql @@ -1,5 +1,5 @@ {{ config( - + schema = 'nft_ethereum', alias = 'wallet_metrics', materialized='table', file_format = 'delta', @@ -19,7 +19,7 @@ nft_trades_no_wash as AND wt.unique_trade_id=nft.unique_trade_id where is_wash_trade = FALSE ), ---- adding in mints because a mint can be interpreted as a buy for $0 or gas fees +--- adding in mints because a mint can be interpreted as a buy for $0 or gas fees nft_trades_no_wash_w_mints as ( select aggregator_address as aggregator_address, aggregator_name as aggregator_name, @@ -80,7 +80,7 @@ select aggregator_address as aggregator_address, from {{ref('nft_mints')}} ) , --- creating a longform version of buys and sells +-- creating a longform version of buys and sells buys_and_sells_nft_trades_no_wash_w_mints as ( --sells @@ -187,7 +187,7 @@ lastest_eth_price_usd as ( select blockchain, minute, price -from {{ref('prices_usd_latest')}} +from {{source('prices', 'usd_latest')}} where blockchain = 'ethereum' and symbol = 'WETH' ), @@ -226,15 +226,15 @@ where 1 = 1 order by b.block_time desc ), ---- Hacky split to fix bloom size error -all_trades_profit_and_unrealized_profit_w_floors as +--- Hacky split to fix bloom size error +all_trades_profit_and_unrealized_profit_w_floors as - (select + (select b.*, coalesce(floors1.avg_floor_price * p.price, floors2.price_p5_eth * p.price, 0) floor_usd, coalesce(sell_amount_usd, floors1.avg_floor_price * p.price, floors2.price_p5_eth * p.price, 0) + buy_amount_usd usd_profit, - + coalesce(floors1.avg_floor_price, floors2.price_p5_eth, 0) floor_eth, coalesce(sell_amount_eth, floors1.avg_floor_price, floors2.price_p5_eth, 0) sell_amount_eth_or_floor, case @@ -302,4 +302,4 @@ from all_trades_profit_and_unrealized_profit_w_floors group by 1 ) -select * from aggregated_wallet_trading_stats \ No newline at end of file +select * from aggregated_wallet_trading_stats diff --git a/models/nft/ethereum/nft_ethereum_wallet_pnl.sql b/nft/models/nft_metrics/ethereum/nft_ethereum_wallet_pnl.sql similarity index 100% rename from models/nft/ethereum/nft_ethereum_wallet_pnl.sql rename to nft/models/nft_metrics/ethereum/nft_ethereum_wallet_pnl.sql diff --git a/models/nft/nft_linked_addresses.sql b/nft/models/nft_metrics/nft_linked_addresses.sql similarity index 100% rename from models/nft/nft_linked_addresses.sql rename to nft/models/nft_metrics/nft_linked_addresses.sql diff --git a/models/nft/nft_marketplaces_info.sql b/nft/models/nft_metrics/nft_marketplaces_info.sql similarity index 100% rename from models/nft/nft_marketplaces_info.sql rename to nft/models/nft_metrics/nft_marketplaces_info.sql diff --git a/nft/models/nft_metrics/nft_schema.yml b/nft/models/nft_metrics/nft_schema.yml new file mode 100644 index 00000000000..88f857fbe90 --- /dev/null +++ b/nft/models/nft_metrics/nft_schema.yml @@ -0,0 +1,49 @@ +version: 2 + +models: + - name: nft_linked_addresses + meta: + blockchain: ethereum, solana + sector: nft + contributors: springzh, 0xRob + config: + tags: ['nft', 'opensea', 'looksrare', 'x2y2', 'magiceden', 'sudoswap', 'ethereum', 'solana', 'address'] + description: > + NFT linked addresses. Addresses that buy and sell NFTs from each other. By definition (master address < alt address) alphabetically. + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - blockchain + - master_address + - alternative_address + columns: + - name: blockchain + - name: master_address + description: "Master address" + - name: alternative_address + description: "Alternative address" + - name: last_interaction + description: "block_time of the last trade between the pair" + + - name: nft_marketplaces_info + meta: + blockchain: ethereum, polygon, bnb, avalanche_c, gnosis, optimism, arbitrum, fantom, goerli + sector: nft + contributors: hildobby + config: + tags: ['nft', 'ethereum', 'polygon', 'bnb', 'avalanche_c', 'gnosis', 'optimism', 'arbitrum', 'fantom', 'goerli', 'info'] + description: > + NFT marketplaces info + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - project + columns: + - name: project + description: "Marketplace codename" + - name: name + description: "Marketplace capitalised name" + - name: marketplace_type + description: "Type of marketplace" + - name: x_username + description: "Username on X" diff --git a/models/seaport/arbitrum/seaport_arbitrum_base_pairs.sql b/nft/models/seaport/arbitrum/seaport_arbitrum_base_pairs.sql similarity index 98% rename from models/seaport/arbitrum/seaport_arbitrum_base_pairs.sql rename to nft/models/seaport/arbitrum/seaport_arbitrum_base_pairs.sql index 3a7e1669df1..3f1233f15e2 100644 --- a/models/seaport/arbitrum/seaport_arbitrum_base_pairs.sql +++ b/nft/models/seaport/arbitrum/seaport_arbitrum_base_pairs.sql @@ -1,5 +1,5 @@ {{ config( - + schema = 'seaport_arbitrum', alias = 'base_pairs', partition_by = ['block_date'], materialized = 'incremental', @@ -35,7 +35,7 @@ with iv_offer_consideration as ( when '2' then 'erc721' when '3' then 'erc1155' else 'etc' - end as consideration_first_item_type + end as consideration_first_item_type ,offerer as sender ,recipient as receiver ,zone @@ -98,7 +98,7 @@ with iv_offer_consideration as ( when '2' then 'erc721' when '3' then 'erc1155' else 'etc' - end as consideration_first_item_type + end as consideration_first_item_type ,recipient as sender ,from_hex(json_extract_scalar(consideration_item,'$.recipient')) as receiver ,zone @@ -138,7 +138,7 @@ with iv_offer_consideration as ( {% endif %} {% if is_incremental() %} where evt_block_time >= date_trunc('day', now() - interval '7' day) - {% endif %} + {% endif %} ) ) ,iv_base_pairs as ( diff --git a/models/seaport/arbitrum/seaport_arbitrum_schema.yml b/nft/models/seaport/arbitrum/seaport_arbitrum_schema.yml similarity index 100% rename from models/seaport/arbitrum/seaport_arbitrum_schema.yml rename to nft/models/seaport/arbitrum/seaport_arbitrum_schema.yml diff --git a/models/seaport/arbitrum/seaport_arbitrum_tagging.sql b/nft/models/seaport/arbitrum/seaport_arbitrum_tagging.sql similarity index 94% rename from models/seaport/arbitrum/seaport_arbitrum_tagging.sql rename to nft/models/seaport/arbitrum/seaport_arbitrum_tagging.sql index 259cdcf1ed1..ee74152a1ce 100644 --- a/models/seaport/arbitrum/seaport_arbitrum_tagging.sql +++ b/nft/models/seaport/arbitrum/seaport_arbitrum_tagging.sql @@ -1,4 +1,5 @@ {{ config( + schema = 'seaport_arbitrum', alias = 'tagging', tags = [ 'static'], unique_key = ['blockchain', 'tagging_method', 'identifier']) @@ -12,5 +13,5 @@ FROM , ('arbitrum', 'zone', 0x110b2b128a9ed1be5ef3232d8e4e41640df5c2cd, 'OpenSea', 'Marketplace') , ('arbitrum', 'zone', 0xf397619df7bfd4d1657ea9bdd9df7ff888731a11, 'OpenSea', 'Marketplace') , ('arbitrum', 'tx_data_salt', 0x360c6ebe, 'OpenSea', 'Marketplace') - ) - x (blockchain, tagging_method, identifier, protocol, protocol_type) \ No newline at end of file + ) + x (blockchain, tagging_method, identifier, protocol, protocol_type) diff --git a/models/seaport/arbitrum/seaport_arbitrum_trades.sql b/nft/models/seaport/arbitrum/seaport_arbitrum_trades.sql similarity index 99% rename from models/seaport/arbitrum/seaport_arbitrum_trades.sql rename to nft/models/seaport/arbitrum/seaport_arbitrum_trades.sql index f3c0d9f3978..511b9c30297 100644 --- a/models/seaport/arbitrum/seaport_arbitrum_trades.sql +++ b/nft/models/seaport/arbitrum/seaport_arbitrum_trades.sql @@ -1,5 +1,5 @@ {{ config( - + schema = 'seaport_arbitrum', alias = 'trades', partition_by = ['block_date'], materialized = 'incremental', diff --git a/models/seaport/avalanche_c/seaport_avalanche_c_base_pairs.sql b/nft/models/seaport/avalanche_c/seaport_avalanche_c_base_pairs.sql similarity index 98% rename from models/seaport/avalanche_c/seaport_avalanche_c_base_pairs.sql rename to nft/models/seaport/avalanche_c/seaport_avalanche_c_base_pairs.sql index 33fa6d663d6..96d5bdf2f12 100644 --- a/models/seaport/avalanche_c/seaport_avalanche_c_base_pairs.sql +++ b/nft/models/seaport/avalanche_c/seaport_avalanche_c_base_pairs.sql @@ -1,5 +1,5 @@ {{ config( - + schema = 'seaport_avalanche_c', alias = 'base_pairs', partition_by = ['block_date'], materialized = 'incremental', @@ -35,7 +35,7 @@ with iv_offer_consideration as ( when '2' then 'erc721' when '3' then 'erc1155' else 'etc' - end as consideration_first_item_type + end as consideration_first_item_type ,offerer as sender ,recipient as receiver ,zone @@ -98,7 +98,7 @@ with iv_offer_consideration as ( when '2' then 'erc721' when '3' then 'erc1155' else 'etc' - end as consideration_first_item_type + end as consideration_first_item_type ,recipient as sender ,from_hex(json_extract_scalar(consideration_item,'$.recipient')) as receiver ,zone diff --git a/models/seaport/avalanche_c/seaport_avalanche_c_schema.yml b/nft/models/seaport/avalanche_c/seaport_avalanche_c_schema.yml similarity index 100% rename from models/seaport/avalanche_c/seaport_avalanche_c_schema.yml rename to nft/models/seaport/avalanche_c/seaport_avalanche_c_schema.yml diff --git a/models/seaport/avalanche_c/seaport_avalanche_c_tagging.sql b/nft/models/seaport/avalanche_c/seaport_avalanche_c_tagging.sql similarity index 93% rename from models/seaport/avalanche_c/seaport_avalanche_c_tagging.sql rename to nft/models/seaport/avalanche_c/seaport_avalanche_c_tagging.sql index 64f22bb8a07..de859368a69 100644 --- a/models/seaport/avalanche_c/seaport_avalanche_c_tagging.sql +++ b/nft/models/seaport/avalanche_c/seaport_avalanche_c_tagging.sql @@ -1,4 +1,5 @@ {{ config( + schema = 'seaport_avalanche_c', alias = 'tagging', tags = [ 'static'], unique_key = ['blockchain', 'tagging_method', 'identifier']) @@ -11,5 +12,5 @@ FROM , ('avalanche_c', 'zone', 0x000000e7ec00e7b300774b00001314b8610022b8, 'OpenSea', 'Marketplace') , ('avalanche_c', 'zone', 0x110b2b128a9ed1be5ef3232d8e4e41640df5c2cd, 'OpenSea', 'Marketplace') , ('avalanche_c', 'tx_data_salt', 0x360c6ebe, 'OpenSea', 'Marketplace') - ) - x (blockchain, tagging_method, identifier, protocol, protocol_type) \ No newline at end of file + ) + x (blockchain, tagging_method, identifier, protocol, protocol_type) diff --git a/models/seaport/avalanche_c/seaport_avalanche_c_trades.sql b/nft/models/seaport/avalanche_c/seaport_avalanche_c_trades.sql similarity index 99% rename from models/seaport/avalanche_c/seaport_avalanche_c_trades.sql rename to nft/models/seaport/avalanche_c/seaport_avalanche_c_trades.sql index 5a477182eeb..f42e9d7baab 100644 --- a/models/seaport/avalanche_c/seaport_avalanche_c_trades.sql +++ b/nft/models/seaport/avalanche_c/seaport_avalanche_c_trades.sql @@ -1,5 +1,5 @@ {{ config( - + schema = 'seaport_avalanche_c', alias = 'trades', partition_by = ['block_date'], materialized = 'incremental', diff --git a/models/seaport/base/seaport_base_schema.yml b/nft/models/seaport/base/seaport_base_schema.yml similarity index 100% rename from models/seaport/base/seaport_base_schema.yml rename to nft/models/seaport/base/seaport_base_schema.yml diff --git a/models/seaport/base/seaport_base_tagging.sql b/nft/models/seaport/base/seaport_base_tagging.sql similarity index 92% rename from models/seaport/base/seaport_base_tagging.sql rename to nft/models/seaport/base/seaport_base_tagging.sql index 73c706fa245..4525103056c 100644 --- a/models/seaport/base/seaport_base_tagging.sql +++ b/nft/models/seaport/base/seaport_base_tagging.sql @@ -1,4 +1,5 @@ {{ config( + schema = 'seaport_base', alias = 'tagging', tags = [ 'static'], unique_key = ['blockchain', 'tagging_method', 'identifier']) @@ -10,5 +11,5 @@ FROM ('base', 'zone', 0x000000e7ec00e7b300774b00001314b8610022b8, 'OpenSea', 'Marketplace') , ('base', 'zone', 0x110b2b128a9ed1be5ef3232d8e4e41640df5c2cd, 'OpenSea', 'Marketplace') , ('base', 'tx_data_salt', 0x360c6ebe, 'OpenSea', 'Marketplace') - ) - x (blockchain, tagging_method, identifier, protocol, protocol_type) \ No newline at end of file + ) + x (blockchain, tagging_method, identifier, protocol, protocol_type) diff --git a/models/seaport/bnb/seaport_bnb_base_pairs.sql b/nft/models/seaport/bnb/seaport_bnb_base_pairs.sql similarity index 98% rename from models/seaport/bnb/seaport_bnb_base_pairs.sql rename to nft/models/seaport/bnb/seaport_bnb_base_pairs.sql index aaef714014d..f668407909c 100644 --- a/models/seaport/bnb/seaport_bnb_base_pairs.sql +++ b/nft/models/seaport/bnb/seaport_bnb_base_pairs.sql @@ -1,5 +1,5 @@ {{ config( - + schema = 'seaport_bnb', alias = 'base_pairs', partition_by = ['block_date'], materialized = 'incremental', @@ -35,7 +35,7 @@ with iv_offer_consideration as ( when '2' then 'erc721' when '3' then 'erc1155' else 'etc' - end as consideration_first_item_type + end as consideration_first_item_type ,offerer as sender ,recipient as receiver ,zone @@ -98,7 +98,7 @@ with iv_offer_consideration as ( when '2' then 'erc721' when '3' then 'erc1155' else 'etc' - end as consideration_first_item_type + end as consideration_first_item_type ,recipient as sender ,from_hex(json_extract_scalar(consideration_item,'$.recipient')) as receiver ,zone diff --git a/models/seaport/bnb/seaport_bnb_schema.yml b/nft/models/seaport/bnb/seaport_bnb_schema.yml similarity index 100% rename from models/seaport/bnb/seaport_bnb_schema.yml rename to nft/models/seaport/bnb/seaport_bnb_schema.yml diff --git a/models/seaport/bnb/seaport_bnb_tagging.sql b/nft/models/seaport/bnb/seaport_bnb_tagging.sql similarity index 94% rename from models/seaport/bnb/seaport_bnb_tagging.sql rename to nft/models/seaport/bnb/seaport_bnb_tagging.sql index f1d536f292d..7ccff6a69e4 100644 --- a/models/seaport/bnb/seaport_bnb_tagging.sql +++ b/nft/models/seaport/bnb/seaport_bnb_tagging.sql @@ -1,4 +1,5 @@ {{ config( + schema = 'seaport_bnb', alias = 'tagging', tags = [ 'static'], unique_key = ['blockchain', 'tagging_method', 'identifier']) @@ -12,5 +13,5 @@ FROM , ('bnb', 'zone', 0x110b2b128a9ed1be5ef3232d8e4e41640df5c2cd, 'OpenSea', 'Marketplace') , ('bnb', 'zone', 0xf397619df7bfd4d1657ea9bdd9df7ff888731a11, 'OpenSea', 'Marketplace') , ('bnb', 'tx_data_salt', 0x360c6ebe, 'OpenSea', 'Marketplace') - ) - x (blockchain, tagging_method, identifier, protocol, protocol_type) \ No newline at end of file + ) + x (blockchain, tagging_method, identifier, protocol, protocol_type) diff --git a/models/seaport/bnb/seaport_bnb_trades.sql b/nft/models/seaport/bnb/seaport_bnb_trades.sql similarity index 99% rename from models/seaport/bnb/seaport_bnb_trades.sql rename to nft/models/seaport/bnb/seaport_bnb_trades.sql index 7ce88cc2f84..c8f198f66f3 100644 --- a/models/seaport/bnb/seaport_bnb_trades.sql +++ b/nft/models/seaport/bnb/seaport_bnb_trades.sql @@ -1,5 +1,5 @@ {{ config( - + schema = 'seaport_bnb', alias = 'trades', partition_by = ['block_date'], materialized = 'incremental', diff --git a/models/seaport/chains/seaport_arbitrum_traces.sql b/nft/models/seaport/chains/seaport_arbitrum_traces.sql similarity index 100% rename from models/seaport/chains/seaport_arbitrum_traces.sql rename to nft/models/seaport/chains/seaport_arbitrum_traces.sql diff --git a/models/seaport/chains/seaport_avalanche_c_traces.sql b/nft/models/seaport/chains/seaport_avalanche_c_traces.sql similarity index 100% rename from models/seaport/chains/seaport_avalanche_c_traces.sql rename to nft/models/seaport/chains/seaport_avalanche_c_traces.sql diff --git a/models/seaport/chains/seaport_base_traces.sql b/nft/models/seaport/chains/seaport_base_traces.sql similarity index 100% rename from models/seaport/chains/seaport_base_traces.sql rename to nft/models/seaport/chains/seaport_base_traces.sql diff --git a/models/seaport/chains/seaport_bnb_traces.sql b/nft/models/seaport/chains/seaport_bnb_traces.sql similarity index 100% rename from models/seaport/chains/seaport_bnb_traces.sql rename to nft/models/seaport/chains/seaport_bnb_traces.sql diff --git a/models/seaport/chains/seaport_ethereum_traces.sql b/nft/models/seaport/chains/seaport_ethereum_traces.sql similarity index 100% rename from models/seaport/chains/seaport_ethereum_traces.sql rename to nft/models/seaport/chains/seaport_ethereum_traces.sql diff --git a/models/seaport/chains/seaport_optimism_traces.sql b/nft/models/seaport/chains/seaport_optimism_traces.sql similarity index 100% rename from models/seaport/chains/seaport_optimism_traces.sql rename to nft/models/seaport/chains/seaport_optimism_traces.sql diff --git a/models/seaport/chains/seaport_polygon_traces.sql b/nft/models/seaport/chains/seaport_polygon_traces.sql similarity index 100% rename from models/seaport/chains/seaport_polygon_traces.sql rename to nft/models/seaport/chains/seaport_polygon_traces.sql diff --git a/models/seaport/ethereum/seaport_ethereum_base_pairs.sql b/nft/models/seaport/ethereum/seaport_ethereum_base_pairs.sql similarity index 99% rename from models/seaport/ethereum/seaport_ethereum_base_pairs.sql rename to nft/models/seaport/ethereum/seaport_ethereum_base_pairs.sql index 779e6e09aca..7abe3857b21 100644 --- a/models/seaport/ethereum/seaport_ethereum_base_pairs.sql +++ b/nft/models/seaport/ethereum/seaport_ethereum_base_pairs.sql @@ -1,5 +1,5 @@ {{ config( - + schema = 'seaport_ethereum', alias = 'base_pairs', partition_by = ['block_date'], materialized = 'incremental', diff --git a/models/seaport/ethereum/seaport_ethereum_schema.yml b/nft/models/seaport/ethereum/seaport_ethereum_schema.yml similarity index 100% rename from models/seaport/ethereum/seaport_ethereum_schema.yml rename to nft/models/seaport/ethereum/seaport_ethereum_schema.yml diff --git a/models/seaport/ethereum/seaport_ethereum_tagging.sql b/nft/models/seaport/ethereum/seaport_ethereum_tagging.sql similarity index 97% rename from models/seaport/ethereum/seaport_ethereum_tagging.sql rename to nft/models/seaport/ethereum/seaport_ethereum_tagging.sql index f353c820d68..0205173f52b 100644 --- a/models/seaport/ethereum/seaport_ethereum_tagging.sql +++ b/nft/models/seaport/ethereum/seaport_ethereum_tagging.sql @@ -1,4 +1,5 @@ {{ config( + schema = 'seaport_ethereum', alias = 'tagging', tags = [ 'static'], unique_key = ['blockchain', 'tagging_method', 'identifier']) @@ -28,5 +29,5 @@ FROM , ('ethereum', 'tx_data_salt', 0x72db8c0b, 'Gem', 'Marketplace') , ('ethereum', 'tx_data_salt', 0x0021fb3f, 'Mint.fun', 'Marketplace') , ('ethereum', 'tx_data_salt', 0x1d4da48b, 'Reservoir', 'Marketplace') - ) - x (blockchain, tagging_method, identifier, protocol, protocol_type) \ No newline at end of file + ) + x (blockchain, tagging_method, identifier, protocol, protocol_type) diff --git a/models/seaport/ethereum/seaport_ethereum_trades.sql b/nft/models/seaport/ethereum/seaport_ethereum_trades.sql similarity index 96% rename from models/seaport/ethereum/seaport_ethereum_trades.sql rename to nft/models/seaport/ethereum/seaport_ethereum_trades.sql index 29803f0ca75..0fe86ad2147 100644 --- a/models/seaport/ethereum/seaport_ethereum_trades.sql +++ b/nft/models/seaport/ethereum/seaport_ethereum_trades.sql @@ -1,5 +1,5 @@ {{ config( - + schema = 'seaport_ethereum', alias = 'trades', post_hook='{{ expose_spells(\'["ethereum"]\', "project", @@ -18,7 +18,7 @@ select * ,seller ,buyer ,trade_type - ,trade_category + ,trade_category ,evt_type ,nft_contract_address ,collection @@ -72,7 +72,7 @@ select * ,seller ,buyer ,trade_type - ,trade_category + ,trade_category ,evt_type ,nft_contract_address ,collection @@ -116,5 +116,5 @@ select * ,is_private ,sub_idx ,sub_type - from {{ ref('seaport_v2_ethereum_trades') }} + from {{ ref('seaport_v2_ethereum_trades') }} ) diff --git a/models/seaport/ethereum/seaport_v1_ethereum_trades.sql b/nft/models/seaport/ethereum/seaport_v1_ethereum_trades.sql similarity index 100% rename from models/seaport/ethereum/seaport_v1_ethereum_trades.sql rename to nft/models/seaport/ethereum/seaport_v1_ethereum_trades.sql diff --git a/models/seaport/ethereum/seaport_v2_ethereum_trades.sql b/nft/models/seaport/ethereum/seaport_v2_ethereum_trades.sql similarity index 100% rename from models/seaport/ethereum/seaport_v2_ethereum_trades.sql rename to nft/models/seaport/ethereum/seaport_v2_ethereum_trades.sql diff --git a/models/seaport/optimism/seaport_optimism_base_pairs.sql b/nft/models/seaport/optimism/seaport_optimism_base_pairs.sql similarity index 99% rename from models/seaport/optimism/seaport_optimism_base_pairs.sql rename to nft/models/seaport/optimism/seaport_optimism_base_pairs.sql index 5d1761ff921..06bc2663e45 100644 --- a/models/seaport/optimism/seaport_optimism_base_pairs.sql +++ b/nft/models/seaport/optimism/seaport_optimism_base_pairs.sql @@ -1,5 +1,5 @@ {{ config( - + schema = 'seaport_optimism', alias = 'base_pairs', partition_by = ['block_date'], materialized = 'incremental', diff --git a/models/seaport/optimism/seaport_optimism_schema.yml b/nft/models/seaport/optimism/seaport_optimism_schema.yml similarity index 100% rename from models/seaport/optimism/seaport_optimism_schema.yml rename to nft/models/seaport/optimism/seaport_optimism_schema.yml diff --git a/models/seaport/optimism/seaport_optimism_tagging.sql b/nft/models/seaport/optimism/seaport_optimism_tagging.sql similarity index 93% rename from models/seaport/optimism/seaport_optimism_tagging.sql rename to nft/models/seaport/optimism/seaport_optimism_tagging.sql index 7c05aafe412..82add1d02e0 100644 --- a/models/seaport/optimism/seaport_optimism_tagging.sql +++ b/nft/models/seaport/optimism/seaport_optimism_tagging.sql @@ -1,4 +1,5 @@ {{ config( + schema = 'seaport_optimism', alias = 'tagging', tags = [ 'static'], unique_key = ['blockchain', 'tagging_method', 'identifier']) @@ -12,5 +13,5 @@ FROM , ('optimism', 'zone', 0x110b2b128a9ed1be5ef3232d8e4e41640df5c2cd, 'OpenSea', 'Marketplace') , ('optimism', 'zone', 0xf397619df7bfd4d1657ea9bdd9df7ff888731a11, 'OpenSea', 'Marketplace') , ('optimism', 'tx_data_salt', 0x360c6ebe, 'OpenSea', 'Marketplace') - ) - x (blockchain, tagging_method, identifier, protocol, protocol_type) \ No newline at end of file + ) + x (blockchain, tagging_method, identifier, protocol, protocol_type) diff --git a/models/seaport/optimism/seaport_optimism_trades.sql b/nft/models/seaport/optimism/seaport_optimism_trades.sql similarity index 99% rename from models/seaport/optimism/seaport_optimism_trades.sql rename to nft/models/seaport/optimism/seaport_optimism_trades.sql index 0544a8c56d6..3eec9337b9e 100644 --- a/models/seaport/optimism/seaport_optimism_trades.sql +++ b/nft/models/seaport/optimism/seaport_optimism_trades.sql @@ -1,5 +1,5 @@ {{ config( - + schema = 'seaport_optimism', alias = 'trades', partition_by = ['block_date'], materialized = 'incremental', diff --git a/models/seaport/polygon/seaport_polygon_base_pairs.sql b/nft/models/seaport/polygon/seaport_polygon_base_pairs.sql similarity index 98% rename from models/seaport/polygon/seaport_polygon_base_pairs.sql rename to nft/models/seaport/polygon/seaport_polygon_base_pairs.sql index 311a751c9b6..17881269c7c 100644 --- a/models/seaport/polygon/seaport_polygon_base_pairs.sql +++ b/nft/models/seaport/polygon/seaport_polygon_base_pairs.sql @@ -1,5 +1,5 @@ {{ config( - + schema = 'seaport_polygon', alias = 'base_pairs', partition_by = ['block_date'], materialized = 'incremental', @@ -35,7 +35,7 @@ with iv_offer_consideration as ( when '2' then 'erc721' when '3' then 'erc1155' else 'etc' - end as consideration_first_item_type + end as consideration_first_item_type ,offerer as sender ,recipient as receiver ,zone @@ -99,7 +99,7 @@ with iv_offer_consideration as ( when '2' then 'erc721' when '3' then 'erc1155' else 'etc' - end as consideration_first_item_type + end as consideration_first_item_type ,recipient as sender ,from_hex(json_extract_scalar(consideration_item,'$.recipient')) as receiver ,zone diff --git a/models/seaport/polygon/seaport_polygon_schema.yml b/nft/models/seaport/polygon/seaport_polygon_schema.yml similarity index 100% rename from models/seaport/polygon/seaport_polygon_schema.yml rename to nft/models/seaport/polygon/seaport_polygon_schema.yml diff --git a/models/seaport/polygon/seaport_polygon_tagging.sql b/nft/models/seaport/polygon/seaport_polygon_tagging.sql similarity index 94% rename from models/seaport/polygon/seaport_polygon_tagging.sql rename to nft/models/seaport/polygon/seaport_polygon_tagging.sql index 89f177ca942..20693755132 100644 --- a/models/seaport/polygon/seaport_polygon_tagging.sql +++ b/nft/models/seaport/polygon/seaport_polygon_tagging.sql @@ -1,4 +1,5 @@ {{ config( + schema = 'seaport_polygon', alias = 'tagging', tags = [ 'static'], unique_key = ['blockchain', 'tagging_method', 'identifier']) @@ -12,5 +13,5 @@ FROM , ('polygon', 'zone', 0x110b2b128a9ed1be5ef3232d8e4e41640df5c2cd, 'OpenSea', 'Marketplace') , ('polygon', 'zone', 0xf397619df7bfd4d1657ea9bdd9df7ff888731a11, 'OpenSea', 'Marketplace') , ('polygon', 'tx_data_salt', 0x360c6ebe, 'OpenSea', 'Marketplace') - ) - x (blockchain, tagging_method, identifier, protocol, protocol_type) \ No newline at end of file + ) + x (blockchain, tagging_method, identifier, protocol, protocol_type) diff --git a/models/seaport/polygon/seaport_polygon_trades.sql b/nft/models/seaport/polygon/seaport_polygon_trades.sql similarity index 99% rename from models/seaport/polygon/seaport_polygon_trades.sql rename to nft/models/seaport/polygon/seaport_polygon_trades.sql index c05670e3a51..898bc587ae2 100644 --- a/models/seaport/polygon/seaport_polygon_trades.sql +++ b/nft/models/seaport/polygon/seaport_polygon_trades.sql @@ -1,5 +1,5 @@ {{ config( - + schema = 'seaport_polygon', alias = 'trades', partition_by = ['block_month'], materialized = 'incremental', diff --git a/models/seaport/seaport_schema.yml b/nft/models/seaport/seaport_schema.yml similarity index 100% rename from models/seaport/seaport_schema.yml rename to nft/models/seaport/seaport_schema.yml diff --git a/models/seaport/seaport_tagging.sql b/nft/models/seaport/seaport_tagging.sql similarity index 96% rename from models/seaport/seaport_tagging.sql rename to nft/models/seaport/seaport_tagging.sql index 71cf6c25814..e28c0ce14ff 100644 --- a/models/seaport/seaport_tagging.sql +++ b/nft/models/seaport/seaport_tagging.sql @@ -1,4 +1,5 @@ {{ config( + schema = 'seaport', tags = [ 'static'], alias = 'tagging', unique_key = ['blockchain', 'tagging_method', 'identifier'], @@ -32,4 +33,4 @@ FROM ( UNION ALL {% endif %} {% endfor %} - ) \ No newline at end of file + ) diff --git a/models/seaport/seaport_traces.sql b/nft/models/seaport/seaport_traces.sql similarity index 97% rename from models/seaport/seaport_traces.sql rename to nft/models/seaport/seaport_traces.sql index 814f09a42b3..4e08d54c999 100644 --- a/models/seaport/seaport_traces.sql +++ b/nft/models/seaport/seaport_traces.sql @@ -1,5 +1,5 @@ {{ config( - + schema = 'seaport', alias = 'traces', unique_key = ['blockchain', 'block_number', 'tx_hash', 'evt_index', 'order_hash', 'trace_side', 'trace_index'], post_hook='{{ expose_spells(\'["arbitrum", "avalanche_c", "base", "bnb", "ethereum", "optimism", "polygon"]\', @@ -45,4 +45,4 @@ FROM ( UNION ALL {% endif %} {% endfor %} - ) \ No newline at end of file + ) diff --git a/nft/package-lock.yml b/nft/package-lock.yml new file mode 100644 index 00000000000..669f9637dc1 --- /dev/null +++ b/nft/package-lock.yml @@ -0,0 +1,4 @@ +packages: + - package: dbt-labs/dbt_utils + version: 1.1.1 +sha1_hash: a158c48c59c2bb7d729d2a4e215aabe5bb4f3353 diff --git a/nft/packages.yml b/nft/packages.yml new file mode 100644 index 00000000000..6152b330974 --- /dev/null +++ b/nft/packages.yml @@ -0,0 +1,3 @@ +packages: + - package: dbt-labs/dbt_utils + version: 1.1.1 \ No newline at end of file diff --git a/nft/profiles.yml b/nft/profiles.yml new file mode 100644 index 00000000000..10d52bd460f --- /dev/null +++ b/nft/profiles.yml @@ -0,0 +1,12 @@ +spellbook-local: + target: dev + outputs: + dev: + type: trino + user: trino + password: trino + host: trino + port: 1234 + database: hive + schema: wizard + threads: 1 \ No newline at end of file diff --git a/seeds/astaria/_schema.yml b/nft/seeds/astaria/_schema.yml similarity index 100% rename from seeds/astaria/_schema.yml rename to nft/seeds/astaria/_schema.yml diff --git a/seeds/astaria/astaria_lending_seed.csv b/nft/seeds/astaria/astaria_lending_seed.csv similarity index 100% rename from seeds/astaria/astaria_lending_seed.csv rename to nft/seeds/astaria/astaria_lending_seed.csv diff --git a/seeds/bend_dao/ethereum/_schema.yml b/nft/seeds/bend_dao/ethereum/_schema.yml similarity index 100% rename from seeds/bend_dao/ethereum/_schema.yml rename to nft/seeds/bend_dao/ethereum/_schema.yml diff --git a/seeds/bend_dao/ethereum/bend_dao_nft_lending.csv b/nft/seeds/bend_dao/ethereum/bend_dao_nft_lending.csv similarity index 100% rename from seeds/bend_dao/ethereum/bend_dao_nft_lending.csv rename to nft/seeds/bend_dao/ethereum/bend_dao_nft_lending.csv diff --git a/seeds/opensea/ethereum/opensea_wyvern_trades_samples.csv b/nft/seeds/opensea/ethereum/opensea_wyvern_trades_samples.csv similarity index 100% rename from seeds/opensea/ethereum/opensea_wyvern_trades_samples.csv rename to nft/seeds/opensea/ethereum/opensea_wyvern_trades_samples.csv diff --git a/seeds/opensea/ethereum/schema.yml b/nft/seeds/opensea/ethereum/schema.yml similarity index 100% rename from seeds/opensea/ethereum/schema.yml rename to nft/seeds/opensea/ethereum/schema.yml diff --git a/seeds/opensea/opensea_seaport_trades_samples.csv b/nft/seeds/opensea/opensea_seaport_trades_samples.csv similarity index 100% rename from seeds/opensea/opensea_seaport_trades_samples.csv rename to nft/seeds/opensea/opensea_seaport_trades_samples.csv diff --git a/seeds/opensea/polygon/opensea_polygon_zeroex_trades_samples.csv b/nft/seeds/opensea/polygon/opensea_polygon_zeroex_trades_samples.csv similarity index 100% rename from seeds/opensea/polygon/opensea_polygon_zeroex_trades_samples.csv rename to nft/seeds/opensea/polygon/opensea_polygon_zeroex_trades_samples.csv diff --git a/seeds/opensea/polygon/schema.yml b/nft/seeds/opensea/polygon/schema.yml similarity index 100% rename from seeds/opensea/polygon/schema.yml rename to nft/seeds/opensea/polygon/schema.yml diff --git a/seeds/opensea/schema.yml b/nft/seeds/opensea/schema.yml similarity index 100% rename from seeds/opensea/schema.yml rename to nft/seeds/opensea/schema.yml diff --git a/seeds/opensea/solana/opensea_solana_trades_solscan.csv b/nft/seeds/opensea/solana/opensea_solana_trades_solscan.csv similarity index 100% rename from seeds/opensea/solana/opensea_solana_trades_solscan.csv rename to nft/seeds/opensea/solana/opensea_solana_trades_solscan.csv diff --git a/seeds/opensea/solana/schema.yml b/nft/seeds/opensea/solana/schema.yml similarity index 100% rename from seeds/opensea/solana/schema.yml rename to nft/seeds/opensea/solana/schema.yml diff --git a/seeds/seaport/_schema.yml b/nft/seeds/seaport/_schema.yml similarity index 100% rename from seeds/seaport/_schema.yml rename to nft/seeds/seaport/_schema.yml diff --git a/seeds/seaport/seaport_ethereum_transfers_postgres.csv b/nft/seeds/seaport/seaport_ethereum_transfers_postgres.csv similarity index 100% rename from seeds/seaport/seaport_ethereum_transfers_postgres.csv rename to nft/seeds/seaport/seaport_ethereum_transfers_postgres.csv diff --git a/seeds/seaport/seaport_ethereum_view_transactions_postgres.csv b/nft/seeds/seaport/seaport_ethereum_view_transactions_postgres.csv similarity index 100% rename from seeds/seaport/seaport_ethereum_view_transactions_postgres.csv rename to nft/seeds/seaport/seaport_ethereum_view_transactions_postgres.csv diff --git a/seeds/seaport/seaport_trades_seed.csv b/nft/seeds/seaport/seaport_trades_seed.csv similarity index 100% rename from seeds/seaport/seaport_trades_seed.csv rename to nft/seeds/seaport/seaport_trades_seed.csv diff --git a/seeds/_sector/nft/_schema.yml b/nft/seeds/trades/base_trades/_schema.yml similarity index 96% rename from seeds/_sector/nft/_schema.yml rename to nft/seeds/trades/base_trades/_schema.yml index 81b1df99313..fa6df2383da 100644 --- a/seeds/_sector/nft/_schema.yml +++ b/nft/seeds/trades/base_trades/_schema.yml @@ -371,7 +371,7 @@ seeds: price_raw: uint256 platform_fee_amount_raw: uint256 royalty_fee_amount_raw: uint256 - nft_token_id: uint256 + nft_token_id: uint256 - name: zonic_arbitrum_base_trades_seed config: @@ -405,8 +405,8 @@ seeds: seller: varbinary nft_contract_address: varbinary price_raw: uint256 - nft_token_id: uint256 - + nft_token_id: uint256 + - name: campfire_avalanche_c_base_trades_seed config: column_types: @@ -416,7 +416,7 @@ seeds: nft_contract_address: varbinary price_raw: uint256 nft_token_id: uint256 - + - name: hyperspace_avalanche_c_base_trades_seed config: column_types: @@ -425,8 +425,8 @@ seeds: seller: varbinary nft_contract_address: varbinary price_raw: uint256 - nft_token_id: uint256 - + nft_token_id: uint256 + - name: joepegs_avalanche_c_base_trades_seed config: column_types: @@ -437,3 +437,18 @@ seeds: price_raw: uint256 royalty_fee_amount_raw: uint256 nft_token_id: uint256 + + - name: quix_events_seed + config: + column_types: + tx_hash: varbinary + buyer: varbinary + seller: varbinary + nft_contract_address: varbinary + project_contract_address: varbinary + tx_from: varbinary + tx_to: varbinary + royalty_fee_receive_address: varbinary + token_id: uint256 + block_date: date + diff --git a/seeds/_sector/nft/alienswap_base_base_trades_seed.csv b/nft/seeds/trades/base_trades/alienswap_base_base_trades_seed.csv similarity index 100% rename from seeds/_sector/nft/alienswap_base_base_trades_seed.csv rename to nft/seeds/trades/base_trades/alienswap_base_base_trades_seed.csv diff --git a/seeds/_sector/nft/archipelago_ethereum_base_trades_seed.csv b/nft/seeds/trades/base_trades/archipelago_ethereum_base_trades_seed.csv similarity index 100% rename from seeds/_sector/nft/archipelago_ethereum_base_trades_seed.csv rename to nft/seeds/trades/base_trades/archipelago_ethereum_base_trades_seed.csv diff --git a/seeds/_sector/nft/aurem_polygon_base_trades_seed.csv b/nft/seeds/trades/base_trades/aurem_polygon_base_trades_seed.csv similarity index 100% rename from seeds/_sector/nft/aurem_polygon_base_trades_seed.csv rename to nft/seeds/trades/base_trades/aurem_polygon_base_trades_seed.csv diff --git a/seeds/_sector/nft/blur_ethereum_base_trades_seed.csv b/nft/seeds/trades/base_trades/blur_ethereum_base_trades_seed.csv similarity index 100% rename from seeds/_sector/nft/blur_ethereum_base_trades_seed.csv rename to nft/seeds/trades/base_trades/blur_ethereum_base_trades_seed.csv diff --git a/seeds/_sector/nft/blur_seaport_ethereum_base_trades_seed.csv b/nft/seeds/trades/base_trades/blur_seaport_ethereum_base_trades_seed.csv similarity index 100% rename from seeds/_sector/nft/blur_seaport_ethereum_base_trades_seed.csv rename to nft/seeds/trades/base_trades/blur_seaport_ethereum_base_trades_seed.csv diff --git a/seeds/_sector/nft/blur_v2_ethereum_base_trades_seed.csv b/nft/seeds/trades/base_trades/blur_v2_ethereum_base_trades_seed.csv similarity index 100% rename from seeds/_sector/nft/blur_v2_ethereum_base_trades_seed.csv rename to nft/seeds/trades/base_trades/blur_v2_ethereum_base_trades_seed.csv diff --git a/seeds/_sector/nft/campfire_avalanche_c_base_trades_seed.csv b/nft/seeds/trades/base_trades/campfire_avalanche_c_base_trades_seed.csv similarity index 100% rename from seeds/_sector/nft/campfire_avalanche_c_base_trades_seed.csv rename to nft/seeds/trades/base_trades/campfire_avalanche_c_base_trades_seed.csv diff --git a/seeds/_sector/nft/chikn_avalanche_c_base_trades_seed.csv b/nft/seeds/trades/base_trades/chikn_avalanche_c_base_trades_seed.csv similarity index 100% rename from seeds/_sector/nft/chikn_avalanche_c_base_trades_seed.csv rename to nft/seeds/trades/base_trades/chikn_avalanche_c_base_trades_seed.csv diff --git a/seeds/_sector/nft/collectionswap_ethereum_base_trades_seed.csv b/nft/seeds/trades/base_trades/collectionswap_ethereum_base_trades_seed.csv similarity index 100% rename from seeds/_sector/nft/collectionswap_ethereum_base_trades_seed.csv rename to nft/seeds/trades/base_trades/collectionswap_ethereum_base_trades_seed.csv diff --git a/seeds/_sector/nft/cryptopunks_ethereum_base_trades_seed.csv b/nft/seeds/trades/base_trades/cryptopunks_ethereum_base_trades_seed.csv similarity index 100% rename from seeds/_sector/nft/cryptopunks_ethereum_base_trades_seed.csv rename to nft/seeds/trades/base_trades/cryptopunks_ethereum_base_trades_seed.csv diff --git a/seeds/_sector/nft/dew_polygon_base_trades_seed.csv b/nft/seeds/trades/base_trades/dew_polygon_base_trades_seed.csv similarity index 100% rename from seeds/_sector/nft/dew_polygon_base_trades_seed.csv rename to nft/seeds/trades/base_trades/dew_polygon_base_trades_seed.csv diff --git a/seeds/_sector/nft/element_arbitrum_base_trades_seed.csv b/nft/seeds/trades/base_trades/element_arbitrum_base_trades_seed.csv similarity index 100% rename from seeds/_sector/nft/element_arbitrum_base_trades_seed.csv rename to nft/seeds/trades/base_trades/element_arbitrum_base_trades_seed.csv diff --git a/seeds/_sector/nft/element_base_base_trades_seed.csv b/nft/seeds/trades/base_trades/element_base_base_trades_seed.csv similarity index 100% rename from seeds/_sector/nft/element_base_base_trades_seed.csv rename to nft/seeds/trades/base_trades/element_base_base_trades_seed.csv diff --git a/seeds/_sector/nft/element_ethereum_base_trades_seed.csv b/nft/seeds/trades/base_trades/element_ethereum_base_trades_seed.csv similarity index 100% rename from seeds/_sector/nft/element_ethereum_base_trades_seed.csv rename to nft/seeds/trades/base_trades/element_ethereum_base_trades_seed.csv diff --git a/seeds/_sector/nft/element_optimism_base_trades_seed.csv b/nft/seeds/trades/base_trades/element_optimism_base_trades_seed.csv similarity index 100% rename from seeds/_sector/nft/element_optimism_base_trades_seed.csv rename to nft/seeds/trades/base_trades/element_optimism_base_trades_seed.csv diff --git a/seeds/_sector/nft/foundation_ethereum_base_trades_seed.csv b/nft/seeds/trades/base_trades/foundation_ethereum_base_trades_seed.csv similarity index 100% rename from seeds/_sector/nft/foundation_ethereum_base_trades_seed.csv rename to nft/seeds/trades/base_trades/foundation_ethereum_base_trades_seed.csv diff --git a/seeds/_sector/nft/hyperspace_avalanche_c_base_trades_seed.csv b/nft/seeds/trades/base_trades/hyperspace_avalanche_c_base_trades_seed.csv similarity index 100% rename from seeds/_sector/nft/hyperspace_avalanche_c_base_trades_seed.csv rename to nft/seeds/trades/base_trades/hyperspace_avalanche_c_base_trades_seed.csv diff --git a/seeds/_sector/nft/joepegs_avalanche_c_base_trades_seed.csv b/nft/seeds/trades/base_trades/joepegs_avalanche_c_base_trades_seed.csv similarity index 100% rename from seeds/_sector/nft/joepegs_avalanche_c_base_trades_seed.csv rename to nft/seeds/trades/base_trades/joepegs_avalanche_c_base_trades_seed.csv diff --git a/seeds/_sector/nft/looksrare_seaport_ethereum_base_trades_seed.csv b/nft/seeds/trades/base_trades/looksrare_seaport_ethereum_base_trades_seed.csv similarity index 100% rename from seeds/_sector/nft/looksrare_seaport_ethereum_base_trades_seed.csv rename to nft/seeds/trades/base_trades/looksrare_seaport_ethereum_base_trades_seed.csv diff --git a/seeds/_sector/nft/looksrare_v1_ethereum_base_trades_seed.csv b/nft/seeds/trades/base_trades/looksrare_v1_ethereum_base_trades_seed.csv similarity index 100% rename from seeds/_sector/nft/looksrare_v1_ethereum_base_trades_seed.csv rename to nft/seeds/trades/base_trades/looksrare_v1_ethereum_base_trades_seed.csv diff --git a/seeds/_sector/nft/looksrare_v2_ethereum_base_trades_seed.csv b/nft/seeds/trades/base_trades/looksrare_v2_ethereum_base_trades_seed.csv similarity index 100% rename from seeds/_sector/nft/looksrare_v2_ethereum_base_trades_seed.csv rename to nft/seeds/trades/base_trades/looksrare_v2_ethereum_base_trades_seed.csv diff --git a/seeds/_sector/nft/mintsquare_zksync_base_trades_seed.csv b/nft/seeds/trades/base_trades/mintsquare_zksync_base_trades_seed.csv similarity index 100% rename from seeds/_sector/nft/mintsquare_zksync_base_trades_seed.csv rename to nft/seeds/trades/base_trades/mintsquare_zksync_base_trades_seed.csv diff --git a/seeds/quix/quix_events_seed.csv b/nft/seeds/trades/base_trades/quix_events_seed.csv similarity index 100% rename from seeds/quix/quix_events_seed.csv rename to nft/seeds/trades/base_trades/quix_events_seed.csv diff --git a/seeds/_sector/nft/sudoswap_ethereum_base_trades_seed.csv b/nft/seeds/trades/base_trades/sudoswap_ethereum_base_trades_seed.csv similarity index 100% rename from seeds/_sector/nft/sudoswap_ethereum_base_trades_seed.csv rename to nft/seeds/trades/base_trades/sudoswap_ethereum_base_trades_seed.csv diff --git a/seeds/_sector/nft/sudoswap_v2_arbitrum_base_trades_seed.csv b/nft/seeds/trades/base_trades/sudoswap_v2_arbitrum_base_trades_seed.csv similarity index 100% rename from seeds/_sector/nft/sudoswap_v2_arbitrum_base_trades_seed.csv rename to nft/seeds/trades/base_trades/sudoswap_v2_arbitrum_base_trades_seed.csv diff --git a/seeds/_sector/nft/sudoswap_v2_base_base_trades_seed.csv b/nft/seeds/trades/base_trades/sudoswap_v2_base_base_trades_seed.csv similarity index 100% rename from seeds/_sector/nft/sudoswap_v2_base_base_trades_seed.csv rename to nft/seeds/trades/base_trades/sudoswap_v2_base_base_trades_seed.csv diff --git a/seeds/_sector/nft/sudoswap_v2_ethereum_base_trades_seed.csv b/nft/seeds/trades/base_trades/sudoswap_v2_ethereum_base_trades_seed.csv similarity index 100% rename from seeds/_sector/nft/sudoswap_v2_ethereum_base_trades_seed.csv rename to nft/seeds/trades/base_trades/sudoswap_v2_ethereum_base_trades_seed.csv diff --git a/seeds/_sector/nft/superrare_ethereum_base_trades_seed.csv b/nft/seeds/trades/base_trades/superrare_ethereum_base_trades_seed.csv similarity index 100% rename from seeds/_sector/nft/superrare_ethereum_base_trades_seed.csv rename to nft/seeds/trades/base_trades/superrare_ethereum_base_trades_seed.csv diff --git a/seeds/_sector/nft/tevaera_zksync_base_trades_seed.csv b/nft/seeds/trades/base_trades/tevaera_zksync_base_trades_seed.csv similarity index 100% rename from seeds/_sector/nft/tevaera_zksync_base_trades_seed.csv rename to nft/seeds/trades/base_trades/tevaera_zksync_base_trades_seed.csv diff --git a/seeds/_sector/nft/x2y2_ethereum_base_trades_seed.csv b/nft/seeds/trades/base_trades/x2y2_ethereum_base_trades_seed.csv similarity index 100% rename from seeds/_sector/nft/x2y2_ethereum_base_trades_seed.csv rename to nft/seeds/trades/base_trades/x2y2_ethereum_base_trades_seed.csv diff --git a/seeds/_sector/nft/zk_markets_zksync_base_trades_seed.csv b/nft/seeds/trades/base_trades/zk_markets_zksync_base_trades_seed.csv similarity index 100% rename from seeds/_sector/nft/zk_markets_zksync_base_trades_seed.csv rename to nft/seeds/trades/base_trades/zk_markets_zksync_base_trades_seed.csv diff --git a/seeds/_sector/nft/zonic_arbitrum_base_trades_seed.csv b/nft/seeds/trades/base_trades/zonic_arbitrum_base_trades_seed.csv similarity index 100% rename from seeds/_sector/nft/zonic_arbitrum_base_trades_seed.csv rename to nft/seeds/trades/base_trades/zonic_arbitrum_base_trades_seed.csv diff --git a/seeds/_sector/nft/zonic_base_base_trades_seed.csv b/nft/seeds/trades/base_trades/zonic_base_base_trades_seed.csv similarity index 100% rename from seeds/_sector/nft/zonic_base_base_trades_seed.csv rename to nft/seeds/trades/base_trades/zonic_base_base_trades_seed.csv diff --git a/seeds/_sector/nft/zonic_zksync_base_trades_seed.csv b/nft/seeds/trades/base_trades/zonic_zksync_base_trades_seed.csv similarity index 100% rename from seeds/_sector/nft/zonic_zksync_base_trades_seed.csv rename to nft/seeds/trades/base_trades/zonic_zksync_base_trades_seed.csv diff --git a/seeds/_sector/nft/zonic_zora_base_trades_seed.csv b/nft/seeds/trades/base_trades/zonic_zora_base_trades_seed.csv similarity index 100% rename from seeds/_sector/nft/zonic_zora_base_trades_seed.csv rename to nft/seeds/trades/base_trades/zonic_zora_base_trades_seed.csv diff --git a/seeds/_sector/nft/zora_v1_ethereum_base_trades_seed.csv b/nft/seeds/trades/base_trades/zora_v1_ethereum_base_trades_seed.csv similarity index 100% rename from seeds/_sector/nft/zora_v1_ethereum_base_trades_seed.csv rename to nft/seeds/trades/base_trades/zora_v1_ethereum_base_trades_seed.csv diff --git a/seeds/_sector/nft/zora_v2_ethereum_base_trades_seed.csv b/nft/seeds/trades/base_trades/zora_v2_ethereum_base_trades_seed.csv similarity index 100% rename from seeds/_sector/nft/zora_v2_ethereum_base_trades_seed.csv rename to nft/seeds/trades/base_trades/zora_v2_ethereum_base_trades_seed.csv diff --git a/seeds/_sector/nft/zora_v3_ethereum_base_trades_seed.csv b/nft/seeds/trades/base_trades/zora_v3_ethereum_base_trades_seed.csv similarity index 100% rename from seeds/_sector/nft/zora_v3_ethereum_base_trades_seed.csv rename to nft/seeds/trades/base_trades/zora_v3_ethereum_base_trades_seed.csv diff --git a/seeds/_sector/nft/solana/_schema.yml b/nft/seeds/trades/solana_trades/_schema.yml similarity index 95% rename from seeds/_sector/nft/solana/_schema.yml rename to nft/seeds/trades/solana_trades/_schema.yml index e7e095a8bc5..bee7e58aa1a 100644 --- a/seeds/_sector/nft/solana/_schema.yml +++ b/nft/seeds/trades/solana_trades/_schema.yml @@ -78,3 +78,8 @@ seeds: taker_fee_amount_raw: double maker_fee_amount_raw: double royalty_fee_amount_raw: double + + - name: magiceden_solana_trades_solscan + config: + column_types: + tx_hash: varchar diff --git a/seeds/_sector/nft/solana/magiceden_mmm_solana_trades_seed.csv b/nft/seeds/trades/solana_trades/magiceden_mmm_solana_trades_seed.csv similarity index 100% rename from seeds/_sector/nft/solana/magiceden_mmm_solana_trades_seed.csv rename to nft/seeds/trades/solana_trades/magiceden_mmm_solana_trades_seed.csv diff --git a/seeds/magiceden/solana/magiceden_solana_trades_solscan.csv b/nft/seeds/trades/solana_trades/magiceden_solana_trades_solscan.csv similarity index 100% rename from seeds/magiceden/solana/magiceden_solana_trades_solscan.csv rename to nft/seeds/trades/solana_trades/magiceden_solana_trades_solscan.csv diff --git a/seeds/_sector/nft/solana/magiceden_v2_solana_trades_seed.csv b/nft/seeds/trades/solana_trades/magiceden_v2_solana_trades_seed.csv similarity index 100% rename from seeds/_sector/nft/solana/magiceden_v2_solana_trades_seed.csv rename to nft/seeds/trades/solana_trades/magiceden_v2_solana_trades_seed.csv diff --git a/seeds/_sector/nft/solana/magiceden_v3_solana_trades_seed.csv b/nft/seeds/trades/solana_trades/magiceden_v3_solana_trades_seed.csv similarity index 100% rename from seeds/_sector/nft/solana/magiceden_v3_solana_trades_seed.csv rename to nft/seeds/trades/solana_trades/magiceden_v3_solana_trades_seed.csv diff --git a/seeds/_sector/nft/solana/tensorswap_v1_solana_trades_seed.csv b/nft/seeds/trades/solana_trades/tensorswap_v1_solana_trades_seed.csv similarity index 100% rename from seeds/_sector/nft/solana/tensorswap_v1_solana_trades_seed.csv rename to nft/seeds/trades/solana_trades/tensorswap_v1_solana_trades_seed.csv diff --git a/seeds/_sector/nft/solana/tensorswap_v2_solana_trades_seed.csv b/nft/seeds/trades/solana_trades/tensorswap_v2_solana_trades_seed.csv similarity index 100% rename from seeds/_sector/nft/solana/tensorswap_v2_solana_trades_seed.csv rename to nft/seeds/trades/solana_trades/tensorswap_v2_solana_trades_seed.csv diff --git a/tests/_sector/nft/check_nft_rowcount_blur.sql b/nft/tests/check_nft_rowcount_blur.sql similarity index 100% rename from tests/_sector/nft/check_nft_rowcount_blur.sql rename to nft/tests/check_nft_rowcount_blur.sql diff --git a/tests/_sector/nft/check_nft_rowcount_superrare.sql b/nft/tests/check_nft_rowcount_superrare.sql similarity index 100% rename from tests/_sector/nft/check_nft_rowcount_superrare.sql rename to nft/tests/check_nft_rowcount_superrare.sql diff --git a/tests/_sector/nft/check_nft_rowcount_zora_v1.sql b/nft/tests/check_nft_rowcount_zora_v1.sql similarity index 100% rename from tests/_sector/nft/check_nft_rowcount_zora_v1.sql rename to nft/tests/check_nft_rowcount_zora_v1.sql diff --git a/tests/generic/check_seaport_seed.sql b/nft/tests/generic/check_seaport_seed.sql similarity index 100% rename from tests/generic/check_seaport_seed.sql rename to nft/tests/generic/check_seaport_seed.sql diff --git a/tests/magiceden/solana/magiceden_solana_assert_samples.sql b/nft/tests/magiceden/solana/magiceden_solana_assert_samples.sql similarity index 100% rename from tests/magiceden/solana/magiceden_solana_assert_samples.sql rename to nft/tests/magiceden/solana/magiceden_solana_assert_samples.sql diff --git a/tests/nft/ethereum/nft_ethereum_aggregators_markers_no_collisions.sql b/nft/tests/nft_ethereum_aggregators_markers_no_collisions.sql similarity index 100% rename from tests/nft/ethereum/nft_ethereum_aggregators_markers_no_collisions.sql rename to nft/tests/nft_ethereum_aggregators_markers_no_collisions.sql diff --git a/tests/nft/ethereum/nft_ethereum_collection_stats_test.sql b/nft/tests/nft_ethereum_collection_stats_test.sql similarity index 100% rename from tests/nft/ethereum/nft_ethereum_collection_stats_test.sql rename to nft/tests/nft_ethereum_collection_stats_test.sql diff --git a/tests/nft/ethereum/nft_ethereum_native_mints_test.sql b/nft/tests/nft_ethereum_native_mints_test.sql similarity index 100% rename from tests/nft/ethereum/nft_ethereum_native_mints_test.sql rename to nft/tests/nft_ethereum_native_mints_test.sql diff --git a/tests/opensea/solana/opensea_solana_assert_samples.sql b/nft/tests/opensea/solana/opensea_solana_assert_samples.sql similarity index 100% rename from tests/opensea/solana/opensea_solana_assert_samples.sql rename to nft/tests/opensea/solana/opensea_solana_assert_samples.sql diff --git a/scripts/check_schema.sh b/scripts/check_schema.sh new file mode 100755 index 00000000000..6ff8ffcc557 --- /dev/null +++ b/scripts/check_schema.sh @@ -0,0 +1,22 @@ +# Run the dbt command and capture its output and error +dbt ls $PROFILE --resource-type model --select state:modified,config.schema:no_schema --output path --state . --project-dir $PROJECT_DIR +test=$(dbt --quiet --no-print ls $PROFILE --resource-type model --select state:modified,config.schema:no_schema --output path --state . --project-dir $PROJECT_DIR 2>error_output.txt) +dbt_exit_status=$? + +# Check if the dbt command failed +if [[ $dbt_exit_status -ne 0 ]]; then + echo "Error: dbt command failed with exit status $dbt_exit_status" + echo "dbt error output:" + cat error_output.txt + exit $dbt_exit_status +fi + +# Check if the output of the dbt command is empty +if [[ -z "$test" ]]; then + echo "Success: All models have a custom schema" + exit 0 +else + echo "Found models without custom schema:" + echo "$test" + exit 1 +fi diff --git a/seeds/collectionswap/_schema.yml b/seeds/collectionswap/_schema.yml deleted file mode 100644 index 58476273202..00000000000 --- a/seeds/collectionswap/_schema.yml +++ /dev/null @@ -1,9 +0,0 @@ -version: 2 - -seeds: - - name: collectionswap_ethereum_trades_samples - config: - column_types: - amount_raw: decimal(38) - platform_fee_amount_raw: decimal(38) - royalty_fee_amount_raw: decimal(38) diff --git a/seeds/collectionswap/collectionswap_ethereum_trades_samples.csv b/seeds/collectionswap/collectionswap_ethereum_trades_samples.csv deleted file mode 100644 index 770b451f2bb..00000000000 --- a/seeds/collectionswap/collectionswap_ethereum_trades_samples.csv +++ /dev/null @@ -1,5 +0,0 @@ -block_number,tx_hash,buyer,seller,nft_contract_address,token_id,amount_raw,platform_fee_amount_raw,royalty_fee_amount_raw,description -17062425,0x4e2e4ec8d53f82be880c6da6345ced1f614e5cae74b49be6c8023a6e1db158f5,0xdf1943dfb5d1b7853a136848b32522d0ed9db5a9,0xec04a3b0f3a900ea5f24a3374caff08226f16bda,0x32973908faee0bf825a343000fe412ebe56f802a,1985,996400000000000000,0,47000000000000000,Buy -17062578,0x96792d636025ef3f8062f7a9578991ea9dc7ae8bae1863b48a7228dd8ad00cfd,0x2c893b54e24188764ab71bbb72baca8990dea2e4,0xec04a3b0f3a900ea5f24a3374caff08226f16bda,0x32973908faee0bf825a343000fe412ebe56f802a,257,1208400000000000000,0,57000000000000000,Buy -17007728,0x49d04addc5360fc7ea2f44cb2c679258bf4cf09c95ea0bf98f0eb56e77c7ab1d,0x9b83bb7860f7674acd855711d61b0c5f7b33a53d,0xf7ac4701ee00bb188d3c2c847721fd894a9ca501,0xfcb1315c4273954f74cb16d5b663dbf479eec62e,341,66000000000000000,0,33333333333333,Sell -17093561,0x93f8a1b1385904f782e6106545471ce650e7fa7bc17d3367ec07ae6094521823,0xec04a3b0f3a900ea5f24a3374caff08226f16bda,0xf7ac4701ee00bb188d3c2c847721fd894a9ca501,0x32973908faee0bf825a343000fe412ebe56f802a,5033,782100000000000000,0,39500000000000000,Sell diff --git a/seeds/foundation/ethereum/foundation_trades_samples.csv b/seeds/foundation/ethereum/foundation_trades_samples.csv deleted file mode 100644 index af4343a0079..00000000000 --- a/seeds/foundation/ethereum/foundation_trades_samples.csv +++ /dev/null @@ -1,18 +0,0 @@ -tx_hash,block_time,token_id,amount_original,buyer,seller,platform_fee_amount,royalty_fee_amount -0xe561e5bc95351dba0381676d867aeedc805f4121d2599055927fa7fda24c0b94,2022-12-19 19:05:59,21,0.355,0x3932f608f69eeb3e58ee067be0b03ca4d82da6fb,0x1f08cbfca1f63a23bb6255a76e1ddeeb8d24d0fa,0.01775,0.0355 -0x3aa4d62a4985ace80c77c4429519d8e2a896f7822d5eb9193cecbfc4717d1254,2022-12-19 13:03:47,103512,1.75,0x59d6779eca6c91ed7679e261b54299b5155eadf0,0xcafb98282f5ae4aa9083e031981e980cff1d9a79,0.0875,0.175 -0x2e57dd05cb9282df1f30da7acb3a9f454ada509a269507ce927b17c4229b0c0a,2022-12-19 07:08:11,28,0.04,0xc1a8c39598e41d5b2082d382527c72e2b419f1bd,0x38345b9d3b617e6125082963af9fc4255157366e,0.002,0.004 -0xb92503a6d12c3914b9fced60b0000a8aa9fcb22d6402cdbe4756190118f76010,2022-12-19 23:03:59,310,0.042,0x1f92fc15bcbeb4dd24eefbead8d7aee409f891dc,0x58e165378f92bcc86c531455ed9c1cac7075445f,0.0021,0.0042 -0xad2db80c707f4b60e1716a57167beed7cdf58ae305db36403b89dfd2fde3cc63,2022-12-19 00:24:47,12,0.07,0x7dbba2fa51a93c8a236aab356663d191e38445ee,0xb192318b236ded93c36b7def38649aa1f4613795,0.0035,0.007 -0x19eaa1a8e225b0ba8e1d18c7e7c94495d64c0e17f7c57fcf31c908001ce99558,2022-12-19 07:52:35,4,0.75,0x5efdb6d8c798c2c2bea5b1961982a5944f92a5c1,0x511531656cb4bea59d62f3b1f3bb8b1d40eebef9,0.0375,0.075 -0x06bd27c6e118e2c909fc7975c9dd006aa62c22a8a97f81f0b9fbee38e8019a38,2022-12-19 22:20:23,59,0.04,0x9e9081492c8c8bb906bb66da9621241d4b14f9a5,0x3932f608f69eeb3e58ee067be0b03ca4d82da6fb,0.002,0.004 -0x49d82611975cfd7a98becca24114a4d24a06a7d0f5378efd0981e39bf6fad7dd,2022-12-19 01:48:47,16,0.05,0x773d73174ed1c44a83fdd279a046af824927f46d,0x1307001ffd264dcef256ea0f7826fda218153f3e,0.0025,0.005 -0x1a36c872aa3f919dcf52f8a1fc71399bb2a59e7ac4ec03ca616ed4b26ca710e3,2022-12-19 18:01:11,3,0.01,0xd42d52b709829926531c64a32f2713b4dc8ea6f6,0xe78f417a343c76f0e9ec3439358b7e6f3f62640b,0.0005,0 -0xdd22f30a1f996a7fd134f2d628f5ec2d791252aa505ab3a8a3d91a9263cd9d4c,2022-12-19 10:46:59,2,0.09,0x4eda5e83e19c68e1858b923760dc8ae442902e65,0x7dd51b0247b288cb17ba8a581ed33aef6271f04d,0.0045,0 -0xbaed704c7e6ebf362464d67bc323f3ed4facb9b7f6bd701333d8f04487e2adac,2022-12-19 10:54:59,6,0.2,0x0616ba63e300db20c760a3a5edbab3f2cc32cba4,0x879364ef7d5db984204e5af509a7f02afb294d92,0.01,0 -0x5011038706d0f193785e4eeab55224ca378e66d58be0172e153f8e707661ba4a,2022-12-19 12:07:47,16,0.15,0xb2e1462847e6244f9931915ea2294005643b4861,0xd49e55b8078dec84a3c0315fd76d89047768d0a3,0.0075,0 -0x2de00158dcc8132757e1ae9ada367e66d7777aaddf216c7bb2934ca433e0629f,2022-03-31 21:52:16,2,1,0x0d6cfc385463ff9e6ab20a4a4f71f111b53a0942,0xcb97a05a140bf08fbba30a6fa43b3a30539f01a7,0.05,0 -0xdf385f25a17e44f7c459ae230d8e2a11021533a67de3d9f4473ec98c1fefa36c,2022-03-31 11:27:20,11,0.5,0xb73d416e440e5cc1cd9e4d4e1973cd58367c36ae,0xaabd8bb4881dc89a790a214024abf9a11c06e1b4,0.025,0 -0x020cbdee6b985cbc583e5d69c338d16e1a40187466fd123f4448c9e726e92802,2022-12-20 08:02:23,9,0.09,0x0b1456304be405ffd71ffc4002bf8cea6204734e,0x0e97bcb60145f6a6b56adc31250a9e0a0de6c813,0.0045,0 -0xbb7b7c9084cb77a99a88cb75b535a5d904b5160d14b71bcace4be30c996f8821,2022-12-20 09:59:47,8,0.07,0x48aed5215b5a1578b8274df885be4e655d9cf0cd,0x3cb11ca67aca2780b950d24e5524414e04000a44,0.0035,0 -0x7e0af3c11d118f004c4a137ce01d08c9b2dba8bc24dd71f64f03e4f7683e4480,2022-12-20 02:32:47,94535,2.5,0xd3d225b239f055065f0b7d6f48d90f866c344fe8,0x7f314be00306b7ce9b186f437574e52b5dfb384c,0.125,0.25 diff --git a/seeds/fractal/polygon/fractal_polygon_sample_trades.csv b/seeds/fractal/polygon/fractal_polygon_sample_trades.csv deleted file mode 100644 index 303879fdfee..00000000000 --- a/seeds/fractal/polygon/fractal_polygon_sample_trades.csv +++ /dev/null @@ -1,3 +0,0 @@ -block_number,tx_hash,nft_contract_address,token_id,buyer,seller,amount_original,platform_fee_amount -38585943,0xb70fa18ce0a42545a1bd9376a8c8817b2ad94fb003080a20207e1f5d1d701980,0x8d32d4a9514a66b2b0b9ee48d3ea782a2e76c271,825,0xbf56f31e7bd07672d73f9168c5730a4d76a6b9f4,0x30905f49342436d0294d35c48e14c0b6f5669f3f,1.45,0.0435 -40385666,0xc13a96ecd661f38e595017e5fd9a184c57564773206d682ab03c11ea45e775b2,0x5c1da3713627bc49473c68b4e1d53291d7f971af,30,0x09505ff87529fd3a18e7326b7dc47b0be1d5b666,0x2621e9638983138884855e7ff15c15fbc796a21c,0.2,0.006 diff --git a/seeds/fractal/polygon/schema.yml b/seeds/fractal/polygon/schema.yml deleted file mode 100644 index 4bb62da7b33..00000000000 --- a/seeds/fractal/polygon/schema.yml +++ /dev/null @@ -1,11 +0,0 @@ -version: 2 - -seeds: - - name: fractal_polygon_sample_trades - config: - column_types: - tx_hash: varbinary - nft_contract_address: varbinary - buyer: varbinary - seller: varbinary - token_id: uint256 diff --git a/seeds/looksrare/ethereum/looksrare_ethereum_seed_schema.yml b/seeds/looksrare/ethereum/looksrare_ethereum_seed_schema.yml deleted file mode 100644 index d833049f5c0..00000000000 --- a/seeds/looksrare/ethereum/looksrare_ethereum_seed_schema.yml +++ /dev/null @@ -1,16 +0,0 @@ -version: 2 - -seeds: - - name: looksrare_ethereum_v1_trades - config: - column_types: - amount_raw: decimal(38) - platform_fee_amount_raw: decimal(38) - royalty_fee_amount_raw: decimal(38) - - - name: looksrare_ethereum_v2_trades - config: - column_types: - amount_raw: decimal(38) - platform_fee_amount_raw: decimal(38) - royalty_fee_amount_raw: decimal(38) diff --git a/seeds/looksrare/ethereum/looksrare_ethereum_trades_postgres.csv b/seeds/looksrare/ethereum/looksrare_ethereum_trades_postgres.csv deleted file mode 100644 index 17711d6f67c..00000000000 --- a/seeds/looksrare/ethereum/looksrare_ethereum_trades_postgres.csv +++ /dev/null @@ -1,1002 +0,0 @@ -tx_hash,block_time,nft_token_id,original_amount -0x000062bbcb5d555e787620050a4fcda67568c8fb0fe27ff88f552107dfa73280,2022-01-21T23:30:09+00:00,2271,5.25 -0x0000b296dc9f331f08558d052b2847bbaaa0d6aa8ff459024087f68c61441e6d,2022-01-23T12:48:25+00:00,712,14.48 -0x000126afe5f4dd143d17a7107b1f56333f5733801c47840479a679edad0fbeaa,2022-07-02T10:24:08+00:00,574,0.059 -0x0001a119425231adf838c3f9361ca940e2955ba460270cd8f96eef6d38497a6d,2022-01-14T03:49:11+00:00,6473,2.2788 -0x0001cb665ba44910266144dcc29dfc6537949a2ff811df727c35cd8f7256042d,2022-05-18T01:35:46+00:00,9756,0.05 -0x0001d0d72db92ea3f928e86a05bd092adea86d8e00137da6d0b7efda9c9edd42,2022-05-01T07:20:58+00:00,1194,6.1 -0x0001e5d5f9c8713d0655b94de27027c3ca935ebe4568054cc8cf782870389c91,2022-01-26T21:37:21+00:00,1906,493.1 -0x00021a3ba32bc1ccce494acd6b26a5d70614f9fe61299671f35eddc4cfbf75ac,2022-01-29T22:57:09+00:00,269,0.01 -0x0002921098b624b02ddd589fc194214806cdf4e2933f73c13191e14f9d32235a,2022-03-04T20:20:57+00:00,1688,0.08 -0x000347d0b7984693edb8b228292139cbacc14de7cec6528e1a61a48ea49cccde,2022-06-22T09:43:36+00:00,3763,0.089 -0x000371193722b4323adb02ac542fcffceb58bdb6e835862938395bb1794ac024,2022-03-21T07:36:50+00:00,6366,0.25 -0x0003c0f0002aee02e4af37fabeb477277f749c0d3d537730a0dd6122e1891361,2022-01-31T22:13:13+00:00,2459,2.25 -0x0004c1bdb2e2449cb2fdbd6e6d8048320c1fec8b4ac5f2bf4060abe22d915ace,2022-02-01T21:01:09+00:00,5433,0.3 -0x00055a29b874eb7e03c933cf8102e644224e79a83685bfbd03123a656164afa5,2022-06-05T02:32:27+00:00,5312,1.1 -0x0006350270c7e03962dd216a69a47825427385a2fc90fa476efc6ce9cb087fac,2022-03-06T02:58:32+00:00,4459,0.017 -0x00064ce4027ecbbe61fb3c6f58b83c1d5199fc8a353c9e393a4d4697959ef092,2022-05-07T02:37:36+00:00,4808,0.275 -0x0006545d115c5cccb741d0483865ffba15eb8bc01721a80ac2d331291d5bc5ce,2022-07-03T02:03:47+00:00,421,0.015 -0x0006ab0ba330f1c69bd714f44d7c7dc26c8983e8c1bc3368626c0c45e411dbe8,2022-01-14T05:32:22+00:00,1164,0.069 -0x0006c5f7d751dc20335b313175bbf656c75cca7878790b188a463be8ad1c232b,2022-04-20T17:54:34+00:00,1124,0.3 -0x0006d2077cf76d0b75abb92542c4f3d6b733fa7842d57d59fc0031124499768c,2022-02-05T11:51:03+00:00,8934,0.86 -0x0007fed03c15b7dc7a4ac94f05e6edba748b21103484c7c3e71b7b756a69a89e,2022-02-21T01:50:40+00:00,1487,1.001 -0x000815ee6d9b892e59904cf4b04bfc42494e6231ce17f418761a9e983501cce8,2022-02-09T20:42:48+00:00,2272,0.45 -0x0008207da0de2060f286a50fc0947ba013f17424aaef47ec38622cefefa5bf48,2022-04-06T05:50:37+00:00,3302,0.45 -0x00082ef9c8ea698bb3306df6eb5dba0afcbf9cf3941d9558b530a9083196704a,2022-04-28T14:20:09+00:00,7120,0.15 -0x0008aae02b094b64eaa02537021b296ab4df17ea9bb308eeb5341af6e53e8726,2022-02-13T08:17:13+00:00,3803,0.315 -0x0008c48855593ef70da6f2b813a1a19c4b51fe9814179b515e78c5603c5f2ed0,2022-04-21T09:52:54+00:00,5011,0.3 -0x00093b7511b641448cca47221706d4e5db0f0d722027f88205a799e599c9d7bb,2022-05-24T17:27:51+00:00,7461,0.45 -0x0009744155b3f650425fb9befd096feb731ce95917992454eb82ddb67dacb4d5,2022-05-18T14:43:18+00:00,1,57.69 -0x0009859467cc1e8b1061dc060990689fe99e85c5c42c1692e87aacef139b68b9,2022-02-16T16:47:46+00:00,3416,0.05 -0x00098ec077a822817e4ea08c165167b2f82eac0c4d51b406835902bda0f8747f,2022-02-25T13:24:08+00:00,378,0.25 -0x0009df2711213651a8531d3410a23a67735f386b4f28557c21571b61d5f1c2a9,2022-02-07T08:22:55+00:00,16938,5010 -0x000a94446e536cc7b7d56ceacf8f49c709f17873f930f793d51682b18a2ee5a8,2022-02-09T14:35:36+00:00,6766,0.04 -0x000ae70551a6c30ac2aa1cbe697ad887da43c97f3380c080d7e04a3c9a3397f2,2022-05-18T04:37:29+00:00,3573,7.69 -0x000aee41f332e6a7f88ab51c5e14d0a953ff0425a57a204306b9cf471792805e,2022-01-18T17:02:55+00:00,8523,0.5 -0x000c3345ca3b872fcb6833d8ddd53ec8bb32afaf7c056ca37fcb4e8123441d0d,2022-02-04T23:21:50+00:00,11,0.5514 -0x000c55600afc9c679886ded1bab08d11ddf8129255e0fa4827f92af1c78ea7e5,2022-05-07T00:24:14+00:00,1189,620.419 -0x000ca5d18258fbc83a1b0e6338c0f8924a7b881c8a0dc4fb8b397d0944bd478e,2022-06-10T12:37:31+00:00,8077,0.279 -0x000d1d80ca3fbf1fc492b5df1387b911984b0e0faec4588173396fa5da935063,2022-05-08T14:31:01+00:00,11312,0.14 -0x000d2a080221a4481cd7708ac4c7a96c9672c86c4f5ea4ded3ef29f26804b1ba,2022-03-01T07:04:17+00:00,5742,0.46 -0x000d8882b914300ead3e67e632f6f534fd6ca015c1737df942a4eb2a67e2bab5,2022-05-25T12:57:43+00:00,3163,0.25 -0x000dae51165eb59ebe90816088b6c211735bb1b38e6ed6a83218a7b7b34aa07b,2022-01-15T21:12:52+00:00,8997,210 -0x000db24dc8217e4d8979f98c4032a42fe79a43f7d186fb2742a7ec81dc8dc5c7,2022-06-22T16:24:21+00:00,1134,0.2 -0x000dbb7fabd2a785583ebd10ceef74fdb4cd96a760a1df2fdabcf6c960ed924f,2022-06-15T03:56:17+00:00,3154,0.15 -0x000dd4f840c8e4811f032008d203a25c5bdd8fd007c3cdaf77e4e57ebb4469ab,2022-01-29T23:21:42+00:00,1,0.01 -0x000e7a87cfea4d9f62aaede70d63dc8f8f45297d157d40dab09bf050fe879803,2022-05-01T13:31:00+00:00,602,3.7 -0x000eae8bd8baa891cb4cf9d598b7b13f5ff279f72792d9b252e60e3ac3a0ea28,2022-02-04T23:17:50+00:00,5,0.4 -0x000ed271bf964af3d22e629393fd7f8eea94689af321a250b4c80f3a2da632a3,2022-02-03T18:35:24+00:00,7899,0.289 -0x000ee73961d273fb79e19e6a3b4767ec0d13fc4f3573f32ccf36b3f32de137c1,2022-01-19T23:25:39+00:00,689,143.889433 -0x000f5c920d4f45f57c6cf9fc789bd97f5fb2b442e63003d798451cfa8288eaff,2022-06-10T23:41:46+00:00,3637,0.19 -0x001023c8676b3a6e1d51c47ab3d59914adaf1777d4d89ec5c60f42b7a2582f02,2022-05-06T10:37:00+00:00,6945,104.8 -0x00103e7c025d33fa2f50de840eff467e5c9b9318fe5c3f98b1212bdcacc469da,2022-03-13T08:37:31+00:00,3664,0.0001 -0x00104ba80368f66fa04a835c85c845a8eff890dcbe54056849f8e196d48b70fb,2022-03-22T15:49:06+00:00,3209,0.34 -0x00108180e6908d4b274c2d8c64ceaf6bfa6481bb9fd4c7c79b771d01a7b679c3,2022-04-19T17:02:35+00:00,13354,1.27 -0x001085dbe758d36813bfe7269f0aeca4e97a25a4f0cb5867db5c9ef7070a9dcd,2022-03-15T19:42:30+00:00,7983,0.3 -0x0010ca65f1733cb6f5624c94674d9eb6fecf6ffc822264b4d4a15f1a85641798,2022-02-18T15:29:50+00:00,3904,0.15 -0x0010cc86232c2077c41a299709b721f037934ad60687c65e31a93734ec1a09c7,2022-05-26T12:13:37+00:00,475,0.35 -0x0010db571d2d7ca0a414d0b5307f3eda1234cf93c3251100f4aa39875df0a326,2022-01-12T19:19:23+00:00,244,0.01 -0x00114cdd2f4fed598ba0671dd3dd2e3d002c57a8211c188fbbae31408331ce09,2022-03-10T03:05:18+00:00,4012,0.08 -0x00118024806eafc9b4c8bd578bbb75c28d67117c4fc12c6328c0995d8151e861,2022-01-29T19:43:46+00:00,9788,0.98 -0x00119aabd3f56457975aed78446a7a824cac840fd167fa9f17cb21acebc37a99,2022-04-22T06:18:48+00:00,40,0.18 -0x001200fb24284a97a7a1b9987db4422afd9369db8bcffa49f36d62ffbb5ba7d1,2022-02-17T06:29:10+00:00,19058,2.12 -0x00127785697a2ee3b2a248981543235405b1ae05db84e5296e614801cd2390c8,2022-03-02T11:38:54+00:00,6964,0.1 -0x001284042ce85d3180f0792b2dd0f957b3e001763d664b7c52b224f4934c1a5b,2022-05-19T19:35:12+00:00,1748,0.0479 -0x00128c641927e5f91e5dd840df5b7130811275ee7aade13280e81bb9a4a0c9e9,2022-03-25T04:30:40+00:00,1948,360 -0x0012e0d0f97fa887fe899df1d2d66c0f49129723a2b5835e8f226cbaec126bc2,2022-06-17T09:59:07+00:00,3854,0.064 -0x0014570fae82a084683398c160ddf6c862347cb8a31fee4cd798ca974ae96369,2022-04-23T02:21:27+00:00,3334,0.011 -0x0014840f72e98ff594b4b30e322323057d30f907d250fa013e5227aca92de752,2022-05-31T17:17:31+00:00,3605,0.17 -0x00156e70c1171a44f30428779b5e9be8dc96d8f3ecb0b3a7c13ce3ae271dc2e8,2022-02-27T22:32:40+00:00,3278,0.99 -0x00157714385290a612770915c8122bcd333449860b22c5db9f8b0af40c514e41,2022-05-19T04:54:17+00:00,8908,0.154 -0x00158f34033714ce66735a0099f88cbcd852b65cd9ad1be6b65a460266e73b22,2022-05-13T10:28:39+00:00,2899,0.011 -0x00159c45f0bc39d31aa89a63cd8a273f65da10679b9592ecb1158131fddd3abc,2022-06-27T06:20:16+00:00,8786,0.7666 -0x0015f756d6c56c7ddcdc75dc7114d04d0abcf78adc0e4875b982f0803f4cd62f,2022-01-12T22:11:16+00:00,1685,4.2 -0x00160cc0a0fec556a8761f208decff1c3ddd0e4e73317553e515e13ba8787961,2022-02-02T02:49:07+00:00,3445,0.25 -0x001653f553f65aae45a7767e1b61b2811c67495b967077008a2c1e68bbdb60db,2022-05-01T05:14:39+00:00,53709,7.95 -0x00167ab6eb637b393480bdaff8c4dc8796d16093ea3275d67fc546b6ea31a4ca,2022-01-16T19:47:30+00:00,8246,0.46 -0x00169573be7fa5d2787c5a0ca7299ec4ebe7315e34e540e86b4894f0561a6e94,2022-01-26T21:19:00+00:00,1865,279 -0x0016a726a86da79cf764c1b5500e6598e8fb78205d66bd98666151bbb1a8cf64,2022-05-12T00:32:40+00:00,10294,0.1149 -0x0016fd72599db6b7f16321e19eb06fbd4ec8e4aea500fb5168197fe9f1341e1e,2022-02-23T03:27:19+00:00,11272,1.1 -0x00175377369b82331c140705bbc6f61d88fa6c39d730057ca632d12ecddf82dd,2022-03-16T15:41:20+00:00,9122,0.094 -0x0017df0c3bfcaf584bd841da85ab0a656df30784be0bdf2ed668d5dc44b5c7fb,2022-05-05T04:38:46+00:00,5937,0.18315 -0x00182424599775fff86b6d44dbd97d181809ada9ca6cec5c478fc89b384998c5,2022-05-18T03:57:30+00:00,3079,0.061 -0x00188271185e0d215a9352dcdbc268381fdfc7bdb394cc3cbc87d0d0ece6f531,2022-06-19T16:32:24+00:00,65314,2.26 -0x00188dc48384ca588d9360b7dd98344b705e0ae5315798500fddfd4ed427f633,2022-03-23T04:13:44+00:00,9559,340 -0x00189f2bff8a3c135a60a8535359ac66f93b296072c302e053dd97370ce7d613,2022-04-15T16:40:28+00:00,6874,0.175 -0x001941ceea3b6cfb11e2c2b4a86e6516294c556901e7f752353fbcd18d8a9313,2022-01-21T05:16:46+00:00,5105,0.88 -0x001951f5cbfc2f83469b242956f8657ddf76b660a9b9acb9027b48bbbde77aa5,2022-03-16T15:33:55+00:00,9728,450 -0x0019b24557b1048b4098b0893b25c5a68936c25f591533f7ead289050a4d53f1,2022-06-24T09:51:51+00:00,2894,0.2332 -0x0019eb1fcdcb7a26e223d45007b27968b55927d15bc6c528c3192c9e96cf6ee9,2022-05-14T19:22:27+00:00,9065,1.4 -0x001a017ca2c0d538dbd5f1665d1b64e3f549da2997ffcccc63722711a99faa9d,2022-01-11T11:58:07+00:00,6,1 -0x001a18143824278bb9599fa9d55c04b7b129bdf0739a82a46c68a2fd36597fa4,2022-04-20T23:53:24+00:00,745,0.49 -0x001a5a3ddd689816ba104bb381b06eb70f42fab032c8ddd0193769eb3ba06cbb,2022-02-07T03:31:01+00:00,9559,142.3 -0x001abffc978a8f4d9f85c6122738e82090cc774a593057fe631127120227a4fd,2022-05-18T19:56:41+00:00,8769,0.2 -0x001b21cb215b7384e135c0d7511ecfa5891b1f215084651fe5459216a81ac315,2022-03-09T18:46:59+00:00,4540,0.8 -0x001bce8ae206ba34ce01cf0b885bff73365cb692f30f55afb4bd33df3b032de9,2022-05-25T20:41:21+00:00,2,0.05 -0x001c4a4185a8ca96b9fd8dc832666685b7803da27935e9984fa0c7c72b92920f,2022-03-18T02:05:55+00:00,23,0.15 -0x001c57e9cdc42981356de09d6336ec7d5e07dba2f82984eb273f5e58f97a0c77,2022-01-25T22:37:06+00:00,15115,868 -0x001c8844fcbb56150741825aa17aefe40c4fee61e67116cc51df58a0eabe922e,2022-01-28T18:31:05+00:00,3741,975 -0x001d0e12ae891f7502a9a2dd57975a4335387fc9c06d7387daff777bbe19defc,2022-06-30T12:34:37+00:00,356,0.35 -0x001d6fb15e4cad79f330811c5cd68ad0c7cddaf77c1971484d464e37627d01a0,2022-05-18T23:23:41+00:00,8858,0.029 -0x001e21cf1faaf334623b6599a078961c39bbb6e4d777b7f00bc9f06f8e72dce1,2022-05-05T19:45:19+00:00,2126,0.1 -0x001e60c40f2d355bf809b4efc863647365d3f4334584d15f53b7fcb431cdea7f,2022-05-05T22:55:46+00:00,7607,0.103 -0x001ea6bd1c840edd7e10eba3fc9c7e9dbcf95a2dff968db56741483e37b080d3,2022-04-14T03:29:21+00:00,532,0.2142069 -0x001ed8101cd25e30436cf474578f26768766ecf2ed390560652e823b2bdf75c8,2022-04-27T03:42:41+00:00,2781,139 -0x001fbaf98f7484b7874a6fc9b54590ccbba190371183e063ef154f33ab46a183,2022-06-28T02:03:34+00:00,18277,87.15550991 -0x00203e45f958544b8ad4fe2da236b926df9fed942d8488e7cd0b268746d2ba10,2022-01-16T21:19:28+00:00,5438,0.15 -0x00205cdeed094cd1e0b45cc1d5664611f5554d64df5a74e6f258160e166ec10f,2022-03-08T04:15:39+00:00,9728,586 -0x0020dae274a427ec25e34d008f8478ac91e86b8236256750dfbff4206e777a48,2022-05-20T11:03:44+00:00,64195,3.22 -0x0020fcb17a7c83ac950692f672183f291c275ce8d5c5b4031a8be7ebb8f6e596,2022-01-26T14:08:50+00:00,7315,0.5 -0x00215c9edc55d9f64163be61477daabb0797e2ffaa82ab4facc0b3764be41ffe,2022-04-29T13:37:58+00:00,2325,0.14 -0x002166c95feda00057d48593d37837c395b0b4ecafefbd2c7e24c70a118e4bfe,2022-05-03T04:35:14+00:00,3377,0.1769 -0x0021a1d975cedba0b3001fcdc7cafe6f7fca0d4514cd53346ea5c7598296ec8e,2022-04-19T01:13:19+00:00,356,4.79 -0x0021bf0e3bc3a98a12c10ccfa2539b27fc4ef01e0d0fd176cee5d70debfd7a3e,2022-03-18T02:32:49+00:00,1,0.2999 -0x0021f3c021fc7528e94f3959c20311d1240dc083ac89a328969bf945baf79d0a,2022-02-16T17:30:54+00:00,8314,0.62 -0x00225e477b567d9f5b083a81ce00525c74ce3b8ab6b6cc43852a6245072b1f56,2022-04-25T23:42:51+00:00,565,3.43 -0x00226c0b60f8d4119fdce7e5e93356bc595f229941f76c09a9d3497c5a041e8d,2022-03-03T05:51:41+00:00,4008,0.01 -0x0022b9f02997f755e25b767b853b2b783d98cc302c1725c7cda6508d172fcdfa,2022-01-29T08:32:19+00:00,689,206.7194201 -0x0022c82f16eae138dbe4ca79ad58545afc709cd6789c4354fca73b1e10c6808d,2022-03-11T02:05:48+00:00,9559,511 -0x00238880b1e54ed6a74563e865f500ac5320277cb14b325ce3eb789c74e6372a,2022-01-18T04:41:41+00:00,66,0.07 -0x0023bd18d57ae202cd278a78623c960749e1c5fa04a3a6d0915c72983fbc998c,2022-04-29T15:23:26+00:00,1702,0.39 -0x0023c75f16ea10df1b593f36bfa3bc6951151e7735e0771566c6d4dd36594ff2,2022-02-28T13:15:05+00:00,7206,0.019 -0x00243f991b32c5e6d05e394c04ccfc612920bbc1612e8e9469d20674d6ffea97,2022-05-13T11:51:29+00:00,60098,3.055 -0x0024733ffc87886867d61aba1b47b0e980beae0cbe76c0448d7d13fcc2246308,2022-04-22T15:35:59+00:00,6144,1.2 -0x00248ef4fc277de481260313b1ae224b9c0dd534d16dd10d9e448828f7455360,2022-02-01T14:08:40+00:00,1609,0.35 -0x00250caedc5b2fe2ce2f98ddb1cfc27b68f5f62905597e51bb74a27d3ec8551b,2022-05-27T15:17:33+00:00,1408,0.3188 -0x0025192cc4804126faa328f44d3dea4e3a53a2f97487668079947df83386d7ab,2022-06-03T13:53:20+00:00,5188,0.16 -0x00257c0670f2d9442f69a927aa1e51f787e5475e28bc2507f2115a108ff03dab,2022-01-24T21:54:37+00:00,2727,79 -0x0025f4dc8812589ae52568c90bb1b35fea1aa944322e95770a6fb457e2d17f05,2022-05-05T08:30:33+00:00,3170,0.011 -0x0025fb552aa216b72de0e02a3ca37dadcca2761cb5935e578cb5667e5785ee5f,2022-05-17T15:24:10+00:00,4770,0.15 -0x00267146acde12665d222b36ad0b443db3b2aa7085f013487831453bb8138a4e,2022-05-08T20:20:05+00:00,228,18.65 -0x002687aff7a8132c5f4b1ea42dca9bde6264e57653debf9210921f2704f74637,2022-01-25T22:38:44+00:00,5283,382 -0x00268c068c881ea4a91ab6e8af374abfb367465730b89325123cd4fdf124de7e,2022-05-01T12:03:44+00:00,5538,30.88 -0x0026cde83aa3be57c2deaa1e22dabaa71e349d310d77a57cdc579200026f6902,2022-03-03T00:34:42+00:00,1973,0.35 -0x0026e6c1b918aa908f19ee93d1aae23606e17b4380df1761a4fa93c5e4d303d9,2022-04-07T15:55:06+00:00,2768,0.15 -0x0026f8f2d36cecaada4837d74291bb786ea6a64ea224fd90667b5073806b5ed1,2022-06-08T08:49:47+00:00,94,0.925 -0x0027687093ae3ac5aba0f6fe5956eea5a695baa226da978257e20e33aa7ac21b,2022-02-12T20:14:29+00:00,7044,0.739 -0x002880df3938f7556112a1977790bce1183fcce9cf07148bcfb01f6c6c0fdb10,2022-04-01T05:19:56+00:00,1948,493.5 -0x0029035976cbda6d966aac3d68ebdc62c6aae205730ca0bf88b4db2d648e3032,2022-01-13T13:40:20+00:00,168,152.2 -0x0029197acf34bb39d3ea97fd1f4c972a45c2d1957cb755f41c3de2bf18f3b468,2022-05-11T07:30:09+00:00,7595,0.15 -0x00296e0857df7952e8b98a8370283145d81f3890fbfa2ebd785115c662c552fd,2022-01-18T11:32:29+00:00,5303,1.066 -0x002a1b55ceb602255f0c9eb03a33a57ecf53fa703ee82ae8edbf2bf856173b09,2022-01-31T19:57:17+00:00,7244,4.85 -0x002aa1e0b51f435007d3f2f5be20a4d94d3669787c16deab77d11ff82dd5a785,2022-01-10T18:35:52+00:00,4503,0.0001 -0x002ba2eaa3d08db8f0695d454a3524993a4319d007ba536b726d87bef76755b1,2022-02-16T15:08:28+00:00,4407,0.35 -0x002bd17982040018c9bdc52c68fcd8eb16aa7e19552a6697dcea8bd1baf5bdb4,2022-05-27T23:10:21+00:00,536,0.002 -0x002bf5615464f39837ffc3d52e482a35e4def63a1bc7edb6a51f3dd60c0dcabf,2022-02-07T03:43:42+00:00,10783,0.42 -0x002c1a665f04a97f62f536a33f50aead55512e769dc0b5561851a1a0c3fd3d20,2022-01-28T13:30:45+00:00,4384,0.219 -0x002c63bc2376f1e78348dd40362e82e2ddd8cf31e19cd5c848f4c0a6ef86fe6e,2022-06-22T09:20:53+00:00,7121,0.331 -0x002ca2de243665df939090da3caf6b6c6cf9e7d7976c9d434389d6325bb95afc,2022-03-02T12:52:19+00:00,1045,0.198 -0x002ce9df4ac86bedee0f081c4c7b558c748500a424a55d1cd449b6946a581f9b,2022-01-29T07:47:10+00:00,10255,169.12 -0x002cfb40e7bb9d3ee5b20e682a236516c91e1600eebb4b2cc387a8e9d3d6f8e2,2022-01-20T17:44:42+00:00,5527,0.3 -0x002d39b44a8c9ea8be0a75563bfe1cbd7d77d737b242cd49f46c276070528a61,2022-02-16T11:16:20+00:00,5480,0.033 -0x002dbbc1c1634fc8477b99cf1eab0880a304424489c8f2cf4df8091d79fc938b,2022-06-13T16:17:41+00:00,97835,1.7 -0x002ddfd021636dc2d59288434d4a93ae9df98b489daf693bba9b617aa6a180cf,2022-06-25T15:40:51+00:00,3278,0.02 -0x002e321e2af5e2d7f1a15028c5922a54297cd468f833d24b5d1c4bbcda7072ee,2022-02-02T00:19:54+00:00,9,0.229 -0x002edf1434cfc5d134a083618242956dbada346012e98ad54de54819be6b26c7,2022-03-18T05:10:03+00:00,2804,8.88 -0x002f558b406bb36a1c154b8b037cfadc10a4ef356a8ac1e740ae620afde272ee,2022-04-30T08:24:01+00:00,8410,0.1405 -0x002f5ecb2608c6d6c1948352395b4f562777402e6fd3d535bcbe9116553e2dd6,2022-01-11T00:46:24+00:00,2718,0.15 -0x002fa006071f475eac7a7040fb21fb65dd56e6a43e2f571eedd6be804d7effee,2022-04-04T07:03:46+00:00,1484,0.43 -0x002fc9d1c4ce6819367289f9d936a199ea9d9af63e7537c271ebf6bfc1212f6d,2022-02-05T17:39:14+00:00,8362,0.41 -0x002ff659bf53d0a1cc9bd5c6a3640e7442213733229bdebcfbd1838994a3009c,2022-04-24T14:18:35+00:00,5618,0.219 -0x003001c02e9e0ae24d7f338b02df50710ac721fff001ea8297b117e9ec19d723,2022-06-07T05:02:54+00:00,7269,0.17 -0x0030fc3200a080ac36fdeb8347cb00885b0df10ef63ec999242ed3c7c364298d,2022-04-07T23:21:07+00:00,1805,0.09123 -0x003143b7a42164963636c4c73c40503036b4b5989b68ed3f8cdab8cdfc473ae9,2022-06-21T05:00:44+00:00,5354,11 -0x0031ba17ce753dba17f45ad4c49a6b8823e21794d056dfc3e988bac91b6c99d9,2022-03-16T03:01:16+00:00,15178,0.3 -0x0031cafd1ccf279220e4d464e4a7d05a27f094798688285e73a1243d9931e319,2022-02-06T11:29:03+00:00,8449,1.0101 -0x0032f46d5c06e5f0860f27ac478f87e9bbe91316ad98f18aa652326cb14444f1,2022-01-23T11:39:30+00:00,1052,0.08 -0x0032f686d7ce87b664d349f196f92de2682f6648f5d0546e9dd552eb3e2ebc05,2022-02-06T02:03:48+00:00,5283,245 -0x0034070c6e951d21b4e0c7fcc97d7b74005c3d85d0a77b1d1528f502be42394b,2022-05-28T20:08:13+00:00,9635,2.57 -0x00340e56833edbeecbd9116358110b31878d0f66745f71e47b7134763d7267d7,2022-04-20T19:33:42+00:00,3231,0.25 -0x00358f800cbf35fce6c2899182d7ff1b7010a2b21e4389b22f12feebd347186a,2022-05-12T14:33:53+00:00,17222,4.595 -0x003592c0fbb469ff8def691acda00c5b4a03e6648e89d0f7b9b65657b557f9ac,2022-04-15T14:27:55+00:00,4119,0.23 -0x0035d0c556a39ada4254a2d521a11dc8d730c3c0e14ba612e9c70610a1e47162,2022-05-20T01:24:10+00:00,6338,0.571 -0x00360001f1036336412ec091ca8f7633ede31bf47def182292ddc7c9f41a9bec,2022-01-12T22:20:14+00:00,1075,0.3 -0x00360935e16b347b3169f72e8779be297ec93ae7b811f79dac736711323b2b86,2022-01-31T19:00:22+00:00,2,0.51 -0x00363b87c75873c1cf73595d100008aa5c402c45a103baf45f8d39ddb7faa60b,2022-05-29T06:58:02+00:00,2717,0.42 -0x00365e255cfcc32734b9da94369263d33a21c36196f42a1a61ebad90bba05f98,2022-03-11T10:54:55+00:00,1361,0.02 -0x003668e67f06888f9f92ffe3f5e11d271d05e1a4346f83561b2f188c06d76502,2022-05-05T19:32:21+00:00,18179,4.2 -0x0036a281b9a0366edc63673b23b26b388fc4c0d3d1f2f7c8593850be34494b32,2022-05-28T22:41:14+00:00,1671,0.215 -0x0036d91769064df2da62f027765b98e810094fe0f449a4fff087fbe422e25cd7,2022-01-12T05:08:19+00:00,2323,0.5 -0x0036d9eaf96e4f3bac012aed793a32506e17a7b9e1e36426974d3b15e56d5575,2022-02-09T09:15:06+00:00,925,0.2 -0x00372ae909eeb3f98a4da0afa6f6d51f8d4cc96e2a00cb9046054848d72c998d,2022-03-25T20:48:39+00:00,18493,0.15 -0x00375db5c478bd901e0b417a89bea71b80155ff246b6b790257c2a1ef6fb8774,2022-05-07T16:18:55+00:00,1390,0.025 -0x0037f1a26c6ad5340515de691f5598bb3019db3300dd8a41b7ddd072ff210f99,2022-01-24T12:34:32+00:00,2363,0.34 -0x00382f78b6e3fd4957bf1f7bfbf5611ca8584aef412585c17e5c7e14d09a4a03,2022-04-18T04:40:15+00:00,2163,0.5 -0x00383dda5d161682f0f33f2eabc946782e26477351c82f3372d611583cfe9f34,2022-02-09T15:42:03+00:00,8119,0.52 -0x0038c310ecd151379010ca209a524fb969e002d8da35035602712087043e2770,2022-02-16T19:33:06+00:00,2645,0.2 -0x0038e76c1f7a08991e1b9e4901957e5fb075adea55281c76bbcc66e53b9f2091,2022-02-22T18:45:16+00:00,18389,1.84 -0x0039952a47f8c6cc45ed020cff0bf30ac406dc2695e90a015822ad44f016292a,2022-02-25T18:46:10+00:00,18711,0.61 -0x0039c488b516502eaa9df07d67ec5c30c3186e1be3bcd77d1301b9788abe8f42,2022-03-06T19:50:42+00:00,2786,0.495 -0x003a2490a54a7b3c1014e0746ec53aef11113e1939554cac5ae9b77cf641c23b,2022-06-07T18:52:07+00:00,1516,0.99 -0x003a31aa357fb4555bd9e19c3f3c63111ef9abe1ead55eb28d1ac069ff0de7b5,2022-01-20T23:25:45+00:00,19497,569 -0x003a3df04060b993c17c1cbeb09386264aeccaf68881e524cdda8f20680e80e6,2022-01-22T20:46:43+00:00,9728,420 -0x003a5d7fef8819dac4736e89fa8297430a0cae24ae2e646b6087bbdbdae3ddfb,2022-05-06T03:37:14+00:00,4305,3.2 -0x003ab0078487a76224ade0384380137ba3c7bfa414a9b4b42f27676ea252c415,2022-04-05T08:43:29+00:00,930,0.031 -0x003ab671357022982707b6e1cc8f7944c0753aa8766eebfdba3e36a6b6612406,2022-05-26T10:11:26+00:00,6229,0.36 -0x003b3e1849b96a90528d9b0b7103cc0ed5466e88595ef059fc0a1954502073cc,2022-06-25T09:07:23+00:00,1076,0.0821 -0x003b66668b12351bfdd9d77fe9889d897433a4fc00654572d8b5f6b444e2e7bb,2022-02-25T17:41:30+00:00,2224,0.05 -0x003b95ee97ff0e27875bbec733eca38ddc7911b6569bae26061b7ba83f80a173,2022-06-02T06:27:05+00:00,724,0.04 -0x003be4bd84d237b8b1d985a220b98622806adc077c3bf7bee845a0376f78e1c1,2022-02-02T10:10:52+00:00,2289,0.07 -0x003cf3f46e6b9bd84a42de9847a9dc8e9e8c794863192483f5116f8cea71f754,2022-03-27T17:50:48+00:00,2959,0.41 -0x003d5d88a778e98c081ec3f8b47524f5cfc02378726aadf303ca6330071b58f4,2022-04-10T09:08:43+00:00,3468,0.24 -0x003da304f9dc9d40ac20edd02ecb4477cd12e8c7afd6a5648f611abdb4ff323a,2022-06-01T05:32:26+00:00,1703,0.17 -0x003da79d447d581d1c469ac62dba92be3e6aaab0c5306ad17238d426b9370dba,2022-04-08T12:19:04+00:00,8099,0.14 -0x003dad1bd025160b322988d2515794ac36bb063ea812099e9d699252edca7f2c,2022-05-17T00:27:00+00:00,865,0.1 -0x003db058a8036beaf1bafee621e11820c73a845d8559077efd9b1851860b1197,2022-04-10T19:13:42+00:00,4908,47.5 -0x003e3b33165841b4d9e7ed0c720770da0b2a4ca57b56aa187b2edc61f84f9187,2022-06-06T02:21:36+00:00,4008,3.84 -0x003e46957d95bc43166c31739c13d376189038192d7fdfe934d5426ae22e2b88,2022-05-26T02:36:41+00:00,5199,1.449 -0x003e6bb86702f7b062344dca10e7cc3e0a180a8daaaf84f418cd4a179262c337,2022-03-18T01:18:48+00:00,1496,0.2507 -0x003eeeb92fa58e45422bdc998f7ff8d97a7b3f6b4ca1e524fa68cd9e8c400fb0,2022-02-23T06:59:35+00:00,6012,0.47 -0x003f28dccd9443a070369d23f3eb82e44bbfcbd64e59ac20f25ca3ab4be7995a,2022-03-29T22:29:05+00:00,7750,0.021 -0x003f930ed748f6c3a4c29460a0590fe681e7b7a9772c0d8a7d72d693b9d46315,2022-01-17T15:39:57+00:00,1649,1 -0x003fe5742194faac05f1a0f74b2cb3698f60dfbfb42fd73793cc315d429863a5,2022-02-02T10:52:34+00:00,16082,0.068 -0x003ff38645d6765111523516a57a347aa0bad31e3b9f8992880e0407d3f6651f,2022-05-03T05:03:17+00:00,9084,0.2121 -0x004003574da5565b0c383dff1cf920d20c31509ba225ffc74b12518570aeb244,2022-02-01T14:48:44+00:00,7158,0.31 -0x004004ec7a650bdc6e6f05880bc02b3fd6fe2cb6d6e4257f4823b95cbeb382e4,2022-04-16T22:22:45+00:00,14564,5.05 -0x0040b46351f3e8f4233720f63abd230c6e78b70ec87612c760436bcde455fb6d,2022-01-18T20:47:11+00:00,3110,0.1 -0x00415387322a937c816e28822424e4221d2f94ad43d921ab5a6c37b6307d4e64,2022-05-02T20:10:13+00:00,3831,0.1518 -0x0041f104700144607cb6308fb6b702819b2fff44373b9309d520850a11a1ffb5,2022-05-03T06:18:52+00:00,3020,24 -0x00423a5dbda475b872f0b5f5d5f313757e1df7e888e73606725fad43a3805e27,2022-01-13T14:31:39+00:00,864,0.02 -0x00425ba48c653b8de20e1a8abdf9aad75bb86232911811be0af426e1893a534c,2022-03-31T20:57:39+00:00,5447,48 -0x004371e18924d073d4c2b792431a6524ec22528cfc6bd8a675ec5925c090b04a,2022-02-27T00:31:25+00:00,6059,0.0808 -0x0043a11c816760f7809b529c0cec76778c8fb815fb27d6cabf7bbe8fc4dc2607,2022-05-03T01:46:07+00:00,2161,1.8 -0x0043a645632bd028bbf816d39af33e375b8e0bc57ed548a5f0746dddfda555e7,2022-01-27T18:46:25+00:00,2781,0.125 -0x0043af96fa91f48941255899f7a7d9784cb635a78a283145527908650dddb8d0,2022-03-22T03:35:25+00:00,24400,0.221 -0x0044bb3de0e537e48f9eb8a1f7bcd595f21956242e63150817277e764815804d,2022-02-26T19:41:01+00:00,3060,0.4 -0x0044d1e1cc466852f357235a03f6f6fb7ba3b546c74a1c65e25605ef9432f6f9,2022-03-11T09:09:09+00:00,18,0.299 -0x0044e4ac6dbb15d922299668ba6217b8097feb47fa5386e15f48ccaf5a8e2082,2022-01-11T17:34:36+00:00,13687,16.3 -0x0044f190de8c5896e87824eb80c6997ddf6d0899af862c832ea8d126115a0148,2022-06-01T12:19:44+00:00,84961,3.08 -0x00451dc28fe0ea430ab0148d55bd19bcadb6b5447c415f491482cec7e419ec73,2022-05-22T23:51:28+00:00,1954,84.9 -0x00455ae9873d3e176a21004da63f9c834dc273a4ef05bac404205b790fc10960,2022-06-12T12:08:38+00:00,973,1.8 -0x00457d8a2080cd19addbc5082179acdc4663f5943219bb3a92c7c50796d45ed1,2022-06-21T21:44:02+00:00,4629,0.666 -0x004580b76ee0448cd149d323007d60d42eca16b382b960ef248b352f96261b51,2022-02-26T02:24:46+00:00,1461,0.25 -0x0045b2ec394084796ee88471675a096e9b4e6a070812e4485ec4198d5f06bfb3,2022-01-20T23:28:29+00:00,6183,112.9 -0x0045c075918cae4deaaab43f6d678ef6269c7362b3170ebba819e8dfc5d79dbc,2022-03-17T02:35:51+00:00,6664,1 -0x004670691ce9de097d923704d3fe20289bca067353a49f90b66ed791cd25c1f0,2022-04-08T00:59:57+00:00,8268,0.19 -0x0046d7e5a6c1fdcd14fc8c5b8f69b43755e01162525aebdc914dfb7d0cf9fa1b,2022-05-30T05:50:06+00:00,1825,0.23 -0x0047176d55107358fd1d53f72112bd9dbf3d47c2f9f20a879ce652992dd199ab,2022-04-23T00:16:43+00:00,2,1 -0x00477f4fed96fd39622fef2bf4f698f5a020ab64127707acd35175e1d30b1cf2,2022-01-24T19:31:29+00:00,10,4.89 -0x0047c216a2a49d6f6c6b56b9925965036ff51b02ce77498555a1095c8338d882,2022-06-14T17:44:34+00:00,854,1 -0x0047f1fda83da4d9f4c65d39400cc1cdf9dbe6df6ea07b61a4ca3d501cce3387,2022-04-07T13:09:17+00:00,3940,1.83 -0x004837f6a6c95155469b26325fe0ce27fd42a6e9b21ff028a42c2441146ac32e,2022-05-22T21:11:04+00:00,2824,0.78 -0x0048503dd0af7d72a8f3a4c1a97e5b395c5277105c58c8a9c2fc14e06ce07d1a,2022-01-11T20:58:34+00:00,5956,12.3 -0x004885f94399ea70c015ff5f5913728acc02d001586da3fca4dc7c0867908f46,2022-02-25T03:50:46+00:00,1865,167 -0x0048a90e1f6ae599e594c49c336c5e04162c9deb7a5d556b4ae80015a1bacf9c,2022-01-17T23:56:10+00:00,2229,177.5 -0x0048ac7f1acba780c8c74ddd846e266b16c919a32ec8150956a25fe13902b974,2022-02-26T21:52:19+00:00,7,0.3 -0x0048b78655d119b2e40c4a8a51c3933f5f883cc349d531a46b296e825d450255,2022-05-28T21:38:14+00:00,3184,0.469 -0x0048dc4507601133024dd06f2937d91666133cada4b87f133c5d325e019e59d5,2022-05-05T16:11:34+00:00,34902,0.7449 -0x0049821b6ed9f4625d29544d814f353c82f8d3f0592097251b05002e916c7bae,2022-02-11T23:57:13+00:00,8284,0.22 -0x0049fe7a87db89528e9f2a3b329e45e3c23fc6e3cad99fb66a0791005781ab66,2022-04-19T04:22:17+00:00,1401,0.23 -0x004a5a184e878f2c1af790235e516b97782c593913ddb1e4060bafb0504a4431,2022-03-05T01:05:07+00:00,2693,0.17 -0x004a90be65f80e3a9204d96c404fd47fa60f30a1cf648bae1335e65aca85a6a8,2022-03-02T00:26:26+00:00,6587,0.07 -0x004ac22f8231e38865889e2b04ff159580ee2d65430e233d5bbe0a9c5f8e0b8f,2022-05-01T21:00:26+00:00,90786,6.11 -0x004b286a40952908cd65b301207322440992a3d79a215daee03febb5225f1db7,2022-04-02T02:33:45+00:00,3889,0.15 -0x004b36d0b3477693c9a7bf26320dd3e054e734d61e376b5019c638e5c1eb9639,2022-05-07T07:30:19+00:00,8203,0.282 -0x004b80a57bb699a52f493cc7cae10de32b9952af4f2492c8ce51352c2b47f270,2022-03-31T12:47:41+00:00,389,0.02 -0x004bc124d9b849f7d178f53e13dbf09724c479a34fbbcee09a56f922e83d88eb,2022-06-20T05:57:02+00:00,1290,0.256 -0x004bf4c762edef758bb23956b1617c89cc037ebcb056348fd5bd12028e45c5b9,2022-05-19T20:45:19+00:00,9275,0.12 -0x004c0fba3d44dcbf87d1bca90a786bcf2ad8bf4a6e3b20a0c9216e76ef52429b,2022-04-24T13:28:30+00:00,856,0.42 -0x004c32d84ddad8a939e0b50e412c0fad109cdbf43699df07392a96b15db5fe4e,2022-05-10T00:10:16+00:00,7648,12.75 -0x004c37d81109f1f36bf372cfa1d3a24505935aaf1b11735f8cba94127eee9e0b,2022-03-28T00:45:47+00:00,45632,2.215 -0x004c9ce20ab14dec11b364a2330e3c8d5e83a47776f1881148037053ecd98ec1,2022-02-16T19:36:50+00:00,8560,2.6 -0x004d83934166de7feffeab0cc3fb9a7e8064497867da41e2ebf334e5a615c9df,2022-01-10T22:08:41+00:00,1441,0.266 -0x004e40b0c08e0a372f5e0e8a8aaea1073422d69006ab76d8b7a7836de93744a5,2022-01-13T06:17:00+00:00,1,0.18 -0x004f7c8c24f3b3e6d57dbf3ebd1cd78aaa5c73f89767b7d120ec66a42245c506,2022-05-23T21:00:50+00:00,3045,0.101 -0x004f852153e1acc5248bd0f83cb3b6f9c2e2eb66772d73682a9e79de1176c015,2022-03-07T12:42:14+00:00,3287,0.58 -0x004fb8733568a2a5f80d62d31ce53e99a1df425f6aa8f7a2815b264b5da7f868,2022-02-15T17:52:46+00:00,41353,3.34 -0x004ffe4292e1546a2fd6df9a25cbb00c6797d11d0d0f2aa9bbb6b3a8a307aedc,2022-02-05T04:27:42+00:00,1168,2 -0x005049270a717686515ef839993d9e83b8804ad9a330dad09f7fe486edaa0723,2022-05-07T21:49:35+00:00,7252,0.35 -0x005072ad1d890bb9b239751e380021482e8444ec3064d7e45ca937e5ba0b50fc,2022-01-12T15:54:52+00:00,6662,4 -0x0050e0b1e2df6dbf0581de569a0fe7e6cb190a6d8bc2bdf5ca6f78c1c120d390,2022-02-01T18:32:05+00:00,8319,124.5 -0x0050facf30016e2d7d065b645aeef12149ad828882b808f6c117a9039b3036e4,2022-02-03T06:23:05+00:00,7051,0.29 -0x0051058fbfab6aa5c61b1ba21a7de0c18dc53e05860588fe14feae9161c6aec1,2022-05-01T17:28:47+00:00,9690,21.685 -0x005114892e8ca2594801c9ef28ad7f8b6b89dc31824b463f804f3baff887c6dc,2022-02-11T07:59:07+00:00,1903,0.39 -0x00511f3a16ed85f26eb67497b6e8b7575599a60ad21e98cb8ca33b960c69a18a,2022-02-25T17:03:45+00:00,5403,0.205 -0x0051339cd30613eeb925ac0496ec56f0805a1b243ce915d6b95058f8eee92499,2022-02-02T01:18:06+00:00,4083,0.3 -0x0051d309f6e28446ab823b88634642b62a1a95cfa71db0dabb07ba4d45709a63,2022-01-19T23:45:48+00:00,19497,230 -0x00527797a9bde78b63e00070bb61d529d77c97556225344c20f2ebb3f6d9d127,2022-01-20T10:49:27+00:00,4971,0.145 -0x005307e0fd023b48e50f3d0d2ff3faf64e25d79b58115d3d1370d71560ce1be1,2022-03-30T23:24:19+00:00,2131,0.019 -0x00533b69c97f12eca46ed88d2b0dbe0f7818bde0307292284f87e913af177e60,2022-07-03T20:02:22+00:00,2465,0.35 -0x005414f6931fedd1d918034cccc5ef210d49da2b155c6e73ec543fcbfd13d0fb,2022-06-13T23:42:36+00:00,58411,1.9 -0x005435937d84910d63e32872167b64bd9a45fbe3ad9b26aa47bfc240edbf2baf,2022-01-15T02:20:23+00:00,6821,0.39 -0x005459ac0388d422e0cbf77cb2147f242a8ddf42387a0def4772792989ccb00d,2022-05-03T03:14:00+00:00,393,3.2 -0x0054a4331cbce1b9cce9334fc1bc6729d7ddb865704b254bf7224f4552bebfa2,2022-01-28T04:14:15+00:00,20667,0.75 -0x005535387ff496b5fbba15b6afc772fb6d834380cdf6ed8716fb17ebbff0887f,2022-02-11T14:45:21+00:00,1795,0.25 -0x00561e8faee1ffee8b6b197aec2d14bb395f90bd2de854e103dfbb73762dd66c,2022-05-04T11:51:55+00:00,7432,0.09 -0x0056acdaadb19dba0a5125da11fb01ed214acc19641d05fd6c5db678fd874eb3,2022-05-21T01:53:47+00:00,7487,0.08 -0x0056c8a030c7b1be8dc6b725249e830052d54300b5cb349135adeca32b1979dc,2022-06-05T02:48:52+00:00,4564,0.175 -0x0056d3f0e3157631ae6044d4b7cd0a1d3cf57948d93c3123c58cdf1f4761d37b,2022-03-13T21:35:48+00:00,10988,0.229 -0x005740fabc78544a780c8e7e96a62be6d3c14334752a73d08eaee5dc78bc5d85,2022-01-13T18:06:33+00:00,4267,467 -0x0058c2a1558b9390653b1582a5479714fc8ce518ce8e5940099c8c867b376644,2022-01-16T19:36:34+00:00,4911,0.611 -0x005967ec99e9dbbc1cfa3d4eb9e329de033ccbdfda52dda49d981daee33d496b,2022-01-20T00:56:17+00:00,8388,1 -0x0059f5d6a39027065c51a075f1419d63b9390a1024ec19d552378f6f382e57c0,2022-04-20T14:02:56+00:00,9753,0.35 -0x005a59969077b84ebbddca8814299a9219a32811c9f1eb13bee59154f84ce70d,2022-03-10T00:30:01+00:00,5,1.198 -0x005a70a5cd5b0137e14e77c79f44c2ec21f0c67c6fd19e412dbb16c81ef3ec4b,2022-05-23T08:30:55+00:00,9728,250 -0x005c25a885cd6db16db56edf792a731585919bcbc80aad2e2ab906c147391cff,2022-01-24T06:05:29+00:00,4564,0.18 -0x005c32b68aa3aab642c98534962141b4fe48a92951d78fdb7e924ef7cd4316f6,2022-04-10T16:12:36+00:00,4887,0.32 -0x005c66ad7224f0501bd14162ad42ad02661af33def80ab902ad3f1ab7f182097,2022-05-21T14:49:29+00:00,2541,0.188 -0x005cccc03c72f9da079f79b9894232dcc0d3734fc5cbf7b510c3882b94730b90,2022-02-03T06:46:41+00:00,3561,0.025 -0x005cdeeec19bfa55d25693b9eaf963f1a6afb551bd9befd08b42aae609e43d6b,2022-06-05T19:31:14+00:00,54662,2.75 -0x005cf7a8dde7c9adf37c6be88dc92bedfa1266a551a6bd789932ef15969e9697,2022-01-15T23:46:37+00:00,8714,205 -0x005dee9a918f73d3591d606a2f74eba0ead612900bc969604cef65082305c8ac,2022-01-29T08:38:57+00:00,1865,356 -0x005dfe05750dc6de239160453f3250d6dc6f00837ef25a7bb2d61f4153115099,2022-01-19T13:48:20+00:00,9954,3.3 -0x005ea0d7d91be167a9e8241e9bb3cf297dafdb0ae2b2e07627cffc475049d412,2022-02-04T04:42:46+00:00,1637,2.15 -0x005f216f4f39bae81fc6f67d375d9a4f813fa35bcd3c6db87aa57660ea33a790,2022-02-08T09:53:31+00:00,6313,1.12 -0x0061b3ccc4d86bf1200ee97c7322f93d5c5c5fbfa67e6e90bce3265e787ea5a3,2022-03-31T18:31:55+00:00,5529,0.41 -0x0061dd01eb4e63fd39592d31bb78d8e66e1c1024a2ba82813d73c08cdc86669e,2022-06-28T14:51:34+00:00,8619,0.657741397912913 -0x0062055295d8fdadc3e90419f9a5ac08ba1a80378cf6c5187f88c118044b9859,2022-05-15T13:03:27+00:00,6253,0.03949 -0x00620c19617218df53571c9b7e392035d5b7744a6dabdf625f06f288b6127d5b,2022-03-27T04:24:40+00:00,16935,1.69 -0x006210d9d7bca7ec8bf409b7eac36d0d9fc277aec1e385e89933203ff2de1b08,2022-05-10T14:06:15+00:00,4226,0.122 -0x0062317573bc900822a1a028c104b86aa371bcae5250cfb92eeb56f76dae85eb,2022-05-24T03:49:38+00:00,5493,2.9 -0x00626478cee68d90a4e1b3ad9af08417c08881a9a02d8d8fe46b12f2bb93f671,2022-05-04T20:17:11+00:00,1478,116 -0x0063625dadca427d31d970041ad305ca40b80850c90349edf5208841b56e6065,2022-03-15T15:42:11+00:00,967,0.265 -0x006371beb347c93f14981f83aafca386794361ad0b4e16dbc0bac8ddd6b6a4d4,2022-03-23T15:08:47+00:00,4316,3 -0x00637cb659d75dcbbe8d4dab80e1077a9dc3d94cf9784413b906f3d748988e73,2022-01-30T08:49:01+00:00,8268,2 -0x00642d2d3d0466afddb96f95a3ce9940d74268eb76b34ddf76c39b979d1cb000,2022-06-02T15:18:34+00:00,81847,3 -0x006433a185482b2e800a9522b3dc8a0b54bba70d32f217f97a78010d77e6fdf5,2022-06-17T13:58:49+00:00,566,0.38 -0x00647a764f2862b667eae3bd950c3a5b39807076cb7b17d590edff59c6350187,2022-01-16T23:52:14+00:00,283,57 -0x0064e56437be4338be38a62be53093701eaf33d231dc666a6da76712a9068892,2022-04-17T12:32:18+00:00,378,1.188 -0x006589c16a3c22eb6156cf925fb68aa19055cbd85be239b481fb3b358a027b89,2022-05-10T19:50:39+00:00,6397,9.5 -0x0065a88c9830e64b152a9a82e3c7216e121a4ffd051e87dabe31e1106eca15c6,2022-05-02T02:43:26+00:00,92030,4.2 -0x006613b14bc0982590a5919d93c3a2f3e4106314f698ef56032920b1364df775,2022-05-12T15:59:34+00:00,4192,3.101 -0x0066597674fefe93cbf10d6081c37b63281a3166101bc017631d88d930543a68,2022-04-25T19:40:52+00:00,6679,0.74 -0x0066c85ec29f2a0924cb8dc05744aeae5970c1b44df2372370e292aad6156874,2022-03-19T13:01:42+00:00,29400,33 -0x00671e25e3e3e7613ad5bd4ba7b84713f92f2c067fc87812ab3f1714b8720371,2022-04-05T17:09:05+00:00,2227,0.1699 -0x0067901105b209923d2fa5d5328225f385636f411cc81d372d7b50b827e8be03,2022-01-25T17:37:16+00:00,1490,0.16 -0x006823719a35aeac27346a5f300f5b43586c7a0a3f5380380817329afde5b9b4,2022-01-26T12:09:21+00:00,3991,1.1 -0x006864fde194e64ec28637efd36269d8310ff85c902f207a5c117951408fc647,2022-06-04T21:28:24+00:00,1074,0.15 -0x0068cf02b65f55215e20c6be8c144755e5d5b452c5e6c59f292fef88ebee514e,2022-06-03T08:47:43+00:00,14850,0.0289 -0x006909e4c790b51a4810742ddff877ab570f4078569e0cc89718016334cf7427,2022-04-28T13:57:22+00:00,2578,0.0678 -0x00691270c9816efb8cf86574c10a5acae1224d04789e3befe65a44f4f7cdbc69,2022-03-04T07:39:21+00:00,689,180.6083727 -0x0069381ede35aeaf4ed847abf97817b88d0df7f8103674477b420e3262eb17d5,2022-01-16T09:55:46+00:00,9730,0.02 -0x0069483bcc2f986bba09e018da7054cc91e31d39c6dfdfae25e16a2416e2ee13,2022-01-11T09:42:55+00:00,10756,13.9 -0x00698fe8f00ab9b7e570ca5d51d174d0a6dcbe881b673aba1431a5470bde43b2,2022-06-07T14:35:51+00:00,164,0.1 -0x0069be533872d2796f1caacc4c1e9d5a80785f60f47eb1d470995b2f2d4fe2c8,2022-02-16T22:22:41+00:00,5285,0.199 -0x0069cb58da346a9960a41e75a968b12e5924705fe15a02c41ceb16ec60489f7b,2022-01-11T09:08:36+00:00,5369,0.55 -0x006a1a8cae842fa74a248b2f4dc9caacc23b02a368ad1a5e3a0875fe33c9c654,2022-06-02T23:32:35+00:00,2550,0.373 -0x006a32257efd1a698f893c75fbb6b6b5d99c764509cafb4420f56e48f95a86de,2022-01-30T06:23:50+00:00,9559,434 -0x006a52ff00ce2ae90086099cb983d5b28e687eeaa7a20250021c5b00eb3b4c3b,2022-05-27T08:54:01+00:00,2311,81.73 -0x006b4ed3a28b0833ea79e9742cb4d57b4972d56624a759121819baae32a5de6b,2022-06-29T03:12:18+00:00,7581,0.14 -0x006b6ec8a88a23afd73725560c2d102c4dd3875bbc95d73a02a2e1f0c48c8acf,2022-04-16T03:35:36+00:00,9559,428 -0x006c4ddb9f468ccdbe0ef0e0e733a09f0b404678a87010cdc78ae83c50e25b75,2022-04-30T00:03:52+00:00,3987,0.88 -0x006c65ff3ded7ffb3df7be3d9e2665773716c55d519b11e7facd454e5dff4882,2022-05-28T19:27:23+00:00,55660,2.87 -0x006c81659a0993b5b7b5c58c0b58bb6ff9d15d81b5bdf741d2f8b6ffe5a27f51,2022-02-18T05:55:10+00:00,3822,0.2 -0x006cda6cd5a0206d8d7a27b3b0c3907e98dd7937e4a74cc5d7ea14baf3722c79,2022-04-09T18:37:25+00:00,7364,0.015 -0x006ce3312cc9c0332121ff3506c029fe930f4b7fe8f4cdfba0e5a7b9df00079d,2022-01-21T03:05:52+00:00,4178,0.25 -0x006d260238c79dec7a77adc10edc6940e44b6b39c372cac824065c1190dcc22a,2022-02-25T00:36:53+00:00,1955,0.35 -0x006e0298b1691e8553449866b8f76fa93bcc03e0ec611df62d1d75b07c157f43,2022-05-12T23:28:03+00:00,19092,1.38 -0x006e337cde8e6fbb6b8e95635b3e2d2b33a3c0225deb59a7ee6efa0c20c75334,2022-03-10T04:10:46+00:00,19564,194.5504243 -0x006e4b952ebd4210731dceed8a9f4c8b40e0ea8e7d1e8064dc04f16e4233a11e,2022-03-21T17:29:54+00:00,2310,0.07 -0x006f432475410f9b2b67896aab1ffe5f2000e67a6aa81e3ef9ec933e9840168c,2022-07-04T12:50:26+00:00,141,0.16 -0x006f6d23568e8505a07c256cabb9c7b924fa8363c2b341a686a2316aa38cd8ef,2022-01-20T07:22:37+00:00,4492,0.5 -0x006f72f2b78f71e81443d750e03f1bbd5edeb4fb255e9385e7290a15714d3f50,2022-04-23T09:20:22+00:00,8472,0.189 -0x006f9f8e62c3f19a185f56054f8afe2cc39baa438e9bfb1c71dc561ce054f995,2022-02-24T14:24:09+00:00,4781,0.065 -0x007056d16c5eacb4de537ca122f863c8caf8c9aeb8d139f125a884dc5b183f5a,2022-05-17T18:13:25+00:00,7345,0.059 -0x0070b66613e49f785476dc1e720ddaf3680bd656ae66a14f87ab7e29bbbcf7b1,2022-01-27T16:52:13+00:00,5,0.56 -0x0070e457bcfb24e0ee3780e2678a3a17f1d526cb5ff59003598142d3f74e4787,2022-05-06T08:23:23+00:00,2882,0.121 -0x007145a52ef505dce333fb7076b410f27e3626e97c0a0bdde5678a35f03a8580,2022-01-13T13:22:56+00:00,9377,56.206 -0x0071a63ebc89b4bc05f1c938dd5456173bc7df581bc69c2553eece2a7969e19b,2022-01-29T01:27:35+00:00,13007,1.25 -0x007217cd78ac7361c3d0192d8f5e5c81a6d257acb6902be0ceff4d81758e29b7,2022-05-13T16:49:59+00:00,916,0.54 -0x00722636897b7651c71169f3cdb1085043ca63bd6c2ebfa24bad39b74ed51b24,2022-03-30T15:01:41+00:00,17790,1.04 -0x0072376d8876b2c722f9285a1b7ae45d1470856a54980a6254280184ca8d9859,2022-05-09T19:26:40+00:00,50520,2.88 -0x0072acc2841c62148e292be55d58417a20aa9714c523215eb48eb5c318d23845,2022-02-17T04:43:55+00:00,5489,0.4 -0x0073235f57f4b1de23834ab2f15d26ac3d184b56d5b323d9b1002a524530477f,2022-03-09T19:02:53+00:00,1437,0.45 -0x00732fa1367879531faac815bd3a779212738b196d7fa0b182ac71eeab18425b,2022-02-05T13:27:44+00:00,4529,0.18 -0x007381d1d6e0e34049805ed1878a86cd87b117063217338963c958b3a58a4eee,2022-01-20T15:54:57+00:00,5949,1.7 -0x0073a2af271b1ce5c05c7ab7f4471a13c9d06c8c2e6a934bb2b72994137538e0,2022-04-13T20:48:55+00:00,619,0.02 -0x0073d50bda04fef3173054d54ad3cacac7e81f6b25171e182ba079d1cfa672e8,2022-01-14T03:13:15+00:00,4758,0.01 -0x0073f52cd9210d4762b54d67b738fe864f300105ab90501fe939dbf4e152023a,2022-01-22T09:40:57+00:00,8319,166.5 -0x00740fe8f51e926d7cd51d50ff70a00000c1104d3f8cdaed47746578b6e97182,2022-01-21T15:10:49+00:00,290,3.5 -0x0074d7c9154db86102b567145a7bd4c051d1fef6a60421a646a213086d848c11,2022-02-05T13:23:38+00:00,3158,0.09 -0x0074fa667604e0fc901317cba4b37fc75462a958814af95092e95ceaad11036a,2022-04-27T00:59:02+00:00,1522,0.01 -0x00751617245c58523b783fe3a7a934bd84c9fa976a2e8ce4ad909c4e897cfd1c,2022-02-25T05:53:49+00:00,3857,0.1 -0x0075f4d329d5e8fa639f07a5ac33e47f0df884508c7013f82495807b61b83a02,2022-01-27T02:50:07+00:00,6314,0.09 -0x007605f21a2464a035b5aca60afede98cd99578a2253b5a5c872918aeac6f35f,2022-05-29T14:16:51+00:00,2725,0.0048 -0x007647b3f7890cbf6ad14ed4d30778c0454b2b6678917a9a93607e82a9f1911d,2022-06-25T22:29:06+00:00,1049,0.153088527878671 -0x00765881ae316588b63977e42b522a274e51e24633e89cab7f3772639a4b6857,2022-04-05T06:00:27+00:00,19708,0.3 -0x0076998d854798f21b1892884d8431fd31ca494e56d00b6bd79fbebcffa0100c,2022-02-04T15:38:50+00:00,5779,0.069 -0x00769f3c4c6a18967d1148e001bff9ba241c197a00ed79f04ba5076dd05f3e55,2022-04-29T02:34:45+00:00,1150,0.129 -0x0076d331d606445582676d245ecab541045b9b7b4ab0ae5873110416695d5537,2022-03-19T01:30:38+00:00,1,5.5 -0x00773b1f0107922816a3e47a8f59bdcee884996c3f65c4275b4aec3127b8e937,2022-04-02T01:50:09+00:00,33,0.055 -0x0078843fbaf9d792cc5813f83c2ed1234944a185a923a6e0d38604152db365ca,2022-03-12T11:17:53+00:00,5669,13.9 -0x007900ff2559d9b8b2722e4d7f4580a086ac03b2a1ad7c2cb41ab0640ded4cb6,2022-06-02T18:12:51+00:00,772,0.39 -0x00799e736330d5300b743a531b2b1e210068b2cb31564fb91a8c689bfa51d10b,2022-04-03T07:15:24+00:00,3636,0.349 -0x0079ac57e13c38dbef0d045a6ff051221c494bc50cf28ccd43852935985f3dd5,2022-04-22T20:59:48+00:00,6453,0.2 -0x007a2805af6737060609b880a594802ebf7e7789202f871a7a6de77788a332cb,2022-05-21T02:10:29+00:00,649,0.085 -0x007a3e8c595a428522ea2506fdf156e37cefb90d7b0371a2f6f29cc9bf1afd97,2022-01-19T19:26:54+00:00,4830,5.47 -0x007a74a670f943335c356d03149ca2f68da73bde2b150ff8c89427459d09879e,2022-03-30T10:52:05+00:00,4270,0.0195 -0x007af37f7c9517813268596f32e8cfe253030483d177aeedee79a240e48e4dcb,2022-04-16T01:39:50+00:00,9042,0.13 -0x007b34fde0d947eb0df625428b96216ec3c22445c7bf3c1469f4ef37fb1daacc,2022-04-01T03:28:34+00:00,3563,1 -0x007b8327c5ff5eea63e7f32d4241320c04aba8de6137b41e480c0f0872a1ed43,2022-01-31T22:24:43+00:00,1242,0.294 -0x007ba17438c89bc81853163ec28d0bef9c94176b775f4965e029321f868f7cc5,2022-05-26T08:12:47+00:00,4801,1.73 -0x007ba6642dd95773eddab8981e30f3a8e7176d826c75ec9a4cc65cdc26ea606e,2022-01-11T13:06:46+00:00,6862,1.6 -0x007c1e497c78919f25bc0602ac778145989675a77941ff69eb573c8754be621a,2022-02-09T08:23:40+00:00,5438,0.03 -0x007c3ab6b4780b8973170c6c3ed961da1af66321ee1ca423dce7268d1c2a166a,2022-05-21T20:54:12+00:00,4814,8.49 -0x007ce58827744d7441136d66c7ef2285b8eebc75b5a27af3e9391f819b73934e,2022-01-11T17:38:12+00:00,3573,0.85 -0x007d245474ad2decdbdba37f591c0c46b44417e730a305eb7a7c9618a13e62fb,2022-05-06T16:44:35+00:00,1095,0.45 -0x007d323b627aea22e93d2712f331bdd4a6dc09b5a7d32beba1154f938c9c9519,2022-03-15T02:30:45+00:00,8989,0.04 -0x007d4088c12739aa22c30b6fbbea8e4eb8d3408e98b89405681bdb3d98256b3c,2022-02-04T06:46:08+00:00,8459,0.0649 -0x007d8ad1efa26afa70e2aacbd024f3943bbdbeb53c00a332b53c7cbeef6210c6,2022-05-17T15:53:31+00:00,3136,0.049 -0x007e4165d88fc28d038ef2b3c6972c87dccbf06f64c3ef87ba5dbf9f7bf81ec8,2022-04-25T16:46:31+00:00,5,1.485 -0x007e4c347b25236c8c788f5a41d8d4d9cdf8a2a2466e07c93a059248c796c505,2022-02-13T10:06:48+00:00,8653,0.19 -0x007e57efcdd34abb65511929aee2163a9ba98697d85178d7856d7d9a4ee7bdac,2022-04-16T15:41:27+00:00,4745,5 -0x007ef8d53fb23ccf1cffaf70214eba76615658720b85542df591f087d4e69dbd,2022-02-02T20:55:16+00:00,2671,0.5399 -0x007f9d7732fe87b0fdf81a0d9a8ce7b94cced59726797050ea8ca3f2ba752773,2022-01-12T21:28:37+00:00,7701,0.1399 -0x007ff7ddebc22b335957b948468598f423686d8476a74888732dd9b91640db5c,2022-05-21T05:02:17+00:00,9975,0.102 -0x00804eaae12388b54b9d2293a9e26dbedbb79bb1502684a8b7daf748057d10f2,2022-03-09T15:02:21+00:00,1839,0.015 -0x00809cdfb4fc7fa6f7d49d243bd679c8d0f80ce858bd2968fa3bdeb93b1325ae,2022-06-03T03:35:39+00:00,7737,0.08 -0x00811be36c86268739fa76c2c7e1444d899c8e2656c487d78b12545da81dc307,2022-01-27T19:22:53+00:00,17282,967 -0x0081307af3cb48c518cb9a0aac15cbe2e33617e010b23d4184ab8e5be7cd9523,2022-06-27T03:33:24+00:00,59670,2.59 -0x0081574d0d219cead3223e3c15b66c06fadb849b0d691960b3d2643ddc6643fa,2022-06-16T06:25:47+00:00,8341,0.1101 -0x00818ce7503c405f26bf2794a799ee3e167aeaa4ea921ad3e5e0c8fa196cad2e,2022-01-15T23:25:36+00:00,3790,100.99 -0x00820d099ea546a9e4dbdb4f235483f2a4d80820b88a2fe3fcac0eb9f6e4a66b,2022-04-24T01:12:39+00:00,2334,0.1688 -0x0082bd2f798f142ce6f745ce42786a8582a732f5f5f6aeac2971e3c7591b6db0,2022-04-01T08:22:26+00:00,2611,0.074 -0x00838348c1a627634243a3a9b2a9baff6f0a3f7d02c4b7dd2f0b08c51a62f4d0,2022-01-20T15:50:09+00:00,6289,1.865 -0x0083c9055cac225e9d70e64e3ca12f8554cda6f40b0de9f72cd52f85d3c077f6,2022-02-02T00:57:31+00:00,3680,0.89 -0x0084357619ff8c17341fb195f9746154a9a72cf14e9b0b91db74518a99fe2fc8,2022-04-22T11:36:33+00:00,2334,0.2 -0x0084b4a45a08223286a07c153cd00b43159e61ffc480850533b33f1064bbda57,2022-02-12T07:33:32+00:00,1938,193.5328749 -0x0084d7a9dbfd20b7b86160bbaace9220157a8658a60c08f163ba98d74eef54b7,2022-06-15T06:22:21+00:00,3606,2.95 -0x0084d7e36ffd707ac6cce864e39a48b7db7a0e37ba35ed330ffdb6050116b40f,2022-02-18T08:10:55+00:00,3085,0.19 -0x0084f8deb006df075083ee0a0acf5942f09cf460466fdb0350afbf378bc38be0,2022-06-17T15:45:33+00:00,535,0.55 -0x00851a69de8c2eded20c1a0fb0d3b70fde24338616ab385110aecce3159104f5,2022-06-14T19:20:01+00:00,8,0.13 -0x0085f89a51d032daad91834c4ec2def7e2620e6187e2b339044874d9c3bd31e9,2022-03-27T21:14:43+00:00,1,0.849 -0x008627b637f7102ac3ff09dbb9e27180deda47820fc2b78585bf823bd458b5e7,2022-02-03T07:24:22+00:00,2048,0.036 -0x00865ba53ba789abca47c988ed446278b8a85a3b3acf8c6dd831e8b13f358b25,2022-04-27T23:19:58+00:00,2331,11.2 -0x0087ebcd67a2cf4898f7908129830b2155298d096c0ba75e318b674035905730,2022-01-29T00:09:57+00:00,5,1 -0x0087f0c3cf97f647a821cefb5c9d29646710459f791b58614844af71ab9d463c,2022-02-11T08:50:58+00:00,4246,0.25 -0x0087f3d1172754f023863fe106ff142e0d3fa9292838507a925a7b0271cb38e5,2022-02-04T14:37:08+00:00,8590,2.75 -0x0088155e4338161ff70b7dfab70b4e928dc59629e81a3f8935836326b55033eb,2022-04-13T19:13:39+00:00,671,1.55 -0x00887fe885a5b44abe1e505b74c492d33b738ac04a7f0dafb08541e9bed89f8a,2022-03-16T00:22:32+00:00,5308,0.04 -0x0088b9edfd9006d4b9dc97953e3a4d40895b04d86a047d51ba3b77d411bf7714,2022-01-15T19:31:11+00:00,1284,1 -0x0089ddff2712417c1310fdceecb6dc8c9e48478c9062ec0d58a1fe1ce6d209f8,2022-05-19T02:43:42+00:00,6331,0.081 -0x008a0d6edca24d04e500226aa59b28a1a6162ae556edf2bf498034fa68db8051,2022-01-11T18:58:00+00:00,1633,1.55 -0x008a42e3320e5bca0e78081bb5ed321fd6f140a3ac3053a0f370bf241c20905f,2022-01-30T05:32:02+00:00,5991,0.24 -0x008a6f14e61f324f13c57ebf389fa299cb1a577411cce560a980aae21a80863d,2022-02-07T08:09:14+00:00,4266,0.05 -0x008a9b0fdcd5b96e7837bb03c89307e9625c518fb5c224d577a1a9c81ca1ba36,2022-01-15T22:30:26+00:00,3163,90 -0x008aeb1418a5a99c4898c714ace637dbfdb5f7d30fc90ab5bee81edef99edf33,2022-06-03T17:56:31+00:00,2456,0.1943 -0x008b35627b75dacee9b38af00bb718907ba9595f8cc21cf74c4f01ca0ed133a6,2022-06-01T13:44:15+00:00,8751,0.1101 -0x008bc0a8e6fdd285843a968966a368032bc186bcaf555dd24aed1e4a38339b05,2022-05-22T05:06:55+00:00,3050,0.32 -0x008bcf2e27f6e6049fd0c8399ef7b0fe03b7598e60c878079fc2e654de3e5456,2022-04-05T06:13:25+00:00,4693,4.16 -0x008bde624a5c174b92af44b5cb75aa7851cfe73634326375bad1503be22b52d5,2022-05-02T17:08:38+00:00,45459,3.85 -0x008be253dbef8d0cb5e3ac3705ae8a288b0a22536fe9bb762936967dcec762cf,2022-02-13T16:23:53+00:00,724,0.34 -0x008bf39bd6ccff2ea11a939a8ab67426526072fec741c6f7c84a344e9f5a1990,2022-05-04T19:28:17+00:00,70513,4.81 -0x008c390651770f2644a945ee480d6422345b3342ca850edfb6336d2b268f53b9,2022-01-29T07:42:45+00:00,9559,328 -0x008c55e4b4bf6803249664d6ef1c98e9182683dc2719c65cf22a6dbcf6299c31,2022-05-25T02:57:06+00:00,2540,2.21 -0x008ca190280f0166937e60c7bc047ecbf833eb321cea7d75afaaf89ee7ee99d1,2022-04-25T13:26:08+00:00,939,0.179 -0x008ced86264f53b45fc2e11c49fec6693388f7d297439c5c2ae840979361e836,2022-07-02T11:16:30+00:00,4874,0.2 -0x008d4c3a92de8451810e71da258be3ad6d69e5b5c863a6188e62d7cda1442a42,2022-06-04T11:14:13+00:00,3400,0.1 -0x008de818bec54bad5144edf448268fb2a547737c77f025bb70af997fd998dd3e,2022-01-28T18:34:56+00:00,5487,1.5 -0x008e0b94801dceb5cadf963bbe4a76f9ad50091cadce9012dc56152a4b1929d2,2022-04-04T04:20:12+00:00,4670,0.119 -0x008e6a1ff725c48a118473f52499d72d59530e2dbe283428e90c6531f8893db5,2022-01-12T14:08:03+00:00,168,152.3 -0x008ec0a0476ca4565362b5ee6d163381e783aaaeec03c167ae4b4e6ad2c3a7f2,2022-06-20T08:26:33+00:00,73166,2.275 -0x008ee1eadb510bb4bc41045c51480c5dfa8574136bacf754380eaceb99bfedbb,2022-04-14T03:38:20+00:00,4956,0.74 -0x008f232a879c5cc94a910afb0f3748fcac14cd3223a5efe9cdcd8bef7aed52d9,2022-01-15T21:37:32+00:00,9249,8.522 -0x008f608bfe14ab9c0be6fab0b287b48a897f6d6af29312d2cd7aec1a9b88db68,2022-05-18T17:17:11+00:00,9021,0.033 -0x008f69d852eeefbfeda86a10e55246433b76572593fe97d479520c7cb741f0cd,2022-06-12T01:17:20+00:00,37863,0.0319 -0x008f9af7f23533fbec89e4cf410bec2cf40d3202acfeb7dfd440c12e1368b1c6,2022-06-27T00:02:54+00:00,2937,0.001 -0x009001667cdf83a6e4724d5299dda11ef75a27a4868eb3c8897868b307d74978,2022-03-22T15:32:10+00:00,5752,0.075 -0x00908636e99a1211df4dff5713cb575a61ae8ea5be5c257d5f1990bbb3ef015f,2022-05-04T15:50:22+00:00,1894,0.5 -0x0090e1ee3e444210fb44b0ccde386bf95eabf928db64a954406fc36922c75c93,2022-06-15T10:50:45+00:00,24030,0.009 -0x009164a6aced3e4fa3f16288e3530589b979a237e26c46533bde7eadd8d0affb,2022-05-22T12:11:49+00:00,8749,0.271 -0x009284ded3def34c4ad6a5dcda9827338ce18b09a13d8e7a3aacb8bcc7cc09ed,2022-05-30T12:28:31+00:00,5939,0.008699999 -0x009297b82d5da80b05662ba590673b8320e810c30c4333780accf7cf75cadc78,2022-03-30T13:46:17+00:00,1949,0.25 -0x0092ffaf9ebf3a5e7ff7f8a5d30b4599de15dfcff2b4ff46d7e72b54672d22b5,2022-05-22T00:16:52+00:00,412,0.141 -0x00933f6900bb2b6ae1204147829a0cb2e2f2c4b2cf3cecf51932e0cc676238fc,2022-02-23T17:01:47+00:00,19108,1.56 -0x00935ba9f2d997fa2f15d1ade01dd91f1efaa28f85421205afc475e620bf10ee,2022-01-18T14:06:04+00:00,10317,0.079 -0x0093ccbbb215f54fe8a4328ce2d5321efb91d4342a0d4b1438048216e385c680,2022-02-07T08:11:44+00:00,2728,0.04 -0x009419961cc4ead53b884c8cd8b9c46c955255b4d1452f998fc7bdfb5232f701,2022-05-24T00:37:56+00:00,46036,3.46 -0x00943bbf9fa1d06f0b1251fac24fb1d75f80934973594ad088f607be2c730ac1,2022-01-15T23:56:44+00:00,10371,0.01 -0x0094b2f9c95c876b62e7f24097529b4a720c1ad8643f2a0eaabda5925ac25b64,2022-01-17T08:43:38+00:00,5147,1.75 -0x0094f5ce738204e498a1760e1277cbff57edb719f8f9284be06f155b3f32a949,2022-03-29T03:55:08+00:00,5283,546 -0x009540387a27a667dbc15c4e7a0bf48301635b7a508729f9d90633d696d98e73,2022-01-30T10:26:17+00:00,322,0.07 -0x00956826793f9dfee569cbf65de1eae658e61058e4a1449093787dbc70895432,2022-05-12T17:50:48+00:00,3899,0.33 -0x00956b8e22d14aa8d7ce2c7fe03b2928bc35d16772071a28c2bf24bef336e169,2022-02-04T02:26:25+00:00,5279,0.325 -0x0095ddb0521a2c6fc807bec8576a6fa6338200ac27218ac95129fc37cc9ff12e,2022-05-30T09:59:34+00:00,0,0.218 -0x0096332676b1866157597d78649f81e550ad421c8f7e496c155491f0f0b5ea71,2022-01-06T02:13:40+00:00,112,0.005 -0x0096a8b40cc1e41a7fe7fefd6bad8cfad0521ca0aaa2b84a836d84cea0bbf35d,2022-02-12T05:16:43+00:00,5186,1.2 -0x0096ca63c9a1d30fe851a6581dea18916d25f09daf642a7518c1abb337258de6,2022-04-21T23:36:57+00:00,6695,0.222 -0x0096e858f84561823f4f502ac409f207f99efad00ffcd7dc5b30e4fd51ed23ca,2022-05-12T00:55:59+00:00,53191,3.01 -0x009738890b63b57c9825c6d9e57cd49d826e37bd182f5fad4fb1ff0358375f9f,2022-03-12T04:49:26+00:00,8889,0.597 -0x0097519e1f841dce422e97ee802faf1e31153e9019eee8471513c8cb6e970a01,2022-03-15T03:57:52+00:00,2498,2.4 -0x0097c5bed3bc3c688d3e8f60c29afc0198ff72d657b17c40c29a1cd00fa6bd8e,2022-06-13T10:22:12+00:00,7547,0.34 -0x0097fd46469945e61a45a4768cb1f31043f480e0fbaaafb1ee4f6fae6d24c242,2022-01-24T23:44:39+00:00,1938,171.9019586 -0x00984ca299d3f3f9b659b2b8f03a24bf0de5f37fa5b379007e9714e5c10b78d9,2022-04-24T13:54:08+00:00,1,4.4 -0x0098d65469a69b71e2e290005be4c9b0c6f3cde2faff693df5222fd08e2f92da,2022-04-21T20:15:44+00:00,7366,0.12 -0x00993a05d4e0baa118caad5170692bff6e027e868d57260091ab63e9acf974d9,2022-01-17T15:15:48+00:00,3778,20.2 -0x0099645472b5f7e7bb4e76e30b3515ed472a9da1e84e20a7da8c541be9679270,2022-01-18T17:39:29+00:00,1434,0.09 -0x0099dc7a7a335c216f3c3a371bdac2ce22b53bd2dc0d9ba6d35ec908771c83c0,2022-05-13T16:10:38+00:00,13617,5.5 -0x009a33e850dd434f7f8c34a9cecdf7a6c79eb7881f5511806e81a84f9e479d14,2022-06-23T03:00:24+00:00,5644,0.35 -0x009a3740361b5dca119786ddfd6e509505e876dd49614da0e0c54f311a98a4fe,2022-06-16T11:25:26+00:00,6797,0.25 -0x009b1845a2042930bdae3338c5eb115c2bb56ffb8ef12f289122c62fe1c118fc,2022-05-17T20:57:14+00:00,1755,4.555 -0x009b8e8519b81e620ace3b4b6303e4e21849f17ee27774f07f986735a52f5cd1,2022-06-04T08:33:41+00:00,7913,0.1 -0x009bc6de127913db419eb87f19db1dee1d995bade28d9b142afd8b2dc1a20845,2022-04-07T04:28:36+00:00,9820,26.2 -0x009c25049dd581603cfa483ff2b7e9a2f31402dd6575fd95563b05419a664526,2022-05-19T16:13:02+00:00,2896,0.8 -0x009cea580d979edb50830f5e277f5b4521b7fd0c4ef1808463e198f8a4fa0220,2022-05-21T18:56:05+00:00,1965,0.116 -0x009cf8ebf4499489cf33bb9e3262699ff2ad70d6ce0a5e0247b5f0d175e14d97,2022-04-05T01:04:16+00:00,329,0.59 -0x009dabab214ba4ed50dee999f9a60446d3e4d11b856e41863b09edbc488ee49d,2022-05-24T18:25:55+00:00,2892,0.0001 -0x009deb02b8175f9b3b031a13564a80bd10f97d799a2abdf71f1bd0c18c44045e,2022-06-04T08:59:56+00:00,7100,0.57 -0x009e2daa854398296c934d9f2f47460c1d7d048dc9431cbe1f218ad389af5260,2022-06-21T05:18:48+00:00,1886,0.001 -0x009e55865331ce10861c44f27843e3568fecb37b10364ee521ec215e251a2df4,2022-03-27T17:47:12+00:00,4207,0.084 -0x009f364727586f94e1bb3eb86038dca43718d4ee65fa6d9b313b1ed676401c17,2022-03-16T01:25:44+00:00,5283,637 -0x009f54f75fc9214604c58c2ea5fe240ad4f1ebd781d2df21f3a400077d074501,2022-01-29T16:00:55+00:00,2709,0.15 -0x009f7779e3a767221c38491934d2d9dba449c862025e06cfa61ab48fd44e74b9,2022-05-20T18:13:09+00:00,1966,0.0918 -0x00a03112bc940012512dbdeccecb9799ec29bcb333e392ed9d32b4e91e55a8de,2022-05-27T04:36:07+00:00,379,1.071 -0x00a12de3df14df20dc81d96f1b036bf01bbf4e8a5e18da893c74b3f9a9d113bd,2022-05-14T00:39:28+00:00,15337,2.3 -0x00a226c43a9e4b3ff55d7119fadbb5f42c1977508ae140ff2d4525927f2cddf3,2022-02-21T03:54:01+00:00,7723,6.3 -0x00a24751a2a8d4c8b4e7eb892b566653f4832a7b7c07faea0ca52b73b1194f26,2022-02-02T15:04:33+00:00,3261,0.33 -0x00a2d6768dbbcbe15dde357428ebeb5bff6a267764b1edacfff15b70f98c35ec,2022-05-17T17:37:00+00:00,7721,0.069 -0x00a2f1bba3a34aa564f4db616238ada73888f866d0c882abc639fe92f1447741,2022-01-25T18:10:27+00:00,10306,7.5 -0x00a32c0807a8ed380970f6afc86ea62c7a56ff35a44cad03c252f098bce728b4,2022-05-19T01:28:26+00:00,6277,0.05 -0x00a39a8d0dc89f72d8ff1abcee8207b1d45f891d8cd73881b4c3ff4180b1e1e4,2022-01-31T08:27:26+00:00,10185,0.05 -0x00a468115e5c439e18da0cb3724d296433a65b6bd78af8c387e7fa4072828712,2022-05-21T22:15:16+00:00,49330,3.3 -0x00a492565f75c9cdea0c3aff2fa751135b4265b1ee9f2f246ed16a251beb09b9,2022-01-13T15:41:06+00:00,7501,0.51 -0x00a54cd9991e1d4abfa90336843d850b5fbd9f4d6353bda60a6cfbb4d21f5fda,2022-01-24T03:48:14+00:00,4330,0.44 -0x00a573814b1e380c8f74b84541a4fa7217064707dc7911c5cb075e1e60a70501,2022-02-01T18:54:06+00:00,18153,4.69 -0x00a5ca591ae874ac1c317dbd76b3f7bee42828ea214ccad1cdf7a358bd6561e1,2022-06-24T21:56:03+00:00,7750,0.255 -0x00a5e426a48391f42d741d9f7a05f28cadf47b69b98faaa130ad659d0d167ed4,2022-01-15T06:46:39+00:00,4625,2.5 -0x00a5f1bd15c32b6f20734d3e1fc78d93f777eb409573bd0d8fcb9dab92a9cfc4,2022-02-27T08:33:47+00:00,4461,0.63 -0x00a61dd82ff81bc49c6e769febadb01cc5b13f804f910c90c8401cbba4c87e0f,2022-02-04T15:14:47+00:00,5358,13 -0x00a62d47a692d4e5e6962c8a3b16c7fc5be054b00f5dc90ff17b4052fc2d0138,2022-01-28T15:08:35+00:00,193,0.13 -0x00a6cbcf1b21ff0fd4d5d9128ffb2831f2c82a5a3e4314990d5d5d2fd866a63d,2022-04-24T17:21:49+00:00,6089,1.45 -0x00a740ea7196989ece10479571695d4ad46db0e8e4defd44fd6159139b4645b8,2022-04-24T21:11:38+00:00,3463,0.15 -0x00a7902e6f484b0ea843c60a7f68ca48c071682498ae4bf6c8e5a85f64d9ad68,2022-01-25T13:20:26+00:00,2273,0.1 -0x00a79c0856932eb235e6b56d9db5fe0e31b37deabd17142ece3d79e0d7ddef93,2022-05-22T15:07:01+00:00,2542,0.015 -0x00a842115cc70549857d8c0121153c6a0be6551dbbd47c76df316937c4d46355,2022-04-01T16:35:53+00:00,1,2 -0x00a8c915239056777224487ac0379f0e931ad4cc9dc08766e4b173888ba4b690,2022-01-15T23:43:54+00:00,10137,1809.5 -0x00a8d2f09467e20bb2183c3122ec1bb62a6f34c2ceacac74d658737ba944a952,2022-02-02T12:22:58+00:00,1,0.03 -0x00a8dc1874d8d82a97ae3a2618f1d647e070bff5ba77840f2b42ad6820a45875,2022-05-24T03:54:01+00:00,2238,0.00011 -0x00a94a3c66a4a629e65623e210f5930fa6eb0136ca3c8f0d9d7415adb3a642bf,2022-01-11T21:03:55+00:00,10968,100 -0x00a9b1d823ca8fb22874da0c9457f5230c9b20c60592b5db45ae506c68aee967,2022-03-07T21:07:34+00:00,937,0.21 -0x00a9c37360b98154fb79e9dba041f3108f25570163431509d6a05a3f84baf6b5,2022-04-17T13:47:30+00:00,2255,0.07 -0x00aa1197353c355db5a3441364c880a0e39b1aa91b7b1485492196fe49bd73c1,2022-02-13T21:20:32+00:00,1,5.3 -0x00aa1d43c6d87f10f5683329a1dc83ed6975c2ce92d22524621cded07c9b4953,2022-05-08T08:44:03+00:00,9526,0.55 -0x00ab281e03b8f9b21df8f969a682faf9301ff250a7c5175e78cd63a8eafb7683,2022-01-31T02:21:55+00:00,7341,0.567 -0x00ab2cc94aa27038f1b3fd4ef4b90b369fa764e3f99cc57db76c17e4a7010d39,2022-04-25T17:58:40+00:00,1692,14.75 -0x00abc308a86b58bc62245a989a0551130bf069b009946ed9e2ea0e825e0b62aa,2022-04-26T06:39:44+00:00,9386,2.99 -0x00abdb08a950770e4565624cc435c501523525edd155a97561b2761d0b40d2d5,2022-05-13T16:31:23+00:00,816,0.378 -0x00ac105d15d515c44036dab81d97141c6e8cc67dca87a5869141b2097d9e04dc,2022-05-23T19:10:19+00:00,2503,0.069 -0x00ac1dcd09e8607fc834842b832070fbc0e43d85949cbb0ac9a53dcabd792461,2022-06-13T16:45:04+00:00,65230,1.75 -0x00ac1f8d2aea6cb58b2930f57302a11adbfe784b0f32e5437048969ff0080d69,2022-02-23T20:30:48+00:00,1334,0.21 -0x00ac72f8516bed2f70a88aaec3cfa0b6b64d34cdeb077076a87f8e1bd54d8859,2022-05-02T18:42:40+00:00,401,0.606 -0x00acdc1f818d57bc4e1ef4a3374c12a9db8c71bc84e2bb7fa8741c1096418e99,2022-01-31T16:07:46+00:00,8918,0.1 -0x00acf1907e458ec49ec8b28f407a005078a55debbb9d2349a33a5052fd2253f8,2022-05-30T18:27:32+00:00,3705,0.16 -0x00ad458ea5fa2a6fbab5dc3763c83d549e919ed0609a16d1daefb0720a6fb490,2022-05-21T20:44:46+00:00,2613,0.01 -0x00ad4ab3b2580a55fb2386de2df61842d2fb99f595bc1d0f08f506ad928e24ff,2022-04-03T07:04:59+00:00,1,0.237 -0x00ad595d8f0a23358854edd6f60750862ac10cdf271dc5a00c0a83af8037d343,2022-06-04T23:44:42+00:00,6410,218 -0x00ad91607bf96be04b1381f7e3216c5d19d70e03d2df3c16d590c240067eb413,2022-05-12T18:50:01+00:00,1,0.099 -0x00adb5de1c7df055187477833a52db60a4d4ba796e7e0c4c21d19aafb1f384e8,2022-04-13T10:14:52+00:00,4950,0.3 -0x00adf65d128bdae716aa1245f5fa16ad53d52ef2b5a82ce5390207243824be32,2022-05-08T19:35:51+00:00,971,0.4125 -0x00ae848caef7b8466dcaf3acfa42304a5a345c92e3860a871328462404c3f38a,2022-01-18T13:49:01+00:00,1401,1.1 -0x00aeb78846cc3ab140d0b0d48051880300209d794859625d0afb3b6ffe847c85,2022-03-13T12:09:22+00:00,5580,0.55 -0x00aefd5ce67eb8bdb972c074b7ee7bccf9c8821e1454f7d0c87f4b714236a734,2022-02-16T22:26:03+00:00,2637,0.25 -0x00af769014d231c44d30660ac7804f130b8ba98e6885de5136955f346adcc59a,2022-04-03T16:08:29+00:00,3145,4.39 -0x00af7dc3bae2a78d2b6b0fb1ee03922476861ab93968bf473a246af7c4fe6214,2022-02-06T21:56:40+00:00,4636,0.72 -0x00afd58c0175eeb096487a76ae7d7fd0e708eddcfc9ee1742449f72582fdaa5e,2022-06-19T03:11:38+00:00,1501,0.212923970734945 -0x00b09f83954ebd92ebc0b641c17c1438d2a1e45472af690100ef2fbf45089867,2022-01-26T12:28:55+00:00,12686,0.08 -0x00b0c158da209b360e101405affa57179a8609e6413fdb3581285b983516ba1f,2022-04-19T15:53:10+00:00,1273,0.11 -0x00b0ef8b2b96760f50a25303627b05d5cfb1343cb32b8b5711c08c814585381f,2022-04-08T13:32:59+00:00,2119,0.045 -0x00b207d40f56bc78aab3659dbff296a45a283b5a96ef087fff2fb106cc5f0171,2022-02-18T08:10:16+00:00,8032,1.169 -0x00b222dc99802604b75c4d5f7af97a540390d76ab8d3d7eaf97a80e6f291c1b6,2022-02-13T22:46:25+00:00,330,0.25199 -0x00b27d2809d75c1b71176d7cf9f73481e7b83aecea53f5943265c3b17f0be104,2022-01-29T15:27:34+00:00,10446,0.04 -0x00b282b3676ce60fe2f3f0fca64bd6c5abd1defc2ac3bd62eb47d7d983a79c3a,2022-02-01T18:35:42+00:00,1888,2.5 -0x00b2c5fb1b9a780888a3225826ecdd735211f8d78f78bf3a038000bbf05c33fe,2022-04-27T02:34:01+00:00,5318,26.78 -0x00b2d24f8480275ef2d90268feb70ffa7d467779fda27bcc249a613fd1383739,2022-01-11T10:55:57+00:00,10004,0.45 -0x00b35420c285adadbc4704f8a60a6e2f4746a9650e81dcf12cc514469888705c,2022-01-11T20:47:52+00:00,10244,9 -0x00b383dbfae02c1b8aab55d2565dfbaeea2a6325b28ca57f963f59a83410ba71,2022-05-07T20:50:18+00:00,9954,0.015 -0x00b3d7038ec3f3ddcb954bbc0ac8b2427dfdd2e7d236b3420f009ccc5ee55d04,2022-02-12T00:04:10+00:00,6305,0.06 -0x00b3eee055612740d3c5151ca273fabde39b78b7148883689c4c5dc57bf2353a,2022-04-08T07:03:56+00:00,372,0.3 -0x00b41ed1f793df310a1faa3811706f4b6ef0b800bfc8f23779e38591c2f4e690,2022-06-29T02:56:43+00:00,1,0.49 -0x00b4a3b27b90d347d744de2626b9f458aefa8220a78db46876db4cf51a7b8e76,2022-01-20T09:36:24+00:00,3574,4.5 -0x00b4e8f6993e98108e5c83b2d5b6bbdcd853c22ac06fc2615e3f0045f39235ff,2022-06-18T18:46:25+00:00,83777,3.2 -0x00b55a227ef6646bc6a75c205eba6cd0e8f346cd848b209752771da13f81f68e,2022-03-29T03:59:44+00:00,5283,513 -0x00b586d602dd37599fc334cef3fb12a62a40156939ccb1ece8072c585905a991,2022-01-21T16:56:54+00:00,0,0.25 -0x00b587f4fd5fd9bdb34b77ff97028739ecaeeb16ef09ad450ab488ff99578f38,2022-02-15T21:01:29+00:00,6129,0.939 -0x00b5c7ab236356a1997ef3cae4f29f3d60ec2fbaa1e5361c58ff97a434be00e8,2022-01-31T12:25:51+00:00,2362,1.99 -0x00b5fd4148947008e60965ebb24f62ed3fb124fdea9b08e279681473d4b9f9b9,2022-01-22T23:48:22+00:00,3521,563 -0x00b6461999b7e65a50d72b2b6a79057effbe3c26943a8b6218b4d9f896049f47,2022-02-05T10:53:01+00:00,1606,136.1 -0x00b6acaf543819897d70da6f5415e05b6ab58f7fdf5244f69c2f0c4f13dcd235,2022-02-15T11:46:56+00:00,8865,0.11 -0x00b6b3ce045f4d042b0ce3bf649c306c5d9eda49e6796424be0bc6fe8933c431,2022-05-21T01:33:33+00:00,557,0.035 -0x00b6b7046f0ab5ba17d63e2d08e1e17bc9512131889776a50d22706cdd532166,2022-04-26T11:11:57+00:00,8025,0.82 -0x00b735c7d8d4653cd06a9b4879fd808f53763ec75e01c2dccbf2d7fd1f19e121,2022-04-19T20:11:30+00:00,3807,7.601 -0x00b75d5586437aeb3aa3b6c6b37c65dcb480e966f2f5fa4f2d99a3e7b51b0953,2022-05-24T01:25:39+00:00,7600,0.525 -0x00b815d1fe483b80601304d329b71e3155231dfbb6988f07516cf64ef2c8c512,2022-01-13T23:39:09+00:00,6367,0.48 -0x00b82e670d11ccf2e8b9357f8cc08d3add4dc33ee66c14ccdbbc4d23abf0d5d0,2022-02-01T03:46:56+00:00,802,0.3 -0x00b889d965e6b34b25c6c3bb8eadac7846f76d4879da0a83454b4f32bc316e45,2022-01-19T04:40:06+00:00,1795,1.9 -0x00b9079cdf193d259d5c1a351a8fea2336579b49bff198d4df990dda4ed9667c,2022-04-27T00:00:17+00:00,143,1.49 -0x00b914008732992f1959f10627d2323832c5769f5077bbb5fba9e4276dfc0129,2022-01-23T21:13:35+00:00,9728,436 -0x00b94f7f401876d95696fe5bac9d3067ffd7a7d52d893cc1d784ff6d535ade97,2022-05-08T19:37:38+00:00,855,0.1104 -0x00b97e8177636d10001998b7cb60753bc197b3257bc35a29e66463d751860094,2022-05-21T23:32:27+00:00,9409,0.119 -0x00b99677d8af639a061c924f6933e36b8cf079eb4ae273fb8194733f426b59c5,2022-05-21T14:56:30+00:00,8495,0.107599999 -0x00baa0af50a6ff0eb27323282d210af08aaf7b5f9125975e45502ba0f3ecf394,2022-05-14T08:17:34+00:00,1239,3.6 -0x00bbbd0d2c0086e9aaaec984c4c7e1ac242aac7d5ac7c88a794b7d0c16be6f40,2022-04-03T05:01:40+00:00,3680,0.305 -0x00bbebceae39d028b22eac255889d4f85d011a1e1f2e3dd76eb4f41ba72005b9,2022-01-25T19:14:56+00:00,3046,19 -0x00bc64b64d741a1600553c17fc368210d8d0c30ebe32a25109a8a83e9157820a,2022-06-12T19:29:37+00:00,3733,0.06 -0x00bc82fcb71a635fb36ab135814c6377ca8bdfeeb71bb4d66c68c8004730d51d,2022-01-27T14:23:05+00:00,195,0.11 -0x00bd4c3a84d008d3bb38017d54f47724ff7763c86a3f41bb7f03b69b2355cb02,2022-01-16T23:51:14+00:00,18036,120 -0x00bd8fd5488b5b0c93b75eb4199097205ca50325516e9cac435e4527f672046a,2022-02-12T00:16:08+00:00,935,0.394 -0x00bdc53df01a0c8b784674f4e14de071616a027ddda3efdb3c98f897b8045406,2022-05-26T16:39:29+00:00,1900,0.09 -0x00bdff0f76d582550fdbcb7eb67a5444d167cbe1692eaada3764e317dac4e578,2022-06-24T01:45:06+00:00,2862,0.0069 -0x00be0dc5bdd6bb754780f83624562391809e3d63bbd270fda201277ff1af675f,2022-02-24T10:54:44+00:00,2433,1.22959 -0x00be3e5c8905bbb173318ee0ce1c022e4f0c11d2b4befb04c25df80d3a3da6e1,2022-05-07T18:56:11+00:00,10,3 -0x00be6dc32f2bf8725f70defacdff2e447f4b5ae4f5bb3b9302b6a9d504420035,2022-03-12T23:47:32+00:00,1938,268.6935338 -0x00bf4551fa4b2c69409254dbf574efb358eb2ae8db18696f05bb204295a68879,2022-05-15T11:42:30+00:00,2841,0.0122223223 -0x00bf6852f316604dc2c1d85bec901aa1ee34187a3957bad7ab3f638c3b14efcd,2022-03-31T16:02:14+00:00,4543,20.5 -0x00bfa9d58a4395b04d8151fac3a924a29db1f014a5bbf42def46be56eb9c0814,2022-04-24T23:23:23+00:00,10142,0.275 -0x00c0a358b5c900b5d9f0abe193b397ac1d69474a5542c2d7957a6d2b55ada8c7,2022-05-30T22:27:09+00:00,3203,0.055 -0x00c116f89758bb6408c589eb854b8ce9c4febfa320a89594c59236ae2cd7c42d,2022-04-13T03:57:59+00:00,1657,266.1602184 -0x00c158b3958c1cf4520594f69e3671b212371832625332b939e2cf70252bf2cf,2022-05-17T14:15:36+00:00,244,0.08 -0x00c16494e8fdcea5a2a448a0a082338c4e7d0870b351984fb00f8944a0a87cec,2022-05-31T06:32:37+00:00,9797,0.065 -0x00c1ae6133a549e371b54334d9441281637b92c33f6010d6a6984a176d61fd7f,2022-03-02T21:32:03+00:00,3903,0.001 -0x00c1dab951d08937c630da401756faa16bd6c08978014bca589d968e5f9d4c2b,2022-05-19T23:42:46+00:00,1002,0.101 -0x00c2a62536a105b5ea8d1e721aed79fdca17bbe2f90d8df5939b368122c72233,2022-05-04T19:00:19+00:00,72885,49 -0x00c377a6cd904cf1820294556ba9618f2bf2de1cc7f9614bcfcb59a3cfe41cba,2022-05-28T02:33:20+00:00,4447,0.21 -0x00c386d26d94564cda11127925ec12ee716345081f8c5e53c0695f823ca8b2ec,2022-04-05T05:06:45+00:00,5340,0.122 -0x00c3b71266a59022a056273cc8f6006833f476ba8fe4e6cdeb4091113436967d,2022-01-12T15:07:50+00:00,7936,223 -0x00c3f86d8891dd829a2739fbea7ffb358f5140eef80b24725adeca07fc0a1f38,2022-05-28T17:31:02+00:00,5167,2.145 -0x00c3ff5edd85d6bb83c9ba5d8473f03b165133e2b9ec4f608ac3efc99c206447,2022-01-11T20:40:50+00:00,7386,0.4 -0x00c40bd416e71b1b5862ed7cfdf8bdd6388f44b4a93b0a6a01e0d781aad5605a,2022-01-27T23:08:30+00:00,5283,310 -0x00c44897d73f62c335878b230a975ad66000a8b1cb933b131bdd36ad62e3c875,2022-05-28T04:27:45+00:00,3,0.1 -0x00c4607f37d4282775b1ed8800c76351a9ce7a62c0c279352cf312a380964b76,2022-05-22T04:45:34+00:00,4343,0.26 -0x00c475dd3a3c614cb0200412364de64a92a8e91574d3e179a67a78243cb08180,2022-01-14T08:44:04+00:00,1129,0.0001 -0x00c4b3db2c1fbbc1bf666e6f0065bee3564271bbd0e4137db57944e6ec1c20e6,2022-02-26T18:29:08+00:00,3059,0.45 -0x00c4cb6f1211b5d72cca6a43339dbbfd31b296ab8fbe9024231f42725efd9d31,2022-07-03T12:38:44+00:00,4665,0.012 -0x00c55598e72c7d2914b04d69148ad02d24282cebde67c862c50ce1b7ceedd2b8,2022-05-08T09:25:28+00:00,61407,3.3 -0x00c5c02a1e93b55f460a8066e718f3f328cae651046c995dfcd52bc5d20f4c48,2022-03-31T05:20:21+00:00,5283,475 -0x00c62ee851645356011e5221442283b6ae4c678729fa0248420b5183f551c2fb,2022-03-10T07:23:32+00:00,2871,0.02 -0x00c672fcaafcfb092b8a2a621ec32f6412e1890b92edc3baa980eadd86a195c0,2022-01-24T16:55:36+00:00,2287,1.052 -0x00c701b7e0de413004f7bf3ee0ab59a3312b4b523b15d653ff25071738a7c823,2022-05-31T14:30:19+00:00,7885,1 -0x00c780ab8b3f0d9be43fe7e352557816551c00d914d94fd5b5a1f40adaf46bcb,2022-02-09T07:43:02+00:00,3095,0.01 -0x00c82c8852f51a80b2fd90c8b273a74b74b281b93bf8f913641da3d854a90dfe,2022-05-05T19:29:39+00:00,2917,0.1498 -0x00c882608f756bf2a571fe480316ede9cd1abe9f7d484027e260b4e0f3f006d6,2022-05-19T23:58:27+00:00,9507,0.123 -0x00c8e656e5cda27cce9ea8199a22377ad53f8cf667312ce84170ae7d36270ace,2022-05-14T02:42:52+00:00,10,3.33 -0x00c922513da6dce63767ee58fb1ec06f3f4752e6b5a8f1b7447993524dca61a7,2022-06-28T15:20:19+00:00,0,0.7 -0x00cacee7c84a595a2f95112ca0ee66c034d4dd014bb357e4279052cbd0274424,2022-05-19T05:21:46+00:00,19264,4.25 -0x00cb41c197514e53226c2dc5bb341f414fb6315a5de9aab7e7203129dc7b1b4f,2022-06-21T07:54:37+00:00,1904,2.501 -0x00cb70e46813a8d86a005b5cdc0e6764fa688747b2ba11bd3c4fa041923d3a63,2022-01-11T23:24:32+00:00,7593,28.357071 -0x00cbc11f8125a5dc15c4ff4761d3f81e44808ac123104f1f2fddb69bd141ba3a,2022-04-24T23:46:08+00:00,2901,1.55 -0x00cc1019b3fc194cfbd766a678082392087277e25ab5566cfb465dd315b35b29,2022-05-19T05:05:27+00:00,3945,0.151 -0x00ccc8498c394432975c0bca95dc76605dc81ff17ec707c4ca8435e6bb25ba77,2022-01-17T22:28:32+00:00,855,2.45 -0x00ccdc160a3393f141573f8e4543b558db5044508cd82d1928b25905688727ae,2022-02-01T14:26:20+00:00,334,10.55 -0x00ce95005740a48d10e4255e195a979ca4239bfc035193f3b18ba13ee7bbb79d,2022-01-30T06:29:12+00:00,1865,501 -0x00ceefe117d944682e63022e514ed4b03b2b3ae6c89ec23ed2321eba9efde200,2022-05-21T06:53:13+00:00,2735,0.6 -0x00cf014a49f25d5f6aa4f85a4dbbacb1b14b92176cbc0b1b52da6262c2b7851a,2022-06-08T23:28:46+00:00,6095,0.4 -0x00cfe921c9fbb3d209f1247dff1015769c5a79b15bfb290e6c5994755f5ccc04,2022-01-21T16:55:46+00:00,2432,0.85 -0x00d0025b1f95e48cb7de7db468df8e3a6e6d4caef3399d4b877917e98f6889fa,2022-05-26T05:31:53+00:00,3449,0.075 -0x00d0269ae5147affa69ef9fac23a63ea96b6d86f33d399d661631f965b093937,2022-05-22T15:04:09+00:00,377,0.13 -0x00d11165f0c110832fc237d8d1517735932e7ccf01af025e4d76292bb58d1a97,2022-06-10T15:46:53+00:00,8208,0.1868 -0x00d1500afd3dfde311436a84bf0cface0b61d4c09f029b0a403d19b9f4379a71,2022-02-17T11:43:46+00:00,10225,0.02 -0x00d190888708b47c3d65a0c5aa267937068351e7ad7d4bda123d585d56c86512,2022-05-11T19:45:22+00:00,9579,0.13 -0x00d1f39e6ee4c992634bda99d24bc7b0d43c306f85068b62c1411d6e14535301,2022-02-12T18:32:50+00:00,6638,0.385 -0x00d1f53da9b0f4959e5c54ca346acd02b4200754ee35bc51b885d4d397e83619,2022-02-17T04:26:24+00:00,574,0.2 -0x00d229aecd2a3f45d7009580b134389a1e0ccbd60139f6a165c036568b6a3a84,2022-02-07T13:37:30+00:00,1111,0.1 -0x00d2f2bc45f53c400252082032914a0b7e17db18db9949a3a9b341868b06e136,2022-05-12T01:03:17+00:00,84819,3.08 -0x00d2f701a6a20588fc754ead7090d93b67bfbb2caa6a2672cdfdfebc10646827,2022-03-26T05:24:41+00:00,1865,294 -0x00d36a30866109fb13c1536fed60143ce06084efbf19023c51f6e8337a2d1c82,2022-03-13T18:01:27+00:00,7706,0.05 -0x00d3b2c92b63f0f90fb79fc0c5165d84e15bfb00d2a329eca2c19dccdbf7a088,2022-05-20T02:02:27+00:00,7205,0.89 -0x00d402a00713e99a7c851f012d959462eaa9ae24cc704e1d72bc05a0d2115dd6,2022-05-14T07:16:15+00:00,17982,0.2 -0x00d415f9c2e532a521c6e1e1e28edaf5893fea6afce68cfebb0116851043036c,2022-04-29T12:55:56+00:00,5431,3.18 -0x00d46607def7d9b80539f0b8eb42f69b4a5a4a40325ed5da08d135277889e6e0,2022-01-31T18:48:34+00:00,3950,1.5 -0x00d51d619161ba2c4a947787f4f2cae2cc14582eb69e74c20b41175a40ffe12b,2022-04-21T06:34:34+00:00,4646,0.075 -0x00d523df3efdd2ed6d3516c7088bb7be2df8da4f1c7dd460a7d55a2c4b91eff3,2022-02-05T04:22:54+00:00,75011,3.6 -0x00d57c4fc15db781e18f186574e91d3e3ba06d73e650bfb2274638c3af42dad6,2022-01-21T19:36:23+00:00,4684,0.35 -0x00d6a563b7a17a256b234913a067ded3cf1b4bee2a841ec3dd34ea17f8446ce5,2022-04-09T02:26:19+00:00,4249,1.42 -0x00d6b9a27e27541ac21009b14bc1af8c3db3fe6d62ecc38ff0d966e4a5cdf95d,2022-06-22T10:30:31+00:00,5218,0.3411 -0x00d6bd6795c641cc800e8e4dd302aa47d58adb01e9c9db1700cc5e914e791940,2022-06-09T10:55:06+00:00,16074,17.8 -0x00d7dc1032db55a4933f218a20dc06f706166fce7be7587195107b4f4b838962,2022-01-27T05:54:54+00:00,445,0.0001 -0x00d821f71db813b7c94d89d1e4bee53af8dd06b3c033a4676bf71f5122d7ea4a,2022-05-23T03:08:50+00:00,4750,0.4101 -0x00d86844590e1a40543e1ad6138832b5fb2e6fdf36d190c35f1c40c030b9cfff,2022-06-27T08:02:05+00:00,14882,0.163 -0x00d8b298d4c92a87b0e9f635c2073c63593a4adbdd2535a4ccab31de82406a59,2022-04-10T21:33:00+00:00,719,0.43 -0x00d8b8225b7639a0a61936a5b36b7a58eb848b353e1c00992d53c2bb47694a9e,2022-04-03T01:11:19+00:00,7995,1.35 -0x00d9382c601239682f09112f751d65f26dcd159da050c5699a3c13e24380c7ff,2022-01-11T00:48:53+00:00,2319,0.13 -0x00d9a41d07b40ca3c513088cd8300b305b519a8219270bd0a4e326e278740bab,2022-03-06T09:40:46+00:00,8170,0.301 -0x00d9a9f5c41bf3948083f61c97546c8672e5b2b8aec000f8c3c763f6b3fd986d,2022-06-23T16:27:24+00:00,9728,1347.5 -0x00d9cb1f9bfbefb965f48d6eca21c87ecf3cef936bb235632f0a5bb233b36e30,2022-01-21T17:19:08+00:00,709,2.3 -0x00d9e466150a5ee7acb357275455a94e5846cc4b8ebc524dd243f9c506675a69,2022-05-16T19:58:04+00:00,9812,0.078 -0x00da131bf2fbfc496078421c067ff5f566822af9450343dcfd7004bf79e4aa0a,2022-01-30T00:56:35+00:00,5081,0.16 -0x00da6a59cbf9bd47b147e3dd952f44a6fe8ed3540240a7796bef3be20be0f3a9,2022-07-03T06:40:06+00:00,12,0.45 -0x00da8b016032a8cff3234bb90987126afd9307f619baebcbe2482e5608acf4ec,2022-02-11T15:18:55+00:00,975,0.32 -0x00dadc87442f63ef28974150ce31fa2b139e8433372397534698f5f699233946,2022-03-28T02:57:56+00:00,1880,0.18 -0x00db3d33f455c8b036a56f5303a2dc636d61fc9cb928c35359f517e525b4764e,2022-01-20T15:58:22+00:00,8324,1.299 -0x00dbcbc88d2bfb1f2672ead2a204e1dd82f492591dcf840f6bd1772360d08bfa,2022-01-11T16:15:06+00:00,9153,0.01 -0x00dc21a1ec0f1c3155ccc4dfdf736647e9d34267126d33eca0884ee59296185a,2022-04-19T02:11:28+00:00,3170,0.05 -0x00dc6883473eb2d0165379cd8dbe8c8e51407cdc0d3a48fe96e9781b1559ae02,2022-01-30T17:11:10+00:00,2006,4.338895 -0x00dc6b86c5590e3df6f7ae460ac8d7f1f5a1b4b12dd55191b34881547d461125,2022-05-22T16:31:42+00:00,126,0.15 -0x00dcf88cf369670e67282669287e493cd7b0d66cf6c4c998c596e5bc1d8266f9,2022-01-13T22:37:11+00:00,17452,119.23 -0x00dd2a74167b4853a2ca957c9b85b12e0a50d0537b6f9a64fb09132402d32fa0,2022-01-21T23:58:31+00:00,10255,152.7 -0x00dd85ea560cfe3eaffd60964615ab820d22374ed1af987e25ebbfb7781e5055,2022-01-15T21:59:30+00:00,8770,285 -0x00de37c3262d254bc797497c50d05f2198866b3343396c7945c940770ffff4cb,2022-05-02T18:36:10+00:00,56437,4.49 -0x00dea1b774a39adb40fc73c980a858f3f76070677cd227d362f5da6cc6480e61,2022-04-07T06:15:31+00:00,9728,754 -0x00dea41b8e270fce702af0019a5ccc931c108eb0735bc7afc9844edfdb97a01e,2022-05-10T17:33:21+00:00,5224,10 -0x00dee3db769b0a4f8b04abcf63d3ac7c90e486020aaca0900a6c554492c1891a,2022-04-16T06:52:23+00:00,1,0.19 -0x00df2e43d891697e6b924193b3c660f3a803d1d6b3b1528ba93b6b764c554787,2022-02-06T17:41:42+00:00,6267,0.255 -0x00dfc69853d8f966ba400a300c3799958b5a5f20c4fe05478bb56d99e084491f,2022-01-12T17:42:38+00:00,5676,0.08 -0x00e006a3ab590b04371669542a5497f56945511c7b77da8394d7b64f0f76473b,2022-03-02T04:26:34+00:00,9728,388 -0x00e0752ba07ceb853462178ff8b03d566ddc5e76edbee10221c5073573167786,2022-01-23T06:45:40+00:00,6899,0.01 -0x00e13dee3158c5b8e6f29375aa952098bb6f3bc3daaad7a93d6fe9ca574dda91,2022-04-21T08:16:28+00:00,2164,0.498 -0x00e13eb2b008f54871e1a2dd8a6a32622ffa18e1130d7e8d1ebe0e050eae4cc3,2022-03-06T19:41:57+00:00,5247,0.222 -0x00e2430da0a88785563d527deaa221c1f3dae2e9b8bd4b22085060551cc0c525,2022-03-19T05:33:59+00:00,9157,11.1 -0x00e2ae1f8814c9aa7f200c92b2c6755a9e82d4c118908b1831646e2b98f0b970,2022-04-09T04:27:33+00:00,5691,0.75 -0x00e2b5c7c965e1735971ed50520a458ab358975d9b72ae61fa7cd7581b4f3297,2022-05-18T17:36:33+00:00,3962,0.03167 -0x00e3003e35c5dd48357e5844dda1943a67610626181de24d9bc2559294dad40b,2022-04-25T04:42:43+00:00,9580,1.65 -0x00e36c3874e08cbc3fb19c96d4cd153fad06a2ac45ae33cb1e4fb7807735366e,2022-05-04T14:18:30+00:00,20020,6.5 -0x00e3abb9ba61e6c77de14e3e7058d37f462b2dac050594bcbe64108adc0aa93a,2022-02-13T05:42:49+00:00,5905,0.33 -0x00e42ef09e791840d2964feaccb4f2983fe4fbd9f0c3bd290404da1fe5ea2e2a,2022-05-03T22:30:26+00:00,3599,0.35 -0x00e453bbae77ed40be305727ac91549b698b93f948c626714e23166b67fde7b9,2022-03-12T23:40:19+00:00,1657,309.51 -0x00e4d3b1f62ba92efcf4234ce4527b58ab88f298ffac38b7afeaffb09178161a,2022-02-15T17:20:13+00:00,724,0.1 -0x00e5a39330a01a84372e4edf2054811b2b64aaf63b2dd0ba98ddd345009e2928,2022-01-16T20:54:14+00:00,2693,364 -0x00e600504bc8f94fc828f1e4f38ca5dc2e32ef277af8f2ca32c67a3200d8207e,2022-06-01T00:39:23+00:00,1039,4.1 -0x00e62fa819d62d25bf449ee0f7058e9ef22eda8d517cc146db844adf99aae32e,2022-03-30T01:20:20+00:00,1231,0.11033 -0x00e6468b5ec1d7a15c378508763433de4c49f5a859666b94453016fd57275272,2022-02-27T16:18:40+00:00,3034,0.725 -0x00e663e44467298fac69221df45d9c5d072d8da4e14d0bc3cbc2e20cd20cf856,2022-03-01T17:58:47+00:00,3387,0.6 -0x00e667a4858ad0c108cfebba73d572b24aa9edc566e5e9ea8e4f727c72146e38,2022-05-09T09:50:01+00:00,5317,0.238 -0x00e6ee7850c451de3596a990112defc0330d45be5946a3d06d6cb792a8072be1,2022-04-05T19:46:19+00:00,11084,0.749 -0x00e76fde2939e417670b4461bb257a67c2997a2cb5e587d14b32d10816213e50,2022-05-02T14:38:58+00:00,68734,3.81 -0x00e7983a10ac2218f610893bc4b5537989f2cc38dfe7a0ab330a2a55619a2e0f,2022-05-26T17:12:32+00:00,2717,0.278 -0x00e7a03a2db06c7e5c439a221bfc99f6eda43c3a09ae655512c09583e339aa88,2022-06-14T23:48:13+00:00,3231,0.22 -0x00e7d1a1616c71ec8fd6b2d4d6467a7f14b08deeed68b47518796ff3fb90c030,2022-05-12T09:37:49+00:00,46913,3 -0x00e7f6dfd6df53884eb56c85049d5f695549d5f7f6c599adb19ddff0a03a19ef,2022-02-26T21:58:14+00:00,7201,0.2 -0x00e8db24ad2da1ef46da912ff899b20a518cc6ac8f9ff34331fd6b5a56a41ab4,2022-01-20T14:12:59+00:00,2467,1.69 -0x00e91d6bf2e9a81c29b081b28b6076a82907c3658b359da18d8e34e84be2125c,2022-07-02T07:00:43+00:00,636,0.320971 -0x00e9434c402d6e2ac2f0effa45dd25e4d82ee4ecd7171ef7cff4fb3095d90028,2022-04-03T06:09:38+00:00,9559,454 -0x00e9670d40a78f754007ebb78c5c22db06f982e5eb69a74fd396d4d501184fd7,2022-06-27T14:35:04+00:00,87635,2.8 -0x00e9df25258b09c987e34c6845c9c5d5b07b88abdbeff1ca7e77d975b8b24894,2022-04-05T18:30:08+00:00,8655,0.39 -0x00e9fe5fd173d77066caadb4b7b5d321b3c3613b37afb4dddae85b44be11e63f,2022-06-08T00:50:58+00:00,3765,0.277 -0x00eaa628ab6f8d8a25ff627b3d0ca8ae8df3c64c35789fae2aacfa451ab937cd,2022-02-19T07:42:05+00:00,9228,749.182 -0x00eaf806d7597f93e7751923c390d4aece146ab3758563dfef3c1c812f5929e4,2022-03-29T20:57:45+00:00,9392,0.162 -0x00eb44c9af3440c6207075337b7097f21e1c305fb9d815e6966ea86dcce737f0,2022-05-02T12:18:39+00:00,3313,0.5 -0x00eb54c9f50e9027417f6ac0bcd4a231ee239d7fffc6958eff730bd93c09319c,2022-01-24T04:35:29+00:00,9679,0.38 -0x00ebd4e5326c46776e6195593719a73a2951dd41176f37ff6f1622d29e3a29c6,2022-03-31T21:59:19+00:00,1425,0.3 -0x00ebd6088952a23d3abb93bf4a519984c67b21e92c77a5c102e6001d542b2b82,2022-05-06T05:49:34+00:00,2613,3.44 -0x00ebdc4e5e445772e7ed5c819ef71fb1e9946b68ea0e436bac34ad2bfd6e5a9d,2022-05-20T00:41:18+00:00,1389,0.12 -0x00ec164f681d6b13b49c91d1fff8bbbf253043fdf06772c4f0fa0e9d10447a20,2022-02-12T04:16:04+00:00,1865,598 -0x00ec1fd85d4bc4e36c776a7e37b68dafb0d13f7ff595fabfef3049e9cacb58c7,2022-01-14T21:45:56+00:00,6690,0.08 -0x00ec3a39b7f5ab3ef965ff4e937569c722ae42fef9790c3420d59c8a069aea9d,2022-06-30T23:07:19+00:00,2304,6.9 -0x00ed6c2b7cdb5be14d5faffd47d8f7a56fb3cacc0a44f48ce955594c679dfd3f,2022-05-05T02:33:09+00:00,4980,0.41 -0x00ed7a883aff2f77e48a09bd3091bdbc1c024fcb8acc545dc2b7f4f0bc85d548,2022-01-16T12:04:53+00:00,6958,0.15 -0x00edb2cb536a22c3616789776be73ccfe57a581187816c73e5e934b5dbaa62c8,2022-05-14T14:50:33+00:00,3616,0.18 -0x00ee3b5c4a1c24daab2418b3faafb0fbb50d18506fedc4aaacd30beed4414adf,2022-03-06T06:37:49+00:00,19564,265.0114992 -0x00eeece077cedb33321bcdda270168e742310dfef944f7806532c18c708cec4d,2022-05-07T11:38:25+00:00,8247,0.0225 -0x00ef35121e910c2e2026222bed889918c3dec885c59fa615ff46388cef228768,2022-03-26T02:15:45+00:00,991,1.7 -0x00ef65943d58a4693f6ab662c35a961d1dfe7dbc65710a1055b106c092809bf8,2022-01-13T07:03:09+00:00,10372,0.01 -0x00ef79967e20017593fac458c99aaf647b1702cc8f116f5099abed6f85748fb4,2022-06-13T12:37:28+00:00,2633,0.16 -0x00f03a376424a8fe701a022ccdfd15fda6e66adb46d5a82e50002742c10a597c,2022-06-09T17:01:18+00:00,3090,3.9 -0x00f044355dc80389d70aba599c2c6bf100b5f7429c391eafd19bf02c690aebd9,2022-05-29T20:30:20+00:00,5553,0.35 -0x00f0b1f195036149aea5803f0602b2868b2651c71c480e7269bd6c604c9c23f8,2022-04-06T17:27:58+00:00,4255,0.095 -0x00f100fb1c44f7ffc299d158a683d0a7a052b5bf19ec79768d905ca61a2887ab,2022-04-11T14:02:52+00:00,394,0.25 -0x00f120c987b4b655465f6da5c236455986b5254e894ca57b4d9474716c3803f3,2022-01-15T16:52:12+00:00,6183,98.34 -0x00f12311f56f47f62a527faa9d8db6a6fda944dddecd5c090cb9dd235c106ded,2022-05-22T01:58:13+00:00,4742,0.112544444 -0x00f12ec3a77b3a91089a28c0ed69b0c3d8392b7e0b1550f0df8e548adda36087,2022-02-06T01:28:14+00:00,9559,346 -0x00f12ff79938902c156a2581999c9f106cead449b57e8f0adad92fd0664b54e0,2022-05-04T11:00:05+00:00,23286,27.9 -0x00f14c5ada7265a3c6506aa54763a1da5b9047b6d9e601f75ce4e0c5dccc6988,2022-05-02T14:20:12+00:00,1138,0.3 -0x00f263521d160150bfc03592fa0da9433f28a35580dac3a6ab90ce1538fb86a4,2022-05-13T00:40:01+00:00,2255,0.298 -0x00f2b46a99a1bf29fb9296281ade145282410d9019906b9bdde4cf7c1fad573b,2022-06-22T06:36:48+00:00,1801,2 -0x00f31040299e085abe1eb20f5d8d6171cd1c2dece8e80f9c1ee70d19c3894448,2022-01-28T21:40:22+00:00,37765,0.077 -0x00f33c8ce1dbc505ff62253e92472a1c1af90a98cc08c8788c96a8d943460cae,2022-06-09T22:35:57+00:00,1478,0.1001 -0x00f3780735097da7a47d5c36f4228f6912bf0e61c3b42fa5d3075f621852c6af,2022-05-27T16:27:10+00:00,56828,2.8 -0x00f460a08ad0d7a2b3e4a344908beb037ca2d3a0af122256b06ea625c2357307,2022-06-21T11:38:37+00:00,8567,0.265 -0x00f51ca35cf565b499b151ae598bc9878d5ee2fa21dd924b1703d01611387e04,2022-01-13T13:02:35+00:00,9280,0.035 -0x00f5434cda805fe7024d455e91c12100c85b36f30cb9718a22128f1b4ffa4c4c,2022-02-10T13:29:47+00:00,7,0.305 -0x00f56ace8a3bc5e1bc0ce91b62cef3775130eb6390a38a9589c0aad8dd9d03cf,2022-05-10T19:34:14+00:00,6766,0.649 -0x00f63c4c70f6a9a7a499703e2e515fd9223e414e7310a36d5eab7b76929aeb21,2022-05-05T20:16:07+00:00,16503,5.09 -0x00f653198217990da00d325d8d46d3eca43d5d6abd0e4ddddca1eda7ff46da87,2022-04-23T22:43:44+00:00,0,7.19 -0x00f65674045a2dd3674429b42e477c21c8842365562631ac987e129b379a2d91,2022-02-16T18:27:21+00:00,5610,0.888 -0x00f667b79fc0e5b655da35c52c041a897306c48f6caca5e4073a540b4e6a378c,2022-02-04T07:05:06+00:00,2800,0.1 -0x00f6fb14c455bc6e601219f7d14101f9da0c95c6925f4a25a16fa92bd377770d,2022-04-04T06:19:26+00:00,1906,455.132 -0x00f706af38fcdd8fdd0b4fbf529888980be8593e0fc0fce62c280583bf6cd2d7,2022-05-16T18:35:40+00:00,73649,2.88 -0x00f708467f63cdd35fca2e836df5c6582296c2f751eb75a87dd6d4764a420cf1,2022-05-02T21:13:02+00:00,306,2.229 -0x00f7544b73442e9e72683c00895d7d91029849e2ef09460a75c9ca3f4dfa5a24,2022-02-07T07:49:47+00:00,285,0.1 -0x00f82e383490446795f6ba6210bf4bb270bf4fd80784fe5881a9dc13f7434593,2022-03-18T13:26:15+00:00,5751,0.018 -0x00f84972d28eb14c0dcf36cc04a149689f7bd7fdcfdae159712d2b866694cb27,2022-05-20T22:24:27+00:00,4122,0.15 -0x00f84cb1c8794a948969b6a7e5146ea9646bb2e82698d1f4f747730cfe18e1e0,2022-04-25T21:16:54+00:00,3244,2.8 -0x00f84f28b75e3228d8f889660af4d116b11ab318264adcdebb90242032755b1c,2022-03-31T23:45:44+00:00,3186,1.46 -0x00f8df90845cf7cff8cdb87963572e695aaa7d81904fa224b0d08bfc23cdd6c3,2022-01-30T16:08:51+00:00,7420,0.368 -0x00f93f45caddcdf8d904e50e560fce1693760e9210d72e77772da2bba9f835bd,2022-02-01T22:59:52+00:00,6392,2.55 -0x00f9cd04afa1e99d805814f0cc4ef4e550fa7dd90506622916c45e9e48881c63,2022-03-19T13:10:35+00:00,1236,10.75 -0x00f9d948e33a5bfe4a46fb8792e6355891abf00f8727405006b28b7885d817b5,2022-01-13T17:18:36+00:00,8233,0.3 -0x00fa9750c80f4b1afa33528c7fdbf1e004c8bdc54e3f070998eec5f3ea8c8e2b,2022-04-20T10:02:50+00:00,3085,0.175 -0x00fad797af2f8f2b5e9184debaa39f2dd49a7e6a08ff0b80957d7f1f190dfaa4,2022-07-04T05:24:47+00:00,4825,0.04 -0x00fae49370d3ce81a8f1f1ac631420129915a639d24f8a2e333c23cd2c528059,2022-02-18T06:35:51+00:00,5283,430 -0x00fb1d93fb1a95dee61b54dfa61611ecf06599a358aa1173865a582994e9775b,2022-01-12T23:12:34+00:00,5393,54 -0x00fb592cb5c612cbb2c8ae7f52a0d784ebc3d15e6101400baa64e2285281cff2,2022-05-08T20:27:58+00:00,0,38.5 -0x00fbcd2a3b1a672af6b89a8d6437575c603e10dacb9742cbc446c03f08f726fa,2022-05-30T00:17:04+00:00,1038,2.7 -0x00fbe3e05ec5d6e7d01e61d7df657d0b79454c5349aba1bfd40f8b8f51ec5865,2022-04-26T09:51:56+00:00,1243,0.003 -0x00fc78ea8a2769c8d12b90e668bb9e1afc3abf25525f2e8939a83edf4ae7d98a,2022-03-30T02:18:41+00:00,1948,461 -0x00fc90538adc62ab0c7e5d47c261ccd1f02ffcb0a53fdc179703f5c7dc6d116e,2022-01-13T00:39:25+00:00,1154,0.18 -0x00fce6fcf17245d632dcd66b855a66f25cf4181037b39afa7828cb584c191adb,2022-07-03T01:11:31+00:00,1915,0.055 -0x00fe070de5cec96ed9428cfac70d28a73f0089aa79e7465fda972703e771e5c4,2022-02-21T15:30:13+00:00,3,0.16 -0x00fe07ae58be6a4f3f8d56c59f9f5bd670c777e96b050c923243c40c03e3a027,2022-06-16T13:13:37+00:00,3500,0.06 -0x00fe2482c82ca542c5967768a02d1675aa53d2608dbe70270c2b5c6ddcd8ddc8,2022-01-11T19:51:37+00:00,8077,0.399 -0x00feb813315afc3b52d449bee087b52465c1e7b19069abeea9ab970fb03cf38b,2022-02-25T08:04:41+00:00,5,0.29 -0x00ff7516b845b03b22e2e39944c2a40a7dcd94442c789af9e4ae592ede403abc,2022-02-06T12:03:38+00:00,1,0.859 -0x00ffab14d04c301abde593185b37ff6ae63aad5161b4f53af9c9bea14445b946,2022-03-31T11:18:30+00:00,2466,0.18 -0x00ffdab3713cea07d5729ee4c90c2ac34ab548afef607be03d2fd97a23e5f987,2022-01-11T08:11:59+00:00,9777,0.07 -0x010181b8980cf88e00cf0f56e4b2972d76a78d45d5ca25de35067f3549572af4,2022-06-17T18:20:18+00:00,3812,0.021 -0x0101cac72daed4b77a3a96c2927e35637fa04cad79c09c84d2b8847b7467f792,2022-01-31T08:28:40+00:00,10317,0.07 -0x0101f3a666cd25563b6f96388b082f7ddd627c51c5c1ffb497acfacdfdd31618,2022-03-25T20:06:48+00:00,4969,0.15509 -0x010207e6d3d97d7eb7e613a55d57fcb04ef35af5ccd49b014affb8d3ad9492cc,2022-01-19T21:18:55+00:00,6703,0.7 -0x01020b55462c501a37bff51aa5b0a5f8c5e89199845f63256c9d35dc212eb5aa,2022-02-02T01:55:51+00:00,8336,1.3555 -0x0102276fb8eb2a320d4c853eb3edf340850aa46c6d064263780341589813023e,2022-04-08T18:29:15+00:00,3557,0.5 -0x010228ef5157bea9980ac5f7aaab7b9eacdf751d284a4a4fc283fe1c455d2d49,2022-06-30T15:50:12+00:00,9123,0.2 -0x010276da0dc12f752d2adf8d6ef581265dba624a2a1c610cf72acea240365c09,2022-05-16T02:16:58+00:00,6007,2.25 -0x01027ea0afd606490b9cf360102524a62529da26e7500a16fb0a88feb20b53f7,2022-01-31T08:23:29+00:00,1865,470.38 -0x01031721ee9a5b9566d593dd3c43db016d16fa6ec3d75ca6e1a1fa2e5d813948,2022-05-09T00:07:44+00:00,318,0.018 -0x01031eaa1f4f10cd97ea1888820ec2540e24606acf8eb13229cf57720200a6f1,2022-06-27T07:57:05+00:00,2102,0.69 -0x01035fd36393773914e8666cc3701f952bce3ef9847c3a4eacc9adcfa6b43576,2022-04-14T09:20:05+00:00,5658,0.24 -0x0103c35c86b913fff0c301b79374d01c3118e7320ac06bbb9da4d03946dde564,2022-05-03T11:51:57+00:00,908,0.006 -0x0103e6108b3f983bb292b37b2f784b55a26147e36d5aa803ce07d3148be6a274,2022-04-24T09:53:57+00:00,7735,1.888 -0x010400dba95499751b31ba3c733b91accc675283fa1a0616b5374d3842bc010b,2022-06-08T01:45:16+00:00,6196,0.035 -0x010440e3a6fd1ab1938e581f6e6fe61873d93e2e9c8f5435883c4e87fda31fd3,2022-05-20T09:27:43+00:00,486,0.175 -0x010491ec337ded0174be4f6174599066536910cb17716a99379d8577a6e6d4ee,2022-04-30T21:18:02+00:00,397,0.11 -0x0104c9ef4c3ffaa3c56f019f77e549bcb0c91172e80969757873ed2fc1184191,2022-02-06T01:09:26+00:00,9559,497 -0x0104d1d0ebfd6fa8b0bbc17e96d562c58f52740fe652a47dfea0bfbb52a8b65d,2022-02-06T07:02:57+00:00,9645,0.015 -0x0104ec9a5bd81cbab35597e2c017d7016c90c2babd00a94a63710ff4c1ba6dd4,2022-02-01T16:08:43+00:00,10,0.179 -0x010561d8fcc40e338f4c0b1872883f5f78a902f67f90d518bcca0943767b1c53,2022-02-11T22:09:50+00:00,226,0.35 -0x01057e5bdc6671d223988ce2e93149e8d9dca0bdede9354d7e66966c03503775,2022-02-25T21:43:18+00:00,3342,1.8789999 -0x01066cb05b316a87af21778fc26b6f0171a7bbd8a1a3fd654264e12f1b9f3bcd,2022-05-14T17:11:09+00:00,7661,1.321 -0x0106cf9d6de71b9dcfe1395e22481c8f2f432e4445af850450057ddd19a334e2,2022-03-22T19:41:47+00:00,3387,0.11 -0x0107436529559a63da07fd5ecc0f0786c2271a01bffeccae4c371c85bea79a07,2022-02-08T11:56:51+00:00,3913,0.016 -0x010764008f07f4ace3d5c1cf02bf906d7719de68c85a283dff6da5e586cafa10,2022-01-19T23:06:26+00:00,6659,6 -0x01079a277e40bcfbf66df6d7dd7d2ea2f4750beb7be5f8ed0e83fa2072ddb3c9,2022-02-08T03:38:37+00:00,152017,3.51 -0x0108497eb69a02cf3232a8b85df105791667e3abde8a7c49b0a773bf5d3ba7c0,2022-05-02T04:53:24+00:00,3238,0.02 -0x0108919430d1c44cdf4c7fffac9253492aa08879d5bc979db087290b805fca75,2022-02-02T04:24:14+00:00,5,0.42 -0x0108a231054b28416124e430558c72ecd535ee9518def85048b74450d61073e9,2022-05-04T16:03:26+00:00,1268,0.24 -0x01095fcaaa666ff6264d29a1444fd72d527be3dcc1ea018f1b54aaa4c5287fcb,2022-01-13T09:26:22+00:00,2783,0.2 -0x01098bbf2c32c6dde6c8fdfbc317d27f6fab92dabae4b677fd2455f590601cf9,2022-05-09T13:36:04+00:00,7742,2.6 -0x0109e9cc4f211540ecd61ed5d97d5f8017f1ca242eb7bd2a393d64f663d66559,2022-01-24T14:08:35+00:00,3164,30 -0x010a8dc9f1a1e492d4f6586076bcbf83ec6fcfa1a1029806230c6467e43e111a,2022-04-03T07:42:09+00:00,1865,354.7 -0x010ab1b0e53af03490ff82be4c5064ca17b56ddd6763e5dfcdfb61daa4df0f84,2022-01-31T14:33:37+00:00,5140,520 -0x010aec5a512fdf20a8d7d1a993ca59bfe5093e130b60b98eeea67620f30ad273,2022-01-20T15:27:31+00:00,6271,0.01 -0x010b122a419c922d071aefbc06e5e4794322acc81f29b9cdf610d565eb7828ad,2022-02-02T04:55:19+00:00,3492,7.77 -0x010ba48000d2c661d62a4fe62b13ffbbbd1ae8eae6c03df337b31840edbd718b,2022-01-16T21:34:56+00:00,6411,0.031 -0x010c675ff7fd597fd5070d48d81ec6b66a014a660ef827ce94f4d35966fee357,2022-01-12T11:38:32+00:00,3298,14.1 -0x010cab25945d159b0f553b0ef724d3c21debed934a14cef017fccfdaff38c733,2022-04-26T08:38:29+00:00,2374,0.95 -0x010cc6c4dbc2dee66e6ad1d98c1ecfedc482d6cc7a7261a9700d3b4273f1fa7a,2022-02-11T10:17:48+00:00,9498,0.405 -0x010cd10f9ca582f4751957da71db49668fd49487f8e93dd2e8f83640bf2e781e,2022-02-15T12:53:09+00:00,6824,0.63 -0x010d4055dff3f65b657049e231fb35a93eba36f6c027ade508b96fa73ced462d,2022-02-15T23:52:05+00:00,8229,0.605 -0x010e81dbb1600c6337b7e433962e2cd8398153fc48d49354b0049b03f79fef4e,2022-02-18T06:41:15+00:00,9559,396 -0x010eb751255338317c9ab069609e69e2ccaabee967bb283cd90188668aa551b6,2022-05-23T16:39:07+00:00,4070,19.78 -0x010ef1e1c58770e8b62c2d2492bff480e690747d17b2686d56b56ffb8ca725dd,2022-02-04T03:22:34+00:00,2295,0.22 -0x010f4475f26a8a8d06e38414e595ba97948a7b7ce224871ddcba9a311fbf8a5d,2022-05-19T04:25:13+00:00,6790,0.1677 -0x010f76aa0bacb31a9a05be0aaf3de833338e91c033df28eecc903ce38aafaa53,2022-02-12T08:29:58+00:00,7658,102 -0x010fb0b24439f6805f3c2d091f6c8bac861fff959112e4ee733de63546ff1820,2022-02-06T12:59:47+00:00,8442,4.269 -0x010fc6d1d82a4845fd17bab02acdc166eefc4fa297533ed038146b6ec8f90f22,2022-03-25T04:24:30+00:00,5283,441 -0x010fe428c29a877a078feaccae1f497025bebadc75ba25c72bf3529cb27c66b4,2022-02-27T13:08:04+00:00,1617,0.043 -0x01100445b6c09d1b4df6e855ac3983dc52bd9c5c55c25258b6681dae128326b3,2022-03-05T05:25:09+00:00,1948,244 -0x01105fe78ead5751720cf7d306ccc31f9b1c9e375e631d84026ca2ba1aa64dad,2022-03-03T17:13:55+00:00,2910,0.4 -0x0110804a885d6d30e621dad1bd96b6d062330fd2a6bd4960312ab974f06e528e,2022-04-19T13:43:30+00:00,1023,2.1 -0x0110a49d7940ad2c7ff96fb5fc6c2c8bdb55fc1a8d6932fb257c607ed2db6802,2022-05-17T15:07:37+00:00,6423,1.46 -0x0110ef8faf0e588944f6ba490a5feb5b66779fb318d3288bc4c71700e25c71fc,2022-04-28T04:39:27+00:00,9429,22.1 -0x0110f7cc7d9ec989fde7d3975f361cf6b550b7856a0ce28b5c4a71a39b390fd4,2022-03-23T20:11:40+00:00,145,0.1 -0x01111577042e98e48e9ea4a413ef0b11baa35be903d2e28dae9177644e4c1302,2022-05-28T15:57:22+00:00,2794,18.5 -0x01117764089db814cd6b1aea705b911daf5d1feb11b30a2b63209e6f418b1f23,2022-05-05T21:06:05+00:00,19190,4.5 -0x0111b9b7e32e9fcf14043f18421c0fbf1905808cb989a58117c79397af8f3363,2022-01-17T13:02:00+00:00,10320,0.03 -0x011281c904df649ba7e911080af98fce2eb53a5461d978b5531211fb598ea926,2022-02-09T00:30:31+00:00,575,0.25 -0x01129df9126a894edc8048395d8723e151eee322cba6960db7f06a1f80560772,2022-06-16T21:37:04+00:00,2893,0.025 -0x0112ae553f5931fb7cde9c51dc2456266eb9aae628d6680d125b329c5be914ed,2022-06-03T15:02:06+00:00,4346,0.07 -0x01131cc182f5572a1715d06483ef471b1d9e6710b237a90bec1896f53799ebf4,2022-02-11T03:43:07+00:00,4030,80 -0x011328d62f1db432d362b11ff5796f121d486ad903630b76d12d73553127c0d5,2022-02-06T15:01:41+00:00,2468,0.1 -0x01137d6b04cfb42a49b6649502c3cbfda25a5a073682f9e79c162d748633a24e,2022-01-21T00:42:01+00:00,4087,0.12 -0x0113e9719681fc7433748c99d9dcdbe3e37f1792d7fe66ae8969eff770435a75,2022-03-01T05:15:07+00:00,1904,0.038 -0x0114518876456664e46f367ee0655be7d8e09a53f657a1443735f86f5203357d,2022-01-30T07:13:19+00:00,3083,652.01 -0x0114ca9cc8551af3f1542fa59ae1ee907942cde7fb05c20e14a07a4a93fe718a,2022-04-02T21:38:47+00:00,6585,0.1 -0x0115118fe7ebdedd4d1daad5b49e664f5c8262829105d795203b80adf89f41b8,2022-05-27T21:49:04+00:00,65,0.1 -0x01151bc2083df8994ce0e47635c49ae81622b6e34d9b27dd69c11bffea751b5b,2022-06-13T19:43:35+00:00,7816,0.11 -0x01151da19620b8893e19f52936144ffca55f4df26d61e37c52488b33a905fbda,2022-02-23T06:35:10+00:00,863,0.25 -0x011657bb66b787d56f8d6d4a301e501d30b428a8118ca1f1cc84cdaca8d5f229,2022-05-17T21:12:49+00:00,7856,0.078 -0x0116e82400744d6e7b6b38a8154fc000539b2d8e2bef4243dfe1993aee8a709e,2022-01-11T20:26:10+00:00,3152,20.74 -0x0117387ad80df042927f08ed117c4b41da148b8c7cd66a5b29ad64d609cb5924,2022-02-21T05:46:56+00:00,5283,452 -0x011752af5c916a220762845793f64083cec0ce1706a5ce1db96e8b52b431b603,2022-05-17T21:58:49+00:00,4422,0.091 -0x01177421223eede163476978861b93935d9dc5bfb798daa3246c2787cefd3bca,2022-02-04T21:32:03+00:00,7086,0.035 -0x0117fb3bfa4d3b707ffa8fdd78b639432a796372baf4ac4d25c6f3977c4e5d94,2022-01-11T22:18:29+00:00,4308,248 -0x01186a59ac52e9173129c23eeb72b844ed3abe00a11656adcac982c7797cdbab,2022-05-12T00:51:52+00:00,45121,3 -0x0118b6d8adb4e43adeb961e56a69a02d48b70c3853e936fb8b47c9671a82749c,2022-05-17T15:44:57+00:00,4770,0.11 -0x0119279b98e11a19de4d3b96feff575c30e12da5ec2c4ee91674b8ae13901cde,2022-06-22T18:45:35+00:00,7172,0.08 -0x011998c8d29b57b43574811841890a3d3e4cec6e8a864523da570c4aae3324d4,2022-04-13T10:39:25+00:00,1558,29.9 -0x0119a3de84968ac6d722d1b39f7c39e201a084b7f447b5abfc2ecfe8e26fad70,2022-01-19T15:09:33+00:00,5283,436 -0x011a280af65ded0bf39ac9e8258c24fdaa40fe61c9ef49b7324dee18dec552ad,2022-03-15T14:43:08+00:00,6251,0.45 -0x011a3bc09dbcff3f920f273252c1af8603971726890d104c3ee6399103b51b96,2022-04-04T23:39:36+00:00,8569,5.75 -0x011a89f875bc0dc384be93438780ed3ac16d20a438ee953e53cb43d0a80fd825,2022-03-05T11:33:52+00:00,4678,0.086 -0x011ad16b0c8f101f1b3da3192d5409e848621e852f5b57f9f5a5117e6c21fd3a,2022-02-21T23:40:52+00:00,5159,1.85 -0x011d31a49944adfa861a4071cd4d0dfe57e320468471611ca371efbc173da520,2022-02-01T13:39:37+00:00,6385,1.95 -0x011d41740f69449423f8e38f4cc0cf9fea1ec9c53f694b3dfa77c170d2e7cd09,2022-06-14T09:04:14+00:00,974,0.05 -0x011de4e7016a4b2f3a22d059ea362efb48b2320a478cc08a614a866bf312dfdc,2022-07-03T09:19:50+00:00,34255,0.252 -0x011e41d03207747ccdac09c245421a7d43c0ba3f69ab26b2adea792a9a75a733,2022-06-04T18:24:18+00:00,1218,0.115 -0x011e8cc04663bc8158220b37bc2972d1f258e844b9a047e746a7fc997dd647b6,2022-05-10T14:40:21+00:00,7823,22 -0x011e8e5063fc617a357f002849f93537e171719dfea084b464acb668862125f6,2022-03-18T11:52:32+00:00,10,0.01 -0x011eb4e22b6d8ca304f185c148d38531555235695caf78f3fa64b164b8455dd4,2022-05-17T15:18:50+00:00,5618,0.149 -0x011ecc56a6e9f87cd795e897cc27aed402628654797b70e8b6ddaa50c6c9ae69,2022-07-03T12:05:06+00:00,63,0.76 -0x011edc03e10b84f4147be02f8d390069eb409736e3136660f25082702e606246,2022-05-24T22:28:48+00:00,5199,0.0774999 -0x011f59d4b11ea84d2aa40066ca5364e1772a9c7d89313273403bd1bbdc6714a0,2022-01-29T08:36:14+00:00,9647,30.82 -0x011f9e46d853d71e2ace7b75473684a258508541f951ff10de999fa09df871a3,2022-03-23T04:16:01+00:00,1938,242.4006412 -0x011fa928442bbcc65ba86710880c5375654526ca07a53dd90fc14e748c8d129d,2022-01-25T22:29:42+00:00,17282,905 -0x0120647db7fda7a6bff5772d4bbadc23287e9590d6d9e1d456c4b927e97b94e4,2022-01-11T08:11:17+00:00,9534,0.05 -0x0120db74b8af4dc0111c666911c12f651a6d19ee1b1501ee49458ee7bb639d29,2022-04-15T07:04:27+00:00,3886,0.511 -0x0121f159556a19bb63fab8a2b9aa9a629513cc94600ae479e2747b0b601aa330,2022-01-27T22:12:21+00:00,15573,0.4 -0x0122256e00e0e4a3d6cc65021deae5f4d8ec3d72fbf3bd2570b61852e924546f,2022-05-18T10:57:48+00:00,5461,0.165 -0x0122448d6df1bf780276eb863c33e235e376689db9cc88b64aa9a640a1c2206b,2022-03-27T22:51:15+00:00,1,0.73455 -0x0122515e72399a2a24682c88b5c642edf0079d9c8d9b1190bafb4af28a98dde9,2022-01-28T08:32:20+00:00,2811,192.167 -0x0122986a364e383af6667097799ba9e4d766793ad0b5b3b624b53437862c4dbb,2022-01-11T20:58:51+00:00,15645,16 -0x012333d92192c48616e8d2b7022716f01e713c2a83b9292988f5cdc3ddbb1202,2022-05-28T22:16:16+00:00,256,0.07 -0x01233d031f9ac53820b01a270668015674624b612bb4073d91fbec2d9fe87576,2022-05-15T21:29:01+00:00,4010,1 -0x01247b2ab7fb66524ff56f51e5d614dfb479f1587675166b8ad56fca93f2600b,2022-02-25T10:05:23+00:00,1060,2.22 -0x0124c8399c12c9ddf827be0b4bf9d4b7c2ba98e82bcdc04f93214959b994d16d,2022-06-11T03:52:59+00:00,15381,0.0678 -0x012512e0f8cbb819819770b88824dae11a12a6c4b88af8c497fa9153a15c9668,2022-04-29T16:20:51+00:00,814,13.8 -0x012687690cd369141e233e44dda605f824af0e79e2b93821d9416d00bf267857,2022-04-24T08:04:48+00:00,5365,1.4594 -0x0126b5f77113d3a02baa9b2a514fee31396483775384f9ab544e7002ee15ec16,2022-02-18T01:36:48+00:00,2864,0.002 -0x0126becefc55331880dca34f369527dcd39bad05403041953a6e8da434cbd459,2022-04-24T02:29:19+00:00,2480,0.011 -0x01270411c36e8ea5bd736d5da0df45a569e282ef21971d4231cd820dc5a79874,2022-03-08T10:58:31+00:00,13461,0.52 -0x01270e0cbf90c8002151f9bac4238a9b1d04a6f88387c0519ccc4ed07f6375bd,2022-04-22T05:13:00+00:00,1486,0.057 -0x012722cd82916a66d535a345e764ce72df0d078f19c5b00f947d555017f07a18,2022-05-16T05:01:04+00:00,1949,0.024 -0x0127815bda7b0377b66ce84ae65c52c3840808509ee67517aa9189d53551d14b,2022-06-17T13:14:41+00:00,4136,0.15 -0x0127d5a6470312e6240bad6b4b8615357b7729547e48b90154e67addfb0a7b30,2022-05-02T00:14:59+00:00,25216,6 -0x0127e4ce69c5037ad8d57efe842b3c1af83ca80bd0bcb1546434594e6e00139c,2022-05-18T20:09:00+00:00,2509,0.031 -0x0128367ca08f6362da835598b76ed51ab3114b37022d7561cb517dfa1a50e87b,2022-05-19T03:16:44+00:00,6769,0.4 -0x01285ae8afff05eb0c3ccc5c37b9dc315231d86ed72077a91c5610717e91f36d,2022-04-02T15:39:43+00:00,1,0.19 -0x01286f09accc293427a587790f76992f88aff40a3f448c1db0b17078c1418841,2022-04-20T18:29:48+00:00,2446,0.4 -0x012873207328c98bf9d8398b4be0ff223643b3788e1c5f1242edbbaa723190d1,2022-04-14T08:37:39+00:00,8244,0.217 -0x012880cfc1d8db4f0352bfe8d5d99b160ab37fb7cccff8ca2e942466e9652e18,2022-02-24T23:16:08+00:00,15386,0.02 -0x0128ad4dccf852669fb983c0df0082924087c1fb07da6305b35a29e4b012ec63,2022-04-03T12:36:01+00:00,3461,0.22 -0x01293e68dafaeb831bec4c734c982d9817bf477ea745fe224218d0ee6dd2b62d,2022-03-10T01:18:48+00:00,23013,0.13 -0x01297f68fac3446a17eda072ee1963ed16177c8baca8c2c2731bd415dfa40826,2022-01-22T23:38:22+00:00,3239,137 -0x012a3f26c2983a8f26515a730447fb62ee60e8654348c55f9dbfbde3450b489c,2022-03-14T02:09:02+00:00,99,0.9 -0x012a987fb89744172b4f6e7af8b728822c2d5be7e7196142a5e9a2f5a6469db1,2022-04-04T18:59:46+00:00,2242,0.1269 -0x012affe8eedc285f5172838c9aac001aef2544a7335d7484ef1c101ac98a1c0e,2022-06-11T13:30:30+00:00,2298,0.01 -0x012b544e46126b2f3b05a252d5c95d48a2d58bec2793f1b67e32c61df1960699,2022-01-31T20:07:54+00:00,3151,18 -0x012b7f476b509211eb75f44d3dd219b22240f7406e0cab86e7ce140a7d0e7315,2022-06-21T05:17:40+00:00,5413,0.009 -0x012ca81befbbed1174f9f66f07c8918d4584a7acfcc10f6fc0156fe66015e84f,2022-01-12T08:00:34+00:00,138,0.15 -0x012d31aa13d937a1945fc9e10c116d4fd222af0d5dd45401b6853e80188ac73f,2022-06-19T15:28:14+00:00,0,1.04 -0x012dd65e199e375e362ba251863fadf1a2aee140b05e3fa89f57c5374503cd2b,2022-04-28T07:42:18+00:00,6675,0.0361 -0x012de8e9c17c24eddb1ffa61c8e6c3d73847afc9c36633919ed56323f2d5f062,2022-02-10T08:49:54+00:00,8284,83.3 -0x012de9bda1bc71f1dadd9bf2e0449d7d56e3fdb011fa500f505dcbfc95a8b732,2022-01-26T11:56:17+00:00,3790,122.93 -0x012e6d9ab0e29e1dc71a687c03278c47696a082c9d5504e867e115493844c8c6,2022-01-11T20:16:44+00:00,5770,0.05 -0x012eb787fae4bc61403f1a4eec2a3d03b0af1b5bdac7e1ad27917658f46eb7f4,2022-04-01T06:43:20+00:00,1119,1.5 -0x012ebfb9f91fda68c3df487f1e1d2e558d7a46ec38feddcbc8472a52b950ec5c,2022-02-05T22:42:01+00:00,5009,0.0748 -0x012f2123a94e851ac0c105543471be3dad5823d237ce13b87dcdebbaf8d2f47d,2022-02-26T14:54:04+00:00,843,0.198 -0x012f8ef884eaf7f55cb43b24e33cc3af3684e2e2c16f03acfa75f7efcf3d62da,2022-02-10T05:26:30+00:00,6912,0.66 -0x012fac23d08150489f1b07334ffc59cb4ea1d749d29343e818557684312345e9,2022-05-02T03:22:07+00:00,84479,30 -0x012fbd734d32be917794079db1ba04230ec94bbe86d1727e0ba7dd4163e0b9eb,2022-05-23T18:07:01+00:00,4,0.0009 -0x012fcacb3dc23aefb44f1f7c7232e05663f0e34fd97b3169fe101549cde9b314,2022-06-29T12:37:06+00:00,4069,0.09 -0x012fccda2c0665a36747f5fbdb3296e53843711d01871a554760fce1d745358d,2022-03-04T04:17:57+00:00,1616,0.029 -0x013061ff954026511c8c12be3e35a96383267e81a74500f8560569bf4e78b451,2022-05-23T19:35:51+00:00,3769,0.1028 -0x013071bdf9f235036c7ebe7aaa7bf09e6869e0e145db8adb8772c3164409c369,2022-02-18T05:14:38+00:00,1549,1.802 -0x0130b4da0a206c9c844aa689ffc2c207f15c5c2b17165d3c1c61f40121844a9d,2022-01-22T11:54:32+00:00,338,1.69 -0x01313b849c4d3058a5e4694dc7134f4a9b9e2f3ba0e2470c2c27c9d2cb85866c,2022-02-03T09:45:03+00:00,986,0.1199 -0x013179a05acdd085c17dc790e9deb12d604ff7e28237cba6258ae1953450019d,2022-04-21T06:17:29+00:00,835,0.489 -0x01327293356fd1020b345c7d688db6944e3ab55e33b4cb663e00ea039691e845,2022-02-18T11:55:21+00:00,4019,0.2104 -0x0132e682826ae8611c3c517620ec599f02747619d2f4ed30af7fc73af99fcf9b,2022-05-21T21:31:01+00:00,2,0.5 -0x0132f0c5698ba3aeadab2ded6fbd259a5cd1acf11744ed9b8ab1cae00bd87128,2022-01-15T23:04:01+00:00,1938,25.7 -0x0133905490547d22bb4b2158d38d4d868e2bb81e59c1388e80a1fe393cdf166d,2022-02-14T18:58:56+00:00,2524,0.43 -0x0134a950c0f564ef5980fd6c77fe4ce54c46a0de567b2958812b214c4e053dcf,2022-04-26T09:37:48+00:00,954,0.0369 -0x0134cfe0bbd7e71aa197b885a4400af610e77ac8e1fdfe9e62236a1defcf34f4,2022-04-22T16:58:46+00:00,4557,2.399 -0x0134e283be2bbc1474154a4d56c0911f1f0d848d6a878524c6f34d68ef094160,2022-01-23T21:56:33+00:00,3161,9 -0x01350bebf301e6cd2bbbe4053eb774d9e9d93c1770db8acc074c94398f941a82,2022-05-19T23:48:01+00:00,7255,0.21 -0x01350ec18410bbd9d6869f177f48f142c6386595a9e97dacb7718f105fe1de22,2022-03-22T04:46:58+00:00,5283,352 -0x01356fe1d97d6e6ab48483e0a56e59b7cc3477e8984d62cd993b1e5d0d1a1709,2022-02-13T17:35:46+00:00,2204,0.3 -0x0135cb36f7dcb477b64c229c8c53174f07f10f91ac17d239e56c2b9d59edc8e4,2022-03-29T08:35:06+00:00,959,0.24 -0x01360115dbf32d74ba7852a96b939d1969b01f1aa0f0efef659c66cb1d5f2366,2022-02-13T08:23:41+00:00,8475,175.0725075 -0x013625de69f515c31cb667df7dad897a498156dca374a3fedbf89333ad9c00b7,2022-04-03T06:39:24+00:00,1906,344.132 -0x013705671aa24c4d5b00764635bac34071e867527c6985c17ad8b2bf74cbbf45,2022-04-30T09:24:58+00:00,29676,39 -0x01380588a775a3d613dec92b7f2e232192d154ab717ddec81ec1e51fc9d1fc97,2022-01-29T15:56:52+00:00,1229,0.2 -0x0138f0aa464ca2a9dd8c883ef379eb17238573a3dc0918fa854630a326be7c37,2022-06-24T06:29:28+00:00,4186,0.185 -0x0138fefd78b846771fe8d293f2ef0bbc975976a2b26985559fb47ddfff03540f,2022-01-30T00:20:36+00:00,459,2.079 -0x0139781923bf5b4aff72f789c9b1870cea2eef87f27dbc9f7ac259497c9e2b2e,2022-03-22T11:29:44+00:00,4817,1.88 -0x01397e4dd673b6c2a90ea3b5a049277cd7f944ef08068d1ef2fd8ce3593073be,2022-05-04T03:34:34+00:00,7655,0.07169 -0x013996b07eb14df4529104abb19c163abe4f52b25b5a8651dc7f4b240b975433,2022-05-14T15:04:15+00:00,2508,0.1269 -0x013a07cd24504df380b2a06f13410c6663968be21cbca0b4d4046a06cc520e91,2022-02-04T03:47:55+00:00,4823,0.45 -0x013a58bf7dbed09b441fd37a79922bac4c4ab075f0e72d826f9e509043df16ca,2022-02-23T01:35:02+00:00,7225,1.65 -0x013a7e75719f0013044fd19b69a64cba8769b62dc832b0f5e8f0c1b80d40518d,2022-06-09T14:39:28+00:00,5445,0.075 -0x013af2923f97fc2b8e63cda610d4fa31f99ffd75ddb21d2ceb7b6f0724d549f3,2022-02-05T02:57:56+00:00,2614,0.133 -0x013b39c37c298b407590acabd5af1c09aae72fcff40487167c0ea5a2317d85c7,2022-05-06T16:22:39+00:00,3349,0.29 -0x013c8b2939b1f9ce99c627e5b61cd18043d30cdbcc7e621f0dd4405d1f50cd8c,2022-03-30T18:23:49+00:00,3421,0.8469 -0x013cc6571ed4ccceb023ad26cb895b800461f46119da7b5afeff3db6b78cfade,2022-03-25T06:32:11+00:00,6744,3.4 -0x013d0eab1a5bf329d4da1d6c45c92fe5528d121ddf1708e41c746830cc5253b7,2022-05-05T21:45:46+00:00,8663,3.8 -0x013d5843c1c335873b907ee028a8e2457a06576ac094a08b1fce5c6a7d6221da,2022-01-27T18:20:33+00:00,3361,3.3 -0x013d8bd37f5b9cfc7ac38ba13420f8108b95aabe0771d79f32825776c47aaf2a,2022-02-11T14:56:41+00:00,623,0.03 -0x013df17d50f7d41e2b58195c1eefdc0ea2f88758fa9c36526c10b9b7bb33661b,2022-04-05T18:55:22+00:00,1976,0.0988 -0x013eb9edd46c1292b518a9a19710876fc016d3b46cafa332adfd8327464b2036,2022-05-02T17:51:58+00:00,11931,0.85 -0x013ec99f0d766f1fec0a6b7c1a3a969010d6841c7865ffe5b1eac8e7edf45942,2022-06-30T13:52:27+00:00,718,0.032 -0x013f16bcee7e3c6d6503b1dec2603e55461f4947f56a2046c9e41624f5eccaef,2022-04-04T06:48:06+00:00,610,0.77 -0x013fd454f2aa0e6b858d27fcfc316f9d171ff27d88af77540b988c2f6752b807,2022-01-12T18:14:03+00:00,1182,0.47 -0x013ff1f9cbc5adc7cafe794e735ffa78fc336ae59b0fc4d7948efd39178a9915,2022-01-15T21:20:48+00:00,645,0.25 -0x014058ddcd3473cde5ded4206af019ec00c416c8ee0f09f8d44b05ea754ae5f9,2022-01-20T13:50:57+00:00,2423,0.3 -0x014085107283326f6be973192f0f308ad864352e41eb4c2ae6306b3a389a036e,2022-01-18T07:31:59+00:00,2226,0.08 -0x0140c96babdc2ceae69a0dd4e71601760457f4355e94edc38aa87cca3ba54ef2,2022-04-21T02:23:18+00:00,5200,0.234 -0x0140e4c8b3be147f37f35d8d3d844d5ba5e636b37f0f2b520d4b723ee0e5cef8,2022-04-01T20:59:22+00:00,1,0.13 -0x0140f635558f07b1334e3d0586b59fe8b5105a0dc5c1dd282b7cb118e6d30415,2022-05-06T17:36:16+00:00,1004,0.5125 -0x014193bac6f68eeb3439e88b9851d87727a46fb29c4cdfb0647c1e9e579def04,2022-01-10T13:55:00+00:00,2913,0.05 -0x0141b6c98cad0a210c12cfc055d12567496776d88ea32a33e3d82bbdebc691a0,2022-04-27T19:59:37+00:00,5841,1 -0x0141bcbcb9737eecb62e815dc002d3526d952f79d360472d96c53be82f1d33e7,2022-03-19T11:23:28+00:00,1,0.255 -0x0141d53d7cd1975c12995bb0b640b5d015b77c3a278331f6ead0d28ee77ac1ef,2022-03-30T20:27:25+00:00,520,1.2 -0x0141d93e3b22e85f2690220928f94380a745b9f7d667f1043f58489e27631576,2022-03-08T03:19:55+00:00,1865,266 -0x01422817f6b3709e37600f3f198a7b99435ed1fd5e7563927dbe49b76dfa5207,2022-01-31T12:37:23+00:00,1420,0.2888 -0x0142759766d330121aea0d4e35475e94f2289bd690732e3becf5c56262cf2fcf,2022-04-25T08:57:48+00:00,7209,0.044 -0x0142e778c4d38e0a6b03b3c5aeac17368c3cc33520cc336a6ee6559b14338dff,2022-01-28T22:23:59+00:00,7353,1.5 -0x01432226d4436328e5be605b2c5b300a720025f8a5fbc795244f30b29daee001,2022-01-05T16:42:12+00:00,3918,0.428 -0x014393282d73986919a10556212419beaa89024b83a918afce162e535ad5bad2,2022-04-13T15:12:59+00:00,165,0.06 -0x01439e520c11ec21838c2f262acc95c98db8cee1a2a4f220e68eaaf038201d5f,2022-05-02T23:37:49+00:00,1080,0.8 -0x01441a2afe1b41a25c6d8d33eed9618d944110dc7bfcd637fce69a5eeb5d6f7f,2022-01-17T04:43:06+00:00,5192,0.6 -0x01443fc13607ccaffe5e9f5094de608363ea61dfbebfb70c18e5e71dc1f91ff7,2022-03-14T00:38:33+00:00,1920,0.0505 -0x0144929b8492865312807d266382abf7e4fb60635747e70c14bca5dda91eab4f,2022-01-16T15:23:58+00:00,1,0.035 -0x0144c742286213ed3c00a3c5a88260b45b1f13ae2bd2078c268f2807e8e5cc06,2022-07-02T15:50:24+00:00,5288,0.1 -0x01454ce3cd36590eb61b1bd003b4eabfa0ba7bae2c78ffc669bb949e479b856f,2022-03-17T16:07:46+00:00,7375,0.48 -0xa45c2cc5922b10f8dc44520cb857aa01b149fe1df56e36dd91f3f0dcdac2f699,2023-02-17T04:19:59+00:00,8830,5.05 diff --git a/seeds/looksrare/ethereum/looksrare_ethereum_v1_trades.csv b/seeds/looksrare/ethereum/looksrare_ethereum_v1_trades.csv deleted file mode 100644 index af3ed242fe0..00000000000 --- a/seeds/looksrare/ethereum/looksrare_ethereum_v1_trades.csv +++ /dev/null @@ -1,11 +0,0 @@ -block_number,tx_hash,buyer,seller,nft_contract_address,token_id,amount_raw,platform_fee_amount_raw,royalty_fee_amount_raw -14749831,0xe0336323d6e540c6afde8b092c19629e873bf65659b637beee25acc213b59f05,0x9547e02d92f39f5d9d00ad20925dd22df1fc1a36,0xe80ef3e29c4a8de3867260104befb1ae2d88de57,0xed5af388653567af2f388e6224dc7c4b3241c544,2261,9.51e+18,1.902e+17,4.755e+17 -14749341,0xaec7e5fb824d88c3cd97f3d8cf9271255553fe9f6f1735b87023530170ed819f,0xa91419d0c9bcd89eaad97c16b3057c7d96688536,0xa99df6986beb0006b2e0c1f4be026a1821a13ca6,0x34d85c9cdeb23fa97cb08333b511ac86e1c4e258,91765,3e+18,6e+16,1.5e+17 -14745927,0xcb8d4240b5453d8ea292993e6456849abbbcc7c15b010b79087bda0e40045882,0x31837aaf36961274a04b915697fdfca1af31a0c7,0xe4c2f917640b0a12a8a94bd2d07499c36db832b0,0xbce6d2aa86934af4317ab8615f89e3f9430914cb,9176,1.79e+17,3.58e+15,1.79e+16 -14750412,0x09e44e399e334a2ea741dbb9767ae689cad07995a638c68ca32d3cb874567c6f,0x49620d1f3ce8f607f9b8f5bd7295ab75785f4bab,0x002a99690ab1989b7971db28cd4a7673e1e6f495,0x34d85c9cdeb23fa97cb08333b511ac86e1c4e258,99247,3.4e+18,6.8e+16,1.7e+17 -14745937,0x374c9a7b47a365b2c967cde2ca2d926e527801c630d96c06a91fd4af5a453a8c,0x02c7d6a071d363123694da8263498da7c0ff70bd,0x46873897f487119f34ffde1e6819dbda90cf8acd,0x34d85c9cdeb23fa97cb08333b511ac86e1c4e258,63254,2.739e+18,5.478e+16,1.3695e+17 -14750168,0x63b718d63962680950dac50f7285d46ca267b7384de294fcc47c1b9b9ead61b4,0xf8c9c83b2787435fa504ccabc07ed7e66dd4e93f,0x9832ff728c61236b32fb6f6e3c7e993f6c5bba88,0x306b1ea3ecdf94ab739f1910bbda052ed4a9f949,7215,1.09e+18,2.18e+16,5.45e+16 -14746661,0x5fc3092953d0c05fc8191cc23a6032b9690b6dd0069e56eb94ba733d9c6ce71f,0x60577490f99712525e4a36d559256c6f99c788f3,0x17331428346e388f32013e6bec0aba29303857fd,0x60e4d786628fea6478f785a6d7e704777c86a7c6,19722,1.924e+19,3.848e+17,4.81e+17 -14749045,0x8b8130bc5d3a81d638d83c1aa79d5cfdad6818fad7d10a0b45b6d2941738bb09,0xb17cf8ef22a650b6de374a14fb1cabda635fdd8b,0xbaf6b2f3b5ed4a97a242dc44d8268cb427fdfc44,0x34d85c9cdeb23fa97cb08333b511ac86e1c4e258,51869,2.7e+19,5.4e+17,1.35e+18 -14748039,0x5f4b498121a4809afa987a66cf54059a879991e0e2c2b6bae1e7b39cffa2f9cf,0x4caf82a6914f5e00f8296bd729c3fd9bec9c500d,0xa099ec99966fa615c29b1ec56ce403fe655bca40,0x306b1ea3ecdf94ab739f1910bbda052ed4a9f949,10977,2.2e+18,4.4e+16,1.1e+17 -14745425,0x93f8ac1a5283288a18529d9159b1ed6f51b6319a4dad82c7b51bca21b7d276d6,0x80b8cc02807197db68bce43a2236f522ce333170,0x79c58ecf1d9e0a6c27fda1a1b67e88ad9c568034,0x60e4d786628fea6478f785a6d7e704777c86a7c6,22017,1.712e+19,3.424e+17,4.28e+17 diff --git a/seeds/looksrare/ethereum/looksrare_ethereum_v2_trades.csv b/seeds/looksrare/ethereum/looksrare_ethereum_v2_trades.csv deleted file mode 100644 index bac8f2eea9a..00000000000 --- a/seeds/looksrare/ethereum/looksrare_ethereum_v2_trades.csv +++ /dev/null @@ -1,11 +0,0 @@ -block_number,tx_hash,buyer,seller,nft_contract_address,token_id,amount_raw,platform_fee_amount_raw,royalty_fee_amount_raw -17001140,0x27045f81c5698478ff4d6142ec5ef667f0e0693784726c91d9727174b648cebe,0x06e14b037650e6d7c5e6a8eb329e1b44e2d7650c,0x43b4fba85628566d62a3b83c8f1df309bcf08983,0x2ee6af0dff3a1ce3f7e3414c52c48fd50d73691e,3687,4.23e+16,211500000000000,0 -17000405,0x3800f5cc168bbc593fb2deae39944d8852d8805cd5338fe447dd2c8d0a66f12b,0x04bc337f14ad1f7ed42a03f89c5e44ef1ce792f9,0xcc6096439d445fb8e0a988fd8fc1817120b3de4d,0x762bc5880f128dcac29cffdde1cf7ddf4cfc39ee,8868,5e+17,2500000000000000,0 -17003740,0x0e5c655384418098bc07c40af649394ff2f3d51151775df6b315c11ac1a52fa3,0xa854772db43b52d7b456c2b5a40bd41627b316c2,0xc935aaa23734fce35843829d2a39c3920172a0d6,0x595a8974c1473717c4b5d456350cd594d9bda687,11467,4.975e+20,2487500000000000000,0 -17002686,0x572e2b3741efc9ea41b90e9bb95a15700139df6359ddb344e699013e4a4aeef1,0xaf6376e68437ee82d1e0e47ae9c217f35681074c,0xa2a9234dd5db7be6c31372b51f2b1328cf28b407,0x03b8d129a8f6dc62a797b59aa5eebb11ad63dada,2262,1.171e+17,585500000000000,0 -17003734,0xf0a2211bbee83745a59a18a5d453e9b03d4b9cb62f96fa954a882da0e7501446,0xc935aaa23734fce35843829d2a39c3920172a0d6,0xa854772db43b52d7b456c2b5a40bd41627b316c2,0x595a8974c1473717c4b5d456350cd594d9bda687,11755,5e+20,2500000000000000000,0 -17003993,0x316c5b2ccd73c6c29e194cae20198cd7b6ac6a6c862b71f69e52c54b46bf6c71,0x51768b7ca1f0e82c68c240b981f7433b65fd5629,0x120ef8f2485750aeedc1d5619d87e8360166e491,0x8dcb8b2d721c022552d826f8bcf2995747248d31,486,1e+16,50000000000000,0 -17002746,0xe1eeb5c4b15fc814bd5e10832779bcd770541b3bb374eec73996e9c7a83e509c,0xaf6376e68437ee82d1e0e47ae9c217f35681074c,0xa2a9234dd5db7be6c31372b51f2b1328cf28b407,0x03b8d129a8f6dc62a797b59aa5eebb11ad63dada,1741,1.258e+17,629000000000000,0 -17001154,0x0a2bf893af1f2c12e43e5ce71fb994921cac5c4b9df7e99f25c5e3b59494c2f4,0x06e14b037650e6d7c5e6a8eb329e1b44e2d7650c,0xf8442ae38a8246f425b7928fb60fd61bbdf5d459,0x2ee6af0dff3a1ce3f7e3414c52c48fd50d73691e,4120,4.22e+16,211000000000000,0 -17002726,0x757b19eaa3bec734450b3e02e9dd72c86a822f746f702bbf5c9fefee325f274e,0xaf6376e68437ee82d1e0e47ae9c217f35681074c,0xa2a9234dd5db7be6c31372b51f2b1328cf28b407,0x03b8d129a8f6dc62a797b59aa5eebb11ad63dada,1997,1.181e+17,590500000000000,0 -17002693,0x1bb237727108a12eabb4c2ce03d5399a70fb8ec8374e4fba66996c1a031d0754,0xaf6376e68437ee82d1e0e47ae9c217f35681074c,0xa2a9234dd5db7be6c31372b51f2b1328cf28b407,0x03b8d129a8f6dc62a797b59aa5eebb11ad63dada,2577,1.176e+17,588000000000000,0 diff --git a/seeds/magiceden/polygon/_schema.yml b/seeds/magiceden/polygon/_schema.yml deleted file mode 100644 index ac05c0bd420..00000000000 --- a/seeds/magiceden/polygon/_schema.yml +++ /dev/null @@ -1,15 +0,0 @@ -version: 2 - -seeds: - - name: magiceden_polygon_sample_trades - config: - column_types: - tx_hash: varbinary - nft_contract_address: varbinary - buyer: varbinary - seller: varbinary - token_id: uint256 - currency_contract: varbinary - amount_raw: uint256 - platform_fee_amount_raw: uint256 - royalty_fee_amount_raw: uint256 diff --git a/seeds/magiceden/polygon/magiceden_polygon_sample_trades.csv b/seeds/magiceden/polygon/magiceden_polygon_sample_trades.csv deleted file mode 100644 index f803b8c8c4d..00000000000 --- a/seeds/magiceden/polygon/magiceden_polygon_sample_trades.csv +++ /dev/null @@ -1,26 +0,0 @@ -block_time,block_number,tx_hash,nft_contract_address,token_id,buyer,seller,currency_contract,currency_symbol,amount_raw,amount_original,platform_fee_amount_raw,platform_fee_amount,royalty_fee_amount_raw,royalty_fee_amount -2023-04-14T01:58:32Z,41504710,0x443c3a57a1b8b53e24834c36d27922cddb53d99ba12b61b1a037533240679ea0,0x16ffbcd475781514c1905c213e049fcce7ee4a7f,14,0x225081e982e68ca6f726e348da128b67d05d1576,0xecafe1156f006ccf92e63a7e16c9876ff5f5cdf6,0x0d500b1d8e8ef31e21c99d1db9a6444d3adf1270,MATIC,160000000000000000,0.16,3200000000000000,0.0032,800000000000000,0.0008 -2023-04-14T01:58:32Z,41504710,0x443c3a57a1b8b53e24834c36d27922cddb53d99ba12b61b1a037533240679ea0,0x16ffbcd475781514c1905c213e049fcce7ee4a7f,13,0x225081e982e68ca6f726e348da128b67d05d1576,0xecafe1156f006ccf92e63a7e16c9876ff5f5cdf6,0x0d500b1d8e8ef31e21c99d1db9a6444d3adf1270,MATIC,180000000000000000,0.18,3600000000000000,0.0036,900000000000000,0.0009 -2023-04-14T01:58:32Z,41504710,0x443c3a57a1b8b53e24834c36d27922cddb53d99ba12b61b1a037533240679ea0,0x16ffbcd475781514c1905c213e049fcce7ee4a7f,11,0x225081e982e68ca6f726e348da128b67d05d1576,0xecafe1156f006ccf92e63a7e16c9876ff5f5cdf6,0x0d500b1d8e8ef31e21c99d1db9a6444d3adf1270,MATIC,200000000000000000,0.2,4000000000000000,0.004,1000000000000000,0.001 -2023-04-14T01:58:32Z,41504710,0x443c3a57a1b8b53e24834c36d27922cddb53d99ba12b61b1a037533240679ea0,0x16ffbcd475781514c1905c213e049fcce7ee4a7f,12,0x225081e982e68ca6f726e348da128b67d05d1576,0xecafe1156f006ccf92e63a7e16c9876ff5f5cdf6,0x2791bca1f2de4661ed88a30c99a7a9449aa84174,USDC,200000,0.2,4000,0.004,1000,0.001 -2023-04-13T08:44:46Z,41478111,0x4f3e3fe7a633fc602d9ac92aa88262586bcc15dba93a4b59fb3f2cc13562bbb5,0x16ffbcd475781514c1905c213e049fcce7ee4a7f,10,0x225081e982e68ca6f726e348da128b67d05d1576,0xecafe1156f006ccf92e63a7e16c9876ff5f5cdf6,0x7ceb23fd6bc0add59e62ac25578270cff1b9f619,WETH,120000000000000,0.00012,2400000000000,2.4e-06,600000000000,6e-07 -2023-04-13T08:44:46Z,41478111,0x4f3e3fe7a633fc602d9ac92aa88262586bcc15dba93a4b59fb3f2cc13562bbb5,0x16ffbcd475781514c1905c213e049fcce7ee4a7f,5,0x225081e982e68ca6f726e348da128b67d05d1576,0xecafe1156f006ccf92e63a7e16c9876ff5f5cdf6,0x2791bca1f2de4661ed88a30c99a7a9449aa84174,USDC,200000,0.2,4000,0.004,1000,0.001 -2023-04-14T20:51:20Z,41535248,0x8c7c06448154eb2b80fb83a74f8d53ca7c4051fabe1600a28ceb74d058c89bcd,0xba6666b118f8303f990f3519df07e160227cce87,8,0x83f741fd08ae9286589b3c618b9371f424196178,0xe07edb37cddc19aa5fd3110d77658369755ed721,0x0d500b1d8e8ef31e21c99d1db9a6444d3adf1270,MATIC,14000000000000001,0.014000000000000002,280000000000000,0.00028000000000000003,700000000000000,7.000000000000001e-05 -2023-04-14T20:51:20Z,41535248,0x8c7c06448154eb2b80fb83a74f8d53ca7c4051fabe1600a28ceb74d058c89bcd,0xba6666b118f8303f990f3519df07e160227cce87,16,0x83f741fd08ae9286589b3c618b9371f424196178,0x87999855c8b8a15d23e3bb9326b9ce6241fdde7b,0x0d500b1d8e8ef31e21c99d1db9a6444d3adf1270,MATIC,11000000000000000,0.011,220000000000000,0.00022,550000000000000,5.5e-05 -2023-04-14T20:51:20Z,41535248,0x8c7c06448154eb2b80fb83a74f8d53ca7c4051fabe1600a28ceb74d058c89bcd,0xba6666b118f8303f990f3519df07e160227cce87,7,0x83f741fd08ae9286589b3c618b9371f424196178,0xbd5dbbc1b1d0e182293bd0915090c4331f34562a,0x0d500b1d8e8ef31e21c99d1db9a6444d3adf1270,MATIC,4800000000000000,0.0048,96000000000000,9.6e-05,240000000000000,2.4e-05 -2023-04-14T20:47:28Z,41535154,0xf5cdac86703bd70ad0f5e70be6faf77e1187badbef6edd69dd9c3e8346584832,0xba6666b118f8303f990f3519df07e160227cce87,11,0x83f741fd08ae9286589b3c618b9371f424196178,0x87999855c8b8a15d23e3bb9326b9ce6241fdde7b,0x0d500b1d8e8ef31e21c99d1db9a6444d3adf1270,MATIC,100000000000000000,0.1,2000000000000000,0.002,5000000000000000,0.0005 -2023-04-14T20:47:28Z,41535154,0xf5cdac86703bd70ad0f5e70be6faf77e1187badbef6edd69dd9c3e8346584832,0xba6666b118f8303f990f3519df07e160227cce87,8,0x83f741fd08ae9286589b3c618b9371f424196178,0xe07edb37cddc19aa5fd3110d77658369755ed721,0x0d500b1d8e8ef31e21c99d1db9a6444d3adf1270,MATIC,14000000000000001,0.014000000000000002,280000000000000,0.00028000000000000003,700000000000000,7.000000000000001e-05 -2023-04-14T20:47:28Z,41535154,0xf5cdac86703bd70ad0f5e70be6faf77e1187badbef6edd69dd9c3e8346584832,0xba6666b118f8303f990f3519df07e160227cce87,16,0x83f741fd08ae9286589b3c618b9371f424196178,0x87999855c8b8a15d23e3bb9326b9ce6241fdde7b,0x0d500b1d8e8ef31e21c99d1db9a6444d3adf1270,MATIC,11000000000000000,0.011,220000000000000,0.00022,550000000000000,5.5e-05 -2023-04-14T20:47:28Z,41535154,0xf5cdac86703bd70ad0f5e70be6faf77e1187badbef6edd69dd9c3e8346584832,0xba6666b118f8303f990f3519df07e160227cce87,7,0x83f741fd08ae9286589b3c618b9371f424196178,0xbd5dbbc1b1d0e182293bd0915090c4331f34562a,0x0d500b1d8e8ef31e21c99d1db9a6444d3adf1270,MATIC,4800000000000000,0.0048,96000000000000,9.6e-05,240000000000000,2.4e-05 -2023-04-14T20:30:50Z,41534719,0x1e60690c9fcbf79d294dc65529d0ba700ac732bad2120527ce48791be195b20a,0xba6666b118f8303f990f3519df07e160227cce87,7,0x83f741fd08ae9286589b3c618b9371f424196178,0xbd5dbbc1b1d0e182293bd0915090c4331f34562a,0x0d500b1d8e8ef31e21c99d1db9a6444d3adf1270,MATIC,4800000000000000,0.0048,96000000000000,9.6e-05,240000000000000,2.4e-05 -2023-04-14T20:30:50Z,41534719,0x1e60690c9fcbf79d294dc65529d0ba700ac732bad2120527ce48791be195b20a,0xba6666b118f8303f990f3519df07e160227cce87,8,0x83f741fd08ae9286589b3c618b9371f424196178,0x04ca5b4ffc26c8c554c83dadfe7a8d2ef9bf5560,0x2791bca1f2de4661ed88a30c99a7a9449aa84174,USDC,9000,0.009,180,0.00018,450,0.00045 -2023-04-14T20:25:26Z,41534581,0xb5a629a99a9217b4aeab5857b183af85168fe227cf6cf2a55d0f482ff618714a,0xba6666b118f8303f990f3519df07e160227cce87,8,0x83f741fd08ae9286589b3c618b9371f424196178,0x04ca5b4ffc26c8c554c83dadfe7a8d2ef9bf5560,0x2791bca1f2de4661ed88a30c99a7a9449aa84174,USDC,9000,0.009,180,0.00018,450,0.00045 -2023-04-14T20:25:26Z,41534581,0xb5a629a99a9217b4aeab5857b183af85168fe227cf6cf2a55d0f482ff618714a,0xba6666b118f8303f990f3519df07e160227cce87,11,0x83f741fd08ae9286589b3c618b9371f424196178,0x87999855c8b8a15d23e3bb9326b9ce6241fdde7b,0x0d500b1d8e8ef31e21c99d1db9a6444d3adf1270,MATIC,100000000000000000,0.1,2000000000000000,0.002,5000000000000000,0.0005 -2023-04-14T20:25:26Z,41534581,0xb5a629a99a9217b4aeab5857b183af85168fe227cf6cf2a55d0f482ff618714a,0xba6666b118f8303f990f3519df07e160227cce87,7,0x83f741fd08ae9286589b3c618b9371f424196178,0xbd5dbbc1b1d0e182293bd0915090c4331f34562a,0x0d500b1d8e8ef31e21c99d1db9a6444d3adf1270,MATIC,4800000000000000,0.0048,96000000000000,9.6e-05,240000000000000,2.4e-05 -2023-04-14T20:25:26Z,41534581,0xb5a629a99a9217b4aeab5857b183af85168fe227cf6cf2a55d0f482ff618714a,0xba6666b118f8303f990f3519df07e160227cce87,16,0x83f741fd08ae9286589b3c618b9371f424196178,0x87999855c8b8a15d23e3bb9326b9ce6241fdde7b,0x0d500b1d8e8ef31e21c99d1db9a6444d3adf1270,MATIC,11000000000000000,0.011,220000000000000,0.00022,550000000000000,5.5e-05 -2023-01-30T16:33:38Z,38710726,0xb86869577ee5f5740617c326bf8dc302abbf555236c14d14fed14cd20b1a9a07,0x5d666f215a85b87cb042d59662a7ecd2c8cc44e6,7583903,0x45e9105e61a2455af444f503aa416c11d3456796,0x1213a46dd9ad97338385c462a133dec6786cb685,0x0d500b1d8e8ef31e21c99d1db9a6444d3adf1270,MATIC,20000000000000000,0.02,400000000000000,0.0004,400000000000000,0.0001 -2023-04-08T10:21:23Z,41286148,0x5b93e49a6fd2a0fbf56fd6af4ca71e1fc05791840d6f038a8c642cb1f153645c,0x670fd103b1a08628e9557cd66b87ded841115190,5632,0x23ad2b673f85449483c0998dde163640fead11c2,0x1f246641f51073aeddf197d8e38ecb88e87d1437,0x7ceb23fd6bc0add59e62ac25578270cff1b9f619,WETH,2320000000000000000,2.32,0,0.077256,77256000000000000,0.0 -2023-03-30T16:56:32Z,40946034,0x473b2ae16136be4eeebfdf84c65749769fa89d6abe1381bc7b2bbe06287fd6f6,0x670fd103b1a08628e9557cd66b87ded841115190,7536,0x609a37f469fb38a2d40665c6ad587efa90917e1c,0x8234ad49dcbbafdbd4689c06cee9ca3bd6e3897b,0x7ceb23fd6bc0add59e62ac25578270cff1b9f619,WETH,1750000000000000000,1.75,0,0.058275,58275000000000000,0.0 -2023-03-30T03:14:49Z,40923733,0x9fc4439824208224a50ed2e8a28686bbcccaa363e3270960278715870210937d,0x670fd103b1a08628e9557cd66b87ded841115190,8726,0xe0b52149724bc363ef60ac785bf03eec029833b8,0xc2ca58d0c4f2301fc191e1ffc07a479743b6f3b9,0x7ceb23fd6bc0add59e62ac25578270cff1b9f619,WETH,2490000000000000000,2.49,0,0.082917,82917000000000000,0.0 -2022-12-05T06:21:17Z,36444272,0x1db6db50ed58c792e46df9186a770aaa876d3c496ab9f559d30f89ce68faab4b,0x67f4732266c7300cca593c814d46bee72e40659f,395362,0x9396c0fed2af8257f59437f461de1c8ff7b06630,0x0abce0b39ffb60f9520a6eb3de64bc4c4da4c9a0,0x7ceb23fd6bc0add59e62ac25578270cff1b9f619,WETH,800000000000000,0.0008,0,3.2e-05,32000000000000,0.0 -2022-09-26T12:17:48Z,33589463,0xa11e2cc9e3d92b2ecf8dde2d8fe84d0cc2dd75bad0042da757559cc0477007d7,0x67f4732266c7300cca593c814d46bee72e40659f,371166,0x2c4664f85b69f4b22eb7b1b52498a76770a12c8a,0x91ff070462ab026a823a1d6ea7744d5421bce53f,0x2791bca1f2de4661ed88a30c99a7a9449aa84174,USDC,227880,0.22788,0,0.0,8440,0.00844 diff --git a/seeds/magiceden/solana/schema.yml b/seeds/magiceden/solana/schema.yml deleted file mode 100644 index a3303892987..00000000000 --- a/seeds/magiceden/solana/schema.yml +++ /dev/null @@ -1,7 +0,0 @@ -version: 2 - -seeds: - - name: magiceden_solana_trades_solscan - config: - column_types: - tx_hash: varchar diff --git a/seeds/nftb/bnb/nftb_nft_trades_samples.csv b/seeds/nftb/bnb/nftb_nft_trades_samples.csv deleted file mode 100644 index ace81b97d36..00000000000 --- a/seeds/nftb/bnb/nftb_nft_trades_samples.csv +++ /dev/null @@ -1,4 +0,0 @@ -block_number,tx_hash,token_id,amount_original,buyer,seller -11477718,0xec91184a7d3259163e53248393fe5e0e065c97721e52128e3737b50eaff03bcd,3286,0.8,0xa0af8c602cf7ba65af48947ad603bdb3dca9ba9d,0xb746392bb158c37d18e911cc63fb65d202817a71 -15996071,0x7d57c2ab0e4d8a3ca6245173cb6666b677a13a03f58acea77fb17c7bb6df54fd,12406,0.1,0x83a7640e07e63b21957520b8d599a1400377a092,0x5bdb3dab4f55251e68e572d873dc7bfc49c0c849 -18425936,0xe1d37cc7c5863673902acb7df4ec17e45c7951e4e4e09bc10d7eccc7ea8b275e,13097,0.06,0xed5e70dc3214cb0dcb3beb3f1b9b4bb6e087a508,0x6e00422d2e2f06088b27a23ecde8c4a13e73f528 \ No newline at end of file diff --git a/seeds/nftb/bnb/schema.yml b/seeds/nftb/bnb/schema.yml deleted file mode 100644 index 935ec97d25b..00000000000 --- a/seeds/nftb/bnb/schema.yml +++ /dev/null @@ -1,10 +0,0 @@ -version: 2 - -seeds: - - name: nftb_nft_trades_samples - config: - column_types: - tx_hash: varbinary - buyer: varbinary - seller: varbinary - token_id: uint256 diff --git a/seeds/nftrade/bnb/nftrade_nft_trades_samples.csv b/seeds/nftrade/bnb/nftrade_nft_trades_samples.csv deleted file mode 100644 index d4f53e5087f..00000000000 --- a/seeds/nftrade/bnb/nftrade_nft_trades_samples.csv +++ /dev/null @@ -1,4 +0,0 @@ -block_number,tx_hash,token_id,amount_original,buyer,seller -24540264,0x61844c5082981839169b9aec66aa1d86d0cf78cbd7d337838bdf25aa08186da0,102016038038,0.3,0x5c6631657b4fe10ab5b9353674f87a3883ad7d2f,0x836a38b59c3226a3e7f8fc8b15a87a398a008888 -24552538,0x9c48f24b3d5b902f6141800d8d0405966c860ac19c7ac93c53d6078eb45df7a1,274,1,0x826547bb2ec83f7d70b8ff9755c106e1c6f51c1f,0x06ac921952c4a5904a08a9a29d3f09d38728cef1 -22407143,0x8b32c7921db1acbadced7e7cd3312827cf53ce9d3d5ad7a32112dcd964c79220,43896,0.008,0x59827d64fa596880541e53b8dc14af4ae05025f9,0x46b6d95e3c571bf62155efe7809e87c2f11ed675 \ No newline at end of file diff --git a/seeds/nftrade/bnb/schema.yml b/seeds/nftrade/bnb/schema.yml deleted file mode 100644 index 67c7f1c9167..00000000000 --- a/seeds/nftrade/bnb/schema.yml +++ /dev/null @@ -1,10 +0,0 @@ -version: 2 - -seeds: - - name: nftrade_nft_trades_samples - config: - column_types: - tx_hash: varbinary - buyer: varbinary - seller: varbinary - token_id: uint256 diff --git a/seeds/pancakeswap/bnb/pancakeswap_nft_trades_samples.csv b/seeds/pancakeswap/bnb/pancakeswap_nft_trades_samples.csv deleted file mode 100644 index cda155dd53b..00000000000 --- a/seeds/pancakeswap/bnb/pancakeswap_nft_trades_samples.csv +++ /dev/null @@ -1,21 +0,0 @@ -block_time,tx_hash,token_id,amount_original,buyer,seller -2021-09-30 10:06:35,0x3355dd01e13ff82d293b515ee898cf32733dd545c6c07a8d559549a6ac6dd1c1,430666,0.064,0xafe45ab5a3de11fb1d62fa3753b5050a74746f29,0x9800d40068a4380a7397dc95f8312f2e685a5265 -2021-10-01 10:24:37,0xa4a629f7c9459624757a347287e9d1daf2341cebd4f18a174d929c7877385726,436334,0.05,0xfc30175de1dca8a4cd53150fe3564a3b1b70a460,0x78054d69ac1977d4b9a07eef5149ad6a0f196c00 -2021-10-01 22:14:28,0x5b60d0eba1752237073ee0ad3667e3a9d4a29920cca88f1e9dd68de747aa1c9b,356621,0.1685,0x9a6d078080d4f3f3d7ae5c815fdc0f916869d775,0x81009f3114303ba0ca99aff6257c032d1cbd1e0a -2021-10-21 3:57:17,0x14e2c43cc7161fd289af006c9aaf0582207cc77e054c8952951727427847c130,395401,0.0599,0xac11088f343075ccbdba46d7b13e1dc16fa9b2bf,0x25985e4e1a60aa334005d147c8d0ebcc4fc75970 -2021-10-23 9:06:38,0xb4e5d40941b761d229c9cf26e3e8a9cdea6ce0c6cab2f436cb56d8e3b98f82de,105435,0.095,0xeb7384e81dc3bf963e60ff8f4b3873f9e59c040a,0x6918df5d42764dfea3e47365c65c5ceef38e93d3 -2021-10-28 1:02:16,0x342dc104220e57eead62554dd03548bb7d733d8b6279946bf54990f98a7ef0ef,236209,0.037,0x86855386f3747dbd868a71b9674671e4b05d24d2,0x3f0d07eb59d75fa2b59eb90391a90a59e1cc24e3 -2021-12-30 4:50:46,0x344a7f708d8b891e76cd1e205e7b7d3fca2f0658c49fbe8bbc7007f89139954b,808851,0.013,0x85f4fc4df600ed02df93b0c11ba3b2b35b59f606,0x93e8339693bce225e64861743d8b1cd168ddd888 -2021-12-30 8:39:15,0x15f71294f6b88036ace6e9c43cf5d38e34bb325273db6a6a38632f6840706e33,40004,0.02,0xdc7e31b985cb5d6cc97045c0b2334717c0c5d3d1,0xbcd98c531667c83cd7ef82c3539ee78749081ff8 -2021-12-31 5:41:46,0x2d5899848ce0ddf7f0c861fa1d7e97e77b982831f892fb0b1ea978b6d51e208a,837935,0.009,0xd623e113b373c058bfe94c8049ddaf321a8c98e4,0xda71bff7569db52ef2ee8ac4ceb4fbebddde5b84 -2022-02-05 1:13:24,0xca7656b7d1a86df6eefc60c2609585172c6fe6718313baadaafcbafce71f8870,878,0.66,0x94e2755e2ab5f206d2b6fdfa4c91a2691bdbe051,0xfa839459b8033fc5a4554f802d667e5dba381130 -2022-03-08 23:14:15,0xc3b3bdd2eb861722ff6819485b8ca69c11166134a2c7116a56cd46b26bd256ee,275853,0.0165,0xfe29374f15604fae2d88439b9f9122daf5440915,0x1dc97f2b616e83889572d0e754ed65eff9a0862d -2022-03-13 13:34:46,0x1ee940c5e64724ff909ef5149db8e90516143f703e3012168ba7fcb87eea8641,632,0.05,0x91841c28da9d90537da49d8e25a83e64d579cc73,0x3a2b576ef1884f10c4b18c06d55e7c07fde4ec12 -2022-03-25 17:14:42,0x4d2ca712422ec7952979ff7c18796fadd97de1da19b4746f034b908f4de481ed,2486,5.88,0xd84e9762ea94136628db63cd7a41205e20e75eb8,0x8ff7927b5eda0fea1f8e1362d9d590f75de93b96 -2022-04-17 12:51:13,0x7109b15577d8bfb221b59b2af0694670a06b7e7363c59c0113d30660089fc8be,352080,0.107,0xe88178ff95a219165de252923a9ae70a73b18ce2,0x50e3bdfc1c58159f55ff6803848cffe2183f6a89 -2022-04-18 16:09:43,0x952bb32a1c1b4ef3fa6a9dd363104c6117cca64728f9a3231090e6e97d06463e,796554,1.67,0x208b91fade3f2a627f2a7fd95d7ed1f619e01284,0x8847d7b8e3df29d16f5fc32764ebedcabfe6e951 -2022-04-28 17:38:2,0x074830f9dced8b8fccd6b279951dd00ec8b7a1325e26faa912e64c1f714ef9b4,9094,23.8,0xa8d81cd9e28cad330675ad3b74eb9100663fb5e4,0x208b91fade3f2a627f2a7fd95d7ed1f619e01284 -2022-05-03 13:09:56,0xbaa4fde93431fe5047a02ff69a22abfdbe699bd7804ea11274854c4158197ffd,1951,15.8,0xc5dbe2c25172d77da4b2e125260e47c094f59585,0xc5ab141b5d0e2accff7eb2bc98fb23bfa022c542 -2022-05-06 12:09:51,0x74f8bc56e45cc90e0bbbb5aacb3e31f9be5a05a17ea55474048361bcca4a67b6,1383,0.55,0x8c0069470961677cac20bf7853714948c6545d97,0xcda04b40fc8a8db9d53a57d5767831c74967a129 -2022-05-22 17:14:33,0x436c2812b943495f6b89ee8d348e4b84ff5d59a328a3591f658af8c7db69748c,863375,0.0065,0x2d06212b8485a17dc221096b2d1ab3e6ab16bcab,0x3dfa8515fecd0c1646752f53c9eb5f1736d7d79d -2022-10-02 15:09:15,0xf4d12d2343750283d3e37c80fbcb473316e09054b19d7dd1ac3b61a323a4fb7d,822937,0.0125,0xd2150665d42296a289df1f4d44cef1f9ab483bb6,0xdfa05fccd1f6e000903db5326f6827096cd772c5 \ No newline at end of file diff --git a/seeds/pancakeswap/bnb/schema.yml b/seeds/pancakeswap/bnb/schema.yml deleted file mode 100644 index 7afc50c14a0..00000000000 --- a/seeds/pancakeswap/bnb/schema.yml +++ /dev/null @@ -1,10 +0,0 @@ -version: 2 - -seeds: - - name: pancakeswap_nft_trades_samples - config: - column_types: - tx_hash: varbinary - buyer: varbinary - seller: varbinary - token_id: uint256 diff --git a/seeds/quix/schema.yml b/seeds/quix/schema.yml deleted file mode 100644 index 35295b84111..00000000000 --- a/seeds/quix/schema.yml +++ /dev/null @@ -1,16 +0,0 @@ -version: 2 - -seeds: - - name: quix_events_seed - config: - column_types: - tx_hash: varbinary - buyer: varbinary - seller: varbinary - nft_contract_address: varbinary - project_contract_address: varbinary - tx_from: varbinary - tx_to: varbinary - royalty_fee_receive_address: varbinary - token_id: uint256 - block_date: date diff --git a/seeds/trove/arbitrum/schema.yml b/seeds/trove/arbitrum/schema.yml deleted file mode 100644 index 994d7828a1b..00000000000 --- a/seeds/trove/arbitrum/schema.yml +++ /dev/null @@ -1,19 +0,0 @@ -version: 2 - -seeds: - - name: trove_v1_arbitrum_nft_samples - config: - column_types: - tx_hash: varbinary - buyer: varbinary - seller: varbinary - token_id: uint256 - - - name: trove_v2_arbitrum_nft_samples - config: - column_types: - tx_hash: varbinary - buyer: varbinary - seller: varbinary - token_id: uint256 - diff --git a/seeds/trove/arbitrum/trove_v1_arbitrum_nft_samples.csv b/seeds/trove/arbitrum/trove_v1_arbitrum_nft_samples.csv deleted file mode 100644 index dedde14115f..00000000000 --- a/seeds/trove/arbitrum/trove_v1_arbitrum_nft_samples.csv +++ /dev/null @@ -1,3 +0,0 @@ -block_number,tx_hash,token_id,amount_original,buyer,seller -6778004,0x793368b4f98718181c8c3b70808fe6551cb7c9edafc99cc43863b50e068047f4,8,16.65,0x812cda2181ed7c45a35a691e0c85e231d218e273,0x0b9dfd38542cc9f69a69c65cada77ac24dbcfab0 -6833341,0x0f5caf0571ac588df5c7c8fa08c3f3eed8f0ce1b40e66529e66c6864b39f6154,77,7.6,0x812cda2181ed7c45a35a691e0c85e231d218e273,0x2661362e99a66defd7ffa752b8976adf59426a31 diff --git a/seeds/trove/arbitrum/trove_v2_arbitrum_nft_samples.csv b/seeds/trove/arbitrum/trove_v2_arbitrum_nft_samples.csv deleted file mode 100644 index 9210120cff9..00000000000 --- a/seeds/trove/arbitrum/trove_v2_arbitrum_nft_samples.csv +++ /dev/null @@ -1,5 +0,0 @@ -block_number,tx_hash,token_id,amount_original,buyer,seller -7866345,0xd78a65ee2fdb6d6719a5b6bf7ad0cd6713bf32213c5c5df480fd49bcf13072f0,3,150,0x97a1341c5c827706bcbc30fb7064ec423262ce92,0x7d8e4b2b6a436f55c67a3001c1a9a6a219f3e1d3 -53056674,0xdeae45d8832f70f805f5e671ea8c313aa8819d24281ac008810b40c9939ed7e9,4560,160.0,0x2c6dfc6f7ad5f9cbb08b60a958e8189d427497d0,0x3eb2b60929ecb88f85234da59e529d656b4e5c49 -54532480,0x0ea8e7e59593e8809d7d18cb3b3cbb4f2bb132a2bee107789db8002c47b7ca5e,10554,808.0,0xf9c1989eb95dbc89489410cdf3941541937016ff,0x72f49af425d059a476d3c7abeecce86c0e587a4e -32342040,0x0b00a76301676ce62cc85b0ca3b4d056a4f4c19c7a8fcea4db7056cb94752c26,5981,0.01,0x938594ac888f330dadb0ca61930b5a369be119c6,0xb0704ba969a38d17b318ba00be16c80cc83ce976 diff --git a/seeds/trove/ethereum/schema.yml b/seeds/trove/ethereum/schema.yml deleted file mode 100644 index d729cf0b4b9..00000000000 --- a/seeds/trove/ethereum/schema.yml +++ /dev/null @@ -1,10 +0,0 @@ -version: 2 - -seeds: - - name: trove_ethereum_nft_trades_samples - config: - column_types: - tx_hash: varbinary - buyer: varbinary - seller: varbinary - token_id: uint256 diff --git a/seeds/trove/ethereum/trove_ethereum_nft_trades_samples.csv b/seeds/trove/ethereum/trove_ethereum_nft_trades_samples.csv deleted file mode 100644 index 1d520223af5..00000000000 --- a/seeds/trove/ethereum/trove_ethereum_nft_trades_samples.csv +++ /dev/null @@ -1,3 +0,0 @@ -block_number,tx_hash,token_id,amount_original,buyer,seller -15907892,0x28855536b504c2042dfe4f1fd231686cb1ee7f8dbdefa0865fd197a71dc940d5,3540,0.035,0xb0e5ca05aa921da8b194766341ee6630f4288e98,0x75e55dd9914870a415532c2bb5b969d5a3437841 -15437418,0x62a2a156aa224918767b28f4ce6999bf227aa8ad5f518c0ba9c0c168b4dc2c5a,6363,0.5,0x4ef500abe8c3524e93b67821224131e0591ba25f,0x023cd4062b82db1eecc91fe077ec944d4b89384a diff --git a/seeds/zeroex/zeroex_api_fills_deduped_sample.csv b/seeds/zeroex/zeroex_api_fills_deduped_sample.csv index e2ad586ce5c..a0cb9c5711b 100644 --- a/seeds/zeroex/zeroex_api_fills_deduped_sample.csv +++ b/seeds/zeroex/zeroex_api_fills_deduped_sample.csv @@ -1,11 +1,11 @@ volume_usd,block_date,block_time,blockchain,evt_index,maker,taker,maker_symbol,token_pair,taker_token,taker_token_amount,taker_symbol,trace_address,tx_from,tx_hash,tx_to,taker_token_amount_raw,maker_token,maker_token_amount,version,maker_token_amount_raw 29.62565417333819,2023-04-04,2023-04-04 20:18:46.000 UTC,polygon,319,0x000000024d657368537761700000000000000000,0x21f96887b77f0ef00a33b148965269fcd14f3f62,WMATIC,USDT-WMATIC,0xc2132d05d31c914a87c6611c10748aeb04b58e8f,,USDT,[],0x21f96887b77f0ef00a33b148965269fcd14f3f62,0x6cee7ce88c9d9f441bda4d751832b2e6cf5fbad1cd5e23a56430762b0383fff4,0x1a1ec25dc08e98e5e93f1104b5e5cdd298707d31,29740815,0x0d500b1d8e8ef31e21c99d1db9a6444d3adf1270,26.054563579943917,,26054563579943916000 -1313.8937061251322,2023-04-04,2023-04-04 20:17:51.000 UTC,optimism,22,0x00000012556e6973776170563300000000000000,0x6cf233cb7a0a1878ef2d315f77e6c8b925f12cec,WETH,USDC.e-WETH,0x7f5c764cbc14f9669b88837ca1490cca17c31607,,USDC.e,[],0x6cf233cb7a0a1878ef2d315f77e6c8b925f12cec,0xd95e7f7008d83757d379ae63f102fe1b4e3a8cd90f561b608b909eab75e38ed6,0xdef1abe32c034e558cdd535791643c58a13acc10,1314662670,0x4200000000000000000000000000000000000006,0.7028875856613949,,702887585661394800 -1051.1007943624827,2023-04-04,2023-04-04 20:17:51.000 UTC,optimism,30,0x0000001d56656c6f64726f6d6500000000000000,0x6cf233cb7a0a1878ef2d315f77e6c8b925f12cec,WETH,USDC.e-WETH,0x7f5c764cbc14f9669b88837ca1490cca17c31607,,USDC.e,[],0x6cf233cb7a0a1878ef2d315f77e6c8b925f12cec,0xd95e7f7008d83757d379ae63f102fe1b4e3a8cd90f561b608b909eab75e38ed6,0xdef1abe32c034e558cdd535791643c58a13acc10,1051730135,0x4200000000000000000000000000000000000006,0.56230248778272,,562302487782719940 -7094.404668872238,2023-04-04,2023-04-04 20:17:51.000 UTC,optimism,6,0x00000012556e6973776170563300000000000000,0x6cf233cb7a0a1878ef2d315f77e6c8b925f12cec,WETH,USDC.e-WETH,0x7f5c764cbc14f9669b88837ca1490cca17c31607,,USDC.e,[],0x6cf233cb7a0a1878ef2d315f77e6c8b925f12cec,0xd95e7f7008d83757d379ae63f102fe1b4e3a8cd90f561b608b909eab75e38ed6,0xdef1abe32c034e558cdd535791643c58a13acc10,7099178417,0x4200000000000000000000000000000000000006,3.795260564962038,,3795260564962038000 -1051.061195219627,2023-04-04,2023-04-04 20:17:51.000 UTC,optimism,14,0x00000012556e6973776170563300000000000000,0x6cf233cb7a0a1878ef2d315f77e6c8b925f12cec,WETH,USDC.e-WETH,0x7f5c764cbc14f9669b88837ca1490cca17c31607,,USDC.e,[],0x6cf233cb7a0a1878ef2d315f77e6c8b925f12cec,0xd95e7f7008d83757d379ae63f102fe1b4e3a8cd90f561b608b909eab75e38ed6,0xdef1abe32c034e558cdd535791643c58a13acc10,1051730136,0x4200000000000000000000000000000000000006,0.5622813036140263,,562281303614026300 -7.411073983046853,2023-04-04,2023-04-04 20:17:51.000 UTC,arbitrum,14,0x000012556e697377617056330000000000000000,0x9afde46508b8d659bb0ffcdfd769ec37f7199cfa,WETH,USDC.e-WETH,0xff970a61a04b1ca14834a43f5de4533ebddb5cc8,,USDC.e,[],0x9afde46508b8d659bb0ffcdfd769ec37f7199cfa,0xf17ddcf43ef53af1b5377706298851c2dc55738b74e91480dc9fef68ae21eb19,0x9dda6ef3d919c9bc8885d5560999a3640431e8e6,7418076,0x82af49447d8a07e3bd95bd0d56f35241523fbab1,0.00396466767046502,,3964667670465020 +1313.8937061251322,2023-04-04,2023-04-04 20:17:51.000 UTC,optimism,22,0x00000012556e6973776170563300000000000000,0x6cf233cb7a0a1878ef2d315f77e6c8b925f12cec,WETH,USDC-WETH,0x7f5c764cbc14f9669b88837ca1490cca17c31607,,USDC,[],0x6cf233cb7a0a1878ef2d315f77e6c8b925f12cec,0xd95e7f7008d83757d379ae63f102fe1b4e3a8cd90f561b608b909eab75e38ed6,0xdef1abe32c034e558cdd535791643c58a13acc10,1314662670,0x4200000000000000000000000000000000000006,0.7028875856613949,,702887585661394800 +1051.1007943624827,2023-04-04,2023-04-04 20:17:51.000 UTC,optimism,30,0x0000001d56656c6f64726f6d6500000000000000,0x6cf233cb7a0a1878ef2d315f77e6c8b925f12cec,WETH,USDC-WETH,0x7f5c764cbc14f9669b88837ca1490cca17c31607,,USDC,[],0x6cf233cb7a0a1878ef2d315f77e6c8b925f12cec,0xd95e7f7008d83757d379ae63f102fe1b4e3a8cd90f561b608b909eab75e38ed6,0xdef1abe32c034e558cdd535791643c58a13acc10,1051730135,0x4200000000000000000000000000000000000006,0.56230248778272,,562302487782719940 +7094.404668872238,2023-04-04,2023-04-04 20:17:51.000 UTC,optimism,6,0x00000012556e6973776170563300000000000000,0x6cf233cb7a0a1878ef2d315f77e6c8b925f12cec,WETH,USDC-WETH,0x7f5c764cbc14f9669b88837ca1490cca17c31607,,USDC,[],0x6cf233cb7a0a1878ef2d315f77e6c8b925f12cec,0xd95e7f7008d83757d379ae63f102fe1b4e3a8cd90f561b608b909eab75e38ed6,0xdef1abe32c034e558cdd535791643c58a13acc10,7099178417,0x4200000000000000000000000000000000000006,3.795260564962038,,3795260564962038000 +1051.061195219627,2023-04-04,2023-04-04 20:17:51.000 UTC,optimism,14,0x00000012556e6973776170563300000000000000,0x6cf233cb7a0a1878ef2d315f77e6c8b925f12cec,WETH,USDC-WETH,0x7f5c764cbc14f9669b88837ca1490cca17c31607,,USDC,[],0x6cf233cb7a0a1878ef2d315f77e6c8b925f12cec,0xd95e7f7008d83757d379ae63f102fe1b4e3a8cd90f561b608b909eab75e38ed6,0xdef1abe32c034e558cdd535791643c58a13acc10,1051730136,0x4200000000000000000000000000000000000006,0.5622813036140263,,562281303614026300 +7.411073983046853,2023-04-04,2023-04-04 20:17:51.000 UTC,arbitrum,14,0x000012556e697377617056330000000000000000,0x9afde46508b8d659bb0ffcdfd769ec37f7199cfa,WETH,USDC-WETH,0xff970a61a04b1ca14834a43f5de4533ebddb5cc8,,USDC,[],0x9afde46508b8d659bb0ffcdfd769ec37f7199cfa,0xf17ddcf43ef53af1b5377706298851c2dc55738b74e91480dc9fef68ae21eb19,0x9dda6ef3d919c9bc8885d5560999a3640431e8e6,7418076,0x82af49447d8a07e3bd95bd0d56f35241523fbab1,0.00396466767046502,,3964667670465020 7.1442258283893505,2023-04-04,2023-04-04 20:17:26.000 UTC,polygon,148,0x0000000241706553776170000000000000000000,0x9c32b24373f571ec5b6791ed93abf3b721fd4648,WMATIC,WETH-WMATIC,0x7ceb23fd6bc0add59e62ac25578270cff1b9f619,,WETH,[],0x9c32b24373f571ec5b6791ed93abf3b721fd4648,0x3f9aea7d0632669b92e938787115cc02cc0dfa929ada9d383bd07b9499aaaab8,0xdef1c0ded9bec7f1a1670819833240f027b25eff,3836860083468541,0x0d500b1d8e8ef31e21c99d1db9a6444d3adf1270,6.283057413218761,,6283057413218761000 1.9167938344396847,2023-04-04,2023-04-04 20:17:08.000 UTC,polygon,101,0x876cea61f692f1624b6c8b1a8ac3d7a978a9f4fb,0x03421553988977107a7cdd4432036f8cf46bd986,WMATIC,USDC-WMATIC,0x2791bca1f2de4661ed88a30c99a7a9449aa84174,,USDC,[],0x03421553988977107a7cdd4432036f8cf46bd986,0x5516cddee0696f2879c86a267b62c9190a6f4c65ba0e41d261b8a41839ed08bd,0xdef1c0ded9bec7f1a1670819833240f027b25eff,1939993,0x0d500b1d8e8ef31e21c99d1db9a6444d3adf1270,1.685742584344288,,1685742584344288100 -4.9504863536259585,2023-04-04,2023-04-04 20:17:06.000 UTC,optimism,7,0x0000001942656574686f76656e78000000000000,0xc68ac244a944896efed6077c7bd3e0b9e1a2a013,WETH,USDC.e-WETH,0x7f5c764cbc14f9669b88837ca1490cca17c31607,,USDC.e,[],0xc68ac244a944896efed6077c7bd3e0b9e1a2a013,0x36afdb610015ea42c3ac96ea39ff822e60e103cc8cc571d356dab8db13c50585,0xdef1abe32c034e558cdd535791643c58a13acc10,4950000,0x4200000000000000000000000000000000000006,0.00264833858684946,,2648338586849460 +4.9504863536259585,2023-04-04,2023-04-04 20:17:06.000 UTC,optimism,7,0x0000001942656574686f76656e78000000000000,0xc68ac244a944896efed6077c7bd3e0b9e1a2a013,WETH,USDC-WETH,0x7f5c764cbc14f9669b88837ca1490cca17c31607,,USDC,[],0xc68ac244a944896efed6077c7bd3e0b9e1a2a013,0x36afdb610015ea42c3ac96ea39ff822e60e103cc8cc571d356dab8db13c50585,0xdef1abe32c034e558cdd535791643c58a13acc10,4950000,0x4200000000000000000000000000000000000006,0.00264833858684946,,2648338586849460 49.546377456572095,2023-04-04,2023-04-04 20:16:52.000 UTC,arbitrum,10,0x000012556e697377617056330000000000000000,0xcc6a141d85872fde54e527b3438aa1ddb478ed1f,WETH,ARB-WETH,0x912ce59144191c1204e64559fe8253a0e49e6548,,ARB,[],0xcc6a141d85872fde54e527b3438aa1ddb478ed1f,0x5d3d3c993bdabbfa6307b157842c61a114614a4dae9827af95b413bc07a21cc6,0x00000000009726632680fb29d3f7a9734e3010e2,40000000000000000000,0x82af49447d8a07e3bd95bd0d56f35241523fbab1,0.026505594376750458,,26505594376750455 diff --git a/seeds/zeroex/zeroex_api_fills_sample.csv b/seeds/zeroex/zeroex_api_fills_sample.csv index 49177e383b5..50fe18c25dc 100644 --- a/seeds/zeroex/zeroex_api_fills_sample.csv +++ b/seeds/zeroex/zeroex_api_fills_sample.csv @@ -7,5 +7,5 @@ volume_usd,block_date,block_time,blockchain,evt_index,maker,taker,maker_symbol,t 504.32666693752896,2023-04-04,2023-04-04 20:18:35.000 UTC,ethereum,70,0x1b425529c9d7472603e2dcf125fd195f71dfb412,0x980a76779950f2c7cc06478f3933754839eb0577,WETH,RINIA-WETH,0x307838663832386130363434663132666133353238383865363435613930333333643330663666643764,,RINIA,[],0x980a76779950f2c7cc06478f3933754839eb0577,0x9e77263bc7c05219af3393e3fed53e4affbdcadb168fb0272f1f66a404c2a7f5,0xdef1c0ded9bec7f1a1670819833240f027b25eff,0x307863303261616133396232323366653864306130653563346632376561643930383363373536636332,0.2697972839475782,,2.697972839475782E17 1187.960462635206,2023-04-04,2023-04-04 20:18:23.000 UTC,ethereum,67,0xe3baa96ad46457d9e6cdd4e32abc11e2c124ec49,0xe66b31678d6c16e9ebf358268a790b763c133750,MATIC,MATIC-WETH,0x307863303261616133396232323366653864306130653563346632376561643930383363373536636332,0.6355176659650807,WETH,[],0xc2c5075f7ab3c7ec9137818321d141591fd64bbe,0xdc8f6fc4096ed10ef8de4dd8fd8d417f3d0e813803106a2f404191a59f2a3af6,0xe66b31678d6c16e9ebf358268a790b763c133750,0x307837643161666137623731386662383933646233306133616263306366633630386161636665626230,,,1.0412282002731007E21 49.49835260980026,2023-04-04,2023-04-04 20:17:59.000 UTC,ethereum,48,0x945bcf562085de2d5875b9e2012ed5fd5cfab927,0xe66b31678d6c16e9ebf358268a790b763c133750,MATIC,MATIC-WETH,0x307863303261616133396232323366653864306130653563346632376561643930383363373536636332,0.02647990274854503,WETH,[],0x59d68b8c82079568c9907903f554d2e7e25ebf55,0xd73d99416671b47e2f821bdf332a4283a31d002c8ff02918c5c2fcfbe2625d58,0xe66b31678d6c16e9ebf358268a790b763c133750,0x307837643161666137623731386662383933646233306133616263306366633630386161636665626230,,,43273671441228360000 -1051.1007943624827,2023-04-04,2023-04-04 20:17:51.000 UTC,optimism,30,0x0000001d56656c6f64726f6d6500000000000000,0x6cf233cb7a0a1878ef2d315f77e6c8b925f12cec,WETH,USDC.e-WETH,0x7f5c764cbc14f9669b88837ca1490cca17c31607,,USDC.e,[],0x6cf233cb7a0a1878ef2d315f77e6c8b925f12cec,0xd95e7f7008d83757d379ae63f102fe1b4e3a8cd90f561b608b909eab75e38ed6,0xdef1abe32c034e558cdd535791643c58a13acc10,0x4200000000000000000000000000000000000006,0.56230248778272,,5.6230248778271994E17 -1051.061195219627,2023-04-04,2023-04-04 20:17:51.000 UTC,optimism,14,0x00000012556e6973776170563300000000000000,0x6cf233cb7a0a1878ef2d315f77e6c8b925f12cec,WETH,USDC.e-WETH,0x7f5c764cbc14f9669b88837ca1490cca17c31607,,USDC.e,[],0x6cf233cb7a0a1878ef2d315f77e6c8b925f12cec,0xd95e7f7008d83757d379ae63f102fe1b4e3a8cd90f561b608b909eab75e38ed6,0xdef1abe32c034e558cdd535791643c58a13acc10,0x4200000000000000000000000000000000000006,0.5622813036140263,,5.622813036140263E17 +1051.1007943624827,2023-04-04,2023-04-04 20:17:51.000 UTC,optimism,30,0x0000001d56656c6f64726f6d6500000000000000,0x6cf233cb7a0a1878ef2d315f77e6c8b925f12cec,WETH,USDC-WETH,0x7f5c764cbc14f9669b88837ca1490cca17c31607,,USDC,[],0x6cf233cb7a0a1878ef2d315f77e6c8b925f12cec,0xd95e7f7008d83757d379ae63f102fe1b4e3a8cd90f561b608b909eab75e38ed6,0xdef1abe32c034e558cdd535791643c58a13acc10,0x4200000000000000000000000000000000000006,0.56230248778272,,5.6230248778271994E17 +1051.061195219627,2023-04-04,2023-04-04 20:17:51.000 UTC,optimism,14,0x00000012556e6973776170563300000000000000,0x6cf233cb7a0a1878ef2d315f77e6c8b925f12cec,WETH,USDC-WETH,0x7f5c764cbc14f9669b88837ca1490cca17c31607,,USDC,[],0x6cf233cb7a0a1878ef2d315f77e6c8b925f12cec,0xd95e7f7008d83757d379ae63f102fe1b4e3a8cd90f561b608b909eab75e38ed6,0xdef1abe32c034e558cdd535791643c58a13acc10,0x4200000000000000000000000000000000000006,0.5622813036140263,,5.622813036140263E17 diff --git a/seeds/zonic/schema.yml b/seeds/zonic/schema.yml deleted file mode 100644 index 2d7b9eb5e7c..00000000000 --- a/seeds/zonic/schema.yml +++ /dev/null @@ -1,11 +0,0 @@ -version: 2 - -seeds: - - name: zonic_events_seed - config: - column_types: - tx_hash: varbinary - buyer: varbinary - seller: varbinary - nft_contract_address: varbinary - token_id: uint256 diff --git a/seeds/zonic/zonic_events_seed.csv b/seeds/zonic/zonic_events_seed.csv deleted file mode 100644 index e93ed31dc92..00000000000 --- a/seeds/zonic/zonic_events_seed.csv +++ /dev/null @@ -1,18 +0,0 @@ -block_number,tx_hash,evt_index,nft_contract_address,token_id,buyer,seller,amount_original,platform_fee_amount,royalty_fee_amount -73841382,0xca484e3f73baa6f5d034f990b88f1bd74094d604c9a1bd8b02932a7119d5eac0,0,0xfa14e1157f35e1dad95dc3f822a9d18c40e360e2,1663029,0x8a2d2a4c1b05455b8f340a6bb98b0c08513a8555,0xcec6c84af91405379818d159ee6121c9d927ba85,0.0005,1.25e-05,0 -74202562,0x12b559e9d34f8b6c6a2078f2b8f090e03b1aef18cd29d5746b1feaf6fdb26cba,0,0xc7a144c247dd503acf87b2dc65aff3de3c10e3d1,1363,0xb6c3e1cddbcdc2e1758a7cc677749d3c6c811f8a,0x6fb57d194bd89cf54ada268f87ba7b0c73548dc5,0.006,0.00015,0 -74069202,0x728307b55f2157f5e11dc5fe12bf7e2c9a234cefa2669864d4b0c1603d8744c6,0,0x656b02f01500e0d7c072330e324f3e026df91f55,5400,0xc8feee4b352c46b15ed12492df669911d8496e51,0x83c3096351afea52d43a5de1c718cc6c967487fb,0.00589,0.00014725,0.0002945 -74078258,0xcdd99aa98335a514411f183ef23e0beedf0692a7685066bbc643060aff328599,0,0x9b9f542456ad12796ccb8eb6644f29e3314e68e1,1475,0x124474fdbecddef33732e84c4834faee38ef0c44,0x76f980cfe17d4ff3e3f9ddce2129c17e55a1091d,0.035,0.000875,0.00175 -74048380,0x6b136a9a6c1869df3cfa212404c5ae55ee3efeeb45b0003803047d706c6da939,0,0x812053625db6b8fbd282f8e269413a6dd59724c9,572,0xa277ba906e5bcb2176dc183e982637c38c7ecf27,0x477e665ea49d49ebe1cb27b668e977225563d9f7,0.0018,4.5e-05,0.00018 -74104224,0xe956335095bdf20ccd15fe736992ec22d385cfbd3d96caeb61de3fda0209ad44,0,0x0d21136236c0731378286be2ea3611a19280dd56,1273,0x4a550e6eaf8ba34305cbc0d7cfcb1d0e4865f274,0x5fac5a1a1d8343705a605561d925bab7642a1957,1.01,0.02525,0 -74004501,0x6fb1f8abc50cfb37d62ddb11551e01d0ea55aa8226b154e47187d19977cc5194,0,0x812053625db6b8fbd282f8e269413a6dd59724c9,7762,0xade9f040f13c454453e9cf65c99e8195e840e1f5,0x9b5ee10beea46180be7560cbe7aef8f88a3221fb,0.0012,3e-05,0.00012 -73499763,0xca20ef8970fec9f812eee8f3a04f3d4f61739c132769e56d7a9936f5843705aa,0,0xfa14e1157f35e1dad95dc3f822a9d18c40e360e2,2709460,0x5f690790e3bea9b2deaffbc569a8e35004508029,0x618954bb75e6254b38909d3d4ba0ce1a8d320c07,0.001,2.5e-05,0 -74744387,0x896fc8e400878758dc8e05c55e048b2816f02f52a06a795c715fea7a5260cc96,0,0xb91b2276bd5a98994bf1f496e3886f688f8d4581,2035,0x2ba1d521595c5b31b177fd5263f8b002f570e92a,0xdc065fb9bd6d5d6651e257e5799bd38eaf005fc6,0.002,5e-05,0 -74623436,0x888545a097b22604e3c9834ecaaa3ef8868855c1461c603c90c8825966f3a692,0,0x67709f880f66e15f6ae93b1d737f8d8d9fb9827f,770,0x9d3714cceff1e57d9653158c877def1e74bd6f20,0xc1d7ffb0aa7325c8413fbc7351630ef3580fffb1,0.36,0.009,0.018 -74678149,0x09d4e6192f12a0f976bb752e3394b8459bea659087b60bd1a2ee35573b68ce7a,0,0x656b02f01500e0d7c072330e324f3e026df91f55,4183,0xc596cb23208bb80450f3a25cd7efddd111437158,0xcfa1bf8ca39a89b6c0e9aff55454b20e589c0da0,0.0065,0.0001625,0.000325 -74627003,0x177ecf46aa55791070bd5bb53fca4d6ad5a7f5747d176a4d01389bf6674cc3a7,0,0xc66a1ee3be858e7041dda9bd1ea2fbd3ce07f63e,19146,0x77422fd76a39d216619f5ae2596bb5b12e8e3b0e,0x06e252cdb6bf0e724346be59ceadf6684c79793c,0.0006,1.5e-05,0 -74402579,0x8f8c3b9fcfcaa0bd9b8363ef36b759cabb9c346baa14a407258a2e37c24d2f79,0,0xc480325c86392b773cbad885759c205f26d91bbb,2435,0x1062cbf8ff53f78c76e3df908469d8c4c7d69196,0xfc5fb8d52017ddb7a803ec20d299fcc94ca9eaa0,0.35,0.00875,0 -74504570,0xd8f1626f6199e646878f74c7e5b94bcd1fdb03a7dc3156a8c880770a1edfee4c,0,0xfa14e1157f35e1dad95dc3f822a9d18c40e360e2,449323,0x3c7f96edf54d6567d91be151e40423a7ba86e8ad,0x55daee2be43171c46fa6edd682d6beec02b6e03d,0.00079,1.975e-05,0 -74914578,0x770ea847974390cc9facdfb7266144249ee5bc4fd836b7c5107013a93aecbbf2,0,0x662146c0e1126488662c0afbb53a0cdbfa1bde4a,6968,0xf37a1e05106bd964e5095b328d6ac5629a1f6b54,0xc3ee19826f13b3509c8fedcc5576552c36dd74bc,0.005,0.000125,0 -74910954,0x5f4e00d41fe1cdf37eae03927d235f45c391b30c357aa5d2ccaf6d0ecd8de36f,0,0x20bdae1413659f47416f769a4b27044946bc9923,3095,0x42eabe5e25cc092eae837961be75bd5dfe182969,0xcb44b8eaf868d0600e2dbdc5f0c5ea733a40476e,0.005,0.000125,0 -74898193,0x357875c21328188c5e7900518cd561bbda6e414fddb237f8911216836c0abd63,0,0xab586a06b98df0a86dcd4e1a0294a404c6284725,3314,0x3d81fa04b30c7ac4571274e17891fbb9be8a5bf3,0x1111615a735ac3b3bf3a9ac75b673509500ac8e8,0.11,0.00275,0 diff --git a/sources/_subprojects/nft/_sources.yml b/sources/_subprojects/nft/_sources.yml new file mode 100644 index 00000000000..af3fea4ecc6 --- /dev/null +++ b/sources/_subprojects/nft/_sources.yml @@ -0,0 +1,17 @@ +version: 2 + +sources: + - name: nft + description: "output models of the NFT sector (dbt subproject)" + tables: + - name: trades + - name: aggregators + - name: base_trades + + - name: nft_optimism + tables: + - name: wash_trades + + - name: nft_ethereum + tables: + - name: wallet_metrics diff --git a/sources/_subprojects/spellbook/_sources.yml b/sources/_subprojects/spellbook/_sources.yml index 16c7d4e99ec..62aee447931 100644 --- a/sources/_subprojects/spellbook/_sources.yml +++ b/sources/_subprojects/spellbook/_sources.yml @@ -53,9 +53,6 @@ sources: - name: cex_optimism tables: - name: addresses - - name: prices - tables: - - name: usd_forward_fill - name: op_retropgf_optimism tables: - name: recipients @@ -64,3 +61,10 @@ sources: tables: - name: fee_vaults - name: grants_funding + + - name: prices + tables: + - name: usd_forward_fill + - name: prices + tables: + - name: usd_latest diff --git a/sources/sudoswap/ethereum/sudoswap_ethereum_sources.yml b/sources/sudoswap/ethereum/sudoswap_ethereum_sources.yml index 58465934495..71c83c9db97 100644 --- a/sources/sudoswap/ethereum/sudoswap_ethereum_sources.yml +++ b/sources/sudoswap/ethereum/sudoswap_ethereum_sources.yml @@ -44,3 +44,4 @@ sources: tables: - name: Astrodrop_evt_Claimed loaded_at_field: evt_block_time + - name: base_trades diff --git a/tests/generic/check_seed.sql b/tests/generic/check_seed.sql deleted file mode 100644 index b1af4ffb53e..00000000000 --- a/tests/generic/check_seed.sql +++ /dev/null @@ -1,20 +0,0 @@ --- this tests checks a model for every row in a seed file. --- you need to specify the matching columns and the columns to check for equality. --- filter: dictionary filter of column:value that is applied to the seed file --- actual implementation in macros/test-helpers/check_seed.sql -{% test check_seed(model, seed_file, match_columns=[], check_columns=[], filter=None) %} - {# - --jinja comment - -- potential dynamic approach, but requires db access -- ci setup to allow in future? - -- {%- set unique_columns = config.get('unique_key') -%} - -- {%- set seed_check_columns = dbt_utils.get_filtered_columns_in_relation(from=seed_file, except=unique_columns) -%} - -- {%- set seed_matching_columns = dbt_utils.get_filtered_columns_in_relation(from=seed_file, except=seed_check_columns) -%} - --jinja comment - #} - {{ config(severity = 'error') }} - {%- set seed_check_columns = check_columns -%} - {%- set seed_matching_columns = match_columns -%} - {%- set seed = seed_file -%} - {{ check_seed_macro(model,seed,seed_matching_columns,seed_check_columns,filter) }} - -{% endtest %} diff --git a/tests/generic/compare_column_values_to_seed_values.sql b/tests/generic/compare_column_values_to_seed_values.sql deleted file mode 100644 index 1073925bf62..00000000000 --- a/tests/generic/compare_column_values_to_seed_values.sql +++ /dev/null @@ -1,22 +0,0 @@ -{% test compare_column_values_to_seed_values(model, column_name, seed_file_location) %} - - with unit_test as - ( - select - seed.test_description, - case - when m.{{ column_name }} = seed.{{ column_name }} - then True - else False - end as generic_column_test - from {{ model }} m - join {{ seed_file_location }} seed - on m.tx_hash = seed.tx_hash - and m.block_number = seed.block_number - ) - - select test_description - from unit_test - where generic_column_test = False - -{% endtest %} diff --git a/tests/generic/equal_rowcount_with_sources.sql b/tests/generic/equal_rowcount_with_sources.sql deleted file mode 100644 index 71be9489536..00000000000 --- a/tests/generic/equal_rowcount_with_sources.sql +++ /dev/null @@ -1,27 +0,0 @@ -{% test equal_rowcount_with_sources(model, evt_sources=[]) %} - - WITH - model_count as ( - select count(*) as count_a from {{ model }} - ) - ,sources_count as ( - select sum(count_b) as count_b - from ( - {% for source in evt_sources %} - select count(*) as count_b - from {{ source }} - where evt_block_time <= (select max(block_time) from {{ model }}) - {% if not loop.last %} UNION ALL {% endif %} - {% endfor %} - ) b - ) - - ,unit_test as ( - select count_a, count_b, abs(count_a - count_b) as diff_count - from model_count - full outer join sources_count - on 1=1 - ) - - select * from unit_test where diff_count > 0 -{% endtest %} diff --git a/tests/generic/is_unique_filtered.sql b/tests/generic/is_unique_filtered.sql deleted file mode 100644 index da19556226c..00000000000 --- a/tests/generic/is_unique_filtered.sql +++ /dev/null @@ -1,13 +0,0 @@ -{% test is_unique_filtered(model, column_name) %} - -select - {{ column_name }} as unique_field, - count(*) as n_records - -from {{ model }} -where {{ column_name }} is not null - and block_date >= NOW() - interval '2' day -group by {{ column_name }} -having count(*) > 1 - -{% endtest %} From 119888d0d1f5153c23f9d55d07d75e248934435c Mon Sep 17 00:00:00 2001 From: Alan Ghobadi Date: Fri, 14 Jun 2024 13:04:01 +0200 Subject: [PATCH 121/149] NFT: Fix model source typo (#6175) * Fix model source typo * Exclude daily spellbook from running --- .github/workflows/spellbook.yml | 1 + nft/macros/nft_wash_trades.sql | 4 ++-- nft/models/_extra_sources.yml | 2 +- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/.github/workflows/spellbook.yml b/.github/workflows/spellbook.yml index 81b81216170..919a25b1642 100644 --- a/.github/workflows/spellbook.yml +++ b/.github/workflows/spellbook.yml @@ -9,6 +9,7 @@ on: - '.gitignore' - 'tokens/**' - 'daily_spellbook/**' + - 'nft/**' concurrency: group: ${{ github.workflow }}-${{ github.ref }} diff --git a/nft/macros/nft_wash_trades.sql b/nft/macros/nft_wash_trades.sql index 178fa105929..0a3ee9099fb 100644 --- a/nft/macros/nft_wash_trades.sql +++ b/nft/macros/nft_wash_trades.sql @@ -87,7 +87,7 @@ WITH filter_1 AS ( FROM {{ ref('nft_trades') }} nftt INNER JOIN {{ first_funded_by }} filter_funding_buyer ON filter_funding_buyer.address=nftt.buyer - AND filter_funding_buyer.first_funded_by NOT IN (SELECT DISTINCT address FROM {{ source('labels','bridges') }}) + AND filter_funding_buyer.first_funded_by NOT IN (SELECT DISTINCT address FROM {{ source('labels','bridge') }}) AND filter_funding_buyer.first_funded_by NOT IN (SELECT DISTINCT address FROM {{ source('labels','cex') }}) AND filter_funding_buyer.first_funded_by NOT IN (SELECT DISTINCT contract_address FROM {{ source('tornado_cash','withdrawals') }}) {% if is_incremental() %} @@ -95,7 +95,7 @@ WITH filter_1 AS ( {% endif %} INNER JOIN {{ first_funded_by }} filter_funding_seller ON filter_funding_seller.address=nftt.seller - AND filter_funding_seller.first_funded_by NOT IN (SELECT DISTINCT address FROM {{ source('labels','bridges') }}) + AND filter_funding_seller.first_funded_by NOT IN (SELECT DISTINCT address FROM {{ source('labels','bridge') }}) AND filter_funding_seller.first_funded_by NOT IN (SELECT DISTINCT address FROM {{ source('labels','cex') }}) AND filter_funding_seller.first_funded_by NOT IN (SELECT DISTINCT contract_address FROM {{ source('tornado_cash','withdrawals') }}) AND nftt.blockchain='{{blockchain}}' diff --git a/nft/models/_extra_sources.yml b/nft/models/_extra_sources.yml index 4e31d9241c9..c3571faaf45 100644 --- a/nft/models/_extra_sources.yml +++ b/nft/models/_extra_sources.yml @@ -9,7 +9,7 @@ sources: - name: labels tables: - name: cex - - name: bridges + - name: bridge - name: dex tables: From 6b28783da50e6ce9b54e3b3d91da303127776207 Mon Sep 17 00:00:00 2001 From: jeff-dude <102681548+jeff-dude@users.noreply.github.com> Date: Fri, 14 Jun 2024 10:31:26 -0400 Subject: [PATCH 122/149] failing on dupes (#6176) --- .../bot_trades/solana/platforms/bonkbot_solana_bot_trades.sql | 1 + 1 file changed, 1 insertion(+) diff --git a/models/_sector/dex/bot_trades/solana/platforms/bonkbot_solana_bot_trades.sql b/models/_sector/dex/bot_trades/solana/platforms/bonkbot_solana_bot_trades.sql index 8f947337b1e..1bae8f26e19 100644 --- a/models/_sector/dex/bot_trades/solana/platforms/bonkbot_solana_bot_trades.sql +++ b/models/_sector/dex/bot_trades/solana/platforms/bonkbot_solana_bot_trades.sql @@ -1,4 +1,5 @@ {{ config( + tags = ['prod_exclude'], alias = 'bot_trades', schema = 'bonkbot_solana', partition_by = ['block_month'], From ac97a0a30cf5479ba9f3c5093770a32c39a3aeb8 Mon Sep 17 00:00:00 2001 From: max-morrow Date: Fri, 14 Jun 2024 17:34:23 +0300 Subject: [PATCH 123/149] 1inch-U25: upgrade project_swaps & project_orders flow (#6155) * huge upgrade project_swaps & project_orders flow - fixed calls to proxy contracts - fixed incorrect parsing contract abi * fixes * retrigger ci * fix bracket * redesigned lineage to optimize future refills - created project_calls flow - some fixes * fix & added blockchains project_orders spellbooks - fix unique keys in project_swaps & project_orders flows * retrigger * retrigger * fix * retrigger * fix * ambigous fix * fix * retrigger ci * retrigger ci * fix * fix * fix * fix * fix * true dates returned --------- Co-authored-by: grkhr --- .../_meta/oneinch_mapped_contracts_macro.sql | 22 +- .../oneinch/oneinch_project_calls_macro.sql | 122 +++++++++ .../oneinch/oneinch_project_orders_macro.sql | 77 ++++-- .../oneinch/oneinch_project_swaps_macro.sql | 258 ++++++++++++------ .../oneinch_arbitrum_project_calls.sql | 24 ++ .../oneinch_arbitrum_project_swaps.sql | 2 +- .../oneinch_avalanche_c_project_calls.sql | 24 ++ .../oneinch_avalanche_c_project_swaps.sql | 2 +- .../base/oneinch_base_project_calls.sql | 24 ++ .../base/oneinch_base_project_swaps.sql | 2 +- .../oneinch/bnb/oneinch_bnb_project_calls.sql | 24 ++ .../oneinch/bnb/oneinch_bnb_project_swaps.sql | 2 +- .../oneinch_ethereum_project_calls.sql | 24 ++ .../oneinch_ethereum_project_swaps.sql | 2 +- .../fantom/oneinch_fantom_project_calls.sql | 24 ++ .../fantom/oneinch_fantom_project_swaps.sql | 2 +- .../gnosis/oneinch_gnosis_project_calls.sql | 24 ++ .../gnosis/oneinch_gnosis_project_swaps.sql | 2 +- models/oneinch/oneinch_project_orders.sql | 102 +++---- models/oneinch/oneinch_project_swaps.sql | 2 +- .../oneinch_optimism_project_calls.sql | 24 ++ .../oneinch_optimism_project_swaps.sql | 2 +- .../polygon/oneinch_polygon_project_calls.sql | 24 ++ .../polygon/oneinch_polygon_project_swaps.sql | 2 +- .../zksync/oneinch_zksync_project_calls.sql | 24 ++ .../zksync/oneinch_zksync_project_swaps.sql | 2 +- 26 files changed, 659 insertions(+), 184 deletions(-) create mode 100644 macros/models/_project/oneinch/oneinch_project_calls_macro.sql create mode 100644 models/oneinch/arbitrum/oneinch_arbitrum_project_calls.sql create mode 100644 models/oneinch/avalanche_c/oneinch_avalanche_c_project_calls.sql create mode 100644 models/oneinch/base/oneinch_base_project_calls.sql create mode 100644 models/oneinch/bnb/oneinch_bnb_project_calls.sql create mode 100644 models/oneinch/ethereum/oneinch_ethereum_project_calls.sql create mode 100644 models/oneinch/fantom/oneinch_fantom_project_calls.sql create mode 100644 models/oneinch/gnosis/oneinch_gnosis_project_calls.sql create mode 100644 models/oneinch/optimism/oneinch_optimism_project_calls.sql create mode 100644 models/oneinch/polygon/oneinch_polygon_project_calls.sql create mode 100644 models/oneinch/zksync/oneinch_zksync_project_calls.sql diff --git a/macros/models/_project/oneinch/_meta/oneinch_mapped_contracts_macro.sql b/macros/models/_project/oneinch/_meta/oneinch_mapped_contracts_macro.sql index 7af3f895b43..32375d18623 100644 --- a/macros/models/_project/oneinch/_meta/oneinch_mapped_contracts_macro.sql +++ b/macros/models/_project/oneinch/_meta/oneinch_mapped_contracts_macro.sql @@ -45,6 +45,7 @@ , ('0xa218543cc21ee9388fa1e509f950fd127ca82155', 'true', '1inch' , 'SettlementV1' , ['fantom']) , ('0x7f069df72b7a39bce9806e3afaf579e54d8cf2b9', 'true', '1inch' , 'SettlementV1' , ['base']) , ('0x11de482747d1b39e599f120d526af512dd1a9326', 'true', '1inch' , 'SettlementV1' , ['zksync']) + , ('0xfb2809a5314473e1165f6b58018e20ed8f07b840', 'true', '1inch' , 'SettlementV2' , ['ethereum','bnb','polygon','arbitrum','avalanche_c','gnosis','optimism','fantom','base']) , ('0x0cae51e1032e8461f4806e26332c030e34de3adb', 'true', 'AnySwap' , 'AnyswapV3Router' , ['arbitrum']) , ('0x7782046601e7b9b05ca55a3899780ce6ee6b8b2b', 'true', 'AnySwap' , 'AnyswapV6Router' , ['ethereum']) , ('0xb0731d50c681c45856bfc3f7539d5f61d4be81d8', 'true', 'AnySwap' , 'UNDEFINED' , ['avalanche_c']) @@ -72,6 +73,7 @@ , ('0x99a58482bd75cbab83b27ec03ca68ff489b5788f', 'true', 'Curvefi' , 'SwapRouter' , ['ethereum']) , ('0xbebc44782c7db0a1a60cb6fe97d0b483032ff1c7', 'true', 'Curvefi' , 'ThreepoolSwap' , ['ethereum']) , ('0xdc24316b9ae028f1497c275eb9192a3ea0f67022', 'true', 'Curvefi' , 'StETHSwap' , ['ethereum']) + , ('0xF0d4c12A5768D806021F80a262B4d39d26C58b8D', 'true', 'Curvefi' , 'CurveRouterV1' , ['ethereum']) , ('0x1d8b86e3d88cdb2d34688e87e72f388cb541b7c8', 'true', 'Curvefi' , 'VyperContract' , ['polygon']) , ('0x43b4fdfd4ff969587185cdb6f0bd875c5fc83f8c', 'true', 'Curvefi' , 'Vyper' , ['ethereum']) , ('0x0656fd85364d03b103ceeda192fb2d3906a6ac15', 'true', 'DODO' , 'DODOFeeRouteProxy' , ['bnb']) @@ -111,8 +113,7 @@ , ('0x1fc3607fa67b58deddb0faf7a116f417a20c551c', 'true', 'Kyber' , 'AggregationRouter' , ['fantom']) , ('0x546c79662e028b661dfb4767664d0273184e4dd1', 'true', 'Kyber' , 'AggregationRouter' , ['polygon']) , ('0x617dee16b86534a5d792a4d7a62fb491b544111e', 'true', 'Kyber' , 'MetaAggregationRouterV1' , ['ethereum','polygon','fantom']) - , ('0x6131b5fae19ea4f9d964eac0408e4408b66337b5', 'true', 'Kyber' , 'MetaAggregationRouterV2' , ['ethereum','bnb','polygon','arbitrum','avalanche_c','fantom']) - , ('0x6131b5fae19ea4f9d964eac0408e4408b66337b5', 'true', 'Kyber' , 'MetaAggregationRouterV2' , ['optimism']) + , ('0x6131b5fae19ea4f9d964eac0408e4408b66337b5', 'true', 'Kyber' , 'MetaAggregationRouterV2' , ['ethereum','bnb','polygon','arbitrum','avalanche_c','optimism','fantom']) , ('0xdf1a1b60f2d438842916c0adc43748768353ec25', 'true', 'Kyber' , 'AggregationRouterV2' , ['polygon','fantom']) , ('0xb18d4f69627f8320619a696202ad2c430cef7c53', 'true', 'LevinSwap' , 'UniswapV2Router02' , ['gnosis']) , ('0x1231deb6f5749ef6ce6943a275a1d3e7486f4eae', 'true', 'LiFi' , 'DiamondV2' , ['ethereum','bnb','polygon','arbitrum','avalanche_c','gnosis','optimism','fantom']) @@ -358,21 +359,6 @@ contracts as ( , 'TransitSwap' , 'ZeroEx' ], project) as multi - , contains(array[ - '1inch' - , 'ZeroEx' - , 'Clipper' - , 'Hashflow' - , 'Native' - , 'Swaap' - , 'Paraswap' - ], project) as lop - , contains(array[ - '1inch' - , 'CoWSwap' - , 'Uniswap' - , 'Bebop' - ], project) as auction , tag from (values {% for row in config if blockchain in row[4] %} @@ -400,7 +386,7 @@ select , address , project , tag - , map_from_entries(array[('user', user), ('multi', multi), ('lop', lop), ('auction', auction)]) as flags + , map_from_entries(array[('user', user), ('multi', multi), ('recreated', first_created_at <> last_created_at)]) as flags , first_created_at , last_created_at , last_creator diff --git a/macros/models/_project/oneinch/oneinch_project_calls_macro.sql b/macros/models/_project/oneinch/oneinch_project_calls_macro.sql new file mode 100644 index 00000000000..92b18a8090f --- /dev/null +++ b/macros/models/_project/oneinch/oneinch_project_calls_macro.sql @@ -0,0 +1,122 @@ +{% macro + oneinch_project_calls_macro( + blockchain + , date_from = '2024-01-01' + ) +%} + +{% set native_addresses = '(0x0000000000000000000000000000000000000000, 0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee)' %} + + + +with + +static as ( + select + array['swap', 'settle', 'change', 'exact', 'batch', 'trade', 'sell', 'buy', 'fill', 'route', 'zap', 'symbiosis', 'aggregate', 'multicall', 'execute', 'wrap', 'transform'] as suitables + , array['add', 'remove', 'mint', 'increase', 'decrease', 'cancel', 'destroy', 'claim', 'rescue', 'withdraw', 'simulate', 'join', 'exit', 'interaction', '721', '1155', 'nft', 'create'] as exceptions +) + +, meta as ( + select + wrapped_native_token_address + , native_token_symbol as native_symbol + from ({{ oneinch_blockchain_macro(blockchain) }}) +) + +, contracts as ( + select + blockchain + , address as call_to + , any_value(project) as project + , any_value(tag) as tag + , any_value(flags) as flags + from {{ ref('oneinch_' + blockchain + '_mapped_contracts') }} + where + project not in ('MEVBot', 'Unknown') + group by 1, 2 +) + +, signatures as ( + select + id as selector + , min(signature) as signature + , min(split_part(signature, '(', 1)) as method + from {{ source('abi', 'signatures') }} + where length(id) = 4 + group by 1 +) + +, calls as ( + select * + from ( + select + block_number + , block_time + , tx_hash + , "from" as call_from + , "to" as call_to + , trace_address as call_trace_address + , cardinality(trace_address) = 0 as direct + , substr(input, 1, 4) as selector + , success as call_success + , tx_success + from {{ source(blockchain, 'traces') }} + where + {% if is_incremental() %} + {{ incremental_predicate('block_time') }} + {% else %} + block_time >= timestamp '{{date_from}}' + {% endif %} + ) + join contracts using(call_to) + join signatures using(selector) + join static on true + join meta on true + join ( + select + block_number + , block_time + , hash as tx_hash + , "from" as tx_from + , "to" as tx_to + , gas_used as tx_gas_used + from {{ source(blockchain, 'transactions') }} + where + {% if is_incremental() %} + {{ incremental_predicate('block_time') }} + {% else %} + block_time >= timestamp '{{date_from}}' + {% endif %} + + ) using(block_number, block_time, tx_hash) + where + not reduce(exceptions, false, (r, x) -> if(position(x in lower(replace(method, '_'))) > 0, true, r), r -> r) -- without "exception" methods + and reduce(suitables, false, (r, x) -> if(position(x in lower(replace(method, '_'))) > 0, true, r), r -> r) -- "suitable" methods only +) + +-- output -- + +select + blockchain + , block_number + , block_time + , tx_hash + , tx_from + , tx_to + , tx_success + , tx_gas_used + , call_trace_address + , project + , tag + , map_concat(flags, map_from_entries(array[('direct', direct)])) as flags + , selector as call_selector + , method + , signature + , call_from + , call_to + , call_success + , date(date_trunc('month', block_time)) as block_month +from calls + +{% endmacro %} \ No newline at end of file diff --git a/macros/models/_project/oneinch/oneinch_project_orders_macro.sql b/macros/models/_project/oneinch/oneinch_project_orders_macro.sql index 7f391ddab53..111724c504b 100644 --- a/macros/models/_project/oneinch/oneinch_project_orders_macro.sql +++ b/macros/models/_project/oneinch/oneinch_project_orders_macro.sql @@ -600,8 +600,8 @@ "receiver": "substr(input, 4 + bytearray_to_bigint(substr(input, 4 + 24 + 1, 8)) + 32*8 + 12 + 1, 32)", "maker_asset": "substr(input, 4 + bytearray_to_bigint(substr(input, 4 + 24 + 1, 8)) + bytearray_to_bigint(substr(input, 4 + bytearray_to_bigint(substr(input, 4 + 24 + 1, 8)) + 32*5 + 24 + 1, 8)) + 32 * least(x, bytearray_to_bigint(substr(input, 4 + bytearray_to_bigint(substr(input, 4 + 24 + 1, 8)) + 32*5 + 24 + 1, 8))) + 12 + 1, 20)", "taker_asset": "substr(input, 4 + bytearray_to_bigint(substr(input, 4 + 24 + 1, 8)) + bytearray_to_bigint(substr(input, 4 + bytearray_to_bigint(substr(input, 4 + 24 + 1, 8)) + 32*4 + 24 + 1, 8)) + 32 * least(x, bytearray_to_bigint(substr(input, 4 + bytearray_to_bigint(substr(input, 4 + 24 + 1, 8)) + 32*4 + 24 + 1, 8))) + 12 + 1, 20)", - "maker_max_amount": "substr(input, 4 + bytearray_to_bigint(substr(input, 4 + 24 + 1, 8)) + bytearray_to_bigint(substr(input, 4 + bytearray_to_bigint(substr(input, 4 + 24 + 1, 8)) + 32*7 + 24 + 1, 8)) + 32 * least(x, bytearray_to_bigint(substr(input, 4 + bytearray_to_bigint(substr(input, 4 + 24 + 1, 8)) + 32*7 + 24 + 1, 8))) + 1, 32)", - "taker_max_amount": "substr(input, 4 + bytearray_to_bigint(substr(input, 4 + 24 + 1, 8)) + bytearray_to_bigint(substr(input, 4 + bytearray_to_bigint(substr(input, 4 + 24 + 1, 8)) + 32*6 + 24 + 1, 8)) + 32 * least(x, bytearray_to_bigint(substr(input, 4 + bytearray_to_bigint(substr(input, 4 + 24 + 1, 8)) + 32*6 + 24 + 1, 8))) + 1, 32)", + "making_amount": "substr(input, 4 + bytearray_to_bigint(substr(input, 4 + 24 + 1, 8)) + bytearray_to_bigint(substr(input, 4 + bytearray_to_bigint(substr(input, 4 + 24 + 1, 8)) + 32*7 + 24 + 1, 8)) + 32 * least(x, bytearray_to_bigint(substr(input, 4 + bytearray_to_bigint(substr(input, 4 + 24 + 1, 8)) + 32*7 + 24 + 1, 8))) + 1, 32)", + "taking_amount": "substr(input, 4 + bytearray_to_bigint(substr(input, 4 + 24 + 1, 8)) + bytearray_to_bigint(substr(input, 4 + bytearray_to_bigint(substr(input, 4 + 24 + 1, 8)) + 32*6 + 24 + 1, 8)) + 32 * least(x, bytearray_to_bigint(substr(input, 4 + bytearray_to_bigint(substr(input, 4 + 24 + 1, 8)) + 32*6 + 24 + 1, 8))) + 1, 32)", "deadline": "substr(input, 4 + bytearray_to_bigint(substr(input, 4 + 24 + 1, 8)) + 32*1 + 24 + 1, 8)", "nonce": "substr(input, 4 + bytearray_to_bigint(substr(input, 4 + 24 + 1, 8)) + 32*3 + 1, 32)", "order_hash": "substr(input, 4 + bytearray_to_bigint(substr(input, 4 + 24 + 1, 8)) + 32*10 + 1, 16)", @@ -783,6 +783,29 @@ logs as ( , joined as ( select * + , coalesce(log_maker, call_maker, call_to) as maker + , coalesce(log_taker, call_taker) as taker + , coalesce(log_receiver, call_receiver) as receiver + , coalesce(log_maker_asset, call_maker_asset) as maker_asset + , coalesce(log_taker_asset, call_taker_asset) as taker_asset + , coalesce(log_maker_max_amount, call_maker_max_amount) as maker_max_amount + , coalesce(log_taker_max_amount, call_taker_max_amount) as taker_max_amount + , coalesce(log_maker_min_amount, call_maker_min_amount) as maker_min_amount + , coalesce(log_taker_min_amount, call_taker_min_amount) as taker_min_amount + , coalesce(log_making_amount, call_making_amount) as making_amount + , coalesce(log_taking_amount, call_taking_amount) as taking_amount + , coalesce(log_start, call_start) as order_start + , coalesce(log_end, call_end) as order_end + , coalesce(log_deadline, call_deadline) as order_deadline + , coalesce(log_maker_fee_amount, call_maker_fee_amount) as maker_fee_amount + , coalesce(log_taker_fee_amount, call_taker_fee_amount) as taker_fee_amount + , coalesce(log_fee_asset, call_fee_asset) as fee_asset + , coalesce(log_fee_max_amount, call_fee_max_amount) as fee_max_amount + , coalesce(log_fee_min_amount, call_fee_min_amount) as fee_min_amount + , coalesce(log_fee_amount, call_fee_amount) as fee_amount + , coalesce(log_fee_receiver, call_fee_receiver) as fee_receiver + , coalesce(log_nonce, call_nonce) as order_nonce + , coalesce(log_order_hash, call_order_hash, concat(tx_hash, to_big_endian_32(cast(call_trade_counter as int)))) as order_hash , count(*) over(partition by blockchain, block_number, tx_hash, call_trace_address, call_trade) as trades from calls full join logs using(block_number, tx_hash, topic0) @@ -812,7 +835,9 @@ select blockchain , project , tag - , flags + , map_concat(flags, map_from_entries(array[ + ('auction', coalesce(order_start, uint256 '0') > uint256 '0' or project in ('CoWSwap', 'Bebop')) + ])) as flags , block_number , block_time , tx_hash @@ -827,29 +852,29 @@ select , call_error , call_trade , method - , coalesce(coalesce(log_maker, call_maker), call_to) as maker - , coalesce(log_taker, call_taker) as taker - , coalesce(log_receiver, call_receiver) as receiver - , coalesce(log_maker_asset, call_maker_asset) as maker_asset - , coalesce(log_taker_asset, call_taker_asset) as taker_asset - , coalesce(log_maker_max_amount, call_maker_max_amount) as maker_max_amount - , coalesce(log_taker_max_amount, call_taker_max_amount) as taker_max_amount - , coalesce(log_maker_min_amount, call_maker_min_amount) as maker_min_amount - , coalesce(log_taker_min_amount, call_taker_min_amount) as taker_min_amount - , coalesce(log_making_amount, call_making_amount) as making_amount - , coalesce(log_taking_amount, call_taking_amount) as taking_amount - , coalesce(log_start, call_start) as order_start - , coalesce(log_end, call_end) as order_end - , coalesce(log_deadline, call_deadline) as order_deadline - , coalesce(log_maker_fee_amount, call_maker_fee_amount) as maker_fee_amount - , coalesce(log_taker_fee_amount, call_taker_fee_amount) as taker_fee_amount - , coalesce(log_fee_asset, call_fee_asset) as fee_asset - , coalesce(log_fee_max_amount, call_fee_max_amount) as fee_max_amount - , coalesce(log_fee_min_amount, call_fee_min_amount) as fee_min_amount - , coalesce(log_fee_amount, call_fee_amount) as fee_amount - , coalesce(log_fee_receiver, call_fee_receiver) as fee_receiver - , coalesce(log_nonce, call_nonce) as order_nonce - , coalesce(log_order_hash, call_order_hash, to_big_endian_64(call_trade_counter)) as order_hash + , maker + , taker + , receiver + , maker_asset + , taker_asset + , maker_max_amount + , taker_max_amount + , maker_min_amount + , taker_min_amount + , coalesce(making_amount, if(order_start = uint256 '0' or order_start = order_end, maker_max_amount, maker_max_amount - cast(to_unixtime(block_time) - order_start as double) / (order_end - order_start) * (cast(maker_max_amount as double) - cast(maker_min_amount as double))), maker_max_amount, maker_min_amount) as making_amount + , coalesce(taking_amount, if(order_start = uint256 '0' or order_start = order_end, taker_max_amount, taker_max_amount - cast(to_unixtime(block_time) - order_start as double) / (order_end - order_start) * (cast(taker_max_amount as double) - cast(taker_min_amount as double))), taker_max_amount, taker_min_amount) as taking_amount + , order_start + , order_end + , order_deadline + , maker_fee_amount + , taker_fee_amount + , fee_asset + , fee_max_amount + , fee_min_amount + , fee_amount + , fee_receiver + , order_nonce + , order_hash , array[input] as call_input , array[output] as call_output , index as event_index diff --git a/macros/models/_project/oneinch/oneinch_project_swaps_macro.sql b/macros/models/_project/oneinch/oneinch_project_swaps_macro.sql index b858aed3386..79ec7f980e4 100644 --- a/macros/models/_project/oneinch/oneinch_project_swaps_macro.sql +++ b/macros/models/_project/oneinch/oneinch_project_swaps_macro.sql @@ -5,78 +5,139 @@ ) %} +{% set native_addresses = '(0x0000000000000000000000000000000000000000, 0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee)' %} + with -methods as ( +meta as ( + select + chain_id + , wrapped_native_token_address + , native_token_symbol as native_symbol + from ({{ oneinch_blockchain_macro(blockchain) }}) +) + +, orders as ( select - blockchain - , address as call_to + block_number + , tx_hash + , call_trace_address , project - , method - , selector - , flags - from {{ ref('oneinch_' + blockchain + '_mapped_methods') }} - where flags['swap'] + , order_hash + , maker + , maker_asset + , making_amount + , taker_asset + , taking_amount + , flags as order_flags + from {{ ref('oneinch_' + blockchain + '_project_orders') }} + where + {% if is_incremental() %} + {{ incremental_predicate('block_time') }} + {% else %} + block_time >= timestamp '{{date_from}}' + {% endif %} + and call_success + + union all + + select + block_number + , tx_hash + , call_trace_address + , '1inch' as project + , coalesce(order_hash, concat(tx_hash, to_big_endian_32(cast(counter as int)))) as order_hash + , maker + , maker_asset + , making_amount + , taker_asset + , taking_amount + , flags as order_flags + from ( + select *, row_number() over(partition by block_number, tx_hash order by call_trace_address) as counter + from {{ ref('oneinch_' + blockchain + '_lop') }} + where + {% if is_incremental() %} + {{ incremental_predicate('block_time') }} + {% else %} + block_time >= timestamp '{{date_from}}' + {% endif %} + and call_success + ) ) , calls as ( select - * - , array_agg((call_trace_address, flags)) over(partition by block_number, tx_hash, project) as call_trace_addresses + blockchain + , block_number + , tx_hash + , tx_from + , tx_to + , call_trace_address + , project + , tag + , flags + , call_selector + , method + , call_from + , call_to + , order_hash + , order_flags + , maker + , maker_asset + , making_amount + , taker_asset + , taking_amount + , call_trace_addresses + , if(maker_asset in {{native_addresses}}, wrapped_native_token_address, maker_asset) as _maker_asset + , if(taker_asset in {{native_addresses}}, wrapped_native_token_address, taker_asset) as _taker_asset + , coalesce(order_hash, to_big_endian_64(counter)) as call_trade_id from ( select - block_number - , block_time - , tx_hash - , "from" as call_from - , "to" as call_to - , trace_address as call_trace_address - , cardinality(trace_address) = 0 as direct - , substr(input, 1, 4) as selector - from {{ source(blockchain, 'traces') }} - {% if is_incremental() %} - where {{ incremental_predicate('block_time') }} - {% else %} - where block_time >= timestamp '{{date_from}}' - {% endif %} + * + , array_agg(call_trace_address) over(partition by block_number, tx_hash, project) as call_trace_addresses + , row_number() over(partition by block_number, tx_hash order by call_trace_address) as counter + from {{ ref('oneinch_' + blockchain + '_project_calls') }} + where + {% if is_incremental() %} + {{ incremental_predicate('block_time') }} + {% else %} + block_time >= timestamp '{{date_from}}' + {% endif %} and (tx_success or tx_success is null) - and success + and call_success ) - join methods using(call_to, selector) - join ( - select - block_number - , hash as tx_hash - , "from" as tx_from - from {{ source(blockchain, 'transactions') }} - {% if is_incremental() %} - where {{ incremental_predicate('block_time') }} - {% else %} - where block_time >= timestamp '{{date_from}}' - {% endif %} - and (success or success is null) - - ) using(block_number, tx_hash) + left join orders using(block_number, tx_hash, call_trace_address, project) + join meta on true + where + reduce(call_trace_addresses, true, (r, x) -> if(r and x <> call_trace_address and slice(call_trace_address, 1, cardinality(x)) = x, false, r), r -> r) -- only not nested calls of the project in tx + or order_hash is not null -- all orders +) + +, tokens as ( + select + contract_address + , symbol + from {{ source('tokens', 'erc20') }} + where blockchain = '{{blockchain}}' ) , prices as ( select - blockchain - , contract_address + contract_address , minute , price , decimals - , symbol from {{ source('prices', 'usd') }} where - blockchain = '{{blockchain}}' {% if is_incremental() %} - and {{ incremental_predicate('minute') }} + {{ incremental_predicate('minute') }} {% else %} - and minute >= timestamp '{{date_from}}' + minute >= timestamp '{{date_from}}' {% endif %} + and blockchain = '{{blockchain}}' ) , creations as ( @@ -91,57 +152,78 @@ methods as ( (0x0000000000000000000000000000000000000000, 0) ) -, amounts as ( +, swaps as ( select * - , transform(filter(array_distinct(flatten(call_transfer_addresses)), x -> x[2]), x -> (x[1])) as users + , transform(filter(array_distinct(flatten(call_transfer_addresses)), x -> not x.contract), x -> (x.address)) as users , array_agg( cast(row(project, call_trace_address, coalesce(user_amount_usd, amount_usd)) as row(project varchar, call_trace_address array(bigint), amount_usd double)) ) over(partition by block_number, tx_hash) as amounts - , coalesce(if(direct, user_amount_usd, caller_amount_usd), amount_usd) as result_amount_usd + , coalesce(if(flags['direct'], user_amount_usd, caller_amount_usd), amount_usd) as result_amount_usd from ( select - calls.blockchain + blockchain , calls.block_number , calls.tx_hash , calls.call_trace_address - , any_value(calls.block_time) as block_time - , any_value(calls.tx_from) as tx_from - , any_value(calls.project) as project - , any_value(calls.call_from) as call_from - , any_value(calls.call_to) as call_to - , any_value(calls.method) as method - , any_value(calls.flags) as flags - , any_value(calls.direct) as direct + , call_trade_id + , any_value(block_time) as block_time + , any_value(tx_from) as tx_from + , any_value(tx_to) as tx_to + , any_value(project) as project + , any_value(tag) as tag + , any_value(flags) as flags + , any_value(call_from) as call_from + , any_value(call_to) as call_to + , any_value(call_selector) as call_selector + , any_value(method) as method + , any_value(order_hash) as order_hash + , any_value(maker) as maker + , any_value(maker_asset) as maker_asset + , any_value(making_amount) as making_amount + , any_value(taker_asset) as taker_asset + , any_value(taking_amount) as taking_amount + , any_value(order_flags) as order_flags + , array_agg(distinct if(native, native_symbol, symbol)) as tokens , max(amount * price / pow(10, decimals)) as amount_usd , max(amount * price / pow(10, decimals)) filter(where creations_from.block_number is null or creations_to.block_number is null) as user_amount_usd , max(amount * price / pow(10, decimals)) filter(where transfer_from = call_from or transfer_to = call_from) as caller_amount_usd , array_agg(array[ - cast(row(transfer_from, creations_from.block_number is null) as row(address varbinary, success boolean)), - cast(row(transfer_to, creations_to.block_number is null) as row(address varbinary, success boolean)) - ]) as call_transfer_addresses + cast(row(transfer_from, creations_from.block_number is not null) as row(address varbinary, contract boolean)) + , cast(row(transfer_to, creations_to.block_number is not null) as row(address varbinary, contract boolean)) + ]) as call_transfer_addresses from calls join ( - select * - from ({{ oneinch_parsed_transfers_from_calls_macro(blockchain) }}) - {% if is_incremental() %} - where {{ incremental_predicate('block_time') }} - {% else %} - where block_time >= timestamp '{{date_from}}' - {% endif %} + select + block_number + , block_time + , tx_hash + , transfer_trace_address + , if(type = 'native', wrapped_native_token_address, contract_address) as contract_address + , type = 'native' as native + , amount + , native_symbol + , transfer_from + , transfer_to + , date_trunc('minute', block_time) as minute + from ({{ oneinch_parsed_transfers_from_calls_macro(blockchain) }}), meta + where + {% if is_incremental() %} + {{ incremental_predicate('block_time') }} + {% else %} + block_time >= timestamp '{{date_from}}' + {% endif %} ) as transfers on calls.block_number = transfers.block_number and calls.tx_hash = transfers.tx_hash - and slice(transfer_trace_address, 1, cardinality(call_trace_address)) = call_trace_address - and reduce(call_trace_addresses, call_trace_address, (r, x) -> if(slice(transfer_trace_address, 1, cardinality(x[1])) = x[1] and r < x[1], x[1], r), r -> r) = call_trace_address - left join prices on - prices.contract_address = transfers.contract_address - and prices.minute = date_trunc('minute', transfers.block_time) + and slice(transfer_trace_address, 1, cardinality(call_trace_address)) = call_trace_address -- nested transfers only + and reduce(call_trace_addresses, call_trace_address, (r, x) -> if(slice(transfer_trace_address, 1, cardinality(x)) = x and x > r, x, r), r -> r) = call_trace_address -- transfers related to the call only + and (order_hash is null or contract_address in (_maker_asset, _taker_asset)) -- transfers related to the order only + left join prices using(contract_address, minute) + left join tokens using(contract_address) left join creations as creations_from on creations_from.address = transfers.transfer_from left join creations as creations_to on creations_to.address = transfers.transfer_to - where - reduce(call_trace_addresses, true, (r, x) -> if(r and x[1] <> call_trace_address and slice(call_trace_address, 1, cardinality(x[1])) = x[1] and x[2] = flags, false, r), r -> r) - group by 1, 2, 3, 4 + group by 1, 2, 3, 4, 5 ) ) @@ -150,22 +232,34 @@ methods as ( select blockchain , block_number - , tx_hash - , call_trace_address , block_time + , tx_hash , tx_from + , tx_to + , call_trace_address , project + , tag + , flags + , call_selector + , method , call_from , call_to - , method - , map_concat(flags, map_from_entries(array[('direct', direct)])) as flags + , order_hash + , maker + , maker_asset + , making_amount + , taker_asset + , taking_amount + , order_flags + , tokens , amount_usd , user_amount_usd , caller_amount_usd , result_amount_usd , amounts - , if(cardinality(users) = 0 or not flags['limits'], array_union(users, array[tx_from]), users) as users + , if(cardinality(users) = 0 or order_hash is null, array_union(users, array[tx_from]), users) as users , date(date_trunc('month', block_time)) as block_month -from amounts + , call_trade_id +from swaps {% endmacro %} \ No newline at end of file diff --git a/models/oneinch/arbitrum/oneinch_arbitrum_project_calls.sql b/models/oneinch/arbitrum/oneinch_arbitrum_project_calls.sql new file mode 100644 index 00000000000..f9a52ca41b9 --- /dev/null +++ b/models/oneinch/arbitrum/oneinch_arbitrum_project_calls.sql @@ -0,0 +1,24 @@ +{% set blockchain = 'arbitrum' %} + + + +{{ + config( + schema = 'oneinch_' + blockchain, + alias = 'project_calls', + partition_by = ['block_month'], + materialized = 'incremental', + file_format = 'delta', + incremental_strategy = 'merge', + incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.block_time')], + unique_key = ['blockchain', 'block_number', 'tx_hash', 'call_trace_address'] + ) +}} + + + +{{ + oneinch_project_calls_macro( + blockchain = blockchain + ) +}} \ No newline at end of file diff --git a/models/oneinch/arbitrum/oneinch_arbitrum_project_swaps.sql b/models/oneinch/arbitrum/oneinch_arbitrum_project_swaps.sql index 9a560bdcf91..7f0ef20cd25 100644 --- a/models/oneinch/arbitrum/oneinch_arbitrum_project_swaps.sql +++ b/models/oneinch/arbitrum/oneinch_arbitrum_project_swaps.sql @@ -11,7 +11,7 @@ file_format = 'delta', incremental_strategy = 'merge', incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.block_time')], - unique_key = ['blockchain', 'tx_hash', 'call_trace_address'] + unique_key = ['blockchain', 'block_number', 'tx_hash', 'call_trace_address', 'call_trade_id'] ) }} diff --git a/models/oneinch/avalanche_c/oneinch_avalanche_c_project_calls.sql b/models/oneinch/avalanche_c/oneinch_avalanche_c_project_calls.sql new file mode 100644 index 00000000000..108b2656d2d --- /dev/null +++ b/models/oneinch/avalanche_c/oneinch_avalanche_c_project_calls.sql @@ -0,0 +1,24 @@ +{% set blockchain = 'avalanche_c' %} + + + +{{ + config( + schema = 'oneinch_' + blockchain, + alias = 'project_calls', + partition_by = ['block_month'], + materialized = 'incremental', + file_format = 'delta', + incremental_strategy = 'merge', + incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.block_time')], + unique_key = ['blockchain', 'block_number', 'tx_hash', 'call_trace_address'] + ) +}} + + + +{{ + oneinch_project_calls_macro( + blockchain = blockchain + ) +}} \ No newline at end of file diff --git a/models/oneinch/avalanche_c/oneinch_avalanche_c_project_swaps.sql b/models/oneinch/avalanche_c/oneinch_avalanche_c_project_swaps.sql index 2165d04fa7a..1163d3cf2b6 100644 --- a/models/oneinch/avalanche_c/oneinch_avalanche_c_project_swaps.sql +++ b/models/oneinch/avalanche_c/oneinch_avalanche_c_project_swaps.sql @@ -11,7 +11,7 @@ file_format = 'delta', incremental_strategy = 'merge', incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.block_time')], - unique_key = ['blockchain', 'tx_hash', 'call_trace_address'] + unique_key = ['blockchain', 'block_number', 'tx_hash', 'call_trace_address', 'call_trade_id'] ) }} diff --git a/models/oneinch/base/oneinch_base_project_calls.sql b/models/oneinch/base/oneinch_base_project_calls.sql new file mode 100644 index 00000000000..0e032672355 --- /dev/null +++ b/models/oneinch/base/oneinch_base_project_calls.sql @@ -0,0 +1,24 @@ +{% set blockchain = 'base' %} + + + +{{ + config( + schema = 'oneinch_' + blockchain, + alias = 'project_calls', + partition_by = ['block_month'], + materialized = 'incremental', + file_format = 'delta', + incremental_strategy = 'merge', + incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.block_time')], + unique_key = ['blockchain', 'block_number', 'tx_hash', 'call_trace_address'] + ) +}} + + + +{{ + oneinch_project_calls_macro( + blockchain = blockchain + ) +}} \ No newline at end of file diff --git a/models/oneinch/base/oneinch_base_project_swaps.sql b/models/oneinch/base/oneinch_base_project_swaps.sql index 68373480266..0ee0f02ba5c 100644 --- a/models/oneinch/base/oneinch_base_project_swaps.sql +++ b/models/oneinch/base/oneinch_base_project_swaps.sql @@ -11,7 +11,7 @@ file_format = 'delta', incremental_strategy = 'merge', incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.block_time')], - unique_key = ['blockchain', 'tx_hash', 'call_trace_address'] + unique_key = ['blockchain', 'block_number', 'tx_hash', 'call_trace_address', 'call_trade_id'] ) }} diff --git a/models/oneinch/bnb/oneinch_bnb_project_calls.sql b/models/oneinch/bnb/oneinch_bnb_project_calls.sql new file mode 100644 index 00000000000..ce8b3a478fe --- /dev/null +++ b/models/oneinch/bnb/oneinch_bnb_project_calls.sql @@ -0,0 +1,24 @@ +{% set blockchain = 'bnb' %} + + + +{{ + config( + schema = 'oneinch_' + blockchain, + alias = 'project_calls', + partition_by = ['block_month'], + materialized = 'incremental', + file_format = 'delta', + incremental_strategy = 'merge', + incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.block_time')], + unique_key = ['blockchain', 'block_number', 'tx_hash', 'call_trace_address'] + ) +}} + + + +{{ + oneinch_project_calls_macro( + blockchain = blockchain + ) +}} \ No newline at end of file diff --git a/models/oneinch/bnb/oneinch_bnb_project_swaps.sql b/models/oneinch/bnb/oneinch_bnb_project_swaps.sql index dd0d00a2bb8..cda7a0bab41 100644 --- a/models/oneinch/bnb/oneinch_bnb_project_swaps.sql +++ b/models/oneinch/bnb/oneinch_bnb_project_swaps.sql @@ -11,7 +11,7 @@ file_format = 'delta', incremental_strategy = 'merge', incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.block_time')], - unique_key = ['blockchain', 'tx_hash', 'call_trace_address'] + unique_key = ['blockchain', 'block_number', 'tx_hash', 'call_trace_address', 'call_trade_id'] ) }} diff --git a/models/oneinch/ethereum/oneinch_ethereum_project_calls.sql b/models/oneinch/ethereum/oneinch_ethereum_project_calls.sql new file mode 100644 index 00000000000..1c569f7bbad --- /dev/null +++ b/models/oneinch/ethereum/oneinch_ethereum_project_calls.sql @@ -0,0 +1,24 @@ +{% set blockchain = 'ethereum' %} + + + +{{ + config( + schema = 'oneinch_' + blockchain, + alias = 'project_calls', + partition_by = ['block_month'], + materialized = 'incremental', + file_format = 'delta', + incremental_strategy = 'merge', + incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.block_time')], + unique_key = ['blockchain', 'block_number', 'tx_hash', 'call_trace_address'] + ) +}} + + + +{{ + oneinch_project_calls_macro( + blockchain = blockchain + ) +}} \ No newline at end of file diff --git a/models/oneinch/ethereum/oneinch_ethereum_project_swaps.sql b/models/oneinch/ethereum/oneinch_ethereum_project_swaps.sql index 62ede1328e7..ce18756de7a 100644 --- a/models/oneinch/ethereum/oneinch_ethereum_project_swaps.sql +++ b/models/oneinch/ethereum/oneinch_ethereum_project_swaps.sql @@ -11,7 +11,7 @@ file_format = 'delta', incremental_strategy = 'merge', incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.block_time')], - unique_key = ['blockchain', 'tx_hash', 'call_trace_address'] + unique_key = ['blockchain', 'block_number', 'tx_hash', 'call_trace_address', 'call_trade_id'] ) }} diff --git a/models/oneinch/fantom/oneinch_fantom_project_calls.sql b/models/oneinch/fantom/oneinch_fantom_project_calls.sql new file mode 100644 index 00000000000..73caf1173c6 --- /dev/null +++ b/models/oneinch/fantom/oneinch_fantom_project_calls.sql @@ -0,0 +1,24 @@ +{% set blockchain = 'fantom' %} + + + +{{ + config( + schema = 'oneinch_' + blockchain, + alias = 'project_calls', + partition_by = ['block_month'], + materialized = 'incremental', + file_format = 'delta', + incremental_strategy = 'merge', + incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.block_time')], + unique_key = ['blockchain', 'block_number', 'tx_hash', 'call_trace_address'] + ) +}} + + + +{{ + oneinch_project_calls_macro( + blockchain = blockchain + ) +}} \ No newline at end of file diff --git a/models/oneinch/fantom/oneinch_fantom_project_swaps.sql b/models/oneinch/fantom/oneinch_fantom_project_swaps.sql index 04c4a8ce828..cc21fa718aa 100644 --- a/models/oneinch/fantom/oneinch_fantom_project_swaps.sql +++ b/models/oneinch/fantom/oneinch_fantom_project_swaps.sql @@ -11,7 +11,7 @@ file_format = 'delta', incremental_strategy = 'merge', incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.block_time')], - unique_key = ['blockchain', 'tx_hash', 'call_trace_address'] + unique_key = ['blockchain', 'block_number', 'tx_hash', 'call_trace_address', 'call_trade_id'] ) }} diff --git a/models/oneinch/gnosis/oneinch_gnosis_project_calls.sql b/models/oneinch/gnosis/oneinch_gnosis_project_calls.sql new file mode 100644 index 00000000000..1e16a2a37d4 --- /dev/null +++ b/models/oneinch/gnosis/oneinch_gnosis_project_calls.sql @@ -0,0 +1,24 @@ +{% set blockchain = 'gnosis' %} + + + +{{ + config( + schema = 'oneinch_' + blockchain, + alias = 'project_calls', + partition_by = ['block_month'], + materialized = 'incremental', + file_format = 'delta', + incremental_strategy = 'merge', + incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.block_time')], + unique_key = ['blockchain', 'block_number', 'tx_hash', 'call_trace_address'] + ) +}} + + + +{{ + oneinch_project_calls_macro( + blockchain = blockchain + ) +}} \ No newline at end of file diff --git a/models/oneinch/gnosis/oneinch_gnosis_project_swaps.sql b/models/oneinch/gnosis/oneinch_gnosis_project_swaps.sql index 5c140abcfbc..522d0483f5a 100644 --- a/models/oneinch/gnosis/oneinch_gnosis_project_swaps.sql +++ b/models/oneinch/gnosis/oneinch_gnosis_project_swaps.sql @@ -11,7 +11,7 @@ file_format = 'delta', incremental_strategy = 'merge', incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.block_time')], - unique_key = ['blockchain', 'tx_hash', 'call_trace_address'] + unique_key = ['blockchain', 'block_number', 'tx_hash', 'call_trace_address', 'call_trade_id'] ) }} diff --git a/models/oneinch/oneinch_project_orders.sql b/models/oneinch/oneinch_project_orders.sql index e02589fd236..d3e68e9f1d5 100644 --- a/models/oneinch/oneinch_project_orders.sql +++ b/models/oneinch/oneinch_project_orders.sql @@ -7,44 +7,64 @@ 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'] + unique_key = ['blockchain', 'block_number', 'tx_hash', 'call_trace_address', 'order_hash'] ) }} +{% set + orders_base_columns = [ + 'blockchain', + 'block_number', + 'block_time', + 'tx_hash', + 'method', + 'call_selector', + 'call_trace_address', + 'call_from', + 'call_to', + 'call_gas_used', + 'maker', + 'maker_asset', + 'making_amount', + 'taker_asset', + 'taking_amount', + 'order_hash', + 'flags', + ] +%} + +{% set native_addresses = '(0x0000000000000000000000000000000000000000, 0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee)' %} + with - -orders as ( + +meta as ( + select + blockchain + , wrapped_native_token_address + , native_token_symbol as native_symbol + from {{ ref('oneinch_blockchains') }} +) + +, orders as ( select * - , array[maker_asset, taker_asset] as assets + , array[ + if(maker_asset in {{native_addresses}}, wrapped_native_token_address, maker_asset) + , if(taker_asset in {{native_addresses}}, wrapped_native_token_address, taker_asset) + ] as assets , date_trunc('minute', block_time) as minute - , row_number() over(partition by blockchain, block_number, tx_hash, project order by call_trace_address) as counter + , row_number() over(partition by blockchain, block_number, tx_hash order by call_trace_address, order_hash) as counter from ( {% for blockchain in oneinch_exposed_blockchains_list() %} select - blockchain - , block_number - , block_time - , tx_hash + {{ orders_base_columns | join(', ') }} + , tag , project - , method - , call_selector - , call_trace_address - , call_from - , call_to - , call_gas_used - , maker - , maker_asset - , coalesce(making_amount, if(order_start = uint256 '0', maker_max_amount, maker_max_amount - cast(block_unixtime - order_start as double) / (order_end - order_start) * (cast(maker_max_amount as double) - cast(maker_min_amount as double)))) as making_amount - , taker_asset - , coalesce(taking_amount, if(order_start = uint256 '0', taker_max_amount, taker_max_amount - cast(block_unixtime - order_start as double) / (order_end - order_start) * (cast(taker_max_amount as double) - cast(taker_min_amount as double)))) as taking_amount - , order_hash , order_start , order_end , order_deadline - , flags from {{ ref('oneinch_' + blockchain + '_project_orders') }} where call_success {% if not loop.last %} union all {% endif %} @@ -53,30 +73,16 @@ orders as ( union all select - blockchain - , block_number - , block_time - , tx_hash + {{ orders_base_columns | join(', ') }} + , contract_name as tag , '1inch' as project - , method - , call_selector - , call_trace_address - , call_from - , call_to - , call_gas_used - , maker - , maker_asset - , making_amount - , taker_asset - , taking_amount - , order_hash , null as order_start , null as order_end , null as order_deadline - , flags from {{ ref('oneinch_lop') }} where call_success ) + join meta using(blockchain) {% if is_incremental() %} where {{ incremental_predicate('block_time') }} {% endif %} @@ -102,6 +108,7 @@ orders as ( , block_number , tx_hash , call_trace_address + , coalesce(order_hash, concat(tx_hash, to_big_endian_32(cast(counter as int)))) as order_hash , any_value(block_time) as block_time , any_value(project) as project , any_value(call_selector) as call_selector @@ -111,20 +118,20 @@ orders as ( , any_value(maker) as maker , any_value(maker_asset) as maker_asset , any_value(taker_asset) as taker_asset - , any_value(symbol) filter(where contract_address = maker_asset) as maker_asset_symbol - , any_value(symbol) filter(where contract_address = taker_asset) as taker_asset_symbol + , any_value(if(maker_asset = assets[1], symbol, native_symbol)) filter(where contract_address = assets[1]) as maker_asset_symbol + , any_value(if(taker_asset = assets[2], symbol, native_symbol)) filter(where contract_address = assets[2]) as taker_asset_symbol , any_value(making_amount) as making_amount , any_value(taking_amount) as taking_amount - , any_value(making_amount * price / pow(10, decimals)) filter(where contract_address = maker_asset) as making_amount_usd - , any_value(taking_amount * price / pow(10, decimals)) filter(where contract_address = taker_asset) as taking_amount_usd - , any_value(coalesce(order_hash, concat(tx_hash, to_big_endian_32(cast(counter as int))))) as order_hash + , any_value(making_amount * price / pow(10, decimals)) filter(where contract_address = assets[1]) as making_amount_usd + , any_value(taking_amount * price / pow(10, decimals)) filter(where contract_address = assets[2]) as taking_amount_usd , any_value(order_start) as order_start , any_value(order_end) as order_end , any_value(order_deadline) as order_deadline , any_value(flags) as flags - from (select * from orders, unnest(assets) as assets(contract_address)) + , 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 + group by 1, 2, 3, 4, 5 ) -- output -- @@ -134,8 +141,8 @@ select , block_number , block_time , tx_hash - , call_trace_address , project + , call_trace_address , call_selector , call_from , call_to @@ -155,5 +162,6 @@ select , order_end , order_deadline , flags + , tag , date(date_trunc('month', block_time)) as block_month from joined \ No newline at end of file diff --git a/models/oneinch/oneinch_project_swaps.sql b/models/oneinch/oneinch_project_swaps.sql index bf3968c152b..fb1169899c0 100644 --- a/models/oneinch/oneinch_project_swaps.sql +++ b/models/oneinch/oneinch_project_swaps.sql @@ -3,7 +3,7 @@ schema = 'oneinch', alias = 'project_swaps', materialized = 'view', - unique_key = ['blockchain', 'tx_hash', 'call_trace_address'] + unique_key = ['blockchain', 'block_number', 'tx_hash', 'call_trace_address', 'call_trade_id'] ) }} diff --git a/models/oneinch/optimism/oneinch_optimism_project_calls.sql b/models/oneinch/optimism/oneinch_optimism_project_calls.sql new file mode 100644 index 00000000000..461d4f3b7d2 --- /dev/null +++ b/models/oneinch/optimism/oneinch_optimism_project_calls.sql @@ -0,0 +1,24 @@ +{% set blockchain = 'optimism' %} + + + +{{ + config( + schema = 'oneinch_' + blockchain, + alias = 'project_calls', + partition_by = ['block_month'], + materialized = 'incremental', + file_format = 'delta', + incremental_strategy = 'merge', + incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.block_time')], + unique_key = ['blockchain', 'block_number', 'tx_hash', 'call_trace_address'] + ) +}} + + + +{{ + oneinch_project_calls_macro( + blockchain = blockchain + ) +}} \ No newline at end of file diff --git a/models/oneinch/optimism/oneinch_optimism_project_swaps.sql b/models/oneinch/optimism/oneinch_optimism_project_swaps.sql index 5715b69e0eb..d9b13c84eb9 100644 --- a/models/oneinch/optimism/oneinch_optimism_project_swaps.sql +++ b/models/oneinch/optimism/oneinch_optimism_project_swaps.sql @@ -11,7 +11,7 @@ file_format = 'delta', incremental_strategy = 'merge', incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.block_time')], - unique_key = ['blockchain', 'tx_hash', 'call_trace_address'] + unique_key = ['blockchain', 'block_number', 'tx_hash', 'call_trace_address', 'call_trade_id'] ) }} diff --git a/models/oneinch/polygon/oneinch_polygon_project_calls.sql b/models/oneinch/polygon/oneinch_polygon_project_calls.sql new file mode 100644 index 00000000000..cedb4fb0901 --- /dev/null +++ b/models/oneinch/polygon/oneinch_polygon_project_calls.sql @@ -0,0 +1,24 @@ +{% set blockchain = 'polygon' %} + + + +{{ + config( + schema = 'oneinch_' + blockchain, + alias = 'project_calls', + partition_by = ['block_month'], + materialized = 'incremental', + file_format = 'delta', + incremental_strategy = 'merge', + incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.block_time')], + unique_key = ['blockchain', 'block_number', 'tx_hash', 'call_trace_address'] + ) +}} + + + +{{ + oneinch_project_calls_macro( + blockchain = blockchain + ) +}} \ No newline at end of file diff --git a/models/oneinch/polygon/oneinch_polygon_project_swaps.sql b/models/oneinch/polygon/oneinch_polygon_project_swaps.sql index b93244d2cb1..6f1e098e8e9 100644 --- a/models/oneinch/polygon/oneinch_polygon_project_swaps.sql +++ b/models/oneinch/polygon/oneinch_polygon_project_swaps.sql @@ -11,7 +11,7 @@ file_format = 'delta', incremental_strategy = 'merge', incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.block_time')], - unique_key = ['blockchain', 'tx_hash', 'call_trace_address'] + unique_key = ['blockchain', 'block_number', 'tx_hash', 'call_trace_address', 'call_trade_id'] ) }} diff --git a/models/oneinch/zksync/oneinch_zksync_project_calls.sql b/models/oneinch/zksync/oneinch_zksync_project_calls.sql new file mode 100644 index 00000000000..01091d61d0c --- /dev/null +++ b/models/oneinch/zksync/oneinch_zksync_project_calls.sql @@ -0,0 +1,24 @@ +{% set blockchain = 'zksync' %} + + + +{{ + config( + schema = 'oneinch_' + blockchain, + alias = 'project_calls', + partition_by = ['block_month'], + materialized = 'incremental', + file_format = 'delta', + incremental_strategy = 'merge', + incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.block_time')], + unique_key = ['blockchain', 'block_number', 'tx_hash', 'call_trace_address'] + ) +}} + + + +{{ + oneinch_project_calls_macro( + blockchain = blockchain + ) +}} \ No newline at end of file diff --git a/models/oneinch/zksync/oneinch_zksync_project_swaps.sql b/models/oneinch/zksync/oneinch_zksync_project_swaps.sql index c5fe2f1848d..db6d4809a23 100644 --- a/models/oneinch/zksync/oneinch_zksync_project_swaps.sql +++ b/models/oneinch/zksync/oneinch_zksync_project_swaps.sql @@ -11,7 +11,7 @@ file_format = 'delta', incremental_strategy = 'merge', incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.block_time')], - unique_key = ['blockchain', 'tx_hash', 'call_trace_address'] + unique_key = ['blockchain', 'block_number', 'tx_hash', 'call_trace_address', 'call_trade_id'] ) }} From 4f48010b53905224a8d03dd0ab1525ba2a4dfa3c Mon Sep 17 00:00:00 2001 From: jeff-dude <102681548+jeff-dude@users.noreply.github.com> Date: Mon, 17 Jun 2024 05:48:55 -0400 Subject: [PATCH 124/149] dex sector subproject creation (#6161) * intitiate project * initial file movement * moving around more files * move dex aggregator lineage * fix compile errors * move dex pools * move seeds, tests, fix compile errors * move generic tests * move project views, fix compile errors * move more pools * initiate dex sources file, update first ref to source * cleanup subproject sources * update dex aggregator to source * dex trades ref to source * cow protocol ref to source * cow gnosis ref to source * cleanup old uniswap models * balancer refs to sources * fix compile errors, more refs to sources * cleanup project file * cleanup old dex models * move more dependencies for balancer * intitiate project * initial file movement * moving around more files * move dex aggregator lineage * fix compile errors * move dex pools * move seeds, tests, fix compile errors * move generic tests * move project views, fix compile errors * move more pools * initiate dex sources file, update first ref to source * cleanup subproject sources * update dex aggregator to source * dex trades ref to source * cow protocol ref to source * cow gnosis ref to source * cleanup old uniswap models * balancer refs to sources * fix compile errors, more refs to sources * cleanup project file * cleanup old dex models * move more dependencies for balancer * Fix sources post rebase * Fix tests for cow * Fix schema post rebase * Fix dbt_project post rebase * Switch to source * Switch to source * Add sources * Move test * Move back tests * Remove * Fix sources * Fix * Fix source * Add missing seeds * clean up tests * organize macros * organize models * test full dex run * Revert "test full dex run" This reverts commit 1672016368ec3ce66226ab8b6e0f70b4786a7ad9. --------- Co-authored-by: Alan Ghobadi --- .github/workflows/commit_manifest.yml | 2 +- .github/workflows/dex.yml | 19 + dbt_project.yml | 116 --- dex/README.md | 11 + dex/dbt_project.yml | 67 ++ .../_project}/airswap_compatible_trades.sql | 0 .../_project}/balancer_compatible_trades.sql | 0 .../_project}/clipper_compatible_trades.sql | 0 .../_project}/dodo_compatible_trades.sql | 0 .../_project}/kyberswap_compatible_trades.sql | 0 .../_project}/maverick_compatible_trades.sql | 0 .../_project}/openocean_compatible_trades.sql | 0 .../trader_joe_compatible_trades.sql | 0 .../_project}/uniswap_compatible_trades.sql | 0 .../models/_project}/yield_yak_trades.sql | 0 .../macros/models}/dex_atomic_arbitrages.sql | 0 .../macros/models}/dex_sandwiched.sql | 0 .../macros/models}/dex_sandwiches.sql | 0 .../models}/enrich_curve_dex_trades.sql | 0 .../macros/models}/enrich_dex_trades.sql | 0 .../generic_spot_compatible_trades.sql | 0 .../_projects}/aerodrome/aerodrome_trades.sql | 0 .../_projects}/airswap/airswap_trades.sql | 0 .../_projects}/apeswap/apeswap_trades.sql | 0 .../_projects}/arbswap/arbswap_trades.sql | 0 .../models/_projects/arrakis/_schema.yml | 0 .../arrakis/arrakis_uniswap_pools.sql | 0 .../_projects/arrakis/optimism/_schema.yml | 0 .../arrakis_optimism_uniswap_pools.sql | 0 .../_projects}/babyswap/babyswap_trades.sql | 0 .../_projects/balancer/labels/_schema.yml | 307 ++++++++ .../labels_balancer_v2_pools_arbitrum.sql | 1 + .../labels_balancer_v2_pools_avalanche_c.sql | 1 + .../base}/labels_balancer_v2_pools_base.sql | 1 + .../labels_balancer_v1_pools_ethereum.sql | 2 +- .../labels_balancer_v2_pools_ethereum.sql | 1 + .../labels_balancer_v2_pools_gnosis.sql | 1 + .../labels}/labels_balancer_v1_pools.sql | 2 +- .../labels}/labels_balancer_v2_pools.sql | 5 +- .../labels_balancer_v2_pools_optimism.sql | 1 + .../labels_balancer_v2_pools_polygon.sql | 1 + .../zkevm}/labels_balancer_v2_pools_zkevm.sql | 1 + .../_projects/balancer/pools/_schema.yml | 268 +++++++ .../balancer_v2_arbitrum_pools_fees.sql | 0 .../balancer_v2_avalanche_c_pools_fees.sql | 0 .../balancer/pools/balancer_pools_fees.sql | 0 .../base/balancer_v2_base_pools_fees.sql | 0 .../balancer_v2_ethereum_pools_fees.sql | 0 .../gnosis/balancer_v2_gnosis_pools_fees.sql | 0 .../balancer_v2_optimism_pools_fees.sql | 0 .../balancer_v2_polygon_pools_fees.sql | 0 .../zkevm/balancer_v2_zkevm_pools_fees.sql | 0 .../balancer/trades/arbitrum/_schema.yml | 4 - .../arbitrum/balancer_arbitrum_trades.sql | 0 .../arbitrum/balancer_v2_arbitrum_trades.sql | 8 +- .../balancer/trades/avalanche_c/_schema.yml | 4 - .../balancer_avalanche_c_trades.sql | 0 .../balancer_v2_avalanche_c_trades.sql | 8 +- .../balancer/trades/balancer_trades.sql | 0 .../balancer/trades/base/_schema.yml | 4 - .../trades/base/balancer_base_trades.sql | 0 .../trades/base/balancer_v2_base_trades.sql | 8 +- .../balancer/trades/ethereum/_schema.yml | 4 - .../ethereum/balancer_ethereum_trades.sql | 0 .../ethereum/balancer_v1_ethereum_trades.sql | 0 .../ethereum/balancer_v2_ethereum_trades.sql | 8 +- .../balancer/trades/gnosis/_schema.yml | 4 - .../trades/gnosis/balancer_gnosis_trades.sql | 0 .../gnosis/balancer_v2_gnosis_trades.sql | 8 +- .../balancer/trades/optimism/_schema.yml | 4 - .../optimism/balancer_optimism_trades.sql | 0 .../optimism/balancer_v2_optimism_trades.sql | 8 +- .../balancer/trades/polygon/_schema.yml | 4 - .../polygon/balancer_polygon_trades.sql | 0 .../polygon/balancer_v2_polygon_trades.sql | 8 +- .../balancer/trades/zkevm/_schema.yml | 4 - .../trades/zkevm/balancer_v2_zkevm_trades.sql | 8 +- .../trades/zkevm/balancer_zkevm_trades.sql | 0 .../_projects}/bancor/bancor_trades.sql | 0 .../models/_projects/bebop/_schema.yml | 0 .../_projects/bebop/arbitrum/_schema.yml | 0 .../bebop/arbitrum/bebop_arbitrum_trades.sql | 0 .../arbitrum/bebop_blend_arbitrum_trades.sql | 0 .../arbitrum/bebop_jam_arbitrum_trades.sql | 0 .../arbitrum/bebop_rfq_arbitrum_trades.sql | 0 .../models/_projects/bebop/base/_schema.yml | 0 .../bebop/base/bebop_base_trades.sql | 0 .../bebop/base/bebop_blend_base_trades.sql | 0 .../bebop/base/bebop_jam_base_trades.sql | 0 .../models/_projects}/bebop/bebop_trades.sql | 0 .../models/_projects/bebop/bnb/_schema.yml | 0 .../_projects}/bebop/bnb/bebop_bnb_trades.sql | 0 .../bebop/bnb/bebop_jam_bnb_trades.sql | 0 .../_projects/bebop/ethereum/_schema.yml | 0 .../ethereum/bebop_blend_ethereum_trades.sql | 0 .../bebop/ethereum/bebop_ethereum_trades.sql | 0 .../ethereum/bebop_jam_ethereum_trades.sql | 0 .../ethereum/bebop_rfq_ethereum_trades.sql | 0 .../_projects/bebop/optimism/_schema.yml | 0 .../optimism/bebop_jam_optimism_trades.sql | 0 .../bebop/optimism/bebop_optimism_trades.sql | 0 .../optimism/bebop_rfq_optimism_trades.sql | 0 .../_projects/bebop/polygon/_schema.yml | 0 .../polygon/bebop_blend_polygon_trades.sql | 0 .../polygon/bebop_jam_polygon_trades.sql | 0 .../bebop/polygon/bebop_polygon_trades.sql | 0 .../polygon/bebop_rfq_polygon_trades.sql | 0 .../models/_projects/bebop/scroll/_schema.yml | 0 .../bebop/scroll/bebop_jam_scroll_trades.sql | 0 .../bebop/scroll/bebop_scroll_trades.sql | 0 .../models/_projects/bebop/zksync/_schema.yml | 0 .../bebop/zksync/bebop_jam_zksync_trades.sql | 0 .../bebop/zksync/bebop_zksync_trades.sql | 0 dex/models/_projects/beethoven_x/_schema.yml | 53 ++ .../beethoven_x_fantom_pools_fees.sql | 0 .../beethoven_x/beethoven_x_trades.sql | 0 .../_projects}/biswap/biswap_trades.sql | 0 .../_projects}/camelot/camelot_trades.sql | 0 .../carbon_defi/carbon_defi_trades.sql | 0 .../_projects}/clipper/clipper_trades.sql | 0 dex/models/_projects/cow_protocol/_schema.yml | 325 ++++++++ .../arbitrum/cow_protocol_arbitrum_trades.sql | 0 .../cow_protocol/cow_protocol_trades.sql | 2 +- .../ethereum/cow_protocol_ethereum_trades.sql | 26 +- .../gnosis/cow_protocol_gnosis_trades.sql | 2 +- .../models/_projects/curvefi/celo/_schema.yml | 0 .../curvefi/celo/curvefi_celo_pools.sql | 0 .../_projects}/curvefi/curvefi_trades.sql | 0 .../_projects/curvefi/ethereum/_schema.yml | 0 .../curvefi_ethereum_pool_details.sql | 4 +- .../ethereum/curvefi_ethereum_view_pools.sql | 2 +- .../_projects/curvefi/fantom/_schema.yml | 0 .../fantom/curvefi_fantom_pool_tokens.sql | 2 +- .../_projects/curvefi/optimism/_schema.yml | 40 + .../optimism/curvefi_optimism_pools.sql | 2 +- .../models/_projects}/curvefi/readme.md | 0 .../_projects}/defiswap/defiswap_trades.sql | 0 .../_projects/dex_trades_views_schema.yml | 2 +- .../models/_projects}/dfx/dfx_trades.sql | 0 .../models/_projects/dodo/_schema.yml | 0 .../_projects/dodo/arbitrum/_schema.yml | 0 .../dodo_aggregator_arbitrum_trades.sql | 2 +- .../models/_projects/dodo/base/_schema.yml | 0 .../dodo/base/dodo_aggregator_base_trades.sql | 2 +- .../models/_projects/dodo/bnb/_schema.yml | 0 .../dodo/bnb/dodo_aggregator_bnb_trades.sql | 2 +- .../dodo/dodo_aggregator_trades.sql | 14 +- .../models/_projects}/dodo/dodo_trades.sql | 0 .../_projects/dodo/ethereum/_schema.yml | 0 .../dodo_aggregator_ethereum_trades.sql | 2 +- .../_projects/dodo/optimism/_schema.yml | 0 .../dodo_aggregator_optimism_trades.sql | 2 +- .../models/_projects/dodo/polygon/_schema.yml | 0 .../dodo_aggregator_polygon_trades.sql | 2 +- .../_projects/ellipsis_finance/_schema.yml | 48 ++ .../ellipsis_finance_bnb_pool_tokens.sql | 0 .../ellipsis_finance_trades.sql | 0 .../_projects}/equalizer/equalizer_trades.sql | 0 .../_projects/equalizer/fantom/_schema.yml | 0 .../fantom/equalizer_fantom_pools.sql | 0 .../firebird_finance/optimism/_schema.yml | 0 .../firebird_finance_optimism_trades.sql | 0 .../_projects}/fraxswap/fraxswap_trades.sql | 0 .../models/_projects/gamma/_schema.yml | 0 .../_projects}/gamma/gamma_uniswap_pools.sql | 0 .../_projects/gamma/optimism/_schema.yml | 0 .../optimism/gamma_optimism_uniswap_pools.sql | 0 .../_projects}/glacier/glacier_trades.sql | 0 .../models/_projects}/gmx/gmx_trades.sql | 0 .../_projects}/hashflow/hashflow_trades.sql | 0 .../_projects}/honeyswap/honeyswap_trades.sql | 0 .../_projects}/integral/integral_trades.sql | 0 .../_projects}/iziswap/iziswap_trades.sql | 0 .../models/_projects/kyberswap/_schema.yml | 0 .../_projects/kyberswap/arbitrum/_schema.yml | 0 .../kyberswap_aggregator_arbitrum_trades.sql | 0 .../kyberswap/avalanche_c/_schema.yml | 0 ...yberswap_aggregator_avalanche_c_trades.sql | 0 .../_projects/kyberswap/base/_schema.yml | 0 .../base/kyberswap_aggregator_base_trades.sql | 0 .../_projects/kyberswap/bnb/_schema.yml | 0 .../bnb/kyberswap_aggregator_bnb_trades.sql | 0 .../_projects/kyberswap/ethereum/_schema.yml | 0 .../kyberswap_aggregator_ethereum_trades.sql | 0 .../kyberswap/kyberswap_aggregator_trades.sql | 0 .../_projects}/kyberswap/kyberswap_trades.sql | 0 .../_projects/kyberswap/optimism/_schema.yml | 0 .../kyberswap_aggregator_optimism_trades.sql | 0 .../_projects/kyberswap/polygon/_schema.yml | 0 .../kyberswap_aggregator_polygon_trades.sql | 0 .../models/_projects/lifi/_schema.yml | 0 .../models/_projects/lifi/fantom/_schema.yml | 0 .../lifi/fantom/lifi_fantom_trades.sql | 2 +- .../lifi/fantom/lifi_v2_fantom_trades.sql | 0 .../models/_projects}/lifi/lifi_trades.sql | 2 +- .../_projects/lifi/optimism/_schema.yml | 0 .../lifi/optimism/lifi_optimism_trades.sql | 2 +- .../lifi/optimism/lifi_v2_optimism_trades.sql | 0 .../models/_projects}/mauve/mauve_trades.sql | 0 .../_projects}/maverick/maverick_trades.sql | 0 .../models/_projects}/mdex/mdex_trades.sql | 0 .../models/_projects/mento/celo/_schema.yml | 0 .../mento/celo/mento_celo_pools.sql | 0 .../mento/celo/mento_v1_celo_pools.sql | 0 .../mento/celo/mento_v2_celo_pools.sql | 0 .../_projects}/mstable/mstable_trades.sql | 0 .../mummy_finance/mummy_finance_trades.sql | 0 .../_projects}/nomiswap/nomiswap_trades.sql | 0 .../models/_projects/odos/_schema.yml | 0 .../_projects/odos/avalanche_c/_schema.yml | 0 .../avalanche_c/odos_avalanche_c_trades.sql | 1 + .../models/_projects/odos/base/_schema.yml | 0 .../_projects}/odos/base/odos_base_trades.sql | 0 .../odos/base/odos_v2_base_trades.sql | 0 .../_projects/odos/ethereum/_schema.yml | 0 .../odos/ethereum/odos_ethereum_trades.sql | 0 .../odos/ethereum/odos_v2_ethereum_trades.sql | 0 .../models/_projects}/odos/odos_trades.sql | 1 + .../_projects/odos/optimism/_schema.yml | 0 .../odos/optimism/odos_optimism_trades.sql | 0 .../odos/optimism/odos_v1_optimism_trades.sql | 0 .../odos/optimism/odos_v2_optimism_trades.sql | 0 .../oneinch/_meta/oneinch_blockchains.sql | 0 .../oneinch/_meta/oneinch_fusion_accounts.sql | 0 .../_meta/oneinch_fusion_executors.sql | 0 .../oneinch/_meta/oneinch_fusion_farms.sql | 0 .../_meta/oneinch_fusion_resolvers.sql | 0 .../_meta/oneinch_mapped_contracts.sql | 0 .../oneinch/_meta/oneinch_mapped_methods.sql | 0 .../models/_projects/oneinch/_schema.yml | 0 .../oneinch_arbitrum_mapped_contracts.sql | 0 .../_meta/oneinch_arbitrum_mapped_methods.sql | 0 .../oneinch/arbitrum/oneinch_arbitrum_ar.sql | 0 .../oneinch_arbitrum_call_transfers.sql | 0 .../oneinch/arbitrum/oneinch_arbitrum_lop.sql | 0 .../oneinch_arbitrum_project_calls.sql | 0 .../oneinch_arbitrum_project_orders.sql | 0 .../oneinch_arbitrum_project_swaps.sql | 0 .../arbitrum/oneinch_arbitrum_schema.yml | 0 .../oneinch_avalanche_c_mapped_contracts.sql | 0 .../oneinch_avalanche_c_mapped_methods.sql | 0 .../avalanche_c/oneinch_avalanche_c_ar.sql | 0 .../oneinch_avalanche_c_call_transfers.sql | 0 .../avalanche_c/oneinch_avalanche_c_lop.sql | 0 .../oneinch_avalanche_c_project_calls.sql | 0 .../oneinch_avalanche_c_project_orders.sql | 0 .../oneinch_avalanche_c_project_swaps.sql | 0 .../oneinch_avalanche_c_schema.yml | 0 .../_meta/oneinch_base_mapped_contracts.sql | 0 .../_meta/oneinch_base_mapped_methods.sql | 0 .../oneinch/base/oneinch_base_ar.sql | 0 .../base/oneinch_base_call_transfers.sql | 0 .../oneinch/base/oneinch_base_lop.sql | 0 .../base/oneinch_base_project_calls.sql | 0 .../base/oneinch_base_project_orders.sql | 0 .../base/oneinch_base_project_swaps.sql | 0 .../oneinch/base/oneinch_base_schema.yml | 0 .../_meta/oneinch_bnb_mapped_contracts.sql | 0 .../bnb/_meta/oneinch_bnb_mapped_methods.sql | 0 .../_projects}/oneinch/bnb/oneinch_bnb_ar.sql | 0 .../bnb/oneinch_bnb_call_transfers.sql | 0 .../oneinch/bnb/oneinch_bnb_lop.sql | 0 .../oneinch/bnb/oneinch_bnb_project_calls.sql | 0 .../bnb/oneinch_bnb_project_orders.sql | 0 .../oneinch/bnb/oneinch_bnb_project_swaps.sql | 0 .../oneinch/bnb/oneinch_bnb_schema.yml | 0 .../oneinch_ethereum_mapped_contracts.sql | 0 .../_meta/oneinch_ethereum_mapped_methods.sql | 0 .../oneinch/ethereum/oneinch_ethereum_ar.sql | 0 .../oneinch_ethereum_call_transfers.sql | 0 .../oneinch/ethereum/oneinch_ethereum_lop.sql | 0 .../oneinch_ethereum_project_calls.sql | 0 .../oneinch_ethereum_project_orders.sql | 0 .../oneinch_ethereum_project_swaps.sql | 0 .../ethereum/oneinch_ethereum_schema.yml | 47 +- .../_meta/oneinch_fantom_mapped_contracts.sql | 0 .../_meta/oneinch_fantom_mapped_methods.sql | 0 .../oneinch/fantom/oneinch_fantom_ar.sql | 0 .../fantom/oneinch_fantom_call_transfers.sql | 0 .../oneinch/fantom/oneinch_fantom_lop.sql | 0 .../fantom/oneinch_fantom_project_calls.sql | 0 .../fantom/oneinch_fantom_project_orders.sql | 0 .../fantom/oneinch_fantom_project_swaps.sql | 0 .../oneinch/fantom/oneinch_fantom_schema.yml | 0 .../_meta/oneinch_gnosis_mapped_contracts.sql | 0 .../_meta/oneinch_gnosis_mapped_methods.sql | 0 .../oneinch/gnosis/oneinch_gnosis_ar.sql | 0 .../gnosis/oneinch_gnosis_call_transfers.sql | 0 .../oneinch/gnosis/oneinch_gnosis_lop.sql | 0 .../gnosis/oneinch_gnosis_project_calls.sql | 0 .../gnosis/oneinch_gnosis_project_orders.sql | 0 .../gnosis/oneinch_gnosis_project_swaps.sql | 0 .../oneinch/gnosis/oneinch_gnosis_schema.yml | 0 .../models/_projects}/oneinch/oneinch_ar.sql | 0 .../_projects}/oneinch/oneinch_ar_trades.sql | 0 .../oneinch/oneinch_call_transfers.sql | 0 .../_projects}/oneinch/oneinch_calls.sql | 0 .../models/_projects}/oneinch/oneinch_lop.sql | 0 .../oneinch/oneinch_lop_own_trades.sql | 0 .../oneinch_parsed_transfers_from_calls.sql | 0 .../oneinch/oneinch_project_orders.sql | 0 .../oneinch/oneinch_project_swaps.sql | 0 .../_projects}/oneinch/oneinch_swaps.sql | 0 .../oneinch_optimism_mapped_contracts.sql | 0 .../_meta/oneinch_optimism_mapped_methods.sql | 0 .../oneinch/optimism/oneinch_optimism_ar.sql | 0 .../oneinch_optimism_call_transfers.sql | 0 .../oneinch/optimism/oneinch_optimism_lop.sql | 0 .../oneinch_optimism_project_calls.sql | 0 .../oneinch_optimism_project_orders.sql | 0 .../oneinch_optimism_project_swaps.sql | 0 .../optimism/oneinch_optimism_schema.yml | 0 .../oneinch_polygon_mapped_contracts.sql | 0 .../_meta/oneinch_polygon_mapped_methods.sql | 0 .../oneinch/polygon/oneinch_polygon_ar.sql | 0 .../oneinch_polygon_call_transfers.sql | 0 .../oneinch/polygon/oneinch_polygon_lop.sql | 0 .../polygon/oneinch_polygon_project_calls.sql | 0 .../oneinch_polygon_project_orders.sql | 0 .../polygon/oneinch_polygon_project_swaps.sql | 0 .../polygon/oneinch_polygon_schema.yml | 0 .../_meta/oneinch_zksync_mapped_contracts.sql | 0 .../_meta/oneinch_zksync_mapped_methods.sql | 0 .../oneinch/zksync/oneinch_zksync_ar.sql | 0 .../zksync/oneinch_zksync_call_transfers.sql | 0 .../oneinch/zksync/oneinch_zksync_lop.sql | 0 .../zksync/oneinch_zksync_project_calls.sql | 0 .../zksync/oneinch_zksync_project_orders.sql | 0 .../zksync/oneinch_zksync_project_swaps.sql | 0 .../oneinch/zksync/oneinch_zksync_schema.yml | 0 .../onepunchswap/onepunchswap_trades.sql | 0 .../_projects}/openocean/openocean_trades.sql | 0 .../_projects}/openxswap/openxswap_trades.sql | 0 .../opx_finance/opx_finance_trades.sql | 0 .../pancakeswap/pancakeswap_trades.sql | 0 .../models/_projects/paraswap/_schema.yml | 0 .../_projects/paraswap/arbitrum/_schema.yml | 0 .../arbitrum/paraswap_arbitrum_trades.sql | 0 .../arbitrum/paraswap_v5_arbitrum_trades.sql | 0 .../arbitrum/paraswap_v6_arbitrum_trades.sql | 0 .../paraswap_v6_arbitrum_trades_decoded.sql | 0 .../paraswap/avalanche_c/_schema.yml | 0 .../paraswap_avalanche_c_trades.sql | 0 .../paraswap_v5_avalanche_c_trades.sql | 0 .../paraswap_v6_avalanche_c_trades.sql | 0 ...paraswap_v6_avalanche_c_trades_decoded.sql | 0 .../_projects/paraswap/base/_schema.yml | 0 .../paraswap/base/paraswap_base_trades.sql | 0 .../paraswap/base/paraswap_v5_base_trades.sql | 0 .../paraswap/base/paraswap_v6_base_trades.sql | 0 .../base/paraswap_v6_base_trades_decoded.sql | 0 .../models/_projects/paraswap/bnb/_schema.yml | 0 .../paraswap/bnb/paraswap_bnb_trades.sql | 0 .../paraswap/bnb/paraswap_v4_bnb_trades.sql | 0 .../paraswap/bnb/paraswap_v5_bnb_trades.sql | 0 .../paraswap/bnb/paraswap_v6_bnb_trades.sql | 0 .../bnb/paraswap_v6_bnb_trades_decoded.sql | 0 .../_projects/paraswap/ethereum/_schema.yml | 88 +-- .../ethereum/paraswap_ethereum_trades.sql | 0 .../ethereum/paraswap_v4_ethereum_trades.sql | 0 .../ethereum/paraswap_v5_ethereum_trades.sql | 0 .../ethereum/paraswap_v6_ethereum_trades.sql | 0 .../paraswap_v6_ethereum_trades_decoded.sql | 0 .../_projects/paraswap/fantom/_schema.yml | 0 .../fantom/paraswap_fantom_trades.sql | 0 .../fantom/paraswap_v5_fantom_trades.sql | 0 .../fantom/paraswap_v6_fantom_trades.sql | 0 .../paraswap_v6_fantom_trades_decoded.sql | 0 .../_projects/paraswap/optimism/_schema.yml | 0 .../optimism/paraswap_optimism_trades.sql | 0 .../optimism/paraswap_v5_optimism_trades.sql | 0 .../optimism/paraswap_v6_optimism_trades.sql | 0 .../paraswap_v6_optimism_trades_decoded.sql | 0 .../_projects}/paraswap/paraswap_trades.sql | 0 .../_projects/paraswap/polygon/_schema.yml | 0 .../polygon/paraswap_polygon_trades.sql | 0 .../polygon/paraswap_v4_polygon_trades.sql | 0 .../polygon/paraswap_v5_polygon_trades.sql | 0 .../polygon/paraswap_v6_polygon_trades.sql | 0 .../paraswap_v6_polygon_trades_decoded.sql | 0 .../platypus_finance_trades.sql | 0 .../_projects}/quickswap/quickswap_trades.sql | 0 .../_projects}/rubicon/rubicon_trades.sql | 0 .../_projects}/shibaswap/shibaswap_trades.sql | 0 .../spartacus_exchange/fantom/_schema.yml | 0 .../spartacus_exchange_fantom_pools.sql | 2 +- .../spartacus_exchange_trades.sql | 0 .../_projects/spiritswap/fantom/_schema.yml | 0 .../fantom/spiritswap_fantom_pools.sql | 2 +- .../spiritswap/spiritswap_trades.sql | 0 .../_projects/spookyswap/fantom/_schema.yml | 0 .../fantom/spookyswap_fantom_pools.sql | 0 .../spookyswap/spookyswap_trades.sql | 0 .../_projects}/sushiswap/sushiswap_trades.sql | 0 .../models/_projects}/swapr/swapr_trades.sql | 0 .../_projects}/synthetix/synthetix_trades.sql | 0 .../models/_projects}/thena/thena_trades.sql | 0 .../models/_projects/tokenlon/_schema.yml | 0 .../_projects/tokenlon/ethereum/_schema.yml | 0 .../ethereum/tokenlon_ethereum_trades.sql | 2 +- .../tokenlon_v5_ethereum_amm_v1_trades.sql | 0 .../tokenlon_v5_ethereum_amm_v2_trades.sql | 0 .../tokenlon_v5_ethereum_pmm_v5_trades.sql | 0 .../tokenlon_v5_ethereum_rfq_v1_trades.sql | 0 .../tokenlon_v5_ethereum_rfq_v2_trades.sql | 0 .../_projects}/tokenlon/tokenlon_trades.sql | 2 +- .../trader_joe/trader_joe_trades.sql | 0 .../_projects}/ubeswap/ubeswap_trades.sql | 0 .../_projects/unidex/optimism/_schema.yml | 99 +++ .../optimism/unidex_optimism_trades.sql | 0 dex/models/_projects/uniswap/_schema.yml | 278 +++++++ .../arbitrum/uniswap_arbitrum_pools.sql | 1 - .../uniswap/bnb/uniswap_bnb_pools.sql | 2 +- .../uniswap/celo/uniswap_celo_pools.sql | 0 .../ethereum/uniswap_ethereum_pools.sql | 0 .../uniswap_optimism_ovm1_pool_mapping.sql | 0 .../optimism/uniswap_optimism_pools.sql | 0 .../uniswap/polygon/uniswap_polygon_pools.sql | 0 .../uniswap_liquidity_manager_pools.sql | 0 .../_projects}/uniswap/uniswap_pools.sql | 2 +- .../_projects}/uniswap/uniswap_trades.sql | 0 .../_projects}/velodrome/velodrome_trades.sql | 0 .../_projects}/verse_dex/verse_dex_trades.sql | 0 .../wardenswap/wardenswap_trades.sql | 0 .../_projects/wigoswap/fantom/_schema.yml | 0 .../wigoswap/fantom/wigoswap_fantom_pools.sql | 0 .../_projects}/wigoswap/wigoswap_trades.sql | 0 .../_projects}/wombat/wombat_trades.sql | 0 .../models/_projects}/woofi/woofi_trades.sql | 0 .../_projects}/xchange/xchange_trades.sql | 0 dex/models/_projects/yield_yak/_schema.yml | 79 ++ .../_projects/yield_yak/arbitrum/_schema.yml | 46 +- .../arbitrum/yield_yak_arbitrum_trades.sql | 0 .../yield_yak/avalanche_c/_schema.yml | 44 +- .../yield_yak_avalanche_c_trades.sql | 0 .../_projects/yield_yak/mantle/_schema.yml | 192 ++--- .../mantle/yield_yak_mantle_trades.sql | 0 .../_projects}/yield_yak/yield_yak_trades.sql | 0 .../arbitrum/zeroex_arbitrum_api_fills.sql | 2 +- .../zeroex_arbitrum_api_fills_deduped.sql | 0 .../arbitrum/zeroex_arbitrum_native_fills.sql | 1 + .../arbitrum/zeroex_arbitrum_schema.yml | 0 .../zeroex_avalanche_c_api_fills.sql | 2 +- .../zeroex_avalanche_c_api_fills_deduped.sql | 0 .../avalanche_c/zeroex_avalanche_c_schema.yml | 0 .../zeroex/base/zeroex_base_api_fills.sql | 0 .../base/zeroex_base_api_fills_deduped.sql | 0 .../base/zeroex_base_api_fills_schema.yml | 0 .../zeroex/bnb/zeroex_bnb_api_fills.sql | 2 +- .../bnb/zeroex_bnb_api_fills_deduped.sql | 2 +- .../zeroex/bnb/zeroex_bnb_native_fills.sql | 1 + .../zeroex/bnb/zeroex_bnb_schema.yml | 0 .../zeroex/celo/zeroex_celo_api_fills.sql | 0 .../celo/zeroex_celo_api_fills_deduped.sql | 0 .../zeroex/celo/zeroex_celo_schema.yml | 0 .../ethereum/zeroex_ethereum_api_fills.sql | 2 +- .../zeroex_ethereum_api_fills_deduped.sql | 0 .../ethereum/zeroex_ethereum_native_fills.sql | 1 + .../ethereum/zeroex_ethereum_nft_fills.sql | 2 +- .../ethereum/zeroex_ethereum_schema.yml | 0 .../zeroex/fantom/zeroex_fantom_api_fills.sql | 2 +- .../zeroex_fantom_api_fills_deduped.sql | 0 .../zeroex/fantom/zeroex_fantom_schema.yml | 0 .../optimism/zeroex_optimism_api_fills.sql | 0 .../zeroex_optimism_api_fills_deduped.sql | 0 .../optimism/zeroex_optimism_native_fills.sql | 1 + .../optimism/zeroex_optimism_schema.yml | 0 .../polygon/zeroex_polygon_api_fills.sql | 0 .../zeroex_polygon_api_fills_deduped.sql | 0 .../polygon/zeroex_polygon_native_fills.sql | 1 + .../polygon/zeroex_polygon_nft_fills.sql | 3 +- .../zeroex/polygon/zeroex_polygon_schema.yml | 0 .../_projects}/zeroex/zeroex_api_fills.sql | 0 .../zeroex/zeroex_api_fills_deduped.sql | 0 .../_projects}/zeroex/zeroex_native_fills.sql | 1 + .../zeroex/zeroex_native_trades.sql | 1 + .../_projects}/zeroex/zeroex_schema.yml | 0 .../_projects}/zeroex/zeroex_trades.sql | 0 .../_projects}/zigzag/zigzag_trades.sql | 0 .../_projects}/zipswap/zipswap_trades.sql | 0 dex/models/_schema.yml | 25 + dex/models/addresses/_schema.yml | 147 ++++ .../arbitrum/dex_arbitrum_addresses.sql | 0 .../addresses}/base/dex_base_addresses.sql | 0 .../addresses}/bnb/dex_bnb_addresses.sql | 0 .../models/addresses}/dex_addresses.sql | 0 .../ethereum/dex_ethereum_addresses.sql | 0 .../optimism/dex_optimism_addresses.sql | 0 .../polygon/dex_polygon_addresses.sql | 0 dex/models/aggregator_trades/_schema.yml | 94 +++ .../dex_aggregator_trades.sql | 0 dex/models/arbitrages/_schema.yml | 655 ++++++++++++++++ .../dex_arbitrum_atomic_arbitrages.sql | 0 .../dex_avalanche_c_atomic_arbitrages.sql | 0 .../base}/dex_base_atomic_arbitrages.sql | 0 .../bnb}/dex_bnb_atomic_arbitrages.sql | 0 .../celo}/dex_celo_atomic_arbitrages.sql | 0 .../arbitrages}/dex_atomic_arbitrages.sql | 0 .../dex_ethereum_atomic_arbitrages.sql | 0 .../fantom}/dex_fantom_atomic_arbitrages.sql | 0 .../gnosis}/dex_gnosis_atomic_arbitrages.sql | 0 .../dex_optimism_atomic_arbitrages.sql | 0 .../dex_polygon_atomic_arbitrages.sql | 0 .../scroll}/dex_scroll_atomic_arbitrages.sql | 0 .../zksync}/dex_zksync_atomic_arbitrages.sql | 0 .../zora}/dex_zora_atomic_arbitrages.sql | 0 {models/dex => dex/models}/dex_info.sql | 0 dex/models/pools/_schema.yml | 138 ++++ .../dex => dex/models/pools}/dex_pools.sql | 2 +- .../models/pools}/dex_raw_pool_creations.sql | 0 .../pools}/dex_raw_pool_initializations.sql | 0 .../models/pools}/dex_raw_pools.sql | 0 dex/models/prices/_schema.yml | 37 + .../dex => dex/models/prices}/dex_prices.sql | 2 +- .../models/prices}/dex_prices_latest.sql | 2 +- .../models/sandwiches/_schema.yml | 714 +++--------------- .../arbitrum}/dex_arbitrum_sandwiched.sql | 0 .../arbitrum}/dex_arbitrum_sandwiches.sql | 0 .../dex_avalanche_c_sandwiched.sql | 0 .../dex_avalanche_c_sandwiches.sql | 0 .../sandwiches/base}/dex_base_sandwiched.sql | 0 .../sandwiches/base}/dex_base_sandwiches.sql | 0 .../sandwiches/bnb}/dex_bnb_sandwiched.sql | 0 .../sandwiches/bnb}/dex_bnb_sandwiches.sql | 0 .../sandwiches/celo}/dex_celo_sandwiched.sql | 0 .../sandwiches/celo}/dex_celo_sandwiches.sql | 0 .../models/sandwiches}/dex_sandwiched.sql | 0 .../models/sandwiches}/dex_sandwiches.sql | 0 .../ethereum}/dex_ethereum_sandwiched.sql | 0 .../ethereum}/dex_ethereum_sandwiches.sql | 0 .../fantom}/dex_fantom_sandwiched.sql | 0 .../fantom}/dex_fantom_sandwiches.sql | 0 .../gnosis}/dex_gnosis_sandwiched.sql | 0 .../gnosis}/dex_gnosis_sandwiches.sql | 0 .../optimism}/dex_optimism_sandwiched.sql | 0 .../optimism}/dex_optimism_sandwiches.sql | 0 .../polygon}/dex_polygon_sandwiched.sql | 0 .../polygon}/dex_polygon_sandwiches.sql | 0 .../scroll}/dex_scroll_sandwiched.sql | 0 .../scroll}/dex_scroll_sandwiches.sql | 0 .../zksync}/dex_zksync_sandwiched.sql | 0 .../zksync}/dex_zksync_sandwiches.sql | 0 .../sandwiches/zora}/dex_zora_sandwiched.sql | 0 .../sandwiches/zora}/dex_zora_sandwiches.sql | 0 .../dex => dex/models}/trades/_schema.yml | 0 .../models}/trades/arbitrum/_schema.yml | 0 .../arbitrum/dex_arbitrum_base_trades.sql | 0 .../airswap_arbitrum_base_trades.sql | 0 .../apeswap_arbitrum_base_trades.sql | 0 .../arbswap_arbitrum_base_trades.sql | 0 .../platforms/auragi_arbitrum_base_trades.sql | 0 .../balancer_v2_arbitrum_base_trades.sql | 0 .../camelot_v2_arbitrum_base_trades.sql | 0 .../camelot_v3_arbitrum_base_trades.sql | 0 .../chronos_arbitrum_base_trades.sql | 0 .../clipper_arbitrum_base_trades.sql | 0 .../platforms/dodo_arbitrum_base_trades.sql | 0 .../fraxswap_arbitrum_base_trades.sql | 0 .../platforms/gmx_arbitrum_base_trades.sql | 0 .../platforms/gridex_arbitrum_base_trades.sql | 0 .../integral_arbitrum_base_trades.sql | 0 .../kyberswap_arbitrum_base_trades.sql | 0 .../oasisswap_arbitrum_base_trades.sql | 0 .../pancakeswap_v2_arbitrum_base_trades.sql | 0 .../pancakeswap_v3_arbitrum_base_trades.sql | 0 .../platforms/ramses_arbitrum_base_trades.sql | 0 .../rubicon_arbitrum_base_trades.sql | 0 .../sharkyswap_arbitrum_base_trades.sql | 0 .../smardex_arbitrum_base_trades.sql | 0 .../solidlizard_arbitrum_base_trades.sql | 0 .../solidly_v3_arbitrum_base_trades.sql | 0 .../sterling_finance_arbitrum_base_trades.sql | 0 .../sushiswap_v1_arbitrum_base_trades.sql | 0 .../sushiswap_v2_arbitrum_base_trades.sql | 0 .../swaap_v2_arbitrum_base_trades.sql | 0 .../trader_joe_v2_1_arbitrum_base_trades.sql | 0 .../trader_joe_v2_arbitrum_base_trades.sql | 0 .../uniswap_v2_arbitrum_base_trades.sql | 0 .../uniswap_v3_arbitrum_base_trades.sql | 0 .../wombat_exchange_arbitrum_base_trades.sql | 0 .../platforms/woofi_arbitrum_base_trades.sql | 0 .../xchange_arbitrum_base_trades.sql | 0 .../platforms/zigzag_arbitrum_base_trades.sql | 0 .../zyberswap_arbitrum_base_trades.sql | 0 .../models}/trades/avalanche_c/_schema.yml | 0 .../dex_avalanche_c_base_trades.sql | 0 .../airswap_avalanche_c_base_trades.sql | 0 .../balancer_v2_avalanche_c_base_trades.sql | 0 .../curvefi_avalanche_c_base_trades.sql | 0 .../fraxswap_avalanche_c_base_trades.sql | 0 .../glacier_v2_avalanche_c_base_trades.sql | 0 .../glacier_v3_avalanche_c_base_trades.sql | 0 .../platforms/gmx_avalanche_c_base_trades.sql | 0 .../hashflow_avalanche_c_base_trades.sql | 0 .../kyberswap_avalanche_c_base_trades.sql | 0 .../openocean_avalanche_c_base_trades.sql | 0 .../pharaoh_avalanche_c_base_trades.sql | 0 ...atypus_finance_avalanche_c_base_trades.sql | 0 .../sushiswap_v1_avalanche_c_base_trades.sql | 0 .../sushiswap_v2_avalanche_c_base_trades.sql | 0 .../trader_joe_v1_avalanche_c_base_trades.sql | 0 ...rader_joe_v2_1_avalanche_c_base_trades.sql | 0 .../trader_joe_v2_avalanche_c_base_trades.sql | 0 .../uniswap_v2_avalanche_c_base_trades.sql | 0 .../uniswap_v3_avalanche_c_base_trades.sql | 0 .../woofi_avalanche_c_base_trades.sql | 0 .../models}/trades/base/_schema.yml | 0 .../trades/base/dex_base_base_trades.sql | 0 .../platforms/aerodrome_base_base_trades.sql | 0 .../platforms/alienbase_base_base_trades.sql | 0 .../platforms/autotronic_base_base_trades.sql | 0 .../balancer_v2_base_base_trades.sql | 0 .../platforms/baseswap_base_base_trades.sql | 0 .../baseswap_basex_base_base_trades.sql | 0 .../baso_finance_base_base_trades.sql | 0 .../citadelswap_base_base_trades.sql | 0 .../platforms/clipper_base_base_trades.sql | 0 .../crescentswap_base_base_trades.sql | 0 .../platforms/dackieswap_base_base_trades.sql | 0 .../platforms/derpdex_base_base_trades.sql | 0 .../base/platforms/dodo_base_base_trades.sql | 0 .../elk_finance_base_base_trades.sql | 0 .../platforms/energon_base_base_trades.sql | 0 .../platforms/gridex_base_base_trades.sql | 0 .../platforms/horizondex_base_base_trades.sql | 0 .../icecreamswap_base_base_trades.sql | 0 .../platforms/kyberswap_base_base_trades.sql | 0 .../leetswap_v2_base_base_trades.sql | 0 .../platforms/maverick_base_base_trades.sql | 0 .../platforms/moonbase_base_base_trades.sql | 0 .../platforms/oasisswap_base_base_trades.sql | 0 .../platforms/openocean_base_base_trades.sql | 0 .../pancakeswap_v2_base_base_trades.sql | 0 .../pancakeswap_v3_base_base_trades.sql | 0 .../plantbaseswap_base_base_trades.sql | 0 .../platforms/rocketswap_base_base_trades.sql | 0 .../platforms/rubicon_base_base_trades.sql | 0 .../base/platforms/scale_base_base_trades.sql | 0 .../platforms/sharkswap_base_base_trades.sql | 0 .../platforms/smardex_base_base_trades.sql | 0 .../base/platforms/sobal_base_base_trades.sql | 0 .../platforms/solidly_v3_base_base_trades.sql | 0 .../platforms/soswap_base_base_trades.sql | 0 .../sushiswap_v1_base_base_trades.sql | 0 .../sushiswap_v2_base_base_trades.sql | 0 .../platforms/swapbased_base_base_trades.sql | 0 .../platforms/synthswap_base_base_trades.sql | 0 .../throne_exchange_v2_base_base_trades.sql | 0 .../throne_exchange_v3_base_base_trades.sql | 0 .../base/platforms/torus_base_base_trades.sql | 0 .../platforms/uniswap_v2_base_base_trades.sql | 0 .../platforms/uniswap_v3_base_base_trades.sql | 0 .../velocimeter_v2_base_base_trades.sql | 0 .../platforms/voltswap_base_base_trades.sql | 0 .../wombat_exchange_base_base_trades.sql | 0 .../base/platforms/woofi_base_base_trades.sql | 0 .../dex => dex/models}/trades/bnb/_schema.yml | 0 .../trades/bnb/dex_bnb_base_trades.sql | 0 .../bnb/platforms/airswap_bnb_base_trades.sql | 0 .../bnb/platforms/apeswap_bnb_base_trades.sql | 0 .../platforms/babyswap_bnb_base_trades.sql | 0 .../platforms/biswap_v2_bnb_base_trades.sql | 0 .../platforms/biswap_v3_bnb_base_trades.sql | 0 .../bnb/platforms/dodo_bnb_base_trades.sql | 0 .../ellipsis_finance_bnb_base_trades.sql | 0 .../platforms/fraxswap_bnb_base_trades.sql | 0 .../platforms/hashflow_bnb_base_trades.sql | 0 .../bnb/platforms/iziswap_bnb_base_trades.sql | 0 .../platforms/kyberswap_bnb_base_trades.sql | 0 .../platforms/maverick_bnb_base_trades.sql | 0 .../bnb/platforms/mdex_bnb_base_trades.sql | 0 .../platforms/nomiswap_bnb_base_trades.sql | 0 .../onepunchswap_bnb_base_trades.sql | 0 .../pancakeswap_v2_bnb_base_trades.sql | 0 .../pancakeswap_v3_bnb_base_trades.sql | 0 .../sushiswap_v1_bnb_base_trades.sql | 0 .../sushiswap_v2_bnb_base_trades.sql | 0 .../bnb/platforms/thena_bnb_base_trades.sql | 0 .../trader_joe_v2_1_bnb_base_trades.sql | 0 .../trader_joe_v2_bnb_base_trades.sql | 0 .../platforms/uniswap_v2_bnb_base_trades.sql | 0 .../platforms/uniswap_v3_bnb_base_trades.sql | 0 .../bnb/platforms/wombat_bnb_base_trades.sql | 0 .../bnb/platforms/woofi_bnb_base_trades.sql | 0 .../bnb/platforms/xchange_bnb_base_trades.sql | 0 .../models}/trades/celo/_schema.yml | 0 .../trades/celo/dex_celo_base_trades.sql | 0 .../platforms/carbonhood_celo_base_trades.sql | 0 .../platforms/curvefi_celo_base_trades.sql | 0 .../platforms/mento_v1_celo_base_trades.sql | 0 .../platforms/mento_v2_celo_base_trades.sql | 0 .../platforms/sushiswap_celo_base_trades.sql | 0 .../platforms/ubeswap_celo_base_trades.sql | 0 .../platforms/uniswap_v3_celo_base_trades.sql | 0 .../models}/trades/dex_base_trades.sql | 0 .../dex => dex/models}/trades/dex_trades.sql | 0 .../models}/trades/ethereum/_schema.yml | 0 .../ethereum/dex_ethereum_base_trades.sql | 0 .../airswap_ethereum_base_trades.sql | 0 .../apeswap_ethereum_base_trades.sql | 0 .../balancer_v1_ethereum_base_trades.sql | 0 .../balancer_v2_ethereum_base_trades.sql | 0 .../platforms/bancor_ethereum_base_trades.sql | 0 .../carbon_defi_ethereum_base_trades.sql | 0 .../clipper_ethereum_base_trades.sql | 0 .../curvefi_ethereum_base_trades.sql | 0 .../defiswap_ethereum_base_trades.sql | 0 .../platforms/dfx_ethereum_base_trades.sql | 0 .../platforms/dodo_ethereum_base_trades.sql | 0 .../fraxswap_ethereum_base_trades.sql | 0 .../integral_ethereum_base_trades.sql | 0 .../kyberswap_ethereum_base_trades.sql | 0 .../platforms/mauve_ethereum_base_trades.sql | 0 .../maverick_ethereum_base_trades.sql | 0 .../mstable_ethereum_base_trades.sql | 0 .../pancakeswap_v2_ethereum_base_trades.sql | 0 .../pancakeswap_v3_ethereum_base_trades.sql | 0 .../shibaswap_v1_ethereum_base_trades.sql | 0 .../solidly_v3_ethereum_base_trades.sql | 0 .../sushiswap_v1_ethereum_base_trades.sql | 0 .../sushiswap_v2_ethereum_base_trades.sql | 0 .../platforms/swapr_ethereum_base_trades.sql | 0 .../uniswap_v1_ethereum_base_trades.sql | 0 .../uniswap_v2_ethereum_base_trades.sql | 0 .../uniswap_v3_ethereum_base_trades.sql | 0 .../verse_dex_ethereum_base_trades.sql | 0 .../xchange_ethereum_base_trades.sql | 0 .../models}/trades/fantom/_schema.yml | 0 .../trades/fantom/dex_fantom_base_trades.sql | 0 .../beethoven_x_fantom_base_trades.sql | 0 .../platforms/curvefi_fantom_base_trades.sql | 0 .../equalizer_fantom_base_trades.sql | 0 .../openocean_fantom_base_trades.sql | 0 .../solidly_v3_fantom_base_trades.sql | 0 .../spartacus_exchange_fantom_base_trades.sql | 0 .../spiritswap_fantom_base_trades.sql | 0 .../spookyswap_fantom_base_trades.sql | 0 .../sushiswap_v1_fantom_base_trades.sql | 0 .../sushiswap_v2_fantom_base_trades.sql | 0 .../platforms/wigoswap_fantom_base_trades.sql | 0 .../models}/trades/gnosis/_schema.yml | 0 .../trades/gnosis/dex_gnosis_base_trades.sql | 0 .../balancer_v2_gnosis_base_trades.sql | 0 .../honeyswap_v2_gnosis_base_trades.sql | 0 .../sushiswap_v1_gnosis_base_trades.sql | 0 .../sushiswap_v2_gnosis_base_trades.sql | 0 .../models}/trades/linea/_schema.yml | 0 .../trades/linea/dex_linea_base_trades.sql | 0 .../platforms/echodex_linea_base_trades.sql | 0 .../platforms/lynex_linea_base_trades.sql | 0 .../platforms/nile_linea_base_trades.sql | 0 .../pancakeswap_v2_linea_base_trades.sql | 0 .../pancakeswap_v3_linea_base_trades.sql | 0 .../platforms/secta_linea_base_trades.sql | 0 .../sushiswap_v2_linea_base_trades.sql | 0 .../models}/trades/optimism/_schema.yml | 0 .../optimism/dex_optimism_base_trades.sql | 0 .../balancer_v2_optimism_base_trades.sql | 0 .../chainhop_optimism_base_trades.sql | 0 .../clipper_optimism_base_trades.sql | 0 .../curvefi_optimism_base_trades.sql | 0 .../dackieswap_v2_optimism_base_trades.sql | 0 .../dackieswap_v3_optimism_base_trades.sql | 0 .../platforms/dodo_optimism_base_trades.sql | 0 .../elk_finance_optimism_base_trades.sql | 0 .../fraxswap_optimism_base_trades.sql | 0 .../platforms/gridex_optimism_base_trades.sql | 0 .../hashflow_optimism_base_trades.sql | 0 .../kyberswap_optimism_base_trades.sql | 0 .../mummy_finance_optimism_base_trades.sql | 0 .../openocean_optimism_base_trades.sql | 0 .../openxswap_optimism_base_trades.sql | 0 .../opx_finance_optimism_base_trades.sql | 0 .../rubicon_optimism_base_trades.sql | 0 .../solidly_v3_optimism_base_trades.sql | 0 .../sushiswap_v1_optimism_base_trades.sql | 0 .../sushiswap_v2_optimism_base_trades.sql | 0 .../synthetix_optimism_base_trades.sql | 0 .../uniswap_v2_optimism_base_trades.sql | 0 .../uniswap_v3_optimism_base_trades.sql | 0 .../velodrome_optimism_base_trades.sql | 0 .../wardenswap_optimism_base_trades.sql | 0 .../wombat_exchange_optimism_base_trades.sql | 0 .../platforms/woofi_optimism_base_trades.sql | 0 .../zipswap_optimism_base_trades.sql | 0 .../models}/trades/polygon/_schema.yml | 0 .../polygon/dex_polygon_base_trades.sql | 0 .../platforms/airswap_polygon_base_trades.sql | 0 .../platforms/apeswap_polygon_base_trades.sql | 0 .../balancer_v2_polygon_base_trades.sql | 0 .../platforms/clipper_polygon_base_trades.sql | 0 .../platforms/dodo_polygon_base_trades.sql | 0 .../platforms/dooar_polygon_base_trades.sql | 0 .../fraxswap_polygon_base_trades.sql | 0 .../honeyswap_v2_polygon_base_trades.sql | 0 .../kyberswap_polygon_base_trades.sql | 0 .../quickswap_v2_polygon_base_trades.sql | 0 .../quickswap_v3_polygon_base_trades.sql | 0 .../sushiswap_v1_polygon_base_trades.sql | 0 .../sushiswap_v2_polygon_base_trades.sql | 0 .../uniswap_v2_polygon_base_trades.sql | 0 .../uniswap_v3_polygon_base_trades.sql | 0 .../platforms/xchange_polygon_base_trades.sql | 0 .../dex => dex/models/trades}/readme.md | 0 .../models}/trades/scroll/_schema.yml | 0 .../trades/scroll/dex_scroll_base_trades.sql | 0 .../icecreamswap_v2_scroll_base_trades.sql | 0 .../platforms/iziswap_scroll_base_trades.sql | 0 .../platforms/nuri_scroll_base_trades.sql | 0 .../scrollswap_scroll_base_trades.sql | 0 .../sushiswap_v2_scroll_base_trades.sql | 0 .../syncswap_v1_scroll_base_trades.sql | 0 .../uniswap_v3_scroll_base_trades.sql | 0 .../platforms/zebra_scroll_base_trades.sql | 0 .../models}/trades/zkevm/_schema.yml | 0 .../trades/zkevm/dex_zkevm_base_trades.sql | 0 .../balancer_v2_zkevm_base_trades.sql | 0 .../pancakeswap_v2_zkevm_base_trades.sql | 0 .../pancakeswap_v3_zkevm_base_trades.sql | 0 .../models}/trades/zksync/_schema.yml | 0 .../trades/zksync/dex_zksync_base_trades.sql | 0 .../derpdex_v1_zksync_base_trades.sql | 0 .../dracula_finance_zksync_base_trades.sql | 0 .../ezkalibur_v2_zksync_base_trades.sql | 0 .../platforms/gemswap_zksync_base_trades.sql | 0 .../iziswap_v1_zksync_base_trades.sql | 0 .../iziswap_v2_zksync_base_trades.sql | 0 .../platforms/maverick_zksync_base_trades.sql | 0 .../platforms/mute_zksync_base_trades.sql | 0 .../pancakeswap_v2_zksync_base_trades.sql | 0 .../pancakeswap_v3_zksync_base_trades.sql | 0 .../spacefi_v1_zksync_base_trades.sql | 0 .../syncswap_v1_zksync_base_trades.sql | 0 .../syncswap_v2_zksync_base_trades.sql | 0 .../uniswap_v3_zksync_base_trades.sql | 0 .../velocore_v0_zksync_base_trades.sql | 0 .../velocore_v1_zksync_base_trades.sql | 0 .../velocore_v2_zksync_base_trades.sql | 0 .../vesync_v1_zksync_base_trades.sql | 0 .../platforms/wagmi_v1_zksync_base_trades.sql | 0 .../zkswap_finance_zksync_base_trades.sql | 0 .../models}/trades/zora/_schema.yml | 0 .../trades/zora/dex_zora_base_trades.sql | 0 .../platforms/uniswap_v2_zora_base_trades.sql | 0 .../platforms/uniswap_v3_zora_base_trades.sql | 0 dex/package-lock.yml | 4 + dex/packages.yml | 3 + dex/profiles.yml | 12 + .../balancer/balancer_transfers_bpt_seed.csv | 0 .../seeds/_project}/zeroex/_schema.yml | 0 .../_project}/zeroex/arbitrum/_schema.yml | 0 ...roex_arbitrum_api_fills_deduped_sample.csv | 0 .../zeroex_arbitrum_api_fills_sample.csv | 0 .../zeroex_arbitrum_native_fills_sample.csv | 0 .../_project}/zeroex/avalanche_c/_schema.yml | 0 ...x_avalanche_c_api_fills_deduped_sample.csv | 0 .../zeroex_avalanche_c_api_fills_sample.csv | 0 .../seeds/_project}/zeroex/base/_schema.yml | 0 .../base/zeroex_base_api_fills_sample.csv | 0 .../seeds/_project}/zeroex/bnb/_schema.yml | 0 .../zeroex_bnb_api_fills_deduped_sample.csv | 0 .../bnb/zeroex_bnb_api_fills_sample.csv | 0 .../bnb/zeroex_bnb_native_fills_sample.csv | 0 .../seeds/_project}/zeroex/celo/_schema.yml | 0 .../zeroex_celo_api_fills_deduped_sample.csv | 0 .../celo/zeroex_celo_api_fills_sample.csv | 0 .../_project}/zeroex/ethereum/_schema.yml | 0 ...roex_ethereum_api_fills_deduped_sample.csv | 0 .../zeroex_ethereum_api_fills_sample.csv | 0 .../zeroex_ethereum_native_fills_sample.csv | 0 .../zeroex_ethereum_nft_fills_sample.csv | 0 .../seeds/_project}/zeroex/fantom/_schema.yml | 0 ...zeroex_fantom_api_fills_deduped_sample.csv | 0 .../fantom/zeroex_fantom_api_fills_sample.csv | 0 .../_project}/zeroex/optimism/_schema.yml | 0 ...roex_optimism_api_fills_deduped_sample.csv | 0 .../zeroex_optimism_api_fills_sample.csv | 0 .../_project}/zeroex/polygon/_schema.yml | 0 ...eroex_polygon_api_fills_deduped_sample.csv | 0 .../zeroex_polygon_api_fills_sample.csv | 0 .../zeroex_polygon_native_fills_sample.csv | 0 .../zeroex_polygon_nft_fills_sample.csv | 0 .../zeroex_api_fills_deduped_sample.csv | 0 .../zeroex/zeroex_api_fills_sample.csv | 0 .../zeroex/zeroex_native_fills_sample.csv | 0 .../seeds/aggregator_trades}/_schema.yml | 0 .../dex_aggregator_seed.csv | 0 {seeds/dex => dex/seeds}/pools/_schema.yml | 0 .../seeds}/pools/dex_pools_seed.csv | 0 .../dex => dex/seeds/trades}/_schema.yml | 0 .../aerodrome_base_base_trades_seed.csv | 0 .../airswap_arbitrum_base_trades_seed.csv | 0 .../airswap_avalanche_c_base_trades_seed.csv | 0 .../trades}/airswap_bnb_base_trades_seed.csv | 0 .../airswap_ethereum_base_trades_seed.csv | 0 .../airswap_polygon_base_trades_seed.csv | 0 .../alienbase_base_base_trades_seed.csv | 0 .../apeswap_arbitrum_base_trades_seed.csv | 0 .../trades}/apeswap_bnb_base_trades_seed.csv | 0 .../apeswap_ethereum_base_trades_seed.csv | 0 .../apeswap_polygon_base_trades_seed.csv | 0 .../arbswap_arbitrum_base_trades_seed.csv | 0 .../auragi_arbitrum_base_trades_seed.csv | 0 .../autotronic_base_base_trades_seed.csv | 0 .../trades}/babyswap_bnb_base_trades_seed.csv | 0 .../balancer_arbitrum_base_trades_seed.csv | 0 .../balancer_avalanche_c_base_trades_seed.csv | 0 .../balancer_base_base_trades_seed.csv | 0 .../balancer_ethereum_base_trades_seed.csv | 0 .../balancer_gnosis_base_trades_seed.csv | 0 .../balancer_optimism_base_trades_seed.csv | 0 .../balancer_polygon_base_trades_seed.csv | 0 .../balancer_zkevm_base_trades_seed.csv | 0 .../bancor_ethereum_base_trades_seed.csv | 0 .../baseswap_base_base_trades_seed.csv | 0 .../baseswap_basex_base_base_trades_seed.csv | 0 .../baso_finance_base_base_trades_seed.csv | 0 .../beethoven_x_fantom_base_trades_seed.csv | 0 .../beethoven_x_optimism_base_trades_seed.csv | 0 .../trades}/biswap_bnb_base_trades_seed.csv | 0 .../camelot_arbitrum_base_trades_seed.csv | 0 .../carbon_defi_ethereum_base_trades_seed.csv | 0 .../carbonhood_celo_base_trades_seed.csv | 0 .../chainhop_optimism_base_trades_seed.csv | 0 .../chronos_arbitrum_base_trades_seed.csv | 0 .../citadelswap_base_base_trades_seed.csv | 0 .../clipper_arbitrum_base_trades_seed.csv | 0 .../trades}/clipper_base_base_trades_seed.csv | 0 .../clipper_ethereum_base_trades_seed.csv | 0 .../clipper_optimism_base_trades_seed.csv | 0 .../clipper_polygon_base_trades_seed.csv | 0 .../crescentswap_base_base_trades_seed.csv | 0 .../curvefi_avalanche_c_base_trades_seed.csv | 0 .../trades}/curvefi_celo_base_trades_seed.csv | 0 .../curvefi_ethereum_base_trades_seed.csv | 0 .../curvefi_fantom_base_trades_seed.csv | 0 .../curvefi_optimism_base_trades_seed.csv | 0 .../dackieswap_base_base_trades_seed.csv | 0 ...ackieswap_v2_optimism_base_trades_seed.csv | 0 ...ackieswap_v3_optimism_base_trades_seed.csv | 0 .../defiswap_ethereum_base_trades_seed.csv | 0 .../trades}/derpdex_base_base_trades_seed.csv | 0 .../derpdex_zksync_base_trades_seed.csv | 0 .../trades}/dfx_ethereum_base_trades_seed.csv | 0 .../dodo_arbitrum_base_trades_seed.csv | 0 .../trades}/dodo_base_base_trades_seed.csv | 0 .../trades}/dodo_bnb_base_trades_seed.csv | 0 .../dodo_ethereum_base_trades_seed.csv | 0 .../dodo_optimism_base_trades_seed.csv | 0 .../trades}/dodo_polygon_base_trades_seed.csv | 0 .../dooar_polygon_base_trades_seed.csv | 0 ...racula_finance_zksync_base_trades_seed.csv | 0 .../echodex_linea_base_trades_seed.csv | 0 .../elk_finance_base_base_trades_seed.csv | 0 .../elk_finance_optimism_base_trades_seed.csv | 0 .../ellipsis_finance_bnb_base_trades_seed.csv | 0 .../trades}/energon_base_base_trades_seed.csv | 0 .../equalizer_fantom_base_trades_seed.csv | 0 .../ezkalibur_zksync_base_trades_seed.csv | 0 .../fraxswap_arbitrum_base_trades_seed.csv | 0 .../fraxswap_avalanche_c_base_trades_seed.csv | 0 .../trades}/fraxswap_bnb_base_trades_seed.csv | 0 .../fraxswap_ethereum_base_trades_seed.csv | 0 .../fraxswap_optimism_base_trades_seed.csv | 0 .../fraxswap_polygon_base_trades_seed.csv | 0 .../gemswap_zksync_base_trades_seed.csv | 0 .../glacier_avalanche_c_base_trades_seed.csv | 0 .../trades}/gmx_arbitrum_base_trades_seed.csv | 0 .../gmx_avalanche_c_base_trades_seed.csv | 0 .../gridex_arbitrum_base_trades_seed.csv | 0 .../trades}/gridex_base_base_trades_seed.csv | 0 .../gridex_optimism_base_trades_seed.csv | 0 .../hashflow_avalanche_c_base_trades_seed.csv | 0 .../trades}/hashflow_bnb_base_trades_seed.csv | 0 .../hashflow_ethereum_base_trades_seed.csv | 0 .../hashflow_optimism_base_trades_seed.csv | 0 .../honeyswap_gnosis_base_trades_seed.csv | 0 .../honeyswap_polygon_base_trades_seed.csv | 0 .../horizondex_base_base_trades_seed.csv | 0 .../icecreamswap_base_base_trades_seed.csv | 0 ...cecreamswap_v2_scroll_base_trades_seed.csv | 0 .../integral_arbitrum_base_trades_seed.csv | 0 .../integral_ethereum_base_trades_seed.csv | 0 .../trades}/iziswap_bnb_base_trades_seed.csv | 0 .../iziswap_scroll_base_trades_seed.csv | 0 .../iziswap_zksync_base_trades_seed.csv | 0 .../kyberswap_arbitrum_base_trades_seed.csv | 0 ...kyberswap_avalanche_c_base_trades_seed.csv | 0 .../kyberswap_base_base_trades_seed.csv | 0 .../kyberswap_bnb_base_trades_seed.csv | 0 .../kyberswap_ethereum_base_trades_seed.csv | 0 .../kyberswap_optimism_base_trades_seed.csv | 0 .../kyberswap_polygon_base_trades_seed.csv | 0 .../leetswap_v2_base_base_trades_seed.csv | 0 .../trades}/lynex_linea_base_trades_seed.csv | 0 .../mauve_ethereum_base_trades_seed.csv | 0 .../maverick_base_base_trades_seed.csv | 0 .../trades}/maverick_bnb_base_trades_seed.csv | 0 .../maverick_ethereum_base_trades_seed.csv | 0 .../maverick_zksync_base_trades_seed.csv | 0 .../trades}/mdex_bnb_base_trades_seed.csv | 0 .../trades}/mento_celo_base_trades_seed.csv | 0 .../moonbase_base_base_trades_seed.csv | 0 .../mstable_ethereum_base_trades_seed.csv | 0 ...ummy_finance_optimism_base_trades_seed.csv | 0 .../trades}/mute_zksync_base_trades_seed.csv | 0 .../trades}/nile_linea_base_trades_seed.csv | 0 .../trades}/nomiswap_bnb_base_trades_seed.csv | 0 .../trades}/nuri_scroll_base_trades_seed.csv | 0 .../oasisswap_arbitrum_base_trades_seed.csv | 0 .../oasisswap_base_base_trades_seed.csv | 0 .../oneinch_arbitrum_base_trades_seed.csv | 0 .../oneinch_avalanche_c_base_trades_seed.csv | 0 .../trades}/oneinch_base_base_trades_seed.csv | 0 .../trades}/oneinch_bnb_base_trades_seed.csv | 0 .../oneinch_ethereum_base_trades_seed.csv | 0 .../oneinch_fantom_base_trades_seed.csv | 0 .../oneinch_gnosis_base_trades_seed.csv | 0 .../oneinch_optimism_base_trades_seed.csv | 0 .../oneinch_polygon_base_trades_seed.csv | 0 .../oneinch_zksync_base_trades_seed.csv | 0 .../onepunchswap_bnb_base_trades_seed.csv | 0 ...openocean_avalanche_c_base_trades_seed.csv | 0 .../openocean_base_base_trades_seed.csv | 0 .../openocean_fantom_base_trades_seed.csv | 0 .../openocean_optimism_base_trades_seed.csv | 0 .../openxswap_optimism_base_trades_seed.csv | 0 .../opx_finance_optimism_base_trades_seed.csv | 0 .../pancakeswap_arbitrum_base_trades_seed.csv | 0 .../pancakeswap_base_base_trades_seed.csv | 0 .../pancakeswap_bnb_base_trades_seed.csv | 0 .../pancakeswap_ethereum_base_trades_seed.csv | 0 .../pancakeswap_linea_base_trades_seed.csv | 0 .../pancakeswap_zkevm_base_trades_seed.csv | 0 .../pancakeswap_zksync_base_trades_seed.csv | 0 .../pharaoh_avalanche_c_base_trades_seed.csv | 0 .../plantbaseswap_base_base_trades_seed.csv | 0 ...s_finance_avalanche_c_base_trades_seed.csv | 0 .../quickswap_polygon_base_trades_seed.csv | 0 .../ramses_arbitrum_base_trades_seed.csv | 0 .../rocketswap_base_base_trades_seed.csv | 0 .../rubicon_arbitrum_base_trades_seed.csv | 0 .../trades}/rubicon_base_base_trades_seed.csv | 0 .../rubicon_optimism_base_trades_seed.csv | 0 .../trades}/scale_base_base_trades_seed.csv | 0 .../scrollswap_scroll_base_trades_seed.csv | 0 .../trades}/secta_linea_base_trades_seed.csv | 0 .../sharkswap_base_base_trades_seed.csv | 0 .../sharkyswap_arbitrum_base_trades_seed.csv | 0 .../shibaswap_ethereum_base_trades_seed.csv | 0 .../smardex_arbitrum_base_trades_seed.csv | 0 .../trades}/smardex_base_base_trades_seed.csv | 0 .../trades}/sobal_base_base_trades_seed.csv | 0 .../solidlizard_arbitrum_base_trades_seed.csv | 0 .../trades}/solidly_base_base_trades_seed.csv | 0 .../solidly_v3_arbitrum_base_trades_seed.csv | 0 .../solidly_v3_base_base_trades_seed.csv | 0 .../solidly_v3_ethereum_base_trades_seed.csv | 0 .../solidly_v3_fantom_base_trades_seed.csv | 0 .../solidly_v3_optimism_base_trades_seed.csv | 0 .../trades}/soswap_base_base_trades_seed.csv | 0 .../spacefi_zksync_base_trades_seed.csv | 0 ...tacus_exchange_fantom_base_trades_seed.csv | 0 .../spiritswap_fantom_base_trades_seed.csv | 0 .../spookyswap_fantom_base_trades_seed.csv | 0 ...ling_finance_arbitrum_base_trades_seed.csv | 0 .../sushiswap_arbitrum_base_trades_seed.csv | 0 ...sushiswap_avalanche_c_base_trades_seed.csv | 0 .../sushiswap_base_base_trades_seed.csv | 0 .../sushiswap_bnb_base_trades_seed.csv | 0 .../sushiswap_celo_base_trades_seed.csv | 0 .../sushiswap_ethereum_base_trades_seed.csv | 0 .../sushiswap_fantom_base_trades_seed.csv | 0 .../sushiswap_gnosis_base_trades_seed.csv | 0 .../sushiswap_linea_base_trades_seed.csv | 0 .../sushiswap_optimism_base_trades_seed.csv | 0 .../sushiswap_polygon_base_trades_seed.csv | 0 .../sushiswap_scroll_base_trades_seed.csv | 0 .../swaap_v2_arbitrum_base_trades_seed.csv | 0 .../swapbased_base_base_trades_seed.csv | 0 .../swapr_ethereum_base_trades_seed.csv | 0 .../syncswap_scroll_base_trades_seed.csv | 0 .../syncswap_zksync_base_trades_seed.csv | 0 .../synthetix_optimism_base_trades_seed.csv | 0 .../synthswap_base_base_trades_seed.csv | 0 .../trades}/thena_bnb_base_trades_seed.csv | 0 ...rone_exchange_v2_base_base_trades_seed.csv | 0 ...rone_exchange_v3_base_base_trades_seed.csv | 0 .../trades}/torus_base_base_trades_seed.csv | 0 .../trader_joe_arbitrum_base_trades_seed.csv | 0 ...rader_joe_avalanche_c_base_trades_seed.csv | 0 .../trader_joe_bnb_base_trades_seed.csv | 0 .../trades}/ubeswap_celo_base_trades_seed.csv | 0 .../uniswap_arbitrum_base_trades_seed.csv | 0 .../uniswap_avalanche_c_base_trades_seed.csv | 0 .../trades}/uniswap_base_base_trades_seed.csv | 0 .../trades}/uniswap_bnb_base_trades_seed.csv | 0 .../trades}/uniswap_celo_base_trades_seed.csv | 0 .../uniswap_ethereum_base_trades_seed.csv | 0 .../uniswap_optimism_base_trades_seed.csv | 0 .../uniswap_polygon_base_trades_seed.csv | 0 .../uniswap_scroll_base_trades_seed.csv | 0 .../uniswap_zksync_base_trades_seed.csv | 0 .../trades}/uniswap_zora_base_trades_seed.csv | 0 .../velocimeter_v2_base_base_trades_seed.csv | 0 .../velocore_zksync_base_trades_seed.csv | 0 .../velodrome_optimism_base_trades_seed.csv | 0 .../verse_dex_ethereum_base_trades_seed.csv | 0 .../vesync_zksync_base_trades_seed.csv | 0 .../voltswap_base_base_trades_seed.csv | 0 .../trades}/wagmi_zksync_base_trades_seed.csv | 0 .../wardenswap_optimism_base_trades_seed.csv | 0 .../wigoswap_fantom_base_trades_seed.csv | 0 .../trades}/wombat_bnb_base_trades_seed.csv | 0 ...bat_exchange_arbitrum_base_trades_seed.csv | 0 .../wombat_exchange_base_base_trades_seed.csv | 0 ...bat_exchange_optimism_base_trades_seed.csv | 0 .../woofi_arbitrum_base_trades_seed.csv | 0 .../woofi_avalanche_c_base_trades_seed.csv | 0 .../trades}/woofi_base_base_trades_seed.csv | 0 .../trades}/woofi_bnb_base_trades_seed.csv | 0 .../woofi_optimism_base_trades_seed.csv | 0 .../xchange_arbitrum_base_trades_seed.csv | 0 .../trades}/xchange_bnb_base_trades_seed.csv | 0 .../xchange_ethereum_base_trades_seed.csv | 0 .../xchange_polygon_base_trades_seed.csv | 0 .../trades}/zebra_scroll_base_trades_seed.csv | 0 .../zigzag_arbitrum_base_trades_seed.csv | 0 .../zipswap_optimism_base_trades_seed.csv | 0 ...zkswap_finance_zksync_base_trades_seed.csv | 0 .../zyberswap_arbitrum_base_trades_seed.csv | 0 .../generic/check_dex_aggregator_seed.sql | 0 .../generic/check_dex_base_trades_seed.sql | 0 .../generic/check_dex_info_relationship.sql | 0 .../tests}/generic/check_dex_pools_seed.sql | 0 .../zeroex_ethereum_fills_deduped_test.sql | 0 .../generic}/zeroex_ethereum_fills_test.sql | 0 .../generic}/zeroex_ethereum_nft_test.sql | 0 .../balancer/balancer_bpt_prices_macro.sql | 2 +- .../balancer/balancer_bpt_supply_macro.sql | 2 +- .../balancer/balancer_liquidity_macro.sql | 4 +- ...lancer_pool_token_supply_changes_macro.sql | 2 +- .../balancer/balancer_protocol_fee_macro.sql | 4 +- ..._token_balance_changes_daily_agg_macro.sql | 2 +- .../balancer_token_balance_changes_macro.sql | 2 +- macros/models/_sector/add_amount_usd.sql | 2 +- .../balancer_v1_ethereum_liquidity.sql | 2 +- models/_project/balancer/pools/_schema.yml | 72 +- .../balancer/pools/arbitrum/_schema.yml | 64 +- .../balancer/pools/avalanche_c/_schema.yml | 64 +- .../pools/balancer_pools_metrics_daily.sql | 2 +- .../_project/balancer/pools/base/_schema.yml | 64 +- .../balancer/pools/ethereum/_schema.yml | 64 +- .../balancer/pools/gnosis/_schema.yml | 64 +- .../balancer/pools/optimism/_schema.yml | 67 +- .../balancer/pools/polygon/_schema.yml | 64 +- .../_project/balancer/pools/zkevm/_schema.yml | 64 +- models/_project/oneinch/_schema.yml | 47 ++ .../oneinch_ethereum_airdrop_claims.sql | 0 .../arbitrum/uniswap_arbitrum_schema.yml | 34 + .../uniswap_v3_arbitrum_flashloans.sql | 0 .../uniswap/bnb/uniswap_bnb_schema.yml | 34 + .../uniswap/bnb/uniswap_v3_bnb_flashloans.sql | 0 .../uniswap/celo/uniswap_celo_schema.yml | 34 + .../celo/uniswap_v3_celo_flashloans.sql | 19 +- .../uniswap_ethereum_airdrop_claims.sql | 2 +- .../ethereum/uniswap_ethereum_schema.yml | 195 +++++ .../uniswap_v3_ethereum_flashloans.sql | 0 .../uniswap_v3_ethereum_proposals.sql | 0 .../ethereum/uniswap_v3_ethereum_votes.sql | 0 .../optimism/uniswap_optimism_schema.yml | 34 + .../uniswap_v3_optimism_flashloans.sql | 0 .../polygon/uniswap_polygon_schema.yml | 34 + .../polygon/uniswap_v3_polygon_flashloans.sql | 0 .../uniswap/uniswap_flashloans.sql | 2 +- models/_project/uniswap/uniswap_schema.yml | 35 + .../platforms/geodnet_polygon_revenue.sql | 2 +- .../alchemydao_ethereum_airdrop_claims.sql | 4 +- .../beethoven_x_fantom_protocol_fee.sql | 2 +- .../fantom/beethoven_x_fantom_schema.yml | 49 -- .../camelot_arbitrum_pair_fee_rates.sql | 2 +- .../arbitrum/cow_protocol_arbitrum_schema.yml | 109 --- models/cow_protocol/cow_protocol_schema.yml | 88 +-- .../cow_protocol_ethereum_batches.sql | 2 +- .../cow_protocol_ethereum_referrals.sql | 2 +- .../ethereum/cow_protocol_ethereum_schema.yml | 285 +------ .../cow_protocol_ethereum_trade_slippage.sql | 2 +- .../gnosis/cow_protocol_gnosis_batches.sql | 2 +- .../gnosis/cow_protocol_gnosis_schema.yml | 160 +--- ...sh_labels_bluechip_investment_ethereum.sql | 4 +- ..._hash_labels_early_investment_ethereum.sql | 8 +- ..._tx_hash_labels_harvest_yield_ethereum.sql | 4 +- ...otocol_tx_hash_labels_offramp_ethereum.sql | 4 +- ...rotocol_tx_hash_labels_onramp_ethereum.sql | 4 +- ..._hash_labels_stable_to_stable_ethereum.sql | 4 +- ...bels_staking_token_investment_ethereum.sql | 4 +- ...sh_labels_treasury_management_ethereum.sql | 4 +- .../optimism/curvefi_optimism_schema.yml | 44 +- models/dao/balances/dao_balances.sql | 2 +- .../dao_transactions_arbitrum_erc20.sql | 2 +- .../dao_transactions_arbitrum_eth.sql | 2 +- .../base/dao_transactions_base_erc20.sql | 2 +- .../base/dao_transactions_base_eth.sql | 2 +- .../dao_transactions_ethereum_erc20.sql | 2 +- .../gnosis/dao_transactions_gnosis_erc20.sql | 2 +- .../dao_transactions_polygon_erc20.sql | 2 +- models/dex/arbitrum/_schema.yml | 24 - models/dex/base/_schema.yml | 23 - models/dex/bnb/_schema.yml | 24 - models/dex/dex_flashloans.sql | 2 +- models/dex/dex_schema.yml | 471 +----------- models/dex/ethereum/_schema.yml | 23 - models/dex/optimism/_schema.yml | 23 - models/dex/polygon/_schema.yml | 24 - .../bnb/ellipsis_finance_bnb_schema.yml | 46 -- .../gearbox_ethereum_airdrop_claims.sql | 4 +- .../arbitrum/gyroscope_arbitrum_trades.sql | 2 +- .../ethereum/gyroscope_ethereum_trades.sql | 2 +- .../optimism/gyroscope_optimism_trades.sql | 2 +- .../polygon/gyroscope_polygon_trades.sql | 2 +- .../ethereum/hashflow_ethereum_raw_trades.sql | 425 ----------- .../ethereum/hashflow_ethereum_schema.yml | 157 +--- .../ethereum/hashflow_ethereum_trades.sql | 80 -- .../immortalx/celo/immortalx_celo_schema.yml | 4 - .../keep3r_network_token_prices.sql | 6 +- .../balancer_v1/labels_balancer_v1_schema.yml | 68 -- .../labels_balancer_v2_gauges_arbitrum.sql | 6 +- .../labels_balancer_v2_gauges_avalanche_c.sql | 2 +- .../labels_balancer_v2_gauges_base.sql | 2 +- .../labels_balancer_v2_gauges_ethereum.sql | 4 +- .../labels_balancer_v2_gauges_gnosis.sql | 2 +- .../labels_balancer_v2_gauges_optimism.sql | 6 +- .../labels_balancer_v2_gauges_polygon.sql | 6 +- .../labels_balancer_v2_gauges_zkevm.sql | 2 +- .../balancer_v2/labels_balancer_v2_schema.yml | 278 +------ .../labels_op_chains_likely_bot_addresses.sql | 3 +- .../labels_op_chains_likely_bot_contracts.sql | 3 +- .../labels_arbitrage_traders_ethereum.sql | 8 +- .../labels_dex_aggregator_traders.sql | 2 +- .../persona/dex_pools/labels_dex_pools.sql | 2 +- .../dex_traders/labels_dex_traders.sql | 4 +- .../op_dex_traders/labels_op_dex_traders.sql | 2 +- .../labels_sandwich_attackers_ethereum.sql | 4 +- .../labels_smart_dex_traders_ethereum.sql | 6 +- .../labels_trader_platforms.sql | 4 +- .../labels_average_trade_values.sql | 4 +- .../usage/trader_age/labels_trader_age.sql | 4 +- .../labels_trader_dex_diversity.sql | 4 +- .../labels_trader_frequencies.sql | 4 +- .../usage/trader_kyt/labels_trader_kyt.sql | 6 +- models/labels/labels_addresses.sql | 6 +- models/paraswap/_schema.yml | 64 ++ .../paraswap_ethereum_airdrop_claims.sql | 4 +- models/pharaoh/pharaoh_avalanche_c_trades.sql | 122 --- .../ethereum/safe_ethereum_airdrop_claims.sql | 4 +- .../thales_ethereum_airdrop_claims.sql | 4 +- .../optimism/unidex_optimism_schema.yml | 133 +--- .../arbitrum/uniswap_arbitrum_schema.yml | 193 ----- .../arbitrum/uniswap_arbitrum_trades.sql | 45 -- .../arbitrum/uniswap_v3_arbitrum_trades.sql | 111 --- .../uniswap_avalanche_c_trades.sql | 44 -- .../uniswap_v3_avalanche_c_trades.sql | 106 --- models/uniswap/base/uniswap_base_trades.sql | 43 -- .../uniswap/base/uniswap_v3_base_trades.sql | 110 --- models/uniswap/bnb/uniswap_bnb_schema.yml | 193 ----- models/uniswap/bnb/uniswap_bnb_trades.sql | 44 -- models/uniswap/bnb/uniswap_v3_bnb_trades.sql | 111 --- models/uniswap/celo/uniswap_celo_schema.yml | 193 ----- models/uniswap/celo/uniswap_celo_trades.sql | 45 -- .../uniswap/celo/uniswap_v3_celo_trades.sql | 109 --- .../ethereum/uniswap_ethereum_schema.yml | 440 ----------- .../ethereum/uniswap_ethereum_trades.sql | 47 -- .../ethereum/uniswap_v1_ethereum_trades.sql | 134 ---- .../ethereum/uniswap_v2_ethereum_trades.sql | 116 --- .../ethereum/uniswap_v3_ethereum_trades.sql | 111 --- .../optimism/uniswap_optimism_schema.yml | 222 ------ .../optimism/uniswap_optimism_trades.sql | 45 -- .../optimism/uniswap_v3_optimism_trades.sql | 111 --- .../polygon/uniswap_polygon_schema.yml | 193 ----- .../polygon/uniswap_polygon_trades.sql | 45 -- .../polygon/uniswap_v3_polygon_trades.sql | 111 --- models/uniswap/uniswap_schema.yml | 112 --- .../value_defi_ethereum_airdrop_claims.sql | 4 +- .../velodrome_optimism_airdrop_claims.sql | 4 +- .../arbitrum/yield_yak_arbitrum_schema.yml | 98 +-- .../yield_yak_avalanche_c_schema.yml | 98 +-- .../mantle/yield_yak_mantle_schema.yml | 98 +-- models/yield_yak/yield_yak_schema.yml | 81 +- .../curvefi_ethereum_view_pools_postgres.csv | 299 -------- seeds/dex/trades/_schema.yml | 12 - seeds/dex/trades/dex_trades_seed.csv | 541 ------------- sources/_subprojects/dex/_sources.yml | 67 ++ sources/_subprojects/spellbook/_sources.yml | 37 +- .../cow_protocol_ethereum_assert_batches.sql | 16 - ...ow_protocol_ethereum_assert_order_type.sql | 37 - ..._protocol_ethereum_assert_partial_fill.sql | 37 - .../cow_protocol_ethereum_assert_slippage.sql | 17 - .../cow_protocol_ethereum_assert_solvers.sql | 21 - .../cow_protocol_ethereum_assert_trades.sql | 5 - .../cow_protocol_gnosis_assert_solvers.sql | 20 - tests/generic/check_dex_seed.sql | 12 - tests/generic/dex_trades_token_bought.sql | 24 - 1302 files changed, 3995 insertions(+), 8760 deletions(-) create mode 100644 .github/workflows/dex.yml create mode 100644 dex/README.md create mode 100644 dex/dbt_project.yml rename {macros/models/_sector/dex => dex/macros/models/_project}/airswap_compatible_trades.sql (100%) rename {macros/models/_sector/dex => dex/macros/models/_project}/balancer_compatible_trades.sql (100%) rename {macros/models/_sector/dex => dex/macros/models/_project}/clipper_compatible_trades.sql (100%) rename {macros/models/_sector/dex => dex/macros/models/_project}/dodo_compatible_trades.sql (100%) rename {macros/models/_sector/dex => dex/macros/models/_project}/kyberswap_compatible_trades.sql (100%) rename {macros/models/_sector/dex => dex/macros/models/_project}/maverick_compatible_trades.sql (100%) rename {macros/models/_sector/dex => dex/macros/models/_project}/openocean_compatible_trades.sql (100%) rename {macros/models/_sector/dex => dex/macros/models/_project}/trader_joe_compatible_trades.sql (100%) rename {macros/models/_sector/dex => dex/macros/models/_project}/uniswap_compatible_trades.sql (100%) rename {macros/models/_project/yield_yak => dex/macros/models/_project}/yield_yak_trades.sql (100%) rename {macros/models/_sector/dex => dex/macros/models}/dex_atomic_arbitrages.sql (100%) rename {macros/models/_sector/dex => dex/macros/models}/dex_sandwiched.sql (100%) rename {macros/models/_sector/dex => dex/macros/models}/dex_sandwiches.sql (100%) rename {macros/models/_sector/dex => dex/macros/models}/enrich_curve_dex_trades.sql (100%) rename {macros/models/_sector/dex => dex/macros/models}/enrich_dex_trades.sql (100%) rename {macros/models/_sector/dex => dex/macros/models}/generic_spot_compatible_trades.sql (100%) rename {models/_project => dex/models/_projects}/aerodrome/aerodrome_trades.sql (100%) rename {models/_project => dex/models/_projects}/airswap/airswap_trades.sql (100%) rename {models/_project => dex/models/_projects}/apeswap/apeswap_trades.sql (100%) rename {models/_project => dex/models/_projects}/arbswap/arbswap_trades.sql (100%) rename models/arrakis/arrakis_schema.yml => dex/models/_projects/arrakis/_schema.yml (100%) rename {models => dex/models/_projects}/arrakis/arrakis_uniswap_pools.sql (100%) rename models/arrakis/optimism/arrakis_optimism_schema.yml => dex/models/_projects/arrakis/optimism/_schema.yml (100%) rename {models => dex/models/_projects}/arrakis/optimism/arrakis_optimism_uniswap_pools.sql (100%) rename {models/_project => dex/models/_projects}/babyswap/babyswap_trades.sql (100%) create mode 100644 dex/models/_projects/balancer/labels/_schema.yml rename {models/labels/addresses/__single_category_labels__/balancer_v2 => dex/models/_projects/balancer/labels/arbitrum}/labels_balancer_v2_pools_arbitrum.sql (99%) rename {models/labels/addresses/__single_category_labels__/balancer_v2 => dex/models/_projects/balancer/labels/avalanche_c}/labels_balancer_v2_pools_avalanche_c.sql (99%) rename {models/labels/addresses/__single_category_labels__/balancer_v2 => dex/models/_projects/balancer/labels/base}/labels_balancer_v2_pools_base.sql (99%) rename {models/labels/addresses/__single_category_labels__/balancer_v1 => dex/models/_projects/balancer/labels/ethereum}/labels_balancer_v1_pools_ethereum.sql (99%) rename {models/labels/addresses/__single_category_labels__/balancer_v2 => dex/models/_projects/balancer/labels/ethereum}/labels_balancer_v2_pools_ethereum.sql (99%) rename {models/labels/addresses/__single_category_labels__/balancer_v2 => dex/models/_projects/balancer/labels/gnosis}/labels_balancer_v2_pools_gnosis.sql (99%) rename {models/labels/addresses/__single_category_labels__/balancer_v1 => dex/models/_projects/balancer/labels}/labels_balancer_v1_pools.sql (92%) rename {models/labels/addresses/__single_category_labels__/balancer_v2 => dex/models/_projects/balancer/labels}/labels_balancer_v2_pools.sql (91%) rename {models/labels/addresses/__single_category_labels__/balancer_v2 => dex/models/_projects/balancer/labels/optimism}/labels_balancer_v2_pools_optimism.sql (99%) rename {models/labels/addresses/__single_category_labels__/balancer_v2 => dex/models/_projects/balancer/labels/polygon}/labels_balancer_v2_pools_polygon.sql (99%) rename {models/labels/addresses/__single_category_labels__/balancer_v2 => dex/models/_projects/balancer/labels/zkevm}/labels_balancer_v2_pools_zkevm.sql (99%) create mode 100644 dex/models/_projects/balancer/pools/_schema.yml rename {models/_project => dex/models/_projects}/balancer/pools/arbitrum/balancer_v2_arbitrum_pools_fees.sql (100%) rename {models/_project => dex/models/_projects}/balancer/pools/avalanche_c/balancer_v2_avalanche_c_pools_fees.sql (100%) rename {models/_project => dex/models/_projects}/balancer/pools/balancer_pools_fees.sql (100%) rename {models/_project => dex/models/_projects}/balancer/pools/base/balancer_v2_base_pools_fees.sql (100%) rename {models/_project => dex/models/_projects}/balancer/pools/ethereum/balancer_v2_ethereum_pools_fees.sql (100%) rename {models/_project => dex/models/_projects}/balancer/pools/gnosis/balancer_v2_gnosis_pools_fees.sql (100%) rename {models/_project => dex/models/_projects}/balancer/pools/optimism/balancer_v2_optimism_pools_fees.sql (100%) rename {models/_project => dex/models/_projects}/balancer/pools/polygon/balancer_v2_polygon_pools_fees.sql (100%) rename {models/_project => dex/models/_projects}/balancer/pools/zkevm/balancer_v2_zkevm_pools_fees.sql (100%) rename {models/_project => dex/models/_projects}/balancer/trades/arbitrum/_schema.yml (97%) rename {models/_project => dex/models/_projects}/balancer/trades/arbitrum/balancer_arbitrum_trades.sql (100%) rename {models/_project => dex/models/_projects}/balancer/trades/arbitrum/balancer_v2_arbitrum_trades.sql (93%) rename {models/_project => dex/models/_projects}/balancer/trades/avalanche_c/_schema.yml (97%) rename {models/_project => dex/models/_projects}/balancer/trades/avalanche_c/balancer_avalanche_c_trades.sql (100%) rename {models/_project => dex/models/_projects}/balancer/trades/avalanche_c/balancer_v2_avalanche_c_trades.sql (93%) rename {models/_project => dex/models/_projects}/balancer/trades/balancer_trades.sql (100%) rename {models/_project => dex/models/_projects}/balancer/trades/base/_schema.yml (97%) rename {models/_project => dex/models/_projects}/balancer/trades/base/balancer_base_trades.sql (100%) rename {models/_project => dex/models/_projects}/balancer/trades/base/balancer_v2_base_trades.sql (93%) rename {models/_project => dex/models/_projects}/balancer/trades/ethereum/_schema.yml (97%) rename {models/_project => dex/models/_projects}/balancer/trades/ethereum/balancer_ethereum_trades.sql (100%) rename {models/_project => dex/models/_projects}/balancer/trades/ethereum/balancer_v1_ethereum_trades.sql (100%) rename {models/_project => dex/models/_projects}/balancer/trades/ethereum/balancer_v2_ethereum_trades.sql (93%) rename {models/_project => dex/models/_projects}/balancer/trades/gnosis/_schema.yml (97%) rename {models/_project => dex/models/_projects}/balancer/trades/gnosis/balancer_gnosis_trades.sql (100%) rename {models/_project => dex/models/_projects}/balancer/trades/gnosis/balancer_v2_gnosis_trades.sql (93%) rename {models/_project => dex/models/_projects}/balancer/trades/optimism/_schema.yml (97%) rename {models/_project => dex/models/_projects}/balancer/trades/optimism/balancer_optimism_trades.sql (100%) rename {models/_project => dex/models/_projects}/balancer/trades/optimism/balancer_v2_optimism_trades.sql (93%) rename {models/_project => dex/models/_projects}/balancer/trades/polygon/_schema.yml (97%) rename {models/_project => dex/models/_projects}/balancer/trades/polygon/balancer_polygon_trades.sql (100%) rename {models/_project => dex/models/_projects}/balancer/trades/polygon/balancer_v2_polygon_trades.sql (93%) rename {models/_project => dex/models/_projects}/balancer/trades/zkevm/_schema.yml (97%) rename {models/_project => dex/models/_projects}/balancer/trades/zkevm/balancer_v2_zkevm_trades.sql (93%) rename {models/_project => dex/models/_projects}/balancer/trades/zkevm/balancer_zkevm_trades.sql (100%) rename {models/_project => dex/models/_projects}/bancor/bancor_trades.sql (100%) rename models/bebop/bebop_trades_schema.yml => dex/models/_projects/bebop/_schema.yml (100%) rename models/bebop/arbitrum/bebop_arbitrum_schema.yml => dex/models/_projects/bebop/arbitrum/_schema.yml (100%) rename {models => dex/models/_projects}/bebop/arbitrum/bebop_arbitrum_trades.sql (100%) rename {models => dex/models/_projects}/bebop/arbitrum/bebop_blend_arbitrum_trades.sql (100%) rename {models => dex/models/_projects}/bebop/arbitrum/bebop_jam_arbitrum_trades.sql (100%) rename {models => dex/models/_projects}/bebop/arbitrum/bebop_rfq_arbitrum_trades.sql (100%) rename models/bebop/base/bebop_base_schema.yml => dex/models/_projects/bebop/base/_schema.yml (100%) rename {models => dex/models/_projects}/bebop/base/bebop_base_trades.sql (100%) rename {models => dex/models/_projects}/bebop/base/bebop_blend_base_trades.sql (100%) rename {models => dex/models/_projects}/bebop/base/bebop_jam_base_trades.sql (100%) rename {models => dex/models/_projects}/bebop/bebop_trades.sql (100%) rename models/bebop/bnb/bebop_bnb_schema.yml => dex/models/_projects/bebop/bnb/_schema.yml (100%) rename {models => dex/models/_projects}/bebop/bnb/bebop_bnb_trades.sql (100%) rename {models => dex/models/_projects}/bebop/bnb/bebop_jam_bnb_trades.sql (100%) rename models/bebop/ethereum/bebop_ethereum_schema.yml => dex/models/_projects/bebop/ethereum/_schema.yml (100%) rename {models => dex/models/_projects}/bebop/ethereum/bebop_blend_ethereum_trades.sql (100%) rename {models => dex/models/_projects}/bebop/ethereum/bebop_ethereum_trades.sql (100%) rename {models => dex/models/_projects}/bebop/ethereum/bebop_jam_ethereum_trades.sql (100%) rename {models => dex/models/_projects}/bebop/ethereum/bebop_rfq_ethereum_trades.sql (100%) rename models/bebop/optimism/bebop_optimism_schema.yml => dex/models/_projects/bebop/optimism/_schema.yml (100%) rename {models => dex/models/_projects}/bebop/optimism/bebop_jam_optimism_trades.sql (100%) rename {models => dex/models/_projects}/bebop/optimism/bebop_optimism_trades.sql (100%) rename {models => dex/models/_projects}/bebop/optimism/bebop_rfq_optimism_trades.sql (100%) rename models/bebop/polygon/bebop_polygon_schema.yml => dex/models/_projects/bebop/polygon/_schema.yml (100%) rename {models => dex/models/_projects}/bebop/polygon/bebop_blend_polygon_trades.sql (100%) rename {models => dex/models/_projects}/bebop/polygon/bebop_jam_polygon_trades.sql (100%) rename {models => dex/models/_projects}/bebop/polygon/bebop_polygon_trades.sql (100%) rename {models => dex/models/_projects}/bebop/polygon/bebop_rfq_polygon_trades.sql (100%) rename models/bebop/scroll/bebop_scroll_schema.yml => dex/models/_projects/bebop/scroll/_schema.yml (100%) rename {models => dex/models/_projects}/bebop/scroll/bebop_jam_scroll_trades.sql (100%) rename {models => dex/models/_projects}/bebop/scroll/bebop_scroll_trades.sql (100%) rename models/bebop/zksync/bebop_zksync_schema.yml => dex/models/_projects/bebop/zksync/_schema.yml (100%) rename {models => dex/models/_projects}/bebop/zksync/bebop_jam_zksync_trades.sql (100%) rename {models => dex/models/_projects}/bebop/zksync/bebop_zksync_trades.sql (100%) create mode 100644 dex/models/_projects/beethoven_x/_schema.yml rename {models/beethoven_x/fantom => dex/models/_projects/beethoven_x}/beethoven_x_fantom_pools_fees.sql (100%) rename {models/_project => dex/models/_projects}/beethoven_x/beethoven_x_trades.sql (100%) rename {models/_project => dex/models/_projects}/biswap/biswap_trades.sql (100%) rename {models/_project => dex/models/_projects}/camelot/camelot_trades.sql (100%) rename {models/_project => dex/models/_projects}/carbon_defi/carbon_defi_trades.sql (100%) rename {models/_project => dex/models/_projects}/clipper/clipper_trades.sql (100%) create mode 100644 dex/models/_projects/cow_protocol/_schema.yml rename {models => dex/models/_projects}/cow_protocol/arbitrum/cow_protocol_arbitrum_trades.sql (100%) rename {models => dex/models/_projects}/cow_protocol/cow_protocol_trades.sql (98%) rename {models => dex/models/_projects}/cow_protocol/ethereum/cow_protocol_ethereum_trades.sql (94%) rename {models => dex/models/_projects}/cow_protocol/gnosis/cow_protocol_gnosis_trades.sql (99%) rename models/curvefi/celo/curvefi_celo_schema.yml => dex/models/_projects/curvefi/celo/_schema.yml (100%) rename {models => dex/models/_projects}/curvefi/celo/curvefi_celo_pools.sql (100%) rename {models/_project => dex/models/_projects}/curvefi/curvefi_trades.sql (100%) rename models/curvefi/ethereum/curvefi_ethereum_schema.yml => dex/models/_projects/curvefi/ethereum/_schema.yml (100%) rename {models => dex/models/_projects}/curvefi/ethereum/curvefi_ethereum_pool_details.sql (99%) rename {models => dex/models/_projects}/curvefi/ethereum/curvefi_ethereum_view_pools.sql (99%) rename models/curvefi/fantom/curvefi_fantom_schema.yml => dex/models/_projects/curvefi/fantom/_schema.yml (100%) rename {models => dex/models/_projects}/curvefi/fantom/curvefi_fantom_pool_tokens.sql (99%) create mode 100644 dex/models/_projects/curvefi/optimism/_schema.yml rename {models => dex/models/_projects}/curvefi/optimism/curvefi_optimism_pools.sql (99%) rename {models => dex/models/_projects}/curvefi/readme.md (100%) rename {models/_project => dex/models/_projects}/defiswap/defiswap_trades.sql (100%) rename models/_project/_schema.yml => dex/models/_projects/dex_trades_views_schema.yml (99%) rename {models/_project => dex/models/_projects}/dfx/dfx_trades.sql (100%) rename models/dodo/dodo_trades_schema.yml => dex/models/_projects/dodo/_schema.yml (100%) rename models/dodo/arbitrum/dodo_arbitrum_schema.yml => dex/models/_projects/dodo/arbitrum/_schema.yml (100%) rename {models => dex/models/_projects}/dodo/arbitrum/dodo_aggregator_arbitrum_trades.sql (99%) rename models/dodo/base/dodo_base_schema.yml => dex/models/_projects/dodo/base/_schema.yml (100%) rename {models => dex/models/_projects}/dodo/base/dodo_aggregator_base_trades.sql (99%) rename models/dodo/bnb/dodo_bnb_schema.yml => dex/models/_projects/dodo/bnb/_schema.yml (100%) rename {models => dex/models/_projects}/dodo/bnb/dodo_aggregator_bnb_trades.sql (99%) rename {models => dex/models/_projects}/dodo/dodo_aggregator_trades.sql (79%) rename {models/_project => dex/models/_projects}/dodo/dodo_trades.sql (100%) rename models/dodo/ethereum/dodo_ethereum_schema.yml => dex/models/_projects/dodo/ethereum/_schema.yml (100%) rename {models => dex/models/_projects}/dodo/ethereum/dodo_aggregator_ethereum_trades.sql (99%) rename models/dodo/optimism/dodo_optimism_schema.yml => dex/models/_projects/dodo/optimism/_schema.yml (100%) rename {models => dex/models/_projects}/dodo/optimism/dodo_aggregator_optimism_trades.sql (99%) rename models/dodo/polygon/dodo_polygon_schema.yml => dex/models/_projects/dodo/polygon/_schema.yml (100%) rename {models => dex/models/_projects}/dodo/polygon/dodo_aggregator_polygon_trades.sql (99%) create mode 100644 dex/models/_projects/ellipsis_finance/_schema.yml rename {models/ellipsis_finance/bnb => dex/models/_projects/ellipsis_finance}/ellipsis_finance_bnb_pool_tokens.sql (100%) rename {models/_project => dex/models/_projects}/ellipsis_finance/ellipsis_finance_trades.sql (100%) rename {models/_project => dex/models/_projects}/equalizer/equalizer_trades.sql (100%) rename models/equalizer/fantom/equalizer_fantom_schema.yml => dex/models/_projects/equalizer/fantom/_schema.yml (100%) rename {models => dex/models/_projects}/equalizer/fantom/equalizer_fantom_pools.sql (100%) rename models/firebird_finance/optimism/firebird_finance_optimism_schema.yml => dex/models/_projects/firebird_finance/optimism/_schema.yml (100%) rename {models => dex/models/_projects}/firebird_finance/optimism/firebird_finance_optimism_trades.sql (100%) rename {models/_project => dex/models/_projects}/fraxswap/fraxswap_trades.sql (100%) rename models/gamma/gamma_schema.yml => dex/models/_projects/gamma/_schema.yml (100%) rename {models => dex/models/_projects}/gamma/gamma_uniswap_pools.sql (100%) rename models/gamma/optimism/gamma_optimism_schema.yml => dex/models/_projects/gamma/optimism/_schema.yml (100%) rename {models => dex/models/_projects}/gamma/optimism/gamma_optimism_uniswap_pools.sql (100%) rename {models/_project => dex/models/_projects}/glacier/glacier_trades.sql (100%) rename {models/_project => dex/models/_projects}/gmx/gmx_trades.sql (100%) rename {models/_project => dex/models/_projects}/hashflow/hashflow_trades.sql (100%) rename {models/_project => dex/models/_projects}/honeyswap/honeyswap_trades.sql (100%) rename {models/_project => dex/models/_projects}/integral/integral_trades.sql (100%) rename {models/_project => dex/models/_projects}/iziswap/iziswap_trades.sql (100%) rename models/kyberswap/kyberswap_trades_schema.yml => dex/models/_projects/kyberswap/_schema.yml (100%) rename models/kyberswap/arbitrum/kyberswap_arbitrum_schema.yml => dex/models/_projects/kyberswap/arbitrum/_schema.yml (100%) rename {models => dex/models/_projects}/kyberswap/arbitrum/kyberswap_aggregator_arbitrum_trades.sql (100%) rename models/kyberswap/avalanche_c/kyberswap_avalanche_c_schema.yml => dex/models/_projects/kyberswap/avalanche_c/_schema.yml (100%) rename {models => dex/models/_projects}/kyberswap/avalanche_c/kyberswap_aggregator_avalanche_c_trades.sql (100%) rename models/kyberswap/base/kyberswap_base_schema.yml => dex/models/_projects/kyberswap/base/_schema.yml (100%) rename {models => dex/models/_projects}/kyberswap/base/kyberswap_aggregator_base_trades.sql (100%) rename models/kyberswap/bnb/kyberswap_bnb_schema.yml => dex/models/_projects/kyberswap/bnb/_schema.yml (100%) rename {models => dex/models/_projects}/kyberswap/bnb/kyberswap_aggregator_bnb_trades.sql (100%) rename models/kyberswap/ethereum/kyberswap_ethereum_schema.yml => dex/models/_projects/kyberswap/ethereum/_schema.yml (100%) rename {models => dex/models/_projects}/kyberswap/ethereum/kyberswap_aggregator_ethereum_trades.sql (100%) rename {models => dex/models/_projects}/kyberswap/kyberswap_aggregator_trades.sql (100%) rename {models/_project => dex/models/_projects}/kyberswap/kyberswap_trades.sql (100%) rename models/kyberswap/optimism/kyberswap_optimism_schema.yml => dex/models/_projects/kyberswap/optimism/_schema.yml (100%) rename {models => dex/models/_projects}/kyberswap/optimism/kyberswap_aggregator_optimism_trades.sql (100%) rename models/kyberswap/polygon/kyberswap_polygon_schema.yml => dex/models/_projects/kyberswap/polygon/_schema.yml (100%) rename {models => dex/models/_projects}/kyberswap/polygon/kyberswap_aggregator_polygon_trades.sql (100%) rename models/lifi/lifi_trades_schema.yml => dex/models/_projects/lifi/_schema.yml (100%) rename models/lifi/fantom/lifi_fantom_schema.yml => dex/models/_projects/lifi/fantom/_schema.yml (100%) rename {models => dex/models/_projects}/lifi/fantom/lifi_fantom_trades.sql (96%) rename {models => dex/models/_projects}/lifi/fantom/lifi_v2_fantom_trades.sql (100%) rename {models => dex/models/_projects}/lifi/lifi_trades.sql (97%) rename models/lifi/optimism/lifi_optimism_schema.yml => dex/models/_projects/lifi/optimism/_schema.yml (100%) rename {models => dex/models/_projects}/lifi/optimism/lifi_optimism_trades.sql (96%) rename {models => dex/models/_projects}/lifi/optimism/lifi_v2_optimism_trades.sql (100%) rename {models/_project => dex/models/_projects}/mauve/mauve_trades.sql (100%) rename {models/_project => dex/models/_projects}/maverick/maverick_trades.sql (100%) rename {models/_project => dex/models/_projects}/mdex/mdex_trades.sql (100%) rename models/mento/celo/mento_celo_schema.yml => dex/models/_projects/mento/celo/_schema.yml (100%) rename {models => dex/models/_projects}/mento/celo/mento_celo_pools.sql (100%) rename {models => dex/models/_projects}/mento/celo/mento_v1_celo_pools.sql (100%) rename {models => dex/models/_projects}/mento/celo/mento_v2_celo_pools.sql (100%) rename {models/_project => dex/models/_projects}/mstable/mstable_trades.sql (100%) rename {models/_project => dex/models/_projects}/mummy_finance/mummy_finance_trades.sql (100%) rename {models/_project => dex/models/_projects}/nomiswap/nomiswap_trades.sql (100%) rename models/odos/odos_trades_schema.yml => dex/models/_projects/odos/_schema.yml (100%) rename models/odos/avalanche_c/odos_avalanche_c_schema.yml => dex/models/_projects/odos/avalanche_c/_schema.yml (100%) rename {models => dex/models/_projects}/odos/avalanche_c/odos_avalanche_c_trades.sql (99%) rename models/odos/base/odos_base_schema.yml => dex/models/_projects/odos/base/_schema.yml (100%) rename {models => dex/models/_projects}/odos/base/odos_base_trades.sql (100%) rename {models => dex/models/_projects}/odos/base/odos_v2_base_trades.sql (100%) rename models/odos/ethereum/odos_ethereum_schema.yml => dex/models/_projects/odos/ethereum/_schema.yml (100%) rename {models => dex/models/_projects}/odos/ethereum/odos_ethereum_trades.sql (100%) rename {models => dex/models/_projects}/odos/ethereum/odos_v2_ethereum_trades.sql (100%) rename {models => dex/models/_projects}/odos/odos_trades.sql (97%) rename models/odos/optimism/odos_optimism_schema.yml => dex/models/_projects/odos/optimism/_schema.yml (100%) rename {models => dex/models/_projects}/odos/optimism/odos_optimism_trades.sql (100%) rename {models => dex/models/_projects}/odos/optimism/odos_v1_optimism_trades.sql (100%) rename {models => dex/models/_projects}/odos/optimism/odos_v2_optimism_trades.sql (100%) rename {models => dex/models/_projects}/oneinch/_meta/oneinch_blockchains.sql (100%) rename {models => dex/models/_projects}/oneinch/_meta/oneinch_fusion_accounts.sql (100%) rename {models => dex/models/_projects}/oneinch/_meta/oneinch_fusion_executors.sql (100%) rename {models => dex/models/_projects}/oneinch/_meta/oneinch_fusion_farms.sql (100%) rename {models => dex/models/_projects}/oneinch/_meta/oneinch_fusion_resolvers.sql (100%) rename {models => dex/models/_projects}/oneinch/_meta/oneinch_mapped_contracts.sql (100%) rename {models => dex/models/_projects}/oneinch/_meta/oneinch_mapped_methods.sql (100%) rename models/oneinch/oneinch_schema.yml => dex/models/_projects/oneinch/_schema.yml (100%) rename {models => dex/models/_projects}/oneinch/arbitrum/_meta/oneinch_arbitrum_mapped_contracts.sql (100%) rename {models => dex/models/_projects}/oneinch/arbitrum/_meta/oneinch_arbitrum_mapped_methods.sql (100%) rename {models => dex/models/_projects}/oneinch/arbitrum/oneinch_arbitrum_ar.sql (100%) rename {models => dex/models/_projects}/oneinch/arbitrum/oneinch_arbitrum_call_transfers.sql (100%) rename {models => dex/models/_projects}/oneinch/arbitrum/oneinch_arbitrum_lop.sql (100%) rename {models => dex/models/_projects}/oneinch/arbitrum/oneinch_arbitrum_project_calls.sql (100%) rename {models => dex/models/_projects}/oneinch/arbitrum/oneinch_arbitrum_project_orders.sql (100%) rename {models => dex/models/_projects}/oneinch/arbitrum/oneinch_arbitrum_project_swaps.sql (100%) rename {models => dex/models/_projects}/oneinch/arbitrum/oneinch_arbitrum_schema.yml (100%) rename {models => dex/models/_projects}/oneinch/avalanche_c/_meta/oneinch_avalanche_c_mapped_contracts.sql (100%) rename {models => dex/models/_projects}/oneinch/avalanche_c/_meta/oneinch_avalanche_c_mapped_methods.sql (100%) rename {models => dex/models/_projects}/oneinch/avalanche_c/oneinch_avalanche_c_ar.sql (100%) rename {models => dex/models/_projects}/oneinch/avalanche_c/oneinch_avalanche_c_call_transfers.sql (100%) rename {models => dex/models/_projects}/oneinch/avalanche_c/oneinch_avalanche_c_lop.sql (100%) rename {models => dex/models/_projects}/oneinch/avalanche_c/oneinch_avalanche_c_project_calls.sql (100%) rename {models => dex/models/_projects}/oneinch/avalanche_c/oneinch_avalanche_c_project_orders.sql (100%) rename {models => dex/models/_projects}/oneinch/avalanche_c/oneinch_avalanche_c_project_swaps.sql (100%) rename {models => dex/models/_projects}/oneinch/avalanche_c/oneinch_avalanche_c_schema.yml (100%) rename {models => dex/models/_projects}/oneinch/base/_meta/oneinch_base_mapped_contracts.sql (100%) rename {models => dex/models/_projects}/oneinch/base/_meta/oneinch_base_mapped_methods.sql (100%) rename {models => dex/models/_projects}/oneinch/base/oneinch_base_ar.sql (100%) rename {models => dex/models/_projects}/oneinch/base/oneinch_base_call_transfers.sql (100%) rename {models => dex/models/_projects}/oneinch/base/oneinch_base_lop.sql (100%) rename {models => dex/models/_projects}/oneinch/base/oneinch_base_project_calls.sql (100%) rename {models => dex/models/_projects}/oneinch/base/oneinch_base_project_orders.sql (100%) rename {models => dex/models/_projects}/oneinch/base/oneinch_base_project_swaps.sql (100%) rename {models => dex/models/_projects}/oneinch/base/oneinch_base_schema.yml (100%) rename {models => dex/models/_projects}/oneinch/bnb/_meta/oneinch_bnb_mapped_contracts.sql (100%) rename {models => dex/models/_projects}/oneinch/bnb/_meta/oneinch_bnb_mapped_methods.sql (100%) rename {models => dex/models/_projects}/oneinch/bnb/oneinch_bnb_ar.sql (100%) rename {models => dex/models/_projects}/oneinch/bnb/oneinch_bnb_call_transfers.sql (100%) rename {models => dex/models/_projects}/oneinch/bnb/oneinch_bnb_lop.sql (100%) rename {models => dex/models/_projects}/oneinch/bnb/oneinch_bnb_project_calls.sql (100%) rename {models => dex/models/_projects}/oneinch/bnb/oneinch_bnb_project_orders.sql (100%) rename {models => dex/models/_projects}/oneinch/bnb/oneinch_bnb_project_swaps.sql (100%) rename {models => dex/models/_projects}/oneinch/bnb/oneinch_bnb_schema.yml (100%) rename {models => dex/models/_projects}/oneinch/ethereum/_meta/oneinch_ethereum_mapped_contracts.sql (100%) rename {models => dex/models/_projects}/oneinch/ethereum/_meta/oneinch_ethereum_mapped_methods.sql (100%) rename {models => dex/models/_projects}/oneinch/ethereum/oneinch_ethereum_ar.sql (100%) rename {models => dex/models/_projects}/oneinch/ethereum/oneinch_ethereum_call_transfers.sql (100%) rename {models => dex/models/_projects}/oneinch/ethereum/oneinch_ethereum_lop.sql (100%) rename {models => dex/models/_projects}/oneinch/ethereum/oneinch_ethereum_project_calls.sql (100%) rename {models => dex/models/_projects}/oneinch/ethereum/oneinch_ethereum_project_orders.sql (100%) rename {models => dex/models/_projects}/oneinch/ethereum/oneinch_ethereum_project_swaps.sql (100%) rename {models => dex/models/_projects}/oneinch/ethereum/oneinch_ethereum_schema.yml (73%) rename {models => dex/models/_projects}/oneinch/fantom/_meta/oneinch_fantom_mapped_contracts.sql (100%) rename {models => dex/models/_projects}/oneinch/fantom/_meta/oneinch_fantom_mapped_methods.sql (100%) rename {models => dex/models/_projects}/oneinch/fantom/oneinch_fantom_ar.sql (100%) rename {models => dex/models/_projects}/oneinch/fantom/oneinch_fantom_call_transfers.sql (100%) rename {models => dex/models/_projects}/oneinch/fantom/oneinch_fantom_lop.sql (100%) rename {models => dex/models/_projects}/oneinch/fantom/oneinch_fantom_project_calls.sql (100%) rename {models => dex/models/_projects}/oneinch/fantom/oneinch_fantom_project_orders.sql (100%) rename {models => dex/models/_projects}/oneinch/fantom/oneinch_fantom_project_swaps.sql (100%) rename {models => dex/models/_projects}/oneinch/fantom/oneinch_fantom_schema.yml (100%) rename {models => dex/models/_projects}/oneinch/gnosis/_meta/oneinch_gnosis_mapped_contracts.sql (100%) rename {models => dex/models/_projects}/oneinch/gnosis/_meta/oneinch_gnosis_mapped_methods.sql (100%) rename {models => dex/models/_projects}/oneinch/gnosis/oneinch_gnosis_ar.sql (100%) rename {models => dex/models/_projects}/oneinch/gnosis/oneinch_gnosis_call_transfers.sql (100%) rename {models => dex/models/_projects}/oneinch/gnosis/oneinch_gnosis_lop.sql (100%) rename {models => dex/models/_projects}/oneinch/gnosis/oneinch_gnosis_project_calls.sql (100%) rename {models => dex/models/_projects}/oneinch/gnosis/oneinch_gnosis_project_orders.sql (100%) rename {models => dex/models/_projects}/oneinch/gnosis/oneinch_gnosis_project_swaps.sql (100%) rename {models => dex/models/_projects}/oneinch/gnosis/oneinch_gnosis_schema.yml (100%) rename {models => dex/models/_projects}/oneinch/oneinch_ar.sql (100%) rename {models => dex/models/_projects}/oneinch/oneinch_ar_trades.sql (100%) rename {models => dex/models/_projects}/oneinch/oneinch_call_transfers.sql (100%) rename {models => dex/models/_projects}/oneinch/oneinch_calls.sql (100%) rename {models => dex/models/_projects}/oneinch/oneinch_lop.sql (100%) rename {models => dex/models/_projects}/oneinch/oneinch_lop_own_trades.sql (100%) rename {models => dex/models/_projects}/oneinch/oneinch_parsed_transfers_from_calls.sql (100%) rename {models => dex/models/_projects}/oneinch/oneinch_project_orders.sql (100%) rename {models => dex/models/_projects}/oneinch/oneinch_project_swaps.sql (100%) rename {models => dex/models/_projects}/oneinch/oneinch_swaps.sql (100%) rename {models => dex/models/_projects}/oneinch/optimism/_meta/oneinch_optimism_mapped_contracts.sql (100%) rename {models => dex/models/_projects}/oneinch/optimism/_meta/oneinch_optimism_mapped_methods.sql (100%) rename {models => dex/models/_projects}/oneinch/optimism/oneinch_optimism_ar.sql (100%) rename {models => dex/models/_projects}/oneinch/optimism/oneinch_optimism_call_transfers.sql (100%) rename {models => dex/models/_projects}/oneinch/optimism/oneinch_optimism_lop.sql (100%) rename {models => dex/models/_projects}/oneinch/optimism/oneinch_optimism_project_calls.sql (100%) rename {models => dex/models/_projects}/oneinch/optimism/oneinch_optimism_project_orders.sql (100%) rename {models => dex/models/_projects}/oneinch/optimism/oneinch_optimism_project_swaps.sql (100%) rename {models => dex/models/_projects}/oneinch/optimism/oneinch_optimism_schema.yml (100%) rename {models => dex/models/_projects}/oneinch/polygon/_meta/oneinch_polygon_mapped_contracts.sql (100%) rename {models => dex/models/_projects}/oneinch/polygon/_meta/oneinch_polygon_mapped_methods.sql (100%) rename {models => dex/models/_projects}/oneinch/polygon/oneinch_polygon_ar.sql (100%) rename {models => dex/models/_projects}/oneinch/polygon/oneinch_polygon_call_transfers.sql (100%) rename {models => dex/models/_projects}/oneinch/polygon/oneinch_polygon_lop.sql (100%) rename {models => dex/models/_projects}/oneinch/polygon/oneinch_polygon_project_calls.sql (100%) rename {models => dex/models/_projects}/oneinch/polygon/oneinch_polygon_project_orders.sql (100%) rename {models => dex/models/_projects}/oneinch/polygon/oneinch_polygon_project_swaps.sql (100%) rename {models => dex/models/_projects}/oneinch/polygon/oneinch_polygon_schema.yml (100%) rename {models => dex/models/_projects}/oneinch/zksync/_meta/oneinch_zksync_mapped_contracts.sql (100%) rename {models => dex/models/_projects}/oneinch/zksync/_meta/oneinch_zksync_mapped_methods.sql (100%) rename {models => dex/models/_projects}/oneinch/zksync/oneinch_zksync_ar.sql (100%) rename {models => dex/models/_projects}/oneinch/zksync/oneinch_zksync_call_transfers.sql (100%) rename {models => dex/models/_projects}/oneinch/zksync/oneinch_zksync_lop.sql (100%) rename {models => dex/models/_projects}/oneinch/zksync/oneinch_zksync_project_calls.sql (100%) rename {models => dex/models/_projects}/oneinch/zksync/oneinch_zksync_project_orders.sql (100%) rename {models => dex/models/_projects}/oneinch/zksync/oneinch_zksync_project_swaps.sql (100%) rename {models => dex/models/_projects}/oneinch/zksync/oneinch_zksync_schema.yml (100%) rename {models/_project => dex/models/_projects}/onepunchswap/onepunchswap_trades.sql (100%) rename {models/_project => dex/models/_projects}/openocean/openocean_trades.sql (100%) rename {models/_project => dex/models/_projects}/openxswap/openxswap_trades.sql (100%) rename {models/_project => dex/models/_projects}/opx_finance/opx_finance_trades.sql (100%) rename {models/_project => dex/models/_projects}/pancakeswap/pancakeswap_trades.sql (100%) rename models/paraswap/paraswap_trades_schema.yml => dex/models/_projects/paraswap/_schema.yml (100%) rename models/paraswap/arbitrum/paraswap_arbitrum_schema.yml => dex/models/_projects/paraswap/arbitrum/_schema.yml (100%) rename {models => dex/models/_projects}/paraswap/arbitrum/paraswap_arbitrum_trades.sql (100%) rename {models => dex/models/_projects}/paraswap/arbitrum/paraswap_v5_arbitrum_trades.sql (100%) rename {models => dex/models/_projects}/paraswap/arbitrum/paraswap_v6_arbitrum_trades.sql (100%) rename {models => dex/models/_projects}/paraswap/arbitrum/paraswap_v6_arbitrum_trades_decoded.sql (100%) rename models/paraswap/avalanche_c/paraswap_avalanche_c_schema.yml => dex/models/_projects/paraswap/avalanche_c/_schema.yml (100%) rename {models => dex/models/_projects}/paraswap/avalanche_c/paraswap_avalanche_c_trades.sql (100%) rename {models => dex/models/_projects}/paraswap/avalanche_c/paraswap_v5_avalanche_c_trades.sql (100%) rename {models => dex/models/_projects}/paraswap/avalanche_c/paraswap_v6_avalanche_c_trades.sql (100%) rename {models => dex/models/_projects}/paraswap/avalanche_c/paraswap_v6_avalanche_c_trades_decoded.sql (100%) rename models/paraswap/base/paraswap_base_schema.yml => dex/models/_projects/paraswap/base/_schema.yml (100%) rename {models => dex/models/_projects}/paraswap/base/paraswap_base_trades.sql (100%) rename {models => dex/models/_projects}/paraswap/base/paraswap_v5_base_trades.sql (100%) rename {models => dex/models/_projects}/paraswap/base/paraswap_v6_base_trades.sql (100%) rename {models => dex/models/_projects}/paraswap/base/paraswap_v6_base_trades_decoded.sql (100%) rename models/paraswap/bnb/paraswap_bnb_schema.yml => dex/models/_projects/paraswap/bnb/_schema.yml (100%) rename {models => dex/models/_projects}/paraswap/bnb/paraswap_bnb_trades.sql (100%) rename {models => dex/models/_projects}/paraswap/bnb/paraswap_v4_bnb_trades.sql (100%) rename {models => dex/models/_projects}/paraswap/bnb/paraswap_v5_bnb_trades.sql (100%) rename {models => dex/models/_projects}/paraswap/bnb/paraswap_v6_bnb_trades.sql (100%) rename {models => dex/models/_projects}/paraswap/bnb/paraswap_v6_bnb_trades_decoded.sql (100%) rename models/paraswap/ethereum/paraswap_ethereum_schema.yml => dex/models/_projects/paraswap/ethereum/_schema.yml (85%) rename {models => dex/models/_projects}/paraswap/ethereum/paraswap_ethereum_trades.sql (100%) rename {models => dex/models/_projects}/paraswap/ethereum/paraswap_v4_ethereum_trades.sql (100%) rename {models => dex/models/_projects}/paraswap/ethereum/paraswap_v5_ethereum_trades.sql (100%) rename {models => dex/models/_projects}/paraswap/ethereum/paraswap_v6_ethereum_trades.sql (100%) rename {models => dex/models/_projects}/paraswap/ethereum/paraswap_v6_ethereum_trades_decoded.sql (100%) rename models/paraswap/fantom/paraswap_fantom_schema.yml => dex/models/_projects/paraswap/fantom/_schema.yml (100%) rename {models => dex/models/_projects}/paraswap/fantom/paraswap_fantom_trades.sql (100%) rename {models => dex/models/_projects}/paraswap/fantom/paraswap_v5_fantom_trades.sql (100%) rename {models => dex/models/_projects}/paraswap/fantom/paraswap_v6_fantom_trades.sql (100%) rename {models => dex/models/_projects}/paraswap/fantom/paraswap_v6_fantom_trades_decoded.sql (100%) rename models/paraswap/optimism/paraswap_optimism_schema.yml => dex/models/_projects/paraswap/optimism/_schema.yml (100%) rename {models => dex/models/_projects}/paraswap/optimism/paraswap_optimism_trades.sql (100%) rename {models => dex/models/_projects}/paraswap/optimism/paraswap_v5_optimism_trades.sql (100%) rename {models => dex/models/_projects}/paraswap/optimism/paraswap_v6_optimism_trades.sql (100%) rename {models => dex/models/_projects}/paraswap/optimism/paraswap_v6_optimism_trades_decoded.sql (100%) rename {models => dex/models/_projects}/paraswap/paraswap_trades.sql (100%) rename models/paraswap/polygon/paraswap_polygon_schema.yml => dex/models/_projects/paraswap/polygon/_schema.yml (100%) rename {models => dex/models/_projects}/paraswap/polygon/paraswap_polygon_trades.sql (100%) rename {models => dex/models/_projects}/paraswap/polygon/paraswap_v4_polygon_trades.sql (100%) rename {models => dex/models/_projects}/paraswap/polygon/paraswap_v5_polygon_trades.sql (100%) rename {models => dex/models/_projects}/paraswap/polygon/paraswap_v6_polygon_trades.sql (100%) rename {models => dex/models/_projects}/paraswap/polygon/paraswap_v6_polygon_trades_decoded.sql (100%) rename {models/_project => dex/models/_projects}/platypus_finance/platypus_finance_trades.sql (100%) rename {models/_project => dex/models/_projects}/quickswap/quickswap_trades.sql (100%) rename {models/_project => dex/models/_projects}/rubicon/rubicon_trades.sql (100%) rename {models/_project => dex/models/_projects}/shibaswap/shibaswap_trades.sql (100%) rename models/spartacus_exchange/fantom/spartacus_exchange_fantom_schema.yml => dex/models/_projects/spartacus_exchange/fantom/_schema.yml (100%) rename {models => dex/models/_projects}/spartacus_exchange/fantom/spartacus_exchange_fantom_pools.sql (95%) rename {models/_project => dex/models/_projects}/spartacus_exchange/spartacus_exchange_trades.sql (100%) rename models/spiritswap/fantom/spiritswap_fantom_schema.yml => dex/models/_projects/spiritswap/fantom/_schema.yml (100%) rename {models => dex/models/_projects}/spiritswap/fantom/spiritswap_fantom_pools.sql (96%) rename {models/_project => dex/models/_projects}/spiritswap/spiritswap_trades.sql (100%) rename models/spookyswap/fantom/spookyswap_fantom_schema.yml => dex/models/_projects/spookyswap/fantom/_schema.yml (100%) rename {models => dex/models/_projects}/spookyswap/fantom/spookyswap_fantom_pools.sql (100%) rename {models/_project => dex/models/_projects}/spookyswap/spookyswap_trades.sql (100%) rename {models/_project => dex/models/_projects}/sushiswap/sushiswap_trades.sql (100%) rename {models/_project => dex/models/_projects}/swapr/swapr_trades.sql (100%) rename {models/_project => dex/models/_projects}/synthetix/synthetix_trades.sql (100%) rename {models/_project => dex/models/_projects}/thena/thena_trades.sql (100%) rename models/tokenlon/tokenlon_trades_schema.yml => dex/models/_projects/tokenlon/_schema.yml (100%) rename models/tokenlon/ethereum/tokenlon_ethereum_schema.yml => dex/models/_projects/tokenlon/ethereum/_schema.yml (100%) rename {models => dex/models/_projects}/tokenlon/ethereum/tokenlon_ethereum_trades.sql (97%) rename {models => dex/models/_projects}/tokenlon/ethereum/tokenlon_v5_ethereum_amm_v1_trades.sql (100%) rename {models => dex/models/_projects}/tokenlon/ethereum/tokenlon_v5_ethereum_amm_v2_trades.sql (100%) rename {models => dex/models/_projects}/tokenlon/ethereum/tokenlon_v5_ethereum_pmm_v5_trades.sql (100%) rename {models => dex/models/_projects}/tokenlon/ethereum/tokenlon_v5_ethereum_rfq_v1_trades.sql (100%) rename {models => dex/models/_projects}/tokenlon/ethereum/tokenlon_v5_ethereum_rfq_v2_trades.sql (100%) rename {models => dex/models/_projects}/tokenlon/tokenlon_trades.sql (97%) rename {models/_project => dex/models/_projects}/trader_joe/trader_joe_trades.sql (100%) rename {models/_project => dex/models/_projects}/ubeswap/ubeswap_trades.sql (100%) create mode 100644 dex/models/_projects/unidex/optimism/_schema.yml rename {models => dex/models/_projects}/unidex/optimism/unidex_optimism_trades.sql (100%) create mode 100644 dex/models/_projects/uniswap/_schema.yml rename {models => dex/models/_projects}/uniswap/arbitrum/uniswap_arbitrum_pools.sql (99%) rename {models => dex/models/_projects}/uniswap/bnb/uniswap_bnb_pools.sql (99%) rename {models => dex/models/_projects}/uniswap/celo/uniswap_celo_pools.sql (100%) rename {models => dex/models/_projects}/uniswap/ethereum/uniswap_ethereum_pools.sql (100%) rename {models => dex/models/_projects}/uniswap/optimism/uniswap_optimism_ovm1_pool_mapping.sql (100%) rename {models => dex/models/_projects}/uniswap/optimism/uniswap_optimism_pools.sql (100%) rename {models => dex/models/_projects}/uniswap/polygon/uniswap_polygon_pools.sql (100%) rename {models => dex/models/_projects}/uniswap/uniswap_liquidity_manager_pools.sql (100%) rename {models => dex/models/_projects}/uniswap/uniswap_pools.sql (96%) rename {models/_project => dex/models/_projects}/uniswap/uniswap_trades.sql (100%) rename {models/_project => dex/models/_projects}/velodrome/velodrome_trades.sql (100%) rename {models/_project => dex/models/_projects}/verse_dex/verse_dex_trades.sql (100%) rename {models/_project => dex/models/_projects}/wardenswap/wardenswap_trades.sql (100%) rename models/wigoswap/fantom/wigoswap_fantom_schema.yml => dex/models/_projects/wigoswap/fantom/_schema.yml (100%) rename {models => dex/models/_projects}/wigoswap/fantom/wigoswap_fantom_pools.sql (100%) rename {models/_project => dex/models/_projects}/wigoswap/wigoswap_trades.sql (100%) rename {models/_project => dex/models/_projects}/wombat/wombat_trades.sql (100%) rename {models/_project => dex/models/_projects}/woofi/woofi_trades.sql (100%) rename {models/_project => dex/models/_projects}/xchange/xchange_trades.sql (100%) create mode 100644 dex/models/_projects/yield_yak/_schema.yml rename models/uniswap/base/uniswap_base_schema.yml => dex/models/_projects/yield_yak/arbitrum/_schema.yml (79%) rename {models => dex/models/_projects}/yield_yak/arbitrum/yield_yak_arbitrum_trades.sql (100%) rename models/uniswap/avalanche_c/uniswap_avalanche_c_schema.yml => dex/models/_projects/yield_yak/avalanche_c/_schema.yml (80%) rename {models => dex/models/_projects}/yield_yak/avalanche_c/yield_yak_avalanche_c_trades.sql (100%) rename models/pharaoh/pharaoh_avalanche_c_schema.yml => dex/models/_projects/yield_yak/mantle/_schema.yml (80%) rename {models => dex/models/_projects}/yield_yak/mantle/yield_yak_mantle_trades.sql (100%) rename {models => dex/models/_projects}/yield_yak/yield_yak_trades.sql (100%) rename {models => dex/models/_projects}/zeroex/arbitrum/zeroex_arbitrum_api_fills.sql (99%) rename {models => dex/models/_projects}/zeroex/arbitrum/zeroex_arbitrum_api_fills_deduped.sql (100%) rename {models => dex/models/_projects}/zeroex/arbitrum/zeroex_arbitrum_native_fills.sql (99%) rename {models => dex/models/_projects}/zeroex/arbitrum/zeroex_arbitrum_schema.yml (100%) rename {models => dex/models/_projects}/zeroex/avalanche_c/zeroex_avalanche_c_api_fills.sql (99%) rename {models => dex/models/_projects}/zeroex/avalanche_c/zeroex_avalanche_c_api_fills_deduped.sql (100%) rename {models => dex/models/_projects}/zeroex/avalanche_c/zeroex_avalanche_c_schema.yml (100%) rename {models => dex/models/_projects}/zeroex/base/zeroex_base_api_fills.sql (100%) rename {models => dex/models/_projects}/zeroex/base/zeroex_base_api_fills_deduped.sql (100%) rename {models => dex/models/_projects}/zeroex/base/zeroex_base_api_fills_schema.yml (100%) rename {models => dex/models/_projects}/zeroex/bnb/zeroex_bnb_api_fills.sql (99%) rename {models => dex/models/_projects}/zeroex/bnb/zeroex_bnb_api_fills_deduped.sql (99%) rename {models => dex/models/_projects}/zeroex/bnb/zeroex_bnb_native_fills.sql (99%) rename {models => dex/models/_projects}/zeroex/bnb/zeroex_bnb_schema.yml (100%) rename {models => dex/models/_projects}/zeroex/celo/zeroex_celo_api_fills.sql (100%) rename {models => dex/models/_projects}/zeroex/celo/zeroex_celo_api_fills_deduped.sql (100%) rename {models => dex/models/_projects}/zeroex/celo/zeroex_celo_schema.yml (100%) rename {models => dex/models/_projects}/zeroex/ethereum/zeroex_ethereum_api_fills.sql (99%) rename {models => dex/models/_projects}/zeroex/ethereum/zeroex_ethereum_api_fills_deduped.sql (100%) rename {models => dex/models/_projects}/zeroex/ethereum/zeroex_ethereum_native_fills.sql (99%) rename {models => dex/models/_projects}/zeroex/ethereum/zeroex_ethereum_nft_fills.sql (99%) rename {models => dex/models/_projects}/zeroex/ethereum/zeroex_ethereum_schema.yml (100%) rename {models => dex/models/_projects}/zeroex/fantom/zeroex_fantom_api_fills.sql (99%) rename {models => dex/models/_projects}/zeroex/fantom/zeroex_fantom_api_fills_deduped.sql (100%) rename {models => dex/models/_projects}/zeroex/fantom/zeroex_fantom_schema.yml (100%) rename {models => dex/models/_projects}/zeroex/optimism/zeroex_optimism_api_fills.sql (100%) rename {models => dex/models/_projects}/zeroex/optimism/zeroex_optimism_api_fills_deduped.sql (100%) rename {models => dex/models/_projects}/zeroex/optimism/zeroex_optimism_native_fills.sql (99%) rename {models => dex/models/_projects}/zeroex/optimism/zeroex_optimism_schema.yml (100%) rename {models => dex/models/_projects}/zeroex/polygon/zeroex_polygon_api_fills.sql (100%) rename {models => dex/models/_projects}/zeroex/polygon/zeroex_polygon_api_fills_deduped.sql (100%) rename {models => dex/models/_projects}/zeroex/polygon/zeroex_polygon_native_fills.sql (99%) rename {models => dex/models/_projects}/zeroex/polygon/zeroex_polygon_nft_fills.sql (98%) rename {models => dex/models/_projects}/zeroex/polygon/zeroex_polygon_schema.yml (100%) rename {models => dex/models/_projects}/zeroex/zeroex_api_fills.sql (100%) rename {models => dex/models/_projects}/zeroex/zeroex_api_fills_deduped.sql (100%) rename {models => dex/models/_projects}/zeroex/zeroex_native_fills.sql (96%) rename {models => dex/models/_projects}/zeroex/zeroex_native_trades.sql (98%) rename {models => dex/models/_projects}/zeroex/zeroex_schema.yml (100%) rename {models => dex/models/_projects}/zeroex/zeroex_trades.sql (100%) rename {models/_project => dex/models/_projects}/zigzag/zigzag_trades.sql (100%) rename {models/_project => dex/models/_projects}/zipswap/zipswap_trades.sql (100%) create mode 100644 dex/models/_schema.yml create mode 100644 dex/models/addresses/_schema.yml rename {models/dex => dex/models/addresses}/arbitrum/dex_arbitrum_addresses.sql (100%) rename {models/dex => dex/models/addresses}/base/dex_base_addresses.sql (100%) rename {models/dex => dex/models/addresses}/bnb/dex_bnb_addresses.sql (100%) rename {models/dex => dex/models/addresses}/dex_addresses.sql (100%) rename {models/dex => dex/models/addresses}/ethereum/dex_ethereum_addresses.sql (100%) rename {models/dex => dex/models/addresses}/optimism/dex_optimism_addresses.sql (100%) rename {models/dex => dex/models/addresses}/polygon/dex_polygon_addresses.sql (100%) create mode 100644 dex/models/aggregator_trades/_schema.yml rename {models/dex => dex/models/aggregator_trades}/dex_aggregator_trades.sql (100%) create mode 100644 dex/models/arbitrages/_schema.yml rename {models/dex/chains/mev/arbitrages => dex/models/arbitrages/arbitrum}/dex_arbitrum_atomic_arbitrages.sql (100%) rename {models/dex/chains/mev/arbitrages => dex/models/arbitrages/avalanche_c}/dex_avalanche_c_atomic_arbitrages.sql (100%) rename {models/dex/chains/mev/arbitrages => dex/models/arbitrages/base}/dex_base_atomic_arbitrages.sql (100%) rename {models/dex/chains/mev/arbitrages => dex/models/arbitrages/bnb}/dex_bnb_atomic_arbitrages.sql (100%) rename {models/dex/chains/mev/arbitrages => dex/models/arbitrages/celo}/dex_celo_atomic_arbitrages.sql (100%) rename {models/dex => dex/models/arbitrages}/dex_atomic_arbitrages.sql (100%) rename {models/dex/chains/mev/arbitrages => dex/models/arbitrages/ethereum}/dex_ethereum_atomic_arbitrages.sql (100%) rename {models/dex/chains/mev/arbitrages => dex/models/arbitrages/fantom}/dex_fantom_atomic_arbitrages.sql (100%) rename {models/dex/chains/mev/arbitrages => dex/models/arbitrages/gnosis}/dex_gnosis_atomic_arbitrages.sql (100%) rename {models/dex/chains/mev/arbitrages => dex/models/arbitrages/optimism}/dex_optimism_atomic_arbitrages.sql (100%) rename {models/dex/chains/mev/arbitrages => dex/models/arbitrages/polygon}/dex_polygon_atomic_arbitrages.sql (100%) rename {models/dex/chains/mev/arbitrages => dex/models/arbitrages/scroll}/dex_scroll_atomic_arbitrages.sql (100%) rename {models/dex/chains/mev/arbitrages => dex/models/arbitrages/zksync}/dex_zksync_atomic_arbitrages.sql (100%) rename {models/dex/chains/mev/arbitrages => dex/models/arbitrages/zora}/dex_zora_atomic_arbitrages.sql (100%) rename {models/dex => dex/models}/dex_info.sql (100%) create mode 100644 dex/models/pools/_schema.yml rename {models/dex => dex/models/pools}/dex_pools.sql (98%) rename {models/dex => dex/models/pools}/dex_raw_pool_creations.sql (100%) rename {models/dex => dex/models/pools}/dex_raw_pool_initializations.sql (100%) rename {models/dex => dex/models/pools}/dex_raw_pools.sql (100%) create mode 100644 dex/models/prices/_schema.yml rename {models/dex => dex/models/prices}/dex_prices.sql (99%) rename {models/dex => dex/models/prices}/dex_prices_latest.sql (98%) rename models/dex/chains/dex_schema.yml => dex/models/sandwiches/_schema.yml (69%) rename {models/dex/chains/mev/sandwiches => dex/models/sandwiches/arbitrum}/dex_arbitrum_sandwiched.sql (100%) rename {models/dex/chains/mev/sandwiches => dex/models/sandwiches/arbitrum}/dex_arbitrum_sandwiches.sql (100%) rename {models/dex/chains/mev/sandwiches => dex/models/sandwiches/avalanche_c}/dex_avalanche_c_sandwiched.sql (100%) rename {models/dex/chains/mev/sandwiches => dex/models/sandwiches/avalanche_c}/dex_avalanche_c_sandwiches.sql (100%) rename {models/dex/chains/mev/sandwiches => dex/models/sandwiches/base}/dex_base_sandwiched.sql (100%) rename {models/dex/chains/mev/sandwiches => dex/models/sandwiches/base}/dex_base_sandwiches.sql (100%) rename {models/dex/chains/mev/sandwiches => dex/models/sandwiches/bnb}/dex_bnb_sandwiched.sql (100%) rename {models/dex/chains/mev/sandwiches => dex/models/sandwiches/bnb}/dex_bnb_sandwiches.sql (100%) rename {models/dex/chains/mev/sandwiches => dex/models/sandwiches/celo}/dex_celo_sandwiched.sql (100%) rename {models/dex/chains/mev/sandwiches => dex/models/sandwiches/celo}/dex_celo_sandwiches.sql (100%) rename {models/dex => dex/models/sandwiches}/dex_sandwiched.sql (100%) rename {models/dex => dex/models/sandwiches}/dex_sandwiches.sql (100%) rename {models/dex/chains/mev/sandwiches => dex/models/sandwiches/ethereum}/dex_ethereum_sandwiched.sql (100%) rename {models/dex/chains/mev/sandwiches => dex/models/sandwiches/ethereum}/dex_ethereum_sandwiches.sql (100%) rename {models/dex/chains/mev/sandwiches => dex/models/sandwiches/fantom}/dex_fantom_sandwiched.sql (100%) rename {models/dex/chains/mev/sandwiches => dex/models/sandwiches/fantom}/dex_fantom_sandwiches.sql (100%) rename {models/dex/chains/mev/sandwiches => dex/models/sandwiches/gnosis}/dex_gnosis_sandwiched.sql (100%) rename {models/dex/chains/mev/sandwiches => dex/models/sandwiches/gnosis}/dex_gnosis_sandwiches.sql (100%) rename {models/dex/chains/mev/sandwiches => dex/models/sandwiches/optimism}/dex_optimism_sandwiched.sql (100%) rename {models/dex/chains/mev/sandwiches => dex/models/sandwiches/optimism}/dex_optimism_sandwiches.sql (100%) rename {models/dex/chains/mev/sandwiches => dex/models/sandwiches/polygon}/dex_polygon_sandwiched.sql (100%) rename {models/dex/chains/mev/sandwiches => dex/models/sandwiches/polygon}/dex_polygon_sandwiches.sql (100%) rename {models/dex/chains/mev/sandwiches => dex/models/sandwiches/scroll}/dex_scroll_sandwiched.sql (100%) rename {models/dex/chains/mev/sandwiches => dex/models/sandwiches/scroll}/dex_scroll_sandwiches.sql (100%) rename {models/dex/chains/mev/sandwiches => dex/models/sandwiches/zksync}/dex_zksync_sandwiched.sql (100%) rename {models/dex/chains/mev/sandwiches => dex/models/sandwiches/zksync}/dex_zksync_sandwiches.sql (100%) rename {models/dex/chains/mev/sandwiches => dex/models/sandwiches/zora}/dex_zora_sandwiched.sql (100%) rename {models/dex/chains/mev/sandwiches => dex/models/sandwiches/zora}/dex_zora_sandwiches.sql (100%) rename {models/_sector/dex => dex/models}/trades/_schema.yml (100%) rename {models/_sector/dex => dex/models}/trades/arbitrum/_schema.yml (100%) rename {models/_sector/dex => dex/models}/trades/arbitrum/dex_arbitrum_base_trades.sql (100%) rename {models/_sector/dex => dex/models}/trades/arbitrum/platforms/airswap_arbitrum_base_trades.sql (100%) rename {models/_sector/dex => dex/models}/trades/arbitrum/platforms/apeswap_arbitrum_base_trades.sql (100%) rename {models/_sector/dex => dex/models}/trades/arbitrum/platforms/arbswap_arbitrum_base_trades.sql (100%) rename {models/_sector/dex => dex/models}/trades/arbitrum/platforms/auragi_arbitrum_base_trades.sql (100%) rename {models/_sector/dex => dex/models}/trades/arbitrum/platforms/balancer_v2_arbitrum_base_trades.sql (100%) rename {models/_sector/dex => dex/models}/trades/arbitrum/platforms/camelot_v2_arbitrum_base_trades.sql (100%) rename {models/_sector/dex => dex/models}/trades/arbitrum/platforms/camelot_v3_arbitrum_base_trades.sql (100%) rename {models/_sector/dex => dex/models}/trades/arbitrum/platforms/chronos_arbitrum_base_trades.sql (100%) rename {models/_sector/dex => dex/models}/trades/arbitrum/platforms/clipper_arbitrum_base_trades.sql (100%) rename {models/_sector/dex => dex/models}/trades/arbitrum/platforms/dodo_arbitrum_base_trades.sql (100%) rename {models/_sector/dex => dex/models}/trades/arbitrum/platforms/fraxswap_arbitrum_base_trades.sql (100%) rename {models/_sector/dex => dex/models}/trades/arbitrum/platforms/gmx_arbitrum_base_trades.sql (100%) rename {models/_sector/dex => dex/models}/trades/arbitrum/platforms/gridex_arbitrum_base_trades.sql (100%) rename {models/_sector/dex => dex/models}/trades/arbitrum/platforms/integral_arbitrum_base_trades.sql (100%) rename {models/_sector/dex => dex/models}/trades/arbitrum/platforms/kyberswap_arbitrum_base_trades.sql (100%) rename {models/_sector/dex => dex/models}/trades/arbitrum/platforms/oasisswap_arbitrum_base_trades.sql (100%) rename {models/_sector/dex => dex/models}/trades/arbitrum/platforms/pancakeswap_v2_arbitrum_base_trades.sql (100%) rename {models/_sector/dex => dex/models}/trades/arbitrum/platforms/pancakeswap_v3_arbitrum_base_trades.sql (100%) rename {models/_sector/dex => dex/models}/trades/arbitrum/platforms/ramses_arbitrum_base_trades.sql (100%) rename {models/_sector/dex => dex/models}/trades/arbitrum/platforms/rubicon_arbitrum_base_trades.sql (100%) rename {models/_sector/dex => dex/models}/trades/arbitrum/platforms/sharkyswap_arbitrum_base_trades.sql (100%) rename {models/_sector/dex => dex/models}/trades/arbitrum/platforms/smardex_arbitrum_base_trades.sql (100%) rename {models/_sector/dex => dex/models}/trades/arbitrum/platforms/solidlizard_arbitrum_base_trades.sql (100%) rename {models/_sector/dex => dex/models}/trades/arbitrum/platforms/solidly_v3_arbitrum_base_trades.sql (100%) rename {models/_sector/dex => dex/models}/trades/arbitrum/platforms/sterling_finance_arbitrum_base_trades.sql (100%) rename {models/_sector/dex => dex/models}/trades/arbitrum/platforms/sushiswap_v1_arbitrum_base_trades.sql (100%) rename {models/_sector/dex => dex/models}/trades/arbitrum/platforms/sushiswap_v2_arbitrum_base_trades.sql (100%) rename {models/_sector/dex => dex/models}/trades/arbitrum/platforms/swaap_v2_arbitrum_base_trades.sql (100%) rename {models/_sector/dex => dex/models}/trades/arbitrum/platforms/trader_joe_v2_1_arbitrum_base_trades.sql (100%) rename {models/_sector/dex => dex/models}/trades/arbitrum/platforms/trader_joe_v2_arbitrum_base_trades.sql (100%) rename {models/_sector/dex => dex/models}/trades/arbitrum/platforms/uniswap_v2_arbitrum_base_trades.sql (100%) rename {models/_sector/dex => dex/models}/trades/arbitrum/platforms/uniswap_v3_arbitrum_base_trades.sql (100%) rename {models/_sector/dex => dex/models}/trades/arbitrum/platforms/wombat_exchange_arbitrum_base_trades.sql (100%) rename {models/_sector/dex => dex/models}/trades/arbitrum/platforms/woofi_arbitrum_base_trades.sql (100%) rename {models/_sector/dex => dex/models}/trades/arbitrum/platforms/xchange_arbitrum_base_trades.sql (100%) rename {models/_sector/dex => dex/models}/trades/arbitrum/platforms/zigzag_arbitrum_base_trades.sql (100%) rename {models/_sector/dex => dex/models}/trades/arbitrum/platforms/zyberswap_arbitrum_base_trades.sql (100%) rename {models/_sector/dex => dex/models}/trades/avalanche_c/_schema.yml (100%) rename {models/_sector/dex => dex/models}/trades/avalanche_c/dex_avalanche_c_base_trades.sql (100%) rename {models/_sector/dex => dex/models}/trades/avalanche_c/platforms/airswap_avalanche_c_base_trades.sql (100%) rename {models/_sector/dex => dex/models}/trades/avalanche_c/platforms/balancer_v2_avalanche_c_base_trades.sql (100%) rename {models/_sector/dex => dex/models}/trades/avalanche_c/platforms/curvefi_avalanche_c_base_trades.sql (100%) rename {models/_sector/dex => dex/models}/trades/avalanche_c/platforms/fraxswap_avalanche_c_base_trades.sql (100%) rename {models/_sector/dex => dex/models}/trades/avalanche_c/platforms/glacier_v2_avalanche_c_base_trades.sql (100%) rename {models/_sector/dex => dex/models}/trades/avalanche_c/platforms/glacier_v3_avalanche_c_base_trades.sql (100%) rename {models/_sector/dex => dex/models}/trades/avalanche_c/platforms/gmx_avalanche_c_base_trades.sql (100%) rename {models/_sector/dex => dex/models}/trades/avalanche_c/platforms/hashflow_avalanche_c_base_trades.sql (100%) rename {models/_sector/dex => dex/models}/trades/avalanche_c/platforms/kyberswap_avalanche_c_base_trades.sql (100%) rename {models/_sector/dex => dex/models}/trades/avalanche_c/platforms/openocean_avalanche_c_base_trades.sql (100%) rename {models/_sector/dex => dex/models}/trades/avalanche_c/platforms/pharaoh_avalanche_c_base_trades.sql (100%) rename {models/_sector/dex => dex/models}/trades/avalanche_c/platforms/platypus_finance_avalanche_c_base_trades.sql (100%) rename {models/_sector/dex => dex/models}/trades/avalanche_c/platforms/sushiswap_v1_avalanche_c_base_trades.sql (100%) rename {models/_sector/dex => dex/models}/trades/avalanche_c/platforms/sushiswap_v2_avalanche_c_base_trades.sql (100%) rename {models/_sector/dex => dex/models}/trades/avalanche_c/platforms/trader_joe_v1_avalanche_c_base_trades.sql (100%) rename {models/_sector/dex => dex/models}/trades/avalanche_c/platforms/trader_joe_v2_1_avalanche_c_base_trades.sql (100%) rename {models/_sector/dex => dex/models}/trades/avalanche_c/platforms/trader_joe_v2_avalanche_c_base_trades.sql (100%) rename {models/_sector/dex => dex/models}/trades/avalanche_c/platforms/uniswap_v2_avalanche_c_base_trades.sql (100%) rename {models/_sector/dex => dex/models}/trades/avalanche_c/platforms/uniswap_v3_avalanche_c_base_trades.sql (100%) rename {models/_sector/dex => dex/models}/trades/avalanche_c/platforms/woofi_avalanche_c_base_trades.sql (100%) rename {models/_sector/dex => dex/models}/trades/base/_schema.yml (100%) rename {models/_sector/dex => dex/models}/trades/base/dex_base_base_trades.sql (100%) rename {models/_sector/dex => dex/models}/trades/base/platforms/aerodrome_base_base_trades.sql (100%) rename {models/_sector/dex => dex/models}/trades/base/platforms/alienbase_base_base_trades.sql (100%) rename {models/_sector/dex => dex/models}/trades/base/platforms/autotronic_base_base_trades.sql (100%) rename {models/_sector/dex => dex/models}/trades/base/platforms/balancer_v2_base_base_trades.sql (100%) rename {models/_sector/dex => dex/models}/trades/base/platforms/baseswap_base_base_trades.sql (100%) rename {models/_sector/dex => dex/models}/trades/base/platforms/baseswap_basex_base_base_trades.sql (100%) rename {models/_sector/dex => dex/models}/trades/base/platforms/baso_finance_base_base_trades.sql (100%) rename {models/_sector/dex => dex/models}/trades/base/platforms/citadelswap_base_base_trades.sql (100%) rename {models/_sector/dex => dex/models}/trades/base/platforms/clipper_base_base_trades.sql (100%) rename {models/_sector/dex => dex/models}/trades/base/platforms/crescentswap_base_base_trades.sql (100%) rename {models/_sector/dex => dex/models}/trades/base/platforms/dackieswap_base_base_trades.sql (100%) rename {models/_sector/dex => dex/models}/trades/base/platforms/derpdex_base_base_trades.sql (100%) rename {models/_sector/dex => dex/models}/trades/base/platforms/dodo_base_base_trades.sql (100%) rename {models/_sector/dex => dex/models}/trades/base/platforms/elk_finance_base_base_trades.sql (100%) rename {models/_sector/dex => dex/models}/trades/base/platforms/energon_base_base_trades.sql (100%) rename {models/_sector/dex => dex/models}/trades/base/platforms/gridex_base_base_trades.sql (100%) rename {models/_sector/dex => dex/models}/trades/base/platforms/horizondex_base_base_trades.sql (100%) rename {models/_sector/dex => dex/models}/trades/base/platforms/icecreamswap_base_base_trades.sql (100%) rename {models/_sector/dex => dex/models}/trades/base/platforms/kyberswap_base_base_trades.sql (100%) rename {models/_sector/dex => dex/models}/trades/base/platforms/leetswap_v2_base_base_trades.sql (100%) rename {models/_sector/dex => dex/models}/trades/base/platforms/maverick_base_base_trades.sql (100%) rename {models/_sector/dex => dex/models}/trades/base/platforms/moonbase_base_base_trades.sql (100%) rename {models/_sector/dex => dex/models}/trades/base/platforms/oasisswap_base_base_trades.sql (100%) rename {models/_sector/dex => dex/models}/trades/base/platforms/openocean_base_base_trades.sql (100%) rename {models/_sector/dex => dex/models}/trades/base/platforms/pancakeswap_v2_base_base_trades.sql (100%) rename {models/_sector/dex => dex/models}/trades/base/platforms/pancakeswap_v3_base_base_trades.sql (100%) rename {models/_sector/dex => dex/models}/trades/base/platforms/plantbaseswap_base_base_trades.sql (100%) rename {models/_sector/dex => dex/models}/trades/base/platforms/rocketswap_base_base_trades.sql (100%) rename {models/_sector/dex => dex/models}/trades/base/platforms/rubicon_base_base_trades.sql (100%) rename {models/_sector/dex => dex/models}/trades/base/platforms/scale_base_base_trades.sql (100%) rename {models/_sector/dex => dex/models}/trades/base/platforms/sharkswap_base_base_trades.sql (100%) rename {models/_sector/dex => dex/models}/trades/base/platforms/smardex_base_base_trades.sql (100%) rename {models/_sector/dex => dex/models}/trades/base/platforms/sobal_base_base_trades.sql (100%) rename {models/_sector/dex => dex/models}/trades/base/platforms/solidly_v3_base_base_trades.sql (100%) rename {models/_sector/dex => dex/models}/trades/base/platforms/soswap_base_base_trades.sql (100%) rename {models/_sector/dex => dex/models}/trades/base/platforms/sushiswap_v1_base_base_trades.sql (100%) rename {models/_sector/dex => dex/models}/trades/base/platforms/sushiswap_v2_base_base_trades.sql (100%) rename {models/_sector/dex => dex/models}/trades/base/platforms/swapbased_base_base_trades.sql (100%) rename {models/_sector/dex => dex/models}/trades/base/platforms/synthswap_base_base_trades.sql (100%) rename {models/_sector/dex => dex/models}/trades/base/platforms/throne_exchange_v2_base_base_trades.sql (100%) rename {models/_sector/dex => dex/models}/trades/base/platforms/throne_exchange_v3_base_base_trades.sql (100%) rename {models/_sector/dex => dex/models}/trades/base/platforms/torus_base_base_trades.sql (100%) rename {models/_sector/dex => dex/models}/trades/base/platforms/uniswap_v2_base_base_trades.sql (100%) rename {models/_sector/dex => dex/models}/trades/base/platforms/uniswap_v3_base_base_trades.sql (100%) rename {models/_sector/dex => dex/models}/trades/base/platforms/velocimeter_v2_base_base_trades.sql (100%) rename {models/_sector/dex => dex/models}/trades/base/platforms/voltswap_base_base_trades.sql (100%) rename {models/_sector/dex => dex/models}/trades/base/platforms/wombat_exchange_base_base_trades.sql (100%) rename {models/_sector/dex => dex/models}/trades/base/platforms/woofi_base_base_trades.sql (100%) rename {models/_sector/dex => dex/models}/trades/bnb/_schema.yml (100%) rename {models/_sector/dex => dex/models}/trades/bnb/dex_bnb_base_trades.sql (100%) rename {models/_sector/dex => dex/models}/trades/bnb/platforms/airswap_bnb_base_trades.sql (100%) rename {models/_sector/dex => dex/models}/trades/bnb/platforms/apeswap_bnb_base_trades.sql (100%) rename {models/_sector/dex => dex/models}/trades/bnb/platforms/babyswap_bnb_base_trades.sql (100%) rename {models/_sector/dex => dex/models}/trades/bnb/platforms/biswap_v2_bnb_base_trades.sql (100%) rename {models/_sector/dex => dex/models}/trades/bnb/platforms/biswap_v3_bnb_base_trades.sql (100%) rename {models/_sector/dex => dex/models}/trades/bnb/platforms/dodo_bnb_base_trades.sql (100%) rename {models/_sector/dex => dex/models}/trades/bnb/platforms/ellipsis_finance_bnb_base_trades.sql (100%) rename {models/_sector/dex => dex/models}/trades/bnb/platforms/fraxswap_bnb_base_trades.sql (100%) rename {models/_sector/dex => dex/models}/trades/bnb/platforms/hashflow_bnb_base_trades.sql (100%) rename {models/_sector/dex => dex/models}/trades/bnb/platforms/iziswap_bnb_base_trades.sql (100%) rename {models/_sector/dex => dex/models}/trades/bnb/platforms/kyberswap_bnb_base_trades.sql (100%) rename {models/_sector/dex => dex/models}/trades/bnb/platforms/maverick_bnb_base_trades.sql (100%) rename {models/_sector/dex => dex/models}/trades/bnb/platforms/mdex_bnb_base_trades.sql (100%) rename {models/_sector/dex => dex/models}/trades/bnb/platforms/nomiswap_bnb_base_trades.sql (100%) rename {models/_sector/dex => dex/models}/trades/bnb/platforms/onepunchswap_bnb_base_trades.sql (100%) rename {models/_sector/dex => dex/models}/trades/bnb/platforms/pancakeswap_v2_bnb_base_trades.sql (100%) rename {models/_sector/dex => dex/models}/trades/bnb/platforms/pancakeswap_v3_bnb_base_trades.sql (100%) rename {models/_sector/dex => dex/models}/trades/bnb/platforms/sushiswap_v1_bnb_base_trades.sql (100%) rename {models/_sector/dex => dex/models}/trades/bnb/platforms/sushiswap_v2_bnb_base_trades.sql (100%) rename {models/_sector/dex => dex/models}/trades/bnb/platforms/thena_bnb_base_trades.sql (100%) rename {models/_sector/dex => dex/models}/trades/bnb/platforms/trader_joe_v2_1_bnb_base_trades.sql (100%) rename {models/_sector/dex => dex/models}/trades/bnb/platforms/trader_joe_v2_bnb_base_trades.sql (100%) rename {models/_sector/dex => dex/models}/trades/bnb/platforms/uniswap_v2_bnb_base_trades.sql (100%) rename {models/_sector/dex => dex/models}/trades/bnb/platforms/uniswap_v3_bnb_base_trades.sql (100%) rename {models/_sector/dex => dex/models}/trades/bnb/platforms/wombat_bnb_base_trades.sql (100%) rename {models/_sector/dex => dex/models}/trades/bnb/platforms/woofi_bnb_base_trades.sql (100%) rename {models/_sector/dex => dex/models}/trades/bnb/platforms/xchange_bnb_base_trades.sql (100%) rename {models/_sector/dex => dex/models}/trades/celo/_schema.yml (100%) rename {models/_sector/dex => dex/models}/trades/celo/dex_celo_base_trades.sql (100%) rename {models/_sector/dex => dex/models}/trades/celo/platforms/carbonhood_celo_base_trades.sql (100%) rename {models/_sector/dex => dex/models}/trades/celo/platforms/curvefi_celo_base_trades.sql (100%) rename {models/_sector/dex => dex/models}/trades/celo/platforms/mento_v1_celo_base_trades.sql (100%) rename {models/_sector/dex => dex/models}/trades/celo/platforms/mento_v2_celo_base_trades.sql (100%) rename {models/_sector/dex => dex/models}/trades/celo/platforms/sushiswap_celo_base_trades.sql (100%) rename {models/_sector/dex => dex/models}/trades/celo/platforms/ubeswap_celo_base_trades.sql (100%) rename {models/_sector/dex => dex/models}/trades/celo/platforms/uniswap_v3_celo_base_trades.sql (100%) rename {models/_sector/dex => dex/models}/trades/dex_base_trades.sql (100%) rename {models/_sector/dex => dex/models}/trades/dex_trades.sql (100%) rename {models/_sector/dex => dex/models}/trades/ethereum/_schema.yml (100%) rename {models/_sector/dex => dex/models}/trades/ethereum/dex_ethereum_base_trades.sql (100%) rename {models/_sector/dex => dex/models}/trades/ethereum/platforms/airswap_ethereum_base_trades.sql (100%) rename {models/_sector/dex => dex/models}/trades/ethereum/platforms/apeswap_ethereum_base_trades.sql (100%) rename {models/_sector/dex => dex/models}/trades/ethereum/platforms/balancer_v1_ethereum_base_trades.sql (100%) rename {models/_sector/dex => dex/models}/trades/ethereum/platforms/balancer_v2_ethereum_base_trades.sql (100%) rename {models/_sector/dex => dex/models}/trades/ethereum/platforms/bancor_ethereum_base_trades.sql (100%) rename {models/_sector/dex => dex/models}/trades/ethereum/platforms/carbon_defi_ethereum_base_trades.sql (100%) rename {models/_sector/dex => dex/models}/trades/ethereum/platforms/clipper_ethereum_base_trades.sql (100%) rename {models/_sector/dex => dex/models}/trades/ethereum/platforms/curvefi_ethereum_base_trades.sql (100%) rename {models/_sector/dex => dex/models}/trades/ethereum/platforms/defiswap_ethereum_base_trades.sql (100%) rename {models/_sector/dex => dex/models}/trades/ethereum/platforms/dfx_ethereum_base_trades.sql (100%) rename {models/_sector/dex => dex/models}/trades/ethereum/platforms/dodo_ethereum_base_trades.sql (100%) rename {models/_sector/dex => dex/models}/trades/ethereum/platforms/fraxswap_ethereum_base_trades.sql (100%) rename {models/_sector/dex => dex/models}/trades/ethereum/platforms/integral_ethereum_base_trades.sql (100%) rename {models/_sector/dex => dex/models}/trades/ethereum/platforms/kyberswap_ethereum_base_trades.sql (100%) rename {models/_sector/dex => dex/models}/trades/ethereum/platforms/mauve_ethereum_base_trades.sql (100%) rename {models/_sector/dex => dex/models}/trades/ethereum/platforms/maverick_ethereum_base_trades.sql (100%) rename {models/_sector/dex => dex/models}/trades/ethereum/platforms/mstable_ethereum_base_trades.sql (100%) rename {models/_sector/dex => dex/models}/trades/ethereum/platforms/pancakeswap_v2_ethereum_base_trades.sql (100%) rename {models/_sector/dex => dex/models}/trades/ethereum/platforms/pancakeswap_v3_ethereum_base_trades.sql (100%) rename {models/_sector/dex => dex/models}/trades/ethereum/platforms/shibaswap_v1_ethereum_base_trades.sql (100%) rename {models/_sector/dex => dex/models}/trades/ethereum/platforms/solidly_v3_ethereum_base_trades.sql (100%) rename {models/_sector/dex => dex/models}/trades/ethereum/platforms/sushiswap_v1_ethereum_base_trades.sql (100%) rename {models/_sector/dex => dex/models}/trades/ethereum/platforms/sushiswap_v2_ethereum_base_trades.sql (100%) rename {models/_sector/dex => dex/models}/trades/ethereum/platforms/swapr_ethereum_base_trades.sql (100%) rename {models/_sector/dex => dex/models}/trades/ethereum/platforms/uniswap_v1_ethereum_base_trades.sql (100%) rename {models/_sector/dex => dex/models}/trades/ethereum/platforms/uniswap_v2_ethereum_base_trades.sql (100%) rename {models/_sector/dex => dex/models}/trades/ethereum/platforms/uniswap_v3_ethereum_base_trades.sql (100%) rename {models/_sector/dex => dex/models}/trades/ethereum/platforms/verse_dex_ethereum_base_trades.sql (100%) rename {models/_sector/dex => dex/models}/trades/ethereum/platforms/xchange_ethereum_base_trades.sql (100%) rename {models/_sector/dex => dex/models}/trades/fantom/_schema.yml (100%) rename {models/_sector/dex => dex/models}/trades/fantom/dex_fantom_base_trades.sql (100%) rename {models/_sector/dex => dex/models}/trades/fantom/platforms/beethoven_x_fantom_base_trades.sql (100%) rename {models/_sector/dex => dex/models}/trades/fantom/platforms/curvefi_fantom_base_trades.sql (100%) rename {models/_sector/dex => dex/models}/trades/fantom/platforms/equalizer_fantom_base_trades.sql (100%) rename {models/_sector/dex => dex/models}/trades/fantom/platforms/openocean_fantom_base_trades.sql (100%) rename {models/_sector/dex => dex/models}/trades/fantom/platforms/solidly_v3_fantom_base_trades.sql (100%) rename {models/_sector/dex => dex/models}/trades/fantom/platforms/spartacus_exchange_fantom_base_trades.sql (100%) rename {models/_sector/dex => dex/models}/trades/fantom/platforms/spiritswap_fantom_base_trades.sql (100%) rename {models/_sector/dex => dex/models}/trades/fantom/platforms/spookyswap_fantom_base_trades.sql (100%) rename {models/_sector/dex => dex/models}/trades/fantom/platforms/sushiswap_v1_fantom_base_trades.sql (100%) rename {models/_sector/dex => dex/models}/trades/fantom/platforms/sushiswap_v2_fantom_base_trades.sql (100%) rename {models/_sector/dex => dex/models}/trades/fantom/platforms/wigoswap_fantom_base_trades.sql (100%) rename {models/_sector/dex => dex/models}/trades/gnosis/_schema.yml (100%) rename {models/_sector/dex => dex/models}/trades/gnosis/dex_gnosis_base_trades.sql (100%) rename {models/_sector/dex => dex/models}/trades/gnosis/platforms/balancer_v2_gnosis_base_trades.sql (100%) rename {models/_sector/dex => dex/models}/trades/gnosis/platforms/honeyswap_v2_gnosis_base_trades.sql (100%) rename {models/_sector/dex => dex/models}/trades/gnosis/platforms/sushiswap_v1_gnosis_base_trades.sql (100%) rename {models/_sector/dex => dex/models}/trades/gnosis/platforms/sushiswap_v2_gnosis_base_trades.sql (100%) rename {models/_sector/dex => dex/models}/trades/linea/_schema.yml (100%) rename {models/_sector/dex => dex/models}/trades/linea/dex_linea_base_trades.sql (100%) rename {models/_sector/dex => dex/models}/trades/linea/platforms/echodex_linea_base_trades.sql (100%) rename {models/_sector/dex => dex/models}/trades/linea/platforms/lynex_linea_base_trades.sql (100%) rename {models/_sector/dex => dex/models}/trades/linea/platforms/nile_linea_base_trades.sql (100%) rename {models/_sector/dex => dex/models}/trades/linea/platforms/pancakeswap_v2_linea_base_trades.sql (100%) rename {models/_sector/dex => dex/models}/trades/linea/platforms/pancakeswap_v3_linea_base_trades.sql (100%) rename {models/_sector/dex => dex/models}/trades/linea/platforms/secta_linea_base_trades.sql (100%) rename {models/_sector/dex => dex/models}/trades/linea/platforms/sushiswap_v2_linea_base_trades.sql (100%) rename {models/_sector/dex => dex/models}/trades/optimism/_schema.yml (100%) rename {models/_sector/dex => dex/models}/trades/optimism/dex_optimism_base_trades.sql (100%) rename {models/_sector/dex => dex/models}/trades/optimism/platforms/balancer_v2_optimism_base_trades.sql (100%) rename {models/_sector/dex => dex/models}/trades/optimism/platforms/chainhop_optimism_base_trades.sql (100%) rename {models/_sector/dex => dex/models}/trades/optimism/platforms/clipper_optimism_base_trades.sql (100%) rename {models/_sector/dex => dex/models}/trades/optimism/platforms/curvefi_optimism_base_trades.sql (100%) rename {models/_sector/dex => dex/models}/trades/optimism/platforms/dackieswap_v2_optimism_base_trades.sql (100%) rename {models/_sector/dex => dex/models}/trades/optimism/platforms/dackieswap_v3_optimism_base_trades.sql (100%) rename {models/_sector/dex => dex/models}/trades/optimism/platforms/dodo_optimism_base_trades.sql (100%) rename {models/_sector/dex => dex/models}/trades/optimism/platforms/elk_finance_optimism_base_trades.sql (100%) rename {models/_sector/dex => dex/models}/trades/optimism/platforms/fraxswap_optimism_base_trades.sql (100%) rename {models/_sector/dex => dex/models}/trades/optimism/platforms/gridex_optimism_base_trades.sql (100%) rename {models/_sector/dex => dex/models}/trades/optimism/platforms/hashflow_optimism_base_trades.sql (100%) rename {models/_sector/dex => dex/models}/trades/optimism/platforms/kyberswap_optimism_base_trades.sql (100%) rename {models/_sector/dex => dex/models}/trades/optimism/platforms/mummy_finance_optimism_base_trades.sql (100%) rename {models/_sector/dex => dex/models}/trades/optimism/platforms/openocean_optimism_base_trades.sql (100%) rename {models/_sector/dex => dex/models}/trades/optimism/platforms/openxswap_optimism_base_trades.sql (100%) rename {models/_sector/dex => dex/models}/trades/optimism/platforms/opx_finance_optimism_base_trades.sql (100%) rename {models/_sector/dex => dex/models}/trades/optimism/platforms/rubicon_optimism_base_trades.sql (100%) rename {models/_sector/dex => dex/models}/trades/optimism/platforms/solidly_v3_optimism_base_trades.sql (100%) rename {models/_sector/dex => dex/models}/trades/optimism/platforms/sushiswap_v1_optimism_base_trades.sql (100%) rename {models/_sector/dex => dex/models}/trades/optimism/platforms/sushiswap_v2_optimism_base_trades.sql (100%) rename {models/_sector/dex => dex/models}/trades/optimism/platforms/synthetix_optimism_base_trades.sql (100%) rename {models/_sector/dex => dex/models}/trades/optimism/platforms/uniswap_v2_optimism_base_trades.sql (100%) rename {models/_sector/dex => dex/models}/trades/optimism/platforms/uniswap_v3_optimism_base_trades.sql (100%) rename {models/_sector/dex => dex/models}/trades/optimism/platforms/velodrome_optimism_base_trades.sql (100%) rename {models/_sector/dex => dex/models}/trades/optimism/platforms/wardenswap_optimism_base_trades.sql (100%) rename {models/_sector/dex => dex/models}/trades/optimism/platforms/wombat_exchange_optimism_base_trades.sql (100%) rename {models/_sector/dex => dex/models}/trades/optimism/platforms/woofi_optimism_base_trades.sql (100%) rename {models/_sector/dex => dex/models}/trades/optimism/platforms/zipswap_optimism_base_trades.sql (100%) rename {models/_sector/dex => dex/models}/trades/polygon/_schema.yml (100%) rename {models/_sector/dex => dex/models}/trades/polygon/dex_polygon_base_trades.sql (100%) rename {models/_sector/dex => dex/models}/trades/polygon/platforms/airswap_polygon_base_trades.sql (100%) rename {models/_sector/dex => dex/models}/trades/polygon/platforms/apeswap_polygon_base_trades.sql (100%) rename {models/_sector/dex => dex/models}/trades/polygon/platforms/balancer_v2_polygon_base_trades.sql (100%) rename {models/_sector/dex => dex/models}/trades/polygon/platforms/clipper_polygon_base_trades.sql (100%) rename {models/_sector/dex => dex/models}/trades/polygon/platforms/dodo_polygon_base_trades.sql (100%) rename {models/_sector/dex => dex/models}/trades/polygon/platforms/dooar_polygon_base_trades.sql (100%) rename {models/_sector/dex => dex/models}/trades/polygon/platforms/fraxswap_polygon_base_trades.sql (100%) rename {models/_sector/dex => dex/models}/trades/polygon/platforms/honeyswap_v2_polygon_base_trades.sql (100%) rename {models/_sector/dex => dex/models}/trades/polygon/platforms/kyberswap_polygon_base_trades.sql (100%) rename {models/_sector/dex => dex/models}/trades/polygon/platforms/quickswap_v2_polygon_base_trades.sql (100%) rename {models/_sector/dex => dex/models}/trades/polygon/platforms/quickswap_v3_polygon_base_trades.sql (100%) rename {models/_sector/dex => dex/models}/trades/polygon/platforms/sushiswap_v1_polygon_base_trades.sql (100%) rename {models/_sector/dex => dex/models}/trades/polygon/platforms/sushiswap_v2_polygon_base_trades.sql (100%) rename {models/_sector/dex => dex/models}/trades/polygon/platforms/uniswap_v2_polygon_base_trades.sql (100%) rename {models/_sector/dex => dex/models}/trades/polygon/platforms/uniswap_v3_polygon_base_trades.sql (100%) rename {models/_sector/dex => dex/models}/trades/polygon/platforms/xchange_polygon_base_trades.sql (100%) rename {models/_sector/dex => dex/models/trades}/readme.md (100%) rename {models/_sector/dex => dex/models}/trades/scroll/_schema.yml (100%) rename {models/_sector/dex => dex/models}/trades/scroll/dex_scroll_base_trades.sql (100%) rename {models/_sector/dex => dex/models}/trades/scroll/platforms/icecreamswap_v2_scroll_base_trades.sql (100%) rename {models/_sector/dex => dex/models}/trades/scroll/platforms/iziswap_scroll_base_trades.sql (100%) rename {models/_sector/dex => dex/models}/trades/scroll/platforms/nuri_scroll_base_trades.sql (100%) rename {models/_sector/dex => dex/models}/trades/scroll/platforms/scrollswap_scroll_base_trades.sql (100%) rename {models/_sector/dex => dex/models}/trades/scroll/platforms/sushiswap_v2_scroll_base_trades.sql (100%) rename {models/_sector/dex => dex/models}/trades/scroll/platforms/syncswap_v1_scroll_base_trades.sql (100%) rename {models/_sector/dex => dex/models}/trades/scroll/platforms/uniswap_v3_scroll_base_trades.sql (100%) rename {models/_sector/dex => dex/models}/trades/scroll/platforms/zebra_scroll_base_trades.sql (100%) rename {models/_sector/dex => dex/models}/trades/zkevm/_schema.yml (100%) rename {models/_sector/dex => dex/models}/trades/zkevm/dex_zkevm_base_trades.sql (100%) rename {models/_sector/dex => dex/models}/trades/zkevm/platforms/balancer_v2_zkevm_base_trades.sql (100%) rename {models/_sector/dex => dex/models}/trades/zkevm/platforms/pancakeswap_v2_zkevm_base_trades.sql (100%) rename {models/_sector/dex => dex/models}/trades/zkevm/platforms/pancakeswap_v3_zkevm_base_trades.sql (100%) rename {models/_sector/dex => dex/models}/trades/zksync/_schema.yml (100%) rename {models/_sector/dex => dex/models}/trades/zksync/dex_zksync_base_trades.sql (100%) rename {models/_sector/dex => dex/models}/trades/zksync/platforms/derpdex_v1_zksync_base_trades.sql (100%) rename {models/_sector/dex => dex/models}/trades/zksync/platforms/dracula_finance_zksync_base_trades.sql (100%) rename {models/_sector/dex => dex/models}/trades/zksync/platforms/ezkalibur_v2_zksync_base_trades.sql (100%) rename {models/_sector/dex => dex/models}/trades/zksync/platforms/gemswap_zksync_base_trades.sql (100%) rename {models/_sector/dex => dex/models}/trades/zksync/platforms/iziswap_v1_zksync_base_trades.sql (100%) rename {models/_sector/dex => dex/models}/trades/zksync/platforms/iziswap_v2_zksync_base_trades.sql (100%) rename {models/_sector/dex => dex/models}/trades/zksync/platforms/maverick_zksync_base_trades.sql (100%) rename {models/_sector/dex => dex/models}/trades/zksync/platforms/mute_zksync_base_trades.sql (100%) rename {models/_sector/dex => dex/models}/trades/zksync/platforms/pancakeswap_v2_zksync_base_trades.sql (100%) rename {models/_sector/dex => dex/models}/trades/zksync/platforms/pancakeswap_v3_zksync_base_trades.sql (100%) rename {models/_sector/dex => dex/models}/trades/zksync/platforms/spacefi_v1_zksync_base_trades.sql (100%) rename {models/_sector/dex => dex/models}/trades/zksync/platforms/syncswap_v1_zksync_base_trades.sql (100%) rename {models/_sector/dex => dex/models}/trades/zksync/platforms/syncswap_v2_zksync_base_trades.sql (100%) rename {models/_sector/dex => dex/models}/trades/zksync/platforms/uniswap_v3_zksync_base_trades.sql (100%) rename {models/_sector/dex => dex/models}/trades/zksync/platforms/velocore_v0_zksync_base_trades.sql (100%) rename {models/_sector/dex => dex/models}/trades/zksync/platforms/velocore_v1_zksync_base_trades.sql (100%) rename {models/_sector/dex => dex/models}/trades/zksync/platforms/velocore_v2_zksync_base_trades.sql (100%) rename {models/_sector/dex => dex/models}/trades/zksync/platforms/vesync_v1_zksync_base_trades.sql (100%) rename {models/_sector/dex => dex/models}/trades/zksync/platforms/wagmi_v1_zksync_base_trades.sql (100%) rename {models/_sector/dex => dex/models}/trades/zksync/platforms/zkswap_finance_zksync_base_trades.sql (100%) rename {models/_sector/dex => dex/models}/trades/zora/_schema.yml (100%) rename {models/_sector/dex => dex/models}/trades/zora/dex_zora_base_trades.sql (100%) rename {models/_sector/dex => dex/models}/trades/zora/platforms/uniswap_v2_zora_base_trades.sql (100%) rename {models/_sector/dex => dex/models}/trades/zora/platforms/uniswap_v3_zora_base_trades.sql (100%) create mode 100644 dex/package-lock.yml create mode 100644 dex/packages.yml create mode 100644 dex/profiles.yml rename {seeds => dex/seeds/_project}/balancer/balancer_transfers_bpt_seed.csv (100%) rename {seeds => dex/seeds/_project}/zeroex/_schema.yml (100%) rename {seeds => dex/seeds/_project}/zeroex/arbitrum/_schema.yml (100%) rename {seeds => dex/seeds/_project}/zeroex/arbitrum/zeroex_arbitrum_api_fills_deduped_sample.csv (100%) rename {seeds => dex/seeds/_project}/zeroex/arbitrum/zeroex_arbitrum_api_fills_sample.csv (100%) rename {seeds => dex/seeds/_project}/zeroex/arbitrum/zeroex_arbitrum_native_fills_sample.csv (100%) rename {seeds => dex/seeds/_project}/zeroex/avalanche_c/_schema.yml (100%) rename {seeds => dex/seeds/_project}/zeroex/avalanche_c/zeroex_avalanche_c_api_fills_deduped_sample.csv (100%) rename {seeds => dex/seeds/_project}/zeroex/avalanche_c/zeroex_avalanche_c_api_fills_sample.csv (100%) rename {seeds => dex/seeds/_project}/zeroex/base/_schema.yml (100%) rename {seeds => dex/seeds/_project}/zeroex/base/zeroex_base_api_fills_sample.csv (100%) rename {seeds => dex/seeds/_project}/zeroex/bnb/_schema.yml (100%) rename {seeds => dex/seeds/_project}/zeroex/bnb/zeroex_bnb_api_fills_deduped_sample.csv (100%) rename {seeds => dex/seeds/_project}/zeroex/bnb/zeroex_bnb_api_fills_sample.csv (100%) rename {seeds => dex/seeds/_project}/zeroex/bnb/zeroex_bnb_native_fills_sample.csv (100%) rename {seeds => dex/seeds/_project}/zeroex/celo/_schema.yml (100%) rename {seeds => dex/seeds/_project}/zeroex/celo/zeroex_celo_api_fills_deduped_sample.csv (100%) rename {seeds => dex/seeds/_project}/zeroex/celo/zeroex_celo_api_fills_sample.csv (100%) rename {seeds => dex/seeds/_project}/zeroex/ethereum/_schema.yml (100%) rename {seeds => dex/seeds/_project}/zeroex/ethereum/zeroex_ethereum_api_fills_deduped_sample.csv (100%) rename {seeds => dex/seeds/_project}/zeroex/ethereum/zeroex_ethereum_api_fills_sample.csv (100%) rename {seeds => dex/seeds/_project}/zeroex/ethereum/zeroex_ethereum_native_fills_sample.csv (100%) rename {seeds => dex/seeds/_project}/zeroex/ethereum/zeroex_ethereum_nft_fills_sample.csv (100%) rename {seeds => dex/seeds/_project}/zeroex/fantom/_schema.yml (100%) rename {seeds => dex/seeds/_project}/zeroex/fantom/zeroex_fantom_api_fills_deduped_sample.csv (100%) rename {seeds => dex/seeds/_project}/zeroex/fantom/zeroex_fantom_api_fills_sample.csv (100%) rename {seeds => dex/seeds/_project}/zeroex/optimism/_schema.yml (100%) rename {seeds => dex/seeds/_project}/zeroex/optimism/zeroex_optimism_api_fills_deduped_sample.csv (100%) rename {seeds => dex/seeds/_project}/zeroex/optimism/zeroex_optimism_api_fills_sample.csv (100%) rename {seeds => dex/seeds/_project}/zeroex/polygon/_schema.yml (100%) rename {seeds => dex/seeds/_project}/zeroex/polygon/zeroex_polygon_api_fills_deduped_sample.csv (100%) rename {seeds => dex/seeds/_project}/zeroex/polygon/zeroex_polygon_api_fills_sample.csv (100%) rename {seeds => dex/seeds/_project}/zeroex/polygon/zeroex_polygon_native_fills_sample.csv (100%) rename {seeds => dex/seeds/_project}/zeroex/polygon/zeroex_polygon_nft_fills_sample.csv (100%) rename {seeds => dex/seeds/_project}/zeroex/zeroex_api_fills_deduped_sample.csv (100%) rename {seeds => dex/seeds/_project}/zeroex/zeroex_api_fills_sample.csv (100%) rename {seeds => dex/seeds/_project}/zeroex/zeroex_native_fills_sample.csv (100%) rename {seeds/dex/aggregator => dex/seeds/aggregator_trades}/_schema.yml (100%) rename {seeds/dex/aggregator => dex/seeds/aggregator_trades}/dex_aggregator_seed.csv (100%) rename {seeds/dex => dex/seeds}/pools/_schema.yml (100%) rename {seeds/dex => dex/seeds}/pools/dex_pools_seed.csv (100%) rename {seeds/_sector/dex => dex/seeds/trades}/_schema.yml (100%) rename {seeds/_sector/dex => dex/seeds/trades}/aerodrome_base_base_trades_seed.csv (100%) rename {seeds/_sector/dex => dex/seeds/trades}/airswap_arbitrum_base_trades_seed.csv (100%) rename {seeds/_sector/dex => dex/seeds/trades}/airswap_avalanche_c_base_trades_seed.csv (100%) rename {seeds/_sector/dex => dex/seeds/trades}/airswap_bnb_base_trades_seed.csv (100%) rename {seeds/_sector/dex => dex/seeds/trades}/airswap_ethereum_base_trades_seed.csv (100%) rename {seeds/_sector/dex => dex/seeds/trades}/airswap_polygon_base_trades_seed.csv (100%) rename {seeds/_sector/dex => dex/seeds/trades}/alienbase_base_base_trades_seed.csv (100%) rename {seeds/_sector/dex => dex/seeds/trades}/apeswap_arbitrum_base_trades_seed.csv (100%) rename {seeds/_sector/dex => dex/seeds/trades}/apeswap_bnb_base_trades_seed.csv (100%) rename {seeds/_sector/dex => dex/seeds/trades}/apeswap_ethereum_base_trades_seed.csv (100%) rename {seeds/_sector/dex => dex/seeds/trades}/apeswap_polygon_base_trades_seed.csv (100%) rename {seeds/_sector/dex => dex/seeds/trades}/arbswap_arbitrum_base_trades_seed.csv (100%) rename {seeds/_sector/dex => dex/seeds/trades}/auragi_arbitrum_base_trades_seed.csv (100%) rename {seeds/_sector/dex => dex/seeds/trades}/autotronic_base_base_trades_seed.csv (100%) rename {seeds/_sector/dex => dex/seeds/trades}/babyswap_bnb_base_trades_seed.csv (100%) rename {seeds/_sector/dex => dex/seeds/trades}/balancer_arbitrum_base_trades_seed.csv (100%) rename {seeds/_sector/dex => dex/seeds/trades}/balancer_avalanche_c_base_trades_seed.csv (100%) rename {seeds/_sector/dex => dex/seeds/trades}/balancer_base_base_trades_seed.csv (100%) rename {seeds/_sector/dex => dex/seeds/trades}/balancer_ethereum_base_trades_seed.csv (100%) rename {seeds/_sector/dex => dex/seeds/trades}/balancer_gnosis_base_trades_seed.csv (100%) rename {seeds/_sector/dex => dex/seeds/trades}/balancer_optimism_base_trades_seed.csv (100%) rename {seeds/_sector/dex => dex/seeds/trades}/balancer_polygon_base_trades_seed.csv (100%) rename {seeds/_sector/dex => dex/seeds/trades}/balancer_zkevm_base_trades_seed.csv (100%) rename {seeds/_sector/dex => dex/seeds/trades}/bancor_ethereum_base_trades_seed.csv (100%) rename {seeds/_sector/dex => dex/seeds/trades}/baseswap_base_base_trades_seed.csv (100%) rename {seeds/_sector/dex => dex/seeds/trades}/baseswap_basex_base_base_trades_seed.csv (100%) rename {seeds/_sector/dex => dex/seeds/trades}/baso_finance_base_base_trades_seed.csv (100%) rename {seeds/_sector/dex => dex/seeds/trades}/beethoven_x_fantom_base_trades_seed.csv (100%) rename {seeds/_sector/dex => dex/seeds/trades}/beethoven_x_optimism_base_trades_seed.csv (100%) rename {seeds/_sector/dex => dex/seeds/trades}/biswap_bnb_base_trades_seed.csv (100%) rename {seeds/_sector/dex => dex/seeds/trades}/camelot_arbitrum_base_trades_seed.csv (100%) rename {seeds/_sector/dex => dex/seeds/trades}/carbon_defi_ethereum_base_trades_seed.csv (100%) rename {seeds/_sector/dex => dex/seeds/trades}/carbonhood_celo_base_trades_seed.csv (100%) rename {seeds/_sector/dex => dex/seeds/trades}/chainhop_optimism_base_trades_seed.csv (100%) rename {seeds/_sector/dex => dex/seeds/trades}/chronos_arbitrum_base_trades_seed.csv (100%) rename {seeds/_sector/dex => dex/seeds/trades}/citadelswap_base_base_trades_seed.csv (100%) rename {seeds/_sector/dex => dex/seeds/trades}/clipper_arbitrum_base_trades_seed.csv (100%) rename {seeds/_sector/dex => dex/seeds/trades}/clipper_base_base_trades_seed.csv (100%) rename {seeds/_sector/dex => dex/seeds/trades}/clipper_ethereum_base_trades_seed.csv (100%) rename {seeds/_sector/dex => dex/seeds/trades}/clipper_optimism_base_trades_seed.csv (100%) rename {seeds/_sector/dex => dex/seeds/trades}/clipper_polygon_base_trades_seed.csv (100%) rename {seeds/_sector/dex => dex/seeds/trades}/crescentswap_base_base_trades_seed.csv (100%) rename {seeds/_sector/dex => dex/seeds/trades}/curvefi_avalanche_c_base_trades_seed.csv (100%) rename {seeds/_sector/dex => dex/seeds/trades}/curvefi_celo_base_trades_seed.csv (100%) rename {seeds/_sector/dex => dex/seeds/trades}/curvefi_ethereum_base_trades_seed.csv (100%) rename {seeds/_sector/dex => dex/seeds/trades}/curvefi_fantom_base_trades_seed.csv (100%) rename {seeds/_sector/dex => dex/seeds/trades}/curvefi_optimism_base_trades_seed.csv (100%) rename {seeds/_sector/dex => dex/seeds/trades}/dackieswap_base_base_trades_seed.csv (100%) rename {seeds/_sector/dex => dex/seeds/trades}/dackieswap_v2_optimism_base_trades_seed.csv (100%) rename {seeds/_sector/dex => dex/seeds/trades}/dackieswap_v3_optimism_base_trades_seed.csv (100%) rename {seeds/_sector/dex => dex/seeds/trades}/defiswap_ethereum_base_trades_seed.csv (100%) rename {seeds/_sector/dex => dex/seeds/trades}/derpdex_base_base_trades_seed.csv (100%) rename {seeds/_sector/dex => dex/seeds/trades}/derpdex_zksync_base_trades_seed.csv (100%) rename {seeds/_sector/dex => dex/seeds/trades}/dfx_ethereum_base_trades_seed.csv (100%) rename {seeds/_sector/dex => dex/seeds/trades}/dodo_arbitrum_base_trades_seed.csv (100%) rename {seeds/_sector/dex => dex/seeds/trades}/dodo_base_base_trades_seed.csv (100%) rename {seeds/_sector/dex => dex/seeds/trades}/dodo_bnb_base_trades_seed.csv (100%) rename {seeds/_sector/dex => dex/seeds/trades}/dodo_ethereum_base_trades_seed.csv (100%) rename {seeds/_sector/dex => dex/seeds/trades}/dodo_optimism_base_trades_seed.csv (100%) rename {seeds/_sector/dex => dex/seeds/trades}/dodo_polygon_base_trades_seed.csv (100%) rename {seeds/_sector/dex => dex/seeds/trades}/dooar_polygon_base_trades_seed.csv (100%) rename {seeds/_sector/dex => dex/seeds/trades}/dracula_finance_zksync_base_trades_seed.csv (100%) rename {seeds/_sector/dex => dex/seeds/trades}/echodex_linea_base_trades_seed.csv (100%) rename {seeds/_sector/dex => dex/seeds/trades}/elk_finance_base_base_trades_seed.csv (100%) rename {seeds/_sector/dex => dex/seeds/trades}/elk_finance_optimism_base_trades_seed.csv (100%) rename {seeds/_sector/dex => dex/seeds/trades}/ellipsis_finance_bnb_base_trades_seed.csv (100%) rename {seeds/_sector/dex => dex/seeds/trades}/energon_base_base_trades_seed.csv (100%) rename {seeds/_sector/dex => dex/seeds/trades}/equalizer_fantom_base_trades_seed.csv (100%) rename {seeds/_sector/dex => dex/seeds/trades}/ezkalibur_zksync_base_trades_seed.csv (100%) rename {seeds/_sector/dex => dex/seeds/trades}/fraxswap_arbitrum_base_trades_seed.csv (100%) rename {seeds/_sector/dex => dex/seeds/trades}/fraxswap_avalanche_c_base_trades_seed.csv (100%) rename {seeds/_sector/dex => dex/seeds/trades}/fraxswap_bnb_base_trades_seed.csv (100%) rename {seeds/_sector/dex => dex/seeds/trades}/fraxswap_ethereum_base_trades_seed.csv (100%) rename {seeds/_sector/dex => dex/seeds/trades}/fraxswap_optimism_base_trades_seed.csv (100%) rename {seeds/_sector/dex => dex/seeds/trades}/fraxswap_polygon_base_trades_seed.csv (100%) rename {seeds/_sector/dex => dex/seeds/trades}/gemswap_zksync_base_trades_seed.csv (100%) rename {seeds/_sector/dex => dex/seeds/trades}/glacier_avalanche_c_base_trades_seed.csv (100%) rename {seeds/_sector/dex => dex/seeds/trades}/gmx_arbitrum_base_trades_seed.csv (100%) rename {seeds/_sector/dex => dex/seeds/trades}/gmx_avalanche_c_base_trades_seed.csv (100%) rename {seeds/_sector/dex => dex/seeds/trades}/gridex_arbitrum_base_trades_seed.csv (100%) rename {seeds/_sector/dex => dex/seeds/trades}/gridex_base_base_trades_seed.csv (100%) rename {seeds/_sector/dex => dex/seeds/trades}/gridex_optimism_base_trades_seed.csv (100%) rename {seeds/_sector/dex => dex/seeds/trades}/hashflow_avalanche_c_base_trades_seed.csv (100%) rename {seeds/_sector/dex => dex/seeds/trades}/hashflow_bnb_base_trades_seed.csv (100%) rename {seeds/_sector/dex => dex/seeds/trades}/hashflow_ethereum_base_trades_seed.csv (100%) rename {seeds/_sector/dex => dex/seeds/trades}/hashflow_optimism_base_trades_seed.csv (100%) rename {seeds/_sector/dex => dex/seeds/trades}/honeyswap_gnosis_base_trades_seed.csv (100%) rename {seeds/_sector/dex => dex/seeds/trades}/honeyswap_polygon_base_trades_seed.csv (100%) rename {seeds/_sector/dex => dex/seeds/trades}/horizondex_base_base_trades_seed.csv (100%) rename {seeds/_sector/dex => dex/seeds/trades}/icecreamswap_base_base_trades_seed.csv (100%) rename {seeds/_sector/dex => dex/seeds/trades}/icecreamswap_v2_scroll_base_trades_seed.csv (100%) rename {seeds/_sector/dex => dex/seeds/trades}/integral_arbitrum_base_trades_seed.csv (100%) rename {seeds/_sector/dex => dex/seeds/trades}/integral_ethereum_base_trades_seed.csv (100%) rename {seeds/_sector/dex => dex/seeds/trades}/iziswap_bnb_base_trades_seed.csv (100%) rename {seeds/_sector/dex => dex/seeds/trades}/iziswap_scroll_base_trades_seed.csv (100%) rename {seeds/_sector/dex => dex/seeds/trades}/iziswap_zksync_base_trades_seed.csv (100%) rename {seeds/_sector/dex => dex/seeds/trades}/kyberswap_arbitrum_base_trades_seed.csv (100%) rename {seeds/_sector/dex => dex/seeds/trades}/kyberswap_avalanche_c_base_trades_seed.csv (100%) rename {seeds/_sector/dex => dex/seeds/trades}/kyberswap_base_base_trades_seed.csv (100%) rename {seeds/_sector/dex => dex/seeds/trades}/kyberswap_bnb_base_trades_seed.csv (100%) rename {seeds/_sector/dex => dex/seeds/trades}/kyberswap_ethereum_base_trades_seed.csv (100%) rename {seeds/_sector/dex => dex/seeds/trades}/kyberswap_optimism_base_trades_seed.csv (100%) rename {seeds/_sector/dex => dex/seeds/trades}/kyberswap_polygon_base_trades_seed.csv (100%) rename {seeds/_sector/dex => dex/seeds/trades}/leetswap_v2_base_base_trades_seed.csv (100%) rename {seeds/_sector/dex => dex/seeds/trades}/lynex_linea_base_trades_seed.csv (100%) rename {seeds/_sector/dex => dex/seeds/trades}/mauve_ethereum_base_trades_seed.csv (100%) rename {seeds/_sector/dex => dex/seeds/trades}/maverick_base_base_trades_seed.csv (100%) rename {seeds/_sector/dex => dex/seeds/trades}/maverick_bnb_base_trades_seed.csv (100%) rename {seeds/_sector/dex => dex/seeds/trades}/maverick_ethereum_base_trades_seed.csv (100%) rename {seeds/_sector/dex => dex/seeds/trades}/maverick_zksync_base_trades_seed.csv (100%) rename {seeds/_sector/dex => dex/seeds/trades}/mdex_bnb_base_trades_seed.csv (100%) rename {seeds/_sector/dex => dex/seeds/trades}/mento_celo_base_trades_seed.csv (100%) rename {seeds/_sector/dex => dex/seeds/trades}/moonbase_base_base_trades_seed.csv (100%) rename {seeds/_sector/dex => dex/seeds/trades}/mstable_ethereum_base_trades_seed.csv (100%) rename {seeds/_sector/dex => dex/seeds/trades}/mummy_finance_optimism_base_trades_seed.csv (100%) rename {seeds/_sector/dex => dex/seeds/trades}/mute_zksync_base_trades_seed.csv (100%) rename {seeds/_sector/dex => dex/seeds/trades}/nile_linea_base_trades_seed.csv (100%) rename {seeds/_sector/dex => dex/seeds/trades}/nomiswap_bnb_base_trades_seed.csv (100%) rename {seeds/_sector/dex => dex/seeds/trades}/nuri_scroll_base_trades_seed.csv (100%) rename {seeds/_sector/dex => dex/seeds/trades}/oasisswap_arbitrum_base_trades_seed.csv (100%) rename {seeds/_sector/dex => dex/seeds/trades}/oasisswap_base_base_trades_seed.csv (100%) rename {seeds/_sector/dex => dex/seeds/trades}/oneinch_arbitrum_base_trades_seed.csv (100%) rename {seeds/_sector/dex => dex/seeds/trades}/oneinch_avalanche_c_base_trades_seed.csv (100%) rename {seeds/_sector/dex => dex/seeds/trades}/oneinch_base_base_trades_seed.csv (100%) rename {seeds/_sector/dex => dex/seeds/trades}/oneinch_bnb_base_trades_seed.csv (100%) rename {seeds/_sector/dex => dex/seeds/trades}/oneinch_ethereum_base_trades_seed.csv (100%) rename {seeds/_sector/dex => dex/seeds/trades}/oneinch_fantom_base_trades_seed.csv (100%) rename {seeds/_sector/dex => dex/seeds/trades}/oneinch_gnosis_base_trades_seed.csv (100%) rename {seeds/_sector/dex => dex/seeds/trades}/oneinch_optimism_base_trades_seed.csv (100%) rename {seeds/_sector/dex => dex/seeds/trades}/oneinch_polygon_base_trades_seed.csv (100%) rename {seeds/_sector/dex => dex/seeds/trades}/oneinch_zksync_base_trades_seed.csv (100%) rename {seeds/_sector/dex => dex/seeds/trades}/onepunchswap_bnb_base_trades_seed.csv (100%) rename {seeds/_sector/dex => dex/seeds/trades}/openocean_avalanche_c_base_trades_seed.csv (100%) rename {seeds/_sector/dex => dex/seeds/trades}/openocean_base_base_trades_seed.csv (100%) rename {seeds/_sector/dex => dex/seeds/trades}/openocean_fantom_base_trades_seed.csv (100%) rename {seeds/_sector/dex => dex/seeds/trades}/openocean_optimism_base_trades_seed.csv (100%) rename {seeds/_sector/dex => dex/seeds/trades}/openxswap_optimism_base_trades_seed.csv (100%) rename {seeds/_sector/dex => dex/seeds/trades}/opx_finance_optimism_base_trades_seed.csv (100%) rename {seeds/_sector/dex => dex/seeds/trades}/pancakeswap_arbitrum_base_trades_seed.csv (100%) rename {seeds/_sector/dex => dex/seeds/trades}/pancakeswap_base_base_trades_seed.csv (100%) rename {seeds/_sector/dex => dex/seeds/trades}/pancakeswap_bnb_base_trades_seed.csv (100%) rename {seeds/_sector/dex => dex/seeds/trades}/pancakeswap_ethereum_base_trades_seed.csv (100%) rename {seeds/_sector/dex => dex/seeds/trades}/pancakeswap_linea_base_trades_seed.csv (100%) rename {seeds/_sector/dex => dex/seeds/trades}/pancakeswap_zkevm_base_trades_seed.csv (100%) rename {seeds/_sector/dex => dex/seeds/trades}/pancakeswap_zksync_base_trades_seed.csv (100%) rename {seeds/_sector/dex => dex/seeds/trades}/pharaoh_avalanche_c_base_trades_seed.csv (100%) rename {seeds/_sector/dex => dex/seeds/trades}/plantbaseswap_base_base_trades_seed.csv (100%) rename {seeds/_sector/dex => dex/seeds/trades}/platypus_finance_avalanche_c_base_trades_seed.csv (100%) rename {seeds/_sector/dex => dex/seeds/trades}/quickswap_polygon_base_trades_seed.csv (100%) rename {seeds/_sector/dex => dex/seeds/trades}/ramses_arbitrum_base_trades_seed.csv (100%) rename {seeds/_sector/dex => dex/seeds/trades}/rocketswap_base_base_trades_seed.csv (100%) rename {seeds/_sector/dex => dex/seeds/trades}/rubicon_arbitrum_base_trades_seed.csv (100%) rename {seeds/_sector/dex => dex/seeds/trades}/rubicon_base_base_trades_seed.csv (100%) rename {seeds/_sector/dex => dex/seeds/trades}/rubicon_optimism_base_trades_seed.csv (100%) rename {seeds/_sector/dex => dex/seeds/trades}/scale_base_base_trades_seed.csv (100%) rename {seeds/_sector/dex => dex/seeds/trades}/scrollswap_scroll_base_trades_seed.csv (100%) rename {seeds/_sector/dex => dex/seeds/trades}/secta_linea_base_trades_seed.csv (100%) rename {seeds/_sector/dex => dex/seeds/trades}/sharkswap_base_base_trades_seed.csv (100%) rename {seeds/_sector/dex => dex/seeds/trades}/sharkyswap_arbitrum_base_trades_seed.csv (100%) rename {seeds/_sector/dex => dex/seeds/trades}/shibaswap_ethereum_base_trades_seed.csv (100%) rename {seeds/_sector/dex => dex/seeds/trades}/smardex_arbitrum_base_trades_seed.csv (100%) rename {seeds/_sector/dex => dex/seeds/trades}/smardex_base_base_trades_seed.csv (100%) rename {seeds/_sector/dex => dex/seeds/trades}/sobal_base_base_trades_seed.csv (100%) rename {seeds/_sector/dex => dex/seeds/trades}/solidlizard_arbitrum_base_trades_seed.csv (100%) rename {seeds/_sector/dex => dex/seeds/trades}/solidly_base_base_trades_seed.csv (100%) rename {seeds/_sector/dex => dex/seeds/trades}/solidly_v3_arbitrum_base_trades_seed.csv (100%) rename {seeds/_sector/dex => dex/seeds/trades}/solidly_v3_base_base_trades_seed.csv (100%) rename {seeds/_sector/dex => dex/seeds/trades}/solidly_v3_ethereum_base_trades_seed.csv (100%) rename {seeds/_sector/dex => dex/seeds/trades}/solidly_v3_fantom_base_trades_seed.csv (100%) rename {seeds/_sector/dex => dex/seeds/trades}/solidly_v3_optimism_base_trades_seed.csv (100%) rename {seeds/_sector/dex => dex/seeds/trades}/soswap_base_base_trades_seed.csv (100%) rename {seeds/_sector/dex => dex/seeds/trades}/spacefi_zksync_base_trades_seed.csv (100%) rename {seeds/_sector/dex => dex/seeds/trades}/spartacus_exchange_fantom_base_trades_seed.csv (100%) rename {seeds/_sector/dex => dex/seeds/trades}/spiritswap_fantom_base_trades_seed.csv (100%) rename {seeds/_sector/dex => dex/seeds/trades}/spookyswap_fantom_base_trades_seed.csv (100%) rename {seeds/_sector/dex => dex/seeds/trades}/sterling_finance_arbitrum_base_trades_seed.csv (100%) rename {seeds/_sector/dex => dex/seeds/trades}/sushiswap_arbitrum_base_trades_seed.csv (100%) rename {seeds/_sector/dex => dex/seeds/trades}/sushiswap_avalanche_c_base_trades_seed.csv (100%) rename {seeds/_sector/dex => dex/seeds/trades}/sushiswap_base_base_trades_seed.csv (100%) rename {seeds/_sector/dex => dex/seeds/trades}/sushiswap_bnb_base_trades_seed.csv (100%) rename {seeds/_sector/dex => dex/seeds/trades}/sushiswap_celo_base_trades_seed.csv (100%) rename {seeds/_sector/dex => dex/seeds/trades}/sushiswap_ethereum_base_trades_seed.csv (100%) rename {seeds/_sector/dex => dex/seeds/trades}/sushiswap_fantom_base_trades_seed.csv (100%) rename {seeds/_sector/dex => dex/seeds/trades}/sushiswap_gnosis_base_trades_seed.csv (100%) rename {seeds/_sector/dex => dex/seeds/trades}/sushiswap_linea_base_trades_seed.csv (100%) rename {seeds/_sector/dex => dex/seeds/trades}/sushiswap_optimism_base_trades_seed.csv (100%) rename {seeds/_sector/dex => dex/seeds/trades}/sushiswap_polygon_base_trades_seed.csv (100%) rename {seeds/_sector/dex => dex/seeds/trades}/sushiswap_scroll_base_trades_seed.csv (100%) rename {seeds/_sector/dex => dex/seeds/trades}/swaap_v2_arbitrum_base_trades_seed.csv (100%) rename {seeds/_sector/dex => dex/seeds/trades}/swapbased_base_base_trades_seed.csv (100%) rename {seeds/_sector/dex => dex/seeds/trades}/swapr_ethereum_base_trades_seed.csv (100%) rename {seeds/_sector/dex => dex/seeds/trades}/syncswap_scroll_base_trades_seed.csv (100%) rename {seeds/_sector/dex => dex/seeds/trades}/syncswap_zksync_base_trades_seed.csv (100%) rename {seeds/_sector/dex => dex/seeds/trades}/synthetix_optimism_base_trades_seed.csv (100%) rename {seeds/_sector/dex => dex/seeds/trades}/synthswap_base_base_trades_seed.csv (100%) rename {seeds/_sector/dex => dex/seeds/trades}/thena_bnb_base_trades_seed.csv (100%) rename {seeds/_sector/dex => dex/seeds/trades}/throne_exchange_v2_base_base_trades_seed.csv (100%) rename {seeds/_sector/dex => dex/seeds/trades}/throne_exchange_v3_base_base_trades_seed.csv (100%) rename {seeds/_sector/dex => dex/seeds/trades}/torus_base_base_trades_seed.csv (100%) rename {seeds/_sector/dex => dex/seeds/trades}/trader_joe_arbitrum_base_trades_seed.csv (100%) rename {seeds/_sector/dex => dex/seeds/trades}/trader_joe_avalanche_c_base_trades_seed.csv (100%) rename {seeds/_sector/dex => dex/seeds/trades}/trader_joe_bnb_base_trades_seed.csv (100%) rename {seeds/_sector/dex => dex/seeds/trades}/ubeswap_celo_base_trades_seed.csv (100%) rename {seeds/_sector/dex => dex/seeds/trades}/uniswap_arbitrum_base_trades_seed.csv (100%) rename {seeds/_sector/dex => dex/seeds/trades}/uniswap_avalanche_c_base_trades_seed.csv (100%) rename {seeds/_sector/dex => dex/seeds/trades}/uniswap_base_base_trades_seed.csv (100%) rename {seeds/_sector/dex => dex/seeds/trades}/uniswap_bnb_base_trades_seed.csv (100%) rename {seeds/_sector/dex => dex/seeds/trades}/uniswap_celo_base_trades_seed.csv (100%) rename {seeds/_sector/dex => dex/seeds/trades}/uniswap_ethereum_base_trades_seed.csv (100%) rename {seeds/_sector/dex => dex/seeds/trades}/uniswap_optimism_base_trades_seed.csv (100%) rename {seeds/_sector/dex => dex/seeds/trades}/uniswap_polygon_base_trades_seed.csv (100%) rename {seeds/_sector/dex => dex/seeds/trades}/uniswap_scroll_base_trades_seed.csv (100%) rename {seeds/_sector/dex => dex/seeds/trades}/uniswap_zksync_base_trades_seed.csv (100%) rename {seeds/_sector/dex => dex/seeds/trades}/uniswap_zora_base_trades_seed.csv (100%) rename {seeds/_sector/dex => dex/seeds/trades}/velocimeter_v2_base_base_trades_seed.csv (100%) rename {seeds/_sector/dex => dex/seeds/trades}/velocore_zksync_base_trades_seed.csv (100%) rename {seeds/_sector/dex => dex/seeds/trades}/velodrome_optimism_base_trades_seed.csv (100%) rename {seeds/_sector/dex => dex/seeds/trades}/verse_dex_ethereum_base_trades_seed.csv (100%) rename {seeds/_sector/dex => dex/seeds/trades}/vesync_zksync_base_trades_seed.csv (100%) rename {seeds/_sector/dex => dex/seeds/trades}/voltswap_base_base_trades_seed.csv (100%) rename {seeds/_sector/dex => dex/seeds/trades}/wagmi_zksync_base_trades_seed.csv (100%) rename {seeds/_sector/dex => dex/seeds/trades}/wardenswap_optimism_base_trades_seed.csv (100%) rename {seeds/_sector/dex => dex/seeds/trades}/wigoswap_fantom_base_trades_seed.csv (100%) rename {seeds/_sector/dex => dex/seeds/trades}/wombat_bnb_base_trades_seed.csv (100%) rename {seeds/_sector/dex => dex/seeds/trades}/wombat_exchange_arbitrum_base_trades_seed.csv (100%) rename {seeds/_sector/dex => dex/seeds/trades}/wombat_exchange_base_base_trades_seed.csv (100%) rename {seeds/_sector/dex => dex/seeds/trades}/wombat_exchange_optimism_base_trades_seed.csv (100%) rename {seeds/_sector/dex => dex/seeds/trades}/woofi_arbitrum_base_trades_seed.csv (100%) rename {seeds/_sector/dex => dex/seeds/trades}/woofi_avalanche_c_base_trades_seed.csv (100%) rename {seeds/_sector/dex => dex/seeds/trades}/woofi_base_base_trades_seed.csv (100%) rename {seeds/_sector/dex => dex/seeds/trades}/woofi_bnb_base_trades_seed.csv (100%) rename {seeds/_sector/dex => dex/seeds/trades}/woofi_optimism_base_trades_seed.csv (100%) rename {seeds/_sector/dex => dex/seeds/trades}/xchange_arbitrum_base_trades_seed.csv (100%) rename {seeds/_sector/dex => dex/seeds/trades}/xchange_bnb_base_trades_seed.csv (100%) rename {seeds/_sector/dex => dex/seeds/trades}/xchange_ethereum_base_trades_seed.csv (100%) rename {seeds/_sector/dex => dex/seeds/trades}/xchange_polygon_base_trades_seed.csv (100%) rename {seeds/_sector/dex => dex/seeds/trades}/zebra_scroll_base_trades_seed.csv (100%) rename {seeds/_sector/dex => dex/seeds/trades}/zigzag_arbitrum_base_trades_seed.csv (100%) rename {seeds/_sector/dex => dex/seeds/trades}/zipswap_optimism_base_trades_seed.csv (100%) rename {seeds/_sector/dex => dex/seeds/trades}/zkswap_finance_zksync_base_trades_seed.csv (100%) rename {seeds/_sector/dex => dex/seeds/trades}/zyberswap_arbitrum_base_trades_seed.csv (100%) rename {tests => dex/tests}/generic/check_dex_aggregator_seed.sql (100%) rename {tests => dex/tests}/generic/check_dex_base_trades_seed.sql (100%) rename {tests => dex/tests}/generic/check_dex_info_relationship.sql (100%) rename {tests => dex/tests}/generic/check_dex_pools_seed.sql (100%) rename {tests/generic/ethereum => dex/tests/generic}/zeroex_ethereum_fills_deduped_test.sql (100%) rename {tests/generic/ethereum => dex/tests/generic}/zeroex_ethereum_fills_test.sql (100%) rename {tests/generic/ethereum => dex/tests/generic}/zeroex_ethereum_nft_test.sql (100%) create mode 100644 models/_project/oneinch/_schema.yml rename models/{oneinch/ethereum => _project/oneinch}/oneinch_ethereum_airdrop_claims.sql (100%) create mode 100644 models/_project/uniswap/arbitrum/uniswap_arbitrum_schema.yml rename models/{ => _project}/uniswap/arbitrum/uniswap_v3_arbitrum_flashloans.sql (100%) create mode 100644 models/_project/uniswap/bnb/uniswap_bnb_schema.yml rename models/{ => _project}/uniswap/bnb/uniswap_v3_bnb_flashloans.sql (100%) create mode 100644 models/_project/uniswap/celo/uniswap_celo_schema.yml rename models/{ => _project}/uniswap/celo/uniswap_v3_celo_flashloans.sql (81%) rename models/{ => _project}/uniswap/ethereum/uniswap_ethereum_airdrop_claims.sql (98%) create mode 100644 models/_project/uniswap/ethereum/uniswap_ethereum_schema.yml rename models/{ => _project}/uniswap/ethereum/uniswap_v3_ethereum_flashloans.sql (100%) rename models/{ => _project}/uniswap/ethereum/uniswap_v3_ethereum_proposals.sql (100%) rename models/{ => _project}/uniswap/ethereum/uniswap_v3_ethereum_votes.sql (100%) create mode 100644 models/_project/uniswap/optimism/uniswap_optimism_schema.yml rename models/{ => _project}/uniswap/optimism/uniswap_v3_optimism_flashloans.sql (100%) create mode 100644 models/_project/uniswap/polygon/uniswap_polygon_schema.yml rename models/{ => _project}/uniswap/polygon/uniswap_v3_polygon_flashloans.sql (100%) rename models/{ => _project}/uniswap/uniswap_flashloans.sql (97%) create mode 100644 models/_project/uniswap/uniswap_schema.yml delete mode 100644 models/cow_protocol/arbitrum/cow_protocol_arbitrum_schema.yml delete mode 100644 models/dex/arbitrum/_schema.yml delete mode 100644 models/dex/base/_schema.yml delete mode 100644 models/dex/bnb/_schema.yml delete mode 100644 models/dex/ethereum/_schema.yml delete mode 100644 models/dex/optimism/_schema.yml delete mode 100644 models/dex/polygon/_schema.yml delete mode 100644 models/hashflow/ethereum/hashflow_ethereum_raw_trades.sql delete mode 100644 models/hashflow/ethereum/hashflow_ethereum_trades.sql delete mode 100644 models/labels/addresses/__single_category_labels__/balancer_v1/labels_balancer_v1_schema.yml create mode 100644 models/paraswap/_schema.yml rename models/paraswap/{ethereum => }/paraswap_ethereum_airdrop_claims.sql (95%) delete mode 100644 models/pharaoh/pharaoh_avalanche_c_trades.sql delete mode 100644 models/uniswap/arbitrum/uniswap_arbitrum_schema.yml delete mode 100644 models/uniswap/arbitrum/uniswap_arbitrum_trades.sql delete mode 100644 models/uniswap/arbitrum/uniswap_v3_arbitrum_trades.sql delete mode 100644 models/uniswap/avalanche_c/uniswap_avalanche_c_trades.sql delete mode 100644 models/uniswap/avalanche_c/uniswap_v3_avalanche_c_trades.sql delete mode 100644 models/uniswap/base/uniswap_base_trades.sql delete mode 100644 models/uniswap/base/uniswap_v3_base_trades.sql delete mode 100644 models/uniswap/bnb/uniswap_bnb_schema.yml delete mode 100644 models/uniswap/bnb/uniswap_bnb_trades.sql delete mode 100644 models/uniswap/bnb/uniswap_v3_bnb_trades.sql delete mode 100644 models/uniswap/celo/uniswap_celo_schema.yml delete mode 100644 models/uniswap/celo/uniswap_celo_trades.sql delete mode 100644 models/uniswap/celo/uniswap_v3_celo_trades.sql delete mode 100644 models/uniswap/ethereum/uniswap_ethereum_schema.yml delete mode 100644 models/uniswap/ethereum/uniswap_ethereum_trades.sql delete mode 100644 models/uniswap/ethereum/uniswap_v1_ethereum_trades.sql delete mode 100644 models/uniswap/ethereum/uniswap_v2_ethereum_trades.sql delete mode 100644 models/uniswap/ethereum/uniswap_v3_ethereum_trades.sql delete mode 100644 models/uniswap/optimism/uniswap_optimism_schema.yml delete mode 100644 models/uniswap/optimism/uniswap_optimism_trades.sql delete mode 100644 models/uniswap/optimism/uniswap_v3_optimism_trades.sql delete mode 100644 models/uniswap/polygon/uniswap_polygon_schema.yml delete mode 100644 models/uniswap/polygon/uniswap_polygon_trades.sql delete mode 100644 models/uniswap/polygon/uniswap_v3_polygon_trades.sql delete mode 100644 models/uniswap/uniswap_schema.yml delete mode 100644 seeds/curvefi/ethereum/curvefi_ethereum_view_pools_postgres.csv delete mode 100644 seeds/dex/trades/_schema.yml delete mode 100644 seeds/dex/trades/dex_trades_seed.csv create mode 100644 sources/_subprojects/dex/_sources.yml delete mode 100644 tests/cow_protocol/ethereum/cow_protocol_ethereum_assert_batches.sql delete mode 100644 tests/cow_protocol/ethereum/cow_protocol_ethereum_assert_order_type.sql delete mode 100644 tests/cow_protocol/ethereum/cow_protocol_ethereum_assert_partial_fill.sql delete mode 100644 tests/cow_protocol/ethereum/cow_protocol_ethereum_assert_slippage.sql delete mode 100644 tests/cow_protocol/ethereum/cow_protocol_ethereum_assert_solvers.sql delete mode 100644 tests/cow_protocol/ethereum/cow_protocol_ethereum_assert_trades.sql delete mode 100644 tests/cow_protocol/gnosis/cow_protocol_gnosis_assert_solvers.sql delete mode 100644 tests/generic/check_dex_seed.sql delete mode 100644 tests/generic/dex_trades_token_bought.sql diff --git a/.github/workflows/commit_manifest.yml b/.github/workflows/commit_manifest.yml index 0942ff31823..2be7adc44ca 100644 --- a/.github/workflows/commit_manifest.yml +++ b/.github/workflows/commit_manifest.yml @@ -15,7 +15,7 @@ jobs: runs-on: [ self-hosted, linux, spellbook-trino-ci ] strategy: matrix: - project: [ 'tokens', 'spellbook', 'daily_spellbook', 'nft'] + project: [ 'tokens', 'spellbook', 'daily_spellbook', 'nft', 'dex'] max-parallel: 1 steps: diff --git a/.github/workflows/dex.yml b/.github/workflows/dex.yml new file mode 100644 index 00000000000..b07bfe52003 --- /dev/null +++ b/.github/workflows/dex.yml @@ -0,0 +1,19 @@ +name: DBT DEX sector run + +on: + workflow_dispatch: + pull_request: + paths: + - dex/** + - .github/workflows/dex.yml + - .github/workflows/dbt_run.yml + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + +jobs: + dbt-run: + uses: ./.github/workflows/dbt_run.yml + with: + project: 'dex' \ No newline at end of file diff --git a/dbt_project.yml b/dbt_project.yml index 73cb2738b7e..fd0c179ce0d 100644 --- a/dbt_project.yml +++ b/dbt_project.yml @@ -86,23 +86,6 @@ models: bitcoin: +schema: cex_bitcoin - uniswap: - +schema: uniswap - arbitrum: - +schema: uniswap_arbitrum - ethereum: - +schema: uniswap_ethereum - optimism: - +schema: uniswap_optimism - polygon: - +schema: uniswap_polygon - bnb: - +schema: uniswap_bnb - base: - +schema: uniswap_base - celo: - +schema: uniswap_celo - balances: +schema: balances ethereum: @@ -114,21 +97,6 @@ models: polygon: +schema: balances_polygon - dodo: - +schema: dodo - ethereum: - +schema: dodo_ethereum - bnb: - +schema: dodo_bnb - polygon: - +schema: dodo_polygon - arbitrum: - +schema: dodo_arbitrum - optimism: - +schema: dodo_optimism - base: - +schema: dodo_base - labels: +schema: labels +materialized: table @@ -150,11 +118,6 @@ models: solana_utils: +schema: solana_utils - odos: - +schema: odos - avalanche_c: - +schema: odos_avalanche_c - transfers: +schema: transfers ethereum: @@ -200,13 +163,6 @@ models: base: +schema: safe_base - lifi: - +schema: lifi - fantom: - +schema: lifi_fantom - optimism: - +schema: lifi_optimism - aragon: +schema: aragon ethereum: @@ -220,11 +176,6 @@ models: arbitrum: +schema: aragon_arbitrum - spiritswap: - +schema: spiritswap - fantom: - +schema: spiritswap_fantom - jarvis_network: +schema: jarvis_network polygon: @@ -240,11 +191,6 @@ models: bnb: +schema: spaceid_bnb - spartacus_exchange: - +schema: spartacus_exchange - fantom: - +schema: spartacus_exchange_fantom - tornado_cash: +schema: tornado_cash arbitrum: @@ -302,15 +248,6 @@ models: ethereum: +schema: fiat_dao_ethereum - curvefi: - +schema: curvefi - ethereum: - +schema: curvefi_ethereum - optimism: - +schema: curvefi_optimism - fantom: - +schema: curvefi_fantom - cow_protocol: +schema: cow_protocol ethereum: @@ -340,21 +277,6 @@ models: avalanche_c: +schema: yield_yak_avalanche_c - kyberswap: - +schema: kyberswap - avalanche_c: - +schema: kyberswap_avalanche_c - optimism: - +schema: kyberswap_optimism - ethereum: - +schema: kyberswap_ethereum - arbitrum: - +schema: kyberswap_arbitrum - bnb: - +schema: kyberswap_bnb - polygon: - +schema: kyberswap_polygon - hashflow: +schema: hashflow ethereum: @@ -369,25 +291,6 @@ models: ethereum: +schema: nexusmutual_ethereum - zeroex: - +schema: zeroex - ethereum: - +schema: zeroex_ethereum - optimism: - +schema: zeroex_optimism - polygon: - +schema: zeroex_polygon - avalanche_c: - +schema: zeroex_avalanche_c - fantom: - +schema: zeroex_fantom - arbitrum: - +schema: zeroex_arbitrum - bnb: - +schema: zeroex_bnb - celo: - +schema: zeroex_celo - ampleforth: +schema: ampleforth @@ -471,11 +374,6 @@ models: ethereum: +schema: tokenfy_ethereum - tokenlon: - +schema: tokenlon - ethereum: - +schema: tokenlon_ethereum - thales: +schema: thales ethereum: @@ -569,11 +467,6 @@ models: polygon: +schema: rocifi_polygon - oneinch: - +schema: oneinch - ethereum: - +schema: oneinch_ethereum - pooltogether: +schema: pooltogether ethereum: @@ -628,15 +521,6 @@ models: base: +schema: layerzero_base - bebop: - +schema: bebop - ethereum: - +schema: bebop_ethereum - polygon: - +schema: bebop_polygon - arbitrum: - +schema: bebop_arbitrum - tokemak: +schema: tokemak ethereum: diff --git a/dex/README.md b/dex/README.md new file mode 100644 index 00000000000..8aef6e6c3ac --- /dev/null +++ b/dex/README.md @@ -0,0 +1,11 @@ +## DEX subproject + +This is a DBT subproject for the main lineages of the DEX sector. Included in this subproject, but not limited to over time: +- `dex.trades` +- `dex_aggreagtor.trades` +- `dex.prices` +- `dex.sandwiches` +- `dex.sandwiched` +- ...and more! + +This subproject will be dedicated to building the above spells (and others in the future related to DEX) on an hourly cadence in production. All other spells not included within this subproject will treat these spells as sources. For example, labels spells which read from `dex.trades` will now treat the spell as a source, rather than reference within dbt. \ No newline at end of file diff --git a/dex/dbt_project.yml b/dex/dbt_project.yml new file mode 100644 index 00000000000..140b7eeb175 --- /dev/null +++ b/dex/dbt_project.yml @@ -0,0 +1,67 @@ +#Welcome to your Spellbook! + +name: "dex" +version: "1.0.0" +config-version: 2 + +quoting: + database: false + schema: false + identifier: false + +# This setting configures which "profile" dbt uses for this project. +profile: "spellbook-local" + +vars: + DBT_ENV_CUSTOM_ENV_S3_BUCKET: "{{ env_var('DBT_ENV_CUSTOM_ENV_S3_BUCKET', 'local') }}" + DBT_ENV_INCREMENTAL_TIME: "{{ env_var('DBT_ENV_INCREMENTAL_TIME', '1') }}" + DBT_ENV_INCREMENTAL_TIME_UNIT: "{{ env_var('DBT_ENV_INCREMENTAL_TIME_UNIT', 'day') }}" + +# These configurations specify where dbt should look for different types of files. +# You don't need to change these! +model-paths: ["models", "../sources"] +analysis-paths: ["analyses"] +test-paths: ["tests"] +seed-paths: ["seeds"] +macro-paths: ["macros", "../macros"] +snapshot-paths: ["snapshots"] + +target-path: "target" # directory which will store compiled SQL files +clean-targets: # directories to be removed by `dbt clean` + - "target" + - "dbt_packages" + +# Configuring tests +# Full documentation: https://docs.getdbt.com/reference/test-configs +tests: + dex: + +store_failures: true # store failures for all tests + +# Configuring seeds +# Full documentation: https://docs.getdbt.com/reference/seed-configs +# For configuring individual seeds (e.g. overriding column types) we recommend a yml file nested in the same folder as the seed +seeds: + dex: + +schema: test_data + +# defining search order of macro invokation +dispatch: + - macro_namespace: dbt_utils + search_order: ['trino_utils', 'dbt_utils'] + +# Configuring models +# Full documentation: https://docs.getdbt.com/docs/configuring-models +models: + dex: + +post-hook: + - sql: "{{ set_trino_session_property(is_materialized(model), 'writer_scaling_min_data_processed', model.config.get('writer_min_size', '500MB')) }}" + transaction: true + - sql: "{{ set_trino_session_property(is_materialized(model), 'task_scale_writers_enabled', false) }}" + transaction: true + - sql: "{{ optimize_spell(this, model.config.materialized) }}" + transaction: true + - sql: "{{ mark_as_spell(this, model.config.materialized) }}" + transaction: true + +materialized: view + +schema: no_schema # this should be overriden in model specific configs + +view_security: invoker \ No newline at end of file diff --git a/macros/models/_sector/dex/airswap_compatible_trades.sql b/dex/macros/models/_project/airswap_compatible_trades.sql similarity index 100% rename from macros/models/_sector/dex/airswap_compatible_trades.sql rename to dex/macros/models/_project/airswap_compatible_trades.sql diff --git a/macros/models/_sector/dex/balancer_compatible_trades.sql b/dex/macros/models/_project/balancer_compatible_trades.sql similarity index 100% rename from macros/models/_sector/dex/balancer_compatible_trades.sql rename to dex/macros/models/_project/balancer_compatible_trades.sql diff --git a/macros/models/_sector/dex/clipper_compatible_trades.sql b/dex/macros/models/_project/clipper_compatible_trades.sql similarity index 100% rename from macros/models/_sector/dex/clipper_compatible_trades.sql rename to dex/macros/models/_project/clipper_compatible_trades.sql diff --git a/macros/models/_sector/dex/dodo_compatible_trades.sql b/dex/macros/models/_project/dodo_compatible_trades.sql similarity index 100% rename from macros/models/_sector/dex/dodo_compatible_trades.sql rename to dex/macros/models/_project/dodo_compatible_trades.sql diff --git a/macros/models/_sector/dex/kyberswap_compatible_trades.sql b/dex/macros/models/_project/kyberswap_compatible_trades.sql similarity index 100% rename from macros/models/_sector/dex/kyberswap_compatible_trades.sql rename to dex/macros/models/_project/kyberswap_compatible_trades.sql diff --git a/macros/models/_sector/dex/maverick_compatible_trades.sql b/dex/macros/models/_project/maverick_compatible_trades.sql similarity index 100% rename from macros/models/_sector/dex/maverick_compatible_trades.sql rename to dex/macros/models/_project/maverick_compatible_trades.sql diff --git a/macros/models/_sector/dex/openocean_compatible_trades.sql b/dex/macros/models/_project/openocean_compatible_trades.sql similarity index 100% rename from macros/models/_sector/dex/openocean_compatible_trades.sql rename to dex/macros/models/_project/openocean_compatible_trades.sql diff --git a/macros/models/_sector/dex/trader_joe_compatible_trades.sql b/dex/macros/models/_project/trader_joe_compatible_trades.sql similarity index 100% rename from macros/models/_sector/dex/trader_joe_compatible_trades.sql rename to dex/macros/models/_project/trader_joe_compatible_trades.sql diff --git a/macros/models/_sector/dex/uniswap_compatible_trades.sql b/dex/macros/models/_project/uniswap_compatible_trades.sql similarity index 100% rename from macros/models/_sector/dex/uniswap_compatible_trades.sql rename to dex/macros/models/_project/uniswap_compatible_trades.sql diff --git a/macros/models/_project/yield_yak/yield_yak_trades.sql b/dex/macros/models/_project/yield_yak_trades.sql similarity index 100% rename from macros/models/_project/yield_yak/yield_yak_trades.sql rename to dex/macros/models/_project/yield_yak_trades.sql diff --git a/macros/models/_sector/dex/dex_atomic_arbitrages.sql b/dex/macros/models/dex_atomic_arbitrages.sql similarity index 100% rename from macros/models/_sector/dex/dex_atomic_arbitrages.sql rename to dex/macros/models/dex_atomic_arbitrages.sql diff --git a/macros/models/_sector/dex/dex_sandwiched.sql b/dex/macros/models/dex_sandwiched.sql similarity index 100% rename from macros/models/_sector/dex/dex_sandwiched.sql rename to dex/macros/models/dex_sandwiched.sql diff --git a/macros/models/_sector/dex/dex_sandwiches.sql b/dex/macros/models/dex_sandwiches.sql similarity index 100% rename from macros/models/_sector/dex/dex_sandwiches.sql rename to dex/macros/models/dex_sandwiches.sql diff --git a/macros/models/_sector/dex/enrich_curve_dex_trades.sql b/dex/macros/models/enrich_curve_dex_trades.sql similarity index 100% rename from macros/models/_sector/dex/enrich_curve_dex_trades.sql rename to dex/macros/models/enrich_curve_dex_trades.sql diff --git a/macros/models/_sector/dex/enrich_dex_trades.sql b/dex/macros/models/enrich_dex_trades.sql similarity index 100% rename from macros/models/_sector/dex/enrich_dex_trades.sql rename to dex/macros/models/enrich_dex_trades.sql diff --git a/macros/models/_sector/dex/generic_spot_compatible_trades.sql b/dex/macros/models/generic_spot_compatible_trades.sql similarity index 100% rename from macros/models/_sector/dex/generic_spot_compatible_trades.sql rename to dex/macros/models/generic_spot_compatible_trades.sql diff --git a/models/_project/aerodrome/aerodrome_trades.sql b/dex/models/_projects/aerodrome/aerodrome_trades.sql similarity index 100% rename from models/_project/aerodrome/aerodrome_trades.sql rename to dex/models/_projects/aerodrome/aerodrome_trades.sql diff --git a/models/_project/airswap/airswap_trades.sql b/dex/models/_projects/airswap/airswap_trades.sql similarity index 100% rename from models/_project/airswap/airswap_trades.sql rename to dex/models/_projects/airswap/airswap_trades.sql diff --git a/models/_project/apeswap/apeswap_trades.sql b/dex/models/_projects/apeswap/apeswap_trades.sql similarity index 100% rename from models/_project/apeswap/apeswap_trades.sql rename to dex/models/_projects/apeswap/apeswap_trades.sql diff --git a/models/_project/arbswap/arbswap_trades.sql b/dex/models/_projects/arbswap/arbswap_trades.sql similarity index 100% rename from models/_project/arbswap/arbswap_trades.sql rename to dex/models/_projects/arbswap/arbswap_trades.sql diff --git a/models/arrakis/arrakis_schema.yml b/dex/models/_projects/arrakis/_schema.yml similarity index 100% rename from models/arrakis/arrakis_schema.yml rename to dex/models/_projects/arrakis/_schema.yml diff --git a/models/arrakis/arrakis_uniswap_pools.sql b/dex/models/_projects/arrakis/arrakis_uniswap_pools.sql similarity index 100% rename from models/arrakis/arrakis_uniswap_pools.sql rename to dex/models/_projects/arrakis/arrakis_uniswap_pools.sql diff --git a/models/arrakis/optimism/arrakis_optimism_schema.yml b/dex/models/_projects/arrakis/optimism/_schema.yml similarity index 100% rename from models/arrakis/optimism/arrakis_optimism_schema.yml rename to dex/models/_projects/arrakis/optimism/_schema.yml diff --git a/models/arrakis/optimism/arrakis_optimism_uniswap_pools.sql b/dex/models/_projects/arrakis/optimism/arrakis_optimism_uniswap_pools.sql similarity index 100% rename from models/arrakis/optimism/arrakis_optimism_uniswap_pools.sql rename to dex/models/_projects/arrakis/optimism/arrakis_optimism_uniswap_pools.sql diff --git a/models/_project/babyswap/babyswap_trades.sql b/dex/models/_projects/babyswap/babyswap_trades.sql similarity index 100% rename from models/_project/babyswap/babyswap_trades.sql rename to dex/models/_projects/babyswap/babyswap_trades.sql diff --git a/dex/models/_projects/balancer/labels/_schema.yml b/dex/models/_projects/balancer/labels/_schema.yml new file mode 100644 index 00000000000..5307014bab0 --- /dev/null +++ b/dex/models/_projects/balancer/labels/_schema.yml @@ -0,0 +1,307 @@ +version: 2 + +models: + - name: labels_balancer_v1_pools_ethereum + meta: + blockchain: ethereum + sector: labels + project: balancer_v1 + contributors: balancerlabs + config: + tags: ['labels', 'ethereum', 'balancer', 'pools'] + description: "Balancer V1 liquidity pools created on Ethereum. " + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - address + columns: + - &blockchain + name: blockchain + description: "Blockchain" + - &address + name: address + description: "Address of liquidity pool" + - &name + name: name + description: "Label name of pool containg the token symbols and their respective weights (if applicable)" + - &category + name: category + description: "Label category" + - &contributor + name: contributor + description: "Wizard(s) contributing to labels" + - &source + name: source + description: "How were labels generated (could be static or query)" + - &created_at + name: created_at + description: "When were labels created" + - &updated_at + name: updated_at + description: "When were labels updated for the last time" + - &model_name + name: model_name + description: "Name of the label model sourced from" + - &label_type + name: label_type + description: "Type of label (see labels overall readme)" + + - name: labels_balancer_v1_pools + meta: + blockchain: ethereum + sector: labels + project: balancer_v1 + contributors: balancerlabs + config: + tags: ['labels', 'ethereum', 'balancer', 'pools'] + description: "Balancer V1 liquidity pools created across blockchains." + columns: + - *blockchain + - *address + - *name + - *category + - *contributor + - *source + - *created_at + - *updated_at + - *model_name + - *label_type + + - name: labels_balancer_v2_pools_ethereum + meta: + blockchain: ethereum + sector: labels + project: balancer_v2 + contributors: balancerlabs, viniabussafi + config: + tags: ['labels', 'ethereum', 'balancer', 'pools'] + description: 'Balancer V2 liquidity pools created on Ethereum. ' + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - address + - name + - category + - model_name + - blockchain + columns: + - *blockchain + - *address + - *name + - *category + - *contributor + - *source + - *created_at + - *updated_at + - *model_name + - *label_type + + - name: labels_balancer_v2_pools_polygon + meta: + blockchain: polygon + sector: labels + project: balancer_v2 + contributors: balancerlabs, viniabussafi + config: + tags: ['labels', 'polygon', 'balancer', 'pools'] + description: 'Balancer V2 liquidity pools created on Polygon.' + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - address + columns: + - *blockchain + - *address + - *name + - *category + - *contributor + - *source + - *created_at + - *updated_at + - *model_name + - *label_type + + - name: labels_balancer_v2_pools_gnosis + meta: + blockchain: gnosis + sector: labels + project: balancer_v2 + contributors: balancerlabs, viniabussafi + config: + tags: ['labels', 'gnosis', 'balancer', 'pools'] + description: 'Balancer V2 liquidity pools created on Gnosis.' + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - address + columns: + - *blockchain + - *address + - *name + - *category + - *contributor + - *source + - *created_at + - *updated_at + - *model_name + - *label_type + + - name: labels_balancer_v2_pools_avalanche_c + meta: + blockchain: avalanche_c + sector: labels + project: balancer_v2 + contributors: balancerlabs, viniabussafi + config: + tags: ['labels', 'avalanche_c', 'balancer', 'pools'] + description: 'Balancer V2 liquidity pools created on Avalanche Chain.' + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - address + columns: + - *blockchain + - *address + - *name + - *category + - *contributor + - *source + - *created_at + - *updated_at + - *model_name + - *label_type + + - name: labels_balancer_v2_pools_base + meta: + blockchain: base + sector: labels + project: balancer_v2 + contributors: balancerlabs, viniabussafi + config: + tags: ['labels', 'base', 'balancer', 'pools'] + description: 'Balancer V2 liquidity pools created on Base Chain.' + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - address + columns: + - *blockchain + - *address + - *name + - *category + - *contributor + - *source + - *created_at + - *updated_at + - *model_name + - *label_type + + - name: labels_balancer_v2_pools_arbitrum + meta: + blockchain: arbitrum + sector: labels + project: balancer_v2 + contributors: balancerlabs, viniabussafi + config: + tags: ['labels', 'arbitrum', 'balancer', 'pools'] + description: 'Balancer V2 liquidity pools created on Arbitrum.' + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - address + columns: + - *blockchain + - *address + - *name + - *category + - *contributor + - *source + - *created_at + - *updated_at + - *model_name + - *label_type + + - name: labels_balancer_v2_pools_optimism + meta: + blockchain: optimism + sector: labels + project: balancer_v2 + contributors: balancerlabs, viniabussafi + config: + tags: ['labels', 'optimism', 'balancer', 'pools'] + description: 'Balancer V2 liquidity pools created on Optimism.' + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - address + columns: + - *blockchain + - *address + - *name + - *category + - *contributor + - *source + - *created_at + - *updated_at + - *model_name + - *label_type + + - name: labels_balancer_v2_pools_zkevm + meta: + blockchain: zkevm + sector: labels + project: balancer_v2 + contributors: balancerlabs, viniabussafi + config: + tags: ['labels', 'zkevm', 'balancer', 'pools'] + description: 'Balancer V2 liquidity pools created on Polygon zkevm.' + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - address + columns: + - *blockchain + - *address + - *name + - *category + - *contributor + - *source + - *created_at + - *updated_at + - *model_name + - *label_type + + + - name: labels_balancer_v2_pools + meta: + blockchain: ethereum, polygon, arbitrum, optimism, gnosis, base, avalanche_c, zkevm + sector: labels + project: balancer_v2 + contributors: balancerlabs, viniabussafi + config: + tags: + [ + 'labels', + 'ethereum', + 'polygon', + 'arbitrum', + 'optimism', + 'avalanche_c', + 'base', + 'gnosis', + 'zkevm', + 'balancer', + 'pools', + ] + description: 'Balancer V2 liquidity pools created across blockchains.' + columns: + - *blockchain + - *address + - *name + - *category + - *contributor + - *source + - *created_at + - *updated_at + - *model_name + - *label_type \ No newline at end of file diff --git a/models/labels/addresses/__single_category_labels__/balancer_v2/labels_balancer_v2_pools_arbitrum.sql b/dex/models/_projects/balancer/labels/arbitrum/labels_balancer_v2_pools_arbitrum.sql similarity index 99% rename from models/labels/addresses/__single_category_labels__/balancer_v2/labels_balancer_v2_pools_arbitrum.sql rename to dex/models/_projects/balancer/labels/arbitrum/labels_balancer_v2_pools_arbitrum.sql index 0c3177a1abf..92a12c168f5 100644 --- a/models/labels/addresses/__single_category_labels__/balancer_v2/labels_balancer_v2_pools_arbitrum.sql +++ b/dex/models/_projects/balancer/labels/arbitrum/labels_balancer_v2_pools_arbitrum.sql @@ -1,4 +1,5 @@ {{config( + schema = 'labels', alias = 'balancer_v2_pools_arbitrum', post_hook = '{{ expose_spells(\'["arbitrum"]\', "sector", diff --git a/models/labels/addresses/__single_category_labels__/balancer_v2/labels_balancer_v2_pools_avalanche_c.sql b/dex/models/_projects/balancer/labels/avalanche_c/labels_balancer_v2_pools_avalanche_c.sql similarity index 99% rename from models/labels/addresses/__single_category_labels__/balancer_v2/labels_balancer_v2_pools_avalanche_c.sql rename to dex/models/_projects/balancer/labels/avalanche_c/labels_balancer_v2_pools_avalanche_c.sql index 71811eb75df..ef71780d697 100644 --- a/models/labels/addresses/__single_category_labels__/balancer_v2/labels_balancer_v2_pools_avalanche_c.sql +++ b/dex/models/_projects/balancer/labels/avalanche_c/labels_balancer_v2_pools_avalanche_c.sql @@ -1,4 +1,5 @@ {{config( + schema = 'labels', alias = 'balancer_v2_pools_avalanche_c', post_hook = '{{ expose_spells(\'["avalanche_c"]\', "sector", diff --git a/models/labels/addresses/__single_category_labels__/balancer_v2/labels_balancer_v2_pools_base.sql b/dex/models/_projects/balancer/labels/base/labels_balancer_v2_pools_base.sql similarity index 99% rename from models/labels/addresses/__single_category_labels__/balancer_v2/labels_balancer_v2_pools_base.sql rename to dex/models/_projects/balancer/labels/base/labels_balancer_v2_pools_base.sql index 7eba615f28e..1b4c00b5f9e 100644 --- a/models/labels/addresses/__single_category_labels__/balancer_v2/labels_balancer_v2_pools_base.sql +++ b/dex/models/_projects/balancer/labels/base/labels_balancer_v2_pools_base.sql @@ -1,4 +1,5 @@ {{config( + schema = 'labels', alias = 'balancer_v2_pools_base', post_hook = '{{ expose_spells(\'["base"]\', "sector", diff --git a/models/labels/addresses/__single_category_labels__/balancer_v1/labels_balancer_v1_pools_ethereum.sql b/dex/models/_projects/balancer/labels/ethereum/labels_balancer_v1_pools_ethereum.sql similarity index 99% rename from models/labels/addresses/__single_category_labels__/balancer_v1/labels_balancer_v1_pools_ethereum.sql rename to dex/models/_projects/balancer/labels/ethereum/labels_balancer_v1_pools_ethereum.sql index c47b919ff85..ebb10b016b7 100644 --- a/models/labels/addresses/__single_category_labels__/balancer_v1/labels_balancer_v1_pools_ethereum.sql +++ b/dex/models/_projects/balancer/labels/ethereum/labels_balancer_v1_pools_ethereum.sql @@ -1,5 +1,5 @@ {{config( - + schema = 'labels', alias = 'balancer_v1_pools_ethereum', materialized = 'incremental', file_format = 'delta', diff --git a/models/labels/addresses/__single_category_labels__/balancer_v2/labels_balancer_v2_pools_ethereum.sql b/dex/models/_projects/balancer/labels/ethereum/labels_balancer_v2_pools_ethereum.sql similarity index 99% rename from models/labels/addresses/__single_category_labels__/balancer_v2/labels_balancer_v2_pools_ethereum.sql rename to dex/models/_projects/balancer/labels/ethereum/labels_balancer_v2_pools_ethereum.sql index 99988d1bbeb..d103f357cb0 100644 --- a/models/labels/addresses/__single_category_labels__/balancer_v2/labels_balancer_v2_pools_ethereum.sql +++ b/dex/models/_projects/balancer/labels/ethereum/labels_balancer_v2_pools_ethereum.sql @@ -1,4 +1,5 @@ {{config( + schema = 'labels', alias = 'balancer_v2_pools_ethereum', post_hook = '{{ expose_spells(\'["ethereum"]\', "sector", diff --git a/models/labels/addresses/__single_category_labels__/balancer_v2/labels_balancer_v2_pools_gnosis.sql b/dex/models/_projects/balancer/labels/gnosis/labels_balancer_v2_pools_gnosis.sql similarity index 99% rename from models/labels/addresses/__single_category_labels__/balancer_v2/labels_balancer_v2_pools_gnosis.sql rename to dex/models/_projects/balancer/labels/gnosis/labels_balancer_v2_pools_gnosis.sql index bab1ec9fdb3..c907edd95e4 100644 --- a/models/labels/addresses/__single_category_labels__/balancer_v2/labels_balancer_v2_pools_gnosis.sql +++ b/dex/models/_projects/balancer/labels/gnosis/labels_balancer_v2_pools_gnosis.sql @@ -1,4 +1,5 @@ {{config( + schema = 'labels', alias = 'balancer_v2_pools_gnosis', post_hook = '{{ expose_spells(\'["gnosis"]\', "sector", diff --git a/models/labels/addresses/__single_category_labels__/balancer_v1/labels_balancer_v1_pools.sql b/dex/models/_projects/balancer/labels/labels_balancer_v1_pools.sql similarity index 92% rename from models/labels/addresses/__single_category_labels__/balancer_v1/labels_balancer_v1_pools.sql rename to dex/models/_projects/balancer/labels/labels_balancer_v1_pools.sql index 900c48cc9dd..3fac8ed84c1 100644 --- a/models/labels/addresses/__single_category_labels__/balancer_v1/labels_balancer_v1_pools.sql +++ b/dex/models/_projects/balancer/labels/labels_balancer_v1_pools.sql @@ -1,5 +1,5 @@ {{config( - + schema = 'labels', alias = 'labels_balancer_v1_pools', post_hook='{{ expose_spells(\'["ethereum"]\', "sector", diff --git a/models/labels/addresses/__single_category_labels__/balancer_v2/labels_balancer_v2_pools.sql b/dex/models/_projects/balancer/labels/labels_balancer_v2_pools.sql similarity index 91% rename from models/labels/addresses/__single_category_labels__/balancer_v2/labels_balancer_v2_pools.sql rename to dex/models/_projects/balancer/labels/labels_balancer_v2_pools.sql index 57478b9e0a3..2507f8a739a 100644 --- a/models/labels/addresses/__single_category_labels__/balancer_v2/labels_balancer_v2_pools.sql +++ b/dex/models/_projects/balancer/labels/labels_balancer_v2_pools.sql @@ -1,5 +1,6 @@ -{{config(alias = 'balancer_v2_pools', - +{{config( + schema = 'labels', + alias = 'balancer_v2_pools', post_hook='{{ expose_spells(\'["ethereum", "arbitrum", "optimism", "polygon", "avalanche_c", "base", "gnosis", "zkevm"]\', "sector", "labels", diff --git a/models/labels/addresses/__single_category_labels__/balancer_v2/labels_balancer_v2_pools_optimism.sql b/dex/models/_projects/balancer/labels/optimism/labels_balancer_v2_pools_optimism.sql similarity index 99% rename from models/labels/addresses/__single_category_labels__/balancer_v2/labels_balancer_v2_pools_optimism.sql rename to dex/models/_projects/balancer/labels/optimism/labels_balancer_v2_pools_optimism.sql index a3e5b624cda..22a66efaaa4 100644 --- a/models/labels/addresses/__single_category_labels__/balancer_v2/labels_balancer_v2_pools_optimism.sql +++ b/dex/models/_projects/balancer/labels/optimism/labels_balancer_v2_pools_optimism.sql @@ -1,4 +1,5 @@ {{config( + schema = 'labels', alias = 'balancer_v2_pools_optimism', post_hook = '{{ expose_spells(\'["optimism"]\', "sector", diff --git a/models/labels/addresses/__single_category_labels__/balancer_v2/labels_balancer_v2_pools_polygon.sql b/dex/models/_projects/balancer/labels/polygon/labels_balancer_v2_pools_polygon.sql similarity index 99% rename from models/labels/addresses/__single_category_labels__/balancer_v2/labels_balancer_v2_pools_polygon.sql rename to dex/models/_projects/balancer/labels/polygon/labels_balancer_v2_pools_polygon.sql index 7710b10702f..11f9af6d31e 100644 --- a/models/labels/addresses/__single_category_labels__/balancer_v2/labels_balancer_v2_pools_polygon.sql +++ b/dex/models/_projects/balancer/labels/polygon/labels_balancer_v2_pools_polygon.sql @@ -1,4 +1,5 @@ {{config( + schema = 'labels', alias = 'balancer_v2_pools_polygon', post_hook = '{{ expose_spells(\'["polygon"]\', "sector", diff --git a/models/labels/addresses/__single_category_labels__/balancer_v2/labels_balancer_v2_pools_zkevm.sql b/dex/models/_projects/balancer/labels/zkevm/labels_balancer_v2_pools_zkevm.sql similarity index 99% rename from models/labels/addresses/__single_category_labels__/balancer_v2/labels_balancer_v2_pools_zkevm.sql rename to dex/models/_projects/balancer/labels/zkevm/labels_balancer_v2_pools_zkevm.sql index 25d06550e35..8353fd05ce4 100644 --- a/models/labels/addresses/__single_category_labels__/balancer_v2/labels_balancer_v2_pools_zkevm.sql +++ b/dex/models/_projects/balancer/labels/zkevm/labels_balancer_v2_pools_zkevm.sql @@ -1,4 +1,5 @@ {{config( + schema = 'labels', alias = 'balancer_v2_pools_zkevm', post_hook = '{{ expose_spells(\'["zkevm"]\', "sector", diff --git a/dex/models/_projects/balancer/pools/_schema.yml b/dex/models/_projects/balancer/pools/_schema.yml new file mode 100644 index 00000000000..4c8d413147c --- /dev/null +++ b/dex/models/_projects/balancer/pools/_schema.yml @@ -0,0 +1,268 @@ +version: 2 + +models: + - name: balancer_pools_fees + meta: + blockchain: arbitrum, avalanche_c, base, ethereum, gnosis, optimism, polygon, zkevm + contributors: jacektrocinski, thetroyharris, viniabussafi + config: + tags: ['arbitrum', 'avalanche_c', 'base', 'ethereum', 'gnosis', 'optimism', 'polygon', 'zkevm', 'pools', 'fees'] + description: > + Balancer v2 swap fees stored at the pool level. + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - blockchain + - block_number + - tx_hash + - index + columns: + - &blockchain + name: blockchain + description: "Blockchain" + - &version + name: version + description: "Version of Balancer where the liquidity pool used in transaction is deployed" + - &contract_address + name: contract_address + description: 'zkevm address for the liquidity pool used in transaction' + tests: + - not_null + - &tx_hash + name: tx_hash + description: 'Transaction hash' + tests: + - not_null + - &index + name: index + description: 'Event Index' + tests: + - not_null + - &tx_index + name: tx_index + description: 'Transaction Index' + tests: + - not_null + - &block_time + name: block_time + description: 'Block time in UTC' + tests: + - not_null + - &block_number + name: block_number + description: 'Event Block Number' + tests: + - not_null + - &swap_fee_percentage + name: swap_fee_percentage + description: 'Swap fees for the pool, values are returned with 18 decimals (1e18 meaning 100%)' + tests: + - not_null + + - name: balancer_v2_arbitrum_pools_fees + meta: + blockchain: arbitrum + project: balancer_v2 + contributors: jacektrocinski, thetroyharris, viniabussafi + config: + tags: ['arbitrum', 'balancer', 'pools_fees'] + description: > + Balancer v2 swap fees stored at the pool level. + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - block_number + - tx_hash + - index + columns: + - *blockchain + - *version + - *contract_address + - *tx_hash + - *index + - *tx_index + - *block_time + - *block_number + - *swap_fee_percentage + + - name: balancer_v2_avalanche_c_pools_fees + meta: + blockchain: avalanche_c + project: balancer_v2 + contributors: jacektrocinski, thetroyharris, viniabussafi + config: + tags: ['avalanche_c', 'balancer', 'pools_fees'] + description: > + Balancer v2 swap fees stored at the pool level. + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - block_number + - tx_hash + - index + columns: + - *blockchain + - *version + - *contract_address + - *tx_hash + - *index + - *tx_index + - *block_time + - *block_number + - *swap_fee_percentage + + - name: balancer_v2_base_pools_fees + meta: + blockchain: base + project: balancer_v2 + contributors: jacektrocinski, thetroyharris, viniabussafi + config: + tags: ['base', 'balancer', 'pools_fees'] + description: > + Balancer v2 swap fees stored at the pool level. + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - block_number + - tx_hash + - index + columns: + - *blockchain + - *version + - *contract_address + - *tx_hash + - *index + - *tx_index + - *block_time + - *block_number + - *swap_fee_percentage + + - name: balancer_v2_ethereum_pools_fees + meta: + blockchain: ethereum + project: balancer_v2 + contributors: jacektrocinski, thetroyharris, viniabussafi + config: + tags: ['ethereum', 'balancer', 'pools', 'fees'] + description: > + Balancer v2 swap fees stored at the pool level. + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - block_number + - tx_hash + - index + columns: + - *blockchain + - *version + - *contract_address + - *tx_hash + - *index + - *tx_index + - *block_time + - *block_number + - *swap_fee_percentage + + - name: balancer_v2_gnosis_pools_fees + meta: + blockchain: gnosis + project: balancer_v2 + contributors: jacektrocinski, thetroyharris, viniabussafi + config: + tags: ['gnosis', 'balancer', 'pools_fees'] + description: > + Balancer v2 swap fees stored at the pool level. + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - block_number + - tx_hash + - index + columns: + - *blockchain + - *version + - *contract_address + - *tx_hash + - *index + - *tx_index + - *block_time + - *block_number + - *swap_fee_percentage + + - name: balancer_v2_optimism_pools_fees + meta: + blockchain: optimism + project: balancer_v2 + contributors: jacektrocinski, thetroyharris, viniabussafi + config: + tags: ['optimism', 'balancer', 'pools_fees'] + description: > + Balancer v2 swap fees stored at the pool level. + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - block_number + - tx_hash + - index + columns: + - *blockchain + - *version + - *contract_address + - *tx_hash + - *index + - *tx_index + - *block_time + - *block_number + - *swap_fee_percentage + + - name: balancer_v2_polygon_pools_fees + meta: + blockchain: polygon + project: balancer_v2 + contributors: jacektrocinski, thetroyharris, viniabussafi + config: + tags: ['polygon', 'balancer', 'pools', 'fees'] + description: > + Balancer v2 swap fees stored at the pool level. + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - block_number + - tx_hash + - index + columns: + - *blockchain + - *version + - *contract_address + - *tx_hash + - *index + - *tx_index + - *block_time + - *block_number + - *swap_fee_percentage + + - name: balancer_v2_zkevm_pools_fees + meta: + blockchain: zkevm + project: balancer_v2 + contributors: jacektrocinski, thetroyharris, viniabussafi + config: + tags: ['zkevm', 'balancer', 'pools_fees'] + description: > + Balancer v2 swap fees stored at the pool level. + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - block_number + - tx_hash + - index + columns: + - *blockchain + - *version + - *contract_address + - *tx_hash + - *index + - *tx_index + - *block_time + - *block_number + - *swap_fee_percentage \ No newline at end of file diff --git a/models/_project/balancer/pools/arbitrum/balancer_v2_arbitrum_pools_fees.sql b/dex/models/_projects/balancer/pools/arbitrum/balancer_v2_arbitrum_pools_fees.sql similarity index 100% rename from models/_project/balancer/pools/arbitrum/balancer_v2_arbitrum_pools_fees.sql rename to dex/models/_projects/balancer/pools/arbitrum/balancer_v2_arbitrum_pools_fees.sql diff --git a/models/_project/balancer/pools/avalanche_c/balancer_v2_avalanche_c_pools_fees.sql b/dex/models/_projects/balancer/pools/avalanche_c/balancer_v2_avalanche_c_pools_fees.sql similarity index 100% rename from models/_project/balancer/pools/avalanche_c/balancer_v2_avalanche_c_pools_fees.sql rename to dex/models/_projects/balancer/pools/avalanche_c/balancer_v2_avalanche_c_pools_fees.sql diff --git a/models/_project/balancer/pools/balancer_pools_fees.sql b/dex/models/_projects/balancer/pools/balancer_pools_fees.sql similarity index 100% rename from models/_project/balancer/pools/balancer_pools_fees.sql rename to dex/models/_projects/balancer/pools/balancer_pools_fees.sql diff --git a/models/_project/balancer/pools/base/balancer_v2_base_pools_fees.sql b/dex/models/_projects/balancer/pools/base/balancer_v2_base_pools_fees.sql similarity index 100% rename from models/_project/balancer/pools/base/balancer_v2_base_pools_fees.sql rename to dex/models/_projects/balancer/pools/base/balancer_v2_base_pools_fees.sql diff --git a/models/_project/balancer/pools/ethereum/balancer_v2_ethereum_pools_fees.sql b/dex/models/_projects/balancer/pools/ethereum/balancer_v2_ethereum_pools_fees.sql similarity index 100% rename from models/_project/balancer/pools/ethereum/balancer_v2_ethereum_pools_fees.sql rename to dex/models/_projects/balancer/pools/ethereum/balancer_v2_ethereum_pools_fees.sql diff --git a/models/_project/balancer/pools/gnosis/balancer_v2_gnosis_pools_fees.sql b/dex/models/_projects/balancer/pools/gnosis/balancer_v2_gnosis_pools_fees.sql similarity index 100% rename from models/_project/balancer/pools/gnosis/balancer_v2_gnosis_pools_fees.sql rename to dex/models/_projects/balancer/pools/gnosis/balancer_v2_gnosis_pools_fees.sql diff --git a/models/_project/balancer/pools/optimism/balancer_v2_optimism_pools_fees.sql b/dex/models/_projects/balancer/pools/optimism/balancer_v2_optimism_pools_fees.sql similarity index 100% rename from models/_project/balancer/pools/optimism/balancer_v2_optimism_pools_fees.sql rename to dex/models/_projects/balancer/pools/optimism/balancer_v2_optimism_pools_fees.sql diff --git a/models/_project/balancer/pools/polygon/balancer_v2_polygon_pools_fees.sql b/dex/models/_projects/balancer/pools/polygon/balancer_v2_polygon_pools_fees.sql similarity index 100% rename from models/_project/balancer/pools/polygon/balancer_v2_polygon_pools_fees.sql rename to dex/models/_projects/balancer/pools/polygon/balancer_v2_polygon_pools_fees.sql diff --git a/models/_project/balancer/pools/zkevm/balancer_v2_zkevm_pools_fees.sql b/dex/models/_projects/balancer/pools/zkevm/balancer_v2_zkevm_pools_fees.sql similarity index 100% rename from models/_project/balancer/pools/zkevm/balancer_v2_zkevm_pools_fees.sql rename to dex/models/_projects/balancer/pools/zkevm/balancer_v2_zkevm_pools_fees.sql diff --git a/models/_project/balancer/trades/arbitrum/_schema.yml b/dex/models/_projects/balancer/trades/arbitrum/_schema.yml similarity index 97% rename from models/_project/balancer/trades/arbitrum/_schema.yml rename to dex/models/_projects/balancer/trades/arbitrum/_schema.yml index 09ef97905b8..1f6eb04efb1 100644 --- a/models/_project/balancer/trades/arbitrum/_schema.yml +++ b/dex/models/_projects/balancer/trades/arbitrum/_schema.yml @@ -19,10 +19,6 @@ models: - version - tx_hash - evt_index - - check_dex_seed: - blockchain: arbitrum - project: balancer - version: 2 columns: - &blockchain name: blockchain diff --git a/models/_project/balancer/trades/arbitrum/balancer_arbitrum_trades.sql b/dex/models/_projects/balancer/trades/arbitrum/balancer_arbitrum_trades.sql similarity index 100% rename from models/_project/balancer/trades/arbitrum/balancer_arbitrum_trades.sql rename to dex/models/_projects/balancer/trades/arbitrum/balancer_arbitrum_trades.sql diff --git a/models/_project/balancer/trades/arbitrum/balancer_v2_arbitrum_trades.sql b/dex/models/_projects/balancer/trades/arbitrum/balancer_v2_arbitrum_trades.sql similarity index 93% rename from models/_project/balancer/trades/arbitrum/balancer_v2_arbitrum_trades.sql rename to dex/models/_projects/balancer/trades/arbitrum/balancer_v2_arbitrum_trades.sql index 2baa6afd2b2..0aeeed435c5 100644 --- a/models/_project/balancer/trades/arbitrum/balancer_v2_arbitrum_trades.sql +++ b/dex/models/_projects/balancer/trades/arbitrum/balancer_v2_arbitrum_trades.sql @@ -68,7 +68,7 @@ WITH dexs.block_time, MAX(bpt_prices.day) AS bpa_max_block_date FROM dexs - LEFT JOIN {{ ref('balancer_v2_arbitrum_bpt_prices') }} bpt_prices + LEFT JOIN {{ source('balancer_v2_arbitrum', 'bpt_prices') }} bpt_prices ON bpt_prices.contract_address = dexs.token_bought_address AND bpt_prices.day <= DATE_TRUNC('day', dexs.block_time) GROUP BY 1, 2, 3, 4, 5 @@ -82,7 +82,7 @@ WITH dexs.block_time, MAX(bpt_prices.day) AS bpb_max_block_date FROM dexs - LEFT JOIN {{ ref('balancer_v2_arbitrum_bpt_prices') }} bpt_prices + LEFT JOIN {{ source('balancer_v2_arbitrum', 'bpt_prices') }} bpt_prices ON bpt_prices.contract_address = dexs.token_sold_address AND bpt_prices.day <= DATE_TRUNC('day', dexs.block_time) GROUP BY 1, 2, 3, 4, 5 @@ -132,13 +132,13 @@ FROM dexs ON bpa.block_number = dexs.block_number AND bpa.tx_hash = dexs.tx_hash AND bpa.evt_index = dexs.evt_index - LEFT JOIN {{ ref('balancer_v2_arbitrum_bpt_prices') }} bpa_bpt_prices + LEFT JOIN {{ source('balancer_v2_arbitrum', 'bpt_prices') }} bpa_bpt_prices ON bpa_bpt_prices.contract_address = bpa.contract_address AND bpa_bpt_prices.day = bpa.bpa_max_block_date INNER JOIN bpb ON bpb.block_number = dexs.block_number AND bpb.tx_hash = dexs.tx_hash AND bpb.evt_index = dexs.evt_index - LEFT JOIN {{ ref('balancer_v2_arbitrum_bpt_prices') }} bpb_bpt_prices + LEFT JOIN {{ source('balancer_v2_arbitrum', 'bpt_prices') }} bpb_bpt_prices ON bpb_bpt_prices.contract_address = bpb.contract_address AND bpb_bpt_prices.day = bpb.bpb_max_block_date \ No newline at end of file diff --git a/models/_project/balancer/trades/avalanche_c/_schema.yml b/dex/models/_projects/balancer/trades/avalanche_c/_schema.yml similarity index 97% rename from models/_project/balancer/trades/avalanche_c/_schema.yml rename to dex/models/_projects/balancer/trades/avalanche_c/_schema.yml index 86aca24b807..6036c557ff2 100644 --- a/models/_project/balancer/trades/avalanche_c/_schema.yml +++ b/dex/models/_projects/balancer/trades/avalanche_c/_schema.yml @@ -19,10 +19,6 @@ models: - version - tx_hash - evt_index - - check_dex_seed: - blockchain: avalanche_c - project: balancer - version: 2 columns: - &blockchain name: blockchain diff --git a/models/_project/balancer/trades/avalanche_c/balancer_avalanche_c_trades.sql b/dex/models/_projects/balancer/trades/avalanche_c/balancer_avalanche_c_trades.sql similarity index 100% rename from models/_project/balancer/trades/avalanche_c/balancer_avalanche_c_trades.sql rename to dex/models/_projects/balancer/trades/avalanche_c/balancer_avalanche_c_trades.sql diff --git a/models/_project/balancer/trades/avalanche_c/balancer_v2_avalanche_c_trades.sql b/dex/models/_projects/balancer/trades/avalanche_c/balancer_v2_avalanche_c_trades.sql similarity index 93% rename from models/_project/balancer/trades/avalanche_c/balancer_v2_avalanche_c_trades.sql rename to dex/models/_projects/balancer/trades/avalanche_c/balancer_v2_avalanche_c_trades.sql index d1a0eb61af5..3de611ffa3e 100644 --- a/models/_project/balancer/trades/avalanche_c/balancer_v2_avalanche_c_trades.sql +++ b/dex/models/_projects/balancer/trades/avalanche_c/balancer_v2_avalanche_c_trades.sql @@ -68,7 +68,7 @@ WITH dexs.block_time, MAX(bpt_prices.day) AS bpa_max_block_date FROM dexs - LEFT JOIN {{ ref('balancer_v2_avalanche_c_bpt_prices') }} bpt_prices + LEFT JOIN {{ source('balancer_v2_avalanche_c', 'bpt_prices') }} bpt_prices ON bpt_prices.contract_address = dexs.token_bought_address AND bpt_prices.day <= DATE_TRUNC('day', dexs.block_time) GROUP BY 1, 2, 3, 4, 5 @@ -82,7 +82,7 @@ WITH dexs.block_time, MAX(bpt_prices.day) AS bpb_max_block_date FROM dexs - LEFT JOIN {{ ref('balancer_v2_avalanche_c_bpt_prices') }} bpt_prices + LEFT JOIN {{ source('balancer_v2_avalanche_c', 'bpt_prices') }} bpt_prices ON bpt_prices.contract_address = dexs.token_sold_address AND bpt_prices.day <= DATE_TRUNC('day', dexs.block_time) GROUP BY 1, 2, 3, 4, 5 @@ -132,13 +132,13 @@ FROM dexs ON bpa.block_number = dexs.block_number AND bpa.tx_hash = dexs.tx_hash AND bpa.evt_index = dexs.evt_index - LEFT JOIN {{ ref('balancer_v2_avalanche_c_bpt_prices') }} bpa_bpt_prices + LEFT JOIN {{ source('balancer_v2_avalanche_c', 'bpt_prices') }} bpa_bpt_prices ON bpa_bpt_prices.contract_address = bpa.contract_address AND bpa_bpt_prices.day = bpa.bpa_max_block_date INNER JOIN bpb ON bpb.block_number = dexs.block_number AND bpb.tx_hash = dexs.tx_hash AND bpb.evt_index = dexs.evt_index - LEFT JOIN {{ ref('balancer_v2_avalanche_c_bpt_prices') }} bpb_bpt_prices + LEFT JOIN {{ source('balancer_v2_avalanche_c', 'bpt_prices') }} bpb_bpt_prices ON bpb_bpt_prices.contract_address = bpb.contract_address AND bpb_bpt_prices.day = bpb.bpb_max_block_date \ No newline at end of file diff --git a/models/_project/balancer/trades/balancer_trades.sql b/dex/models/_projects/balancer/trades/balancer_trades.sql similarity index 100% rename from models/_project/balancer/trades/balancer_trades.sql rename to dex/models/_projects/balancer/trades/balancer_trades.sql diff --git a/models/_project/balancer/trades/base/_schema.yml b/dex/models/_projects/balancer/trades/base/_schema.yml similarity index 97% rename from models/_project/balancer/trades/base/_schema.yml rename to dex/models/_projects/balancer/trades/base/_schema.yml index 4a0bd85156f..ccd587803b5 100644 --- a/models/_project/balancer/trades/base/_schema.yml +++ b/dex/models/_projects/balancer/trades/base/_schema.yml @@ -19,10 +19,6 @@ models: - version - tx_hash - evt_index - - check_dex_seed: - blockchain: base - project: balancer - version: 2 columns: - &blockchain name: blockchain diff --git a/models/_project/balancer/trades/base/balancer_base_trades.sql b/dex/models/_projects/balancer/trades/base/balancer_base_trades.sql similarity index 100% rename from models/_project/balancer/trades/base/balancer_base_trades.sql rename to dex/models/_projects/balancer/trades/base/balancer_base_trades.sql diff --git a/models/_project/balancer/trades/base/balancer_v2_base_trades.sql b/dex/models/_projects/balancer/trades/base/balancer_v2_base_trades.sql similarity index 93% rename from models/_project/balancer/trades/base/balancer_v2_base_trades.sql rename to dex/models/_projects/balancer/trades/base/balancer_v2_base_trades.sql index b94589a490a..78f9f0f482f 100644 --- a/models/_project/balancer/trades/base/balancer_v2_base_trades.sql +++ b/dex/models/_projects/balancer/trades/base/balancer_v2_base_trades.sql @@ -68,7 +68,7 @@ WITH dexs.block_time, MAX(bpt_prices.day) AS bpa_max_block_date FROM dexs - LEFT JOIN {{ ref('balancer_v2_base_bpt_prices') }} bpt_prices + LEFT JOIN {{ source('balancer_v2_base', 'bpt_prices') }} bpt_prices ON bpt_prices.contract_address = dexs.token_bought_address AND bpt_prices.day <= DATE_TRUNC('day', dexs.block_time) GROUP BY 1, 2, 3, 4, 5 @@ -82,7 +82,7 @@ WITH dexs.block_time, MAX(bpt_prices.day) AS bpb_max_block_date FROM dexs - LEFT JOIN {{ ref('balancer_v2_base_bpt_prices') }} bpt_prices + LEFT JOIN {{ source('balancer_v2_base', 'bpt_prices') }} bpt_prices ON bpt_prices.contract_address = dexs.token_sold_address AND bpt_prices.day <= DATE_TRUNC('day', dexs.block_time) GROUP BY 1, 2, 3, 4, 5 @@ -132,13 +132,13 @@ FROM dexs ON bpa.block_number = dexs.block_number AND bpa.tx_hash = dexs.tx_hash AND bpa.evt_index = dexs.evt_index - LEFT JOIN {{ ref('balancer_v2_base_bpt_prices') }} bpa_bpt_prices + LEFT JOIN {{ source('balancer_v2_base', 'bpt_prices') }} bpa_bpt_prices ON bpa_bpt_prices.contract_address = bpa.contract_address AND bpa_bpt_prices.day = bpa.bpa_max_block_date INNER JOIN bpb ON bpb.block_number = dexs.block_number AND bpb.tx_hash = dexs.tx_hash AND bpb.evt_index = dexs.evt_index - LEFT JOIN {{ ref('balancer_v2_base_bpt_prices') }} bpb_bpt_prices + LEFT JOIN {{ source('balancer_v2_base', 'bpt_prices') }} bpb_bpt_prices ON bpb_bpt_prices.contract_address = bpb.contract_address AND bpb_bpt_prices.day = bpb.bpb_max_block_date \ No newline at end of file diff --git a/models/_project/balancer/trades/ethereum/_schema.yml b/dex/models/_projects/balancer/trades/ethereum/_schema.yml similarity index 97% rename from models/_project/balancer/trades/ethereum/_schema.yml rename to dex/models/_projects/balancer/trades/ethereum/_schema.yml index 42d29d7e17d..48f04166bfe 100644 --- a/models/_project/balancer/trades/ethereum/_schema.yml +++ b/dex/models/_projects/balancer/trades/ethereum/_schema.yml @@ -111,10 +111,6 @@ models: - block_time - tx_hash - evt_index - - check_dex_seed: - blockchain: ethereum - project: balancer - version: 1 columns: - *blockchain - *project diff --git a/models/_project/balancer/trades/ethereum/balancer_ethereum_trades.sql b/dex/models/_projects/balancer/trades/ethereum/balancer_ethereum_trades.sql similarity index 100% rename from models/_project/balancer/trades/ethereum/balancer_ethereum_trades.sql rename to dex/models/_projects/balancer/trades/ethereum/balancer_ethereum_trades.sql diff --git a/models/_project/balancer/trades/ethereum/balancer_v1_ethereum_trades.sql b/dex/models/_projects/balancer/trades/ethereum/balancer_v1_ethereum_trades.sql similarity index 100% rename from models/_project/balancer/trades/ethereum/balancer_v1_ethereum_trades.sql rename to dex/models/_projects/balancer/trades/ethereum/balancer_v1_ethereum_trades.sql diff --git a/models/_project/balancer/trades/ethereum/balancer_v2_ethereum_trades.sql b/dex/models/_projects/balancer/trades/ethereum/balancer_v2_ethereum_trades.sql similarity index 93% rename from models/_project/balancer/trades/ethereum/balancer_v2_ethereum_trades.sql rename to dex/models/_projects/balancer/trades/ethereum/balancer_v2_ethereum_trades.sql index dfb4c2439bf..1576a017b0f 100644 --- a/models/_project/balancer/trades/ethereum/balancer_v2_ethereum_trades.sql +++ b/dex/models/_projects/balancer/trades/ethereum/balancer_v2_ethereum_trades.sql @@ -68,7 +68,7 @@ WITH dexs.block_time, MAX(bpt_prices.day) AS bpa_max_block_date FROM dexs - LEFT JOIN {{ ref('balancer_v2_ethereum_bpt_prices') }} bpt_prices + LEFT JOIN {{ source('balancer_v2_ethereum', 'bpt_prices') }} bpt_prices ON bpt_prices.contract_address = dexs.token_bought_address AND bpt_prices.day <= DATE_TRUNC('day', dexs.block_time) GROUP BY 1, 2, 3, 4, 5 @@ -82,7 +82,7 @@ WITH dexs.block_time, MAX(bpt_prices.day) AS bpb_max_block_date FROM dexs - LEFT JOIN {{ ref('balancer_v2_ethereum_bpt_prices') }} bpt_prices + LEFT JOIN {{ source('balancer_v2_ethereum', 'bpt_prices') }} bpt_prices ON bpt_prices.contract_address = dexs.token_sold_address AND bpt_prices.day <= DATE_TRUNC('day', dexs.block_time) GROUP BY 1, 2, 3, 4, 5 @@ -132,13 +132,13 @@ FROM dexs ON bpa.block_number = dexs.block_number AND bpa.tx_hash = dexs.tx_hash AND bpa.evt_index = dexs.evt_index - LEFT JOIN {{ ref('balancer_v2_ethereum_bpt_prices') }} bpa_bpt_prices + LEFT JOIN {{ source('balancer_v2_ethereum', 'bpt_prices') }} bpa_bpt_prices ON bpa_bpt_prices.contract_address = bpa.contract_address AND bpa_bpt_prices.day = bpa.bpa_max_block_date INNER JOIN bpb ON bpb.block_number = dexs.block_number AND bpb.tx_hash = dexs.tx_hash AND bpb.evt_index = dexs.evt_index - LEFT JOIN {{ ref('balancer_v2_ethereum_bpt_prices') }} bpb_bpt_prices + LEFT JOIN {{ source('balancer_v2_ethereum', 'bpt_prices') }} bpb_bpt_prices ON bpb_bpt_prices.contract_address = bpb.contract_address AND bpb_bpt_prices.day = bpb.bpb_max_block_date \ No newline at end of file diff --git a/models/_project/balancer/trades/gnosis/_schema.yml b/dex/models/_projects/balancer/trades/gnosis/_schema.yml similarity index 97% rename from models/_project/balancer/trades/gnosis/_schema.yml rename to dex/models/_projects/balancer/trades/gnosis/_schema.yml index ae5ae4065a2..9c61182b8cd 100644 --- a/models/_project/balancer/trades/gnosis/_schema.yml +++ b/dex/models/_projects/balancer/trades/gnosis/_schema.yml @@ -19,10 +19,6 @@ models: - version - tx_hash - evt_index - - check_dex_seed: - blockchain: gnosis - project: balancer - version: 2 columns: - &blockchain name: blockchain diff --git a/models/_project/balancer/trades/gnosis/balancer_gnosis_trades.sql b/dex/models/_projects/balancer/trades/gnosis/balancer_gnosis_trades.sql similarity index 100% rename from models/_project/balancer/trades/gnosis/balancer_gnosis_trades.sql rename to dex/models/_projects/balancer/trades/gnosis/balancer_gnosis_trades.sql diff --git a/models/_project/balancer/trades/gnosis/balancer_v2_gnosis_trades.sql b/dex/models/_projects/balancer/trades/gnosis/balancer_v2_gnosis_trades.sql similarity index 93% rename from models/_project/balancer/trades/gnosis/balancer_v2_gnosis_trades.sql rename to dex/models/_projects/balancer/trades/gnosis/balancer_v2_gnosis_trades.sql index 090b5b9e737..d9e629fe0df 100644 --- a/models/_project/balancer/trades/gnosis/balancer_v2_gnosis_trades.sql +++ b/dex/models/_projects/balancer/trades/gnosis/balancer_v2_gnosis_trades.sql @@ -68,7 +68,7 @@ WITH dexs.block_time, MAX(bpt_prices.day) AS bpa_max_block_date FROM dexs - LEFT JOIN {{ ref('balancer_v2_gnosis_bpt_prices') }} bpt_prices + LEFT JOIN {{ source('balancer_v2_gnosis', 'bpt_prices') }} bpt_prices ON bpt_prices.contract_address = dexs.token_bought_address AND bpt_prices.day <= DATE_TRUNC('day', dexs.block_time) GROUP BY 1, 2, 3, 4, 5 @@ -82,7 +82,7 @@ WITH dexs.block_time, MAX(bpt_prices.day) AS bpb_max_block_date FROM dexs - LEFT JOIN {{ ref('balancer_v2_gnosis_bpt_prices') }} bpt_prices + LEFT JOIN {{ source('balancer_v2_gnosis', 'bpt_prices') }} bpt_prices ON bpt_prices.contract_address = dexs.token_sold_address AND bpt_prices.day <= DATE_TRUNC('day', dexs.block_time) GROUP BY 1, 2, 3, 4, 5 @@ -132,13 +132,13 @@ FROM dexs ON bpa.block_number = dexs.block_number AND bpa.tx_hash = dexs.tx_hash AND bpa.evt_index = dexs.evt_index - LEFT JOIN {{ ref('balancer_v2_gnosis_bpt_prices') }} bpa_bpt_prices + LEFT JOIN {{ source('balancer_v2_gnosis', 'bpt_prices') }} bpa_bpt_prices ON bpa_bpt_prices.contract_address = bpa.contract_address AND bpa_bpt_prices.day = bpa.bpa_max_block_date INNER JOIN bpb ON bpb.block_number = dexs.block_number AND bpb.tx_hash = dexs.tx_hash AND bpb.evt_index = dexs.evt_index - LEFT JOIN {{ ref('balancer_v2_gnosis_bpt_prices') }} bpb_bpt_prices + LEFT JOIN {{ source('balancer_v2_gnosis', 'bpt_prices') }} bpb_bpt_prices ON bpb_bpt_prices.contract_address = bpb.contract_address AND bpb_bpt_prices.day = bpb.bpb_max_block_date \ No newline at end of file diff --git a/models/_project/balancer/trades/optimism/_schema.yml b/dex/models/_projects/balancer/trades/optimism/_schema.yml similarity index 97% rename from models/_project/balancer/trades/optimism/_schema.yml rename to dex/models/_projects/balancer/trades/optimism/_schema.yml index 481a7f9073b..326de06e009 100644 --- a/models/_project/balancer/trades/optimism/_schema.yml +++ b/dex/models/_projects/balancer/trades/optimism/_schema.yml @@ -19,10 +19,6 @@ models: - version - tx_hash - evt_index - - check_dex_seed: - blockchain: optimism - project: balancer - version: 2 columns: - &blockchain name: blockchain diff --git a/models/_project/balancer/trades/optimism/balancer_optimism_trades.sql b/dex/models/_projects/balancer/trades/optimism/balancer_optimism_trades.sql similarity index 100% rename from models/_project/balancer/trades/optimism/balancer_optimism_trades.sql rename to dex/models/_projects/balancer/trades/optimism/balancer_optimism_trades.sql diff --git a/models/_project/balancer/trades/optimism/balancer_v2_optimism_trades.sql b/dex/models/_projects/balancer/trades/optimism/balancer_v2_optimism_trades.sql similarity index 93% rename from models/_project/balancer/trades/optimism/balancer_v2_optimism_trades.sql rename to dex/models/_projects/balancer/trades/optimism/balancer_v2_optimism_trades.sql index b53e845ddd6..b04f7ea49bc 100644 --- a/models/_project/balancer/trades/optimism/balancer_v2_optimism_trades.sql +++ b/dex/models/_projects/balancer/trades/optimism/balancer_v2_optimism_trades.sql @@ -68,7 +68,7 @@ WITH dexs.block_time, MAX(bpt_prices.day) AS bpa_max_block_date FROM dexs - LEFT JOIN {{ ref('balancer_v2_optimism_bpt_prices') }} bpt_prices + LEFT JOIN {{ source('balancer_v2_optimism', 'bpt_prices') }} bpt_prices ON bpt_prices.contract_address = dexs.token_bought_address AND bpt_prices.day <= DATE_TRUNC('day', dexs.block_time) GROUP BY 1, 2, 3, 4, 5 @@ -82,7 +82,7 @@ WITH dexs.block_time, MAX(bpt_prices.day) AS bpb_max_block_date FROM dexs - LEFT JOIN {{ ref('balancer_v2_optimism_bpt_prices') }} bpt_prices + LEFT JOIN {{ source('balancer_v2_optimism', 'bpt_prices') }} bpt_prices ON bpt_prices.contract_address = dexs.token_sold_address AND bpt_prices.day <= DATE_TRUNC('day', dexs.block_time) GROUP BY 1, 2, 3, 4, 5 @@ -132,13 +132,13 @@ FROM dexs ON bpa.block_number = dexs.block_number AND bpa.tx_hash = dexs.tx_hash AND bpa.evt_index = dexs.evt_index - LEFT JOIN {{ ref('balancer_v2_optimism_bpt_prices') }} bpa_bpt_prices + LEFT JOIN {{ source('balancer_v2_optimism', 'bpt_prices') }} bpa_bpt_prices ON bpa_bpt_prices.contract_address = bpa.contract_address AND bpa_bpt_prices.day = bpa.bpa_max_block_date INNER JOIN bpb ON bpb.block_number = dexs.block_number AND bpb.tx_hash = dexs.tx_hash AND bpb.evt_index = dexs.evt_index - LEFT JOIN {{ ref('balancer_v2_optimism_bpt_prices') }} bpb_bpt_prices + LEFT JOIN {{ source('balancer_v2_optimism', 'bpt_prices') }} bpb_bpt_prices ON bpb_bpt_prices.contract_address = bpb.contract_address AND bpb_bpt_prices.day = bpb.bpb_max_block_date \ No newline at end of file diff --git a/models/_project/balancer/trades/polygon/_schema.yml b/dex/models/_projects/balancer/trades/polygon/_schema.yml similarity index 97% rename from models/_project/balancer/trades/polygon/_schema.yml rename to dex/models/_projects/balancer/trades/polygon/_schema.yml index c0dfa6ac51b..7691a4f0cc4 100644 --- a/models/_project/balancer/trades/polygon/_schema.yml +++ b/dex/models/_projects/balancer/trades/polygon/_schema.yml @@ -19,10 +19,6 @@ models: - version - tx_hash - evt_index - - check_dex_seed: - blockchain: polygon - project: balancer - version: 2 columns: - &blockchain name: blockchain diff --git a/models/_project/balancer/trades/polygon/balancer_polygon_trades.sql b/dex/models/_projects/balancer/trades/polygon/balancer_polygon_trades.sql similarity index 100% rename from models/_project/balancer/trades/polygon/balancer_polygon_trades.sql rename to dex/models/_projects/balancer/trades/polygon/balancer_polygon_trades.sql diff --git a/models/_project/balancer/trades/polygon/balancer_v2_polygon_trades.sql b/dex/models/_projects/balancer/trades/polygon/balancer_v2_polygon_trades.sql similarity index 93% rename from models/_project/balancer/trades/polygon/balancer_v2_polygon_trades.sql rename to dex/models/_projects/balancer/trades/polygon/balancer_v2_polygon_trades.sql index 37b12105abe..5a5f19c028e 100644 --- a/models/_project/balancer/trades/polygon/balancer_v2_polygon_trades.sql +++ b/dex/models/_projects/balancer/trades/polygon/balancer_v2_polygon_trades.sql @@ -68,7 +68,7 @@ WITH dexs.block_time, MAX(bpt_prices.day) AS bpa_max_block_date FROM dexs - LEFT JOIN {{ ref('balancer_v2_polygon_bpt_prices') }} bpt_prices + LEFT JOIN {{ source('balancer_v2_polygon', 'bpt_prices') }} bpt_prices ON bpt_prices.contract_address = dexs.token_bought_address AND bpt_prices.day <= DATE_TRUNC('day', dexs.block_time) GROUP BY 1, 2, 3, 4, 5 @@ -82,7 +82,7 @@ WITH dexs.block_time, MAX(bpt_prices.day) AS bpb_max_block_date FROM dexs - LEFT JOIN {{ ref('balancer_v2_polygon_bpt_prices') }} bpt_prices + LEFT JOIN {{ source('balancer_v2_polygon', 'bpt_prices') }} bpt_prices ON bpt_prices.contract_address = dexs.token_sold_address AND bpt_prices.day <= DATE_TRUNC('day', dexs.block_time) GROUP BY 1, 2, 3, 4, 5 @@ -132,13 +132,13 @@ FROM dexs ON bpa.block_number = dexs.block_number AND bpa.tx_hash = dexs.tx_hash AND bpa.evt_index = dexs.evt_index - LEFT JOIN {{ ref('balancer_v2_polygon_bpt_prices') }} bpa_bpt_prices + LEFT JOIN {{ source('balancer_v2_polygon', 'bpt_prices') }} bpa_bpt_prices ON bpa_bpt_prices.contract_address = bpa.contract_address AND bpa_bpt_prices.day = bpa.bpa_max_block_date INNER JOIN bpb ON bpb.block_number = dexs.block_number AND bpb.tx_hash = dexs.tx_hash AND bpb.evt_index = dexs.evt_index - LEFT JOIN {{ ref('balancer_v2_polygon_bpt_prices') }} bpb_bpt_prices + LEFT JOIN {{ source('balancer_v2_polygon', 'bpt_prices') }} bpb_bpt_prices ON bpb_bpt_prices.contract_address = bpb.contract_address AND bpb_bpt_prices.day = bpb.bpb_max_block_date \ No newline at end of file diff --git a/models/_project/balancer/trades/zkevm/_schema.yml b/dex/models/_projects/balancer/trades/zkevm/_schema.yml similarity index 97% rename from models/_project/balancer/trades/zkevm/_schema.yml rename to dex/models/_projects/balancer/trades/zkevm/_schema.yml index 80f42ffe980..a4c86cbc3a6 100644 --- a/models/_project/balancer/trades/zkevm/_schema.yml +++ b/dex/models/_projects/balancer/trades/zkevm/_schema.yml @@ -19,10 +19,6 @@ models: - version - tx_hash - evt_index - - check_dex_seed: - blockchain: zkevm - project: balancer - version: 2 columns: - &blockchain name: blockchain diff --git a/models/_project/balancer/trades/zkevm/balancer_v2_zkevm_trades.sql b/dex/models/_projects/balancer/trades/zkevm/balancer_v2_zkevm_trades.sql similarity index 93% rename from models/_project/balancer/trades/zkevm/balancer_v2_zkevm_trades.sql rename to dex/models/_projects/balancer/trades/zkevm/balancer_v2_zkevm_trades.sql index 36cc38e4a44..72103686ff8 100644 --- a/models/_project/balancer/trades/zkevm/balancer_v2_zkevm_trades.sql +++ b/dex/models/_projects/balancer/trades/zkevm/balancer_v2_zkevm_trades.sql @@ -68,7 +68,7 @@ WITH dexs.block_time, MAX(bpt_prices.day) AS bpa_max_block_date FROM dexs - LEFT JOIN {{ ref('balancer_v2_zkevm_bpt_prices') }} bpt_prices + LEFT JOIN {{ source('balancer_v2_zkevm', 'bpt_prices') }} bpt_prices ON bpt_prices.contract_address = dexs.token_bought_address AND bpt_prices.day <= DATE_TRUNC('day', dexs.block_time) GROUP BY 1, 2, 3, 4, 5 @@ -82,7 +82,7 @@ WITH dexs.block_time, MAX(bpt_prices.day) AS bpb_max_block_date FROM dexs - LEFT JOIN {{ ref('balancer_v2_zkevm_bpt_prices') }} bpt_prices + LEFT JOIN {{ source('balancer_v2_zkevm', 'bpt_prices') }} bpt_prices ON bpt_prices.contract_address = dexs.token_sold_address AND bpt_prices.day <= DATE_TRUNC('day', dexs.block_time) GROUP BY 1, 2, 3, 4, 5 @@ -132,13 +132,13 @@ FROM dexs ON bpa.block_number = dexs.block_number AND bpa.tx_hash = dexs.tx_hash AND bpa.evt_index = dexs.evt_index - LEFT JOIN {{ ref('balancer_v2_zkevm_bpt_prices') }} bpa_bpt_prices + LEFT JOIN {{ source('balancer_v2_zkevm', 'bpt_prices') }} bpa_bpt_prices ON bpa_bpt_prices.contract_address = bpa.contract_address AND bpa_bpt_prices.day = bpa.bpa_max_block_date INNER JOIN bpb ON bpb.block_number = dexs.block_number AND bpb.tx_hash = dexs.tx_hash AND bpb.evt_index = dexs.evt_index - LEFT JOIN {{ ref('balancer_v2_zkevm_bpt_prices') }} bpb_bpt_prices + LEFT JOIN {{ source('balancer_v2_zkevm', 'bpt_prices') }} bpb_bpt_prices ON bpb_bpt_prices.contract_address = bpb.contract_address AND bpb_bpt_prices.day = bpb.bpb_max_block_date \ No newline at end of file diff --git a/models/_project/balancer/trades/zkevm/balancer_zkevm_trades.sql b/dex/models/_projects/balancer/trades/zkevm/balancer_zkevm_trades.sql similarity index 100% rename from models/_project/balancer/trades/zkevm/balancer_zkevm_trades.sql rename to dex/models/_projects/balancer/trades/zkevm/balancer_zkevm_trades.sql diff --git a/models/_project/bancor/bancor_trades.sql b/dex/models/_projects/bancor/bancor_trades.sql similarity index 100% rename from models/_project/bancor/bancor_trades.sql rename to dex/models/_projects/bancor/bancor_trades.sql diff --git a/models/bebop/bebop_trades_schema.yml b/dex/models/_projects/bebop/_schema.yml similarity index 100% rename from models/bebop/bebop_trades_schema.yml rename to dex/models/_projects/bebop/_schema.yml diff --git a/models/bebop/arbitrum/bebop_arbitrum_schema.yml b/dex/models/_projects/bebop/arbitrum/_schema.yml similarity index 100% rename from models/bebop/arbitrum/bebop_arbitrum_schema.yml rename to dex/models/_projects/bebop/arbitrum/_schema.yml diff --git a/models/bebop/arbitrum/bebop_arbitrum_trades.sql b/dex/models/_projects/bebop/arbitrum/bebop_arbitrum_trades.sql similarity index 100% rename from models/bebop/arbitrum/bebop_arbitrum_trades.sql rename to dex/models/_projects/bebop/arbitrum/bebop_arbitrum_trades.sql diff --git a/models/bebop/arbitrum/bebop_blend_arbitrum_trades.sql b/dex/models/_projects/bebop/arbitrum/bebop_blend_arbitrum_trades.sql similarity index 100% rename from models/bebop/arbitrum/bebop_blend_arbitrum_trades.sql rename to dex/models/_projects/bebop/arbitrum/bebop_blend_arbitrum_trades.sql diff --git a/models/bebop/arbitrum/bebop_jam_arbitrum_trades.sql b/dex/models/_projects/bebop/arbitrum/bebop_jam_arbitrum_trades.sql similarity index 100% rename from models/bebop/arbitrum/bebop_jam_arbitrum_trades.sql rename to dex/models/_projects/bebop/arbitrum/bebop_jam_arbitrum_trades.sql diff --git a/models/bebop/arbitrum/bebop_rfq_arbitrum_trades.sql b/dex/models/_projects/bebop/arbitrum/bebop_rfq_arbitrum_trades.sql similarity index 100% rename from models/bebop/arbitrum/bebop_rfq_arbitrum_trades.sql rename to dex/models/_projects/bebop/arbitrum/bebop_rfq_arbitrum_trades.sql diff --git a/models/bebop/base/bebop_base_schema.yml b/dex/models/_projects/bebop/base/_schema.yml similarity index 100% rename from models/bebop/base/bebop_base_schema.yml rename to dex/models/_projects/bebop/base/_schema.yml diff --git a/models/bebop/base/bebop_base_trades.sql b/dex/models/_projects/bebop/base/bebop_base_trades.sql similarity index 100% rename from models/bebop/base/bebop_base_trades.sql rename to dex/models/_projects/bebop/base/bebop_base_trades.sql diff --git a/models/bebop/base/bebop_blend_base_trades.sql b/dex/models/_projects/bebop/base/bebop_blend_base_trades.sql similarity index 100% rename from models/bebop/base/bebop_blend_base_trades.sql rename to dex/models/_projects/bebop/base/bebop_blend_base_trades.sql diff --git a/models/bebop/base/bebop_jam_base_trades.sql b/dex/models/_projects/bebop/base/bebop_jam_base_trades.sql similarity index 100% rename from models/bebop/base/bebop_jam_base_trades.sql rename to dex/models/_projects/bebop/base/bebop_jam_base_trades.sql diff --git a/models/bebop/bebop_trades.sql b/dex/models/_projects/bebop/bebop_trades.sql similarity index 100% rename from models/bebop/bebop_trades.sql rename to dex/models/_projects/bebop/bebop_trades.sql diff --git a/models/bebop/bnb/bebop_bnb_schema.yml b/dex/models/_projects/bebop/bnb/_schema.yml similarity index 100% rename from models/bebop/bnb/bebop_bnb_schema.yml rename to dex/models/_projects/bebop/bnb/_schema.yml diff --git a/models/bebop/bnb/bebop_bnb_trades.sql b/dex/models/_projects/bebop/bnb/bebop_bnb_trades.sql similarity index 100% rename from models/bebop/bnb/bebop_bnb_trades.sql rename to dex/models/_projects/bebop/bnb/bebop_bnb_trades.sql diff --git a/models/bebop/bnb/bebop_jam_bnb_trades.sql b/dex/models/_projects/bebop/bnb/bebop_jam_bnb_trades.sql similarity index 100% rename from models/bebop/bnb/bebop_jam_bnb_trades.sql rename to dex/models/_projects/bebop/bnb/bebop_jam_bnb_trades.sql diff --git a/models/bebop/ethereum/bebop_ethereum_schema.yml b/dex/models/_projects/bebop/ethereum/_schema.yml similarity index 100% rename from models/bebop/ethereum/bebop_ethereum_schema.yml rename to dex/models/_projects/bebop/ethereum/_schema.yml diff --git a/models/bebop/ethereum/bebop_blend_ethereum_trades.sql b/dex/models/_projects/bebop/ethereum/bebop_blend_ethereum_trades.sql similarity index 100% rename from models/bebop/ethereum/bebop_blend_ethereum_trades.sql rename to dex/models/_projects/bebop/ethereum/bebop_blend_ethereum_trades.sql diff --git a/models/bebop/ethereum/bebop_ethereum_trades.sql b/dex/models/_projects/bebop/ethereum/bebop_ethereum_trades.sql similarity index 100% rename from models/bebop/ethereum/bebop_ethereum_trades.sql rename to dex/models/_projects/bebop/ethereum/bebop_ethereum_trades.sql diff --git a/models/bebop/ethereum/bebop_jam_ethereum_trades.sql b/dex/models/_projects/bebop/ethereum/bebop_jam_ethereum_trades.sql similarity index 100% rename from models/bebop/ethereum/bebop_jam_ethereum_trades.sql rename to dex/models/_projects/bebop/ethereum/bebop_jam_ethereum_trades.sql diff --git a/models/bebop/ethereum/bebop_rfq_ethereum_trades.sql b/dex/models/_projects/bebop/ethereum/bebop_rfq_ethereum_trades.sql similarity index 100% rename from models/bebop/ethereum/bebop_rfq_ethereum_trades.sql rename to dex/models/_projects/bebop/ethereum/bebop_rfq_ethereum_trades.sql diff --git a/models/bebop/optimism/bebop_optimism_schema.yml b/dex/models/_projects/bebop/optimism/_schema.yml similarity index 100% rename from models/bebop/optimism/bebop_optimism_schema.yml rename to dex/models/_projects/bebop/optimism/_schema.yml diff --git a/models/bebop/optimism/bebop_jam_optimism_trades.sql b/dex/models/_projects/bebop/optimism/bebop_jam_optimism_trades.sql similarity index 100% rename from models/bebop/optimism/bebop_jam_optimism_trades.sql rename to dex/models/_projects/bebop/optimism/bebop_jam_optimism_trades.sql diff --git a/models/bebop/optimism/bebop_optimism_trades.sql b/dex/models/_projects/bebop/optimism/bebop_optimism_trades.sql similarity index 100% rename from models/bebop/optimism/bebop_optimism_trades.sql rename to dex/models/_projects/bebop/optimism/bebop_optimism_trades.sql diff --git a/models/bebop/optimism/bebop_rfq_optimism_trades.sql b/dex/models/_projects/bebop/optimism/bebop_rfq_optimism_trades.sql similarity index 100% rename from models/bebop/optimism/bebop_rfq_optimism_trades.sql rename to dex/models/_projects/bebop/optimism/bebop_rfq_optimism_trades.sql diff --git a/models/bebop/polygon/bebop_polygon_schema.yml b/dex/models/_projects/bebop/polygon/_schema.yml similarity index 100% rename from models/bebop/polygon/bebop_polygon_schema.yml rename to dex/models/_projects/bebop/polygon/_schema.yml diff --git a/models/bebop/polygon/bebop_blend_polygon_trades.sql b/dex/models/_projects/bebop/polygon/bebop_blend_polygon_trades.sql similarity index 100% rename from models/bebop/polygon/bebop_blend_polygon_trades.sql rename to dex/models/_projects/bebop/polygon/bebop_blend_polygon_trades.sql diff --git a/models/bebop/polygon/bebop_jam_polygon_trades.sql b/dex/models/_projects/bebop/polygon/bebop_jam_polygon_trades.sql similarity index 100% rename from models/bebop/polygon/bebop_jam_polygon_trades.sql rename to dex/models/_projects/bebop/polygon/bebop_jam_polygon_trades.sql diff --git a/models/bebop/polygon/bebop_polygon_trades.sql b/dex/models/_projects/bebop/polygon/bebop_polygon_trades.sql similarity index 100% rename from models/bebop/polygon/bebop_polygon_trades.sql rename to dex/models/_projects/bebop/polygon/bebop_polygon_trades.sql diff --git a/models/bebop/polygon/bebop_rfq_polygon_trades.sql b/dex/models/_projects/bebop/polygon/bebop_rfq_polygon_trades.sql similarity index 100% rename from models/bebop/polygon/bebop_rfq_polygon_trades.sql rename to dex/models/_projects/bebop/polygon/bebop_rfq_polygon_trades.sql diff --git a/models/bebop/scroll/bebop_scroll_schema.yml b/dex/models/_projects/bebop/scroll/_schema.yml similarity index 100% rename from models/bebop/scroll/bebop_scroll_schema.yml rename to dex/models/_projects/bebop/scroll/_schema.yml diff --git a/models/bebop/scroll/bebop_jam_scroll_trades.sql b/dex/models/_projects/bebop/scroll/bebop_jam_scroll_trades.sql similarity index 100% rename from models/bebop/scroll/bebop_jam_scroll_trades.sql rename to dex/models/_projects/bebop/scroll/bebop_jam_scroll_trades.sql diff --git a/models/bebop/scroll/bebop_scroll_trades.sql b/dex/models/_projects/bebop/scroll/bebop_scroll_trades.sql similarity index 100% rename from models/bebop/scroll/bebop_scroll_trades.sql rename to dex/models/_projects/bebop/scroll/bebop_scroll_trades.sql diff --git a/models/bebop/zksync/bebop_zksync_schema.yml b/dex/models/_projects/bebop/zksync/_schema.yml similarity index 100% rename from models/bebop/zksync/bebop_zksync_schema.yml rename to dex/models/_projects/bebop/zksync/_schema.yml diff --git a/models/bebop/zksync/bebop_jam_zksync_trades.sql b/dex/models/_projects/bebop/zksync/bebop_jam_zksync_trades.sql similarity index 100% rename from models/bebop/zksync/bebop_jam_zksync_trades.sql rename to dex/models/_projects/bebop/zksync/bebop_jam_zksync_trades.sql diff --git a/models/bebop/zksync/bebop_zksync_trades.sql b/dex/models/_projects/bebop/zksync/bebop_zksync_trades.sql similarity index 100% rename from models/bebop/zksync/bebop_zksync_trades.sql rename to dex/models/_projects/bebop/zksync/bebop_zksync_trades.sql diff --git a/dex/models/_projects/beethoven_x/_schema.yml b/dex/models/_projects/beethoven_x/_schema.yml new file mode 100644 index 00000000000..bfc9021bb99 --- /dev/null +++ b/dex/models/_projects/beethoven_x/_schema.yml @@ -0,0 +1,53 @@ +version: 2 + +models: + - name: beethoven_x_fantom_pools_fees + meta: + blockchain: fantom + project: beethoven_x + contributors: jacektrocinski, thetroyharris, tomfutago + config: + tags: ['fantom', 'balancer', 'pools_fees'] + description: > + Beethoven X swap fees stored at the pool level. + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - block_number + - tx_hash + - index + columns: + - &blockchain + name: blockchain + description: "Blockchain which the DEX is deployed" + - &contract_address + name: contract_address + description: 'fantom address for the liquidity pool used in transaction' + tests: + - not_null + - &tx_hash + name: tx_hash + description: "Unique transaction hash value tied to each transaction on the DEX" + - &index + name: index + description: '' + tests: + - not_null + - &tx_index + name: tx_index + description: '' + tests: + - not_null + - &block_time + name: block_time + description: "UTC event block time of each DEX trade" + - &block_number + name: block_number + description: 'Block number' + tests: + - not_null + - &swap_fee_percentage + name: swap_fee_percentage + description: 'Swap fees for the pool, values are returned with 18 decimals (1e18 meaning 100%)' + tests: + - not_null \ No newline at end of file diff --git a/models/beethoven_x/fantom/beethoven_x_fantom_pools_fees.sql b/dex/models/_projects/beethoven_x/beethoven_x_fantom_pools_fees.sql similarity index 100% rename from models/beethoven_x/fantom/beethoven_x_fantom_pools_fees.sql rename to dex/models/_projects/beethoven_x/beethoven_x_fantom_pools_fees.sql diff --git a/models/_project/beethoven_x/beethoven_x_trades.sql b/dex/models/_projects/beethoven_x/beethoven_x_trades.sql similarity index 100% rename from models/_project/beethoven_x/beethoven_x_trades.sql rename to dex/models/_projects/beethoven_x/beethoven_x_trades.sql diff --git a/models/_project/biswap/biswap_trades.sql b/dex/models/_projects/biswap/biswap_trades.sql similarity index 100% rename from models/_project/biswap/biswap_trades.sql rename to dex/models/_projects/biswap/biswap_trades.sql diff --git a/models/_project/camelot/camelot_trades.sql b/dex/models/_projects/camelot/camelot_trades.sql similarity index 100% rename from models/_project/camelot/camelot_trades.sql rename to dex/models/_projects/camelot/camelot_trades.sql diff --git a/models/_project/carbon_defi/carbon_defi_trades.sql b/dex/models/_projects/carbon_defi/carbon_defi_trades.sql similarity index 100% rename from models/_project/carbon_defi/carbon_defi_trades.sql rename to dex/models/_projects/carbon_defi/carbon_defi_trades.sql diff --git a/models/_project/clipper/clipper_trades.sql b/dex/models/_projects/clipper/clipper_trades.sql similarity index 100% rename from models/_project/clipper/clipper_trades.sql rename to dex/models/_projects/clipper/clipper_trades.sql diff --git a/dex/models/_projects/cow_protocol/_schema.yml b/dex/models/_projects/cow_protocol/_schema.yml new file mode 100644 index 00000000000..3fe644f02d4 --- /dev/null +++ b/dex/models/_projects/cow_protocol/_schema.yml @@ -0,0 +1,325 @@ +version: 2 + +models: + - name: cow_protocol_trades + meta: + blockchain: ethereum + sector: dex + project: cow_protocol + contributors: bh2smith, gentrexha + config: + tags: ['ethereum','cow_protocol','trades','dex','aggregator','cross-chain'] + description: > + CoW Protocol trades on all chains across all contracts and versions. + This table will load dex trades downstream. + This particular version of the protocol trades table is intended to conform + with the columns as specified in dex.trades sector. + A more detailed version of the protocol trades table can be found under `cow_protocol_ethereum.trades` + columns: + - &blockchain + name: blockchain + description: "Blockchain which the project is deployed" + - &project + name: project + description: "Project name" + - &version + name: version + description: "Version of the contract built and deployed by the project" + - &block_date + name: block_date + description: "UTC event block date of each trade" + - &block_time + name: block_time + description: "UTC event block time of each trade" + - &token_bought_symbol + name: token_bought_symbol + description: "Token symbol for token bought in the trade" + - &token_sold_symbol + name: token_sold_symbol + description: "Token symbol for token sold in the trade" + - &token_pair + name: token_pair + description: "Token symbol pair for each token involved in the trade" + - &token_bought_amount + name: token_bought_amount + description: "Value of the token bought at time of execution in the original currency" + - &token_sold_amount + name: token_sold_amount + description: "Value of the token sold at time of execution in the original currency" + - &token_bought_amount_raw + name: token_bought_amount_raw + description: "Raw value of the token bought at time of execution in the original currency" + - &token_sold_amount_raw + name: token_sold_amount_raw + description: "Raw value of the token sold at time of execution in the original currency" + - &amount_usd + name: amount_usd + description: "USD value of the trade at time of execution" + - &token_bought_address + name: token_bought_address + description: "Contract address of the token bought" + - &token_sold_address + name: token_sold_address + description: "Contract address of the token sold" + - &taker + name: taker + description: "Address of trader who purchased a token" + - &maker + name: maker + description: "Address of trader who sold a token" + - &project_contract_address + name: project_contract_address + description: "Project contract address which executed the trade on the blockchain" + - &tx_hash + name: tx_hash + description: "Unique transaction hash value tied to each transaction on the DEX" + - &tx_from + name: tx_from + description: "Trader address owning the order being filled" + - &tx_to + name: tx_to + description: "Address which received the token bought" + - &trace_address + name: trace_address + description: "" + - &evt_index + name: evt_index + description: "Index of the corresponding trade event" + + - name: cow_protocol_arbitrum_trades + meta: + blockchain: arbitrum + project: cow_protocol + contributors: olgafetisova + config: + tags: ['arbitrum','cow_protocol','trades', 'dex', 'aggregator'] + description: > + CoW Protocol enriched trades list on Arbitrum Chain + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - tx_hash + - order_uid + - evt_index + columns: + - name: block_date + description: "UTC event block date of each trade" + - name: block_time + description: "Timestamp for block event time in UTC" + - name: tx_hash + description: "Transaction hash of trade" + - name: evt_index + description: "Index of the corresponding trade event" + - name: order_uid + description: "Unique identifier of order involved in trade. Note that partially fillable orders can be touched multiple times so this is not a unique ID for trade events." + - name: trader + description: "Owner of the order being traded (aka trader)" + - name: sell_token_address + description: "Arbitrum address of sellToken" + - name: sell_token + description: "Symbol of sellToken" + - name: buy_token_address + description: "Arbitrum address of buyToken" + - name: buy_token + description: "Symbol of buyToken" + - name: token_pair + description: "Ordered concatenation of buy/sell token symbols involved in trade" + - name: units_sold + description: "Units of sellToken sold (incorporates token decimals)." + - name: atoms_sold + description: "Amount (in atoms) of the sellToken sold" + - name: units_bought + description: "Units of buyToken bought (incorporates token decimals)." + - name: atoms_bought + description: "Amount (in atoms) of the buyToken bought" + - name: usd_value + description: "USD value of trade (taken as the max of buy value, sell value when both available, otherwise whichever is known)" + - name: buy_price + description: "USD price of buyToken at the time of trade" + - name: buy_value_usd + description: "USD value of buyToken amount" + - name: sell_price + description: "USD price of sellToken at the time of trade" + - name: sell_value_usd + description: "USD value of sellToken amount" + - name: fee + description: "Unit of fee taken (in sellToken) - incorporating token decimals" + - name: fee_atoms + description: "Amount (in atoms) of fee - taken in sellToken" + - name: fee_usd + description: "USD value of trade fee" + - name: app_data + description: "Hashed metadata related to trade event (full content available on IPFS)" + - name: receiver + description: "Recipient of trades buyToken" + - name: limit_sell_amount + description: "Sell amount side of the limit price" + - name: limit_buy_amount + description: "Buy amount side of the limit price" + - name: valid_to + description: "epoch timestamp (in seconds) until when the order was valid" + - name: flags + description: "bitmap with additional trade information (cf. https://github.com/cowprotocol/contracts/blob/main/src/contracts/libraries/GPv2Trade.sol#L58-L94)" + - name: surplus_usd + description: "USD value of surplus (difference between limit and executed price)" + + - name: cow_protocol_ethereum_trades + meta: + blockchain: ethereum + project: cow_protocol + contributors: bh2smith, gentrexha + config: + tags: ['ethereum','cow_protocol','trades', 'dex', 'aggregator'] + description: > + CoW Protocol enriched trades list on Ethereum + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - tx_hash + - order_uid + - evt_index + columns: + - name: block_date + description: "UTC event block date of each trade" + - name: block_number + description: "Block number that the transaction was included" + - name: block_time + description: "Timestamp for block event time in UTC" + - name: tx_hash + description: "Transaction hash of trade" + - name: evt_index + description: "Index of the corresponding trade event" + - name: order_uid + description: "Unique identifier of order involved in trade. Note that partially fillable orders can be touched multiple times so this is not a unique ID for trade events." + - name: trader + description: "Owner of the order being traded (aka trader)" + - name: sell_token_address + description: "Ethereum address of sellToken" + - name: sell_token + description: "Symbol of sellToken" + - name: buy_token_address + description: "Ethereum address of buyToken" + - name: buy_token + description: "Symbol of buyToken" + - name: token_pair + description: "Ordered concatenation of buy/sell token symbols involved in trade" + - name: units_sold + description: "Units of sellToken sold (incorporates token decimals)." + - name: atoms_sold + description: "Amount (in atoms) of the sellToken sold" + - name: units_bought + description: "Units of buyToken bought (incorporates token decimals)." + - name: atoms_bought + description: "Amount (in atoms) of the buyToken bought" + - name: usd_value + description: "USD value of trade (taken as the max of buy value, sell value when both available, otherwise whichever is known)" + - name: buy_price + description: "USD price of buyToken at the time of trade" + - name: buy_value_usd + description: "USD value of buyToken amount" + - name: sell_price + description: "USD price of sellToken at the time of trade" + - name: sell_value_usd + description: "USD value of sellToken amount" + - name: fee + description: "Unit of fee taken (in sellToken) - incorporating token decimals" + - name: fee_atoms + description: "Amount (in atoms) of fee - taken in sellToken" + - name: fee_usd + description: "USD value of trade fee" + - name: app_data + description: "Hashed metadata related to trade event (full content available on IPFS)" + - name: receiver + description: "Recipient of trades buyToken" + - name: limit_sell_amount + description: "Sell amount side of the limit price" + - name: limit_buy_amount + description: "Buy amount side of the limit price" + - name: valid_to + description: "epoch timestamp (in seconds) until when the order was valid" + - name: flags + description: "bitmap with additional trade information (cf. https://github.com/cowprotocol/contracts/blob/main/src/contracts/libraries/GPv2Trade.sol#L58-L94)" + - name: surplus_usd + description: "USD value of surplus (difference between limit and executed price)" + - name: order_type + description: "SELL/BUY string indicating if the trade was a sell or buy order" + - name: partial_fill + description: "Boolean indicating if the order is partially fill-able" + - name: fill_proportion + + - name: cow_protocol_gnosis_trades + meta: + blockchain: gnosis + project: cow_protocol + contributors: bh2smith + config: + tags: ['gnosis','cow_protocol','trades', 'dex', 'aggregator'] + description: > + CoW Protocol enriched trades list on Gnosis Chain + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - tx_hash + - order_uid + - evt_index + columns: + - name: block_date + description: "UTC event block date of each trade" + - name: block_time + description: "Timestamp for block event time in UTC" + - name: tx_hash + description: "Transaction hash of trade" + - name: evt_index + description: "Index of the corresponding trade event" + - name: order_uid + description: "Unique identifier of order involved in trade. Note that partially fillable orders can be touched multiple times so this is not a unique ID for trade events." + - name: trader + description: "Owner of the order being traded (aka trader)" + - name: sell_token_address + description: "Ethereum address of sellToken" + - name: sell_token + description: "Symbol of sellToken" + - name: buy_token_address + description: "Ethereum address of buyToken" + - name: buy_token + description: "Symbol of buyToken" + - name: token_pair + description: "Ordered concatenation of buy/sell token symbols involved in trade" + - name: units_sold + description: "Units of sellToken sold (incorporates token decimals)." + - name: atoms_sold + description: "Amount (in atoms) of the sellToken sold" + - name: units_bought + description: "Units of buyToken bought (incorporates token decimals)." + - name: atoms_bought + description: "Amount (in atoms) of the buyToken bought" + - name: usd_value + description: "USD value of trade (taken as the max of buy value, sell value when both available, otherwise whichever is known)" + - name: buy_price + description: "USD price of buyToken at the time of trade" + - name: buy_value_usd + description: "USD value of buyToken amount" + - name: sell_price + description: "USD price of sellToken at the time of trade" + - name: sell_value_usd + description: "USD value of sellToken amount" + - name: fee + description: "Unit of fee taken (in sellToken) - incorporating token decimals" + - name: fee_atoms + description: "Amount (in atoms) of fee - taken in sellToken" + - name: fee_usd + description: "USD value of trade fee" + - name: app_data + description: "Hashed metadata related to trade event (full content available on IPFS)" + - name: receiver + description: "Recipient of trades buyToken" + - name: limit_sell_amount + description: "Sell amount side of the limit price" + - name: limit_buy_amount + description: "Buy amount side of the limit price" + - name: valid_to + description: "epoch timestamp (in seconds) until when the order was valid" + - name: flags + description: "bitmap with additional trade information (cf. https://github.com/cowprotocol/contracts/blob/main/src/contracts/libraries/GPv2Trade.sol#L58-L94)" + - name: surplus_usd + description: "USD value of surplus (difference between limit and executed price)" \ No newline at end of file diff --git a/models/cow_protocol/arbitrum/cow_protocol_arbitrum_trades.sql b/dex/models/_projects/cow_protocol/arbitrum/cow_protocol_arbitrum_trades.sql similarity index 100% rename from models/cow_protocol/arbitrum/cow_protocol_arbitrum_trades.sql rename to dex/models/_projects/cow_protocol/arbitrum/cow_protocol_arbitrum_trades.sql diff --git a/models/cow_protocol/cow_protocol_trades.sql b/dex/models/_projects/cow_protocol/cow_protocol_trades.sql similarity index 98% rename from models/cow_protocol/cow_protocol_trades.sql rename to dex/models/_projects/cow_protocol/cow_protocol_trades.sql index 6f2a84d55e8..aa731eafcf3 100644 --- a/models/cow_protocol/cow_protocol_trades.sql +++ b/dex/models/_projects/cow_protocol/cow_protocol_trades.sql @@ -1,5 +1,5 @@ {{ config( - + schema = 'cow_protocol', alias='trades', post_hook='{{ expose_spells(\'["ethereum", "gnosis", "arbitrum"]\', "project", diff --git a/models/cow_protocol/ethereum/cow_protocol_ethereum_trades.sql b/dex/models/_projects/cow_protocol/ethereum/cow_protocol_ethereum_trades.sql similarity index 94% rename from models/cow_protocol/ethereum/cow_protocol_ethereum_trades.sql rename to dex/models/_projects/cow_protocol/ethereum/cow_protocol_ethereum_trades.sql index 5f7b78c54ee..0ff99b3625a 100644 --- a/models/cow_protocol/ethereum/cow_protocol_ethereum_trades.sql +++ b/dex/models/_projects/cow_protocol/ethereum/cow_protocol_ethereum_trades.sql @@ -1,17 +1,17 @@ {{ config( - - alias='trades', - materialized='incremental', - partition_by = ['block_month'], - unique_key = ['tx_hash', 'order_uid', 'evt_index'], - on_schema_change='sync_all_columns', - file_format ='delta', - incremental_strategy='merge', - incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.block_time')], - post_hook='{{ expose_spells(\'["ethereum"]\', - "project", - "cow_protocol", - \'["bh2smith", "gentrexha", "olgafetisova"]\') }}' + schema='cow_protocol_ethereum', + alias='trades', + materialized='incremental', + partition_by = ['block_month'], + unique_key = ['tx_hash', 'order_uid', 'evt_index'], + on_schema_change='sync_all_columns', + file_format ='delta', + incremental_strategy='merge', + incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.block_time')], + post_hook='{{ expose_spells(\'["ethereum"]\', + "project", + "cow_protocol", + \'["bh2smith", "gentrexha", "olgafetisova"]\') }}' ) }} diff --git a/models/cow_protocol/gnosis/cow_protocol_gnosis_trades.sql b/dex/models/_projects/cow_protocol/gnosis/cow_protocol_gnosis_trades.sql similarity index 99% rename from models/cow_protocol/gnosis/cow_protocol_gnosis_trades.sql rename to dex/models/_projects/cow_protocol/gnosis/cow_protocol_gnosis_trades.sql index 2bae34d7c63..60277f51741 100644 --- a/models/cow_protocol/gnosis/cow_protocol_gnosis_trades.sql +++ b/dex/models/_projects/cow_protocol/gnosis/cow_protocol_gnosis_trades.sql @@ -1,5 +1,5 @@ {{ config( - + schema = 'cow_protocol_gnosis', alias='trades', materialized='incremental', partition_by = ['block_month'], diff --git a/models/curvefi/celo/curvefi_celo_schema.yml b/dex/models/_projects/curvefi/celo/_schema.yml similarity index 100% rename from models/curvefi/celo/curvefi_celo_schema.yml rename to dex/models/_projects/curvefi/celo/_schema.yml diff --git a/models/curvefi/celo/curvefi_celo_pools.sql b/dex/models/_projects/curvefi/celo/curvefi_celo_pools.sql similarity index 100% rename from models/curvefi/celo/curvefi_celo_pools.sql rename to dex/models/_projects/curvefi/celo/curvefi_celo_pools.sql diff --git a/models/_project/curvefi/curvefi_trades.sql b/dex/models/_projects/curvefi/curvefi_trades.sql similarity index 100% rename from models/_project/curvefi/curvefi_trades.sql rename to dex/models/_projects/curvefi/curvefi_trades.sql diff --git a/models/curvefi/ethereum/curvefi_ethereum_schema.yml b/dex/models/_projects/curvefi/ethereum/_schema.yml similarity index 100% rename from models/curvefi/ethereum/curvefi_ethereum_schema.yml rename to dex/models/_projects/curvefi/ethereum/_schema.yml diff --git a/models/curvefi/ethereum/curvefi_ethereum_pool_details.sql b/dex/models/_projects/curvefi/ethereum/curvefi_ethereum_pool_details.sql similarity index 99% rename from models/curvefi/ethereum/curvefi_ethereum_pool_details.sql rename to dex/models/_projects/curvefi/ethereum/curvefi_ethereum_pool_details.sql index 71dc10c2a21..cebcd240178 100644 --- a/models/curvefi/ethereum/curvefi_ethereum_pool_details.sql +++ b/dex/models/_projects/curvefi/ethereum/curvefi_ethereum_pool_details.sql @@ -1,6 +1,6 @@ {{ config( - - alias = 'pool_details' + schema = 'curvefi_ethereum' + , alias = 'pool_details' ) }} SELECT diff --git a/models/curvefi/ethereum/curvefi_ethereum_view_pools.sql b/dex/models/_projects/curvefi/ethereum/curvefi_ethereum_view_pools.sql similarity index 99% rename from models/curvefi/ethereum/curvefi_ethereum_view_pools.sql rename to dex/models/_projects/curvefi/ethereum/curvefi_ethereum_view_pools.sql index 46185b413f4..d398ad52dc0 100644 --- a/models/curvefi/ethereum/curvefi_ethereum_view_pools.sql +++ b/dex/models/_projects/curvefi/ethereum/curvefi_ethereum_view_pools.sql @@ -1,5 +1,5 @@ {{ config( - + schema = 'curvefi_ethereum', alias = 'view_pools', materialized='table', file_format = 'delta', diff --git a/models/curvefi/fantom/curvefi_fantom_schema.yml b/dex/models/_projects/curvefi/fantom/_schema.yml similarity index 100% rename from models/curvefi/fantom/curvefi_fantom_schema.yml rename to dex/models/_projects/curvefi/fantom/_schema.yml diff --git a/models/curvefi/fantom/curvefi_fantom_pool_tokens.sql b/dex/models/_projects/curvefi/fantom/curvefi_fantom_pool_tokens.sql similarity index 99% rename from models/curvefi/fantom/curvefi_fantom_pool_tokens.sql rename to dex/models/_projects/curvefi/fantom/curvefi_fantom_pool_tokens.sql index 83a2b84ee31..e58a957e2c8 100644 --- a/models/curvefi/fantom/curvefi_fantom_pool_tokens.sql +++ b/dex/models/_projects/curvefi/fantom/curvefi_fantom_pool_tokens.sql @@ -1,5 +1,5 @@ {{ config( - + schema = 'curvefi_fantom', alias = 'pool_tokens', materialized = 'incremental', file_format = 'delta', diff --git a/dex/models/_projects/curvefi/optimism/_schema.yml b/dex/models/_projects/curvefi/optimism/_schema.yml new file mode 100644 index 00000000000..311dc638b22 --- /dev/null +++ b/dex/models/_projects/curvefi/optimism/_schema.yml @@ -0,0 +1,40 @@ +version: 2 + +models: + - name: curvefi_optimism_pools + meta: + blockchain: optimism + project: curvefi + contributors: msilb7 + config: + tags: ['optimism','curvefi','curve','dex'] + description: > + A table containing all known pools of curvefi on optimism (i.e. metapool, basicpool). Additional types should be monitored to ensure they're accurately shown. + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - version + - tokenid + - token + - pool + columns: + - &version + name: version + description: "Versions of the pool: Basic Pool, Meta Pool, etc" + tests: + - not_null + - &tokenid + name: tokenid + description: "ID of the token in the pool" + tests: + - not_null + - &token + name: token + description: "Token Address" + tests: + - not_null + - &pool + name: pool + description: "Pool contract address" + tests: + - not_null \ No newline at end of file diff --git a/models/curvefi/optimism/curvefi_optimism_pools.sql b/dex/models/_projects/curvefi/optimism/curvefi_optimism_pools.sql similarity index 99% rename from models/curvefi/optimism/curvefi_optimism_pools.sql rename to dex/models/_projects/curvefi/optimism/curvefi_optimism_pools.sql index 0e4ae291ece..1f738fa0af3 100644 --- a/models/curvefi/optimism/curvefi_optimism_pools.sql +++ b/dex/models/_projects/curvefi/optimism/curvefi_optimism_pools.sql @@ -1,5 +1,5 @@ {{ config( - + schema = 'curvefi_optimism', alias = 'pools', materialized = 'incremental', file_format = 'delta', diff --git a/models/curvefi/readme.md b/dex/models/_projects/curvefi/readme.md similarity index 100% rename from models/curvefi/readme.md rename to dex/models/_projects/curvefi/readme.md diff --git a/models/_project/defiswap/defiswap_trades.sql b/dex/models/_projects/defiswap/defiswap_trades.sql similarity index 100% rename from models/_project/defiswap/defiswap_trades.sql rename to dex/models/_projects/defiswap/defiswap_trades.sql diff --git a/models/_project/_schema.yml b/dex/models/_projects/dex_trades_views_schema.yml similarity index 99% rename from models/_project/_schema.yml rename to dex/models/_projects/dex_trades_views_schema.yml index 00230ce31ee..8b969c29d8d 100644 --- a/models/_project/_schema.yml +++ b/dex/models/_projects/dex_trades_views_schema.yml @@ -1,6 +1,6 @@ version: 2 -models: +models: - name: aerodrome_trades - name: airswap_trades - name: apeswap_trades diff --git a/models/_project/dfx/dfx_trades.sql b/dex/models/_projects/dfx/dfx_trades.sql similarity index 100% rename from models/_project/dfx/dfx_trades.sql rename to dex/models/_projects/dfx/dfx_trades.sql diff --git a/models/dodo/dodo_trades_schema.yml b/dex/models/_projects/dodo/_schema.yml similarity index 100% rename from models/dodo/dodo_trades_schema.yml rename to dex/models/_projects/dodo/_schema.yml diff --git a/models/dodo/arbitrum/dodo_arbitrum_schema.yml b/dex/models/_projects/dodo/arbitrum/_schema.yml similarity index 100% rename from models/dodo/arbitrum/dodo_arbitrum_schema.yml rename to dex/models/_projects/dodo/arbitrum/_schema.yml diff --git a/models/dodo/arbitrum/dodo_aggregator_arbitrum_trades.sql b/dex/models/_projects/dodo/arbitrum/dodo_aggregator_arbitrum_trades.sql similarity index 99% rename from models/dodo/arbitrum/dodo_aggregator_arbitrum_trades.sql rename to dex/models/_projects/dodo/arbitrum/dodo_aggregator_arbitrum_trades.sql index 08b6d5778a4..e16b77aebbc 100644 --- a/models/dodo/arbitrum/dodo_aggregator_arbitrum_trades.sql +++ b/dex/models/_projects/dodo/arbitrum/dodo_aggregator_arbitrum_trades.sql @@ -1,6 +1,6 @@ {{ config ( - + schema = 'dodo_arbitrum', alias = 'aggregator_trades', partition_by = ['block_month'], materialized = 'incremental', diff --git a/models/dodo/base/dodo_base_schema.yml b/dex/models/_projects/dodo/base/_schema.yml similarity index 100% rename from models/dodo/base/dodo_base_schema.yml rename to dex/models/_projects/dodo/base/_schema.yml diff --git a/models/dodo/base/dodo_aggregator_base_trades.sql b/dex/models/_projects/dodo/base/dodo_aggregator_base_trades.sql similarity index 99% rename from models/dodo/base/dodo_aggregator_base_trades.sql rename to dex/models/_projects/dodo/base/dodo_aggregator_base_trades.sql index 3f9374a5210..7842933a35b 100644 --- a/models/dodo/base/dodo_aggregator_base_trades.sql +++ b/dex/models/_projects/dodo/base/dodo_aggregator_base_trades.sql @@ -1,6 +1,6 @@ {{ config ( - + schema = 'dodo_base', alias = 'aggregator_trades', partition_by = ['block_month'], materialized = 'incremental', diff --git a/models/dodo/bnb/dodo_bnb_schema.yml b/dex/models/_projects/dodo/bnb/_schema.yml similarity index 100% rename from models/dodo/bnb/dodo_bnb_schema.yml rename to dex/models/_projects/dodo/bnb/_schema.yml diff --git a/models/dodo/bnb/dodo_aggregator_bnb_trades.sql b/dex/models/_projects/dodo/bnb/dodo_aggregator_bnb_trades.sql similarity index 99% rename from models/dodo/bnb/dodo_aggregator_bnb_trades.sql rename to dex/models/_projects/dodo/bnb/dodo_aggregator_bnb_trades.sql index 02c5d8cfb0a..8bbd1c5812c 100644 --- a/models/dodo/bnb/dodo_aggregator_bnb_trades.sql +++ b/dex/models/_projects/dodo/bnb/dodo_aggregator_bnb_trades.sql @@ -1,6 +1,6 @@ {{ config ( - + schema = 'dodo_bnb', alias = 'aggregator_trades', partition_by = ['block_month'], materialized = 'incremental', diff --git a/models/dodo/dodo_aggregator_trades.sql b/dex/models/_projects/dodo/dodo_aggregator_trades.sql similarity index 79% rename from models/dodo/dodo_aggregator_trades.sql rename to dex/models/_projects/dodo/dodo_aggregator_trades.sql index 499def3d2f7..960836bfe2a 100644 --- a/models/dodo/dodo_aggregator_trades.sql +++ b/dex/models/_projects/dodo/dodo_aggregator_trades.sql @@ -1,11 +1,11 @@ {{ config( - - alias = 'aggregator_trades', - post_hook='{{ expose_spells(\'["ethereum","bnb","polygon","arbitrum","optimism","base"]\', - "project", - "dodo", - \'["owen05"]\') }}' - ) + schema = 'dodo', + alias = 'aggregator_trades', + post_hook='{{ expose_spells(\'["ethereum","bnb","polygon","arbitrum","optimism","base"]\', + "project", + "dodo", + \'["owen05"]\') }}' + ) }} {% set dodo_models = [ diff --git a/models/_project/dodo/dodo_trades.sql b/dex/models/_projects/dodo/dodo_trades.sql similarity index 100% rename from models/_project/dodo/dodo_trades.sql rename to dex/models/_projects/dodo/dodo_trades.sql diff --git a/models/dodo/ethereum/dodo_ethereum_schema.yml b/dex/models/_projects/dodo/ethereum/_schema.yml similarity index 100% rename from models/dodo/ethereum/dodo_ethereum_schema.yml rename to dex/models/_projects/dodo/ethereum/_schema.yml diff --git a/models/dodo/ethereum/dodo_aggregator_ethereum_trades.sql b/dex/models/_projects/dodo/ethereum/dodo_aggregator_ethereum_trades.sql similarity index 99% rename from models/dodo/ethereum/dodo_aggregator_ethereum_trades.sql rename to dex/models/_projects/dodo/ethereum/dodo_aggregator_ethereum_trades.sql index 03a9d496d67..0276d19f0be 100644 --- a/models/dodo/ethereum/dodo_aggregator_ethereum_trades.sql +++ b/dex/models/_projects/dodo/ethereum/dodo_aggregator_ethereum_trades.sql @@ -1,6 +1,6 @@ {{ config ( - + schema = 'dodo_ethereum', alias = 'aggregator_trades', partition_by = ['block_month'], materialized = 'incremental', diff --git a/models/dodo/optimism/dodo_optimism_schema.yml b/dex/models/_projects/dodo/optimism/_schema.yml similarity index 100% rename from models/dodo/optimism/dodo_optimism_schema.yml rename to dex/models/_projects/dodo/optimism/_schema.yml diff --git a/models/dodo/optimism/dodo_aggregator_optimism_trades.sql b/dex/models/_projects/dodo/optimism/dodo_aggregator_optimism_trades.sql similarity index 99% rename from models/dodo/optimism/dodo_aggregator_optimism_trades.sql rename to dex/models/_projects/dodo/optimism/dodo_aggregator_optimism_trades.sql index 8325dd73c9f..16783aec971 100644 --- a/models/dodo/optimism/dodo_aggregator_optimism_trades.sql +++ b/dex/models/_projects/dodo/optimism/dodo_aggregator_optimism_trades.sql @@ -1,6 +1,6 @@ {{ config ( - + schema = 'dodo_optimism', alias = 'aggregator_trades', partition_by = ['block_month'], materialized = 'incremental', diff --git a/models/dodo/polygon/dodo_polygon_schema.yml b/dex/models/_projects/dodo/polygon/_schema.yml similarity index 100% rename from models/dodo/polygon/dodo_polygon_schema.yml rename to dex/models/_projects/dodo/polygon/_schema.yml diff --git a/models/dodo/polygon/dodo_aggregator_polygon_trades.sql b/dex/models/_projects/dodo/polygon/dodo_aggregator_polygon_trades.sql similarity index 99% rename from models/dodo/polygon/dodo_aggregator_polygon_trades.sql rename to dex/models/_projects/dodo/polygon/dodo_aggregator_polygon_trades.sql index 7b3f165cbcf..44391d3e094 100644 --- a/models/dodo/polygon/dodo_aggregator_polygon_trades.sql +++ b/dex/models/_projects/dodo/polygon/dodo_aggregator_polygon_trades.sql @@ -1,6 +1,6 @@ {{ config ( - + schema = 'dodo_polygon', alias = 'aggregator_trades', partition_by = ['block_month'], materialized = 'incremental', diff --git a/dex/models/_projects/ellipsis_finance/_schema.yml b/dex/models/_projects/ellipsis_finance/_schema.yml new file mode 100644 index 00000000000..fa2d567f110 --- /dev/null +++ b/dex/models/_projects/ellipsis_finance/_schema.yml @@ -0,0 +1,48 @@ +version: 2 + +models: + - name: ellipsis_finance_bnb_pool_tokens + meta: + blockchain: bnb + sector: dex + project: ellipsis_finance + contributors: Henrystats, 0xRob + config: + tags: ["bnb", "pool_tokens", "ellipsis", "dex"] + description: > + Ellipsis underlying tokens for token_exchange_underlying event + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - pool + - token_id + - token_type + - check_dex_pools_seed: + blockchain: bnb + project: ellipsis_finance + version: 1 + columns: + - &blockchain + name: blockchain + description: "Blockchain which the DEX is deployed" + - &project + name: project + description: "Project name of the DEX" + - &version + name: version + description: "Version of the contract built and deployed by the DEX project" + - &pool + name: pool + description: "pool contract address" + - &token_id + name: token_id + description: "underlying token id" + - &token_address + name: token_address + description: "underlying token address" + - &token_type + name: token_type + description: "token data (Underlying token, pool token.......)" + - &pool_type + name: pool_type + description: "pool type (Meta Pool, Base Pool....)" \ No newline at end of file diff --git a/models/ellipsis_finance/bnb/ellipsis_finance_bnb_pool_tokens.sql b/dex/models/_projects/ellipsis_finance/ellipsis_finance_bnb_pool_tokens.sql similarity index 100% rename from models/ellipsis_finance/bnb/ellipsis_finance_bnb_pool_tokens.sql rename to dex/models/_projects/ellipsis_finance/ellipsis_finance_bnb_pool_tokens.sql diff --git a/models/_project/ellipsis_finance/ellipsis_finance_trades.sql b/dex/models/_projects/ellipsis_finance/ellipsis_finance_trades.sql similarity index 100% rename from models/_project/ellipsis_finance/ellipsis_finance_trades.sql rename to dex/models/_projects/ellipsis_finance/ellipsis_finance_trades.sql diff --git a/models/_project/equalizer/equalizer_trades.sql b/dex/models/_projects/equalizer/equalizer_trades.sql similarity index 100% rename from models/_project/equalizer/equalizer_trades.sql rename to dex/models/_projects/equalizer/equalizer_trades.sql diff --git a/models/equalizer/fantom/equalizer_fantom_schema.yml b/dex/models/_projects/equalizer/fantom/_schema.yml similarity index 100% rename from models/equalizer/fantom/equalizer_fantom_schema.yml rename to dex/models/_projects/equalizer/fantom/_schema.yml diff --git a/models/equalizer/fantom/equalizer_fantom_pools.sql b/dex/models/_projects/equalizer/fantom/equalizer_fantom_pools.sql similarity index 100% rename from models/equalizer/fantom/equalizer_fantom_pools.sql rename to dex/models/_projects/equalizer/fantom/equalizer_fantom_pools.sql diff --git a/models/firebird_finance/optimism/firebird_finance_optimism_schema.yml b/dex/models/_projects/firebird_finance/optimism/_schema.yml similarity index 100% rename from models/firebird_finance/optimism/firebird_finance_optimism_schema.yml rename to dex/models/_projects/firebird_finance/optimism/_schema.yml diff --git a/models/firebird_finance/optimism/firebird_finance_optimism_trades.sql b/dex/models/_projects/firebird_finance/optimism/firebird_finance_optimism_trades.sql similarity index 100% rename from models/firebird_finance/optimism/firebird_finance_optimism_trades.sql rename to dex/models/_projects/firebird_finance/optimism/firebird_finance_optimism_trades.sql diff --git a/models/_project/fraxswap/fraxswap_trades.sql b/dex/models/_projects/fraxswap/fraxswap_trades.sql similarity index 100% rename from models/_project/fraxswap/fraxswap_trades.sql rename to dex/models/_projects/fraxswap/fraxswap_trades.sql diff --git a/models/gamma/gamma_schema.yml b/dex/models/_projects/gamma/_schema.yml similarity index 100% rename from models/gamma/gamma_schema.yml rename to dex/models/_projects/gamma/_schema.yml diff --git a/models/gamma/gamma_uniswap_pools.sql b/dex/models/_projects/gamma/gamma_uniswap_pools.sql similarity index 100% rename from models/gamma/gamma_uniswap_pools.sql rename to dex/models/_projects/gamma/gamma_uniswap_pools.sql diff --git a/models/gamma/optimism/gamma_optimism_schema.yml b/dex/models/_projects/gamma/optimism/_schema.yml similarity index 100% rename from models/gamma/optimism/gamma_optimism_schema.yml rename to dex/models/_projects/gamma/optimism/_schema.yml diff --git a/models/gamma/optimism/gamma_optimism_uniswap_pools.sql b/dex/models/_projects/gamma/optimism/gamma_optimism_uniswap_pools.sql similarity index 100% rename from models/gamma/optimism/gamma_optimism_uniswap_pools.sql rename to dex/models/_projects/gamma/optimism/gamma_optimism_uniswap_pools.sql diff --git a/models/_project/glacier/glacier_trades.sql b/dex/models/_projects/glacier/glacier_trades.sql similarity index 100% rename from models/_project/glacier/glacier_trades.sql rename to dex/models/_projects/glacier/glacier_trades.sql diff --git a/models/_project/gmx/gmx_trades.sql b/dex/models/_projects/gmx/gmx_trades.sql similarity index 100% rename from models/_project/gmx/gmx_trades.sql rename to dex/models/_projects/gmx/gmx_trades.sql diff --git a/models/_project/hashflow/hashflow_trades.sql b/dex/models/_projects/hashflow/hashflow_trades.sql similarity index 100% rename from models/_project/hashflow/hashflow_trades.sql rename to dex/models/_projects/hashflow/hashflow_trades.sql diff --git a/models/_project/honeyswap/honeyswap_trades.sql b/dex/models/_projects/honeyswap/honeyswap_trades.sql similarity index 100% rename from models/_project/honeyswap/honeyswap_trades.sql rename to dex/models/_projects/honeyswap/honeyswap_trades.sql diff --git a/models/_project/integral/integral_trades.sql b/dex/models/_projects/integral/integral_trades.sql similarity index 100% rename from models/_project/integral/integral_trades.sql rename to dex/models/_projects/integral/integral_trades.sql diff --git a/models/_project/iziswap/iziswap_trades.sql b/dex/models/_projects/iziswap/iziswap_trades.sql similarity index 100% rename from models/_project/iziswap/iziswap_trades.sql rename to dex/models/_projects/iziswap/iziswap_trades.sql diff --git a/models/kyberswap/kyberswap_trades_schema.yml b/dex/models/_projects/kyberswap/_schema.yml similarity index 100% rename from models/kyberswap/kyberswap_trades_schema.yml rename to dex/models/_projects/kyberswap/_schema.yml diff --git a/models/kyberswap/arbitrum/kyberswap_arbitrum_schema.yml b/dex/models/_projects/kyberswap/arbitrum/_schema.yml similarity index 100% rename from models/kyberswap/arbitrum/kyberswap_arbitrum_schema.yml rename to dex/models/_projects/kyberswap/arbitrum/_schema.yml diff --git a/models/kyberswap/arbitrum/kyberswap_aggregator_arbitrum_trades.sql b/dex/models/_projects/kyberswap/arbitrum/kyberswap_aggregator_arbitrum_trades.sql similarity index 100% rename from models/kyberswap/arbitrum/kyberswap_aggregator_arbitrum_trades.sql rename to dex/models/_projects/kyberswap/arbitrum/kyberswap_aggregator_arbitrum_trades.sql diff --git a/models/kyberswap/avalanche_c/kyberswap_avalanche_c_schema.yml b/dex/models/_projects/kyberswap/avalanche_c/_schema.yml similarity index 100% rename from models/kyberswap/avalanche_c/kyberswap_avalanche_c_schema.yml rename to dex/models/_projects/kyberswap/avalanche_c/_schema.yml diff --git a/models/kyberswap/avalanche_c/kyberswap_aggregator_avalanche_c_trades.sql b/dex/models/_projects/kyberswap/avalanche_c/kyberswap_aggregator_avalanche_c_trades.sql similarity index 100% rename from models/kyberswap/avalanche_c/kyberswap_aggregator_avalanche_c_trades.sql rename to dex/models/_projects/kyberswap/avalanche_c/kyberswap_aggregator_avalanche_c_trades.sql diff --git a/models/kyberswap/base/kyberswap_base_schema.yml b/dex/models/_projects/kyberswap/base/_schema.yml similarity index 100% rename from models/kyberswap/base/kyberswap_base_schema.yml rename to dex/models/_projects/kyberswap/base/_schema.yml diff --git a/models/kyberswap/base/kyberswap_aggregator_base_trades.sql b/dex/models/_projects/kyberswap/base/kyberswap_aggregator_base_trades.sql similarity index 100% rename from models/kyberswap/base/kyberswap_aggregator_base_trades.sql rename to dex/models/_projects/kyberswap/base/kyberswap_aggregator_base_trades.sql diff --git a/models/kyberswap/bnb/kyberswap_bnb_schema.yml b/dex/models/_projects/kyberswap/bnb/_schema.yml similarity index 100% rename from models/kyberswap/bnb/kyberswap_bnb_schema.yml rename to dex/models/_projects/kyberswap/bnb/_schema.yml diff --git a/models/kyberswap/bnb/kyberswap_aggregator_bnb_trades.sql b/dex/models/_projects/kyberswap/bnb/kyberswap_aggregator_bnb_trades.sql similarity index 100% rename from models/kyberswap/bnb/kyberswap_aggregator_bnb_trades.sql rename to dex/models/_projects/kyberswap/bnb/kyberswap_aggregator_bnb_trades.sql diff --git a/models/kyberswap/ethereum/kyberswap_ethereum_schema.yml b/dex/models/_projects/kyberswap/ethereum/_schema.yml similarity index 100% rename from models/kyberswap/ethereum/kyberswap_ethereum_schema.yml rename to dex/models/_projects/kyberswap/ethereum/_schema.yml diff --git a/models/kyberswap/ethereum/kyberswap_aggregator_ethereum_trades.sql b/dex/models/_projects/kyberswap/ethereum/kyberswap_aggregator_ethereum_trades.sql similarity index 100% rename from models/kyberswap/ethereum/kyberswap_aggregator_ethereum_trades.sql rename to dex/models/_projects/kyberswap/ethereum/kyberswap_aggregator_ethereum_trades.sql diff --git a/models/kyberswap/kyberswap_aggregator_trades.sql b/dex/models/_projects/kyberswap/kyberswap_aggregator_trades.sql similarity index 100% rename from models/kyberswap/kyberswap_aggregator_trades.sql rename to dex/models/_projects/kyberswap/kyberswap_aggregator_trades.sql diff --git a/models/_project/kyberswap/kyberswap_trades.sql b/dex/models/_projects/kyberswap/kyberswap_trades.sql similarity index 100% rename from models/_project/kyberswap/kyberswap_trades.sql rename to dex/models/_projects/kyberswap/kyberswap_trades.sql diff --git a/models/kyberswap/optimism/kyberswap_optimism_schema.yml b/dex/models/_projects/kyberswap/optimism/_schema.yml similarity index 100% rename from models/kyberswap/optimism/kyberswap_optimism_schema.yml rename to dex/models/_projects/kyberswap/optimism/_schema.yml diff --git a/models/kyberswap/optimism/kyberswap_aggregator_optimism_trades.sql b/dex/models/_projects/kyberswap/optimism/kyberswap_aggregator_optimism_trades.sql similarity index 100% rename from models/kyberswap/optimism/kyberswap_aggregator_optimism_trades.sql rename to dex/models/_projects/kyberswap/optimism/kyberswap_aggregator_optimism_trades.sql diff --git a/models/kyberswap/polygon/kyberswap_polygon_schema.yml b/dex/models/_projects/kyberswap/polygon/_schema.yml similarity index 100% rename from models/kyberswap/polygon/kyberswap_polygon_schema.yml rename to dex/models/_projects/kyberswap/polygon/_schema.yml diff --git a/models/kyberswap/polygon/kyberswap_aggregator_polygon_trades.sql b/dex/models/_projects/kyberswap/polygon/kyberswap_aggregator_polygon_trades.sql similarity index 100% rename from models/kyberswap/polygon/kyberswap_aggregator_polygon_trades.sql rename to dex/models/_projects/kyberswap/polygon/kyberswap_aggregator_polygon_trades.sql diff --git a/models/lifi/lifi_trades_schema.yml b/dex/models/_projects/lifi/_schema.yml similarity index 100% rename from models/lifi/lifi_trades_schema.yml rename to dex/models/_projects/lifi/_schema.yml diff --git a/models/lifi/fantom/lifi_fantom_schema.yml b/dex/models/_projects/lifi/fantom/_schema.yml similarity index 100% rename from models/lifi/fantom/lifi_fantom_schema.yml rename to dex/models/_projects/lifi/fantom/_schema.yml diff --git a/models/lifi/fantom/lifi_fantom_trades.sql b/dex/models/_projects/lifi/fantom/lifi_fantom_trades.sql similarity index 96% rename from models/lifi/fantom/lifi_fantom_trades.sql rename to dex/models/_projects/lifi/fantom/lifi_fantom_trades.sql index bb0bfdcbfcc..83ab544ad74 100644 --- a/models/lifi/fantom/lifi_fantom_trades.sql +++ b/dex/models/_projects/lifi/fantom/lifi_fantom_trades.sql @@ -1,6 +1,6 @@ {{ config( - + schema = 'lifi_fantom', alias = 'trades' ) }} diff --git a/models/lifi/fantom/lifi_v2_fantom_trades.sql b/dex/models/_projects/lifi/fantom/lifi_v2_fantom_trades.sql similarity index 100% rename from models/lifi/fantom/lifi_v2_fantom_trades.sql rename to dex/models/_projects/lifi/fantom/lifi_v2_fantom_trades.sql diff --git a/models/lifi/lifi_trades.sql b/dex/models/_projects/lifi/lifi_trades.sql similarity index 97% rename from models/lifi/lifi_trades.sql rename to dex/models/_projects/lifi/lifi_trades.sql index 4f4cf5e3e15..d91055d86c9 100644 --- a/models/lifi/lifi_trades.sql +++ b/dex/models/_projects/lifi/lifi_trades.sql @@ -1,5 +1,5 @@ {{ config( - + schema = 'lifi', alias = 'trades', post_hook='{{ expose_spells(\'["fantom", "optimism"]\', "project", diff --git a/models/lifi/optimism/lifi_optimism_schema.yml b/dex/models/_projects/lifi/optimism/_schema.yml similarity index 100% rename from models/lifi/optimism/lifi_optimism_schema.yml rename to dex/models/_projects/lifi/optimism/_schema.yml diff --git a/models/lifi/optimism/lifi_optimism_trades.sql b/dex/models/_projects/lifi/optimism/lifi_optimism_trades.sql similarity index 96% rename from models/lifi/optimism/lifi_optimism_trades.sql rename to dex/models/_projects/lifi/optimism/lifi_optimism_trades.sql index 2d678eb3c01..d373f3f66a2 100644 --- a/models/lifi/optimism/lifi_optimism_trades.sql +++ b/dex/models/_projects/lifi/optimism/lifi_optimism_trades.sql @@ -1,6 +1,6 @@ {{ config( - + schema = 'lifi_optimism', alias = 'trades' ) }} diff --git a/models/lifi/optimism/lifi_v2_optimism_trades.sql b/dex/models/_projects/lifi/optimism/lifi_v2_optimism_trades.sql similarity index 100% rename from models/lifi/optimism/lifi_v2_optimism_trades.sql rename to dex/models/_projects/lifi/optimism/lifi_v2_optimism_trades.sql diff --git a/models/_project/mauve/mauve_trades.sql b/dex/models/_projects/mauve/mauve_trades.sql similarity index 100% rename from models/_project/mauve/mauve_trades.sql rename to dex/models/_projects/mauve/mauve_trades.sql diff --git a/models/_project/maverick/maverick_trades.sql b/dex/models/_projects/maverick/maverick_trades.sql similarity index 100% rename from models/_project/maverick/maverick_trades.sql rename to dex/models/_projects/maverick/maverick_trades.sql diff --git a/models/_project/mdex/mdex_trades.sql b/dex/models/_projects/mdex/mdex_trades.sql similarity index 100% rename from models/_project/mdex/mdex_trades.sql rename to dex/models/_projects/mdex/mdex_trades.sql diff --git a/models/mento/celo/mento_celo_schema.yml b/dex/models/_projects/mento/celo/_schema.yml similarity index 100% rename from models/mento/celo/mento_celo_schema.yml rename to dex/models/_projects/mento/celo/_schema.yml diff --git a/models/mento/celo/mento_celo_pools.sql b/dex/models/_projects/mento/celo/mento_celo_pools.sql similarity index 100% rename from models/mento/celo/mento_celo_pools.sql rename to dex/models/_projects/mento/celo/mento_celo_pools.sql diff --git a/models/mento/celo/mento_v1_celo_pools.sql b/dex/models/_projects/mento/celo/mento_v1_celo_pools.sql similarity index 100% rename from models/mento/celo/mento_v1_celo_pools.sql rename to dex/models/_projects/mento/celo/mento_v1_celo_pools.sql diff --git a/models/mento/celo/mento_v2_celo_pools.sql b/dex/models/_projects/mento/celo/mento_v2_celo_pools.sql similarity index 100% rename from models/mento/celo/mento_v2_celo_pools.sql rename to dex/models/_projects/mento/celo/mento_v2_celo_pools.sql diff --git a/models/_project/mstable/mstable_trades.sql b/dex/models/_projects/mstable/mstable_trades.sql similarity index 100% rename from models/_project/mstable/mstable_trades.sql rename to dex/models/_projects/mstable/mstable_trades.sql diff --git a/models/_project/mummy_finance/mummy_finance_trades.sql b/dex/models/_projects/mummy_finance/mummy_finance_trades.sql similarity index 100% rename from models/_project/mummy_finance/mummy_finance_trades.sql rename to dex/models/_projects/mummy_finance/mummy_finance_trades.sql diff --git a/models/_project/nomiswap/nomiswap_trades.sql b/dex/models/_projects/nomiswap/nomiswap_trades.sql similarity index 100% rename from models/_project/nomiswap/nomiswap_trades.sql rename to dex/models/_projects/nomiswap/nomiswap_trades.sql diff --git a/models/odos/odos_trades_schema.yml b/dex/models/_projects/odos/_schema.yml similarity index 100% rename from models/odos/odos_trades_schema.yml rename to dex/models/_projects/odos/_schema.yml diff --git a/models/odos/avalanche_c/odos_avalanche_c_schema.yml b/dex/models/_projects/odos/avalanche_c/_schema.yml similarity index 100% rename from models/odos/avalanche_c/odos_avalanche_c_schema.yml rename to dex/models/_projects/odos/avalanche_c/_schema.yml diff --git a/models/odos/avalanche_c/odos_avalanche_c_trades.sql b/dex/models/_projects/odos/avalanche_c/odos_avalanche_c_trades.sql similarity index 99% rename from models/odos/avalanche_c/odos_avalanche_c_trades.sql rename to dex/models/_projects/odos/avalanche_c/odos_avalanche_c_trades.sql index cdb4fbc5623..756f8f1a57f 100644 --- a/models/odos/avalanche_c/odos_avalanche_c_trades.sql +++ b/dex/models/_projects/odos/avalanche_c/odos_avalanche_c_trades.sql @@ -1,5 +1,6 @@ {{ config( tags=['prod_exclude'], + schema = 'odos_avalanche_c', alias = 'trades', partition_by = ['block_date'], materialized = 'incremental', diff --git a/models/odos/base/odos_base_schema.yml b/dex/models/_projects/odos/base/_schema.yml similarity index 100% rename from models/odos/base/odos_base_schema.yml rename to dex/models/_projects/odos/base/_schema.yml diff --git a/models/odos/base/odos_base_trades.sql b/dex/models/_projects/odos/base/odos_base_trades.sql similarity index 100% rename from models/odos/base/odos_base_trades.sql rename to dex/models/_projects/odos/base/odos_base_trades.sql diff --git a/models/odos/base/odos_v2_base_trades.sql b/dex/models/_projects/odos/base/odos_v2_base_trades.sql similarity index 100% rename from models/odos/base/odos_v2_base_trades.sql rename to dex/models/_projects/odos/base/odos_v2_base_trades.sql diff --git a/models/odos/ethereum/odos_ethereum_schema.yml b/dex/models/_projects/odos/ethereum/_schema.yml similarity index 100% rename from models/odos/ethereum/odos_ethereum_schema.yml rename to dex/models/_projects/odos/ethereum/_schema.yml diff --git a/models/odos/ethereum/odos_ethereum_trades.sql b/dex/models/_projects/odos/ethereum/odos_ethereum_trades.sql similarity index 100% rename from models/odos/ethereum/odos_ethereum_trades.sql rename to dex/models/_projects/odos/ethereum/odos_ethereum_trades.sql diff --git a/models/odos/ethereum/odos_v2_ethereum_trades.sql b/dex/models/_projects/odos/ethereum/odos_v2_ethereum_trades.sql similarity index 100% rename from models/odos/ethereum/odos_v2_ethereum_trades.sql rename to dex/models/_projects/odos/ethereum/odos_v2_ethereum_trades.sql diff --git a/models/odos/odos_trades.sql b/dex/models/_projects/odos/odos_trades.sql similarity index 97% rename from models/odos/odos_trades.sql rename to dex/models/_projects/odos/odos_trades.sql index 86bfa269889..43e2ac5e5c8 100644 --- a/models/odos/odos_trades.sql +++ b/dex/models/_projects/odos/odos_trades.sql @@ -1,4 +1,5 @@ {{ config( + schema = 'odos', alias = 'trades', post_hook='{{ expose_spells(\'["optimism", "ethereum"]\', "project", diff --git a/models/odos/optimism/odos_optimism_schema.yml b/dex/models/_projects/odos/optimism/_schema.yml similarity index 100% rename from models/odos/optimism/odos_optimism_schema.yml rename to dex/models/_projects/odos/optimism/_schema.yml diff --git a/models/odos/optimism/odos_optimism_trades.sql b/dex/models/_projects/odos/optimism/odos_optimism_trades.sql similarity index 100% rename from models/odos/optimism/odos_optimism_trades.sql rename to dex/models/_projects/odos/optimism/odos_optimism_trades.sql diff --git a/models/odos/optimism/odos_v1_optimism_trades.sql b/dex/models/_projects/odos/optimism/odos_v1_optimism_trades.sql similarity index 100% rename from models/odos/optimism/odos_v1_optimism_trades.sql rename to dex/models/_projects/odos/optimism/odos_v1_optimism_trades.sql diff --git a/models/odos/optimism/odos_v2_optimism_trades.sql b/dex/models/_projects/odos/optimism/odos_v2_optimism_trades.sql similarity index 100% rename from models/odos/optimism/odos_v2_optimism_trades.sql rename to dex/models/_projects/odos/optimism/odos_v2_optimism_trades.sql diff --git a/models/oneinch/_meta/oneinch_blockchains.sql b/dex/models/_projects/oneinch/_meta/oneinch_blockchains.sql similarity index 100% rename from models/oneinch/_meta/oneinch_blockchains.sql rename to dex/models/_projects/oneinch/_meta/oneinch_blockchains.sql diff --git a/models/oneinch/_meta/oneinch_fusion_accounts.sql b/dex/models/_projects/oneinch/_meta/oneinch_fusion_accounts.sql similarity index 100% rename from models/oneinch/_meta/oneinch_fusion_accounts.sql rename to dex/models/_projects/oneinch/_meta/oneinch_fusion_accounts.sql diff --git a/models/oneinch/_meta/oneinch_fusion_executors.sql b/dex/models/_projects/oneinch/_meta/oneinch_fusion_executors.sql similarity index 100% rename from models/oneinch/_meta/oneinch_fusion_executors.sql rename to dex/models/_projects/oneinch/_meta/oneinch_fusion_executors.sql diff --git a/models/oneinch/_meta/oneinch_fusion_farms.sql b/dex/models/_projects/oneinch/_meta/oneinch_fusion_farms.sql similarity index 100% rename from models/oneinch/_meta/oneinch_fusion_farms.sql rename to dex/models/_projects/oneinch/_meta/oneinch_fusion_farms.sql diff --git a/models/oneinch/_meta/oneinch_fusion_resolvers.sql b/dex/models/_projects/oneinch/_meta/oneinch_fusion_resolvers.sql similarity index 100% rename from models/oneinch/_meta/oneinch_fusion_resolvers.sql rename to dex/models/_projects/oneinch/_meta/oneinch_fusion_resolvers.sql diff --git a/models/oneinch/_meta/oneinch_mapped_contracts.sql b/dex/models/_projects/oneinch/_meta/oneinch_mapped_contracts.sql similarity index 100% rename from models/oneinch/_meta/oneinch_mapped_contracts.sql rename to dex/models/_projects/oneinch/_meta/oneinch_mapped_contracts.sql diff --git a/models/oneinch/_meta/oneinch_mapped_methods.sql b/dex/models/_projects/oneinch/_meta/oneinch_mapped_methods.sql similarity index 100% rename from models/oneinch/_meta/oneinch_mapped_methods.sql rename to dex/models/_projects/oneinch/_meta/oneinch_mapped_methods.sql diff --git a/models/oneinch/oneinch_schema.yml b/dex/models/_projects/oneinch/_schema.yml similarity index 100% rename from models/oneinch/oneinch_schema.yml rename to dex/models/_projects/oneinch/_schema.yml diff --git a/models/oneinch/arbitrum/_meta/oneinch_arbitrum_mapped_contracts.sql b/dex/models/_projects/oneinch/arbitrum/_meta/oneinch_arbitrum_mapped_contracts.sql similarity index 100% rename from models/oneinch/arbitrum/_meta/oneinch_arbitrum_mapped_contracts.sql rename to dex/models/_projects/oneinch/arbitrum/_meta/oneinch_arbitrum_mapped_contracts.sql diff --git a/models/oneinch/arbitrum/_meta/oneinch_arbitrum_mapped_methods.sql b/dex/models/_projects/oneinch/arbitrum/_meta/oneinch_arbitrum_mapped_methods.sql similarity index 100% rename from models/oneinch/arbitrum/_meta/oneinch_arbitrum_mapped_methods.sql rename to dex/models/_projects/oneinch/arbitrum/_meta/oneinch_arbitrum_mapped_methods.sql diff --git a/models/oneinch/arbitrum/oneinch_arbitrum_ar.sql b/dex/models/_projects/oneinch/arbitrum/oneinch_arbitrum_ar.sql similarity index 100% rename from models/oneinch/arbitrum/oneinch_arbitrum_ar.sql rename to dex/models/_projects/oneinch/arbitrum/oneinch_arbitrum_ar.sql diff --git a/models/oneinch/arbitrum/oneinch_arbitrum_call_transfers.sql b/dex/models/_projects/oneinch/arbitrum/oneinch_arbitrum_call_transfers.sql similarity index 100% rename from models/oneinch/arbitrum/oneinch_arbitrum_call_transfers.sql rename to dex/models/_projects/oneinch/arbitrum/oneinch_arbitrum_call_transfers.sql diff --git a/models/oneinch/arbitrum/oneinch_arbitrum_lop.sql b/dex/models/_projects/oneinch/arbitrum/oneinch_arbitrum_lop.sql similarity index 100% rename from models/oneinch/arbitrum/oneinch_arbitrum_lop.sql rename to dex/models/_projects/oneinch/arbitrum/oneinch_arbitrum_lop.sql diff --git a/models/oneinch/arbitrum/oneinch_arbitrum_project_calls.sql b/dex/models/_projects/oneinch/arbitrum/oneinch_arbitrum_project_calls.sql similarity index 100% rename from models/oneinch/arbitrum/oneinch_arbitrum_project_calls.sql rename to dex/models/_projects/oneinch/arbitrum/oneinch_arbitrum_project_calls.sql diff --git a/models/oneinch/arbitrum/oneinch_arbitrum_project_orders.sql b/dex/models/_projects/oneinch/arbitrum/oneinch_arbitrum_project_orders.sql similarity index 100% rename from models/oneinch/arbitrum/oneinch_arbitrum_project_orders.sql rename to dex/models/_projects/oneinch/arbitrum/oneinch_arbitrum_project_orders.sql diff --git a/models/oneinch/arbitrum/oneinch_arbitrum_project_swaps.sql b/dex/models/_projects/oneinch/arbitrum/oneinch_arbitrum_project_swaps.sql similarity index 100% rename from models/oneinch/arbitrum/oneinch_arbitrum_project_swaps.sql rename to dex/models/_projects/oneinch/arbitrum/oneinch_arbitrum_project_swaps.sql diff --git a/models/oneinch/arbitrum/oneinch_arbitrum_schema.yml b/dex/models/_projects/oneinch/arbitrum/oneinch_arbitrum_schema.yml similarity index 100% rename from models/oneinch/arbitrum/oneinch_arbitrum_schema.yml rename to dex/models/_projects/oneinch/arbitrum/oneinch_arbitrum_schema.yml diff --git a/models/oneinch/avalanche_c/_meta/oneinch_avalanche_c_mapped_contracts.sql b/dex/models/_projects/oneinch/avalanche_c/_meta/oneinch_avalanche_c_mapped_contracts.sql similarity index 100% rename from models/oneinch/avalanche_c/_meta/oneinch_avalanche_c_mapped_contracts.sql rename to dex/models/_projects/oneinch/avalanche_c/_meta/oneinch_avalanche_c_mapped_contracts.sql diff --git a/models/oneinch/avalanche_c/_meta/oneinch_avalanche_c_mapped_methods.sql b/dex/models/_projects/oneinch/avalanche_c/_meta/oneinch_avalanche_c_mapped_methods.sql similarity index 100% rename from models/oneinch/avalanche_c/_meta/oneinch_avalanche_c_mapped_methods.sql rename to dex/models/_projects/oneinch/avalanche_c/_meta/oneinch_avalanche_c_mapped_methods.sql diff --git a/models/oneinch/avalanche_c/oneinch_avalanche_c_ar.sql b/dex/models/_projects/oneinch/avalanche_c/oneinch_avalanche_c_ar.sql similarity index 100% rename from models/oneinch/avalanche_c/oneinch_avalanche_c_ar.sql rename to dex/models/_projects/oneinch/avalanche_c/oneinch_avalanche_c_ar.sql diff --git a/models/oneinch/avalanche_c/oneinch_avalanche_c_call_transfers.sql b/dex/models/_projects/oneinch/avalanche_c/oneinch_avalanche_c_call_transfers.sql similarity index 100% rename from models/oneinch/avalanche_c/oneinch_avalanche_c_call_transfers.sql rename to dex/models/_projects/oneinch/avalanche_c/oneinch_avalanche_c_call_transfers.sql diff --git a/models/oneinch/avalanche_c/oneinch_avalanche_c_lop.sql b/dex/models/_projects/oneinch/avalanche_c/oneinch_avalanche_c_lop.sql similarity index 100% rename from models/oneinch/avalanche_c/oneinch_avalanche_c_lop.sql rename to dex/models/_projects/oneinch/avalanche_c/oneinch_avalanche_c_lop.sql diff --git a/models/oneinch/avalanche_c/oneinch_avalanche_c_project_calls.sql b/dex/models/_projects/oneinch/avalanche_c/oneinch_avalanche_c_project_calls.sql similarity index 100% rename from models/oneinch/avalanche_c/oneinch_avalanche_c_project_calls.sql rename to dex/models/_projects/oneinch/avalanche_c/oneinch_avalanche_c_project_calls.sql diff --git a/models/oneinch/avalanche_c/oneinch_avalanche_c_project_orders.sql b/dex/models/_projects/oneinch/avalanche_c/oneinch_avalanche_c_project_orders.sql similarity index 100% rename from models/oneinch/avalanche_c/oneinch_avalanche_c_project_orders.sql rename to dex/models/_projects/oneinch/avalanche_c/oneinch_avalanche_c_project_orders.sql diff --git a/models/oneinch/avalanche_c/oneinch_avalanche_c_project_swaps.sql b/dex/models/_projects/oneinch/avalanche_c/oneinch_avalanche_c_project_swaps.sql similarity index 100% rename from models/oneinch/avalanche_c/oneinch_avalanche_c_project_swaps.sql rename to dex/models/_projects/oneinch/avalanche_c/oneinch_avalanche_c_project_swaps.sql diff --git a/models/oneinch/avalanche_c/oneinch_avalanche_c_schema.yml b/dex/models/_projects/oneinch/avalanche_c/oneinch_avalanche_c_schema.yml similarity index 100% rename from models/oneinch/avalanche_c/oneinch_avalanche_c_schema.yml rename to dex/models/_projects/oneinch/avalanche_c/oneinch_avalanche_c_schema.yml diff --git a/models/oneinch/base/_meta/oneinch_base_mapped_contracts.sql b/dex/models/_projects/oneinch/base/_meta/oneinch_base_mapped_contracts.sql similarity index 100% rename from models/oneinch/base/_meta/oneinch_base_mapped_contracts.sql rename to dex/models/_projects/oneinch/base/_meta/oneinch_base_mapped_contracts.sql diff --git a/models/oneinch/base/_meta/oneinch_base_mapped_methods.sql b/dex/models/_projects/oneinch/base/_meta/oneinch_base_mapped_methods.sql similarity index 100% rename from models/oneinch/base/_meta/oneinch_base_mapped_methods.sql rename to dex/models/_projects/oneinch/base/_meta/oneinch_base_mapped_methods.sql diff --git a/models/oneinch/base/oneinch_base_ar.sql b/dex/models/_projects/oneinch/base/oneinch_base_ar.sql similarity index 100% rename from models/oneinch/base/oneinch_base_ar.sql rename to dex/models/_projects/oneinch/base/oneinch_base_ar.sql diff --git a/models/oneinch/base/oneinch_base_call_transfers.sql b/dex/models/_projects/oneinch/base/oneinch_base_call_transfers.sql similarity index 100% rename from models/oneinch/base/oneinch_base_call_transfers.sql rename to dex/models/_projects/oneinch/base/oneinch_base_call_transfers.sql diff --git a/models/oneinch/base/oneinch_base_lop.sql b/dex/models/_projects/oneinch/base/oneinch_base_lop.sql similarity index 100% rename from models/oneinch/base/oneinch_base_lop.sql rename to dex/models/_projects/oneinch/base/oneinch_base_lop.sql diff --git a/models/oneinch/base/oneinch_base_project_calls.sql b/dex/models/_projects/oneinch/base/oneinch_base_project_calls.sql similarity index 100% rename from models/oneinch/base/oneinch_base_project_calls.sql rename to dex/models/_projects/oneinch/base/oneinch_base_project_calls.sql diff --git a/models/oneinch/base/oneinch_base_project_orders.sql b/dex/models/_projects/oneinch/base/oneinch_base_project_orders.sql similarity index 100% rename from models/oneinch/base/oneinch_base_project_orders.sql rename to dex/models/_projects/oneinch/base/oneinch_base_project_orders.sql diff --git a/models/oneinch/base/oneinch_base_project_swaps.sql b/dex/models/_projects/oneinch/base/oneinch_base_project_swaps.sql similarity index 100% rename from models/oneinch/base/oneinch_base_project_swaps.sql rename to dex/models/_projects/oneinch/base/oneinch_base_project_swaps.sql diff --git a/models/oneinch/base/oneinch_base_schema.yml b/dex/models/_projects/oneinch/base/oneinch_base_schema.yml similarity index 100% rename from models/oneinch/base/oneinch_base_schema.yml rename to dex/models/_projects/oneinch/base/oneinch_base_schema.yml diff --git a/models/oneinch/bnb/_meta/oneinch_bnb_mapped_contracts.sql b/dex/models/_projects/oneinch/bnb/_meta/oneinch_bnb_mapped_contracts.sql similarity index 100% rename from models/oneinch/bnb/_meta/oneinch_bnb_mapped_contracts.sql rename to dex/models/_projects/oneinch/bnb/_meta/oneinch_bnb_mapped_contracts.sql diff --git a/models/oneinch/bnb/_meta/oneinch_bnb_mapped_methods.sql b/dex/models/_projects/oneinch/bnb/_meta/oneinch_bnb_mapped_methods.sql similarity index 100% rename from models/oneinch/bnb/_meta/oneinch_bnb_mapped_methods.sql rename to dex/models/_projects/oneinch/bnb/_meta/oneinch_bnb_mapped_methods.sql diff --git a/models/oneinch/bnb/oneinch_bnb_ar.sql b/dex/models/_projects/oneinch/bnb/oneinch_bnb_ar.sql similarity index 100% rename from models/oneinch/bnb/oneinch_bnb_ar.sql rename to dex/models/_projects/oneinch/bnb/oneinch_bnb_ar.sql diff --git a/models/oneinch/bnb/oneinch_bnb_call_transfers.sql b/dex/models/_projects/oneinch/bnb/oneinch_bnb_call_transfers.sql similarity index 100% rename from models/oneinch/bnb/oneinch_bnb_call_transfers.sql rename to dex/models/_projects/oneinch/bnb/oneinch_bnb_call_transfers.sql diff --git a/models/oneinch/bnb/oneinch_bnb_lop.sql b/dex/models/_projects/oneinch/bnb/oneinch_bnb_lop.sql similarity index 100% rename from models/oneinch/bnb/oneinch_bnb_lop.sql rename to dex/models/_projects/oneinch/bnb/oneinch_bnb_lop.sql diff --git a/models/oneinch/bnb/oneinch_bnb_project_calls.sql b/dex/models/_projects/oneinch/bnb/oneinch_bnb_project_calls.sql similarity index 100% rename from models/oneinch/bnb/oneinch_bnb_project_calls.sql rename to dex/models/_projects/oneinch/bnb/oneinch_bnb_project_calls.sql diff --git a/models/oneinch/bnb/oneinch_bnb_project_orders.sql b/dex/models/_projects/oneinch/bnb/oneinch_bnb_project_orders.sql similarity index 100% rename from models/oneinch/bnb/oneinch_bnb_project_orders.sql rename to dex/models/_projects/oneinch/bnb/oneinch_bnb_project_orders.sql diff --git a/models/oneinch/bnb/oneinch_bnb_project_swaps.sql b/dex/models/_projects/oneinch/bnb/oneinch_bnb_project_swaps.sql similarity index 100% rename from models/oneinch/bnb/oneinch_bnb_project_swaps.sql rename to dex/models/_projects/oneinch/bnb/oneinch_bnb_project_swaps.sql diff --git a/models/oneinch/bnb/oneinch_bnb_schema.yml b/dex/models/_projects/oneinch/bnb/oneinch_bnb_schema.yml similarity index 100% rename from models/oneinch/bnb/oneinch_bnb_schema.yml rename to dex/models/_projects/oneinch/bnb/oneinch_bnb_schema.yml diff --git a/models/oneinch/ethereum/_meta/oneinch_ethereum_mapped_contracts.sql b/dex/models/_projects/oneinch/ethereum/_meta/oneinch_ethereum_mapped_contracts.sql similarity index 100% rename from models/oneinch/ethereum/_meta/oneinch_ethereum_mapped_contracts.sql rename to dex/models/_projects/oneinch/ethereum/_meta/oneinch_ethereum_mapped_contracts.sql diff --git a/models/oneinch/ethereum/_meta/oneinch_ethereum_mapped_methods.sql b/dex/models/_projects/oneinch/ethereum/_meta/oneinch_ethereum_mapped_methods.sql similarity index 100% rename from models/oneinch/ethereum/_meta/oneinch_ethereum_mapped_methods.sql rename to dex/models/_projects/oneinch/ethereum/_meta/oneinch_ethereum_mapped_methods.sql diff --git a/models/oneinch/ethereum/oneinch_ethereum_ar.sql b/dex/models/_projects/oneinch/ethereum/oneinch_ethereum_ar.sql similarity index 100% rename from models/oneinch/ethereum/oneinch_ethereum_ar.sql rename to dex/models/_projects/oneinch/ethereum/oneinch_ethereum_ar.sql diff --git a/models/oneinch/ethereum/oneinch_ethereum_call_transfers.sql b/dex/models/_projects/oneinch/ethereum/oneinch_ethereum_call_transfers.sql similarity index 100% rename from models/oneinch/ethereum/oneinch_ethereum_call_transfers.sql rename to dex/models/_projects/oneinch/ethereum/oneinch_ethereum_call_transfers.sql diff --git a/models/oneinch/ethereum/oneinch_ethereum_lop.sql b/dex/models/_projects/oneinch/ethereum/oneinch_ethereum_lop.sql similarity index 100% rename from models/oneinch/ethereum/oneinch_ethereum_lop.sql rename to dex/models/_projects/oneinch/ethereum/oneinch_ethereum_lop.sql diff --git a/models/oneinch/ethereum/oneinch_ethereum_project_calls.sql b/dex/models/_projects/oneinch/ethereum/oneinch_ethereum_project_calls.sql similarity index 100% rename from models/oneinch/ethereum/oneinch_ethereum_project_calls.sql rename to dex/models/_projects/oneinch/ethereum/oneinch_ethereum_project_calls.sql diff --git a/models/oneinch/ethereum/oneinch_ethereum_project_orders.sql b/dex/models/_projects/oneinch/ethereum/oneinch_ethereum_project_orders.sql similarity index 100% rename from models/oneinch/ethereum/oneinch_ethereum_project_orders.sql rename to dex/models/_projects/oneinch/ethereum/oneinch_ethereum_project_orders.sql diff --git a/models/oneinch/ethereum/oneinch_ethereum_project_swaps.sql b/dex/models/_projects/oneinch/ethereum/oneinch_ethereum_project_swaps.sql similarity index 100% rename from models/oneinch/ethereum/oneinch_ethereum_project_swaps.sql rename to dex/models/_projects/oneinch/ethereum/oneinch_ethereum_project_swaps.sql diff --git a/models/oneinch/ethereum/oneinch_ethereum_schema.yml b/dex/models/_projects/oneinch/ethereum/oneinch_ethereum_schema.yml similarity index 73% rename from models/oneinch/ethereum/oneinch_ethereum_schema.yml rename to dex/models/_projects/oneinch/ethereum/oneinch_ethereum_schema.yml index a61e821d1b8..25c31b0bfae 100644 --- a/models/oneinch/ethereum/oneinch_ethereum_schema.yml +++ b/dex/models/_projects/oneinch/ethereum/oneinch_ethereum_schema.yml @@ -158,49 +158,4 @@ models: - name: transfer_to - name: transfers_between_players - name: minute - - name: block_month - - - name: oneinch_ethereum_airdrop_claims - meta: - blockchain: ethereum - sector: airdrop - project: oneinch - contributors: hildobby - config: - tags: ['table', 'airdrop', 'ethereum', 'claim', 'oneinch'] - description: "List of claim transactions for the $1INCH airdrop" - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - tx_hash - - recipient - - evt_index - columns: - - name: blockchain - tests: - - not_null - - name: block_time - - name: block_number - description: "Block number of transaction" - - name: project - description: "Project name" - - name: airdrop_number - description: "Airdrop identifier number" - - name: recipient - description: "Airdrop recipient" - - name: contract_address - description: "Contract addressed used" - - name: tx_hash - description: "Transaction hash" - - name: amount_raw - description: "Raw amount of tokens" - - name: amount_original - description: "Original amount of tokens" - - name: amount_usd - description: "USD value of tokens" - - name: token_address - description: "Token address" - - name: token_symbol - description: "Token symbol" - - name: evt_index - description: "Event index" + - name: block_month \ No newline at end of file diff --git a/models/oneinch/fantom/_meta/oneinch_fantom_mapped_contracts.sql b/dex/models/_projects/oneinch/fantom/_meta/oneinch_fantom_mapped_contracts.sql similarity index 100% rename from models/oneinch/fantom/_meta/oneinch_fantom_mapped_contracts.sql rename to dex/models/_projects/oneinch/fantom/_meta/oneinch_fantom_mapped_contracts.sql diff --git a/models/oneinch/fantom/_meta/oneinch_fantom_mapped_methods.sql b/dex/models/_projects/oneinch/fantom/_meta/oneinch_fantom_mapped_methods.sql similarity index 100% rename from models/oneinch/fantom/_meta/oneinch_fantom_mapped_methods.sql rename to dex/models/_projects/oneinch/fantom/_meta/oneinch_fantom_mapped_methods.sql diff --git a/models/oneinch/fantom/oneinch_fantom_ar.sql b/dex/models/_projects/oneinch/fantom/oneinch_fantom_ar.sql similarity index 100% rename from models/oneinch/fantom/oneinch_fantom_ar.sql rename to dex/models/_projects/oneinch/fantom/oneinch_fantom_ar.sql diff --git a/models/oneinch/fantom/oneinch_fantom_call_transfers.sql b/dex/models/_projects/oneinch/fantom/oneinch_fantom_call_transfers.sql similarity index 100% rename from models/oneinch/fantom/oneinch_fantom_call_transfers.sql rename to dex/models/_projects/oneinch/fantom/oneinch_fantom_call_transfers.sql diff --git a/models/oneinch/fantom/oneinch_fantom_lop.sql b/dex/models/_projects/oneinch/fantom/oneinch_fantom_lop.sql similarity index 100% rename from models/oneinch/fantom/oneinch_fantom_lop.sql rename to dex/models/_projects/oneinch/fantom/oneinch_fantom_lop.sql diff --git a/models/oneinch/fantom/oneinch_fantom_project_calls.sql b/dex/models/_projects/oneinch/fantom/oneinch_fantom_project_calls.sql similarity index 100% rename from models/oneinch/fantom/oneinch_fantom_project_calls.sql rename to dex/models/_projects/oneinch/fantom/oneinch_fantom_project_calls.sql diff --git a/models/oneinch/fantom/oneinch_fantom_project_orders.sql b/dex/models/_projects/oneinch/fantom/oneinch_fantom_project_orders.sql similarity index 100% rename from models/oneinch/fantom/oneinch_fantom_project_orders.sql rename to dex/models/_projects/oneinch/fantom/oneinch_fantom_project_orders.sql diff --git a/models/oneinch/fantom/oneinch_fantom_project_swaps.sql b/dex/models/_projects/oneinch/fantom/oneinch_fantom_project_swaps.sql similarity index 100% rename from models/oneinch/fantom/oneinch_fantom_project_swaps.sql rename to dex/models/_projects/oneinch/fantom/oneinch_fantom_project_swaps.sql diff --git a/models/oneinch/fantom/oneinch_fantom_schema.yml b/dex/models/_projects/oneinch/fantom/oneinch_fantom_schema.yml similarity index 100% rename from models/oneinch/fantom/oneinch_fantom_schema.yml rename to dex/models/_projects/oneinch/fantom/oneinch_fantom_schema.yml diff --git a/models/oneinch/gnosis/_meta/oneinch_gnosis_mapped_contracts.sql b/dex/models/_projects/oneinch/gnosis/_meta/oneinch_gnosis_mapped_contracts.sql similarity index 100% rename from models/oneinch/gnosis/_meta/oneinch_gnosis_mapped_contracts.sql rename to dex/models/_projects/oneinch/gnosis/_meta/oneinch_gnosis_mapped_contracts.sql diff --git a/models/oneinch/gnosis/_meta/oneinch_gnosis_mapped_methods.sql b/dex/models/_projects/oneinch/gnosis/_meta/oneinch_gnosis_mapped_methods.sql similarity index 100% rename from models/oneinch/gnosis/_meta/oneinch_gnosis_mapped_methods.sql rename to dex/models/_projects/oneinch/gnosis/_meta/oneinch_gnosis_mapped_methods.sql diff --git a/models/oneinch/gnosis/oneinch_gnosis_ar.sql b/dex/models/_projects/oneinch/gnosis/oneinch_gnosis_ar.sql similarity index 100% rename from models/oneinch/gnosis/oneinch_gnosis_ar.sql rename to dex/models/_projects/oneinch/gnosis/oneinch_gnosis_ar.sql diff --git a/models/oneinch/gnosis/oneinch_gnosis_call_transfers.sql b/dex/models/_projects/oneinch/gnosis/oneinch_gnosis_call_transfers.sql similarity index 100% rename from models/oneinch/gnosis/oneinch_gnosis_call_transfers.sql rename to dex/models/_projects/oneinch/gnosis/oneinch_gnosis_call_transfers.sql diff --git a/models/oneinch/gnosis/oneinch_gnosis_lop.sql b/dex/models/_projects/oneinch/gnosis/oneinch_gnosis_lop.sql similarity index 100% rename from models/oneinch/gnosis/oneinch_gnosis_lop.sql rename to dex/models/_projects/oneinch/gnosis/oneinch_gnosis_lop.sql diff --git a/models/oneinch/gnosis/oneinch_gnosis_project_calls.sql b/dex/models/_projects/oneinch/gnosis/oneinch_gnosis_project_calls.sql similarity index 100% rename from models/oneinch/gnosis/oneinch_gnosis_project_calls.sql rename to dex/models/_projects/oneinch/gnosis/oneinch_gnosis_project_calls.sql diff --git a/models/oneinch/gnosis/oneinch_gnosis_project_orders.sql b/dex/models/_projects/oneinch/gnosis/oneinch_gnosis_project_orders.sql similarity index 100% rename from models/oneinch/gnosis/oneinch_gnosis_project_orders.sql rename to dex/models/_projects/oneinch/gnosis/oneinch_gnosis_project_orders.sql diff --git a/models/oneinch/gnosis/oneinch_gnosis_project_swaps.sql b/dex/models/_projects/oneinch/gnosis/oneinch_gnosis_project_swaps.sql similarity index 100% rename from models/oneinch/gnosis/oneinch_gnosis_project_swaps.sql rename to dex/models/_projects/oneinch/gnosis/oneinch_gnosis_project_swaps.sql diff --git a/models/oneinch/gnosis/oneinch_gnosis_schema.yml b/dex/models/_projects/oneinch/gnosis/oneinch_gnosis_schema.yml similarity index 100% rename from models/oneinch/gnosis/oneinch_gnosis_schema.yml rename to dex/models/_projects/oneinch/gnosis/oneinch_gnosis_schema.yml diff --git a/models/oneinch/oneinch_ar.sql b/dex/models/_projects/oneinch/oneinch_ar.sql similarity index 100% rename from models/oneinch/oneinch_ar.sql rename to dex/models/_projects/oneinch/oneinch_ar.sql diff --git a/models/oneinch/oneinch_ar_trades.sql b/dex/models/_projects/oneinch/oneinch_ar_trades.sql similarity index 100% rename from models/oneinch/oneinch_ar_trades.sql rename to dex/models/_projects/oneinch/oneinch_ar_trades.sql diff --git a/models/oneinch/oneinch_call_transfers.sql b/dex/models/_projects/oneinch/oneinch_call_transfers.sql similarity index 100% rename from models/oneinch/oneinch_call_transfers.sql rename to dex/models/_projects/oneinch/oneinch_call_transfers.sql diff --git a/models/oneinch/oneinch_calls.sql b/dex/models/_projects/oneinch/oneinch_calls.sql similarity index 100% rename from models/oneinch/oneinch_calls.sql rename to dex/models/_projects/oneinch/oneinch_calls.sql diff --git a/models/oneinch/oneinch_lop.sql b/dex/models/_projects/oneinch/oneinch_lop.sql similarity index 100% rename from models/oneinch/oneinch_lop.sql rename to dex/models/_projects/oneinch/oneinch_lop.sql diff --git a/models/oneinch/oneinch_lop_own_trades.sql b/dex/models/_projects/oneinch/oneinch_lop_own_trades.sql similarity index 100% rename from models/oneinch/oneinch_lop_own_trades.sql rename to dex/models/_projects/oneinch/oneinch_lop_own_trades.sql diff --git a/models/oneinch/oneinch_parsed_transfers_from_calls.sql b/dex/models/_projects/oneinch/oneinch_parsed_transfers_from_calls.sql similarity index 100% rename from models/oneinch/oneinch_parsed_transfers_from_calls.sql rename to dex/models/_projects/oneinch/oneinch_parsed_transfers_from_calls.sql diff --git a/models/oneinch/oneinch_project_orders.sql b/dex/models/_projects/oneinch/oneinch_project_orders.sql similarity index 100% rename from models/oneinch/oneinch_project_orders.sql rename to dex/models/_projects/oneinch/oneinch_project_orders.sql diff --git a/models/oneinch/oneinch_project_swaps.sql b/dex/models/_projects/oneinch/oneinch_project_swaps.sql similarity index 100% rename from models/oneinch/oneinch_project_swaps.sql rename to dex/models/_projects/oneinch/oneinch_project_swaps.sql diff --git a/models/oneinch/oneinch_swaps.sql b/dex/models/_projects/oneinch/oneinch_swaps.sql similarity index 100% rename from models/oneinch/oneinch_swaps.sql rename to dex/models/_projects/oneinch/oneinch_swaps.sql diff --git a/models/oneinch/optimism/_meta/oneinch_optimism_mapped_contracts.sql b/dex/models/_projects/oneinch/optimism/_meta/oneinch_optimism_mapped_contracts.sql similarity index 100% rename from models/oneinch/optimism/_meta/oneinch_optimism_mapped_contracts.sql rename to dex/models/_projects/oneinch/optimism/_meta/oneinch_optimism_mapped_contracts.sql diff --git a/models/oneinch/optimism/_meta/oneinch_optimism_mapped_methods.sql b/dex/models/_projects/oneinch/optimism/_meta/oneinch_optimism_mapped_methods.sql similarity index 100% rename from models/oneinch/optimism/_meta/oneinch_optimism_mapped_methods.sql rename to dex/models/_projects/oneinch/optimism/_meta/oneinch_optimism_mapped_methods.sql diff --git a/models/oneinch/optimism/oneinch_optimism_ar.sql b/dex/models/_projects/oneinch/optimism/oneinch_optimism_ar.sql similarity index 100% rename from models/oneinch/optimism/oneinch_optimism_ar.sql rename to dex/models/_projects/oneinch/optimism/oneinch_optimism_ar.sql diff --git a/models/oneinch/optimism/oneinch_optimism_call_transfers.sql b/dex/models/_projects/oneinch/optimism/oneinch_optimism_call_transfers.sql similarity index 100% rename from models/oneinch/optimism/oneinch_optimism_call_transfers.sql rename to dex/models/_projects/oneinch/optimism/oneinch_optimism_call_transfers.sql diff --git a/models/oneinch/optimism/oneinch_optimism_lop.sql b/dex/models/_projects/oneinch/optimism/oneinch_optimism_lop.sql similarity index 100% rename from models/oneinch/optimism/oneinch_optimism_lop.sql rename to dex/models/_projects/oneinch/optimism/oneinch_optimism_lop.sql diff --git a/models/oneinch/optimism/oneinch_optimism_project_calls.sql b/dex/models/_projects/oneinch/optimism/oneinch_optimism_project_calls.sql similarity index 100% rename from models/oneinch/optimism/oneinch_optimism_project_calls.sql rename to dex/models/_projects/oneinch/optimism/oneinch_optimism_project_calls.sql diff --git a/models/oneinch/optimism/oneinch_optimism_project_orders.sql b/dex/models/_projects/oneinch/optimism/oneinch_optimism_project_orders.sql similarity index 100% rename from models/oneinch/optimism/oneinch_optimism_project_orders.sql rename to dex/models/_projects/oneinch/optimism/oneinch_optimism_project_orders.sql diff --git a/models/oneinch/optimism/oneinch_optimism_project_swaps.sql b/dex/models/_projects/oneinch/optimism/oneinch_optimism_project_swaps.sql similarity index 100% rename from models/oneinch/optimism/oneinch_optimism_project_swaps.sql rename to dex/models/_projects/oneinch/optimism/oneinch_optimism_project_swaps.sql diff --git a/models/oneinch/optimism/oneinch_optimism_schema.yml b/dex/models/_projects/oneinch/optimism/oneinch_optimism_schema.yml similarity index 100% rename from models/oneinch/optimism/oneinch_optimism_schema.yml rename to dex/models/_projects/oneinch/optimism/oneinch_optimism_schema.yml diff --git a/models/oneinch/polygon/_meta/oneinch_polygon_mapped_contracts.sql b/dex/models/_projects/oneinch/polygon/_meta/oneinch_polygon_mapped_contracts.sql similarity index 100% rename from models/oneinch/polygon/_meta/oneinch_polygon_mapped_contracts.sql rename to dex/models/_projects/oneinch/polygon/_meta/oneinch_polygon_mapped_contracts.sql diff --git a/models/oneinch/polygon/_meta/oneinch_polygon_mapped_methods.sql b/dex/models/_projects/oneinch/polygon/_meta/oneinch_polygon_mapped_methods.sql similarity index 100% rename from models/oneinch/polygon/_meta/oneinch_polygon_mapped_methods.sql rename to dex/models/_projects/oneinch/polygon/_meta/oneinch_polygon_mapped_methods.sql diff --git a/models/oneinch/polygon/oneinch_polygon_ar.sql b/dex/models/_projects/oneinch/polygon/oneinch_polygon_ar.sql similarity index 100% rename from models/oneinch/polygon/oneinch_polygon_ar.sql rename to dex/models/_projects/oneinch/polygon/oneinch_polygon_ar.sql diff --git a/models/oneinch/polygon/oneinch_polygon_call_transfers.sql b/dex/models/_projects/oneinch/polygon/oneinch_polygon_call_transfers.sql similarity index 100% rename from models/oneinch/polygon/oneinch_polygon_call_transfers.sql rename to dex/models/_projects/oneinch/polygon/oneinch_polygon_call_transfers.sql diff --git a/models/oneinch/polygon/oneinch_polygon_lop.sql b/dex/models/_projects/oneinch/polygon/oneinch_polygon_lop.sql similarity index 100% rename from models/oneinch/polygon/oneinch_polygon_lop.sql rename to dex/models/_projects/oneinch/polygon/oneinch_polygon_lop.sql diff --git a/models/oneinch/polygon/oneinch_polygon_project_calls.sql b/dex/models/_projects/oneinch/polygon/oneinch_polygon_project_calls.sql similarity index 100% rename from models/oneinch/polygon/oneinch_polygon_project_calls.sql rename to dex/models/_projects/oneinch/polygon/oneinch_polygon_project_calls.sql diff --git a/models/oneinch/polygon/oneinch_polygon_project_orders.sql b/dex/models/_projects/oneinch/polygon/oneinch_polygon_project_orders.sql similarity index 100% rename from models/oneinch/polygon/oneinch_polygon_project_orders.sql rename to dex/models/_projects/oneinch/polygon/oneinch_polygon_project_orders.sql diff --git a/models/oneinch/polygon/oneinch_polygon_project_swaps.sql b/dex/models/_projects/oneinch/polygon/oneinch_polygon_project_swaps.sql similarity index 100% rename from models/oneinch/polygon/oneinch_polygon_project_swaps.sql rename to dex/models/_projects/oneinch/polygon/oneinch_polygon_project_swaps.sql diff --git a/models/oneinch/polygon/oneinch_polygon_schema.yml b/dex/models/_projects/oneinch/polygon/oneinch_polygon_schema.yml similarity index 100% rename from models/oneinch/polygon/oneinch_polygon_schema.yml rename to dex/models/_projects/oneinch/polygon/oneinch_polygon_schema.yml diff --git a/models/oneinch/zksync/_meta/oneinch_zksync_mapped_contracts.sql b/dex/models/_projects/oneinch/zksync/_meta/oneinch_zksync_mapped_contracts.sql similarity index 100% rename from models/oneinch/zksync/_meta/oneinch_zksync_mapped_contracts.sql rename to dex/models/_projects/oneinch/zksync/_meta/oneinch_zksync_mapped_contracts.sql diff --git a/models/oneinch/zksync/_meta/oneinch_zksync_mapped_methods.sql b/dex/models/_projects/oneinch/zksync/_meta/oneinch_zksync_mapped_methods.sql similarity index 100% rename from models/oneinch/zksync/_meta/oneinch_zksync_mapped_methods.sql rename to dex/models/_projects/oneinch/zksync/_meta/oneinch_zksync_mapped_methods.sql diff --git a/models/oneinch/zksync/oneinch_zksync_ar.sql b/dex/models/_projects/oneinch/zksync/oneinch_zksync_ar.sql similarity index 100% rename from models/oneinch/zksync/oneinch_zksync_ar.sql rename to dex/models/_projects/oneinch/zksync/oneinch_zksync_ar.sql diff --git a/models/oneinch/zksync/oneinch_zksync_call_transfers.sql b/dex/models/_projects/oneinch/zksync/oneinch_zksync_call_transfers.sql similarity index 100% rename from models/oneinch/zksync/oneinch_zksync_call_transfers.sql rename to dex/models/_projects/oneinch/zksync/oneinch_zksync_call_transfers.sql diff --git a/models/oneinch/zksync/oneinch_zksync_lop.sql b/dex/models/_projects/oneinch/zksync/oneinch_zksync_lop.sql similarity index 100% rename from models/oneinch/zksync/oneinch_zksync_lop.sql rename to dex/models/_projects/oneinch/zksync/oneinch_zksync_lop.sql diff --git a/models/oneinch/zksync/oneinch_zksync_project_calls.sql b/dex/models/_projects/oneinch/zksync/oneinch_zksync_project_calls.sql similarity index 100% rename from models/oneinch/zksync/oneinch_zksync_project_calls.sql rename to dex/models/_projects/oneinch/zksync/oneinch_zksync_project_calls.sql diff --git a/models/oneinch/zksync/oneinch_zksync_project_orders.sql b/dex/models/_projects/oneinch/zksync/oneinch_zksync_project_orders.sql similarity index 100% rename from models/oneinch/zksync/oneinch_zksync_project_orders.sql rename to dex/models/_projects/oneinch/zksync/oneinch_zksync_project_orders.sql diff --git a/models/oneinch/zksync/oneinch_zksync_project_swaps.sql b/dex/models/_projects/oneinch/zksync/oneinch_zksync_project_swaps.sql similarity index 100% rename from models/oneinch/zksync/oneinch_zksync_project_swaps.sql rename to dex/models/_projects/oneinch/zksync/oneinch_zksync_project_swaps.sql diff --git a/models/oneinch/zksync/oneinch_zksync_schema.yml b/dex/models/_projects/oneinch/zksync/oneinch_zksync_schema.yml similarity index 100% rename from models/oneinch/zksync/oneinch_zksync_schema.yml rename to dex/models/_projects/oneinch/zksync/oneinch_zksync_schema.yml diff --git a/models/_project/onepunchswap/onepunchswap_trades.sql b/dex/models/_projects/onepunchswap/onepunchswap_trades.sql similarity index 100% rename from models/_project/onepunchswap/onepunchswap_trades.sql rename to dex/models/_projects/onepunchswap/onepunchswap_trades.sql diff --git a/models/_project/openocean/openocean_trades.sql b/dex/models/_projects/openocean/openocean_trades.sql similarity index 100% rename from models/_project/openocean/openocean_trades.sql rename to dex/models/_projects/openocean/openocean_trades.sql diff --git a/models/_project/openxswap/openxswap_trades.sql b/dex/models/_projects/openxswap/openxswap_trades.sql similarity index 100% rename from models/_project/openxswap/openxswap_trades.sql rename to dex/models/_projects/openxswap/openxswap_trades.sql diff --git a/models/_project/opx_finance/opx_finance_trades.sql b/dex/models/_projects/opx_finance/opx_finance_trades.sql similarity index 100% rename from models/_project/opx_finance/opx_finance_trades.sql rename to dex/models/_projects/opx_finance/opx_finance_trades.sql diff --git a/models/_project/pancakeswap/pancakeswap_trades.sql b/dex/models/_projects/pancakeswap/pancakeswap_trades.sql similarity index 100% rename from models/_project/pancakeswap/pancakeswap_trades.sql rename to dex/models/_projects/pancakeswap/pancakeswap_trades.sql diff --git a/models/paraswap/paraswap_trades_schema.yml b/dex/models/_projects/paraswap/_schema.yml similarity index 100% rename from models/paraswap/paraswap_trades_schema.yml rename to dex/models/_projects/paraswap/_schema.yml diff --git a/models/paraswap/arbitrum/paraswap_arbitrum_schema.yml b/dex/models/_projects/paraswap/arbitrum/_schema.yml similarity index 100% rename from models/paraswap/arbitrum/paraswap_arbitrum_schema.yml rename to dex/models/_projects/paraswap/arbitrum/_schema.yml diff --git a/models/paraswap/arbitrum/paraswap_arbitrum_trades.sql b/dex/models/_projects/paraswap/arbitrum/paraswap_arbitrum_trades.sql similarity index 100% rename from models/paraswap/arbitrum/paraswap_arbitrum_trades.sql rename to dex/models/_projects/paraswap/arbitrum/paraswap_arbitrum_trades.sql diff --git a/models/paraswap/arbitrum/paraswap_v5_arbitrum_trades.sql b/dex/models/_projects/paraswap/arbitrum/paraswap_v5_arbitrum_trades.sql similarity index 100% rename from models/paraswap/arbitrum/paraswap_v5_arbitrum_trades.sql rename to dex/models/_projects/paraswap/arbitrum/paraswap_v5_arbitrum_trades.sql diff --git a/models/paraswap/arbitrum/paraswap_v6_arbitrum_trades.sql b/dex/models/_projects/paraswap/arbitrum/paraswap_v6_arbitrum_trades.sql similarity index 100% rename from models/paraswap/arbitrum/paraswap_v6_arbitrum_trades.sql rename to dex/models/_projects/paraswap/arbitrum/paraswap_v6_arbitrum_trades.sql diff --git a/models/paraswap/arbitrum/paraswap_v6_arbitrum_trades_decoded.sql b/dex/models/_projects/paraswap/arbitrum/paraswap_v6_arbitrum_trades_decoded.sql similarity index 100% rename from models/paraswap/arbitrum/paraswap_v6_arbitrum_trades_decoded.sql rename to dex/models/_projects/paraswap/arbitrum/paraswap_v6_arbitrum_trades_decoded.sql diff --git a/models/paraswap/avalanche_c/paraswap_avalanche_c_schema.yml b/dex/models/_projects/paraswap/avalanche_c/_schema.yml similarity index 100% rename from models/paraswap/avalanche_c/paraswap_avalanche_c_schema.yml rename to dex/models/_projects/paraswap/avalanche_c/_schema.yml diff --git a/models/paraswap/avalanche_c/paraswap_avalanche_c_trades.sql b/dex/models/_projects/paraswap/avalanche_c/paraswap_avalanche_c_trades.sql similarity index 100% rename from models/paraswap/avalanche_c/paraswap_avalanche_c_trades.sql rename to dex/models/_projects/paraswap/avalanche_c/paraswap_avalanche_c_trades.sql diff --git a/models/paraswap/avalanche_c/paraswap_v5_avalanche_c_trades.sql b/dex/models/_projects/paraswap/avalanche_c/paraswap_v5_avalanche_c_trades.sql similarity index 100% rename from models/paraswap/avalanche_c/paraswap_v5_avalanche_c_trades.sql rename to dex/models/_projects/paraswap/avalanche_c/paraswap_v5_avalanche_c_trades.sql diff --git a/models/paraswap/avalanche_c/paraswap_v6_avalanche_c_trades.sql b/dex/models/_projects/paraswap/avalanche_c/paraswap_v6_avalanche_c_trades.sql similarity index 100% rename from models/paraswap/avalanche_c/paraswap_v6_avalanche_c_trades.sql rename to dex/models/_projects/paraswap/avalanche_c/paraswap_v6_avalanche_c_trades.sql diff --git a/models/paraswap/avalanche_c/paraswap_v6_avalanche_c_trades_decoded.sql b/dex/models/_projects/paraswap/avalanche_c/paraswap_v6_avalanche_c_trades_decoded.sql similarity index 100% rename from models/paraswap/avalanche_c/paraswap_v6_avalanche_c_trades_decoded.sql rename to dex/models/_projects/paraswap/avalanche_c/paraswap_v6_avalanche_c_trades_decoded.sql diff --git a/models/paraswap/base/paraswap_base_schema.yml b/dex/models/_projects/paraswap/base/_schema.yml similarity index 100% rename from models/paraswap/base/paraswap_base_schema.yml rename to dex/models/_projects/paraswap/base/_schema.yml diff --git a/models/paraswap/base/paraswap_base_trades.sql b/dex/models/_projects/paraswap/base/paraswap_base_trades.sql similarity index 100% rename from models/paraswap/base/paraswap_base_trades.sql rename to dex/models/_projects/paraswap/base/paraswap_base_trades.sql diff --git a/models/paraswap/base/paraswap_v5_base_trades.sql b/dex/models/_projects/paraswap/base/paraswap_v5_base_trades.sql similarity index 100% rename from models/paraswap/base/paraswap_v5_base_trades.sql rename to dex/models/_projects/paraswap/base/paraswap_v5_base_trades.sql diff --git a/models/paraswap/base/paraswap_v6_base_trades.sql b/dex/models/_projects/paraswap/base/paraswap_v6_base_trades.sql similarity index 100% rename from models/paraswap/base/paraswap_v6_base_trades.sql rename to dex/models/_projects/paraswap/base/paraswap_v6_base_trades.sql diff --git a/models/paraswap/base/paraswap_v6_base_trades_decoded.sql b/dex/models/_projects/paraswap/base/paraswap_v6_base_trades_decoded.sql similarity index 100% rename from models/paraswap/base/paraswap_v6_base_trades_decoded.sql rename to dex/models/_projects/paraswap/base/paraswap_v6_base_trades_decoded.sql diff --git a/models/paraswap/bnb/paraswap_bnb_schema.yml b/dex/models/_projects/paraswap/bnb/_schema.yml similarity index 100% rename from models/paraswap/bnb/paraswap_bnb_schema.yml rename to dex/models/_projects/paraswap/bnb/_schema.yml diff --git a/models/paraswap/bnb/paraswap_bnb_trades.sql b/dex/models/_projects/paraswap/bnb/paraswap_bnb_trades.sql similarity index 100% rename from models/paraswap/bnb/paraswap_bnb_trades.sql rename to dex/models/_projects/paraswap/bnb/paraswap_bnb_trades.sql diff --git a/models/paraswap/bnb/paraswap_v4_bnb_trades.sql b/dex/models/_projects/paraswap/bnb/paraswap_v4_bnb_trades.sql similarity index 100% rename from models/paraswap/bnb/paraswap_v4_bnb_trades.sql rename to dex/models/_projects/paraswap/bnb/paraswap_v4_bnb_trades.sql diff --git a/models/paraswap/bnb/paraswap_v5_bnb_trades.sql b/dex/models/_projects/paraswap/bnb/paraswap_v5_bnb_trades.sql similarity index 100% rename from models/paraswap/bnb/paraswap_v5_bnb_trades.sql rename to dex/models/_projects/paraswap/bnb/paraswap_v5_bnb_trades.sql diff --git a/models/paraswap/bnb/paraswap_v6_bnb_trades.sql b/dex/models/_projects/paraswap/bnb/paraswap_v6_bnb_trades.sql similarity index 100% rename from models/paraswap/bnb/paraswap_v6_bnb_trades.sql rename to dex/models/_projects/paraswap/bnb/paraswap_v6_bnb_trades.sql diff --git a/models/paraswap/bnb/paraswap_v6_bnb_trades_decoded.sql b/dex/models/_projects/paraswap/bnb/paraswap_v6_bnb_trades_decoded.sql similarity index 100% rename from models/paraswap/bnb/paraswap_v6_bnb_trades_decoded.sql rename to dex/models/_projects/paraswap/bnb/paraswap_v6_bnb_trades_decoded.sql diff --git a/models/paraswap/ethereum/paraswap_ethereum_schema.yml b/dex/models/_projects/paraswap/ethereum/_schema.yml similarity index 85% rename from models/paraswap/ethereum/paraswap_ethereum_schema.yml rename to dex/models/_projects/paraswap/ethereum/_schema.yml index d75d4c78691..312e8c69a76 100644 --- a/models/paraswap/ethereum/paraswap_ethereum_schema.yml +++ b/dex/models/_projects/paraswap/ethereum/_schema.yml @@ -1,68 +1,6 @@ version: 2 -models: - - name: paraswap_ethereum_airdrop_claims - meta: - blockchain: ethereum - sector: airdrop - project: paraswap - contributors: hildobby - config: - tags: ['table', 'airdrop', 'ethereum', 'claim', 'paraswap'] - description: "List of claim transactions for the $PSP airdrop" - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - tx_hash - - recipient - - evt_index - columns: - - &blockchain - name: blockchain - description: "Blockchain" - - &block_time - name: block_time - description: "Block time of transaction" - - &block_month - name: block_month - description: "Block month of transaction" - - &block_number - name: block_number - description: "Block number of transaction" - - &project - name: project - description: "Project name" - - &airdrop_number - name: airdrop_number - description: "Airdrop identifier number" - - &recipient - name: recipient - description: "Airdrop recipient" - - &contract_address - name: contract_address - description: "Contract addressed used" - - &tx_hash - name: tx_hash - description: "Transaction hash" - - &amount_raw - name: amount_raw - description: "Raw amount of tokens" - - &amount_original - name: amount_original - description: "Original amount of tokens" - - &amount_usd - name: amount_usd - description: "USD value of tokens" - - &token_address - name: token_address - description: "Token address" - - &token_symbol - name: token_symbol - description: "Token symbol" - - &evt_index - name: evt_index - description: "Event index" - +models: - name: paraswap_v4_ethereum_trades meta: blockchain: ethereum @@ -88,15 +26,21 @@ models: project: paraswap version: 4 columns: - - *blockchain - - *project + - &blockchain + name: blockchain + description: "Blockchain" + - &project + name: project + description: "Project name" - &version name: version description: "Version of the contract built and deployed by the DEX project" - &block_date name: block_date description: "UTC event block date of each DEX trade" - - *block_time + - &block_time + name: block_time + description: "Block time of transaction" - &token_bought_symbol name: token_bought_symbol description: "Token symbol for token bought in the transaction" @@ -118,7 +62,9 @@ models: - &token_sold_amount_raw name: token_sold_amount_raw description: "Raw value of the token sold at time of execution in the original currency" - - *amount_usd + - &amount_usd + name: amount_usd + description: "USD value of tokens" - &token_bought_address name: token_bought_address description: "Contract address of the token bought" @@ -134,7 +80,9 @@ models: - &project_contract_address name: project_contract_address description: "Project contract address which executed the trade on the blockchain" - - *tx_hash + - &tx_hash + name: tx_hash + description: "Transaction hash" - &tx_from name: tx_from description: "Address which initiated the transaction" @@ -144,7 +92,9 @@ models: - &trace_address name: trace_address description: "" - - *evt_index + - &evt_index + name: evt_index + description: "Event index" - name: paraswap_v5_ethereum_trades meta: diff --git a/models/paraswap/ethereum/paraswap_ethereum_trades.sql b/dex/models/_projects/paraswap/ethereum/paraswap_ethereum_trades.sql similarity index 100% rename from models/paraswap/ethereum/paraswap_ethereum_trades.sql rename to dex/models/_projects/paraswap/ethereum/paraswap_ethereum_trades.sql diff --git a/models/paraswap/ethereum/paraswap_v4_ethereum_trades.sql b/dex/models/_projects/paraswap/ethereum/paraswap_v4_ethereum_trades.sql similarity index 100% rename from models/paraswap/ethereum/paraswap_v4_ethereum_trades.sql rename to dex/models/_projects/paraswap/ethereum/paraswap_v4_ethereum_trades.sql diff --git a/models/paraswap/ethereum/paraswap_v5_ethereum_trades.sql b/dex/models/_projects/paraswap/ethereum/paraswap_v5_ethereum_trades.sql similarity index 100% rename from models/paraswap/ethereum/paraswap_v5_ethereum_trades.sql rename to dex/models/_projects/paraswap/ethereum/paraswap_v5_ethereum_trades.sql diff --git a/models/paraswap/ethereum/paraswap_v6_ethereum_trades.sql b/dex/models/_projects/paraswap/ethereum/paraswap_v6_ethereum_trades.sql similarity index 100% rename from models/paraswap/ethereum/paraswap_v6_ethereum_trades.sql rename to dex/models/_projects/paraswap/ethereum/paraswap_v6_ethereum_trades.sql diff --git a/models/paraswap/ethereum/paraswap_v6_ethereum_trades_decoded.sql b/dex/models/_projects/paraswap/ethereum/paraswap_v6_ethereum_trades_decoded.sql similarity index 100% rename from models/paraswap/ethereum/paraswap_v6_ethereum_trades_decoded.sql rename to dex/models/_projects/paraswap/ethereum/paraswap_v6_ethereum_trades_decoded.sql diff --git a/models/paraswap/fantom/paraswap_fantom_schema.yml b/dex/models/_projects/paraswap/fantom/_schema.yml similarity index 100% rename from models/paraswap/fantom/paraswap_fantom_schema.yml rename to dex/models/_projects/paraswap/fantom/_schema.yml diff --git a/models/paraswap/fantom/paraswap_fantom_trades.sql b/dex/models/_projects/paraswap/fantom/paraswap_fantom_trades.sql similarity index 100% rename from models/paraswap/fantom/paraswap_fantom_trades.sql rename to dex/models/_projects/paraswap/fantom/paraswap_fantom_trades.sql diff --git a/models/paraswap/fantom/paraswap_v5_fantom_trades.sql b/dex/models/_projects/paraswap/fantom/paraswap_v5_fantom_trades.sql similarity index 100% rename from models/paraswap/fantom/paraswap_v5_fantom_trades.sql rename to dex/models/_projects/paraswap/fantom/paraswap_v5_fantom_trades.sql diff --git a/models/paraswap/fantom/paraswap_v6_fantom_trades.sql b/dex/models/_projects/paraswap/fantom/paraswap_v6_fantom_trades.sql similarity index 100% rename from models/paraswap/fantom/paraswap_v6_fantom_trades.sql rename to dex/models/_projects/paraswap/fantom/paraswap_v6_fantom_trades.sql diff --git a/models/paraswap/fantom/paraswap_v6_fantom_trades_decoded.sql b/dex/models/_projects/paraswap/fantom/paraswap_v6_fantom_trades_decoded.sql similarity index 100% rename from models/paraswap/fantom/paraswap_v6_fantom_trades_decoded.sql rename to dex/models/_projects/paraswap/fantom/paraswap_v6_fantom_trades_decoded.sql diff --git a/models/paraswap/optimism/paraswap_optimism_schema.yml b/dex/models/_projects/paraswap/optimism/_schema.yml similarity index 100% rename from models/paraswap/optimism/paraswap_optimism_schema.yml rename to dex/models/_projects/paraswap/optimism/_schema.yml diff --git a/models/paraswap/optimism/paraswap_optimism_trades.sql b/dex/models/_projects/paraswap/optimism/paraswap_optimism_trades.sql similarity index 100% rename from models/paraswap/optimism/paraswap_optimism_trades.sql rename to dex/models/_projects/paraswap/optimism/paraswap_optimism_trades.sql diff --git a/models/paraswap/optimism/paraswap_v5_optimism_trades.sql b/dex/models/_projects/paraswap/optimism/paraswap_v5_optimism_trades.sql similarity index 100% rename from models/paraswap/optimism/paraswap_v5_optimism_trades.sql rename to dex/models/_projects/paraswap/optimism/paraswap_v5_optimism_trades.sql diff --git a/models/paraswap/optimism/paraswap_v6_optimism_trades.sql b/dex/models/_projects/paraswap/optimism/paraswap_v6_optimism_trades.sql similarity index 100% rename from models/paraswap/optimism/paraswap_v6_optimism_trades.sql rename to dex/models/_projects/paraswap/optimism/paraswap_v6_optimism_trades.sql diff --git a/models/paraswap/optimism/paraswap_v6_optimism_trades_decoded.sql b/dex/models/_projects/paraswap/optimism/paraswap_v6_optimism_trades_decoded.sql similarity index 100% rename from models/paraswap/optimism/paraswap_v6_optimism_trades_decoded.sql rename to dex/models/_projects/paraswap/optimism/paraswap_v6_optimism_trades_decoded.sql diff --git a/models/paraswap/paraswap_trades.sql b/dex/models/_projects/paraswap/paraswap_trades.sql similarity index 100% rename from models/paraswap/paraswap_trades.sql rename to dex/models/_projects/paraswap/paraswap_trades.sql diff --git a/models/paraswap/polygon/paraswap_polygon_schema.yml b/dex/models/_projects/paraswap/polygon/_schema.yml similarity index 100% rename from models/paraswap/polygon/paraswap_polygon_schema.yml rename to dex/models/_projects/paraswap/polygon/_schema.yml diff --git a/models/paraswap/polygon/paraswap_polygon_trades.sql b/dex/models/_projects/paraswap/polygon/paraswap_polygon_trades.sql similarity index 100% rename from models/paraswap/polygon/paraswap_polygon_trades.sql rename to dex/models/_projects/paraswap/polygon/paraswap_polygon_trades.sql diff --git a/models/paraswap/polygon/paraswap_v4_polygon_trades.sql b/dex/models/_projects/paraswap/polygon/paraswap_v4_polygon_trades.sql similarity index 100% rename from models/paraswap/polygon/paraswap_v4_polygon_trades.sql rename to dex/models/_projects/paraswap/polygon/paraswap_v4_polygon_trades.sql diff --git a/models/paraswap/polygon/paraswap_v5_polygon_trades.sql b/dex/models/_projects/paraswap/polygon/paraswap_v5_polygon_trades.sql similarity index 100% rename from models/paraswap/polygon/paraswap_v5_polygon_trades.sql rename to dex/models/_projects/paraswap/polygon/paraswap_v5_polygon_trades.sql diff --git a/models/paraswap/polygon/paraswap_v6_polygon_trades.sql b/dex/models/_projects/paraswap/polygon/paraswap_v6_polygon_trades.sql similarity index 100% rename from models/paraswap/polygon/paraswap_v6_polygon_trades.sql rename to dex/models/_projects/paraswap/polygon/paraswap_v6_polygon_trades.sql diff --git a/models/paraswap/polygon/paraswap_v6_polygon_trades_decoded.sql b/dex/models/_projects/paraswap/polygon/paraswap_v6_polygon_trades_decoded.sql similarity index 100% rename from models/paraswap/polygon/paraswap_v6_polygon_trades_decoded.sql rename to dex/models/_projects/paraswap/polygon/paraswap_v6_polygon_trades_decoded.sql diff --git a/models/_project/platypus_finance/platypus_finance_trades.sql b/dex/models/_projects/platypus_finance/platypus_finance_trades.sql similarity index 100% rename from models/_project/platypus_finance/platypus_finance_trades.sql rename to dex/models/_projects/platypus_finance/platypus_finance_trades.sql diff --git a/models/_project/quickswap/quickswap_trades.sql b/dex/models/_projects/quickswap/quickswap_trades.sql similarity index 100% rename from models/_project/quickswap/quickswap_trades.sql rename to dex/models/_projects/quickswap/quickswap_trades.sql diff --git a/models/_project/rubicon/rubicon_trades.sql b/dex/models/_projects/rubicon/rubicon_trades.sql similarity index 100% rename from models/_project/rubicon/rubicon_trades.sql rename to dex/models/_projects/rubicon/rubicon_trades.sql diff --git a/models/_project/shibaswap/shibaswap_trades.sql b/dex/models/_projects/shibaswap/shibaswap_trades.sql similarity index 100% rename from models/_project/shibaswap/shibaswap_trades.sql rename to dex/models/_projects/shibaswap/shibaswap_trades.sql diff --git a/models/spartacus_exchange/fantom/spartacus_exchange_fantom_schema.yml b/dex/models/_projects/spartacus_exchange/fantom/_schema.yml similarity index 100% rename from models/spartacus_exchange/fantom/spartacus_exchange_fantom_schema.yml rename to dex/models/_projects/spartacus_exchange/fantom/_schema.yml diff --git a/models/spartacus_exchange/fantom/spartacus_exchange_fantom_pools.sql b/dex/models/_projects/spartacus_exchange/fantom/spartacus_exchange_fantom_pools.sql similarity index 95% rename from models/spartacus_exchange/fantom/spartacus_exchange_fantom_pools.sql rename to dex/models/_projects/spartacus_exchange/fantom/spartacus_exchange_fantom_pools.sql index 26b6080c5ad..caf5ee80c48 100644 --- a/models/spartacus_exchange/fantom/spartacus_exchange_fantom_pools.sql +++ b/dex/models/_projects/spartacus_exchange/fantom/spartacus_exchange_fantom_pools.sql @@ -1,5 +1,5 @@ {{ config( - + schema = 'spartacus_exchange_fantom', alias = 'pools', materialized = 'incremental', file_format = 'delta', diff --git a/models/_project/spartacus_exchange/spartacus_exchange_trades.sql b/dex/models/_projects/spartacus_exchange/spartacus_exchange_trades.sql similarity index 100% rename from models/_project/spartacus_exchange/spartacus_exchange_trades.sql rename to dex/models/_projects/spartacus_exchange/spartacus_exchange_trades.sql diff --git a/models/spiritswap/fantom/spiritswap_fantom_schema.yml b/dex/models/_projects/spiritswap/fantom/_schema.yml similarity index 100% rename from models/spiritswap/fantom/spiritswap_fantom_schema.yml rename to dex/models/_projects/spiritswap/fantom/_schema.yml diff --git a/models/spiritswap/fantom/spiritswap_fantom_pools.sql b/dex/models/_projects/spiritswap/fantom/spiritswap_fantom_pools.sql similarity index 96% rename from models/spiritswap/fantom/spiritswap_fantom_pools.sql rename to dex/models/_projects/spiritswap/fantom/spiritswap_fantom_pools.sql index 7b78ed1f457..457c678e485 100644 --- a/models/spiritswap/fantom/spiritswap_fantom_pools.sql +++ b/dex/models/_projects/spiritswap/fantom/spiritswap_fantom_pools.sql @@ -1,5 +1,5 @@ {{ config( - + schema = 'spritswap_fantom', alias = 'pools', materialized = 'incremental', file_format = 'delta', diff --git a/models/_project/spiritswap/spiritswap_trades.sql b/dex/models/_projects/spiritswap/spiritswap_trades.sql similarity index 100% rename from models/_project/spiritswap/spiritswap_trades.sql rename to dex/models/_projects/spiritswap/spiritswap_trades.sql diff --git a/models/spookyswap/fantom/spookyswap_fantom_schema.yml b/dex/models/_projects/spookyswap/fantom/_schema.yml similarity index 100% rename from models/spookyswap/fantom/spookyswap_fantom_schema.yml rename to dex/models/_projects/spookyswap/fantom/_schema.yml diff --git a/models/spookyswap/fantom/spookyswap_fantom_pools.sql b/dex/models/_projects/spookyswap/fantom/spookyswap_fantom_pools.sql similarity index 100% rename from models/spookyswap/fantom/spookyswap_fantom_pools.sql rename to dex/models/_projects/spookyswap/fantom/spookyswap_fantom_pools.sql diff --git a/models/_project/spookyswap/spookyswap_trades.sql b/dex/models/_projects/spookyswap/spookyswap_trades.sql similarity index 100% rename from models/_project/spookyswap/spookyswap_trades.sql rename to dex/models/_projects/spookyswap/spookyswap_trades.sql diff --git a/models/_project/sushiswap/sushiswap_trades.sql b/dex/models/_projects/sushiswap/sushiswap_trades.sql similarity index 100% rename from models/_project/sushiswap/sushiswap_trades.sql rename to dex/models/_projects/sushiswap/sushiswap_trades.sql diff --git a/models/_project/swapr/swapr_trades.sql b/dex/models/_projects/swapr/swapr_trades.sql similarity index 100% rename from models/_project/swapr/swapr_trades.sql rename to dex/models/_projects/swapr/swapr_trades.sql diff --git a/models/_project/synthetix/synthetix_trades.sql b/dex/models/_projects/synthetix/synthetix_trades.sql similarity index 100% rename from models/_project/synthetix/synthetix_trades.sql rename to dex/models/_projects/synthetix/synthetix_trades.sql diff --git a/models/_project/thena/thena_trades.sql b/dex/models/_projects/thena/thena_trades.sql similarity index 100% rename from models/_project/thena/thena_trades.sql rename to dex/models/_projects/thena/thena_trades.sql diff --git a/models/tokenlon/tokenlon_trades_schema.yml b/dex/models/_projects/tokenlon/_schema.yml similarity index 100% rename from models/tokenlon/tokenlon_trades_schema.yml rename to dex/models/_projects/tokenlon/_schema.yml diff --git a/models/tokenlon/ethereum/tokenlon_ethereum_schema.yml b/dex/models/_projects/tokenlon/ethereum/_schema.yml similarity index 100% rename from models/tokenlon/ethereum/tokenlon_ethereum_schema.yml rename to dex/models/_projects/tokenlon/ethereum/_schema.yml diff --git a/models/tokenlon/ethereum/tokenlon_ethereum_trades.sql b/dex/models/_projects/tokenlon/ethereum/tokenlon_ethereum_trades.sql similarity index 97% rename from models/tokenlon/ethereum/tokenlon_ethereum_trades.sql rename to dex/models/_projects/tokenlon/ethereum/tokenlon_ethereum_trades.sql index 8f0d950c9f6..b4e84971d72 100644 --- a/models/tokenlon/ethereum/tokenlon_ethereum_trades.sql +++ b/dex/models/_projects/tokenlon/ethereum/tokenlon_ethereum_trades.sql @@ -1,6 +1,6 @@ {{ config( + schema = 'tokenlon_ethereum', alias = 'trades', - post_hook='{{ expose_spells(\'["ethereum"]\', "project", "tokenlon", diff --git a/models/tokenlon/ethereum/tokenlon_v5_ethereum_amm_v1_trades.sql b/dex/models/_projects/tokenlon/ethereum/tokenlon_v5_ethereum_amm_v1_trades.sql similarity index 100% rename from models/tokenlon/ethereum/tokenlon_v5_ethereum_amm_v1_trades.sql rename to dex/models/_projects/tokenlon/ethereum/tokenlon_v5_ethereum_amm_v1_trades.sql diff --git a/models/tokenlon/ethereum/tokenlon_v5_ethereum_amm_v2_trades.sql b/dex/models/_projects/tokenlon/ethereum/tokenlon_v5_ethereum_amm_v2_trades.sql similarity index 100% rename from models/tokenlon/ethereum/tokenlon_v5_ethereum_amm_v2_trades.sql rename to dex/models/_projects/tokenlon/ethereum/tokenlon_v5_ethereum_amm_v2_trades.sql diff --git a/models/tokenlon/ethereum/tokenlon_v5_ethereum_pmm_v5_trades.sql b/dex/models/_projects/tokenlon/ethereum/tokenlon_v5_ethereum_pmm_v5_trades.sql similarity index 100% rename from models/tokenlon/ethereum/tokenlon_v5_ethereum_pmm_v5_trades.sql rename to dex/models/_projects/tokenlon/ethereum/tokenlon_v5_ethereum_pmm_v5_trades.sql diff --git a/models/tokenlon/ethereum/tokenlon_v5_ethereum_rfq_v1_trades.sql b/dex/models/_projects/tokenlon/ethereum/tokenlon_v5_ethereum_rfq_v1_trades.sql similarity index 100% rename from models/tokenlon/ethereum/tokenlon_v5_ethereum_rfq_v1_trades.sql rename to dex/models/_projects/tokenlon/ethereum/tokenlon_v5_ethereum_rfq_v1_trades.sql diff --git a/models/tokenlon/ethereum/tokenlon_v5_ethereum_rfq_v2_trades.sql b/dex/models/_projects/tokenlon/ethereum/tokenlon_v5_ethereum_rfq_v2_trades.sql similarity index 100% rename from models/tokenlon/ethereum/tokenlon_v5_ethereum_rfq_v2_trades.sql rename to dex/models/_projects/tokenlon/ethereum/tokenlon_v5_ethereum_rfq_v2_trades.sql diff --git a/models/tokenlon/tokenlon_trades.sql b/dex/models/_projects/tokenlon/tokenlon_trades.sql similarity index 97% rename from models/tokenlon/tokenlon_trades.sql rename to dex/models/_projects/tokenlon/tokenlon_trades.sql index a1112f50354..3079a528466 100644 --- a/models/tokenlon/tokenlon_trades.sql +++ b/dex/models/_projects/tokenlon/tokenlon_trades.sql @@ -1,6 +1,6 @@ {{ config( + schema = 'tokenlon', alias = 'trades', - post_hook='{{ expose_spells(\'["ethereum"]\', "project", "tokenlon", diff --git a/models/_project/trader_joe/trader_joe_trades.sql b/dex/models/_projects/trader_joe/trader_joe_trades.sql similarity index 100% rename from models/_project/trader_joe/trader_joe_trades.sql rename to dex/models/_projects/trader_joe/trader_joe_trades.sql diff --git a/models/_project/ubeswap/ubeswap_trades.sql b/dex/models/_projects/ubeswap/ubeswap_trades.sql similarity index 100% rename from models/_project/ubeswap/ubeswap_trades.sql rename to dex/models/_projects/ubeswap/ubeswap_trades.sql diff --git a/dex/models/_projects/unidex/optimism/_schema.yml b/dex/models/_projects/unidex/optimism/_schema.yml new file mode 100644 index 00000000000..0de7bc11f0f --- /dev/null +++ b/dex/models/_projects/unidex/optimism/_schema.yml @@ -0,0 +1,99 @@ +version: 2 + +models: + - name: unidex_optimism_trades + meta: + blockchain: optimism + sector: dex + project: unidex + contributors: ARDev097 + config: + tags: ['optimism','trades', 'unidex','dex'] + description: > + unidex dex trades on optimism + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - block_date + - blockchain + - project + - version + - tx_hash + - evt_index + - check_dex_aggregator_seed: + blockchain: optimism + project: unidex + version: 1 + columns: + - &blockchain + name: blockchain + description: "Blockchain on which the project is deployed" + - &project + name: project + description: "The underlying protocol/project where the swap took place" + - &version + name: version + description: "The version of the protocol/project" + - &block_month + name: block_month + description: "Month of the transaction" + - &block_date + name: block_date + description: "Date of the transaction" + - &block_time + name: block_time + description: "Time of the transaction" + - &token_bought_symbol + name: token_bought_symbol + description: "Token symbol for token bought in the transaction" + - &token_sold_symbol + name: token_sold_symbol + description: "Token symbol for token sold in the transaction" + - &token_pair + name: token_pair + description: "Token symbol pair for each token involved in the transaction" + - &token_bought_amount + name: token_bought_amount + description: "Value of the token bought at time of execution in the original currency" + - &token_sold_amount + name: token_sold_amount + description: "Value of the token sold at time of execution in the original currency" + - &token_bought_amount_raw + name: token_bought_amount_raw + description: "Raw value of the token bought at time of execution in the original currency" + - &token_sold_amount_raw + name: token_sold_amount_raw + description: "Raw value of the token sold at time of execution in the original currency" + - &amount_usd + name: amount_usd + description: "USD value of the trade at time of execution" + - &token_bought_address + name: token_bought_address + description: "Contract address of the token bought" + - &token_sold_address + name: token_sold_address + description: "Contract address of the token sold" + - &taker + name: taker + description: "Address of trader who purchased a token" + - &maker + name: maker + description: "Address of trader who sold a token" + - &project_contract_address + name: project_contract_address + description: "Project contract address which executed the trade on the blockchain" + - &tx_hash + name: tx_hash + description: "The hash of the transaction" + - &tx_from + name: tx_from + description: "The address that originated the transaction; based on the optimism.transactions table" + - &tx_to + name: tx_to + description: "The address receiving the transaction; based on the optimism.transactions table" + - &evt_index + name: evt_index + description: "Event index number" + - &trace_address + name: trace_address + description: "" \ No newline at end of file diff --git a/models/unidex/optimism/unidex_optimism_trades.sql b/dex/models/_projects/unidex/optimism/unidex_optimism_trades.sql similarity index 100% rename from models/unidex/optimism/unidex_optimism_trades.sql rename to dex/models/_projects/unidex/optimism/unidex_optimism_trades.sql diff --git a/dex/models/_projects/uniswap/_schema.yml b/dex/models/_projects/uniswap/_schema.yml new file mode 100644 index 00000000000..886e8438644 --- /dev/null +++ b/dex/models/_projects/uniswap/_schema.yml @@ -0,0 +1,278 @@ +version: 2 + +models: + - name: uniswap_pools + meta: + blockchain: ethereum, polygon, arbitrum, celo + sector: dex + contributors: hildobby, tomfutago + config: + tags: ['ethereum', 'polygon', 'arbitrum', 'celo', 'pools'] + description: > + Uniswap DEX pools + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - blockchain + - pool + columns: + - &blockchain + name: blockchain + description: "Blockchain which the DEX is deployed" + - &project + name: project + description: "Project name of the DEX" + - &version + name: version + description: "Version of the contract built and deployed by the DEX project" + - name: pool + description: "DEX pool smart contract address" + - name: fee + description: "Defined fee" + - &token0 + name: token0 + description: "First token in pool" + - &token1 + name: token1 + description: "Second token in pool" + - name: creation_block_time + description: "Block time of pool creation" + - name: creation_block_number + description: "Block number of pool creation" + - name: contract_address + description: "Contract address used to create the pool" + + - name: uniswap_liquidity_manager_pools + meta: + blockchain: optimism + project: uniswap + contributors: msilb7 + config: + tags: ['optimism','uniswap','pools','liquidity managers'] + description: > + A table containing Uniswap mappings for known liquidity manager pools created. + columns: + - name: blockchain + description: 'Blockchain of the LP Token' + - name: dex_project_name + description: "DEX Project Name - This will be used for overall DEX LM incentives models" + - name: dex_project_version + description: "DEX Project Version - This will be used for overall DEX LM incentives models" + - name: project + description: 'Project Name of the LP Token' + - name: contract_address + description: 'Manager LP Token contract address' + - name: pool_contract + description: "Uniswap liquidity pool contract address" + - name: fee + description: "Swap fee of a Uniswap liquidity pool. Divide by 1e4 or power(10,4) to get the fee percentage" + - name: token0 + description: "Token0 contract address" + - name: token1 + description: "Token1 contract address" + + - name: uniswap_arbitrum_pools + meta: + blockchain: arbitrum + sector: dex + contributors: hildobby + config: + tags: ['arbitrum'] + description: > + Uniswap DEX pools + columns: + - *blockchain + - *project + - *version + - name: pool + description: "DEX pool smart contract address" + tests: + - unique + - &fee + name: fee + description: "Defined fee" + - name: token0 + description: "First token in pool" + - name: token1 + description: "Second token in pool" + - name: creation_block_time + description: "Block time of pool creation" + - name: creation_block_number + description: "Block number of pool creation" + - name: contract_address + description: "Contract address used to create the pool" + + - name: uniswap_bnb_pools + meta: + blockchain: bnb + sector: dex + contributors: mtitus6 + config: + tags: ['bnb'] + description: > + Uniswap DEX pools on BNB + columns: + - *blockchain + - *project + - *version + - name: pool + description: "DEX pool smart contract address" + tests: + - unique + - name: fee + description: "Defined fee" + - name: token0 + description: "First token in pool" + - name: token1 + description: "Second token in pool" + - name: creation_block_time + description: "Block time of pool creation" + - name: creation_block_number + description: "Block number of pool creation" + - name: contract_address + description: "Contract address used to create the pool" + + - name: uniswap_celo_pools + meta: + blockchain: celo + sector: dex + contributors: hildobby, tomfutago + config: + tags: ['celo'] + description: > + Uniswap DEX pools + columns: + - *blockchain + - *project + - *version + - name: pool + description: "DEX pool smart contract address" + tests: + - unique + - name: fee + description: "Defined fee" + - name: token0 + description: "First token in pool" + - name: token1 + description: "Second token in pool" + - name: creation_block_time + description: "Block time of pool creation" + - name: creation_block_number + description: "Block number of pool creation" + - name: contract_address + description: "Contract address used to create the pool" + + - name: uniswap_ethereum_pools + meta: + blockchain: ethereum + sector: dex + contributors: hildobby + config: + tags: ['ethereum'] + description: > + Uniswap DEX pools + columns: + - *blockchain + - *project + - *version + - name: pool + description: "DEX pool smart contract address" + tests: + - unique + - name: fee + description: "Defined fee" + - name: token0 + description: "First token in pool" + - name: token1 + description: "Second token in pool" + - name: creation_block_time + description: "Block time of pool creation" + - name: creation_block_number + description: "Block number of pool creation" + - name: contract_address + description: "Contract address used to create the pool" + + - name: uniswap_optimism_pools + meta: + blockchain: optimism + project: uniswap + contributors: msilb7, chuxin, mtitus6 + config: + tags: ['optimism','uniswap','pools'] + description: > + A canonical table containing all Uniswap pools created on Optimism. Pools from OVM1 will be missing from factory_evt_poolcreated, so we use this table to get pool information. + columns: + - *blockchain + - *project + - *version + - name: pool + description: "DEX pool smart contract address" + tests: + - unique + - name: fee + description: "Defined fee" + - name: token0 + description: "First token in pool" + - name: token1 + description: "Second token in pool" + - name: creation_block_time + description: "Block time of pool creation" + - name: creation_block_number + description: "Block number of pool creation" + - name: contract_address + description: "Contract address used to create the pool" + + - name: uniswap_optimism_ovm1_pool_mapping + meta: + blockchain: optimism + project: uniswap + contributors: msilb7, chuxin + config: + tags: ['optimism','uniswap','pools'] + description: > + A canonical table containing all Uniswap pool address changes between OVM1 and the EVM Equivalence regenesis release. + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - oldAddress + - newAddress + columns: + - &oldAddress + name: oldAddress + description: "Uniswap liquidity pool contract address in OVM1" + - &newAddress + name: newAddress + description: "Uniswap liquidity pool contract address in the EVM Equivalence regenesis release." + - *token0 + - *token1 + - *fee + + - name: uniswap_polygon_pools + meta: + blockchain: polygon + sector: dex + contributors: hildobby + config: + tags: ['polygon'] + description: > + Uniswap DEX pools + columns: + - *blockchain + - *project + - *version + - name: pool + description: "DEX pool smart contract address" + tests: + - unique + - name: fee + description: "Defined fee" + - name: token0 + description: "First token in pool" + - name: token1 + description: "Second token in pool" + - name: creation_block_time + description: "Block time of pool creation" + - name: creation_block_number + description: "Block number of pool creation" + - name: contract_address + description: "Contract address used to create the pool" \ No newline at end of file diff --git a/models/uniswap/arbitrum/uniswap_arbitrum_pools.sql b/dex/models/_projects/uniswap/arbitrum/uniswap_arbitrum_pools.sql similarity index 99% rename from models/uniswap/arbitrum/uniswap_arbitrum_pools.sql rename to dex/models/_projects/uniswap/arbitrum/uniswap_arbitrum_pools.sql index 7c026ee6280..496d1694397 100644 --- a/models/uniswap/arbitrum/uniswap_arbitrum_pools.sql +++ b/dex/models/_projects/uniswap/arbitrum/uniswap_arbitrum_pools.sql @@ -1,5 +1,4 @@ {{ config( - schema = 'uniswap_arbitrum', alias = 'pools', materialized = 'incremental', diff --git a/models/uniswap/bnb/uniswap_bnb_pools.sql b/dex/models/_projects/uniswap/bnb/uniswap_bnb_pools.sql similarity index 99% rename from models/uniswap/bnb/uniswap_bnb_pools.sql rename to dex/models/_projects/uniswap/bnb/uniswap_bnb_pools.sql index 5513681bd8c..cc6675f88b7 100644 --- a/models/uniswap/bnb/uniswap_bnb_pools.sql +++ b/dex/models/_projects/uniswap/bnb/uniswap_bnb_pools.sql @@ -1,5 +1,5 @@ {{ config( - + schema = 'uniswap_bnb', alias = 'pools', materialized = 'incremental', diff --git a/models/uniswap/celo/uniswap_celo_pools.sql b/dex/models/_projects/uniswap/celo/uniswap_celo_pools.sql similarity index 100% rename from models/uniswap/celo/uniswap_celo_pools.sql rename to dex/models/_projects/uniswap/celo/uniswap_celo_pools.sql diff --git a/models/uniswap/ethereum/uniswap_ethereum_pools.sql b/dex/models/_projects/uniswap/ethereum/uniswap_ethereum_pools.sql similarity index 100% rename from models/uniswap/ethereum/uniswap_ethereum_pools.sql rename to dex/models/_projects/uniswap/ethereum/uniswap_ethereum_pools.sql diff --git a/models/uniswap/optimism/uniswap_optimism_ovm1_pool_mapping.sql b/dex/models/_projects/uniswap/optimism/uniswap_optimism_ovm1_pool_mapping.sql similarity index 100% rename from models/uniswap/optimism/uniswap_optimism_ovm1_pool_mapping.sql rename to dex/models/_projects/uniswap/optimism/uniswap_optimism_ovm1_pool_mapping.sql diff --git a/models/uniswap/optimism/uniswap_optimism_pools.sql b/dex/models/_projects/uniswap/optimism/uniswap_optimism_pools.sql similarity index 100% rename from models/uniswap/optimism/uniswap_optimism_pools.sql rename to dex/models/_projects/uniswap/optimism/uniswap_optimism_pools.sql diff --git a/models/uniswap/polygon/uniswap_polygon_pools.sql b/dex/models/_projects/uniswap/polygon/uniswap_polygon_pools.sql similarity index 100% rename from models/uniswap/polygon/uniswap_polygon_pools.sql rename to dex/models/_projects/uniswap/polygon/uniswap_polygon_pools.sql diff --git a/models/uniswap/uniswap_liquidity_manager_pools.sql b/dex/models/_projects/uniswap/uniswap_liquidity_manager_pools.sql similarity index 100% rename from models/uniswap/uniswap_liquidity_manager_pools.sql rename to dex/models/_projects/uniswap/uniswap_liquidity_manager_pools.sql diff --git a/models/uniswap/uniswap_pools.sql b/dex/models/_projects/uniswap/uniswap_pools.sql similarity index 96% rename from models/uniswap/uniswap_pools.sql rename to dex/models/_projects/uniswap/uniswap_pools.sql index 184d0b59c38..3e88d084378 100644 --- a/models/uniswap/uniswap_pools.sql +++ b/dex/models/_projects/uniswap/uniswap_pools.sql @@ -1,5 +1,5 @@ {{ config( - + schema = 'uniswap', alias = 'pools', post_hook='{{ expose_spells(\'["ethereum", "arbitrum", "polygon"]\', "project", diff --git a/models/_project/uniswap/uniswap_trades.sql b/dex/models/_projects/uniswap/uniswap_trades.sql similarity index 100% rename from models/_project/uniswap/uniswap_trades.sql rename to dex/models/_projects/uniswap/uniswap_trades.sql diff --git a/models/_project/velodrome/velodrome_trades.sql b/dex/models/_projects/velodrome/velodrome_trades.sql similarity index 100% rename from models/_project/velodrome/velodrome_trades.sql rename to dex/models/_projects/velodrome/velodrome_trades.sql diff --git a/models/_project/verse_dex/verse_dex_trades.sql b/dex/models/_projects/verse_dex/verse_dex_trades.sql similarity index 100% rename from models/_project/verse_dex/verse_dex_trades.sql rename to dex/models/_projects/verse_dex/verse_dex_trades.sql diff --git a/models/_project/wardenswap/wardenswap_trades.sql b/dex/models/_projects/wardenswap/wardenswap_trades.sql similarity index 100% rename from models/_project/wardenswap/wardenswap_trades.sql rename to dex/models/_projects/wardenswap/wardenswap_trades.sql diff --git a/models/wigoswap/fantom/wigoswap_fantom_schema.yml b/dex/models/_projects/wigoswap/fantom/_schema.yml similarity index 100% rename from models/wigoswap/fantom/wigoswap_fantom_schema.yml rename to dex/models/_projects/wigoswap/fantom/_schema.yml diff --git a/models/wigoswap/fantom/wigoswap_fantom_pools.sql b/dex/models/_projects/wigoswap/fantom/wigoswap_fantom_pools.sql similarity index 100% rename from models/wigoswap/fantom/wigoswap_fantom_pools.sql rename to dex/models/_projects/wigoswap/fantom/wigoswap_fantom_pools.sql diff --git a/models/_project/wigoswap/wigoswap_trades.sql b/dex/models/_projects/wigoswap/wigoswap_trades.sql similarity index 100% rename from models/_project/wigoswap/wigoswap_trades.sql rename to dex/models/_projects/wigoswap/wigoswap_trades.sql diff --git a/models/_project/wombat/wombat_trades.sql b/dex/models/_projects/wombat/wombat_trades.sql similarity index 100% rename from models/_project/wombat/wombat_trades.sql rename to dex/models/_projects/wombat/wombat_trades.sql diff --git a/models/_project/woofi/woofi_trades.sql b/dex/models/_projects/woofi/woofi_trades.sql similarity index 100% rename from models/_project/woofi/woofi_trades.sql rename to dex/models/_projects/woofi/woofi_trades.sql diff --git a/models/_project/xchange/xchange_trades.sql b/dex/models/_projects/xchange/xchange_trades.sql similarity index 100% rename from models/_project/xchange/xchange_trades.sql rename to dex/models/_projects/xchange/xchange_trades.sql diff --git a/dex/models/_projects/yield_yak/_schema.yml b/dex/models/_projects/yield_yak/_schema.yml new file mode 100644 index 00000000000..54303a59964 --- /dev/null +++ b/dex/models/_projects/yield_yak/_schema.yml @@ -0,0 +1,79 @@ +version: 2 + +models: + - name: yield_yak_trades + meta: + blockchain: avalanche_c, arbitrum, mantle + sector: dex + project: yield_yak + contributors: Henrystats, angus_1 + config: + tags: ['avalanche_c', 'yield_yak','trades', 'dex', 'aggregator', 'Henrystats', 'angus_1', 'cross-chain', 'arbitrum', 'mantle'] + description: > + yield yak aggregator trades on all chains across all contracts and versions. This table will load dex trades downstream. + columns: + - name: blockchain + description: "Blockchain which the DEX is deployed" + - &project + name: project + description: "Project name of the DEX" + - &version + name: version + description: "Version of the contract built and deployed by the DEX project" + - name: block_date + description: "UTC event block date of each DEX trade" + - name: block_time + description: "UTC event block time of each DEX trade" + - &token_bought_symbol + name: token_bought_symbol + description: "Token symbol for token bought in the transaction" + - &token_sold_symbol + name: token_sold_symbol + description: "Token symbol for token sold in the transaction" + - &token_pair + name: token_pair + description: "Token symbol pair for each token involved in the transaction" + - &token_bought_amount + name: token_bought_amount + description: "Value of the token bought at time of execution in the original currency" + - &token_sold_amount + name: token_sold_amount + description: "Value of the token sold at time of execution in the original currency" + - &token_bought_amount_raw + name: token_bought_amount_raw + description: "Raw value of the token bought at time of execution in the original currency" + - &token_sold_amount_raw + name: token_sold_amount_raw + description: "Raw value of the token sold at time of execution in the original currency" + - &amount_usd + name: amount_usd + description: "USD value of the trade at time of execution" + - &token_bought_address + name: token_bought_address + description: "Contract address of the token bought" + - &token_sold_address + name: token_sold_address + description: "Contract address of the token sold" + - &taker + name: taker + description: "Address of trader who purchased a token" + - &maker + name: maker + description: "Address of trader who sold a token" + - &project_contract_address + name: project_contract_address + description: "Project contract address which executed the trade on the blockchain" + - name: tx_hash + description: "Unique transaction hash value tied to each transaction on the DEX" + - &tx_from + name: tx_from + description: "Address which initiated the transaction" + - &tx_to + name: tx_to + description: "Address which received the transaction" + - &trace_address + name: trace_address + description: "Address of the trace within the call graph forest" + - &evt_index + name: evt_index + description: "The position of this event log within this transaction" \ No newline at end of file diff --git a/models/uniswap/base/uniswap_base_schema.yml b/dex/models/_projects/yield_yak/arbitrum/_schema.yml similarity index 79% rename from models/uniswap/base/uniswap_base_schema.yml rename to dex/models/_projects/yield_yak/arbitrum/_schema.yml index 8fa0b4a7979..218be819acd 100644 --- a/models/uniswap/base/uniswap_base_schema.yml +++ b/dex/models/_projects/yield_yak/arbitrum/_schema.yml @@ -1,16 +1,16 @@ version: 2 models: - - name: uniswap_v3_base_trades + - name: yield_yak_arbitrum_trades meta: - blockchain: base + blockchain: arbitrum sector: dex - project: uniswap_v3 - contributors: wuligy + project: yield_yak + contributors: angus_1 config: - tags: ['base','uniswap_v3','trades', 'uniswap','dex'] + tags: ['arbitrum','trades', 'aggregator', 'yield_yak','dex'] description: > - Uniswap V3 contract trades on Base + yield yak aggregator trades on arbitrum tests: - dbt_utils.unique_combination_of_columns: combination_of_columns: @@ -20,28 +20,23 @@ models: - version - tx_hash - evt_index - - check_dex_seed: - blockchain: base - project: uniswap - version: 3 + - trace_address + - check_dex_aggregator_seed: + blockchain: arbitrum + project: yield_yak + version: 1 columns: - - &blockchain - name: blockchain + - name: blockchain description: "Blockchain which the DEX is deployed" - &project name: project - description: "Project name of the DEX" + description: "Project name of the DEX" - &version name: version description: "Version of the contract built and deployed by the DEX project" - - &block_date - name: block_date + - name: block_date description: "UTC event block date of each DEX trade" - - &block_month - name: block_month - description: "UTC event block month of each DEX trade" - - &block_time - name: block_time + - name: block_time description: "UTC event block time of each DEX trade" - &token_bought_symbol name: token_bought_symbol @@ -82,8 +77,7 @@ models: - &project_contract_address name: project_contract_address description: "Project contract address which executed the trade on the blockchain" - - &tx_hash - name: tx_hash + - name: tx_hash description: "Unique transaction hash value tied to each transaction on the DEX" - &tx_from name: tx_from @@ -91,6 +85,12 @@ models: - &tx_to name: tx_to description: "Address which received the transaction" + - &trace_address + name: trace_address + description: "" - &evt_index name: evt_index - description: "" \ No newline at end of file + description: "The position of this event log within this transaction" + - &block_month + name: block_month + description: "UTC event block month of each DEX trade" \ No newline at end of file diff --git a/models/yield_yak/arbitrum/yield_yak_arbitrum_trades.sql b/dex/models/_projects/yield_yak/arbitrum/yield_yak_arbitrum_trades.sql similarity index 100% rename from models/yield_yak/arbitrum/yield_yak_arbitrum_trades.sql rename to dex/models/_projects/yield_yak/arbitrum/yield_yak_arbitrum_trades.sql diff --git a/models/uniswap/avalanche_c/uniswap_avalanche_c_schema.yml b/dex/models/_projects/yield_yak/avalanche_c/_schema.yml similarity index 80% rename from models/uniswap/avalanche_c/uniswap_avalanche_c_schema.yml rename to dex/models/_projects/yield_yak/avalanche_c/_schema.yml index 947cc59a418..745843b9720 100644 --- a/models/uniswap/avalanche_c/uniswap_avalanche_c_schema.yml +++ b/dex/models/_projects/yield_yak/avalanche_c/_schema.yml @@ -1,16 +1,16 @@ version: 2 models: - - name: uniswap_v3_avalanche_c_trades + - name: yield_yak_avalanche_c_trades meta: blockchain: avalanche_c sector: dex - project: uniswap_v3 - contributors: phu + project: yield_yak + contributors: Henrystats config: - tags: ['avalanche_c','uniswap_v3','trades', 'uniswap','dex'] + tags: ['avalanche_c','trades', 'aggregator', 'yield_yak','dex'] description: > - Uniswap V3 contract trades on Avalanche_c + yield yak aggregator trades on avalanche_c tests: - dbt_utils.unique_combination_of_columns: combination_of_columns: @@ -20,28 +20,23 @@ models: - version - tx_hash - evt_index - - check_dex_seed: + - trace_address + - check_dex_aggregator_seed: blockchain: avalanche_c - project: uniswap - version: 3 + project: yield_yak + version: 1 columns: - - &blockchain - name: blockchain + - name: blockchain description: "Blockchain which the DEX is deployed" - - &project + - &project name: project - description: "Project name of the DEX" + description: "Project name of the DEX" - &version name: version description: "Version of the contract built and deployed by the DEX project" - - &block_date - name: block_date + - name: block_date description: "UTC event block date of each DEX trade" - - &block_month - name: block_month - description: "UTC event block month of each DEX trade" - - &block_time - name: block_time + - name: block_time description: "UTC event block time of each DEX trade" - &token_bought_symbol name: token_bought_symbol @@ -82,8 +77,7 @@ models: - &project_contract_address name: project_contract_address description: "Project contract address which executed the trade on the blockchain" - - &tx_hash - name: tx_hash + - name: tx_hash description: "Unique transaction hash value tied to each transaction on the DEX" - &tx_from name: tx_from @@ -91,6 +85,12 @@ models: - &tx_to name: tx_to description: "Address which received the transaction" + - &trace_address + name: trace_address + description: "" - &evt_index name: evt_index - description: "" \ No newline at end of file + description: "The position of this event log within this transaction" + - &block_month + name: block_month + description: "UTC event block month of each DEX trade" \ No newline at end of file diff --git a/models/yield_yak/avalanche_c/yield_yak_avalanche_c_trades.sql b/dex/models/_projects/yield_yak/avalanche_c/yield_yak_avalanche_c_trades.sql similarity index 100% rename from models/yield_yak/avalanche_c/yield_yak_avalanche_c_trades.sql rename to dex/models/_projects/yield_yak/avalanche_c/yield_yak_avalanche_c_trades.sql diff --git a/models/pharaoh/pharaoh_avalanche_c_schema.yml b/dex/models/_projects/yield_yak/mantle/_schema.yml similarity index 80% rename from models/pharaoh/pharaoh_avalanche_c_schema.yml rename to dex/models/_projects/yield_yak/mantle/_schema.yml index 38aa30ab7b0..9be02b99d00 100644 --- a/models/pharaoh/pharaoh_avalanche_c_schema.yml +++ b/dex/models/_projects/yield_yak/mantle/_schema.yml @@ -1,96 +1,96 @@ -version: 2 - -models: - - name: pharaoh_avalanche_c_trades - meta: - blockchain: avalanche_c - sector: dex - project: pharaoh - contributors: discochuck, hosuke - config: - tags: ['avalanche_c','pharaoh','trades','dex'] - description: > - pharaoh v2 contract trades on avalanche_c - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - block_date - - blockchain - - project - - version - - tx_hash - - evt_index - - check_dex_seed: - blockchain: avalanche_c - project: pharaoh - version: 1 - columns: - - &blockchain - name: blockchain - description: "Blockchain which the DEX is deployed" - - &project - name: project - description: "Project name of the DEX" - - &version - name: version - description: "Version of the contract built and deployed by the DEX project" - - &block_month - name: block_month - description: "UTC event block month of each DEX trade" - - &block_date - name: block_date - description: "UTC event block date of each DEX trade" - - &block_time - name: block_time - description: "UTC event block time of each DEX trade" - - &token_bought_symbol - name: token_bought_symbol - description: "Token symbol for token bought in the transaction" - - &token_sold_symbol - name: token_sold_symbol - description: "Token symbol for token sold in the transaction" - - &token_pair - name: token_pair - description: "Token symbol pair for each token involved in the transaction" - - &token_bought_amount - name: token_bought_amount - description: "Value of the token bought at time of execution in the original currency" - - &token_sold_amount - name: token_sold_amount - description: "Value of the token sold at time of execution in the original currency" - - &token_bought_amount_raw - name: token_bought_amount_raw - description: "Raw value of the token bought at time of execution in the original currency" - - &token_sold_amount_raw - name: token_sold_amount_raw - description: "Raw value of the token sold at time of execution in the original currency" - - &amount_usd - name: amount_usd - description: "USD value of the trade at time of execution" - - &token_bought_address - name: token_bought_address - description: "Contract address of the token bought" - - &token_sold_address - name: token_sold_address - description: "Contract address of the token sold" - - &taker - name: taker - description: "Address of trader who purchased a token" - - &maker - name: maker - description: "Address of trader who sold a token" - - &project_contract_address - name: project_contract_address - description: "Project contract address which executed the trade on the blockchain" - - &tx_hash - name: tx_hash - description: "Unique transaction hash value tied to each transaction on the DEX" - - &tx_from - name: tx_from - description: "Address which initiated the transaction" - - &tx_to - name: tx_to - description: "Address which received the transaction" - - &evt_index - name: evt_index - +version: 2 + +models: + - name: yield_yak_mantle_trades + meta: + blockchain: mantle + sector: dex + project: yield_yak + contributors: angus_1 + config: + tags: ['mantle','trades', 'aggregator', 'yield_yak','dex'] + description: > + yield yak aggregator trades on mantle + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - block_date + - blockchain + - project + - version + - tx_hash + - evt_index + - trace_address + - check_dex_aggregator_seed: + blockchain: mantle + project: yield_yak + version: 1 + columns: + - name: blockchain + description: "Blockchain which the DEX is deployed" + - &project + name: project + description: "Project name of the DEX" + - &version + name: version + description: "Version of the contract built and deployed by the DEX project" + - name: block_date + description: "UTC event block date of each DEX trade" + - name: block_time + description: "UTC event block time of each DEX trade" + - &token_bought_symbol + name: token_bought_symbol + description: "Token symbol for token bought in the transaction" + - &token_sold_symbol + name: token_sold_symbol + description: "Token symbol for token sold in the transaction" + - &token_pair + name: token_pair + description: "Token symbol pair for each token involved in the transaction" + - &token_bought_amount + name: token_bought_amount + description: "Value of the token bought at time of execution in the original currency" + - &token_sold_amount + name: token_sold_amount + description: "Value of the token sold at time of execution in the original currency" + - &token_bought_amount_raw + name: token_bought_amount_raw + description: "Raw value of the token bought at time of execution in the original currency" + - &token_sold_amount_raw + name: token_sold_amount_raw + description: "Raw value of the token sold at time of execution in the original currency" + - &amount_usd + name: amount_usd + description: "USD value of the trade at time of execution" + - &token_bought_address + name: token_bought_address + description: "Contract address of the token bought" + - &token_sold_address + name: token_sold_address + description: "Contract address of the token sold" + - &taker + name: taker + description: "Address of trader who purchased a token" + - &maker + name: maker + description: "Address of trader who sold a token" + - &project_contract_address + name: project_contract_address + description: "Project contract address which executed the trade on the blockchain" + - name: tx_hash + description: "Unique transaction hash value tied to each transaction on the DEX" + - &tx_from + name: tx_from + description: "Address which initiated the transaction" + - &tx_to + name: tx_to + description: "Address which received the transaction" + - &trace_address + name: trace_address + description: "" + - &evt_index + name: evt_index + description: "The position of this event log within this transaction" + - &block_month + name: block_month + description: "UTC event block month of each DEX trade" \ No newline at end of file diff --git a/models/yield_yak/mantle/yield_yak_mantle_trades.sql b/dex/models/_projects/yield_yak/mantle/yield_yak_mantle_trades.sql similarity index 100% rename from models/yield_yak/mantle/yield_yak_mantle_trades.sql rename to dex/models/_projects/yield_yak/mantle/yield_yak_mantle_trades.sql diff --git a/models/yield_yak/yield_yak_trades.sql b/dex/models/_projects/yield_yak/yield_yak_trades.sql similarity index 100% rename from models/yield_yak/yield_yak_trades.sql rename to dex/models/_projects/yield_yak/yield_yak_trades.sql diff --git a/models/zeroex/arbitrum/zeroex_arbitrum_api_fills.sql b/dex/models/_projects/zeroex/arbitrum/zeroex_arbitrum_api_fills.sql similarity index 99% rename from models/zeroex/arbitrum/zeroex_arbitrum_api_fills.sql rename to dex/models/_projects/zeroex/arbitrum/zeroex_arbitrum_api_fills.sql index ca28b611eb6..522b4e786ee 100644 --- a/models/zeroex/arbitrum/zeroex_arbitrum_api_fills.sql +++ b/dex/models/_projects/zeroex/arbitrum/zeroex_arbitrum_api_fills.sql @@ -1,5 +1,5 @@ {{ config( - + schema = 'zeroex_arbitrum', alias = 'api_fills', materialized='incremental', partition_by = ['block_month'], diff --git a/models/zeroex/arbitrum/zeroex_arbitrum_api_fills_deduped.sql b/dex/models/_projects/zeroex/arbitrum/zeroex_arbitrum_api_fills_deduped.sql similarity index 100% rename from models/zeroex/arbitrum/zeroex_arbitrum_api_fills_deduped.sql rename to dex/models/_projects/zeroex/arbitrum/zeroex_arbitrum_api_fills_deduped.sql diff --git a/models/zeroex/arbitrum/zeroex_arbitrum_native_fills.sql b/dex/models/_projects/zeroex/arbitrum/zeroex_arbitrum_native_fills.sql similarity index 99% rename from models/zeroex/arbitrum/zeroex_arbitrum_native_fills.sql rename to dex/models/_projects/zeroex/arbitrum/zeroex_arbitrum_native_fills.sql index b6443dd96eb..c0dcc026f90 100644 --- a/models/zeroex/arbitrum/zeroex_arbitrum_native_fills.sql +++ b/dex/models/_projects/zeroex/arbitrum/zeroex_arbitrum_native_fills.sql @@ -1,4 +1,5 @@ {{ config( + schema = 'zeroex_arbitrum', alias = 'native_fills', materialized='incremental', partition_by = ['block_month'], diff --git a/models/zeroex/arbitrum/zeroex_arbitrum_schema.yml b/dex/models/_projects/zeroex/arbitrum/zeroex_arbitrum_schema.yml similarity index 100% rename from models/zeroex/arbitrum/zeroex_arbitrum_schema.yml rename to dex/models/_projects/zeroex/arbitrum/zeroex_arbitrum_schema.yml diff --git a/models/zeroex/avalanche_c/zeroex_avalanche_c_api_fills.sql b/dex/models/_projects/zeroex/avalanche_c/zeroex_avalanche_c_api_fills.sql similarity index 99% rename from models/zeroex/avalanche_c/zeroex_avalanche_c_api_fills.sql rename to dex/models/_projects/zeroex/avalanche_c/zeroex_avalanche_c_api_fills.sql index ecc912e35f6..61517e467d8 100644 --- a/models/zeroex/avalanche_c/zeroex_avalanche_c_api_fills.sql +++ b/dex/models/_projects/zeroex/avalanche_c/zeroex_avalanche_c_api_fills.sql @@ -1,5 +1,5 @@ {{ config( - + schema = 'zeroex_avalance_c', alias = 'api_fills', materialized='incremental', partition_by = ['block_month'], diff --git a/models/zeroex/avalanche_c/zeroex_avalanche_c_api_fills_deduped.sql b/dex/models/_projects/zeroex/avalanche_c/zeroex_avalanche_c_api_fills_deduped.sql similarity index 100% rename from models/zeroex/avalanche_c/zeroex_avalanche_c_api_fills_deduped.sql rename to dex/models/_projects/zeroex/avalanche_c/zeroex_avalanche_c_api_fills_deduped.sql diff --git a/models/zeroex/avalanche_c/zeroex_avalanche_c_schema.yml b/dex/models/_projects/zeroex/avalanche_c/zeroex_avalanche_c_schema.yml similarity index 100% rename from models/zeroex/avalanche_c/zeroex_avalanche_c_schema.yml rename to dex/models/_projects/zeroex/avalanche_c/zeroex_avalanche_c_schema.yml diff --git a/models/zeroex/base/zeroex_base_api_fills.sql b/dex/models/_projects/zeroex/base/zeroex_base_api_fills.sql similarity index 100% rename from models/zeroex/base/zeroex_base_api_fills.sql rename to dex/models/_projects/zeroex/base/zeroex_base_api_fills.sql diff --git a/models/zeroex/base/zeroex_base_api_fills_deduped.sql b/dex/models/_projects/zeroex/base/zeroex_base_api_fills_deduped.sql similarity index 100% rename from models/zeroex/base/zeroex_base_api_fills_deduped.sql rename to dex/models/_projects/zeroex/base/zeroex_base_api_fills_deduped.sql diff --git a/models/zeroex/base/zeroex_base_api_fills_schema.yml b/dex/models/_projects/zeroex/base/zeroex_base_api_fills_schema.yml similarity index 100% rename from models/zeroex/base/zeroex_base_api_fills_schema.yml rename to dex/models/_projects/zeroex/base/zeroex_base_api_fills_schema.yml diff --git a/models/zeroex/bnb/zeroex_bnb_api_fills.sql b/dex/models/_projects/zeroex/bnb/zeroex_bnb_api_fills.sql similarity index 99% rename from models/zeroex/bnb/zeroex_bnb_api_fills.sql rename to dex/models/_projects/zeroex/bnb/zeroex_bnb_api_fills.sql index a4b0a526244..5dca26f6314 100644 --- a/models/zeroex/bnb/zeroex_bnb_api_fills.sql +++ b/dex/models/_projects/zeroex/bnb/zeroex_bnb_api_fills.sql @@ -1,5 +1,5 @@ {{ config( - + schema = 'zeroex_bnb', alias = 'api_fills', materialized='incremental', partition_by = ['block_month'], diff --git a/models/zeroex/bnb/zeroex_bnb_api_fills_deduped.sql b/dex/models/_projects/zeroex/bnb/zeroex_bnb_api_fills_deduped.sql similarity index 99% rename from models/zeroex/bnb/zeroex_bnb_api_fills_deduped.sql rename to dex/models/_projects/zeroex/bnb/zeroex_bnb_api_fills_deduped.sql index f669c048297..68be120d149 100644 --- a/models/zeroex/bnb/zeroex_bnb_api_fills_deduped.sql +++ b/dex/models/_projects/zeroex/bnb/zeroex_bnb_api_fills_deduped.sql @@ -1,5 +1,5 @@ {{ config( - + schema = 'zeroex_bnb', alias = 'api_fills_deduped', materialized='incremental', partition_by = ['block_month'], diff --git a/models/zeroex/bnb/zeroex_bnb_native_fills.sql b/dex/models/_projects/zeroex/bnb/zeroex_bnb_native_fills.sql similarity index 99% rename from models/zeroex/bnb/zeroex_bnb_native_fills.sql rename to dex/models/_projects/zeroex/bnb/zeroex_bnb_native_fills.sql index 4a20b62ee56..6b582e2d540 100644 --- a/models/zeroex/bnb/zeroex_bnb_native_fills.sql +++ b/dex/models/_projects/zeroex/bnb/zeroex_bnb_native_fills.sql @@ -1,4 +1,5 @@ {{ config( + schema = 'zeroex_bnb', alias = 'native_fills', materialized='incremental', partition_by = ['block_month'], diff --git a/models/zeroex/bnb/zeroex_bnb_schema.yml b/dex/models/_projects/zeroex/bnb/zeroex_bnb_schema.yml similarity index 100% rename from models/zeroex/bnb/zeroex_bnb_schema.yml rename to dex/models/_projects/zeroex/bnb/zeroex_bnb_schema.yml diff --git a/models/zeroex/celo/zeroex_celo_api_fills.sql b/dex/models/_projects/zeroex/celo/zeroex_celo_api_fills.sql similarity index 100% rename from models/zeroex/celo/zeroex_celo_api_fills.sql rename to dex/models/_projects/zeroex/celo/zeroex_celo_api_fills.sql diff --git a/models/zeroex/celo/zeroex_celo_api_fills_deduped.sql b/dex/models/_projects/zeroex/celo/zeroex_celo_api_fills_deduped.sql similarity index 100% rename from models/zeroex/celo/zeroex_celo_api_fills_deduped.sql rename to dex/models/_projects/zeroex/celo/zeroex_celo_api_fills_deduped.sql diff --git a/models/zeroex/celo/zeroex_celo_schema.yml b/dex/models/_projects/zeroex/celo/zeroex_celo_schema.yml similarity index 100% rename from models/zeroex/celo/zeroex_celo_schema.yml rename to dex/models/_projects/zeroex/celo/zeroex_celo_schema.yml diff --git a/models/zeroex/ethereum/zeroex_ethereum_api_fills.sql b/dex/models/_projects/zeroex/ethereum/zeroex_ethereum_api_fills.sql similarity index 99% rename from models/zeroex/ethereum/zeroex_ethereum_api_fills.sql rename to dex/models/_projects/zeroex/ethereum/zeroex_ethereum_api_fills.sql index 1531044e861..a8d101a01e2 100644 --- a/models/zeroex/ethereum/zeroex_ethereum_api_fills.sql +++ b/dex/models/_projects/zeroex/ethereum/zeroex_ethereum_api_fills.sql @@ -1,5 +1,5 @@ {{ config( - + schema = 'zeroex_ethereum', alias = 'api_fills', materialized='incremental', partition_by = ['block_month'], diff --git a/models/zeroex/ethereum/zeroex_ethereum_api_fills_deduped.sql b/dex/models/_projects/zeroex/ethereum/zeroex_ethereum_api_fills_deduped.sql similarity index 100% rename from models/zeroex/ethereum/zeroex_ethereum_api_fills_deduped.sql rename to dex/models/_projects/zeroex/ethereum/zeroex_ethereum_api_fills_deduped.sql diff --git a/models/zeroex/ethereum/zeroex_ethereum_native_fills.sql b/dex/models/_projects/zeroex/ethereum/zeroex_ethereum_native_fills.sql similarity index 99% rename from models/zeroex/ethereum/zeroex_ethereum_native_fills.sql rename to dex/models/_projects/zeroex/ethereum/zeroex_ethereum_native_fills.sql index 6bf44060d48..d25d7b2ed58 100644 --- a/models/zeroex/ethereum/zeroex_ethereum_native_fills.sql +++ b/dex/models/_projects/zeroex/ethereum/zeroex_ethereum_native_fills.sql @@ -1,4 +1,5 @@ {{ config( + schema = 'zeroex_ethereum', alias = 'native_fills', materialized='incremental', partition_by = ['block_month'], diff --git a/models/zeroex/ethereum/zeroex_ethereum_nft_fills.sql b/dex/models/_projects/zeroex/ethereum/zeroex_ethereum_nft_fills.sql similarity index 99% rename from models/zeroex/ethereum/zeroex_ethereum_nft_fills.sql rename to dex/models/_projects/zeroex/ethereum/zeroex_ethereum_nft_fills.sql index 67140ef0f2a..faf0b2ce872 100644 --- a/models/zeroex/ethereum/zeroex_ethereum_nft_fills.sql +++ b/dex/models/_projects/zeroex/ethereum/zeroex_ethereum_nft_fills.sql @@ -1,5 +1,5 @@ {{ config( - + schema = 'zeroex_ethereum', alias = 'nft_fills', materialized='incremental', partition_by = ['block_date'], diff --git a/models/zeroex/ethereum/zeroex_ethereum_schema.yml b/dex/models/_projects/zeroex/ethereum/zeroex_ethereum_schema.yml similarity index 100% rename from models/zeroex/ethereum/zeroex_ethereum_schema.yml rename to dex/models/_projects/zeroex/ethereum/zeroex_ethereum_schema.yml diff --git a/models/zeroex/fantom/zeroex_fantom_api_fills.sql b/dex/models/_projects/zeroex/fantom/zeroex_fantom_api_fills.sql similarity index 99% rename from models/zeroex/fantom/zeroex_fantom_api_fills.sql rename to dex/models/_projects/zeroex/fantom/zeroex_fantom_api_fills.sql index 7aa286884d8..5b72e6db837 100644 --- a/models/zeroex/fantom/zeroex_fantom_api_fills.sql +++ b/dex/models/_projects/zeroex/fantom/zeroex_fantom_api_fills.sql @@ -1,5 +1,5 @@ {{ config( - + schema = 'zeroex_fantom', alias = 'api_fills', materialized='incremental', partition_by = ['block_month'], diff --git a/models/zeroex/fantom/zeroex_fantom_api_fills_deduped.sql b/dex/models/_projects/zeroex/fantom/zeroex_fantom_api_fills_deduped.sql similarity index 100% rename from models/zeroex/fantom/zeroex_fantom_api_fills_deduped.sql rename to dex/models/_projects/zeroex/fantom/zeroex_fantom_api_fills_deduped.sql diff --git a/models/zeroex/fantom/zeroex_fantom_schema.yml b/dex/models/_projects/zeroex/fantom/zeroex_fantom_schema.yml similarity index 100% rename from models/zeroex/fantom/zeroex_fantom_schema.yml rename to dex/models/_projects/zeroex/fantom/zeroex_fantom_schema.yml diff --git a/models/zeroex/optimism/zeroex_optimism_api_fills.sql b/dex/models/_projects/zeroex/optimism/zeroex_optimism_api_fills.sql similarity index 100% rename from models/zeroex/optimism/zeroex_optimism_api_fills.sql rename to dex/models/_projects/zeroex/optimism/zeroex_optimism_api_fills.sql diff --git a/models/zeroex/optimism/zeroex_optimism_api_fills_deduped.sql b/dex/models/_projects/zeroex/optimism/zeroex_optimism_api_fills_deduped.sql similarity index 100% rename from models/zeroex/optimism/zeroex_optimism_api_fills_deduped.sql rename to dex/models/_projects/zeroex/optimism/zeroex_optimism_api_fills_deduped.sql diff --git a/models/zeroex/optimism/zeroex_optimism_native_fills.sql b/dex/models/_projects/zeroex/optimism/zeroex_optimism_native_fills.sql similarity index 99% rename from models/zeroex/optimism/zeroex_optimism_native_fills.sql rename to dex/models/_projects/zeroex/optimism/zeroex_optimism_native_fills.sql index 6543c86271f..c8b03dc979e 100644 --- a/models/zeroex/optimism/zeroex_optimism_native_fills.sql +++ b/dex/models/_projects/zeroex/optimism/zeroex_optimism_native_fills.sql @@ -1,4 +1,5 @@ {{ config( + schema = 'zeroex_optimism', alias = 'native_fills', materialized='incremental', partition_by = ['block_month'], diff --git a/models/zeroex/optimism/zeroex_optimism_schema.yml b/dex/models/_projects/zeroex/optimism/zeroex_optimism_schema.yml similarity index 100% rename from models/zeroex/optimism/zeroex_optimism_schema.yml rename to dex/models/_projects/zeroex/optimism/zeroex_optimism_schema.yml diff --git a/models/zeroex/polygon/zeroex_polygon_api_fills.sql b/dex/models/_projects/zeroex/polygon/zeroex_polygon_api_fills.sql similarity index 100% rename from models/zeroex/polygon/zeroex_polygon_api_fills.sql rename to dex/models/_projects/zeroex/polygon/zeroex_polygon_api_fills.sql diff --git a/models/zeroex/polygon/zeroex_polygon_api_fills_deduped.sql b/dex/models/_projects/zeroex/polygon/zeroex_polygon_api_fills_deduped.sql similarity index 100% rename from models/zeroex/polygon/zeroex_polygon_api_fills_deduped.sql rename to dex/models/_projects/zeroex/polygon/zeroex_polygon_api_fills_deduped.sql diff --git a/models/zeroex/polygon/zeroex_polygon_native_fills.sql b/dex/models/_projects/zeroex/polygon/zeroex_polygon_native_fills.sql similarity index 99% rename from models/zeroex/polygon/zeroex_polygon_native_fills.sql rename to dex/models/_projects/zeroex/polygon/zeroex_polygon_native_fills.sql index 2fb1d2b80bc..6d37f0eaa50 100644 --- a/models/zeroex/polygon/zeroex_polygon_native_fills.sql +++ b/dex/models/_projects/zeroex/polygon/zeroex_polygon_native_fills.sql @@ -1,4 +1,5 @@ {{ config( + schema = 'zeroex_polygon', alias = 'native_fills', materialized='incremental', partition_by = ['block_month'], diff --git a/models/zeroex/polygon/zeroex_polygon_nft_fills.sql b/dex/models/_projects/zeroex/polygon/zeroex_polygon_nft_fills.sql similarity index 98% rename from models/zeroex/polygon/zeroex_polygon_nft_fills.sql rename to dex/models/_projects/zeroex/polygon/zeroex_polygon_nft_fills.sql index c59c022a550..4dc306800c5 100644 --- a/models/zeroex/polygon/zeroex_polygon_nft_fills.sql +++ b/dex/models/_projects/zeroex/polygon/zeroex_polygon_nft_fills.sql @@ -1,5 +1,6 @@ {{ config( -tags=['prod_exclude'], + tags=['prod_exclude'], + schema = 'zeroex_polygon', alias = 'nft_fills', materialized='incremental', partition_by = ['block_date'], diff --git a/models/zeroex/polygon/zeroex_polygon_schema.yml b/dex/models/_projects/zeroex/polygon/zeroex_polygon_schema.yml similarity index 100% rename from models/zeroex/polygon/zeroex_polygon_schema.yml rename to dex/models/_projects/zeroex/polygon/zeroex_polygon_schema.yml diff --git a/models/zeroex/zeroex_api_fills.sql b/dex/models/_projects/zeroex/zeroex_api_fills.sql similarity index 100% rename from models/zeroex/zeroex_api_fills.sql rename to dex/models/_projects/zeroex/zeroex_api_fills.sql diff --git a/models/zeroex/zeroex_api_fills_deduped.sql b/dex/models/_projects/zeroex/zeroex_api_fills_deduped.sql similarity index 100% rename from models/zeroex/zeroex_api_fills_deduped.sql rename to dex/models/_projects/zeroex/zeroex_api_fills_deduped.sql diff --git a/models/zeroex/zeroex_native_fills.sql b/dex/models/_projects/zeroex/zeroex_native_fills.sql similarity index 96% rename from models/zeroex/zeroex_native_fills.sql rename to dex/models/_projects/zeroex/zeroex_native_fills.sql index f9e1bb61214..156b6b259ae 100644 --- a/models/zeroex/zeroex_native_fills.sql +++ b/dex/models/_projects/zeroex/zeroex_native_fills.sql @@ -1,4 +1,5 @@ {{ config( + schema = 'zeroex', alias = 'native_fills', post_hook='{{ expose_spells(\'["ethereum","arbitrum", "optimism", "polygon","bnb"]\', "project", diff --git a/models/zeroex/zeroex_native_trades.sql b/dex/models/_projects/zeroex/zeroex_native_trades.sql similarity index 98% rename from models/zeroex/zeroex_native_trades.sql rename to dex/models/_projects/zeroex/zeroex_native_trades.sql index 506e7e49e59..3a2195e6c62 100644 --- a/models/zeroex/zeroex_native_trades.sql +++ b/dex/models/_projects/zeroex/zeroex_native_trades.sql @@ -1,4 +1,5 @@ {{ config( + schema = 'zeroex', alias = 'native_trades', post_hook='{{ expose_spells(\'["ethereum","arbitrum", "optimism", "polygon","bnb"]\', "project", diff --git a/models/zeroex/zeroex_schema.yml b/dex/models/_projects/zeroex/zeroex_schema.yml similarity index 100% rename from models/zeroex/zeroex_schema.yml rename to dex/models/_projects/zeroex/zeroex_schema.yml diff --git a/models/zeroex/zeroex_trades.sql b/dex/models/_projects/zeroex/zeroex_trades.sql similarity index 100% rename from models/zeroex/zeroex_trades.sql rename to dex/models/_projects/zeroex/zeroex_trades.sql diff --git a/models/_project/zigzag/zigzag_trades.sql b/dex/models/_projects/zigzag/zigzag_trades.sql similarity index 100% rename from models/_project/zigzag/zigzag_trades.sql rename to dex/models/_projects/zigzag/zigzag_trades.sql diff --git a/models/_project/zipswap/zipswap_trades.sql b/dex/models/_projects/zipswap/zipswap_trades.sql similarity index 100% rename from models/_project/zipswap/zipswap_trades.sql rename to dex/models/_projects/zipswap/zipswap_trades.sql diff --git a/dex/models/_schema.yml b/dex/models/_schema.yml new file mode 100644 index 00000000000..bc3e8e18c38 --- /dev/null +++ b/dex/models/_schema.yml @@ -0,0 +1,25 @@ +version: 2 + +models: + - name: dex_info + meta: + blockchain: ethereum, polygon, bnb, avalanche_c, gnosis, optimism, arbitrum, fantom, goerli, solana + sector: dex + contributors: hildobby + config: + tags: ['dex', 'ethereum', 'polygon', 'bnb', 'avalanche_c', 'gnosis', 'optimism', 'arbitrum', 'fantom', 'goerli', 'solana', 'info'] + description: > + DEXs info + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - project + columns: + - name: project + description: "Marketplace codename" + - name: name + description: "Marketplace capitalised name" + - name: marketplace_type + description: "Type of marketplace" + - name: x_username + description: "Username on X" \ No newline at end of file diff --git a/dex/models/addresses/_schema.yml b/dex/models/addresses/_schema.yml new file mode 100644 index 00000000000..d08bd08ef03 --- /dev/null +++ b/dex/models/addresses/_schema.yml @@ -0,0 +1,147 @@ +version: 2 + +models: + - name: dex_addresses + meta: + blockchain: arbitrum, base, bnb, ethereum, optimism, polygon + sector: dex + project: addresses + contributors: rantum + config: + tags: ['table', 'dex', 'addresses', 'arbitrum', 'base', 'bnb', 'ethereum', 'optimism', 'polygon'] + description: "Known decentralised exchange addresses" + columns: + - name: blockchain + description: "Name of blockchain" + - name: address + description: "Address of known DEX" + - name: dex_name + description: "Name of decentralised exchange" + - name: distinct_name + description: "Distinct name of decentralised exchange address" + + - name: dex_arbitrum_addresses + meta: + blockchain: arbitrum + sector: dex + project: addresses + contributors: rantum + config: + tags: ['table', 'dex', 'addresses', 'arbitrum'] + description: "Known decentralised exchange addresses" + columns: + - name: blockchain + description: "Name of blockchain" + - name: address + description: "Address of known DEX" + tests: + - unique + - name: dex_name + description: "Name of decentralised exchange" + - name: distinct_name + description: "Distinct name of decentralised exchange address" + + - name: dex_base_addresses + meta: + blockchain: base + sector: dex + project: addresses + contributors: rantum + config: + tags: ['table', 'dex', 'addresses', 'base'] + description: "Known decentralised exchange addresses" + columns: + - name: blockchain + description: "Name of blockchain" + - name: address + description: "Address of known DEX" + tests: + - unique + - name: dex_name + description: "Name of decentralised exchange" + - name: distinct_name + description: "Distinct name of decentralised exchange address" + + - name: dex_bnb_addresses + meta: + blockchain: bnb + sector: dex + project: addresses + contributors: rantum + config: + tags: ['table', 'dex', 'addresses', 'bnb'] + description: "Known decentralised exchange addresses" + columns: + - name: blockchain + description: "Name of blockchain" + - name: address + description: "Address of known DEX" + tests: + - unique + - name: dex_name + description: "Name of decentralised exchange" + - name: distinct_name + description: "Distinct name of decentralised exchange address" + + - name: dex_ethereum_addresses + meta: + blockchain: ethereum + sector: dex + project: addresses + contributors: soispoke, rantum + config: + tags: ['table', 'dex', 'addresses', 'ethereum'] + description: "Known decentralised exchange addresses" + columns: + - name: blockchain + description: "Name of blockchain" + - name: address + description: "Address of known DEX" + tests: + - unique + - name: dex_name + description: "Name of decentralised exchange" + - name: distinct_name + description: "Distinct name of decentralised exchange address" + + - name: dex_optimism_addresses + meta: + blockchain: optimism + sector: dex + project: addresses + contributors: rantum + config: + tags: ['table', 'dex', 'addresses', 'optimism'] + description: "Known decentralised exchange addresses" + columns: + - name: blockchain + description: "Name of blockchain" + - name: address + description: "Address of known DEX" + tests: + - unique + - name: dex_name + description: "Name of decentralised exchange" + - name: distinct_name + description: "Distinct name of decentralised exchange address" + + - name: dex_polygon_addresses + meta: + blockchain: polygon + sector: dex + project: addresses + contributors: rantum + config: + tags: ['table', 'dex', 'addresses', 'polygon'] + description: "Known decentralised exchange addresses" + columns: + - name: blockchain + description: "Name of blockchain" + - name: address + description: "Address of known DEX" + tests: + - unique + - name: dex_name + description: "Name of decentralised exchange" + - name: distinct_name + description: "Distinct name of decentralised exchange address" \ No newline at end of file diff --git a/models/dex/arbitrum/dex_arbitrum_addresses.sql b/dex/models/addresses/arbitrum/dex_arbitrum_addresses.sql similarity index 100% rename from models/dex/arbitrum/dex_arbitrum_addresses.sql rename to dex/models/addresses/arbitrum/dex_arbitrum_addresses.sql diff --git a/models/dex/base/dex_base_addresses.sql b/dex/models/addresses/base/dex_base_addresses.sql similarity index 100% rename from models/dex/base/dex_base_addresses.sql rename to dex/models/addresses/base/dex_base_addresses.sql diff --git a/models/dex/bnb/dex_bnb_addresses.sql b/dex/models/addresses/bnb/dex_bnb_addresses.sql similarity index 100% rename from models/dex/bnb/dex_bnb_addresses.sql rename to dex/models/addresses/bnb/dex_bnb_addresses.sql diff --git a/models/dex/dex_addresses.sql b/dex/models/addresses/dex_addresses.sql similarity index 100% rename from models/dex/dex_addresses.sql rename to dex/models/addresses/dex_addresses.sql diff --git a/models/dex/ethereum/dex_ethereum_addresses.sql b/dex/models/addresses/ethereum/dex_ethereum_addresses.sql similarity index 100% rename from models/dex/ethereum/dex_ethereum_addresses.sql rename to dex/models/addresses/ethereum/dex_ethereum_addresses.sql diff --git a/models/dex/optimism/dex_optimism_addresses.sql b/dex/models/addresses/optimism/dex_optimism_addresses.sql similarity index 100% rename from models/dex/optimism/dex_optimism_addresses.sql rename to dex/models/addresses/optimism/dex_optimism_addresses.sql diff --git a/models/dex/polygon/dex_polygon_addresses.sql b/dex/models/addresses/polygon/dex_polygon_addresses.sql similarity index 100% rename from models/dex/polygon/dex_polygon_addresses.sql rename to dex/models/addresses/polygon/dex_polygon_addresses.sql diff --git a/dex/models/aggregator_trades/_schema.yml b/dex/models/aggregator_trades/_schema.yml new file mode 100644 index 00000000000..a645c9a4b7e --- /dev/null +++ b/dex/models/aggregator_trades/_schema.yml @@ -0,0 +1,94 @@ +version: 2 + +models: + - name: dex_aggregator_trades + meta: + blockchain: ethereum, gnosis, avalanche_c, fantom, optimism, arbitrum, bnb + sector: dex_aggregator + contributors: bh2smith, Henrystats, jeff-dude, rantum + config: + tags: ['ethereum', 'gnosis', 'avalanche_c', 'fantom', 'aggregator', 'dex', 'trades', 'cross-chain'] + description: > + Aggregator trades on all chains across all contracts and versions + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - block_date + - blockchain + - project + - version + - tx_hash + - evt_index + - trace_address + columns: + - &blockchain + name: blockchain + description: "Blockchain which the DEX is deployed" + - &project + name: project + description: "Project name of the DEX" + - &version + name: version + description: "Version of the contract built and deployed by the DEX project" + - &block_date + name: block_date + description: "UTC event block date of each DEX trade" + - &block_time + name: block_time + description: "UTC event block time of each DEX trade" + - &token_bought_symbol + name: token_bought_symbol + description: "Token symbol for token bought in the trade" + - &token_sold_symbol + name: token_sold_symbol + description: "Token symbol for token sold in the trade" + - &token_pair + name: token_pair + description: "Token symbol pair for each token involved in the trade" + - &token_bought_amount + name: token_bought_amount + description: "Value of the token bought at time of execution in the original currency" + - &token_sold_amount + name: token_sold_amount + description: "Value of the token sold at time of execution in the original currency" + - &token_bought_amount_raw + name: token_bought_amount_raw + description: "Raw value of the token bought at time of execution in the original currency" + - &token_sold_amount_raw + name: token_sold_amount_raw + description: "Raw value of the token sold at time of execution in the original currency" + - &amount_usd + name: amount_usd + description: "USD value of the trade at time of execution" + tests: + - dbt_utils.accepted_range: + max_value: 1000000000 # $1b is an arbitrary number, intended to flag outlier amounts early + - &token_bought_address + name: token_bought_address + description: "Contract address of the token bought" + - &token_sold_address + name: token_sold_address + description: "Contract address of the token sold" + - &taker + name: taker + description: "Address of trader who purchased a token" + - &maker + name: maker + description: "Address of trader who sold a token" + - &project_contract_address + name: project_contract_address + description: "Project contract address which executed the trade on the blockchain" + - &tx_hash + name: tx_hash + description: "Unique transaction hash value tied to each transaction on the DEX" + - &tx_from + name: tx_from + description: "Address which initiated the trade" + - &tx_to + name: tx_to + description: "Address which received the trade" + - &trace_address + name: trace_address + - &evt_index + name: evt_index + description: "Index of the corresponding trade event" \ No newline at end of file diff --git a/models/dex/dex_aggregator_trades.sql b/dex/models/aggregator_trades/dex_aggregator_trades.sql similarity index 100% rename from models/dex/dex_aggregator_trades.sql rename to dex/models/aggregator_trades/dex_aggregator_trades.sql diff --git a/dex/models/arbitrages/_schema.yml b/dex/models/arbitrages/_schema.yml new file mode 100644 index 00000000000..c7e50740644 --- /dev/null +++ b/dex/models/arbitrages/_schema.yml @@ -0,0 +1,655 @@ +version: 2 + +models: + - name: dex_atomic_arbitrages + meta: + blockchain: ethereum, bnb, avalanche_c, gnosis, optimism, arbitrum, fantom, polygon, base, celo, zksync, scroll, zora + sector: dex + contributors: hildobby + config: + tags: ['dex', 'mev', 'atomic', 'arbitrages'] + description: > + DEX MEV Arbitrage Trades across all Chains + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - blockchain + - tx_hash + - project_contract_address + - evt_index + columns: + - &blockchain + name: blockchain + description: "Blockchain which the DEX is deployed" + - &project + name: project + description: "Project name of the DEX" + - &version + name: version + description: "Version of the contract built and deployed by the DEX project" + - &block_time + name: block_time + description: "UTC event block time of each DEX trade" + - &block_month + name: block_month + description: "Month corresponding to the prices data" + - &block_number + name: block_number + description: "the block number of the block that the offer was created in" + - &token_sold_address + name: token_sold_address + description: "Contract address of the token sold" + - &token_bought_address + name: token_bought_address + description: "Contract address of the token bought" + - &token_sold_symbol + name: token_sold_symbol + description: "Token symbol for token sold in the trade" + - &token_bought_symbol + name: token_bought_symbol + description: "Token symbol for token bought in the trade" + - &maker + name: maker + description: "Address of trader who sold a token" + - &taker + name: taker + description: "Address of trader who purchased a token" + - &tx_hash + name: tx_hash + description: "Unique transaction hash value tied to each transaction on the DEX" + - &tx_from + name: tx_from + description: "Address which initiated the trade" + - &tx_to + name: tx_to + description: "Address which received the trade" + - &project_contract_address + name: project_contract_address + description: "Project contract address which executed the trade on the blockchain" + - &trace_address + name: trace_address + - &token_pair + name: token_pair + description: "Token symbol pair for each token involved in the trade" + - &tx_index + name: tx_index + description: "the transaction index of the transaction that the offer was created in" + - &token_sold_amount_raw + name: token_sold_amount_raw + description: "Raw value of the token sold at time of execution in the original currency" + - &token_bought_amount_raw + name: token_bought_amount_raw + description: "Raw value of the token bought at time of execution in the original currency" + - &token_sold_amount + name: token_sold_amount + description: "Value of the token sold at time of execution in the original currency" + - &token_bought_amount + name: token_bought_amount + description: "Value of the token bought at time of execution in the original currency" + - &amount_usd + name: amount_usd + description: "USD value of the trade at time of execution" + - &evt_index + name: evt_index + description: "Index of the corresponding trade event" + + - name: dex_ethereum_atomic_arbitrages + meta: + blockchain: ethereum + sector: dex + contributors: hildobby + config: + tags: ['dex', 'mev', 'atomic', 'arbitrages', 'ethereum'] + description: > + DEX MEV Arbitrage Trades on Ethereum + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - blockchain + - tx_hash + - project_contract_address + - evt_index + columns: + - *blockchain + - *project + - *version + - *block_time + - *block_month + - *block_number + - *token_sold_address + - *token_bought_address + - *token_sold_symbol + - *token_bought_symbol + - *maker + - *taker + - *tx_hash + - *tx_from + - *tx_to + - *project_contract_address + - *trace_address + - *token_pair + - *tx_index + - *token_sold_amount_raw + - *token_bought_amount_raw + - *token_sold_amount + - *token_bought_amount + - *amount_usd + - *evt_index + + - name: dex_arbitrum_atomic_arbitrages + meta: + blockchain: arbitrum + sector: dex + contributors: hildobby + config: + tags: ['dex', 'mev', 'atomic', 'arbitrages', 'arbitrum'] + description: > + DEX MEV Arbitrage Trades on Arbitrum + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - blockchain + - tx_hash + - project_contract_address + - evt_index + columns: + - *blockchain + - *project + - *version + - *block_time + - *block_month + - *block_number + - *token_sold_address + - *token_bought_address + - *token_sold_symbol + - *token_bought_symbol + - *maker + - *taker + - *tx_hash + - *tx_from + - *tx_to + - *project_contract_address + - *trace_address + - *token_pair + - *tx_index + - *token_sold_amount_raw + - *token_bought_amount_raw + - *token_sold_amount + - *token_bought_amount + - *amount_usd + - *evt_index + + - name: dex_avalanche_c_atomic_arbitrages + meta: + blockchain: avalanche_c + sector: dex + contributors: hildobby + config: + tags: ['dex', 'mev', 'atomic', 'arbitrages', 'avalanche_c'] + description: > + DEX MEV Arbitrage Trades on Avalanche + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - blockchain + - tx_hash + - project_contract_address + - evt_index + columns: + - *blockchain + - *project + - *version + - *block_time + - *block_month + - *block_number + - *token_sold_address + - *token_bought_address + - *token_sold_symbol + - *token_bought_symbol + - *maker + - *taker + - *tx_hash + - *tx_from + - *tx_to + - *project_contract_address + - *trace_address + - *token_pair + - *tx_index + - *token_sold_amount_raw + - *token_bought_amount_raw + - *token_sold_amount + - *token_bought_amount + - *amount_usd + - *evt_index + + - name: dex_bnb_atomic_arbitrages + meta: + blockchain: bnb + sector: dex + contributors: hildobby + config: + tags: ['dex', 'mev', 'atomic', 'arbitrages', 'bnb'] + description: > + DEX MEV Arbitrage Trades on BNB + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - blockchain + - tx_hash + - project_contract_address + - evt_index + columns: + - *blockchain + - *project + - *version + - *block_time + - *block_month + - *block_number + - *token_sold_address + - *token_bought_address + - *token_sold_symbol + - *token_bought_symbol + - *maker + - *taker + - *tx_hash + - *tx_from + - *tx_to + - *project_contract_address + - *trace_address + - *token_pair + - *tx_index + - *token_sold_amount_raw + - *token_bought_amount_raw + - *token_sold_amount + - *token_bought_amount + - *amount_usd + - *evt_index + + - name: dex_fantom_atomic_arbitrages + meta: + blockchain: fantom + sector: dex + contributors: hildobby + config: + tags: ['dex', 'mev', 'atomic', 'arbitrages', 'fantom'] + description: > + DEX MEV Arbitrage Trades on Fantom + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - blockchain + - tx_hash + - project_contract_address + - evt_index + columns: + - *blockchain + - *project + - *version + - *block_time + - *block_month + - *block_number + - *token_sold_address + - *token_bought_address + - *token_sold_symbol + - *token_bought_symbol + - *maker + - *taker + - *tx_hash + - *tx_from + - *tx_to + - *project_contract_address + - *trace_address + - *token_pair + - *tx_index + - *token_sold_amount_raw + - *token_bought_amount_raw + - *token_sold_amount + - *token_bought_amount + - *amount_usd + - *evt_index + + - name: dex_gnosis_atomic_arbitrages + meta: + blockchain: gnosis + sector: dex + contributors: hildobby + config: + tags: ['dex', 'mev', 'atomic', 'arbitrages', 'gnosis'] + description: > + DEX MEV Arbitrage Trades on Gnosis + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - blockchain + - tx_hash + - project_contract_address + - evt_index + columns: + - *blockchain + - *project + - *version + - *block_time + - *block_month + - *block_number + - *token_sold_address + - *token_bought_address + - *token_sold_symbol + - *token_bought_symbol + - *maker + - *taker + - *tx_hash + - *tx_from + - *tx_to + - *project_contract_address + - *trace_address + - *token_pair + - *tx_index + - *token_sold_amount_raw + - *token_bought_amount_raw + - *token_sold_amount + - *token_bought_amount + - *amount_usd + - *evt_index + + - name: dex_optimism_atomic_arbitrages + meta: + blockchain: optimism + sector: dex + contributors: hildobby + config: + tags: ['dex', 'mev', 'atomic', 'arbitrages', 'optimism'] + description: > + DEX MEV Arbitrage Trades on Optimism + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - blockchain + - tx_hash + - project_contract_address + - evt_index + columns: + - *blockchain + - *project + - *version + - *block_time + - *block_month + - *block_number + - *token_sold_address + - *token_bought_address + - *token_sold_symbol + - *token_bought_symbol + - *maker + - *taker + - *tx_hash + - *tx_from + - *tx_to + - *project_contract_address + - *trace_address + - *token_pair + - *tx_index + - *token_sold_amount_raw + - *token_bought_amount_raw + - *token_sold_amount + - *token_bought_amount + - *amount_usd + - *evt_index + + - name: dex_polygon_atomic_arbitrages + meta: + blockchain: polygon + sector: dex + contributors: hildobby + config: + tags: ['dex', 'mev', 'atomic', 'arbitrages', 'polygon'] + description: > + DEX MEV Arbitrage Trades on Polygon + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - blockchain + - tx_hash + - project_contract_address + - evt_index + columns: + - *blockchain + - *project + - *version + - *block_time + - *block_month + - *block_number + - *token_sold_address + - *token_bought_address + - *token_sold_symbol + - *token_bought_symbol + - *maker + - *taker + - *tx_hash + - *tx_from + - *tx_to + - *project_contract_address + - *trace_address + - *token_pair + - *tx_index + - *token_sold_amount_raw + - *token_bought_amount_raw + - *token_sold_amount + - *token_bought_amount + - *amount_usd + - *evt_index + + - name: dex_base_atomic_arbitrages + meta: + blockchain: base + sector: dex + contributors: hildobby + config: + tags: ['dex', 'mev', 'atomic', 'arbitrages', 'base'] + description: > + DEX MEV Arbitrage Trades on Base + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - blockchain + - tx_hash + - project_contract_address + - evt_index + columns: + - *blockchain + - *project + - *version + - *block_time + - *block_month + - *block_number + - *token_sold_address + - *token_bought_address + - *token_sold_symbol + - *token_bought_symbol + - *maker + - *taker + - *tx_hash + - *tx_from + - *tx_to + - *project_contract_address + - *trace_address + - *token_pair + - *tx_index + - *token_sold_amount_raw + - *token_bought_amount_raw + - *token_sold_amount + - *token_bought_amount + - *amount_usd + - *evt_index + + - name: dex_celo_atomic_arbitrages + meta: + blockchain: celo + sector: dex + contributors: hildobby + config: + tags: ['dex', 'mev', 'atomic', 'arbitrages', 'celo'] + description: > + DEX MEV Arbitrage Trades on Celo + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - blockchain + - tx_hash + - project_contract_address + - evt_index + columns: + - *blockchain + - *project + - *version + - *block_time + - *block_month + - *block_number + - *token_sold_address + - *token_bought_address + - *token_sold_symbol + - *token_bought_symbol + - *maker + - *taker + - *tx_hash + - *tx_from + - *tx_to + - *project_contract_address + - *trace_address + - *token_pair + - *tx_index + - *token_sold_amount_raw + - *token_bought_amount_raw + - *token_sold_amount + - *token_bought_amount + - *amount_usd + - *evt_index + + - name: dex_zksync_atomic_arbitrages + meta: + blockchain: zksync + sector: dex + contributors: hildobby + config: + tags: ['dex', 'mev', 'atomic', 'arbitrages', 'zksync'] + description: > + DEX MEV Arbitrage Trades on zkSync + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - blockchain + - tx_hash + - project_contract_address + - evt_index + columns: + - *blockchain + - *project + - *version + - *block_time + - *block_month + - *block_number + - *token_sold_address + - *token_bought_address + - *token_sold_symbol + - *token_bought_symbol + - *maker + - *taker + - *tx_hash + - *tx_from + - *tx_to + - *project_contract_address + - *trace_address + - *token_pair + - *tx_index + - *token_sold_amount_raw + - *token_bought_amount_raw + - *token_sold_amount + - *token_bought_amount + - *amount_usd + - *evt_index + + - name: dex_scroll_atomic_arbitrages + meta: + blockchain: scroll + sector: dex + contributors: hildobby + config: + tags: ['dex', 'mev', 'atomic', 'arbitrages', 'scroll'] + description: > + DEX MEV Arbitrage Trades on zkSScrollync + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - blockchain + - tx_hash + - project_contract_address + - evt_index + columns: + - *blockchain + - *project + - *version + - *block_time + - *block_month + - *block_number + - *token_sold_address + - *token_bought_address + - *token_sold_symbol + - *token_bought_symbol + - *maker + - *taker + - *tx_hash + - *tx_from + - *tx_to + - *project_contract_address + - *trace_address + - *token_pair + - *tx_index + - *token_sold_amount_raw + - *token_bought_amount_raw + - *token_sold_amount + - *token_bought_amount + - *amount_usd + - *evt_index + + + - name: dex_zora_atomic_arbitrages + meta: + blockchain: zora + sector: dex + contributors: hildobby + config: + tags: ['dex', 'mev', 'atomic', 'arbitrages', 'zora'] + description: > + DEX MEV Arbitrage Trades on Zora Network + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - blockchain + - tx_hash + - project_contract_address + - evt_index + columns: + - *blockchain + - *project + - *version + - *block_time + - *block_month + - *block_number + - *token_sold_address + - *token_bought_address + - *token_sold_symbol + - *token_bought_symbol + - *maker + - *taker + - *tx_hash + - *tx_from + - *tx_to + - *project_contract_address + - *trace_address + - *token_pair + - *tx_index + - *token_sold_amount_raw + - *token_bought_amount_raw + - *token_sold_amount + - *token_bought_amount + - *amount_usd + - *evt_index + diff --git a/models/dex/chains/mev/arbitrages/dex_arbitrum_atomic_arbitrages.sql b/dex/models/arbitrages/arbitrum/dex_arbitrum_atomic_arbitrages.sql similarity index 100% rename from models/dex/chains/mev/arbitrages/dex_arbitrum_atomic_arbitrages.sql rename to dex/models/arbitrages/arbitrum/dex_arbitrum_atomic_arbitrages.sql diff --git a/models/dex/chains/mev/arbitrages/dex_avalanche_c_atomic_arbitrages.sql b/dex/models/arbitrages/avalanche_c/dex_avalanche_c_atomic_arbitrages.sql similarity index 100% rename from models/dex/chains/mev/arbitrages/dex_avalanche_c_atomic_arbitrages.sql rename to dex/models/arbitrages/avalanche_c/dex_avalanche_c_atomic_arbitrages.sql diff --git a/models/dex/chains/mev/arbitrages/dex_base_atomic_arbitrages.sql b/dex/models/arbitrages/base/dex_base_atomic_arbitrages.sql similarity index 100% rename from models/dex/chains/mev/arbitrages/dex_base_atomic_arbitrages.sql rename to dex/models/arbitrages/base/dex_base_atomic_arbitrages.sql diff --git a/models/dex/chains/mev/arbitrages/dex_bnb_atomic_arbitrages.sql b/dex/models/arbitrages/bnb/dex_bnb_atomic_arbitrages.sql similarity index 100% rename from models/dex/chains/mev/arbitrages/dex_bnb_atomic_arbitrages.sql rename to dex/models/arbitrages/bnb/dex_bnb_atomic_arbitrages.sql diff --git a/models/dex/chains/mev/arbitrages/dex_celo_atomic_arbitrages.sql b/dex/models/arbitrages/celo/dex_celo_atomic_arbitrages.sql similarity index 100% rename from models/dex/chains/mev/arbitrages/dex_celo_atomic_arbitrages.sql rename to dex/models/arbitrages/celo/dex_celo_atomic_arbitrages.sql diff --git a/models/dex/dex_atomic_arbitrages.sql b/dex/models/arbitrages/dex_atomic_arbitrages.sql similarity index 100% rename from models/dex/dex_atomic_arbitrages.sql rename to dex/models/arbitrages/dex_atomic_arbitrages.sql diff --git a/models/dex/chains/mev/arbitrages/dex_ethereum_atomic_arbitrages.sql b/dex/models/arbitrages/ethereum/dex_ethereum_atomic_arbitrages.sql similarity index 100% rename from models/dex/chains/mev/arbitrages/dex_ethereum_atomic_arbitrages.sql rename to dex/models/arbitrages/ethereum/dex_ethereum_atomic_arbitrages.sql diff --git a/models/dex/chains/mev/arbitrages/dex_fantom_atomic_arbitrages.sql b/dex/models/arbitrages/fantom/dex_fantom_atomic_arbitrages.sql similarity index 100% rename from models/dex/chains/mev/arbitrages/dex_fantom_atomic_arbitrages.sql rename to dex/models/arbitrages/fantom/dex_fantom_atomic_arbitrages.sql diff --git a/models/dex/chains/mev/arbitrages/dex_gnosis_atomic_arbitrages.sql b/dex/models/arbitrages/gnosis/dex_gnosis_atomic_arbitrages.sql similarity index 100% rename from models/dex/chains/mev/arbitrages/dex_gnosis_atomic_arbitrages.sql rename to dex/models/arbitrages/gnosis/dex_gnosis_atomic_arbitrages.sql diff --git a/models/dex/chains/mev/arbitrages/dex_optimism_atomic_arbitrages.sql b/dex/models/arbitrages/optimism/dex_optimism_atomic_arbitrages.sql similarity index 100% rename from models/dex/chains/mev/arbitrages/dex_optimism_atomic_arbitrages.sql rename to dex/models/arbitrages/optimism/dex_optimism_atomic_arbitrages.sql diff --git a/models/dex/chains/mev/arbitrages/dex_polygon_atomic_arbitrages.sql b/dex/models/arbitrages/polygon/dex_polygon_atomic_arbitrages.sql similarity index 100% rename from models/dex/chains/mev/arbitrages/dex_polygon_atomic_arbitrages.sql rename to dex/models/arbitrages/polygon/dex_polygon_atomic_arbitrages.sql diff --git a/models/dex/chains/mev/arbitrages/dex_scroll_atomic_arbitrages.sql b/dex/models/arbitrages/scroll/dex_scroll_atomic_arbitrages.sql similarity index 100% rename from models/dex/chains/mev/arbitrages/dex_scroll_atomic_arbitrages.sql rename to dex/models/arbitrages/scroll/dex_scroll_atomic_arbitrages.sql diff --git a/models/dex/chains/mev/arbitrages/dex_zksync_atomic_arbitrages.sql b/dex/models/arbitrages/zksync/dex_zksync_atomic_arbitrages.sql similarity index 100% rename from models/dex/chains/mev/arbitrages/dex_zksync_atomic_arbitrages.sql rename to dex/models/arbitrages/zksync/dex_zksync_atomic_arbitrages.sql diff --git a/models/dex/chains/mev/arbitrages/dex_zora_atomic_arbitrages.sql b/dex/models/arbitrages/zora/dex_zora_atomic_arbitrages.sql similarity index 100% rename from models/dex/chains/mev/arbitrages/dex_zora_atomic_arbitrages.sql rename to dex/models/arbitrages/zora/dex_zora_atomic_arbitrages.sql diff --git a/models/dex/dex_info.sql b/dex/models/dex_info.sql similarity index 100% rename from models/dex/dex_info.sql rename to dex/models/dex_info.sql diff --git a/dex/models/pools/_schema.yml b/dex/models/pools/_schema.yml new file mode 100644 index 00000000000..2509126abe0 --- /dev/null +++ b/dex/models/pools/_schema.yml @@ -0,0 +1,138 @@ +version: 2 + +models: + - name: dex_raw_pool_initializations + meta: + blockchain: ethereum, polygon, bnb, avalanche_c, gnosis, fantom, optimism, arbitrum, celo, base, zksync, zora + sector: dex + contributors: grkhr + config: + tags: ['dex', 'cross-chain', 'pools'] + description: > + DEX raw pools initialization calls + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - blockchain + - pool + - tx_hash + - call_trace_address + columns: + - &blockchain + name: blockchain + description: "Blockchain which the DEX is deployed" + - &type + name: type + description: "Pool implementation standard" + - &version + name: version + description: "Version of the contract built and deployed by the DEX project" + - &block_time + name: block_time + description: "UTC event block time of each DEX trade" + - &pool + name: pool + description: "DEX pool smart contract address" + - &token0 + name: token0 + description: "First token in pool" + - &token1 + name: token1 + description: "Second token in pool" + - &tx_hash + name: tx_hash + description: "Unique transaction hash value tied to each transaction on the DEX" + - &call_trace_address + name: call_trace_address + + - name: dex_raw_pool_creations + meta: + blockchain: ethereum, polygon, bnb, avalanche_c, gnosis, fantom, optimism, arbitrum, celo, base, zksync, zora + sector: dex + contributors: grkhr + config: + tags: ['dex', 'cross-chain', 'pools'] + description: > + DEX raw pools on all chains across all contracts and versions parsed from logs + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - blockchain + - pool + columns: + - *blockchain + - *type + - *version + - *pool + - *token0 + - *token1 + - &tokens + name: tokens + description: "Tokens in the pool" + - &creation_block_time + name: creation_block_time + description: "Block time of pool creation" + - &creation_block_number + name: creation_block_number + description: "Block number of pool creation" + - name: contract_address + description: "Contract address used to create the pool" + - name: rn + + - name: dex_raw_pools + meta: + blockchain: ethereum, polygon, bnb, avalanche_c, gnosis, fantom, optimism, arbitrum, celo, base, zksync, zora + sector: dex + contributors: grkhr + config: + tags: ['dex', 'cross-chain', 'pools'] + description: > + DEX raw pools on all chains across all contracts and versions parsed from logs + filtered degen pools + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - blockchain + - pool + columns: + - *blockchain + - *type + - *version + - *pool + - *token0 + - *token1 + - *tokens + - *creation_block_time + - *creation_block_number + - name: contract_address + description: "Contract address used to create the pool" + + - name: dex_pools + meta: + blockchain: ethereum, arbitrum, polygon + sector: dex + contributors: hildobby + config: + tags: ['ethereum', 'arbitrum', 'polygon', 'dex', 'cross-chain', 'pools'] + description: > + DEX pools on all chains across all contracts and versions + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - blockchain + - pool + columns: + - *blockchain + - &project + name: project + description: "Project name of the DEX" + - *version + - *pool + - &fee + name: fee + description: "Defined fee" + - *token0 + - *token1 + - *creation_block_time + - *creation_block_number + - name: contract_address + description: "Contract address used to create the pool" \ No newline at end of file diff --git a/models/dex/dex_pools.sql b/dex/models/pools/dex_pools.sql similarity index 98% rename from models/dex/dex_pools.sql rename to dex/models/pools/dex_pools.sql index ffb0bf62d44..0a23f9543c5 100644 --- a/models/dex/dex_pools.sql +++ b/dex/models/pools/dex_pools.sql @@ -1,5 +1,5 @@ {{ config( - + schema = 'dex', alias = 'pools', materialized = 'incremental', file_format = 'delta', diff --git a/models/dex/dex_raw_pool_creations.sql b/dex/models/pools/dex_raw_pool_creations.sql similarity index 100% rename from models/dex/dex_raw_pool_creations.sql rename to dex/models/pools/dex_raw_pool_creations.sql diff --git a/models/dex/dex_raw_pool_initializations.sql b/dex/models/pools/dex_raw_pool_initializations.sql similarity index 100% rename from models/dex/dex_raw_pool_initializations.sql rename to dex/models/pools/dex_raw_pool_initializations.sql diff --git a/models/dex/dex_raw_pools.sql b/dex/models/pools/dex_raw_pools.sql similarity index 100% rename from models/dex/dex_raw_pools.sql rename to dex/models/pools/dex_raw_pools.sql diff --git a/dex/models/prices/_schema.yml b/dex/models/prices/_schema.yml new file mode 100644 index 00000000000..57110aa8aca --- /dev/null +++ b/dex/models/prices/_schema.yml @@ -0,0 +1,37 @@ +version: 2 + +models: + - name: dex_prices + meta: + blockchain: ethereum, bnb, avalanche_c, gnosis, optimism, arbitrum, fantom + sector: dex + contributors: Henrystats + config: + tags: ['ethereum', 'polygon', 'arbitrum', 'optimism', 'gnosis', 'fantom', 'avalanche_c', 'trades', 'dex', 'cross-chain', 'prices'] + description: > + This table loads the prices of tokens from the dex.trades table. This helps for missing tokens from the prices.usd table + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - hour + - blockchain + - contract_address + columns: + - &block_month + name: block_month + description: "Month corresponding to the prices data" + - &hour + name: hour + description: "hour corresponding to the prices data" + - &contract_address + name: contract_address + description: "token's contract address" + - &blockchain + name: blockchain + description: "Blockchain which the DEX is deployed" + - &median_price + name: median_price + description: "Median price of the token in USD within the corresponding hour" + - &sample_size + name: sample_size + description: "Number of times the token was traded within the coressponding hour" \ No newline at end of file diff --git a/models/dex/dex_prices.sql b/dex/models/prices/dex_prices.sql similarity index 99% rename from models/dex/dex_prices.sql rename to dex/models/prices/dex_prices.sql index 794e6ca3aec..5467aeda991 100644 --- a/models/dex/dex_prices.sql +++ b/dex/models/prices/dex_prices.sql @@ -1,5 +1,5 @@ {{ config( - + schema = 'dex', alias = 'prices', partition_by = ['block_month'], materialized = 'incremental', diff --git a/models/dex/dex_prices_latest.sql b/dex/models/prices/dex_prices_latest.sql similarity index 98% rename from models/dex/dex_prices_latest.sql rename to dex/models/prices/dex_prices_latest.sql index b6714778d89..2ebc0591630 100644 --- a/models/dex/dex_prices_latest.sql +++ b/dex/models/prices/dex_prices_latest.sql @@ -1,6 +1,6 @@ {{ config( + schema = 'dex', alias = 'prices_latest', - partition_by = ['block_month'], materialized = 'incremental', file_format = 'delta', diff --git a/models/dex/chains/dex_schema.yml b/dex/models/sandwiches/_schema.yml similarity index 69% rename from models/dex/chains/dex_schema.yml rename to dex/models/sandwiches/_schema.yml index 95afa1bbe88..15bf5b060ae 100644 --- a/models/dex/chains/dex_schema.yml +++ b/dex/models/sandwiches/_schema.yml @@ -1,20 +1,21 @@ version: 2 models: - - name: dex_ethereum_sandwiches + - name: dex_sandwiches meta: - blockchain: ethereum + blockchain: ethereum, bnb, avalanche_c, gnosis, optimism, fantom, arbitrum, celo, zksync, scroll, zora sector: dex contributors: hildobby config: - tags: ['dex', 'mev', 'sandwiches', 'ethereum'] + tags: ['dex', 'mev', 'sandwiches'] description: > - DEX MEV Sandwich Trades on Ethereum + DEX MEV Sandwich Trades across chains tests: - dbt_utils.unique_combination_of_columns: combination_of_columns: - blockchain - tx_hash + - project_contract_address - evt_index columns: - &blockchain @@ -65,14 +66,11 @@ models: - &project_contract_address name: project_contract_address description: "Project contract address which executed the trade on the blockchain" - - &trace_address - name: trace_address - description: "Trace address" - &token_pair name: token_pair description: "Token symbol pair for each token involved in the trade" - - &index - name: index + - &tx_index + name: tx_index description: "Index of the transaction in block" - &token_sold_amount_raw name: token_sold_amount_raw @@ -93,6 +91,88 @@ models: name: evt_index description: "Event index" + - name: dex_sandwiched + meta: + blockchain: ethereum, bnb, avalanche_c, gnosis, optimism, fantom, arbitrum, celo, zksync, scroll, zora + sector: dex + contributors: hildobby + config: + tags: ['dex', 'mev', 'sandwiched'] + description: > + DEX MEV Sandwiched Trades across chains + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - blockchain + - tx_hash + - evt_index + columns: + - *blockchain + - *project + - *version + - *block_time + - *block_month + - *block_number + - *token_sold_address + - *token_bought_address + - *token_sold_symbol + - *token_bought_symbol + - *maker + - *taker + - *tx_hash + - *tx_from + - *tx_to + - *project_contract_address + - *token_pair + - *tx_index + - *token_sold_amount_raw + - *token_bought_amount_raw + - *token_sold_amount + - *token_bought_amount + - *amount_usd + - *evt_index + + - name: dex_ethereum_sandwiches + meta: + blockchain: ethereum + sector: dex + contributors: hildobby + config: + tags: ['dex', 'mev', 'sandwiches', 'ethereum'] + description: > + DEX MEV Sandwich Trades on Ethereum + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - blockchain + - tx_hash + - evt_index + columns: + - *blockchain + - *project + - *version + - *block_time + - *block_month + - *block_number + - *token_sold_address + - *token_bought_address + - *token_sold_symbol + - *token_bought_symbol + - *maker + - *taker + - *tx_hash + - *tx_from + - *tx_to + - *project_contract_address + - *token_pair + - *tx_index + - *token_sold_amount_raw + - *token_bought_amount_raw + - *token_sold_amount + - *token_bought_amount + - *amount_usd + - *evt_index + - name: dex_arbitrum_sandwiches meta: blockchain: arbitrum @@ -125,9 +205,8 @@ models: - *tx_from - *tx_to - *project_contract_address - - *trace_address - *token_pair - - *index + - *tx_index - *token_sold_amount_raw - *token_bought_amount_raw - *token_sold_amount @@ -167,9 +246,8 @@ models: - *tx_from - *tx_to - *project_contract_address - - *trace_address - *token_pair - - *index + - *tx_index - *token_sold_amount_raw - *token_bought_amount_raw - *token_sold_amount @@ -209,9 +287,8 @@ models: - *tx_from - *tx_to - *project_contract_address - - *trace_address - *token_pair - - *index + - *tx_index - *token_sold_amount_raw - *token_bought_amount_raw - *token_sold_amount @@ -251,9 +328,8 @@ models: - *tx_from - *tx_to - *project_contract_address - - *trace_address - *token_pair - - *index + - *tx_index - *token_sold_amount_raw - *token_bought_amount_raw - *token_sold_amount @@ -293,9 +369,8 @@ models: - *tx_from - *tx_to - *project_contract_address - - *trace_address - *token_pair - - *index + - *tx_index - *token_sold_amount_raw - *token_bought_amount_raw - *token_sold_amount @@ -335,9 +410,8 @@ models: - *tx_from - *tx_to - *project_contract_address - - *trace_address - *token_pair - - *index + - *tx_index - *token_sold_amount_raw - *token_bought_amount_raw - *token_sold_amount @@ -377,9 +451,8 @@ models: - *tx_from - *tx_to - *project_contract_address - - *trace_address - *token_pair - - *index + - *tx_index - *token_sold_amount_raw - *token_bought_amount_raw - *token_sold_amount @@ -419,9 +492,8 @@ models: - *tx_from - *tx_to - *project_contract_address - - *trace_address - *token_pair - - *index + - *tx_index - *token_sold_amount_raw - *token_bought_amount_raw - *token_sold_amount @@ -461,9 +533,8 @@ models: - *tx_from - *tx_to - *project_contract_address - - *trace_address - *token_pair - - *index + - *tx_index - *token_sold_amount_raw - *token_bought_amount_raw - *token_sold_amount @@ -503,9 +574,8 @@ models: - *tx_from - *tx_to - *project_contract_address - - *trace_address - *token_pair - - *index + - *tx_index - *token_sold_amount_raw - *token_bought_amount_raw - *token_sold_amount @@ -545,9 +615,8 @@ models: - *tx_from - *tx_to - *project_contract_address - - *trace_address - *token_pair - - *index + - *tx_index - *token_sold_amount_raw - *token_bought_amount_raw - *token_sold_amount @@ -587,9 +656,8 @@ models: - *tx_from - *tx_to - *project_contract_address - - *trace_address - *token_pair - - *index + - *tx_index - *token_sold_amount_raw - *token_bought_amount_raw - *token_sold_amount @@ -629,11 +697,8 @@ models: - *tx_from - *tx_to - *project_contract_address - - *trace_address - *token_pair - - &tx_index - name: tx_index - description: "Index of transaction in block" + - *tx_index - *token_sold_amount_raw - *token_bought_amount_raw - *token_sold_amount @@ -673,7 +738,6 @@ models: - *tx_from - *tx_to - *project_contract_address - - *trace_address - *token_pair - *tx_index - *token_sold_amount_raw @@ -715,7 +779,6 @@ models: - *tx_from - *tx_to - *project_contract_address - - *trace_address - *token_pair - *tx_index - *token_sold_amount_raw @@ -757,7 +820,6 @@ models: - *tx_from - *tx_to - *project_contract_address - - *trace_address - *token_pair - *tx_index - *token_sold_amount_raw @@ -799,7 +861,6 @@ models: - *tx_from - *tx_to - *project_contract_address - - *trace_address - *token_pair - *tx_index - *token_sold_amount_raw @@ -841,7 +902,6 @@ models: - *tx_from - *tx_to - *project_contract_address - - *trace_address - *token_pair - *tx_index - *token_sold_amount_raw @@ -883,7 +943,6 @@ models: - *tx_from - *tx_to - *project_contract_address - - *trace_address - *token_pair - *tx_index - *token_sold_amount_raw @@ -925,7 +984,6 @@ models: - *tx_from - *tx_to - *project_contract_address - - *trace_address - *token_pair - *tx_index - *token_sold_amount_raw @@ -967,7 +1025,6 @@ models: - *tx_from - *tx_to - *project_contract_address - - *trace_address - *token_pair - *tx_index - *token_sold_amount_raw @@ -1009,7 +1066,6 @@ models: - *tx_from - *tx_to - *project_contract_address - - *trace_address - *token_pair - *tx_index - *token_sold_amount_raw @@ -1051,7 +1107,6 @@ models: - *tx_from - *tx_to - *project_contract_address - - *trace_address - *token_pair - *tx_index - *token_sold_amount_raw @@ -1093,7 +1148,6 @@ models: - *tx_from - *tx_to - *project_contract_address - - *trace_address - *token_pair - *tx_index - *token_sold_amount_raw @@ -1135,179 +1189,6 @@ models: - *tx_from - *tx_to - *project_contract_address - - *trace_address - - *token_pair - - *tx_index - - *token_sold_amount_raw - - *token_bought_amount_raw - - *token_sold_amount - - *token_bought_amount - - *amount_usd - - *evt_index - - - name: dex_ethereum_atomic_arbitrages - meta: - blockchain: ethereum - sector: dex - contributors: hildobby - config: - tags: ['dex', 'mev', 'atomic', 'arbitrages', 'ethereum'] - description: > - DEX MEV Arbitrage Trades on Ethereum - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - blockchain - - tx_hash - - project_contract_address - - evt_index - columns: - - *blockchain - - *project - - *version - - *block_time - - *block_month - - *block_number - - *token_sold_address - - *token_bought_address - - *token_sold_symbol - - *token_bought_symbol - - *maker - - *taker - - *tx_hash - - *tx_from - - *tx_to - - *project_contract_address - - *trace_address - - *token_pair - - *tx_index - - *token_sold_amount_raw - - *token_bought_amount_raw - - *token_sold_amount - - *token_bought_amount - - *amount_usd - - *evt_index - - - name: dex_arbitrum_atomic_arbitrages - meta: - blockchain: arbitrum - sector: dex - contributors: hildobby - config: - tags: ['dex', 'mev', 'atomic', 'arbitrages', 'arbitrum'] - description: > - DEX MEV Arbitrage Trades on Arbitrum - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - blockchain - - tx_hash - - project_contract_address - - evt_index - columns: - - *blockchain - - *project - - *version - - *block_time - - *block_month - - *block_number - - *token_sold_address - - *token_bought_address - - *token_sold_symbol - - *token_bought_symbol - - *maker - - *taker - - *tx_hash - - *tx_from - - *tx_to - - *project_contract_address - - *trace_address - - *token_pair - - *tx_index - - *token_sold_amount_raw - - *token_bought_amount_raw - - *token_sold_amount - - *token_bought_amount - - *amount_usd - - *evt_index - - - name: dex_avalanche_c_atomic_arbitrages - meta: - blockchain: avalanche_c - sector: dex - contributors: hildobby - config: - tags: ['dex', 'mev', 'atomic', 'arbitrages', 'avalanche_c'] - description: > - DEX MEV Arbitrage Trades on Avalanche - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - blockchain - - tx_hash - - project_contract_address - - evt_index - columns: - - *blockchain - - *project - - *version - - *block_time - - *block_month - - *block_number - - *token_sold_address - - *token_bought_address - - *token_sold_symbol - - *token_bought_symbol - - *maker - - *taker - - *tx_hash - - *tx_from - - *tx_to - - *project_contract_address - - *trace_address - - *token_pair - - *tx_index - - *token_sold_amount_raw - - *token_bought_amount_raw - - *token_sold_amount - - *token_bought_amount - - *amount_usd - - *evt_index - - - name: dex_bnb_atomic_arbitrages - meta: - blockchain: bnb - sector: dex - contributors: hildobby - config: - tags: ['dex', 'mev', 'atomic', 'arbitrages', 'bnb'] - description: > - DEX MEV Arbitrage Trades on BNB - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - blockchain - - tx_hash - - project_contract_address - - evt_index - columns: - - *blockchain - - *project - - *version - - *block_time - - *block_month - - *block_number - - *token_sold_address - - *token_bought_address - - *token_sold_symbol - - *token_bought_symbol - - *maker - - *taker - - *tx_hash - - *tx_from - - *tx_to - - *project_contract_address - - *trace_address - *token_pair - *tx_index - *token_sold_amount_raw @@ -1315,393 +1196,4 @@ models: - *token_sold_amount - *token_bought_amount - *amount_usd - - *evt_index - - - name: dex_fantom_atomic_arbitrages - meta: - blockchain: fantom - sector: dex - contributors: hildobby - config: - tags: ['dex', 'mev', 'atomic', 'arbitrages', 'fantom'] - description: > - DEX MEV Arbitrage Trades on Fantom - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - blockchain - - tx_hash - - project_contract_address - - evt_index - columns: - - *blockchain - - *project - - *version - - *block_time - - *block_month - - *block_number - - *token_sold_address - - *token_bought_address - - *token_sold_symbol - - *token_bought_symbol - - *maker - - *taker - - *tx_hash - - *tx_from - - *tx_to - - *project_contract_address - - *trace_address - - *token_pair - - *tx_index - - *token_sold_amount_raw - - *token_bought_amount_raw - - *token_sold_amount - - *token_bought_amount - - *amount_usd - - *evt_index - - - name: dex_gnosis_atomic_arbitrages - meta: - blockchain: gnosis - sector: dex - contributors: hildobby - config: - tags: ['dex', 'mev', 'atomic', 'arbitrages', 'gnosis'] - description: > - DEX MEV Arbitrage Trades on Gnosis - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - blockchain - - tx_hash - - project_contract_address - - evt_index - columns: - - *blockchain - - *project - - *version - - *block_time - - *block_month - - *block_number - - *token_sold_address - - *token_bought_address - - *token_sold_symbol - - *token_bought_symbol - - *maker - - *taker - - *tx_hash - - *tx_from - - *tx_to - - *project_contract_address - - *trace_address - - *token_pair - - *tx_index - - *token_sold_amount_raw - - *token_bought_amount_raw - - *token_sold_amount - - *token_bought_amount - - *amount_usd - - *evt_index - - - name: dex_optimism_atomic_arbitrages - meta: - blockchain: optimism - sector: dex - contributors: hildobby - config: - tags: ['dex', 'mev', 'atomic', 'arbitrages', 'optimism'] - description: > - DEX MEV Arbitrage Trades on Optimism - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - blockchain - - tx_hash - - project_contract_address - - evt_index - columns: - - *blockchain - - *project - - *version - - *block_time - - *block_month - - *block_number - - *token_sold_address - - *token_bought_address - - *token_sold_symbol - - *token_bought_symbol - - *maker - - *taker - - *tx_hash - - *tx_from - - *tx_to - - *project_contract_address - - *trace_address - - *token_pair - - *tx_index - - *token_sold_amount_raw - - *token_bought_amount_raw - - *token_sold_amount - - *token_bought_amount - - *amount_usd - - *evt_index - - - name: dex_polygon_atomic_arbitrages - meta: - blockchain: polygon - sector: dex - contributors: hildobby - config: - tags: ['dex', 'mev', 'atomic', 'arbitrages', 'polygon'] - description: > - DEX MEV Arbitrage Trades on Polygon - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - blockchain - - tx_hash - - project_contract_address - - evt_index - columns: - - *blockchain - - *project - - *version - - *block_time - - *block_month - - *block_number - - *token_sold_address - - *token_bought_address - - *token_sold_symbol - - *token_bought_symbol - - *maker - - *taker - - *tx_hash - - *tx_from - - *tx_to - - *project_contract_address - - *trace_address - - *token_pair - - *tx_index - - *token_sold_amount_raw - - *token_bought_amount_raw - - *token_sold_amount - - *token_bought_amount - - *amount_usd - - *evt_index - - - name: dex_base_atomic_arbitrages - meta: - blockchain: base - sector: dex - contributors: hildobby - config: - tags: ['dex', 'mev', 'atomic', 'arbitrages', 'base'] - description: > - DEX MEV Arbitrage Trades on Base - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - blockchain - - tx_hash - - project_contract_address - - evt_index - columns: - - *blockchain - - *project - - *version - - *block_time - - *block_month - - *block_number - - *token_sold_address - - *token_bought_address - - *token_sold_symbol - - *token_bought_symbol - - *maker - - *taker - - *tx_hash - - *tx_from - - *tx_to - - *project_contract_address - - *trace_address - - *token_pair - - *tx_index - - *token_sold_amount_raw - - *token_bought_amount_raw - - *token_sold_amount - - *token_bought_amount - - *amount_usd - - *evt_index - - - name: dex_celo_atomic_arbitrages - meta: - blockchain: celo - sector: dex - contributors: hildobby - config: - tags: ['dex', 'mev', 'atomic', 'arbitrages', 'celo'] - description: > - DEX MEV Arbitrage Trades on Celo - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - blockchain - - tx_hash - - project_contract_address - - evt_index - columns: - - *blockchain - - *project - - *version - - *block_time - - *block_month - - *block_number - - *token_sold_address - - *token_bought_address - - *token_sold_symbol - - *token_bought_symbol - - *maker - - *taker - - *tx_hash - - *tx_from - - *tx_to - - *project_contract_address - - *trace_address - - *token_pair - - *tx_index - - *token_sold_amount_raw - - *token_bought_amount_raw - - *token_sold_amount - - *token_bought_amount - - *amount_usd - - *evt_index - - - name: dex_zksync_atomic_arbitrages - meta: - blockchain: zksync - sector: dex - contributors: hildobby - config: - tags: ['dex', 'mev', 'atomic', 'arbitrages', 'zksync'] - description: > - DEX MEV Arbitrage Trades on zkSync - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - blockchain - - tx_hash - - project_contract_address - - evt_index - columns: - - *blockchain - - *project - - *version - - *block_time - - *block_month - - *block_number - - *token_sold_address - - *token_bought_address - - *token_sold_symbol - - *token_bought_symbol - - *maker - - *taker - - *tx_hash - - *tx_from - - *tx_to - - *project_contract_address - - *trace_address - - *token_pair - - *tx_index - - *token_sold_amount_raw - - *token_bought_amount_raw - - *token_sold_amount - - *token_bought_amount - - *amount_usd - - *evt_index - - - name: dex_scroll_atomic_arbitrages - meta: - blockchain: scroll - sector: dex - contributors: hildobby - config: - tags: ['dex', 'mev', 'atomic', 'arbitrages', 'scroll'] - description: > - DEX MEV Arbitrage Trades on zkSScrollync - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - blockchain - - tx_hash - - project_contract_address - - evt_index - columns: - - *blockchain - - *project - - *version - - *block_time - - *block_month - - *block_number - - *token_sold_address - - *token_bought_address - - *token_sold_symbol - - *token_bought_symbol - - *maker - - *taker - - *tx_hash - - *tx_from - - *tx_to - - *project_contract_address - - *trace_address - - *token_pair - - *tx_index - - *token_sold_amount_raw - - *token_bought_amount_raw - - *token_sold_amount - - *token_bought_amount - - *amount_usd - - *evt_index - - - - name: dex_zora_atomic_arbitrages - meta: - blockchain: zora - sector: dex - contributors: hildobby - config: - tags: ['dex', 'mev', 'atomic', 'arbitrages', 'zora'] - description: > - DEX MEV Arbitrage Trades on Zora Network - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - blockchain - - tx_hash - - project_contract_address - - evt_index - columns: - - *blockchain - - *project - - *version - - *block_time - - *block_month - - *block_number - - *token_sold_address - - *token_bought_address - - *token_sold_symbol - - *token_bought_symbol - - *maker - - *taker - - *tx_hash - - *tx_from - - *tx_to - - *project_contract_address - - *trace_address - - *token_pair - - *tx_index - - *token_sold_amount_raw - - *token_bought_amount_raw - - *token_sold_amount - - *token_bought_amount - - *amount_usd - - *evt_index - + - *evt_index \ No newline at end of file diff --git a/models/dex/chains/mev/sandwiches/dex_arbitrum_sandwiched.sql b/dex/models/sandwiches/arbitrum/dex_arbitrum_sandwiched.sql similarity index 100% rename from models/dex/chains/mev/sandwiches/dex_arbitrum_sandwiched.sql rename to dex/models/sandwiches/arbitrum/dex_arbitrum_sandwiched.sql diff --git a/models/dex/chains/mev/sandwiches/dex_arbitrum_sandwiches.sql b/dex/models/sandwiches/arbitrum/dex_arbitrum_sandwiches.sql similarity index 100% rename from models/dex/chains/mev/sandwiches/dex_arbitrum_sandwiches.sql rename to dex/models/sandwiches/arbitrum/dex_arbitrum_sandwiches.sql diff --git a/models/dex/chains/mev/sandwiches/dex_avalanche_c_sandwiched.sql b/dex/models/sandwiches/avalanche_c/dex_avalanche_c_sandwiched.sql similarity index 100% rename from models/dex/chains/mev/sandwiches/dex_avalanche_c_sandwiched.sql rename to dex/models/sandwiches/avalanche_c/dex_avalanche_c_sandwiched.sql diff --git a/models/dex/chains/mev/sandwiches/dex_avalanche_c_sandwiches.sql b/dex/models/sandwiches/avalanche_c/dex_avalanche_c_sandwiches.sql similarity index 100% rename from models/dex/chains/mev/sandwiches/dex_avalanche_c_sandwiches.sql rename to dex/models/sandwiches/avalanche_c/dex_avalanche_c_sandwiches.sql diff --git a/models/dex/chains/mev/sandwiches/dex_base_sandwiched.sql b/dex/models/sandwiches/base/dex_base_sandwiched.sql similarity index 100% rename from models/dex/chains/mev/sandwiches/dex_base_sandwiched.sql rename to dex/models/sandwiches/base/dex_base_sandwiched.sql diff --git a/models/dex/chains/mev/sandwiches/dex_base_sandwiches.sql b/dex/models/sandwiches/base/dex_base_sandwiches.sql similarity index 100% rename from models/dex/chains/mev/sandwiches/dex_base_sandwiches.sql rename to dex/models/sandwiches/base/dex_base_sandwiches.sql diff --git a/models/dex/chains/mev/sandwiches/dex_bnb_sandwiched.sql b/dex/models/sandwiches/bnb/dex_bnb_sandwiched.sql similarity index 100% rename from models/dex/chains/mev/sandwiches/dex_bnb_sandwiched.sql rename to dex/models/sandwiches/bnb/dex_bnb_sandwiched.sql diff --git a/models/dex/chains/mev/sandwiches/dex_bnb_sandwiches.sql b/dex/models/sandwiches/bnb/dex_bnb_sandwiches.sql similarity index 100% rename from models/dex/chains/mev/sandwiches/dex_bnb_sandwiches.sql rename to dex/models/sandwiches/bnb/dex_bnb_sandwiches.sql diff --git a/models/dex/chains/mev/sandwiches/dex_celo_sandwiched.sql b/dex/models/sandwiches/celo/dex_celo_sandwiched.sql similarity index 100% rename from models/dex/chains/mev/sandwiches/dex_celo_sandwiched.sql rename to dex/models/sandwiches/celo/dex_celo_sandwiched.sql diff --git a/models/dex/chains/mev/sandwiches/dex_celo_sandwiches.sql b/dex/models/sandwiches/celo/dex_celo_sandwiches.sql similarity index 100% rename from models/dex/chains/mev/sandwiches/dex_celo_sandwiches.sql rename to dex/models/sandwiches/celo/dex_celo_sandwiches.sql diff --git a/models/dex/dex_sandwiched.sql b/dex/models/sandwiches/dex_sandwiched.sql similarity index 100% rename from models/dex/dex_sandwiched.sql rename to dex/models/sandwiches/dex_sandwiched.sql diff --git a/models/dex/dex_sandwiches.sql b/dex/models/sandwiches/dex_sandwiches.sql similarity index 100% rename from models/dex/dex_sandwiches.sql rename to dex/models/sandwiches/dex_sandwiches.sql diff --git a/models/dex/chains/mev/sandwiches/dex_ethereum_sandwiched.sql b/dex/models/sandwiches/ethereum/dex_ethereum_sandwiched.sql similarity index 100% rename from models/dex/chains/mev/sandwiches/dex_ethereum_sandwiched.sql rename to dex/models/sandwiches/ethereum/dex_ethereum_sandwiched.sql diff --git a/models/dex/chains/mev/sandwiches/dex_ethereum_sandwiches.sql b/dex/models/sandwiches/ethereum/dex_ethereum_sandwiches.sql similarity index 100% rename from models/dex/chains/mev/sandwiches/dex_ethereum_sandwiches.sql rename to dex/models/sandwiches/ethereum/dex_ethereum_sandwiches.sql diff --git a/models/dex/chains/mev/sandwiches/dex_fantom_sandwiched.sql b/dex/models/sandwiches/fantom/dex_fantom_sandwiched.sql similarity index 100% rename from models/dex/chains/mev/sandwiches/dex_fantom_sandwiched.sql rename to dex/models/sandwiches/fantom/dex_fantom_sandwiched.sql diff --git a/models/dex/chains/mev/sandwiches/dex_fantom_sandwiches.sql b/dex/models/sandwiches/fantom/dex_fantom_sandwiches.sql similarity index 100% rename from models/dex/chains/mev/sandwiches/dex_fantom_sandwiches.sql rename to dex/models/sandwiches/fantom/dex_fantom_sandwiches.sql diff --git a/models/dex/chains/mev/sandwiches/dex_gnosis_sandwiched.sql b/dex/models/sandwiches/gnosis/dex_gnosis_sandwiched.sql similarity index 100% rename from models/dex/chains/mev/sandwiches/dex_gnosis_sandwiched.sql rename to dex/models/sandwiches/gnosis/dex_gnosis_sandwiched.sql diff --git a/models/dex/chains/mev/sandwiches/dex_gnosis_sandwiches.sql b/dex/models/sandwiches/gnosis/dex_gnosis_sandwiches.sql similarity index 100% rename from models/dex/chains/mev/sandwiches/dex_gnosis_sandwiches.sql rename to dex/models/sandwiches/gnosis/dex_gnosis_sandwiches.sql diff --git a/models/dex/chains/mev/sandwiches/dex_optimism_sandwiched.sql b/dex/models/sandwiches/optimism/dex_optimism_sandwiched.sql similarity index 100% rename from models/dex/chains/mev/sandwiches/dex_optimism_sandwiched.sql rename to dex/models/sandwiches/optimism/dex_optimism_sandwiched.sql diff --git a/models/dex/chains/mev/sandwiches/dex_optimism_sandwiches.sql b/dex/models/sandwiches/optimism/dex_optimism_sandwiches.sql similarity index 100% rename from models/dex/chains/mev/sandwiches/dex_optimism_sandwiches.sql rename to dex/models/sandwiches/optimism/dex_optimism_sandwiches.sql diff --git a/models/dex/chains/mev/sandwiches/dex_polygon_sandwiched.sql b/dex/models/sandwiches/polygon/dex_polygon_sandwiched.sql similarity index 100% rename from models/dex/chains/mev/sandwiches/dex_polygon_sandwiched.sql rename to dex/models/sandwiches/polygon/dex_polygon_sandwiched.sql diff --git a/models/dex/chains/mev/sandwiches/dex_polygon_sandwiches.sql b/dex/models/sandwiches/polygon/dex_polygon_sandwiches.sql similarity index 100% rename from models/dex/chains/mev/sandwiches/dex_polygon_sandwiches.sql rename to dex/models/sandwiches/polygon/dex_polygon_sandwiches.sql diff --git a/models/dex/chains/mev/sandwiches/dex_scroll_sandwiched.sql b/dex/models/sandwiches/scroll/dex_scroll_sandwiched.sql similarity index 100% rename from models/dex/chains/mev/sandwiches/dex_scroll_sandwiched.sql rename to dex/models/sandwiches/scroll/dex_scroll_sandwiched.sql diff --git a/models/dex/chains/mev/sandwiches/dex_scroll_sandwiches.sql b/dex/models/sandwiches/scroll/dex_scroll_sandwiches.sql similarity index 100% rename from models/dex/chains/mev/sandwiches/dex_scroll_sandwiches.sql rename to dex/models/sandwiches/scroll/dex_scroll_sandwiches.sql diff --git a/models/dex/chains/mev/sandwiches/dex_zksync_sandwiched.sql b/dex/models/sandwiches/zksync/dex_zksync_sandwiched.sql similarity index 100% rename from models/dex/chains/mev/sandwiches/dex_zksync_sandwiched.sql rename to dex/models/sandwiches/zksync/dex_zksync_sandwiched.sql diff --git a/models/dex/chains/mev/sandwiches/dex_zksync_sandwiches.sql b/dex/models/sandwiches/zksync/dex_zksync_sandwiches.sql similarity index 100% rename from models/dex/chains/mev/sandwiches/dex_zksync_sandwiches.sql rename to dex/models/sandwiches/zksync/dex_zksync_sandwiches.sql diff --git a/models/dex/chains/mev/sandwiches/dex_zora_sandwiched.sql b/dex/models/sandwiches/zora/dex_zora_sandwiched.sql similarity index 100% rename from models/dex/chains/mev/sandwiches/dex_zora_sandwiched.sql rename to dex/models/sandwiches/zora/dex_zora_sandwiched.sql diff --git a/models/dex/chains/mev/sandwiches/dex_zora_sandwiches.sql b/dex/models/sandwiches/zora/dex_zora_sandwiches.sql similarity index 100% rename from models/dex/chains/mev/sandwiches/dex_zora_sandwiches.sql rename to dex/models/sandwiches/zora/dex_zora_sandwiches.sql diff --git a/models/_sector/dex/trades/_schema.yml b/dex/models/trades/_schema.yml similarity index 100% rename from models/_sector/dex/trades/_schema.yml rename to dex/models/trades/_schema.yml diff --git a/models/_sector/dex/trades/arbitrum/_schema.yml b/dex/models/trades/arbitrum/_schema.yml similarity index 100% rename from models/_sector/dex/trades/arbitrum/_schema.yml rename to dex/models/trades/arbitrum/_schema.yml diff --git a/models/_sector/dex/trades/arbitrum/dex_arbitrum_base_trades.sql b/dex/models/trades/arbitrum/dex_arbitrum_base_trades.sql similarity index 100% rename from models/_sector/dex/trades/arbitrum/dex_arbitrum_base_trades.sql rename to dex/models/trades/arbitrum/dex_arbitrum_base_trades.sql diff --git a/models/_sector/dex/trades/arbitrum/platforms/airswap_arbitrum_base_trades.sql b/dex/models/trades/arbitrum/platforms/airswap_arbitrum_base_trades.sql similarity index 100% rename from models/_sector/dex/trades/arbitrum/platforms/airswap_arbitrum_base_trades.sql rename to dex/models/trades/arbitrum/platforms/airswap_arbitrum_base_trades.sql diff --git a/models/_sector/dex/trades/arbitrum/platforms/apeswap_arbitrum_base_trades.sql b/dex/models/trades/arbitrum/platforms/apeswap_arbitrum_base_trades.sql similarity index 100% rename from models/_sector/dex/trades/arbitrum/platforms/apeswap_arbitrum_base_trades.sql rename to dex/models/trades/arbitrum/platforms/apeswap_arbitrum_base_trades.sql diff --git a/models/_sector/dex/trades/arbitrum/platforms/arbswap_arbitrum_base_trades.sql b/dex/models/trades/arbitrum/platforms/arbswap_arbitrum_base_trades.sql similarity index 100% rename from models/_sector/dex/trades/arbitrum/platforms/arbswap_arbitrum_base_trades.sql rename to dex/models/trades/arbitrum/platforms/arbswap_arbitrum_base_trades.sql diff --git a/models/_sector/dex/trades/arbitrum/platforms/auragi_arbitrum_base_trades.sql b/dex/models/trades/arbitrum/platforms/auragi_arbitrum_base_trades.sql similarity index 100% rename from models/_sector/dex/trades/arbitrum/platforms/auragi_arbitrum_base_trades.sql rename to dex/models/trades/arbitrum/platforms/auragi_arbitrum_base_trades.sql diff --git a/models/_sector/dex/trades/arbitrum/platforms/balancer_v2_arbitrum_base_trades.sql b/dex/models/trades/arbitrum/platforms/balancer_v2_arbitrum_base_trades.sql similarity index 100% rename from models/_sector/dex/trades/arbitrum/platforms/balancer_v2_arbitrum_base_trades.sql rename to dex/models/trades/arbitrum/platforms/balancer_v2_arbitrum_base_trades.sql diff --git a/models/_sector/dex/trades/arbitrum/platforms/camelot_v2_arbitrum_base_trades.sql b/dex/models/trades/arbitrum/platforms/camelot_v2_arbitrum_base_trades.sql similarity index 100% rename from models/_sector/dex/trades/arbitrum/platforms/camelot_v2_arbitrum_base_trades.sql rename to dex/models/trades/arbitrum/platforms/camelot_v2_arbitrum_base_trades.sql diff --git a/models/_sector/dex/trades/arbitrum/platforms/camelot_v3_arbitrum_base_trades.sql b/dex/models/trades/arbitrum/platforms/camelot_v3_arbitrum_base_trades.sql similarity index 100% rename from models/_sector/dex/trades/arbitrum/platforms/camelot_v3_arbitrum_base_trades.sql rename to dex/models/trades/arbitrum/platforms/camelot_v3_arbitrum_base_trades.sql diff --git a/models/_sector/dex/trades/arbitrum/platforms/chronos_arbitrum_base_trades.sql b/dex/models/trades/arbitrum/platforms/chronos_arbitrum_base_trades.sql similarity index 100% rename from models/_sector/dex/trades/arbitrum/platforms/chronos_arbitrum_base_trades.sql rename to dex/models/trades/arbitrum/platforms/chronos_arbitrum_base_trades.sql diff --git a/models/_sector/dex/trades/arbitrum/platforms/clipper_arbitrum_base_trades.sql b/dex/models/trades/arbitrum/platforms/clipper_arbitrum_base_trades.sql similarity index 100% rename from models/_sector/dex/trades/arbitrum/platforms/clipper_arbitrum_base_trades.sql rename to dex/models/trades/arbitrum/platforms/clipper_arbitrum_base_trades.sql diff --git a/models/_sector/dex/trades/arbitrum/platforms/dodo_arbitrum_base_trades.sql b/dex/models/trades/arbitrum/platforms/dodo_arbitrum_base_trades.sql similarity index 100% rename from models/_sector/dex/trades/arbitrum/platforms/dodo_arbitrum_base_trades.sql rename to dex/models/trades/arbitrum/platforms/dodo_arbitrum_base_trades.sql diff --git a/models/_sector/dex/trades/arbitrum/platforms/fraxswap_arbitrum_base_trades.sql b/dex/models/trades/arbitrum/platforms/fraxswap_arbitrum_base_trades.sql similarity index 100% rename from models/_sector/dex/trades/arbitrum/platforms/fraxswap_arbitrum_base_trades.sql rename to dex/models/trades/arbitrum/platforms/fraxswap_arbitrum_base_trades.sql diff --git a/models/_sector/dex/trades/arbitrum/platforms/gmx_arbitrum_base_trades.sql b/dex/models/trades/arbitrum/platforms/gmx_arbitrum_base_trades.sql similarity index 100% rename from models/_sector/dex/trades/arbitrum/platforms/gmx_arbitrum_base_trades.sql rename to dex/models/trades/arbitrum/platforms/gmx_arbitrum_base_trades.sql diff --git a/models/_sector/dex/trades/arbitrum/platforms/gridex_arbitrum_base_trades.sql b/dex/models/trades/arbitrum/platforms/gridex_arbitrum_base_trades.sql similarity index 100% rename from models/_sector/dex/trades/arbitrum/platforms/gridex_arbitrum_base_trades.sql rename to dex/models/trades/arbitrum/platforms/gridex_arbitrum_base_trades.sql diff --git a/models/_sector/dex/trades/arbitrum/platforms/integral_arbitrum_base_trades.sql b/dex/models/trades/arbitrum/platforms/integral_arbitrum_base_trades.sql similarity index 100% rename from models/_sector/dex/trades/arbitrum/platforms/integral_arbitrum_base_trades.sql rename to dex/models/trades/arbitrum/platforms/integral_arbitrum_base_trades.sql diff --git a/models/_sector/dex/trades/arbitrum/platforms/kyberswap_arbitrum_base_trades.sql b/dex/models/trades/arbitrum/platforms/kyberswap_arbitrum_base_trades.sql similarity index 100% rename from models/_sector/dex/trades/arbitrum/platforms/kyberswap_arbitrum_base_trades.sql rename to dex/models/trades/arbitrum/platforms/kyberswap_arbitrum_base_trades.sql diff --git a/models/_sector/dex/trades/arbitrum/platforms/oasisswap_arbitrum_base_trades.sql b/dex/models/trades/arbitrum/platforms/oasisswap_arbitrum_base_trades.sql similarity index 100% rename from models/_sector/dex/trades/arbitrum/platforms/oasisswap_arbitrum_base_trades.sql rename to dex/models/trades/arbitrum/platforms/oasisswap_arbitrum_base_trades.sql diff --git a/models/_sector/dex/trades/arbitrum/platforms/pancakeswap_v2_arbitrum_base_trades.sql b/dex/models/trades/arbitrum/platforms/pancakeswap_v2_arbitrum_base_trades.sql similarity index 100% rename from models/_sector/dex/trades/arbitrum/platforms/pancakeswap_v2_arbitrum_base_trades.sql rename to dex/models/trades/arbitrum/platforms/pancakeswap_v2_arbitrum_base_trades.sql diff --git a/models/_sector/dex/trades/arbitrum/platforms/pancakeswap_v3_arbitrum_base_trades.sql b/dex/models/trades/arbitrum/platforms/pancakeswap_v3_arbitrum_base_trades.sql similarity index 100% rename from models/_sector/dex/trades/arbitrum/platforms/pancakeswap_v3_arbitrum_base_trades.sql rename to dex/models/trades/arbitrum/platforms/pancakeswap_v3_arbitrum_base_trades.sql diff --git a/models/_sector/dex/trades/arbitrum/platforms/ramses_arbitrum_base_trades.sql b/dex/models/trades/arbitrum/platforms/ramses_arbitrum_base_trades.sql similarity index 100% rename from models/_sector/dex/trades/arbitrum/platforms/ramses_arbitrum_base_trades.sql rename to dex/models/trades/arbitrum/platforms/ramses_arbitrum_base_trades.sql diff --git a/models/_sector/dex/trades/arbitrum/platforms/rubicon_arbitrum_base_trades.sql b/dex/models/trades/arbitrum/platforms/rubicon_arbitrum_base_trades.sql similarity index 100% rename from models/_sector/dex/trades/arbitrum/platforms/rubicon_arbitrum_base_trades.sql rename to dex/models/trades/arbitrum/platforms/rubicon_arbitrum_base_trades.sql diff --git a/models/_sector/dex/trades/arbitrum/platforms/sharkyswap_arbitrum_base_trades.sql b/dex/models/trades/arbitrum/platforms/sharkyswap_arbitrum_base_trades.sql similarity index 100% rename from models/_sector/dex/trades/arbitrum/platforms/sharkyswap_arbitrum_base_trades.sql rename to dex/models/trades/arbitrum/platforms/sharkyswap_arbitrum_base_trades.sql diff --git a/models/_sector/dex/trades/arbitrum/platforms/smardex_arbitrum_base_trades.sql b/dex/models/trades/arbitrum/platforms/smardex_arbitrum_base_trades.sql similarity index 100% rename from models/_sector/dex/trades/arbitrum/platforms/smardex_arbitrum_base_trades.sql rename to dex/models/trades/arbitrum/platforms/smardex_arbitrum_base_trades.sql diff --git a/models/_sector/dex/trades/arbitrum/platforms/solidlizard_arbitrum_base_trades.sql b/dex/models/trades/arbitrum/platforms/solidlizard_arbitrum_base_trades.sql similarity index 100% rename from models/_sector/dex/trades/arbitrum/platforms/solidlizard_arbitrum_base_trades.sql rename to dex/models/trades/arbitrum/platforms/solidlizard_arbitrum_base_trades.sql diff --git a/models/_sector/dex/trades/arbitrum/platforms/solidly_v3_arbitrum_base_trades.sql b/dex/models/trades/arbitrum/platforms/solidly_v3_arbitrum_base_trades.sql similarity index 100% rename from models/_sector/dex/trades/arbitrum/platforms/solidly_v3_arbitrum_base_trades.sql rename to dex/models/trades/arbitrum/platforms/solidly_v3_arbitrum_base_trades.sql diff --git a/models/_sector/dex/trades/arbitrum/platforms/sterling_finance_arbitrum_base_trades.sql b/dex/models/trades/arbitrum/platforms/sterling_finance_arbitrum_base_trades.sql similarity index 100% rename from models/_sector/dex/trades/arbitrum/platforms/sterling_finance_arbitrum_base_trades.sql rename to dex/models/trades/arbitrum/platforms/sterling_finance_arbitrum_base_trades.sql diff --git a/models/_sector/dex/trades/arbitrum/platforms/sushiswap_v1_arbitrum_base_trades.sql b/dex/models/trades/arbitrum/platforms/sushiswap_v1_arbitrum_base_trades.sql similarity index 100% rename from models/_sector/dex/trades/arbitrum/platforms/sushiswap_v1_arbitrum_base_trades.sql rename to dex/models/trades/arbitrum/platforms/sushiswap_v1_arbitrum_base_trades.sql diff --git a/models/_sector/dex/trades/arbitrum/platforms/sushiswap_v2_arbitrum_base_trades.sql b/dex/models/trades/arbitrum/platforms/sushiswap_v2_arbitrum_base_trades.sql similarity index 100% rename from models/_sector/dex/trades/arbitrum/platforms/sushiswap_v2_arbitrum_base_trades.sql rename to dex/models/trades/arbitrum/platforms/sushiswap_v2_arbitrum_base_trades.sql diff --git a/models/_sector/dex/trades/arbitrum/platforms/swaap_v2_arbitrum_base_trades.sql b/dex/models/trades/arbitrum/platforms/swaap_v2_arbitrum_base_trades.sql similarity index 100% rename from models/_sector/dex/trades/arbitrum/platforms/swaap_v2_arbitrum_base_trades.sql rename to dex/models/trades/arbitrum/platforms/swaap_v2_arbitrum_base_trades.sql diff --git a/models/_sector/dex/trades/arbitrum/platforms/trader_joe_v2_1_arbitrum_base_trades.sql b/dex/models/trades/arbitrum/platforms/trader_joe_v2_1_arbitrum_base_trades.sql similarity index 100% rename from models/_sector/dex/trades/arbitrum/platforms/trader_joe_v2_1_arbitrum_base_trades.sql rename to dex/models/trades/arbitrum/platforms/trader_joe_v2_1_arbitrum_base_trades.sql diff --git a/models/_sector/dex/trades/arbitrum/platforms/trader_joe_v2_arbitrum_base_trades.sql b/dex/models/trades/arbitrum/platforms/trader_joe_v2_arbitrum_base_trades.sql similarity index 100% rename from models/_sector/dex/trades/arbitrum/platforms/trader_joe_v2_arbitrum_base_trades.sql rename to dex/models/trades/arbitrum/platforms/trader_joe_v2_arbitrum_base_trades.sql diff --git a/models/_sector/dex/trades/arbitrum/platforms/uniswap_v2_arbitrum_base_trades.sql b/dex/models/trades/arbitrum/platforms/uniswap_v2_arbitrum_base_trades.sql similarity index 100% rename from models/_sector/dex/trades/arbitrum/platforms/uniswap_v2_arbitrum_base_trades.sql rename to dex/models/trades/arbitrum/platforms/uniswap_v2_arbitrum_base_trades.sql diff --git a/models/_sector/dex/trades/arbitrum/platforms/uniswap_v3_arbitrum_base_trades.sql b/dex/models/trades/arbitrum/platforms/uniswap_v3_arbitrum_base_trades.sql similarity index 100% rename from models/_sector/dex/trades/arbitrum/platforms/uniswap_v3_arbitrum_base_trades.sql rename to dex/models/trades/arbitrum/platforms/uniswap_v3_arbitrum_base_trades.sql diff --git a/models/_sector/dex/trades/arbitrum/platforms/wombat_exchange_arbitrum_base_trades.sql b/dex/models/trades/arbitrum/platforms/wombat_exchange_arbitrum_base_trades.sql similarity index 100% rename from models/_sector/dex/trades/arbitrum/platforms/wombat_exchange_arbitrum_base_trades.sql rename to dex/models/trades/arbitrum/platforms/wombat_exchange_arbitrum_base_trades.sql diff --git a/models/_sector/dex/trades/arbitrum/platforms/woofi_arbitrum_base_trades.sql b/dex/models/trades/arbitrum/platforms/woofi_arbitrum_base_trades.sql similarity index 100% rename from models/_sector/dex/trades/arbitrum/platforms/woofi_arbitrum_base_trades.sql rename to dex/models/trades/arbitrum/platforms/woofi_arbitrum_base_trades.sql diff --git a/models/_sector/dex/trades/arbitrum/platforms/xchange_arbitrum_base_trades.sql b/dex/models/trades/arbitrum/platforms/xchange_arbitrum_base_trades.sql similarity index 100% rename from models/_sector/dex/trades/arbitrum/platforms/xchange_arbitrum_base_trades.sql rename to dex/models/trades/arbitrum/platforms/xchange_arbitrum_base_trades.sql diff --git a/models/_sector/dex/trades/arbitrum/platforms/zigzag_arbitrum_base_trades.sql b/dex/models/trades/arbitrum/platforms/zigzag_arbitrum_base_trades.sql similarity index 100% rename from models/_sector/dex/trades/arbitrum/platforms/zigzag_arbitrum_base_trades.sql rename to dex/models/trades/arbitrum/platforms/zigzag_arbitrum_base_trades.sql diff --git a/models/_sector/dex/trades/arbitrum/platforms/zyberswap_arbitrum_base_trades.sql b/dex/models/trades/arbitrum/platforms/zyberswap_arbitrum_base_trades.sql similarity index 100% rename from models/_sector/dex/trades/arbitrum/platforms/zyberswap_arbitrum_base_trades.sql rename to dex/models/trades/arbitrum/platforms/zyberswap_arbitrum_base_trades.sql diff --git a/models/_sector/dex/trades/avalanche_c/_schema.yml b/dex/models/trades/avalanche_c/_schema.yml similarity index 100% rename from models/_sector/dex/trades/avalanche_c/_schema.yml rename to dex/models/trades/avalanche_c/_schema.yml diff --git a/models/_sector/dex/trades/avalanche_c/dex_avalanche_c_base_trades.sql b/dex/models/trades/avalanche_c/dex_avalanche_c_base_trades.sql similarity index 100% rename from models/_sector/dex/trades/avalanche_c/dex_avalanche_c_base_trades.sql rename to dex/models/trades/avalanche_c/dex_avalanche_c_base_trades.sql diff --git a/models/_sector/dex/trades/avalanche_c/platforms/airswap_avalanche_c_base_trades.sql b/dex/models/trades/avalanche_c/platforms/airswap_avalanche_c_base_trades.sql similarity index 100% rename from models/_sector/dex/trades/avalanche_c/platforms/airswap_avalanche_c_base_trades.sql rename to dex/models/trades/avalanche_c/platforms/airswap_avalanche_c_base_trades.sql diff --git a/models/_sector/dex/trades/avalanche_c/platforms/balancer_v2_avalanche_c_base_trades.sql b/dex/models/trades/avalanche_c/platforms/balancer_v2_avalanche_c_base_trades.sql similarity index 100% rename from models/_sector/dex/trades/avalanche_c/platforms/balancer_v2_avalanche_c_base_trades.sql rename to dex/models/trades/avalanche_c/platforms/balancer_v2_avalanche_c_base_trades.sql diff --git a/models/_sector/dex/trades/avalanche_c/platforms/curvefi_avalanche_c_base_trades.sql b/dex/models/trades/avalanche_c/platforms/curvefi_avalanche_c_base_trades.sql similarity index 100% rename from models/_sector/dex/trades/avalanche_c/platforms/curvefi_avalanche_c_base_trades.sql rename to dex/models/trades/avalanche_c/platforms/curvefi_avalanche_c_base_trades.sql diff --git a/models/_sector/dex/trades/avalanche_c/platforms/fraxswap_avalanche_c_base_trades.sql b/dex/models/trades/avalanche_c/platforms/fraxswap_avalanche_c_base_trades.sql similarity index 100% rename from models/_sector/dex/trades/avalanche_c/platforms/fraxswap_avalanche_c_base_trades.sql rename to dex/models/trades/avalanche_c/platforms/fraxswap_avalanche_c_base_trades.sql diff --git a/models/_sector/dex/trades/avalanche_c/platforms/glacier_v2_avalanche_c_base_trades.sql b/dex/models/trades/avalanche_c/platforms/glacier_v2_avalanche_c_base_trades.sql similarity index 100% rename from models/_sector/dex/trades/avalanche_c/platforms/glacier_v2_avalanche_c_base_trades.sql rename to dex/models/trades/avalanche_c/platforms/glacier_v2_avalanche_c_base_trades.sql diff --git a/models/_sector/dex/trades/avalanche_c/platforms/glacier_v3_avalanche_c_base_trades.sql b/dex/models/trades/avalanche_c/platforms/glacier_v3_avalanche_c_base_trades.sql similarity index 100% rename from models/_sector/dex/trades/avalanche_c/platforms/glacier_v3_avalanche_c_base_trades.sql rename to dex/models/trades/avalanche_c/platforms/glacier_v3_avalanche_c_base_trades.sql diff --git a/models/_sector/dex/trades/avalanche_c/platforms/gmx_avalanche_c_base_trades.sql b/dex/models/trades/avalanche_c/platforms/gmx_avalanche_c_base_trades.sql similarity index 100% rename from models/_sector/dex/trades/avalanche_c/platforms/gmx_avalanche_c_base_trades.sql rename to dex/models/trades/avalanche_c/platforms/gmx_avalanche_c_base_trades.sql diff --git a/models/_sector/dex/trades/avalanche_c/platforms/hashflow_avalanche_c_base_trades.sql b/dex/models/trades/avalanche_c/platforms/hashflow_avalanche_c_base_trades.sql similarity index 100% rename from models/_sector/dex/trades/avalanche_c/platforms/hashflow_avalanche_c_base_trades.sql rename to dex/models/trades/avalanche_c/platforms/hashflow_avalanche_c_base_trades.sql diff --git a/models/_sector/dex/trades/avalanche_c/platforms/kyberswap_avalanche_c_base_trades.sql b/dex/models/trades/avalanche_c/platforms/kyberswap_avalanche_c_base_trades.sql similarity index 100% rename from models/_sector/dex/trades/avalanche_c/platforms/kyberswap_avalanche_c_base_trades.sql rename to dex/models/trades/avalanche_c/platforms/kyberswap_avalanche_c_base_trades.sql diff --git a/models/_sector/dex/trades/avalanche_c/platforms/openocean_avalanche_c_base_trades.sql b/dex/models/trades/avalanche_c/platforms/openocean_avalanche_c_base_trades.sql similarity index 100% rename from models/_sector/dex/trades/avalanche_c/platforms/openocean_avalanche_c_base_trades.sql rename to dex/models/trades/avalanche_c/platforms/openocean_avalanche_c_base_trades.sql diff --git a/models/_sector/dex/trades/avalanche_c/platforms/pharaoh_avalanche_c_base_trades.sql b/dex/models/trades/avalanche_c/platforms/pharaoh_avalanche_c_base_trades.sql similarity index 100% rename from models/_sector/dex/trades/avalanche_c/platforms/pharaoh_avalanche_c_base_trades.sql rename to dex/models/trades/avalanche_c/platforms/pharaoh_avalanche_c_base_trades.sql diff --git a/models/_sector/dex/trades/avalanche_c/platforms/platypus_finance_avalanche_c_base_trades.sql b/dex/models/trades/avalanche_c/platforms/platypus_finance_avalanche_c_base_trades.sql similarity index 100% rename from models/_sector/dex/trades/avalanche_c/platforms/platypus_finance_avalanche_c_base_trades.sql rename to dex/models/trades/avalanche_c/platforms/platypus_finance_avalanche_c_base_trades.sql diff --git a/models/_sector/dex/trades/avalanche_c/platforms/sushiswap_v1_avalanche_c_base_trades.sql b/dex/models/trades/avalanche_c/platforms/sushiswap_v1_avalanche_c_base_trades.sql similarity index 100% rename from models/_sector/dex/trades/avalanche_c/platforms/sushiswap_v1_avalanche_c_base_trades.sql rename to dex/models/trades/avalanche_c/platforms/sushiswap_v1_avalanche_c_base_trades.sql diff --git a/models/_sector/dex/trades/avalanche_c/platforms/sushiswap_v2_avalanche_c_base_trades.sql b/dex/models/trades/avalanche_c/platforms/sushiswap_v2_avalanche_c_base_trades.sql similarity index 100% rename from models/_sector/dex/trades/avalanche_c/platforms/sushiswap_v2_avalanche_c_base_trades.sql rename to dex/models/trades/avalanche_c/platforms/sushiswap_v2_avalanche_c_base_trades.sql diff --git a/models/_sector/dex/trades/avalanche_c/platforms/trader_joe_v1_avalanche_c_base_trades.sql b/dex/models/trades/avalanche_c/platforms/trader_joe_v1_avalanche_c_base_trades.sql similarity index 100% rename from models/_sector/dex/trades/avalanche_c/platforms/trader_joe_v1_avalanche_c_base_trades.sql rename to dex/models/trades/avalanche_c/platforms/trader_joe_v1_avalanche_c_base_trades.sql diff --git a/models/_sector/dex/trades/avalanche_c/platforms/trader_joe_v2_1_avalanche_c_base_trades.sql b/dex/models/trades/avalanche_c/platforms/trader_joe_v2_1_avalanche_c_base_trades.sql similarity index 100% rename from models/_sector/dex/trades/avalanche_c/platforms/trader_joe_v2_1_avalanche_c_base_trades.sql rename to dex/models/trades/avalanche_c/platforms/trader_joe_v2_1_avalanche_c_base_trades.sql diff --git a/models/_sector/dex/trades/avalanche_c/platforms/trader_joe_v2_avalanche_c_base_trades.sql b/dex/models/trades/avalanche_c/platforms/trader_joe_v2_avalanche_c_base_trades.sql similarity index 100% rename from models/_sector/dex/trades/avalanche_c/platforms/trader_joe_v2_avalanche_c_base_trades.sql rename to dex/models/trades/avalanche_c/platforms/trader_joe_v2_avalanche_c_base_trades.sql diff --git a/models/_sector/dex/trades/avalanche_c/platforms/uniswap_v2_avalanche_c_base_trades.sql b/dex/models/trades/avalanche_c/platforms/uniswap_v2_avalanche_c_base_trades.sql similarity index 100% rename from models/_sector/dex/trades/avalanche_c/platforms/uniswap_v2_avalanche_c_base_trades.sql rename to dex/models/trades/avalanche_c/platforms/uniswap_v2_avalanche_c_base_trades.sql diff --git a/models/_sector/dex/trades/avalanche_c/platforms/uniswap_v3_avalanche_c_base_trades.sql b/dex/models/trades/avalanche_c/platforms/uniswap_v3_avalanche_c_base_trades.sql similarity index 100% rename from models/_sector/dex/trades/avalanche_c/platforms/uniswap_v3_avalanche_c_base_trades.sql rename to dex/models/trades/avalanche_c/platforms/uniswap_v3_avalanche_c_base_trades.sql diff --git a/models/_sector/dex/trades/avalanche_c/platforms/woofi_avalanche_c_base_trades.sql b/dex/models/trades/avalanche_c/platforms/woofi_avalanche_c_base_trades.sql similarity index 100% rename from models/_sector/dex/trades/avalanche_c/platforms/woofi_avalanche_c_base_trades.sql rename to dex/models/trades/avalanche_c/platforms/woofi_avalanche_c_base_trades.sql diff --git a/models/_sector/dex/trades/base/_schema.yml b/dex/models/trades/base/_schema.yml similarity index 100% rename from models/_sector/dex/trades/base/_schema.yml rename to dex/models/trades/base/_schema.yml diff --git a/models/_sector/dex/trades/base/dex_base_base_trades.sql b/dex/models/trades/base/dex_base_base_trades.sql similarity index 100% rename from models/_sector/dex/trades/base/dex_base_base_trades.sql rename to dex/models/trades/base/dex_base_base_trades.sql diff --git a/models/_sector/dex/trades/base/platforms/aerodrome_base_base_trades.sql b/dex/models/trades/base/platforms/aerodrome_base_base_trades.sql similarity index 100% rename from models/_sector/dex/trades/base/platforms/aerodrome_base_base_trades.sql rename to dex/models/trades/base/platforms/aerodrome_base_base_trades.sql diff --git a/models/_sector/dex/trades/base/platforms/alienbase_base_base_trades.sql b/dex/models/trades/base/platforms/alienbase_base_base_trades.sql similarity index 100% rename from models/_sector/dex/trades/base/platforms/alienbase_base_base_trades.sql rename to dex/models/trades/base/platforms/alienbase_base_base_trades.sql diff --git a/models/_sector/dex/trades/base/platforms/autotronic_base_base_trades.sql b/dex/models/trades/base/platforms/autotronic_base_base_trades.sql similarity index 100% rename from models/_sector/dex/trades/base/platforms/autotronic_base_base_trades.sql rename to dex/models/trades/base/platforms/autotronic_base_base_trades.sql diff --git a/models/_sector/dex/trades/base/platforms/balancer_v2_base_base_trades.sql b/dex/models/trades/base/platforms/balancer_v2_base_base_trades.sql similarity index 100% rename from models/_sector/dex/trades/base/platforms/balancer_v2_base_base_trades.sql rename to dex/models/trades/base/platforms/balancer_v2_base_base_trades.sql diff --git a/models/_sector/dex/trades/base/platforms/baseswap_base_base_trades.sql b/dex/models/trades/base/platforms/baseswap_base_base_trades.sql similarity index 100% rename from models/_sector/dex/trades/base/platforms/baseswap_base_base_trades.sql rename to dex/models/trades/base/platforms/baseswap_base_base_trades.sql diff --git a/models/_sector/dex/trades/base/platforms/baseswap_basex_base_base_trades.sql b/dex/models/trades/base/platforms/baseswap_basex_base_base_trades.sql similarity index 100% rename from models/_sector/dex/trades/base/platforms/baseswap_basex_base_base_trades.sql rename to dex/models/trades/base/platforms/baseswap_basex_base_base_trades.sql diff --git a/models/_sector/dex/trades/base/platforms/baso_finance_base_base_trades.sql b/dex/models/trades/base/platforms/baso_finance_base_base_trades.sql similarity index 100% rename from models/_sector/dex/trades/base/platforms/baso_finance_base_base_trades.sql rename to dex/models/trades/base/platforms/baso_finance_base_base_trades.sql diff --git a/models/_sector/dex/trades/base/platforms/citadelswap_base_base_trades.sql b/dex/models/trades/base/platforms/citadelswap_base_base_trades.sql similarity index 100% rename from models/_sector/dex/trades/base/platforms/citadelswap_base_base_trades.sql rename to dex/models/trades/base/platforms/citadelswap_base_base_trades.sql diff --git a/models/_sector/dex/trades/base/platforms/clipper_base_base_trades.sql b/dex/models/trades/base/platforms/clipper_base_base_trades.sql similarity index 100% rename from models/_sector/dex/trades/base/platforms/clipper_base_base_trades.sql rename to dex/models/trades/base/platforms/clipper_base_base_trades.sql diff --git a/models/_sector/dex/trades/base/platforms/crescentswap_base_base_trades.sql b/dex/models/trades/base/platforms/crescentswap_base_base_trades.sql similarity index 100% rename from models/_sector/dex/trades/base/platforms/crescentswap_base_base_trades.sql rename to dex/models/trades/base/platforms/crescentswap_base_base_trades.sql diff --git a/models/_sector/dex/trades/base/platforms/dackieswap_base_base_trades.sql b/dex/models/trades/base/platforms/dackieswap_base_base_trades.sql similarity index 100% rename from models/_sector/dex/trades/base/platforms/dackieswap_base_base_trades.sql rename to dex/models/trades/base/platforms/dackieswap_base_base_trades.sql diff --git a/models/_sector/dex/trades/base/platforms/derpdex_base_base_trades.sql b/dex/models/trades/base/platforms/derpdex_base_base_trades.sql similarity index 100% rename from models/_sector/dex/trades/base/platforms/derpdex_base_base_trades.sql rename to dex/models/trades/base/platforms/derpdex_base_base_trades.sql diff --git a/models/_sector/dex/trades/base/platforms/dodo_base_base_trades.sql b/dex/models/trades/base/platforms/dodo_base_base_trades.sql similarity index 100% rename from models/_sector/dex/trades/base/platforms/dodo_base_base_trades.sql rename to dex/models/trades/base/platforms/dodo_base_base_trades.sql diff --git a/models/_sector/dex/trades/base/platforms/elk_finance_base_base_trades.sql b/dex/models/trades/base/platforms/elk_finance_base_base_trades.sql similarity index 100% rename from models/_sector/dex/trades/base/platforms/elk_finance_base_base_trades.sql rename to dex/models/trades/base/platforms/elk_finance_base_base_trades.sql diff --git a/models/_sector/dex/trades/base/platforms/energon_base_base_trades.sql b/dex/models/trades/base/platforms/energon_base_base_trades.sql similarity index 100% rename from models/_sector/dex/trades/base/platforms/energon_base_base_trades.sql rename to dex/models/trades/base/platforms/energon_base_base_trades.sql diff --git a/models/_sector/dex/trades/base/platforms/gridex_base_base_trades.sql b/dex/models/trades/base/platforms/gridex_base_base_trades.sql similarity index 100% rename from models/_sector/dex/trades/base/platforms/gridex_base_base_trades.sql rename to dex/models/trades/base/platforms/gridex_base_base_trades.sql diff --git a/models/_sector/dex/trades/base/platforms/horizondex_base_base_trades.sql b/dex/models/trades/base/platforms/horizondex_base_base_trades.sql similarity index 100% rename from models/_sector/dex/trades/base/platforms/horizondex_base_base_trades.sql rename to dex/models/trades/base/platforms/horizondex_base_base_trades.sql diff --git a/models/_sector/dex/trades/base/platforms/icecreamswap_base_base_trades.sql b/dex/models/trades/base/platforms/icecreamswap_base_base_trades.sql similarity index 100% rename from models/_sector/dex/trades/base/platforms/icecreamswap_base_base_trades.sql rename to dex/models/trades/base/platforms/icecreamswap_base_base_trades.sql diff --git a/models/_sector/dex/trades/base/platforms/kyberswap_base_base_trades.sql b/dex/models/trades/base/platforms/kyberswap_base_base_trades.sql similarity index 100% rename from models/_sector/dex/trades/base/platforms/kyberswap_base_base_trades.sql rename to dex/models/trades/base/platforms/kyberswap_base_base_trades.sql diff --git a/models/_sector/dex/trades/base/platforms/leetswap_v2_base_base_trades.sql b/dex/models/trades/base/platforms/leetswap_v2_base_base_trades.sql similarity index 100% rename from models/_sector/dex/trades/base/platforms/leetswap_v2_base_base_trades.sql rename to dex/models/trades/base/platforms/leetswap_v2_base_base_trades.sql diff --git a/models/_sector/dex/trades/base/platforms/maverick_base_base_trades.sql b/dex/models/trades/base/platforms/maverick_base_base_trades.sql similarity index 100% rename from models/_sector/dex/trades/base/platforms/maverick_base_base_trades.sql rename to dex/models/trades/base/platforms/maverick_base_base_trades.sql diff --git a/models/_sector/dex/trades/base/platforms/moonbase_base_base_trades.sql b/dex/models/trades/base/platforms/moonbase_base_base_trades.sql similarity index 100% rename from models/_sector/dex/trades/base/platforms/moonbase_base_base_trades.sql rename to dex/models/trades/base/platforms/moonbase_base_base_trades.sql diff --git a/models/_sector/dex/trades/base/platforms/oasisswap_base_base_trades.sql b/dex/models/trades/base/platforms/oasisswap_base_base_trades.sql similarity index 100% rename from models/_sector/dex/trades/base/platforms/oasisswap_base_base_trades.sql rename to dex/models/trades/base/platforms/oasisswap_base_base_trades.sql diff --git a/models/_sector/dex/trades/base/platforms/openocean_base_base_trades.sql b/dex/models/trades/base/platforms/openocean_base_base_trades.sql similarity index 100% rename from models/_sector/dex/trades/base/platforms/openocean_base_base_trades.sql rename to dex/models/trades/base/platforms/openocean_base_base_trades.sql diff --git a/models/_sector/dex/trades/base/platforms/pancakeswap_v2_base_base_trades.sql b/dex/models/trades/base/platforms/pancakeswap_v2_base_base_trades.sql similarity index 100% rename from models/_sector/dex/trades/base/platforms/pancakeswap_v2_base_base_trades.sql rename to dex/models/trades/base/platforms/pancakeswap_v2_base_base_trades.sql diff --git a/models/_sector/dex/trades/base/platforms/pancakeswap_v3_base_base_trades.sql b/dex/models/trades/base/platforms/pancakeswap_v3_base_base_trades.sql similarity index 100% rename from models/_sector/dex/trades/base/platforms/pancakeswap_v3_base_base_trades.sql rename to dex/models/trades/base/platforms/pancakeswap_v3_base_base_trades.sql diff --git a/models/_sector/dex/trades/base/platforms/plantbaseswap_base_base_trades.sql b/dex/models/trades/base/platforms/plantbaseswap_base_base_trades.sql similarity index 100% rename from models/_sector/dex/trades/base/platforms/plantbaseswap_base_base_trades.sql rename to dex/models/trades/base/platforms/plantbaseswap_base_base_trades.sql diff --git a/models/_sector/dex/trades/base/platforms/rocketswap_base_base_trades.sql b/dex/models/trades/base/platforms/rocketswap_base_base_trades.sql similarity index 100% rename from models/_sector/dex/trades/base/platforms/rocketswap_base_base_trades.sql rename to dex/models/trades/base/platforms/rocketswap_base_base_trades.sql diff --git a/models/_sector/dex/trades/base/platforms/rubicon_base_base_trades.sql b/dex/models/trades/base/platforms/rubicon_base_base_trades.sql similarity index 100% rename from models/_sector/dex/trades/base/platforms/rubicon_base_base_trades.sql rename to dex/models/trades/base/platforms/rubicon_base_base_trades.sql diff --git a/models/_sector/dex/trades/base/platforms/scale_base_base_trades.sql b/dex/models/trades/base/platforms/scale_base_base_trades.sql similarity index 100% rename from models/_sector/dex/trades/base/platforms/scale_base_base_trades.sql rename to dex/models/trades/base/platforms/scale_base_base_trades.sql diff --git a/models/_sector/dex/trades/base/platforms/sharkswap_base_base_trades.sql b/dex/models/trades/base/platforms/sharkswap_base_base_trades.sql similarity index 100% rename from models/_sector/dex/trades/base/platforms/sharkswap_base_base_trades.sql rename to dex/models/trades/base/platforms/sharkswap_base_base_trades.sql diff --git a/models/_sector/dex/trades/base/platforms/smardex_base_base_trades.sql b/dex/models/trades/base/platforms/smardex_base_base_trades.sql similarity index 100% rename from models/_sector/dex/trades/base/platforms/smardex_base_base_trades.sql rename to dex/models/trades/base/platforms/smardex_base_base_trades.sql diff --git a/models/_sector/dex/trades/base/platforms/sobal_base_base_trades.sql b/dex/models/trades/base/platforms/sobal_base_base_trades.sql similarity index 100% rename from models/_sector/dex/trades/base/platforms/sobal_base_base_trades.sql rename to dex/models/trades/base/platforms/sobal_base_base_trades.sql diff --git a/models/_sector/dex/trades/base/platforms/solidly_v3_base_base_trades.sql b/dex/models/trades/base/platforms/solidly_v3_base_base_trades.sql similarity index 100% rename from models/_sector/dex/trades/base/platforms/solidly_v3_base_base_trades.sql rename to dex/models/trades/base/platforms/solidly_v3_base_base_trades.sql diff --git a/models/_sector/dex/trades/base/platforms/soswap_base_base_trades.sql b/dex/models/trades/base/platforms/soswap_base_base_trades.sql similarity index 100% rename from models/_sector/dex/trades/base/platforms/soswap_base_base_trades.sql rename to dex/models/trades/base/platforms/soswap_base_base_trades.sql diff --git a/models/_sector/dex/trades/base/platforms/sushiswap_v1_base_base_trades.sql b/dex/models/trades/base/platforms/sushiswap_v1_base_base_trades.sql similarity index 100% rename from models/_sector/dex/trades/base/platforms/sushiswap_v1_base_base_trades.sql rename to dex/models/trades/base/platforms/sushiswap_v1_base_base_trades.sql diff --git a/models/_sector/dex/trades/base/platforms/sushiswap_v2_base_base_trades.sql b/dex/models/trades/base/platforms/sushiswap_v2_base_base_trades.sql similarity index 100% rename from models/_sector/dex/trades/base/platforms/sushiswap_v2_base_base_trades.sql rename to dex/models/trades/base/platforms/sushiswap_v2_base_base_trades.sql diff --git a/models/_sector/dex/trades/base/platforms/swapbased_base_base_trades.sql b/dex/models/trades/base/platforms/swapbased_base_base_trades.sql similarity index 100% rename from models/_sector/dex/trades/base/platforms/swapbased_base_base_trades.sql rename to dex/models/trades/base/platforms/swapbased_base_base_trades.sql diff --git a/models/_sector/dex/trades/base/platforms/synthswap_base_base_trades.sql b/dex/models/trades/base/platforms/synthswap_base_base_trades.sql similarity index 100% rename from models/_sector/dex/trades/base/platforms/synthswap_base_base_trades.sql rename to dex/models/trades/base/platforms/synthswap_base_base_trades.sql diff --git a/models/_sector/dex/trades/base/platforms/throne_exchange_v2_base_base_trades.sql b/dex/models/trades/base/platforms/throne_exchange_v2_base_base_trades.sql similarity index 100% rename from models/_sector/dex/trades/base/platforms/throne_exchange_v2_base_base_trades.sql rename to dex/models/trades/base/platforms/throne_exchange_v2_base_base_trades.sql diff --git a/models/_sector/dex/trades/base/platforms/throne_exchange_v3_base_base_trades.sql b/dex/models/trades/base/platforms/throne_exchange_v3_base_base_trades.sql similarity index 100% rename from models/_sector/dex/trades/base/platforms/throne_exchange_v3_base_base_trades.sql rename to dex/models/trades/base/platforms/throne_exchange_v3_base_base_trades.sql diff --git a/models/_sector/dex/trades/base/platforms/torus_base_base_trades.sql b/dex/models/trades/base/platforms/torus_base_base_trades.sql similarity index 100% rename from models/_sector/dex/trades/base/platforms/torus_base_base_trades.sql rename to dex/models/trades/base/platforms/torus_base_base_trades.sql diff --git a/models/_sector/dex/trades/base/platforms/uniswap_v2_base_base_trades.sql b/dex/models/trades/base/platforms/uniswap_v2_base_base_trades.sql similarity index 100% rename from models/_sector/dex/trades/base/platforms/uniswap_v2_base_base_trades.sql rename to dex/models/trades/base/platforms/uniswap_v2_base_base_trades.sql diff --git a/models/_sector/dex/trades/base/platforms/uniswap_v3_base_base_trades.sql b/dex/models/trades/base/platforms/uniswap_v3_base_base_trades.sql similarity index 100% rename from models/_sector/dex/trades/base/platforms/uniswap_v3_base_base_trades.sql rename to dex/models/trades/base/platforms/uniswap_v3_base_base_trades.sql diff --git a/models/_sector/dex/trades/base/platforms/velocimeter_v2_base_base_trades.sql b/dex/models/trades/base/platforms/velocimeter_v2_base_base_trades.sql similarity index 100% rename from models/_sector/dex/trades/base/platforms/velocimeter_v2_base_base_trades.sql rename to dex/models/trades/base/platforms/velocimeter_v2_base_base_trades.sql diff --git a/models/_sector/dex/trades/base/platforms/voltswap_base_base_trades.sql b/dex/models/trades/base/platforms/voltswap_base_base_trades.sql similarity index 100% rename from models/_sector/dex/trades/base/platforms/voltswap_base_base_trades.sql rename to dex/models/trades/base/platforms/voltswap_base_base_trades.sql diff --git a/models/_sector/dex/trades/base/platforms/wombat_exchange_base_base_trades.sql b/dex/models/trades/base/platforms/wombat_exchange_base_base_trades.sql similarity index 100% rename from models/_sector/dex/trades/base/platforms/wombat_exchange_base_base_trades.sql rename to dex/models/trades/base/platforms/wombat_exchange_base_base_trades.sql diff --git a/models/_sector/dex/trades/base/platforms/woofi_base_base_trades.sql b/dex/models/trades/base/platforms/woofi_base_base_trades.sql similarity index 100% rename from models/_sector/dex/trades/base/platforms/woofi_base_base_trades.sql rename to dex/models/trades/base/platforms/woofi_base_base_trades.sql diff --git a/models/_sector/dex/trades/bnb/_schema.yml b/dex/models/trades/bnb/_schema.yml similarity index 100% rename from models/_sector/dex/trades/bnb/_schema.yml rename to dex/models/trades/bnb/_schema.yml diff --git a/models/_sector/dex/trades/bnb/dex_bnb_base_trades.sql b/dex/models/trades/bnb/dex_bnb_base_trades.sql similarity index 100% rename from models/_sector/dex/trades/bnb/dex_bnb_base_trades.sql rename to dex/models/trades/bnb/dex_bnb_base_trades.sql diff --git a/models/_sector/dex/trades/bnb/platforms/airswap_bnb_base_trades.sql b/dex/models/trades/bnb/platforms/airswap_bnb_base_trades.sql similarity index 100% rename from models/_sector/dex/trades/bnb/platforms/airswap_bnb_base_trades.sql rename to dex/models/trades/bnb/platforms/airswap_bnb_base_trades.sql diff --git a/models/_sector/dex/trades/bnb/platforms/apeswap_bnb_base_trades.sql b/dex/models/trades/bnb/platforms/apeswap_bnb_base_trades.sql similarity index 100% rename from models/_sector/dex/trades/bnb/platforms/apeswap_bnb_base_trades.sql rename to dex/models/trades/bnb/platforms/apeswap_bnb_base_trades.sql diff --git a/models/_sector/dex/trades/bnb/platforms/babyswap_bnb_base_trades.sql b/dex/models/trades/bnb/platforms/babyswap_bnb_base_trades.sql similarity index 100% rename from models/_sector/dex/trades/bnb/platforms/babyswap_bnb_base_trades.sql rename to dex/models/trades/bnb/platforms/babyswap_bnb_base_trades.sql diff --git a/models/_sector/dex/trades/bnb/platforms/biswap_v2_bnb_base_trades.sql b/dex/models/trades/bnb/platforms/biswap_v2_bnb_base_trades.sql similarity index 100% rename from models/_sector/dex/trades/bnb/platforms/biswap_v2_bnb_base_trades.sql rename to dex/models/trades/bnb/platforms/biswap_v2_bnb_base_trades.sql diff --git a/models/_sector/dex/trades/bnb/platforms/biswap_v3_bnb_base_trades.sql b/dex/models/trades/bnb/platforms/biswap_v3_bnb_base_trades.sql similarity index 100% rename from models/_sector/dex/trades/bnb/platforms/biswap_v3_bnb_base_trades.sql rename to dex/models/trades/bnb/platforms/biswap_v3_bnb_base_trades.sql diff --git a/models/_sector/dex/trades/bnb/platforms/dodo_bnb_base_trades.sql b/dex/models/trades/bnb/platforms/dodo_bnb_base_trades.sql similarity index 100% rename from models/_sector/dex/trades/bnb/platforms/dodo_bnb_base_trades.sql rename to dex/models/trades/bnb/platforms/dodo_bnb_base_trades.sql diff --git a/models/_sector/dex/trades/bnb/platforms/ellipsis_finance_bnb_base_trades.sql b/dex/models/trades/bnb/platforms/ellipsis_finance_bnb_base_trades.sql similarity index 100% rename from models/_sector/dex/trades/bnb/platforms/ellipsis_finance_bnb_base_trades.sql rename to dex/models/trades/bnb/platforms/ellipsis_finance_bnb_base_trades.sql diff --git a/models/_sector/dex/trades/bnb/platforms/fraxswap_bnb_base_trades.sql b/dex/models/trades/bnb/platforms/fraxswap_bnb_base_trades.sql similarity index 100% rename from models/_sector/dex/trades/bnb/platforms/fraxswap_bnb_base_trades.sql rename to dex/models/trades/bnb/platforms/fraxswap_bnb_base_trades.sql diff --git a/models/_sector/dex/trades/bnb/platforms/hashflow_bnb_base_trades.sql b/dex/models/trades/bnb/platforms/hashflow_bnb_base_trades.sql similarity index 100% rename from models/_sector/dex/trades/bnb/platforms/hashflow_bnb_base_trades.sql rename to dex/models/trades/bnb/platforms/hashflow_bnb_base_trades.sql diff --git a/models/_sector/dex/trades/bnb/platforms/iziswap_bnb_base_trades.sql b/dex/models/trades/bnb/platforms/iziswap_bnb_base_trades.sql similarity index 100% rename from models/_sector/dex/trades/bnb/platforms/iziswap_bnb_base_trades.sql rename to dex/models/trades/bnb/platforms/iziswap_bnb_base_trades.sql diff --git a/models/_sector/dex/trades/bnb/platforms/kyberswap_bnb_base_trades.sql b/dex/models/trades/bnb/platforms/kyberswap_bnb_base_trades.sql similarity index 100% rename from models/_sector/dex/trades/bnb/platforms/kyberswap_bnb_base_trades.sql rename to dex/models/trades/bnb/platforms/kyberswap_bnb_base_trades.sql diff --git a/models/_sector/dex/trades/bnb/platforms/maverick_bnb_base_trades.sql b/dex/models/trades/bnb/platforms/maverick_bnb_base_trades.sql similarity index 100% rename from models/_sector/dex/trades/bnb/platforms/maverick_bnb_base_trades.sql rename to dex/models/trades/bnb/platforms/maverick_bnb_base_trades.sql diff --git a/models/_sector/dex/trades/bnb/platforms/mdex_bnb_base_trades.sql b/dex/models/trades/bnb/platforms/mdex_bnb_base_trades.sql similarity index 100% rename from models/_sector/dex/trades/bnb/platforms/mdex_bnb_base_trades.sql rename to dex/models/trades/bnb/platforms/mdex_bnb_base_trades.sql diff --git a/models/_sector/dex/trades/bnb/platforms/nomiswap_bnb_base_trades.sql b/dex/models/trades/bnb/platforms/nomiswap_bnb_base_trades.sql similarity index 100% rename from models/_sector/dex/trades/bnb/platforms/nomiswap_bnb_base_trades.sql rename to dex/models/trades/bnb/platforms/nomiswap_bnb_base_trades.sql diff --git a/models/_sector/dex/trades/bnb/platforms/onepunchswap_bnb_base_trades.sql b/dex/models/trades/bnb/platforms/onepunchswap_bnb_base_trades.sql similarity index 100% rename from models/_sector/dex/trades/bnb/platforms/onepunchswap_bnb_base_trades.sql rename to dex/models/trades/bnb/platforms/onepunchswap_bnb_base_trades.sql diff --git a/models/_sector/dex/trades/bnb/platforms/pancakeswap_v2_bnb_base_trades.sql b/dex/models/trades/bnb/platforms/pancakeswap_v2_bnb_base_trades.sql similarity index 100% rename from models/_sector/dex/trades/bnb/platforms/pancakeswap_v2_bnb_base_trades.sql rename to dex/models/trades/bnb/platforms/pancakeswap_v2_bnb_base_trades.sql diff --git a/models/_sector/dex/trades/bnb/platforms/pancakeswap_v3_bnb_base_trades.sql b/dex/models/trades/bnb/platforms/pancakeswap_v3_bnb_base_trades.sql similarity index 100% rename from models/_sector/dex/trades/bnb/platforms/pancakeswap_v3_bnb_base_trades.sql rename to dex/models/trades/bnb/platforms/pancakeswap_v3_bnb_base_trades.sql diff --git a/models/_sector/dex/trades/bnb/platforms/sushiswap_v1_bnb_base_trades.sql b/dex/models/trades/bnb/platforms/sushiswap_v1_bnb_base_trades.sql similarity index 100% rename from models/_sector/dex/trades/bnb/platforms/sushiswap_v1_bnb_base_trades.sql rename to dex/models/trades/bnb/platforms/sushiswap_v1_bnb_base_trades.sql diff --git a/models/_sector/dex/trades/bnb/platforms/sushiswap_v2_bnb_base_trades.sql b/dex/models/trades/bnb/platforms/sushiswap_v2_bnb_base_trades.sql similarity index 100% rename from models/_sector/dex/trades/bnb/platforms/sushiswap_v2_bnb_base_trades.sql rename to dex/models/trades/bnb/platforms/sushiswap_v2_bnb_base_trades.sql diff --git a/models/_sector/dex/trades/bnb/platforms/thena_bnb_base_trades.sql b/dex/models/trades/bnb/platforms/thena_bnb_base_trades.sql similarity index 100% rename from models/_sector/dex/trades/bnb/platforms/thena_bnb_base_trades.sql rename to dex/models/trades/bnb/platforms/thena_bnb_base_trades.sql diff --git a/models/_sector/dex/trades/bnb/platforms/trader_joe_v2_1_bnb_base_trades.sql b/dex/models/trades/bnb/platforms/trader_joe_v2_1_bnb_base_trades.sql similarity index 100% rename from models/_sector/dex/trades/bnb/platforms/trader_joe_v2_1_bnb_base_trades.sql rename to dex/models/trades/bnb/platforms/trader_joe_v2_1_bnb_base_trades.sql diff --git a/models/_sector/dex/trades/bnb/platforms/trader_joe_v2_bnb_base_trades.sql b/dex/models/trades/bnb/platforms/trader_joe_v2_bnb_base_trades.sql similarity index 100% rename from models/_sector/dex/trades/bnb/platforms/trader_joe_v2_bnb_base_trades.sql rename to dex/models/trades/bnb/platforms/trader_joe_v2_bnb_base_trades.sql diff --git a/models/_sector/dex/trades/bnb/platforms/uniswap_v2_bnb_base_trades.sql b/dex/models/trades/bnb/platforms/uniswap_v2_bnb_base_trades.sql similarity index 100% rename from models/_sector/dex/trades/bnb/platforms/uniswap_v2_bnb_base_trades.sql rename to dex/models/trades/bnb/platforms/uniswap_v2_bnb_base_trades.sql diff --git a/models/_sector/dex/trades/bnb/platforms/uniswap_v3_bnb_base_trades.sql b/dex/models/trades/bnb/platforms/uniswap_v3_bnb_base_trades.sql similarity index 100% rename from models/_sector/dex/trades/bnb/platforms/uniswap_v3_bnb_base_trades.sql rename to dex/models/trades/bnb/platforms/uniswap_v3_bnb_base_trades.sql diff --git a/models/_sector/dex/trades/bnb/platforms/wombat_bnb_base_trades.sql b/dex/models/trades/bnb/platforms/wombat_bnb_base_trades.sql similarity index 100% rename from models/_sector/dex/trades/bnb/platforms/wombat_bnb_base_trades.sql rename to dex/models/trades/bnb/platforms/wombat_bnb_base_trades.sql diff --git a/models/_sector/dex/trades/bnb/platforms/woofi_bnb_base_trades.sql b/dex/models/trades/bnb/platforms/woofi_bnb_base_trades.sql similarity index 100% rename from models/_sector/dex/trades/bnb/platforms/woofi_bnb_base_trades.sql rename to dex/models/trades/bnb/platforms/woofi_bnb_base_trades.sql diff --git a/models/_sector/dex/trades/bnb/platforms/xchange_bnb_base_trades.sql b/dex/models/trades/bnb/platforms/xchange_bnb_base_trades.sql similarity index 100% rename from models/_sector/dex/trades/bnb/platforms/xchange_bnb_base_trades.sql rename to dex/models/trades/bnb/platforms/xchange_bnb_base_trades.sql diff --git a/models/_sector/dex/trades/celo/_schema.yml b/dex/models/trades/celo/_schema.yml similarity index 100% rename from models/_sector/dex/trades/celo/_schema.yml rename to dex/models/trades/celo/_schema.yml diff --git a/models/_sector/dex/trades/celo/dex_celo_base_trades.sql b/dex/models/trades/celo/dex_celo_base_trades.sql similarity index 100% rename from models/_sector/dex/trades/celo/dex_celo_base_trades.sql rename to dex/models/trades/celo/dex_celo_base_trades.sql diff --git a/models/_sector/dex/trades/celo/platforms/carbonhood_celo_base_trades.sql b/dex/models/trades/celo/platforms/carbonhood_celo_base_trades.sql similarity index 100% rename from models/_sector/dex/trades/celo/platforms/carbonhood_celo_base_trades.sql rename to dex/models/trades/celo/platforms/carbonhood_celo_base_trades.sql diff --git a/models/_sector/dex/trades/celo/platforms/curvefi_celo_base_trades.sql b/dex/models/trades/celo/platforms/curvefi_celo_base_trades.sql similarity index 100% rename from models/_sector/dex/trades/celo/platforms/curvefi_celo_base_trades.sql rename to dex/models/trades/celo/platforms/curvefi_celo_base_trades.sql diff --git a/models/_sector/dex/trades/celo/platforms/mento_v1_celo_base_trades.sql b/dex/models/trades/celo/platforms/mento_v1_celo_base_trades.sql similarity index 100% rename from models/_sector/dex/trades/celo/platforms/mento_v1_celo_base_trades.sql rename to dex/models/trades/celo/platforms/mento_v1_celo_base_trades.sql diff --git a/models/_sector/dex/trades/celo/platforms/mento_v2_celo_base_trades.sql b/dex/models/trades/celo/platforms/mento_v2_celo_base_trades.sql similarity index 100% rename from models/_sector/dex/trades/celo/platforms/mento_v2_celo_base_trades.sql rename to dex/models/trades/celo/platforms/mento_v2_celo_base_trades.sql diff --git a/models/_sector/dex/trades/celo/platforms/sushiswap_celo_base_trades.sql b/dex/models/trades/celo/platforms/sushiswap_celo_base_trades.sql similarity index 100% rename from models/_sector/dex/trades/celo/platforms/sushiswap_celo_base_trades.sql rename to dex/models/trades/celo/platforms/sushiswap_celo_base_trades.sql diff --git a/models/_sector/dex/trades/celo/platforms/ubeswap_celo_base_trades.sql b/dex/models/trades/celo/platforms/ubeswap_celo_base_trades.sql similarity index 100% rename from models/_sector/dex/trades/celo/platforms/ubeswap_celo_base_trades.sql rename to dex/models/trades/celo/platforms/ubeswap_celo_base_trades.sql diff --git a/models/_sector/dex/trades/celo/platforms/uniswap_v3_celo_base_trades.sql b/dex/models/trades/celo/platforms/uniswap_v3_celo_base_trades.sql similarity index 100% rename from models/_sector/dex/trades/celo/platforms/uniswap_v3_celo_base_trades.sql rename to dex/models/trades/celo/platforms/uniswap_v3_celo_base_trades.sql diff --git a/models/_sector/dex/trades/dex_base_trades.sql b/dex/models/trades/dex_base_trades.sql similarity index 100% rename from models/_sector/dex/trades/dex_base_trades.sql rename to dex/models/trades/dex_base_trades.sql diff --git a/models/_sector/dex/trades/dex_trades.sql b/dex/models/trades/dex_trades.sql similarity index 100% rename from models/_sector/dex/trades/dex_trades.sql rename to dex/models/trades/dex_trades.sql diff --git a/models/_sector/dex/trades/ethereum/_schema.yml b/dex/models/trades/ethereum/_schema.yml similarity index 100% rename from models/_sector/dex/trades/ethereum/_schema.yml rename to dex/models/trades/ethereum/_schema.yml diff --git a/models/_sector/dex/trades/ethereum/dex_ethereum_base_trades.sql b/dex/models/trades/ethereum/dex_ethereum_base_trades.sql similarity index 100% rename from models/_sector/dex/trades/ethereum/dex_ethereum_base_trades.sql rename to dex/models/trades/ethereum/dex_ethereum_base_trades.sql diff --git a/models/_sector/dex/trades/ethereum/platforms/airswap_ethereum_base_trades.sql b/dex/models/trades/ethereum/platforms/airswap_ethereum_base_trades.sql similarity index 100% rename from models/_sector/dex/trades/ethereum/platforms/airswap_ethereum_base_trades.sql rename to dex/models/trades/ethereum/platforms/airswap_ethereum_base_trades.sql diff --git a/models/_sector/dex/trades/ethereum/platforms/apeswap_ethereum_base_trades.sql b/dex/models/trades/ethereum/platforms/apeswap_ethereum_base_trades.sql similarity index 100% rename from models/_sector/dex/trades/ethereum/platforms/apeswap_ethereum_base_trades.sql rename to dex/models/trades/ethereum/platforms/apeswap_ethereum_base_trades.sql diff --git a/models/_sector/dex/trades/ethereum/platforms/balancer_v1_ethereum_base_trades.sql b/dex/models/trades/ethereum/platforms/balancer_v1_ethereum_base_trades.sql similarity index 100% rename from models/_sector/dex/trades/ethereum/platforms/balancer_v1_ethereum_base_trades.sql rename to dex/models/trades/ethereum/platforms/balancer_v1_ethereum_base_trades.sql diff --git a/models/_sector/dex/trades/ethereum/platforms/balancer_v2_ethereum_base_trades.sql b/dex/models/trades/ethereum/platforms/balancer_v2_ethereum_base_trades.sql similarity index 100% rename from models/_sector/dex/trades/ethereum/platforms/balancer_v2_ethereum_base_trades.sql rename to dex/models/trades/ethereum/platforms/balancer_v2_ethereum_base_trades.sql diff --git a/models/_sector/dex/trades/ethereum/platforms/bancor_ethereum_base_trades.sql b/dex/models/trades/ethereum/platforms/bancor_ethereum_base_trades.sql similarity index 100% rename from models/_sector/dex/trades/ethereum/platforms/bancor_ethereum_base_trades.sql rename to dex/models/trades/ethereum/platforms/bancor_ethereum_base_trades.sql diff --git a/models/_sector/dex/trades/ethereum/platforms/carbon_defi_ethereum_base_trades.sql b/dex/models/trades/ethereum/platforms/carbon_defi_ethereum_base_trades.sql similarity index 100% rename from models/_sector/dex/trades/ethereum/platforms/carbon_defi_ethereum_base_trades.sql rename to dex/models/trades/ethereum/platforms/carbon_defi_ethereum_base_trades.sql diff --git a/models/_sector/dex/trades/ethereum/platforms/clipper_ethereum_base_trades.sql b/dex/models/trades/ethereum/platforms/clipper_ethereum_base_trades.sql similarity index 100% rename from models/_sector/dex/trades/ethereum/platforms/clipper_ethereum_base_trades.sql rename to dex/models/trades/ethereum/platforms/clipper_ethereum_base_trades.sql diff --git a/models/_sector/dex/trades/ethereum/platforms/curvefi_ethereum_base_trades.sql b/dex/models/trades/ethereum/platforms/curvefi_ethereum_base_trades.sql similarity index 100% rename from models/_sector/dex/trades/ethereum/platforms/curvefi_ethereum_base_trades.sql rename to dex/models/trades/ethereum/platforms/curvefi_ethereum_base_trades.sql diff --git a/models/_sector/dex/trades/ethereum/platforms/defiswap_ethereum_base_trades.sql b/dex/models/trades/ethereum/platforms/defiswap_ethereum_base_trades.sql similarity index 100% rename from models/_sector/dex/trades/ethereum/platforms/defiswap_ethereum_base_trades.sql rename to dex/models/trades/ethereum/platforms/defiswap_ethereum_base_trades.sql diff --git a/models/_sector/dex/trades/ethereum/platforms/dfx_ethereum_base_trades.sql b/dex/models/trades/ethereum/platforms/dfx_ethereum_base_trades.sql similarity index 100% rename from models/_sector/dex/trades/ethereum/platforms/dfx_ethereum_base_trades.sql rename to dex/models/trades/ethereum/platforms/dfx_ethereum_base_trades.sql diff --git a/models/_sector/dex/trades/ethereum/platforms/dodo_ethereum_base_trades.sql b/dex/models/trades/ethereum/platforms/dodo_ethereum_base_trades.sql similarity index 100% rename from models/_sector/dex/trades/ethereum/platforms/dodo_ethereum_base_trades.sql rename to dex/models/trades/ethereum/platforms/dodo_ethereum_base_trades.sql diff --git a/models/_sector/dex/trades/ethereum/platforms/fraxswap_ethereum_base_trades.sql b/dex/models/trades/ethereum/platforms/fraxswap_ethereum_base_trades.sql similarity index 100% rename from models/_sector/dex/trades/ethereum/platforms/fraxswap_ethereum_base_trades.sql rename to dex/models/trades/ethereum/platforms/fraxswap_ethereum_base_trades.sql diff --git a/models/_sector/dex/trades/ethereum/platforms/integral_ethereum_base_trades.sql b/dex/models/trades/ethereum/platforms/integral_ethereum_base_trades.sql similarity index 100% rename from models/_sector/dex/trades/ethereum/platforms/integral_ethereum_base_trades.sql rename to dex/models/trades/ethereum/platforms/integral_ethereum_base_trades.sql diff --git a/models/_sector/dex/trades/ethereum/platforms/kyberswap_ethereum_base_trades.sql b/dex/models/trades/ethereum/platforms/kyberswap_ethereum_base_trades.sql similarity index 100% rename from models/_sector/dex/trades/ethereum/platforms/kyberswap_ethereum_base_trades.sql rename to dex/models/trades/ethereum/platforms/kyberswap_ethereum_base_trades.sql diff --git a/models/_sector/dex/trades/ethereum/platforms/mauve_ethereum_base_trades.sql b/dex/models/trades/ethereum/platforms/mauve_ethereum_base_trades.sql similarity index 100% rename from models/_sector/dex/trades/ethereum/platforms/mauve_ethereum_base_trades.sql rename to dex/models/trades/ethereum/platforms/mauve_ethereum_base_trades.sql diff --git a/models/_sector/dex/trades/ethereum/platforms/maverick_ethereum_base_trades.sql b/dex/models/trades/ethereum/platforms/maverick_ethereum_base_trades.sql similarity index 100% rename from models/_sector/dex/trades/ethereum/platforms/maverick_ethereum_base_trades.sql rename to dex/models/trades/ethereum/platforms/maverick_ethereum_base_trades.sql diff --git a/models/_sector/dex/trades/ethereum/platforms/mstable_ethereum_base_trades.sql b/dex/models/trades/ethereum/platforms/mstable_ethereum_base_trades.sql similarity index 100% rename from models/_sector/dex/trades/ethereum/platforms/mstable_ethereum_base_trades.sql rename to dex/models/trades/ethereum/platforms/mstable_ethereum_base_trades.sql diff --git a/models/_sector/dex/trades/ethereum/platforms/pancakeswap_v2_ethereum_base_trades.sql b/dex/models/trades/ethereum/platforms/pancakeswap_v2_ethereum_base_trades.sql similarity index 100% rename from models/_sector/dex/trades/ethereum/platforms/pancakeswap_v2_ethereum_base_trades.sql rename to dex/models/trades/ethereum/platforms/pancakeswap_v2_ethereum_base_trades.sql diff --git a/models/_sector/dex/trades/ethereum/platforms/pancakeswap_v3_ethereum_base_trades.sql b/dex/models/trades/ethereum/platforms/pancakeswap_v3_ethereum_base_trades.sql similarity index 100% rename from models/_sector/dex/trades/ethereum/platforms/pancakeswap_v3_ethereum_base_trades.sql rename to dex/models/trades/ethereum/platforms/pancakeswap_v3_ethereum_base_trades.sql diff --git a/models/_sector/dex/trades/ethereum/platforms/shibaswap_v1_ethereum_base_trades.sql b/dex/models/trades/ethereum/platforms/shibaswap_v1_ethereum_base_trades.sql similarity index 100% rename from models/_sector/dex/trades/ethereum/platforms/shibaswap_v1_ethereum_base_trades.sql rename to dex/models/trades/ethereum/platforms/shibaswap_v1_ethereum_base_trades.sql diff --git a/models/_sector/dex/trades/ethereum/platforms/solidly_v3_ethereum_base_trades.sql b/dex/models/trades/ethereum/platforms/solidly_v3_ethereum_base_trades.sql similarity index 100% rename from models/_sector/dex/trades/ethereum/platforms/solidly_v3_ethereum_base_trades.sql rename to dex/models/trades/ethereum/platforms/solidly_v3_ethereum_base_trades.sql diff --git a/models/_sector/dex/trades/ethereum/platforms/sushiswap_v1_ethereum_base_trades.sql b/dex/models/trades/ethereum/platforms/sushiswap_v1_ethereum_base_trades.sql similarity index 100% rename from models/_sector/dex/trades/ethereum/platforms/sushiswap_v1_ethereum_base_trades.sql rename to dex/models/trades/ethereum/platforms/sushiswap_v1_ethereum_base_trades.sql diff --git a/models/_sector/dex/trades/ethereum/platforms/sushiswap_v2_ethereum_base_trades.sql b/dex/models/trades/ethereum/platforms/sushiswap_v2_ethereum_base_trades.sql similarity index 100% rename from models/_sector/dex/trades/ethereum/platforms/sushiswap_v2_ethereum_base_trades.sql rename to dex/models/trades/ethereum/platforms/sushiswap_v2_ethereum_base_trades.sql diff --git a/models/_sector/dex/trades/ethereum/platforms/swapr_ethereum_base_trades.sql b/dex/models/trades/ethereum/platforms/swapr_ethereum_base_trades.sql similarity index 100% rename from models/_sector/dex/trades/ethereum/platforms/swapr_ethereum_base_trades.sql rename to dex/models/trades/ethereum/platforms/swapr_ethereum_base_trades.sql diff --git a/models/_sector/dex/trades/ethereum/platforms/uniswap_v1_ethereum_base_trades.sql b/dex/models/trades/ethereum/platforms/uniswap_v1_ethereum_base_trades.sql similarity index 100% rename from models/_sector/dex/trades/ethereum/platforms/uniswap_v1_ethereum_base_trades.sql rename to dex/models/trades/ethereum/platforms/uniswap_v1_ethereum_base_trades.sql diff --git a/models/_sector/dex/trades/ethereum/platforms/uniswap_v2_ethereum_base_trades.sql b/dex/models/trades/ethereum/platforms/uniswap_v2_ethereum_base_trades.sql similarity index 100% rename from models/_sector/dex/trades/ethereum/platforms/uniswap_v2_ethereum_base_trades.sql rename to dex/models/trades/ethereum/platforms/uniswap_v2_ethereum_base_trades.sql diff --git a/models/_sector/dex/trades/ethereum/platforms/uniswap_v3_ethereum_base_trades.sql b/dex/models/trades/ethereum/platforms/uniswap_v3_ethereum_base_trades.sql similarity index 100% rename from models/_sector/dex/trades/ethereum/platforms/uniswap_v3_ethereum_base_trades.sql rename to dex/models/trades/ethereum/platforms/uniswap_v3_ethereum_base_trades.sql diff --git a/models/_sector/dex/trades/ethereum/platforms/verse_dex_ethereum_base_trades.sql b/dex/models/trades/ethereum/platforms/verse_dex_ethereum_base_trades.sql similarity index 100% rename from models/_sector/dex/trades/ethereum/platforms/verse_dex_ethereum_base_trades.sql rename to dex/models/trades/ethereum/platforms/verse_dex_ethereum_base_trades.sql diff --git a/models/_sector/dex/trades/ethereum/platforms/xchange_ethereum_base_trades.sql b/dex/models/trades/ethereum/platforms/xchange_ethereum_base_trades.sql similarity index 100% rename from models/_sector/dex/trades/ethereum/platforms/xchange_ethereum_base_trades.sql rename to dex/models/trades/ethereum/platforms/xchange_ethereum_base_trades.sql diff --git a/models/_sector/dex/trades/fantom/_schema.yml b/dex/models/trades/fantom/_schema.yml similarity index 100% rename from models/_sector/dex/trades/fantom/_schema.yml rename to dex/models/trades/fantom/_schema.yml diff --git a/models/_sector/dex/trades/fantom/dex_fantom_base_trades.sql b/dex/models/trades/fantom/dex_fantom_base_trades.sql similarity index 100% rename from models/_sector/dex/trades/fantom/dex_fantom_base_trades.sql rename to dex/models/trades/fantom/dex_fantom_base_trades.sql diff --git a/models/_sector/dex/trades/fantom/platforms/beethoven_x_fantom_base_trades.sql b/dex/models/trades/fantom/platforms/beethoven_x_fantom_base_trades.sql similarity index 100% rename from models/_sector/dex/trades/fantom/platforms/beethoven_x_fantom_base_trades.sql rename to dex/models/trades/fantom/platforms/beethoven_x_fantom_base_trades.sql diff --git a/models/_sector/dex/trades/fantom/platforms/curvefi_fantom_base_trades.sql b/dex/models/trades/fantom/platforms/curvefi_fantom_base_trades.sql similarity index 100% rename from models/_sector/dex/trades/fantom/platforms/curvefi_fantom_base_trades.sql rename to dex/models/trades/fantom/platforms/curvefi_fantom_base_trades.sql diff --git a/models/_sector/dex/trades/fantom/platforms/equalizer_fantom_base_trades.sql b/dex/models/trades/fantom/platforms/equalizer_fantom_base_trades.sql similarity index 100% rename from models/_sector/dex/trades/fantom/platforms/equalizer_fantom_base_trades.sql rename to dex/models/trades/fantom/platforms/equalizer_fantom_base_trades.sql diff --git a/models/_sector/dex/trades/fantom/platforms/openocean_fantom_base_trades.sql b/dex/models/trades/fantom/platforms/openocean_fantom_base_trades.sql similarity index 100% rename from models/_sector/dex/trades/fantom/platforms/openocean_fantom_base_trades.sql rename to dex/models/trades/fantom/platforms/openocean_fantom_base_trades.sql diff --git a/models/_sector/dex/trades/fantom/platforms/solidly_v3_fantom_base_trades.sql b/dex/models/trades/fantom/platforms/solidly_v3_fantom_base_trades.sql similarity index 100% rename from models/_sector/dex/trades/fantom/platforms/solidly_v3_fantom_base_trades.sql rename to dex/models/trades/fantom/platforms/solidly_v3_fantom_base_trades.sql diff --git a/models/_sector/dex/trades/fantom/platforms/spartacus_exchange_fantom_base_trades.sql b/dex/models/trades/fantom/platforms/spartacus_exchange_fantom_base_trades.sql similarity index 100% rename from models/_sector/dex/trades/fantom/platforms/spartacus_exchange_fantom_base_trades.sql rename to dex/models/trades/fantom/platforms/spartacus_exchange_fantom_base_trades.sql diff --git a/models/_sector/dex/trades/fantom/platforms/spiritswap_fantom_base_trades.sql b/dex/models/trades/fantom/platforms/spiritswap_fantom_base_trades.sql similarity index 100% rename from models/_sector/dex/trades/fantom/platforms/spiritswap_fantom_base_trades.sql rename to dex/models/trades/fantom/platforms/spiritswap_fantom_base_trades.sql diff --git a/models/_sector/dex/trades/fantom/platforms/spookyswap_fantom_base_trades.sql b/dex/models/trades/fantom/platforms/spookyswap_fantom_base_trades.sql similarity index 100% rename from models/_sector/dex/trades/fantom/platforms/spookyswap_fantom_base_trades.sql rename to dex/models/trades/fantom/platforms/spookyswap_fantom_base_trades.sql diff --git a/models/_sector/dex/trades/fantom/platforms/sushiswap_v1_fantom_base_trades.sql b/dex/models/trades/fantom/platforms/sushiswap_v1_fantom_base_trades.sql similarity index 100% rename from models/_sector/dex/trades/fantom/platforms/sushiswap_v1_fantom_base_trades.sql rename to dex/models/trades/fantom/platforms/sushiswap_v1_fantom_base_trades.sql diff --git a/models/_sector/dex/trades/fantom/platforms/sushiswap_v2_fantom_base_trades.sql b/dex/models/trades/fantom/platforms/sushiswap_v2_fantom_base_trades.sql similarity index 100% rename from models/_sector/dex/trades/fantom/platforms/sushiswap_v2_fantom_base_trades.sql rename to dex/models/trades/fantom/platforms/sushiswap_v2_fantom_base_trades.sql diff --git a/models/_sector/dex/trades/fantom/platforms/wigoswap_fantom_base_trades.sql b/dex/models/trades/fantom/platforms/wigoswap_fantom_base_trades.sql similarity index 100% rename from models/_sector/dex/trades/fantom/platforms/wigoswap_fantom_base_trades.sql rename to dex/models/trades/fantom/platforms/wigoswap_fantom_base_trades.sql diff --git a/models/_sector/dex/trades/gnosis/_schema.yml b/dex/models/trades/gnosis/_schema.yml similarity index 100% rename from models/_sector/dex/trades/gnosis/_schema.yml rename to dex/models/trades/gnosis/_schema.yml diff --git a/models/_sector/dex/trades/gnosis/dex_gnosis_base_trades.sql b/dex/models/trades/gnosis/dex_gnosis_base_trades.sql similarity index 100% rename from models/_sector/dex/trades/gnosis/dex_gnosis_base_trades.sql rename to dex/models/trades/gnosis/dex_gnosis_base_trades.sql diff --git a/models/_sector/dex/trades/gnosis/platforms/balancer_v2_gnosis_base_trades.sql b/dex/models/trades/gnosis/platforms/balancer_v2_gnosis_base_trades.sql similarity index 100% rename from models/_sector/dex/trades/gnosis/platforms/balancer_v2_gnosis_base_trades.sql rename to dex/models/trades/gnosis/platforms/balancer_v2_gnosis_base_trades.sql diff --git a/models/_sector/dex/trades/gnosis/platforms/honeyswap_v2_gnosis_base_trades.sql b/dex/models/trades/gnosis/platforms/honeyswap_v2_gnosis_base_trades.sql similarity index 100% rename from models/_sector/dex/trades/gnosis/platforms/honeyswap_v2_gnosis_base_trades.sql rename to dex/models/trades/gnosis/platforms/honeyswap_v2_gnosis_base_trades.sql diff --git a/models/_sector/dex/trades/gnosis/platforms/sushiswap_v1_gnosis_base_trades.sql b/dex/models/trades/gnosis/platforms/sushiswap_v1_gnosis_base_trades.sql similarity index 100% rename from models/_sector/dex/trades/gnosis/platforms/sushiswap_v1_gnosis_base_trades.sql rename to dex/models/trades/gnosis/platforms/sushiswap_v1_gnosis_base_trades.sql diff --git a/models/_sector/dex/trades/gnosis/platforms/sushiswap_v2_gnosis_base_trades.sql b/dex/models/trades/gnosis/platforms/sushiswap_v2_gnosis_base_trades.sql similarity index 100% rename from models/_sector/dex/trades/gnosis/platforms/sushiswap_v2_gnosis_base_trades.sql rename to dex/models/trades/gnosis/platforms/sushiswap_v2_gnosis_base_trades.sql diff --git a/models/_sector/dex/trades/linea/_schema.yml b/dex/models/trades/linea/_schema.yml similarity index 100% rename from models/_sector/dex/trades/linea/_schema.yml rename to dex/models/trades/linea/_schema.yml diff --git a/models/_sector/dex/trades/linea/dex_linea_base_trades.sql b/dex/models/trades/linea/dex_linea_base_trades.sql similarity index 100% rename from models/_sector/dex/trades/linea/dex_linea_base_trades.sql rename to dex/models/trades/linea/dex_linea_base_trades.sql diff --git a/models/_sector/dex/trades/linea/platforms/echodex_linea_base_trades.sql b/dex/models/trades/linea/platforms/echodex_linea_base_trades.sql similarity index 100% rename from models/_sector/dex/trades/linea/platforms/echodex_linea_base_trades.sql rename to dex/models/trades/linea/platforms/echodex_linea_base_trades.sql diff --git a/models/_sector/dex/trades/linea/platforms/lynex_linea_base_trades.sql b/dex/models/trades/linea/platforms/lynex_linea_base_trades.sql similarity index 100% rename from models/_sector/dex/trades/linea/platforms/lynex_linea_base_trades.sql rename to dex/models/trades/linea/platforms/lynex_linea_base_trades.sql diff --git a/models/_sector/dex/trades/linea/platforms/nile_linea_base_trades.sql b/dex/models/trades/linea/platforms/nile_linea_base_trades.sql similarity index 100% rename from models/_sector/dex/trades/linea/platforms/nile_linea_base_trades.sql rename to dex/models/trades/linea/platforms/nile_linea_base_trades.sql diff --git a/models/_sector/dex/trades/linea/platforms/pancakeswap_v2_linea_base_trades.sql b/dex/models/trades/linea/platforms/pancakeswap_v2_linea_base_trades.sql similarity index 100% rename from models/_sector/dex/trades/linea/platforms/pancakeswap_v2_linea_base_trades.sql rename to dex/models/trades/linea/platforms/pancakeswap_v2_linea_base_trades.sql diff --git a/models/_sector/dex/trades/linea/platforms/pancakeswap_v3_linea_base_trades.sql b/dex/models/trades/linea/platforms/pancakeswap_v3_linea_base_trades.sql similarity index 100% rename from models/_sector/dex/trades/linea/platforms/pancakeswap_v3_linea_base_trades.sql rename to dex/models/trades/linea/platforms/pancakeswap_v3_linea_base_trades.sql diff --git a/models/_sector/dex/trades/linea/platforms/secta_linea_base_trades.sql b/dex/models/trades/linea/platforms/secta_linea_base_trades.sql similarity index 100% rename from models/_sector/dex/trades/linea/platforms/secta_linea_base_trades.sql rename to dex/models/trades/linea/platforms/secta_linea_base_trades.sql diff --git a/models/_sector/dex/trades/linea/platforms/sushiswap_v2_linea_base_trades.sql b/dex/models/trades/linea/platforms/sushiswap_v2_linea_base_trades.sql similarity index 100% rename from models/_sector/dex/trades/linea/platforms/sushiswap_v2_linea_base_trades.sql rename to dex/models/trades/linea/platforms/sushiswap_v2_linea_base_trades.sql diff --git a/models/_sector/dex/trades/optimism/_schema.yml b/dex/models/trades/optimism/_schema.yml similarity index 100% rename from models/_sector/dex/trades/optimism/_schema.yml rename to dex/models/trades/optimism/_schema.yml diff --git a/models/_sector/dex/trades/optimism/dex_optimism_base_trades.sql b/dex/models/trades/optimism/dex_optimism_base_trades.sql similarity index 100% rename from models/_sector/dex/trades/optimism/dex_optimism_base_trades.sql rename to dex/models/trades/optimism/dex_optimism_base_trades.sql diff --git a/models/_sector/dex/trades/optimism/platforms/balancer_v2_optimism_base_trades.sql b/dex/models/trades/optimism/platforms/balancer_v2_optimism_base_trades.sql similarity index 100% rename from models/_sector/dex/trades/optimism/platforms/balancer_v2_optimism_base_trades.sql rename to dex/models/trades/optimism/platforms/balancer_v2_optimism_base_trades.sql diff --git a/models/_sector/dex/trades/optimism/platforms/chainhop_optimism_base_trades.sql b/dex/models/trades/optimism/platforms/chainhop_optimism_base_trades.sql similarity index 100% rename from models/_sector/dex/trades/optimism/platforms/chainhop_optimism_base_trades.sql rename to dex/models/trades/optimism/platforms/chainhop_optimism_base_trades.sql diff --git a/models/_sector/dex/trades/optimism/platforms/clipper_optimism_base_trades.sql b/dex/models/trades/optimism/platforms/clipper_optimism_base_trades.sql similarity index 100% rename from models/_sector/dex/trades/optimism/platforms/clipper_optimism_base_trades.sql rename to dex/models/trades/optimism/platforms/clipper_optimism_base_trades.sql diff --git a/models/_sector/dex/trades/optimism/platforms/curvefi_optimism_base_trades.sql b/dex/models/trades/optimism/platforms/curvefi_optimism_base_trades.sql similarity index 100% rename from models/_sector/dex/trades/optimism/platforms/curvefi_optimism_base_trades.sql rename to dex/models/trades/optimism/platforms/curvefi_optimism_base_trades.sql diff --git a/models/_sector/dex/trades/optimism/platforms/dackieswap_v2_optimism_base_trades.sql b/dex/models/trades/optimism/platforms/dackieswap_v2_optimism_base_trades.sql similarity index 100% rename from models/_sector/dex/trades/optimism/platforms/dackieswap_v2_optimism_base_trades.sql rename to dex/models/trades/optimism/platforms/dackieswap_v2_optimism_base_trades.sql diff --git a/models/_sector/dex/trades/optimism/platforms/dackieswap_v3_optimism_base_trades.sql b/dex/models/trades/optimism/platforms/dackieswap_v3_optimism_base_trades.sql similarity index 100% rename from models/_sector/dex/trades/optimism/platforms/dackieswap_v3_optimism_base_trades.sql rename to dex/models/trades/optimism/platforms/dackieswap_v3_optimism_base_trades.sql diff --git a/models/_sector/dex/trades/optimism/platforms/dodo_optimism_base_trades.sql b/dex/models/trades/optimism/platforms/dodo_optimism_base_trades.sql similarity index 100% rename from models/_sector/dex/trades/optimism/platforms/dodo_optimism_base_trades.sql rename to dex/models/trades/optimism/platforms/dodo_optimism_base_trades.sql diff --git a/models/_sector/dex/trades/optimism/platforms/elk_finance_optimism_base_trades.sql b/dex/models/trades/optimism/platforms/elk_finance_optimism_base_trades.sql similarity index 100% rename from models/_sector/dex/trades/optimism/platforms/elk_finance_optimism_base_trades.sql rename to dex/models/trades/optimism/platforms/elk_finance_optimism_base_trades.sql diff --git a/models/_sector/dex/trades/optimism/platforms/fraxswap_optimism_base_trades.sql b/dex/models/trades/optimism/platforms/fraxswap_optimism_base_trades.sql similarity index 100% rename from models/_sector/dex/trades/optimism/platforms/fraxswap_optimism_base_trades.sql rename to dex/models/trades/optimism/platforms/fraxswap_optimism_base_trades.sql diff --git a/models/_sector/dex/trades/optimism/platforms/gridex_optimism_base_trades.sql b/dex/models/trades/optimism/platforms/gridex_optimism_base_trades.sql similarity index 100% rename from models/_sector/dex/trades/optimism/platforms/gridex_optimism_base_trades.sql rename to dex/models/trades/optimism/platforms/gridex_optimism_base_trades.sql diff --git a/models/_sector/dex/trades/optimism/platforms/hashflow_optimism_base_trades.sql b/dex/models/trades/optimism/platforms/hashflow_optimism_base_trades.sql similarity index 100% rename from models/_sector/dex/trades/optimism/platforms/hashflow_optimism_base_trades.sql rename to dex/models/trades/optimism/platforms/hashflow_optimism_base_trades.sql diff --git a/models/_sector/dex/trades/optimism/platforms/kyberswap_optimism_base_trades.sql b/dex/models/trades/optimism/platforms/kyberswap_optimism_base_trades.sql similarity index 100% rename from models/_sector/dex/trades/optimism/platforms/kyberswap_optimism_base_trades.sql rename to dex/models/trades/optimism/platforms/kyberswap_optimism_base_trades.sql diff --git a/models/_sector/dex/trades/optimism/platforms/mummy_finance_optimism_base_trades.sql b/dex/models/trades/optimism/platforms/mummy_finance_optimism_base_trades.sql similarity index 100% rename from models/_sector/dex/trades/optimism/platforms/mummy_finance_optimism_base_trades.sql rename to dex/models/trades/optimism/platforms/mummy_finance_optimism_base_trades.sql diff --git a/models/_sector/dex/trades/optimism/platforms/openocean_optimism_base_trades.sql b/dex/models/trades/optimism/platforms/openocean_optimism_base_trades.sql similarity index 100% rename from models/_sector/dex/trades/optimism/platforms/openocean_optimism_base_trades.sql rename to dex/models/trades/optimism/platforms/openocean_optimism_base_trades.sql diff --git a/models/_sector/dex/trades/optimism/platforms/openxswap_optimism_base_trades.sql b/dex/models/trades/optimism/platforms/openxswap_optimism_base_trades.sql similarity index 100% rename from models/_sector/dex/trades/optimism/platforms/openxswap_optimism_base_trades.sql rename to dex/models/trades/optimism/platforms/openxswap_optimism_base_trades.sql diff --git a/models/_sector/dex/trades/optimism/platforms/opx_finance_optimism_base_trades.sql b/dex/models/trades/optimism/platforms/opx_finance_optimism_base_trades.sql similarity index 100% rename from models/_sector/dex/trades/optimism/platforms/opx_finance_optimism_base_trades.sql rename to dex/models/trades/optimism/platforms/opx_finance_optimism_base_trades.sql diff --git a/models/_sector/dex/trades/optimism/platforms/rubicon_optimism_base_trades.sql b/dex/models/trades/optimism/platforms/rubicon_optimism_base_trades.sql similarity index 100% rename from models/_sector/dex/trades/optimism/platforms/rubicon_optimism_base_trades.sql rename to dex/models/trades/optimism/platforms/rubicon_optimism_base_trades.sql diff --git a/models/_sector/dex/trades/optimism/platforms/solidly_v3_optimism_base_trades.sql b/dex/models/trades/optimism/platforms/solidly_v3_optimism_base_trades.sql similarity index 100% rename from models/_sector/dex/trades/optimism/platforms/solidly_v3_optimism_base_trades.sql rename to dex/models/trades/optimism/platforms/solidly_v3_optimism_base_trades.sql diff --git a/models/_sector/dex/trades/optimism/platforms/sushiswap_v1_optimism_base_trades.sql b/dex/models/trades/optimism/platforms/sushiswap_v1_optimism_base_trades.sql similarity index 100% rename from models/_sector/dex/trades/optimism/platforms/sushiswap_v1_optimism_base_trades.sql rename to dex/models/trades/optimism/platforms/sushiswap_v1_optimism_base_trades.sql diff --git a/models/_sector/dex/trades/optimism/platforms/sushiswap_v2_optimism_base_trades.sql b/dex/models/trades/optimism/platforms/sushiswap_v2_optimism_base_trades.sql similarity index 100% rename from models/_sector/dex/trades/optimism/platforms/sushiswap_v2_optimism_base_trades.sql rename to dex/models/trades/optimism/platforms/sushiswap_v2_optimism_base_trades.sql diff --git a/models/_sector/dex/trades/optimism/platforms/synthetix_optimism_base_trades.sql b/dex/models/trades/optimism/platforms/synthetix_optimism_base_trades.sql similarity index 100% rename from models/_sector/dex/trades/optimism/platforms/synthetix_optimism_base_trades.sql rename to dex/models/trades/optimism/platforms/synthetix_optimism_base_trades.sql diff --git a/models/_sector/dex/trades/optimism/platforms/uniswap_v2_optimism_base_trades.sql b/dex/models/trades/optimism/platforms/uniswap_v2_optimism_base_trades.sql similarity index 100% rename from models/_sector/dex/trades/optimism/platforms/uniswap_v2_optimism_base_trades.sql rename to dex/models/trades/optimism/platforms/uniswap_v2_optimism_base_trades.sql diff --git a/models/_sector/dex/trades/optimism/platforms/uniswap_v3_optimism_base_trades.sql b/dex/models/trades/optimism/platforms/uniswap_v3_optimism_base_trades.sql similarity index 100% rename from models/_sector/dex/trades/optimism/platforms/uniswap_v3_optimism_base_trades.sql rename to dex/models/trades/optimism/platforms/uniswap_v3_optimism_base_trades.sql diff --git a/models/_sector/dex/trades/optimism/platforms/velodrome_optimism_base_trades.sql b/dex/models/trades/optimism/platforms/velodrome_optimism_base_trades.sql similarity index 100% rename from models/_sector/dex/trades/optimism/platforms/velodrome_optimism_base_trades.sql rename to dex/models/trades/optimism/platforms/velodrome_optimism_base_trades.sql diff --git a/models/_sector/dex/trades/optimism/platforms/wardenswap_optimism_base_trades.sql b/dex/models/trades/optimism/platforms/wardenswap_optimism_base_trades.sql similarity index 100% rename from models/_sector/dex/trades/optimism/platforms/wardenswap_optimism_base_trades.sql rename to dex/models/trades/optimism/platforms/wardenswap_optimism_base_trades.sql diff --git a/models/_sector/dex/trades/optimism/platforms/wombat_exchange_optimism_base_trades.sql b/dex/models/trades/optimism/platforms/wombat_exchange_optimism_base_trades.sql similarity index 100% rename from models/_sector/dex/trades/optimism/platforms/wombat_exchange_optimism_base_trades.sql rename to dex/models/trades/optimism/platforms/wombat_exchange_optimism_base_trades.sql diff --git a/models/_sector/dex/trades/optimism/platforms/woofi_optimism_base_trades.sql b/dex/models/trades/optimism/platforms/woofi_optimism_base_trades.sql similarity index 100% rename from models/_sector/dex/trades/optimism/platforms/woofi_optimism_base_trades.sql rename to dex/models/trades/optimism/platforms/woofi_optimism_base_trades.sql diff --git a/models/_sector/dex/trades/optimism/platforms/zipswap_optimism_base_trades.sql b/dex/models/trades/optimism/platforms/zipswap_optimism_base_trades.sql similarity index 100% rename from models/_sector/dex/trades/optimism/platforms/zipswap_optimism_base_trades.sql rename to dex/models/trades/optimism/platforms/zipswap_optimism_base_trades.sql diff --git a/models/_sector/dex/trades/polygon/_schema.yml b/dex/models/trades/polygon/_schema.yml similarity index 100% rename from models/_sector/dex/trades/polygon/_schema.yml rename to dex/models/trades/polygon/_schema.yml diff --git a/models/_sector/dex/trades/polygon/dex_polygon_base_trades.sql b/dex/models/trades/polygon/dex_polygon_base_trades.sql similarity index 100% rename from models/_sector/dex/trades/polygon/dex_polygon_base_trades.sql rename to dex/models/trades/polygon/dex_polygon_base_trades.sql diff --git a/models/_sector/dex/trades/polygon/platforms/airswap_polygon_base_trades.sql b/dex/models/trades/polygon/platforms/airswap_polygon_base_trades.sql similarity index 100% rename from models/_sector/dex/trades/polygon/platforms/airswap_polygon_base_trades.sql rename to dex/models/trades/polygon/platforms/airswap_polygon_base_trades.sql diff --git a/models/_sector/dex/trades/polygon/platforms/apeswap_polygon_base_trades.sql b/dex/models/trades/polygon/platforms/apeswap_polygon_base_trades.sql similarity index 100% rename from models/_sector/dex/trades/polygon/platforms/apeswap_polygon_base_trades.sql rename to dex/models/trades/polygon/platforms/apeswap_polygon_base_trades.sql diff --git a/models/_sector/dex/trades/polygon/platforms/balancer_v2_polygon_base_trades.sql b/dex/models/trades/polygon/platforms/balancer_v2_polygon_base_trades.sql similarity index 100% rename from models/_sector/dex/trades/polygon/platforms/balancer_v2_polygon_base_trades.sql rename to dex/models/trades/polygon/platforms/balancer_v2_polygon_base_trades.sql diff --git a/models/_sector/dex/trades/polygon/platforms/clipper_polygon_base_trades.sql b/dex/models/trades/polygon/platforms/clipper_polygon_base_trades.sql similarity index 100% rename from models/_sector/dex/trades/polygon/platforms/clipper_polygon_base_trades.sql rename to dex/models/trades/polygon/platforms/clipper_polygon_base_trades.sql diff --git a/models/_sector/dex/trades/polygon/platforms/dodo_polygon_base_trades.sql b/dex/models/trades/polygon/platforms/dodo_polygon_base_trades.sql similarity index 100% rename from models/_sector/dex/trades/polygon/platforms/dodo_polygon_base_trades.sql rename to dex/models/trades/polygon/platforms/dodo_polygon_base_trades.sql diff --git a/models/_sector/dex/trades/polygon/platforms/dooar_polygon_base_trades.sql b/dex/models/trades/polygon/platforms/dooar_polygon_base_trades.sql similarity index 100% rename from models/_sector/dex/trades/polygon/platforms/dooar_polygon_base_trades.sql rename to dex/models/trades/polygon/platforms/dooar_polygon_base_trades.sql diff --git a/models/_sector/dex/trades/polygon/platforms/fraxswap_polygon_base_trades.sql b/dex/models/trades/polygon/platforms/fraxswap_polygon_base_trades.sql similarity index 100% rename from models/_sector/dex/trades/polygon/platforms/fraxswap_polygon_base_trades.sql rename to dex/models/trades/polygon/platforms/fraxswap_polygon_base_trades.sql diff --git a/models/_sector/dex/trades/polygon/platforms/honeyswap_v2_polygon_base_trades.sql b/dex/models/trades/polygon/platforms/honeyswap_v2_polygon_base_trades.sql similarity index 100% rename from models/_sector/dex/trades/polygon/platforms/honeyswap_v2_polygon_base_trades.sql rename to dex/models/trades/polygon/platforms/honeyswap_v2_polygon_base_trades.sql diff --git a/models/_sector/dex/trades/polygon/platforms/kyberswap_polygon_base_trades.sql b/dex/models/trades/polygon/platforms/kyberswap_polygon_base_trades.sql similarity index 100% rename from models/_sector/dex/trades/polygon/platforms/kyberswap_polygon_base_trades.sql rename to dex/models/trades/polygon/platforms/kyberswap_polygon_base_trades.sql diff --git a/models/_sector/dex/trades/polygon/platforms/quickswap_v2_polygon_base_trades.sql b/dex/models/trades/polygon/platforms/quickswap_v2_polygon_base_trades.sql similarity index 100% rename from models/_sector/dex/trades/polygon/platforms/quickswap_v2_polygon_base_trades.sql rename to dex/models/trades/polygon/platforms/quickswap_v2_polygon_base_trades.sql diff --git a/models/_sector/dex/trades/polygon/platforms/quickswap_v3_polygon_base_trades.sql b/dex/models/trades/polygon/platforms/quickswap_v3_polygon_base_trades.sql similarity index 100% rename from models/_sector/dex/trades/polygon/platforms/quickswap_v3_polygon_base_trades.sql rename to dex/models/trades/polygon/platforms/quickswap_v3_polygon_base_trades.sql diff --git a/models/_sector/dex/trades/polygon/platforms/sushiswap_v1_polygon_base_trades.sql b/dex/models/trades/polygon/platforms/sushiswap_v1_polygon_base_trades.sql similarity index 100% rename from models/_sector/dex/trades/polygon/platforms/sushiswap_v1_polygon_base_trades.sql rename to dex/models/trades/polygon/platforms/sushiswap_v1_polygon_base_trades.sql diff --git a/models/_sector/dex/trades/polygon/platforms/sushiswap_v2_polygon_base_trades.sql b/dex/models/trades/polygon/platforms/sushiswap_v2_polygon_base_trades.sql similarity index 100% rename from models/_sector/dex/trades/polygon/platforms/sushiswap_v2_polygon_base_trades.sql rename to dex/models/trades/polygon/platforms/sushiswap_v2_polygon_base_trades.sql diff --git a/models/_sector/dex/trades/polygon/platforms/uniswap_v2_polygon_base_trades.sql b/dex/models/trades/polygon/platforms/uniswap_v2_polygon_base_trades.sql similarity index 100% rename from models/_sector/dex/trades/polygon/platforms/uniswap_v2_polygon_base_trades.sql rename to dex/models/trades/polygon/platforms/uniswap_v2_polygon_base_trades.sql diff --git a/models/_sector/dex/trades/polygon/platforms/uniswap_v3_polygon_base_trades.sql b/dex/models/trades/polygon/platforms/uniswap_v3_polygon_base_trades.sql similarity index 100% rename from models/_sector/dex/trades/polygon/platforms/uniswap_v3_polygon_base_trades.sql rename to dex/models/trades/polygon/platforms/uniswap_v3_polygon_base_trades.sql diff --git a/models/_sector/dex/trades/polygon/platforms/xchange_polygon_base_trades.sql b/dex/models/trades/polygon/platforms/xchange_polygon_base_trades.sql similarity index 100% rename from models/_sector/dex/trades/polygon/platforms/xchange_polygon_base_trades.sql rename to dex/models/trades/polygon/platforms/xchange_polygon_base_trades.sql diff --git a/models/_sector/dex/readme.md b/dex/models/trades/readme.md similarity index 100% rename from models/_sector/dex/readme.md rename to dex/models/trades/readme.md diff --git a/models/_sector/dex/trades/scroll/_schema.yml b/dex/models/trades/scroll/_schema.yml similarity index 100% rename from models/_sector/dex/trades/scroll/_schema.yml rename to dex/models/trades/scroll/_schema.yml diff --git a/models/_sector/dex/trades/scroll/dex_scroll_base_trades.sql b/dex/models/trades/scroll/dex_scroll_base_trades.sql similarity index 100% rename from models/_sector/dex/trades/scroll/dex_scroll_base_trades.sql rename to dex/models/trades/scroll/dex_scroll_base_trades.sql diff --git a/models/_sector/dex/trades/scroll/platforms/icecreamswap_v2_scroll_base_trades.sql b/dex/models/trades/scroll/platforms/icecreamswap_v2_scroll_base_trades.sql similarity index 100% rename from models/_sector/dex/trades/scroll/platforms/icecreamswap_v2_scroll_base_trades.sql rename to dex/models/trades/scroll/platforms/icecreamswap_v2_scroll_base_trades.sql diff --git a/models/_sector/dex/trades/scroll/platforms/iziswap_scroll_base_trades.sql b/dex/models/trades/scroll/platforms/iziswap_scroll_base_trades.sql similarity index 100% rename from models/_sector/dex/trades/scroll/platforms/iziswap_scroll_base_trades.sql rename to dex/models/trades/scroll/platforms/iziswap_scroll_base_trades.sql diff --git a/models/_sector/dex/trades/scroll/platforms/nuri_scroll_base_trades.sql b/dex/models/trades/scroll/platforms/nuri_scroll_base_trades.sql similarity index 100% rename from models/_sector/dex/trades/scroll/platforms/nuri_scroll_base_trades.sql rename to dex/models/trades/scroll/platforms/nuri_scroll_base_trades.sql diff --git a/models/_sector/dex/trades/scroll/platforms/scrollswap_scroll_base_trades.sql b/dex/models/trades/scroll/platforms/scrollswap_scroll_base_trades.sql similarity index 100% rename from models/_sector/dex/trades/scroll/platforms/scrollswap_scroll_base_trades.sql rename to dex/models/trades/scroll/platforms/scrollswap_scroll_base_trades.sql diff --git a/models/_sector/dex/trades/scroll/platforms/sushiswap_v2_scroll_base_trades.sql b/dex/models/trades/scroll/platforms/sushiswap_v2_scroll_base_trades.sql similarity index 100% rename from models/_sector/dex/trades/scroll/platforms/sushiswap_v2_scroll_base_trades.sql rename to dex/models/trades/scroll/platforms/sushiswap_v2_scroll_base_trades.sql diff --git a/models/_sector/dex/trades/scroll/platforms/syncswap_v1_scroll_base_trades.sql b/dex/models/trades/scroll/platforms/syncswap_v1_scroll_base_trades.sql similarity index 100% rename from models/_sector/dex/trades/scroll/platforms/syncswap_v1_scroll_base_trades.sql rename to dex/models/trades/scroll/platforms/syncswap_v1_scroll_base_trades.sql diff --git a/models/_sector/dex/trades/scroll/platforms/uniswap_v3_scroll_base_trades.sql b/dex/models/trades/scroll/platforms/uniswap_v3_scroll_base_trades.sql similarity index 100% rename from models/_sector/dex/trades/scroll/platforms/uniswap_v3_scroll_base_trades.sql rename to dex/models/trades/scroll/platforms/uniswap_v3_scroll_base_trades.sql diff --git a/models/_sector/dex/trades/scroll/platforms/zebra_scroll_base_trades.sql b/dex/models/trades/scroll/platforms/zebra_scroll_base_trades.sql similarity index 100% rename from models/_sector/dex/trades/scroll/platforms/zebra_scroll_base_trades.sql rename to dex/models/trades/scroll/platforms/zebra_scroll_base_trades.sql diff --git a/models/_sector/dex/trades/zkevm/_schema.yml b/dex/models/trades/zkevm/_schema.yml similarity index 100% rename from models/_sector/dex/trades/zkevm/_schema.yml rename to dex/models/trades/zkevm/_schema.yml diff --git a/models/_sector/dex/trades/zkevm/dex_zkevm_base_trades.sql b/dex/models/trades/zkevm/dex_zkevm_base_trades.sql similarity index 100% rename from models/_sector/dex/trades/zkevm/dex_zkevm_base_trades.sql rename to dex/models/trades/zkevm/dex_zkevm_base_trades.sql diff --git a/models/_sector/dex/trades/zkevm/platforms/balancer_v2_zkevm_base_trades.sql b/dex/models/trades/zkevm/platforms/balancer_v2_zkevm_base_trades.sql similarity index 100% rename from models/_sector/dex/trades/zkevm/platforms/balancer_v2_zkevm_base_trades.sql rename to dex/models/trades/zkevm/platforms/balancer_v2_zkevm_base_trades.sql diff --git a/models/_sector/dex/trades/zkevm/platforms/pancakeswap_v2_zkevm_base_trades.sql b/dex/models/trades/zkevm/platforms/pancakeswap_v2_zkevm_base_trades.sql similarity index 100% rename from models/_sector/dex/trades/zkevm/platforms/pancakeswap_v2_zkevm_base_trades.sql rename to dex/models/trades/zkevm/platforms/pancakeswap_v2_zkevm_base_trades.sql diff --git a/models/_sector/dex/trades/zkevm/platforms/pancakeswap_v3_zkevm_base_trades.sql b/dex/models/trades/zkevm/platforms/pancakeswap_v3_zkevm_base_trades.sql similarity index 100% rename from models/_sector/dex/trades/zkevm/platforms/pancakeswap_v3_zkevm_base_trades.sql rename to dex/models/trades/zkevm/platforms/pancakeswap_v3_zkevm_base_trades.sql diff --git a/models/_sector/dex/trades/zksync/_schema.yml b/dex/models/trades/zksync/_schema.yml similarity index 100% rename from models/_sector/dex/trades/zksync/_schema.yml rename to dex/models/trades/zksync/_schema.yml diff --git a/models/_sector/dex/trades/zksync/dex_zksync_base_trades.sql b/dex/models/trades/zksync/dex_zksync_base_trades.sql similarity index 100% rename from models/_sector/dex/trades/zksync/dex_zksync_base_trades.sql rename to dex/models/trades/zksync/dex_zksync_base_trades.sql diff --git a/models/_sector/dex/trades/zksync/platforms/derpdex_v1_zksync_base_trades.sql b/dex/models/trades/zksync/platforms/derpdex_v1_zksync_base_trades.sql similarity index 100% rename from models/_sector/dex/trades/zksync/platforms/derpdex_v1_zksync_base_trades.sql rename to dex/models/trades/zksync/platforms/derpdex_v1_zksync_base_trades.sql diff --git a/models/_sector/dex/trades/zksync/platforms/dracula_finance_zksync_base_trades.sql b/dex/models/trades/zksync/platforms/dracula_finance_zksync_base_trades.sql similarity index 100% rename from models/_sector/dex/trades/zksync/platforms/dracula_finance_zksync_base_trades.sql rename to dex/models/trades/zksync/platforms/dracula_finance_zksync_base_trades.sql diff --git a/models/_sector/dex/trades/zksync/platforms/ezkalibur_v2_zksync_base_trades.sql b/dex/models/trades/zksync/platforms/ezkalibur_v2_zksync_base_trades.sql similarity index 100% rename from models/_sector/dex/trades/zksync/platforms/ezkalibur_v2_zksync_base_trades.sql rename to dex/models/trades/zksync/platforms/ezkalibur_v2_zksync_base_trades.sql diff --git a/models/_sector/dex/trades/zksync/platforms/gemswap_zksync_base_trades.sql b/dex/models/trades/zksync/platforms/gemswap_zksync_base_trades.sql similarity index 100% rename from models/_sector/dex/trades/zksync/platforms/gemswap_zksync_base_trades.sql rename to dex/models/trades/zksync/platforms/gemswap_zksync_base_trades.sql diff --git a/models/_sector/dex/trades/zksync/platforms/iziswap_v1_zksync_base_trades.sql b/dex/models/trades/zksync/platforms/iziswap_v1_zksync_base_trades.sql similarity index 100% rename from models/_sector/dex/trades/zksync/platforms/iziswap_v1_zksync_base_trades.sql rename to dex/models/trades/zksync/platforms/iziswap_v1_zksync_base_trades.sql diff --git a/models/_sector/dex/trades/zksync/platforms/iziswap_v2_zksync_base_trades.sql b/dex/models/trades/zksync/platforms/iziswap_v2_zksync_base_trades.sql similarity index 100% rename from models/_sector/dex/trades/zksync/platforms/iziswap_v2_zksync_base_trades.sql rename to dex/models/trades/zksync/platforms/iziswap_v2_zksync_base_trades.sql diff --git a/models/_sector/dex/trades/zksync/platforms/maverick_zksync_base_trades.sql b/dex/models/trades/zksync/platforms/maverick_zksync_base_trades.sql similarity index 100% rename from models/_sector/dex/trades/zksync/platforms/maverick_zksync_base_trades.sql rename to dex/models/trades/zksync/platforms/maverick_zksync_base_trades.sql diff --git a/models/_sector/dex/trades/zksync/platforms/mute_zksync_base_trades.sql b/dex/models/trades/zksync/platforms/mute_zksync_base_trades.sql similarity index 100% rename from models/_sector/dex/trades/zksync/platforms/mute_zksync_base_trades.sql rename to dex/models/trades/zksync/platforms/mute_zksync_base_trades.sql diff --git a/models/_sector/dex/trades/zksync/platforms/pancakeswap_v2_zksync_base_trades.sql b/dex/models/trades/zksync/platforms/pancakeswap_v2_zksync_base_trades.sql similarity index 100% rename from models/_sector/dex/trades/zksync/platforms/pancakeswap_v2_zksync_base_trades.sql rename to dex/models/trades/zksync/platforms/pancakeswap_v2_zksync_base_trades.sql diff --git a/models/_sector/dex/trades/zksync/platforms/pancakeswap_v3_zksync_base_trades.sql b/dex/models/trades/zksync/platforms/pancakeswap_v3_zksync_base_trades.sql similarity index 100% rename from models/_sector/dex/trades/zksync/platforms/pancakeswap_v3_zksync_base_trades.sql rename to dex/models/trades/zksync/platforms/pancakeswap_v3_zksync_base_trades.sql diff --git a/models/_sector/dex/trades/zksync/platforms/spacefi_v1_zksync_base_trades.sql b/dex/models/trades/zksync/platforms/spacefi_v1_zksync_base_trades.sql similarity index 100% rename from models/_sector/dex/trades/zksync/platforms/spacefi_v1_zksync_base_trades.sql rename to dex/models/trades/zksync/platforms/spacefi_v1_zksync_base_trades.sql diff --git a/models/_sector/dex/trades/zksync/platforms/syncswap_v1_zksync_base_trades.sql b/dex/models/trades/zksync/platforms/syncswap_v1_zksync_base_trades.sql similarity index 100% rename from models/_sector/dex/trades/zksync/platforms/syncswap_v1_zksync_base_trades.sql rename to dex/models/trades/zksync/platforms/syncswap_v1_zksync_base_trades.sql diff --git a/models/_sector/dex/trades/zksync/platforms/syncswap_v2_zksync_base_trades.sql b/dex/models/trades/zksync/platforms/syncswap_v2_zksync_base_trades.sql similarity index 100% rename from models/_sector/dex/trades/zksync/platforms/syncswap_v2_zksync_base_trades.sql rename to dex/models/trades/zksync/platforms/syncswap_v2_zksync_base_trades.sql diff --git a/models/_sector/dex/trades/zksync/platforms/uniswap_v3_zksync_base_trades.sql b/dex/models/trades/zksync/platforms/uniswap_v3_zksync_base_trades.sql similarity index 100% rename from models/_sector/dex/trades/zksync/platforms/uniswap_v3_zksync_base_trades.sql rename to dex/models/trades/zksync/platforms/uniswap_v3_zksync_base_trades.sql diff --git a/models/_sector/dex/trades/zksync/platforms/velocore_v0_zksync_base_trades.sql b/dex/models/trades/zksync/platforms/velocore_v0_zksync_base_trades.sql similarity index 100% rename from models/_sector/dex/trades/zksync/platforms/velocore_v0_zksync_base_trades.sql rename to dex/models/trades/zksync/platforms/velocore_v0_zksync_base_trades.sql diff --git a/models/_sector/dex/trades/zksync/platforms/velocore_v1_zksync_base_trades.sql b/dex/models/trades/zksync/platforms/velocore_v1_zksync_base_trades.sql similarity index 100% rename from models/_sector/dex/trades/zksync/platforms/velocore_v1_zksync_base_trades.sql rename to dex/models/trades/zksync/platforms/velocore_v1_zksync_base_trades.sql diff --git a/models/_sector/dex/trades/zksync/platforms/velocore_v2_zksync_base_trades.sql b/dex/models/trades/zksync/platforms/velocore_v2_zksync_base_trades.sql similarity index 100% rename from models/_sector/dex/trades/zksync/platforms/velocore_v2_zksync_base_trades.sql rename to dex/models/trades/zksync/platforms/velocore_v2_zksync_base_trades.sql diff --git a/models/_sector/dex/trades/zksync/platforms/vesync_v1_zksync_base_trades.sql b/dex/models/trades/zksync/platforms/vesync_v1_zksync_base_trades.sql similarity index 100% rename from models/_sector/dex/trades/zksync/platforms/vesync_v1_zksync_base_trades.sql rename to dex/models/trades/zksync/platforms/vesync_v1_zksync_base_trades.sql diff --git a/models/_sector/dex/trades/zksync/platforms/wagmi_v1_zksync_base_trades.sql b/dex/models/trades/zksync/platforms/wagmi_v1_zksync_base_trades.sql similarity index 100% rename from models/_sector/dex/trades/zksync/platforms/wagmi_v1_zksync_base_trades.sql rename to dex/models/trades/zksync/platforms/wagmi_v1_zksync_base_trades.sql diff --git a/models/_sector/dex/trades/zksync/platforms/zkswap_finance_zksync_base_trades.sql b/dex/models/trades/zksync/platforms/zkswap_finance_zksync_base_trades.sql similarity index 100% rename from models/_sector/dex/trades/zksync/platforms/zkswap_finance_zksync_base_trades.sql rename to dex/models/trades/zksync/platforms/zkswap_finance_zksync_base_trades.sql diff --git a/models/_sector/dex/trades/zora/_schema.yml b/dex/models/trades/zora/_schema.yml similarity index 100% rename from models/_sector/dex/trades/zora/_schema.yml rename to dex/models/trades/zora/_schema.yml diff --git a/models/_sector/dex/trades/zora/dex_zora_base_trades.sql b/dex/models/trades/zora/dex_zora_base_trades.sql similarity index 100% rename from models/_sector/dex/trades/zora/dex_zora_base_trades.sql rename to dex/models/trades/zora/dex_zora_base_trades.sql diff --git a/models/_sector/dex/trades/zora/platforms/uniswap_v2_zora_base_trades.sql b/dex/models/trades/zora/platforms/uniswap_v2_zora_base_trades.sql similarity index 100% rename from models/_sector/dex/trades/zora/platforms/uniswap_v2_zora_base_trades.sql rename to dex/models/trades/zora/platforms/uniswap_v2_zora_base_trades.sql diff --git a/models/_sector/dex/trades/zora/platforms/uniswap_v3_zora_base_trades.sql b/dex/models/trades/zora/platforms/uniswap_v3_zora_base_trades.sql similarity index 100% rename from models/_sector/dex/trades/zora/platforms/uniswap_v3_zora_base_trades.sql rename to dex/models/trades/zora/platforms/uniswap_v3_zora_base_trades.sql diff --git a/dex/package-lock.yml b/dex/package-lock.yml new file mode 100644 index 00000000000..709885d7a0b --- /dev/null +++ b/dex/package-lock.yml @@ -0,0 +1,4 @@ +packages: +- package: dbt-labs/dbt_utils + version: 1.2.0 +sha1_hash: eb1031c07e7c89332527e572f2e44613ce5b62bf diff --git a/dex/packages.yml b/dex/packages.yml new file mode 100644 index 00000000000..d4f9f38e076 --- /dev/null +++ b/dex/packages.yml @@ -0,0 +1,3 @@ +packages: + - package: dbt-labs/dbt_utils + version: 1.2.0 \ No newline at end of file diff --git a/dex/profiles.yml b/dex/profiles.yml new file mode 100644 index 00000000000..10d52bd460f --- /dev/null +++ b/dex/profiles.yml @@ -0,0 +1,12 @@ +spellbook-local: + target: dev + outputs: + dev: + type: trino + user: trino + password: trino + host: trino + port: 1234 + database: hive + schema: wizard + threads: 1 \ No newline at end of file diff --git a/seeds/balancer/balancer_transfers_bpt_seed.csv b/dex/seeds/_project/balancer/balancer_transfers_bpt_seed.csv similarity index 100% rename from seeds/balancer/balancer_transfers_bpt_seed.csv rename to dex/seeds/_project/balancer/balancer_transfers_bpt_seed.csv diff --git a/seeds/zeroex/_schema.yml b/dex/seeds/_project/zeroex/_schema.yml similarity index 100% rename from seeds/zeroex/_schema.yml rename to dex/seeds/_project/zeroex/_schema.yml diff --git a/seeds/zeroex/arbitrum/_schema.yml b/dex/seeds/_project/zeroex/arbitrum/_schema.yml similarity index 100% rename from seeds/zeroex/arbitrum/_schema.yml rename to dex/seeds/_project/zeroex/arbitrum/_schema.yml diff --git a/seeds/zeroex/arbitrum/zeroex_arbitrum_api_fills_deduped_sample.csv b/dex/seeds/_project/zeroex/arbitrum/zeroex_arbitrum_api_fills_deduped_sample.csv similarity index 100% rename from seeds/zeroex/arbitrum/zeroex_arbitrum_api_fills_deduped_sample.csv rename to dex/seeds/_project/zeroex/arbitrum/zeroex_arbitrum_api_fills_deduped_sample.csv diff --git a/seeds/zeroex/arbitrum/zeroex_arbitrum_api_fills_sample.csv b/dex/seeds/_project/zeroex/arbitrum/zeroex_arbitrum_api_fills_sample.csv similarity index 100% rename from seeds/zeroex/arbitrum/zeroex_arbitrum_api_fills_sample.csv rename to dex/seeds/_project/zeroex/arbitrum/zeroex_arbitrum_api_fills_sample.csv diff --git a/seeds/zeroex/arbitrum/zeroex_arbitrum_native_fills_sample.csv b/dex/seeds/_project/zeroex/arbitrum/zeroex_arbitrum_native_fills_sample.csv similarity index 100% rename from seeds/zeroex/arbitrum/zeroex_arbitrum_native_fills_sample.csv rename to dex/seeds/_project/zeroex/arbitrum/zeroex_arbitrum_native_fills_sample.csv diff --git a/seeds/zeroex/avalanche_c/_schema.yml b/dex/seeds/_project/zeroex/avalanche_c/_schema.yml similarity index 100% rename from seeds/zeroex/avalanche_c/_schema.yml rename to dex/seeds/_project/zeroex/avalanche_c/_schema.yml diff --git a/seeds/zeroex/avalanche_c/zeroex_avalanche_c_api_fills_deduped_sample.csv b/dex/seeds/_project/zeroex/avalanche_c/zeroex_avalanche_c_api_fills_deduped_sample.csv similarity index 100% rename from seeds/zeroex/avalanche_c/zeroex_avalanche_c_api_fills_deduped_sample.csv rename to dex/seeds/_project/zeroex/avalanche_c/zeroex_avalanche_c_api_fills_deduped_sample.csv diff --git a/seeds/zeroex/avalanche_c/zeroex_avalanche_c_api_fills_sample.csv b/dex/seeds/_project/zeroex/avalanche_c/zeroex_avalanche_c_api_fills_sample.csv similarity index 100% rename from seeds/zeroex/avalanche_c/zeroex_avalanche_c_api_fills_sample.csv rename to dex/seeds/_project/zeroex/avalanche_c/zeroex_avalanche_c_api_fills_sample.csv diff --git a/seeds/zeroex/base/_schema.yml b/dex/seeds/_project/zeroex/base/_schema.yml similarity index 100% rename from seeds/zeroex/base/_schema.yml rename to dex/seeds/_project/zeroex/base/_schema.yml diff --git a/seeds/zeroex/base/zeroex_base_api_fills_sample.csv b/dex/seeds/_project/zeroex/base/zeroex_base_api_fills_sample.csv similarity index 100% rename from seeds/zeroex/base/zeroex_base_api_fills_sample.csv rename to dex/seeds/_project/zeroex/base/zeroex_base_api_fills_sample.csv diff --git a/seeds/zeroex/bnb/_schema.yml b/dex/seeds/_project/zeroex/bnb/_schema.yml similarity index 100% rename from seeds/zeroex/bnb/_schema.yml rename to dex/seeds/_project/zeroex/bnb/_schema.yml diff --git a/seeds/zeroex/bnb/zeroex_bnb_api_fills_deduped_sample.csv b/dex/seeds/_project/zeroex/bnb/zeroex_bnb_api_fills_deduped_sample.csv similarity index 100% rename from seeds/zeroex/bnb/zeroex_bnb_api_fills_deduped_sample.csv rename to dex/seeds/_project/zeroex/bnb/zeroex_bnb_api_fills_deduped_sample.csv diff --git a/seeds/zeroex/bnb/zeroex_bnb_api_fills_sample.csv b/dex/seeds/_project/zeroex/bnb/zeroex_bnb_api_fills_sample.csv similarity index 100% rename from seeds/zeroex/bnb/zeroex_bnb_api_fills_sample.csv rename to dex/seeds/_project/zeroex/bnb/zeroex_bnb_api_fills_sample.csv diff --git a/seeds/zeroex/bnb/zeroex_bnb_native_fills_sample.csv b/dex/seeds/_project/zeroex/bnb/zeroex_bnb_native_fills_sample.csv similarity index 100% rename from seeds/zeroex/bnb/zeroex_bnb_native_fills_sample.csv rename to dex/seeds/_project/zeroex/bnb/zeroex_bnb_native_fills_sample.csv diff --git a/seeds/zeroex/celo/_schema.yml b/dex/seeds/_project/zeroex/celo/_schema.yml similarity index 100% rename from seeds/zeroex/celo/_schema.yml rename to dex/seeds/_project/zeroex/celo/_schema.yml diff --git a/seeds/zeroex/celo/zeroex_celo_api_fills_deduped_sample.csv b/dex/seeds/_project/zeroex/celo/zeroex_celo_api_fills_deduped_sample.csv similarity index 100% rename from seeds/zeroex/celo/zeroex_celo_api_fills_deduped_sample.csv rename to dex/seeds/_project/zeroex/celo/zeroex_celo_api_fills_deduped_sample.csv diff --git a/seeds/zeroex/celo/zeroex_celo_api_fills_sample.csv b/dex/seeds/_project/zeroex/celo/zeroex_celo_api_fills_sample.csv similarity index 100% rename from seeds/zeroex/celo/zeroex_celo_api_fills_sample.csv rename to dex/seeds/_project/zeroex/celo/zeroex_celo_api_fills_sample.csv diff --git a/seeds/zeroex/ethereum/_schema.yml b/dex/seeds/_project/zeroex/ethereum/_schema.yml similarity index 100% rename from seeds/zeroex/ethereum/_schema.yml rename to dex/seeds/_project/zeroex/ethereum/_schema.yml diff --git a/seeds/zeroex/ethereum/zeroex_ethereum_api_fills_deduped_sample.csv b/dex/seeds/_project/zeroex/ethereum/zeroex_ethereum_api_fills_deduped_sample.csv similarity index 100% rename from seeds/zeroex/ethereum/zeroex_ethereum_api_fills_deduped_sample.csv rename to dex/seeds/_project/zeroex/ethereum/zeroex_ethereum_api_fills_deduped_sample.csv diff --git a/seeds/zeroex/ethereum/zeroex_ethereum_api_fills_sample.csv b/dex/seeds/_project/zeroex/ethereum/zeroex_ethereum_api_fills_sample.csv similarity index 100% rename from seeds/zeroex/ethereum/zeroex_ethereum_api_fills_sample.csv rename to dex/seeds/_project/zeroex/ethereum/zeroex_ethereum_api_fills_sample.csv diff --git a/seeds/zeroex/ethereum/zeroex_ethereum_native_fills_sample.csv b/dex/seeds/_project/zeroex/ethereum/zeroex_ethereum_native_fills_sample.csv similarity index 100% rename from seeds/zeroex/ethereum/zeroex_ethereum_native_fills_sample.csv rename to dex/seeds/_project/zeroex/ethereum/zeroex_ethereum_native_fills_sample.csv diff --git a/seeds/zeroex/ethereum/zeroex_ethereum_nft_fills_sample.csv b/dex/seeds/_project/zeroex/ethereum/zeroex_ethereum_nft_fills_sample.csv similarity index 100% rename from seeds/zeroex/ethereum/zeroex_ethereum_nft_fills_sample.csv rename to dex/seeds/_project/zeroex/ethereum/zeroex_ethereum_nft_fills_sample.csv diff --git a/seeds/zeroex/fantom/_schema.yml b/dex/seeds/_project/zeroex/fantom/_schema.yml similarity index 100% rename from seeds/zeroex/fantom/_schema.yml rename to dex/seeds/_project/zeroex/fantom/_schema.yml diff --git a/seeds/zeroex/fantom/zeroex_fantom_api_fills_deduped_sample.csv b/dex/seeds/_project/zeroex/fantom/zeroex_fantom_api_fills_deduped_sample.csv similarity index 100% rename from seeds/zeroex/fantom/zeroex_fantom_api_fills_deduped_sample.csv rename to dex/seeds/_project/zeroex/fantom/zeroex_fantom_api_fills_deduped_sample.csv diff --git a/seeds/zeroex/fantom/zeroex_fantom_api_fills_sample.csv b/dex/seeds/_project/zeroex/fantom/zeroex_fantom_api_fills_sample.csv similarity index 100% rename from seeds/zeroex/fantom/zeroex_fantom_api_fills_sample.csv rename to dex/seeds/_project/zeroex/fantom/zeroex_fantom_api_fills_sample.csv diff --git a/seeds/zeroex/optimism/_schema.yml b/dex/seeds/_project/zeroex/optimism/_schema.yml similarity index 100% rename from seeds/zeroex/optimism/_schema.yml rename to dex/seeds/_project/zeroex/optimism/_schema.yml diff --git a/seeds/zeroex/optimism/zeroex_optimism_api_fills_deduped_sample.csv b/dex/seeds/_project/zeroex/optimism/zeroex_optimism_api_fills_deduped_sample.csv similarity index 100% rename from seeds/zeroex/optimism/zeroex_optimism_api_fills_deduped_sample.csv rename to dex/seeds/_project/zeroex/optimism/zeroex_optimism_api_fills_deduped_sample.csv diff --git a/seeds/zeroex/optimism/zeroex_optimism_api_fills_sample.csv b/dex/seeds/_project/zeroex/optimism/zeroex_optimism_api_fills_sample.csv similarity index 100% rename from seeds/zeroex/optimism/zeroex_optimism_api_fills_sample.csv rename to dex/seeds/_project/zeroex/optimism/zeroex_optimism_api_fills_sample.csv diff --git a/seeds/zeroex/polygon/_schema.yml b/dex/seeds/_project/zeroex/polygon/_schema.yml similarity index 100% rename from seeds/zeroex/polygon/_schema.yml rename to dex/seeds/_project/zeroex/polygon/_schema.yml diff --git a/seeds/zeroex/polygon/zeroex_polygon_api_fills_deduped_sample.csv b/dex/seeds/_project/zeroex/polygon/zeroex_polygon_api_fills_deduped_sample.csv similarity index 100% rename from seeds/zeroex/polygon/zeroex_polygon_api_fills_deduped_sample.csv rename to dex/seeds/_project/zeroex/polygon/zeroex_polygon_api_fills_deduped_sample.csv diff --git a/seeds/zeroex/polygon/zeroex_polygon_api_fills_sample.csv b/dex/seeds/_project/zeroex/polygon/zeroex_polygon_api_fills_sample.csv similarity index 100% rename from seeds/zeroex/polygon/zeroex_polygon_api_fills_sample.csv rename to dex/seeds/_project/zeroex/polygon/zeroex_polygon_api_fills_sample.csv diff --git a/seeds/zeroex/polygon/zeroex_polygon_native_fills_sample.csv b/dex/seeds/_project/zeroex/polygon/zeroex_polygon_native_fills_sample.csv similarity index 100% rename from seeds/zeroex/polygon/zeroex_polygon_native_fills_sample.csv rename to dex/seeds/_project/zeroex/polygon/zeroex_polygon_native_fills_sample.csv diff --git a/seeds/zeroex/polygon/zeroex_polygon_nft_fills_sample.csv b/dex/seeds/_project/zeroex/polygon/zeroex_polygon_nft_fills_sample.csv similarity index 100% rename from seeds/zeroex/polygon/zeroex_polygon_nft_fills_sample.csv rename to dex/seeds/_project/zeroex/polygon/zeroex_polygon_nft_fills_sample.csv diff --git a/seeds/zeroex/zeroex_api_fills_deduped_sample.csv b/dex/seeds/_project/zeroex/zeroex_api_fills_deduped_sample.csv similarity index 100% rename from seeds/zeroex/zeroex_api_fills_deduped_sample.csv rename to dex/seeds/_project/zeroex/zeroex_api_fills_deduped_sample.csv diff --git a/seeds/zeroex/zeroex_api_fills_sample.csv b/dex/seeds/_project/zeroex/zeroex_api_fills_sample.csv similarity index 100% rename from seeds/zeroex/zeroex_api_fills_sample.csv rename to dex/seeds/_project/zeroex/zeroex_api_fills_sample.csv diff --git a/seeds/zeroex/zeroex_native_fills_sample.csv b/dex/seeds/_project/zeroex/zeroex_native_fills_sample.csv similarity index 100% rename from seeds/zeroex/zeroex_native_fills_sample.csv rename to dex/seeds/_project/zeroex/zeroex_native_fills_sample.csv diff --git a/seeds/dex/aggregator/_schema.yml b/dex/seeds/aggregator_trades/_schema.yml similarity index 100% rename from seeds/dex/aggregator/_schema.yml rename to dex/seeds/aggregator_trades/_schema.yml diff --git a/seeds/dex/aggregator/dex_aggregator_seed.csv b/dex/seeds/aggregator_trades/dex_aggregator_seed.csv similarity index 100% rename from seeds/dex/aggregator/dex_aggregator_seed.csv rename to dex/seeds/aggregator_trades/dex_aggregator_seed.csv diff --git a/seeds/dex/pools/_schema.yml b/dex/seeds/pools/_schema.yml similarity index 100% rename from seeds/dex/pools/_schema.yml rename to dex/seeds/pools/_schema.yml diff --git a/seeds/dex/pools/dex_pools_seed.csv b/dex/seeds/pools/dex_pools_seed.csv similarity index 100% rename from seeds/dex/pools/dex_pools_seed.csv rename to dex/seeds/pools/dex_pools_seed.csv diff --git a/seeds/_sector/dex/_schema.yml b/dex/seeds/trades/_schema.yml similarity index 100% rename from seeds/_sector/dex/_schema.yml rename to dex/seeds/trades/_schema.yml diff --git a/seeds/_sector/dex/aerodrome_base_base_trades_seed.csv b/dex/seeds/trades/aerodrome_base_base_trades_seed.csv similarity index 100% rename from seeds/_sector/dex/aerodrome_base_base_trades_seed.csv rename to dex/seeds/trades/aerodrome_base_base_trades_seed.csv diff --git a/seeds/_sector/dex/airswap_arbitrum_base_trades_seed.csv b/dex/seeds/trades/airswap_arbitrum_base_trades_seed.csv similarity index 100% rename from seeds/_sector/dex/airswap_arbitrum_base_trades_seed.csv rename to dex/seeds/trades/airswap_arbitrum_base_trades_seed.csv diff --git a/seeds/_sector/dex/airswap_avalanche_c_base_trades_seed.csv b/dex/seeds/trades/airswap_avalanche_c_base_trades_seed.csv similarity index 100% rename from seeds/_sector/dex/airswap_avalanche_c_base_trades_seed.csv rename to dex/seeds/trades/airswap_avalanche_c_base_trades_seed.csv diff --git a/seeds/_sector/dex/airswap_bnb_base_trades_seed.csv b/dex/seeds/trades/airswap_bnb_base_trades_seed.csv similarity index 100% rename from seeds/_sector/dex/airswap_bnb_base_trades_seed.csv rename to dex/seeds/trades/airswap_bnb_base_trades_seed.csv diff --git a/seeds/_sector/dex/airswap_ethereum_base_trades_seed.csv b/dex/seeds/trades/airswap_ethereum_base_trades_seed.csv similarity index 100% rename from seeds/_sector/dex/airswap_ethereum_base_trades_seed.csv rename to dex/seeds/trades/airswap_ethereum_base_trades_seed.csv diff --git a/seeds/_sector/dex/airswap_polygon_base_trades_seed.csv b/dex/seeds/trades/airswap_polygon_base_trades_seed.csv similarity index 100% rename from seeds/_sector/dex/airswap_polygon_base_trades_seed.csv rename to dex/seeds/trades/airswap_polygon_base_trades_seed.csv diff --git a/seeds/_sector/dex/alienbase_base_base_trades_seed.csv b/dex/seeds/trades/alienbase_base_base_trades_seed.csv similarity index 100% rename from seeds/_sector/dex/alienbase_base_base_trades_seed.csv rename to dex/seeds/trades/alienbase_base_base_trades_seed.csv diff --git a/seeds/_sector/dex/apeswap_arbitrum_base_trades_seed.csv b/dex/seeds/trades/apeswap_arbitrum_base_trades_seed.csv similarity index 100% rename from seeds/_sector/dex/apeswap_arbitrum_base_trades_seed.csv rename to dex/seeds/trades/apeswap_arbitrum_base_trades_seed.csv diff --git a/seeds/_sector/dex/apeswap_bnb_base_trades_seed.csv b/dex/seeds/trades/apeswap_bnb_base_trades_seed.csv similarity index 100% rename from seeds/_sector/dex/apeswap_bnb_base_trades_seed.csv rename to dex/seeds/trades/apeswap_bnb_base_trades_seed.csv diff --git a/seeds/_sector/dex/apeswap_ethereum_base_trades_seed.csv b/dex/seeds/trades/apeswap_ethereum_base_trades_seed.csv similarity index 100% rename from seeds/_sector/dex/apeswap_ethereum_base_trades_seed.csv rename to dex/seeds/trades/apeswap_ethereum_base_trades_seed.csv diff --git a/seeds/_sector/dex/apeswap_polygon_base_trades_seed.csv b/dex/seeds/trades/apeswap_polygon_base_trades_seed.csv similarity index 100% rename from seeds/_sector/dex/apeswap_polygon_base_trades_seed.csv rename to dex/seeds/trades/apeswap_polygon_base_trades_seed.csv diff --git a/seeds/_sector/dex/arbswap_arbitrum_base_trades_seed.csv b/dex/seeds/trades/arbswap_arbitrum_base_trades_seed.csv similarity index 100% rename from seeds/_sector/dex/arbswap_arbitrum_base_trades_seed.csv rename to dex/seeds/trades/arbswap_arbitrum_base_trades_seed.csv diff --git a/seeds/_sector/dex/auragi_arbitrum_base_trades_seed.csv b/dex/seeds/trades/auragi_arbitrum_base_trades_seed.csv similarity index 100% rename from seeds/_sector/dex/auragi_arbitrum_base_trades_seed.csv rename to dex/seeds/trades/auragi_arbitrum_base_trades_seed.csv diff --git a/seeds/_sector/dex/autotronic_base_base_trades_seed.csv b/dex/seeds/trades/autotronic_base_base_trades_seed.csv similarity index 100% rename from seeds/_sector/dex/autotronic_base_base_trades_seed.csv rename to dex/seeds/trades/autotronic_base_base_trades_seed.csv diff --git a/seeds/_sector/dex/babyswap_bnb_base_trades_seed.csv b/dex/seeds/trades/babyswap_bnb_base_trades_seed.csv similarity index 100% rename from seeds/_sector/dex/babyswap_bnb_base_trades_seed.csv rename to dex/seeds/trades/babyswap_bnb_base_trades_seed.csv diff --git a/seeds/_sector/dex/balancer_arbitrum_base_trades_seed.csv b/dex/seeds/trades/balancer_arbitrum_base_trades_seed.csv similarity index 100% rename from seeds/_sector/dex/balancer_arbitrum_base_trades_seed.csv rename to dex/seeds/trades/balancer_arbitrum_base_trades_seed.csv diff --git a/seeds/_sector/dex/balancer_avalanche_c_base_trades_seed.csv b/dex/seeds/trades/balancer_avalanche_c_base_trades_seed.csv similarity index 100% rename from seeds/_sector/dex/balancer_avalanche_c_base_trades_seed.csv rename to dex/seeds/trades/balancer_avalanche_c_base_trades_seed.csv diff --git a/seeds/_sector/dex/balancer_base_base_trades_seed.csv b/dex/seeds/trades/balancer_base_base_trades_seed.csv similarity index 100% rename from seeds/_sector/dex/balancer_base_base_trades_seed.csv rename to dex/seeds/trades/balancer_base_base_trades_seed.csv diff --git a/seeds/_sector/dex/balancer_ethereum_base_trades_seed.csv b/dex/seeds/trades/balancer_ethereum_base_trades_seed.csv similarity index 100% rename from seeds/_sector/dex/balancer_ethereum_base_trades_seed.csv rename to dex/seeds/trades/balancer_ethereum_base_trades_seed.csv diff --git a/seeds/_sector/dex/balancer_gnosis_base_trades_seed.csv b/dex/seeds/trades/balancer_gnosis_base_trades_seed.csv similarity index 100% rename from seeds/_sector/dex/balancer_gnosis_base_trades_seed.csv rename to dex/seeds/trades/balancer_gnosis_base_trades_seed.csv diff --git a/seeds/_sector/dex/balancer_optimism_base_trades_seed.csv b/dex/seeds/trades/balancer_optimism_base_trades_seed.csv similarity index 100% rename from seeds/_sector/dex/balancer_optimism_base_trades_seed.csv rename to dex/seeds/trades/balancer_optimism_base_trades_seed.csv diff --git a/seeds/_sector/dex/balancer_polygon_base_trades_seed.csv b/dex/seeds/trades/balancer_polygon_base_trades_seed.csv similarity index 100% rename from seeds/_sector/dex/balancer_polygon_base_trades_seed.csv rename to dex/seeds/trades/balancer_polygon_base_trades_seed.csv diff --git a/seeds/_sector/dex/balancer_zkevm_base_trades_seed.csv b/dex/seeds/trades/balancer_zkevm_base_trades_seed.csv similarity index 100% rename from seeds/_sector/dex/balancer_zkevm_base_trades_seed.csv rename to dex/seeds/trades/balancer_zkevm_base_trades_seed.csv diff --git a/seeds/_sector/dex/bancor_ethereum_base_trades_seed.csv b/dex/seeds/trades/bancor_ethereum_base_trades_seed.csv similarity index 100% rename from seeds/_sector/dex/bancor_ethereum_base_trades_seed.csv rename to dex/seeds/trades/bancor_ethereum_base_trades_seed.csv diff --git a/seeds/_sector/dex/baseswap_base_base_trades_seed.csv b/dex/seeds/trades/baseswap_base_base_trades_seed.csv similarity index 100% rename from seeds/_sector/dex/baseswap_base_base_trades_seed.csv rename to dex/seeds/trades/baseswap_base_base_trades_seed.csv diff --git a/seeds/_sector/dex/baseswap_basex_base_base_trades_seed.csv b/dex/seeds/trades/baseswap_basex_base_base_trades_seed.csv similarity index 100% rename from seeds/_sector/dex/baseswap_basex_base_base_trades_seed.csv rename to dex/seeds/trades/baseswap_basex_base_base_trades_seed.csv diff --git a/seeds/_sector/dex/baso_finance_base_base_trades_seed.csv b/dex/seeds/trades/baso_finance_base_base_trades_seed.csv similarity index 100% rename from seeds/_sector/dex/baso_finance_base_base_trades_seed.csv rename to dex/seeds/trades/baso_finance_base_base_trades_seed.csv diff --git a/seeds/_sector/dex/beethoven_x_fantom_base_trades_seed.csv b/dex/seeds/trades/beethoven_x_fantom_base_trades_seed.csv similarity index 100% rename from seeds/_sector/dex/beethoven_x_fantom_base_trades_seed.csv rename to dex/seeds/trades/beethoven_x_fantom_base_trades_seed.csv diff --git a/seeds/_sector/dex/beethoven_x_optimism_base_trades_seed.csv b/dex/seeds/trades/beethoven_x_optimism_base_trades_seed.csv similarity index 100% rename from seeds/_sector/dex/beethoven_x_optimism_base_trades_seed.csv rename to dex/seeds/trades/beethoven_x_optimism_base_trades_seed.csv diff --git a/seeds/_sector/dex/biswap_bnb_base_trades_seed.csv b/dex/seeds/trades/biswap_bnb_base_trades_seed.csv similarity index 100% rename from seeds/_sector/dex/biswap_bnb_base_trades_seed.csv rename to dex/seeds/trades/biswap_bnb_base_trades_seed.csv diff --git a/seeds/_sector/dex/camelot_arbitrum_base_trades_seed.csv b/dex/seeds/trades/camelot_arbitrum_base_trades_seed.csv similarity index 100% rename from seeds/_sector/dex/camelot_arbitrum_base_trades_seed.csv rename to dex/seeds/trades/camelot_arbitrum_base_trades_seed.csv diff --git a/seeds/_sector/dex/carbon_defi_ethereum_base_trades_seed.csv b/dex/seeds/trades/carbon_defi_ethereum_base_trades_seed.csv similarity index 100% rename from seeds/_sector/dex/carbon_defi_ethereum_base_trades_seed.csv rename to dex/seeds/trades/carbon_defi_ethereum_base_trades_seed.csv diff --git a/seeds/_sector/dex/carbonhood_celo_base_trades_seed.csv b/dex/seeds/trades/carbonhood_celo_base_trades_seed.csv similarity index 100% rename from seeds/_sector/dex/carbonhood_celo_base_trades_seed.csv rename to dex/seeds/trades/carbonhood_celo_base_trades_seed.csv diff --git a/seeds/_sector/dex/chainhop_optimism_base_trades_seed.csv b/dex/seeds/trades/chainhop_optimism_base_trades_seed.csv similarity index 100% rename from seeds/_sector/dex/chainhop_optimism_base_trades_seed.csv rename to dex/seeds/trades/chainhop_optimism_base_trades_seed.csv diff --git a/seeds/_sector/dex/chronos_arbitrum_base_trades_seed.csv b/dex/seeds/trades/chronos_arbitrum_base_trades_seed.csv similarity index 100% rename from seeds/_sector/dex/chronos_arbitrum_base_trades_seed.csv rename to dex/seeds/trades/chronos_arbitrum_base_trades_seed.csv diff --git a/seeds/_sector/dex/citadelswap_base_base_trades_seed.csv b/dex/seeds/trades/citadelswap_base_base_trades_seed.csv similarity index 100% rename from seeds/_sector/dex/citadelswap_base_base_trades_seed.csv rename to dex/seeds/trades/citadelswap_base_base_trades_seed.csv diff --git a/seeds/_sector/dex/clipper_arbitrum_base_trades_seed.csv b/dex/seeds/trades/clipper_arbitrum_base_trades_seed.csv similarity index 100% rename from seeds/_sector/dex/clipper_arbitrum_base_trades_seed.csv rename to dex/seeds/trades/clipper_arbitrum_base_trades_seed.csv diff --git a/seeds/_sector/dex/clipper_base_base_trades_seed.csv b/dex/seeds/trades/clipper_base_base_trades_seed.csv similarity index 100% rename from seeds/_sector/dex/clipper_base_base_trades_seed.csv rename to dex/seeds/trades/clipper_base_base_trades_seed.csv diff --git a/seeds/_sector/dex/clipper_ethereum_base_trades_seed.csv b/dex/seeds/trades/clipper_ethereum_base_trades_seed.csv similarity index 100% rename from seeds/_sector/dex/clipper_ethereum_base_trades_seed.csv rename to dex/seeds/trades/clipper_ethereum_base_trades_seed.csv diff --git a/seeds/_sector/dex/clipper_optimism_base_trades_seed.csv b/dex/seeds/trades/clipper_optimism_base_trades_seed.csv similarity index 100% rename from seeds/_sector/dex/clipper_optimism_base_trades_seed.csv rename to dex/seeds/trades/clipper_optimism_base_trades_seed.csv diff --git a/seeds/_sector/dex/clipper_polygon_base_trades_seed.csv b/dex/seeds/trades/clipper_polygon_base_trades_seed.csv similarity index 100% rename from seeds/_sector/dex/clipper_polygon_base_trades_seed.csv rename to dex/seeds/trades/clipper_polygon_base_trades_seed.csv diff --git a/seeds/_sector/dex/crescentswap_base_base_trades_seed.csv b/dex/seeds/trades/crescentswap_base_base_trades_seed.csv similarity index 100% rename from seeds/_sector/dex/crescentswap_base_base_trades_seed.csv rename to dex/seeds/trades/crescentswap_base_base_trades_seed.csv diff --git a/seeds/_sector/dex/curvefi_avalanche_c_base_trades_seed.csv b/dex/seeds/trades/curvefi_avalanche_c_base_trades_seed.csv similarity index 100% rename from seeds/_sector/dex/curvefi_avalanche_c_base_trades_seed.csv rename to dex/seeds/trades/curvefi_avalanche_c_base_trades_seed.csv diff --git a/seeds/_sector/dex/curvefi_celo_base_trades_seed.csv b/dex/seeds/trades/curvefi_celo_base_trades_seed.csv similarity index 100% rename from seeds/_sector/dex/curvefi_celo_base_trades_seed.csv rename to dex/seeds/trades/curvefi_celo_base_trades_seed.csv diff --git a/seeds/_sector/dex/curvefi_ethereum_base_trades_seed.csv b/dex/seeds/trades/curvefi_ethereum_base_trades_seed.csv similarity index 100% rename from seeds/_sector/dex/curvefi_ethereum_base_trades_seed.csv rename to dex/seeds/trades/curvefi_ethereum_base_trades_seed.csv diff --git a/seeds/_sector/dex/curvefi_fantom_base_trades_seed.csv b/dex/seeds/trades/curvefi_fantom_base_trades_seed.csv similarity index 100% rename from seeds/_sector/dex/curvefi_fantom_base_trades_seed.csv rename to dex/seeds/trades/curvefi_fantom_base_trades_seed.csv diff --git a/seeds/_sector/dex/curvefi_optimism_base_trades_seed.csv b/dex/seeds/trades/curvefi_optimism_base_trades_seed.csv similarity index 100% rename from seeds/_sector/dex/curvefi_optimism_base_trades_seed.csv rename to dex/seeds/trades/curvefi_optimism_base_trades_seed.csv diff --git a/seeds/_sector/dex/dackieswap_base_base_trades_seed.csv b/dex/seeds/trades/dackieswap_base_base_trades_seed.csv similarity index 100% rename from seeds/_sector/dex/dackieswap_base_base_trades_seed.csv rename to dex/seeds/trades/dackieswap_base_base_trades_seed.csv diff --git a/seeds/_sector/dex/dackieswap_v2_optimism_base_trades_seed.csv b/dex/seeds/trades/dackieswap_v2_optimism_base_trades_seed.csv similarity index 100% rename from seeds/_sector/dex/dackieswap_v2_optimism_base_trades_seed.csv rename to dex/seeds/trades/dackieswap_v2_optimism_base_trades_seed.csv diff --git a/seeds/_sector/dex/dackieswap_v3_optimism_base_trades_seed.csv b/dex/seeds/trades/dackieswap_v3_optimism_base_trades_seed.csv similarity index 100% rename from seeds/_sector/dex/dackieswap_v3_optimism_base_trades_seed.csv rename to dex/seeds/trades/dackieswap_v3_optimism_base_trades_seed.csv diff --git a/seeds/_sector/dex/defiswap_ethereum_base_trades_seed.csv b/dex/seeds/trades/defiswap_ethereum_base_trades_seed.csv similarity index 100% rename from seeds/_sector/dex/defiswap_ethereum_base_trades_seed.csv rename to dex/seeds/trades/defiswap_ethereum_base_trades_seed.csv diff --git a/seeds/_sector/dex/derpdex_base_base_trades_seed.csv b/dex/seeds/trades/derpdex_base_base_trades_seed.csv similarity index 100% rename from seeds/_sector/dex/derpdex_base_base_trades_seed.csv rename to dex/seeds/trades/derpdex_base_base_trades_seed.csv diff --git a/seeds/_sector/dex/derpdex_zksync_base_trades_seed.csv b/dex/seeds/trades/derpdex_zksync_base_trades_seed.csv similarity index 100% rename from seeds/_sector/dex/derpdex_zksync_base_trades_seed.csv rename to dex/seeds/trades/derpdex_zksync_base_trades_seed.csv diff --git a/seeds/_sector/dex/dfx_ethereum_base_trades_seed.csv b/dex/seeds/trades/dfx_ethereum_base_trades_seed.csv similarity index 100% rename from seeds/_sector/dex/dfx_ethereum_base_trades_seed.csv rename to dex/seeds/trades/dfx_ethereum_base_trades_seed.csv diff --git a/seeds/_sector/dex/dodo_arbitrum_base_trades_seed.csv b/dex/seeds/trades/dodo_arbitrum_base_trades_seed.csv similarity index 100% rename from seeds/_sector/dex/dodo_arbitrum_base_trades_seed.csv rename to dex/seeds/trades/dodo_arbitrum_base_trades_seed.csv diff --git a/seeds/_sector/dex/dodo_base_base_trades_seed.csv b/dex/seeds/trades/dodo_base_base_trades_seed.csv similarity index 100% rename from seeds/_sector/dex/dodo_base_base_trades_seed.csv rename to dex/seeds/trades/dodo_base_base_trades_seed.csv diff --git a/seeds/_sector/dex/dodo_bnb_base_trades_seed.csv b/dex/seeds/trades/dodo_bnb_base_trades_seed.csv similarity index 100% rename from seeds/_sector/dex/dodo_bnb_base_trades_seed.csv rename to dex/seeds/trades/dodo_bnb_base_trades_seed.csv diff --git a/seeds/_sector/dex/dodo_ethereum_base_trades_seed.csv b/dex/seeds/trades/dodo_ethereum_base_trades_seed.csv similarity index 100% rename from seeds/_sector/dex/dodo_ethereum_base_trades_seed.csv rename to dex/seeds/trades/dodo_ethereum_base_trades_seed.csv diff --git a/seeds/_sector/dex/dodo_optimism_base_trades_seed.csv b/dex/seeds/trades/dodo_optimism_base_trades_seed.csv similarity index 100% rename from seeds/_sector/dex/dodo_optimism_base_trades_seed.csv rename to dex/seeds/trades/dodo_optimism_base_trades_seed.csv diff --git a/seeds/_sector/dex/dodo_polygon_base_trades_seed.csv b/dex/seeds/trades/dodo_polygon_base_trades_seed.csv similarity index 100% rename from seeds/_sector/dex/dodo_polygon_base_trades_seed.csv rename to dex/seeds/trades/dodo_polygon_base_trades_seed.csv diff --git a/seeds/_sector/dex/dooar_polygon_base_trades_seed.csv b/dex/seeds/trades/dooar_polygon_base_trades_seed.csv similarity index 100% rename from seeds/_sector/dex/dooar_polygon_base_trades_seed.csv rename to dex/seeds/trades/dooar_polygon_base_trades_seed.csv diff --git a/seeds/_sector/dex/dracula_finance_zksync_base_trades_seed.csv b/dex/seeds/trades/dracula_finance_zksync_base_trades_seed.csv similarity index 100% rename from seeds/_sector/dex/dracula_finance_zksync_base_trades_seed.csv rename to dex/seeds/trades/dracula_finance_zksync_base_trades_seed.csv diff --git a/seeds/_sector/dex/echodex_linea_base_trades_seed.csv b/dex/seeds/trades/echodex_linea_base_trades_seed.csv similarity index 100% rename from seeds/_sector/dex/echodex_linea_base_trades_seed.csv rename to dex/seeds/trades/echodex_linea_base_trades_seed.csv diff --git a/seeds/_sector/dex/elk_finance_base_base_trades_seed.csv b/dex/seeds/trades/elk_finance_base_base_trades_seed.csv similarity index 100% rename from seeds/_sector/dex/elk_finance_base_base_trades_seed.csv rename to dex/seeds/trades/elk_finance_base_base_trades_seed.csv diff --git a/seeds/_sector/dex/elk_finance_optimism_base_trades_seed.csv b/dex/seeds/trades/elk_finance_optimism_base_trades_seed.csv similarity index 100% rename from seeds/_sector/dex/elk_finance_optimism_base_trades_seed.csv rename to dex/seeds/trades/elk_finance_optimism_base_trades_seed.csv diff --git a/seeds/_sector/dex/ellipsis_finance_bnb_base_trades_seed.csv b/dex/seeds/trades/ellipsis_finance_bnb_base_trades_seed.csv similarity index 100% rename from seeds/_sector/dex/ellipsis_finance_bnb_base_trades_seed.csv rename to dex/seeds/trades/ellipsis_finance_bnb_base_trades_seed.csv diff --git a/seeds/_sector/dex/energon_base_base_trades_seed.csv b/dex/seeds/trades/energon_base_base_trades_seed.csv similarity index 100% rename from seeds/_sector/dex/energon_base_base_trades_seed.csv rename to dex/seeds/trades/energon_base_base_trades_seed.csv diff --git a/seeds/_sector/dex/equalizer_fantom_base_trades_seed.csv b/dex/seeds/trades/equalizer_fantom_base_trades_seed.csv similarity index 100% rename from seeds/_sector/dex/equalizer_fantom_base_trades_seed.csv rename to dex/seeds/trades/equalizer_fantom_base_trades_seed.csv diff --git a/seeds/_sector/dex/ezkalibur_zksync_base_trades_seed.csv b/dex/seeds/trades/ezkalibur_zksync_base_trades_seed.csv similarity index 100% rename from seeds/_sector/dex/ezkalibur_zksync_base_trades_seed.csv rename to dex/seeds/trades/ezkalibur_zksync_base_trades_seed.csv diff --git a/seeds/_sector/dex/fraxswap_arbitrum_base_trades_seed.csv b/dex/seeds/trades/fraxswap_arbitrum_base_trades_seed.csv similarity index 100% rename from seeds/_sector/dex/fraxswap_arbitrum_base_trades_seed.csv rename to dex/seeds/trades/fraxswap_arbitrum_base_trades_seed.csv diff --git a/seeds/_sector/dex/fraxswap_avalanche_c_base_trades_seed.csv b/dex/seeds/trades/fraxswap_avalanche_c_base_trades_seed.csv similarity index 100% rename from seeds/_sector/dex/fraxswap_avalanche_c_base_trades_seed.csv rename to dex/seeds/trades/fraxswap_avalanche_c_base_trades_seed.csv diff --git a/seeds/_sector/dex/fraxswap_bnb_base_trades_seed.csv b/dex/seeds/trades/fraxswap_bnb_base_trades_seed.csv similarity index 100% rename from seeds/_sector/dex/fraxswap_bnb_base_trades_seed.csv rename to dex/seeds/trades/fraxswap_bnb_base_trades_seed.csv diff --git a/seeds/_sector/dex/fraxswap_ethereum_base_trades_seed.csv b/dex/seeds/trades/fraxswap_ethereum_base_trades_seed.csv similarity index 100% rename from seeds/_sector/dex/fraxswap_ethereum_base_trades_seed.csv rename to dex/seeds/trades/fraxswap_ethereum_base_trades_seed.csv diff --git a/seeds/_sector/dex/fraxswap_optimism_base_trades_seed.csv b/dex/seeds/trades/fraxswap_optimism_base_trades_seed.csv similarity index 100% rename from seeds/_sector/dex/fraxswap_optimism_base_trades_seed.csv rename to dex/seeds/trades/fraxswap_optimism_base_trades_seed.csv diff --git a/seeds/_sector/dex/fraxswap_polygon_base_trades_seed.csv b/dex/seeds/trades/fraxswap_polygon_base_trades_seed.csv similarity index 100% rename from seeds/_sector/dex/fraxswap_polygon_base_trades_seed.csv rename to dex/seeds/trades/fraxswap_polygon_base_trades_seed.csv diff --git a/seeds/_sector/dex/gemswap_zksync_base_trades_seed.csv b/dex/seeds/trades/gemswap_zksync_base_trades_seed.csv similarity index 100% rename from seeds/_sector/dex/gemswap_zksync_base_trades_seed.csv rename to dex/seeds/trades/gemswap_zksync_base_trades_seed.csv diff --git a/seeds/_sector/dex/glacier_avalanche_c_base_trades_seed.csv b/dex/seeds/trades/glacier_avalanche_c_base_trades_seed.csv similarity index 100% rename from seeds/_sector/dex/glacier_avalanche_c_base_trades_seed.csv rename to dex/seeds/trades/glacier_avalanche_c_base_trades_seed.csv diff --git a/seeds/_sector/dex/gmx_arbitrum_base_trades_seed.csv b/dex/seeds/trades/gmx_arbitrum_base_trades_seed.csv similarity index 100% rename from seeds/_sector/dex/gmx_arbitrum_base_trades_seed.csv rename to dex/seeds/trades/gmx_arbitrum_base_trades_seed.csv diff --git a/seeds/_sector/dex/gmx_avalanche_c_base_trades_seed.csv b/dex/seeds/trades/gmx_avalanche_c_base_trades_seed.csv similarity index 100% rename from seeds/_sector/dex/gmx_avalanche_c_base_trades_seed.csv rename to dex/seeds/trades/gmx_avalanche_c_base_trades_seed.csv diff --git a/seeds/_sector/dex/gridex_arbitrum_base_trades_seed.csv b/dex/seeds/trades/gridex_arbitrum_base_trades_seed.csv similarity index 100% rename from seeds/_sector/dex/gridex_arbitrum_base_trades_seed.csv rename to dex/seeds/trades/gridex_arbitrum_base_trades_seed.csv diff --git a/seeds/_sector/dex/gridex_base_base_trades_seed.csv b/dex/seeds/trades/gridex_base_base_trades_seed.csv similarity index 100% rename from seeds/_sector/dex/gridex_base_base_trades_seed.csv rename to dex/seeds/trades/gridex_base_base_trades_seed.csv diff --git a/seeds/_sector/dex/gridex_optimism_base_trades_seed.csv b/dex/seeds/trades/gridex_optimism_base_trades_seed.csv similarity index 100% rename from seeds/_sector/dex/gridex_optimism_base_trades_seed.csv rename to dex/seeds/trades/gridex_optimism_base_trades_seed.csv diff --git a/seeds/_sector/dex/hashflow_avalanche_c_base_trades_seed.csv b/dex/seeds/trades/hashflow_avalanche_c_base_trades_seed.csv similarity index 100% rename from seeds/_sector/dex/hashflow_avalanche_c_base_trades_seed.csv rename to dex/seeds/trades/hashflow_avalanche_c_base_trades_seed.csv diff --git a/seeds/_sector/dex/hashflow_bnb_base_trades_seed.csv b/dex/seeds/trades/hashflow_bnb_base_trades_seed.csv similarity index 100% rename from seeds/_sector/dex/hashflow_bnb_base_trades_seed.csv rename to dex/seeds/trades/hashflow_bnb_base_trades_seed.csv diff --git a/seeds/_sector/dex/hashflow_ethereum_base_trades_seed.csv b/dex/seeds/trades/hashflow_ethereum_base_trades_seed.csv similarity index 100% rename from seeds/_sector/dex/hashflow_ethereum_base_trades_seed.csv rename to dex/seeds/trades/hashflow_ethereum_base_trades_seed.csv diff --git a/seeds/_sector/dex/hashflow_optimism_base_trades_seed.csv b/dex/seeds/trades/hashflow_optimism_base_trades_seed.csv similarity index 100% rename from seeds/_sector/dex/hashflow_optimism_base_trades_seed.csv rename to dex/seeds/trades/hashflow_optimism_base_trades_seed.csv diff --git a/seeds/_sector/dex/honeyswap_gnosis_base_trades_seed.csv b/dex/seeds/trades/honeyswap_gnosis_base_trades_seed.csv similarity index 100% rename from seeds/_sector/dex/honeyswap_gnosis_base_trades_seed.csv rename to dex/seeds/trades/honeyswap_gnosis_base_trades_seed.csv diff --git a/seeds/_sector/dex/honeyswap_polygon_base_trades_seed.csv b/dex/seeds/trades/honeyswap_polygon_base_trades_seed.csv similarity index 100% rename from seeds/_sector/dex/honeyswap_polygon_base_trades_seed.csv rename to dex/seeds/trades/honeyswap_polygon_base_trades_seed.csv diff --git a/seeds/_sector/dex/horizondex_base_base_trades_seed.csv b/dex/seeds/trades/horizondex_base_base_trades_seed.csv similarity index 100% rename from seeds/_sector/dex/horizondex_base_base_trades_seed.csv rename to dex/seeds/trades/horizondex_base_base_trades_seed.csv diff --git a/seeds/_sector/dex/icecreamswap_base_base_trades_seed.csv b/dex/seeds/trades/icecreamswap_base_base_trades_seed.csv similarity index 100% rename from seeds/_sector/dex/icecreamswap_base_base_trades_seed.csv rename to dex/seeds/trades/icecreamswap_base_base_trades_seed.csv diff --git a/seeds/_sector/dex/icecreamswap_v2_scroll_base_trades_seed.csv b/dex/seeds/trades/icecreamswap_v2_scroll_base_trades_seed.csv similarity index 100% rename from seeds/_sector/dex/icecreamswap_v2_scroll_base_trades_seed.csv rename to dex/seeds/trades/icecreamswap_v2_scroll_base_trades_seed.csv diff --git a/seeds/_sector/dex/integral_arbitrum_base_trades_seed.csv b/dex/seeds/trades/integral_arbitrum_base_trades_seed.csv similarity index 100% rename from seeds/_sector/dex/integral_arbitrum_base_trades_seed.csv rename to dex/seeds/trades/integral_arbitrum_base_trades_seed.csv diff --git a/seeds/_sector/dex/integral_ethereum_base_trades_seed.csv b/dex/seeds/trades/integral_ethereum_base_trades_seed.csv similarity index 100% rename from seeds/_sector/dex/integral_ethereum_base_trades_seed.csv rename to dex/seeds/trades/integral_ethereum_base_trades_seed.csv diff --git a/seeds/_sector/dex/iziswap_bnb_base_trades_seed.csv b/dex/seeds/trades/iziswap_bnb_base_trades_seed.csv similarity index 100% rename from seeds/_sector/dex/iziswap_bnb_base_trades_seed.csv rename to dex/seeds/trades/iziswap_bnb_base_trades_seed.csv diff --git a/seeds/_sector/dex/iziswap_scroll_base_trades_seed.csv b/dex/seeds/trades/iziswap_scroll_base_trades_seed.csv similarity index 100% rename from seeds/_sector/dex/iziswap_scroll_base_trades_seed.csv rename to dex/seeds/trades/iziswap_scroll_base_trades_seed.csv diff --git a/seeds/_sector/dex/iziswap_zksync_base_trades_seed.csv b/dex/seeds/trades/iziswap_zksync_base_trades_seed.csv similarity index 100% rename from seeds/_sector/dex/iziswap_zksync_base_trades_seed.csv rename to dex/seeds/trades/iziswap_zksync_base_trades_seed.csv diff --git a/seeds/_sector/dex/kyberswap_arbitrum_base_trades_seed.csv b/dex/seeds/trades/kyberswap_arbitrum_base_trades_seed.csv similarity index 100% rename from seeds/_sector/dex/kyberswap_arbitrum_base_trades_seed.csv rename to dex/seeds/trades/kyberswap_arbitrum_base_trades_seed.csv diff --git a/seeds/_sector/dex/kyberswap_avalanche_c_base_trades_seed.csv b/dex/seeds/trades/kyberswap_avalanche_c_base_trades_seed.csv similarity index 100% rename from seeds/_sector/dex/kyberswap_avalanche_c_base_trades_seed.csv rename to dex/seeds/trades/kyberswap_avalanche_c_base_trades_seed.csv diff --git a/seeds/_sector/dex/kyberswap_base_base_trades_seed.csv b/dex/seeds/trades/kyberswap_base_base_trades_seed.csv similarity index 100% rename from seeds/_sector/dex/kyberswap_base_base_trades_seed.csv rename to dex/seeds/trades/kyberswap_base_base_trades_seed.csv diff --git a/seeds/_sector/dex/kyberswap_bnb_base_trades_seed.csv b/dex/seeds/trades/kyberswap_bnb_base_trades_seed.csv similarity index 100% rename from seeds/_sector/dex/kyberswap_bnb_base_trades_seed.csv rename to dex/seeds/trades/kyberswap_bnb_base_trades_seed.csv diff --git a/seeds/_sector/dex/kyberswap_ethereum_base_trades_seed.csv b/dex/seeds/trades/kyberswap_ethereum_base_trades_seed.csv similarity index 100% rename from seeds/_sector/dex/kyberswap_ethereum_base_trades_seed.csv rename to dex/seeds/trades/kyberswap_ethereum_base_trades_seed.csv diff --git a/seeds/_sector/dex/kyberswap_optimism_base_trades_seed.csv b/dex/seeds/trades/kyberswap_optimism_base_trades_seed.csv similarity index 100% rename from seeds/_sector/dex/kyberswap_optimism_base_trades_seed.csv rename to dex/seeds/trades/kyberswap_optimism_base_trades_seed.csv diff --git a/seeds/_sector/dex/kyberswap_polygon_base_trades_seed.csv b/dex/seeds/trades/kyberswap_polygon_base_trades_seed.csv similarity index 100% rename from seeds/_sector/dex/kyberswap_polygon_base_trades_seed.csv rename to dex/seeds/trades/kyberswap_polygon_base_trades_seed.csv diff --git a/seeds/_sector/dex/leetswap_v2_base_base_trades_seed.csv b/dex/seeds/trades/leetswap_v2_base_base_trades_seed.csv similarity index 100% rename from seeds/_sector/dex/leetswap_v2_base_base_trades_seed.csv rename to dex/seeds/trades/leetswap_v2_base_base_trades_seed.csv diff --git a/seeds/_sector/dex/lynex_linea_base_trades_seed.csv b/dex/seeds/trades/lynex_linea_base_trades_seed.csv similarity index 100% rename from seeds/_sector/dex/lynex_linea_base_trades_seed.csv rename to dex/seeds/trades/lynex_linea_base_trades_seed.csv diff --git a/seeds/_sector/dex/mauve_ethereum_base_trades_seed.csv b/dex/seeds/trades/mauve_ethereum_base_trades_seed.csv similarity index 100% rename from seeds/_sector/dex/mauve_ethereum_base_trades_seed.csv rename to dex/seeds/trades/mauve_ethereum_base_trades_seed.csv diff --git a/seeds/_sector/dex/maverick_base_base_trades_seed.csv b/dex/seeds/trades/maverick_base_base_trades_seed.csv similarity index 100% rename from seeds/_sector/dex/maverick_base_base_trades_seed.csv rename to dex/seeds/trades/maverick_base_base_trades_seed.csv diff --git a/seeds/_sector/dex/maverick_bnb_base_trades_seed.csv b/dex/seeds/trades/maverick_bnb_base_trades_seed.csv similarity index 100% rename from seeds/_sector/dex/maverick_bnb_base_trades_seed.csv rename to dex/seeds/trades/maverick_bnb_base_trades_seed.csv diff --git a/seeds/_sector/dex/maverick_ethereum_base_trades_seed.csv b/dex/seeds/trades/maverick_ethereum_base_trades_seed.csv similarity index 100% rename from seeds/_sector/dex/maverick_ethereum_base_trades_seed.csv rename to dex/seeds/trades/maverick_ethereum_base_trades_seed.csv diff --git a/seeds/_sector/dex/maverick_zksync_base_trades_seed.csv b/dex/seeds/trades/maverick_zksync_base_trades_seed.csv similarity index 100% rename from seeds/_sector/dex/maverick_zksync_base_trades_seed.csv rename to dex/seeds/trades/maverick_zksync_base_trades_seed.csv diff --git a/seeds/_sector/dex/mdex_bnb_base_trades_seed.csv b/dex/seeds/trades/mdex_bnb_base_trades_seed.csv similarity index 100% rename from seeds/_sector/dex/mdex_bnb_base_trades_seed.csv rename to dex/seeds/trades/mdex_bnb_base_trades_seed.csv diff --git a/seeds/_sector/dex/mento_celo_base_trades_seed.csv b/dex/seeds/trades/mento_celo_base_trades_seed.csv similarity index 100% rename from seeds/_sector/dex/mento_celo_base_trades_seed.csv rename to dex/seeds/trades/mento_celo_base_trades_seed.csv diff --git a/seeds/_sector/dex/moonbase_base_base_trades_seed.csv b/dex/seeds/trades/moonbase_base_base_trades_seed.csv similarity index 100% rename from seeds/_sector/dex/moonbase_base_base_trades_seed.csv rename to dex/seeds/trades/moonbase_base_base_trades_seed.csv diff --git a/seeds/_sector/dex/mstable_ethereum_base_trades_seed.csv b/dex/seeds/trades/mstable_ethereum_base_trades_seed.csv similarity index 100% rename from seeds/_sector/dex/mstable_ethereum_base_trades_seed.csv rename to dex/seeds/trades/mstable_ethereum_base_trades_seed.csv diff --git a/seeds/_sector/dex/mummy_finance_optimism_base_trades_seed.csv b/dex/seeds/trades/mummy_finance_optimism_base_trades_seed.csv similarity index 100% rename from seeds/_sector/dex/mummy_finance_optimism_base_trades_seed.csv rename to dex/seeds/trades/mummy_finance_optimism_base_trades_seed.csv diff --git a/seeds/_sector/dex/mute_zksync_base_trades_seed.csv b/dex/seeds/trades/mute_zksync_base_trades_seed.csv similarity index 100% rename from seeds/_sector/dex/mute_zksync_base_trades_seed.csv rename to dex/seeds/trades/mute_zksync_base_trades_seed.csv diff --git a/seeds/_sector/dex/nile_linea_base_trades_seed.csv b/dex/seeds/trades/nile_linea_base_trades_seed.csv similarity index 100% rename from seeds/_sector/dex/nile_linea_base_trades_seed.csv rename to dex/seeds/trades/nile_linea_base_trades_seed.csv diff --git a/seeds/_sector/dex/nomiswap_bnb_base_trades_seed.csv b/dex/seeds/trades/nomiswap_bnb_base_trades_seed.csv similarity index 100% rename from seeds/_sector/dex/nomiswap_bnb_base_trades_seed.csv rename to dex/seeds/trades/nomiswap_bnb_base_trades_seed.csv diff --git a/seeds/_sector/dex/nuri_scroll_base_trades_seed.csv b/dex/seeds/trades/nuri_scroll_base_trades_seed.csv similarity index 100% rename from seeds/_sector/dex/nuri_scroll_base_trades_seed.csv rename to dex/seeds/trades/nuri_scroll_base_trades_seed.csv diff --git a/seeds/_sector/dex/oasisswap_arbitrum_base_trades_seed.csv b/dex/seeds/trades/oasisswap_arbitrum_base_trades_seed.csv similarity index 100% rename from seeds/_sector/dex/oasisswap_arbitrum_base_trades_seed.csv rename to dex/seeds/trades/oasisswap_arbitrum_base_trades_seed.csv diff --git a/seeds/_sector/dex/oasisswap_base_base_trades_seed.csv b/dex/seeds/trades/oasisswap_base_base_trades_seed.csv similarity index 100% rename from seeds/_sector/dex/oasisswap_base_base_trades_seed.csv rename to dex/seeds/trades/oasisswap_base_base_trades_seed.csv diff --git a/seeds/_sector/dex/oneinch_arbitrum_base_trades_seed.csv b/dex/seeds/trades/oneinch_arbitrum_base_trades_seed.csv similarity index 100% rename from seeds/_sector/dex/oneinch_arbitrum_base_trades_seed.csv rename to dex/seeds/trades/oneinch_arbitrum_base_trades_seed.csv diff --git a/seeds/_sector/dex/oneinch_avalanche_c_base_trades_seed.csv b/dex/seeds/trades/oneinch_avalanche_c_base_trades_seed.csv similarity index 100% rename from seeds/_sector/dex/oneinch_avalanche_c_base_trades_seed.csv rename to dex/seeds/trades/oneinch_avalanche_c_base_trades_seed.csv diff --git a/seeds/_sector/dex/oneinch_base_base_trades_seed.csv b/dex/seeds/trades/oneinch_base_base_trades_seed.csv similarity index 100% rename from seeds/_sector/dex/oneinch_base_base_trades_seed.csv rename to dex/seeds/trades/oneinch_base_base_trades_seed.csv diff --git a/seeds/_sector/dex/oneinch_bnb_base_trades_seed.csv b/dex/seeds/trades/oneinch_bnb_base_trades_seed.csv similarity index 100% rename from seeds/_sector/dex/oneinch_bnb_base_trades_seed.csv rename to dex/seeds/trades/oneinch_bnb_base_trades_seed.csv diff --git a/seeds/_sector/dex/oneinch_ethereum_base_trades_seed.csv b/dex/seeds/trades/oneinch_ethereum_base_trades_seed.csv similarity index 100% rename from seeds/_sector/dex/oneinch_ethereum_base_trades_seed.csv rename to dex/seeds/trades/oneinch_ethereum_base_trades_seed.csv diff --git a/seeds/_sector/dex/oneinch_fantom_base_trades_seed.csv b/dex/seeds/trades/oneinch_fantom_base_trades_seed.csv similarity index 100% rename from seeds/_sector/dex/oneinch_fantom_base_trades_seed.csv rename to dex/seeds/trades/oneinch_fantom_base_trades_seed.csv diff --git a/seeds/_sector/dex/oneinch_gnosis_base_trades_seed.csv b/dex/seeds/trades/oneinch_gnosis_base_trades_seed.csv similarity index 100% rename from seeds/_sector/dex/oneinch_gnosis_base_trades_seed.csv rename to dex/seeds/trades/oneinch_gnosis_base_trades_seed.csv diff --git a/seeds/_sector/dex/oneinch_optimism_base_trades_seed.csv b/dex/seeds/trades/oneinch_optimism_base_trades_seed.csv similarity index 100% rename from seeds/_sector/dex/oneinch_optimism_base_trades_seed.csv rename to dex/seeds/trades/oneinch_optimism_base_trades_seed.csv diff --git a/seeds/_sector/dex/oneinch_polygon_base_trades_seed.csv b/dex/seeds/trades/oneinch_polygon_base_trades_seed.csv similarity index 100% rename from seeds/_sector/dex/oneinch_polygon_base_trades_seed.csv rename to dex/seeds/trades/oneinch_polygon_base_trades_seed.csv diff --git a/seeds/_sector/dex/oneinch_zksync_base_trades_seed.csv b/dex/seeds/trades/oneinch_zksync_base_trades_seed.csv similarity index 100% rename from seeds/_sector/dex/oneinch_zksync_base_trades_seed.csv rename to dex/seeds/trades/oneinch_zksync_base_trades_seed.csv diff --git a/seeds/_sector/dex/onepunchswap_bnb_base_trades_seed.csv b/dex/seeds/trades/onepunchswap_bnb_base_trades_seed.csv similarity index 100% rename from seeds/_sector/dex/onepunchswap_bnb_base_trades_seed.csv rename to dex/seeds/trades/onepunchswap_bnb_base_trades_seed.csv diff --git a/seeds/_sector/dex/openocean_avalanche_c_base_trades_seed.csv b/dex/seeds/trades/openocean_avalanche_c_base_trades_seed.csv similarity index 100% rename from seeds/_sector/dex/openocean_avalanche_c_base_trades_seed.csv rename to dex/seeds/trades/openocean_avalanche_c_base_trades_seed.csv diff --git a/seeds/_sector/dex/openocean_base_base_trades_seed.csv b/dex/seeds/trades/openocean_base_base_trades_seed.csv similarity index 100% rename from seeds/_sector/dex/openocean_base_base_trades_seed.csv rename to dex/seeds/trades/openocean_base_base_trades_seed.csv diff --git a/seeds/_sector/dex/openocean_fantom_base_trades_seed.csv b/dex/seeds/trades/openocean_fantom_base_trades_seed.csv similarity index 100% rename from seeds/_sector/dex/openocean_fantom_base_trades_seed.csv rename to dex/seeds/trades/openocean_fantom_base_trades_seed.csv diff --git a/seeds/_sector/dex/openocean_optimism_base_trades_seed.csv b/dex/seeds/trades/openocean_optimism_base_trades_seed.csv similarity index 100% rename from seeds/_sector/dex/openocean_optimism_base_trades_seed.csv rename to dex/seeds/trades/openocean_optimism_base_trades_seed.csv diff --git a/seeds/_sector/dex/openxswap_optimism_base_trades_seed.csv b/dex/seeds/trades/openxswap_optimism_base_trades_seed.csv similarity index 100% rename from seeds/_sector/dex/openxswap_optimism_base_trades_seed.csv rename to dex/seeds/trades/openxswap_optimism_base_trades_seed.csv diff --git a/seeds/_sector/dex/opx_finance_optimism_base_trades_seed.csv b/dex/seeds/trades/opx_finance_optimism_base_trades_seed.csv similarity index 100% rename from seeds/_sector/dex/opx_finance_optimism_base_trades_seed.csv rename to dex/seeds/trades/opx_finance_optimism_base_trades_seed.csv diff --git a/seeds/_sector/dex/pancakeswap_arbitrum_base_trades_seed.csv b/dex/seeds/trades/pancakeswap_arbitrum_base_trades_seed.csv similarity index 100% rename from seeds/_sector/dex/pancakeswap_arbitrum_base_trades_seed.csv rename to dex/seeds/trades/pancakeswap_arbitrum_base_trades_seed.csv diff --git a/seeds/_sector/dex/pancakeswap_base_base_trades_seed.csv b/dex/seeds/trades/pancakeswap_base_base_trades_seed.csv similarity index 100% rename from seeds/_sector/dex/pancakeswap_base_base_trades_seed.csv rename to dex/seeds/trades/pancakeswap_base_base_trades_seed.csv diff --git a/seeds/_sector/dex/pancakeswap_bnb_base_trades_seed.csv b/dex/seeds/trades/pancakeswap_bnb_base_trades_seed.csv similarity index 100% rename from seeds/_sector/dex/pancakeswap_bnb_base_trades_seed.csv rename to dex/seeds/trades/pancakeswap_bnb_base_trades_seed.csv diff --git a/seeds/_sector/dex/pancakeswap_ethereum_base_trades_seed.csv b/dex/seeds/trades/pancakeswap_ethereum_base_trades_seed.csv similarity index 100% rename from seeds/_sector/dex/pancakeswap_ethereum_base_trades_seed.csv rename to dex/seeds/trades/pancakeswap_ethereum_base_trades_seed.csv diff --git a/seeds/_sector/dex/pancakeswap_linea_base_trades_seed.csv b/dex/seeds/trades/pancakeswap_linea_base_trades_seed.csv similarity index 100% rename from seeds/_sector/dex/pancakeswap_linea_base_trades_seed.csv rename to dex/seeds/trades/pancakeswap_linea_base_trades_seed.csv diff --git a/seeds/_sector/dex/pancakeswap_zkevm_base_trades_seed.csv b/dex/seeds/trades/pancakeswap_zkevm_base_trades_seed.csv similarity index 100% rename from seeds/_sector/dex/pancakeswap_zkevm_base_trades_seed.csv rename to dex/seeds/trades/pancakeswap_zkevm_base_trades_seed.csv diff --git a/seeds/_sector/dex/pancakeswap_zksync_base_trades_seed.csv b/dex/seeds/trades/pancakeswap_zksync_base_trades_seed.csv similarity index 100% rename from seeds/_sector/dex/pancakeswap_zksync_base_trades_seed.csv rename to dex/seeds/trades/pancakeswap_zksync_base_trades_seed.csv diff --git a/seeds/_sector/dex/pharaoh_avalanche_c_base_trades_seed.csv b/dex/seeds/trades/pharaoh_avalanche_c_base_trades_seed.csv similarity index 100% rename from seeds/_sector/dex/pharaoh_avalanche_c_base_trades_seed.csv rename to dex/seeds/trades/pharaoh_avalanche_c_base_trades_seed.csv diff --git a/seeds/_sector/dex/plantbaseswap_base_base_trades_seed.csv b/dex/seeds/trades/plantbaseswap_base_base_trades_seed.csv similarity index 100% rename from seeds/_sector/dex/plantbaseswap_base_base_trades_seed.csv rename to dex/seeds/trades/plantbaseswap_base_base_trades_seed.csv diff --git a/seeds/_sector/dex/platypus_finance_avalanche_c_base_trades_seed.csv b/dex/seeds/trades/platypus_finance_avalanche_c_base_trades_seed.csv similarity index 100% rename from seeds/_sector/dex/platypus_finance_avalanche_c_base_trades_seed.csv rename to dex/seeds/trades/platypus_finance_avalanche_c_base_trades_seed.csv diff --git a/seeds/_sector/dex/quickswap_polygon_base_trades_seed.csv b/dex/seeds/trades/quickswap_polygon_base_trades_seed.csv similarity index 100% rename from seeds/_sector/dex/quickswap_polygon_base_trades_seed.csv rename to dex/seeds/trades/quickswap_polygon_base_trades_seed.csv diff --git a/seeds/_sector/dex/ramses_arbitrum_base_trades_seed.csv b/dex/seeds/trades/ramses_arbitrum_base_trades_seed.csv similarity index 100% rename from seeds/_sector/dex/ramses_arbitrum_base_trades_seed.csv rename to dex/seeds/trades/ramses_arbitrum_base_trades_seed.csv diff --git a/seeds/_sector/dex/rocketswap_base_base_trades_seed.csv b/dex/seeds/trades/rocketswap_base_base_trades_seed.csv similarity index 100% rename from seeds/_sector/dex/rocketswap_base_base_trades_seed.csv rename to dex/seeds/trades/rocketswap_base_base_trades_seed.csv diff --git a/seeds/_sector/dex/rubicon_arbitrum_base_trades_seed.csv b/dex/seeds/trades/rubicon_arbitrum_base_trades_seed.csv similarity index 100% rename from seeds/_sector/dex/rubicon_arbitrum_base_trades_seed.csv rename to dex/seeds/trades/rubicon_arbitrum_base_trades_seed.csv diff --git a/seeds/_sector/dex/rubicon_base_base_trades_seed.csv b/dex/seeds/trades/rubicon_base_base_trades_seed.csv similarity index 100% rename from seeds/_sector/dex/rubicon_base_base_trades_seed.csv rename to dex/seeds/trades/rubicon_base_base_trades_seed.csv diff --git a/seeds/_sector/dex/rubicon_optimism_base_trades_seed.csv b/dex/seeds/trades/rubicon_optimism_base_trades_seed.csv similarity index 100% rename from seeds/_sector/dex/rubicon_optimism_base_trades_seed.csv rename to dex/seeds/trades/rubicon_optimism_base_trades_seed.csv diff --git a/seeds/_sector/dex/scale_base_base_trades_seed.csv b/dex/seeds/trades/scale_base_base_trades_seed.csv similarity index 100% rename from seeds/_sector/dex/scale_base_base_trades_seed.csv rename to dex/seeds/trades/scale_base_base_trades_seed.csv diff --git a/seeds/_sector/dex/scrollswap_scroll_base_trades_seed.csv b/dex/seeds/trades/scrollswap_scroll_base_trades_seed.csv similarity index 100% rename from seeds/_sector/dex/scrollswap_scroll_base_trades_seed.csv rename to dex/seeds/trades/scrollswap_scroll_base_trades_seed.csv diff --git a/seeds/_sector/dex/secta_linea_base_trades_seed.csv b/dex/seeds/trades/secta_linea_base_trades_seed.csv similarity index 100% rename from seeds/_sector/dex/secta_linea_base_trades_seed.csv rename to dex/seeds/trades/secta_linea_base_trades_seed.csv diff --git a/seeds/_sector/dex/sharkswap_base_base_trades_seed.csv b/dex/seeds/trades/sharkswap_base_base_trades_seed.csv similarity index 100% rename from seeds/_sector/dex/sharkswap_base_base_trades_seed.csv rename to dex/seeds/trades/sharkswap_base_base_trades_seed.csv diff --git a/seeds/_sector/dex/sharkyswap_arbitrum_base_trades_seed.csv b/dex/seeds/trades/sharkyswap_arbitrum_base_trades_seed.csv similarity index 100% rename from seeds/_sector/dex/sharkyswap_arbitrum_base_trades_seed.csv rename to dex/seeds/trades/sharkyswap_arbitrum_base_trades_seed.csv diff --git a/seeds/_sector/dex/shibaswap_ethereum_base_trades_seed.csv b/dex/seeds/trades/shibaswap_ethereum_base_trades_seed.csv similarity index 100% rename from seeds/_sector/dex/shibaswap_ethereum_base_trades_seed.csv rename to dex/seeds/trades/shibaswap_ethereum_base_trades_seed.csv diff --git a/seeds/_sector/dex/smardex_arbitrum_base_trades_seed.csv b/dex/seeds/trades/smardex_arbitrum_base_trades_seed.csv similarity index 100% rename from seeds/_sector/dex/smardex_arbitrum_base_trades_seed.csv rename to dex/seeds/trades/smardex_arbitrum_base_trades_seed.csv diff --git a/seeds/_sector/dex/smardex_base_base_trades_seed.csv b/dex/seeds/trades/smardex_base_base_trades_seed.csv similarity index 100% rename from seeds/_sector/dex/smardex_base_base_trades_seed.csv rename to dex/seeds/trades/smardex_base_base_trades_seed.csv diff --git a/seeds/_sector/dex/sobal_base_base_trades_seed.csv b/dex/seeds/trades/sobal_base_base_trades_seed.csv similarity index 100% rename from seeds/_sector/dex/sobal_base_base_trades_seed.csv rename to dex/seeds/trades/sobal_base_base_trades_seed.csv diff --git a/seeds/_sector/dex/solidlizard_arbitrum_base_trades_seed.csv b/dex/seeds/trades/solidlizard_arbitrum_base_trades_seed.csv similarity index 100% rename from seeds/_sector/dex/solidlizard_arbitrum_base_trades_seed.csv rename to dex/seeds/trades/solidlizard_arbitrum_base_trades_seed.csv diff --git a/seeds/_sector/dex/solidly_base_base_trades_seed.csv b/dex/seeds/trades/solidly_base_base_trades_seed.csv similarity index 100% rename from seeds/_sector/dex/solidly_base_base_trades_seed.csv rename to dex/seeds/trades/solidly_base_base_trades_seed.csv diff --git a/seeds/_sector/dex/solidly_v3_arbitrum_base_trades_seed.csv b/dex/seeds/trades/solidly_v3_arbitrum_base_trades_seed.csv similarity index 100% rename from seeds/_sector/dex/solidly_v3_arbitrum_base_trades_seed.csv rename to dex/seeds/trades/solidly_v3_arbitrum_base_trades_seed.csv diff --git a/seeds/_sector/dex/solidly_v3_base_base_trades_seed.csv b/dex/seeds/trades/solidly_v3_base_base_trades_seed.csv similarity index 100% rename from seeds/_sector/dex/solidly_v3_base_base_trades_seed.csv rename to dex/seeds/trades/solidly_v3_base_base_trades_seed.csv diff --git a/seeds/_sector/dex/solidly_v3_ethereum_base_trades_seed.csv b/dex/seeds/trades/solidly_v3_ethereum_base_trades_seed.csv similarity index 100% rename from seeds/_sector/dex/solidly_v3_ethereum_base_trades_seed.csv rename to dex/seeds/trades/solidly_v3_ethereum_base_trades_seed.csv diff --git a/seeds/_sector/dex/solidly_v3_fantom_base_trades_seed.csv b/dex/seeds/trades/solidly_v3_fantom_base_trades_seed.csv similarity index 100% rename from seeds/_sector/dex/solidly_v3_fantom_base_trades_seed.csv rename to dex/seeds/trades/solidly_v3_fantom_base_trades_seed.csv diff --git a/seeds/_sector/dex/solidly_v3_optimism_base_trades_seed.csv b/dex/seeds/trades/solidly_v3_optimism_base_trades_seed.csv similarity index 100% rename from seeds/_sector/dex/solidly_v3_optimism_base_trades_seed.csv rename to dex/seeds/trades/solidly_v3_optimism_base_trades_seed.csv diff --git a/seeds/_sector/dex/soswap_base_base_trades_seed.csv b/dex/seeds/trades/soswap_base_base_trades_seed.csv similarity index 100% rename from seeds/_sector/dex/soswap_base_base_trades_seed.csv rename to dex/seeds/trades/soswap_base_base_trades_seed.csv diff --git a/seeds/_sector/dex/spacefi_zksync_base_trades_seed.csv b/dex/seeds/trades/spacefi_zksync_base_trades_seed.csv similarity index 100% rename from seeds/_sector/dex/spacefi_zksync_base_trades_seed.csv rename to dex/seeds/trades/spacefi_zksync_base_trades_seed.csv diff --git a/seeds/_sector/dex/spartacus_exchange_fantom_base_trades_seed.csv b/dex/seeds/trades/spartacus_exchange_fantom_base_trades_seed.csv similarity index 100% rename from seeds/_sector/dex/spartacus_exchange_fantom_base_trades_seed.csv rename to dex/seeds/trades/spartacus_exchange_fantom_base_trades_seed.csv diff --git a/seeds/_sector/dex/spiritswap_fantom_base_trades_seed.csv b/dex/seeds/trades/spiritswap_fantom_base_trades_seed.csv similarity index 100% rename from seeds/_sector/dex/spiritswap_fantom_base_trades_seed.csv rename to dex/seeds/trades/spiritswap_fantom_base_trades_seed.csv diff --git a/seeds/_sector/dex/spookyswap_fantom_base_trades_seed.csv b/dex/seeds/trades/spookyswap_fantom_base_trades_seed.csv similarity index 100% rename from seeds/_sector/dex/spookyswap_fantom_base_trades_seed.csv rename to dex/seeds/trades/spookyswap_fantom_base_trades_seed.csv diff --git a/seeds/_sector/dex/sterling_finance_arbitrum_base_trades_seed.csv b/dex/seeds/trades/sterling_finance_arbitrum_base_trades_seed.csv similarity index 100% rename from seeds/_sector/dex/sterling_finance_arbitrum_base_trades_seed.csv rename to dex/seeds/trades/sterling_finance_arbitrum_base_trades_seed.csv diff --git a/seeds/_sector/dex/sushiswap_arbitrum_base_trades_seed.csv b/dex/seeds/trades/sushiswap_arbitrum_base_trades_seed.csv similarity index 100% rename from seeds/_sector/dex/sushiswap_arbitrum_base_trades_seed.csv rename to dex/seeds/trades/sushiswap_arbitrum_base_trades_seed.csv diff --git a/seeds/_sector/dex/sushiswap_avalanche_c_base_trades_seed.csv b/dex/seeds/trades/sushiswap_avalanche_c_base_trades_seed.csv similarity index 100% rename from seeds/_sector/dex/sushiswap_avalanche_c_base_trades_seed.csv rename to dex/seeds/trades/sushiswap_avalanche_c_base_trades_seed.csv diff --git a/seeds/_sector/dex/sushiswap_base_base_trades_seed.csv b/dex/seeds/trades/sushiswap_base_base_trades_seed.csv similarity index 100% rename from seeds/_sector/dex/sushiswap_base_base_trades_seed.csv rename to dex/seeds/trades/sushiswap_base_base_trades_seed.csv diff --git a/seeds/_sector/dex/sushiswap_bnb_base_trades_seed.csv b/dex/seeds/trades/sushiswap_bnb_base_trades_seed.csv similarity index 100% rename from seeds/_sector/dex/sushiswap_bnb_base_trades_seed.csv rename to dex/seeds/trades/sushiswap_bnb_base_trades_seed.csv diff --git a/seeds/_sector/dex/sushiswap_celo_base_trades_seed.csv b/dex/seeds/trades/sushiswap_celo_base_trades_seed.csv similarity index 100% rename from seeds/_sector/dex/sushiswap_celo_base_trades_seed.csv rename to dex/seeds/trades/sushiswap_celo_base_trades_seed.csv diff --git a/seeds/_sector/dex/sushiswap_ethereum_base_trades_seed.csv b/dex/seeds/trades/sushiswap_ethereum_base_trades_seed.csv similarity index 100% rename from seeds/_sector/dex/sushiswap_ethereum_base_trades_seed.csv rename to dex/seeds/trades/sushiswap_ethereum_base_trades_seed.csv diff --git a/seeds/_sector/dex/sushiswap_fantom_base_trades_seed.csv b/dex/seeds/trades/sushiswap_fantom_base_trades_seed.csv similarity index 100% rename from seeds/_sector/dex/sushiswap_fantom_base_trades_seed.csv rename to dex/seeds/trades/sushiswap_fantom_base_trades_seed.csv diff --git a/seeds/_sector/dex/sushiswap_gnosis_base_trades_seed.csv b/dex/seeds/trades/sushiswap_gnosis_base_trades_seed.csv similarity index 100% rename from seeds/_sector/dex/sushiswap_gnosis_base_trades_seed.csv rename to dex/seeds/trades/sushiswap_gnosis_base_trades_seed.csv diff --git a/seeds/_sector/dex/sushiswap_linea_base_trades_seed.csv b/dex/seeds/trades/sushiswap_linea_base_trades_seed.csv similarity index 100% rename from seeds/_sector/dex/sushiswap_linea_base_trades_seed.csv rename to dex/seeds/trades/sushiswap_linea_base_trades_seed.csv diff --git a/seeds/_sector/dex/sushiswap_optimism_base_trades_seed.csv b/dex/seeds/trades/sushiswap_optimism_base_trades_seed.csv similarity index 100% rename from seeds/_sector/dex/sushiswap_optimism_base_trades_seed.csv rename to dex/seeds/trades/sushiswap_optimism_base_trades_seed.csv diff --git a/seeds/_sector/dex/sushiswap_polygon_base_trades_seed.csv b/dex/seeds/trades/sushiswap_polygon_base_trades_seed.csv similarity index 100% rename from seeds/_sector/dex/sushiswap_polygon_base_trades_seed.csv rename to dex/seeds/trades/sushiswap_polygon_base_trades_seed.csv diff --git a/seeds/_sector/dex/sushiswap_scroll_base_trades_seed.csv b/dex/seeds/trades/sushiswap_scroll_base_trades_seed.csv similarity index 100% rename from seeds/_sector/dex/sushiswap_scroll_base_trades_seed.csv rename to dex/seeds/trades/sushiswap_scroll_base_trades_seed.csv diff --git a/seeds/_sector/dex/swaap_v2_arbitrum_base_trades_seed.csv b/dex/seeds/trades/swaap_v2_arbitrum_base_trades_seed.csv similarity index 100% rename from seeds/_sector/dex/swaap_v2_arbitrum_base_trades_seed.csv rename to dex/seeds/trades/swaap_v2_arbitrum_base_trades_seed.csv diff --git a/seeds/_sector/dex/swapbased_base_base_trades_seed.csv b/dex/seeds/trades/swapbased_base_base_trades_seed.csv similarity index 100% rename from seeds/_sector/dex/swapbased_base_base_trades_seed.csv rename to dex/seeds/trades/swapbased_base_base_trades_seed.csv diff --git a/seeds/_sector/dex/swapr_ethereum_base_trades_seed.csv b/dex/seeds/trades/swapr_ethereum_base_trades_seed.csv similarity index 100% rename from seeds/_sector/dex/swapr_ethereum_base_trades_seed.csv rename to dex/seeds/trades/swapr_ethereum_base_trades_seed.csv diff --git a/seeds/_sector/dex/syncswap_scroll_base_trades_seed.csv b/dex/seeds/trades/syncswap_scroll_base_trades_seed.csv similarity index 100% rename from seeds/_sector/dex/syncswap_scroll_base_trades_seed.csv rename to dex/seeds/trades/syncswap_scroll_base_trades_seed.csv diff --git a/seeds/_sector/dex/syncswap_zksync_base_trades_seed.csv b/dex/seeds/trades/syncswap_zksync_base_trades_seed.csv similarity index 100% rename from seeds/_sector/dex/syncswap_zksync_base_trades_seed.csv rename to dex/seeds/trades/syncswap_zksync_base_trades_seed.csv diff --git a/seeds/_sector/dex/synthetix_optimism_base_trades_seed.csv b/dex/seeds/trades/synthetix_optimism_base_trades_seed.csv similarity index 100% rename from seeds/_sector/dex/synthetix_optimism_base_trades_seed.csv rename to dex/seeds/trades/synthetix_optimism_base_trades_seed.csv diff --git a/seeds/_sector/dex/synthswap_base_base_trades_seed.csv b/dex/seeds/trades/synthswap_base_base_trades_seed.csv similarity index 100% rename from seeds/_sector/dex/synthswap_base_base_trades_seed.csv rename to dex/seeds/trades/synthswap_base_base_trades_seed.csv diff --git a/seeds/_sector/dex/thena_bnb_base_trades_seed.csv b/dex/seeds/trades/thena_bnb_base_trades_seed.csv similarity index 100% rename from seeds/_sector/dex/thena_bnb_base_trades_seed.csv rename to dex/seeds/trades/thena_bnb_base_trades_seed.csv diff --git a/seeds/_sector/dex/throne_exchange_v2_base_base_trades_seed.csv b/dex/seeds/trades/throne_exchange_v2_base_base_trades_seed.csv similarity index 100% rename from seeds/_sector/dex/throne_exchange_v2_base_base_trades_seed.csv rename to dex/seeds/trades/throne_exchange_v2_base_base_trades_seed.csv diff --git a/seeds/_sector/dex/throne_exchange_v3_base_base_trades_seed.csv b/dex/seeds/trades/throne_exchange_v3_base_base_trades_seed.csv similarity index 100% rename from seeds/_sector/dex/throne_exchange_v3_base_base_trades_seed.csv rename to dex/seeds/trades/throne_exchange_v3_base_base_trades_seed.csv diff --git a/seeds/_sector/dex/torus_base_base_trades_seed.csv b/dex/seeds/trades/torus_base_base_trades_seed.csv similarity index 100% rename from seeds/_sector/dex/torus_base_base_trades_seed.csv rename to dex/seeds/trades/torus_base_base_trades_seed.csv diff --git a/seeds/_sector/dex/trader_joe_arbitrum_base_trades_seed.csv b/dex/seeds/trades/trader_joe_arbitrum_base_trades_seed.csv similarity index 100% rename from seeds/_sector/dex/trader_joe_arbitrum_base_trades_seed.csv rename to dex/seeds/trades/trader_joe_arbitrum_base_trades_seed.csv diff --git a/seeds/_sector/dex/trader_joe_avalanche_c_base_trades_seed.csv b/dex/seeds/trades/trader_joe_avalanche_c_base_trades_seed.csv similarity index 100% rename from seeds/_sector/dex/trader_joe_avalanche_c_base_trades_seed.csv rename to dex/seeds/trades/trader_joe_avalanche_c_base_trades_seed.csv diff --git a/seeds/_sector/dex/trader_joe_bnb_base_trades_seed.csv b/dex/seeds/trades/trader_joe_bnb_base_trades_seed.csv similarity index 100% rename from seeds/_sector/dex/trader_joe_bnb_base_trades_seed.csv rename to dex/seeds/trades/trader_joe_bnb_base_trades_seed.csv diff --git a/seeds/_sector/dex/ubeswap_celo_base_trades_seed.csv b/dex/seeds/trades/ubeswap_celo_base_trades_seed.csv similarity index 100% rename from seeds/_sector/dex/ubeswap_celo_base_trades_seed.csv rename to dex/seeds/trades/ubeswap_celo_base_trades_seed.csv diff --git a/seeds/_sector/dex/uniswap_arbitrum_base_trades_seed.csv b/dex/seeds/trades/uniswap_arbitrum_base_trades_seed.csv similarity index 100% rename from seeds/_sector/dex/uniswap_arbitrum_base_trades_seed.csv rename to dex/seeds/trades/uniswap_arbitrum_base_trades_seed.csv diff --git a/seeds/_sector/dex/uniswap_avalanche_c_base_trades_seed.csv b/dex/seeds/trades/uniswap_avalanche_c_base_trades_seed.csv similarity index 100% rename from seeds/_sector/dex/uniswap_avalanche_c_base_trades_seed.csv rename to dex/seeds/trades/uniswap_avalanche_c_base_trades_seed.csv diff --git a/seeds/_sector/dex/uniswap_base_base_trades_seed.csv b/dex/seeds/trades/uniswap_base_base_trades_seed.csv similarity index 100% rename from seeds/_sector/dex/uniswap_base_base_trades_seed.csv rename to dex/seeds/trades/uniswap_base_base_trades_seed.csv diff --git a/seeds/_sector/dex/uniswap_bnb_base_trades_seed.csv b/dex/seeds/trades/uniswap_bnb_base_trades_seed.csv similarity index 100% rename from seeds/_sector/dex/uniswap_bnb_base_trades_seed.csv rename to dex/seeds/trades/uniswap_bnb_base_trades_seed.csv diff --git a/seeds/_sector/dex/uniswap_celo_base_trades_seed.csv b/dex/seeds/trades/uniswap_celo_base_trades_seed.csv similarity index 100% rename from seeds/_sector/dex/uniswap_celo_base_trades_seed.csv rename to dex/seeds/trades/uniswap_celo_base_trades_seed.csv diff --git a/seeds/_sector/dex/uniswap_ethereum_base_trades_seed.csv b/dex/seeds/trades/uniswap_ethereum_base_trades_seed.csv similarity index 100% rename from seeds/_sector/dex/uniswap_ethereum_base_trades_seed.csv rename to dex/seeds/trades/uniswap_ethereum_base_trades_seed.csv diff --git a/seeds/_sector/dex/uniswap_optimism_base_trades_seed.csv b/dex/seeds/trades/uniswap_optimism_base_trades_seed.csv similarity index 100% rename from seeds/_sector/dex/uniswap_optimism_base_trades_seed.csv rename to dex/seeds/trades/uniswap_optimism_base_trades_seed.csv diff --git a/seeds/_sector/dex/uniswap_polygon_base_trades_seed.csv b/dex/seeds/trades/uniswap_polygon_base_trades_seed.csv similarity index 100% rename from seeds/_sector/dex/uniswap_polygon_base_trades_seed.csv rename to dex/seeds/trades/uniswap_polygon_base_trades_seed.csv diff --git a/seeds/_sector/dex/uniswap_scroll_base_trades_seed.csv b/dex/seeds/trades/uniswap_scroll_base_trades_seed.csv similarity index 100% rename from seeds/_sector/dex/uniswap_scroll_base_trades_seed.csv rename to dex/seeds/trades/uniswap_scroll_base_trades_seed.csv diff --git a/seeds/_sector/dex/uniswap_zksync_base_trades_seed.csv b/dex/seeds/trades/uniswap_zksync_base_trades_seed.csv similarity index 100% rename from seeds/_sector/dex/uniswap_zksync_base_trades_seed.csv rename to dex/seeds/trades/uniswap_zksync_base_trades_seed.csv diff --git a/seeds/_sector/dex/uniswap_zora_base_trades_seed.csv b/dex/seeds/trades/uniswap_zora_base_trades_seed.csv similarity index 100% rename from seeds/_sector/dex/uniswap_zora_base_trades_seed.csv rename to dex/seeds/trades/uniswap_zora_base_trades_seed.csv diff --git a/seeds/_sector/dex/velocimeter_v2_base_base_trades_seed.csv b/dex/seeds/trades/velocimeter_v2_base_base_trades_seed.csv similarity index 100% rename from seeds/_sector/dex/velocimeter_v2_base_base_trades_seed.csv rename to dex/seeds/trades/velocimeter_v2_base_base_trades_seed.csv diff --git a/seeds/_sector/dex/velocore_zksync_base_trades_seed.csv b/dex/seeds/trades/velocore_zksync_base_trades_seed.csv similarity index 100% rename from seeds/_sector/dex/velocore_zksync_base_trades_seed.csv rename to dex/seeds/trades/velocore_zksync_base_trades_seed.csv diff --git a/seeds/_sector/dex/velodrome_optimism_base_trades_seed.csv b/dex/seeds/trades/velodrome_optimism_base_trades_seed.csv similarity index 100% rename from seeds/_sector/dex/velodrome_optimism_base_trades_seed.csv rename to dex/seeds/trades/velodrome_optimism_base_trades_seed.csv diff --git a/seeds/_sector/dex/verse_dex_ethereum_base_trades_seed.csv b/dex/seeds/trades/verse_dex_ethereum_base_trades_seed.csv similarity index 100% rename from seeds/_sector/dex/verse_dex_ethereum_base_trades_seed.csv rename to dex/seeds/trades/verse_dex_ethereum_base_trades_seed.csv diff --git a/seeds/_sector/dex/vesync_zksync_base_trades_seed.csv b/dex/seeds/trades/vesync_zksync_base_trades_seed.csv similarity index 100% rename from seeds/_sector/dex/vesync_zksync_base_trades_seed.csv rename to dex/seeds/trades/vesync_zksync_base_trades_seed.csv diff --git a/seeds/_sector/dex/voltswap_base_base_trades_seed.csv b/dex/seeds/trades/voltswap_base_base_trades_seed.csv similarity index 100% rename from seeds/_sector/dex/voltswap_base_base_trades_seed.csv rename to dex/seeds/trades/voltswap_base_base_trades_seed.csv diff --git a/seeds/_sector/dex/wagmi_zksync_base_trades_seed.csv b/dex/seeds/trades/wagmi_zksync_base_trades_seed.csv similarity index 100% rename from seeds/_sector/dex/wagmi_zksync_base_trades_seed.csv rename to dex/seeds/trades/wagmi_zksync_base_trades_seed.csv diff --git a/seeds/_sector/dex/wardenswap_optimism_base_trades_seed.csv b/dex/seeds/trades/wardenswap_optimism_base_trades_seed.csv similarity index 100% rename from seeds/_sector/dex/wardenswap_optimism_base_trades_seed.csv rename to dex/seeds/trades/wardenswap_optimism_base_trades_seed.csv diff --git a/seeds/_sector/dex/wigoswap_fantom_base_trades_seed.csv b/dex/seeds/trades/wigoswap_fantom_base_trades_seed.csv similarity index 100% rename from seeds/_sector/dex/wigoswap_fantom_base_trades_seed.csv rename to dex/seeds/trades/wigoswap_fantom_base_trades_seed.csv diff --git a/seeds/_sector/dex/wombat_bnb_base_trades_seed.csv b/dex/seeds/trades/wombat_bnb_base_trades_seed.csv similarity index 100% rename from seeds/_sector/dex/wombat_bnb_base_trades_seed.csv rename to dex/seeds/trades/wombat_bnb_base_trades_seed.csv diff --git a/seeds/_sector/dex/wombat_exchange_arbitrum_base_trades_seed.csv b/dex/seeds/trades/wombat_exchange_arbitrum_base_trades_seed.csv similarity index 100% rename from seeds/_sector/dex/wombat_exchange_arbitrum_base_trades_seed.csv rename to dex/seeds/trades/wombat_exchange_arbitrum_base_trades_seed.csv diff --git a/seeds/_sector/dex/wombat_exchange_base_base_trades_seed.csv b/dex/seeds/trades/wombat_exchange_base_base_trades_seed.csv similarity index 100% rename from seeds/_sector/dex/wombat_exchange_base_base_trades_seed.csv rename to dex/seeds/trades/wombat_exchange_base_base_trades_seed.csv diff --git a/seeds/_sector/dex/wombat_exchange_optimism_base_trades_seed.csv b/dex/seeds/trades/wombat_exchange_optimism_base_trades_seed.csv similarity index 100% rename from seeds/_sector/dex/wombat_exchange_optimism_base_trades_seed.csv rename to dex/seeds/trades/wombat_exchange_optimism_base_trades_seed.csv diff --git a/seeds/_sector/dex/woofi_arbitrum_base_trades_seed.csv b/dex/seeds/trades/woofi_arbitrum_base_trades_seed.csv similarity index 100% rename from seeds/_sector/dex/woofi_arbitrum_base_trades_seed.csv rename to dex/seeds/trades/woofi_arbitrum_base_trades_seed.csv diff --git a/seeds/_sector/dex/woofi_avalanche_c_base_trades_seed.csv b/dex/seeds/trades/woofi_avalanche_c_base_trades_seed.csv similarity index 100% rename from seeds/_sector/dex/woofi_avalanche_c_base_trades_seed.csv rename to dex/seeds/trades/woofi_avalanche_c_base_trades_seed.csv diff --git a/seeds/_sector/dex/woofi_base_base_trades_seed.csv b/dex/seeds/trades/woofi_base_base_trades_seed.csv similarity index 100% rename from seeds/_sector/dex/woofi_base_base_trades_seed.csv rename to dex/seeds/trades/woofi_base_base_trades_seed.csv diff --git a/seeds/_sector/dex/woofi_bnb_base_trades_seed.csv b/dex/seeds/trades/woofi_bnb_base_trades_seed.csv similarity index 100% rename from seeds/_sector/dex/woofi_bnb_base_trades_seed.csv rename to dex/seeds/trades/woofi_bnb_base_trades_seed.csv diff --git a/seeds/_sector/dex/woofi_optimism_base_trades_seed.csv b/dex/seeds/trades/woofi_optimism_base_trades_seed.csv similarity index 100% rename from seeds/_sector/dex/woofi_optimism_base_trades_seed.csv rename to dex/seeds/trades/woofi_optimism_base_trades_seed.csv diff --git a/seeds/_sector/dex/xchange_arbitrum_base_trades_seed.csv b/dex/seeds/trades/xchange_arbitrum_base_trades_seed.csv similarity index 100% rename from seeds/_sector/dex/xchange_arbitrum_base_trades_seed.csv rename to dex/seeds/trades/xchange_arbitrum_base_trades_seed.csv diff --git a/seeds/_sector/dex/xchange_bnb_base_trades_seed.csv b/dex/seeds/trades/xchange_bnb_base_trades_seed.csv similarity index 100% rename from seeds/_sector/dex/xchange_bnb_base_trades_seed.csv rename to dex/seeds/trades/xchange_bnb_base_trades_seed.csv diff --git a/seeds/_sector/dex/xchange_ethereum_base_trades_seed.csv b/dex/seeds/trades/xchange_ethereum_base_trades_seed.csv similarity index 100% rename from seeds/_sector/dex/xchange_ethereum_base_trades_seed.csv rename to dex/seeds/trades/xchange_ethereum_base_trades_seed.csv diff --git a/seeds/_sector/dex/xchange_polygon_base_trades_seed.csv b/dex/seeds/trades/xchange_polygon_base_trades_seed.csv similarity index 100% rename from seeds/_sector/dex/xchange_polygon_base_trades_seed.csv rename to dex/seeds/trades/xchange_polygon_base_trades_seed.csv diff --git a/seeds/_sector/dex/zebra_scroll_base_trades_seed.csv b/dex/seeds/trades/zebra_scroll_base_trades_seed.csv similarity index 100% rename from seeds/_sector/dex/zebra_scroll_base_trades_seed.csv rename to dex/seeds/trades/zebra_scroll_base_trades_seed.csv diff --git a/seeds/_sector/dex/zigzag_arbitrum_base_trades_seed.csv b/dex/seeds/trades/zigzag_arbitrum_base_trades_seed.csv similarity index 100% rename from seeds/_sector/dex/zigzag_arbitrum_base_trades_seed.csv rename to dex/seeds/trades/zigzag_arbitrum_base_trades_seed.csv diff --git a/seeds/_sector/dex/zipswap_optimism_base_trades_seed.csv b/dex/seeds/trades/zipswap_optimism_base_trades_seed.csv similarity index 100% rename from seeds/_sector/dex/zipswap_optimism_base_trades_seed.csv rename to dex/seeds/trades/zipswap_optimism_base_trades_seed.csv diff --git a/seeds/_sector/dex/zkswap_finance_zksync_base_trades_seed.csv b/dex/seeds/trades/zkswap_finance_zksync_base_trades_seed.csv similarity index 100% rename from seeds/_sector/dex/zkswap_finance_zksync_base_trades_seed.csv rename to dex/seeds/trades/zkswap_finance_zksync_base_trades_seed.csv diff --git a/seeds/_sector/dex/zyberswap_arbitrum_base_trades_seed.csv b/dex/seeds/trades/zyberswap_arbitrum_base_trades_seed.csv similarity index 100% rename from seeds/_sector/dex/zyberswap_arbitrum_base_trades_seed.csv rename to dex/seeds/trades/zyberswap_arbitrum_base_trades_seed.csv diff --git a/tests/generic/check_dex_aggregator_seed.sql b/dex/tests/generic/check_dex_aggregator_seed.sql similarity index 100% rename from tests/generic/check_dex_aggregator_seed.sql rename to dex/tests/generic/check_dex_aggregator_seed.sql diff --git a/tests/generic/check_dex_base_trades_seed.sql b/dex/tests/generic/check_dex_base_trades_seed.sql similarity index 100% rename from tests/generic/check_dex_base_trades_seed.sql rename to dex/tests/generic/check_dex_base_trades_seed.sql diff --git a/tests/generic/check_dex_info_relationship.sql b/dex/tests/generic/check_dex_info_relationship.sql similarity index 100% rename from tests/generic/check_dex_info_relationship.sql rename to dex/tests/generic/check_dex_info_relationship.sql diff --git a/tests/generic/check_dex_pools_seed.sql b/dex/tests/generic/check_dex_pools_seed.sql similarity index 100% rename from tests/generic/check_dex_pools_seed.sql rename to dex/tests/generic/check_dex_pools_seed.sql diff --git a/tests/generic/ethereum/zeroex_ethereum_fills_deduped_test.sql b/dex/tests/generic/zeroex_ethereum_fills_deduped_test.sql similarity index 100% rename from tests/generic/ethereum/zeroex_ethereum_fills_deduped_test.sql rename to dex/tests/generic/zeroex_ethereum_fills_deduped_test.sql diff --git a/tests/generic/ethereum/zeroex_ethereum_fills_test.sql b/dex/tests/generic/zeroex_ethereum_fills_test.sql similarity index 100% rename from tests/generic/ethereum/zeroex_ethereum_fills_test.sql rename to dex/tests/generic/zeroex_ethereum_fills_test.sql diff --git a/tests/generic/ethereum/zeroex_ethereum_nft_test.sql b/dex/tests/generic/zeroex_ethereum_nft_test.sql similarity index 100% rename from tests/generic/ethereum/zeroex_ethereum_nft_test.sql rename to dex/tests/generic/zeroex_ethereum_nft_test.sql diff --git a/macros/models/_project/balancer/balancer_bpt_prices_macro.sql b/macros/models/_project/balancer/balancer_bpt_prices_macro.sql index 088277e6b87..23d8f0cfc28 100644 --- a/macros/models/_project/balancer/balancer_bpt_prices_macro.sql +++ b/macros/models/_project/balancer/balancer_bpt_prices_macro.sql @@ -9,7 +9,7 @@ WITH pool_labels AS ( address AS pool_id, name AS pool_symbol, pool_type - FROM {{ ref('labels_balancer_v2_pools') }} + FROM {{ source('labels', 'balancer_v2_pools') }} WHERE blockchain = '{{blockchain}}' ), diff --git a/macros/models/_project/balancer/balancer_bpt_supply_macro.sql b/macros/models/_project/balancer/balancer_bpt_supply_macro.sql index 1b1dab0a80a..9ccb707cd73 100644 --- a/macros/models/_project/balancer/balancer_bpt_supply_macro.sql +++ b/macros/models/_project/balancer/balancer_bpt_supply_macro.sql @@ -11,7 +11,7 @@ WITH pool_labels AS ( name, pool_type, ROW_NUMBER() OVER (PARTITION BY address ORDER BY MAX(updated_at) DESC) AS num - FROM {{ ref('labels_balancer_v2_pools') }} + FROM {{ source('labels', 'balancer_v2_pools') }} WHERE blockchain = '{{blockchain}}' GROUP BY 1, 2, 3) WHERE num = 1 diff --git a/macros/models/_project/balancer/balancer_liquidity_macro.sql b/macros/models/_project/balancer/balancer_liquidity_macro.sql index 5bb70f51e48..5eb9a247eba 100644 --- a/macros/models/_project/balancer/balancer_liquidity_macro.sql +++ b/macros/models/_project/balancer/balancer_liquidity_macro.sql @@ -9,7 +9,7 @@ WITH pool_labels AS ( address AS pool_id, name AS pool_symbol, pool_type - FROM {{ ref('labels_balancer_v2_pools') }} + FROM {{ source('labels', 'balancer_v2_pools') }} WHERE blockchain = '{{blockchain}}' ), @@ -30,7 +30,7 @@ WITH pool_labels AS ( contract_address AS token, approx_percentile(median_price, 0.5) AS price, sum(sample_size) AS sample_size - FROM {{ ref('dex_prices') }} + FROM {{ source('dex', 'prices') }} GROUP BY 1, 2 HAVING sum(sample_size) > 3 ), diff --git a/macros/models/_project/balancer/balancer_pool_token_supply_changes_macro.sql b/macros/models/_project/balancer/balancer_pool_token_supply_changes_macro.sql index 5b876cca011..a9a70e5369d 100644 --- a/macros/models/_project/balancer/balancer_pool_token_supply_changes_macro.sql +++ b/macros/models/_project/balancer/balancer_pool_token_supply_changes_macro.sql @@ -8,7 +8,7 @@ WITH pool_labels AS ( address, name, pool_type - FROM {{ ref('labels_balancer_v2_pools') }} + FROM {{ source('labels', 'balancer_v2_pools') }} WHERE blockchain = '{{blockchain}}' ), diff --git a/macros/models/_project/balancer/balancer_protocol_fee_macro.sql b/macros/models/_project/balancer/balancer_protocol_fee_macro.sql index aa8328088fd..a5dafd0cd11 100644 --- a/macros/models/_project/balancer/balancer_protocol_fee_macro.sql +++ b/macros/models/_project/balancer/balancer_protocol_fee_macro.sql @@ -11,7 +11,7 @@ WITH pool_labels AS ( name, pool_type, ROW_NUMBER() OVER (PARTITION BY address ORDER BY MAX(updated_at) DESC) AS num - FROM {{ ref('labels_balancer_v2_pools') }} + FROM {{ source('labels', 'balancer_v2_pools') }} WHERE blockchain = '{{blockchain}}' GROUP BY 1, 2, 3) WHERE num = 1 @@ -35,7 +35,7 @@ WITH pool_labels AS ( contract_address AS token, approx_percentile(median_price, 0.5) AS price, sum(sample_size) AS sample_size - FROM {{ ref('dex_prices') }} + FROM {{ source('dex', 'prices') }} GROUP BY 1, 2 HAVING sum(sample_size) > 3 ), diff --git a/macros/models/_project/balancer/balancer_token_balance_changes_daily_agg_macro.sql b/macros/models/_project/balancer/balancer_token_balance_changes_daily_agg_macro.sql index 7500f5d7e82..27af2752d29 100644 --- a/macros/models/_project/balancer/balancer_token_balance_changes_daily_agg_macro.sql +++ b/macros/models/_project/balancer/balancer_token_balance_changes_daily_agg_macro.sql @@ -24,7 +24,7 @@ WITH contract_address AS token, approx_percentile(median_price, 0.5) AS price, sum(sample_size) AS sample_size - FROM {{ ref('dex_prices') }} + FROM {{ source('dex', 'prices') }} {% if is_incremental() %} WHERE {{ incremental_predicate('hour') }} {% endif %} diff --git a/macros/models/_project/balancer/balancer_token_balance_changes_macro.sql b/macros/models/_project/balancer/balancer_token_balance_changes_macro.sql index b16c9bf038e..26feb0e2a10 100644 --- a/macros/models/_project/balancer/balancer_token_balance_changes_macro.sql +++ b/macros/models/_project/balancer/balancer_token_balance_changes_macro.sql @@ -8,7 +8,7 @@ WITH pool_labels AS ( address AS pool_id, name AS pool_symbol, pool_type - FROM {{ ref('labels_balancer_v2_pools') }} + FROM {{ source('labels', 'balancer_v2_pools') }} WHERE blockchain = '{{blockchain}}' ), diff --git a/macros/models/_sector/add_amount_usd.sql b/macros/models/_sector/add_amount_usd.sql index 00f5e264a26..c0414440fc4 100644 --- a/macros/models/_sector/add_amount_usd.sql +++ b/macros/models/_sector/add_amount_usd.sql @@ -14,7 +14,7 @@ WITH trusted_tokens AS ( SELECT contract_address , blockchain - FROM {{ ref('prices_trusted_tokens') }} + FROM {{ source('prices','trusted_tokens') }} ) , prices AS ( SELECT diff --git a/models/_project/balancer/liquidity/ethereum/balancer_v1_ethereum_liquidity.sql b/models/_project/balancer/liquidity/ethereum/balancer_v1_ethereum_liquidity.sql index b433278b8db..1c331972d84 100644 --- a/models/_project/balancer/liquidity/ethereum/balancer_v1_ethereum_liquidity.sql +++ b/models/_project/balancer/liquidity/ethereum/balancer_v1_ethereum_liquidity.sql @@ -11,7 +11,7 @@ WITH pool_labels AS ( SELECT address, name - FROM {{ ref('labels_balancer_v1_pools_ethereum') }} + FROM {{ source('labels', 'balancer_v1_pools_ethereum') }} ), prices AS ( diff --git a/models/_project/balancer/pools/_schema.yml b/models/_project/balancer/pools/_schema.yml index 65c86555a7c..88b3adaa386 100644 --- a/models/_project/balancer/pools/_schema.yml +++ b/models/_project/balancer/pools/_schema.yml @@ -1,64 +1,6 @@ version: 2 models: - - name: balancer_pools_fees - meta: - blockchain: arbitrum, avalanche_c, base, ethereum, gnosis, optimism, polygon, zkevm - contributors: jacektrocinski, thetroyharris, viniabussafi - config: - tags: ['arbitrum', 'avalanche_c', 'base', 'ethereum', 'gnosis', 'optimism', 'polygon', 'zkevm', 'pools', 'fees'] - description: > - Balancer v2 swap fees stored at the pool level. - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - blockchain - - block_number - - tx_hash - - index - columns: - - &blockchain - name: blockchain - description: "Blockchain" - - &version - name: version - description: "Version of Balancer where the liquidity pool used in transaction is deployed" - - &contract_address - name: contract_address - description: 'zkevm address for the liquidity pool used in transaction' - tests: - - not_null - - &tx_hash - name: tx_hash - description: 'Transaction hash' - tests: - - not_null - - &index - name: index - description: 'Event Index' - tests: - - not_null - - &tx_index - name: tx_index - description: 'Transaction Index' - tests: - - not_null - - &block_time - name: block_time - description: 'Block time in UTC' - tests: - - not_null - - &block_number - name: block_number - description: 'Event Block Number' - tests: - - not_null - - &swap_fee_percentage - name: swap_fee_percentage - description: 'Swap fees for the pool, values are returned with 18 decimals (1e18 meaning 100%)' - tests: - - not_null - - name: balancer_pools_tokens_weights meta: blockchain: arbitrum, avalanche_c, base, ethereum, gnosis, optimism, polygon, 'zkevm' @@ -74,8 +16,12 @@ models: - pool_id - token_address columns: - - *blockchain - - *version + - &blockchain + name: blockchain + description: "Blockchain" + - &version + name: version + description: "Version of Balancer where the liquidity pool used in transaction is deployed" - &pool_id name: pool_id description: 'Unique encoded identifier that refers to each pool' @@ -164,7 +110,11 @@ models: - &evt_block_number name: evt_block_number description: 'Event Block Number' - - *contract_address + - &contract_address + name: contract_address + description: 'zkevm address for the liquidity pool used in transaction' + tests: + - not_null - &evt_tx_hash name: evt_tx_hash description: 'Transaction hash' diff --git a/models/_project/balancer/pools/arbitrum/_schema.yml b/models/_project/balancer/pools/arbitrum/_schema.yml index fd04cb90077..7b3ed27390a 100644 --- a/models/_project/balancer/pools/arbitrum/_schema.yml +++ b/models/_project/balancer/pools/arbitrum/_schema.yml @@ -1,21 +1,15 @@ version: 2 models: - - name: balancer_v2_arbitrum_pools_fees + - name: balancer_arbitrum_pools_tokens_weights meta: blockchain: arbitrum - project: balancer_v2 - contributors: jacektrocinski, thetroyharris, viniabussafi + project: balancer + contributors: jacektrocinski, viniabussafi config: - tags: ['arbitrum', 'balancer', 'pools_fees'] + tags: ['arbitrum', 'balancer', 'pools', 'tokens', 'weights'] description: > - Balancer v2 swap fees stored at the pool level. - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - block_number - - tx_hash - - index + Token weights in Balancer pools. columns: - &blockchain name: blockchain @@ -23,54 +17,6 @@ models: - &version name: version description: "Version of Balancer where the liquidity pool used in transaction is deployed" - - &contract_address - name: contract_address - description: 'Arbitrum address for the liquidity pool used in transaction' - tests: - - not_null - - &tx_hash - name: tx_hash - description: 'Transaction hash' - tests: - - not_null - - &index - name: index - description: 'Event Index' - tests: - - not_null - - &tx_index - name: tx_index - description: 'Transaction Index' - tests: - - not_null - - &block_time - name: block_time - description: 'Block time in UTC' - tests: - - not_null - - &block_number - name: block_number - description: 'Event Block Number' - tests: - - not_null - - &swap_fee_percentage - name: swap_fee_percentage - description: 'Swap fees for the pool, values are returned with 18 decimals (1e18 meaning 100%)' - tests: - - not_null - - - name: balancer_arbitrum_pools_tokens_weights - meta: - blockchain: arbitrum - project: balancer - contributors: jacektrocinski, viniabussafi - config: - tags: ['arbitrum', 'balancer', 'pools', 'tokens', 'weights'] - description: > - Token weights in Balancer pools. - columns: - - *blockchain - - *version - &pool_id name: pool_id description: 'Unique encoded identifier that refers to each pool' diff --git a/models/_project/balancer/pools/avalanche_c/_schema.yml b/models/_project/balancer/pools/avalanche_c/_schema.yml index 2c5082a751c..27eee2d82fc 100644 --- a/models/_project/balancer/pools/avalanche_c/_schema.yml +++ b/models/_project/balancer/pools/avalanche_c/_schema.yml @@ -1,21 +1,15 @@ version: 2 models: - - name: balancer_v2_avalanche_c_pools_fees + - name: balancer_avalanche_c_pools_tokens_weights meta: blockchain: avalanche_c - project: balancer_v2 - contributors: jacektrocinski, thetroyharris, viniabussafi + project: balancer + contributors: jacektrocinski, viniabussafi config: - tags: ['avalanche_c', 'balancer', 'pools_fees'] + tags: ['avalanche_c', 'balancer', 'pools', 'tokens', 'weights'] description: > - Balancer v2 swap fees stored at the pool level. - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - block_number - - tx_hash - - index + Token weights in Balancer pools. columns: - &blockchain name: blockchain @@ -23,54 +17,6 @@ models: - &version name: version description: "Version of Balancer where the liquidity pool used in transaction is deployed" - - &contract_address - name: contract_address - description: 'avalanche_c address for the liquidity pool used in transaction' - tests: - - not_null - - &tx_hash - name: tx_hash - description: 'Transaction hash' - tests: - - not_null - - &index - name: index - description: 'Event Index' - tests: - - not_null - - &tx_index - name: tx_index - description: 'Transaction Index' - tests: - - not_null - - &block_time - name: block_time - description: 'Block time in UTC' - tests: - - not_null - - &block_number - name: block_number - description: 'Event Block Number' - tests: - - not_null - - &swap_fee_percentage - name: swap_fee_percentage - description: 'Swap fees for the pool, values are returned with 18 decimals (1e18 meaning 100%)' - tests: - - not_null - - - name: balancer_avalanche_c_pools_tokens_weights - meta: - blockchain: avalanche_c - project: balancer - contributors: jacektrocinski, viniabussafi - config: - tags: ['avalanche_c', 'balancer', 'pools', 'tokens', 'weights'] - description: > - Token weights in Balancer pools. - columns: - - *blockchain - - *version - &pool_id name: pool_id description: 'Unique encoded identifier that refers to each pool' diff --git a/models/_project/balancer/pools/balancer_pools_metrics_daily.sql b/models/_project/balancer/pools/balancer_pools_metrics_daily.sql index 9b24ba57a27..02ec8eff4cf 100644 --- a/models/_project/balancer/pools/balancer_pools_metrics_daily.sql +++ b/models/_project/balancer/pools/balancer_pools_metrics_daily.sql @@ -22,7 +22,7 @@ trades AS( blockchain, project_contract_address, sum(amount_usd) AS swap_amount_usd - FROM {{ ref('balancer_trades') }} + FROM {{ source('balancer', 'trades') }} {% if is_incremental() %} WHERE {{incremental_predicate('block_date')}} {% endif %} diff --git a/models/_project/balancer/pools/base/_schema.yml b/models/_project/balancer/pools/base/_schema.yml index 0949d82f17c..37d569a57c3 100644 --- a/models/_project/balancer/pools/base/_schema.yml +++ b/models/_project/balancer/pools/base/_schema.yml @@ -1,21 +1,15 @@ version: 2 models: - - name: balancer_v2_base_pools_fees + - name: balancer_base_pools_tokens_weights meta: blockchain: base - project: balancer_v2 - contributors: jacektrocinski, thetroyharris, viniabussafi + project: balancer + contributors: jacektrocinski, viniabussafi config: - tags: ['base', 'balancer', 'pools_fees'] + tags: ['base', 'balancer', 'pools', 'tokens', 'weights'] description: > - Balancer v2 swap fees stored at the pool level. - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - block_number - - tx_hash - - index + Token weights in Balancer pools. columns: - &blockchain name: blockchain @@ -23,54 +17,6 @@ models: - &version name: version description: "Version of Balancer where the liquidity pool used in transaction is deployed" - - &contract_address - name: contract_address - description: 'base address for the liquidity pool used in transaction' - tests: - - not_null - - &tx_hash - name: tx_hash - description: 'Transaction hash' - tests: - - not_null - - &index - name: index - description: 'Event Index' - tests: - - not_null - - &tx_index - name: tx_index - description: 'Transaction Index' - tests: - - not_null - - &block_time - name: block_time - description: 'Block time in UTC' - tests: - - not_null - - &block_number - name: block_number - description: 'Event Block Number' - tests: - - not_null - - &swap_fee_percentage - name: swap_fee_percentage - description: 'Swap fees for the pool, values are returned with 18 decimals (1e18 meaning 100%)' - tests: - - not_null - - - name: balancer_base_pools_tokens_weights - meta: - blockchain: base - project: balancer - contributors: jacektrocinski, viniabussafi - config: - tags: ['base', 'balancer', 'pools', 'tokens', 'weights'] - description: > - Token weights in Balancer pools. - columns: - - *blockchain - - *version - &pool_id name: pool_id description: 'Unique encoded identifier that refers to each pool' diff --git a/models/_project/balancer/pools/ethereum/_schema.yml b/models/_project/balancer/pools/ethereum/_schema.yml index ea4a24ef8c8..4f92f1b58ac 100644 --- a/models/_project/balancer/pools/ethereum/_schema.yml +++ b/models/_project/balancer/pools/ethereum/_schema.yml @@ -1,21 +1,15 @@ version: 2 models: - - name: balancer_v2_ethereum_pools_fees + - name: balancer_ethereum_pools_tokens_weights meta: blockchain: ethereum - project: balancer_v2 - contributors: jacektrocinski, thetroyharris, viniabussafi + project: balancer + contributors: jacektrocinski, viniabussafi config: - tags: ['ethereum', 'balancer', 'pools', 'fees'] + tags: ['ethereum', 'balancer', 'pools', 'tokens', 'weights'] description: > - Balancer v2 swap fees stored at the pool level. - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - block_number - - tx_hash - - index + Token weights in Balancer pools. columns: - &blockchain name: blockchain @@ -23,54 +17,6 @@ models: - &version name: version description: "Version of Balancer where the liquidity pool used in transaction is deployed" - - &contract_address - name: contract_address - description: 'zkevm address for the liquidity pool used in transaction' - tests: - - not_null - - &tx_hash - name: tx_hash - description: 'Transaction hash' - tests: - - not_null - - &index - name: index - description: 'Event Index' - tests: - - not_null - - &tx_index - name: tx_index - description: 'Transaction Index' - tests: - - not_null - - &block_time - name: block_time - description: 'Block time in UTC' - tests: - - not_null - - &block_number - name: block_number - description: 'Event Block Number' - tests: - - not_null - - &swap_fee_percentage - name: swap_fee_percentage - description: 'Swap fees for the pool, values are returned with 18 decimals (1e18 meaning 100%)' - tests: - - not_null - - - name: balancer_ethereum_pools_tokens_weights - meta: - blockchain: ethereum - project: balancer - contributors: jacektrocinski, viniabussafi - config: - tags: ['ethereum', 'balancer', 'pools', 'tokens', 'weights'] - description: > - Token weights in Balancer pools. - columns: - - *blockchain - - *version - &pool_id name: pool_id description: 'Unique encoded identifier that refers to each pool' diff --git a/models/_project/balancer/pools/gnosis/_schema.yml b/models/_project/balancer/pools/gnosis/_schema.yml index ac61b0140a4..a24d4345cd5 100644 --- a/models/_project/balancer/pools/gnosis/_schema.yml +++ b/models/_project/balancer/pools/gnosis/_schema.yml @@ -1,21 +1,15 @@ version: 2 models: - - name: balancer_v2_gnosis_pools_fees + - name: balancer_gnosis_pools_tokens_weights meta: blockchain: gnosis - project: balancer_v2 - contributors: jacektrocinski, thetroyharris, viniabussafi + project: balancer + contributors: jacektrocinski, viniabussafi config: - tags: ['gnosis', 'balancer', 'pools_fees'] + tags: ['gnosis', 'balancer', 'pools', 'tokens', 'weights'] description: > - Balancer v2 swap fees stored at the pool level. - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - block_number - - tx_hash - - index + Token weights in Balancer pools. columns: - &blockchain name: blockchain @@ -23,54 +17,6 @@ models: - &version name: version description: "Version of Balancer where the liquidity pool used in transaction is deployed" - - &contract_address - name: contract_address - description: 'gnosis address for the liquidity pool used in transaction' - tests: - - not_null - - &tx_hash - name: tx_hash - description: 'Transaction hash' - tests: - - not_null - - &index - name: index - description: 'Event Index' - tests: - - not_null - - &tx_index - name: tx_index - description: 'Transaction Index' - tests: - - not_null - - &block_time - name: block_time - description: 'Block time in UTC' - tests: - - not_null - - &block_number - name: block_number - description: 'Event Block Number' - tests: - - not_null - - &swap_fee_percentage - name: swap_fee_percentage - description: 'Swap fees for the pool, values are returned with 18 decimals (1e18 meaning 100%)' - tests: - - not_null - - - name: balancer_gnosis_pools_tokens_weights - meta: - blockchain: gnosis - project: balancer - contributors: jacektrocinski, viniabussafi - config: - tags: ['gnosis', 'balancer', 'pools', 'tokens', 'weights'] - description: > - Token weights in Balancer pools. - columns: - - *blockchain - - *version - &pool_id name: pool_id description: 'Unique encoded identifier that refers to each pool' diff --git a/models/_project/balancer/pools/optimism/_schema.yml b/models/_project/balancer/pools/optimism/_schema.yml index 289820cd3bc..88a17c5195a 100644 --- a/models/_project/balancer/pools/optimism/_schema.yml +++ b/models/_project/balancer/pools/optimism/_schema.yml @@ -1,21 +1,15 @@ version: 2 models: - - name: balancer_v2_optimism_pools_fees + - name: balancer_optimism_pools_tokens_weights meta: blockchain: optimism - project: balancer_v2 - contributors: jacektrocinski, thetroyharris, viniabussafi + project: balancer + contributors: jacektrocinski, viniabussafi config: - tags: ['optimism', 'balancer', 'pools_fees'] + tags: ['optimism', 'balancer', 'pools', 'tokens', 'weights'] description: > - Balancer v2 swap fees stored at the pool level. - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - block_number - - tx_hash - - index + Token weights in Balancer pools. columns: - &blockchain name: blockchain @@ -23,54 +17,6 @@ models: - &version name: version description: "Version of Balancer where the liquidity pool used in transaction is deployed" - - &contract_address - name: contract_address - description: 'optimism address for the liquidity pool used in transaction' - tests: - - not_null - - &tx_hash - name: tx_hash - description: 'Transaction hash' - tests: - - not_null - - &index - name: index - description: 'Event Index' - tests: - - not_null - - &tx_index - name: tx_index - description: 'Transaction Index' - tests: - - not_null - - &block_time - name: block_time - description: 'Block time in UTC' - tests: - - not_null - - &block_number - name: block_number - description: 'Event Block Number' - tests: - - not_null - - &swap_fee_percentage - name: swap_fee_percentage - description: 'Swap fees for the pool, values are returned with 18 decimals (1e18 meaning 100%)' - tests: - - not_null - - - name: balancer_optimism_pools_tokens_weights - meta: - blockchain: optimism - project: balancer - contributors: jacektrocinski, viniabussafi - config: - tags: ['optimism', 'balancer', 'pools', 'tokens', 'weights'] - description: > - Token weights in Balancer pools. - columns: - - *blockchain - - *version - &pool_id name: pool_id description: 'Unique encoded identifier that refers to each pool' @@ -137,7 +83,8 @@ models: - &evt_block_number name: evt_block_number description: 'Event Block Number' - - *contract_address + - &contract_address + name: contract_address - &evt_tx_hash name: evt_tx_hash description: 'Transaction hash' diff --git a/models/_project/balancer/pools/polygon/_schema.yml b/models/_project/balancer/pools/polygon/_schema.yml index 40929f01c30..a223aebe4c4 100644 --- a/models/_project/balancer/pools/polygon/_schema.yml +++ b/models/_project/balancer/pools/polygon/_schema.yml @@ -1,21 +1,15 @@ version: 2 models: - - name: balancer_v2_polygon_pools_fees + - name: balancer_polygon_pools_tokens_weights meta: blockchain: polygon - project: balancer_v2 - contributors: jacektrocinski, thetroyharris, viniabussafi + project: balancer + contributors: jacektrocinski, viniabussafi config: - tags: ['polygon', 'balancer', 'pools', 'fees'] + tags: ['polygon', 'balancer', 'pools', 'tokens', 'weights'] description: > - Balancer v2 swap fees stored at the pool level. - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - block_number - - tx_hash - - index + Token weights in Balancer pools. columns: - &blockchain name: blockchain @@ -23,54 +17,6 @@ models: - &version name: version description: "Version of Balancer where the liquidity pool used in transaction is deployed" - - &contract_address - name: contract_address - description: 'zkevm address for the liquidity pool used in transaction' - tests: - - not_null - - &tx_hash - name: tx_hash - description: 'Transaction hash' - tests: - - not_null - - &index - name: index - description: 'Event Index' - tests: - - not_null - - &tx_index - name: tx_index - description: 'Transaction Index' - tests: - - not_null - - &block_time - name: block_time - description: 'Block time in UTC' - tests: - - not_null - - &block_number - name: block_number - description: 'Event Block Number' - tests: - - not_null - - &swap_fee_percentage - name: swap_fee_percentage - description: 'Swap fees for the pool, values are returned with 18 decimals (1e18 meaning 100%)' - tests: - - not_null - - - name: balancer_polygon_pools_tokens_weights - meta: - blockchain: polygon - project: balancer - contributors: jacektrocinski, viniabussafi - config: - tags: ['polygon', 'balancer', 'pools', 'tokens', 'weights'] - description: > - Token weights in Balancer pools. - columns: - - *blockchain - - *version - &pool_id name: pool_id description: 'Unique encoded identifier that refers to each pool' diff --git a/models/_project/balancer/pools/zkevm/_schema.yml b/models/_project/balancer/pools/zkevm/_schema.yml index 03f7ab4e6be..cacbbeb205e 100644 --- a/models/_project/balancer/pools/zkevm/_schema.yml +++ b/models/_project/balancer/pools/zkevm/_schema.yml @@ -1,21 +1,15 @@ version: 2 models: - - name: balancer_v2_zkevm_pools_fees + - name: balancer_zkevm_pools_tokens_weights meta: blockchain: zkevm - project: balancer_v2 - contributors: jacektrocinski, thetroyharris, viniabussafi + project: balancer + contributors: jacektrocinski, viniabussafi config: - tags: ['zkevm', 'balancer', 'pools_fees'] + tags: ['zkevm', 'balancer', 'pools', 'tokens', 'weights'] description: > - Balancer v2 swap fees stored at the pool level. - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - block_number - - tx_hash - - index + Token weights in Balancer pools. columns: - &blockchain name: blockchain @@ -23,54 +17,6 @@ models: - &version name: version description: "Version of Balancer where the liquidity pool used in transaction is deployed" - - &contract_address - name: contract_address - description: 'zkevm address for the liquidity pool used in transaction' - tests: - - not_null - - &tx_hash - name: tx_hash - description: 'Transaction hash' - tests: - - not_null - - &index - name: index - description: 'Event Index' - tests: - - not_null - - &tx_index - name: tx_index - description: 'Transaction Index' - tests: - - not_null - - &block_time - name: block_time - description: 'Block time in UTC' - tests: - - not_null - - &block_number - name: block_number - description: 'Event Block Number' - tests: - - not_null - - &swap_fee_percentage - name: swap_fee_percentage - description: 'Swap fees for the pool, values are returned with 18 decimals (1e18 meaning 100%)' - tests: - - not_null - - - name: balancer_zkevm_pools_tokens_weights - meta: - blockchain: zkevm - project: balancer - contributors: jacektrocinski, viniabussafi - config: - tags: ['zkevm', 'balancer', 'pools', 'tokens', 'weights'] - description: > - Token weights in Balancer pools. - columns: - - *blockchain - - *version - &pool_id name: pool_id description: 'Unique encoded identifier that refers to each pool' diff --git a/models/_project/oneinch/_schema.yml b/models/_project/oneinch/_schema.yml new file mode 100644 index 00000000000..f29a47588c3 --- /dev/null +++ b/models/_project/oneinch/_schema.yml @@ -0,0 +1,47 @@ +version: 2 + +models: + - name: oneinch_ethereum_airdrop_claims + meta: + blockchain: ethereum + sector: airdrop + project: oneinch + contributors: hildobby + config: + tags: ['table', 'airdrop', 'ethereum', 'claim', 'oneinch'] + description: "List of claim transactions for the $1INCH airdrop" + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - tx_hash + - recipient + - evt_index + columns: + - name: blockchain + tests: + - not_null + - name: block_time + - name: block_number + description: "Block number of transaction" + - name: project + description: "Project name" + - name: airdrop_number + description: "Airdrop identifier number" + - name: recipient + description: "Airdrop recipient" + - name: contract_address + description: "Contract addressed used" + - name: tx_hash + description: "Transaction hash" + - name: amount_raw + description: "Raw amount of tokens" + - name: amount_original + description: "Original amount of tokens" + - name: amount_usd + description: "USD value of tokens" + - name: token_address + description: "Token address" + - name: token_symbol + description: "Token symbol" + - name: evt_index + description: "Event index" diff --git a/models/oneinch/ethereum/oneinch_ethereum_airdrop_claims.sql b/models/_project/oneinch/oneinch_ethereum_airdrop_claims.sql similarity index 100% rename from models/oneinch/ethereum/oneinch_ethereum_airdrop_claims.sql rename to models/_project/oneinch/oneinch_ethereum_airdrop_claims.sql diff --git a/models/_project/uniswap/arbitrum/uniswap_arbitrum_schema.yml b/models/_project/uniswap/arbitrum/uniswap_arbitrum_schema.yml new file mode 100644 index 00000000000..e81e5710d3d --- /dev/null +++ b/models/_project/uniswap/arbitrum/uniswap_arbitrum_schema.yml @@ -0,0 +1,34 @@ +version: 2 + +models: + - name: uniswap_v3_arbitrum_flashloans + meta: + blockchain: arbitrum + sector: lending + contributors: hildobby + config: + tags: ['arbitrum', 'flashloans'] + description: > + All Uniswap v3 flashloans on Arbitrum + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - blockchain + - tx_hash + - evt_index + columns: + - name: blockchain + - name: project + - name: version + - name: block_time + - name: block_number + - name: amount + - name: amount_usd + - name: tx_hash + - name: evt_index + - name: fee + - name: currency_contract + - name: currency_symbol + - name: recipient + - name: contract_address + - name: block_month diff --git a/models/uniswap/arbitrum/uniswap_v3_arbitrum_flashloans.sql b/models/_project/uniswap/arbitrum/uniswap_v3_arbitrum_flashloans.sql similarity index 100% rename from models/uniswap/arbitrum/uniswap_v3_arbitrum_flashloans.sql rename to models/_project/uniswap/arbitrum/uniswap_v3_arbitrum_flashloans.sql diff --git a/models/_project/uniswap/bnb/uniswap_bnb_schema.yml b/models/_project/uniswap/bnb/uniswap_bnb_schema.yml new file mode 100644 index 00000000000..768b8c47dc4 --- /dev/null +++ b/models/_project/uniswap/bnb/uniswap_bnb_schema.yml @@ -0,0 +1,34 @@ +version: 2 + +models: + - name: uniswap_v3_bnb_flashloans + meta: + blockchain: bnb + sector: lending + contributors: hildobby + config: + tags: ['bnb', 'flashloans'] + description: > + All Uniswap v3 flashloans on BNB + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - blockchain + - tx_hash + - evt_index + columns: + - name: blockchain + - name: project + - name: version + - name: block_time + - name: block_number + - name: amount + - name: amount_usd + - name: tx_hash + - name: evt_index + - name: fee + - name: currency_contract + - name: currency_symbol + - name: recipient + - name: contract_address + - name: block_month \ No newline at end of file diff --git a/models/uniswap/bnb/uniswap_v3_bnb_flashloans.sql b/models/_project/uniswap/bnb/uniswap_v3_bnb_flashloans.sql similarity index 100% rename from models/uniswap/bnb/uniswap_v3_bnb_flashloans.sql rename to models/_project/uniswap/bnb/uniswap_v3_bnb_flashloans.sql diff --git a/models/_project/uniswap/celo/uniswap_celo_schema.yml b/models/_project/uniswap/celo/uniswap_celo_schema.yml new file mode 100644 index 00000000000..0560a061054 --- /dev/null +++ b/models/_project/uniswap/celo/uniswap_celo_schema.yml @@ -0,0 +1,34 @@ +version: 2 + +models: + - name: uniswap_v3_celo_flashloans + meta: + blockchain: celo + sector: lending + contributors: hildobby, tomfutago + config: + tags: ['celo', 'flashloans'] + description: > + All Uniswap v3 flashloans on Celo + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - blockchain + - tx_hash + - evt_index + columns: + - name: blockchain + - name: project + - name: version + - name: block_time + - name: block_number + - name: amount + - name: amount_usd + - name: tx_hash + - name: evt_index + - name: fee + - name: currency_contract + - name: currency_symbol + - name: recipient + - name: contract_address + - name: block_month diff --git a/models/uniswap/celo/uniswap_v3_celo_flashloans.sql b/models/_project/uniswap/celo/uniswap_v3_celo_flashloans.sql similarity index 81% rename from models/uniswap/celo/uniswap_v3_celo_flashloans.sql rename to models/_project/uniswap/celo/uniswap_v3_celo_flashloans.sql index 647c52468ec..b3e73a5b29d 100644 --- a/models/uniswap/celo/uniswap_v3_celo_flashloans.sql +++ b/models/_project/uniswap/celo/uniswap_v3_celo_flashloans.sql @@ -1,13 +1,14 @@ {{ config( - alias = 'flashloans' - , materialized = 'incremental' - , file_format = 'delta' - , incremental_strategy = 'merge' - , unique_key = ['tx_hash', 'evt_index'] - , post_hook = '{{ expose_spells(\'["celo"]\', - "project", - "uniswap_v3", - \'["hildobby", "tomfutago"]\') }}' + schema = 'uniswap_v3_celo' + , alias = 'flashloans' + , materialized = 'incremental' + , file_format = 'delta' + , incremental_strategy = 'merge' + , unique_key = ['tx_hash', 'evt_index'] + , post_hook = '{{ expose_spells(\'["celo"]\', + "project", + "uniswap_v3", + \'["hildobby", "tomfutago"]\') }}' ) }} diff --git a/models/uniswap/ethereum/uniswap_ethereum_airdrop_claims.sql b/models/_project/uniswap/ethereum/uniswap_ethereum_airdrop_claims.sql similarity index 98% rename from models/uniswap/ethereum/uniswap_ethereum_airdrop_claims.sql rename to models/_project/uniswap/ethereum/uniswap_ethereum_airdrop_claims.sql index 41b6a24fb07..525592ad039 100644 --- a/models/uniswap/ethereum/uniswap_ethereum_airdrop_claims.sql +++ b/models/_project/uniswap/ethereum/uniswap_ethereum_airdrop_claims.sql @@ -1,6 +1,6 @@ {{ config( - + schema = 'uniswap_ethereum', alias = 'airdrop_claims', materialized = 'incremental', file_format = 'delta', diff --git a/models/_project/uniswap/ethereum/uniswap_ethereum_schema.yml b/models/_project/uniswap/ethereum/uniswap_ethereum_schema.yml new file mode 100644 index 00000000000..27a5bd5cca3 --- /dev/null +++ b/models/_project/uniswap/ethereum/uniswap_ethereum_schema.yml @@ -0,0 +1,195 @@ +version: 2 + +models: + - name: uniswap_v3_ethereum_votes + meta: + blockchain: ethereum + sector: dao + contributors: soispoke + config: + tags: ['ethereum', 'votes', 'dao', 'cross-chain'] + description: > + DAO votes on all chains across all contracts and versions + columns: + - name: blockchain + - name: project + description: "Project name of the DAO" + - name: version + description: "Version of the contract built and deployed by the DAO project" + - name: block_time + description: "UTC event block time of each DAO vote" + - &block_month + name: block_month + description: "UTC event block month of each DEX trade" + - name: tx_hash + description: "Unique transaction hash value tied to each vote on the DAO" + - &dao_name + name: dao_name + description: "DAO name" + - &dao_address + name: dao_address + description: "DAO wallet address" + - &proposal_id + name: proposal_id + - &votes + name: votes + description: "Votes weighted by the amount of governance tokens" + - &votes_share + name: votes_share + description: "Votes share in percent for a given proposal" + - &token_symbol + name: token_symbol + - &token_address + name: token_address + - &votes_value_usd + name: votes_value_usd + description: "USD amount of governance tokens used at the time of the vote" + - &voter_address + name: voter_address + - &support + name: support + description: "0 = Against, 1 = For, 2 = Abstain votes" + tests: + - accepted_values: + values: ['for', 'against', 'abstain'] + - &reason + name: reason + description: "Optional onchain comments to explain votes" + + - name: uniswap_v3_ethereum_proposals + meta: + blockchain: ethereum + sector: dao + contributors: soispoke + config: + tags: ['ethereum', 'proposals', 'dao', 'cross-chain'] + description: > + DAO proposals on all chains across all contracts and versions + tests: + - check_seed: + seed_file: ref('uniswap_v3_proposals_seed') + match_columns: + - blockchain + - proposal_id + check_columns: + - status + columns: + - name: blockchain + - name: project + description: "Project name of the DAO" + - name: version + description: "Version of the contract built and deployed by the DAO project" + - name: created_at + description: "UTC event block time at which the proposal was created" + - name: tx_hash + description: "Unique transaction hash value tied to each DAO proposal" + - *dao_name + - *dao_address + - *block_month + - name: proposal_id + tests: + - unique + - &votes_for + name: votes_for + - &votes_against + name: votes_against + - &votes_total + name: votes_total + description: "Total number of governance tokens used to vote on a given DAO proposal" + - &number_of_voters + name: number_of_voters + - &participation + name: participation + description: "Participation in percent: Number of governance tokens used to vote / Total token supply" + - &status + name: status + description: "Proposal status: Queued, Active, Executed, Canceled or Defeated" + tests: + - accepted_values: + values: ['Queued', 'Active', 'Executed', 'Canceled','Defeated'] + - &description + name: description + description: "Description of the proposal" + + - name: uniswap_ethereum_airdrop_claims + meta: + blockchain: ethereum + sector: airdrop + project: uniswap + contributors: hildobby + config: + tags: ['table', 'airdrop', 'ethereum', 'claim', 'uniswap'] + description: "List of claim transactions for the $UNI airdrop" + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - tx_hash + - recipient + - evt_index + columns: + - &blockchain + name: blockchain + description: "Blockchain which the DEX is deployed" + - &block_time + name: block_time + description: "UTC event block time of each DEX trade" + - &block_number + name: block_number + description: "Block number of transaction" + - &project + name: project + description: "Project name of the DEX" + - &airdrop_number + name: airdrop_number + description: "Airdrop identifier number" + - &recipient + name: recipient + description: "Airdrop recipient" + - &contract_address + name: contract_address + description: "Contract addressed used" + - &tx_hash + name: tx_hash + description: "Unique transaction hash value tied to each transaction on the DEX" + - name: amount_raw + description: "Raw amount of tokens" + - name: amount_original + description: "Original amount of tokens" + - name: amount_usd + description: "USD value of tokens" + - *token_address + - *token_symbol + - &evt_index + name: evt_index + + - name: uniswap_v3_ethereum_flashloans + meta: + blockchain: ethereum + sector: lending + contributors: hildobby + config: + tags: ['ethereum', 'flashloans'] + description: > + All Uniswap v3 flashloans on Ethereum + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - blockchain + - tx_hash + - evt_index + columns: + - name: blockchain + - name: project + - name: version + - name: block_time + - name: block_number + - name: amount + - name: amount_usd + - name: tx_hash + - name: evt_index + - name: fee + - name: currency_contract + - name: currency_symbol + - name: recipient + - name: contract_address + - name: block_month diff --git a/models/uniswap/ethereum/uniswap_v3_ethereum_flashloans.sql b/models/_project/uniswap/ethereum/uniswap_v3_ethereum_flashloans.sql similarity index 100% rename from models/uniswap/ethereum/uniswap_v3_ethereum_flashloans.sql rename to models/_project/uniswap/ethereum/uniswap_v3_ethereum_flashloans.sql diff --git a/models/uniswap/ethereum/uniswap_v3_ethereum_proposals.sql b/models/_project/uniswap/ethereum/uniswap_v3_ethereum_proposals.sql similarity index 100% rename from models/uniswap/ethereum/uniswap_v3_ethereum_proposals.sql rename to models/_project/uniswap/ethereum/uniswap_v3_ethereum_proposals.sql diff --git a/models/uniswap/ethereum/uniswap_v3_ethereum_votes.sql b/models/_project/uniswap/ethereum/uniswap_v3_ethereum_votes.sql similarity index 100% rename from models/uniswap/ethereum/uniswap_v3_ethereum_votes.sql rename to models/_project/uniswap/ethereum/uniswap_v3_ethereum_votes.sql diff --git a/models/_project/uniswap/optimism/uniswap_optimism_schema.yml b/models/_project/uniswap/optimism/uniswap_optimism_schema.yml new file mode 100644 index 00000000000..9430771f4a9 --- /dev/null +++ b/models/_project/uniswap/optimism/uniswap_optimism_schema.yml @@ -0,0 +1,34 @@ +version: 2 + +models: + - name: uniswap_v3_optimism_flashloans + meta: + blockchain: optimism + sector: lending + contributors: hildobby + config: + tags: ['optimism', 'flashloans'] + description: > + All Uniswap v3 flashloans on Optimism + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - blockchain + - tx_hash + - evt_index + columns: + - name: blockchain + - name: project + - name: version + - name: block_time + - name: block_number + - name: amount + - name: amount_usd + - name: tx_hash + - name: evt_index + - name: fee + - name: currency_contract + - name: currency_symbol + - name: recipient + - name: contract_address + - name: block_month diff --git a/models/uniswap/optimism/uniswap_v3_optimism_flashloans.sql b/models/_project/uniswap/optimism/uniswap_v3_optimism_flashloans.sql similarity index 100% rename from models/uniswap/optimism/uniswap_v3_optimism_flashloans.sql rename to models/_project/uniswap/optimism/uniswap_v3_optimism_flashloans.sql diff --git a/models/_project/uniswap/polygon/uniswap_polygon_schema.yml b/models/_project/uniswap/polygon/uniswap_polygon_schema.yml new file mode 100644 index 00000000000..3986e172aac --- /dev/null +++ b/models/_project/uniswap/polygon/uniswap_polygon_schema.yml @@ -0,0 +1,34 @@ +version: 2 + +models: + - name: uniswap_v3_polygon_flashloans + meta: + blockchain: polygon + sector: lending + contributors: hildobby + config: + tags: ['polygon', 'flashloans'] + description: > + All Uniswap v3 flashloans on Polygon + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - blockchain + - tx_hash + - evt_index + columns: + - name: blockchain + - name: project + - name: version + - name: block_time + - name: block_number + - name: amount + - name: amount_usd + - name: tx_hash + - name: evt_index + - name: fee + - name: currency_contract + - name: currency_symbol + - name: recipient + - name: contract_address + - name: block_month diff --git a/models/uniswap/polygon/uniswap_v3_polygon_flashloans.sql b/models/_project/uniswap/polygon/uniswap_v3_polygon_flashloans.sql similarity index 100% rename from models/uniswap/polygon/uniswap_v3_polygon_flashloans.sql rename to models/_project/uniswap/polygon/uniswap_v3_polygon_flashloans.sql diff --git a/models/uniswap/uniswap_flashloans.sql b/models/_project/uniswap/uniswap_flashloans.sql similarity index 97% rename from models/uniswap/uniswap_flashloans.sql rename to models/_project/uniswap/uniswap_flashloans.sql index a75933e5608..e8001c6f8a7 100644 --- a/models/uniswap/uniswap_flashloans.sql +++ b/models/_project/uniswap/uniswap_flashloans.sql @@ -1,5 +1,5 @@ {{ config( - + schema = 'uniswap', alias = 'flashloans', post_hook='{{ expose_spells(\'["ethereum","arbitrum", "optimism", "polygon", "bnb"]\', "project", diff --git a/models/_project/uniswap/uniswap_schema.yml b/models/_project/uniswap/uniswap_schema.yml new file mode 100644 index 00000000000..379f24a05d8 --- /dev/null +++ b/models/_project/uniswap/uniswap_schema.yml @@ -0,0 +1,35 @@ +version: 2 + +models: + - name: uniswap_flashloans + meta: + blockchain: ethereum, bnb, arbitrum, optimism, polygon, celo + sector: lending + contributors: hildobby, tomfutago + config: + tags: ['ethereum', 'bnb', 'arbitrum', 'optimism', 'polygon', 'celo', 'flashloans'] + description: > + All Uniswap flashloans + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - blockchain + - tx_hash + - evt_index + columns: + - name: blockchain + - name: project + - name: version + - name: block_month + - name: block_time + - name: block_number + - name: amount + - name: amount_usd + - name: tx_hash + - name: evt_index + - name: fee + - name: currency_contract + - name: currency_symbol + - name: recipient + - name: contract_address + - name: block_month diff --git a/models/_sector/depin/polygon/platforms/geodnet_polygon_revenue.sql b/models/_sector/depin/polygon/platforms/geodnet_polygon_revenue.sql index 54039ad513c..7b4db3e07bf 100644 --- a/models/_sector/depin/polygon/platforms/geodnet_polygon_revenue.sql +++ b/models/_sector/depin/polygon/platforms/geodnet_polygon_revenue.sql @@ -51,7 +51,7 @@ WITH AVG(median_price) AS price, DATE_TRUNC('hour', hour) AS hour, DATE_TRUNC('day', hour) AS day - FROM {{ ref('dex_prices') }} + FROM {{ source('dex', 'prices') }} WHERE blockchain = 'polygon' AND contract_address = 0xac0f66379a6d7801d7726d5a943356a172549adb diff --git a/models/alchemydao/ethereum/alchemydao_ethereum_airdrop_claims.sql b/models/alchemydao/ethereum/alchemydao_ethereum_airdrop_claims.sql index ab6b97c580d..b3c283afdd9 100644 --- a/models/alchemydao/ethereum/alchemydao_ethereum_airdrop_claims.sql +++ b/models/alchemydao/ethereum/alchemydao_ethereum_airdrop_claims.sql @@ -20,7 +20,7 @@ WITH more_prices AS ( , MAX(hour) AS max_hour , MIN_BY(median_price, hour) AS min_price , MAX_BY(median_price, hour) AS max_price - FROM {{ ref('dex_prices') }} + FROM {{ source('dex', 'prices') }} WHERE blockchain = 'ethereum' AND contract_address= {{alch_token_address}} ) @@ -44,7 +44,7 @@ SELECT 'ethereum' AS blockchain , 'ALCH' AS token_symbol , t.evt_index FROM {{ source('alchemydao_ethereum', 'MerkleDistributor_evt_Claimed') }} t -LEFT JOIN {{ ref('dex_prices') }} pu ON pu.blockchain = 'ethereum' +LEFT JOIN {{ source('dex', 'prices') }} pu ON pu.blockchain = 'ethereum' AND pu.contract_address= {{alch_token_address}} AND pu.hour = date_trunc('hour', t.evt_block_time) WHERE t.evt_block_time BETWEEN TIMESTAMP '2021-03-28' AND TIMESTAMP '2021-04-19' \ No newline at end of file diff --git a/models/beethoven_x/fantom/beethoven_x_fantom_protocol_fee.sql b/models/beethoven_x/fantom/beethoven_x_fantom_protocol_fee.sql index ac4f94d2a9f..a41f2474d8b 100644 --- a/models/beethoven_x/fantom/beethoven_x_fantom_protocol_fee.sql +++ b/models/beethoven_x/fantom/beethoven_x_fantom_protocol_fee.sql @@ -37,7 +37,7 @@ WITH pool_labels AS ( contract_address AS token, approx_percentile(median_price, 0.5) AS price, sum(sample_size) AS sample_size - FROM {{ ref('dex_prices') }} + FROM {{ source('dex', 'prices') }} GROUP BY 1, 2 HAVING sum(sample_size) > 3 ), diff --git a/models/beethoven_x/fantom/beethoven_x_fantom_schema.yml b/models/beethoven_x/fantom/beethoven_x_fantom_schema.yml index 54e2a286953..a1263080140 100644 --- a/models/beethoven_x/fantom/beethoven_x_fantom_schema.yml +++ b/models/beethoven_x/fantom/beethoven_x_fantom_schema.yml @@ -62,55 +62,6 @@ models: - name: protocol_liquidity_eth description: 'Liquidity of the token in the pool in ETH, except BPTs' - - name: beethoven_x_fantom_pools_fees - meta: - blockchain: fantom - project: beethoven_x - contributors: jacektrocinski, thetroyharris, tomfutago - config: - tags: ['fantom', 'balancer', 'pools_fees'] - description: > - Beethoven X swap fees stored at the pool level. - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - block_number - - tx_hash - - index - columns: - - *blockchain - - &contract_address - name: contract_address - description: 'fantom address for the liquidity pool used in transaction' - tests: - - not_null - - &tx_hash - name: tx_hash - description: "Unique transaction hash value tied to each transaction on the DEX" - - &index - name: index - description: '' - tests: - - not_null - - &tx_index - name: tx_index - description: '' - tests: - - not_null - - &block_time - name: block_time - description: "UTC event block time of each DEX trade" - - &block_number - name: block_number - description: 'Block number' - tests: - - not_null - - &swap_fee_percentage - name: swap_fee_percentage - description: 'Swap fees for the pool, values are returned with 18 decimals (1e18 meaning 100%)' - tests: - - not_null - - name: beethoven_x_fantom_protocol_fee meta: blockchain: fantom diff --git a/models/camelot/arbitrum/camelot_arbitrum_pair_fee_rates.sql b/models/camelot/arbitrum/camelot_arbitrum_pair_fee_rates.sql index a0d7e828857..8589838004b 100644 --- a/models/camelot/arbitrum/camelot_arbitrum_pair_fee_rates.sql +++ b/models/camelot/arbitrum/camelot_arbitrum_pair_fee_rates.sql @@ -101,7 +101,7 @@ with camelot_pair_trades_by_minute as ( select distinct date_trunc('minute', block_time) as minute, project_contract_address as pair - from {{ ref("dex_trades") }} + from {{ source('dex', 'trades') }} where blockchain = '{{blockchain}}' and project = 'camelot' {% if not is_incremental() %} diff --git a/models/cow_protocol/arbitrum/cow_protocol_arbitrum_schema.yml b/models/cow_protocol/arbitrum/cow_protocol_arbitrum_schema.yml deleted file mode 100644 index 68f3a0fdc48..00000000000 --- a/models/cow_protocol/arbitrum/cow_protocol_arbitrum_schema.yml +++ /dev/null @@ -1,109 +0,0 @@ -version: 2 - -models: - - name: cow_protocol_arbitrum_trades - meta: - blockchain: arbitrum - project: cow_protocol - contributors: olgafetisova - config: - tags: ['arbitrum','cow_protocol','trades', 'dex', 'aggregator'] - description: > - CoW Protocol enriched trades list on Arbitrum Chain - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - tx_hash - - order_uid - - evt_index - columns: - - &block_date - name: block_date - description: "UTC event block date of each trade" - - &block_time - name: block_time - description: "Timestamp for block event time in UTC" - - &tx_hash - name: tx_hash - description: "Transaction hash of trade" - - &evt_index - name: evt_index - description: "Index of the corresponding trade event" - - &order_uid - name: order_uid - description: "Unique identifier of order involved in trade. Note that partially fillable orders can be touched multiple times so this is not a unique ID for trade events." - - &trader - name: trader - description: "Owner of the order being traded (aka trader)" - - &sell_token_address - name: sell_token_address - description: "Arbitrum address of sellToken" - - &sell_token - name: sell_token - description: "Symbol of sellToken" - - &buy_token_address - name: buy_token_address - description: "Arbitrum address of buyToken" - - &buy_token - name: buy_token - description: "Symbol of buyToken" - - &token_pair - name: token_pair - description: "Ordered concatenation of buy/sell token symbols involved in trade" - - &units_sold - name: units_sold - description: "Units of sellToken sold (incorporates token decimals)." - - &atoms_sold - name: atoms_sold - description: "Amount (in atoms) of the sellToken sold" - - &units_bought - name: units_bought - description: "Units of buyToken bought (incorporates token decimals)." - - &atoms_bought - name: atoms_bought - description: "Amount (in atoms) of the buyToken bought" - - &usd_value - name: usd_value - description: "USD value of trade (taken as the max of buy value, sell value when both available, otherwise whichever is known)" - - &buy_price - name: buy_price - description: "USD price of buyToken at the time of trade" - - &buy_value_usd - name: buy_value_usd - description: "USD value of buyToken amount" - - &sell_price - name: sell_price - description: "USD price of sellToken at the time of trade" - - &sell_value_usd - name: sell_value_usd - description: "USD value of sellToken amount" - - &fee - name: fee - description: "Unit of fee taken (in sellToken) - incorporating token decimals" - - &fee_atoms - name: fee_atoms - description: "Amount (in atoms) of fee - taken in sellToken" - - &fee_usd - name: fee_usd - description: "USD value of trade fee" - - &app_data - name: app_data - description: "Hashed metadata related to trade event (full content available on IPFS)" - - &receiver - name: receiver - description: "Recipient of trades buyToken" - - &limit_sell_amount - name: limit_sell_amount - description: "Sell amount side of the limit price" - - &limit_buy_amount - name: limit_buy_amount - description: "Buy amount side of the limit price" - - &valid_to - name: valid_to - description: "epoch timestamp (in seconds) until when the order was valid" - - &flags - name: flags - description: "bitmap with additional trade information (cf. https://github.com/cowprotocol/contracts/blob/main/src/contracts/libraries/GPv2Trade.sol#L58-L94)" - - &surplus_usd - name: surplus_usd - description: "USD value of surplus (difference between limit and executed price)" diff --git a/models/cow_protocol/cow_protocol_schema.yml b/models/cow_protocol/cow_protocol_schema.yml index e5e30100826..3cade8424ec 100644 --- a/models/cow_protocol/cow_protocol_schema.yml +++ b/models/cow_protocol/cow_protocol_schema.yml @@ -1,20 +1,15 @@ version: 2 models: - - name: cow_protocol_trades + - name: cow_protocol_batches meta: - blockchain: ethereum - sector: dex + blockchain: gnosis project: cow_protocol - contributors: bh2smith, gentrexha + contributors: bh2smith config: - tags: ['ethereum','cow_protocol','trades','dex','aggregator','cross-chain'] + tags: ['gnosis','cow_protocol','batches', 'dex', 'aggregator', 'auction'] description: > - CoW Protocol trades on all chains across all contracts and versions. - This table will load dex trades downstream. - This particular version of the protocol trades table is intended to conform - with the columns as specified in dex.trades sector. - A more detailed version of the protocol trades table can be found under `cow_protocol_ethereum.trades` + CoW Protocol enriched batches table cross-chain columns: - &blockchain name: blockchain @@ -31,75 +26,6 @@ models: - &block_time name: block_time description: "UTC event block time of each trade" - - &token_bought_symbol - name: token_bought_symbol - description: "Token symbol for token bought in the trade" - - &token_sold_symbol - name: token_sold_symbol - description: "Token symbol for token sold in the trade" - - &token_pair - name: token_pair - description: "Token symbol pair for each token involved in the trade" - - &token_bought_amount - name: token_bought_amount - description: "Value of the token bought at time of execution in the original currency" - - &token_sold_amount - name: token_sold_amount - description: "Value of the token sold at time of execution in the original currency" - - &token_bought_amount_raw - name: token_bought_amount_raw - description: "Raw value of the token bought at time of execution in the original currency" - - &token_sold_amount_raw - name: token_sold_amount_raw - description: "Raw value of the token sold at time of execution in the original currency" - - &amount_usd - name: amount_usd - description: "USD value of the trade at time of execution" - - &token_bought_address - name: token_bought_address - description: "Contract address of the token bought" - - &token_sold_address - name: token_sold_address - description: "Contract address of the token sold" - - &taker - name: taker - description: "Address of trader who purchased a token" - - &maker - name: maker - description: "Address of trader who sold a token" - - &project_contract_address - name: project_contract_address - description: "Project contract address which executed the trade on the blockchain" - - &tx_hash - name: tx_hash - description: "Unique transaction hash value tied to each transaction on the DEX" - - &tx_from - name: tx_from - description: "Trader address owning the order being filled" - - &tx_to - name: tx_to - description: "Address which received the token bought" - - &trace_address - name: trace_address - description: "" - - &evt_index - name: evt_index - description: "Index of the corresponding trade event" - - name: cow_protocol_batches - meta: - blockchain: gnosis - project: cow_protocol - contributors: bh2smith - config: - tags: ['gnosis','cow_protocol','batches', 'dex', 'aggregator', 'auction'] - description: > - CoW Protocol enriched batches table cross-chain - columns: - - *blockchain - - *project - - *version - - *block_date - - *block_time - &num_trades name: num_trades description: Number of trades settled within the batch @@ -112,7 +38,9 @@ models: - &solver_address name: solver_address description: Ethereum address of solver settled batch (equivalent to tx.from) - - *tx_hash + - &tx_hash + name: tx_hash + description: "Unique transaction hash value tied to each transaction on the DEX" - &gas_price name: gas_price description: Gas price (in WEI) of transaction diff --git a/models/cow_protocol/ethereum/cow_protocol_ethereum_batches.sql b/models/cow_protocol/ethereum/cow_protocol_ethereum_batches.sql index 9318c5d61fa..743499aea18 100644 --- a/models/cow_protocol/ethereum/cow_protocol_ethereum_batches.sql +++ b/models/cow_protocol/ethereum/cow_protocol_ethereum_batches.sql @@ -54,7 +54,7 @@ batch_values as ( sum(usd_value) as batch_value, sum(fee_usd) as fee_value, price as eth_price - from {{ ref('cow_protocol_ethereum_trades') }} + from {{ source('cow_protocol_ethereum', 'trades') }} left outer join {{ source('prices', 'usd') }} as p on p.contract_address = 0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2 {% if is_incremental() %} diff --git a/models/cow_protocol/ethereum/cow_protocol_ethereum_referrals.sql b/models/cow_protocol/ethereum/cow_protocol_ethereum_referrals.sql index 928ff6a299c..6af195f559a 100644 --- a/models/cow_protocol/ethereum/cow_protocol_ethereum_referrals.sql +++ b/models/cow_protocol/ethereum/cow_protocol_ethereum_referrals.sql @@ -23,7 +23,7 @@ referral_map as ( ROW_NUMBER() OVER(PARTITION BY trader ORDER BY block_time, evt_index) AS user_trade_index, trader, app_data - FROM {{ ref('cow_protocol_ethereum_trades') }} + FROM {{ source('cow_protocol_ethereum', 'trades') }} GROUP BY trader, block_time, app_data, evt_index ) ,user_first_trade as ( diff --git a/models/cow_protocol/ethereum/cow_protocol_ethereum_schema.yml b/models/cow_protocol/ethereum/cow_protocol_ethereum_schema.yml index 9dfe0df5c8b..c0712beb0b5 100644 --- a/models/cow_protocol/ethereum/cow_protocol_ethereum_schema.yml +++ b/models/cow_protocol/ethereum/cow_protocol_ethereum_schema.yml @@ -10,137 +10,6 @@ models: tags: ['ethereum','cow_protocol','solver'] description: > CoW Protocol solvers list on Ethereum - columns: - - &address - name: address - description: "Solver's wallet address" - - &environment - name: environment - description: "Development environment" - - &name - name: name - description: "Solver's name" - - &active - name: active - description: "Solver's active status according to the events emitted by GPv2AllowListAuthentication. True if solver has been 'added' and not yet removed, False when the solver has been 'removed'." - - - name: cow_protocol_ethereum_trades - meta: - blockchain: ethereum - project: cow_protocol - contributors: bh2smith, gentrexha - config: - tags: ['ethereum','cow_protocol','trades', 'dex', 'aggregator'] - description: > - CoW Protocol enriched trades list on Ethereum - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - tx_hash - - order_uid - - evt_index - columns: - - &block_date - name: block_date - description: "UTC event block date of each trade" - - &block_number - name: block_number - description: "Block number that the transaction was included" - - &block_time - name: block_time - description: "Timestamp for block event time in UTC" - - &tx_hash - name: tx_hash - description: "Transaction hash of trade" - - &evt_index - name: evt_index - description: "Index of the corresponding trade event" - - &order_uid - name: order_uid - description: "Unique identifier of order involved in trade. Note that partially fillable orders can be touched multiple times so this is not a unique ID for trade events." - - &trader - name: trader - description: "Owner of the order being traded (aka trader)" - - &sell_token_address - name: sell_token_address - description: "Ethereum address of sellToken" - - &sell_token - name: sell_token - description: "Symbol of sellToken" - - &buy_token_address - name: buy_token_address - description: "Ethereum address of buyToken" - - &buy_token - name: buy_token - description: "Symbol of buyToken" - - &token_pair - name: token_pair - description: "Ordered concatenation of buy/sell token symbols involved in trade" - - &units_sold - name: units_sold - description: "Units of sellToken sold (incorporates token decimals)." - - &atoms_sold - name: atoms_sold - description: "Amount (in atoms) of the sellToken sold" - - &units_bought - name: units_bought - description: "Units of buyToken bought (incorporates token decimals)." - - &atoms_bought - name: atoms_bought - description: "Amount (in atoms) of the buyToken bought" - - &usd_value - name: usd_value - description: "USD value of trade (taken as the max of buy value, sell value when both available, otherwise whichever is known)" - - &buy_price - name: buy_price - description: "USD price of buyToken at the time of trade" - - &buy_value_usd - name: buy_value_usd - description: "USD value of buyToken amount" - - &sell_price - name: sell_price - description: "USD price of sellToken at the time of trade" - - &sell_value_usd - name: sell_value_usd - description: "USD value of sellToken amount" - - &fee - name: fee - description: "Unit of fee taken (in sellToken) - incorporating token decimals" - - &fee_atoms - name: fee_atoms - description: "Amount (in atoms) of fee - taken in sellToken" - - &fee_usd - name: fee_usd - description: "USD value of trade fee" - - &app_data - name: app_data - description: "Hashed metadata related to trade event (full content available on IPFS)" - - &receiver - name: receiver - description: "Recipient of trades buyToken" - - &limit_sell_amount - name: limit_sell_amount - description: "Sell amount side of the limit price" - - &limit_buy_amount - name: limit_buy_amount - description: "Buy amount side of the limit price" - - &valid_to - name: valid_to - description: "epoch timestamp (in seconds) until when the order was valid" - - &flags - name: flags - description: "bitmap with additional trade information (cf. https://github.com/cowprotocol/contracts/blob/main/src/contracts/libraries/GPv2Trade.sol#L58-L94)" - - &surplus_usd - name: surplus_usd - description: "USD value of surplus (difference between limit and executed price)" - - &order_type - name: order_type - description: "SELL/BUY string indicating if the trade was a sell or buy order" - - &partial_fill - name: partial_fill - description: "Boolean indicating if the order is partially fill-able" - - &fill_proportion - name: fill_proportion - name: cow_protocol_ethereum_batches meta: @@ -151,43 +20,6 @@ models: tags: ['ethereum','cow_protocol','trades', 'dex', 'aggregator', 'auction'] description: > CoW Protocol enriched batches table on Ethereum - columns: - - *block_date - - *block_number - - *block_time - - &num_trades - name: num_trades - description: Number of trades settled within the batch - - &dex_swaps - name: dex_swaps - description: Number of AMM interactions used to settle the batch (Null when unknown) - - &batch_value - name: batch_value - description: Total USD value of trades settled within the batch - - &solver_address - name: solver_address - description: Ethereum address of solver settled batch (equivalent to tx.from) - - *tx_hash - - &gas_price - name: gas_price - description: Gas price (in WEI) of transaction - - &gas_used - name: gas_used - description: Total/cumulative gas consumed (in WEI) to settle the batch - - &tx_cost_usd - name: tx_cost_usd - description: USD cost of batch execution (gas_price * gas_used) / 1e18 * ETH price - - &fee_value - name: Total USD valuation of fees collected from all trades within the batch - - &call_data_size - name: call_data_size - description: Size (in Kilobytes) of call data passed into the settle method. - - &unwraps - name: unwraps - description: Number of WETH unwraps performed within the settlement - - &token_approvals - name: token_approvals - description: Number of ERC20 token approvals made within the settlement - name: cow_protocol_ethereum_app_data meta: @@ -198,26 +30,6 @@ models: tags: ['ethereum','cow_protocol','app_data', "metadata"] description: > CoW Protocol App Data is JSON content stored on IPFS corresponding to order AppHash (cf. CoW Documentation https://docs.cow.fi/front-end/creating-app-ids). - columns: - - &app_hash - name: app_hash - description: Unique identifier of AppData published on-chain, used to fetch remaining content from IPFS. This can be recovered from call data provided to the Settlement Contracts `settle` method - - &app_code - name: app_code - description: App Code is an indicator of where the order came from - primarily intended to be used for integration partners - - *environment - - &order_class - name: order_class - description: Enum flag indicating if an order was a market or limit order (can be Null) - - &referrer - name: referrer - description: Ethereum address of referrer - used for tracking affiliate data (can be Null) - - &slippage_bips - name: slippage_bips - description: User's slippage tolerance configured through the interface. Used to compute trade execution price improvement (can be Null) - - &utm - name: utm - description: utm object associated with the app data (consisting of fields utmSource, utmContent and utmMedium) - name: cow_protocol_ethereum_order_rewards meta: @@ -229,22 +41,6 @@ models: description: > Order Rewards (or more appropriately named Order Meta) contains off-chain meta data relevant to the solver competition on the granularity level of orders. - columns: - - *tx_hash - - &solver - name: solver - description: "Address of the solver who settled the order (i.e. the from address of the corresponding transaction)" - - *block_number - - &cow_reward - name: cow_reward - description: "COW token reward distributed to solver for settling order" - - &surplus_fee - name: surplus_fee - description: "Fee taken from limit orders" - - *order_uid - - "e_solver - name: quote_solver - description: "Address of the solver who provided the winning quote for this order" - name: cow_protocol_ethereum_eth_flow_orders meta: @@ -258,30 +54,6 @@ models: through the ETHFlow contract (https://github.com/cowprotocol/ethflowcontract) sending native which then wraps the asset as an ERC20. The order is filled through this intermediary contract that uses ERC1271 signature verification to place the order on the user's behalf. - columns: - - *block_date - - *block_time - - *block_number - - *tx_hash - - *environment - - *valid_to - - "e_id - name: quote_id - description: Integer corresponding to the quote user was given in the interface. - - &sell_amount - name: sell_amount - description: sell amount as part of the signed user order - - *fee - - &buy_amount - name: buy_amount - description: buy amount as part of the signed user order - - *buy_token - - *receiver - - &sender - name: sender - description: sender of order placement transaction. Equivalent to "trader" - - *app_hash - - *order_uid - name: cow_protocol_ethereum_referrals meta: @@ -295,9 +67,6 @@ models: A referral is considered valid whenever a new trader comes and places their first order with referral address in the meta content. This table contains the relevant query to build the affiliate mapping. - columns: - - *trader - - *referrer - name: cow_protocol_ethereum_trade_slippage meta: @@ -315,25 +84,6 @@ models: combination_of_columns: - order_uid - block_number - columns: - - *order_uid - - *block_time - - *block_number - - &buy_quote - name: buy_quote - - &sell_quote - name: sell_quote - - &tolerance_bips - name: tolerance_bips - - &trade_usd_value - name: trade_usd_value - - *fill_proportion - - &amount_atoms - name: amount_atoms - - &amount_percentage - name: amount_percentage - - &amount_usd - name: amount_usd - name: cow_protocol_ethereum_airdrop_claims meta: @@ -349,37 +99,4 @@ models: combination_of_columns: - tx_hash - recipient - - evt_index - columns: - - &blockchain - name: blockchain - description: "Blockchain" - - *block_time - - *block_number - - &project - name: project - description: "Project name" - - &airdrop_number - name: airdrop_number - description: "Airdrop identifier number" - - &recipient - name: recipient - description: "Airdrop recipient" - - &contract_address - name: contract_address - description: "Contract addressed used" - - *tx_hash - - name: amount_raw - description: "Raw amount of tokens" - - name: amount_original - description: "Original amount of tokens" - - name: amount_usd - description: "USD value of tokens" - - &token_address - name: token_address - description: "Token address" - - &token_symbol - name: token_symbol - description: "Token symbol" - - *evt_index - + - evt_index \ No newline at end of file diff --git a/models/cow_protocol/ethereum/cow_protocol_ethereum_trade_slippage.sql b/models/cow_protocol/ethereum/cow_protocol_ethereum_trade_slippage.sql index 12637353537..4b3987a9bab 100644 --- a/models/cow_protocol/ethereum/cow_protocol_ethereum_trade_slippage.sql +++ b/models/cow_protocol/ethereum/cow_protocol_ethereum_trade_slippage.sql @@ -31,7 +31,7 @@ select usd_value as trade_usd_value, slippage_bips as tolerance_bips from {{ref('cow_protocol_ethereum_app_data')}} as ad -inner join {{ ref('cow_protocol_ethereum_trades') }} as t on t.app_data = ad.app_hash +inner join {{ source('cow_protocol_ethereum', 'trades') }} as t on t.app_data = ad.app_hash where slippage_bips is not null ), diff --git a/models/cow_protocol/gnosis/cow_protocol_gnosis_batches.sql b/models/cow_protocol/gnosis/cow_protocol_gnosis_batches.sql index 6aaad8388cc..4654c7053ab 100644 --- a/models/cow_protocol/gnosis/cow_protocol_gnosis_batches.sql +++ b/models/cow_protocol/gnosis/cow_protocol_gnosis_batches.sql @@ -53,7 +53,7 @@ batch_values as ( sum(usd_value) as batch_value, sum(fee_usd) as fee_value, price as eth_price - from {{ ref('cow_protocol_gnosis_trades') }} + from {{ source('cow_protocol_gnosis', 'trades') }} left outer join {{ source('prices', 'usd') }} as p on p.contract_address = 0xe91d153e0b41518a2ce8dd3d7944fa863463a97d {% if is_incremental() %} diff --git a/models/cow_protocol/gnosis/cow_protocol_gnosis_schema.yml b/models/cow_protocol/gnosis/cow_protocol_gnosis_schema.yml index af34905c012..80d39a5c579 100644 --- a/models/cow_protocol/gnosis/cow_protocol_gnosis_schema.yml +++ b/models/cow_protocol/gnosis/cow_protocol_gnosis_schema.yml @@ -10,125 +10,7 @@ models: tags: ['gnosis_chain','cow_protocol','solver'] description: > CoW Protocol solvers list on Gnosis Chain - columns: - - &address - name: address - description: "Solver's wallet address" - - &environment - name: environment - description: "Solver's environment" - - &name - name: name - description: "Solver's name" - - &active - name: active - description: "Solver's active status according to the events emitted by GPv2AllowListAuthentication. True if solver has been 'added' and not yet removed, False when the solver has been 'removed'." - - name: cow_protocol_gnosis_trades - meta: - blockchain: gnosis - project: cow_protocol - contributors: bh2smith - config: - tags: ['gnosis','cow_protocol','trades', 'dex', 'aggregator'] - description: > - CoW Protocol enriched trades list on Gnosis Chain - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - tx_hash - - order_uid - - evt_index - columns: - - &block_date - name: block_date - description: "UTC event block date of each trade" - - &block_time - name: block_time - description: "Timestamp for block event time in UTC" - - &tx_hash - name: tx_hash - description: "Transaction hash of trade" - - &evt_index - name: evt_index - description: "Index of the corresponding trade event" - - &order_uid - name: order_uid - description: "Unique identifier of order involved in trade. Note that partially fillable orders can be touched multiple times so this is not a unique ID for trade events." - - &trader - name: trader - description: "Owner of the order being traded (aka trader)" - - &sell_token_address - name: sell_token_address - description: "Ethereum address of sellToken" - - &sell_token - name: sell_token - description: "Symbol of sellToken" - - &buy_token_address - name: buy_token_address - description: "Ethereum address of buyToken" - - &buy_token - name: buy_token - description: "Symbol of buyToken" - - &token_pair - name: token_pair - description: "Ordered concatenation of buy/sell token symbols involved in trade" - - &units_sold - name: units_sold - description: "Units of sellToken sold (incorporates token decimals)." - - &atoms_sold - name: atoms_sold - description: "Amount (in atoms) of the sellToken sold" - - &units_bought - name: units_bought - description: "Units of buyToken bought (incorporates token decimals)." - - &atoms_bought - name: atoms_bought - description: "Amount (in atoms) of the buyToken bought" - - &usd_value - name: usd_value - description: "USD value of trade (taken as the max of buy value, sell value when both available, otherwise whichever is known)" - - &buy_price - name: buy_price - description: "USD price of buyToken at the time of trade" - - &buy_value_usd - name: buy_value_usd - description: "USD value of buyToken amount" - - &sell_price - name: sell_price - description: "USD price of sellToken at the time of trade" - - &sell_value_usd - name: sell_value_usd - description: "USD value of sellToken amount" - - &fee - name: fee - description: "Unit of fee taken (in sellToken) - incorporating token decimals" - - &fee_atoms - name: fee_atoms - description: "Amount (in atoms) of fee - taken in sellToken" - - &fee_usd - name: fee_usd - description: "USD value of trade fee" - - &app_data - name: app_data - description: "Hashed metadata related to trade event (full content available on IPFS)" - - &receiver - name: receiver - description: "Recipient of trades buyToken" - - &limit_sell_amount - name: limit_sell_amount - description: "Sell amount side of the limit price" - - &limit_buy_amount - name: limit_buy_amount - description: "Buy amount side of the limit price" - - &valid_to - name: valid_to - description: "epoch timestamp (in seconds) until when the order was valid" - - &flags - name: flags - description: "bitmap with additional trade information (cf. https://github.com/cowprotocol/contracts/blob/main/src/contracts/libraries/GPv2Trade.sol#L58-L94)" - - &surplus_usd - name: surplus_usd - description: "USD value of surplus (difference between limit and executed price)" + - name: cow_protocol_gnosis_batches meta: blockchain: gnosis @@ -138,43 +20,3 @@ models: tags: ['gnosis','cow_protocol','trades', 'dex', 'aggregator', 'auction'] description: > CoW Protocol enriched batches table on Gnosis Chain - columns: - - *block_date - - *block_time - - &num_trades - name: num_trades - description: Number of trades settled within the batch - - &dex_swaps - name: dex_swaps - description: Number of AMM interactions used to settle the batch (estimated) - - &batch_value - name: batch_value - description: Total USD value of trades settled within the batch - - &solver_address - name: solver_address - description: Ethereum address of solver settled batch (equivalent to tx.from) - - name: tx_hash - description: "Transaction hash of trade" - tests: - - unique - - &gas_price - name: gas_price - description: Gas price (in WEI) of transaction - - &gas_used - name: gas_used - description: Total/cumulative gas consumed (in WEI) to settle the batch - - &tx_cost_usd - name: tx_cost_usd - description: USD cost of batch execution (gas_price * gas_used) / 1e18 * ETH price - - &fee_value - name: fee_value - description: Total USD valuation of fees collected from all trades within the batch - - &call_data_size - name: call_data_size - description: Size (in Kilobytes) of call data passed into the settle method. - - &unwraps - name: unwraps - description: Number of WETH unwraps performed within the settlement - - &token_approvals - name: token_approvals - description: Number of ERC20 token approvals made within the settlement diff --git a/models/cow_protocol/tx_hash_labels/bluechip_investment/ethereum/cow_protocol_tx_hash_labels_bluechip_investment_ethereum.sql b/models/cow_protocol/tx_hash_labels/bluechip_investment/ethereum/cow_protocol_tx_hash_labels_bluechip_investment_ethereum.sql index b12bc6ddb47..672f596f107 100644 --- a/models/cow_protocol/tx_hash_labels/bluechip_investment/ethereum/cow_protocol_tx_hash_labels_bluechip_investment_ethereum.sql +++ b/models/cow_protocol/tx_hash_labels/bluechip_investment/ethereum/cow_protocol_tx_hash_labels_bluechip_investment_ethereum.sql @@ -22,13 +22,13 @@ with * from ( select tx_hash, evt_index, project, version - from {{ ref('dex_aggregator_trades') }} + from {{ source('dex_aggregator', 'trades') }} where blockchain = 'ethereum' and token_bought_address in (select bluechip_address from bluechips) and token_sold_address not in (select bluechip_address from bluechips) UNION ALL select tx_hash, evt_index, project, version - from {{ ref('dex_trades') }} + from {{ source('dex', 'trades') }} where blockchain = 'ethereum' and token_bought_address in (select bluechip_address from bluechips) and token_sold_address not in (select bluechip_address from bluechips) diff --git a/models/cow_protocol/tx_hash_labels/early_investment/ethereum/cow_protocol_tx_hash_labels_early_investment_ethereum.sql b/models/cow_protocol/tx_hash_labels/early_investment/ethereum/cow_protocol_tx_hash_labels_early_investment_ethereum.sql index 579a3fa63ac..64d9d6d66d2 100644 --- a/models/cow_protocol/tx_hash_labels/early_investment/ethereum/cow_protocol_tx_hash_labels_early_investment_ethereum.sql +++ b/models/cow_protocol/tx_hash_labels/early_investment/ethereum/cow_protocol_tx_hash_labels_early_investment_ethereum.sql @@ -12,11 +12,11 @@ with min(block_date) as project_start from ( select token_bought_address, block_date - from {{ ref('dex_aggregator_trades') }} + from {{ source('dex_aggregator', 'trades') }} where blockchain = 'ethereum' UNION ALL select token_bought_address, block_date - from {{ ref('dex_trades') }} + from {{ source('dex', 'trades') }} where blockchain = 'ethereum' ) group by @@ -29,11 +29,11 @@ with * from ( select tx_hash, evt_index, project, version, block_date, token_bought_address - from {{ ref('dex_aggregator_trades') }} + from {{ source('dex_aggregator', 'trades') }} where blockchain = 'ethereum' UNION ALL select tx_hash, evt_index, project, version, block_date, token_bought_address - from {{ ref('dex_trades') }} + from {{ source('dex', 'trades') }} where blockchain = 'ethereum' ) t join project_starts p on t.token_bought_address = p.token_bought_address where diff --git a/models/cow_protocol/tx_hash_labels/harvest_yield/ethereum/cow_protocol_tx_hash_labels_harvest_yield_ethereum.sql b/models/cow_protocol/tx_hash_labels/harvest_yield/ethereum/cow_protocol_tx_hash_labels_harvest_yield_ethereum.sql index 20cd6180d98..146941f4b73 100644 --- a/models/cow_protocol/tx_hash_labels/harvest_yield/ethereum/cow_protocol_tx_hash_labels_harvest_yield_ethereum.sql +++ b/models/cow_protocol/tx_hash_labels/harvest_yield/ethereum/cow_protocol_tx_hash_labels_harvest_yield_ethereum.sql @@ -29,12 +29,12 @@ with * from ( select tx_hash, evt_index, project, version - from {{ ref('dex_aggregator_trades') }} + from {{ source('dex_aggregator', 'trades') }} where blockchain = 'ethereum' and token_sold_address in (select harvest_yield_token_address from harvest_yield_tokens) UNION ALL select tx_hash, evt_index, project, version - from {{ ref('dex_trades') }} + from {{ source('dex', 'trades') }} where blockchain = 'ethereum' and token_sold_address in (select harvest_yield_token_address from harvest_yield_tokens) ) diff --git a/models/cow_protocol/tx_hash_labels/offramp/ethereum/cow_protocol_tx_hash_labels_offramp_ethereum.sql b/models/cow_protocol/tx_hash_labels/offramp/ethereum/cow_protocol_tx_hash_labels_offramp_ethereum.sql index 1da41c55b8a..4e95074a5ce 100644 --- a/models/cow_protocol/tx_hash_labels/offramp/ethereum/cow_protocol_tx_hash_labels_offramp_ethereum.sql +++ b/models/cow_protocol/tx_hash_labels/offramp/ethereum/cow_protocol_tx_hash_labels_offramp_ethereum.sql @@ -11,13 +11,13 @@ with * from ( select tx_hash, evt_index, project, version - from {{ ref('dex_aggregator_trades') }} + from {{ source('dex_aggregator', 'trades') }} where blockchain = 'ethereum' and token_bought_address in (select contract_address from {{ source('tokens_ethereum', 'stablecoins') }}) and token_sold_address not in (select contract_address from {{ source('tokens_ethereum', 'stablecoins') }}) UNION ALL select tx_hash, evt_index, project, version - from {{ ref('dex_trades') }} + from {{ source('dex', 'trades') }} where blockchain = 'ethereum' and token_bought_address in (select contract_address from {{ source('tokens_ethereum', 'stablecoins') }}) and token_sold_address not in (select contract_address from {{ source('tokens_ethereum', 'stablecoins') }}) diff --git a/models/cow_protocol/tx_hash_labels/onramp/ethereum/cow_protocol_tx_hash_labels_onramp_ethereum.sql b/models/cow_protocol/tx_hash_labels/onramp/ethereum/cow_protocol_tx_hash_labels_onramp_ethereum.sql index ffbf0ba3b48..4386df4889f 100644 --- a/models/cow_protocol/tx_hash_labels/onramp/ethereum/cow_protocol_tx_hash_labels_onramp_ethereum.sql +++ b/models/cow_protocol/tx_hash_labels/onramp/ethereum/cow_protocol_tx_hash_labels_onramp_ethereum.sql @@ -11,13 +11,13 @@ with * from ( select tx_hash, evt_index, project, version - from {{ ref('dex_aggregator_trades') }} + from {{ source('dex_aggregator', 'trades') }} where blockchain = 'ethereum' and token_bought_address not in (select contract_address from {{ source('tokens_ethereum', 'stablecoins') }}) and token_sold_address in (select contract_address from {{ source('tokens_ethereum', 'stablecoins') }}) UNION ALL select tx_hash, evt_index, project, version - from {{ ref('dex_trades') }} + from {{ source('dex', 'trades') }} where blockchain = 'ethereum' and token_bought_address not in (select contract_address from {{ source('tokens_ethereum', 'stablecoins') }}) and token_sold_address in (select contract_address from {{ source('tokens_ethereum', 'stablecoins') }}) diff --git a/models/cow_protocol/tx_hash_labels/stable_to_stable/ethereum/cow_protocol_tx_hash_labels_stable_to_stable_ethereum.sql b/models/cow_protocol/tx_hash_labels/stable_to_stable/ethereum/cow_protocol_tx_hash_labels_stable_to_stable_ethereum.sql index 9bb5e10bb21..1a10036443f 100644 --- a/models/cow_protocol/tx_hash_labels/stable_to_stable/ethereum/cow_protocol_tx_hash_labels_stable_to_stable_ethereum.sql +++ b/models/cow_protocol/tx_hash_labels/stable_to_stable/ethereum/cow_protocol_tx_hash_labels_stable_to_stable_ethereum.sql @@ -11,13 +11,13 @@ with * from ( select tx_hash, evt_index, project, version - from {{ ref('dex_aggregator_trades') }} + from {{ source('dex_aggregator', 'trades') }} where blockchain = 'ethereum' and token_bought_address in (select contract_address from {{ source('tokens_ethereum', 'stablecoins') }}) and token_sold_address in (select contract_address from {{ source('tokens_ethereum', 'stablecoins') }}) UNION ALL select tx_hash, evt_index, project, version - from {{ ref('dex_trades') }} + from {{ source('dex', 'trades') }} where blockchain = 'ethereum' and token_bought_address in (select contract_address from {{ source('tokens_ethereum', 'stablecoins') }}) and token_sold_address in (select contract_address from {{ source('tokens_ethereum', 'stablecoins') }}) diff --git a/models/cow_protocol/tx_hash_labels/staking_token_investment/ethereum/cow_protocol_tx_hash_labels_staking_token_investment_ethereum.sql b/models/cow_protocol/tx_hash_labels/staking_token_investment/ethereum/cow_protocol_tx_hash_labels_staking_token_investment_ethereum.sql index 7b03a8e2fbe..ed8af754027 100644 --- a/models/cow_protocol/tx_hash_labels/staking_token_investment/ethereum/cow_protocol_tx_hash_labels_staking_token_investment_ethereum.sql +++ b/models/cow_protocol/tx_hash_labels/staking_token_investment/ethereum/cow_protocol_tx_hash_labels_staking_token_investment_ethereum.sql @@ -32,12 +32,12 @@ with * from ( select tx_hash, evt_index, project, version - from {{ ref('dex_aggregator_trades') }} + from {{ source('dex_aggregator', 'trades') }} where blockchain = 'ethereum' and token_bought_address in (select staking_token_address from staking_tokens) UNION ALL select tx_hash, evt_index, project, version - from {{ ref('dex_trades') }} + from {{ source('dex', 'trades') }} where blockchain = 'ethereum' and token_bought_address in (select staking_token_address from staking_tokens) ) diff --git a/models/cow_protocol/tx_hash_labels/treasury_management/ethereum/cow_protocol_tx_hash_labels_treasury_management_ethereum.sql b/models/cow_protocol/tx_hash_labels/treasury_management/ethereum/cow_protocol_tx_hash_labels_treasury_management_ethereum.sql index 2db843bc30a..999d9883439 100644 --- a/models/cow_protocol/tx_hash_labels/treasury_management/ethereum/cow_protocol_tx_hash_labels_treasury_management_ethereum.sql +++ b/models/cow_protocol/tx_hash_labels/treasury_management/ethereum/cow_protocol_tx_hash_labels_treasury_management_ethereum.sql @@ -19,12 +19,12 @@ with * from ( select tx_hash, evt_index, project, version - from {{ ref('dex_aggregator_trades') }} + from {{ source('dex_aggregator', 'trades') }} where blockchain = 'ethereum' and taker in (select address from daos) UNION ALL select tx_hash, evt_index, project, version - from {{ ref('dex_trades') }} + from {{ source('dex', 'trades') }} where blockchain = 'ethereum' and taker in (select address from daos) ) diff --git a/models/curvefi/optimism/curvefi_optimism_schema.yml b/models/curvefi/optimism/curvefi_optimism_schema.yml index e6d0925e1c6..e528d812f84 100644 --- a/models/curvefi/optimism/curvefi_optimism_schema.yml +++ b/models/curvefi/optimism/curvefi_optimism_schema.yml @@ -1,44 +1,6 @@ version: 2 models: - - name: curvefi_optimism_pools - meta: - blockchain: optimism - project: curvefi - contributors: msilb7 - config: - tags: ['optimism','curvefi','curve','dex'] - description: > - A table containing all known pools of curvefi on optimism (i.e. metapool, basicpool). Additional types should be monitored to ensure they're accurately shown. - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - version - - tokenid - - token - - pool - columns: - - &version - name: version - description: "Versions of the pool: Basic Pool, Meta Pool, etc" - tests: - - not_null - - &tokenid - name: tokenid - description: "ID of the token in the pool" - tests: - - not_null - - &token - name: token - description: "Token Address" - tests: - - not_null - - &pool - name: pool - description: "Pool contract address" - tests: - - not_null - - name: curvefi_optimism_gauge_mappings meta: blockchain: optimism @@ -57,7 +19,11 @@ models: - &blockchain name: blockchain description: "Blockchain which the DEX is deployed" - - *version + - &version + name: version + description: "Versions of the pool: Basic Pool, Meta Pool, etc" + tests: + - not_null - &pool_contract name: pool_contract description: "Address of the liquidity pool contract" diff --git a/models/dao/balances/dao_balances.sql b/models/dao/balances/dao_balances.sql index b0e3cb81769..f8ec9cc8af9 100644 --- a/models/dao/balances/dao_balances.sql +++ b/models/dao/balances/dao_balances.sql @@ -107,7 +107,7 @@ LEFT JOIN AND e.blockchain = 'ethereum' AND e.symbol = 'WETH' LEFT JOIN -{{ ref('dex_prices') }} dp +{{ source('dex', 'prices') }} dp ON dp.contract_address = db.asset_contract_address AND d.day = dp.hour AND dp.blockchain = db.blockchain diff --git a/models/dao/transactions/arbitrum/dao_transactions_arbitrum_erc20.sql b/models/dao/transactions/arbitrum/dao_transactions_arbitrum_erc20.sql index 256c48ac13d..ac30ba0550a 100644 --- a/models/dao/transactions/arbitrum/dao_transactions_arbitrum_erc20.sql +++ b/models/dao/transactions/arbitrum/dao_transactions_arbitrum_erc20.sql @@ -110,7 +110,7 @@ LEFT JOIN AND p.minute >= date_trunc('day', now() - interval '7' Day) {% endif %} LEFT JOIN -{{ ref('dex_prices') }} dp +{{ source('dex', 'prices') }} dp ON dp.hour = date_trunc('hour', t.block_time) AND dp.contract_address = t.token AND dp.blockchain = 'arbitrum' diff --git a/models/dao/transactions/arbitrum/dao_transactions_arbitrum_eth.sql b/models/dao/transactions/arbitrum/dao_transactions_arbitrum_eth.sql index 336a4293265..f74e60d078e 100644 --- a/models/dao/transactions/arbitrum/dao_transactions_arbitrum_eth.sql +++ b/models/dao/transactions/arbitrum/dao_transactions_arbitrum_eth.sql @@ -110,7 +110,7 @@ LEFT JOIN AND p.minute >= date_trunc('day', now() - interval '7' Day) {% endif %} LEFT JOIN -{{ ref('dex_prices') }} dp +{{ source('dex', 'prices') }} dp ON dp.hour = date_trunc('hour', t.block_time) AND dp.contract_address = 0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2 AND dp.blockchain = 'arbitrum' diff --git a/models/dao/transactions/base/dao_transactions_base_erc20.sql b/models/dao/transactions/base/dao_transactions_base_erc20.sql index 6d2539d0ddd..a90cf4970f5 100644 --- a/models/dao/transactions/base/dao_transactions_base_erc20.sql +++ b/models/dao/transactions/base/dao_transactions_base_erc20.sql @@ -110,7 +110,7 @@ LEFT JOIN AND p.minute >= date_trunc('day', now() - interval '7' Day) {% endif %} LEFT JOIN -{{ ref('dex_prices') }} dp +{{ source('dex', 'prices') }} dp ON dp.hour = date_trunc('hour', t.block_time) AND dp.contract_address = t.token AND dp.blockchain = 'base' diff --git a/models/dao/transactions/base/dao_transactions_base_eth.sql b/models/dao/transactions/base/dao_transactions_base_eth.sql index 09d9750ae22..1263f0646ce 100644 --- a/models/dao/transactions/base/dao_transactions_base_eth.sql +++ b/models/dao/transactions/base/dao_transactions_base_eth.sql @@ -158,7 +158,7 @@ LEFT JOIN AND p.minute >= date_trunc('day', now() - interval '7' Day) {% endif %} LEFT JOIN -{{ ref('dex_prices') }} dp +{{ source('dex', 'prices') }} dp ON dp.hour = date_trunc('hour', t.block_time) AND dp.contract_address = 0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2 AND dp.blockchain = 'base' diff --git a/models/dao/transactions/ethereum/dao_transactions_ethereum_erc20.sql b/models/dao/transactions/ethereum/dao_transactions_ethereum_erc20.sql index 508565a4a15..e74f72321ae 100644 --- a/models/dao/transactions/ethereum/dao_transactions_ethereum_erc20.sql +++ b/models/dao/transactions/ethereum/dao_transactions_ethereum_erc20.sql @@ -108,7 +108,7 @@ LEFT JOIN AND p.minute >= date_trunc('day', now() - interval '7' Day) {% endif %} LEFT JOIN -{{ ref('dex_prices') }} dp +{{ source('dex', 'prices') }} dp ON dp.hour = date_trunc('hour', t.block_time) AND dp.contract_address = t.token AND dp.blockchain = 'ethereum' diff --git a/models/dao/transactions/gnosis/dao_transactions_gnosis_erc20.sql b/models/dao/transactions/gnosis/dao_transactions_gnosis_erc20.sql index ef19f91936e..09c767a191f 100644 --- a/models/dao/transactions/gnosis/dao_transactions_gnosis_erc20.sql +++ b/models/dao/transactions/gnosis/dao_transactions_gnosis_erc20.sql @@ -108,7 +108,7 @@ LEFT JOIN AND p.minute >= date_trunc('day', now() - interval '7' Day) {% endif %} LEFT JOIN -{{ ref('dex_prices') }} dp +{{ source('dex', 'prices') }} dp ON dp.hour = date_trunc('hour', t.block_time) AND dp.contract_address = t.token AND dp.blockchain = 'gnosis' diff --git a/models/dao/transactions/polygon/dao_transactions_polygon_erc20.sql b/models/dao/transactions/polygon/dao_transactions_polygon_erc20.sql index 58ab12a4b91..51a0fe6175e 100644 --- a/models/dao/transactions/polygon/dao_transactions_polygon_erc20.sql +++ b/models/dao/transactions/polygon/dao_transactions_polygon_erc20.sql @@ -108,7 +108,7 @@ LEFT JOIN AND p.minute >= date_trunc('day', now() - interval '7' Day) {% endif %} LEFT JOIN -{{ ref('dex_prices') }} dp +{{ source('dex', 'prices') }} dp ON dp.hour = date_trunc('hour', t.block_time) AND dp.contract_address = t.token AND dp.blockchain = 'polygon' diff --git a/models/dex/arbitrum/_schema.yml b/models/dex/arbitrum/_schema.yml deleted file mode 100644 index e1ede77bc38..00000000000 --- a/models/dex/arbitrum/_schema.yml +++ /dev/null @@ -1,24 +0,0 @@ -version: 2 - -models: - - - name: dex_arbitrum_addresses - meta: - blockchain: arbitrum - sector: dex - project: addresses - contributors: rantum - config: - tags: ['table', 'dex', 'addresses', 'arbitrum'] - description: "Known decentralised exchange addresses" - columns: - - name: blockchain - description: "Name of blockchain" - - name: address - description: "Address of known DEX" - tests: - - unique - - name: dex_name - description: "Name of decentralised exchange" - - name: distinct_name - description: "Distinct name of decentralised exchange address" \ No newline at end of file diff --git a/models/dex/base/_schema.yml b/models/dex/base/_schema.yml deleted file mode 100644 index f0256b6afac..00000000000 --- a/models/dex/base/_schema.yml +++ /dev/null @@ -1,23 +0,0 @@ -version: 2 - -models: - - name: dex_base_addresses - meta: - blockchain: base - sector: dex - project: addresses - contributors: rantum - config: - tags: ['table', 'dex', 'addresses', 'base'] - description: "Known decentralised exchange addresses" - columns: - - name: blockchain - description: "Name of blockchain" - - name: address - description: "Address of known DEX" - tests: - - unique - - name: dex_name - description: "Name of decentralised exchange" - - name: distinct_name - description: "Distinct name of decentralised exchange address" \ No newline at end of file diff --git a/models/dex/bnb/_schema.yml b/models/dex/bnb/_schema.yml deleted file mode 100644 index 74c5e66923a..00000000000 --- a/models/dex/bnb/_schema.yml +++ /dev/null @@ -1,24 +0,0 @@ -version: 2 - -models: - - - name: dex_bnb_addresses - meta: - blockchain: bnb - sector: dex - project: addresses - contributors: rantum - config: - tags: ['table', 'dex', 'addresses', 'bnb'] - description: "Known decentralised exchange addresses" - columns: - - name: blockchain - description: "Name of blockchain" - - name: address - description: "Address of known DEX" - tests: - - unique - - name: dex_name - description: "Name of decentralised exchange" - - name: distinct_name - description: "Distinct name of decentralised exchange address" \ No newline at end of file diff --git a/models/dex/dex_flashloans.sql b/models/dex/dex_flashloans.sql index 5ba0b5fc5c6..41a15f76d25 100644 --- a/models/dex/dex_flashloans.sql +++ b/models/dex/dex_flashloans.sql @@ -1,5 +1,5 @@ {{ config( - + schema = 'dex', alias = 'flashloans', partition_by = ['block_month'], materialized = 'incremental', diff --git a/models/dex/dex_schema.yml b/models/dex/dex_schema.yml index 70d90f53349..4a17e681108 100644 --- a/models/dex/dex_schema.yml +++ b/models/dex/dex_schema.yml @@ -1,25 +1,15 @@ version: 2 models: - - name: dex_aggregator_trades + - name: dex_incentive_mappings meta: - blockchain: ethereum, gnosis, avalanche_c, fantom, optimism, arbitrum, bnb - sector: dex_aggregator - contributors: bh2smith, Henrystats, jeff-dude, rantum + blockchain: optimism + sector: dex + contributors: msilb7 config: - tags: ['ethereum', 'gnosis', 'avalanche_c', 'fantom', 'aggregator', 'dex', 'trades', 'cross-chain'] + tags: ['optimism', 'amm', 'trades', 'dex', 'cross-chain','incentives'] description: > - Aggregator trades on all chains across all contracts and versions - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - block_date - - blockchain - - project - - version - - tx_hash - - evt_index - - trace_address + Mappings for DEX incentives contracts (i.e. gauges, bribes) to liquidity pools on all chains across all contracts and versions columns: - &blockchain name: blockchain @@ -30,115 +20,6 @@ models: - &version name: version description: "Version of the contract built and deployed by the DEX project" - - &block_date - name: block_date - description: "UTC event block date of each DEX trade" - - &block_time - name: block_time - description: "UTC event block time of each DEX trade" - - &token_bought_symbol - name: token_bought_symbol - description: "Token symbol for token bought in the trade" - - &token_sold_symbol - name: token_sold_symbol - description: "Token symbol for token sold in the trade" - - &token_pair - name: token_pair - description: "Token symbol pair for each token involved in the trade" - - &token_bought_amount - name: token_bought_amount - description: "Value of the token bought at time of execution in the original currency" - - &token_sold_amount - name: token_sold_amount - description: "Value of the token sold at time of execution in the original currency" - - &token_bought_amount_raw - name: token_bought_amount_raw - description: "Raw value of the token bought at time of execution in the original currency" - - &token_sold_amount_raw - name: token_sold_amount_raw - description: "Raw value of the token sold at time of execution in the original currency" - - &amount_usd - name: amount_usd - description: "USD value of the trade at time of execution" - tests: - - dbt_utils.accepted_range: - max_value: 1000000000 # $1b is an arbitrary number, intended to flag outlier amounts early - - &token_bought_address - name: token_bought_address - description: "Contract address of the token bought" - - &token_sold_address - name: token_sold_address - description: "Contract address of the token sold" - - &taker - name: taker - description: "Address of trader who purchased a token" - - &maker - name: maker - description: "Address of trader who sold a token" - - &project_contract_address - name: project_contract_address - description: "Project contract address which executed the trade on the blockchain" - - &tx_hash - name: tx_hash - description: "Unique transaction hash value tied to each transaction on the DEX" - - &tx_from - name: tx_from - description: "Address which initiated the trade" - - &tx_to - name: tx_to - description: "Address which received the trade" - - &trace_address - name: trace_address - - &evt_index - name: evt_index - description: "Index of the corresponding trade event" - - - name: dex_prices - meta: - blockchain: ethereum, bnb, avalanche_c, gnosis, optimism, arbitrum, fantom - sector: dex - contributors: Henrystats - config: - tags: ['ethereum', 'polygon', 'arbitrum', 'optimism', 'gnosis', 'fantom', 'avalanche_c', 'trades', 'dex', 'cross-chain', 'prices'] - description: > - This table loads the prices of tokens from the dex.trades table. This helps for missing tokens from the prices.usd table - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - hour - - blockchain - - contract_address - columns: - - &block_month - name: block_month - description: "Month corresponding to the prices data" - - &hour - name: hour - description: "hour corresponding to the prices data" - - &contract_address - name: contract_address - description: "token's contract address" - - *blockchain - - &median_price - name: median_price - description: "Median price of the token in USD within the corresponding hour" - - &sample_size - name: sample_size - description: "Number of times the token was traded within the coressponding hour" - - - name: dex_incentive_mappings - meta: - blockchain: optimism - sector: dex - contributors: msilb7 - config: - tags: ['optimism', 'amm', 'trades', 'dex', 'cross-chain','incentives'] - description: > - Mappings for DEX incentives contracts (i.e. gauges, bribes) to liquidity pools on all chains across all contracts and versions - columns: - - *blockchain - - *project - - *version - &pool_contract name: pool_contract description: "Address of the liquidity pool contract" @@ -154,137 +35,15 @@ models: - &evt_block_number name: evt_block_number description: 'Block Number' - - *contract_address + - &contract_address + name: contract_address + description: "token's contract address" - &evt_tx_hash name: evt_tx_hash description: 'Tx Hash' - - *evt_index - - - name: dex_pools - meta: - blockchain: ethereum, arbitrum, polygon - sector: dex - contributors: hildobby - config: - tags: ['ethereum', 'arbitrum', 'polygon', 'dex', 'cross-chain', 'pools'] - description: > - DEX pools on all chains across all contracts and versions - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - blockchain - - pool - columns: - - *blockchain - - *project - - *version - - &pool - name: pool - description: "DEX pool smart contract address" - - &fee - name: fee - description: "Defined fee" - - &token0 - name: token0 - description: "First token in pool" - - &token1 - name: token1 - description: "Second token in pool" - - &creation_block_time - name: creation_block_time - description: "Block time of pool creation" - - &creation_block_number - name: creation_block_number - description: "Block number of pool creation" - - name: contract_address - description: "Contract address used to create the pool" - - - name: dex_raw_pool_initializations - meta: - blockchain: ethereum, polygon, bnb, avalanche_c, gnosis, fantom, optimism, arbitrum, celo, base, zksync, zora - sector: dex - contributors: grkhr - config: - tags: ['dex', 'cross-chain', 'pools'] - description: > - DEX raw pools initialization calls - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - blockchain - - pool - - tx_hash - - call_trace_address - columns: - - *blockchain - - &type - name: type - description: "Pool implementation standard" - - *version - - *block_time - - *pool - - *token0 - - *token1 - - *tx_hash - - &call_trace_address - name: call_trace_address - - - name: dex_raw_pool_creations - meta: - blockchain: ethereum, polygon, bnb, avalanche_c, gnosis, fantom, optimism, arbitrum, celo, base, zksync, zora - sector: dex - contributors: grkhr - config: - tags: ['dex', 'cross-chain', 'pools'] - description: > - DEX raw pools on all chains across all contracts and versions parsed from logs - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - blockchain - - pool - columns: - - *blockchain - - *type - - *version - - *pool - - *token0 - - *token1 - - &tokens - name: tokens - description: "Tokens in the pool" - - *creation_block_time - - *creation_block_number - - name: contract_address - description: "Contract address used to create the pool" - - name: rn - - - name: dex_raw_pools - meta: - blockchain: ethereum, polygon, bnb, avalanche_c, gnosis, fantom, optimism, arbitrum, celo, base, zksync, zora - sector: dex - contributors: grkhr - config: - tags: ['dex', 'cross-chain', 'pools'] - description: > - DEX raw pools on all chains across all contracts and versions parsed from logs + filtered degen pools - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - blockchain - - pool - columns: - - *blockchain - - *type - - *version - - *pool - - *token0 - - *token1 - - *tokens - - *creation_block_time - - *creation_block_number - - name: contract_address - description: "Contract address used to create the pool" + - &evt_index + name: evt_index + description: "Index of the corresponding trade event" - name: dex_offers meta: @@ -299,8 +58,12 @@ models: - *blockchain - *project - *version - - *block_date - - *block_time + - &block_date + name: block_date + description: "UTC event block date of each DEX trade" + - &block_time + name: block_time + description: "UTC event block time of each DEX trade" - &block_number name: block_number description: "the block number of the block that the offer was created in" @@ -308,7 +71,9 @@ models: name: tx_index description: "the transaction index of the transaction that the offer was created in" - *evt_index - - *maker + - &maker + name: maker + description: "Address of trader who sold a token" - &sell_token_symbol name: sell_token_symbol description: "the token the offer is selling" @@ -321,7 +86,9 @@ models: - &buy_token_address name: buy_token_address description: "the address of the token the offer is buying" - - *token_pair + - &token_pair + name: token_pair + description: "Token symbol pair for each token involved in the trade" - &sell_amount name: sell_amount description: "the amount of the token that the maker is selling" @@ -361,10 +128,18 @@ models: - &txn_cost_usd name: txn_cost_usd description: "the cost of the transaction in USD" - - *project_contract_address - - *tx_hash - - *tx_from - - *tx_to + - &project_contract_address + name: project_contract_address + description: "Project contract address which executed the trade on the blockchain" + - &tx_hash + name: tx_hash + description: "Unique transaction hash value tied to each transaction on the DEX" + - &tx_from + name: tx_from + description: "Address which initiated the trade" + - &tx_to + name: tx_to + description: "Address which received the trade" - name: dex_flashloans @@ -397,176 +172,4 @@ models: - name: currency_symbol - name: recipient - name: contract_address - - name: block_month - - - name: dex_sandwiches - meta: - blockchain: ethereum, bnb, avalanche_c, gnosis, optimism, fantom, arbitrum, celo, zksync, scroll, zora - sector: dex - contributors: hildobby - config: - tags: ['dex', 'mev', 'sandwiches'] - description: > - DEX MEV Sandwich Trades across chains - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - blockchain - - tx_hash - - project_contract_address - - evt_index - columns: - - *blockchain - - *project - - *version - - *block_time - - *block_month - - *block_number - - *token_sold_address - - *token_bought_address - - *token_sold_symbol - - *token_bought_symbol - - *maker - - *taker - - *tx_hash - - *tx_from - - *tx_to - - *project_contract_address - - *trace_address - - *token_pair - - &index - name: index - description: "Index of the transaction in block" - - *token_sold_amount_raw - - *token_bought_amount_raw - - *token_sold_amount - - *token_bought_amount - - *amount_usd - - *evt_index - - - name: dex_sandwiched - meta: - blockchain: ethereum, bnb, avalanche_c, gnosis, optimism, fantom, arbitrum, celo, zksync, scroll, zora - sector: dex - contributors: hildobby - config: - tags: ['dex', 'mev', 'sandwiched'] - description: > - DEX MEV Sandwiched Trades across chains - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - blockchain - - tx_hash - - evt_index - columns: - - *blockchain - - *project - - *version - - *block_time - - *block_month - - *block_number - - *token_sold_address - - *token_bought_address - - *token_sold_symbol - - *token_bought_symbol - - *maker - - *taker - - *tx_hash - - *tx_from - - *tx_to - - *project_contract_address - - *trace_address - - *token_pair - - *tx_index - - *token_sold_amount_raw - - *token_bought_amount_raw - - *token_sold_amount - - *token_bought_amount - - *amount_usd - - *evt_index - - - name: dex_info - meta: - blockchain: ethereum, polygon, bnb, avalanche_c, gnosis, optimism, arbitrum, fantom, goerli, solana - sector: dex - contributors: hildobby - config: - tags: ['dex', 'ethereum', 'polygon', 'bnb', 'avalanche_c', 'gnosis', 'optimism', 'arbitrum', 'fantom', 'goerli', 'solana', 'info'] - description: > - DEXs info - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - project - columns: - - name: project - description: "Marketplace codename" - - name: name - description: "Marketplace capitalised name" - - name: marketplace_type - description: "Type of marketplace" - - name: x_username - description: "Username on X" - - - name: dex_addresses - meta: - blockchain: arbitrum, base, bnb, ethereum, optimism, polygon - sector: dex - project: addresses - contributors: rantum - config: - tags: ['table', 'dex', 'addresses', 'arbitrum', 'base', 'bnb', 'ethereum', 'optimism', 'polygon'] - description: "Known decentralised exchange addresses" - columns: - - name: blockchain - description: "Name of blockchain" - - name: address - description: "Address of known DEX" - - name: dex_name - description: "Name of decentralised exchange" - - name: distinct_name - description: "Distinct name of decentralised exchange address" - - - name: dex_atomic_arbitrages - meta: - blockchain: ethereum, bnb, avalanche_c, gnosis, optimism, arbitrum, fantom, polygon, base, celo, zksync, scroll, zora - sector: dex - contributors: hildobby - config: - tags: ['dex', 'mev', 'atomic', 'arbitrages'] - description: > - DEX MEV Arbitrage Trades across all Chains - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - blockchain - - tx_hash - - project_contract_address - - evt_index - columns: - - *blockchain - - *project - - *version - - *block_time - - *block_month - - *block_number - - *token_sold_address - - *token_bought_address - - *token_sold_symbol - - *token_bought_symbol - - *maker - - *taker - - *tx_hash - - *tx_from - - *tx_to - - *project_contract_address - - *trace_address - - *token_pair - - *tx_index - - *token_sold_amount_raw - - *token_bought_amount_raw - - *token_sold_amount - - *token_bought_amount - - *amount_usd - - *evt_index + - name: block_month \ No newline at end of file diff --git a/models/dex/ethereum/_schema.yml b/models/dex/ethereum/_schema.yml deleted file mode 100644 index d69f2a6760d..00000000000 --- a/models/dex/ethereum/_schema.yml +++ /dev/null @@ -1,23 +0,0 @@ -version: 2 - -models: - - name: dex_ethereum_addresses - meta: - blockchain: ethereum - sector: dex - project: addresses - contributors: soispoke, rantum - config: - tags: ['table', 'dex', 'addresses', 'ethereum'] - description: "Known decentralised exchange addresses" - columns: - - name: blockchain - description: "Name of blockchain" - - name: address - description: "Address of known DEX" - tests: - - unique - - name: dex_name - description: "Name of decentralised exchange" - - name: distinct_name - description: "Distinct name of decentralised exchange address" \ No newline at end of file diff --git a/models/dex/optimism/_schema.yml b/models/dex/optimism/_schema.yml deleted file mode 100644 index 59adaebc120..00000000000 --- a/models/dex/optimism/_schema.yml +++ /dev/null @@ -1,23 +0,0 @@ -version: 2 - -models: - - name: dex_optimism_addresses - meta: - blockchain: optimism - sector: dex - project: addresses - contributors: rantum - config: - tags: ['table', 'dex', 'addresses', 'optimism'] - description: "Known decentralised exchange addresses" - columns: - - name: blockchain - description: "Name of blockchain" - - name: address - description: "Address of known DEX" - tests: - - unique - - name: dex_name - description: "Name of decentralised exchange" - - name: distinct_name - description: "Distinct name of decentralised exchange address" \ No newline at end of file diff --git a/models/dex/polygon/_schema.yml b/models/dex/polygon/_schema.yml deleted file mode 100644 index 5357be14e32..00000000000 --- a/models/dex/polygon/_schema.yml +++ /dev/null @@ -1,24 +0,0 @@ -version: 2 - -models: - - - name: dex_polygon_addresses - meta: - blockchain: polygon - sector: dex - project: addresses - contributors: rantum - config: - tags: ['table', 'dex', 'addresses', 'polygon'] - description: "Known decentralised exchange addresses" - columns: - - name: blockchain - description: "Name of blockchain" - - name: address - description: "Address of known DEX" - tests: - - unique - - name: dex_name - description: "Name of decentralised exchange" - - name: distinct_name - description: "Distinct name of decentralised exchange address" \ No newline at end of file diff --git a/models/ellipsis_finance/bnb/ellipsis_finance_bnb_schema.yml b/models/ellipsis_finance/bnb/ellipsis_finance_bnb_schema.yml index 4cdf583feaf..b76eff8e56b 100644 --- a/models/ellipsis_finance/bnb/ellipsis_finance_bnb_schema.yml +++ b/models/ellipsis_finance/bnb/ellipsis_finance_bnb_schema.yml @@ -1,52 +1,6 @@ version: 2 models: - - name: ellipsis_finance_bnb_pool_tokens - meta: - blockchain: bnb - sector: dex - project: ellipsis_finance - contributors: Henrystats, 0xRob - config: - tags: ["bnb", "pool_tokens", "ellipsis", "dex"] - description: > - Ellipsis underlying tokens for token_exchange_underlying event - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - pool - - token_id - - token_type - - check_dex_pools_seed: - blockchain: bnb - project: ellipsis_finance - version: 1 - columns: - - &blockchain - name: blockchain - description: "Blockchain which the DEX is deployed" - - &project - name: project - description: "Project name of the DEX" - - &version - name: version - description: "Version of the contract built and deployed by the DEX project" - - &pool - name: pool - description: "pool contract address" - - &token_id - name: token_id - description: "underlying token id" - - &token_address - name: token_address - description: "underlying token address" - - &token_type - name: token_type - description: "token data (Underlying token, pool token.......)" - - &pool_type - name: pool_type - description: "pool type (Meta Pool, Base Pool....)" - - name: ellipsis_finance_bnb_airdrop_claims meta: blockchain: bnb diff --git a/models/gearbox/ethereum/gearbox_ethereum_airdrop_claims.sql b/models/gearbox/ethereum/gearbox_ethereum_airdrop_claims.sql index f89b73b04b5..b25454ee3e3 100644 --- a/models/gearbox/ethereum/gearbox_ethereum_airdrop_claims.sql +++ b/models/gearbox/ethereum/gearbox_ethereum_airdrop_claims.sql @@ -20,7 +20,7 @@ WITH more_prices AS ( , MAX(hour) AS max_hour , MIN_BY(median_price, hour) AS min_price , MAX_BY(median_price, hour) AS max_price - FROM {{ ref('dex_prices') }} + FROM {{ source('dex', 'prices') }} WHERE blockchain = 'ethereum' AND contract_address= {{gear_token_address}} ) @@ -44,7 +44,7 @@ SELECT 'ethereum' AS blockchain , 'GEAR' AS token_symbol , t.evt_index FROM {{ source('gearbox_ethereum', 'MerkleDistributor_evt_Claimed') }} t -LEFT JOIN {{ ref('dex_prices') }} pu ON pu.blockchain = 'ethereum' +LEFT JOIN {{ source('dex', 'prices') }} pu ON pu.blockchain = 'ethereum' AND pu.contract_address= {{gear_token_address}} AND pu.hour = date_trunc('hour', t.evt_block_time) WHERE t.evt_block_time BETWEEN TIMESTAMP '2022-04-05' AND TIMESTAMP '2022-07-22' \ No newline at end of file diff --git a/models/gyroscope/arbitrum/gyroscope_arbitrum_trades.sql b/models/gyroscope/arbitrum/gyroscope_arbitrum_trades.sql index 6401af4cd74..7b9c608cbb0 100644 --- a/models/gyroscope/arbitrum/gyroscope_arbitrum_trades.sql +++ b/models/gyroscope/arbitrum/gyroscope_arbitrum_trades.sql @@ -46,7 +46,7 @@ SELECT tx_from, tx_to, evt_index -FROM {{ ref('balancer_v2_arbitrum_trades') }} x +FROM {{ source('balancer_v2_arbitrum', 'trades') }} x inner join E_CLPs y on x.block_time >= y.min_block_time and x.project_contract_address = y.pool diff --git a/models/gyroscope/ethereum/gyroscope_ethereum_trades.sql b/models/gyroscope/ethereum/gyroscope_ethereum_trades.sql index 95a8ae0ab37..f944c841899 100644 --- a/models/gyroscope/ethereum/gyroscope_ethereum_trades.sql +++ b/models/gyroscope/ethereum/gyroscope_ethereum_trades.sql @@ -46,7 +46,7 @@ SELECT tx_from, tx_to, evt_index -FROM {{ ref('balancer_v2_ethereum_trades') }} x +FROM {{ source('balancer_v2_ethereum', 'trades') }} x inner join E_CLPs y on x.block_time >= y.min_block_time and x.project_contract_address = y.pool diff --git a/models/gyroscope/optimism/gyroscope_optimism_trades.sql b/models/gyroscope/optimism/gyroscope_optimism_trades.sql index a2e724127cc..b8acf2a259c 100644 --- a/models/gyroscope/optimism/gyroscope_optimism_trades.sql +++ b/models/gyroscope/optimism/gyroscope_optimism_trades.sql @@ -46,7 +46,7 @@ SELECT tx_from, tx_to, evt_index -FROM {{ ref('balancer_v2_optimism_trades') }} x +FROM {{ source('balancer_v2_optimism', 'trades') }} x inner join E_CLPs y on x.block_time >= y.min_block_time and x.project_contract_address = y.pool diff --git a/models/gyroscope/polygon/gyroscope_polygon_trades.sql b/models/gyroscope/polygon/gyroscope_polygon_trades.sql index e84740ecf08..375fff1fa4f 100644 --- a/models/gyroscope/polygon/gyroscope_polygon_trades.sql +++ b/models/gyroscope/polygon/gyroscope_polygon_trades.sql @@ -46,7 +46,7 @@ with E_CLPs AS ( tx_from, tx_to, evt_index - FROM {{ ref('balancer_v2_polygon_trades') }} x + FROM {{ source('balancer_v2_polygon', 'trades') }} x inner join E_CLPs y on x.block_time >= y.min_block_time and x.project_contract_address = y.pool diff --git a/models/hashflow/ethereum/hashflow_ethereum_raw_trades.sql b/models/hashflow/ethereum/hashflow_ethereum_raw_trades.sql deleted file mode 100644 index e625e68194b..00000000000 --- a/models/hashflow/ethereum/hashflow_ethereum_raw_trades.sql +++ /dev/null @@ -1,425 +0,0 @@ -{{ config( - tags=[ 'prod_exclude'], - alias = 'raw_trades', - partition_by = ['block_date'], - materialized = 'incremental', - file_format = 'delta', - incremental_strategy = 'merge', - unique_key = ['block_date', 'composite_index', 'tx_hash'], - post_hook='{{ expose_spells(\'["ethereum"]\', - "project", - "hashflow", - \'["justabi", "jeff-dude"]\') }}' - ) -}} - -{# -## model not yet migrated to dunesql syntax and excluded in prod on both engines due to complexity -## needs refactoring to read from decoded tables - #} - -{% set project_start_date = '2021-04-28' %} - -with ethereum_traces as ( - select * - from {{ source('ethereum', 'traces') }} - where `to` in ('0x455a3b3be6e7c8843f2b03a1ca22a5a5727ef5c4','0x9d4fc735e1a596420d24a266b7b5402fe4ec153c', - '0x2405cb057a9baf85daa11ce9832baed839b6871c','0x043389f397ad72619d05946f5f35426a7ace6613', - '0xa18607ca4a3804cc3cd5730eafefcc47a7641643', '0x6ad3dac99c9a4a480748c566ce7b3503506e3d71') - and block_time >= '{{ project_start_date }}' - {% if is_incremental() %} - and block_time >= date_trunc('day', now() - interval '10 days') - {% endif %} -), - -ethereum_transactions as ( - select * - from {{ source('ethereum', 'transactions') }} - where block_time >= '{{ project_start_date }}' - {% if is_incremental() %} - and block_time >= date_trunc('day', now() - interval '10 days') - {% endif %} -), - -prices_usd as ( - select * - from {{ source('prices', 'usd') }} - where `minute` >= '{{ project_start_date }}' - and blockchain = 'ethereum' - {% if is_incremental() %} - and `minute` >= date_trunc('day', now() - interval '10 days') - {% endif %} -), - -erc20_tokens as ( - select * - from {{ source('tokens', 'erc20') }} - where blockchain = 'ethereum' -), - -hashflow_pool_evt_trade as ( - select * - from {{ source('hashflow_ethereum', 'pool_evt_trade') }} - where evt_block_time >= '{{ project_start_date }}' - {% if is_incremental() %} - and evt_block_time >= date_trunc('day', now() - interval '10 days') - {% endif %} -), - -{% if not is_incremental() %} -ethereum_logs as ( - select * - from {{ source('ethereum', 'logs') }} - where block_time >= '{{ project_start_date }}' - and block_number <= 13974528 -- block of last trade of all legacy routers -), - -new_router as ( - select - cast(coalesce(l.evt_index, -1) as int) as composite_index, - cast(get_json_object(quote,'$.flag') as string) as source, - t.call_block_time as block_time, - t.call_tx_hash as tx_hash, - t.call_success as fill_status, - 'tradeSingleHop' as method_id, - t.contract_address as router_contract, - ('0x' || substring(get_json_object(quote,'$.pool') from 3)) as pool, - tx.from as trader, - ('0x' || substring(get_json_object(quote,'$.quoteToken') from 3)) as maker_token, - ('0x' || substring(get_json_object(quote,'$.baseToken') from 3)) as taker_token, - case when get_json_object(quote,'$.quoteToken') = '0x0000000000000000000000000000000000000000' then 'ETH' - else mp.symbol end as maker_symbol, - case when get_json_object(quote,'$.baseToken') = '0x0000000000000000000000000000000000000000' then 'ETH' - else tp.symbol end as taker_symbol, - case when l.evt_tx_hash is not null then l.`quoteTokenAmount`/power(10, mp.decimals) - else cast(get_json_object(quote,'$.maxQuoteTokenAmount') as float)/power(10,mp.decimals) end as maker_token_amount, - case when l.evt_tx_hash is not null then l.`baseTokenAmount`/power(10, tp.decimals) - else cast(get_json_object(quote,'$.maxBaseTokenAmount') as float)/power(10,tp.decimals) end as taker_token_amount, - case when l.evt_tx_hash is not null - then coalesce( - l.`baseTokenAmount`/power(10, tp.decimals) * tp.price, - `quoteTokenAmount`/power(10, mp.decimals) * mp.price) - else coalesce( - cast(get_json_object(quote,'$.maxBaseTokenAmount') as float)/power(10, tp.decimals) * tp.price, - cast(get_json_object(quote,'$.maxQuoteTokenAmount') as float)/power(10, mp.decimals) * mp.price) end as amount_usd - from {{ source('hashflow_ethereum', 'router_call_tradesinglehop') }} t - inner join ethereum_transactions tx on tx.hash = t.call_tx_hash - left join hashflow_pool_evt_trade l on l.txid = ('0x' || substring(get_json_object(quote,'$.txid') from 3)) - left join prices_usd tp on tp.minute = date_trunc('minute', t.call_block_time) - and tp.contract_address = - case when get_json_object(quote,'$.baseToken') = '0x0000000000000000000000000000000000000000' - then '0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2' - else ('0x' || substring(get_json_object(quote,'$.baseToken') from 3)) end - left join prices_usd mp on mp.minute = date_trunc('minute', t.call_block_time) - and mp.contract_address = - case when get_json_object(quote,'$.quoteToken') = '0x0000000000000000000000000000000000000000' - then '0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2' - else ('0x' || substring(get_json_object(quote,'$.quoteToken') from 3)) end -), - -event_decoding_router as ( - select - tx_hash, - index as evt_index, - substring(`data`, 13, 20) as trader, - substring(`data`, 33, 32) as tx_id, - substring(`data`, 109, 20) as maker_token, - substring(`data`, 77, 20) as taker_token, - cast(conv(substring(`data`, 173, 20), 16, 10) as decimal) as maker_token_amount, - cast(conv(substring(`data`, 141, 20), 16, 10) as decimal) as taker_token_amount - from ethereum_logs - where topic1 ='0x8cf3dec1929508e5677d7db003124e74802bfba7250a572205a9986d86ca9f1e' -- trade0() - - union all - - select - tx_hash, - index as evt_index, - substring(`data`, 45, 20) as trader, - substring(`data`, 65, 32) as tx_id, - substring(`data`, 141, 20) as maker_token, - substring(`data`, 109, 20) as taker_token, - cast(conv(substring(`data`, 205, 20), 16, 10) as decimal) as maker_token_amount, - cast(conv(substring(`data`, 173, 20), 16, 10) as decimal) as taker_token_amount - from ethereum_logs l - where topic1 ='0xb709ddcc6550418e9b89df1f4938071eeaa3f6376309904c77e15d46b16066f5' -- trade() -), - -legacy_router_w_integration as ( - select - cast(coalesce(l.evt_index, -1) as int) as composite_index, - substring(input, 324, 1) as source, - t.block_time, - t.tx_hash, - t.error is null as fill_status, - substring(t.input, 1, 4) as method_id, - t.to as router_contract, - substring(t.input, 17, 20) as pool, - tx.from as trader, -- adjusted to use tx sender due to integration, was substring(t.input, 49, 20) as trader, - maker_token, - taker_token, - case when substring(input, 113, 20) = '0x0000000000000000000000000000000000000000' then 'ETH' - else mp.symbol end as maker_symbol, - case when substring(input, 81, 20) = '0x0000000000000000000000000000000000000000' then 'ETH' - else tp.symbol end as taker_symbol, - case when l.tx_hash is not null then maker_token_amount/power(10,mp.decimals) end as maker_token_amount, - case when l.tx_hash is not null then taker_token_amount/power(10,tp.decimals) end as taker_token_amount, - case when l.tx_hash is not null then - coalesce( - taker_token_amount/power(10, tp.decimals) * tp.price, - maker_token_amount/power(10, mp.decimals) * mp.price) end as amount_usd - from ethereum_traces t - inner join ethereum_transactions tx on tx.hash = t.tx_hash - left join event_decoding_router l on l.tx_id = substring(t.input, 325, 32) -- join on tx_id 1:1, no dup - left join prices_usd tp on tp.minute = date_trunc('minute', t.block_time) - and tp.contract_address = - case when substring(input, 81, 20) = '0x0000000000000000000000000000000000000000' - then '0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2' else substring(input, 81, 20) end - left join prices_usd mp on mp.minute = date_trunc('minute', t.block_time) - and mp.contract_address = - case when substring(input, 113, 20) = '0x0000000000000000000000000000000000000000' - then '0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2' else substring(input, 113, 20) end - where -- cast(trace_address as string) = '{}' --top level call -- removed this because of 1inch integration - t.to in ('0xa18607ca4a3804cc3cd5730eafefcc47a7641643') - and substring(input, 1, 4) in ('0xba93c39c') -- swap - and t.block_number <= 13803909 -- block of last trade of this legacy router - - union all - - select - cast(coalesce(l.evt_index, -1) as int) as composite_index, - substring(input, 484, 1) as source, - t.block_time, - t.tx_hash, - t.error is null as fill_status, - 'tradeSingleHop' as method_id, - t.to as router_contract, - substring(t.input, 49, 20) as pool, --mm - tx.from as trader, - maker_token, - taker_token, - case when substring(input, 209, 20) = '0x0000000000000000000000000000000000000000' then 'ETH' - else mp.symbol end as maker_symbol, - case when substring(input, 177, 20) = '0x0000000000000000000000000000000000000000' then 'ETH' - else tp.symbol end as taker_symbol, - case when l.tx_hash is not null then maker_token_amount/power(10,mp.decimals) end as maker_token_amount, - case when l.tx_hash is not null then taker_token_amount/power(10,tp.decimals) end as taker_token_amount, - case when l.tx_hash is not null then - coalesce( - taker_token_amount/power(10, tp.decimals) * tp.price, - maker_token_amount/power(10, mp.decimals) * mp.price) end as amount_usd - from ethereum_traces t - inner join ethereum_transactions tx on tx.hash = t.tx_hash - left join event_decoding_router l on l.tx_id = substring(t.input, 485, 32) - left join prices_usd tp on tp.minute = date_trunc('minute', t.block_time) - and tp.contract_address = - case when substring(input, 177, 20) = '0x0000000000000000000000000000000000000000' - then '0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2' else substring(input, 177, 20) end - left join prices_usd mp on mp.minute = date_trunc('minute', t.block_time) - and mp.contract_address = - case when substring(input, 209, 20) = '0x0000000000000000000000000000000000000000' - then '0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2' else substring(input, 209, 20) end - where t.to in ('0x6ad3dac99c9a4a480748c566ce7b3503506e3d71') - and substring(input, 1, 4) in ('0xf0910b2b') -- trade single hop - AND t.block_number <= 13974528 -- block of last trade of this legacy router -), -{% endif %} - -legacy_routers as ( - select - t.block_time, - t.tx_hash, - error is null as fill_status, - substring(input, 1, 4) as method_id, - `to` as router_contract, - substring(input, 17, 20) as pool, --mm - substring(input, 49, 20) as trader, - case when substring(input, 1, 4) = '0xc7f6b19d' then substring(input, 81, 20) - else '0x0000000000000000000000000000000000000000' end as maker_token, - case when substring(input, 1, 4) = '0xc7f6b19d' then '0x0000000000000000000000000000000000000000' - else substring(input, 81, 20) end as taker_token, --eth - case when substring(input, 1, 4) = '0xc7f6b19d' then e.symbol - else 'ETH' end as maker_symbol, - case when substring(input, 1, 4) = '0xc7f6b19d' then 'ETH' - else e.symbol end as taker_symbol, - case when substring(input, 1, 4) = '0xc7f6b19d' - then cast(conv(substring(input, 145, 20), 16, 10) as decimal)/power(10, e.decimals) - else cast(conv(substring(input, 145, 20), 16, 10) as decimal)/1e18 end as maker_token_amount, - case when substring(input, 1, 4) = '0xc7f6b19d' - then cast(conv(substring(input, 113, 20), 16, 10) as decimal)/1e18 - else cast(conv(substring(input, 113, 20), 16, 10) as decimal)/power(10,e.decimals) end as taker_token_amount, - case when substring(input, 1, 4) = '0xc7f6b19d' - then cast(conv(substring(input, 113, 20), 16, 10) as decimal)/1e18 * price - else cast(conv(substring(input, 145, 20), 16, 10) as decimal)/1e18 * price end as amount_usd - from ethereum_traces t - left join prices_usd p on minute = date_trunc('minute', t.block_time) - left join erc20_tokens e on e.contract_address = substring(input, 81, 20) - where cast(trace_address as string) = '{}' --top level call - and `to` in ('0x9d4fc735e1a596420d24a266b7b5402fe4ec153c', '0x2405cb057a9baf85daa11ce9832baed839b6871c') - and substring(input, 1, 4) in ('0x9ec7605b', -- token to eth - '0xc7f6b19d') -- eth to token - and p.symbol = 'WETH' - - union all - - select - t.block_time, - t.tx_hash, - error is null as fill_status, - substring(input, 1, 4) as method_id, - `to` as router_contract, - substring(input, 17, 20) as pool, - substring(input, 49, 20) as trader, - substring(input, 113, 20) as maker_token, - substring(input, 81, 20) as taker_token, - mp.symbol as maker_symbol, - tp.symbol as taker_symbol, - cast(conv(substring(input, 177, 20), 16, 10) as decimal)/power(10, mp.decimals) as maker_token_amount, - cast(conv(substring(input, 145, 20), 16, 10) as decimal)/power(10, tp.decimals) as taker_token_amount, - coalesce( - cast(conv(substring(input, 145, 20), 16, 10) as decimal)/power(10, tp.decimals) * tp.price, - cast(conv(substring(input, 177, 20), 16, 10) as decimal)/power(10, mp.decimals) * mp.price) as amount_usd - from ethereum_traces t - left join prices_usd tp on tp.minute = date_trunc('minute', t.block_time) and tp.contract_address = substring(input, 81, 20) - left join prices_usd mp on mp.minute = date_trunc('minute', t.block_time) and mp.contract_address = substring(input, 113, 20) - where cast(trace_address as string) = '{}' - and `to` in ('0x455a3B3Be6e7C8843f2b03A1cA22A5a5727ef5C4','0x9d4fc735e1a596420d24a266b7b5402fe4ec153c', '0x2405cb057a9baf85daa11ce9832baed839b6871c','0x043389f397ad72619d05946f5f35426a7ace6613') - and substring(input, 1, 4) in ('0x064f0410','0x4d0246ad') -- token to token - - union all - - select - t.block_time, - t.tx_hash, - error is null as fill_status, - substring(input, 1, 4) as method_id, - `to` as router_contract, - substring(input, 17, 20) as pool, - substring(input, 49, 20) as trader, - case when substring(input, 1, 4) = '0xe43d9733' then substring(input, 81, 20) - else '0x0000000000000000000000000000000000000000' end as maker_token, - case when substring(input, 1, 4) = '0xe43d9733' then '0x0000000000000000000000000000000000000000' - else substring(input, 81, 20) end as taker_token, --eth - case when substring(input, 1, 4) = '0xe43d9733' then e.symbol - else 'ETH' end as maker_symbol, - case when substring(input, 1, 4) = '0xe43d9733' then 'ETH' - else e.symbol end as taker_symbol, - case when substring(input, 1, 4) = '0xe43d9733' - then cast(conv(substring(input, 145, 20), 16, 10) as decimal)/power(10,e.decimals) - else cast(conv(substring(input, 145, 20), 16, 10) as decimal)/1e18 end as maker_token_amount, - case when substring(input, 1, 4) = '0xe43d9733' - then cast(conv(substring(input, 113, 20), 16, 10) as decimal)/1e18 - else cast(conv(substring(input, 113, 20), 16, 10) as decimal)/power(10,e.decimals) end as taker_token_amount, - case when substring(input, 1, 4) = '0xe43d9733' - then cast(conv(substring(input, 113, 20), 16, 10) as decimal)/1e18 * price - else cast(conv(substring(input, 145, 20), 16, 10) as decimal)/1e18 * price end as amount_usd - from ethereum_traces t - left join prices_usd p on minute = date_trunc('minute', t.block_time) - left join erc20_tokens e on e.contract_address = substring(input, 81, 20) - where cast(trace_address as string) = '{}' - and `to` in ('0x455a3B3Be6e7C8843f2b03A1cA22A5a5727ef5C4','0x043389f397ad72619d05946f5f35426a7ace6613') - and substring(input, 1, 4) in ('0xd0529c02', -- token to eth - '0xe43d9733') -- eth to token - and p.symbol = 'WETH' -), - -new_pool as ( - -- subquery for including new pools created on 2022-04-09 - -- same trade event abi, effectively only from table hashflow.pool_evt_trade since 2022-04-09 - select - l.evt_index as composite_index, - null as source, -- no join on call for this batch, refer to metabase for source info - tx.block_time as block_time, - tx.hash as tx_hash, - true as fill_status, -- without call we are only logging successful fills - null as method_id, -- without call we don't have function call info - tx.to as router_contract, -- taking top level contract called in tx as router, not necessarily HF contract - l.pool as pool, - tx.from as trader, - l.`quoteToken` as maker_token, - l.`baseToken` as taker_token, - case when l.`quoteToken` = '0x0000000000000000000000000000000000000000' then 'ETH' - else mp.symbol end as maker_symbol, - case when l.`baseToken` = '0x0000000000000000000000000000000000000000' then 'ETH' - else tp.symbol end as taker_symbol, - l.`quoteTokenAmount`/power(10, mp.decimals) as maker_token_amount, - l.`baseTokenAmount`/power(10, tp.decimals) as taker_token_amount, - coalesce( - l.`baseTokenAmount`/power(10, tp.decimals) * tp.price, - l.`quoteTokenAmount`/power(10, mp.decimals) * mp.price) as amount_usd - from hashflow_pool_evt_trade l - inner join ethereum_transactions tx on tx.hash = l.evt_tx_hash - left join prices_usd tp on tp.minute = date_trunc('minute', tx.block_time) - and tp.contract_address = - case when l.`baseToken` = '0x0000000000000000000000000000000000000000' - then '0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2' else l.`baseToken` end - left join prices_usd mp on mp.minute = date_trunc('minute', tx.block_time) - and mp.contract_address = - case when l.`quoteToken` = '0x0000000000000000000000000000000000000000' - then '0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2' else l.`quoteToken` end - WHERE l.evt_block_time > '2022-04-08' -- necessary filter to only include new trades -), - - -{% if not is_incremental() %} - -dedupe_new_router as ( -- since new_router and new_pool have overlapping trades, we remove them from new_router here - select new_router.* - from new_router - left join new_pool - on new_router.block_time = new_pool.block_time - and new_router.composite_index = new_pool.composite_index - and new_router.tx_hash = new_pool.tx_hash - where new_pool.tx_hash is null - -), - -{% endif %} - -all_trades as ( - select - -1 as composite_index, - -- was decoding from trace, no log_index, only single swap exist so works as PK - '0x00' as source, - -- all from native front end, no integration yet - * - from legacy_routers - - union all - - select * from new_pool - - {% if not is_incremental() %} - - union all - - select * from legacy_router_w_integration - - union all - - select * from dedupe_new_router - - {% endif %} -) - -select - try_cast(date_trunc('day', block_time) AS date) AS block_date, - block_time, - composite_index, - fill_status, - maker_symbol, - maker_token, - maker_token_amount, - method_id, - pool, - router_contract, - source, - taker_symbol, - taker_token, - taker_token_amount, - trader, - tx_hash, - amount_usd -from all_trades -where fill_status is true -; \ No newline at end of file diff --git a/models/hashflow/ethereum/hashflow_ethereum_schema.yml b/models/hashflow/ethereum/hashflow_ethereum_schema.yml index db64949f510..0669b549de8 100644 --- a/models/hashflow/ethereum/hashflow_ethereum_schema.yml +++ b/models/hashflow/ethereum/hashflow_ethereum_schema.yml @@ -1,19 +1,21 @@ version: 2 models: - - name: hashflow_ethereum_raw_trades + - name: hashflow_ethereum_crosschain_trades meta: blockchain: ethereum + sector: dex project: hashflow - contributors: justabi + contributors: BroderickBonelli config: - tags: ['ethereum', 'hashflow', 'trades'] - description: "Hashflow contract trades on Ethereum - decoded" + tags: ['ethereum','hashflow','trades','dex','BroderickBonelli'] + description: > + Table of Hashflow cross chain trades on ethereum. Includes unique data for cross chain trades such as source and destination chains for further analysis of Hashflow's cross chain activity. tests: - dbt_utils.unique_combination_of_columns: combination_of_columns: - block_date - - composite_index + - source_chain - tx_hash columns: - &block_date @@ -22,96 +24,12 @@ models: - &block_time name: block_time description: "UTC event block time of each trade" - - &composite_index - name: composite_index - description: "Ethereum log index or Hashflow trade event index if exists, else -1 (-1 means decoded from traces)" - - &fill_status - name: fill_status - description: "Boolean, was the trade successful" - - &maker_symbol - name: maker_symbol - description: "Token symbol for token bought in the transaction" - - &maker_token - name: maker_token - description: "Token contract address pair for token bought in the transaction" - - &maker_token_amount - name: maker_token_amount - description: "Value of the token bought at time of execution" - - &method_id - name: method_id - description: "Method of trade - tbc" - - &pool - name: pool - description: "Contract address of the pool" - - &router_contract - name: router_contract - description: "Taking top level contract called in tx as router, not necessarily HF contract" - - &source - name: source - description: "" - - &taker_symbol - name: taker_symbol - description: "Token symbol for token sold in the transaction" - - &taker_token - name: taker_token - description: "Token contract address pair for token sold in the transaction" - - &taker_token_amount - name: taker_token_amount - description: "Value of the token sold at time of execution" - - &trader - name: trader - description: "Address of trader who sold a token" - - &tx_hash - name: tx_hash - description: "Unique transaction hash value tied to each transaction" - - &amount_usd - name: amount_usd - description: "USD value of the trade at time of execution" - - - name: hashflow_ethereum_trades - meta: - blockchain: ethereum - sector: dex - project: hashflow - contributors: justabi - config: - tags: ['ethereum', 'hashflow', 'trades', 'dex'] - description: "Hashflow contract trades on Ethereum - formatted for dex.trades" - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - block_date - - blockchain - - project - - version - - tx_hash - - evt_index - - trace_address - - check_dex_seed: - blockchain: ethereum - project: hashflow - version: 1 - columns: - - &blockchain - name: blockchain - description: "Blockchain which the DEX is deployed" - - &project - name: project - description: "Project name of the DEX" - - &version - name: version - description: "Version of the contract built and deployed by the DEX project" - - *block_date - - *block_time - &token_bought_symbol name: token_bought_symbol description: "Token symbol for token bought in the transaction" - &token_sold_symbol name: token_sold_symbol description: "Token symbol for token sold in the transaction" - - &token_pair - name: token_pair - description: "Token symbol pair for each token involved in the transaction" - &token_bought_amount name: token_bought_amount description: "Value of the token bought at time of execution in the original currency" @@ -124,66 +42,21 @@ models: - &token_sold_amount_raw name: token_sold_amount_raw description: "Raw value of the token sold at time of execution in the original currency" - - *amount_usd + - &amount_usd + name: amount_usd + description: "USD value of the trade at time of execution" - &token_bought_address name: token_bought_address description: "Contract address of the token bought" - &token_sold_address name: token_sold_address description: "Contract address of the token sold" - - &taker - name: taker - description: "Address of trader who purchased a token" - - &maker - name: maker + - &trader + name: trader description: "Address of trader who sold a token" - - &project_contract_address - name: project_contract_address - description: "Project contract address which executed the trade on the blockchain" - - *tx_hash - - &tx_from - name: tx_from - description: "Address which initiated the transaction" - - &tx_to - name: tx_to - description: "Address which received the transaction" - - &trace_address - name: trace_address - description: "" - - &evt_index - name: evt_index - description: "" - - - name: hashflow_ethereum_crosschain_trades - meta: - blockchain: ethereum - sector: dex - project: hashflow - contributors: BroderickBonelli - config: - tags: ['ethereum','hashflow','trades','dex','BroderickBonelli'] - description: > - Table of Hashflow cross chain trades on ethereum. Includes unique data for cross chain trades such as source and destination chains for further analysis of Hashflow's cross chain activity. - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - block_date - - source_chain - - tx_hash - columns: - - *block_date - - *block_time - - *token_bought_symbol - - *token_sold_symbol - - *token_bought_amount - - *token_sold_amount - - *token_bought_amount_raw - - *token_sold_amount_raw - - *amount_usd - - *token_bought_address - - *token_sold_address - - *trader - - *tx_hash + - &tx_hash + name: tx_hash + description: "Unique transaction hash value tied to each transaction" - &source_chain name: source_chain description: "Chain where the trade originated." diff --git a/models/hashflow/ethereum/hashflow_ethereum_trades.sql b/models/hashflow/ethereum/hashflow_ethereum_trades.sql deleted file mode 100644 index 9ad03e725e6..00000000000 --- a/models/hashflow/ethereum/hashflow_ethereum_trades.sql +++ /dev/null @@ -1,80 +0,0 @@ -{{ config( - tags=[ 'prod_exclude'], - alias = 'trades', - partition_by = ['block_date'], - materialized = 'incremental', - file_format = 'delta', - incremental_strategy = 'merge', - unique_key = ['block_date', 'blockchain', 'project', 'version', 'tx_hash', 'evt_index', 'trace_address'], - post_hook='{{ expose_spells(\'["ethereum"]\', - "project", - "hashflow", - \'["justabi", "jeff-dude"]\') }}' - ) -}} - -{# -## model not yet migrated to dunesql syntax and excluded in prod on both engines due to complexity -## needs refactoring to read from decoded tables - #} - -{% set project_start_date = '2021-04-28' %} - -with hashflow_trades as ( - select * - from {{ ref('hashflow_ethereum_raw_trades') }} - where fill_status is true -- successful trade - {% if is_incremental() %} - and block_time >= date_trunc('day', now() - interval '10 days') - {% endif %} -), - -ethereum_transactions as ( - select * - from {{ source('ethereum', 'transactions') }} - where block_time >= '{{ project_start_date }}' - {% if is_incremental() %} - and block_time >= date_trunc('day', now() - interval '10 days') - {% endif %} -), - -erc20_tokens as ( - select * - from {{ source('tokens', 'erc20') }} - where blockchain = 'ethereum' -) - -select - 'ethereum' AS blockchain, - 'hashflow' as project, - '1' as version, - block_date, - hashflow_trades.block_time, - hashflow_trades.maker_symbol as token_bought_symbol, - hashflow_trades.taker_symbol as token_sold_symbol, - case when lower(hashflow_trades.maker_symbol) > lower(hashflow_trades.taker_symbol) - then concat(hashflow_trades.taker_symbol, '-', hashflow_trades.maker_symbol) - else concat(hashflow_trades.maker_symbol, '-', hashflow_trades.taker_symbol) end as token_pair, - hashflow_trades.maker_token_amount as token_bought_amount, - hashflow_trades.taker_token_amount as token_sold_amount, - CAST(hashflow_trades.maker_token_amount * power(10, erc20a.decimals) AS DECIMAL(38,0)) as token_bought_amount_raw, - CAST(hashflow_trades.taker_token_amount * power(10, erc20b.decimals) AS DECIMAL(38,0)) as token_sold_amount_raw, - hashflow_trades.amount_usd, - hashflow_trades.maker_token as token_bought_address, - hashflow_trades.taker_token as token_sold_address, - hashflow_trades.trader as taker, - hashflow_trades.pool as maker, - hashflow_trades.router_contract as project_contract_address, - hashflow_trades.tx_hash, - tx.from as tx_from, - tx.to as tx_to, - '' as trace_address, - case when hashflow_trades.composite_index <> -1 then hashflow_trades.composite_index end as evt_index -from hashflow_trades -inner join ethereum_transactions tx - on hashflow_trades.tx_hash = tx.hash -left join erc20_tokens erc20a - on erc20a.contract_address = hashflow_trades.maker_token -left join erc20_tokens erc20b - on erc20b.contract_address = hashflow_trades.taker_token -; \ No newline at end of file diff --git a/models/immortalx/celo/immortalx_celo_schema.yml b/models/immortalx/celo/immortalx_celo_schema.yml index eb06e801af8..fb3b520ba51 100644 --- a/models/immortalx/celo/immortalx_celo_schema.yml +++ b/models/immortalx/celo/immortalx_celo_schema.yml @@ -60,10 +60,6 @@ models: - &project name: project description: "The underlying protocol/project where the swap took place" - tests: - - relationships: - to: ref('dex_info') - field: project - &version name: version description: "The version of the protocol/project" diff --git a/models/keep3r_network/keep3r_network_token_prices.sql b/models/keep3r_network/keep3r_network_token_prices.sql index 05a08b2b99c..8e9c7a08c08 100644 --- a/models/keep3r_network/keep3r_network_token_prices.sql +++ b/models/keep3r_network/keep3r_network_token_prices.sql @@ -37,7 +37,7 @@ dex_price as ( blockchain, date_trunc('day', hour) as day, avg(median_price) as price - FROM {{ ref('dex_prices') }} prc --on prc.contract_address = tkn.token_address and prc.blockchain = prc.blockchain + FROM {{ source('dex', 'prices') }} prc --on prc.contract_address = tkn.token_address and prc.blockchain = prc.blockchain where hour >= timestamp '2021-10-10' -- month of $K3PR Mint and contract_address in (select token_address from dex_tokens) @@ -55,7 +55,7 @@ dex_trade as ( blockchain, block_date as day, (amount_usd / token_sold_amount) as price - from {{ ref('dex_trades') }} + from {{ source('dex', 'trades') }} where token_sold_address in (select token_address from dex_tokens) and block_date >= timestamp '2021-10-10' @@ -65,7 +65,7 @@ dex_trade as ( blockchain, block_date as day, (amount_usd / token_bought_amount) as price - from {{ ref('dex_trades') }} + from {{ source('dex', 'trades') }} where token_bought_address in (select token_address from dex_tokens) and block_date >= timestamp '2021-10-10' diff --git a/models/labels/addresses/__single_category_labels__/balancer_v1/labels_balancer_v1_schema.yml b/models/labels/addresses/__single_category_labels__/balancer_v1/labels_balancer_v1_schema.yml deleted file mode 100644 index b28b49766d1..00000000000 --- a/models/labels/addresses/__single_category_labels__/balancer_v1/labels_balancer_v1_schema.yml +++ /dev/null @@ -1,68 +0,0 @@ -version: 2 - -models: - - name: labels_balancer_v1_pools_ethereum - meta: - blockchain: ethereum - sector: labels - project: balancer_v1 - contributors: balancerlabs - config: - tags: ['labels', 'ethereum', 'balancer', 'pools'] - description: "Balancer V1 liquidity pools created on Ethereum. " - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - address - columns: - - &blockchain - name: blockchain - description: "Blockchain" - - &address - name: address - description: "Address of liquidity pool" - - &name - name: name - description: "Label name of pool containg the token symbols and their respective weights (if applicable)" - - &category - name: category - description: "Label category" - - &contributor - name: contributor - description: "Wizard(s) contributing to labels" - - &source - name: source - description: "How were labels generated (could be static or query)" - - &created_at - name: created_at - description: "When were labels created" - - &updated_at - name: updated_at - description: "When were labels updated for the last time" - - &model_name - name: model_name - description: "Name of the label model sourced from" - - &label_type - name: label_type - description: "Type of label (see labels overall readme)" - - - name: labels_balancer_v1_pools - meta: - blockchain: ethereum - sector: labels - project: balancer_v1 - contributors: balancerlabs - config: - tags: ['labels', 'ethereum', 'balancer', 'pools'] - description: "Balancer V1 liquidity pools created across blockchains." - columns: - - *blockchain - - *address - - *name - - *category - - *contributor - - *source - - *created_at - - *updated_at - - *model_name - - *label_type \ No newline at end of file diff --git a/models/labels/addresses/__single_category_labels__/balancer_v2/labels_balancer_v2_gauges_arbitrum.sql b/models/labels/addresses/__single_category_labels__/balancer_v2/labels_balancer_v2_gauges_arbitrum.sql index 1fd767faeae..9319de28db5 100644 --- a/models/labels/addresses/__single_category_labels__/balancer_v2/labels_balancer_v2_gauges_arbitrum.sql +++ b/models/labels/addresses/__single_category_labels__/balancer_v2/labels_balancer_v2_gauges_arbitrum.sql @@ -23,7 +23,7 @@ SELECT distinct FROM {{ source('balancer_ethereum', 'ArbitrumRootGaugeFactory_evt_ArbitrumRootGaugeCreated') }} gauge LEFT JOIN {{ source('balancer_v2_arbitrum', 'ChildChainLiquidityGaugeFactory_evt_RewardsOnlyGaugeCreated') }} streamer ON gauge.recipient = streamer.streamer - LEFT JOIN {{ ref('labels_balancer_v2_pools_arbitrum') }} pools ON pools.address = streamer.pool + LEFT JOIN {{ source('labels', 'balancer_v2_pools_arbitrum') }} pools ON pools.address = streamer.pool WHERE pools.name IS NOT NULL UNION ALL @@ -45,7 +45,7 @@ FROM {{ source('balancer_ethereum', 'CappedArbitrumRootGaugeFactory_evt_GaugeCreated') }} gauge INNER JOIN {{ source('balancer_ethereum', 'CappedArbitrumRootGaugeFactory_call_create') }} call ON call.call_tx_hash = gauge.evt_tx_hash LEFT JOIN {{ source('balancer_v2_arbitrum', 'ChildChainLiquidityGaugeFactory_evt_RewardsOnlyGaugeCreated') }} streamer ON streamer.streamer = call.recipient - LEFT JOIN {{ ref('labels_balancer_v2_pools_arbitrum') }} pools ON pools.address = streamer.pool + LEFT JOIN {{ source('labels', 'balancer_v2_pools_arbitrum') }} pools ON pools.address = streamer.pool WHERE pools.name IS NOT NULL), child_gauges AS( @@ -64,7 +64,7 @@ SELECT distinct 'identifier' AS label_type FROM {{ source('balancer_ethereum', 'CappedArbitrumRootGaugeFactory_call_create') }} call LEFT JOIN {{ source('balancer_arbitrum', 'ChildChainGaugeFactory_call_create') }} child ON child.output_0 = call.recipient - LEFT JOIN {{ ref('labels_balancer_v2_pools_arbitrum') }} pools ON pools.address = child.pool), + LEFT JOIN {{ source('labels', 'balancer_v2_pools_arbitrum') }} pools ON pools.address = child.pool), gauges AS( SELECT * FROM reward_gauges diff --git a/models/labels/addresses/__single_category_labels__/balancer_v2/labels_balancer_v2_gauges_avalanche_c.sql b/models/labels/addresses/__single_category_labels__/balancer_v2/labels_balancer_v2_gauges_avalanche_c.sql index 0530e49c4b2..080d9e04325 100644 --- a/models/labels/addresses/__single_category_labels__/balancer_v2/labels_balancer_v2_gauges_avalanche_c.sql +++ b/models/labels/addresses/__single_category_labels__/balancer_v2/labels_balancer_v2_gauges_avalanche_c.sql @@ -22,7 +22,7 @@ SELECT distinct 'identifier' AS label_type FROM {{ source('balancer_ethereum', 'AvalancheRootGaugeFactory_call_create') }} call LEFT JOIN {{ source('balancer_avalanche_c', 'ChildChainGaugeFactory_call_create') }} child ON child.output_0 = call.recipient - LEFT JOIN {{ ref('labels_balancer_v2_pools_avalanche_c') }} pools ON pools.address = child.pool), + LEFT JOIN {{ source('labels', 'balancer_v2_pools_avalanche_c') }} pools ON pools.address = child.pool), controller AS( --to allow filtering for active gauges only SELECT diff --git a/models/labels/addresses/__single_category_labels__/balancer_v2/labels_balancer_v2_gauges_base.sql b/models/labels/addresses/__single_category_labels__/balancer_v2/labels_balancer_v2_gauges_base.sql index add55152846..f93f6b89499 100644 --- a/models/labels/addresses/__single_category_labels__/balancer_v2/labels_balancer_v2_gauges_base.sql +++ b/models/labels/addresses/__single_category_labels__/balancer_v2/labels_balancer_v2_gauges_base.sql @@ -22,7 +22,7 @@ SELECT distinct 'identifier' AS label_type FROM {{ source('balancer_ethereum', 'BaseRootGaugeFactory_call_create') }} call LEFT JOIN {{ source('balancer_base', 'ChildChainGaugeFactory_call_create') }} child ON child.output_0 = call.recipient - LEFT JOIN {{ ref('labels_balancer_v2_pools_base') }} pools ON pools.address = child.pool), + LEFT JOIN {{ source('labels', 'balancer_v2_pools_base') }} pools ON pools.address = child.pool), controller AS( --to allow filtering for active gauges only SELECT diff --git a/models/labels/addresses/__single_category_labels__/balancer_v2/labels_balancer_v2_gauges_ethereum.sql b/models/labels/addresses/__single_category_labels__/balancer_v2/labels_balancer_v2_gauges_ethereum.sql index 2c59d996e2f..aad04be36e5 100644 --- a/models/labels/addresses/__single_category_labels__/balancer_v2/labels_balancer_v2_gauges_ethereum.sql +++ b/models/labels/addresses/__single_category_labels__/balancer_v2/labels_balancer_v2_gauges_ethereum.sql @@ -22,7 +22,7 @@ SELECT 'identifier' AS label_type FROM {{ source('balancer_ethereum', 'LiquidityGaugeFactory_evt_GaugeCreated') }} gauge - LEFT JOIN {{ ref('labels_balancer_v2_pools_ethereum') }} pools ON pools.address = gauge.pool + LEFT JOIN {{ source('labels', 'balancer_v2_pools_ethereum') }} pools ON pools.address = gauge.pool UNION ALL @@ -42,7 +42,7 @@ SELECT FROM {{ source('balancer_ethereum', 'CappedLiquidityGaugeFactory_evt_GaugeCreated') }} evt INNER JOIN {{ source('balancer_ethereum', 'CappedLiquidityGaugeFactory_call_create') }} call ON call.call_tx_hash = evt.evt_tx_hash - LEFT JOIN {{ ref('labels_balancer_v2_pools_ethereum') }} pools ON pools.address = call.pool + LEFT JOIN {{ source('labels', 'balancer_v2_pools_ethereum') }} pools ON pools.address = call.pool UNION ALL diff --git a/models/labels/addresses/__single_category_labels__/balancer_v2/labels_balancer_v2_gauges_gnosis.sql b/models/labels/addresses/__single_category_labels__/balancer_v2/labels_balancer_v2_gauges_gnosis.sql index 9d2555952b8..800e03f266d 100644 --- a/models/labels/addresses/__single_category_labels__/balancer_v2/labels_balancer_v2_gauges_gnosis.sql +++ b/models/labels/addresses/__single_category_labels__/balancer_v2/labels_balancer_v2_gauges_gnosis.sql @@ -22,7 +22,7 @@ SELECT distinct 'identifier' AS label_type FROM {{ source('balancer_ethereum', 'GnosisRootGaugeFactory_call_create') }} call LEFT JOIN {{ source('balancer_gnosis', 'ChildChainGaugeFactory_call_create') }} child ON child.output_0 = call.recipient - LEFT JOIN {{ ref('labels_balancer_v2_pools_gnosis') }} pools ON pools.address = child.pool), + LEFT JOIN {{ source('labels', 'balancer_v2_pools_gnosis') }} pools ON pools.address = child.pool), controller AS( --to allow filtering for active gauges only SELECT diff --git a/models/labels/addresses/__single_category_labels__/balancer_v2/labels_balancer_v2_gauges_optimism.sql b/models/labels/addresses/__single_category_labels__/balancer_v2/labels_balancer_v2_gauges_optimism.sql index 2ea1ad0facf..774f14f2c17 100644 --- a/models/labels/addresses/__single_category_labels__/balancer_v2/labels_balancer_v2_gauges_optimism.sql +++ b/models/labels/addresses/__single_category_labels__/balancer_v2/labels_balancer_v2_gauges_optimism.sql @@ -23,7 +23,7 @@ SELECT FROM {{ source('balancer_ethereum', 'OptimismRootGaugeFactory_evt_OptimismRootGaugeCreated') }} gauge LEFT JOIN {{ source('balancer_optimism', 'ChildChainLiquidityGaugeFactory_evt_RewardsOnlyGaugeCreated') }} streamer ON gauge.recipient = streamer.streamer - LEFT JOIN {{ ref('labels_balancer_v2_pools_optimism') }} pools ON pools.address = streamer.pool + LEFT JOIN {{ source('labels', 'balancer_v2_pools_optimism') }} pools ON pools.address = streamer.pool UNION ALL @@ -44,7 +44,7 @@ FROM {{ source('balancer_ethereum', 'CappedOptimismRootGaugeFactory_evt_GaugeCreated') }} gauge INNER JOIN {{ source('balancer_ethereum', 'CappedOptimismRootGaugeFactory_call_create') }} call ON call.call_tx_hash = gauge.evt_tx_hash LEFT JOIN {{ source('balancer_optimism', 'ChildChainLiquidityGaugeFactory_evt_RewardsOnlyGaugeCreated') }} streamer ON streamer.streamer = call.recipient - LEFT JOIN {{ ref('labels_balancer_v2_pools_optimism') }} pools ON pools.address = streamer.pool), + LEFT JOIN {{ source('labels', 'balancer_v2_pools_optimism') }} pools ON pools.address = streamer.pool), child_gauges AS( SELECT distinct @@ -62,7 +62,7 @@ SELECT distinct 'identifier' AS label_type FROM {{ source('balancer_ethereum', 'CappedOptimismRootGaugeFactory_call_create') }} call LEFT JOIN {{ source('balancer_optimism', 'ChildChainGaugeFactory_call_create') }} child ON child.output_0 = call.recipient - LEFT JOIN {{ ref('labels_balancer_v2_pools_optimism') }} pools ON pools.address = child.pool), + LEFT JOIN {{ source('labels', 'balancer_v2_pools_optimism') }} pools ON pools.address = child.pool), gauges AS( SELECT * FROM reward_gauges diff --git a/models/labels/addresses/__single_category_labels__/balancer_v2/labels_balancer_v2_gauges_polygon.sql b/models/labels/addresses/__single_category_labels__/balancer_v2/labels_balancer_v2_gauges_polygon.sql index bc6fe7dfbf6..bca23a0c63a 100644 --- a/models/labels/addresses/__single_category_labels__/balancer_v2/labels_balancer_v2_gauges_polygon.sql +++ b/models/labels/addresses/__single_category_labels__/balancer_v2/labels_balancer_v2_gauges_polygon.sql @@ -23,7 +23,7 @@ SELECT FROM {{ source('balancer_ethereum', 'PolygonRootGaugeFactory_evt_PolygonRootGaugeCreated') }} gauge LEFT JOIN {{ source('balancer_polygon', 'ChildChainLiquidityGaugeFactory_evt_RewardsOnlyGaugeCreated') }} streamer ON gauge.recipient = streamer.streamer - LEFT JOIN {{ ref('labels_balancer_v2_pools_polygon') }} pools ON pools.address = streamer.pool + LEFT JOIN {{ source('labels', 'balancer_v2_pools_polygon') }} pools ON pools.address = streamer.pool UNION ALL @@ -44,7 +44,7 @@ FROM {{ source('balancer_ethereum', 'CappedPolygonRootGaugeFactory_evt_GaugeCreated') }} gauge INNER JOIN {{ source('balancer_ethereum', 'CappedPolygonRootGaugeFactory_call_create') }} call ON call.call_tx_hash = gauge.evt_tx_hash LEFT JOIN {{ source('balancer_polygon', 'ChildChainLiquidityGaugeFactory_evt_RewardsOnlyGaugeCreated') }} streamer ON streamer.streamer = call.recipient - LEFT JOIN {{ ref('labels_balancer_v2_pools_polygon') }} pools ON pools.address = streamer.pool), + LEFT JOIN {{ source('labels', 'balancer_v2_pools_polygon') }} pools ON pools.address = streamer.pool), child_gauges AS( SELECT distinct @@ -62,7 +62,7 @@ SELECT distinct 'identifier' AS label_type FROM {{ source('balancer_ethereum', 'CappedPolygonRootGaugeFactory_call_create') }} call LEFT JOIN {{ source('balancer_polygon', 'ChildChainGaugeFactory_call_create') }} child ON child.output_0 = call.recipient - LEFT JOIN {{ ref('labels_balancer_v2_pools_polygon') }} pools ON pools.address = child.pool), + LEFT JOIN {{ source('labels', 'balancer_v2_pools_polygon') }} pools ON pools.address = child.pool), gauges AS( SELECT * FROM reward_gauges diff --git a/models/labels/addresses/__single_category_labels__/balancer_v2/labels_balancer_v2_gauges_zkevm.sql b/models/labels/addresses/__single_category_labels__/balancer_v2/labels_balancer_v2_gauges_zkevm.sql index 81c415e8478..1e1b946e5ae 100644 --- a/models/labels/addresses/__single_category_labels__/balancer_v2/labels_balancer_v2_gauges_zkevm.sql +++ b/models/labels/addresses/__single_category_labels__/balancer_v2/labels_balancer_v2_gauges_zkevm.sql @@ -21,7 +21,7 @@ SELECT distinct 'identifier' AS label_type FROM {{ source('balancer_ethereum', 'PolygonZkEVMRootGaugeFactory_call_create') }} call LEFT JOIN {{ source('balancer_zkevm', 'ChildChainGaugeFactory_call_create') }} child ON child.output_0 = call.recipient - LEFT JOIN {{ ref('labels_balancer_v2_pools_zkevm') }} pools ON pools.address = child.pool), + LEFT JOIN {{ source('labels', 'balancer_v2_pools_zkevm') }} pools ON pools.address = child.pool), controller AS( --to allow filtering for active gauges only SELECT diff --git a/models/labels/addresses/__single_category_labels__/balancer_v2/labels_balancer_v2_schema.yml b/models/labels/addresses/__single_category_labels__/balancer_v2/labels_balancer_v2_schema.yml index 99205695c3c..11a5544f507 100644 --- a/models/labels/addresses/__single_category_labels__/balancer_v2/labels_balancer_v2_schema.yml +++ b/models/labels/addresses/__single_category_labels__/balancer_v2/labels_balancer_v2_schema.yml @@ -1,23 +1,15 @@ version: 2 models: - - name: labels_balancer_v2_pools_ethereum + - name: labels_balancer_v2_gauges meta: - blockchain: ethereum + blockchain: ethereum, polygon, optimism, arbitrum, avalanche_c, base, gnosis, zkevm sector: labels project: balancer_v2 - contributors: balancerlabs, viniabussafi + contributors: jacektrocinski, viniabussafi config: - tags: ['labels', 'ethereum', 'balancer', 'pools'] - description: 'Balancer V2 liquidity pools created on Ethereum. ' - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - address - - name - - category - - model_name - - blockchain + tags: ['labels', 'ethereum', 'polygon', 'optimism', 'arbitrum', 'avalanche_c', 'base', 'gnosis', 'zkevm', 'gauges'] + description: 'Balancer v2 gauge labels.' columns: - &blockchain name: blockchain @@ -25,9 +17,17 @@ models: - &address name: address description: 'Address of liquidity pool' + - &pool_address + name: pool_address + description: "Address of the pool to which a Gauge belongs" + - &child_gauge_address + name: child_gauge_address + description: "Address of the Child Gauge on L2s, NULL if on mainnet" - &name - name: name - description: 'Label name of pool containg the token symbols and their respective weights (if applicable)' + name: name + - &status + name: status + description: "Flag for whether a gauge is active or inactive" - &category name: category description: 'Label category' @@ -50,246 +50,6 @@ models: name: label_type description: "Type of label (see labels overall readme)" - - name: labels_balancer_v2_pools_polygon - meta: - blockchain: polygon - sector: labels - project: balancer_v2 - contributors: balancerlabs, viniabussafi - config: - tags: ['labels', 'polygon', 'balancer', 'pools'] - description: 'Balancer V2 liquidity pools created on Polygon.' - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - address - columns: - - *blockchain - - *address - - *name - - *category - - *contributor - - *source - - *created_at - - *updated_at - - *model_name - - *label_type - - - name: labels_balancer_v2_pools_gnosis - meta: - blockchain: gnosis - sector: labels - project: balancer_v2 - contributors: balancerlabs, viniabussafi - config: - tags: ['labels', 'gnosis', 'balancer', 'pools'] - description: 'Balancer V2 liquidity pools created on Gnosis.' - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - address - columns: - - *blockchain - - *address - - *name - - *category - - *contributor - - *source - - *created_at - - *updated_at - - *model_name - - *label_type - - - name: labels_balancer_v2_pools_avalanche_c - meta: - blockchain: avalanche_c - sector: labels - project: balancer_v2 - contributors: balancerlabs, viniabussafi - config: - tags: ['labels', 'avalanche_c', 'balancer', 'pools'] - description: 'Balancer V2 liquidity pools created on Avalanche Chain.' - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - address - columns: - - *blockchain - - *address - - *name - - *category - - *contributor - - *source - - *created_at - - *updated_at - - *model_name - - *label_type - - - name: labels_balancer_v2_pools_base - meta: - blockchain: base - sector: labels - project: balancer_v2 - contributors: balancerlabs, viniabussafi - config: - tags: ['labels', 'base', 'balancer', 'pools'] - description: 'Balancer V2 liquidity pools created on Base Chain.' - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - address - columns: - - *blockchain - - *address - - *name - - *category - - *contributor - - *source - - *created_at - - *updated_at - - *model_name - - *label_type - - - name: labels_balancer_v2_pools_arbitrum - meta: - blockchain: arbitrum - sector: labels - project: balancer_v2 - contributors: balancerlabs, viniabussafi - config: - tags: ['labels', 'arbitrum', 'balancer', 'pools'] - description: 'Balancer V2 liquidity pools created on Arbitrum.' - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - address - columns: - - *blockchain - - *address - - *name - - *category - - *contributor - - *source - - *created_at - - *updated_at - - *model_name - - *label_type - - - name: labels_balancer_v2_pools_optimism - meta: - blockchain: optimism - sector: labels - project: balancer_v2 - contributors: balancerlabs, viniabussafi - config: - tags: ['labels', 'optimism', 'balancer', 'pools'] - description: 'Balancer V2 liquidity pools created on Optimism.' - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - address - columns: - - *blockchain - - *address - - *name - - *category - - *contributor - - *source - - *created_at - - *updated_at - - *model_name - - *label_type - - - name: labels_balancer_v2_pools_zkevm - meta: - blockchain: zkevm - sector: labels - project: balancer_v2 - contributors: balancerlabs, viniabussafi - config: - tags: ['labels', 'zkevm', 'balancer', 'pools'] - description: 'Balancer V2 liquidity pools created on Polygon zkevm.' - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - address - columns: - - *blockchain - - *address - - *name - - *category - - *contributor - - *source - - *created_at - - *updated_at - - *model_name - - *label_type - - - - name: labels_balancer_v2_pools - meta: - blockchain: ethereum, polygon, arbitrum, optimism, gnosis, base, avalanche_c, zkevm - sector: labels - project: balancer_v2 - contributors: balancerlabs, viniabussafi - config: - tags: - [ - 'labels', - 'ethereum', - 'polygon', - 'arbitrum', - 'optimism', - 'avalanche_c', - 'base', - 'gnosis', - 'zkevm', - 'balancer', - 'pools', - ] - description: 'Balancer V2 liquidity pools created across blockchains.' - columns: - - *blockchain - - *address - - *name - - *category - - *contributor - - *source - - *created_at - - *updated_at - - *model_name - - *label_type - - - name: labels_balancer_v2_gauges - meta: - blockchain: ethereum, polygon, optimism, arbitrum, avalanche_c, base, gnosis, zkevm - sector: labels - project: balancer_v2 - contributors: jacektrocinski, viniabussafi - config: - tags: ['labels', 'ethereum', 'polygon', 'optimism', 'arbitrum', 'avalanche_c', 'base', 'gnosis', 'zkevm', 'gauges'] - description: 'Balancer v2 gauge labels.' - columns: - - *blockchain - - *address - - &pool_address - name: pool_address - description: "Address of the pool to which a Gauge belongs" - - &child_gauge_address - name: child_gauge_address - description: "Address of the Child Gauge on L2s, NULL if on mainnet" - - *name - - &status - name: status - description: "Flag for whether a gauge is active or inactive" - - *category - - *contributor - - *source - - *created_at - - *updated_at - - *model_name - - *label_type - - name: labels_balancer_v2_gauges_ethereum meta: blockchain: ethereum @@ -428,7 +188,7 @@ models: - *created_at - *updated_at - *model_name - - *label_type + - *label_type - name: labels_balancer_v2_gauges_base meta: @@ -456,7 +216,7 @@ models: - *created_at - *updated_at - *model_name - - *label_type + - *label_type - name: labels_balancer_v2_gauges_gnosis meta: @@ -484,7 +244,7 @@ models: - *created_at - *updated_at - *model_name - - *label_type + - *label_type - name: labels_balancer_v2_gauges_zkevm meta: @@ -512,4 +272,4 @@ models: - *created_at - *updated_at - *model_name - - *label_type + - *label_type \ No newline at end of file diff --git a/models/labels/addresses/__single_category_labels__/likely_bots/op_chains/labels_op_chains_likely_bot_addresses.sql b/models/labels/addresses/__single_category_labels__/likely_bots/op_chains/labels_op_chains_likely_bot_addresses.sql index 4ed7f9a141c..e90c682ed6f 100644 --- a/models/labels/addresses/__single_category_labels__/likely_bots/op_chains/labels_op_chains_likely_bot_addresses.sql +++ b/models/labels/addresses/__single_category_labels__/likely_bots/op_chains/labels_op_chains_likely_bot_addresses.sql @@ -32,8 +32,7 @@ WITH sender_transfer_rates AS ( , SUM(CASE WHEN EXISTS (SELECT 1 FROM {{ source('erc20_' + chain,'evt_transfer') }} r WHERE t.hash = r.evt_tx_hash AND t.block_number = r.evt_block_number) THEN 1 WHEN EXISTS (SELECT 1 FROM {{ source('nft_' + chain,'transfers') }} r WHERE t.hash = r.tx_hash AND t.block_number = r.block_number AND blockchain = '{{chain}}') THEN 1 ELSE 0 END) AS num_token_tfer_txs - - , SUM(CASE WHEN EXISTS (SELECT 1 FROM {{ ref('dex_trades') }} r WHERE t.hash = r.tx_hash AND t.block_time = r.block_time AND r.block_month = DATE_TRUNC('month',r.block_time) AND blockchain = '{{chain}}') THEN 1 ELSE 0 END) AS num_dex_trade_txs + , SUM(CASE WHEN EXISTS (SELECT 1 FROM {{ source('dex', 'trades') }} r WHERE t.hash = r.tx_hash AND t.block_time = r.block_time AND r.block_month = DATE_TRUNC('month',r.block_time) AND blockchain = '{{chain}}') THEN 1 ELSE 0 END) AS num_dex_trade_txs , SUM(CASE WHEN EXISTS (SELECT 1 FROM {{ ref('perpetual_trades') }} r WHERE t.hash = r.tx_hash AND t.block_time = r.block_time AND r.block_month = DATE_TRUNC('month',r.block_time) AND blockchain = '{{chain}}') THEN 1 ELSE 0 END) AS num_perp_trade_txs , SUM(CASE WHEN EXISTS (SELECT 1 FROM {{ source('nft', 'trades') }} r WHERE t.hash = r.tx_hash AND t.block_number = r.block_number AND r.block_month = DATE_TRUNC('month',r.block_time) AND blockchain = '{{chain}}') THEN 1 ELSE 0 END) AS num_nft_trade_txs diff --git a/models/labels/addresses/__single_category_labels__/likely_bots/op_chains/labels_op_chains_likely_bot_contracts.sql b/models/labels/addresses/__single_category_labels__/likely_bots/op_chains/labels_op_chains_likely_bot_contracts.sql index abc965152ee..9c00229812f 100644 --- a/models/labels/addresses/__single_category_labels__/likely_bots/op_chains/labels_op_chains_likely_bot_contracts.sql +++ b/models/labels/addresses/__single_category_labels__/likely_bots/op_chains/labels_op_chains_likely_bot_contracts.sql @@ -34,8 +34,7 @@ FROM ( SUM(CASE WHEN EXISTS (SELECT 1 FROM {{ source('erc20_' + chain,'evt_transfer') }} r WHERE t.hash = r.evt_tx_hash AND t.block_number = r.evt_block_number) THEN 1 WHEN EXISTS (SELECT 1 FROM {{ source('nft_' + chain,'transfers') }} r WHERE t.hash = r.tx_hash AND t.block_number = r.block_number ) THEN 1 ELSE 0 END) AS num_token_tfer_txs, - - SUM(CASE WHEN EXISTS (SELECT 1 FROM {{ ref('dex_trades') }} r WHERE t.hash = r.tx_hash AND t.block_time = r.block_time AND r.block_month = DATE_TRUNC('month',r.block_time) AND blockchain = '{{chain}}') THEN 1 ELSE 0 END) AS num_dex_trade_txs, + SUM(CASE WHEN EXISTS (SELECT 1 FROM {{ source('dex', 'trades') }} r WHERE t.hash = r.tx_hash AND t.block_time = r.block_time AND r.block_month = DATE_TRUNC('month',r.block_time) AND blockchain = '{{chain}}') THEN 1 ELSE 0 END) AS num_dex_trade_txs, SUM(CASE WHEN EXISTS (SELECT 1 FROM {{ ref('perpetual_trades') }} r WHERE t.hash = r.tx_hash AND t.block_time = r.block_time AND r.block_month = DATE_TRUNC('month',r.block_time) AND blockchain = '{{chain}}') THEN 1 ELSE 0 END) AS num_perp_trade_txs, SUM(CASE WHEN EXISTS (SELECT 1 FROM {{ source('nft', 'trades') }} r WHERE t.hash = r.tx_hash AND t.block_number = r.block_number AND r.block_month = DATE_TRUNC('month',r.block_time) AND blockchain = '{{chain}}') THEN 1 ELSE 0 END) AS num_nft_trade_txs, COUNT(*) AS num_txs, COUNT(DISTINCT "from") AS num_senders, COUNT(*)/COUNT(DISTINCT "from") AS txs_per_sender, diff --git a/models/labels/addresses/dex/persona/arbitrage_traders/ethereum/labels_arbitrage_traders_ethereum.sql b/models/labels/addresses/dex/persona/arbitrage_traders/ethereum/labels_arbitrage_traders_ethereum.sql index 388ff5e8a42..724a35600e2 100644 --- a/models/labels/addresses/dex/persona/arbitrage_traders/ethereum/labels_arbitrage_traders_ethereum.sql +++ b/models/labels/addresses/dex/persona/arbitrage_traders/ethereum/labels_arbitrage_traders_ethereum.sql @@ -58,7 +58,7 @@ with token_sold_address, token_bought_address, evt_index - FROM {{ref('dex_trades')}} + FROM {{ source('dex', 'trades') }} UNION ALL @@ -68,7 +68,7 @@ with token_sold_address, token_bought_address, evt_index - FROM {{ ref('dex_aggregator_trades') }} --{{ref('dex_aggregator_trades')}} + FROM {{ source('dex_aggregator', 'trades') }} --{{ source('dex', 'trades') }} ) t1 INNER JOIN ( @@ -78,7 +78,7 @@ with token_sold_address, token_bought_address, evt_index - FROM {{ref('dex_trades')}} + FROM {{ source('dex', 'trades') }} UNION ALL SELECT taker, tx_hash, @@ -86,7 +86,7 @@ with token_sold_address, token_bought_address, evt_index - FROM {{ref('dex_aggregator_trades')}} + FROM {{ source('dex', 'trades') }} ) t2 ON t1.tx_hash = t2.tx_hash WHERE t1.blockchain = 'ethereum' diff --git a/models/labels/addresses/dex/persona/dex_aggregator_traders/labels_dex_aggregator_traders.sql b/models/labels/addresses/dex/persona/dex_aggregator_traders/labels_dex_aggregator_traders.sql index 47c2ccee1cf..c5b8ccbedbc 100644 --- a/models/labels/addresses/dex/persona/dex_aggregator_traders/labels_dex_aggregator_traders.sql +++ b/models/labels/addresses/dex/persona/dex_aggregator_traders/labels_dex_aggregator_traders.sql @@ -12,7 +12,7 @@ with dex_traders as ( select distinct taker as address, blockchain - from {{ ref('dex_aggregator_trades') }} + from {{ source('dex_aggregator', 'trades') }} ) select blockchain, diff --git a/models/labels/addresses/dex/persona/dex_pools/labels_dex_pools.sql b/models/labels/addresses/dex/persona/dex_pools/labels_dex_pools.sql index 3b2af76cba0..bd94d99c9b3 100644 --- a/models/labels/addresses/dex/persona/dex_pools/labels_dex_pools.sql +++ b/models/labels/addresses/dex/persona/dex_pools/labels_dex_pools.sql @@ -19,4 +19,4 @@ SELECT blockchain , now() AS updated_at , 'dex_pools' AS model_name , 'persona' AS label_type -FROM {{ ref('dex_pools') }} \ No newline at end of file +FROM {{ source('dex', 'pools') }} \ No newline at end of file diff --git a/models/labels/addresses/dex/persona/dex_traders/labels_dex_traders.sql b/models/labels/addresses/dex/persona/dex_traders/labels_dex_traders.sql index daee195d8a7..6fb71d27fe5 100644 --- a/models/labels/addresses/dex/persona/dex_traders/labels_dex_traders.sql +++ b/models/labels/addresses/dex/persona/dex_traders/labels_dex_traders.sql @@ -14,11 +14,11 @@ with SELECT address, blockchain FROM ( select taker as address, blockchain - from {{ ref('dex_trades') }} + from {{ source('dex', 'trades') }} GROUP BY taker, blockchain --distinct UNION ALL select tx_from as address, blockchain - from {{ ref('dex_trades') }} + from {{ source('dex', 'trades') }} GROUP BY tx_from, blockchain --distinct ) uni GROUP BY address, blockchain--distinct diff --git a/models/labels/addresses/dex/persona/op_dex_traders/labels_op_dex_traders.sql b/models/labels/addresses/dex/persona/op_dex_traders/labels_op_dex_traders.sql index 384db9bbfea..9c33323ddde 100644 --- a/models/labels/addresses/dex/persona/op_dex_traders/labels_op_dex_traders.sql +++ b/models/labels/addresses/dex/persona/op_dex_traders/labels_op_dex_traders.sql @@ -4,7 +4,7 @@ WITH dex_trades_count AS (SELECT taker, COUNT(taker) AS trades_count -FROM {{ ref('dex_trades') }} +FROM {{ source('dex', 'trades') }} WHERE blockchain = 'optimism' GROUP BY taker ), diff --git a/models/labels/addresses/dex/persona/sandwich_attackers/ethereum/labels_sandwich_attackers_ethereum.sql b/models/labels/addresses/dex/persona/sandwich_attackers/ethereum/labels_sandwich_attackers_ethereum.sql index 14020175084..e1c2f3d9587 100644 --- a/models/labels/addresses/dex/persona/sandwich_attackers/ethereum/labels_sandwich_attackers_ethereum.sql +++ b/models/labels/addresses/dex/persona/sandwich_attackers/ethereum/labels_sandwich_attackers_ethereum.sql @@ -4,8 +4,8 @@ with eth_sandwich_attackers as ( select distinct buy.tx_to as address - from {{ ref('dex_trades') }} buy - inner join {{ ref('dex_trades') }} sell + from {{ source('dex', 'trades') }} buy + inner join {{ source('dex', 'trades') }} sell on sell.block_time = buy.block_time and sell.tx_hash != buy.tx_hash and buy."tx_from" = sell."tx_from" diff --git a/models/labels/addresses/dex/persona/smart_dex_traders/ethereum/labels_smart_dex_traders_ethereum.sql b/models/labels/addresses/dex/persona/smart_dex_traders/ethereum/labels_smart_dex_traders_ethereum.sql index d9787ba47e9..4bbbc2e7eea 100644 --- a/models/labels/addresses/dex/persona/smart_dex_traders/ethereum/labels_smart_dex_traders_ethereum.sql +++ b/models/labels/addresses/dex/persona/smart_dex_traders/ethereum/labels_smart_dex_traders_ethereum.sql @@ -75,7 +75,7 @@ swappers as ( token_sold_address, taker, tx_hash - from {{ ref('dex_trades') }} + from {{ source('dex', 'trades') }} where blockchain = 'ethereum' and block_date > now() - interval '60' day @@ -189,7 +189,7 @@ swappers as ( taker, amount_usd / token_bought_amount as cost_basis, project as venue - from {{ ref('dex_trades') }} + from {{ source('dex', 'trades') }} where blockchain = 'ethereum' and block_time > now() - interval '60' day @@ -219,7 +219,7 @@ swappers as ( taker, amount_usd / token_sold_amount as cost_basis, project as venue - from {{ ref('dex_trades') }} + from {{ source('dex', 'trades') }} where blockchain = 'ethereum' and block_time > now() - interval '60' day diff --git a/models/labels/addresses/dex/persona/trader_platforms/labels_trader_platforms.sql b/models/labels/addresses/dex/persona/trader_platforms/labels_trader_platforms.sql index af353c40a18..5f70668a7d2 100644 --- a/models/labels/addresses/dex/persona/trader_platforms/labels_trader_platforms.sql +++ b/models/labels/addresses/dex/persona/trader_platforms/labels_trader_platforms.sql @@ -20,13 +20,13 @@ with trader_platforms as ( taker, project, block_time - from {{ ref('dex_aggregator_trades') }} + from {{ source('dex_aggregator', 'trades') }} UNION ALL select blockchain, taker, project, block_time - from {{ ref('dex_trades') }} + from {{ source('dex', 'trades') }} ) group by taker, project, blockchain order by first_trade diff --git a/models/labels/addresses/dex/usage/average_trade_values/labels_average_trade_values.sql b/models/labels/addresses/dex/usage/average_trade_values/labels_average_trade_values.sql index bb7ef4799cc..566547b6167 100644 --- a/models/labels/addresses/dex/usage/average_trade_values/labels_average_trade_values.sql +++ b/models/labels/addresses/dex/usage/average_trade_values/labels_average_trade_values.sql @@ -17,10 +17,10 @@ with blockchain from ( select taker, blockchain, amount_usd - from {{ ref('dex_aggregator_trades') }} + from {{ source('dex_aggregator', 'trades') }} UNION ALL select taker, blockchain, amount_usd - from {{ ref('dex_trades') }} + from {{ source('dex', 'trades') }} ) group by taker, blockchain ) diff --git a/models/labels/addresses/dex/usage/trader_age/labels_trader_age.sql b/models/labels/addresses/dex/usage/trader_age/labels_trader_age.sql index d294534930c..d1113de13ed 100644 --- a/models/labels/addresses/dex/usage/trader_age/labels_trader_age.sql +++ b/models/labels/addresses/dex/usage/trader_age/labels_trader_age.sql @@ -15,10 +15,10 @@ with trader_age as ( taker as address from ( select blockchain, taker, block_date - from {{ ref('dex_aggregator_trades') }} + from {{ source('dex_aggregator', 'trades') }} UNION ALL select blockchain, taker, block_date - from {{ ref('dex_trades') }} + from {{ source('dex', 'trades') }} ) group by taker, blockchain ) diff --git a/models/labels/addresses/dex/usage/trader_dex_diversity/labels_trader_dex_diversity.sql b/models/labels/addresses/dex/usage/trader_dex_diversity/labels_trader_dex_diversity.sql index 284de74fc99..1fd81228595 100644 --- a/models/labels/addresses/dex/usage/trader_dex_diversity/labels_trader_dex_diversity.sql +++ b/models/labels/addresses/dex/usage/trader_dex_diversity/labels_trader_dex_diversity.sql @@ -16,10 +16,10 @@ with count(distinct project) as dex_diversity, taker as address from (select blockchain, taker, project - from {{ ref('dex_aggregator_trades') }} + from {{ source('dex_aggregator', 'trades') }} union all select blockchain, taker, project - from {{ ref('dex_trades') }}) + from {{ source('dex', 'trades') }}) group by taker, blockchain ) diff --git a/models/labels/addresses/dex/usage/trader_frequencies/labels_trader_frequencies.sql b/models/labels/addresses/dex/usage/trader_frequencies/labels_trader_frequencies.sql index 497037d4765..84cffa9c5fc 100644 --- a/models/labels/addresses/dex/usage/trader_frequencies/labels_trader_frequencies.sql +++ b/models/labels/addresses/dex/usage/trader_frequencies/labels_trader_frequencies.sql @@ -21,10 +21,10 @@ with end as trades_per_day from ( select blockchain, taker, block_date, tx_hash - from {{ ref('dex_aggregator_trades') }} + from {{ source('dex_aggregator', 'trades') }} UNION ALL select blockchain, taker, block_date, tx_hash - from {{ ref('dex_trades') }} + from {{ source('dex', 'trades') }} ) group by taker, blockchain -- That have at least more than 1 trade diff --git a/models/labels/addresses/dex/usage/trader_kyt/labels_trader_kyt.sql b/models/labels/addresses/dex/usage/trader_kyt/labels_trader_kyt.sql index cc26e10fe82..3d43371ccd1 100644 --- a/models/labels/addresses/dex/usage/trader_kyt/labels_trader_kyt.sql +++ b/models/labels/addresses/dex/usage/trader_kyt/labels_trader_kyt.sql @@ -164,7 +164,7 @@ from (select t1."from", date_trunc('month', t1.block_time) AS month, count(*) AS when sum(amount_usd) >= cast(100000 AS double) and sum(amount_usd) < cast(500000 AS double) then 'Shark trader' when sum(amount_usd) >= cast(500000 AS double) then 'Whale trader' end AS trader_type - from {{ ref('dex_trades') }} + from {{ source('dex', 'trades') }} where block_time > now() - interval '30' day group by 1 having sum(amount_usd) > cast (10000 AS double) @@ -184,8 +184,8 @@ from (select t1."from", date_trunc('month', t1.block_time) AS month, count(*) AS date_trunc('month', t1.block_time) AS month, sum(t1.amount_usd) AS monthly_trade_amount, ROW_NUMBER() OVER (PARTITION BY t1.tx_from ORDER BY sum(t1.amount_usd) DESC) AS rn - FROM {{ ref('dex_trades') }} t1 - join (select distinct tx_from from {{ ref('dex_trades') }} where block_time > now() - interval '3' month ) t3 + FROM {{ source('dex', 'trades') }} t1 + join (select distinct tx_from from {{ source('dex', 'trades') }} where block_time > now() - interval '3' month ) t3 on t3.tx_from = t1.tx_from left join active_traders t2 on t1.tx_from = t2.tx_from where t1.block_time >= now() - interval '1' year diff --git a/models/labels/labels_addresses.sql b/models/labels/labels_addresses.sql index 1dbc1d0e38c..e0afc67d250 100644 --- a/models/labels/labels_addresses.sql +++ b/models/labels/labels_addresses.sql @@ -1,5 +1,5 @@ {{ config( - + alias = 'addresses', materialized = 'table', file_format = 'delta', @@ -12,8 +12,8 @@ -- single category labels (no subsets), needs label_type and model_name added still. {% set single_category_labels_models = [ ref('labels_aztec_v2_contracts_ethereum') - , ref('labels_balancer_v1_pools') - , ref('labels_balancer_v2_pools') + , source('labels', 'labels_balancer_v1_pools') + , source('labels', 'balancer_v2_pools') , ref('labels_balancer_v2_gauges') , ref('labels_cex') , ref('labels_contracts') diff --git a/models/paraswap/_schema.yml b/models/paraswap/_schema.yml new file mode 100644 index 00000000000..1fd2dec2cc8 --- /dev/null +++ b/models/paraswap/_schema.yml @@ -0,0 +1,64 @@ +version: 2 + +models: + - name: paraswap_ethereum_airdrop_claims + meta: + blockchain: ethereum + sector: airdrop + project: paraswap + contributors: hildobby + config: + tags: ['table', 'airdrop', 'ethereum', 'claim', 'paraswap'] + description: "List of claim transactions for the $PSP airdrop" + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - tx_hash + - recipient + - evt_index + columns: + - &blockchain + name: blockchain + description: "Blockchain" + - &block_time + name: block_time + description: "Block time of transaction" + - &block_month + name: block_month + description: "Block month of transaction" + - &block_number + name: block_number + description: "Block number of transaction" + - &project + name: project + description: "Project name" + - &airdrop_number + name: airdrop_number + description: "Airdrop identifier number" + - &recipient + name: recipient + description: "Airdrop recipient" + - &contract_address + name: contract_address + description: "Contract addressed used" + - &tx_hash + name: tx_hash + description: "Transaction hash" + - &amount_raw + name: amount_raw + description: "Raw amount of tokens" + - &amount_original + name: amount_original + description: "Original amount of tokens" + - &amount_usd + name: amount_usd + description: "USD value of tokens" + - &token_address + name: token_address + description: "Token address" + - &token_symbol + name: token_symbol + description: "Token symbol" + - &evt_index + name: evt_index + description: "Event index" \ No newline at end of file diff --git a/models/paraswap/ethereum/paraswap_ethereum_airdrop_claims.sql b/models/paraswap/paraswap_ethereum_airdrop_claims.sql similarity index 95% rename from models/paraswap/ethereum/paraswap_ethereum_airdrop_claims.sql rename to models/paraswap/paraswap_ethereum_airdrop_claims.sql index 2b79f196302..7339ca842d6 100644 --- a/models/paraswap/ethereum/paraswap_ethereum_airdrop_claims.sql +++ b/models/paraswap/paraswap_ethereum_airdrop_claims.sql @@ -22,7 +22,7 @@ WITH more_prices AS ( , MAX(hour) AS max_hour , MIN_BY(median_price, hour) AS min_price , MAX_BY(median_price, hour) AS max_price - FROM {{ ref('dex_prices') }} + FROM {{ source('dex', 'prices') }} WHERE blockchain = 'ethereum' AND contract_address= {{psp_token_address}} ) @@ -46,7 +46,7 @@ SELECT 'ethereum' AS blockchain , 'PSP' AS token_symbol , t.evt_index FROM {{ source('erc20_ethereum', 'evt_transfer') }} t -LEFT JOIN {{ ref('dex_prices') }} pu ON pu.blockchain = 'ethereum' +LEFT JOIN {{ source('dex', 'prices') }} pu ON pu.blockchain = 'ethereum' AND pu.contract_address= {{psp_token_address}} AND pu.hour = date_trunc('hour', t.evt_block_time) {% if is_incremental() %} diff --git a/models/pharaoh/pharaoh_avalanche_c_trades.sql b/models/pharaoh/pharaoh_avalanche_c_trades.sql deleted file mode 100644 index efd2e37ed2b..00000000000 --- a/models/pharaoh/pharaoh_avalanche_c_trades.sql +++ /dev/null @@ -1,122 +0,0 @@ -{{ config( - schema = 'pharaoh_avalanche_c' - , alias = 'trades' - , partition_by = ['block_month'] - , materialized = 'incremental' - , file_format = 'delta' - , incremental_strategy = 'merge' - , unique_key = ['block_date', 'blockchain', 'project', 'version', 'tx_hash', 'evt_index'] - ) -}} - -{% set project_start_date = '2023-12-10' %} - -WITH dexs AS -( - SELECT - t.evt_block_time AS block_time - ,t.recipient AS taker - ,CAST(NULL AS VARBINARY) AS maker - ,CASE - WHEN router.evt_tx_hash IS NULL - THEN CASE WHEN amount0 < INT256 '0' THEN abs(amount0) ELSE abs(amount1) END - ELSE router.amountOut - END AS token_bought_amount_raw - ,CASE - WHEN router.evt_tx_hash IS NULL - THEN CASE WHEN amount0 < INT256 '0' THEN abs(amount1) ELSE abs(amount0) END - ELSE router.inputAmount - END AS token_sold_amount_raw - ,NULL AS amount_usd - ,CASE - WHEN router.evt_tx_hash IS NULL - THEN CASE WHEN amount0 < INT256 '0' THEN f.token0 ELSE f.token1 END - ELSE router.outputToken - END AS token_bought_address - ,CASE - WHEN router.evt_tx_hash IS NULL - THEN CASE WHEN amount0 < INT256 '0' THEN f.token1 ELSE f.token0 END - ELSE router.inputToken - END AS token_sold_address - ,t.contract_address as project_contract_address - ,t.evt_tx_hash AS tx_hash - ,t.evt_index - FROM - {{ source('pharaoh_avalanche_c', 'ClPool_evt_Swap') }} t - INNER JOIN - {{ source('pharaoh_avalanche_c', 'ClPoolFactory_evt_PoolCreated') }} f - ON f.pool = t.contract_address - LEFT JOIN {{ source('odos_v2_avalanche_c', 'OdosRouterV2_evt_Swap') }} AS router - ON t.evt_tx_hash = router.evt_tx_hash - AND t.evt_index + 2 = router.evt_index - {% if is_incremental() %} - WHERE {{ incremental_predicate('t.evt_block_time') }} - {% endif %} -) -SELECT - 'avalanche_c' AS blockchain - ,'pharaoh' AS project - ,'1' AS version - ,CAST(date_trunc('day', dexs.block_time) AS date) AS block_date - ,CAST(date_trunc('month', dexs.block_time) AS date) AS block_month - ,dexs.block_time - ,erc20a.symbol AS token_bought_symbol - ,erc20b.symbol AS token_sold_symbol - ,case - when lower(erc20a.symbol) > lower(erc20b.symbol) then concat(erc20b.symbol, '-', erc20a.symbol) - else concat(erc20a.symbol, '-', erc20b.symbol) - end as token_pair - ,CAST(dexs.token_bought_amount_raw AS UINT256) / power(10, erc20a.decimals) AS token_bought_amount - ,CAST(dexs.token_sold_amount_raw AS UINT256) / power(10, erc20b.decimals) AS token_sold_amount - ,CAST(dexs.token_bought_amount_raw AS UINT256) AS token_bought_amount_raw - ,CAST(dexs.token_sold_amount_raw AS UINT256) AS token_sold_amount_raw - ,coalesce( - dexs.amount_usd - ,(CAST(dexs.token_bought_amount_raw AS UINT256) / power(10, p_bought.decimals)) * p_bought.price - ,(CAST(dexs.token_sold_amount_raw AS UINT256) / power(10, p_sold.decimals)) * p_sold.price - ) AS amount_usd - ,dexs.token_bought_address - ,dexs.token_sold_address - ,coalesce(dexs.taker, tx."from") AS taker -- subqueries rely on this COALESCE to avoid redundant joins with the transactions table - ,dexs.maker - ,dexs.project_contract_address - ,dexs.tx_hash - ,tx."from" AS tx_from - ,tx.to AS tx_to - ,dexs.evt_index -FROM dexs -INNER JOIN - {{ source('avalanche_c', 'transactions') }} tx - ON tx.hash = dexs.tx_hash - {% if not is_incremental() %} - AND tx.block_time >= TIMESTAMP '{{project_start_date}}' - {% endif %} - {% if is_incremental() %} - AND {{ incremental_predicate('tx.block_time') }} - {% endif %} -LEFT JOIN {{ source('tokens', 'erc20') }} erc20a - ON erc20a.contract_address = dexs.token_bought_address - AND erc20a.blockchain = 'avalanche_c' -LEFT JOIN {{ source('tokens', 'erc20') }} erc20b - ON erc20b.contract_address = dexs.token_sold_address - AND erc20b.blockchain = 'avalanche_c' -LEFT JOIN {{ source('prices', 'usd') }} p_bought - ON p_bought.minute = date_trunc('minute', dexs.block_time) - AND p_bought.contract_address = dexs.token_bought_address - AND p_bought.blockchain = 'avalanche_c' - {% if not is_incremental() %} - AND p_bought.minute >= TIMESTAMP '{{project_start_date}}' - {% endif %} - {% if is_incremental() %} - AND {{ incremental_predicate('p_bought.minute') }} - {% endif %} -LEFT JOIN {{ source('prices', 'usd') }} p_sold - ON p_sold.minute = date_trunc('minute', dexs.block_time) - AND p_sold.contract_address = dexs.token_sold_address - AND p_sold.blockchain = 'avalanche_c' - {% if not is_incremental() %} - AND p_sold.minute >= TIMESTAMP '{{project_start_date}}' - {% endif %} - {% if is_incremental() %} - AND {{ incremental_predicate('p_sold.minute') }} - {% endif %} diff --git a/models/safe/ethereum/safe_ethereum_airdrop_claims.sql b/models/safe/ethereum/safe_ethereum_airdrop_claims.sql index cea0fad0d3b..8808f7f9cf2 100644 --- a/models/safe/ethereum/safe_ethereum_airdrop_claims.sql +++ b/models/safe/ethereum/safe_ethereum_airdrop_claims.sql @@ -22,7 +22,7 @@ WITH more_prices AS ( , MAX(hour) AS max_hour , MIN_BY(median_price, hour) AS min_price , MAX_BY(median_price, hour) AS max_price - FROM {{ ref('dex_prices') }} + FROM {{ source('dex', 'prices') }} WHERE blockchain = 'ethereum' AND contract_address= {{safe_token_address}} ) @@ -46,7 +46,7 @@ SELECT 'ethereum' AS blockchain , 'SAFE' AS token_symbol , t.evt_index FROM {{ source('erc20_ethereum', 'evt_transfer') }} t -LEFT JOIN {{ ref('dex_prices') }} pu ON pu.blockchain = 'ethereum' +LEFT JOIN {{ source('dex', 'prices') }} pu ON pu.blockchain = 'ethereum' AND pu.contract_address= {{safe_token_address}} AND pu.hour = date_trunc('hour', t.evt_block_time) {% if is_incremental() %} diff --git a/models/thales/ethereum/thales_ethereum_airdrop_claims.sql b/models/thales/ethereum/thales_ethereum_airdrop_claims.sql index 7c7c9e33e48..c9dd3152565 100644 --- a/models/thales/ethereum/thales_ethereum_airdrop_claims.sql +++ b/models/thales/ethereum/thales_ethereum_airdrop_claims.sql @@ -20,7 +20,7 @@ WITH more_prices AS ( , MAX(hour) AS max_hour , MIN_BY(median_price, hour) AS min_price , MAX_BY(median_price, hour) AS max_price - FROM {{ ref('dex_prices') }} + FROM {{ source('dex', 'prices') }} WHERE blockchain = 'ethereum' AND contract_address= {{thales_token_address}} ) @@ -44,7 +44,7 @@ SELECT 'ethereum' AS blockchain , 'THALES' AS token_symbol , t.evt_index FROM {{ source('thales_ethereum', 'Airdrop_evt_Claim') }} t -LEFT JOIN {{ ref('dex_prices') }} pu ON pu.blockchain = 'ethereum' +LEFT JOIN {{ source('dex', 'prices') }} pu ON pu.blockchain = 'ethereum' AND pu.contract_address= {{thales_token_address}} AND pu.hour = date_trunc('hour', t.evt_block_time) WHERE t.evt_block_time BETWEEN TIMESTAMP '2021-09-15' AND TIMESTAMP '2022-02-02' \ No newline at end of file diff --git a/models/unidex/optimism/unidex_optimism_schema.yml b/models/unidex/optimism/unidex_optimism_schema.yml index 421e30803c5..eb1c8039466 100644 --- a/models/unidex/optimism/unidex_optimism_schema.yml +++ b/models/unidex/optimism/unidex_optimism_schema.yml @@ -1,16 +1,16 @@ version: 2 -models: - - name: unidex_optimism_trades +models: + - name: unidex_v1_optimism_perpetual_trades meta: blockchain: optimism - sector: dex - project: unidex + sector: perpetual + project: unidex_v1 contributors: ARDev097 config: - tags: ['optimism','trades', 'unidex','dex'] + tags: ['optimism', 'unidex', 'unidex_v1', 'perpetuals', 'perps'] description: > - unidex dex trades on optimism + Unidex_v1 perpetuals trades on Optimism tests: - dbt_utils.unique_combination_of_columns: combination_of_columns: @@ -19,108 +19,17 @@ models: - project - version - tx_hash - - evt_index - - check_dex_aggregator_seed: - blockchain: optimism - project: unidex - version: 1 + - evt_index columns: - &blockchain name: blockchain description: "Blockchain on which the project is deployed" - - &project - name: project - description: "The underlying protocol/project where the swap took place" - - &version - name: version - description: "The version of the protocol/project" - - &block_month - name: block_month - description: "Month of the transaction" - &block_date name: block_date description: "Date of the transaction" - &block_time name: block_time description: "Time of the transaction" - - &token_bought_symbol - name: token_bought_symbol - description: "Token symbol for token bought in the transaction" - - &token_sold_symbol - name: token_sold_symbol - description: "Token symbol for token sold in the transaction" - - &token_pair - name: token_pair - description: "Token symbol pair for each token involved in the transaction" - - &token_bought_amount - name: token_bought_amount - description: "Value of the token bought at time of execution in the original currency" - - &token_sold_amount - name: token_sold_amount - description: "Value of the token sold at time of execution in the original currency" - - &token_bought_amount_raw - name: token_bought_amount_raw - description: "Raw value of the token bought at time of execution in the original currency" - - &token_sold_amount_raw - name: token_sold_amount_raw - description: "Raw value of the token sold at time of execution in the original currency" - - &amount_usd - name: amount_usd - description: "USD value of the trade at time of execution" - - &token_bought_address - name: token_bought_address - description: "Contract address of the token bought" - - &token_sold_address - name: token_sold_address - description: "Contract address of the token sold" - - &taker - name: taker - description: "Address of trader who purchased a token" - - &maker - name: maker - description: "Address of trader who sold a token" - - &project_contract_address - name: project_contract_address - description: "Project contract address which executed the trade on the blockchain" - - &tx_hash - name: tx_hash - description: "The hash of the transaction" - - &tx_from - name: tx_from - description: "The address that originated the transaction; based on the optimism.transactions table" - - &tx_to - name: tx_to - description: "The address receiving the transaction; based on the optimism.transactions table" - - &evt_index - name: evt_index - description: "Event index number" - - &trace_address - name: trace_address - description: "" - - - name: unidex_v1_optimism_perpetual_trades - meta: - blockchain: optimism - sector: perpetual - project: unidex_v1 - contributors: ARDev097 - config: - tags: ['optimism', 'unidex', 'unidex_v1', 'perpetuals', 'perps'] - description: > - Unidex_v1 perpetuals trades on Optimism - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - block_date - - blockchain - - project - - version - - tx_hash - - evt_index - columns: - - *blockchain - - *block_date - - *block_time - &virtual_asset name: virtual_asset description: "How the protocol represents the underlying asset" @@ -148,8 +57,12 @@ models: - &trade name: trade description: "Indicates the trade's direction whether a short, long, of if a position is being closed" - - *project - - *version + - &project + name: project + description: "The underlying protocol/project where the swap took place" + - &version + name: version + description: "The version of the protocol/project" - &frontend name: frontend description: "The frontend protocol/project where the specific swap was executed; built on top of the 'project' and defaults to the 'project' if no other frontend is specified" @@ -159,11 +72,21 @@ models: - &volume_raw name: volume_raw description: "The size of the position in raw form" - - *tx_hash - - *tx_from - - *tx_to - - *evt_index - - *block_month + - &tx_hash + name: tx_hash + description: "The hash of the transaction" + - &tx_from + name: tx_from + description: "The address that originated the transaction; based on the optimism.transactions table" + - &tx_to + name: tx_to + description: "The address receiving the transaction; based on the optimism.transactions table" + - &evt_index + name: evt_index + description: "Event index number" + - &block_month + name: block_month + description: "Month of the transaction" - name: unidex_v2_optimism_perpetual_trades meta: diff --git a/models/uniswap/arbitrum/uniswap_arbitrum_schema.yml b/models/uniswap/arbitrum/uniswap_arbitrum_schema.yml deleted file mode 100644 index 697330ad2c4..00000000000 --- a/models/uniswap/arbitrum/uniswap_arbitrum_schema.yml +++ /dev/null @@ -1,193 +0,0 @@ -version: 2 - -models: - - name: uniswap_v3_arbitrum_trades - meta: - blockchain: arbitrum - sector: dex - project: uniswap_v3 - contributors: jeff-dude, masquot, soispoke, mtitus6 - config: - tags: ['arbitrum','uniswap_v3','trades', 'uniswap','dex'] - description: > - Uniswap V3 contract trades on Arbitrum - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - block_date - - blockchain - - project - - version - - tx_hash - - evt_index - - check_dex_seed: - blockchain: arbitrum - project: uniswap - version: 3 - columns: - - &blockchain - name: blockchain - description: "Blockchain which the DEX is deployed" - - &project - name: project - description: "Project name of the DEX" - - &version - name: version - description: "Version of the contract built and deployed by the DEX project" - - &block_month - name: block_month - description: "UTC event block month of each DEX trade" - - &block_date - name: block_date - description: "UTC event block date of each DEX trade" - - &block_time - name: block_time - description: "UTC event block time of each DEX trade" - - &token_bought_symbol - name: token_bought_symbol - description: "Token symbol for token bought in the transaction" - - &token_sold_symbol - name: token_sold_symbol - description: "Token symbol for token sold in the transaction" - - &token_pair - name: token_pair - description: "Token symbol pair for each token involved in the transaction" - - &token_bought_amount - name: token_bought_amount - description: "Value of the token bought at time of execution in the original currency" - - &token_sold_amount - name: token_sold_amount - description: "Value of the token sold at time of execution in the original currency" - - &token_bought_amount_raw - name: token_bought_amount_raw - description: "Raw value of the token bought at time of execution in the original currency" - - &token_sold_amount_raw - name: token_sold_amount_raw - description: "Raw value of the token sold at time of execution in the original currency" - - &amount_usd - name: amount_usd - description: "USD value of the trade at time of execution" - - &token_bought_address - name: token_bought_address - description: "Contract address of the token bought" - - &token_sold_address - name: token_sold_address - description: "Contract address of the token sold" - - &taker - name: taker - description: "Address of trader who purchased a token" - - &maker - name: maker - description: "Address of trader who sold a token" - - &project_contract_address - name: project_contract_address - description: "Project contract address which executed the trade on the blockchain" - - &tx_hash - name: tx_hash - description: "Unique transaction hash value tied to each transaction on the DEX" - - &tx_from - name: tx_from - description: "Address which initiated the transaction" - - &tx_to - name: tx_to - description: "Address which received the transaction" - - &evt_index - name: evt_index - description: "" - - - name: uniswap_arbitrum_trades - meta: - blockchain: arbitrum - sector: dex - project: uniswap - contributors: jeff-dude, masquot, soispoke, mtitus6 - config: - tags: ['arbitrum','dex','trades', 'uniswap'] - description: > - Uniswap trades on Arbitrum across all contracts and versions. This table will load dex trades downstream. - columns: - - *blockchain - - *project - - *version - - *block_month - - *block_date - - *block_time - - *token_bought_symbol - - *token_sold_symbol - - *token_pair - - *token_bought_amount - - *token_sold_amount - - *token_bought_amount_raw - - *token_sold_amount_raw - - *amount_usd - - *token_bought_address - - *token_sold_address - - *taker - - *maker - - *project_contract_address - - *tx_hash - - *tx_from - - *tx_to - - *evt_index - - - name: uniswap_arbitrum_pools - meta: - blockchain: arbitrum - sector: dex - contributors: hildobby - config: - tags: ['arbitrum'] - description: > - Uniswap DEX pools - columns: - - *blockchain - - *project - - *version - - name: pool - description: "DEX pool smart contract address" - tests: - - unique - - name: fee - description: "Defined fee" - - name: token0 - description: "First token in pool" - - name: token1 - description: "Second token in pool" - - name: creation_block_time - description: "Block time of pool creation" - - name: creation_block_number - description: "Block number of pool creation" - - name: contract_address - description: "Contract address used to create the pool" - - - name: uniswap_v3_arbitrum_flashloans - meta: - blockchain: arbitrum - sector: lending - contributors: hildobby - config: - tags: ['arbitrum', 'flashloans'] - description: > - All Uniswap v3 flashloans on Arbitrum - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - blockchain - - tx_hash - - evt_index - columns: - - name: blockchain - - name: project - - name: version - - name: block_time - - name: block_number - - name: amount - - name: amount_usd - - name: tx_hash - - name: evt_index - - name: fee - - name: currency_contract - - name: currency_symbol - - name: recipient - - name: contract_address - - name: block_month diff --git a/models/uniswap/arbitrum/uniswap_arbitrum_trades.sql b/models/uniswap/arbitrum/uniswap_arbitrum_trades.sql deleted file mode 100644 index adfa8e14cac..00000000000 --- a/models/uniswap/arbitrum/uniswap_arbitrum_trades.sql +++ /dev/null @@ -1,45 +0,0 @@ -{{ config( - alias = 'trades' - , tags = ['prod_exclude'] - ) -}} - -{% set uniswap_models = [ -ref('uniswap_v3_arbitrum_trades') -] %} - - -SELECT * -FROM ( - {% for dex_model in uniswap_models %} - SELECT - blockchain, - project, - version, - block_month, - block_date, - block_time, - token_bought_symbol, - token_sold_symbol, - token_pair, - token_bought_amount, - token_sold_amount, - token_bought_amount_raw, - token_sold_amount_raw, - amount_usd, - token_bought_address, - token_sold_address, - taker, - maker, - project_contract_address, - tx_hash, - tx_from, - tx_to, - - evt_index - FROM {{ dex_model }} - {% if not loop.last %} - UNION ALL - {% endif %} - {% endfor %} -) diff --git a/models/uniswap/arbitrum/uniswap_v3_arbitrum_trades.sql b/models/uniswap/arbitrum/uniswap_v3_arbitrum_trades.sql deleted file mode 100644 index 48e18251c6f..00000000000 --- a/models/uniswap/arbitrum/uniswap_v3_arbitrum_trades.sql +++ /dev/null @@ -1,111 +0,0 @@ -{{ config( - schema = 'uniswap_v3_arbitrum', - alias = 'trades', - tags = ['prod_exclude'], - partition_by = ['block_month'], - materialized = 'incremental', - file_format = 'delta', - incremental_strategy = 'merge', - unique_key = ['block_date', 'blockchain', 'project', 'version', 'tx_hash', 'evt_index'], - post_hook='{{ expose_spells(\'["arbitrum"]\', - "project", - "uniswap_v3", - \'["jeff-dude", "markusbkoch", "masquot", "milkyklim", "0xBoxer", "mewwts", "hagaetc","mtitus6"]\') }}' - ) -}} - -{% set project_start_date = '2021-06-01' %} - -WITH dexs AS -( - --Uniswap v3 - SELECT - t.evt_block_time AS block_time - ,t.recipient AS taker - ,CAST(NULL as VARBINARY) as maker - ,CASE WHEN amount0 < INT256 '0' THEN abs(amount0) ELSE abs(amount1) END AS token_bought_amount_raw -- when amount0 is negative it means trader_a is buying token0 from the pool - ,CASE WHEN amount0 < INT256 '0' THEN abs(amount1) ELSE abs(amount0) END AS token_sold_amount_raw - ,NULL AS amount_usd - ,CASE WHEN amount0 < INT256 '0' THEN f.token0 ELSE f.token1 END AS token_bought_address - ,CASE WHEN amount0 < INT256 '0' THEN f.token1 ELSE f.token0 END AS token_sold_address - ,t.contract_address as project_contract_address - ,t.evt_tx_hash AS tx_hash - - ,t.evt_index - FROM - {{ source('uniswap_v3_arbitrum', 'Pair_evt_Swap') }} t - INNER JOIN - {{ source('uniswap_v3_arbitrum', 'Factory_evt_PoolCreated') }} f - ON f.pool = t.contract_address - {% if is_incremental() %} - WHERE t.evt_block_time >= date_trunc('day', now() - interval '7' day) - {% endif %} -) -SELECT DISTINCT - 'arbitrum' AS blockchain - ,'uniswap' AS project - ,'3' AS version - ,CAST(date_trunc('month', dexs.block_time) AS date) AS block_month - ,CAST(date_trunc('DAY', dexs.block_time) AS date) AS block_date - ,dexs.block_time - ,erc20a.symbol AS token_bought_symbol - ,erc20b.symbol AS token_sold_symbol - ,case - when lower(erc20a.symbol) > lower(erc20b.symbol) then concat(erc20b.symbol, '-', erc20a.symbol) - else concat(erc20a.symbol, '-', erc20b.symbol) - end as token_pair - ,dexs.token_bought_amount_raw / power(10, erc20a.decimals) AS token_bought_amount - ,dexs.token_sold_amount_raw / power(10, erc20b.decimals) AS token_sold_amount - ,CAST(dexs.token_bought_amount_raw AS UINT256) AS token_bought_amount_raw - ,CAST(dexs.token_sold_amount_raw AS UINT256) AS token_sold_amount_raw - ,coalesce( - dexs.amount_usd - ,(dexs.token_bought_amount_raw / power(10, p_bought.decimals)) * p_bought.price - ,(dexs.token_sold_amount_raw / power(10, p_sold.decimals)) * p_sold.price - ) AS amount_usd - ,dexs.token_bought_address - ,dexs.token_sold_address - ,coalesce(dexs.taker, tx."from") AS taker -- subqueries rely on this COALESCE to avoid redundant joins with the transactions table - ,dexs.maker - ,dexs.project_contract_address - ,dexs.tx_hash - ,tx."from" AS tx_from - ,tx.to AS tx_to - - ,dexs.evt_index -FROM dexs -INNER JOIN - {{ source('arbitrum', 'transactions') }} tx - ON tx.hash = dexs.tx_hash - {% if not is_incremental() %} - AND tx.block_time >= TIMESTAMP '{{project_start_date}}' - {% endif %} - {% if is_incremental() %} - AND tx.block_time >= date_trunc('day', now() - interval '7' day) - {% endif %} -LEFT JOIN {{ source('tokens', 'erc20') }} erc20a - ON erc20a.contract_address = dexs.token_bought_address - AND erc20a.blockchain = 'arbitrum' -LEFT JOIN {{ source('tokens', 'erc20') }} erc20b - ON erc20b.contract_address = dexs.token_sold_address - AND erc20b.blockchain = 'arbitrum' -LEFT JOIN {{ source('prices', 'usd') }} p_bought - ON p_bought.minute = date_trunc('minute', dexs.block_time) - AND p_bought.contract_address = dexs.token_bought_address - AND p_bought.blockchain = 'arbitrum' - {% if not is_incremental() %} - AND p_bought.minute >= TIMESTAMP '{{project_start_date}}' - {% endif %} - {% if is_incremental() %} - AND p_bought.minute >= date_trunc('day', now() - interval '7' day) - {% endif %} -LEFT JOIN {{ source('prices', 'usd') }} p_sold - ON p_sold.minute = date_trunc('minute', dexs.block_time) - AND p_sold.contract_address = dexs.token_sold_address - AND p_sold.blockchain = 'arbitrum' - {% if not is_incremental() %} - AND p_sold.minute >= TIMESTAMP '{{project_start_date}}' - {% endif %} - {% if is_incremental() %} - AND p_sold.minute >= date_trunc('day', now() - interval '7' day) - {% endif %} \ No newline at end of file diff --git a/models/uniswap/avalanche_c/uniswap_avalanche_c_trades.sql b/models/uniswap/avalanche_c/uniswap_avalanche_c_trades.sql deleted file mode 100644 index 767f36bef15..00000000000 --- a/models/uniswap/avalanche_c/uniswap_avalanche_c_trades.sql +++ /dev/null @@ -1,44 +0,0 @@ -{{ config( - schema = 'uniswap_avalanche_c' - , alias = 'trades' - , tags = ['prod_exclude'] - ) -}} - -{% set uniswap_avalanche_c_models = [ -'uniswap_v3_avalanche_c_trades' -] %} - -SELECT * -FROM ( - {% for dex_model in uniswap_avalanche_c_models %} - SELECT - blockchain, - project, - version, - block_date, - block_month, - block_time, - token_bought_symbol, - token_sold_symbol, - token_pair, - token_bought_amount, - token_sold_amount, - token_bought_amount_raw, - token_sold_amount_raw, - amount_usd, - token_bought_address, - token_sold_address, - taker, - maker, - project_contract_address, - tx_hash, - tx_from, - tx_to, - evt_index - FROM {{ ref(dex_model) }} - {% if not loop.last %} - UNION ALL - {% endif %} - {% endfor %} -) \ No newline at end of file diff --git a/models/uniswap/avalanche_c/uniswap_v3_avalanche_c_trades.sql b/models/uniswap/avalanche_c/uniswap_v3_avalanche_c_trades.sql deleted file mode 100644 index d3b189d99f3..00000000000 --- a/models/uniswap/avalanche_c/uniswap_v3_avalanche_c_trades.sql +++ /dev/null @@ -1,106 +0,0 @@ -{{ config( - schema = 'uniswap_v3_avalanche_c', - alias = 'trades', - tags = ['prod_exclude'], - partition_by = ['block_month'], - materialized = 'incremental', - file_format = 'delta', - incremental_strategy = 'merge', - unique_key = ['block_date', 'blockchain', 'project', 'version', 'tx_hash', 'evt_index'] - ) -}} - -{% set project_start_date = '2023-06-21' %} - -WITH dexs AS -( - --Uniswap v3 - SELECT - t.evt_block_time AS block_time - ,t.recipient AS taker - ,CAST(NULL as VARBINARY) as maker - ,CASE WHEN amount0 < INT256 '0' THEN abs(amount0) ELSE abs(amount1) END AS token_bought_amount_raw -- when amount0 is negative it means trader_a is buying token0 from the pool - ,CASE WHEN amount0 < INT256 '0' THEN abs(amount1) ELSE abs(amount0) END AS token_sold_amount_raw - ,NULL AS amount_usd - ,CASE WHEN amount0 < INT256 '0' THEN f.token0 ELSE f.token1 END AS token_bought_address - ,CASE WHEN amount0 < INT256 '0' THEN f.token1 ELSE f.token0 END AS token_sold_address - ,t.contract_address as project_contract_address - ,t.evt_tx_hash AS tx_hash - ,t.evt_index - FROM - {{ source('uniswap_v3_avalanche_c', 'Pair_evt_Swap') }} t - INNER JOIN - {{ source('uniswap_v3_avalanche_c', 'UniswapV3Factory_evt_PoolCreated') }} f - ON f.pool = t.contract_address - {% if is_incremental() %} - WHERE t.evt_block_time >= date_trunc('day', now() - interval '7' day) - {% endif %} -) -SELECT - 'avalanche_c' AS blockchain - ,'uniswap' AS project - ,'3' AS version - ,TRY_CAST(date_trunc('DAY', dexs.block_time) AS date) AS block_date - ,CAST(date_trunc('month', dexs.block_time) AS date) AS block_month - ,dexs.block_time - ,erc20a.symbol AS token_bought_symbol - ,erc20b.symbol AS token_sold_symbol - ,case - when lower(erc20a.symbol) > lower(erc20b.symbol) then concat(erc20b.symbol, '-', erc20a.symbol) - else concat(erc20a.symbol, '-', erc20b.symbol) - end as token_pair - ,dexs.token_bought_amount_raw / power(10, erc20a.decimals) AS token_bought_amount - ,dexs.token_sold_amount_raw / power(10, erc20b.decimals) AS token_sold_amount - ,cast(dexs.token_bought_amount_raw AS uint256) AS token_bought_amount_raw - ,cast(dexs.token_sold_amount_raw AS uint256) AS token_sold_amount_raw - ,coalesce( - dexs.amount_usd - ,(dexs.token_bought_amount_raw / power(10, p_bought.decimals)) * p_bought.price - ,(dexs.token_sold_amount_raw / power(10, p_sold.decimals)) * p_sold.price - ) AS amount_usd - ,dexs.token_bought_address - ,dexs.token_sold_address - ,coalesce(dexs.taker, tx."from") AS taker -- subqueries rely on this COALESCE to avoid redundant joins with the transactions table - ,dexs.maker - ,dexs.project_contract_address - ,dexs.tx_hash - ,tx."from" AS tx_from - ,tx.to AS tx_to - - ,dexs.evt_index -FROM dexs -INNER JOIN - {{ source('avalanche_c', 'transactions') }} tx - ON tx.hash = dexs.tx_hash - {% if not is_incremental() %} - AND tx.block_time >= TIMESTAMP '{{project_start_date}}' - {% endif %} - {% if is_incremental() %} - AND tx.block_time >= date_trunc('day', now() - interval '7' day) - {% endif %} -LEFT JOIN {{ source('tokens', 'erc20') }} erc20a - ON erc20a.contract_address = dexs.token_bought_address - AND erc20a.blockchain = 'avalanche_c' -LEFT JOIN {{ source('tokens', 'erc20') }} erc20b - ON erc20b.contract_address = dexs.token_sold_address - AND erc20b.blockchain = 'avalanche_c' -LEFT JOIN {{ source('prices', 'usd') }} p_bought - ON p_bought.minute = date_trunc('minute', dexs.block_time) - AND p_bought.contract_address = dexs.token_bought_address - AND p_bought.blockchain = 'avalanche_c' - {% if not is_incremental() %} - AND p_bought.minute >= TIMESTAMP '{{project_start_date}}' - {% endif %} - {% if is_incremental() %} - AND p_bought.minute >= date_trunc('day', now() - interval '7' day) - {% endif %} -LEFT JOIN {{ source('prices', 'usd') }} p_sold - ON p_sold.minute = date_trunc('minute', dexs.block_time) - AND p_sold.contract_address = dexs.token_sold_address - AND p_sold.blockchain = 'avalanche_c' - {% if not is_incremental() %} - AND p_sold.minute >= TIMESTAMP '{{project_start_date}}' - {% endif %} - {% if is_incremental() %} - AND p_sold.minute >= date_trunc('day', now() - interval '7' day) - {% endif %} \ No newline at end of file diff --git a/models/uniswap/base/uniswap_base_trades.sql b/models/uniswap/base/uniswap_base_trades.sql deleted file mode 100644 index 6390c817a7f..00000000000 --- a/models/uniswap/base/uniswap_base_trades.sql +++ /dev/null @@ -1,43 +0,0 @@ -{{ config( - alias = 'trades' - , tags = ['prod_exclude'] - ) -}} - -{% set uniswap_base_models = [ -'uniswap_v3_base_trades' -] %} - -SELECT * -FROM ( - {% for dex_model in uniswap_base_models %} - SELECT - blockchain, - project, - version, - block_date, - block_month, - block_time, - token_bought_symbol, - token_sold_symbol, - token_pair, - token_bought_amount, - token_sold_amount, - token_bought_amount_raw, - token_sold_amount_raw, - amount_usd, - token_bought_address, - token_sold_address, - taker, - maker, - project_contract_address, - tx_hash, - tx_from, - tx_to, - evt_index - FROM {{ ref(dex_model) }} - {% if not loop.last %} - UNION ALL - {% endif %} - {% endfor %} -) \ No newline at end of file diff --git a/models/uniswap/base/uniswap_v3_base_trades.sql b/models/uniswap/base/uniswap_v3_base_trades.sql deleted file mode 100644 index e9f96ec9f4b..00000000000 --- a/models/uniswap/base/uniswap_v3_base_trades.sql +++ /dev/null @@ -1,110 +0,0 @@ -{{ config( - schema = 'uniswap_v3_base', - alias = 'trades', - tags = ['prod_exclude'], - partition_by = ['block_month'], - materialized = 'incremental', - file_format = 'delta', - incremental_strategy = 'merge', - unique_key = ['block_date', 'blockchain', 'project', 'version', 'tx_hash', 'evt_index'], - post_hook='{{ expose_spells(\'["base"]\', - "project", - "uniswap_v3", - \'["wuligy"]\') }}' - ) -}} - -{% set project_start_date = '2023-07-16' %} - -WITH dexs AS -( - --Uniswap v3 - SELECT - t.evt_block_time AS block_time - ,t.recipient AS taker - ,CAST(NULL as VARBINARY) as maker - ,CASE WHEN amount0 < INT256 '0' THEN abs(amount0) ELSE abs(amount1) END AS token_bought_amount_raw -- when amount0 is negative it means trader_a is buying token0 from the pool - ,CASE WHEN amount0 < INT256 '0' THEN abs(amount1) ELSE abs(amount0) END AS token_sold_amount_raw - ,NULL AS amount_usd - ,CASE WHEN amount0 < INT256 '0' THEN f.token0 ELSE f.token1 END AS token_bought_address - ,CASE WHEN amount0 < INT256 '0' THEN f.token1 ELSE f.token0 END AS token_sold_address - ,t.contract_address as project_contract_address - ,t.evt_tx_hash AS tx_hash - ,t.evt_index - FROM - {{ source('uniswap_v3_base', 'UniswapV3Pool_evt_Swap') }} t - INNER JOIN - {{ source('uniswap_v3_base', 'UniswapV3Factory_evt_PoolCreated') }} f - ON f.pool = t.contract_address - {% if is_incremental() %} - WHERE t.evt_block_time >= date_trunc('day', now() - interval '7' day) - {% endif %} -) -SELECT - 'base' AS blockchain - ,'uniswap' AS project - ,'3' AS version - ,TRY_CAST(date_trunc('DAY', dexs.block_time) AS date) AS block_date - ,CAST(date_trunc('month', dexs.block_time) AS date) AS block_month - ,dexs.block_time - ,erc20a.symbol AS token_bought_symbol - ,erc20b.symbol AS token_sold_symbol - ,case - when lower(erc20a.symbol) > lower(erc20b.symbol) then concat(erc20b.symbol, '-', erc20a.symbol) - else concat(erc20a.symbol, '-', erc20b.symbol) - end as token_pair - ,dexs.token_bought_amount_raw / power(10, erc20a.decimals) AS token_bought_amount - ,dexs.token_sold_amount_raw / power(10, erc20b.decimals) AS token_sold_amount - ,cast(dexs.token_bought_amount_raw AS uint256) AS token_bought_amount_raw - ,cast(dexs.token_sold_amount_raw AS uint256) AS token_sold_amount_raw - ,coalesce( - dexs.amount_usd - ,(dexs.token_bought_amount_raw / power(10, p_bought.decimals)) * p_bought.price - ,(dexs.token_sold_amount_raw / power(10, p_sold.decimals)) * p_sold.price - ) AS amount_usd - ,dexs.token_bought_address - ,dexs.token_sold_address - ,coalesce(dexs.taker, tx."from") AS taker -- subqueries rely on this COALESCE to avoid redundant joins with the transactions table - ,dexs.maker - ,dexs.project_contract_address - ,dexs.tx_hash - ,tx."from" AS tx_from - ,tx.to AS tx_to - - ,dexs.evt_index -FROM dexs -INNER JOIN - {{ source('base', 'transactions') }} tx - ON tx.hash = dexs.tx_hash - {% if not is_incremental() %} - AND tx.block_time >= TIMESTAMP '{{project_start_date}}' - {% endif %} - {% if is_incremental() %} - AND tx.block_time >= date_trunc('day', now() - interval '7' day) - {% endif %} -LEFT JOIN {{ source('tokens', 'erc20') }} erc20a - ON erc20a.contract_address = dexs.token_bought_address - AND erc20a.blockchain = 'base' -LEFT JOIN {{ source('tokens', 'erc20') }} erc20b - ON erc20b.contract_address = dexs.token_sold_address - AND erc20b.blockchain = 'base' -LEFT JOIN {{ source('prices', 'usd') }} p_bought - ON p_bought.minute = date_trunc('minute', dexs.block_time) - AND p_bought.contract_address = dexs.token_bought_address - AND p_bought.blockchain = 'base' - {% if not is_incremental() %} - AND p_bought.minute >= TIMESTAMP '{{project_start_date}}' - {% endif %} - {% if is_incremental() %} - AND p_bought.minute >= date_trunc('day', now() - interval '7' day) - {% endif %} -LEFT JOIN {{ source('prices', 'usd') }} p_sold - ON p_sold.minute = date_trunc('minute', dexs.block_time) - AND p_sold.contract_address = dexs.token_sold_address - AND p_sold.blockchain = 'base' - {% if not is_incremental() %} - AND p_sold.minute >= TIMESTAMP '{{project_start_date}}' - {% endif %} - {% if is_incremental() %} - AND p_sold.minute >= date_trunc('day', now() - interval '7' day) - {% endif %} \ No newline at end of file diff --git a/models/uniswap/bnb/uniswap_bnb_schema.yml b/models/uniswap/bnb/uniswap_bnb_schema.yml deleted file mode 100644 index 7ce9483d7b7..00000000000 --- a/models/uniswap/bnb/uniswap_bnb_schema.yml +++ /dev/null @@ -1,193 +0,0 @@ -version: 2 - -models: - - name: uniswap_v3_bnb_trades - meta: - blockchain: bnb - sector: dex - project: uniswap_v3 - contributors: chrispearcx - config: - tags: ['bnb','uniswap_v3','trades', 'uniswap','dex'] - description: > - Uniswap V3 contract trades on BNB chain - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - block_date - - blockchain - - project - - version - - tx_hash - - evt_index - - check_dex_seed: - blockchain: bnb - project: uniswap - version: 3 - columns: - - &blockchain - name: blockchain - description: "Blockchain which the DEX is deployed" - - &project - name: project - description: "Project name of the DEX" - - &version - name: version - description: "Version of the contract built and deployed by the DEX project" - - &block_month - name: block_date - description: "UTC event block month of each DEX trade" - - &block_date - name: block_date - description: "UTC event block date of each DEX trade" - - &block_time - name: block_time - description: "UTC event block time of each DEX trade" - - &token_bought_symbol - name: token_bought_symbol - description: "Token symbol for token bought in the transaction" - - &token_sold_symbol - name: token_sold_symbol - description: "Token symbol for token sold in the transaction" - - &token_pair - name: token_pair - description: "Token symbol pair for each token involved in the transaction" - - &token_bought_amount - name: token_bought_amount - description: "Value of the token bought at time of execution in the original currency" - - &token_sold_amount - name: token_sold_amount - description: "Value of the token sold at time of execution in the original currency" - - &token_bought_amount_raw - name: token_bought_amount_raw - description: "Raw value of the token bought at time of execution in the original currency" - - &token_sold_amount_raw - name: token_sold_amount_raw - description: "Raw value of the token sold at time of execution in the original currency" - - &amount_usd - name: amount_usd - description: "USD value of the trade at time of execution" - - &token_bought_address - name: token_bought_address - description: "Contract address of the token bought" - - &token_sold_address - name: token_sold_address - description: "Contract address of the token sold" - - &taker - name: taker - description: "Address of trader who purchased a token" - - &maker - name: maker - description: "Address of trader who sold a token" - - &project_contract_address - name: project_contract_address - description: "Project contract address which executed the trade on the blockchain" - - &tx_hash - name: tx_hash - description: "Unique transaction hash value tied to each transaction on the DEX" - - &tx_from - name: tx_from - description: "Address which initiated the transaction" - - &tx_to - name: tx_to - description: "Address which received the transaction" - - &evt_index - name: evt_index - description: "" - - - name: uniswap_bnb_trades - meta: - blockchain: bnb - sector: dex - project: uniswap - contributors: chrispearcx - config: - tags: ['bnb','dex','trades', 'uniswap'] - description: > - Uniswap trades on BNB chain across all contracts and versions. This table will load dex trades downstream. - columns: - - *blockchain - - *project - - *version - - *block_month - - *block_date - - *block_time - - *token_bought_symbol - - *token_sold_symbol - - *token_pair - - *token_bought_amount - - *token_sold_amount - - *token_bought_amount_raw - - *token_sold_amount_raw - - *amount_usd - - *token_bought_address - - *token_sold_address - - *taker - - *maker - - *project_contract_address - - *tx_hash - - *tx_from - - *tx_to - - *evt_index - - - name: uniswap_v3_bnb_flashloans - meta: - blockchain: bnb - sector: lending - contributors: hildobby - config: - tags: ['bnb', 'flashloans'] - description: > - All Uniswap v3 flashloans on BNB - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - blockchain - - tx_hash - - evt_index - columns: - - name: blockchain - - name: project - - name: version - - name: block_time - - name: block_number - - name: amount - - name: amount_usd - - name: tx_hash - - name: evt_index - - name: fee - - name: currency_contract - - name: currency_symbol - - name: recipient - - name: contract_address - - name: block_month - - - name: uniswap_bnb_pools - meta: - blockchain: bnb - sector: dex - contributors: mtitus6 - config: - tags: ['bnb'] - description: > - Uniswap DEX pools on BNB - columns: - - *blockchain - - *project - - *version - - name: pool - description: "DEX pool smart contract address" - tests: - - unique - - name: fee - description: "Defined fee" - - name: token0 - description: "First token in pool" - - name: token1 - description: "Second token in pool" - - name: creation_block_time - description: "Block time of pool creation" - - name: creation_block_number - description: "Block number of pool creation" - - name: contract_address - description: "Contract address used to create the pool" diff --git a/models/uniswap/bnb/uniswap_bnb_trades.sql b/models/uniswap/bnb/uniswap_bnb_trades.sql deleted file mode 100644 index fd14d526849..00000000000 --- a/models/uniswap/bnb/uniswap_bnb_trades.sql +++ /dev/null @@ -1,44 +0,0 @@ -{{ config( - alias = 'trades' - , tags = ['prod_exclude'] - ) -}} - -{% set uniswap_bnb_models = [ -ref('uniswap_v3_bnb_trades') -] %} - - -SELECT * -FROM ( - {% for dex_model in uniswap_bnb_models %} - SELECT - blockchain, - project, - version, - block_month, - block_date, - block_time, - token_bought_symbol, - token_sold_symbol, - token_pair, - token_bought_amount, - token_sold_amount, - token_bought_amount_raw, - token_sold_amount_raw, - amount_usd, - token_bought_address, - token_sold_address, - taker, - maker, - project_contract_address, - tx_hash, - tx_from, - tx_to, - evt_index - FROM {{ dex_model }} - {% if not loop.last %} - UNION ALL - {% endif %} - {% endfor %} -) \ No newline at end of file diff --git a/models/uniswap/bnb/uniswap_v3_bnb_trades.sql b/models/uniswap/bnb/uniswap_v3_bnb_trades.sql deleted file mode 100644 index 8c582789d1b..00000000000 --- a/models/uniswap/bnb/uniswap_v3_bnb_trades.sql +++ /dev/null @@ -1,111 +0,0 @@ -{{ config( - schema = 'uniswap_v3_bnb', - alias = 'trades', - tags = ['prod_exclude'], - partition_by = ['block_month'], - materialized = 'incremental', - file_format = 'delta', - incremental_strategy = 'merge', - unique_key = ['block_date', 'blockchain', 'project', 'version', 'tx_hash', 'evt_index'], - post_hook='{{ expose_spells(\'["bnb"]\', - "project", - "uniswap_v3", - \'["chrispearcx"]\') }}' - ) -}} - -{% set project_start_date = '2023-03-01' %} - -WITH dexs AS -( - --Uniswap v3 - SELECT - t.evt_block_time AS block_time - ,t.recipient AS taker - ,CAST(NULL as VARBINARY) as maker - ,CASE WHEN amount0 < INT256 '0' THEN abs(amount0) ELSE abs(amount1) END AS token_bought_amount_raw -- when amount0 is negative it means trader_a is buying token0 from the pool - ,CASE WHEN amount0 < INT256 '0' THEN abs(amount1) ELSE abs(amount0) END AS token_sold_amount_raw - ,NULL AS amount_usd - ,CASE WHEN amount0 < INT256 '0' THEN f.token0 ELSE f.token1 END AS token_bought_address - ,CASE WHEN amount0 < INT256 '0' THEN f.token1 ELSE f.token0 END AS token_sold_address - ,t.contract_address as project_contract_address - ,t.evt_tx_hash AS tx_hash - - ,t.evt_index - FROM - {{ source('uniswap_v3_bnb', 'Pair_evt_Swap') }} t - INNER JOIN - {{ source('uniswap_v3_bnb', 'Factory_evt_PoolCreated') }} f - ON f.pool = t.contract_address - {% if is_incremental() %} - WHERE t.evt_block_time >= date_trunc('day', now() - interval '7' day) - {% endif %} -) -SELECT - 'bnb' AS blockchain - ,'uniswap' AS project - ,'3' AS version - ,CAST(date_trunc('month', dexs.block_time) AS date) AS block_month - ,CAST(date_trunc('DAY', dexs.block_time) AS date) AS block_date - ,dexs.block_time - ,erc20a.symbol AS token_bought_symbol - ,erc20b.symbol AS token_sold_symbol - ,case - when lower(erc20a.symbol) > lower(erc20b.symbol) then concat(erc20b.symbol, '-', erc20a.symbol) - else concat(erc20a.symbol, '-', erc20b.symbol) - end as token_pair - ,dexs.token_bought_amount_raw / power(10, erc20a.decimals) AS token_bought_amount - ,dexs.token_sold_amount_raw / power(10, erc20b.decimals) AS token_sold_amount - ,CAST(dexs.token_bought_amount_raw AS UINT256) AS token_bought_amount_raw - ,CAST(dexs.token_sold_amount_raw AS UINT256) AS token_sold_amount_raw - ,coalesce( - dexs.amount_usd - ,(dexs.token_bought_amount_raw / power(10, p_bought.decimals)) * p_bought.price - ,(dexs.token_sold_amount_raw / power(10, p_sold.decimals)) * p_sold.price - ) AS amount_usd - ,dexs.token_bought_address - ,dexs.token_sold_address - ,coalesce(dexs.taker, tx."from") AS taker -- subqueries rely on this COALESCE to avoid redundant joins with the transactions table - ,dexs.maker - ,dexs.project_contract_address - ,dexs.tx_hash - ,tx."from" AS tx_from - ,tx.to AS tx_to - - ,dexs.evt_index -FROM dexs -INNER JOIN - {{ source('bnb', 'transactions') }} tx - ON tx.hash = dexs.tx_hash - {% if not is_incremental() %} - AND tx.block_time >= TIMESTAMP '{{project_start_date}}' - {% endif %} - {% if is_incremental() %} - AND tx.block_time >= date_trunc('day', now() - interval '7' day) - {% endif %} -LEFT JOIN {{ source('tokens', 'erc20') }} erc20a - ON erc20a.contract_address = dexs.token_bought_address - AND erc20a.blockchain = 'bnb' -LEFT JOIN {{ source('tokens', 'erc20') }} erc20b - ON erc20b.contract_address = dexs.token_sold_address - AND erc20b.blockchain = 'bnb' -LEFT JOIN {{ source('prices', 'usd') }} p_bought - ON p_bought.minute = date_trunc('minute', dexs.block_time) - AND p_bought.contract_address = dexs.token_bought_address - AND p_bought.blockchain = 'bnb' - {% if not is_incremental() %} - AND p_bought.minute >= TIMESTAMP '{{project_start_date}}' - {% endif %} - {% if is_incremental() %} - AND p_bought.minute >= date_trunc('day', now() - interval '7' day) - {% endif %} -LEFT JOIN {{ source('prices', 'usd') }} p_sold - ON p_sold.minute = date_trunc('minute', dexs.block_time) - AND p_sold.contract_address = dexs.token_sold_address - AND p_sold.blockchain = 'bnb' - {% if not is_incremental() %} - AND p_sold.minute >= TIMESTAMP '{{project_start_date}}' - {% endif %} - {% if is_incremental() %} - AND p_sold.minute >= date_trunc('day', now() - interval '7' day) - {% endif %} \ No newline at end of file diff --git a/models/uniswap/celo/uniswap_celo_schema.yml b/models/uniswap/celo/uniswap_celo_schema.yml deleted file mode 100644 index eb2ede7194c..00000000000 --- a/models/uniswap/celo/uniswap_celo_schema.yml +++ /dev/null @@ -1,193 +0,0 @@ -version: 2 - -models: - - name: uniswap_v3_celo_trades - meta: - blockchain: celo - sector: dex - project: uniswap_v3 - contributors: jeff-dude, masquot, soispoke, tomfutago - config: - tags: ['celo','uniswap_v3','trades', 'uniswap','dex'] - description: > - Uniswap V3 contract trades on Celo - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - block_date - - blockchain - - project - - version - - tx_hash - - evt_index - - check_dex_seed: - blockchain: celo - project: uniswap - version: 3 - columns: - - &blockchain - name: blockchain - description: "Blockchain which the DEX is deployed" - - &project - name: project - description: "Project name of the DEX" - - &version - name: version - description: "Version of the contract built and deployed by the DEX project" - - &block_month - name: block_month - description: "UTC event block month of each DEX trade" - - &block_date - name: block_date - description: "UTC event block date of each DEX trade" - - &block_time - name: block_time - description: "UTC event block time of each DEX trade" - - &token_bought_symbol - name: token_bought_symbol - description: "Token symbol for token bought in the transaction" - - &token_sold_symbol - name: token_sold_symbol - description: "Token symbol for token sold in the transaction" - - &token_pair - name: token_pair - description: "Token symbol pair for each token involved in the transaction" - - &token_bought_amount - name: token_bought_amount - description: "Value of the token bought at time of execution in the original currency" - - &token_sold_amount - name: token_sold_amount - description: "Value of the token sold at time of execution in the original currency" - - &token_bought_amount_raw - name: token_bought_amount_raw - description: "Raw value of the token bought at time of execution in the original currency" - - &token_sold_amount_raw - name: token_sold_amount_raw - description: "Raw value of the token sold at time of execution in the original currency" - - &amount_usd - name: amount_usd - description: "USD value of the trade at time of execution" - - &token_bought_address - name: token_bought_address - description: "Contract address of the token bought" - - &token_sold_address - name: token_sold_address - description: "Contract address of the token sold" - - &taker - name: taker - description: "Address of trader who purchased a token" - - &maker - name: maker - description: "Address of trader who sold a token" - - &project_contract_address - name: project_contract_address - description: "Project contract address which executed the trade on the blockchain" - - &tx_hash - name: tx_hash - description: "Unique transaction hash value tied to each transaction on the DEX" - - &tx_from - name: tx_from - description: "Address which initiated the transaction" - - &tx_to - name: tx_to - description: "Address which received the transaction" - - &evt_index - name: evt_index - description: "" - - - name: uniswap_celo_trades - meta: - blockchain: celo - sector: dex - project: uniswap - contributors: jeff-dude, masquot, soispoke, tomfutago - config: - tags: ['celo','dex','trades', 'uniswap'] - description: > - Uniswap trades on Celo across all contracts and versions. This table will load dex trades downstream. - columns: - - *blockchain - - *project - - *version - - *block_month - - *block_date - - *block_time - - *token_bought_symbol - - *token_sold_symbol - - *token_pair - - *token_bought_amount - - *token_sold_amount - - *token_bought_amount_raw - - *token_sold_amount_raw - - *amount_usd - - *token_bought_address - - *token_sold_address - - *taker - - *maker - - *project_contract_address - - *tx_hash - - *tx_from - - *tx_to - - *evt_index - - - name: uniswap_celo_pools - meta: - blockchain: celo - sector: dex - contributors: hildobby, tomfutago - config: - tags: ['celo'] - description: > - Uniswap DEX pools - columns: - - *blockchain - - *project - - *version - - *block_month - - name: pool - description: "DEX pool smart contract address" - tests: - - unique - - name: fee - description: "Defined fee" - - name: token0 - description: "First token in pool" - - name: token1 - description: "Second token in pool" - - name: creation_block_time - description: "Block time of pool creation" - - name: creation_block_number - description: "Block number of pool creation" - - name: contract_address - description: "Contract address used to create the pool" - - - name: uniswap_v3_celo_flashloans - meta: - blockchain: celo - sector: lending - contributors: hildobby, tomfutago - config: - tags: ['celo', 'flashloans'] - description: > - All Uniswap v3 flashloans on Celo - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - blockchain - - tx_hash - - evt_index - columns: - - *blockchain - - *project - - *version - - *block_time - - name: block_number - - name: amount - - name: amount_usd - - *tx_hash - - *evt_index - - name: fee - - name: currency_contract - - name: currency_symbol - - name: recipient - - name: contract_address diff --git a/models/uniswap/celo/uniswap_celo_trades.sql b/models/uniswap/celo/uniswap_celo_trades.sql deleted file mode 100644 index d0421add4b7..00000000000 --- a/models/uniswap/celo/uniswap_celo_trades.sql +++ /dev/null @@ -1,45 +0,0 @@ -{{ config( - alias = 'trades' - , tags = ['prod_exclude'] - ) -}} - -{% set uniswap_models = [ -ref('uniswap_v3_celo_trades') -] %} - - -SELECT * -FROM ( - {% for dex_model in uniswap_models %} - SELECT - blockchain, - project, - version, - block_month, - block_date, - block_time, - token_bought_symbol, - token_sold_symbol, - token_pair, - token_bought_amount, - token_sold_amount, - token_bought_amount_raw, - token_sold_amount_raw, - amount_usd, - token_bought_address, - token_sold_address, - taker, - maker, - project_contract_address, - tx_hash, - tx_from, - tx_to, - - evt_index - FROM {{ dex_model }} - {% if not loop.last %} - UNION ALL - {% endif %} - {% endfor %} -) diff --git a/models/uniswap/celo/uniswap_v3_celo_trades.sql b/models/uniswap/celo/uniswap_v3_celo_trades.sql deleted file mode 100644 index ec605b2f080..00000000000 --- a/models/uniswap/celo/uniswap_v3_celo_trades.sql +++ /dev/null @@ -1,109 +0,0 @@ -{{ config( - schema = 'uniswap_v3_celo', - alias = 'trades', - tags = ['prod_exclude'], - partition_by = ['block_month'], - materialized = 'incremental', - file_format = 'delta', - incremental_strategy = 'merge', - unique_key = ['block_date', 'blockchain', 'project', 'version', 'tx_hash', 'evt_index'], - post_hook='{{ expose_spells(\'["celo"]\', - "project", - "uniswap_v3", - \'["jeff-dude", "markusbkoch", "masquot", "milkyklim", "0xBoxer", "mewwts", "hagaetc", "tomfutago"]\') }}' - ) -}} - -{% set project_start_date = '2022-07-07' %} - -WITH dexs AS -( - --Uniswap v3 - SELECT - t.evt_block_time AS block_time - ,t.recipient AS taker - ,CAST(NULL as VARBINARY) as maker - ,CASE WHEN amount0 < INT256 '0' THEN abs(amount0) ELSE abs(amount1) END AS token_bought_amount_raw -- when amount0 is negative it means trader_a is buying token0 from the pool - ,CASE WHEN amount0 < INT256 '0' THEN abs(amount1) ELSE abs(amount0) END AS token_sold_amount_raw - ,NULL AS amount_usd - ,CASE WHEN amount0 < INT256 '0' THEN f.token0 ELSE f.token1 END AS token_bought_address - ,CASE WHEN amount0 < INT256 '0' THEN f.token1 ELSE f.token0 END AS token_sold_address - ,t.contract_address as project_contract_address - ,t.evt_tx_hash AS tx_hash - ,t.evt_index - FROM - {{ source('uniswap_v3_celo', 'Pair_evt_Swap') }} t - INNER JOIN - {{ source('uniswap_v3_celo', 'UniswapV3Factory_evt_PoolCreated') }} f - ON f.pool = t.contract_address - {% if is_incremental() %} - WHERE t.evt_block_time >= date_trunc('day', now() - interval '7' day) - {% endif %} -) -SELECT DISTINCT - 'celo' AS blockchain - ,'uniswap' AS project - ,'3' AS version - ,CAST(date_trunc('month', dexs.block_time) AS date) AS block_month - ,CAST(date_trunc('DAY', dexs.block_time) AS date) AS block_date - ,dexs.block_time - ,erc20a.symbol AS token_bought_symbol - ,erc20b.symbol AS token_sold_symbol - ,case - when lower(erc20a.symbol) > lower(erc20b.symbol) then concat(erc20b.symbol, '-', erc20a.symbol) - else concat(erc20a.symbol, '-', erc20b.symbol) - end as token_pair - ,dexs.token_bought_amount_raw / power(10, erc20a.decimals) AS token_bought_amount - ,dexs.token_sold_amount_raw / power(10, erc20b.decimals) AS token_sold_amount - ,CAST(dexs.token_bought_amount_raw AS UINT256) AS token_bought_amount_raw - ,CAST(dexs.token_sold_amount_raw AS UINT256) AS token_sold_amount_raw - ,coalesce( - dexs.amount_usd - ,(dexs.token_bought_amount_raw / power(10, p_bought.decimals)) * p_bought.price - ,(dexs.token_sold_amount_raw / power(10, p_sold.decimals)) * p_sold.price - ) AS amount_usd - ,dexs.token_bought_address - ,dexs.token_sold_address - ,coalesce(dexs.taker, tx."from") AS taker -- subqueries rely on this COALESCE to avoid redundant joins with the transactions table - ,dexs.maker - ,dexs.project_contract_address - ,dexs.tx_hash - ,tx."from" AS tx_from - ,tx.to AS tx_to - ,dexs.evt_index -FROM dexs -INNER JOIN - {{ source('celo', 'transactions') }} tx - ON tx.hash = dexs.tx_hash - {% if not is_incremental() %} - AND tx.block_time >= TIMESTAMP '{{project_start_date}}' - {% endif %} - {% if is_incremental() %} - AND tx.block_time >= date_trunc('day', now() - interval '7' day) - {% endif %} -LEFT JOIN {{ source('tokens', 'erc20') }} erc20a - ON erc20a.contract_address = dexs.token_bought_address - AND erc20a.blockchain = 'celo' -LEFT JOIN {{ source('tokens', 'erc20') }} erc20b - ON erc20b.contract_address = dexs.token_sold_address - AND erc20b.blockchain = 'celo' -LEFT JOIN {{ source('prices', 'usd') }} p_bought - ON p_bought.minute = date_trunc('minute', dexs.block_time) - AND p_bought.contract_address = dexs.token_bought_address - AND p_bought.blockchain = 'celo' - {% if not is_incremental() %} - AND p_bought.minute >= TIMESTAMP '{{project_start_date}}' - {% endif %} - {% if is_incremental() %} - AND p_bought.minute >= date_trunc('day', now() - interval '7' day) - {% endif %} -LEFT JOIN {{ source('prices', 'usd') }} p_sold - ON p_sold.minute = date_trunc('minute', dexs.block_time) - AND p_sold.contract_address = dexs.token_sold_address - AND p_sold.blockchain = 'celo' - {% if not is_incremental() %} - AND p_sold.minute >= TIMESTAMP '{{project_start_date}}' - {% endif %} - {% if is_incremental() %} - AND p_sold.minute >= date_trunc('day', now() - interval '7' day) - {% endif %} diff --git a/models/uniswap/ethereum/uniswap_ethereum_schema.yml b/models/uniswap/ethereum/uniswap_ethereum_schema.yml deleted file mode 100644 index 8b8c07c7490..00000000000 --- a/models/uniswap/ethereum/uniswap_ethereum_schema.yml +++ /dev/null @@ -1,440 +0,0 @@ -version: 2 - -models: - - name: uniswap_v1_ethereum_trades - meta: - blockchain: ethereum - sector: dex - project: uniswap_v1 - contributors: jeff-dude, masquot, soispoke - config: - tags: ['ethereum','uniswap_v1','trades', 'uniswap','dex'] - description: > - Uniswap V1 contract trades on Ethereum - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - block_date - - blockchain - - project - - version - - tx_hash - - evt_index - - check_dex_seed: - blockchain: ethereum - project: uniswap - version: 1 - columns: - - &blockchain - name: blockchain - description: "Blockchain which the DEX is deployed" - - &project - name: project - description: "Project name of the DEX" - - &version - name: version - description: "Version of the contract built and deployed by the DEX project" - - &block_month - name: block_month - description: "UTC event block month of each DEX trade" - - &block_date - name: block_date - description: "UTC event block date of each DEX trade" - - &block_time - name: block_time - description: "UTC event block time of each DEX trade" - - &token_bought_symbol - name: token_bought_symbol - description: "Token symbol for token bought in the transaction" - - &token_sold_symbol - name: token_sold_symbol - description: "Token symbol for token sold in the transaction" - - &token_pair - name: token_pair - description: "Token symbol pair for each token involved in the transaction" - - &token_bought_amount - name: token_bought_amount - description: "Value of the token bought at time of execution in the original currency" - - &token_sold_amount - name: token_sold_amount - description: "Value of the token sold at time of execution in the original currency" - - &token_bought_amount_raw - name: token_bought_amount_raw - description: "Raw value of the token bought at time of execution in the original currency" - - &token_sold_amount_raw - name: token_sold_amount_raw - description: "Raw value of the token sold at time of execution in the original currency" - - &amount_usd - name: amount_usd - description: "USD value of the trade at time of execution" - - &token_bought_address - name: token_bought_address - description: "Contract address of the token bought" - - &token_sold_address - name: token_sold_address - description: "Contract address of the token sold" - - &taker - name: taker - description: "Address of trader who purchased a token" - - &maker - name: maker - description: "Address of trader who sold a token" - - &project_contract_address - name: project_contract_address - description: "Project contract address which executed the trade on the blockchain" - - &tx_hash - name: tx_hash - description: "Unique transaction hash value tied to each transaction on the DEX" - - &tx_from - name: tx_from - description: "Address which initiated the transaction" - - &tx_to - name: tx_to - description: "Address which received the transaction" - - &evt_index - name: evt_index - description: "" - - - name: uniswap_v2_ethereum_trades - meta: - blockchain: ethereum - sector: dex - project: uniswap_v2 - contributors: jeff-dude, masquot, soispoke - config: - tags: ['ethereum','uniswap_v2','trades', 'uniswap','dex'] - description: > - Uniswap V2 contract trades on Ethereum - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - block_date - - blockchain - - project - - version - - tx_hash - - evt_index - - check_dex_seed: - blockchain: ethereum - project: uniswap - version: 2 - columns: - - *blockchain - - *project - - *version - - *block_month - - *block_date - - *block_time - - *token_bought_symbol - - *token_sold_symbol - - *token_pair - - *token_bought_amount - - *token_sold_amount - - *token_bought_amount_raw - - *token_sold_amount_raw - - *amount_usd - - *token_bought_address - - *token_sold_address - - *taker - - *maker - - *project_contract_address - - *tx_hash - - *tx_from - - *tx_to - - *evt_index - - - name: uniswap_v3_ethereum_trades - meta: - blockchain: ethereum - sector: dex - project: uniswap_v3 - contributors: jeff-dude, masquot, soispoke - config: - tags: ['ethereum','uniswap_v3','trades', 'uniswap','dex'] - description: > - Uniswap V3 contract trades on Ethereum - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - block_date - - blockchain - - project - - version - - tx_hash - - evt_index - - check_dex_seed: - blockchain: ethereum - project: uniswap - version: 3 - columns: - - *blockchain - - *project - - *version - - *block_month - - *block_date - - *block_time - - *token_bought_symbol - - *token_sold_symbol - - *token_pair - - *token_bought_amount - - *token_sold_amount - - *token_bought_amount_raw - - *token_sold_amount_raw - - *amount_usd - - *token_bought_address - - *token_sold_address - - *taker - - *maker - - *project_contract_address - - *tx_hash - - *tx_from - - *tx_to - - *evt_index - - - name: uniswap_ethereum_trades - meta: - blockchain: ethereum - sector: dex - project: uniswap - contributors: jeff-dude, masquot, soispoke - config: - tags: ['ethereum','dex','trades', 'uniswap', 'jeff-dude'] - description: > - Uniswap trades on Ethereum across all contracts and versions. This table will load dex trades downstream. - columns: - - *blockchain - - *project - - *version - - *block_month - - *block_date - - *block_time - - *token_bought_symbol - - *token_sold_symbol - - *token_pair - - *token_bought_amount - - *token_sold_amount - - *token_bought_amount_raw - - *token_sold_amount_raw - - *amount_usd - - *token_bought_address - - *token_sold_address - - *taker - - *maker - - *project_contract_address - - *tx_hash - - *tx_from - - *tx_to - - *evt_index - - - name: uniswap_v3_ethereum_votes - meta: - blockchain: ethereum - sector: dao - contributors: soispoke - config: - tags: ['ethereum', 'votes', 'dao', 'cross-chain'] - description: > - DAO votes on all chains across all contracts and versions - columns: - - name: blockchain - - name: project - description: "Project name of the DAO" - - name: version - description: "Version of the contract built and deployed by the DAO project" - - name: block_time - description: "UTC event block time of each DAO vote" - - *block_month - - name: tx_hash - description: "Unique transaction hash value tied to each vote on the DAO" - - &dao_name - name: dao_name - description: "DAO name" - - &dao_address - name: dao_address - description: "DAO wallet address" - - &proposal_id - name: proposal_id - - &votes - name: votes - description: "Votes weighted by the amount of governance tokens" - - &votes_share - name: votes_share - description: "Votes share in percent for a given proposal" - - &token_symbol - name: token_symbol - - &token_address - name: token_address - - &votes_value_usd - name: votes_value_usd - description: "USD amount of governance tokens used at the time of the vote" - - &voter_address - name: voter_address - - &support - name: support - description: "0 = Against, 1 = For, 2 = Abstain votes" - tests: - - accepted_values: - values: ['for', 'against', 'abstain'] - - &reason - name: reason - description: "Optional onchain comments to explain votes" - - - name: uniswap_v3_ethereum_proposals - meta: - blockchain: ethereum - sector: dao - contributors: soispoke - config: - tags: ['ethereum', 'proposals', 'dao', 'cross-chain'] - description: > - DAO proposals on all chains across all contracts and versions - tests: - - check_seed: - seed_file: ref('uniswap_v3_proposals_seed') - match_columns: - - blockchain - - proposal_id - check_columns: - - status - columns: - - name: blockchain - - name: project - description: "Project name of the DAO" - - name: version - description: "Version of the contract built and deployed by the DAO project" - - name: created_at - description: "UTC event block time at which the proposal was created" - - name: tx_hash - description: "Unique transaction hash value tied to each DAO proposal" - - *dao_name - - *dao_address - - *block_month - - name: proposal_id - tests: - - unique - - &votes_for - name: votes_for - - &votes_against - name: votes_against - - &votes_total - name: votes_total - description: "Total number of governance tokens used to vote on a given DAO proposal" - - &number_of_voters - name: number_of_voters - - &participation - name: participation - description: "Participation in percent: Number of governance tokens used to vote / Total token supply" - - &status - name: status - description: "Proposal status: Queued, Active, Executed, Canceled or Defeated" - tests: - - accepted_values: - values: ['Queued', 'Active', 'Executed', 'Canceled','Defeated'] - - &description - name: description - description: "Description of the proposal" - - - name: uniswap_ethereum_airdrop_claims - meta: - blockchain: ethereum - sector: airdrop - project: uniswap - contributors: hildobby - config: - tags: ['table', 'airdrop', 'ethereum', 'claim', 'uniswap'] - description: "List of claim transactions for the $UNI airdrop" - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - tx_hash - - recipient - - evt_index - columns: - - *blockchain - - *block_time - - &block_number - name: block_number - description: "Block number of transaction" - - *project - - &airdrop_number - name: airdrop_number - description: "Airdrop identifier number" - - &recipient - name: recipient - description: "Airdrop recipient" - - &contract_address - name: contract_address - description: "Contract addressed used" - - *tx_hash - - name: amount_raw - description: "Raw amount of tokens" - - name: amount_original - description: "Original amount of tokens" - - name: amount_usd - description: "USD value of tokens" - - *token_address - - *token_symbol - - *evt_index - - - - name: uniswap_ethereum_pools - meta: - blockchain: ethereum - sector: dex - contributors: hildobby - config: - tags: ['ethereum'] - description: > - Uniswap DEX pools - columns: - - *blockchain - - *project - - *version - - name: pool - description: "DEX pool smart contract address" - tests: - - unique - - name: fee - description: "Defined fee" - - name: token0 - description: "First token in pool" - - name: token1 - description: "Second token in pool" - - name: creation_block_time - description: "Block time of pool creation" - - name: creation_block_number - description: "Block number of pool creation" - - name: contract_address - description: "Contract address used to create the pool" - - - name: uniswap_v3_ethereum_flashloans - meta: - blockchain: ethereum - sector: lending - contributors: hildobby - config: - tags: ['ethereum', 'flashloans'] - description: > - All Uniswap v3 flashloans on Ethereum - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - blockchain - - tx_hash - - evt_index - columns: - - name: blockchain - - name: project - - name: version - - name: block_time - - name: block_number - - name: amount - - name: amount_usd - - name: tx_hash - - name: evt_index - - name: fee - - name: currency_contract - - name: currency_symbol - - name: recipient - - name: contract_address - - name: block_month diff --git a/models/uniswap/ethereum/uniswap_ethereum_trades.sql b/models/uniswap/ethereum/uniswap_ethereum_trades.sql deleted file mode 100644 index 956d767aedc..00000000000 --- a/models/uniswap/ethereum/uniswap_ethereum_trades.sql +++ /dev/null @@ -1,47 +0,0 @@ -{{ config( - alias = 'trades' - , tags = ['prod_exclude'] - ) -}} - -{% set uniswap_models = [ -ref('uniswap_v1_ethereum_trades') -,ref('uniswap_v2_ethereum_trades') -,ref('uniswap_v3_ethereum_trades') -] %} - - -SELECT * -FROM ( - {% for dex_model in uniswap_models %} - SELECT - blockchain, - project, - version, - block_month, - block_date, - block_time, - token_bought_symbol, - token_sold_symbol, - token_pair, - token_bought_amount, - token_sold_amount, - token_bought_amount_raw, - token_sold_amount_raw, - amount_usd, - token_bought_address, - token_sold_address, - taker, - maker, - project_contract_address, - tx_hash, - tx_from, - tx_to, - evt_index - FROM {{ dex_model }} - {% if not loop.last %} - UNION ALL - {% endif %} - {% endfor %} -) - diff --git a/models/uniswap/ethereum/uniswap_v1_ethereum_trades.sql b/models/uniswap/ethereum/uniswap_v1_ethereum_trades.sql deleted file mode 100644 index fa79ab08f68..00000000000 --- a/models/uniswap/ethereum/uniswap_v1_ethereum_trades.sql +++ /dev/null @@ -1,134 +0,0 @@ -{{ config( - schema = 'uniswap_v1_ethereum', - alias = 'trades', - tags = ['prod_exclude'], - partition_by = ['block_month'], - materialized = 'incremental', - file_format = 'delta', - incremental_strategy = 'merge', - unique_key = ['block_date', 'blockchain', 'project', 'version', 'tx_hash', 'evt_index'], - post_hook='{{ expose_spells(\'["ethereum"]\', - "project", - "uniswap_v1", - \'["jeff-dude", "markusbkoch", "masquot", "milkyklim", "0xBoxer", "mewwts", "hagaetc"]\') }}' - ) -}} - -{% set project_start_date = '2018-11-01' %} -{% set weth_address = '0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2' %} - -WITH dexs AS -( - -- Uniswap v1 TokenPurchase - SELECT - t.evt_block_time AS block_time - ,t.buyer AS taker - ,CAST(NULL as VARBINARY) as maker - ,t.tokens_bought AS token_bought_amount_raw - ,t.eth_sold AS token_sold_amount_raw - ,NULL AS amount_usd - ,f.token AS token_bought_address - ,{{weth_address}} AS token_sold_address --Using WETH for easier joining with USD price table - ,t.contract_address AS project_contract_address - ,t.evt_tx_hash AS tx_hash - - ,t.evt_index - FROM - {{ source('uniswap_ethereum', 'Exchange_evt_TokenPurchase') }} t - INNER JOIN {{ source('uniswap_ethereum', 'Factory_evt_NewExchange') }} f - ON f.exchange = t.contract_address - {% if is_incremental() %} - WHERE t.evt_block_time >= date_trunc('day', now() - interval '7' day) - {% endif %} - - UNION ALL - - -- Uniswap v1 EthPurchase - SELECT - t.evt_block_time AS block_time - ,t.buyer AS taker - ,CAST(NULL as VARBINARY) as maker - ,t.eth_bought AS token_bought_amount_raw - ,t.tokens_sold AS token_sold_amount_raw - ,NULL AS amount_usd - ,{{weth_address}} AS token_bought_address --Using WETH for easier joining with USD price table - ,f.token AS token_sold_address - ,t.contract_address AS project_contract_address - ,t.evt_tx_hash AS tx_hash - - ,t.evt_index - FROM - {{ source('uniswap_ethereum', 'Exchange_evt_EthPurchase') }} t - INNER JOIN {{ source('uniswap_ethereum', 'Factory_evt_NewExchange') }} f - ON f.exchange = t.contract_address - {% if is_incremental() %} - WHERE t.evt_block_time >= date_trunc('day', now() - interval '7' day) - {% endif %} -) -SELECT - 'ethereum' AS blockchain - ,'uniswap' AS project - ,'1' AS version - ,CAST(date_trunc('month', dexs.block_time) AS date) AS block_month - ,CAST(date_trunc('DAY', dexs.block_time) AS date) AS block_date - ,dexs.block_time - ,erc20a.symbol AS token_bought_symbol - ,erc20b.symbol AS token_sold_symbol - ,case - when lower(erc20a.symbol) > lower(erc20b.symbol) then concat(erc20b.symbol, '-', erc20a.symbol) - else concat(erc20a.symbol, '-', erc20b.symbol) - end as token_pair - ,dexs.token_bought_amount_raw / power(10, erc20a.decimals) AS token_bought_amount - ,dexs.token_sold_amount_raw / power(10, erc20b.decimals) AS token_sold_amount - ,dexs.token_bought_amount_raw AS token_bought_amount_raw - ,dexs.token_sold_amount_raw AS token_sold_amount_raw - ,coalesce( - dexs.amount_usd - ,(dexs.token_bought_amount_raw / power(10, p_bought.decimals)) * p_bought.price - ,(dexs.token_sold_amount_raw / power(10, p_sold.decimals)) * p_sold.price - ) AS amount_usd - ,dexs.token_bought_address - ,dexs.token_sold_address - ,coalesce(dexs.taker, tx."from") AS taker -- subqueries rely on this COALESCE to avoid redundant joins with the transactions table - ,dexs.maker - ,dexs.project_contract_address - ,dexs.tx_hash - ,tx."from" AS tx_from - ,tx.to AS tx_to - - ,dexs.evt_index -FROM dexs -INNER JOIN {{ source('ethereum', 'transactions') }} tx - ON tx.hash = dexs.tx_hash - {% if not is_incremental() %} - AND tx.block_time >= TIMESTAMP '{{project_start_date}}' - {% endif %} - {% if is_incremental() %} - AND tx.block_time >= date_trunc('day', now() - interval '7' day) - {% endif %} -LEFT JOIN {{ source('tokens', 'erc20') }} erc20a - ON erc20a.contract_address = dexs.token_bought_address - AND erc20a.blockchain = 'ethereum' -LEFT JOIN {{ source('tokens', 'erc20') }} erc20b - ON erc20b.contract_address = dexs.token_sold_address - AND erc20b.blockchain = 'ethereum' -LEFT JOIN {{ source('prices', 'usd') }} p_bought - ON p_bought.minute = date_trunc('minute', dexs.block_time) - AND p_bought.contract_address = dexs.token_bought_address - AND p_bought.blockchain = 'ethereum' - {% if not is_incremental() %} - AND p_bought.minute >= TIMESTAMP '{{project_start_date}}' - {% endif %} - {% if is_incremental() %} - AND p_bought.minute >= date_trunc('day', now() - interval '7' day) - {% endif %} -LEFT JOIN {{ source('prices', 'usd') }} p_sold - ON p_sold.minute = date_trunc('minute', dexs.block_time) - AND p_sold.contract_address = dexs.token_sold_address - AND p_sold.blockchain = 'ethereum' - {% if not is_incremental() %} - AND p_sold.minute >= TIMESTAMP '{{project_start_date}}' - {% endif %} - {% if is_incremental() %} - AND p_sold.minute >= date_trunc('day', now() - interval '7' day) - {% endif %} diff --git a/models/uniswap/ethereum/uniswap_v2_ethereum_trades.sql b/models/uniswap/ethereum/uniswap_v2_ethereum_trades.sql deleted file mode 100644 index 0185107c796..00000000000 --- a/models/uniswap/ethereum/uniswap_v2_ethereum_trades.sql +++ /dev/null @@ -1,116 +0,0 @@ -{{ config( - schema = 'uniswap_v2_ethereum', - alias = 'trades', - tags = ['prod_exclude'], - partition_by = ['block_month'], - materialized = 'incremental', - file_format = 'delta', - incremental_strategy = 'merge', - unique_key = ['block_date', 'blockchain', 'project', 'version', 'tx_hash', 'evt_index'], - post_hook='{{ expose_spells(\'["ethereum"]\', - "project", - "uniswap_v2", - \'["jeff-dude", "markusbkoch", "masquot", "milkyklim", "0xBoxer", "mewwts", "hagaetc"]\') }}' - ) -}} - -{% set project_start_date = '2020-05-05' %} -{% set weth_ubomb_wash_trading_pair = "0xed9c854cb02de75ce4c9bba992828d6cb7fd5c71" %} -{% set weth_weth_wash_trading_pair = "0xf9c1fa7d41bf44ade1dd08d37cc68f67ae75bf92" %} -{% set feg_eth_wash_trading_pair = "0x854373387e41371ac6e307a1f29603c6fa10d872" %} - -WITH dexs AS -( - -- Uniswap v2 - SELECT - t.evt_block_time AS block_time - ,t.to AS taker - ,CAST(NULL as VARBINARY) as maker - ,CASE WHEN amount0Out = UINT256 '0' THEN amount1Out ELSE amount0Out END AS token_bought_amount_raw - ,CASE WHEN amount0In = UINT256 '0' OR amount1Out = UINT256 '0' THEN amount1In ELSE amount0In END AS token_sold_amount_raw - ,NULL AS amount_usd - ,CASE WHEN amount0Out = UINT256 '0' THEN f.token1 ELSE f.token0 END AS token_bought_address - ,CASE WHEN amount0In = UINT256 '0' OR amount1Out = UINT256 '0' THEN f.token1 ELSE f.token0 END AS token_sold_address - ,t.contract_address as project_contract_address - ,t.evt_tx_hash AS tx_hash - - ,t.evt_index - FROM - {{ source('uniswap_v2_ethereum', 'Pair_evt_Swap') }} t - INNER JOIN {{ source('uniswap_v2_ethereum', 'Factory_evt_PairCreated') }} f - ON f.pair = t.contract_address - WHERE t.contract_address NOT IN ( - {{weth_ubomb_wash_trading_pair}}, - {{weth_weth_wash_trading_pair}}, - {{feg_eth_wash_trading_pair}}) - {% if is_incremental() %} - AND t.evt_block_time >= date_trunc('day', now() - interval '7' day) - {% endif %} -) -SELECT - 'ethereum' AS blockchain - ,'uniswap' AS project - ,'2' AS version - ,CAST(date_trunc('month', dexs.block_time) AS date) AS block_month - ,CAST(date_trunc('DAY', dexs.block_time) AS date) AS block_date - ,dexs.block_time - ,erc20a.symbol AS token_bought_symbol - ,erc20b.symbol AS token_sold_symbol - ,case - when lower(erc20a.symbol) > lower(erc20b.symbol) then concat(erc20b.symbol, '-', erc20a.symbol) - else concat(erc20a.symbol, '-', erc20b.symbol) - end as token_pair - ,dexs.token_bought_amount_raw / power(10, erc20a.decimals) AS token_bought_amount - ,dexs.token_sold_amount_raw / power(10, erc20b.decimals) AS token_sold_amount - ,dexs.token_bought_amount_raw AS token_bought_amount_raw - ,dexs.token_sold_amount_raw AS token_sold_amount_raw - ,coalesce( - dexs.amount_usd - ,(dexs.token_bought_amount_raw / power(10, p_bought.decimals)) * p_bought.price - ,(dexs.token_sold_amount_raw / power(10, p_sold.decimals)) * p_sold.price - ) AS amount_usd - ,dexs.token_bought_address - ,dexs.token_sold_address - ,coalesce(dexs.taker, tx."from") AS taker -- subqueries rely on this COALESCE to avoid redundant joins with the transactions table - ,dexs.maker - ,dexs.project_contract_address - ,dexs.tx_hash - ,tx."from" AS tx_from - ,tx.to AS tx_to - - ,dexs.evt_index -FROM dexs -INNER JOIN {{ source('ethereum', 'transactions') }} tx - ON tx.hash = dexs.tx_hash - {% if not is_incremental() %} - AND tx.block_time >= TIMESTAMP '{{project_start_date}}' - {% endif %} - {% if is_incremental() %} - AND tx.block_time >= date_trunc('day', now() - interval '7' day) - {% endif %} -LEFT JOIN {{ source('tokens', 'erc20') }} erc20a - ON erc20a.contract_address = dexs.token_bought_address - AND erc20a.blockchain = 'ethereum' -LEFT JOIN {{ source('tokens', 'erc20') }} erc20b - ON erc20b.contract_address = dexs.token_sold_address - AND erc20b.blockchain = 'ethereum' -LEFT JOIN {{ source('prices', 'usd') }} p_bought - ON p_bought.minute = date_trunc('minute', dexs.block_time) - AND p_bought.contract_address = dexs.token_bought_address - AND p_bought.blockchain = 'ethereum' - {% if not is_incremental() %} - AND p_bought.minute >= TIMESTAMP '{{project_start_date}}' - {% endif %} - {% if is_incremental() %} - AND p_bought.minute >= date_trunc('day', now() - interval '7' day) - {% endif %} -LEFT JOIN {{ source('prices', 'usd') }} p_sold - ON p_sold.minute = date_trunc('minute', dexs.block_time) - AND p_sold.contract_address = dexs.token_sold_address - AND p_sold.blockchain = 'ethereum' - {% if not is_incremental() %} - AND p_sold.minute >= TIMESTAMP '{{project_start_date}}' - {% endif %} - {% if is_incremental() %} - AND p_sold.minute >= date_trunc('day', now() - interval '7' day) - {% endif %} diff --git a/models/uniswap/ethereum/uniswap_v3_ethereum_trades.sql b/models/uniswap/ethereum/uniswap_v3_ethereum_trades.sql deleted file mode 100644 index d8ebe425c2e..00000000000 --- a/models/uniswap/ethereum/uniswap_v3_ethereum_trades.sql +++ /dev/null @@ -1,111 +0,0 @@ -{{ config( - schema = 'uniswap_v3_ethereum', - alias = 'trades', - tags = ['prod_exclude'], - partition_by = ['block_month'], - materialized = 'incremental', - file_format = 'delta', - incremental_strategy = 'merge', - unique_key = ['block_date', 'blockchain', 'project', 'version', 'tx_hash', 'evt_index'], - post_hook='{{ expose_spells(\'["ethereum"]\', - "project", - "uniswap_v3", - \'["jeff-dude", "markusbkoch", "masquot", "milkyklim", "0xBoxer", "mewwts", "hagaetc"]\') }}' - ) -}} - -{% set project_start_date = '2021-05-04' %} - -WITH dexs AS -( - --Uniswap v3 - SELECT - t.evt_block_time AS block_time - ,t.recipient AS taker - ,CAST(NULL as VARBINARY) as maker - ,CASE WHEN amount0 < INT256 '0' THEN abs(amount0) ELSE abs(amount1) END AS token_bought_amount_raw -- when amount0 is negative it means trader_a is buying token0 from the pool - ,CASE WHEN amount0 < INT256 '0' THEN abs(amount1) ELSE abs(amount0) END AS token_sold_amount_raw - ,NULL AS amount_usd - ,CASE WHEN amount0 < INT256 '0' THEN f.token0 ELSE f.token1 END AS token_bought_address - ,CASE WHEN amount0 < INT256 '0' THEN f.token1 ELSE f.token0 END AS token_sold_address - ,t.contract_address as project_contract_address - ,f.fee - ,t.evt_tx_hash AS tx_hash - - ,t.evt_index - FROM - {{ source('uniswap_v3_ethereum', 'Pair_evt_Swap') }} t - INNER JOIN {{ source('uniswap_v3_ethereum', 'Factory_evt_PoolCreated') }} f - ON f.pool = t.contract_address - {% if is_incremental() %} - WHERE t.evt_block_time >= date_trunc('day', now() - interval '7' day) - {% endif %} -) -SELECT - 'ethereum' AS blockchain - ,'uniswap' AS project - ,'3' AS version - ,CAST(date_trunc('month', dexs.block_time) AS date) AS block_month - ,CAST(date_trunc('DAY', dexs.block_time) AS date) AS block_date - ,dexs.block_time - ,erc20a.symbol AS token_bought_symbol - ,erc20b.symbol AS token_sold_symbol - ,case - when lower(erc20a.symbol) > lower(erc20b.symbol) then concat(erc20b.symbol, '-', erc20a.symbol) - else concat(erc20a.symbol, '-', erc20b.symbol) - end as token_pair - ,dexs.token_bought_amount_raw / power(10, erc20a.decimals) AS token_bought_amount - ,dexs.token_sold_amount_raw / power(10, erc20b.decimals) AS token_sold_amount - ,CAST(dexs.token_bought_amount_raw AS UINT256) AS token_bought_amount_raw - ,CAST(dexs.token_sold_amount_raw AS UINT256) AS token_sold_amount_raw - ,coalesce( - dexs.amount_usd - ,(dexs.token_bought_amount_raw / power(10, p_bought.decimals)) * p_bought.price - ,(dexs.token_sold_amount_raw / power(10, p_sold.decimals)) * p_sold.price - ) AS amount_usd - ,dexs.token_bought_address - ,dexs.token_sold_address - ,coalesce(dexs.taker, tx."from") AS taker -- subqueries rely on this COALESCE to avoid redundant joins with the transactions table - ,dexs.maker - ,dexs.project_contract_address - ,dexs.fee - ,dexs.tx_hash - ,tx."from" AS tx_from - ,tx.to AS tx_to - - ,dexs.evt_index -FROM dexs -INNER JOIN {{ source('ethereum', 'transactions') }} tx - ON tx.hash = dexs.tx_hash - {% if not is_incremental() %} - AND tx.block_time >= TIMESTAMP '{{project_start_date}}' - {% endif %} - {% if is_incremental() %} - AND tx.block_time >= date_trunc('day', now() - interval '7' day) - {% endif %} -LEFT JOIN {{ source('tokens', 'erc20') }} erc20a - ON erc20a.contract_address = dexs.token_bought_address - AND erc20a.blockchain = 'ethereum' -LEFT JOIN {{ source('tokens', 'erc20') }} erc20b - ON erc20b.contract_address = dexs.token_sold_address - AND erc20b.blockchain = 'ethereum' -LEFT JOIN {{ source('prices', 'usd') }} p_bought - ON p_bought.minute = date_trunc('minute', dexs.block_time) - AND p_bought.contract_address = dexs.token_bought_address - AND p_bought.blockchain = 'ethereum' - {% if not is_incremental() %} - AND p_bought.minute >= TIMESTAMP '{{project_start_date}}' - {% endif %} - {% if is_incremental() %} - AND p_bought.minute >= date_trunc('day', now() - interval '7' day) - {% endif %} -LEFT JOIN {{ source('prices', 'usd') }} p_sold - ON p_sold.minute = date_trunc('minute', dexs.block_time) - AND p_sold.contract_address = dexs.token_sold_address - AND p_sold.blockchain = 'ethereum' - {% if not is_incremental() %} - AND p_sold.minute >= TIMESTAMP '{{project_start_date}}' - {% endif %} - {% if is_incremental() %} - AND p_sold.minute >= date_trunc('day', now() - interval '7' day) - {% endif %} diff --git a/models/uniswap/optimism/uniswap_optimism_schema.yml b/models/uniswap/optimism/uniswap_optimism_schema.yml deleted file mode 100644 index 8ec566eec5b..00000000000 --- a/models/uniswap/optimism/uniswap_optimism_schema.yml +++ /dev/null @@ -1,222 +0,0 @@ -version: 2 - -models: - - name: uniswap_optimism_pools - meta: - blockchain: optimism - project: uniswap - contributors: msilb7, chuxin, mtitus6 - config: - tags: ['optimism','uniswap','pools'] - description: > - A canonical table containing all Uniswap pools created on Optimism. Pools from OVM1 will be missing from factory_evt_poolcreated, so we use this table to get pool information. - columns: - - &blockchain - name: blockchain - description: "Blockchain which the DEX is deployed" - - &project - name: project - description: "Project name of the DEX" - - &version - name: version - description: "Version of the contract built and deployed by the DEX project" - - &pool - name: pool - description: "Uniswap liquidity pool contract address" - tests: - - unique - - &token0 - name: token0 - description: "Token0 contract address" - - &token1 - name: token1 - description: "Token1 contract address" - - &fee - name: fee - description: "Swap fee of a Uniswap liquidity pool. Divide by 1e6 or power(10,6) to get the fee percentage" - - &creation_block_time - name: creation_block_time - description: "Block time of pool creation" - - &creation_block_number - name: creation_block_number - description: "Block number of pool creation" - - &contract_address - name: contract_address - description: "Contract address used to create the pool" - - - name: uniswap_optimism_ovm1_pool_mapping - meta: - blockchain: optimism - project: uniswap - contributors: msilb7, chuxin - config: - tags: ['optimism','uniswap','pools'] - description: > - A canonical table containing all Uniswap pool address changes between OVM1 and the EVM Equivalence regenesis release. - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - oldAddress - - newAddress - columns: - - &oldAddress - name: oldAddress - description: "Uniswap liquidity pool contract address in OVM1" - - &newAddress - name: newAddress - description: "Uniswap liquidity pool contract address in the EVM Equivalence regenesis release." - - *token0 - - *token1 - - *fee - - - name: uniswap_v3_optimism_trades - meta: - blockchain: optimism - project: uniswap - contributors: 0xBoxer, jeff-dude - config: - tags: ['optimism','uniswap','dex'] - description: > - A table containing all trades of uniswap v3 on optimism - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - block_date - - blockchain - - project - - version - - tx_hash - - evt_index - - check_dex_seed: - blockchain: optimism - project: uniswap - version: 3 - columns: - - *blockchain - - *project - - *version - - &block_month - name: block_month - description: "UTC event block month of each DEX trade" - - &block_date - name: block_date - description: "UTC event block date of each DEX trade" - - &block_time - name: block_time - description: "UTC event block time of each DEX trade" - - &token_bought_symbol - name: token_bought_symbol - description: "Token symbol for token bought in the transaction" - - &token_sold_symbol - name: token_sold_symbol - description: "Token symbol for token sold in the transaction" - - &token_pair - name: token_pair - description: "Token symbol pair for each token involved in the transaction" - - &token_bought_amount - name: token_bought_amount - description: "Value of the token bought at time of execution in the original currency" - - &token_sold_amount - name: token_sold_amount - description: "Value of the token sold at time of execution in the original currency" - - &token_bought_amount_raw - name: token_bought_amount_raw - description: "Raw value of the token bought at time of execution in the original currency" - - &token_sold_amount_raw - name: token_sold_amount_raw - description: "Raw value of the token sold at time of execution in the original currency" - - &amount_usd - name: amount_usd - description: "USD value of the trade at time of execution" - - &token_bought_address - name: token_bought_address - description: "Contract address of the token bought" - - &token_sold_address - name: token_sold_address - description: "Contract address of the token sold" - - &taker - name: taker - description: "Address of trader who purchased a token" - - &maker - name: maker - description: "Address of trader who sold a token" - - &project_contract_address - name: project_contract_address - description: "Project contract address which executed the trade on the blockchain" - - &tx_hash - name: tx_hash - description: "Unique transaction hash value tied to each transaction on the DEX" - - &tx_from - name: tx_from - description: "Address which initiated the transaction" - - &tx_to - name: tx_to - description: "Address which received the transaction" - - &evt_index - name: evt_index - description: "" - - name: uniswap_optimism_trades - meta: - blockchain: optimism - project: uniswap - contributors: 0xBoxer, jeff-dude - config: - tags: ['optimism','uniswap','dex.trades'] - description: > - A table containing all trades of uniswap on optimism. future proof for more protocol version on this chain - columns: - - *blockchain - - *project - - *version - - *block_month - - *block_date - - *block_time - - *token_bought_symbol - - *token_sold_symbol - - *token_pair - - *token_bought_amount - - *token_sold_amount - - *token_bought_amount_raw - - *token_sold_amount_raw - - *amount_usd - - *token_bought_address - - *token_sold_address - - *taker - - *maker - - *project_contract_address - - *tx_hash - - *tx_from - - *tx_to - - *evt_index - - - name: uniswap_v3_optimism_flashloans - meta: - blockchain: optimism - sector: lending - contributors: hildobby - config: - tags: ['optimism', 'flashloans'] - description: > - All Uniswap v3 flashloans on Optimism - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - blockchain - - tx_hash - - evt_index - columns: - - name: blockchain - - name: project - - name: version - - name: block_time - - name: block_number - - name: amount - - name: amount_usd - - name: tx_hash - - name: evt_index - - name: fee - - name: currency_contract - - name: currency_symbol - - name: recipient - - name: contract_address - - name: block_month diff --git a/models/uniswap/optimism/uniswap_optimism_trades.sql b/models/uniswap/optimism/uniswap_optimism_trades.sql deleted file mode 100644 index 5672d94c4b3..00000000000 --- a/models/uniswap/optimism/uniswap_optimism_trades.sql +++ /dev/null @@ -1,45 +0,0 @@ -{{ config( - alias = 'trades' - , tags = ['prod_exclude'] - ) -}} - -{% set uniswap_models = [ -ref('uniswap_v3_optimism_trades') -] %} - - -SELECT * -FROM ( - {% for dex_model in uniswap_models %} - SELECT - blockchain, - project, - version, - block_month, - block_date, - block_time, - token_bought_symbol, - token_sold_symbol, - token_pair, - token_bought_amount, - token_sold_amount, - token_bought_amount_raw, - token_sold_amount_raw, - amount_usd, - token_bought_address, - token_sold_address, - taker, - maker, - project_contract_address, - tx_hash, - tx_from, - tx_to, - - evt_index - FROM {{ dex_model }} - {% if not loop.last %} - UNION ALL - {% endif %} - {% endfor %} -) \ No newline at end of file diff --git a/models/uniswap/optimism/uniswap_v3_optimism_trades.sql b/models/uniswap/optimism/uniswap_v3_optimism_trades.sql deleted file mode 100644 index ef530f792c7..00000000000 --- a/models/uniswap/optimism/uniswap_v3_optimism_trades.sql +++ /dev/null @@ -1,111 +0,0 @@ -{{ config( - schema = 'uniswap_v3_optimism', - alias = 'trades', - tags = ['prod_exclude'], - partition_by = ['block_month'], - materialized = 'incremental', - file_format = 'delta', - incremental_strategy = 'merge', - unique_key = ['block_date', 'blockchain', 'project', 'version', 'tx_hash', 'evt_index'], - post_hook='{{ expose_spells(\'["optimism"]\', - "project", - "uniswap_v3", - \'["jeff-dude", "markusbkoch", "masquot", "milkyklim", "0xBoxer", "mewwts", "hagaetc"]\') }}' - ) -}} --- OVM 1 Launch 06-23-21 -{% set project_start_date = '2021-06-23' %} - -WITH dexs AS -( - --Uniswap v3 - SELECT - t.evt_block_time AS block_time - , t.evt_block_number - , t.recipient AS taker - ,CAST(NULL as VARBINARY) as maker - ,CASE WHEN amount0 < INT256 '0' THEN abs(amount0) ELSE abs(amount1) END AS token_bought_amount_raw -- when amount0 is negative it means trader_a is buying token0 from the pool - ,CASE WHEN amount0 < INT256 '0' THEN abs(amount1) ELSE abs(amount0) END AS token_sold_amount_raw - ,NULL AS amount_usd - ,CASE WHEN amount0 < INT256 '0' THEN f.token0 ELSE f.token1 END AS token_bought_address - ,CASE WHEN amount0 < INT256 '0' THEN f.token1 ELSE f.token0 END AS token_sold_address - ,t.contract_address as project_contract_address - ,t.evt_tx_hash AS tx_hash - - ,t.evt_index - FROM - {{ source('uniswap_v3_optimism', 'Pair_evt_Swap') }} t - INNER JOIN {{ ref('uniswap_optimism_pools') }} f - ON f.pool = t.contract_address - {% if is_incremental() %} - WHERE t.evt_block_time >= date_trunc('day', now() - interval '7' day) - {% endif %} -) -SELECT - 'optimism' AS blockchain - ,'uniswap' AS project - ,'3' AS version - ,CAST(date_trunc('month', dexs.block_time) AS date) AS block_month - ,CAST(date_trunc('DAY', dexs.block_time) AS date) AS block_date - ,dexs.block_time - ,erc20a.symbol AS token_bought_symbol - ,erc20b.symbol AS token_sold_symbol - ,case - when lower(erc20a.symbol) > lower(erc20b.symbol) then concat(erc20b.symbol, '-', erc20a.symbol) - else concat(erc20a.symbol, '-', erc20b.symbol) - end as token_pair - ,dexs.token_bought_amount_raw / power(10, erc20a.decimals) AS token_bought_amount - ,dexs.token_sold_amount_raw / power(10, erc20b.decimals) AS token_sold_amount - ,CAST(dexs.token_bought_amount_raw AS UINT256) AS token_bought_amount_raw - ,CAST(dexs.token_sold_amount_raw AS UINT256) AS token_sold_amount_raw - ,coalesce( - dexs.amount_usd - ,(dexs.token_bought_amount_raw / power(10, p_bought.decimals)) * p_bought.price - ,(dexs.token_sold_amount_raw / power(10, p_sold.decimals)) * p_sold.price - ) AS amount_usd - ,dexs.token_bought_address - ,dexs.token_sold_address - ,coalesce(dexs.taker, tx."from") AS taker -- subqueries rely on this COALESCE to avoid redundant joins with the transactions table - ,dexs.maker - ,dexs.project_contract_address - ,dexs.tx_hash - ,tx."from" AS tx_from - ,tx.to AS tx_to - - ,dexs.evt_index -FROM dexs -INNER JOIN {{ source('optimism', 'transactions') }} tx - ON tx.hash = dexs.tx_hash - AND tx.block_number = dexs.evt_block_number - {% if not is_incremental() %} - AND tx.block_time >= TIMESTAMP '{{project_start_date}}' - {% endif %} - {% if is_incremental() %} - AND tx.block_time >= date_trunc('day', now() - interval '7' day) - {% endif %} -LEFT JOIN {{ source('tokens', 'erc20') }} erc20a - ON erc20a.contract_address = dexs.token_bought_address - AND erc20a.blockchain = 'optimism' -LEFT JOIN {{ source('tokens', 'erc20') }} erc20b - ON erc20b.contract_address = dexs.token_sold_address - AND erc20b.blockchain = 'optimism' -LEFT JOIN {{ source('prices', 'usd') }} p_bought - ON p_bought.minute = date_trunc('minute', dexs.block_time) - AND p_bought.contract_address = dexs.token_bought_address - AND p_bought.blockchain = 'optimism' - {% if not is_incremental() %} - AND p_bought.minute >= TIMESTAMP '{{project_start_date}}' - {% endif %} - {% if is_incremental() %} - AND p_bought.minute >= date_trunc('day', now() - interval '7' day) - {% endif %} -LEFT JOIN {{ source('prices', 'usd') }} p_sold - ON p_sold.minute = date_trunc('minute', dexs.block_time) - AND p_sold.contract_address = dexs.token_sold_address - AND p_sold.blockchain = 'optimism' - {% if not is_incremental() %} - AND p_sold.minute >= TIMESTAMP '{{project_start_date}}' - {% endif %} - {% if is_incremental() %} - AND p_sold.minute >= date_trunc('day', now() - interval '7' day) - {% endif %} \ No newline at end of file diff --git a/models/uniswap/polygon/uniswap_polygon_schema.yml b/models/uniswap/polygon/uniswap_polygon_schema.yml deleted file mode 100644 index cea488380f0..00000000000 --- a/models/uniswap/polygon/uniswap_polygon_schema.yml +++ /dev/null @@ -1,193 +0,0 @@ -version: 2 - -models: - - name: uniswap_v3_polygon_trades - meta: - blockchain: polygon - sector: dex - project: uniswap_v3 - contributors: Henrystats - config: - tags: ['polygon','uniswap_v3','trades', 'uniswap','dex'] - description: > - Uniswap V3 contract trades on polygon - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - block_date - - blockchain - - project - - version - - tx_hash - - evt_index - - check_dex_seed: - blockchain: polygon - project: uniswap - version: 3 - columns: - - &blockchain - name: blockchain - description: "Blockchain which the DEX is deployed" - - &project - name: project - description: "Project name of the DEX" - - &version - name: version - description: "Version of the contract built and deployed by the DEX project" - - &block_month - name: block_month - description: "UTC event block month of each DEX trade" - - &block_date - name: block_date - description: "UTC event block date of each DEX trade" - - &block_time - name: block_time - description: "UTC event block time of each DEX trade" - - &token_bought_symbol - name: token_bought_symbol - description: "Token symbol for token bought in the transaction" - - &token_sold_symbol - name: token_sold_symbol - description: "Token symbol for token sold in the transaction" - - &token_pair - name: token_pair - description: "Token symbol pair for each token involved in the transaction" - - &token_bought_amount - name: token_bought_amount - description: "Value of the token bought at time of execution in the original currency" - - &token_sold_amount - name: token_sold_amount - description: "Value of the token sold at time of execution in the original currency" - - &token_bought_amount_raw - name: token_bought_amount_raw - description: "Raw value of the token bought at time of execution in the original currency" - - &token_sold_amount_raw - name: token_sold_amount_raw - description: "Raw value of the token sold at time of execution in the original currency" - - &amount_usd - name: amount_usd - description: "USD value of the trade at time of execution" - - &token_bought_address - name: token_bought_address - description: "Contract address of the token bought" - - &token_sold_address - name: token_sold_address - description: "Contract address of the token sold" - - &taker - name: taker - description: "Address of trader who purchased a token" - - &maker - name: maker - description: "Address of trader who sold a token" - - &project_contract_address - name: project_contract_address - description: "Project contract address which executed the trade on the blockchain" - - &tx_hash - name: tx_hash - description: "Unique transaction hash value tied to each transaction on the DEX" - - &tx_from - name: tx_from - description: "Address which initiated the transaction" - - &tx_to - name: tx_to - description: "Address which received the transaction" - - &evt_index - name: evt_index - description: "" - - - name: uniswap_polygon_trades - meta: - blockchain: polygon - sector: dex - project: uniswap - contributors: henrystats - config: - tags: ['polygon','dex','trades', 'uniswap'] - description: > - Uniswap trades on Polygon across all contracts and versions. This table will load dex trades downstream. - columns: - - *blockchain - - *project - - *version - - *block_month - - *block_date - - *block_time - - *token_bought_symbol - - *token_sold_symbol - - *token_pair - - *token_bought_amount - - *token_sold_amount - - *token_bought_amount_raw - - *token_sold_amount_raw - - *amount_usd - - *token_bought_address - - *token_sold_address - - *taker - - *maker - - *project_contract_address - - *tx_hash - - *tx_from - - *tx_to - - *evt_index - - - name: uniswap_polygon_pools - meta: - blockchain: polygon - sector: dex - contributors: hildobby - config: - tags: ['polygon'] - description: > - Uniswap DEX pools - columns: - - *blockchain - - *project - - *version - - name: pool - description: "DEX pool smart contract address" - tests: - - unique - - name: fee - description: "Defined fee" - - name: token0 - description: "First token in pool" - - name: token1 - description: "Second token in pool" - - name: creation_block_time - description: "Block time of pool creation" - - name: creation_block_number - description: "Block number of pool creation" - - name: contract_address - description: "Contract address used to create the pool" - - - name: uniswap_v3_polygon_flashloans - meta: - blockchain: polygon - sector: lending - contributors: hildobby - config: - tags: ['polygon', 'flashloans'] - description: > - All Uniswap v3 flashloans on Polygon - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - blockchain - - tx_hash - - evt_index - columns: - - name: blockchain - - name: project - - name: version - - name: block_time - - name: block_number - - name: amount - - name: amount_usd - - name: tx_hash - - name: evt_index - - name: fee - - name: currency_contract - - name: currency_symbol - - name: recipient - - name: contract_address - - name: block_month diff --git a/models/uniswap/polygon/uniswap_polygon_trades.sql b/models/uniswap/polygon/uniswap_polygon_trades.sql deleted file mode 100644 index c8aae59f359..00000000000 --- a/models/uniswap/polygon/uniswap_polygon_trades.sql +++ /dev/null @@ -1,45 +0,0 @@ -{{ config( - alias = 'trades' - , tags = ['prod_exclude'] - ) -}} - -{% set uniswap_polygon_models = [ -ref('uniswap_v3_polygon_trades') -] %} - - -SELECT * -FROM ( - {% for dex_model in uniswap_polygon_models %} - SELECT - blockchain, - project, - version, - block_month, - block_date, - block_time, - token_bought_symbol, - token_sold_symbol, - token_pair, - token_bought_amount, - token_sold_amount, - token_bought_amount_raw, - token_sold_amount_raw, - amount_usd, - token_bought_address, - token_sold_address, - taker, - maker, - project_contract_address, - tx_hash, - tx_from, - tx_to, - - evt_index - FROM {{ dex_model }} - {% if not loop.last %} - UNION ALL - {% endif %} - {% endfor %} -) \ No newline at end of file diff --git a/models/uniswap/polygon/uniswap_v3_polygon_trades.sql b/models/uniswap/polygon/uniswap_v3_polygon_trades.sql deleted file mode 100644 index deb55266b4f..00000000000 --- a/models/uniswap/polygon/uniswap_v3_polygon_trades.sql +++ /dev/null @@ -1,111 +0,0 @@ -{{ config( - schema = 'uniswap_v3_polygon', - alias = 'trades', - tags = ['prod_exclude'], - partition_by = ['block_month'], - materialized = 'incremental', - file_format = 'delta', - incremental_strategy = 'merge', - unique_key = ['block_date', 'blockchain', 'project', 'version', 'tx_hash', 'evt_index'], - post_hook='{{ expose_spells(\'["polygon"]\', - "project", - "uniswap_v3", - \'["Henrystats"]\') }}' - ) -}} - -{% set project_start_date = '2021-12-20' %} - -WITH dexs AS -( - --Uniswap v3 - SELECT - t.evt_block_time AS block_time - ,t.recipient AS taker - ,CAST(NULL as VARBINARY) as maker - ,CASE WHEN amount0 < INT256 '0' THEN abs(amount0) ELSE abs(amount1) END AS token_bought_amount_raw -- when amount0 is negative it means trader_a is buying token0 from the pool - ,CASE WHEN amount0 < INT256 '0' THEN abs(amount1) ELSE abs(amount0) END AS token_sold_amount_raw - ,NULL AS amount_usd - ,CASE WHEN amount0 < INT256 '0' THEN f.token0 ELSE f.token1 END AS token_bought_address - ,CASE WHEN amount0 < INT256 '0' THEN f.token1 ELSE f.token0 END AS token_sold_address - ,t.contract_address as project_contract_address - ,t.evt_tx_hash AS tx_hash - - ,t.evt_index - FROM - {{ source('uniswap_v3_polygon', 'UniswapV3Pool_evt_Swap') }} t - INNER JOIN - {{ source('uniswap_v3_polygon', 'Factory_evt_PoolCreated') }} f - ON f.pool = t.contract_address - {% if is_incremental() %} - WHERE t.evt_block_time >= date_trunc('day', now() - interval '7' day) - {% endif %} -) -SELECT - 'polygon' AS blockchain - ,'uniswap' AS project - ,'3' AS version - ,CAST(date_trunc('month', dexs.block_time) AS date) AS block_month - ,CAST(date_trunc('DAY', dexs.block_time) AS date) AS block_date - ,dexs.block_time - ,erc20a.symbol AS token_bought_symbol - ,erc20b.symbol AS token_sold_symbol - ,case - when lower(erc20a.symbol) > lower(erc20b.symbol) then concat(erc20b.symbol, '-', erc20a.symbol) - else concat(erc20a.symbol, '-', erc20b.symbol) - end as token_pair - ,dexs.token_bought_amount_raw / power(10, erc20a.decimals) AS token_bought_amount - ,dexs.token_sold_amount_raw / power(10, erc20b.decimals) AS token_sold_amount - ,CAST(dexs.token_bought_amount_raw AS UINT256) AS token_bought_amount_raw - ,CAST(dexs.token_sold_amount_raw AS UINT256) AS token_sold_amount_raw - ,coalesce( - dexs.amount_usd - ,(dexs.token_bought_amount_raw / power(10, p_bought.decimals)) * p_bought.price - ,(dexs.token_sold_amount_raw / power(10, p_sold.decimals)) * p_sold.price - ) AS amount_usd - ,dexs.token_bought_address - ,dexs.token_sold_address - ,coalesce(dexs.taker, tx."from") AS taker -- subqueries rely on this COALESCE to avoid redundant joins with the transactions table - ,dexs.maker - ,dexs.project_contract_address - ,dexs.tx_hash - ,tx."from" AS tx_from - ,tx.to AS tx_to - - ,dexs.evt_index -FROM dexs -INNER JOIN - {{ source('polygon', 'transactions') }} tx - ON tx.hash = dexs.tx_hash - {% if not is_incremental() %} - AND tx.block_time >= TIMESTAMP '{{project_start_date}}' - {% endif %} - {% if is_incremental() %} - AND tx.block_time >= date_trunc('day', now() - interval '7' day) - {% endif %} -LEFT JOIN {{ source('tokens', 'erc20') }} erc20a - ON erc20a.contract_address = dexs.token_bought_address - AND erc20a.blockchain = 'polygon' -LEFT JOIN {{ source('tokens', 'erc20') }} erc20b - ON erc20b.contract_address = dexs.token_sold_address - AND erc20b.blockchain = 'polygon' -LEFT JOIN {{ source('prices', 'usd') }} p_bought - ON p_bought.minute = date_trunc('minute', dexs.block_time) - AND p_bought.contract_address = dexs.token_bought_address - AND p_bought.blockchain = 'polygon' - {% if not is_incremental() %} - AND p_bought.minute >= TIMESTAMP '{{project_start_date}}' - {% endif %} - {% if is_incremental() %} - AND p_bought.minute >= date_trunc('day', now() - interval '7' day) - {% endif %} -LEFT JOIN {{ source('prices', 'usd') }} p_sold - ON p_sold.minute = date_trunc('minute', dexs.block_time) - AND p_sold.contract_address = dexs.token_sold_address - AND p_sold.blockchain = 'polygon' - {% if not is_incremental() %} - AND p_sold.minute >= TIMESTAMP '{{project_start_date}}' - {% endif %} - {% if is_incremental() %} - AND p_sold.minute >= date_trunc('day', now() - interval '7' day) - {% endif %} \ No newline at end of file diff --git a/models/uniswap/uniswap_schema.yml b/models/uniswap/uniswap_schema.yml deleted file mode 100644 index 5ff710e6631..00000000000 --- a/models/uniswap/uniswap_schema.yml +++ /dev/null @@ -1,112 +0,0 @@ -version: 2 - -models: - - name: uniswap_liquidity_manager_pools - meta: - blockchain: optimism - project: uniswap - contributors: msilb7 - config: - tags: ['optimism','uniswap','pools','liquidity managers'] - description: > - A table containing Uniswap mappings for known liquidity manager pools created. - columns: - - &blockchain_lm - name: blockchain - description: 'Blockchain of the LP Token' - - &dex_project_name - name: dex_project_name - description: "DEX Project Name - This will be used for overall DEX LM incentives models" - - &dex_project_version - name: dex_project_version - description: "DEX Project Version - This will be used for overall DEX LM incentives models" - - &project_lm - name: project - description: 'Project Name of the LP Token' - - &contract_address_lm - name: contract_address - description: 'Manager LP Token contract address' - - &pool_contract - name: pool_contract - description: "Uniswap liquidity pool contract address" - - &fee - name: fee - description: "Swap fee of a Uniswap liquidity pool. Divide by 1e4 or power(10,4) to get the fee percentage" - - &token0 - name: token0 - description: "Token0 contract address" - - &token1 - name: token1 - description: "Token1 contract address" - - - name: uniswap_pools - meta: - blockchain: ethereum, polygon, arbitrum, celo - sector: dex - contributors: hildobby, tomfutago - config: - tags: ['ethereum', 'polygon', 'arbitrum', 'celo', 'pools'] - description: > - Uniswap DEX pools - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - blockchain - - pool - columns: - - &blockchain - name: blockchain - description: "Blockchain which the DEX is deployed" - - &project - name: project - description: "Project name of the DEX" - - &version - name: version - description: "Version of the contract built and deployed by the DEX project" - - name: pool - description: "DEX pool smart contract address" - - name: fee - description: "Defined fee" - - name: token0 - description: "First token in pool" - - name: token1 - description: "Second token in pool" - - name: creation_block_time - description: "Block time of pool creation" - - name: creation_block_number - description: "Block number of pool creation" - - name: contract_address - description: "Contract address used to create the pool" - - - name: uniswap_flashloans - meta: - blockchain: ethereum, bnb, arbitrum, optimism, polygon, celo - sector: lending - contributors: hildobby, tomfutago - config: - tags: ['ethereum', 'bnb', 'arbitrum', 'optimism', 'polygon', 'celo', 'flashloans'] - description: > - All Uniswap flashloans - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - blockchain - - tx_hash - - evt_index - columns: - - name: blockchain - - name: project - - name: version - - name: block_month - - name: block_time - - name: block_number - - name: amount - - name: amount_usd - - name: tx_hash - - name: evt_index - - name: fee - - name: currency_contract - - name: currency_symbol - - name: recipient - - name: contract_address - - name: block_month diff --git a/models/value_defi/ethereum/value_defi_ethereum_airdrop_claims.sql b/models/value_defi/ethereum/value_defi_ethereum_airdrop_claims.sql index e3833083d99..181199ab47f 100644 --- a/models/value_defi/ethereum/value_defi_ethereum_airdrop_claims.sql +++ b/models/value_defi/ethereum/value_defi_ethereum_airdrop_claims.sql @@ -20,7 +20,7 @@ WITH more_prices AS ( , MAX(hour) AS max_hour , MIN_BY(median_price, hour) AS min_price , MAX_BY(median_price, hour) AS max_price - FROM {{ ref('dex_prices') }} + FROM {{ source('dex', 'prices') }} WHERE blockchain = 'ethereum' AND contract_address= {{vusd_token_address}} ) @@ -44,7 +44,7 @@ SELECT 'ethereum' AS blockchain , 'vUSD' AS token_symbol , t.evt_index FROM {{ source('value_defi_ethereum', 'MerkleDistributor_evt_Claimed') }} t -LEFT JOIN {{ ref('dex_prices') }} pu ON pu.blockchain = 'ethereum' +LEFT JOIN {{ source('dex', 'prices') }} pu ON pu.blockchain = 'ethereum' AND pu.contract_address= {{vusd_token_address}} AND pu.hour = date_trunc('hour', t.evt_block_time) WHERE t.evt_block_time BETWEEN TIMESTAMP '2021-01-19' AND TIMESTAMP '2021-09-26' \ No newline at end of file diff --git a/models/velodrome/optimism/velodrome_optimism_airdrop_claims.sql b/models/velodrome/optimism/velodrome_optimism_airdrop_claims.sql index ae9cfaea183..da7a001f4d4 100644 --- a/models/velodrome/optimism/velodrome_optimism_airdrop_claims.sql +++ b/models/velodrome/optimism/velodrome_optimism_airdrop_claims.sql @@ -22,7 +22,7 @@ WITH price_bounds AS ( , MAX(hour) AS max_hour , MIN_BY(median_price, hour) AS min_price , MAX_BY(median_price, hour) AS max_price - FROM {{ ref('dex_prices') }} + FROM {{ source('dex', 'prices') }} WHERE blockchain = 'optimism' AND contract_address= {{velo_token_address}} ) @@ -46,7 +46,7 @@ SELECT 'optimism' AS blockchain , 'VELO' AS token_symbol , t.evt_index FROM {{ source('velodrome_optimism', 'MerkleClaim_evt_Claim') }} t -LEFT JOIN {{ ref('dex_prices') }} pu ON pu.blockchain = 'optimism' +LEFT JOIN {{ source('dex', 'prices') }} pu ON pu.blockchain = 'optimism' AND pu.contract_address= {{velo_token_address}} AND pu.hour = date_trunc('hour', t.evt_block_time) {% if is_incremental() %} diff --git a/models/yield_yak/arbitrum/yield_yak_arbitrum_schema.yml b/models/yield_yak/arbitrum/yield_yak_arbitrum_schema.yml index 156935e7a2d..c4d8535b097 100644 --- a/models/yield_yak/arbitrum/yield_yak_arbitrum_schema.yml +++ b/models/yield_yak/arbitrum/yield_yak_arbitrum_schema.yml @@ -1,100 +1,6 @@ version: 2 models: - - name: yield_yak_arbitrum_trades - meta: - blockchain: arbitrum - sector: dex - project: yield_yak - contributors: angus_1 - config: - tags: ['arbitrum','trades', 'aggregator', 'yield_yak','dex'] - description: > - yield yak aggregator trades on arbitrum - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - block_date - - blockchain - - project - - version - - tx_hash - - evt_index - - trace_address - - check_dex_aggregator_seed: - blockchain: arbitrum - project: yield_yak - version: 1 - columns: - - name: blockchain - description: "Blockchain which the DEX is deployed" - - &project - name: project - description: "Project name of the DEX" - - &version - name: version - description: "Version of the contract built and deployed by the DEX project" - - name: block_date - description: "UTC event block date of each DEX trade" - - name: block_time - description: "UTC event block time of each DEX trade" - - &token_bought_symbol - name: token_bought_symbol - description: "Token symbol for token bought in the transaction" - - &token_sold_symbol - name: token_sold_symbol - description: "Token symbol for token sold in the transaction" - - &token_pair - name: token_pair - description: "Token symbol pair for each token involved in the transaction" - - &token_bought_amount - name: token_bought_amount - description: "Value of the token bought at time of execution in the original currency" - - &token_sold_amount - name: token_sold_amount - description: "Value of the token sold at time of execution in the original currency" - - &token_bought_amount_raw - name: token_bought_amount_raw - description: "Raw value of the token bought at time of execution in the original currency" - - &token_sold_amount_raw - name: token_sold_amount_raw - description: "Raw value of the token sold at time of execution in the original currency" - - &amount_usd - name: amount_usd - description: "USD value of the trade at time of execution" - - &token_bought_address - name: token_bought_address - description: "Contract address of the token bought" - - &token_sold_address - name: token_sold_address - description: "Contract address of the token sold" - - &taker - name: taker - description: "Address of trader who purchased a token" - - &maker - name: maker - description: "Address of trader who sold a token" - - &project_contract_address - name: project_contract_address - description: "Project contract address which executed the trade on the blockchain" - - name: tx_hash - description: "Unique transaction hash value tied to each transaction on the DEX" - - &tx_from - name: tx_from - description: "Address which initiated the transaction" - - &tx_to - name: tx_to - description: "Address which received the transaction" - - &trace_address - name: trace_address - description: "" - - &evt_index - name: evt_index - description: "The position of this event log within this transaction" - - &block_month - name: block_month - description: "UTC event block month of each DEX trade" - - name: yield_yak_arbitrum_deposits meta: blockchain: arbitrum @@ -120,7 +26,9 @@ models: - &tx_hash name: tx_hash description: "Transaction hash of the deposit/withdraw/reinvest/swap" - - *evt_index + - &evt_index + name: evt_index + description: "The position of this event log within this transaction" - &tx_index name: tx_index description: "Index of the transaction within the block" diff --git a/models/yield_yak/avalanche_c/yield_yak_avalanche_c_schema.yml b/models/yield_yak/avalanche_c/yield_yak_avalanche_c_schema.yml index d19bfff1d08..40b7de500f5 100644 --- a/models/yield_yak/avalanche_c/yield_yak_avalanche_c_schema.yml +++ b/models/yield_yak/avalanche_c/yield_yak_avalanche_c_schema.yml @@ -1,100 +1,6 @@ version: 2 models: - - name: yield_yak_avalanche_c_trades - meta: - blockchain: avalanche_c - sector: dex - project: yield_yak - contributors: Henrystats - config: - tags: ['avalanche_c','trades', 'aggregator', 'yield_yak','dex'] - description: > - yield yak aggregator trades on avalanche_c - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - block_date - - blockchain - - project - - version - - tx_hash - - evt_index - - trace_address - - check_dex_aggregator_seed: - blockchain: avalanche_c - project: yield_yak - version: 1 - columns: - - name: blockchain - description: "Blockchain which the DEX is deployed" - - &project - name: project - description: "Project name of the DEX" - - &version - name: version - description: "Version of the contract built and deployed by the DEX project" - - name: block_date - description: "UTC event block date of each DEX trade" - - name: block_time - description: "UTC event block time of each DEX trade" - - &token_bought_symbol - name: token_bought_symbol - description: "Token symbol for token bought in the transaction" - - &token_sold_symbol - name: token_sold_symbol - description: "Token symbol for token sold in the transaction" - - &token_pair - name: token_pair - description: "Token symbol pair for each token involved in the transaction" - - &token_bought_amount - name: token_bought_amount - description: "Value of the token bought at time of execution in the original currency" - - &token_sold_amount - name: token_sold_amount - description: "Value of the token sold at time of execution in the original currency" - - &token_bought_amount_raw - name: token_bought_amount_raw - description: "Raw value of the token bought at time of execution in the original currency" - - &token_sold_amount_raw - name: token_sold_amount_raw - description: "Raw value of the token sold at time of execution in the original currency" - - &amount_usd - name: amount_usd - description: "USD value of the trade at time of execution" - - &token_bought_address - name: token_bought_address - description: "Contract address of the token bought" - - &token_sold_address - name: token_sold_address - description: "Contract address of the token sold" - - &taker - name: taker - description: "Address of trader who purchased a token" - - &maker - name: maker - description: "Address of trader who sold a token" - - &project_contract_address - name: project_contract_address - description: "Project contract address which executed the trade on the blockchain" - - name: tx_hash - description: "Unique transaction hash value tied to each transaction on the DEX" - - &tx_from - name: tx_from - description: "Address which initiated the transaction" - - &tx_to - name: tx_to - description: "Address which received the transaction" - - &trace_address - name: trace_address - description: "" - - &evt_index - name: evt_index - description: "The position of this event log within this transaction" - - &block_month - name: block_month - description: "UTC event block month of each DEX trade" - - name: yield_yak_avalanche_c_deposits meta: blockchain: avalanche_c @@ -120,7 +26,9 @@ models: - &tx_hash name: tx_hash description: "Transaction hash of the deposit/withdraw/reinvest/swap" - - *evt_index + - &evt_index + name: evt_index + description: "The position of this event log within this transaction" - &tx_index name: tx_index description: "Index of the transaction within the block" diff --git a/models/yield_yak/mantle/yield_yak_mantle_schema.yml b/models/yield_yak/mantle/yield_yak_mantle_schema.yml index df0322029c1..b8677c67091 100644 --- a/models/yield_yak/mantle/yield_yak_mantle_schema.yml +++ b/models/yield_yak/mantle/yield_yak_mantle_schema.yml @@ -1,100 +1,6 @@ version: 2 models: - - name: yield_yak_mantle_trades - meta: - blockchain: mantle - sector: dex - project: yield_yak - contributors: angus_1 - config: - tags: ['mantle','trades', 'aggregator', 'yield_yak','dex'] - description: > - yield yak aggregator trades on mantle - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - block_date - - blockchain - - project - - version - - tx_hash - - evt_index - - trace_address - - check_dex_aggregator_seed: - blockchain: mantle - project: yield_yak - version: 1 - columns: - - name: blockchain - description: "Blockchain which the DEX is deployed" - - &project - name: project - description: "Project name of the DEX" - - &version - name: version - description: "Version of the contract built and deployed by the DEX project" - - name: block_date - description: "UTC event block date of each DEX trade" - - name: block_time - description: "UTC event block time of each DEX trade" - - &token_bought_symbol - name: token_bought_symbol - description: "Token symbol for token bought in the transaction" - - &token_sold_symbol - name: token_sold_symbol - description: "Token symbol for token sold in the transaction" - - &token_pair - name: token_pair - description: "Token symbol pair for each token involved in the transaction" - - &token_bought_amount - name: token_bought_amount - description: "Value of the token bought at time of execution in the original currency" - - &token_sold_amount - name: token_sold_amount - description: "Value of the token sold at time of execution in the original currency" - - &token_bought_amount_raw - name: token_bought_amount_raw - description: "Raw value of the token bought at time of execution in the original currency" - - &token_sold_amount_raw - name: token_sold_amount_raw - description: "Raw value of the token sold at time of execution in the original currency" - - &amount_usd - name: amount_usd - description: "USD value of the trade at time of execution" - - &token_bought_address - name: token_bought_address - description: "Contract address of the token bought" - - &token_sold_address - name: token_sold_address - description: "Contract address of the token sold" - - &taker - name: taker - description: "Address of trader who purchased a token" - - &maker - name: maker - description: "Address of trader who sold a token" - - &project_contract_address - name: project_contract_address - description: "Project contract address which executed the trade on the blockchain" - - name: tx_hash - description: "Unique transaction hash value tied to each transaction on the DEX" - - &tx_from - name: tx_from - description: "Address which initiated the transaction" - - &tx_to - name: tx_to - description: "Address which received the transaction" - - &trace_address - name: trace_address - description: "" - - &evt_index - name: evt_index - description: "The position of this event log within this transaction" - - &block_month - name: block_month - description: "UTC event block month of each DEX trade" - - name: yield_yak_mantle_deposits meta: blockchain: mantle @@ -120,7 +26,9 @@ models: - &tx_hash name: tx_hash description: "Transaction hash of the deposit/withdraw/reinvest/swap" - - *evt_index + - &evt_index + name: evt_index + description: "The position of this event log within this transaction" - &tx_index name: tx_index description: "Index of the transaction within the block" diff --git a/models/yield_yak/yield_yak_schema.yml b/models/yield_yak/yield_yak_schema.yml index 7062261dc57..e19f7104dd7 100644 --- a/models/yield_yak/yield_yak_schema.yml +++ b/models/yield_yak/yield_yak_schema.yml @@ -1,83 +1,6 @@ version: 2 models: - - name: yield_yak_trades - meta: - blockchain: avalanche_c, arbitrum, mantle - sector: dex - project: yield_yak - contributors: Henrystats, angus_1 - config: - tags: ['avalanche_c', 'yield_yak','trades', 'dex', 'aggregator', 'Henrystats', 'angus_1', 'cross-chain', 'arbitrum', 'mantle'] - description: > - yield yak aggregator trades on all chains across all contracts and versions. This table will load dex trades downstream. - columns: - - name: blockchain - description: "Blockchain which the DEX is deployed" - - &project - name: project - description: "Project name of the DEX" - - &version - name: version - description: "Version of the contract built and deployed by the DEX project" - - name: block_date - description: "UTC event block date of each DEX trade" - - name: block_time - description: "UTC event block time of each DEX trade" - - &token_bought_symbol - name: token_bought_symbol - description: "Token symbol for token bought in the transaction" - - &token_sold_symbol - name: token_sold_symbol - description: "Token symbol for token sold in the transaction" - - &token_pair - name: token_pair - description: "Token symbol pair for each token involved in the transaction" - - &token_bought_amount - name: token_bought_amount - description: "Value of the token bought at time of execution in the original currency" - - &token_sold_amount - name: token_sold_amount - description: "Value of the token sold at time of execution in the original currency" - - &token_bought_amount_raw - name: token_bought_amount_raw - description: "Raw value of the token bought at time of execution in the original currency" - - &token_sold_amount_raw - name: token_sold_amount_raw - description: "Raw value of the token sold at time of execution in the original currency" - - &amount_usd - name: amount_usd - description: "USD value of the trade at time of execution" - - &token_bought_address - name: token_bought_address - description: "Contract address of the token bought" - - &token_sold_address - name: token_sold_address - description: "Contract address of the token sold" - - &taker - name: taker - description: "Address of trader who purchased a token" - - &maker - name: maker - description: "Address of trader who sold a token" - - &project_contract_address - name: project_contract_address - description: "Project contract address which executed the trade on the blockchain" - - name: tx_hash - description: "Unique transaction hash value tied to each transaction on the DEX" - - &tx_from - name: tx_from - description: "Address which initiated the transaction" - - &tx_to - name: tx_to - description: "Address which received the transaction" - - &trace_address - name: trace_address - description: "Address of the trace within the call graph forest" - - &evt_index - name: evt_index - description: "The position of this event log within this transaction" - - name: yield_yak_deposits meta: blockchain: avalanche_c, arbitrum, mantle @@ -104,7 +27,9 @@ models: - &tx_hash name: tx_hash description: "Transaction hash of the deposit/withdraw/reinvest/swap" - - *evt_index + - &evt_index + name: evt_index + description: "The position of this event log within this transaction" - &tx_index name: tx_index description: "Index of the transaction within the block" diff --git a/seeds/curvefi/ethereum/curvefi_ethereum_view_pools_postgres.csv b/seeds/curvefi/ethereum/curvefi_ethereum_view_pools_postgres.csv deleted file mode 100644 index 46af91ddd4d..00000000000 --- a/seeds/curvefi/ethereum/curvefi_ethereum_view_pools_postgres.csv +++ /dev/null @@ -1,299 +0,0 @@ -version,name,symbol,pool_address,decoded,dune_namespace,dune_table_name,a,mid_fee,out_fee,token_address,deposit_contract,coin0,coin1,coin2,coin3,undercoin0,undercoin1,undercoin2,undercoin3,gauge_contract -Factory V1 Meta,GOLD/BSD,GBSD,0x9809f2b973bdb056d24bc2b6571ea1f23db4e861,no,,,200,4000000,4000000,0x9809f2b973bdb056d24bc2b6571ea1f23db4e861,0x9809f2b973bdb056d24bc2b6571ea1f23db4e861,0x804c23b6ccfa0a1fae1a81c9964f42ae689c790e,0x6c3f90f043a72fa612cbac8115ee7e52bde6e490,,,0x804c23b6ccfa0a1fae1a81c9964f42ae689c790e,0x6b175474e89094c44da98b954eedeac495271d0f,0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48,0xdac17f958d2ee523a2206206994597c13d831ec7, -Factory V2,cbETH/ETH,cbETH/ETH,0x5fae7e604fc3e24fd43a72867cebac94c65b404a,no,,,200000000,5000000,45000000,0x5b6c539b224014a09b3388e51caaa8e354c959c8,0x5fae7e604fc3e24fd43a72867cebac94c65b404a,0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2,0xbe9895146f7af43049ca1c1ae358b0541ea49704,,,,,,, -Factory V2,FXSFPIS,FXSFPIS,0xd4e2fdc354c5dffb865798ca98c2b9d5382f687c,no,,,400000,26000000,45000000,0xb83e5af00b321d2280382b8634625826fbd75c5b,0xd4e2fdc354c5dffb865798ca98c2b9d5382f687c,0x3432b6a60d23ca0dfca7761b7ab56459d9c964d0,0xc2544a32872a91f4a553b404c6950e89de901fdb,,,,,,, -Factory V2,RAI/LUSD-3,RAILUSD-3,0xc58fdb8a50ab921a73535656a7c69387dd863ff6,no,,,200000000,500000,5000000,0xd29f1a967441ae1a4ff2ea35ede54fe01cf6b95f,0xc58fdb8a50ab921a73535656a7c69387dd863ff6,0x03ab458634910aad20ef5f1c8ee96f1d6ac54919,0x5f98805a4e8be255a32880fdec7f6728c6568ba0,,,,,,, -Factory V2,RAI/LUSD-2,RAILUSD-2,0x162b4deefc73a5277b09bd7a02d25da73d66183d,no,,,200000000,500000,5000000,0xd63acb54fffff6b85255a1ffb6eefffc93cfdd91,0x162b4deefc73a5277b09bd7a02d25da73d66183d,0x03ab458634910aad20ef5f1c8ee96f1d6ac54919,0x5f98805a4e8be255a32880fdec7f6728c6568ba0,,,,,,, -Factory V2,RAI/LUSD,RAILUSD,0x0d1c65b28190cb88f328d2051c524a5c63d10eb5,no,,,200000000,500000,5000000,0x00989e88f674157992b74f11eb78ee10a76e6258,0x0d1c65b28190cb88f328d2051c524a5c63d10eb5,0x03ab458634910aad20ef5f1c8ee96f1d6ac54919,0x5f98805a4e8be255a32880fdec7f6728c6568ba0,,,,,,, -Factory V2,RAI/DAI-3,RAIDAI-3,0x337ca39842c448030196693f3433332ff1cf3e41,no,,,200000000,500000,5000000,0x4c5e815f0481bb1995ad417a4019669e1017d84b,0x337ca39842c448030196693f3433332ff1cf3e41,0x03ab458634910aad20ef5f1c8ee96f1d6ac54919,0x6b175474e89094c44da98b954eedeac495271d0f,,,,,,, -Factory V2,BTRFLY/ETH,BTRFLYETH,0x6e314039f4c56000f4ebb3a7854a84cc6225fb92,no,,,400000,26000000,45000000,0x7483dd57f6488b0e194a151c57df6ec85c00ace9,0x6e314039f4c56000f4ebb3a7854a84cc6225fb92,0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2,0xc55126051b22ebb829d00368f4b12bde432de5da,,,,,,, -Factory V2,test2,test2,0xbd917239ec067a6af82aabb6b45dad3d09f4efd8,no,,,400000,26000000,45000000,0x2d011868ac59c5d00b41dead65bfb5ddd4976bda,0xbd917239ec067a6af82aabb6b45dad3d09f4efd8,0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2,0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48,,,,,,, -Factory V2,test,test,0x118629329731ce1ff01f9401212c53939f8a9eeb,no,,,400000,26000000,45000000,0x14b536dc890b29bb5d317ec4c4585857ccbf0778,0x118629329731ce1ff01f9401212c53939f8a9eeb,0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2,0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48,,,,,,, -Factory V2,RAI/DAI-2,RAIDAI-2,0x91d9d17efd378f38a48122ae6ec01b2e83d1ac98,no,,,200000000,500000,45000000,0x85bc2193cd594cddafabed3f4fca48849a9968f8,0x91d9d17efd378f38a48122ae6ec01b2e83d1ac98,0x03ab458634910aad20ef5f1c8ee96f1d6ac54919,0x6b175474e89094c44da98b954eedeac495271d0f,,,,,,, -Factory V2,RAI/DAI,RAIDAI,0x79cb6a84fbec1fe2d66b705a1e7f6482c2993049,no,,,200000000,5000000,45000000,0xc5a62c8a3272e53059386338c9ec2a375f130b33,0x79cb6a84fbec1fe2d66b705a1e7f6482c2993049,0x03ab458634910aad20ef5f1c8ee96f1d6ac54919,0x6b175474e89094c44da98b954eedeac495271d0f,,,,,,, -Factory V2,CTR/ETH,CTRETH,0x383ad525211b8a1a9c13532cc021773052b2f4f8,no,,,400000,26000000,45000000,0x4ce6803f108a667e53fe09a93cf91a18d9d2ad31,0x383ad525211b8a1a9c13532cc021773052b2f4f8,0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2,0xb3ad645db386d7f6d753b2b9c3f4b853da6890b8,,,,,,, -Factory V2,MATIC/FLEET,MATICFLEET,0x799d141e83d88996c48b98a4f8eb3d96ab422dd3,no,,,400000,26000000,45000000,0x359b630ef33a40b0abeeeed5467fe839f9f7e561,0x799d141e83d88996c48b98a4f8eb3d96ab422dd3,0x7d1afa7b718fb893db30a3abc0cfc608aacfebb0,0xfd56a3dcfc0690881a466ae432d71bb2db588083,,,,,,, -Factory V2,MATIC/SHIB,MATICSHIB,0xb2c248c0b0db7d28dfa0123438b40bb31fb8aa05,no,,,400000,26000000,45000000,0x38f730b5a96fd79b97bb64210021fa67db1ed147,0xb2c248c0b0db7d28dfa0123438b40bb31fb8aa05,0x7d1afa7b718fb893db30a3abc0cfc608aacfebb0,0x95ad61b0a150d79219dcf64e1e6cc01f0b64c4ce,,,,,,, -Factory V2,APW/ETH,APWETH,0xc78d84ee5d970227f988a2e2dc0a4a945163bcb9,no,,,400000,26000000,45000000,0x6542d124440269ed8a8a3b14ece9f4923382371a,0xc78d84ee5d970227f988a2e2dc0a4a945163bcb9,0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2,0x4104b135dbc9609fc1a9490e61369036497660c8,,,,,,, -Factory V2,APW/ETH,APWETH,0x316d2606ce036ec0e69a11432a870a4ec66ade96,no,,,400000,26000000,45000000,0x7d4e5c315746ecbf4d82b538767817135f3e3142,0x316d2606ce036ec0e69a11432a870a4ec66ade96,0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2,0x4104b135dbc9609fc1a9490e61369036497660c8,,,,,,, -Factory V2,BENTCVX/FRAX,BNTCVXFRAX,0xb2e2536821521174a168eda7be78a6c70ea6e5fa,no,,,400000,26000000,45000000,0xdb5a544b6ef951cabd6438eea360758d8b9b9a5f,0xb2e2536821521174a168eda7be78a6c70ea6e5fa,0x9e0441e084f5db0606565737158aa6ab6b970fe0,0x3175df0976dfa876431c2e9ee6bc45b65d3473cc,,,,,,, -Factory V2,BENT/FRAX,BENTFRAXBP,0xd3301b7caa76f932816a6fc7ef0b673238e217ad,no,,,400000,26000000,45000000,0xa3008d3ee33b1ffc448f8891c8c3518b47e0b605,0xd3301b7caa76f932816a6fc7ef0b673238e217ad,0x01597e397605bf280674bf292623460b4204c375,0x3175df0976dfa876431c2e9ee6bc45b65d3473cc,,,,,,, -Factory V2,FLOAT/USDC,FLOATUSDC,0x840cbf6861137624e60380d5e915619885c5aa95,no,,,2000000,5000000,45000000,0x7beb4ee7bfa0f9c16911e57d2aac933e249d840e,0x840cbf6861137624e60380d5e915619885c5aa95,0xb05097849bca421a3f51b249ba6cca4af4b97cb9,0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48,,,,,,, -Factory V2,Phanes,PNHS,0x9bfb082f2dd5d63907afa33dbb8f9c0bcd5c2333,no,,,400000,26000000,45000000,0x799ebe5e2faae084480e890aefc1b23bf626df3b,0x9bfb082f2dd5d63907afa33dbb8f9c0bcd5c2333,0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2,0x4425c9c6302bd2a815c21012dc7f692216fb3176,,,,,,, -Factory V2,MXNT/USDC,MXNTUSDC,0xc12a73c46d49fa0d7433c90291bc8d1a9eae7b23,no,,,200000000,5000000,45000000,0xf10dba33dcba27e4e45ca77e69c6c2afb96068db,0xc12a73c46d49fa0d7433c90291bc8d1a9eae7b23,0xed03ed872159e199065401b6d0d487d78d9464aa,0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48,,,,,,, -Factory V2,mxnt,MXNT-3Crv,0x039fd59541b3989c7a1e9278431038b3b6ba5f43,no,,,200000000,26000000,45000000,0xdf0b71258854fc8a685e2b63972cdaad61a1c165,0x039fd59541b3989c7a1e9278431038b3b6ba5f43,0xed03ed872159e199065401b6d0d487d78d9464aa,0x6c3f90f043a72fa612cbac8115ee7e52bde6e490,,,,,,, -Factory V2,RAREPEPE,NAKAMOTO,0xddbdcebb989b1ef804338d6c9a902f91c2738936,no,,,300000,30000000,50000000,0xaf47ced866c824fdbd3e00f651bdde19ac9cbd03,0xddbdcebb989b1ef804338d6c9a902f91c2738936,0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2,0xd6242e984e6db6b5286fb2c26c69330da639da12,,,,,,, -Factory V2,NAKAMOTOCARD,RAREPEPE,0xfce1b5447a3db7e18352e8ae4bcd780029012383,no,,,300000,30000000,50000000,0x77b46d22ca8fba667929e5b78d8cd1310f6b8504,0xfce1b5447a3db7e18352e8ae4bcd780029012383,0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2,0xd6242e984e6db6b5286fb2c26c69330da639da12,,,,,,, -Factory V2,WETH/RAREPEPE,RAREPEPE,0xec1f6df37b16432e520942affe28149badc5bc5e,no,,,250000,25000000,100000000,0xd3c499639e581f0aa2f85be0b385d1298831c22f,0xec1f6df37b16432e520942affe28149badc5bc5e,0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2,0xd6242e984e6db6b5286fb2c26c69330da639da12,,,,,,, -Factory V2,aCRV/CRV,aCRV,0x95f3672a418230c5664b7154dfce0acfa7eed68d,no,,,200000000,10000000,90000000,0x2c97c40c24e2ff11c6965dc40ca77967bcec4719,0x95f3672a418230c5664b7154dfce0acfa7eed68d,0x2b95a1dcc3d405535f9ed33c219ab38e8d7e0884,0xd533a949740bb3306d119cc777fa900ba034cd52,,,,,,, -Factory V2,frETH/WETH,frETHWETH,0x6e77889ff348a16547caba3ce011cb120ed73bfc,no,,,400000,26000000,45000000,0x517e47a2e8c38e5a96708ed866a39ccbaa105640,0x6e77889ff348a16547caba3ce011cb120ed73bfc,0xb4bd4628e6efb0cb521d9ec35050c75840320374,0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2,,,,,,, -Factory V2,UNBNK/ETH,UNBNK/ETH,0x5114f86027d4c9a509cba072b8135a171402c6d5,no,,,400000,26000000,45000000,0x20a1512284dc88102bfe169c08530c743d85dcc7,0x5114f86027d4c9a509cba072b8135a171402c6d5,0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2,0x06b884e60794ce02aafab13791b59a2e6a07442f,,,,,,, -Factory V2,ARTH/DAI,ARTH+DAI,0xfd484a99d21ca118f22871134f467b1ca3f842aa,no,,,200000000,5000000,45000000,0xd1dca101e8155f79db50bc51abbd4ff74bc53f25,0xfd484a99d21ca118f22871134f467b1ca3f842aa,0x8cc0f052fff7ead7f2edcccac895502e884a8a71,0x6b175474e89094c44da98b954eedeac495271d0f,,,,,,, -Factory V2,bSTBL/DAI,bSTBLDAI,0xa148bd19e26ff9604f6a608e22bfb7b772d0d1a3,no,,,200000000,1000000,10000000,0x7657ceb382013f1ce9ac7b08dd8db4f28d3a7538,0xa148bd19e26ff9604f6a608e22bfb7b772d0d1a3,0x6b175474e89094c44da98b954eedeac495271d0f,0x5ee08f40b637417bcc9d2c51b62f4820ec9cf5d8,,,,,,, -Factory V2,ARTH/USDC,ARTH+USDC,0x7f2af2c7bfdad063ff01dcec077a216d95a0a944,no,,,200000000,5000000,45000000,0x6cd19aeae3df93fec7b75c11db3c68f9831a44d5,0x7f2af2c7bfdad063ff01dcec077a216d95a0a944,0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48,0x8cc0f052fff7ead7f2edcccac895502e884a8a71,,,,,,, -Factory V2,ARTH,ARTH+USDC,0xbfca1a72edd92fff61a8c88f61d4e64e99232b4b,no,,,200000000,5000000,45000000,0x82ebe2c1a4f235efdebabd534ca00cfef59cf22b,0xbfca1a72edd92fff61a8c88f61d4e64e99232b4b,0x8cc0f052fff7ead7f2edcccac895502e884a8a71,0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48,,,,,,, -Factory V2,ARTH,ARTH+3pool,0x7d99469fb3a530136ec0ab6981d64bc9ff81ad04,no,,,200000000,5000000,45000000,0xbb6b6a7204385031a161210967b93b7eb02f8d5e,0x7d99469fb3a530136ec0ab6981d64bc9ff81ad04,0x8cc0f052fff7ead7f2edcccac895502e884a8a71,0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48,,,,,,, -Factory V2,ARTH,ARTH+3pool,0x6525e7e2e8450741ab97bd3948bfa47878f83ec6,no,,,200000000,5000000,45000000,0x240558287687e0645f552c17865a28d64dccf8df,0x6525e7e2e8450741ab97bd3948bfa47878f83ec6,0x8cc0f052fff7ead7f2edcccac895502e884a8a71,0x6c3f90f043a72fa612cbac8115ee7e52bde6e490,,,,,,, -Factory V2,PSL/ETH,PSLETH,0xd434eaf67bba1903f61cdd3ede6700cac74a5ff2,no,,,400000,26000000,45000000,0xa149523fed056edff817062fbb59455ed3a4380f,0xd434eaf67bba1903f61cdd3ede6700cac74a5ff2,0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2,0xc775c0c30840cb9f51e21061b054ebf1a00acc29,,,,,,, -Factory V2,TRU/ETH,TRUETH,0x7f787210c83012fca364ae79ad8fc26641c6fbe5,no,,,400000,26000000,45000000,0x79d34ea9f93abfdf163073e87051b75b768079e9,0x7f787210c83012fca364ae79ad8fc26641c6fbe5,0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2,0x4c19596f5aaff459fa38b0f7ed92f11ae6543784,,,,,,, -Factory V1 Meta,CRV/GNO,CRVGNOOK,0xf08dbd81fcc712004e6943454c83c52de963cdec,no,,,10,4000000,4000000,0xf08dbd81fcc712004e6943454c83c52de963cdec,0xf08dbd81fcc712004e6943454c83c52de963cdec,0x6810e776880c02933d47db1b9fc05908e5386b96,0x6c3f90f043a72fa612cbac8115ee7e52bde6e490,,,0x6810e776880c02933d47db1b9fc05908e5386b96,0x6b175474e89094c44da98b954eedeac495271d0f,0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48,0xdac17f958d2ee523a2206206994597c13d831ec7, -Factory V1 Meta,CRV/GNO,CRVGNOOK,0x172a54ba45783049216f90f85fe5e5f6bc1c08fe,no,,,10,4000000,4000000,0x172a54ba45783049216f90f85fe5e5f6bc1c08fe,0x172a54ba45783049216f90f85fe5e5f6bc1c08fe,0x6810e776880c02933d47db1b9fc05908e5386b96,0x6c3f90f043a72fa612cbac8115ee7e52bde6e490,,,0x6810e776880c02933d47db1b9fc05908e5386b96,0x6b175474e89094c44da98b954eedeac495271d0f,0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48,0xdac17f958d2ee523a2206206994597c13d831ec7, -Factory V1 Plain,Test Only,TestOnly,0xe7e4366f6ed6afd23e88154c00b532bdc0352333,no,,,200,4000000,4000000,0xe7e4366f6ed6afd23e88154c00b532bdc0352333,0xe7e4366f6ed6afd23e88154c00b532bdc0352333,0xadf15ec41689fc5b6dca0db7c53c9bfe7981e655,0x3432b6a60d23ca0dfca7761b7ab56459d9c964d0,0x0000000000000000000000000000000000000000,0x0000000000000000000000000000000000000000,,,,, -Factory V1 Plain,DYDX/stkDYDX,DYDXstDYDX,0x04ecd49246bf5143e43e2305136c46aeb6fad400,no,,,10,4000000,4000000,0x04ecd49246bf5143e43e2305136c46aeb6fad400,0x04ecd49246bf5143e43e2305136c46aeb6fad400,0x92d6c1e31e14520e676a687f0a93788b716beff5,0x65f7ba4ec257af7c55fd5854e5f6356bbd0fb8ec,0x0000000000000000000000000000000000000000,0x0000000000000000000000000000000000000000,,,,, -Factory V1 Plain,sdFXS,sdFXSFXS,0x8c524635d52bd7b1bd55e062303177a7d916c046,no,,,10,4000000,4000000,0x8c524635d52bd7b1bd55e062303177a7d916c046,0x8c524635d52bd7b1bd55e062303177a7d916c046,0x3432b6a60d23ca0dfca7761b7ab56459d9c964d0,0x402f878bdd1f5c66fdaf0fababcf74741b68ac36,0x0000000000000000000000000000000000000000,0x0000000000000000000000000000000000000000,,,,,0xa9a9bc60fc80478059a83f516d5215185eec2fc0 -Factory V1 Plain,sdANGLE,sdAGAG,0x48ff31bbbd8ab553ebe7cbd84e1ea3dba8f54957,no,,,10,4000000,4000000,0x48ff31bbbd8ab553ebe7cbd84e1ea3dba8f54957,0x48ff31bbbd8ab553ebe7cbd84e1ea3dba8f54957,0x31429d1856ad1377a8a0079410b297e1a9e214c2,0x752b4c6e92d96467fe9b9a2522ef07228e00f87c,0x0000000000000000000000000000000000000000,0x0000000000000000000000000000000000000000,,,,,0x03ffc218c7a9306d21193565cbdc4378952faa8c -Factory V1 Plain,dfxCAD/CADC,dfx2CAD,0x9ca41a2dab3cee15308998868ca644e2e3be5c59,no,,,100,4000000,4000000,0x9ca41a2dab3cee15308998868ca644e2e3be5c59,0x9ca41a2dab3cee15308998868ca644e2e3be5c59,0xfe32747d0251ba92bcb80b6d16c8257ecf25ab1c,0xcadc0acd4b445166f12d2c07eac6e2544fbe2eef,0x0000000000000000000000000000000000000000,0x0000000000000000000000000000000000000000,,,,,0xa5f483571c126b173e33c327e8a293a3492e4566 -Factory V1 Meta,USDT/DAI,USDT/DAI_M,0x3dcc3ac50cb42f7e443d7f548dd2c48edaa8f59a,no,,,10,4000000,4000000,0x3dcc3ac50cb42f7e443d7f548dd2c48edaa8f59a,0x3dcc3ac50cb42f7e443d7f548dd2c48edaa8f59a,0x6c3f90f043a72fa612cbac8115ee7e52bde6e490,0x6c3f90f043a72fa612cbac8115ee7e52bde6e490,,,0x6c3f90f043a72fa612cbac8115ee7e52bde6e490,0x6b175474e89094c44da98b954eedeac495271d0f,0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48,0xdac17f958d2ee523a2206206994597c13d831ec7, -Factory V1 Meta,USDT/DAI,USDTDAI_OP,0xb548e49bb6f33a77885836723b73ef9c8dbc047b,no,,,10,4000000,4000000,0xb548e49bb6f33a77885836723b73ef9c8dbc047b,0xb548e49bb6f33a77885836723b73ef9c8dbc047b,0x6c3f90f043a72fa612cbac8115ee7e52bde6e490,0x6c3f90f043a72fa612cbac8115ee7e52bde6e490,,,0x6c3f90f043a72fa612cbac8115ee7e52bde6e490,0x6b175474e89094c44da98b954eedeac495271d0f,0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48,0xdac17f958d2ee523a2206206994597c13d831ec7, -Factory V1 Meta,xUSD1,xUSD1,0x8b3138df9aa1f60648c65c67d6ff646be305788b,no,,,10,4000000,4000000,0x8b3138df9aa1f60648c65c67d6ff646be305788b,0x8b3138df9aa1f60648c65c67d6ff646be305788b,0xbfef1f07018b3a87fc1e12877038f9616512d587,0x6c3f90f043a72fa612cbac8115ee7e52bde6e490,,,0xbfef1f07018b3a87fc1e12877038f9616512d587,0x6b175474e89094c44da98b954eedeac495271d0f,0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48,0xdac17f958d2ee523a2206206994597c13d831ec7, -Factory V1 Meta,xUSD1,xUSD1,0xc5481720517e1b170cf1d19ceaabe07c37896eb2,no,,,10,4000000,4000000,0xc5481720517e1b170cf1d19ceaabe07c37896eb2,0xc5481720517e1b170cf1d19ceaabe07c37896eb2,0xbfef1f07018b3a87fc1e12877038f9616512d587,0x6c3f90f043a72fa612cbac8115ee7e52bde6e490,,,0xbfef1f07018b3a87fc1e12877038f9616512d587,0x6b175474e89094c44da98b954eedeac495271d0f,0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48,0xdac17f958d2ee523a2206206994597c13d831ec7, -Factory V1 Meta,USDS/3CRV,USDS3CRV,0xde495223f7cd7ee0cde1addbd6836046bbdf3ad3,no,,,2000,4000000,4000000,0xde495223f7cd7ee0cde1addbd6836046bbdf3ad3,0xde495223f7cd7ee0cde1addbd6836046bbdf3ad3,0x45fdb1b92a649fb6a64ef1511d3ba5bf60044838,0x6c3f90f043a72fa612cbac8115ee7e52bde6e490,,,0x45fdb1b92a649fb6a64ef1511d3ba5bf60044838,0x6b175474e89094c44da98b954eedeac495271d0f,0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48,0xdac17f958d2ee523a2206206994597c13d831ec7, -Factory V1 Meta,xUSD1,xUSD1,0x87872be0c56ef97156f2617b3083d22423fc62e9,no,,,10,4000000,4000000,0x87872be0c56ef97156f2617b3083d22423fc62e9,0x87872be0c56ef97156f2617b3083d22423fc62e9,0xbfef1f07018b3a87fc1e12877038f9616512d587,0x6c3f90f043a72fa612cbac8115ee7e52bde6e490,,,0xbfef1f07018b3a87fc1e12877038f9616512d587,0x6b175474e89094c44da98b954eedeac495271d0f,0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48,0xdac17f958d2ee523a2206206994597c13d831ec7, -Factory V1 Meta,xUSD1,xUSD1,0x85f102be3a76165be9668be0bf36e906a488fd33,no,,,10,4000000,4000000,0x85f102be3a76165be9668be0bf36e906a488fd33,0x85f102be3a76165be9668be0bf36e906a488fd33,0xbfef1f07018b3a87fc1e12877038f9616512d587,0x6c3f90f043a72fa612cbac8115ee7e52bde6e490,,,0xbfef1f07018b3a87fc1e12877038f9616512d587,0x6b175474e89094c44da98b954eedeac495271d0f,0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48,0xdac17f958d2ee523a2206206994597c13d831ec7, -Factory V1 Meta,xUSD1,xUSD1,0x92da88e2e6f96cc7c667cd1367bd090adf3c6053,no,,,10,4000000,4000000,0x92da88e2e6f96cc7c667cd1367bd090adf3c6053,0x92da88e2e6f96cc7c667cd1367bd090adf3c6053,0xbfef1f07018b3a87fc1e12877038f9616512d587,0x6c3f90f043a72fa612cbac8115ee7e52bde6e490,,,0xbfef1f07018b3a87fc1e12877038f9616512d587,0x6b175474e89094c44da98b954eedeac495271d0f,0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48,0xdac17f958d2ee523a2206206994597c13d831ec7, -Factory V1 Meta,handleUSD,fxUSD,0x0aace9b6c491d5cd9f80665a2fcc1af09e9ccf00,no,,,200,4000000,4000000,0x0aace9b6c491d5cd9f80665a2fcc1af09e9ccf00,0x0aace9b6c491d5cd9f80665a2fcc1af09e9ccf00,0x8616e8ea83f048ab9a5ec513c9412dd2993bce3f,,,,0x8616e8ea83f048ab9a5ec513c9412dd2993bce3f,,,, -Factory V1 Meta,MIMFRAXBP,MIMFRAXBP,0xb3bc1833ac51aacea92acd551fbe1ab7edc59edf,no,,,200,4000000,4000000,0xb3bc1833ac51aacea92acd551fbe1ab7edc59edf,0xb3bc1833ac51aacea92acd551fbe1ab7edc59edf,0x99d8a9c45b2eca8864373a26d1459e3dff1e17f3,,,,0x99d8a9c45b2eca8864373a26d1459e3dff1e17f3,,,, -Factory V1 Meta,MAI+3pool,MAIpool,0x48fcffa86fb24bdeb45b5739f7ced24095a7c8e8,no,,,500,4000000,4000000,0x48fcffa86fb24bdeb45b5739f7ced24095a7c8e8,0x48fcffa86fb24bdeb45b5739f7ced24095a7c8e8,0x8d6cebd76f18e1558d4db88138e2defb3909fad6,0x6c3f90f043a72fa612cbac8115ee7e52bde6e490,,,0x8d6cebd76f18e1558d4db88138e2defb3909fad6,0x6b175474e89094c44da98b954eedeac495271d0f,0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48,0xdac17f958d2ee523a2206206994597c13d831ec7, -Factory V1 Meta,EUROC,EUROC/3CRV,0x642562115cf5a5e72ab517e6448ec8b61843dac9,no,,,200,4000000,4000000,0x642562115cf5a5e72ab517e6448ec8b61843dac9,0x642562115cf5a5e72ab517e6448ec8b61843dac9,0x1abaea1f7c830bd89acc67ec4af516284b1bc33c,0x6c3f90f043a72fa612cbac8115ee7e52bde6e490,,,0x1abaea1f7c830bd89acc67ec4af516284b1bc33c,0x6b175474e89094c44da98b954eedeac495271d0f,0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48,0xdac17f958d2ee523a2206206994597c13d831ec7,0xad25a97fee68e68eed9453e551d43555d7571554 -Factory V1 Meta,MXNT,crvMXNT,0x50c8f34cea0e65535fc2525b637ccd8a07c90896,no,,,200,4000000,4000000,0x50c8f34cea0e65535fc2525b637ccd8a07c90896,0x50c8f34cea0e65535fc2525b637ccd8a07c90896,0xed03ed872159e199065401b6d0d487d78d9464aa,0x6c3f90f043a72fa612cbac8115ee7e52bde6e490,,,0xed03ed872159e199065401b6d0d487d78d9464aa,0x6b175474e89094c44da98b954eedeac495271d0f,0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48,0xdac17f958d2ee523a2206206994597c13d831ec7, -Factory V1 Meta,alUSDFRAXBP,ALUSDFRXBP,0x2ed1d3e7771d64feed7ae8f25b4032c8dd2d0b99,no,,,200,4000000,4000000,0x2ed1d3e7771d64feed7ae8f25b4032c8dd2d0b99,0x2ed1d3e7771d64feed7ae8f25b4032c8dd2d0b99,0xbc6da0fe9ad5f3b0d58160288917aa56653660e9,,,,0xbc6da0fe9ad5f3b0d58160288917aa56653660e9,,,, -Factory V1 Meta,3CRV/lvUSD,CRVlvUSD,0x67c7f0a63ba70a2dac69477b716551fc921aed00,no,,,10,4000000,4000000,0x67c7f0a63ba70a2dac69477b716551fc921aed00,0x67c7f0a63ba70a2dac69477b716551fc921aed00,0x99899399c097a55afb6b48f797dc5acfa7d343b1,0x6c3f90f043a72fa612cbac8115ee7e52bde6e490,,,0x99899399c097a55afb6b48f797dc5acfa7d343b1,0x6b175474e89094c44da98b954eedeac495271d0f,0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48,0xdac17f958d2ee523a2206206994597c13d831ec7,0x427aa775edab0f2d9301cd988a5a99ba6cc792e6 -Factory V1 Meta,USDi,USDi-3CRV,0x63594b2011a0f2616586bf3eef8096d42272f916,no,,,1000,4000000,4000000,0x63594b2011a0f2616586bf3eef8096d42272f916,0x63594b2011a0f2616586bf3eef8096d42272f916,0x2a54ba2964c8cd459dc568853f79813a60761b58,0x6c3f90f043a72fa612cbac8115ee7e52bde6e490,,,0x2a54ba2964c8cd459dc568853f79813a60761b58,0x6b175474e89094c44da98b954eedeac495271d0f,0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48,0xdac17f958d2ee523a2206206994597c13d831ec7, -Factory V1 Meta,OMI/USD,OMIUSD,0x8116e7c29f60fdacf3954891a038f845565ef5a0,no,,,200,40000000,40000000,0x8116e7c29f60fdacf3954891a038f845565ef5a0,0x8116e7c29f60fdacf3954891a038f845565ef5a0,0xed35af169af46a02ee13b9d79eb57d6d68c1749e,0x6c3f90f043a72fa612cbac8115ee7e52bde6e490,,,0xed35af169af46a02ee13b9d79eb57d6d68c1749e,0x6b175474e89094c44da98b954eedeac495271d0f,0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48,0xdac17f958d2ee523a2206206994597c13d831ec7, -Factory V1 Meta,MBSC DeFi (USD),MBSC,0xee60f4a3487c07b4570ccffef315401c4c5744c8,no,,,100,5000000,5000000,0xee60f4a3487c07b4570ccffef315401c4c5744c8,0xee60f4a3487c07b4570ccffef315401c4c5744c8,0x8e3cf6478582a87a30cd5e6a10e939b642cd7c16,0x6c3f90f043a72fa612cbac8115ee7e52bde6e490,,,0x8e3cf6478582a87a30cd5e6a10e939b642cd7c16,0x6b175474e89094c44da98b954eedeac495271d0f,0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48,0xdac17f958d2ee523a2206206994597c13d831ec7, -Factory V1 Meta,Ubiquity 3Pool,uAD3crv,0x9558b18f021fc3cba1c9b777603829a42244818b,no,,,10,4000000,4000000,0x9558b18f021fc3cba1c9b777603829a42244818b,0x9558b18f021fc3cba1c9b777603829a42244818b,0x0f644658510c95cb46955e55d7ba9dda9e9fbec6,0x6c3f90f043a72fa612cbac8115ee7e52bde6e490,,,0x0f644658510c95cb46955e55d7ba9dda9e9fbec6,0x6b175474e89094c44da98b954eedeac495271d0f,0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48,0xdac17f958d2ee523a2206206994597c13d831ec7, -Factory V1 Meta,home,HOME+3crv,0x5c6a6cf9ae657a73b98454d17986af41fc7b44ee,no,,,200,4000000,4000000,0x5c6a6cf9ae657a73b98454d17986af41fc7b44ee,0x5c6a6cf9ae657a73b98454d17986af41fc7b44ee,0xb8919522331c59f5c16bdfaa6a121a6e03a91f62,0x6c3f90f043a72fa612cbac8115ee7e52bde6e490,,,0xb8919522331c59f5c16bdfaa6a121a6e03a91f62,0x6b175474e89094c44da98b954eedeac495271d0f,0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48,0xdac17f958d2ee523a2206206994597c13d831ec7,0xe277dd681d966e83f68e5bc7fbfeaf5f1341195f -Factory V1 Meta,3CRVUST,CRVUST,0xbf5d9decccc762fa7b5eb9fac668c803d42d97b6,no,,,10,4000000,4000000,0xbf5d9decccc762fa7b5eb9fac668c803d42d97b6,0xbf5d9decccc762fa7b5eb9fac668c803d42d97b6,0xa47c8bf37f92abed4a126bda807a7b7498661acd,0x6c3f90f043a72fa612cbac8115ee7e52bde6e490,,,0xa47c8bf37f92abed4a126bda807a7b7498661acd,0x6b175474e89094c44da98b954eedeac495271d0f,0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48,0xdac17f958d2ee523a2206206994597c13d831ec7, -Factory V1 Meta,$Pc/ETH,$Pc,0x6f80b9543dd5a0408f162fe2a1675db70a2cb77d,no,,,10,4000000,4000000,0x6f80b9543dd5a0408f162fe2a1675db70a2cb77d,0x6f80b9543dd5a0408f162fe2a1675db70a2cb77d,0x2fe269292f74f0a98c5786088317b4f86313c211,0x6c3f90f043a72fa612cbac8115ee7e52bde6e490,,,0x2fe269292f74f0a98c5786088317b4f86313c211,0x6b175474e89094c44da98b954eedeac495271d0f,0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48,0xdac17f958d2ee523a2206206994597c13d831ec7, -Factory V1 Meta,PUSd,PUSd-,0x8ee017541375f6bcd802ba119bddc94dad6911a1,no,,,100,4000000,4000000,0x8ee017541375f6bcd802ba119bddc94dad6911a1,0x8ee017541375f6bcd802ba119bddc94dad6911a1,0x466a756e9a7401b5e2444a3fcb3c2c12fbea0a54,0x6c3f90f043a72fa612cbac8115ee7e52bde6e490,,,0x466a756e9a7401b5e2444a3fcb3c2c12fbea0a54,0x6b175474e89094c44da98b954eedeac495271d0f,0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48,0xdac17f958d2ee523a2206206994597c13d831ec7,0x89664d561e79ca22fd2ea4076b3e5def0b219c15 -Factory V1 Meta,PUSd,PUSd-3CRV,0xeb07fcd7a8627281845ba3acbed24435802d4b52,no,,,100,4000000,4000000,0xeb07fcd7a8627281845ba3acbed24435802d4b52,0xeb07fcd7a8627281845ba3acbed24435802d4b52,0x466a756e9a7401b5e2444a3fcb3c2c12fbea0a54,0x6c3f90f043a72fa612cbac8115ee7e52bde6e490,,,0x466a756e9a7401b5e2444a3fcb3c2c12fbea0a54,0x6b175474e89094c44da98b954eedeac495271d0f,0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48,0xdac17f958d2ee523a2206206994597c13d831ec7, -Factory V1 Meta,pbtc,pbtc,0xc9467e453620f16b57a34a770c6bcebece002587,no,,,200,4000000,4000000,0xc9467e453620f16b57a34a770c6bcebece002587,0xc9467e453620f16b57a34a770c6bcebece002587,0x62199b909fb8b8cf870f97bef2ce6783493c4908,0x075b1bb99792c9e1041ba13afef80c91a1e70fb3,,,0x62199b909fb8b8cf870f97bef2ce6783493c4908,0xeb4c2781e4eba804ce9a9803c67d0893436bb27d,0x2260fac5e5542a773aa44fbcfedf7c193bc2c599,0xfe18be6b3bd88a2d2a7f928d00292e7a9963cfc6,0xb5efa93d5d23642f970af41a1ea9a26f19cbd2eb -Factory V2,[Test] Test CTDL/wBTC,testCTDL,0x3c42b0f384d2912661c940d46cffe1cd10f1c66f,no,,,400000,26000000,45000000,0xe2b11613bbe8e09f73fa81b4a09f0dadb20f5df6,0x3c42b0f384d2912661c940d46cffe1cd10f1c66f,0xaf0b1fdf9c6bfec7b3512f207553c0ba00d7f1a2,0x2260fac5e5542a773aa44fbcfedf7c193bc2c599,,,,,,, -Factory V2,CXD/USDC,CXDUSDC,0x4535913573d299a6372ca43b90aa6be1cf68f779,no,,,400000,26000000,45000000,0x70a03471b4f2dee5174ade1165742e2d3fed2e27,0x4535913573d299a6372ca43b90aa6be1cf68f779,0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48,0x5a56da75c50aa2733f5fa9a2442aaefcbc60b2e6,,,,,,, -Factory V2,CXD/ETH,CXDETH,0x5d898fd41875b14c1781fb497aecab8e9b24dfc9,no,,,400000,26000000,45000000,0x1979f8296492ff9e6527eca47fc44bb30c391139,0x5d898fd41875b14c1781fb497aecab8e9b24dfc9,0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2,0x5a56da75c50aa2733f5fa9a2442aaefcbc60b2e6,,,,,,, -Factory V2,ETH/VIRTUE,ETHVIRT,0xd0a1d2a9350824516ae8729b8311557ba7e55bff,no,,,400000,30000000,100000000,0x94f6c0201e1bfcba290345338c3c4abc1901d336,0xd0a1d2a9350824516ae8729b8311557ba7e55bff,0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2,0x9416ba76e88d873050a06e5956a3ebf10386b863,,,,,,, -Factory V2,VIRTUE/ETH,VIRTETH,0xb2e113a6b8edea086a44b1509013c4fc69ec4bf0,no,,,400000,30000000,100000000,0x203dd977cdb764176ac0fa12f96b3da377fdf5e5,0xb2e113a6b8edea086a44b1509013c4fc69ec4bf0,0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2,0x9416ba76e88d873050a06e5956a3ebf10386b863,,,,,,, -Factory V2,FPI2Pool,FPIFRAX,0xf861483fa7e511fbc37487d91b6faa803af5d37c,no,,,200000000,15000000,30000000,0x4704ab1fb693ce163f7c9d3a31b3ff4eaf797714,0xf861483fa7e511fbc37487d91b6faa803af5d37c,0x853d955acef822db058eb8505911ed77f175b99e,0x5ca135cb8527d76e932f34b5145575f9d8cbe08e,,,,,,, -Factory V2,VNXAU/USDC,VNXAUSDC,0x62d1d9065b4c78964040b640ab404d86d8f68263,no,,,200000000,5000000,45000000,0xfbe8925bdee1c5dd778b3e2ac3ffaeaac462f3c9,0x62d1d9065b4c78964040b640ab404d86d8f68263,0x6d57b2e05f26c26b549231c866bdd39779e4a488,0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48,,,,,,, -Factory V2,CADC/3CRV,CADC3CRV,0x595146ed98c81dde9bd23d0c2ab5b807c7fe2d9f,no,,,200000000,5000000,45000000,0x7372601c874a8fa339f52bf0673d14e86f550bfb,0x595146ed98c81dde9bd23d0c2ab5b807c7fe2d9f,0xcadc0acd4b445166f12d2c07eac6e2544fbe2eef,0x6c3f90f043a72fa612cbac8115ee7e52bde6e490,,,,,,, -Factory V2,CNC/ETH,CNCETH,0x838af967537350d2c44abb8c010e49e32673ab94,no,,,400000,26000000,45000000,0xf9835375f6b268743ea0a54d742aa156947f8c06,0x838af967537350d2c44abb8c010e49e32673ab94,0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2,0x9ae380f0272e2162340a5bb646c354271c0f5cfc,,,,,,, -Factory V2,CNC/ETH,CNCETH,0x782115c863a05abf8795df377d89aad1aadf4dfa,no,,,400000,26000000,45000000,0xc0f888d0987287aa1d09cac49f2cca89f7bbe774,0x782115c863a05abf8795df377d89aad1aadf4dfa,0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2,0x9ae380f0272e2162340a5bb646c354271c0f5cfc,,,,,,, -Factory V2,JPEG/ETH,JPEGETH,0x7e050cf658777cc1da4a4508e79d71859044b60e,no,,,400000,26000000,45000000,0x34ed182d0812d119c92907852d2b429f095a9b07,0x7e050cf658777cc1da4a4508e79d71859044b60e,0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2,0xe80c0cd204d654cebe8dd64a4857cab6be8345a3,,,,,,, -Factory V2,eth/nfd,nfdeth,0x7472764c28f843ba246f294c44de9456911a3454,no,,,400000,26000000,45000000,0x5d331b8c8f87130ffbe55011d9d0f74a7af9a21c,0x7472764c28f843ba246f294c44de9456911a3454,0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2,0xdfdb7f72c1f195c5951a234e8db9806eb0635346,,,,,,, -Factory V2,LFT/ETH,LFTETH,0xfe4a08f22fe65759ba91db2e2cada09b4415b0d7,no,,,400000,26000000,45000000,0x401322b9fddba8c0a8d40fbcece1d1752c12316b,0xfe4a08f22fe65759ba91db2e2cada09b4415b0d7,0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2,0xb620be8a1949aa9532e6a3510132864ef9bc3f82,,,,,,, -Factory V2,JZC Miners,JZC/ETH,0x86cf48e9735f84d3311141e8941b2494fb4b8142,no,,,400000,26000000,45000000,0x1b8577b2d5cde12f29f01c5c4d5420e5f4b25e5f,0x86cf48e9735f84d3311141e8941b2494fb4b8142,0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2,0x7bb46c33a972349ef48e7545cac068fb77b89e5a,,,,,,, -Factory V2,KP3R/ETH,KP3RETH,0x21410232b484136404911780bc32756d5d1a9fa9,no,,,400000,26000000,45000000,0x4647b6d835f3b393c7a955df51eefcf0db961606,0x21410232b484136404911780bc32756d5d1a9fa9,0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2,0x1ceb5cb57c4d4e2b2433641b95dd330a33185a44,,,,,,, -Factory V2,PAL/ETH,PALETH,0x75a6787c7ee60424358b449b539a8b774c9b4862,no,,,400000,26000000,45000000,0xbe4f3ad6c9458b901c81b734cb22d9eae9ad8b50,0x75a6787c7ee60424358b449b539a8b774c9b4862,0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2,0xab846fb6c81370327e784ae7cbb6d6a6af6ff4bf,,,,,,, -Factory V2,USDC/STG,USDCSTG,0x751d3feffed0890b76e9b86476cfeeaa1fcda73d,no,,,400000,26000000,45000000,0x61bfabe002d2617b897c0a40f4ad45c9fde1b88b,0x751d3feffed0890b76e9b86476cfeeaa1fcda73d,0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48,0xaf5191b0de278c7286d6c7cc6ab6bb8a73ba2cd6,,,,,,, -Factory V2,USDC/STG,USDCSTG,0x39567db64f0b25db2c35fc7a4f60c3c5258e4654,no,,,400000,26000000,45000000,0x09eff23aeff4b0a89a31fbcaad85ee7248a5ac83,0x39567db64f0b25db2c35fc7a4f60c3c5258e4654,0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48,0xaf5191b0de278c7286d6c7cc6ab6bb8a73ba2cd6,,,,,,, -Factory V2,Test,AAA,0xa6b28989b81b2fe4ec03fde324de1a99ae4366e4,no,,,200000000,5000000,45000000,0xaf0c83990e3fd6a6999d364ee7bf0c9fddcf43e0,0xa6b28989b81b2fe4ec03fde324de1a99ae4366e4,0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48,0x514910771af9ca656af840dff83e8264ecf986ca,,,,,,, -Factory V2,ALUSD/BNT,ALUSDBNT,0x6b234f354eda8fae082be20dcf790fd886b42340,no,,,100000000,6500000,45000000,0xa21da2e5335cb06b3d031732c496e334386c1de4,0x6b234f354eda8fae082be20dcf790fd886b42340,0xbc6da0fe9ad5f3b0d58160288917aa56653660e9,0x1f573d6fb3f13d689ff844b4ce37794d79a7ff1c,,,,,,, -Factory V2,ibKRW/USDC,ibKRWUSDC,0xef04f337fcb2ea220b6e8db5edbe2d774837581c,no,,,200000000,5000000,45000000,0x80caccdbd3f07bbdb558db4a9e146d099933d677,0xef04f337fcb2ea220b6e8db5edbe2d774837581c,0x95dfdc8161832e4ff7816ac4b6367ce201538253,0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48,,,,,,, -Factory V2,ibJPY/USDC,ibJPYUSDC,0xeb0265938c1190ab4e3e1f6583bc956df47c0f93,no,,,200000000,5000000,45000000,0x127091ede112aed7bae281747771b3150bb047bb,0xeb0265938c1190ab4e3e1f6583bc956df47c0f93,0x5555f75e3d5278082200fb451d1b6ba946d8e13b,0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48,,,,,,, -Factory V2,ibGBP/USDC,ibGBPUSDC,0xacce4fe9ce2a6fe9af83e7cf321a3ff7675e0ab6,no,,,200000000,5000000,45000000,0x22cf19eb64226e0e1a79c69b345b31466fd273a7,0xacce4fe9ce2a6fe9af83e7cf321a3ff7675e0ab6,0x69681f8fde45345c3870bcd5eaf4a05a60e7d227,0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48,,,,,,, -Factory V2,ibCHF/USDC,ibCHFUSDC,0x6df0d77f0496ce44e72d695943950d8641fca5cf,no,,,200000000,5000000,45000000,0x08cea8e5b4551722deb97113c139dd83c26c5398,0x6df0d77f0496ce44e72d695943950d8641fca5cf,0x1cc481ce2bd2ec7bf67d1be64d4878b16078f309,0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48,,,,,,, -Factory V2,ibAUD/USDC,ibAUDUSDC,0x5b692073f141c31384fae55856cfb6cbffe91e60,no,,,200000000,5000000,45000000,0x54c8ecf46a81496eeb0608bd3353388b5d7a2a33,0x5b692073f141c31384fae55856cfb6cbffe91e60,0xfafdf0c4c1cb09d430bf88c75d88bb46dae09967,0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48,,,,,,, -Factory V1 Plain,Curve sETH2-stETH,sETH2stETH,0xd1011b637f979a5d9093df1b32e7736c289024f5,no,,,50,4000000,4000000,0xd1011b637f979a5d9093df1b32e7736c289024f5,0xd1011b637f979a5d9093df1b32e7736c289024f5,0xfe2e637202056d30016725477c5da089ab0a043a,0xae7ab96520de3a18e5e111b5eaab095312d7fe84,0x0000000000000000000000000000000000000000,0x0000000000000000000000000000000000000000,,,,, -Factory V1 Plain,sETH2/stETH,sETH2stETH,0xe95e4c2dac312f31dc605533d5a4d0af42579308,no,,,50,4000000,4000000,0xe95e4c2dac312f31dc605533d5a4d0af42579308,0xe95e4c2dac312f31dc605533d5a4d0af42579308,0xfe2e637202056d30016725477c5da089ab0a043a,0xae7ab96520de3a18e5e111b5eaab095312d7fe84,0x0000000000000000000000000000000000000000,0x0000000000000000000000000000000000000000,,,,,0xecb860e54e33fea8fab5b076734e2591d1a9eba4 -Factory V1 Plain,TriCRV,TriCRV,0x6577b46a566ade492ad551a315c04de3fbe3dbfa,no,,,50,30000000,30000000,0x6577b46a566ade492ad551a315c04de3fbe3dbfa,0x6577b46a566ade492ad551a315c04de3fbe3dbfa,0xd6ecdfd41ddb7167f3ed9b37f33fb24d57543e26,0x62b9c7356a2dc64a1969e19c23e4f579f9810aa7,0xd533a949740bb3306d119cc777fa900ba034cd52,0x0000000000000000000000000000000000000000,,,,,0x29e86ff40fad527fe54af75afe3bb89708af3aa7 -Factory V1 Plain,sdCRV,sdCRVCRV,0x323b3a6e7a71c1b8c257606ef0364d61df8aa525,no,,,10,4000000,4000000,0x323b3a6e7a71c1b8c257606ef0364d61df8aa525,0x323b3a6e7a71c1b8c257606ef0364d61df8aa525,0xd533a949740bb3306d119cc777fa900ba034cd52,0xd1b5651e55d4ceed36251c61c50c889b36f6abb5,0x0000000000000000000000000000000000000000,0x0000000000000000000000000000000000000000,,,,, -Factory V1 Plain,sdCRV,sdCRVCRV,0xf7b55c3732ad8b2c2da7c24f30a69f55c54fb717,no,,,10,4000000,4000000,0xf7b55c3732ad8b2c2da7c24f30a69f55c54fb717,0xf7b55c3732ad8b2c2da7c24f30a69f55c54fb717,0xd533a949740bb3306d119cc777fa900ba034cd52,0xd1b5651e55d4ceed36251c61c50c889b36f6abb5,0x0000000000000000000000000000000000000000,0x0000000000000000000000000000000000000000,,,,,0x663fc22e92f26c377ddf3c859b560c4732ee639a -Factory V1 Plain,mCRV-CRV,mCRV-CRV,0xf74bec4bcf432a17470e9c4f71542f2677b9af6a,no,,,10,15000000,15000000,0xf74bec4bcf432a17470e9c4f71542f2677b9af6a,0xf74bec4bcf432a17470e9c4f71542f2677b9af6a,0x79317218de52dfa2a233a3aeed098161889418c7,0xd533a949740bb3306d119cc777fa900ba034cd52,0x0000000000000000000000000000000000000000,0x0000000000000000000000000000000000000000,,,,, -Factory V1 Plain,FRAX/ARTH.usd,FRAXARTHu,0x5a59fd6018186471727faaeae4e57890abc49b08,no,,,100,4000000,4000000,0x5a59fd6018186471727faaeae4e57890abc49b08,0x5a59fd6018186471727faaeae4e57890abc49b08,0x973f054edbecd287209c36a2651094fa52f99a71,0x853d955acef822db058eb8505911ed77f175b99e,0x0000000000000000000000000000000000000000,0x0000000000000000000000000000000000000000,,,,, -Factory V1 Plain,CLever CVX,clevCVX,0xaa6a4f8ddcca7d3b9e7ad38c8338a2fcfdb1e713,no,,,200,4000000,4000000,0xaa6a4f8ddcca7d3b9e7ad38c8338a2fcfdb1e713,0xaa6a4f8ddcca7d3b9e7ad38c8338a2fcfdb1e713,0x4e3fbd56cd56c3e72c1403e103b45db9da5b9d2b,0xf05e58fcea29ab4da01a495140b349f8410ba904,0x0000000000000000000000000000000000000000,0x0000000000000000000000000000000000000000,,,,, -Factory V1 Plain,CLever CVX,clevCVX,0x8c1de7a8f8852197b109daf75a6fbb685c013315,no,,,200,20000000,20000000,0x8c1de7a8f8852197b109daf75a6fbb685c013315,0x8c1de7a8f8852197b109daf75a6fbb685c013315,0x4e3fbd56cd56c3e72c1403e103b45db9da5b9d2b,0xf05e58fcea29ab4da01a495140b349f8410ba904,0x0000000000000000000000000000000000000000,0x0000000000000000000000000000000000000000,,,,,0x0e9470d9e8f5c726158704b982c6de1466372ef2 -Factory V2,ibEUR/USDC,ibEURUSDC,0x1570af3df649fc74872c5b8f280a162a3bdd4eb6,no,,,200000000,5000000,45000000,0x8682fbf0cbf312c891532ba9f1a91e44f81ad7df,0x1570af3df649fc74872c5b8f280a162a3bdd4eb6,0x96e61422b6a9ba0e068b6c5add4ffabc6a4aae27,0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48,,,,,,, -Factory V1 Plain,ApeUSD-FRAX,ApeUSDFRAX,0x1977870a4c18a728c19dd4eb6542451df06e0a4b,no,,,200,4000000,4000000,0x1977870a4c18a728c19dd4eb6542451df06e0a4b,0x1977870a4c18a728c19dd4eb6542451df06e0a4b,0xff709449528b6fb6b88f557f7d93dece33bca78d,0x853d955acef822db058eb8505911ed77f175b99e,0x0000000000000000000000000000000000000000,0x0000000000000000000000000000000000000000,,,,, -Factory V1 Plain,CPI2Pool,FPIVOLT,0x07350d8c30d463179de6a58764c21558db66dd9c,no,,,200,4000000,4000000,0x07350d8c30d463179de6a58764c21558db66dd9c,0x07350d8c30d463179de6a58764c21558db66dd9c,0x853d955acef822db058eb8505911ed77f175b99e,0x559ebc30b0e58a45cc9ff573f77ef1e5eb1b3e18,0x0000000000000000000000000000000000000000,0x0000000000000000000000000000000000000000,,,,, -Factory V1 Plain,CPI2Pool,FPIVOLT,0xc38ca214c7a82b1ee977232f045afb6d425cfff0,no,,,200,4000000,4000000,0xc38ca214c7a82b1ee977232f045afb6d425cfff0,0xc38ca214c7a82b1ee977232f045afb6d425cfff0,0x5ca135cb8527d76e932f34b5145575f9d8cbe08e,0x559ebc30b0e58a45cc9ff573f77ef1e5eb1b3e18,0x0000000000000000000000000000000000000000,0x0000000000000000000000000000000000000000,,,,, -Factory V1 Plain,pxCVX/CVX,pxCVX,0xf38a67da7a3a12aa12a9981ae6a79c0fdddd71ab,no,,,50,15000000,15000000,0xf38a67da7a3a12aa12a9981ae6a79c0fdddd71ab,0xf38a67da7a3a12aa12a9981ae6a79c0fdddd71ab,0xbce0cf87f513102f22232436cca2ca49e815c3ac,0x4e3fbd56cd56c3e72c1403e103b45db9da5b9d2b,0x0000000000000000000000000000000000000000,0x0000000000000000000000000000000000000000,,,,, -Factory V2,COMP/ETH,COMPETH,0x9c6751593a1424108f53e5ad6754940fedaa5bc0,no,,,400000,26000000,45000000,0x675eaafa53d80400bc4144876f467622f628ebcb,0x9c6751593a1424108f53e5ad6754940fedaa5bc0,0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2,0xc00e94cb662c3520282e6f5717214004a7f26888,,,,,,, -Factory V1 Plain,WOMI/OMI,WOMIOMI,0xee98d56f60a5905cbb52348c8719b247dafe60ec,no,,,10,10000000,10000000,0xee98d56f60a5905cbb52348c8719b247dafe60ec,0xee98d56f60a5905cbb52348c8719b247dafe60ec,0x04969cd041c0cafb6ac462bd65b536a5bdb3a670,0xed35af169af46a02ee13b9d79eb57d6d68c1749e,0x0000000000000000000000000000000000000000,0x0000000000000000000000000000000000000000,,,,, -Factory V1 Plain,dfxSGD/XSGD,dfx2SGD,0x943b7e761f34866da12c9b84c99888fe2ef607c5,no,,,100,4000000,4000000,0x943b7e761f34866da12c9b84c99888fe2ef607c5,0x943b7e761f34866da12c9b84c99888fe2ef607c5,0x52ddda10eb0abdb34528329c4af16d218ab95bd1,0x70e8de73ce538da2beed35d14187f6959a8eca96,0x0000000000000000000000000000000000000000,0x0000000000000000000000000000000000000000,,,,, -Factory V1 Plain,yveCRV,yvecrv,0x7e46fd8a30869aa9ed55af031067df666efe87da,no,,,50,15000000,15000000,0x7e46fd8a30869aa9ed55af031067df666efe87da,0x7e46fd8a30869aa9ed55af031067df666efe87da,0xd533a949740bb3306d119cc777fa900ba034cd52,0xc5bddf9843308380375a611c18b50fb9341f502a,0x0000000000000000000000000000000000000000,0x0000000000000000000000000000000000000000,,,,, -Factory V1 Plain,Euro Pool,europool,0xe7a3b38c39f97e977723bd1239c3470702568e7b,no,,,10,4000000,4000000,0xe7a3b38c39f97e977723bd1239c3470702568e7b,0xe7a3b38c39f97e977723bd1239c3470702568e7b,0xee586e7eaad39207f0549bc65f19e336942c992f,0x1a7e4e63778b4f12a199c062f3efdd288afcbce8,0x1abaea1f7c830bd89acc67ec4af516284b1bc33c,0x0000000000000000000000000000000000000000,,,,,0x9f57569eaa61d427deeebac8d9546a745160391c -Factory V1 Plain,MATIC/FLEET,MATICFLEET,0xd7c10449a6d134a9ed37e2922f8474eac6e5c100,no,,,10,4000000,4000000,0xd7c10449a6d134a9ed37e2922f8474eac6e5c100,0xd7c10449a6d134a9ed37e2922f8474eac6e5c100,0xfd56a3dcfc0690881a466ae432d71bb2db588083,0x7d1afa7b718fb893db30a3abc0cfc608aacfebb0,0x0000000000000000000000000000000000000000,0x0000000000000000000000000000000000000000,,,,, -Factory V1 Plain,Euro Pool,europool,0xf70c5c65cf6a28e7a4483f52511e5a29678e4ffd,no,,,10,4000000,4000000,0xf70c5c65cf6a28e7a4483f52511e5a29678e4ffd,0xf70c5c65cf6a28e7a4483f52511e5a29678e4ffd,0xee586e7eaad39207f0549bc65f19e336942c992f,0x1a7e4e63778b4f12a199c062f3efdd288afcbce8,0x1abaea1f7c830bd89acc67ec4af516284b1bc33c,0x0000000000000000000000000000000000000000,,,,, -Factory V1 Plain,GCD / USDP,GCDUSDP,0x649c1b0e70a80210bcfb3c4eb5ddad175b90be4d,no,,,100,4000000,4000000,0x649c1b0e70a80210bcfb3c4eb5ddad175b90be4d,0x649c1b0e70a80210bcfb3c4eb5ddad175b90be4d,0x213ecae6b3cbc0ad976f7d82626546d5b63a71cb,0x1456688345527be1f37e9e627da0837d6f08c925,0x0000000000000000000000000000000000000000,0x0000000000000000000000000000000000000000,,,,, -Factory V1 Plain,stETH/aETHb,stETHaETHb,0x875df0ba24ccd867f8217593ee27253280772a97,no,,,100,4000000,4000000,0x875df0ba24ccd867f8217593ee27253280772a97,0x875df0ba24ccd867f8217593ee27253280772a97,0xae7ab96520de3a18e5e111b5eaab095312d7fe84,0xd01ef7c0a5d8c432fc2d1a85c66cf2327362e5c6,0x0000000000000000000000000000000000000000,0x0000000000000000000000000000000000000000,,,,, -Factory V1 Plain,sdLFT,sdLFTLFT,0xc69b00366f07840ff939cc9fdf866c3dccb10804,no,,,10,4000000,4000000,0xc69b00366f07840ff939cc9fdf866c3dccb10804,0xc69b00366f07840ff939cc9fdf866c3dccb10804,0xb620be8a1949aa9532e6a3510132864ef9bc3f82,0x0879c1a344910c2944c29b892a1cf0c216122c66,0x0000000000000000000000000000000000000000,0x0000000000000000000000000000000000000000,,,,, -Factory V2,AAVE/ETH,AAVEETH,0xbf9702efefe1303a61b7c944b5741b773dd930a7,no,,,400000,26000000,45000000,0xd0ed79293aeb9705944aef1871f09d6cbeb8fb54,0xbf9702efefe1303a61b7c944b5741b773dd930a7,0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2,0x7fc66500c84a76ad7e9c93437bfc5ac33e2ddae9,,,,,,, -Factory V2,MKR/ETH,MKRETH,0x90ce3285a9cce2d36149f12df2c1e357af304a1d,no,,,400000,26000000,45000000,0xd7d81c8665dcd3e6960afe64f204a564d8f8c54b,0x90ce3285a9cce2d36149f12df2c1e357af304a1d,0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2,0x9f8f72aa9304c8b593d555f12ef6589cc3a579a2,,,,,,, -Factory V2,Goldfinch FIDU/USDC,fidu-usdc,0x80aa1a80a30055daa084e599836532f3e58c95e2,no,,,200000000,5000000,45000000,0x42ec68ca5c2c80036044f3eead675447ab3a8065,0x80aa1a80a30055daa084e599836532f3e58c95e2,0x6a445e9f40e0b97c92d0b8a3366cef1d67f700bf,0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48,,,,,,, -Factory V1 Plain,frxETH,frxETH,0x7c0316c925e12ebfc55e0f325794b43ead425157,no,,,100,4000000,4000000,0x7c0316c925e12ebfc55e0f325794b43ead425157,0x7c0316c925e12ebfc55e0f325794b43ead425157,0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee,0x00000000008fd4f395ec6f12920bae9cb6c722e4,0x0000000000000000000000000000000000000000,0x0000000000000000000000000000000000000000,,,,, -Factory V1 Plain,Tokemak tMYC/MYC,tMYC,0x83d78bf3f861e898cca47bd076b3839ab5469d70,no,,,1000000000,4000000,4000000,0x83d78bf3f861e898cca47bd076b3839ab5469d70,0x83d78bf3f861e898cca47bd076b3839ab5469d70,0x061aee9ab655e73719577ea1df116d7139b2a7e7,0x4b13006980acb09645131b91d259eaa111eaf5ba,0x0000000000000000000000000000000000000000,0x0000000000000000000000000000000000000000,,,,, -Factory V1 Plain,agEUR/EUROC,agEUREUROC,0xba866791f98098df41c3187d4d5433be29215c79,no,,,200,4000000,4000000,0xba866791f98098df41c3187d4d5433be29215c79,0xba866791f98098df41c3187d4d5433be29215c79,0x1a7e4e63778b4f12a199c062f3efdd288afcbce8,0x1abaea1f7c830bd89acc67ec4af516284b1bc33c,0x0000000000000000000000000000000000000000,0x0000000000000000000000000000000000000000,,,,, -Factory V1 Plain,agEUR/EUROC,agEUREUROC,0xba3436fd341f2c8a928452db3c5a3670d1d5cc73,no,,,1000,4000000,4000000,0xba3436fd341f2c8a928452db3c5a3670d1d5cc73,0xba3436fd341f2c8a928452db3c5a3670d1d5cc73,0x1a7e4e63778b4f12a199c062f3efdd288afcbce8,0x1abaea1f7c830bd89acc67ec4af516284b1bc33c,0x0000000000000000000000000000000000000000,0x0000000000000000000000000000000000000000,,,,,0xf9f46ef781b9c7b76e8b505226d5e0e0e7fe2f04 -Factory V1 Plain,cbETH,cbETHETH,0x6e8d2b6fb24117c675c2fabc524f28cc5d81f18a,no,,,100,4000000,4000000,0x6e8d2b6fb24117c675c2fabc524f28cc5d81f18a,0x6e8d2b6fb24117c675c2fabc524f28cc5d81f18a,0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee,0xbe9895146f7af43049ca1c1ae358b0541ea49704,0x0000000000000000000000000000000000000000,0x0000000000000000000000000000000000000000,,,,, -Factory V1 Plain,aETH,aETH,0xc22936d5ece78c048d6e7fe5d9f77fb6caa16dbb,no,,,10,10000000,10000000,0xc22936d5ece78c048d6e7fe5d9f77fb6caa16dbb,0xc22936d5ece78c048d6e7fe5d9f77fb6caa16dbb,0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee,0x030ba81f1c18d280636f32af80b9aad02cf0854e,0x0000000000000000000000000000000000000000,0x0000000000000000000000000000000000000000,,,,, -Factory V2,SILO/FRAX,silofrax,0x9a22cdb1ca1cdd2371cd5bb5199564c4e89465eb,no,,,400000,26000000,45000000,0x2302aabe69e6e7a1b0aa23aac68fccb8a4d2b460,0x9a22cdb1ca1cdd2371cd5bb5199564c4e89465eb,0x6f80310ca7f2c654691d1383149fa1a57d8ab1f8,0x853d955acef822db058eb8505911ed77f175b99e,,,,,,, -Factory V2,OHM/ETH,OHMETH,0x6ec38b3228251a0c5d491faf66858e2e23d7728b,no,,,400000,26000000,45000000,0x3660bd168494d61ffdac21e403d0f6356cf90fd7,0x6ec38b3228251a0c5d491faf66858e2e23d7728b,0x64aa3364f17a4d01c6f1751fd97c2bd3d7e7f1d5,0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2,,,,,,, -Factory V2,OHM/ETH,OHMETH,0x365901db5adb4c789801f19d5f1f46c574783ad6,no,,,400000,26000000,45000000,0xbce2c09c6757cf002dfba4e8b9c6f3d3437dc8dc,0x365901db5adb4c789801f19d5f1f46c574783ad6,0x64aa3364f17a4d01c6f1751fd97c2bd3d7e7f1d5,0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2,,,,,,, -Factory V2,YFI/ETH,YFIETH,0xc26b89a667578ec7b3f11b2f98d6fd15c07c54ba,yes,curvefi,yfieth_swap,400000,26000000,45000000,0x29059568bb40344487d62f7450e78b8e6c74e0e5,0xc26b89a667578ec7b3f11b2f98d6fd15c07c54ba,0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2,0x0bc529c00c6401aef6d220be8c6ea1667f6ad93e,,,,,,, -Regular,y,y,0x45f783cce6b7ff23b2ab2d70e416cdb7d6055f51,yes,curvefi,y_swap,,,,0xdf5e0e81dff6faf3a7e52ba697820c5e32d806a8,0xbbc81d23ea2c3ec7e56d39296f0cbb648873a5d3,0x16de59092dae5ccf4a1e6439d611fd0653f0bd01,0xd6ad7a6750a7593e092a9b218d66c0a814a3436e,0x83f798e925bcd4017eb265844fddabb448f1707d,0x73a052500105205d34daf004eab301916da8190f,0x6b175474e89094c44da98b954eedeac495271d0f,0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48,0xdac17f958d2ee523a2206206994597c13d831ec7,0x0000000000085d4780b73119b644ae5ecd22b376,0xfa712ee4788c042e2b7bb55e6cb8ec569c4530c1 -Regular,xautusd,xautusd,0xadcfcf9894335dc340f6cd182afa45999f45fc44,yes,curvefi,xautusd_swap,,,,0x8484673ca7bff40f82b041916881aea15ee84834,0xc5fa220347375ac4f91f9e4a4aab362f22801504,0x68749665ff8d2d112fa859aa293f07a622782f38,0x6c3f90f043a72fa612cbac8115ee7e52bde6e490,,,0x68749665ff8d2d112fa859aa293f07a622782f38,0x6b175474e89094c44da98b954eedeac495271d0f,0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48,0xdac17f958d2ee523a2206206994597c13d831ec7,0x1b3e14157ed33f60668f2103bcd5db39a1573e5b -Factory V1 Meta,wormhole v2 UST-3Pool,UST_whv2,0xceaf7747579696a2f0bb206a14210e3c9e6fb269,yes,curvefi,wormhole_v2,10,4000000,4000000,0xceaf7747579696a2f0bb206a14210e3c9e6fb269,0xceaf7747579696a2f0bb206a14210e3c9e6fb269,0xa693b19d2931d498c5b318df961919bb4aee87a5,0x6c3f90f043a72fa612cbac8115ee7e52bde6e490,,,0xa693b19d2931d498c5b318df961919bb4aee87a5,0x6b175474e89094c44da98b954eedeac495271d0f,0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48,0xdac17f958d2ee523a2206206994597c13d831ec7,0xb0f5d00e5916c8b8981e99191a1458704b587b2b -Factory V1 Meta,Wasabi BTC,waBTC,0x6d0bd8365e2fcd0c2acf7d218f629a319b6c9d47,yes,curvefi,waBTC,200,4000000,4000000,0x6d0bd8365e2fcd0c2acf7d218f629a319b6c9d47,0x6d0bd8365e2fcd0c2acf7d218f629a319b6c9d47,0xfd8e70e83e399307db3978d3f34b060a06792c36,0x075b1bb99792c9e1041ba13afef80c91a1e70fb3,,,0xfd8e70e83e399307db3978d3f34b060a06792c36,0xeb4c2781e4eba804ce9a9803c67d0893436bb27d,0x2260fac5e5542a773aa44fbcfedf7c193bc2c599,0xfe18be6b3bd88a2d2a7f928d00292e7a9963cfc6, -Regular,ust,ust,0x890f4e345b1daed0367a877a1612f86a1f86985f,yes,curvefi,ust_swap,,,,0x94e131324b6054c0d789b190b2dac504e4361b53,0xb0a0716841f2fc03fba72a891b8bb13584f52f2d,0xa47c8bf37f92abed4a126bda807a7b7498661acd,0x6c3f90f043a72fa612cbac8115ee7e52bde6e490,,,0xa47c8bf37f92abed4a126bda807a7b7498661acd,0x6b175474e89094c44da98b954eedeac495271d0f,0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48,0xdac17f958d2ee523a2206206994597c13d831ec7,0x3b7020743bc2a4ca9eaf9d0722d42e20d6935855 -Factory V1 Meta,USDV,USDV,0x7abd51bba7f9f6ae87ac77e1ea1c5783ada56e5c,yes,curvefi,usdv,10,4000000,4000000,0x7abd51bba7f9f6ae87ac77e1ea1c5783ada56e5c,0x7abd51bba7f9f6ae87ac77e1ea1c5783ada56e5c,0xea3fb6f331735252e7bfb0b24b3b761301293dbe,0x6c3f90f043a72fa612cbac8115ee7e52bde6e490,,,0xea3fb6f331735252e7bfb0b24b3b761301293dbe,0x6b175474e89094c44da98b954eedeac495271d0f,0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48,0xdac17f958d2ee523a2206206994597c13d831ec7, -Regular,usdt,usdt,0x52ea46506b9cc5ef470c5bf89f17dc28bb35d85c,yes,curvefi,usdt_swap,,,,0x9fc689ccada600b6df723d9e47d84d76664a1f23,0xac795d2c97e60df6a99ff1c814727302fd747a80,0x5d3a536e4d6dbd6114cc1ead35777bab948e3643,0x39aa39c021dfbae8fac545936693ac917d5e7563,0xdac17f958d2ee523a2206206994597c13d831ec7,,0x6b175474e89094c44da98b954eedeac495271d0f,0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48,0xdac17f958d2ee523a2206206994597c13d831ec7,,0xbc89cd85491d81c6ad2954e6d0362ee29fca8f53 -Regular,usdp,usdp,0x42d7025938bec20b69cbae5a77421082407f053a,yes,curvefi,usdp_swap,,,,0x7eb40e450b9655f4b3cc4259bcc731c63ff55ae6,0x3c8caee4e09296800f8d29a68fa3837e2dae4940,0x1456688345527be1f37e9e627da0837d6f08c925,0x6c3f90f043a72fa612cbac8115ee7e52bde6e490,,,0x1456688345527be1f37e9e627da0837d6f08c925,0x6b175474e89094c44da98b954eedeac495271d0f,0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48,0xdac17f958d2ee523a2206206994597c13d831ec7,0x055be5ddb7a925bfef3417fc157f53ca77ca7222 -Regular,usdn,usdn,0x0f9cb53ebe405d49a0bbdbd291a65ff571bc83e1,yes,curvefi,usdn_swap,,,,0x4f3e8f405cf5afc05d68142f3783bdfe13811522,0x094d12e5b541784701fd8d65f11fc0598fbc6332,0x674c6ad92fd080e4004b2312b45f796a192d27a0,0x6c3f90f043a72fa612cbac8115ee7e52bde6e490,,,0x674c6ad92fd080e4004b2312b45f796a192d27a0,0x6b175474e89094c44da98b954eedeac495271d0f,0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48,0xdac17f958d2ee523a2206206994597c13d831ec7,0xf98450b5602fa59cc66e1379dffb6fddc724cfc4 -Factory V1 Meta,USDM,USDM,0x5b3b5df2bf2b6543f78e053bd91c4bdd820929f1,yes,curvefi,usdm,10,4000000,4000000,0x5b3b5df2bf2b6543f78e053bd91c4bdd820929f1,0x5b3b5df2bf2b6543f78e053bd91c4bdd820929f1,0x31d4eb09a216e181ec8a43ce79226a487d6f0ba9,0x6c3f90f043a72fa612cbac8115ee7e52bde6e490,,,0x31d4eb09a216e181ec8a43ce79226a487d6f0ba9,0x6b175474e89094c44da98b954eedeac495271d0f,0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48,0xdac17f958d2ee523a2206206994597c13d831ec7,0x9af13a7b1f1bbf1a2b05c6fbf23ac23a9e573b4e -Regular,usdk,usdk,0x3e01dd8a5e1fb3481f0f589056b428fc308af0fb,yes,curvefi,usdk_swap,,,,0x97e2768e8e73511ca874545dc5ff8067eb19b787,0xf1f85a74ad6c64315f85af52d3d46bf715236adc,0x1c48f86ae57291f7686349f12601910bd8d470bb,0x6c3f90f043a72fa612cbac8115ee7e52bde6e490,,,0x1c48f86ae57291f7686349f12601910bd8d470bb,0x6b175474e89094c44da98b954eedeac495271d0f,0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48,0xdac17f958d2ee523a2206206994597c13d831ec7,0xc2b1df84112619d190193e48148000e3990bf627 -Factory V1 Meta,USDD/3CRV,USDD3CRV,0xe6b5cc1b4b47305c58392ce3d359b10282fc36ea,yes,curvefi,usdd,200,4000000,4000000,0xe6b5cc1b4b47305c58392ce3d359b10282fc36ea,0xe6b5cc1b4b47305c58392ce3d359b10282fc36ea,0x0c10bf8fcb7bf5412187a595ab97a3609160b5c6,0x6c3f90f043a72fa612cbac8115ee7e52bde6e490,,,0x0c10bf8fcb7bf5412187a595ab97a3609160b5c6,0x6b175474e89094c44da98b954eedeac495271d0f,0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48,0xdac17f958d2ee523a2206206994597c13d831ec7,0xd5d3efc90ffb38987005fdea303b68306aa5c624 -Factory V1 Meta,tusd-3pool,tusd3pool,0xac5f019a302c4c8caac0a7f28183ac62e6e80034,yes,curvefi,tusd3pool,200,4000000,4000000,0xac5f019a302c4c8caac0a7f28183ac62e6e80034,0xac5f019a302c4c8caac0a7f28183ac62e6e80034,0xef779cf3d260dbe6177b30ff08b10db591a6dd9c,0x6c3f90f043a72fa612cbac8115ee7e52bde6e490,,,0xef779cf3d260dbe6177b30ff08b10db591a6dd9c,0x6b175474e89094c44da98b954eedeac495271d0f,0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48,0xdac17f958d2ee523a2206206994597c13d831ec7, -Regular,tusd,tusd,0xecd5e75afb02efa118af914515d6521aabd189f1,yes,curvefi,tusd,,,,0xecd5e75afb02efa118af914515d6521aabd189f1,0xa79828df1850e8a3a3064576f380d90aecdd3359,0x0000000000085d4780b73119b644ae5ecd22b376,0x6c3f90f043a72fa612cbac8115ee7e52bde6e490,,,0x0000000000085d4780b73119b644ae5ecd22b376,0x6b175474e89094c44da98b954eedeac495271d0f,0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48,0xdac17f958d2ee523a2206206994597c13d831ec7,0x359fd5d6417ae3d8d6497d9b2e7a890798262ba4 -Regular,tricrypto,tricrypto,0x80466c64868e1ab14a1ddf27a676c3fcbe638fe5,yes,curvefi,tricrypto_swap,,,,0xca3d75ac011bf5ad07a98d02f18225f9bd9a6bdf,0x331af2e331bd619defaa5dac6c038f53fcf9f785,0xdac17f958d2ee523a2206206994597c13d831ec7,0x2260fac5e5542a773aa44fbcfedf7c193bc2c599,0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2,,,,,,0x6955a55416a06839309018a8b0cb72c4ddc11f15 -Regular,tricrypto2,tricrypto2,0xd51a44d3fae010294c616388b506acda1bfaae46,yes,curvefi,tricrypto2_swap,,,,0xc4ad29ba4b3c580e6d59105fff484999997675ff,0x3993d34e7e99abf6b6f367309975d1360222d446,0xdac17f958d2ee523a2206206994597c13d831ec7,0x2260fac5e5542a773aa44fbcfedf7c193bc2c599,0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2,,,,,,0xdefd8fdd20e0f34115c7018ccfb655796f6b2168 -Factory V1 Meta,Test Pool D,TPD,0x705da2596cf6aaa2fea36f2a59985ec9e8aec7e2,yes,curvefi,tpd,10,4000000,4000000,0x705da2596cf6aaa2fea36f2a59985ec9e8aec7e2,0x705da2596cf6aaa2fea36f2a59985ec9e8aec7e2,0x4185cf99745b2a20727b37ee798193dd4a56cdfa,0x6c3f90f043a72fa612cbac8115ee7e52bde6e490,,,0x4185cf99745b2a20727b37ee798193dd4a56cdfa,0x6b175474e89094c44da98b954eedeac495271d0f,0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48,0xdac17f958d2ee523a2206206994597c13d831ec7, -Regular,3pool,3pool,0xbebc44782c7db0a1a60cb6fe97d0b483032ff1c7,yes,curvefi,threepool_swap,,,,0x6c3f90f043a72fa612cbac8115ee7e52bde6e490,,0x6b175474e89094c44da98b954eedeac495271d0f,0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48,0xdac17f958d2ee523a2206206994597c13d831ec7,,,,,,0xbfcf63294ad7105dea65aa58f8ae5be2d9d0952a -Regular,teth,teth,0x752ebeb79963cf0732e9c0fec72a49fd1defaeac,yes,curvefi,teth_swap,,,,0xcb08717451aae9ef950a2524e33b6dcaba60147b,,0x0000000000000000000000000000000000000000,0xcdf7028ceab81fa0c6971208e83fa7872994bee5,,,,,,,0x6070fbd4e608ee5391189e7205d70cc4a274c017 -Regular,tbtc,tbtc,0xc25099792e9349c7dd09759744ea681c7de2cb66,yes,curvefi,tbtc_swap,,,,0x64eda51d3ad40d56b9dfc5554e06f94e1dd786fd,0xaa82ca713d94bba7a89ceab55314f9effeddc78c,0x8daebade922df735c38c80c7ebd708af50815faa,0x075b1bb99792c9e1041ba13afef80c91a1e70fb3,,,0x8daebade922df735c38c80c7ebd708af50815faa,0xeb4c2781e4eba804ce9a9803c67d0893436bb27d,0x2260fac5e5542a773aa44fbcfedf7c193bc2c599,0xfe18be6b3bd88a2d2a7f928d00292e7a9963cfc6,0x6828bcf74279ee32f2723ec536c22c51eed383c6 -Factory V1 Meta,tbtc2,tbtc2,0xfa65aa60a9d45623c57d383fb4cf8fb8b854cc4d,yes,curvefi,tbtc2,200,4000000,4000000,0xfa65aa60a9d45623c57d383fb4cf8fb8b854cc4d,0xfa65aa60a9d45623c57d383fb4cf8fb8b854cc4d,0x18084fba666a33d37592fa2633fd49a74dd93a88,0x075b1bb99792c9e1041ba13afef80c91a1e70fb3,,,0x18084fba666a33d37592fa2633fd49a74dd93a88,0xeb4c2781e4eba804ce9a9803c67d0893436bb27d,0x2260fac5e5542a773aa44fbcfedf7c193bc2c599,0xfe18be6b3bd88a2d2a7f928d00292e7a9963cfc6,0x29284d30bcb70e86a6c3f84cbc4de0ce16b0f1ca -Factory V1 Plain,Tokemak tWETH/WETH,tWETH+WETH,0x06d39e95977349431e3d800d49c63b4d472e10fb,yes,curvefi,tWETH_WETH,10,4000000,4000000,0x06d39e95977349431e3d800d49c63b4d472e10fb,0x06d39e95977349431e3d800d49c63b4d472e10fb,0xd3d13a578a53685b4ac36a1bab31912d2b2a2f36,0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2,0x0000000000000000000000000000000000000000,0x0000000000000000000000000000000000000000,,,,, -Factory V1 Plain,Tokemak tTCR/TCR,tTCR,0x01fe650ef2f8e2982295489ae6adc1413bf6011f,yes,curvefi,tTCR,1000000000,4000000,4000000,0x01fe650ef2f8e2982295489ae6adc1413bf6011f,0x01fe650ef2f8e2982295489ae6adc1413bf6011f,0x15a629f0665a3eb97d7ae9a7ce7abf73aeb79415,0x9c4a4204b79dd291d6b6571c5be8bbcd0622f050,0x0000000000000000000000000000000000000000,0x0000000000000000000000000000000000000000,,,,, -Factory V1 Plain,Tokemak tSUSHI/SUSHI,tSUSHI,0x0437ac6109e8a366a1f4816edf312a36952db856,yes,curvefi,tSUSHI,1000000000,4000000,4000000,0x0437ac6109e8a366a1f4816edf312a36952db856,0x0437ac6109e8a366a1f4816edf312a36952db856,0xf49764c9c5d644ece6ae2d18ffd9f1e902629777,0x6b3595068778dd592e39a122f4f5a5cf09c90fe2,0x0000000000000000000000000000000000000000,0x0000000000000000000000000000000000000000,,,,, -Factory V1 Plain,Tokemak tSNX/SNX,tSNX,0x50b0d9171160d6eb8aa39e090da51e7e078e81c4,yes,curvefi,tSNX,1000000000,4000000,4000000,0x50b0d9171160d6eb8aa39e090da51e7e078e81c4,0x50b0d9171160d6eb8aa39e090da51e7e078e81c4,0xeff721eae19885e17f5b80187d6527aad3ffc8de,0xc011a73ee8576fb46f5e1c5751ca3b9fe0af2a6f,0x0000000000000000000000000000000000000000,0x0000000000000000000000000000000000000000,,,,, -Factory V1 Plain,Tokemak tGAMMA/GAMMA,tGAMMA,0x9462f2b3c9beea8afc334cdb1d1382b072e494ea,yes,curvefi,tGAMMA,1000000000,4000000,4000000,0x9462f2b3c9beea8afc334cdb1d1382b072e494ea,0x9462f2b3c9beea8afc334cdb1d1382b072e494ea,0x2fc6e9c1b2c07e18632efe51879415a580ad22e1,0x6bea7cfef803d1e3d5f7c0103f7ded065644e197,0x0000000000000000000000000000000000000000,0x0000000000000000000000000000000000000000,,,,, -Factory V1 Plain,Tokemak tFXS/FXS,tFXS,0x961226b64ad373275130234145b96d100dc0b655,yes,curvefi,tFXS,1000000000,4000000,4000000,0x961226b64ad373275130234145b96d100dc0b655,0x961226b64ad373275130234145b96d100dc0b655,0xadf15ec41689fc5b6dca0db7c53c9bfe7981e655,0x3432b6a60d23ca0dfca7761b7ab56459d9c964d0,0x0000000000000000000000000000000000000000,0x0000000000000000000000000000000000000000,,,,, -Factory V1 Plain,tFRAX/FRAX Test,tFRAX+FRAX,0x694650a0b2866472c2eea27827ce6253c1d13074,yes,curvefi,tFRAXFRAX,1000000000,4000000,4000000,0x694650a0b2866472c2eea27827ce6253c1d13074,0x694650a0b2866472c2eea27827ce6253c1d13074,0x94671a3cee8c7a12ea72602978d1bb84e920efb2,0x853d955acef822db058eb8505911ed77f175b99e,0x0000000000000000000000000000000000000000,0x0000000000000000000000000000000000000000,,,,, -Factory V1 Plain,Tokemak tFOX/FOX,tFOX,0xc250b22d15e43d95fbe27b12d98b6098f8493eac,yes,curvefi,tFOX,1000000000,4000000,4000000,0xc250b22d15e43d95fbe27b12d98b6098f8493eac,0xc250b22d15e43d95fbe27b12d98b6098f8493eac,0x808d3e6b23516967ceae4f17a5f9038383ed5311,0xc770eefad204b5180df6a14ee197d99d808ee52d,0x0000000000000000000000000000000000000000,0x0000000000000000000000000000000000000000,,,,, -Factory V1 Plain,Tokemak tAPW/APW,tAPW,0xcaf8703f8664731ced11f63bb0570e53ab4600a9,yes,curvefi,tAPW,1000000000,4000000,4000000,0xcaf8703f8664731ced11f63bb0570e53ab4600a9,0xcaf8703f8664731ced11f63bb0570e53ab4600a9,0xdc0b02849bb8e0f126a216a2840275da829709b0,0x4104b135dbc9609fc1a9490e61369036497660c8,0x0000000000000000000000000000000000000000,0x0000000000000000000000000000000000000000,,,,, -Factory V1 Plain,Tokemak tALCX/ALCX,tALCX,0x9001a452d39a8710d27ed5c2e10431c13f5fba74,yes,curvefi,tALCX,1000000000,4000000,4000000,0x9001a452d39a8710d27ed5c2e10431c13f5fba74,0x9001a452d39a8710d27ed5c2e10431c13f5fba74,0xd3b5d9a561c293fb42b446fe7e237daa9bf9aa84,0xdbdb4d16eda451d0503b854cf79d55697f90c8df,0x0000000000000000000000000000000000000000,0x0000000000000000000000000000000000000000,,,,, -Regular,susdv2,susd,0xa5407eae9ba41422680e2e00537571bcc53efbfd,yes,curvefi,susd_swap,,,,0xc25a3a3b969415c80451098fa907ec722572917f,0xfcba3e75865d2d561be8d220616520c171f12851,0x6b175474e89094c44da98b954eedeac495271d0f,0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48,0xdac17f958d2ee523a2206206994597c13d831ec7,0x57ab1ec28d129707052df4df418d58a2d46d5f51,0x6b175474e89094c44da98b954eedeac495271d0f,0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48,0xdac17f958d2ee523a2206206994597c13d831ec7,0x57ab1e02fee23774580c119740129eac7081e9d3,0xa90996896660decc6e997655e065b23788857849 -Regular,steth,steth,0xdc24316b9ae028f1497c275eb9192a3ea0f67022,yes,curvefi,steth_swap,,,,0x06325440d014e39736583c165c2963ba99faf14e,,0x0000000000000000000000000000000000000000,0xae7ab96520de3a18e5e111b5eaab095312d7fe84,,,,,,,0x182b723a58739a9c974cfdb385ceadb237453c28 -Factory V1 Plain,stETH concentrated,STETHETH_C,0x828b154032950c8ff7cf8085d841723db2696056,yes,curvefi,stETHconcentrated,1000,4000000,4000000,0x828b154032950c8ff7cf8085d841723db2696056,0x828b154032950c8ff7cf8085d841723db2696056,0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2,0xae7ab96520de3a18e5e111b5eaab095312d7fe84,0x0000000000000000000000000000000000000000,0x0000000000000000000000000000000000000000,,,,,0xf668e6d326945d499e5b35e7cd2e82acfbcfe6f0 -Regular,spelleth,spelleth,0x98638facf9a3865cd033f36548713183f6996122,yes,curvefi,spelleth_swap,,,,0x8282bd15dca2ea2bdf24163e8f2781b30c43a2ef,,0x0000000000000000000000000000000000000000,0x090185f2135308bad17527004364ebcc2d37e5f6,,,,,,,0x08380a4999be1a958e2abba07968d703c7a3027c -Regular,seth,seth,0xc5424b857f758e906013f3555dad202e4bdb4567,yes,curvefi,seth_swap,,,,0xa3d87fffce63b53e0d54faa1cc983b7eb0b74a9c,,0x0000000000000000000000000000000000000000,0x5e74c9036fb86bd7ecdcb084a0673efc32ea31cb,,,,,,,0x3c0ffff15ea30c35d7a85b85c0782d6c94e1d238 -Factory V2,SDT/ETH,SDTETH,0xfb8814d005c5f32874391e888da6eb2fe7a27902,yes,curvefi,sdteth_swap,400000,26000000,45000000,0x6359b6d3e327c497453d4376561ee276c6933323,0xfb8814d005c5f32874391e888da6eb2fe7a27902,0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2,0x73968b9a57c6e53d41345fd57a6e6ae27d6cdb2f,,,,,,, -Factory V1 Plain,sdCRV,sdCRV,0x737bc004136f66ae3f8fd5a1199e81c18388097b,yes,curvefi,sdCRV,200,15500000,15500000,0x737bc004136f66ae3f8fd5a1199e81c18388097b,0x737bc004136f66ae3f8fd5a1199e81c18388097b,0x478bbc744811ee8310b461514bdc29d03739084d,0xd533a949740bb3306d119cc777fa900ba034cd52,0x0000000000000000000000000000000000000000,0x0000000000000000000000000000000000000000,,,,,0xe64026269a7a528cb9ce17c3a403a956ac973a97 -Regular,sbtc,sbtc,0x7fc77b5c7614e1533320ea6ddc2eb61fa00a9714,yes,curvefi,sbtc_swap,,,,0x075b1bb99792c9e1041ba13afef80c91a1e70fb3,,0xeb4c2781e4eba804ce9a9803c67d0893436bb27d,0x2260fac5e5542a773aa44fbcfedf7c193bc2c599,0xfe18be6b3bd88a2d2a7f928d00292e7a9963cfc6,,,,,,0x705350c4bcd35c9441419ddd5d2f097d7a55410f -Factory V1 Plain,Wanna Avoid Tether?,sansUSDT,0x08eaf78d40abfa6c341f05692eb48edca425ce04,yes,curvefi,sansUSDT,10,4000000,4000000,0x08eaf78d40abfa6c341f05692eb48edca425ce04,0x08eaf78d40abfa6c341f05692eb48edca425ce04,0x57ab1ec28d129707052df4df418d58a2d46d5f51,0xa47c8bf37f92abed4a126bda807a7b7498661acd,0x99d8a9c45b2eca8864373a26d1459e3dff1e17f3,0x0000000000000000000000000000000000000000,,,,, -Regular,saave,saave,0xeb16ae0052ed37f479f7fe63849198df1765a733,yes,curvefi,saave_swap,,,,0x02d341ccb60faaf662bc0554d13778015d1b285c,,0x028171bca77440897b824ca71d1c56cac55b68a3,0x6c5024cd4f8a59110119c56f8933403a539555eb,,,0x6b175474e89094c44da98b954eedeac495271d0f,0x57ab1ec28d129707052df4df418d58a2d46d5f51,,,0x462253b8f74b72304c145db0e4eebd326b22ca39 -Factory V1 Meta,sUSD Metapool,sUSD,0xd05ce4ab1f4fb0c0e1b65ebe3ed7f2dcfc6ccf20,yes,curvefi,sUSD,100,4000000,4000000,0xd05ce4ab1f4fb0c0e1b65ebe3ed7f2dcfc6ccf20,0xd05ce4ab1f4fb0c0e1b65ebe3ed7f2dcfc6ccf20,0x57ab1ec28d129707052df4df418d58a2d46d5f51,0x6c3f90f043a72fa612cbac8115ee7e52bde6e490,,,0x57ab1ec28d129707052df4df418d58a2d46d5f51,0x6b175474e89094c44da98b954eedeac495271d0f,0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48,0xdac17f958d2ee523a2206206994597c13d831ec7,0x1c633797b992bbdf20048b822ba58fd0ea17a8c8 -Regular,rsv,rsv,0xc18cc39da8b11da8c3541c598ee022258f9744da,yes,curvefi,rsv_swap,,,,0xc2ee6b0334c261ed60c72f6054450b61b8f18e35,0xbe175115bf33e12348ff77ccfee4726866a0fbd5,0x196f4727526ea7fb1e17b2071b3d8eaa38486988,0x6c3f90f043a72fa612cbac8115ee7e52bde6e490,,,0x196f4727526ea7fb1e17b2071b3d8eaa38486988,0x6b175474e89094c44da98b954eedeac495271d0f,0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48,0xdac17f958d2ee523a2206206994597c13d831ec7,0x4dc4a289a8e33600d8bd4cf5f6313e43a37adec7 -Factory V2,RocketPool rETH,rp-eth,0x1dff955cddd55fba58db3cd658f9e3e3c31851eb,yes,curvefi,rpeth_swap,400000,26000000,45000000,0x367d89e3577b95e5d9a770945225b93889b1dc8d,0x1dff955cddd55fba58db3cd658f9e3e3c31851eb,0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2,0xae78736cd615f374d3085123a210448e74fc6393,,,,,,, -Regular,reth,reth,0xf9440930043eb3997fc70e1339dbb11f341de7a8,yes,curvefi,reth_swap,,,,0x53a901d48795c58f485cbb38df08fa96a24669d5,,0x9559aaa82d9649c7a7b220e7c461d2e74c9a3593,0x0000000000000000000000000000000000000000,,,,,,,0x824f13f1a2f29cfeea81154b46c0fc820677a637 -Regular,ren,ren,0x93054188d876f558f4a66b2ef1d97d16edf0895b,yes,curvefi,ren_swap,,,,0x49849c98ae39fff122806c06791fa73784fb3675,,0xeb4c2781e4eba804ce9a9803c67d0893436bb27d,0x2260fac5e5542a773aa44fbcfedf7c193bc2c599,,,,,,,0xb1f2cdec61db658f091671f5f199635aef202cac -Factory V2,RAI/FRAX,RAIFRAX,0xc68ffddea3a77b456227b50ebfdcc3c33bc2a8a4,yes,curvefi,raifrax_swap,200000000,5000000,45000000,0x1b8b8a78e12397e18a2bd2b400205d1eb8897573,0xc68ffddea3a77b456227b50ebfdcc3c33bc2a8a4,0x03ab458634910aad20ef5f1c8ee96f1d6ac54919,0x853d955acef822db058eb8505911ed77f175b99e,,,,,,, -Factory V2,RAI/ETH,RAIETH,0x96fb2ab514ca569a1486c50339533ca4637b338b,yes,curvefi,raieth_swap,400000,26000000,45000000,0xde3e8978896e1fa31f1ea2b9012caa4057adb273,0x96fb2ab514ca569a1486c50339533ca4637b338b,0x03ab458634910aad20ef5f1c8ee96f1d6ac54919,0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2,,,,,,, -Factory V2,RAI/agEUR,RAIAGEUR,0xb6d9b32407bfa562d9211acdba2631a46c850956,yes,curvefi,raiageur_swap,200000000,5000000,45000000,0xca7c3ac4e5fb7b2ae60472c80344ea9403c6d2b1,0xb6d9b32407bfa562d9211acdba2631a46c850956,0x03ab458634910aad20ef5f1c8ee96f1d6ac54919,0x1a7e4e63778b4f12a199c062f3efdd288afcbce8,,,,,,, -Regular,rai,rai,0x618788357d0ebd8a37e763adab3bc575d54c2c7d,yes,curvefi,rai_swap,,,,0x6ba5b4e438fa0aaf7c1bd179285af65d13bd3d90,0xcb636b81743bb8a7f1e355debb7d33b07009cccc,0x03ab458634910aad20ef5f1c8ee96f1d6ac54919,0x6c3f90f043a72fa612cbac8115ee7e52bde6e490,,,0x03ab458634910aad20ef5f1c8ee96f1d6ac54919,0x6b175474e89094c44da98b954eedeac495271d0f,0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48,0xdac17f958d2ee523a2206206994597c13d831ec7,0x66ec719045bbd62db5ebb11184c18237d3cc2e62 -Factory V1 Plain,rETH/wstETH,rETHwstETH,0x447ddd4960d9fdbf6af9a790560d0af76795cb08,yes,curvefi,rETHwstETH,50,4000000,4000000,0x447ddd4960d9fdbf6af9a790560d0af76795cb08,0x447ddd4960d9fdbf6af9a790560d0af76795cb08,0xae78736cd615f374d3085123a210448e74fc6393,0x7f39c581f595b53c5cb19bd0b3f8da6c935e2ca0,0x0000000000000000000000000000000000000000,0x0000000000000000000000000000000000000000,,,,,0x8ad7e0e6edc61bc48ca0dd07f9021c249044ed30 -Factory V2,pxCVX/CVX,pxCVXCVX,0xf3456e8061461e144b3f252e69dcd5b6070fdee0,yes,curvefi,pxCVXCVX,200000000,15000000,30000000,0xace78d9bab82b6b4783120dba82aa10b040a14d9,0xf3456e8061461e144b3f252e69dcd5b6070fdee0,0x4e3fbd56cd56c3e72c1403e103b45db9da5b9d2b,0xbce0cf87f513102f22232436cca2ca49e815c3ac,,,,,,, -Regular,pbtc,pbtc,0x7f55dde206dbad629c080068923b36fe9d6bdbef,yes,curvefi,pbtc_swap,,,,0xde5331ac4b3630f94853ff322b66407e0d6331e8,0x11f419adabbff8d595e7d5b223eee3863bb3902c,0x5228a22e72ccc52d415ecfd199f99d0665e7733b,0x075b1bb99792c9e1041ba13afef80c91a1e70fb3,,,0x5228a22e72ccc52d415ecfd199f99d0665e7733b,0xeb4c2781e4eba804ce9a9803c67d0893436bb27d,0x2260fac5e5542a773aa44fbcfedf7c193bc2c599,0xfe18be6b3bd88a2d2a7f928d00292e7a9963cfc6,0xd7d147c6bb90a718c3de8c0568f9b560c79fa416 -Factory V1 Meta,Paxos Dollar (USDP),pax-usdp,0xc270b3b858c335b6ba5d5b10e2da8a09976005ad,yes,curvefi,paxusdp,1000,4000000,4000000,0xc270b3b858c335b6ba5d5b10e2da8a09976005ad,0xc270b3b858c335b6ba5d5b10e2da8a09976005ad,0x8e870d67f660d95d5be530380d0ec0bd388289e1,0x6c3f90f043a72fa612cbac8115ee7e52bde6e490,,,0x8e870d67f660d95d5be530380d0ec0bd388289e1,0x6b175474e89094c44da98b954eedeac495271d0f,0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48,0xdac17f958d2ee523a2206206994597c13d831ec7,0xc95bdf13a08a547e4dd9f29b00ab7ff08c5d093d -Regular,pax,pax,0x06364f10b501e868329afbc005b3492902d6c763,yes,curvefi,pax_swap,,,,0xd905e2eaebe188fc92179b6350807d8bd91db0d8,0xa50ccc70b6a011cffddf45057e39679379187287,0x99d1fa417f94dcd62bfe781a1213c092a47041bc,0x9777d7e2b60bb01759d0e2f8be2095df444cb07e,0x1be5d71f2da660bfdee8012ddc58d024448a0a59,0x8e870d67f660d95d5be530380d0ec0bd388289e1,0x6b175474e89094c44da98b954eedeac495271d0f,0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48,0xdac17f958d2ee523a2206206994597c13d831ec7,0x8e870d67f660d95d5be530380d0ec0bd388289e1,0x64e3c23bfc40722d3b649844055f1d51c1ac041d -Factory V2,PAR/USDC,PARUSDC,0xdad60c5b748306ba5a0c9a3c3482a8d1153dad2a,yes,curvefi,parusdc_swap,200000000,5000000,45000000,0x030cafae2ece75ed411aeb53633fbed3092c3e32,0xdad60c5b748306ba5a0c9a3c3482a8d1153dad2a,0x68037790a0229e9ce6eaa8a99ea92964106c4703,0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48,,,,,,, -Factory V1 Meta,PAR/USDC,PARUSDC,0x5b78b93fa851c357586915c7ba7258b762eb1ba0,yes,curvefi,par3crv,10,4000000,4000000,0x5b78b93fa851c357586915c7ba7258b762eb1ba0,0x5b78b93fa851c357586915c7ba7258b762eb1ba0,0x68037790a0229e9ce6eaa8a99ea92964106c4703,0x6c3f90f043a72fa612cbac8115ee7e52bde6e490,,,0x68037790a0229e9ce6eaa8a99ea92964106c4703,0x6b175474e89094c44da98b954eedeac495271d0f,0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48,0xdac17f958d2ee523a2206206994597c13d831ec7, -Factory V2,AAVE/palStkAAVE,palStkAAVE,0x48536ec5233297c367fd0b6979b75d9270bb6b15,yes,curvefi,palstkaave_swap,200000000,5000000,45000000,0x6085def4343a0b5d97820f131a362dae9fe59841,0x48536ec5233297c367fd0b6979b75d9270bb6b15,0x7fc66500c84a76ad7e9c93437bfc5ac33e2ddae9,0x24e79e946dea5482212c38aab2d0782f04cdb0e0,,,,,,, -Regular,obtc,obtc,0xd81da8d904b52208541bade1bd6595d8a251f8dd,yes,curvefi,obtc_swap,,,,0x2fe94ea3d5d4a175184081439753de15aef9d614,0xd5bcf53e2c81e1991570f33fa881c49eea570c8d,0x8064d9ae6cdf087b1bcd5bdf3531bd5d8c537a68,0x075b1bb99792c9e1041ba13afef80c91a1e70fb3,,,0x8064d9ae6cdf087b1bcd5bdf3531bd5d8c537a68,0xeb4c2781e4eba804ce9a9803c67d0893436bb27d,0x2260fac5e5542a773aa44fbcfedf7c193bc2c599,0xfe18be6b3bd88a2d2a7f928d00292e7a9963cfc6,0x11137b10c210b579405c21a07489e28f3c040ab1 -Regular,musd,musd,0x8474ddbe98f5aa3179b3b3f5942d724afcdec9f6,yes,curvefi,musd_swap,,,,0x1aef73d49dedc4b1778d0706583995958dc862e6,0x803a2b40c5a9bb2b86dd630b274fa2a9202874c2,0xe2f2a5c287993345a840db3b0845fbc70f5935a5,0x6c3f90f043a72fa612cbac8115ee7e52bde6e490,,,0xe2f2a5c287993345a840db3b0845fbc70f5935a5,0x6b175474e89094c44da98b954eedeac495271d0f,0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48,0xdac17f958d2ee523a2206206994597c13d831ec7,0x5f626c30ec1215f4edcc9982265e8b1f411d1352 -Regular,mim,mim,0x5a6a4d54456819380173272a5e8e9b9904bdf41b,yes,curvefi,mim,,,,0x5a6a4d54456819380173272a5e8e9b9904bdf41b,,0x99d8a9c45b2eca8864373a26d1459e3dff1e17f3,0x6c3f90f043a72fa612cbac8115ee7e52bde6e490,,,0x99d8a9c45b2eca8864373a26d1459e3dff1e17f3,0x6b175474e89094c44da98b954eedeac495271d0f,0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48,0xdac17f958d2ee523a2206206994597c13d831ec7,0xd8b712d29381748db89c36bca0138d7c75866ddf -Factory V1 Plain,Meta EUR,mEUR,0x3cfaa1596777cad9f5004f9a0c443d912e262243,yes,curvefi,mEUR,100,4000000,4000000,0x3cfaa1596777cad9f5004f9a0c443d912e262243,0x3cfaa1596777cad9f5004f9a0c443d912e262243,0x68037790a0229e9ce6eaa8a99ea92964106c4703,0xc581b735a1688071a1746c968e0798d642ede491,0xdb25f211ab05b1c97d595516f45794528a807ad8,0xd71ecff9342a5ced620049e616c5035f1db98620,,,,, -Regular,lusd,lusd,0xed279fdd11ca84beef15af5d39bb4d4bee23f0ca,yes,curvefi,lusd_swap,,,,0xed279fdd11ca84beef15af5d39bb4d4bee23f0ca,,0x5f98805a4e8be255a32880fdec7f6728c6568ba0,0x6c3f90f043a72fa612cbac8115ee7e52bde6e490,,,0x5f98805a4e8be255a32880fdec7f6728c6568ba0,0x6b175474e89094c44da98b954eedeac495271d0f,0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48,0xdac17f958d2ee523a2206206994597c13d831ec7,0x9b8519a9a00100720ccdc8a120fbed319ca47a14 -Regular,linkusd,linkusd,0xe7a24ef0c5e95ffb0f6684b813a78f2a3ad7d171,yes,curvefi,linkusd_swap,,,,0x6d65b498cb23deaba52db31c93da9bffb340fb8f,0x1de7f0866e2c4adac7b457c58cc25c8688cda1f2,0x0e2ec54fc0b509f445631bf4b91ab8168230c752,0x6c3f90f043a72fa612cbac8115ee7e52bde6e490,,,0x0e2ec54fc0b509f445631bf4b91ab8168230c752,0x6b175474e89094c44da98b954eedeac495271d0f,0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48,0xdac17f958d2ee523a2206206994597c13d831ec7, -Regular,link,link,0xf178c0b5bb7e7abf4e12a4838c7b7c5ba2c623c0,yes,curvefi,link_swap,,,,0xcee60cfa923170e4f8204ae08b4fa6a3f5656f3a,,0x514910771af9ca656af840dff83e8264ecf986ca,0xbbc455cb4f1b9e4bfc4b73970d360c8f032efee6,,,,,,,0xfd4d8a17df4c27c1dd245d153ccf4499e806c87d -Factory V1 Meta,kusd-3pool,kusd3pool,0xed09ca8275dffb09c632b6ea58c035a851f73616,yes,curvefi,kusd3pool,200,4000000,4000000,0xed09ca8275dffb09c632b6ea58c035a851f73616,0xed09ca8275dffb09c632b6ea58c035a851f73616,0x332e824e46fceeb9e59ba9491b80d3e6d42b0b59,0x6c3f90f043a72fa612cbac8115ee7e52bde6e490,,,0x332e824e46fceeb9e59ba9491b80d3e6d42b0b59,0x6b175474e89094c44da98b954eedeac495271d0f,0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48,0xdac17f958d2ee523a2206206994597c13d831ec7, -Factory V1 Plain,jGBP/TGBP,jGBP+TGBP,0xed24fe718effc6b2fc59eeaa5c5f51dd079ab6ed,yes,curvefi,jGBP_TGBP,200,4000000,4000000,0xed24fe718effc6b2fc59eeaa5c5f51dd079ab6ed,0xed24fe718effc6b2fc59eeaa5c5f51dd079ab6ed,0x7409856cae628f5d578b285b45669b36e7005283,0x00000000441378008ea67f4284a57932b1c000a5,0x0000000000000000000000000000000000000000,0x0000000000000000000000000000000000000000,,,,, -Regular,ib,ib,0x2dded6da1bf5dbdf597c45fcfaa3194e53ecfeaf,yes,curvefi,ironbank_swap,,,,0x5282a4ef67d9c33135340fb3289cc1711c13638c,,0x8e595470ed749b85c6f7669de83eae304c2ec68f,0x76eb2fe28b36b3ee97f3adae0c69606eedb2a37c,0x48759f220ed983db51fa7a8c0d2aab8f3ce4166a,,0x6b175474e89094c44da98b954eedeac495271d0f,0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48,0xdac17f958d2ee523a2206206994597c13d831ec7,,0xf5194c3325202f456c95c1cf0ca36f8475c1949f -Factory V2,INV/DOLA,INVDOLA,0x99af0326ab1c2a68c6712a5622c1aa8e4b35fd57,yes,curvefi,invdola_swap,400000,26000000,45000000,0x1868e657122554750eb07b2fa45b4044af35c583,0x99af0326ab1c2a68c6712a5622c1aa8e4b35fd57,0x41d5d79431a913c4ae7d69a668ecdfe5ff9dfb68,0x865377367054516e17014ccded1e7d814edc9ce4,,,,,,, -Factory V1 Meta,ibBTC,ibbtc,0xfbdca68601f835b27790d98bbb8ec7f05fdeaa9b,yes,curvefi,ibbtc,100,4000000,4000000,0xfbdca68601f835b27790d98bbb8ec7f05fdeaa9b,0xfbdca68601f835b27790d98bbb8ec7f05fdeaa9b,0x8751d4196027d4e6da63716fa7786b5174f04c15,0x075b1bb99792c9e1041ba13afef80c91a1e70fb3,,,0x8751d4196027d4e6da63716fa7786b5174f04c15,0xeb4c2781e4eba804ce9a9803c67d0893436bb27d,0x2260fac5e5542a773aa44fbcfedf7c193bc2c599,0xfe18be6b3bd88a2d2a7f928d00292e7a9963cfc6,0x346c7bb1a7a6a30c8e81c14e90fc2f0fbddc54d8 -Factory V1 Meta,Interest Bearing Bitcoin,ibbtc,0x99ae07e7ab61dcce4383a86d14f61c68cdccbf27,yes,curvefi,ibbtc,200,4000000,4000000,0x99ae07e7ab61dcce4383a86d14f61c68cdccbf27,0x99ae07e7ab61dcce4383a86d14f61c68cdccbf27,0xc4e15973e6ff2a35cc804c2cf9d2a1b817a8b40f,0x075b1bb99792c9e1041ba13afef80c91a1e70fb3,,,0xc4e15973e6ff2a35cc804c2cf9d2a1b817a8b40f,0xeb4c2781e4eba804ce9a9803c67d0893436bb27d,0x2260fac5e5542a773aa44fbcfedf7c193bc2c599,0xfe18be6b3bd88a2d2a7f928d00292e7a9963cfc6,0xe9ef132a724ff731b17bd550709c38a3258edc4e -Factory V1 Plain,ibZAR/ZARP,ibZAR+ZARP,0xcbd5cc53c5b846671c6434ab301ad4d210c21184,yes,curvefi,ibZAR_ZARP,200,4000000,4000000,0xcbd5cc53c5b846671c6434ab301ad4d210c21184,0xcbd5cc53c5b846671c6434ab301ad4d210c21184,0x8cb24ed2e4f7e2065f4eb2be5f6b0064b1919850,0x81d66d255d47662b6b16f3c5bbfbb15283b05bc2,0x0000000000000000000000000000000000000000,0x0000000000000000000000000000000000000000,,,,,0xdb190e4d9c9a95fdf066b258892b8d6bb107434e -Factory V1 Plain,ibKRW/sKRW,ibKRW+sKRW,0x8461a004b50d321cb22b7d034969ce6803911899,yes,curvefi,ibKRW_sKRW,100,4000000,4000000,0x8461a004b50d321cb22b7d034969ce6803911899,0x8461a004b50d321cb22b7d034969ce6803911899,0x95dfdc8161832e4ff7816ac4b6367ce201538253,0x269895a3df4d73b077fc823dd6da1b95f72aaf9b,0x0000000000000000000000000000000000000000,0x0000000000000000000000000000000000000000,,,,,0x1750a3a3d80a3f5333bbe9c4695b0fad41061ab1 -Factory V1 Plain,ibJPY/sJPY,ibJPY+sJPY,0x8818a9bb44fbf33502be7c15c500d0c783b73067,yes,curvefi,ibJPY_sJPY,100,4000000,4000000,0x8818a9bb44fbf33502be7c15c500d0c783b73067,0x8818a9bb44fbf33502be7c15c500d0c783b73067,0x5555f75e3d5278082200fb451d1b6ba946d8e13b,0xf6b1c627e95bfc3c1b4c9b825a032ff0fbf3e07d,0x0000000000000000000000000000000000000000,0x0000000000000000000000000000000000000000,,,,,0xeff437a56a22d7dd86c1202a308536ed8c7da7c1 -Factory V1 Plain,ibGBP/sGBP,ibGBP+sGBP,0xd6ac1cb9019137a896343da59dde6d097f710538,yes,curvefi,ibGBP_sGBP,100,4000000,4000000,0xd6ac1cb9019137a896343da59dde6d097f710538,0xd6ac1cb9019137a896343da59dde6d097f710538,0x69681f8fde45345c3870bcd5eaf4a05a60e7d227,0x97fe22e7341a0cd8db6f6c021a24dc8f4dad855f,0x0000000000000000000000000000000000000000,0x0000000000000000000000000000000000000000,,,,,0x63d9f3ab7d0c528797a12a0684e50c397e9e79dc -Factory V1 Plain,ibEUR/sEUR,ibEUR+sEUR,0x1f71f05cf491595652378fe94b7820344a551b8e,yes,curvefi,ibEUR_sEUR,100,4000000,4000000,0x1f71f05cf491595652378fe94b7820344a551b8e,0x1f71f05cf491595652378fe94b7820344a551b8e,0x96e61422b6a9ba0e068b6c5add4ffabc6a4aae27,0x57ab1ec28d129707052df4df418d58a2d46d5f51,0x0000000000000000000000000000000000000000,0x0000000000000000000000000000000000000000,,,,, -Factory V1 Plain,ibEUR/sEUR,ibEUR+sEUR,0x19b080fe1ffa0553469d20ca36219f17fcf03859,yes,curvefi,ibEUR_sEUR,100,4000000,4000000,0x19b080fe1ffa0553469d20ca36219f17fcf03859,0x19b080fe1ffa0553469d20ca36219f17fcf03859,0x96e61422b6a9ba0e068b6c5add4ffabc6a4aae27,0xd71ecff9342a5ced620049e616c5035f1db98620,0x0000000000000000000000000000000000000000,0x0000000000000000000000000000000000000000,,,,,0x99fb76f75501039089aac8f20f487bf84e51d76f -Factory V1 Plain,ibCHF/sCHF,ibCHF+sCHF,0x9c2c8910f113181783c249d8f6aa41b51cde0f0c,yes,curvefi,ibCHF_sCHF,100,4000000,4000000,0x9c2c8910f113181783c249d8f6aa41b51cde0f0c,0x9c2c8910f113181783c249d8f6aa41b51cde0f0c,0x1cc481ce2bd2ec7bf67d1be64d4878b16078f309,0x0f83287ff768d1c1e17a42f44d644d7f22e8ee1d,0x0000000000000000000000000000000000000000,0x0000000000000000000000000000000000000000,,,,,0x2fa53e8fa5fadb81f4332c8ece39fe62ea2f919e -Factory V1 Plain,ibAUD/sAUD,ibAUD+sAUD,0x3f1b0278a9ee595635b61817630cc19de792f506,yes,curvefi,ibAUD_sAUD,100,4000000,4000000,0x3f1b0278a9ee595635b61817630cc19de792f506,0x3f1b0278a9ee595635b61817630cc19de792f506,0xfafdf0c4c1cb09d430bf88c75d88bb46dae09967,0xf48e200eaf9906362bb1442fca31e0835773b8b4,0x0000000000000000000000000000000000000000,0x0000000000000000000000000000000000000000,,,,,0x05ca5c01629a8e5845f12ea3a03ff7331932233a -Regular,husd,husd,0x3ef6a01a0f81d6046290f3e2a8c5b843e738e604,yes,curvefi,husd_swap,,,,0x5b5cfe992adac0c9d48e05854b2d91c73a003858,0x09672362833d8f703d5395ef3252d4bfa51c15ca,0xdf574c24545e5ffecb9a659c229253d4111d87e1,0x6c3f90f043a72fa612cbac8115ee7e52bde6e490,,,0xdf574c24545e5ffecb9a659c229253d4111d87e1,0x6b175474e89094c44da98b954eedeac495271d0f,0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48,0xdac17f958d2ee523a2206206994597c13d831ec7,0x2db0e83599a91b508ac268a6197b8b14f5e72840 -Regular,hbtc,hbtc,0x4ca9b3063ec5866a4b82e437059d2c43d1be596f,yes,curvefi,hbtc_swap,,,,0xb19059ebb43466c323583928285a49f558e572fd,,0x0316eb71485b0ab14103307bf65a021042c6d380,0x2260fac5e5542a773aa44fbcfedf7c193bc2c599,,,,,,,0x4c18e409dc8619bfb6a1cb56d114c3f592e0ae79 -Regular,gusd,gusd,0x4f062658eaaf2c1ccf8c8e36d6824cdf41167956,yes,curvefi,gusd_swap,,,,0xd2967f45c4f384deea880f807be904762a3dea07,0x64448b78561690b70e17cbe8029a3e5c1bb7136e,0x056fd409e1d7a124bd7017459dfea2f387b6d5cd,0x6c3f90f043a72fa612cbac8115ee7e52bde6e490,,,0x056fd409e1d7a124bd7017459dfea2f387b6d5cd,0x6b175474e89094c44da98b954eedeac495271d0f,0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48,0xdac17f958d2ee523a2206206994597c13d831ec7,0xc5cfada84e902ad92dd40194f0883ad49639b023 -Factory V2,FXS/ETH,FXSETH,0x1667954f14f5b22c703116d8d806f988b1e09018,yes,curvefi,fxseth_swap,400000,26000000,45000000,0x27ca67c8d7a060988c9f8f57bf7c784dd41816a6,0x1667954f14f5b22c703116d8d806f988b1e09018,0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2,0x3432b6a60d23ca0dfca7761b7ab56459d9c964d0,,,,,,, -Factory V2,FXS/ETH,FXSETH,0x03470b57b05089ee40c651dac9e0387f1f3cb46f,yes,curvefi,fxseth_swap,400000,26000000,45000000,0x1aea495539b514a5538878d3d3695c7aeddc61f1,0x03470b57b05089ee40c651dac9e0387f1f3cb46f,0x3432b6a60d23ca0dfca7761b7ab56459d9c964d0,0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2,,,,,,, -Factory V2,FXS/ETH,FXSETH,0x941eb6f616114e4ecaa85377945ea306002612fe,yes,curvefi,fxseth_swap,400000,26000000,45000000,0x90244f43d548a4f8dfecfad91a193465b1fad6f7,0x941eb6f616114e4ecaa85377945ea306002612fe,0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2,0x3432b6a60d23ca0dfca7761b7ab56459d9c964d0,,,,,,, -Factory V2,FXS/ETH,FXSETH,0x6ec176b5449dd7c1a87ca8d97acecc531c0ca0d8,yes,curvefi,fxseth_swap,400000,26000000,45000000,0xd67f3684346e416a8b1311c8955fb6000a083aaa,0x6ec176b5449dd7c1a87ca8d97acecc531c0ca0d8,0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2,0x3432b6a60d23ca0dfca7761b7ab56459d9c964d0,,,,,,, -Factory V1 Plain,handleEUR,fxEUR_CRV,0x8df0713b2a047c45a0bef21c3b309bcef91afd34,yes,curvefi,fxEUR_CRV,10,4000000,4000000,0x8df0713b2a047c45a0bef21c3b309bcef91afd34,0x8df0713b2a047c45a0bef21c3b309bcef91afd34,0x116172b2482c5dc3e6f445c16ac13367ac3fcd35,0xdb25f211ab05b1c97d595516f45794528a807ad8,0x0000000000000000000000000000000000000000,0x0000000000000000000000000000000000000000,,,,,0xe99de9059e65683f7c5e29a0078efecea34e1c2f -Regular,frax,frax,0xd632f22692fac7611d2aa1c0d552930d43caed3b,yes,curvefi,frax,,,,0xd632f22692fac7611d2aa1c0d552930d43caed3b,,0x853d955acef822db058eb8505911ed77f175b99e,0x6c3f90f043a72fa612cbac8115ee7e52bde6e490,,,0x853d955acef822db058eb8505911ed77f175b99e,0x6b175474e89094c44da98b954eedeac495271d0f,0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48,0xdac17f958d2ee523a2206206994597c13d831ec7,0x72e158d38dbd50a483501c24f792bdaaa3e7d55c -Factory V1 Meta,fiat,FIAT+3Crv,0xdb8cc7eced700a4bffde98013760ff31ff9408d8,yes,curvefi,fiat3crv,200,4000000,4000000,0xdb8cc7eced700a4bffde98013760ff31ff9408d8,0xdb8cc7eced700a4bffde98013760ff31ff9408d8,0x586aa273f262909eef8fa02d90ab65f5015e0516,0x6c3f90f043a72fa612cbac8115ee7e52bde6e490,,,0x586aa273f262909eef8fa02d90ab65f5015e0516,0x6b175474e89094c44da98b954eedeac495271d0f,0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48,0xdac17f958d2ee523a2206206994597c13d831ec7,0x71c5dc1b395b02834a97ecf5a0ca062bf8801b07 -Factory V1 Meta,BUSDFRAXBP,BUSDFRAXBP,0x8fdb0bb9365a46b145db80d0b1c5c5e979c84190,yes,curvefi,factory_metapoool_busdfraxbp,200,4000000,4000000,0x8fdb0bb9365a46b145db80d0b1c5c5e979c84190,0x8fdb0bb9365a46b145db80d0b1c5c5e979c84190,0x4fabb145d64652a948d72533023f6e7a623c7c53,,,,0x4fabb145d64652a948d72533023f6e7a623c7c53,,,,0xaeac6dcd12cc0be74c8f99efe4bb5205a1f9a608 -Factory V1 Meta,USDDFRAXBP,USDDFRAXBP,0x4606326b4db89373f5377c316d3b0f6e55bc6a20,yes,curvefi,factory_metapool_usddfraxbp,200,4000000,4000000,0x4606326b4db89373f5377c316d3b0f6e55bc6a20,0x4606326b4db89373f5377c316d3b0f6e55bc6a20,0x0c10bf8fcb7bf5412187a595ab97a3609160b5c6,,,,0x0c10bf8fcb7bf5412187a595ab97a3609160b5c6,,,,0xb8b9dfcb48614fa873ccec72c79d728d39ec9a5c -Factory V1 Meta,TUSDFRAXBP,TUSDFRAXBP,0x33baeda08b8afacc4d3d07cf31d49fc1f1f3e893,yes,curvefi,factory_metapool_tusdfraxbp,200,4000000,4000000,0x33baeda08b8afacc4d3d07cf31d49fc1f1f3e893,0x33baeda08b8afacc4d3d07cf31d49fc1f1f3e893,0x0000000000085d4780b73119b644ae5ecd22b376,,,,0x0000000000085d4780b73119b644ae5ecd22b376,,,,0xf865fdd6a5f307f398a94dc40687995cfaa77bc9 -Factory V1 Meta,sUSDFRAXBP,SUSDFRAXBP,0xe3c190c57b5959ae62efe3b6797058b76ba2f5ef,yes,curvefi,factory_metapool_susdfraxbp,200,4000000,4000000,0xe3c190c57b5959ae62efe3b6797058b76ba2f5ef,0xe3c190c57b5959ae62efe3b6797058b76ba2f5ef,0x57ab1ec28d129707052df4df418d58a2d46d5f51,,,,0x57ab1ec28d129707052df4df418d58a2d46d5f51,,,,0xf6d7087d4ae4dcf85956d743406e63cda74d99ad -Factory V1 Meta,LUSDFRAXBP,LUSDFRAXBP,0x497ce58f34605b9944e6b15ecafe6b001206fd25,yes,curvefi,factory_metapool_lusdfraxbp,200,4000000,4000000,0x497ce58f34605b9944e6b15ecafe6b001206fd25,0x497ce58f34605b9944e6b15ecafe6b001206fd25,0x5f98805a4e8be255a32880fdec7f6728c6568ba0,,,,0x5f98805a4e8be255a32880fdec7f6728c6568ba0,,,,0x389fc079a15354e9cbce8258433cc0f85b755a42 -Factory V1 Meta,GUSDFRAXBP,GUSDFRAXBP,0x4e43151b78b5fbb16298c1161fcbf7531d5f8d93,yes,curvefi,factory_metapool_gusdfraxbp,200,4000000,4000000,0x4e43151b78b5fbb16298c1161fcbf7531d5f8d93,0x4e43151b78b5fbb16298c1161fcbf7531d5f8d93,0x056fd409e1d7a124bd7017459dfea2f387b6d5cd,,,,0x056fd409e1d7a124bd7017459dfea2f387b6d5cd,,,,0xda7f9dd286577cc338047b040c289463743a474e -Factory V1 Meta,apeUSDFRAXBP,APEUSDBP,0x04b727c7e246ca70d496ecf52e6b6280f3c8077d,yes,curvefi,factory_metapool_apeusdfraxbp,200,4000000,4000000,0x04b727c7e246ca70d496ecf52e6b6280f3c8077d,0x04b727c7e246ca70d496ecf52e6b6280f3c8077d,0xff709449528b6fb6b88f557f7d93dece33bca78d,,,,0xff709449528b6fb6b88f557f7d93dece33bca78d,,,,0xd6e48cc0597a1ee12a8beeb88e22bfdb81777164 -Factory V1 Meta,alUSDFRAXBP,alUSDFRAXB,0xb30da2376f63de30b42dc055c93fa474f31330a5,yes,curvefi,factory_metapool_alusdfraxbp,200,4000000,4000000,0xb30da2376f63de30b42dc055c93fa474f31330a5,0xb30da2376f63de30b42dc055c93fa474f31330a5,0xbc6da0fe9ad5f3b0d58160288917aa56653660e9,,,,0xbc6da0fe9ad5f3b0d58160288917aa56653660e9,,,,0x740ba8aa0052e07b925908b380248cb03f3de5cb -Factory V1 Meta,fUSD-3pool,fUSD,0xc2f5fea5197a3d92736500fd7733fcc7a3bbdf3f,yes,curvefi,fUSD,200,4000000,4000000,0xc2f5fea5197a3d92736500fd7733fcc7a3bbdf3f,0xc2f5fea5197a3d92736500fd7733fcc7a3bbdf3f,0x42ef9077d8e79689799673ae588e046f8832cb95,0x6c3f90f043a72fa612cbac8115ee7e52bde6e490,,,0x42ef9077d8e79689799673ae588e046f8832cb95,0x6b175474e89094c44da98b954eedeac495271d0f,0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48,0xdac17f958d2ee523a2206206994597c13d831ec7, -Regular,eurtusd,eurtusd,0x9838eccc42659fa8aa7daf2ad134b53984c9427b,yes,curvefi,eurtusd_swap,,,,0x3b6831c0077a1e44ed0a21841c3bc4dc11bce833,0x5d0f47b32fdd343bfa74ce221808e2abe4a53827,0xc581b735a1688071a1746c968e0798d642ede491,0x6c3f90f043a72fa612cbac8115ee7e52bde6e490,,,0xc581b735a1688071a1746c968e0798d642ede491,0x6b175474e89094c44da98b954eedeac495271d0f,0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48,0xdac17f958d2ee523a2206206994597c13d831ec7,0x4fd86ce7ecea88f7e0aa78dc12625996fb3a04bc -Factory V1 Plain,Euro Tether,EURT,0xfd5db7463a3ab53fd211b4af195c5bccc1a03890,yes,curvefi,eurt,100,4000000,4000000,0xfd5db7463a3ab53fd211b4af195c5bccc1a03890,0xfd5db7463a3ab53fd211b4af195c5bccc1a03890,0xc581b735a1688071a1746c968e0798d642ede491,0xd71ecff9342a5ced620049e616c5035f1db98620,0x0000000000000000000000000000000000000000,0x0000000000000000000000000000000000000000,,,,, -Regular,eursusd,eursusd,0x98a7f18d4e56cfe84e3d081b40001b3d5bd3eb8b,yes,curvefi,eursusdc_swap,,,,0x3d229e1b4faab62f621ef2f6a610961f7bd7b23b,,0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48,0xdb25f211ab05b1c97d595516f45794528a807ad8,,,,,,,0x65ca7dc5cb661fc58de57b1e1af404649a27ad35 -Regular,eurs,eurs,0x0ce6a5ff5217e38315f87032cf90686c96627caa,yes,curvefi,eurs_swap,,,,0x194ebd173f6cdace046c53eacce9b953f28411d1,,0xdb25f211ab05b1c97d595516f45794528a807ad8,0xd71ecff9342a5ced620049e616c5035f1db98620,,,,,,,0x90bb609649e0451e5ad952683d64bd2d1f245840 -Factory V2,DYDX/ETH,DYDXETH,0x8b0afa4b63a3581b731da9d79774a3eae63b5abd,yes,curvefi,dydxeth_swap,400000,26000000,45000000,0x4acc1bf7d6a591016641325aa6664a1cd178f002,0x8b0afa4b63a3581b731da9d79774a3eae63b5abd,0x92d6c1e31e14520e676a687f0a93788b716beff5,0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2,,,,,,, -Regular,dusd,dusd,0x8038c01a0390a8c547446a0b2c18fc9aefecc10c,yes,curvefi,dusd_swap,,,,0x3a664ab939fd8482048609f652f9a0b0677337b9,0x61e10659fe3aa93d036d099405224e4ac24996d0,0x5bc25f649fc4e26069ddf4cf4010f9f706c23831,0x6c3f90f043a72fa612cbac8115ee7e52bde6e490,,,0x5bc25f649fc4e26069ddf4cf4010f9f706c23831,0x6b175474e89094c44da98b954eedeac495271d0f,0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48,0xdac17f958d2ee523a2206206994597c13d831ec7,0xaea6c312f4b3e04d752946d329693f7293bc2e6d -Factory V2,DUCK/ETH,DUCKETH,0xd8c49617e6a2c7584ddbeab652368ee84954bf5c,yes,curvefi,ducketh,400000,26000000,45000000,0x91f2f1b9d9c7d838c87b687d2accd1f0be8fae5d,0xd8c49617e6a2c7584ddbeab652368ee84954bf5c,0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2,0x92e187a03b6cd19cb6af293ba17f2745fd2357d5,,,,,,, -Factory V1 Meta,DOLA-3pool Curve LP,DOLA3POOL,0xaa5a67c256e27a5d80712c51971408db3370927d,yes,curvefi,dola_3crv_pool,100,4000000,4000000,0xaa5a67c256e27a5d80712c51971408db3370927d,0xaa5a67c256e27a5d80712c51971408db3370927d,0x865377367054516e17014ccded1e7d814edc9ce4,0x6c3f90f043a72fa612cbac8115ee7e52bde6e490,,,0x865377367054516e17014ccded1e7d814edc9ce4,0x6b175474e89094c44da98b954eedeac495271d0f,0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48,0xdac17f958d2ee523a2206206994597c13d831ec7,0x8fa728f393588e8d8dd1ca397e9a710e53fa553a -Factory V1 Meta,DEI,DEI,0x6870f9b4dd5d34c7fc53d0d85d9dbd1aab339bf7,yes,curvefi,dei,10,4000000,4000000,0x6870f9b4dd5d34c7fc53d0d85d9dbd1aab339bf7,0x6870f9b4dd5d34c7fc53d0d85d9dbd1aab339bf7,0xde12c7959e1a72bbe8a5f7a1dc8f8eef9ab011b3,0x6c3f90f043a72fa612cbac8115ee7e52bde6e490,,,0xde12c7959e1a72bbe8a5f7a1dc8f8eef9ab011b3,0x6b175474e89094c44da98b954eedeac495271d0f,0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48,0xdac17f958d2ee523a2206206994597c13d831ec7, -Factory V2,cvxFxs/Fxs,cvxFXSFXS,0xd658a338613198204dca1143ac3f01a722b5d94a,yes,curvefi,cvxfxsfxs_swap,200000000,15000000,30000000,0xf3a43307dcafa93275993862aae628fcb50dc768,0xd658a338613198204dca1143ac3f01a722b5d94a,0x3432b6a60d23ca0dfca7761b7ab56459d9c964d0,0xfeef77d3f69374f66429c91d732a244f074bdf74,,,,,,, -Regular,cvxeth,cvxeth,0xb576491f1e6e5e62f1d8f26062ee822b40b0e0d4,yes,curvefi,cvxeth_swap,,,,0x3a283d9c08e8b55966afb64c515f5143cf907611,,0x0000000000000000000000000000000000000000,0x4e3fbd56cd56c3e72c1403e103b45db9da5b9d2b,,,,,,,0x7e1444ba99dcdffe8fbdb42c02f0005d14f13be1 -Factory V1 Plain,cvxCRV,cvxcrv,0x9d0464996170c6b9e75eed71c68b99ddedf279e8,yes,curvefi,cvxcrv,50,15000000,15000000,0x9d0464996170c6b9e75eed71c68b99ddedf279e8,0x9d0464996170c6b9e75eed71c68b99ddedf279e8,0xd533a949740bb3306d119cc777fa900ba034cd52,0x62b9c7356a2dc64a1969e19c23e4f579f9810aa7,0x0000000000000000000000000000000000000000,0x0000000000000000000000000000000000000000,,,,,0x903da6213a5a12b61c821598154efad98c3b20e4 -Regular,crveth,crveth,0x8301ae4fc9c624d1d396cbdaa1ed877821d7c511,yes,curvefi,crveth_swap,,,,0xed4064f376cb8d68f770fb1ff088a3d0f3ff5c4d,,0x0000000000000000000000000000000000000000,0xd533a949740bb3306d119cc777fa900ba034cd52,,,,,,,0x1cebdb0856dd985fae9b8fea2262469360b8a3a6 -Factory V1 Plain,Curve.fi sCRV/CRV,crvCRVsCRV,0x621f13bf667207335c601f8c89ea5ec260bada9a,yes,curvefi,crvCRVsCRV,100,4000000,4000000,0x621f13bf667207335c601f8c89ea5ec260bada9a,0x621f13bf667207335c601f8c89ea5ec260bada9a,0xd38aeb759891882e78e957c80656572503d8c1b1,0xd533a949740bb3306d119cc777fa900ba034cd52,0x0000000000000000000000000000000000000000,0x0000000000000000000000000000000000000000,,,,, -Factory V1 Plain,Ahead of the Curve,crvCRV,0xda5b670ccd418a187a3066674a8002adc9356ad1,yes,curvefi,crvCRV,10,4000000,4000000,0xda5b670ccd418a187a3066674a8002adc9356ad1,0xda5b670ccd418a187a3066674a8002adc9356ad1,0xd533a949740bb3306d119cc777fa900ba034cd52,0x9d409a0a012cfba9b15f6d4b36ac57a46966ab9a,0x62b9c7356a2dc64a1969e19c23e4f579f9810aa7,0xd38aeb759891882e78e957c80656572503d8c1b1,,,,, -Regular,compound,compound,0xa2b47e3d5c44877cca798226b7b8118f9bfb7a56,yes,curvefi,compound_swap,,,,0x845838df265dcd2c412a1dc9e959c7d08537f8a2,0xeb21209ae4c2c9ff2a86aca31e123764a3b6bc06,0x5d3a536e4d6dbd6114cc1ead35777bab948e3643,0x39aa39c021dfbae8fac545936693ac917d5e7563,,,0x6b175474e89094c44da98b954eedeac495271d0f,0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48,,,0x7ca5b0a2910b33e9759dc7ddb0413949071d7575 -Factory V2,CADC/USDC,CADCUSDC,0xe07bde9eb53deffa979dae36882014b758111a78,yes,curvefi,cadcusdc_swap,200000000,5000000,45000000,0x1054ff2ffa34c055a13dcd9e0b4c0ca5b3aeceb9,0xe07bde9eb53deffa979dae36882014b758111a78,0xcadc0acd4b445166f12d2c07eac6e2544fbe2eef,0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48,,,,,,, -Factory V1 Plain,Badger Locked CVX,bveCVX-CVX,0x04c90c198b2eff55716079bc06d7ccc4aa4d7512,yes,curvefi,bveCVX_CVX,100,4000000,4000000,0x04c90c198b2eff55716079bc06d7ccc4aa4d7512,0x04c90c198b2eff55716079bc06d7ccc4aa4d7512,0x4e3fbd56cd56c3e72c1403e103b45db9da5b9d2b,0xfd05d3c7fe2924020620a8be4961bbaa747e6305,0x0000000000000000000000000000000000000000,0x0000000000000000000000000000000000000000,,,,,0x1b759a88543931f4bb983bca4194306039cb979c -Regular,busdv2,busdv2,0x4807862aa8b2bf68830e4c8dc86d0e9a998e085a,yes,curvefi,busdv2,,,,0x4807862aa8b2bf68830e4c8dc86d0e9a998e085a,,0x4fabb145d64652a948d72533023f6e7a623c7c53,0x6c3f90f043a72fa612cbac8115ee7e52bde6e490,,,0x4fabb145d64652a948d72533023f6e7a623c7c53,0x6b175474e89094c44da98b954eedeac495271d0f,0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48,0xdac17f958d2ee523a2206206994597c13d831ec7,0xd4b22fedca85e684919955061fdf353b9d38389b -Regular,busd,busd,0x79a8c46dea5ada233abaffd40f3a0a2b1e5a4f27,yes,curvefi,busd_swap,,,,0x3b3ac5386837dc563660fb6a0937dfaa5924333b,0xb6c057591e073249f2d9d88ba59a46cfc9b59edb,0xc2cb1040220768554cf699b0d863a3cd4324ce32,0x26ea744e5b887e5205727f55dfbe8685e3b21951,0xe6354ed5bc4b393a5aad09f21c46e101e692d447,0x04bc0ab673d88ae9dbc9da2380cb6b79c4bca9ae,0x6b175474e89094c44da98b954eedeac495271d0f,0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48,0xdac17f958d2ee523a2206206994597c13d831ec7,0x4fabb145d64652a948d72533023f6e7a623c7c53,0x69fb7c45726cfe2badee8317005d3f94be838840 -Factory V2,BTRFLY/ETH,BTRFLYETH,0xf43b15ab692fde1f9c24a9fce700adcc809d5391,yes,curvefi,btrfly_eth_swap,400000,26000000,45000000,0xe160364fd8407ffc8b163e278300c6c5d18ff61d,0xf43b15ab692fde1f9c24a9fce700adcc809d5391,0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2,0xc0d4ceb216b3ba9c3701b291766fdcba977cec3a,,,,,,, -Factory V1 Meta,Bhome,bhome,0x3b22b869ba3c0a495cead0b8a009b70886d37fac,yes,curvefi,bhome,10,4000000,4000000,0x3b22b869ba3c0a495cead0b8a009b70886d37fac,0x3b22b869ba3c0a495cead0b8a009b70886d37fac,0xb8919522331c59f5c16bdfaa6a121a6e03a91f62,0x6c3f90f043a72fa612cbac8115ee7e52bde6e490,,,0xb8919522331c59f5c16bdfaa6a121a6e03a91f62,0x6b175474e89094c44da98b954eedeac495271d0f,0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48,0xdac17f958d2ee523a2206206994597c13d831ec7, -Factory V1 Plain,bentCVX,bentcvx,0xf083fba98ded0f9c970e5a418500bad08d8b9732,yes,curvefi,bentcvx,50,15000000,15000000,0xf083fba98ded0f9c970e5a418500bad08d8b9732,0xf083fba98ded0f9c970e5a418500bad08d8b9732,0x4e3fbd56cd56c3e72c1403e103b45db9da5b9d2b,0x9e0441e084f5db0606565737158aa6ab6b970fe0,0x0000000000000000000000000000000000000000,0x0000000000000000000000000000000000000000,,,,, -Factory V1 Plain,Bean-LUSD,BEANLUSD,0xd652c40fbb3f06d6b58cb9aa9cff063ee63d465d,yes,curvefi,bean_lusd_pool,100,4000000,4000000,0xd652c40fbb3f06d6b58cb9aa9cff063ee63d465d,0xd652c40fbb3f06d6b58cb9aa9cff063ee63d465d,0xdc59ac4fefa32293a95889dc396682858d52e5db,0x5f98805a4e8be255a32880fdec7f6728c6568ba0,0x0000000000000000000000000000000000000000,0x0000000000000000000000000000000000000000,,,,, -Regular,bbtc,bbtc,0x071c661b4deefb59e2a3ddb20db036821eee8f4b,yes,curvefi,bbtc_swap,,,,0x410e3e86ef427e30b9235497143881f717d93c2a,0xc45b2eee6e09ca176ca3bb5f7eee7c47bf93c756,0x9be89d2a4cd102d8fecc6bf9da793be995c22541,0x075b1bb99792c9e1041ba13afef80c91a1e70fb3,,,0x9be89d2a4cd102d8fecc6bf9da793be995c22541,0xeb4c2781e4eba804ce9a9803c67d0893436bb27d,0x2260fac5e5542a773aa44fbcfedf7c193bc2c599,0xfe18be6b3bd88a2d2a7f928d00292e7a9963cfc6,0xdfc7adfa664b08767b735de28f9e84cd30492aee -Factory V1 Meta,baoUSD,baoUSD-,0x0fafafd3c393ead5f5129cfc7e0e12367088c473,yes,curvefi,baoUSD,100,4000000,4000000,0x0fafafd3c393ead5f5129cfc7e0e12367088c473,0x0fafafd3c393ead5f5129cfc7e0e12367088c473,0x7945b0a6674b175695e5d1d08ae1e6f13744abb0,0x6c3f90f043a72fa612cbac8115ee7e52bde6e490,,,0x7945b0a6674b175695e5d1d08ae1e6f13744abb0,0x6b175474e89094c44da98b954eedeac495271d0f,0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48,0xdac17f958d2ee523a2206206994597c13d831ec7, -Factory V2,BADGER/WBTC,BADGERWBTC,0x50f3752289e1456bfa505afd37b241bca23e685d,yes,curvefi,badgerwbtc_swap,400000,26000000,45000000,0x137469b55d1f15651ba46a89d0588e97dd0b6562,0x50f3752289e1456bfa505afd37b241bca23e685d,0x3472a5a71965499acd81997a54bba8d852c6e53d,0x2260fac5e5542a773aa44fbcfedf7c193bc2c599,,,,,,, -Regular,ankreth,ankreth,0xa96a65c051bf88b4095ee1f2451c2a9d43f53ae2,yes,curvefi,ankreth_swap,,,,0xaa17a236f2badc98ddc0cf999abb47d47fc0a6cf,,0x0000000000000000000000000000000000000000,0xe95a203b1a91a908f9b9ce46459d101078c2c3cb,,,,,,,0x6d10ed2cf043e6fcf51a0e7b4c2af3fa06695707 -Regular,alusd,alusd,0x43b4fdfd4ff969587185cdb6f0bd875c5fc83f8c,yes,curvefi,alusd,,,,0x43b4fdfd4ff969587185cdb6f0bd875c5fc83f8c,,0xbc6da0fe9ad5f3b0d58160288917aa56653660e9,0x6c3f90f043a72fa612cbac8115ee7e52bde6e490,,,0xbc6da0fe9ad5f3b0d58160288917aa56653660e9,0x6b175474e89094c44da98b954eedeac495271d0f,0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48,0xdac17f958d2ee523a2206206994597c13d831ec7,0x9582c4adacb3bce56fea3e590f05c3ca2fb9c477 -Factory V1 Plain,alETH,alETH+ETH,0xc4c319e2d4d66cca4464c0c2b32c9bd23ebe784e,yes,curvefi,aleth,100,4000000,4000000,0xc4c319e2d4d66cca4464c0c2b32c9bd23ebe784e,0xc4c319e2d4d66cca4464c0c2b32c9bd23ebe784e,0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee,0x0100546f2cd4c9d97f798ffc9755e47865ff7ee6,0x0000000000000000000000000000000000000000,0x0000000000000000000000000000000000000000,,,,,0x12dcd9e8d1577b5e4f066d8e7d404404ef045342 -Factory V2,ALCX/ETH,ALCXETH,0xa498b08ca3c109e4ebc7ff01422b6769eaef16ef,yes,curvefi,alcxeth_swap,400000,26000000,45000000,0x3010c5746833bbd5f244bd42f97f20c45f2bbf25,0xa498b08ca3c109e4ebc7ff01422b6769eaef16ef,0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2,0xdbdb4d16eda451d0503b854cf79d55697f90c8df,,,,,,, -Factory V1 Plain,agEUR/ibEUR,ag+ib-EUR,0xb37d6c07482bc11cd28a1f11f1a6ad7b66dec933,yes,curvefi,ag_ibEUR,200,4000000,4000000,0xb37d6c07482bc11cd28a1f11f1a6ad7b66dec933,0xb37d6c07482bc11cd28a1f11f1a6ad7b66dec933,0x96e61422b6a9ba0e068b6c5add4ffabc6a4aae27,0x1a7e4e63778b4f12a199c062f3efdd288afcbce8,0x0000000000000000000000000000000000000000,0x0000000000000000000000000000000000000000,,,,,0x38039dd47636154273b287f74c432cac83da97e2 -Factory V1 Plain,agEUR,agEUR/sEUR,0x45a8cc73ec100306af64ab2ccb7b12e70ec549a8,yes,curvefi,agEURsEUR,200,4000000,4000000,0x45a8cc73ec100306af64ab2ccb7b12e70ec549a8,0x45a8cc73ec100306af64ab2ccb7b12e70ec549a8,0x1a7e4e63778b4f12a199c062f3efdd288afcbce8,0xd71ecff9342a5ced620049e616c5035f1db98620,0x0000000000000000000000000000000000000000,0x0000000000000000000000000000000000000000,,,,, -Regular,aave,aave,0xdebf20617708857ebe4f679508e7b7863a8a8eee,yes,curvefi,aave_swap,,,,0xfd2a8fa60abd58efe3eee34dd494cd491dc14900,,0x028171bca77440897b824ca71d1c56cac55b68a3,0xbcca60bb61934080951369a648fb03df4f96263c,0x3ed3b47dd13ec9a98b44e6204a523e766b225811,,0x6b175474e89094c44da98b954eedeac495271d0f,0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48,0xdac17f958d2ee523a2206206994597c13d831ec7,,0xd662908ada2ea1916b3318327a97eb18ad588b5d -Factory V1 Plain,AAVE Untethered,aUSDC+aDAI,0x6a274de3e2462c7614702474d64d376729831dca,yes,curvefi,aUSDC_aDAI,100,4000000,4000000,0x6a274de3e2462c7614702474d64d376729831dca,0x6a274de3e2462c7614702474d64d376729831dca,0xbcca60bb61934080951369a648fb03df4f96263c,0x028171bca77440897b824ca71d1c56cac55b68a3,0x0000000000000000000000000000000000000000,0x0000000000000000000000000000000000000000,,,,,0xd81370cad41b244b8d2129153997e26ceeab3bef -Factory V1 Plain,Ankr Reward-Earning Staked MATIC,aMATICb,0x1f6bb2a7a2a84d08bb821b89e38ca651175aedd4,yes,curvefi,aMATICb,200,4000000,4000000,0x1f6bb2a7a2a84d08bb821b89e38ca651175aedd4,0x1f6bb2a7a2a84d08bb821b89e38ca651175aedd4,0x7d1afa7b718fb893db30a3abc0cfc608aacfebb0,0x99534ef705df1fff4e4bd7bbaaf9b0dff038ebfe,0x0000000000000000000000000000000000000000,0x0000000000000000000000000000000000000000,,,,,0xd4a0db2627670a3fc1390f0947ed1ccd29bed28c -Factory V1 Plain,Ankr Reward-Earning Staked ETH,aETHb,0xfb9a265b5a1f52d97838ec7274a0b1442efacc87,yes,curvefi,aETHb,100,4000000,4000000,0xfb9a265b5a1f52d97838ec7274a0b1442efacc87,0xfb9a265b5a1f52d97838ec7274a0b1442efacc87,0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee,0xd01ef7c0a5d8c432fc2d1a85c66cf2327362e5c6,0x0000000000000000000000000000000000000000,0x0000000000000000000000000000000000000000,,,,,0xdd9b30168aeded944042568bfe16f73ef2b4573e -Factory V1 Meta,SORA XSTUSD,XSTUSD,0x1033812efec8716bbae0c19e5678698d25e26edf,yes,curvefi,XSTUSD,100,4000000,4000000,0x1033812efec8716bbae0c19e5678698d25e26edf,0x1033812efec8716bbae0c19e5678698d25e26edf,0xc7d9c108d4e1dd1484d3e2568d7f74bfd763d356,0x6c3f90f043a72fa612cbac8115ee7e52bde6e490,,,0xc7d9c108d4e1dd1484d3e2568d7f74bfd763d356,0x6b175474e89094c44da98b954eedeac495271d0f,0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48,0xdac17f958d2ee523a2206206994597c13d831ec7,0xb3d8e2a22a28dc55b26236c45cc1df75e5081ef5 -Factory V1 Meta,xDollar Interverse Money,XIM3CRV,0x679ce2a8b3180f5a00e0dcca26783016799e9a58,yes,curvefi,XIM3CRV,100,4000000,4000000,0x679ce2a8b3180f5a00e0dcca26783016799e9a58,0x679ce2a8b3180f5a00e0dcca26783016799e9a58,0x573d2505a7ee69d136a8667b4cd915f039ac54e5,0x6c3f90f043a72fa612cbac8115ee7e52bde6e490,,,0x573d2505a7ee69d136a8667b4cd915f039ac54e5,0x6b175474e89094c44da98b954eedeac495271d0f,0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48,0xdac17f958d2ee523a2206206994597c13d831ec7, -Factory V1 Meta,xim,XIM,0x6d8ff88973b15df3e2dc6abb9af29cad8c2b5ef5,yes,curvefi,XIM,100,4000000,4000000,0x6d8ff88973b15df3e2dc6abb9af29cad8c2b5ef5,0x6d8ff88973b15df3e2dc6abb9af29cad8c2b5ef5,0x573d2505a7ee69d136a8667b4cd915f039ac54e5,0x6c3f90f043a72fa612cbac8115ee7e52bde6e490,,,0x573d2505a7ee69d136a8667b4cd915f039ac54e5,0x6b175474e89094c44da98b954eedeac495271d0f,0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48,0xdac17f958d2ee523a2206206994597c13d831ec7,0x63093c86472469f55c4f6c7cbff83ec18cd8a94b -Factory V1 Plain,Stax Frax/Temple xLP + LP,xFraxTplLP,0xdadfd00a2bbeb1abc4936b1644a3033e1b653228,yes,stax,Vyper_contract,40,29400000,29400000,0xdadfd00a2bbeb1abc4936b1644a3033e1b653228,0xdadfd00a2bbeb1abc4936b1644a3033e1b653228,0xbcb8b7fc9197feda75c101fa69d3211b5a30dcd9,0x6021444f1706f15465bee85463bcc7d7cc17fc03,0x0000000000000000000000000000000000000000,0x0000000000000000000000000000000000000000,,,,,0x8f162742a7bcdb87eb52d83c687e43356055a68b -Factory V1 Meta,dForce,USX3CRV,0x76264772707c8bc24261516b560cbf3cbe6f7819,yes,curvefi,USX3CRV,100,4000000,4000000,0x76264772707c8bc24261516b560cbf3cbe6f7819,0x76264772707c8bc24261516b560cbf3cbe6f7819,0x0a5e677a6a24b2f1a2bf4f3bffc443231d2fdec8,0x6c3f90f043a72fa612cbac8115ee7e52bde6e490,,,0x0a5e677a6a24b2f1a2bf4f3bffc443231d2fdec8,0x6b175474e89094c44da98b954eedeac495271d0f,0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48,0xdac17f958d2ee523a2206206994597c13d831ec7, -Factory V1 Plain,UST-FRAX,UST-FRAX,0x1c65ba665ce39cfe85639227eccf17be2b167058,yes,curvefi,USTFRAX,200,4000000,4000000,0x1c65ba665ce39cfe85639227eccf17be2b167058,0x1c65ba665ce39cfe85639227eccf17be2b167058,0xa693b19d2931d498c5b318df961919bb4aee87a5,0x853d955acef822db058eb8505911ed77f175b99e,0x0000000000000000000000000000000000000000,0x0000000000000000000000000000000000000000,,,,,0x3084218bd8338a0340c74b658aff2212ab69cab1 -Factory V2,TOKE/ETH,TOKEETH,0xe0e970a99bc4f53804d8145bebbc7ebc9422ba7f,yes,curvefi,TOKEETH,400000,26000000,45000000,0x7ea4ad8c803653498bf6ac1d2debc04dce8fd2ad,0xe0e970a99bc4f53804d8145bebbc7ebc9422ba7f,0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2,0x2e9d63788249371f1dfc918a52f8d799f4a38c94,,,,,,, -Factory V2,STG/USDC,STGUSDC,0x3211c6cbef1429da3d0d58494938299c92ad5860,yes,curvefi,STG_USDC,400000,26000000,45000000,0xdf55670e27be5cde7228dd0a6849181891c9eba1,0x3211c6cbef1429da3d0d58494938299c92ad5860,0xaf5191b0de278c7286d6c7cc6ab6bb8a73ba2cd6,0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48,,,,,,, -Factory V1 Meta,RAMP rUSD,RAMP rUSD,0x8083b047e962ca45b210e28ac755fbda3d773c5b,yes,curvefi,RAMPrUSD,100,4000000,4000000,0x8083b047e962ca45b210e28ac755fbda3d773c5b,0x8083b047e962ca45b210e28ac755fbda3d773c5b,0xcf178a685471927e977a0ea8ee555c11b2aa6b7b,0x6c3f90f043a72fa612cbac8115ee7e52bde6e490,,,0xcf178a685471927e977a0ea8ee555c11b2aa6b7b,0x6b175474e89094c44da98b954eedeac495271d0f,0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48,0xdac17f958d2ee523a2206206994597c13d831ec7,0xecd04fcf4c1a2b1c300e386a96d0906bc31e22b3 -Factory V1 Meta,QBIT Well,QWell1,0x9f4a88da14f2b6dbc785c1db3511a53b8f342bde,yes,curvefi,QWell1,100,8400000,8400000,0x9f4a88da14f2b6dbc785c1db3511a53b8f342bde,0x9f4a88da14f2b6dbc785c1db3511a53b8f342bde,0x8b921e618dd3fa5a199b0a8b7901f5530d74ef27,0x6c3f90f043a72fa612cbac8115ee7e52bde6e490,,,0x8b921e618dd3fa5a199b0a8b7901f5530d74ef27,0x6b175474e89094c44da98b954eedeac495271d0f,0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48,0xdac17f958d2ee523a2206206994597c13d831ec7, -Factory V1 Meta,QabbalahBit Wellsprings,QBITWELLS,0xc8781f2193e2cb861c9325677d98297f94a0dfd3,yes,curvefi,QBITWELLS,10,18000000,18000000,0xc8781f2193e2cb861c9325677d98297f94a0dfd3,0xc8781f2193e2cb861c9325677d98297f94a0dfd3,0x8b921e618dd3fa5a199b0a8b7901f5530d74ef27,0x6c3f90f043a72fa612cbac8115ee7e52bde6e490,,,0x8b921e618dd3fa5a199b0a8b7901f5530d74ef27,0x6b175474e89094c44da98b954eedeac495271d0f,0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48,0xdac17f958d2ee523a2206206994597c13d831ec7, -Factory V1 Meta,PWRD Metapool,PWRD3CRV,0x2de8c952871317fb9f22c73bb66bf86a1eebe1a5,yes,curvefi,PWRD3CRV,200,4000000,4000000,0x2de8c952871317fb9f22c73bb66bf86a1eebe1a5,0x2de8c952871317fb9f22c73bb66bf86a1eebe1a5,0xf0a93d4994b3d98fb5e3a2f90dbc2d69073cb86b,0x6c3f90f043a72fa612cbac8115ee7e52bde6e490,,,0xf0a93d4994b3d98fb5e3a2f90dbc2d69073cb86b,0x6b175474e89094c44da98b954eedeac495271d0f,0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48,0xdac17f958d2ee523a2206206994597c13d831ec7,0x17f18b0bc46dafb1772d88897a8f8782bf3285e8 -Factory V1 Meta,PWRD Metapool,PWRD,0xbcb91e689114b9cc865ad7871845c95241df4105,yes,curvefi,PWRD,200,4000000,4000000,0xbcb91e689114b9cc865ad7871845c95241df4105,0xbcb91e689114b9cc865ad7871845c95241df4105,0xf0a93d4994b3d98fb5e3a2f90dbc2d69073cb86b,0x6c3f90f043a72fa612cbac8115ee7e52bde6e490,,,0xf0a93d4994b3d98fb5e3a2f90dbc2d69073cb86b,0x6b175474e89094c44da98b954eedeac495271d0f,0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48,0xdac17f958d2ee523a2206206994597c13d831ec7,0xb07d00e0ee9b1b2eb9f1b483924155af7af0c8fa -Factory V1 Meta,Orkan,ORK,0x148a88719ba0b34f16e0f5a7537da73bdc9c2a2a,yes,curvefi,ORK,100,4000000,4000000,0x148a88719ba0b34f16e0f5a7537da73bdc9c2a2a,0x148a88719ba0b34f16e0f5a7537da73bdc9c2a2a,0xe1406825186d63980fd6e2ec61888f7b91c4bae4,0x075b1bb99792c9e1041ba13afef80c91a1e70fb3,,,0xe1406825186d63980fd6e2ec61888f7b91c4bae4,0xeb4c2781e4eba804ce9a9803c67d0893436bb27d,0x2260fac5e5542a773aa44fbcfedf7c193bc2c599,0xfe18be6b3bd88a2d2a7f928d00292e7a9963cfc6, -Factory V1 Plain,OPEN MATIC,OPEN MATIC,0xc8a7c1c4b748970f57ca59326bcd49f5c9dc43e3,yes,curvefi,OPEN_MATIC,100,4000000,4000000,0xc8a7c1c4b748970f57ca59326bcd49f5c9dc43e3,0xc8a7c1c4b748970f57ca59326bcd49f5c9dc43e3,0x69e8b9528cabda89fe846c67675b5d73d463a916,0x7d1afa7b718fb893db30a3abc0cfc608aacfebb0,0x0000000000000000000000000000000000000000,0x0000000000000000000000000000000000000000,,,,, -Factory V1 Plain,MIM-UST,MIM-UST,0x55a8a39bc9694714e2874c1ce77aa1e599461e18,yes,curvefi,MIM_UST,200,4000000,4000000,0x55a8a39bc9694714e2874c1ce77aa1e599461e18,0x55a8a39bc9694714e2874c1ce77aa1e599461e18,0x99d8a9c45b2eca8864373a26d1459e3dff1e17f3,0xa47c8bf37f92abed4a126bda807a7b7498661acd,0x0000000000000000000000000000000000000000,0x0000000000000000000000000000000000000000,,,,,0xb518f5e3242393d4ec792bd3f44946a3b98d0e48 -Factory V1 Plain,JPYC/ibJPY,JPYC+ibJPY,0xbb2dc673e1091abca3eadb622b18f6d4634b2cd9,yes,curvefi,JPYC_ibJPY,200,4000000,4000000,0xbb2dc673e1091abca3eadb622b18f6d4634b2cd9,0xbb2dc673e1091abca3eadb622b18f6d4634b2cd9,0x2370f9d504c7a6e775bf6e14b3f12846b594cd53,0x5555f75e3d5278082200fb451d1b6ba946d8e13b,0x0000000000000000000000000000000000000000,0x0000000000000000000000000000000000000000,,,,, -Factory V1 Meta,FEI Metapool,FEI3CRV,0x06cb22615ba53e60d67bf6c341a0fd5e718e1655,yes,fei_protocol,Fei3Crv,10,4000000,4000000,0x06cb22615ba53e60d67bf6c341a0fd5e718e1655,0x06cb22615ba53e60d67bf6c341a0fd5e718e1655,0x956f47f50a910163d8bf957cf5846d573e7f87ca,0x6c3f90f043a72fa612cbac8115ee7e52bde6e490,,,0x956f47f50a910163d8bf957cf5846d573e7f87ca,0x6b175474e89094c44da98b954eedeac495271d0f,0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48,0xdac17f958d2ee523a2206206994597c13d831ec7,0xdc69d4cb5b86388fff0b51885677e258883534ae -Factory V1 Plain,Fei PCV 1,FEIPCV-1,0xa0d35faead5299bf18efbb5defd1ec6d4ab4ef3b,yes,curvefi,FEIPCV_1,1000,4000000,4000000,0xa0d35faead5299bf18efbb5defd1ec6d4ab4ef3b,0xa0d35faead5299bf18efbb5defd1ec6d4ab4ef3b,0x683923db55fead99a79fa01a27eec3cb19679cc3,0x028171bca77440897b824ca71d1c56cac55b68a3,0x5f98805a4e8be255a32880fdec7f6728c6568ba0,0x0000000000000000000000000000000000000000,,,,, -Factory V1 Plain,Neutrino EUR,EURN/EURT,0x3fb78e61784c9c637d560ede23ad57ca1294c14a,yes,curvefi,EURN_EURT,200,4000000,4000000,0x3fb78e61784c9c637d560ede23ad57ca1294c14a,0x3fb78e61784c9c637d560ede23ad57ca1294c14a,0x9fcf418b971134625cdf38448b949c8640971671,0xc581b735a1688071a1746c968e0798d642ede491,0x0000000000000000000000000000000000000000,0x0000000000000000000000000000000000000000,,,,,0xd9277b0d007464eff133622ec0d42081c93cef02 -Factory V1 Plain,Sharedstake ETH/vETH2,ETH/vETH2,0xf03bd3cfe85f00bf5819ac20f0870ce8a8d1f0d8,yes,curvefi,ETH_vETH2,100,4000000,4000000,0xf03bd3cfe85f00bf5819ac20f0870ce8a8d1f0d8,0xf03bd3cfe85f00bf5819ac20f0870ce8a8d1f0d8,0x898bad2774eb97cf6b94605677f43b41871410b1,0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2,0x0000000000000000000000000000000000000000,0x0000000000000000000000000000000000000000,,,,, -Factory V1 Meta,ELONX POOL,ELONXSWAP,0x8ed10e4e307822b969bcdaffd49095235f6f892b,yes,curvefi,ELONXSWAP,10,4000000,4000000,0x8ed10e4e307822b969bcdaffd49095235f6f892b,0x8ed10e4e307822b969bcdaffd49095235f6f892b,0x815b4ce34fac32b951bd26ea85901e3b834204b6,0x6c3f90f043a72fa612cbac8115ee7e52bde6e490,,,0x815b4ce34fac32b951bd26ea85901e3b834204b6,0x6b175474e89094c44da98b954eedeac495271d0f,0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48,0xdac17f958d2ee523a2206206994597c13d831ec7, -Factory V1 Meta,DSU,DSU+3Crv,0x9fed7a930d86dfe5980040e18c92b1b0d381ec19,yes,curvefi,DSU3Crv,200,4000000,4000000,0x9fed7a930d86dfe5980040e18c92b1b0d381ec19,0x9fed7a930d86dfe5980040e18c92b1b0d381ec19,0x605d26fbd5be761089281d5cec2ce86eea667109,0x6c3f90f043a72fa612cbac8115ee7e52bde6e490,,,0x605d26fbd5be761089281d5cec2ce86eea667109,0x6b175474e89094c44da98b954eedeac495271d0f,0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48,0xdac17f958d2ee523a2206206994597c13d831ec7, -Factory V1 Meta,DSU,DSU,0xf0c081020b9d06eb1b33e357767c00ccc138be7c,yes,curvefi,DSU,200,4000000,4000000,0xf0c081020b9d06eb1b33e357767c00ccc138be7c,0xf0c081020b9d06eb1b33e357767c00ccc138be7c,0x605d26fbd5be761089281d5cec2ce86eea667109,0x6c3f90f043a72fa612cbac8115ee7e52bde6e490,,,0x605d26fbd5be761089281d5cec2ce86eea667109,0x6b175474e89094c44da98b954eedeac495271d0f,0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48,0xdac17f958d2ee523a2206206994597c13d831ec7,0x76d96c0522b3f820de53ea8ea98fe8b38b35af3f -Factory V1 Plain,d3pool,D3,0xbaaa1f5dba42c3389bdbc2c9d2de134f5cd0dc89,yes,curvefi,D3,200,4000000,4000000,0xbaaa1f5dba42c3389bdbc2c9d2de134f5cd0dc89,0xbaaa1f5dba42c3389bdbc2c9d2de134f5cd0dc89,0x853d955acef822db058eb8505911ed77f175b99e,0x956f47f50a910163d8bf957cf5846d573e7f87ca,0xbc6da0fe9ad5f3b0d58160288917aa56653660e9,0x0000000000000000000000000000000000000000,,,,,0x16c2bee6f55dab7f494dba643ff52ef2d47fba36 -Factory V1 Meta,BTCpx,BTCpx,0x4e52cfc80679f402d10f7766fa3f85351a7c2530,yes,curvefi,BTCpx,200,4000000,4000000,0x4e52cfc80679f402d10f7766fa3f85351a7c2530,0x4e52cfc80679f402d10f7766fa3f85351a7c2530,0x9c32185b81766a051e08de671207b34466dd1021,0x075b1bb99792c9e1041ba13afef80c91a1e70fb3,,,0x9c32185b81766a051e08de671207b34466dd1021,0xeb4c2781e4eba804ce9a9803c67d0893436bb27d,0x2260fac5e5542a773aa44fbcfedf7c193bc2c599,0xfe18be6b3bd88a2d2a7f928d00292e7a9963cfc6,0x517616c02c4286daa20e5841cad084039f2062fc -Factory V1 Meta,AETHV1,AETHV1,0x97aeb34ac6561146dd9ce191efd5634f6465def4,yes,curvefi,AETHV1,10,4000000,4000000,0x97aeb34ac6561146dd9ce191efd5634f6465def4,0x97aeb34ac6561146dd9ce191efd5634f6465def4,0x3a3a65aab0dd2a17e3f1947ba16138cd37d08c04,0x6c3f90f043a72fa612cbac8115ee7e52bde6e490,,,0x3a3a65aab0dd2a17e3f1947ba16138cd37d08c04,0x6b175474e89094c44da98b954eedeac495271d0f,0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48,0xdac17f958d2ee523a2206206994597c13d831ec7, -Factory V1 Plain,3EURpool,3EURpool,0xb9446c4ef5ebe66268da6700d26f96273de3d571,yes,curvefi,3eurpool,200,4000000,4000000,0xb9446c4ef5ebe66268da6700d26f96273de3d571,0xb9446c4ef5ebe66268da6700d26f96273de3d571,0x1a7e4e63778b4f12a199c062f3efdd288afcbce8,0xc581b735a1688071a1746c968e0798d642ede491,0xdb25f211ab05b1c97d595516f45794528a807ad8,0x0000000000000000000000000000000000000000,,,,,0x1e212e054d74ed136256fc5a5dddb4867c6e003f -Factory V1 Meta,DYDX-3CRV,3DYDX,0xe667c793513ecbd74fb53bb4b91fdae02bfc092d,yes,curvefi,3DYDX,100,4000000,4000000,0xe667c793513ecbd74fb53bb4b91fdae02bfc092d,0xe667c793513ecbd74fb53bb4b91fdae02bfc092d,0x92d6c1e31e14520e676a687f0a93788b716beff5,0x6c3f90f043a72fa612cbac8115ee7e52bde6e490,,,0x92d6c1e31e14520e676a687f0a93788b716beff5,0x6b175474e89094c44da98b954eedeac495271d0f,0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48,0xdac17f958d2ee523a2206206994597c13d831ec7, -Factory V1 Plain,cvxCRV,2CRV,0x6c7fc04fee277eabdd387c5b498a8d0f4cb9c6a6,yes,curvefi,2CRV,10,15000000,15000000,0x6c7fc04fee277eabdd387c5b498a8d0f4cb9c6a6,0x6c7fc04fee277eabdd387c5b498a8d0f4cb9c6a6,0xd533a949740bb3306d119cc777fa900ba034cd52,0x62b9c7356a2dc64a1969e19c23e4f579f9810aa7,0x0000000000000000000000000000000000000000,0x0000000000000000000000000000000000000000,,,,, -Factory V1 Meta,17PctCryptoDiversifiedDollar,17PctCypt,0xe76ebd4f9fa58e5269d3cd032b055b443239e664,yes,curvefi,17PctCypt,10,4000000,4000000,0xe76ebd4f9fa58e5269d3cd032b055b443239e664,0xe76ebd4f9fa58e5269d3cd032b055b443239e664,0xc4ad29ba4b3c580e6d59105fff484999997675ff,0x6c3f90f043a72fa612cbac8115ee7e52bde6e490,,,0xc4ad29ba4b3c580e6d59105fff484999997675ff,0x6b175474e89094c44da98b954eedeac495271d0f,0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48,0xdac17f958d2ee523a2206206994597c13d831ec7, -Factory V1 Meta,17PctCryptoDiversifiedDollar,17PctCypt,0x66b2e9b25f8aba6b4a10350c785d63bade5a11e9,yes,curvefi,17PctCypt,10,4000000,4000000,0x66b2e9b25f8aba6b4a10350c785d63bade5a11e9,0x66b2e9b25f8aba6b4a10350c785d63bade5a11e9,0xc4ad29ba4b3c580e6d59105fff484999997675ff,0x6c3f90f043a72fa612cbac8115ee7e52bde6e490,,,0xc4ad29ba4b3c580e6d59105fff484999997675ff,0x6b175474e89094c44da98b954eedeac495271d0f,0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48,0xdac17f958d2ee523a2206206994597c13d831ec7, diff --git a/seeds/dex/trades/_schema.yml b/seeds/dex/trades/_schema.yml deleted file mode 100644 index 5542398b7a4..00000000000 --- a/seeds/dex/trades/_schema.yml +++ /dev/null @@ -1,12 +0,0 @@ -version: 2 - -seeds: - - name: dex_trades_seed - config: - column_types: - tx_hash: varbinary - token_bought_address: varbinary - token_sold_address: varbinary - token_bought_amount: double - token_sold_amount: double - block_date: timestamp diff --git a/seeds/dex/trades/dex_trades_seed.csv b/seeds/dex/trades/dex_trades_seed.csv deleted file mode 100644 index 1ad1878fbb3..00000000000 --- a/seeds/dex/trades/dex_trades_seed.csv +++ /dev/null @@ -1,541 +0,0 @@ -blockchain,project,version,block_date,tx_hash,evt_index,token_bought_address,token_bought_amount,token_sold_address,token_sold_amount -avalanche_c,pharaoh,1,2023-12-27,0xba5d58703f53313a5d46bc2f14043735580123c66817558adfee943fe5fb5e49,19,0x9702230A8Ea53601f5cD2dc00fDBc13d4dF4A8c7,50008753,0xB97EF9Ef8734C71904D8002F8b6Bc66Dd9c48a6E,50000000 -ethereum,kyberswap,elastic_2,2023-01-09,0xa6d744fdbe93ed48ad6d8d3d3b86715e7a5bab9d95a970b56f9a40cbde38fc5a,413,0x7f39c581f595b53c5cb19bd0b3f8da6c935e2ca0,10.3359399189,0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48,18256.893542 -ethereum,maverick,1,2023-03-10,0x0da5b35106718de658279fc109cc593cf5d81de829e77a6cea01566f3bf7def6,130,0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48,15035.242634,0x5f98805a4e8be255a32880fdec7f6728c6568ba0,14628.522982718923 -ethereum,uniswap,1,2022-08-10,0xc5d051f200779582390fe36838263f346e3f9c13731f6d186f12bd72e1223501,164,0x6b175474e89094c44da98b954eedeac495271d0f,114.525972456783,0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2,0.062801179402571 -ethereum,uniswap,1,2022-08-10,0x6a6aaf4e55c3f7a070b1b2bb955c8a072bd7f3a00db898bb6ad9c35ff1d0bd36,58,0x23b608675a2b2fb1890d3abbd85c5775c51691d5,0.00485937701376674,0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2,0.0941477783366224 -ethereum,uniswap,1,2022-08-10,0x73e6503108c7774fad6f297303553153bb074d7a8abea64e67c23025dbd9cdd1,259,0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48,1604.708387,0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2,0.9605157 -ethereum,uniswap,1,2022-08-10,0x085c1de4ae885aced9e145292fe1e7619ad707df91db2a47046e6394f0a2ab14,39,0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2,1.45503069565416,0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48,2500 -ethereum,uniswap,1,2022-08-09,0xcb3958bb94b8d1d8ba8960e4c76e90f4f60446311f9ad595f7768077084f41b3,126,0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2,0.205795017804108,0x9f8f72aa9304c8b593d555f12ef6589cc3a579a2,0.325960741989667 -ethereum,uniswap,1,2022-08-10,0x0995c3e2ae836c9d1c2648c9bbbdc06710294c933faed35a7cf5fe84295324c6,274,0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2,0.00130012577707246,0x3d1ba9be9f66b8ee101911bc36d3fb562eac2244,3418.726 -ethereum,uniswap,2,2022-08-14,0x906bf116aa38282ea12a0a55fccdd9684d4904c0ddb5bff8c1a6e4e1bf791eb2,17,0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48,300.357175,0x6b175474e89094c44da98b954eedeac495271d0f,301.348892417344 -ethereum,uniswap,2,2022-08-14,0x644857941ede03358cbb28793d925e374184d07faa62cba22b1ca974035c06ee,161,0x6b175474e89094c44da98b954eedeac495271d0f,149.606421160013,0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48,150 -ethereum,uniswap,2,2022-08-14,0x51b191c8c620b1dc5867f1c0e1c3b2c4acb20009a7e29a8540c0ed94f678c350,194,0x1f9840a85d5af5bf1d1762f925bdaddc4201f984,1980.88020260497,0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2,9.13345856353334 -ethereum,uniswap,2,2022-08-14,0x77bdb8bff66248595b99851084a3a921db653ba2fb2a775ac7f0614cf4bddab5,23,0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2,3.13666561702156,0x1f9840a85d5af5bf1d1762f925bdaddc4201f984,683.8 -ethereum,uniswap,2,2022-08-14,0xb00a6f017198bbbcc4d2d390326cec87301e08880e1e1e0d6877b28b906a61d5,33,0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2,7.9695767307707,0x6b175474e89094c44da98b954eedeac495271d0f,15531.4453730142 -ethereum,uniswap,3,2022-09-28,0x021a4ea590baee1e6bec5ecdb3b03cb67a4efaac67ac764f97ac3b152fe1ad10,8,0xae78736cd615f374d3085123a210448e74fc6393,0.490796462724159,0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2,0.510288592522475 -ethereum,uniswap,3,2022-09-28,0x566b4dd208a3af70b3b80e9352e35f263db73ec29ed6e6385f719773b98d19ce,239,0x3845badade8e6dff049820680d1f14bd3903a5d0,15.6789364011265,0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2,0.01 -ethereum,uniswap,3,2022-09-28,0xdcaf9394fddb84afbf971045661d7e96ed2d01a743ea913abceb20cf4c13452e,2,0xdac17f958d2ee523a2206206994597c13d831ec7,18410.19214,0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2,13.7977443609023 -ethereum,uniswap,3,2022-09-28,0x4bda429e77bdd899139e00628c8fee2e119db6098745cba00e11efeeb1a99bd2,84,0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48,10747.932591,0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2,8.06043203550863 -ethereum,uniswap,3,2022-09-28,0x7a98cdef70a5518538457c807d90e69340d709d2a2a87699a869db8be7a66d8f,112,0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48,46942.648238,0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2,35.2 -optimism,uniswap,3,2022-09-30,0xf55b5c5ec3bf016046a173f484fe972e32fdcba467d7f9e736aa24c72ba77f77,7,0xda10009cbd5d07dd0cecc66161fc93d7c9000da1,100.981029315346,0x7f5c764cbc14f9669b88837ca1490cca17c31607,101 -optimism,uniswap,3,2022-09-30,0x1eb5e4679743665b626af08e0e1cb571982d851e4d9a26ca84763ab4e97b2413,10,0xda10009cbd5d07dd0cecc66161fc93d7c9000da1,5.38359932389085,0x7f5c764cbc14f9669b88837ca1490cca17c31607,5.384615 -optimism,uniswap,3,2022-09-30,0x14d51305de3c0224f1474e895d8a75c3f6f31c050a8384fb56352b9ce23dfde5,2,0x7f5c764cbc14f9669b88837ca1490cca17c31607,60.46196,0x94b008aa00579c1307b0ef2c499ad98a8ce58e58,60.456251 -ethereum,airswap,swap_erc20_v4,2023-05-23,0xd36c783cd53d3bf612ec74f6f41c1044ca99f45dd16673e9152093df6089e2b5,293,0x6b175474e89094c44da98b954eedeac495271d0f,9.18792133,0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2,0.005 -ethereum,airswap,swap_erc20_v4,2023-05-23,0xcdb69602e9ecf42a2e0375eeaef525f825c06d4d83943f69dfb2aca882c54308,272,0xd533a949740bb3306d119cc777fa900ba034cd52,3381.61805,0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48,2977.71 -ethereum,airswap,swap_v3,2022-08-19,0x00399b5f2fc5535efd528b03f76a871766e5f2d2869799281b3064cd02de14fe,308,0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48,825.220907,0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2,0.4863593 -ethereum,airswap,swap_v3,2022-08-25,0x0000e369cb6a2d5908c26d736d0012a3136603f2020acfe8bfd86af4790c8590,213,0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2,0.357272738807249,0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48,600 -ethereum,airswap,swap,2022-09-29,0x30219b51b252348303f297778374024b4afcd6023d522b4442d2304b8f0c154d,3,0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48,102122.5869,0xe34c023c0ea9899a8f8e9381437a604908e8b719,103441.57 -ethereum,airswap,swap,2022-09-27,0x1daef042310db224f72cb4c922e1a4ccfa2cbbba8f2757dec38651e95933c6f7,32,0x72b886d09c117654ab7da13a14d603001de0b777,253905.87392903,0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48,30500 -ethereum,airswap,light,2022-05-25,0x02881571864ff927f2c1e3a65e88ac2cdb63bcc8b075b3b5cac1fabdbff8719a,287,0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48,3901.628058,0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2,1.98514 -ethereum,airswap,light,2022-05-31,0x041c1b58767f3428419d4c3e767e4dda0490d5aa2459902955f9bca530739bc8,175,0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2,1.02477942922041,0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48,2000 -ethereum,airswap,light_v0,2021-03-19,0xc418c91e3ac55dd29d4471f12fd5d425df952d2bbe70d5f7157f6a15c49b4c6f,272,0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2,2.11323417,0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48,3816.26867 -ethereum,airswap,light_v0,2021-03-19,0xc204cbd09767db2c912a7185dcda818b267bc6119a6ba7fc9a16d5ebca654068,109,0xdac17f958d2ee523a2206206994597c13d831ec7,909.704519,0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2,0.4985 -ethereum,curve,Regular,2022-09-03,0x0fc5910c411bdbbf1827fa278c22b3351892e8931e7c3db02e817bc052a489fc,11,0xdac17f958d2ee523a2206206994597c13d831ec7,45324225240,0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2,2.929896609E+019 -ethereum,curve,Regular,2022-09-04,0x4ca41e0f0700f357111aaae66a85b0def53b00a6ca02145e6e6ec00775621df5,537,0x6c3f90f043a72fa612cbac8115ee7e52bde6e490,7.93070096583753E+022,0x5f98805a4e8be255a32880fdec7f6728c6568ba0,7.78328E+022 -ethereum,curve,Factory V1 Meta,2022-09-23,0x182e11e393388ea9365b1e566bfc66754bbdfb7f83344f6e1e4f05cde97ea66b,11,0x6c3f90f043a72fa612cbac8115ee7e52bde6e490,4.29398385988372E+020,0xa693b19d2931d498c5b318df961919bb4aee87a5,10259457322 -ethereum,curve,Factory V1 Plain,2022-09-19,0xe31b85292938984c61b4a9d8d2eb781f20bfa22c068a380a67fce94ef8ec450c,60,0xd533a949740bb3306d119cc777fa900ba034cd52,7.42474512665705E+020,0x62b9c7356a2dc64a1969e19c23e4f579f9810aa7,7.74567425737246E+020 -ethereum,curve,Factory V2,2022-09-03,0x02fe546401dd52e07528532ed1ac4ed1d4f525118836f71a4014282fb6a06839,4,0xaf5191b0de278c7286d6c7cc6ab6bb8a73ba2cd6,5.13561732187354E+022,0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48,33333000000 -ethereum,clipper,1,2021-07-14,0x8d246ba8ec0775e6b7cff03010b858e22a9295d24b7fd08a8f705bbd3d333dab,301,0xdac17f958d2ee523a2206206994597c13d831ec7,165.266255,0x0000000000000000000000000000000000000000,0.082849 -ethereum,clipper,2,2022-08-05,0xdae0599fd4db92ae4ba8c69bb8f0955c8d6e33bef1b5dd91f7b42aff95d1bffb,90,0xdac17f958d2ee523a2206206994597c13d831ec7,15,0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2,0.00905195942930063 -ethereum,clipper,3,2022-10-05,0x2a85b64c9b39ad26cd62b72c984fb31c6c53e2eab317d79a34787a10d9883942,222,0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48,150,0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2,0.110806219109147 -ethereum,sushiswap,1,2021-09-15,0x7074892627f2bccfbf394ec8760cade1d3d672289b46fbc7c5e590db31c16c95,3,0x6b3595068778dd592e39a122f4f5a5cf09c90fe2,3017.55093634511,0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2,11.7781782389008 -ethereum,sushiswap,1,2021-11-22,0x3d68c5df7a7a82ad679592d00eced1461447b487d1c54d89f0fa46ddc21bac84,7,0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2,9.46565784374643,0xd291e7a03283640fdc51b121ac401383a46cc623,1121.3436686981 -ethereum,sushiswap,1,2021-11-27,0x0de46956f3fbdf6c9613f087f063daf62b7be67aeb8f092704d98feb1d2a0911,8,0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2,0.309451321421892,0xf422b6f41a14fb74b21cb95a8d82971a3b527117,16109.3510951687 -ethereum,sushiswap,1,2021-08-01,0x901305aef9025df025b948065b89dd2f6350c09d9cd4eb957b3b69d4a487b1eb,8,0x25f8087ead173b73d6e8b84329989a8eea16cf73,3588.33361827192,0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2,3.18922607574853 -ethereum,swapr,1,2022-09-03,0xc58ae666672615f121747458b336004b5bac48823a6135163d3b23afeab4d632,333,0x6b175474e89094c44da98b954eedeac495271d0f,68.407407578415861544,0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2,0.0441670997926941 -ethereum,swapr,1,2022-05-04,0x53f3c3e596923e6c74988dffb69b52fe90d5bc191237dd87bd926de934b2f310,181,0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2,0.278764086245774,0x6b175474e89094c44da98b954eedeac495271d0f,781.537753648362 -ethereum,defiswap,1,2020-09-10,0xe1fa03eaadc2050042d0a70799776d4788a22732ba4914c80644629cd6312e65,196,0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48,0.03502,0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2,0.0001 -ethereum,defiswap,1,2022-02-03,0x6f280443c97a4f5f75d041ae8c378af7bd88aeb9df893019aac2e8f13f7c04ed,48,0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2,852.379306321183,0xc00e94cb662c3520282e6f5717214004a7f26888,3674.21052715029 -ethereum,dfx,0.5,2022-10-14,0x8e51157eb06f0dcd4a546db83a8c4419ea6438e8d5f049c9a7ac71c6a03ca179,604,0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48,101.003244,0x2c537e5624e4af88a7ae4060c022609376c8d0eb,1891.282964 -ethereum,dfx,0.5,2022-10-13,0xa655e13b90fdfb4e590422308ebd51c45e4c213c466c2c765e307207936b6375,19,0x1abaea1f7c830bd89acc67ec4af516284b1bc33c,39601.170618,0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48,38720 -arbitrum,zigzag,1,2022-10-16,0x65149408bc88fdf9b690269f7e57dcaf8d5577af412ccd3b6d8cb13a9e5c11f8,1,0xff970a61a04b1ca14834a43f5de4533ebddb5cc8,266374900,0xfd086bc7cd5c481dcc9c85ebe478a1c0b69fcbb9,266363162 -arbitrum,zigzag,1,2022-10-26,0xc36027e8ccac981439cae6471824c08fad2831a94d18245052f60ec68e95fd1e,1,0xff970a61a04b1ca14834a43f5de4533ebddb5cc8,214452952992,0x2f2a2543b76a4166549f7aab2e75bef0aefc5b0f,1060036291 -arbitrum,zigzag,1,2022-10-01,0x0a18966c178428cdedcec56823ceea18cd25b30f3da0051185af6633ace725b7,1,0xff970a61a04b1ca14834a43f5de4533ebddb5cc8,114719722544,0x82af49447d8a07e3bd95bd0d56f35241523fbab1,86485492800931211274 -bnb,pancake,2,2022-10-02,0x621c3436f07ab0c7228b50618195a1d9c19c62268d51f556fe3e9595c21cb2c6,140,0x8ac76a51cc950d9822d68b83fe1ad97b32cd580d,4.128690371495819498,0x0e09fabb73bd3ade0a17ecc321fd13a19e81ce82,0.9182291278576036 -bnb,pancake,2,2022-10-06,0x60655c0da9953df69117f9b0d3ff1872a50c97657ace896b365b5781f96d97cf,46,0x60655c0da9953df69117f9b0d3ff1872a50c97657ace896b365b5781f96d97cf,29.176228605313702756,0xaef0d72a118ce24fee3cd1d43d383897d05b4e99,266659.423741634885391646 -ethereum,dodo,1,2020-09-01,0x784afe0cd29926a86e15390c6d894eccfd3fcfd3d170cbb69a1a9aeb9f98e5af,72,0xc00e94cb662c3520282e6f5717214004a7f26888,24.88,0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48,6557.285496 -ethereum,dodo,1,2021-01-30,0x616b4f09c34a3e598b00373a961e1daa4c2decc7a5315192f2927a68e767a4d6,100,0xc00e94cb662c3520282e6f5717214004a7f26888,22.84,0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48,7017.918 -ethereum,dodo,2_dvm,2022-11-01,0xd22f88ac18cec7940d5d238140e8cd70e1fb77f01524e92cdba9002831405e53,48,0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48,823.892847,0x4bdcb66b968060d9390c1d12bd29734496205581,15050.127244362413 -ethereum,dodo,2_dsp,2022-11-01,0x217a50ce8c056b6f240ca0fee82a7aea76fde5845238717d4d2fe36a1d885fe3,18,0x6b175474e89094c44da98b954eedeac495271d0f,16786.79842759679,0xdac17f958d2ee523a2206206994597c13d831ec7,16789.191028 -bnb,dodo,1,2022-01-02,0x520b133f33a11da463ef652c2204e89056384f3755aa17ed3bd8692a708e2daf,9,0x8ac76a51cc950d9822d68b83fe1ad97b32cd580d,15000,0xe9e7cea3dedca5984780bafc599bd69add087d56,14999.373075377125 -bnb,dodo,1,2021-12-08,0x5a3656a980ff18ea51639ec55b909e06c05447296ad41234cce2a6504e7e3cd1,555,0xe9e7cea3dedca5984780bafc599bd69add087d56,6499.127981081047,0x55d398326f99059ff775485246999027b3197955,6493.88249982855 -bnb,dodo,2_dvm,2022-10-27,0x1b313c2256a8fe451949711d34dfadf49b33e6e49fa95564394c764f1fa10a96,138,0x4a9a2b2b04549c3927dd2c9668a5ef3fca473623,16153.846153846154,0xb5102cee1528ce2c760893034a4603663495fd72,804.7505008944851 -bnb,dodo,2_dsp,2022-01-28,0x0adbde9ea212758528e872e94cd4056e77aae00d64a270df9cd10adef1a43883,185,0x2c30b4cb4b3001afa5b8c43c5a7ca548067562a0,282.61385074773614,0x8ac76a51cc950d9822d68b83fe1ad97b32cd580d,282.357407285385 -bnb,dodo,2_dpp,2022-12-18,0x5425c84608187bfd827a076b30760402987276fdcc5168b4b9cce30ac531752b,15,0xbb4cdb9cbd36b01bd1cbaebf2de08d9173bc095c,1.4460644851563125,0xe9e7cea3dedca5984780bafc599bd69add087d56,350.17016117475544 -bnb,dodo,2_dpp,2022-12-18,0x8a13bf64a7c9b5db044f3771b6a654e822c37434f55d1e41d8b5a7808221835b,40,0xbb4cdb9cbd36b01bd1cbaebf2de08d9173bc095c,1.8608918052876906,0x55d398326f99059ff775485246999027b3197955,451.18801668480404 -arbitrum,dodo,1,2023-01-07,0x9ed6106825fc5d53665ee6376f3501b4b54a554c19290afc4d51e06ff8bbb6ce,16,0xfd086bc7cd5c481dcc9c85ebe478a1c0b69fcbb9,50.014816,0xff970a61a04b1ca14834a43f5de4533ebddb5cc8,50 -arbitrum,dodo,1,2023-01-07,0xd6415725b7c78e43935708dad578870363486a806d38ef8a0e9a8f6ab4cfe475,14,0xfd086bc7cd5c481dcc9c85ebe478a1c0b69fcbb9,101.859893,0xff970a61a04b1ca14834a43f5de4533ebddb5cc8,101.809143 -arbitrum,dodo,2_dvm,2023-10-09,0x8c4a3f95cd30e91aca5ec95cab93543af728256c299110b14a29438e79f62e72,15,0xff970a61a04b1ca14834a43f5de4533ebddb5cc8,4.108417,0x82af49447d8a07e3bd95bd0d56f35241523fbab1,0.002622797526025669 -arbitrum,dodo,2_dsp,2023-01-07,0x75bf7f2fbb62b1d543e1e8b3e3641f85fffcdedeb4e3eeaedd0fc9461563be79,12,0x641441c631e2f909700d2f41fd87f0aa6a6b4edb,1211.1861381535175,0xff970a61a04b1ca14834a43f5de4533ebddb5cc8,1211.102662 -arbitrum,dodo,2_dpp,2023-02-23,0x55c6277132f498dbaf7ad4df56380f0838f14121491b4b2954d7af42f3024cc0,23,0x82af49447d8a07e3bd95bd0d56f35241523fbab1,0.2164701922659768,0xff970a61a04b1ca14834a43f5de4533ebddb5cc8,360.422629 -optimism,dodo,2_dvm,2022-08-18,0x64557e632ccb92997101e6fe03d93b926f54488d82fa3c1a1ff28f32e2ccdef6,4,0x7f5c764cbc14f9669b88837ca1490cca17c31607,0.491844,0x4200000000000000000000000000000000000006,0.000338547426391858 -ethereum,bancor,1,2021-07-19,0x00c78e18b2ff2f7da30364f421d7b32e026523d64d37617a8c5acfa94f8850a1,235,0x1f573d6fb3f13d689ff844b4ce37794d79a7ff1c,306.394926082191,0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2,0.45 -ethereum,bancor,1,2022-01-01,0xe3a7a76069d1109e9d4d13236ee746ce1cf5dbf9dcf430fde8b257f19a98162e,196,0x1f573d6fb3f13d689ff844b4ce37794d79a7ff1c,1991.31923775975,0xb056c38f6b7dc4064367403e26424cd2c60655e1,10000 -ethereum,bancor,1,2022-08-10,0xc470cc109b2fd341d5e155ef0a5b270d31e46320fec423616bfbf8e08bde1d89,87,0x4a220e6096b25eadb88358cb44068a3248254675,4.21008338989588,0x1f573d6fb3f13d689ff844b4ce37794d79a7ff1c,879.148341427923 -ethereum,carbon_defi,1,2023-04-24,0xd4d6be5f2e8475ff67c7f718edfdb8b1de9bef225e7f82f8b3867f07da3d6032,396,0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48,60.764468,0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2,0.032 -ethereum,carbon_defi,1,2023-06-10,0x11646f9854a79d49fc4f8005fb542b6afd6ac2ae3b444a89ca3a57b6e325f8a1,214,0x6b175474e89094c44da98b954eedeac495271d0f,18803.048784261206,0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2,10.553764 -ethereum,carbon_defi,1,2023-07-04,0x28b9ffba580de047e5b3025e28b6dc6e9b4a0091dc7e90e87a3b9df1a72e1fee,424,0x1f573d6fb3f13d689ff844b4ce37794d79a7ff1c,731.6246907423406,0x48fb253446873234f2febbf9bdeaa72d9d387f94,1402.8429106481624 -ethereum,hashflow,1,2022-10-11,0x32cf4a6b5cc8f98c1e581c4c645c4e8a5509b524798789d9ba4d32e169c367f5,16,0xdac17f958d2ee523a2206206994597c13d831ec7,17911.421153,0x7d1afa7b718fb893db30a3abc0cfc608aacfebb0,22400 -ethereum,hashflow,1,2022-10-11,0xe4e4a36fba54da2aae2fd17bd783d448636f2a439f5ee8c65a6bd6b1a0015812,60,0x0000000000000000000000000000000000000000,1.3681194955173488,0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48,1744.214319 -ethereum,mstable,feederpool,2021-05-05,0x44d84fd2602b8cc6c8872f7c1ec1354b7265a8dde35c3099310298322f948ce8,393,0x4fabb145d64652a948d72533023f6e7a623c7c53,207366.593542953125079686,0x6b175474e89094c44da98b954eedeac495271d0f,207343.38432717659586164 -ethereum,mstable,feederpool,2021-07-12,0x40a185a0e023931c764c9e0c367494ec0491ac1c83c104e52c0f80ec5eecf227,39,0x6b175474e89094c44da98b954eedeac495271d0f,14152.444151925737407389,0x4fabb145d64652a948d72533023f6e7a623c7c53,14170.8094 -ethereum,mstable,masset,2022-08-11,0x251247062570a31c65605c5c022d0b6375c0e0a7f78ff846ed0194e6eb89d75f,48,0xeb4c2781e4eba804ce9a9803c67d0893436bb27d,1.48620013,0x2260fac5e5542a773aa44fbcfedf7c193bc2c599,1.49136326 -ethereum,mstable,masset,2022-11-10,0x2a25f982c167701bb14fedab38e36db11b80e0df84415224a9b9358810abe5e9,20,0x57ab1ec28d129707052df4df418d58a2d46d5f51,97891.598255842626470327,0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48,98029.682483 -avalanche_c,sushiswap,1,2022-02-25,0x82fd5a6540dce85d1e21f32f1c3caed449899345ef111576a17c2954fe0effc6,33,0xa7d7079b0fead91f3e65f86e8915cb59c1a4c664,1379.137017,0xd586e7f844cea2f87f50152665bcbc2c279d8d70,1373.864622043913288097 -avalanche_c,sushiswap,1,2022-05-12,0x73e34eb697701cff1cd6f045855584d6cc7a8e7923d8e2f494a0ffba034500c8,116,0xb31f66aa3c1e785363f0875a1b74e27b85fd66c7,0.210377021755772039,0x50b7545627a5162f82a992c33b87adc75187b218,0.0002241 -gnosis,sushiswap,1,2021-11-08,0x5071403049381a8e0a9b1859d933a4367ac95db0549597d615f11d8d6989766b,103,0xddafbb505ad214d7b80b1f830fccc89b60fb7a83,138.845996,0xe91d153e0b41518a2ce8dd3d7944fa863463a97d,138.937452952743346786 -gnosis,sushiswap,1,2022-06-28,0x73b7fc9d26042dc2552a014c6a8e138dedaabb3150721f538404a109f5efd031,9,0xe91d153e0b41518a2ce8dd3d7944fa863463a97d,4.529829473199357637,0xe2e73a1c69ecf83f464efce6a5be353a37ca09b2,0.650820213174998578 -arbitrum,sushiswap,1,2023-01-10,0xafa7fc216c42ebc38df30ee06c935d34454603b51c8f30110b09ba0c96a5cf2b,7,0xff970a61a04b1ca14834a43f5de4533ebddb5cc8,1.988441,0xfd086bc7cd5c481dcc9c85ebe478a1c0b69fcbb9,2 -arbitrum,sushiswap,1,2023-01-10,0x6ae9f8365f8e9ce4b6fa5e957558f798eb79552370533b525d2cfcc49ac895d6,7,0xff970a61a04b1ca14834a43f5de4533ebddb5cc8,0.003433,0x82af49447d8a07e3bd95bd0d56f35241523fbab1,0.0000026 -arbitrum,sushiswap,1,2023-01-09,0x98032f79d4f04087984d9a29bf0cda82b2ab80afaf7c53172a9886d5cad4a66e,12,0xfd086bc7cd5c481dcc9c85ebe478a1c0b69fcbb9,0.892222,0x82af49447d8a07e3bd95bd0d56f35241523fbab1,0.0006764 -avalanche_c,fraxswap,1,2022-07-16,0xa3b0a0511b2454fc1120234bee1c8d55b389fd18aeef5c7facf901ebbeb22347,11,0x214db107654ff987ad859f34125307783fc8e387,200.0,0xd24c2ad096400b6fbcd2ad8b24e7acbc21a1da64,1094.4001103042203 -avalanche_c,fraxswap,1,2022-08-19,0x92ffa2b7400b5ce9f50561358c9704a93b4c60133a2cd12b22393cdcf0cf4d5f,4,0xd24c2ad096400b6fbcd2ad8b24e7acbc21a1da64,1026.1252914116867,0x214db107654ff987ad859f34125307783fc8e387,167.62804286355896 -avalanche_c,fraxswap,1,2022-07-13,0xf57b7cfe775b4f21f74ed2c08d56eaceb84a1e9191f3c7d5097128b08ab7444b,9,0xd24c2ad096400b6fbcd2ad8b24e7acbc21a1da64,500.0,0x214db107654ff987ad859f34125307783fc8e387,103.83628889808516 -avalanche_c,fraxswap,1,2022-10-15,0xe29a3bc86f7903618c9716037437256d8cb3bd37368f356e19c825d505b21616,4,0x214db107654ff987ad859f34125307783fc8e387,167.2033272898448,0xd24c2ad096400b6fbcd2ad8b24e7acbc21a1da64,1000.0 -avalanche_c,fraxswap,1,2022-09-05,0xc0d3943d0fb158b7fa111a20ae64e81044161e6a1cabf819f64252980f81af3f,4,0xd24c2ad096400b6fbcd2ad8b24e7acbc21a1da64,1330.6397885530023,0x214db107654ff987ad859f34125307783fc8e387,215.93386151058667 -avalanche_c,fraxswap,1,2022-06-16,0x17cc2def9d5869f604789dc0593af77b68fc6b51dd98e0dacf9f50d744d5d534,86,0xd24c2ad096400b6fbcd2ad8b24e7acbc21a1da64,1000.0,0x214db107654ff987ad859f34125307783fc8e387,228.50208340351497 -avalanche_c,fraxswap,1,2022-06-16,0xc7973b9adc9c15c4b536ac3682344420b8e8e541e801e0f451a52f685a10d002,65,0xd24c2ad096400b6fbcd2ad8b24e7acbc21a1da64,1000.0,0x214db107654ff987ad859f34125307783fc8e387,229.28068237184743 -avalanche_c,fraxswap,1,2022-09-05,0x608542c07700429cf096204f91a193341e40ae4059b7940d7eb5ad9f051836b8,4,0xd24c2ad096400b6fbcd2ad8b24e7acbc21a1da64,1052.0376768716717,0x214db107654ff987ad859f34125307783fc8e387,169.6623770097244 -avalanche_c,hashflow,1,2022-09-23,0xb64cabc1fc83f1922a9bf1c315a6bf7e81530dc33b68be78871e61329884078a,25,0xb97ef9ef8734c71904d8002f8b6bc66dd9c48a6e,1003.182468,0xb31f66aa3c1e785363f0875a1b74e27b85fd66c7,57.71187672458048 -avalanche_c,hashflow,1,2022-08-29,0x3b837a7861992717ee9843e7b46bf414255eb77583f4eb5409d2945ee0295597,38,0xb31f66aa3c1e785363f0875a1b74e27b85fd66c7,11.276858734485854208,0xa7d7079b0fead91f3e65f86e8915cb59c1a4c664,200 -avalanche_c,hashflow,1,2023-01-12,0xab0c51f0fc13c3bd30194e0fabf1827fd9ae164ffc2ca8aab83c0443a2e63abd,3,0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48,431.856634,0xb97ef9ef8734c71904d8002f8b6bc66dd9c48a6e,432.07267 -avalanche_c,curve,2,2022-11-03,0x5fac517fbfdd744ff858c15babc0998cbc7c2d0c4aa064f60bd17b2a3a53d670,17,0xa7d7079b0fead91f3e65f86e8915cb59c1a4c664,24396.061353,0xd586e7f844cea2f87f50152665bcbc2c279d8d70,24408.524998416038829515 -avalanche_c,curve,2,2022-06-04,0x36158219ea84887d26aa64deb11ca2ccc3e1576e5464b044edbd446aa277beda,20,0xc7198437980c041c805a1edcba50c1ce5db95118,149.228657,0xa7d7079b0fead91f3e65f86e8915cb59c1a4c664,149.167743 -avalanche_c,curve,2,2022-11-02,0xcd7a6bd17655e6d54bc4a21927082f27b1f499c9b791bad783084c19b95ce4e1,168,0xb97ef9ef8734c71904d8002f8b6bc66dd9c48a6e,647.498626,0xa7d7079b0fead91f3e65f86e8915cb59c1a4c664,647.585569 -avalanche_c,platypus_finance,1,2022-05-01,0xc9cf002b6422ef0a617284537683372c66b92e84e0b28fde8a0cc04a4eef519e,23,0xb97ef9ef8734c71904d8002f8b6bc66dd9c48a6e,4994.308573,0x9702230a8ea53601f5cd2dc00fdbc13d4df4a8c7,4994.787342 -avalanche_c,platypus_finance,1,2022-05-03,0x75dc4b71defb76d9888aabbd8771e8b38ee48fb41d43cc3ecae6fb73b3911c84,20,0xb97ef9ef8734c71904d8002f8b6bc66dd9c48a6e,21009.805223,0x9702230a8ea53601f5cd2dc00fdbc13d4df4a8c7,21012.319756 -avalanche_c,platypus_finance,1,2022-05-03,0x93bd89cf8a4d602d5cbc32446e5fb4bf9ed170f5ac72c2dc23294c8f5e1a8a05,26,0xb97ef9ef8734c71904d8002f8b6bc66dd9c48a6e,1199719.208427,0xd586e7f844cea2f87f50152665bcbc2c279d8d70,1200000.0 -avalanche_c,platypus_finance,1,2022-05-04,0x306818d93ecd131c5e5e40a2293150db9484555d539a45e0512cc28a7041ebfb,45,0xd586e7f844cea2f87f50152665bcbc2c279d8d70,220.0206736954061,0xb97ef9ef8734c71904d8002f8b6bc66dd9c48a6e,220.0 -avalanche_c,platypus_finance,1,2022-05-04,0x9e982c5f221d878d5c30291f3b1af3bb4896a0d15ecc305ff4d4e63936ed191e,64,0xd586e7f844cea2f87f50152665bcbc2c279d8d70,728.2722352237333,0xb97ef9ef8734c71904d8002f8b6bc66dd9c48a6e,728.227031 -avalanche_c,platypus_finance,1,2022-05-05,0xd1d05ff16c664884875cf17ded334008fe1005b15103460c76a8979a791d3cc1,13,0xb97ef9ef8734c71904d8002f8b6bc66dd9c48a6e,148967.354389,0x9702230a8ea53601f5cd2dc00fdbc13d4df4a8c7,149000.0 -avalanche_c,platypus_finance,1,2022-05-05,0x138e58cdee3bd8ccb09bfaaffe340f84c29688d4a239dab4b94d12e49434d5a9,82,0x9702230a8ea53601f5cd2dc00fdbc13d4df4a8c7,783.164086,0xd586e7f844cea2f87f50152665bcbc2c279d8d70,783.2365264361647 -avalanche_c,platypus_finance,1,2022-05-06,0x48596630bee61338ac47f100539d58fd783215ceb624d888249818b9c7eade5f,59,0xb97ef9ef8734c71904d8002f8b6bc66dd9c48a6e,741.001182,0xd586e7f844cea2f87f50152665bcbc2c279d8d70,741.1522427698851 -avalanche_c,platypus_finance,1,2022-05-07,0x2954327b19870057c067530f4f951014163795afe991f5cd2657649ab8151a88,74,0xd586e7f844cea2f87f50152665bcbc2c279d8d70,1034.338934536323,0xb97ef9ef8734c71904d8002f8b6bc66dd9c48a6e,1034.310287 -avalanche_c,platypus_finance,1,2022-05-07,0x9ac609a5cf6084d4152e835fcf790f45dbdb363bda79afc62ac3dfc5235eea7d,17,0x9702230a8ea53601f5cd2dc00fdbc13d4df4a8c7,121.298967,0xb97ef9ef8734c71904d8002f8b6bc66dd9c48a6e,121.300365 -avalanche_c,platypus_finance,1,2022-05-07,0x2a3a710fa23fe85c0153a701167ac8265327e08c4e527e9de3d0727099934f48,8,0xb97ef9ef8734c71904d8002f8b6bc66dd9c48a6e,2069.426263,0x9702230a8ea53601f5cd2dc00fdbc13d4df4a8c7,2069.863443 -avalanche_c,platypus_finance,1,2022-05-09,0xa268e678b9167e2afbff624d6c473e1de4e69e00bbbf15cff30fec754965161e,80,0xb97ef9ef8734c71904d8002f8b6bc66dd9c48a6e,504890.913495,0xd586e7f844cea2f87f50152665bcbc2c279d8d70,505000.0 -avalanche_c,platypus_finance,1,2022-05-09,0x2747e96f2e6198cbaad9a34257faae3d1282401ec89c4d8e2b8980830417f7e4,26,0xb97ef9ef8734c71904d8002f8b6bc66dd9c48a6e,23608.565879,0xd586e7f844cea2f87f50152665bcbc2c279d8d70,23614.60193014132 -avalanche_c,platypus_finance,1,2022-05-09,0x4587aca823136fd6dbe9ecf9a992074062c49d13ee38fc65a7f547e5647c40d6,34,0x9702230a8ea53601f5cd2dc00fdbc13d4df4a8c7,340.040453,0xd586e7f844cea2f87f50152665bcbc2c279d8d70,340.06469425688414 -avalanche_c,platypus_finance,1,2022-05-09,0x916f2f560b3c13f31aa4139608b067e00ad042bd3bdb197a683e68d77c80aab0,12,0xb97ef9ef8734c71904d8002f8b6bc66dd9c48a6e,25017.262697,0x9702230a8ea53601f5cd2dc00fdbc13d4df4a8c7,25023.099847 -avalanche_c,platypus_finance,1,2022-05-09,0xd1e3319eb5ab9cae929d2a18e79facb10309f84a8e38073596df084745c2f2f1,113,0xb97ef9ef8734c71904d8002f8b6bc66dd9c48a6e,289498.193117,0xd586e7f844cea2f87f50152665bcbc2c279d8d70,289560.3059171445 -avalanche_c,platypus_finance,1,2022-05-09,0x7fa1daa95f0c034752cb3719b62e7ae3d372945db163bda78e26cdc3a18192c3,6,0x9702230a8ea53601f5cd2dc00fdbc13d4df4a8c7,7500.368177,0xb97ef9ef8734c71904d8002f8b6bc66dd9c48a6e,7500.0 -avalanche_c,platypus_finance,1,2022-05-09,0x363e3d084f738cb84cc809ca6ec9738bc23ceb606ca13148fe210b0bb098115b,22,0xb97ef9ef8734c71904d8002f8b6bc66dd9c48a6e,78918.176151,0x9702230a8ea53601f5cd2dc00fdbc13d4df4a8c7,78938.0 -avalanche_c,platypus_finance,1,2022-05-09,0x70aa1e9d8f0698b0b4b118b5296d67a3fb15f380a8ca105ba3c433655ae93aa6,28,0xb97ef9ef8734c71904d8002f8b6bc66dd9c48a6e,44548.677919,0x9702230a8ea53601f5cd2dc00fdbc13d4df4a8c7,44561.0 -avalanche_c,platypus_finance,1,2022-05-10,0x1bbe2f7773c059f500de2cd6acdee778d04b8c8185d4c69bb20db835feda9b76,24,0xb97ef9ef8734c71904d8002f8b6bc66dd9c48a6e,1505.784684,0xd586e7f844cea2f87f50152665bcbc2c279d8d70,1506.0280424835855 -arbitrum,gmx,1,2022-11-14,0x4c4f46a92fba43bfcb232568d7a31b4af63e91ab332b36549f2cc8929057bf11,10,0x82af49447d8a07e3bd95bd0d56f35241523fbab1,0.20892017,0xff970a61a04b1ca14834a43f5de4533ebddb5cc8,259 -arbitrum,gmx,1,2022-11-15,0xe8c98bea3bf37ebb632c2f59e8e8db88f06456c12a1a9b1f6217f896820928b8,10,0x82af49447d8a07e3bd95bd0d56f35241523fbab1,0.0023785668,0xfd086bc7cd5c481dcc9c85ebe478a1c0b69fcbb9,3 -avalanche_c,gmx,1,2022-11-14,0x4fee39a37c1adab2e185876f06395fe3a0ed53d2d2d10e82ef7b40dbdb70714e,16,0xb97ef9ef8734c71904d8002f8b6bc66dd9c48a6e,562.108981,0x49d5c2bdffac6ce2bfdb6640f4f80f226bc10bab,0.46443571715597298 -avalanche_c,gmx,1,2022-11-15,0x834202fb166e9cd8056bb1b7109c3a63e636244b5306080b3405d0321c0731c4,11,0xb97ef9ef8734c71904d8002f8b6bc66dd9c48a6e,260.988536,0xb31f66aa3c1e785363f0875a1b74e27b85fd66c7,20 -polygon,uniswap,3,2022-11-14,0x065d1410e74a0f973feb1b2b81030c4e48787fc9e540700d6018dfb5f96bfcf0,2,0x0d500b1d8e8ef31e21c99d1db9a6444d3adf1270,240.508119698835042944,0xc2132d05d31c914a87c6611c10748aeb04b58e8f,219.13821 -polygon,uniswap,3,2022-11-14,0x17e206610661e39deac15979717f6658035a531aa66c78ffcdc6e8d02a4dd4a9,60,0x2791bca1f2de4661ed88a30c99a7a9449aa84174,230.890774,0x1bfd67037b42cf73acf2047067bd4f2c47d9bfd6,0.0140068 -polygon,uniswap,3,2022-11-05,0x2f2f34207e9b8b521e87e40aaf452c0ddb57c580b5174a615cc286366efca79d,33,0x0d500b1d8e8ef31e21c99d1db9a6444d3adf1270,1005.454808280348265291,0xc2132d05d31c914a87c6611c10748aeb04b58e8f,1212.644735 -polygon,dodo,1,2023-01-07,0xa4d5eb370faea67353f0a86d7942acc80ac927fdc3c058487436fb322ac7b7d1,183,0x2791bca1f2de4661ed88a30c99a7a9449aa84174,46.625415,0xc2132d05d31c914a87c6611c10748aeb04b58e8f,46.644294 -polygon,dodo,1,2023-01-07,0x1aba3621500f42af37f31950137b0776485ae1530a958fc05a68c39f414280c2,115,0x2791bca1f2de4661ed88a30c99a7a9449aa84174,891.937912,0xc2132d05d31c914a87c6611c10748aeb04b58e8f,892.289088 -polygon,dodo,2_dvm,2023-01-07,0x828df8835147ed71b60e504127e409ffeb3bf7495dfec75a712c117f07d28f56,405,0x1bfd67037b42cf73acf2047067bd4f2c47d9bfd6,0.00005737,0x0d500b1d8e8ef31e21c99d1db9a6444d3adf1270,1.2059550547960038 -polygon,dodo,2_dpp,2023-01-07,0x76f9dbda9492d12478525d27fce7963152bb9c5f3f7dafc2c5e9a8effd03f2d8,39,0x2791bca1f2de4661ed88a30c99a7a9449aa84174,750,0x0d500b1d8e8ef31e21c99d1db9a6444d3adf1270,933.2716544242052 -avalanche_c,woofi,1,2022-11-08,0xae581cf151eacf9877f628e722514674f3f13b19abcce4e82808a2350526134a,25,0xb31f66aa3c1e785363f0875a1b74e27b85fd66c7,33.765119660094401667,0xb97ef9ef8734c71904d8002f8b6bc66dd9c48a6e,565.826462 -avalanche_c,woofi,1,2022-05-10,0x4ab2a9385bda8de7df444e6f342c12dd70ad6300fdf3a351d80f46e119a7811c,122,0xb97ef9ef8734c71904d8002f8b6bc66dd9c48a6e,126322.419554,0x50b7545627a5162f82a992c33b87adc75187b218,4.00000076 -avalanche_c,woofi,1,2022-07-28,0xa1bcc8d3ec39c8694c2be30f5489091fe1bfe8ffd570841e55e00bef6ee3359c,6,0xb97ef9ef8734c71904d8002f8b6bc66dd9c48a6e,0.197657,0xb31f66aa3c1e785363f0875a1b74e27b85fd66c7,0.008699999999999999 -avalanche_c,woofi,1,2022-09-07,0xf48e0d36d6a51f82edecb408b20c1aa275fddc71f18d4118e734e3116c19d359,8,0xb31f66aa3c1e785363f0875a1b74e27b85fd66c7,2.714758315778573433,0xb97ef9ef8734c71904d8002f8b6bc66dd9c48a6e,49.97 -bnb,woofi,1,2021-12-21,0xf3d0410543a546cf714ecbbe97caf9b6dc89f0caf627a44dc3b24eb8717b8c56,66,0x7130d2a12b9bcbfae4f2634d864a1ee1ce3ead9c,1.572913555840424953,0x55d398326f99059ff775485246999027b3197955,75491.688052189872040799 -bnb,woofi,1,2021-12-17,0xec25e2af89961b2ca54b69312a2cee1f545786e96d5287dec9fd12b2aba8df63,37,0x55d398326f99059ff775485246999027b3197955,12083.822061807061265726,0x2170ed0880ac9a755fd29b2688956bd959f933f8,3.097519332673643182 -bnb,woofi,2,2022-08-21,0x37420ded51ff96116d39301b4e4e75f3c713423b94319eb4fe3f29e31d3bd6cb,83,0x55d398326f99059ff775485246999027b3197955,14.977390055532270669,0xbb4cdb9cbd36b01bd1cbaebf2de08d9173bc095c,0.050325032466406425 -bnb,iziswap,1,2022-11-21,0x07e7b79ed2e7958c7744accc12ce8c732d82c6d62ce586365d276a72ecca8ba4,97,0xbb4cdb9cbd36b01bd1cbaebf2de08d9173bc095c,3.91980872085136,0x55d398326f99059ff775485246999027b3197955,1000.0 -bnb,iziswap,1,2022-11-21,0x8c1e8cb4f4766ef9a775f040c576dd88a3a6993c8754c35f1e6faf4e1aa65718,197,0x55d398326f99059ff775485246999027b3197955,1016.3951483032495,0xbb4cdb9cbd36b01bd1cbaebf2de08d9173bc095c,4.0 -bnb,iziswap,1,2022-11-21,0x57bbc0040e8db0bdf9dd38b1e888dfc124159a4ef4c0368426f89238db23d8de,264,0x55d398326f99059ff775485246999027b3197955,1019.5850870781412,0xbb4cdb9cbd36b01bd1cbaebf2de08d9173bc095c,4.0 -bnb,fraxswap,1,2022-11-19,0x36f1b32a8115300906f74d3ddf2051d62a226045611a251d84a8a32395ead967,439,0x90c97f71e18723b0cf0dfa30ee176ab653e89f40,0.251513613449462899,0xbb4cdb9cbd36b01bd1cbaebf2de08d9173bc095c,0.001 -bnb,fraxswap,1,2022-10-26,0xe09dd465622225d25f5555214eb8e8e6e74d4a4fa5f6ac51b35f520150011f24,50,0x90c97f71e18723b0cf0dfa30ee176ab653e89f40,4.663005228579123357,0xbb4cdb9cbd36b01bd1cbaebf2de08d9173bc095c,0.018388924302368166 -ethereum,fraxswap,1,2022-07-25,0x36ea8f58b542aed8c3f35ce396da15054e04a522efb25281c8ed0080a081083a,200,0x853d955acef822db058eb8505911ed77f175b99e,6321.896197119067345439,0x3432b6a60d23ca0dfca7761b7ab56459d9c964d0,1000 -ethereum,fraxswap,1,2022-08-21,0x39714256ccf47a89e297b726e8de9eec9446949a224d5e2215fd4dc87c0c8969,406,0x3432b6a60d23ca0dfca7761b7ab56459d9c964d0,2000.000000000000121322,0x853d955acef822db058eb8505911ed77f175b99e,13014.187897251069443882 -polygon,fraxswap,1,2022-11-01,0xda324654d84c5f9b67f6947575878eb25f8789153151295d08ee2738847a0750,135,0x45c32fa6df82ead1e2ef74d17b76547eddfaff89,0.008797854552852608,0x0d500b1d8e8ef31e21c99d1db9a6444d3adf1270,0.01 -polygon,fraxswap,1,2022-11-01,0x9f4b2967cd1cc64490f2765b6d95c70f8d6df37eaa7f2b441e141b2a41f7a793,188,0x0d500b1d8e8ef31e21c99d1db9a6444d3adf1270,1.987969423771805753,0x45c32fa6df82ead1e2ef74d17b76547eddfaff89,1.759300000000000086 -bnb,biswap,1,2022-11-22,0x66a602998a3585037eb498c103b009a4face2faf93ea57dfb1a44d1fa4a06dad,163,0xe9e7cea3dedca5984780bafc599bd69add087d56,33.830622552179025128,0x563ca064e41f3b5d80adeecfe49ab375fd7afbef,2128.2655 -bnb,biswap,1,2022-11-22,0x9050a1e2f7aa392e39195b5b22382d595e94104b72699655b198c498f82bbfe6,153,0xe9e7cea3dedca5984780bafc599bd69add087d56,26.146488901376957832,0x563ca064e41f3b5d80adeecfe49ab375fd7afbef,1643.319 -bnb,biswap,1,2022-11-22,0xe2efd633720bd29322da7e39857e98b3c9904a1c55f9b3995441160983e06296,119,0xe9e7cea3dedca5984780bafc599bd69add087d56,43.898605549510836795,0x563ca064e41f3b5d80adeecfe49ab375fd7afbef,2756.0281 -bnb,biswap,1,2022-11-22,0x0b9ba3ee4a0b3f4db2baba70be527f5a50aea77423cd921106ec9f0ac8dcf169,115,0xbb4cdb9cbd36b01bd1cbaebf2de08d9173bc095c,0.018248512111984361,0xe9e7cea3dedca5984780bafc599bd69add087d56,4.837104443141354752 -bnb,biswap,1,2022-11-22,0xaf03946d9b98e5d6e841bb50555208801e48d773a8dfdf1ecc203d943c27c603,350,0x2170ed0880ac9a755fd29b2688956bd959f933f8,6.247796965743473757,0x7130d2a12b9bcbfae4f2634d864a1ee1ce3ead9c,0.43849 -bnb,nomiswap,1,2022-12-01,0x3b8f8370f2535fb7cd8b68a63d7bdb722cb5452b79a231122a9f5dd246be6657,295,0xe9e7cea3dedca5984780bafc599bd69add087d56,3.4406837272665105,0x60322971a672b81bcce5947706d22c19daecf6fb,8.610658726450525 -bnb,nomiswap,1,2022-12-01,0x2cb3567eada4e2f6350c44a7765516d381641db036cc664e3a64d15b303ac7ad,2503,0x60322971a672b81bcce5947706d22c19daecf6fb,85.62389404482691,0xe9e7cea3dedca5984780bafc599bd69add087d56,34.191528536984286 -bnb,nomiswap,1,2022-11-30,0x9e3dfbd555adc7bd60844ca970bf6fd8ca6a24981b0c05925660f0f5ee8b4a5e,655,0x60322971a672b81bcce5947706d22c19daecf6fb,90.47037459371727,0xe9e7cea3dedca5984780bafc599bd69add087d56,34.79453094032464 -bnb,nomiswap,1,2022-11-30,0xe504096106135022b0d0917e863c8255cc5f8777bcaa70ee38f342be6f74c56d,338,0x60322971a672b81bcce5947706d22c19daecf6fb,103.77456768715207,0xe9e7cea3dedca5984780bafc599bd69add087d56,39.45117236156748 -bnb,nomiswap,1,2022-12-02,0xad22e5ec3486fe0b950510bb500c37baf27f4f50bf5f0fbd6c4ccfc777e2ad15,249,0xe9e7cea3dedca5984780bafc599bd69add087d56,44.399389252049524,0x60322971a672b81bcce5947706d22c19daecf6fb,114.46999990155486 -bnb,babyswap,1,2022-11-22,0x0f4e9d9f303d6d87cd95d85f2dbe48f3cc8e7e8240952e4bd485ef0f81503617,150,0xbb4cdb9cbd36b01bd1cbaebf2de08d9173bc095c,0.050410279081245794,0x55d398326f99059ff775485246999027b3197955,13.346254023941418542 -bnb,babyswap,1,2022-11-22,0x6ba016ab36bd67d7459b4fbaead32e82a57a8930564355d3bfbd3ec7f876d559,244,0xbb4cdb9cbd36b01bd1cbaebf2de08d9173bc095c,0.004192030247987002,0x53e562b9b7e5e94b81f10e96ee70ad06df3d2657,40.39956 -bnb,babyswap,1,2022-11-22,0x0e6d9777fc533bc403df3ebe1b82b5399870f1301e45c90427b9664438efcc31,353,0x53e562b9b7e5e94b81f10e96ee70ad06df3d2657,1738.090365320173641069,0xbb4cdb9cbd36b01bd1cbaebf2de08d9173bc095c,0.18104693184 -bnb,babyswap,1,2022-11-30,0x279dfbce106e55f05a20331ed088e1fd2e1ff68c05ab089cca473f3dbbaef9fe,283,0x55d398326f99059ff775485246999027b3197955,1654.599686417120624489,0x53e562b9b7e5e94b81f10e96ee70ad06df3d2657,60085.854 -avalanche_c,trader_joe,1,2022-11-08,0x1f90838d916d2edf881ba53d8abfe5b557ff2a8d23d7ed692cc0687a71a9cd53,15,0xb97ef9ef8734c71904d8002f8b6bc66dd9c48a6e,342510510,0xb31f66aa3c1e785363f0875a1b74e27b85fd66c7,21741961515422881640 -avalanche_c,trader_joe,1,2022-11-09,0x82cd2992be090d073b82406e3f3882c43eeb4ac7e7ce26839290c6e028b2ac3b,130,0xb97ef9ef8734c71904d8002f8b6bc66dd9c48a6e,30093631,0xb31f66aa3c1e785363f0875a1b74e27b85fd66c7,2354558311510002477 -optimism,velodrome,1,2022-12-02,0x8c4641cbf23a94be095e73660510f7e265d76601b414ea6f838f651609741c87,7,0x7f5c764cbc14f9669b88837ca1490cca17c31607,338.699889,0x4200000000000000000000000000000000000042,311 -optimism,velodrome,1,2022-12-02,0x52e9f5710d07923e189104e31b1c98f569a9fa038b41b67043e9b991fcf7a95f,5,0x7f5c764cbc14f9669b88837ca1490cca17c31607,896.242313,0x4200000000000000000000000000000000000042,823.875076815262 -bnb,mdex,1,2022-12-01,0xcd3cb070ee7f3524bbe091d15cc228676301ba87c8f11101293dd704c7442aa3,633,0xe9e7cea3dedca5984780bafc599bd69add087d56,41.22399442847115,0xa7f552078dcc247c2684336020c03648500c6d9f,1149.6338751257592 -bnb,mdex,1,2022-12-01,0x5558ee58a68414ca812e6861e4f1743fd4670669ab67bdd6cfde72f2185bf098,169,0xbb4cdb9cbd36b01bd1cbaebf2de08d9173bc095c,0.050624007144351967,0xe9e7cea3dedca5984780bafc599bd69add087d56,15.035196244738406 -bnb,mdex,1,2022-12-01,0xfdd41f1fbd608530bd96c19fdfc713d861ec483d9c71976df981a4f61fd28140,376,0x55d398326f99059ff775485246999027b3197955,3.854107292216319,0x3ee2200efb3400fabb9aacf31297cbdd1d435d47,12.23 -bnb,mdex,1,2022-12-01,0x7d8f360ee960583133bbde85314d0257703feabf7a87518e5dc7b3a83de5c001,436,0xbb4cdb9cbd36b01bd1cbaebf2de08d9173bc095c,0.1,0x55d398326f99059ff775485246999027b3197955,29.673387128124077 -bnb,mdex,1,2022-12-01,0xc2e17fc3812f583f5cd2ac1622939828181600b4a65bc1a30449050e3955522c,341,0xe9e7cea3dedca5984780bafc599bd69add087d56,39.60004338983994,0xf8a0bf9cf54bb92f17374d9e9a321e6a111a51bd,5.179156079954205 -bnb,ellipsis_finance,1,2022-06-12,0x264e4b912aa4d9a5338fc3803687229fd8fd6fb3cdc3008c97060d10a959f62a,437,0x1075bea848451a13fd6f696b5d0fda52743e6439,2.291714623466671663,0x2170ed0880ac9a755fd29b2688956bd959f933f8,2 -bnb,ellipsis_finance,1,2022-11-10,0x9c962e3862c0912117ad770035c492a2a4bca4e72f38baa12165853f85960992,458,0xe9e7cea3dedca5984780bafc599bd69add087d56,78.965818265473976219,0x7c869b5a294b1314e985283d01c702b62224a05f,78.401313456087213685 -bnb,ellipsis_finance,1,2022-05-22,0x85e68cfc48c650f4d7cfb9ce98b09c89e0952b3f7b7b2111ead705a72bd4cb38,349,0xe9e7cea3dedca5984780bafc599bd69add087d56,299.616793572788036088,0xdcecf0664c33321ceca2effce701e710a2d28a3f,314.194676267749213306 -bnb,wombat,1,2022-10-27,0xb228abac355fbc699ab0b134f48a495929069310aa32132ca5cdb679a81b6128,111,0x0782b6d8c4551b9760e74c0545a9bcd90bdc41e5,173.56579848904872,0xe9e7cea3dedca5984780bafc599bd69add087d56,173.79087768722817 -bnb,wombat,1,2022-10-27,0x7a6f269ba6a5826e1ac578ec0bb3272429912ab38a8e2533706415cad6cf0634,128,0x1bdd3cf7f79cfb8edbb955f20ad99211551ba275,0.001925010584091731,0xbb4cdb9cbd36b01bd1cbaebf2de08d9173bc095c,0.002 -bnb,wombat,1,2022-10-27,0x478de9749640e880e80485550c62a63072fa946c791f3cf00b60e417c34cb4dd,138,0xe9e7cea3dedca5984780bafc599bd69add087d56,100.08972348327656,0x8ac76a51cc950d9822d68b83fe1ad97b32cd580d,100.1 -bnb,hashflow,1,2022-10-10,0xf7ae714fd7b9c2c5a6f5d1cda6f17b90c3a8585e1d3a2c8efa14826b15f9b9b7,19,0xbb4cdb9cbd36b01bd1cbaebf2de08d9173bc095c,2.784257887632644608,0x8ac76a51cc950d9822d68b83fe1ad97b32cd580d,762 -bnb,hashflow,1,2022-10-10,0x7add80a388efcf38752d98b48a63844b6c3f45a4df9305268180bd8c2cc6d4b0,207,0xe9e7cea3dedca5984780bafc599bd69add087d56,110.063488,0xbb4cdb9cbd36b01bd1cbaebf2de08d9173bc095c,0.4 -bnb,hashflow,1,2023-01-14,0x082830ea432a172e3bab91f690c27830e3fe812aa0cd6613fd62f91be7586fc1,137,0xb3999f658c0391d94a37f7ff328f3fec942bcadc,2.73,0x44ec807ce2f4a6f2737a92e985f318d035883e47,2.73 -bnb,apeswap,1,2022-12-01,0xe4a7e72a504a6a295a75d3f264d0c94b441e89c813b9526f94f660f547c5c835,714,0xbb4cdb9cbd36b01bd1cbaebf2de08d9173bc095c,0.00120638837141382,0xe9e7cea3dedca5984780bafc599bd69add087d56,0.36 -bnb,apeswap,1,2022-12-01,0x23340f2b63579368aeec4765d4dcda837ea706755e9de56f9ee240877d73d5fe,31,0xbb4cdb9cbd36b01bd1cbaebf2de08d9173bc095c,0.003268023598876883,0xe9e7cea3dedca5984780bafc599bd69add087d56,0.9757957073529867 -bnb,apeswap,1,2022-12-01,0xec62c204ea228732d789965d8cbadf18282c0d8fa172623bef62a440ad119827,218,0xbb4cdb9cbd36b01bd1cbaebf2de08d9173bc095c,0.013379338141206242,0x55d398326f99059ff775485246999027b3197955,4 -bnb,apeswap,1,2022-12-01,0x293589cdd2503ed9c667d7dd22ddbb65aaaf66490b197c47cb479a4dd84ef023,335,0xbb4cdb9cbd36b01bd1cbaebf2de08d9173bc095c,0.01336201242131474,0xe9e7cea3dedca5984780bafc599bd69add087d56,4 -bnb,apeswap,1,2022-12-01,0x8a751f20be9f46c85fa9ed18490f9da5c7907b5fa5ffa93b2aec182778f24cda,442,0xe9e7cea3dedca5984780bafc599bd69add087d56,1.7425522170245182,0xbb4cdb9cbd36b01bd1cbaebf2de08d9173bc095c,0.005817836045524239 -polygon,apeswap,1,2022-11-22,0x2f15cd0b477cc45c55924b7aa461a516e2b2f369a3806b55042e3c0e5b0877da,157,0x46d502fac9aea7c5bc7b13c8ec9d02378c33d36f,2248,0x0d500b1d8e8ef31e21c99d1db9a6444d3adf1270,57.048500720012677391 -polygon,apeswap,1,2022-11-22,0x3d56ef902984864931d8feb5f1e91cf896e2d1d535a4ada3968942f2f1c500fa,10,0x0d500b1d8e8ef31e21c99d1db9a6444d3adf1270,699.067345412356780819,0x7ceb23fd6bc0add59e62ac25578270cff1b9f619,0.530171159999668219 -polygon,apeswap,1,2022-11-22,0x740f53bcc15bb3a96c1435003e837677f8bc8f0d94d0c3ff6c33f45443cb746b,134,0xc004e2318722ea2b15499d6375905d75ee5390b8,22416.52442997,0x2791bca1f2de4661ed88a30c99a7a9449aa84174,21 -polygon,apeswap,1,2022-11-22,0x194d468d6c62a717806b5ee4b71131e9f834d724cbd4309a525fac5d9a320f64,185,0x0d500b1d8e8ef31e21c99d1db9a6444d3adf1270,0.99267586734214204,0x5d47baba0d66083c52009271faf3f50dcc01023c,12.616273336186259757 -polygon,apeswap,1,2022-11-22,0xe1d484c6453e2f701a0b246764d4c6dac27d99588b4df3ba6caee50f72f21429,290,0x2791bca1f2de4661ed88a30c99a7a9449aa84174,33,0xc004e2318722ea2b15499d6375905d75ee5390b8,35313.94136592 -fantom,curve,2,2023-01-26,0x2c82d58a52e773e79abe81c8f04ab506f9ddded1b17d7f87ff40861a10681e4b,27,0x04068da6c83afcfa0e13ba15a6696662335d5b75,194.438488,0xdc301622e621166bd8e82f2ca0a26c13ad0be355,191.5377712986513 -fantom,curve,2,2023-01-26,0x7e20e5a8d85bf205cfe3dd7cb6a6668c82707f0ab7f7581a5d78dffbe1dac8ee,10,0x04068da6c83afcfa0e13ba15a6696662335d5b75,93.168043,0xfb98b335551a418cd0737375a2ea0ded62ea213b,93.91500221736457 -fantom,spookyswap,1,2023-01-22,0x0d8a71bb5d5d881dae96a62603d51aed6029fcb1f400eb90afd33fdacbd1b3fb,3,0x049d68029688eabf473097a2fc38ef61633a3c7a,94.447206,0x21be370d5312f44cb42ce377bc9b8a0cef1a4c83,248.3197518 -fantom,spookyswap,1,2023-01-22,0xc408dfc2a9be6f97e60b89fa8c5711e796e73c55c62f74d22ad9ae54667b6565,20,0x21be370d5312f44cb42ce377bc9b8a0cef1a4c83,590,0x049d68029688eabf473097a2fc38ef61633a3c7a,225.486545 -optimism,beethoven_x,2,2023-01-22,0x3be1a0fb7f1ef890351fe4a575a095e6e996625e01af1e4b43893d00ac35bbb6,1,0x4200000000000000000000000000000000000042,56.0439404452666,0x7f5c764cbc14f9669b88837ca1490cca17c31607,128.261625 -optimism,beethoven_x,2,2023-01-22,0x6a660bbea15d3fb2c13c37ec0f6268ead9a3b0370344085751665c8981eaf167,508,0xfe8b128ba8c78aabc59d4c64cee7ff28e9379921,0.000034701468348079,0x4200000000000000000000000000000000000042,0.000111535848130678 -optimism,beethoven_x,2,2023-01-22,0x6a660bbea15d3fb2c13c37ec0f6268ead9a3b0370344085751665c8981eaf167,512,0x4200000000000000000000000000000000000042,1.38960477071438,0x4200000000000000000000000000000000000006,0.00195330326074912 -optimism,beethoven_x,2,2023-01-21,0xbc0015bacc88ed681b13ee19ef14c3ec74184cb8fe4e96128313f2ab797c283e,8,0x1f32b1c2345538c0c6f582fcb022739c4a194ebb,0.0716016140629488,0x4200000000000000000000000000000000000006,0.0789256223359575 -optimism,beethoven_x,2,2023-01-22,0x0d0042f1f3726a6958ef3a491482e734d559cf07ed24d1e19b65541d893fe75d,10,0x7f5c764cbc14f9669b88837ca1490cca17c31607,96.65967,0x1f32b1c2345538c0c6f582fcb022739c4a194ebb,0.0539912808878705 -optimism,rubicon,1,2023-01-23,0x9b881a99a4d952ce35e69e938aeb6fa433e9b6aa609338a6451d61231fadd565,106,0x4200000000000000000000000000000000000006,0.0687643728672874,0x7f5c764cbc14f9669b88837ca1490cca17c31607,112.189533 -optimism,rubicon,1,2023-01-24,0x0808ab44a5ba3c04cd3411216feb1cf7f6d2408f6173ae0d2c533f1ee9ec7317,6,0x7f5c764cbc14f9669b88837ca1490cca17c31607,10.997583,0x4200000000000000000000000000000000000042,5.01949758830531 -optimism,rubicon,1,2023-01-24,0x888942e2eba202731c2bdf4fa1b3bddd03870d3064106bf478b9a0950f3f51c3,6,0x7f5c764cbc14f9669b88837ca1490cca17c31607,8.817783,0x4200000000000000000000000000000000000042,4.02459708671438 -optimism,rubicon,1,2023-01-24,0x888942e2eba202731c2bdf4fa1b3bddd03870d3064106bf478b9a0950f3f51c3,15,0x4200000000000000000000000000000000000006,0.00538901884526646,0x7f5c764cbc14f9669b88837ca1490cca17c31607,8.816901 -optimism,rubicon,1,2023-01-24,0x888942e2eba202731c2bdf4fa1b3bddd03870d3064106bf478b9a0950f3f51c3,22,0x94b008aa00579c1307b0ef2c499ad98a8ce58e58,8.670616,0x4200000000000000000000000000000000000006,0.00538847955865886 -fantom,sushiswap,1,2023-01-20,0xed537c0e7ebd3d654bd8e5cf8ceec84a4fdc0483eee59802c890d0fcfcf1060c,166,0x321162cd933e2be498cd2267a90534a804051b11,0.00756091,0x74b23882a30290451a17c44f4f05243b6b58c76d,0.1022693 -fantom,sushiswap,1,2023-01-20,0xd0e069b94d62579995037ae2180a1e88811012383cfc0927092680f87e0ed2d3,29,0x049d68029688eabf473097a2fc38ef61633a3c7a,70.205678,0x21be370d5312f44cb42ce377bc9b8a0cef1a4c83,230 -arbitrum,arbswap,1,2022-12-17,0x0e24e2a7c61821707441ac12f8e8d4ce38ff829f94b86a70ede3cfd9af52511a,19,0x82af49447d8a07e3bd95bd0d56f35241523fbab1,0.001234459141,0xff970a61a04b1ca14834a43f5de4533ebddb5cc8,1.458842 -arbitrum,arbswap,1,2022-12-17,0x3390d9871240fc2a540dc5d0dec18cbcc6991c936330c5fbe7513c6a0a990ec0,5,0xff970a61a04b1ca14834a43f5de4533ebddb5cc8,19.230924,0xda10009cbd5d07dd0cecc66161fc93d7c9000da1,18.86197078 -arbitrum,arbswap,1,2022-12-18,0xea091ea1def1416b81a3903b1c266bd53cb137f8c52d9fab883811440ac9e474,4,0x82af49447d8a07e3bd95bd0d56f35241523fbab1,0.01899934141,0xff970a61a04b1ca14834a43f5de4533ebddb5cc8,23.112426 -arbitrum,balancer,2,2022-10-25,0x8cc9955e4368d88ef78a0c6dc8505da3e7272446e70947126286780daa454f84,3,0xff970a61a04b1ca14834a43f5de4533ebddb5cc8,430.19906,0x6694340fc020c5e6b96567843da2df01b2ce1eb6,900 -ethereum,balancer,1,2020-08-02,0xac80f41cdfc018bfdc6d37f881fe3def377aa9fd3d0b794c3d7e7ee1e6501ce4,99,0x6b175474e89094c44da98b954eedeac495271d0f,25.34746680728174,0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2,0.0658152885716226 -ethereum,balancer,2,2022-05-06,0xb6bba47d296682416f32fb4264cfe3fe2994284183081beafc8c36cc1e76b1f2,3,0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2,3.755554997108105,0xba100000625a3754423978a60c9317c58a424e3d,758.7236799507402 -gnosis,balancer,2,2023-01-20,0x70a7380d73bd8dc96aa2a2ec338f6a660df54e797bab507b5ee04c27e6433844,20,0xe91d153e0b41518a2ce8dd3d7944fa863463a97d,2.811201702694398,0xddafbb505ad214d7b80b1f830fccc89b60fb7a83,2.811563 -optimism,balancer,2,2023-01-14,0xbcd5b16b59067a5c9dc98fe5fcf0c2ec8b0554249bdb54db423d805d2e20265c,33,0x4200000000000000000000000000000000000006,0.020434661575615593,0x7f5c764cbc14f9669b88837ca1490cca17c31607,31.094857 -polygon,balancer,2,2022-02-05,0x24685d2daebdf4ade873366e33863e0c9b349e974270d786fc773cf5bc8554ec,254,0x53e0bca35ec356bd5dddfebbd1fc0fd03fabad39,6.60916362154873,0x7ceb23fd6bc0add59e62ac25578270cff1b9f619,0.03965 -fantom,spartacus_exchange,1,2023-01-23,0x6768ad671c7da39ee9d75b37ad58b77c72982aa7bf21d1dfb030fa7546ad58d9,13,0x04068da6c83afcfa0e13ba15a6696662335d5b75,13273.768685,0x049d68029688eabf473097a2fc38ef61633a3c7a,13276.71125 -fantom,spartacus_exchange,1,2023-01-22,0xc0a1b20ead30eb1f7c730afcf9399945ce84b5bcdcb9dabf3bcfa3411499d1b5,6,0x04068da6c83afcfa0e13ba15a6696662335d5b75,25.332101,0x21be370d5312f44cb42ce377bc9b8a0cef1a4c83,67 -fantom,equalizer,1,2023-01-22,0xca3fce464272fae479cc0056caa15e882e3fde396a5da883871ba9b8ff1fbbf3,43,0x5cc61a78f164885776aa610fb0fe1257df78e59b,129.98998930892284,0x04068da6c83afcfa0e13ba15a6696662335d5b75,1.049684 -fantom,equalizer,1,2023-01-22,0xf72faa8d02ad82c498e2bef2eafa3071d4e531b8245be1defc963f314ab96a24,48,0x049d68029688eabf473097a2fc38ef61633a3c7a,9.017632,0x04068da6c83afcfa0e13ba15a6696662335d5b75,9.019453 -fantom,wigoswap,1,2023-01-22,0xecaff2b9aeedca150c05e79e27474e25a2c40722ae2b70b3b90be163f2a9f8b9,15,0x04068da6c83afcfa0e13ba15a6696662335d5b75,87.454047,0x21be370d5312f44cb42ce377bc9b8a0cef1a4c83,220 -fantom,wigoswap,1,2023-01-22,0x3a5eaeb4b331a05e24406c955f2ee89c0da7b37365b6049de224aa08d9b4e38b,17,0x1e4f97b9f9f913c46f1632781732927b9019c68b,33.77612953779118,0x21be370d5312f44cb42ce377bc9b8a0cef1a4c83,96.8125 -fantom,spiritswap,1,2023-01-23,0x2d2c2b842b1a0118bbfb931715b21ee17d3ae0a0128e6402b3cfa4645e3a69c4,57,0x21be370d5312f44cb42ce377bc9b8a0cef1a4c83,48.501746184182,0x8d11ec38a3eb5e956b052f67da8bdc9bef8abf3e,19.985 -fantom,spiritswap,1,2023-01-23,0xf02b0492697aa787cac842b91a47a4f5582386822e7a493dbf278718175ccfbd,4,0x04068da6c83afcfa0e13ba15a6696662335d5b75,282.525324,0x21be370d5312f44cb42ce377bc9b8a0cef1a4c83,700 -optimism,synthetix,1,2023-01-29,0x8ae97667b2e098ab76d6fc3e89a62fca7a736894fba7a740a3636f9c64cc8077,7,0xe405de8f52ba7559f9df3c368500b6e6ae6cee49,20,0x8c6f28f2f1a3c87f0f938b96d27520d9751ec8d9,33025.1881585549 -optimism,synthetix,1,2023-01-30,0x81f4b75e257aae89b5ac2a79764260131f9db2ff4551cc837e3f758df444e12e,7,0x8c6f28f2f1a3c87f0f938b96d27520d9751ec8d9,67.814135331492,0xe405de8f52ba7559f9df3c368500b6e6ae6cee49,0.04161141 -optimism,synthetix,1,2023-01-30,0x26fdd3b38051f353979603153113ba2600290e6e9a4455c4f32a933b52c2e91d,7,0x8c6f28f2f1a3c87f0f938b96d27520d9751ec8d9,0.154574875193123,0xe405de8f52ba7559f9df3c368500b6e6ae6cee49,0.0001 -optimism,synthetix,1,2023-01-30,0xe32cc68ee496955f2aee625067b304cea1f066ac5f23cb864ddc1466636e5cff,7,0xfbc4198702e81ae77c06d58f81b629bdf36f0a71,0.128596335180203,0x8c6f28f2f1a3c87f0f938b96d27520d9751ec8d9,0.1396 -optimism,synthetix,1,2023-01-30,0x298ec0451a7380c6c5f470414248c896ac473996ecd5cc1b2abfcc542770b536,7,0xc5db22719a06418028a40a9b5e9a7c02959d0d08,437.636404718796,0x8c6f28f2f1a3c87f0f938b96d27520d9751ec8d9,3080.5826 -optimism,curve,1,2022-12-02,0x80b901d362d34109fc5ab3d2501390a9a0e54e69388e5eea84469ce77a3b9302,9,0x8c6f28f2f1a3c87f0f938b96d27520d9751ec8d9,73.0574092246244,0x7f5c764cbc14f9669b88837ca1490cca17c31607,72.2707437014961 -optimism,curve,1,2022-12-01,0x9b98ca1a43c0b4c7709285f8e591a605905dc35e8f52234410628de6ebf1d365,42,0x7f5c764cbc14f9669b88837ca1490cca17c31607,1.034302,0x8c6f28f2f1a3c87f0f938b96d27520d9751ec8d9,1.03049060456676 -optimism,curve,1,2023-01-31,0x77fadc1a0ea6ab065fc3190a24f4f67ff35f22dc824f003cf0656d79089669c4,25,0x8c6f28f2f1a3c87f0f938b96d27520d9751ec8d9,0.435843637716131,0x94b008aa00579c1307b0ef2c499ad98a8ce58e58,0.429232709933431 -optimism,curve,1,2023-01-30,0xa0b8591ffcbc148432fd3c603616dce7877f6097d93716d726ef6dae9a6bcd8f,8,0x8c6f28f2f1a3c87f0f938b96d27520d9751ec8d9,0.0218734943841243,0x94b008aa00579c1307b0ef2c499ad98a8ce58e58,0.0215416887092783 -optimism,curve,1,2023-01-30,0xfca84e35c36c4d6fe0f40eac69c229e9bf4fa3a12f7b8267ae9609aff58a65af,6,0x7f5c764cbc14f9669b88837ca1490cca17c31607,45.648713,0x8c6f28f2f1a3c87f0f938b96d27520d9751ec8d9,45.6283342082489 -optimism,curve,1,2023-01-30,0x76780eb40844a0fc1cbaa16a30d8098d55bec4d774cfee1a7baed9c8dd4f6a92,8,0x8c6f28f2f1a3c87f0f938b96d27520d9751ec8d9,0.0799001414721287,0x94b008aa00579c1307b0ef2c499ad98a8ce58e58,0.0786881443367727 -optimism,curve,1,2023-01-30,0x72f451639593a62c0ec916d20de947b11d15f2ae5075452ddf08d68f77b54e87,8,0x8c6f28f2f1a3c87f0f938b96d27520d9751ec8d9,0.0998759919306217,0x94b008aa00579c1307b0ef2c499ad98a8ce58e58,0.0983609378552637 -optimism,curve,1,2023-01-31,0xa70d826c5b3b5afbe9585e15f1e58c75cbcc1359784d48de48b9d025270985d9,70,0x7f5c764cbc14f9669b88837ca1490cca17c31607,32.037157,0x94b008aa00579c1307b0ef2c499ad98a8ce58e58,32.036492 -optimism,curve,1,2023-01-31,0x2a4ff09a9d921f631e4e14a61fc6f7fd7997691ed40acac415c0988fe93f9f96,39,0x7f5c764cbc14f9669b88837ca1490cca17c31607,16.006302,0x94b008aa00579c1307b0ef2c499ad98a8ce58e58,16.006705 -optimism,curve,1,2023-01-30,0xf14d489c5cb44772b1082e7589781fac60d0f559fa2999844b2cbb782d434443,75,0x7f5c764cbc14f9669b88837ca1490cca17c31607,8.00233,0xda10009cbd5d07dd0cecc66161fc93d7c9000da1,8.00249590591778 -optimism,curve,1,2023-01-30,0x2615836b17d0b9a467f187a84c497233ee3a815a0ad341d70b63e28d2c6c98df,159,0x7f5c764cbc14f9669b88837ca1490cca17c31607,128.283656,0xda10009cbd5d07dd0cecc66161fc93d7c9000da1,128.286430267516 -optimism,curve,1,2023-01-30,0x4569f2998b9f00eea1c372d82a36fa32b7aa7ca9fba7378bf63756614e2733e9,3,0x94b008aa00579c1307b0ef2c499ad98a8ce58e58,255.877053,0xda10009cbd5d07dd0cecc66161fc93d7c9000da1,255.914112076597 -optimism,zipswap,1,2022-04-06,0xbdad190b91443e3b18e07e213b2b8ebc2725e188571f0f43eb8962d8f885c932,3,0x7f5c764cbc14f9669b88837ca1490cca17c31607,3867.857072,0x4200000000000000000000000000000000000006,1.15 -optimism,zipswap,1,2022-02-05,0x111251020222b3efbd71693d4d5ef3f3e3ff9598f023152877f47ad87f2b60b8,5,0x4200000000000000000000000000000000000006,1.44270162397699,0xda10009cbd5d07dd0cecc66161fc93d7c9000da1,4293.85850577198 -optimism,zipswap,1,2022-02-12,0x25b8b0f3465265e895c92353e967bd934d86ae6a0ce9a5a7bf45d967868a1582,9,0x4200000000000000000000000000000000000006,1.00158875384491,0xda10009cbd5d07dd0cecc66161fc93d7c9000da1,2961.21850646285 -optimism,zipswap,1,2022-03-06,0xbc6ec237edd3883acd524defb5f1d8635df3610eb195828b4679b3dc9e6e6b0e,4,0x4200000000000000000000000000000000000006,1.89814384488954,0x7f5c764cbc14f9669b88837ca1490cca17c31607,4924.180007 -optimism,zipswap,1,2022-03-01,0xb285876c166ca5a4614c28cb838a1067cf12b8a0f5217fe1021427f7d4571548,4,0x7f5c764cbc14f9669b88837ca1490cca17c31607,5587.487912,0x4200000000000000000000000000000000000006,1.9 -avalanche_c,trader_joe,2,2023-02-17,0x51c5b4dabbcedf31ab4379eeb163dd8a72db4ed827655e6c4019a84d59e45c0b,55,0x152b9d0fdc40c096757f570a51e494bd4b943e50,0.1884868,0x49d5c2bdffac6ce2bfdb6640f4f80f226bc10bab,2.7198489125262477 -avalanche_c,trader_joe,2,2023-02-17,0x582496cdacfa83cbb32bdc9e6a7a0baecb31e43ca798728500e783b95c2b6673,14,0x49d5c2bdffac6ce2bfdb6640f4f80f226bc10bab,2.7198489125262477,0x152b9d0fdc40c096757f570a51e494bd4b943e50,0.1884868 -polygon,quickswap,3,2023-02-17,0x8d1bffc369ccde33fff07cb5edaf58bdc4a63217e5e234d8fe1f3908779610ae,105,0x0d500b1d8e8ef31e21c99d1db9a6444d3adf1270,200,0x2791bca1f2de4661ed88a30c99a7a9449aa84174,293.856899 -polygon,quickswap,3,2023-02-17,0x5761ecf943d9ccdec872484d42d45c28f72b3a3760c6da97b573c8a7e2e38af4,192,0xc2132d05d31c914a87c6611c10748aeb04b58e8f,147.193696,0x0d500b1d8e8ef31e21c99d1db9a6444d3adf1270,100 -polygon,quickswap,2,2022-10-17,0x89588a0facfd37f5e6787bab1a534d4ceb94b0c630a177397150cd580151f2e0,179,0x2791bca1f2de4661ed88a30c99a7a9449aa84174,13.420646,0x8f3cf7ad23cd3cadbd9735aff958023239c6a063,13.425263636998267 -polygon,quickswap,2,2022-10-14,0x7fb5168d79b8a249784a62e266d4d805e98ae81af2b69c54dc23060ce4ceaae9,216,0x2791bca1f2de4661ed88a30c99a7a9449aa84174,494.340474,0x7ceb23fd6bc0add59e62ac25578270cff1b9f619,0.37290529608348755 -polygon,quickswap,2,2022-06-25,0xe9da7260f20bbb8b5d135c217c073758b5474e2973ac9540b4ee919d0219650b,288,0x2791bca1f2de4661ed88a30c99a7a9449aa84174,183.901282,0x0d500b1d8e8ef31e21c99d1db9a6444d3adf1270,300 -fantom,beethoven_x,1,2023-02-01,0xb353ea3753bd43f79452a99a5f0b4ba79848eb535406006b2a325e2610cc20c7,10,0xc3bf643799237588b7a6b407b3fc028dd4e037d2,10.79068245,0x21be370d5312f44cb42ce377bc9b8a0cef1a4c83,10.9191819 -fantom,beethoven_x,1,2023-02-01,0x406e3b0bfa2b7289eb7a9c37a87f55d1c1f7b5dc1c90cf638ccf6bc06b73f4f0,43,0xc3bf643799237588b7a6b407b3fc028dd4e037d2,154.8200719,0x21be370d5312f44cb42ce377bc9b8a0cef1a4c83,156.6637268 -fantom,beethoven_x,1,2023-02-01,0x9ed054600393f6ddfd5e9e271ceacc419ea1ea5c5069032f3bccf6e0bbd1057c,9,0x8d11ec38a3eb5e956b052f67da8bdc9bef8abf3e,4.419601846,0x04068da6c83afcfa0e13ba15a6696662335d5b75,4.417833 -fantom,beethoven_x,1,2023-02-01,0x3ad542dcee62446ad4cea36a4606c1dfecdc654d83113509ca43c958737b97b9,44,0x21be370d5312f44cb42ce377bc9b8a0cef1a4c83,1999.4,0x04068da6c83afcfa0e13ba15a6696662335d5b75,1042.833542 -fantom,beethoven_x,1,2023-02-01,0xf73a2c4c02eb03d263d39f5b640229bb9b23f8242a5389b37a5c8aedc428b17e,56,0x21be370d5312f44cb42ce377bc9b8a0cef1a4c83,84.55916959,0xc5e2b037d30a390e62180970b3aa4e91868764cd,550.564336 -ethereum,pancakeswap,2,2023-01-12,0x176632fa77a3e328cf904f814888f77ee97c57cde0a014d1dedcab92accfc959,247,0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2,0.1936898575,0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48,274.694256 -ethereum,pancakeswap,2,2023-01-09,0xc1f7f412ac0636e914b2e55e21ddbb79f313be2d7ca4c5e084db223787c52441,325,0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48,39.768234,0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2,0.03053786191 -ethereum,pancakeswap,2,2022-12-01,0x70cb37c8e8a566b850d1475606b3c4b64adf51cca9bb9e32645344b93c99c8f9,17,0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2,7.607205635,0xdac17f958d2ee523a2206206994597c13d831ec7,9627.386202 -ethereum,pancakeswap,2,2022-12-13,0x0ba7e4e4a630729028258782ac77f81444de749ffe9fbc526295c29979a9cca1,49,0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2,1.479851125,0xdac17f958d2ee523a2206206994597c13d831ec7,1948.798982 -ethereum,pancakeswap,2,2022-12-13,0xc66b844b06fdfcc8376915467463328e5bd189335f03249670473a247e38741a,300,0xdac17f958d2ee523a2206206994597c13d831ec7,187.010126,0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2,0.1401299988 -arbitrum,integral,size,2022-07-14,0x16f35abbffc8b50bc985d2db02abeaf337e16de587b85eb3c834b70bf6e9cfc7,3,0x82af49447d8a07e3bd95bd0d56f35241523fbab1,0.01900877891605384,0xff970a61a04b1ca14834a43f5de4533ebddb5cc8,21.123742 -arbitrum,integral,size,2022-10-23,0xb705d45124099b8e98e9dd7205392dbda8a34d40e3ad47a875239cf38c9a81fe,7,0x82af49447d8a07e3bd95bd0d56f35241523fbab1,0.000653038267454768,0xff970a61a04b1ca14834a43f5de4533ebddb5cc8,0.855361 -arbitrum,integral,size,2022-10-29,0x769e31ebc00639ce2a44b9885070473d619ed35ddcdbcff789852067457e2785,4,0xff970a61a04b1ca14834a43f5de4533ebddb5cc8,0.03,0x82af49447d8a07e3bd95bd0d56f35241523fbab1,0.000018904849893185 -arbitrum,integral,size,2022-11-10,0x3d18f064963df7166dd579e65c775b4d4e8260923041e4393615fc032977a9a4,3,0xff970a61a04b1ca14834a43f5de4533ebddb5cc8,0.642262,0x82af49447d8a07e3bd95bd0d56f35241523fbab1,0.0005 -arbitrum,integral,size,2023-01-27,0xbf780d189520cb325350d3c94423f1a46c42387f765f35c4dcca7e1e8bdff06e,10,0xff970a61a04b1ca14834a43f5de4533ebddb5cc8,2,0x82af49447d8a07e3bd95bd0d56f35241523fbab1,0.0012454151038722 -arbitrum,integral,size,2023-03-05,0x8bda9d3016f4e7768181325032442549348c251f2e161852bce177b00143c2ed,7,0x82af49447d8a07e3bd95bd0d56f35241523fbab1,0.00291816855303509,0xff970a61a04b1ca14834a43f5de4533ebddb5cc8,4.579709 -ethereum,integral,size,2022-03-21,0xae7bb04cb102287ca2b832010121bd8fdac1396359a428f50ce992a5c6ebc212,153,0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2,0.005070744820370721,0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48,14.77512 -ethereum,integral,size,2022-07-03,0x5534f8443a6a08c6c279e5fbaaaa39ffe5a698de2be8240827dc732320585761,244,0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2,0.24908715433948347,0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48,265.219513 -ethereum,integral,size,2023-01-06,0x822561900aada258035a1645eb34c866b9d02638ada3fd9f5dc4739d18d680c1,80,0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48,89483.765933,0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2,72 -ethereum,integral,size,2023-01-30,0xe51df574230b4e1002606a3cd73d511e85003e19413c6d1db52f3d6b788935a0,158,0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2,126.18176269960297,0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48,199977.007606 -ethereum,integral,size,2023-02-14,0x7c01d8115c86b110ed4673068feed8febe7d26115d56779161c0d5c1e2a01ae3,170,0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2,45.174995872186976,0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48,69953.020039 -ethereum,integral,size,2023-03-05,0x93a28f10be5e758a9ac05722595c8a2d8c5900a107ad097e47027eeea57ebe61,91,0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2,43.29894547565704,0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48,68000 -optimism,sushiswap,trident-cpp,2023-02-25,0x556acdec157c9c7beaecbd3013a988e5ed13e4d4293231274bd0055687b6d3fe,19,0x4200000000000000000000000000000000000042,1.2359258546421,0x7f5c764cbc14f9669b88837ca1490cca17c31607,3.834014 -optimism,sushiswap,trident-cpp,2023-02-25,0x49135f081d16041793f3f4c52c91085382c9a8cc2e7bfd6b4d90306ff624f954,22,0x7f5c764cbc14f9669b88837ca1490cca17c31607,13.318854,0x4200000000000000000000000000000000000042,4.48285194988426 -optimism,sushiswap,trident-cpp,2023-02-25,0xfec6e552c846e1a321fe73dffd923ba15312066d0b91b3dd1d7d7d169a86e789,10,0x7f5c764cbc14f9669b88837ca1490cca17c31607,1.791866,0x94b008aa00579c1307b0ef2c499ad98a8ce58e58,1.839893 -optimism,sushiswap,trident-sp,2022-10-10,0x83c508e618dc0994dfbb7cdc027e5959fab51038dce9d561c75179e09f86f47e,17,0x8c6f28f2f1a3c87f0f938b96d27520d9751ec8d9,7.60726339281,0x7f5c764cbc14f9669b88837ca1490cca17c31607,7.749999 -optimism,sushiswap,trident-sp,2022-10-04,0x62e0ddfab23a326c20b192d2532493ab8457a2ae8eddcc935bf467d88d6fe745,17,0xda10009cbd5d07dd0cecc66161fc93d7c9000da1,3.999622063709,0x7f5c764cbc14f9669b88837ca1490cca17c31607,4.000001 -bnb,pancakeswap,mmpool,2023-03-03,0x42b4dcf040808d2a22928744c0a78aaf9873b30b027a638ae93b1983295cf0fc,306,0xbb4cdb9cbd36b01bd1cbaebf2de08d9173bc095c,6.944209657,0x55d398326f99059ff775485246999027b3197955,2012.077814 -bnb,pancakeswap,mmpool,2023-03-03,0x653194cae17a57e6b1ceddb9e7fcd917435094460772c16d9bf0a97b60a4b9b2,94,0xbb4cdb9cbd36b01bd1cbaebf2de08d9173bc095c,0.3451386066,0x55d398326f99059ff775485246999027b3197955,100 -bnb,pancakeswap,mmpool,2023-03-03,0x590e143ba81d3aca84b3e84391f7943af2aedbbb3fb600eea4b455cc974c519a,390,0xbb4cdb9cbd36b01bd1cbaebf2de08d9173bc095c,0.3394153334,0x55d398326f99059ff775485246999027b3197955,98.37106848 -bnb,pancakeswap,mmpool,2023-03-03,0x0d9e5f3bb655fdab7281e376d5baba55867a8f16bfe53f2c6dfa8e88885b5570,255,0x55d398326f99059ff775485246999027b3197955,150,0xbb4cdb9cbd36b01bd1cbaebf2de08d9173bc095c,0.5188477066 -bnb,pancakeswap,mmpool,2023-03-03,0x077b09506b8b3cf5fa5737ff1b5f865f5cb846eca7325abe08092b043f9f6fcd,107,0xe9e7cea3dedca5984780bafc599bd69add087d56,53,0xbb4cdb9cbd36b01bd1cbaebf2de08d9173bc095c,0.183167344 -ethereum,pancakeswap,mmpool,2023-03-09,0x4a4e3ed3c8048ae97d776d90a8e6c7a20036aefb98846dd5158a01dd29b0996d,231,0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48,71.119581,0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2,0.0462709406 -ethereum,pancakeswap,mmpool,2023-03-09,0x19cc99f99a1c638bf5a45711a50f3c185cedd9ad4e1cbda231895c6d0f365abf,277,0xdac17f958d2ee523a2206206994597c13d831ec7,1283.292428,0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2,0.8356205947 -ethereum,pancakeswap,mmpool,2023-03-09,0x7d97ffaff69d26a44b1f0347675fe839cb72c886b46e94becec16a381a6e6c8e,349,0x4fabb145d64652a948d72533023f6e7a623c7c53,38.18645876,0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2,0.02489566923 -ethereum,pancakeswap,mmpool,2023-03-09,0xe8fceccb966aa76d8b847f0b067f987b233313699d53a8dfd95f3e4869b9c621,500,0x4fabb145d64652a948d72533023f6e7a623c7c53,39.47962744,0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2,0.02571453404 -ethereum,pancakeswap,mmpool,2023-03-09,0x06e1b3740c4a4d8fa60f7ddf6defb706f1ec64c563b697f0695647921b2b8c89,288,0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48,1535.457365,0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2,1 -bnb,pancakeswap,stableswap,2022-09-30,0xc8e562b51d15bc7dcc461f0d8f674c368cb17d5b338c825fc2021da4e070635d,42,0x0782b6d8c4551b9760e74c0545a9bcd90bdc41e5,44.96591897,0xe9e7cea3dedca5984780bafc599bd69add087d56,45 -bnb,pancakeswap,stableswap,2023-02-23,0x926a9463e8b1c94b267f8996c0aa3d25f0650b16d84cdf22c5c8cbd175b35a92,95,0x8ac76a51cc950d9822d68b83fe1ad97b32cd580d,29.52590913,0xe9e7cea3dedca5984780bafc599bd69add087d56,29.53001786 -bnb,pancakeswap,stableswap,2023-02-23,0x2748ee8746f8ef3188f256312489cf877f819725c7b8526eabd2588437bced33,318,0xe9e7cea3dedca5984780bafc599bd69add087d56,17.00035523,0x55d398326f99059ff775485246999027b3197955,17 -bnb,pancakeswap,stableswap,2023-02-23,0xac4971ca3d750e40957720b9ed7d312de71868da236c5775f6cee8dc6a14bf30,226,0x55d398326f99059ff775485246999027b3197955,1000.607238,0xe9e7cea3dedca5984780bafc599bd69add087d56,1000.83 -bnb,pancakeswap,stableswap,2023-02-23,0xe71f7a8812df06a0b36b88a2746d1d48ad39bb5bcb61c23572aeea04df96cc50,181,0x8ac76a51cc950d9822d68b83fe1ad97b32cd580d,2499.859114,0x55d398326f99059ff775485246999027b3197955,2500 -arbitrum,clipper,1,2022-12-15,0x4e8b282691842b546869ff2ffb6e33e515d609bced31527bc049f92e6e00c831,3,0xff970a61a04b1ca14834a43f5de4533ebddb5cc8,5.490002,0xfd086bc7cd5c481dcc9c85ebe478a1c0b69fcbb9,5.49 -arbitrum,clipper,1,2022-12-15,0x3c63866b0a50ef829cf1431b90116fad82e44823228dfa57a6fb43eda552304b,2,0xfd086bc7cd5c481dcc9c85ebe478a1c0b69fcbb9,10.474675,0x82af49447d8a07e3bd95bd0d56f35241523fbab1,0.0083 -arbitrum,clipper,1,2023-02-15,0x52f3a5f2a8217e8bba343841bd379c076cfa06c1279d64ee43f891fc4aaedebc,3,0xda10009cbd5d07dd0cecc66161fc93d7c9000da1,114.4518751,0xfd086bc7cd5c481dcc9c85ebe478a1c0b69fcbb9,114.56 -arbitrum,clipper,1,2022-12-17,0x283d63748d6390489926c305d148468c5308c75e58ea120fb0329a345b9c9447,22,0x82af49447d8a07e3bd95bd0d56f35241523fbab1,0.04963966456,0xff970a61a04b1ca14834a43f5de4533ebddb5cc8,58.644399 -arbitrum,clipper,1,2023-02-15,0x967ac0e5c10a6d27df334f4a33a35c25a3cbf58e7ee48d6a58b97467a16496cc,58,0x82af49447d8a07e3bd95bd0d56f35241523fbab1,0.1052072797,0x2f2a2543b76a4166549f7aab2e75bef0aefc5b0f,0.00736108 -optimism,curve,1,2022-11-12,0xcea94039dcf9ce75c6081f0ed26fc3f6b9193036f901372b002edc67f960a711,9,0x94b008aa00579c1307b0ef2c499ad98a8ce58e58,0.001012,0x2e3d870790dc77a83dd1d18184acc7439a53f475,0.00101798869624305 -optimism,curve,1,2022-05-20,0xf0a56683a1f5c98f734da37362976c19ced781ea2ca1168c203d605593689308,3,0x94b008aa00579c1307b0ef2c499ad98a8ce58e58,112.531495,0x7f5c764cbc14f9669b88837ca1490cca17c31607,106.894737 -optimism,curve,1,2022-05-16,0x1daf9b0e5b53bbb0cf2cc82fc56ea4b03e4b04642326c4c34ee5034edcc419a0,5,0x2e3d870790dc77a83dd1d18184acc7439a53f475,2028.06638964748,0x94b008aa00579c1307b0ef2c499ad98a8ce58e58,2002.456704 -optimism,curve,1,2022-05-11,0x9e35d672d4202923c30f0e65eeaae4b7e922600b2715dacde56a98cef3903062,5,0x94b008aa00579c1307b0ef2c499ad98a8ce58e58,1002.93221,0x2e3d870790dc77a83dd1d18184acc7439a53f475,1001.2474503025 -optimism,curve,1,2022-05-14,0xa3178cf9778f11a12c896e7967a38ab72b2ca043e2f569dc56e7fe58de6d7995,3,0x2e3d870790dc77a83dd1d18184acc7439a53f475,6057.51457069822,0xfb21b70922b9f6e3c6274bcd6cb1aa8a0fe20b80,30000 -ethereum,verse_dex,1,2023-04-04,0x18c614748464c21582bcd495cc7b733b79c229f704175c1148ce38586315979a,152,0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2,0.00955734414316444,0x249ca82617ec3dfb2589c4c17ab7ec9765350a18,16661.729412 -ethereum,verse_dex,1,2023-04-04,0x8ff523946a9fc2f8fde8d15bab4987afaf68ac5af60112dfde75d784ee833a7c,324,0x249ca82617ec3dfb2589c4c17ab7ec9765350a18,1.7744202052689952,0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2,0.000001 -ethereum,clipper,4,2023-04-06,0x3772f0915d742bc2d40fec51d5be6c0f92e511290fea9212d45561ebae61f7f7,156,0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48,4134.968625,0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2,2.175 -ethereum,clipper,4,2023-04-06,0x844d2221065c96722aeb29ff2a412042c41515ce86bede33615e29357fb76d10,118,0xdac17f958d2ee523a2206206994597c13d831ec7,18956.433604,0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2,10 -ethereum,clipper,4,2023-03-30,0x4e4aa9d5238083c16fab7077782dfafd928cd9fc5fe1946230345a6c06393c29,168,0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2,6.766262249310329856,0xdac17f958d2ee523a2206206994597c13d831ec7,12000 -ethereum,pancakeswap,3,2023-04-02,0x3a0097fcc23266394c9ec6e5cf1dd667e60717b1f92fbc76a5e5e2aa50a430ba,84,0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2,0.001637811713,0xdac17f958d2ee523a2206206994597c13d831ec7,3 -ethereum,pancakeswap,3,2023-04-01,0x942d7e8064aa1925e484ad9e38b25b0eea8620aa2b85a42a47b957bcdc5df18b,175,0xdac17f958d2ee523a2206206994597c13d831ec7,0.980006,0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48,1 -bnb,pancakeswap,3,2023-04-02,0x34e2f3b9224779e88f114b4c4a65f1480e9caa66ff85921f9c3bba825ef51f63,266,0x7130d2a12b9bcbfae4f2634d864a1ee1ce3ead9c,0.000003526055978,0x55d398326f99059ff775485246999027b3197955,0.1 -bnb,pancakeswap,3,2023-04-02,0x54ce217448356994969038a892c0e7b5613ae237305a8191a95ff0d034321c52,174,0x55d398326f99059ff775485246999027b3197955,0.1933971381,0xe9e7cea3dedca5984780bafc599bd69add087d56,0.1934275369 -bnb,pancakeswap,3,2023-04-02,0x570f6d65a9f3046b184feb4efea90de552b31e6b06c1a04baf645636a3389ca1,265,0x55d398326f99059ff775485246999027b3197955,1,0xe9e7cea3dedca5984780bafc599bd69add087d56,1.002954374 -ethereum,kyberswap,elastic,2023-03-18,0x294c98fc947bf25331849d24ecc6dda039c293aa36b5046c88a8e677b1621d78,94,0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48,25060.144,0x7f39c581f595b53c5cb19bd0b3f8da6c935e2ca0,12.515483515 -ethereum,kyberswap,elastic,2023-03-15,0x672f52ebebab645191403cfecb43dbb512100552e669288f4fc81174f9bdf587,104,0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48,15081.44,0x7f39c581f595b53c5cb19bd0b3f8da6c935e2ca0,8.03308903 -ethereum,kyberswap,elastic,2023-01-09,0xa508a934395ab577132be907912b0d70c1493730696db951fc39e9b4506b9a96,37,0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2,5.222238778,0x7f39c581f595b53c5cb19bd0b3f8da6c935e2ca0,4.767894198 -bnb,onepunchswap,quick,2023-03-03,0xa74ad784d8b0f673cb7ebe659f46d136a6d4a58bbd6386f3c4cc8a3adb064bdd,273,0x55d398326f99059ff775485246999027b3197955,1099.16920747,0xe9e7cea3dedca5984780bafc599bd69add087d56,1100 -bnb,onepunchswap,normal,2023-01-12,0xa723fca3a321586a38c738a1bc221a4e9bf4f5e7732660ae6ffc9d64024ec92d,448,0x55d398326f99059ff775485246999027b3197955,21.499975900000003,0xe9e7cea3dedca5984780bafc599bd69add087d56,22 -arbitrum,kyberswap,elastic,2023-04-11,0xdf4e944f86454b662499e8326333dce6af1c18f9663d1289c89b5d49a18d5e9f,5,0x912ce59144191c1204e64559fe8253a0e49e6548,579.3333333,0x82af49447d8a07e3bd95bd0d56f35241523fbab1,0.370589731 -arbitrum,kyberswap,elastic,2023-03-11,0xbfd464a0d559cceebbdd20c42ee8a1054de12c936396adbec4bafad9eba60faa,13,0xff970a61a04b1ca14834a43f5de4533ebddb5cc8,2468.999762,0x82af49447d8a07e3bd95bd0d56f35241523fbab1,1.723592528 -arbitrum,kyberswap,elastic,2023-03-26,0x070e704ea6da35b05c97e2a2f9ccf01136f9bdf6d411da31206a837d373e58ca,6,0x82af49447d8a07e3bd95bd0d56f35241523fbab1,0.0029,0xff970a61a04b1ca14834a43f5de4533ebddb5cc8,5.145281 -bnb,sushiswap,1,2021-11-01,0xc66fb80242b7c788c2896b3dc8c611203771be9474d18f85cb2032d594de327c,830,0xbb4cdb9cbd36b01bd1cbaebf2de08d9173bc095c,0.07525109648,0x049d68029688eabf473097a2fc38ef61633a3c7a,43.351292 -bnb,sushiswap,1,2021-11-01,0xffc3e47949b600ee61d7b3b7b57da6137ed4c55652da396d02ff3ece60bfdd9b,591,0xbb4cdb9cbd36b01bd1cbaebf2de08d9173bc095c,0.01789196956,0x049d68029688eabf473097a2fc38ef61633a3c7a,9.541071 -polygon,sushiswap,1,2021-06-16,0xc625dc2c5e923afd8469e9e03233d37eab64d627a4e6f221c8b63efcf276523c,179,0x7ceb23fd6bc0add59e62ac25578270cff1b9f619,0.1131447356,0x0d500b1d8e8ef31e21c99d1db9a6444d3adf1270,191.734491 -polygon,sushiswap,1,2021-06-16,0xa727f3165a6e7533cbeecfbe67e4072f8b9a0eec486a4c9976b25b902a1bd6f0,310,0x7ceb23fd6bc0add59e62ac25578270cff1b9f619,0.0008197673253,0x0d500b1d8e8ef31e21c99d1db9a6444d3adf1270,1.388941988 -arbitrum,arbswap,1,2023-04-20,0x33634f26b1e30f11e9e838aff4d9b80aba590b7e606cd098aaf44dff750453f0,26,0xfd086bc7cd5c481dcc9c85ebe478a1c0b69fcbb9,393.359856,0xff970a61a04b1ca14834a43f5de4533ebddb5cc8,393.622497 -arbitrum,arbswap,1,2023-04-20,0x7067cf03ac33918acdfdc6e92baa72116fe9fcf8f80a66f50eadb1622b045749,24,0xfd086bc7cd5c481dcc9c85ebe478a1c0b69fcbb9,301.67528,0xff970a61a04b1ca14834a43f5de4533ebddb5cc8,301.87521 -arbitrum,arbswap,1,2023-04-20,0x3f0b0b0a16ade0cde73012628a814ee1115191648bd0d194e85a75c8f9f74267,20,0xfd086bc7cd5c481dcc9c85ebe478a1c0b69fcbb9,1225.214854,0xff970a61a04b1ca14834a43f5de4533ebddb5cc8,1226.048896 -avalanche_c,glacier,2,2023-04-22,0x8e5b51477a54c3de4e5850c09f33958ca357baa676bb7342389030bc4ba3e901,5,0x3712871408a829c5cd4e86da1f4ce727efcd28f6,63.768883740248004859,0xb31f66aa3c1e785363f0875a1b74e27b85fd66c7,0.1 -avalanche_c,glacier,3,2023-10-11,0x1751558603dd0b89deff0e55ada181d3491079ef14e47ec44e8441be9958d386,51,0x152b9d0FdC40C096757F570A51E494bd4b943E50,0.00003735,0xB97EF9Ef8734C71904D8002F8b6Bc66Dd9c48a6E,1 -bnb,thena,1,2023-01-13,0x5e9dbda2365611fd1a32b5b674aa082008194192ce42764e9ba7cb68e81a770f,205,0xbb4cdb9cbd36b01bd1cbaebf2de08d9173bc095c,0.2832796564,0xf307910a4c7bbc79691fd374889b36d8531b08e3,3794.420108 -bnb,thena,1,2023-03-20,0xce4925f4437a57ca2c81eaa2d9ffe98d3f057e7814517f06011c61706038ec57,54,0x3e0a7c7db7bb21bda290a80c9811de6d47781671,106017.0695,0xbb4cdb9cbd36b01bd1cbaebf2de08d9173bc095c,0.2878260858 -bnb,thena,1,2023-01-13,0x9ac1353991d2f9b54d9bbe5bf410f572ca49b2cd55f9b21129d2c34d044869d2,70,0xe9e7cea3dedca5984780bafc599bd69add087d56,248.3024372,0xbb4cdb9cbd36b01bd1cbaebf2de08d9173bc095c,0.85 -bnb,thena,1,2023-01-11,0x9bef538535e92fcceeaa0d0e53671a96f99b7f4caf3e5571bce376b376ba1792,86,0xe9e7cea3dedca5984780bafc599bd69add087d56,0.02782935491,0xbb4cdb9cbd36b01bd1cbaebf2de08d9173bc095c,0.0001 -bnb,thena,1,2023-01-15,0x19c3e71f0813076f8c101040e915ebf57e518b12a34299ba9d901092ce023b47,93,0x2170ed0880ac9a755fd29b2688956bd959f933f8,1.300626579,0xbb4cdb9cbd36b01bd1cbaebf2de08d9173bc095c,6.656329907 -bnb,thena,fusion,2023-04-25,0xbb4c30455d3d5e8b69d11dfcfa3bf1bcb77822d9f1d34726cba5a6d09e1e9fa2,409,0x55d398326f99059ff775485246999027b3197955,7009.844541,0x8ac76a51cc950d9822d68b83fe1ad97b32cd580d,7010.638184 -bnb,thena,fusion,2023-04-21,0xc7fc3cd4454421a2f37db49d965be5ab236419988cce54245da9fa38e301a7b7,64,0xbb4cdb9cbd36b01bd1cbaebf2de08d9173bc095c,4.82962897,0x55d398326f99059ff775485246999027b3197955,1553.83144 -bnb,thena,fusion,2023-04-22,0xbce3f03c353621d410f8bb396b157c644a03153699cf2821f6fd042225a37044,87,0xbb4cdb9cbd36b01bd1cbaebf2de08d9173bc095c,8.491571503,0x2170ed0880ac9a755fd29b2688956bd959f933f8,1.504299198 -bnb,thena,fusion,2023-04-23,0x436ade4d35952187e4a045cfbe9495839b1bcf8b26448f3b67dbbdd54636c831,293,0xbb4cdb9cbd36b01bd1cbaebf2de08d9173bc095c,1.27418968,0xad29abb318791d579433d831ed122afeaf29dcfe,971.5572125 -bnb,thena,fusion,2023-04-23,0xc0dda2219f7daa1866b234f324dae21abeebae534e5a63378d3c90b039c5ae71,98,0xbb4cdb9cbd36b01bd1cbaebf2de08d9173bc095c,7.677802518,0x55d398326f99059ff775485246999027b3197955,2535.952589 -bnb,trader_joe,2,2023-03-22,0xac02d1ccbda4a91fd1536f651b8fb4e5f007c2946895b5b79f75172b7d8ffa65,89,0xbb4cdb9cbd36b01bd1cbaebf2de08d9173bc095c,2.272454476,0x2170ed0880ac9a755fd29b2688956bd959f933f8,0.4238820505 -bnb,trader_joe,2,2023-03-29,0x13ec4185ea44e8bfc20f697d78cdc143857a4b4e5bb4c38912ffa0a6816b8c34,101,0xbb4cdb9cbd36b01bd1cbaebf2de08d9173bc095c,0.03494438202,0x55d398326f99059ff775485246999027b3197955,10.94292897 -bnb,trader_joe,2,2023-03-30,0x2def8747ff99350ff0aa9fcbfa71a863ad597f430a99ae8a625263f101be0b8a,67,0xf7de7e8a6bd59ed41a4b5fe50278b3b7f31384df,,0xbb4cdb9cbd36b01bd1cbaebf2de08d9173bc095c,0.2773595262 -bnb,trader_joe,2,2023-03-30,0xf0fbd4b3c90627a03e4d5711ba46cc8d34a9b98e7a9e66d956df655107a0744e,152,0x7130d2a12b9bcbfae4f2634d864a1ee1ce3ead9c,0.0003537724251,0xbb4cdb9cbd36b01bd1cbaebf2de08d9173bc095c,0.03171060155 -bnb,trader_joe,2,2023-03-18,0x8a0fb41570066245da48355ec6d29a08d6a7a16078e55992444f0f0e81268d58,310,0x371c7ec6d8039ff7933a2aa28eb827ffe1f52f07,,0xbb4cdb9cbd36b01bd1cbaebf2de08d9173bc095c,0.00499 -polygon,clipper,coves1,2022-06-03,0x93e44bb7e6ddf344eed6b2b4c5515e3c05b2e446ec31af6872cc682718b060a6,163,0x172370d5cd63279efa6d502dab29171933a610af,0.123367431088796876,0x8505b9d2254a7ae468c0e9dd10ccea3a837aef5c,0.002702 -polygon,clipper,coves1,2022-06-05,0x3c054758e23b93515785e9c2700043d354d880340e390a7b8b8a98a8b8b2bfe3,159,0x0621d647cecbfb64b79e44302c1933cb4f27054d,90.847377705661993975,0x8505b9d2254a7ae468c0e9dd10ccea3a837aef5c,0.039663 -polygon,clipper,coves1,2023-03-04,0xa58ec465b5e28a212f86083c0dfeecb154f24f40104445a7990c5c576230e0c3,443,0x6bfce69d1df30fd2b2c8e478edec9daa643ae3b8,5.099499802721257244,0x482bc619ee7662759cdc0685b4e78f464da39c73,713.373882 -arbitrum,clipper,coves1,2022-12-06,0xa0a47ca5f454a5c9d001d03de6563fe0e2a48e16c8723d3c0a26088a7f940f41,3,0xe7b0ce0526fbe3969035a145c9e9691d4d9d216c,0.158964119815058764,0xf97f4df75117a78c1a5a0dbb814af92458539fb4,0.01 -arbitrum,clipper,coves1,2022-12-09,0xc1b08d81333f584ac973dd872bbc77f1d008e772451d7de74a154b57de7f883f,3,0xe7b0ce0526fbe3969035a145c9e9691d4d9d216c,15.114099040607641726,0x75c9bc761d88f70156daf83aa010e84680baf131,1815.668906918918325545 -arbitrum,clipper,coves1,2023-03-20,0x2931dbddc1a0871c8ab04e51da506c576e799c0bfdc8a4e779a0dae75c5dfcc3,3,0xe7b0ce0526fbe3969035a145c9e9691d4d9d216c,3.119357483899408340,0xf97f4df75117a78c1a5a0dbb814af92458539fb4,0.553 -polygon,clipper,1,2022-01-26,0x555c31d37b6b77de5edbbaa623761737a33a5b71441d1f909eb8557ab9d7a166,205,0x2791bca1f2de4661ed88a30c99a7a9449aa84174,133.833762,0x7ceb23fd6bc0add59e62ac25578270cff1b9f619,0.051695 -polygon,clipper,1,2022-01-26,0xd41d3a78cf89308068ff7f8e7019c85ad52d9ca67e39df15421d29328075e5ee,106,0x8f3cf7ad23cd3cadbd9735aff958023239c6a063,0.5,0x0d500b1d8e8ef31e21c99d1db9a6444d3adf1270,0.296711840114860928 -polygon,clipper,1,2022-01-27,0x756a078124017590745a408ed1e73b6fe5c2b2b6173d58ec5a00f5ef335d5b16,681,0x0d500b1d8e8ef31e21c99d1db9a6444d3adf1270,644.744585586146541568,0xc2132d05d31c914a87c6611c10748aeb04b58e8f,1027.15 -polygon,clipper,2,2023-05-05,0xb435e13ddd117c716da7a545cee52c0044d13e426ad828a2320f452e28e6af85,133,0x2791bca1f2de4661ed88a30c99a7a9449aa84174,21.938739,0x0d500b1d8e8ef31e21c99d1db9a6444d3adf1270,22 -polygon,clipper,2,2023-05-02,0x3a421f0ecb82952458147c5e36a74b3a76b3a19b73b8f12876cba549abe05c89,33,0x7ceb23fd6bc0add59e62ac25578270cff1b9f619,0.89233926939564864,0x2791bca1f2de4661ed88a30c99a7a9449aa84174,1646.45 -polygon,clipper,2,2023-04-30,0xc0d794026723e06e8ed27ac51deea4c6721349cfed72c7adae93a4e25e4bd9cf,103,0x0d500b1d8e8ef31e21c99d1db9a6444d3adf1270,9.9588119216496128,0x2791bca1f2de4661ed88a30c99a7a9449aa84174,10.03 -optimism,clipper,1,2022-02-12,0xd22ecf018e5f53662e338637030fc9b421ca9eb2d0bb8780f82153c3081ad0ce,2,0xda10009cbd5d07dd0cecc66161fc93d7c9000da1,2.980299461242894336,0x4200000000000000000000000000000000000006,0.001 -optimism,clipper,1,2022-02-14,0x76bceae919aa817fd3bfb14752bdf6cc2a9fc2103e95b16e32bdd495751644a0,2,0x4200000000000000000000000000000000000006,0.001993505781816838,0x94b008aa00579c1307b0ef2c499ad98a8ce58e58,6 -optimism,clipper,1,2022-06-19,0xdffb84123a6e954f391a44d1a3c045097cdbb9cc8a2d74c29d92fbe84b7a3b91,3,0x4200000000000000000000000000000000000006,0.025954788650449416,0x7f5c764cbc14f9669b88837ca1490cca17c31607,27 -optimism,clipper,2,2023-01-07,0xa9ebe982d106fda99c19deb174e8f4c3ab5cfd86f3a59bd733e6be2a9cc4fce2,2,0x7f5c764cbc14f9669b88837ca1490cca17c31607,2.95,0xda10009cbd5d07dd0cecc66161fc93d7c9000da1,2.95 -optimism,clipper,2,2023-04-28,0x9858f1003e8e35dfa563531e4af26303fbb4d3e04ef8e56b0e601cf012fb365e,2,0x7f5c764cbc14f9669b88837ca1490cca17c31607,174.913443,0x4200000000000000000000000000000000000006,0.092345 -optimism,clipper,2,2023-05-08,0x0a79d12a8a315b8f3bc098e137b9984f64e4f74b8593d15fe7238f0913eae25a,3,0x94b008aa00579c1307b0ef2c499ad98a8ce58e58,100.800922,0x7f5c764cbc14f9669b88837ca1490cca17c31607,100.89 -optimism,clipper,coves1,2022-12-13,0x201e546c8871abf6220934093065e1aac8fab88320f6815cad4e78273e07626b,2,0x5130f6ce257b8f9bf7fac0a0b519bd588120ed40,0.618159001037606673,0x8c6f28f2f1a3c87f0f938b96d27520d9751ec8d9,21.3 -optimism,clipper,coves1,2023-03-17,0xdce9dc4b6817b3038e339b0db046d35e602a830023808dad953146f14ea1e076,2,0x5130f6ce257b8f9bf7fac0a0b519bd588120ed40,0.246568672972728249,0x8c6f28f2f1a3c87f0f938b96d27520d9751ec8d9,11.489492 -optimism,clipper,coves1,2023-01-08,0xeaa79d87de38e9f0a5ee5b0ab948dd998a342348f11a35ab63a726054d31b472,2,0x5130f6ce257b8f9bf7fac0a0b519bd588120ed40,3.085208524632291028,0x8c6f28f2f1a3c87f0f938b96d27520d9751ec8d9,107.717588 -arbitrum,camelot,1,2023-02-10,0x03bad3b7a62d5dcde805ebcf1441e6966fdf66f4d03fabc040955e953b26e8e9,3,0x82af49447d8a07e3bd95bd0d56f35241523fbab1,0.09033515213962749,0x1426cf37caa89628c4da2864e40cf75e6d66ac6b,249.5412320381824 -arbitrum,camelot,1,2023-02-06,0x04fd14aa1471a9561a66fd804a5c995ec211aa7e96bbcbeb48801efdbdb236d6,3,0x82af49447d8a07e3bd95bd0d56f35241523fbab1,0.22457814589748834,0x088cd8f5ef3652623c22d48b1605dcfe860cd704, -arbitrum,camelot,1,2023-02-16,0x0aba2b8e2046b670abd3046e28e55e5fb521b6271d2ec8fb72c54df1f5977079,3,0x82af49447d8a07e3bd95bd0d56f35241523fbab1,0.707795125477355,0x51318b7d00db7acc4026c88c3952b66278b6a67f,1759.9819725646116 -arbitrum,camelot,1,2023-02-08,0x317879e802e220cd2b910c2b477406506eff5ef62894344adc9f7e26fa3589e0,3,0xff970a61a04b1ca14834a43f5de4533ebddb5cc8,466.224209,0xba42a714bc9c16be6a1ce5eb66ab4deb3904862a, -arbitrum,camelot,1,2023-02-20,0x2d820ba0c8ee0b2b3dfbe1002520bfd952fd65e6f52217722fdd83ed44b982cb,3,0x82af49447d8a07e3bd95bd0d56f35241523fbab1,0.18770390514247653,0x1426cf37caa89628c4da2864e40cf75e6d66ac6b,225 -ethereum,xchange,1,2023-06-05,0x46da856ff5390f122260b3ddeff8c84e6471d715722bcec69410859a9dd7a9ce,26,0x70008f18fc58928dce982b0a69c2c21ff80dca54,6177.083844891557065659,0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2,0.25809555 -ethereum,xchange,1,2023-06-04,0xb9cf9af8c09ee4b01f7998e4d09b5732e3d59db577453d8f649c3368a5be4723,3,0x7102dc82ef61bfb0410b1b1bf8ea74575bf0a105,16740.414870869491102082,0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2,349.842891200744390656 -ethereum,xchange,1,2023-06-04,0xdca9e79f3d41644b579994c0e62f73e8741605b85bb9a80fcc6d173180fd891c,26,0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2,264.386114548212846651,0x7103ebdbf1f89be2d53eff9b3cf996c9e775c105,16740.857191421503408067 -ethereum,xchange,1,2023-06-12,0xf71d8fd364e2402eb11ba7bfbd9b59336e2b075571c1523d119f74a11a1986e3,170,0x117546d1467d80c6bde13910412c724383260cf9,345579.7727468311529198,0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2,0.1 -ethereum,xchange,1,2023-06-12,0x7da422240ab88976df8c9694114daf8b8cfc335e1f851a8c175bca99e5e4cdcd,200,0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2,0.134508790612232095,0x117546d1467d80c6bde13910412c724383260cf9,477750.8030874053723140 -ethereum,xchange,1,2023-06-12,0x4eba2bbed2a473a3a6b2fbfc1d784940b5157afc285c35aff1200e491ea1346a,115,0xdbc7945c5403c589ec39a9aa8c5af234c706f6a2,14049529527.028758241707276441,0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2,0.1 -arbitrum,rubicon,1,2023-06-22,0xd8360d1c435e78ccb4dd69a09a86fcae9cbfd03be22880f375bc63f945f86105,9,0x82af49447d8a07e3bd95bd0d56f35241523fbab1,0.000001,0xff970a61a04b1ca14834a43f5de4533ebddb5cc8,0.045454 -bnb,maverick,1,2023-07-11,0x1ed037d4a55c43d54c152ef4e02bb64911ce4d6876ce9a2d3b0692866f8e92ee,116,0x55d398326f99059ff775485246999027b3197955,616.3450112,0xbb4cdb9cbd36b01bd1cbaebf2de08d9173bc095c,2.4932 -bnb,maverick,1,2023-07-11,0x1ed037d4a55c43d54c152ef4e02bb64911ce4d6876ce9a2d3b0692866f8e92ee,112,0x55d398326f99059ff775485246999027b3197955,80.43094329,0xbb4cdb9cbd36b01bd1cbaebf2de08d9173bc095c,0.3252 -bnb,maverick,1,2023-07-11,0xdcabb7f0bf4e3b5dd66cd5920bdac9aff12525bbf19cd6ff1fdaa580c13c91d2,284,0x55d398326f99059ff775485246999027b3197955,39.15345608,0xbb4cdb9cbd36b01bd1cbaebf2de08d9173bc095c,0.15791026 -bnb,maverick,1,2023-07-11,0x39e0ca81018ce7c7af3988d7c07b711bd0c388285f53b0d00a215e1aa5da2f33,239,0xbb4cdb9cbd36b01bd1cbaebf2de08d9173bc095c,0.007728228509,0x55d398326f99059ff775485246999027b3197955,1.919414559 -bnb,maverick,1,2023-07-11,0x840ba933291c56edf365f610145a3daaddca924d05cdbb854406bfd9e1456c5c,490,0x55d398326f99059ff775485246999027b3197955,0.09150513578,0xbb4cdb9cbd36b01bd1cbaebf2de08d9173bc095c,0.00037 -bnb,biswap,3,2023-07-04,0xf1e982bbc994157eb9166ff1dd38007563be61732e4d9cf68c9054c06172d914,388,0x55d398326f99059ff775485246999027b3197955,347.9115816,0x965f527d9159dce6288a2219db51fc6eef120dd1,3393.698051 -bnb,biswap,3,2023-07-04,0x374992d7f8a643561b0e2e81fba3476bed551ff56923cdb7249a6ed55f0048f9,62,0x55d398326f99059ff775485246999027b3197955,4250.697313,0xbb4cdb9cbd36b01bd1cbaebf2de08d9173bc095c,17.322 -bnb,biswap,3,2023-07-04,0x48f8c54608537fd65159b1ddd29816ecb8898d24d8db5d499081dc6d54ff970b,203,0xbb4cdb9cbd36b01bd1cbaebf2de08d9173bc095c,3.749781574,0x55d398326f99059ff775485246999027b3197955,918 -bnb,biswap,3,2023-07-04,0xc7eafa7888604093d5519a2781a11ccfc13a3886ff527a2d7994ab149736bc38,111,0x55d398326f99059ff775485246999027b3197955,432.8623893,0x965f527d9159dce6288a2219db51fc6eef120dd1,4211.332437 -bnb,biswap,3,2023-07-04,0x72d5dac9c7a76ac8a22f187904b7426b558679e7e67bf57d445c2843e76b7ce9,353,0x55d398326f99059ff775485246999027b3197955,2067.243048,0x965f527d9159dce6288a2219db51fc6eef120dd1,20000 -arbitrum,clipper,2,2023-08-18,0x1768f47e4c444d7c0ddd57a3443e7d33fac05e50f3fdd2df90ff2668ceec3b84,5,0x82af49447d8a07e3bd95bd0d56f35241523fbab1,0.511516502316425216,0x2f2a2543b76a4166549f7aab2e75bef0aefc5b0f,0.03255 -arbitrum,clipper,2,2023-08-18,0x90e3be5cdf42ec6b3a73ec3d05223eab42838ac30ad5cc74289f794af6b577f2,21,0x82af49447d8a07e3bd95bd0d56f35241523fbab1,0.846399351080674428,0xfd086bc7cd5c481dcc9c85ebe478a1c0b69fcbb9,1414.806453 -arbitrum,clipper,2,2023-08-18,0x6b111ae4d162a9edc797aed817bb7c63c6dc822d1779cb81fa5b059ace8d4d9f,5,0x82af49447d8a07e3bd95bd0d56f35241523fbab1,0.10982751402043816,0xaf88d065e77c8cc2239327c5edb3a432268e5831,183.36 -bnb,trader_joe,2.1,2023-07-28,0xb33ad6a6e11af49bab308fdee266792b9f2076ddc0ddda7a67f914a2f16b8556,414,0x55d398326f99059ff775485246999027b3197955,43.56323804,0xbb4cdb9cbd36b01bd1cbaebf2de08d9173bc095c,0.1813504168 -bnb,trader_joe,2.1,2023-07-28,0xd46f2e27a78eba9f1be4c977d455e6149a5378ff00c09ca688ecbc758a074d46,137,0x55d398326f99059ff775485246999027b3197955,79.36140925,0xbb4cdb9cbd36b01bd1cbaebf2de08d9173bc095c,0.3298806352 -bnb,trader_joe,2.1,2023-07-28,0x83a45610d0c433efd31036beae942c56f622a8199e06af63504665aa77db5877,213,0x55d398326f99059ff775485246999027b3197955,84.52649753,0xbb4cdb9cbd36b01bd1cbaebf2de08d9173bc095c,0.3513502969 -bnb,trader_joe,2.1,2023-07-27,0xb82b8d676b6c1ee79634ca1c1cb581061c81c63f028145b67b299ea66d7bb236,115,0xbb4cdb9cbd36b01bd1cbaebf2de08d9173bc095c,0.01662917245,0x55d398326f99059ff775485246999027b3197955,3.9994 -bnb,trader_joe,2.1,2023-07-27,0x34e262e0bc312d589c71f35e75bcf77ae849804f46fdb18bec9b32a8b80e48d0,886,0xbb4cdb9cbd36b01bd1cbaebf2de08d9173bc095c,0.004132442613,0x55d398326f99059ff775485246999027b3197955,0.99985 -arbitrum,pancakeswap,3,2023-08-10,0x5717320a6ee550e52766121090ee54b07b3709f4f0711cc92eebc0ef98254f83,3,0xff970a61a04b1ca14834a43f5de4533ebddb5cc8,11,0x82af49447d8a07e3bd95bd0d56f35241523fbab1,0.005948697782 -arbitrum,pancakeswap,2,2023-08-10,0x827d5b1184f9a6f635ef1a0a114a3c00f9a9ee365270c7650d780fb915803878,9,0xfd086bc7cd5c481dcc9c85ebe478a1c0b69fcbb9,0.500654,0x82af49447d8a07e3bd95bd0d56f35241523fbab1,0.0002455680987 -arbitrum,pancakeswap,2,2023-08-10,0x83a33922c2a82f94f34cae0d4db5d5870f96591c1a934966f683f4cdc9b16874,5,0x912ce59144191c1204e64559fe8253a0e49e6548,0.2627488973,0x82af49447d8a07e3bd95bd0d56f35241523fbab1,0.0001916379656 -arbitrum,pancakeswap,2,2023-08-10,0xc3e422ff2d453e0f4e4e28a99ceb4ec86b63d7bd3326f79ca7e93c499c74337a,4,0x912ce59144191c1204e64559fe8253a0e49e6548,0.2425571142,0x82af49447d8a07e3bd95bd0d56f35241523fbab1,0.00014 -arbitrum,pancakeswap,2,2023-08-10,0x1958fe5d2b768dff806749c4d029be07fd5a0e182d4de5e2328b84dbfac8520d,9,0xfd086bc7cd5c481dcc9c85ebe478a1c0b69fcbb9,0.239277,0x82af49447d8a07e3bd95bd0d56f35241523fbab1,0.0001 -arbitrum,pancakeswap,2,2023-08-10,0xb9cda996210e763e0edaa5489a276e96f4db35161b15b95407f95cfd4a8e2c79,10,0xfd086bc7cd5c481dcc9c85ebe478a1c0b69fcbb9,0.221946,0x82af49447d8a07e3bd95bd0d56f35241523fbab1,0.0001257329137 -base,uniswap,3,2023-08-12,0xc04be42e9fe8cfcbaa9aebab27c9b527b692473f89a7f8c0df6f09c8f5573cbc,10,0x8544fe9d190fd7ec52860abbf45088e81ee24a8c,,0x4200000000000000000000000000000000000006, -base,uniswap,3,2023-08-18,0x43c43e6b8316986ab3c14123c0e297e3f47891d1f17d16760cdd9e04be53d967,48,0x4200000000000000000000000000000000000006,,0xd9aaec86b65d86f6a7b5b1b0c42ffa531710b6ca, -base,sushiswap,1,2023-08-11,0x9a0de02d064c2093c18eb1fcf221c5d2f8ddbb959f152a50953ff7305d7487d3,33,0x4200000000000000000000000000000000000006,,0xeb466342c4d449bc9f53a865d5cb90586f405215, -gnosis,honeyswap,2,2023-08-21,0xe0945f4c866da125593006178aebc47ad709977fa1cef3267f2f393998096208,5,0xe91d153e0b41518a2ce8dd3d7944fa863463a97d,56.58785072313919,0x9c58bacc331c9aa871afd802db6379a98e80cedb,0.5544256540774396 -gnosis,honeyswap,2,2023-08-21,0x61cb55ee2597cf986e9c7008d22dbed8a3199db268f1778640a7be6b69755ea5,34,0x9c58bacc331c9aa871afd802db6379a98e80cedb,2.61298539303e-7,0x3a97704a1b25f08aa230ae53b352e2e72ef52843,0.000001006924689829 -gnosis,honeyswap,2,2023-08-21,0x61cb55ee2597cf986e9c7008d22dbed8a3199db268f1778640a7be6b69755ea5,37,0xe91d153e0b41518a2ce8dd3d7944fa863463a97d,0.000026616366730299,0x9c58bacc331c9aa871afd802db6379a98e80cedb,2.61298539303e-7 -gnosis,honeyswap,2,2023-08-21,0x47b8a32f6fb1c87166640072a6e882be5751c9cf32bbb5bfbc0c6283b135d5c3,45,0xe91d153e0b41518a2ce8dd3d7944fa863463a97d,0.000003449911839519,0x524b969793a64a602342d89bc2789d43a016b13a,0.000124343025949923 -gnosis,honeyswap,2,2023-08-21,0xe9a4089db84306526abfab3fd1410a6b55104753b7a2cee09353ca4754bbfff6,9,0xe68856eb29b2fb39699286cca7f10f90ce8ae9de,0.003243743285956065,0xe91d153e0b41518a2ce8dd3d7944fa863463a97d,0.00001 -celo,uniswap,3,2023-07-26,0xb4c714f5f3ada0aab91354ea4f98b81d3f22b99a44bd1120064804375baaf0f1,39,0x765DE816845861e75A25fCA122bb6898B8B1282a,0.000000128752079,0x471EcE3750Da237f93B8E339c536989b8978a438,0.0000001651 -celo,uniswap,3,2023-07-24,0xfd97ff672aabdbd57b3ff7f51ec91b3170e946e5c6a93f4486c33b6a8619fac8,22,0x765DE816845861e75A25fCA122bb6898B8B1282a,0.000013520104342,0x471EcE3750Da237f93B8E339c536989b8978a438,0.00001732 -celo,uniswap,3,2023-09-01,0xa97e020130d49ce315764b2508064d6ff039f2448f2061bd6ba974179d09303f,12,0xD8763CBa276a3738E6DE85b4b3bF5FDed6D6cA73,0.000018520277777,0x471EcE3750Da237f93B8E339c536989b8978a438,0.000046 -celo,uniswap,3,2023-09-03,0x1450d020ee268a70b1794e0bb248604cf30b2f7510c6065e93cd4adaae20cf85,32,0xD8763CBa276a3738E6DE85b4b3bF5FDed6D6cA73,0.027461717078225,0x471EcE3750Da237f93B8E339c536989b8978a438,0.07 -celo,uniswap,3,2022-07-08,0x481633031a8e6c30fb13d788ff16bfe294adbc71c0cf7ae291a7798935eb789d,41,0xD8763CBa276a3738E6DE85b4b3bF5FDed6D6cA73,2.948959733277387,0x765DE816845861e75A25fCA122bb6898B8B1282a,3 -base,aerodrome,1,2023-08-29,0x7d759da49295695ec7cade65a7f8abbdf83d6f639efa03ad73533f46f387375e,21,0x9e53e88dcff56d3062510a745952dec4cefdff9e,949750.9264,0x4200000000000000000000000000000000000006,0.2 -base,aerodrome,1,2023-08-29,0x3c00dfe0b735b6c7f3dd302e41cdb5bc32fa64ce98b958ea2a99e9b868f24976,8,0xd9aaec86b65d86f6a7b5b1b0c42ffa531710b6ca,16.521567,0x4200000000000000000000000000000000000006,0.01 -base,aerodrome,1,2023-08-29,0x644579f1f66b20b7aacddc4300ea746963ef3c68c37b32d14c7a9f59a92d2151,17,0x9e53e88dcff56d3062510a745952dec4cefdff9e,1.59E+06,0x4200000000000000000000000000000000000006,0.3 -base,aerodrome,1,2023-08-29,0x552ae20fd4164aa9ef2a37616510c7dd54333733578a4af20074e81dc14af8ce,143,0x4200000000000000000000000000000000000006,0.06062542,0xd9aaec86b65d86f6a7b5b1b0c42ffa531710b6ca,100 -base,aerodrome,1,2023-08-29,0x8e6c892e94a991f843932a8b9af962f448d06c25addca4c608eef800aaf2ab70,16,0xd9aaec86b65d86f6a7b5b1b0c42ffa531710b6ca,170.841539,0x4200000000000000000000000000000000000006,0.1 -base,pancakeswap,3,2023-08-31,0x5c4a3562d59f1f93dc0957c343e76b35b6e950fe7ad5fbdf076cc22c8da8174e,28,0x4200000000000000000000000000000000000006,0.003720470707,0xd9aaec86b65d86f6a7b5b1b0c42ffa531710b6ca,6.343995 -base,pancakeswap,3,2023-08-31,0xea7b7bd6c573297654b851fe15360dcd00adb93fdfbff8a9a92335321afe9abf,4,0x4200000000000000000000000000000000000006,0.005807826327,0xd9aaec86b65d86f6a7b5b1b0c42ffa531710b6ca,9.580012 -base,pancakeswap,3,2023-09-01,0x6d95168e601891640fa88da905543ef7a462558b78ca18bf99db90eb1abc110f,26,0xd9aaec86b65d86f6a7b5b1b0c42ffa531710b6ca,0.41335,0x4200000000000000000000000000000000000006,0.0002522152926 -base,pancakeswap,3,2023-09-01,0x640b78e9b17af09de2fc40078be4b4f21b2972f88a9072d7efa409f12bfd5250,452,0xd9aaec86b65d86f6a7b5b1b0c42ffa531710b6ca,2.937885,0x4200000000000000000000000000000000000006,0.001785943443 -base,pancakeswap,3,2023-09-01,0xbc5078838d0be6b2f8622cf083f5d4c9730d4ee634c187ed0c0a6433d134a50e,21,0xd9aaec86b65d86f6a7b5b1b0c42ffa531710b6ca,10,0x4200000000000000000000000000000000000006,0.006102659752 -base,pancakeswap,2,2023-08-31,0x9a02a20dca2bf9e479728cedbaa40aba6cbff9a0bb39d74acbe697d8f448e0a1,7,0x4200000000000000000000000000000000000006,0.004908297163,0x8fbd0648971d56f1f2c35fa075ff5bc75fb0e39d,522.2112531 -base,pancakeswap,2,2023-08-31,0xc3dbd8776badacf03df41d3b465ec8ea39fe3eabd955d3a617f9f389a16dcceb,32,0x4200000000000000000000000000000000000006,0.002061983011,0x8fbd0648971d56f1f2c35fa075ff5bc75fb0e39d,236.8625742 -base,pancakeswap,2,2023-09-02,0xdc89e32ecf7ae2bec89917684fc4bfdd67810fd57a5233b08f99c72d82296613,11,0x4200000000000000000000000000000000000006,0.0009771073402,0xd9aaec86b65d86f6a7b5b1b0c42ffa531710b6ca,1.547626 -base,pancakeswap,2,2023-09-03,0x242eae02b5a66da57e2c3262ef4bac617cfb32b4a040b22bb2cdc516df520de6,5,0x4200000000000000000000000000000000000006,0.0005003577617,0xd9aaec86b65d86f6a7b5b1b0c42ffa531710b6ca,0.818416 -base,pancakeswap,2,2023-09-03,0x4bcf24191cfadc78f8d99c300c82fe203814e136cf0c3a628a889c3c0dfcd0b4,4,0x4200000000000000000000000000000000000006,0.0004002484217,0xd9aaec86b65d86f6a7b5b1b0c42ffa531710b6ca,0.653942 -celo,mento,1,2023-07-17,0x5da85d08a4baa9c78510bad37fc0cf9ef2045db2aa46e988a0dd82bb8212b2f4,100,0xd8763cba276a3738e6de85b4b3bf5fded6d6ca73,20.956079931951415,0x471ece3750da237f93b8e339c536989b8978a438,40.605169743968546 -celo,mento,1,2023-07-12,0x3e4cdec526c199a166cf6cb20153c1497e8a644a0a41f1e697e895b9165548e8,20,0x471ece3750da237f93b8e339c536989b8978a438,800.0054,0x765de816845861e75a25fca122bb6898b8b1282a,395.59555761415027 -celo,mento,1,2023-07-09,0x2dd4a8ded11dc1c72ecc777ad46dac15c0d43d8a39c9ba3f27ce14e4484ed79e,9,0x765de816845861e75a25fca122bb6898b8b1282a,96.17799572228877,0x471ece3750da237f93b8e339c536989b8978a438,187.82965109563872 -celo,mento,1,2023-07-13,0x2f7be9a913a12c73eb45713140e4d3952153e90d3e81c26fbdd29726e164fee8,26,0x471ece3750da237f93b8e339c536989b8978a438,6.975571396935835,0x765de816845861e75a25fca122bb6898b8b1282a,3.3358208614857126 -celo,mento,1,2023-07-22,0xa1e3eb8c0b08d483915ddcb2921593cdf8e1a1eaf8ec2679bc5fe9fcbf179e6a,4,0xe8537a3d056da446677b9e9d6c5db704eaab4787,607.0101626243413,0x471ece3750da237f93b8e339c536989b8978a438,256 -celo,mento,2,2023-06-21,0xb91f34e839f46eb834105bab4b66eabe0bf47dd155fc30160da75a452a32d096,83,0x765de816845861e75a25fca122bb6898b8b1282a,445.2967749304183,0x471ece3750da237f93b8e339c536989b8978a438,1030 -celo,mento,2,2023-06-30,0xfd0f315871c06f18b2c6b0debc2a518d199aafae7b83d25567fd68e6dae811e7,106,0x471ece3750da237f93b8e339c536989b8978a438,100.38789463130256,0xe8537a3d056da446677b9e9d6c5db704eaab4787,210.92554896017592 -celo,mento,2,2023-06-21,0x534776eb975e06ff6d31674d397851105049c5dd35962a8f50b505ad45a9bede,133,0xeb466342c4d449bc9f53a865d5cb90586f405215,490.058081,0x765de816845861e75a25fca122bb6898b8b1282a,490.15611234048663 -celo,mento,2,2023-06-10,0x2ca1f551c2d7444069a391bcba4b203d675e68d09db37bbbee90350e55c4c34b,66,0xd8763cba276a3738e6de85b4b3bf5fded6d6ca73,291.95751633951255,0x471ece3750da237f93b8e339c536989b8978a438,788.89 -celo,mento,2,2023-06-22,0x5e7703f4b32df24f6c5c3539028e09f37bdbd174b00d6da565ecc1c54ba4f39d,58,0x471ece3750da237f93b8e339c536989b8978a438,189.2299185313668,0xd8763cba276a3738e6de85b4b3bf5fded6d6ca73,76.73486063607002 -base,dodo,2_dpp,2023-08-24,0x8d284b3f21f9fae6bfffa14d0396c735b986accea585fe845d8e34b1e130d349,30,0xd9aaec86b65d86f6a7b5b1b0c42ffa531710b6ca,0.08111752951130441,0x4200000000000000000000000000000000000006,135.73585 -celo,ubeswap,1,2023-09-21,0xe1d99a46df999d4097da812472101e3fb6b91ddc38cc02abfcbf87307d705f69,46,0xa8d0e6799ff3fd19c6459bf02689ae09c4d78ba7,4.139726896e-09,0x471ece3750da237f93b8e339c536989b8978a438,1e-08 -celo,ubeswap,1,2023-09-21,0xe1d99a46df999d4097da812472101e3fb6b91ddc38cc02abfcbf87307d705f69,85,0x471ece3750da237f93b8e339c536989b8978a438,0.011131926416824384,0xe273ad7ee11dcfaa87383ad5977ee1504ac07568,0.004629938972936026 -celo,ubeswap,1,2023-09-21,0xe1d99a46df999d4097da812472101e3fb6b91ddc38cc02abfcbf87307d705f69,57,0x64defa3544c695db8c535d289d843a189aa26b98,0.001859808034948372,0x64defa3544c695db8c535d289d843a189aa26b98,0.00031599070221135 -celo,ubeswap,1,2023-09-21,0xe1d99a46df999d4097da812472101e3fb6b91ddc38cc02abfcbf87307d705f69,65,0x98587fa3fe8ae28ace515281c1fec1e992a7f214,0.002284075177457273,0x64defa3544c695db8c535d289d843a189aa26b98,0.001859901297288047 -celo,ubeswap,1,2023-09-21,0xe1d99a46df999d4097da812472101e3fb6b91ddc38cc02abfcbf87307d705f69,79,0xe273ad7ee11dcfaa87383ad5977ee1504ac07568,0.00342165606916204,0x918146359264c492bd6934071c6bd31c854edbc3,0.003661695659348901 -celo,ubeswap,1,2023-09-21,0xe1d99a46df999d4097da812472101e3fb6b91ddc38cc02abfcbf87307d705f69,71,0x918146359264c492bd6934071c6bd31c854edbc3,0.001781202060105895,0x918146359264c492bd6934071c6bd31c854edbc3,2.2958504411753e-05 -optimism,opx_finance,1,2023-09-14,0x2fc2351426e105434af65e0e2f1faa992c7285748e5938133bf03f99aa64a4d0,9,0x7f5c764cbc14f9669b88837ca1490cca17c31607,385.924225,0x4200000000000000000000000000000000000006,0.239356245490566881 -optimism,opx_finance,1,2022-11-04,0x66e3aba1a244fe17e3ff45be045c1318a8957e150e811bc19ecfad0f203b6de0,11,0x7f5c764cbc14f9669b88837ca1490cca17c31607,10.936762,0x4200000000000000000000000000000000000006,0.0068 -optimism,opx_finance,1,2023-02-03,0x6c81ff042560bb6583a1646ff37ad07cd4e96594381235c50d836966a544d354,8,0x7f5c764cbc14f9669b88837ca1490cca17c31607,14.070861,0x4200000000000000000000000000000000000042,5 -celo,sushiswap,1,2023-09-15,0x1c030237cdd13c3fefabd7e95cc51cc5ba77e003127615fd92ec5ae852c51ef8,29,0x122013fd7df1c6f636a5bb8f03108e876548b455,0.009567356764263468,0x471ece3750da237f93b8e339c536989b8978a438,35.37827374653412 -celo,sushiswap,1,2023-09-15,0xd932e433b0f672f29af0490b5304361095ea3ce2096f824c495dfae5bf72e026,21,0x122013fd7df1c6f636a5bb8f03108e876548b455,0.008584151286614612,0x471ece3750da237f93b8e339c536989b8978a438,31.755965948104855 -celo,sushiswap,1,2023-09-15,0x157447e41e81e05ba65c69caac7d56200f371a977ee5c841dfeec683317b98fb,38,0x122013fd7df1c6f636a5bb8f03108e876548b455,0.015146900389257045,0x765de816845861e75a25fca122bb6898b8b1282a,23.8728179530718 -celo,sushiswap,1,2023-09-15,0x76c03c7f772668dd72fb1143ba4ad89cb144da742e651f4cbbc8245388e0f539,21,0x122013fd7df1c6f636a5bb8f03108e876548b455,0.03129519531871116,0x471ece3750da237f93b8e339c536989b8978a438,114.90811086228412 -celo,sushiswap,1,2023-09-15,0x1c030237cdd13c3fefabd7e95cc51cc5ba77e003127615fd92ec5ae852c51ef8,23,0x765de816845861e75a25fca122bb6898b8b1282a,15.255434965463113,0x122013fd7df1c6f636a5bb8f03108e876548b455,0.009567356764263468 -celo,sushiswap,1,2023-09-15,0x76c03c7f772668dd72fb1143ba4ad89cb144da742e651f4cbbc8245388e0f539,26,0x765de816845861e75a25fca122bb6898b8b1282a,49.42283255941517,0x122013fd7df1c6f636a5bb8f03108e876548b455,0.031295195318706094 -arbitrum,trader_joe,2.1,2023-09-27,0xa0c3a8baeb889f57962e1f90f02878c52bc2703923ea44d6c32b54ac85a182fa,4,0xfd086bc7cd5c481dcc9c85ebe478a1c0b69fcbb9,1000.850315,0xaf88d065e77c8cc2239327c5edb3a432268e5831,999.9975 -arbitrum,trader_joe,2,2023-02-25,0x0089a8b75a142474502974fa9a69d69bf007d7fcd760df9e78e1e38cdc63a8bd,1,0x82af49447d8a07e3bd95bd0d56f35241523fbab1,0.119172119245068251,0x371c7ec6d8039ff7933a2aa28eb827ffe1f52f07,748.500000000000004917 -ethereum,mauve,1,2023-09-14,0x9287ef89d064846c961ae2102b32cf1327bc5b26bde1ae0f9c884f6dec6b73e9,485,0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2,0.05361889288401018,0xbe9895146f7af43049ca1c1ae358b0541ea49704,0.05 -ethereum,mauve,1,2023-09-13,0x7f71f44e295edd95a55425e96e8a05e5059908f2cabbe53497b7657037ac6c31,102,0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48,15,0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2,0.007446710798914315 -ethereum,mauve,1,2023-09-14,0xcc62f06a8c9b4351ebb510d178fc68fe946bba1cd05244db92de76fd62a824b7,200,0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48,16.83761,0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2,0.01 -ethereum,mauve,1,2023-09-14,0x94993dbf07f4ef0bf38a15a303182a3dbd0ef4525f09c4be0f2babbb5be2e2aa,236,0x1abaea1f7c830bd89acc67ec4af516284b1bc33c,1758.083836,0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48,1850 -optimism,openxswap,1,2023-02-24,0xaed44713142d008b7771dbd844dc04996fdf84d2a759b18000fbbd1cedda9ee2,7,0x3c8b650257cfb5f272f799f5e2b4e65093a11a05,2234.6467852361957,0x4200000000000000000000000000000000000006,0.30264897056 -optimism,openxswap,1,2023-02-24,0x2ab499560940eec712e662231d9a0dc39199c592ee4f651cfc5fe26ae60ded20,13,0x4200000000000000000000000000000000000006,1.0286444738988605,0x4200000000000000000000000000000000000042,544.7762488522358 -optimism,openxswap,1,2023-04-15,0x4083325e7db95f35ef9e425ee7cf550ca7504af92355f214af8071d70659a9df,8,0x4200000000000000000000000000000000000006,0.004769354772713511,0x7f5c764cbc14f9669b88837ca1490cca17c31607,9.994 -arbitrum,camelot,3,2023-10-15,0x939231c21d47605a86fce8536da3cfb556a7ca4334e3f1963a23006633597f03,6,0x2ac2b254bc18cd4999f64773a966e4f4869c34ee,,0x82af49447d8a07e3bd95bd0d56f35241523fbab1,0.01 -arbitrum,camelot,3,2023-10-15,0xe12624f375d78828270cf0b84757b6c1e3fd2a8efddb3c25cac301fe5bfb71ae,6,0x2ac2b254bc18cd4999f64773a966e4f4869c34ee,,0x82af49447d8a07e3bd95bd0d56f35241523fbab1,0.168 -arbitrum,camelot,3,2023-10-15,0x810b6259d2171ca029a3ddb86dfbf682a9306443424082198afe63050fc699a9,6,0x82af49447d8a07e3bd95bd0d56f35241523fbab1,0.02553995037289231,0x2ac2b254bc18cd4999f64773a966e4f4869c34ee, -optimism,wardenswap,2,2022-09-21,0x2c44ca40b62d3154a01796de00696cba3a3247ab5124ddd263165cf4b470fc4c,43,0x8c6f28f2f1a3c87f0f938b96d27520d9751ec8d9,529.0905775854186,0x4200000000000000000000000000000000000006,0.4280560649800964 -optimism,wardenswap,2,2022-07-27,0xd025c68690340c035e9b9b5e3d53435c2f301a3f9e6a7bdceb7cb9a82bf28174,20,0xda10009cbd5d07dd0cecc66161fc93d7c9000da1,16.093947010513283,0x3c8b650257cfb5f272f799f5e2b4e65093a11a05,270 -optimism,wardenswap,2,2022-06-26,0x2084856c984f51a9a9bd377bfbc6ce78be410cc8c9b2836282b83b1dc2b2d677,16,0x7f5c764cbc14f9669b88837ca1490cca17c31607,1393.326394,0x94b008aa00579c1307b0ef2c499ad98a8ce58e58,1397.048637 -optimism,openocean,2,2023-09-04,0x1c2bc7857ce9acd8d6b018eea4b2e2affbda61e56916161b4348ef0603ff7935,23,0x350a791bfc2c21f9ed5d10980dad2e2638ffa7f6,82.11154686585886,0x7f5c764cbc14f9669b88837ca1490cca17c31607,500.376315 -optimism,openocean,2,2023-06-30,0x4a823ca5c73264723a1326c9d3dedd0f1b2bbbc446e7f2c71ac5c998234b8ca2,9,0x1db2466d9f5e10d7090e7152b68d62703a2245f0,14.714535262567255,0x7f5c764cbc14f9669b88837ca1490cca17c31607,2 -optimism,openocean,2,2022-08-03,0x13875f629d4c608d034411333bf0f0095fb6ac41c219163ed8d359805a63fa05,25,0x94b008aa00579c1307b0ef2c499ad98a8ce58e58,11.319842,0x8c6f28f2f1a3c87f0f938b96d27520d9751ec8d9,11.265711412351504 -celo,curve,1,2023-10-17,0x4cef035b424859b5d61b1da3c2f03febd83f03083c764fa1af860bf4e26d28b3,16,0x37f750b7cc259a2f741af45294f6a16572cf5cad,118810.850166,0x765de816845861e75a25fca122bb6898b8b1282a,118999.79999999999 -celo,curve,1,2023-10-15,0x0a524624a533492b91c1204004589225f697d37bf63af60fde884b226e8b1f26,14,0x37f750b7cc259a2f741af45294f6a16572cf5cad,10.329967,0x765de816845861e75a25fca122bb6898b8b1282a,10.34099704814135 -celo,curve,1,2023-10-16,0xba430c475c9ee7e8bd17c760f6a7833b0779781092033de73ca1bf3f7e86e7f8,43,0x37f750b7cc259a2f741af45294f6a16572cf5cad,5.189966,0x765de816845861e75a25fca122bb6898b8b1282a,5.197918504908161 -celo,curve,1,2023-10-15,0x28500eb8fe60219ee750bbea028e4ace3259aae1f350727c97311be3ac579dd4,13,0x37f750b7cc259a2f741af45294f6a16572cf5cad,432.240793,0x765de816845861e75a25fca122bb6898b8b1282a,432.6936029057536 -optimism,openocean,2,2023-05-30,0xc97e676905d6d2763fa55ac9aac6d6d85f6597901cf34711d6b65981b0cb0f75,7,0x7f5c764cbc14f9669b88837ca1490cca17c31607,3.193448,0x4200000000000000000000000000000000000006,0.00167453389173889 -optimism,openocean,2,2023-11-07,0xde2d7e6f02cfce8eb8a1bb752ce956cfcf81b7bf8380490bcdfeab9694b4e5ad,15,0x8700daec35af8ff88c16bdf0418774cb3d7599b4,2.9738578135579843,0x4200000000000000000000000000000000000006,0.003958725899153863 -optimism,openocean,2,2023-07-31,0x92188637370c0bf3595ae4bef248db90f43167483320fc9b21adb016cfb84e76,81,0x8b21e9b7daf2c4325bf3d18c1beb79a347fe902a,1438.894027919516,0x4200000000000000000000000000000000000042,14.86875 -base,maverick,1,2023-10-24,0xf76389f7730beb6a51a3e1881b0a9139fe8ec07d8403061fd52d5aaf1357ad00,12,0x50c5725949a6f0c72e6c4a641f24049a917db0cb,2955.014794642196128309,0xd9aaec86b65d86f6a7b5b1b0c42ffa531710b6ca,2954.059434 -optimism,woofi,1,2023-06-21,0x2e968976942bbbd2a843a1b3d2b8c344f4f0b705d6e8d1d3742078b6fab28b10,38,0x7f5c764cbc14f9669b88837ca1490cca17c31607,1.628553,0x4200000000000000000000000000000000000006,0.0009 -optimism,woofi,1,2023-07-30,0x58b21db3dc2a145b8c844471310eebdc85fdf3ec8820d4a6ea526bc1f735aec0,15,0x7f5c764cbc14f9669b88837ca1490cca17c31607,0.102243,0x4200000000000000000000000000000000000042,0.06525080616397874 -optimism,woofi,1,2023-06-07,0x203dbe62e1896dc9892dae69e7c4dbdc7c491d775923fb44a094c45b916a9946,12,0x4200000000000000000000000000000000000042,8.853725019194362,0x7f5c764cbc14f9669b88837ca1490cca17c31607,13.180901 -zksync,maverick,1,2023-10-23,0xbe2700aac1174728513863a4f42d37aa9ac7a7d73389fa00a5abcfbd3570d5a6,4,0x2039bb4116B4EFc145Ec4f0e2eA75012D6C0f181,1.723727835619188444,0x3355df6D4c9C3035724Fd0e3914dE96A5a83aaf4,1.7232 -arbitrum,1inch LOP,1,2021-09-24,0xfaebdcb7948f7141d05709373681b0e04c0672051b072db49268066c5ed146b6,1,0x82af49447d8a07e3bd95bd0d56f35241523fbab1,0.0001,0xfd086bc7cd5c481dcc9c85ebe478a1c0b69fcbb9,0.308879 -arbitrum,1inch LOP,2,2021-12-10,0x1c7b1db733029cdfefa5d33372061dcf392e6ddd668774306f7e80c6057d9631,1,0x0e15258734300290a651fdbae8deb039a8e7a2fa,1,0xfd086bc7cd5c481dcc9c85ebe478a1c0b69fcbb9,0.63023 -arbitrum,1inch LOP,3,2022-11-25,0x5c8b58d7b37384216431a6fd41f424f1a750b4cb28c0a891d313454590cb1046,1,0xbfa641051ba0a0ad1b0acf549a89536a0d76472e,1,0xfd086bc7cd5c481dcc9c85ebe478a1c0b69fcbb9,1 -arbitrum,1inch LOP,3 RFQ,2023-04-26,0x51b8f0aeaa4944927bf2c1c4c8c379fcfb7e7a3cdcd5389a424d8cecdb1a9b4e,1,0x82af49447d8a07e3bd95bd0d56f35241523fbab1,0.005639386973373932,0xfd086bc7cd5c481dcc9c85ebe478a1c0b69fcbb9,10.995641 -avalanche_c,1inch LOP,2,2022-01-18,0x17648dc902706d6d6e169087fdd0d5d9ed9c0a13a568ec8a48051f0b1ba5c908,1,0xa7d7079b0fead91f3e65f86e8915cb59c1a4c664,5,0xc7198437980c041c805a1edcba50c1ce5db95118,4.992058 -avalanche_c,1inch LOP,2 RFQ,2022-01-24,0xb2b5c36e970b5b7bcdc90cfe4f62200c2f3f30cbdbfc05dbaea5d1539ad6280c,1,0x49d5c2bdffac6ce2bfdb6640f4f80f226bc10bab,0.02,0xa7d7079b0fead91f3e65f86e8915cb59c1a4c664,47.776 -avalanche_c,1inch LOP,3,2022-11-30,0x7f208a0a570fb7276214dc4db47080a2aa90447fc7e5113ee3bda6cf694f7b0f,1,0xb31f66aa3c1e785363f0875a1b74e27b85fd66c7,7.724e-05,0xc7198437980c041c805a1edcba50c1ce5db95118,0.001 -base,1inch LOP,3,2023-08-16,0x30231210e1afdc76c1cddd2576a52aa1ea98457297e62c902a7a5aa5bd7e9791,1,0x4200000000000000000000000000000000000006,0.001,0xeb466342c4d449bc9f53a865d5cb90586f405215,1.823264 -bnb,1inch LOP,1,2021-06-03,0x660036450cb8728a2ac5f2deb22bff8758af26aa099d4d0dbbae609093f47795,1,0x111111111117dc0aa78b770fa6a738034120c302,0.01,0xbb4cdb9cbd36b01bd1cbaebf2de08d9173bc095c,8.240829737963e-05 -bnb,1inch LOP,1 RFQ,2021-06-07,0x0205753c08d2642e2a12525ac0949d078a99e02ee87e559456245be24dc6803a,1,0x1af3f329e8be154074d8769d1ffa4ee058b1dbc3,3.8,0x111111111117dc0aa78b770fa6a738034120c302,1 -bnb,1inch LOP,2,2021-12-06,0x9d7783360204258b9f2307f4ce4970f8de2a6d67db9b0b6215b9a0dcc39d0eff,1,0x1af3f329e8be154074d8769d1ffa4ee058b1dbc3,2.1,0x111111111117dc0aa78b770fa6a738034120c302,0.5 -bnb,1inch LOP,2 RFQ,2021-11-10,0x582066cd36fe1535334a05de5203025a0abadb6d2fb07542dba06d79b9fcb121,1,0x55d398326f99059ff775485246999027b3197955,2e-14,0xe9e7cea3dedca5984780bafc599bd69add087d56,1e-14 -bnb,1inch LOP,3,2022-11-21,0x76952e9657a210fa51de9d0caf38cb66a4e594b8963790e9e282321b0608d560,1,0xe9e7cea3dedca5984780bafc599bd69add087d56,1,0x8ac76a51cc950d9822d68b83fe1ad97b32cd580d,1 -bnb,1inch LOP,3 RFQ,2023-04-26,0x25086a72ce6a3cf12f836808a97c05432dae39fe74947fa2b9d0129bb47cceea,1,0xe9e7cea3dedca5984780bafc599bd69add087d56,188.91263865081478,0x2170ed0880ac9a755fd29b2688956bd959f933f8,0.09669320051055542 -ethereum,1inch LOP,1,2021-06-08,0x7430839c7a467a4946b2723bdb8d54d4bfeb72a54fbee988a184fc6ccee0c8fe,1,0xdac17f958d2ee523a2206206994597c13d831ec7,15,0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2,0.005705137173652603 -ethereum,1inch LOP,1 RFQ,2021-06-24,0x17eedf52cd16e9a2a6cf7dcd0ea60f07b25d9b972564542b702cd86301270bc4,1,0x6b175474e89094c44da98b954eedeac495271d0f,1.23e-16,0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2,1.23e-16 -ethereum,1inch LOP,2,2021-12-09,0x72e2bd374bad0f3ba7844edb0ddabcd3bf2b0b04c082e9eafc2e1e705d6d111a,1,0x111111111117dc0aa78b770fa6a738034120c302,1,0x888888435fde8e7d4c54cab67f206e4199454c60,1.8550742510066875 -ethereum,1inch LOP,2 RFQ,2021-11-12,0x3069e869f54a593d282f6d72e78c16638555bbb460ce09376f3b969a49740eb9,1,0xdac17f958d2ee523a2206206994597c13d831ec7,100,0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2,0.0217122261545476 -ethereum,1inch LOP,3,2022-11-15,0xd6f31e37e9a2bdf79f9e08a3a1aff7aa27b6f33fad8e34506930058f944944eb,1,0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2,0.000794199483325101,0x6b175474e89094c44da98b954eedeac495271d0f,1 -ethereum,1inch LOP,3 RFQ,2022-11-28,0x6daff653b30efeda718d49eb9b6e30b42298603dba0722bbb035f797ef8420bc,1,0x4d224452801aced8b2f0aebe155379bb5d594381,919.1542838365331,0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48,3799.290434 -fantom,1inch LOP,2 RFQ,2022-04-12,0x23a0a583070aedd2ab9a8dd8984b431751469932d6423cedada0a550b25a266f,1,0x049d68029688eabf473097a2fc38ef61633a3c7a,20,0x21be370d5312f44cb42ce377bc9b8a0cef1a4c83,16.89972442886853 -fantom,1inch LOP,3,2022-11-20,0x60219b7e2fea63be636203aa8feaeaae96edd76514aebe8042cd23204ac522e7,1,0x04068da6c83afcfa0e13ba15a6696662335d5b75,0.999842,0x8d11ec38a3eb5e956b052f67da8bdc9bef8abf3e,1 -gnosis,1inch LOP,2,2022-01-17,0xb0bfe04bdc2a2492173d561b19bbba1ccb0fda47050e6c3b25244e133e1e6977,1,0x4ecaba5870353805a9f068101a40e0f32ed605c6,2,0xe91d153e0b41518a2ce8dd3d7944fa863463a97d,1.9896530579786145 -gnosis,1inch LOP,3,2022-11-25,0xd94d1559f1c5bf2647da93659003d2dfab158ead080b79837c5a28e9d9160c7b,1,0xe91d153e0b41518a2ce8dd3d7944fa863463a97d,2,0x4ecaba5870353805a9f068101a40e0f32ed605c6,2 -optimism,1inch LOP,2,2022-08-09,0xdb2a1b694452ef009cf8899ad6e8bae2b18c84fc75e293a9508a5633bda26f79,1,0x8c6f28f2f1a3c87f0f938b96d27520d9751ec8d9,1,0xfe8b128ba8c78aabc59d4c64cee7ff28e9379921,1.3430288208555679 -optimism,1inch LOP,3,2022-11-25,0x7a40bb7f50e59c5e673afe94e8733494243acd0877d227a809aa9ba1c16ba33d,1,0x94b008aa00579c1307b0ef2c499ad98a8ce58e58,1,0xc5102fe9359fd9a28f877a67e36b0f050d81a3cc,12 -polygon,1inch LOP,1,2021-06-10,0x4ec29b58b188d26022191edd51af35f155b9edec5e79303fd78b3aef0400e8bb,1,0x8f3cf7ad23cd3cadbd9735aff958023239c6a063,8,0x0d500b1d8e8ef31e21c99d1db9a6444d3adf1270,2.6666666666666665 -polygon,1inch LOP,1 RFQ,2021-06-21,0x30e49b6e23145b5904bc1cd776a65ad2309e61e95c00c0b452cbf578e957b2aa,1,0xc2132d05d31c914a87c6611c10748aeb04b58e8f,20,0x7ceb23fd6bc0add59e62ac25578270cff1b9f619,0.010257304255126252 -polygon,1inch LOP,2,2021-12-16,0x9f883ed622c357df0756ea6552c525b1fef3ccdd785772a0a27acb3e83b147a9,1,0x8f3cf7ad23cd3cadbd9735aff958023239c6a063,0.612715402673482,0x2791bca1f2de4661ed88a30c99a7a9449aa84174,0.61342 -polygon,1inch LOP,2 RFQ,2022-04-08,0x7f4d4290f3b5fd42d8c148457aa0c5b0ae5ad6a52f538eb7d1f611a6551224a1,1,0x0d500b1d8e8ef31e21c99d1db9a6444d3adf1270,15,0x2791bca1f2de4661ed88a30c99a7a9449aa84174,22.0248 -polygon,1inch LOP,3,2022-11-16,0x4367e740ccdaf64bb9300d64ce071c691ecc305c2f1ac5aff3f7ba3fe19f82c8,1,0x7ceb23fd6bc0add59e62ac25578270cff1b9f619,0.0747847780830808,0x0d500b1d8e8ef31e21c99d1db9a6444d3adf1270,100 -polygon,1inch LOP,3 RFQ,2022-11-24,0x5fc98b8f538e6258f554039c182aa9094b2d3f83293812ad86a8ec8ffe122092,1,0x2791bca1f2de4661ed88a30c99a7a9449aa84174,0.02,0xc2132d05d31c914a87c6611c10748aeb04b58e8f,0.01 -zksync,1inch LOP,3,2023-04-25,0xce890512f93dd7d2f1576214025a384a7e4d77d0696f7586b08aa7f2abbb3666,1,0x85d84c774cf8e9ff85342684b0e795df72a24908,473.99490916145186,0x5aea5775959fbc2557cc8789bc1bf90a239d9a91,0.021538506874320695 -zksync,1inch LOP,3 RFQ,2023-05-02,0x96a6f0a3b6dca895ae56ad55b14366f9ec0993409754caad26c0921598beebf8,1,0x3355df6d4c9c3035724fd0e3914de96a5a83aaf4,42.322852,0x5aea5775959fbc2557cc8789bc1bf90a239d9a91,0.023143049624060132 -avalanche_c,uniswap,3,2023-11-11,0x3fd0df30055592268a66399a4d958ae6aaa957cab7442c0ecc60d7257a156261,7,0xb97ef9ef8734c71904d8002f8b6bc66dd9c48a6e,497.409883,0xb31f66aa3c1e785363f0875a1b74e27b85fd66c7,34.17977416 -avalanche_c,uniswap,3,2023-11-11,0x31e1a422f13f742ba7ad4c5b2b33bf2cc6c05777cfff4062f8e9667dc0eab524,14,0xb31f66aa3c1e785363f0875a1b74e27b85fd66c7,95.79678643,0xb97ef9ef8734c71904d8002f8b6bc66dd9c48a6e,1379.142478 -avalanche_c,uniswap,3,2023-11-11,0x79cc2e2b8543ae7b5215f9f389069106061efc619fa23437b5662d81fac2d8dc,2,0xb97ef9ef8734c71904d8002f8b6bc66dd9c48a6e,661.400762,0xb31f66aa3c1e785363f0875a1b74e27b85fd66c7,46 -avalanche_c,uniswap,3,2023-11-11,0x31e1a422f13f742ba7ad4c5b2b33bf2cc6c05777cfff4062f8e9667dc0eab524,16,0x49d5c2bdffac6ce2bfdb6640f4f80f226bc10bab,0.6729956329,0xb31f66aa3c1e785363f0875a1b74e27b85fd66c7,95.79678643 -avalanche_c,uniswap,3,2023-11-11,0x41b6ec0e3ba96f6c72bab7954353152ba44904bd61232f91e824c9a74495b1e4,2,0x9702230a8ea53601f5cd2dc00fdbc13d4df4a8c7,600.415091,0xb31f66aa3c1e785363f0875a1b74e27b85fd66c7,41.78982883 -optimism,mummy_finance,1,2023-06-20,0xcb520a60a0eae0a5a7b9e5658345151a370ef9c236072db32d9b3212ee24a496,36,0x4200000000000000000000000000000000000042,793.6112352289659,0x7f5c764cbc14f9669b88837ca1490cca17c31607,1048.751532 -optimism,mummy_finance,1,2023-06-30,0x671265ebe5dd61134633adf575ba80faec6be090271351ad79fed7c0f5468d50,65,0x4200000000000000000000000000000000000006,0.37616451992981625,0x4200000000000000000000000000000000000042,525.2047826760436 -optimism,mummy_finance,1,2023-06-09,0xd7cadb14f39a79bf0ca3ea0ebf9aa85caa1465da154010294ee502942a8de5d4,21,0x4200000000000000000000000000000000000006,1.530834771081591,0x4200000000000000000000000000000000000042,2097.160814236567 -optimism,hashflow,1,2023-04-13,0x0c2c4ed714220d38b0f93b13398e7bd7454120a07a1188095a740afc055e85dd,5,0xda10009cbd5d07dd0cecc66161fc93d7c9000da1,1.0942802244,0x7f5c764cbc14f9669b88837ca1490cca17c31607,1.0945 -optimism,hashflow,1,2023-07-26,0xc5237e5f00c0f8059bf9d21edca6f541fdd3e11331e0204aa3792be7d71742f8,54,0x4200000000000000000000000000000000000006,0.22758095181286583,0x94b008aa00579c1307b0ef2c499ad98a8ce58e58,425.593457 -optimism,hashflow,1,2022-10-26,0xa4cc224376e71b43c83a9913f466986d2b51f0b0bd5e6102d2e93ade474991d8,1,0x7f5c764cbc14f9669b88837ca1490cca17c31607,0.999996,0x94b008aa00579c1307b0ef2c499ad98a8ce58e58,1 -avalanche_c,trader_joe,2.1,2023-08-17,0x3eccbee27f56c671eccd2ad82fca3b0448053d8d978a2003025817529b33c47a,5,0xc7198437980c041c805a1edcba50c1ce5db95118,154.777492,0x9702230a8ea53601f5cd2dc00fdbc13d4df4a8c7,154.714055 -avalanche_c,trader_joe,2.1,2023-08-17,0xd74525e25428aa4d32f129511ed8349516aeff791691277551663ad944fafeed,2,0xb31f66aa3c1e785363f0875a1b74e27b85fd66c7,100.00000003864702,0xb97ef9ef8734c71904d8002f8b6bc66dd9c48a6e,1120.132837 -avalanche_c,trader_joe,2.1,2023-08-17,0xbacddb47282c250d7126995a0a32a77e2be8c98e69b85c7dd3ef9cdb295b5084,8,0xb31f66aa3c1e785363f0875a1b74e27b85fd66c7,8.961454748219834,0xb97ef9ef8734c71904d8002f8b6bc66dd9c48a6e,99.979979 -avalanche_c,trader_joe,2.1,2023-08-17,0x29946138727b0557036d93d5b4c81f95175e711ce8ab443d2f6b1b1c8c92786e,14,0x9702230a8ea53601f5cd2dc00fdbc13d4df4a8c7,7427.555309,0xb31f66aa3c1e785363f0875a1b74e27b85fd66c7,672.1804038165711 -avalanche_c,trader_joe,2.1,2023-08-17,0x29946138727b0557036d93d5b4c81f95175e711ce8ab443d2f6b1b1c8c92786e,13,0x9702230a8ea53601f5cd2dc00fdbc13d4df4a8c7,0.847235,0xb31f66aa3c1e785363f0875a1b74e27b85fd66c7,0.07651931900157347 diff --git a/sources/_subprojects/dex/_sources.yml b/sources/_subprojects/dex/_sources.yml new file mode 100644 index 00000000000..270dc948654 --- /dev/null +++ b/sources/_subprojects/dex/_sources.yml @@ -0,0 +1,67 @@ +version: 2 + +sources: + - name: dex + description: "output models of the DEX sector (dbt subproject)" + tables: + - name: trades + - name: prices + - name: prices_latest + - name: pools + - name: addresses + - name: atomic_arbitrages + - name: sandwiches + - name: sandwiched + - name: info + - name: dex_aggregator + tables: + - name: trades + - name: balancer_v2_optimism + tables: + - name: trades + - name: balancer_v2_arbitrum + tables: + - name: trades + - name: balancer_v2_avalanche_c + tables: + - name: trades + - name: balancer_v2_base + tables: + - name: trades + - name: balancer_v2_ethereum + tables: + - name: trades + - name: balancer_v2_gnosis + tables: + - name: trades + - name: balancer_v2_polygon + tables: + - name: trades + - name: balancer_v2_zkevm + tables: + - name: trades + - name: balancer + tables: + - name: trades + - name: labels + tables: + - name: balancer_v1_pools_ethereum + - name: labels_balancer_v1_pools + - name: balancer_v2_pools + - name: balancer_v2_pools_arbitrum + - name: balancer_v2_pools_avalanche_c + - name: balancer_v2_pools_base + - name: balancer_v2_pools_ethereum + - name: balancer_v2_pools_gnosis + - name: balancer_v2_pools_optimism + - name: balancer_v2_pools_polygon + - name: balancer_v2_pools_zkevm + - name: uniswap_v3_optimism + tables: + - name: ovm1_pool_mapping + - name: cow_protocol_ethereum + tables: + - name: trades + - name: cow_protocol_gnosis + tables: + - name: trades \ No newline at end of file diff --git a/sources/_subprojects/spellbook/_sources.yml b/sources/_subprojects/spellbook/_sources.yml index 62aee447931..3fa4c6f2bc2 100644 --- a/sources/_subprojects/spellbook/_sources.yml +++ b/sources/_subprojects/spellbook/_sources.yml @@ -44,15 +44,16 @@ sources: - name: bridge_optimism tables: - name: standard_bridge_flows - - name: uniswap_v3_optimism - tables: - - name: ovm1_pool_mapping - name: op_optimism tables: - name: airdrop_1_claims - name: cex_optimism tables: - name: addresses + - name: prices + tables: + - name: usd_forward_fill + - name: trusted_tokens - name: op_retropgf_optimism tables: - name: recipients @@ -61,10 +62,30 @@ sources: tables: - name: fee_vaults - name: grants_funding - - - name: prices + - name: balancer_v2_optimism tables: - - name: usd_forward_fill - - name: prices + - name: bpt_prices + - name: balancer_v2_arbitrum + tables: + - name: bpt_prices + - name: balancer_v2_avalanche_c + tables: + - name: bpt_prices + - name: balancer_v2_base + tables: + - name: bpt_prices + - name: balancer_v2_ethereum + tables: + - name: bpt_prices + - name: balancer_v2_gnosis + tables: + - name: bpt_prices + - name: balancer_v2_polygon + tables: + - name: bpt_prices + - name: balancer_v2_zkevm + tables: + - name: bpt_prices + - name: balancer tables: - - name: usd_latest + - name: bpt_prices diff --git a/tests/cow_protocol/ethereum/cow_protocol_ethereum_assert_batches.sql b/tests/cow_protocol/ethereum/cow_protocol_ethereum_assert_batches.sql deleted file mode 100644 index 068fa7eabff..00000000000 --- a/tests/cow_protocol/ethereum/cow_protocol_ethereum_assert_batches.sql +++ /dev/null @@ -1,16 +0,0 @@ --- Try it out here: https://dune.com/queries/1389623 -with batches_with_trades as ( - select - s.evt_tx_hash, - s.evt_block_time - from {{ source('gnosis_protocol_v2_ethereum','GPv2Settlement_evt_Trade') }} t - inner join {{ source('gnosis_protocol_v2_ethereum','GPv2Settlement_evt_Settlement') }} s - on s.evt_tx_hash = t.evt_tx_hash - group by s.evt_tx_hash, s.evt_block_time -) - -select evt_tx_hash from batches_with_trades -where evt_tx_hash not in (select tx_hash from {{ ref('cow_protocol_ethereum_batches' )}}) --- The reference table is only refreshed once in a while, --- so we impose a time constraint on this test. -and evt_block_time < date(now()) - interval '1' day diff --git a/tests/cow_protocol/ethereum/cow_protocol_ethereum_assert_order_type.sql b/tests/cow_protocol/ethereum/cow_protocol_ethereum_assert_order_type.sql deleted file mode 100644 index 2efb50fece3..00000000000 --- a/tests/cow_protocol/ethereum/cow_protocol_ethereum_assert_order_type.sql +++ /dev/null @@ -1,37 +0,0 @@ --- Given a list of solvers, when we look at the active solvers, then we should see only 1 per each env and name -WITH unit_test1 AS -( - SELECT - * - FROM - {{ ref('cow_protocol_ethereum_trades') }} - WHERE - order_uid = 0xc47c770fe431a2cd5fda46c84b0cdd2dbbdfb2f487e65dec444d07e7a92cffff64b07802fb794c8e7519589e85ebf67da10c9f0d640ada76 - and order_type != 'BUY' -), - - unit_test2 AS -( - SELECT - * - FROM - {{ ref('cow_protocol_ethereum_trades') }} - WHERE - order_uid = 0xb431b648f44c8c988c417044ecdbfecf9785e177be12f600de467989284842ef40a50cf069e992aa4536211b23f286ef88752187ffffffff - and order_type != 'SELL' -) - -SELECT - * -FROM - ( - SELECT - * - FROM - unit_test1 - UNION - SELECT - * - FROM - unit_test2 - ) \ No newline at end of file diff --git a/tests/cow_protocol/ethereum/cow_protocol_ethereum_assert_partial_fill.sql b/tests/cow_protocol/ethereum/cow_protocol_ethereum_assert_partial_fill.sql deleted file mode 100644 index 50c0740013f..00000000000 --- a/tests/cow_protocol/ethereum/cow_protocol_ethereum_assert_partial_fill.sql +++ /dev/null @@ -1,37 +0,0 @@ --- Given a list of trades, when we look at their partial_fill, based on the type of the trade we expect partial_fill to behave differently -WITH unit_test1 AS -( - SELECT - * - FROM - {{ ref('cow_protocol_ethereum_trades') }} - WHERE - order_uid = 0xaa1568c867c991bd462bcb6ee5939e4e01144d4e9e29bb74c2fa8d50b3afc92c519b70055af55a007110b4ff99b0ea33071c720a64289604 - and partial_fill != true -), - - unit_test2 AS -( - SELECT - * - FROM - {{ ref('cow_protocol_ethereum_trades') }} - WHERE - order_uid = 0xb431b648f44c8c988c417044ecdbfecf9785e177be12f600de467989284842ef40a50cf069e992aa4536211b23f286ef88752187ffffffff - and partial_fill != false -) - -SELECT - * -FROM - ( - SELECT - * - FROM - unit_test1 - UNION - SELECT - * - FROM - unit_test2 - ) \ No newline at end of file diff --git a/tests/cow_protocol/ethereum/cow_protocol_ethereum_assert_slippage.sql b/tests/cow_protocol/ethereum/cow_protocol_ethereum_assert_slippage.sql deleted file mode 100644 index 653eb598e92..00000000000 --- a/tests/cow_protocol/ethereum/cow_protocol_ethereum_assert_slippage.sql +++ /dev/null @@ -1,17 +0,0 @@ -WITH test_1 AS -( - SELECT * FROM {{ ref('cow_protocol_ethereum_trade_slippage') }} - WHERE order_uid = 0x514a80473dc24034a1983ec831603f2f100ad7defd1578b077c637f73f3b92ecffab14b181409170378471b13ff2bff5be012c646434b605 - AND block_number = 16975171 - AND ( - abs(amount_percentage) > 3.3 - OR - abs(amount_atoms) > 10471539 - OR - abs(amount_usd) > 10.5 - ) -) - -SELECT * FROM ( - SELECT * FROM test_1 -) \ No newline at end of file diff --git a/tests/cow_protocol/ethereum/cow_protocol_ethereum_assert_solvers.sql b/tests/cow_protocol/ethereum/cow_protocol_ethereum_assert_solvers.sql deleted file mode 100644 index 8f841595ad2..00000000000 --- a/tests/cow_protocol/ethereum/cow_protocol_ethereum_assert_solvers.sql +++ /dev/null @@ -1,21 +0,0 @@ --- Test Query: https://dune.com/queries/2718501 --- Given a list of solvers, when we look at the active solvers, then we should see only 1 per each env and name -WITH unit_test1 - AS (SELECT COUNT(address) as cnt - FROM {{ ref('cow_protocol_ethereum_solvers' )}} - WHERE active = true - AND environment != 'new' -- There are times when there can be multiple (new, uncatalogued) solvers. - GROUP BY environment, name - HAVING COUNT(address) > 1), --- Given a list of solvers, , then we should never see a solver who's both true and false for active - unit_test2 - AS (SELECT count(address) as cnt - FROM {{ ref('cow_protocol_ethereum_solvers' )}} - GROUP BY address, environment, name - HAVING COUNT(address) > 1) -SELECT * -FROM (SELECT * - FROM unit_test1 - UNION - SELECT * - FROM unit_test2) \ No newline at end of file diff --git a/tests/cow_protocol/ethereum/cow_protocol_ethereum_assert_trades.sql b/tests/cow_protocol/ethereum/cow_protocol_ethereum_assert_trades.sql deleted file mode 100644 index 46caec69133..00000000000 --- a/tests/cow_protocol/ethereum/cow_protocol_ethereum_assert_trades.sql +++ /dev/null @@ -1,5 +0,0 @@ --- Try it out here: https://dune.com/queries/1398185 -select evt_tx_hash -from {{ source('gnosis_protocol_v2_ethereum', 'GPv2Settlement_evt_Trade') }} -where evt_tx_hash not in (select tx_hash from {{ ref('cow_protocol_ethereum_batches')}}) -and evt_block_time < date(now()) - interval '1' day \ No newline at end of file diff --git a/tests/cow_protocol/gnosis/cow_protocol_gnosis_assert_solvers.sql b/tests/cow_protocol/gnosis/cow_protocol_gnosis_assert_solvers.sql deleted file mode 100644 index d1673869e20..00000000000 --- a/tests/cow_protocol/gnosis/cow_protocol_gnosis_assert_solvers.sql +++ /dev/null @@ -1,20 +0,0 @@ --- Given a list of solvers, when we look at the active solvers, then we should see only 1 per each env and name -WITH unit_test1 - AS (SELECT COUNT(address) as cnt - FROM {{ ref('cow_protocol_gnosis_solvers' )}} - WHERE active = true - AND environment != 'new' - GROUP BY environment, name - HAVING COUNT(address) > 1), --- Given a list of solvers, then we should never see a solver who's both true and false for active - unit_test2 - AS (SELECT count(address) as cnt - FROM {{ ref('cow_protocol_gnosis_solvers' )}} - GROUP BY address, environment, name - HAVING COUNT(address) > 1) -SELECT * -FROM (SELECT * - FROM unit_test1 - UNION - SELECT * - FROM unit_test2) \ No newline at end of file diff --git a/tests/generic/check_dex_seed.sql b/tests/generic/check_dex_seed.sql deleted file mode 100644 index 82e0ae65e5e..00000000000 --- a/tests/generic/check_dex_seed.sql +++ /dev/null @@ -1,12 +0,0 @@ --- this tests checks a dex trades model for every row in a seed file. --- actual implementation in macros/test-helpers/check_seed.sql -{% test check_dex_seed(model, blockchain=None, project=None, version=None) %} - - {%- set seed_file = ref('dex_trades_seed') -%} - {%- set seed_check_columns = ['token_bought_address','token_sold_address'] -%} - {%- set seed_matching_columns = ['block_date','blockchain','project','version','tx_hash','evt_index'] -%} - {%- set filter = {'blockchain':blockchain, 'project':project, 'version':version} -%} - - {{ check_seed_macro(model,seed_file,seed_matching_columns,seed_check_columns,filter) }} - -{% endtest %} diff --git a/tests/generic/dex_trades_token_bought.sql b/tests/generic/dex_trades_token_bought.sql deleted file mode 100644 index b2fc4ec8020..00000000000 --- a/tests/generic/dex_trades_token_bought.sql +++ /dev/null @@ -1,24 +0,0 @@ -{% test dex_trades_token_bought(model, column_name, dex_trades_seed) %} - - with unit_test as - ( - select - case - when lower(m.{{ column_name }}) = lower(seed.{{ column_name }}) - then True - else False - end as token_bought_test - from {{ model }} m - inner join {{ dex_trades_seed }} seed - on m.tx_hash = seed.tx_hash - and m.evt_index = seed.evt_index - and m.block_date = seed.block_date - and m.blockchain = seed.blockchain - and m.project = seed.project - and m.version = seed.version - ) - select * - from unit_test - where token_bought_test = False - -{% endtest %} From c18a11bdd0a70bd503de86ac27be43a07f546c6d Mon Sep 17 00:00:00 2001 From: Alan Ghobadi Date: Mon, 17 Jun 2024 13:10:15 +0200 Subject: [PATCH 125/149] Fix commit manifest ci (#6187) * Fix source issue * dummy commit to trigger CI --- .../chains/solana/platforms/magiceden_mmm_solana_trades.sql | 1 + sources/_subprojects/spellbook/_sources.yml | 1 + 2 files changed, 2 insertions(+) diff --git a/nft/models/_sector/trades/chains/solana/platforms/magiceden_mmm_solana_trades.sql b/nft/models/_sector/trades/chains/solana/platforms/magiceden_mmm_solana_trades.sql index de4fb53369b..4f568b796c7 100644 --- a/nft/models/_sector/trades/chains/solana/platforms/magiceden_mmm_solana_trades.sql +++ b/nft/models/_sector/trades/chains/solana/platforms/magiceden_mmm_solana_trades.sql @@ -524,3 +524,4 @@ select * from raw_nft_trades + diff --git a/sources/_subprojects/spellbook/_sources.yml b/sources/_subprojects/spellbook/_sources.yml index 3fa4c6f2bc2..e1dab41cd83 100644 --- a/sources/_subprojects/spellbook/_sources.yml +++ b/sources/_subprojects/spellbook/_sources.yml @@ -54,6 +54,7 @@ sources: tables: - name: usd_forward_fill - name: trusted_tokens + - name: usd_latest - name: op_retropgf_optimism tables: - name: recipients From 27832d9ab2f5e4e5ea3e86103f5f9cfc23c310dd Mon Sep 17 00:00:00 2001 From: 0xRob <83790096+0xRobin@users.noreply.github.com> Date: Tue, 18 Jun 2024 13:36:11 +0200 Subject: [PATCH 126/149] Make NFT models incremental (#6199) * make unperformant models incremental * fix compile * include opensea v1 * fix compile: * add incremental_predicates --- .../chains/nft_ethereum_aggregators_gem.sql | 19 +++++++++++++++--- .../nft_ethereum_aggregators_manual.sql | 1 - .../nft_ethereum_aggregators_markers.sql | 15 +++++++------- .../opensea_v1_ethereum_base_trades.sql | 20 +++++++++++++++---- 4 files changed, 40 insertions(+), 15 deletions(-) diff --git a/nft/models/_sector/aggregators/chains/nft_ethereum_aggregators_gem.sql b/nft/models/_sector/aggregators/chains/nft_ethereum_aggregators_gem.sql index d076eacc023..08795fbf172 100644 --- a/nft/models/_sector/aggregators/chains/nft_ethereum_aggregators_gem.sql +++ b/nft/models/_sector/aggregators/chains/nft_ethereum_aggregators_gem.sql @@ -1,14 +1,21 @@ {{config( - schema = 'nft_ethereum', - alias = 'aggregators_gem' -)}} + alias = 'aggregators_gem', + materialized = 'incremental', + file_format = 'delta', + incremental_strategy = 'merge', + unique_key='contract_address' + ) +}} WITH vasa_contracts as ( SELECT distinct address AS contract_address FROM {{ source('ethereum','creation_traces') }} WHERE "from" = 0x073ab1c0cad3677cde9bdb0cdeedc2085c029579 and block_time >= TIMESTAMP '2021-10-12' + {% if is_incremental() %} + AND {{incremental_predicate('block_time')}} + {% endif %} ) @@ -18,8 +25,14 @@ select from vasa_contracts c left join {{ source('ethereum','transactions') }} t on t.block_time >= CAST('2021-10-12' AS TIMESTAMP) and t.to = c.contract_address +{% if is_incremental() %} +AND {{incremental_predicate('t.block_time')}} +{% endif %} left join {{ ref('nft_ethereum_transfers') }} nt on t.block_number = nt.block_number and t.hash = nt.tx_hash +{% if is_incremental() %} +AND {{incremental_predicate('nt.block_time')}} +{% endif %} group by 1,2 having count(distinct t.hash) filter(where t."from" != 0x073ab1c0cad3677cde9bdb0cdeedc2085c029579) > 10 and count(distinct nt.contract_address) > 2 diff --git a/nft/models/_sector/aggregators/chains/nft_ethereum_aggregators_manual.sql b/nft/models/_sector/aggregators/chains/nft_ethereum_aggregators_manual.sql index be7c4ac0e87..3e41026c183 100644 --- a/nft/models/_sector/aggregators/chains/nft_ethereum_aggregators_manual.sql +++ b/nft/models/_sector/aggregators/chains/nft_ethereum_aggregators_manual.sql @@ -1,5 +1,4 @@ {{config( - schema = 'nft_ethereum', alias='aggregators_manual' )}} diff --git a/nft/models/_sector/aggregators/chains/nft_ethereum_aggregators_markers.sql b/nft/models/_sector/aggregators/chains/nft_ethereum_aggregators_markers.sql index 4403a864eed..2112fa4fb72 100644 --- a/nft/models/_sector/aggregators/chains/nft_ethereum_aggregators_markers.sql +++ b/nft/models/_sector/aggregators/chains/nft_ethereum_aggregators_markers.sql @@ -1,13 +1,11 @@ {{ config( - schema = 'nft_ethereum', alias = 'aggregators_markers', - materialized = 'table', - unique_key='hash_marker', - post_hook='{{ expose_spells(\'["ethereum"]\', - "sector", - "nft", - \'["hildobby", "0xRob"]\') }}') + materialized = 'incremental', + file_format = 'delta', + incremental_strategy = 'merge', + unique_key='hash_marker' + ) }} WITH reservoir AS ( @@ -25,6 +23,9 @@ AND regexp_replace(cast(data as varchar), '^.*00', '') != '1f' AND length(regexp_replace(cast(data as varchar), '^.*00', ''))%2 = 0 AND block_time > TIMESTAMP '2022-10-15' + {% if is_incremental() %} + AND {{incremental_predicate('block_time')}} + {% endif %} ) -- needed to eliminate duplicates diff --git a/nft/models/_sector/trades/chains/ethereum/platforms/opensea_v1_ethereum_base_trades.sql b/nft/models/_sector/trades/chains/ethereum/platforms/opensea_v1_ethereum_base_trades.sql index 1782abddce3..aa3f931bd91 100644 --- a/nft/models/_sector/trades/chains/ethereum/platforms/opensea_v1_ethereum_base_trades.sql +++ b/nft/models/_sector/trades/chains/ethereum/platforms/opensea_v1_ethereum_base_trades.sql @@ -1,9 +1,11 @@ {{ config( schema = 'opensea_v1_ethereum', alias = 'base_trades', - tags =['static'], - materialized = 'table', - file_format = 'delta' + materialized = 'incremental', + incremental_strategy = 'merge', + file_format = 'delta', + unique_key = ['block_number','tx_hash','sub_tx_trade_id'], + incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.block_time')] ) }} @@ -68,9 +70,13 @@ WITH wyvern_call_data as ( FROM {{ source('opensea_ethereum','wyvernexchange_call_atomicmatch_') }} wc WHERE 1=1 - AND (element_at(addrs,4) = {{OS_WALLET}} OR element_at(addrs,11) = {{OS_WALLET}}) -- limit to OpenSea + {% if is_incremental() %} + AND {{incremental_predicate('call_block_time')}} + {% endif %} + AND (element_at(addrs,4) = {{OS_WALLET}} OR element_at(addrs,11) = {{OS_WALLET}}) -- limit to OpenSea AND call_success = true AND call_block_time >= TIMESTAMP '{{START_DATE}}' AND call_block_time <= TIMESTAMP '{{END_DATE}}' + ), @@ -85,6 +91,9 @@ order_prices as ( lag(evt_index) over (partition by evt_block_number, evt_tx_hash order by evt_index asc) as prev_order_evt_index from {{ source('opensea_ethereum','wyvernexchange_evt_ordersmatched') }} WHERE evt_block_time >= TIMESTAMP '{{START_DATE}}' AND evt_block_time <= TIMESTAMP '{{END_DATE}}' + {% if is_incremental() %} + AND {{incremental_predicate('evt_block_time')}} + {% endif %} ), -- needed to pull token_id, token_amounts, token_standard and nft_contract_address @@ -102,6 +111,9 @@ nft_transfers as ( tx_hash from {{ ref('nft_ethereum_transfers') }} WHERE block_time >= TIMESTAMP '{{START_DATE}}' AND block_time <= TIMESTAMP '{{END_DATE}}' + {% if is_incremental() %} + AND {{incremental_predicate('block_time')}} + {% endif %} ), -- join call and order data From bbf387b92083ad9f9bd80ba3198a9dbeec66f55c Mon Sep 17 00:00:00 2001 From: henrystats <65398020+henrystats@users.noreply.github.com> Date: Tue, 18 Jun 2024 14:22:01 +0100 Subject: [PATCH 127/149] [easy] Add USDB & WETH Prices on Blast - Ready for review (#6190) * Add USDB & WETH BLast * add blast to token checker * update contributor --- models/prices/blast/prices_blast_schema.yml | 29 +++++++++++++++++++++ models/prices/blast/prices_blast_tokens.sql | 20 ++++++++++++++ models/prices/prices_schema.yml | 2 +- models/prices/prices_tokens.sql | 5 ++-- scripts/token_checker.py | 3 ++- 5 files changed, 55 insertions(+), 4 deletions(-) create mode 100644 models/prices/blast/prices_blast_schema.yml create mode 100644 models/prices/blast/prices_blast_tokens.sql diff --git a/models/prices/blast/prices_blast_schema.yml b/models/prices/blast/prices_blast_schema.yml new file mode 100644 index 00000000000..c4a560cf1c0 --- /dev/null +++ b/models/prices/blast/prices_blast_schema.yml @@ -0,0 +1,29 @@ +version: 2 + +models: + - name: prices_blast_tokens + meta: + blockchain: blast + sector: prices + contributors: Henrystats + config: + tags: ['prices', 'tokens', 'usd', 'blast'] + description: "Price tokens on blast chain" + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - contract_address + columns: + - name: token_id + description: "Id of the token at coinpaprika. This id is required to pull the price feed data. NOTE: Not all tokens are listed at coinpaprika - consider using price data from DEX sources in this case or submit a listing request at coinpaprika." + - name: blockchain + description: "Native blockchain of the token, if any" + tests: + - accepted_values: + values: [ "blast" ] + - name: contract_address + description: "Contract address of the token, if any" + - name: symbol + description: "Token symbol" + - name: decimals + description: "Number of decimals for the token contract" \ No newline at end of file diff --git a/models/prices/blast/prices_blast_tokens.sql b/models/prices/blast/prices_blast_tokens.sql new file mode 100644 index 00000000000..ebac11566dc --- /dev/null +++ b/models/prices/blast/prices_blast_tokens.sql @@ -0,0 +1,20 @@ +{{ config( + schema='prices_blast', + alias = 'tokens', + materialized='table', + file_format = 'delta', + tags=['static'] + ) +}} +SELECT + token_id + , blockchain + , symbol + , contract_address + , decimals +FROM +( + VALUES + ('weth-weth','blast','WETH',0x4300000000000000000000000000000000000004,18), + ('usdb-usdb','blast','USDB',0x4300000000000000000000000000000000000003,18) +) as temp (token_id, blockchain, symbol, contract_address, decimals) diff --git a/models/prices/prices_schema.yml b/models/prices/prices_schema.yml index 3620aaea4ca..d9db811627c 100644 --- a/models/prices/prices_schema.yml +++ b/models/prices/prices_schema.yml @@ -3,7 +3,7 @@ version: 2 models: - name: prices_tokens meta: - blockchain: arbitrum, avalanche_c, gnosis, polygon, optimism, ethereum, bnb, solana, fantom, celo, base, zksync, zora, linea, zkevm + blockchain: arbitrum, avalanche_c, gnosis, polygon, optimism, ethereum, bnb, solana, fantom, celo, base, zksync, zora, linea, zkevm, blast sector: prices contributors: aalan3, hildobby, pipistrella, viniabussafi config: diff --git a/models/prices/prices_tokens.sql b/models/prices/prices_tokens.sql index 316aeb00cf5..af2db758212 100644 --- a/models/prices/prices_tokens.sql +++ b/models/prices/prices_tokens.sql @@ -4,10 +4,10 @@ materialized='table', file_format = 'delta', tags = ['static'], - post_hook = '{{ expose_spells(\'["ethereum", "solana", "arbitrum", "gnosis", "optimism", "bnb", "avalanche_c", "polygon", "fantom", "celo", "base", "zksync", "zora", "bitcoin", "cardano"]\', + post_hook = '{{ expose_spells(\'["ethereum", "solana", "arbitrum", "gnosis", "optimism", "bnb", "avalanche_c", "polygon", "fantom", "celo", "base", "zksync", "zora", "bitcoin", "cardano","blast"]\', "sector", "prices", - \'["aalan3", "jeff-dude", "umer_h_adil", "0xBoxer", "rantum", "lgingerich", "hildobby", "cryptokoryo", "0xRob", "hosuke"]\') }}' + \'["aalan3", "jeff-dude", "umer_h_adil", "0xBoxer", "rantum", "lgingerich", "hildobby", "cryptokoryo", "0xRob", "hosuke", "Henrystats"]\') }}' ) }} @@ -32,6 +32,7 @@ ref('prices_native_tokens') ,ref('prices_linea_tokens') ,ref('prices_zkevm_tokens') ,ref('prices_mantle_tokens') +,ref('prices_blast_tokens') ] %} diff --git a/scripts/token_checker.py b/scripts/token_checker.py index 893097a8c0e..1a454e47f0c 100644 --- a/scripts/token_checker.py +++ b/scripts/token_checker.py @@ -25,7 +25,8 @@ def __init__(self): "base": "base-base", "zksync": "zksync-zksync", "zora": "eth-ethereum", - "mantle": "mnt-mantle" + "mantle": "mnt-mantle", + "blast": "blast-blast" } self.tokens_by_id = self.get_tokens() self.contracts_by_chain = self.get_contracts() From 97257f9d9f4044167bb106b70b4b43a067c325bf Mon Sep 17 00:00:00 2001 From: henrystats <65398020+henrystats@users.noreply.github.com> Date: Tue, 18 Jun 2024 14:22:19 +0100 Subject: [PATCH 128/149] Add Blast Tokens (#6183) Co-authored-by: Huang Geyang --- .../tokens/blast/tokens_blast_erc20.sql | 22 +++++++++++++++++++ .../tokens/blast/tokens_blast_schema.yml | 21 ++++++++++++++++++ tokens/models/tokens/tokens_erc20.sql | 5 +++-- tokens/models/tokens/tokens_native.sql | 5 +++-- tokens/models/tokens/tokens_schema.yml | 10 ++++----- 5 files changed, 54 insertions(+), 9 deletions(-) create mode 100644 tokens/models/tokens/blast/tokens_blast_erc20.sql create mode 100644 tokens/models/tokens/blast/tokens_blast_schema.yml diff --git a/tokens/models/tokens/blast/tokens_blast_erc20.sql b/tokens/models/tokens/blast/tokens_blast_erc20.sql new file mode 100644 index 00000000000..725a1f8816f --- /dev/null +++ b/tokens/models/tokens/blast/tokens_blast_erc20.sql @@ -0,0 +1,22 @@ +{{ + config( + schema = 'tokens_blast' + ,alias = 'erc20' + ,tags = ['static'] + ,materialized = 'table' + ) +}} + +SELECT + contract_address + , symbol + , decimals +FROM (VALUES + (0x4300000000000000000000000000000000000004, 'WETH', 18) + , (0x4300000000000000000000000000000000000003, 'USDB', 18) + , (0x20fe91f17ec9080e3cac2d688b4ecb48c5ac3a9c, 'YES', 6) + , (0x491e6de43b55c8eae702edc263e32339da42f58c, 'ESE', 18) + , (0x5ffd9ebd27f2fcab044c0f0a26a45cb62fa29c06, 'PAC', 18) + , (0x2416092f143378750bb29b79ed961ab195cceea5, 'ezETH', 18) + , (0x04C0599Ae5A44757c0af6F9eC3b93da8976c150A, 'weETH', 18) +) AS temp_table (contract_address, symbol, decimals) diff --git a/tokens/models/tokens/blast/tokens_blast_schema.yml b/tokens/models/tokens/blast/tokens_blast_schema.yml new file mode 100644 index 00000000000..b2e34b596c1 --- /dev/null +++ b/tokens/models/tokens/blast/tokens_blast_schema.yml @@ -0,0 +1,21 @@ +version: 2 + +models: + - name: tokens_blast_erc20 + meta: + blockchain: blast + sector: tokens + project: erc20 + contributors: Henrystats + config: + tags: ['table', 'erc20'] + description: "ERC20 Token Addresses, Symbols and Decimals" + columns: + - name: contract_address + description: "ERC20 token contract address" + tests: + - unique + - name: symbol + description: "ERC20 token symbol" + - name: decimals + description: "Number of decimals, refers to how divisible an ERC20 token can be" \ No newline at end of file diff --git a/tokens/models/tokens/tokens_erc20.sql b/tokens/models/tokens/tokens_erc20.sql index 3163e392095..e638a29f817 100644 --- a/tokens/models/tokens/tokens_erc20.sql +++ b/tokens/models/tokens/tokens_erc20.sql @@ -3,10 +3,10 @@ schema = 'tokens' ,alias = 'erc20' ,materialized = 'table' - ,post_hook='{{ expose_spells(\'["arbitrum","avalanche_c","base","bnb","celo","ethereum","fantom","fuse","gnosis","goerli","mantle","optimism","polygon","scroll","zkevm","zksync","zora"]\', + ,post_hook='{{ expose_spells(\'["arbitrum","avalanche_c","base","bnb","celo","ethereum","fantom","fuse","gnosis","goerli","mantle","optimism","polygon","scroll","zkevm","zksync","zora","blast"]\', "sector", "tokens", - \'["bh2smith","0xManny","hildobby","soispoke","dot2dotseurat","mtitus6","wuligy","lgingerich","0xRob","jeff-dude","viniabussafi","IrishLatte19","angus_1"]\') }}' + \'["bh2smith","0xManny","hildobby","soispoke","dot2dotseurat","mtitus6","wuligy","lgingerich","0xRob","jeff-dude","viniabussafi","IrishLatte19","angus_1","Henrystats"]\') }}' ) }} @@ -33,6 +33,7 @@ ,'tokens_zkevm': {'blockchain': 'zkevm', 'model': ref('tokens_zkevm_erc20')} ,'tokens_zksync': {'blockchain': 'zksync', 'model': ref('tokens_zksync_erc20')} ,'tokens_zora': {'blockchain': 'zora', 'model': ref('tokens_zora_erc20')} + ,'tokens_blast': {'blockchain': 'blast', 'model': ref('tokens_blast_erc20')} } %} with diff --git a/tokens/models/tokens/tokens_native.sql b/tokens/models/tokens/tokens_native.sql index 4750d21234a..69c3c76d5a8 100644 --- a/tokens/models/tokens/tokens_native.sql +++ b/tokens/models/tokens/tokens_native.sql @@ -1,10 +1,10 @@ {{ config( alias='native', tags=['static'], - post_hook='{{ expose_spells(\'["arbitrum","avalanche_c","bnb","ethereum","optimism", "gnosis", "fantom", "polygon","solana", "celo", "zksync", "mantle"]\', + post_hook='{{ expose_spells(\'["arbitrum","avalanche_c","bnb","ethereum","optimism", "gnosis", "fantom", "polygon","solana", "celo", "zksync", "mantle","blast"]\', "sector", "tokens", - \'["0xManny","hildobby","soispoke","dot2dotseurat","mtitus6","wuligy","lgingerich","angus_1"]\') }}')}} + \'["0xManny","hildobby","soispoke","dot2dotseurat","mtitus6","wuligy","lgingerich","angus_1","Henrystats"]\') }}')}} SELECT chain, symbol, price_symbol, price_address, decimals FROM (VALUES @@ -22,4 +22,5 @@ FROM (VALUES , ('celo', 'CELO', 'CELO', 0x471ece3750da237f93b8e339c536989b8978a438, 18) , ('zksync', 'ETH', 'WETH', 0x000000000000000000000000000000000000800A, 18) , ('mantle', 'MNT', 'WMNT', 0x78c1b0c915c4faa5fffa6cabf0219da63d7f4cb8, 18) + , ('blast', 'ETH', 'WETH', 0x4300000000000000000000000000000000000004, 18) ) AS temp_table (chain, symbol, price_symbol, price_address, decimals) diff --git a/tokens/models/tokens/tokens_schema.yml b/tokens/models/tokens/tokens_schema.yml index 39a720d6628..b100e42c1bd 100644 --- a/tokens/models/tokens/tokens_schema.yml +++ b/tokens/models/tokens/tokens_schema.yml @@ -3,11 +3,11 @@ version: 2 models: - name: tokens_erc20 meta: - blockchain: arbitrum, avalanche_c, bnb, ethereum, gnosis, mantle, optimism, fantom, polygon, base + blockchain: arbitrum, avalanche_c, bnb, ethereum, gnosis, mantle, optimism, fantom, polygon, base, blast sector: tokens - contributors: hildobby, 0xManny, dot2dotseurat, soispoke, mtitus6, wuligy, angus_1 + contributors: hildobby, 0xManny, dot2dotseurat, soispoke, mtitus6, wuligy, angus_1, Henrystats config: - tags: ['tokens','erc20', 'arbitrum', 'avalanche_c', 'bnb', 'ethereum', 'gnosis', 'mantle', 'optimism', 'fantom', 'base'] + tags: ['tokens','erc20', 'arbitrum', 'avalanche_c', 'bnb', 'ethereum', 'gnosis', 'mantle', 'optimism', 'fantom', 'base', 'blast'] description: > Crosschain ERC20 tokens tests: @@ -26,11 +26,11 @@ models: - name: tokens_native meta: - blockchain: avalanche_c, bnb, ethereum, gnosis, optimism, ethereum, arbitrum, solana, fantom, mantle + blockchain: avalanche_c, bnb, ethereum, gnosis, optimism, ethereum, arbitrum, solana, fantom, mantle, blast sector: tokens contributors: ilemi config: - tags: ['tokens','native', 'avalanche_c', 'bnb','ethereum', 'gnosis','optimism','ethereum','solana','arbitrum', 'fantom','mantle'] + tags: ['tokens','native', 'avalanche_c', 'bnb','ethereum', 'gnosis','optimism','ethereum','solana','arbitrum', 'fantom','mantle', 'blast'] description: > The chain native token and symbol, and the prices.usd symbol/address that is closest. columns: From 21ece77d0fac6c8942045ccad6f7451298fd5a94 Mon Sep 17 00:00:00 2001 From: Lydia Puspita <113081740+lydiapuspita@users.noreply.github.com> Date: Tue, 18 Jun 2024 20:23:01 +0700 Subject: [PATCH 129/149] Add THE, NMT, PEPECOIN, VRTX token (#6174) * Update prices_bnb_tokens.sql add THE Token * Update prices_ethereum_tokens.sql Add PEPECOIN and NMT token price * Update prices_arbitrum_tokens.sql Add VRTX token price * Fix models/prices/ethereum/prices_ethereum_tokens.sql * Update models/prices/arbitrum/prices_arbitrum_tokens.sql --------- Co-authored-by: Huang Geyang --- models/prices/arbitrum/prices_arbitrum_tokens.sql | 3 ++- models/prices/bnb/prices_bnb_tokens.sql | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/models/prices/arbitrum/prices_arbitrum_tokens.sql b/models/prices/arbitrum/prices_arbitrum_tokens.sql index c10ba51ebb5..1b410ff857b 100644 --- a/models/prices/arbitrum/prices_arbitrum_tokens.sql +++ b/models/prices/arbitrum/prices_arbitrum_tokens.sql @@ -197,5 +197,6 @@ FROM ('gyd-gyro-dollar','arbitrum','GYD',0xca5d8f8a8d49439357d3cf46ca2e720702f132b8, 18), ('a51-a51-finance','arbitrum','A51',0xb3f13b0c61d65d67d7d6215d70c89533ee567a91, 18), ('oseth-stakewise-staked-eth','arbitrum','osETH',0xf7d4e7273e5015c96728a6b02f31c505ee184603, 18), - ('sliz-solidlizard-dex-token','arbitrum','SLIZ',0x463913D3a3D3D291667D53B8325c598Eb88D3B0e, 18) + -- ('sliz-solidlizard-dex-token','arbitrum','SLIZ',0x463913D3a3D3D291667D53B8325c598Eb88D3B0e, 18), -- Inactive + ('vrtx-vertex-protocol', 'arbitrum', 'VRTX', 0x95146881b86b3ee99e63705ec87afe29fcc044d9, 18) ) as temp (token_id, blockchain, symbol, contract_address, decimals) diff --git a/models/prices/bnb/prices_bnb_tokens.sql b/models/prices/bnb/prices_bnb_tokens.sql index 862dd3c07b2..5953569bfdb 100644 --- a/models/prices/bnb/prices_bnb_tokens.sql +++ b/models/prices/bnb/prices_bnb_tokens.sql @@ -266,7 +266,8 @@ FROM --('dofn-openfabric', 'bnb', 'OFN', 0x8899ec96ed8c96b5c86c23c3f069c3def75b6d97,18),--not found in api ('xpe-xpense', 'bnb', 'XPE', 0x88691f292b76bf4d2caa5678a54515fae77c33af,18), ('trump-maga', 'bnb', 'TRUMP', 0x4ea98c1999575aaadfb38237dd015c5e773f75a2,9), - ('wsm-wall-street-memes', 'bnb', 'WSM', 0xb62e45c3df611dce236a6ddc7a493d79f9dfadef, 18) + ('wsm-wall-street-memes', 'bnb', 'WSM', 0xb62e45c3df611dce236a6ddc7a493d79f9dfadef, 18), + ('the-thena', 'bnb', 'THE', 0xf4c8e32eadec4bfe97e0f595add0f4450a863a11, 18) ) as temp (token_id, blockchain, symbol, contract_address, decimals) where contract_address not in ( 0x2ab0e9e4ee70fff1fb9d67031e44f6410170d00e -- bXEN has bad price feed. From 58ba9a32b4a5fa50019fc36b0786654bc80ad117 Mon Sep 17 00:00:00 2001 From: whale_hunter <143016036+whalehunting@users.noreply.github.com> Date: Tue, 18 Jun 2024 15:24:00 +0200 Subject: [PATCH 130/149] chore: add DOUGH price feed (#6173) Co-authored-by: Huang Geyang --- models/prices/ethereum/prices_ethereum_tokens.sql | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/models/prices/ethereum/prices_ethereum_tokens.sql b/models/prices/ethereum/prices_ethereum_tokens.sql index ad5f7588f9c..fde65530dfd 100644 --- a/models/prices/ethereum/prices_ethereum_tokens.sql +++ b/models/prices/ethereum/prices_ethereum_tokens.sql @@ -1791,7 +1791,8 @@ FROM ('gods-gods-unchained', 'ethereum', 'GODS', 0xccc8cb5229b0ac8069c51fd58367fd1e622afd97, 18), ('cah-moon-tropica', 'ethereum', 'CAH', 0x8e0e57dcb1ce8d9091df38ec1bfc3b224529754a, 18), ('bigtime-big-time', 'ethereum', 'BIGTIME', 0x64Bc2cA1Be492bE7185FAA2c8835d9b824c8a194, 18), - ('portal2-portal-coin', 'ethereum', 'PORTAL', 0x1bbe973bef3a977fc51cbed703e8ffdefe001fed, 18) + ('portal2-portal-coin', 'ethereum', 'PORTAL', 0x1bbe973bef3a977fc51cbed703e8ffdefe001fed, 18), + ('dough-l3t-h1m-c00k', 'ethereum', 'DOUGH', 0xFc116eA24F002F600e363bdce4b91715fe5e0392, 9) ) as temp (token_id, blockchain, symbol, contract_address, decimals) where contract_address not in ( -- bad price feeds From e2b53fe2d7865b411171499dd9dfd9990196c9f0 Mon Sep 17 00:00:00 2001 From: yy-analytics <103118737+yy-analytics@users.noreply.github.com> Date: Tue, 18 Jun 2024 18:54:31 +0530 Subject: [PATCH 131/149] Adding and handful of new tokens for avalanche to tokens.erc20 (#6165) Co-authored-by: Huang Geyang --- .../models/tokens/avalanche_c/tokens_avalanche_c_erc20.sql | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/tokens/models/tokens/avalanche_c/tokens_avalanche_c_erc20.sql b/tokens/models/tokens/avalanche_c/tokens_avalanche_c_erc20.sql index 150667ba16c..5cc6bfd5d23 100644 --- a/tokens/models/tokens/avalanche_c/tokens_avalanche_c_erc20.sql +++ b/tokens/models/tokens/avalanche_c/tokens_avalanche_c_erc20.sql @@ -363,4 +363,9 @@ FROM (VALUES , (0xfdfe62182f63000b58c70bdd39566dec89d4006c, 'JLP', 18) , (0xfebf47cf89f766e6c24317b17f862ba5d4d82f8c, 'ELP', 18) , (0xffa26cb3458023c4b78c3d10f8bef4704c2fd198, 'HAKU-LP', 18) + , (0x17766e5dd91fdc14c24cd9847e5e93fd62a05afd, 'ZERO-LP', 18) + , (0x332719570155dc61bec2901a06d6b36faf02f184, 'ZERO-LP', 18) + , (0x60b78d111382036abc5eed987a709b07d52df9d3, 'COM-LP', 18) + , (0xf0ed25fd26e0b64c86c6c78b661f2ef283e9b6ff, 'COM-LP', 18) + , (0xf105fb50fc6ddd8a857bbecd296c8a630e8ca857, 'PGL', 18) ) AS temp_table (contract_address, symbol, decimals) From b53caacfe5c041a729f6c10d40c4fecde54f7505 Mon Sep 17 00:00:00 2001 From: henrystats <65398020+henrystats@users.noreply.github.com> Date: Tue, 18 Jun 2024 14:25:22 +0100 Subject: [PATCH 132/149] Aerodrome Base Slipstream trades - Ready for review (#6185) * Aerodrome Base Slipstream trades * fix slipsteam * add slipstream tests --- dex/models/trades/base/_schema.yml | 2 +- .../platforms/aerodrome_base_base_trades.sql | 74 ++++++++++++++++--- .../aerodrome_base_base_trades_seed.csv | 2 + 3 files changed, 68 insertions(+), 10 deletions(-) diff --git a/dex/models/trades/base/_schema.yml b/dex/models/trades/base/_schema.yml index d4f9a7483eb..5c8979de934 100644 --- a/dex/models/trades/base/_schema.yml +++ b/dex/models/trades/base/_schema.yml @@ -30,7 +30,7 @@ models: blockchain: base sector: dex project: aerodrome - contributors: msilb7, tomfutago + contributors: msilb7, tomfutago, Henrystats config: tags: [ 'base', 'dex', 'trades', 'aerodrome' ] description: aerodrome base trades diff --git a/dex/models/trades/base/platforms/aerodrome_base_base_trades.sql b/dex/models/trades/base/platforms/aerodrome_base_base_trades.sql index ace7300a2ee..7a184db1dca 100644 --- a/dex/models/trades/base/platforms/aerodrome_base_base_trades.sql +++ b/dex/models/trades/base/platforms/aerodrome_base_base_trades.sql @@ -10,13 +10,69 @@ ) }} -{{ - uniswap_compatible_v2_trades( - blockchain = 'base', - project = 'aerodrome', - version = '1', - Pair_evt_Swap = source('aerodrome_base', 'Pool_evt_Swap'), - Factory_evt_PairCreated = source('aerodrome_base', 'PoolFactory_evt_PoolCreated'), - pair_column_name = 'pool' +WITH + +dexs_v1 AS ( + {{ + uniswap_compatible_v2_trades( + blockchain = 'base', + project = 'aerodrome', + version = '1', + Pair_evt_Swap = source('aerodrome_base', 'Pool_evt_Swap'), + Factory_evt_PairCreated = source('aerodrome_base', 'PoolFactory_evt_PoolCreated'), + pair_column_name = 'pool' ) -}} + }} +), + +dexs_v2 AS ( + {{ + uniswap_compatible_v3_trades( + blockchain = 'base', + project = 'aerodrome', + version = 'slipstream', + Pair_evt_Swap = source('aerodrome_base', 'CLPool_evt_Swap'), + Factory_evt_PoolCreated = source('aerodrome_base', 'CLFactory_evt_PoolCreated'), + optional_columns = null + ) + }} +) + +SELECT + dexs_v1.blockchain, + dexs_v1.project, + dexs_v1.version, + dexs_v1.block_month, + dexs_v1.block_date, + dexs_v1.block_time, + dexs_v1.block_number, + dexs_v1.token_bought_amount_raw, + dexs_v1.token_sold_amount_raw, + dexs_v1.token_bought_address, + dexs_v1.token_sold_address, + dexs_v1.taker, + dexs_v1.maker, + dexs_v1.project_contract_address, + dexs_v1.tx_hash, + dexs_v1.evt_index +FROM dexs_v1 +UNION ALL +SELECT + dexs_v2.blockchain, + dexs_v2.project, + dexs_v2.version, + dexs_v2.block_month, + dexs_v2.block_date, + dexs_v2.block_time, + dexs_v2.block_number, + dexs_v2.token_bought_amount_raw, + dexs_v2.token_sold_amount_raw, + dexs_v2.token_bought_address, + dexs_v2.token_sold_address, + dexs_v2.taker, + dexs_v2.maker, + dexs_v2.project_contract_address, + dexs_v2.tx_hash, + dexs_v2.evt_index +FROM dexs_v2 + diff --git a/dex/seeds/trades/aerodrome_base_base_trades_seed.csv b/dex/seeds/trades/aerodrome_base_base_trades_seed.csv index 20c008ebad8..081126dee5f 100644 --- a/dex/seeds/trades/aerodrome_base_base_trades_seed.csv +++ b/dex/seeds/trades/aerodrome_base_base_trades_seed.csv @@ -4,3 +4,5 @@ base,aerodrome,1,2023-08-29,0x7d759da49295695ec7cade65a7f8abbdf83d6f639efa03ad73 base,aerodrome,1,2023-08-29,0x3c00dfe0b735b6c7f3dd302e41cdb5bc32fa64ce98b958ea2a99e9b868f24976,8,0xd9aaec86b65d86f6a7b5b1b0c42ffa531710b6ca,0x4200000000000000000000000000000000000006,3242321,16521567,10000000000000000 base,aerodrome,1,2023-08-29,0x644579f1f66b20b7aacddc4300ea746963ef3c68c37b32d14c7a9f59a92d2151,17,0x9e53e88dcff56d3062510a745952dec4cefdff9e,0x4200000000000000000000000000000000000006,3241443,1588864691284781064569017,300000000000000000 base,aerodrome,1,2023-08-29,0x552ae20fd4164aa9ef2a37616510c7dd54333733578a4af20074e81dc14af8ce,143,0x4200000000000000000000000000000000000006,0xd9aaec86b65d86f6a7b5b1b0c42ffa531710b6ca,3244933,60625419898954064,100000000 +base,aerodrome,slipstream,2024-06-16,0x2bff240977f1e646d573a2fd7f95c2584fcb996739b8c150afbe82c1c453200e,329,0xb79dd08ea68a908a97220c76d19a6aa9cbde4376,0xe4796ccb6bb5de2290c417ac337f2b66ca2e770e,15877323,56289745,53454210540060595144 +base,aerodrome,slipstream,2024-06-16,0xd9e3de3e1554daa8bc52c80cb9f2197e949d06f1b7734eb7e75ee52bc153b589,159,0x532f27101965dd16442e59d40670faf5ebb142e4,0x4200000000000000000000000000000000000006,15879372,6208881609743124843349,277382734258193000 From 0579694c4bd17d8bdc53ff86563ed18934e543a8 Mon Sep 17 00:00:00 2001 From: blanchemaria6 <130497866+blanchemaria6@users.noreply.github.com> Date: Tue, 18 Jun 2024 20:25:50 +0700 Subject: [PATCH 133/149] add dackieswap v2 on arbitrum to dex.trades (#6179) * add dackieswap v2 on arbitrum to dex.trades * fix seed --------- Co-authored-by: Huang Geyang --- dex/models/trades/arbitrum/_schema.yml | 19 +++++++++++++++++ .../arbitrum/dex_arbitrum_base_trades.sql | 1 + .../dackieswap_v2_arbitrum_base_trades.sql | 21 +++++++++++++++++++ dex/seeds/trades/_schema.yml | 15 +++++++++++++ ...ackieswap_v2_arbitrum_base_trades_seed.csv | 2 ++ .../_sector/dex/trades/arbitrum/_sources.yml | 5 +++++ 6 files changed, 63 insertions(+) create mode 100644 dex/models/trades/arbitrum/platforms/dackieswap_v2_arbitrum_base_trades.sql create mode 100644 dex/seeds/trades/dackieswap_v2_arbitrum_base_trades_seed.csv diff --git a/dex/models/trades/arbitrum/_schema.yml b/dex/models/trades/arbitrum/_schema.yml index 4c9e3f89d73..17920190c13 100644 --- a/dex/models/trades/arbitrum/_schema.yml +++ b/dex/models/trades/arbitrum/_schema.yml @@ -698,3 +698,22 @@ models: - check_dex_base_trades_seed: seed_file: ref('solidly_v3_arbitrum_base_trades_seed') + - name: dackieswap_v2_arbitrum_base_trades + meta: + blockchain: arbitrum + sector: dex + project: dackieswap + contributors: blanchemaria6 + config: + tags: [ 'arbitrum', 'dex', 'trades', 'dackieswap' ] + description: "dackieswap v2 arbitrum base trades" + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - tx_hash + - evt_index + - check_dex_base_trades_seed: + seed_file: ref('dackieswap_v2_arbitrum_base_trades_seed') + filter: + version: 2 + diff --git a/dex/models/trades/arbitrum/dex_arbitrum_base_trades.sql b/dex/models/trades/arbitrum/dex_arbitrum_base_trades.sql index f64e73dc37f..9a6e102065c 100644 --- a/dex/models/trades/arbitrum/dex_arbitrum_base_trades.sql +++ b/dex/models/trades/arbitrum/dex_arbitrum_base_trades.sql @@ -43,6 +43,7 @@ , ref('auragi_arbitrum_base_trades') , ref('wombat_exchange_arbitrum_base_trades') , ref('solidly_v3_arbitrum_base_trades') + , ref('dackieswap_v2_arbitrum_base_trades') ] %} WITH base_union AS ( diff --git a/dex/models/trades/arbitrum/platforms/dackieswap_v2_arbitrum_base_trades.sql b/dex/models/trades/arbitrum/platforms/dackieswap_v2_arbitrum_base_trades.sql new file mode 100644 index 00000000000..5bba1a05163 --- /dev/null +++ b/dex/models/trades/arbitrum/platforms/dackieswap_v2_arbitrum_base_trades.sql @@ -0,0 +1,21 @@ +{{ + config( + schema = 'dackieswap_v2_arbitrum', + alias = 'base_trades', + materialized = 'incremental', + file_format = 'delta', + incremental_strategy = 'merge', + unique_key = ['tx_hash', 'evt_index'], + incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.block_time')] + ) +}} + +{{ + uniswap_compatible_v2_trades( + blockchain = 'arbitrum', + project = 'dackieswap', + version = '2', + Pair_evt_Swap = source('dackieswap_v2_arbitrum', 'DackiePair_evt_Swap'), + Factory_evt_PairCreated = source('dackieswap_v2_arbitrum', 'DackieFactory_evt_PairCreated') + ) +}} diff --git a/dex/seeds/trades/_schema.yml b/dex/seeds/trades/_schema.yml index 6f7bd8e93f1..6291bd38ae4 100644 --- a/dex/seeds/trades/_schema.yml +++ b/dex/seeds/trades/_schema.yml @@ -3600,3 +3600,18 @@ seeds: token_bought_amount_raw: uint256 token_sold_amount_raw: uint256 block_date: timestamp + + - name: dackieswap_v2_arbitrum_base_trades_seed + config: + column_types: + blockchain: varchar + project: varchar + version: varchar + tx_hash: varbinary + evt_index: uint256 + block_number: uint256 + token_bought_address: varbinary + token_sold_address: varbinary + token_bought_amount_raw: uint256 + token_sold_amount_raw: uint256 + block_date: timestamp diff --git a/dex/seeds/trades/dackieswap_v2_arbitrum_base_trades_seed.csv b/dex/seeds/trades/dackieswap_v2_arbitrum_base_trades_seed.csv new file mode 100644 index 00000000000..1831e05e68e --- /dev/null +++ b/dex/seeds/trades/dackieswap_v2_arbitrum_base_trades_seed.csv @@ -0,0 +1,2 @@ +blockchain,project,version,block_date,tx_hash,evt_index,token_bought_address,token_sold_address,block_number,token_bought_amount_raw,token_sold_amount_raw +arbitrum,dackieswap,2,2024-03-31,0x83910e35eb69356c628bf0ea2dc698b15774c40681c6e4e79d3fd2d869b02fdf,9,0x59debed8d46a0cb823d8be8b957add987ead39aa,0x47c337bd5b9344a6f3d6f58c474d9d8cd419d8ca,216962559,6867475956379792590208,644092244140891936143 diff --git a/sources/_sector/dex/trades/arbitrum/_sources.yml b/sources/_sector/dex/trades/arbitrum/_sources.yml index 79ebffec9fc..5c55694a339 100644 --- a/sources/_sector/dex/trades/arbitrum/_sources.yml +++ b/sources/_sector/dex/trades/arbitrum/_sources.yml @@ -138,4 +138,9 @@ sources: tables: - name: SolidlyV3Factory_evt_PoolCreated - name: SolidlyV3Pool_evt_Swap + - name: dackieswap_v2_arbitrum + tables: + - name: DackieFactory_evt_PairCreated + - name: DackiePair_evt_Swap + From e69946bcac25c70c8c176a60c2dc7ada0aaa29db Mon Sep 17 00:00:00 2001 From: blanchemaria6 <130497866+blanchemaria6@users.noreply.github.com> Date: Tue, 18 Jun 2024 20:29:10 +0700 Subject: [PATCH 134/149] add dackieswap v3 on arb to dex.trades (#6170) * add dackieswap v3 on arb to dex.trades * fix model * fix seed --------- Co-authored-by: Huang Geyang Co-authored-by: jeff-dude <102681548+jeff-dude@users.noreply.github.com> --- dex/models/trades/arbitrum/_schema.yml | 19 +++++++++++++++++ .../arbitrum/dex_arbitrum_base_trades.sql | 1 + .../dackieswap_v3_arbitrum_base_trades.sql | 21 +++++++++++++++++++ dex/seeds/trades/_schema.yml | 15 +++++++++++++ ...ackieswap_v3_arbitrum_base_trades_seed.csv | 2 ++ .../_sector/dex/trades/arbitrum/_sources.yml | 4 ++++ 6 files changed, 62 insertions(+) create mode 100644 dex/models/trades/arbitrum/platforms/dackieswap_v3_arbitrum_base_trades.sql create mode 100644 dex/seeds/trades/dackieswap_v3_arbitrum_base_trades_seed.csv diff --git a/dex/models/trades/arbitrum/_schema.yml b/dex/models/trades/arbitrum/_schema.yml index 17920190c13..f63f1d0b991 100644 --- a/dex/models/trades/arbitrum/_schema.yml +++ b/dex/models/trades/arbitrum/_schema.yml @@ -698,6 +698,25 @@ models: - check_dex_base_trades_seed: seed_file: ref('solidly_v3_arbitrum_base_trades_seed') + - name: dackieswap_v3_arbitrum_base_trades + meta: + blockchain: arbitrum + sector: dex + project: dackieswap + contributors: blanchemaria6 + config: + tags: [ 'arbitrum', 'dex', 'trades', 'dackieswap' ] + description: "dackieswap v3 arbitrum base trades" + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - tx_hash + - evt_index + - check_dex_base_trades_seed: + seed_file: ref('dackieswap_v3_arbitrum_base_trades_seed') + filter: + version: 3 + - name: dackieswap_v2_arbitrum_base_trades meta: blockchain: arbitrum diff --git a/dex/models/trades/arbitrum/dex_arbitrum_base_trades.sql b/dex/models/trades/arbitrum/dex_arbitrum_base_trades.sql index 9a6e102065c..7fce3667352 100644 --- a/dex/models/trades/arbitrum/dex_arbitrum_base_trades.sql +++ b/dex/models/trades/arbitrum/dex_arbitrum_base_trades.sql @@ -43,6 +43,7 @@ , ref('auragi_arbitrum_base_trades') , ref('wombat_exchange_arbitrum_base_trades') , ref('solidly_v3_arbitrum_base_trades') + , ref('dackieswap_v3_arbitrum_base_trades') , ref('dackieswap_v2_arbitrum_base_trades') ] %} diff --git a/dex/models/trades/arbitrum/platforms/dackieswap_v3_arbitrum_base_trades.sql b/dex/models/trades/arbitrum/platforms/dackieswap_v3_arbitrum_base_trades.sql new file mode 100644 index 00000000000..2062b701416 --- /dev/null +++ b/dex/models/trades/arbitrum/platforms/dackieswap_v3_arbitrum_base_trades.sql @@ -0,0 +1,21 @@ +{{ + config( + schema = 'dackieswap_v3_arbitrum', + alias = 'base_trades', + materialized = 'incremental', + file_format = 'delta', + incremental_strategy = 'merge', + unique_key = ['tx_hash', 'evt_index'], + incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.block_time')] + ) +}} + +{{ + uniswap_compatible_v3_trades( + blockchain = 'arbitrum', + project = 'dackieswap', + version = '3', + Pair_evt_Swap = source('dackieswap_v3_arbitrum', 'PancakeV3Pool_evt_Swap'), + Factory_evt_PoolCreated = source('dackieswap_v3_arbitrum', 'PancakeV3Factory_evt_PoolCreated') + ) +}} diff --git a/dex/seeds/trades/_schema.yml b/dex/seeds/trades/_schema.yml index 6291bd38ae4..b5273aeb52d 100644 --- a/dex/seeds/trades/_schema.yml +++ b/dex/seeds/trades/_schema.yml @@ -3601,6 +3601,21 @@ seeds: token_sold_amount_raw: uint256 block_date: timestamp + - name: dackieswap_v3_arbitrum_base_trades_seed + config: + column_types: + blockchain: varchar + project: varchar + version: varchar + tx_hash: varbinary + evt_index: uint256 + block_number: uint256 + token_bought_address: varbinary + token_sold_address: varbinary + token_bought_amount_raw: uint256 + token_sold_amount_raw: uint256 + block_date: timestamp + - name: dackieswap_v2_arbitrum_base_trades_seed config: column_types: diff --git a/dex/seeds/trades/dackieswap_v3_arbitrum_base_trades_seed.csv b/dex/seeds/trades/dackieswap_v3_arbitrum_base_trades_seed.csv new file mode 100644 index 00000000000..29a90af15b7 --- /dev/null +++ b/dex/seeds/trades/dackieswap_v3_arbitrum_base_trades_seed.csv @@ -0,0 +1,2 @@ +blockchain,project,version,block_date,tx_hash,evt_index,token_bought_address,token_sold_address,block_number,token_bought_amount_raw,token_sold_amount_raw +optimism,arbitrum,3,2024-06-14,0xd1345c5af7583b5a7e72fb35daa56cacef45ceacbeb44c67444915a82f633e8f,9,0xff970a61a04b1ca14834a43f5de4533ebddb5cc8,0x82af49447d8a07e3bd95bd0d56f35241523fbab1,221635172,65542539,18742850732772437 diff --git a/sources/_sector/dex/trades/arbitrum/_sources.yml b/sources/_sector/dex/trades/arbitrum/_sources.yml index 5c55694a339..f93d9107f33 100644 --- a/sources/_sector/dex/trades/arbitrum/_sources.yml +++ b/sources/_sector/dex/trades/arbitrum/_sources.yml @@ -138,6 +138,10 @@ sources: tables: - name: SolidlyV3Factory_evt_PoolCreated - name: SolidlyV3Pool_evt_Swap + - name: dackieswap_v3_arbitrum + tables: + - name: PancakeV3Factory_evt_PoolCreated + - name: PancakeV3Pool_evt_Swap - name: dackieswap_v2_arbitrum tables: - name: DackieFactory_evt_PairCreated From 571ed0d5232a8c33474992b6c8b1614797e5fa57 Mon Sep 17 00:00:00 2001 From: henrystats <65398020+henrystats@users.noreply.github.com> Date: Tue, 18 Jun 2024 14:29:21 +0100 Subject: [PATCH 135/149] Add Uniswap Blast (V2 & V3) - Ready for review (#6177) * Add Uniswap Blast (V2 & V3) * fix seed naming * push * Update tests * trigger rerun * smol fix --- dex/models/trades/_schema.yml | 4 +- dex/models/trades/blast/_schema.yml | 44 +++++++++++++++++ .../trades/blast/dex_blast_base_trades.sql | 49 +++++++++++++++++++ .../uniswap_v2_blast_base_trades.sql | 21 ++++++++ .../uniswap_v3_blast_base_trades.sql | 20 ++++++++ dex/models/trades/dex_base_trades.sql | 1 + dex/seeds/trades/_schema.yml | 15 ++++++ .../trades/uniswap_blast_base_trades_seed.csv | 5 ++ sources/_sector/dex/trades/blast/_sources.yml | 11 +++++ 9 files changed, 168 insertions(+), 2 deletions(-) create mode 100644 dex/models/trades/blast/_schema.yml create mode 100644 dex/models/trades/blast/dex_blast_base_trades.sql create mode 100644 dex/models/trades/blast/platforms/uniswap_v2_blast_base_trades.sql create mode 100644 dex/models/trades/blast/platforms/uniswap_v3_blast_base_trades.sql create mode 100644 dex/seeds/trades/uniswap_blast_base_trades_seed.csv create mode 100644 sources/_sector/dex/trades/blast/_sources.yml diff --git a/dex/models/trades/_schema.yml b/dex/models/trades/_schema.yml index 0872fd9e231..6b9ea4e1b83 100644 --- a/dex/models/trades/_schema.yml +++ b/dex/models/trades/_schema.yml @@ -3,7 +3,7 @@ version: 2 models: - name: dex_trades meta: - blockchain: arbitrum, avalanche_c, base, bnb, celo, ethereum, fantom, gnosis, optimism, polygon, scroll, zksync, linea + blockchain: arbitrum, avalanche_c, base, bnb, celo, ethereum, fantom, gnosis, optimism, polygon, scroll, zksync, linea, blast sector: dex contributors: 0xRob, hosuke, jeff-dude, tomfutago config: @@ -99,7 +99,7 @@ models: - name: dex_base_trades meta: - blockchain: arbitrum, avalanche_c, base, bnb, celo, ethereum, fantom, gnosis, optimism, polygon, scroll, zksync, linea + blockchain: arbitrum, avalanche_c, base, bnb, celo, ethereum, fantom, gnosis, optimism, polygon, scroll, zksync, linea, blast sector: dex contributors: 0xRob, hosuke, jeff-dude, tomfutago config: diff --git a/dex/models/trades/blast/_schema.yml b/dex/models/trades/blast/_schema.yml new file mode 100644 index 00000000000..e74f37f10ef --- /dev/null +++ b/dex/models/trades/blast/_schema.yml @@ -0,0 +1,44 @@ +version: 2 + +models: + - name: dex_blast_base_trades + tests: + - check_dex_info_relationship + + - name: uniswap_v3_blast_base_trades + meta: + blockchain: blast + sector: dex + project: uniswap + contributors: Henrystats + config: + tags: [ 'blast', 'dex', 'trades', 'uniswap', 'v3' ] + description: "uniswap blast v3 base trades" + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - tx_hash + - evt_index + - check_dex_base_trades_seed: + seed_file: ref('uniswap_blast_base_trades_seed') + filter: + version: 3 + + - name: uniswap_v2_blast_base_trades + meta: + blockchain: blast + sector: dex + project: uniswap + contributors: Henrystats + config: + tags: [ 'blast', 'dex', 'trades', 'uniswap', 'v2' ] + description: "uniswap blast v2 base trades" + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - tx_hash + - evt_index + - check_dex_base_trades_seed: + seed_file: ref('uniswap_blast_base_trades_seed') + filter: + version: 2 diff --git a/dex/models/trades/blast/dex_blast_base_trades.sql b/dex/models/trades/blast/dex_blast_base_trades.sql new file mode 100644 index 00000000000..d97b4ba73d4 --- /dev/null +++ b/dex/models/trades/blast/dex_blast_base_trades.sql @@ -0,0 +1,49 @@ +{{ config( + schema = 'dex_blast' + , alias = 'base_trades' + , materialized = 'view' + ) +}} + +{% set base_models = [ + ref('uniswap_v3_blast_base_trades') + , ref('uniswap_v2_blast_base_trades') +] %} + +WITH base_union AS ( + SELECT * + FROM ( + {% for base_model in base_models %} + SELECT + blockchain + , project + , version + , block_month + , block_date + , block_time + , block_number + , token_bought_amount_raw + , token_sold_amount_raw + , token_bought_address + , token_sold_address + , taker + , maker + , project_contract_address + , tx_hash + , evt_index + FROM + {{ base_model }} + {% if not loop.last %} + UNION ALL + {% endif %} + {% endfor %} + ) +) + +{{ + add_tx_columns( + model_cte = 'base_union' + , blockchain = 'blast' + , columns = ['from', 'to', 'index'] + ) +}} diff --git a/dex/models/trades/blast/platforms/uniswap_v2_blast_base_trades.sql b/dex/models/trades/blast/platforms/uniswap_v2_blast_base_trades.sql new file mode 100644 index 00000000000..7d059a15693 --- /dev/null +++ b/dex/models/trades/blast/platforms/uniswap_v2_blast_base_trades.sql @@ -0,0 +1,21 @@ +{{ + config( + schema = 'uniswap_v2_blast', + alias = 'base_trades', + materialized = 'incremental', + file_format = 'delta', + incremental_strategy = 'merge', + unique_key = ['tx_hash', 'evt_index'], + incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.block_time')] + ) +}} + +{{ + uniswap_compatible_v2_trades( + blockchain = 'blast', + project = 'uniswap', + version = '2', + Pair_evt_Swap = source('uniswap_v2_blast', 'Pair_evt_Swap'), + Factory_evt_PairCreated = source('uniswap_v2_blast', 'UniswapV2Factory_evt_PairCreated') + ) +}} diff --git a/dex/models/trades/blast/platforms/uniswap_v3_blast_base_trades.sql b/dex/models/trades/blast/platforms/uniswap_v3_blast_base_trades.sql new file mode 100644 index 00000000000..fe8f6918945 --- /dev/null +++ b/dex/models/trades/blast/platforms/uniswap_v3_blast_base_trades.sql @@ -0,0 +1,20 @@ +{{ config( + schema = 'uniswap_v3_blast' + , alias = 'base_trades' + , materialized = 'incremental' + , file_format = 'delta' + , incremental_strategy = 'merge' + , unique_key = ['tx_hash', 'evt_index'] + , incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.block_time')] + ) +}} + +{{ + uniswap_compatible_v3_trades( + blockchain = 'blast' + , project = 'uniswap' + , version = '3' + , Pair_evt_Swap = source('uniswap_v3_blast', 'UniswapV3Pool_evt_Swap') + , Factory_evt_PoolCreated = source('uniswap_v3_blast', 'UniswapV3Factory_evt_PoolCreated') + ) +}} diff --git a/dex/models/trades/dex_base_trades.sql b/dex/models/trades/dex_base_trades.sql index 38c0f907536..aeca281ccc4 100644 --- a/dex/models/trades/dex_base_trades.sql +++ b/dex/models/trades/dex_base_trades.sql @@ -26,6 +26,7 @@ , ref('dex_zora_base_trades') , ref('dex_zkevm_base_trades') , ref('dex_linea_base_trades') + , ref('dex_blast_base_trades') ] %} with base_union as ( diff --git a/dex/seeds/trades/_schema.yml b/dex/seeds/trades/_schema.yml index b5273aeb52d..864cf01b259 100644 --- a/dex/seeds/trades/_schema.yml +++ b/dex/seeds/trades/_schema.yml @@ -1920,6 +1920,21 @@ seeds: token_sold_amount_raw: uint256 block_date: timestamp + - name: uniswap_blast_base_trades_seed + config: + column_types: + blockchain: varchar + project: varchar + version: varchar + tx_hash: varbinary + evt_index: uint256 + block_number: uint256 + token_bought_address: varbinary + token_sold_address: varbinary + token_bought_amount_raw: uint256 + token_sold_amount_raw: uint256 + block_date: timestamp + - name: uniswap_celo_base_trades_seed config: column_types: diff --git a/dex/seeds/trades/uniswap_blast_base_trades_seed.csv b/dex/seeds/trades/uniswap_blast_base_trades_seed.csv new file mode 100644 index 00000000000..9b0153e8d42 --- /dev/null +++ b/dex/seeds/trades/uniswap_blast_base_trades_seed.csv @@ -0,0 +1,5 @@ +blockchain,project,version,block_date,tx_hash,evt_index,token_bought_address,token_sold_address,block_number,token_bought_amount_raw,token_sold_amount_raw +blast,uniswap,3,2024-05-23,0x551d4e0f41354ae704d4741dcf4cc04545e8d57244970f82aa555e1133b7540d,46,0x4300000000000000000000000000000000000003,0x4300000000000000000000000000000000000004,3838988,1493638757736905160844,398348972910668948 +blast,uniswap,3,2024-04-16,0x179f36ba037f73bba13287344a8500eb1d2afbc0d431397cd53a01dc3f7b4526,7,0x4300000000000000000000000000000000000004,0x2416092f143378750bb29b79ed961ab195cceea5,2246306,2105445002466536,2057258487654622 +blast,uniswap,2,2024-06-07,0x1719c8d79cc064f4863417c7fae613857ef1c3b6a30f0071d9e416b4bb8385ec,23,0x4300000000000000000000000000000000000003,0x4300000000000000000000000000000000000004,4471336,1135362542678049275,298977031258286 +blast,uniswap,2,2024-04-16,0x5057cf71829bebf2b9c9c19255355125906ec48123743fbdfbec6b6aa5c363a5,8,0x4300000000000000000000000000000000000003,0x4300000000000000000000000000000000000004,2215230,30824068867802868,10000000000000 diff --git a/sources/_sector/dex/trades/blast/_sources.yml b/sources/_sector/dex/trades/blast/_sources.yml new file mode 100644 index 00000000000..67a7326cd80 --- /dev/null +++ b/sources/_sector/dex/trades/blast/_sources.yml @@ -0,0 +1,11 @@ +version: 2 + +sources: + - name: uniswap_v3_blast + tables: + - name: UniswapV3Pool_evt_Swap + - name: UniswapV3Factory_evt_PoolCreated + - name: uniswap_v2_blast + tables: + - name: Pair_evt_Swap + - name: UniswapV2Factory_evt_PairCreated \ No newline at end of file From 6f401a1a4539053d4d1a774f3b6b7ad497c17b60 Mon Sep 17 00:00:00 2001 From: blanchemaria6 <130497866+blanchemaria6@users.noreply.github.com> Date: Tue, 18 Jun 2024 20:30:46 +0700 Subject: [PATCH 136/149] Add horizondex on linea to dex.trades (#6166) Co-authored-by: Huang Geyang Co-authored-by: jeff-dude <102681548+jeff-dude@users.noreply.github.com> --- dex/models/trades/linea/_schema.yml | 20 +++++++ .../trades/linea/dex_linea_base_trades.sql | 1 + .../horizondex_linea_base_trades.sql | 56 +++++++++++++++++++ dex/seeds/trades/_schema.yml | 16 ++++++ .../horizondex_linea_base_trades_seed.csv | 2 + sources/_sector/dex/trades/linea/_sources.yml | 7 ++- 6 files changed, 101 insertions(+), 1 deletion(-) create mode 100644 dex/models/trades/linea/platforms/horizondex_linea_base_trades.sql create mode 100644 dex/seeds/trades/horizondex_linea_base_trades_seed.csv diff --git a/dex/models/trades/linea/_schema.yml b/dex/models/trades/linea/_schema.yml index c98e569bd10..dc4e3f062bc 100644 --- a/dex/models/trades/linea/_schema.yml +++ b/dex/models/trades/linea/_schema.yml @@ -128,3 +128,23 @@ models: seed_file: ref('pancakeswap_linea_base_trades_seed') filter: version: 3 + + - name: horizondex_linea_base_trades + meta: + blockchain: linea + sector: dex + project: horizondex + contributors: blanchemaria6 + config: + tags: [ 'linea', 'dex', 'trades', 'horizondex' ] + description: "horizondex dex swaps on linea chain" + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - tx_hash + - evt_index + - check_dex_base_trades_seed: + seed_file: ref('horizondex_linea_base_trades_seed') + filter: + version: 1 + diff --git a/dex/models/trades/linea/dex_linea_base_trades.sql b/dex/models/trades/linea/dex_linea_base_trades.sql index fd743226c7c..b1b016b71e8 100644 --- a/dex/models/trades/linea/dex_linea_base_trades.sql +++ b/dex/models/trades/linea/dex_linea_base_trades.sql @@ -13,6 +13,7 @@ , ref('secta_linea_base_trades') , ref('pancakeswap_v2_linea_base_trades') , ref('pancakeswap_v3_linea_base_trades') + , ref('horizondex_linea_base_trades') ] %} WITH base_union AS ( diff --git a/dex/models/trades/linea/platforms/horizondex_linea_base_trades.sql b/dex/models/trades/linea/platforms/horizondex_linea_base_trades.sql new file mode 100644 index 00000000000..5704adbc357 --- /dev/null +++ b/dex/models/trades/linea/platforms/horizondex_linea_base_trades.sql @@ -0,0 +1,56 @@ +{{ + config( + schema = 'horizondex_linea' + , alias = 'base_trades' + , materialized = 'incremental' + , file_format = 'delta' + , incremental_strategy = 'merge' + , unique_key = ['tx_hash', 'evt_index'] + , incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.block_time')] + ) +}} + +WITH dexs AS +( + SELECT + t.evt_block_number AS block_number + , t.evt_block_time AS block_time + , t.recipient AS taker + , cast(null as varbinary) as maker + , CASE WHEN t.deltaQty0 < INT256 '0' THEN abs(t.deltaQty0) ELSE abs(t.deltaQty1) END AS token_bought_amount_raw -- when amount0 is negative it means trader_a is buying token0 from the pool + , CASE WHEN t.deltaQty0 < INT256 '0' THEN abs(t.deltaQty1) ELSE abs(t.deltaQty0) END AS token_sold_amount_raw + , CASE WHEN t.deltaQty0 < INT256 '0' THEN f.token0 ELSE f.token1 END AS token_bought_address + , CASE WHEN t.deltaQty0 < INT256 '0' THEN f.token1 ELSE f.token0 END AS token_sold_address + , t.contract_address as project_contract_address + , t.evt_tx_hash AS tx_hash + , t.evt_index + FROM + {{ source('horizondex_linea', 'Pool_evt_Swap') }} t + INNER JOIN + {{ source('horizondex_linea', 'Factory_evt_PoolCreated') }} f + ON f.pool = t.contract_address + {% if is_incremental() %} + WHERE + {{ incremental_predicate('t.evt_block_time') }} + {% endif %} +) + +SELECT + 'linea' AS blockchain + ,'horizondex' AS project + ,'1' AS version + , CAST(date_trunc('month', dexs.block_time) AS date) AS block_month + , CAST(date_trunc('day', dexs.block_time) AS date) AS block_date + , dexs.block_time + , dexs.block_number + , CAST(dexs.token_bought_amount_raw AS UINT256) AS token_bought_amount_raw + , CAST(dexs.token_sold_amount_raw AS UINT256) AS token_sold_amount_raw + , dexs.token_bought_address + , dexs.token_sold_address + , dexs.taker + , dexs.maker + , dexs.project_contract_address + , dexs.tx_hash + , dexs.evt_index +FROM + dexs \ No newline at end of file diff --git a/dex/seeds/trades/_schema.yml b/dex/seeds/trades/_schema.yml index 864cf01b259..35f81fa5160 100644 --- a/dex/seeds/trades/_schema.yml +++ b/dex/seeds/trades/_schema.yml @@ -3616,6 +3616,21 @@ seeds: token_sold_amount_raw: uint256 block_date: timestamp + - name: horizondex_linea_base_trades_seed + config: + column_types: + blockchain: varchar + project: varchar + version: varchar + tx_hash: varbinary + evt_index: uint256 + block_number: uint256 + token_bought_address: varbinary + token_sold_address: varbinary + token_bought_amount_raw: uint256 + token_sold_amount_raw: uint256 + block_date: timestamp + - name: dackieswap_v3_arbitrum_base_trades_seed config: column_types: @@ -3645,3 +3660,4 @@ seeds: token_bought_amount_raw: uint256 token_sold_amount_raw: uint256 block_date: timestamp + diff --git a/dex/seeds/trades/horizondex_linea_base_trades_seed.csv b/dex/seeds/trades/horizondex_linea_base_trades_seed.csv new file mode 100644 index 00000000000..1d024e32bcd --- /dev/null +++ b/dex/seeds/trades/horizondex_linea_base_trades_seed.csv @@ -0,0 +1,2 @@ +blockchain,project,version,block_date,tx_hash,evt_index,token_bought_address,token_sold_address,block_number,token_bought_amount_raw,token_sold_amount_raw +linea,horizondex,1,2024-03-31,0x96944de91cdace41b3a31e9009be155923c57a0231ebd2f806e8991aa32f39fd,122,0x3aab2285ddcddad8edf438c1bab47e1a9d05a9b4,0xe5d7c2a44ffddf6b295a15c148167daaaf5cf34f,3276720,3,596000000000 diff --git a/sources/_sector/dex/trades/linea/_sources.yml b/sources/_sector/dex/trades/linea/_sources.yml index 065727d0f1c..d6cad87de38 100644 --- a/sources/_sector/dex/trades/linea/_sources.yml +++ b/sources/_sector/dex/trades/linea/_sources.yml @@ -28,4 +28,9 @@ sources: - name: pancakeswap_v3_linea tables: - name: PancakeV3Pool_evt_Swap - - name: PancakeV3Factory_evt_PoolCreated \ No newline at end of file + - name: PancakeV3Factory_evt_PoolCreated + - name: horizondex_linea + tables: + - name: Pool_evt_Swap + - name: Factory_evt_PoolCreated + From ae2d873923f3205593a8761e2da8d66a7c596663 Mon Sep 17 00:00:00 2001 From: blanchemaria6 <130497866+blanchemaria6@users.noreply.github.com> Date: Tue, 18 Jun 2024 20:31:33 +0700 Subject: [PATCH 137/149] Add gridex on polygon to dex.trades (#6143) * Add gridex on polygon to dex.trades * update seed * Add gridex_polygon_base_trades_seed schema --------- Co-authored-by: Huang Geyang Co-authored-by: jeff-dude <102681548+jeff-dude@users.noreply.github.com> --- dex/models/trades/polygon/_schema.yml | 20 +++++++++++++++ .../polygon/dex_polygon_base_trades.sql | 1 + .../platforms/gridex_polygon_base_trades.sql | 25 +++++++++++++++++++ dex/seeds/trades/_schema.yml | 16 +++++++++++- .../gridex_polygon_base_trades_seed.csv | 2 ++ .../_sector/dex/trades/polygon/_sources.yml | 5 ++++ 6 files changed, 68 insertions(+), 1 deletion(-) create mode 100644 dex/models/trades/polygon/platforms/gridex_polygon_base_trades.sql create mode 100644 dex/seeds/trades/gridex_polygon_base_trades_seed.csv diff --git a/dex/models/trades/polygon/_schema.yml b/dex/models/trades/polygon/_schema.yml index 84f43ca6795..0973adf831e 100644 --- a/dex/models/trades/polygon/_schema.yml +++ b/dex/models/trades/polygon/_schema.yml @@ -324,3 +324,23 @@ models: seed_file: ref('uniswap_polygon_base_trades_seed') filter: version: 2 + + - name: gridex_polygon_base_trades + meta: + blockchain: polygon + sector: dex + project: gridex + contributors: blanchemaria6 + config: + tags: [ 'polygon', 'dex', 'trades', 'gridex' ] + description: "gridex polygon base trades" + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - tx_hash + - evt_index + - check_dex_base_trades_seed: + seed_file: ref('gridex_polygon_base_trades_seed') + filter: + version: 1 + diff --git a/dex/models/trades/polygon/dex_polygon_base_trades.sql b/dex/models/trades/polygon/dex_polygon_base_trades.sql index c1535918c44..32921be9f6e 100644 --- a/dex/models/trades/polygon/dex_polygon_base_trades.sql +++ b/dex/models/trades/polygon/dex_polygon_base_trades.sql @@ -22,6 +22,7 @@ , ref('xchange_polygon_base_trades') , ref('dooar_polygon_base_trades') , ref('uniswap_v2_polygon_base_trades') + , ref('gridex_polygon_base_trades') ] %} WITH base_union AS ( diff --git a/dex/models/trades/polygon/platforms/gridex_polygon_base_trades.sql b/dex/models/trades/polygon/platforms/gridex_polygon_base_trades.sql new file mode 100644 index 00000000000..91e775b4219 --- /dev/null +++ b/dex/models/trades/polygon/platforms/gridex_polygon_base_trades.sql @@ -0,0 +1,25 @@ +{{ + config( + schema = 'gridex_polygon', + alias = 'base_trades', + materialized = 'incremental', + file_format = 'delta', + incremental_strategy = 'merge', + unique_key = ['tx_hash', 'evt_index'], + incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.block_time')] + ) +}} + +{{ + uniswap_compatible_v3_trades( + blockchain = 'polygon', + project = 'gridex', + version = '1', + Pair_evt_Swap = source('gridex_polygon', 'GridPair_evt_Swap'), + Factory_evt_PoolCreated = source('gridex_polygon', 'GridFactory_evt_GridCreated'), + taker_column_name = 'sender', + maker_column_name = 'recipient', + optional_columns = null, + pair_column_name = 'grid' + ) +}} \ No newline at end of file diff --git a/dex/seeds/trades/_schema.yml b/dex/seeds/trades/_schema.yml index 35f81fa5160..647dae3abb1 100644 --- a/dex/seeds/trades/_schema.yml +++ b/dex/seeds/trades/_schema.yml @@ -3616,6 +3616,21 @@ seeds: token_sold_amount_raw: uint256 block_date: timestamp + - name: gridex_polygon_base_trades_seed + config: + column_types: + blockchain: varchar + project: varchar + version: varchar + tx_hash: varbinary + evt_index: uint256 + block_number: uint256 + token_bought_address: varbinary + token_sold_address: varbinary + token_bought_amount_raw: uint256 + token_sold_amount_raw: uint256 + block_date: timestamp + - name: horizondex_linea_base_trades_seed config: column_types: @@ -3660,4 +3675,3 @@ seeds: token_bought_amount_raw: uint256 token_sold_amount_raw: uint256 block_date: timestamp - diff --git a/dex/seeds/trades/gridex_polygon_base_trades_seed.csv b/dex/seeds/trades/gridex_polygon_base_trades_seed.csv new file mode 100644 index 00000000000..a1da116e461 --- /dev/null +++ b/dex/seeds/trades/gridex_polygon_base_trades_seed.csv @@ -0,0 +1,2 @@ +blockchain,project,version,block_date,tx_hash,evt_index,token_bought_address,token_sold_address,block_number,token_bought_amount_raw,token_sold_amount_raw +polygon,gridex,1,2023-09-05,0x66c372a49c17f07337b331fe5e76ceda9b968e6cf22170c88281632637e53276,120,0x2791bca1f2de4661ed88a30c99a7a9449aa84174,0x924442a46eac25646b520da8d78218ae8ff437c2,47167864,72079513,30000000000000000000000 \ No newline at end of file diff --git a/sources/_sector/dex/trades/polygon/_sources.yml b/sources/_sector/dex/trades/polygon/_sources.yml index 257019868af..11b86d16b27 100644 --- a/sources/_sector/dex/trades/polygon/_sources.yml +++ b/sources/_sector/dex/trades/polygon/_sources.yml @@ -60,3 +60,8 @@ sources: tables: - name: DooarSwapV2Pair_evt_Swap - name: DooarSwapV2Factory_evt_PairCreated + - name: gridex_polygon + tables: + - name: GridFactory_evt_GridCreated + - name: GridPair_evt_Swap + From 661743a03ff6e7e43f89303bd340ce0b99d8185c Mon Sep 17 00:00:00 2001 From: blanchemaria6 <130497866+blanchemaria6@users.noreply.github.com> Date: Tue, 18 Jun 2024 20:34:13 +0700 Subject: [PATCH 138/149] Add smardex on polygon to dex.trades (#6128) * add smardex on polygon to dex.trades * update source * fix bug * update seed * update seed * update seed --------- Co-authored-by: Huang Geyang Co-authored-by: jeff-dude Co-authored-by: jeff-dude <102681548+jeff-dude@users.noreply.github.com> --- dex/models/trades/polygon/_schema.yml | 18 ++++++++++++- .../polygon/dex_polygon_base_trades.sql | 1 + .../platforms/smardex_polygon_base_trades.sql | 25 +++++++++++++++++++ dex/seeds/trades/_schema.yml | 15 +++++++++++ .../smardex_polygon_base_trades_seed.csv | 2 ++ .../_sector/dex/trades/polygon/_sources.yml | 5 +++- 6 files changed, 64 insertions(+), 2 deletions(-) create mode 100644 dex/models/trades/polygon/platforms/smardex_polygon_base_trades.sql create mode 100644 dex/seeds/trades/smardex_polygon_base_trades_seed.csv diff --git a/dex/models/trades/polygon/_schema.yml b/dex/models/trades/polygon/_schema.yml index 0973adf831e..5b092fa9319 100644 --- a/dex/models/trades/polygon/_schema.yml +++ b/dex/models/trades/polygon/_schema.yml @@ -325,6 +325,23 @@ models: filter: version: 2 + - name: smardex_polygon_base_trades + meta: + blockchain: polygon + sector: dex + project: smardex + contributors: blanchemaria6 + config: + tags: [ 'base', 'dex', 'trades', 'smardex' ] + description: "smardex base trades on polygon" + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - tx_hash + - evt_index + - check_dex_base_trades_seed: + seed_file: ref('smardex_polygon_base_trades_seed') + - name: gridex_polygon_base_trades meta: blockchain: polygon @@ -343,4 +360,3 @@ models: seed_file: ref('gridex_polygon_base_trades_seed') filter: version: 1 - diff --git a/dex/models/trades/polygon/dex_polygon_base_trades.sql b/dex/models/trades/polygon/dex_polygon_base_trades.sql index 32921be9f6e..e809ba3c03b 100644 --- a/dex/models/trades/polygon/dex_polygon_base_trades.sql +++ b/dex/models/trades/polygon/dex_polygon_base_trades.sql @@ -22,6 +22,7 @@ , ref('xchange_polygon_base_trades') , ref('dooar_polygon_base_trades') , ref('uniswap_v2_polygon_base_trades') + , ref('smardex_polygon_base_trades') , ref('gridex_polygon_base_trades') ] %} diff --git a/dex/models/trades/polygon/platforms/smardex_polygon_base_trades.sql b/dex/models/trades/polygon/platforms/smardex_polygon_base_trades.sql new file mode 100644 index 00000000000..8267cfa2426 --- /dev/null +++ b/dex/models/trades/polygon/platforms/smardex_polygon_base_trades.sql @@ -0,0 +1,25 @@ +{{ + config( + schema = 'smardex_polygon', + alias = 'base_trades', + materialized = 'incremental', + file_format = 'delta', + incremental_strategy = 'merge', + unique_key = ['tx_hash', 'evt_index'], + incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.block_time')] + ) +}} + +{{ + uniswap_compatible_v3_trades( + blockchain = 'polygon', + project = 'smardex', + version = '1', + Pair_evt_Swap = source('smardex_polygon', 'SmardexPair_evt_Swap'), + Factory_evt_PoolCreated = source('smardex_polygon', 'SmardexFactory_evt_PairCreated'), + taker_column_name = 'to', + maker_column_name = 'contract_address', + optional_columns = null, + pair_column_name = 'pair' + ) +}} \ No newline at end of file diff --git a/dex/seeds/trades/_schema.yml b/dex/seeds/trades/_schema.yml index 647dae3abb1..7b366cf6143 100644 --- a/dex/seeds/trades/_schema.yml +++ b/dex/seeds/trades/_schema.yml @@ -3615,6 +3615,21 @@ seeds: token_bought_amount_raw: uint256 token_sold_amount_raw: uint256 block_date: timestamp + + - name: smardex_polygon_base_trades_seed + config: + column_types: + blockchain: varchar + project: varchar + version: varchar + tx_hash: varbinary + evt_index: uint256 + block_number: uint256 + token_bought_address: varbinary + token_sold_address: varbinary + token_bought_amount_raw: uint256 + token_sold_amount_raw: uint256 + block_date: timestamp - name: gridex_polygon_base_trades_seed config: diff --git a/dex/seeds/trades/smardex_polygon_base_trades_seed.csv b/dex/seeds/trades/smardex_polygon_base_trades_seed.csv new file mode 100644 index 00000000000..378423e69e4 --- /dev/null +++ b/dex/seeds/trades/smardex_polygon_base_trades_seed.csv @@ -0,0 +1,2 @@ +blockchain,project,version,block_date,tx_hash,evt_index,token_bought_address,token_sold_address,block_number,token_bought_amount_raw,token_sold_amount_raw +polygon,smardex,1,2024-06-11,0x885b2833498c911aca89a8c0219686583538c75706795b25c478cba709756418,476,0x0d500b1d8e8ef31e21c99d1db9a6444d3adf1270,0x1bfd67037b42cf73acf2047067bd4f2c47d9bfd6,58014407,3503000228043981967,3290 \ No newline at end of file diff --git a/sources/_sector/dex/trades/polygon/_sources.yml b/sources/_sector/dex/trades/polygon/_sources.yml index 11b86d16b27..809afc01557 100644 --- a/sources/_sector/dex/trades/polygon/_sources.yml +++ b/sources/_sector/dex/trades/polygon/_sources.yml @@ -60,8 +60,11 @@ sources: tables: - name: DooarSwapV2Pair_evt_Swap - name: DooarSwapV2Factory_evt_PairCreated + - name: smardex_polygon + tables: + - name: SmardexPair_evt_Swap + - name: SmardexFactory_evt_PairCreated - name: gridex_polygon tables: - name: GridFactory_evt_GridCreated - name: GridPair_evt_Swap - From 51ac6513d05b90bd05aab3ef8286670a837c8e29 Mon Sep 17 00:00:00 2001 From: henrystats <65398020+henrystats@users.noreply.github.com> Date: Tue, 18 Jun 2024 14:34:37 +0100 Subject: [PATCH 139/149] Add superchief NFT Trades - Ready for Review (#6184) * Add superchief NFT Trades * fix seed --------- Co-authored-by: 0xRob <83790096+0xRobin@users.noreply.github.com> --- .../nft_avalanche_c_base_trades.sql | 1 + .../chains/avalanche_c/platforms/_schema.yml | 26 +++++++ .../superchief_avalanche_c_base_trades.sql | 74 +++++++++++++++++++ nft/seeds/trades/base_trades/_schema.yml | 10 +++ ...uperchief_avalanche_c_base_trades_seed.csv | 3 + .../nft/trades/avalanche_c_sources.yml | 6 +- 6 files changed, 119 insertions(+), 1 deletion(-) create mode 100644 nft/models/_sector/trades/chains/avalanche_c/platforms/superchief_avalanche_c_base_trades.sql create mode 100644 nft/seeds/trades/base_trades/superchief_avalanche_c_base_trades_seed.csv diff --git a/nft/models/_sector/trades/chains/avalanche_c/nft_avalanche_c_base_trades.sql b/nft/models/_sector/trades/chains/avalanche_c/nft_avalanche_c_base_trades.sql index ed393b130a8..f3e89ffb26b 100644 --- a/nft/models/_sector/trades/chains/avalanche_c/nft_avalanche_c_base_trades.sql +++ b/nft/models/_sector/trades/chains/avalanche_c/nft_avalanche_c_base_trades.sql @@ -14,6 +14,7 @@ ,ref('element_avalanche_c_base_trades') ,ref('opensea_v3_avalanche_c_base_trades') ,ref('opensea_v4_avalanche_c_base_trades') + ,ref('superchief_avalanche_c_base_trades') ] %} diff --git a/nft/models/_sector/trades/chains/avalanche_c/platforms/_schema.yml b/nft/models/_sector/trades/chains/avalanche_c/platforms/_schema.yml index eebffe3179f..21c74c1f67c 100644 --- a/nft/models/_sector/trades/chains/avalanche_c/platforms/_schema.yml +++ b/nft/models/_sector/trades/chains/avalanche_c/platforms/_schema.yml @@ -185,3 +185,29 @@ models: - block_number - tx_hash - sub_tx_trade_id + + - name: superchief_avalanche_c_base_trades + meta: + blockchain: avalanche_c + sector: nft + project: superchief + contributors: Henrystats + config: + tags: ['avalanche', 'nft', 'trades', 'superchief'] + description: "Superchief base trades" + tests: + - check_columns_nft_base_trades + - dbt_utils.unique_combination_of_columns: + combination_of_columns: ['block_number','tx_hash','sub_tx_trade_id'] + - check_seed: + seed_file: ref('superchief_avalanche_c_base_trades_seed') + match_columns: + - block_number + - tx_hash + - sub_tx_trade_id + check_columns: + - buyer + - seller + - nft_contract_address + - nft_token_id + - price_raw \ No newline at end of file diff --git a/nft/models/_sector/trades/chains/avalanche_c/platforms/superchief_avalanche_c_base_trades.sql b/nft/models/_sector/trades/chains/avalanche_c/platforms/superchief_avalanche_c_base_trades.sql new file mode 100644 index 00000000000..5864cf5f53c --- /dev/null +++ b/nft/models/_sector/trades/chains/avalanche_c/platforms/superchief_avalanche_c_base_trades.sql @@ -0,0 +1,74 @@ +{{ config( + schema='superchief_avalanche_c', + alias = 'base_trades', + materialized = 'incremental', + file_format = 'delta', + incremental_strategy = 'merge', + unique_key = ['block_number','tx_hash','sub_tx_trade_id'] +)}} + +WITH + +auction_started_event as ( + SELECT + amount as nft_amount, + evt_block_time, + 'Auction Sale' as trade_category, + id as auction_id, + tokenId as nft_token_id, + CASE + WHEN paymentToken = 0x0000000000000000000000000000000000000000 THEN 0xB31f66AA3C1e785363F0875A1B74E27b85FD66c7 + ELSE paymentToken + END as currency_contract, + collection as nft_contract_address, + tx."from" as seller + FROM + {{source('avalanche_c', 'transactions')}} tx + INNER JOIN + {{ source('superchief_avalanche_c', 'AuctionManager_evt_NewAuction') }} au + ON au.evt_block_number = tx.block_number + AND au.evt_tx_hash = tx.hash + {% if is_incremental() %} + AND {{incremental_predicate('tx.block_time')}} + {% endif %} + {% if is_incremental() %} + WHERE {{incremental_predicate('evt_block_time')}} + {% endif %} +), + +base_trades as ( + SELECT + 'avalanche_c' as blockchain, + 'superchief' as project, + 'v1' as project_version, + ee.evt_block_time as block_time, + date_trunc('day',ee.evt_block_time) as block_date, + date_trunc('month',ee.evt_block_time) as block_month, + ae.nft_token_id, + 'Secondary' as trade_type, + ae.nft_amount, + ae.trade_category, + ae.seller, + ee.winner as buyer, + ee.bidPrice as price_raw, + ae.currency_contract, + ae.nft_contract_address, + ee.evt_tx_hash as tx_hash, + ee.contract_address as project_contract_address, + ee.evt_block_number as block_number, + CAST(NULL as UINT256) as platform_fee_amount_raw, + CAST(NULL AS UINT256) as royalty_fee_amount_raw, + CAST(NULL as VARBINARY) royalty_fee_address, + CAST(NULL as VARBINARY) as platform_fee_address, + ee.evt_index as sub_tx_trade_id + FROM + {{ source('superchief_avalanche_c', 'AuctionManager_evt_AuctionFinished') }} ee + LEFT JOIN + auction_started_event ae + ON ee.id = ae.auction_id + {% if is_incremental() %} + WHERE {{incremental_predicate('ee.evt_block_time')}} + {% endif %} +) + +{{add_nft_tx_data('base_trades','avalanche_c')}} \ No newline at end of file diff --git a/nft/seeds/trades/base_trades/_schema.yml b/nft/seeds/trades/base_trades/_schema.yml index fa6df2383da..3f2771475bc 100644 --- a/nft/seeds/trades/base_trades/_schema.yml +++ b/nft/seeds/trades/base_trades/_schema.yml @@ -452,3 +452,13 @@ seeds: token_id: uint256 block_date: date + - name: superchief_avalanche_c_base_trades_seed + config: + column_types: + tx_hash: varbinary + buyer: varbinary + seller: varbinary + nft_contract_address: varbinary + price_raw: uint256 + nft_token_id: uint256 + diff --git a/nft/seeds/trades/base_trades/superchief_avalanche_c_base_trades_seed.csv b/nft/seeds/trades/base_trades/superchief_avalanche_c_base_trades_seed.csv new file mode 100644 index 00000000000..849d13427c5 --- /dev/null +++ b/nft/seeds/trades/base_trades/superchief_avalanche_c_base_trades_seed.csv @@ -0,0 +1,3 @@ +block_number,tx_hash,sub_tx_trade_id,buyer,seller,nft_contract_address,nft_token_id,price_raw +36121339,0x6edabeca4aa843f13fab5c8800adb113567a4daefb2e11db52db8da790fc4fdc,3,0x221541e0b15058e677181a8c977f6a3a2f87a26b,0xB8Ad671479618b7E204b82C16D7d4aA675C71CA6,0x6d15a7192f8e9ad55a72b997df0986d712c31cbf,13,20000000000000000000 +34870682,0xfa9454db02b85154742e0a73818b77a625bb0653966683bbbabe610cc79130e0,4,0x054391ce4dfd63aac0a0d11db14d3593bb0ded1e,0x35429d0F7A70D777f29C6fE504056888717B086b,0xd78275056849d420f38dc4da2c05d748692adc5f,3,130000000000000000 diff --git a/sources/_sector/nft/trades/avalanche_c_sources.yml b/sources/_sector/nft/trades/avalanche_c_sources.yml index c7596548b79..939f29cc5d7 100644 --- a/sources/_sector/nft/trades/avalanche_c_sources.yml +++ b/sources/_sector/nft/trades/avalanche_c_sources.yml @@ -14,4 +14,8 @@ sources: tables: - name: JoepegExchange_evt_TakerBid - name: JoepegExchange_evt_TakerAsk - - name: JoepegExchange_evt_RoyaltyPayment \ No newline at end of file + - name: JoepegExchange_evt_RoyaltyPayment + - name: superchief_avalanche_c + tables: + - name: AuctionManager_evt_NewAuction + - name: AuctionManager_evt_AuctionFinished \ No newline at end of file From 221cb33380ff75052a6d01a777a383bd4d8a8882 Mon Sep 17 00:00:00 2001 From: henrystats <65398020+henrystats@users.noreply.github.com> Date: Tue, 18 Jun 2024 14:37:18 +0100 Subject: [PATCH 140/149] Add Salvor Avalanche NFT Trades - Ready for review (#6182) * Add Salvor Avalanche NFT Trades * update seeds * fix date --------- Co-authored-by: 0xRob <83790096+0xRobin@users.noreply.github.com> Co-authored-by: jeff-dude <102681548+jeff-dude@users.noreply.github.com> --- .../nft_avalanche_c_base_trades.sql | 1 + .../chains/avalanche_c/platforms/_schema.yml | 29 +++++- .../chikn_avalanche_c_base_trades.sql | 2 +- .../salvor_avalanche_c_base_trades.sql | 89 +++++++++++++++++++ nft/seeds/trades/base_trades/_schema.yml | 11 +++ .../salvor_avalanche_c_base_trades_seed.csv | 3 + .../nft/trades/avalanche_c_sources.yml | 6 +- 7 files changed, 138 insertions(+), 3 deletions(-) create mode 100644 nft/models/_sector/trades/chains/avalanche_c/platforms/salvor_avalanche_c_base_trades.sql create mode 100644 nft/seeds/trades/base_trades/salvor_avalanche_c_base_trades_seed.csv diff --git a/nft/models/_sector/trades/chains/avalanche_c/nft_avalanche_c_base_trades.sql b/nft/models/_sector/trades/chains/avalanche_c/nft_avalanche_c_base_trades.sql index f3e89ffb26b..59665afbdf3 100644 --- a/nft/models/_sector/trades/chains/avalanche_c/nft_avalanche_c_base_trades.sql +++ b/nft/models/_sector/trades/chains/avalanche_c/nft_avalanche_c_base_trades.sql @@ -14,6 +14,7 @@ ,ref('element_avalanche_c_base_trades') ,ref('opensea_v3_avalanche_c_base_trades') ,ref('opensea_v4_avalanche_c_base_trades') + ,ref('salvor_avalanche_c_base_trades') ,ref('superchief_avalanche_c_base_trades') ] %} diff --git a/nft/models/_sector/trades/chains/avalanche_c/platforms/_schema.yml b/nft/models/_sector/trades/chains/avalanche_c/platforms/_schema.yml index 21c74c1f67c..2784c610327 100644 --- a/nft/models/_sector/trades/chains/avalanche_c/platforms/_schema.yml +++ b/nft/models/_sector/trades/chains/avalanche_c/platforms/_schema.yml @@ -186,6 +186,33 @@ models: - tx_hash - sub_tx_trade_id + - name: salvor_avalanche_c_base_trades + meta: + blockchain: avalanche_c + sector: nft + project: salvor + contributors: Henrystats + config: + tags: ['avalanche', 'nft', 'trades', 'salvor'] + description: "Salvor base trades" + tests: + - check_columns_nft_base_trades + - dbt_utils.unique_combination_of_columns: + combination_of_columns: ['block_number','tx_hash','sub_tx_trade_id'] + - check_seed: + seed_file: ref('salvor_avalanche_c_base_trades_seed') + match_columns: + - block_number + - tx_hash + - sub_tx_trade_id + check_columns: + - buyer + - seller + - nft_contract_address + - nft_token_id + - price_raw + - royalty_fee_amount_raw + - name: superchief_avalanche_c_base_trades meta: blockchain: avalanche_c @@ -210,4 +237,4 @@ models: - seller - nft_contract_address - nft_token_id - - price_raw \ No newline at end of file + - price_raw diff --git a/nft/models/_sector/trades/chains/avalanche_c/platforms/chikn_avalanche_c_base_trades.sql b/nft/models/_sector/trades/chains/avalanche_c/platforms/chikn_avalanche_c_base_trades.sql index b01ca4450b1..fe9b42f85a3 100644 --- a/nft/models/_sector/trades/chains/avalanche_c/platforms/chikn_avalanche_c_base_trades.sql +++ b/nft/models/_sector/trades/chains/avalanche_c/platforms/chikn_avalanche_c_base_trades.sql @@ -14,7 +14,7 @@ WITH base_trades as ( SELECT 'avalanche_c' as blockchain, - 'joepegs' as project, + 'chikn' as project, 'v1' as project_version, evt_block_time as block_time, date_trunc('day', evt_block_time) as block_date, diff --git a/nft/models/_sector/trades/chains/avalanche_c/platforms/salvor_avalanche_c_base_trades.sql b/nft/models/_sector/trades/chains/avalanche_c/platforms/salvor_avalanche_c_base_trades.sql new file mode 100644 index 00000000000..4a376605bce --- /dev/null +++ b/nft/models/_sector/trades/chains/avalanche_c/platforms/salvor_avalanche_c_base_trades.sql @@ -0,0 +1,89 @@ +{{ config( + schema='salvor_avalanche_c', + alias = 'base_trades', + materialized = 'incremental', + file_format = 'delta', + incremental_strategy = 'merge', + unique_key = ['block_number','tx_hash','sub_tx_trade_id'] +)}} + +{% set project_start_date = '2022-10-29' %} + +WITH + +events as ( + SELECT + evt_block_time, + tokenId as nft_token_id, + UINT256 '1' as nft_amount, + 'Trade' as trade_category, + buyer, + bid as price_raw, + 0xB31f66AA3C1e785363F0875A1B74E27b85FD66c7 as currency_contract, + collection as nft_contract_address, + evt_tx_hash, + contract_address, + evt_block_number, + evt_index + FROM + {{ source('salvor_avalanche_c', 'Marketplace_evt_AcceptCollectionOffer') }} + {% if is_incremental() %} + WHERE {{incremental_predicate('evt_block_time')}} + {% endif %} +), + +royalty_payment as ( + SELECT + evt_tx_hash, + collection, + tokenId, + SUM(amount) as amount, + MIN_BY(royaltyReceiver, evt_index) as royaltyRecipient, + MIN_BY(_seller, evt_index) as seller, + COUNT(*) as number_of_payments -- when there are multiple payments, the royalty_fee_address & seller is null + FROM + {{ source('salvor_avalanche_c', 'PaymentManager_evt_RoyaltyReceived') }} + {% if is_incremental() %} + WHERE {{incremental_predicate('evt_block_time')}} + {% endif %} + GROUP BY 1, 2, 3 +), + +base_trades as ( + SELECT + 'avalanche_c' as blockchain, + 'salvor' as project, + 'v1' as project_version, + ee.evt_block_time as block_time, + date_trunc('day',ee.evt_block_time) as block_date, + date_trunc('month',ee.evt_block_time) as block_month, + ee.nft_token_id, + 'secondary' as trade_type, + ee.nft_amount, + ee.trade_category, + ra.seller, + ee.buyer, + ee.price_raw, + ee.currency_contract, + ee.nft_contract_address, + ee.evt_tx_hash as tx_hash, + ee.contract_address as project_contract_address, + ee.evt_block_number as block_number, + CAST(NULL as UINT256) as platform_fee_amount_raw, + ra.amount as royalty_fee_amount_raw, + CASE + WHEN number_of_payments = 1 THEN royaltyRecipient + ELSE CAST(NULL as VARBINARY) + END as royalty_fee_address, + CAST(NULL as VARBINARY) as platform_fee_address, + ee.evt_index as sub_tx_trade_id + FROM + events ee + LEFT JOIN + royalty_payment ra + ON ee.evt_tx_hash = ra.evt_tx_hash + AND ee.nft_contract_address = ra.collection + AND ee.nft_token_id = ra.tokenId +) + +{{add_nft_tx_data('base_trades','avalanche_c')}} diff --git a/nft/seeds/trades/base_trades/_schema.yml b/nft/seeds/trades/base_trades/_schema.yml index 3f2771475bc..79003a7c2a5 100644 --- a/nft/seeds/trades/base_trades/_schema.yml +++ b/nft/seeds/trades/base_trades/_schema.yml @@ -452,6 +452,17 @@ seeds: token_id: uint256 block_date: date + - name: salvor_avalanche_c_base_trades_seed + config: + column_types: + tx_hash: varbinary + buyer: varbinary + seller: varbinary + nft_contract_address: varbinary + price_raw: uint256 + royalty_fee_amount_raw: uint256 + nft_token_id: uint256 + - name: superchief_avalanche_c_base_trades_seed config: column_types: diff --git a/nft/seeds/trades/base_trades/salvor_avalanche_c_base_trades_seed.csv b/nft/seeds/trades/base_trades/salvor_avalanche_c_base_trades_seed.csv new file mode 100644 index 00000000000..e3fadd1e1d8 --- /dev/null +++ b/nft/seeds/trades/base_trades/salvor_avalanche_c_base_trades_seed.csv @@ -0,0 +1,3 @@ +block_number,tx_hash,sub_tx_trade_id,buyer,seller,nft_contract_address,nft_token_id,price_raw,royalty_fee_amount_raw +35388785,0xee3e3c521e08aad7ecbb2bebe1619813d84282de0fc60090f699cfe0d1cb96a8,0,0x9aa4b22a616d5cbc6834d3e5da877d17f93c2b77,0x3013c5c7bae60b1bb8e33311fe3c14c790beedc7,0xe1398278b7210fabb17c2abc948fb3ee688b786b,36,70000000000000000,7000000000000000 +29511671,0x6dc7b53f5916e597578d2bd901dfba9fbd2f7e75c90e6d4ea92566f8c976b52a,10,0x9a372e6797919473b5751b8853c7f46ef9e07615,0xc2d05d5350a9b5f7cd5c75ae5c67fdbed852a2e1,0xce4fee23ab35d0d9a4b6b644881ddd8adebeb300,9512,360000000000000000,27000000000000000 diff --git a/sources/_sector/nft/trades/avalanche_c_sources.yml b/sources/_sector/nft/trades/avalanche_c_sources.yml index 939f29cc5d7..f9fd3d43a96 100644 --- a/sources/_sector/nft/trades/avalanche_c_sources.yml +++ b/sources/_sector/nft/trades/avalanche_c_sources.yml @@ -15,7 +15,11 @@ sources: - name: JoepegExchange_evt_TakerBid - name: JoepegExchange_evt_TakerAsk - name: JoepegExchange_evt_RoyaltyPayment + - name: salvor_avalanche_c + tables: + - name: Marketplace_evt_AcceptCollectionOffer + - name: PaymentManager_evt_RoyaltyReceived - name: superchief_avalanche_c tables: - name: AuctionManager_evt_NewAuction - - name: AuctionManager_evt_AuctionFinished \ No newline at end of file + - name: AuctionManager_evt_AuctionFinished From 3e8c0bcd74e948e29d49ebaaa1c6230c648ad07e Mon Sep 17 00:00:00 2001 From: Lorenz Lehmann <90760534+lorenz234@users.noreply.github.com> Date: Tue, 18 Jun 2024 15:37:43 +0200 Subject: [PATCH 141/149] fix and extend blob submitter mapping (#6188) * fix and extend blob submitter mapping * retry engine --- models/blobs/ethereum/blobs_submitters.sql | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/models/blobs/ethereum/blobs_submitters.sql b/models/blobs/ethereum/blobs_submitters.sql index eb934c599b5..eec6692f003 100644 --- a/models/blobs/ethereum/blobs_submitters.sql +++ b/models/blobs/ethereum/blobs_submitters.sql @@ -28,7 +28,22 @@ SELECT address , (0xc94c243f8fb37223f3eb2f7961f7072602a51b8b, 'Metal') , (0xe1b64045351b0b6e9821f19b39f81bc4711d2230, 'Boba Network') , (0x08f9f14ff43e112b18c96f0986f28cb1878f1d11, 'Camp Network') - , (0x5ead389b57d533a94a0eacd570dc1cc59c25f2d4, 'Public Goods Network') + , (0x5ead389b57d533a94a0eacd570dc1cc59c25f2d4, 'Parallel') , (0xcf2898225ed05be911d3709d9417e86e0b4cfc8f, 'Scroll') , (0xa6ea2f3299b63c53143c993d2d5e60a69cd6fe24, 'Lisk') + , (0x3d0bf26e60a689a7da5ea3ddad7371f27f7671a5, 'Optopia') + , (0x5c53f2ff1030c7fbc0616fd5b8fc6be97aa27e00, 'Lumio') + , (0x1fd6a75cc72f39147756a663f3ef1fc95ef89495, 'opBNB') + , (0xa76e31d8471d569efdd3d95d1b11ce6710f4533f, 'Manta') + , (0x84bdfb21ed7c8b332a42bfd595744a84f3101e4e, 'Karak') + , (0x994c288de8418c8d3c5a4d21a69f35bf9641781c, 'Hypr') + , (0x6079e9c37b87fe06d0bde2431a0fa309826c9b67, 'Ancient8') + , (0x2f6afe2e3fea041b892a6e240fd1a0e5b51e8376, 'Mantle') + , (0xcdf02971871b7736874e20b8487c019d28090019, 'Metis') + , (0xf8db8aba597ff36ccd16fecfbb1b816b3236e9b8, 'Orderly') + , (0xdec273bf31ad79ad00d619c52662f724176a12fb, 'Lambda') + , (0x68bdfece01535090c8f3c27ec3b1ae97e83fa4aa, 'Mint') + , (0x000000633b68f5d8d3a86593ebb815b4663bcbe0, 'Taiko') + , (0x52ee324F2bCD0c5363d713eb9f62D1eE47266ac1, 'Rari') + , (0x7ab7da0c3117d7dfe0abfaa8d8d33883f8477c74, 'Debank Chain') ) AS x(address, entity) From a3c6aafdde47115271cdbe092368d169a52b2264 Mon Sep 17 00:00:00 2001 From: tomfutago <35136350+tomfutago@users.noreply.github.com> Date: Tue, 18 Jun 2024 14:37:58 +0100 Subject: [PATCH 142/149] aave update (#6171) Co-authored-by: Huang Geyang --- ...xusmutual_ethereum_capital_pool_totals.sql | 190 +++--------------- 1 file changed, 26 insertions(+), 164 deletions(-) diff --git a/models/nexusmutual/ethereum/capital_pool/nexusmutual_ethereum_capital_pool_totals.sql b/models/nexusmutual/ethereum/capital_pool/nexusmutual_ethereum_capital_pool_totals.sql index 6a08e2826b3..fb024054973 100644 --- a/models/nexusmutual/ethereum/capital_pool/nexusmutual_ethereum_capital_pool_totals.sql +++ b/models/nexusmutual/ethereum/capital_pool/nexusmutual_ethereum_capital_pool_totals.sql @@ -146,94 +146,18 @@ aave_current_market as ( aave_supplied as ( select - block_date, - symbol, - sum(atoken_amount) as atoken_amount - from ( - select - date_trunc('day', s.evt_block_time) as block_date, - t.symbol, - s.amount / power(10, t.decimals) / u.liquidityIndex * power(10, 27) as atoken_amount - from {{ source('aave_v3_ethereum', 'Pool_evt_Supply') }} s - inner join {{ source('tokens', 'erc20') }} t on t.contract_address = s.reserve and t.blockchain = 'ethereum' - inner join {{ source('aave_v3_ethereum', 'Pool_evt_ReserveDataUpdated') }} u - on u.evt_block_number = s.evt_block_number - and u.evt_index < s.evt_index - and u.evt_tx_hash = s.evt_tx_hash - and u.reserve = s.reserve - where s.evt_block_time >= timestamp '2024-05-23' - and s.onBehalfOf = 0x51ad1265C8702c9e96Ea61Fe4088C2e22eD4418e - ) t - group by 1, 2 -), - -aave_supply_withdrawn as ( - select - block_date, - symbol, - sum(atoken_amount) as atoken_amount - from ( - select - date_trunc('day', w.evt_block_time) as block_date, - t.symbol, - w.amount / power(10, t.decimals) / u.liquidityIndex * power(10, 27) as atoken_amount - from {{ source('aave_v3_ethereum', 'Pool_evt_Withdraw') }} w - inner join {{ source('tokens', 'erc20') }} t on t.contract_address = w.reserve and t.blockchain = 'ethereum' - inner join {{ source('aave_v3_ethereum', 'Pool_evt_ReserveDataUpdated') }} u - on u.evt_block_number = w.evt_block_number - and u.evt_index < w.evt_index - and u.evt_tx_hash = w.evt_tx_hash - and u.reserve = w.reserve - where w.evt_block_time >= timestamp '2024-05-23' - and w.user = 0x51ad1265C8702c9e96Ea61Fe4088C2e22eD4418e - ) t - group by 1, 2 -), - -aave_supply_repaid as ( - select - block_date, - symbol, - sum(atoken_amount) as atoken_amount - from ( - select - date_trunc('day', r.evt_block_time) as block_date, - t.symbol, - r.amount / power(10, t.decimals) / u.liquidityIndex * power(10, 27) as atoken_amount - from {{ source('aave_v3_ethereum', 'Pool_evt_Repay') }} r - inner join {{ source('tokens', 'erc20') }} t on t.contract_address = r.reserve and t.blockchain = 'ethereum' - inner join {{ source('aave_v3_ethereum', 'Pool_evt_ReserveDataUpdated') }} u - on u.evt_block_number = r.evt_block_number - and u.evt_index < r.evt_index - and u.evt_tx_hash = r.evt_tx_hash - and u.reserve = r.reserve - where r.evt_block_time >= timestamp '2024-05-23' - and r.user = 0x51ad1265C8702c9e96Ea61Fe4088C2e22eD4418e - and r.useATokens - ) t - group by 1, 2 -), - -aave_supply_liquidated as ( - select - block_date, - symbol, - sum(atoken_amount) as atoken_amount - from ( - select - date_trunc('day', l.evt_block_time) as block_date, - t.symbol, - cast(l.liquidatedCollateralAmount as double) / power(10, t.decimals) / u.liquidityIndex * power(10, 27) as atoken_amount - from {{ source('aave_v3_ethereum', 'Pool_evt_LiquidationCall') }} l - inner join {{ source('tokens', 'erc20') }} t on t.contract_address = l.collateralasset and t.blockchain = 'ethereum' - inner join {{ source('aave_v3_ethereum', 'Pool_evt_ReserveDataUpdated') }} u - on u.evt_block_number = l.evt_block_number - and u.evt_index < l.evt_index - and u.evt_tx_hash = l.evt_tx_hash - and u.reserve = l.collateralAsset - where l.evt_block_time >= timestamp '2024-05-23' - and l.user = 0x51ad1265C8702c9e96Ea61Fe4088C2e22eD4418e - ) t + date_trunc('day', s.block_time) as block_date, + s.symbol, + sum(s.amount / u.liquidityIndex * power(10, 27)) as atoken_amount + from {{ ref('aave_ethereum_supply') }} s + inner join {{ source('aave_v3_ethereum', 'Pool_evt_ReserveDataUpdated') }} u + on u.evt_block_number = s.block_number + and u.evt_index < s.evt_index + and u.evt_tx_hash = s.tx_hash + and u.reserve = s.token_address + where s.block_time >= timestamp '2024-05-23' + and coalesce(s.on_behalf_of, s.depositor) = 0x51ad1265C8702c9e96Ea61Fe4088C2e22eD4418e --Advisory Board multisig + and s.version = '3' group by 1, 2 ), @@ -241,84 +165,26 @@ aave_scaled_supplies as ( select cm.block_date, cm.symbol, - sum( - s.atoken_amount - coalesce(sw.atoken_amount, 0) - coalesce(sr.atoken_amount, 0) - coalesce(sl.atoken_amount, 0) - ) over (order by cm.block_date) * cm.liquidity_index / power(10, 27) as supplied_amount + sum(s.atoken_amount) over (order by cm.block_date) * cm.liquidity_index / power(10, 27) as supplied_amount from aave_current_market cm left join aave_supplied s on cm.block_date = s.block_date and cm.symbol = s.symbol - left join aave_supply_withdrawn sw on cm.block_date = sw.block_date and cm.symbol = sw.symbol - left join aave_supply_repaid sr on cm.block_date = sr.block_date and cm.symbol = sr.symbol - left join aave_supply_liquidated sl on cm.block_date = sl.block_date and cm.symbol = sl.symbol where cm.symbol = 'WETH' ), aave_borrowed as ( select - block_date, - symbol, - sum(atoken_amount) as atoken_amount - from ( - select - date_trunc('day', b.evt_block_time) as block_date, - t.symbol, - b.amount / power(10, t.decimals) / u.variableBorrowIndex * power(10, 27) as atoken_amount - from {{ source('aave_v3_ethereum', 'Pool_evt_Borrow') }} b - inner join {{ source('tokens', 'erc20') }} t on b.reserve = t.contract_address and t.blockchain = 'ethereum' - inner join {{ source('aave_v3_ethereum', 'Pool_evt_ReserveDataUpdated') }} u - on u.evt_block_number = b.evt_block_number - and u.evt_index < b.evt_index - and u.evt_tx_hash = b.evt_tx_hash - and u.reserve = b.reserve - where b.evt_block_time >= timestamp '2024-05-23' - and b.onBehalfOf = 0x51ad1265C8702c9e96Ea61Fe4088C2e22eD4418e - ) t - group by 1, 2 -), - -aave_borrow_repaid as ( - select - block_date, - symbol, - sum(atoken_amount) as atoken_amount - from ( - select - date_trunc('day', r.evt_block_time) as block_date, - t.symbol, - r.amount / power(10, t.decimals) / u.variableBorrowIndex * power(10, 27) as atoken_amount - from {{ source('aave_v3_ethereum', 'Pool_evt_Repay') }} r - inner join {{ source('tokens', 'erc20') }} t on t.contract_address = r.reserve and t.blockchain = 'ethereum' - inner join {{ source('aave_v3_ethereum', 'Pool_evt_ReserveDataUpdated') }} u - on u.evt_block_number = r.evt_block_number - and u.evt_index < r.evt_index - and u.evt_tx_hash = r.evt_tx_hash - and u.reserve = r.reserve - where r.evt_block_time >= timestamp '2024-05-23' - and r.user = 0x51ad1265C8702c9e96Ea61Fe4088C2e22eD4418e - and r.useATokens - ) t - group by 1, 2 -), - -aave_borrow_liquidated as ( - select - block_date, - symbol, - sum(atoken_amount) as atoken_amount - from ( - select - date_trunc('day', l.evt_block_time) as block_date, - t.symbol, - cast(l.debtToCover as double) / power(10, t.decimals) / u.variableBorrowIndex * power(10, 27) as atoken_amount - from {{ source('aave_v3_ethereum', 'Pool_evt_LiquidationCall') }} l - inner join {{ source('tokens', 'erc20') }} t on t.contract_address = l.collateralasset and t.blockchain = 'ethereum' - inner join {{ source('aave_v3_ethereum', 'Pool_evt_ReserveDataUpdated') }} u - on u.evt_block_number = l.evt_block_number - and u.evt_index < l.evt_index - and u.evt_tx_hash = l.evt_tx_hash - and u.reserve = l.collateralAsset - where l.evt_block_time >= timestamp '2024-05-23' - and l.user = 0x51ad1265C8702c9e96Ea61Fe4088C2e22eD4418e - ) t + date_trunc('day', b.block_time) as block_date, + b.symbol, + sum(b.amount / u.variableBorrowIndex * power(10, 27)) as atoken_amount + from {{ ref('aave_ethereum_borrow') }} b + inner join {{ source('aave_v3_ethereum', 'Pool_evt_ReserveDataUpdated') }} u + on u.evt_block_number = b.block_number + and u.evt_index < b.evt_index + and u.evt_tx_hash = b.tx_hash + and u.reserve = b.token_address + where b.block_time >= timestamp '2024-05-23' + and coalesce(b.on_behalf_of, b.borrower) = 0x51ad1265C8702c9e96Ea61Fe4088C2e22eD4418e --Advisory Board multisig + and b.version = '3' group by 1, 2 ), @@ -326,13 +192,9 @@ aave_scaled_borrows as ( select cm.block_date, cm.symbol, - sum( - b.atoken_amount - coalesce(br.atoken_amount, 0) - coalesce(bl.atoken_amount, 0) - ) over (order by cm.block_date) * cm.variable_borrow_index / power(10, 27) as borrowed_amount + sum(b.atoken_amount) over (order by cm.block_date) * cm.variable_borrow_index / power(10, 27) as borrowed_amount from aave_current_market cm left join aave_borrowed b on cm.block_date = b.block_date and cm.symbol = b.symbol - left join aave_borrow_repaid br on cm.block_date = br.block_date and cm.symbol = br.symbol - left join aave_borrow_liquidated bl on cm.block_date = bl.block_date and cm.symbol = bl.symbol where cm.symbol = 'USDC' ), From 951539e8942a0fec7b4dfae853193bb17bd2216b Mon Sep 17 00:00:00 2001 From: ppclunghe <90045511+ppclunghe@users.noreply.github.com> Date: Tue, 18 Jun 2024 15:38:15 +0200 Subject: [PATCH 143/149] incremental predicate update for lido liquidity (#6167) * incremental predicate update for lido liquidity * other spells * fix arb ramses * fix kyber arbitrum --- ...lido_liquidity_arbitrum_balancer_pools.sql | 30 ++++----- .../lido_liquidity_arbitrum_camelot_pools.sql | 40 +++++------ .../lido_liquidity_arbitrum_curve_pools.sql | 67 ++++++------------- ...ido_liquidity_arbitrum_kyberswap_pools.sql | 38 +++++------ ..._liquidity_arbitrum_kyberswap_v2_pools.sql | 34 +++++----- .../lido_liquidity_arbitrum_ramses_pools.sql | 60 ++++------------- ...do_liquidity_arbitrum_uniswap_v3_pools.sql | 56 ++++------------ .../lido_liquidity_arbitrum_wombat_pools.sql | 46 +++++++------ ...lido_liquidity_base_aerodrome_cl_pools.sql | 4 +- .../lido_liquidity_base_aerodrome_pools.sql | 43 ++++++------ .../lido_liquidity_base_kyberswap_pools.sql | 26 +++---- .../lido_liquidity_base_uniswap_v3_pools.sql | 1 + ...lido_liquidity_ethereum_balancer_pools.sql | 41 ++++++------ ...quidity_ethereum_curve_steth_conc_pool.sql | 52 +++++++------- ...idity_ethereum_curve_steth_frxeth_pool.sql | 54 ++++++++------- ...liquidity_ethereum_curve_steth_ng_pool.sql | 34 +++++----- ...do_liquidity_ethereum_curve_steth_pool.sql | 34 +++++----- ...uidity_ethereum_curve_wsteth_reth_pool.sql | 34 +++++----- ...ido_liquidity_ethereum_kyberswap_pools.sql | 28 ++++---- ..._liquidity_ethereum_kyberswap_v2_pools.sql | 28 ++++---- ...lido_liquidity_ethereum_maverick_pools.sql | 26 +++---- ...iquidity_ethereum_pancakeswap_v3_pools.sql | 28 ++++---- .../lido_liquidity_ethereum_solidly_pools.sql | 58 ++++------------ ...do_liquidity_ethereum_uniswap_v2_pools.sql | 26 +++---- ...do_liquidity_ethereum_uniswap_v3_pools.sql | 58 ++++------------ .../lido_liquidity_linea_syncswap_pools.sql | 1 + ...lido_liquidity_optimism_balancer_pools.sql | 31 ++++----- .../lido_liquidity_optimism_curve_pools.sql | 34 +++++----- ...ido_liquidity_optimism_kyberswap_pools.sql | 27 ++++---- ..._liquidity_optimism_kyberswap_v2_pools.sql | 31 ++++----- ...do_liquidity_optimism_uniswap_v3_pools.sql | 55 ++++----------- ..._liquidity_optimism_velodrome_cl_pools.sql | 1 + ...ido_liquidity_optimism_velodrome_pools.sql | 40 +++++------ ..._liquidity_optimism_velodrome_v2_pools.sql | 31 +++++---- .../lido_liquidity_polygon_balancer_pools.sql | 30 +++++---- ...o_liquidity_polygon_kyberswap_v2_pools.sql | 27 ++++---- ...ido_liquidity_polygon_uniswap_v3_pools.sql | 57 ++++------------ .../lido_liquidity_scroll_syncswap_pools.sql | 1 + .../lido_liquidity_scroll_zebra_pools.sql | 1 + .../lido_liquidity_zksync_maverick_pools.sql | 2 + .../lido_liquidity_zksync_syncswap_pools.sql | 9 +-- ...ido_liquidity_zksync_syncswap_v2_pools.sql | 3 +- 42 files changed, 569 insertions(+), 758 deletions(-) diff --git a/models/lido/liquidity/arbitrum/lido_liquidity_arbitrum_balancer_pools.sql b/models/lido/liquidity/arbitrum/lido_liquidity_arbitrum_balancer_pools.sql index 96fadc30002..e1bb4e49682 100644 --- a/models/lido/liquidity/arbitrum/lido_liquidity_arbitrum_balancer_pools.sql +++ b/models/lido/liquidity/arbitrum/lido_liquidity_arbitrum_balancer_pools.sql @@ -1,15 +1,15 @@ {{ config( schema='lido_liquidity_arbitrum', - alias = 'balancer_pools', - + alias = 'balancer_pools', materialized = 'incremental', file_format = 'delta', incremental_strategy = 'merge', unique_key = ['pool', 'time'], - post_hook='{{ expose_spells(\'["arbitrum"]\', - "project", - "lido_liquidity", - \'["ppclunghe"]\') }}' + incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.time')], + post_hook='{{ expose_spells(blockchains = \'["arbitrum"]\', + spell_type = "project", + spell_name = "lido_liquidity", + contributors = \'["pipistrella"]\') }}' ) }} @@ -80,7 +80,7 @@ WHERE call_create.output_0 in (select distinct poolAddress from pools) {% if not is_incremental() %} WHERE DATE_TRUNC('day', p.minute) >= DATE '{{ project_start_date }}' {% else %} - WHERE DATE_TRUNC('day', p.minute) >= DATE_TRUNC('day', NOW() - INTERVAL '1' day) + WHERE {{ incremental_predicate('p.minute') }} {% endif %} and date_trunc('day', minute) < current_date @@ -111,9 +111,8 @@ WHERE call_create.output_0 in (select distinct poolAddress from pools) {% if not is_incremental() %} WHERE DATE_TRUNC('day', p.minute) >= DATE '{{ project_start_date }}' {% else %} - WHERE DATE_TRUNC('day', p.minute) >= DATE_TRUNC('day', NOW() - INTERVAL '1' day) + WHERE {{ incremental_predicate('p.minute') }} {% endif %} - and blockchain = 'arbitrum' and contract_address = 0x5979d7b546e38e414f7e9822514be443a4800529 )) @@ -136,10 +135,9 @@ WHERE call_create.output_0 in (select distinct poolAddress from pools) {% if not is_incremental() %} WHERE DATE_TRUNC('day', evt_block_time) >= DATE '{{ project_start_date }}' - {% else %} - WHERE DATE_TRUNC('day', evt_block_time) >= DATE_TRUNC('day', NOW() - INTERVAL '1' day) + {% else %} + WHERE {{ incremental_predicate('evt_block_time') }} {% endif %} - and poolId in (select pool_id from pools) UNION ALL @@ -154,7 +152,7 @@ WHERE call_create.output_0 in (select distinct poolAddress from pools) {% if not is_incremental() %} WHERE DATE_TRUNC('day', evt_block_time) >= DATE '{{ project_start_date }}' {% else %} - WHERE DATE_TRUNC('day', evt_block_time) >= DATE_TRUNC('day', NOW() - INTERVAL '1' day) + WHERE {{ incremental_predicate('evt_block_time') }} {% endif %} and poolId in (select pool_id from pools) @@ -174,7 +172,7 @@ WHERE call_create.output_0 in (select distinct poolAddress from pools) {% if not is_incremental() %} WHERE DATE_TRUNC('day', evt_block_time) >= DATE '{{ project_start_date }}' {% else %} - WHERE DATE_TRUNC('day', evt_block_time) >= DATE_TRUNC('day', NOW() - INTERVAL '1' day) + WHERE {{ incremental_predicate('evt_block_time') }} {% endif %} and poolId in (select pool_id from pools) ) @@ -190,7 +188,7 @@ WHERE call_create.output_0 in (select distinct poolAddress from pools) {% if not is_incremental() %} WHERE DATE_TRUNC('day', evt_block_time) >= DATE '{{ project_start_date }}' {% else %} - WHERE DATE_TRUNC('day', evt_block_time) >= DATE_TRUNC('day', NOW() - INTERVAL '1' day) + WHERE {{ incremental_predicate('evt_block_time') }} {% endif %} and poolId in (select pool_id from pools) ) @@ -357,7 +355,7 @@ on main.day = paired4.day and main.pool_id = paired4.pool_id {% if not is_incremental() %} WHERE DATE_TRUNC('day', evt_block_time) >= DATE '{{ project_start_date }}' {% else %} - WHERE DATE_TRUNC('day', evt_block_time) >= DATE_TRUNC('day', NOW() - INTERVAL '1' day) + WHERE {{ incremental_predicate('evt_block_time') }} {% endif %} and s.poolId in (select pool_id from pools) group by 1,2 diff --git a/models/lido/liquidity/arbitrum/lido_liquidity_arbitrum_camelot_pools.sql b/models/lido/liquidity/arbitrum/lido_liquidity_arbitrum_camelot_pools.sql index e18680616ae..638f0eb77e5 100644 --- a/models/lido/liquidity/arbitrum/lido_liquidity_arbitrum_camelot_pools.sql +++ b/models/lido/liquidity/arbitrum/lido_liquidity_arbitrum_camelot_pools.sql @@ -1,15 +1,15 @@ {{ config( schema='lido_liquidity_arbitrum', - alias = 'camelot_pools', - + alias = 'camelot_pools', materialized = 'incremental', file_format = 'delta', incremental_strategy = 'merge', unique_key = ['pool', 'time'], - post_hook='{{ expose_spells(\'["arbitrum"]\', - "project", - "lido_liquidity", - \'["ppclunghe", "gregshestakovlido"]\') }}' + incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.time')], + post_hook='{{ expose_spells(blockchains = \'["arbitrum""]\', + spell_type = "project", + spell_name = "lido_liquidity", + contributors = \'["pipistrella", "zergil1397"]\') }}' ) }} @@ -26,7 +26,7 @@ where token0 = 0x5979D7b546E38E414F7E9822514be443A4800529 , tokens as ( -select distinct token as address--, pt.symbol, pt.decimals, tm.address_l1 +select distinct token as address from ( select token1 as token from {{ source('camelot_arbitrum','CamelotFactory_evt_PairCreated')}} @@ -51,14 +51,11 @@ select 0x5979D7b546E38E414F7E9822514be443A4800529 AVG(price) AS price FROM {{source('prices','usd')}} p - {% if not is_incremental() %} WHERE DATE_TRUNC('day', p.minute) >= DATE '{{ project_start_date }}' - {% else %} - - WHERE DATE_TRUNC('day', p.minute) >= DATE_TRUNC('day', NOW() - INTERVAL '1' day) + {% else %} + WHERE {{ incremental_predicate('p.minute') }} {% endif %} - AND DATE_TRUNC('day', minute) < CURRENT_DATE AND blockchain = 'arbitrum' AND contract_address IN (SELECT address FROM tokens) @@ -104,11 +101,9 @@ select 0x5979D7b546E38E414F7E9822514be443A4800529 {{source('prices','usd')}} p {% if not is_incremental() %} WHERE DATE_TRUNC('day', p.minute) >= DATE '{{ project_start_date }}' - {% else %} - - WHERE DATE_TRUNC('day', p.minute) >= DATE_TRUNC('day', NOW() - INTERVAL '1' day) + {% else %} + WHERE {{ incremental_predicate('p.minute') }} {% endif %} - AND blockchain = 'arbitrum' AND contract_address IN ( SELECT @@ -135,8 +130,7 @@ select 0x5979D7b546E38E414F7E9822514be443A4800529 {% if not is_incremental() %} WHERE DATE_TRUNC('day', sw.evt_block_time) >= DATE '{{ project_start_date }}' {% else %} - - WHERE DATE_TRUNC('day', sw.evt_block_time) >= DATE_TRUNC('day', NOW() - INTERVAL '1' day) + WHERE {{ incremental_predicate('sw.evt_block_time') }} {% endif %} and sw.contract_address in (select address from pools) @@ -156,8 +150,7 @@ select 0x5979D7b546E38E414F7E9822514be443A4800529 {% if not is_incremental() %} WHERE DATE_TRUNC('day', mt.evt_block_time) >= DATE '{{ project_start_date }}' {% else %} - - WHERE DATE_TRUNC('day', mt.evt_block_time) >= DATE_TRUNC('day', NOW() - INTERVAL '1' day) + WHERE {{ incremental_predicate('mt.evt_block_time') }} {% endif %} and mt.contract_address in (select address from pools) group by 1,2,3,4 @@ -177,8 +170,7 @@ select 0x5979D7b546E38E414F7E9822514be443A4800529 {% if not is_incremental() %} WHERE DATE_TRUNC('day', bn.evt_block_time) >= DATE '{{ project_start_date }}' {% else %} - - WHERE DATE_TRUNC('day', bn.evt_block_time) >= DATE_TRUNC('day', NOW() - INTERVAL '1' day) + WHERE {{ incremental_predicate('bn.evt_block_time') }} {% endif %} and bn.contract_address in (select address from pools) group by 1,2,3,4 @@ -238,7 +230,7 @@ select 0x5979D7b546E38E414F7E9822514be443A4800529 {% if not is_incremental() %} WHERE DATE_TRUNC('day', sw.evt_block_time) >= DATE '{{ project_start_date }}' {% else %} - WHERE DATE_TRUNC('day', sw.evt_block_time) >= DATE_TRUNC('day', NOW() - INTERVAL '1' day) + WHERE {{ incremental_predicate('sw.evt_block_time') }} {% endif %} and sw.contract_address in (select address from pools) @@ -290,6 +282,6 @@ left join trading_volume tv on l.time = tv.time and l.pool = tv.pool ) -select CONCAT(CONCAT(CONCAT(CONCAT(CONCAT(blockchain,CONCAT(' ', project)) ,' '), coalesce(paired_token_symbol,'unknown')),':') , main_token_symbol) as pool_name,* +select blockchain||' '||project||' '||coalesce(paired_token_symbol,'unknown')||':'||main_token_symbol as pool_name, * from all_metrics diff --git a/models/lido/liquidity/arbitrum/lido_liquidity_arbitrum_curve_pools.sql b/models/lido/liquidity/arbitrum/lido_liquidity_arbitrum_curve_pools.sql index 238a860762e..3510dfe9393 100644 --- a/models/lido/liquidity/arbitrum/lido_liquidity_arbitrum_curve_pools.sql +++ b/models/lido/liquidity/arbitrum/lido_liquidity_arbitrum_curve_pools.sql @@ -1,15 +1,16 @@ {{ config( schema='lido_liquidity_arbitrum', - alias = 'curve_pools', - + alias = 'curve_pools', materialized = 'incremental', file_format = 'delta', incremental_strategy = 'merge', unique_key = ['pool', 'time'], - post_hook='{{ expose_spells(\'["arbitrum"]\', - "project", - "lido_liquidity", - \'["ppclunghe", "kemasan"]\') }}' + incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.time')], + post_hook='{{ expose_spells(blockchains = \'["arbitrum""]\', + spell_type = "project", + spell_name = "lido_liquidity", + contributors = \'["pipistrella", "kemasan"]\') }}' + ) }} @@ -25,12 +26,10 @@ weth_prices_daily AS ( decimals, avg(price) AS price FROM {{source('prices','usd')}} p - --WHERE date_trunc('day', minute) >= date '{{ project_start_date }}' {% if not is_incremental() %} WHERE DATE_TRUNC('day', p.minute) >= DATE '{{ project_start_date }}' {% else %} - - WHERE DATE_TRUNC('day', p.minute) >= DATE_TRUNC('day', NOW() - INTERVAL '1' day) + WHERE {{ incremental_predicate('p.minute') }} {% endif %} and date_trunc('day', minute) < date_trunc('day', now()) @@ -61,12 +60,10 @@ weth_prices_daily AS ( DATE_TRUNC('hour', minute) time , last_value(price) over (partition by DATE_TRUNC('hour', minute), contract_address ORDER BY minute range between unbounded preceding AND unbounded following) AS price FROM {{ source('prices', 'usd') }} p - --WHERE date_trunc('hour', minute) >= date '{{ project_start_date }}' {% if not is_incremental() %} WHERE DATE_TRUNC('day', p.minute) >= DATE '{{ project_start_date }}' {% else %} - - WHERE DATE_TRUNC('day', p.minute) >= DATE_TRUNC('day', NOW() - INTERVAL '1' day) + WHERE {{ incremental_predicate('p.minute') }} {% endif %} and blockchain = 'arbitrum' @@ -82,13 +79,10 @@ weth_prices_daily AS ( decimals, avg(price) AS price FROM {{source('prices','usd')}} p - --WHERE date_trunc('day', minute) >= date'{{ project_start_date }}' - {% if not is_incremental() %} WHERE DATE_TRUNC('day', p.minute) >= DATE '{{ project_start_date }}' {% else %} - - WHERE DATE_TRUNC('day', p.minute) >= DATE_TRUNC('day', NOW() - INTERVAL '1' day) + WHERE {{ incremental_predicate('p.minute') }} {% endif %} and date_trunc('day', minute) < date_trunc('day', now()) @@ -115,12 +109,10 @@ weth_prices_daily AS ( , sum(token_amounts[1]) as eth_amount_raw , sum(token_amounts[2]) as wsteth_amount_raw from {{source('curvefi_arbitrum','wstETH_swap_evt_AddLiquidity')}} - --WHERE date_trunc('day', evt_block_time) >= date '{{ project_start_date }}' {% if not is_incremental() %} WHERE DATE_TRUNC('day', evt_block_time) >= DATE '{{ project_start_date }}' {% else %} - - WHERE DATE_TRUNC('day', evt_block_time) >= DATE_TRUNC('day', NOW() - INTERVAL '1' day) + WHERE {{ incremental_predicate('evt_block_time') }} {% endif %} group by 1, 2 @@ -134,15 +126,11 @@ weth_prices_daily AS ( , uint256 '0' as eth_amount_raw , coin_amount as wsteth_amount_raw from {{source('curvefi_arbitrum','wstETH_swap_evt_RemoveLiquidityOne')}} - --WHERE date_trunc('day', evt_block_time) >= date '{{ project_start_date }}' - {% if not is_incremental() %} WHERE DATE_TRUNC('day', evt_block_time) >= DATE '{{ project_start_date }}' {% else %} - - WHERE DATE_TRUNC('day', evt_block_time) >= DATE_TRUNC('day', NOW() - INTERVAL '1' day) + WHERE {{ incremental_predicate('evt_block_time') }} {% endif %} - and evt_tx_hash in (select evt_tx_hash from {{source('lido_arbitrum','wstETH_evt_Transfer')}}) union all @@ -152,15 +140,11 @@ weth_prices_daily AS ( , coin_amount as eth_amount_raw , uint256 '0' as wsteth_amount_raw from {{source('curvefi_arbitrum','wstETH_swap_evt_RemoveLiquidityOne')}} - --WHERE date_trunc('day', evt_block_time) >= date '{{ project_start_date }}' - - {% if not is_incremental() %} + {% if not is_incremental() %} WHERE DATE_TRUNC('day', evt_block_time) >= DATE '{{ project_start_date }}' {% else %} - - WHERE DATE_TRUNC('day', evt_block_time) >= DATE_TRUNC('day', NOW() - INTERVAL '1' day) + WHERE {{ incremental_predicate('evt_block_time') }} {% endif %} - and evt_tx_hash not in (select evt_tx_hash from {{source('lido_arbitrum','wstETH_evt_Transfer')}}) union all @@ -170,16 +154,11 @@ weth_prices_daily AS ( , token_amounts[1] , token_amounts[2] from {{source('curvefi_arbitrum','wstETH_swap_evt_RemoveLiquidityImbalance')}} - --WHERE date_trunc('day', evt_block_time) >= date '{{ project_start_date }}' - {% if not is_incremental() %} WHERE DATE_TRUNC('day', evt_block_time) >= DATE '{{ project_start_date }}' {% else %} - - WHERE DATE_TRUNC('day', evt_block_time) >= DATE_TRUNC('day', NOW() - INTERVAL '1' day) - {% endif %} - - + WHERE {{ incremental_predicate('evt_block_time') }} + {% endif %} union all @@ -188,13 +167,10 @@ weth_prices_daily AS ( , token_amounts[1] , token_amounts[2] from {{source('curvefi_arbitrum','wstETH_swap_evt_RemoveLiquidity')}} - --WHERE date_trunc('day', evt_block_time) >= date '{{ project_start_date }}' - {% if not is_incremental() %} WHERE DATE_TRUNC('day', evt_block_time) >= DATE '{{ project_start_date }}' {% else %} - - WHERE DATE_TRUNC('day', evt_block_time) >= DATE_TRUNC('day', NOW() - INTERVAL '1' day) + WHERE {{ incremental_predicate('evt_block_time') }} {% endif %} @@ -208,13 +184,10 @@ weth_prices_daily AS ( , sum(case when sold_id = int256 '0' then cast(tokens_sold as double) else (-1)*cast(tokens_bought as double) end) as eth_amount_raw , sum(case when sold_id = int256 '0' then (-1)*cast(tokens_bought as double) else cast(tokens_sold as double) end) as wsteth_amount_raw from {{source('curvefi_arbitrum','wstETH_swap_evt_TokenExchange')}} - --WHERE date_trunc('day', evt_block_time) >= date '{{ project_start_date }}' - {% if not is_incremental() %} WHERE DATE_TRUNC('day', evt_block_time) >= DATE '{{ project_start_date }}' {% else %} - - WHERE DATE_TRUNC('day', evt_block_time) >= DATE_TRUNC('day', NOW() - INTERVAL '1' day) + WHERE {{ incremental_predicate('evt_block_time') }} {% endif %} group by 1,2 @@ -286,7 +259,7 @@ weth_prices_daily AS ( {% if not is_incremental() %} WHERE DATE_TRUNC('day', evt_block_time) >= DATE '{{ project_start_date }}' {% else %} - WHERE DATE_TRUNC('day', evt_block_time) >= DATE_TRUNC('day', NOW() - INTERVAL '1' day) + WHERE {{ incremental_predicate('evt_block_time') }} {% endif %} group by 1 @@ -333,6 +306,6 @@ weth_prices_daily AS ( ) -select CONCAT(CONCAT(CONCAT(CONCAT(CONCAT(blockchain,CONCAT(' ', project)) ,' '), coalesce(paired_token_symbol,'unknown')),':') , main_token_symbol, ' ', format('%,.3f%%',round(coalesce(fee,0),4))) as pool_name,* +select blockchain||' '||project||' '||coalesce(paired_token_symbol,'unknown')||':'||main_token_symbol||' '||format('%,.3f%%',round(coalesce(fee,0),4)) as pool_name, * from all_metrics diff --git a/models/lido/liquidity/arbitrum/lido_liquidity_arbitrum_kyberswap_pools.sql b/models/lido/liquidity/arbitrum/lido_liquidity_arbitrum_kyberswap_pools.sql index 1b999f736ba..1e53df0fe5d 100644 --- a/models/lido/liquidity/arbitrum/lido_liquidity_arbitrum_kyberswap_pools.sql +++ b/models/lido/liquidity/arbitrum/lido_liquidity_arbitrum_kyberswap_pools.sql @@ -1,15 +1,15 @@ {{ config( schema='lido_liquidity_arbitrum', - alias = 'kyberswap_pools', - + alias = 'kyberswap_pools', materialized = 'incremental', file_format = 'delta', incremental_strategy = 'merge', unique_key = ['pool', 'time'], - post_hook='{{ expose_spells(\'["arbitrum"]\', - "project", - "lido_liquidity", - \'["ppclunghe", "gregshestakovlido"]\') }}' + incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.time')], + post_hook='{{ expose_spells(blockchains = \'["arbitrum""]\', + spell_type = "project", + spell_name = "lido_liquidity", + contributors = \'["pipistrella", "zergil1397"]\') }}' ) }} @@ -49,13 +49,11 @@ select 0x5979D7b546E38E414F7E9822514be443A4800529 symbol, AVG(price) AS price FROM - {{source('prices','usd')}} p - + {{source('prices','usd')}} p {% if not is_incremental() %} WHERE DATE_TRUNC('day', p.minute) >= DATE '{{ project_start_date }}' - {% endif %} - {% if is_incremental() %} - WHERE DATE_TRUNC('day', p.minute) >= DATE_TRUNC('day', NOW() - INTERVAL '1' day) + {% else %} + WHERE {{ incremental_predicate('p.minute') }} {% endif %} AND DATE_TRUNC('day', minute) < current_date @@ -108,11 +106,9 @@ select 0x5979D7b546E38E414F7E9822514be443A4800529 {% if not is_incremental() %} WHERE DATE_TRUNC('day', p.minute) >= DATE '{{ project_start_date }}' + {% else %} + WHERE {{ incremental_predicate('p.minute') }} {% endif %} - {% if is_incremental() %} - WHERE DATE_TRUNC('day', p.minute) >= DATE_TRUNC('day', NOW() - INTERVAL '1' day) - {% endif %} - AND blockchain = 'arbitrum' AND contract_address IN ( SELECT @@ -137,7 +133,7 @@ select 0x5979D7b546E38E414F7E9822514be443A4800529 {% if not is_incremental() %} WHERE DATE_TRUNC('day', sw.evt_block_time) >= DATE '{{ project_start_date }}' {% else %} - WHERE DATE_TRUNC('day', sw.evt_block_time) >= DATE_TRUNC('day', NOW() - INTERVAL '1' day) + WHERE {{ incremental_predicate('sw.evt_block_time') }} {% endif %} and sw.contract_address in (select address from pools) group by 1,2,3,4 @@ -155,7 +151,7 @@ select 0x5979D7b546E38E414F7E9822514be443A4800529 {% if not is_incremental() %} WHERE DATE_TRUNC('day', mt.evt_block_time) >= DATE '{{ project_start_date }}' {% else %} - WHERE DATE_TRUNC('day', mt.evt_block_time) >= DATE_TRUNC('day', NOW() - INTERVAL '1' day) + WHERE {{ incremental_predicate('mt.evt_block_time') }} {% endif %} and mt.contract_address in (select address from pools) group by 1,2,3,4 @@ -175,7 +171,7 @@ select 0x5979D7b546E38E414F7E9822514be443A4800529 {% if not is_incremental() %} WHERE DATE_TRUNC('day', bn.evt_block_time) >= DATE '{{ project_start_date }}' {% else %} - WHERE DATE_TRUNC('day', bn.evt_block_time) >= DATE_TRUNC('day', NOW() - INTERVAL '1' day) + WHERE {{ incremental_predicate('bn.evt_block_time') }} {% endif %} and bn.contract_address in (select address from pools) group by 1,2,3,4 @@ -193,7 +189,7 @@ select 0x5979D7b546E38E414F7E9822514be443A4800529 {% if not is_incremental() %} WHERE DATE_TRUNC('day', bn.evt_block_time) >= DATE '{{ project_start_date }}' {% else %} - WHERE DATE_TRUNC('day', bn.evt_block_time) >= DATE_TRUNC('day', NOW() - INTERVAL '1' day) + WHERE {{ incremental_predicate('bn.evt_block_time') }} {% endif %} and bn.contract_address in (select address from pools) group by 1,2,3,4 @@ -246,7 +242,7 @@ select 0x5979D7b546E38E414F7E9822514be443A4800529 {% if not is_incremental() %} WHERE DATE_TRUNC('day', sw.evt_block_time) >= DATE '{{ project_start_date }}' {% else %} - WHERE DATE_TRUNC('day', sw.evt_block_time) >= DATE_TRUNC('day', NOW() - INTERVAL '1' day) + WHERE {{ incremental_predicate('sw.evt_block_time') }} {% endif %} and sw.contract_address in (select address from pools) group by 1,2,3,4 @@ -289,6 +285,6 @@ group by 1,2 left join trading_volume tv on l.time = tv.time and l.pool = tv.pool ) -select CONCAT(CONCAT(CONCAT(CONCAT(CONCAT(blockchain,CONCAT(' ', project)) ,' '), paired_token_symbol),':') , main_token_symbol, ' ', format('%,.3f',round(coalesce(fee,0),4))) as pool_name,* +select blockchain||' '||project||' '||paired_token_symbol||':'||main_token_symbol||' '||format('%,.3f',round(coalesce(fee,0),4)) as pool_name, * from all_metrics diff --git a/models/lido/liquidity/arbitrum/lido_liquidity_arbitrum_kyberswap_v2_pools.sql b/models/lido/liquidity/arbitrum/lido_liquidity_arbitrum_kyberswap_v2_pools.sql index cd24d9701c7..52a83dfcd68 100644 --- a/models/lido/liquidity/arbitrum/lido_liquidity_arbitrum_kyberswap_v2_pools.sql +++ b/models/lido/liquidity/arbitrum/lido_liquidity_arbitrum_kyberswap_v2_pools.sql @@ -1,15 +1,15 @@ {{ config( schema='lido_liquidity_arbitrum', - alias = 'kyberswap_v2_pools', - + alias = 'kyberswap_v2_pools', materialized = 'incremental', file_format = 'delta', incremental_strategy = 'merge', unique_key = ['pool', 'time'], - post_hook='{{ expose_spells(\'["arbitrum"]\', - "project", - "lido_liquidity", - \'["ppclunghe"]\') }}' + incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.time')], + post_hook='{{ expose_spells(blockchains = \'["arbitrum""]\', + spell_type = "project", + spell_name = "lido_liquidity", + contributors = \'["pipistrella"]\') }}' ) }} @@ -53,9 +53,8 @@ select 0x5979D7b546E38E414F7E9822514be443A4800529 {% if not is_incremental() %} WHERE DATE_TRUNC('day', p.minute) >= DATE '{{ project_start_date }}' - {% endif %} - {% if is_incremental() %} - WHERE DATE_TRUNC('day', p.minute) >= DATE_TRUNC('day', NOW() - INTERVAL '1' day) + {% else%} + WHERE {{ incremental_predicate('p.minute') }} {% endif %} AND DATE_TRUNC('day', minute) < current_date @@ -109,9 +108,8 @@ select 0x5979D7b546E38E414F7E9822514be443A4800529 {% if not is_incremental() %} WHERE DATE_TRUNC('day', p.minute) >= DATE '{{ project_start_date }}' - {% endif %} - {% if is_incremental() %} - WHERE DATE_TRUNC('day', p.minute) >= DATE_TRUNC('day', NOW() - INTERVAL '1' day) + {% else%} + WHERE {{ incremental_predicate('p.minute') }} {% endif %} AND blockchain = 'arbitrum' @@ -138,7 +136,7 @@ select 0x5979D7b546E38E414F7E9822514be443A4800529 {% if not is_incremental() %} WHERE DATE_TRUNC('day', sw.evt_block_time) >= DATE '{{ project_start_date }}' {% else %} - WHERE DATE_TRUNC('day', sw.evt_block_time) >= DATE_TRUNC('day', NOW() - INTERVAL '1' day) + WHERE {{ incremental_predicate('sw.evt_block_time') }} {% endif %} and sw.contract_address in (select address from pools) group by 1,2,3,4 @@ -156,7 +154,7 @@ select 0x5979D7b546E38E414F7E9822514be443A4800529 {% if not is_incremental() %} WHERE DATE_TRUNC('day', mt.evt_block_time) >= DATE '{{ project_start_date }}' {% else %} - WHERE DATE_TRUNC('day', mt.evt_block_time) >= DATE_TRUNC('day', NOW() - INTERVAL '1' day) + WHERE {{ incremental_predicate('mt.evt_block_time') }} {% endif %} and mt.contract_address in (select address from pools) group by 1,2,3,4 @@ -176,7 +174,7 @@ select 0x5979D7b546E38E414F7E9822514be443A4800529 {% if not is_incremental() %} WHERE DATE_TRUNC('day', bn.evt_block_time) >= DATE '{{ project_start_date }}' {% else %} - WHERE DATE_TRUNC('day', bn.evt_block_time) >= DATE_TRUNC('day', NOW() - INTERVAL '1' day) + WHERE {{ incremental_predicate('bn.evt_block_time') }} {% endif %} and bn.contract_address in (select address from pools) group by 1,2,3,4 @@ -194,7 +192,7 @@ select 0x5979D7b546E38E414F7E9822514be443A4800529 {% if not is_incremental() %} WHERE DATE_TRUNC('day', bn.evt_block_time) >= DATE '{{ project_start_date }}' {% else %} - WHERE DATE_TRUNC('day', bn.evt_block_time) >= DATE_TRUNC('day', NOW() - INTERVAL '1' day) + WHERE {{ incremental_predicate('bn.evt_block_time') }} {% endif %} and bn.contract_address in (select address from pools) group by 1,2,3,4 @@ -247,7 +245,7 @@ select 0x5979D7b546E38E414F7E9822514be443A4800529 {% if not is_incremental() %} WHERE DATE_TRUNC('day', sw.evt_block_time) >= DATE '{{ project_start_date }}' {% else %} - WHERE DATE_TRUNC('day', sw.evt_block_time) >= DATE_TRUNC('day', NOW() - INTERVAL '1' day) + WHERE {{ incremental_predicate('sw.evt_block_time') }} {% endif %} and sw.contract_address in (select address from pools) group by 1,2,3,4 @@ -290,6 +288,6 @@ group by 1,2 left join trading_volume tv on l.time = tv.time and l.pool = tv.pool ) -select CONCAT(CONCAT(CONCAT(CONCAT(CONCAT(blockchain,CONCAT(' ', project)) ,' '), coalesce(paired_token_symbol, 'unknown')),':') , main_token_symbol, ' ', format('%,.3f',round(coalesce(fee,0),4))) as pool_name,* +select blockchain||' '||project||' '||coalesce(paired_token_symbol, 'unknown')||':'||main_token_symbol||' '||format('%,.3f',round(coalesce(fee,0),4)) as pool_name, * from all_metrics diff --git a/models/lido/liquidity/arbitrum/lido_liquidity_arbitrum_ramses_pools.sql b/models/lido/liquidity/arbitrum/lido_liquidity_arbitrum_ramses_pools.sql index 5687a78fbe8..392e99dcbfa 100644 --- a/models/lido/liquidity/arbitrum/lido_liquidity_arbitrum_ramses_pools.sql +++ b/models/lido/liquidity/arbitrum/lido_liquidity_arbitrum_ramses_pools.sql @@ -1,15 +1,15 @@ {{ config( schema='lido_liquidity_arbitrum', - alias = 'ramses_pools', - + alias = 'ramses_pools', materialized = 'incremental', file_format = 'delta', incremental_strategy = 'merge', unique_key = ['pool', 'time'], - post_hook='{{ expose_spells(\'["arbitrum"]\', - "project", - "lido_liquidity", - \'["ppclunghe"]\') }}' + incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.time')], + post_hook='{{ expose_spells(blockchains = \'["arbitrum""]\', + spell_type = "project", + spell_name = "lido_liquidity", + contributors = \'["pipistrella"]\') }}' ) }} @@ -63,7 +63,7 @@ with {% if not is_incremental() %} WHERE DATE_TRUNC('day', p.minute) >= DATE '{{ project_start_date }}' {% else %} - WHERE DATE_TRUNC('day', p.minute) >= DATE_TRUNC('day', NOW() - INTERVAL '1' day) + WHERE {{ incremental_predicate('p.minute') }} {% endif %} AND DATE_TRUNC('day', minute) < current_date @@ -113,7 +113,7 @@ with {% if not is_incremental() %} WHERE DATE_TRUNC('day', p.minute) >= DATE '{{ project_start_date }}' {% else %} - WHERE DATE_TRUNC('day', p.minute) >= DATE_TRUNC('day', NOW() - INTERVAL '1' day) + WHERE {{ incremental_predicate('p.minute') }} {% endif %} AND blockchain = 'arbitrum' @@ -139,7 +139,7 @@ with {% if not is_incremental() %} WHERE DATE_TRUNC('day', sw.evt_block_time) >= DATE '{{ project_start_date }}' {% else %} - WHERE DATE_TRUNC('day', sw.evt_block_time) >= DATE_TRUNC('day', NOW() - INTERVAL '1' day) + WHERE {{ incremental_predicate('sw.evt_block_time') }} {% endif %} and sw.contract_address IN ( SELECT @@ -162,7 +162,7 @@ with {% if not is_incremental() %} WHERE DATE_TRUNC('day', mt.evt_block_time) >= DATE '{{ project_start_date }}' {% else %} - WHERE DATE_TRUNC('day', mt.evt_block_time) >= DATE_TRUNC('day', NOW() - INTERVAL '1' day) + WHERE {{ incremental_predicate('mt.evt_block_time') }} {% endif %} and mt.contract_address IN ( SELECT @@ -192,7 +192,7 @@ with {% if not is_incremental() %} WHERE DATE_TRUNC('day', c.evt_block_time) >= DATE '{{ project_start_date }}' {% else %} - WHERE DATE_TRUNC('day', c.evt_block_time) >= DATE_TRUNC('day', NOW() - INTERVAL '1' day) + WHERE {{ incremental_predicate('c.evt_block_time') }} {% endif %} and c.contract_address IN ( SELECT @@ -290,7 +290,7 @@ with {% if not is_incremental() %} WHERE DATE_TRUNC('day', sw.evt_block_time) >= DATE '{{ project_start_date }}' {% else %} - WHERE DATE_TRUNC('day', sw.evt_block_time) >= DATE_TRUNC('day', NOW() - INTERVAL '1' day) + WHERE {{ incremental_predicate('sw.evt_block_time') }} {% endif %} GROUP BY 1, 2, 3, 4 @@ -362,39 +362,7 @@ with LEFT JOIN trading_volume AS tv ON l.time = tv.time AND l.pool = tv.pool ) -SELECT - CONCAT( - CAST( - CONCAT( - CAST( - CONCAT( - CAST( - CONCAT( - CAST( - CONCAT( - CAST(blockchain AS VARCHAR), - CAST( - CONCAT(CAST(' ' AS VARCHAR), CAST(project AS VARCHAR)) AS VARCHAR - ) - ) AS VARCHAR - ), - CAST(' ' AS VARCHAR) - ) AS VARCHAR - ), - CAST( - COALESCE(paired_token_symbol, 'unknown') AS VARCHAR - ) - ) AS VARCHAR - ), - CAST(':' AS VARCHAR) - ) AS VARCHAR - ), - CAST(main_token_symbol AS VARCHAR), - CAST(' ' AS VARCHAR), - format('%,.3f',round(coalesce(fee,0),4)) - ) AS pool_name, - * -FROM - all_metrics +SELECT blockchain||' '||project||' '||COALESCE(paired_token_symbol, 'unknown')||':'||main_token_symbol||' '||format('%,.3f',round(coalesce(fee,0),4)) AS pool_name, * +FROM all_metrics diff --git a/models/lido/liquidity/arbitrum/lido_liquidity_arbitrum_uniswap_v3_pools.sql b/models/lido/liquidity/arbitrum/lido_liquidity_arbitrum_uniswap_v3_pools.sql index 1f679a1b3fd..69c998f1623 100644 --- a/models/lido/liquidity/arbitrum/lido_liquidity_arbitrum_uniswap_v3_pools.sql +++ b/models/lido/liquidity/arbitrum/lido_liquidity_arbitrum_uniswap_v3_pools.sql @@ -1,15 +1,15 @@ {{ config( schema='lido_liquidity_arbitrum', - alias = 'uniswap_v3_pools', - + alias = 'uniswap_v3_pools', materialized = 'incremental', file_format = 'delta', incremental_strategy = 'merge', unique_key = ['pool', 'time'], - post_hook='{{ expose_spells(\'["arbitrum"]\', - "project", - "lido_liquidity", - \'["ppclunghe", "gregshestakovlido"]\') }}' + incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.time')], + post_hook='{{ expose_spells(blockchains = \'["arbitrum""]\', + spell_type = "project", + spell_name = "lido_liquidity", + contributors = \'["pipistrella"]\') }}' ) }} @@ -63,7 +63,7 @@ with {% if not is_incremental() %} WHERE DATE_TRUNC('day', p.minute) >= DATE '{{ project_start_date }}' {% else %} - WHERE DATE_TRUNC('day', p.minute) >= DATE_TRUNC('day', NOW() - INTERVAL '1' day) + WHERE {{ incremental_predicate('p.minute') }} {% endif %} AND DATE_TRUNC('day', minute) < current_date @@ -113,7 +113,7 @@ with {% if not is_incremental() %} WHERE DATE_TRUNC('day', p.minute) >= DATE '{{ project_start_date }}' {% else %} - WHERE DATE_TRUNC('day', p.minute) >= DATE_TRUNC('day', NOW() - INTERVAL '1' day) + WHERE {{ incremental_predicate('p.minute') }} {% endif %} AND blockchain = 'arbitrum' @@ -139,7 +139,7 @@ with {% if not is_incremental() %} WHERE DATE_TRUNC('day', sw.evt_block_time) >= DATE '{{ project_start_date }}' {% else %} - WHERE DATE_TRUNC('day', sw.evt_block_time) >= DATE_TRUNC('day', NOW() - INTERVAL '1' day) + WHERE {{ incremental_predicate('sw.evt_block_time') }} {% endif %} and sw.contract_address IN ( SELECT @@ -162,7 +162,7 @@ with {% if not is_incremental() %} WHERE DATE_TRUNC('day', mt.evt_block_time) >= DATE '{{ project_start_date }}' {% else %} - WHERE DATE_TRUNC('day', mt.evt_block_time) >= DATE_TRUNC('day', NOW() - INTERVAL '1' day) + WHERE {{ incremental_predicate('mt.evt_block_time') }} {% endif %} and mt.contract_address IN ( SELECT @@ -192,7 +192,7 @@ with {% if not is_incremental() %} WHERE DATE_TRUNC('day', c.evt_block_time) >= DATE '{{ project_start_date }}' {% else %} - WHERE DATE_TRUNC('day', c.evt_block_time) >= DATE_TRUNC('day', NOW() - INTERVAL '1' day) + WHERE {{ incremental_predicate('c.evt_block_time') }} {% endif %} and c.contract_address IN ( SELECT @@ -290,7 +290,7 @@ with {% if not is_incremental() %} WHERE DATE_TRUNC('day', sw.evt_block_time) >= DATE '{{ project_start_date }}' {% else %} - WHERE DATE_TRUNC('day', sw.evt_block_time) >= DATE_TRUNC('day', NOW() - INTERVAL '1' day) + WHERE {{ incremental_predicate('sw.evt_block_time') }} {% endif %} GROUP BY 1, 2, 3, 4 @@ -362,37 +362,7 @@ with LEFT JOIN trading_volume AS tv ON l.time = tv.time AND l.pool = tv.pool ) -SELECT - CONCAT( - CAST( - CONCAT( - CAST( - CONCAT( - CAST( - CONCAT( - CAST( - CONCAT( - CAST(blockchain AS VARCHAR), - CAST( - CONCAT(CAST(' ' AS VARCHAR), CAST(project AS VARCHAR)) AS VARCHAR - ) - ) AS VARCHAR - ), - CAST(' ' AS VARCHAR) - ) AS VARCHAR - ), - CAST( - COALESCE(paired_token_symbol, 'unknown') AS VARCHAR - ) - ) AS VARCHAR - ), - CAST(':' AS VARCHAR) - ) AS VARCHAR - ), - CAST(main_token_symbol AS VARCHAR), - CAST(' ' AS VARCHAR), - format('%,.3f',round(coalesce(fee,0),4)) - ) AS pool_name, +SELECT blockchain||' '||project||' '||COALESCE(paired_token_symbol, 'unknown')||':'||main_token_symbol||' '||format('%,.3f',round(coalesce(fee,0),4)) AS pool_name, * FROM all_metrics diff --git a/models/lido/liquidity/arbitrum/lido_liquidity_arbitrum_wombat_pools.sql b/models/lido/liquidity/arbitrum/lido_liquidity_arbitrum_wombat_pools.sql index 781a0e5dec0..bf016a70f39 100644 --- a/models/lido/liquidity/arbitrum/lido_liquidity_arbitrum_wombat_pools.sql +++ b/models/lido/liquidity/arbitrum/lido_liquidity_arbitrum_wombat_pools.sql @@ -1,15 +1,15 @@ {{ config( schema='lido_liquidity_arbitrum', - alias = 'wombat_pools', - + alias = 'wombat_pools', materialized = 'incremental', file_format = 'delta', incremental_strategy = 'merge', unique_key = ['pool', 'time'], - post_hook='{{ expose_spells(\'["arbitrum"]\', - "project", - "lido_liquidity", - \'["ppclunghe"]\') }}' + incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.time')], + post_hook='{{ expose_spells(blockchains = \'["arbitrum""]\', + spell_type = "project", + spell_name = "lido_liquidity", + contributors = \'["pipistrella"]\') }}' ) }} @@ -33,7 +33,7 @@ tokens_prices_daily AS ( {% if not is_incremental() %} WHERE DATE_TRUNC('day', p.minute) >= DATE '{{ project_start_date }}' {% else %} - WHERE DATE_TRUNC('day', p.minute) >= DATE_TRUNC('day', NOW() - INTERVAL '1' day) + WHERE {{ incremental_predicate('p.minute') }} {% endif %} AND DATE_TRUNC('day', minute) < DATE_TRUNC('day', now()) AND blockchain = 'arbitrum' @@ -65,7 +65,7 @@ SELECT {% if not is_incremental() %} WHERE DATE_TRUNC('day', p.minute) >= DATE '{{ project_start_date }}' {% else %} - WHERE DATE_TRUNC('day', p.minute) >= DATE_TRUNC('day', NOW() - INTERVAL '1' day) + WHERE {{ incremental_predicate('p.minute') }} {% endif %} AND blockchain = 'arbitrum' AND contract_address = 0x5979d7b546e38e414f7e9822514be443a4800529 @@ -83,7 +83,7 @@ SELECT {% if not is_incremental() %} WHERE DATE_TRUNC('day', sw.evt_block_time) >= DATE '{{ project_start_date }}' {% else %} - WHERE DATE_TRUNC('day', sw.evt_block_time) >= DATE_TRUNC('day', NOW() - INTERVAL '1' day) + WHERE {{ incremental_predicate('sw.evt_block_time') }} {% endif %} GROUP BY 1,2 ) @@ -97,7 +97,7 @@ SELECT {% if not is_incremental() %} WHERE DATE_TRUNC('day', sw.evt_block_time) >= DATE '{{ project_start_date }}' {% else %} - WHERE DATE_TRUNC('day', sw.evt_block_time) >= DATE_TRUNC('day', NOW() - INTERVAL '1' day) + WHERE {{ incremental_predicate('sw.evt_block_time') }} {% endif %} and token = 0x5979d7b546e38e414f7e9822514be443a4800529 GROUP BY 1,2 @@ -113,7 +113,7 @@ SELECT {% if not is_incremental() %} WHERE DATE_TRUNC('day', sw.evt_block_time) >= DATE '{{ project_start_date }}' {% else %} - WHERE DATE_TRUNC('day', sw.evt_block_time) >= DATE_TRUNC('day', NOW() - INTERVAL '1' day) + WHERE {{ incremental_predicate('sw.evt_block_time') }} {% endif %} and token = 0x5979d7b546e38e414f7e9822514be443a4800529 GROUP BY 1,2 @@ -156,7 +156,7 @@ group by 1,2,3 {% if not is_incremental() %} WHERE DATE_TRUNC('day', sw.evt_block_time) >= DATE '{{ project_start_date }}' {% else %} - WHERE DATE_TRUNC('day', sw.evt_block_time) >= DATE_TRUNC('day', NOW() - INTERVAL '1' day) + WHERE {{ incremental_predicate('sw.evt_block_time') }} {% endif %} GROUP BY 1,2 @@ -187,13 +187,21 @@ group by 1,2,3 ) - select 'arbitrum wombat wstETH one-sided' as pool_name, 0xe14302040c0a1eb6fb5a4a79efa46d60029358d9 as pool, - 'arbitrum' as blockchain, 'wombat' as project, 0.01 as fee, cast(l.time as date) as time, - 0x5979d7b546e38e414f7e9822514be443a4800529 as main_token, 'wstETH' as main_token_symbol, - cast(null as varbinary) as paired_token, '' as paired_token_symbol, - l.amount0/1e18 as main_token_reserve, 0 as paired_token_reserve, - p0.price as main_token_usd_price, 0 as paired_token_usd_price, - coalesce(tv.volume,0)/2 as trading_volume + select 'arbitrum wombat wstETH one-sided' as pool_name, + 0xe14302040c0a1eb6fb5a4a79efa46d60029358d9 as pool, + 'arbitrum' as blockchain, + 'wombat' as project, + 0.01 as fee, + cast(l.time as date) as time, + 0x5979d7b546e38e414f7e9822514be443a4800529 as main_token, + 'wstETH' as main_token_symbol, + cast(null as varbinary) as paired_token, + '' as paired_token_symbol, + l.amount0/1e18 as main_token_reserve, + 0 as paired_token_reserve, + p0.price as main_token_usd_price, + 0 as paired_token_usd_price, + coalesce(tv.volume,0)/2 as trading_volume FROM pool_liquidity AS l LEFT JOIN tokens_prices_daily AS p0 ON DATE_TRUNC('day', l.time) = p0.time LEFT JOIN trading_volume AS tv ON DATE_TRUNC('day', l.time) = tv.time diff --git a/models/lido/liquidity/base/lido_liquidity_base_aerodrome_cl_pools.sql b/models/lido/liquidity/base/lido_liquidity_base_aerodrome_cl_pools.sql index 70b7a73af2c..4e4211ea02e 100644 --- a/models/lido/liquidity/base/lido_liquidity_base_aerodrome_cl_pools.sql +++ b/models/lido/liquidity/base/lido_liquidity_base_aerodrome_cl_pools.sql @@ -5,6 +5,7 @@ file_format = 'delta', incremental_strategy = 'merge', unique_key = ['pool', 'time'], + incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.time')], post_hook='{{ expose_spells(blockchains = \'["base"]\', spell_type = "project", spell_name = "lido_liquidity", @@ -301,8 +302,7 @@ group by 1,2 ) -select --CONCAT(CONCAT(CONCAT(CONCAT(CONCAT(blockchain,CONCAT(' ', project)) ,' '), coalesce(paired_token_symbol,'unknown')),':') , main_token_symbol, ' ', pool_type, ' ', format('%,.3f',round(coalesce(fee,0),4))) as pool_name, - blockchain||' '||project||' '||coalesce(paired_token_symbol,'unknown')||':'||main_token_symbol||' '||pool_type||' '||format('%,.3f',round(coalesce(fee,0),4)) as pool_name, +select blockchain||' '||project||' '||coalesce(paired_token_symbol,'unknown')||':'||main_token_symbol||' '||pool_type||' '||format('%,.3f',round(coalesce(fee,0),4)) as pool_name, pool, blockchain, project, diff --git a/models/lido/liquidity/base/lido_liquidity_base_aerodrome_pools.sql b/models/lido/liquidity/base/lido_liquidity_base_aerodrome_pools.sql index cea82337543..394924dfd74 100644 --- a/models/lido/liquidity/base/lido_liquidity_base_aerodrome_pools.sql +++ b/models/lido/liquidity/base/lido_liquidity_base_aerodrome_pools.sql @@ -1,15 +1,15 @@ {{ config( schema='lido_liquidity_base', - alias = 'aerodrome', - + alias = 'aerodrome', materialized = 'incremental', file_format = 'delta', incremental_strategy = 'merge', unique_key = ['pool', 'time'], - post_hook='{{ expose_spells(\'["base"]\', - "project", - "lido_liquidity", - \'["ppclunghe", "kemasan"]\') }}' + incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.time')], + post_hook='{{ expose_spells(blockchains = \'["base"]\', + spell_type = "project", + spell_name = "lido_liquidity", + contributors = \'["pipistrella", "kemasan"]\') }}' ) }} @@ -59,7 +59,7 @@ FROM {{source('prices','usd')}} p {% if not is_incremental() %} WHERE DATE_TRUNC('day', p.minute) >= DATE '{{ project_start_date }}' {% else %} -WHERE DATE_TRUNC('day', p.minute) >= DATE_TRUNC('day', NOW() - INTERVAL '1' day) --? +WHERE {{ incremental_predicate('p.minute') }} {% endif %} and date_trunc('day', minute) < current_date @@ -94,7 +94,7 @@ select distinct {% if not is_incremental() %} WHERE DATE_TRUNC('day', p.minute) >= DATE '{{ project_start_date }}' {% else %} - WHERE DATE_TRUNC('day', p.minute) >= DATE_TRUNC('day', NOW() - INTERVAL '1' day) + WHERE {{ incremental_predicate('p.minute') }} {% endif %} and blockchain = 'base' and contract_address = 0xc1CBa3fCea344f92D9239c08C0568f6F2F0ee452 @@ -120,9 +120,8 @@ from wsteth_prices_hourly {% if not is_incremental() %} WHERE DATE_TRUNC('day', m.evt_block_time) >= DATE '{{ project_start_date }}' {% else %} - WHERE DATE_TRUNC('day', m.evt_block_time) >= DATE_TRUNC('day', NOW() - INTERVAL '1' day) - {% endif %} - + WHERE {{ incremental_predicate('m.evt_block_time') }} + {% endif %} and m.contract_address in (select address from pools) group by 1,2,3,4 ) @@ -135,14 +134,12 @@ from wsteth_prices_hourly (-1)*SUM(CAST(amount0 AS DOUBLE)) AS amount0, (-1)*SUM(CAST(amount1 AS DOUBLE)) AS amount1 from {{source('aerodrome_base','Pool_evt_Burn')}} b - left join {{source('aerodrome_base','PoolFactory_evt_PoolCreated')}} cr on b.contract_address = cr.pool - + left join {{source('aerodrome_base','PoolFactory_evt_PoolCreated')}} cr on b.contract_address = cr.pool {% if not is_incremental() %} WHERE DATE_TRUNC('day', b.evt_block_time) >= DATE '{{ project_start_date }}' {% else %} - WHERE DATE_TRUNC('day', b.evt_block_time) >= DATE_TRUNC('day', NOW() - INTERVAL '1' day) - {% endif %} - + WHERE {{ incremental_predicate('b.evt_block_time') }} + {% endif %} and b.contract_address in (select address from pools) group by 1,2,3,4 @@ -156,14 +153,12 @@ from wsteth_prices_hourly SUM(CAST(amount0In AS DOUBLE) - CAST(amount0Out AS DOUBLE)) AS amount0, SUM(CAST(amount1In AS DOUBLE) - CAST(amount1Out AS DOUBLE)) AS amount1 from {{source('aerodrome_base','Pool_evt_Swap')}} s - left join {{source('aerodrome_base','PoolFactory_evt_PoolCreated')}} cr on s.contract_address = cr.pool - + left join {{source('aerodrome_base','PoolFactory_evt_PoolCreated')}} cr on s.contract_address = cr.pool {% if not is_incremental() %} WHERE DATE_TRUNC('day', s.evt_block_time) >= DATE '{{ project_start_date }}' {% else %} - WHERE DATE_TRUNC('day', s.evt_block_time) >= DATE_TRUNC('day', NOW() - INTERVAL '1' day) - {% endif %} - + WHERE {{ incremental_predicate('s.evt_block_time') }} + {% endif %} and s.contract_address in (select address from pools) group by 1,2,3,4 @@ -182,7 +177,7 @@ select {% if not is_incremental() %} WHERE DATE_TRUNC('day', s.evt_block_time) >= DATE '{{ project_start_date }}' {% else %} - WHERE DATE_TRUNC('day', s.evt_block_time) >= DATE_TRUNC('day', NOW() - INTERVAL '1' day) + WHERE {{ incremental_predicate('s.evt_block_time') }} {% endif %} and s.contract_address in (select address from pools) group by 1,2,3,4 @@ -241,7 +236,7 @@ GROUP BY 1,2,3,4 {% if not is_incremental() %} WHERE DATE_TRUNC('day', s.evt_block_time) >= DATE '{{ project_start_date }}' {% else %} - WHERE DATE_TRUNC('day', s.evt_block_time) >= DATE_TRUNC('day', NOW() - INTERVAL '1' day) + WHERE {{ incremental_predicate('s.evt_block_time') }} {% endif %} and s.contract_address in (select address from pools) @@ -302,7 +297,7 @@ group by 1,2 ) -select CONCAT(CONCAT(CONCAT(CONCAT(CONCAT(blockchain,CONCAT(' ', project)) ,' '), coalesce(paired_token_symbol,'unknown')),':') , main_token_symbol, ' ', pool_type, ' ', format('%,.3f',round(coalesce(fee,0),4))) as pool_name, +select blockchain||' '||project||' '||coalesce(paired_token_symbol,'unknown')||':'|| main_token_symbol||' '||pool_type||' '||format('%,.3f',round(coalesce(fee,0),4)) as pool_name, pool, blockchain, project, diff --git a/models/lido/liquidity/base/lido_liquidity_base_kyberswap_pools.sql b/models/lido/liquidity/base/lido_liquidity_base_kyberswap_pools.sql index f2de4dd6e0f..b95927d5f14 100644 --- a/models/lido/liquidity/base/lido_liquidity_base_kyberswap_pools.sql +++ b/models/lido/liquidity/base/lido_liquidity_base_kyberswap_pools.sql @@ -1,15 +1,15 @@ {{ config( schema='lido_liquidity_base', - alias = 'kyberswap_pools', - + alias = 'kyberswap_pools', materialized = 'incremental', file_format = 'delta', incremental_strategy = 'merge', unique_key = ['pool', 'time'], - post_hook='{{ expose_spells(\'["base"]\', - "project", - "lido_liquidity", - \'["ppclunghe", "kemasan"]\') }}' + incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.time')], + post_hook='{{ expose_spells(blockchains = \'["base"]\', + spell_type = "project", + spell_name = "lido_liquidity", + contributors = \'["pipistrella", "kemasan"]\') }}' ) }} @@ -53,7 +53,7 @@ from ( {% if not is_incremental() %} WHERE DATE_TRUNC('day', p.minute) >= DATE '{{ project_start_date }}' {% else %} - WHERE DATE_TRUNC('day', p.minute) >= DATE_TRUNC('day', NOW() - INTERVAL '1' day) + WHERE {{ incremental_predicate('p.minute') }} {% endif %} and date_trunc('day', minute) < current_date and blockchain = 'base' @@ -108,7 +108,7 @@ from ( {% if not is_incremental() %} WHERE DATE_TRUNC('day', sw.evt_block_time) >= DATE '{{ project_start_date }}' {% else %} - WHERE DATE_TRUNC('day', sw.evt_block_time) >= DATE_TRUNC('day', NOW() - INTERVAL '1' day) + WHERE {{ incremental_predicate('sw.evt_block_time') }} {% endif %} and sw.contract_address in (select address from pools) group by 1,2,3,4 @@ -126,7 +126,7 @@ from ( {% if not is_incremental() %} WHERE DATE_TRUNC('day', mt.evt_block_time) >= DATE '{{ project_start_date }}' {% else %} - WHERE DATE_TRUNC('day', mt.evt_block_time) >= DATE_TRUNC('day', NOW() - INTERVAL '1' day) + WHERE {{ incremental_predicate('mt.evt_block_time') }} {% endif %} and mt.contract_address in (select address from pools) group by 1,2,3,4 @@ -145,7 +145,7 @@ from ( {% if not is_incremental() %} WHERE DATE_TRUNC('day', bn.evt_block_time) >= DATE '{{ project_start_date }}' {% else %} - WHERE DATE_TRUNC('day', bn.evt_block_time) >= DATE_TRUNC('day', NOW() - INTERVAL '1' day) + WHERE {{ incremental_predicate('bn.evt_block_time') }} {% endif %} and bn.contract_address in (select address from pools) group by 1,2,3,4 @@ -163,7 +163,7 @@ from ( {% if not is_incremental() %} WHERE DATE_TRUNC('day', bn.evt_block_time) >= DATE '{{ project_start_date }}' {% else %} - WHERE DATE_TRUNC('day', bn.evt_block_time) >= DATE_TRUNC('day', NOW() - INTERVAL '1' day) + WHERE {{ incremental_predicate('bn.evt_block_time') }} {% endif %} and bn.contract_address in (select address from pools) group by 1,2,3,4 @@ -209,7 +209,7 @@ from ( {% if not is_incremental() %} WHERE DATE_TRUNC('day', sw.evt_block_time) >= DATE '{{ project_start_date }}' {% else %} - WHERE DATE_TRUNC('day', sw.evt_block_time) >= DATE_TRUNC('day', NOW() - INTERVAL '1' day) + WHERE {{ incremental_predicate('sw.evt_block_time') }} {% endif %} and sw.contract_address in (select address from pools) group by 1,2,3,4 @@ -250,5 +250,5 @@ left join trading_volume tv on l.time = tv.time and l.pool = tv.pool order by time DESC ) -select CONCAT(CONCAT(CONCAT(CONCAT(CONCAT(blockchain,CONCAT(' ', project)) ,' '), coalesce(paired_token_symbol, 'unknown')),':') , main_token_symbol, ' ', format('%,.3f%%',round(coalesce(fee,0),4))) as pool_name,* +select blockchain||' '||project||' '||coalesce(paired_token_symbol, 'unknown')||':'||main_token_symbol||' '||format('%,.3f%%',round(coalesce(fee,0),4)) as pool_name,* from all_metrics diff --git a/models/lido/liquidity/base/lido_liquidity_base_uniswap_v3_pools.sql b/models/lido/liquidity/base/lido_liquidity_base_uniswap_v3_pools.sql index 3bb20d397c4..11fc0602854 100644 --- a/models/lido/liquidity/base/lido_liquidity_base_uniswap_v3_pools.sql +++ b/models/lido/liquidity/base/lido_liquidity_base_uniswap_v3_pools.sql @@ -6,6 +6,7 @@ file_format = 'delta', incremental_strategy = 'merge', unique_key = ['pool', 'time'], + incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.time')], post_hook='{{ expose_spells(blockchains = \'["base"]\', spell_type = "project", spell_name = "lido_liquidity", diff --git a/models/lido/liquidity/ethereum/lido_liquidity_ethereum_balancer_pools.sql b/models/lido/liquidity/ethereum/lido_liquidity_ethereum_balancer_pools.sql index a4036987e56..df87589df7f 100644 --- a/models/lido/liquidity/ethereum/lido_liquidity_ethereum_balancer_pools.sql +++ b/models/lido/liquidity/ethereum/lido_liquidity_ethereum_balancer_pools.sql @@ -1,14 +1,15 @@ {{ config( - alias = 'balancer_pools', - + alias = 'balancer_pools', materialized = 'incremental', file_format = 'delta', incremental_strategy = 'merge', unique_key = ['pool', 'time'], - post_hook='{{ expose_spells(\'["ethereum"]\', - "project", - "lido_liquidity", - \'["ppclunghe"]\') }}' + incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.time')], + post_hook='{{ expose_spells(blockchains = \'["ethereum"]\', + spell_type = "project", + spell_name = "lido_liquidity", + contributors = \'["pipistrella"]\') }}' + ) }} @@ -52,7 +53,7 @@ group by 1 {% if not is_incremental() %} WHERE DATE_TRUNC('day', p.minute) >= DATE '{{ project_start_date }}' {% else %} - WHERE DATE_TRUNC('day', p.minute) >= DATE_TRUNC('day', NOW() - INTERVAL '1' day) + WHERE {{ incremental_predicate('p.minute') }} {% endif %} and date_trunc('day', minute) < current_date @@ -130,7 +131,7 @@ from ( {% if not is_incremental() %} WHERE DATE_TRUNC('day', call_block_time) >= DATE '{{ project_start_date }}' {% else %} - WHERE DATE_TRUNC('day', call_block_time) >= DATE_TRUNC('day', NOW() - INTERVAL '1' day) + WHERE {{ incremental_predicate('call_block_time') }} {% endif %} and call_success @@ -146,7 +147,7 @@ from ( {% if not is_incremental() %} WHERE DATE_TRUNC('day', evt_block_time) >= DATE '{{ project_start_date }}' {% else %} - WHERE DATE_TRUNC('day', evt_block_time) >= DATE_TRUNC('day', NOW() - INTERVAL '1' day) + WHERE {{ incremental_predicate('evt_block_time') }} {% endif %} GROUP BY 1 @@ -163,7 +164,7 @@ from ( {% if not is_incremental() %} WHERE DATE_TRUNC('day', p.minute) >= DATE '{{ project_start_date }}' {% else %} - WHERE DATE_TRUNC('day', p.minute) >= DATE_TRUNC('day', NOW() - INTERVAL '1' day) + WHERE {{ incremental_predicate('p.minute') }} {% endif %} and date_trunc('day', minute) < current_date and blockchain = 'ethereum' @@ -191,7 +192,7 @@ from ( {% if not is_incremental() %} WHERE DATE_TRUNC('day', p.minute) >= DATE '{{ project_start_date }}' {% else %} - WHERE DATE_TRUNC('day', p.minute) >= DATE_TRUNC('day', NOW() - INTERVAL '1' day) + WHERE {{ incremental_predicate('p.minute') }} {% endif %} and date_trunc('day', minute) < current_date and blockchain = 'ethereum' @@ -221,7 +222,7 @@ SELECT distinct {% if not is_incremental() %} WHERE DATE_TRUNC('day', p.minute) >= DATE '{{ project_start_date }}' {% else %} - WHERE DATE_TRUNC('day', p.minute) >= DATE_TRUNC('day', NOW() - INTERVAL '1' day) + WHERE {{ incremental_predicate('p.minute') }} {% endif %} and blockchain = 'ethereum' and contract_address = 0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2 @@ -237,7 +238,7 @@ SELECT distinct {% if not is_incremental() %} WHERE DATE_TRUNC('day', p.minute) >= DATE '{{ project_start_date }}' {% else %} - WHERE DATE_TRUNC('day', p.minute) >= DATE_TRUNC('day', NOW() - INTERVAL '1' day) + WHERE {{ incremental_predicate('p.minute') }} {% endif %} and blockchain = 'ethereum' and contract_address = 0xdac17f958d2ee523a2206206994597c13d831ec7 @@ -253,7 +254,7 @@ SELECT distinct {% if not is_incremental() %} WHERE DATE_TRUNC('day', r.time) >= DATE '{{ project_start_date }}' {% else %} - WHERE DATE_TRUNC('day', r.time) >= DATE_TRUNC('day', NOW() - INTERVAL '1' day) + WHERE {{ incremental_predicate('r.time') }} {% endif %} group by 1,2,3,4 @@ -271,7 +272,7 @@ SELECT distinct {% if not is_incremental() %} WHERE DATE_TRUNC('day', p.minute) >= DATE '{{ project_start_date }}' {% else %} - WHERE DATE_TRUNC('day', p.minute) >= DATE_TRUNC('day', NOW() - INTERVAL '1' day) + WHERE {{ incremental_predicate('p.minute') }} {% endif %} and blockchain = 'ethereum' and contract_address = 0x7f39C581F595B53c5cb19bD0b3f8dA6c935E2Ca0 @@ -296,7 +297,7 @@ SELECT distinct {% if not is_incremental() %} WHERE DATE_TRUNC('day', evt_block_time) >= DATE '{{ project_start_date }}' {% else %} - WHERE DATE_TRUNC('day', evt_block_time) >= DATE_TRUNC('day', NOW() - INTERVAL '1' day) + WHERE {{ incremental_predicate('evt_block_time') }} {% endif %} and poolId in (select pool_id from pools) UNION @@ -310,7 +311,7 @@ SELECT distinct {% if not is_incremental() %} WHERE DATE_TRUNC('day', evt_block_time) >= DATE '{{ project_start_date }}' {% else %} - WHERE DATE_TRUNC('day', evt_block_time) >= DATE_TRUNC('day', NOW() - INTERVAL '1' day) + WHERE {{ incremental_predicate('evt_block_time') }} {% endif %} and poolId in (select pool_id from pools) ) swaps @@ -329,7 +330,7 @@ SELECT distinct {% if not is_incremental() %} WHERE DATE_TRUNC('day', evt_block_time) >= DATE '{{ project_start_date }}' {% else %} - WHERE DATE_TRUNC('day', evt_block_time) >= DATE_TRUNC('day', NOW() - INTERVAL '1' day) + WHERE {{ incremental_predicate('evt_block_time') }} {% endif %} and poolId in (select pool_id from pools) ORDER BY 1, 2, 3 @@ -345,7 +346,7 @@ SELECT distinct {% if not is_incremental() %} WHERE DATE_TRUNC('day', evt_block_time) >= DATE '{{ project_start_date }}' {% else %} - WHERE DATE_TRUNC('day', evt_block_time) >= DATE_TRUNC('day', NOW() - INTERVAL '1' day) + WHERE {{ incremental_predicate('evt_block_time') }} {% endif %} and poolId in (select pool_id from pools) ) @@ -483,7 +484,7 @@ on main.day = paired2.day and main.pool_id = paired2.pool_id {% if not is_incremental() %} WHERE DATE_TRUNC('day', s.evt_block_time) >= DATE '{{ project_start_date }}' {% else %} - WHERE DATE_TRUNC('day', s.evt_block_time) >= DATE_TRUNC('day', NOW() - INTERVAL '1' day) + WHERE {{ incremental_predicate('s.evt_block_time') }} {% endif %} and s.poolId in (select pool_id from pools) group by 1,2 diff --git a/models/lido/liquidity/ethereum/lido_liquidity_ethereum_curve_steth_conc_pool.sql b/models/lido/liquidity/ethereum/lido_liquidity_ethereum_curve_steth_conc_pool.sql index 2b9f34f64fd..1ecb79f36f7 100644 --- a/models/lido/liquidity/ethereum/lido_liquidity_ethereum_curve_steth_conc_pool.sql +++ b/models/lido/liquidity/ethereum/lido_liquidity_ethereum_curve_steth_conc_pool.sql @@ -1,14 +1,14 @@ {{ config( - alias = 'curve_steth_conc_pool', - + alias = 'curve_steth_conc_pool', materialized = 'incremental', file_format = 'delta', incremental_strategy = 'merge', unique_key = ['pool', 'time'], - post_hook='{{ expose_spells(\'["ethereum"]\', - "project", - "lido_liquidity", - \'["ppclunghe"]\') }}' + incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.time')], + post_hook='{{ expose_spells(blockchains = \'["ethereum"]\', + spell_type = "project", + spell_name = "lido_liquidity", + contributors = \'["pipistrella"]\') }}' ) }} @@ -64,7 +64,7 @@ from {{source('erc20_ethereum','evt_Transfer')}} t {% if not is_incremental() %} WHERE DATE_TRUNC('day', evt_block_time) >= DATE '{{ project_start_date }}' {% else %} - WHERE DATE_TRUNC('day', evt_block_time) >= DATE_TRUNC('day', NOW() - INTERVAL '1' day) + WHERE {{ incremental_predicate('evt_block_time') }} {% endif %} and contract_address = 0xae7ab96520de3a18e5e111b5eaab095312d7fe84 @@ -85,7 +85,7 @@ from {{source('erc20_ethereum','evt_Transfer')}} t {% if not is_incremental() %} WHERE DATE_TRUNC('day', evt_block_time) >= DATE '{{ project_start_date }}' {% else %} - WHERE DATE_TRUNC('day', evt_block_time) >= DATE_TRUNC('day', NOW() - INTERVAL '1' day) + WHERE {{ incremental_predicate('evt_block_time') }} {% endif %} and contract_address = 0xae7ab96520de3a18e5e111b5eaab095312d7fe84 and "from" = 0x828b154032950C8ff7CF8085D841723Db2696056 @@ -119,7 +119,7 @@ from {{source('erc20_ethereum','evt_Transfer')}} t {% if not is_incremental() %} WHERE DATE_TRUNC('day', evt_block_time) >= DATE '{{ project_start_date }}' {% else %} - WHERE DATE_TRUNC('day', evt_block_time) >= DATE_TRUNC('day', NOW() - INTERVAL '1' day) + WHERE {{ incremental_predicate('evt_block_time') }} {% endif %} and contract_address = 0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2 and to = 0x828b154032950C8ff7CF8085D841723Db2696056 @@ -135,7 +135,7 @@ from {{source('erc20_ethereum','evt_Transfer')}} t {% if not is_incremental() %} WHERE DATE_TRUNC('day', evt_block_time) >= DATE '{{ project_start_date }}' {% else %} - WHERE DATE_TRUNC('day', evt_block_time) >= DATE_TRUNC('day', NOW() - INTERVAL '1' day) + WHERE {{ incremental_predicate('evt_block_time') }} {% endif %} and contract_address = 0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2 and "from" = 0x828b154032950C8ff7CF8085D841723Db2696056 @@ -169,7 +169,7 @@ order by 1 {% if not is_incremental() %} WHERE DATE_TRUNC('day', p.minute) >= DATE '{{ project_start_date }}' {% else %} - WHERE DATE_TRUNC('day', p.minute) >= DATE_TRUNC('day', NOW() - INTERVAL '1' day) + WHERE {{ incremental_predicate('p.minute') }} {% endif %} and date_trunc('day', minute) < current_date and blockchain = 'ethereum' @@ -199,7 +199,7 @@ order by 1 {% if not is_incremental() %} WHERE DATE_TRUNC('day', p.minute) >= DATE '{{ project_start_date }}' {% else %} - WHERE DATE_TRUNC('day', p.minute) >= DATE_TRUNC('day', NOW() - INTERVAL '1' day) + WHERE {{ incremental_predicate('p.minute') }} {% endif %} and blockchain = 'ethereum' and symbol = 'WETH' @@ -214,7 +214,7 @@ order by 1 {% if not is_incremental() %} WHERE DATE_TRUNC('day', p.minute) >= DATE '{{ project_start_date }}' {% else %} - WHERE DATE_TRUNC('day', p.minute) >= DATE_TRUNC('day', NOW() - INTERVAL '1' day) + WHERE {{ incremental_predicate('p.minute') }} {% endif %} and date_trunc('day', minute) < current_date @@ -240,7 +240,7 @@ order by 1 {% if not is_incremental() %} WHERE DATE_TRUNC('day', evt_block_time) >= DATE '{{ project_start_date }}' {% else %} - WHERE DATE_TRUNC('day', evt_block_time) >= DATE_TRUNC('day', NOW() - INTERVAL '1' day) + WHERE {{ incremental_predicate('evt_block_time') }} {% endif %} group by 1 @@ -264,16 +264,20 @@ order by 1 select 'ethereum curve WETH:stETH concentrated 0.04' as pool_name, -0x828b154032950C8ff7CF8085D841723Db2696056 as pool, -'ethereum' as blockchain, 'curve' as project,0.04 as fee, -cast(b.time as date) as time, -0xae7ab96520DE3A18E5e111B5EaAb095312D7fE84 as main_token, 'stETH' as main_token_symbol, -0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2 as paired_token, 'WETH' as paired_token_symbol, -wsteth as main_token_reserve, -coalesce(eth.weth, 0) as paired_token_reserve, -coalesce(stethp.price*r.rate, wethp.price*r.rate) as main_token_usd_price, -wethp.price as paired_token_usd_price, -v.volume as trading_volume + 0x828b154032950C8ff7CF8085D841723Db2696056 as pool, + 'ethereum' as blockchain, + 'curve' as project, + 0.04 as fee, + cast(b.time as date) as time, + 0xae7ab96520DE3A18E5e111B5EaAb095312D7fE84 as main_token, + 'stETH' as main_token_symbol, + 0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2 as paired_token, + 'WETH' as paired_token_symbol, + wsteth as main_token_reserve, + coalesce(eth.weth, 0) as paired_token_reserve, + coalesce(stethp.price*r.rate, wethp.price*r.rate) as main_token_usd_price, + wethp.price as paired_token_usd_price, + v.volume as trading_volume from steth_balances b left join weth_balances eth on b.time = eth.time left join steth_prices_daily stethp on b.time = stethp.time diff --git a/models/lido/liquidity/ethereum/lido_liquidity_ethereum_curve_steth_frxeth_pool.sql b/models/lido/liquidity/ethereum/lido_liquidity_ethereum_curve_steth_frxeth_pool.sql index 7c4e61af61d..1e574e3c580 100644 --- a/models/lido/liquidity/ethereum/lido_liquidity_ethereum_curve_steth_frxeth_pool.sql +++ b/models/lido/liquidity/ethereum/lido_liquidity_ethereum_curve_steth_frxeth_pool.sql @@ -1,14 +1,14 @@ {{ config( - alias = 'curve_steth_frxeth_pool', - + alias = 'curve_steth_frxeth_pool', materialized = 'incremental', file_format = 'delta', incremental_strategy = 'merge', unique_key = ['pool', 'time'], - post_hook='{{ expose_spells(\'["ethereum"]\', - "project", - "lido_liquidity", - \'["ppclunghe"]\') }}' + incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.time')], + post_hook='{{ expose_spells(blockchains = \'["ethereum"]\', + spell_type = "project", + spell_name = "lido_liquidity", + contributors = \'["pipistrella"]\') }}' ) }} @@ -65,7 +65,7 @@ from {{source('erc20_ethereum','evt_Transfer')}} t {% if not is_incremental() %} WHERE DATE_TRUNC('day', evt_block_time) >= DATE '{{ project_start_date }}' {% else %} - WHERE DATE_TRUNC('day', evt_block_time) >= DATE_TRUNC('day', NOW() - INTERVAL '1' day) + WHERE {{ incremental_predicate('evt_block_time') }} {% endif %} and contract_address = 0xae7ab96520de3a18e5e111b5eaab095312d7fe84 and to = 0x4d9f9D15101EEC665F77210cB999639f760F831E @@ -84,7 +84,7 @@ from {{source('erc20_ethereum','evt_Transfer')}} t {% if not is_incremental() %} WHERE DATE_TRUNC('day', evt_block_time) >= DATE '{{ project_start_date }}' {% else %} - WHERE DATE_TRUNC('day', evt_block_time) >= DATE_TRUNC('day', NOW() - INTERVAL '1' day) + WHERE {{ incremental_predicate('evt_block_time') }} {% endif %} and contract_address = 0xae7ab96520de3a18e5e111b5eaab095312d7fe84 @@ -119,7 +119,7 @@ from {{source('erc20_ethereum','evt_Transfer')}} t {% if not is_incremental() %} WHERE DATE_TRUNC('day', evt_block_time) >= DATE '{{ project_start_date }}' {% else %} - WHERE DATE_TRUNC('day', evt_block_time) >= DATE_TRUNC('day', NOW() - INTERVAL '1' day) + WHERE {{ incremental_predicate('evt_block_time') }} {% endif %} and contract_address = 0x5e8422345238f34275888049021821e8e08caa1f and to = 0x4d9f9d15101eec665f77210cb999639f760f831e @@ -135,7 +135,7 @@ from {{source('erc20_ethereum','evt_Transfer')}} t {% if not is_incremental() %} WHERE DATE_TRUNC('day', evt_block_time) >= DATE '{{ project_start_date }}' {% else %} - WHERE DATE_TRUNC('day', evt_block_time) >= DATE_TRUNC('day', NOW() - INTERVAL '1' day) + WHERE {{ incremental_predicate('evt_block_time') }} {% endif %} and contract_address = 0x5e8422345238f34275888049021821e8e08caa1f and "from" = 0x4d9f9d15101eec665f77210cb999639f760f831e @@ -168,7 +168,7 @@ from {{source('curvefi_ethereum','frxeth_eth_pool_call_price_oracle')}} {% if not is_incremental() %} WHERE DATE_TRUNC('day', call_block_time) >= DATE '{{ project_start_date }}' {% else %} - WHERE DATE_TRUNC('day', call_block_time) >= DATE_TRUNC('day', NOW() - INTERVAL '1' day) + WHERE {{ incremental_predicate('call_block_time') }} {% endif %} and call_success = true @@ -182,7 +182,7 @@ from {{source('curvefi_ethereum','frxeth_eth_pool_call_price_oracle')}} {% if not is_incremental() %} WHERE DATE_TRUNC('day', p.minute) >= DATE '{{ project_start_date }}' {% else %} - WHERE DATE_TRUNC('day', p.minute) >= DATE_TRUNC('day', NOW() - INTERVAL '1' day) + WHERE {{ incremental_predicate('p.minute') }} {% endif %} and date_trunc('day', minute) < current_date and blockchain = 'ethereum' @@ -212,7 +212,7 @@ from {{source('curvefi_ethereum','frxeth_eth_pool_call_price_oracle')}} {% if not is_incremental() %} WHERE DATE_TRUNC('day', p.minute) >= DATE '{{ project_start_date }}' {% else %} - WHERE DATE_TRUNC('day', p.minute) >= DATE_TRUNC('day', NOW() - INTERVAL '1' day) + WHERE {{ incremental_predicate('p.minute') }} {% endif %} and blockchain = 'ethereum' @@ -228,7 +228,7 @@ from {{source('curvefi_ethereum','frxeth_eth_pool_call_price_oracle')}} {% if not is_incremental() %} WHERE DATE_TRUNC('day', p.minute) >= DATE '{{ project_start_date }}' {% else %} - WHERE DATE_TRUNC('day', p.minute) >= DATE_TRUNC('day', NOW() - INTERVAL '1' day) + WHERE {{ incremental_predicate('p.minute') }} {% endif %} and date_trunc('day', minute) < current_date @@ -253,7 +253,7 @@ from {{source('curvefi_ethereum','frxeth_eth_pool_call_price_oracle')}} {% if not is_incremental() %} WHERE DATE_TRUNC('day', c.evt_block_time) >= DATE '{{ project_start_date }}' {% else %} - WHERE DATE_TRUNC('day', c.evt_block_time) >= DATE_TRUNC('day', NOW() - INTERVAL '1' day) + WHERE {{ incremental_predicate('c.evt_block_time') }} {% endif %} group by 1 @@ -275,16 +275,20 @@ from {{source('curvefi_ethereum','frxeth_eth_pool_call_price_oracle')}} ) select 'ethereum curve frxETH:stETH 0.04' as pool_name, -0x4d9f9D15101EEC665F77210cB999639f760F831E as pool, -'ethereum' as blockchain, 'curve' as project,0.04 as fee, -cast(b.time as date) as time, -0xae7ab96520DE3A18E5e111B5EaAb095312D7fE84 as main_token, 'stETH' as main_token_symbol, -0x5E8422345238F34275888049021821E8E08CAa1f as paired_token, 'frxETH' as paired_token_symbol, -wsteth as main_token_reserve, -coalesce(frxeth.frxeth, 0) as paired_token_reserve, -coalesce(stethp.price*r.rate, wethp.price*r.rate) as main_token_usd_price, -wethp.price*coalesce(fr.rate,1) as paired_token_usd_price, -v.volume as trading_volume + 0x4d9f9D15101EEC665F77210cB999639f760F831E as pool, + 'ethereum' as blockchain, + 'curve' as project, + 0.04 as fee, + cast(b.time as date) as time, + 0xae7ab96520DE3A18E5e111B5EaAb095312D7fE84 as main_token, + 'stETH' as main_token_symbol, + 0x5E8422345238F34275888049021821E8E08CAa1f as paired_token, + 'frxETH' as paired_token_symbol, + wsteth as main_token_reserve, + coalesce(frxeth.frxeth, 0) as paired_token_reserve, + coalesce(stethp.price*r.rate, wethp.price*r.rate) as main_token_usd_price, + wethp.price*coalesce(fr.rate,1) as paired_token_usd_price, + v.volume as trading_volume from steth_balances b left join wsteth_rate r on b.time >= r.day and b.time < r.next_day left join frxeth_balances frxeth on b.time = frxeth.time diff --git a/models/lido/liquidity/ethereum/lido_liquidity_ethereum_curve_steth_ng_pool.sql b/models/lido/liquidity/ethereum/lido_liquidity_ethereum_curve_steth_ng_pool.sql index 9bd5903f057..ed9ce8c29ba 100644 --- a/models/lido/liquidity/ethereum/lido_liquidity_ethereum_curve_steth_ng_pool.sql +++ b/models/lido/liquidity/ethereum/lido_liquidity_ethereum_curve_steth_ng_pool.sql @@ -1,14 +1,14 @@ {{ config( - alias = 'curve_steth_ng_pool', - + alias = 'curve_steth_ng_pool', materialized = 'incremental', file_format = 'delta', incremental_strategy = 'merge', unique_key = ['pool', 'time'], - post_hook='{{ expose_spells(\'["ethereum"]\', - "project", - "lido_liquidity", - \'["ppclunghe"]\') }}' + incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.time')], + post_hook='{{ expose_spells(blockchains = \'["ethereum"]\', + spell_type = "project", + spell_name = "lido_liquidity", + contributors = \'["pipistrella"]\') }}' ) }} @@ -64,7 +64,7 @@ from {{source('erc20_ethereum','evt_Transfer')}} t {% if not is_incremental() %} WHERE DATE_TRUNC('day', evt_block_time) >= DATE '{{ project_start_date }}' {% else %} - WHERE DATE_TRUNC('day', evt_block_time) >= DATE_TRUNC('day', NOW() - INTERVAL '1' day) + WHERE {{ incremental_predicate('evt_block_time') }} {% endif %} and contract_address = 0xae7ab96520de3a18e5e111b5eaab095312d7fe84 and to = 0x21e27a5e5513d6e65c4f830167390997aa84843a @@ -82,7 +82,7 @@ from {{source('erc20_ethereum','evt_Transfer')}} t {% if not is_incremental() %} WHERE DATE_TRUNC('day', evt_block_time) >= DATE '{{ project_start_date }}' {% else %} - WHERE DATE_TRUNC('day', evt_block_time) >= DATE_TRUNC('day', NOW() - INTERVAL '1' day) + WHERE {{ incremental_predicate('evt_block_time') }} {% endif %} and contract_address = 0xae7ab96520de3a18e5e111b5eaab095312d7fe84 and "from" = 0x21e27a5e5513d6e65c4f830167390997aa84843a @@ -116,7 +116,7 @@ FROM ( {% if not is_incremental() %} WHERE DATE_TRUNC('day', block_time) >= DATE '{{ project_start_date }}' {% else %} - WHERE DATE_TRUNC('day', block_time) >= DATE_TRUNC('day', NOW() - INTERVAL '1' day) + WHERE {{ incremental_predicate('block_time') }} {% endif %} AND "from" = 0x21e27a5e5513d6e65c4f830167390997aa84843a AND success @@ -131,7 +131,7 @@ FROM ( {% if not is_incremental() %} WHERE DATE_TRUNC('day', block_time) >= DATE '{{ project_start_date }}' {% else %} - WHERE DATE_TRUNC('day', block_time) >= DATE_TRUNC('day', NOW() - INTERVAL '1' day) + WHERE {{ incremental_predicate('block_time') }} {% endif %} AND to = 0x21e27a5e5513d6e65c4f830167390997aa84843a AND success @@ -146,7 +146,7 @@ FROM ( {% if not is_incremental() %} WHERE DATE_TRUNC('day', block_time) >= DATE '{{ project_start_date }}' {% else %} - WHERE DATE_TRUNC('day', block_time) >= DATE_TRUNC('day', NOW() - INTERVAL '1' day) + WHERE {{ incremental_predicate('block_time') }} {% endif %} AND "from" = 0x21e27a5e5513d6e65c4f830167390997aa84843a AND success @@ -163,7 +163,7 @@ group by 1 {% if not is_incremental() %} WHERE DATE_TRUNC('day', p.minute) >= DATE '{{ project_start_date }}' {% else %} - WHERE DATE_TRUNC('day', p.minute) >= DATE_TRUNC('day', NOW() - INTERVAL '1' day) + WHERE {{ incremental_predicate('p.minute') }} {% endif %} and date_trunc('day', minute) < current_date and blockchain = 'ethereum' @@ -193,7 +193,7 @@ group by 1 {% if not is_incremental() %} WHERE DATE_TRUNC('day', p.minute) >= DATE '{{ project_start_date }}' {% else %} - WHERE DATE_TRUNC('day', p.minute) >= DATE_TRUNC('day', NOW() - INTERVAL '1' day) + WHERE {{ incremental_predicate('p.minute') }} {% endif %} and blockchain = 'ethereum' @@ -209,7 +209,7 @@ group by 1 {% if not is_incremental() %} WHERE DATE_TRUNC('day', p.minute) >= DATE '{{ project_start_date }}' {% else %} - WHERE DATE_TRUNC('day', p.minute) >= DATE_TRUNC('day', NOW() - INTERVAL '1' day) + WHERE {{ incremental_predicate('p.minute') }} {% endif %} and date_trunc('day', minute) < current_date and blockchain = 'ethereum' @@ -233,7 +233,7 @@ group by 1 {% if not is_incremental() %} WHERE DATE_TRUNC('day', evt_block_time) >= DATE '{{ project_start_date }}' {% else %} - WHERE DATE_TRUNC('day', evt_block_time) >= DATE_TRUNC('day', NOW() - INTERVAL '1' day) + WHERE {{ incremental_predicate('evt_block_time') }} {% endif %} group by 1 @@ -259,7 +259,9 @@ group by 1 select 'ethereum curve ETH:stETH NG 0.04' as pool_name, 0x21e27a5e5513d6e65c4f830167390997aa84843a as pool, - 'ethereum' as blockchain, 'curve' as project,0.04 as fee, + 'ethereum' as blockchain, + 'curve' as project, + 0.04 as fee, cast(b.time as date) as time, 0xae7ab96520DE3A18E5e111B5EaAb095312D7fE84 as main_token, 'stETH' as main_token_symbol, diff --git a/models/lido/liquidity/ethereum/lido_liquidity_ethereum_curve_steth_pool.sql b/models/lido/liquidity/ethereum/lido_liquidity_ethereum_curve_steth_pool.sql index 8e36cbcf973..39c738cd066 100644 --- a/models/lido/liquidity/ethereum/lido_liquidity_ethereum_curve_steth_pool.sql +++ b/models/lido/liquidity/ethereum/lido_liquidity_ethereum_curve_steth_pool.sql @@ -1,14 +1,14 @@ {{ config( - alias = 'curve_steth_pool', - + alias = 'curve_steth_pool', materialized = 'incremental', file_format = 'delta', incremental_strategy = 'merge', unique_key = ['pool', 'time'], - post_hook='{{ expose_spells(\'["ethereum"]\', - "project", - "lido_liquidity", - \'["ppclunghe"]\') }}' + incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.time')], + post_hook='{{ expose_spells(blockchains = \'["ethereum"]\', + spell_type = "project", + spell_name = "lido_liquidity", + contributors = \'["pipistrella"]\') }}' ) }} @@ -64,7 +64,7 @@ from {{source('erc20_ethereum','evt_Transfer')}} t {% if not is_incremental() %} WHERE DATE_TRUNC('day', evt_block_time) >= DATE '{{ project_start_date }}' {% else %} - WHERE DATE_TRUNC('day', evt_block_time) >= DATE_TRUNC('day', NOW() - INTERVAL '1' day) + WHERE {{ incremental_predicate('evt_block_time') }} {% endif %} and contract_address = 0xae7ab96520de3a18e5e111b5eaab095312d7fe84 and to = 0xdc24316b9ae028f1497c275eb9192a3ea0f67022 @@ -82,7 +82,7 @@ from {{source('erc20_ethereum','evt_Transfer')}} t {% if not is_incremental() %} WHERE DATE_TRUNC('day', evt_block_time) >= DATE '{{ project_start_date }}' {% else %} - WHERE DATE_TRUNC('day', evt_block_time) >= DATE_TRUNC('day', NOW() - INTERVAL '1' day) + WHERE {{ incremental_predicate('evt_block_time') }} {% endif %} and contract_address = 0xae7ab96520de3a18e5e111b5eaab095312d7fe84 and "from" = 0xdc24316b9ae028f1497c275eb9192a3ea0f67022 @@ -116,7 +116,7 @@ FROM ( {% if not is_incremental() %} WHERE DATE_TRUNC('day', block_time) >= DATE '{{ project_start_date }}' {% else %} - WHERE DATE_TRUNC('day', block_time) >= DATE_TRUNC('day', NOW() - INTERVAL '1' day) + WHERE {{ incremental_predicate('block_time') }} {% endif %} AND"from" = 0xDC24316b9AE028F1497c275EB9192a3Ea0f67022 AND success @@ -130,7 +130,7 @@ FROM ( {% if not is_incremental() %} WHERE DATE_TRUNC('day', block_time) >= DATE '{{ project_start_date }}' {% else %} - WHERE DATE_TRUNC('day', block_time) >= DATE_TRUNC('day', NOW() - INTERVAL '1' day) + WHERE {{ incremental_predicate('block_time') }} {% endif %} AND to = 0xDC24316b9AE028F1497c275EB9192a3Ea0f67022 AND success @@ -144,7 +144,7 @@ FROM ( {% if not is_incremental() %} WHERE DATE_TRUNC('day', block_time) >= DATE '{{ project_start_date }}' {% else %} - WHERE DATE_TRUNC('day', block_time) >= DATE_TRUNC('day', NOW() - INTERVAL '1' day) + WHERE {{ incremental_predicate('block_time') }} {% endif %} AND "from" = 0xDC24316b9AE028F1497c275EB9192a3Ea0f67022 AND success @@ -162,7 +162,7 @@ group by 1 {% if not is_incremental() %} WHERE DATE_TRUNC('day', p.minute) >= DATE '{{ project_start_date }}' {% else %} - WHERE DATE_TRUNC('day', p.minute) >= DATE_TRUNC('day', NOW() - INTERVAL '1' day) + WHERE {{ incremental_predicate('p.minute') }} {% endif %} and date_trunc('day', minute) < current_date and blockchain = 'ethereum' @@ -192,7 +192,7 @@ group by 1 {% if not is_incremental() %} WHERE DATE_TRUNC('day', p.minute) >= DATE '{{ project_start_date }}' {% else %} - WHERE DATE_TRUNC('day', p.minute) >= DATE_TRUNC('day', NOW() - INTERVAL '1' day) + WHERE {{ incremental_predicate('p.minute') }} {% endif %} and blockchain = 'ethereum' and symbol = 'WETH' @@ -207,7 +207,7 @@ group by 1 {% if not is_incremental() %} WHERE DATE_TRUNC('day', p.minute) >= DATE '{{ project_start_date }}' {% else %} - WHERE DATE_TRUNC('day', p.minute) >= DATE_TRUNC('day', NOW() - INTERVAL '1' day) + WHERE {{ incremental_predicate('p.minute') }} {% endif %} and date_trunc('day', minute) < current_date and blockchain = 'ethereum' @@ -231,7 +231,7 @@ group by 1 {% if not is_incremental() %} WHERE DATE_TRUNC('day', evt_block_time) >= DATE '{{ project_start_date }}' {% else %} - WHERE DATE_TRUNC('day', evt_block_time) >= DATE_TRUNC('day', NOW() - INTERVAL '1' day) + WHERE {{ incremental_predicate('evt_block_time') }} {% endif %} group by 1 @@ -256,7 +256,9 @@ group by 1 select 'ethereum curve ETH:stETH 0.04' as pool_name, 0xDC24316b9AE028F1497c275EB9192a3Ea0f67022 as pool, - 'ethereum' as blockchain, 'curve' as project,0.04 as fee, + 'ethereum' as blockchain, + 'curve' as project, + 0.04 as fee, cast(b.time as date) as time, 0xae7ab96520DE3A18E5e111B5EaAb095312D7fE84 as main_token, 'stETH' as main_token_symbol, diff --git a/models/lido/liquidity/ethereum/lido_liquidity_ethereum_curve_wsteth_reth_pool.sql b/models/lido/liquidity/ethereum/lido_liquidity_ethereum_curve_wsteth_reth_pool.sql index 3261b9e9456..7923ea30411 100644 --- a/models/lido/liquidity/ethereum/lido_liquidity_ethereum_curve_wsteth_reth_pool.sql +++ b/models/lido/liquidity/ethereum/lido_liquidity_ethereum_curve_wsteth_reth_pool.sql @@ -1,15 +1,15 @@ {{ config( - alias = 'curve_wsteth_reth_pool', - + alias = 'curve_wsteth_reth_pool', materialized = 'incremental', file_format = 'delta', incremental_strategy = 'merge', unique_key = ['pool', 'time'], - post_hook='{{ expose_spells(\'["ethereum"]\', - "project", - "lido_liquidity", - \'["ppclunghe"]\') }}' + incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.time')], + post_hook='{{ expose_spells(blockchains = \'["ethereum"]\', + spell_type = "project", + spell_name = "lido_liquidity", + contributors = \'["pipistrella"]\') }}' ) }} @@ -75,7 +75,7 @@ from {{source('erc20_ethereum','evt_Transfer')}} t {% if not is_incremental() %} WHERE DATE_TRUNC('day', evt_block_time) >= DATE '{{ project_start_date }}' {% else %} - WHERE DATE_TRUNC('day', evt_block_time) >= DATE_TRUNC('day', NOW() - INTERVAL '1' day) + WHERE {{ incremental_predicate('evt_block_time') }} {% endif %} and contract_address = 0xae78736Cd615f374D3085123A210448E74Fc6393 and to = 0x447Ddd4960d9fdBF6af9a790560d0AF76795CB08 @@ -90,7 +90,7 @@ from {{source('erc20_ethereum','evt_Transfer')}} t {% if not is_incremental() %} WHERE DATE_TRUNC('day', evt_block_time) >= DATE '{{ project_start_date }}' {% else %} - WHERE DATE_TRUNC('day', evt_block_time) >= DATE_TRUNC('day', NOW() - INTERVAL '1' day) + WHERE {{ incremental_predicate('evt_block_time') }} {% endif %} and contract_address = 0xae78736Cd615f374D3085123A210448E74Fc6393 and "from" = 0x447Ddd4960d9fdBF6af9a790560d0AF76795CB08 @@ -121,7 +121,7 @@ order by 1 {% if not is_incremental() %} WHERE DATE_TRUNC('day', p.minute) >= DATE '{{ project_start_date }}' {% else %} - WHERE DATE_TRUNC('day', p.minute) >= DATE_TRUNC('day', NOW() - INTERVAL '1' day) + WHERE {{ incremental_predicate('p.minute') }} {% endif %} and date_trunc('day', minute) < current_date and blockchain = 'ethereum' @@ -151,7 +151,7 @@ order by 1 {% if not is_incremental() %} WHERE DATE_TRUNC('day', p.minute) >= DATE '{{ project_start_date }}' {% else %} - WHERE DATE_TRUNC('day', p.minute) >= DATE_TRUNC('day', NOW() - INTERVAL '1' day) + WHERE {{ incremental_predicate('p.minute') }} {% endif %} and blockchain = 'ethereum' and contract_address = 0x7f39C581F595B53c5cb19bD0b3f8dA6c935E2Ca0 @@ -166,7 +166,7 @@ order by 1 {% if not is_incremental() %} WHERE DATE_TRUNC('day', p.minute) >= DATE '{{ project_start_date }}' {% else %} - WHERE DATE_TRUNC('day', p.minute) >= DATE_TRUNC('day', NOW() - INTERVAL '1' day) + WHERE {{ incremental_predicate('p.minute') }} {% endif %} and date_trunc('day', minute) < current_date and blockchain = 'ethereum' @@ -190,7 +190,7 @@ order by 1 {% if not is_incremental() %} WHERE DATE_TRUNC('day', evt_block_time) >= DATE '{{ project_start_date }}' {% else %} - WHERE DATE_TRUNC('day', evt_block_time) >= DATE_TRUNC('day', NOW() - INTERVAL '1' day) + WHERE {{ incremental_predicate('evt_block_time') }} {% endif %} group by 1 @@ -213,10 +213,14 @@ order by 1 select 'ethereum curve rETH:wstETH 0.04' as pool_name, 0x447Ddd4960d9fdBF6af9a790560d0AF76795CB08 as pool, - 'ethereum' as blockchain, 'curve' as project,0.04 as fee, + 'ethereum' as blockchain, + 'curve' as project, + 0.04 as fee, cast(b.time as date) as time, - 0x7f39C581F595B53c5cb19bD0b3f8dA6c935E2Ca0 as main_token, 'wstETH' as main_token_symbol, - 0xae78736Cd615f374D3085123A210448E74Fc6393 as paired_token, 'rETH' as paired_token_symbol, + 0x7f39C581F595B53c5cb19bD0b3f8dA6c935E2Ca0 as main_token, + 'wstETH' as main_token_symbol, + 0xae78736Cd615f374D3085123A210448E74Fc6393 as paired_token, + 'rETH' as paired_token_symbol, wsteth as main_token_reserve, coalesce(reth.reth, 0) as paired_token_reserve, coalesce(wstethp.price, 0)as main_token_usd_price, diff --git a/models/lido/liquidity/ethereum/lido_liquidity_ethereum_kyberswap_pools.sql b/models/lido/liquidity/ethereum/lido_liquidity_ethereum_kyberswap_pools.sql index 89c1604f7bd..83ceb801b87 100644 --- a/models/lido/liquidity/ethereum/lido_liquidity_ethereum_kyberswap_pools.sql +++ b/models/lido/liquidity/ethereum/lido_liquidity_ethereum_kyberswap_pools.sql @@ -1,14 +1,14 @@ {{ config( - alias = 'kyberswap_pools', - + alias = 'kyberswap_pools', materialized = 'incremental', file_format = 'delta', incremental_strategy = 'merge', unique_key = ['pool', 'time'], - post_hook='{{ expose_spells(\'["ethereum"]\', - "project", - "lido_liquidity", - \'["ppclunghe", "gregshestakovlido"]\') }}' + incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.time')], + post_hook='{{ expose_spells(blockchains = \'["ethereum"]\', + spell_type = "project", + spell_name = "lido_liquidity", + contributors = \'["pipistrella", "zergil1397"]\') }}' ) }} @@ -49,7 +49,7 @@ select 0x7f39C581F595B53c5cb19bD0b3f8dA6c935E2Ca0 {% if not is_incremental() %} WHERE DATE_TRUNC('day', p.minute) >= DATE '{{ project_start_date }}' {% else %} - WHERE DATE_TRUNC('day', p.minute) >= DATE_TRUNC('day', NOW() - INTERVAL '1' day) + WHERE {{ incremental_predicate('p.minute') }} {% endif %} and date_trunc('day', minute) < current_date and blockchain = 'ethereum' @@ -83,7 +83,7 @@ select 0x7f39C581F595B53c5cb19bD0b3f8dA6c935E2Ca0 {% if not is_incremental() %} WHERE DATE_TRUNC('day', p.minute) >= DATE '{{ project_start_date }}' {% else %} - WHERE DATE_TRUNC('day', p.minute) >= DATE_TRUNC('day', NOW() - INTERVAL '1' day) + WHERE {{ incremental_predicate('p.minute') }} {% endif %} and blockchain = 'ethereum' and contract_address in (select address from tokens) @@ -104,7 +104,7 @@ select 0x7f39C581F595B53c5cb19bD0b3f8dA6c935E2Ca0 {% if not is_incremental() %} WHERE DATE_TRUNC('day', sw.evt_block_time) >= DATE '{{ project_start_date }}' {% else %} - WHERE DATE_TRUNC('day', sw.evt_block_time) >= DATE_TRUNC('day', NOW() - INTERVAL '1' day) + WHERE {{ incremental_predicate('sw.evt_block_time') }} {% endif %} and sw.contract_address in (select address from pools) group by 1,2,3,4 @@ -122,7 +122,7 @@ select 0x7f39C581F595B53c5cb19bD0b3f8dA6c935E2Ca0 {% if not is_incremental() %} WHERE DATE_TRUNC('day', mt.evt_block_time) >= DATE '{{ project_start_date }}' {% else %} - WHERE DATE_TRUNC('day', mt.evt_block_time) >= DATE_TRUNC('day', NOW() - INTERVAL '1' day) + WHERE {{ incremental_predicate('mt.evt_block_time') }} {% endif %} and mt.contract_address in (select address from pools) group by 1,2,3,4 @@ -141,7 +141,7 @@ select 0x7f39C581F595B53c5cb19bD0b3f8dA6c935E2Ca0 {% if not is_incremental() %} WHERE DATE_TRUNC('day', bn.evt_block_time) >= DATE '{{ project_start_date }}' {% else %} - WHERE DATE_TRUNC('day', bn.evt_block_time) >= DATE_TRUNC('day', NOW() - INTERVAL '1' day) + WHERE {{ incremental_predicate('bn.evt_block_time') }} {% endif %} and bn.contract_address in (select address from pools) group by 1,2,3,4 @@ -159,7 +159,7 @@ select 0x7f39C581F595B53c5cb19bD0b3f8dA6c935E2Ca0 {% if not is_incremental() %} WHERE DATE_TRUNC('day', bn.evt_block_time) >= DATE '{{ project_start_date }}' {% else %} - WHERE DATE_TRUNC('day', bn.evt_block_time) >= DATE_TRUNC('day', NOW() - INTERVAL '1' day) + WHERE {{ incremental_predicate('bn.evt_block_time') }} {% endif %} and bn.contract_address in (select address from pools) group by 1,2,3,4 @@ -207,7 +207,7 @@ select 0x7f39C581F595B53c5cb19bD0b3f8dA6c935E2Ca0 {% if not is_incremental() %} WHERE DATE_TRUNC('day', sw.evt_block_time) >= DATE '{{ project_start_date }}' {% else %} - WHERE DATE_TRUNC('day', sw.evt_block_time) >= DATE_TRUNC('day', NOW() - INTERVAL '1' day) + WHERE {{ incremental_predicate('sw.evt_block_time') }} {% endif %} and sw.contract_address in (select address from pools) group by 1,2,3,4 @@ -251,6 +251,6 @@ left join trading_volume tv on l.time = tv.time and l.pool = tv.pool -select CONCAT(CONCAT(CONCAT(CONCAT(CONCAT(blockchain,CONCAT(' ', project)) ,' '), paired_token_symbol),':') , main_token_symbol, ' ', format('%,.3f',round(coalesce(fee,0),4))) as pool_name,* +select blockchain||' '||project||' '||paired_token_symbol||':'||main_token_symbol||' '||format('%,.3f',round(coalesce(fee,0),4)) as pool_name,* from all_metrics diff --git a/models/lido/liquidity/ethereum/lido_liquidity_ethereum_kyberswap_v2_pools.sql b/models/lido/liquidity/ethereum/lido_liquidity_ethereum_kyberswap_v2_pools.sql index 040dc8f08f6..525245ee540 100644 --- a/models/lido/liquidity/ethereum/lido_liquidity_ethereum_kyberswap_v2_pools.sql +++ b/models/lido/liquidity/ethereum/lido_liquidity_ethereum_kyberswap_v2_pools.sql @@ -1,14 +1,14 @@ {{ config( - alias = 'kyberswap_v2_pools', - + alias = 'kyberswap_v2_pools', materialized = 'incremental', file_format = 'delta', incremental_strategy = 'merge', unique_key = ['pool', 'time'], - post_hook='{{ expose_spells(\'["ethereum"]\', - "project", - "lido_liquidity", - \'["ppclunghe"]\') }}' + incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.time')], + post_hook='{{ expose_spells(blockchains = \'["ethereum"]\', + spell_type = "project", + spell_name = "lido_liquidity", + contributors = \'["pipistrella"]\') }}' ) }} @@ -49,7 +49,7 @@ select 0x7f39C581F595B53c5cb19bD0b3f8dA6c935E2Ca0 {% if not is_incremental() %} WHERE DATE_TRUNC('day', p.minute) >= DATE '{{ project_start_date }}' {% else %} - WHERE DATE_TRUNC('day', p.minute) >= DATE_TRUNC('day', NOW() - INTERVAL '1' day) + WHERE {{ incremental_predicate('p.minute') }} {% endif %} and date_trunc('day', minute) < current_date and blockchain = 'ethereum' @@ -83,7 +83,7 @@ select 0x7f39C581F595B53c5cb19bD0b3f8dA6c935E2Ca0 {% if not is_incremental() %} WHERE DATE_TRUNC('day', p.minute) >= DATE '{{ project_start_date }}' {% else %} - WHERE DATE_TRUNC('day', p.minute) >= DATE_TRUNC('day', NOW() - INTERVAL '1' day) + WHERE {{ incremental_predicate('p.minute') }} {% endif %} and blockchain = 'ethereum' and contract_address in (select address from tokens) @@ -104,7 +104,7 @@ select 0x7f39C581F595B53c5cb19bD0b3f8dA6c935E2Ca0 {% if not is_incremental() %} WHERE DATE_TRUNC('day', sw.evt_block_time) >= DATE '{{ project_start_date }}' {% else %} - WHERE DATE_TRUNC('day', sw.evt_block_time) >= DATE_TRUNC('day', NOW() - INTERVAL '1' day) + WHERE {{ incremental_predicate('sw.evt_block_time') }} {% endif %} and sw.contract_address in (select address from pools) group by 1,2,3,4 @@ -122,7 +122,7 @@ select 0x7f39C581F595B53c5cb19bD0b3f8dA6c935E2Ca0 {% if not is_incremental() %} WHERE DATE_TRUNC('day', mt.evt_block_time) >= DATE '{{ project_start_date }}' {% else %} - WHERE DATE_TRUNC('day', mt.evt_block_time) >= DATE_TRUNC('day', NOW() - INTERVAL '1' day) + WHERE {{ incremental_predicate('mt.evt_block_time') }} {% endif %} and mt.contract_address in (select address from pools) group by 1,2,3,4 @@ -141,7 +141,7 @@ select 0x7f39C581F595B53c5cb19bD0b3f8dA6c935E2Ca0 {% if not is_incremental() %} WHERE DATE_TRUNC('day', bn.evt_block_time) >= DATE '{{ project_start_date }}' {% else %} - WHERE DATE_TRUNC('day', bn.evt_block_time) >= DATE_TRUNC('day', NOW() - INTERVAL '1' day) + WHERE {{ incremental_predicate('bn.evt_block_time') }} {% endif %} and bn.contract_address in (select address from pools) group by 1,2,3,4 @@ -159,7 +159,7 @@ select 0x7f39C581F595B53c5cb19bD0b3f8dA6c935E2Ca0 {% if not is_incremental() %} WHERE DATE_TRUNC('day', bn.evt_block_time) >= DATE '{{ project_start_date }}' {% else %} - WHERE DATE_TRUNC('day', bn.evt_block_time) >= DATE_TRUNC('day', NOW() - INTERVAL '1' day) + WHERE {{ incremental_predicate('bn.evt_block_time') }} {% endif %} and bn.contract_address in (select address from pools) group by 1,2,3,4 @@ -207,7 +207,7 @@ select 0x7f39C581F595B53c5cb19bD0b3f8dA6c935E2Ca0 {% if not is_incremental() %} WHERE DATE_TRUNC('day', sw.evt_block_time) >= DATE '{{ project_start_date }}' {% else %} - WHERE DATE_TRUNC('day', sw.evt_block_time) >= DATE_TRUNC('day', NOW() - INTERVAL '1' day) + WHERE {{ incremental_predicate('sw.evt_block_time') }} {% endif %} and sw.contract_address in (select address from pools) group by 1,2,3,4 @@ -251,6 +251,6 @@ left join trading_volume tv on l.time = tv.time and l.pool = tv.pool -select CONCAT(CONCAT(CONCAT(CONCAT(CONCAT(blockchain,CONCAT(' ', project)) ,' '), paired_token_symbol),':') , main_token_symbol, ' ', format('%,.3f',round(coalesce(fee,0),4))) as pool_name,* +select blockchain||' '||project||' '||paired_token_symbol||':'||main_token_symbol||' '||format('%,.3f',round(coalesce(fee,0),4)) as pool_name, * from all_metrics diff --git a/models/lido/liquidity/ethereum/lido_liquidity_ethereum_maverick_pools.sql b/models/lido/liquidity/ethereum/lido_liquidity_ethereum_maverick_pools.sql index dad438433f1..a8c8638bb6e 100644 --- a/models/lido/liquidity/ethereum/lido_liquidity_ethereum_maverick_pools.sql +++ b/models/lido/liquidity/ethereum/lido_liquidity_ethereum_maverick_pools.sql @@ -1,14 +1,14 @@ {{ config( - alias = 'maverick_pools', - + alias = 'maverick_pools', materialized = 'incremental', file_format = 'delta', incremental_strategy = 'merge', unique_key = ['pool', 'time'], - post_hook='{{ expose_spells(\'["ethereum"]\', - "project", - "lido_liquidity", - \'["ppclunghe"]\') }}' + incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.time')], + post_hook='{{ expose_spells(blockchains = \'["ethereum"]\', + spell_type = "project", + spell_name = "lido_liquidity", + contributors = \'["pipistrella"]\') }}' ) }} @@ -50,7 +50,7 @@ select 0x7f39C581F595B53c5cb19bD0b3f8dA6c935E2Ca0 {% if not is_incremental() %} WHERE DATE_TRUNC('day', p.minute) >= DATE '{{ project_start_date }}' {% else %} - WHERE DATE_TRUNC('day', p.minute) >= DATE_TRUNC('day', NOW() - INTERVAL '1' day) + WHERE {{ incremental_predicate('p.minute') }} {% endif %} and date_trunc('day', minute) < current_date and blockchain = 'ethereum' @@ -79,7 +79,7 @@ select 0x7f39C581F595B53c5cb19bD0b3f8dA6c935E2Ca0 {% if not is_incremental() %} WHERE DATE_TRUNC('day', p.minute) >= DATE '{{ project_start_date }}' {% else %} - WHERE DATE_TRUNC('day', p.minute) >= DATE_TRUNC('day', NOW() - INTERVAL '1' day) + WHERE {{ incremental_predicate('p.minute') }} {% endif %} and blockchain = 'ethereum' and contract_address = 0x7f39C581F595B53c5cb19bD0b3f8dA6c935E2Ca0 @@ -98,7 +98,7 @@ select 0x7f39C581F595B53c5cb19bD0b3f8dA6c935E2Ca0 {% if not is_incremental() %} WHERE DATE_TRUNC('day', sw.evt_block_time) >= DATE '{{ project_start_date }}' {% else %} - WHERE DATE_TRUNC('day', sw.evt_block_time) >= DATE_TRUNC('day', NOW() - INTERVAL '1' day) + WHERE {{ incremental_predicate('sw.evt_block_time') }} {% endif %} and sw.contract_address in (select poolAddress from pools) group by 1,2,3,4 @@ -115,7 +115,7 @@ left join {{source('maverick_v1_ethereum','factory_evt_PoolCreated')}} cr on a.c {% if not is_incremental() %} WHERE DATE_TRUNC('day', a.call_block_time) >= DATE '{{ project_start_date }}' {% else %} - WHERE DATE_TRUNC('day', a.call_block_time) >= DATE_TRUNC('day', NOW() - INTERVAL '1' day) + WHERE {{ incremental_predicate('a.call_block_time') }} {% endif %} and a.call_success and a.contract_address in (select poolAddress from pools) @@ -133,7 +133,7 @@ left join {{source('maverick_v1_ethereum','factory_evt_PoolCreated')}} cr on a.c {% if not is_incremental() %} WHERE DATE_TRUNC('day', a.call_block_time) >= DATE '{{ project_start_date }}' {% else %} - WHERE DATE_TRUNC('day', a.call_block_time) >= DATE_TRUNC('day', NOW() - INTERVAL '1' day) + WHERE {{ incremental_predicate('a.call_block_time') }} {% endif %} and a.call_success and a.contract_address in (select poolAddress from pools) @@ -190,7 +190,7 @@ GROUP BY 1,2,3,4,5 {% if not is_incremental() %} WHERE DATE_TRUNC('day', sw.evt_block_time) >= DATE '{{ project_start_date }}' {% else %} - WHERE DATE_TRUNC('day', sw.evt_block_time) >= DATE_TRUNC('day', NOW() - INTERVAL '1' day) + WHERE {{ incremental_predicate('sw.evt_block_time') }} {% endif %} and sw.contract_address in (select poolAddress from pools) group by 1,2,3,4 @@ -235,7 +235,7 @@ left join trading_volume t on o.time = t.time and o.pool = t.pool ) -select CONCAT(CONCAT(CONCAT(CONCAT(CONCAT(blockchain,CONCAT(' ', project)) ,' '), coalesce(paired_token_symbol,'unknown')),':') , main_token_symbol, ' ', fee, '(', cast(pool as varchar),')') as pool_name, +select blockchain||' '||project||' '||coalesce(paired_token_symbol,'unknown')||':'||main_token_symbol||' '||fee|| '('||cast(pool as varchar)||')' as pool_name, pool, blockchain, project, diff --git a/models/lido/liquidity/ethereum/lido_liquidity_ethereum_pancakeswap_v3_pools.sql b/models/lido/liquidity/ethereum/lido_liquidity_ethereum_pancakeswap_v3_pools.sql index 5e143561814..1ce44e4f37a 100644 --- a/models/lido/liquidity/ethereum/lido_liquidity_ethereum_pancakeswap_v3_pools.sql +++ b/models/lido/liquidity/ethereum/lido_liquidity_ethereum_pancakeswap_v3_pools.sql @@ -1,14 +1,14 @@ {{ config( - alias = 'pancakeswap_v3_pools', - + alias = 'pancakeswap_v3_pools', materialized = 'incremental', file_format = 'delta', incremental_strategy = 'merge', unique_key = ['pool', 'time'], - post_hook='{{ expose_spells(\'["ethereum"]\', - "project", - "lido_liquidity", - \'["ppclunghe"]\') }}' + incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.time')], + post_hook='{{ expose_spells(blockchains = \'["ethereum"]\', + spell_type = "project", + spell_name = "lido_liquidity", + contributors = \'["pipistrella"]\') }}' ) }} @@ -49,7 +49,7 @@ select 0x7f39C581F595B53c5cb19bD0b3f8dA6c935E2Ca0 {% if not is_incremental() %} WHERE DATE_TRUNC('day', p.minute) >= DATE '{{ project_start_date }}' {% else %} - WHERE DATE_TRUNC('day', p.minute) >= DATE_TRUNC('day', NOW() - INTERVAL '1' day) + WHERE {{ incremental_predicate('p.minute') }} {% endif %} and date_trunc('day', minute) < current_date and blockchain = 'ethereum' @@ -83,7 +83,7 @@ select 0x7f39C581F595B53c5cb19bD0b3f8dA6c935E2Ca0 {% if not is_incremental() %} WHERE DATE_TRUNC('day', p.minute) >= DATE '{{ project_start_date }}' {% else %} - WHERE DATE_TRUNC('day', p.minute) >= DATE_TRUNC('day', NOW() - INTERVAL '1' day) + WHERE {{ incremental_predicate('p.minute') }} {% endif %} and blockchain = 'ethereum' and contract_address in (select address from tokens) @@ -104,7 +104,7 @@ select 0x7f39C581F595B53c5cb19bD0b3f8dA6c935E2Ca0 {% if not is_incremental() %} WHERE DATE_TRUNC('day', sw.evt_block_time) >= DATE '{{ project_start_date }}' {% else %} - WHERE DATE_TRUNC('day', sw.evt_block_time) >= DATE_TRUNC('day', NOW() - INTERVAL '1' day) + WHERE {{ incremental_predicate('sw.evt_block_time') }} {% endif %} and sw.contract_address in (select address from pools) group by 1,2,3,4 @@ -122,7 +122,7 @@ select 0x7f39C581F595B53c5cb19bD0b3f8dA6c935E2Ca0 {% if not is_incremental() %} WHERE DATE_TRUNC('day', mt.evt_block_time) >= DATE '{{ project_start_date }}' {% else %} - WHERE DATE_TRUNC('day', mt.evt_block_time) >= DATE_TRUNC('day', NOW() - INTERVAL '1' day) + WHERE {{ incremental_predicate('mt.evt_block_time') }} {% endif %} and mt.contract_address in (select address from pools) group by 1,2,3,4 @@ -141,7 +141,7 @@ select 0x7f39C581F595B53c5cb19bD0b3f8dA6c935E2Ca0 {% if not is_incremental() %} WHERE DATE_TRUNC('day', bn.evt_block_time) >= DATE '{{ project_start_date }}' {% else %} - WHERE DATE_TRUNC('day', bn.evt_block_time) >= DATE_TRUNC('day', NOW() - INTERVAL '1' day) + WHERE {{ incremental_predicate('bn.evt_block_time') }} {% endif %} and bn.contract_address in (select address from pools) group by 1,2,3,4 @@ -163,7 +163,7 @@ select 0x7f39C581F595B53c5cb19bD0b3f8dA6c935E2Ca0 {% if not is_incremental() %} WHERE DATE_TRUNC('day', c.evt_block_time) >= DATE '{{ project_start_date }}' {% else %} - WHERE DATE_TRUNC('day', c.evt_block_time) >= DATE_TRUNC('day', NOW() - INTERVAL '1' day) + WHERE {{ incremental_predicate('c.evt_block_time') }} {% endif %} and c.contract_address IN (SELECT address FROM pools) ) @@ -210,7 +210,7 @@ select 0x7f39C581F595B53c5cb19bD0b3f8dA6c935E2Ca0 {% if not is_incremental() %} WHERE DATE_TRUNC('day', sw.evt_block_time) >= DATE '{{ project_start_date }}' {% else %} - WHERE DATE_TRUNC('day', sw.evt_block_time) >= DATE_TRUNC('day', NOW() - INTERVAL '1' day) + WHERE {{ incremental_predicate('sw.evt_block_time') }} {% endif %} and sw.contract_address in (select address from pools) group by 1,2,3,4 @@ -254,6 +254,6 @@ left join trading_volume tv on l.time = tv.time and l.pool = tv.pool -select CONCAT(CONCAT(CONCAT(CONCAT(CONCAT(blockchain,CONCAT(' ', project)) ,' '), COALESCE(paired_token_symbol, 'unknown')),':') , main_token_symbol, ' ', format('%,.3f',round(coalesce(fee,0),4))) as pool_name,* +select blockchain||' '||project||' '||COALESCE(paired_token_symbol, 'unknown')||':'||main_token_symbol||' '||format('%,.3f',round(coalesce(fee,0),4)) as pool_name,* from all_metrics diff --git a/models/lido/liquidity/ethereum/lido_liquidity_ethereum_solidly_pools.sql b/models/lido/liquidity/ethereum/lido_liquidity_ethereum_solidly_pools.sql index 8599193646b..5e7b827721c 100644 --- a/models/lido/liquidity/ethereum/lido_liquidity_ethereum_solidly_pools.sql +++ b/models/lido/liquidity/ethereum/lido_liquidity_ethereum_solidly_pools.sql @@ -1,14 +1,14 @@ {{ config( - alias = 'solidly_pools', - + alias = 'solidly_pools', materialized = 'incremental', file_format = 'delta', incremental_strategy = 'merge', unique_key = ['pool', 'time'], - post_hook='{{ expose_spells(\'["ethereum"]\', - "project", - "lido_liquidity", - \'["ppclunghe"]\') }}' + incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.time')], + post_hook='{{ expose_spells(blockchains = \'["ethereum"]\', + spell_type = "project", + spell_name = "lido_liquidity", + contributors = \'["pipistrella"]\') }}' ) }} @@ -52,7 +52,7 @@ group by 1 {% if not is_incremental() %} WHERE DATE_TRUNC('day', p.minute) >= DATE '{{ project_start_date }}' {% else %} - WHERE DATE_TRUNC('day', p.minute) >= DATE_TRUNC('day', NOW() - INTERVAL '1' day) + WHERE {{ incremental_predicate('p.minute') }} {% endif %} and date_trunc('day', minute) < current_date @@ -116,7 +116,7 @@ group by 1 {% if not is_incremental() %} WHERE DATE_TRUNC('day', p.minute) >= DATE '{{ project_start_date }}' {% else %} - WHERE DATE_TRUNC('day', p.minute) >= DATE_TRUNC('day', NOW() - INTERVAL '1' day) + WHERE {{ incremental_predicate('p.minute') }} {% endif %} AND DATE_TRUNC('day', minute) < current_date AND blockchain = 'ethereum' @@ -164,7 +164,7 @@ group by 1 {% if not is_incremental() %} WHERE DATE_TRUNC('day', p.minute) >= DATE '{{ project_start_date }}' {% else %} - WHERE DATE_TRUNC('day', p.minute) >= DATE_TRUNC('day', NOW() - INTERVAL '1' day) + WHERE {{ incremental_predicate('p.minute') }} {% endif %} AND blockchain = 'ethereum' AND contract_address IN (SELECT address FROM tokens) @@ -185,7 +185,7 @@ group by 1 {% if not is_incremental() %} WHERE DATE_TRUNC('day', sw.evt_block_time) >= DATE '{{ project_start_date }}' {% else %} - WHERE DATE_TRUNC('day', sw.evt_block_time) >= DATE_TRUNC('day', NOW() - INTERVAL '1' day) + WHERE {{ incremental_predicate('sw.evt_block_time') }} {% endif %} and sw.contract_address IN (SELECT address FROM pools) GROUP BY 1, 2, 3, 4 @@ -205,7 +205,7 @@ group by 1 {% if not is_incremental() %} WHERE DATE_TRUNC('day', mt.evt_block_time) >= DATE '{{ project_start_date }}' {% else %} - WHERE DATE_TRUNC('day', mt.evt_block_time) >= DATE_TRUNC('day', NOW() - INTERVAL '1' day) + WHERE {{ incremental_predicate('mt.evt_block_time') }} {% endif %} and mt.contract_address IN (SELECT address FROM pools) GROUP BY 1, 2, 3, 4 @@ -227,7 +227,7 @@ group by 1 {% if not is_incremental() %} WHERE DATE_TRUNC('day', c.evt_block_time) >= DATE '{{ project_start_date }}' {% else %} - WHERE DATE_TRUNC('day', c.evt_block_time) >= DATE_TRUNC('day', NOW() - INTERVAL '1' day) + WHERE {{ incremental_predicate('c.evt_block_time') }} {% endif %} and c.contract_address IN (SELECT address FROM pools) ) @@ -314,7 +314,7 @@ group by 1 {% if not is_incremental() %} WHERE DATE_TRUNC('day', sw.evt_block_time) >= DATE '{{ project_start_date }}' {% else %} - WHERE DATE_TRUNC('day', sw.evt_block_time) >= DATE_TRUNC('day', NOW() - INTERVAL '1' day) + WHERE {{ incremental_predicate('sw.evt_block_time') }} {% endif %} GROUP BY 1, 2, 3, 4 @@ -386,37 +386,7 @@ group by 1 LEFT JOIN steth_prices_daily on steth_prices_daily.time = l.time LEFT JOIN trading_volume AS tv ON l.time = tv.time AND l.pool = tv.pool ) -SELECT - CONCAT( - CAST( - CONCAT( - CAST( - CONCAT( - CAST( - CONCAT( - CAST( - CONCAT( - CAST(blockchain AS VARCHAR), - CAST( - CONCAT(CAST(' ' AS VARCHAR), CAST(project AS VARCHAR)) AS VARCHAR - ) - ) AS VARCHAR - ), - CAST(' ' AS VARCHAR) - ) AS VARCHAR - ), - CAST( - COALESCE(paired_token_symbol, 'unknown') AS VARCHAR - ) - ) AS VARCHAR - ), - CAST(':' AS VARCHAR) - ) AS VARCHAR - ), - CAST(main_token_symbol AS VARCHAR), - CAST(' ' AS VARCHAR), - format('%,.3f',round(coalesce(fee,0),4)) - ) AS pool_name, +SELECT blockchain||' '||project||' ' ||COALESCE(paired_token_symbol, 'unknown')||':'||main_token_symbol||' '||format('%,.3f',round(coalesce(fee,0),4)) AS pool_name, * FROM all_metrics diff --git a/models/lido/liquidity/ethereum/lido_liquidity_ethereum_uniswap_v2_pools.sql b/models/lido/liquidity/ethereum/lido_liquidity_ethereum_uniswap_v2_pools.sql index 592d5c20a78..fd3b52fdcd8 100644 --- a/models/lido/liquidity/ethereum/lido_liquidity_ethereum_uniswap_v2_pools.sql +++ b/models/lido/liquidity/ethereum/lido_liquidity_ethereum_uniswap_v2_pools.sql @@ -1,14 +1,14 @@ {{ config( - alias = 'uniswap_v2_pools', - + alias = 'uniswap_v2_pools', materialized = 'incremental', file_format = 'delta', incremental_strategy = 'merge', unique_key = ['pool', 'time'], - post_hook='{{ expose_spells(\'["ethereum"]\', - "project", - "lido_liquidity", - \'["ppclunghe", "gregshestakovlido"]\') }}' + incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.time')], + post_hook='{{ expose_spells(blockchains = \'["ethereum"]\', + spell_type = "project", + spell_name = "lido_liquidity", + contributors = \'["pipistrella", "zergil1397"]\') }}' ) }} @@ -67,7 +67,7 @@ cross join unnest(day) as days(day) {% if not is_incremental() %} WHERE DATE_TRUNC('day', p.minute) >= DATE '{{ project_start_date }}' {% else %} - WHERE DATE_TRUNC('day', p.minute) >= DATE_TRUNC('day', NOW() - INTERVAL '1' day) + WHERE {{ incremental_predicate('p.minute') }} {% endif %} AND DATE_TRUNC('day', minute) < current_date AND blockchain = 'ethereum' @@ -114,7 +114,7 @@ cross join unnest(day) as days(day) {% if not is_incremental() %} WHERE DATE_TRUNC('day', p.minute) >= DATE '{{ project_start_date }}' {% else %} - WHERE DATE_TRUNC('day', p.minute) >= DATE_TRUNC('day', NOW() - INTERVAL '1' day) + WHERE {{ incremental_predicate('p.minute') }} {% endif %} AND blockchain = 'ethereum' AND contract_address IN (SELECT address FROM tokens) @@ -136,7 +136,7 @@ cross join unnest(day) as days(day) {% if not is_incremental() %} WHERE DATE_TRUNC('day', sw.evt_block_time) >= DATE '{{ project_start_date }}' {% else %} - WHERE DATE_TRUNC('day', sw.evt_block_time) >= DATE_TRUNC('day', NOW() - INTERVAL '1' day) + WHERE {{ incremental_predicate('sw.evt_block_time') }} {% endif %} and sw.contract_address IN (SELECT address FROM pools) GROUP BY 1,2,3,4 @@ -155,7 +155,7 @@ cross join unnest(day) as days(day) {% if not is_incremental() %} WHERE DATE_TRUNC('day', mt.evt_block_time) >= DATE '{{ project_start_date }}' {% else %} - WHERE DATE_TRUNC('day', mt.evt_block_time) >= DATE_TRUNC('day', NOW() - INTERVAL '1' day) + WHERE {{ incremental_predicate('mt.evt_block_time') }} {% endif %} and mt.contract_address IN (SELECT address FROM pools) GROUP BY 1, 2, 3, 4 @@ -175,7 +175,7 @@ cross join unnest(day) as days(day) {% if not is_incremental() %} WHERE DATE_TRUNC('day', bn.evt_block_time) >= DATE '{{ project_start_date }}' {% else %} - WHERE DATE_TRUNC('day', bn.evt_block_time) >= DATE_TRUNC('day', NOW() - INTERVAL '1' day) + WHERE {{ incremental_predicate('bn.evt_block_time') }} {% endif %} and bn.contract_address IN (SELECT address FROM pools) GROUP BY 1, 2, 3, 4 @@ -221,7 +221,7 @@ cross join unnest(day) as days(day) {% if not is_incremental() %} WHERE DATE_TRUNC('day', sw.evt_block_time) >= DATE '{{ project_start_date }}' {% else %} - WHERE DATE_TRUNC('day', sw.evt_block_time) >= DATE_TRUNC('day', NOW() - INTERVAL '1' day) + WHERE {{ incremental_predicate('sw.evt_block_time') }} {% endif %} GROUP BY 1, 2, 3, 4 @@ -266,5 +266,5 @@ left join trading_volume AS tv ON l.time = tv.time AND l.pool = tv.pool -select CONCAT(CONCAT(CONCAT(CONCAT(CONCAT(blockchain,CONCAT(' ', project)) ,' '), COALESCE(paired_token_symbol, 'unknown')),':') , main_token_symbol, ' ', format('%,.3f',round(coalesce(fee,0),4))) as pool_name,* +select blockchain||' '||project||' '||COALESCE(paired_token_symbol, 'unknown')||':'||main_token_symbol||' '||format('%,.3f',round(coalesce(fee,0),4)) as pool_name,* from all_metrics diff --git a/models/lido/liquidity/ethereum/lido_liquidity_ethereum_uniswap_v3_pools.sql b/models/lido/liquidity/ethereum/lido_liquidity_ethereum_uniswap_v3_pools.sql index f7f57dcc73a..5c01710c7c5 100644 --- a/models/lido/liquidity/ethereum/lido_liquidity_ethereum_uniswap_v3_pools.sql +++ b/models/lido/liquidity/ethereum/lido_liquidity_ethereum_uniswap_v3_pools.sql @@ -1,14 +1,14 @@ {{ config( - alias = 'uniswap_v3_pools', - + alias = 'uniswap_v3_pools', materialized = 'incremental', file_format = 'delta', incremental_strategy = 'merge', unique_key = ['pool', 'time'], - post_hook='{{ expose_spells(\'["ethereum"]\', - "project", - "lido_liquidity", - \'["pipistrella", "zergil1397"]\') }}' + incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.time')], + post_hook='{{ expose_spells(blockchains = \'["ethereum"]\', + spell_type = "project", + spell_name = "lido_liquidity", + contributors = \'["pipistrella", "zergil1397"]\') }}' ) }} @@ -52,7 +52,7 @@ group by 1 {% if not is_incremental() %} WHERE DATE_TRUNC('day', p.minute) >= DATE '{{ project_start_date }}' {% else %} - WHERE DATE_TRUNC('day', p.minute) >= DATE_TRUNC('day', NOW() - INTERVAL '1' day) + WHERE {{ incremental_predicate('p.minute') }} {% endif %} and date_trunc('day', minute) < current_date @@ -116,7 +116,7 @@ group by 1 {% if not is_incremental() %} WHERE DATE_TRUNC('day', p.minute) >= DATE '{{ project_start_date }}' {% else %} - WHERE DATE_TRUNC('day', p.minute) >= DATE_TRUNC('day', NOW() - INTERVAL '1' day) + WHERE {{ incremental_predicate('p.minute') }} {% endif %} AND DATE_TRUNC('day', minute) < current_date AND blockchain = 'ethereum' @@ -178,7 +178,7 @@ group by 1 {% if not is_incremental() %} WHERE DATE_TRUNC('day', p.minute) >= DATE '{{ project_start_date }}' {% else %} - WHERE DATE_TRUNC('day', p.minute) >= DATE_TRUNC('day', NOW() - INTERVAL '1' day) + WHERE {{ incremental_predicate('p.minute') }} {% endif %} AND blockchain = 'ethereum' AND contract_address IN (SELECT address FROM tokens) @@ -199,7 +199,7 @@ group by 1 {% if not is_incremental() %} WHERE DATE_TRUNC('day', sw.evt_block_time) >= DATE '{{ project_start_date }}' {% else %} - WHERE DATE_TRUNC('day', sw.evt_block_time) >= DATE_TRUNC('day', NOW() - INTERVAL '1' day) + WHERE {{ incremental_predicate('sw.evt_block_time') }} {% endif %} and sw.contract_address IN (SELECT address FROM pools) GROUP BY 1, 2, 3, 4 @@ -219,7 +219,7 @@ group by 1 {% if not is_incremental() %} WHERE DATE_TRUNC('day', mt.evt_block_time) >= DATE '{{ project_start_date }}' {% else %} - WHERE DATE_TRUNC('day', mt.evt_block_time) >= DATE_TRUNC('day', NOW() - INTERVAL '1' day) + WHERE {{ incremental_predicate('mt.evt_block_time') }} {% endif %} and mt.contract_address IN (SELECT address FROM pools) GROUP BY 1, 2, 3, 4 @@ -241,7 +241,7 @@ group by 1 {% if not is_incremental() %} WHERE DATE_TRUNC('day', c.evt_block_time) >= DATE '{{ project_start_date }}' {% else %} - WHERE DATE_TRUNC('day', c.evt_block_time) >= DATE_TRUNC('day', NOW() - INTERVAL '1' day) + WHERE {{ incremental_predicate('c.evt_block_time') }} {% endif %} and c.contract_address IN (SELECT address FROM pools) ) @@ -328,7 +328,7 @@ group by 1 {% if not is_incremental() %} WHERE DATE_TRUNC('day', sw.evt_block_time) >= DATE '{{ project_start_date }}' {% else %} - WHERE DATE_TRUNC('day', sw.evt_block_time) >= DATE_TRUNC('day', NOW() - INTERVAL '1' day) + WHERE {{ incremental_predicate('sw.evt_block_time') }} {% endif %} GROUP BY 1, 2, 3, 4 @@ -400,37 +400,7 @@ group by 1 LEFT JOIN steth_prices_daily on steth_prices_daily.time = l.time LEFT JOIN trading_volume AS tv ON l.time = tv.time AND l.pool = tv.pool ) -SELECT - CONCAT( - CAST( - CONCAT( - CAST( - CONCAT( - CAST( - CONCAT( - CAST( - CONCAT( - CAST(blockchain AS VARCHAR), - CAST( - CONCAT(CAST(' ' AS VARCHAR), CAST(project AS VARCHAR)) AS VARCHAR - ) - ) AS VARCHAR - ), - CAST(' ' AS VARCHAR) - ) AS VARCHAR - ), - CAST( - COALESCE(paired_token_symbol, 'unknown') AS VARCHAR - ) - ) AS VARCHAR - ), - CAST(':' AS VARCHAR) - ) AS VARCHAR - ), - CAST(main_token_symbol AS VARCHAR), - CAST(' ' AS VARCHAR), - format('%,.3f',round(coalesce(fee,0),4)) - ) AS pool_name, +SELECT blockchain||' '||project||' '||COALESCE(paired_token_symbol, 'unknown')||':'||main_token_symbol ||' ' ||format('%,.3f',round(coalesce(fee,0),4)) AS pool_name, * FROM all_metrics diff --git a/models/lido/liquidity/linea/lido_liquidity_linea_syncswap_pools.sql b/models/lido/liquidity/linea/lido_liquidity_linea_syncswap_pools.sql index 9df7356a31f..d827943ccb1 100644 --- a/models/lido/liquidity/linea/lido_liquidity_linea_syncswap_pools.sql +++ b/models/lido/liquidity/linea/lido_liquidity_linea_syncswap_pools.sql @@ -5,6 +5,7 @@ file_format = 'delta', incremental_strategy = 'merge', unique_key = ['pool', 'time'], + incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.time')], post_hook='{{ expose_spells(blockchains = \'["linea"]\', spell_type = "project", spell_name = "lido_liquidity", diff --git a/models/lido/liquidity/optimism/lido_liquidity_optimism_balancer_pools.sql b/models/lido/liquidity/optimism/lido_liquidity_optimism_balancer_pools.sql index b09fac87ccc..bc52a907c6a 100644 --- a/models/lido/liquidity/optimism/lido_liquidity_optimism_balancer_pools.sql +++ b/models/lido/liquidity/optimism/lido_liquidity_optimism_balancer_pools.sql @@ -6,10 +6,11 @@ file_format = 'delta', incremental_strategy = 'merge', unique_key = ['pool', 'time'], - post_hook='{{ expose_spells(\'["optimism"]\', - "project", - "lido_liquidity", - \'["ppclunghe"]\') }}' + incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.time')], + post_hook='{{ expose_spells(blockchains = \'["optimism"]\', + spell_type = "project", + spell_name = "lido_liquidity", + contributors = \'["pipistrella"]\') }}' ) }} @@ -70,7 +71,7 @@ WHERE call_create.output_0 in (select distinct poolAddress from pools) {% if not is_incremental() %} WHERE DATE_TRUNC('day', p.minute) >= DATE '{{ project_start_date }}' {% else %} - WHERE DATE_TRUNC('day', p.minute) >= DATE_TRUNC('day', NOW() - INTERVAL '1' day) + WHERE {{ incremental_predicate('p.minute') }} {% endif %} and date_trunc('day', minute) < date_trunc('day', now()) @@ -99,7 +100,7 @@ WHERE call_create.output_0 in (select distinct poolAddress from pools) {% if not is_incremental() %} WHERE DATE_TRUNC('day', p.minute) >= DATE '{{ project_start_date }}' {% else %} - WHERE DATE_TRUNC('day', p.minute) >= DATE_TRUNC('day', NOW() - INTERVAL '1' day) + WHERE {{ incremental_predicate('p.minute') }} {% endif %} and date_trunc('day', minute) < current_date @@ -118,7 +119,7 @@ union all and blockchain = 'optimism' and contract_address = 0x7F5c764cBc14f9669B88837ca1490cCa17c31607 union all -SELECT distinct + SELECT distinct DATE_TRUNC('day', minute) AS time, 0x6af3737f6d58ae8bcb9f2b597125d37244596e59 as token, 'bb-rf-soWBTC', @@ -128,7 +129,7 @@ SELECT distinct {% if not is_incremental() %} WHERE DATE_TRUNC('day', p.minute) >= DATE '{{ project_start_date }}' {% else %} - WHERE DATE_TRUNC('day', p.minute) >= DATE_TRUNC('day', NOW() - INTERVAL '1' day) + WHERE {{ incremental_predicate('p.minute') }} {% endif %} and date_trunc('day', minute) < current_date @@ -157,7 +158,7 @@ SELECT distinct {% if not is_incremental() %} WHERE DATE_TRUNC('day', p.minute) >= DATE '{{ project_start_date }}' {% else %} - WHERE DATE_TRUNC('day', p.minute) >= DATE_TRUNC('day', NOW() - INTERVAL '1' day) + WHERE {{ incremental_predicate('p.minute') }} {% endif %} and date_trunc('day', minute) < current_date @@ -188,7 +189,7 @@ union all {% if not is_incremental() %} WHERE DATE_TRUNC('day', p.minute) >= DATE '{{ project_start_date }}' {% else %} - WHERE DATE_TRUNC('day', p.minute) >= DATE_TRUNC('day', NOW() - INTERVAL '1' day) + WHERE {{ incremental_predicate('p.minute') }} {% endif %} and blockchain = 'optimism' @@ -213,7 +214,7 @@ union all {% if not is_incremental() %} WHERE DATE_TRUNC('day', evt_block_time) >= DATE '{{ project_start_date }}' {% else %} - WHERE DATE_TRUNC('day', evt_block_time) >= DATE_TRUNC('day', NOW() - INTERVAL '1' day) + WHERE {{ incremental_predicate('evt_block_time') }} {% endif %} and poolId in (select pool_id from pools) @@ -228,7 +229,7 @@ union all {% if not is_incremental() %} WHERE DATE_TRUNC('day', evt_block_time) >= DATE '{{ project_start_date }}' {% else %} - WHERE DATE_TRUNC('day', evt_block_time) >= DATE_TRUNC('day', NOW() - INTERVAL '1' day) + WHERE {{ incremental_predicate('evt_block_time') }} {% endif %} and poolId in (select pool_id from pools) @@ -247,7 +248,7 @@ union all {% if not is_incremental() %} WHERE DATE_TRUNC('day', evt_block_time) >= DATE '{{ project_start_date }}' {% else %} - WHERE DATE_TRUNC('day', evt_block_time) >= DATE_TRUNC('day', NOW() - INTERVAL '1' day) + WHERE {{ incremental_predicate('evt_block_time') }} {% endif %} and poolId in (select pool_id from pools) @@ -265,7 +266,7 @@ union all {% if not is_incremental() %} WHERE DATE_TRUNC('day', evt_block_time) >= DATE '{{ project_start_date }}' {% else %} - WHERE DATE_TRUNC('day', evt_block_time) >= DATE_TRUNC('day', NOW() - INTERVAL '1' day) + WHERE {{ incremental_predicate('evt_block_time') }} {% endif %} and poolId in (select pool_id from pools) @@ -438,7 +439,7 @@ on main.day = paired4.day and main.pool_id = paired4.pool_id {% if not is_incremental() %} WHERE DATE_TRUNC('day', s.evt_block_time) >= DATE '{{ project_start_date }}' {% else %} - WHERE DATE_TRUNC('day', s.evt_block_time) >= DATE_TRUNC('day', NOW() - INTERVAL '1' day) + WHERE {{ incremental_predicate('s.evt_block_time') }} {% endif %} and s.poolId in (select pool_id from pools) group by 1,2 diff --git a/models/lido/liquidity/optimism/lido_liquidity_optimism_curve_pools.sql b/models/lido/liquidity/optimism/lido_liquidity_optimism_curve_pools.sql index aebee42d694..12343834b6b 100644 --- a/models/lido/liquidity/optimism/lido_liquidity_optimism_curve_pools.sql +++ b/models/lido/liquidity/optimism/lido_liquidity_optimism_curve_pools.sql @@ -6,10 +6,12 @@ file_format = 'delta', incremental_strategy = 'merge', unique_key = ['pool', 'time'], - post_hook='{{ expose_spells(\'["optimism"]\', - "project", - "lido_liquidity", - \'["ppclunghe", "kemasan"]\') }}' + incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.time')], + post_hook='{{ expose_spells(blockchains = \'["optimism"]\', + spell_type = "project", + spell_name = "lido_liquidity", + contributors = \'["pipistrella", "kemasan"]\') }}' + ) }} @@ -28,8 +30,8 @@ with {% if not is_incremental() %} WHERE DATE_TRUNC('day', p.minute) >= DATE '{{ project_start_date }}' - {% else %} - WHERE DATE_TRUNC('day', p.minute) >= DATE_TRUNC('day', NOW() - INTERVAL '1' day) + {% else %} + WHERE {{ incremental_predicate('p.minute') }} {% endif %} and date_trunc('day', minute) < current_date @@ -64,7 +66,7 @@ with {% if not is_incremental() %} WHERE DATE_TRUNC('day', p.minute) >= DATE '{{ project_start_date }}' {% else %} - WHERE DATE_TRUNC('day', p.minute) >= DATE_TRUNC('day', NOW() - INTERVAL '1' day) + WHERE {{ incremental_predicate('p.minute') }} {% endif %} and blockchain = 'optimism' @@ -84,7 +86,7 @@ with {% if not is_incremental() %} WHERE DATE_TRUNC('day', p.minute) >= DATE '{{ project_start_date }}' {% else %} - WHERE DATE_TRUNC('day', p.minute) >= DATE_TRUNC('day', NOW() - INTERVAL '1' day) + WHERE {{ incremental_predicate('p.minute') }} {% endif %} and date_trunc('day', minute) < date_trunc('day', now()) @@ -115,7 +117,7 @@ with {% if not is_incremental() %} WHERE DATE_TRUNC('day', evt_block_time) >= DATE '{{ project_start_date }}' {% else %} - WHERE DATE_TRUNC('day', evt_block_time) >= DATE_TRUNC('day', NOW() - INTERVAL '1' day) + WHERE {{ incremental_predicate('evt_block_time') }} {% endif %} group by 1, 2 @@ -133,7 +135,7 @@ with {% if not is_incremental() %} WHERE DATE_TRUNC('day', evt_block_time) >= DATE '{{ project_start_date }}' {% else %} - WHERE DATE_TRUNC('day', evt_block_time) >= DATE_TRUNC('day', NOW() - INTERVAL '1' day) + WHERE {{ incremental_predicate('evt_block_time') }} {% endif %} and evt_tx_hash in (select evt_tx_hash from {{source('lido_optimism','wstETH_evt_Transfer')}}) @@ -148,7 +150,7 @@ with {% if not is_incremental() %} WHERE DATE_TRUNC('day', evt_block_time) >= DATE '{{ project_start_date }}' {% else %} - WHERE DATE_TRUNC('day', evt_block_time) >= DATE_TRUNC('day', NOW() - INTERVAL '1' day) + WHERE {{ incremental_predicate('evt_block_time') }} {% endif %} and evt_tx_hash not in (select evt_tx_hash from {{source('lido_optimism','wstETH_evt_Transfer')}}) @@ -163,7 +165,7 @@ with {% if not is_incremental() %} WHERE DATE_TRUNC('day', evt_block_time) >= DATE '{{ project_start_date }}' {% else %} - WHERE DATE_TRUNC('day', evt_block_time) >= DATE_TRUNC('day', NOW() - INTERVAL '1' day) + WHERE {{ incremental_predicate('evt_block_time') }} {% endif %} @@ -178,7 +180,7 @@ with {% if not is_incremental() %} WHERE DATE_TRUNC('day', evt_block_time) >= DATE '{{ project_start_date }}' {% else %} - WHERE DATE_TRUNC('day', evt_block_time) >= DATE_TRUNC('day', NOW() - INTERVAL '1' day) + WHERE {{ incremental_predicate('evt_block_time') }} {% endif %} @@ -197,7 +199,7 @@ with {% if not is_incremental() %} WHERE DATE_TRUNC('day', evt_block_time) >= DATE '{{ project_start_date }}' {% else %} - WHERE DATE_TRUNC('day', evt_block_time) >= DATE_TRUNC('day', NOW() - INTERVAL '1' day) + WHERE {{ incremental_predicate('evt_block_time') }} {% endif %} group by 1,2 @@ -268,7 +270,7 @@ with {% if not is_incremental() %} WHERE DATE_TRUNC('day', evt_block_time) >= DATE '{{ project_start_date }}' {% else %} - WHERE DATE_TRUNC('day', evt_block_time) >= DATE_TRUNC('day', NOW() - INTERVAL '1' day) + WHERE {{ incremental_predicate('evt_block_time') }} {% endif %} group by 1 @@ -316,6 +318,6 @@ with ) -select CONCAT(CONCAT(CONCAT(CONCAT(CONCAT(blockchain,CONCAT(' ', project)) ,' '), coalesce(paired_token_symbol,'unknown')),':') , main_token_symbol, ' ', format('%,.3f%%',round(coalesce(fee,0),4))) as pool_name,* +select blockchain||' '||project||' '||coalesce(paired_token_symbol,'unknown')||':'||main_token_symbol|| ' '||format('%,.3f%%',round(coalesce(fee,0),4)) as pool_name, * from all_metrics diff --git a/models/lido/liquidity/optimism/lido_liquidity_optimism_kyberswap_pools.sql b/models/lido/liquidity/optimism/lido_liquidity_optimism_kyberswap_pools.sql index e177cc2c0cc..fa4a889bc9d 100644 --- a/models/lido/liquidity/optimism/lido_liquidity_optimism_kyberswap_pools.sql +++ b/models/lido/liquidity/optimism/lido_liquidity_optimism_kyberswap_pools.sql @@ -6,10 +6,11 @@ file_format = 'delta', incremental_strategy = 'merge', unique_key = ['pool', 'time'], - post_hook='{{ expose_spells(\'["optimism"]\', - "project", - "lido_liquidity", - \'["ppclunghe", "gregshestakovlido"]\') }}' + incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.time')], + post_hook='{{ expose_spells(blockchains = \'["optimism"]\', + spell_type = "project", + spell_name = "lido_liquidity", + contributors = \'["pipistrella", "zergil1397"]\') }}' ) }} @@ -48,7 +49,7 @@ select 0x1F32b1c2345538c0c6f582fCB022739c4A194Ebb {% if not is_incremental() %} WHERE DATE_TRUNC('day', p.minute) >= DATE '{{ project_start_date }}' {% else %} - WHERE DATE_TRUNC('day', p.minute) >= DATE_TRUNC('day', NOW() - INTERVAL '1' day) + WHERE {{ incremental_predicate('p.minute') }} {% endif %} and date_trunc('day', minute) < current_date and blockchain = 'optimism' @@ -81,7 +82,7 @@ select 0x1F32b1c2345538c0c6f582fCB022739c4A194Ebb {% if not is_incremental() %} WHERE DATE_TRUNC('day', p.minute) >= DATE '{{ project_start_date }}' {% else %} - WHERE DATE_TRUNC('day', p.minute) >= DATE_TRUNC('day', NOW() - INTERVAL '1' day) + WHERE {{ incremental_predicate('p.minute') }} {% endif %} and blockchain = 'optimism' @@ -101,7 +102,7 @@ select 0x1F32b1c2345538c0c6f582fCB022739c4A194Ebb {% if not is_incremental() %} WHERE DATE_TRUNC('day', sw.evt_block_time) >= DATE '{{ project_start_date }}' {% else %} - WHERE DATE_TRUNC('day', sw.evt_block_time) >= DATE_TRUNC('day', NOW() - INTERVAL '1' day) + WHERE {{ incremental_predicate('sw.evt_block_time') }} {% endif %} and sw.contract_address in (select address from pools) group by 1,2,3,4 @@ -119,7 +120,7 @@ select 0x1F32b1c2345538c0c6f582fCB022739c4A194Ebb {% if not is_incremental() %} WHERE DATE_TRUNC('day', mt.evt_block_time) >= DATE '{{ project_start_date }}' {% else %} - WHERE DATE_TRUNC('day', mt.evt_block_time) >= DATE_TRUNC('day', NOW() - INTERVAL '1' day) + WHERE {{ incremental_predicate('mt.evt_block_time') }} {% endif %} and mt.contract_address in (select address from pools) group by 1,2,3,4 @@ -138,7 +139,7 @@ select 0x1F32b1c2345538c0c6f582fCB022739c4A194Ebb {% if not is_incremental() %} WHERE DATE_TRUNC('day', bn.evt_block_time) >= DATE '{{ project_start_date }}' {% else %} - WHERE DATE_TRUNC('day', bn.evt_block_time) >= DATE_TRUNC('day', NOW() - INTERVAL '1' day) + WHERE {{ incremental_predicate('bn.evt_block_time') }} {% endif %} and bn.contract_address in (select address from pools) group by 1,2,3,4 @@ -156,7 +157,7 @@ select 0x1F32b1c2345538c0c6f582fCB022739c4A194Ebb {% if not is_incremental() %} WHERE DATE_TRUNC('day', bn.evt_block_time) >= DATE '{{ project_start_date }}' {% else %} - WHERE DATE_TRUNC('day', bn.evt_block_time) >= DATE_TRUNC('day', NOW() - INTERVAL '1' day) + WHERE {{ incremental_predicate('bn.evt_block_time') }} {% endif %} and bn.contract_address in (select address from pools) group by 1,2,3,4 @@ -179,7 +180,7 @@ select 0x1F32b1c2345538c0c6f582fCB022739c4A194Ebb ) , pool_liquidity as ( - select time, --lead(time, 1, current_date + interval '1' day) over (order by time) as next_time, + select time, pool, token0, token1, sum(amount0) as amount0, sum(amount1) as amount1 @@ -202,7 +203,7 @@ select 0x1F32b1c2345538c0c6f582fCB022739c4A194Ebb {% if not is_incremental() %} WHERE DATE_TRUNC('day', sw.evt_block_time) >= DATE '{{ project_start_date }}' {% else %} - WHERE DATE_TRUNC('day', sw.evt_block_time) >= DATE_TRUNC('day', NOW() - INTERVAL '1' day) + WHERE {{ incremental_predicate('sw.evt_block_time') }} {% endif %} and sw.contract_address in (select address from pools) group by 1,2,3,4 @@ -243,5 +244,5 @@ left join trading_volume tv on l.time = tv.time and l.pool = tv.pool ) -select CONCAT(CONCAT(CONCAT(CONCAT(CONCAT(blockchain,CONCAT(' ', project)) ,' '), coalesce(paired_token_symbol, 'unknown')),':') , main_token_symbol, ' ', format('%,.3f%%',round(coalesce(fee,0),4))) as pool_name,* +select blockchain||' '||project||' '||coalesce(paired_token_symbol, 'unknown')||':'||main_token_symbol||' '||format('%,.3f%%',round(coalesce(fee,0),4)) as pool_name,* from all_metrics diff --git a/models/lido/liquidity/optimism/lido_liquidity_optimism_kyberswap_v2_pools.sql b/models/lido/liquidity/optimism/lido_liquidity_optimism_kyberswap_v2_pools.sql index cbdefa61357..b1d5f54ae9f 100644 --- a/models/lido/liquidity/optimism/lido_liquidity_optimism_kyberswap_v2_pools.sql +++ b/models/lido/liquidity/optimism/lido_liquidity_optimism_kyberswap_v2_pools.sql @@ -1,15 +1,16 @@ {{ config( schema='lido_liquidity_optimism', - alias = 'kyberswap_v2_pools', - + alias = 'kyberswap_v2_pools', materialized = 'incremental', file_format = 'delta', incremental_strategy = 'merge', unique_key = ['pool', 'time'], - post_hook='{{ expose_spells(\'["optimism"]\', - "project", - "lido_liquidity", - \'["ppclunghe"]\') }}' + incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.time')], + post_hook='{{ expose_spells(blockchains = \'["optimism"]\', + spell_type = "project", + spell_name = "lido_liquidity", + contributors = \'["pipistrella"]\') }}' + ) }} @@ -50,7 +51,7 @@ select 0x1F32b1c2345538c0c6f582fCB022739c4A194Ebb {% if not is_incremental() %} WHERE DATE_TRUNC('day', p.minute) >= DATE '{{ project_start_date }}' {% else %} - WHERE DATE_TRUNC('day', p.minute) >= DATE_TRUNC('day', NOW() - INTERVAL '1' day) + WHERE {{ incremental_predicate('p.minute') }} {% endif %} and date_trunc('day', minute) < current_date and blockchain = 'optimism' @@ -80,7 +81,7 @@ select 0x1F32b1c2345538c0c6f582fCB022739c4A194Ebb {% if not is_incremental() %} WHERE DATE_TRUNC('day', p.minute) >= DATE '{{ project_start_date }}' {% else %} - WHERE DATE_TRUNC('day', p.minute) >= DATE_TRUNC('day', NOW() - INTERVAL '1' day) + WHERE {{ incremental_predicate('p.minute') }} {% endif %} and date_trunc('day', minute) < current_date and blockchain = 'optimism' @@ -114,7 +115,7 @@ select 0x1F32b1c2345538c0c6f582fCB022739c4A194Ebb {% if not is_incremental() %} WHERE DATE_TRUNC('day', p.minute) >= DATE '{{ project_start_date }}' {% else %} - WHERE DATE_TRUNC('day', p.minute) >= DATE_TRUNC('day', NOW() - INTERVAL '1' day) + WHERE {{ incremental_predicate('p.minute') }} {% endif %} and blockchain = 'optimism' @@ -134,7 +135,7 @@ select 0x1F32b1c2345538c0c6f582fCB022739c4A194Ebb {% if not is_incremental() %} WHERE DATE_TRUNC('day', sw.evt_block_time) >= DATE '{{ project_start_date }}' {% else %} - WHERE DATE_TRUNC('day', sw.evt_block_time) >= DATE_TRUNC('day', NOW() - INTERVAL '1' day) + WHERE {{ incremental_predicate('sw.evt_block_time') }} {% endif %} and sw.contract_address in (select address from pools) group by 1,2,3,4 @@ -152,7 +153,7 @@ select 0x1F32b1c2345538c0c6f582fCB022739c4A194Ebb {% if not is_incremental() %} WHERE DATE_TRUNC('day', mt.evt_block_time) >= DATE '{{ project_start_date }}' {% else %} - WHERE DATE_TRUNC('day', mt.evt_block_time) >= DATE_TRUNC('day', NOW() - INTERVAL '1' day) + WHERE {{ incremental_predicate('mt.evt_block_time') }} {% endif %} and mt.contract_address in (select address from pools) group by 1,2,3,4 @@ -171,7 +172,7 @@ select 0x1F32b1c2345538c0c6f582fCB022739c4A194Ebb {% if not is_incremental() %} WHERE DATE_TRUNC('day', bn.evt_block_time) >= DATE '{{ project_start_date }}' {% else %} - WHERE DATE_TRUNC('day', bn.evt_block_time) >= DATE_TRUNC('day', NOW() - INTERVAL '1' day) + WHERE {{ incremental_predicate('bn.evt_block_time') }} {% endif %} and bn.contract_address in (select address from pools) group by 1,2,3,4 @@ -189,7 +190,7 @@ select 0x1F32b1c2345538c0c6f582fCB022739c4A194Ebb {% if not is_incremental() %} WHERE DATE_TRUNC('day', bn.evt_block_time) >= DATE '{{ project_start_date }}' {% else %} - WHERE DATE_TRUNC('day', bn.evt_block_time) >= DATE_TRUNC('day', NOW() - INTERVAL '1' day) + WHERE {{ incremental_predicate('bn.evt_block_time') }} {% endif %} and bn.contract_address in (select address from pools) group by 1,2,3,4 @@ -235,7 +236,7 @@ select 0x1F32b1c2345538c0c6f582fCB022739c4A194Ebb {% if not is_incremental() %} WHERE DATE_TRUNC('day', sw.evt_block_time) >= DATE '{{ project_start_date }}' {% else %} - WHERE DATE_TRUNC('day', sw.evt_block_time) >= DATE_TRUNC('day', NOW() - INTERVAL '1' day) + WHERE {{ incremental_predicate('sw.evt_block_time') }} {% endif %} and sw.contract_address in (select address from pools) group by 1,2,3,4 @@ -276,5 +277,5 @@ left join trading_volume tv on l.time = tv.time and l.pool = tv.pool ) -select CONCAT(CONCAT(CONCAT(CONCAT(CONCAT(blockchain,CONCAT(' ', project)) ,' '), coalesce(paired_token_symbol, 'unknown')),':') , main_token_symbol, ' ', format('%,.3f%%',round(coalesce(fee,0),4))) as pool_name,* +select blockchain||' '||project||' '||coalesce(paired_token_symbol, 'unknown')||':'||main_token_symbol|| ' '||format('%,.3f%%',round(coalesce(fee,0),4)) as pool_name,* from all_metrics diff --git a/models/lido/liquidity/optimism/lido_liquidity_optimism_uniswap_v3_pools.sql b/models/lido/liquidity/optimism/lido_liquidity_optimism_uniswap_v3_pools.sql index 07134eac55d..3acef287d37 100644 --- a/models/lido/liquidity/optimism/lido_liquidity_optimism_uniswap_v3_pools.sql +++ b/models/lido/liquidity/optimism/lido_liquidity_optimism_uniswap_v3_pools.sql @@ -6,10 +6,12 @@ file_format = 'delta', incremental_strategy = 'merge', unique_key = ['pool', 'time'], - post_hook='{{ expose_spells(\'["optimism"]\', - "project", - "lido_liquidity", - \'["ppclunghe", "gregshestakovlido"]\') }}' + incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.time')], + post_hook='{{ expose_spells(blockchains = \'["optimism"]\', + spell_type = "project", + spell_name = "lido_liquidity", + contributors = \'["pipistrella", "zergil1397"]\') }}' + ) }} @@ -63,7 +65,7 @@ with {% if not is_incremental() %} WHERE DATE_TRUNC('day', p.minute) >= DATE '{{ project_start_date }}' {% else %} - WHERE DATE_TRUNC('day', p.minute) >= DATE_TRUNC('day', NOW() - INTERVAL '1' day) + WHERE {{ incremental_predicate('p.minute') }} {% endif %} AND DATE_TRUNC('day', minute) < current_date AND blockchain = 'optimism' @@ -111,7 +113,7 @@ with {% if not is_incremental() %} WHERE DATE_TRUNC('day', p.minute) >= DATE '{{ project_start_date }}' {% else %} - WHERE DATE_TRUNC('day', p.minute) >= DATE_TRUNC('day', NOW() - INTERVAL '1' day) + WHERE {{ incremental_predicate('p.minute') }} {% endif %} AND blockchain = 'optimism' AND contract_address IN (SELECT address FROM tokens) @@ -133,7 +135,7 @@ with {% if not is_incremental() %} WHERE DATE_TRUNC('day', sw.evt_block_time) >= DATE '{{ project_start_date }}' {% else %} - WHERE DATE_TRUNC('day', sw.evt_block_time) >= DATE_TRUNC('day', NOW() - INTERVAL '1' day) + WHERE {{ incremental_predicate('sw.evt_block_time') }} {% endif %} and sw.contract_address IN ( SELECT @@ -162,7 +164,7 @@ with {% if not is_incremental() %} WHERE DATE_TRUNC('day', mt.evt_block_time) >= DATE '{{ project_start_date }}' {% else %} - WHERE DATE_TRUNC('day', mt.evt_block_time) >= DATE_TRUNC('day', NOW() - INTERVAL '1' day) + WHERE {{ incremental_predicate('mt.evt_block_time') }} {% endif %} and mt.contract_address IN ( SELECT @@ -193,7 +195,7 @@ with {% if not is_incremental() %} WHERE DATE_TRUNC('day', bn.evt_block_time) >= DATE '{{ project_start_date }}' {% else %} - WHERE DATE_TRUNC('day', bn.evt_block_time) >= DATE_TRUNC('day', NOW() - INTERVAL '1' day) + WHERE {{ incremental_predicate('bn.evt_block_time') }} {% endif %} and bn.contract_address IN ( SELECT @@ -223,7 +225,7 @@ with {% if not is_incremental() %} WHERE DATE_TRUNC('day', bn.evt_block_time) >= DATE '{{ project_start_date }}' {% else %} - WHERE DATE_TRUNC('day', bn.evt_block_time) >= DATE_TRUNC('day', NOW() - INTERVAL '1' day) + WHERE {{ incremental_predicate('bn.evt_block_time') }} {% endif %} and bn.contract_address IN ( SELECT @@ -320,7 +322,7 @@ with {% if not is_incremental() %} WHERE DATE_TRUNC('day', sw.evt_block_time) >= DATE '{{ project_start_date }}' {% else %} - WHERE DATE_TRUNC('day', sw.evt_block_time) >= DATE_TRUNC('day', NOW() - INTERVAL '1' day) + WHERE {{ incremental_predicate('sw.evt_block_time') }} {% endif %} GROUP BY 1, 2, 3, 4 @@ -389,36 +391,7 @@ with LEFT JOIN trading_volume AS tv ON l.time = tv.time AND l.pool = tv.pool ) SELECT - CONCAT( - CAST( - CONCAT( - CAST( - CONCAT( - CAST( - CONCAT( - CAST( - CONCAT( - CAST(blockchain AS VARCHAR), - CAST( - CONCAT(CAST(' ' AS VARCHAR), CAST(project AS VARCHAR)) AS VARCHAR - ) - ) AS VARCHAR - ), - CAST(' ' AS VARCHAR) - ) AS VARCHAR - ), - CAST( - COALESCE(paired_token_symbol, 'unknown') AS VARCHAR - ) - ) AS VARCHAR - ), - CAST(':' AS VARCHAR) - ) AS VARCHAR - ), - CAST(main_token_symbol AS VARCHAR), - CAST(' ' AS VARCHAR), - format('%,.3f',round(coalesce(fee,0),4)) - ) AS pool_name, + blockchain||' '||project||' '||COALESCE(paired_token_symbol, 'unknown')||':'||main_token_symbol||' '||format('%,.3f',round(coalesce(fee,0),4)) AS pool_name, * FROM all_metrics \ No newline at end of file diff --git a/models/lido/liquidity/optimism/lido_liquidity_optimism_velodrome_cl_pools.sql b/models/lido/liquidity/optimism/lido_liquidity_optimism_velodrome_cl_pools.sql index c1b4c093d87..b2fd41700af 100644 --- a/models/lido/liquidity/optimism/lido_liquidity_optimism_velodrome_cl_pools.sql +++ b/models/lido/liquidity/optimism/lido_liquidity_optimism_velodrome_cl_pools.sql @@ -5,6 +5,7 @@ file_format = 'delta', incremental_strategy = 'merge', unique_key = ['pool', 'time'], + incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.time')], post_hook='{{ expose_spells(blockchains = \'["optimism"]\', spell_type = "project", spell_name = "lido_liquidity", diff --git a/models/lido/liquidity/optimism/lido_liquidity_optimism_velodrome_pools.sql b/models/lido/liquidity/optimism/lido_liquidity_optimism_velodrome_pools.sql index f63756ad200..a2af88bd113 100644 --- a/models/lido/liquidity/optimism/lido_liquidity_optimism_velodrome_pools.sql +++ b/models/lido/liquidity/optimism/lido_liquidity_optimism_velodrome_pools.sql @@ -6,10 +6,12 @@ file_format = 'delta', incremental_strategy = 'merge', unique_key = ['pool', 'time'], - post_hook='{{ expose_spells(\'["optimism"]\', - "project", - "lido_liquidity", - \'["ppclunghe"]\') }}' + incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.time')], + post_hook='{{ expose_spells(blockchains = \'["optimism"]\', + spell_type = "project", + spell_name = "lido_liquidity", + contributors = \'["pipistrella"]\') }}' + ) }} @@ -57,9 +59,8 @@ FROM {{source('prices','usd')}} p {% if not is_incremental() %} WHERE DATE_TRUNC('day', p.minute) >= DATE '{{ project_start_date }}' {% else %} -WHERE DATE_TRUNC('day', p.minute) >= DATE_TRUNC('day', NOW() - INTERVAL '1' day) +WHERE {{ incremental_predicate('p.minute') }} {% endif %} - and date_trunc('day', minute) < current_date and blockchain = 'optimism' and contract_address IN (select token from tokens) @@ -90,9 +91,8 @@ select distinct {% if not is_incremental() %} WHERE DATE_TRUNC('day', p.minute) >= DATE '{{ project_start_date }}' {% else %} - WHERE DATE_TRUNC('day', p.minute) >= DATE_TRUNC('day', NOW() - INTERVAL '1' day) + WHERE {{ incremental_predicate('p.minute') }} {% endif %} - and blockchain = 'optimism' and contract_address = 0x1F32b1c2345538c0c6f582fCB022739c4A194Ebb ) @@ -113,14 +113,12 @@ from wsteth_prices_hourly SUM(CAST(amount0 AS DOUBLE)) AS amount0, SUM(CAST(amount1 AS DOUBLE)) AS amount1 from {{source('velodrome_optimism','Pair_evt_Mint')}} m - left join {{source('velodrome_optimism','PairFactory_evt_PairCreated')}} cr on m.contract_address = cr.pair - + left join {{source('velodrome_optimism','PairFactory_evt_PairCreated')}} cr on m.contract_address = cr.pair {% if not is_incremental() %} WHERE DATE_TRUNC('day', m.evt_block_time) >= DATE '{{ project_start_date }}' {% else %} - WHERE DATE_TRUNC('day', m.evt_block_time) >= DATE_TRUNC('day', NOW() - INTERVAL '1' day) - {% endif %} - + WHERE {{ incremental_predicate('m.evt_block_time') }} + {% endif %} and m.contract_address in (select address from pools) group by 1,2,3,4 ) @@ -138,9 +136,8 @@ from wsteth_prices_hourly {% if not is_incremental() %} WHERE DATE_TRUNC('day', b.evt_block_time) >= DATE '{{ project_start_date }}' {% else %} - WHERE DATE_TRUNC('day', b.evt_block_time) >= DATE_TRUNC('day', NOW() - INTERVAL '1' day) - {% endif %} - + WHERE {{ incremental_predicate('b.evt_block_time') }} + {% endif %} and b.contract_address in (select address from pools) group by 1,2,3,4 @@ -159,9 +156,8 @@ from wsteth_prices_hourly {% if not is_incremental() %} WHERE DATE_TRUNC('day', s.evt_block_time) >= DATE '{{ project_start_date }}' {% else %} - WHERE DATE_TRUNC('day', s.evt_block_time) >= DATE_TRUNC('day', NOW() - INTERVAL '1' day) - {% endif %} - + WHERE {{ incremental_predicate('s.evt_block_time') }} + {% endif %} and s.contract_address in (select address from pools) group by 1,2,3,4 @@ -181,7 +177,7 @@ select {% if not is_incremental() %} WHERE DATE_TRUNC('day', s.evt_block_time) >= DATE '{{ project_start_date }}' {% else %} - WHERE DATE_TRUNC('day', s.evt_block_time) >= DATE_TRUNC('day', NOW() - INTERVAL '1' day) + WHERE {{ incremental_predicate('s.evt_block_time') }} {% endif %} and s.contract_address in (select address from pools) group by 1,2,3,4 @@ -240,7 +236,7 @@ GROUP BY 1,2,3,4 {% if not is_incremental() %} WHERE DATE_TRUNC('day', s.evt_block_time) >= DATE '{{ project_start_date }}' {% else %} - WHERE DATE_TRUNC('day', s.evt_block_time) >= DATE_TRUNC('day', NOW() - INTERVAL '1' day) + WHERE {{ incremental_predicate('s.evt_block_time') }} {% endif %} and s.contract_address in (select address from pools) @@ -299,7 +295,7 @@ group by 1,2 AND l.pool = tv.pool ) -select CONCAT(CONCAT(CONCAT(CONCAT(CONCAT(blockchain,CONCAT(' ', project)) ,' '), coalesce(paired_token_symbol,'unknown')),':') , main_token_symbol, ' ', pool_type) as pool_name, +select blockchain||' '||project||' '||coalesce(paired_token_symbol,'unknown')||':'||main_token_symbol||' '||pool_type as pool_name, pool, blockchain, project, diff --git a/models/lido/liquidity/optimism/lido_liquidity_optimism_velodrome_v2_pools.sql b/models/lido/liquidity/optimism/lido_liquidity_optimism_velodrome_v2_pools.sql index c6d3cffc3c3..455742958ea 100644 --- a/models/lido/liquidity/optimism/lido_liquidity_optimism_velodrome_v2_pools.sql +++ b/models/lido/liquidity/optimism/lido_liquidity_optimism_velodrome_v2_pools.sql @@ -1,15 +1,15 @@ {{ config( schema='lido_liquidity_optimism', - alias = 'velodrome_v2_pools', - + alias = 'velodrome_v2_pools', materialized = 'incremental', file_format = 'delta', incremental_strategy = 'merge', unique_key = ['pool', 'time'], - post_hook='{{ expose_spells(\'["optimism"]\', - "project", - "lido_liquidity", - \'["ppclunghe"]\') }}' + incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.time')], + post_hook='{{ expose_spells(blockchains = \'["optimism"]\', + spell_type = "project", + spell_name = "lido_liquidity", + contributors = \'["pipistrella"]\') }}' ) }} @@ -60,12 +60,11 @@ FROM {{source('prices','usd')}} p {% if not is_incremental() %} WHERE DATE_TRUNC('day', p.minute) >= DATE '{{ project_start_date }}' {% else %} -WHERE DATE_TRUNC('day', p.minute) >= DATE_TRUNC('day', NOW() - INTERVAL '1' day) +WHERE {{ incremental_predicate('p.minute') }} {% endif %} - and date_trunc('day', minute) < current_date and blockchain = 'optimism' - and contract_address IN (select token from tokens) + and contract_address IN (select token from tokens) group by 1,2,3,4 union all select distinct @@ -93,7 +92,7 @@ select distinct {% if not is_incremental() %} WHERE DATE_TRUNC('day', p.minute) >= DATE '{{ project_start_date }}' {% else %} - WHERE DATE_TRUNC('day', p.minute) >= DATE_TRUNC('day', NOW() - INTERVAL '1' day) + WHERE {{ incremental_predicate('p.minute') }} {% endif %} and blockchain = 'optimism' and contract_address = 0x1F32b1c2345538c0c6f582fCB022739c4A194Ebb @@ -120,7 +119,7 @@ from wsteth_prices_hourly {% if not is_incremental() %} WHERE DATE_TRUNC('day', m.evt_block_time) >= DATE '{{ project_start_date }}' {% else %} - WHERE DATE_TRUNC('day', m.evt_block_time) >= DATE_TRUNC('day', NOW() - INTERVAL '1' day) + WHERE {{ incremental_predicate('m.evt_block_time') }} {% endif %} and m.contract_address in (select address from pools) @@ -140,7 +139,7 @@ from wsteth_prices_hourly {% if not is_incremental() %} WHERE DATE_TRUNC('day', b.evt_block_time) >= DATE '{{ project_start_date }}' {% else %} - WHERE DATE_TRUNC('day', b.evt_block_time) >= DATE_TRUNC('day', NOW() - INTERVAL '1' day) + WHERE {{ incremental_predicate('b.evt_block_time') }} {% endif %} and b.contract_address in (select address from pools) @@ -161,7 +160,7 @@ from wsteth_prices_hourly {% if not is_incremental() %} WHERE DATE_TRUNC('day', s.evt_block_time) >= DATE '{{ project_start_date }}' {% else %} - WHERE DATE_TRUNC('day', s.evt_block_time) >= DATE_TRUNC('day', NOW() - INTERVAL '1' day) + WHERE {{ incremental_predicate('s.evt_block_time') }} {% endif %} and s.contract_address in (select address from pools) @@ -182,7 +181,7 @@ select {% if not is_incremental() %} WHERE DATE_TRUNC('day', s.evt_block_time) >= DATE '{{ project_start_date }}' {% else %} - WHERE DATE_TRUNC('day', s.evt_block_time) >= DATE_TRUNC('day', NOW() - INTERVAL '1' day) + WHERE {{ incremental_predicate('s.evt_block_time') }} {% endif %} and s.contract_address in (select address from pools) group by 1,2,3,4 @@ -241,7 +240,7 @@ GROUP BY 1,2,3,4 {% if not is_incremental() %} WHERE DATE_TRUNC('day', s.evt_block_time) >= DATE '{{ project_start_date }}' {% else %} - WHERE DATE_TRUNC('day', s.evt_block_time) >= DATE_TRUNC('day', NOW() - INTERVAL '1' day) + WHERE {{ incremental_predicate('s.evt_block_time') }} {% endif %} and s.contract_address in (select address from pools) @@ -302,7 +301,7 @@ group by 1,2 ) -select CONCAT(CONCAT(CONCAT(CONCAT(CONCAT(blockchain,CONCAT(' ', project)) ,' '), coalesce(paired_token_symbol,'unknown')),':') , main_token_symbol, ' ', pool_type, ' ', format('%,.3f',round(coalesce(fee,0),4))) as pool_name, +select blockchain||' '||project||' '||coalesce(paired_token_symbol,'unknown')||':'||main_token_symbol||' '||pool_type||' '||format('%,.3f',round(coalesce(fee,0),4)) as pool_name, pool, blockchain, project, diff --git a/models/lido/liquidity/polygon/lido_liquidity_polygon_balancer_pools.sql b/models/lido/liquidity/polygon/lido_liquidity_polygon_balancer_pools.sql index 3b15ee2df4d..cc8825ad069 100644 --- a/models/lido/liquidity/polygon/lido_liquidity_polygon_balancer_pools.sql +++ b/models/lido/liquidity/polygon/lido_liquidity_polygon_balancer_pools.sql @@ -6,10 +6,12 @@ file_format = 'delta', incremental_strategy = 'merge', unique_key = ['pool', 'time'], - post_hook='{{ expose_spells(\'["polygon"]\', - "project", - "lido_liquidity", - \'["ppclunghe", "kemasan"]\') }}' + incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.time')], + post_hook='{{ expose_spells(blockchains = \'["polygon"]\', + spell_type = "project", + spell_name = "lido_liquidity", + contributors = \'["pipistrella", "kemasan"]\') }}' + ) }} @@ -76,7 +78,7 @@ WHERE call_create.output_0 in (select distinct poolAddress from pools) {% if not is_incremental() %} WHERE DATE_TRUNC('day', p.minute) >= DATE '{{ project_start_date }}' {% else %} - WHERE DATE_TRUNC('day', p.minute) >= DATE_TRUNC('day', NOW() - INTERVAL '1' day) + WHERE {{ incremental_predicate('p.minute') }} {% endif %} and date_trunc('day', minute) < current_date and blockchain = 'polygon' @@ -104,7 +106,7 @@ SELECT distinct {% if not is_incremental() %} WHERE DATE_TRUNC('day', p.minute) >= DATE '{{ project_start_date }}' {% else %} - WHERE DATE_TRUNC('day', p.minute) >= DATE_TRUNC('day', NOW() - INTERVAL '1' day) + WHERE {{ incremental_predicate('p.minute') }} {% endif %} and date_trunc('day', minute) < current_date and blockchain = 'polygon' @@ -133,7 +135,7 @@ union all {% if not is_incremental() %} WHERE DATE_TRUNC('day', p.minute) >= DATE '{{ project_start_date }}' {% else %} - WHERE DATE_TRUNC('day', p.minute) >= DATE_TRUNC('day', NOW() - INTERVAL '1' day) + WHERE {{ incremental_predicate('p.minute') }} {% endif %} and blockchain = 'polygon' and contract_address = 0x03b54A6e9a984069379fae1a4fC4dBAE93B3bCCD @@ -151,7 +153,7 @@ union all {% if not is_incremental() %} WHERE DATE_TRUNC('day', p.minute) >= DATE '{{ project_start_date }}' {% else %} - WHERE DATE_TRUNC('day', p.minute) >= DATE_TRUNC('day', NOW() - INTERVAL '1' day) + WHERE {{ incremental_predicate('p.minute') }} {% endif %} and blockchain = 'polygon' and contract_address = 0x7ceb23fd6bc0add59e62ac25578270cff1b9f619 @@ -170,7 +172,7 @@ union all {% if not is_incremental() %} WHERE DATE_TRUNC('day', p.minute) >= DATE '{{ project_start_date }}' {% else %} - WHERE DATE_TRUNC('day', p.minute) >= DATE_TRUNC('day', NOW() - INTERVAL '1' day) + WHERE {{ incremental_predicate('p.minute') }} {% endif %} and blockchain = 'polygon' and contract_address = 0x7ceb23fd6bc0add59e62ac25578270cff1b9f619 @@ -194,7 +196,7 @@ union all {% if not is_incremental() %} WHERE DATE_TRUNC('day', evt_block_time) >= DATE '{{ project_start_date }}' {% else %} - WHERE DATE_TRUNC('day', evt_block_time) >= DATE_TRUNC('day', NOW() - INTERVAL '1' day) + WHERE {{ incremental_predicate('evt_block_time') }} {% endif %} and poolId in (select pool_id from pools) UNION @@ -208,7 +210,7 @@ union all {% if not is_incremental() %} WHERE DATE_TRUNC('day', evt_block_time) >= DATE '{{ project_start_date }}' {% else %} - WHERE DATE_TRUNC('day', evt_block_time) >= DATE_TRUNC('day', NOW() - INTERVAL '1' day) + WHERE {{ incremental_predicate('evt_block_time') }} {% endif %} and poolId in (select pool_id from pools) ) swaps @@ -226,7 +228,7 @@ union all {% if not is_incremental() %} WHERE DATE_TRUNC('day', evt_block_time) >= DATE '{{ project_start_date }}' {% else %} - WHERE DATE_TRUNC('day', evt_block_time) >= DATE_TRUNC('day', NOW() - INTERVAL '1' day) + WHERE {{ incremental_predicate('evt_block_time') }} {% endif %} and poolId in (select pool_id from pools) ORDER BY 1, 2, 3 @@ -243,7 +245,7 @@ union all {% if not is_incremental() %} WHERE DATE_TRUNC('day', evt_block_time) >= DATE '{{ project_start_date }}' {% else %} - WHERE DATE_TRUNC('day', evt_block_time) >= DATE_TRUNC('day', NOW() - INTERVAL '1' day) + WHERE {{ incremental_predicate('evt_block_time') }} {% endif %} and poolId in (select pool_id from pools) ) @@ -460,7 +462,7 @@ order by 1 desc {% if not is_incremental() %} WHERE DATE_TRUNC('day', s.evt_block_time) >= DATE '{{ project_start_date }}' {% else %} - WHERE DATE_TRUNC('day', s.evt_block_time) >= DATE_TRUNC('day', NOW() - INTERVAL '1' day) + WHERE {{ incremental_predicate('s.evt_block_time') }} {% endif %} and s.poolId in (select pool_id from pools) group by 1,2 diff --git a/models/lido/liquidity/polygon/lido_liquidity_polygon_kyberswap_v2_pools.sql b/models/lido/liquidity/polygon/lido_liquidity_polygon_kyberswap_v2_pools.sql index ea391c454f4..ad86e49308a 100644 --- a/models/lido/liquidity/polygon/lido_liquidity_polygon_kyberswap_v2_pools.sql +++ b/models/lido/liquidity/polygon/lido_liquidity_polygon_kyberswap_v2_pools.sql @@ -6,10 +6,11 @@ file_format = 'delta', incremental_strategy = 'merge', unique_key = ['pool', 'time'], - post_hook='{{ expose_spells(\'["polygon"]\', - "project", - "lido_liquidity", - \'["ppclunghe"]\') }}' + incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.time')], + post_hook='{{ expose_spells(blockchains = \'["polygon"]\', + spell_type = "project", + spell_name = "lido_liquidity", + contributors = \'["pipistrella"]\') }}' ) }} @@ -50,7 +51,7 @@ select 0x03b54A6e9a984069379fae1a4fC4dBAE93B3bCCD {% if not is_incremental() %} WHERE DATE_TRUNC('day', p.minute) >= DATE '{{ project_start_date }}' {% else %} - WHERE DATE_TRUNC('day', p.minute) >= DATE_TRUNC('day', NOW() - INTERVAL '1' day) + WHERE {{ incremental_predicate('p.minute') }} {% endif %} and date_trunc('day', minute) < current_date and blockchain = 'polygon' @@ -80,7 +81,7 @@ select 0x03b54A6e9a984069379fae1a4fC4dBAE93B3bCCD {% if not is_incremental() %} WHERE DATE_TRUNC('day', p.minute) >= DATE '{{ project_start_date }}' {% else %} - WHERE DATE_TRUNC('day', p.minute) >= DATE_TRUNC('day', NOW() - INTERVAL '1' day) + WHERE {{ incremental_predicate('p.minute') }} {% endif %} and date_trunc('day', minute) < current_date and blockchain = 'polygon' @@ -114,7 +115,7 @@ select 0x03b54A6e9a984069379fae1a4fC4dBAE93B3bCCD {% if not is_incremental() %} WHERE DATE_TRUNC('day', p.minute) >= DATE '{{ project_start_date }}' {% else %} - WHERE DATE_TRUNC('day', p.minute) >= DATE_TRUNC('day', NOW() - INTERVAL '1' day) + WHERE {{ incremental_predicate('p.minute') }} {% endif %} and blockchain = 'polygon' @@ -134,7 +135,7 @@ select 0x03b54A6e9a984069379fae1a4fC4dBAE93B3bCCD {% if not is_incremental() %} WHERE DATE_TRUNC('day', sw.evt_block_time) >= DATE '{{ project_start_date }}' {% else %} - WHERE DATE_TRUNC('day', sw.evt_block_time) >= DATE_TRUNC('day', NOW() - INTERVAL '1' day) + WHERE {{ incremental_predicate('sw.evt_block_time') }} {% endif %} and sw.contract_address in (select address from pools) group by 1,2,3,4 @@ -152,7 +153,7 @@ select 0x03b54A6e9a984069379fae1a4fC4dBAE93B3bCCD {% if not is_incremental() %} WHERE DATE_TRUNC('day', mt.evt_block_time) >= DATE '{{ project_start_date }}' {% else %} - WHERE DATE_TRUNC('day', mt.evt_block_time) >= DATE_TRUNC('day', NOW() - INTERVAL '1' day) + WHERE {{ incremental_predicate('mt.evt_block_time') }} {% endif %} and mt.contract_address in (select address from pools) group by 1,2,3,4 @@ -171,7 +172,7 @@ select 0x03b54A6e9a984069379fae1a4fC4dBAE93B3bCCD {% if not is_incremental() %} WHERE DATE_TRUNC('day', bn.evt_block_time) >= DATE '{{ project_start_date }}' {% else %} - WHERE DATE_TRUNC('day', bn.evt_block_time) >= DATE_TRUNC('day', NOW() - INTERVAL '1' day) + WHERE {{ incremental_predicate('bn.evt_block_time') }} {% endif %} and bn.contract_address in (select address from pools) group by 1,2,3,4 @@ -189,7 +190,7 @@ select 0x03b54A6e9a984069379fae1a4fC4dBAE93B3bCCD {% if not is_incremental() %} WHERE DATE_TRUNC('day', bn.evt_block_time) >= DATE '{{ project_start_date }}' {% else %} - WHERE DATE_TRUNC('day', bn.evt_block_time) >= DATE_TRUNC('day', NOW() - INTERVAL '1' day) + WHERE {{ incremental_predicate('bn.evt_block_time') }} {% endif %} and bn.contract_address in (select address from pools) group by 1,2,3,4 @@ -235,7 +236,7 @@ select 0x03b54A6e9a984069379fae1a4fC4dBAE93B3bCCD {% if not is_incremental() %} WHERE DATE_TRUNC('day', sw.evt_block_time) >= DATE '{{ project_start_date }}' {% else %} - WHERE DATE_TRUNC('day', sw.evt_block_time) >= DATE_TRUNC('day', NOW() - INTERVAL '1' day) + WHERE {{ incremental_predicate('sw.evt_block_time') }} {% endif %} and sw.contract_address in (select address from pools) group by 1,2,3,4 @@ -276,5 +277,5 @@ left join trading_volume tv on l.time = tv.time and l.pool = tv.pool ) -select CONCAT(CONCAT(CONCAT(CONCAT(CONCAT(blockchain,CONCAT(' ', project)) ,' '), coalesce(paired_token_symbol, 'unknown')),':') , main_token_symbol, ' ', format('%,.3f%%',round(coalesce(fee,0),4))) as pool_name,* +select blockchain||' '||project||' '||coalesce(paired_token_symbol, 'unknown')||':'||main_token_symbol||' '||format('%,.3f%%',round(coalesce(fee,0),4)) as pool_name,* from all_metrics diff --git a/models/lido/liquidity/polygon/lido_liquidity_polygon_uniswap_v3_pools.sql b/models/lido/liquidity/polygon/lido_liquidity_polygon_uniswap_v3_pools.sql index 1385dd549ca..ef3bc54aebb 100644 --- a/models/lido/liquidity/polygon/lido_liquidity_polygon_uniswap_v3_pools.sql +++ b/models/lido/liquidity/polygon/lido_liquidity_polygon_uniswap_v3_pools.sql @@ -1,15 +1,15 @@ {{ config( schema='lido_liquidity_polygon', - alias = 'uniswap_v3_pools', - + alias = 'uniswap_v3_pools', materialized = 'incremental', file_format = 'delta', incremental_strategy = 'merge', unique_key = ['pool', 'time'], - post_hook='{{ expose_spells(\'["polygon"]\', - "project", - "lido_liquidity", - \'["ppclunghe"]\') }}' + incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.time')], + post_hook='{{ expose_spells(blockchains = \'["polygon"]\', + spell_type = "project", + spell_name = "lido_liquidity", + contributors = \'["pipistrella"]\') }}' ) }} @@ -63,7 +63,7 @@ with {% if not is_incremental() %} WHERE DATE_TRUNC('day', p.minute) >= DATE '{{ project_start_date }}' {% else %} - WHERE DATE_TRUNC('day', p.minute) >= DATE_TRUNC('day', NOW() - INTERVAL '1' day) + WHERE {{ incremental_predicate('p.minute') }} {% endif %} AND DATE_TRUNC('day', minute) < current_date AND blockchain = 'polygon' @@ -111,7 +111,7 @@ with {% if not is_incremental() %} WHERE DATE_TRUNC('day', p.minute) >= DATE '{{ project_start_date }}' {% else %} - WHERE DATE_TRUNC('day', p.minute) >= DATE_TRUNC('day', NOW() - INTERVAL '1' day) + WHERE {{ incremental_predicate('p.minute') }} {% endif %} AND blockchain = 'polygon' AND contract_address IN (SELECT address FROM tokens) @@ -133,7 +133,7 @@ with {% if not is_incremental() %} WHERE DATE_TRUNC('day', sw.evt_block_time) >= DATE '{{ project_start_date }}' {% else %} - WHERE DATE_TRUNC('day', sw.evt_block_time) >= DATE_TRUNC('day', NOW() - INTERVAL '1' day) + WHERE {{ incremental_predicate('sw.evt_block_time') }} {% endif %} and sw.contract_address IN ( SELECT @@ -162,7 +162,7 @@ with {% if not is_incremental() %} WHERE DATE_TRUNC('day', mt.evt_block_time) >= DATE '{{ project_start_date }}' {% else %} - WHERE DATE_TRUNC('day', mt.evt_block_time) >= DATE_TRUNC('day', NOW() - INTERVAL '1' day) + WHERE {{ incremental_predicate('mt.evt_block_time') }} {% endif %} and mt.contract_address IN ( SELECT @@ -193,7 +193,7 @@ with {% if not is_incremental() %} WHERE DATE_TRUNC('day', bn.evt_block_time) >= DATE '{{ project_start_date }}' {% else %} - WHERE DATE_TRUNC('day', bn.evt_block_time) >= DATE_TRUNC('day', NOW() - INTERVAL '1' day) + WHERE {{ incremental_predicate('bn.evt_block_time') }} {% endif %} and bn.contract_address IN ( SELECT @@ -223,7 +223,7 @@ with {% if not is_incremental() %} WHERE DATE_TRUNC('day', bn.evt_block_time) >= DATE '{{ project_start_date }}' {% else %} - WHERE DATE_TRUNC('day', bn.evt_block_time) >= DATE_TRUNC('day', NOW() - INTERVAL '1' day) + WHERE {{ incremental_predicate('bn.evt_block_time') }} {% endif %} and bn.contract_address IN ( SELECT @@ -320,7 +320,7 @@ with {% if not is_incremental() %} WHERE DATE_TRUNC('day', sw.evt_block_time) >= DATE '{{ project_start_date }}' {% else %} - WHERE DATE_TRUNC('day', sw.evt_block_time) >= DATE_TRUNC('day', NOW() - INTERVAL '1' day) + WHERE {{ incremental_predicate('sw.evt_block_time') }} {% endif %} GROUP BY 1, 2, 3, 4 @@ -389,36 +389,7 @@ with LEFT JOIN trading_volume AS tv ON l.time = tv.time AND l.pool = tv.pool ) SELECT - CONCAT( - CAST( - CONCAT( - CAST( - CONCAT( - CAST( - CONCAT( - CAST( - CONCAT( - CAST(blockchain AS VARCHAR), - CAST( - CONCAT(CAST(' ' AS VARCHAR), CAST(project AS VARCHAR)) AS VARCHAR - ) - ) AS VARCHAR - ), - CAST(' ' AS VARCHAR) - ) AS VARCHAR - ), - CAST( - COALESCE(paired_token_symbol, 'unknown') AS VARCHAR - ) - ) AS VARCHAR - ), - CAST(':' AS VARCHAR) - ) AS VARCHAR - ), - CAST(main_token_symbol AS VARCHAR), - CAST(' ' AS VARCHAR), - format('%,.3f',round(coalesce(fee,0),4)) - ) AS pool_name, +blockchain ||' '||project||' '||COALESCE(paired_token_symbol, 'unknown')||':'||main_token_symbol||' '||format('%,.3f',round(coalesce(fee,0),4)) AS pool_name, * FROM all_metrics \ No newline at end of file diff --git a/models/lido/liquidity/scroll/lido_liquidity_scroll_syncswap_pools.sql b/models/lido/liquidity/scroll/lido_liquidity_scroll_syncswap_pools.sql index 33a6f7d992e..2d51fb76801 100644 --- a/models/lido/liquidity/scroll/lido_liquidity_scroll_syncswap_pools.sql +++ b/models/lido/liquidity/scroll/lido_liquidity_scroll_syncswap_pools.sql @@ -5,6 +5,7 @@ file_format = 'delta', incremental_strategy = 'merge', unique_key = ['pool', 'time'], + incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.time')], post_hook='{{ expose_spells(blockchains = \'["scroll"]\', spell_type = "project", spell_name = "lido_liquidity", diff --git a/models/lido/liquidity/scroll/lido_liquidity_scroll_zebra_pools.sql b/models/lido/liquidity/scroll/lido_liquidity_scroll_zebra_pools.sql index d97d696e628..71f4e52d11d 100644 --- a/models/lido/liquidity/scroll/lido_liquidity_scroll_zebra_pools.sql +++ b/models/lido/liquidity/scroll/lido_liquidity_scroll_zebra_pools.sql @@ -5,6 +5,7 @@ file_format = 'delta', incremental_strategy = 'merge', unique_key = ['pool', 'time'], + incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.time')], post_hook='{{ expose_spells(blockchains = \'["scroll"]\', spell_type = "project", spell_name = "lido_liquidity", diff --git a/models/lido/liquidity/zksync/lido_liquidity_zksync_maverick_pools.sql b/models/lido/liquidity/zksync/lido_liquidity_zksync_maverick_pools.sql index edd71fefe8c..8561750c36e 100644 --- a/models/lido/liquidity/zksync/lido_liquidity_zksync_maverick_pools.sql +++ b/models/lido/liquidity/zksync/lido_liquidity_zksync_maverick_pools.sql @@ -4,10 +4,12 @@ file_format = 'delta', incremental_strategy = 'merge', unique_key = ['pool', 'time'], + incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.time')], post_hook='{{ expose_spells(blockchains = \'["zksync"]\', spell_type = "project", spell_name = "lido_liquidity", contributors = \'["pipistrella"]\') }}' + ) }} diff --git a/models/lido/liquidity/zksync/lido_liquidity_zksync_syncswap_pools.sql b/models/lido/liquidity/zksync/lido_liquidity_zksync_syncswap_pools.sql index 6803b8e8f7f..241eae10442 100644 --- a/models/lido/liquidity/zksync/lido_liquidity_zksync_syncswap_pools.sql +++ b/models/lido/liquidity/zksync/lido_liquidity_zksync_syncswap_pools.sql @@ -5,10 +5,11 @@ file_format = 'delta', incremental_strategy = 'merge', unique_key = ['pool', 'time'], - post_hook='{{ expose_spells(\'["zksync"]\', - "project", - "lido_liquidity", - \'["pipistrella"]\') }}' + incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.time')], + post_hook='{{ expose_spells(blockchains = \'["zksync"]\', + spell_type = "project", + spell_name = "lido_liquidity", + contributors = \'["pipistrella"]\') }}' ) }} diff --git a/models/lido/liquidity/zksync/lido_liquidity_zksync_syncswap_v2_pools.sql b/models/lido/liquidity/zksync/lido_liquidity_zksync_syncswap_v2_pools.sql index 06403042175..59431236fd8 100644 --- a/models/lido/liquidity/zksync/lido_liquidity_zksync_syncswap_v2_pools.sql +++ b/models/lido/liquidity/zksync/lido_liquidity_zksync_syncswap_v2_pools.sql @@ -5,6 +5,7 @@ file_format = 'delta', incremental_strategy = 'merge', unique_key = ['pool', 'time'], + incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.time')], post_hook='{{ expose_spells(blockchains = \'["zksync"]\', spell_type = "project", spell_name = "lido_liquidity", @@ -268,7 +269,7 @@ group by 1,2 ) -select CONCAT(CONCAT(CONCAT(CONCAT(CONCAT(blockchain,CONCAT(' ', project)) ,' '), coalesce(paired_token_symbol,'unknown')),':') , main_token_symbol, ' ', pool_type, ' ', format('%,.3f',round(coalesce(fee,0),4))) as pool_name, +select blockchain||' '||project||' '||coalesce(paired_token_symbol,'unknown')||':'||main_token_symbol||' '||pool_type||' '||format('%,.3f',round(coalesce(fee,0),4)) as pool_name, pool, blockchain, project, From 3f4a3a43fcd71cd1223a275f89c9b983bdfc3dd8 Mon Sep 17 00:00:00 2001 From: hildobby Date: Tue, 18 Jun 2024 15:38:39 +0200 Subject: [PATCH 144/149] Add Linea, Blast, Mantle & zkEVM to evms tables (#6159) * remake bridge.flows * fix * fix * fix * fix * fix * fix * fixes * fix * fix * fix * fix * fi * fix * fix * fix * fix * fi * Add Linea, Blast, Mantle & zkEVM to evms tables * fix * fix * fix --- models/evms/evms_blocks.sql | 6 +++- models/evms/evms_contracts.sql | 6 +++- models/evms/evms_creation_traces.sql | 6 +++- models/evms/evms_erc1155_approvalsforall.sql | 6 +++- models/evms/evms_erc1155_transfersbatch.sql | 6 +++- models/evms/evms_erc1155_transferssingle.sql | 6 +++- models/evms/evms_erc20_approvals.sql | 6 +++- models/evms/evms_erc20_transfers.sql | 6 +++- models/evms/evms_erc721_approvals.sql | 6 +++- models/evms/evms_erc721_approvalsforall.sql | 6 +++- models/evms/evms_erc721_transfers.sql | 6 +++- models/evms/evms_logs.sql | 6 +++- models/evms/evms_logs_decoded.sql | 6 +++- models/evms/evms_schema.yml | 34 ++++++++++---------- models/evms/evms_traces.sql | 6 +++- models/evms/evms_traces_decoded.sql | 6 +++- models/evms/evms_transactions.sql | 6 +++- 17 files changed, 97 insertions(+), 33 deletions(-) diff --git a/models/evms/evms_blocks.sql b/models/evms/evms_blocks.sql index def6f5e88c0..ec629459e74 100644 --- a/models/evms/evms_blocks.sql +++ b/models/evms/evms_blocks.sql @@ -2,7 +2,7 @@ schema='evms', alias = 'blocks', unique_key=['blockchain', 'number'], - post_hook='{{ expose_spells(\'["ethereum", "polygon", "bnb", "avalanche_c", "gnosis", "fantom", "optimism", "arbitrum", "celo", "base", "goerli", "zksync", "zora", "scroll"]\', + post_hook='{{ expose_spells(\'["ethereum", "polygon", "bnb", "avalanche_c", "gnosis", "fantom", "optimism", "arbitrum", "celo", "base", "goerli", "zksync", "zora", "scroll", "linea", "zkevm", "blast", "mantle"]\', "sector", "evms", \'["hildobby"]\') }}' @@ -24,6 +24,10 @@ , ('zksync', source('zksync', 'blocks')) , ('zora', source('zora', 'blocks')) , ('scroll', source('scroll', 'blocks')) + , ('linea', source('linea', 'blocks')) + , ('zkevm', source('zkevm', 'blocks')) + , ('blast', source('blast', 'blocks')) + , ('mantle', source('mantle', 'blocks')) ] %} SELECT * diff --git a/models/evms/evms_contracts.sql b/models/evms/evms_contracts.sql index 7780ff075ce..23edf7ee816 100644 --- a/models/evms/evms_contracts.sql +++ b/models/evms/evms_contracts.sql @@ -2,7 +2,7 @@ schema='evms', alias = 'contracts', unique_key=['blockchain', 'address', 'created_at'], - post_hook='{{ expose_spells(\'["ethereum", "polygon", "bnb", "avalanche_c", "gnosis", "fantom", "optimism", "arbitrum", "celo", "base", "goerli", "zksync", "zora", "scroll"]\', + post_hook='{{ expose_spells(\'["ethereum", "polygon", "bnb", "avalanche_c", "gnosis", "fantom", "optimism", "arbitrum", "celo", "base", "goerli", "zksync", "zora", "scroll", "linea", "zkevm", "blast", "mantle"]\', "sector", "evms", \'["hildobby"]\') }}' @@ -24,6 +24,10 @@ , ('zksync', source('zksync', 'contracts')) , ('zora', source('zora', 'contracts')) , ('scroll', source('scroll', 'contracts')) + , ('linea', source('linea', 'contracts')) + , ('zkevm', source('zkevm', 'contracts')) + , ('blast', source('blast', 'contracts')) + , ('mantle', source('mantle', 'contracts')) ] %} SELECT * diff --git a/models/evms/evms_creation_traces.sql b/models/evms/evms_creation_traces.sql index 73423299cd4..0da729fca27 100644 --- a/models/evms/evms_creation_traces.sql +++ b/models/evms/evms_creation_traces.sql @@ -2,7 +2,7 @@ schema='evms', alias = 'creation_traces', unique_key=['blockchain', 'tx_hash', 'evt_index'], - post_hook='{{ expose_spells(\'["ethereum", "polygon", "bnb", "avalanche_c", "gnosis", "fantom", "optimism", "arbitrum", "celo", "base", "goerli", "zksync", "zora", "scroll"]\', + post_hook='{{ expose_spells(\'["ethereum", "polygon", "bnb", "avalanche_c", "gnosis", "fantom", "optimism", "arbitrum", "celo", "base", "goerli", "zksync", "zora", "scroll", "linea", "zkevm", "blast", "mantle"]\', "sector", "evms", \'["hildobby"]\') }}' @@ -24,6 +24,10 @@ , ('zksync', source('zksync', 'creation_traces')) , ('zora', source('zora', 'creation_traces')) , ('scroll', source('scroll', 'creation_traces')) + , ('linea', source('linea', 'creation_traces')) + , ('zkevm', source('zkevm', 'creation_traces')) + , ('blast', source('blast', 'creation_traces')) + , ('mantle', source('mantle', 'creation_traces')) ] %} SELECT * diff --git a/models/evms/evms_erc1155_approvalsforall.sql b/models/evms/evms_erc1155_approvalsforall.sql index 666cd015993..9302d24a914 100644 --- a/models/evms/evms_erc1155_approvalsforall.sql +++ b/models/evms/evms_erc1155_approvalsforall.sql @@ -2,7 +2,7 @@ schema='evms', alias = 'erc1155_approvalsforall', unique_key=['blockchain', 'tx_hash', 'evt_index'], - post_hook='{{ expose_spells(\'["ethereum", "polygon", "bnb", "avalanche_c", "gnosis", "fantom", "optimism", "arbitrum", "celo", "base", "goerli", "zksync", "zora", "scroll"]\', + post_hook='{{ expose_spells(\'["ethereum", "polygon", "bnb", "avalanche_c", "gnosis", "fantom", "optimism", "arbitrum", "celo", "base", "goerli", "zksync", "zora", "scroll", "linea", "zkevm", "blast", "mantle"]\', "sector", "evms", \'["hildobby"]\') }}' @@ -24,6 +24,10 @@ , ('zksync', source('erc1155_zksync', 'evt_ApprovalForAll')) , ('zora', source('erc1155_zora', 'evt_ApprovalForAll')) , ('scroll', source('erc1155_scroll', 'evt_ApprovalForAll')) + , ('linea', source('erc1155_linea', 'evt_ApprovalForAll')) + , ('zkevm', source('erc1155_zkevm', 'evt_ApprovalForAll')) + , ('blast', source('erc1155_blast', 'evt_ApprovalForAll')) + , ('mantle', source('erc1155_mantle', 'evt_ApprovalForAll')) ] %} SELECT * diff --git a/models/evms/evms_erc1155_transfersbatch.sql b/models/evms/evms_erc1155_transfersbatch.sql index 907e3e463b5..c0c5c03484c 100644 --- a/models/evms/evms_erc1155_transfersbatch.sql +++ b/models/evms/evms_erc1155_transfersbatch.sql @@ -2,7 +2,7 @@ schema='evms', alias = 'erc1155_transfersbatch', unique_key=['blockchain', 'tx_hash', 'evt_index'], - post_hook='{{ expose_spells(\'["ethereum", "polygon", "bnb", "avalanche_c", "gnosis", "fantom", "optimism", "arbitrum", "celo", "base", "goerli", "zksync", "zora", "scroll"]\', + post_hook='{{ expose_spells(\'["ethereum", "polygon", "bnb", "avalanche_c", "gnosis", "fantom", "optimism", "arbitrum", "celo", "base", "goerli", "zksync", "zora", "scroll", "linea", "zkevm", "blast", "mantle"]\', "sector", "evms", \'["hildobby"]\') }}' @@ -24,6 +24,10 @@ , ('zksync', source('erc1155_zksync', 'evt_transferbatch')) , ('zora', source('erc1155_zora', 'evt_transferbatch')) , ('scroll', source('erc1155_scroll', 'evt_transferbatch')) + , ('linea', source('erc1155_linea', 'evt_transferbatch')) + , ('zkevm', source('erc1155_zkevm', 'evt_transferbatch')) + , ('blast', source('erc1155_blast', 'evt_transferbatch')) + , ('mantle', source('erc1155_mantle', 'evt_transferbatch')) ] %} SELECT * diff --git a/models/evms/evms_erc1155_transferssingle.sql b/models/evms/evms_erc1155_transferssingle.sql index c17a01a4fe8..594fbe02ecf 100644 --- a/models/evms/evms_erc1155_transferssingle.sql +++ b/models/evms/evms_erc1155_transferssingle.sql @@ -2,7 +2,7 @@ schema='evms', alias = 'erc1155_transferssingle', unique_key=['blockchain', 'tx_hash', 'evt_index'], - post_hook='{{ expose_spells(\'["ethereum", "polygon", "bnb", "avalanche_c", "gnosis", "fantom", "optimism", "arbitrum", "celo", "base", "goerli", "zksync", "zora", "scroll"]\', + post_hook='{{ expose_spells(\'["ethereum", "polygon", "bnb", "avalanche_c", "gnosis", "fantom", "optimism", "arbitrum", "celo", "base", "goerli", "zksync", "zora", "scroll", "linea", "zkevm", "blast", "mantle"]\', "sector", "evms", \'["hildobby"]\') }}' @@ -24,6 +24,10 @@ , ('zksync', source('erc1155_zksync', 'evt_transfersingle')) , ('zora', source('erc1155_zora', 'evt_transfersingle')) , ('scroll', source('erc1155_scroll', 'evt_transfersingle')) + , ('linea', source('erc1155_linea', 'evt_transfersingle')) + , ('zkevm', source('erc1155_zkevm', 'evt_transfersingle')) + , ('blast', source('erc1155_blast', 'evt_transfersingle')) + , ('mantle', source('erc1155_mantle', 'evt_transfersingle')) ] %} SELECT * diff --git a/models/evms/evms_erc20_approvals.sql b/models/evms/evms_erc20_approvals.sql index 38827e4848f..447987c332d 100644 --- a/models/evms/evms_erc20_approvals.sql +++ b/models/evms/evms_erc20_approvals.sql @@ -2,7 +2,7 @@ schema='evms', alias = 'erc20_approvals', unique_key=['blockchain', 'tx_hash', 'evt_index'], - post_hook='{{ expose_spells(\'["ethereum", "polygon", "bnb", "avalanche_c", "gnosis", "fantom", "optimism", "arbitrum", "celo", "base", "goerli", "zksync", "zora", "scroll"]\', + post_hook='{{ expose_spells(\'["ethereum", "polygon", "bnb", "avalanche_c", "gnosis", "fantom", "optimism", "arbitrum", "celo", "base", "goerli", "zksync", "zora", "scroll", "linea", "zkevm", "blast", "mantle"]\', "sector", "evms", \'["hildobby"]\') }}' @@ -24,6 +24,10 @@ , ('zksync', source('erc20_zksync', 'evt_approval')) , ('zora', source('erc20_zora', 'evt_approval')) , ('scroll', source('erc20_scroll', 'evt_approval')) + , ('linea', source('erc20_linea', 'evt_approval')) + , ('zkevm', source('erc20_zkevm', 'evt_approval')) + , ('blast', source('erc20_blast', 'evt_approval')) + , ('mantle', source('erc20_mantle', 'evt_approval')) ] %} SELECT * diff --git a/models/evms/evms_erc20_transfers.sql b/models/evms/evms_erc20_transfers.sql index 59db0a8eaf0..eb1e01a8ea7 100644 --- a/models/evms/evms_erc20_transfers.sql +++ b/models/evms/evms_erc20_transfers.sql @@ -2,7 +2,7 @@ schema='evms', alias = 'erc20_transfers', unique_key=['blockchain', 'tx_hash', 'evt_index'], - post_hook='{{ expose_spells(\'["ethereum", "polygon", "bnb", "avalanche_c", "gnosis", "fantom", "optimism", "arbitrum", "celo", "base", "goerli", "zksync", "zora", "scroll"]\', + post_hook='{{ expose_spells(\'["ethereum", "polygon", "bnb", "avalanche_c", "gnosis", "fantom", "optimism", "arbitrum", "celo", "base", "goerli", "zksync", "zora", "scroll", "linea", "zkevm", "blast", "mantle"]\', "sector", "evms", \'["hildobby"]\') }}' @@ -24,6 +24,10 @@ , ('zksync', source('erc20_zksync', 'evt_transfer')) , ('zora', source('erc20_zora', 'evt_transfer')) , ('scroll', source('erc20_scroll', 'evt_transfer')) + , ('linea', source('erc20_linea', 'evt_transfer')) + , ('zkevm', source('erc20_zkevm', 'evt_transfer')) + , ('blast', source('erc20_blast', 'evt_transfer')) + , ('mantle', source('erc20_mantle', 'evt_transfer')) ] %} SELECT * diff --git a/models/evms/evms_erc721_approvals.sql b/models/evms/evms_erc721_approvals.sql index 9e8b1465e08..838c41a9357 100644 --- a/models/evms/evms_erc721_approvals.sql +++ b/models/evms/evms_erc721_approvals.sql @@ -2,7 +2,7 @@ schema='evms', alias = 'erc721_approvals', unique_key=['blockchain', 'tx_hash', 'evt_index'], - post_hook='{{ expose_spells(\'["ethereum", "polygon", "bnb", "avalanche_c", "gnosis", "fantom", "optimism", "arbitrum", "celo", "base", "goerli", "zksync", "zora", "scroll"]\', + post_hook='{{ expose_spells(\'["ethereum", "polygon", "bnb", "avalanche_c", "gnosis", "fantom", "optimism", "arbitrum", "celo", "base", "goerli", "zksync", "zora", "scroll", "linea", "zkevm", "blast", "mantle"]\', "sector", "evms", \'["hildobby"]\') }}' @@ -24,6 +24,10 @@ , ('zksync', source('erc721_zksync', 'evt_Approval')) , ('zora', source('erc721_zora', 'evt_Approval')) , ('scroll', source('erc721_scroll', 'evt_Approval')) + , ('linea', source('erc721_linea', 'evt_Approval')) + , ('zkevm', source('erc721_zkevm', 'evt_Approval')) + , ('blast', source('erc721_blast', 'evt_Approval')) + , ('mantle', source('erc721_mantle', 'evt_Approval')) ] %} SELECT * diff --git a/models/evms/evms_erc721_approvalsforall.sql b/models/evms/evms_erc721_approvalsforall.sql index 31b238d21a5..08e9578ebef 100644 --- a/models/evms/evms_erc721_approvalsforall.sql +++ b/models/evms/evms_erc721_approvalsforall.sql @@ -2,7 +2,7 @@ schema='evms', alias = 'erc721_approvalsforall', unique_key=['blockchain', 'tx_hash', 'evt_index'], - post_hook='{{ expose_spells(\'["ethereum", "polygon", "bnb", "avalanche_c", "gnosis", "fantom", "optimism", "arbitrum", "celo", "base", "goerli", "zksync", "zora", "scroll"]\', + post_hook='{{ expose_spells(\'["ethereum", "polygon", "bnb", "avalanche_c", "gnosis", "fantom", "optimism", "arbitrum", "celo", "base", "goerli", "zksync", "zora", "scroll", "linea", "zkevm", "blast", "mantle"]\', "sector", "evms", \'["hildobby"]\') }}' @@ -24,6 +24,10 @@ , ('zksync', source('erc721_zksync', 'evt_ApprovalForAll')) , ('zora', source('erc721_zora', 'evt_ApprovalForAll')) , ('scroll', source('erc721_scroll', 'evt_ApprovalForAll')) + , ('linea', source('erc721_linea', 'evt_ApprovalForAll')) + , ('zkevm', source('erc721_zkevm', 'evt_ApprovalForAll')) + , ('blast', source('erc721_blast', 'evt_ApprovalForAll')) + , ('mantle', source('erc721_mantle', 'evt_ApprovalForAll')) ] %} SELECT * diff --git a/models/evms/evms_erc721_transfers.sql b/models/evms/evms_erc721_transfers.sql index 4e0b9fedcb1..961e412ff36 100644 --- a/models/evms/evms_erc721_transfers.sql +++ b/models/evms/evms_erc721_transfers.sql @@ -2,7 +2,7 @@ schema='evms', alias = 'erc721_transfers', unique_key=['blockchain', 'tx_hash', 'evt_index'], - post_hook='{{ expose_spells(\'["ethereum", "polygon", "bnb", "avalanche_c", "gnosis", "fantom", "optimism", "arbitrum", "celo", "base", "goerli", "zksync", "zora", "scroll"]\', + post_hook='{{ expose_spells(\'["ethereum", "polygon", "bnb", "avalanche_c", "gnosis", "fantom", "optimism", "arbitrum", "celo", "base", "goerli", "zksync", "zora", "scroll", "linea", "zkevm", "blast", "mantle"]\', "sector", "evms", \'["hildobby"]\') }}' @@ -24,6 +24,10 @@ , ('zksync', source('erc721_zksync', 'evt_transfer')) , ('zora', source('erc721_zora', 'evt_transfer')) , ('scroll', source('erc721_scroll', 'evt_transfer')) + , ('linea', source('erc721_linea', 'evt_transfer')) + , ('zkevm', source('erc721_zkevm', 'evt_transfer')) + , ('blast', source('erc721_blast', 'evt_transfer')) + , ('mantle', source('erc721_mantle', 'evt_transfer')) ] %} SELECT * diff --git a/models/evms/evms_logs.sql b/models/evms/evms_logs.sql index 0632fd86fa2..9743ae87c10 100644 --- a/models/evms/evms_logs.sql +++ b/models/evms/evms_logs.sql @@ -2,7 +2,7 @@ schema='evms', alias = 'logs', unique_key=['blockchain', 'tx_hash'], - post_hook='{{ expose_spells(\'["ethereum", "polygon", "bnb", "avalanche_c", "gnosis", "fantom", "optimism", "arbitrum", "celo", "base", "goerli", "zksync", "zora", "scroll"]\', + post_hook='{{ expose_spells(\'["ethereum", "polygon", "bnb", "avalanche_c", "gnosis", "fantom", "optimism", "arbitrum", "celo", "base", "goerli", "zksync", "zora", "scroll", "linea", "zkevm", "blast", "mantle"]\', "sector", "evms", \'["hildobby"]\') }}' @@ -24,6 +24,10 @@ , ('zksync', source('zksync', 'logs')) , ('zora', source('zora', 'logs')) , ('scroll', source('scroll', 'logs')) + , ('linea', source('linea', 'logs')) + , ('zkevm', source('zkevm', 'logs')) + , ('blast', source('blast', 'logs')) + , ('mantle', source('mantle', 'logs')) ] %} SELECT * diff --git a/models/evms/evms_logs_decoded.sql b/models/evms/evms_logs_decoded.sql index 2ece7f0b366..6e8f9c50135 100644 --- a/models/evms/evms_logs_decoded.sql +++ b/models/evms/evms_logs_decoded.sql @@ -2,7 +2,7 @@ schema='evms', alias = 'logs_decoded', unique_key=['blockchain', 'tx_hash'], - post_hook='{{ expose_spells(\'["ethereum", "polygon", "bnb", "avalanche_c", "gnosis", "fantom", "optimism", "arbitrum", "celo", "base", "goerli", "zksync", "zora", "scroll"]\', + post_hook='{{ expose_spells(\'["ethereum", "polygon", "bnb", "avalanche_c", "gnosis", "fantom", "optimism", "arbitrum", "celo", "base", "goerli", "zksync", "zora", "scroll", "linea", "zkevm", "blast", "mantle"]\', "sector", "evms", \'["hildobby"]\') }}' @@ -24,6 +24,10 @@ , ('zksync', source('zksync', 'logs_decoded')) , ('zora', source('zora', 'logs_decoded')) , ('scroll', source('scroll', 'logs_decoded')) + , ('linea', source('linea', 'logs_decoded')) + , ('zkevm', source('zkevm', 'logs_decoded')) + , ('blast', source('blast', 'logs_decoded')) + , ('mantle', source('mantle', 'logs_decoded')) ] %} SELECT * diff --git a/models/evms/evms_schema.yml b/models/evms/evms_schema.yml index ae0ccdbb81c..132393f4430 100644 --- a/models/evms/evms_schema.yml +++ b/models/evms/evms_schema.yml @@ -3,7 +3,7 @@ version: 2 models: - name: evms_transactions meta: - blockchain: ethereum, polygon, bnb, avalanche_c, gnosis, fantom, optimism, arbitrum, celo, base, goerli, zksync, zora, scroll + blockchain: ethereum, polygon, bnb, avalanche_c, gnosis, fantom, optimism, arbitrum, celo, base, goerli, zksync, zora, scroll, linea, zkevm, blast, mantle sector: evms contributors: hildobby config: @@ -76,7 +76,7 @@ models: - name: evms_traces meta: - blockchain: ethereum, polygon, bnb, avalanche_c, gnosis, fantom, optimism, arbitrum, celo, base, goerli, zksync, zora, scroll + blockchain: ethereum, polygon, bnb, avalanche_c, gnosis, fantom, optimism, arbitrum, celo, base, goerli, zksync, zora, scroll, linea, zkevm, blast, mantle sector: evms contributors: hildobby config: @@ -127,7 +127,7 @@ models: - name: evms_traces_decoded meta: - blockchain: ethereum, polygon, bnb, avalanche_c, gnosis, fantom, optimism, arbitrum, celo, base, goerli, zksync, zora, scroll + blockchain: ethereum, polygon, bnb, avalanche_c, gnosis, fantom, optimism, arbitrum, celo, base, goerli, zksync, zora, scroll, linea, zkevm, blast, mantle sector: evms contributors: hildobby config: @@ -153,7 +153,7 @@ models: - name: evms_logs meta: - blockchain: ethereum, polygon, bnb, avalanche_c, gnosis, fantom, optimism, arbitrum, celo, base, goerli, zksync, zora, scroll + blockchain: ethereum, polygon, bnb, avalanche_c, gnosis, fantom, optimism, arbitrum, celo, base, goerli, zksync, zora, scroll, linea, zkevm, blast, mantle sector: evms contributors: hildobby config: @@ -183,7 +183,7 @@ models: - name: evms_logs_decoded meta: - blockchain: ethereum, polygon, bnb, avalanche_c, gnosis, fantom, optimism, arbitrum, celo, base, goerli, zksync, zora, scroll + blockchain: ethereum, polygon, bnb, avalanche_c, gnosis, fantom, optimism, arbitrum, celo, base, goerli, zksync, zora, scroll, linea, zkevm, blast, mantle sector: evms contributors: hildobby config: @@ -209,7 +209,7 @@ models: - name: evms_blocks meta: - blockchain: ethereum, polygon, bnb, avalanche_c, gnosis, fantom, optimism, arbitrum, celo, base, goerli, zksync, zora, scroll + blockchain: ethereum, polygon, bnb, avalanche_c, gnosis, fantom, optimism, arbitrum, celo, base, goerli, zksync, zora, scroll, linea, zkevm, blast, mantle sector: evms contributors: hildobby config: @@ -232,7 +232,7 @@ models: - name: evms_contracts meta: - blockchain: ethereum, polygon, bnb, avalanche_c, gnosis, fantom, optimism, arbitrum, celo, base, goerli, zksync, zora, scroll + blockchain: ethereum, polygon, bnb, avalanche_c, gnosis, fantom, optimism, arbitrum, celo, base, goerli, zksync, zora, scroll, linea, zkevm, blast, mantle sector: evms contributors: hildobby config: @@ -268,7 +268,7 @@ models: - name: evms_creation_traces meta: - blockchain: ethereum, polygon, bnb, avalanche_c, gnosis, fantom, optimism, arbitrum, celo, base, goerli, zksync, zora, scroll + blockchain: ethereum, polygon, bnb, avalanche_c, gnosis, fantom, optimism, arbitrum, celo, base, goerli, zksync, zora, scroll, linea, zkevm, blast, mantle sector: evms contributors: hildobby config: @@ -288,7 +288,7 @@ models: - name: evms_erc20_transfers meta: - blockchain: ethereum, polygon, bnb, avalanche_c, gnosis, fantom, optimism, arbitrum, celo, base, goerli, zksync, zora, scroll + blockchain: ethereum, polygon, bnb, avalanche_c, gnosis, fantom, optimism, arbitrum, celo, base, goerli, zksync, zora, scroll, linea, zkevm, blast, mantle sector: evms contributors: hildobby config: @@ -317,7 +317,7 @@ models: - name: evms_erc20_approvals meta: - blockchain: ethereum, polygon, bnb, avalanche_c, gnosis, fantom, optimism, arbitrum, celo, base, goerli, zksync, zora, scroll + blockchain: ethereum, polygon, bnb, avalanche_c, gnosis, fantom, optimism, arbitrum, celo, base, goerli, zksync, zora, scroll, linea, zkevm, blast, mantle sector: evms contributors: hildobby config: @@ -340,7 +340,7 @@ models: - name: evms_erc1155_transferssingle meta: - blockchain: ethereum, polygon, bnb, avalanche_c, gnosis, fantom, optimism, arbitrum, celo, base, goerli, zksync, zora, scroll + blockchain: ethereum, polygon, bnb, avalanche_c, gnosis, fantom, optimism, arbitrum, celo, base, goerli, zksync, zora, scroll, linea, zkevm, blast, mantle sector: evms contributors: hildobby config: @@ -365,7 +365,7 @@ models: - name: evms_erc1155_transfersbatch meta: - blockchain: ethereum, polygon, bnb, avalanche_c, gnosis, fantom, optimism, arbitrum, celo, base, goerli, zksync, zora, scroll + blockchain: ethereum, polygon, bnb, avalanche_c, gnosis, fantom, optimism, arbitrum, celo, base, goerli, zksync, zora, scroll, linea, zkevm, blast, mantle sector: evms contributors: hildobby config: @@ -390,7 +390,7 @@ models: - name: evms_erc1155_approvalsforall meta: - blockchain: ethereum, polygon, bnb, avalanche_c, gnosis, fantom, optimism, arbitrum, celo, base, goerli, zksync, zora, scroll + blockchain: ethereum, polygon, bnb, avalanche_c, gnosis, fantom, optimism, arbitrum, celo, base, goerli, zksync, zora, scroll, linea, zkevm, blast, mantle sector: evms contributors: hildobby config: @@ -415,7 +415,7 @@ models: - name: evms_erc721_transfers meta: - blockchain: ethereum, polygon, bnb, avalanche_c, gnosis, fantom, optimism, arbitrum, celo, base, goerli, zksync, zora, scroll + blockchain: ethereum, polygon, bnb, avalanche_c, gnosis, fantom, optimism, arbitrum, celo, base, goerli, zksync, zora, scroll, linea, zkevm, blast, mantle sector: evms contributors: hildobby config: @@ -436,7 +436,7 @@ models: - name: evms_erc721_approvals meta: - blockchain: ethereum, polygon, bnb, avalanche_c, gnosis, fantom, optimism, arbitrum, celo, base, goerli, zksync, zora, scroll + blockchain: ethereum, polygon, bnb, avalanche_c, gnosis, fantom, optimism, arbitrum, celo, base, goerli, zksync, zora, scroll, linea, zkevm, blast, mantle sector: evms contributors: hildobby config: @@ -459,7 +459,7 @@ models: - name: evms_erc721_approvalsforall meta: - blockchain: ethereum, polygon, bnb, avalanche_c, gnosis, fantom, optimism, arbitrum, celo, base, goerli, zksync, zora, scroll + blockchain: ethereum, polygon, bnb, avalanche_c, gnosis, fantom, optimism, arbitrum, celo, base, goerli, zksync, zora, scroll, linea, zkevm, blast, mantle sector: evms contributors: hildobby config: @@ -479,7 +479,7 @@ models: - name: evms_info meta: - blockchain: ethereum, polygon, bnb, avalanche_c, gnosis, fantom, optimism, arbitrum, celo, base, goerli, zksync, zora, scroll + blockchain: ethereum, polygon, bnb, avalanche_c, gnosis, fantom, optimism, arbitrum, celo, base, goerli, zksync, zora, scroll, linea, zkevm, blast, mantle sector: evms contributors: hildobby config: diff --git a/models/evms/evms_traces.sql b/models/evms/evms_traces.sql index 7657eeb9de4..91c49202c6c 100644 --- a/models/evms/evms_traces.sql +++ b/models/evms/evms_traces.sql @@ -2,7 +2,7 @@ schema='evms', alias = 'traces', unique_key=['blockchain', 'tx_hash', 'evt_index'], - post_hook='{{ expose_spells(\'["ethereum", "polygon", "bnb", "avalanche_c", "gnosis", "fantom", "optimism", "arbitrum", "celo", "base", "goerli", "zksync", "zora", "scroll"]\', + post_hook='{{ expose_spells(\'["ethereum", "polygon", "bnb", "avalanche_c", "gnosis", "fantom", "optimism", "arbitrum", "celo", "base", "goerli", "zksync", "zora", "scroll", "linea", "zkevm", "blast", "mantle"]\', "sector", "evms", \'["hildobby"]\') }}' @@ -24,6 +24,10 @@ , ('zksync', source('zksync', 'traces')) , ('zora', source('zora', 'traces')) , ('scroll', source('scroll', 'traces')) + , ('linea', source('linea', 'traces')) + , ('zkevm', source('zkevm', 'traces')) + , ('blast', source('blast', 'traces')) + , ('mantle', source('mantle', 'traces')) ] %} SELECT * diff --git a/models/evms/evms_traces_decoded.sql b/models/evms/evms_traces_decoded.sql index 69318066244..0ee1294cab7 100644 --- a/models/evms/evms_traces_decoded.sql +++ b/models/evms/evms_traces_decoded.sql @@ -2,7 +2,7 @@ schema='evms', alias = 'traces_decoded', unique_key=['blockchain', 'tx_hash', 'evt_index'], - post_hook='{{ expose_spells(\'["ethereum", "polygon", "bnb", "avalanche_c", "gnosis", "fantom", "optimism", "arbitrum", "celo", "base", "goerli", "zksync", "zora", "scroll"]\', + post_hook='{{ expose_spells(\'["ethereum", "polygon", "bnb", "avalanche_c", "gnosis", "fantom", "optimism", "arbitrum", "celo", "base", "goerli", "zksync", "zora", "scroll", "linea", "zkevm", "blast", "mantle"]\', "sector", "evms", \'["hildobby"]\') }}' @@ -24,6 +24,10 @@ , ('zksync', source('zksync', 'traces_decoded')) , ('zora', source('zora', 'traces_decoded')) , ('scroll', source('scroll', 'traces_decoded')) + , ('linea', source('linea', 'traces_decoded')) + , ('zkevm', source('zkevm', 'traces_decoded')) + , ('blast', source('blast', 'traces_decoded')) + , ('mantle', source('mantle', 'traces_decoded')) ] %} SELECT * diff --git a/models/evms/evms_transactions.sql b/models/evms/evms_transactions.sql index 413bc3cdd31..81051e19604 100644 --- a/models/evms/evms_transactions.sql +++ b/models/evms/evms_transactions.sql @@ -2,7 +2,7 @@ schema='evms', alias = 'transactions', unique_key=['blockchain', 'tx_hash', 'evt_index'], - post_hook='{{ expose_spells(\'["ethereum", "polygon", "bnb", "avalanche_c", "gnosis", "fantom", "optimism", "arbitrum", "celo", "base", "goerli", "zksync", "zora", "scroll"]\', + post_hook='{{ expose_spells(\'["ethereum", "polygon", "bnb", "avalanche_c", "gnosis", "fantom", "optimism", "arbitrum", "celo", "base", "goerli", "zksync", "zora", "scroll", "linea", "zkevm", "blast", "mantle"]\', "sector", "evms", \'["hildobby"]\') }}' @@ -25,6 +25,10 @@ , ('zksync', source('zksync', 'transactions')) , ('zora', source('zora', 'transactions')) , ('scroll', source('scroll', 'transactions')) + , ('linea', source('linea', 'transactions')) + , ('zkevm', source('zkevm', 'transactions')) + , ('blast', source('blast', 'transactions')) + , ('mantle', source('mantle', 'transactions')) ] %} SELECT * From b29b329aa1582c2c92f950b0392763e3de4e7705 Mon Sep 17 00:00:00 2001 From: hildobby Date: Tue, 18 Jun 2024 15:38:56 +0200 Subject: [PATCH 145/149] Create addresses_events for mantle (#6152) * create addresses_events for mantle * Update daily_spellbook/models/addresses_events/mantle/addresses_events_mantle_first_activity.sql * Revert "Update daily_spellbook/models/addresses_events/mantle/addresses_events_mantle_first_activity.sql" This reverts commit de157dae56f016e8e47a80466d126d36998d9be6. --------- Co-authored-by: Huang Geyang Co-authored-by: jeff-dude --- ...addresses_events_mantle_first_activity.sql | 37 +++++++++ ...ddresses_events_mantle_first_funded_by.sql | 14 ++++ .../mantle/addresses_events_mantle_schema.yml | 79 +++++++++++++++++++ 3 files changed, 130 insertions(+) create mode 100644 daily_spellbook/models/addresses_events/mantle/addresses_events_mantle_first_activity.sql create mode 100644 daily_spellbook/models/addresses_events/mantle/addresses_events_mantle_first_funded_by.sql create mode 100644 daily_spellbook/models/addresses_events/mantle/addresses_events_mantle_schema.yml diff --git a/daily_spellbook/models/addresses_events/mantle/addresses_events_mantle_first_activity.sql b/daily_spellbook/models/addresses_events/mantle/addresses_events_mantle_first_activity.sql new file mode 100644 index 00000000000..34143da750f --- /dev/null +++ b/daily_spellbook/models/addresses_events/mantle/addresses_events_mantle_first_activity.sql @@ -0,0 +1,37 @@ +{{ config( + schema = 'addresses_events_mantle' + , alias = 'first_activity' + , materialized = 'incremental' + , file_format = 'delta' + , incremental_strategy = 'append' + , unique_key = ['address'] + ) +}} + +SELECT 'mantle' AS blockchain +, et."from" AS address +, MIN_BY(et."to", et.block_number) AS first_activity_to +, MIN(et.block_time) AS first_block_time +, MIN(et.block_number) AS first_block_number +, MIN_BY(et.hash, et.block_number) AS first_tx_hash +, MIN_BY(COALESCE(sig.function, CAST((bytearray_substring(et.data, 1, 4)) as VARCHAR)), et.block_number) as first_function +, MIN_BY(et.value/1e18, et.block_number) as first_{{native_symbol}}_transferred +FROM +{{ source('mantle', 'transactions') }} et +LEFT JOIN ( + SELECT + DISTINCT id, + split_part(signature,'(',1) as function + FROM + {{ source('abi', 'signatures') }} + where type = 'function_call' + AND id NOT IN (0x09779838, 0x00000000) -- for some weird reason these have duplicates functions +) sig + ON sig.id = bytearray_substring(et.data, 1, 4) +{% if is_incremental() %} +LEFT JOIN {{this}} ffb ON et."from" = ffb.address +WHERE ffb.address IS NULL +AND et.block_time >= date_trunc('day', now() - interval '7' day) +{% endif %} + +GROUP BY et."from" diff --git a/daily_spellbook/models/addresses_events/mantle/addresses_events_mantle_first_funded_by.sql b/daily_spellbook/models/addresses_events/mantle/addresses_events_mantle_first_funded_by.sql new file mode 100644 index 00000000000..ab5d5699dd7 --- /dev/null +++ b/daily_spellbook/models/addresses_events/mantle/addresses_events_mantle_first_funded_by.sql @@ -0,0 +1,14 @@ +{{ config( + schema = 'addresses_events_mantle' + , alias = 'first_funded_by' + , materialized = 'incremental' + , file_format = 'delta' + , incremental_strategy = 'append' + , unique_key = ['address'] + ) +}} + + +{{addresses_events_first_funded_by( + blockchain='mantle' +)}} diff --git a/daily_spellbook/models/addresses_events/mantle/addresses_events_mantle_schema.yml b/daily_spellbook/models/addresses_events/mantle/addresses_events_mantle_schema.yml new file mode 100644 index 00000000000..a1dbb96d762 --- /dev/null +++ b/daily_spellbook/models/addresses_events/mantle/addresses_events_mantle_schema.yml @@ -0,0 +1,79 @@ +version: 2 + +models: + - name: addresses_events_mantle_first_funded_by + meta: + blockchain: mantle + sector: addresses_events + project: addresses + contributors: hildobby + config: + tags: ['table', 'funded', 'addresses_events', 'mantle'] + description: "Table showing who first funded each Linea address in ETH" + tests: + - check_seed: + seed_file: ref('first_funded_by_seed') + filter: + blockchain: mantle + match_columns: + - blockchain + - address + check_columns: + - first_funded_by + - block_number + - tx_hash + columns: + - name: blockchain + description: "Blockchain" + - name: address + description: "Concerned mantle address" + tests: + - unique + - name: first_funded_by + description: "Which mantle address first funded the address with ETH" + - name: block_time + description: "The block time on which the address was first funded with ETH" + - name: block_number + description: "The block number on which the address was first funded with ETH" + - name: tx_hash + description: "The transaction hash on which the address was first funded with ETH" + + - name: addresses_events_mantle_first_activity + meta: + blockchain: mantle + sector: addresses_events + project: addresses + contributors: hildobby + config: + tags: ['table', 'activity', 'addresses_events', 'mantle'] + description: "Table showing first activity of each mantle Mainnet address" + tests: + - check_seed: + seed_file: ref('first_activity_seed') + filter: + blockchain: mantle + match_columns: + - address + check_columns: + - first_activity_to + - first_block_number + - first_tx_hash + columns: + - name: blockchain + description: "Blockchain" + - name: address + description: "Concerned mantle Mainnet address" + tests: + - unique + - name: first_activity_to + description: "First transaction activity to address" + - name: first_block_time + description: "The block time on which the address made it's first activity" + - name: first_block_number + description: "The block number on which the address made it's first activity" + - name: first_tx_hash + description: "The transaction hash on which the address made it's first activity" + - name: first_function + description: "first function called by address" + - name: first_eth_transferred + description: "ETH transferred in transaction" From 7182639158b5cbcd25e4b4742177b6e13946124a Mon Sep 17 00:00:00 2001 From: hildobby Date: Tue, 18 Jun 2024 15:39:08 +0200 Subject: [PATCH 146/149] Create addresses_events tables for blast (#6151) * add addresses_events for blast * fix --- .../addresses_events_blast_first_activity.sql | 37 +++++++++ ...addresses_events_blast_first_funded_by.sql | 14 ++++ .../blast/addresses_events_blast_schema.yml | 79 +++++++++++++++++++ 3 files changed, 130 insertions(+) create mode 100644 daily_spellbook/models/addresses_events/blast/addresses_events_blast_first_activity.sql create mode 100644 daily_spellbook/models/addresses_events/blast/addresses_events_blast_first_funded_by.sql create mode 100644 daily_spellbook/models/addresses_events/blast/addresses_events_blast_schema.yml diff --git a/daily_spellbook/models/addresses_events/blast/addresses_events_blast_first_activity.sql b/daily_spellbook/models/addresses_events/blast/addresses_events_blast_first_activity.sql new file mode 100644 index 00000000000..3ea6f9919c6 --- /dev/null +++ b/daily_spellbook/models/addresses_events/blast/addresses_events_blast_first_activity.sql @@ -0,0 +1,37 @@ +{{ config( + schema = 'addresses_events_blast' + , alias = 'first_activity' + , materialized = 'incremental' + , file_format = 'delta' + , incremental_strategy = 'append' + , unique_key = ['address'] + ) +}} + +SELECT 'blast' AS blockchain +, et."from" AS address +, MIN_BY(et."to", et.block_number) AS first_activity_to +, MIN(et.block_time) AS first_block_time +, MIN(et.block_number) AS first_block_number +, MIN_BY(et.hash, et.block_number) AS first_tx_hash +, MIN_BY(COALESCE(sig.function, CAST((bytearray_substring(et.data, 1, 4)) as VARCHAR)), et.block_number) as first_function +, MIN_BY(et.value/1e18, et.block_number) as first_{{native_symbol}}_transferred +FROM +{{ source('blast', 'transactions') }} et +LEFT JOIN ( + SELECT + DISTINCT id, + split_part(signature,'(',1) as function + FROM + {{ source('abi', 'signatures') }} + where type = 'function_call' + AND id NOT IN (0x09779838, 0x00000000) -- for some weird reason these have duplicates functions +) sig + ON sig.id = bytearray_substring(et.data, 1, 4) +{% if is_incremental() %} +LEFT JOIN {{this}} ffb ON et."from" = ffb.address +WHERE ffb.address IS NULL +AND et.block_time >= date_trunc('day', now() - interval '7' day) +{% endif %} + +GROUP BY et."from" diff --git a/daily_spellbook/models/addresses_events/blast/addresses_events_blast_first_funded_by.sql b/daily_spellbook/models/addresses_events/blast/addresses_events_blast_first_funded_by.sql new file mode 100644 index 00000000000..16bd0bca594 --- /dev/null +++ b/daily_spellbook/models/addresses_events/blast/addresses_events_blast_first_funded_by.sql @@ -0,0 +1,14 @@ +{{ config( + schema = 'addresses_events_blast' + , alias = 'first_funded_by' + , materialized = 'incremental' + , file_format = 'delta' + , incremental_strategy = 'append' + , unique_key = ['address'] + ) +}} + + +{{addresses_events_first_funded_by( + blockchain='blast' +)}} diff --git a/daily_spellbook/models/addresses_events/blast/addresses_events_blast_schema.yml b/daily_spellbook/models/addresses_events/blast/addresses_events_blast_schema.yml new file mode 100644 index 00000000000..75c38b79f16 --- /dev/null +++ b/daily_spellbook/models/addresses_events/blast/addresses_events_blast_schema.yml @@ -0,0 +1,79 @@ +version: 2 + +models: + - name: addresses_events_blast_first_funded_by + meta: + blockchain: blast + sector: addresses_events + project: addresses + contributors: hildobby, lgingerich + config: + tags: ['table', 'funded', 'addresses_events', 'blast'] + description: "Table showing who first funded each blast address in ETH" + tests: + - check_seed: + seed_file: ref('first_funded_by_seed') + filter: + blockchain: blast + match_columns: + - blockchain + - address + check_columns: + - first_funded_by + - block_number + - tx_hash + columns: + - name: blockchain + description: "Blockchain" + - name: address + description: "Concerned blast address" + tests: + - unique + - name: first_funded_by + description: "Which blast address first funded the address with ETH" + - name: block_time + description: "The block time on which the address was first funded with ETH" + - name: block_number + description: "The block number on which the address was first funded with ETH" + - name: tx_hash + description: "The transaction hash on which the address was first funded with ETH" + + - name: addresses_events_blast_first_activity + meta: + blockchain: blast + sector: addresses_events + project: addresses + contributors: hildobby + config: + tags: ['table', 'activity', 'addresses_events', 'blast'] + description: "Table showing first activity of each blast Mainnet address" + tests: + - check_seed: + seed_file: ref('first_activity_seed') + filter: + blockchain: blast + match_columns: + - address + check_columns: + - first_activity_to + - first_block_number + - first_tx_hash + columns: + - name: blockchain + description: "Blockchain" + - name: address + description: "Concerned blast Mainnet address" + tests: + - unique + - name: first_activity_to + description: "First transaction activity to address" + - name: first_block_time + description: "The block time on which the address made it's first activity" + - name: first_block_number + description: "The block number on which the address made it's first activity" + - name: first_tx_hash + description: "The transaction hash on which the address made it's first activity" + - name: first_function + description: "first function called by address" + - name: first_eth_transferred + description: "ETH transferred in transaction" From 4848fc383f0b98c7a5f8eebd949bd42f85c3a7d5 Mon Sep 17 00:00:00 2001 From: Thanh Le Date: Tue, 18 Jun 2024 20:39:59 +0700 Subject: [PATCH 147/149] Add solana dex price hrs (#6080) * Add solana dex price hrs * Update models/dex/solana/dex_solana_price_hour.sql Co-authored-by: Huang Geyang * Use the variable * Update models/dex/solana/dex_solana_price_hour.sql Co-authored-by: Huang Geyang * Fix project_start_date * Update models/dex/solana/dex_solana_schema.yml --------- Co-authored-by: Huang Geyang --- models/dex/solana/dex_solana_price_hour.sql | 70 +++++++++++++++++++++ models/dex/solana/dex_solana_schema.yml | 30 +++++++++ 2 files changed, 100 insertions(+) create mode 100644 models/dex/solana/dex_solana_price_hour.sql diff --git a/models/dex/solana/dex_solana_price_hour.sql b/models/dex/solana/dex_solana_price_hour.sql new file mode 100644 index 00000000000..c30da89c0c1 --- /dev/null +++ b/models/dex/solana/dex_solana_price_hour.sql @@ -0,0 +1,70 @@ +{{ + config( + schema = 'dex_solana', + alias = 'price_hour', + partition_by = ['block_month'], + materialized = 'incremental', + file_format = 'delta', + incremental_strategy = 'merge', + incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.hour')], + unique_key = ['blockchain', 'contract_address', 'hour'], + pre_hook='{{ enforce_join_distribution("PARTITIONED") }}', + post_hook='{{ expose_spells(\'["solana"]\', + "project", + "dex", + \'["get_nimbus"]\') }}') +}} + +{% set project_start_date = '2022-03-10' %} --grabbed min block time from whirlpool_solana.whirlpool_call_swap +with + raw_data as ( + SELECT + * + FROM + {{ ref('dex_solana_trades') }} + WHERE 1 = 1 + {% if is_incremental() %} + AND {{ incremental_predicate('block_time') }} + {% else %} + AND block_time >= DATE '{{project_start_date}}' + {% endif %} + ), + bought_price as ( + SELECT + token_bought_mint_address as token_mint, + DATE_TRUNC('hour', block_time) AS hour, + SUM(amount_usd) / SUM(token_bought_amount) AS price + FROM raw_data + GROUP BY + 1, + 2 + ), + sold_price as ( + SELECT token_sold_mint_address as token_mint, + DATE_TRUNC('hour', block_time) AS hour, + SUM(amount_usd) / SUM(token_sold_amount) AS price + FROM raw_data + GROUP BY 1, + 2 + ), + all_trades as ( + SELECT * + FROM bought_price + UNION ALL + SELECT * + FROM sold_price + ) +SELECT t1.token_mint as contract_address, + t1.hour as hour, + t2.symbol, + t2.decimals, + 'solana' as blockchain, + avg(t1.price) as price, + CAST(DATE_TRUNC('month', t1.hour) as date) as block_month +FROM all_trades t1 + JOIN + {{ ref('tokens_solana_fungible') }} t2 ON t1.token_mint = t2.token_mint_address +GROUP BY 1, + 2, + 3, + 4 \ No newline at end of file diff --git a/models/dex/solana/dex_solana_schema.yml b/models/dex/solana/dex_solana_schema.yml index 9bbcabd2184..d34e0d9a1e4 100644 --- a/models/dex/solana/dex_solana_schema.yml +++ b/models/dex/solana/dex_solana_schema.yml @@ -92,3 +92,33 @@ models: - &tx_index name: tx_index description: "index of the transaction in the block slot" + + - name: dex_solana_price_hour + meta: + blockchain: solana + contributors: [get_nimbus] + config: + tags: ['solana','dex', 'price'] + description: > + All token price in Orca pool + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - blockchain + - contract_address + - hour + columns: + - name: blockchain + description: "Blockchain which the DEX is deployed" + - name: contract_address + description: "contract_address of token" + - name: hour + description: "Time of price in hour" + - name: block_month + description: "UTC event block month of each DEX trade" + - name: symbol + description: "Token symbol" + - name: decimals + description: "Token decimals" + - name: price + description: "Token price" \ No newline at end of file From 7aad21619da7fc9ae3184c12defd9dfd6845973a Mon Sep 17 00:00:00 2001 From: Amin Latifi Date: Tue, 18 Jun 2024 20:24:58 +0000 Subject: [PATCH 148/149] Add GIV token to ethereum prices (#6137) * Add GIV token to ethereum prices * Updated GIV token coinpaparika ID * Empty --- models/prices/ethereum/prices_ethereum_tokens.sql | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/models/prices/ethereum/prices_ethereum_tokens.sql b/models/prices/ethereum/prices_ethereum_tokens.sql index fde65530dfd..448ca538aeb 100644 --- a/models/prices/ethereum/prices_ethereum_tokens.sql +++ b/models/prices/ethereum/prices_ethereum_tokens.sql @@ -1792,7 +1792,8 @@ FROM ('cah-moon-tropica', 'ethereum', 'CAH', 0x8e0e57dcb1ce8d9091df38ec1bfc3b224529754a, 18), ('bigtime-big-time', 'ethereum', 'BIGTIME', 0x64Bc2cA1Be492bE7185FAA2c8835d9b824c8a194, 18), ('portal2-portal-coin', 'ethereum', 'PORTAL', 0x1bbe973bef3a977fc51cbed703e8ffdefe001fed, 18), - ('dough-l3t-h1m-c00k', 'ethereum', 'DOUGH', 0xFc116eA24F002F600e363bdce4b91715fe5e0392, 9) + ('dough-l3t-h1m-c00k', 'ethereum', 'DOUGH', 0xFc116eA24F002F600e363bdce4b91715fe5e0392, 9), + ('giv-giv', 'ethereum', 'GIV', 0x900db999074d9277c5da2a43f252d74366230da0, 18) ) as temp (token_id, blockchain, symbol, contract_address, decimals) where contract_address not in ( -- bad price feeds From a563d22dbdfa9ae68ad2de90987348b33f58156c Mon Sep 17 00:00:00 2001 From: jeff-dude <102681548+jeff-dude@users.noreply.github.com> Date: Tue, 18 Jun 2024 17:46:36 -0400 Subject: [PATCH 149/149] initiate uniswap version views (#6201) --- .../ethereum/uniswap_v2_ethereum_trades.sql | 38 +++++++++++++++++ .../ethereum/uniswap_v3_ethereum_trades.sql | 42 +++++++++++++++++++ 2 files changed, 80 insertions(+) create mode 100644 dex/models/_projects/uniswap/ethereum/uniswap_v2_ethereum_trades.sql create mode 100644 dex/models/_projects/uniswap/ethereum/uniswap_v3_ethereum_trades.sql diff --git a/dex/models/_projects/uniswap/ethereum/uniswap_v2_ethereum_trades.sql b/dex/models/_projects/uniswap/ethereum/uniswap_v2_ethereum_trades.sql new file mode 100644 index 00000000000..b226c71204a --- /dev/null +++ b/dex/models/_projects/uniswap/ethereum/uniswap_v2_ethereum_trades.sql @@ -0,0 +1,38 @@ +{{ config( + schema = 'uniswap_v2_ethereum', + alias = 'trades', + materialized = 'view' + ) +}} + + +SELECT + dex.blockchain + , dex.project + , dex.version + , dex.block_month + , dex.block_date + , dex.block_time + , dex.block_number + , dex.token_bought_symbol + , dex.token_sold_symbol + , dex.token_pair + , dex.token_bought_amount + , dex.token_sold_amount + , dex.token_bought_amount_raw + , dex.token_sold_amount_raw + , dex.amount_usd + , dex.token_bought_address + , dex.token_sold_address + , dex.taker + , dex.maker + , dex.project_contract_address + , dex.tx_hash + , dex.tx_from + , dex.tx_to + , dex.evt_index +FROM + {{ ref('dex_trades') }} as dex +WHERE + dex.project = 'uniswap' + AND dex.version = '2' \ No newline at end of file diff --git a/dex/models/_projects/uniswap/ethereum/uniswap_v3_ethereum_trades.sql b/dex/models/_projects/uniswap/ethereum/uniswap_v3_ethereum_trades.sql new file mode 100644 index 00000000000..2c354b321a4 --- /dev/null +++ b/dex/models/_projects/uniswap/ethereum/uniswap_v3_ethereum_trades.sql @@ -0,0 +1,42 @@ +{{ config( + schema = 'uniswap_v3_ethereum', + alias = 'trades', + materialized = 'view' + ) +}} + + +SELECT + dex.blockchain + , dex.project + , dex.version + , dex.block_month + , dex.block_date + , dex.block_time + , dex.block_number + , dex.token_bought_symbol + , dex.token_sold_symbol + , dex.token_pair + , dex.token_bought_amount + , dex.token_sold_amount + , dex.token_bought_amount_raw + , dex.token_sold_amount_raw + , dex.amount_usd + , dex.token_bought_address + , dex.token_sold_address + , dex.taker + , dex.maker + , dex.project_contract_address + , f.fee + , dex.tx_hash + , dex.tx_from + , dex.tx_to + , dex.evt_index +FROM + {{ ref('dex_trades') }} as dex +INNER JOIN + {{ source('uniswap_v3_ethereum', 'Factory_evt_PoolCreated') }} as f + ON f.pool = dex.project_contract_address +WHERE + dex.project = 'uniswap' + AND dex.version = '3' \ No newline at end of file