Project Name: tpMarket - A Prediction Market on Tron
Project Track: DeFi
Team Name: Multi
Team Member(s): 5, @klappetron, @karilplazik, @kipchoge, @jabba, @fifa_guy
DevPost URL: https://devpost.com/software/tpmarket-prediction-market-on-tron
Video Submission: https://youtu.be/QRVx0lL9wyg
Project Repo/Website:
Website - Mainnet: https://tpmarket.io
Website - Testnet: https://testnet.tpmarket.io
Github: https://github.com/klappe22/pMarket
Project Goal:
After seeing multiple accounts on twitter engaging in making bets against each others, most famously the Algod vs Do Kwon bet regarding Luna and UST https://www.theblock.co/post/137687/terraform-labs-do-kwon-bets-1-million-on-lunas-future-price, we saw that a prediction market for over/under bets is necessary and sought after in the crypto space. With oracles and smart contracts it’s possible to remove the escrow, and automate the whole process from the creation of a bet to the payout of a bet.
Project Info & Details:
why?
As explained in the section above, clearly this seems to be something that the market participants wants. There are endless of reason to why someone would want to use tpMarket, and some examples are:
- You are bullish BTC and is certain that it will be above $30k on January 1st 2023.
- You are bearish a stablecoin and think that it will depeg.
- You wanna go long an asset without buying it
how?
We will now use example 1 from above and show how a bet can go from creation to payout on tpMarket. First, you’ll need to choose some parameters:
- Strike Price: $30 000 (the price BTC needs to hit for you to win)
- Expiry: 2023-01-01 (the end date)
- Position Size: 1000 TRX (what should the payout be?)
- Over Odds: 5.00 which is the same as 20% (your side)
- Under Odds: 1.25 which is the same as 80% (the opponent’s side)
Note: Over Odds + Under Odds = 100% always because we take 0 fees.
Now when this market is created, the Under side will automatically be for sale and in our case,
it will cost 800TRX. Why?
Under Price = Position Size / Under Odds = 1000 / 1.25 = 800 TRX
Someone buys it for 800 TRX which means that you’ll receive 800TRX, making the input for your bet:
Your stake = Position Size - List Price = 1000 - 800 TRX = 200 TRX
And your opponents stake is of course 800 TRX. This table explains what will happen on January 1st:
BTC Price | Winner | Payout |
---|---|---|
$BTC is above $30000 -> |
You | 200 TRX * 5.00 = 1000TRX |
$BTC is below $30000 -> |
Not You | 800 TRX * 1.25 = 1000TRX |
So to summarize, if you win you’ll get 1000TRX and your stake is only 200 TRX, which makes sense since 200 * 5.00 = 1000 and your odds was 5.00!
When 2023 is here and if BTC is above $30k then you just go to https://tpmarket.io/positions and click exercise, and you’ll receive the payout.
Check out https://youtu.be/QRVx0lL9wyg for a video where we go through the above scenario.
This is how easy it is to create a market on tpMarket, and keep in mind in most cases you are not the one creating markets, you just take markets that someone else created. In that case it’s even simpler, you just browse at https://tpmarket.io/trade and buy what you want:
Project Milestones:
-
Keep working on the UI and the general UX of the website
-
Optimize the contracts to consume less energy.
-
Get support for more markets, and they don’t have to be for cryptocurrencies.
-
Make it possible to have whatever token you want as collateral for a position
Deployed Contracts
PredictionMarket.sol:
https://tronscan.org/#/contract/TQe2mJiLd493atDVVoEZTmFYpS8Gx8TCgx/code
https://nile.tronscan.org/#/contract/TD9MPoqzWxx74ADC36kYsUrsnqwnWvwprX/code
Exchange.sol:
https://tronscan.org/#/contract/TJoP1GHbi5Lybe1FiMqWqU6CX6zMDDh4Nc/code
https://nile.tronscan.org/#/contract/TVEZKmK73exA2x7AryDs3D9TXacUvFiTkQ/code
Summary:
tpMarket is a prediction market where users can be both market makers and takers. Currently it supports 3 currencies on testnet (TRX, BTC and JST) and 9 on mainnet (TRX, BTC, JST, ETH, SUN, NFT, BTT, USDT, USDC). If you wanna try it out, keep in mind that the code is not audited so there are probably bugs, and that the contracts are not optimized yet. Also, be sure to watch the submission video at https://youtu.be/QRVx0lL9wyg!