-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Avantis Protocol on Base #7450
base: main
Are you sure you want to change the base?
Avantis Protocol on Base #7450
Conversation
post_hook='{{ expose_spells(\'["base"]\', | ||
"project", | ||
"avantis", | ||
\'["princi"]\') }}' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please apply the new post_hook format.
post_hook='{{ expose_spells(\'["base"]\', | ||
"project", | ||
"avantis", | ||
\'["princi"]\') }}' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
post_hook='{{ expose_spells(\'["base"]\', | |
"project", | |
"avantis", | |
\'["princi"]\') }}' | |
post_hook='{{ expose_spells(blockchains = \'["base"]\', | |
spell_type = "project", | |
spell_name = "avantis", | |
contributors = \'["princi"]\') }}' |
executionFee / 1e18 as fee_usd, | ||
isBuy, | ||
'limit_order' as event_type | ||
FROM delta_prod.avantis_base.Trading_evt_OpenLimitPlaced |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We need to use proper source()
syntax.
FROM delta_prod.avantis_base.Trading_evt_OpenLimitPlaced | |
FROM {{ source('avantis_base', 'Trading_evt_OpenLimitPlaced') }} |
...rly_spellbook/models/_sector/perpetual/projects/avantis/avantis_v1_base_perpetual_trades.sql
Show resolved
Hide resolved
...rly_spellbook/models/_sector/perpetual/projects/avantis/avantis_v1_base_perpetual_trades.sql
Outdated
Show resolved
Hide resolved
...rly_spellbook/models/_sector/perpetual/projects/avantis/avantis_v1_base_perpetual_trades.sql
Outdated
Show resolved
Hide resolved
Got it, I will make the suggested updates.
…On Tue, 14 Jan 2025 at 12:30, Huang Geyang ***@***.***> wrote:
***@***.**** requested changes on this pull request.
------------------------------
In
dbt_subprojects/hourly_spellbook/models/_sector/perpetual/projects/avantis/avantis_v1_base_perpetual_trades.sql
<#7450 (comment)>
:
> + post_hook='{{ expose_spells(\'["base"]\',
+ "project",
+ "avantis",
+ \'["princi"]\') }}'
⬇️ Suggested change
- post_hook='{{ expose_spells(\'["base"]\',
- "project",
- "avantis",
- \'["princi"]\') }}'
+ post_hook='{{ expose_spells(blockchains = \'["base"]\',
+ spell_type = "project",
+ spell_name = "avantis",
+ contributors = \'["princi"]\') }}'
------------------------------
In
dbt_subprojects/hourly_spellbook/models/_sector/perpetual/projects/avantis/avantis_v1_base_perpetual_trades.sql
<#7450 (comment)>
:
> + SELECT
+ evt_block_time,
+ evt_block_number,
+ evt_tx_hash,
+ evt_tx_from,
+ evt_tx_to,
+ evt_index,
+ contract_address,
+ trader,
+ pairIndex,
+ index as position_size,
+ openPrice / 1e8 as price_usd,
+ executionFee / 1e18 as fee_usd,
+ isBuy,
+ 'limit_order' as event_type
+ FROM delta_prod.avantis_base.Trading_evt_OpenLimitPlaced
We need to use proper source() syntax.
⬇️ Suggested change
- FROM delta_prod.avantis_base.Trading_evt_OpenLimitPlaced
+ FROM {{ source('avantis_base', 'Trading_evt_OpenLimitPlaced') }}
------------------------------
In
dbt_subprojects/hourly_spellbook/models/_sector/perpetual/projects/avantis/avantis_v1_base_perpetual_trades.sql
<#7450 (comment)>
:
> + evt_block_time,
+ evt_block_number,
+ evt_tx_hash,
+ evt_tx_from,
+ evt_tx_to,
+ evt_index,
+ contract_address,
+ trader,
+ pairIndex,
+ index as position_size,
+ openPrice / 1e8 as price_usd,
+ executionFee / 1e18 as fee_usd,
+ isBuy,
+ 'limit_order' as event_type
+ FROM delta_prod.avantis_base.Trading_evt_OpenLimitPlaced
+
Please remember to add incremental filters where needed.
⬇️ Suggested change
-
+ {% if is_incremental() %}
+ WHERE {{ incremental_predicate('evt_block_time') }}
+ {% endif %}
------------------------------
In
dbt_subprojects/hourly_spellbook/models/_sector/perpetual/projects/avantis/avantis_v1_base_perpetual_trades.sql
<#7450 (comment)>
:
> + FROM delta_prod.avantis_base.Trading_evt_MarginUpdated
+),
Same as above.
------------------------------
In
dbt_subprojects/hourly_spellbook/models/_sector/perpetual/projects/avantis/avantis_v1_base_perpetual_trades.sql
<#7450 (comment)>
:
> + perps.market_address,
+ perps.volume_usd,
+ perps.fee_usd,
+ perps.margin_usd,
+ perps.trade,
+ perps.project,
+ perps.version,
+ perps.frontend,
+ perps.trader,
+ CAST(perps.volume_raw as UINT256) as volume_raw,
+ perps.tx_hash,
+ tx."from" AS tx_from,
+ tx."to" AS tx_to,
+ perps.evt_index
+FROM perps
+INNER JOIN delta_prod.base.transactions AS tx
Same as above.
—
Reply to this email directly, view it on GitHub
<#7450 (review)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/BNGN7KOPLBFVUPVQJC23NQ32KSYZTAVCNFSM6AAAAABU6BXS56VHI2DSMVQWIX3LMV43YUDVNRWFEZLROVSXG5CSMV3GSZLXHMZDKNBYHEZTKMBQGA>
.
You are receiving this because you authored the thread.Message ID:
***@***.***>
|
blockchain | ||
,block_date | ||
,block_month | ||
,block_time | ||
,virtual_asset | ||
,underlying_asset |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Spaces for indentation.
description: > | ||
Perpetual swaps/trades table on avantis protocol across blockchains | ||
columns: | ||
- &blockchain |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We need to add data-tests, including uniqueness test and check_perpetuals_seed
test.
blockchain | ||
,block_date |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
blockchain | |
,block_date | |
blockchain | |
,block_date |
post_hook='{{ expose_spells(\'["base"]\', | ||
"project", | ||
"avantis", | ||
\'["princi"]\') }}' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
post_hook='{{ expose_spells(\'["base"]\', | |
"project", | |
"avantis", | |
\'["princi"]\') }}' | |
post_hook='{{ expose_spells(blockchains = \'["base"]\', | |
spell_type = "project", | |
spell_name = "avantis", | |
contributors = \'["princi"]\') }}' |
{% for avantis_perpetual_trades in avantis_base_perpetual_trade_models %} | ||
SELECT | ||
blockchain | ||
,block_date |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
,block_date | |
,block_date |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To maintain the format, isn't the current spacing already correct?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you use select or search, you will see in this historical file, blockchain
is indented with 8 spaces, while ,block_date
is indented with 2 tabs
tx."to" AS tx_to, | ||
perps.evt_index | ||
FROM perps | ||
INNER JOIN {{ source('base', 'transactions') }} AS tx |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We need a incremental filter for all transactions
tables.
We can make a transactions CTE with incremental first before inner join for faster loading.
i.e.
transactions_filtered AS (
SELECT
hash,
block_number,
"from",
"to"
FROM
{{ source('base','transactions') }}
WHERE
{% if is_incremental() %}
{{ incremental_predicate('block_time') }}
{% else %}
block_time >= TIMESTAMP '{{project_start_date}}'
{% endif %}
),
Thank you for contributing to Spellbook 🪄
Please open the PR in draft and mark as ready when you want to request a review.
Description:
[...]
quick links for more information: