Skip to content

Commit

Permalink
[FA migration] Dynamically process FA mapping (#698)
Browse files Browse the repository at this point in the history
  • Loading branch information
bowenyang007 authored Feb 4, 2025
1 parent 279ad33 commit 9bcb77e
Show file tree
Hide file tree
Showing 24 changed files with 785 additions and 253 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
[
{
"transaction_version": 1680592683,
"coin_type_hash": "91ceb1308a98389691e05158b07ed5f079ab78461a6bb8d5a4054b1bb5cb8bb6",
"coin_type": "0x1::aptos_coin::AptosCoin",
"supply": "111442820397688086",
"transaction_timestamp": "2024-09-05T11:52:16",
"transaction_epoch": 8371
},
{
"transaction_version": 1957950162,
"coin_type_hash": "91ceb1308a98389691e05158b07ed5f079ab78461a6bb8d5a4054b1bb5cb8bb6",
"coin_type": "0x1::aptos_coin::AptosCoin",
"supply": "112743621173497128",
"transaction_timestamp": "2024-11-23T22:32:30",
"transaction_epoch": 9331
}
]
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
[
{
"storage_id": "0x1734f2619bb775e59d04469663b9c05614b5ada6afbf2f750095f43cb8d41e40",
"owner_address": "0x345ced5d7c67360d61a1d59d8cd83cb53095a81aa24a337027391b1c7dd1786f",
"asset_type_v2": null,
"asset_type_v1": "0x1::aptos_coin::AptosCoin",
"is_primary": true,
"is_frozen": false,
"amount_v1": "115245132",
"amount_v2": null,
"amount": "115245132",
"last_transaction_version_v1": 1957950162,
"last_transaction_version_v2": null,
"last_transaction_version": 1957950162,
"last_transaction_timestamp_v1": "2024-11-23T22:32:30",
"last_transaction_timestamp_v2": null,
"last_transaction_timestamp": "2024-11-23T22:32:30",
"token_standard": "v1",
"asset_type": "0x1::aptos_coin::AptosCoin"
},
{
"storage_id": "0xa1ddab83c8209aabffc66264730ba95bcc7d7a7966192c00d800ab734729622c",
"owner_address": "0x7ae7cc51c4fab67181a969f53a5d01a292dad0baf259c92c4e1a13f056768e1c",
"asset_type_v2": "0x878370592f9129e14b76558689a4b570ad22678111df775befbfcbc9fb3d90ab",
"asset_type_v1": "0x5ae6789dd2fec1a9ec9cccfb3acaf12e93d432f0a3a42c92fe1a9d490b7bbc06::mkl_token::MKL",
"is_primary": true,
"is_frozen": false,
"amount_v1": null,
"amount_v2": "431101567356",
"amount": "431101567356",
"last_transaction_version_v1": null,
"last_transaction_version_v2": 1957950162,
"last_transaction_version": 1957950162,
"last_transaction_timestamp_v1": null,
"last_transaction_timestamp_v2": "2024-11-23T22:32:30",
"last_transaction_timestamp": "2024-11-23T22:32:30",
"token_standard": "v1",
"asset_type": "0x5ae6789dd2fec1a9ec9cccfb3acaf12e93d432f0a3a42c92fe1a9d490b7bbc06::mkl_token::MKL"
},
{
"storage_id": "0xd29b17433643769f27d89851553ec2ab5e4204b66eceecb6eec774668117c3e0",
"owner_address": "0x345ced5d7c67360d61a1d59d8cd83cb53095a81aa24a337027391b1c7dd1786f",
"asset_type_v2": "0x878370592f9129e14b76558689a4b570ad22678111df775befbfcbc9fb3d90ab",
"asset_type_v1": "0x5ae6789dd2fec1a9ec9cccfb3acaf12e93d432f0a3a42c92fe1a9d490b7bbc06::mkl_token::MKL",
"is_primary": true,
"is_frozen": false,
"amount_v1": null,
"amount_v2": "3643926",
"amount": "3643926",
"last_transaction_version_v1": null,
"last_transaction_version_v2": 1957950162,
"last_transaction_version": 1957950162,
"last_transaction_timestamp_v1": null,
"last_transaction_timestamp_v2": "2024-11-23T22:32:30",
"last_transaction_timestamp": "2024-11-23T22:32:30",
"token_standard": "v1",
"asset_type": "0x5ae6789dd2fec1a9ec9cccfb3acaf12e93d432f0a3a42c92fe1a9d490b7bbc06::mkl_token::MKL"
},
{
"storage_id": "0xfa4e15c47bc6b38cc404cf08e30e69fd14ff2cc82b136ef3630445a66605653c",
"owner_address": "0x5ae6789dd2fec1a9ec9cccfb3acaf12e93d432f0a3a42c92fe1a9d490b7bbc06",
"asset_type_v2": null,
"asset_type_v1": "0x1::aptos_coin::AptosCoin",
"is_primary": true,
"is_frozen": false,
"amount_v1": "997323833",
"amount_v2": null,
"amount": "997323833",
"last_transaction_version_v1": 1680592683,
"last_transaction_version_v2": null,
"last_transaction_version": 1680592683,
"last_transaction_timestamp_v1": "2024-09-05T11:52:16",
"last_transaction_timestamp_v2": null,
"last_transaction_timestamp": "2024-09-05T11:52:16",
"token_standard": "v1",
"asset_type": "0x1::aptos_coin::AptosCoin"
}
]
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
[
{
"transaction_version": 1680592683,
"event_index": -1,
"owner_address": "0x5ae6789dd2fec1a9ec9cccfb3acaf12e93d432f0a3a42c92fe1a9d490b7bbc06",
"storage_id": "0xfa4e15c47bc6b38cc404cf08e30e69fd14ff2cc82b136ef3630445a66605653c",
"asset_type": "0x1::aptos_coin::AptosCoin",
"is_frozen": null,
"amount": "205700",
"type_": "0x1::aptos_coin::GasFeeEvent",
"is_gas_fee": true,
"gas_fee_payer_address": null,
"is_transaction_success": true,
"entry_function_id_str": "0x5ae6789dd2fec1a9ec9cccfb3acaf12e93d432f0a3a42c92fe1a9d490b7bbc06::managed_mkl_token::initialize_module",
"block_height": 222731447,
"token_standard": "v1",
"transaction_timestamp": "2024-09-05T11:52:16",
"storage_refund_amount": "47280"
},
{
"transaction_version": 1957950162,
"event_index": -1,
"owner_address": "0x345ced5d7c67360d61a1d59d8cd83cb53095a81aa24a337027391b1c7dd1786f",
"storage_id": "0x1734f2619bb775e59d04469663b9c05614b5ada6afbf2f750095f43cb8d41e40",
"asset_type": "0x1::aptos_coin::AptosCoin",
"is_frozen": null,
"amount": "2100",
"type_": "0x1::aptos_coin::GasFeeEvent",
"is_gas_fee": true,
"gas_fee_payer_address": null,
"is_transaction_success": true,
"entry_function_id_str": "0x5ae6789dd2fec1a9ec9cccfb3acaf12e93d432f0a3a42c92fe1a9d490b7bbc06::managed_liquidity_auction::claim_mkl_reward",
"block_height": 256094969,
"token_standard": "v1",
"transaction_timestamp": "2024-11-23T22:32:30",
"storage_refund_amount": "0"
},
{
"transaction_version": 1957950162,
"event_index": 0,
"owner_address": "0x7ae7cc51c4fab67181a969f53a5d01a292dad0baf259c92c4e1a13f056768e1c",
"storage_id": "0xa1ddab83c8209aabffc66264730ba95bcc7d7a7966192c00d800ab734729622c",
"asset_type": "0x878370592f9129e14b76558689a4b570ad22678111df775befbfcbc9fb3d90ab",
"is_frozen": null,
"amount": "3643926",
"type_": "0x1::fungible_asset::Withdraw",
"is_gas_fee": false,
"gas_fee_payer_address": null,
"is_transaction_success": true,
"entry_function_id_str": "0x5ae6789dd2fec1a9ec9cccfb3acaf12e93d432f0a3a42c92fe1a9d490b7bbc06::managed_liquidity_auction::claim_mkl_reward",
"block_height": 256094969,
"token_standard": "v2",
"transaction_timestamp": "2024-11-23T22:32:30",
"storage_refund_amount": "0"
},
{
"transaction_version": 1957950162,
"event_index": 1,
"owner_address": "0x345ced5d7c67360d61a1d59d8cd83cb53095a81aa24a337027391b1c7dd1786f",
"storage_id": "0xd29b17433643769f27d89851553ec2ab5e4204b66eceecb6eec774668117c3e0",
"asset_type": "0x878370592f9129e14b76558689a4b570ad22678111df775befbfcbc9fb3d90ab",
"is_frozen": null,
"amount": "3643926",
"type_": "0x1::fungible_asset::Deposit",
"is_gas_fee": false,
"gas_fee_payer_address": null,
"is_transaction_success": true,
"entry_function_id_str": "0x5ae6789dd2fec1a9ec9cccfb3acaf12e93d432f0a3a42c92fe1a9d490b7bbc06::managed_liquidity_auction::claim_mkl_reward",
"block_height": 256094969,
"token_standard": "v2",
"transaction_timestamp": "2024-11-23T22:32:30",
"storage_refund_amount": "0"
}
]
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,36 @@
[
{
"asset_type": "0x5ae6789dd2fec1a9ec9cccfb3acaf12e93d432f0a3a42c92fe1a9d490b7bbc06::mkl_token::MKL",
"creator_address": "0x5ae6789dd2fec1a9ec9cccfb3acaf12e93d432f0a3a42c92fe1a9d490b7bbc06",
"name": "MKL",
"symbol": "MKL",
"decimals": 6,
"icon_uri": null,
"project_uri": null,
"last_transaction_version": 1680592683,
"last_transaction_timestamp": "2024-09-05T11:52:16",
"supply_aggregator_table_handle_v1": null,
"supply_aggregator_table_key_v1": null,
"token_standard": "v1",
"maximum_v2": null,
"is_token_v2": null,
"supply_v2": null
},
{
"asset_type": "0x878370592f9129e14b76558689a4b570ad22678111df775befbfcbc9fb3d90ab",
"creator_address": "0x000000000000000000000000000000000000000000000000000000000000000a",
"name": "MKL",
"symbol": "MKL",
"decimals": 6,
"icon_uri": "",
"project_uri": "",
"last_transaction_version": 1957950162,
"last_transaction_timestamp": "2024-11-23T22:32:30",
"supply_aggregator_table_handle_v1": null,
"supply_aggregator_table_key_v1": null,
"token_standard": "v2",
"maximum_v2": "340282366920938463463374607431768211455",
"is_token_v2": null,
"supply_v2": "96895109643615"
}
]
3 changes: 1 addition & 2 deletions rust/integration-tests/src/models/events_models.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,7 @@ use processor::schema::events;
use serde::{Deserialize, Serialize};
/**
* Event model
* this is created // b/c there is inserated_at field which isn't defined in the Event struct, we can't just load the events directly without specifying the fields.
* TODO: make this more generic to load all fields, then we should be able to run tests for all processor in one test case.
* this is created b/c there is inserated_at field which isn't defined in the Event struct, we can't just load the events directly without specifying the fields.
*/
#[derive(Clone, Debug, Deserialize, FieldCount, Identifiable, Insertable, Serialize, Queryable)]
#[diesel(primary_key(transaction_version, event_index))]
Expand Down
11 changes: 10 additions & 1 deletion rust/integration-tests/src/models/fa_v2_models.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ use diesel::{Identifiable, Insertable, Queryable};
use field_count::FieldCount;
use processor::schema::{
coin_supply, current_fungible_asset_balances, fungible_asset_activities,
fungible_asset_balances, fungible_asset_metadata,
fungible_asset_balances, fungible_asset_metadata, fungible_asset_to_coin_mappings,
};
use serde::{Deserialize, Serialize};

Expand Down Expand Up @@ -110,3 +110,12 @@ pub struct CoinSupply {
pub transaction_epoch: i64,
pub inserted_at: chrono::NaiveDateTime,
}

#[derive(Clone, Debug, Deserialize, FieldCount, Identifiable, Insertable, Serialize)]
#[diesel(primary_key(coin_type))]
#[diesel(table_name = fungible_asset_to_coin_mappings)]
pub struct FungibleAssetToCoinMapping {
pub coin_type: String,
pub fungible_asset_metadata_address: String,
pub last_transaction_version: i64,
}
Loading

0 comments on commit 9bcb77e

Please sign in to comment.