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

TRN-862 Soulbound ERC5484 Tokens #928

Merged
merged 33 commits into from
Feb 26, 2025
Merged

TRN-862 Soulbound ERC5484 Tokens #928

merged 33 commits into from
Feb 26, 2025

Conversation

JCSanPedro
Copy link
Collaborator

@JCSanPedro JCSanPedro commented Feb 23, 2025

This PR includes the changes in #925 and will be merged together.

Description

ERC5484 describes a specification for consensual soulbound tokens. Soulbounds token cannot be transferred once created, however they can be burned. Each token is associated with a BurnAuth field, which dictates which account is allowed to burn the ok.

Additionally, the minting of a token needs to be consensual, meaning that there should be proof that both the issuer (collection owner), and receiver agree to minting this token (and agree to the token's associated burn authority).

This PR extends the nft and sft pallets, as well as their associated precompiles, to support the ERC5484 eip.

Implementation

To implement the consent mechanisms, both pallets introduce two new extrinsics:

  • issue - This is called by the collection owner and creates a pending issuance in storage. For the nft pallet, the burn authority field is also set during this call.
  • accept_issuance - This is called by the token receiver. The token is minted in this call.

This two step mechanism proves that both the issuer and token owner consent to the minting of the token.

Additionally, the sft pallet adds two more extrinsics:

  • set_token_burn_authority - Sets the burn authority for a token and can only be called by the collection owner. Once a burn authority has been set, it is immutable. It is also not allowed to set the burn authority for a token if it has already been minted before. For sfts, if a specific token is soulbound, then all instances of that token should be soulbound as well.
  • burn_as_owner - This supplements the existing burn extrinsic by allowing the collection owner to burn the token.

Precompiles

The precompiles have been updated to support the ERC5484 interface.

Release Notes

Key Changes

Update the nft and sft pallets to support issuing of soulbound tokens, and update the ERC721 and ERC1155 precompiles to support the ERC5484 interface.

Type of Change

  • Runtime Changes
  • Client Changes

API Changes

EVM Precompile Changes

Added

  • ERC721: issue_soulbound
  • ERC721: pending_issuances
  • ERC721: accept_soulbound_issuance
  • ERC1155: issue_soulbound
  • ERC1155: pending_issuances
  • ERC1155: accept_soulbound_issuance
  • ERC1155: burn_as_collection_owner
  • ERC1155: set_burn_auth

Storage Changes

Added

  • Nft: TokenUtilityFlags
  • Nft: PendingIssuances
  • Sft: TokenUtilityFlags
  • Sft: PendingIssuances

Extrinsic Changes

Added

  • Nft: issue_soulbound
  • Nft: accept_soulbound_issuance
  • Sft: issue_soulbound
  • Sft: accept_soulbound_issuance
  • Sft: set_token_burn_authority
  • Sft: burn_as_collection_owner

Event Changes

Added

  • Nft: TokenTransferableFlagSet
  • Nft: PendingIssuanceCreated
  • Nft: Issued
  • Sft: UtilityFlagsSet
  • Sft: TokenTransferableFlagSet
  • Sft: TokenBurnAuthoritySet
  • Sft: PendingIssuanceCreated
  • Sft: Issued

Error Messages

Added

  • Nft: PendingIssuanceLimitExceeded
  • Nft: InvalidPendingIssuance
  • Nft: CannotUpdateTokenUtility
  • Nft: InvalidBurnAuthority
  • Sft: PendingIssuanceLimitExceeded
  • Sft: InvalidPendingIssuance
  • Sft: CannotUpdateTokenUtility
  • Sft: InvalidBurnAuthority

Copy link
Contributor

@JasonTulp JasonTulp left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice work man! Looking good

Copy link
Contributor

@JasonTulp JasonTulp left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! 🚀 Nice work

Copy link
Contributor

@surangap surangap left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm, had some comments

@JCSanPedro JCSanPedro merged commit a69f220 into main Feb 26, 2025
2 checks passed
@JCSanPedro JCSanPedro deleted the TRN-862-sbt branch February 26, 2025 23:14
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

Successfully merging this pull request may close these issues.

4 participants