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

The global indexing of the minted and burned tokens #1012

Open
xgreenx opened this issue Jun 16, 2023 · 3 comments
Open

The global indexing of the minted and burned tokens #1012

xgreenx opened this issue Jun 16, 2023 · 3 comments

Comments

@xgreenx
Copy link

xgreenx commented Jun 16, 2023

This issue first requires finishing the FuelLabs/fuel-vm#496.

With an upcoming feature that allows minting multi assets per contract, it is crucial for the indexer to create Mapping AssetId -> (ContractId, AssetSubId). The ability to find the mother contract for the asset by its AssetId should be a prevalent request and has many use cases in the business logic.

Besides that, with a new fuel_tx::Receipt::Mint and fuel_tx::Receipt::Burn, the indexer also can track the total amount of each asset. It could be useful later to track that bringing of assets is done correctly(the amount of specific asset in the Fuel Network is equal to the amount of bridged tokens).

Voxelot added a commit to FuelLabs/fuel-specs that referenced this issue Aug 7, 2023
### Abstract

This PR introduces granular asset minting which would enable sub
identifiers to be included at asset creation. These sub identifiers can
include important metadata and be used to enable native level NFTs.

**This adds:**
- A new asset ID construction (which incorporates the contract ID and
the sub asset ID).
- New receipt logs for minting and burning which are helpful for
indexing.
- Changes to the MINT and BURN opcodes.

### Cons

- This removes the nice feature that asset IDs are the contract ID.

### Pros

- Native level UTXO based NFTs.
- Single contract multi-asset pools (useful for common AMM designs).

Implementation tickets/PRs:

- FuelLabs/fuel-vm#496
- FuelLabs/fuels-ts#1067
- FuelLabs/fuel-indexer#1012
- FuelLabs/sway#4651

---------

Co-authored-by: Brandon Kite <brandonkite92@gmail.com>
Co-authored-by: Green Baneling <XgreenX9999@gmail.com>
@ra0x3
Copy link
Contributor

ra0x3 commented Sep 12, 2023

@deekerno Any more work to do here after #1205 ?

@deekerno
Copy link
Contributor

There doesn't seem to be any additional work needed, but I want to make sure that I understand this correctly.

If we just want a record of every asset that has been burned or minted on the network, we could create an indexer for that fairly easily and people can make requests to that for information.

In contrast, if instead we want that information to be available to any and every indexer, we would have to process the mint/burn receipts at the same time that we process blocks so that information could be stored in the database and an indexer could make use of that.

@xgreenx, can you provide some examples of how you envision this being used?

@xgreenx
Copy link
Author

xgreenx commented Sep 21, 2023

The primary use case is to find what contract owns the asset and may mint/burn it. Without this information, it is impossible to work with fungible and non-fungible tokens because you can't use methods defined in the standard(you don't know which contract you need to call).

Any project that requires this kind of information can indeed create its own indexer. But it seems to me that everyone wants access to this information.

If you are okay with tracking those receipts, could you also track the supply?=)

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

No branches or pull requests

3 participants