Private survey publishing

In this milestone, our goal is to enable a survey publisher to publish a survey as a dataNFT, provide bounties, and an array of whitelisted addresses. In this scenario, the survey publisher is the owner of the dataNFT and also owns the CIDs of all survey responses. Given that the survey is published as private, this ensures that only whitelisted addresses can participate in the survey and receive the bounties.

In this milestone, we've implemented a workflow that obliges the survey publisher to stake their dataNFT into the DataNFTVault smart contract before they can request the respondents' CID from the SurveyVault smart contract. This process ensures that the ownership of the dataNFT is transferred to the community after the predetermined private duration expires. In this case, the duration to maintain the survey responses as private has been set to one year.

Process PrivateSurveyFlow

  1. Initially, the survey publisher initializes SurveyFactory.sol and provides the questions.json CID, bounties in $ocean, the number of participants, and whitelisted addresses.
  2. Following this, the survey publisher deploys SurveyVault.sol via SurveyFactory.sol and sets the whitelisted addresses, $ocean bounties, and the number of participants in the vault.
  3. Eligible survey responders on the whitelist can submit their response.json CID to SurveyVault.sol. These responders are then able to claim their allocated $ocean bounties until the total number of response.json CIDs matches the predetermined number of participants.
  4. Once SurveyVault.sol is deployed, its address is returned to SurveyFactory.sol and the survey publisher mints a data NFT, setting the metadata through the client. The file address in the dataNFT is set to SurveyVault.sol's smart contract address.
  5. The survey publisher must stake the minted dataNFT into DataNFTVault.sol to receive the CIDs stored in SurveyVault.sol. At this stage, only the survey publisher can access CIDs from SurveyVault.sol.
  6. When the dataNFT staked in DataNFTVault matures, a call function can trigger the transfer of dataNFT ownership from the DataNFTVault to the Community Treasury.
  7. The Community Treasury now owns the dataNFT and the SurveyVault. The dataNFT is listed on Ocean's marketplace, and survey response CIDs can be accessed via dataTokens.

Untitled

The repository is publicly available on our GitHub

For simplicity of testing the private survey flow combining milestone 4.1 & 4.2, all smart contracts and client scripts are placed in a single repository.

https://github.com/datalatte-ai/PrivateSurveyFlow