Overview of Smart Contracts
Subscriptions
Subscriptions.sol
This contract allows the users to subscribe to Santiment prediction providers - this is implemented in a form of “shares”. One purchased share gives access to all subject's predictions. The main functions are:
- Shares management. The contract provide functions to sell or buy shares.
- Price management. It allows to get sell or buy prices for the share objects, taking into account the fees deduction.
- Fee management. It implements a fee system where a protocol fee and a subject fee are deducted from the transaction amounts. The contract also keeps track of the shares balance and supply for each subject. It allows the user to withdraw collected fees.
Signals and Predictions
Prices.sol
This contract handles price-related information, which could be for assets, commodities, or other market instruments. Its primary functions include:
- Price Storage: It includes methods to set and store the current prices of certain assets.
- Price Retrieval: Users or other contracts can fetch the stored price data, which may be updated periodically.
- Price Change: There is a logic to change already stored prices.
Signals.sol
This contract is focused on managing signals, which represent market indicators or other forms of analysis. It provides functionalities such as:
- Signal Storage: Users can submit signals, which the contract stores. Signals may represent different kinds of indicators used for trading or analysis.
- Signal Retrieval: The contract allows retrieval of the stored signals for analysis or use in other smart contracts.
- Signal Validation: There is some mechanism for validating signals before storing them, ensuring that they meet certain criteria.
Predictions.sol
This smart contract manages predictions, related to market or event outcomes. The code provides functionality for:
- Storing Predictions: Users can submit their predictions, which are stored on the blockchain. This is handled through a function that takes the prediction details as parameters.
- Retrieving Predictions: The contract includes a method for fetching stored predictions.
- Validation Mechanism: There is a logic that checks the prediction data based on the data source (for example, by oracles etc).
- Predictions Management. Those functions allows to change the prediction after its creation, to open or cancel the prediction and also add it to the competition.
Competitions
These contracts work together to organize competitions, manage predictions, and distribute rewards based on performance metrics.
Competitions.sol
This contract manages the lifecycle of competitions and participants.
- Data Tracking: Tracks prediction data and performance metrics for competitors.
- Predictions Management: Contains logic for closing predictions and keeping track of winners. Key structures include
Competitor(for holding prediction data and performance) andWinner(for storing winner information). - Balance Management: Holds the balance and count of competitions and interacts with an ERC20 SAN token.
Rewarding.sol
It extends the functionality of the Competitions contract to facilitate winner determination and reward distribution in a structured and orderly way, using various performance metrics.
- Retrieving Winners: Structures are defined to track attempts to find different types of winners (based on average or sum of performance in descending or ascending order).
- Winners Management: Functions are provided to find and sort winners according to different criteria and manage distribution of rewards.