Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@masa-finance/masa-contracts-marketplace

Package Overview
Dependencies
Maintainers
5
Versions
31
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@masa-finance/masa-contracts-marketplace

## 📌 Introduction

  • 2.1.16
  • npm
  • Socket score

Version published
Weekly downloads
32
increased by23.08%
Maintainers
5
Weekly downloads
 
Created
Source

🌐 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 🌟.

FAQs

Package last updated on 27 Mar 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc