-
Notifications
You must be signed in to change notification settings - Fork 41
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Add some docs and remove TODOs * More documentation * . * update docs to use fuel parameter * Update zrml/combinatorial-tokens/README.md * Update zrml/combinatorial-tokens/README.md * fix comment * add decision market oracle scoreboard to futarchy module doc * update decision market oracle doc to include scoreboard * add fuel parameter doc to complexity of deploy combinatorial pool * correct the futarchy module documentation to use root origin for proposal --------- Co-authored-by: Chralt98 <chralt98@gmail.com> Co-authored-by: Chralt <chralt.developer@gmail.com>
- Loading branch information
1 parent
d70e33a
commit 57e9348
Showing
12 changed files
with
283 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,38 @@ | ||
# Combo Module | ||
# Combinatorial Tokens Module | ||
|
||
The Combo module implements combinatorial tokens in substrate. | ||
The combinatorial-tokens module implements modern Zeitgeist's method of | ||
creating and destroying outcome tokens. | ||
|
||
## Overview | ||
|
||
In a categorical or scalar prediction market, one unit of a complete set (i.e. one unit of each outcome token of the market) always redeems for one unit of collateral. | ||
|
||
In a Yes/No market, for instance, holding `x` units of Yes and `x` units of No means that, when the market resolves, you will always receive `x` units of collateral. In a scalar market, on the other hand, `x` units of Long and `x` units of Short will always redeem to a total of `x` units of collateral, as well. | ||
|
||
This means that buying and selling collateral for complete sets should be allowed. For example, `x` units of collateral should fetch `x` units of complete set, and vice versa. Buying complete sets can be thought of as splitting collateral into outcome tokens, while selling complete sets can be thought of as merging outcome tokens back into collateral. | ||
|
||
The combinatorial-tokens module generalizes this approach to not only allow splitting and merging into collateral, but also splitting and merging into outcome tokens of multiple different markets. This allows us to create outcome tokens that combine multiple events. They are called _combinatorial tokens_. | ||
|
||
For example, splitting an `A` token from one categorical market using another categorical market with two outcomes `X` and `Y` yields `A & X` and `A & Y` tokens. They represent the event that `A` and `X` (resp. `Y`) occur. Splitting a Yes token from a binary market using a scalar market will give `Yes & Long` and `Yes & Short` tokens. They represent Long/Short tokens contingent on `Yes` occurring. | ||
|
||
In addition to splitting and merging, combinatorial tokens can be redeemed if one of the markets involved in creating them has been resolved. For example, if the `XY` market above resolves to `X`, then every unit of `X & A` redeems for a unit of `A` and `Y & A` is worthless. If the scalar market above resolves so that `Long` is valued at `.4` and `Short` at `.6`, then every unit of `Yes & Long` redeems for `.4` units of `Yes` and every unit of `Yes & Short` redeems for `.6`. | ||
|
||
An important distinction which we've so far neglected to make is the distinction between an abstract _collection_ like `X & A` or `Yes & Short` and a concrete _position_, which is a collection together with a collateral token against which it is valued. Collections are purely abstract and used in the implementation. Positions are actual tokens on the chain. | ||
|
||
Collections and positions are identified using their IDs. When using the standard combinatorial ID Manager, this ID is a 256 bit value. The position ID of a certain token can be calculated using the collection ID and the collateral. | ||
|
||
### Terminology | ||
|
||
- _Combinatorial token_: Any instance of `zeitgeist_primitives::Asset::CombinatorialToken`. | ||
- _Complete set (of a prediction market)_: An abstract set containing every outcome of a particular prediction market. One unit of a complete set is one unit of each outcome token from the market in question. After the market resolves, a complete set always redeems for exactly one unit of collateral. | ||
- _Merge_: The process of exchanging multiple tokens for a single token of equal value. | ||
- _Split_: The process of exchanging a token for more complicated tokens of equal value. | ||
|
||
### Combinatorial ID Manager | ||
|
||
Calculating | ||
|
||
alt_bn128 | ||
|
||
combinatorial tokens, as [defined by | ||
Gnosis](https://docs.gnosis.io/conditionaltokens/) in Substrate. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,46 @@ | ||
# Futarchy Module | ||
|
||
The futarchy module provides a straightforward, "no bells and whistles" | ||
implementation of the | ||
[futarchy governance system](https://docs.zeitgeist.pm/docs/learn/futarchy). | ||
|
||
## Overview | ||
|
||
The futarchy module is essentially an oracle based governance system: When a | ||
proposal is submitted, an oracle is specified which evaluates whether the | ||
proposal should be executed. The type of the oracle is configured using the | ||
associated type `Oracle`, which must implement `FutarchyOracle`. | ||
|
||
The typical oracle implementation for futarchy is the `DecisionMarketOracle` | ||
implementation exposed by the neo-swaps module, which allows making decisions | ||
based on prices in prediction markets. A `DecisionMarketOracle` is defined by | ||
providing a pool ID and two outcomes, the _positive_ and _negative_ outcome. The | ||
oracle evaluates positively (meaning that it will allow the proposal to pass) if | ||
and only if the positive outcome is more valuable than the negative outcome over | ||
a period of time for a certain absolute and relative threshold determined by a | ||
`DecisionMarketOracleScoreboard`. | ||
|
||
The standard governance flow is the following: | ||
|
||
- The root origin submits a proposal to be approved or rejected via futarchy by | ||
running a governance proposal through | ||
[pallet-democracy](https://github.com/paritytech/polkadot-sdk/tree/master/substrate/frame/democracy) | ||
and calling into this pallet's sole extrinsic `submit_proposal`. Assuming that | ||
the thesis of futarchy is correct and the market used to evaluate the proposal | ||
is well-configured and sufficiently liquid, submitting a proposal to futarchy | ||
rather than pallet-democracy gives a stronger guarantee on the efficacy of the | ||
proposal. | ||
- Wait until the `duration` specified in `submit_proposal` has passed. The | ||
oracle will be automatically evaluated and will either schedule | ||
`proposal.call` at `proposal.when` where `proposal` is the proposal specified | ||
in `submit_proposal`. | ||
|
||
### Terminology | ||
|
||
- _Call_: Refers to an on-chain extrinsic call. | ||
- _Oracle_: A means of making a decision about a proposal. At any block, an | ||
oracle evaluates to `true` (proposal is accepted) or `false` (proposal is | ||
rejected). | ||
- _Proposal_: Consists of a call, an oracle and a time of execution. If and only | ||
if the proposal is accepted, the call is scheduled for the specified time of | ||
execution. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.