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

[event_v2] indexer logic update to handle migration (#360) #388

Merged
merged 1 commit into from
Dec 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 12 additions & 2 deletions python/processors/nft_orderbooks/parsers/okx_parser.py
Copy link
Collaborator

Choose a reason for hiding this comment

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

can we remove these? we're no longer maintaining the python stuff anyway so it's not needed and we don't want to test it anyway.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

larry added these.
what to do with this file?

Copy link
Collaborator

Choose a reason for hiding this comment

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

uh just revert to how it was.

Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@
"okx_listing_utils::CancelListingEvent",
]
)
DEPOSIT_EVENT_V1 = "0x3::token::DepositEvent"
DEPOSIT_EVENT_V2 = "0x3::token::Deposit"


def parse_marketplace_events(
Expand Down Expand Up @@ -141,8 +143,16 @@ def parse_marketplace_events(
def get_token_data_from_deposit_events(user_transaction) -> Dict[str, TokenDataIdType]:
# Extract deposit events, which contain token metadata
deposit_events: Dict[str, TokenDataIdType] = {}
for event in user_transaction.events:
if event.type_str != "0x3::token::DepositEvent":
for idx, event in enumerate(user_transaction.events):
if event.type_str != DEPOSIT_EVENT_V1 and event.type_str != DEPOSIT_EVENT_V2:
continue
# Current event is either DEPOSIT_EVENT_V1 or DEPOSIT_EVENT_V2.
if (
idx > 0
# skip if prior event is V2 deposit event.
and user_transaction.events[idx - 1].type_str == DEPOSIT_EVENT_V2
and event.type_str == DEPOSIT_EVENT_V1
):
continue
account_address = standardize_address(event_utils.get_account_address(event))
data = json.loads(event.data)
Expand Down
6 changes: 3 additions & 3 deletions rust/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions rust/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ aptos-indexer-processor-sdk = { git = "https://github.com/aptos-labs/aptos-index
aptos-indexer-processor-sdk-server-framework = { git = "https://github.com/aptos-labs/aptos-indexer-processor-sdk.git", rev = "e6867c50a2c30ef16ad6f82e02313b2ba5ce361a" }
aptos-protos = { git = "https://github.com/aptos-labs/aptos-core.git", rev = "5c48aee129b5a141be2792ffa3d9bd0a1a61c9cb" }
aptos-system-utils = { git = "https://github.com/aptos-labs/aptos-core.git", rev = "202bdccff2b2d333a385ae86a4fcf23e89da9f62" }
aptos-indexer-test-transactions = { git = "https://github.com/aptos-labs/aptos-core.git", rev = "f60f1f0ca1dd935330152e481e680f1beb5b44ec" }
aptos-indexer-test-transactions = { git = "https://github.com/aptos-labs/aptos-core.git", rev = "60ee0c686c15480b2cbba224c205e03f479bcdbd" }
aptos-indexer-testing-framework = { git = "https://github.com/aptos-labs/aptos-indexer-processor-sdk.git", rev = "e6867c50a2c30ef16ad6f82e02313b2ba5ce361a" }
async-trait = "0.1.53"
backtrace = "0.3.58"
Expand Down Expand Up @@ -78,14 +78,14 @@ google-cloud-googleapis = "0.10.0"
google-cloud-pubsub = "0.18.0"
hex = "0.4.3"
itertools = "0.12.1"
lazy_static = "1.4.0"
jemallocator = { version = "0.5.0", features = [
"profiling",
"unprefixed_malloc_on_supported_platforms",
] }
json-structural-diff = "0.1.0"
assert-json-diff = "2.0.2"
kanal = { version = "0.1.0-pre8", features = ["async"] }
lazy_static = "1.4.0"
once_cell = "1.10.0"
num_cpus = "1.16.0"
pbjson = "0.5.1"
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
[
{
"transaction_version": 78753811,
"coin_type_hash": "91ceb1308a98389691e05158b07ed5f079ab78461a6bb8d5a4054b1bb5cb8bb6",
"coin_type": "0x1::aptos_coin::AptosCoin",
"supply": "18447249875628517278",
"transaction_timestamp": "2024-12-02T19:50:23",
"transaction_epoch": 63
}
]
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
[
{
"storage_id": "0x9249cee32378643feb7674c405057e6287050c151e74d7fee4857e1e82b608d1",
"owner_address": "0xe93dcd3dd5febf8d72bf8d33e1d85a6115300fedfe055c062834d264f103ce4c",
"asset_type": "0x1::aptos_coin::AptosCoin",
"is_primary": true,
"is_frozen": false,
"amount": "34464975541459",
"last_transaction_timestamp": "2024-12-02T19:50:23",
"last_transaction_version": 78753811,
"token_standard": "v1"
},
{
"storage_id": "0xcec6acee464c2f2689dddf50ad4e9c78bb91b2d0a345cda799ab2a1dcdd4077c",
"owner_address": "0x74512d8383e6857a9a587012c44ad98420cbc713301714402611d7f87a7f4fe0",
"asset_type": "0x1::aptos_coin::AptosCoin",
"is_primary": true,
"is_frozen": false,
"amount": "2",
"last_transaction_timestamp": "2024-12-02T19:50:23",
"last_transaction_version": 78753811,
"token_standard": "v1"
}
]
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
[
{
"transaction_version": 78753811,
"event_index": -1,
"owner_address": "0xe93dcd3dd5febf8d72bf8d33e1d85a6115300fedfe055c062834d264f103ce4c",
"storage_id": "0x9249cee32378643feb7674c405057e6287050c151e74d7fee4857e1e82b608d1",
"asset_type": "0x1::aptos_coin::AptosCoin",
"is_frozen": null,
"amount": "700",
"type_": "0x1::aptos_coin::GasFeeEvent",
"is_gas_fee": true,
"gas_fee_payer_address": null,
"is_transaction_success": true,
"entry_function_id_str": "0x1::coin::transfer",
"block_height": 10811317,
"token_standard": "v1",
"transaction_timestamp": "2024-12-02T19:50:23",
"storage_refund_amount": "0"
},
{
"transaction_version": 78753811,
"event_index": 0,
"owner_address": "0xe93dcd3dd5febf8d72bf8d33e1d85a6115300fedfe055c062834d264f103ce4c",
"storage_id": "0x9249cee32378643feb7674c405057e6287050c151e74d7fee4857e1e82b608d1",
"asset_type": "0x1::aptos_coin::AptosCoin",
"is_frozen": null,
"amount": "1",
"type_": "0x1::coin::CoinWithdraw",
"is_gas_fee": false,
"gas_fee_payer_address": null,
"is_transaction_success": true,
"entry_function_id_str": "0x1::coin::transfer",
"block_height": 10811317,
"token_standard": "v1",
"transaction_timestamp": "2024-12-02T19:50:23",
"storage_refund_amount": "0"
},
{
"transaction_version": 78753811,
"event_index": 1,
"owner_address": "0x74512d8383e6857a9a587012c44ad98420cbc713301714402611d7f87a7f4fe0",
"storage_id": "0xcec6acee464c2f2689dddf50ad4e9c78bb91b2d0a345cda799ab2a1dcdd4077c",
"asset_type": "0x1::aptos_coin::AptosCoin",
"is_frozen": null,
"amount": "1",
"type_": "0x1::coin::CoinDeposit",
"is_gas_fee": false,
"gas_fee_payer_address": null,
"is_transaction_success": true,
"entry_function_id_str": "0x1::coin::transfer",
"block_height": 10811317,
"token_standard": "v1",
"transaction_timestamp": "2024-12-02T19:50:23",
"storage_refund_amount": "0"
}
]
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
[
{
"transaction_version": 78753811,
"write_set_change_index": 0,
"storage_id": "0xcec6acee464c2f2689dddf50ad4e9c78bb91b2d0a345cda799ab2a1dcdd4077c",
"owner_address": "0x74512d8383e6857a9a587012c44ad98420cbc713301714402611d7f87a7f4fe0",
"asset_type": "0x1::aptos_coin::AptosCoin",
"is_primary": true,
"is_frozen": false,
"amount": "2",
"transaction_timestamp": "2024-12-02T19:50:23",
"token_standard": "v1"
},
{
"transaction_version": 78753811,
"write_set_change_index": 1,
"storage_id": "0x9249cee32378643feb7674c405057e6287050c151e74d7fee4857e1e82b608d1",
"owner_address": "0xe93dcd3dd5febf8d72bf8d33e1d85a6115300fedfe055c062834d264f103ce4c",
"asset_type": "0x1::aptos_coin::AptosCoin",
"is_primary": true,
"is_frozen": false,
"amount": "34464975541459",
"transaction_timestamp": "2024-12-02T19:50:23",
"token_standard": "v1"
}
]
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
[]
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
[
{
"sequence_number": 0,
"creation_number": 0,
"account_address": "0x0000000000000000000000000000000000000000000000000000000000000000",
"transaction_version": 78753811,
"transaction_block_height": 10811317,
"type_": "0x1::coin::CoinWithdraw",
"data": {
"amount": "1",
"account": "0xe93dcd3dd5febf8d72bf8d33e1d85a6115300fedfe055c062834d264f103ce4c",
"coin_type": "0x1::aptos_coin::AptosCoin"
},
"indexed_type": "0x1::coin::CoinWithdraw",
"event_index": 0
},
{
"sequence_number": 0,
"creation_number": 0,
"account_address": "0x0000000000000000000000000000000000000000000000000000000000000000",
"transaction_version": 78753811,
"transaction_block_height": 10811317,
"type_": "0x1::coin::CoinDeposit",
"data": {
"amount": "1",
"account": "0x74512d8383e6857a9a587012c44ad98420cbc713301714402611d7f87a7f4fe0",
"coin_type": "0x1::aptos_coin::AptosCoin"
},
"indexed_type": "0x1::coin::CoinDeposit",
"event_index": 1
},
{
"sequence_number": 0,
"creation_number": 0,
"account_address": "0x0000000000000000000000000000000000000000000000000000000000000000",
"transaction_version": 78753811,
"transaction_block_height": 10811317,
"type_": "0x1::transaction_fee::FeeStatement",
"data": {
"io_gas_units": "4",
"storage_fee_octas": "0",
"execution_gas_units": "4",
"total_charge_gas_units": "7",
"storage_fee_refund_octas": "0"
},
"indexed_type": "0x1::transaction_fee::FeeStatement",
"event_index": 2
}
]
Original file line number Diff line number Diff line change
@@ -0,0 +1,139 @@
[
{
"sequence_number": 0,
"creation_number": 0,
"account_address": "0x0000000000000000000000000000000000000000000000000000000000000000",
"transaction_version": 78753831,
"transaction_block_height": 10811321,
"type_": "0x3::token::TokenDataCreation",
"data": {
"id": {
"name": "NFT Collectible #13360",
"creator": "0xcdc14b3f3edbbb739a0a7168661ae562449dd88ede045f4a310a4cf41489001a",
"collection": "An NFT Collection Name"
},
"uri": "https://aptos.dev",
"name": "NFT Collectible #13360",
"creator": "0xcdc14b3f3edbbb739a0a7168661ae562449dd88ede045f4a310a4cf41489001a",
"maximum": "1",
"description": "",
"property_keys": [],
"property_types": [],
"property_values": [],
"mutability_config": {
"uri": true,
"maximum": true,
"royalty": true,
"properties": true,
"description": true
},
"royalty_payee_address": "0xcdc14b3f3edbbb739a0a7168661ae562449dd88ede045f4a310a4cf41489001a",
"royalty_points_numerator": "0",
"royalty_points_denominator": "100"
},
"indexed_type": "0x3::token::TokenDataCreation",
"event_index": 0
},
{
"sequence_number": 0,
"creation_number": 0,
"account_address": "0x0000000000000000000000000000000000000000000000000000000000000000",
"transaction_version": 78753831,
"transaction_block_height": 10811321,
"type_": "0x3::token::Mint",
"data": {
"id": {
"name": "NFT Collectible #13360",
"creator": "0xcdc14b3f3edbbb739a0a7168661ae562449dd88ede045f4a310a4cf41489001a",
"collection": "An NFT Collection Name"
},
"amount": "1",
"creator": "0xcdc14b3f3edbbb739a0a7168661ae562449dd88ede045f4a310a4cf41489001a"
},
"indexed_type": "0x3::token::Mint",
"event_index": 1
},
{
"sequence_number": 0,
"creation_number": 0,
"account_address": "0x0000000000000000000000000000000000000000000000000000000000000000",
"transaction_version": 78753831,
"transaction_block_height": 10811321,
"type_": "0x3::token::TokenDeposit",
"data": {
"id": {
"token_data_id": {
"name": "NFT Collectible #13360",
"creator": "0xcdc14b3f3edbbb739a0a7168661ae562449dd88ede045f4a310a4cf41489001a",
"collection": "An NFT Collection Name"
},
"property_version": "0"
},
"amount": "1",
"account": "0xcdc14b3f3edbbb739a0a7168661ae562449dd88ede045f4a310a4cf41489001a"
},
"indexed_type": "0x3::token::TokenDeposit",
"event_index": 2
},
{
"sequence_number": 0,
"creation_number": 0,
"account_address": "0x0000000000000000000000000000000000000000000000000000000000000000",
"transaction_version": 78753831,
"transaction_block_height": 10811321,
"type_": "0x3::token::TokenWithdraw",
"data": {
"id": {
"token_data_id": {
"name": "NFT Collectible #13360",
"creator": "0xcdc14b3f3edbbb739a0a7168661ae562449dd88ede045f4a310a4cf41489001a",
"collection": "An NFT Collection Name"
},
"property_version": "0"
},
"amount": "1",
"account": "0xcdc14b3f3edbbb739a0a7168661ae562449dd88ede045f4a310a4cf41489001a"
},
"indexed_type": "0x3::token::TokenWithdraw",
"event_index": 3
},
{
"sequence_number": 0,
"creation_number": 0,
"account_address": "0x0000000000000000000000000000000000000000000000000000000000000000",
"transaction_version": 78753831,
"transaction_block_height": 10811321,
"type_": "0x3::token::TokenDeposit",
"data": {
"id": {
"token_data_id": {
"name": "NFT Collectible #13360",
"creator": "0xcdc14b3f3edbbb739a0a7168661ae562449dd88ede045f4a310a4cf41489001a",
"collection": "An NFT Collection Name"
},
"property_version": "0"
},
"amount": "1",
"account": "0x348cd99611633b0eb8ee803016bcd26bae4ce9d2954da8ab060cd90ecea39118"
},
"indexed_type": "0x3::token::TokenDeposit",
"event_index": 4
},
{
"sequence_number": 0,
"creation_number": 0,
"account_address": "0x0000000000000000000000000000000000000000000000000000000000000000",
"transaction_version": 78753831,
"transaction_block_height": 10811321,
"type_": "0x1::transaction_fee::FeeStatement",
"data": {
"io_gas_units": "6",
"storage_fee_octas": "97720",
"execution_gas_units": "8",
"total_charge_gas_units": "991",
"storage_fee_refund_octas": "0"
},
"indexed_type": "0x1::transaction_fee::FeeStatement",
"event_index": 5
}
]
Loading
Loading