diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 41761301108..2102ae9d859 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -19,7 +19,7 @@ Contributions in the form of issues and pull requests are very much welcome here ## [BETA] Pre-push hooks -UPDATE: These pre-push hooks require running `dbt compile` which is a fairly slow step due to the size of our project. We intend to rewrite these hooks to be more efficient but for the time being they remain cumbersome. Feel free to use them if you find them useful but the same checks will run in a Github Action when you commit your code. Feel free to uninstall if they do not bring joy, we'll let wizards know when we think we've improved them enought to warrant making them part of the general development flow. +UPDATE: These pre-push hooks require running `dbt compile` which is a fairly slow step due to the size of our project. We intend to rewrite these hooks to be more efficient but for the time being they remain cumbersome. Feel free to use them if you find them useful but the same checks will run in a Github Action when you commit your code. Feel free to uninstall if they do not bring joy, we'll let wizards know when we think we've improved them enough to warrant making them part of the general development flow. We are testing out adding pre-push hooks to our workflow. The goal is to catch common errors before code is pushed and streamline the pull request review process. @@ -126,13 +126,13 @@ example custom test: ```sql with unit_test1 as (select - case when col1 == 2 and col2 == 'moon' then True else False end as test + case when col1 = 2 and col2 = 'moon' then True else False end as test from {{ ref('mock_table' )}} where tx_id = '102'), unit_test2 as (select - case when col1 == 2 and col2 == 'moon' then True else False end as test + case when col1 = 2 and col2 = 'moon' then True else False end as test from {{ ref('mock_table' )}} where tx_id = '103'), diff --git a/Pipfile b/Pipfile index fe5bde4c96d..c9ae7c5f591 100644 --- a/Pipfile +++ b/Pipfile @@ -7,7 +7,7 @@ name = "pypi" numpy = "2.0.12" pre-commit = "2.20.0" pytest = "7.1.3" -dbt-trino = "1.8.2" +dbt-trino = "1.9.0" [requires] -python_version = "3.9" \ No newline at end of file +python_version = "3.9" diff --git a/Pipfile.lock b/Pipfile.lock index fa6d5669f33..4be5af25b65 100644 --- a/Pipfile.lock +++ b/Pipfile.lock @@ -1,7 +1,7 @@ { "_meta": { "hash": { - "sha256": "ad039719a8fc32f6782de06f76f191e442fce11863ff3248c65ee3ab7e137618" + "sha256": "82294d4746cf046802c3e59758a47a7e13d24a6abec9e6f8fbfd5d2384217b9a" }, "pipfile-spec": 6, "requires": { @@ -65,114 +65,101 @@ }, "charset-normalizer": { "hashes": [ - "sha256:0099d79bdfcf5c1f0c2c72f91516702ebf8b0b8ddd8905f97a8aecf49712c621", - "sha256:0713f3adb9d03d49d365b70b84775d0a0d18e4ab08d12bc46baa6132ba78aaf6", - "sha256:07afec21bbbbf8a5cc3651aa96b980afe2526e7f048fdfb7f1014d84acc8b6d8", - "sha256:0b309d1747110feb25d7ed6b01afdec269c647d382c857ef4663bbe6ad95a912", - "sha256:0d99dd8ff461990f12d6e42c7347fd9ab2532fb70e9621ba520f9e8637161d7c", - "sha256:0de7b687289d3c1b3e8660d0741874abe7888100efe14bd0f9fd7141bcbda92b", - "sha256:1110e22af8ca26b90bd6364fe4c763329b0ebf1ee213ba32b68c73de5752323d", - "sha256:130272c698667a982a5d0e626851ceff662565379baf0ff2cc58067b81d4f11d", - "sha256:136815f06a3ae311fae551c3df1f998a1ebd01ddd424aa5603a4336997629e95", - "sha256:14215b71a762336254351b00ec720a8e85cada43b987da5a042e4ce3e82bd68e", - "sha256:1db4e7fefefd0f548d73e2e2e041f9df5c59e178b4c72fbac4cc6f535cfb1565", - "sha256:1ffd9493de4c922f2a38c2bf62b831dcec90ac673ed1ca182fe11b4d8e9f2a64", - "sha256:2006769bd1640bdf4d5641c69a3d63b71b81445473cac5ded39740a226fa88ab", - "sha256:20587d20f557fe189b7947d8e7ec5afa110ccf72a3128d61a2a387c3313f46be", - "sha256:223217c3d4f82c3ac5e29032b3f1c2eb0fb591b72161f86d93f5719079dae93e", - "sha256:27623ba66c183eca01bf9ff833875b459cad267aeeb044477fedac35e19ba907", - "sha256:285e96d9d53422efc0d7a17c60e59f37fbf3dfa942073f666db4ac71e8d726d0", - "sha256:2de62e8801ddfff069cd5c504ce3bc9672b23266597d4e4f50eda28846c322f2", - "sha256:2f6c34da58ea9c1a9515621f4d9ac379871a8f21168ba1b5e09d74250de5ad62", - "sha256:309a7de0a0ff3040acaebb35ec45d18db4b28232f21998851cfa709eeff49d62", - "sha256:35c404d74c2926d0287fbd63ed5d27eb911eb9e4a3bb2c6d294f3cfd4a9e0c23", - "sha256:3710a9751938947e6327ea9f3ea6332a09bf0ba0c09cae9cb1f250bd1f1549bc", - "sha256:3d59d125ffbd6d552765510e3f31ed75ebac2c7470c7274195b9161a32350284", - "sha256:40d3ff7fc90b98c637bda91c89d51264a3dcf210cade3a2c6f838c7268d7a4ca", - "sha256:425c5f215d0eecee9a56cdb703203dda90423247421bf0d67125add85d0c4455", - "sha256:43193c5cda5d612f247172016c4bb71251c784d7a4d9314677186a838ad34858", - "sha256:44aeb140295a2f0659e113b31cfe92c9061622cadbc9e2a2f7b8ef6b1e29ef4b", - "sha256:47334db71978b23ebcf3c0f9f5ee98b8d65992b65c9c4f2d34c2eaf5bcaf0594", - "sha256:4796efc4faf6b53a18e3d46343535caed491776a22af773f366534056c4e1fbc", - "sha256:4a51b48f42d9358460b78725283f04bddaf44a9358197b889657deba38f329db", - "sha256:4b67fdab07fdd3c10bb21edab3cbfe8cf5696f453afce75d815d9d7223fbe88b", - "sha256:4ec9dd88a5b71abfc74e9df5ebe7921c35cbb3b641181a531ca65cdb5e8e4dea", - "sha256:4f9fc98dad6c2eaa32fc3af1417d95b5e3d08aff968df0cd320066def971f9a6", - "sha256:54b6a92d009cbe2fb11054ba694bc9e284dad30a26757b1e372a1fdddaf21920", - "sha256:55f56e2ebd4e3bc50442fbc0888c9d8c94e4e06a933804e2af3e89e2f9c1c749", - "sha256:5726cf76c982532c1863fb64d8c6dd0e4c90b6ece9feb06c9f202417a31f7dd7", - "sha256:5d447056e2ca60382d460a604b6302d8db69476fd2015c81e7c35417cfabe4cd", - "sha256:5ed2e36c3e9b4f21dd9422f6893dec0abf2cca553af509b10cd630f878d3eb99", - "sha256:5ff2ed8194587faf56555927b3aa10e6fb69d931e33953943bc4f837dfee2242", - "sha256:62f60aebecfc7f4b82e3f639a7d1433a20ec32824db2199a11ad4f5e146ef5ee", - "sha256:63bc5c4ae26e4bc6be6469943b8253c0fd4e4186c43ad46e713ea61a0ba49129", - "sha256:6b40e8d38afe634559e398cc32b1472f376a4099c75fe6299ae607e404c033b2", - "sha256:6b493a043635eb376e50eedf7818f2f322eabbaa974e948bd8bdd29eb7ef2a51", - "sha256:6dba5d19c4dfab08e58d5b36304b3f92f3bd5d42c1a3fa37b5ba5cdf6dfcbcee", - "sha256:6fd30dc99682dc2c603c2b315bded2799019cea829f8bf57dc6b61efde6611c8", - "sha256:707b82d19e65c9bd28b81dde95249b07bf9f5b90ebe1ef17d9b57473f8a64b7b", - "sha256:7706f5850360ac01d80c89bcef1640683cc12ed87f42579dab6c5d3ed6888613", - "sha256:7782afc9b6b42200f7362858f9e73b1f8316afb276d316336c0ec3bd73312742", - "sha256:79983512b108e4a164b9c8d34de3992f76d48cadc9554c9e60b43f308988aabe", - "sha256:7f683ddc7eedd742e2889d2bfb96d69573fde1d92fcb811979cdb7165bb9c7d3", - "sha256:82357d85de703176b5587dbe6ade8ff67f9f69a41c0733cf2425378b49954de5", - "sha256:84450ba661fb96e9fd67629b93d2941c871ca86fc38d835d19d4225ff946a631", - "sha256:86f4e8cca779080f66ff4f191a685ced73d2f72d50216f7112185dc02b90b9b7", - "sha256:8cda06946eac330cbe6598f77bb54e690b4ca93f593dee1568ad22b04f347c15", - "sha256:8ce7fd6767a1cc5a92a639b391891bf1c268b03ec7e021c7d6d902285259685c", - "sha256:8ff4e7cdfdb1ab5698e675ca622e72d58a6fa2a8aa58195de0c0061288e6e3ea", - "sha256:9289fd5dddcf57bab41d044f1756550f9e7cf0c8e373b8cdf0ce8773dc4bd417", - "sha256:92a7e36b000bf022ef3dbb9c46bfe2d52c047d5e3f3343f43204263c5addc250", - "sha256:92db3c28b5b2a273346bebb24857fda45601aef6ae1c011c0a997106581e8a88", - "sha256:95c3c157765b031331dd4db3c775e58deaee050a3042fcad72cbc4189d7c8dca", - "sha256:980b4f289d1d90ca5efcf07958d3eb38ed9c0b7676bf2831a54d4f66f9c27dfa", - "sha256:9ae4ef0b3f6b41bad6366fb0ea4fc1d7ed051528e113a60fa2a65a9abb5b1d99", - "sha256:9c98230f5042f4945f957d006edccc2af1e03ed5e37ce7c373f00a5a4daa6149", - "sha256:9fa2566ca27d67c86569e8c85297aaf413ffab85a8960500f12ea34ff98e4c41", - "sha256:a14969b8691f7998e74663b77b4c36c0337cb1df552da83d5c9004a93afdb574", - "sha256:a8aacce6e2e1edcb6ac625fb0f8c3a9570ccc7bfba1f63419b3769ccf6a00ed0", - "sha256:a8e538f46104c815be19c975572d74afb53f29650ea2025bbfaef359d2de2f7f", - "sha256:aa41e526a5d4a9dfcfbab0716c7e8a1b215abd3f3df5a45cf18a12721d31cb5d", - "sha256:aa693779a8b50cd97570e5a0f343538a8dbd3e496fa5dcb87e29406ad0299654", - "sha256:ab22fbd9765e6954bc0bcff24c25ff71dcbfdb185fcdaca49e81bac68fe724d3", - "sha256:ab2e5bef076f5a235c3774b4f4028a680432cded7cad37bba0fd90d64b187d19", - "sha256:ab973df98fc99ab39080bfb0eb3a925181454d7c3ac8a1e695fddfae696d9e90", - "sha256:af73657b7a68211996527dbfeffbb0864e043d270580c5aef06dc4b659a4b578", - "sha256:b197e7094f232959f8f20541ead1d9862ac5ebea1d58e9849c1bf979255dfac9", - "sha256:b295729485b06c1a0683af02a9e42d2caa9db04a373dc38a6a58cdd1e8abddf1", - "sha256:b8831399554b92b72af5932cdbbd4ddc55c55f631bb13ff8fe4e6536a06c5c51", - "sha256:b8dcd239c743aa2f9c22ce674a145e0a25cb1566c495928440a181ca1ccf6719", - "sha256:bcb4f8ea87d03bc51ad04add8ceaf9b0f085ac045ab4d74e73bbc2dc033f0236", - "sha256:bd7af3717683bea4c87acd8c0d3d5b44d56120b26fd3f8a692bdd2d5260c620a", - "sha256:bf4475b82be41b07cc5e5ff94810e6a01f276e37c2d55571e3fe175e467a1a1c", - "sha256:c3e446d253bd88f6377260d07c895816ebf33ffffd56c1c792b13bff9c3e1ade", - "sha256:c57516e58fd17d03ebe67e181a4e4e2ccab1168f8c2976c6a334d4f819fe5944", - "sha256:c94057af19bc953643a33581844649a7fdab902624d2eb739738a30e2b3e60fc", - "sha256:cab5d0b79d987c67f3b9e9c53f54a61360422a5a0bc075f43cab5621d530c3b6", - "sha256:ce031db0408e487fd2775d745ce30a7cd2923667cf3b69d48d219f1d8f5ddeb6", - "sha256:cee4373f4d3ad28f1ab6290684d8e2ebdb9e7a1b74fdc39e4c211995f77bec27", - "sha256:d5b054862739d276e09928de37c79ddeec42a6e1bfc55863be96a36ba22926f6", - "sha256:dbe03226baf438ac4fda9e2d0715022fd579cb641c4cf639fa40d53b2fe6f3e2", - "sha256:dc15e99b2d8a656f8e666854404f1ba54765871104e50c8e9813af8a7db07f12", - "sha256:dcaf7c1524c0542ee2fc82cc8ec337f7a9f7edee2532421ab200d2b920fc97cf", - "sha256:dd4eda173a9fcccb5f2e2bd2a9f423d180194b1bf17cf59e3269899235b2a114", - "sha256:dd9a8bd8900e65504a305bf8ae6fa9fbc66de94178c420791d0293702fce2df7", - "sha256:de7376c29d95d6719048c194a9cf1a1b0393fbe8488a22008610b0361d834ecf", - "sha256:e7fdd52961feb4c96507aa649550ec2a0d527c086d284749b2f582f2d40a2e0d", - "sha256:e91f541a85298cf35433bf66f3fab2a4a2cff05c127eeca4af174f6d497f0d4b", - "sha256:e9e3c4c9e1ed40ea53acf11e2a386383c3304212c965773704e4603d589343ed", - "sha256:ee803480535c44e7f5ad00788526da7d85525cfefaf8acf8ab9a310000be4b03", - "sha256:f09cb5a7bbe1ecae6e87901a2eb23e0256bb524a79ccc53eb0b7629fbe7677c4", - "sha256:f19c1585933c82098c2a520f8ec1227f20e339e33aca8fa6f956f6691b784e67", - "sha256:f1a2f519ae173b5b6a2c9d5fa3116ce16e48b3462c8b96dfdded11055e3d6365", - "sha256:f28f891ccd15c514a0981f3b9db9aa23d62fe1a99997512b0491d2ed323d229a", - "sha256:f3e73a4255342d4eb26ef6df01e3962e73aa29baa3124a8e824c5d3364a65748", - "sha256:f606a1881d2663630ea5b8ce2efe2111740df4b687bd78b34a8131baa007f79b", - "sha256:fe9f97feb71aa9896b81973a7bbada8c49501dc73e58a10fcef6663af95e5079", - "sha256:ffc519621dce0c767e96b9c53f09c5d215578e10b02c285809f76509a3931482" - ], - "markers": "python_full_version >= '3.7.0'", - "version": "==3.4.0" + "sha256:0167ddc8ab6508fe81860a57dd472b2ef4060e8d378f0cc555707126830f2537", + "sha256:01732659ba9b5b873fc117534143e4feefecf3b2078b0a6a2e925271bb6f4cfa", + "sha256:01ad647cdd609225c5350561d084b42ddf732f4eeefe6e678765636791e78b9a", + "sha256:04432ad9479fa40ec0f387795ddad4437a2b50417c69fa275e212933519ff294", + "sha256:0907f11d019260cdc3f94fbdb23ff9125f6b5d1039b76003b5b0ac9d6a6c9d5b", + "sha256:0924e81d3d5e70f8126529951dac65c1010cdf117bb75eb02dd12339b57749dd", + "sha256:09b26ae6b1abf0d27570633b2b078a2a20419c99d66fb2823173d73f188ce601", + "sha256:09b5e6733cbd160dcc09589227187e242a30a49ca5cefa5a7edd3f9d19ed53fd", + "sha256:0af291f4fe114be0280cdd29d533696a77b5b49cfde5467176ecab32353395c4", + "sha256:0f55e69f030f7163dffe9fd0752b32f070566451afe180f99dbeeb81f511ad8d", + "sha256:1a2bc9f351a75ef49d664206d51f8e5ede9da246602dc2d2726837620ea034b2", + "sha256:22e14b5d70560b8dd51ec22863f370d1e595ac3d024cb8ad7d308b4cd95f8313", + "sha256:234ac59ea147c59ee4da87a0c0f098e9c8d169f4dc2a159ef720f1a61bbe27cd", + "sha256:2369eea1ee4a7610a860d88f268eb39b95cb588acd7235e02fd5a5601773d4fa", + "sha256:237bdbe6159cff53b4f24f397d43c6336c6b0b42affbe857970cefbb620911c8", + "sha256:28bf57629c75e810b6ae989f03c0828d64d6b26a5e205535585f96093e405ed1", + "sha256:2967f74ad52c3b98de4c3b32e1a44e32975e008a9cd2a8cc8966d6a5218c5cb2", + "sha256:2a75d49014d118e4198bcee5ee0a6f25856b29b12dbf7cd012791f8a6cc5c496", + "sha256:2bdfe3ac2e1bbe5b59a1a63721eb3b95fc9b6817ae4a46debbb4e11f6232428d", + "sha256:2d074908e1aecee37a7635990b2c6d504cd4766c7bc9fc86d63f9c09af3fa11b", + "sha256:2fb9bd477fdea8684f78791a6de97a953c51831ee2981f8e4f583ff3b9d9687e", + "sha256:311f30128d7d333eebd7896965bfcfbd0065f1716ec92bd5638d7748eb6f936a", + "sha256:329ce159e82018d646c7ac45b01a430369d526569ec08516081727a20e9e4af4", + "sha256:345b0426edd4e18138d6528aed636de7a9ed169b4aaf9d61a8c19e39d26838ca", + "sha256:363e2f92b0f0174b2f8238240a1a30142e3db7b957a5dd5689b0e75fb717cc78", + "sha256:3a3bd0dcd373514dcec91c411ddb9632c0d7d92aed7093b8c3bbb6d69ca74408", + "sha256:3bed14e9c89dcb10e8f3a29f9ccac4955aebe93c71ae803af79265c9ca5644c5", + "sha256:44251f18cd68a75b56585dd00dae26183e102cd5e0f9f1466e6df5da2ed64ea3", + "sha256:44ecbf16649486d4aebafeaa7ec4c9fed8b88101f4dd612dcaf65d5e815f837f", + "sha256:4532bff1b8421fd0a320463030c7520f56a79c9024a4e88f01c537316019005a", + "sha256:49402233c892a461407c512a19435d1ce275543138294f7ef013f0b63d5d3765", + "sha256:4c0907b1928a36d5a998d72d64d8eaa7244989f7aaaf947500d3a800c83a3fd6", + "sha256:4d86f7aff21ee58f26dcf5ae81a9addbd914115cdebcbb2217e4f0ed8982e146", + "sha256:5777ee0881f9499ed0f71cc82cf873d9a0ca8af166dfa0af8ec4e675b7df48e6", + "sha256:5df196eb874dae23dcfb968c83d4f8fdccb333330fe1fc278ac5ceeb101003a9", + "sha256:619a609aa74ae43d90ed2e89bdd784765de0a25ca761b93e196d938b8fd1dbbd", + "sha256:6e27f48bcd0957c6d4cb9d6fa6b61d192d0b13d5ef563e5f2ae35feafc0d179c", + "sha256:6ff8a4a60c227ad87030d76e99cd1698345d4491638dfa6673027c48b3cd395f", + "sha256:73d94b58ec7fecbc7366247d3b0b10a21681004153238750bb67bd9012414545", + "sha256:7461baadb4dc00fd9e0acbe254e3d7d2112e7f92ced2adc96e54ef6501c5f176", + "sha256:75832c08354f595c760a804588b9357d34ec00ba1c940c15e31e96d902093770", + "sha256:7709f51f5f7c853f0fb938bcd3bc59cdfdc5203635ffd18bf354f6967ea0f824", + "sha256:78baa6d91634dfb69ec52a463534bc0df05dbd546209b79a3880a34487f4b84f", + "sha256:7974a0b5ecd505609e3b19742b60cee7aa2aa2fb3151bc917e6e2646d7667dcf", + "sha256:7a4f97a081603d2050bfaffdefa5b02a9ec823f8348a572e39032caa8404a487", + "sha256:7b1bef6280950ee6c177b326508f86cad7ad4dff12454483b51d8b7d673a2c5d", + "sha256:7d053096f67cd1241601111b698f5cad775f97ab25d81567d3f59219b5f1adbd", + "sha256:804a4d582ba6e5b747c625bf1255e6b1507465494a40a2130978bda7b932c90b", + "sha256:807f52c1f798eef6cf26beb819eeb8819b1622ddfeef9d0977a8502d4db6d534", + "sha256:80ed5e856eb7f30115aaf94e4a08114ccc8813e6ed1b5efa74f9f82e8509858f", + "sha256:8417cb1f36cc0bc7eaba8ccb0e04d55f0ee52df06df3ad55259b9a323555fc8b", + "sha256:8436c508b408b82d87dc5f62496973a1805cd46727c34440b0d29d8a2f50a6c9", + "sha256:89149166622f4db9b4b6a449256291dc87a99ee53151c74cbd82a53c8c2f6ccd", + "sha256:8bfa33f4f2672964266e940dd22a195989ba31669bd84629f05fab3ef4e2d125", + "sha256:8c60ca7339acd497a55b0ea5d506b2a2612afb2826560416f6894e8b5770d4a9", + "sha256:91b36a978b5ae0ee86c394f5a54d6ef44db1de0815eb43de826d41d21e4af3de", + "sha256:955f8851919303c92343d2f66165294848d57e9bba6cf6e3625485a70a038d11", + "sha256:97f68b8d6831127e4787ad15e6757232e14e12060bec17091b85eb1486b91d8d", + "sha256:9b23ca7ef998bc739bf6ffc077c2116917eabcc901f88da1b9856b210ef63f35", + "sha256:9f0b8b1c6d84c8034a44893aba5e767bf9c7a211e313a9605d9c617d7083829f", + "sha256:aabfa34badd18f1da5ec1bc2715cadc8dca465868a4e73a0173466b688f29dda", + "sha256:ab36c8eb7e454e34e60eb55ca5d241a5d18b2c6244f6827a30e451c42410b5f7", + "sha256:b010a7a4fd316c3c484d482922d13044979e78d1861f0e0650423144c616a46a", + "sha256:b1ac5992a838106edb89654e0aebfc24f5848ae2547d22c2c3f66454daa11971", + "sha256:b7b2d86dd06bfc2ade3312a83a5c364c7ec2e3498f8734282c6c3d4b07b346b8", + "sha256:b97e690a2118911e39b4042088092771b4ae3fc3aa86518f84b8cf6888dbdb41", + "sha256:bc2722592d8998c870fa4e290c2eec2c1569b87fe58618e67d38b4665dfa680d", + "sha256:c0429126cf75e16c4f0ad00ee0eae4242dc652290f940152ca8c75c3a4b6ee8f", + "sha256:c30197aa96e8eed02200a83fba2657b4c3acd0f0aa4bdc9f6c1af8e8962e0757", + "sha256:c4c3e6da02df6fa1410a7680bd3f63d4f710232d3139089536310d027950696a", + "sha256:c75cb2a3e389853835e84a2d8fb2b81a10645b503eca9bcb98df6b5a43eb8886", + "sha256:c96836c97b1238e9c9e3fe90844c947d5afbf4f4c92762679acfe19927d81d77", + "sha256:d7f50a1f8c450f3925cb367d011448c39239bb3eb4117c36a6d354794de4ce76", + "sha256:d973f03c0cb71c5ed99037b870f2be986c3c05e63622c017ea9816881d2dd247", + "sha256:d98b1668f06378c6dbefec3b92299716b931cd4e6061f3c875a71ced1780ab85", + "sha256:d9c3cdf5390dcd29aa8056d13e8e99526cda0305acc038b96b30352aff5ff2bb", + "sha256:dad3e487649f498dd991eeb901125411559b22e8d7ab25d3aeb1af367df5efd7", + "sha256:dccbe65bd2f7f7ec22c4ff99ed56faa1e9f785482b9bbd7c717e26fd723a1d1e", + "sha256:dd78cfcda14a1ef52584dbb008f7ac81c1328c0f58184bf9a84c49c605002da6", + "sha256:e218488cd232553829be0664c2292d3af2eeeb94b32bea483cf79ac6a694e037", + "sha256:e358e64305fe12299a08e08978f51fc21fac060dcfcddd95453eabe5b93ed0e1", + "sha256:ea0d8d539afa5eb2728aa1932a988a9a7af94f18582ffae4bc10b3fbdad0626e", + "sha256:eab677309cdb30d047996b36d34caeda1dc91149e4fdca0b1a039b3f79d9a807", + "sha256:eb8178fe3dba6450a3e024e95ac49ed3400e506fd4e9e5c32d30adda88cbd407", + "sha256:ecddf25bee22fe4fe3737a399d0d177d72bc22be6913acfab364b40bce1ba83c", + "sha256:eea6ee1db730b3483adf394ea72f808b6e18cf3cb6454b4d86e04fa8c4327a12", + "sha256:f08ff5e948271dc7e18a35641d2f11a4cd8dfd5634f55228b691e62b37125eb3", + "sha256:f30bf9fd9be89ecb2360c7d94a711f00c09b976258846efe40db3d05828e8089", + "sha256:fa88b843d6e211393a37219e6a1c1df99d35e8fd90446f1118f4216e307e48cd", + "sha256:fc54db6c8593ef7d4b2a331b58653356cf04f67c960f584edb7c3d8c97e8f39e", + "sha256:fd4ec41f914fa74ad1b8304bbc634b3de73d2a0889bd32076342a573e0779e00", + "sha256:ffc9202a29ab3920fa812879e95a9e78b2465fd10be7fcbd042899695d75e616" + ], + "markers": "python_version >= '3.7'", + "version": "==3.4.1" }, "click": { "hashes": [ @@ -780,7 +767,7 @@ "sha256:37dd54208da7e1cd875388217d5e00ebd4179249f90fb72437e91a35459a0ad3", "sha256:a8b2bc7bffae282281c8140a97d3aa9c14da0b136dfe83f850eea9a5f7470427" ], - "markers": "python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2'", + "markers": "python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3'", "version": "==2.9.0.post0" }, "python-slugify": { @@ -994,7 +981,7 @@ "sha256:4721f391ed90541fddacab5acf947aa0d3dc7d27b2e1e8eda2be8970586c3274", "sha256:ff70335d468e7eb6ec65b95b99d3a2836546063f63acc5171de367e834932a81" ], - "markers": "python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2'", + "markers": "python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3'", "version": "==1.17.0" }, "snowplow-tracker": { diff --git a/dbt_subprojects/daily_spellbook/README.md b/dbt_subprojects/daily_spellbook/README.md index 284f462bfd6..ed24c86402d 100644 --- a/dbt_subprojects/daily_spellbook/README.md +++ b/dbt_subprojects/daily_spellbook/README.md @@ -1,3 +1,3 @@ ## Daily Spellbook -This is a DBT sub project for the the main models of Spellbook that runs on a daily candence. +This is a DBT sub project for the main models of Spellbook that runs on a daily cadence. diff --git a/dbt_subprojects/daily_spellbook/macros/project/yield_yak/yield_yak_strategies.sql b/dbt_subprojects/daily_spellbook/macros/project/yield_yak/yield_yak_strategies.sql index 677d70269d8..cb58bcc6c86 100644 --- a/dbt_subprojects/daily_spellbook/macros/project/yield_yak/yield_yak_strategies.sql +++ b/dbt_subprojects/daily_spellbook/macros/project/yield_yak/yield_yak_strategies.sql @@ -107,6 +107,7 @@ 'PenguinStrategyForLPb', 'PlatypusStrategy', 'SonicStrategyForSA', + 'StableJackStrategy', 'StableVaultStrategyForS3D', 'StableVaultStrategyForS3F', 'StargateStrategyForLP', @@ -115,6 +116,7 @@ 'StormStrategyForSA', 'SuStrategyV2', 'SynapseStrategy', + 'TokenMillStrategy', 'UnipoolStrategyV1', 'UspPlatypusStrategy', 'Vault', diff --git a/dbt_subprojects/daily_spellbook/macros/project/yield_yak/yield_yak_user_yrt_balances.sql b/dbt_subprojects/daily_spellbook/macros/project/yield_yak/yield_yak_user_yrt_balances.sql index b9e4ed15e26..faf1f236a10 100644 --- a/dbt_subprojects/daily_spellbook/macros/project/yield_yak/yield_yak_user_yrt_balances.sql +++ b/dbt_subprojects/daily_spellbook/macros/project/yield_yak/yield_yak_user_yrt_balances.sql @@ -31,6 +31,13 @@ existing_contracts AS ( {% endif -%} new_transfers AS ( + SELECT + s.contract_address + , s.block_time + , s.block_number + , s.user_address + , s.net_transfer_amount + FROM ( {%- for strategy in yield_yak_strategies(blockchain) %} SELECT s.contract_address @@ -40,19 +47,8 @@ new_transfers AS ( , SUM(u.net_transfer_amount) AS net_transfer_amount FROM {{ source(namespace_blockchain, strategy + '_evt_Transfer') }} s CROSS JOIN UNNEST(ARRAY[s."from", s.to], ARRAY[-1 * CAST(s.value AS INT256), CAST(s.value AS INT256)]) AS u(user_address, net_transfer_amount) - {%- if is_incremental() %} - LEFT JOIN existing_contracts c - ON c.contract_address = s.contract_address - WHERE - (({{ incremental_predicate('s.evt_block_time') }} - AND s.evt_block_time > c.max_from_time) - OR c.contract_address IS NULL) -- This line allows for new contract_addresses being appended that were not already included in previous runs but also allows their entire historical data to be loaded - AND s."from" != s."to" - {%- endif %} - {%- if not is_incremental() %} WHERE s."from" != s."to" - {%- endif %} GROUP BY s.contract_address , s.evt_block_time @@ -63,6 +59,15 @@ new_transfers AS ( UNION ALL {%- endif -%} {%- endfor %} + ) s + {%- if is_incremental() %} + LEFT JOIN existing_contracts c + ON c.contract_address = s.contract_address + WHERE + ({{ incremental_predicate('s.block_time') }} + AND s.block_time > c.max_from_time) + OR c.contract_address IS NULL -- This line allows for new contract_addresses being appended that were not already included in previous runs but also allows their entire historical data to be loaded + {%- endif %} ), combined_table AS ( diff --git a/dbt_subprojects/daily_spellbook/models/_sector/alm/README.md b/dbt_subprojects/daily_spellbook/models/_sector/alm/README.md index cd518f1c77c..dfd2a73445f 100644 --- a/dbt_subprojects/daily_spellbook/models/_sector/alm/README.md +++ b/dbt_subprojects/daily_spellbook/models/_sector/alm/README.md @@ -41,7 +41,7 @@ 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. +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/dbt_subprojects/dex/models/trades/readme.md) 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. diff --git a/dbt_subprojects/daily_spellbook/models/_sector/labels/addresses/__single_category_labels__/balancer_v2/labels_balancer_v2_gauges.sql b/dbt_subprojects/daily_spellbook/models/_sector/labels/addresses/__single_category_labels__/balancer/labels_balancer_gauges.sql similarity index 64% rename from dbt_subprojects/daily_spellbook/models/_sector/labels/addresses/__single_category_labels__/balancer_v2/labels_balancer_v2_gauges.sql rename to dbt_subprojects/daily_spellbook/models/_sector/labels/addresses/__single_category_labels__/balancer/labels_balancer_gauges.sql index cf8e359cbde..92b41dc3d1a 100644 --- a/dbt_subprojects/daily_spellbook/models/_sector/labels/addresses/__single_category_labels__/balancer_v2/labels_balancer_v2_gauges.sql +++ b/dbt_subprojects/daily_spellbook/models/_sector/labels/addresses/__single_category_labels__/balancer/labels_balancer_gauges.sql @@ -1,20 +1,19 @@ {{config( - - alias = 'balancer_v2_gauges', + alias = 'balancer_gauges', post_hook='{{ expose_spells(\'["ethereum", "arbitrum", "optimism", "polygon", "avalanche_c", "base", "gnosis", "zkevm"]\', "sector", "labels", \'["jacektrocinski", "viniabussafi"]\') }}')}} {% set gauges_models = [ - ref('labels_balancer_v2_gauges_ethereum') - , ref('labels_balancer_v2_gauges_polygon') - , ref('labels_balancer_v2_gauges_arbitrum') - , ref('labels_balancer_v2_gauges_optimism') - , ref('labels_balancer_v2_gauges_avalanche_c') - , ref('labels_balancer_v2_gauges_base') - , ref('labels_balancer_v2_gauges_gnosis') - , ref('labels_balancer_v2_gauges_zkevm') + ref('labels_balancer_gauges_ethereum') + , ref('labels_balancer_gauges_polygon') + , ref('labels_balancer_gauges_arbitrum') + , ref('labels_balancer_gauges_optimism') + , ref('labels_balancer_gauges_avalanche_c') + , ref('labels_balancer_gauges_base') + , ref('labels_balancer_gauges_gnosis') + , ref('labels_balancer_gauges_zkevm') ] %} SELECT * diff --git a/dbt_subprojects/daily_spellbook/models/_sector/labels/addresses/__single_category_labels__/balancer_v2/labels_balancer_v2_gauges_arbitrum.sql b/dbt_subprojects/daily_spellbook/models/_sector/labels/addresses/__single_category_labels__/balancer/labels_balancer_gauges_arbitrum.sql similarity index 62% rename from dbt_subprojects/daily_spellbook/models/_sector/labels/addresses/__single_category_labels__/balancer_v2/labels_balancer_v2_gauges_arbitrum.sql rename to dbt_subprojects/daily_spellbook/models/_sector/labels/addresses/__single_category_labels__/balancer/labels_balancer_gauges_arbitrum.sql index 9319de28db5..81c7aa8e797 100644 --- a/dbt_subprojects/daily_spellbook/models/_sector/labels/addresses/__single_category_labels__/balancer_v2/labels_balancer_v2_gauges_arbitrum.sql +++ b/dbt_subprojects/daily_spellbook/models/_sector/labels/addresses/__single_category_labels__/balancer/labels_balancer_gauges_arbitrum.sql @@ -1,6 +1,5 @@ {{config( - - alias = 'balancer_v2_gauges_arbitrum', + alias = 'balancer_gauges_arbitrum', post_hook='{{ expose_spells(\'["arbitrum"]\', "sector", "labels", @@ -13,12 +12,12 @@ SELECT distinct pools.address AS pool_address, streamer.gauge AS child_gauge_address, 'arb:' || pools.name AS name, - 'balancer_v2_gauges' AS category, + 'balancer_gauges' AS category, 'balancerlabs' AS contributor, 'query' AS source, TIMESTAMP '2022-01-13' AS created_at, NOW() AS updated_at, - 'balancer_v2_gauges_arbitrum' AS model_name, + 'balancer_gauges_arbitrum' AS model_name, 'identifier' AS label_type FROM {{ source('balancer_ethereum', 'ArbitrumRootGaugeFactory_evt_ArbitrumRootGaugeCreated') }} gauge @@ -34,12 +33,12 @@ SELECT distinct pools.address AS pool_address, streamer.gauge AS child_gauge_address, 'arb:' || pools.name AS name, - 'balancer_v2_gauges' AS category, + 'balancer_gauges' AS category, 'balancerlabs' AS contributor, 'query' AS source, TIMESTAMP '2022-01-13' AS created_at, NOW() AS updated_at, - 'balancer_v2_gauges_arbitrum' AS model_name, + 'balancer_gauges_arbitrum' AS model_name, 'identifier' AS label_type FROM {{ source('balancer_ethereum', 'CappedArbitrumRootGaugeFactory_evt_GaugeCreated') }} gauge @@ -55,46 +54,86 @@ SELECT distinct pools.address AS pool_address, child.output_0 AS child_gauge_address, 'arb:' || pools.name AS name, - 'balancer_v2_gauges' AS category, + 'balancer_gauges' AS category, 'balancerlabs' AS contributor, 'query' AS source, TIMESTAMP '2022-01-13' AS created_at, NOW() AS updated_at, - 'balancer_v2_gauges_arbitrum' AS model_name, + 'balancer_gauges_arbitrum' AS model_name, '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 {{ source('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), + SELECT + * + FROM reward_gauges + WHERE name IS NOT NULL + + UNION ALL -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 + * + FROM child_gauges + WHERE name IS NOT NULL), + +kill_unkill_1 AS( + SELECT + contract_address, + call_block_time, + 'kill' AS action + FROM {{ source('balancer_ethereum', 'ArbitrumRootGauge_call_killGauge') }} + WHERE call_success + + UNION ALL + + SELECT + contract_address, + call_block_time, + 'kill' AS action + FROM {{ source('balancer_ethereum', 'CappedArbitrumRootGauge_call_killGauge') }} + WHERE call_success + + UNION ALL + + SELECT + contract_address, + call_block_time, + 'unkill' AS action + FROM {{ source('balancer_ethereum', 'ArbitrumRootGauge_call_initialize') }} + WHERE call_success + + UNION ALL SELECT + contract_address, + call_block_time, + 'unkill' AS action + FROM {{ source('balancer_ethereum', 'CappedArbitrumRootGauge_call_initialize') }} + WHERE call_success +), + +kill_unkill AS( + SELECT + contract_address, + call_block_time, + action, + ROW_NUMBER() OVER(PARTITION BY contract_address ORDER BY call_block_time DESC) AS rn + FROM kill_unkill_1 +) + SELECT DISTINCT g.blockchain , g.address , g.pool_address , g.child_gauge_address , g.name - , CASE WHEN c.rn = 1 + , CASE WHEN k.action = 'kill' + THEN 'inactive' + WHEN k.action = 'unkill' THEN 'active' - ELSE 'inactive' - END AS status + ELSE 'active' + END AS status , g.category , g.contributor , g.source @@ -103,4 +142,4 @@ INNER JOIN gauges g ON g.address = c.addr , g.model_name , g.label_type FROM gauges g - INNER JOIN controller c ON g.address = c.address \ No newline at end of file + LEFT JOIN kill_unkill k ON g.address = k.contract_address AND k.rn = 1 \ No newline at end of file diff --git a/dbt_subprojects/daily_spellbook/models/_sector/labels/addresses/__single_category_labels__/balancer_v2/labels_balancer_v2_gauges_avalanche_c.sql b/dbt_subprojects/daily_spellbook/models/_sector/labels/addresses/__single_category_labels__/balancer/labels_balancer_gauges_avalanche_c.sql similarity index 55% rename from dbt_subprojects/daily_spellbook/models/_sector/labels/addresses/__single_category_labels__/balancer_v2/labels_balancer_v2_gauges_avalanche_c.sql rename to dbt_subprojects/daily_spellbook/models/_sector/labels/addresses/__single_category_labels__/balancer/labels_balancer_gauges_avalanche_c.sql index 080d9e04325..58c35cd9bca 100644 --- a/dbt_subprojects/daily_spellbook/models/_sector/labels/addresses/__single_category_labels__/balancer_v2/labels_balancer_v2_gauges_avalanche_c.sql +++ b/dbt_subprojects/daily_spellbook/models/_sector/labels/addresses/__single_category_labels__/balancer/labels_balancer_gauges_avalanche_c.sql @@ -1,6 +1,5 @@ {{config( - - alias = 'balancer_v2_gauges_avalanche_c', + alias = 'balancer_gauges_avalanche_c', post_hook='{{ expose_spells(\'["avalanche_c"]\', "sector", "labels", @@ -13,39 +12,56 @@ SELECT distinct pools.address AS pool_address, child.output_0 AS child_gauge_address, 'ava:' || pools.name AS name, - 'balancer_v2_gauges' AS category, + 'balancer_gauges' AS category, 'balancerlabs' AS contributor, 'query' AS source, TIMESTAMP '2022-01-13' AS created_at, NOW() AS updated_at, - 'balancer_v2_gauges_avalanche_c' AS model_name, + 'balancer_gauges_avalanche_c' AS model_name, '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 {{ source('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 -) +kill_unkill_1 AS( + SELECT + contract_address, + call_block_time, + 'kill' AS action + FROM {{ source('balancer_ethereum', 'AvalancheRootGauge_call_killGauge') }} + WHERE call_success + + UNION ALL SELECT + contract_address, + call_block_time, + 'unkill' AS action + FROM {{ source('balancer_ethereum', 'AvalancheRootGauge_call_initialize') }} + WHERE call_success +), + +kill_unkill AS( + SELECT + contract_address, + call_block_time, + action, + ROW_NUMBER() OVER(PARTITION BY contract_address ORDER BY call_block_time DESC) AS rn + FROM kill_unkill_1 +) + + SELECT DISTINCT g.blockchain , g.address , g.pool_address , g.child_gauge_address , g.name - , CASE WHEN c.rn = 1 + , CASE WHEN k.action = 'kill' + THEN 'inactive' + WHEN k.action = 'unkill' THEN 'active' - ELSE 'inactive' - END AS status + ELSE 'active' + END AS status , g.category , g.contributor , g.source @@ -54,4 +70,4 @@ INNER JOIN gauges g ON g.address = c.addr , g.model_name , g.label_type FROM gauges g - INNER JOIN controller c ON g.address = c.address + LEFT JOIN kill_unkill k ON g.address = k.contract_address AND k.rn = 1 \ No newline at end of file diff --git a/dbt_subprojects/daily_spellbook/models/_sector/labels/addresses/__single_category_labels__/balancer_v2/labels_balancer_v2_gauges_base.sql b/dbt_subprojects/daily_spellbook/models/_sector/labels/addresses/__single_category_labels__/balancer/labels_balancer_gauges_base.sql similarity index 55% rename from dbt_subprojects/daily_spellbook/models/_sector/labels/addresses/__single_category_labels__/balancer_v2/labels_balancer_v2_gauges_base.sql rename to dbt_subprojects/daily_spellbook/models/_sector/labels/addresses/__single_category_labels__/balancer/labels_balancer_gauges_base.sql index f93f6b89499..b2351de27e5 100644 --- a/dbt_subprojects/daily_spellbook/models/_sector/labels/addresses/__single_category_labels__/balancer_v2/labels_balancer_v2_gauges_base.sql +++ b/dbt_subprojects/daily_spellbook/models/_sector/labels/addresses/__single_category_labels__/balancer/labels_balancer_gauges_base.sql @@ -1,6 +1,5 @@ {{config( - - alias = 'balancer_v2_gauges_base', + alias = 'balancer_gauges_base', post_hook='{{ expose_spells(\'["base"]\', "sector", "labels", @@ -13,39 +12,56 @@ SELECT distinct pools.address AS pool_address, child.output_0 AS child_gauge_address, 'base:' || pools.name AS name, - 'balancer_v2_gauges' AS category, + 'balancer_gauges' AS category, 'balancerlabs' AS contributor, 'query' AS source, TIMESTAMP '2022-01-13' AS created_at, NOW() AS updated_at, - 'balancer_v2_gauges_base' AS model_name, + 'balancer_gauges_base' AS model_name, '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 {{ source('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 -) +kill_unkill_1 AS( + SELECT + contract_address, + call_block_time, + 'kill' AS action + FROM {{ source('balancer_ethereum', 'BaseRootGauge_call_killGauge') }} + WHERE call_success + + UNION ALL SELECT + contract_address, + call_block_time, + 'unkill' AS action + FROM {{ source('balancer_ethereum', 'BaseRootGauge_call_initialize') }} + WHERE call_success +), + +kill_unkill AS( + SELECT + contract_address, + call_block_time, + action, + ROW_NUMBER() OVER(PARTITION BY contract_address ORDER BY call_block_time DESC) AS rn + FROM kill_unkill_1 +) + + SELECT DISTINCT g.blockchain , g.address , g.pool_address , g.child_gauge_address , g.name - , CASE WHEN c.rn = 1 + , CASE WHEN k.action = 'kill' + THEN 'inactive' + WHEN k.action = 'unkill' THEN 'active' - ELSE 'inactive' - END AS status + ELSE 'active' + END AS status , g.category , g.contributor , g.source @@ -54,4 +70,4 @@ INNER JOIN gauges g ON g.address = c.addr , g.model_name , g.label_type FROM gauges g - INNER JOIN controller c ON g.address = c.address + LEFT JOIN kill_unkill k ON g.address = k.contract_address AND k.rn = 1 \ No newline at end of file diff --git a/dbt_subprojects/daily_spellbook/models/_sector/labels/addresses/__single_category_labels__/balancer/labels_balancer_gauges_ethereum.sql b/dbt_subprojects/daily_spellbook/models/_sector/labels/addresses/__single_category_labels__/balancer/labels_balancer_gauges_ethereum.sql new file mode 100644 index 00000000000..630ecc963cb --- /dev/null +++ b/dbt_subprojects/daily_spellbook/models/_sector/labels/addresses/__single_category_labels__/balancer/labels_balancer_gauges_ethereum.sql @@ -0,0 +1,141 @@ +{{config( + alias = 'balancer_gauges_ethereum', + post_hook='{{ expose_spells(\'["ethereum"]\', + "sector", + "labels", + \'["jacektrocinski", "viniabussafi"]\') }}')}} + +WITH gauges AS( +SELECT + 'ethereum' AS blockchain, + gauge AS address, + COALESCE(v2pools.address, v3pools.address) AS pool_address, + CAST(NULL AS VARBINARY) AS child_gauge_address, + 'eth:' || COALESCE(v2pools.name, v3pools.name) AS name, + 'balancer_gauges' AS category, + 'balancerlabs' AS contributor, + 'query' AS source, + TIMESTAMP '2022-01-13' AS created_at, + NOW() AS updated_at, + 'balancer_gauges_ethereum' AS model_name, + 'identifier' AS label_type +FROM + {{ source('balancer_ethereum', 'LiquidityGaugeFactory_evt_GaugeCreated') }} gauge + LEFT JOIN {{ source('labels', 'balancer_v2_pools_ethereum') }} v2pools ON v2pools.address = gauge.pool + LEFT JOIN {{ source('labels', 'balancer_v3_pools_ethereum') }} v3pools ON v3pools.address = gauge.pool + +UNION ALL + +SELECT + 'ethereum' AS blockchain, + gauge AS address, + COALESCE(v2pools.address, v3pools.address) AS pool_address, + CAST(NULL AS VARBINARY) AS child_gauge_address, + 'eth:' || COALESCE(v2pools.name, v3pools.name) AS name, + 'balancer_gauges' AS category, + 'balancerlabs' AS contributor, + 'query' AS source, + TIMESTAMP '2022-01-13' AS created_at, + NOW() AS updated_at, + 'balancer_gauges_ethereum' AS model_name, + 'identifier' AS label_type +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 {{ source('labels', 'balancer_v2_pools_ethereum') }} v2pools ON v2pools.address = call.pool + LEFT JOIN {{ source('labels', 'balancer_v3_pools_ethereum') }} v3pools ON v3pools.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_gauges' AS category, + 'balancerlabs' AS contributor, + 'query' AS source, + TIMESTAMP '2022-01-13' AS created_at, + NOW() AS updated_at, + 'balancer_gauges_ethereum' AS model_name, + 'identifier' AS label_type +FROM + {{ source('balancer','single_recipient_gauges') }} +WHERE + blockchain = 'ethereum'), + +kill_unkill_1 AS( + SELECT + contract_address, + call_block_time, + 'kill' AS action + FROM {{ source('balancer_ethereum', 'LiquidityGauge_call_killGauge') }} + WHERE call_success + + UNION ALL + + SELECT + contract_address, + call_block_time, + 'kill' AS action + FROM {{ source('balancer_ethereum', 'LiquidityGaugeV5_call_killGauge') }} + WHERE call_success + + UNION ALL + + SELECT + contract_address, + call_block_time, + 'unkill' AS action + FROM {{ source('balancer_ethereum', 'LiquidityGauge_call_initialize') }} + WHERE call_success + + UNION ALL + + SELECT + contract_address, + call_block_time, + 'unkill' AS action + FROM {{ source('balancer_ethereum', 'LiquidityGaugeV5_call_initialize') }} + WHERE call_success + + UNION ALL + + SELECT + contract_address, + call_block_time, + 'unkill' AS action + FROM {{ source('balancer_ethereum', 'CappedLiquidityGaugeV5_call_initialize') }} + WHERE call_success +), + +kill_unkill AS( + SELECT + contract_address, + call_block_time, + action, + ROW_NUMBER() OVER(PARTITION BY contract_address ORDER BY call_block_time DESC) AS rn + FROM kill_unkill_1 +) + SELECT DISTINCT + g.blockchain + , g.address + , g.pool_address + , g.child_gauge_address + , g.name + , CASE WHEN k.action = 'kill' + THEN 'inactive' + WHEN k.action = 'unkill' + THEN 'active' + ELSE 'active' + END AS status + , g.category + , g.contributor + , g.source + , g.created_at + , g.updated_at + , g.model_name + , g.label_type + FROM gauges g + LEFT JOIN kill_unkill k ON g.address = k.contract_address AND k.rn = 1 \ No newline at end of file diff --git a/dbt_subprojects/daily_spellbook/models/_sector/labels/addresses/__single_category_labels__/balancer/labels_balancer_gauges_gnosis.sql b/dbt_subprojects/daily_spellbook/models/_sector/labels/addresses/__single_category_labels__/balancer/labels_balancer_gauges_gnosis.sql new file mode 100644 index 00000000000..430428b731b --- /dev/null +++ b/dbt_subprojects/daily_spellbook/models/_sector/labels/addresses/__single_category_labels__/balancer/labels_balancer_gauges_gnosis.sql @@ -0,0 +1,74 @@ +{{config( + alias = 'balancer_gauges_gnosis', + post_hook='{{ expose_spells(\'["gnosis"]\', + "sector", + "labels", + \'["viniabussafi"]\') }}')}} + +WITH gauges AS( +SELECT distinct + 'gnosis' AS blockchain, + call.output_0 AS address, + COALESCE(v2pools.address, v3pools.address) AS pool_address, + child.output_0 AS child_gauge_address, + 'gno:' || COALESCE(v2pools.name, v3pools.name) AS name, + 'balancer_gauges' AS category, + 'balancerlabs' AS contributor, + 'query' AS source, + TIMESTAMP '2022-01-13' AS created_at, + NOW() AS updated_at, + 'balancer_gauges_gnosis' AS model_name, + '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 {{ source('labels', 'balancer_v2_pools_gnosis') }} v2pools ON v2pools.address = child.pool + LEFT JOIN {{ source('labels', 'balancer_v3_pools_gnosis') }} v3pools ON v3pools.address = child.pool), + +kill_unkill_1 AS( + SELECT + contract_address, + call_block_time, + 'kill' AS action + FROM {{ source('balancer_ethereum', 'GnosisRootGauge_call_killGauge') }} + WHERE call_success + + UNION ALL + + SELECT + contract_address, + call_block_time, + 'unkill' AS action + FROM {{ source('balancer_ethereum', 'GnosisRootGauge_call_initialize') }} + WHERE call_success +), + +kill_unkill AS( + SELECT + contract_address, + call_block_time, + action, + ROW_NUMBER() OVER(PARTITION BY contract_address ORDER BY call_block_time DESC) AS rn + FROM kill_unkill_1 +) + + SELECT DISTINCT + g.blockchain + , g.address + , g.pool_address + , g.child_gauge_address + , g.name + , CASE WHEN k.action = 'kill' + THEN 'inactive' + WHEN k.action = 'unkill' + THEN 'active' + ELSE 'active' + END AS status + , g.category + , g.contributor + , g.source + , g.created_at + , g.updated_at + , g.model_name + , g.label_type + FROM gauges g + LEFT JOIN kill_unkill k ON g.address = k.contract_address AND k.rn = 1 \ No newline at end of file diff --git a/dbt_subprojects/daily_spellbook/models/_sector/labels/addresses/__single_category_labels__/balancer_v2/labels_balancer_v2_gauges_optimism.sql b/dbt_subprojects/daily_spellbook/models/_sector/labels/addresses/__single_category_labels__/balancer/labels_balancer_gauges_optimism.sql similarity index 62% rename from dbt_subprojects/daily_spellbook/models/_sector/labels/addresses/__single_category_labels__/balancer_v2/labels_balancer_v2_gauges_optimism.sql rename to dbt_subprojects/daily_spellbook/models/_sector/labels/addresses/__single_category_labels__/balancer/labels_balancer_gauges_optimism.sql index 774f14f2c17..b8240a95a64 100644 --- a/dbt_subprojects/daily_spellbook/models/_sector/labels/addresses/__single_category_labels__/balancer_v2/labels_balancer_v2_gauges_optimism.sql +++ b/dbt_subprojects/daily_spellbook/models/_sector/labels/addresses/__single_category_labels__/balancer/labels_balancer_gauges_optimism.sql @@ -1,6 +1,5 @@ {{config( - - alias = 'balancer_v2_gauges_optimism', + alias = 'balancer_gauges_optimism', post_hook='{{ expose_spells(\'["optimism"]\', "sector", "labels", @@ -13,12 +12,12 @@ SELECT pools.address AS pool_address, streamer.gauge AS child_gauge_address, 'op:' || pools.name AS name, - 'balancer_v2_gauges' AS category, + 'balancer_gauges' AS category, 'balancerlabs' AS contributor, 'query' AS source, TIMESTAMP '2022-01-13' AS created_at, NOW() AS updated_at, - 'balancer_v2_gauges_optimism' AS model_name, + 'balancer_gauges_optimism' AS model_name, 'identifier' AS label_type FROM {{ source('balancer_ethereum', 'OptimismRootGaugeFactory_evt_OptimismRootGaugeCreated') }} gauge @@ -33,12 +32,12 @@ SELECT pools.address AS pool_address, streamer.gauge AS child_gauge_address, 'op:' || pools.name AS name, - 'balancer_v2_gauges' AS category, + 'balancer_gauges' AS category, 'balancerlabs' AS contributor, 'query' AS source, TIMESTAMP '2022-01-13' AS created_at, NOW() AS updated_at, - 'balancer_v2_gauges_optimism' AS model_name, + 'balancer_gauges_optimism' AS model_name, 'identifier' AS label_type FROM {{ source('balancer_ethereum', 'CappedOptimismRootGaugeFactory_evt_GaugeCreated') }} gauge @@ -53,46 +52,86 @@ SELECT distinct pools.address AS pool_address, child.output_0 AS child_gauge_address, 'opt:' || pools.name AS name, - 'balancer_v2_gauges' AS category, + 'balancer_gauges' AS category, 'balancerlabs' AS contributor, 'query' AS source, TIMESTAMP '2022-01-13' AS created_at, NOW() AS updated_at, - 'balancer_v2_gauges_optimism' AS model_name, + 'balancer_gauges_optimism' AS model_name, '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 {{ source('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), + SELECT + * + FROM reward_gauges + WHERE name IS NOT NULL + + UNION ALL -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 + * + FROM child_gauges + WHERE name IS NOT NULL), + +kill_unkill_1 AS( + SELECT + contract_address, + call_block_time, + 'kill' AS action + FROM {{ source('balancer_ethereum', 'OptimismRootGauge_call_killGauge') }} + WHERE call_success + + UNION ALL SELECT + contract_address, + call_block_time, + 'kill' AS action + FROM {{ source('balancer_ethereum', 'CappedOptimismRootGauge_call_killGauge') }} + WHERE call_success + + UNION ALL + + SELECT + contract_address, + call_block_time, + 'unkill' AS action + FROM {{ source('balancer_ethereum', 'OptimismRootGauge_call_initialize') }} + WHERE call_success + + UNION ALL + + SELECT + contract_address, + call_block_time, + 'unkill' AS action + FROM {{ source('balancer_ethereum', 'CappedOptimismRootGauge_call_initialize') }} + WHERE call_success +), + +kill_unkill AS( + SELECT + contract_address, + call_block_time, + action, + ROW_NUMBER() OVER(PARTITION BY contract_address ORDER BY call_block_time DESC) AS rn + FROM kill_unkill_1 +) + SELECT DISTINCT g.blockchain , g.address , g.pool_address , g.child_gauge_address , g.name - , CASE WHEN c.rn = 1 + , CASE WHEN k.action = 'kill' + THEN 'inactive' + WHEN k.action = 'unkill' THEN 'active' - ELSE 'inactive' - END AS status + ELSE 'active' + END AS status , g.category , g.contributor , g.source @@ -101,4 +140,4 @@ INNER JOIN gauges g ON g.address = c.addr , g.model_name , g.label_type FROM gauges g - INNER JOIN controller c ON g.address = c.address \ No newline at end of file + LEFT JOIN kill_unkill k ON g.address = k.contract_address AND k.rn = 1 \ No newline at end of file diff --git a/dbt_subprojects/daily_spellbook/models/_sector/labels/addresses/__single_category_labels__/balancer_v2/labels_balancer_v2_gauges_polygon.sql b/dbt_subprojects/daily_spellbook/models/_sector/labels/addresses/__single_category_labels__/balancer/labels_balancer_gauges_polygon.sql similarity index 62% rename from dbt_subprojects/daily_spellbook/models/_sector/labels/addresses/__single_category_labels__/balancer_v2/labels_balancer_v2_gauges_polygon.sql rename to dbt_subprojects/daily_spellbook/models/_sector/labels/addresses/__single_category_labels__/balancer/labels_balancer_gauges_polygon.sql index bca23a0c63a..f93587fe2d4 100644 --- a/dbt_subprojects/daily_spellbook/models/_sector/labels/addresses/__single_category_labels__/balancer_v2/labels_balancer_v2_gauges_polygon.sql +++ b/dbt_subprojects/daily_spellbook/models/_sector/labels/addresses/__single_category_labels__/balancer/labels_balancer_gauges_polygon.sql @@ -1,6 +1,5 @@ {{config( - - alias = 'balancer_v2_gauges_polygon', + alias = 'balancer_gauges_polygon', post_hook='{{ expose_spells(\'["polygon"]\', "sector", "labels", @@ -13,12 +12,12 @@ SELECT pools.address AS pool_address, streamer.gauge AS child_gauge_address, 'pol:' || pools.name AS name, - 'balancer_v2_gauges' AS category, + 'balancer_gauges' AS category, 'balancerlabs' AS contributor, 'query' AS source, TIMESTAMP '2022-01-13' AS created_at, NOW() AS updated_at, - 'balancer_v2_gauges_polygon' AS model_name, + 'balancer_gauges_polygon' AS model_name, 'identifier' AS label_type FROM {{ source('balancer_ethereum', 'PolygonRootGaugeFactory_evt_PolygonRootGaugeCreated') }} gauge @@ -33,12 +32,12 @@ SELECT pools.address AS pool_address, streamer.gauge AS child_gauge_address, 'pol:' || pools.name AS name, - 'balancer_v2_gauges' AS category, + 'balancer_gauges' AS category, 'balancerlabs' AS contributor, 'query' AS source, TIMESTAMP '2022-01-13' AS created_at, NOW() AS updated_at, - 'balancer_v2_gauges_polygon' AS model_name, + 'balancer_gauges_polygon' AS model_name, 'identifier' AS label_type FROM {{ source('balancer_ethereum', 'CappedPolygonRootGaugeFactory_evt_GaugeCreated') }} gauge @@ -53,46 +52,86 @@ SELECT distinct pools.address AS pool_address, child.output_0 AS child_gauge_address, 'pol:' || pools.name AS name, - 'balancer_v2_gauges' AS category, + 'balancer_gauges' AS category, 'balancerlabs' AS contributor, 'query' AS source, TIMESTAMP '2022-01-13' AS created_at, NOW() AS updated_at, - 'balancer_v2_gauges_polygon' AS model_name, + 'balancer_gauges_polygon' AS model_name, '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 {{ source('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), + SELECT + * + FROM reward_gauges + WHERE name IS NOT NULL + + UNION ALL -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 + * + FROM child_gauges + WHERE name IS NOT NULL), + +kill_unkill_1 AS( + SELECT + contract_address, + call_block_time, + 'kill' AS action + FROM {{ source('balancer_ethereum', 'PolygonRootGauge_call_killGauge') }} + WHERE call_success + + UNION ALL SELECT + contract_address, + call_block_time, + 'kill' AS action + FROM {{ source('balancer_ethereum', 'CappedPolygonRootGauge_call_killGauge') }} + WHERE call_success + + UNION ALL + + SELECT + contract_address, + call_block_time, + 'unkill' AS action + FROM {{ source('balancer_ethereum', 'PolygonRootGauge_call_initialize') }} + WHERE call_success + + UNION ALL + + SELECT + contract_address, + call_block_time, + 'unkill' AS action + FROM {{ source('balancer_ethereum', 'CappedPolygonRootGauge_call_initialize') }} + WHERE call_success +), + +kill_unkill AS( + SELECT + contract_address, + call_block_time, + action, + ROW_NUMBER() OVER(PARTITION BY contract_address ORDER BY call_block_time DESC) AS rn + FROM kill_unkill_1 +) + SELECT DISTINCT g.blockchain , g.address , g.pool_address , g.child_gauge_address , g.name - , CASE WHEN c.rn = 1 + , CASE WHEN k.action = 'kill' + THEN 'inactive' + WHEN k.action = 'unkill' THEN 'active' - ELSE 'inactive' - END AS status + ELSE 'active' + END AS status , g.category , g.contributor , g.source @@ -101,4 +140,4 @@ INNER JOIN gauges g ON g.address = c.addr , g.model_name , g.label_type FROM gauges g - INNER JOIN controller c ON g.address = c.address \ No newline at end of file + LEFT JOIN kill_unkill k ON g.address = k.contract_address AND k.rn = 1 \ No newline at end of file diff --git a/dbt_subprojects/daily_spellbook/models/_sector/labels/addresses/__single_category_labels__/balancer_v2/labels_balancer_v2_gauges_zkevm.sql b/dbt_subprojects/daily_spellbook/models/_sector/labels/addresses/__single_category_labels__/balancer/labels_balancer_gauges_zkevm.sql similarity index 55% rename from dbt_subprojects/daily_spellbook/models/_sector/labels/addresses/__single_category_labels__/balancer_v2/labels_balancer_v2_gauges_zkevm.sql rename to dbt_subprojects/daily_spellbook/models/_sector/labels/addresses/__single_category_labels__/balancer/labels_balancer_gauges_zkevm.sql index 1e1b946e5ae..c941f81a158 100644 --- a/dbt_subprojects/daily_spellbook/models/_sector/labels/addresses/__single_category_labels__/balancer_v2/labels_balancer_v2_gauges_zkevm.sql +++ b/dbt_subprojects/daily_spellbook/models/_sector/labels/addresses/__single_category_labels__/balancer/labels_balancer_gauges_zkevm.sql @@ -1,5 +1,5 @@ {{config( - alias = 'balancer_v2_gauges_zkevm', + alias = 'balancer_gauges_zkevm', post_hook='{{ expose_spells(\'["zkevm"]\', "sector", "labels", @@ -12,39 +12,56 @@ SELECT distinct pools.address AS pool_address, child.output_0 AS child_gauge_address, 'zk:' || pools.name AS name, - 'balancer_v2_gauges' AS category, + 'balancer_gauges' AS category, 'balancerlabs' AS contributor, 'query' AS source, TIMESTAMP '2022-01-13' AS created_at, NOW() AS updated_at, - 'balancer_v2_gauges_zkevm' AS model_name, + 'balancer_gauges_zkevm' AS model_name, '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 {{ source('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 -) +kill_unkill_1 AS( + SELECT + contract_address, + call_block_time, + 'kill' AS action + FROM {{ source('balancer_ethereum', 'PolygonZkEVMRootGauge_call_killGauge') }} + WHERE call_success + + UNION ALL SELECT + contract_address, + call_block_time, + 'unkill' AS action + FROM {{ source('balancer_ethereum', 'PolygonZkEVMRootGauge_call_initialize') }} + WHERE call_success +), + +kill_unkill AS( + SELECT + contract_address, + call_block_time, + action, + ROW_NUMBER() OVER(PARTITION BY contract_address ORDER BY call_block_time DESC) AS rn + FROM kill_unkill_1 +) + + SELECT DISTINCT g.blockchain , g.address , g.pool_address , g.child_gauge_address , g.name - , CASE WHEN c.rn = 1 + , CASE WHEN k.action = 'kill' + THEN 'inactive' + WHEN k.action = 'unkill' THEN 'active' - ELSE 'inactive' - END AS status + ELSE 'active' + END AS status , g.category , g.contributor , g.source @@ -53,4 +70,4 @@ INNER JOIN gauges g ON g.address = c.addr , g.model_name , g.label_type FROM gauges g - INNER JOIN controller c ON g.address = c.address \ No newline at end of file + LEFT JOIN kill_unkill k ON g.address = k.contract_address AND k.rn = 1 \ No newline at end of file diff --git a/dbt_subprojects/daily_spellbook/models/_sector/labels/addresses/__single_category_labels__/balancer_v2/labels_balancer_v2_schema.yml b/dbt_subprojects/daily_spellbook/models/_sector/labels/addresses/__single_category_labels__/balancer/labels_balancer_schema.yml similarity index 73% rename from dbt_subprojects/daily_spellbook/models/_sector/labels/addresses/__single_category_labels__/balancer_v2/labels_balancer_v2_schema.yml rename to dbt_subprojects/daily_spellbook/models/_sector/labels/addresses/__single_category_labels__/balancer/labels_balancer_schema.yml index 8103fae3ea0..3e7f70b74cb 100644 --- a/dbt_subprojects/daily_spellbook/models/_sector/labels/addresses/__single_category_labels__/balancer_v2/labels_balancer_v2_schema.yml +++ b/dbt_subprojects/daily_spellbook/models/_sector/labels/addresses/__single_category_labels__/balancer/labels_balancer_schema.yml @@ -1,15 +1,20 @@ version: 2 models: - - name: labels_balancer_v2_gauges + - name: labels_balancer_gauges meta: blockchain: ethereum, polygon, optimism, arbitrum, avalanche_c, base, gnosis, zkevm sector: labels - project: balancer_v2 + project: balancer contributors: jacektrocinski, viniabussafi config: tags: ['labels', 'ethereum', 'polygon', 'optimism', 'arbitrum', 'avalanche_c', 'base', 'gnosis', 'zkevm', 'gauges'] - description: 'Balancer v2 gauge labels.' + description: 'Balancer gauge labels.' + data_tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - blockchain + - address columns: - &blockchain name: blockchain @@ -50,19 +55,15 @@ models: name: label_type description: "Type of label (see labels overall readme)" - - name: labels_balancer_v2_gauges_ethereum + - name: labels_balancer_gauges_ethereum meta: blockchain: ethereum sector: labels - project: balancer_v2 + project: balancer contributors: jacektrocinski, viniabussafi config: tags: ['labels', 'ethereum', 'gauges'] - description: 'Balancer v2 gauge labels.' - data_tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - address + description: 'Balancer gauge labels.' columns: - *blockchain - *address @@ -78,19 +79,15 @@ models: - *model_name - *label_type - - name: labels_balancer_v2_gauges_polygon + - name: labels_balancer_gauges_polygon meta: blockchain: polygon sector: labels - project: balancer_v2 + project: balancer contributors: jacektrocinski, viniabussafi config: tags: ['labels', 'polygon', 'gauges'] - description: 'Balancer v2 gauge labels.' - data_tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - address + description: 'Balancer gauge labels.' columns: - *blockchain - *address @@ -106,19 +103,15 @@ models: - *model_name - *label_type - - name: labels_balancer_v2_gauges_arbitrum + - name: labels_balancer_gauges_arbitrum meta: blockchain: arbitrum sector: labels - project: balancer_v2 + project: balancer contributors: jacektrocinski, viniabussafi config: tags: ['labels', 'arbitrum', 'gauges'] - description: 'Balancer v2 gauge labels.' - data_tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - address + description: 'Balancer gauge labels.' columns: - *blockchain - *address @@ -134,19 +127,15 @@ models: - *model_name - *label_type - - name: labels_balancer_v2_gauges_optimism + - name: labels_balancer_gauges_optimism meta: blockchain: optimism sector: labels - project: balancer_v2 + project: balancer contributors: jacektrocinski, viniabussafi config: tags: ['labels', 'optimism', 'gauges'] - description: 'Balancer v2 gauge labels.' - data_tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - address + description: 'Balancer gauge labels.' columns: - *blockchain - *address @@ -162,19 +151,15 @@ models: - *model_name - *label_type - - name: labels_balancer_v2_gauges_avalanche_c + - name: labels_balancer_gauges_avalanche_c meta: blockchain: avalanche_c sector: labels - project: balancer_v2 + project: balancer contributors: viniabussafi config: tags: ['labels', 'avalanche_c', 'gauges'] - description: 'Balancer v2 gauge labels.' - data_tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - address + description: 'Balancer gauge labels.' columns: - *blockchain - *address @@ -190,19 +175,15 @@ models: - *model_name - *label_type - - name: labels_balancer_v2_gauges_base + - name: labels_balancer_gauges_base meta: blockchain: base sector: labels - project: balancer_v2 + project: balancer contributors: viniabussafi config: tags: ['labels', 'base', 'gauges'] - description: 'Balancer v2 gauge labels.' - data_tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - address + description: 'Balancer gauge labels.' columns: - *blockchain - *address @@ -218,19 +199,15 @@ models: - *model_name - *label_type - - name: labels_balancer_v2_gauges_gnosis + - name: labels_balancer_gauges_gnosis meta: blockchain: gnosis sector: labels - project: balancer_v2 + project: balancer contributors: viniabussafi config: tags: ['labels', 'gnosis', 'gauges'] - description: 'Balancer v2 gauge labels.' - data_tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - address + description: 'Balancer gauge labels.' columns: - *blockchain - *address @@ -246,19 +223,15 @@ models: - *model_name - *label_type - - name: labels_balancer_v2_gauges_zkevm + - name: labels_balancer_gauges_zkevm meta: blockchain: zkevm sector: labels - project: balancer_v2 + project: balancer contributors: viniabussafi config: tags: ['labels', 'zkevm', 'gauges'] - description: 'Balancer v2 gauge labels.' - data_tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - address + description: 'Balancer gauge labels.' columns: - *blockchain - *address diff --git a/dbt_subprojects/daily_spellbook/models/_sector/labels/addresses/__single_category_labels__/balancer_v2/labels_balancer_v2_gauges_ethereum.sql b/dbt_subprojects/daily_spellbook/models/_sector/labels/addresses/__single_category_labels__/balancer_v2/labels_balancer_v2_gauges_ethereum.sql deleted file mode 100644 index 07b9abcaf31..00000000000 --- a/dbt_subprojects/daily_spellbook/models/_sector/labels/addresses/__single_category_labels__/balancer_v2/labels_balancer_v2_gauges_ethereum.sql +++ /dev/null @@ -1,97 +0,0 @@ -{{config( - - alias = 'balancer_v2_gauges_ethereum', - post_hook='{{ expose_spells(\'["ethereum"]\', - "sector", - "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, - 'query' AS source, - TIMESTAMP '2022-01-13' AS created_at, - NOW() AS updated_at, - 'balancer_v2_gauges_ethereum' AS model_name, - 'identifier' AS label_type -FROM - {{ source('balancer_ethereum', 'LiquidityGaugeFactory_evt_GaugeCreated') }} gauge - LEFT JOIN {{ source('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, - 'query' AS source, - TIMESTAMP '2022-01-13' AS created_at, - NOW() AS updated_at, - 'balancer_v2_gauges_ethereum' AS model_name, - 'identifier' AS label_type -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 {{ source('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, - 'query' AS source, - TIMESTAMP '2022-01-13' AS created_at, - NOW() AS updated_at, - 'balancer_v2_gauges_ethereum' AS model_name, - 'identifier' AS label_type -FROM - {{ source('balancer','single_recipient_gauges') }} -WHERE - 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/dbt_subprojects/daily_spellbook/models/_sector/labels/addresses/__single_category_labels__/balancer_v2/labels_balancer_v2_gauges_gnosis.sql b/dbt_subprojects/daily_spellbook/models/_sector/labels/addresses/__single_category_labels__/balancer_v2/labels_balancer_v2_gauges_gnosis.sql deleted file mode 100644 index 800e03f266d..00000000000 --- a/dbt_subprojects/daily_spellbook/models/_sector/labels/addresses/__single_category_labels__/balancer_v2/labels_balancer_v2_gauges_gnosis.sql +++ /dev/null @@ -1,57 +0,0 @@ -{{config( - - alias = 'balancer_v2_gauges_gnosis', - post_hook='{{ expose_spells(\'["gnosis"]\', - "sector", - "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, - 'query' AS source, - TIMESTAMP '2022-01-13' AS created_at, - NOW() AS updated_at, - 'balancer_v2_gauges_gnosis' AS model_name, - '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 {{ source('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/dbt_subprojects/daily_spellbook/models/_sector/labels/addresses/__single_category_labels__/beets/labels_beets_pools_sonic.sql b/dbt_subprojects/daily_spellbook/models/_sector/labels/addresses/__single_category_labels__/beets/labels_beets_pools_sonic.sql new file mode 100644 index 00000000000..f1a8903fbcf --- /dev/null +++ b/dbt_subprojects/daily_spellbook/models/_sector/labels/addresses/__single_category_labels__/beets/labels_beets_pools_sonic.sql @@ -0,0 +1,222 @@ +{{config( + alias = 'beets_pools_sonic', + post_hook = '{{ expose_spells(\'["sonic"]\', + "sector", + "labels", + \'["viniabussafi"]\') }}' +)}} + +WITH v2_pools AS( + WITH pools AS ( + 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_v2_sonic', 'Vault_evt_PoolRegistered') }} c + INNER JOIN {{ source('beethoven_x_v2_sonic', 'WeightedPoolFactory_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 AS token_address, + 0 AS normalized_weight, + cc.symbol, + 'stable' AS pool_type, + cc.name AS pool_name + FROM {{ source('beethoven_x_v2_sonic', 'Vault_evt_PoolRegistered') }} c + INNER JOIN {{ source('beethoven_x_v2_sonic', '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) +), + +settings AS ( + SELECT + pool_id, + coalesce(t.symbol, '?') AS token_symbol, + normalized_weight, + p.symbol AS pool_symbol, + p.pool_type, + p.pool_name + FROM pools p + LEFT JOIN {{ source('tokens', 'erc20') }} t ON p.token_address = t.contract_address + AND t.blockchain = 'sonic' +) + +SELECT + 'sonic' AS blockchain, + bytearray_substring(pool_id, 1, 20) AS address, + CASE WHEN pool_type IN ('stable') + 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), '/'))) + END AS name, + pool_name AS poolname, + pool_type, + '2' AS version, + 'beets_v2_pool' AS category, + 'beets' AS contributor, + 'query' AS source, + TIMESTAMP'2024-12-15 00:00' AS created_at, + now() AS updated_at, + 'beets_pools_sonic' AS model_name, + 'identifier' AS label_type +FROM ( + SELECT + s1.pool_id, + token_symbol, + pool_symbol, + cast(100 * normalized_weight AS integer) AS norm_weight, + pool_type, + pool_name + FROM settings s1 + GROUP BY s1.pool_id, token_symbol, pool_symbol, normalized_weight, pool_type, pool_name +) s +GROUP BY pool_id, pool_symbol, pool_type, pool_name +ORDER BY 1), + +v3_pools AS( + WITH token_data AS ( + SELECT + pool, + ARRAY_AGG(FROM_HEX(json_extract_scalar(token, '$.token')) ORDER BY token_index) AS tokens + FROM ( + SELECT + pool, + tokenConfig, + SEQUENCE(1, CARDINALITY(tokenConfig)) AS token_index_array + FROM {{ source('beethoven_x_v3_sonic', 'Vault_evt_PoolRegistered') }} + ) AS pool_data + CROSS JOIN UNNEST(tokenConfig, token_index_array) AS t(token, token_index) + GROUP BY 1 + ), + + pools AS ( + SELECT + pool_id, + zip.tokens AS token_address, + zip.weights / POWER(10, 18) AS normalized_weight, + symbol, + pool_type + FROM ( + SELECT + c.pool AS pool_id, + t.tokens, + w.weights, + cc.symbol, + 'weighted' AS pool_type + FROM token_data c + INNER JOIN {{ source('beethoven_x_v3_sonic', 'WeightedPoolFactory_call_create') }} cc + ON c.pool = cc.output_pool + CROSS JOIN UNNEST(c.tokens) WITH ORDINALITY t(tokens, pos) + CROSS JOIN UNNEST(cc.normalizedWeights) WITH ORDINALITY w(weights, pos) + WHERE t.pos = w.pos + + UNION ALL + + SELECT + c.pool AS pool_id, + t.tokens, + 0 AS weights, + cc.symbol, + 'stable' AS pool_type + FROM token_data c + INNER JOIN {{ source('beethoven_x_v3_sonic', 'StablePoolFactory_call_create') }} cc + ON c.pool = cc.output_pool + CROSS JOIN UNNEST(c.tokens) AS t(tokens) + ) zip + ), + + settings AS ( + SELECT + pool_id, + coalesce(t.symbol, '?') AS token_symbol, + normalized_weight, + p.symbol AS pool_symbol, + p.pool_type + FROM pools p + LEFT JOIN {{ source('tokens', 'erc20') }} t ON p.token_address = t.contract_address + AND t.blockchain = 'sonic' + ) + +SELECT + 'sonic' AS blockchain, + bytearray_substring(pool_id, 1, 20) AS address, + CASE WHEN pool_type IN ('stable') + 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), '/'))) + END AS name, + pool_type, + '3' AS version, + 'beets_v3_pool' AS category, + 'beets' AS contributor, + 'query' AS source, + TIMESTAMP'2024-12-15 00:00' AS created_at, + now() AS updated_at, + 'beets_pools_sonic' AS model_name, + 'identifier' AS label_type +FROM ( + SELECT + s1.pool_id, + token_symbol, + pool_symbol, + cast(100 * normalized_weight AS integer) AS norm_weight, + pool_type + FROM settings s1 + GROUP BY s1.pool_id, token_symbol, pool_symbol, normalized_weight, pool_type +) s +GROUP BY pool_id, pool_symbol, pool_type +ORDER BY 1 +) + +SELECT + blockchain, + address, + name, + pool_type, + version, + category, + contributor, + source, + created_at, + updated_at, + model_name, + label_type +FROM v2_pools + +UNION + +SELECT + blockchain, + address, + name, + pool_type, + version, + category, + contributor, + source, + created_at, + updated_at, + model_name, + label_type +FROM v3_pools \ No newline at end of file diff --git a/dbt_subprojects/daily_spellbook/models/_sector/labels/addresses/__single_category_labels__/beets/labels_beets_schema.yml b/dbt_subprojects/daily_spellbook/models/_sector/labels/addresses/__single_category_labels__/beets/labels_beets_schema.yml new file mode 100644 index 00000000000..b830022043c --- /dev/null +++ b/dbt_subprojects/daily_spellbook/models/_sector/labels/addresses/__single_category_labels__/beets/labels_beets_schema.yml @@ -0,0 +1,54 @@ +version: 2 + +models: + - name: labels_beets_pools_sonic + meta: + blockchain: sonic + sector: labels + project: beets + contributors: viniabussafi + config: + tags: ['labels', 'fantom', 'balancer', 'pools'] + description: 'Beets liquidity pools created on Sonic.' + data_tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - address + - name + - category + - model_name + - blockchain + 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)' + - &poolname + name: poolname + description: 'Label name of pool set at contract creation' + - &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)" \ No newline at end of file diff --git a/dbt_subprojects/daily_spellbook/models/_sector/labels/labels_addresses.sql b/dbt_subprojects/daily_spellbook/models/_sector/labels/labels_addresses.sql index 3d3047c5079..7eb98fbfc0e 100644 --- a/dbt_subprojects/daily_spellbook/models/_sector/labels/labels_addresses.sql +++ b/dbt_subprojects/daily_spellbook/models/_sector/labels/labels_addresses.sql @@ -16,7 +16,7 @@ , source('labels', 'balancer_v2_pools') , source('labels', 'balancer_v3_pools') , source('labels', 'balancer_cowswap_amm_pools') - , ref('labels_balancer_v2_gauges') + , ref('labels_balancer_gauges') , ref('labels_cex') , ref('labels_contracts') , ref('labels_hackers_ethereum') diff --git a/dbt_subprojects/daily_spellbook/models/_sector/rwa/ethereum/rwa_ethereum_balances.sql b/dbt_subprojects/daily_spellbook/models/_sector/rwa/ethereum/rwa_ethereum_balances.sql new file mode 100644 index 00000000000..73b28c870b9 --- /dev/null +++ b/dbt_subprojects/daily_spellbook/models/_sector/rwa/ethereum/rwa_ethereum_balances.sql @@ -0,0 +1,38 @@ +{{ + config( + schema = 'rwa_ethereum', + alias = 'balances', + materialized = 'incremental', + file_format = 'delta', + incremental_strategy = 'merge', + unique_key = ['day', 'address', 'token_address', 'blockchain'], + incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.day')] + ) +}} + +with +rwa_tokens as ( + select + symbol, + contract_address as token_address + from + {{ source('tokens_ethereum', 'rwa')}} +) + +,balances as ( + {{ + balances_incremental_subset_daily( + blockchain = 'ethereum', + token_list = 'rwa_tokens', + start_date = '2020-01-01' + ) + }} +) + +select + t.symbol + ,b.* +from balances b +left join rwa_tokens t + on b.token_address = t.token_address + \ No newline at end of file diff --git a/dbt_subprojects/daily_spellbook/models/_sector/rwa/ethereum/rwa_ethereum_schema.yml b/dbt_subprojects/daily_spellbook/models/_sector/rwa/ethereum/rwa_ethereum_schema.yml new file mode 100644 index 00000000000..9f5802e9e4b --- /dev/null +++ b/dbt_subprojects/daily_spellbook/models/_sector/rwa/ethereum/rwa_ethereum_schema.yml @@ -0,0 +1,62 @@ +version: 2 + +models: + - name: rwa_ethereum_balances + + meta: + blockchain: ethereum + sector: rwa + project: rwa + contributors: synthquest + + config: + tags: ['rwa', 'balances'] + description: "Balances of rwa token holders" + data_tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - day + - address + - token_address + columns: + - &blockchain + name: blockchain + description: "Blockchain for the token" + - &symbol + name: symbol + description: "Symbol for the token" + - &version + name: version + description: "Version of the token" + - &day + name: day + description: "Date on which the token balance is logged" + - &address + name: address + description: "Address for the token holder" + - &token_symbol + name: token_symbol + description: "Symbol for the token" + - &token_address + name: token_address + description: "Address for the token" + - &token_standard + name: token_standard + description: "Standard for the token" + - &token_id + name: token_id + description: "ID for the token" + - &balance + name: balance + description: "Balance for the user" + - &balance_usd + name: balance_usd + description: "USD value of balance for the user" + - &last_updated + name: last_updated + description: "UTC timestamp when data was last updated" + - &next_update + name: next_update + description: "UTC timestamp when data is next updated" + + \ No newline at end of file diff --git a/dbt_subprojects/daily_spellbook/models/aave/base/aave_base_interest_rates.sql b/dbt_subprojects/daily_spellbook/models/aave/base/aave_base_interest_rates.sql new file mode 100644 index 00000000000..236a5883414 --- /dev/null +++ b/dbt_subprojects/daily_spellbook/models/aave/base/aave_base_interest_rates.sql @@ -0,0 +1,26 @@ +{{ config( + schema = 'aave_base' + , alias = 'interest_rates' + , post_hook='{{ expose_spells(blockchains = \'["base"]\', + spell_type = "project", + spell_name = "aave", + contributors = \'["mikeghen1","batwayne", "chuxin"]\') }}' + ) +}} + +SELECT * +FROM +( + SELECT + reserve, + symbol, + hour, + deposit_apy, + stable_borrow_apy, + variable_borrow_apy + FROM {{ ref('aave_v3_base_interest_rates') }} + /* + UNION ALL + < add new version as needed + */ +) diff --git a/dbt_subprojects/daily_spellbook/models/aave/base/aave_base_schema.yml b/dbt_subprojects/daily_spellbook/models/aave/base/aave_base_schema.yml index d08a831c95d..4b7197c5e8b 100644 --- a/dbt_subprojects/daily_spellbook/models/aave/base/aave_base_schema.yml +++ b/dbt_subprojects/daily_spellbook/models/aave/base/aave_base_schema.yml @@ -54,3 +54,59 @@ models: - &evt_index name: evt_index description: "Event index" + + - name: aave_v3_base_interest_rates + meta: + blockchain: base + sector: lending + project: aave_v3 + contributors: mikeghen1, batwayne, chuxin + config: + tags: ['base', 'aave_v3', 'interest', 'aave', 'lending'] + description: "Hourly aave interest rates on base" + data_tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - reserve + - symbol + - hour + columns: + - &reserve + name: reserve + description: "Aave reserve contract address" + - *symbol + - &hour + name: hour + description: "Block timestamp truncated to hours" + - &deposit_apy + name: deposit_apy + description: "Hourly deposit interest rate value of the reserve" + - &stable_borrow_apy + name: stable_borrow_apy + description: "Hourly stable borrow interest rate value of the reserve" + - &variable_borrow_apy + name: variable_borrow_apy + description: "Hourly variable borrow interest rate value of the reserve" + + - name: aave_base_interest_rates + meta: + blockchain: base + sector: lending + project: aave + contributors: mikeghen1, batwayne, chuxin + config: + tags: ['base', 'aave_v3', 'interest', 'aave', 'lending'] + description: "Hourly aave interest rates on base" + data_tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - reserve + - symbol + - hour + columns: + - *reserve + - *symbol + - *hour + - *deposit_apy + - *stable_borrow_apy + - *variable_borrow_apy diff --git a/dbt_subprojects/daily_spellbook/models/aave/base/aave_v3_base_interest_rates.sql b/dbt_subprojects/daily_spellbook/models/aave/base/aave_v3_base_interest_rates.sql new file mode 100644 index 00000000000..195450220e4 --- /dev/null +++ b/dbt_subprojects/daily_spellbook/models/aave/base/aave_v3_base_interest_rates.sql @@ -0,0 +1,28 @@ +{{ config( + schema = 'aave_v3_base' + , alias = 'interest_rates' + , materialized = 'incremental' + , file_format = 'delta' + , incremental_strategy = 'merge' + , unique_key = ['reserve', 'symbol', 'hour'] + , post_hook='{{ expose_spells(blockchains = \'["base"]\', + spell_type = "project", + spell_name = "aave_v3", + contributors = \'["mikeghen1","batwayne", "chuxin"]\') }}' + ) +}} + +select + a.reserve, + t.symbol, + date_trunc('hour',a.evt_block_time) as hour, + avg(CAST(a.liquidityRate AS DOUBLE)) / 1e27 as deposit_apy, + avg(CAST(a.stableBorrowRate AS DOUBLE)) / 1e27 as stable_borrow_apy, + avg(CAST(a.variableBorrowRate AS DOUBLE)) / 1e27 as variable_borrow_apy +from {{ source('aave_v3_base', 'L2Pool_evt_ReserveDataUpdated') }} a +left join {{ source('tokens', 'erc20') }} t +on a.reserve = t.contract_address and t.blockchain = 'base' +{% if is_incremental() %} + WHERE {{ incremental_predicate('evt_block_time') }} +{% endif %} +group by 1,2,3 diff --git a/dbt_subprojects/daily_spellbook/models/evms/evms_info.sql b/dbt_subprojects/daily_spellbook/models/evms/evms_info.sql index 9a2a98639a3..754a83957ed 100644 --- a/dbt_subprojects/daily_spellbook/models/evms/evms_info.sql +++ b/dbt_subprojects/daily_spellbook/models/evms/evms_info.sql @@ -10,6 +10,7 @@ , "bnb" , "boba" , "celo" + , "corn" , "ethereum" , "fantom" , "flare" @@ -22,6 +23,7 @@ , "ronin" , "scroll" , "sei" + , "sonic" , "viction" , "worldchain" , "zksync" @@ -95,4 +97,6 @@ FROM ( , (2020, 'ronin', 'Ronin', 'Layer 1', null, 'RON', 0xe514d9deb7966c8be0ca922de8a064264ea6bcd4, 'https://app.roninchain.com/', timestamp '2021-01-25 10:49', NULL, NULL, NULL, true) , (14, 'flare', 'Flare', 'Layer 1', NULL, 'FLR', NULL, 'https://flare-explorer.flare.network/', timestamp '2022-07-13 15:32', NULL, NULL, NULL, true) , (88, 'viction', 'Viction', 'Layer 1', NULL, 'VIC', 0xC054751BdBD24Ae713BA3Dc9Bd9434aBe2abc1ce, 'https://vicscan.xyz/', timestamp '2018-12-14 07:50:20', NULL, NULL, NULL, true) + , (21000000, 'corn', 'Corn', 'Layer 1', NULL, 'BTCN', NULL, 'https://cornscan.io/', timestamp '2024-11-19 10:29:11', NULL, NULL, NULL, true) + , (146, 'sonic', 'Sonic', 'Layer 1', NULL, 'SONIC', NULL, 'https://sonicscan.org/', timestamp '2024-12-01 00:00', NULL, NULL, NULL, true) ) AS temp_table (chain_id, blockchain, name, chain_type, rollup_type, native_token_symbol, wrapped_native_token_address, explorer_link, first_block_time, codebase, data_availability, settlement, is_on_dune) diff --git a/dbt_subprojects/daily_spellbook/tests/aave/base/aave_base_interests_test.sql b/dbt_subprojects/daily_spellbook/tests/aave/base/aave_base_interests_test.sql new file mode 100644 index 00000000000..829be379215 --- /dev/null +++ b/dbt_subprojects/daily_spellbook/tests/aave/base/aave_base_interests_test.sql @@ -0,0 +1,25 @@ +with unit_test1 + as (select case + when abs(variable_borrow_apy - 0.10808360395679557) / 0.10808360395679557 < 0.001 + then true + else false + end as test + from {{ ref('aave_v3_base_interest_rates' )}} + where reserve = 0x833589fcd6edb6e08f4c7c32d4f71b54bda02913 -- USDC + and hour = TIMESTAMP '2025-01-02 20:00'), + unit_test2 + as (select case + when abs(deposit_apy - 0.015712521763084) / 0.015712521763084 < 0.001 + then true + else false + end as test + from {{ ref('aave_v3_base_interest_rates' )}} + where symbol = 'WETH' -- 0x4200000000000000000000000000000000000006 + and hour = TIMESTAMP '2024-08-21 03:00') +select * +from (select * + from unit_test1 + union + select * + from unit_test2) +where test = false \ No newline at end of file diff --git a/dbt_subprojects/dex/models/_projects/paraswap/arbitrum/paraswap_v6_arbitrum_trades_decoded.sql b/dbt_subprojects/dex/models/_projects/paraswap/arbitrum/paraswap_v6_arbitrum_trades_decoded.sql index 502fc389f43..1024152f7ff 100644 --- a/dbt_subprojects/dex/models/_projects/paraswap/arbitrum/paraswap_v6_arbitrum_trades_decoded.sql +++ b/dbt_subprojects/dex/models/_projects/paraswap/arbitrum/paraswap_v6_arbitrum_trades_decoded.sql @@ -6,8 +6,13 @@ file_format = 'delta', incremental_strategy = 'merge', incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.blockTime')], - unique_key = ['call_tx_hash', 'method', 'call_trace_address'] + unique_key = ['call_tx_hash', 'method', 'call_trace_address'], + post_hook='{{ expose_spells(blockchains = \'["arbitrum"]\', + spell_type = "project", + spell_name = "paraswap_v6", + contributors = \'["eptighte", "mwamedacen"]\') }}' ) + }} {{ paraswap_v6_trades_master('arbitrum', 'paraswap') }} \ No newline at end of file diff --git a/dbt_subprojects/dex/models/_projects/paraswap/avalanche_c/paraswap_v6_avalanche_c_trades_decoded.sql b/dbt_subprojects/dex/models/_projects/paraswap/avalanche_c/paraswap_v6_avalanche_c_trades_decoded.sql index 8115c77340e..01ff942135a 100644 --- a/dbt_subprojects/dex/models/_projects/paraswap/avalanche_c/paraswap_v6_avalanche_c_trades_decoded.sql +++ b/dbt_subprojects/dex/models/_projects/paraswap/avalanche_c/paraswap_v6_avalanche_c_trades_decoded.sql @@ -6,7 +6,11 @@ file_format = 'delta', incremental_strategy = 'merge', incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.blockTime')], - unique_key = ['call_tx_hash', 'method', 'call_trace_address'] + unique_key = ['call_tx_hash', 'method', 'call_trace_address'], + post_hook='{{ expose_spells(blockchains = \'["avalanche_c"]\', + spell_type = "project", + spell_name = "paraswap_v6", + contributors = \'["eptighte", "mwamedacen"]\') }}' ) }} diff --git a/dbt_subprojects/dex/models/_projects/paraswap/base/paraswap_v6_base_trades_decoded.sql b/dbt_subprojects/dex/models/_projects/paraswap/base/paraswap_v6_base_trades_decoded.sql index f8d2ea8f24b..3029cf2c40b 100644 --- a/dbt_subprojects/dex/models/_projects/paraswap/base/paraswap_v6_base_trades_decoded.sql +++ b/dbt_subprojects/dex/models/_projects/paraswap/base/paraswap_v6_base_trades_decoded.sql @@ -6,7 +6,11 @@ file_format = 'delta', incremental_strategy = 'merge', incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.blockTime')], - unique_key = ['call_tx_hash', 'method', 'call_trace_address'] + unique_key = ['call_tx_hash', 'method', 'call_trace_address'], + post_hook='{{ expose_spells(blockchains = \'["base"]\', + spell_type = "project", + spell_name = "paraswap_v6", + contributors = \'["eptighte", "mwamedacen"]\') }}' ) }} diff --git a/dbt_subprojects/dex/models/_projects/paraswap/bnb/paraswap_v6_bnb_trades_decoded.sql b/dbt_subprojects/dex/models/_projects/paraswap/bnb/paraswap_v6_bnb_trades_decoded.sql index 594d41c2743..257c866aa86 100644 --- a/dbt_subprojects/dex/models/_projects/paraswap/bnb/paraswap_v6_bnb_trades_decoded.sql +++ b/dbt_subprojects/dex/models/_projects/paraswap/bnb/paraswap_v6_bnb_trades_decoded.sql @@ -6,7 +6,11 @@ file_format = 'delta', incremental_strategy = 'merge', incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.blockTime')], - unique_key = ['call_tx_hash', 'method', 'call_trace_address'] + unique_key = ['call_tx_hash', 'method', 'call_trace_address'], + post_hook='{{ expose_spells(blockchains = \'["bnb"]\', + spell_type = "project", + spell_name = "paraswap_v6", + contributors = \'["eptighte", "mwamedacen"]\') }}' ) }} diff --git a/dbt_subprojects/dex/models/_projects/paraswap/ethereum/paraswap_v6_ethereum_trades_decoded.sql b/dbt_subprojects/dex/models/_projects/paraswap/ethereum/paraswap_v6_ethereum_trades_decoded.sql index eb2a0849ccc..a36e1034c9d 100644 --- a/dbt_subprojects/dex/models/_projects/paraswap/ethereum/paraswap_v6_ethereum_trades_decoded.sql +++ b/dbt_subprojects/dex/models/_projects/paraswap/ethereum/paraswap_v6_ethereum_trades_decoded.sql @@ -6,7 +6,11 @@ file_format = 'delta', incremental_strategy = 'merge', incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.blockTime')], - unique_key = ['call_tx_hash', 'method', 'call_trace_address'] + unique_key = ['call_tx_hash', 'method', 'call_trace_address'], + post_hook='{{ expose_spells(blockchains = \'["ethereum"]\', + spell_type = "project", + spell_name = "paraswap_v6", + contributors = \'["eptighte", "mwamedacen"]\') }}' ) }} diff --git a/dbt_subprojects/dex/models/_projects/paraswap/fantom/paraswap_v6_fantom_trades_decoded.sql b/dbt_subprojects/dex/models/_projects/paraswap/fantom/paraswap_v6_fantom_trades_decoded.sql index ef3047c2ff0..796f9333021 100644 --- a/dbt_subprojects/dex/models/_projects/paraswap/fantom/paraswap_v6_fantom_trades_decoded.sql +++ b/dbt_subprojects/dex/models/_projects/paraswap/fantom/paraswap_v6_fantom_trades_decoded.sql @@ -6,7 +6,11 @@ file_format = 'delta', incremental_strategy = 'merge', incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.blockTime')], - unique_key = ['call_tx_hash', 'method', 'call_trace_address'] + unique_key = ['call_tx_hash', 'method', 'call_trace_address'], + post_hook='{{ expose_spells(blockchains = \'["fantom"]\', + spell_type = "project", + spell_name = "paraswap_v6", + contributors = \'["eptighte", "mwamedacen"]\') }}' ) }} diff --git a/dbt_subprojects/dex/models/_projects/paraswap/optimism/paraswap_v6_optimism_trades_decoded.sql b/dbt_subprojects/dex/models/_projects/paraswap/optimism/paraswap_v6_optimism_trades_decoded.sql index f9fec8cccdb..e5b7223726d 100644 --- a/dbt_subprojects/dex/models/_projects/paraswap/optimism/paraswap_v6_optimism_trades_decoded.sql +++ b/dbt_subprojects/dex/models/_projects/paraswap/optimism/paraswap_v6_optimism_trades_decoded.sql @@ -6,7 +6,11 @@ file_format = 'delta', incremental_strategy = 'merge', incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.blockTime')], - unique_key = ['call_tx_hash', 'method', 'call_trace_address'] + unique_key = ['call_tx_hash', 'method', 'call_trace_address'], + post_hook='{{ expose_spells(blockchains = \'["optimism"]\', + spell_type = "project", + spell_name = "paraswap_v6", + contributors = \'["eptighte", "mwamedacen"]\') }}' ) }} diff --git a/dbt_subprojects/dex/models/_projects/paraswap/polygon/paraswap_v6_polygon_trades_decoded.sql b/dbt_subprojects/dex/models/_projects/paraswap/polygon/paraswap_v6_polygon_trades_decoded.sql index ee56d154a6b..6672db00e66 100644 --- a/dbt_subprojects/dex/models/_projects/paraswap/polygon/paraswap_v6_polygon_trades_decoded.sql +++ b/dbt_subprojects/dex/models/_projects/paraswap/polygon/paraswap_v6_polygon_trades_decoded.sql @@ -6,7 +6,11 @@ file_format = 'delta', incremental_strategy = 'merge', incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.blockTime')], - unique_key = ['call_tx_hash', 'method', 'call_trace_address'] + unique_key = ['call_tx_hash', 'method', 'call_trace_address'], + post_hook='{{ expose_spells(blockchains = \'["polygon"]\', + spell_type = "project", + spell_name = "paraswap_v6", + contributors = \'["eptighte", "mwamedacen"]\') }}' ) }} diff --git a/dbt_subprojects/dex/models/dex_info.sql b/dbt_subprojects/dex/models/dex_info.sql index ef08d06f0b5..f8bef38bdae 100644 --- a/dbt_subprojects/dex/models/dex_info.sql +++ b/dbt_subprojects/dex/models/dex_info.sql @@ -192,7 +192,11 @@ FROM (VALUES , ('saddle_finance', 'Saddle Finance', 'Direct', 'saddlefinance') , ('katana', 'Katana', 'Direct', 'AxieInfinity') , ('jetswap', 'JetSwap', 'Direct', 'Jetfuelfinance') + , ('bridgers', 'Bridgers', 'Direct', 'Bridgersxyz') , ('levinswap', 'Levinswap', 'Direct', 'levinswap') + , ('sparkdex', 'SparkDEX', 'Direct', 'SparkDexAI') + , ('blazeswap', 'BlazeSwap', 'Direct', 'blazeswapdex') + , ('enosys', 'Enosys', 'Direct', 'enosys_global') , ('gravity_finance', 'GravityFinance', 'Direct', 'Gravity_Finance') , ('fluid', 'Fluid DEX', 'Direct', '0xfluid') ) AS temp_table (project, name, marketplace_type, x_username) diff --git a/dbt_subprojects/dex/models/trades/_schema.yml b/dbt_subprojects/dex/models/trades/_schema.yml index cb10cfb6b1d..450e3bf5741 100644 --- a/dbt_subprojects/dex/models/trades/_schema.yml +++ b/dbt_subprojects/dex/models/trades/_schema.yml @@ -4,7 +4,7 @@ models: - name: dex_trades meta: docs_slug: /curated/trading/DEX/dex-trades - blockchain: arbitrum, avalanche_c, base, bnb, celo, ethereum, fantom, gnosis, kaia, optimism, polygon, scroll, zksync, linea, blast, sei, ronin + blockchain: arbitrum, avalanche_c, base, bnb, celo, ethereum, fantom, gnosis, kaia, optimism, polygon, scroll, zksync, linea, blast, sei, ronin, flare sector: dex short_description: The `dex.trades` table captures detailed data on trades executed via decentralized exchanges (DEXs). This table contains a detailed breakdown of trade execution containing one or many trades per transaction. contributors: 0xRob, hosuke, jeff-dude, tomfutago, viniabussafi diff --git a/dbt_subprojects/dex/models/trades/base/_schema.yml b/dbt_subprojects/dex/models/trades/base/_schema.yml index fde1b6d7532..9648dedd6a4 100644 --- a/dbt_subprojects/dex/models/trades/base/_schema.yml +++ b/dbt_subprojects/dex/models/trades/base/_schema.yml @@ -46,7 +46,7 @@ models: blockchain: base sector: dex project: stablebase - contributors: principatel + contributors: principatel, hosuke config: tags: ["base", "dex", "trades", "stablebase"] description: stablebase base trades diff --git a/dbt_subprojects/dex/models/trades/base/platforms/stablebase_base_base_trades.sql b/dbt_subprojects/dex/models/trades/base/platforms/stablebase_base_base_trades.sql index f2c2df02aef..99adc687c28 100644 --- a/dbt_subprojects/dex/models/trades/base/platforms/stablebase_base_base_trades.sql +++ b/dbt_subprojects/dex/models/trades/base/platforms/stablebase_base_base_trades.sql @@ -8,6 +8,11 @@ unique_key = ['block_date', 'blockchain', 'project', 'version', 'tx_hash', 'evt_index'] ) }} +-- Id mapping: +-- 0 USDbC https://basescan.org/token/0xd9aaec86b65d86f6a7b5b1b0c42ffa531710b6ca +-- 1 DAI https://basescan.org/token/0x50c5725949a6f0c72e6c4a641f24049a917db0cb +-- 2 axlUSDC https://basescan.org/token/0xeb466342c4d449bc9f53a865d5cb90586f405215 + WITH token_swaps AS ( SELECT evt_block_number AS block_number, @@ -16,8 +21,16 @@ WITH token_swaps AS ( evt_tx_to AS taker, tokensSold AS token_sold_amount_raw, tokensBought AS token_bought_amount_raw, - CAST(soldId AS varbinary) AS token_sold_address, - CAST(boughtId AS varbinary) AS token_bought_address, + CASE soldId + WHEN 0 THEN 0xd9aaec86b65d86f6a7b5b1b0c42ffa531710b6ca + WHEN 1 THEN 0x50c5725949a6f0c72e6c4a641f24049a917db0cb + WHEN 2 THEN 0xeb466342c4d449bc9f53a865d5cb90586f405215 + END AS token_sold_address, + CASE boughtId + WHEN 0 THEN 0xd9aaec86b65d86f6a7b5b1b0c42ffa531710b6ca + WHEN 1 THEN 0x50c5725949a6f0c72e6c4a641f24049a917db0cb + WHEN 2 THEN 0xeb466342c4d449bc9f53a865d5cb90586f405215 + END AS token_bought_address, contract_address AS project_contract_address, evt_tx_hash AS tx_hash, evt_index AS evt_index diff --git a/dbt_subprojects/dex/models/trades/dex_base_trades.sql b/dbt_subprojects/dex/models/trades/dex_base_trades.sql index 6a5a68bb734..f39d30c5f98 100644 --- a/dbt_subprojects/dex/models/trades/dex_base_trades.sql +++ b/dbt_subprojects/dex/models/trades/dex_base_trades.sql @@ -33,6 +33,7 @@ , ref('dex_zkevm_base_trades') , ref('dex_zksync_base_trades') , ref('dex_zora_base_trades') + , ref('dex_flare_base_trades') ] %} with base_union as ( diff --git a/dbt_subprojects/dex/models/trades/ethereum/_schema.yml b/dbt_subprojects/dex/models/trades/ethereum/_schema.yml index 5b33a0992c0..a88f3145e99 100644 --- a/dbt_subprojects/dex/models/trades/ethereum/_schema.yml +++ b/dbt_subprojects/dex/models/trades/ethereum/_schema.yml @@ -188,6 +188,7 @@ models: version: - 2 - mmpool + - pcsx - name: shibaswap_v1_ethereum_base_trades meta: diff --git a/dbt_subprojects/dex/models/trades/ethereum/platforms/pancakeswap_v2_ethereum_base_trades.sql b/dbt_subprojects/dex/models/trades/ethereum/platforms/pancakeswap_v2_ethereum_base_trades.sql index 7ab786f47ad..c06b00933e9 100644 --- a/dbt_subprojects/dex/models/trades/ethereum/platforms/pancakeswap_v2_ethereum_base_trades.sql +++ b/dbt_subprojects/dex/models/trades/ethereum/platforms/pancakeswap_v2_ethereum_base_trades.sql @@ -25,6 +25,44 @@ dexs_macro AS ( }} ), +transfer as ( + select * from {{ source('tokens', 'transfers') }} + where blockchain = 'ethereum' + and block_date >= date '2024-09-20' + and tx_hash in (select evt_tx_hash from {{ source('pancakeswap_ethereum', 'ExclusiveDutchOrderReactor_evt_Fill') }}) + {% if is_incremental() %} + and {{ incremental_predicate('block_time') }} + {% endif %} +), + +dexs_pcsx AS ( + -- PancakeSwapX + SELECT + 'pcsx' AS version, + a.evt_block_number AS block_number, + a.evt_block_time AS block_time, + a.swapper AS taker, + a.filler AS maker, + receive.amount_raw AS token_bought_amount_raw, + send.amount_raw AS token_sold_amount_raw, + receive.contract_address AS token_bought_address, + send.contract_address AS token_sold_address, + a.contract_address AS project_contract_address, + a.evt_tx_hash AS tx_hash, + a.evt_index + + FROM {{ source('pancakeswap_ethereum', 'ExclusiveDutchOrderReactor_evt_Fill') }} a + + LEFT JOIN transfer AS send + ON a.evt_tx_hash = send.tx_hash AND a.swapper = send."from" + + LEFT JOIN transfer AS receive + on a.evt_tx_hash = receive.tx_hash AND a.swapper = receive."to" + {% if is_incremental() %} + WHERE {{ incremental_predicate('a.evt_block_time') }} + {% endif %} +), + dexs_mm AS ( -- PancakeSwap v2 MMPool SELECT @@ -129,3 +167,24 @@ SELECT dexs_ss.tx_hash, dexs_ss.evt_index FROM dexs_ss +UNION ALL +SELECT + 'ethereum' AS blockchain, + 'pancakeswap' AS project, + dexs_pcsx.version, + CAST(date_trunc('month', dexs_pcsx.block_time) AS date) AS block_month, + CAST(date_trunc('day', dexs_pcsx.block_time) AS date) AS block_date, + dexs_pcsx.block_time, + dexs_pcsx.block_number, + dexs_pcsx.token_bought_amount_raw, + dexs_pcsx.token_sold_amount_raw, + dexs_pcsx.token_bought_address, + dexs_pcsx.token_sold_address, + dexs_pcsx.taker, + dexs_pcsx.maker, + dexs_pcsx.project_contract_address, + dexs_pcsx.tx_hash, + dexs_pcsx.evt_index +FROM dexs_pcsx +WHERE token_sold_amount_raw > 0 +AND token_bought_amount_raw > 0 \ No newline at end of file diff --git a/dbt_subprojects/dex/models/trades/flare/_schema.yml b/dbt_subprojects/dex/models/trades/flare/_schema.yml new file mode 100644 index 00000000000..438345b34c8 --- /dev/null +++ b/dbt_subprojects/dex/models/trades/flare/_schema.yml @@ -0,0 +1,85 @@ +version: 2 + +models: + - name: dex_flare_base_trades + meta: + blockchain: flare + sector: dex + project: dex + contributors: hosuke + config: + tags: ['flare', 'dex', 'trades'] + description: > + Flare DEX trades + data_tests: + - check_dex_info_relationship + + - name: enosys_v2_flare_base_trades + meta: + blockchain: flare + sector: dex + project: enosys + contributors: hosuke + config: + tags: [ 'flare', 'dex', 'trades', 'enosys', 'v2' ] + description: "Enosys V2 Flare base trades" + data_tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - tx_hash + - evt_index + + - name: sparkdex_v2_flare_base_trades + meta: + blockchain: flare + sector: dex + project: sparkdex + contributors: hosuke + config: + tags: ['flare', 'dex', 'trades', 'sparkdex', 'v2'] + description: "SparkDex (UniswapV2 fork) base trades on Flare" + data_tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - tx_hash + - evt_index + - check_dex_base_trades_seed: + seed_file: ref('sparkdex_flare_base_trades_seed') + filter: + version: 2 + + - name: sparkdex_v3_flare_base_trades + meta: + blockchain: flare + sector: dex + project: sparkdex + contributors: hosuke + config: + tags: [ 'flare', 'dex', 'trades', 'sparkdex', 'v3' ] + description: "SparkDex (UniswapV3 fork) base trades on Flare" + data_tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - tx_hash + - evt_index + - check_dex_base_trades_seed: + seed_file: ref('sparkdex_flare_base_trades_seed') + filter: + version: 3 + + - name: blazeswap_flare_base_trades + meta: + blockchain: flare + sector: dex + project: blazeswap + contributors: hosuke + config: + tags: [ 'flare', 'dex', 'trades', 'blazeswap' ] + description: "Blazeswap Flare base trades" + data_tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - tx_hash + - evt_index + - check_dex_base_trades_seed: + seed_file: ref('blazeswap_flare_base_trades_seed') \ No newline at end of file diff --git a/dbt_subprojects/dex/models/trades/flare/dex_flare_base_trades.sql b/dbt_subprojects/dex/models/trades/flare/dex_flare_base_trades.sql new file mode 100644 index 00000000000..ba14cabcd7a --- /dev/null +++ b/dbt_subprojects/dex/models/trades/flare/dex_flare_base_trades.sql @@ -0,0 +1,51 @@ +{{ config( + schema = 'dex_flare' + , alias = 'base_trades' + , materialized = 'view' + ) +}} + +{% set base_models = [ + ref('enosys_v2_flare_base_trades') + , ref('sparkdex_v2_flare_base_trades') + , ref('sparkdex_v3_flare_base_trades') + , ref('blazeswap_flare_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 = 'flare' + , columns = ['from', 'to', 'index'] + ) +}} diff --git a/dbt_subprojects/dex/models/trades/flare/platforms/blazeswap_flare_base_trades.sql b/dbt_subprojects/dex/models/trades/flare/platforms/blazeswap_flare_base_trades.sql new file mode 100644 index 00000000000..d2743688085 --- /dev/null +++ b/dbt_subprojects/dex/models/trades/flare/platforms/blazeswap_flare_base_trades.sql @@ -0,0 +1,21 @@ +{{ + config( + schema = 'blazeswap_flare', + 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 = 'flare', + project = 'blazeswap', + version = '2', + Pair_evt_Swap = source('blazeswap_flare', 'BLAZE_LP_evt_Swap'), + Factory_evt_PairCreated = source('blazeswap_flare', 'BlazeSwapFactory_evt_PairCreated') + ) +}} diff --git a/dbt_subprojects/dex/models/trades/flare/platforms/enosys_v2_flare_base_trades.sql b/dbt_subprojects/dex/models/trades/flare/platforms/enosys_v2_flare_base_trades.sql new file mode 100644 index 00000000000..680557edfbb --- /dev/null +++ b/dbt_subprojects/dex/models/trades/flare/platforms/enosys_v2_flare_base_trades.sql @@ -0,0 +1,20 @@ +{{ config( + schema = 'enosys_v2_flare' + , 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 = 'flare' + , project = 'enosys' + , version = '2' + , Pair_evt_Swap = source('enosys_flare', 'EnosysPair_evt_Swap') + , Factory_evt_PairCreated = source('enosys_flare', 'EnosysDexFactory_evt_PairCreated') + ) +}} \ No newline at end of file diff --git a/dbt_subprojects/dex/models/trades/flare/platforms/sparkdex_v2_flare_base_trades.sql b/dbt_subprojects/dex/models/trades/flare/platforms/sparkdex_v2_flare_base_trades.sql new file mode 100644 index 00000000000..852be76b246 --- /dev/null +++ b/dbt_subprojects/dex/models/trades/flare/platforms/sparkdex_v2_flare_base_trades.sql @@ -0,0 +1,21 @@ +{{ + config( + schema = 'sparkdex_v2_flare', + 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 = 'flare', + project = 'sparkdex', + version = '2', + Pair_evt_Swap = source('sparkdex_flare', 'UniswapV2Pool_evt_Swap'), + Factory_evt_PairCreated = source('sparkdex_flare', 'UniswapV2Factory_evt_PairCreated') + ) +}} diff --git a/dbt_subprojects/dex/models/trades/flare/platforms/sparkdex_v3_flare_base_trades.sql b/dbt_subprojects/dex/models/trades/flare/platforms/sparkdex_v3_flare_base_trades.sql new file mode 100644 index 00000000000..becc5cda95b --- /dev/null +++ b/dbt_subprojects/dex/models/trades/flare/platforms/sparkdex_v3_flare_base_trades.sql @@ -0,0 +1,21 @@ +{{ + config( + schema = 'sparkdex_v3_flare', + 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 = 'flare', + project = 'sparkdex', + version = '3', + Pair_evt_Swap = source('sparkdex_flare', 'UniswapV3Pool_evt_Swap'), + Factory_evt_PoolCreated = source('sparkdex_flare', 'UniswapV3Factory_evt_PoolCreated') + ) +}} diff --git a/dbt_subprojects/dex/models/trades/optimism/_schema.yml b/dbt_subprojects/dex/models/trades/optimism/_schema.yml index 95626994551..5257ac7bbeb 100644 --- a/dbt_subprojects/dex/models/trades/optimism/_schema.yml +++ b/dbt_subprojects/dex/models/trades/optimism/_schema.yml @@ -574,7 +574,7 @@ models: blockchain: optimism sector: dex project: saddle_finance - contributors: princi + contributors: princi, hosuke config: tags: [ 'optimism', 'dex', 'trades', 'saddle_finance'] description: "saddle finance optimism base trades" @@ -585,3 +585,20 @@ models: - evt_index - check_dex_base_trades_seed: seed_file: ref('saddle_finance_optimism_base_trades_seed') + + - name: bridgers_optimism_base_trades + meta: + blockchain: optimism + sector: dex + project: bridgers + contributors: princi + config: + tags: [ 'optimism', 'dex', 'trades', 'bridgers'] + description: "bridgers optimism base trades" + data_tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - tx_hash + - evt_index + - check_dex_base_trades_seed: + seed_file: ref('bridgers_optimism_base_trades_seed') \ No newline at end of file diff --git a/dbt_subprojects/dex/models/trades/optimism/dex_optimism_base_trades.sql b/dbt_subprojects/dex/models/trades/optimism/dex_optimism_base_trades.sql index 72bea48676f..b646f3d59b8 100644 --- a/dbt_subprojects/dex/models/trades/optimism/dex_optimism_base_trades.sql +++ b/dbt_subprojects/dex/models/trades/optimism/dex_optimism_base_trades.sql @@ -35,6 +35,7 @@ , ref('elk_finance_optimism_base_trades') , ref('fraxswap_optimism_base_trades') , ref('swaap_v2_optimism_base_trades') + , ref('bridgers_optimism_base_trades') , ref('saddle_finance_optimism_base_trades') ] %} diff --git a/dbt_subprojects/dex/models/trades/optimism/platforms/bridgers_optimism_base_trades.sql b/dbt_subprojects/dex/models/trades/optimism/platforms/bridgers_optimism_base_trades.sql new file mode 100644 index 00000000000..d5a8668a166 --- /dev/null +++ b/dbt_subprojects/dex/models/trades/optimism/platforms/bridgers_optimism_base_trades.sql @@ -0,0 +1,50 @@ +{{ config( + schema = 'bridgers_optimism', + alias = 'base_trades', + partition_by = ['block_month'], + materialized = 'incremental', + file_format = 'delta', + incremental_strategy = 'merge', + unique_key = ['tx_hash', 'evt_index'] +) }} + +WITH token_swaps AS ( + SELECT + evt_block_number AS block_number, + CAST(evt_block_time AS timestamp(3) with time zone) AS block_time, + evt_tx_from AS maker, + evt_tx_to AS taker, + fromAmount AS token_sold_amount_raw, + minReturnAmount AS token_bought_amount_raw, + CAST(sender AS varbinary) AS token_sold_address, + CAST(destination AS varbinary) AS token_bought_address, + CAST(contract_address AS varbinary) AS project_contract_address, + evt_tx_hash AS tx_hash, + evt_index AS evt_index + FROM + {{ source('bridgers_optimism', 'Bridgers_evt_Swap') }} + {% if is_incremental() %} + WHERE + {{ incremental_predicate('evt_block_time') }} + {% endif %} +) + +SELECT + 'optimism' AS blockchain, + 'bridgers' AS project, + '1' AS version, + CAST(date_trunc('month', token_swaps.block_time) AS date) AS block_month, + CAST(date_trunc('day', token_swaps.block_time) AS date) AS block_date, + token_swaps.block_time, + token_swaps.block_number, + token_swaps.token_sold_amount_raw, + token_swaps.token_bought_amount_raw, + token_swaps.token_sold_address, + token_swaps.token_bought_address, + token_swaps.maker, + token_swaps.taker, + token_swaps.project_contract_address, + token_swaps.tx_hash, + token_swaps.evt_index +FROM + token_swaps diff --git a/dbt_subprojects/dex/models/trades/optimism/platforms/saddle_finance_optimism_base_trades.sql b/dbt_subprojects/dex/models/trades/optimism/platforms/saddle_finance_optimism_base_trades.sql index dda9f17a17e..78d562a80b6 100644 --- a/dbt_subprojects/dex/models/trades/optimism/platforms/saddle_finance_optimism_base_trades.sql +++ b/dbt_subprojects/dex/models/trades/optimism/platforms/saddle_finance_optimism_base_trades.sql @@ -8,6 +8,15 @@ unique_key = ['tx_hash', 'evt_index'] ) }} +-- contract 0x5847f8177221268d279cf377d0e01ab3fd993628 Id mapping: +-- 0 DAI https://optimistic.etherscan.io/token/0xda10009cbd5d07dd0cecc66161fc93d7c9000da1 +-- 1 USDC.e https://optimistic.etherscan.io/token/0x7f5c764cbc14f9669b88837ca1490cca17c31607 +-- 2 USDT https://optimistic.etherscan.io/token/0x94b008aa00579c1307b0ef2c499ad98a8ce58e58 + +-- contract 0xf6c2e0adc659007ba7c48446f5a4e4e94dfe08b5 Id mapping: +-- 0 USDC.e https://optimistic.etherscan.io/token/0x7f5c764cbc14f9669b88837ca1490cca17c31607 +-- 1 FRAX https://optimistic.etherscan.io/token/0x2e3d870790dc77a83dd1d18184acc7439a53f475 + WITH token_swaps AS ( SELECT evt_block_number AS block_number, @@ -16,8 +25,32 @@ WITH token_swaps AS ( evt_tx_to AS taker, tokensSold AS token_sold_amount_raw, tokensBought AS token_bought_amount_raw, - CAST(soldId AS varbinary) AS token_sold_address, - CAST(boughtId AS varbinary) AS token_bought_address, + CASE + WHEN contract_address = 0x5847f8177221268d279cf377d0e01ab3fd993628 THEN + CASE soldId + WHEN 0 THEN 0xda10009cbd5d07dd0cecc66161fc93d7c9000da1 + WHEN 1 THEN 0x7f5c764cbc14f9669b88837ca1490cca17c31607 + WHEN 2 THEN 0x94b008aa00579c1307b0ef2c499ad98a8ce58e58 + END + WHEN contract_address = 0xf6c2e0adc659007ba7c48446f5a4e4e94dfe08b5 THEN + CASE soldId + WHEN 0 THEN 0x7f5c764cbc14f9669b88837ca1490cca17c31607 + WHEN 1 THEN 0x2e3d870790dc77a83dd1d18184acc7439a53f475 + END + END AS token_sold_address, + CASE + WHEN contract_address = 0x5847f8177221268d279cf377d0e01ab3fd993628 THEN + CASE boughtId + WHEN 0 THEN 0xda10009cbd5d07dd0cecc66161fc93d7c9000da1 + WHEN 1 THEN 0x7f5c764cbc14f9669b88837ca1490cca17c31607 + WHEN 2 THEN 0x94b008aa00579c1307b0ef2c499ad98a8ce58e58 + END + WHEN contract_address = 0xf6c2e0adc659007ba7c48446f5a4e4e94dfe08b5 THEN + CASE boughtId + WHEN 0 THEN 0x7f5c764cbc14f9669b88837ca1490cca17c31607 + WHEN 1 THEN 0x2e3d870790dc77a83dd1d18184acc7439a53f475 + END + END AS token_bought_address, contract_address AS project_contract_address, evt_tx_hash AS tx_hash, evt_index AS evt_index diff --git a/dbt_subprojects/dex/models/trades/ronin/_schema.yml b/dbt_subprojects/dex/models/trades/ronin/_schema.yml index 9d9035dda64..9402dc644cc 100644 --- a/dbt_subprojects/dex/models/trades/ronin/_schema.yml +++ b/dbt_subprojects/dex/models/trades/ronin/_schema.yml @@ -5,19 +5,40 @@ models: data_tests: - check_dex_info_relationship - - name: katana_ronin_base_trades + - name: katana_v2_ronin_base_trades meta: blockchain: ronin sector: dex project: katana - contributors: jeff-dude + contributors: jeff-dude, cxheng315 config: - tags: [ 'ronin', 'dex', 'trades', 'katana' ] - description: "Katana ronin base trades" + tags: ["ronin", "dex", "trades", "katana"] + description: "Katana v2 ronin base trades" data_tests: - dbt_utils.unique_combination_of_columns: combination_of_columns: - tx_hash - evt_index - check_dex_base_trades_seed: - seed_file: ref('katana_ronin_base_trades_seed') \ No newline at end of file + seed_file: ref('katana_ronin_base_trades_seed') + filter: + version: 2 + + - name: katana_v3_ronin_base_trades + meta: + blockchain: ronin + sector: dex + project: katana + contributors: cxheng315 + config: + tags: ["ronin", "dex", "trades", "katana"] + description: "Katana v3 ronin base trades" + data_tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - tx_hash + - evt_index + - check_dex_base_trades_seed: + seed_file: ref('katana_ronin_base_trades_seed') + filter: + version: 3 diff --git a/dbt_subprojects/dex/models/trades/ronin/dex_ronin_base_trades.sql b/dbt_subprojects/dex/models/trades/ronin/dex_ronin_base_trades.sql index 1cd7eaa3262..108ff7cd73d 100644 --- a/dbt_subprojects/dex/models/trades/ronin/dex_ronin_base_trades.sql +++ b/dbt_subprojects/dex/models/trades/ronin/dex_ronin_base_trades.sql @@ -6,7 +6,8 @@ }} {% set base_models = [ - ref('katana_ronin_base_trades') + ref('katana_v2_ronin_base_trades') + , ref('katana_v3_ronin_base_trades') ] %} WITH base_union AS ( diff --git a/dbt_subprojects/dex/models/trades/ronin/platforms/katana_ronin_base_trades.sql b/dbt_subprojects/dex/models/trades/ronin/platforms/katana_v2_ronin_base_trades.sql similarity index 98% rename from dbt_subprojects/dex/models/trades/ronin/platforms/katana_ronin_base_trades.sql rename to dbt_subprojects/dex/models/trades/ronin/platforms/katana_v2_ronin_base_trades.sql index c2f1d62f8a6..e6a6eeb4997 100644 --- a/dbt_subprojects/dex/models/trades/ronin/platforms/katana_ronin_base_trades.sql +++ b/dbt_subprojects/dex/models/trades/ronin/platforms/katana_v2_ronin_base_trades.sql @@ -1,5 +1,5 @@ {{ config( - schema = 'katana_ronin' + schema = 'katana_v2_ronin' , alias = 'base_trades' , materialized = 'incremental' , file_format = 'delta' diff --git a/dbt_subprojects/dex/models/trades/ronin/platforms/katana_v3_ronin_base_trades.sql b/dbt_subprojects/dex/models/trades/ronin/platforms/katana_v3_ronin_base_trades.sql new file mode 100644 index 00000000000..ad3b9dd5e27 --- /dev/null +++ b/dbt_subprojects/dex/models/trades/ronin/platforms/katana_v3_ronin_base_trades.sql @@ -0,0 +1,21 @@ +{{ + config( + schema = 'katana_v3_ronin' + , 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 = 'ronin' + , project = 'katana' + , version = '3' + , Pair_evt_Swap = source('katana_dex_ronin', 'KatanaV3Pool_evt_Swap') + , Factory_evt_PoolCreated = source('katana_dex_ronin', 'KatanaV3Factory_evt_PoolCreated') + ) +}} diff --git a/dbt_subprojects/dex/seeds/trades/_schema.yml b/dbt_subprojects/dex/seeds/trades/_schema.yml index da4c398563d..fe5cb14a4c9 100644 --- a/dbt_subprojects/dex/seeds/trades/_schema.yml +++ b/dbt_subprojects/dex/seeds/trades/_schema.yml @@ -4454,7 +4454,7 @@ seeds: token_bought_amount_raw: uint256 token_sold_amount_raw: uint256 block_date: timestamp - + - name: infusion_base_base_trades_seed config: column_types: @@ -4514,7 +4514,7 @@ seeds: token_bought_amount_raw: uint256 token_sold_amount_raw: uint256 block_date: timestamp - + - name: akronswap_base_base_trades_seed config: column_types: @@ -4529,7 +4529,7 @@ seeds: token_bought_amount_raw: uint256 token_sold_amount_raw: uint256 block_date: timestamp - + - name: katana_ronin_base_trades_seed config: column_types: @@ -4559,8 +4559,23 @@ seeds: token_bought_amount_raw: uint256 token_sold_amount_raw: uint256 block_date: timestamp - + - name: elk_finance_gnosis_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: bridgers_optimism_base_trades_seed config: column_types: blockchain: varchar @@ -4574,7 +4589,7 @@ seeds: token_bought_amount_raw: uint256 token_sold_amount_raw: uint256 block_date: timestamp - + - name: levinswap_gnosis_base_trades_seed config: column_types: @@ -4590,6 +4605,21 @@ seeds: token_sold_amount_raw: uint256 block_date: timestamp + - name: sparkdex_flare_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: gravity_finance_polygon_base_trades_seed config: column_types: @@ -4604,7 +4634,7 @@ seeds: token_bought_amount_raw: uint256 token_sold_amount_raw: uint256 block_date: timestamp - + - name: fluid_ethereum_base_trades_seed config: column_types: @@ -4619,3 +4649,18 @@ seeds: token_bought_amount_raw: uint256 token_sold_amount_raw: uint256 block_date: timestamp + + - name: blazeswap_flare_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/dbt_subprojects/dex/seeds/trades/blazeswap_flare_base_trades_seed.csv b/dbt_subprojects/dex/seeds/trades/blazeswap_flare_base_trades_seed.csv new file mode 100644 index 00000000000..f940476b700 --- /dev/null +++ b/dbt_subprojects/dex/seeds/trades/blazeswap_flare_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 +flare,blazeswap,2,2024-10-06,0x51407c99b67d71815b993420f8811900b5865cb673ba893ef07dcca5f85aa06d,30,0xe6505f92583103af7ed9974dec451a7af4e3a3be,0x1d80c49bbbcd1c0911346656b529df9e5c2f783d,30881152,1335216349117423088152,5497558138880000000000 +flare,blazeswap,2,2024-10-17,0x55de50c11e29636db85763b75c25a2b718dc18b4fe2c37539e5f324ac52e6e24,30,0x1d80c49bbbcd1c0911346656b529df9e5c2f783d,0xe6505f92583103af7ed9974dec451a7af4e3a3be,31449410,105931708336615473057,44371879946728776388 diff --git a/dbt_subprojects/dex/seeds/trades/bridgers_optimism_base_trades_seed.csv b/dbt_subprojects/dex/seeds/trades/bridgers_optimism_base_trades_seed.csv new file mode 100644 index 00000000000..abf59da46e0 --- /dev/null +++ b/dbt_subprojects/dex/seeds/trades/bridgers_optimism_base_trades_seed.csv @@ -0,0 +1,2 @@ +blockchain,project,version,block_month,block_date,block_time,block_number,token_sold_amount_raw,token_bought_amount_raw,token_sold_address,token_bought_address,maker,taker,project_contract_address,tx_hash,evt_index +optimism,birdgers,1,2024-12-01 00:00,2024-12-19 00:00,2024-12-19 21:03,129521708,9447540,9335061,0x96985c5786b86cd8108313a9e3adb9d657164746,0x5551443863617577424555435056776a3173704e5268775a4b7562584d76432d527448727042724e7659495047767639,0xc7b2e791ee0491c8df611d5ccfd87b17a0cb9897,0xf956d9fa19656d8e5219fd6fa8ba6cb198094138,0xb685760ebd368a891f27ae547391f4e2a289895b,0x6e926a4373216290e37f83947a0fa32b836c51c2c152847df6e81f74b813946d,188 diff --git a/dbt_subprojects/dex/seeds/trades/katana_ronin_base_trades_seed.csv b/dbt_subprojects/dex/seeds/trades/katana_ronin_base_trades_seed.csv index d8a0d2f8ea0..a34825a4783 100644 --- a/dbt_subprojects/dex/seeds/trades/katana_ronin_base_trades_seed.csv +++ b/dbt_subprojects/dex/seeds/trades/katana_ronin_base_trades_seed.csv @@ -1,3 +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 ronin,katana,2,2024-01-17,0xca2c3b5d6aec890d5bfe1fb8616036a01b702948107fdb4a243453cfe5a6d86a,10,0x1b918543b518e34902e1e8dd76052bee43c762ff,0xe514d9deb7966c8be0ca922de8a064264ea6bcd4,31230074,12492104858888467232497,5109345881300390132 -ronin,katana,2,2023-03-01,0xcab674e07e3c5b0b6dd53b52971edabc929a2fd907b85d781f70bac74767c6e3,10,0xc99a6a985ed2cac1ef41640596c5a5f9f4e19ef5,0xe514d9deb7966c8be0ca922de8a064264ea6bcd4,22465731,1700000000000000,3070678253641756888 \ No newline at end of file +ronin,katana,2,2023-03-01,0xcab674e07e3c5b0b6dd53b52971edabc929a2fd907b85d781f70bac74767c6e3,10,0xc99a6a985ed2cac1ef41640596c5a5f9f4e19ef5,0xe514d9deb7966c8be0ca922de8a064264ea6bcd4,22465731,1700000000000000,3070678253641756888 +ronin,katana,3,2024-12-19,0x92f922acbb1a4a80b2ad56d8b6ce2cc587f2851fac7b3e37582f7578db55ee4d,160,0xc6046fa4b8961b0e9d823bb3f2dde8fe161d547d,0xe514d9deb7966c8be0ca922de8a064264ea6bcd4,40907478,234401580938417717096,26553212520000000000 +ronin,katana,3,2024-12-19,0x340763e80131db74ce992733518944ad35d1290aaae53f5eeacaeb994057f49e,39,0xe514d9deb7966c8be0ca922de8a064264ea6bcd4,0x0b7007c13325c48911f73a2dad5fa5dcbf808adc,40908371,141505036347788395809,300000000 diff --git a/dbt_subprojects/dex/seeds/trades/pancakeswap_ethereum_base_trades_seed.csv b/dbt_subprojects/dex/seeds/trades/pancakeswap_ethereum_base_trades_seed.csv index ecdeabecc12..518176521fa 100644 --- a/dbt_subprojects/dex/seeds/trades/pancakeswap_ethereum_base_trades_seed.csv +++ b/dbt_subprojects/dex/seeds/trades/pancakeswap_ethereum_base_trades_seed.csv @@ -14,3 +14,6 @@ ethereum,pancakeswap,3,2023-04-01,0x942d7e8064aa1925e484ad9e38b25b0eea8620aa2b85 ethereum,pancakeswap,stableswap,2024-09-03 00:00:00.000 UTC,0x76706147bb031c1dff5386142d866ec083578420885fb24160124a66800ef418,299,0x2260fac5e5542a773aa44fbcfedf7c193bc2c599,0xbdf245957992bfbc62b07e344128a1eec7b7ee3f,20668595,9967437,10000000 ethereum,pancakeswap,stableswap,2024-09-04 00:00:00.000 UTC,0x6639947fd9c9d5e07425f2500f3f50b13bb7b4bd92316d5392866e759aa7e97c,74,0xbdf245957992bfbc62b07e344128a1eec7b7ee3f,0x2260fac5e5542a773aa44fbcfedf7c193bc2c599,20680551,1251896,1177998 ethereum,pancakeswap,stableswap,2024-09-08 00:00:00.000 UTC,0x7e07e90e2230148bd1a5c49ccaa94a36408dc3df2f39c923c6c49b154d6c7ba4,72,0x2260fac5e5542a773aa44fbcfedf7c193bc2c599,0xbdf245957992bfbc62b07e344128a1eec7b7ee3f,20704016,13399197,13511099 +ethereum,pancakeswap,pcsx,2024-12-12,0xa9f85566c718fa84dfe82dfc9638e8383271856e1c61f2ba11d3c4d23be6c8fc,226,0xdac17f958d2ee523a2206206994597c13d831ec7,0x2260fac5e5542a773aa44fbcfedf7c193bc2c599,21386209,20000000000,20072678 +ethereum,pancakeswap,pcsx,2024-12-12,0xdd63f84eca7f3b7cdfc174ae93b80d1fded3bc145be5a63479eb30c525e07f51,430,0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee,0x95ad61b0a150d79219dcf64e1e6cc01f0b64c4ce,21386418,1610345878716657319,220881632899203791230293346 +ethereum,pancakeswap,pcsx,2024-12-12,0x96a89245d9f67ae8f23bdb4c54879e805b727403bbef6214d08fdcc771aa3f51,447,0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48,0x7fc66500c84a76ad7e9c93437bfc5ac33e2ddae9,21386687,553168032,1521057740000000000 diff --git a/dbt_subprojects/dex/seeds/trades/saddle_finance_optimism_base_trades_seed.csv b/dbt_subprojects/dex/seeds/trades/saddle_finance_optimism_base_trades_seed.csv index a459ed8b479..e20c21d3ec3 100644 --- a/dbt_subprojects/dex/seeds/trades/saddle_finance_optimism_base_trades_seed.csv +++ b/dbt_subprojects/dex/seeds/trades/saddle_finance_optimism_base_trades_seed.csv @@ -1,2 +1,4 @@ blockchain,project,version,block_month,block_date,block_time,block_number,token_sold_amount_raw,token_bought_amount_raw,token_sold_address,token_bought_address,maker,taker,project_contract_address,tx_hash,evt_index -optimism,saddle_finance,1,2022-08-01 00:00,2022-08-05 00:00,2022-08-05 19:11,17943155,74907384,74857799085655995549,0x0000000000000000000000000000000000000000000000000000000000000000,0x0000000000000000000000000000000000000000000000000000000000000001,0xd131f1bcdd547e067af447dd3c36c99d6be9fdeb,0xf6c2e0adc659007ba7c48446f5a4e4e94dfe08b5,0xf6c2e0adc659007ba7c48446f5a4e4e94dfe08b5,0xbccdcd4ab61e5ad3384eb173156c3c0507d3bb3f2d2f5a406379e74aafbec38d,3 \ No newline at end of file +optimism,saddle_finance,1,2022-08-01 00:00,2022-08-05 00:00,2022-08-05 19:11,17943155,74907384,74857799085655995549,0x7f5c764cbc14f9669b88837ca1490cca17c31607,0x2e3d870790dc77a83dd1d18184acc7439a53f475,0xd131f1bcdd547e067af447dd3c36c99d6be9fdeb,0xf6c2e0adc659007ba7c48446f5a4e4e94dfe08b5,0xf6c2e0adc659007ba7c48446f5a4e4e94dfe08b5,0xbccdcd4ab61e5ad3384eb173156c3c0507d3bb3f2d2f5a406379e74aafbec38d,3 +optimism,saddle_finance,1,2022-07-01 00:00,2022-07-27 00:00,2022-07-27 19:05,16079111,92288022,92410669220437585672,0x7f5c764cbc14f9669b88837ca1490cca17c31607,0xda10009cbd5d07dd0cecc66161fc93d7c9000da1,0xfeb8bac57bc7c3dcce15b075e8d73b6d67dac9b9,0xa6baa075fb5cf4721b43fe068ee81b56f34fa06d,0x5847f8177221268d279cf377d0e01ab3fd993628,0x70c780f635e8cc884d5999ff812d98344bda173564155f0b62e3b88d74bfd477,3 +optimism,saddle_finance,1,2023-07-01 00:00,2023-07-06 00:00,2023-07-06 08:46,106517219,180000000,179931184169613570122,0x7f5c764cbc14f9669b88837ca1490cca17c31607,0x2e3d870790dc77a83dd1d18184acc7439a53f475,0x01901a4a1acfc3641ed8c2778820200de4b2ff63,0x5c4cf9768c857528b025a6de958f803c852fbaf1,0xf6c2e0adc659007ba7c48446f5a4e4e94dfe08b5,0x9552ae3a5519282594faf5170267d8966b16c3563ce38358c2fe6eebbf494429,5 \ No newline at end of file diff --git a/dbt_subprojects/dex/seeds/trades/sparkdex_flare_base_trades_seed.csv b/dbt_subprojects/dex/seeds/trades/sparkdex_flare_base_trades_seed.csv new file mode 100644 index 00000000000..67298b2d4ad --- /dev/null +++ b/dbt_subprojects/dex/seeds/trades/sparkdex_flare_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 +flare,sparkdex,2,2024-12-19,0x17b97c773299bb5432f7513ec1090b7182326dc6e8a8a772bbcc14639e2e5e74,16,0xfbda5f676cb37624f28265a144a48b0d6e87d3b6,0x1d80c49bbbcd1c0911346656b529df9e5c2f783d,34744392,164250,5873468685772181578 +flare,sparkdex,2,2024-12-19,0xe1ac5909a57022912a5853ccb70e2de4604eae3c6dd3483fc719338cf18a0625,23,0xfbda5f676cb37624f28265a144a48b0d6e87d3b6,0x1d80c49bbbcd1c0911346656b529df9e5c2f783d,34747482,658,24000000000000000 +flare,sparkdex,3,2024-12-04,0x2e172e22c714f28e9e8f29a89799ec5102397e29926a070a2bd11f92637106a3,10,0x1d80c49bbbcd1c0911346656b529df9e5c2f783d,0xfbda5f676cb37624f28265a144a48b0d6e87d3b6,34014169,4999999985390174801119,166057407 +flare,sparkdex,3,2024-10-29,0x2e29ac0d54b4bd75c4788a285a9806ea57ed801b4c931a877b2a17aeaa3dafff,10,0xfbda5f676cb37624f28265a144a48b0d6e87d3b6,0x1d80c49bbbcd1c0911346656b529df9e5c2f783d,32113089,4955860,353988522618423672831 \ No newline at end of file diff --git a/dbt_subprojects/dex/seeds/trades/stablebase_base_base_trades_seed.csv b/dbt_subprojects/dex/seeds/trades/stablebase_base_base_trades_seed.csv index 998c8e33f1b..e3cfc2f90b7 100644 --- a/dbt_subprojects/dex/seeds/trades/stablebase_base_base_trades_seed.csv +++ b/dbt_subprojects/dex/seeds/trades/stablebase_base_base_trades_seed.csv @@ -1,2 +1,2 @@ blockchain,project,version,block_month,block_date,block_time,block_number,token_sold_amount_raw,token_bought_amount_raw,token_sold_address,token_bought_address,maker,taker,project_contract_address,tx_hash,evt_index -base,stablebase,1,2023-08-01,2023-08-28,2023-08-28 19:18:00.000,3230470,129976172599579374396,135180385,0x0000000000000000000000000000000000000000000000000000000000000001,0x0000000000000000000000000000000000000000000000000000000000000000,0x19fbc29d72476365a62151ffdbf4764e54774a81,0x8c59cc9b958635710957e751a9b4e77cd771baf2,0x8c59cc9b958635710957e751a9b4e77cd771baf2,0xc2dec669877f4edfcb7debd2eb23288a0fba8cd57d6f3fb3e45e8b15a6458d43,31 +base,stablebase,1,2023-08-01,2023-08-28,2023-08-28 19:18:00.000,3230470,129976172599579374396,135180385,0x50c5725949a6f0c72e6c4a641f24049a917db0cb,0xd9aaec86b65d86f6a7b5b1b0c42ffa531710b6ca,0x19fbc29d72476365a62151ffdbf4764e54774a81,0x8c59cc9b958635710957e751a9b4e77cd771baf2,0x8c59cc9b958635710957e751a9b4e77cd771baf2,0xc2dec669877f4edfcb7debd2eb23288a0fba8cd57d6f3fb3e45e8b15a6458d43,31 diff --git a/dbt_subprojects/hourly_spellbook/macros/sector/lending/lending_aave_compatible_supply.sql b/dbt_subprojects/hourly_spellbook/macros/sector/lending/lending_aave_compatible_supply.sql index 5320cf668bc..ab042cd9c11 100644 --- a/dbt_subprojects/hourly_spellbook/macros/sector/lending/lending_aave_compatible_supply.sql +++ b/dbt_subprojects/hourly_spellbook/macros/sector/lending/lending_aave_compatible_supply.sql @@ -141,6 +141,16 @@ src_LendingPool_evt_Withdraw as ( {% endif %} ), +{% if 'aave' in project %} +src_WrappedTokenGatewayV2_call_withdrawETH as ( + select * + from {{ source(project_decoded_as ~ '_' ~ blockchain, 'WrappedTokenGatewayV2_call_withdrawETH') }} + {% if is_incremental() %} + where {{ incremental_predicate('call_block_time') }} + {% endif %} +), +{% endif %} + src_LendingPool_evt_LiquidationCall as ( select * from {{ source(project_decoded_as ~ '_' ~ blockchain, 'LendingPool_evt_LiquidationCall') }} @@ -167,18 +177,30 @@ base_supply as ( union all select 'withdraw' as transaction_type, - reserve as token_address, - user as depositor, - cast(null as varbinary) as on_behalf_of, - to as withdrawn_to, + w.reserve as token_address, + w.user as depositor, + {% if 'aave' in project %} + cast(wrap.to as varbinary) + {% else %} + cast(null as varbinary) + {% endif %} as on_behalf_of, + w.to as withdrawn_to, cast(null as varbinary) as liquidator, - -1 * cast(amount as double) as amount, - contract_address, - evt_tx_hash, - evt_index, - evt_block_time, - evt_block_number - from src_LendingPool_evt_Withdraw + -1 * cast(w.amount as double) as amount, + w.contract_address, + w.evt_tx_hash, + w.evt_index, + w.evt_block_time, + w.evt_block_number + from src_LendingPool_evt_Withdraw w + {% if 'aave' in project %} + left join src_WrappedTokenGatewayV2_call_withdrawETH wrap + on w.evt_block_number = wrap.call_block_number + and w.evt_tx_hash = wrap.call_tx_hash + and w.to = wrap.contract_address + and w.amount = wrap.amount + and wrap.call_success + {% endif %} union all select 'deposit_liquidation' as transaction_type, @@ -225,7 +247,8 @@ from base_supply project, version, project_decoded_as = 'aave_v3', - decoded_contract_name = 'Pool' + decoded_contract_name = 'Pool', + decoded_wrapped_token_gateway_name = 'WrappedTokenGatewayV3' ) %} @@ -247,6 +270,16 @@ src_LendingPool_evt_Withdraw as ( {% endif %} ), +{% if 'aave' in project %} +src_WrappedTokenGatewayV3_call_withdrawETH as ( + select * + from {{ source(project_decoded_as ~ '_' ~ blockchain, decoded_wrapped_token_gateway_name ~ '_call_withdrawETH') }} + {% if is_incremental() %} + where {{ incremental_predicate('call_block_time') }} + {% endif %} +), +{% endif %} + src_LendingPool_evt_Repay as ( select * from {{ source(project_decoded_as ~ '_' ~ blockchain, decoded_contract_name ~ '_evt_Repay') }} @@ -282,18 +315,30 @@ base_supply as ( union all select 'withdraw' as transaction_type, - reserve as token_address, - user as depositor, - cast(null as varbinary) as on_behalf_of, - to as withdrawn_to, + w.reserve as token_address, + w.user as depositor, + {% if 'aave' in project %} + cast(wrap.to as varbinary) + {% else %} + cast(null as varbinary) + {% endif %} as on_behalf_of, + w.to as withdrawn_to, cast(null as varbinary) as liquidator, - -1 * cast(amount as double) as amount, - contract_address, - evt_tx_hash, - evt_index, - evt_block_time, - evt_block_number - from src_LendingPool_evt_Withdraw + -1 * cast(w.amount as double) as amount, + w.contract_address, + w.evt_tx_hash, + w.evt_index, + w.evt_block_time, + w.evt_block_number + from src_LendingPool_evt_Withdraw w + {% if 'aave' in project %} + left join src_WrappedTokenGatewayV3_call_withdrawETH wrap + on w.evt_block_number = wrap.call_block_number + and w.evt_tx_hash = wrap.call_tx_hash + and w.to = wrap.contract_address + and w.amount = wrap.amount + and wrap.call_success + {% endif %} union all select 'repay_with_atokens' as transaction_type, diff --git a/dbt_subprojects/hourly_spellbook/models/_project/balancer/erc4626_tokens/ethereum/balancer_v3_ethereum_erc4626_token_mapping.sql b/dbt_subprojects/hourly_spellbook/models/_project/balancer/erc4626_tokens/ethereum/balancer_v3_ethereum_erc4626_token_mapping.sql index 5d00d403603..c240541fef0 100644 --- a/dbt_subprojects/hourly_spellbook/models/_project/balancer/erc4626_tokens/ethereum/balancer_v3_ethereum_erc4626_token_mapping.sql +++ b/dbt_subprojects/hourly_spellbook/models/_project/balancer/erc4626_tokens/ethereum/balancer_v3_ethereum_erc4626_token_mapping.sql @@ -38,7 +38,8 @@ FROM (VALUES (0x7bc3485026ac48b6cf9baf0a377477fff5703af8, 'Static Aave Ethereum USDT', 'WaEthUSDT', 0xdac17f958d2ee523a2206206994597c13d831ec7, 'USDT', 6), (0x0bfc9d54fc184518a81162f8fb99c2eaca081202, 'Static Aave Ethereum WETH', 'WaEthWETH', 0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2, 'WETH', 18), (0x0fe906e030a44ef24ca8c7dc7b7c53a6c4f00ce9, 'Static Aave Ethereum Lido WETH', 'waEthLidoWETH', 0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2, 'WETH', 18), - (0x775f661b0bd1739349b9a2a3ef60be277c5d2d29, 'Static Aave Ethereum Lido wstETH', 'waEthLidowstETH', 0x7f39c581f595b53c5cb19bd0b3f8da6c935e2ca0, 'wstETH', 18) + (0x775f661b0bd1739349b9a2a3ef60be277c5d2d29, 'Static Aave Ethereum Lido wstETH', 'waEthLidowstETH', 0x7f39c581f595b53c5cb19bd0b3f8da6c935e2ca0, 'wstETH', 18), + (0x5F9D59db355b4A60501544637b00e94082cA575b, 'Static Aave Ethereum USDe', 'waEthUSDe', 0x4c9EDD5852cd905f086C759E8383e09bff1E68B3, 'USDe', 18) ) AS temp_table (erc4626_token, erc4626_token_name, erc4626_token_symbol, underlying_token, underlying_token_symbol, decimals) ), @@ -54,8 +55,23 @@ FROM {{ source('metamorpho_factory_ethereum', 'MetaMorphoFactory_evt_CreateMetaM JOIN {{ source('tokens', 'erc20') }} t ON t.blockchain = 'ethereum' AND a.asset = t.contract_address + +UNION + +SELECT + erc4626_token, + erc4626_token_name, + erc4626_token_symbol, + underlying_token, + underlying_token_symbol, + decimals +FROM (VALUES + (0x7204b7dbf9412567835633b6f00c3edc3a8d6330, 'CoinShift USDC', 'csUSDC', 0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48, 'USDC', 18), + (0xbeefc011e94f43b8b7b455ebab290c7ab4e216f1, 'CoinShift USDL', 'csUSDL', 0xbdC7c08592Ee4aa51D06C27Ee23D5087D65aDbcD, 'wUSDL', 18) + ) AS temp_table (erc4626_token, erc4626_token_name, erc4626_token_symbol, underlying_token, underlying_token_symbol, decimals) ) + SELECT 'ethereum' AS blockchain, * diff --git a/dbt_subprojects/hourly_spellbook/models/_project/cow_protocol/arbitrum/cow_protocol_arbitrum_solvers.sql b/dbt_subprojects/hourly_spellbook/models/_project/cow_protocol/arbitrum/cow_protocol_arbitrum_solvers.sql index b6f51bab053..f83aa055fab 100644 --- a/dbt_subprojects/hourly_spellbook/models/_project/cow_protocol/arbitrum/cow_protocol_arbitrum_solvers.sql +++ b/dbt_subprojects/hourly_spellbook/models/_project/cow_protocol/arbitrum/cow_protocol_arbitrum_solvers.sql @@ -55,6 +55,7 @@ known_solver_metadata (address, environment, name) as ( (0x0148538e6cA813D41eA5988008Cdc9B72d4e65A7, 'prod', 'Laita'), (0x1FA2FF499b327f53cD9a82BcAFE36093563E32e4, 'prod', 'Apollo'), (0x0148538e6cA813D41eA5988008Cdc9B72d4e65A7, 'prod', 'Laita'), + (0x9C75aae1Bd2f96D7B4E67e8C5344f3304382276E, 'prod', 'Enso'), (0x034F6Aca83F1900b0157b0123F514A29456eeA59, 'barn', 'Laita'), (0x6bf97aFe2D2C790999cDEd2a8523009eB8a0823f, 'prod', 'Portus'), (0xBB765c920f86e2A2654c4B82deB5BC2E092fF93b, 'barn', 'Portus'), diff --git a/dbt_subprojects/hourly_spellbook/models/_project/cow_protocol/base/cow_protocol_base_solvers.sql b/dbt_subprojects/hourly_spellbook/models/_project/cow_protocol/base/cow_protocol_base_solvers.sql index a3eb28bc6f6..edb59a964a4 100644 --- a/dbt_subprojects/hourly_spellbook/models/_project/cow_protocol/base/cow_protocol_base_solvers.sql +++ b/dbt_subprojects/hourly_spellbook/models/_project/cow_protocol/base/cow_protocol_base_solvers.sql @@ -45,9 +45,13 @@ known_solver_metadata (address, environment, name) as ( (0x147d05987f3008A6C9Ec3E93A4ead430907ac3E1, 'barn', 'Gnosis_0x'), (0x9451D27C993f7a61096BFC33e0241644a7566F66, 'barn', 'Gnosis_BalancerSOR'), (0x0AC9287C83C2386A6a0bb27F847Ce59a0034183C, 'barn', 'Laita'), - (0x172FaCC5d970df43462b0f3aDe670d8cB86DC816, 'barn', 'ApeOut_1Inch'), + (0x172FaCC5d970df43462b0f3aDe670d8cB86DC816, 'barn', 'ApeOut_1inch'), (0xBB765c920f86e2A2654c4B82deB5BC2E092fF93b, 'barn', 'Portus'), - (0x1a72876ebE781E42aB2Ee4278B539688D8B80E2D, 'prod', 'ApeOut_1Inch'), + (0xDF580073E21fFd7968F317B5359B934Eb6d58804, 'barn', 'Barter'), + (0x9775be2Bb0B72d4eA98Bfd38024EF733dc048a30, 'barn', 'Apollo'), + (0x41f387db8470c99b7f376212075e2E289f085Ce9, 'prod', 'Apollo'), + (0x36Fd8A0C24B08F7bb4af8d6eaA6245C3884fC682, 'prod', 'Barter'), + (0x1a72876ebE781E42aB2Ee4278B539688D8B80E2D, 'prod', 'ApeOut_1inch'), (0x6bf97aFe2D2C790999cDEd2a8523009eB8a0823f, 'prod', 'Portus'), (0x69d7F96dFD091652f317D0734A5F2B492ACcbE07, 'prod', 'Baseline'), (0x4cb862E4821fea2dabBD1f0A69c17d52da2A58f6, 'prod', 'Seasolver'), diff --git a/dbt_subprojects/hourly_spellbook/models/_project/cow_protocol/ethereum/cow_protocol_ethereum_solvers.sql b/dbt_subprojects/hourly_spellbook/models/_project/cow_protocol/ethereum/cow_protocol_ethereum_solvers.sql index 5f9bc304b90..68fc0d13775 100644 --- a/dbt_subprojects/hourly_spellbook/models/_project/cow_protocol/ethereum/cow_protocol_ethereum_solvers.sql +++ b/dbt_subprojects/hourly_spellbook/models/_project/cow_protocol/ethereum/cow_protocol_ethereum_solvers.sql @@ -119,11 +119,11 @@ known_solver_metadata (address, environment, name) as ( (0x95480d3f27658e73b2785d30beb0c847d78294c7, 'prod', 'Fractal'), (0x00806DaA2Cfe49715eA05243FF259DeB195760fC, 'prod', 'Quasilabs'), (0x28B1bd44996105b5c14c4dE41093226Ff78A4eB1, 'prod', '0x'), - (0x04B89dBce06e7Aa2F4BBA78969ADD4576eB94788, 'prod', 'ApeOut_1Inch'), + (0x04B89dBce06e7Aa2F4BBA78969ADD4576eB94788, 'prod', 'ApeOut_1inch'), (0xbada5552a3e5e2fb57db982e29257821a2cf192d, 'prod', 'Project_Blanc'), (0x34717040928D7fd8154d4612f3228EFf14521023, 'prod', 'Laita'), (0xBab555BaBEe5d867983902bC8db8F707157245Be, 'barn', 'Project_Blanc'), - (0x854490ef1d402D4f6fce05aBefE1C676eB0DCD74, 'barn', 'ApeOut_1Inch'), + (0x854490ef1d402D4f6fce05aBefE1C676eB0DCD74, 'barn', 'ApeOut_1inch'), (0xBB765c920f86e2A2654c4B82deB5BC2E092fF93b, 'barn', 'Portus'), (0xcC73072B53697911Ff394ae01D3de59c9900b0b0, 'barn', '0x'), (0xd0bA1b1782fbdE45edAb392428f60e14827D08EC, 'barn', 'Laita'), diff --git a/dbt_subprojects/hourly_spellbook/models/_sector/blobs/ethereum/blobs_submitters.sql b/dbt_subprojects/hourly_spellbook/models/_sector/blobs/ethereum/blobs_submitters.sql index 4542d4d8391..a96b8d34093 100644 --- a/dbt_subprojects/hourly_spellbook/models/_sector/blobs/ethereum/blobs_submitters.sql +++ b/dbt_subprojects/hourly_spellbook/models/_sector/blobs/ethereum/blobs_submitters.sql @@ -33,6 +33,7 @@ SELECT address , (0x5ead389b57d533a94a0eacd570dc1cc59c25f2d4, 'Parallel', 'ParallelFi') , (0x40acdc94a00b33151b40763b3fed7c46ff639df4, 'Parallel', 'ParallelFi') , (0xcf2898225ed05be911d3709d9417e86e0b4cfc8f, 'Scroll', 'Scroll_ZKP') + , (0x054a47b9e2a22af6c0ce55020238c8fecd7d334b, 'Scroll', 'Scroll_ZKP') , (0xa6ea2f3299b63c53143c993d2d5e60a69cd6fe24, 'Lisk', 'LiskHQ') , (0x3d0bf26e60a689a7da5ea3ddad7371f27f7671a5, 'Optopia', 'Optopia_AI') , (0x5c53f2ff1030c7fbc0616fd5b8fc6be97aa27e00, 'Lumio', 'PontemNetwork') @@ -78,4 +79,8 @@ SELECT address , (0x2986bf308d0684ad77cd32ee1c60429e6573b5af, 'R0AR Chain', 'th3r0ar') , (0x2f60a5184c63ca94f82a27100643dbabe4f3f7fd, 'Unichain', 'unichain') , (0xf854cd5b26bfd73d51236c0122798907ed65b1f2, 'Swell', 'swellnetworkio') + , (0x500d7ea63cf2e501dadaa5feec1fc19fe2aa72ac, 'Ink', 'inkonchain') + , (0x68d5bbf3a01ecbb47ce38cf64a7d6c0ea618040f, 'Binary Network', 'thebinaryhldgs') + , (0xf263a0aa8afeaa7d516b596d49d7ba6c0feb102c, 'R0AR Chain', 'th3r0ar') + , (0x9391791f7cb74f8bfda65edc0749efd964311b55, 'HashKey', 'HashKeyHSK') ) AS x(address, entity, x_username) \ No newline at end of file diff --git a/dbt_subprojects/hourly_spellbook/models/_sector/cex/addresses/chains/bitcoin/cex_bitcoin_addresses.sql b/dbt_subprojects/hourly_spellbook/models/_sector/cex/addresses/chains/bitcoin/cex_bitcoin_addresses.sql index ecddc2099a3..20fd964b031 100644 --- a/dbt_subprojects/hourly_spellbook/models/_sector/cex/addresses/chains/bitcoin/cex_bitcoin_addresses.sql +++ b/dbt_subprojects/hourly_spellbook/models/_sector/cex/addresses/chains/bitcoin/cex_bitcoin_addresses.sql @@ -793,5 +793,7 @@ FROM (VALUES , ('bitcoin', '3CjxgnmNsu3kaFadzVea2FgECuHN7y2ENz', 'Bitcoin Suisse', 'Bitcoin Suisse 7', 'hildobby', date '2024-05-27') , ('bitcoin', 'bc1qu2dq8w8lv8v3l7lr2c5tvx3yltv22r3nhkx7w0', 'eXch.sc', 'eXch.sc 1', 'hildobby', date '2024-09-06') + + , ('bitcoin', 'bc1qlnkyrrupehgw5evu43erlgkhhagv0uj3yyhacvc65n3ud6qeas0sa958ps', 'Arkham', 'Arkham 1', 'hildobby', date '2024-12-13') ) AS x (blockchain, address, cex_name, distinct_name, added_by, added_date) diff --git a/dbt_subprojects/hourly_spellbook/models/_sector/cex/addresses/chains/cex_evms_addresses.sql b/dbt_subprojects/hourly_spellbook/models/_sector/cex/addresses/chains/cex_evms_addresses.sql index 18acb039b82..9be8fcb6109 100644 --- a/dbt_subprojects/hourly_spellbook/models/_sector/cex/addresses/chains/cex_evms_addresses.sql +++ b/dbt_subprojects/hourly_spellbook/models/_sector/cex/addresses/chains/cex_evms_addresses.sql @@ -923,6 +923,9 @@ FROM (VALUES , (0xf6230e7e98d2bbebf96d14888020e9c3e8c27d69, 'Korbit', 'Korbit 10', 'hildobby', date '2024-05-04') , (0x223674cc4433a50caddf13c65f92151d75996e41, 'Korbit', 'Korbit 11', 'hildobby', date '2024-05-27') , (0x8e2040ab7a6af6bba67e6d9b280c6fea7f930c87, 'Korbit', 'Korbit 12', 'hildobby', date '2024-10-06') + , (0x3a70c2528265f0624e7ac8495b212a367b5b61b2, 'Korbit', 'Korbit 13', 'hildobby', date '2024-12-12') + , (0x5bd811987ee931ac85ed0eda8871282f9c5c88a4, 'Korbit', 'Korbit 14', 'hildobby', date '2024-12-12') + , (0x455ae9f6d25fd49ed7be9f3d8dd1cf58a79a5958, 'Korbit', 'Korbit 15', 'hildobby', date '2024-12-12') , (0xd17e26529e5fca53901f65f1a914317877cab08a, 'Korbit', 'Korbit Gas Supplier 1', 'hildobby', date '2024-10-06') , (0xd77f7f8868f20835fdfc8c7e851f6f23ce9f651d, 'Korbit', 'Korbit Gas Supplier 2', 'hildobby', date '2024-10-06') -- KuCoin @@ -1286,6 +1289,7 @@ FROM (VALUES , (0xee7c0bf91f9ac8117b490c8e028714acbcb41364, 'Bitstamp', 'Bitstamp 44', 'hildobby', date '2024-04-20') , (0xc3b7336d5a5158215599572012cedd4403a81629, 'Bitstamp', 'Bitstamp 45', 'hildobby', date '2024-05-04') , (0x3d9256ad37128e9f47b34a82e06e981719477c18, 'Bitstamp', 'Bitstamp 46', 'hildobby', date '2024-10-06') + , (0x1f69d824c3b4f906ac3fc8826e2391bcb9330e02, 'Bitstamp', 'Bitstamp 47', 'hildobby', date '2024-12-12') , (0xfca70e67b3f93f679992cd36323eeb5a5370c8e4, 'Bitstamp', 'Bitstamp Old Address 1', 'hildobby', date '2022-08-28') , (0x964771f6df31eea2d927fa71d7bd78e81bcdce05, 'Bitstamp', 'Bitstamp Contract 1', 'hildobby', date '2023-08-31') , (0x538d72ded42a76a30f730292da939e0577f22f57, 'Bitstamp', 'Bitstamp Deployer', 'hildobby', date '2023-08-31') @@ -2525,6 +2529,7 @@ FROM (VALUES , (0xc97a4ed29f03fd549c4ae79086673523122d2bc5, 'ZB.com', 'ZB.com 5', 'hildobby', date '2024-05-04') , (0x38b78904a6b44f63eb81d98937fc6614870cfbb9, 'ZB.com', 'ZB.com 6', 'hildobby', date '2024-05-04') , (0xf0d9fcb4fefdbd3e7929374b4632f8ad511bd7e3, 'ZB.com', 'ZB.com 7', 'hildobby', date '2024-10-06') + , (0xcb45822dfa8a65b97bc854a1a61b674153a42967, 'ZB.com', 'ZB.com 8', 'hildobby', date '2024-12-12') , (0x734ac651dd95a339c633cded410228515f97faff, 'ZB.com', 'ZB.com Gas Supplier 1', 'hildobby', date '2023-11-23') , (0xdb7248d26ea60170a4fdc2ea44dc839c9e8c9ee4, 'ZB.com', 'ZB.com Gas Supplier 2', 'hildobby', date '2024-05-04') , (0x5e91e8ccae2dd2c6db87f677e161ed1e07d6ccc8, 'ZB.com', 'ZB.com Gas Supplier 3', 'hildobby', date '2024-10-06') @@ -2689,6 +2694,7 @@ FROM (VALUES , (0xe2933566f172d08f8c90144fed5ae28e9d54b1ec, 'Woo X', 'Woo X Team', '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') + , (0xfa2d1f15557170f6c4a4c5249e77f534184cdb79, 'Woo X', 'Woo X Treasury 3', 'hildobby', date '2024-12-12') , (0xe64eb20471491956338eedc0f98242bc3ad0c91b, 'Woo X', 'Woo X Deployer 1', 'hildobby', date '2024-06-03') -- FastEx , (0x85e1de87a7575c6581f7930f857a3813b66a14d8, 'FastEx', 'FastEx 1', 'hildobby', date '2023-11-23') @@ -2773,6 +2779,7 @@ FROM (VALUES -- OPNX , (0x610887f0ae329557d1ae067f6b7697ff07032116, 'OPNX', 'OPNX 1', 'hildobby', date '2024-01-04') , (0xe5241ac645cad844e94a2e7486283ed6398fb3aa, 'OPNX', 'OPNX 2', 'hildobby', date '2024-01-04') + , (0x05d618a67786e4d078c0fbc8e601ad9765787c5d, 'OPNX', 'OPNX Safe 1', 'hildobby', date '2024-12-12') , (0xcd5f17b1fe981ba260c40c67e740b7290b50ea50, 'OPNX', 'OPNX Contract 1', 'hildobby', date '2024-01-04') , (0x78a0a62fba6fb21a83fe8a3433d44c73a4017a6f, 'OPNX', 'OPNX OX Token', 'hildobby', date '2024-01-04') , (0x28901cf869d94c9d892fbd86c8e57b801e8fdd87, 'OPNX', 'OPNX veOX Token', 'hildobby', date '2024-01-04') @@ -3173,4 +3180,9 @@ FROM (VALUES , (0x8f3ab2c3b651382b07a76653d2be9eb4b87e1630, 'YOOBTC', 'YOOBTC 1', 'hildobby', date '2024-05-25') -- Mbcbit , (0x5e6ad578fe3a2da7bbd0255f04179e1e77317d1a, 'Mbcbit', 'Mbcbit 1', 'hildobby', date '2024-07-05') + -- Arkham Exchange + , (0x679fb19dec9d66c34450a8563ffdfd29c04e615a, 'Arkham', 'Arkham 1', 'hildobby', date '2024-12-13') + , (0x0323718324218dcbff7c9f89ba5a5954f61a6c74, 'Arkham', 'Arkham 2', 'hildobby', date '2024-12-13') + , (0x34407900475cef87ace1597670a9a42f31961d02, 'Arkham', 'Arkham 3', 'hildobby', date '2024-12-13') + , (0xdc2822d0685c0cceab07b35d6de4ac9280fb9cff, 'Arkham', 'Arkham 4', 'hildobby', date '2024-12-13') ) AS x (address, cex_name, distinct_name, added_by, added_date) \ No newline at end of file diff --git a/dbt_subprojects/hourly_spellbook/models/_sector/dune/_schema.yml b/dbt_subprojects/hourly_spellbook/models/_sector/dune/_schema.yml new file mode 100644 index 00000000000..6c6e4f12e11 --- /dev/null +++ b/dbt_subprojects/hourly_spellbook/models/_sector/dune/_schema.yml @@ -0,0 +1,24 @@ +version: 2 + +models: + - name: dune_blockchains + meta: + sector: dune + contributors: 0xRob + description: > + Core table listing blockchains on Dune with meta info + columns: + - name: name + description: "The namespaces of the blockchain as used on Dune" + - name: chain_id + description: "The chain ID (only for EVM)" + - name: display_name + description: "Nicely formatted name" + - name: protocol + description: "evm or non_evm" + - name: token_address + description: "The token address used on Dune to represent the native token" + - name: token_symbol + description: "The token symbol of the native token" + - name: token_decimals + description: "The token decimals of the native token" diff --git a/dbt_subprojects/hourly_spellbook/models/_sector/dune/dune_blockchains.sql b/dbt_subprojects/hourly_spellbook/models/_sector/dune/dune_blockchains.sql new file mode 100644 index 00000000000..739b358e3c7 --- /dev/null +++ b/dbt_subprojects/hourly_spellbook/models/_sector/dune/dune_blockchains.sql @@ -0,0 +1,15 @@ +{{ config( + schema='dune', + alias = 'blockchains', + materialized = 'view', + post_hook='{{ expose_spells(\'["dune"]\', + "sector", + "dune", + \'["0xRob"]\') }}') +}} + +-- because the graphql endpoint often returns http error 403 when querying through http_get(), +-- we store the results in a matview instead and expose that one here with a view on top. +-- matview: https://dune.com/queries/4467416 +select * from +{{ source("dune", "result_blockchains", database="dune") }} diff --git a/dbt_subprojects/hourly_spellbook/models/_sector/lending/borrow/zksync/_schema.yml b/dbt_subprojects/hourly_spellbook/models/_sector/lending/borrow/zksync/_schema.yml index bc19690a235..02e1156a4f7 100644 --- a/dbt_subprojects/hourly_spellbook/models/_sector/lending/borrow/zksync/_schema.yml +++ b/dbt_subprojects/hourly_spellbook/models/_sector/lending/borrow/zksync/_schema.yml @@ -122,3 +122,39 @@ models: - *project_contract_address - *tx_hash - *evt_index + + - name: aave_v3_zksync_base_borrow + meta: + blockchain: zksync + sector: lending + project: aave + contributors: tomfutago + config: + tags: ['lending', 'borrow', 'aave', 'aave', 'zksync'] + description: "Aave v3 borrow transactions on zkSync" + data_tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - transaction_type + - token_address + - tx_hash + - evt_index + - check_lending_base_borrow_seed: + seed_file: ref('aave_zksync_base_borrow_seed') + columns: + - *blockchain + - *project + - *version + - *transaction_type + - *token_address + - *borrower + - *on_behalf_of + - *repayer + - *liquidator + - *amount + - *block_month + - *block_time + - *block_number + - *project_contract_address + - *tx_hash + - *evt_index diff --git a/dbt_subprojects/hourly_spellbook/models/_sector/lending/borrow/zksync/lending_zksync_base_borrow.sql b/dbt_subprojects/hourly_spellbook/models/_sector/lending/borrow/zksync/lending_zksync_base_borrow.sql index dbf3b1513d0..319851e2ca1 100644 --- a/dbt_subprojects/hourly_spellbook/models/_sector/lending/borrow/zksync/lending_zksync_base_borrow.sql +++ b/dbt_subprojects/hourly_spellbook/models/_sector/lending/borrow/zksync/lending_zksync_base_borrow.sql @@ -8,7 +8,8 @@ {% set models = [ - ref('zerolend_zksync_base_borrow') + ref('zerolend_zksync_base_borrow'), + ref('aave_v3_zksync_base_borrow') ] %} diff --git a/dbt_subprojects/hourly_spellbook/models/_sector/lending/borrow/zksync/platforms/aave_v3_zksync_base_borrow.sql b/dbt_subprojects/hourly_spellbook/models/_sector/lending/borrow/zksync/platforms/aave_v3_zksync_base_borrow.sql new file mode 100644 index 00000000000..3005353d5c0 --- /dev/null +++ b/dbt_subprojects/hourly_spellbook/models/_sector/lending/borrow/zksync/platforms/aave_v3_zksync_base_borrow.sql @@ -0,0 +1,19 @@ +{{ + config( + schema = 'aave_v3_zksync', + alias = 'base_borrow', + materialized = 'incremental', + file_format = 'delta', + incremental_strategy = 'merge', + unique_key = ['transaction_type', 'token_address', 'tx_hash', 'evt_index'], + incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.block_time')] + ) +}} + +{{ + lending_aave_v3_compatible_borrow( + blockchain = 'zksync', + project = 'aave', + version = '3' + ) +}} diff --git a/dbt_subprojects/hourly_spellbook/models/_sector/lending/flashloans/_schema.yml b/dbt_subprojects/hourly_spellbook/models/_sector/lending/flashloans/_schema.yml index 66d8e027203..894c67705cc 100644 --- a/dbt_subprojects/hourly_spellbook/models/_sector/lending/flashloans/_schema.yml +++ b/dbt_subprojects/hourly_spellbook/models/_sector/lending/flashloans/_schema.yml @@ -3,12 +3,12 @@ version: 2 models: - name: lending_flashloans meta: - blockchain: ethereum, celo, polygon, optimism, base, arbitrum, avalanche_c, fantom, gnosis, scroll, zksync + blockchain: ethereum, celo, polygon, optimism, base, arbitrum, avalanche_c, fantom, gnosis, zksync, zksync sector: lending project: aave contributors: tomfutago, hildobby config: - tags: ['lending', 'flashloans', 'aave', 'ethereum', 'celo', 'polygon', 'optimism', 'base', 'arbitrum', 'avalanche_c', 'fantom', 'gnosis', 'scroll', 'zksync'] + tags: ['lending', 'flashloans', 'aave', 'ethereum', 'celo', 'polygon', 'optimism', 'base', 'arbitrum', 'avalanche_c', 'fantom', 'gnosis', 'zksync', 'zksync'] description: "All lending transactions involving flashloans transactions" data_tests: - dbt_utils.unique_combination_of_columns: @@ -86,3 +86,34 @@ models: description: "Event index" data_tests: - not_null + + - name: aave_v3_zksync_base_flashloans + meta: + blockchain: zksync + sector: lending + project: aave + contributors: tomfutago + config: + tags: ['lending', 'flashloans', 'aave', 'zksync'] + description: "Aave v3 flashloans transactions on zkSync" + data_tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - tx_hash + - evt_index + - check_lending_base_flashloans_seed: + seed_file: ref('aave_zksync_base_flashloans_seed') + columns: + - *blockchain + - *project + - *version + - *recipient + - *amount + - *fee + - *token_address + - *project_contract_address + - *block_month + - *block_time + - *block_number + - *tx_hash + - *evt_index diff --git a/dbt_subprojects/hourly_spellbook/models/_sector/lending/flashloans/zksync/lending_zksync_base_flashloans.sql b/dbt_subprojects/hourly_spellbook/models/_sector/lending/flashloans/zksync/lending_zksync_base_flashloans.sql index ad81e72af5a..943eeea517b 100644 --- a/dbt_subprojects/hourly_spellbook/models/_sector/lending/flashloans/zksync/lending_zksync_base_flashloans.sql +++ b/dbt_subprojects/hourly_spellbook/models/_sector/lending/flashloans/zksync/lending_zksync_base_flashloans.sql @@ -8,7 +8,8 @@ {% set models = [ - ref('zerolend_zksync_base_flashloans') + ref('zerolend_zksync_base_flashloans'), + ref('aave_v3_zksync_base_flashloans') ] %} diff --git a/dbt_subprojects/hourly_spellbook/models/_sector/lending/flashloans/zksync/platforms/aave_v3_zksync_base_flashloans.sql b/dbt_subprojects/hourly_spellbook/models/_sector/lending/flashloans/zksync/platforms/aave_v3_zksync_base_flashloans.sql new file mode 100644 index 00000000000..821ae724b6c --- /dev/null +++ b/dbt_subprojects/hourly_spellbook/models/_sector/lending/flashloans/zksync/platforms/aave_v3_zksync_base_flashloans.sql @@ -0,0 +1,19 @@ +{{ + config( + schema = 'aave_v3_zksync', + alias = 'base_flashloans', + materialized = 'incremental', + file_format = 'delta', + incremental_strategy = 'merge', + unique_key = ['tx_hash', 'evt_index'], + incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.block_time')] + ) +}} + +{{ + lending_aave_v3_compatible_flashloans( + blockchain = 'zksync', + project = 'aave', + version = '3' + ) +}} diff --git a/dbt_subprojects/hourly_spellbook/models/_sector/lending/supply/ethereum/platforms/aave_lido_v3_ethereum_base_supply.sql b/dbt_subprojects/hourly_spellbook/models/_sector/lending/supply/ethereum/platforms/aave_lido_v3_ethereum_base_supply.sql index 2d19eebd8c1..4e30a0cd6a6 100644 --- a/dbt_subprojects/hourly_spellbook/models/_sector/lending/supply/ethereum/platforms/aave_lido_v3_ethereum_base_supply.sql +++ b/dbt_subprojects/hourly_spellbook/models/_sector/lending/supply/ethereum/platforms/aave_lido_v3_ethereum_base_supply.sql @@ -15,6 +15,7 @@ blockchain = 'ethereum', project = 'aave_lido', version = '3', - decoded_contract_name = 'LidoPool' + decoded_contract_name = 'LidoPool', + decoded_wrapped_token_gateway_name = 'LidoWrappedTokenGatewayV3' ) }} diff --git a/dbt_subprojects/hourly_spellbook/models/_sector/lending/supply/zksync/_schema.yml b/dbt_subprojects/hourly_spellbook/models/_sector/lending/supply/zksync/_schema.yml index e5b4b2c38a4..ec65df69324 100644 --- a/dbt_subprojects/hourly_spellbook/models/_sector/lending/supply/zksync/_schema.yml +++ b/dbt_subprojects/hourly_spellbook/models/_sector/lending/supply/zksync/_schema.yml @@ -122,3 +122,39 @@ models: - *project_contract_address - *tx_hash - *evt_index + + - name: aave_v3_zksync_base_supply + meta: + blockchain: zksync + sector: lending + project: aave + contributors: tomfutago + config: + tags: ['lending', 'supply', 'aave', 'zksync'] + description: "Aave v3 supply transactions on zkSync" + data_tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - transaction_type + - token_address + - tx_hash + - evt_index + - check_lending_base_supply_seed: + seed_file: ref('aave_zksync_base_supply_seed') + columns: + - *blockchain + - *project + - *version + - *transaction_type + - *token_address + - *depositor + - *on_behalf_of + - *withdrawn_to + - *liquidator + - *amount + - *block_month + - *block_time + - *block_number + - *project_contract_address + - *tx_hash + - *evt_index diff --git a/dbt_subprojects/hourly_spellbook/models/_sector/lending/supply/zksync/lending_zksync_base_supply.sql b/dbt_subprojects/hourly_spellbook/models/_sector/lending/supply/zksync/lending_zksync_base_supply.sql index 4cbc152960f..831f1cc0f72 100644 --- a/dbt_subprojects/hourly_spellbook/models/_sector/lending/supply/zksync/lending_zksync_base_supply.sql +++ b/dbt_subprojects/hourly_spellbook/models/_sector/lending/supply/zksync/lending_zksync_base_supply.sql @@ -8,7 +8,8 @@ {% set models = [ - ref('zerolend_zksync_base_supply') + ref('zerolend_zksync_base_supply'), + ref('aave_v3_zksync_base_supply') ] %} diff --git a/dbt_subprojects/hourly_spellbook/models/_sector/lending/supply/zksync/platforms/aave_v3_zksync_base_supply.sql b/dbt_subprojects/hourly_spellbook/models/_sector/lending/supply/zksync/platforms/aave_v3_zksync_base_supply.sql new file mode 100644 index 00000000000..9b51483bad5 --- /dev/null +++ b/dbt_subprojects/hourly_spellbook/models/_sector/lending/supply/zksync/platforms/aave_v3_zksync_base_supply.sql @@ -0,0 +1,19 @@ +{{ + config( + schema = 'aave_v3_zksync', + alias = 'base_supply', + materialized = 'incremental', + file_format = 'delta', + incremental_strategy = 'merge', + unique_key = ['transaction_type', 'token_address', 'tx_hash', 'evt_index'], + incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.block_time')] + ) +}} + +{{ + lending_aave_v3_compatible_supply( + blockchain = 'zksync', + project = 'aave', + version = '3' + ) +}} diff --git a/dbt_subprojects/hourly_spellbook/seeds/_sector/lending/_schema.yml b/dbt_subprojects/hourly_spellbook/seeds/_sector/lending/_schema.yml index f434216529b..213fd274c94 100644 --- a/dbt_subprojects/hourly_spellbook/seeds/_sector/lending/_schema.yml +++ b/dbt_subprojects/hourly_spellbook/seeds/_sector/lending/_schema.yml @@ -168,6 +168,20 @@ seeds: token_address: varbinary borrower: varbinary amount: double + - name: aave_zksync_base_borrow_seed + config: + column_types: + blockchain: varchar + project: varchar + version: varchar + block_number: bigint + block_time: timestamp + tx_hash: varbinary + evt_index: bigint + transaction_type: varchar + token_address: varbinary + borrower: varbinary + amount: double - name: aave_arbitrum_base_supply_seed config: @@ -337,6 +351,20 @@ seeds: token_address: varbinary depositor: varbinary amount: double + - name: aave_zksync_base_supply_seed + config: + column_types: + blockchain: varchar + project: varchar + version: varchar + block_number: bigint + block_time: timestamp + tx_hash: varbinary + evt_index: bigint + transaction_type: varchar + token_address: varbinary + depositor: varbinary + amount: double - name: aave_arbitrum_base_flashloans_seed config: @@ -494,6 +522,19 @@ seeds: token_address: varbinary recipient: varbinary amount: double + - name: aave_zksync_base_flashloans_seed + config: + column_types: + blockchain: varchar + project: varchar + version: varchar + block_number: bigint + block_time: timestamp + tx_hash: varbinary + evt_index: bigint + token_address: varbinary + recipient: varbinary + amount: double - name: moola_celo_base_borrow_seed config: diff --git a/dbt_subprojects/hourly_spellbook/seeds/_sector/lending/aave_zksync_base_borrow_seed.csv b/dbt_subprojects/hourly_spellbook/seeds/_sector/lending/aave_zksync_base_borrow_seed.csv new file mode 100644 index 00000000000..37a024abb8c --- /dev/null +++ b/dbt_subprojects/hourly_spellbook/seeds/_sector/lending/aave_zksync_base_borrow_seed.csv @@ -0,0 +1,4 @@ +blockchain,project,version,block_number,block_time,tx_hash,evt_index,transaction_type,token_address,borrower,amount +zksync,aave,3,51909048,2024-12-22 12:56:09.000 UTC,0x087a9163c4b4c34a26adb3155ad62de8883d413fdfeb1236f84b6260bec9da48,7,borrow,0x1d17cbcf0d6d143135ae902365d2e5e2a16538d4,0x72fe12b5127162f8f3d1eec3f9d232c98a032f23,110000000 +zksync,aave,3,51750031,2024-12-20 11:29:08.000 UTC,0x3a7548fe223e51d74cd4cd2bedcf9122e4853f4209cac2c49e7e9b068c90ebf2,18,borrow_liquidation,0x1d17cbcf0d6d143135ae902365d2e5e2a16538d4,0xd3b2a586180c9e306b38848d31e82f9e17d76f0c,-2770807444 +zksync,aave,3,51907646,2024-12-22 12:30:24.000 UTC,0xac913e1cb652b2aaf1aab9e886803c2d27a45f2ebd2b564548b8c5c2012d5021,14,repay,0x1d17cbcf0d6d143135ae902365d2e5e2a16538d4,0x5ba9811dff37ca8639272d509dcadfe5bec4bff7,-4100000 diff --git a/dbt_subprojects/hourly_spellbook/seeds/_sector/lending/aave_zksync_base_flashloans_seed.csv b/dbt_subprojects/hourly_spellbook/seeds/_sector/lending/aave_zksync_base_flashloans_seed.csv new file mode 100644 index 00000000000..d7129e1a2c0 --- /dev/null +++ b/dbt_subprojects/hourly_spellbook/seeds/_sector/lending/aave_zksync_base_flashloans_seed.csv @@ -0,0 +1,4 @@ +blockchain,project,version,block_number,block_time,tx_hash,evt_index,token_address,recipient,amount +zksync,aave,3,51741885,2024-12-20 09:08:30.000 UTC,0x37aa4e84eb810f3cce179819b68a37acdd53104d799e60a851e75f5775faab24,28,0x1d17cbcf0d6d143135ae902365d2e5e2a16538d4,0x41c914a4a619b7969137551904a537db16905d1f,2504231355 +zksync,aave,3,51741825,2024-12-20 09:07:29.000 UTC,0x0fa867dd6cccb34159b8bfee8a1757a1af6a3e37f7f2af2f58caab044e684826,28,0x1d17cbcf0d6d143135ae902365d2e5e2a16538d4,0x41c914a4a619b7969137551904a537db16905d1f,210563615 +zksync,aave,3,51692496,2024-12-19 18:24:06.000 UTC,0x433e9869c81ae380c4ab360ad6a14a1d56e22a1adf7734b5415bb31485aac494,32,0x493257fd37edb34451f62edf8d2a0c418852ba4c,0x41c914a4a619b7969137551904a537db16905d1f,15509265 diff --git a/dbt_subprojects/hourly_spellbook/seeds/_sector/lending/aave_zksync_base_supply_seed.csv b/dbt_subprojects/hourly_spellbook/seeds/_sector/lending/aave_zksync_base_supply_seed.csv new file mode 100644 index 00000000000..28c24921051 --- /dev/null +++ b/dbt_subprojects/hourly_spellbook/seeds/_sector/lending/aave_zksync_base_supply_seed.csv @@ -0,0 +1,5 @@ +blockchain,project,version,block_number,block_time,tx_hash,evt_index,transaction_type,token_address,depositor,amount +zksync,aave,3,51910059,2024-12-22 13:14:37.000 UTC,0xf9fd60b0434f3b32e6f71bffa3d931f570f67fb79e9d5a3856e864c3d413d729,8,deposit,0x5a7d6b2f92c77fad6ccabd7ee0624e64907eaf3e,0xb34247a2ff891caec36375d0e58f95f8d9bf38d6,100000000000000000000 +zksync,aave,3,51750031,2024-12-20 11:29:08.000 UTC,0x3a7548fe223e51d74cd4cd2bedcf9122e4853f4209cac2c49e7e9b068c90ebf2,18,deposit_liquidation,0x5a7d6b2f92c77fad6ccabd7ee0624e64907eaf3e,0xd3b2a586180c9e306b38848d31e82f9e17d76f0c,-1.9198338954322615e+22 +zksync,aave,3,51215930,2024-12-13 18:06:30.000 UTC,0x8f3e895a74a183300d417869bcaac0edf03a65a9d737af686d222a63967e76f6,8,repay_with_atokens,0x1d17cbcf0d6d143135ae902365d2e5e2a16538d4,0x8a8a757c4c3cbb85450dfb70e61fbcbae3994054,-491998467 +zksync,aave,3,51908987,2024-12-22 12:55:05.000 UTC,0x1bf91b597c04a36bcb2d9e7c7e7c3260eb79ebe62f47a6746f5c615511e075dc,26,withdraw,0x5aea5775959fbc2557cc8789bc1bf90a239d9a91,0xd5f6c8d402e0a0222f7fa132f9e80fdcc074df5c,-20000005150310010 diff --git a/dbt_subprojects/nft/models/_sector/trades/chains/ronin/nft_ronin_base_trades.sql b/dbt_subprojects/nft/models/_sector/trades/chains/ronin/nft_ronin_base_trades.sql new file mode 100644 index 00000000000..83f699e3415 --- /dev/null +++ b/dbt_subprojects/nft/models/_sector/trades/chains/ronin/nft_ronin_base_trades.sql @@ -0,0 +1,49 @@ +{{ config( + schema = 'nft_ronin', + alias = 'base_trades', + materialized = 'view' + ) +}} +-- (project, project_version, model) +{% set nft_models = [ + ref('mavis_ronin_base_trades') +] %} + +with base_union as ( +SELECT * FROM ( +{% for nft_model in nft_models %} + SELECT + blockchain, + project, + project_version, + block_time, + block_date, + block_month, + block_number, + tx_hash, + project_contract_address, + trade_category, + trade_type, + buyer, + seller, + nft_contract_address, + nft_token_id, + nft_amount, + price_raw, + currency_contract, + platform_fee_amount_raw, + royalty_fee_amount_raw, + platform_fee_address, + royalty_fee_address, + sub_tx_trade_id, + tx_from, + tx_to, + tx_data_marker + FROM {{ nft_model }} + {% if not loop.last %} + UNION ALL + {% endif %} + {% endfor %} + ) +) +select * from base_union diff --git a/dbt_subprojects/nft/models/_sector/trades/chains/ronin/platforms/_schema.yml b/dbt_subprojects/nft/models/_sector/trades/chains/ronin/platforms/_schema.yml new file mode 100644 index 00000000000..9da694d9865 --- /dev/null +++ b/dbt_subprojects/nft/models/_sector/trades/chains/ronin/platforms/_schema.yml @@ -0,0 +1,12 @@ +version: 2 + +models: + - name: mavis_ronin_base_trades + meta: + blockchain: ronin + sector: nft + project: mavis_ronin + contributors: ['peterrliem' ] + config: + tags: [ 'ronin', 'nft', 'trades', 'mavis' ] + description: "mavis marketplace base trades" diff --git a/dbt_subprojects/nft/models/_sector/trades/chains/ronin/platforms/mavis_ronin_base_trades.sql b/dbt_subprojects/nft/models/_sector/trades/chains/ronin/platforms/mavis_ronin_base_trades.sql new file mode 100644 index 00000000000..d7ef5b9c292 --- /dev/null +++ b/dbt_subprojects/nft/models/_sector/trades/chains/ronin/platforms/mavis_ronin_base_trades.sql @@ -0,0 +1,92 @@ +{{ config( + schema = 'mavis_ronin', + alias = 'base_trades', + materialized = 'incremental', + file_format = 'delta', + incremental_strategy = 'merge', + unique_key = ['block_number','tx_hash','sub_tx_trade_id'], + ) +}} + + +with trade_details as ( + +select + evt_block_time as block_time, + evt_block_date as block_date, + evt_block_number as block_number, + evt_tx_hash as tx_hash, + evt_tx_from as tx_from, + evt_tx_to as tx_to, + evt_index, + contract_address, + COALESCE(FROM_HEX(json_extract_scalar(json_parse(cast(concat('[', array_join(receivedAllocs, ','), ']') as varchar)),'$[5].recipient')),FROM_HEX(json_extract_scalar(json_parse(json_extract_scalar("order", '$.info')), '$.maker'))) as seller, + FROM_HEX(json_extract_scalar("order", '$.recipient')) as buyer, + json_extract_scalar(json_parse(json_extract_scalar("order", '$.info')), '$.kind') as kind, + cast(json_extract_scalar(replace(json_extract_scalar(json_parse(json_extract_scalar("order", '$.info')),'$.assets[0]'),'\\', ''),'$.erc') as double) as erc, + FROM_HEX(json_extract_scalar(replace(json_extract_scalar(json_parse(json_extract_scalar("order", '$.info')),'$.assets[0]'),'\\', ''),'$.addr')) as nft_contract_address, + cast(json_extract_scalar(replace(json_extract_scalar(json_parse(json_extract_scalar("order", '$.info')),'$.assets[0]'),'\\', ''),'$.id') as double) as nft_token_id, + case + when cast(json_extract_scalar(replace(json_extract_scalar(json_parse(json_extract_scalar("order", '$.info')),'$.assets[0]'),'\\', ''),'$.quantity') as double) = 0 then 1 + else cast(json_extract_scalar(replace(json_extract_scalar(json_parse(json_extract_scalar("order", '$.info')),'$.assets[0]'),'\\', ''),'$.quantity') as double) + end as quantity, + FROM_HEX(json_extract_scalar(json_parse(json_extract_scalar("order", '$.info')), '$.paymentToken')) as currency_address, + CAST(json_extract_scalar("order", '$.realPrice') AS DOUBLE) as price_raw, + CAST(json_extract_scalar(json_parse(json_extract_scalar("order", '$.info')), '$.baseUnitPrice') AS DOUBLE) as base_unit_price_raw, + FROM_HEX(json_extract_scalar("order", '$.refunder')) as refunder, + FROM_HEX(json_extract_scalar(json_parse(cast(concat('[', array_join(receivedAllocs, ','), ']') as varchar)),'$[1].recipient')) as platform_address, + CAST(json_extract_scalar(json_parse(cast(concat('[', array_join(receivedAllocs, ','), ']') as varchar)),'$[1].value') AS DOUBLE) as platform_fee_amount_raw, + FROM_HEX(json_extract_scalar(json_parse(cast(concat('[', array_join(receivedAllocs, ','), ']') as varchar)),'$[2].recipient')) as axie_treasury_address, + CAST(json_extract_scalar(json_parse(cast(concat('[', array_join(receivedAllocs, ','), ']') as varchar)),'$[2].ratio') AS DOUBLE) as axie_fee_raw, + CAST(json_extract_scalar(json_parse(cast(concat('[', array_join(receivedAllocs, ','), ']') as varchar)),'$[2].value') AS DOUBLE) as axie_fee_amount_raw, + FROM_HEX(json_extract_scalar(json_parse(cast(concat('[', array_join(receivedAllocs, ','), ']') as varchar)),'$[3].recipient')) as ronin_treasury_address, + CAST(json_extract_scalar(json_parse(cast(concat('[', array_join(receivedAllocs, ','), ']') as varchar)),'$[3].ratio') AS DOUBLE) as ronin_fee, + CAST(json_extract_scalar(json_parse(cast(concat('[', array_join(receivedAllocs, ','), ']') as varchar)),'$[3].value') AS DOUBLE) as ronin_treasury_fee_amount_raw, + FROM_HEX(json_extract_scalar(json_parse(cast(concat('[', array_join(receivedAllocs, ','), ']') as varchar)),'$[4].recipient')) as creator_royalty_address, + CAST(json_extract_scalar(json_parse(cast(concat('[', array_join(receivedAllocs, ','), ']') as varchar)),'$[4].ratio') AS DOUBLE) as creator_royalty_fee, + CAST(json_extract_scalar(json_parse(cast(concat('[', array_join(receivedAllocs, ','), ']') as varchar)),'$[4].value') AS DOUBLE) as creator_royalty_fee_amount_raw, + CAST(json_extract_scalar(json_parse(cast(concat('[', array_join(receivedAllocs, ','), ']') as varchar)),'$[5].ratio')AS DOUBLE) AS seller_percentage_fee, + CAST(json_extract_scalar(json_parse(cast(concat('[', array_join(receivedAllocs, ','), ']') as varchar)),'$[5].value')AS DOUBLE) AS seller_amount_raw + FROM + {{ source('mavis_marketplace_ronin','MavisMarketPlace_evt_OrderMatched') }} + {% if is_incremental() %} + WHERE {{incremental_predicate('evt_block_time')}} + {% endif %} + ), + +base_trades as ( + + select + 'ronin' as blockchain, + 'mavis market' as project, + 'v1' as project_version, + block_time, + cast(date_trunc('day', block_time) as date) as block_date, + cast(date_trunc('month', block_time) as date) as block_month, + block_number, + nft_contract_address, + nft_token_id, + quantity as nft_amount, + seller, + buyer, + 'buy' as trade_category, + 'secondary' as trade_type, + price_raw, + currency_address as currency_contract, + contract_address as project_contract_address, + tx_hash, + platform_address as platform_fee_address, + platform_fee_amount_raw, + creator_royalty_address as royalty_fee_address, + creator_royalty_fee_amount_raw as royalty_fee_amount_raw, + axie_fee_amount_raw, + ronin_treasury_fee_amount_raw, + evt_index as sub_tx_trade_id + FROM trade_details + ) + +-- this will be removed once tx_from and tx_to are available in the base event tables +{{ add_nft_tx_data('base_trades', 'ronin') }} + + + diff --git a/dbt_subprojects/nft/models/_sector/trades/nft_base_trades.sql b/dbt_subprojects/nft/models/_sector/trades/nft_base_trades.sql index d9d70881f68..5454934eb2e 100644 --- a/dbt_subprojects/nft/models/_sector/trades/nft_base_trades.sql +++ b/dbt_subprojects/nft/models/_sector/trades/nft_base_trades.sql @@ -27,6 +27,7 @@ ,ref('nft_blast_base_trades') ,ref('nft_fantom_base_trades') ,ref('nft_nova_base_trades') + ,ref('nft_ronin_base_trades') ] %} with base_union as ( diff --git a/dbt_subprojects/nft/models/_sector/trades/nft_trades.sql b/dbt_subprojects/nft/models/_sector/trades/nft_trades.sql index d060f52e9f5..ba3ffe325d1 100644 --- a/dbt_subprojects/nft/models/_sector/trades/nft_trades.sql +++ b/dbt_subprojects/nft/models/_sector/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", "blast"]\', + post_hook='{{ expose_spells(\'["ethereum","solana","bnb","optimism","arbitrum","polygon","zksync", "blast", "ronin", "nova"]\', "sector", "nft", \'["soispoke","0xRob", "hildobby"]\') }}') diff --git a/dbt_subprojects/nft/models/nft_metrics/ethereum/metadata/nft_ethereum_metadata_xcopy_collections.sql b/dbt_subprojects/nft/models/nft_metrics/ethereum/metadata/nft_ethereum_metadata_xcopy_collections.sql index cb3eb9a7ef9..98f6fbaef49 100644 --- a/dbt_subprojects/nft/models/nft_metrics/ethereum/metadata/nft_ethereum_metadata_xcopy_collections.sql +++ b/dbt_subprojects/nft/models/nft_metrics/ethereum/metadata/nft_ethereum_metadata_xcopy_collections.sql @@ -126,9 +126,12 @@ from (VALUES , ('E X P O S U R E', 'Edition', 'KnownOrigin', 25, 'Ethereum', 'erc721', 0xFBeef911Dc5821886e1dda71586d90eD28174B7d, 119326, 119350, '', 'https://opensea.io/collection/xcopy-knownorigin?search[stringTraits][0][name]=Tag&search[stringTraits][0][values][0]=exposure&search[sortAscending]=true&search[sortBy]=UNIT_PRICE','2020-01-20') , ('BLOOD BUBBLE', 'Edition', 'KnownOrigin', 25, 'Ethereum', 'erc721', 0xFBeef911Dc5821886e1dda71586d90eD28174B7d, 115026, 115050, '', 'https://opensea.io/collection/xcopy-knownorigin?search[collections][0]=xcopy-knownorigin&search[query]=blood%20bubble','2020-01-12') , ('BLOOD RUN', 'Unique', 'SuperRare', 1, 'Ethereum', 'erc721', 0xb932a70a57673d89f4acffbe830e8ed7f75fb9e0, 7009, 7009, '', 'https://superrare.com/artwork/eth/0xb932a70a57673d89f4acffbe830e8ed7f75fb9e0/7009','2020-01-11') - , ('THE RABBLE', 'Layer', 'Async Art', 44, 'Ethereum', 'erc721', 0xb6dAe651468E9593E4581705a09c10A76AC1e0c8, 432, 475, '', 'https://xcopy.art/works/the-rabble','2020-01-01') + , ('THE RABBLE 1/1', 'Unique', 'Async Art', 1, 'Ethereum', 'erc721', 0xb6dAe651468E9593E4581705a09c10A76AC1e0c8, 432, 432, '', 'https://xcopy.art/works/the-rabble','2020-01-01') + , ('BANKSTA 1/1', 'Unique', 'Async Art', 1, 'Ethereum', 'erc721', 0x6c424C25e9F1ffF9642cB5B7750b0Db7312c29ad, 28, 28, '', 'https://xcopy.art/works/banksta','2020-01-01') + , ('DOOM PARTY 1/1', 'Unique', 'Async Art', 1, 'Ethereum', 'erc721', 0xb6dAe651468E9593E4581705a09c10A76AC1e0c8, 199, 199, '', 'https://xcopy.art/works/doom-party','2020-01-01') + , ('THE RABBLE', 'Layer', 'Async Art', 43, 'Ethereum', 'erc721', 0xb6dAe651468E9593E4581705a09c10A76AC1e0c8, 433, 475, '', 'https://xcopy.art/works/the-rabble','2020-01-01') , ('BANKSTA', 'Layer', 'Async Art', 8, 'Ethereum', 'erc721', 0x6c424C25e9F1ffF9642cB5B7750b0Db7312c29ad, 29, 36, '', 'https://xcopy.art/works/banksta','2020-01-01') - , ('DOOM PARTY', 'Layer', 'Async Art', 12, 'Ethereum', 'erc721', 0xb6dAe651468E9593E4581705a09c10A76AC1e0c8, 199, 210, '', 'https://xcopy.art/works/doom-party','2020-01-01') + , ('DOOM PARTY', 'Layer', 'Async Art', 11, 'Ethereum', 'erc721', 0xb6dAe651468E9593E4581705a09c10A76AC1e0c8, 200, 210, '', 'https://xcopy.art/works/doom-party','2020-01-01') , ('RESIST', 'Edition', 'KnownOrigin', 25, 'Ethereum', 'erc721', 0xFBeef911Dc5821886e1dda71586d90eD28174B7d, 109251, 109275, '', 'https://opensea.io/collection/xcopy-knownorigin?search[collections][0]=xcopy-knownorigin&search[query]=resist','2019-12-31') , ('FOMO', 'Unique', 'SuperRare', 1, 'Ethereum', 'erc721', 0xb932a70a57673d89f4acffbe830e8ed7f75fb9e0, 6708, 6708, '', 'https://superrare.com/artwork/eth/0xb932a70a57673d89f4acffbe830e8ed7f75fb9e0/6708','2019-12-31') , ('THE DAMAGE', 'Edition', 'KnownOrigin', 25, 'Ethereum', 'erc721', 0xFBeef911Dc5821886e1dda71586d90eD28174B7d, 108701, 108725, '', 'https://opensea.io/collection/xcopy-knownorigin?search[collections][0]=xcopy-knownorigin&search[query]=the%20damage','2019-12-30') diff --git a/dbt_subprojects/tokens/dbt_project.yml b/dbt_subprojects/tokens/dbt_project.yml index 4ab163deb41..582d4218748 100644 --- a/dbt_subprojects/tokens/dbt_project.yml +++ b/dbt_subprojects/tokens/dbt_project.yml @@ -23,6 +23,12 @@ vars: DBT_ENV_INCREMENTAL_TIME_UNIT: "{{ env_var('DBT_ENV_INCREMENTAL_TIME_UNIT', 'day') }}" ETH_ERC20_ADDRESS: '0x0000000000000000000000000000000000000000' +# Configuring tests +# Full documentation: https://docs.getdbt.com/reference/test-configs +data_tests: + tokens: + +store_failures: true # store failures for all tests + # These configurations specify where dbt should look for different types of files. # You don't need to change these! model-paths: ["models", "../../sources"] diff --git a/dbt_subprojects/tokens/models/prices/arbitrum/prices_arbitrum_tokens.sql b/dbt_subprojects/tokens/models/prices/arbitrum/prices_arbitrum_tokens.sql index 0d231d726fc..31b062b768d 100644 --- a/dbt_subprojects/tokens/models/prices/arbitrum/prices_arbitrum_tokens.sql +++ b/dbt_subprojects/tokens/models/prices/arbitrum/prices_arbitrum_tokens.sql @@ -229,6 +229,6 @@ FROM ('usdm-mountain-protocol-usd', 'arbitrum', 'USDM', 0x59d9356e565ab3a36dd77763fc0d87feaf85508c, 18), ('usdz-anzen-usdz', 'arbitrum', 'USDZ', 0x5018609ab477cc502e170a5accf5312b86a4b94f, 18), ('trb-tellor', 'arbitrum', 'TRB', 0xd58d345fd9c82262e087d2d0607624b410d88242, 18), - ('mor-morpheusai', 'arbitrum', 'MOR', 0x092baadb7def4c3981454dd9c0a0d7ff07bcfc86, 18) - + ('mor-morpheusai', 'arbitrum', 'MOR', 0x092baadb7def4c3981454dd9c0a0d7ff07bcfc86, 18), + ('usdx-usdxmoney-usdx', 'arbitrum', 'USDX', 0xf3527ef8dE265eAa3716FB312c12847bFBA66Cef, 18) ) as temp (token_id, blockchain, symbol, contract_address, decimals) diff --git a/dbt_subprojects/tokens/models/prices/corn/_schema.yml b/dbt_subprojects/tokens/models/prices/corn/_schema.yml new file mode 100644 index 00000000000..db32a0ff44c --- /dev/null +++ b/dbt_subprojects/tokens/models/prices/corn/_schema.yml @@ -0,0 +1,29 @@ +version: 2 + +models: + - name: prices_corn_tokens + meta: + blockchain: corn + sector: prices + contributors: hosuke + config: + tags: ['prices', 'tokens', 'usd', 'corn'] + description: "Price tokens on Corn EVM chain" + data_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" + data_tests: + - accepted_values: + values: [ "corn" ] + - 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/dbt_subprojects/tokens/models/prices/corn/prices_corn_tokens.sql b/dbt_subprojects/tokens/models/prices/corn/prices_corn_tokens.sql new file mode 100644 index 00000000000..484e6758742 --- /dev/null +++ b/dbt_subprojects/tokens/models/prices/corn/prices_corn_tokens.sql @@ -0,0 +1,25 @@ +{% set blockchain = 'corn' %} + +{{ config( + schema = 'prices_' + blockchain, + alias = 'tokens', + materialized = 'table', + file_format = 'delta', + tags = ['static'] + ) +}} + +SELECT + token_id + , '{{ blockchain }}' as blockchain + , symbol + , contract_address + , decimals +FROM +( + VALUES + ('wbtc-wrapped-bitcoin', 'wBTCN', 0xda5ddd7270381a7c2717ad10d1c0ecb19e3cdfb2, 18) + , ('lbtc-lombard-staked-btc', 'LBTC', 0xecAc9C5F704e954931349Da37F60E39f515c11c1, 8) + , ('usdce-usd-coine', 'USDC.e', 0xDF0B24095e15044538866576754F3C964e902Ee6, 6) + , ('pumpbtc-pumpbtc', 'pumpBTC', 0xF469fBD2abcd6B9de8E169d128226C0Fc90a012e, 8) +) as temp (token_id, symbol, contract_address, decimals) diff --git a/dbt_subprojects/tokens/models/prices/ethereum/prices_ethereum_tokens.sql b/dbt_subprojects/tokens/models/prices/ethereum/prices_ethereum_tokens.sql index 7a0a384527d..d489c9117b5 100644 --- a/dbt_subprojects/tokens/models/prices/ethereum/prices_ethereum_tokens.sql +++ b/dbt_subprojects/tokens/models/prices/ethereum/prices_ethereum_tokens.sql @@ -1255,7 +1255,6 @@ FROM ('donk-donkey', 'ethereum', 'DONK', 0xe4f6d46c244bb7cf3e218cdfb5c35cf9a4d9c920, 18), ('evn-evolution-finance', 'ethereum', 'EVN', 0x9af15d7b8776fa296019979e70a5be53c714a7ec, 18), ('fair-fairgame', 'ethereum', 'FAIR', 0x9b20dabcec77f6289113e61893f7beefaeb1990a, 18), - ('gm-gm-token', 'ethereum', 'GM', 0xbc7250c8c3eca1dfc1728620af835fca489bfdf3, 9), ('gnft-gnft', 'ethereum', 'GNFT', 0xc502002aeb1b9309fccb016adf50507987fc6c2b, 18), ('happy-happyfans', 'ethereum', 'HAPPY', 0x3079f61704e9efa2bcf1db412f735d8d4cfa26f4, 18), ('hmt-human-protocol', 'ethereum', 'HMT', 0xd1ba9bac957322d6e8c07a160a3a8da11a0d2867, 18), @@ -1900,4 +1899,5 @@ where contract_address not in ( ,0xee06a81a695750e71a662b51066f2c74cf4478a0 -- DG, bad price feed ,0x9e24415d1e549ebc626a13a482bb117a2b43e9cf -- LOVELY, rugpull ,0xe9689028ede16c2fdfe3d11855d28f8e3fc452a3 -- BUBBLE, bad price feed + ,0xbc7250c8c3eca1dfc1728620af835fca489bfdf3 -- GM, bad price feed ) diff --git a/dbt_subprojects/tokens/models/prices/prices_tokens.sql b/dbt_subprojects/tokens/models/prices/prices_tokens.sql index 0f38cb25f82..de81356874e 100644 --- a/dbt_subprojects/tokens/models/prices/prices_tokens.sql +++ b/dbt_subprojects/tokens/models/prices/prices_tokens.sql @@ -14,6 +14,7 @@ , "boba" , "cardano" , "celo" + , "corn" , "ethereum" , "fantom" , "flare" @@ -27,6 +28,7 @@ , "scroll" , "sei" , "solana" + , "sonic" , "viction" , "worldchain" , "zksync" @@ -70,6 +72,8 @@ ref('prices_native_tokens') ,ref('prices_ronin_tokens') ,ref('prices_boba_tokens') ,ref('prices_viction_tokens') +,ref('prices_corn_tokens') +,ref('prices_sonic_tokens') ] %} diff --git a/dbt_subprojects/tokens/models/prices/prices_trusted_tokens.sql b/dbt_subprojects/tokens/models/prices/prices_trusted_tokens.sql index cb20a76eda0..69e5bcde143 100644 --- a/dbt_subprojects/tokens/models/prices/prices_trusted_tokens.sql +++ b/dbt_subprojects/tokens/models/prices/prices_trusted_tokens.sql @@ -61,6 +61,10 @@ WITH trusted_tokens AS ( , ('celo', 0xd629eb00deced2a080b7ec630ef6ac117e614f1b) , ('celo', 0x639a647fbe20b6c8ac19e48e2de44ea792c62c5c) , ('celo', 0x48065fbbe25f71c9282ddf5e1cd6d6a887483d5e) + , ('corn', 0xda5ddd7270381a7c2717ad10d1c0ecb19e3cdfb2) -- WBTCN + , ('corn', 0xecac9c5f704e954931349da37f60e39f515c11c1) -- LBTC + , ('corn', 0xdf0b24095e15044538866576754f3c964e902ee6) -- USDC.e + , ('corn', 0xf469fbd2abcd6b9de8e169d128226c0fc90a012e) -- pumpBTC , ('ethereum', 0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2) , ('ethereum', 0xdac17f958d2ee523a2206206994597c13d831ec7) , ('ethereum', 0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48) @@ -143,6 +147,12 @@ WITH trusted_tokens AS ( , ('solana', from_base58('mSoLzYCxHdYgdzU16g5QSh3i5K3z3KZK7ytfqcJm7So')) , ('solana', from_base58('Es9vMFrzaCERmJfrF4H2FYD4KCoNkY11McCe8BenwNYB')) , ('solana', from_base58('EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v')) + , ('sonic', 0x039e2fB66102314Ce7b64Ce5Ce3E5183bc94aD38) + , ('sonic', 0x29219dd400f2Bf60E5a23d13Be72B486D4038894) + , ('sonic', 0x50c42dEAcD8Fc9773493ED674b675bE577f2634b) + , ('sonic', 0xe715cba7b5ccb33790cebff1436809d36cb17e57) + , ('sonic', 0xd3DCe716f3eF535C5Ff8d041c1A41C3bd89b97aE) + , ('sonic', 0xe5da20f15420ad15de0fa650600afc998bbe3955) , ('worldchain', 0x2cFc85d8E48F8EAB294be644d9E25C3030863003) , ('worldchain', 0x79A02482A880bCE3F13e09Da970dC34db4CD24d1) , ('worldchain', 0x03C7054BCB39f7b2e5B2c7AcB37583e32D70Cfa3) @@ -198,4 +208,4 @@ UNION ALL SELECT * FROM - native_tokens \ No newline at end of file + native_tokens diff --git a/dbt_subprojects/tokens/models/prices/solana/prices_solana_tokens.sql b/dbt_subprojects/tokens/models/prices/solana/prices_solana_tokens.sql index 9ba81a4fa10..791f3f58b63 100644 --- a/dbt_subprojects/tokens/models/prices/solana/prices_solana_tokens.sql +++ b/dbt_subprojects/tokens/models/prices/solana/prices_solana_tokens.sql @@ -715,5 +715,6 @@ FROM ('grift1-orbit', 'solana', 'GRIFT', 'GekTNfm84QfyP2GdAHZ5AgACBRd69aNmgA5FDhZupump', 6), ('fxn-fxn', 'solana', 'FXN', '92cRC6kV5D7TiHX1j56AbkPbffo9jwcXxSDQZ8Mopump',6), ('griffain-test-griffaincom', 'solana', 'GRIFFAIN', 'KENJSUYLASHUMfHyy5o4Hp2FdNqZg1AsUPhfH2kYvEP', 6), - ('tank-agenttank', 'solana', 'TANK', 'GAMwtMB6onAvBNBQJCJFuxoaqfPH8uCQ2dewNMVVpump', 6) + ('tank-agenttank', 'solana', 'TANK', 'GAMwtMB6onAvBNBQJCJFuxoaqfPH8uCQ2dewNMVVpump', 6), + ('pengu-pudgy-penguins', 'solana', 'PENGU', '2zMMhcVQEXDtdE6vsFS7S7D5oUodfJHE8vd1gnBouauv', 6) ) as temp (token_id, blockchain, symbol, contract_address, decimals) diff --git a/dbt_subprojects/tokens/models/prices/sonic/_schema.yml b/dbt_subprojects/tokens/models/prices/sonic/_schema.yml new file mode 100644 index 00000000000..de77489ffeb --- /dev/null +++ b/dbt_subprojects/tokens/models/prices/sonic/_schema.yml @@ -0,0 +1,24 @@ +version: 2 + +models: + - name: prices_sonic_tokens + meta: + blockchain: sonic + sector: tokens + contributors: hosuke + config: + tags: ['tokens', 'sonic', 'prices'] + description: "Token prices and metadata on Sonic" + columns: + - name: token_id + description: "Unique identifier for the token" + - name: blockchain + description: "Blockchain where the token is deployed" + - name: symbol + description: "Token symbol" + - name: contract_address + description: "Contract address of the token" + data_tests: + - unique + - name: decimals + description: "Number of decimal places for the token" \ No newline at end of file diff --git a/dbt_subprojects/tokens/models/prices/sonic/prices_sonic_tokens.sql b/dbt_subprojects/tokens/models/prices/sonic/prices_sonic_tokens.sql new file mode 100644 index 00000000000..6a15f52541d --- /dev/null +++ b/dbt_subprojects/tokens/models/prices/sonic/prices_sonic_tokens.sql @@ -0,0 +1,31 @@ +{% set blockchain = 'sonic' %} + +{{ config( + schema = 'prices_' + blockchain, + alias = 'tokens', + materialized = 'table', + file_format = 'delta', + tags = ['static'] + ) +}} + +SELECT + token_id + , '{{ blockchain }}' as blockchain + , symbol + , contract_address + , decimals +FROM +( + VALUES + ('ws-wrapped-sonic', 'wS', 0x039e2fB66102314Ce7b64Ce5Ce3E5183bc94aD38, 18) + , ('usdc-usd-coin', 'USDC.e', 0x29219dd400f2Bf60E5a23d13Be72B486D4038894, 6) + , ('weth-weth', 'WETH', 0x50c42dEAcD8Fc9773493ED674b675bE577f2634b, 18) + , ('euroc-euro-coin', 'EURC.e', 0xe715cba7b5ccb33790cebff1436809d36cb17e57, 6) + , ('beets-beethoven-x', 'BEETS', 0x2d0e0814e62d80056181f5cd932274405966e4f0, 18) + , ('goglz-goggles', 'GOGLZ', 0x9fDbC3f8Abc05Fa8f3Ad3C17D2F806c1230c4564, 18) + , ('fsonic-fantomsonicinu', 'FSONIC', 0x05e31a691405d06708A355C029599c12d5da8b28, 18) + , ('scusd-sonic-usd', 'scUSD', 0xd3DCe716f3eF535C5Ff8d041c1A41C3bd89b97aE, 6) + , ('sceth-sonic-eth', 'scETH', 0x3bce5cb273f0f148010bbea2470e7b5df84c7812, 18) + , ('sts-staked-sonic', 'stS', 0xe5da20f15420ad15de0fa650600afc998bbe3955, 18) +) as temp (token_id, symbol, contract_address, decimals) diff --git a/dbt_subprojects/tokens/models/prices/zksync/prices_zksync_tokens.sql b/dbt_subprojects/tokens/models/prices/zksync/prices_zksync_tokens.sql index 734c23a9279..a4cb74c70a5 100644 --- a/dbt_subprojects/tokens/models/prices/zksync/prices_zksync_tokens.sql +++ b/dbt_subprojects/tokens/models/prices/zksync/prices_zksync_tokens.sql @@ -60,5 +60,8 @@ FROM ('weeth-wrapped-eeth', 'zksync', 'weETH', 0xc1fa6e2e8667d9be0ca938a54c7e0285e9df924a, 18), ('koi4-koi', 'zksync', 'KOI4', 0xa995ad25ce5eb76972ab356168f5e1d9257e4d05, 18), ('mvx-metavault-trade', 'zksync', 'MVX', 0xc8ac6191cdc9c7bf846ad6b52aaaa7a0757ee305, 18), - ('zf-zkswap-finance', 'zksync', 'ZF', 0x31c2c031fdc9d33e974f327ab0d9883eae06ca4a, 18) + ('zf-zkswap-finance', 'zksync', 'ZF', 0x31c2c031fdc9d33e974f327ab0d9883eae06ca4a, 18), + ('rseth-rseth', 'zksync', 'wrsETH', 0xd4169e045bcf9a86cc00101225d9ed61d2f51af2, 18), + ('usdc-usd-coin', 'zksync', 'USDC', 0x1d17cbcf0d6d143135ae902365d2e5e2a16538d4, 6), + ('usdm-mountain-protocol-usd', 'zksync', 'USDM', 0x7715c206a14ac93cb1a6c0316a6e5f8ad7c9dc31, 18) ) as temp (token_id, blockchain, symbol, contract_address, decimals) diff --git a/dbt_subprojects/tokens/models/tokens/_schema.yml b/dbt_subprojects/tokens/models/tokens/_schema.yml index 6c5aea7d540..1969374b9ba 100644 --- a/dbt_subprojects/tokens/models/tokens/_schema.yml +++ b/dbt_subprojects/tokens/models/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, blast, sepolia, sei, nova, worldchain, kaia, ronin, boba, flare, viction + blockchain: arbitrum, avalanche_c, bnb, ethereum, gnosis, mantle, optimism, fantom, polygon, base, blast, sepolia, sei, nova, worldchain, kaia, ronin, boba, flare, viction, sonic sector: tokens - contributors: hildobby, 0xManny, dot2dotseurat, soispoke, mtitus6, wuligy, angus_1, Henrystats, viniabussafi, jeff-dude, rantum, hosuke + contributors: hildobby, 0xManny, dot2dotseurat, soispoke, mtitus6, wuligy, angus_1, Henrystats, viniabussafi, jeff-dude, rantum, hosuke, irishlatte19 config: - tags: ['tokens','erc20', 'arbitrum', 'avalanche_c', 'bnb', 'ethereum', 'gnosis', 'mantle', 'optimism', 'fantom', 'base', 'blast', 'sei', 'nova', 'linea', 'worldchain', 'kaia', 'ronin', 'boba', 'flare', 'viction'] + tags: ['tokens','erc20', 'arbitrum', 'avalanche_c', 'bnb', 'ethereum', 'gnosis', 'mantle', 'optimism', 'fantom', 'base', 'blast', 'sei', 'nova', 'linea', 'worldchain', 'kaia', 'ronin', 'boba', 'flare', 'viction', 'sonic'] description: > Crosschain ERC20 tokens diff --git a/dbt_subprojects/tokens/models/tokens/arbitrum/tokens_arbitrum_erc20.sql b/dbt_subprojects/tokens/models/tokens/arbitrum/tokens_arbitrum_erc20.sql index edf8630b902..7635bf4ce45 100644 --- a/dbt_subprojects/tokens/models/tokens/arbitrum/tokens_arbitrum_erc20.sql +++ b/dbt_subprojects/tokens/models/tokens/arbitrum/tokens_arbitrum_erc20.sql @@ -124,4 +124,6 @@ FROM (VALUES , (0xB0BDE111812EAC913b392D80D51966eC977bE3A2, 'jUSDC', 18) , (0xf3b7994e4dA53E04155057Fd61dc501599d57877, 'farmdWETHV3', 18) , (0x521598765b0E5a4CD743f2769C06787b84617252, 'TLP', 18) + , (0xf3527ef8dE265eAa3716FB312c12847bFBA66Cef, 'USDX', 18) + , (0x7788A3538C5fc7F9c7C8A74EAC4c898fC8d87d92, 'sUSDX', 18) ) AS temp_table (contract_address, symbol, decimals) diff --git a/dbt_subprojects/tokens/models/tokens/avalanche_c/tokens_avalanche_c_erc20.sql b/dbt_subprojects/tokens/models/tokens/avalanche_c/tokens_avalanche_c_erc20.sql index cfe1b2720cf..3702b206a1b 100644 --- a/dbt_subprojects/tokens/models/tokens/avalanche_c/tokens_avalanche_c_erc20.sql +++ b/dbt_subprojects/tokens/models/tokens/avalanche_c/tokens_avalanche_c_erc20.sql @@ -384,4 +384,7 @@ FROM (VALUES , (0xca5d8f8a8d49439357d3cf46ca2e720702f132b8, 'GYD', 18) , (0xC509aB7bB4eDbF193b82264D499a7Fc526Cd01F4, 'stataAvaUSDC', 6) , (0xc654721fbf1f374fd9ffa3385bba2f4932a6af55, 'JUICY', 18) + , (0xBaCD77aC0c456798e05de15999CB212129d90b70, 'WOOFY', 18) + , (0xfE09E309726FcDb92B05Df5f682185a0B0590dD9, 'RIPPED', 18) + , (0x3db3aa87121d16407cfbbadf3f1c5b519182a399, 'AURA', 18) ) AS temp_table (contract_address, symbol, decimals) diff --git a/dbt_subprojects/tokens/models/tokens/avalanche_c/tokens_avalanche_c_nft_curated.sql b/dbt_subprojects/tokens/models/tokens/avalanche_c/tokens_avalanche_c_nft_curated.sql index 8c42f44a161..1fa443c8bea 100644 --- a/dbt_subprojects/tokens/models/tokens/avalanche_c/tokens_avalanche_c_nft_curated.sql +++ b/dbt_subprojects/tokens/models/tokens/avalanche_c/tokens_avalanche_c_nft_curated.sql @@ -9,6 +9,17 @@ SELECT contract_address, name, symbol FROM (VALUES + (0xaaaea1fb9f3de3f70e89f37b69ab11b47eb9ce6f, 'Voting Escrow Pharaoh', 'vePHAR'), + (0x2b9328d83becd4f04de05f129ba56781fa191e67, 'Cattopya', 'CAT'), + (0x34b4da1a0b06cfb09cb0efb46f02e667330e17db, 'Humping Unicorns', 'HUMP'), + (0x47d42b18d54ee0b94b59c3e41dcac3260e995e48, 'Doggerinos Accessories', 'DOGACC'), + (0x824ca4209DebA44Da8d2d71A4c52Bc0E62265FfA, 'Dev and Draw Presale Pass', 'DND PP'), + (0x8d904c8b6bb673d88cdbcd5798cda439f33cb3a4, 'Doggerinos', 'DOGGERINOS'), + (0x9190ba4c3d0a30128509517fa8c0f080fc603f99, 'Fragments of the City', 'CITY'), + (0xb563420b7b8119114968C70093c4966630ad16d3, 'Bruskies', 'Bruskies'), + (0xC93e7eFE0E863a1E4ffC6D2dcF7AfC1d3CCCE0b4, 'Mamboners', 'BONER'), + (0xe6cc79cA731A5e406024015bB2dE5346B52eCA2F, 'Peons V2', 'Peons V2'), + (0xfE09E309726FcDb92B05Df5f682185a0B0590dD9, 'RIPPED DAO', 'RIPPED'), (0x7098b1918eb2aa13945b8a489975bbbf0d5dd79b, 'Long Long Legacy', 'LLL'), (0xc732518034c5df52cdddf17486b9409bc7721e2c, 'Sausagers', 'MEAT'), (0x00bf1594507ccf60b41ad64524d4aba23b059f4b, 'Ferdy Frends', 'FREN'), @@ -12037,5 +12048,6 @@ FROM (VALUES (0xffd2a1cf6dbb896c4db0df992e68e99e329f7a52, 'Angels® Mike Trout 1987 35th Anniversary Chrome T87C-50 Super Rare', 'MLB-22S1-S-1987AC37-M-CHR'), (0xffddfe5194e693c8954ddd9fa9bfb54625bf434c, 'Arne Maier FCA Color Splash Facsimile Signature Team Color TK-67 Legendary', 'BUND-22TK-L-CSTK-67-S-TMC'), (0xffe416277c4a301d3525bacaba00bc4f2000c29e, 'Miami Marlins® Bryan De La Cruz Base Independence Day RWB 22 Rare', 'MLB-22S1-R-B22-M-RWB'), - (0xfff6fa52337d60dbbd222671c0397d5908e5e31d, 'Lil Walter Drip', 'LWD') + (0xfff6fa52337d60dbbd222671c0397d5908e5e31d, 'Lil Walter Drip', 'LWD'), + (0xd1b4367dd9f235f9ee61878019d66e31511e98ee, 'Voidcaller', 'VOIDCALLER') ) AS temp_table (contract_address, name, symbol) diff --git a/dbt_subprojects/tokens/models/tokens/corn/schema.yml b/dbt_subprojects/tokens/models/tokens/corn/schema.yml new file mode 100644 index 00000000000..ae4fc75cb9d --- /dev/null +++ b/dbt_subprojects/tokens/models/tokens/corn/schema.yml @@ -0,0 +1,25 @@ +version: 2 + +models: + - name: tokens_corn_erc20 + meta: + blockchain: corn + sector: tokens + contributors: hosuke + config: + tags: ['tokens', 'corn', 'erc20'] + description: "Known CORN ERC20 tokens" + columns: + - name: contract_address + description: "Contract address of the ERC20 token" + data_tests: + - unique + - not_null + - name: symbol + description: "Symbol of the token" + data_tests: + - not_null + - name: decimals + description: "Number of decimals the token has" + data_tests: + - not_null diff --git a/dbt_subprojects/tokens/models/tokens/corn/tokens_corn_erc20.sql b/dbt_subprojects/tokens/models/tokens/corn/tokens_corn_erc20.sql new file mode 100644 index 00000000000..c9f598adb97 --- /dev/null +++ b/dbt_subprojects/tokens/models/tokens/corn/tokens_corn_erc20.sql @@ -0,0 +1,19 @@ +{{ + config( + schema = 'tokens_corn' + ,alias = 'erc20' + ,tags = ['static'] + ,materialized = 'table' + ) +}} + +SELECT + contract_address + , symbol + , decimals +FROM (VALUES + (0xda5ddd7270381a7c2717ad10d1c0ecb19e3cdfb2, 'wBTCN', 18) + , (0xecAc9C5F704e954931349Da37F60E39f515c11c1, 'LBTC', 8) + , (0xDF0B24095e15044538866576754F3C964e902Ee6, 'USDC.e', 6) + , (0xF469fBD2abcd6B9de8E169d128226C0Fc90a012e, 'pumpBTC', 8) +) as temp (contract_address, symbol, decimals) diff --git a/dbt_subprojects/tokens/models/tokens/ethereum/tokens_ethereum_erc20.sql b/dbt_subprojects/tokens/models/tokens/ethereum/tokens_ethereum_erc20.sql index c83ece387c6..76a57213b82 100644 --- a/dbt_subprojects/tokens/models/tokens/ethereum/tokens_ethereum_erc20.sql +++ b/dbt_subprojects/tokens/models/tokens/ethereum/tokens_ethereum_erc20.sql @@ -4739,6 +4739,10 @@ FROM (VALUES , ( 0x9Ba021B0a9b958B5E75cE9f6dff97C7eE52cb3E6, 'apxETH', 18) , ( 0xa4f6b2cdcb67bf8f48baa459a333d2667aa4b100, 'shezETH', 8) , ( 0x7F4B66FF703336CfC35b901144614496Ae0b0D27, 'shezUSD', 18) - , ( 0xa7b66dda0d7c7c1e43d3130491216172993d163d, 'EVS', 6) - , ( 0x2371e134e3455e0593363cbf89d3b6cf53740618, 'gtWETH', 18) + , ( 0xa7b66dda0d7c7c1e43d3130491216172993d163d, 'EVS', 6) + , ( 0x2371e134e3455e0593363cbf89d3b6cf53740618, 'gtWETH', 18) + , ( 0x5F9D59db355b4A60501544637b00e94082cA575b, 'waEthUSDe', 18) + , ( 0x634Ed807647e07a7C038EF1956a58ADbc6695F88, 'shezUSD', 18) + , ( 0x7204b7dbf9412567835633b6f00c3edc3a8d6330, 'csUSDC', 18) + , ( 0xbeefc011e94f43b8b7b455ebab290c7ab4e216f1, 'csUSDL', 18) ) AS temp_table (contract_address, symbol, decimals) diff --git a/dbt_subprojects/tokens/models/tokens/ethereum/tokens_ethereum_rwa.sql b/dbt_subprojects/tokens/models/tokens/ethereum/tokens_ethereum_rwa.sql new file mode 100644 index 00000000000..a983fcca641 --- /dev/null +++ b/dbt_subprojects/tokens/models/tokens/ethereum/tokens_ethereum_rwa.sql @@ -0,0 +1,39 @@ +{{ config( + schema = 'tokens_ethereum' + , alias = 'rwa' + , tags=['static'] + , post_hook='{{ expose_spells(\'["ethereum"]\', + "sector", + "tokens_ethereum", + \'["synthquest"]\') }}' + , unique_key = ['contract_address'] + ) +}} + +SELECT blockchain, contract_address, backing, symbol, decimals, name +FROM (VALUES + + ('ethereum', 0x68749665FF8D2d112Fa859AA293F07A622782F38, 'Gold-backed', 'XAUT', 6, 'Tether'), + ('ethereum', 0x45804880de22913dafe09f4980848ece6ecbaf78, 'Gold-backed', 'PAXG', 18, 'Paxos'), + ('ethereum', 0x136471a34f6ef19fe571effc1ca711fdb8e49f2b, 'Treasury-backed', 'USYC', 6, 'Hashnote'), + ('ethereum', 0x1b19c19393e2d034d8ff31ff34c81252fcbbee92, 'Treasury-backed', 'OUSG', 18, 'Ondo'), + ('ethereum', 0x7712c34205737192402172409a8F7ccef8aA2AEc, 'Treasury-backed', 'BUIDL', 6, 'Blackrock'), + ('ethereum', 0x96F6eF951840721AdBF46Ac996b59E0235CB985C, 'Treasury-backed', 'USDY', 18, 'Ondo'), + ('ethereum', 0x43415eB6ff9DB7E26A15b704e7A3eDCe97d31C4e, 'Treasury-backed', 'USTB', 6, 'Superstate'), + ('ethereum', 0xdd50C053C096CB04A3e3362E2b622529EC5f2e8a, 'Treasury-backed', 'TBILL', 6, 'Open Eden'), + ('ethereum', 0xe4880249745eAc5F1eD9d8F7DF844792D560e750, 'Treasury-backed', 'USTBL', 5, 'Spiko'), + ('ethereum', 0x8c213ee79581Ff4984583C6a801e5263418C4b86, 'Treasury-backed', 'LTF', 6, 'Centrifuge'), + ('ethereum', 0xa0769f7A8fC65e47dE93797b4e21C073c117Fc80, 'Global-Bond-backed', 'EUTBL', 5, 'Spiko'), + ('ethereum', 0x3f95AA88dDbB7D9D484aa3D482bf0a80009c52c9, 'Global-Bond-backed', 'bERNX', 18, 'Backed'), + ('ethereum', 0x2F123cF3F37CE3328CC9B5b8415f9EC5109b45e7, 'Global-Bond-backed', 'bC3M', 18, 'Backed'), + ('ethereum', 0x3Ee320c9F73a84D1717557af00695A34b26d1F1d, 'Global-Bond-backed', 'XEVT', 6, 'OpenTrade'), + ('ethereum', 0xe4A6f23Fb9e00Fca037Aa0EA0a6954dE0a6C53bF, 'Gold-backed', 'TXAU', 18, 'Aurus'), + ('ethereum', 0x34ABce75D2f8f33940c721dCA0f562617787bfF3, 'Silver-backed', 'TXAG', 18, 'Aurus'), + ('ethereum', 0x6d57B2E05F26C26b549231c866bdd39779e4a488, 'Gold-backed', 'VNXAU', 18, 'VNX'), + ('ethereum', 0x19b22DbADc298c359A1D1b59e35f352A2b40E33c, 'Platinum-backed', 'TXPT', 18, 'Aurus'), + ('ethereum', 0xC139190F447e929f090Edeb554D95AbB8b18aC1C, 'Treasury-backed', 'USDtb', 18, 'Ethena'), + ('ethereum', 0x35D8949372D46B7a3D5A56006AE77B215fc69bC0, 'Treasury-backed', 'USD0++', 18, 'Usual') + + + + ) AS temp_table (blockchain, contract_address, backing, symbol, decimals, name) diff --git a/dbt_subprojects/tokens/models/tokens/ethereum/tokens_ethereum_schema.yml b/dbt_subprojects/tokens/models/tokens/ethereum/tokens_ethereum_schema.yml index bbe1d127dd3..410ddf70608 100644 --- a/dbt_subprojects/tokens/models/tokens/ethereum/tokens_ethereum_schema.yml +++ b/dbt_subprojects/tokens/models/tokens/ethereum/tokens_ethereum_schema.yml @@ -127,3 +127,26 @@ models: data_tests: - accepted_values: values: ['erc721', 'erc1155' , 'erc20', 'cryptopunks','superrare'] + + - name: tokens_ethereum_rwa + meta: + blockchain: ethereum + sector: rwa + contributors: synthquest + config: + tags: ['tokens', 'ethereum', 'rwa'] + description: > + Selection of RWA token addresses. + columns: + - name: blockchain + description: "Blockchain name" + - name: contract_address + description: "RWA token contract address" + - name: backing + description: "RWA token backing" + - name: symbol + description: "RWA token symbol" + - name: name + description: "RWA token project name" + - name: decimals + description: "Number of decimals" diff --git a/dbt_subprojects/tokens/models/tokens/gnosis/tokens_gnosis_erc20.sql b/dbt_subprojects/tokens/models/tokens/gnosis/tokens_gnosis_erc20.sql index 19ca6d3d2d7..effa93ed2bb 100644 --- a/dbt_subprojects/tokens/models/tokens/gnosis/tokens_gnosis_erc20.sql +++ b/dbt_subprojects/tokens/models/tokens/gnosis/tokens_gnosis_erc20.sql @@ -7825,4 +7825,5 @@ FROM (VALUES , ( 0x773cda0cade2a3d86e6d4e30699d40bb95174ff2, 'waGnowstETH', 18) , ( 0x57f664882f762fa37903fc864e2b633d384b411a, 'waGnoWETH', 18) , ( 0x51350d88c1bd32Cc6A79368c9Fb70373Fb71F375, 'waGNOUSDCe', 6) + , ( 0xa4d8bae4430cb084dcd9d82e938bce270b76bae5, 'CHT', 18) ) AS temp_table (contract_address, symbol, decimals) diff --git a/dbt_subprojects/tokens/models/tokens/sonic/tokens_sonic_erc20.sql b/dbt_subprojects/tokens/models/tokens/sonic/tokens_sonic_erc20.sql new file mode 100644 index 00000000000..f39d8d6ffdb --- /dev/null +++ b/dbt_subprojects/tokens/models/tokens/sonic/tokens_sonic_erc20.sql @@ -0,0 +1,38 @@ +{{ + config( + schema = 'tokens_sonic' + ,alias = 'erc20' + ,tags = ['static'] + ,materialized = 'table' + ) +}} + +SELECT + contract_address + , symbol + , decimals +FROM (VALUES + (0x50c42dEAcD8Fc9773493ED674b675bE577f2634b, 'WETH', 18) + , (0x039e2fB66102314Ce7b64Ce5Ce3E5183bc94aD38, 'wS', 18) + , (0x29219dd400f2Bf60E5a23d13Be72B486D4038894, 'USDC.e', 6) + , (0xe715cba7b5ccb33790cebff1436809d36cb17e57, 'EURC.e', 6) + , (0xf2f9f482a395b4dd5b5b92173b7d62f3aff92884, 'DOG', 18) + , (0x06341839dac9384bf96c6fc8df6983661a06356a, 'DOGE', 18) + , (0x446649f0727621bdbb76644b1910be2163b62a11, 'SONIC', 18) + , (0x9fdbc3f8abc05fa8f3ad3c17d2f806c1230c4564, 'GOGLZ', 18) + , (0x2030170901a9d87f6bd0ca9b8ad130119c7e1173, 'BABYSONIC', 9) + , (0xe5da20f15420ad15de0fa650600afc998bbe3955, 'stS', 18) + , (0xd4a5c68a1ed1fc2bb06cba2d90d6adeee7503671, 'HOOPS', 18) + , (0x1e5fe95fb90ac0530f581c617272cd0864626795, 'BEETS', 18) + , (0xe17be928a08d66156ec242a68c4929b07cf14ccc, 'SCARTEL', 18) + , (0x309c92261178fa0cf748a855e90ae73fdb79ebc7, 'WETH', 18) + , (0x342781fd3d3f73bdb54b2dedd925f2ad81b48590, 'SPOOH', 18) + , (0xb5a10bd15af95381d830f71e85328f2d1d823de7, 'SPUB', 18) + , (0x71d634647a1aa323c1a0e6d9548ddaa6eb750e6e, 'SHOB', 18) + , (0x93cd403693da40d27188714a872943f717e3c543, 'SBEER', 18) + , (0x2d10a2e2d680564a942e98ee43e35553db990807, 'STEQILA', 18) + , (0x3854fd4712eb3a5aa51c949c29cace84f7ed2efc, 'Shilly', 18) + , (0x2d0e0814e62d80056181f5cd932274405966e4f0, 'BEETS', 18) + , (0xd3DCe716f3eF535C5Ff8d041c1A41C3bd89b97aE, 'scUSD', 6) + , (0x3bce5cb273f0f148010bbea2470e7b5df84c7812, 'scETH', 18) +) as temp (contract_address, symbol, decimals) diff --git a/dbt_subprojects/tokens/models/tokens/sonic/tokens_sonic_schema.yml b/dbt_subprojects/tokens/models/tokens/sonic/tokens_sonic_schema.yml new file mode 100644 index 00000000000..6cc0daef3fc --- /dev/null +++ b/dbt_subprojects/tokens/models/tokens/sonic/tokens_sonic_schema.yml @@ -0,0 +1,21 @@ +version: 2 + +models: + - name: tokens_sonic_erc20 + meta: + blockchain: sonic + sector: tokens + project: erc20 + contributors: irishlatte19 + config: + tags: ['table', 'erc20', 'sonic'] + description: "ERC20 Token Addresses, Symbols and Decimals on Sonic" + columns: + - name: contract_address + description: "ERC20 token contract address" + data_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/dbt_subprojects/tokens/models/tokens/tokens_erc20.sql b/dbt_subprojects/tokens/models/tokens/tokens_erc20.sql index 04c94f3a19a..35e414bf635 100644 --- a/dbt_subprojects/tokens/models/tokens/tokens_erc20.sql +++ b/dbt_subprojects/tokens/models/tokens/tokens_erc20.sql @@ -12,6 +12,7 @@ ,"bnb" ,"boba" ,"celo" + ,"corn" ,"ethereum" ,"fantom" ,"fuse" @@ -32,10 +33,11 @@ ,"zksync" ,"zora" ,"bob" + ,"sonic" ]\', "sector", "tokens", - \'["bh2smith","0xManny","hildobby","soispoke","dot2dotseurat","mtitus6","wuligy","lgingerich","0xRob","jeff-dude","viniabussafi","IrishLatte19","angus_1","Henrystats","rantum"]\') }}' + \'["bh2smith","0xManny","hildobby","soispoke","dot2dotseurat","mtitus6","wuligy","lgingerich","0xRob","jeff-dude","viniabussafi","IrishLatte19","angus_1","Henrystats","rantum", "IrishLatte19"]\') }}' ) }} @@ -75,6 +77,8 @@ ,'tokens_flare': {'blockchain': 'flare', 'model': ref('tokens_flare_erc20')} ,'tokens_boba': {'blockchain': 'boba', 'model': ref('tokens_boba_erc20')} ,'tokens_viction': {'blockchain': 'viction', 'model': ref('tokens_viction_erc20')} + ,'tokens_sonic': {'blockchain': 'sonic', 'model': ref('tokens_sonic_erc20')} + ,'tokens_corn': {'blockchain': 'corn', 'model': ref('tokens_corn_erc20')} } %} with automated_source as ( diff --git a/docs/general/faq_and_common_issues.md b/docs/general/faq_and_common_issues.md index 428e876d6d3..8e20a8e4083 100644 --- a/docs/general/faq_and_common_issues.md +++ b/docs/general/faq_and_common_issues.md @@ -3,7 +3,7 @@ - Why is my PR running more models than included in the CI test runs? - Steps within the CI test workflow depend on DBT manifest file to be up-to-date on the main branch - When other PRs are merged, main is updated, therefore a new manifest file needs uploaded to storage for CI to read - - The GH workflow to do this lives here: https://github.com/duneanalytics/spellbook/actions/workflows/commit_manifest.yml + - The GH workflow to do this lives [here](https://github.com/duneanalytics/spellbook/actions/workflows/commit_manifest.yml) - If the latest run failed and/or is in progress, then it’s possible manifest files are out of date and your PR will run more than it should - Wait for it to complete or Dune team to fix any failures - I’m modifying an existing spell within my PR that contains a seed test on it via the schema YML file. CI is failing on the seed test, as it can’t find the seed. How do I get around this? @@ -14,4 +14,4 @@ - In order to get around this, force a change on the associated seed file and bring into PR to rebuild, then CI will be able to find in the test section - I submitted a PR to add a new token to `prices.usd`, but it's still not showing up? Why is that? - new price additions can take a few days, as the backend process needs to acknowledge the new API ID value provided & backfill historical pricing data - - please check back in a few days to see the new data populated \ No newline at end of file + - please check back in a few days to see the new data populated diff --git a/docs/seeds/seed_overview.md b/docs/seeds/seed_overview.md index 232dce54c1a..c4fb9c71607 100644 --- a/docs/seeds/seed_overview.md +++ b/docs/seeds/seed_overview.md @@ -6,12 +6,12 @@ Seeds will be required in these sector-level spell additions to ensure proper le ## Using `dex.trades` as an Example for Sector-Level Spell Design Approach to Seeds: -1. Add new model seed to [the schema file](/seeds/_sector/dex/_schema.yml), to ensure proper data type assignments. +1. Add new model seed to [the schema file](/dbt_subprojects/dex/seeds/trades/_schema.yml), to ensure proper data type assignments. 2. Build a seed file in CSV format, which contains: - All the unique keys on the model for downstream join conditions in tests. - Fields which we want to test the results of the model execution. - - Example seed file [here](/seeds/_sector/dex/aerodrome_base_base_trades_seed.csv). -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: + - Example seed file [here](/dbt_subprojects/dex/seeds/trades/aerodrome_base_base_trades_seed.csv). +3. Within the [model schema file](/dbt_subprojects/dex/models/trades/arbitrum/_schema.yml#23-25), call the [generic seed test](/dbt_subprojects/dex/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](/dbt_macros/generic-tests/check_seed_macro.sql). diff --git a/docs/tests/test_overview.md b/docs/tests/test_overview.md index 82d1d890781..c573ed113ce 100644 --- a/docs/tests/test_overview.md +++ b/docs/tests/test_overview.md @@ -11,7 +11,7 @@ Tests tied to models are highly encouraged & at times required, depending on the These tests would benefit all sector-level spells, first introduced in `nft.trades`: -- Validate column data types, as built [here](https://github.com/duneanalytics/spellbook/blob/d6b5acc1dbd01e67e6cb23d96da6f3fc3ec7d268/tests/generic/check_column_types.sql#L6) and called like [this](/models/_sector/nft/trades/chains/arbitrum/platforms/_schema.yml#L14). +- Validate column data types, as built [here](https://github.com/duneanalytics/spellbook/blob/d6b5acc1dbd01e67e6cb23d96da6f3fc3ec7d268/tests/generic/check_column_types.sql#L6) and called like [this](/dbt_subprojects/nft/models/_sector/trades/chains/arbitrum/platforms/_schema.yml#L14). ## Where to Store Tests? diff --git a/sources/_base_sources/evm/corn_base_sources.yml b/sources/_base_sources/evm/corn_base_sources.yml new file mode 100644 index 00000000000..526d09da75f --- /dev/null +++ b/sources/_base_sources/evm/corn_base_sources.yml @@ -0,0 +1,429 @@ +version: 2 + +sources: + # Corn Tables + - name: corn + description: "raw tables for the chain" + + tables: + - name: transactions + meta: + docs_slug: /evm/corn/raw/transactions + short_description: The transactions table contains detailed information about transactions on the network. + description: '{{ doc("corn_transactions_doc") }}' + columns: + - name: block_time + description: "The exact UTC timestamp when the block containing this transaction was added to the chain" + - name: block_number + description: "The sequential number of the block containing this transaction" + - name: value + description: "Amount of BTCN sent from sender to recipient (if any), measured in wei (1 BTCN = 10^18 wei)" + - name: gas_limit + description: "Maximum number of gas units this transaction can consume" + - name: gas_price + description: "Price per unit of gas for this transaction, denominated in wei" + - name: gas_used + description: "Actual amount of gas units consumed by this transaction's execution" + - name: max_fee_per_gas + description: "Maximum total amount per gas unit the initiator is willing to pay" + - name: max_priority_fee_per_gas + description: "Maximum additional fee per gas unit the initiator is willing to pay as a tip to validators" + - name: priority_fee_per_gas + description: "Actual priority fee per gas paid to validators" + - name: nonce + description: "Sequential number representing the count of transactions sent from the sender's address" + - name: index + description: "Position of this transaction within its containing block" + - name: success + description: "Boolean flag indicating whether the transaction executed successfully (true) or failed (false)" + - name: from + description: "Address of the account that initiated and signed this transaction" + - name: to + description: "Address of the recipient account or contract for this transaction" + - name: block_hash + description: "Unique 256-bit identifier (hash) of the block containing this transaction" + - name: data + description: "Input data for the transaction, which may include function calls or contract interaction data" + - name: hash + description: "Unique 256-bit identifier (hash) of this specific transaction" + - name: type + description: "Type of transaction (e.g., legacy, EIP-1559) indicating its structure and fee mechanism" + - name: access_list + description: "List of addresses and storage keys the transaction plans to access, used for gas optimization in EIP-2930 transactions" + - name: chain_id + description: "Chain identifier for the network" + - name: block_date + description: "The UTC date of the block in which this transaction was included" + + - name: traces + meta: + docs_slug: /evm/corn/raw/traces + short_description: The traces table contains information about traces on the network. + description: '{{ doc("corn_traces_doc") }}' + columns: + - name: block_time + description: "The exact UTC timestamp when the block containing this transaction was added to the chain" + - name: block_number + description: "The sequential number of the block containing this transaction" + - name: value + description: "Amount of BTCN sent from sender to recipient (if any), measured in wei (1 BTCN = 10^18 wei)" + - name: gas + description: "Amount of gas allocated for this trace's execution (including gas used by child traces)" + - name: gas_used + description: "Actual amount of gas consumed by this trace's execution" + - name: block_hash + description: "Unique 256-bit identifier (hash) of the block containing this transaction" + - name: success + description: "Boolean flag indicating whether this specific trace was executed successfully (true) or reverted (false)" + - name: tx_index + description: "Position of the parent transaction within its containing block" + - name: tx_from + description: "Address that initiated the parent transaction" + - name: tx_to + description: "Recipient address of the parent transaction" + - name: sub_traces + description: "Number of child traces spawned by this trace during execution" + - name: error + description: "Error message or code if the trace execution failed" + - name: tx_success + description: "Boolean flag indicating whether the parent transaction of this trace was successful" + - name: tx_hash + description: "Unique 256-bit identifier (hash) of the parent transaction" + - name: from + description: "Address that sent this trace" + - name: to + description: "Address that received this trace" + - name: trace_address + description: "Array indicating the exact position of this trace within the trace tree" + - name: type + description: "Type of trace (e.g., call, create, suicide) indicating the nature of the operation" + - name: address + description: "If this trace is a contract creation, this is the address of the deployed contract" + - name: code + description: "If this trace is a contract creation, this is the deployed bytecode of contract" + - name: call_type + description: "Type of call made in this trace (e.g., call, delegatecall, staticcall)" + - name: input + description: "Call data provided to this trace, often containing function signatures and parameters" + - name: output + description: "Data returned by this trace after execution" + - name: refund_address + description: "Address designated to receive any gas refund from this trace" + - name: revert_reason + description: "Reason for reversion if the trace was reverted" + - name: block_date + description: "The UTC date of the block in which this transaction was included" + + - name: traces_decoded + meta: + docs_slug: /evm/corn/decoded/traces_decoded + short_description: The `corn.traces_decoded` table contains decoded traces, including additional information based on submitted smart contracts and their ABIs. + description: '{{ doc("corn_traces_decoded_doc") }}' + columns: + - name: block_date + description: "The UTC date of the block in which this transaction was included" + - name: block_time + description: "The exact UTC timestamp when the block containing this transaction was added to the chain" + - name: block_number + description: "The sequential number of the block containing this transaction" + - name: namespace + description: "Categorical grouping or project name associated with the contract" + - name: contract_name + description: "Human-readable name of the smart contract involved in this trace" + - name: to + description: "Address of the contract or account receiving this trace" + - name: trace_address + description: "Array indicating the exact position of this trace within the trace tree of the transaction" + - name: tx_hash + description: "Unique 256-bit identifier (hash) of the parent transaction" + - name: tx_from + description: "Address that initiated the parent transaction" + - name: tx_to + description: "Recipient address of the parent transaction" + - name: signature + description: "Function signature hash" + - name: function_name + description: "Name of the specific contract function called in this trace" + + - name: logs + meta: + docs_slug: /evm/corn/raw/logs + short_description: The `corn.logs` table contains information about event logs emitted by smart contracts on the corn blockchain. + description: '{{ doc("corn_logs_doc") }}' + columns: + - name: block_date + description: "The UTC date of the block in which this transaction was included" + - name: block_time + description: "The exact UTC timestamp when the block containing this transaction was added to the chain" + - name: block_number + description: "The sequential number of the block containing this transaction" + - name: block_hash + description: "Unique 256-bit identifier (hash) of the block containing this transaction" + - name: tx_index + description: "Position of the parent transaction within its containing block" + - name: tx_hash + description: "Unique 256-bit identifier (hash) of the parent transaction" + - name: contract_address + description: "Address of the smart contract that emitted this log" + - name: topic0 + description: "First 32-byte topic, typically containing the event signature hash" + - name: topic1 + description: "Second 32-byte topic, often containing indexed event parameters" + - name: topic2 + description: "Third 32-byte topic, often containing indexed event parameters" + - name: topic3 + description: "Fourth 32-byte topic, often containing indexed event parameters" + - name: data + description: "ABI-encoded data of the log, containing non-indexed event parameters" + - name: index + description: "Position of this log within the block" + - name: tx_from + description: "Address that initiated the transaction which created this log" + - name: tx_to + description: "Recipient address of the transaction which created this log" + + - name: logs_decoded + meta: + docs_slug: /evm/corn/decoded/logs_decoded + short_description: The `corn.logs_decoded` table contains a subset of all logs for which Dune has the ABI. + description: '{{ doc("corn_logs_decoded_doc") }}' + columns: + - name: block_date + description: "The UTC date of the block in which this transaction was included" + - name: block_time + description: "The exact UTC timestamp when the block containing this transaction was added to the chain" + - name: block_number + description: "The sequential number of the block containing this transaction" + - name: namespace + description: "Categorical grouping or project name associated with the contract" + - name: contract_name + description: "Human-readable name of the smart contract" + - name: contract_address + description: "Address of the smart contract that emitted this log" + - name: tx_hash + description: "Unique 256-bit identifier (hash) of the parent transaction" + - name: tx_from + description: "Address that initiated the transaction which created this log" + - name: tx_to + description: "Recipient address of the transaction which created this log" + - name: index + description: "Position of this log within the block" + - name: signature + description: "Event signature hash" + - name: event_name + description: "Human-readable name of the event" + + - name: contracts + meta: + docs_slug: /evm/corn/raw/contracts + short_description: The `corn.contracts` table tracks decoded contracts on corn, including associated metadata such as namespace, name, address, ABI. It is populated manually by the Dune Community via [contract decoding submissions](https://dune.com/contracts/new). + description: '{{ doc("corn_contracts_doc") }}' + columns: + - name: address + description: "Unique address of the contract on the blockchain" + - name: bytecode + description: "Compiled bytecode of the contract" + - name: name + description: "Human-readable name of the contract" + - name: namespace + description: "Project or protocol name associated with the contract" + - name: abi + description: "JSON representation of the contract's Application Binary Interface" + - name: created_at + description: "Timestamp when this contract entry was created in the table" + + - name: contracts_submitted + meta: + docs_slug: /evm/corn/decoded/contracts_submitted + short_description: The `corn.contracts_submitted` table contains information about contracts submitted for decoding. + description: '{{ doc("corn_contracts_submitted_doc") }}' + columns: + - name: address + description: "Address of the submitted contract" + - name: namespace + description: "Project or protocol name associated with the contract" + - name: name + description: "Name of the submitted contract" + - name: submitted_at + description: "Timestamp when the contract was submitted for decoding" + - name: submitted_by + description: "Address or identifier of the user who submitted the contract" + + - name: creation_traces + meta: + docs_slug: /evm/corn/raw/creation_traces + short_description: The `corn.creation_traces` table contains information about contract creation traces. + description: '{{ doc("corn_creation_traces_doc") }}' + columns: + - name: block_date + description: "The UTC date of the block in which this transaction was included" + - name: block_time + description: "The exact UTC timestamp when the block containing this transaction was added to the chain" + - name: block_number + description: "The sequential number of the block containing this transaction" + - name: tx_hash + description: "Unique 256-bit identifier (hash) of the parent transaction" + - name: address + description: "Address of the created contract" + - name: from + description: "Address that created the contract" + - name: code + description: "Contract bytecode" + - name: success + description: "Whether the contract creation was successful" + - name: block_month + description: "The month of the block date" + + - name: blocks + meta: + docs_slug: /evm/corn/raw/blocks + short_description: The `corn.blocks` table contains information about blocks on the corn blockchain. + description: '{{ doc("corn_blocks_doc") }}' + columns: + - name: block_date + description: "The UTC date of the block in which this transaction was included" + - name: block_time + description: "The exact UTC timestamp when the block containing this transaction was added to the chain" + - name: block_number + description: "The sequential number of the block containing this transaction" + - name: block_hash + description: "Unique 256-bit identifier (hash) of the block containing this transaction" + - name: parent_hash + description: "Hash of the parent block" + - name: nonce + description: "Block nonce value" + - name: difficulty + description: "Block mining difficulty" + - name: gas_limit + description: "Maximum gas allowed in this block" + - name: gas_used + description: "Total gas used by all transactions in this block" + - name: miner + description: "Address of the miner/validator who produced this block" + - name: size + description: "Size of the block in bytes" + - name: total_difficulty + description: "Total chain difficulty up to this block" + - name: base_fee_per_gas + description: "Base fee per gas in this block (EIP-1559)" + - name: state_root + description: "Root hash of the state trie after this block" + - name: transactions_root + description: "Root hash of the transactions trie of this block" + - name: receipts_root + description: "Root hash of the receipts trie of this block" + - name: blob_gas_used + description: "Total blob gas used in this block" + - name: excess_blob_gas + description: "Excess blob gas in this block" + - name: parent_beacon_block_root + description: "Root hash of the parent beacon block" + + - name: erc20_corn + description: "Transfer events for ERC20 tokens on Corn blockchain" + tables: + - name: evt_transfer + meta: + docs_slug: /evm/corn/raw/erc20_transfers + short_description: The evt_transfer table contains all ERC20 token transfer events on the Corn blockchain. + description: '{{ doc("erc20_corn_evt_transfer_doc") }}' + columns: + - name: contract_address + description: "The address of the ERC20 token contract" + - name: from + description: "The address sending the tokens" + - name: to + description: "The address receiving the tokens" + - name: value + description: "The amount of tokens transferred" + - name: evt_tx_hash + description: "The transaction hash of the transfer event" + - name: evt_index + description: "The index of this event within the transaction" + - name: evt_block_time + description: "The timestamp of the block containing this transfer" + - name: evt_block_number + description: "The block number containing this transfer" + + - name: erc721_corn + description: "Transfer events for ERC721 tokens on Corn blockchain" + tables: + - name: evt_transfer + meta: + docs_slug: /evm/corn/raw/erc721_transfers + short_description: The evt_transfer table contains all ERC721 token transfer events on the Corn blockchain. + description: '{{ doc("erc721_corn_evt_transfer_doc") }}' + columns: + - name: contract_address + description: "The address of the ERC721 token contract" + - name: from + description: "The address sending the NFT" + - name: to + description: "The address receiving the NFT" + - name: tokenId + description: "The unique identifier of the NFT being transferred" + - name: evt_tx_hash + description: "The transaction hash of the transfer event" + - name: evt_index + description: "The index of this event within the transaction" + - name: evt_block_time + description: "The timestamp of the block containing this transfer" + - name: evt_block_number + description: "The block number containing this transfer" + + - name: erc1155_corn + description: "Transfer events for ERC1155 tokens on Corn blockchain" + tables: + - name: evt_transfersingle + meta: + docs_slug: /evm/corn/raw/erc1155_transfers_single + short_description: The evt_transfersingle table contains single token transfer events from ERC1155 contracts on the Corn blockchain. + description: '{{ doc("erc1155_corn_evt_transfer_doc") }}' + columns: + - name: contract_address + description: "The address of the ERC1155 token contract" + - name: operator + description: "The address authorized to make the transfer" + - name: from + description: "The address sending the tokens" + - name: to + description: "The address receiving the tokens" + - name: id + description: "The identifier for the token being transferred" + - name: value + description: "The amount of tokens being transferred" + - name: evt_tx_hash + description: "The transaction hash of the transfer event" + - name: evt_index + description: "The index of this event within the transaction" + - name: evt_block_time + description: "The timestamp of the block containing this transfer" + - name: evt_block_number + description: "The block number containing this transfer" + + - name: evt_transferbatch + meta: + docs_slug: /evm/corn/raw/erc1155_transfers_batch + short_description: The evt_transferbatch table contains batch token transfer events from ERC1155 contracts on the Corn blockchain. + description: '{{ doc("erc1155_corn_evt_transfer_doc") }}' + columns: + - name: contract_address + description: "The address of the ERC1155 token contract" + - name: operator + description: "The address authorized to make the transfer" + - name: from + description: "The address sending the tokens" + - name: to + description: "The address receiving the tokens" + - name: ids + description: "The array of token identifiers being transferred" + - name: values + description: "The array of amounts being transferred for each token id" + - name: evt_tx_hash + description: "The transaction hash of the transfer event" + - name: evt_index + description: "The index of this event within the transaction" + - name: evt_block_time + description: "The timestamp of the block containing this transfer" + - name: evt_block_number + description: "The block number containing this transfer" diff --git a/sources/_base_sources/evm/corn_docs_block.md b/sources/_base_sources/evm/corn_docs_block.md new file mode 100644 index 00000000000..a78e8b71ad4 --- /dev/null +++ b/sources/_base_sources/evm/corn_docs_block.md @@ -0,0 +1,203 @@ +{% docs corn_transactions_doc %} + +The `corn.transactions` table contains detailed information about transactions on the Corn blockchain. It includes: + +- Block information: number, timestamp, hash +- Transaction details: hash, from_address, to_address, value +- Gas data: gas_price, gas_limit, gas_used, max_fee_per_gas, priority_fee_per_gas +- Status: success or failure +- Input data for contract interactions +- Nonce and chain_id +- Transaction type and access list + +This table is used for analyzing transaction patterns, gas usage, value transfers, and overall network activity on Corn. + +{% enddocs %} + +{% docs corn_traces_doc %} + +The `corn.traces` table contains records of execution steps for transactions on the Corn blockchain. Each trace represents an atomic operation that modifies the state of the Ethereum Virtual Machine (EVM). Key components include: + +- Transaction hash and block information +- From and to addresses +- Value transferred +- Gas metrics (gas, gas_used) +- Input and output data +- Call type (e.g., CALL, DELEGATECALL, CREATE) +- Error information and revert reasons +- Trace address for nested calls +- Sub-traces count + +This table is essential for: +- Analyzing internal transactions +- Debugging smart contract interactions +- Tracking value flows through complex transactions +- Understanding contract creation and deployment + +{% enddocs %} + +{% docs corn_traces_decoded_doc %} + +The `corn.traces_decoded` table contains a subset of decoded traces from the Corn blockchain dependent on submitted smart contracts and their ABIs. It includes: + +- Block information and transaction details +- Contract name and namespace +- Decoded function names and signatures +- Trace address for execution path tracking +- Transaction origin and destination + +This table is used for high level analysis of smart contract interactions. For fully decoded function calls and parameters, refer to protocol-specific decoded tables. + +{% enddocs %} + +{% docs corn_logs_doc %} + +The `corn.logs` table contains event logs emitted by smart contracts on the Corn blockchain. It includes: + +- Block information: number, timestamp, hash +- Transaction details: hash, index, from, to +- Contract address (emitting the event) +- Topic0 (event signature) +- Additional topics (indexed parameters) +- Data field (non-indexed parameters) +- Log index and transaction index + +This table is crucial for: +- Tracking on-chain events +- Monitoring contract activity +- Analyzing token transfers +- Following protocol-specific events + +{% enddocs %} + +{% docs corn_logs_decoded_doc %} + +The `corn.logs_decoded` table contains a subset of decoded logs from the Corn blockchain dependent on submitted smart contracts and their ABIs. It includes: + +- Block and transaction information +- Contract details (name, namespace, address) +- Decoded event names and signatures +- Transaction origin and destination +- Event parameters (when available) + +This table is used for high level analysis of smart contract events. For fully decoded events and parameters, refer to protocol-specific decoded tables. + +{% enddocs %} + +{% docs corn_blocks_doc %} + +The `corn.blocks` table contains information about Corn blocks. It provides essential data about each block in the Corn blockchain, including: + +- Block identifiers and timestamps +- Gas metrics and size +- Consensus information (difficulty, nonce) +- State roots and receipts +- Parent block information +- Blob gas information +- Parent beacon block root + +This table is used for analyzing block production, network capacity, and chain state. + +{% enddocs %} + +{% docs corn_contracts_doc %} + +The `corn.contracts` table contains information about verified smart contracts on the Corn blockchain. It includes: + +- Contract address +- Contract bytecode +- Contract name and namespace +- Contract ABI +- Creation timestamp + +This table is used for contract verification and analysis. + +{% enddocs %} + +{% docs corn_contracts_submitted_doc %} + +The `corn.contracts_submitted` table tracks contracts submitted for decoding on the Corn blockchain. It includes: + +- Contract address +- Contract name and namespace +- Submission details (timestamp, submitter) + +This table is used for managing contract submissions and decoding status. + +{% enddocs %} + +{% docs corn_creation_traces_doc %} + +The `corn.creation_traces` table contains information about contract creation events on the Corn blockchain. It includes: + +- Block and transaction information +- Creator address +- Created contract address +- Contract bytecode +- Creation success status +- Gas consumption + +This table is used for: +- Analyzing contract deployment patterns +- Tracking new contract deployments +- Understanding contract creation success rates + +{% enddocs %} + +{% docs erc20_corn_evt_transfer_doc %} + +The `erc20_corn.evt_transfer` table contains Transfer events from ERC20 token contracts on the Corn blockchain. Each record represents a token transfer and includes: + +- Token contract address +- Sender and recipient addresses +- Amount of tokens transferred +- Block and transaction information +- Event log details + +This table is essential for: +- Tracking token transfers and holder activity +- Analyzing token distribution patterns +- Monitoring token holder behavior +- Calculating token balances +- Understanding token velocity and liquidity + +{% enddocs %} + +{% docs erc721_corn_evt_transfer_doc %} + +The `erc721_corn.evt_transfer` table contains Transfer events from ERC721 (NFT) token contracts on the Corn blockchain. Each record represents an NFT transfer and includes: + +- NFT contract address +- Token ID +- Sender and recipient addresses +- Block and transaction information +- Event log details + +This table is used for: +- Tracking NFT ownership changes +- Analyzing NFT trading patterns +- Monitoring NFT collection activity +- Building NFT holder histories +- Understanding NFT market dynamics + +{% enddocs %} + +{% docs erc1155_corn_evt_transfer_doc %} + +The `erc1155_corn.evt_transfersingle` and `erc1155_corn.evt_transferbatch` tables contain Transfer events from ERC1155 token contracts on the Corn blockchain. These tables track both fungible and non-fungible token transfers within the same contract. They include: + +- Token contract address +- Token IDs +- Amounts transferred +- Sender, operator, and recipient addresses +- Block and transaction information +- Event log details + +These tables are essential for: +- Tracking multi-token transfers +- Analyzing gaming asset movements +- Monitoring hybrid token systems +- Understanding complex token ecosystems +- Building token holder analytics + +{% enddocs %} diff --git a/sources/_base_sources/evm/kaia_docs_block.md b/sources/_base_sources/evm/kaia_docs_block.md index 56dd35d7550..ee2ca6cdf7e 100644 --- a/sources/_base_sources/evm/kaia_docs_block.md +++ b/sources/_base_sources/evm/kaia_docs_block.md @@ -85,7 +85,7 @@ The `kaia.contracts` table tracks all contracts that have been submitted to Dune {% docs kaia_creation_traces_doc %} -The `kaiam.creation_traces` table contains data about contract creation events on the kaia blockchain. It includes: +The `kaia.creation_traces` table contains data about contract creation events on the kaia blockchain. It includes: - Block number and timestamp - Transaction hash diff --git a/sources/_base_sources/evm/nova_base_sources.yml b/sources/_base_sources/evm/nova_base_sources.yml index f4e998b670c..26a33df163d 100644 --- a/sources/_base_sources/evm/nova_base_sources.yml +++ b/sources/_base_sources/evm/nova_base_sources.yml @@ -84,7 +84,7 @@ sources: - name: error description: "Error log" - name: tx_success - description: "Whether the transaction was completed sucessfully" + description: "Whether the transaction was completed successfully" - &tx_hash name: tx_hash description: "Primary key of the transaction" @@ -321,7 +321,7 @@ sources: description: "Is approved" - &operator name: operator - description: "Opperator" + description: "Operator" - name: erc721_nova description: "Transfers events for ERC721 tokens on Nova." @@ -374,7 +374,6 @@ sources: - *evt_tx_to - *evt_tx_index - *evt_index - - *evt_index - *evt_block_time - *evt_block_number - *evt_block_date diff --git a/sources/_base_sources/evm/optimism_base_sources.yml b/sources/_base_sources/evm/optimism_base_sources.yml index 62e3a112db7..dafc6ed724b 100644 --- a/sources/_base_sources/evm/optimism_base_sources.yml +++ b/sources/_base_sources/evm/optimism_base_sources.yml @@ -131,7 +131,7 @@ sources: - name: traces_decoded meta: docs_slug: /evm/optimism/decoded/traces_decoded - short_description: The `optimism.traces_decoded` table contains decoded traces, including additional information optimismd on submitted smart contracts and their ABIs. + short_description: The `optimism.traces_decoded` table contains decoded traces, including additional information optimised on submitted smart contracts and their ABIs. description: '{{ doc("optimism_traces_decoded_doc") }}' columns: - *block_date diff --git a/sources/_base_sources/evm/sonic_base_sources.yml b/sources/_base_sources/evm/sonic_base_sources.yml new file mode 100644 index 00000000000..12bed27cb57 --- /dev/null +++ b/sources/_base_sources/evm/sonic_base_sources.yml @@ -0,0 +1,605 @@ +version: 2 + +sources: + - name: sonic + description: "Raw tables for the Sonic blockchain" + tables: + - name: transactions + meta: + docs_slug: "/evm/sonic/raw/transactions" + short_description: "The `sonic.transactions` table contains all transactions on the Sonic blockchain." + description: '{{ doc("sonic_transactions_doc") }}' + columns: + - name: block_time + description: "The exact UTC timestamp when this transaction was included" + data_type: timestamp + - name: block_number + description: "The sequential number of the block containing this transaction" + data_type: bigint + - name: value + description: "Amount of native tokens transferred in this transaction" + data_type: uint256 + - name: gas_limit + description: "Maximum amount of gas that can be used by this transaction" + data_type: bigint + - name: gas_price + description: "Price per unit of gas specified by the sender" + data_type: uint256 + - name: gas_used + description: "Amount of gas used by this transaction" + data_type: bigint + - name: max_fee_per_gas + description: "Maximum total fee per unit of gas (EIP-1559)" + data_type: bigint + - name: max_priority_fee_per_gas + description: "Maximum priority fee per unit of gas (EIP-1559)" + data_type: bigint + - name: priority_fee_per_gas + description: "Actual priority fee per unit of gas (EIP-1559)" + data_type: bigint + - name: nonce + description: "Number of transactions sent by the sender prior to this one" + data_type: bigint + - name: index + description: "Index of this transaction within the block" + data_type: bigint + - name: success + description: "Whether the transaction was successful" + data_type: boolean + - name: from + description: "Address that sent the transaction" + data_type: varbinary + - name: to + description: "Address that received the transaction" + data_type: varbinary + - name: block_hash + description: "Hash of the block containing this transaction" + data_type: varbinary + - name: data + description: "Data payload of the transaction" + data_type: varbinary + - name: hash + description: "Unique identifier (hash) of this transaction" + data_type: varbinary + - name: type + description: "Transaction type (0 = legacy, 1 = access list, 2 = EIP-1559)" + data_type: varchar + - name: access_list + description: "List of addresses and storage keys that the transaction plans to access" + data_type: array(row(address varbinary,storageKeys array(varbinary))) + - name: chain_id + description: "Chain ID of the network where this transaction was executed" + data_type: bigint + - name: block_date + description: "UTC date of the block containing this transaction" + data_type: date + + - name: traces + meta: + docs_slug: "/evm/sonic/raw/traces" + short_description: "The `sonic.traces` table contains all transaction traces on the Sonic blockchain." + description: '{{ doc("sonic_traces_doc") }}' + columns: + - name: block_time + description: "The exact UTC timestamp when this trace was created" + data_type: timestamp + - name: block_number + description: "The sequential number of the block containing this trace" + data_type: bigint + - name: value + description: "Amount of native tokens transferred in this trace" + data_type: uint256 + - name: gas + description: "Gas limit for this trace" + data_type: bigint + - name: gas_used + description: "Amount of gas used by this trace" + data_type: bigint + - name: block_hash + description: "Hash of the block containing this trace" + data_type: varbinary + - name: success + description: "Whether this trace was successful" + data_type: boolean + - name: tx_index + description: "Index of the transaction within the block" + data_type: integer + - name: tx_from + description: "Address that sent the transaction" + data_type: varbinary + - name: tx_to + description: "Address that received the transaction" + data_type: varbinary + - name: sub_traces + description: "Number of sub-traces" + data_type: bigint + - name: error + description: "Error message if the trace failed" + data_type: varchar + - name: tx_success + description: "Whether the parent transaction was successful" + data_type: boolean + - name: tx_hash + description: "Hash of the transaction" + data_type: varbinary + - name: from + description: "Address initiating this trace" + data_type: varbinary + - name: to + description: "Address receiving this trace" + data_type: varbinary + - name: trace_address + description: "Array indicating the position in the call trace tree" + data_type: array(bigint) + - name: type + description: "Type of the trace (call, create, suicide, reward)" + data_type: varchar + - name: address + description: "Address of the contract if this is a create trace" + data_type: varbinary + - name: code + description: "Contract code for create traces" + data_type: varbinary + - name: call_type + description: "Type of call (call, delegatecall, staticcall)" + data_type: varchar + - name: input + description: "Input data for the trace" + data_type: varbinary + - name: output + description: "Output data from the trace" + data_type: varbinary + - name: refund_address + description: "Address receiving refund for self-destruct" + data_type: varbinary + - name: revert_reason + description: "Reason for revert if the trace failed" + data_type: varchar + - name: block_date + description: "UTC date of the block containing this trace" + data_type: date + + - name: traces_decoded + meta: + docs_slug: "/evm/sonic/raw/traces_decoded" + short_description: "The `sonic.traces_decoded` table contains decoded traces from known contracts on the Sonic blockchain." + description: '{{ doc("sonic_traces_decoded_doc") }}' + columns: + - name: block_date + description: "UTC date of the block containing this trace" + data_type: date + - name: block_time + description: "The exact UTC timestamp when this trace was created" + data_type: timestamp + - name: block_number + description: "The sequential number of the block containing this trace" + data_type: bigint + - name: namespace + description: "Project namespace for the contract" + data_type: varchar + - name: contract_name + description: "Name of the contract" + data_type: varchar + - name: to + description: "Address receiving this trace" + data_type: varbinary + - name: trace_address + description: "Array indicating the position in the call trace tree" + data_type: array(bigint) + - name: tx_hash + description: "Hash of the transaction" + data_type: varbinary + - name: tx_from + description: "Address that sent the transaction" + data_type: varbinary + - name: tx_to + description: "Address that received the transaction" + data_type: varbinary + - name: signature + description: "Function signature hash" + data_type: varbinary + - name: function_name + description: "Name of the called function" + data_type: varchar + + - name: creation_traces + meta: + docs_slug: "/evm/sonic/raw/creation_traces" + short_description: "The `sonic.creation_traces` table contains information about contract creation events." + description: '{{ doc("sonic_creation_traces_doc") }}' + columns: + - name: block_time + description: "The exact UTC timestamp when the block containing this creation was added to the chain" + data_type: timestamp + - name: block_number + description: "The sequential number of the block containing this creation" + data_type: bigint + - name: tx_hash + description: "Unique 256-bit identifier (hash) of the transaction" + data_type: varbinary + - name: address + description: "Address of the deployed contract" + data_type: varbinary + - name: from + description: "Address of the account that created the contract" + data_type: varbinary + - name: code + description: "Bytecode of the deployed contract" + data_type: varbinary + - name: block_month + description: "The month of the block date" + data_type: date + + - name: logs + meta: + docs_slug: "/evm/sonic/raw/logs" + short_description: "The `sonic.logs` table contains all event logs emitted by contracts on the Sonic blockchain." + description: '{{ doc("sonic_logs_doc") }}' + columns: + - name: block_time + description: "The exact UTC timestamp when this log was emitted" + data_type: timestamp + - name: block_number + description: "The sequential number of the block containing this log" + data_type: bigint + - name: block_hash + description: "Hash of the block containing this log" + data_type: varbinary + - name: contract_address + description: "Address of the contract that emitted this log" + data_type: varbinary + - name: topic0 + description: "First topic of the log (typically the event signature)" + data_type: varbinary + - name: topic1 + description: "Second topic of the log" + data_type: varbinary + - name: topic2 + description: "Third topic of the log" + data_type: varbinary + - name: topic3 + description: "Fourth topic of the log" + data_type: varbinary + - name: data + description: "Additional data included in the log" + data_type: varbinary + - name: tx_hash + description: "Hash of the transaction that generated this log" + data_type: varbinary + - name: index + description: "Index of this log within the transaction" + data_type: integer + - name: tx_index + description: "Index of the transaction within the block" + data_type: integer + - name: block_date + description: "UTC date of the block containing this log" + data_type: date + - name: tx_from + description: "Address that sent the transaction" + data_type: varbinary + - name: tx_to + description: "Address that received the transaction" + data_type: varbinary + + - name: logs_decoded + meta: + docs_slug: "/evm/sonic/raw/logs_decoded" + short_description: "The `sonic.logs_decoded` table contains decoded event logs from known contracts on the Sonic blockchain." + description: '{{ doc("sonic_logs_decoded_doc") }}' + columns: + - name: block_date + description: "UTC date of the block containing this log" + data_type: date + - name: block_time + description: "The exact UTC timestamp when this log was emitted" + data_type: timestamp + - name: block_number + description: "The sequential number of the block containing this log" + data_type: bigint + - name: namespace + description: "Project namespace for the contract" + data_type: varchar + - name: contract_name + description: "Name of the contract that emitted this event" + data_type: varchar + - name: contract_address + description: "Address of the contract that emitted this event" + data_type: varbinary + - name: tx_hash + description: "Hash of the transaction that generated this event" + data_type: varbinary + - name: tx_from + description: "Address that sent the transaction" + data_type: varbinary + - name: tx_to + description: "Address that received the transaction" + data_type: varbinary + - name: index + description: "Index of this event within the transaction" + data_type: integer + - name: signature + description: "Event signature hash" + data_type: varbinary + - name: event_name + description: "Name of the emitted event" + data_type: varchar + + - name: blocks + meta: + docs_slug: "/evm/sonic/raw/blocks" + short_description: "The `sonic.blocks` table contains information about blocks on the Sonic blockchain." + description: '{{ doc("sonic_blocks_doc") }}' + columns: + - name: time + description: "The exact UTC timestamp when this block was added to the chain" + data_type: timestamp + - name: number + description: "The sequential number of this block in the chain" + data_type: bigint + - name: gas_limit + description: "Maximum amount of gas that could be used by all transactions in this block" + data_type: decimal(38,0) + - name: gas_used + description: "Actual amount of gas used by all transactions in this block" + data_type: decimal(38,0) + - name: difficulty + description: "Numerical value indicating the computational effort required to mine this block" + data_type: bigint + - name: total_difficulty + description: "Sum of block difficulties up to this block" + data_type: decimal(38,0) + - name: size + description: "Size of this block in bytes" + data_type: bigint + - name: base_fee_per_gas + description: "Base fee per gas in the block (post-EIP-1559)" + data_type: bigint + - name: hash + description: "Unique 256-bit identifier (hash) of this block" + data_type: varbinary + - name: parent_hash + description: "Hash of the previous block in the chain" + data_type: varbinary + - name: miner + description: "Address of the validator that produced this block" + data_type: varbinary + - name: nonce + description: "Value used to demonstrate proof of work for this block" + data_type: varbinary + - name: state_root + description: "Root hash of the state trie" + data_type: varbinary + - name: transactions_root + description: "Root hash of the transactions trie" + data_type: varbinary + - name: receipts_root + description: "Root hash of the receipts trie" + data_type: varbinary + - name: date + description: "The UTC date when this block was added to the chain" + data_type: date + - name: blob_gas_used + description: "Amount of blob gas used in this block" + data_type: bigint + - name: excess_blob_gas + description: "Excess blob gas in this block" + data_type: bigint + - name: parent_beacon_block_root + description: "Root hash of the parent beacon block" + data_type: varbinary + + - name: erc20_sonic + description: "Transfer events for ERC20 tokens on Sonic blockchain" + tables: + - name: evt_transfer + meta: + docs_slug: "/evm/sonic/decoded/interfaces/erc20/evt_transfer" + short_description: "This table contains individual transfer events for ERC20 tokens on the Sonic blockchain. Each row represents a single token transfer event." + description: '{{ doc("erc20_sonic_evt_transfer_doc") }}' + columns: + - name: contract_address + description: "Address of the ERC20 token contract that emitted this event" + - name: evt_tx_hash + description: "Hash of the transaction containing this event" + - name: evt_index + description: "Index position of this event within the transaction" + - name: evt_block_time + description: "Timestamp of the block containing this event" + - name: evt_block_number + description: "The block number containing this event" + - name: from + description: "Address that sent the transaction" + data_type: varbinary + - name: to + description: "Address that received the transaction" + data_type: varbinary + - name: value + description: "Amount of ERC20 tokens transferred, in the token's Sonic unit" + + - name: evt_approval + meta: + docs_slug: "/evm/sonic/decoded/interfaces/erc20/evt_approval" + short_description: "The `sonic.evt_approval` table contains approval events for ERC20 tokens on Sonic, allowing an address to spend tokens on behalf of the owner." + description: '{{ doc("erc20_sonic_evt_approval_doc") }}' + columns: + - name: contract_address + description: "Address of the ERC20 token contract" + - name: evt_tx_hash + description: "Hash of the transaction containing this event" + - name: evt_index + description: "Index position of this event within the transaction" + - name: evt_block_time + description: "Timestamp of the block containing this event" + - name: evt_block_number + description: "The block number containing this event" + - name: owner + description: "Address of the token owner granting approval" + data_type: varbinary + - name: spender + description: "Address being granted permission to spend tokens" + data_type: varbinary + - name: value + description: "Amount of ERC20 tokens approved for spending, in the token's smallest unit" + + - name: erc1155_sonic + description: "Events related to ERC1155 tokens on Sonic blockchain" + tables: + - name: evt_transfersingle + meta: + docs_slug: "/evm/sonic/decoded/interfaces/erc1155/evt_transfersingle" + short_description: "This table contains single transfer events for ERC1155 tokens on the network." + description: '{{ doc("erc1155_sonic_evt_transfersingle_doc") }}' + columns: + - name: contract_address + description: "Address of the ERC1155 token contract" + - name: evt_tx_hash + description: "Hash of the transaction containing this event" + - name: evt_index + description: "Index position of this event within the transaction" + - name: evt_block_time + description: "Timestamp of the block containing this event" + - name: evt_block_number + description: "The block number containing this event" + - name: operator + description: "The address that is authorized to execute the transfer on behalf of the owner" + data_type: varbinary + - name: from + description: "Address that sent the transaction" + data_type: varbinary + - name: to + description: "Address that received the transaction" + data_type: varbinary + - name: id + description: "Unique identifier of the ERC1155 token being transferred" + - name: value + description: "Quantity of the ERC1155 token transferred" + + - name: evt_transferbatch + meta: + docs_slug: "/evm/sonic/decoded/interfaces/erc1155/evt_transferbatch" + short_description: "This table contains all batch transfer events for ERC1155 tokens on the network." + description: '{{ doc("erc1155_ethereum_evt_transferbatch_doc") }}' + columns: + - name: contract_address + description: "Contract address of the ERC1155 token contract" + - name: evt_tx_hash + description: "Hash of the transaction containing this event" + - name: evt_index + description: "Index position of this event within the transaction" + - name: evt_block_time + description: "Timestamp of the block containing this event" + - name: evt_block_number + description: "The block number containing this event" + - name: operator + description: "Contract address authorized to execute the batch transfer on behalf of the owner" + data_type: varbinary + - name: from + description: "Address that sent the transaction" + data_type: varbinary + - name: to + description: "Address that received the transaction" + data_type: varbinary + - name: ids + description: "Array of unique identifiers of the ERC1155 tokens being transferred" + - name: values + description: "Array of quantities for each ERC1155 token transferred, corresponding to the ids array" + + - name: evt_ApprovalForAll + meta: + docs_slug: "/evm/sonic/decoded/interfaces/erc1155/evt_ApprovalForAll" + short_description: "This table contains approval events for all tokens of an ERC1155 contract on this network." + description: '{{ doc("erc1155_ethereum_evt_ApprovalForAll_doc") }}' + columns: + - name: contract_address + description: "Sonic address of the ERC1155 token contract" + - name: evt_tx_hash + description: "Hash of the transaction containing this event" + - name: evt_index + description: "Index position of this event within the transaction" + - name: evt_block_time + description: "Timestamp of the block containing this event" + - name: evt_block_number + description: "The block number containing this event" + - name: approved + description: "Boolean indicating whether approval is granted (true) or revoked (false)" + - name: owner + description: "Sonic address of the token owner granting or revoking approval" + data_type: varbinary + - name: operator + description: "Sonic address being granted or revoked permission to operate all tokens" + data_type: varbinary + + - name: erc721_sonic + description: '{{ doc("erc721_sonic_evt_transfer_doc") }}' + tables: + - name: evt_transfer + description: "Transfer events for ERC721 tokens on this network" + columns: + - name: contract_address + description: "Contract address of the ERC721 token contract" + - name: evt_tx_hash + description: "Hash of the transaction containing this event" + - name: evt_index + description: "Index position of this event within the transaction" + - name: evt_block_time + description: "Timestamp of the block containing this event" + - name: evt_block_number + description: "The block number containing this event" + - name: from + description: "Address that sent the transaction" + data_type: varbinary + - name: to + description: "Address that received the transaction" + data_type: varbinary + - name: tokenId + description: "Unique identifier of the ERC721 token (NFT) being transferred" + + - name: evt_Approval + meta: + docs_slug: "/evm/sonic/decoded/interfaces/erc721/evt_Approval" + short_description: "Approval events for ERC721 tokens on this network" + description: '{{ doc("erc721_ethereum_evt_Approval_doc") }}' + columns: + - name: contract_address + description: "Contract address of the ERC721 token contract" + - name: evt_tx_hash + description: "Hash of the transaction containing this event" + - name: evt_index + description: "Index position of this event within the transaction" + - name: evt_block_time + description: "Timestamp of the block containing this event" + - name: evt_block_number + description: "The block number containing this event" + - name: approved + description: "Boolean indicating whether approval is granted (true) or revoked (false)" + - name: owner + description: "Address of the token owner granting or revoking approval" + data_type: varbinary + - name: tokenId + description: "Unique identifier of the ERC721 token (NFT) for which approval is granted or revoked" + + - name: evt_ApprovalForAll + meta: + docs_slug: "/evm/sonic/decoded/interfaces/erc721/evt_ApprovalForAll" + short_description: "The `sonic.evt_ApprovalForAll` table contains approval events for all tokens of an ERC721 contract on the Sonic blockchain." + description: '{{ doc("erc721_ethereum_evt_ApprovalForAll_doc") }}' + columns: + - name: contract_address + description: "Address of the ERC721 token contract" + - name: evt_tx_hash + description: "Hash of the transaction containing this event" + - name: evt_index + description: "Index position of this event within the transaction" + - name: evt_block_time + description: "Timestamp of the block containing this event" + - name: evt_block_number + description: "The block number containing this event" + - name: approved + description: "Boolean indicating whether approval is granted (true) or revoked (false)" + - name: owner + description: "Address of the token owner granting or revoking approval" + data_type: varbinary + - name: operator + description: "The address being granted or revoked permission to operate all tokens" + data_type: varbinary diff --git a/sources/_base_sources/evm/sonic_docs_block.md b/sources/_base_sources/evm/sonic_docs_block.md new file mode 100644 index 00000000000..0cddb0102b1 --- /dev/null +++ b/sources/_base_sources/evm/sonic_docs_block.md @@ -0,0 +1,254 @@ +{% docs sonic_transactions_doc %} + +The `sonic.transactions` table contains detailed information about transactions on the Sonic blockchain. It includes: + +- Block information: number, timestamp, hash +- Transaction details: hash, from_address, to_address, value +- Gas data: gas_price, gas_limit, gas_used, max_fee_per_gas, priority_fee_per_gas +- Status: success or failure +- Input data for contract interactions +- Nonce and chain_id +- Transaction type and access list + +This table is used for analyzing transaction patterns, gas usage, value transfers, and overall network activity on Sonic. + +{% enddocs %} + +{% docs sonic_traces_doc %} + +The `sonic.traces` table contains records of execution steps for transactions on the Sonic blockchain. Each trace represents an atomic operation that modifies the state of the Ethereum Virtual Machine (EVM). Key components include: + +- Transaction hash and block information +- From and to addresses +- Value transferred +- Gas metrics (gas, gas_used) +- Input and output data +- Call type (e.g., CALL, DELEGATECALL, CREATE) +- Error information and revert reasons +- Trace address for nested calls + +This table is essential for: +- Analyzing internal transactions +- Debugging smart contract interactions +- Tracking value flows through complex transactions +- Understanding contract creation and deployment +- Monitoring protocol operations +- Analyzing cross-chain operations + +{% enddocs %} + +{% docs sonic_traces_decoded_doc %} + +The `sonic.traces_decoded` table contains a subset of decoded traces from the Sonic blockchain dependent on submitted smart contracts and their ABIs. It includes: + +- Block information and transaction details +- Contract name and namespace +- Decoded function names and signatures +- Trace address for execution path tracking +- Transaction origin and destination +- Function parameters (when available) + +This table is used for high level analysis of smart contract interactions and protocol operations. For fully decoded function calls and parameters, refer to protocol-specific decoded tables. + +{% enddocs %} + +{% docs sonic_logs_doc %} + +The `sonic.logs` table contains event logs emitted by smart contracts on the Sonic blockchain. It includes: + +- Block information: number, timestamp, hash +- Transaction details: hash, index, from, to +- Contract address (emitting the event) +- Topic0 (event signature) +- Additional topics (indexed parameters) +- Data field (non-indexed parameters) +- Log index and transaction index + +This table is crucial for: +- Tracking on-chain events +- Monitoring contract activity +- Analyzing token transfers +- Following protocol-specific events +- Tracking cross-chain operations +- Monitoring protocol state changes + +{% enddocs %} + +{% docs sonic_logs_decoded_doc %} + +The `sonic.logs_decoded` table contains a subset of decoded logs from the Sonic blockchain dependent on submitted smart contracts and their ABIs. It includes: + +- Block and transaction information +- Contract details (name, namespace, address) +- Decoded event names and signatures +- Transaction origin and destination +- Event parameters (when available) + +This table is used for high level analysis of smart contract events, particularly useful for monitoring protocol activities. For fully decoded events and parameters, refer to protocol-specific decoded tables. + +{% enddocs %} + +{% docs sonic_blocks_doc %} + +The `sonic.blocks` table contains information about Sonic blocks. It provides essential data about each block in the Sonic blockchain, including: + +- Block identifiers and timestamps +- Gas metrics and size +- Consensus information (difficulty, nonce) +- State roots and receipts +- Parent block information +- Base fee per gas +- Blob gas metrics +- Parent beacon block root + +This table is fundamental for: +- Analyzing block production and timing +- Monitoring network performance +- Tracking gas usage patterns +- Understanding network upgrades +- Analyzing consensus metrics +- Studying blockchain structure + +{% enddocs %} + +{% docs sonic_creation_traces_doc %} + +The `sonic.creation_traces` table contains information about contract deployments on the Sonic blockchain. It includes: + +- Block information and timestamps +- Transaction details +- Contract addresses +- Creator addresses +- Contract bytecode + +This table is essential for: +- Tracking smart contract deployments +- Analyzing contract creation patterns +- Monitoring new protocol deployments +- Auditing contract creation history +- Understanding contract deployment costs + +{% enddocs %} + +{% docs erc20_sonic_evt_transfer_doc %} + +The `erc20_sonic.evt_transfer` table contains ERC20 token transfer events on the Sonic blockchain. Each record represents a token transfer and includes: + +- Block information and timestamps +- Transaction details +- Token contract address +- Sender and receiver addresses +- Transfer amount +- Event index and transaction index + +This table is essential for: +- Tracking token transfers and flows +- Analyzing token holder behavior +- Monitoring token activity +- Understanding token economics +- Tracking cross-chain token movements + +{% enddocs %} + +{% docs erc721_sonic_evt_transfer_doc %} + +The `erc721_sonic.evt_transfer` table contains ERC721 (NFT) transfer events on the Sonic blockchain. Each record represents an NFT transfer and includes: + +- Block information and timestamps +- Transaction details +- NFT contract address +- Sender and receiver addresses +- Token ID +- Event index and transaction index + +This table is crucial for: +- Tracking NFT ownership changes +- Analyzing NFT trading patterns +- Monitoring NFT market activity +- Understanding NFT collections +- Tracking cross-chain NFT movements + +{% enddocs %} + +{% docs erc1155_sonic_evt_transfer_doc %} + +The `erc1155_sonic.evt_transfer` table contains ERC1155 multi-token transfer events on the Sonic blockchain. Each record represents a token transfer and includes: + +- Block information and timestamps +- Transaction details +- Token contract address +- Sender and receiver addresses +- Token ID and amount +- Event index and transaction index + +This table is used for: +- Tracking multi-token transfers +- Analyzing token usage patterns +- Monitoring protocol activity +- Understanding multi-token operations +- Tracking DeFi integrations + +{% enddocs %} + +{% docs erc20_sonic_evt_approval_doc %} + +The `erc20_sonic.evt_approval` table contains approval events for ERC20 tokens on the Sonic blockchain. Each record represents a token approval and includes: + +- Block information and timestamps +- Transaction details +- Token contract address +- Owner address +- Spender address +- Approved amount +- Event index and transaction index + +This table is essential for: +- Tracking token approvals +- Monitoring DeFi allowances +- Analyzing smart contract permissions +- Understanding protocol integrations +- Tracking liquidity provisions + +{% enddocs %} + +{% docs erc1155_sonic_evt_transfersingle_doc %} + +The `erc1155_sonic.evt_transfersingle` table contains single transfer events for ERC1155 tokens on the Sonic blockchain. Each record represents a single token transfer and includes: + +- Block information and timestamps +- Transaction details +- Token contract address +- Operator address +- Sender and receiver addresses +- Token ID and amount +- Event index and transaction index + +This table is used for: +- Tracking individual token transfers +- Analyzing token usage patterns +- Monitoring protocol activity +- Understanding multi-token operations +- Tracking DeFi integrations + +{% enddocs %} + +{% docs erc1155_sonic_evt_transferbatch_doc %} + +The `erc1155_sonic.evt_transferbatch` table contains batch transfer events for ERC1155 tokens on the Sonic blockchain. Each record represents a batch token transfer and includes: + +- Block information and timestamps +- Transaction details +- Token contract address +- Operator address +- Sender and receiver addresses +- Array of token IDs and amounts +- Event index and transaction index + +This table is crucial for: +- Tracking bulk token transfers +- Analyzing batch operations +- Monitoring large-scale movements +- Understanding protocol migrations +- Tracking multi-token operations + +{% enddocs %} diff --git a/sources/_datasets/dune/sources.yml b/sources/_datasets/dune/sources.yml new file mode 100644 index 00000000000..adc99858345 --- /dev/null +++ b/sources/_datasets/dune/sources.yml @@ -0,0 +1,6 @@ +version: 2 + +sources: + - name: dune + tables: + - name: result_blockchains diff --git a/sources/_sector/dex/trades/ethereum/_sources.yml b/sources/_sector/dex/trades/ethereum/_sources.yml index 5c63d9043bc..4a582b28ca8 100644 --- a/sources/_sector/dex/trades/ethereum/_sources.yml +++ b/sources/_sector/dex/trades/ethereum/_sources.yml @@ -132,3 +132,6 @@ sources: - name: fluid_ethereum tables: - name: FluidDexT1_evt_Swap + - name: pancakeswap_ethereum + tables: + - name: ExclusiveDutchOrderReactor_evt_Fill diff --git a/sources/_sector/dex/trades/flare/_sources.yml b/sources/_sector/dex/trades/flare/_sources.yml new file mode 100644 index 00000000000..5052c204fd3 --- /dev/null +++ b/sources/_sector/dex/trades/flare/_sources.yml @@ -0,0 +1,21 @@ +version: 2 + +sources: + - name: blazeswap_flare + tables: + - name: BlazeSwapFactory_evt_PairCreated + - name: BLAZE_LP_evt_Swap + + - name: sparkdex_flare + tables: + - name: UniswapV3Factory_evt_PoolCreated + - name: UniswapV2Factory_evt_PairCreated + - name: UniswapV3Pool_evt_Swap + - name: UniswapV2Pool_evt_Swap + + - name: enosys_flare + tables: + - name: EnosysPair_evt_Swap + - name: EnosysDexFactory_evt_PairCreated + - name: EnosysDexV3Pool_evt_Swap + - name: EnosysDexV3Factory_evt_PoolCreated diff --git a/sources/_sector/dex/trades/optimism/_sources.yml b/sources/_sector/dex/trades/optimism/_sources.yml index 3aa47f8f5cf..4d723797c87 100644 --- a/sources/_sector/dex/trades/optimism/_sources.yml +++ b/sources/_sector/dex/trades/optimism/_sources.yml @@ -98,3 +98,6 @@ sources: - name: saddle_finance_optimism tables: - name: SwapFlashLoan_evt_TokenSwap + - name: bridgers_optimism + tables: + - name: Bridgers_evt_Swap diff --git a/sources/_sector/dex/trades/ronin/_sources.yml b/sources/_sector/dex/trades/ronin/_sources.yml index 8c61432710f..4e40c27221e 100644 --- a/sources/_sector/dex/trades/ronin/_sources.yml +++ b/sources/_sector/dex/trades/ronin/_sources.yml @@ -4,4 +4,8 @@ sources: - name: katana_dex_ronin tables: - name: KatanaPair_evt_Swap - - name: KatanaFactory_evt_PairCreated \ No newline at end of file + - name: KatanaFactory_evt_PairCreated + - name: katana_dex_ronin + tables: + - name: KatanaV3Pool_evt_Swap + - name: KatanaV3Factory_evt_PoolCreated diff --git a/sources/_sector/lending/borrow/zksync/_sources.yml b/sources/_sector/lending/borrow/zksync/_sources.yml index eba64c2b327..a05983f222e 100644 --- a/sources/_sector/lending/borrow/zksync/_sources.yml +++ b/sources/_sector/lending/borrow/zksync/_sources.yml @@ -1,6 +1,12 @@ version: 2 sources: + - name: aave_v3_zksync + tables: + - name: Pool_evt_Borrow + - name: Pool_evt_Repay + - name: Pool_evt_LiquidationCall + - name: zerolend_zksync tables: - name: Pool_evt_Borrow diff --git a/sources/_sector/lending/flashloans/zksync/_sources.yml b/sources/_sector/lending/flashloans/zksync/_sources.yml index 4d3acf5e19e..33180194b58 100644 --- a/sources/_sector/lending/flashloans/zksync/_sources.yml +++ b/sources/_sector/lending/flashloans/zksync/_sources.yml @@ -1,6 +1,10 @@ version: 2 sources: + - name: aave_v3_zksync + tables: + - name: Pool_evt_FlashLoan + - name: zerolend_zksync tables: - name: Pool_evt_FlashLoan diff --git a/sources/_sector/lending/supply/arbitrum/_sources.yml b/sources/_sector/lending/supply/arbitrum/_sources.yml index 2e2ec7b3576..4cd48c2588d 100644 --- a/sources/_sector/lending/supply/arbitrum/_sources.yml +++ b/sources/_sector/lending/supply/arbitrum/_sources.yml @@ -5,6 +5,7 @@ sources: tables: - name: L2Pool_evt_Supply - name: L2Pool_evt_Withdraw + - name: WrappedTokenGatewayV3_call_withdrawETH - name: compound_v3_arbitrum tables: diff --git a/sources/_sector/lending/supply/avalanche_c/_sources.yml b/sources/_sector/lending/supply/avalanche_c/_sources.yml index 6704f977d09..9a600dbfab2 100644 --- a/sources/_sector/lending/supply/avalanche_c/_sources.yml +++ b/sources/_sector/lending/supply/avalanche_c/_sources.yml @@ -6,12 +6,14 @@ sources: - name: LendingPool_evt_Deposit - name: LendingPool_evt_Withdraw - name: LendingPool_evt_RedeemUnderlying + - name: WrappedTokenGatewayV2_call_withdrawETH - name: aave_v3_avalanche_c tables: - name: Pool_evt_Supply - name: Pool_evt_Withdraw - name: Pool_evt_RedeemUnderlying + - name: WrappedTokenGatewayV3_call_withdrawETH - name: benqi_finance_avalanche_c tables: diff --git a/sources/_sector/lending/supply/base/_sources.yml b/sources/_sector/lending/supply/base/_sources.yml index 93a23a0e7cb..0fe93a08384 100644 --- a/sources/_sector/lending/supply/base/_sources.yml +++ b/sources/_sector/lending/supply/base/_sources.yml @@ -6,6 +6,7 @@ sources: - name: L2Pool_evt_Supply - name: L2Pool_evt_Withdraw - name: L2Pool_evt_RedeemUnderlying + - name: WrappedTokenGatewayV3_call_withdrawETH - name: compound_v3_base tables: diff --git a/sources/_sector/lending/supply/bnb/_sources.yml b/sources/_sector/lending/supply/bnb/_sources.yml index 112c7e1b820..0fdc926b6d5 100644 --- a/sources/_sector/lending/supply/bnb/_sources.yml +++ b/sources/_sector/lending/supply/bnb/_sources.yml @@ -10,6 +10,7 @@ sources: tables: - name: Pool_evt_Supply - name: Pool_evt_Withdraw + - name: WrappedTokenGatewayV3_call_withdrawETH - name: the_granary_bnb tables: diff --git a/sources/_sector/lending/supply/ethereum/_sources.yml b/sources/_sector/lending/supply/ethereum/_sources.yml index bc4108ff420..ff1a916f458 100644 --- a/sources/_sector/lending/supply/ethereum/_sources.yml +++ b/sources/_sector/lending/supply/ethereum/_sources.yml @@ -11,21 +11,25 @@ sources: tables: - name: LendingPool_evt_Deposit - name: LendingPool_evt_Withdraw + - name: WrappedTokenGatewayV2_call_withdrawETH - name: aave_v3_ethereum tables: - name: Pool_evt_Supply - name: Pool_evt_Withdraw - name: Pool_evt_ReserveDataUpdated + - name: WrappedTokenGatewayV3_call_withdrawETH - name: LidoPool_evt_Supply - name: LidoPool_evt_Withdraw - name: LidoPool_evt_ReserveDataUpdated + - name: LidoWrappedTokenGatewayV3_call_withdrawETH - name: aave_v3_etherfi_ethereum tables: - name: PoolInstance_evt_Supply - name: PoolInstance_evt_Withdraw - name: PoolInstance_evt_ReserveDataUpdated + - name: WrappedTokenGatewayV3_call_withdrawETH - name: compound_v2_ethereum tables: diff --git a/sources/_sector/lending/supply/fantom/_sources.yml b/sources/_sector/lending/supply/fantom/_sources.yml index 24027641a58..bcd7da0b21e 100644 --- a/sources/_sector/lending/supply/fantom/_sources.yml +++ b/sources/_sector/lending/supply/fantom/_sources.yml @@ -6,6 +6,7 @@ sources: - name: Pool_evt_Supply - name: Pool_evt_Withdraw - name: Pool_evt_RedeemUnderlying + - name: WrappedTokenGatewayV3_call_withdrawETH - name: the_granary_fantom tables: diff --git a/sources/_sector/lending/supply/gnosis/_sources.yml b/sources/_sector/lending/supply/gnosis/_sources.yml index fe0319ee20d..54652218d9d 100644 --- a/sources/_sector/lending/supply/gnosis/_sources.yml +++ b/sources/_sector/lending/supply/gnosis/_sources.yml @@ -10,6 +10,7 @@ sources: tables: - name: Pool_evt_Supply - name: Pool_evt_Withdraw + - name: WrappedTokenGatewayV3_call_withdrawETH - name: real_rmm_v1_gnosis tables: diff --git a/sources/_sector/lending/supply/optimism/_sources.yml b/sources/_sector/lending/supply/optimism/_sources.yml index 4e90f45f3c7..3531ec489cb 100644 --- a/sources/_sector/lending/supply/optimism/_sources.yml +++ b/sources/_sector/lending/supply/optimism/_sources.yml @@ -6,6 +6,7 @@ sources: - name: Pool_evt_Supply - name: Pool_evt_Withdraw - name: Pool_evt_RedeemUnderlying + - name: WrappedTokenGatewayV3_call_withdrawETH - name: sonne_finance_optimism tables: diff --git a/sources/_sector/lending/supply/polygon/_sources.yml b/sources/_sector/lending/supply/polygon/_sources.yml index dc3812322c7..08f15c4112d 100644 --- a/sources/_sector/lending/supply/polygon/_sources.yml +++ b/sources/_sector/lending/supply/polygon/_sources.yml @@ -6,12 +6,14 @@ sources: - name: LendingPool_evt_Deposit - name: LendingPool_evt_Withdraw - name: LendingPool_evt_RedeemUnderlying + - name: WrappedTokenGatewayV2_call_withdrawETH - name: aave_v3_polygon tables: - name: Pool_evt_Supply - name: Pool_evt_Withdraw - name: Pool_evt_RedeemUnderlying + - name: WrappedTokenGatewayV3_call_withdrawETH - name: compound_v3_polygon tables: diff --git a/sources/_sector/lending/supply/scroll/_sources.yml b/sources/_sector/lending/supply/scroll/_sources.yml index 297f65da6b7..967e06b6d80 100644 --- a/sources/_sector/lending/supply/scroll/_sources.yml +++ b/sources/_sector/lending/supply/scroll/_sources.yml @@ -5,6 +5,7 @@ sources: tables: - name: L2Pool_evt_Supply - name: L2Pool_evt_Withdraw + - name: WrappedTokenGatewayV3_call_withdrawETH - name: layer_bank_scroll tables: diff --git a/sources/_sector/lending/supply/zksync/_sources.yml b/sources/_sector/lending/supply/zksync/_sources.yml index 40e2f2be49f..18e8fe9ac4b 100644 --- a/sources/_sector/lending/supply/zksync/_sources.yml +++ b/sources/_sector/lending/supply/zksync/_sources.yml @@ -1,6 +1,12 @@ version: 2 sources: + - name: aave_v3_zksync + tables: + - name: Pool_evt_Supply + - name: Pool_evt_Withdraw + - name: WrappedTokenGatewayV3_call_withdrawETH + - name: zerolend_zksync tables: - name: Pool_evt_Supply diff --git a/sources/_sector/nft/_sources.yml b/sources/_sector/nft/_sources.yml index b0169568859..1e82442e5fc 100644 --- a/sources/_sector/nft/_sources.yml +++ b/sources/_sector/nft/_sources.yml @@ -49,3 +49,6 @@ sources: - name: nft_sei tables: - name: transfers + - name: nft_ronin + tables: + - name: transfers diff --git a/sources/_sector/nft/trades/ronin_sources.yml b/sources/_sector/nft/trades/ronin_sources.yml new file mode 100644 index 00000000000..8624efeec01 --- /dev/null +++ b/sources/_sector/nft/trades/ronin_sources.yml @@ -0,0 +1,7 @@ +version: 2 + +sources: + - name: mavis_marketplace_ronin + tables: + - name: MavisMarketPlace_evt_OrderMatched + diff --git a/sources/_subprojects_outputs/tokens/_sources.yml b/sources/_subprojects_outputs/tokens/_sources.yml index fcaaea8777e..8bc3e6d082d 100644 --- a/sources/_subprojects_outputs/tokens/_sources.yml +++ b/sources/_subprojects_outputs/tokens/_sources.yml @@ -121,6 +121,20 @@ sources: data_type: integer - name: name data_type: varchar + - name: rwa + columns: + - name: blockchain + data_type: varchar + - name: contract_address + data_type: varbinary + - name: backing + data_type: varchar + - name: symbol + data_type: varchar + - name: decimals + data_type: integer + - name: name + data_type: varchar - name: tokens_arbitrum @@ -174,6 +188,7 @@ sources: data_type: integer - name: name data_type: varchar + - name: tokens_base @@ -289,6 +304,20 @@ sources: data_type: integer - name: name data_type: varchar + - name: rwa + columns: + - name: blockchain + data_type: varchar + - name: contract_address + data_type: varbinary + - name: backing + data_type: varchar + - name: symbol + data_type: varchar + - name: decimals + data_type: integer + - name: name + data_type: varchar - name: tokens_fantom diff --git a/sources/aave/base/aave_base_sources.yml b/sources/aave/base/aave_base_sources.yml new file mode 100644 index 00000000000..e3348a3f85f --- /dev/null +++ b/sources/aave/base/aave_base_sources.yml @@ -0,0 +1,61 @@ +version: 2 + +sources: + - name: aave_v3_base + description: "Decoded contracts for aave v3 on Base" + + tables: + - name: L2Pool_evt_ReserveDataUpdated + description: "Provides the liquidity index, stable and variable borrow rates for aave v3 reserves." + columns: + - name: contract_address + description: "Aave token contract address" + type: varbinary + + - name: evt_tx_hash + description: "Transaction hash of the event" + type: varbinary + + - name: evt_tx_from + description: "Address that initiated the transaction" + type: varbinary + + - name: evt_tx_to + description: "Address that received the transaction" + type: varbinary + + - name: evt_index + description: "Event index" + type: bigint + + - name: evt_block_time + description: "Timestamp for block event time in UTC" + type: timestamp + + - name: evt_block_number + description: "Event block number" + type: bigint + + - name: reserve + description: "Aave reserve contract address" + type: varbinary + + - name: liquidityRate + description: "Liquidity rate value of the reserve" + type: uint256 + + - name: stableBorrowRate + description: "Stable borrow rate value of the reserve" + type: uint256 + + - name: variableBorrowRate + description: "Variable borrow rate value of the reserve" + type: uint256 + + - name: liquidityIndex + description: "Liquidity index value of the reserve" + type: uint256 + + - name: variableBorrowIndex + description: "Variable borrow index value of the reserve" + type: uint256 \ No newline at end of file diff --git a/sources/beets/sonic/beets_sonic_sources.yml b/sources/beets/sonic/beets_sonic_sources.yml new file mode 100644 index 00000000000..0e6aa5daddc --- /dev/null +++ b/sources/beets/sonic/beets_sonic_sources.yml @@ -0,0 +1,35 @@ +version: 2 + +sources: + - name: beethoven_x_v2_sonic + description: > + Decoded tables related to Beethoven X, an automated portfolio manager and trading platform, on Sonic. + tables: + - name: Vault_evt_Swap + - name: Vault_evt_PoolRegistered + - name: WeightedPoolFactory_call_create + - name: Vault_evt_PoolBalanceChanged + - name: Vault_evt_PoolBalanceManaged + - name: ComposableStablePoolFactory_call_create + - name: Vault_evt_FlashLoan + - name: Vault_evt_TokensRegistered + + - name: beethoven_x_v3_sonic + description: > + Decoded tables related to Beethoven X, an automated portfolio manager and trading platform, on Sonic. + tables: + - name: Vault_evt_PoolRegistered + - name: WeightedPoolFactory_evt_PoolCreated + - name: WeightedPoolFactory_call_create + - name: Vault_evt_LiquidityAdded + - name: Vault_evt_LiquidityRemoved + - name: StablePoolFactory_evt_PoolCreated + - name: StablePoolFactory_call_create + - name: Vault_evt_Swap + - name: ProtocolFeeController_evt_ProtocolSwapFeeCollected + - name: ProtocolFeeController_evt_ProtocolYieldFeeCollected + - name: Vault_evt_Wrap + - name: Vault_evt_Unwrap + - name: Vault_evt_LiquidityAddedToBuffer + - name: Vault_evt_LiquidityRemovedFromBuffer + - name: Vault_evt_SwapFeePercentageChanged \ No newline at end of file diff --git a/sources/labels/addresses/__single_category_labels__/balancer_v2/labels_balancer_v2_sources.yml b/sources/labels/addresses/__single_category_labels__/balancer/labels_balancer_sources.yml similarity index 97% rename from sources/labels/addresses/__single_category_labels__/balancer_v2/labels_balancer_v2_sources.yml rename to sources/labels/addresses/__single_category_labels__/balancer/labels_balancer_sources.yml index 7e04cd0686b..361f913c900 100644 --- a/sources/labels/addresses/__single_category_labels__/balancer_v2/labels_balancer_v2_sources.yml +++ b/sources/labels/addresses/__single_category_labels__/balancer/labels_balancer_sources.yml @@ -889,6 +889,33 @@ sources: - name: addr - name: gauge_type - name: weight + + - name: GnosisRootGauge_call_initialize + - name: ArbitrumRootGauge_call_initialize + - name: AvalancheRootGauge_call_initialize + - name: BaseRootGauge_call_initialize + - name: OptimismRootGauge_call_initialize + - name: PolygonRootGauge_call_initialize + - name: PolygonZkEVMRootGauge_call_initialize + - name: LiquidityGauge_call_initialize + - name: LiquidityGaugeV5_call_initialize + - name: CappedArbitrumRootGauge_call_initialize + - name: CappedOptimismRootGauge_call_initialize + - name: CappedPolygonRootGauge_call_initialize + - name: CappedLiquidityGaugeV5_call_initialize + - name: GnosisRootGauge_call_killGauge + - name: ArbitrumRootGauge_call_killGauge + - name: AvalancheRootGauge_call_killGauge + - name: BaseRootGauge_call_killGauge + - name: OptimismRootGauge_call_killGauge + - name: PolygonRootGauge_call_killGauge + - name: PolygonZkEVMRootGauge_call_killGauge + - name: LiquidityGauge_call_killGauge + - name: LiquidityGaugeV5_call_killGauge + - name: CappedArbitrumRootGauge_call_killGauge + - name: CappedOptimismRootGauge_call_killGauge + - name: CappedPolygonRootGauge_call_killGauge + - name: CappedLiquidityGaugeV5_call_killGauge - name: balancer_polygon description: > 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 360b00d059a..d11a59bf6d5 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 @@ -414,6 +414,10 @@ sources: - name: SonicStrategyForSA_evt_Withdraw - name: SonicStrategyForSA_evt_Reinvest - name: SonicStrategyForSA_evt_Transfer + - name: StableJackStrategy_evt_Deposit + - name: StableJackStrategy_evt_Withdraw + - name: StableJackStrategy_evt_Reinvest + - name: StableJackStrategy_evt_Transfer - name: StableVaultStrategyForS3D_evt_Deposit - name: StableVaultStrategyForS3D_evt_Withdraw - name: StableVaultStrategyForS3D_evt_Reinvest @@ -446,6 +450,10 @@ sources: - name: SynapseStrategy_evt_Withdraw - name: SynapseStrategy_evt_Reinvest - name: SynapseStrategy_evt_Transfer + - name: TokenMillStrategy_evt_Deposit + - name: TokenMillStrategy_evt_Withdraw + - name: TokenMillStrategy_evt_Reinvest + - name: TokenMillStrategy_evt_Transfer - name: UnipoolStrategyV1_evt_Deposit - name: UnipoolStrategyV1_evt_Withdraw - name: UnipoolStrategyV1_evt_Reinvest