Skip to content

Commit

Permalink
Merge branch 'duneanalytics:main' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
viniabussafi authored Jul 24, 2024
2 parents 190a2a1 + 5f23fbd commit b699f64
Show file tree
Hide file tree
Showing 36 changed files with 399 additions and 26 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{% macro paraswap_v6_trades_master(blockchain, project, contract_name) %}with
v6_trades as (
{% macro paraswap_v6_trades_by_contract(blockchain, project, contract_name, contract_details) %}
with v6_trades as (
with
sell_trades as (
with
Expand Down Expand Up @@ -98,7 +98,7 @@ select
cast(date_trunc('day', call_block_time) as date) as block_date,
cast(date_trunc('month', call_block_time) as date) as block_month,
'paraswap' AS project,
'6.2' as version,
'{{ contract_details['version'] }}' as version,
call_block_time as blockTime,
call_block_number as blockNumber,
call_tx_hash as txHash,
Expand Down Expand Up @@ -139,4 +139,23 @@ select
bitwise_left_shift(TRY_CAST(1 as uint256), 95)
) <> 0 AS isTakeSurplus
from
v6_trades{% endmacro %}
v6_trades{% endmacro %}

{% macro paraswap_v6_trades_master(blockchain, project) %}
{%
set contracts = {
"AugustusV6_1": {
"version": "6.1",
},
"AugustusV6_2": {
"version": "6.2",
}
}
%}
{% for contract_name, contract_details in contracts.items() %}
select * from ({{ paraswap_v6_trades_by_contract(blockchain, project, contract_name, contract_details) }})
{% if not loop.last %}
union all
{% endif %}
{% endfor %}
{% endmacro %}
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,4 @@
)
}}

{{ paraswap_v6_trades_master('arbitrum', 'paraswap', 'AugustusV6_2') }}
{{ paraswap_v6_trades_master('arbitrum', 'paraswap') }}
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,4 @@
)
}}

{{ paraswap_v6_trades_master('avalanche_c', 'paraswap', 'AugustusV6_2') }}
{{ paraswap_v6_trades_master('avalanche_c', 'paraswap') }}
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,4 @@
)
}}

{{ paraswap_v6_trades_master('base', 'paraswap', 'AugustusV6_2') }}
{{ paraswap_v6_trades_master('base', 'paraswap') }}
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,4 @@
)
}}

{{ paraswap_v6_trades_master('bnb', 'paraswap', 'AugustusV6_2') }}
{{ paraswap_v6_trades_master('bnb', 'paraswap') }}
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,4 @@
)
}}

{{ paraswap_v6_trades_master('ethereum', 'paraswap', 'AugustusV6_2') }}
{{ paraswap_v6_trades_master('ethereum', 'paraswap') }}
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,4 @@
)
}}

{{ paraswap_v6_trades_master('fantom', 'paraswap', 'AugustusV6_2') }}
{{ paraswap_v6_trades_master('fantom', 'paraswap') }}
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,4 @@
)
}}

{{ paraswap_v6_trades_master('optimism', 'paraswap', 'AugustusV6_2') }}
{{ paraswap_v6_trades_master('optimism', 'paraswap') }}
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,4 @@
)
}}

{{ paraswap_v6_trades_master('polygon', 'paraswap', 'AugustusV6_2') }}
{{ paraswap_v6_trades_master('polygon', 'paraswap') }}
1 change: 1 addition & 0 deletions dex/models/dex_info.sql
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,7 @@ FROM (VALUES
, ('lynex', 'Lynex', 'Direct', 'Lynex')
, ('nile', 'Nile', 'Direct', 'Nile')
, ('nuri', 'Nuri', 'Direct', 'nuriexchange')
, ('merchant_moe', 'Merchant Moe', 'Direct', 'MerchantMoe_xyz')
, ('icecreamswap', 'IceCreamSwap', 'Direct', 'icecream_swap')
, ('thruster', 'Thruster Finance', 'Direct', 'ThrusterFi')
, ('blasterswap', 'BlasterSwap', 'Direct', 'BlasterSwap')
Expand Down
1 change: 1 addition & 0 deletions dex/models/trades/dex_base_trades.sql
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
, ref('dex_zora_base_trades')
, ref('dex_zkevm_base_trades')
, ref('dex_linea_base_trades')
, ref('dex_mantle_base_trades')
, ref('dex_blast_base_trades')
] %}

