Skip to content
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

Open
wants to merge 25 commits into
base: main
Choose a base branch
from

Conversation

PatelPrinci
Copy link
Contributor

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:

@github-actions github-actions bot marked this pull request as draft January 10, 2025 10:22
@github-actions github-actions bot added WIP work in progress dbt: hourly covers the hourly dbt subproject labels Jan 10, 2025
@PatelPrinci PatelPrinci marked this pull request as ready for review January 10, 2025 10:30
@github-actions github-actions bot added ready-for-review this PR development is complete, please review and removed WIP work in progress labels Jan 10, 2025
Comment on lines 4 to 7
post_hook='{{ expose_spells(\'["base"]\',
"project",
"avantis",
\'["princi"]\') }}'
Copy link
Collaborator

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.

@jeff-dude jeff-dude added in review Assignee is currently reviewing the PR and removed ready-for-review this PR development is complete, please review labels Jan 13, 2025
Comment on lines 9 to 12
post_hook='{{ expose_spells(\'["base"]\',
"project",
"avantis",
\'["princi"]\') }}'
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
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
Copy link
Collaborator

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.

Suggested change
FROM delta_prod.avantis_base.Trading_evt_OpenLimitPlaced
FROM {{ source('avantis_base', 'Trading_evt_OpenLimitPlaced') }}

@PatelPrinci
Copy link
Contributor Author

PatelPrinci commented Jan 17, 2025 via email

Comment on lines 20 to 25
blockchain
,block_date
,block_month
,block_time
,virtual_asset
,underlying_asset
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Spaces for indentation.

Comment on lines 11 to 14
description: >
Perpetual swaps/trades table on avantis protocol across blockchains
columns:
- &blockchain
Copy link
Collaborator

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.

Comment on lines 20 to 21
blockchain
,block_date
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
blockchain
,block_date
blockchain
,block_date

Comment on lines 4 to 7
post_hook='{{ expose_spells(\'["base"]\',
"project",
"avantis",
\'["princi"]\') }}'
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
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
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
,block_date
,block_date

Copy link
Contributor Author

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?

Copy link
Collaborator

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
Copy link
Collaborator

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 %}
  ),

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
dbt: hourly covers the hourly dbt subproject in review Assignee is currently reviewing the PR
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants