Address of the market contract that is going to be used for each new deployment.
_arbitrator
address
Address of the arbitrator that is going to resolve Realitio disputes.
_realitio
contract IRealityETH_v3_0
Address of the Realitio implementation.
_wrapped1155Factory
contract IWrapped1155Factory
Address of the Wrapped1155Factory implementation.
_conditionalTokens
contract IConditionalTokens
Address of the ConditionalTokens implementation.
_collateralToken
address
Address of the collateral token.
_realityProxy
contract RealityProxy
Address of the RealityProxy implementation.
_questionTimeout
uint32
Reality question timeout.
createCategoricalMarket
Categorical markets are associated with a Reality question that has only one answer.
Creates a Categorical market.
Parameters
Name
Type
Description
params
struct MarketFactory.CreateMarketParams
CreateMarketParams instance.
Return Values
Name
Type
Description
[0]
address
The new market address.
Logic
Validate outcomes length (>= 2).
Encode 1 reality question.
Call createMarket.
createMultiCategoricalMarket
Multi Categorical markets are associated with a Reality question that has one or more answers.
Creates a Multi Categorical market.
Parameters
Name
Type
Description
params
struct MarketFactory.CreateMarketParams
CreateMarketParams instance.
Return Values
Name
Type
Description
[0]
address
The new market address.
Logic
Validate outcomes length (>=2).
Encode 1 reality question.
Call createMarket.
createScalarMarket
Scalar markets are associated with a Reality question that resolves to a numeric value.
Creates a Scalar market.
Parameters
Name
Type
Description
params
struct MarketFactory.CreateMarketParams
CreateMarketParams instance.
Return Values
Name
Type
Description
[0]
address
The new market address.
Logic
Validate upperBound and lowerBound.
Validate outcomes length (2).
Encode 1 reality question.
Call createMarket.
createMultiScalarMarket
Multi Scalar markets are associated with two or more Reality questions, and each one of them resolves to a numeric value.
Creates a Multi Scalar market.
Parameters
Name
Type
Description
params
struct MarketFactory.CreateMarketParams
CreateMarketParams instance.
Return Values
Name
Type
Description
[0]
address
The new market address.
Logic
Validate outcomes length (>=2).
Encode reality questions, one for each outcome.
Instead of using params.marketName, encode a new marketName.
Call createMarket.
createMarket
Creates the Market and deploys the wrapped ERC20 tokens.
Parameters
Name
Type
Description
params
struct MarketFactory.CreateMarketParams
CreateMarketParams instance.
marketName
string
The market name.
config
struct MarketFactory.InternalMarketConfig
InternalMarketConfig instance.
Return Values
Name
Type
Description
[0]
address
The new market address.
Logic
Ask reality questions.
Prepare condition.
Create new erc20 outcome tokens.
Initialize a new market contract.
createNewMarketParams
Creates the structures needed to initialize the new market.
Parameters
Name
Type
Description
params
struct MarketFactory.CreateMarketParams
CreateMarketParams instance.
config
struct MarketFactory.InternalMarketConfig
InternalMarketConfig instance.
Return Values
Name
Type
Description
[0]
struct Market.ConditionalTokensParams
Market.ConditionalTokensParams instance.
[1]
struct Market.RealityParams
Market.RealityParams instance.
encodeRealityQuestionWithOutcomes
Encodes the question, outcomes, category and language following the Reality structure. If any parameter has a special character like quotes, it must be properly escaped.
Parameters
Name
Type
Description
question
string
The question text.
outcomes
string[]
category
string
The question category.
lang
string
The question language.
Return Values
Name
Type
Description
[0]
string
The encoded question.
encodeRealityQuestionWithoutOutcomes
Encodes the question, category and language following the Reality structure. If any parameter has a special character like quotes, it must be properly escaped.
Parameters
Name
Type
Description
question
string
The question text.
category
string
The question category.
lang
string
The question language.
Return Values
Name
Type
Description
[0]
string
The encoded question.
askRealityQuestion
Asks a question on reality.
Parameters
Name
Type
Description
encodedQuestion
string
The encoded question containing the Reality parameters.
templateId
uint256
The Reality template id.
openingTime
uint32
The question opening time.
minBond
uint256
The question min bond.
Return Values
Name
Type
Description
[0]
bytes32
The question id
prepareCondition
Prepares the CTF condition and returns the conditionId.
Parameters
Name
Type
Description
questionId
bytes32
An identifier for the question to be answered by the oracle.
outcomeSlotCount
uint256
The number of outcome slots which must be used for this condition. Must not exceed 256.
Return Values
Name
Type
Description
[0]
bytes32
Condition ID.
Pre-condition
Reality questions asked and return questionsIds.
questionId is hashed from all the values that RealityProxy.resolve() uses to resolve a market (questionsIds, outcomes.length, templateId, lowerBound, upperBound).
Logic
It will check if there is a prepared condition on ConditionalTokens, and call conditionalTokens.prepareCondition() if there isn't any.
deployERC20Positions
Wraps the ERC1155 outcome tokens to ERC20. The INVALID_RESULT outcome is always called SER-INVALID.
Parameters
Name
Type
Description
parentCollectionId
bytes32
The parentCollectionId.
conditionId
bytes32
The conditionId.
outcomeSlotCount
uint256
The amount of outcomes.
tokenNames
string[]
The name of each outcome token.
Return Values
Name
Type
Description
wrapped1155
contract IERC20[]
Array of outcome tokens wrapped to ERC20.
data
bytes[]
Array of token data used to create each ERC20.
Logic
It will call wrapped1155Factory.requireWrapped1155 to create an ERC20 token contract for each position. The new tokens addresses and data is saved in Marketcontract.