Expand Down
23 changes: 23 additions & 0 deletions dex/models/trades/mantle/_schema.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
version: 2

models:
- name: dex_mantle_base_trades
tests:
- check_dex_info_relationship

- name: merchant_moe_mantle_base_trades
meta:
blockchain: mantle
sector: dex
project: merchant_moe
contributors: hosuke
config:
tags: [ 'mantle', 'dex', 'trades', 'merchant_moe' ]
description: "merchant_moe mantle base trades"
tests:
- dbt_utils.unique_combination_of_columns:
combination_of_columns:
- tx_hash
- evt_index
- check_dex_base_trades_seed:
seed_file: ref('merchant_moe_mantle_base_trades_seed')
48 changes: 48 additions & 0 deletions dex/models/trades/mantle/dex_mantle_base_trades.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
{{ config(
schema = 'dex_mantle'
, alias = 'base_trades'
, materialized = 'view'
)
}}

{% set base_models = [
ref('merchant_moe_mantle_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 = 'mantle'
, columns = ['from', 'to', 'index']
)
}}
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{{
config(
schema = 'merchant_moe_mantle',
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 = 'mantle',
project = 'merchant_moe',
version = '1',
Pair_evt_Swap = source('merchant_moe_mantle', 'MoePair_evt_Swap'),
Factory_evt_PairCreated = source('merchant_moe_mantle', 'MoeFactory_evt_PairCreated')
)
}}
14 changes: 14 additions & 0 deletions dex/seeds/trades/_schema.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3811,3 +3811,17 @@ seeds:
token_sold_amount_raw: uint256
block_date: timestamp

