Gnosis Prediction Market Platform And Crowdfunding Contract Source Code

This is not advise as to whether the Gnosis prediction market platform is a good investment or not. This is just a quick look at the source code behind what Gnosis is offering.

Reference Gnosis contracts published – bug bounty program will start soon.

This is the longest set of Solidity source code I’ve seen so far – 4,779 lines of code and comments.

See for the original contents, and for the code to interact with these contract.

Website –


Table of contents

The source code below is from at Nov 03 2016 14:14:32 UTC.





A placeholder contract for a future DAO governance contract. Offers interfaces to calculate fees for trades based on sender and token count. Can be upgraded by a wallet contract controlled by Gnosis founders.


Implements the Dutch auction used by Gnosis for the token launch. Accepts bids using bid function until funding goal or stop price is reached. After the auction is completed, every successful bidder can claim his tokens using the claimTokens function.


Gnosis token (GNO) contract. At deployment all tokens are assigned to the auction contract. Auction contract transfers tokens to bidders according to their bid and final token price. Tokens can be traded after the auction is over and one week passed.

Event Factory



Allows creation of new events used to resolve markets. Events can resolve to a number in a range (ranged event) or an outcome out of a list of outcomes. An example for a ranged event is the Apple stock price on date X. An example for a non-ranged event would be the winner of the World Cup on date X. For every outcome, an outcome token is created. Ranged events are represented with two outcome tokens for long and short positions. Non-ranged events have an outcome token for every defined outcome. Every event defines an oracle contract to resolve the event and a token contract denominating the currency used in markets using this event. The event factory contract allows to buy and sell all outcomes for 1 unit of the currency of the event. Winnings can be redeemed after the event has been resolved using the defined oracle.


Outcome tokens are created for every outcome of an event. Only the event factory contract is allowed to issue and revoke outcome tokens using buy and sell all outcome functions.


Implements basic token functionality like transfer and transferFrom. The library is used to reduce the deployment gas costs of outcome tokens.

Market Crowdfunding


Allows crowdfunding of automated market makers and distributes collected fees among investors.

Market Factories



Allows to create markets and trade outcome tokens on markets with a market maker. A market is always associated to an event and has to be funded in the event’s denomination. A market maker contract like the LMSR market maker has to be defined to allow trading. A fee charged for every trade on a market can be defined to return the investment used to fund the market maker.


Inherits functionality from DefaultMarketFactory and adds functionality required for the HunchGame Gnosis App (high-score etc.).

Market Makers



Calculates prices for event outcome tokens based on demand using a logarithmic market scoring rule. Implementing Robin Hanson’s designed LMSR market maker.