Status: Draft
Version: -
The following specification details the exact requirements for minting Verto-compatible NFTs and an unaudited SmartWeave contract example.
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.
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:
transfer
balance
The NFT contract MUST have the following data supplied in its state:
name
: String
description
: String
ticker
: String
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}".`);
}
The atomic NFT contract initialization MUST have the following tags:
Exchange
: Verto
Action
: marketplace/Create
Content-Type
: (Applicable based on media type)
App-Name
: SmartWeaveContract
App-Version
: 0.3.0
Contract-Src
: (Your contract source transaction)
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)