npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, πŸ‘‹, I’m Ryan HefnerΒ  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you πŸ™

Β© 2024 – Pkg Stats / Ryan Hefner

@masa-finance/masa-contracts-marketplace

v2.1.26

Published

## πŸ“Œ Introduction

Downloads

399

Readme

🌐 Masa Data Marketplace: DataPoints.sol, DataPointsMulti.sol, DataStaking.sol Overview

πŸ“Œ Introduction

The Masa Data Marketplace is a decentralized data marketplace where users can share their data and earn rewards πŸŽ‰. Utilizing DataPointsMulti.sol and DataStaking.sol, the platform represents users' data interactions within the Masa Network as Soulbound tokens 🀝. These tokens, known as DataPoints, can be "staked" into Data Pools using DataStaking.sol, allowing users to contribute their data to the network and receive rewards in return πŸ’°. This system enables users to realize value from their Masa data footprint in a secure and transparent manner πŸ”’.

πŸ“Š DataPoints (DataPoints.sol)

DataPoints.sol

is an ERC20-based smart contract designed to represent accumulated data points as Soulbound tokens πŸš«πŸ”„. This contract includes functionalities for minting and burning tokens, with distinct roles for each action and an admin role for role management. The non-transferability of these tokens ensures they serve purely as a representation of earned points rather than tradable assets πŸ›‘οΈ.

Key Features:

  • Minting and Burning: Only addresses with the appropriate roles can mint or burn tokens, ensuring controlled distribution and redemption of DataPoints πŸ”‘.
  • Role-Based Access Control: Utilizes OpenZeppelin's AccessControl to manage roles and permissions within the contract πŸ”.
  • Soulbound: Overrides ERC20's transfer and transferFrom functions to prevent token transfers, ensuring DataPoints remain tied to the original recipient 🚫.

🌈 DataPointsMulti (DataPointsMulti.sol)

DataPointsMulti.sol

extends the ERC1155 standard to create a Soulbound multi-token contract, where each token ID represents a different data interaction type within the Masa Network 🎨. Similar to DataPoints.sol, it features minting and burning capabilities, role-based access control, and non-transferability of tokens.

Key Features:

  • Multiple Data Types: Supports various data interaction types, such as 'pageView', 'login', 'mint', etc., each represented by a unique token ID πŸ”„.
  • Dynamic URI Mechanism: Implements the ERC1155 URI mechanism to provide on-chain metadata for each token type, facilitating dynamic metadata updates πŸ“„.
  • Soulbound: Ensures tokens cannot be transferred between addresses once minted, focusing on the representation of data points 🚫.

Example Metadata

For a 'pageView' data type, the metadata might look like this:

{
    "name": "pageView",
    "merkle_root": "4e07408562bedb8b60ce05c1decfe3ad16b7224e",
    "zkp": "0x123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0",
    "description": "This metadata incorporates a Merkle root and a Zero-Knowledge Proof (ZKP) to validate and identify the pageView event with its full offchain data. The Merkle root ensures data integrity, while the ZKP provides privacy-preserving verification, maintaining the authenticity of events tracked through the Masa Network without revealing underlying data.",
    "image": "https://masa.finance/pageView.png",
    "weight": 0.5
}

This metadata provides a clear description of the data type, an associated image, and a weight that could represent the relative value or rarity of this data point within the ecosystem.

DataStaking.sol

is a smart contract that enables users to stake their non-transferable tokens, which are represented by DataPointsMulti.sol, to earn rewards over time πŸ’Έ. This contract is a crucial component of the Masa Network's ecosystem, allowing users to participate actively by staking their accumulated data points in exchange for rewards. The contract leverages the ERC20 standard for the rewards mechanism, distributing rewards in the form of ERC20 tokens.

Key Features:

  • Staking Mechanism: Users can stake their non-transferable tokens by interacting with the DataStaking contract. This process involves specifying the token ID and the amount they wish to stake πŸ’Ό.
  • Reward Calculation: The contract calculates rewards based on the amount of tokens staked, the duration of the stake, and a predefined reward rate for each token ID πŸ“ˆ. This incentivizes users to participate in the staking process.
  • Role-Based Access Control: Utilizes OpenZeppelin's AccessControl to manage roles and permissions, ensuring that only authorized addresses can set reward rates and durations for staking πŸ”.
  • Event Emission: The contract emits events such as Staked and RewardsClaimed to provide transparency and traceability for staking actions and reward claims πŸ“£.

πŸš€ Staking Tokens for Rewards

The user journey for earning rewards through staking begins with users holding non-transferable tokens, represented by DataPointsMulti.sol, acquired from various activities within the ecosystem πŸ›€οΈ. Users can stake these tokens via the DataStaking contract to earn rewards over time. The process involves:

  1. Initiating Staking: Users stake their tokens by interacting with the DataStaking contract, specifying the token ID and the amount they wish to stake. This decision is driven by the anticipation of earning rewards, which are influenced by the staked token's duration and reward rate ⏱️.
  2. Understanding Staking Parameters: The duration for which tokens must be staked and the reward rate for each token ID are predetermined by the contract's administrator through the setRewardRateAndDuration function. Users are aware that these parameters directly affect the potential rewards from staking their tokens πŸ“.
  3. Claiming Rewards: Upon the completion of the staking period, users claim their rewards by calling the claimRewards function, specifying the token ID. The contract calculates the reward based on the staked amount, the staking duration, and the reward rate for the token ID πŸ’Έ.
  4. Receiving Rewards: Rewards are distributed in the form of an ERC20 token, transferred to the user's address, allowing them to use or manage these tokens within the ecosystem or elsewhere 🏦.

Summary:

  • Staking Tokens: Users stake specific tokens to earn rewards, with each token ID having its unique reward rate and staking duration 🌟.
  • Claiming Rewards: After the staking period, users claim their rewards, which are paid out in an ERC20 token πŸ†.
  • Events for Tracking: The contract emits events (Staked and RewardsClaimed) to ensure transparency and traceability for staking actions and reward claims πŸ”.

Users can stake their DataPoints into Data Pools to share their data with the Masa Network. By contributing their data, users participate in the data marketplace, enabling data consumers to access aggregated and anonymized data sets. In return, users earn rewards based on the value their data brings to the network πŸ”„.

πŸŽ‰ Conclusion

The Masa Data Marketplace introduces a novel approach to data sharing and monetization in the crypto space πŸš€. By representing user data as non-transferable tokens and allowing users to stake these tokens in Data Pools, the platform creates a secure, transparent, and user-centric data economy 🌍. The Masa Data Marketplace empowers users to take control of their data and earn rewards for their contributions to the network 🌟.