- name: merchant_moe_mantle_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
4 changes: 4 additions & 0 deletions dex/seeds/trades/merchant_moe_mantle_base_trades_seed.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
blockchain,project,version,block_date,tx_hash,evt_index,token_bought_address,token_sold_address,block_number,token_bought_amount_raw,token_sold_amount_raw
mantle,merchant_moe,1,2024-07-18,0x89e0bdd2ca4f6e761e8bd4ac47662329e3a1f68dd212efe67f9bcb6cb8883207,11,0x201eba5cc46d216ce6dc03f6a759e8e766e956ae,0xdeaddeaddeaddeaddeaddeaddeaddeaddead1111,66589887,394988,114000000000000
mantle,merchant_moe,1,2024-07-18,0x54360fca25f09983ff88e25e890bf36e7fc82273444a05d3b779891bcda9eba1,8,0x201eba5cc46d216ce6dc03f6a759e8e766e956ae,0xdeaddeaddeaddeaddeaddeaddeaddeaddead1111,66589884,904316,261000000000000
mantle,merchant_moe,1,2024-07-18,0x7a0ff2aea98ef80e496ae5cc30b3dc0e72cf32f685156dc8ce3561e25e977411,17,0x201eba5cc46d216ce6dc03f6a759e8e766e956ae,0xdeaddeaddeaddeaddeaddeaddeaddeaddead1111,66589886,566496,163500000000000
10 changes: 9 additions & 1 deletion models/prices/arbitrum/prices_arbitrum_tokens.sql
Original file line number Diff line number Diff line change
Expand Up @@ -207,5 +207,13 @@ FROM
('sx-sx-network', 'arbitrum', 'SX', 0x8cf7e3aa6faf6ae180e5ec3f0fb95081c2086ebe, 18),
('zro-layerzero', 'arbitrum', 'ZRO', 0x6985884C4392D348587B19cb9eAAf157F13271cd, 18),
('pickle-pickle-finance', 'arbitrum', 'PICKLE', 0x965772e0e9c84b6f359c8597c891108dcf1c5b1a, 18),
('opul-opuloustoken-via-chainportio', 'arbitrum', 'OPUL', 0x0c5fa0E07949F941A6c2C29a008252db1527d6EE, 18)
('opul-opuloustoken-via-chainportio', 'arbitrum', 'OPUL', 0x0c5fa0E07949F941A6c2C29a008252db1527d6EE, 18),
('weeth-wrapped-eeth', 'arbitrum', 'weETH', 0x35751007a407ca6feffe80b3cb397736d2cf4dbe, 18),
('rsr-reserve-rights', 'arbitrum', 'RSR', 0xca5ca9083702c56b481d1eec86f1776fdbd2e594, 18),
('usdm-mountain-protocol-usd', 'arbitrum', 'USDM', 0x57f5e098cad7a3d1eed53991d4d66c45c9af7812, 18),
('matic-polygon', 'arbitrum', 'MATIC', 0x561877b6b3dd7651313794e5f2894b2f18be0766, 18),
-- ('reserve-electronic-usd', 'arbitrum', 'eUSD', 0x12275dcb9048680c4be40942ea4d92c74c63b844, 18), -- not yet in coinpaprika
-- ('reserve-eth-plus', 'arbitrum', 'ETH+', 0x18c14c2d707b2212e17d1579789fc06010cfca23, 18), -- not yet in coinpaprika
('ethfi-etherfi', 'arbitrum', 'ETHFI', 0x7189fb5b6504bbff6a852b13b7b82a3c118fdc27, 18),
('ens-ethereum-name-service', 'arbitrum', 'ENS', 0xfea31d704deb0975da8e77bf13e04239e70d7c28, 18)
) as temp (token_id, blockchain, symbol, contract_address, decimals)
13 changes: 12 additions & 1 deletion models/prices/base/prices_base_tokens.sql
Original file line number Diff line number Diff line change
Expand Up @@ -112,5 +112,16 @@ FROM
('well-moonwell', 'base', 'WELL', 0xff8adec2221f9f4d8dfbafa6b9a297d17603493d, 18),
('mochi3-mochi', 'base', 'MOCHI', 0xf6e932ca12afa26665dc4dde7e27be02a7c02e50, 18),
('bet-betbase', 'base', 'BET', 0x80F6BcedD3d4fa1035285affA30e38f464Db3895, 18),
('aura-aura-finance','base','AURA',0x1509706a6c66ca549ff0cb464de88231ddbe213b, 18)
('aura-aura-finance','base','AURA',0x1509706a6c66ca549ff0cb464de88231ddbe213b, 18),
('ezeth-renzo-restaked-eth', 'base', 'ezETH', 0x2416092f143378750bb29b79ed961ab195cceea5, 18),
('zro-layerzero', 'base', 'ZRO', 0x6985884c4392d348587b19cb9eaaf157f13271cd, 18),
('btcb-bitcoin-on-base','base','BTCB',0x0c41f1fc9022feb69af6dc666abfe73c9ffda7ce, 18),
('void-the-void','base','VOID',0x21eceaf3bf88ef0797e3927d855ca5bb569a47fc, 18),
('fpepe-based-father-pepe','base','FPEPE',0x81f91fe59ee415735d59bd5be5cca91a0ea4fa69, 8),
('usa-based-usa','base','USA',0xb56d0839998fd79efcd15c27cf966250aa58d6d3, 18),
('boomer-boomer','base','BOOMER',0xcde172dc5ffc46d228838446c57c1227e0b82049, 18),
('boe-boe','base','BOE',0xff62ddfa80e513114c3a0bf4d6ffff1c1d17aadf, 18),
('9mm-shigure-ui-on-base','base','9mm',0x340c070260520ae477b88caa085a33531897145b, 18),
('wolf13-landwolf','base','WOLF',0x88faea256f789f8dd50de54f9c807eef24f71b16, 18),
('normus-normus','base','NORMUS',0xba5ede8d98ab88cea9f0d69918dde28dc23c2553, 18)
) as temp (token_id, blockchain, symbol, contract_address, decimals)
13 changes: 12 additions & 1 deletion models/prices/ethereum/prices_ethereum_tokens.sql
Original file line number Diff line number Diff line change
Expand Up @@ -1797,7 +1797,18 @@ FROM
('zro-layerzero', 'ethereum', 'ZRO', 0x6985884c4392d348587b19cb9eaaf157f13271cd, 18),
('quartz-sandclock', 'ethereum', 'QUARTZ', 0xba8a621b4a54e61c442f5ec623687e2a942225ef, 18),
('wcomai-wrapped-commune-ai', 'ethereum', 'WCOMAI', 0xc78b628b060258300218740b1a7a5b3c82b3bd9f, 18),
('wbeth-wrapped-beacon-eth', 'ethereum', 'WBETH', 0xa2E3356610840701BDf5611a53974510Ae27E2e1, 18)
('wbeth-wrapped-beacon-eth', 'ethereum', 'WBETH', 0xa2E3356610840701BDf5611a53974510Ae27E2e1, 18),
('hoppy2-hoppy', 'ethereum', 'HOPPY', 0x6e79b51959cf968d87826592f46f819f92466615, 9),
('peipei1-peipei', 'ethereum', 'PEIPEI', 0x3ffeea07a27fab7ad1df5297fa75e77a43cb5790, 9),
('draggy-draggy-cto', 'ethereum', 'DRAGGY', 0xd12a99dbc40036cec6f1b776dccd2d36f5953b94, 9),
('maga-maga-hat', 'ethereum', 'MAGA', 0xd29da236dd4aac627346e1bba06a619e8c22d7c5, 9),
('flappy2-flappy', 'ethereum', 'FLAPPY', 0x590246bfbf89b113d8ac36faeea12b7589f7fe5b, 9),
('kendu-kendu-inu', 'ethereum', 'KENDU', 0xaa95f26e30001251fb905d264aa7b00ee9df6c18, 18),
('maganomics-maganomics', 'ethereum', 'MAGANOMICS ', 0x7e744bbb1a49a44dfcc795014a4ba618e418fbbe, 9),
('wojak-wojak', 'ethereum', 'WOJAK ', 0x5026f006b85729a8b14553fae6af249ad16c9aab, 18),
('kai-kai-ken', 'ethereum', 'KAI ', 0xa045fe936e26e1e1e1fb27c1f2ae3643acde0171, 9),
('gme-gme-ethereum', 'ethereum', 'GME ', 0xc56c7a0eaa804f854b536a5f3d5f49d2ec4b12b8, 9),
('birddog-birddog', 'ethereum', 'BIRDDOG ', 0x70fd93fb088150e203d2243b9bd3190276f80c70, 9)
) as temp (token_id, blockchain, symbol, contract_address, decimals)
where contract_address not in (
-- bad price feeds
Expand Down
2 changes: 2 additions & 0 deletions models/prices/linea/prices_linea_tokens.sql
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,6 @@ FROM
,('dai-dai', 'linea', 'DAI', 0x4AF15ec2A0BD43Db75dd04E62FAA3B8EF36b00d5, 18)
,('m-btc-merlins-seal-btc', 'linea', 'M-BTC',0xe4D584ae9b753e549cAE66200A6475d2f00705f7, 18)
,('solvbtc-solv-protocol-solvbtc', 'linea', 'solvBTC', 0x5FFcE65A40f6d3de5332766ffF6A28BF491C868c, 18)
,('ezeth-renzo-restaked-eth', 'linea', 'ezETH', 0x2416092f143378750bb29b79ed961ab195cceea5, 18)
,('usde-ethena-usde', 'linea', 'USDe', 0x5d3a1ff2b6bab83b63cd9ad0787074081a52ef34, 18)
) as temp (token_id, blockchain, symbol, contract_address, decimals)
9 changes: 8 additions & 1 deletion models/prices/optimism/prices_optimism_tokens_curated.sql
Original file line number Diff line number Diff line change
Expand Up @@ -123,5 +123,12 @@ FROM
('tux-magicaltux', 'TUX', 0x17aabf6838a6303fc6e9c5a227dc1eb6d95c829a, 18),
('sonne-sonne-finance', 'SONNE', 0x1db2466d9f5e10d7090e7152b68d62703a2245f0, 18),
('reth-rocket-pool-eth', 'rETH', 0x9bcef72be871e61ed4fbbc7630889bee758eb81d, 18),
('weeth-wrapped-eeth', 'WEETH',0x5a7facb970d094b6c7ff1df0ea68d99e6e73cbff, 18)
('weeth-wrapped-eeth', 'WEETH',0x5a7facb970d094b6c7ff1df0ea68d99e6e73cbff, 18),
('next-connext-eth', 'NEXT', 0x58b9cb810a68a7f3e1e4f8cb45d1b9b3c79705e8, 18),
('ezeth-renzo-restaked-eth', 'ezETH', 0x2416092f143378750bb29b79ed961ab195cceea5, 18),
('usde-ethena-usde', 'USDe', 0x5d3a1ff2b6bab83b63cd9ad0787074081a52ef34, 18),
('kuji-kujira', 'KUJI', 0x3a18dcc9745edcd1ef33ecb93b0b6eba5671e7ca, 6),
('usdv-verified-usd', 'USDV', 0x323665443cef804a3b5206103304bd4872ea4253, 6),
('zro-layerzero', 'ZRO', 0x6985884c4392d348587b19cb9eaaf157f13271cd, 18),
('rseth-rseth', 'rsETH', 0x4186bfc76e2e237523cbc30fd220fe055156b41f, 18)
) as temp (token_id, symbol, contract_address, decimals)
6 changes: 5 additions & 1 deletion models/prices/polygon/prices_polygon_tokens.sql
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,11 @@ FROM
('ice-decentral-games-ice', 'polygon', 'ICE', 0xc6c855ad634dcdad23e64da71ba85b8c51e5ad7c,18),
('bonsai-bonsai-token', 'polygon', 'BONSAI', 0x3d2bd0e15829aa5c362a4144fdf4a1112fa29b5c, 18),
('wifi-wifi', 'polygon', 'WIFI', 0xe238ecb42c424e877652ad82d8a939183a04c35f, 18),
('dfx-dfx-finance', 'polygon', 'DFX', 0x27f485b62c4a7e635f561a87560adf5090239e93, 18)
('dfx-dfx-finance', 'polygon', 'DFX', 0x27f485b62c4a7e635f561a87560adf5090239e93, 18),
('usdv-verified-usd', 'polygon', 'USDV', 0x323665443cef804a3b5206103304bd4872ea4253, 6),
('zro-layerzero', 'polygon', 'ZRO', 0x6985884c4392d348587b19cb9eaaf157f13271cd, 18),
('next-connext-eth', 'polygon', 'NEXT', 0x58b9cb810a68a7f3e1e4f8cb45d1b9b3c79705e8, 18),
('usdm-mountain-protocol-usd', 'polygon', 'USDM', 0x57f5e098cad7a3d1eed53991d4d66c45c9af7812, 18)
) as temp (token_id, blockchain, symbol, contract_address, decimals)
where contract_address not in (
0xef938b6da8576a896f6e0321ef80996f4890f9c4 -- DG, bad price feed
Expand Down
4 changes: 2 additions & 2 deletions sources/_base_sources/mantle_base_sources.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ version: 2
sources:
# Base Tables
- name: mantle
description: "mantle raw tables including transactions, traces and logs."
description: "Mantle raw tables including transactions, traces and logs."
freshness:
warn_after: { count: 12, period: hour }
tables:
Expand Down Expand Up @@ -401,4 +401,4 @@ sources:
- *evt_block_number
- *approved
- *owner
- *operator
- *operator
13 changes: 13 additions & 0 deletions sources/_sector/dex/trades/mantle/_sources.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
version: 2

sources:
- name: butter_mantle
tables:
- name: ButterFactory_evt_PoolCreated
- name: fusionx_mantle
tables:
- name: FusionXV3Factory_evt_PoolCreated
- name: merchant_moe_mantle
tables:
- name: MoeFactory_evt_PairCreated
- name: MoePair_evt_Swap
25 changes: 24 additions & 1 deletion sources/paraswap/arbitrum/paraswap_arbitrum_sources.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,30 @@ sources:
loaded_at_field: evt_block_time
- name: AugustusSwapper_evt_SwappedDirect
loaded_at_field: evt_block_time
# v6
# v6
# v6.1
- name: AugustusV6_1_call_swapExactAmountIn
loaded_at_field: call_block_time
- name: AugustusV6_1_call_swapExactAmountInOnUniswapV2
loaded_at_field: call_block_time
- name: AugustusV6_1_call_swapExactAmountInOnUniswapV3
loaded_at_field: call_block_time
- name: AugustusV6_1_call_swapExactAmountInOnCurveV1
loaded_at_field: call_block_time
- name: AugustusV6_1_call_swapExactAmountInOnCurveV2
loaded_at_field: call_block_time
- name: AugustusV6_1_call_swapExactAmountInOnBalancerV2
loaded_at_field: call_block_time
- name: AugustusV6_1_call_swapExactAmountOut
loaded_at_field: call_block_time
- name: AugustusV6_1_call_swapExactAmountOutOnUniswapV2
loaded_at_field: call_block_time
- name: AugustusV6_1_call_swapExactAmountOutOnUniswapV3
loaded_at_field: call_block_time
- name: AugustusV6_1_call_swapExactAmountOutOnBalancerV2
loaded_at_field: call_block_time

# v6.2
- name: AugustusV6_2_call_swapExactAmountIn
loaded_at_field: call_block_time
- name: AugustusV6_2_call_swapExactAmountInOnUniswapV2
Expand Down
Loading

0 comments on commit b699f64

Please sign in to comment.