DataProtector Sharing Smart Contracts β
A specific smart contract has been developed to support all of the "Sharing" module features.
It mainly serves as a storage for collections, their associated protected data, and their owners.
Code β
You can find the Solidity code here
DataProtectorSharing β
This is a contract that provides a mechanism for managing and sharing protected data through collections, subscriptions, rentals, and sales. This contract extends several functionalities from OpenZeppelin libraries and incorporates access control, token handling, and order management.
FUNCTIONS
General β
consumeProtectedData(protectedData, workerpoolOrder, app)
getProtectedDataRenter(protectedData, renterAddress)
getCollectionSubscriber(collectionTokenId, subscriberAddress)
createCollection(to)
addProtectedDataToCollection(collectionTokenId, protectedData, appWhitelist)
removeProtectedDataFromCollection(protectedData)
Subscription β
subscribeToCollection(collectionTokenId, subscriptionParams)
setProtectedDataToSubscription(protectedData)
removeProtectedDataFromSubscription(protectedData)
setSubscriptionParams(collectionTokenId, subscriptionParams)
Renting β
rentProtectedData(protectedData, rentingParams)
setProtectedDataToRenting(protectedData, rentingParams)
removeProtectedDataFromRenting(protectedData)
Sale β
buyProtectedData(protectedData, to, price)
setProtectedDataForSale(protectedData, price)
removeProtectedDataForSale(protectedData)
EVENTS
General β
OwnershipTransferred(previousOwner, newOwner)
ProtectedDataTransfer(protectedData, fromCollection, toCollection, appWhitelist)
Subscription β
NewSubscription(collectionTokenId, subscriber, endDate)
ProtectedDataAddedForSubscription(collectionTokenId, protectedData)
ProtectedDataRemovedFromSubscription(collectionTokenId, protectedData)
NewSubscriptionParams(collectionTokenId, subscriptionParams)
Renting β
NewRental(collectionTokenId, protectedData, renter, endDate)
ProtectedDataAddedForRenting(collectionTokenId, protectedData, rentingParams)
ProtectedDataRemovedFromRenting(collectionTokenId, protectedData)
Sale β
ProtectedDataSold(collectionTokenId, newOwner, protectedData)
ProtectedDataAddedForSale(collectionTokenId, protectedData, price)
ProtectedDataRemovedFromSale(collectionTokenId, protectedData)
ProtectedDataConsumed(dealid, protectedData, mode)
ERRORS
General β
OnlyPocoCallerAuthorized(account)
EmptyCallData()
Subscription β
InvalidSubscriptionParams(collectionTokenId, subscriptionParams)
OnGoingCollectionSubscriptions(collectionTokenId)
ProtectedDataAvailableInSubscription(collectionTokenId, protectedData)
Renting β
ProtectedDataCurrentlyBeingRented(protectedData)
ProtectedDataNotAvailableForRenting(protectedData)
DurationInvalid(duration)
ProtectedDataAvailableForRenting(collectionTokenId, protectedData)
Sale β
ProtectedDataNotForSale(protectedData)
InvalidPriceForPurchase(protectedData, price)
WorkerpoolOrderNotFree(workerpoolOrder)
NoValidRentalOrSubscription(collectionTokenId, protectedData)