From cd86c58d72213b4c442c6ae4918973ffa700f8ec Mon Sep 17 00:00:00 2001 From: Aaron Gao Date: Thu, 17 Apr 2025 16:41:11 -0600 Subject: [PATCH] add coin_store_deletion_event info to event_to_coin_type map --- Cargo.toml | 1 + .../current_fungible_asset_balances.json | 40 +++++++++++++ .../fungible_asset_activities.json | 56 +++++++++++++++++++ .../fungible_asset_balances.json | 1 + .../fungible_asset_metadata.json | 19 +++++++ .../fungible_asset_processor_tests.rs | 10 ++++ 6 files changed, 127 insertions(+) create mode 100644 integration-tests/sdk_expected_db_output_files/fungible_asset_processor/coin_store_deletion_event/current_fungible_asset_balances.json create mode 100644 integration-tests/sdk_expected_db_output_files/fungible_asset_processor/coin_store_deletion_event/fungible_asset_activities.json create mode 100644 integration-tests/sdk_expected_db_output_files/fungible_asset_processor/coin_store_deletion_event/fungible_asset_balances.json create mode 100644 integration-tests/sdk_expected_db_output_files/fungible_asset_processor/coin_store_deletion_event/fungible_asset_metadata.json diff --git a/Cargo.toml b/Cargo.toml index 6cf1c9e1..46233406 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -25,6 +25,7 @@ anyhow = "1.0.86" # https://github.com/aptos-labs/aptos-indexer-processors/pull/325 aptos-indexer-processor-sdk = { git = "https://github.com/aptos-labs/aptos-indexer-processor-sdk.git", rev = "bfb07a2b6985743fbc275d6fc621a80453f6742d", features = [ "postgres_partial", + "testing_framework" ] } aptos-indexer-test-transactions = { git = "https://github.com/aptos-labs/aptos-core.git", rev = "4bb4cd9799c05099f60c3a2c3813b12cc96ea917" } async-trait = "0.1.53" diff --git a/integration-tests/sdk_expected_db_output_files/fungible_asset_processor/coin_store_deletion_event/current_fungible_asset_balances.json b/integration-tests/sdk_expected_db_output_files/fungible_asset_processor/coin_store_deletion_event/current_fungible_asset_balances.json new file mode 100644 index 00000000..703d27ca --- /dev/null +++ b/integration-tests/sdk_expected_db_output_files/fungible_asset_processor/coin_store_deletion_event/current_fungible_asset_balances.json @@ -0,0 +1,40 @@ +[ + { + "storage_id": "0x35b5700571cbb1c340c5a2fa7e1ecc32fd8b4da273881c2728058bd4c2514895", + "owner_address": "0x2dcbc03740a6fa2efee926b9df329184cce357d0573bdab09930f4d48e61a4c8", + "asset_type_v2": null, + "asset_type_v1": "0x1::aptos_coin::AptosCoin", + "is_primary": true, + "is_frozen": false, + "amount_v1": "25361327420", + "amount_v2": null, + "amount": "25361327420", + "last_transaction_version_v1": 2448304257, + "last_transaction_version_v2": null, + "last_transaction_version": 2448304257, + "last_transaction_timestamp_v1": "2025-03-07T22:32:23", + "last_transaction_timestamp_v2": null, + "last_transaction_timestamp": "2025-03-07T22:32:23", + "token_standard": "v1", + "asset_type": "0x1::aptos_coin::AptosCoin" + }, + { + "storage_id": "0xd5263bada2f6b752de987f5e8eca800ffb07f34c489633fc7eb46acea7cd5c37", + "owner_address": "0xf8e25f6c8ce40a15107fb4b4d288ca03dd434d057392f2ccb5fde505a300a0bf", + "asset_type_v2": "0x000000000000000000000000000000000000000000000000000000000000000a", + "asset_type_v1": "0x1::aptos_coin::AptosCoin", + "is_primary": true, + "is_frozen": false, + "amount_v1": "0", + "amount_v2": "49843000", + "amount": "49843000", + "last_transaction_version_v1": 2448304257, + "last_transaction_version_v2": 2448304257, + "last_transaction_version": 2448304257, + "last_transaction_timestamp_v1": "2025-03-07T22:32:23", + "last_transaction_timestamp_v2": "2025-03-07T22:32:23", + "last_transaction_timestamp": "2025-03-07T22:32:23", + "token_standard": "v1", + "asset_type": "0x1::aptos_coin::AptosCoin" + } +] \ No newline at end of file diff --git a/integration-tests/sdk_expected_db_output_files/fungible_asset_processor/coin_store_deletion_event/fungible_asset_activities.json b/integration-tests/sdk_expected_db_output_files/fungible_asset_processor/coin_store_deletion_event/fungible_asset_activities.json new file mode 100644 index 00000000..61322ab4 --- /dev/null +++ b/integration-tests/sdk_expected_db_output_files/fungible_asset_processor/coin_store_deletion_event/fungible_asset_activities.json @@ -0,0 +1,56 @@ +[ + { + "transaction_version": 2448304257, + "event_index": -1, + "owner_address": "0xf8e25f6c8ce40a15107fb4b4d288ca03dd434d057392f2ccb5fde505a300a0bf", + "storage_id": "0xd5263bada2f6b752de987f5e8eca800ffb07f34c489633fc7eb46acea7cd5c37", + "asset_type": "0x1::aptos_coin::AptosCoin", + "is_frozen": null, + "amount": "57000", + "type_": "0x1::aptos_coin::GasFeeEvent", + "is_gas_fee": true, + "gas_fee_payer_address": null, + "is_transaction_success": true, + "entry_function_id_str": "0xa746e980ae21949a4f084db7403430f00bce3c9a1da4101ffcf0bf45ebd35e7e::test::transfer_and_migrate", + "block_height": 300296983, + "token_standard": "v1", + "transaction_timestamp": "2025-03-07T22:32:23", + "storage_refund_amount": "0" + }, + { + "transaction_version": 2448304257, + "event_index": 0, + "owner_address": "0xf8e25f6c8ce40a15107fb4b4d288ca03dd434d057392f2ccb5fde505a300a0bf", + "storage_id": "0xd5263bada2f6b752de987f5e8eca800ffb07f34c489633fc7eb46acea7cd5c37", + "asset_type": "0x1::aptos_coin::AptosCoin", + "is_frozen": null, + "amount": "100000", + "type_": "0x1::coin::WithdrawEvent", + "is_gas_fee": false, + "gas_fee_payer_address": null, + "is_transaction_success": true, + "entry_function_id_str": "0xa746e980ae21949a4f084db7403430f00bce3c9a1da4101ffcf0bf45ebd35e7e::test::transfer_and_migrate", + "block_height": 300296983, + "token_standard": "v1", + "transaction_timestamp": "2025-03-07T22:32:23", + "storage_refund_amount": "0" + }, + { + "transaction_version": 2448304257, + "event_index": 1, + "owner_address": "0x2dcbc03740a6fa2efee926b9df329184cce357d0573bdab09930f4d48e61a4c8", + "storage_id": "0x35b5700571cbb1c340c5a2fa7e1ecc32fd8b4da273881c2728058bd4c2514895", + "asset_type": "0x1::aptos_coin::AptosCoin", + "is_frozen": null, + "amount": "100000", + "type_": "0x1::coin::DepositEvent", + "is_gas_fee": false, + "gas_fee_payer_address": null, + "is_transaction_success": true, + "entry_function_id_str": "0xa746e980ae21949a4f084db7403430f00bce3c9a1da4101ffcf0bf45ebd35e7e::test::transfer_and_migrate", + "block_height": 300296983, + "token_standard": "v1", + "transaction_timestamp": "2025-03-07T22:32:23", + "storage_refund_amount": "0" + } +] \ No newline at end of file diff --git a/integration-tests/sdk_expected_db_output_files/fungible_asset_processor/coin_store_deletion_event/fungible_asset_balances.json b/integration-tests/sdk_expected_db_output_files/fungible_asset_processor/coin_store_deletion_event/fungible_asset_balances.json new file mode 100644 index 00000000..0637a088 --- /dev/null +++ b/integration-tests/sdk_expected_db_output_files/fungible_asset_processor/coin_store_deletion_event/fungible_asset_balances.json @@ -0,0 +1 @@ +[] \ No newline at end of file diff --git a/integration-tests/sdk_expected_db_output_files/fungible_asset_processor/coin_store_deletion_event/fungible_asset_metadata.json b/integration-tests/sdk_expected_db_output_files/fungible_asset_processor/coin_store_deletion_event/fungible_asset_metadata.json new file mode 100644 index 00000000..8b26da73 --- /dev/null +++ b/integration-tests/sdk_expected_db_output_files/fungible_asset_processor/coin_store_deletion_event/fungible_asset_metadata.json @@ -0,0 +1,19 @@ +[ + { + "asset_type": "0x000000000000000000000000000000000000000000000000000000000000000a", + "creator_address": "0x0000000000000000000000000000000000000000000000000000000000000001", + "name": "Aptos Coin", + "symbol": "APT", + "decimals": 8, + "icon_uri": "", + "project_uri": "", + "last_transaction_version": 2448304257, + "last_transaction_timestamp": "2025-03-07T22:32:23", + "supply_aggregator_table_handle_v1": null, + "supply_aggregator_table_key_v1": null, + "token_standard": "v2", + "maximum_v2": "340282366920938463463374607431768211455", + "is_token_v2": null, + "supply_v2": "118281485271096" + } +] \ No newline at end of file diff --git a/integration-tests/src/sdk_tests/fungible_asset_processor_tests.rs b/integration-tests/src/sdk_tests/fungible_asset_processor_tests.rs index 837b3255..10fc5abf 100644 --- a/integration-tests/src/sdk_tests/fungible_asset_processor_tests.rs +++ b/integration-tests/src/sdk_tests/fungible_asset_processor_tests.rs @@ -64,6 +64,7 @@ mod sdk_fungible_asset_processor_tests { IMPORTED_MAINNET_TXNS_2186504987_COIN_STORE_DELETION_NO_EVENT, IMPORTED_MAINNET_TXNS_2308282694_ASSET_TYPE_V1_NULL, IMPORTED_MAINNET_TXNS_2308283617_ASSET_TYPE_V1_NULL_2, + IMPORTED_MAINNET_TXNS_2448304257_COINSTORE_DELETION_EVENT, IMPORTED_MAINNET_TXNS_255894550_STORAGE_REFUND, IMPORTED_MAINNET_TXNS_508365567_FA_V1_EVENTS, IMPORTED_MAINNET_TXNS_550582915_MULTIPLE_TRANSFER_EVENT, @@ -220,6 +221,15 @@ mod sdk_fungible_asset_processor_tests { .await; } + #[tokio::test(flavor = "multi_thread", worker_threads = 2)] + async fn test_fungible_asset_processor_coin_store_deletion_event() { + process_single_batch_txns( + &[IMPORTED_MAINNET_TXNS_2448304257_COINSTORE_DELETION_EVENT], + Some("coin_store_deletion_event".to_string()), + ) + .await; + } + /// Tests processing of secondary store burn operations /// Validates correct handling of burning tokens from secondary stores #[tokio::test(flavor = "multi_thread", worker_threads = 2)]