The Future of Wagering: AMMs in Smart Contract Betting
Automated Market Makers (AMMs) address a complex accounting challenge in an innovative manner. To grasp how AMMs work, it’s crucial to first understand the problem they solve.
Traditional Order Book Model
In traditional financial systems, whether for stock prices or currency exchanges, an order book is used to track exchange rates. An order book lists the quantities buyers want and the prices they’re willing to pay, alongside the quantities sellers are offering and their asking prices. When a match occurs, a trade is executed, and a new spot price for the asset is established.
This system works well in centralized exchanges where maintaining an order book in a database is cost-effective. However, in decentralized systems using smart contracts, each order incurs significant storage costs. Managing hundreds of thousands of orders, many of which may be irrelevant due to their distance from the current spot price, can become prohibitively expensive.
The Alternative Approach
Observing that prices should rise when an asset is bought and fall when it’s sold suggests a different approach that avoids the need for extensive data storage. Enter Automated Market Makers (AMMs).
The Water Dispenser Analogy
Imagine a unique water dispenser:
- Dual Functionality: This dispenser allows you to either get water by paying with money or sell water back to get money. Anyone can be a consumer or a supplier.
- Dynamic Pricing: The price of water changes based on the dispenser’s stock. As the stock decreases, the price increases, indicating higher demand. Conversely, as more people supply water, the price decreases, reflecting lower demand.
For simplicity, assume the rate of water consumption matches its replenishment.
Mathematical Foundation: Bonded Curve
The price mechanism of the water dispenser can be represented by a simple formula:(amount of water)×(amount of cash)=a constant(amount of water)×(amount of cash)=a constant
Let’s say the dispenser starts with 1000 liters of water and 10 dollars, giving us: 1000×10=10,0001000×10=10,000
If you withdraw 10 liters of water, the new balance must satisfy: 990×(cash in the dispenser)=10,000990×(cash in the dispenser)=10,000
So, the cash remaining in the dispenser would be: 10,000÷990≈10.10110,000÷990≈10.101
Hence, you pay about 10 cents for 10 liters of water.
As more water is dispensed, the price dynamically adjusts. For example, after 500 liters are dispensed, the dispenser contains: 500×(cash in the dispenser)=10,000500×(cash in the dispenser)=10,000
Thus, the new price for 10 liters would be over 40 cents, showing a fourfold increase.
Arbitrage and Market Balance
Arbitrage seekers help maintain the balance by exploiting price differences between the dispenser and other markets, driving the AMM exchange rate toward the market rate naturally.
Comparison with Bookmaking
Similar to AMMs, bookmakers set odds based on the volume of bets rather than purely on objective analysis. The odds adjust as more bets are placed, ensuring the bookmaker’s profits are balanced, akin to maintaining an order book.
Synthesis: AMMs and Betting
A decentralized exchange (DEX) using AMMs can be seen as placing a bet. Exchanging one token for another is a gamble on their relative future values. This concept extends to decentralized betting using AMMs.
Conditional Tokens in Betting
In betting, conditional tokens represent possible outcomes. For instance, in a match between two teams, tokens for each team’s victory can be issued. Only the winning team’s tokens hold value post-event.
Betting Mechanics with AMMs
Placing a bet involves:
- Becoming a liquidity provider.
- Converting liquidity into conditional tokens representing your chosen outcome.
- Exchanging non-chosen outcome tokens for chosen outcome tokens.
For example, starting with $100 in stablecoins and equal tokens for two teams, the AMM adjusts odds as bets are placed. The odds shift, reflecting market sentiment, similar to traditional bookmakers.
Slippage and Impermanent Loss
Large bets can cause slippage, where the odds worsen for subsequent portions of the same bet. Additionally, initial liquidity providers may face impermanent losses, akin to counter-bets against winning outcomes, highlighting the importance of initial odds being close to real odds.
Conclusion
AMMs provide a decentralized, dynamic pricing model that adjusts based on supply and demand without extensive data storage. This model is applicable not only in token exchanges but also in decentralized betting, demonstrating the versatile potential of AMMs in various markets.