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
SD59x18andUD60x18types
# Clone the repository
git clone git@github.com:aniemerg/distribution-markets.git
cd distribution-markets
# Install dependencies
forge installTo compile:
forge buildTo run tests:
forge testFor verbose test output:
forge test -vvContributions 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