VRC725 Specification

VRC725 is the simplest form of Non-Fungible Token on Viction

VRC725 is the official standard for Non-fungible tokens in Viction ecosystem.

Abstract

The following standard allows for the implementation of a standard API for NFTs within smart contracts. This standard provides basic functionality to track and transfer NFTs.

We considered use cases of NFTs being owned and transacted by individuals as well as consignment to third party brokers/wallets/auctioneers (“operators”). NFTs can represent ownership over digital or physical assets. We considered a diverse universe of assets, and we know you will dream up many more:

  • Physical property — houses, unique artwork

  • Virtual collectibles — unique pictures of kittens, collectible cards

  • “Negative value” assets — loans, burdens and other responsibilities

In general, all houses are distinct and no two kittens are alike. NFTs are distinguishable and you must track the ownership of each one separately.

This standards also support gas-free protocol by enabling mechanism that those protocol can utilize while maintaince the security of the token itself.

Motivation

A standard interface allows wallet/broker/auction applications to work with any NFT on Viction. We provide for simple VRC725 smart contracts as well as contracts that track an arbitrarily large number of NFTs. Additional applications are discussed below.

VRC725 can work both with VictionZ with some limitation, which you can consider, or without VictionZ. The permit extension required by VRC725 is suffient for any gas-less protocol to work with.

Specification

VRC725 is based on ERC721. VRC725 includes IERC721Metadata extension to make it easier for use. Moreorver, it also includes two custom permit implementation inspired by EIP-4494 to support gas-free operation.

interface IERC721 is IERC165 {
    event Transfer(address indexed from, address indexed to, uint indexed tokenId);
    event Approval(address indexed owner, address indexed approved, uint indexed tokenId);
    event ApprovalForAll(address indexed owner, address indexed operator, bool approved);

    function balanceOf(address owner) external view returns (uint balance);
    function getApproved(uint tokenId) external view returns (address operator);
    function isApprovedForAll(address owner, address operator) external view returns (bool);
    function ownerOf(uint tokenId) external view returns (address owner);
    function approve(address to, uint tokenId) external;
    function transferFrom(address from, address to, uint tokenId) external;
    function safeTransferFrom(address from, address to, uint tokenId) external;
    function safeTransferFrom(address from, address to, uint tokenId, bytes calldata data) external;
    function setApprovalForAll(address operator, bool _approved) external;
}

Source: IERC721.sol

Source: IERC721Metadata.sol

Source: IERC4494.sol

Source: IVRC725.sol

Methods

  • balanceOf: Returns the number of tokens in owner's account.

  • getApproved: Returns the account approved for tokenId token.

  • isApprovedForAll: Returns if the operator is allowed to manage all of the assets of owner.

  • ownerOf: Returns the owner of the tokenId token.

  • approve: Gives permission to to to transfer tokenId token to another account.

  • transferFrom: Transfers tokenId token from from to to.

  • safeTransferFrom: Safely transfers tokenId token from from to to, checking first that contract recipients are aware of the ERC721 protocol to prevent tokens from being forever locked.

  • safeTransferFrom: Safely transfers tokenId token from from to to.

  • setApprovalForAll: Approve or remove operator as an operator for the caller. Operators can call {transferFrom} or {safeTransferFrom} for any token owned by the caller.

  • name: Returns the token collection name.

  • symbol: Returns the token collection symbol.

  • tokenURI: Returns the Uniform Resource Identifier (URI) for tokenId token.

  • estimateFee: Calculate fee needed to transfer amount of tokens.

  • issuer:Owner of the token

  • nonces: Returns the nonce of an NFT - useful for creating permits

  • isUsedNonce: Is used nonce

  • minFee: The amount fee that will be lost when transferring.

  • permit: Approve for one tokenId by using pre-signed signature, allow other users or smart contract to perform the transfer without owner calling approve first.

  • permitForAll: Approve for a spender by using pre-signed signature, allow other users or smart contract to perform the transfer without owner calling approve first.

Events

  • Transfer

Emitted when tokenId token is transferred from from to to. This event MUST be emitted when tokens are transferred in functions transfer ,transferFrom and safeTransferFrom.

  • Approval

Emitted when owner enables approved to manage the tokenId token. This event MUST be emitted on any successful call to approve function and permit function.

  • ApprovalForAll

Emitted when owner enables or disables (approved) operator to manage all of its assets.This event MUST be emitted on any successful call to setApprovalForAll function and permitForAll function.

Requirement

For a contract to meet VRC725 requirements, it must satisfy the following conditions:

  • Implement IVRC725 which includes IERC721, IERC721Metadata.

  • Must implement 2 functions: permit as defined in EIP- 4494 and its custom variant permitForAll.

  • Have 3 first storage slots in the contracts as follow, this is not required but necessary for integration with VictionZ.

Implementation

To implement VRC725, use can extend ERC721 contract from OpenZeppelin contract libraries or your existing NFT contract. The major differences are that permit and permitForAll functions are required, and the position in storage slots of _balances, _minFee, _owner.

Otherwise, you can inherit the VRC725 from our repository.

Source: VRC725.sol

Example

The following example demonstrates a token using the VRC725.

Source: TestNFT.sol

Enable zero-gas transaction

VRC725 is not required to apply for VictionZ. Zero-gas operation will be applied through TransferHelper (click here for example) which is integrated VRC25.

In the case you need to apply for VictionZ to support more Zero-gas operations in your token, VRC725 is still compatible with VictionZ. Please refer to VIC ZeroGas page for instruction.

Last updated