Status: Draft

Version: -

Abstract

The following specification details the exact requirements for minting Verto-compatible NFTs and an unaudited SmartWeave contract example.

Motivation

With the recent excitement about NFTs being storable on Arweave, we feel it's important for Verto to support all types of SmartWeave tokens, including media-based tokens.

Specification

1. SmartWeave Contract

The NFT SmartWeave Contract SHOULD be an atomic contract, meaning the data (artwork, audio, video, etc.) of the NFT lies in the transaction that also initializes the SmartWeave contract.

The NFT contract MUST behave like a default profit-sharing token contract in its functionality, meaning it must include the following functions:

  1. transfer
  2. balance

The NFT contract MUST have the following data supplied in its state:

  1. name: String
  2. description: String
  3. ticker: String
  4. balance: {"Owner's wallet address": 1}

The following contract source may serve as a baseline for any Verto-compatible tokens:

export function handle(state, action) {
  const input = action.input;
  const caller = action.caller;
  if (input.function === "transfer") {
    const target = input.target;
    ContractAssert(target, `No target specified.`);
    ContractAssert(caller !== target, `Invalid token transfer.`);
    ContractAssert(caller === state.owner, `Caller does not own the token.`);
    state.owner = target;
    return {state};
  }
  if (input.function === "balance") {
    let target;
    if (input.target) {
      target = input.target;
    } else {
      target = caller;
    }
    const ticker = state.ticker;
    ContractAssert(typeof target === "string", `Must specify target to retrieve balance for.`);
    return {
      result: {
        target,
        ticker,
        balance: target === state.owner ? 1 : 0
      }
    };
  }
  throw new ContractError(`No function supplied or function not recognised: "${input.function}".`);
}

2. Transaction Tag Schema

The atomic NFT contract initialization MUST have the following tags:

  1. Exchange: Verto
  2. Action: marketplace/Create
  3. Content-Type: (Applicable based on media type)
  4. App-Name: SmartWeaveContract
  5. App-Version: 0.3.0
  6. Contract-Src: (Your contract source transaction)
  7. Init-State: (The JSON of your initial contract state)

Additionally, it can have a Series tag if the given work is part of a series.

The following transaction may serve as an example for initializing an atomic NFT contract: 6F8DQjCiMpTHMSje1AEJN_PmjUkFlRlL7OjhH477BZI (See on ViewBlock)