Grant Access right to DAO Members
Additional Examples of VWBL Access Condition Possibilities
In this VWBL example, we can develop digital media protocols which DAO members can only view.
This example contract uses Moloch DAO as the DAO framework. VWBL currently is free to use.
Similar to ERC-1155, there are usually many members within a DAO organization, and the fee structure is currently developed to be similar to ERC-1155. 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 grantAccessControlToDAOMember
function is called). Additional one-time DAO-member VWBL decryption request fees are currently being evaluated. Currently the VWBL code enacts this DAO-member one-time fee to the gateway contact before the decryption request is fulfilled.
Smart Contracts
AccessControlCheckerByDAOMember.sol
: Access condition contract which grants a DAO member access control.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.
Grant Access Rights to DAO member and Register Access Condition to Gateway Contract
With the below, the DAO member(s) register their digital content information to the access condition contract and the access condition of digital content is updated to the gateway contract.
System Call Flow
grantAccessControlToDAOMember() (AccessControlCheckerByDAOMember.sol)
/**
* @notice Grant access control, register access condition and digital content info
* @param documentId The Identifier of digital content and decryption key
* @param name The digital content name
* @param encryptedDataUrl The Url of encrypted digital content data
*/
function grantAccessControlToDAOMember(
bytes32 documentId,
string calldata name,
string calldata encryptedDataUrl
) external onlyDAOMember payable returns (bytes32) {
IVWBLGateway(getGatewayAddress()).grantAccessControl.value(msg.value)(documentId, address(this), msg.sender);
documentIdToToken[documentId].contractAddress = address(this);
documentIdToToken[documentId].tokenId = ++counter;
documentIdToInfo[documentId].author = msg.sender;
documentIdToInfo[documentId].name = name;
documentIdToInfo[documentId].encryptedDataUrl = encryptedDataUrl;
existDocumentId[documentId] = true;
documentIds.push(documentId);
emit grantedAccessControl(documentId);
return documentId;
}
/**
* @notice Get VWBL gateway address
*/
function getGatewayAddress() public view returns (address) {
return IGatewayProxy(gatewayProxy).getGatewayAddress();
}
-internal call->grantAccesControl() (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 checkAccessControl() to Gateway Contract
AccessControlCheckerByDAOMember.sol
is VWBL's access condition contract which contains the checkAccessControl()
method of the IAccessControlChecker
interface.
getOwnerAddress()
: Return false because there is no digital content owner.
function getOwnerAddress(bytes32 documentId) external view returns (address) {
return address(0);
}
checkAccessControl()
returns True if user is a specified DAO member.
function checkAccessControl(
address user,
bytes32 documentId
) external view returns (bool) {
(,uint256 shares, uint256 loot,,,) = molochContract.members(user);
if (
existDocumentId[documentId]
&& (shares > 0 || loot > 0)
) {
return true;
}
return false;
}
Github Repository
GitHub: https://github.com/VWBL/Access-Condition-MolochDAO/tree/main/contracts