AlphaDex is a decentralized derivative market and liquidity aggregator. You are looking at its first function, which is similar to a binary option market settled by smart contracts.
The usage of AlphaDex is simple:
- Stake near the end of a round.
- At that moment, be a 🐂BULL if you think the price will go up in the next 2 rounds.
- At that moment, be a 🐻BEAR if you think the price will go down in the next 2 rounds.
- Stake the amount you are willing to risk. There is no need to consider the amount of stakes on both sides.
There are more details in AlphaDex, including "TWAP" and "x+2 vs x+1" stuffs. They are to make sure the process is fair and prevent hackers. You can safely ignore them.
But if you are interested in the details, then this explanation is for you.
- If you stake in round x, you are speculating on the TWAP of round x+2 vs the TWAP of round x+1. (TWAP means time-weighted average price).
- The delay is to prevent price manipulations and flash loan attacks.
- If you stake in round x, you can call [Payoff] after round x+2 ends (that is, after round x+3 begins). There'll be [Payoff] buttons in the table besides your stakes.
For example, assume current round is 09:20 ~ 09:30. In this round, you put your stakes on the difference of:
1. the TWAP between [the last trade before 09:30] and [the last trade before 09:40].
2. the TWAP between [the last trade before 09:40] and [the last trade before 09:50].
If you think 2 > 1, you are 🐂bullish. If you think 1 > 2, you are 🐻bearish. If 1 = 2, then everyone gets their stakes back.
From the chart, we can see this is similar to [price at 9:50] compared with [price at 9:30]. Please read this essay
and this essay
to understand why.
AlphaDex introduces the concept of paired stakes
, to limit the risk exposure when there is bull-bear imbalance in stakes.
- If there are 100 🐂bullish stakes and 10 🐻bearish stakes, then the amount of paired stakes is 10. So the bulls are only risking 10 stakes.
- In this case, if 🐂bulls win, 🐂bulls receive 1.1 stakes per stake (note 100 * 1.1 = 110 = 100 + 10).
- In this case, if 🐂bears win, 🐂bulls can still receive 0.9 stake per stake, while 🐻bears receive 2 stakes per stake (note 100 * 0.9 + 10 * 2 = 110 = 100 + 10).
- Hence one can feel free to put lots of stakes near the end of a round, without worrying about them taken by tiny stakes on the opposite side.
- The contract stores uniswap TWAP only when [Sync contract] is called. This only need to happen once at the end of each round.
- If you are winning, you'd like to call [Sync contract] to fix the price.
- In the future KittenSwap there's no need to manually sync. There are many more functions in AlphaDex, and KittenSwap will provide the best supports for them.
On Contract Safety:
- There are two methods to stake in AlphaDex: (1) MetaMask ==[Stake]=> AlphaDex ==[Payoff]=> MetaMask. (2) Vault ==[Stake]=> AlphaDex ==[Payoff]=> Vault.
- The stake-from-vault method saves gas, because the staked tokens stay in the contract (vault) until you withdraw them, however it will also be more risky if the contract has bug (very unlikely, but still possible).
- The stake-from-metamask method is safe. Even if the contract has bug, the most you can lose are your stakes in a round.