Skip to content
This repository has been archived by the owner on Sep 5, 2022. It is now read-only.

NFTEditable Standard Extension #68

Open
tolya-yanot opened this issue Feb 12, 2022 · 0 comments
Open

NFTEditable Standard Extension #68

tolya-yanot opened this issue Feb 12, 2022 · 0 comments

Comments

@tolya-yanot
Copy link
Member

tolya-yanot commented Feb 12, 2022

⚠️ WARNING: Standards are now published and discussed in the TEPs repository. This page may be out of date.

NFTEditable

Summary

Extension for NFT Standard.

  1. Introducing editor role on collection level simplifies process of mass update as well as signalling of impossibility of such mass update

  2. Introducing editor role on NFT level simplifies process of per NFT updates and provide interface for algorithmic updates

Specification

NFT Collection and/or NFT item smart contracts must implement:

Internal messages

1. edit_content

Request

TL-B schema of inbound message:

edit_content#1a0b9d51 query_id:uint64 payload:Cell = EditRequest;

Should be rejected if:

Message is not from current editor.

Otherwise should do:

Update NFT content according it' inner logic and payload.

2. transfer_editorship

Request

TL-B schema of inbound message:

transfer_editorship#1c04412a query_id:uint64 new_editor:MsgAddress response_destination:MsgAddress custom_payload:(Maybe ^Cell) forward_amount:(VarUInteger 16) forward_payload:(Either Cell ^Cell) = EditRequest;

query_id - arbitrary request number.

new_editor - address of the new editor of the NFT item.

response_destination - address where to send a response with confirmation of a successful transfer and the rest of the coins.

custom_payload - optional custom data.

forward_amount - the amount of nanotons to be sent to the new editor.

forward_payload - optional custom data that should be sent to the new editor.

Should be rejected if:

  1. message is not from current editor.

  2. there is no enough coins (with respect to NFT own storage fee guidelines) to process operation and send forward_amount.

  3. After processing the request, the contract must send at least in_msg_value - forward_amount - max_tx_gas_price to the response_destination address.

    If the contract cannot guarantee this, it must immediately stop executing the request and throw error.

    max_tx_gas_price is the price in Toncoins of maximum transaction gas limit of NFT habitat workchain. For the basechain it can be obtained from ConfigParam 21.

Otherwise should do:

  1. change current editor of NFT to new_editor address.

  2. if forward_amount > 0 send message to new_editor address with forward_amount nanotons attached and with the following layout:

    TL-B schema: editorship_assigned#511a4463 query_id:uint64 prev_editor:MsgAddress forward_payload:(Either Cell ^Cell) = InternalMsgBody;

    query_id should be equal with request's query_id.

    forward_payload should be equal with request's forward_payload.

    prev_editor is address of the previous editor of this NFT item.

    If forward_amount is equal to zero, notification message should not be sent.

  3. Send all excesses of incoming message coins to response_destination with the following layout:

    TL-B schema: excesses#d53276db query_id:uint64 = InternalMsgBody;

    query_id should be equal with request's query_id.

Get-methods

  1. get_editor returns (slice editor)
    return slice of type MsgAddress - address of editor which can update common content in NFT collection/NFT item.

TL-B Schema

edit_content query_id:uint64 payload:Cell = InternalMsgBody;
transfer_editorship query_id:uint64 new_editor:MsgAddress response_destination:MsgAddress custom_payload:(Maybe ^Cell)  forward_amount:(VarUInteger 16) forward_payload:(Either Cell ^Cell) = InternalMsgBody;
editorship_assigned query_id:uint64 prev_editor:MsgAddress forward_payload:(Either Cell ^Cell) = InternalMsgBody;

crc32('edit_content query_id:uint64 payload:Cell = InternalMsgBody') = 0x1a0b9d51 & 0x7fffffff = 0x1a0b9d51

crc32('transfer_editorship query_id:uint64 new_editor:MsgAddress response_destination:MsgAddress custom_payload:Maybe ^Cell forward_amount:VarUInteger 16 forward_payload:Either Cell ^Cell = InternalMsgBody') = 0x9c04412a & 0x7fffffff = 0x1c04412a

crc32('editorship_assigned query_id:uint64 prev_editor:MsgAddress forward_payload:Either Cell ^Cell = InternalMsgBody') = 0xd11a4463 & 0x7fffffff = 0x511a4463

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

1 participant