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

[EI-397] Separate fungible asset and token indexing #354

Merged
merged 6 commits into from
May 3, 2024
Merged

Conversation

rtso
Copy link
Collaborator

@rtso rtso commented Apr 20, 2024

Description

Index fungible assets and tokens independently, to better reflect the composable nature of the object model on chain

  1. Add fungible-related columns maximum_v2 and supply_v2 to fungible_asset_metadata (copied from current_token_datas_v2 )
    1. For coins, these fields will be null
  2. Set to null fungible-related columns maximum, supply, decimals from token_datas_v2
    1. The only place that tracks fungibility of a token will be in current_token_datas_v2.is_fungible_v2
  3. Set to null these columns since we can use a join to get the same information.
    • fungible_asset_metadata.is_token_v2
    • token_activities_v2.is_fungible_v2
    • current_token_ownerships_v2.is_fungible_v2
    • token_ownerships_v2.is_fungible_v2

Proposal: https://www.notion.so/aptoslabs/Indexer-Remove-DB-Lookups-16b8fc8c19fb4c79900e7dc35b0da9ef?d=210b8f48ab3c45fcbc971440836096fd#8dd1c16eebd440a6809b795a8041b1a8

Test plan

Run move scripts to create token mint, transfer, burn txn's. Run token_v2_processor and fungile_asset_processor on the txn's.

Mint fungible token

https://explorer.aptoslabs.com/txn/1033408820/userTxnOverview?network=testnet

Token tables

Screenshot 2024-04-25 at 11 10 40 AM Screenshot 2024-04-25 at 11 10 05 AM Screenshot 2024-04-25 at 10 59 58 AM Screenshot 2024-04-25 at 10 59 37 AM

Fungible asset tables

Screenshot 2024-04-25 at 11 14 51 AM Screenshot 2024-04-25 at 11 14 19 AM Screenshot 2024-04-25 at 11 13 07 AM

Joins

Screenshot 2024-04-25 at 11 21 11 AM

Transfer fungible token

https://explorer.aptoslabs.com/txn/1033409449?network=testnet
Token tables had no change.

Fungible asset tables

FA balance changed.
Screenshot 2024-04-25 at 11 25 29 AM
Screenshot 2024-04-25 at 11 25 23 AM

Joins

Screenshot 2024-04-25 at 11 26 02 AM

Burn fungible asset

https://explorer.aptoslabs.com/txn/1033409890?network=testnet
Token tables had no change.

Fungible asset tables

FA balance changed.
Screenshot 2024-04-25 at 11 28 28 AM
Screenshot 2024-04-25 at 11 28 16 AM

Joins

Screenshot 2024-04-25 at 11 29 05 AM

@rtso rtso force-pushed the rtso/fungible-token branch from 75fa401 to a723c3e Compare April 25, 2024 18:31
@rtso rtso changed the title Re-index fungible token Separate fungible asset and token indexing Apr 25, 2024
@rtso rtso marked this pull request as ready for review April 25, 2024 18:32
@rtso rtso requested review from a team and kent-white April 25, 2024 18:32
@rtso rtso requested review from CapCap, bowenyang007 and a team April 25, 2024 23:58
@rtso rtso changed the title Separate fungible asset and token indexing [EI-397] Separate fungible asset and token indexing Apr 30, 2024
Copy link

linear bot commented Apr 30, 2024

Copy link
Collaborator

@bowenyang007 bowenyang007 left a comment

Choose a reason for hiding this comment

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

yea looks good. a few questions about setting the deprecated fields to null always but overall nice clean up!

@rtso rtso force-pushed the rtso/fungible-token branch 2 times, most recently from 81bdb49 to 722fc42 Compare May 2, 2024 23:14
@rtso rtso force-pushed the rtso/fungible-token branch from 722fc42 to cc4326e Compare May 2, 2024 23:44
@rtso rtso force-pushed the rtso/fungible-token branch from dbad33f to 221c398 Compare May 3, 2024 20:27
@rtso rtso merged commit 07c6385 into main May 3, 2024
8 checks passed
@rtso rtso deleted the rtso/fungible-token branch May 3, 2024 21:26
yuunlimm pushed a commit that referenced this pull request May 9, 2024
* Re-index fungible token

* Test move script

* Schema changes

* Comments

* on conflict, update

* Fix is_fungible_v2 column
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants