
Foresight Finance
A mystical prediction market that lets you bet on outcomes with homomorphic encryption for outcomes(feels like magic).
About
The problem it solves This protocol enables for users to create their own prediction markets for any event through the power of a specialised AMM powered by Uniswap V4. This new kind of AMM called a PM-AMM makes it safer for liquidity providers to provider liquidity to outcome token markets, which are typically very dangerous. This makes it easier for people to create prediction markets for things that they are interested in. The other part of the platform enables for people to create an optimsitc oracle easily through our settlement process. Through Homomoprhic encryption we are able to keep all of the votes from a user secret and anonomys while using ZKProofs to ensure the validity. User Interaction and Data Flow Someone would first interact with our protocol by obtaining USDC, which is used to bootstrap the liquidity of the market. Then they would simply type in a natural Yes/No question for the prediction market. Then, the protocol enters its key phase, where operators are able to add their public key to the smart contract for this particular market. Once, the key phase has ended due to its epxiry, then users will be able to vote on the outcome of an event by encrypting their vote and then sending it to an AVS operator. This completely streamlines the voting process for users, which makes it much simpler than UMA. Then in the third phase, the operators that added theri key, now add a partial decryption of the total product. At this point, the market is essentially closed as no more votes can come in. Finally, the last step is where the user requests a decryiption of the final vote, which the operator then commits on chain. While this decryption is available to everyone, we use the operator as a way to make the experience easier for the user. The project architecture and development process The solution involves three different components: A prediction market AMM using Uniswap, an AVS using Othentic for verifying random numbers, and a front end for facilitating the encryption of the data for the user. One of the benefits of this product is that its core functionality is not limited to prediction markets, as the arbitration mechanism could be extended to other services such as bridging or insurance which can use an optimistic oracle. The Pm-AMM was build based on a paper released by paradigm, to this date there have been no existing solidity/python implementations of this AMM. An important detail regarding this AMM design is that it utilied a cumulative distrivution function and a probability density function to help determine the optimal liquidity levels. The AVS contained an executor node which would look at the encrypted user submission and the existing solution, and multiply them together and then provide a ZK proof showing that what they did was correct. Product Integrations The two sponsors that were used for the protocol were Uniswap and Eigenlayer. Uniswap V4 Hooks were used to create a custom curve to allow for the new PM-AMM invariant. This aspect was espcailly important because they enabled us to use a standard interface for swapping while also serving prediction markets better. Additionally, the project was deployed on Unichain, where the advantages are the speed and the liquidity on that chain which would be useful in funding more prediction markets. Eigenlayer and Othentic were used in the product for the execution and verification of multiplicative homomorphic encryption which powered the secret democratic voting process. These technologies were critical for the platforms ease of use, which will help drive more users. Key differentiators and uniqueness of the project This project is unique in two important ways. First, compared to other prediction markets, this one utilizes an AMM which was created specifically for the probabilistic nature of prediction markets which means that liquidity providers will be better served to place their LP on our platform than others. The other aspect of the protocol that makes it unique is the usage of homomorphic encryption and an optimistic oracle. By allowing for a democratic optimistic oracle, the capabilities of the oracle are increased, Furthermore, its often cited that a democratic optimistic oracle is dangerous because it needs many people to use it, which is why this platform was built with user friendly-ness in mind through the homomorphic encryption. Trade-offs and shortcuts while building In the paper regarding the PM-AMM, there were two inital models shown: a static pm-amm and a dynamic pm-amm which incoporated a time decay aspect. In this porject I was able to only get the static- pm-amm invariant to consistently work. Another area for future improvement would be to build an additional ZK proof for the user's envryption to confirm the amount of tokens that they own and that their vote is valid. Additional Features The entire project was built during the buildathon.