From 722ed1fb27fda6c2c6ad1fcd3274b890ad64ee16 Mon Sep 17 00:00:00 2001 From: Uxio Fuentefria Date: Thu, 5 Apr 2018 13:23:48 +0200 Subject: [PATCH] Document for https://readthedocs.io - Update script for document generation - Add readthedocs sphinx python config - Convert markdown to rst (tables cannot be rendered as markdown) - Generate rst files --- README.md | 4 +- docs/Campaign.md | 119 ---- docs/CampaignFactory.md | 45 -- docs/CategoricalEvent.md | 161 ----- docs/CentralizedOracle.md | 89 --- docs/CentralizedOracleFactory.md | 40 -- docs/DifficultyOracle.md | 62 -- docs/DifficultyOracleFactory.md | 40 -- docs/EtherToken.md | 183 ------ docs/Event.md | 161 ----- docs/EventFactory.md | 76 --- docs/FutarchyOracle.md | 98 ---- docs/FutarchyOracleFactory.md | 48 -- docs/HumanFriendlyToken.md | 127 ---- docs/LMSRMarketMaker.md | 77 --- docs/MajorityOracle.md | 60 -- docs/MajorityOracleFactory.md | 40 -- docs/Market.md | 164 ------ docs/MarketMaker.md | 70 --- docs/Math.md | 351 ----------- docs/Oracle.md | 14 - docs/OutcomeToken.md | 189 ------ docs/ScalarEvent.md | 166 ------ docs/SignedMessageOracle.md | 96 --- docs/SignedMessageOracleFactory.md | 43 -- docs/StandardMarket.md | 180 ------ docs/StandardMarketFactory.md | 42 -- docs/StandardMarketWithPriceLogger.md | 197 ------- docs/StandardMarketWithPriceLoggerFactory.md | 43 -- docs/StandardToken.md | 143 ----- docs/Token.md | 124 ---- docs/UltimateOracle.md | 173 ------ docs/UltimateOracleFactory.md | 45 -- docs/_config.yml | 1 - docs/requirements.txt | 4 + docs/source/.gitignore | 1 + docs/source/Campaign.rst | 165 ++++++ docs/source/CampaignFactory.rst | 74 +++ docs/source/CategoricalEvent.rst | 235 ++++++++ docs/source/CentralizedOracle.rst | 127 ++++ docs/source/CentralizedOracleFactory.rst | 60 ++ docs/source/DifficultyOracle.rst | 85 +++ docs/source/DifficultyOracleFactory.rst | 60 ++ docs/source/EtherToken.rst | 280 +++++++++ docs/source/Event.rst | 235 ++++++++ docs/source/EventFactory.rst | 133 +++++ docs/source/FutarchyOracle.rst | 138 +++++ docs/source/FutarchyOracleFactory.rst | 97 +++ docs/source/HumanFriendlyToken.rst | 204 +++++++ docs/source/LMSRMarketMaker.rst | 123 ++++ docs/source/MajorityOracle.rst | 83 +++ docs/source/MajorityOracleFactory.rst | 60 ++ docs/source/Makefile | 20 + docs/source/Market.rst | 261 +++++++++ docs/source/MarketMaker.rst | 114 ++++ docs/source/Math.rst | 554 ++++++++++++++++++ docs/source/Oracle.rst | 18 + docs/source/OutcomeToken.rst | 295 ++++++++++ docs/source/ScalarEvent.rst | 241 ++++++++ docs/source/SignedMessageOracle.rst | 143 +++++ docs/source/SignedMessageOracleFactory.rst | 67 +++ docs/source/StandardMarket.rst | 300 ++++++++++ docs/source/StandardMarketFactory.rst | 64 ++ docs/source/StandardMarketWithPriceLogger.rst | 323 ++++++++++ .../StandardMarketWithPriceLoggerFactory.rst | 68 +++ docs/source/StandardToken.rst | 226 +++++++ docs/source/Token.rst | 201 +++++++ docs/source/UltimateOracle.rst | 245 ++++++++ docs/source/UltimateOracleFactory.rst | 87 +++ docs/source/conf.py | 160 +++++ docs/source/index.rst | 131 +++++ docs/source/make.bat | 36 ++ scripts/makedocs.sh | 14 +- 73 files changed, 5731 insertions(+), 3472 deletions(-) delete mode 100644 docs/Campaign.md delete mode 100644 docs/CampaignFactory.md delete mode 100644 docs/CategoricalEvent.md delete mode 100644 docs/CentralizedOracle.md delete mode 100644 docs/CentralizedOracleFactory.md delete mode 100644 docs/DifficultyOracle.md delete mode 100644 docs/DifficultyOracleFactory.md delete mode 100644 docs/EtherToken.md delete mode 100644 docs/Event.md delete mode 100644 docs/EventFactory.md delete mode 100644 docs/FutarchyOracle.md delete mode 100644 docs/FutarchyOracleFactory.md delete mode 100644 docs/HumanFriendlyToken.md delete mode 100644 docs/LMSRMarketMaker.md delete mode 100644 docs/MajorityOracle.md delete mode 100644 docs/MajorityOracleFactory.md delete mode 100644 docs/Market.md delete mode 100644 docs/MarketMaker.md delete mode 100644 docs/Math.md delete mode 100644 docs/Oracle.md delete mode 100644 docs/OutcomeToken.md delete mode 100644 docs/ScalarEvent.md delete mode 100644 docs/SignedMessageOracle.md delete mode 100644 docs/SignedMessageOracleFactory.md delete mode 100644 docs/StandardMarket.md delete mode 100644 docs/StandardMarketFactory.md delete mode 100644 docs/StandardMarketWithPriceLogger.md delete mode 100644 docs/StandardMarketWithPriceLoggerFactory.md delete mode 100644 docs/StandardToken.md delete mode 100644 docs/Token.md delete mode 100644 docs/UltimateOracle.md delete mode 100644 docs/UltimateOracleFactory.md delete mode 100644 docs/_config.yml create mode 100644 docs/requirements.txt create mode 100644 docs/source/.gitignore create mode 100644 docs/source/Campaign.rst create mode 100644 docs/source/CampaignFactory.rst create mode 100644 docs/source/CategoricalEvent.rst create mode 100644 docs/source/CentralizedOracle.rst create mode 100644 docs/source/CentralizedOracleFactory.rst create mode 100644 docs/source/DifficultyOracle.rst create mode 100644 docs/source/DifficultyOracleFactory.rst create mode 100644 docs/source/EtherToken.rst create mode 100644 docs/source/Event.rst create mode 100644 docs/source/EventFactory.rst create mode 100644 docs/source/FutarchyOracle.rst create mode 100644 docs/source/FutarchyOracleFactory.rst create mode 100644 docs/source/HumanFriendlyToken.rst create mode 100644 docs/source/LMSRMarketMaker.rst create mode 100644 docs/source/MajorityOracle.rst create mode 100644 docs/source/MajorityOracleFactory.rst create mode 100644 docs/source/Makefile create mode 100644 docs/source/Market.rst create mode 100644 docs/source/MarketMaker.rst create mode 100644 docs/source/Math.rst create mode 100644 docs/source/Oracle.rst create mode 100644 docs/source/OutcomeToken.rst create mode 100644 docs/source/ScalarEvent.rst create mode 100644 docs/source/SignedMessageOracle.rst create mode 100644 docs/source/SignedMessageOracleFactory.rst create mode 100644 docs/source/StandardMarket.rst create mode 100644 docs/source/StandardMarketFactory.rst create mode 100644 docs/source/StandardMarketWithPriceLogger.rst create mode 100644 docs/source/StandardMarketWithPriceLoggerFactory.rst create mode 100644 docs/source/StandardToken.rst create mode 100644 docs/source/Token.rst create mode 100644 docs/source/UltimateOracle.rst create mode 100644 docs/source/UltimateOracleFactory.rst create mode 100644 docs/source/conf.py create mode 100644 docs/source/index.rst create mode 100644 docs/source/make.bat diff --git a/README.md b/README.md index 39377d0..cabc3cf 100644 --- a/README.md +++ b/README.md @@ -105,7 +105,9 @@ Documentation There is a copy version hosted online at https://gnosis.github.io/gnosis-contracts/ -### Build docs with doxity +### Build docs for readthedocs + +Requires [pango](http://www.pango.org/) installed: ```bash scripts/makedocs.sh diff --git a/docs/Campaign.md b/docs/Campaign.md deleted file mode 100644 index 5db3b66..0000000 --- a/docs/Campaign.md +++ /dev/null @@ -1,119 +0,0 @@ -* [Campaign](#campaign) - * [Accessors](#campaign-accessors) - * [Events](#campaign-events) - * [CampaignFunding(*address* indexed `sender`, *uint256* `funding`)](#campaignfundingaddress-indexed-sender-uint256-funding) - * [CampaignRefund(*address* indexed `sender`, *uint256* `refund`)](#campaignrefundaddress-indexed-sender-uint256-refund) - * [MarketCreation(*address* indexed `market`)](#marketcreationaddress-indexed-market) - * [MarketClosing()](#marketclosing) - * [FeeWithdrawal(*address* indexed `receiver`, *uint256* `fees`)](#feewithdrawaladdress-indexed-receiver-uint256-fees) - * [Functions](#campaign-functions) - * [withdrawFees()](#withdrawfees) - * [refund()](#refund) - * [createMarket()](#createmarket) - * [closeMarket()](#closemarket) - * [fund(*uint256* `amount`)](#funduint256-amount) - -# Campaign - -### Campaign contract - Allows to crowdfund a market - -- **Author**: Stefan George - -- **Constructor**: Campaign(*address* `_eventContract`, *address* `_marketFactory`, *address* `_marketMaker`, *uint24* `_fee`, *uint256* `_funding`, *uint256* `_deadline`) -- This contract does **not** have a fallback function. - -## Campaign Accessors - -* *address* marketFactory() `06ae7095` -* *address* marketMaker() `1f21f9af` -* *uint256* finalBalance() `2129e25a` -* *uint256* deadline() `29dcb0cf` -* *uint256* contributions(*address*) `42e94c90` -* *address* market() `80f55605` -* *uint8* stage() `c040e6b8` -* *uint256* funding() `cb4c86b7` -* *uint24* fee() `ddca3f43` -* *address* eventContract() `e274fd24` -* *uint24* FEE_RANGE() `fbde47f6` - -## Campaign Events - -### CampaignFunding(*address* indexed `sender`, *uint256* `funding`) - -**Signature hash**: `9e85601c404591b54325b6512021f8145643571c59865b7ab29ed9e0664cb17f` - -### CampaignRefund(*address* indexed `sender`, *uint256* `refund`) - -**Signature hash**: `d53235e384e83b261994d71b101de6c22402415c0c0d313f064a90e91039e2a9` - -### MarketCreation(*address* indexed `market`) - -**Signature hash**: `d50a500cb3b7c976a045df06de01ca42c942e1a2c43ac27d96bfa7ece3138a99` - -### MarketClosing() - -**Signature hash**: `e7d85885f81486e8f4c99e50e056745493861b8b5d4f973dcf0c3c0f74a25e07` - -### FeeWithdrawal(*address* indexed `receiver`, *uint256* `fees`) - -**Signature hash**: `ee33a3a9cb48e4ff209f8b1c67c4632f1dbbf55aeff8e6f17d957ade7a6fb17c` - -## Campaign Functions - -### withdrawFees() - -- **State mutability**: `nonpayable` -- **Signature hash**: `476343ee` - -Allows to withdraw fees from campaign contract to contributor - -#### Outputs - -| type | name | description | -| --------- | ------ | ----------- | -| *uint256* | `fees` | Fee amount | - -### refund() - -- **State mutability**: `nonpayable` -- **Signature hash**: `590e1ae3` - -Withdraws refund amount - -#### Outputs - -| type | name | description | -| --------- | -------------- | ------------- | -| *uint256* | `refundAmount` | Refund amount | - -### createMarket() - -- **State mutability**: `nonpayable` -- **Signature hash**: `aea0e35f` - -Allows to create market after successful funding - -#### Outputs - -| type | description | -| --------- | -------------- | -| *address* | Market address | - -### closeMarket() - -- **State mutability**: `nonpayable` -- **Signature hash**: `c511ed5e` - -Allows to withdraw fees from market contract to campaign contract - -### fund(*uint256* `amount`) - -- **State mutability**: `nonpayable` -- **Signature hash**: `ca1d209d` - -Allows to contribute to required market funding - -#### Inputs - -| type | name | description | -| --------- | -------- | --------------------------- | -| *uint256* | `amount` | Amount of collateral tokens | diff --git a/docs/CampaignFactory.md b/docs/CampaignFactory.md deleted file mode 100644 index 038c8fc..0000000 --- a/docs/CampaignFactory.md +++ /dev/null @@ -1,45 +0,0 @@ -* [CampaignFactory](#campaignfactory) - * [Events](#campaignfactory-events) - * [CampaignCreation(*address* indexed `creator`, *address* `campaign`, *address* `eventContract`, *address* `marketFactory`, *address* `marketMaker`, *uint24* `fee`, *uint256* `funding`, *uint256* `deadline`)](#campaigncreationaddress-indexed-creator-address-campaign-address-eventcontract-address-marketfactory-address-marketmaker-uint24-fee-uint256-funding-uint256-deadline) - * [Functions](#campaignfactory-functions) - * [createCampaign(*address* `eventContract`, *address* `marketFactory`, *address* `marketMaker`, *uint24* `fee`, *uint256* `funding`, *uint256* `deadline`)](#createcampaignaddress-eventcontract-address-marketfactory-address-marketmaker-uint24-fee-uint256-funding-uint256-deadline) - -# CampaignFactory - -### Campaign factory contract - Allows to create campaign contracts - -- **Author**: Stefan George - -- **Constructor**: CampaignFactory() -- This contract does **not** have a fallback function. - -## CampaignFactory Events - -### CampaignCreation(*address* indexed `creator`, *address* `campaign`, *address* `eventContract`, *address* `marketFactory`, *address* `marketMaker`, *uint24* `fee`, *uint256* `funding`, *uint256* `deadline`) - -**Signature hash**: `7a9fd19b658538a67209802dd9011d6e3ce04586fe93c87096d2bc40ed850866` - -## CampaignFactory Functions - -### createCampaign(*address* `eventContract`, *address* `marketFactory`, *address* `marketMaker`, *uint24* `fee`, *uint256* `funding`, *uint256* `deadline`) - -- **State mutability**: `nonpayable` -- **Signature hash**: `7d1ef569` - -Creates a new campaign contract - -#### Inputs - -| type | name | description | -| --------- | --------------- | -------------------------- | -| *address* | `eventContract` | Event contract | -| *address* | `marketFactory` | Market factory contract | -| *address* | `marketMaker` | Market maker contract | -| *uint24* | `fee` | Market fee | -| *uint256* | `funding` | Initial funding for market | -| *uint256* | `deadline` | Campaign deadline | - -#### Outputs - -| type | name | description | -| --------- | ---------- | --------------- | -| *address* | `campaign` | Market contract | diff --git a/docs/CategoricalEvent.md b/docs/CategoricalEvent.md deleted file mode 100644 index 925ffa2..0000000 --- a/docs/CategoricalEvent.md +++ /dev/null @@ -1,161 +0,0 @@ -* [CategoricalEvent](#categoricalevent) - * [Accessors](#categoricalevent-accessors) - * [Events](#categoricalevent-events) - * [OutcomeTokenCreation(*address* `outcomeToken`, *uint8* `index`)](#outcometokencreationaddress-outcometoken-uint8-index) - * [OutcomeTokenSetIssuance(*address* indexed `buyer`, *uint256* `collateralTokenCount`)](#outcometokensetissuanceaddress-indexed-buyer-uint256-collateraltokencount) - * [OutcomeTokenSetRevocation(*address* indexed `seller`, *uint256* `outcomeTokenCount`)](#outcometokensetrevocationaddress-indexed-seller-uint256-outcometokencount) - * [OutcomeAssignment(*int256* `outcome`)](#outcomeassignmentint256-outcome) - * [WinningsRedemption(*address* indexed `receiver`, *uint256* `winnings`)](#winningsredemptionaddress-indexed-receiver-uint256-winnings) - * [Functions](#categoricalevent-functions) - * [setOutcome()](#setoutcome) - * [buyAllOutcomes(*uint256* `collateralTokenCount`)](#buyalloutcomesuint256-collateraltokencount) - * [getOutcomeTokenDistribution(*address* `owner`)](#getoutcometokendistributionaddress-owner) - * [sellAllOutcomes(*uint256* `outcomeTokenCount`)](#sellalloutcomesuint256-outcometokencount) - * [getOutcomeCount()](#getoutcomecount) - * [redeemWinnings()](#redeemwinnings) - * [getEventHash()](#geteventhash) - * [getOutcomeTokens()](#getoutcometokens) - -# CategoricalEvent - -### Categorical event contract - Categorical events resolve to an outcome from a set of outcomes - -- **Author**: Stefan George - -- **Constructor**: CategoricalEvent(*address* `_collateralToken`, *address* `_oracle`, *uint8* `outcomeCount`) -- This contract does **not** have a fallback function. - -## CategoricalEvent Accessors - -* *int256* outcome() `27793f87` -* *address* oracle() `7dc0d1d0` -* *address* outcomeTokens(*uint256*) `8abe59ea` -* *address* collateralToken() `b2016bd4` -* *bool* isOutcomeSet() `ccdf68f3` - -## CategoricalEvent Events - -### OutcomeTokenCreation(*address* `outcomeToken`, *uint8* `index`) - -**Signature hash**: `ad24776dc347085865b6988e249c191fc22d9b31cf54cb62233c3c16be1736ee` - -### OutcomeTokenSetIssuance(*address* indexed `buyer`, *uint256* `collateralTokenCount`) - -**Signature hash**: `ad2a02292986148558019ae4abf172732228e32e131a91d3fa7e0cada61932c0` - -### OutcomeTokenSetRevocation(*address* indexed `seller`, *uint256* `outcomeTokenCount`) - -**Signature hash**: `7ac9271efd660c24459c447459e46f7366d2b4a692e572f108619d0d7273fcc5` - -### OutcomeAssignment(*int256* `outcome`) - -**Signature hash**: `b1aaa9f4484acc283375c8e495a44766e4026170797dc9280b4ae2ab5632fb71` - -### WinningsRedemption(*address* indexed `receiver`, *uint256* `winnings`) - -**Signature hash**: `2fe921bb50a459800ae7eae7c0124e9e875094a539eb7dc5b3f728017347e0fb` - -## CategoricalEvent Functions - -### setOutcome() - -- **State mutability**: `nonpayable` -- **Signature hash**: `0537665d` - -Sets winning event outcome - -### buyAllOutcomes(*uint256* `collateralTokenCount`) - -- **State mutability**: `nonpayable` -- **Signature hash**: `28da850b` - -Buys equal number of tokens of all outcomes, exchanging collateral tokens and sets of outcome tokens 1:1 - -#### Inputs - -| type | name | description | -| --------- | ---------------------- | --------------------------- | -| *uint256* | `collateralTokenCount` | Number of collateral tokens | - -### getOutcomeTokenDistribution(*address* `owner`) - -- **State mutability**: `view` -- **Signature hash**: `69c19d4c` - -Returns the amount of outcome tokens held by owner - -#### Inputs - -| type | name | -| --------- | ------- | -| *address* | `owner` | - -#### Outputs - -| type | name | description | -| ----------- | -------------------------- | -------------------------- | -| *uint256[]* | `outcomeTokenDistribution` | Outcome token distribution | - -### sellAllOutcomes(*uint256* `outcomeTokenCount`) - -- **State mutability**: `nonpayable` -- **Signature hash**: `6fb1edcd` - -Sells equal number of tokens of all outcomes, exchanging collateral tokens and sets of outcome tokens 1:1 - -#### Inputs - -| type | name | description | -| --------- | ------------------- | ------------------------ | -| *uint256* | `outcomeTokenCount` | Number of outcome tokens | - -### getOutcomeCount() - -- **State mutability**: `view` -- **Signature hash**: `7dc8f086` - -Returns outcome count - -#### Outputs - -| type | description | -| ------- | ------------- | -| *uint8* | Outcome count | - -### redeemWinnings() - -- **State mutability**: `nonpayable` -- **Signature hash**: `ad0b2bec` - -Exchanges sender's winning outcome tokens for collateral tokens - -#### Outputs - -| type | name | description | -| --------- | ---------- | ----------------- | -| *uint256* | `winnings` | Sender's winnings | - -### getEventHash() - -- **State mutability**: `view` -- **Signature hash**: `e96e5950` - -Calculates and returns event hash - -#### Outputs - -| type | description | -| --------- | ----------- | -| *bytes32* | Event hash | - -### getOutcomeTokens() - -- **State mutability**: `view` -- **Signature hash**: `f21a1468` - -Returns outcome tokens array - -#### Outputs - -| type | description | -| ----------- | -------------- | -| *address[]* | Outcome tokens | diff --git a/docs/CentralizedOracle.md b/docs/CentralizedOracle.md deleted file mode 100644 index fa91e9d..0000000 --- a/docs/CentralizedOracle.md +++ /dev/null @@ -1,89 +0,0 @@ -* [CentralizedOracle](#centralizedoracle) - * [Accessors](#centralizedoracle-accessors) - * [Events](#centralizedoracle-events) - * [OwnerReplacement(*address* indexed `newOwner`)](#ownerreplacementaddress-indexed-newowner) - * [OutcomeAssignment(*int256* `outcome`)](#outcomeassignmentint256-outcome) - * [Functions](#centralizedoracle-functions) - * [setOutcome(*int256* `_outcome`)](#setoutcomeint256-_outcome) - * [getOutcome()](#getoutcome) - * [replaceOwner(*address* `newOwner`)](#replaceowneraddress-newowner) - * [isOutcomeSet()](#isoutcomeset) - -# CentralizedOracle - -### Centralized oracle contract - Allows the contract owner to set an outcome - -- **Author**: Stefan George - -- **Constructor**: CentralizedOracle(*address* `_owner`, *bytes* `_ipfsHash`) -- This contract does **not** have a fallback function. - -## CentralizedOracle Accessors - -* *int256* outcome() `27793f87` -* *address* owner() `8da5cb5b` -* *bytes* ipfsHash() `c623674f` -* *bool* isSet() `c65fb380` - -## CentralizedOracle Events - -### OwnerReplacement(*address* indexed `newOwner`) - -**Signature hash**: `191a2405c52452c381a62f3b7480f9d3e77a76d7737659fc1030aff54b395dd5` - -### OutcomeAssignment(*int256* `outcome`) - -**Signature hash**: `b1aaa9f4484acc283375c8e495a44766e4026170797dc9280b4ae2ab5632fb71` - -## CentralizedOracle Functions - -### setOutcome(*int256* `_outcome`) - -- **State mutability**: `nonpayable` -- **Signature hash**: `717a195a` - -Sets event outcome - -#### Inputs - -| type | name | description | -| -------- | ---------- | ------------- | -| *int256* | `_outcome` | Event outcome | - -### getOutcome() - -- **State mutability**: `view` -- **Signature hash**: `7e7e4b47` - -Returns outcome - -#### Outputs - -| type | description | -| -------- | ----------- | -| *int256* | Outcome | - -### replaceOwner(*address* `newOwner`) - -- **State mutability**: `nonpayable` -- **Signature hash**: `a39a45b7` - -Replaces owner - -#### Inputs - -| type | name | description | -| --------- | ---------- | ----------- | -| *address* | `newOwner` | New owner | - -### isOutcomeSet() - -- **State mutability**: `view` -- **Signature hash**: `ccdf68f3` - -Returns if winning outcome is set - -#### Outputs - -| type | description | -| ------ | --------------- | -| *bool* | Is outcome set? | diff --git a/docs/CentralizedOracleFactory.md b/docs/CentralizedOracleFactory.md deleted file mode 100644 index 2704e8a..0000000 --- a/docs/CentralizedOracleFactory.md +++ /dev/null @@ -1,40 +0,0 @@ -* [CentralizedOracleFactory](#centralizedoraclefactory) - * [Events](#centralizedoraclefactory-events) - * [CentralizedOracleCreation(*address* indexed `creator`, *address* `centralizedOracle`, *bytes* `ipfsHash`)](#centralizedoraclecreationaddress-indexed-creator-address-centralizedoracle-bytes-ipfshash) - * [Functions](#centralizedoraclefactory-functions) - * [createCentralizedOracle(*bytes* `ipfsHash`)](#createcentralizedoraclebytes-ipfshash) - -# CentralizedOracleFactory - -### Centralized oracle factory contract - Allows to create centralized oracle contracts - -- **Author**: Stefan George - -- **Constructor**: CentralizedOracleFactory() -- This contract does **not** have a fallback function. - -## CentralizedOracleFactory Events - -### CentralizedOracleCreation(*address* indexed `creator`, *address* `centralizedOracle`, *bytes* `ipfsHash`) - -**Signature hash**: `33a1926cf5c2f7306ac1685bf19260d678fea874f5f59c00b69fa5e2643ecfd2` - -## CentralizedOracleFactory Functions - -### createCentralizedOracle(*bytes* `ipfsHash`) - -- **State mutability**: `nonpayable` -- **Signature hash**: `4e2f220c` - -Creates a new centralized oracle contract - -#### Inputs - -| type | name | description | -| ------- | ---------- | -------------------------------------------- | -| *bytes* | `ipfsHash` | Hash identifying off chain event description | - -#### Outputs - -| type | name | description | -| --------- | ------------------- | --------------- | -| *address* | `centralizedOracle` | Oracle contract | diff --git a/docs/DifficultyOracle.md b/docs/DifficultyOracle.md deleted file mode 100644 index 0875dbb..0000000 --- a/docs/DifficultyOracle.md +++ /dev/null @@ -1,62 +0,0 @@ -* [DifficultyOracle](#difficultyoracle) - * [Accessors](#difficultyoracle-accessors) - * [Events](#difficultyoracle-events) - * [OutcomeAssignment(*uint256* `difficulty`)](#outcomeassignmentuint256-difficulty) - * [Functions](#difficultyoracle-functions) - * [setOutcome()](#setoutcome) - * [getOutcome()](#getoutcome) - * [isOutcomeSet()](#isoutcomeset) - -# DifficultyOracle - -### Difficulty oracle contract - Oracle to resolve difficulty events at given block - -- **Author**: Stefan George - -- **Constructor**: DifficultyOracle(*uint256* `_blockNumber`) -- This contract does **not** have a fallback function. - -## DifficultyOracle Accessors - -* *uint256* difficulty() `19cae462` -* *uint256* blockNumber() `57e871e7` - -## DifficultyOracle Events - -### OutcomeAssignment(*uint256* `difficulty`) - -**Signature hash**: `39972cb21edd888c2061a2b4b37874524bbc055cfeaa3054682ba5369f5029aa` - -## DifficultyOracle Functions - -### setOutcome() - -- **State mutability**: `nonpayable` -- **Signature hash**: `0537665d` - -Sets difficulty as winning outcome for specified block - -### getOutcome() - -- **State mutability**: `view` -- **Signature hash**: `7e7e4b47` - -Returns difficulty - -#### Outputs - -| type | description | -| -------- | ----------- | -| *int256* | Outcome | - -### isOutcomeSet() - -- **State mutability**: `view` -- **Signature hash**: `ccdf68f3` - -Returns if difficulty is set - -#### Outputs - -| type | description | -| ------ | --------------- | -| *bool* | Is outcome set? | diff --git a/docs/DifficultyOracleFactory.md b/docs/DifficultyOracleFactory.md deleted file mode 100644 index 8030fa5..0000000 --- a/docs/DifficultyOracleFactory.md +++ /dev/null @@ -1,40 +0,0 @@ -* [DifficultyOracleFactory](#difficultyoraclefactory) - * [Events](#difficultyoraclefactory-events) - * [DifficultyOracleCreation(*address* indexed `creator`, *address* `difficultyOracle`, *uint256* `blockNumber`)](#difficultyoraclecreationaddress-indexed-creator-address-difficultyoracle-uint256-blocknumber) - * [Functions](#difficultyoraclefactory-functions) - * [createDifficultyOracle(*uint256* `blockNumber`)](#createdifficultyoracleuint256-blocknumber) - -# DifficultyOracleFactory - -### Difficulty oracle factory contract - Allows to create difficulty oracle contracts - -- **Author**: Stefan George - -- **Constructor**: DifficultyOracleFactory() -- This contract does **not** have a fallback function. - -## DifficultyOracleFactory Events - -### DifficultyOracleCreation(*address* indexed `creator`, *address* `difficultyOracle`, *uint256* `blockNumber`) - -**Signature hash**: `83ecbb7b33dba848fcbd61d437ac02705db443e66f76ce6be0cf3415d07ab17f` - -## DifficultyOracleFactory Functions - -### createDifficultyOracle(*uint256* `blockNumber`) - -- **State mutability**: `nonpayable` -- **Signature hash**: `9d5f2422` - -Creates a new difficulty oracle contract - -#### Inputs - -| type | name | description | -| --------- | ------------- | ------------------- | -| *uint256* | `blockNumber` | Target block number | - -#### Outputs - -| type | name | description | -| --------- | ------------------ | --------------- | -| *address* | `difficultyOracle` | Oracle contract | diff --git a/docs/EtherToken.md b/docs/EtherToken.md deleted file mode 100644 index bf6a798..0000000 --- a/docs/EtherToken.md +++ /dev/null @@ -1,183 +0,0 @@ -* [EtherToken](#ethertoken) - * [Accessors](#ethertoken-accessors) - * [Events](#ethertoken-events) - * [Deposit(*address* indexed `sender`, *uint256* `value`)](#depositaddress-indexed-sender-uint256-value) - * [Withdrawal(*address* indexed `receiver`, *uint256* `value`)](#withdrawaladdress-indexed-receiver-uint256-value) - * [Transfer(*address* indexed `from`, *address* indexed `to`, *uint256* `value`)](#transferaddress-indexed-from-address-indexed-to-uint256-value) - * [Approval(*address* indexed `owner`, *address* indexed `spender`, *uint256* `value`)](#approvaladdress-indexed-owner-address-indexed-spender-uint256-value) - * [Functions](#ethertoken-functions) - * [approve(*address* `spender`, *uint256* `value`)](#approveaddress-spender-uint256-value) - * [totalSupply()](#totalsupply) - * [transferFrom(*address* `from`, *address* `to`, *uint256* `value`)](#transferfromaddress-from-address-to-uint256-value) - * [withdraw(*uint256* `value`)](#withdrawuint256-value) - * [balanceOf(*address* `owner`)](#balanceofaddress-owner) - * [transfer(*address* `to`, *uint256* `value`)](#transferaddress-to-uint256-value) - * [deposit()](#deposit) - * [allowance(*address* `owner`, *address* `spender`)](#allowanceaddress-owner-address-spender) - -# EtherToken - -### Token contract - Token exchanging Ether 1:1 - -- **Author**: Stefan George - -- **Constructor**: EtherToken() -- This contract does **not** have a fallback function. - -## EtherToken Accessors - -* *string* name() `06fdde03` -* *uint8* decimals() `313ce567` -* *string* symbol() `95d89b41` - -## EtherToken Events - -### Deposit(*address* indexed `sender`, *uint256* `value`) - -**Signature hash**: `e1fffcc4923d04b559f4d29a8bfc6cda04eb5b0d3c460751c2402c5c5cc9109c` - -### Withdrawal(*address* indexed `receiver`, *uint256* `value`) - -**Signature hash**: `7fcf532c15f0a6db0bd6d0e038bea71d30d808c7d98cb3bf7268a95bf5081b65` - -### Transfer(*address* indexed `from`, *address* indexed `to`, *uint256* `value`) - -**Signature hash**: `ddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef` - -### Approval(*address* indexed `owner`, *address* indexed `spender`, *uint256* `value`) - -**Signature hash**: `8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925` - -## EtherToken Functions - -### approve(*address* `spender`, *uint256* `value`) - -- **State mutability**: `nonpayable` -- **Signature hash**: `095ea7b3` - -Sets approved amount of tokens for spender. Returns success - -#### Inputs - -| type | name | description | -| --------- | --------- | -------------------------- | -| *address* | `spender` | Address of allowed account | -| *uint256* | `value` | Number of approved tokens | - -#### Outputs - -| type | description | -| ------ | ------------------------ | -| *bool* | Was approval successful? | - -### totalSupply() - -- **State mutability**: `view` -- **Signature hash**: `18160ddd` - -Returns total supply of tokens - -#### Outputs - -| type | description | -| --------- | ------------ | -| *uint256* | Total supply | - -### transferFrom(*address* `from`, *address* `to`, *uint256* `value`) - -- **State mutability**: `nonpayable` -- **Signature hash**: `23b872dd` - -Allows allowed third party to transfer tokens from one address to another. Returns success - -#### Inputs - -| type | name | description | -| --------- | ------- | --------------------------------------- | -| *address* | `from` | Address from where tokens are withdrawn | -| *address* | `to` | Address to where tokens are sent | -| *uint256* | `value` | Number of tokens to transfer | - -#### Outputs - -| type | description | -| ------ | ------------------------ | -| *bool* | Was transfer successful? | - -### withdraw(*uint256* `value`) - -- **State mutability**: `nonpayable` -- **Signature hash**: `2e1a7d4d` - -Sells tokens in exchange for Ether, exchanging them 1:1 - -#### Inputs - -| type | name | description | -| --------- | ------- | ------------------------ | -| *uint256* | `value` | Number of tokens to sell | - -### balanceOf(*address* `owner`) - -- **State mutability**: `view` -- **Signature hash**: `70a08231` - -Returns number of tokens owned by given address - -#### Inputs - -| type | name | description | -| --------- | ------- | ---------------------- | -| *address* | `owner` | Address of token owner | - -#### Outputs - -| type | description | -| --------- | ---------------- | -| *uint256* | Balance of owner | - -### transfer(*address* `to`, *uint256* `value`) - -- **State mutability**: `nonpayable` -- **Signature hash**: `a9059cbb` - -Transfers sender's tokens to a given address. Returns success - -#### Inputs - -| type | name | description | -| --------- | ------- | ---------------------------- | -| *address* | `to` | Address of token receiver | -| *uint256* | `value` | Number of tokens to transfer | - -#### Outputs - -| type | description | -| ------ | ------------------------ | -| *bool* | Was transfer successful? | - -### deposit() - -- **State mutability**: `payable` -- **Signature hash**: `d0e30db0` - -Buys tokens with Ether, exchanging them 1:1 - -### allowance(*address* `owner`, *address* `spender`) - -- **State mutability**: `view` -- **Signature hash**: `dd62ed3e` - -Returns number of allowed tokens for given address - -#### Inputs - -| type | name | description | -| --------- | --------- | ------------------------ | -| *address* | `owner` | Address of token owner | -| *address* | `spender` | Address of token spender | - -#### Outputs - -| type | description | -| --------- | ------------------------------- | -| *uint256* | Remaining allowance for spender | diff --git a/docs/Event.md b/docs/Event.md deleted file mode 100644 index 0697fad..0000000 --- a/docs/Event.md +++ /dev/null @@ -1,161 +0,0 @@ -* [Event](#event) - * [Accessors](#event-accessors) - * [Events](#event-events) - * [OutcomeTokenCreation(*address* `outcomeToken`, *uint8* `index`)](#outcometokencreationaddress-outcometoken-uint8-index) - * [OutcomeTokenSetIssuance(*address* indexed `buyer`, *uint256* `collateralTokenCount`)](#outcometokensetissuanceaddress-indexed-buyer-uint256-collateraltokencount) - * [OutcomeTokenSetRevocation(*address* indexed `seller`, *uint256* `outcomeTokenCount`)](#outcometokensetrevocationaddress-indexed-seller-uint256-outcometokencount) - * [OutcomeAssignment(*int256* `outcome`)](#outcomeassignmentint256-outcome) - * [WinningsRedemption(*address* indexed `receiver`, *uint256* `winnings`)](#winningsredemptionaddress-indexed-receiver-uint256-winnings) - * [Functions](#event-functions) - * [setOutcome()](#setoutcome) - * [buyAllOutcomes(*uint256* `collateralTokenCount`)](#buyalloutcomesuint256-collateraltokencount) - * [getOutcomeTokenDistribution(*address* `owner`)](#getoutcometokendistributionaddress-owner) - * [sellAllOutcomes(*uint256* `outcomeTokenCount`)](#sellalloutcomesuint256-outcometokencount) - * [getOutcomeCount()](#getoutcomecount) - * [redeemWinnings()](#redeemwinnings) - * [getEventHash()](#geteventhash) - * [getOutcomeTokens()](#getoutcometokens) - -# Event - -### Event contract - Provide basic functionality required by different event types - -- **Author**: Stefan George - -- **Constructor**: Event(*address* `_collateralToken`, *address* `_oracle`, *uint8* `outcomeCount`) -- This contract does **not** have a fallback function. - -## Event Accessors - -* *int256* outcome() `27793f87` -* *address* oracle() `7dc0d1d0` -* *address* outcomeTokens(*uint256*) `8abe59ea` -* *address* collateralToken() `b2016bd4` -* *bool* isOutcomeSet() `ccdf68f3` - -## Event Events - -### OutcomeTokenCreation(*address* `outcomeToken`, *uint8* `index`) - -**Signature hash**: `ad24776dc347085865b6988e249c191fc22d9b31cf54cb62233c3c16be1736ee` - -### OutcomeTokenSetIssuance(*address* indexed `buyer`, *uint256* `collateralTokenCount`) - -**Signature hash**: `ad2a02292986148558019ae4abf172732228e32e131a91d3fa7e0cada61932c0` - -### OutcomeTokenSetRevocation(*address* indexed `seller`, *uint256* `outcomeTokenCount`) - -**Signature hash**: `7ac9271efd660c24459c447459e46f7366d2b4a692e572f108619d0d7273fcc5` - -### OutcomeAssignment(*int256* `outcome`) - -**Signature hash**: `b1aaa9f4484acc283375c8e495a44766e4026170797dc9280b4ae2ab5632fb71` - -### WinningsRedemption(*address* indexed `receiver`, *uint256* `winnings`) - -**Signature hash**: `2fe921bb50a459800ae7eae7c0124e9e875094a539eb7dc5b3f728017347e0fb` - -## Event Functions - -### setOutcome() - -- **State mutability**: `nonpayable` -- **Signature hash**: `0537665d` - -Sets winning event outcome - -### buyAllOutcomes(*uint256* `collateralTokenCount`) - -- **State mutability**: `nonpayable` -- **Signature hash**: `28da850b` - -Buys equal number of tokens of all outcomes, exchanging collateral tokens and sets of outcome tokens 1:1 - -#### Inputs - -| type | name | description | -| --------- | ---------------------- | --------------------------- | -| *uint256* | `collateralTokenCount` | Number of collateral tokens | - -### getOutcomeTokenDistribution(*address* `owner`) - -- **State mutability**: `view` -- **Signature hash**: `69c19d4c` - -Returns the amount of outcome tokens held by owner - -#### Inputs - -| type | name | -| --------- | ------- | -| *address* | `owner` | - -#### Outputs - -| type | name | description | -| ----------- | -------------------------- | -------------------------- | -| *uint256[]* | `outcomeTokenDistribution` | Outcome token distribution | - -### sellAllOutcomes(*uint256* `outcomeTokenCount`) - -- **State mutability**: `nonpayable` -- **Signature hash**: `6fb1edcd` - -Sells equal number of tokens of all outcomes, exchanging collateral tokens and sets of outcome tokens 1:1 - -#### Inputs - -| type | name | description | -| --------- | ------------------- | ------------------------ | -| *uint256* | `outcomeTokenCount` | Number of outcome tokens | - -### getOutcomeCount() - -- **State mutability**: `view` -- **Signature hash**: `7dc8f086` - -Returns outcome count - -#### Outputs - -| type | description | -| ------- | ------------- | -| *uint8* | Outcome count | - -### redeemWinnings() - -- **State mutability**: `nonpayable` -- **Signature hash**: `ad0b2bec` - -Exchanges sender's winning outcome tokens for collateral tokens - -#### Outputs - -| type | description | -| --------- | ----------------- | -| *uint256* | Sender's winnings | - -### getEventHash() - -- **State mutability**: `view` -- **Signature hash**: `e96e5950` - -Calculates and returns event hash - -#### Outputs - -| type | description | -| --------- | ----------- | -| *bytes32* | Event hash | - -### getOutcomeTokens() - -- **State mutability**: `view` -- **Signature hash**: `f21a1468` - -Returns outcome tokens array - -#### Outputs - -| type | description | -| ----------- | -------------- | -| *address[]* | Outcome tokens | diff --git a/docs/EventFactory.md b/docs/EventFactory.md deleted file mode 100644 index 4df91ac..0000000 --- a/docs/EventFactory.md +++ /dev/null @@ -1,76 +0,0 @@ -* [EventFactory](#eventfactory) - * [Accessors](#eventfactory-accessors) - * [Events](#eventfactory-events) - * [CategoricalEventCreation(*address* indexed `creator`, *address* `categoricalEvent`, *address* `collateralToken`, *address* `oracle`, *uint8* `outcomeCount`)](#categoricaleventcreationaddress-indexed-creator-address-categoricalevent-address-collateraltoken-address-oracle-uint8-outcomecount) - * [ScalarEventCreation(*address* indexed `creator`, *address* `scalarEvent`, *address* `collateralToken`, *address* `oracle`, *int256* `lowerBound`, *int256* `upperBound`)](#scalareventcreationaddress-indexed-creator-address-scalarevent-address-collateraltoken-address-oracle-int256-lowerbound-int256-upperbound) - * [Functions](#eventfactory-functions) - * [createScalarEvent(*address* `collateralToken`, *address* `oracle`, *int256* `lowerBound`, *int256* `upperBound`)](#createscalareventaddress-collateraltoken-address-oracle-int256-lowerbound-int256-upperbound) - * [createCategoricalEvent(*address* `collateralToken`, *address* `oracle`, *uint8* `outcomeCount`)](#createcategoricaleventaddress-collateraltoken-address-oracle-uint8-outcomecount) - -# EventFactory - -### Event factory contract - Allows creation of categorical and scalar events - -- **Author**: Stefan George - -- **Constructor**: EventFactory() -- This contract does **not** have a fallback function. - -## EventFactory Accessors - -* *address* categoricalEvents(*bytes32*) `8d1d2c21` -* *address* scalarEvents(*bytes32*) `9897e8a5` - -## EventFactory Events - -### CategoricalEventCreation(*address* indexed `creator`, *address* `categoricalEvent`, *address* `collateralToken`, *address* `oracle`, *uint8* `outcomeCount`) - -**Signature hash**: `9732758aee476f5125b50d29cc43e28422f12ec078ba9f5c712f9dbd52796f59` - -### ScalarEventCreation(*address* indexed `creator`, *address* `scalarEvent`, *address* `collateralToken`, *address* `oracle`, *int256* `lowerBound`, *int256* `upperBound`) - -**Signature hash**: `d613e63983a1538814e1b390fc232d0e20462cf7410924f6b6a5f29ea38e82ed` - -## EventFactory Functions - -### createScalarEvent(*address* `collateralToken`, *address* `oracle`, *int256* `lowerBound`, *int256* `upperBound`) - -- **State mutability**: `nonpayable` -- **Signature hash**: `5ea194a3` - -Creates a new scalar event and adds it to the event mapping - -#### Inputs - -| type | name | description | -| --------- | ----------------- | -------------------------------------------------------- | -| *address* | `collateralToken` | Tokens used as collateral in exchange for outcome tokens | -| *address* | `oracle` | Oracle contract used to resolve the event | -| *int256* | `lowerBound` | Lower bound for event outcome | -| *int256* | `upperBound` | Lower bound for event outcome | - -#### Outputs - -| type | name | description | -| --------- | --------------- | -------------- | -| *address* | `eventContract` | Event contract | - -### createCategoricalEvent(*address* `collateralToken`, *address* `oracle`, *uint8* `outcomeCount`) - -- **State mutability**: `nonpayable` -- **Signature hash**: `9df0c176` - -Creates a new categorical event and adds it to the event mapping - -#### Inputs - -| type | name | description | -| --------- | ----------------- | -------------------------------------------------------- | -| *address* | `collateralToken` | Tokens used as collateral in exchange for outcome tokens | -| *address* | `oracle` | Oracle contract used to resolve the event | -| *uint8* | `outcomeCount` | Number of event outcomes | - -#### Outputs - -| type | name | description | -| --------- | --------------- | -------------- | -| *address* | `eventContract` | Event contract | diff --git a/docs/FutarchyOracle.md b/docs/FutarchyOracle.md deleted file mode 100644 index 3a58377..0000000 --- a/docs/FutarchyOracle.md +++ /dev/null @@ -1,98 +0,0 @@ -* [FutarchyOracle](#futarchyoracle) - * [Accessors](#futarchyoracle-accessors) - * [Events](#futarchyoracle-events) - * [FutarchyFunding(*uint256* `funding`)](#futarchyfundinguint256-funding) - * [FutarchyClosing()](#futarchyclosing) - * [OutcomeAssignment(*uint256* `winningMarketIndex`)](#outcomeassignmentuint256-winningmarketindex) - * [Functions](#futarchyoracle-functions) - * [setOutcome()](#setoutcome) - * [close()](#close) - * [getOutcome()](#getoutcome) - * [fund(*uint256* `funding`)](#funduint256-funding) - * [isOutcomeSet()](#isoutcomeset) - -# FutarchyOracle - -### Futarchy oracle contract - Allows to create an oracle based on market behaviour - -- **Author**: Stefan George - -- **Constructor**: FutarchyOracle(*address* `_creator`, *address* `eventFactory`, *address* `collateralToken`, *address* `oracle`, *uint8* `outcomeCount`, *int256* `lowerBound`, *int256* `upperBound`, *address* `marketFactory`, *address* `marketMaker`, *uint24* `fee`, *uint256* `_tradingPeriod`, *uint256* `startDate`) -- This contract does **not** have a fallback function. - -## FutarchyOracle Accessors - -* *uint8* LONG() `561cce0a` -* *uint256* winningMarketIndex() `56cfb75f` -* *address* markets(*uint256*) `b1283e77` -* *address* categoricalEvent() `c3730d03` -* *bool* isSet() `c65fb380` -* *uint256* tradingPeriod() `f86e3153` - -## FutarchyOracle Events - -### FutarchyFunding(*uint256* `funding`) - -**Signature hash**: `8b8d4001f25800969052b4c8925891e8acbe35d672701edb74e52265fed9786e` - -### FutarchyClosing() - -**Signature hash**: `5f5592c20f009bc231fd8491ce6ff3d11f2067fd2bd08c2a9999391a09b67dd4` - -### OutcomeAssignment(*uint256* `winningMarketIndex`) - -**Signature hash**: `39972cb21edd888c2061a2b4b37874524bbc055cfeaa3054682ba5369f5029aa` - -## FutarchyOracle Functions - -### setOutcome() - -- **State mutability**: `nonpayable` -- **Signature hash**: `0537665d` - -Allows to set the oracle outcome based on the market with largest long position - -### close() - -- **State mutability**: `nonpayable` -- **Signature hash**: `43d726d6` - -Closes market for winning outcome and redeems winnings and sends all collateral tokens to creator - -### getOutcome() - -- **State mutability**: `view` -- **Signature hash**: `7e7e4b47` - -Returns winning outcome - -#### Outputs - -| type | description | -| -------- | ----------- | -| *int256* | Outcome | - -### fund(*uint256* `funding`) - -- **State mutability**: `nonpayable` -- **Signature hash**: `ca1d209d` - -Funds all markets with equal amount of funding - -#### Inputs - -| type | name | description | -| --------- | --------- | ----------------- | -| *uint256* | `funding` | Amount of funding | - -### isOutcomeSet() - -- **State mutability**: `view` -- **Signature hash**: `ccdf68f3` - -Returns if winning outcome is set - -#### Outputs - -| type | description | -| ------ | --------------- | -| *bool* | Is outcome set? | diff --git a/docs/FutarchyOracleFactory.md b/docs/FutarchyOracleFactory.md deleted file mode 100644 index 0c2b64f..0000000 --- a/docs/FutarchyOracleFactory.md +++ /dev/null @@ -1,48 +0,0 @@ -* [FutarchyOracleFactory](#futarchyoraclefactory) - * [Events](#futarchyoraclefactory-events) - * [FutarchyOracleCreation(*address* indexed `creator`, *address* `futarchyOracle`, *address* `collateralToken`, *address* `oracle`, *uint8* `outcomeCount`, *int256* `lowerBound`, *int256* `upperBound`, *address* `marketMaker`, *uint24* `fee`, *uint256* `tradingPeriod`, *uint256* `startDate`)](#futarchyoraclecreationaddress-indexed-creator-address-futarchyoracle-address-collateraltoken-address-oracle-uint8-outcomecount-int256-lowerbound-int256-upperbound-address-marketmaker-uint24-fee-uint256-tradingperiod-uint256-startdate) - * [Functions](#futarchyoraclefactory-functions) - * [createFutarchyOracle(*address* `collateralToken`, *address* `oracle`, *uint8* `outcomeCount`, *int256* `lowerBound`, *int256* `upperBound`, *address* `marketMaker`, *uint24* `fee`, *uint256* `tradingPeriod`, *uint256* `startDate`)](#createfutarchyoracleaddress-collateraltoken-address-oracle-uint8-outcomecount-int256-lowerbound-int256-upperbound-address-marketmaker-uint24-fee-uint256-tradingperiod-uint256-startdate) - -# FutarchyOracleFactory - -### Futarchy oracle factory contract - Allows to create Futarchy oracle contracts - -- **Author**: Stefan George - -- **Constructor**: FutarchyOracleFactory(*address* `_eventFactory`, *address* `_marketFactory`) -- This contract does **not** have a fallback function. - -## FutarchyOracleFactory Events - -### FutarchyOracleCreation(*address* indexed `creator`, *address* `futarchyOracle`, *address* `collateralToken`, *address* `oracle`, *uint8* `outcomeCount`, *int256* `lowerBound`, *int256* `upperBound`, *address* `marketMaker`, *uint24* `fee`, *uint256* `tradingPeriod`, *uint256* `startDate`) - -**Signature hash**: `31b2f2efb8e38b0139781fb93941176394ceb31c7433234a12da403999ca8766` - -## FutarchyOracleFactory Functions - -### createFutarchyOracle(*address* `collateralToken`, *address* `oracle`, *uint8* `outcomeCount`, *int256* `lowerBound`, *int256* `upperBound`, *address* `marketMaker`, *uint24* `fee`, *uint256* `tradingPeriod`, *uint256* `startDate`) - -- **State mutability**: `nonpayable` -- **Signature hash**: `bb6de2bc` - -Creates a new Futarchy oracle contract - -#### Inputs - -| type | name | description | -| --------- | ----------------- | -------------------------------------------------------- | -| *address* | `collateralToken` | Tokens used as collateral in exchange for outcome tokens | -| *address* | `oracle` | Oracle contract used to resolve the event | -| *uint8* | `outcomeCount` | Number of event outcomes | -| *int256* | `lowerBound` | Lower bound for event outcome | -| *int256* | `upperBound` | Lower bound for event outcome | -| *address* | `marketMaker` | Market maker contract | -| *uint24* | `fee` | Market fee | -| *uint256* | `tradingPeriod` | Trading period before decision can be determined | -| *uint256* | `startDate` | Start date for price logging | - -#### Outputs - -| type | name | description | -| --------- | ---------------- | --------------- | -| *address* | `futarchyOracle` | Oracle contract | diff --git a/docs/HumanFriendlyToken.md b/docs/HumanFriendlyToken.md deleted file mode 100644 index f279f56..0000000 --- a/docs/HumanFriendlyToken.md +++ /dev/null @@ -1,127 +0,0 @@ -* [HumanFriendlyToken](#humanfriendlytoken) - * [Accessors](#humanfriendlytoken-accessors) - * [Events](#humanfriendlytoken-events) - * [Transfer(*address* indexed `from`, *address* indexed `to`, *uint256* `value`)](#transferaddress-indexed-from-address-indexed-to-uint256-value) - * [Approval(*address* indexed `owner`, *address* indexed `spender`, *uint256* `value`)](#approvaladdress-indexed-owner-address-indexed-spender-uint256-value) - * [Functions](#humanfriendlytoken-functions) - * [approve(*address* `spender`, *uint256* `value`)](#approveaddress-spender-uint256-value) - * [transferFrom(*address* `from`, *address* `to`, *uint256* `value`)](#transferfromaddress-from-address-to-uint256-value) - * [balanceOf(*address* `owner`)](#balanceofaddress-owner) - * [transfer(*address* `to`, *uint256* `value`)](#transferaddress-to-uint256-value) - * [allowance(*address* `owner`, *address* `spender`)](#allowanceaddress-owner-address-spender) - -# HumanFriendlyToken - -### Abstract human-friendly token contract - Functions to be implemented by token contracts - -- **Constructor**: HumanFriendlyToken() -- This contract does **not** have a fallback function. - -## HumanFriendlyToken Accessors - -* *string* name() `06fdde03` -* *uint256* totalSupply() `18160ddd` -* *uint8* decimals() `313ce567` -* *string* symbol() `95d89b41` - -## HumanFriendlyToken Events - -### Transfer(*address* indexed `from`, *address* indexed `to`, *uint256* `value`) - -**Signature hash**: `ddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef` - -### Approval(*address* indexed `owner`, *address* indexed `spender`, *uint256* `value`) - -**Signature hash**: `8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925` - -## HumanFriendlyToken Functions - -### approve(*address* `spender`, *uint256* `value`) - -- **State mutability**: `nonpayable` -- **Signature hash**: `095ea7b3` - -#### Inputs - -| type | name | -| --------- | --------- | -| *address* | `spender` | -| *uint256* | `value` | - -#### Outputs - -| type | -| ------ | -| *bool* | - -### transferFrom(*address* `from`, *address* `to`, *uint256* `value`) - -- **State mutability**: `nonpayable` -- **Signature hash**: `23b872dd` - -#### Inputs - -| type | name | -| --------- | ------- | -| *address* | `from` | -| *address* | `to` | -| *uint256* | `value` | - -#### Outputs - -| type | -| ------ | -| *bool* | - -### balanceOf(*address* `owner`) - -- **State mutability**: `view` -- **Signature hash**: `70a08231` - -#### Inputs - -| type | name | -| --------- | ------- | -| *address* | `owner` | - -#### Outputs - -| type | -| --------- | -| *uint256* | - -### transfer(*address* `to`, *uint256* `value`) - -- **State mutability**: `nonpayable` -- **Signature hash**: `a9059cbb` - -#### Inputs - -| type | name | -| --------- | ------- | -| *address* | `to` | -| *uint256* | `value` | - -#### Outputs - -| type | -| ------ | -| *bool* | - -### allowance(*address* `owner`, *address* `spender`) - -- **State mutability**: `view` -- **Signature hash**: `dd62ed3e` - -#### Inputs - -| type | name | -| --------- | --------- | -| *address* | `owner` | -| *address* | `spender` | - -#### Outputs - -| type | -| --------- | -| *uint256* | diff --git a/docs/LMSRMarketMaker.md b/docs/LMSRMarketMaker.md deleted file mode 100644 index abfa4a5..0000000 --- a/docs/LMSRMarketMaker.md +++ /dev/null @@ -1,77 +0,0 @@ -* [LMSRMarketMaker](#lmsrmarketmaker) - * [Functions](#lmsrmarketmaker-functions) - * [calcProfit(*address* `market`, *uint8* `outcomeTokenIndex`, *uint256* `outcomeTokenCount`)](#calcprofitaddress-market-uint8-outcometokenindex-uint256-outcometokencount) - * [calcCost(*address* `market`, *uint8* `outcomeTokenIndex`, *uint256* `outcomeTokenCount`)](#calccostaddress-market-uint8-outcometokenindex-uint256-outcometokencount) - * [calcMarginalPrice(*address* `market`, *uint8* `outcomeTokenIndex`)](#calcmarginalpriceaddress-market-uint8-outcometokenindex) - -# LMSRMarketMaker - -### LMSR market maker contract - Calculates share prices based on share distribution and initial funding - -- **Author**: Alan Lu - -- **Constructor**: LMSRMarketMaker() -- This contract does **not** have a fallback function. - -## LMSRMarketMaker Functions - -### calcProfit(*address* `market`, *uint8* `outcomeTokenIndex`, *uint256* `outcomeTokenCount`) - -- **State mutability**: `view` -- **Signature hash**: `4091c6a9` - -Returns profit for selling given number of outcome tokens - -#### Inputs - -| type | name | description | -| --------- | ------------------- | -------------------------------- | -| *address* | `market` | Market contract | -| *uint8* | `outcomeTokenIndex` | Index of outcome to sell | -| *uint256* | `outcomeTokenCount` | Number of outcome tokens to sell | - -#### Outputs - -| type | name | description | -| --------- | -------- | ----------- | -| *uint256* | `profit` | Profit | - -### calcCost(*address* `market`, *uint8* `outcomeTokenIndex`, *uint256* `outcomeTokenCount`) - -- **State mutability**: `view` -- **Signature hash**: `bd8ff817` - -Returns cost to buy given number of outcome tokens - -#### Inputs - -| type | name | description | -| --------- | ------------------- | ------------------------------- | -| *address* | `market` | Market contract | -| *uint8* | `outcomeTokenIndex` | Index of outcome to buy | -| *uint256* | `outcomeTokenCount` | Number of outcome tokens to buy | - -#### Outputs - -| type | name | description | -| --------- | ------ | ----------- | -| *uint256* | `cost` | Cost | - -### calcMarginalPrice(*address* `market`, *uint8* `outcomeTokenIndex`) - -- **State mutability**: `view` -- **Signature hash**: `d812d346` - -Returns marginal price of an outcome - -#### Inputs - -| type | name | description | -| --------- | ------------------- | ----------------------------------------------- | -| *address* | `market` | Market contract | -| *uint8* | `outcomeTokenIndex` | Index of outcome to determine marginal price of | - -#### Outputs - -| type | name | description | -| --------- | ------- | ---------------------------------------------------- | -| *uint256* | `price` | Marginal price of an outcome as a fixed point number | diff --git a/docs/MajorityOracle.md b/docs/MajorityOracle.md deleted file mode 100644 index 32debe4..0000000 --- a/docs/MajorityOracle.md +++ /dev/null @@ -1,60 +0,0 @@ -* [MajorityOracle](#majorityoracle) - * [Accessors](#majorityoracle-accessors) - * [Functions](#majorityoracle-functions) - * [getStatusAndOutcome()](#getstatusandoutcome) - * [getOutcome()](#getoutcome) - * [isOutcomeSet()](#isoutcomeset) - -# MajorityOracle - -### Majority oracle contract - Allows to resolve an event based on multiple oracles with majority vote - -- **Author**: Stefan George - -- **Constructor**: MajorityOracle(*address[]* `_oracles`) -- This contract does **not** have a fallback function. - -## MajorityOracle Accessors - -* *address* oracles(*uint256*) `5b69a7d8` - -## MajorityOracle Functions - -### getStatusAndOutcome() - -- **State mutability**: `nonpayable` -- **Signature hash**: `6bcc035a` - -Allows to registers oracles for a majority vote - -#### Outputs - -| type | name | -| -------- | ------------ | -| *bool* | `outcomeSet` | -| *int256* | `outcome` | - -### getOutcome() - -- **State mutability**: `view` -- **Signature hash**: `7e7e4b47` - -Returns winning outcome - -#### Outputs - -| type | description | -| -------- | ----------- | -| *int256* | Outcome | - -### isOutcomeSet() - -- **State mutability**: `view` -- **Signature hash**: `ccdf68f3` - -Returns if winning outcome is set - -#### Outputs - -| type | description | -| ------ | --------------- | -| *bool* | Is outcome set? | diff --git a/docs/MajorityOracleFactory.md b/docs/MajorityOracleFactory.md deleted file mode 100644 index 00306a4..0000000 --- a/docs/MajorityOracleFactory.md +++ /dev/null @@ -1,40 +0,0 @@ -* [MajorityOracleFactory](#majorityoraclefactory) - * [Events](#majorityoraclefactory-events) - * [MajorityOracleCreation(*address* indexed `creator`, *address* `majorityOracle`, *address[]* `oracles`)](#majorityoraclecreationaddress-indexed-creator-address-majorityoracle-address-oracles) - * [Functions](#majorityoraclefactory-functions) - * [createMajorityOracle(*address[]* `oracles`)](#createmajorityoracleaddress-oracles) - -# MajorityOracleFactory - -### Majority oracle factory contract - Allows to create majority oracle contracts - -- **Author**: Stefan George - -- **Constructor**: MajorityOracleFactory() -- This contract does **not** have a fallback function. - -## MajorityOracleFactory Events - -### MajorityOracleCreation(*address* indexed `creator`, *address* `majorityOracle`, *address[]* `oracles`) - -**Signature hash**: `df1eeefc4815bdd1bdf45905c4ce59f6ca50efb4148303c9bbda2bff40301d3d` - -## MajorityOracleFactory Functions - -### createMajorityOracle(*address[]* `oracles`) - -- **State mutability**: `nonpayable` -- **Signature hash**: `e04c0c52` - -Creates a new majority oracle contract - -#### Inputs - -| type | name | description | -| ----------- | --------- | ------------------------------------------------ | -| *address[]* | `oracles` | List of oracles taking part in the majority vote | - -#### Outputs - -| type | name | description | -| --------- | ---------------- | --------------- | -| *address* | `majorityOracle` | Oracle contract | diff --git a/docs/Market.md b/docs/Market.md deleted file mode 100644 index a635749..0000000 --- a/docs/Market.md +++ /dev/null @@ -1,164 +0,0 @@ -* [Market](#market) - * [Accessors](#market-accessors) - * [Events](#market-events) - * [MarketFunding(*uint256* `funding`)](#marketfundinguint256-funding) - * [MarketClosing()](#marketclosing) - * [FeeWithdrawal(*uint256* `fees`)](#feewithdrawaluint256-fees) - * [OutcomeTokenPurchase(*address* indexed `buyer`, *uint8* `outcomeTokenIndex`, *uint256* `outcomeTokenCount`, *uint256* `outcomeTokenCost`, *uint256* `marketFees`)](#outcometokenpurchaseaddress-indexed-buyer-uint8-outcometokenindex-uint256-outcometokencount-uint256-outcometokencost-uint256-marketfees) - * [OutcomeTokenSale(*address* indexed `seller`, *uint8* `outcomeTokenIndex`, *uint256* `outcomeTokenCount`, *uint256* `outcomeTokenProfit`, *uint256* `marketFees`)](#outcometokensaleaddress-indexed-seller-uint8-outcometokenindex-uint256-outcometokencount-uint256-outcometokenprofit-uint256-marketfees) - * [OutcomeTokenShortSale(*address* indexed `buyer`, *uint8* `outcomeTokenIndex`, *uint256* `outcomeTokenCount`, *uint256* `cost`)](#outcometokenshortsaleaddress-indexed-buyer-uint8-outcometokenindex-uint256-outcometokencount-uint256-cost) - * [Functions](#market-functions) - * [shortSell(*uint8* `outcomeTokenIndex`, *uint256* `outcomeTokenCount`, *uint256* `minProfit`)](#shortselluint8-outcometokenindex-uint256-outcometokencount-uint256-minprofit) - * [close()](#close) - * [sell(*uint8* `outcomeTokenIndex`, *uint256* `outcomeTokenCount`, *uint256* `minProfit`)](#selluint8-outcometokenindex-uint256-outcometokencount-uint256-minprofit) - * [withdrawFees()](#withdrawfees) - * [calcMarketFee(*uint256* `outcomeTokenCost`)](#calcmarketfeeuint256-outcometokencost) - * [fund(*uint256* `_funding`)](#funduint256-_funding) - * [buy(*uint8* `outcomeTokenIndex`, *uint256* `outcomeTokenCount`, *uint256* `maxCost`)](#buyuint8-outcometokenindex-uint256-outcometokencount-uint256-maxcost) - -# Market - -### Abstract market contract - Functions to be implemented by market contracts - -- **Constructor**: Market() -- This contract does **not** have a fallback function. - -## Market Accessors - -* *address* creator() `02d05d3f` -* *address* marketMaker() `1f21f9af` -* *uint256* createdAtBlock() `59acb42c` -* *int256* netOutcomeTokensSold(*uint256*) `a157979c` -* *uint8* stage() `c040e6b8` -* *uint256* funding() `cb4c86b7` -* *uint24* fee() `ddca3f43` -* *address* eventContract() `e274fd24` - -## Market Events - -### MarketFunding(*uint256* `funding`) - -**Signature hash**: `8a2fe22ce705a4ac9c189969cef327affbdc477afdae4ae274c2f8ad021f9163` - -### MarketClosing() - -**Signature hash**: `e7d85885f81486e8f4c99e50e056745493861b8b5d4f973dcf0c3c0f74a25e07` - -### FeeWithdrawal(*uint256* `fees`) - -**Signature hash**: `706d7f48c702007c2fb0881cea5759732e64f52faee427d5ab030787cfb7d787` - -### OutcomeTokenPurchase(*address* indexed `buyer`, *uint8* `outcomeTokenIndex`, *uint256* `outcomeTokenCount`, *uint256* `outcomeTokenCost`, *uint256* `marketFees`) - -**Signature hash**: `7caea4a19892ce49b4daa2014d5599eed561dcd16ffabfac851a9737217ae410` - -### OutcomeTokenSale(*address* indexed `seller`, *uint8* `outcomeTokenIndex`, *uint256* `outcomeTokenCount`, *uint256* `outcomeTokenProfit`, *uint256* `marketFees`) - -**Signature hash**: `ab24ef3371efb2e0e3b02955e33b8ef03c14523e71f3bda87878a2386cc17b69` - -### OutcomeTokenShortSale(*address* indexed `buyer`, *uint8* `outcomeTokenIndex`, *uint256* `outcomeTokenCount`, *uint256* `cost`) - -**Signature hash**: `1dbdc4ff4d51949738d56e120b2be4edecc55d8d2150f1616ec5802abaae3f88` - -## Market Functions - -### shortSell(*uint8* `outcomeTokenIndex`, *uint256* `outcomeTokenCount`, *uint256* `minProfit`) - -- **State mutability**: `nonpayable` -- **Signature hash**: `28c05d32` - -#### Inputs - -| type | name | -| --------- | ------------------- | -| *uint8* | `outcomeTokenIndex` | -| *uint256* | `outcomeTokenCount` | -| *uint256* | `minProfit` | - -#### Outputs - -| type | -| --------- | -| *uint256* | - -### close() - -- **State mutability**: `nonpayable` -- **Signature hash**: `43d726d6` - -### sell(*uint8* `outcomeTokenIndex`, *uint256* `outcomeTokenCount`, *uint256* `minProfit`) - -- **State mutability**: `nonpayable` -- **Signature hash**: `46280a80` - -#### Inputs - -| type | name | -| --------- | ------------------- | -| *uint8* | `outcomeTokenIndex` | -| *uint256* | `outcomeTokenCount` | -| *uint256* | `minProfit` | - -#### Outputs - -| type | -| --------- | -| *uint256* | - -### withdrawFees() - -- **State mutability**: `nonpayable` -- **Signature hash**: `476343ee` - -#### Outputs - -| type | -| --------- | -| *uint256* | - -### calcMarketFee(*uint256* `outcomeTokenCost`) - -- **State mutability**: `view` -- **Signature hash**: `b0011509` - -#### Inputs - -| type | name | -| --------- | ------------------ | -| *uint256* | `outcomeTokenCost` | - -#### Outputs - -| type | -| --------- | -| *uint256* | - -### fund(*uint256* `_funding`) - -- **State mutability**: `nonpayable` -- **Signature hash**: `ca1d209d` - -#### Inputs - -| type | name | -| --------- | ---------- | -| *uint256* | `_funding` | - -### buy(*uint8* `outcomeTokenIndex`, *uint256* `outcomeTokenCount`, *uint256* `maxCost`) - -- **State mutability**: `nonpayable` -- **Signature hash**: `f6d956df` - -#### Inputs - -| type | name | -| --------- | ------------------- | -| *uint8* | `outcomeTokenIndex` | -| *uint256* | `outcomeTokenCount` | -| *uint256* | `maxCost` | - -#### Outputs - -| type | -| --------- | -| *uint256* | diff --git a/docs/MarketMaker.md b/docs/MarketMaker.md deleted file mode 100644 index 8e7cbdb..0000000 --- a/docs/MarketMaker.md +++ /dev/null @@ -1,70 +0,0 @@ -* [MarketMaker](#marketmaker) - * [Functions](#marketmaker-functions) - * [calcProfit(*address* `market`, *uint8* `outcomeTokenIndex`, *uint256* `outcomeTokenCount`)](#calcprofitaddress-market-uint8-outcometokenindex-uint256-outcometokencount) - * [calcCost(*address* `market`, *uint8* `outcomeTokenIndex`, *uint256* `outcomeTokenCount`)](#calccostaddress-market-uint8-outcometokenindex-uint256-outcometokencount) - * [calcMarginalPrice(*address* `market`, *uint8* `outcomeTokenIndex`)](#calcmarginalpriceaddress-market-uint8-outcometokenindex) - -# MarketMaker - -### Abstract market maker contract - Functions to be implemented by market maker contracts - -- **Constructor**: MarketMaker() -- This contract does **not** have a fallback function. - -## MarketMaker Functions - -### calcProfit(*address* `market`, *uint8* `outcomeTokenIndex`, *uint256* `outcomeTokenCount`) - -- **State mutability**: `view` -- **Signature hash**: `4091c6a9` - -#### Inputs - -| type | name | -| --------- | ------------------- | -| *address* | `market` | -| *uint8* | `outcomeTokenIndex` | -| *uint256* | `outcomeTokenCount` | - -#### Outputs - -| type | -| --------- | -| *uint256* | - -### calcCost(*address* `market`, *uint8* `outcomeTokenIndex`, *uint256* `outcomeTokenCount`) - -- **State mutability**: `view` -- **Signature hash**: `bd8ff817` - -#### Inputs - -| type | name | -| --------- | ------------------- | -| *address* | `market` | -| *uint8* | `outcomeTokenIndex` | -| *uint256* | `outcomeTokenCount` | - -#### Outputs - -| type | -| --------- | -| *uint256* | - -### calcMarginalPrice(*address* `market`, *uint8* `outcomeTokenIndex`) - -- **State mutability**: `view` -- **Signature hash**: `d812d346` - -#### Inputs - -| type | name | -| --------- | ------------------- | -| *address* | `market` | -| *uint8* | `outcomeTokenIndex` | - -#### Outputs - -| type | -| --------- | -| *uint256* | diff --git a/docs/Math.md b/docs/Math.md deleted file mode 100644 index be504d9..0000000 --- a/docs/Math.md +++ /dev/null @@ -1,351 +0,0 @@ -* [Math](#math) - * [Accessors](#math-accessors) - * [Functions](#math-functions) - * [safeToMul(*int256* `a`, *int256* `b`)](#safetomulint256-a-int256-b) - * [ln(*uint256* `x`)](#lnuint256-x) - * [floorLog2(*uint256* `x`)](#floorlog2uint256-x) - * [safeToAdd(*uint256* `a`, *uint256* `b`)](#safetoadduint256-a-uint256-b) - * [add(*uint256* `a`, *uint256* `b`)](#adduint256-a-uint256-b) - * [safeToSub(*int256* `a`, *int256* `b`)](#safetosubint256-a-int256-b) - * [add(*int256* `a`, *int256* `b`)](#addint256-a-int256-b) - * [sub(*int256* `a`, *int256* `b`)](#subint256-a-int256-b) - * [sub(*uint256* `a`, *uint256* `b`)](#subuint256-a-uint256-b) - * [mul(*int256* `a`, *int256* `b`)](#mulint256-a-int256-b) - * [mul(*uint256* `a`, *uint256* `b`)](#muluint256-a-uint256-b) - * [safeToMul(*uint256* `a`, *uint256* `b`)](#safetomuluint256-a-uint256-b) - * [max(*int256[]* `nums`)](#maxint256-nums) - * [safeToAdd(*int256* `a`, *int256* `b`)](#safetoaddint256-a-int256-b) - * [safeToSub(*uint256* `a`, *uint256* `b`)](#safetosubuint256-a-uint256-b) - * [exp(*int256* `x`)](#expint256-x) - -# Math - -### Math library - Allows calculation of logarithmic and exponential functions - -- **Author**: Alan Lu - Stefan George - -- **Constructor**: Math() -- This contract does **not** have a fallback function. - -## Math Accessors - -* *uint256* LN2() `02780677` -* *uint256* LOG2_E() `24902e24` -* *uint256* ONE() `c2ee3a08` - -## Math Functions - -### safeToMul(*int256* `a`, *int256* `b`) - -- **State mutability**: `view` -- **Signature hash**: `1f47ba29` - -Returns whether a multiply operation causes an overflow - -#### Inputs - -| type | name | description | -| -------- | ---- | ------------- | -| *int256* | `a` | First factor | -| *int256* | `b` | Second factor | - -#### Outputs - -| type | description | -| ------ | ---------------------- | -| *bool* | Did no overflow occur? | - -### ln(*uint256* `x`) - -- **State mutability**: `view` -- **Signature hash**: `24d4e90a` - -Returns natural logarithm value of given x - -#### Inputs - -| type | name | description | -| --------- | ---- | ----------- | -| *uint256* | `x` | x | - -#### Outputs - -| type | description | -| -------- | ----------- | -| *int256* | ln(x) | - -### floorLog2(*uint256* `x`) - -- **State mutability**: `view` -- **Signature hash**: `45b8bafc` - -Returns base 2 logarithm value of given x - -#### Inputs - -| type | name | description | -| --------- | ---- | ----------- | -| *uint256* | `x` | x | - -#### Outputs - -| type | name | description | -| -------- | ---- | ----------------- | -| *int256* | `lo` | logarithmic value | - -### safeToAdd(*uint256* `a`, *uint256* `b`) - -- **State mutability**: `view` -- **Signature hash**: `4e30a66c` - -Returns whether an add operation causes an overflow - -#### Inputs - -| type | name | description | -| --------- | ---- | ------------- | -| *uint256* | `a` | First addend | -| *uint256* | `b` | Second addend | - -#### Outputs - -| type | description | -| ------ | ---------------------- | -| *bool* | Did no overflow occur? | - -### add(*uint256* `a`, *uint256* `b`) - -- **State mutability**: `view` -- **Signature hash**: `771602f7` - -Returns sum if no overflow occurred - -#### Inputs - -| type | name | description | -| --------- | ---- | ------------- | -| *uint256* | `a` | First addend | -| *uint256* | `b` | Second addend | - -#### Outputs - -| type | description | -| --------- | ----------- | -| *uint256* | Sum | - -### safeToSub(*int256* `a`, *int256* `b`) - -- **State mutability**: `view` -- **Signature hash**: `90304341` - -Returns whether a subtraction operation causes an underflow - -#### Inputs - -| type | name | description | -| -------- | ---- | ----------- | -| *int256* | `a` | Minuend | -| *int256* | `b` | Subtrahend | - -#### Outputs - -| type | description | -| ------ | ----------------------- | -| *bool* | Did no underflow occur? | - -### add(*int256* `a`, *int256* `b`) - -- **State mutability**: `view` -- **Signature hash**: `a5f3c23b` - -Returns sum if no overflow occurred - -#### Inputs - -| type | name | description | -| -------- | ---- | ------------- | -| *int256* | `a` | First addend | -| *int256* | `b` | Second addend | - -#### Outputs - -| type | description | -| -------- | ----------- | -| *int256* | Sum | - -### sub(*int256* `a`, *int256* `b`) - -- **State mutability**: `view` -- **Signature hash**: `adefc37b` - -Returns difference if no overflow occurred - -#### Inputs - -| type | name | description | -| -------- | ---- | ----------- | -| *int256* | `a` | Minuend | -| *int256* | `b` | Subtrahend | - -#### Outputs - -| type | description | -| -------- | ----------- | -| *int256* | Difference | - -### sub(*uint256* `a`, *uint256* `b`) - -- **State mutability**: `view` -- **Signature hash**: `b67d77c5` - -Returns difference if no overflow occurred - -#### Inputs - -| type | name | description | -| --------- | ---- | ----------- | -| *uint256* | `a` | Minuend | -| *uint256* | `b` | Subtrahend | - -#### Outputs - -| type | description | -| --------- | ----------- | -| *uint256* | Difference | - -### mul(*int256* `a`, *int256* `b`) - -- **State mutability**: `view` -- **Signature hash**: `bbe93d91` - -Returns product if no overflow occurred - -#### Inputs - -| type | name | description | -| -------- | ---- | ------------- | -| *int256* | `a` | First factor | -| *int256* | `b` | Second factor | - -#### Outputs - -| type | description | -| -------- | ----------- | -| *int256* | Product | - -### mul(*uint256* `a`, *uint256* `b`) - -- **State mutability**: `view` -- **Signature hash**: `c8a4ac9c` - -Returns product if no overflow occurred - -#### Inputs - -| type | name | description | -| --------- | ---- | ------------- | -| *uint256* | `a` | First factor | -| *uint256* | `b` | Second factor | - -#### Outputs - -| type | description | -| --------- | ----------- | -| *uint256* | Product | - -### safeToMul(*uint256* `a`, *uint256* `b`) - -- **State mutability**: `view` -- **Signature hash**: `cb10fa76` - -Returns whether a multiply operation causes an overflow - -#### Inputs - -| type | name | description | -| --------- | ---- | ------------- | -| *uint256* | `a` | First factor | -| *uint256* | `b` | Second factor | - -#### Outputs - -| type | description | -| ------ | ---------------------- | -| *bool* | Did no overflow occur? | - -### max(*int256[]* `nums`) - -- **State mutability**: `view` -- **Signature hash**: `ccc13814` - -Returns maximum of an array - -#### Inputs - -| type | name | description | -| ---------- | ------ | ----------------------- | -| *int256[]* | `nums` | Numbers to look through | - -#### Outputs - -| type | name | description | -| -------- | ----- | -------------- | -| *int256* | `max` | Maximum number | - -### safeToAdd(*int256* `a`, *int256* `b`) - -- **State mutability**: `view` -- **Signature hash**: `dc08a80b` - -Returns whether an add operation causes an overflow - -#### Inputs - -| type | name | description | -| -------- | ---- | ------------- | -| *int256* | `a` | First addend | -| *int256* | `b` | Second addend | - -#### Outputs - -| type | description | -| ------ | ---------------------- | -| *bool* | Did no overflow occur? | - -### safeToSub(*uint256* `a`, *uint256* `b`) - -- **State mutability**: `view` -- **Signature hash**: `e31c71c4` - -Returns whether a subtraction operation causes an underflow - -#### Inputs - -| type | name | description | -| --------- | ---- | ----------- | -| *uint256* | `a` | Minuend | -| *uint256* | `b` | Subtrahend | - -#### Outputs - -| type | description | -| ------ | ----------------------- | -| *bool* | Did no underflow occur? | - -### exp(*int256* `x`) - -- **State mutability**: `view` -- **Signature hash**: `e46751e3` - -Returns natural exponential function value of given x - -#### Inputs - -| type | name | description | -| -------- | ---- | ----------- | -| *int256* | `x` | x | - -#### Outputs - -| type | description | -| --------- | ----------- | -| *uint256* | e**x | diff --git a/docs/Oracle.md b/docs/Oracle.md deleted file mode 100644 index c2701cf..0000000 --- a/docs/Oracle.md +++ /dev/null @@ -1,14 +0,0 @@ -* [Oracle](#oracle) - * [Accessors](#oracle-accessors) - -# Oracle - -### Abstract oracle contract - Functions to be implemented by oracles - -- **Constructor**: Oracle() -- This contract does **not** have a fallback function. - -## Oracle Accessors - -* *int256* getOutcome() `7e7e4b47` -* *bool* isOutcomeSet() `ccdf68f3` diff --git a/docs/OutcomeToken.md b/docs/OutcomeToken.md deleted file mode 100644 index 5665ad0..0000000 --- a/docs/OutcomeToken.md +++ /dev/null @@ -1,189 +0,0 @@ -* [OutcomeToken](#outcometoken) - * [Accessors](#outcometoken-accessors) - * [Events](#outcometoken-events) - * [Issuance(*address* indexed `owner`, *uint256* `amount`)](#issuanceaddress-indexed-owner-uint256-amount) - * [Revocation(*address* indexed `owner`, *uint256* `amount`)](#revocationaddress-indexed-owner-uint256-amount) - * [Transfer(*address* indexed `from`, *address* indexed `to`, *uint256* `value`)](#transferaddress-indexed-from-address-indexed-to-uint256-value) - * [Approval(*address* indexed `owner`, *address* indexed `spender`, *uint256* `value`)](#approvaladdress-indexed-owner-address-indexed-spender-uint256-value) - * [Functions](#outcometoken-functions) - * [approve(*address* `spender`, *uint256* `value`)](#approveaddress-spender-uint256-value) - * [totalSupply()](#totalsupply) - * [transferFrom(*address* `from`, *address* `to`, *uint256* `value`)](#transferfromaddress-from-address-to-uint256-value) - * [balanceOf(*address* `owner`)](#balanceofaddress-owner) - * [issue(*address* `_for`, *uint256* `outcomeTokenCount`)](#issueaddress-_for-uint256-outcometokencount) - * [transfer(*address* `to`, *uint256* `value`)](#transferaddress-to-uint256-value) - * [allowance(*address* `owner`, *address* `spender`)](#allowanceaddress-owner-address-spender) - * [revoke(*address* `_for`, *uint256* `outcomeTokenCount`)](#revokeaddress-_for-uint256-outcometokencount) - -# OutcomeToken - -### Outcome token contract - Issuing and revoking outcome tokens - -- **Author**: Stefan George - -- **Constructor**: OutcomeToken() -- This contract does **not** have a fallback function. - -## OutcomeToken Accessors - -* *address* eventContract() `e274fd24` - -## OutcomeToken Events - -### Issuance(*address* indexed `owner`, *uint256* `amount`) - -**Signature hash**: `9cb9c14f7bc76e3a89b796b091850526236115352a198b1e472f00e91376bbcb` - -### Revocation(*address* indexed `owner`, *uint256* `amount`) - -**Signature hash**: `f6a317157440607f36269043eb55f1287a5a19ba2216afeab88cd46cbcfb88e9` - -### Transfer(*address* indexed `from`, *address* indexed `to`, *uint256* `value`) - -**Signature hash**: `ddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef` - -### Approval(*address* indexed `owner`, *address* indexed `spender`, *uint256* `value`) - -**Signature hash**: `8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925` - -## OutcomeToken Functions - -### approve(*address* `spender`, *uint256* `value`) - -- **State mutability**: `nonpayable` -- **Signature hash**: `095ea7b3` - -Sets approved amount of tokens for spender. Returns success - -#### Inputs - -| type | name | description | -| --------- | --------- | -------------------------- | -| *address* | `spender` | Address of allowed account | -| *uint256* | `value` | Number of approved tokens | - -#### Outputs - -| type | description | -| ------ | ------------------------ | -| *bool* | Was approval successful? | - -### totalSupply() - -- **State mutability**: `view` -- **Signature hash**: `18160ddd` - -Returns total supply of tokens - -#### Outputs - -| type | description | -| --------- | ------------ | -| *uint256* | Total supply | - -### transferFrom(*address* `from`, *address* `to`, *uint256* `value`) - -- **State mutability**: `nonpayable` -- **Signature hash**: `23b872dd` - -Allows allowed third party to transfer tokens from one address to another. Returns success - -#### Inputs - -| type | name | description | -| --------- | ------- | --------------------------------------- | -| *address* | `from` | Address from where tokens are withdrawn | -| *address* | `to` | Address to where tokens are sent | -| *uint256* | `value` | Number of tokens to transfer | - -#### Outputs - -| type | description | -| ------ | ------------------------ | -| *bool* | Was transfer successful? | - -### balanceOf(*address* `owner`) - -- **State mutability**: `view` -- **Signature hash**: `70a08231` - -Returns number of tokens owned by given address - -#### Inputs - -| type | name | description | -| --------- | ------- | ---------------------- | -| *address* | `owner` | Address of token owner | - -#### Outputs - -| type | description | -| --------- | ---------------- | -| *uint256* | Balance of owner | - -### issue(*address* `_for`, *uint256* `outcomeTokenCount`) - -- **State mutability**: `nonpayable` -- **Signature hash**: `867904b4` - -Events contract issues new tokens for address. Returns success - -#### Inputs - -| type | name | description | -| --------- | ------------------- | ------------------------- | -| *address* | `_for` | Address of receiver | -| *uint256* | `outcomeTokenCount` | Number of tokens to issue | - -### transfer(*address* `to`, *uint256* `value`) - -- **State mutability**: `nonpayable` -- **Signature hash**: `a9059cbb` - -Transfers sender's tokens to a given address. Returns success - -#### Inputs - -| type | name | description | -| --------- | ------- | ---------------------------- | -| *address* | `to` | Address of token receiver | -| *uint256* | `value` | Number of tokens to transfer | - -#### Outputs - -| type | description | -| ------ | ------------------------ | -| *bool* | Was transfer successful? | - -### allowance(*address* `owner`, *address* `spender`) - -- **State mutability**: `view` -- **Signature hash**: `dd62ed3e` - -Returns number of allowed tokens for given address - -#### Inputs - -| type | name | description | -| --------- | --------- | ------------------------ | -| *address* | `owner` | Address of token owner | -| *address* | `spender` | Address of token spender | - -#### Outputs - -| type | description | -| --------- | ------------------------------- | -| *uint256* | Remaining allowance for spender | - -### revoke(*address* `_for`, *uint256* `outcomeTokenCount`) - -- **State mutability**: `nonpayable` -- **Signature hash**: `eac449d9` - -Events contract revokes tokens for address. Returns success - -#### Inputs - -| type | name | description | -| --------- | ------------------- | -------------------------- | -| *address* | `_for` | Address of token holder | -| *uint256* | `outcomeTokenCount` | Number of tokens to revoke | diff --git a/docs/ScalarEvent.md b/docs/ScalarEvent.md deleted file mode 100644 index 0179d3c..0000000 --- a/docs/ScalarEvent.md +++ /dev/null @@ -1,166 +0,0 @@ -* [ScalarEvent](#scalarevent) - * [Accessors](#scalarevent-accessors) - * [Events](#scalarevent-events) - * [OutcomeTokenCreation(*address* `outcomeToken`, *uint8* `index`)](#outcometokencreationaddress-outcometoken-uint8-index) - * [OutcomeTokenSetIssuance(*address* indexed `buyer`, *uint256* `collateralTokenCount`)](#outcometokensetissuanceaddress-indexed-buyer-uint256-collateraltokencount) - * [OutcomeTokenSetRevocation(*address* indexed `seller`, *uint256* `outcomeTokenCount`)](#outcometokensetrevocationaddress-indexed-seller-uint256-outcometokencount) - * [OutcomeAssignment(*int256* `outcome`)](#outcomeassignmentint256-outcome) - * [WinningsRedemption(*address* indexed `receiver`, *uint256* `winnings`)](#winningsredemptionaddress-indexed-receiver-uint256-winnings) - * [Functions](#scalarevent-functions) - * [setOutcome()](#setoutcome) - * [buyAllOutcomes(*uint256* `collateralTokenCount`)](#buyalloutcomesuint256-collateraltokencount) - * [getOutcomeTokenDistribution(*address* `owner`)](#getoutcometokendistributionaddress-owner) - * [sellAllOutcomes(*uint256* `outcomeTokenCount`)](#sellalloutcomesuint256-outcometokencount) - * [getOutcomeCount()](#getoutcomecount) - * [redeemWinnings()](#redeemwinnings) - * [getEventHash()](#geteventhash) - * [getOutcomeTokens()](#getoutcometokens) - -# ScalarEvent - -### Scalar event contract - Scalar events resolve to a number within a range - -- **Author**: Stefan George - -- **Constructor**: ScalarEvent(*address* `_collateralToken`, *address* `_oracle`, *int256* `_lowerBound`, *int256* `_upperBound`) -- This contract does **not** have a fallback function. - -## ScalarEvent Accessors - -* *int256* outcome() `27793f87` -* *uint8* LONG() `561cce0a` -* *uint24* OUTCOME_RANGE() `6e5452fe` -* *address* oracle() `7dc0d1d0` -* *address* outcomeTokens(*uint256*) `8abe59ea` -* *int256* lowerBound() `a384d6ff` -* *uint8* SHORT() `a871da91` -* *int256* upperBound() `b09ad8a0` -* *address* collateralToken() `b2016bd4` -* *bool* isOutcomeSet() `ccdf68f3` - -## ScalarEvent Events - -### OutcomeTokenCreation(*address* `outcomeToken`, *uint8* `index`) - -**Signature hash**: `ad24776dc347085865b6988e249c191fc22d9b31cf54cb62233c3c16be1736ee` - -### OutcomeTokenSetIssuance(*address* indexed `buyer`, *uint256* `collateralTokenCount`) - -**Signature hash**: `ad2a02292986148558019ae4abf172732228e32e131a91d3fa7e0cada61932c0` - -### OutcomeTokenSetRevocation(*address* indexed `seller`, *uint256* `outcomeTokenCount`) - -**Signature hash**: `7ac9271efd660c24459c447459e46f7366d2b4a692e572f108619d0d7273fcc5` - -### OutcomeAssignment(*int256* `outcome`) - -**Signature hash**: `b1aaa9f4484acc283375c8e495a44766e4026170797dc9280b4ae2ab5632fb71` - -### WinningsRedemption(*address* indexed `receiver`, *uint256* `winnings`) - -**Signature hash**: `2fe921bb50a459800ae7eae7c0124e9e875094a539eb7dc5b3f728017347e0fb` - -## ScalarEvent Functions - -### setOutcome() - -- **State mutability**: `nonpayable` -- **Signature hash**: `0537665d` - -Sets winning event outcome - -### buyAllOutcomes(*uint256* `collateralTokenCount`) - -- **State mutability**: `nonpayable` -- **Signature hash**: `28da850b` - -Buys equal number of tokens of all outcomes, exchanging collateral tokens and sets of outcome tokens 1:1 - -#### Inputs - -| type | name | description | -| --------- | ---------------------- | --------------------------- | -| *uint256* | `collateralTokenCount` | Number of collateral tokens | - -### getOutcomeTokenDistribution(*address* `owner`) - -- **State mutability**: `view` -- **Signature hash**: `69c19d4c` - -Returns the amount of outcome tokens held by owner - -#### Inputs - -| type | name | -| --------- | ------- | -| *address* | `owner` | - -#### Outputs - -| type | name | description | -| ----------- | -------------------------- | -------------------------- | -| *uint256[]* | `outcomeTokenDistribution` | Outcome token distribution | - -### sellAllOutcomes(*uint256* `outcomeTokenCount`) - -- **State mutability**: `nonpayable` -- **Signature hash**: `6fb1edcd` - -Sells equal number of tokens of all outcomes, exchanging collateral tokens and sets of outcome tokens 1:1 - -#### Inputs - -| type | name | description | -| --------- | ------------------- | ------------------------ | -| *uint256* | `outcomeTokenCount` | Number of outcome tokens | - -### getOutcomeCount() - -- **State mutability**: `view` -- **Signature hash**: `7dc8f086` - -Returns outcome count - -#### Outputs - -| type | description | -| ------- | ------------- | -| *uint8* | Outcome count | - -### redeemWinnings() - -- **State mutability**: `nonpayable` -- **Signature hash**: `ad0b2bec` - -Exchanges sender's winning outcome tokens for collateral tokens - -#### Outputs - -| type | name | description | -| --------- | ---------- | ----------------- | -| *uint256* | `winnings` | Sender's winnings | - -### getEventHash() - -- **State mutability**: `view` -- **Signature hash**: `e96e5950` - -Calculates and returns event hash - -#### Outputs - -| type | description | -| --------- | ----------- | -| *bytes32* | Event hash | - -### getOutcomeTokens() - -- **State mutability**: `view` -- **Signature hash**: `f21a1468` - -Returns outcome tokens array - -#### Outputs - -| type | description | -| ----------- | -------------- | -| *address[]* | Outcome tokens | diff --git a/docs/SignedMessageOracle.md b/docs/SignedMessageOracle.md deleted file mode 100644 index 85d27f8..0000000 --- a/docs/SignedMessageOracle.md +++ /dev/null @@ -1,96 +0,0 @@ -* [SignedMessageOracle](#signedmessageoracle) - * [Accessors](#signedmessageoracle-accessors) - * [Events](#signedmessageoracle-events) - * [SignerReplacement(*address* indexed `newSigner`)](#signerreplacementaddress-indexed-newsigner) - * [OutcomeAssignment(*int256* `outcome`)](#outcomeassignmentint256-outcome) - * [Functions](#signedmessageoracle-functions) - * [replaceSigner(*address* `newSigner`, *uint256* `_nonce`, *uint8* `v`, *bytes32* `r`, *bytes32* `s`)](#replacesigneraddress-newsigner-uint256-_nonce-uint8-v-bytes32-r-bytes32-s) - * [getOutcome()](#getoutcome) - * [isOutcomeSet()](#isoutcomeset) - * [setOutcome(*int256* `_outcome`, *uint8* `v`, *bytes32* `r`, *bytes32* `s`)](#setoutcomeint256-_outcome-uint8-v-bytes32-r-bytes32-s) - -# SignedMessageOracle - -### Signed message oracle contract - Allows to set an outcome with a signed message - -- **Author**: Stefan George - -- **Constructor**: SignedMessageOracle(*bytes32* `_descriptionHash`, *uint8* `v`, *bytes32* `r`, *bytes32* `s`) -- This contract does **not** have a fallback function. - -## SignedMessageOracle Accessors - -* *address* signer() `238ac933` -* *int256* outcome() `27793f87` -* *bytes32* descriptionHash() `85dcee93` -* *bool* isSet() `c65fb380` - -## SignedMessageOracle Events - -### SignerReplacement(*address* indexed `newSigner`) - -**Signature hash**: `db3046afd053bee6427d6355ee95671fceb37ee6b944866f9ea86eaa213dac68` - -### OutcomeAssignment(*int256* `outcome`) - -**Signature hash**: `b1aaa9f4484acc283375c8e495a44766e4026170797dc9280b4ae2ab5632fb71` - -## SignedMessageOracle Functions - -### replaceSigner(*address* `newSigner`, *uint256* `_nonce`, *uint8* `v`, *bytes32* `r`, *bytes32* `s`) - -- **State mutability**: `nonpayable` -- **Signature hash**: `5011e399` - -Replaces signer - -#### Inputs - -| type | name | description | -| --------- | ----------- | -------------------------------------- | -| *address* | `newSigner` | New signer | -| *uint256* | `_nonce` | Unique nonce to prevent replay attacks | -| *uint8* | `v` | Signature parameter | -| *bytes32* | `r` | Signature parameter | -| *bytes32* | `s` | Signature parameter | - -### getOutcome() - -- **State mutability**: `view` -- **Signature hash**: `7e7e4b47` - -Returns winning outcome - -#### Outputs - -| type | description | -| -------- | ----------- | -| *int256* | Outcome | - -### isOutcomeSet() - -- **State mutability**: `view` -- **Signature hash**: `ccdf68f3` - -Returns if winning outcome - -#### Outputs - -| type | description | -| ------ | --------------- | -| *bool* | Is outcome set? | - -### setOutcome(*int256* `_outcome`, *uint8* `v`, *bytes32* `r`, *bytes32* `s`) - -- **State mutability**: `nonpayable` -- **Signature hash**: `d9bf3187` - -Sets outcome based on signed message - -#### Inputs - -| type | name | description | -| --------- | ---------- | -------------------- | -| *int256* | `_outcome` | Signed event outcome | -| *uint8* | `v` | Signature parameter | -| *bytes32* | `r` | Signature parameter | -| *bytes32* | `s` | Signature parameter | diff --git a/docs/SignedMessageOracleFactory.md b/docs/SignedMessageOracleFactory.md deleted file mode 100644 index 4e9b87e..0000000 --- a/docs/SignedMessageOracleFactory.md +++ /dev/null @@ -1,43 +0,0 @@ -* [SignedMessageOracleFactory](#signedmessageoraclefactory) - * [Events](#signedmessageoraclefactory-events) - * [SignedMessageOracleCreation(*address* indexed `creator`, *address* `signedMessageOracle`, *address* `oracle`)](#signedmessageoraclecreationaddress-indexed-creator-address-signedmessageoracle-address-oracle) - * [Functions](#signedmessageoraclefactory-functions) - * [createSignedMessageOracle(*bytes32* `descriptionHash`, *uint8* `v`, *bytes32* `r`, *bytes32* `s`)](#createsignedmessageoraclebytes32-descriptionhash-uint8-v-bytes32-r-bytes32-s) - -# SignedMessageOracleFactory - -### Signed message oracle factory contract - Allows to create signed message oracle contracts - -- **Author**: Stefan George - -- **Constructor**: SignedMessageOracleFactory() -- This contract does **not** have a fallback function. - -## SignedMessageOracleFactory Events - -### SignedMessageOracleCreation(*address* indexed `creator`, *address* `signedMessageOracle`, *address* `oracle`) - -**Signature hash**: `7be438e4a33b832fcd7adccf30167ee27bd3e693a5ff6daf7fcf98fb2163b7a2` - -## SignedMessageOracleFactory Functions - -### createSignedMessageOracle(*bytes32* `descriptionHash`, *uint8* `v`, *bytes32* `r`, *bytes32* `s`) - -- **State mutability**: `nonpayable` -- **Signature hash**: `655d0862` - -Creates a new signed message oracle contract - -#### Inputs - -| type | name | description | -| --------- | ----------------- | -------------------------------------------- | -| *bytes32* | `descriptionHash` | Hash identifying off chain event description | -| *uint8* | `v` | Signature parameter | -| *bytes32* | `r` | Signature parameter | -| *bytes32* | `s` | Signature parameter | - -#### Outputs - -| type | name | description | -| --------- | --------------------- | --------------- | -| *address* | `signedMessageOracle` | Oracle contract | diff --git a/docs/StandardMarket.md b/docs/StandardMarket.md deleted file mode 100644 index 12475b8..0000000 --- a/docs/StandardMarket.md +++ /dev/null @@ -1,180 +0,0 @@ -* [StandardMarket](#standardmarket) - * [Accessors](#standardmarket-accessors) - * [Events](#standardmarket-events) - * [MarketFunding(*uint256* `funding`)](#marketfundinguint256-funding) - * [MarketClosing()](#marketclosing) - * [FeeWithdrawal(*uint256* `fees`)](#feewithdrawaluint256-fees) - * [OutcomeTokenPurchase(*address* indexed `buyer`, *uint8* `outcomeTokenIndex`, *uint256* `outcomeTokenCount`, *uint256* `outcomeTokenCost`, *uint256* `marketFees`)](#outcometokenpurchaseaddress-indexed-buyer-uint8-outcometokenindex-uint256-outcometokencount-uint256-outcometokencost-uint256-marketfees) - * [OutcomeTokenSale(*address* indexed `seller`, *uint8* `outcomeTokenIndex`, *uint256* `outcomeTokenCount`, *uint256* `outcomeTokenProfit`, *uint256* `marketFees`)](#outcometokensaleaddress-indexed-seller-uint8-outcometokenindex-uint256-outcometokencount-uint256-outcometokenprofit-uint256-marketfees) - * [OutcomeTokenShortSale(*address* indexed `buyer`, *uint8* `outcomeTokenIndex`, *uint256* `outcomeTokenCount`, *uint256* `cost`)](#outcometokenshortsaleaddress-indexed-buyer-uint8-outcometokenindex-uint256-outcometokencount-uint256-cost) - * [Functions](#standardmarket-functions) - * [shortSell(*uint8* `outcomeTokenIndex`, *uint256* `outcomeTokenCount`, *uint256* `minProfit`)](#shortselluint8-outcometokenindex-uint256-outcometokencount-uint256-minprofit) - * [close()](#close) - * [sell(*uint8* `outcomeTokenIndex`, *uint256* `outcomeTokenCount`, *uint256* `minProfit`)](#selluint8-outcometokenindex-uint256-outcometokencount-uint256-minprofit) - * [withdrawFees()](#withdrawfees) - * [calcMarketFee(*uint256* `outcomeTokenCost`)](#calcmarketfeeuint256-outcometokencost) - * [fund(*uint256* `_funding`)](#funduint256-_funding) - * [buy(*uint8* `outcomeTokenIndex`, *uint256* `outcomeTokenCount`, *uint256* `maxCost`)](#buyuint8-outcometokenindex-uint256-outcometokencount-uint256-maxcost) - -# StandardMarket - -### Market factory contract - Allows to create market contracts - -- **Author**: Stefan George - -- **Constructor**: StandardMarket(*address* `_creator`, *address* `_eventContract`, *address* `_marketMaker`, *uint24* `_fee`) -- This contract does **not** have a fallback function. - -## StandardMarket Accessors - -* *address* creator() `02d05d3f` -* *address* marketMaker() `1f21f9af` -* *uint256* createdAtBlock() `59acb42c` -* *int256* netOutcomeTokensSold(*uint256*) `a157979c` -* *uint8* stage() `c040e6b8` -* *uint256* funding() `cb4c86b7` -* *uint24* fee() `ddca3f43` -* *address* eventContract() `e274fd24` -* *uint24* FEE_RANGE() `fbde47f6` - -## StandardMarket Events - -### MarketFunding(*uint256* `funding`) - -**Signature hash**: `8a2fe22ce705a4ac9c189969cef327affbdc477afdae4ae274c2f8ad021f9163` - -### MarketClosing() - -**Signature hash**: `e7d85885f81486e8f4c99e50e056745493861b8b5d4f973dcf0c3c0f74a25e07` - -### FeeWithdrawal(*uint256* `fees`) - -**Signature hash**: `706d7f48c702007c2fb0881cea5759732e64f52faee427d5ab030787cfb7d787` - -### OutcomeTokenPurchase(*address* indexed `buyer`, *uint8* `outcomeTokenIndex`, *uint256* `outcomeTokenCount`, *uint256* `outcomeTokenCost`, *uint256* `marketFees`) - -**Signature hash**: `7caea4a19892ce49b4daa2014d5599eed561dcd16ffabfac851a9737217ae410` - -### OutcomeTokenSale(*address* indexed `seller`, *uint8* `outcomeTokenIndex`, *uint256* `outcomeTokenCount`, *uint256* `outcomeTokenProfit`, *uint256* `marketFees`) - -**Signature hash**: `ab24ef3371efb2e0e3b02955e33b8ef03c14523e71f3bda87878a2386cc17b69` - -### OutcomeTokenShortSale(*address* indexed `buyer`, *uint8* `outcomeTokenIndex`, *uint256* `outcomeTokenCount`, *uint256* `cost`) - -**Signature hash**: `1dbdc4ff4d51949738d56e120b2be4edecc55d8d2150f1616ec5802abaae3f88` - -## StandardMarket Functions - -### shortSell(*uint8* `outcomeTokenIndex`, *uint256* `outcomeTokenCount`, *uint256* `minProfit`) - -- **State mutability**: `nonpayable` -- **Signature hash**: `28c05d32` - -Buys all outcomes, then sells all shares of selected outcome which were bought, keeping shares of all other outcome tokens. - -#### Inputs - -| type | name | description | -| --------- | ------------------- | ----------------------------------------------------------------------------- | -| *uint8* | `outcomeTokenIndex` | Index of the outcome token to short sell | -| *uint256* | `outcomeTokenCount` | Amount of outcome tokens to short sell | -| *uint256* | `minProfit` | The minimum profit in collateral tokens to earn for short sold outcome tokens | - -#### Outputs - -| type | name | description | -| --------- | ------ | ----------------------------------------------- | -| *uint256* | `cost` | Cost to short sell outcome in collateral tokens | - -### close() - -- **State mutability**: `nonpayable` -- **Signature hash**: `43d726d6` - -Allows market creator to close the markets by transferring all remaining outcome tokens to the creator - -### sell(*uint8* `outcomeTokenIndex`, *uint256* `outcomeTokenCount`, *uint256* `minProfit`) - -- **State mutability**: `nonpayable` -- **Signature hash**: `46280a80` - -Allows to sell outcome tokens to market maker - -#### Inputs - -| type | name | description | -| --------- | ------------------- | ------------------------------------------------------------------ | -| *uint8* | `outcomeTokenIndex` | Index of the outcome token to sell | -| *uint256* | `outcomeTokenCount` | Amount of outcome tokens to sell | -| *uint256* | `minProfit` | The minimum profit in collateral tokens to earn for outcome tokens | - -#### Outputs - -| type | name | description | -| --------- | -------- | --------------------------- | -| *uint256* | `profit` | Profit in collateral tokens | - -### withdrawFees() - -- **State mutability**: `nonpayable` -- **Signature hash**: `476343ee` - -Allows market creator to withdraw fees generated by trades - -#### Outputs - -| type | name | description | -| --------- | ------ | ----------- | -| *uint256* | `fees` | Fee amount | - -### calcMarketFee(*uint256* `outcomeTokenCost`) - -- **State mutability**: `view` -- **Signature hash**: `b0011509` - -Calculates fee to be paid to market maker - -#### Inputs - -| type | name | description | -| --------- | ------------------ | ------------------------------ | -| *uint256* | `outcomeTokenCost` | Cost for buying outcome tokens | - -#### Outputs - -| type | description | -| --------- | ------------- | -| *uint256* | Fee for trade | - -### fund(*uint256* `_funding`) - -- **State mutability**: `nonpayable` -- **Signature hash**: `ca1d209d` - -Allows to fund the market with collateral tokens converting them into outcome tokens - -#### Inputs - -| type | name | description | -| --------- | ---------- | -------------- | -| *uint256* | `_funding` | Funding amount | - -### buy(*uint8* `outcomeTokenIndex`, *uint256* `outcomeTokenCount`, *uint256* `maxCost`) - -- **State mutability**: `nonpayable` -- **Signature hash**: `f6d956df` - -Allows to buy outcome tokens from market maker - -#### Inputs - -| type | name | description | -| --------- | ------------------- | --------------------------------------------------------------- | -| *uint8* | `outcomeTokenIndex` | Index of the outcome token to buy | -| *uint256* | `outcomeTokenCount` | Amount of outcome tokens to buy | -| *uint256* | `maxCost` | The maximum cost in collateral tokens to pay for outcome tokens | - -#### Outputs - -| type | name | description | -| --------- | ------ | ------------------------- | -| *uint256* | `cost` | Cost in collateral tokens | diff --git a/docs/StandardMarketFactory.md b/docs/StandardMarketFactory.md deleted file mode 100644 index 982d9a5..0000000 --- a/docs/StandardMarketFactory.md +++ /dev/null @@ -1,42 +0,0 @@ -* [StandardMarketFactory](#standardmarketfactory) - * [Events](#standardmarketfactory-events) - * [StandardMarketCreation(*address* indexed `creator`, *address* `market`, *address* `eventContract`, *address* `marketMaker`, *uint24* `fee`)](#standardmarketcreationaddress-indexed-creator-address-market-address-eventcontract-address-marketmaker-uint24-fee) - * [Functions](#standardmarketfactory-functions) - * [createMarket(*address* `eventContract`, *address* `marketMaker`, *uint24* `fee`)](#createmarketaddress-eventcontract-address-marketmaker-uint24-fee) - -# StandardMarketFactory - -### Market factory contract - Allows to create market contracts - -- **Author**: Stefan George - -- **Constructor**: StandardMarketFactory() -- This contract does **not** have a fallback function. - -## StandardMarketFactory Events - -### StandardMarketCreation(*address* indexed `creator`, *address* `market`, *address* `eventContract`, *address* `marketMaker`, *uint24* `fee`) - -**Signature hash**: `a88e14227921dd3cab0fe30e6e4e4f8d646d8968abd25634fe49781588a8cf94` - -## StandardMarketFactory Functions - -### createMarket(*address* `eventContract`, *address* `marketMaker`, *uint24* `fee`) - -- **State mutability**: `nonpayable` -- **Signature hash**: `7abeb6a0` - -Creates a new market contract - -#### Inputs - -| type | name | description | -| --------- | --------------- | --------------------- | -| *address* | `eventContract` | Event contract | -| *address* | `marketMaker` | Market maker contract | -| *uint24* | `fee` | Market fee | - -#### Outputs - -| type | name | description | -| --------- | -------- | --------------- | -| *address* | `market` | Market contract | diff --git a/docs/StandardMarketWithPriceLogger.md b/docs/StandardMarketWithPriceLogger.md deleted file mode 100644 index b737ce0..0000000 --- a/docs/StandardMarketWithPriceLogger.md +++ /dev/null @@ -1,197 +0,0 @@ -* [StandardMarketWithPriceLogger](#standardmarketwithpricelogger) - * [Accessors](#standardmarketwithpricelogger-accessors) - * [Events](#standardmarketwithpricelogger-events) - * [MarketFunding(*uint256* `funding`)](#marketfundinguint256-funding) - * [MarketClosing()](#marketclosing) - * [FeeWithdrawal(*uint256* `fees`)](#feewithdrawaluint256-fees) - * [OutcomeTokenPurchase(*address* indexed `buyer`, *uint8* `outcomeTokenIndex`, *uint256* `outcomeTokenCount`, *uint256* `outcomeTokenCost`, *uint256* `marketFees`)](#outcometokenpurchaseaddress-indexed-buyer-uint8-outcometokenindex-uint256-outcometokencount-uint256-outcometokencost-uint256-marketfees) - * [OutcomeTokenSale(*address* indexed `seller`, *uint8* `outcomeTokenIndex`, *uint256* `outcomeTokenCount`, *uint256* `outcomeTokenProfit`, *uint256* `marketFees`)](#outcometokensaleaddress-indexed-seller-uint8-outcometokenindex-uint256-outcometokencount-uint256-outcometokenprofit-uint256-marketfees) - * [OutcomeTokenShortSale(*address* indexed `buyer`, *uint8* `outcomeTokenIndex`, *uint256* `outcomeTokenCount`, *uint256* `cost`)](#outcometokenshortsaleaddress-indexed-buyer-uint8-outcometokenindex-uint256-outcometokencount-uint256-cost) - * [Functions](#standardmarketwithpricelogger-functions) - * [shortSell(*uint8* `outcomeTokenIndex`, *uint256* `outcomeTokenCount`, *uint256* `minProfit`)](#shortselluint8-outcometokenindex-uint256-outcometokencount-uint256-minprofit) - * [close()](#close) - * [sell(*uint8* `outcomeTokenIndex`, *uint256* `outcomeTokenCount`, *uint256* `minProfit`)](#selluint8-outcometokenindex-uint256-outcometokencount-uint256-minprofit) - * [withdrawFees()](#withdrawfees) - * [calcMarketFee(*uint256* `outcomeTokenCost`)](#calcmarketfeeuint256-outcometokencost) - * [fund(*uint256* `_funding`)](#funduint256-_funding) - * [getAvgPrice()](#getavgprice) - * [buy(*uint8* `outcomeTokenIndex`, *uint256* `outcomeTokenCount`, *uint256* `maxCost`)](#buyuint8-outcometokenindex-uint256-outcometokencount-uint256-maxcost) - -# StandardMarketWithPriceLogger - -- **Constructor**: StandardMarketWithPriceLogger(*address* `_creator`, *address* `_eventContract`, *address* `_marketMaker`, *uint24* `_fee`, *uint256* `_startDate`) -- This contract does **not** have a fallback function. - -## StandardMarketWithPriceLogger Accessors - -* *address* creator() `02d05d3f` -* *uint256* startDate() `0b97bc86` -* *address* marketMaker() `1f21f9af` -* *uint8* LONG() `561cce0a` -* *uint256* createdAtBlock() `59acb42c` -* *uint256* lastTradeDate() `68b586d5` -* *uint256* priceIntegral() `8b797a0c` -* *int256* netOutcomeTokensSold(*uint256*) `a157979c` -* *uint8* stage() `c040e6b8` -* *uint256* endDate() `c24a0f8b` -* *uint256* funding() `cb4c86b7` -* *uint24* fee() `ddca3f43` -* *uint256* lastTradePrice() `df449cb8` -* *address* eventContract() `e274fd24` -* *uint24* FEE_RANGE() `fbde47f6` - -## StandardMarketWithPriceLogger Events - -### MarketFunding(*uint256* `funding`) - -**Signature hash**: `8a2fe22ce705a4ac9c189969cef327affbdc477afdae4ae274c2f8ad021f9163` - -### MarketClosing() - -**Signature hash**: `e7d85885f81486e8f4c99e50e056745493861b8b5d4f973dcf0c3c0f74a25e07` - -### FeeWithdrawal(*uint256* `fees`) - -**Signature hash**: `706d7f48c702007c2fb0881cea5759732e64f52faee427d5ab030787cfb7d787` - -### OutcomeTokenPurchase(*address* indexed `buyer`, *uint8* `outcomeTokenIndex`, *uint256* `outcomeTokenCount`, *uint256* `outcomeTokenCost`, *uint256* `marketFees`) - -**Signature hash**: `7caea4a19892ce49b4daa2014d5599eed561dcd16ffabfac851a9737217ae410` - -### OutcomeTokenSale(*address* indexed `seller`, *uint8* `outcomeTokenIndex`, *uint256* `outcomeTokenCount`, *uint256* `outcomeTokenProfit`, *uint256* `marketFees`) - -**Signature hash**: `ab24ef3371efb2e0e3b02955e33b8ef03c14523e71f3bda87878a2386cc17b69` - -### OutcomeTokenShortSale(*address* indexed `buyer`, *uint8* `outcomeTokenIndex`, *uint256* `outcomeTokenCount`, *uint256* `cost`) - -**Signature hash**: `1dbdc4ff4d51949738d56e120b2be4edecc55d8d2150f1616ec5802abaae3f88` - -## StandardMarketWithPriceLogger Functions - -### shortSell(*uint8* `outcomeTokenIndex`, *uint256* `outcomeTokenCount`, *uint256* `minProfit`) - -- **State mutability**: `nonpayable` -- **Signature hash**: `28c05d32` - -Buys all outcomes, then sells all shares of selected outcome which were bought, keeping shares of all other outcome tokens. - -#### Inputs - -| type | name | description | -| --------- | ------------------- | ----------------------------------------------------------------------------- | -| *uint8* | `outcomeTokenIndex` | Index of the outcome token to short sell | -| *uint256* | `outcomeTokenCount` | Amount of outcome tokens to short sell | -| *uint256* | `minProfit` | The minimum profit in collateral tokens to earn for short sold outcome tokens | - -#### Outputs - -| type | name | description | -| --------- | ------ | ----------------------------------------------- | -| *uint256* | `cost` | Cost to short sell outcome in collateral tokens | - -### close() - -- **State mutability**: `nonpayable` -- **Signature hash**: `43d726d6` - -Allows market creator to close the markets by transferring all remaining outcome tokens to the creator - -### sell(*uint8* `outcomeTokenIndex`, *uint256* `outcomeTokenCount`, *uint256* `minProfit`) - -- **State mutability**: `nonpayable` -- **Signature hash**: `46280a80` - -Allows to sell outcome tokens to market maker - -#### Inputs - -| type | name | description | -| --------- | ------------------- | ------------------------------------------------------------------ | -| *uint8* | `outcomeTokenIndex` | Index of the outcome token to sell | -| *uint256* | `outcomeTokenCount` | Amount of outcome tokens to sell | -| *uint256* | `minProfit` | The minimum profit in collateral tokens to earn for outcome tokens | - -#### Outputs - -| type | name | description | -| --------- | -------- | --------------------------- | -| *uint256* | `profit` | Profit in collateral tokens | - -### withdrawFees() - -- **State mutability**: `nonpayable` -- **Signature hash**: `476343ee` - -Allows market creator to withdraw fees generated by trades - -#### Outputs - -| type | name | description | -| --------- | ------ | ----------- | -| *uint256* | `fees` | Fee amount | - -### calcMarketFee(*uint256* `outcomeTokenCost`) - -- **State mutability**: `view` -- **Signature hash**: `b0011509` - -Calculates fee to be paid to market maker - -#### Inputs - -| type | name | description | -| --------- | ------------------ | ------------------------------ | -| *uint256* | `outcomeTokenCost` | Cost for buying outcome tokens | - -#### Outputs - -| type | description | -| --------- | ------------- | -| *uint256* | Fee for trade | - -### fund(*uint256* `_funding`) - -- **State mutability**: `nonpayable` -- **Signature hash**: `ca1d209d` - -Allows to fund the market with collateral tokens converting them into outcome tokens - -#### Inputs - -| type | name | description | -| --------- | ---------- | -------------- | -| *uint256* | `_funding` | Funding amount | - -### getAvgPrice() - -- **State mutability**: `nonpayable` -- **Signature hash**: `f01e66ec` - -Calculates average price for long tokens based on price integral - -#### Outputs - -| type | description | -| --------- | --------------------------------------- | -| *uint256* | Average price for long tokens over time | - -### buy(*uint8* `outcomeTokenIndex`, *uint256* `outcomeTokenCount`, *uint256* `maxCost`) - -- **State mutability**: `nonpayable` -- **Signature hash**: `f6d956df` - -Allows to buy outcome tokens from market maker - -#### Inputs - -| type | name | description | -| --------- | ------------------- | --------------------------------------------------------------- | -| *uint8* | `outcomeTokenIndex` | Index of the outcome token to buy | -| *uint256* | `outcomeTokenCount` | Amount of outcome tokens to buy | -| *uint256* | `maxCost` | The maximum cost in collateral tokens to pay for outcome tokens | - -#### Outputs - -| type | name | description | -| --------- | ------ | ------------------------- | -| *uint256* | `cost` | Cost in collateral tokens | diff --git a/docs/StandardMarketWithPriceLoggerFactory.md b/docs/StandardMarketWithPriceLoggerFactory.md deleted file mode 100644 index fea0738..0000000 --- a/docs/StandardMarketWithPriceLoggerFactory.md +++ /dev/null @@ -1,43 +0,0 @@ -* [StandardMarketWithPriceLoggerFactory](#standardmarketwithpriceloggerfactory) - * [Events](#standardmarketwithpriceloggerfactory-events) - * [StandardMarketWithPriceLoggerCreation(*address* indexed `creator`, *address* `market`, *address* `eventContract`, *address* `marketMaker`, *uint24* `fee`, *uint256* `startDate`)](#standardmarketwithpriceloggercreationaddress-indexed-creator-address-market-address-eventcontract-address-marketmaker-uint24-fee-uint256-startdate) - * [Functions](#standardmarketwithpriceloggerfactory-functions) - * [createMarket(*address* `eventContract`, *address* `marketMaker`, *uint24* `fee`, *uint256* `startDate`)](#createmarketaddress-eventcontract-address-marketmaker-uint24-fee-uint256-startdate) - -# StandardMarketWithPriceLoggerFactory - -### Market factory contract - Allows to create market contracts - -- **Author**: Stefan George - -- **Constructor**: StandardMarketWithPriceLoggerFactory() -- This contract does **not** have a fallback function. - -## StandardMarketWithPriceLoggerFactory Events - -### StandardMarketWithPriceLoggerCreation(*address* indexed `creator`, *address* `market`, *address* `eventContract`, *address* `marketMaker`, *uint24* `fee`, *uint256* `startDate`) - -**Signature hash**: `969b1ad77db8ae8298dedcdf1f2945322eaf681e1d56fcebfd4c23de996dc484` - -## StandardMarketWithPriceLoggerFactory Functions - -### createMarket(*address* `eventContract`, *address* `marketMaker`, *uint24* `fee`, *uint256* `startDate`) - -- **State mutability**: `nonpayable` -- **Signature hash**: `8e44df53` - -Creates a new market contract - -#### Inputs - -| type | name | description | -| --------- | --------------- | ---------------------------- | -| *address* | `eventContract` | Event contract | -| *address* | `marketMaker` | Market maker contract | -| *uint24* | `fee` | Market fee | -| *uint256* | `startDate` | Start date for price logging | - -#### Outputs - -| type | name | description | -| --------- | -------- | --------------- | -| *address* | `market` | Market contract | diff --git a/docs/StandardToken.md b/docs/StandardToken.md deleted file mode 100644 index b6ebfa7..0000000 --- a/docs/StandardToken.md +++ /dev/null @@ -1,143 +0,0 @@ -* [StandardToken](#standardtoken) - * [Events](#standardtoken-events) - * [Transfer(*address* indexed `from`, *address* indexed `to`, *uint256* `value`)](#transferaddress-indexed-from-address-indexed-to-uint256-value) - * [Approval(*address* indexed `owner`, *address* indexed `spender`, *uint256* `value`)](#approvaladdress-indexed-owner-address-indexed-spender-uint256-value) - * [Functions](#standardtoken-functions) - * [approve(*address* `spender`, *uint256* `value`)](#approveaddress-spender-uint256-value) - * [totalSupply()](#totalsupply) - * [transferFrom(*address* `from`, *address* `to`, *uint256* `value`)](#transferfromaddress-from-address-to-uint256-value) - * [balanceOf(*address* `owner`)](#balanceofaddress-owner) - * [transfer(*address* `to`, *uint256* `value`)](#transferaddress-to-uint256-value) - * [allowance(*address* `owner`, *address* `spender`)](#allowanceaddress-owner-address-spender) - -# StandardToken - -### Standard token contract with overflow protection - -- **Constructor**: StandardToken() -- This contract does **not** have a fallback function. - -## StandardToken Events - -### Transfer(*address* indexed `from`, *address* indexed `to`, *uint256* `value`) - -**Signature hash**: `ddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef` - -### Approval(*address* indexed `owner`, *address* indexed `spender`, *uint256* `value`) - -**Signature hash**: `8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925` - -## StandardToken Functions - -### approve(*address* `spender`, *uint256* `value`) - -- **State mutability**: `nonpayable` -- **Signature hash**: `095ea7b3` - -Sets approved amount of tokens for spender. Returns success - -#### Inputs - -| type | name | description | -| --------- | --------- | -------------------------- | -| *address* | `spender` | Address of allowed account | -| *uint256* | `value` | Number of approved tokens | - -#### Outputs - -| type | description | -| ------ | ------------------------ | -| *bool* | Was approval successful? | - -### totalSupply() - -- **State mutability**: `view` -- **Signature hash**: `18160ddd` - -Returns total supply of tokens - -#### Outputs - -| type | description | -| --------- | ------------ | -| *uint256* | Total supply | - -### transferFrom(*address* `from`, *address* `to`, *uint256* `value`) - -- **State mutability**: `nonpayable` -- **Signature hash**: `23b872dd` - -Allows allowed third party to transfer tokens from one address to another. Returns success - -#### Inputs - -| type | name | description | -| --------- | ------- | --------------------------------------- | -| *address* | `from` | Address from where tokens are withdrawn | -| *address* | `to` | Address to where tokens are sent | -| *uint256* | `value` | Number of tokens to transfer | - -#### Outputs - -| type | description | -| ------ | ------------------------ | -| *bool* | Was transfer successful? | - -### balanceOf(*address* `owner`) - -- **State mutability**: `view` -- **Signature hash**: `70a08231` - -Returns number of tokens owned by given address - -#### Inputs - -| type | name | description | -| --------- | ------- | ---------------------- | -| *address* | `owner` | Address of token owner | - -#### Outputs - -| type | description | -| --------- | ---------------- | -| *uint256* | Balance of owner | - -### transfer(*address* `to`, *uint256* `value`) - -- **State mutability**: `nonpayable` -- **Signature hash**: `a9059cbb` - -Transfers sender's tokens to a given address. Returns success - -#### Inputs - -| type | name | description | -| --------- | ------- | ---------------------------- | -| *address* | `to` | Address of token receiver | -| *uint256* | `value` | Number of tokens to transfer | - -#### Outputs - -| type | description | -| ------ | ------------------------ | -| *bool* | Was transfer successful? | - -### allowance(*address* `owner`, *address* `spender`) - -- **State mutability**: `view` -- **Signature hash**: `dd62ed3e` - -Returns number of allowed tokens for given address - -#### Inputs - -| type | name | description | -| --------- | --------- | ------------------------ | -| *address* | `owner` | Address of token owner | -| *address* | `spender` | Address of token spender | - -#### Outputs - -| type | description | -| --------- | ------------------------------- | -| *uint256* | Remaining allowance for spender | diff --git a/docs/Token.md b/docs/Token.md deleted file mode 100644 index e890306..0000000 --- a/docs/Token.md +++ /dev/null @@ -1,124 +0,0 @@ -* [Token](#token) - * [Accessors](#token-accessors) - * [Events](#token-events) - * [Transfer(*address* indexed `from`, *address* indexed `to`, *uint256* `value`)](#transferaddress-indexed-from-address-indexed-to-uint256-value) - * [Approval(*address* indexed `owner`, *address* indexed `spender`, *uint256* `value`)](#approvaladdress-indexed-owner-address-indexed-spender-uint256-value) - * [Functions](#token-functions) - * [approve(*address* `spender`, *uint256* `value`)](#approveaddress-spender-uint256-value) - * [transferFrom(*address* `from`, *address* `to`, *uint256* `value`)](#transferfromaddress-from-address-to-uint256-value) - * [balanceOf(*address* `owner`)](#balanceofaddress-owner) - * [transfer(*address* `to`, *uint256* `value`)](#transferaddress-to-uint256-value) - * [allowance(*address* `owner`, *address* `spender`)](#allowanceaddress-owner-address-spender) - -# Token - -### Abstract token contract - Functions to be implemented by token contracts - -- **Constructor**: Token() -- This contract does **not** have a fallback function. - -## Token Accessors - -* *uint256* totalSupply() `18160ddd` - -## Token Events - -### Transfer(*address* indexed `from`, *address* indexed `to`, *uint256* `value`) - -**Signature hash**: `ddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef` - -### Approval(*address* indexed `owner`, *address* indexed `spender`, *uint256* `value`) - -**Signature hash**: `8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925` - -## Token Functions - -### approve(*address* `spender`, *uint256* `value`) - -- **State mutability**: `nonpayable` -- **Signature hash**: `095ea7b3` - -#### Inputs - -| type | name | -| --------- | --------- | -| *address* | `spender` | -| *uint256* | `value` | - -#### Outputs - -| type | -| ------ | -| *bool* | - -### transferFrom(*address* `from`, *address* `to`, *uint256* `value`) - -- **State mutability**: `nonpayable` -- **Signature hash**: `23b872dd` - -#### Inputs - -| type | name | -| --------- | ------- | -| *address* | `from` | -| *address* | `to` | -| *uint256* | `value` | - -#### Outputs - -| type | -| ------ | -| *bool* | - -### balanceOf(*address* `owner`) - -- **State mutability**: `view` -- **Signature hash**: `70a08231` - -#### Inputs - -| type | name | -| --------- | ------- | -| *address* | `owner` | - -#### Outputs - -| type | -| --------- | -| *uint256* | - -### transfer(*address* `to`, *uint256* `value`) - -- **State mutability**: `nonpayable` -- **Signature hash**: `a9059cbb` - -#### Inputs - -| type | name | -| --------- | ------- | -| *address* | `to` | -| *uint256* | `value` | - -#### Outputs - -| type | -| ------ | -| *bool* | - -### allowance(*address* `owner`, *address* `spender`) - -- **State mutability**: `view` -- **Signature hash**: `dd62ed3e` - -#### Inputs - -| type | name | -| --------- | --------- | -| *address* | `owner` | -| *address* | `spender` | - -#### Outputs - -| type | -| --------- | -| *uint256* | diff --git a/docs/UltimateOracle.md b/docs/UltimateOracle.md deleted file mode 100644 index bd8ad51..0000000 --- a/docs/UltimateOracle.md +++ /dev/null @@ -1,173 +0,0 @@ -* [UltimateOracle](#ultimateoracle) - * [Accessors](#ultimateoracle-accessors) - * [Events](#ultimateoracle-events) - * [ForwardedOracleOutcomeAssignment(*int256* `outcome`)](#forwardedoracleoutcomeassignmentint256-outcome) - * [OutcomeChallenge(*address* indexed `sender`, *int256* `outcome`)](#outcomechallengeaddress-indexed-sender-int256-outcome) - * [OutcomeVote(*address* indexed `sender`, *int256* `outcome`, *uint256* `amount`)](#outcomevoteaddress-indexed-sender-int256-outcome-uint256-amount) - * [Withdrawal(*address* indexed `sender`, *uint256* `amount`)](#withdrawaladdress-indexed-sender-uint256-amount) - * [Functions](#ultimateoracle-functions) - * [isFrontRunnerPeriodOver()](#isfrontrunnerperiodover) - * [withdraw()](#withdraw) - * [isChallengePeriodOver()](#ischallengeperiodover) - * [setForwardedOutcome()](#setforwardedoutcome) - * [getOutcome()](#getoutcome) - * [isChallenged()](#ischallenged) - * [challengeOutcome(*int256* `_outcome`)](#challengeoutcomeint256-_outcome) - * [isOutcomeSet()](#isoutcomeset) - * [voteForOutcome(*int256* `_outcome`, *uint256* `amount`)](#voteforoutcomeint256-_outcome-uint256-amount) - -# UltimateOracle - -### Ultimate oracle contract - Allows to swap oracle result for ultimate oracle result - -- **Author**: Stefan George - -- **Constructor**: UltimateOracle(*address* `_forwardedOracle`, *address* `_collateralToken`, *uint8* `_spreadMultiplier`, *uint256* `_challengePeriod`, *uint256* `_challengeAmount`, *uint256* `_frontRunnerPeriod`) -- This contract does **not** have a fallback function. - -## UltimateOracle Accessors - -* *address* forwardedOracle() `061a85c7` -* *uint256* frontRunnerPeriod() `0853f7eb` -* *int256* frontRunner() `0f3e9438` -* *uint256* totalAmount() `1a39d8ef` -* *uint256* totalOutcomeAmounts(*int256*) `1ff14311` -* *uint256* forwardedOutcomeSetTimestamp() `466ae314` -* *uint256* frontRunnerSetTimestamp() `8ef8125e` -* *int256* forwardedOutcome() `984a470a` -* *uint256* challengeAmount() `9d89e7d4` -* *address* collateralToken() `b2016bd4` -* *uint256* outcomeAmounts(*address*, *int256*) `c427af9b` -* *uint8* spreadMultiplier() `d84d2a47` -* *uint256* challengePeriod() `f3f480d9` - -## UltimateOracle Events - -### ForwardedOracleOutcomeAssignment(*int256* `outcome`) - -**Signature hash**: `6eab3db94ac766c1ac203bcd9c9636476993422eaa067ad449e20ce8501b2a8f` - -### OutcomeChallenge(*address* indexed `sender`, *int256* `outcome`) - -**Signature hash**: `d0fdeb84e66d569a89718f40a99496b38d6c13249a9c9f623fbaa3d8ef343a9d` - -### OutcomeVote(*address* indexed `sender`, *int256* `outcome`, *uint256* `amount`) - -**Signature hash**: `86fa706979a07f1dd01a49718016881d95ada425549c353ec9e55a627b98a93b` - -### Withdrawal(*address* indexed `sender`, *uint256* `amount`) - -**Signature hash**: `7fcf532c15f0a6db0bd6d0e038bea71d30d808c7d98cb3bf7268a95bf5081b65` - -## UltimateOracle Functions - -### isFrontRunnerPeriodOver() - -- **State mutability**: `nonpayable` -- **Signature hash**: `1a4f5b67` - -Checks if time to overbid the front runner is over - -#### Outputs - -| type | description | -| ------ | ---------------------------- | -| *bool* | Is front runner period over? | - -### withdraw() - -- **State mutability**: `nonpayable` -- **Signature hash**: `3ccfd60b` - -Withdraws winnings for user - -#### Outputs - -| type | name | description | -| --------- | -------- | ----------- | -| *uint256* | `amount` | Winnings | - -### isChallengePeriodOver() - -- **State mutability**: `nonpayable` -- **Signature hash**: `72b8de14` - -Checks if time to challenge the outcome is over - -#### Outputs - -| type | description | -| ------ | ------------------------- | -| *bool* | Is challenge period over? | - -### setForwardedOutcome() - -- **State mutability**: `nonpayable` -- **Signature hash**: `739b8c48` - -Allows to set oracle outcome - -### getOutcome() - -- **State mutability**: `view` -- **Signature hash**: `7e7e4b47` - -Returns winning outcome - -#### Outputs - -| type | description | -| -------- | ----------- | -| *int256* | Outcome | - -### isChallenged() - -- **State mutability**: `nonpayable` -- **Signature hash**: `9df4d0fe` - -Checks if outcome was challenged - -#### Outputs - -| type | description | -| ------ | -------------- | -| *bool* | Is challenged? | - -### challengeOutcome(*int256* `_outcome`) - -- **State mutability**: `nonpayable` -- **Signature hash**: `9f0de490` - -Allows to challenge the oracle outcome - -#### Inputs - -| type | name | description | -| -------- | ---------- | ----------------- | -| *int256* | `_outcome` | Outcome to bid on | - -### isOutcomeSet() - -- **State mutability**: `view` -- **Signature hash**: `ccdf68f3` - -Returns if winning outcome is set - -#### Outputs - -| type | description | -| ------ | --------------- | -| *bool* | Is outcome set? | - -### voteForOutcome(*int256* `_outcome`, *uint256* `amount`) - -- **State mutability**: `nonpayable` -- **Signature hash**: `f7553098` - -Allows to challenge the oracle outcome - -#### Inputs - -| type | name | description | -| --------- | ---------- | ----------------- | -| *int256* | `_outcome` | Outcome to bid on | -| *uint256* | `amount` | Amount to bid | diff --git a/docs/UltimateOracleFactory.md b/docs/UltimateOracleFactory.md deleted file mode 100644 index d4e00be..0000000 --- a/docs/UltimateOracleFactory.md +++ /dev/null @@ -1,45 +0,0 @@ -* [UltimateOracleFactory](#ultimateoraclefactory) - * [Events](#ultimateoraclefactory-events) - * [UltimateOracleCreation(*address* indexed `creator`, *address* `ultimateOracle`, *address* `oracle`, *address* `collateralToken`, *uint8* `spreadMultiplier`, *uint256* `challengePeriod`, *uint256* `challengeAmount`, *uint256* `frontRunnerPeriod`)](#ultimateoraclecreationaddress-indexed-creator-address-ultimateoracle-address-oracle-address-collateraltoken-uint8-spreadmultiplier-uint256-challengeperiod-uint256-challengeamount-uint256-frontrunnerperiod) - * [Functions](#ultimateoraclefactory-functions) - * [createUltimateOracle(*address* `oracle`, *address* `collateralToken`, *uint8* `spreadMultiplier`, *uint256* `challengePeriod`, *uint256* `challengeAmount`, *uint256* `frontRunnerPeriod`)](#createultimateoracleaddress-oracle-address-collateraltoken-uint8-spreadmultiplier-uint256-challengeperiod-uint256-challengeamount-uint256-frontrunnerperiod) - -# UltimateOracleFactory - -### Ultimate oracle factory contract - Allows to create ultimate oracle contracts - -- **Author**: Stefan George - -- **Constructor**: UltimateOracleFactory() -- This contract does **not** have a fallback function. - -## UltimateOracleFactory Events - -### UltimateOracleCreation(*address* indexed `creator`, *address* `ultimateOracle`, *address* `oracle`, *address* `collateralToken`, *uint8* `spreadMultiplier`, *uint256* `challengePeriod`, *uint256* `challengeAmount`, *uint256* `frontRunnerPeriod`) - -**Signature hash**: `e6ae2b8211e9721c5dae1d93f70be0ba07bd111608ba4db4317742e1a87fff40` - -## UltimateOracleFactory Functions - -### createUltimateOracle(*address* `oracle`, *address* `collateralToken`, *uint8* `spreadMultiplier`, *uint256* `challengePeriod`, *uint256* `challengeAmount`, *uint256* `frontRunnerPeriod`) - -- **State mutability**: `nonpayable` -- **Signature hash**: `ce70faec` - -Creates a new ultimate Oracle contract - -#### Inputs - -| type | name | description | -| --------- | ------------------- | ------------------------------------------------------------------- | -| *address* | `oracle` | Oracle address | -| *address* | `collateralToken` | Collateral token address | -| *uint8* | `spreadMultiplier` | Defines the spread as a multiple of the money bet on other outcomes | -| *uint256* | `challengePeriod` | Time to challenge oracle outcome | -| *uint256* | `challengeAmount` | Amount to challenge the outcome | -| *uint256* | `frontRunnerPeriod` | Time to overbid the front-runner | - -#### Outputs - -| type | name | description | -| --------- | ---------------- | --------------- | -| *address* | `ultimateOracle` | Oracle contract | diff --git a/docs/_config.yml b/docs/_config.yml deleted file mode 100644 index 9da9a02..0000000 --- a/docs/_config.yml +++ /dev/null @@ -1 +0,0 @@ -theme: jekyll-theme-dinky \ No newline at end of file diff --git a/docs/requirements.txt b/docs/requirements.txt new file mode 100644 index 0000000..a4db202 --- /dev/null +++ b/docs/requirements.txt @@ -0,0 +1,4 @@ +sphinx +sphinx-autobuild +sphinx_rtd_theme +recommonmark diff --git a/docs/source/.gitignore b/docs/source/.gitignore new file mode 100644 index 0000000..e35d885 --- /dev/null +++ b/docs/source/.gitignore @@ -0,0 +1 @@ +_build diff --git a/docs/source/Campaign.rst b/docs/source/Campaign.rst new file mode 100644 index 0000000..b90489c --- /dev/null +++ b/docs/source/Campaign.rst @@ -0,0 +1,165 @@ +Campaign +======== + +- `Campaign <#campaign>`__ + + - `Accessors <#accessors>`__ + - `Events <#events>`__ + + - `CampaignFunding <#campaignfunding-address-indexed-sender-uint256-funding>`__\ (*address* + indexed ``sender``, *uint256* ``funding``) + - `CampaignRefund <#campaignrefund-address-indexed-sender-uint256-refund>`__\ (*address* + indexed ``sender``, *uint256* ``refund``) + - `MarketCreation <#marketcreation-address-indexed-market>`__\ (*address* + indexed ``market``) + - `MarketClosing <#marketclosing>`__\ () + - `FeeWithdrawal <#feewithdrawal-address-indexed-receiver-uint256-fees>`__\ (*address* + indexed ``receiver``, *uint256* ``fees``) + + - `Functions <#functions>`__ + + - `withdrawFees <#withdrawfees>`__\ () + - `refund <#refund>`__\ () + - `createMarket <#createmarket>`__\ () + - `closeMarket <#closemarket>`__\ () + - `fund <#fund-uint256-amount>`__\ (*uint256* ``amount``) + +Campaign contract - Allows to crowdfund a market +------------------------------------------------ + +- **Author**: Stefan George - stefan@gnosis.pm +- **Constructor**: Campaign(\ *address* ``_eventContract``, *address* + ``_marketFactory``, *address* ``_marketMaker``, *uint24* ``_fee``, + *uint256* ``_funding``, *uint256* ``_deadline``) +- This contract does **not** have a fallback function. + +Accessors +--------- + +- *address* marketFactory() ``06ae7095`` +- *address* marketMaker() ``1f21f9af`` +- *uint256* finalBalance() ``2129e25a`` +- *uint256* deadline() ``29dcb0cf`` +- *uint256* contributions(\ *address*) ``42e94c90`` +- *address* market() ``80f55605`` +- *uint8* stage() ``c040e6b8`` +- *uint256* funding() ``cb4c86b7`` +- *uint24* fee() ``ddca3f43`` +- *address* eventContract() ``e274fd24`` +- *uint24* FEE_RANGE() ``fbde47f6`` + +Events +------ + +CampaignFunding(\ *address* indexed ``sender``, *uint256* ``funding``) +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +**Signature hash**: +``9e85601c404591b54325b6512021f8145643571c59865b7ab29ed9e0664cb17f`` + +CampaignRefund(\ *address* indexed ``sender``, *uint256* ``refund``) +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +**Signature hash**: +``d53235e384e83b261994d71b101de6c22402415c0c0d313f064a90e91039e2a9`` + +MarketCreation(\ *address* indexed ``market``) +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +**Signature hash**: +``d50a500cb3b7c976a045df06de01ca42c942e1a2c43ac27d96bfa7ece3138a99`` + +MarketClosing() +~~~~~~~~~~~~~~~ + +**Signature hash**: +``e7d85885f81486e8f4c99e50e056745493861b8b5d4f973dcf0c3c0f74a25e07`` + +FeeWithdrawal(\ *address* indexed ``receiver``, *uint256* ``fees``) +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +**Signature hash**: +``ee33a3a9cb48e4ff209f8b1c67c4632f1dbbf55aeff8e6f17d957ade7a6fb17c`` + +Functions +--------- + +withdrawFees() +~~~~~~~~~~~~~~ + +- **State mutability**: ``nonpayable`` +- **Signature hash**: ``476343ee`` + +Allows to withdraw fees from campaign contract to contributor + +Outputs +^^^^^^^ + ++-----------+----------+-------------+ +| type | name | description | ++===========+==========+=============+ +| *uint256* | ``fees`` | Fee amount | ++-----------+----------+-------------+ + +refund() +~~~~~~~~ + +- **State mutability**: ``nonpayable`` +- **Signature hash**: ``590e1ae3`` + +Withdraws refund amount + +.. _outputs-1: + +Outputs +^^^^^^^ + ++-----------+------------------+---------------+ +| type | name | description | ++===========+==================+===============+ +| *uint256* | ``refundAmount`` | Refund amount | ++-----------+------------------+---------------+ + +createMarket() +~~~~~~~~~~~~~~ + +- **State mutability**: ``nonpayable`` +- **Signature hash**: ``aea0e35f`` + +Allows to create market after successful funding + +.. _outputs-2: + +Outputs +^^^^^^^ + ++-----------+----------------+ +| type | description | ++===========+================+ +| *address* | Market address | ++-----------+----------------+ + +closeMarket() +~~~~~~~~~~~~~ + +- **State mutability**: ``nonpayable`` +- **Signature hash**: ``c511ed5e`` + +Allows to withdraw fees from market contract to campaign contract + +fund(\ *uint256* ``amount``) +~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +- **State mutability**: ``nonpayable`` +- **Signature hash**: ``ca1d209d`` + +Allows to contribute to required market funding + +Inputs +^^^^^^ + ++-----------+------------+-----------------------------+ +| type | name | description | ++===========+============+=============================+ +| *uint256* | ``amount`` | Amount of collateral tokens | ++-----------+------------+-----------------------------+ diff --git a/docs/source/CampaignFactory.rst b/docs/source/CampaignFactory.rst new file mode 100644 index 0000000..9a10e54 --- /dev/null +++ b/docs/source/CampaignFactory.rst @@ -0,0 +1,74 @@ +CampaignFactory +=============== + +- `CampaignFactory <#campaignfactory>`__ + + - `Events <#events>`__ + + - `CampaignCreation <#campaigncreation-address-indexed-creator-address-campaign-address-eventcontract-address-marketfactory-address-marketmaker-uint24-fee-uint256-funding-uint256-deadline>`__\ (*address* + indexed ``creator``, *address* ``campaign``, *address* + ``eventContract``, *address* ``marketFactory``, *address* + ``marketMaker``, *uint24* ``fee``, *uint256* ``funding``, + *uint256* ``deadline``) + + - `Functions <#functions>`__ + + - `createCampaign <#createcampaign-address-eventcontract-address-marketfactory-address-marketmaker-uint24-fee-uint256-funding-uint256-deadline>`__\ (*address* + ``eventContract``, *address* ``marketFactory``, *address* + ``marketMaker``, *uint24* ``fee``, *uint256* ``funding``, + *uint256* ``deadline``) + +Campaign factory contract - Allows to create campaign contracts +--------------------------------------------------------------- + +- **Author**: Stefan George - stefan@gnosis.pm +- **Constructor**: CampaignFactory() +- This contract does **not** have a fallback function. + +Events +------ + +CampaignCreation(\ *address* indexed ``creator``, *address* ``campaign``, *address* ``eventContract``, *address* ``marketFactory``, *address* ``marketMaker``, *uint24* ``fee``, *uint256* ``funding``, *uint256* ``deadline``) +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +**Signature hash**: +``7a9fd19b658538a67209802dd9011d6e3ce04586fe93c87096d2bc40ed850866`` + +Functions +--------- + +createCampaign(\ *address* ``eventContract``, *address* ``marketFactory``, *address* ``marketMaker``, *uint24* ``fee``, *uint256* ``funding``, *uint256* ``deadline``) +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +- **State mutability**: ``nonpayable`` +- **Signature hash**: ``7d1ef569`` + +Creates a new campaign contract + +Inputs +^^^^^^ + ++-----------+-------------------+----------------------------+ +| type | name | description | ++===========+===================+============================+ +| *address* | ``eventContract`` | Event contract | ++-----------+-------------------+----------------------------+ +| *address* | ``marketFactory`` | Market factory contract | ++-----------+-------------------+----------------------------+ +| *address* | ``marketMaker`` | Market maker contract | ++-----------+-------------------+----------------------------+ +| *uint24* | ``fee`` | Market fee | ++-----------+-------------------+----------------------------+ +| *uint256* | ``funding`` | Initial funding for market | ++-----------+-------------------+----------------------------+ +| *uint256* | ``deadline`` | Campaign deadline | ++-----------+-------------------+----------------------------+ + +Outputs +^^^^^^^ + ++-----------+--------------+-----------------+ +| type | name | description | ++===========+==============+=================+ +| *address* | ``campaign`` | Market contract | ++-----------+--------------+-----------------+ diff --git a/docs/source/CategoricalEvent.rst b/docs/source/CategoricalEvent.rst new file mode 100644 index 0000000..6a1e227 --- /dev/null +++ b/docs/source/CategoricalEvent.rst @@ -0,0 +1,235 @@ +CategoricalEvent +================ + +- `CategoricalEvent <#categoricalevent>`__ + + - `Accessors <#accessors>`__ + - `Events <#events>`__ + + - `OutcomeTokenCreation <#outcometokencreation-address-outcometoken-uint8-index>`__\ (*address* + ``outcomeToken``, *uint8* ``index``) + - `OutcomeTokenSetIssuance <#outcometokensetissuance-address-indexed-buyer-uint256-collateraltokencount>`__\ (*address* + indexed ``buyer``, *uint256* ``collateralTokenCount``) + - `OutcomeTokenSetRevocation <#outcometokensetrevocation-address-indexed-seller-uint256-outcometokencount>`__\ (*address* + indexed ``seller``, *uint256* ``outcomeTokenCount``) + - `OutcomeAssignment <#outcomeassignment-int256-outcome>`__\ (*int256* + ``outcome``) + - `WinningsRedemption <#winningsredemption-address-indexed-receiver-uint256-winnings>`__\ (*address* + indexed ``receiver``, *uint256* ``winnings``) + + - `Functions <#functions>`__ + + - `setOutcome <#setoutcome>`__\ () + - `buyAllOutcomes <#buyalloutcomes-uint256-collateraltokencount>`__\ (*uint256* + ``collateralTokenCount``) + - `getOutcomeTokenDistribution <#getoutcometokendistribution-address-owner>`__\ (*address* + ``owner``) + - `sellAllOutcomes <#sellalloutcomes-uint256-outcometokencount>`__\ (*uint256* + ``outcomeTokenCount``) + - `getOutcomeCount <#getoutcomecount>`__\ () + - `redeemWinnings <#redeemwinnings>`__\ () + - `getEventHash <#geteventhash>`__\ () + - `getOutcomeTokens <#getoutcometokens>`__\ () + +Categorical event contract - Categorical events resolve to an outcome from a set of outcomes +-------------------------------------------------------------------------------------------- + +- **Author**: Stefan George - stefan@gnosis.pm +- **Constructor**: CategoricalEvent(\ *address* ``_collateralToken``, + *address* ``_oracle``, *uint8* ``outcomeCount``) +- This contract does **not** have a fallback function. + +Accessors +--------- + +- *int256* outcome() ``27793f87`` +- *address* oracle() ``7dc0d1d0`` +- *address* outcomeTokens(\ *uint256*) ``8abe59ea`` +- *address* collateralToken() ``b2016bd4`` +- *bool* isOutcomeSet() ``ccdf68f3`` + +Events +------ + +OutcomeTokenCreation(\ *address* ``outcomeToken``, *uint8* ``index``) +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +**Signature hash**: +``ad24776dc347085865b6988e249c191fc22d9b31cf54cb62233c3c16be1736ee`` + +OutcomeTokenSetIssuance(\ *address* indexed ``buyer``, *uint256* ``collateralTokenCount``) +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +**Signature hash**: +``ad2a02292986148558019ae4abf172732228e32e131a91d3fa7e0cada61932c0`` + +OutcomeTokenSetRevocation(\ *address* indexed ``seller``, *uint256* ``outcomeTokenCount``) +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +**Signature hash**: +``7ac9271efd660c24459c447459e46f7366d2b4a692e572f108619d0d7273fcc5`` + +OutcomeAssignment(\ *int256* ``outcome``) +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +**Signature hash**: +``b1aaa9f4484acc283375c8e495a44766e4026170797dc9280b4ae2ab5632fb71`` + +WinningsRedemption(\ *address* indexed ``receiver``, *uint256* ``winnings``) +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +**Signature hash**: +``2fe921bb50a459800ae7eae7c0124e9e875094a539eb7dc5b3f728017347e0fb`` + +Functions +--------- + +setOutcome() +~~~~~~~~~~~~ + +- **State mutability**: ``nonpayable`` +- **Signature hash**: ``0537665d`` + +Sets winning event outcome + +buyAllOutcomes(\ *uint256* ``collateralTokenCount``) +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +- **State mutability**: ``nonpayable`` +- **Signature hash**: ``28da850b`` + +Buys equal number of tokens of all outcomes, exchanging collateral +tokens and sets of outcome tokens 1:1 + +Inputs +^^^^^^ + ++-----------+--------------------------+-----------------------------+ +| type | name | description | ++===========+==========================+=============================+ +| *uint256* | ``collateralTokenCount`` | Number of collateral tokens | ++-----------+--------------------------+-----------------------------+ + +getOutcomeTokenDistribution(\ *address* ``owner``) +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +- **State mutability**: ``view`` +- **Signature hash**: ``69c19d4c`` + +Returns the amount of outcome tokens held by owner + +.. _inputs-1: + +Inputs +^^^^^^ + ++-----------+-----------+ +| type | name | ++===========+===========+ +| *address* | ``owner`` | ++-----------+-----------+ + +Outputs +^^^^^^^ + ++-------------+------------------------------+----------------------------+ +| type | name | description | ++=============+==============================+============================+ +| *uint256[]* | ``outcomeTokenDistribution`` | Outcome token distribution | ++-------------+------------------------------+----------------------------+ + +sellAllOutcomes(\ *uint256* ``outcomeTokenCount``) +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +- **State mutability**: ``nonpayable`` +- **Signature hash**: ``6fb1edcd`` + +Sells equal number of tokens of all outcomes, exchanging collateral +tokens and sets of outcome tokens 1:1 + +.. _inputs-2: + +Inputs +^^^^^^ + ++-----------+-----------------------+--------------------------+ +| type | name | description | ++===========+=======================+==========================+ +| *uint256* | ``outcomeTokenCount`` | Number of outcome tokens | ++-----------+-----------------------+--------------------------+ + +getOutcomeCount() +~~~~~~~~~~~~~~~~~ + +- **State mutability**: ``view`` +- **Signature hash**: ``7dc8f086`` + +Returns outcome count + +.. _outputs-1: + +Outputs +^^^^^^^ + ++---------+---------------+ +| type | description | ++=========+===============+ +| *uint8* | Outcome count | ++---------+---------------+ + +redeemWinnings() +~~~~~~~~~~~~~~~~ + +- **State mutability**: ``nonpayable`` +- **Signature hash**: ``ad0b2bec`` + +Exchanges sender’s winning outcome tokens for collateral tokens + +.. _outputs-2: + +Outputs +^^^^^^^ + ++-----------+--------------+-------------------+ +| type | name | description | ++===========+==============+===================+ +| *uint256* | ``winnings`` | Sender’s winnings | ++-----------+--------------+-------------------+ + +getEventHash() +~~~~~~~~~~~~~~ + +- **State mutability**: ``view`` +- **Signature hash**: ``e96e5950`` + +Calculates and returns event hash + +.. _outputs-3: + +Outputs +^^^^^^^ + ++-----------+-------------+ +| type | description | ++===========+=============+ +| *bytes32* | Event hash | ++-----------+-------------+ + +getOutcomeTokens() +~~~~~~~~~~~~~~~~~~ + +- **State mutability**: ``view`` +- **Signature hash**: ``f21a1468`` + +Returns outcome tokens array + +.. _outputs-4: + +Outputs +^^^^^^^ + ++-------------+----------------+ +| type | description | ++=============+================+ +| *address[]* | Outcome tokens | ++-------------+----------------+ diff --git a/docs/source/CentralizedOracle.rst b/docs/source/CentralizedOracle.rst new file mode 100644 index 0000000..1b36fc8 --- /dev/null +++ b/docs/source/CentralizedOracle.rst @@ -0,0 +1,127 @@ +CentralizedOracle +================= + +- `CentralizedOracle <#centralizedoracle>`__ + + - `Accessors <#accessors>`__ + - `Events <#events>`__ + + - `OwnerReplacement <#ownerreplacement-address-indexed-newowner>`__\ (*address* + indexed ``newOwner``) + - `OutcomeAssignment <#outcomeassignment-int256-outcome>`__\ (*int256* + ``outcome``) + + - `Functions <#functions>`__ + + - `setOutcome <#setoutcome-int256-_outcome>`__\ (*int256* + ``_outcome``) + - `getOutcome <#getoutcome>`__\ () + - `replaceOwner <#replaceowner-address-newowner>`__\ (*address* + ``newOwner``) + - `isOutcomeSet <#isoutcomeset>`__\ () + +Centralized oracle contract - Allows the contract owner to set an outcome +------------------------------------------------------------------------- + +- **Author**: Stefan George - stefan@gnosis.pm +- **Constructor**: CentralizedOracle(\ *address* ``_owner``, *bytes* + ``_ipfsHash``) +- This contract does **not** have a fallback function. + +Accessors +--------- + +- *int256* outcome() ``27793f87`` +- *address* owner() ``8da5cb5b`` +- *bytes* ipfsHash() ``c623674f`` +- *bool* isSet() ``c65fb380`` + +Events +------ + +OwnerReplacement(\ *address* indexed ``newOwner``) +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +**Signature hash**: +``191a2405c52452c381a62f3b7480f9d3e77a76d7737659fc1030aff54b395dd5`` + +OutcomeAssignment(\ *int256* ``outcome``) +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +**Signature hash**: +``b1aaa9f4484acc283375c8e495a44766e4026170797dc9280b4ae2ab5632fb71`` + +Functions +--------- + +setOutcome(\ *int256* ``_outcome``) +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +- **State mutability**: ``nonpayable`` +- **Signature hash**: ``717a195a`` + +Sets event outcome + +Inputs +^^^^^^ + ++----------+--------------+---------------+ +| type | name | description | ++==========+==============+===============+ +| *int256* | ``_outcome`` | Event outcome | ++----------+--------------+---------------+ + +getOutcome() +~~~~~~~~~~~~ + +- **State mutability**: ``view`` +- **Signature hash**: ``7e7e4b47`` + +Returns outcome + +Outputs +^^^^^^^ + ++----------+-------------+ +| type | description | ++==========+=============+ +| *int256* | Outcome | ++----------+-------------+ + +replaceOwner(\ *address* ``newOwner``) +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +- **State mutability**: ``nonpayable`` +- **Signature hash**: ``a39a45b7`` + +Replaces owner + +.. _inputs-1: + +Inputs +^^^^^^ + ++-----------+--------------+-------------+ +| type | name | description | ++===========+==============+=============+ +| *address* | ``newOwner`` | New owner | ++-----------+--------------+-------------+ + +isOutcomeSet() +~~~~~~~~~~~~~~ + +- **State mutability**: ``view`` +- **Signature hash**: ``ccdf68f3`` + +Returns if winning outcome is set + +.. _outputs-1: + +Outputs +^^^^^^^ + ++--------+-----------------+ +| type | description | ++========+=================+ +| *bool* | Is outcome set? | ++--------+-----------------+ diff --git a/docs/source/CentralizedOracleFactory.rst b/docs/source/CentralizedOracleFactory.rst new file mode 100644 index 0000000..b6c0669 --- /dev/null +++ b/docs/source/CentralizedOracleFactory.rst @@ -0,0 +1,60 @@ +CentralizedOracleFactory +======================== + +- `CentralizedOracleFactory <#centralizedoraclefactory>`__ + + - `Events <#events>`__ + + - `CentralizedOracleCreation <#centralizedoraclecreation-address-indexed-creator-address-centralizedoracle-bytes-ipfshash>`__\ (*address* + indexed ``creator``, *address* ``centralizedOracle``, *bytes* + ``ipfsHash``) + + - `Functions <#functions>`__ + + - `createCentralizedOracle <#createcentralizedoracle-bytes-ipfshash>`__\ (*bytes* + ``ipfsHash``) + +Centralized oracle factory contract - Allows to create centralized oracle contracts +----------------------------------------------------------------------------------- + +- **Author**: Stefan George - stefan@gnosis.pm +- **Constructor**: CentralizedOracleFactory() +- This contract does **not** have a fallback function. + +Events +------ + +CentralizedOracleCreation(\ *address* indexed ``creator``, *address* ``centralizedOracle``, *bytes* ``ipfsHash``) +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +**Signature hash**: +``33a1926cf5c2f7306ac1685bf19260d678fea874f5f59c00b69fa5e2643ecfd2`` + +Functions +--------- + +createCentralizedOracle(\ *bytes* ``ipfsHash``) +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +- **State mutability**: ``nonpayable`` +- **Signature hash**: ``4e2f220c`` + +Creates a new centralized oracle contract + +Inputs +^^^^^^ + ++---------+--------------+----------------------------------------------+ +| type | name | description | ++=========+==============+==============================================+ +| *bytes* | ``ipfsHash`` | Hash identifying off chain event description | ++---------+--------------+----------------------------------------------+ + +Outputs +^^^^^^^ + ++-----------+-----------------------+-----------------+ +| type | name | description | ++===========+=======================+=================+ +| *address* | ``centralizedOracle`` | Oracle contract | ++-----------+-----------------------+-----------------+ diff --git a/docs/source/DifficultyOracle.rst b/docs/source/DifficultyOracle.rst new file mode 100644 index 0000000..a7214f1 --- /dev/null +++ b/docs/source/DifficultyOracle.rst @@ -0,0 +1,85 @@ +DifficultyOracle +================ + +- `DifficultyOracle <#difficultyoracle>`__ + + - `Accessors <#accessors>`__ + - `Events <#events>`__ + + - `OutcomeAssignment <#outcomeassignment-uint256-difficulty>`__\ (*uint256* + ``difficulty``) + + - `Functions <#functions>`__ + + - `setOutcome <#setoutcome>`__\ () + - `getOutcome <#getoutcome>`__\ () + - `isOutcomeSet <#isoutcomeset>`__\ () + +Difficulty oracle contract - Oracle to resolve difficulty events at given block +------------------------------------------------------------------------------- + +- **Author**: Stefan George - stefan@gnosis.pm +- **Constructor**: DifficultyOracle(\ *uint256* ``_blockNumber``) +- This contract does **not** have a fallback function. + +Accessors +--------- + +- *uint256* difficulty() ``19cae462`` +- *uint256* blockNumber() ``57e871e7`` + +Events +------ + +OutcomeAssignment(\ *uint256* ``difficulty``) +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +**Signature hash**: +``39972cb21edd888c2061a2b4b37874524bbc055cfeaa3054682ba5369f5029aa`` + +Functions +--------- + +setOutcome() +~~~~~~~~~~~~ + +- **State mutability**: ``nonpayable`` +- **Signature hash**: ``0537665d`` + +Sets difficulty as winning outcome for specified block + +getOutcome() +~~~~~~~~~~~~ + +- **State mutability**: ``view`` +- **Signature hash**: ``7e7e4b47`` + +Returns difficulty + +Outputs +^^^^^^^ + ++----------+-------------+ +| type | description | ++==========+=============+ +| *int256* | Outcome | ++----------+-------------+ + +isOutcomeSet() +~~~~~~~~~~~~~~ + +- **State mutability**: ``view`` +- **Signature hash**: ``ccdf68f3`` + +Returns if difficulty is set + +.. _outputs-1: + +Outputs +^^^^^^^ + ++--------+-----------------+ +| type | description | ++========+=================+ +| *bool* | Is outcome set? | ++--------+-----------------+ diff --git a/docs/source/DifficultyOracleFactory.rst b/docs/source/DifficultyOracleFactory.rst new file mode 100644 index 0000000..c878680 --- /dev/null +++ b/docs/source/DifficultyOracleFactory.rst @@ -0,0 +1,60 @@ +DifficultyOracleFactory +======================= + +- `DifficultyOracleFactory <#difficultyoraclefactory>`__ + + - `Events <#events>`__ + + - `DifficultyOracleCreation <#difficultyoraclecreation-address-indexed-creator-address-difficultyoracle-uint256-blocknumber>`__\ (*address* + indexed ``creator``, *address* ``difficultyOracle``, *uint256* + ``blockNumber``) + + - `Functions <#functions>`__ + + - `createDifficultyOracle <#createdifficultyoracle-uint256-blocknumber>`__\ (*uint256* + ``blockNumber``) + +Difficulty oracle factory contract - Allows to create difficulty oracle contracts +--------------------------------------------------------------------------------- + +- **Author**: Stefan George - stefan@gnosis.pm +- **Constructor**: DifficultyOracleFactory() +- This contract does **not** have a fallback function. + +Events +------ + +DifficultyOracleCreation(\ *address* indexed ``creator``, *address* ``difficultyOracle``, *uint256* ``blockNumber``) +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +**Signature hash**: +``83ecbb7b33dba848fcbd61d437ac02705db443e66f76ce6be0cf3415d07ab17f`` + +Functions +--------- + +createDifficultyOracle(\ *uint256* ``blockNumber``) +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +- **State mutability**: ``nonpayable`` +- **Signature hash**: ``9d5f2422`` + +Creates a new difficulty oracle contract + +Inputs +^^^^^^ + ++-----------+-----------------+---------------------+ +| type | name | description | ++===========+=================+=====================+ +| *uint256* | ``blockNumber`` | Target block number | ++-----------+-----------------+---------------------+ + +Outputs +^^^^^^^ + ++-----------+----------------------+-----------------+ +| type | name | description | ++===========+======================+=================+ +| *address* | ``difficultyOracle`` | Oracle contract | ++-----------+----------------------+-----------------+ diff --git a/docs/source/EtherToken.rst b/docs/source/EtherToken.rst new file mode 100644 index 0000000..0cb80e1 --- /dev/null +++ b/docs/source/EtherToken.rst @@ -0,0 +1,280 @@ +EtherToken +========== + +- `EtherToken <#ethertoken>`__ + + - `Accessors <#accessors>`__ + - `Events <#events>`__ + + - `Deposit <#deposit-address-indexed-sender-uint256-value>`__\ (*address* + indexed ``sender``, *uint256* ``value``) + - `Withdrawal <#withdrawal-address-indexed-receiver-uint256-value>`__\ (*address* + indexed ``receiver``, *uint256* ``value``) + - `Transfer <#transfer-address-indexed-from-address-indexed-to-uint256-value>`__\ (*address* + indexed ``from``, *address* indexed ``to``, *uint256* + ``value``) + - `Approval <#approval-address-indexed-owner-address-indexed-spender-uint256-value>`__\ (*address* + indexed ``owner``, *address* indexed ``spender``, *uint256* + ``value``) + + - `Functions <#functions>`__ + + - `approve <#approve-address-spender-uint256-value>`__\ (*address* + ``spender``, *uint256* ``value``) + - `totalSupply <#totalsupply>`__\ () + - `transferFrom <#transferfrom-address-from-address-to-uint256-value>`__\ (*address* + ``from``, *address* ``to``, *uint256* ``value``) + - `withdraw <#withdraw-uint256-value>`__\ (*uint256* ``value``) + - `balanceOf <#balanceof-address-owner>`__\ (*address* ``owner``) + - `transfer <#transfer-address-to-uint256-value>`__\ (*address* + ``to``, *uint256* ``value``) + - `deposit <#deposit>`__\ () + - `allowance <#allowance-address-owner-address-spender>`__\ (*address* + ``owner``, *address* ``spender``) + +Token contract - Token exchanging Ether 1:1 +------------------------------------------- + +- **Author**: Stefan George - stefan@gnosis.pm +- **Constructor**: EtherToken() +- This contract does **not** have a fallback function. + +Accessors +--------- + +- *string* name() ``06fdde03`` +- *uint8* decimals() ``313ce567`` +- *string* symbol() ``95d89b41`` + +Events +------ + +Deposit(\ *address* indexed ``sender``, *uint256* ``value``) +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +**Signature hash**: +``e1fffcc4923d04b559f4d29a8bfc6cda04eb5b0d3c460751c2402c5c5cc9109c`` + +Withdrawal(\ *address* indexed ``receiver``, *uint256* ``value``) +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +**Signature hash**: +``7fcf532c15f0a6db0bd6d0e038bea71d30d808c7d98cb3bf7268a95bf5081b65`` + +Transfer(\ *address* indexed ``from``, *address* indexed ``to``, *uint256* ``value``) +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +**Signature hash**: +``ddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef`` + +Approval(\ *address* indexed ``owner``, *address* indexed ``spender``, *uint256* ``value``) +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +**Signature hash**: +``8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925`` + +Functions +--------- + +approve(\ *address* ``spender``, *uint256* ``value``) +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +- **State mutability**: ``nonpayable`` +- **Signature hash**: ``095ea7b3`` + +Sets approved amount of tokens for spender. Returns success + +Inputs +^^^^^^ + ++-----------+-------------+----------------------------+ +| type | name | description | ++===========+=============+============================+ +| *address* | ``spender`` | Address of allowed account | ++-----------+-------------+----------------------------+ +| *uint256* | ``value`` | Number of approved tokens | ++-----------+-------------+----------------------------+ + +Outputs +^^^^^^^ + ++--------+--------------------------+ +| type | description | ++========+==========================+ +| *bool* | Was approval successful? | ++--------+--------------------------+ + +totalSupply() +~~~~~~~~~~~~~ + +- **State mutability**: ``view`` +- **Signature hash**: ``18160ddd`` + +Returns total supply of tokens + +.. _outputs-1: + +Outputs +^^^^^^^ + ++-----------+--------------+ +| type | description | ++===========+==============+ +| *uint256* | Total supply | ++-----------+--------------+ + +transferFrom(\ *address* ``from``, *address* ``to``, *uint256* ``value``) +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +- **State mutability**: ``nonpayable`` +- **Signature hash**: ``23b872dd`` + +Allows allowed third party to transfer tokens from one address to +another. Returns success + +.. _inputs-1: + +Inputs +^^^^^^ + ++-----------+-----------+-----------------------------------------+ +| type | name | description | ++===========+===========+=========================================+ +| *address* | ``from`` | Address from where tokens are withdrawn | ++-----------+-----------+-----------------------------------------+ +| *address* | ``to`` | Address to where tokens are sent | ++-----------+-----------+-----------------------------------------+ +| *uint256* | ``value`` | Number of tokens to transfer | ++-----------+-----------+-----------------------------------------+ + +.. _outputs-2: + +Outputs +^^^^^^^ + ++--------+--------------------------+ +| type | description | ++========+==========================+ +| *bool* | Was transfer successful? | ++--------+--------------------------+ + +withdraw(\ *uint256* ``value``) +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +- **State mutability**: ``nonpayable`` +- **Signature hash**: ``2e1a7d4d`` + +Sells tokens in exchange for Ether, exchanging them 1:1 + +.. _inputs-2: + +Inputs +^^^^^^ + ++-----------+-----------+--------------------------+ +| type | name | description | ++===========+===========+==========================+ +| *uint256* | ``value`` | Number of tokens to sell | ++-----------+-----------+--------------------------+ + +balanceOf(\ *address* ``owner``) +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +- **State mutability**: ``view`` +- **Signature hash**: ``70a08231`` + +Returns number of tokens owned by given address + +.. _inputs-3: + +Inputs +^^^^^^ + ++-----------+-----------+------------------------+ +| type | name | description | ++===========+===========+========================+ +| *address* | ``owner`` | Address of token owner | ++-----------+-----------+------------------------+ + +.. _outputs-3: + +Outputs +^^^^^^^ + ++-----------+------------------+ +| type | description | ++===========+==================+ +| *uint256* | Balance of owner | ++-----------+------------------+ + +transfer(\ *address* ``to``, *uint256* ``value``) +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +- **State mutability**: ``nonpayable`` +- **Signature hash**: ``a9059cbb`` + +Transfers sender’s tokens to a given address. Returns success + +.. _inputs-4: + +Inputs +^^^^^^ + ++-----------+-----------+------------------------------+ +| type | name | description | ++===========+===========+==============================+ +| *address* | ``to`` | Address of token receiver | ++-----------+-----------+------------------------------+ +| *uint256* | ``value`` | Number of tokens to transfer | ++-----------+-----------+------------------------------+ + +.. _outputs-4: + +Outputs +^^^^^^^ + ++--------+--------------------------+ +| type | description | ++========+==========================+ +| *bool* | Was transfer successful? | ++--------+--------------------------+ + +deposit() +~~~~~~~~~ + +- **State mutability**: ``payable`` +- **Signature hash**: ``d0e30db0`` + +Buys tokens with Ether, exchanging them 1:1 + +allowance(\ *address* ``owner``, *address* ``spender``) +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +- **State mutability**: ``view`` +- **Signature hash**: ``dd62ed3e`` + +Returns number of allowed tokens for given address + +.. _inputs-5: + +Inputs +^^^^^^ + ++-----------+-------------+--------------------------+ +| type | name | description | ++===========+=============+==========================+ +| *address* | ``owner`` | Address of token owner | ++-----------+-------------+--------------------------+ +| *address* | ``spender`` | Address of token spender | ++-----------+-------------+--------------------------+ + +.. _outputs-5: + +Outputs +^^^^^^^ + ++-----------+---------------------------------+ +| type | description | ++===========+=================================+ +| *uint256* | Remaining allowance for spender | ++-----------+---------------------------------+ diff --git a/docs/source/Event.rst b/docs/source/Event.rst new file mode 100644 index 0000000..6e90a5c --- /dev/null +++ b/docs/source/Event.rst @@ -0,0 +1,235 @@ +Event +===== + +- `Event <#event>`__ + + - `Accessors <#accessors>`__ + - `Events <#events>`__ + + - `OutcomeTokenCreation <#outcometokencreation-address-outcometoken-uint8-index>`__\ (*address* + ``outcomeToken``, *uint8* ``index``) + - `OutcomeTokenSetIssuance <#outcometokensetissuance-address-indexed-buyer-uint256-collateraltokencount>`__\ (*address* + indexed ``buyer``, *uint256* ``collateralTokenCount``) + - `OutcomeTokenSetRevocation <#outcometokensetrevocation-address-indexed-seller-uint256-outcometokencount>`__\ (*address* + indexed ``seller``, *uint256* ``outcomeTokenCount``) + - `OutcomeAssignment <#outcomeassignment-int256-outcome>`__\ (*int256* + ``outcome``) + - `WinningsRedemption <#winningsredemption-address-indexed-receiver-uint256-winnings>`__\ (*address* + indexed ``receiver``, *uint256* ``winnings``) + + - `Functions <#functions>`__ + + - `setOutcome <#setoutcome>`__\ () + - `buyAllOutcomes <#buyalloutcomes-uint256-collateraltokencount>`__\ (*uint256* + ``collateralTokenCount``) + - `getOutcomeTokenDistribution <#getoutcometokendistribution-address-owner>`__\ (*address* + ``owner``) + - `sellAllOutcomes <#sellalloutcomes-uint256-outcometokencount>`__\ (*uint256* + ``outcomeTokenCount``) + - `getOutcomeCount <#getoutcomecount>`__\ () + - `redeemWinnings <#redeemwinnings>`__\ () + - `getEventHash <#geteventhash>`__\ () + - `getOutcomeTokens <#getoutcometokens>`__\ () + +Event contract - Provide basic functionality required by different event types +------------------------------------------------------------------------------ + +- **Author**: Stefan George - stefan@gnosis.pm +- **Constructor**: Event(\ *address* ``_collateralToken``, *address* + ``_oracle``, *uint8* ``outcomeCount``) +- This contract does **not** have a fallback function. + +Accessors +--------- + +- *int256* outcome() ``27793f87`` +- *address* oracle() ``7dc0d1d0`` +- *address* outcomeTokens(\ *uint256*) ``8abe59ea`` +- *address* collateralToken() ``b2016bd4`` +- *bool* isOutcomeSet() ``ccdf68f3`` + +Events +------ + +OutcomeTokenCreation(\ *address* ``outcomeToken``, *uint8* ``index``) +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +**Signature hash**: +``ad24776dc347085865b6988e249c191fc22d9b31cf54cb62233c3c16be1736ee`` + +OutcomeTokenSetIssuance(\ *address* indexed ``buyer``, *uint256* ``collateralTokenCount``) +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +**Signature hash**: +``ad2a02292986148558019ae4abf172732228e32e131a91d3fa7e0cada61932c0`` + +OutcomeTokenSetRevocation(\ *address* indexed ``seller``, *uint256* ``outcomeTokenCount``) +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +**Signature hash**: +``7ac9271efd660c24459c447459e46f7366d2b4a692e572f108619d0d7273fcc5`` + +OutcomeAssignment(\ *int256* ``outcome``) +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +**Signature hash**: +``b1aaa9f4484acc283375c8e495a44766e4026170797dc9280b4ae2ab5632fb71`` + +WinningsRedemption(\ *address* indexed ``receiver``, *uint256* ``winnings``) +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +**Signature hash**: +``2fe921bb50a459800ae7eae7c0124e9e875094a539eb7dc5b3f728017347e0fb`` + +Functions +--------- + +setOutcome() +~~~~~~~~~~~~ + +- **State mutability**: ``nonpayable`` +- **Signature hash**: ``0537665d`` + +Sets winning event outcome + +buyAllOutcomes(\ *uint256* ``collateralTokenCount``) +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +- **State mutability**: ``nonpayable`` +- **Signature hash**: ``28da850b`` + +Buys equal number of tokens of all outcomes, exchanging collateral +tokens and sets of outcome tokens 1:1 + +Inputs +^^^^^^ + ++-----------+--------------------------+-----------------------------+ +| type | name | description | ++===========+==========================+=============================+ +| *uint256* | ``collateralTokenCount`` | Number of collateral tokens | ++-----------+--------------------------+-----------------------------+ + +getOutcomeTokenDistribution(\ *address* ``owner``) +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +- **State mutability**: ``view`` +- **Signature hash**: ``69c19d4c`` + +Returns the amount of outcome tokens held by owner + +.. _inputs-1: + +Inputs +^^^^^^ + ++-----------+-----------+ +| type | name | ++===========+===========+ +| *address* | ``owner`` | ++-----------+-----------+ + +Outputs +^^^^^^^ + ++-------------+------------------------------+----------------------------+ +| type | name | description | ++=============+==============================+============================+ +| *uint256[]* | ``outcomeTokenDistribution`` | Outcome token distribution | ++-------------+------------------------------+----------------------------+ + +sellAllOutcomes(\ *uint256* ``outcomeTokenCount``) +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +- **State mutability**: ``nonpayable`` +- **Signature hash**: ``6fb1edcd`` + +Sells equal number of tokens of all outcomes, exchanging collateral +tokens and sets of outcome tokens 1:1 + +.. _inputs-2: + +Inputs +^^^^^^ + ++-----------+-----------------------+--------------------------+ +| type | name | description | ++===========+=======================+==========================+ +| *uint256* | ``outcomeTokenCount`` | Number of outcome tokens | ++-----------+-----------------------+--------------------------+ + +getOutcomeCount() +~~~~~~~~~~~~~~~~~ + +- **State mutability**: ``view`` +- **Signature hash**: ``7dc8f086`` + +Returns outcome count + +.. _outputs-1: + +Outputs +^^^^^^^ + ++---------+---------------+ +| type | description | ++=========+===============+ +| *uint8* | Outcome count | ++---------+---------------+ + +redeemWinnings() +~~~~~~~~~~~~~~~~ + +- **State mutability**: ``nonpayable`` +- **Signature hash**: ``ad0b2bec`` + +Exchanges sender’s winning outcome tokens for collateral tokens + +.. _outputs-2: + +Outputs +^^^^^^^ + ++-----------+-------------------+ +| type | description | ++===========+===================+ +| *uint256* | Sender’s winnings | ++-----------+-------------------+ + +getEventHash() +~~~~~~~~~~~~~~ + +- **State mutability**: ``view`` +- **Signature hash**: ``e96e5950`` + +Calculates and returns event hash + +.. _outputs-3: + +Outputs +^^^^^^^ + ++-----------+-------------+ +| type | description | ++===========+=============+ +| *bytes32* | Event hash | ++-----------+-------------+ + +getOutcomeTokens() +~~~~~~~~~~~~~~~~~~ + +- **State mutability**: ``view`` +- **Signature hash**: ``f21a1468`` + +Returns outcome tokens array + +.. _outputs-4: + +Outputs +^^^^^^^ + ++-------------+----------------+ +| type | description | ++=============+================+ +| *address[]* | Outcome tokens | ++-------------+----------------+ diff --git a/docs/source/EventFactory.rst b/docs/source/EventFactory.rst new file mode 100644 index 0000000..4bf4210 --- /dev/null +++ b/docs/source/EventFactory.rst @@ -0,0 +1,133 @@ +EventFactory +============ + +- `EventFactory <#eventfactory>`__ + + - `Accessors <#accessors>`__ + - `Events <#events>`__ + + - `CategoricalEventCreation <#categoricaleventcreation-address-indexed-creator-address-categoricalevent-address-collateraltoken-address-oracle-uint8-outcomecount>`__\ (*address* + indexed ``creator``, *address* ``categoricalEvent``, *address* + ``collateralToken``, *address* ``oracle``, *uint8* + ``outcomeCount``) + - `ScalarEventCreation <#scalareventcreation-address-indexed-creator-address-scalarevent-address-collateraltoken-address-oracle-int256-lowerbound-int256-upperbound>`__\ (*address* + indexed ``creator``, *address* ``scalarEvent``, *address* + ``collateralToken``, *address* ``oracle``, *int256* + ``lowerBound``, *int256* ``upperBound``) + + - `Functions <#functions>`__ + + - `createScalarEvent <#createscalarevent-address-collateraltoken-address-oracle-int256-lowerbound-int256-upperbound>`__\ (*address* + ``collateralToken``, *address* ``oracle``, *int256* + ``lowerBound``, *int256* ``upperBound``) + - `createCategoricalEvent <#createcategoricalevent-address-collateraltoken-address-oracle-uint8-outcomecount>`__\ (*address* + ``collateralToken``, *address* ``oracle``, *uint8* + ``outcomeCount``) + +Event factory contract - Allows creation of categorical and scalar events +------------------------------------------------------------------------- + +- **Author**: Stefan George - stefan@gnosis.pm +- **Constructor**: EventFactory() +- This contract does **not** have a fallback function. + +Accessors +--------- + +- *address* categoricalEvents(\ *bytes32*) ``8d1d2c21`` +- *address* scalarEvents(\ *bytes32*) ``9897e8a5`` + +Events +------ + +CategoricalEventCreation(\ *address* indexed ``creator``, *address* ``categoricalEvent``, *address* ``collateralToken``, *address* ``oracle``, *uint8* ``outcomeCount``) +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +**Signature hash**: +``9732758aee476f5125b50d29cc43e28422f12ec078ba9f5c712f9dbd52796f59`` + +ScalarEventCreation(\ *address* indexed ``creator``, *address* ``scalarEvent``, *address* ``collateralToken``, *address* ``oracle``, *int256* ``lowerBound``, *int256* ``upperBound``) +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +**Signature hash**: +``d613e63983a1538814e1b390fc232d0e20462cf7410924f6b6a5f29ea38e82ed`` + +Functions +--------- + +createScalarEvent(\ *address* ``collateralToken``, *address* ``oracle``, *int256* ``lowerBound``, *int256* ``upperBound``) +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +- **State mutability**: ``nonpayable`` +- **Signature hash**: ``5ea194a3`` + +Creates a new scalar event and adds it to the event mapping + +Inputs +^^^^^^ + ++------+-------------+------------------------------------------------+ +| type | name | description | ++======+=============+================================================+ +| *add | ``collatera | Tokens used as collateral in exchange for | +| ress | lToken`` | outcome tokens | +| * | | | ++------+-------------+------------------------------------------------+ +| *add | ``oracle`` | Oracle contract used to resolve the event | +| ress | | | +| * | | | ++------+-------------+------------------------------------------------+ +| *int | ``lowerBoun | Lower bound for event outcome | +| 256* | d`` | | ++------+-------------+------------------------------------------------+ +| *int | ``upperBoun | Lower bound for event outcome | +| 256* | d`` | | ++------+-------------+------------------------------------------------+ + +Outputs +^^^^^^^ + ++-----------+-------------------+----------------+ +| type | name | description | ++===========+===================+================+ +| *address* | ``eventContract`` | Event contract | ++-----------+-------------------+----------------+ + +createCategoricalEvent(\ *address* ``collateralToken``, *address* ``oracle``, *uint8* ``outcomeCount``) +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +- **State mutability**: ``nonpayable`` +- **Signature hash**: ``9df0c176`` + +Creates a new categorical event and adds it to the event mapping + +.. _inputs-1: + +Inputs +^^^^^^ + ++------+-------------+------------------------------------------------+ +| type | name | description | ++======+=============+================================================+ +| *add | ``collatera | Tokens used as collateral in exchange for | +| ress | lToken`` | outcome tokens | +| * | | | ++------+-------------+------------------------------------------------+ +| *add | ``oracle`` | Oracle contract used to resolve the event | +| ress | | | +| * | | | ++------+-------------+------------------------------------------------+ +| *uin | ``outcomeCo | Number of event outcomes | +| t8* | unt`` | | ++------+-------------+------------------------------------------------+ + +.. _outputs-1: + +Outputs +^^^^^^^ + ++-----------+-------------------+----------------+ +| type | name | description | ++===========+===================+================+ +| *address* | ``eventContract`` | Event contract | ++-----------+-------------------+----------------+ diff --git a/docs/source/FutarchyOracle.rst b/docs/source/FutarchyOracle.rst new file mode 100644 index 0000000..b25099b --- /dev/null +++ b/docs/source/FutarchyOracle.rst @@ -0,0 +1,138 @@ +FutarchyOracle +============== + +- `FutarchyOracle <#futarchyoracle>`__ + + - `Accessors <#accessors>`__ + - `Events <#events>`__ + + - `FutarchyFunding <#futarchyfunding-uint256-funding>`__\ (*uint256* + ``funding``) + - `FutarchyClosing <#futarchyclosing>`__\ () + - `OutcomeAssignment <#outcomeassignment-uint256-winningmarketindex>`__\ (*uint256* + ``winningMarketIndex``) + + - `Functions <#functions>`__ + + - `setOutcome <#setoutcome>`__\ () + - `close <#close>`__\ () + - `getOutcome <#getoutcome>`__\ () + - `fund <#fund-uint256-funding>`__\ (*uint256* ``funding``) + - `isOutcomeSet <#isoutcomeset>`__\ () + +Futarchy oracle contract - Allows to create an oracle based on market behaviour +------------------------------------------------------------------------------- + +- **Author**: Stefan George - stefan@gnosis.pm +- **Constructor**: FutarchyOracle(\ *address* ``_creator``, *address* + ``eventFactory``, *address* ``collateralToken``, *address* + ``oracle``, *uint8* ``outcomeCount``, *int256* ``lowerBound``, + *int256* ``upperBound``, *address* ``marketFactory``, *address* + ``marketMaker``, *uint24* ``fee``, *uint256* ``_tradingPeriod``, + *uint256* ``startDate``) +- This contract does **not** have a fallback function. + +Accessors +--------- + +- *uint8* LONG() ``561cce0a`` +- *uint256* winningMarketIndex() ``56cfb75f`` +- *address* markets(\ *uint256*) ``b1283e77`` +- *address* categoricalEvent() ``c3730d03`` +- *bool* isSet() ``c65fb380`` +- *uint256* tradingPeriod() ``f86e3153`` + +Events +------ + +FutarchyFunding(\ *uint256* ``funding``) +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +**Signature hash**: +``8b8d4001f25800969052b4c8925891e8acbe35d672701edb74e52265fed9786e`` + +FutarchyClosing() +~~~~~~~~~~~~~~~~~ + +**Signature hash**: +``5f5592c20f009bc231fd8491ce6ff3d11f2067fd2bd08c2a9999391a09b67dd4`` + +OutcomeAssignment(\ *uint256* ``winningMarketIndex``) +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +**Signature hash**: +``39972cb21edd888c2061a2b4b37874524bbc055cfeaa3054682ba5369f5029aa`` + +Functions +--------- + +setOutcome() +~~~~~~~~~~~~ + +- **State mutability**: ``nonpayable`` +- **Signature hash**: ``0537665d`` + +Allows to set the oracle outcome based on the market with largest long +position + +close() +~~~~~~~ + +- **State mutability**: ``nonpayable`` +- **Signature hash**: ``43d726d6`` + +Closes market for winning outcome and redeems winnings and sends all +collateral tokens to creator + +getOutcome() +~~~~~~~~~~~~ + +- **State mutability**: ``view`` +- **Signature hash**: ``7e7e4b47`` + +Returns winning outcome + +Outputs +^^^^^^^ + ++----------+-------------+ +| type | description | ++==========+=============+ +| *int256* | Outcome | ++----------+-------------+ + +fund(\ *uint256* ``funding``) +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +- **State mutability**: ``nonpayable`` +- **Signature hash**: ``ca1d209d`` + +Funds all markets with equal amount of funding + +Inputs +^^^^^^ + ++-----------+-------------+-------------------+ +| type | name | description | ++===========+=============+===================+ +| *uint256* | ``funding`` | Amount of funding | ++-----------+-------------+-------------------+ + +isOutcomeSet() +~~~~~~~~~~~~~~ + +- **State mutability**: ``view`` +- **Signature hash**: ``ccdf68f3`` + +Returns if winning outcome is set + +.. _outputs-1: + +Outputs +^^^^^^^ + ++--------+-----------------+ +| type | description | ++========+=================+ +| *bool* | Is outcome set? | ++--------+-----------------+ diff --git a/docs/source/FutarchyOracleFactory.rst b/docs/source/FutarchyOracleFactory.rst new file mode 100644 index 0000000..9b24400 --- /dev/null +++ b/docs/source/FutarchyOracleFactory.rst @@ -0,0 +1,97 @@ +FutarchyOracleFactory +===================== + +- `FutarchyOracleFactory <#futarchyoraclefactory>`__ + + - `Events <#events>`__ + + - `FutarchyOracleCreation <#futarchyoraclecreation-address-indexed-creator-address-futarchyoracle-address-collateraltoken-address-oracle-uint8-outcomecount-int256-lowerbound-int256-upperbound-address-marketmaker-uint24-fee-uint256-tradingperiod-uint256-startdate>`__\ (*address* + indexed ``creator``, *address* ``futarchyOracle``, *address* + ``collateralToken``, *address* ``oracle``, *uint8* + ``outcomeCount``, *int256* ``lowerBound``, *int256* + ``upperBound``, *address* ``marketMaker``, *uint24* ``fee``, + *uint256* ``tradingPeriod``, *uint256* ``startDate``) + + - `Functions <#functions>`__ + + - `createFutarchyOracle <#createfutarchyoracle-address-collateraltoken-address-oracle-uint8-outcomecount-int256-lowerbound-int256-upperbound-address-marketmaker-uint24-fee-uint256-tradingperiod-uint256-startdate>`__\ (*address* + ``collateralToken``, *address* ``oracle``, *uint8* + ``outcomeCount``, *int256* ``lowerBound``, *int256* + ``upperBound``, *address* ``marketMaker``, *uint24* ``fee``, + *uint256* ``tradingPeriod``, *uint256* ``startDate``) + +Futarchy oracle factory contract - Allows to create Futarchy oracle contracts +----------------------------------------------------------------------------- + +- **Author**: Stefan George - stefan@gnosis.pm +- **Constructor**: FutarchyOracleFactory(\ *address* ``_eventFactory``, + *address* ``_marketFactory``) +- This contract does **not** have a fallback function. + +Events +------ + +FutarchyOracleCreation(\ *address* indexed ``creator``, *address* ``futarchyOracle``, *address* ``collateralToken``, *address* ``oracle``, *uint8* ``outcomeCount``, *int256* ``lowerBound``, *int256* ``upperBound``, *address* ``marketMaker``, *uint24* ``fee``, *uint256* ``tradingPeriod``, *uint256* ``startDate``) +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +**Signature hash**: +``31b2f2efb8e38b0139781fb93941176394ceb31c7433234a12da403999ca8766`` + +Functions +--------- + +createFutarchyOracle(\ *address* ``collateralToken``, *address* ``oracle``, *uint8* ``outcomeCount``, *int256* ``lowerBound``, *int256* ``upperBound``, *address* ``marketMaker``, *uint24* ``fee``, *uint256* ``tradingPeriod``, *uint256* ``startDate``) +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +- **State mutability**: ``nonpayable`` +- **Signature hash**: ``bb6de2bc`` + +Creates a new Futarchy oracle contract + +Inputs +^^^^^^ + ++------+-------------+------------------------------------------------+ +| type | name | description | ++======+=============+================================================+ +| *add | ``collatera | Tokens used as collateral in exchange for | +| ress | lToken`` | outcome tokens | +| * | | | ++------+-------------+------------------------------------------------+ +| *add | ``oracle`` | Oracle contract used to resolve the event | +| ress | | | +| * | | | ++------+-------------+------------------------------------------------+ +| *uin | ``outcomeCo | Number of event outcomes | +| t8* | unt`` | | ++------+-------------+------------------------------------------------+ +| *int | ``lowerBoun | Lower bound for event outcome | +| 256* | d`` | | ++------+-------------+------------------------------------------------+ +| *int | ``upperBoun | Lower bound for event outcome | +| 256* | d`` | | ++------+-------------+------------------------------------------------+ +| *add | ``marketMak | Market maker contract | +| ress | er`` | | +| * | | | ++------+-------------+------------------------------------------------+ +| *uin | ``fee`` | Market fee | +| t24* | | | ++------+-------------+------------------------------------------------+ +| *uin | ``tradingPe | Trading period before decision can be | +| t256 | riod`` | determined | +| * | | | ++------+-------------+------------------------------------------------+ +| *uin | ``startDate | Start date for price logging | +| t256 | `` | | +| * | | | ++------+-------------+------------------------------------------------+ + +Outputs +^^^^^^^ + ++-----------+--------------------+-----------------+ +| type | name | description | ++===========+====================+=================+ +| *address* | ``futarchyOracle`` | Oracle contract | ++-----------+--------------------+-----------------+ diff --git a/docs/source/HumanFriendlyToken.rst b/docs/source/HumanFriendlyToken.rst new file mode 100644 index 0000000..70b9fe4 --- /dev/null +++ b/docs/source/HumanFriendlyToken.rst @@ -0,0 +1,204 @@ +HumanFriendlyToken +================== + +- `HumanFriendlyToken <#humanfriendlytoken>`__ + + - `Accessors <#accessors>`__ + - `Events <#events>`__ + + - `Transfer <#transfer-address-indexed-from-address-indexed-to-uint256-value>`__\ (*address* + indexed ``from``, *address* indexed ``to``, *uint256* + ``value``) + - `Approval <#approval-address-indexed-owner-address-indexed-spender-uint256-value>`__\ (*address* + indexed ``owner``, *address* indexed ``spender``, *uint256* + ``value``) + + - `Functions <#functions>`__ + + - `approve <#approve-address-spender-uint256-value>`__\ (*address* + ``spender``, *uint256* ``value``) + - `transferFrom <#transferfrom-address-from-address-to-uint256-value>`__\ (*address* + ``from``, *address* ``to``, *uint256* ``value``) + - `balanceOf <#balanceof-address-owner>`__\ (*address* ``owner``) + - `transfer <#transfer-address-to-uint256-value>`__\ (*address* + ``to``, *uint256* ``value``) + - `allowance <#allowance-address-owner-address-spender>`__\ (*address* + ``owner``, *address* ``spender``) + +Abstract human-friendly token contract - Functions to be implemented by token contracts +--------------------------------------------------------------------------------------- + +- **Constructor**: HumanFriendlyToken() +- This contract does **not** have a fallback function. + +Accessors +--------- + +- *string* name() ``06fdde03`` +- *uint256* totalSupply() ``18160ddd`` +- *uint8* decimals() ``313ce567`` +- *string* symbol() ``95d89b41`` + +Events +------ + +Transfer(\ *address* indexed ``from``, *address* indexed ``to``, *uint256* ``value``) +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +**Signature hash**: +``ddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef`` + +Approval(\ *address* indexed ``owner``, *address* indexed ``spender``, *uint256* ``value``) +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +**Signature hash**: +``8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925`` + +Functions +--------- + +approve(\ *address* ``spender``, *uint256* ``value``) +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +- **State mutability**: ``nonpayable`` +- **Signature hash**: ``095ea7b3`` + +Inputs +^^^^^^ + ++-----------+-------------+ +| type | name | ++===========+=============+ +| *address* | ``spender`` | ++-----------+-------------+ +| *uint256* | ``value`` | ++-----------+-------------+ + +Outputs +^^^^^^^ + ++--------+ +| type | ++========+ +| *bool* | ++--------+ + +transferFrom(\ *address* ``from``, *address* ``to``, *uint256* ``value``) +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +- **State mutability**: ``nonpayable`` +- **Signature hash**: ``23b872dd`` + +.. _inputs-1: + +Inputs +^^^^^^ + ++-----------+-----------+ +| type | name | ++===========+===========+ +| *address* | ``from`` | ++-----------+-----------+ +| *address* | ``to`` | ++-----------+-----------+ +| *uint256* | ``value`` | ++-----------+-----------+ + +.. _outputs-1: + +Outputs +^^^^^^^ + ++--------+ +| type | ++========+ +| *bool* | ++--------+ + +balanceOf(\ *address* ``owner``) +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +- **State mutability**: ``view`` +- **Signature hash**: ``70a08231`` + +.. _inputs-2: + +Inputs +^^^^^^ + ++-----------+-----------+ +| type | name | ++===========+===========+ +| *address* | ``owner`` | ++-----------+-----------+ + +.. _outputs-2: + +Outputs +^^^^^^^ + ++-----------+ +| type | ++===========+ +| *uint256* | ++-----------+ + +transfer(\ *address* ``to``, *uint256* ``value``) +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +- **State mutability**: ``nonpayable`` +- **Signature hash**: ``a9059cbb`` + +.. _inputs-3: + +Inputs +^^^^^^ + ++-----------+-----------+ +| type | name | ++===========+===========+ +| *address* | ``to`` | ++-----------+-----------+ +| *uint256* | ``value`` | ++-----------+-----------+ + +.. _outputs-3: + +Outputs +^^^^^^^ + ++--------+ +| type | ++========+ +| *bool* | ++--------+ + +allowance(\ *address* ``owner``, *address* ``spender``) +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +- **State mutability**: ``view`` +- **Signature hash**: ``dd62ed3e`` + +.. _inputs-4: + +Inputs +^^^^^^ + ++-----------+-------------+ +| type | name | ++===========+=============+ +| *address* | ``owner`` | ++-----------+-------------+ +| *address* | ``spender`` | ++-----------+-------------+ + +.. _outputs-4: + +Outputs +^^^^^^^ + ++-----------+ +| type | ++===========+ +| *uint256* | ++-----------+ diff --git a/docs/source/LMSRMarketMaker.rst b/docs/source/LMSRMarketMaker.rst new file mode 100644 index 0000000..bcc6a39 --- /dev/null +++ b/docs/source/LMSRMarketMaker.rst @@ -0,0 +1,123 @@ +LMSRMarketMaker +=============== + +- `LMSRMarketMaker <#lmsrmarketmaker>`__ + + - `Functions <#functions>`__ + + - `calcProfit <#calcprofit-address-market-uint8-outcometokenindex-uint256-outcometokencount>`__\ (*address* + ``market``, *uint8* ``outcomeTokenIndex``, *uint256* + ``outcomeTokenCount``) + - `calcCost <#calccost-address-market-uint8-outcometokenindex-uint256-outcometokencount>`__\ (*address* + ``market``, *uint8* ``outcomeTokenIndex``, *uint256* + ``outcomeTokenCount``) + - `calcMarginalPrice <#calcmarginalprice-address-market-uint8-outcometokenindex>`__\ (*address* + ``market``, *uint8* ``outcomeTokenIndex``) + +LMSR market maker contract - Calculates share prices based on share distribution and initial funding +---------------------------------------------------------------------------------------------------- + +- **Author**: Alan Lu - alan.lu@gnosis.pm +- **Constructor**: LMSRMarketMaker() +- This contract does **not** have a fallback function. + +Functions +--------- + +calcProfit(\ *address* ``market``, *uint8* ``outcomeTokenIndex``, *uint256* ``outcomeTokenCount``) +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +- **State mutability**: ``view`` +- **Signature hash**: ``4091c6a9`` + +Returns profit for selling given number of outcome tokens + +Inputs +^^^^^^ + ++-----------+-----------------------+----------------------------------+ +| type | name | description | ++===========+=======================+==================================+ +| *address* | ``market`` | Market contract | ++-----------+-----------------------+----------------------------------+ +| *uint8* | ``outcomeTokenIndex`` | Index of outcome to sell | ++-----------+-----------------------+----------------------------------+ +| *uint256* | ``outcomeTokenCount`` | Number of outcome tokens to sell | ++-----------+-----------------------+----------------------------------+ + +Outputs +^^^^^^^ + ++-----------+------------+-------------+ +| type | name | description | ++===========+============+=============+ +| *uint256* | ``profit`` | Profit | ++-----------+------------+-------------+ + +calcCost(\ *address* ``market``, *uint8* ``outcomeTokenIndex``, *uint256* ``outcomeTokenCount``) +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +- **State mutability**: ``view`` +- **Signature hash**: ``bd8ff817`` + +Returns cost to buy given number of outcome tokens + +.. _inputs-1: + +Inputs +^^^^^^ + ++-----------+-----------------------+---------------------------------+ +| type | name | description | ++===========+=======================+=================================+ +| *address* | ``market`` | Market contract | ++-----------+-----------------------+---------------------------------+ +| *uint8* | ``outcomeTokenIndex`` | Index of outcome to buy | ++-----------+-----------------------+---------------------------------+ +| *uint256* | ``outcomeTokenCount`` | Number of outcome tokens to buy | ++-----------+-----------------------+---------------------------------+ + +.. _outputs-1: + +Outputs +^^^^^^^ + ++-----------+----------+-------------+ +| type | name | description | ++===========+==========+=============+ +| *uint256* | ``cost`` | Cost | ++-----------+----------+-------------+ + +calcMarginalPrice(\ *address* ``market``, *uint8* ``outcomeTokenIndex``) +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +- **State mutability**: ``view`` +- **Signature hash**: ``d812d346`` + +Returns marginal price of an outcome + +.. _inputs-2: + +Inputs +^^^^^^ + ++-----------------------+-----------------------+-----------------------+ +| type | name | description | ++=======================+=======================+=======================+ +| *address* | ``market`` | Market contract | ++-----------------------+-----------------------+-----------------------+ +| *uint8* | ``outcomeTokenIndex`` | Index of outcome to | +| | | determine marginal | +| | | price of | ++-----------------------+-----------------------+-----------------------+ + +.. _outputs-2: + +Outputs +^^^^^^^ + ++-----------+-----------+------------------------------------------------------+ +| type | name | description | ++===========+===========+======================================================+ +| *uint256* | ``price`` | Marginal price of an outcome as a fixed point number | ++-----------+-----------+------------------------------------------------------+ diff --git a/docs/source/MajorityOracle.rst b/docs/source/MajorityOracle.rst new file mode 100644 index 0000000..29e2d9a --- /dev/null +++ b/docs/source/MajorityOracle.rst @@ -0,0 +1,83 @@ +MajorityOracle +============== + +- `MajorityOracle <#majorityoracle>`__ + + - `Accessors <#accessors>`__ + - `Functions <#functions>`__ + + - `getStatusAndOutcome <#getstatusandoutcome>`__\ () + - `getOutcome <#getoutcome>`__\ () + - `isOutcomeSet <#isoutcomeset>`__\ () + +Majority oracle contract - Allows to resolve an event based on multiple oracles with majority vote +-------------------------------------------------------------------------------------------------- + +- **Author**: Stefan George - stefan@gnosis.pm +- **Constructor**: MajorityOracle(\ *address[]* ``_oracles``) +- This contract does **not** have a fallback function. + +Accessors +--------- + +- *address* oracles(\ *uint256*) ``5b69a7d8`` + +Functions +--------- + +getStatusAndOutcome() +~~~~~~~~~~~~~~~~~~~~~ + +- **State mutability**: ``nonpayable`` +- **Signature hash**: ``6bcc035a`` + +Allows to registers oracles for a majority vote + +Outputs +^^^^^^^ + ++----------+----------------+ +| type | name | ++==========+================+ +| *bool* | ``outcomeSet`` | ++----------+----------------+ +| *int256* | ``outcome`` | ++----------+----------------+ + +getOutcome() +~~~~~~~~~~~~ + +- **State mutability**: ``view`` +- **Signature hash**: ``7e7e4b47`` + +Returns winning outcome + +.. _outputs-1: + +Outputs +^^^^^^^ + ++----------+-------------+ +| type | description | ++==========+=============+ +| *int256* | Outcome | ++----------+-------------+ + +isOutcomeSet() +~~~~~~~~~~~~~~ + +- **State mutability**: ``view`` +- **Signature hash**: ``ccdf68f3`` + +Returns if winning outcome is set + +.. _outputs-2: + +Outputs +^^^^^^^ + ++--------+-----------------+ +| type | description | ++========+=================+ +| *bool* | Is outcome set? | ++--------+-----------------+ diff --git a/docs/source/MajorityOracleFactory.rst b/docs/source/MajorityOracleFactory.rst new file mode 100644 index 0000000..7d49b6c --- /dev/null +++ b/docs/source/MajorityOracleFactory.rst @@ -0,0 +1,60 @@ +MajorityOracleFactory +===================== + +- `MajorityOracleFactory <#majorityoraclefactory>`__ + + - `Events <#events>`__ + + - `MajorityOracleCreation <#majorityoraclecreation-address-indexed-creator-address-majorityoracle-address-oracles>`__\ (*address* + indexed ``creator``, *address* ``majorityOracle``, *address[]* + ``oracles``) + + - `Functions <#functions>`__ + + - `createMajorityOracle <#createmajorityoracle-address-oracles>`__\ (*address[]* + ``oracles``) + +Majority oracle factory contract - Allows to create majority oracle contracts +----------------------------------------------------------------------------- + +- **Author**: Stefan George - stefan@gnosis.pm +- **Constructor**: MajorityOracleFactory() +- This contract does **not** have a fallback function. + +Events +------ + +MajorityOracleCreation(\ *address* indexed ``creator``, *address* ``majorityOracle``, *address[]* ``oracles``) +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +**Signature hash**: +``df1eeefc4815bdd1bdf45905c4ce59f6ca50efb4148303c9bbda2bff40301d3d`` + +Functions +--------- + +createMajorityOracle(\ *address[]* ``oracles``) +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +- **State mutability**: ``nonpayable`` +- **Signature hash**: ``e04c0c52`` + +Creates a new majority oracle contract + +Inputs +^^^^^^ + ++-------------+-------------+--------------------------------------------------+ +| type | name | description | ++=============+=============+==================================================+ +| *address[]* | ``oracles`` | List of oracles taking part in the majority vote | ++-------------+-------------+--------------------------------------------------+ + +Outputs +^^^^^^^ + ++-----------+--------------------+-----------------+ +| type | name | description | ++===========+====================+=================+ +| *address* | ``majorityOracle`` | Oracle contract | ++-----------+--------------------+-----------------+ diff --git a/docs/source/Makefile b/docs/source/Makefile new file mode 100644 index 0000000..3527bb5 --- /dev/null +++ b/docs/source/Makefile @@ -0,0 +1,20 @@ +# Minimal makefile for Sphinx documentation +# + +# You can set these variables from the command line. +SPHINXOPTS = +SPHINXBUILD = sphinx-build +SPHINXPROJ = gnosis-contracts +SOURCEDIR = . +BUILDDIR = _build + +# Put it first so that "make" without argument is like "make help". +help: + @$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) + +.PHONY: help Makefile + +# Catch-all target: route all unknown targets to Sphinx using the new +# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS). +%: Makefile + @$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) \ No newline at end of file diff --git a/docs/source/Market.rst b/docs/source/Market.rst new file mode 100644 index 0000000..8dec116 --- /dev/null +++ b/docs/source/Market.rst @@ -0,0 +1,261 @@ +Market +====== + +- `Market <#market>`__ + + - `Accessors <#accessors>`__ + - `Events <#events>`__ + + - `MarketFunding <#marketfunding-uint256-funding>`__\ (*uint256* + ``funding``) + - `MarketClosing <#marketclosing>`__\ () + - `FeeWithdrawal <#feewithdrawal-uint256-fees>`__\ (*uint256* + ``fees``) + - `OutcomeTokenPurchase <#outcometokenpurchase-address-indexed-buyer-uint8-outcometokenindex-uint256-outcometokencount-uint256-outcometokencost-uint256-marketfees>`__\ (*address* + indexed ``buyer``, *uint8* ``outcomeTokenIndex``, *uint256* + ``outcomeTokenCount``, *uint256* ``outcomeTokenCost``, + *uint256* ``marketFees``) + - `OutcomeTokenSale <#outcometokensale-address-indexed-seller-uint8-outcometokenindex-uint256-outcometokencount-uint256-outcometokenprofit-uint256-marketfees>`__\ (*address* + indexed ``seller``, *uint8* ``outcomeTokenIndex``, *uint256* + ``outcomeTokenCount``, *uint256* ``outcomeTokenProfit``, + *uint256* ``marketFees``) + - `OutcomeTokenShortSale <#outcometokenshortsale-address-indexed-buyer-uint8-outcometokenindex-uint256-outcometokencount-uint256-cost>`__\ (*address* + indexed ``buyer``, *uint8* ``outcomeTokenIndex``, *uint256* + ``outcomeTokenCount``, *uint256* ``cost``) + + - `Functions <#functions>`__ + + - `shortSell <#shortsell-uint8-outcometokenindex-uint256-outcometokencount-uint256-minprofit>`__\ (*uint8* + ``outcomeTokenIndex``, *uint256* ``outcomeTokenCount``, + *uint256* ``minProfit``) + - `close <#close>`__\ () + - `sell <#sell-uint8-outcometokenindex-uint256-outcometokencount-uint256-minprofit>`__\ (*uint8* + ``outcomeTokenIndex``, *uint256* ``outcomeTokenCount``, + *uint256* ``minProfit``) + - `withdrawFees <#withdrawfees>`__\ () + - `calcMarketFee <#calcmarketfee-uint256-outcometokencost>`__\ (*uint256* + ``outcomeTokenCost``) + - `fund <#fund-uint256-_funding>`__\ (*uint256* ``_funding``) + - `buy <#buy-uint8-outcometokenindex-uint256-outcometokencount-uint256-maxcost>`__\ (*uint8* + ``outcomeTokenIndex``, *uint256* ``outcomeTokenCount``, + *uint256* ``maxCost``) + +Abstract market contract - Functions to be implemented by market contracts +-------------------------------------------------------------------------- + +- **Constructor**: Market() +- This contract does **not** have a fallback function. + +Accessors +--------- + +- *address* creator() ``02d05d3f`` +- *address* marketMaker() ``1f21f9af`` +- *uint256* createdAtBlock() ``59acb42c`` +- *int256* netOutcomeTokensSold(\ *uint256*) ``a157979c`` +- *uint8* stage() ``c040e6b8`` +- *uint256* funding() ``cb4c86b7`` +- *uint24* fee() ``ddca3f43`` +- *address* eventContract() ``e274fd24`` + +Events +------ + +MarketFunding(\ *uint256* ``funding``) +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +**Signature hash**: +``8a2fe22ce705a4ac9c189969cef327affbdc477afdae4ae274c2f8ad021f9163`` + +MarketClosing() +~~~~~~~~~~~~~~~ + +**Signature hash**: +``e7d85885f81486e8f4c99e50e056745493861b8b5d4f973dcf0c3c0f74a25e07`` + +FeeWithdrawal(\ *uint256* ``fees``) +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +**Signature hash**: +``706d7f48c702007c2fb0881cea5759732e64f52faee427d5ab030787cfb7d787`` + +OutcomeTokenPurchase(\ *address* indexed ``buyer``, *uint8* ``outcomeTokenIndex``, *uint256* ``outcomeTokenCount``, *uint256* ``outcomeTokenCost``, *uint256* ``marketFees``) +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +**Signature hash**: +``7caea4a19892ce49b4daa2014d5599eed561dcd16ffabfac851a9737217ae410`` + +OutcomeTokenSale(\ *address* indexed ``seller``, *uint8* ``outcomeTokenIndex``, *uint256* ``outcomeTokenCount``, *uint256* ``outcomeTokenProfit``, *uint256* ``marketFees``) +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +**Signature hash**: +``ab24ef3371efb2e0e3b02955e33b8ef03c14523e71f3bda87878a2386cc17b69`` + +OutcomeTokenShortSale(\ *address* indexed ``buyer``, *uint8* ``outcomeTokenIndex``, *uint256* ``outcomeTokenCount``, *uint256* ``cost``) +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +**Signature hash**: +``1dbdc4ff4d51949738d56e120b2be4edecc55d8d2150f1616ec5802abaae3f88`` + +Functions +--------- + +shortSell(\ *uint8* ``outcomeTokenIndex``, *uint256* ``outcomeTokenCount``, *uint256* ``minProfit``) +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +- **State mutability**: ``nonpayable`` +- **Signature hash**: ``28c05d32`` + +Inputs +^^^^^^ + ++-----------+-----------------------+ +| type | name | ++===========+=======================+ +| *uint8* | ``outcomeTokenIndex`` | ++-----------+-----------------------+ +| *uint256* | ``outcomeTokenCount`` | ++-----------+-----------------------+ +| *uint256* | ``minProfit`` | ++-----------+-----------------------+ + +Outputs +^^^^^^^ + ++-----------+ +| type | ++===========+ +| *uint256* | ++-----------+ + +close() +~~~~~~~ + +- **State mutability**: ``nonpayable`` +- **Signature hash**: ``43d726d6`` + +sell(\ *uint8* ``outcomeTokenIndex``, *uint256* ``outcomeTokenCount``, *uint256* ``minProfit``) +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +- **State mutability**: ``nonpayable`` +- **Signature hash**: ``46280a80`` + +.. _inputs-1: + +Inputs +^^^^^^ + ++-----------+-----------------------+ +| type | name | ++===========+=======================+ +| *uint8* | ``outcomeTokenIndex`` | ++-----------+-----------------------+ +| *uint256* | ``outcomeTokenCount`` | ++-----------+-----------------------+ +| *uint256* | ``minProfit`` | ++-----------+-----------------------+ + +.. _outputs-1: + +Outputs +^^^^^^^ + ++-----------+ +| type | ++===========+ +| *uint256* | ++-----------+ + +withdrawFees() +~~~~~~~~~~~~~~ + +- **State mutability**: ``nonpayable`` +- **Signature hash**: ``476343ee`` + +.. _outputs-2: + +Outputs +^^^^^^^ + ++-----------+ +| type | ++===========+ +| *uint256* | ++-----------+ + +calcMarketFee(\ *uint256* ``outcomeTokenCost``) +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +- **State mutability**: ``view`` +- **Signature hash**: ``b0011509`` + +.. _inputs-2: + +Inputs +^^^^^^ + ++-----------+----------------------+ +| type | name | ++===========+======================+ +| *uint256* | ``outcomeTokenCost`` | ++-----------+----------------------+ + +.. _outputs-3: + +Outputs +^^^^^^^ + ++-----------+ +| type | ++===========+ +| *uint256* | ++-----------+ + +fund(\ *uint256* ``_funding``) +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +- **State mutability**: ``nonpayable`` +- **Signature hash**: ``ca1d209d`` + +.. _inputs-3: + +Inputs +^^^^^^ + ++-----------+--------------+ +| type | name | ++===========+==============+ +| *uint256* | ``_funding`` | ++-----------+--------------+ + +buy(\ *uint8* ``outcomeTokenIndex``, *uint256* ``outcomeTokenCount``, *uint256* ``maxCost``) +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +- **State mutability**: ``nonpayable`` +- **Signature hash**: ``f6d956df`` + +.. _inputs-4: + +Inputs +^^^^^^ + ++-----------+-----------------------+ +| type | name | ++===========+=======================+ +| *uint8* | ``outcomeTokenIndex`` | ++-----------+-----------------------+ +| *uint256* | ``outcomeTokenCount`` | ++-----------+-----------------------+ +| *uint256* | ``maxCost`` | ++-----------+-----------------------+ + +.. _outputs-4: + +Outputs +^^^^^^^ + ++-----------+ +| type | ++===========+ +| *uint256* | ++-----------+ diff --git a/docs/source/MarketMaker.rst b/docs/source/MarketMaker.rst new file mode 100644 index 0000000..720d2e6 --- /dev/null +++ b/docs/source/MarketMaker.rst @@ -0,0 +1,114 @@ +MarketMaker +=========== + +- `MarketMaker <#marketmaker>`__ + + - `Functions <#functions>`__ + + - `calcProfit <#calcprofit-address-market-uint8-outcometokenindex-uint256-outcometokencount>`__\ (*address* + ``market``, *uint8* ``outcomeTokenIndex``, *uint256* + ``outcomeTokenCount``) + - `calcCost <#calccost-address-market-uint8-outcometokenindex-uint256-outcometokencount>`__\ (*address* + ``market``, *uint8* ``outcomeTokenIndex``, *uint256* + ``outcomeTokenCount``) + - `calcMarginalPrice <#calcmarginalprice-address-market-uint8-outcometokenindex>`__\ (*address* + ``market``, *uint8* ``outcomeTokenIndex``) + +Abstract market maker contract - Functions to be implemented by market maker contracts +-------------------------------------------------------------------------------------- + +- **Constructor**: MarketMaker() +- This contract does **not** have a fallback function. + +Functions +--------- + +calcProfit(\ *address* ``market``, *uint8* ``outcomeTokenIndex``, *uint256* ``outcomeTokenCount``) +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +- **State mutability**: ``view`` +- **Signature hash**: ``4091c6a9`` + +Inputs +^^^^^^ + ++-----------+-----------------------+ +| type | name | ++===========+=======================+ +| *address* | ``market`` | ++-----------+-----------------------+ +| *uint8* | ``outcomeTokenIndex`` | ++-----------+-----------------------+ +| *uint256* | ``outcomeTokenCount`` | ++-----------+-----------------------+ + +Outputs +^^^^^^^ + ++-----------+ +| type | ++===========+ +| *uint256* | ++-----------+ + +calcCost(\ *address* ``market``, *uint8* ``outcomeTokenIndex``, *uint256* ``outcomeTokenCount``) +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +- **State mutability**: ``view`` +- **Signature hash**: ``bd8ff817`` + +.. _inputs-1: + +Inputs +^^^^^^ + ++-----------+-----------------------+ +| type | name | ++===========+=======================+ +| *address* | ``market`` | ++-----------+-----------------------+ +| *uint8* | ``outcomeTokenIndex`` | ++-----------+-----------------------+ +| *uint256* | ``outcomeTokenCount`` | ++-----------+-----------------------+ + +.. _outputs-1: + +Outputs +^^^^^^^ + ++-----------+ +| type | ++===========+ +| *uint256* | ++-----------+ + +calcMarginalPrice(\ *address* ``market``, *uint8* ``outcomeTokenIndex``) +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +- **State mutability**: ``view`` +- **Signature hash**: ``d812d346`` + +.. _inputs-2: + +Inputs +^^^^^^ + ++-----------+-----------------------+ +| type | name | ++===========+=======================+ +| *address* | ``market`` | ++-----------+-----------------------+ +| *uint8* | ``outcomeTokenIndex`` | ++-----------+-----------------------+ + +.. _outputs-2: + +Outputs +^^^^^^^ + ++-----------+ +| type | ++===========+ +| *uint256* | ++-----------+ diff --git a/docs/source/Math.rst b/docs/source/Math.rst new file mode 100644 index 0000000..75f2239 --- /dev/null +++ b/docs/source/Math.rst @@ -0,0 +1,554 @@ +Math +==== + +- `Math <#math>`__ + + - `Accessors <#accessors>`__ + - `Functions <#functions>`__ + + - `safeToMul <#safetomul-int256-a-int256-b>`__\ (*int256* ``a``, + *int256* ``b``) + - `ln <#ln-uint256-x>`__\ (*uint256* ``x``) + - `floorLog2 <#floorlog2-uint256-x>`__\ (*uint256* ``x``) + - `safeToAdd <#safetoadd-uint256-a-uint256-b>`__\ (*uint256* + ``a``, *uint256* ``b``) + - `add <#add-uint256-a-uint256-b>`__\ (*uint256* ``a``, *uint256* + ``b``) + - `safeToSub <#safetosub-int256-a-int256-b>`__\ (*int256* ``a``, + *int256* ``b``) + - `add <#add-int256-a-int256-b>`__\ (*int256* ``a``, *int256* + ``b``) + - `sub <#sub-int256-a-int256-b>`__\ (*int256* ``a``, *int256* + ``b``) + - `sub <#sub-uint256-a-uint256-b>`__\ (*uint256* ``a``, *uint256* + ``b``) + - `mul <#mul-int256-a-int256-b>`__\ (*int256* ``a``, *int256* + ``b``) + - `mul <#mul-uint256-a-uint256-b>`__\ (*uint256* ``a``, *uint256* + ``b``) + - `safeToMul <#safetomul-uint256-a-uint256-b>`__\ (*uint256* + ``a``, *uint256* ``b``) + - `max <#max-int256-nums>`__\ (*int256[]* ``nums``) + - `safeToAdd <#safetoadd-int256-a-int256-b>`__\ (*int256* ``a``, + *int256* ``b``) + - `safeToSub <#safetosub-uint256-a-uint256-b>`__\ (*uint256* + ``a``, *uint256* ``b``) + - `exp <#exp-int256-x>`__\ (*int256* ``x``) + +Math library - Allows calculation of logarithmic and exponential functions +-------------------------------------------------------------------------- + +- **Author**: Alan Lu - alan.lu@gnosis.pm\ Stefan George - + stefan@gnosis.pm +- **Constructor**: Math() +- This contract does **not** have a fallback function. + +Accessors +--------- + +- *uint256* LN2() ``02780677`` +- *uint256* LOG2_E() ``24902e24`` +- *uint256* ONE() ``c2ee3a08`` + +Functions +--------- + +safeToMul(\ *int256* ``a``, *int256* ``b``) +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +- **State mutability**: ``view`` +- **Signature hash**: ``1f47ba29`` + +Returns whether a multiply operation causes an overflow + +Inputs +^^^^^^ + ++----------+-------+---------------+ +| type | name | description | ++==========+=======+===============+ +| *int256* | ``a`` | First factor | ++----------+-------+---------------+ +| *int256* | ``b`` | Second factor | ++----------+-------+---------------+ + +Outputs +^^^^^^^ + ++--------+------------------------+ +| type | description | ++========+========================+ +| *bool* | Did no overflow occur? | ++--------+------------------------+ + +ln(\ *uint256* ``x``) +~~~~~~~~~~~~~~~~~~~~~ + +- **State mutability**: ``view`` +- **Signature hash**: ``24d4e90a`` + +Returns natural logarithm value of given x + +.. _inputs-1: + +Inputs +^^^^^^ + ++-----------+-------+-------------+ +| type | name | description | ++===========+=======+=============+ +| *uint256* | ``x`` | x | ++-----------+-------+-------------+ + +.. _outputs-1: + +Outputs +^^^^^^^ + ++----------+-------------+ +| type | description | ++==========+=============+ +| *int256* | ln(x) | ++----------+-------------+ + +floorLog2(\ *uint256* ``x``) +~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +- **State mutability**: ``view`` +- **Signature hash**: ``45b8bafc`` + +Returns base 2 logarithm value of given x + +.. _inputs-2: + +Inputs +^^^^^^ + ++-----------+-------+-------------+ +| type | name | description | ++===========+=======+=============+ +| *uint256* | ``x`` | x | ++-----------+-------+-------------+ + +.. _outputs-2: + +Outputs +^^^^^^^ + ++----------+--------+-------------------+ +| type | name | description | ++==========+========+===================+ +| *int256* | ``lo`` | logarithmic value | ++----------+--------+-------------------+ + +safeToAdd(\ *uint256* ``a``, *uint256* ``b``) +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +- **State mutability**: ``view`` +- **Signature hash**: ``4e30a66c`` + +Returns whether an add operation causes an overflow + +.. _inputs-3: + +Inputs +^^^^^^ + ++-----------+-------+---------------+ +| type | name | description | ++===========+=======+===============+ +| *uint256* | ``a`` | First addend | ++-----------+-------+---------------+ +| *uint256* | ``b`` | Second addend | ++-----------+-------+---------------+ + +.. _outputs-3: + +Outputs +^^^^^^^ + ++--------+------------------------+ +| type | description | ++========+========================+ +| *bool* | Did no overflow occur? | ++--------+------------------------+ + +add(\ *uint256* ``a``, *uint256* ``b``) +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +- **State mutability**: ``view`` +- **Signature hash**: ``771602f7`` + +Returns sum if no overflow occurred + +.. _inputs-4: + +Inputs +^^^^^^ + ++-----------+-------+---------------+ +| type | name | description | ++===========+=======+===============+ +| *uint256* | ``a`` | First addend | ++-----------+-------+---------------+ +| *uint256* | ``b`` | Second addend | ++-----------+-------+---------------+ + +.. _outputs-4: + +Outputs +^^^^^^^ + ++-----------+-------------+ +| type | description | ++===========+=============+ +| *uint256* | Sum | ++-----------+-------------+ + +safeToSub(\ *int256* ``a``, *int256* ``b``) +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +- **State mutability**: ``view`` +- **Signature hash**: ``90304341`` + +Returns whether a subtraction operation causes an underflow + +.. _inputs-5: + +Inputs +^^^^^^ + ++----------+-------+-------------+ +| type | name | description | ++==========+=======+=============+ +| *int256* | ``a`` | Minuend | ++----------+-------+-------------+ +| *int256* | ``b`` | Subtrahend | ++----------+-------+-------------+ + +.. _outputs-5: + +Outputs +^^^^^^^ + ++--------+-------------------------+ +| type | description | ++========+=========================+ +| *bool* | Did no underflow occur? | ++--------+-------------------------+ + +add(\ *int256* ``a``, *int256* ``b``) +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +- **State mutability**: ``view`` +- **Signature hash**: ``a5f3c23b`` + +Returns sum if no overflow occurred + +.. _inputs-6: + +Inputs +^^^^^^ + ++----------+-------+---------------+ +| type | name | description | ++==========+=======+===============+ +| *int256* | ``a`` | First addend | ++----------+-------+---------------+ +| *int256* | ``b`` | Second addend | ++----------+-------+---------------+ + +.. _outputs-6: + +Outputs +^^^^^^^ + ++----------+-------------+ +| type | description | ++==========+=============+ +| *int256* | Sum | ++----------+-------------+ + +sub(\ *int256* ``a``, *int256* ``b``) +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +- **State mutability**: ``view`` +- **Signature hash**: ``adefc37b`` + +Returns difference if no overflow occurred + +.. _inputs-7: + +Inputs +^^^^^^ + ++----------+-------+-------------+ +| type | name | description | ++==========+=======+=============+ +| *int256* | ``a`` | Minuend | ++----------+-------+-------------+ +| *int256* | ``b`` | Subtrahend | ++----------+-------+-------------+ + +.. _outputs-7: + +Outputs +^^^^^^^ + ++----------+-------------+ +| type | description | ++==========+=============+ +| *int256* | Difference | ++----------+-------------+ + +sub(\ *uint256* ``a``, *uint256* ``b``) +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +- **State mutability**: ``view`` +- **Signature hash**: ``b67d77c5`` + +Returns difference if no overflow occurred + +.. _inputs-8: + +Inputs +^^^^^^ + ++-----------+-------+-------------+ +| type | name | description | ++===========+=======+=============+ +| *uint256* | ``a`` | Minuend | ++-----------+-------+-------------+ +| *uint256* | ``b`` | Subtrahend | ++-----------+-------+-------------+ + +.. _outputs-8: + +Outputs +^^^^^^^ + ++-----------+-------------+ +| type | description | ++===========+=============+ +| *uint256* | Difference | ++-----------+-------------+ + +mul(\ *int256* ``a``, *int256* ``b``) +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +- **State mutability**: ``view`` +- **Signature hash**: ``bbe93d91`` + +Returns product if no overflow occurred + +.. _inputs-9: + +Inputs +^^^^^^ + ++----------+-------+---------------+ +| type | name | description | ++==========+=======+===============+ +| *int256* | ``a`` | First factor | ++----------+-------+---------------+ +| *int256* | ``b`` | Second factor | ++----------+-------+---------------+ + +.. _outputs-9: + +Outputs +^^^^^^^ + ++----------+-------------+ +| type | description | ++==========+=============+ +| *int256* | Product | ++----------+-------------+ + +mul(\ *uint256* ``a``, *uint256* ``b``) +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +- **State mutability**: ``view`` +- **Signature hash**: ``c8a4ac9c`` + +Returns product if no overflow occurred + +.. _inputs-10: + +Inputs +^^^^^^ + ++-----------+-------+---------------+ +| type | name | description | ++===========+=======+===============+ +| *uint256* | ``a`` | First factor | ++-----------+-------+---------------+ +| *uint256* | ``b`` | Second factor | ++-----------+-------+---------------+ + +.. _outputs-10: + +Outputs +^^^^^^^ + ++-----------+-------------+ +| type | description | ++===========+=============+ +| *uint256* | Product | ++-----------+-------------+ + +safeToMul(\ *uint256* ``a``, *uint256* ``b``) +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +- **State mutability**: ``view`` +- **Signature hash**: ``cb10fa76`` + +Returns whether a multiply operation causes an overflow + +.. _inputs-11: + +Inputs +^^^^^^ + ++-----------+-------+---------------+ +| type | name | description | ++===========+=======+===============+ +| *uint256* | ``a`` | First factor | ++-----------+-------+---------------+ +| *uint256* | ``b`` | Second factor | ++-----------+-------+---------------+ + +.. _outputs-11: + +Outputs +^^^^^^^ + ++--------+------------------------+ +| type | description | ++========+========================+ +| *bool* | Did no overflow occur? | ++--------+------------------------+ + +max(\ *int256[]* ``nums``) +~~~~~~~~~~~~~~~~~~~~~~~~~~ + +- **State mutability**: ``view`` +- **Signature hash**: ``ccc13814`` + +Returns maximum of an array + +.. _inputs-12: + +Inputs +^^^^^^ + ++------------+----------+-------------------------+ +| type | name | description | ++============+==========+=========================+ +| *int256[]* | ``nums`` | Numbers to look through | ++------------+----------+-------------------------+ + +.. _outputs-12: + +Outputs +^^^^^^^ + ++----------+---------+----------------+ +| type | name | description | ++==========+=========+================+ +| *int256* | ``max`` | Maximum number | ++----------+---------+----------------+ + +safeToAdd(\ *int256* ``a``, *int256* ``b``) +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +- **State mutability**: ``view`` +- **Signature hash**: ``dc08a80b`` + +Returns whether an add operation causes an overflow + +.. _inputs-13: + +Inputs +^^^^^^ + ++----------+-------+---------------+ +| type | name | description | ++==========+=======+===============+ +| *int256* | ``a`` | First addend | ++----------+-------+---------------+ +| *int256* | ``b`` | Second addend | ++----------+-------+---------------+ + +.. _outputs-13: + +Outputs +^^^^^^^ + ++--------+------------------------+ +| type | description | ++========+========================+ +| *bool* | Did no overflow occur? | ++--------+------------------------+ + +safeToSub(\ *uint256* ``a``, *uint256* ``b``) +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +- **State mutability**: ``view`` +- **Signature hash**: ``e31c71c4`` + +Returns whether a subtraction operation causes an underflow + +.. _inputs-14: + +Inputs +^^^^^^ + ++-----------+-------+-------------+ +| type | name | description | ++===========+=======+=============+ +| *uint256* | ``a`` | Minuend | ++-----------+-------+-------------+ +| *uint256* | ``b`` | Subtrahend | ++-----------+-------+-------------+ + +.. _outputs-14: + +Outputs +^^^^^^^ + ++--------+-------------------------+ +| type | description | ++========+=========================+ +| *bool* | Did no underflow occur? | ++--------+-------------------------+ + +exp(\ *int256* ``x``) +~~~~~~~~~~~~~~~~~~~~~ + +- **State mutability**: ``view`` +- **Signature hash**: ``e46751e3`` + +Returns natural exponential function value of given x + +.. _inputs-15: + +Inputs +^^^^^^ + ++----------+-------+-------------+ +| type | name | description | ++==========+=======+=============+ +| *int256* | ``x`` | x | ++----------+-------+-------------+ + +.. _outputs-15: + +Outputs +^^^^^^^ + ++-----------+-------------+ +| type | description | ++===========+=============+ +| *uint256* | e**x | ++-----------+-------------+ diff --git a/docs/source/Oracle.rst b/docs/source/Oracle.rst new file mode 100644 index 0000000..f9a19f6 --- /dev/null +++ b/docs/source/Oracle.rst @@ -0,0 +1,18 @@ +Oracle +====== + +- `Oracle <#oracle>`__ + + - `Accessors <#accessors>`__ + +Abstract oracle contract - Functions to be implemented by oracles +----------------------------------------------------------------- + +- **Constructor**: Oracle() +- This contract does **not** have a fallback function. + +Accessors +--------- + +- *int256* getOutcome() ``7e7e4b47`` +- *bool* isOutcomeSet() ``ccdf68f3`` diff --git a/docs/source/OutcomeToken.rst b/docs/source/OutcomeToken.rst new file mode 100644 index 0000000..4961b9b --- /dev/null +++ b/docs/source/OutcomeToken.rst @@ -0,0 +1,295 @@ +OutcomeToken +============ + +- `OutcomeToken <#outcometoken>`__ + + - `Accessors <#accessors>`__ + - `Events <#events>`__ + + - `Issuance <#issuance-address-indexed-owner-uint256-amount>`__\ (*address* + indexed ``owner``, *uint256* ``amount``) + - `Revocation <#revocation-address-indexed-owner-uint256-amount>`__\ (*address* + indexed ``owner``, *uint256* ``amount``) + - `Transfer <#transfer-address-indexed-from-address-indexed-to-uint256-value>`__\ (*address* + indexed ``from``, *address* indexed ``to``, *uint256* + ``value``) + - `Approval <#approval-address-indexed-owner-address-indexed-spender-uint256-value>`__\ (*address* + indexed ``owner``, *address* indexed ``spender``, *uint256* + ``value``) + + - `Functions <#functions>`__ + + - `approve <#approve-address-spender-uint256-value>`__\ (*address* + ``spender``, *uint256* ``value``) + - `totalSupply <#totalsupply>`__\ () + - `transferFrom <#transferfrom-address-from-address-to-uint256-value>`__\ (*address* + ``from``, *address* ``to``, *uint256* ``value``) + - `balanceOf <#balanceof-address-owner>`__\ (*address* ``owner``) + - `issue <#issue-address-_for-uint256-outcometokencount>`__\ (*address* + ``_for``, *uint256* ``outcomeTokenCount``) + - `transfer <#transfer-address-to-uint256-value>`__\ (*address* + ``to``, *uint256* ``value``) + - `allowance <#allowance-address-owner-address-spender>`__\ (*address* + ``owner``, *address* ``spender``) + - `revoke <#revoke-address-_for-uint256-outcometokencount>`__\ (*address* + ``_for``, *uint256* ``outcomeTokenCount``) + +Outcome token contract - Issuing and revoking outcome tokens +------------------------------------------------------------ + +- **Author**: Stefan George - stefan@gnosis.pm +- **Constructor**: OutcomeToken() +- This contract does **not** have a fallback function. + +Accessors +--------- + +- *address* eventContract() ``e274fd24`` + +Events +------ + +Issuance(\ *address* indexed ``owner``, *uint256* ``amount``) +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +**Signature hash**: +``9cb9c14f7bc76e3a89b796b091850526236115352a198b1e472f00e91376bbcb`` + +Revocation(\ *address* indexed ``owner``, *uint256* ``amount``) +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +**Signature hash**: +``f6a317157440607f36269043eb55f1287a5a19ba2216afeab88cd46cbcfb88e9`` + +Transfer(\ *address* indexed ``from``, *address* indexed ``to``, *uint256* ``value``) +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +**Signature hash**: +``ddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef`` + +Approval(\ *address* indexed ``owner``, *address* indexed ``spender``, *uint256* ``value``) +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +**Signature hash**: +``8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925`` + +Functions +--------- + +approve(\ *address* ``spender``, *uint256* ``value``) +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +- **State mutability**: ``nonpayable`` +- **Signature hash**: ``095ea7b3`` + +Sets approved amount of tokens for spender. Returns success + +Inputs +^^^^^^ + ++-----------+-------------+----------------------------+ +| type | name | description | ++===========+=============+============================+ +| *address* | ``spender`` | Address of allowed account | ++-----------+-------------+----------------------------+ +| *uint256* | ``value`` | Number of approved tokens | ++-----------+-------------+----------------------------+ + +Outputs +^^^^^^^ + ++--------+--------------------------+ +| type | description | ++========+==========================+ +| *bool* | Was approval successful? | ++--------+--------------------------+ + +totalSupply() +~~~~~~~~~~~~~ + +- **State mutability**: ``view`` +- **Signature hash**: ``18160ddd`` + +Returns total supply of tokens + +.. _outputs-1: + +Outputs +^^^^^^^ + ++-----------+--------------+ +| type | description | ++===========+==============+ +| *uint256* | Total supply | ++-----------+--------------+ + +transferFrom(\ *address* ``from``, *address* ``to``, *uint256* ``value``) +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +- **State mutability**: ``nonpayable`` +- **Signature hash**: ``23b872dd`` + +Allows allowed third party to transfer tokens from one address to +another. Returns success + +.. _inputs-1: + +Inputs +^^^^^^ + ++-----------+-----------+-----------------------------------------+ +| type | name | description | ++===========+===========+=========================================+ +| *address* | ``from`` | Address from where tokens are withdrawn | ++-----------+-----------+-----------------------------------------+ +| *address* | ``to`` | Address to where tokens are sent | ++-----------+-----------+-----------------------------------------+ +| *uint256* | ``value`` | Number of tokens to transfer | ++-----------+-----------+-----------------------------------------+ + +.. _outputs-2: + +Outputs +^^^^^^^ + ++--------+--------------------------+ +| type | description | ++========+==========================+ +| *bool* | Was transfer successful? | ++--------+--------------------------+ + +balanceOf(\ *address* ``owner``) +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +- **State mutability**: ``view`` +- **Signature hash**: ``70a08231`` + +Returns number of tokens owned by given address + +.. _inputs-2: + +Inputs +^^^^^^ + ++-----------+-----------+------------------------+ +| type | name | description | ++===========+===========+========================+ +| *address* | ``owner`` | Address of token owner | ++-----------+-----------+------------------------+ + +.. _outputs-3: + +Outputs +^^^^^^^ + ++-----------+------------------+ +| type | description | ++===========+==================+ +| *uint256* | Balance of owner | ++-----------+------------------+ + +issue(\ *address* ``_for``, *uint256* ``outcomeTokenCount``) +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +- **State mutability**: ``nonpayable`` +- **Signature hash**: ``867904b4`` + +Events contract issues new tokens for address. Returns success + +.. _inputs-3: + +Inputs +^^^^^^ + ++-----------+-----------------------+---------------------------+ +| type | name | description | ++===========+=======================+===========================+ +| *address* | ``_for`` | Address of receiver | ++-----------+-----------------------+---------------------------+ +| *uint256* | ``outcomeTokenCount`` | Number of tokens to issue | ++-----------+-----------------------+---------------------------+ + +transfer(\ *address* ``to``, *uint256* ``value``) +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +- **State mutability**: ``nonpayable`` +- **Signature hash**: ``a9059cbb`` + +Transfers sender’s tokens to a given address. Returns success + +.. _inputs-4: + +Inputs +^^^^^^ + ++-----------+-----------+------------------------------+ +| type | name | description | ++===========+===========+==============================+ +| *address* | ``to`` | Address of token receiver | ++-----------+-----------+------------------------------+ +| *uint256* | ``value`` | Number of tokens to transfer | ++-----------+-----------+------------------------------+ + +.. _outputs-4: + +Outputs +^^^^^^^ + ++--------+--------------------------+ +| type | description | ++========+==========================+ +| *bool* | Was transfer successful? | ++--------+--------------------------+ + +allowance(\ *address* ``owner``, *address* ``spender``) +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +- **State mutability**: ``view`` +- **Signature hash**: ``dd62ed3e`` + +Returns number of allowed tokens for given address + +.. _inputs-5: + +Inputs +^^^^^^ + ++-----------+-------------+--------------------------+ +| type | name | description | ++===========+=============+==========================+ +| *address* | ``owner`` | Address of token owner | ++-----------+-------------+--------------------------+ +| *address* | ``spender`` | Address of token spender | ++-----------+-------------+--------------------------+ + +.. _outputs-5: + +Outputs +^^^^^^^ + ++-----------+---------------------------------+ +| type | description | ++===========+=================================+ +| *uint256* | Remaining allowance for spender | ++-----------+---------------------------------+ + +revoke(\ *address* ``_for``, *uint256* ``outcomeTokenCount``) +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +- **State mutability**: ``nonpayable`` +- **Signature hash**: ``eac449d9`` + +Events contract revokes tokens for address. Returns success + +.. _inputs-6: + +Inputs +^^^^^^ + ++-----------+-----------------------+----------------------------+ +| type | name | description | ++===========+=======================+============================+ +| *address* | ``_for`` | Address of token holder | ++-----------+-----------------------+----------------------------+ +| *uint256* | ``outcomeTokenCount`` | Number of tokens to revoke | ++-----------+-----------------------+----------------------------+ diff --git a/docs/source/ScalarEvent.rst b/docs/source/ScalarEvent.rst new file mode 100644 index 0000000..d3ac9b2 --- /dev/null +++ b/docs/source/ScalarEvent.rst @@ -0,0 +1,241 @@ +ScalarEvent +=========== + +- `ScalarEvent <#scalarevent>`__ + + - `Accessors <#accessors>`__ + - `Events <#events>`__ + + - `OutcomeTokenCreation <#outcometokencreation-address-outcometoken-uint8-index>`__\ (*address* + ``outcomeToken``, *uint8* ``index``) + - `OutcomeTokenSetIssuance <#outcometokensetissuance-address-indexed-buyer-uint256-collateraltokencount>`__\ (*address* + indexed ``buyer``, *uint256* ``collateralTokenCount``) + - `OutcomeTokenSetRevocation <#outcometokensetrevocation-address-indexed-seller-uint256-outcometokencount>`__\ (*address* + indexed ``seller``, *uint256* ``outcomeTokenCount``) + - `OutcomeAssignment <#outcomeassignment-int256-outcome>`__\ (*int256* + ``outcome``) + - `WinningsRedemption <#winningsredemption-address-indexed-receiver-uint256-winnings>`__\ (*address* + indexed ``receiver``, *uint256* ``winnings``) + + - `Functions <#functions>`__ + + - `setOutcome <#setoutcome>`__\ () + - `buyAllOutcomes <#buyalloutcomes-uint256-collateraltokencount>`__\ (*uint256* + ``collateralTokenCount``) + - `getOutcomeTokenDistribution <#getoutcometokendistribution-address-owner>`__\ (*address* + ``owner``) + - `sellAllOutcomes <#sellalloutcomes-uint256-outcometokencount>`__\ (*uint256* + ``outcomeTokenCount``) + - `getOutcomeCount <#getoutcomecount>`__\ () + - `redeemWinnings <#redeemwinnings>`__\ () + - `getEventHash <#geteventhash>`__\ () + - `getOutcomeTokens <#getoutcometokens>`__\ () + +Scalar event contract - Scalar events resolve to a number within a range +------------------------------------------------------------------------ + +- **Author**: Stefan George - stefan@gnosis.pm +- **Constructor**: ScalarEvent(\ *address* ``_collateralToken``, + *address* ``_oracle``, *int256* ``_lowerBound``, *int256* + ``_upperBound``) +- This contract does **not** have a fallback function. + +Accessors +--------- + +- *int256* outcome() ``27793f87`` +- *uint8* LONG() ``561cce0a`` +- *uint24* OUTCOME_RANGE() ``6e5452fe`` +- *address* oracle() ``7dc0d1d0`` +- *address* outcomeTokens(\ *uint256*) ``8abe59ea`` +- *int256* lowerBound() ``a384d6ff`` +- *uint8* SHORT() ``a871da91`` +- *int256* upperBound() ``b09ad8a0`` +- *address* collateralToken() ``b2016bd4`` +- *bool* isOutcomeSet() ``ccdf68f3`` + +Events +------ + +OutcomeTokenCreation(\ *address* ``outcomeToken``, *uint8* ``index``) +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +**Signature hash**: +``ad24776dc347085865b6988e249c191fc22d9b31cf54cb62233c3c16be1736ee`` + +OutcomeTokenSetIssuance(\ *address* indexed ``buyer``, *uint256* ``collateralTokenCount``) +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +**Signature hash**: +``ad2a02292986148558019ae4abf172732228e32e131a91d3fa7e0cada61932c0`` + +OutcomeTokenSetRevocation(\ *address* indexed ``seller``, *uint256* ``outcomeTokenCount``) +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +**Signature hash**: +``7ac9271efd660c24459c447459e46f7366d2b4a692e572f108619d0d7273fcc5`` + +OutcomeAssignment(\ *int256* ``outcome``) +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +**Signature hash**: +``b1aaa9f4484acc283375c8e495a44766e4026170797dc9280b4ae2ab5632fb71`` + +WinningsRedemption(\ *address* indexed ``receiver``, *uint256* ``winnings``) +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +**Signature hash**: +``2fe921bb50a459800ae7eae7c0124e9e875094a539eb7dc5b3f728017347e0fb`` + +Functions +--------- + +setOutcome() +~~~~~~~~~~~~ + +- **State mutability**: ``nonpayable`` +- **Signature hash**: ``0537665d`` + +Sets winning event outcome + +buyAllOutcomes(\ *uint256* ``collateralTokenCount``) +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +- **State mutability**: ``nonpayable`` +- **Signature hash**: ``28da850b`` + +Buys equal number of tokens of all outcomes, exchanging collateral +tokens and sets of outcome tokens 1:1 + +Inputs +^^^^^^ + ++-----------+--------------------------+-----------------------------+ +| type | name | description | ++===========+==========================+=============================+ +| *uint256* | ``collateralTokenCount`` | Number of collateral tokens | ++-----------+--------------------------+-----------------------------+ + +getOutcomeTokenDistribution(\ *address* ``owner``) +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +- **State mutability**: ``view`` +- **Signature hash**: ``69c19d4c`` + +Returns the amount of outcome tokens held by owner + +.. _inputs-1: + +Inputs +^^^^^^ + ++-----------+-----------+ +| type | name | ++===========+===========+ +| *address* | ``owner`` | ++-----------+-----------+ + +Outputs +^^^^^^^ + ++-------------+------------------------------+----------------------------+ +| type | name | description | ++=============+==============================+============================+ +| *uint256[]* | ``outcomeTokenDistribution`` | Outcome token distribution | ++-------------+------------------------------+----------------------------+ + +sellAllOutcomes(\ *uint256* ``outcomeTokenCount``) +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +- **State mutability**: ``nonpayable`` +- **Signature hash**: ``6fb1edcd`` + +Sells equal number of tokens of all outcomes, exchanging collateral +tokens and sets of outcome tokens 1:1 + +.. _inputs-2: + +Inputs +^^^^^^ + ++-----------+-----------------------+--------------------------+ +| type | name | description | ++===========+=======================+==========================+ +| *uint256* | ``outcomeTokenCount`` | Number of outcome tokens | ++-----------+-----------------------+--------------------------+ + +getOutcomeCount() +~~~~~~~~~~~~~~~~~ + +- **State mutability**: ``view`` +- **Signature hash**: ``7dc8f086`` + +Returns outcome count + +.. _outputs-1: + +Outputs +^^^^^^^ + ++---------+---------------+ +| type | description | ++=========+===============+ +| *uint8* | Outcome count | ++---------+---------------+ + +redeemWinnings() +~~~~~~~~~~~~~~~~ + +- **State mutability**: ``nonpayable`` +- **Signature hash**: ``ad0b2bec`` + +Exchanges sender’s winning outcome tokens for collateral tokens + +.. _outputs-2: + +Outputs +^^^^^^^ + ++-----------+--------------+-------------------+ +| type | name | description | ++===========+==============+===================+ +| *uint256* | ``winnings`` | Sender’s winnings | ++-----------+--------------+-------------------+ + +getEventHash() +~~~~~~~~~~~~~~ + +- **State mutability**: ``view`` +- **Signature hash**: ``e96e5950`` + +Calculates and returns event hash + +.. _outputs-3: + +Outputs +^^^^^^^ + ++-----------+-------------+ +| type | description | ++===========+=============+ +| *bytes32* | Event hash | ++-----------+-------------+ + +getOutcomeTokens() +~~~~~~~~~~~~~~~~~~ + +- **State mutability**: ``view`` +- **Signature hash**: ``f21a1468`` + +Returns outcome tokens array + +.. _outputs-4: + +Outputs +^^^^^^^ + ++-------------+----------------+ +| type | description | ++=============+================+ +| *address[]* | Outcome tokens | ++-------------+----------------+ diff --git a/docs/source/SignedMessageOracle.rst b/docs/source/SignedMessageOracle.rst new file mode 100644 index 0000000..bb2da49 --- /dev/null +++ b/docs/source/SignedMessageOracle.rst @@ -0,0 +1,143 @@ +SignedMessageOracle +=================== + +- `SignedMessageOracle <#signedmessageoracle>`__ + + - `Accessors <#accessors>`__ + - `Events <#events>`__ + + - `SignerReplacement <#signerreplacement-address-indexed-newsigner>`__\ (*address* + indexed ``newSigner``) + - `OutcomeAssignment <#outcomeassignment-int256-outcome>`__\ (*int256* + ``outcome``) + + - `Functions <#functions>`__ + + - `replaceSigner <#replacesigner-address-newsigner-uint256-_nonce-uint8-v-bytes32-r-bytes32-s>`__\ (*address* + ``newSigner``, *uint256* ``_nonce``, *uint8* ``v``, *bytes32* + ``r``, *bytes32* ``s``) + - `getOutcome <#getoutcome>`__\ () + - `isOutcomeSet <#isoutcomeset>`__\ () + - `setOutcome <#setoutcome-int256-_outcome-uint8-v-bytes32-r-bytes32-s>`__\ (*int256* + ``_outcome``, *uint8* ``v``, *bytes32* ``r``, *bytes32* ``s``) + +Signed message oracle contract - Allows to set an outcome with a signed message +------------------------------------------------------------------------------- + +- **Author**: Stefan George - stefan@gnosis.pm +- **Constructor**: SignedMessageOracle(\ *bytes32* + ``_descriptionHash``, *uint8* ``v``, *bytes32* ``r``, *bytes32* + ``s``) +- This contract does **not** have a fallback function. + +Accessors +--------- + +- *address* signer() ``238ac933`` +- *int256* outcome() ``27793f87`` +- *bytes32* descriptionHash() ``85dcee93`` +- *bool* isSet() ``c65fb380`` + +Events +------ + +SignerReplacement(\ *address* indexed ``newSigner``) +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +**Signature hash**: +``db3046afd053bee6427d6355ee95671fceb37ee6b944866f9ea86eaa213dac68`` + +OutcomeAssignment(\ *int256* ``outcome``) +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +**Signature hash**: +``b1aaa9f4484acc283375c8e495a44766e4026170797dc9280b4ae2ab5632fb71`` + +Functions +--------- + +replaceSigner(\ *address* ``newSigner``, *uint256* ``_nonce``, *uint8* ``v``, *bytes32* ``r``, *bytes32* ``s``) +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +- **State mutability**: ``nonpayable`` +- **Signature hash**: ``5011e399`` + +Replaces signer + +Inputs +^^^^^^ + ++-----------+---------------+----------------------------------------+ +| type | name | description | ++===========+===============+========================================+ +| *address* | ``newSigner`` | New signer | ++-----------+---------------+----------------------------------------+ +| *uint256* | ``_nonce`` | Unique nonce to prevent replay attacks | ++-----------+---------------+----------------------------------------+ +| *uint8* | ``v`` | Signature parameter | ++-----------+---------------+----------------------------------------+ +| *bytes32* | ``r`` | Signature parameter | ++-----------+---------------+----------------------------------------+ +| *bytes32* | ``s`` | Signature parameter | ++-----------+---------------+----------------------------------------+ + +getOutcome() +~~~~~~~~~~~~ + +- **State mutability**: ``view`` +- **Signature hash**: ``7e7e4b47`` + +Returns winning outcome + +Outputs +^^^^^^^ + ++----------+-------------+ +| type | description | ++==========+=============+ +| *int256* | Outcome | ++----------+-------------+ + +isOutcomeSet() +~~~~~~~~~~~~~~ + +- **State mutability**: ``view`` +- **Signature hash**: ``ccdf68f3`` + +Returns if winning outcome + +.. _outputs-1: + +Outputs +^^^^^^^ + ++--------+-----------------+ +| type | description | ++========+=================+ +| *bool* | Is outcome set? | ++--------+-----------------+ + +setOutcome(\ *int256* ``_outcome``, *uint8* ``v``, *bytes32* ``r``, *bytes32* ``s``) +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +- **State mutability**: ``nonpayable`` +- **Signature hash**: ``d9bf3187`` + +Sets outcome based on signed message + +.. _inputs-1: + +Inputs +^^^^^^ + ++-----------+--------------+----------------------+ +| type | name | description | ++===========+==============+======================+ +| *int256* | ``_outcome`` | Signed event outcome | ++-----------+--------------+----------------------+ +| *uint8* | ``v`` | Signature parameter | ++-----------+--------------+----------------------+ +| *bytes32* | ``r`` | Signature parameter | ++-----------+--------------+----------------------+ +| *bytes32* | ``s`` | Signature parameter | ++-----------+--------------+----------------------+ diff --git a/docs/source/SignedMessageOracleFactory.rst b/docs/source/SignedMessageOracleFactory.rst new file mode 100644 index 0000000..0de86ac --- /dev/null +++ b/docs/source/SignedMessageOracleFactory.rst @@ -0,0 +1,67 @@ +SignedMessageOracleFactory +========================== + +- `SignedMessageOracleFactory <#signedmessageoraclefactory>`__ + + - `Events <#events>`__ + + - `SignedMessageOracleCreation <#signedmessageoraclecreation-address-indexed-creator-address-signedmessageoracle-address-oracle>`__\ (*address* + indexed ``creator``, *address* ``signedMessageOracle``, + *address* ``oracle``) + + - `Functions <#functions>`__ + + - `createSignedMessageOracle <#createsignedmessageoracle-bytes32-descriptionhash-uint8-v-bytes32-r-bytes32-s>`__\ (*bytes32* + ``descriptionHash``, *uint8* ``v``, *bytes32* ``r``, *bytes32* + ``s``) + +Signed message oracle factory contract - Allows to create signed message oracle contracts +----------------------------------------------------------------------------------------- + +- **Author**: Stefan George - stefan@gnosis.pm +- **Constructor**: SignedMessageOracleFactory() +- This contract does **not** have a fallback function. + +Events +------ + +SignedMessageOracleCreation(\ *address* indexed ``creator``, *address* ``signedMessageOracle``, *address* ``oracle``) +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +**Signature hash**: +``7be438e4a33b832fcd7adccf30167ee27bd3e693a5ff6daf7fcf98fb2163b7a2`` + +Functions +--------- + +createSignedMessageOracle(\ *bytes32* ``descriptionHash``, *uint8* ``v``, *bytes32* ``r``, *bytes32* ``s``) +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +- **State mutability**: ``nonpayable`` +- **Signature hash**: ``655d0862`` + +Creates a new signed message oracle contract + +Inputs +^^^^^^ + ++-----------+---------------------+----------------------------------------------+ +| type | name | description | ++===========+=====================+==============================================+ +| *bytes32* | ``descriptionHash`` | Hash identifying off chain event description | ++-----------+---------------------+----------------------------------------------+ +| *uint8* | ``v`` | Signature parameter | ++-----------+---------------------+----------------------------------------------+ +| *bytes32* | ``r`` | Signature parameter | ++-----------+---------------------+----------------------------------------------+ +| *bytes32* | ``s`` | Signature parameter | ++-----------+---------------------+----------------------------------------------+ + +Outputs +^^^^^^^ + ++-----------+-------------------------+-----------------+ +| type | name | description | ++===========+=========================+=================+ +| *address* | ``signedMessageOracle`` | Oracle contract | ++-----------+-------------------------+-----------------+ diff --git a/docs/source/StandardMarket.rst b/docs/source/StandardMarket.rst new file mode 100644 index 0000000..f2fe615 --- /dev/null +++ b/docs/source/StandardMarket.rst @@ -0,0 +1,300 @@ +StandardMarket +============== + +- `StandardMarket <#standardmarket>`__ + + - `Accessors <#accessors>`__ + - `Events <#events>`__ + + - `MarketFunding <#marketfunding-uint256-funding>`__\ (*uint256* + ``funding``) + - `MarketClosing <#marketclosing>`__\ () + - `FeeWithdrawal <#feewithdrawal-uint256-fees>`__\ (*uint256* + ``fees``) + - `OutcomeTokenPurchase <#outcometokenpurchase-address-indexed-buyer-uint8-outcometokenindex-uint256-outcometokencount-uint256-outcometokencost-uint256-marketfees>`__\ (*address* + indexed ``buyer``, *uint8* ``outcomeTokenIndex``, *uint256* + ``outcomeTokenCount``, *uint256* ``outcomeTokenCost``, + *uint256* ``marketFees``) + - `OutcomeTokenSale <#outcometokensale-address-indexed-seller-uint8-outcometokenindex-uint256-outcometokencount-uint256-outcometokenprofit-uint256-marketfees>`__\ (*address* + indexed ``seller``, *uint8* ``outcomeTokenIndex``, *uint256* + ``outcomeTokenCount``, *uint256* ``outcomeTokenProfit``, + *uint256* ``marketFees``) + - `OutcomeTokenShortSale <#outcometokenshortsale-address-indexed-buyer-uint8-outcometokenindex-uint256-outcometokencount-uint256-cost>`__\ (*address* + indexed ``buyer``, *uint8* ``outcomeTokenIndex``, *uint256* + ``outcomeTokenCount``, *uint256* ``cost``) + + - `Functions <#functions>`__ + + - `shortSell <#shortsell-uint8-outcometokenindex-uint256-outcometokencount-uint256-minprofit>`__\ (*uint8* + ``outcomeTokenIndex``, *uint256* ``outcomeTokenCount``, + *uint256* ``minProfit``) + - `close <#close>`__\ () + - `sell <#sell-uint8-outcometokenindex-uint256-outcometokencount-uint256-minprofit>`__\ (*uint8* + ``outcomeTokenIndex``, *uint256* ``outcomeTokenCount``, + *uint256* ``minProfit``) + - `withdrawFees <#withdrawfees>`__\ () + - `calcMarketFee <#calcmarketfee-uint256-outcometokencost>`__\ (*uint256* + ``outcomeTokenCost``) + - `fund <#fund-uint256-_funding>`__\ (*uint256* ``_funding``) + - `buy <#buy-uint8-outcometokenindex-uint256-outcometokencount-uint256-maxcost>`__\ (*uint8* + ``outcomeTokenIndex``, *uint256* ``outcomeTokenCount``, + *uint256* ``maxCost``) + +Market factory contract - Allows to create market contracts +----------------------------------------------------------- + +- **Author**: Stefan George - stefan@gnosis.pm +- **Constructor**: StandardMarket(\ *address* ``_creator``, *address* + ``_eventContract``, *address* ``_marketMaker``, *uint24* ``_fee``) +- This contract does **not** have a fallback function. + +Accessors +--------- + +- *address* creator() ``02d05d3f`` +- *address* marketMaker() ``1f21f9af`` +- *uint256* createdAtBlock() ``59acb42c`` +- *int256* netOutcomeTokensSold(\ *uint256*) ``a157979c`` +- *uint8* stage() ``c040e6b8`` +- *uint256* funding() ``cb4c86b7`` +- *uint24* fee() ``ddca3f43`` +- *address* eventContract() ``e274fd24`` +- *uint24* FEE_RANGE() ``fbde47f6`` + +Events +------ + +MarketFunding(\ *uint256* ``funding``) +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +**Signature hash**: +``8a2fe22ce705a4ac9c189969cef327affbdc477afdae4ae274c2f8ad021f9163`` + +MarketClosing() +~~~~~~~~~~~~~~~ + +**Signature hash**: +``e7d85885f81486e8f4c99e50e056745493861b8b5d4f973dcf0c3c0f74a25e07`` + +FeeWithdrawal(\ *uint256* ``fees``) +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +**Signature hash**: +``706d7f48c702007c2fb0881cea5759732e64f52faee427d5ab030787cfb7d787`` + +OutcomeTokenPurchase(\ *address* indexed ``buyer``, *uint8* ``outcomeTokenIndex``, *uint256* ``outcomeTokenCount``, *uint256* ``outcomeTokenCost``, *uint256* ``marketFees``) +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +**Signature hash**: +``7caea4a19892ce49b4daa2014d5599eed561dcd16ffabfac851a9737217ae410`` + +OutcomeTokenSale(\ *address* indexed ``seller``, *uint8* ``outcomeTokenIndex``, *uint256* ``outcomeTokenCount``, *uint256* ``outcomeTokenProfit``, *uint256* ``marketFees``) +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +**Signature hash**: +``ab24ef3371efb2e0e3b02955e33b8ef03c14523e71f3bda87878a2386cc17b69`` + +OutcomeTokenShortSale(\ *address* indexed ``buyer``, *uint8* ``outcomeTokenIndex``, *uint256* ``outcomeTokenCount``, *uint256* ``cost``) +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +**Signature hash**: +``1dbdc4ff4d51949738d56e120b2be4edecc55d8d2150f1616ec5802abaae3f88`` + +Functions +--------- + +shortSell(\ *uint8* ``outcomeTokenIndex``, *uint256* ``outcomeTokenCount``, *uint256* ``minProfit``) +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +- **State mutability**: ``nonpayable`` +- **Signature hash**: ``28c05d32`` + +Buys all outcomes, then sells all shares of selected outcome which were +bought, keeping shares of all other outcome tokens. + +Inputs +^^^^^^ + ++-----+------------+---------------------------------------------------+ +| typ | name | description | +| e | | | ++=====+============+===================================================+ +| *ui | ``outcomeT | Index of the outcome token to short sell | +| nt8 | okenIndex` | | +| * | ` | | ++-----+------------+---------------------------------------------------+ +| *ui | ``outcomeT | Amount of outcome tokens to short sell | +| nt2 | okenCount` | | +| 56* | ` | | ++-----+------------+---------------------------------------------------+ +| *ui | ``minProfi | The minimum profit in collateral tokens to earn | +| nt2 | t`` | for short sold outcome tokens | +| 56* | | | ++-----+------------+---------------------------------------------------+ + +Outputs +^^^^^^^ + ++-----------+----------+-------------------------------------------------+ +| type | name | description | ++===========+==========+=================================================+ +| *uint256* | ``cost`` | Cost to short sell outcome in collateral tokens | ++-----------+----------+-------------------------------------------------+ + +close() +~~~~~~~ + +- **State mutability**: ``nonpayable`` +- **Signature hash**: ``43d726d6`` + +Allows market creator to close the markets by transferring all remaining +outcome tokens to the creator + +sell(\ *uint8* ``outcomeTokenIndex``, *uint256* ``outcomeTokenCount``, *uint256* ``minProfit``) +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +- **State mutability**: ``nonpayable`` +- **Signature hash**: ``46280a80`` + +Allows to sell outcome tokens to market maker + +.. _inputs-1: + +Inputs +^^^^^^ + ++-----+-------------+-------------------------------------------------+ +| typ | name | description | +| e | | | ++=====+=============+=================================================+ +| *ui | ``outcomeTo | Index of the outcome token to sell | +| nt8 | kenIndex`` | | +| * | | | ++-----+-------------+-------------------------------------------------+ +| *ui | ``outcomeTo | Amount of outcome tokens to sell | +| nt2 | kenCount`` | | +| 56* | | | ++-----+-------------+-------------------------------------------------+ +| *ui | ``minProfit | The minimum profit in collateral tokens to earn | +| nt2 | `` | for outcome tokens | +| 56* | | | ++-----+-------------+-------------------------------------------------+ + +.. _outputs-1: + +Outputs +^^^^^^^ + ++-----------+------------+-----------------------------+ +| type | name | description | ++===========+============+=============================+ +| *uint256* | ``profit`` | Profit in collateral tokens | ++-----------+------------+-----------------------------+ + +withdrawFees() +~~~~~~~~~~~~~~ + +- **State mutability**: ``nonpayable`` +- **Signature hash**: ``476343ee`` + +Allows market creator to withdraw fees generated by trades + +.. _outputs-2: + +Outputs +^^^^^^^ + ++-----------+----------+-------------+ +| type | name | description | ++===========+==========+=============+ +| *uint256* | ``fees`` | Fee amount | ++-----------+----------+-------------+ + +calcMarketFee(\ *uint256* ``outcomeTokenCost``) +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +- **State mutability**: ``view`` +- **Signature hash**: ``b0011509`` + +Calculates fee to be paid to market maker + +.. _inputs-2: + +Inputs +^^^^^^ + ++-----------+----------------------+--------------------------------+ +| type | name | description | ++===========+======================+================================+ +| *uint256* | ``outcomeTokenCost`` | Cost for buying outcome tokens | ++-----------+----------------------+--------------------------------+ + +.. _outputs-3: + +Outputs +^^^^^^^ + ++-----------+---------------+ +| type | description | ++===========+===============+ +| *uint256* | Fee for trade | ++-----------+---------------+ + +fund(\ *uint256* ``_funding``) +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +- **State mutability**: ``nonpayable`` +- **Signature hash**: ``ca1d209d`` + +Allows to fund the market with collateral tokens converting them into +outcome tokens + +.. _inputs-3: + +Inputs +^^^^^^ + ++-----------+--------------+----------------+ +| type | name | description | ++===========+==============+================+ +| *uint256* | ``_funding`` | Funding amount | ++-----------+--------------+----------------+ + +buy(\ *uint8* ``outcomeTokenIndex``, *uint256* ``outcomeTokenCount``, *uint256* ``maxCost``) +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +- **State mutability**: ``nonpayable`` +- **Signature hash**: ``f6d956df`` + +Allows to buy outcome tokens from market maker + +.. _inputs-4: + +Inputs +^^^^^^ + ++------+--------------+------------------------------------------------+ +| type | name | description | ++======+==============+================================================+ +| *uin | ``outcomeTok | Index of the outcome token to buy | +| t8* | enIndex`` | | ++------+--------------+------------------------------------------------+ +| *uin | ``outcomeTok | Amount of outcome tokens to buy | +| t256 | enCount`` | | +| * | | | ++------+--------------+------------------------------------------------+ +| *uin | ``maxCost`` | The maximum cost in collateral tokens to pay | +| t256 | | for outcome tokens | +| * | | | ++------+--------------+------------------------------------------------+ + +.. _outputs-4: + +Outputs +^^^^^^^ + ++-----------+----------+---------------------------+ +| type | name | description | ++===========+==========+===========================+ +| *uint256* | ``cost`` | Cost in collateral tokens | ++-----------+----------+---------------------------+ diff --git a/docs/source/StandardMarketFactory.rst b/docs/source/StandardMarketFactory.rst new file mode 100644 index 0000000..b73b1f6 --- /dev/null +++ b/docs/source/StandardMarketFactory.rst @@ -0,0 +1,64 @@ +StandardMarketFactory +===================== + +- `StandardMarketFactory <#standardmarketfactory>`__ + + - `Events <#events>`__ + + - `StandardMarketCreation <#standardmarketcreation-address-indexed-creator-address-market-address-eventcontract-address-marketmaker-uint24-fee>`__\ (*address* + indexed ``creator``, *address* ``market``, *address* + ``eventContract``, *address* ``marketMaker``, *uint24* ``fee``) + + - `Functions <#functions>`__ + + - `createMarket <#createmarket-address-eventcontract-address-marketmaker-uint24-fee>`__\ (*address* + ``eventContract``, *address* ``marketMaker``, *uint24* ``fee``) + +Market factory contract - Allows to create market contracts +----------------------------------------------------------- + +- **Author**: Stefan George - stefan@gnosis.pm +- **Constructor**: StandardMarketFactory() +- This contract does **not** have a fallback function. + +Events +------ + +StandardMarketCreation(\ *address* indexed ``creator``, *address* ``market``, *address* ``eventContract``, *address* ``marketMaker``, *uint24* ``fee``) +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +**Signature hash**: +``a88e14227921dd3cab0fe30e6e4e4f8d646d8968abd25634fe49781588a8cf94`` + +Functions +--------- + +createMarket(\ *address* ``eventContract``, *address* ``marketMaker``, *uint24* ``fee``) +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +- **State mutability**: ``nonpayable`` +- **Signature hash**: ``7abeb6a0`` + +Creates a new market contract + +Inputs +^^^^^^ + ++-----------+-------------------+-----------------------+ +| type | name | description | ++===========+===================+=======================+ +| *address* | ``eventContract`` | Event contract | ++-----------+-------------------+-----------------------+ +| *address* | ``marketMaker`` | Market maker contract | ++-----------+-------------------+-----------------------+ +| *uint24* | ``fee`` | Market fee | ++-----------+-------------------+-----------------------+ + +Outputs +^^^^^^^ + ++-----------+------------+-----------------+ +| type | name | description | ++===========+============+=================+ +| *address* | ``market`` | Market contract | ++-----------+------------+-----------------+ diff --git a/docs/source/StandardMarketWithPriceLogger.rst b/docs/source/StandardMarketWithPriceLogger.rst new file mode 100644 index 0000000..67460d6 --- /dev/null +++ b/docs/source/StandardMarketWithPriceLogger.rst @@ -0,0 +1,323 @@ +StandardMarketWithPriceLogger +============================= + +- `StandardMarketWithPriceLogger <#standardmarketwithpricelogger>`__ + + - `Accessors <#accessors>`__ + - `Events <#events>`__ + + - `MarketFunding <#marketfunding-uint256-funding>`__\ (*uint256* + ``funding``) + - `MarketClosing <#marketclosing>`__\ () + - `FeeWithdrawal <#feewithdrawal-uint256-fees>`__\ (*uint256* + ``fees``) + - `OutcomeTokenPurchase <#outcometokenpurchase-address-indexed-buyer-uint8-outcometokenindex-uint256-outcometokencount-uint256-outcometokencost-uint256-marketfees>`__\ (*address* + indexed ``buyer``, *uint8* ``outcomeTokenIndex``, *uint256* + ``outcomeTokenCount``, *uint256* ``outcomeTokenCost``, + *uint256* ``marketFees``) + - `OutcomeTokenSale <#outcometokensale-address-indexed-seller-uint8-outcometokenindex-uint256-outcometokencount-uint256-outcometokenprofit-uint256-marketfees>`__\ (*address* + indexed ``seller``, *uint8* ``outcomeTokenIndex``, *uint256* + ``outcomeTokenCount``, *uint256* ``outcomeTokenProfit``, + *uint256* ``marketFees``) + - `OutcomeTokenShortSale <#outcometokenshortsale-address-indexed-buyer-uint8-outcometokenindex-uint256-outcometokencount-uint256-cost>`__\ (*address* + indexed ``buyer``, *uint8* ``outcomeTokenIndex``, *uint256* + ``outcomeTokenCount``, *uint256* ``cost``) + + - `Functions <#functions>`__ + + - `shortSell <#shortsell-uint8-outcometokenindex-uint256-outcometokencount-uint256-minprofit>`__\ (*uint8* + ``outcomeTokenIndex``, *uint256* ``outcomeTokenCount``, + *uint256* ``minProfit``) + - `close <#close>`__\ () + - `sell <#sell-uint8-outcometokenindex-uint256-outcometokencount-uint256-minprofit>`__\ (*uint8* + ``outcomeTokenIndex``, *uint256* ``outcomeTokenCount``, + *uint256* ``minProfit``) + - `withdrawFees <#withdrawfees>`__\ () + - `calcMarketFee <#calcmarketfee-uint256-outcometokencost>`__\ (*uint256* + ``outcomeTokenCost``) + - `fund <#fund-uint256-_funding>`__\ (*uint256* ``_funding``) + - `getAvgPrice <#getavgprice>`__\ () + - `buy <#buy-uint8-outcometokenindex-uint256-outcometokencount-uint256-maxcost>`__\ (*uint8* + ``outcomeTokenIndex``, *uint256* ``outcomeTokenCount``, + *uint256* ``maxCost``) + +- **Constructor**: StandardMarketWithPriceLogger(\ *address* + ``_creator``, *address* ``_eventContract``, *address* + ``_marketMaker``, *uint24* ``_fee``, *uint256* ``_startDate``) +- This contract does **not** have a fallback function. + +Accessors +--------- + +- *address* creator() ``02d05d3f`` +- *uint256* startDate() ``0b97bc86`` +- *address* marketMaker() ``1f21f9af`` +- *uint8* LONG() ``561cce0a`` +- *uint256* createdAtBlock() ``59acb42c`` +- *uint256* lastTradeDate() ``68b586d5`` +- *uint256* priceIntegral() ``8b797a0c`` +- *int256* netOutcomeTokensSold(\ *uint256*) ``a157979c`` +- *uint8* stage() ``c040e6b8`` +- *uint256* endDate() ``c24a0f8b`` +- *uint256* funding() ``cb4c86b7`` +- *uint24* fee() ``ddca3f43`` +- *uint256* lastTradePrice() ``df449cb8`` +- *address* eventContract() ``e274fd24`` +- *uint24* FEE_RANGE() ``fbde47f6`` + +Events +------ + +MarketFunding(\ *uint256* ``funding``) +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +**Signature hash**: +``8a2fe22ce705a4ac9c189969cef327affbdc477afdae4ae274c2f8ad021f9163`` + +MarketClosing() +~~~~~~~~~~~~~~~ + +**Signature hash**: +``e7d85885f81486e8f4c99e50e056745493861b8b5d4f973dcf0c3c0f74a25e07`` + +FeeWithdrawal(\ *uint256* ``fees``) +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +**Signature hash**: +``706d7f48c702007c2fb0881cea5759732e64f52faee427d5ab030787cfb7d787`` + +OutcomeTokenPurchase(\ *address* indexed ``buyer``, *uint8* ``outcomeTokenIndex``, *uint256* ``outcomeTokenCount``, *uint256* ``outcomeTokenCost``, *uint256* ``marketFees``) +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +**Signature hash**: +``7caea4a19892ce49b4daa2014d5599eed561dcd16ffabfac851a9737217ae410`` + +OutcomeTokenSale(\ *address* indexed ``seller``, *uint8* ``outcomeTokenIndex``, *uint256* ``outcomeTokenCount``, *uint256* ``outcomeTokenProfit``, *uint256* ``marketFees``) +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +**Signature hash**: +``ab24ef3371efb2e0e3b02955e33b8ef03c14523e71f3bda87878a2386cc17b69`` + +OutcomeTokenShortSale(\ *address* indexed ``buyer``, *uint8* ``outcomeTokenIndex``, *uint256* ``outcomeTokenCount``, *uint256* ``cost``) +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +**Signature hash**: +``1dbdc4ff4d51949738d56e120b2be4edecc55d8d2150f1616ec5802abaae3f88`` + +Functions +--------- + +shortSell(\ *uint8* ``outcomeTokenIndex``, *uint256* ``outcomeTokenCount``, *uint256* ``minProfit``) +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +- **State mutability**: ``nonpayable`` +- **Signature hash**: ``28c05d32`` + +Buys all outcomes, then sells all shares of selected outcome which were +bought, keeping shares of all other outcome tokens. + +Inputs +^^^^^^ + ++-----+------------+---------------------------------------------------+ +| typ | name | description | +| e | | | ++=====+============+===================================================+ +| *ui | ``outcomeT | Index of the outcome token to short sell | +| nt8 | okenIndex` | | +| * | ` | | ++-----+------------+---------------------------------------------------+ +| *ui | ``outcomeT | Amount of outcome tokens to short sell | +| nt2 | okenCount` | | +| 56* | ` | | ++-----+------------+---------------------------------------------------+ +| *ui | ``minProfi | The minimum profit in collateral tokens to earn | +| nt2 | t`` | for short sold outcome tokens | +| 56* | | | ++-----+------------+---------------------------------------------------+ + +Outputs +^^^^^^^ + ++-----------+----------+-------------------------------------------------+ +| type | name | description | ++===========+==========+=================================================+ +| *uint256* | ``cost`` | Cost to short sell outcome in collateral tokens | ++-----------+----------+-------------------------------------------------+ + +close() +~~~~~~~ + +- **State mutability**: ``nonpayable`` +- **Signature hash**: ``43d726d6`` + +Allows market creator to close the markets by transferring all remaining +outcome tokens to the creator + +sell(\ *uint8* ``outcomeTokenIndex``, *uint256* ``outcomeTokenCount``, *uint256* ``minProfit``) +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +- **State mutability**: ``nonpayable`` +- **Signature hash**: ``46280a80`` + +Allows to sell outcome tokens to market maker + +.. _inputs-1: + +Inputs +^^^^^^ + ++-----+-------------+-------------------------------------------------+ +| typ | name | description | +| e | | | ++=====+=============+=================================================+ +| *ui | ``outcomeTo | Index of the outcome token to sell | +| nt8 | kenIndex`` | | +| * | | | ++-----+-------------+-------------------------------------------------+ +| *ui | ``outcomeTo | Amount of outcome tokens to sell | +| nt2 | kenCount`` | | +| 56* | | | ++-----+-------------+-------------------------------------------------+ +| *ui | ``minProfit | The minimum profit in collateral tokens to earn | +| nt2 | `` | for outcome tokens | +| 56* | | | ++-----+-------------+-------------------------------------------------+ + +.. _outputs-1: + +Outputs +^^^^^^^ + ++-----------+------------+-----------------------------+ +| type | name | description | ++===========+============+=============================+ +| *uint256* | ``profit`` | Profit in collateral tokens | ++-----------+------------+-----------------------------+ + +withdrawFees() +~~~~~~~~~~~~~~ + +- **State mutability**: ``nonpayable`` +- **Signature hash**: ``476343ee`` + +Allows market creator to withdraw fees generated by trades + +.. _outputs-2: + +Outputs +^^^^^^^ + ++-----------+----------+-------------+ +| type | name | description | ++===========+==========+=============+ +| *uint256* | ``fees`` | Fee amount | ++-----------+----------+-------------+ + +calcMarketFee(\ *uint256* ``outcomeTokenCost``) +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +- **State mutability**: ``view`` +- **Signature hash**: ``b0011509`` + +Calculates fee to be paid to market maker + +.. _inputs-2: + +Inputs +^^^^^^ + ++-----------+----------------------+--------------------------------+ +| type | name | description | ++===========+======================+================================+ +| *uint256* | ``outcomeTokenCost`` | Cost for buying outcome tokens | ++-----------+----------------------+--------------------------------+ + +.. _outputs-3: + +Outputs +^^^^^^^ + ++-----------+---------------+ +| type | description | ++===========+===============+ +| *uint256* | Fee for trade | ++-----------+---------------+ + +fund(\ *uint256* ``_funding``) +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +- **State mutability**: ``nonpayable`` +- **Signature hash**: ``ca1d209d`` + +Allows to fund the market with collateral tokens converting them into +outcome tokens + +.. _inputs-3: + +Inputs +^^^^^^ + ++-----------+--------------+----------------+ +| type | name | description | ++===========+==============+================+ +| *uint256* | ``_funding`` | Funding amount | ++-----------+--------------+----------------+ + +getAvgPrice() +~~~~~~~~~~~~~ + +- **State mutability**: ``nonpayable`` +- **Signature hash**: ``f01e66ec`` + +Calculates average price for long tokens based on price integral + +.. _outputs-4: + +Outputs +^^^^^^^ + ++-----------+-----------------------------------------+ +| type | description | ++===========+=========================================+ +| *uint256* | Average price for long tokens over time | ++-----------+-----------------------------------------+ + +buy(\ *uint8* ``outcomeTokenIndex``, *uint256* ``outcomeTokenCount``, *uint256* ``maxCost``) +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +- **State mutability**: ``nonpayable`` +- **Signature hash**: ``f6d956df`` + +Allows to buy outcome tokens from market maker + +.. _inputs-4: + +Inputs +^^^^^^ + ++------+--------------+------------------------------------------------+ +| type | name | description | ++======+==============+================================================+ +| *uin | ``outcomeTok | Index of the outcome token to buy | +| t8* | enIndex`` | | ++------+--------------+------------------------------------------------+ +| *uin | ``outcomeTok | Amount of outcome tokens to buy | +| t256 | enCount`` | | +| * | | | ++------+--------------+------------------------------------------------+ +| *uin | ``maxCost`` | The maximum cost in collateral tokens to pay | +| t256 | | for outcome tokens | +| * | | | ++------+--------------+------------------------------------------------+ + +.. _outputs-5: + +Outputs +^^^^^^^ + ++-----------+----------+---------------------------+ +| type | name | description | ++===========+==========+===========================+ +| *uint256* | ``cost`` | Cost in collateral tokens | ++-----------+----------+---------------------------+ diff --git a/docs/source/StandardMarketWithPriceLoggerFactory.rst b/docs/source/StandardMarketWithPriceLoggerFactory.rst new file mode 100644 index 0000000..139e48f --- /dev/null +++ b/docs/source/StandardMarketWithPriceLoggerFactory.rst @@ -0,0 +1,68 @@ +StandardMarketWithPriceLoggerFactory +==================================== + +- `StandardMarketWithPriceLoggerFactory <#standardmarketwithpriceloggerfactory>`__ + + - `Events <#events>`__ + + - `StandardMarketWithPriceLoggerCreation <#standardmarketwithpriceloggercreation-address-indexed-creator-address-market-address-eventcontract-address-marketmaker-uint24-fee-uint256-startdate>`__\ (*address* + indexed ``creator``, *address* ``market``, *address* + ``eventContract``, *address* ``marketMaker``, *uint24* ``fee``, + *uint256* ``startDate``) + + - `Functions <#functions>`__ + + - `createMarket <#createmarket-address-eventcontract-address-marketmaker-uint24-fee-uint256-startdate>`__\ (*address* + ``eventContract``, *address* ``marketMaker``, *uint24* ``fee``, + *uint256* ``startDate``) + +Market factory contract - Allows to create market contracts +----------------------------------------------------------- + +- **Author**: Stefan George - stefan@gnosis.pm +- **Constructor**: StandardMarketWithPriceLoggerFactory() +- This contract does **not** have a fallback function. + +Events +------ + +StandardMarketWithPriceLoggerCreation(\ *address* indexed ``creator``, *address* ``market``, *address* ``eventContract``, *address* ``marketMaker``, *uint24* ``fee``, *uint256* ``startDate``) +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +**Signature hash**: +``969b1ad77db8ae8298dedcdf1f2945322eaf681e1d56fcebfd4c23de996dc484`` + +Functions +--------- + +createMarket(\ *address* ``eventContract``, *address* ``marketMaker``, *uint24* ``fee``, *uint256* ``startDate``) +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +- **State mutability**: ``nonpayable`` +- **Signature hash**: ``8e44df53`` + +Creates a new market contract + +Inputs +^^^^^^ + ++-----------+-------------------+------------------------------+ +| type | name | description | ++===========+===================+==============================+ +| *address* | ``eventContract`` | Event contract | ++-----------+-------------------+------------------------------+ +| *address* | ``marketMaker`` | Market maker contract | ++-----------+-------------------+------------------------------+ +| *uint24* | ``fee`` | Market fee | ++-----------+-------------------+------------------------------+ +| *uint256* | ``startDate`` | Start date for price logging | ++-----------+-------------------+------------------------------+ + +Outputs +^^^^^^^ + ++-----------+------------+-----------------+ +| type | name | description | ++===========+============+=================+ +| *address* | ``market`` | Market contract | ++-----------+------------+-----------------+ diff --git a/docs/source/StandardToken.rst b/docs/source/StandardToken.rst new file mode 100644 index 0000000..d581f96 --- /dev/null +++ b/docs/source/StandardToken.rst @@ -0,0 +1,226 @@ +StandardToken +============= + +- `StandardToken <#standardtoken>`__ + + - `Events <#events>`__ + + - `Transfer <#transfer-address-indexed-from-address-indexed-to-uint256-value>`__\ (*address* + indexed ``from``, *address* indexed ``to``, *uint256* + ``value``) + - `Approval <#approval-address-indexed-owner-address-indexed-spender-uint256-value>`__\ (*address* + indexed ``owner``, *address* indexed ``spender``, *uint256* + ``value``) + + - `Functions <#functions>`__ + + - `approve <#approve-address-spender-uint256-value>`__\ (*address* + ``spender``, *uint256* ``value``) + - `totalSupply <#totalsupply>`__\ () + - `transferFrom <#transferfrom-address-from-address-to-uint256-value>`__\ (*address* + ``from``, *address* ``to``, *uint256* ``value``) + - `balanceOf <#balanceof-address-owner>`__\ (*address* ``owner``) + - `transfer <#transfer-address-to-uint256-value>`__\ (*address* + ``to``, *uint256* ``value``) + - `allowance <#allowance-address-owner-address-spender>`__\ (*address* + ``owner``, *address* ``spender``) + +Standard token contract with overflow protection +------------------------------------------------ + +- **Constructor**: StandardToken() +- This contract does **not** have a fallback function. + +Events +------ + +Transfer(\ *address* indexed ``from``, *address* indexed ``to``, *uint256* ``value``) +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +**Signature hash**: +``ddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef`` + +Approval(\ *address* indexed ``owner``, *address* indexed ``spender``, *uint256* ``value``) +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +**Signature hash**: +``8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925`` + +Functions +--------- + +approve(\ *address* ``spender``, *uint256* ``value``) +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +- **State mutability**: ``nonpayable`` +- **Signature hash**: ``095ea7b3`` + +Sets approved amount of tokens for spender. Returns success + +Inputs +^^^^^^ + ++-----------+-------------+----------------------------+ +| type | name | description | ++===========+=============+============================+ +| *address* | ``spender`` | Address of allowed account | ++-----------+-------------+----------------------------+ +| *uint256* | ``value`` | Number of approved tokens | ++-----------+-------------+----------------------------+ + +Outputs +^^^^^^^ + ++--------+--------------------------+ +| type | description | ++========+==========================+ +| *bool* | Was approval successful? | ++--------+--------------------------+ + +totalSupply() +~~~~~~~~~~~~~ + +- **State mutability**: ``view`` +- **Signature hash**: ``18160ddd`` + +Returns total supply of tokens + +.. _outputs-1: + +Outputs +^^^^^^^ + ++-----------+--------------+ +| type | description | ++===========+==============+ +| *uint256* | Total supply | ++-----------+--------------+ + +transferFrom(\ *address* ``from``, *address* ``to``, *uint256* ``value``) +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +- **State mutability**: ``nonpayable`` +- **Signature hash**: ``23b872dd`` + +Allows allowed third party to transfer tokens from one address to +another. Returns success + +.. _inputs-1: + +Inputs +^^^^^^ + ++-----------+-----------+-----------------------------------------+ +| type | name | description | ++===========+===========+=========================================+ +| *address* | ``from`` | Address from where tokens are withdrawn | ++-----------+-----------+-----------------------------------------+ +| *address* | ``to`` | Address to where tokens are sent | ++-----------+-----------+-----------------------------------------+ +| *uint256* | ``value`` | Number of tokens to transfer | ++-----------+-----------+-----------------------------------------+ + +.. _outputs-2: + +Outputs +^^^^^^^ + ++--------+--------------------------+ +| type | description | ++========+==========================+ +| *bool* | Was transfer successful? | ++--------+--------------------------+ + +balanceOf(\ *address* ``owner``) +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +- **State mutability**: ``view`` +- **Signature hash**: ``70a08231`` + +Returns number of tokens owned by given address + +.. _inputs-2: + +Inputs +^^^^^^ + ++-----------+-----------+------------------------+ +| type | name | description | ++===========+===========+========================+ +| *address* | ``owner`` | Address of token owner | ++-----------+-----------+------------------------+ + +.. _outputs-3: + +Outputs +^^^^^^^ + ++-----------+------------------+ +| type | description | ++===========+==================+ +| *uint256* | Balance of owner | ++-----------+------------------+ + +transfer(\ *address* ``to``, *uint256* ``value``) +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +- **State mutability**: ``nonpayable`` +- **Signature hash**: ``a9059cbb`` + +Transfers sender’s tokens to a given address. Returns success + +.. _inputs-3: + +Inputs +^^^^^^ + ++-----------+-----------+------------------------------+ +| type | name | description | ++===========+===========+==============================+ +| *address* | ``to`` | Address of token receiver | ++-----------+-----------+------------------------------+ +| *uint256* | ``value`` | Number of tokens to transfer | ++-----------+-----------+------------------------------+ + +.. _outputs-4: + +Outputs +^^^^^^^ + ++--------+--------------------------+ +| type | description | ++========+==========================+ +| *bool* | Was transfer successful? | ++--------+--------------------------+ + +allowance(\ *address* ``owner``, *address* ``spender``) +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +- **State mutability**: ``view`` +- **Signature hash**: ``dd62ed3e`` + +Returns number of allowed tokens for given address + +.. _inputs-4: + +Inputs +^^^^^^ + ++-----------+-------------+--------------------------+ +| type | name | description | ++===========+=============+==========================+ +| *address* | ``owner`` | Address of token owner | ++-----------+-------------+--------------------------+ +| *address* | ``spender`` | Address of token spender | ++-----------+-------------+--------------------------+ + +.. _outputs-5: + +Outputs +^^^^^^^ + ++-----------+---------------------------------+ +| type | description | ++===========+=================================+ +| *uint256* | Remaining allowance for spender | ++-----------+---------------------------------+ diff --git a/docs/source/Token.rst b/docs/source/Token.rst new file mode 100644 index 0000000..d17cc65 --- /dev/null +++ b/docs/source/Token.rst @@ -0,0 +1,201 @@ +Token +===== + +- `Token <#token>`__ + + - `Accessors <#accessors>`__ + - `Events <#events>`__ + + - `Transfer <#transfer-address-indexed-from-address-indexed-to-uint256-value>`__\ (*address* + indexed ``from``, *address* indexed ``to``, *uint256* + ``value``) + - `Approval <#approval-address-indexed-owner-address-indexed-spender-uint256-value>`__\ (*address* + indexed ``owner``, *address* indexed ``spender``, *uint256* + ``value``) + + - `Functions <#functions>`__ + + - `approve <#approve-address-spender-uint256-value>`__\ (*address* + ``spender``, *uint256* ``value``) + - `transferFrom <#transferfrom-address-from-address-to-uint256-value>`__\ (*address* + ``from``, *address* ``to``, *uint256* ``value``) + - `balanceOf <#balanceof-address-owner>`__\ (*address* ``owner``) + - `transfer <#transfer-address-to-uint256-value>`__\ (*address* + ``to``, *uint256* ``value``) + - `allowance <#allowance-address-owner-address-spender>`__\ (*address* + ``owner``, *address* ``spender``) + +Abstract token contract - Functions to be implemented by token contracts +------------------------------------------------------------------------ + +- **Constructor**: Token() +- This contract does **not** have a fallback function. + +Accessors +--------- + +- *uint256* totalSupply() ``18160ddd`` + +Events +------ + +Transfer(\ *address* indexed ``from``, *address* indexed ``to``, *uint256* ``value``) +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +**Signature hash**: +``ddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef`` + +Approval(\ *address* indexed ``owner``, *address* indexed ``spender``, *uint256* ``value``) +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +**Signature hash**: +``8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925`` + +Functions +--------- + +approve(\ *address* ``spender``, *uint256* ``value``) +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +- **State mutability**: ``nonpayable`` +- **Signature hash**: ``095ea7b3`` + +Inputs +^^^^^^ + ++-----------+-------------+ +| type | name | ++===========+=============+ +| *address* | ``spender`` | ++-----------+-------------+ +| *uint256* | ``value`` | ++-----------+-------------+ + +Outputs +^^^^^^^ + ++--------+ +| type | ++========+ +| *bool* | ++--------+ + +transferFrom(\ *address* ``from``, *address* ``to``, *uint256* ``value``) +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +- **State mutability**: ``nonpayable`` +- **Signature hash**: ``23b872dd`` + +.. _inputs-1: + +Inputs +^^^^^^ + ++-----------+-----------+ +| type | name | ++===========+===========+ +| *address* | ``from`` | ++-----------+-----------+ +| *address* | ``to`` | ++-----------+-----------+ +| *uint256* | ``value`` | ++-----------+-----------+ + +.. _outputs-1: + +Outputs +^^^^^^^ + ++--------+ +| type | ++========+ +| *bool* | ++--------+ + +balanceOf(\ *address* ``owner``) +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +- **State mutability**: ``view`` +- **Signature hash**: ``70a08231`` + +.. _inputs-2: + +Inputs +^^^^^^ + ++-----------+-----------+ +| type | name | ++===========+===========+ +| *address* | ``owner`` | ++-----------+-----------+ + +.. _outputs-2: + +Outputs +^^^^^^^ + ++-----------+ +| type | ++===========+ +| *uint256* | ++-----------+ + +transfer(\ *address* ``to``, *uint256* ``value``) +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +- **State mutability**: ``nonpayable`` +- **Signature hash**: ``a9059cbb`` + +.. _inputs-3: + +Inputs +^^^^^^ + ++-----------+-----------+ +| type | name | ++===========+===========+ +| *address* | ``to`` | ++-----------+-----------+ +| *uint256* | ``value`` | ++-----------+-----------+ + +.. _outputs-3: + +Outputs +^^^^^^^ + ++--------+ +| type | ++========+ +| *bool* | ++--------+ + +allowance(\ *address* ``owner``, *address* ``spender``) +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +- **State mutability**: ``view`` +- **Signature hash**: ``dd62ed3e`` + +.. _inputs-4: + +Inputs +^^^^^^ + ++-----------+-------------+ +| type | name | ++===========+=============+ +| *address* | ``owner`` | ++-----------+-------------+ +| *address* | ``spender`` | ++-----------+-------------+ + +.. _outputs-4: + +Outputs +^^^^^^^ + ++-----------+ +| type | ++===========+ +| *uint256* | ++-----------+ diff --git a/docs/source/UltimateOracle.rst b/docs/source/UltimateOracle.rst new file mode 100644 index 0000000..932e422 --- /dev/null +++ b/docs/source/UltimateOracle.rst @@ -0,0 +1,245 @@ +UltimateOracle +============== + +- `UltimateOracle <#ultimateoracle>`__ + + - `Accessors <#accessors>`__ + - `Events <#events>`__ + + - `ForwardedOracleOutcomeAssignment <#forwardedoracleoutcomeassignment-int256-outcome>`__\ (*int256* + ``outcome``) + - `OutcomeChallenge <#outcomechallenge-address-indexed-sender-int256-outcome>`__\ (*address* + indexed ``sender``, *int256* ``outcome``) + - `OutcomeVote <#outcomevote-address-indexed-sender-int256-outcome-uint256-amount>`__\ (*address* + indexed ``sender``, *int256* ``outcome``, *uint256* ``amount``) + - `Withdrawal <#withdrawal-address-indexed-sender-uint256-amount>`__\ (*address* + indexed ``sender``, *uint256* ``amount``) + + - `Functions <#functions>`__ + + - `isFrontRunnerPeriodOver <#isfrontrunnerperiodover>`__\ () + - `withdraw <#withdraw>`__\ () + - `isChallengePeriodOver <#ischallengeperiodover>`__\ () + - `setForwardedOutcome <#setforwardedoutcome>`__\ () + - `getOutcome <#getoutcome>`__\ () + - `isChallenged <#ischallenged>`__\ () + - `challengeOutcome <#challengeoutcome-int256-_outcome>`__\ (*int256* + ``_outcome``) + - `isOutcomeSet <#isoutcomeset>`__\ () + - `voteForOutcome <#voteforoutcome-int256-_outcome-uint256-amount>`__\ (*int256* + ``_outcome``, *uint256* ``amount``) + +Ultimate oracle contract - Allows to swap oracle result for ultimate oracle result +---------------------------------------------------------------------------------- + +- **Author**: Stefan George - stefan@gnosis.pm +- **Constructor**: UltimateOracle(\ *address* ``_forwardedOracle``, + *address* ``_collateralToken``, *uint8* ``_spreadMultiplier``, + *uint256* ``_challengePeriod``, *uint256* ``_challengeAmount``, + *uint256* ``_frontRunnerPeriod``) +- This contract does **not** have a fallback function. + +Accessors +--------- + +- *address* forwardedOracle() ``061a85c7`` +- *uint256* frontRunnerPeriod() ``0853f7eb`` +- *int256* frontRunner() ``0f3e9438`` +- *uint256* totalAmount() ``1a39d8ef`` +- *uint256* totalOutcomeAmounts(\ *int256*) ``1ff14311`` +- *uint256* forwardedOutcomeSetTimestamp() ``466ae314`` +- *uint256* frontRunnerSetTimestamp() ``8ef8125e`` +- *int256* forwardedOutcome() ``984a470a`` +- *uint256* challengeAmount() ``9d89e7d4`` +- *address* collateralToken() ``b2016bd4`` +- *uint256* outcomeAmounts(\ *address*, *int256*) ``c427af9b`` +- *uint8* spreadMultiplier() ``d84d2a47`` +- *uint256* challengePeriod() ``f3f480d9`` + +Events +------ + +ForwardedOracleOutcomeAssignment(\ *int256* ``outcome``) +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +**Signature hash**: +``6eab3db94ac766c1ac203bcd9c9636476993422eaa067ad449e20ce8501b2a8f`` + +OutcomeChallenge(\ *address* indexed ``sender``, *int256* ``outcome``) +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +**Signature hash**: +``d0fdeb84e66d569a89718f40a99496b38d6c13249a9c9f623fbaa3d8ef343a9d`` + +OutcomeVote(\ *address* indexed ``sender``, *int256* ``outcome``, *uint256* ``amount``) +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +**Signature hash**: +``86fa706979a07f1dd01a49718016881d95ada425549c353ec9e55a627b98a93b`` + +Withdrawal(\ *address* indexed ``sender``, *uint256* ``amount``) +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +**Signature hash**: +``7fcf532c15f0a6db0bd6d0e038bea71d30d808c7d98cb3bf7268a95bf5081b65`` + +Functions +--------- + +isFrontRunnerPeriodOver() +~~~~~~~~~~~~~~~~~~~~~~~~~ + +- **State mutability**: ``nonpayable`` +- **Signature hash**: ``1a4f5b67`` + +Checks if time to overbid the front runner is over + +Outputs +^^^^^^^ + ++--------+------------------------------+ +| type | description | ++========+==============================+ +| *bool* | Is front runner period over? | ++--------+------------------------------+ + +withdraw() +~~~~~~~~~~ + +- **State mutability**: ``nonpayable`` +- **Signature hash**: ``3ccfd60b`` + +Withdraws winnings for user + +.. _outputs-1: + +Outputs +^^^^^^^ + ++-----------+------------+-------------+ +| type | name | description | ++===========+============+=============+ +| *uint256* | ``amount`` | Winnings | ++-----------+------------+-------------+ + +isChallengePeriodOver() +~~~~~~~~~~~~~~~~~~~~~~~ + +- **State mutability**: ``nonpayable`` +- **Signature hash**: ``72b8de14`` + +Checks if time to challenge the outcome is over + +.. _outputs-2: + +Outputs +^^^^^^^ + ++--------+---------------------------+ +| type | description | ++========+===========================+ +| *bool* | Is challenge period over? | ++--------+---------------------------+ + +setForwardedOutcome() +~~~~~~~~~~~~~~~~~~~~~ + +- **State mutability**: ``nonpayable`` +- **Signature hash**: ``739b8c48`` + +Allows to set oracle outcome + +getOutcome() +~~~~~~~~~~~~ + +- **State mutability**: ``view`` +- **Signature hash**: ``7e7e4b47`` + +Returns winning outcome + +.. _outputs-3: + +Outputs +^^^^^^^ + ++----------+-------------+ +| type | description | ++==========+=============+ +| *int256* | Outcome | ++----------+-------------+ + +isChallenged() +~~~~~~~~~~~~~~ + +- **State mutability**: ``nonpayable`` +- **Signature hash**: ``9df4d0fe`` + +Checks if outcome was challenged + +.. _outputs-4: + +Outputs +^^^^^^^ + ++--------+----------------+ +| type | description | ++========+================+ +| *bool* | Is challenged? | ++--------+----------------+ + +challengeOutcome(\ *int256* ``_outcome``) +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +- **State mutability**: ``nonpayable`` +- **Signature hash**: ``9f0de490`` + +Allows to challenge the oracle outcome + +Inputs +^^^^^^ + ++----------+--------------+-------------------+ +| type | name | description | ++==========+==============+===================+ +| *int256* | ``_outcome`` | Outcome to bid on | ++----------+--------------+-------------------+ + +isOutcomeSet() +~~~~~~~~~~~~~~ + +- **State mutability**: ``view`` +- **Signature hash**: ``ccdf68f3`` + +Returns if winning outcome is set + +.. _outputs-5: + +Outputs +^^^^^^^ + ++--------+-----------------+ +| type | description | ++========+=================+ +| *bool* | Is outcome set? | ++--------+-----------------+ + +voteForOutcome(\ *int256* ``_outcome``, *uint256* ``amount``) +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +- **State mutability**: ``nonpayable`` +- **Signature hash**: ``f7553098`` + +Allows to challenge the oracle outcome + +.. _inputs-1: + +Inputs +^^^^^^ + ++-----------+--------------+-------------------+ +| type | name | description | ++===========+==============+===================+ +| *int256* | ``_outcome`` | Outcome to bid on | ++-----------+--------------+-------------------+ +| *uint256* | ``amount`` | Amount to bid | ++-----------+--------------+-------------------+ diff --git a/docs/source/UltimateOracleFactory.rst b/docs/source/UltimateOracleFactory.rst new file mode 100644 index 0000000..43071ea --- /dev/null +++ b/docs/source/UltimateOracleFactory.rst @@ -0,0 +1,87 @@ +UltimateOracleFactory +===================== + +- `UltimateOracleFactory <#ultimateoraclefactory>`__ + + - `Events <#events>`__ + + - `UltimateOracleCreation <#ultimateoraclecreation-address-indexed-creator-address-ultimateoracle-address-oracle-address-collateraltoken-uint8-spreadmultiplier-uint256-challengeperiod-uint256-challengeamount-uint256-frontrunnerperiod>`__\ (*address* + indexed ``creator``, *address* ``ultimateOracle``, *address* + ``oracle``, *address* ``collateralToken``, *uint8* + ``spreadMultiplier``, *uint256* ``challengePeriod``, *uint256* + ``challengeAmount``, *uint256* ``frontRunnerPeriod``) + + - `Functions <#functions>`__ + + - `createUltimateOracle <#createultimateoracle-address-oracle-address-collateraltoken-uint8-spreadmultiplier-uint256-challengeperiod-uint256-challengeamount-uint256-frontrunnerperiod>`__\ (*address* + ``oracle``, *address* ``collateralToken``, *uint8* + ``spreadMultiplier``, *uint256* ``challengePeriod``, *uint256* + ``challengeAmount``, *uint256* ``frontRunnerPeriod``) + +Ultimate oracle factory contract - Allows to create ultimate oracle contracts +----------------------------------------------------------------------------- + +- **Author**: Stefan George - stefan@gnosis.pm +- **Constructor**: UltimateOracleFactory() +- This contract does **not** have a fallback function. + +Events +------ + +UltimateOracleCreation(\ *address* indexed ``creator``, *address* ``ultimateOracle``, *address* ``oracle``, *address* ``collateralToken``, *uint8* ``spreadMultiplier``, *uint256* ``challengePeriod``, *uint256* ``challengeAmount``, *uint256* ``frontRunnerPeriod``) +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +**Signature hash**: +``e6ae2b8211e9721c5dae1d93f70be0ba07bd111608ba4db4317742e1a87fff40`` + +Functions +--------- + +createUltimateOracle(\ *address* ``oracle``, *address* ``collateralToken``, *uint8* ``spreadMultiplier``, *uint256* ``challengePeriod``, *uint256* ``challengeAmount``, *uint256* ``frontRunnerPeriod``) +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +- **State mutability**: ``nonpayable`` +- **Signature hash**: ``ce70faec`` + +Creates a new ultimate Oracle contract + +Inputs +^^^^^^ + ++-----+-------------+-------------------------------------------------+ +| typ | name | description | +| e | | | ++=====+=============+=================================================+ +| *ad | ``oracle`` | Oracle address | +| dre | | | +| ss* | | | ++-----+-------------+-------------------------------------------------+ +| *ad | ``collatera | Collateral token address | +| dre | lToken`` | | +| ss* | | | ++-----+-------------+-------------------------------------------------+ +| *ui | ``spreadMul | Defines the spread as a multiple of the money | +| nt8 | tiplier`` | bet on other outcomes | +| * | | | ++-----+-------------+-------------------------------------------------+ +| *ui | ``challenge | Time to challenge oracle outcome | +| nt2 | Period`` | | +| 56* | | | ++-----+-------------+-------------------------------------------------+ +| *ui | ``challenge | Amount to challenge the outcome | +| nt2 | Amount`` | | +| 56* | | | ++-----+-------------+-------------------------------------------------+ +| *ui | ``frontRunn | Time to overbid the front-runner | +| nt2 | erPeriod`` | | +| 56* | | | ++-----+-------------+-------------------------------------------------+ + +Outputs +^^^^^^^ + ++-----------+--------------------+-----------------+ +| type | name | description | ++===========+====================+=================+ +| *address* | ``ultimateOracle`` | Oracle contract | ++-----------+--------------------+-----------------+ diff --git a/docs/source/conf.py b/docs/source/conf.py new file mode 100644 index 0000000..c4845a1 --- /dev/null +++ b/docs/source/conf.py @@ -0,0 +1,160 @@ +# -*- coding: utf-8 -*- + +from recommonmark.parser import CommonMarkParser +# +# Configuration file for the Sphinx documentation builder. +# +# This file does only contain a selection of the most common options. For a +# full list see the documentation: +# http://www.sphinx-doc.org/en/stable/config + +# -- Path setup -------------------------------------------------------------- + +# If extensions (or modules to document with autodoc) are in another directory, +# add these directories to sys.path here. If the directory is relative to the +# documentation root, use os.path.abspath to make it absolute, like shown here. +# +# import os +# import sys +# sys.path.insert(0, os.path.abspath('.')) + + +# -- Project information ----------------------------------------------------- + +project = 'gnosis-contracts' +copyright = '2018, Gnosis' +author = 'Gnosis' + +# The short X.Y version +version = '' +# The full version, including alpha/beta/rc tags +release = '' + + +# -- General configuration --------------------------------------------------- + +# If your documentation needs a minimal Sphinx version, state it here. +# +# needs_sphinx = '1.0' + +# Add any Sphinx extension module names here, as strings. They can be +# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom +# ones. +extensions = [ +] + +# Add any paths that contain templates here, relative to this directory. +templates_path = ['_templates'] + +source_parsers = { + '.md': CommonMarkParser, +} + +# The suffix(es) of source filenames. +# You can specify multiple suffix as a list of string: +# +source_suffix = ['.rst', '.md'] + +# The master toctree document. +master_doc = 'index' + +# The language for content autogenerated by Sphinx. Refer to documentation +# for a list of supported languages. +# +# This is also used if you do content translation via gettext catalogs. +# Usually you set "language" from the command line for these cases. +language = None + +# List of patterns, relative to source directory, that match files and +# directories to ignore when looking for source files. +# This pattern also affects html_static_path and html_extra_path . +exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store'] + +# The name of the Pygments (syntax highlighting) style to use. +pygments_style = 'sphinx' + + +# -- Options for HTML output ------------------------------------------------- + +# The theme to use for HTML and HTML Help pages. See the documentation for +# a list of builtin themes. +# +html_theme = 'sphinx_rtd_theme' + +# Theme options are theme-specific and customize the look and feel of a theme +# further. For a list of options available for each theme, see the +# documentation. +# +# html_theme_options = {} + +# Add any paths that contain custom static files (such as style sheets) here, +# relative to this directory. They are copied after the builtin static files, +# so a file named "default.css" will overwrite the builtin "default.css". +html_static_path = ['_static'] + +# Custom sidebar templates, must be a dictionary that maps document names +# to template names. +# +# The default sidebars (for documents that don't match any pattern) are +# defined by theme itself. Builtin themes are using these templates by +# default: ``['localtoc.html', 'relations.html', 'sourcelink.html', +# 'searchbox.html']``. +# +# html_sidebars = {} + + +# -- Options for HTMLHelp output --------------------------------------------- + +# Output file base name for HTML help builder. +htmlhelp_basename = 'gnosis-contractsdoc' + + +# -- Options for LaTeX output ------------------------------------------------ + +latex_elements = { + # The paper size ('letterpaper' or 'a4paper'). + # + # 'papersize': 'letterpaper', + + # The font size ('10pt', '11pt' or '12pt'). + # + # 'pointsize': '10pt', + + # Additional stuff for the LaTeX preamble. + # + # 'preamble': '', + + # Latex figure (float) alignment + # + # 'figure_align': 'htbp', +} + +# Grouping the document tree into LaTeX files. List of tuples +# (source start file, target name, title, +# author, documentclass [howto, manual, or own class]). +latex_documents = [ + (master_doc, 'gnosis-contracts.tex', 'gnosis-contracts Documentation', + 'Gnosis', 'manual'), +] + + +# -- Options for manual page output ------------------------------------------ + +# One entry per manual page. List of tuples +# (source start file, name, description, authors, manual section). +man_pages = [ + (master_doc, 'gnosis-contracts', 'gnosis-contracts Documentation', + [author], 1) +] + + +# -- Options for Texinfo output ---------------------------------------------- + +# Grouping the document tree into Texinfo files. List of tuples +# (source start file, target name, title, author, +# dir menu entry, description, category) +texinfo_documents = [ + (master_doc, 'gnosis-contracts', 'gnosis-contracts Documentation', + author, 'gnosis-contracts', 'One line description of project.', + 'Miscellaneous'), +] diff --git a/docs/source/index.rst b/docs/source/index.rst new file mode 100644 index 0000000..66a9150 --- /dev/null +++ b/docs/source/index.rst @@ -0,0 +1,131 @@ +Gnosis Contracts Documentation +============================================ +Collection of smart contracts for the Gnosis prediction market platform (https://www.gnosis.pm). +To interact with those contracts have a look at (https://github.com/gnosis/gnosis.js/). + +Install +------- +Install requirements with npm: + +``npm install`` + +Testing and Linting +------------------- +Run all tests (requires Node version >=7 for `async/await`, and will automatically run TestRPC in the background): + +``npm test`` + +Run all tests matching a regexp pattern by setting the `TEST_GREP` environment variable: + +``TEST_GREP='short selling' npm test`` + +Lint the JS: + +``npm run lint`` + +Compile and Deploy +------------------ +These commands apply to the RPC provider running on port 8545. You may want to have TestRPC running in the background. They are really wrappers around the [corresponding Truffle commands](http://truffleframework.com/docs/advanced/commands). + +Compile all contracts to obtain ABI and bytecode: + +``npm run compile`` + +Migrate all contracts required for the basic framework onto network associated with RPC provider: + +``npm run migrate`` + +Network Artifacts +----------------- + +Show the deployed addresses of all contracts on all networks: + +``npm run networks`` + +Command line options for `truffle` can be passed down through NPM by preceding the options list with `--`. + +For example, to clean network artifacts: + +``npm run networks -- --clean`` + +Network artifacts from running migrations will contain addresses of deployed contracts on the Kovan and Rinkeby testnets. + +Take network info from `networks.json` and inject it into contract build artifacts. This is done prepublish as well: + +``npm run injectnetinfo`` + +Extract all network information into `networks.json`: + +Be aware that this will clobber `networks.json`, so be careful with this command: + +``npm run extractnetinfo`` + +Gas Measurements +---------------- + +Log gas measurements into `build/gas-stats.json`: + +``npm run measuregasstats`` + +Documentation +------------- + +There is a copy version hosted online at https://gnosis.github.io/gnosis-contracts/ + +Build docs with doxity: + +``scripts/makedocs.sh`` + +Security and Liability +---------------------- +All contracts are WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + +License +------- +All smart contracts are released under GPL v.3. + +Contributors +------------ +- Stefan George (`Georgi87 `_) +- Martin Koeppelmann (`koeppelmann `_) +- Alan Lu (`cag `_) +- Roland Kofler (`rolandkofler `_) +- Collin Chin (`collinc97 `_) +- Christopher Gewecke (`cgewecke `_) + +.. toctree:: + :maxdepth: 2 + :caption: Contents: + + CampaignFactory + Campaign + CategoricalEvent + CentralizedOracleFactory + CentralizedOracle + DifficultyOracleFactory + DifficultyOracle + EtherToken + EventFactory + Event + FutarchyOracleFactory + FutarchyOracle + HumanFriendlyToken + LMSRMarketMaker + MajorityOracleFactory + MajorityOracle + MarketMaker + Market + Math + Oracle + OutcomeToken + ScalarEvent + SignedMessageOracleFactory + SignedMessageOracle + StandardMarketFactory + StandardMarket + StandardMarketWithPriceLoggerFactory + StandardMarketWithPriceLogger + StandardToken + Token + UltimateOracleFactory + UltimateOracle diff --git a/docs/source/make.bat b/docs/source/make.bat new file mode 100644 index 0000000..c28d4d1 --- /dev/null +++ b/docs/source/make.bat @@ -0,0 +1,36 @@ +@ECHO OFF + +pushd %~dp0 + +REM Command file for Sphinx documentation + +if "%SPHINXBUILD%" == "" ( + set SPHINXBUILD=sphinx-build +) +set SOURCEDIR=. +set BUILDDIR=_build +set SPHINXPROJ=gnosis-contracts + +if "%1" == "" goto help + +%SPHINXBUILD% >NUL 2>NUL +if errorlevel 9009 ( + echo. + echo.The 'sphinx-build' command was not found. Make sure you have Sphinx + echo.installed, then set the SPHINXBUILD environment variable to point + echo.to the full path of the 'sphinx-build' executable. Alternatively you + echo.may add the Sphinx directory to PATH. + echo. + echo.If you don't have Sphinx installed, grab it from + echo.http://sphinx-doc.org/ + exit /b 1 +) + +%SPHINXBUILD% -M %1 %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% +goto end + +:help +%SPHINXBUILD% -M help %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% + +:end +popd diff --git a/scripts/makedocs.sh b/scripts/makedocs.sh index a05aa14..ab8dc7e 100755 --- a/scripts/makedocs.sh +++ b/scripts/makedocs.sh @@ -1,5 +1,11 @@ -#!/usr/bin/env bash +#!/usr/bin/env sh -rm -r docs -mkdir docs -find contracts -name '*.sol' ! -name 'Migrations.sol' -type f -exec bash -c './node_modules/.bin/solmd {} --dest docs/`basename {} .sol`.md' \; +export DOCS_DIR=docs/source + +mkdir -p $DOCS_DIR +mv $DOCS_DIR/index.rst . +rm -f $DOCS_DIR/*.rst +mv index.rst $DOCS_DIR/ +find contracts -name '*.sol' ! -name 'Migrations.sol' -type f -exec bash -c './node_modules/.bin/solmd {} --dest $DOCS_DIR/`basename {} .sol`.md' \; +find $DOCS_DIR -name '*.md' -exec sh -c 'pandoc --from=markdown --to=rst --output=${0%.md}.rst ${0}' {} \; +rm -f $DOCS_DIR/*.md