Granting Access Rights to the Specific NFT Owners (ERC-721)

This page describes how VWBL grants VWBL NFT access rights to the NFT owner

About ERC-721 and VWBL

Details about the ERC-721 NFT Standards are here. VWBL currently is free to use.

Learn more about how we're thinking about fees ("gas") for ERC-721.

Currently, fees ("gas") for key storage is coded to be taken in when digital content is first published (specifically, when the mint function is called). Further decryption requests and views by the NFT Owners (digital content owner) do not require further fees/gas.

Smart Contracts

There are three contracts of the VWBL NFT digital media protocol that are primarily used.

  • VWBL.sol: NFT Contract which adds VWBL features: e.g. that only NFT Owner can view digital content.
  • AccessControlCheckerByNFT.sol: Access condition contract which grants the NFT Owner access control as well as the NFT Minter (digital content creator / decryption key requester). This contract owner is VWBL team.
  • VWBLGateway.sol : Contract which manages who has access rights of the specified digital content. This contract owner is VWBL team. GatewayProxy.sol: Contract which returns VWBLGateway contract address of latest version. This contract owner is VWBL team.

Mint, Grant Access Control and Register Access Conditions

The content creator mint a VWBL NFT, linked to digital content, and then grants access control and register access conditions for that digital content.

System Call Flow
mint() (VWBL.sol)
/**
  * @notice Mint NFT, grant access feature and register access condition of digital content.
  * @param _getKeyURl The URl of VWBL Network(Key management network)
  * @param _royaltiesPercentage Royalty percentage of NFT
  * @param _documentId The Identifier of digital content and decryption key
  */
function mint(string memory _getKeyURl, uint256 _royaltiesPercentage, bytes32 _documentId) public payable returns (uint256) {
   uint256 tokenId = super._mint(_documentId, _getKeyURl, _royaltiesPercentage);

   // grant access control to nft and pay vwbl fee and register nft data to access control checker contract
   IAccessControlCheckerByNFT(accessCheckerContract).grantAccessControlAndRegisterNFT{value: msg.value}(_documentId, address(this), tokenId);

   return tokenId;
 }
-internal call-> grantAccessControlAndRegisterNFT() (AccessControlCheckerNFT.sol)
/**
  * @notice Grant access control, register access condition and NFT info
  * @param documentId The Identifier of digital content and decryption key
  * @param nftContract The contract address of NFT
  * @param tokenId The Identifier of NFT
  */
function grantAccessControlAndRegisterNFT(bytes32 documentId, address nftContract, uint256 tokenId) public payable {
    IVWBLGateway(getGatewayAddress()).grantAccessControl{value: msg.value}(documentId, address(this),IVWBL(nftContract).getMinter(tokenId));
    documentIdToToken[documentId].contractAddress = nftContract;
    documentIdToToken[documentId].tokenId = tokenId;
    emit nftDataRegistered(nftContract, tokenId);
}

/**
 * @notice Get VWBL gateway address
 */
 function getGatewayAddress() public view returns (address) {
    return IGatewayProxy(gatewayProxy).getGatewayAddress();
}
-internal call-> grantAccessControl() (VWBLGateway.sol)
/**
 * @notice Grant access control feature and registering access condition of digital content
 * @param documentId The Identifier of digital content and decryption key
 * @param conditionContractAddress The contract address of access condition
 * @param minter The address of digital content creator
 */
function grantAccessControl(
    bytes32 documentId,
    address conditionContractAddress,
    address minter
) public payable {
    require(msg.value <= feeWei, "Fee is too high");
    require(msg.value >= feeWei, "Fee is insufficient");
    require(
        documentIdToConditionContract[documentId] == address(0),
        "documentId is already used"
    );

    pendingFee += msg.value;
    documentIdToConditionContract[documentId] = conditionContractAddress;
    documentIds.push(documentId);
    documentIdToMinter[documentId] = minter;
    emit accessControlAdded(documentId, conditionContractAddress);
}

Exposing Access Condition Methods to Gateway Contracts

AccessControlCheckerByNFT.sol is a VWBL's access condition contract which contains the following 2 methods of the IAccessControlChecker interface.

  1. getOwnerAddress() : Return NFT Owner (digital content owner)
function getOwnerAddress(
        bytes32 documentId
    ) external view returns (address) {
        Token memory token = documentIdToToken[documentId];
        return IERC721(token.contractAddress).ownerOf(token.tokenId);
    }
  1. checkAccessControl() : Return false because this access condition contract grants access right to only NFT Minter and Owner.
function checkAccessControl(
        address user,
        bytes32 documentId
    ) external view returns (bool) {
        return false;
    }

Github Repository

GitHub: https://github.com/VWBL/VWBL-protocol/tree/master/contracts/access-condition/ERC721

results matching ""

    No results matching ""