Private Prediction Market for Starknet
A and B can enter into a bet by staking some token(ERC20-compliant) – lets say they bet on the price of ETH after 1 month, so we setup a callback with an oracle asking it to give the results to the protocol after the stipulated time, and whoever wins gets to keep the full staked amount – this can then be extended to arbitrary number of participants – we can also create an NFT to represent the position in the bet for a participant which can then be traded on any permissionless NFT market (thereby securitizing predictions/opinions ?) – we could also deposit the staked amounts into some kind of yield bearing protocol, and the interest earned can be the reward for the winner and the staked amounts could be returned to the participants thereby creating a kind of lossless prediction market.
The oracle is currently spoofed – we just provide the contract address (the address of the protocool – prediction_market) and the function selector which should be manually triggered to complete the bet. Further, the bet/prediction can be about anything as long as the data can be provided by the oracle.
The protocol(prediction_market), a test ERC-20 token and an oracle are deployed on the goerli testnet. The relevant addresses can be found in the goerli.deployments.txt file.
Important functions in the prediction_market contract
- start_bet function needs the following arguments to initiate a bet
- Position (0/1) 0 means you are betting that price will go down and 1 means price will go up
- Predicted Price Point (the price point around which the prediction is being made)
- Staked amount
- ERC-20 token address which you want to stake (the requirement for this argument will be removed later)