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

Update std-lib to reflect new granular asset minting spec #4651

Closed
wants to merge 16 commits into from

Conversation

bitzoic
Copy link
Member

@bitzoic bitzoic commented Jun 12, 2023

Description

Changes to std-lib to support multi-asset native token contracts with the introduction of a sub id.

Closes #4644

Checklist

  • I have linked to any relevant issues.
  • I have commented my code, particularly in hard-to-understand areas.
  • I have updated the documentation where relevant (API docs, the reference, and the Sway book).
  • I have added tests that prove my fix is effective or that my feature works.
  • I have added (or requested a maintainer to add) the necessary Breaking* or New Feature labels where relevant.
  • I have done my best to ensure that my PR adheres to the Fuel Labs Code Review Standards.
  • I have requested a review from the relevant team or maintainers.

@bitzoic bitzoic added enhancement New feature or request lib: std Standard library labels Jun 12, 2023
@bitzoic bitzoic self-assigned this Jun 12, 2023
@bitzoic bitzoic linked an issue Jun 12, 2023 that may be closed by this pull request
@SwayStar123
Copy link
Member

I think worths talking discussing if we should have two libraries in the std lib, one with the same api as before (single token), and one with the above multi-token api.

Many usecases only really need one token, and thus would make the new api overtly verbose

@dmihal
Copy link
Contributor

dmihal commented Jun 16, 2023

+1 on @SwayStar123's comment

Would be nice to keep mint and burn the same API that they currently have, which would allow for most applications to update without any changes (other than handling the AssetID -> ContractId conversion)

@bitzoic bitzoic added the breaking May cause existing user code to break. Requires a minor or major release. label Jul 17, 2023
xgreenx added a commit that referenced this pull request Jul 26, 2023
Voxelot added a commit to FuelLabs/fuel-specs that referenced this pull request 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>
@bitzoic
Copy link
Member Author

bitzoic commented Aug 15, 2023

Closed by #4821

@bitzoic bitzoic closed this Aug 15, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
breaking May cause existing user code to break. Requires a minor or major release. enhancement New feature or request lib: std Standard library
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Update std-lib to reflect new granular asset minting spec
3 participants