A Solidity implementation for distribution prediction markets, based on "Distribution Markets" by Dave White. Follows the design of Distribution Markets (Python)
Distribution markets extend traditional prediction markets by allowing traders to express beliefs about entire probability distributions rather than just discrete outcomes. This Solidity implementation provides the core mathematical tools for implementing these markets on-chain, with a focus on efficient and precise calculations using fixed-point arithmetic.
The implementation is built on fixed-point mathematics using PRBMath, providing high-precision calculations for Gaussian distributions and their derivatives. Key components include:
DistributionMath.sol
: Core mathematical library implementing the fundamental calculations needed for distribution markets- Fixed-point arithmetic handling using
SD59x18
andUD60x18
types
# Clone the repository
git clone [email protected]:aniemerg/distribution-markets.git
cd distribution-markets
# Install dependencies
forge install
To compile:
forge build
To run tests:
forge test
For verbose test output:
forge test -vv
Contributions via pull request are welcome! Please ensure:
- All tests pass
- New features include comprehensive tests
- Gas optimization is considered
- Fixed-point arithmetic is handled correctly
- Comments explain complex mathematical operations