Grant Access right to ERC-1155 (Multi-Token) Holders

This page describes how VWBL grants VWBL NFT access rights to the ERC-1155 Token Holders

What is ERC-1155?

ERC-1155​ is a token which combines non-fungible and fungible elements. The ERC-721 standard only allows 1 owner/holder of an NFT to exist, however ERC-1155 standards allow a token to have multiple 'holders', being much more efficient when the same piece of digital content is published to multiple 'holders'.

With ERC-1155 when a content creator or publisher wishes to deliver one digital content to 100 people, they would mint ERC-1155 with a token quantity set at 100, only require minting once.

About ERC-1155 and VWBL

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

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

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). Based upon current commonly accepted publisher models, additional one-time ERC-1155 holder VWBL decryption request fees are currently being evaluated. Currently the VWBL code enacts this ERC-1155 holder-only, one-time fee to the gateway contact before the decryption request is fulfilled.

There is an additional function that supports the one-time fee function when transferring ERC-1155 holders via the safeTransferAndPayFee function.

Smart Contracts

Contract architecture is very similar to the basic VWBL NFT digital media protocol.

  • VWBLERC1155.sol The ERC1155 contract which will be granted VWBL features (that only ERC-1155 holders can view digital content).
  • AccessControlCheckerByERC1155.sol: Access condition contract which defines that an ERC-1155 holder and the ERC1155 Minter (digital content creator/decryption key creator) is granted access control. This contract owner is VWBL team.
  • VWBLGateway.sol : Contract which manages who has access right to the 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 ERC1155 and Register Access Conditions to the Gateway Contract

The content creator mints ERC1155, linked to digital content, and then grants access control and register access conditions for that digital content.

System Call Flow

mint() (VWBLERC1155.sol)
 /**
   * @notice Mint ERC1155, grant access feature and register access condition of digital content.
   * @param _getKeyURl The URl of VWBL Network(Key management network)
   * @param _amount The token quantity
   * @param _royaltiesPercentage Royalty percentage of ERC1155
   * @param _documentId The Identifier of digital content and decryption key
   */
function mint(
    string memory _getKeyURl, 
    uint256 _amount, 
    uint256 _royaltiesPercentage, 
    bytes32 _documentId
) public payable returns (uint256) {
    uint256 tokenId = ++counter;
    tokenIdToTokenInfo[tokenId].minterAddress = msg.sender;
    tokenIdToTokenInfo[tokenId].getKeyURl = _getKeyURl;
    _mint(msg.sender, tokenId, _amount, "");
    if (_royaltiesPercentage > 0) {
        _setRoyalty(tokenId, msg.sender, _royaltiesPercentage);
    }

    IAccessControlCheckerByERC1155(accessCheckerContract).grantAccessControlAndRegisterERC1155{value: msg.value}(
        _documentId,
        address(this),
        tokenId
    );

    return tokenId;
}
-internal call-> grantAccessControlAndRegisterERC1155() (AccessControlCheckerByERC1155.sol)
/**
  * @notice Grant access control, register access condition and ERC1155 info
  * @param documentId The Identifier of digital content and decryption key
  * @param erc1155Contract The contract address of ERC1155
  * @param tokenId The Identifier of ERC1155
  */
function grantAccessControlAndRegisterERC1155(bytes32 documentId, address erc1155Contract, uint256 tokenId) public payable {
    IVWBLGateway(getGatewayAddress()).grantAccessControl{value: msg.value}(documentId, address(this), IVWBLERC1155(erc1155Contract).getMinter(tokenId));
    documentIdToToken[documentId].contractAddress = erc1155Contract;
    documentIdToToken[documentId].tokenId = tokenId;
    emit erc1155DataRegistered(erc1155Contract, 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);
}

Expose Access Condition Methods to Gateway Contract

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

  1. getOwnerAddress() : Return false because there is no digital content owner.
function getOwnerAddress(
    bytes32 documentId
) external view returns (address) {
    return address(0);
}
  1. checkAccessControl(): Return True if user is ERC-1155 holder
function checkAccessControl(
    address user,
    bytes32 documentId
) external view returns (bool) {
     Token memory token = documentIdToToken[documentId];
​
    if (
        IERC1155(token.contractAddress).balanceOf(user, token.tokenId) > 0
    ) {
        return true;
    }
​
    return false;
}

Github Repository

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

results matching ""

    No results matching ""