Prediction platform for future events built on Mina using SnarkyJS
When we learned that Mina will be a sponsor, the first thought we had was: "Wow, chain without DeFi! We had to bring one here", but then inspiration changed to the common sense and all these stories about TornadoCash, Zk money and other unlucky projects come to mind.
So, after some considerations, our final idea is somewhere in-between our lovely decentralized finance and... games. We tried to create the platform where users could make bets on any future event (sports, election results, price movements etc) and all of this privately hiding the tendencies until reveal.
The project is written in TypeScript using SnarkyJS, tests are written using jest framework. It consists of 3 zkApps: BettingEvent, Token and Oracle.The project is written in TypeScript using SnarkyJS, tests are written using jest framework. It consists of 3 zkApps: BettingEvent, Token and Oracle.
BettingEvent is the main contract that represents the Event on which users make predictions whether it will happen or it will not. The user selects the side (will happen/will not), size of their bet and executes bet. The bets are accepted until some time called start. There is a specific time after which event status can be revealed. Reveal can be called by anyone.
Oracle is the contract responsible for processing the results of event from some trusted party.
Once results are known, winners can claim their rewards. The reward comes from the assets lost by other participants.
The contracts were deployed to Mina testnet: { EVENT_CONTRACT: 'B62qr5tZ18UMMwecc9YqBDPvGDoGhHSiJXSe2d3HBVLUBrwh8ofeN4j', BET_FOR_TOKEN: 'B62qrJQQqKHmpPVKCvLNvuZsKyzL1XaVFCxcNjRkGHdCYh3jTo83fFv', BET_AGAINST_TOKEN: 'B62qk2VcTSdB6v67C86SvmfQnb2YqFRHxrp3Qutc2JEzZh9DvVAVBtt', ORACLE_KEY: 'B62qmjEG2MVBNAfHPw9Z1rpxXaCSwnE94kVqfXX3SiudWQXpbeXE9Ai' }