Skip to content

Commit e0c2511

Browse files
lightmarkgregnazario
authored andcommitted
[update] fa
1 parent cf511c3 commit e0c2511

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

apps/nextra/pages/en/build/guides/system-integrators-guide.mdx

+9-1
Original file line numberDiff line numberDiff line change
@@ -218,9 +218,17 @@ For any `FungibleStore`
218218
s, [`fungible_asset::transfer`](https://github.com/aptos-labs/aptos-core/blob/main/aptos-move/framework/aptos-framework/sources/fungible_asset.move#L347)
219219
would be invoked with `FungibleStore` object addresses.
220220

221+
It is noted in the migration phase from coin to FA, withdraw/deposit/transfer FA paired from coin should
222+
call `0x1::coin::deposit/withdraw/transfer`(coin module API) to transfer the asset because the account may have the asset in both
223+
form but fungible asset API can only move FA part but not the coin part. In contrast, coin API could move both parts. For other FA,
224+
since it does not have a paired coin type, only fungible asset API can be used to move assets.
225+
To know which API to call, please refer to [`concurrent_fungible_asset_balance`](../../../indexer/fungible-asset-balances.mdx) table `standard` field, where "v1" means using coin API and "v2" means using fungible asset API.
226+
221227
### Current balance for Fungible Asset
222228

223-
The current balance for an APT FA of FungibleStore is available at the account resources URL: `https://{rest_api_server}/accounts/{fungible_store_object_address}/resource/0x1::fungible_asset::FungibleStore`. The balance is stored as `balance`. The resource also contains a metadata object of the FA type and the frozen status. The address of the primary fungible store can be calculated as `sha3_256(32-byte account address | 32-byte metadata object address | 0xFC)`. The metadata object address of APT FA is `0xA`.
229+
Indexer users can just query [`concurrent_fungible_asset_balance`](../../indexer/fungible-asset-balances.mdx) to get the balance.
230+
231+
For node API, the current balance for an APT FA of FungibleStore is available at the account resources URL: `https://{rest_api_server}/accounts/{fungible_store_object_address}/resource/0x1::fungible_asset::FungibleStore`. The balance is stored as `balance`. The resource also contains a metadata object of the FA type and the frozen status. The address of the primary fungible store can be calculated as `sha3_256(32-byte account address | 32-byte metadata object address | 0xFC)`. The metadata object address of APT FA is `0xA`.
224232

225233
Aptos users have the option to upgrade to concurrent fungible balance to allow parallelization of balance updates, improving the performance of a single account. When a user has upgraded a fungible store balance to support concurrent update, the fungible store object will have another resource `ConcurrentFungibleBalance` that contains the balance of the store, and the `balance` field of FungibleStore will be set to 0. The current balance for an APT FA of `ConcurrentFungibleBalance` (if exists) is available at the account resources URL: `https://{rest_api_server}/accounts/{fungible_store_object_address}/resource/0x1::fungible_asset::ConcurrentFungibleBalance`.
226234

apps/nextra/pages/en/build/smart-contracts/fungible-asset.mdx

+1-1
Original file line numberDiff line numberDiff line change
@@ -417,7 +417,7 @@ There are two changes needed for off-chain services:
417417

418418
Since a user may possess **both** a `coin` balance and a paired FA balance, off-chain applications should be updated to reflect the **sum** of both the `coin` balance and its paired FA balance.
419419

420-
- For Aptos Indexer users, you may utilize a new table called `current_unified_fungible_asset_balances` to obtain the latest sum of coin balance and FA balance representing the same asset type.
420+
- For Aptos Indexer users, you may utilize the table called `current_fungible_asset_balances` to obtain the latest sum of coin balance and FA balance representing the same asset type. If the FA has a paired coin type, the asset type would be set to the coin type, such as `0x1::aptos_coin::AptosCoin`. Otherwise, for FA not paired from a coin, the asset type would be the metadata address. Users could filter by this field to get the FA balance of their interest.
421421
- For users employing Node API or other customized indexing, they should add the balance of the paired FA in users' `FungibleStore` and `ConcurrentFungibleBalance` if any of them exist to the coin balance.
422422

423423
To retrieve the balance of the `PrimaryFungibleStore` for a paired FA to an existing `coin` of type `CoinType`:

0 commit comments

Comments
 (0)