Cover photo

Index+Prediction=(Liveraged Hedge)

See also:


The prediction mechanism allows users to vote on whether the future price of the index will be reached or not. In the current implementation, it is possible to organize a vote on the future value of the index (built on the basis of a smart wallet). The index owner can thus hedge against the risk of a decline in the index’s value by accumulating voting fees.

On the index page, the owner can launch a prediction and a poll about it. Just click the "Create prediction" button.

post image
Create prediction
  • specify the asset on which bets are being accepted and the amount (value) of the bets.

  • target value of the index’s future price in USD.

  • expiration date by which bets are accepted and after which the results can be tallied.

post image

Before signing a transaction, the application checks the list of assets in the index to see if they have quotes in the Chainlink price oracle. If the oracle does not have a quote for a particular asset, the user will not be able to create a prediction.

Once the transaction is signed, users can begin voting.

On the index page, a voting user sees the index owner’s prediction for the future price of the index:

  • true (the price will be the same as the predicted value or higher) or

  • false.

The user must click one of these two buttons.

post image
Vote for prediction

During the first voting attempt, the user signs two transactions in their wallet:

  • an approval transaction for the Uniswap Permit2 contract

  • the voting transaction itself.

When participating in predictions in the future, instead of the first approval transaction, the user will create a signature (an off-chain action) that will be used in the voting transaction. This signature is validated by the Permit2 Uniswap smart contract

https://github.com/Uniswap/permit2

Permit2 Uniswap is used to avoid paying for the approval transaction. The signature instead of the transaction does not require a gas fee.

Once the transaction is signed, the stake will be transferred to the voting contract address. The user will receive ERC-6909 tokens as proof of participation in the prediction.

Subscribe

After voting, the user will see information on the index page in the predictions section about their bet, the outcome they selected, and overall prediction statistics (how many “Yes” and “No” votes), as well as the expiration date.

post image
Index prediction stats

In the current version of the prediction feature, you can create or participate in a prediction only once; bets cannot be changed. Only the owner of an index can create a prediction for that index.

  • Bets are stored on the voting contract.

  • The losing bets are distributed equally among the winners

  • The bet amount is the same for everyone

Once voting on the prediction has ended, the index owner or participants can trigger a snapshot of the index’s current value. The owner does this via the resolve function, while voting participants do so by claiming their rewards (if they were correct prediction).

The first person to send a transaction to the network will trigger the prediction’s resolve process, which will query the Chainlink price oracle and lock in the current price of the index assets onchain. With each claim, the predicted index price will be compared to the actual price (locked in the blockchain). If the user correctly predicted the outcome, they receive a reward and get their stake back. If they did not, they will simply see a message in the app stating that their choice was incorrect. In this case, the user receives nothing and does not sign any transactions.

post image
Win prediction

Users who correctly predict the outcome receive their rewards minus:

  • the protocol fee (currently not set)

  • the 1% fee charged by the index owner who created the prediction.

You can claim a reward (the total amount of all bets on the outcome that did not occur, divided among all correct participants) and get a refund only once per prediction.

If all participants voted for the same outcome within a prediction, the vote is considered invalid. Users can then get their stake back by calling the claim transaction.

The owner of an index who launches a prediction can share a link to the poll page on their social media accounts or in their articles. Each index has its own unique URL.