Smart contracts

Aigang goal is to adopt prediction markets to Insurance space and make them useful for better-balanced insurance products.

Each organized prediction output should help an owner to make the decision based on crowd opinion. These collected opinions should help to shape new insurance products.

How our prediction market contracts will look:

Prediction market Contracts

Entry point to market will be Market Contract which will hold all audit-able information:

- All Predictions list

- All participants wallets in which predictions they participated

- Allow a user to organize predictions

- Allow users to submit prediction forecast

- Prediction resolving function when this prediction solution is available

- Winning prediction output payouts function where users or organizer will distribute rewards.

Prediction entity holds all participants forecasts and addresses to ResultStorage, PrizeCalculator. The prediction will have states:

- Published, all users are allowed to participate

- Resolved, when an answer is stored in ResultStorage and all winners are available to get rewards

- Paused, is set when for some reason prediction forecasts can not continue

- Canceled, the prediction is suspended and participants are allowed to withdraw they forecast amount.

Prediction status flow

PrizeCalculator stores formula how much participant can withdraw when his selected output wins. At first version we use simples prize distribution formula:

Your contributed tokens (_forecastTokens) *

_predictionTotalTokens /

_winOutputTotalTokens = prize

Example:

A prediction has 2 different outcomes (Outcome 1, Outcome 2) and initial 2000 tokens prize:

User A placed 100 tokens on Outcome 1

User B placed 300 tokens on Outcome 1

User C placed 100 tokens on Outcome 2

Total contributed tokens: 2500

After the prediction resolves, the Oracle decides the winning outcome is Outcome 1.

Users can now withdraw the following token amount from their forecasts:

User A -> 100 * 2500 / (100 + 300) = 625 Tokens

User B -> 300 * 2500 / (100 + 300) = 1875 Tokens

User C -> 0 tokens

Outside of blockchain each participant will receive Scores which will participate in statistics.

ResultStorage store all predictions resolutions. The contract will be connected with our oracle service which will solve predictions. At this moment 3rd party services like http://www.oraclize.it/ are not stable, have limited support, expensive and execution flow is not traceable. When we allow users to create predictions by themselves this part becomes extremely complex and we think that this functionality is a key feature. Having own oracle service will be much flexible solution and in the future, this solution can act as a proxy to better 3rd party oracles.

Prediction Market smart Contracts: https://github.com/AigangNetwork/aigang-platform-contracts-predictions

More details about prediction markets are described in our WhitePaper: https://aigang.network/whitepaper