_collateralToken
. With _pairName
, we can choose a name for the pair of long and short tokens. _customAncillaryData
is where we define the price request question. The addresses of the _finder
and _timerAddress
set the rest of the contracts addresses we interact with. For reference, here is the full list of UMA contract deployments.initializeMarket()
after approving the proposerReward
amount to be paid to the wallet that resolves the price request. To keep things simple, proposerReward
is set to 10e18.
priceIdentifier
is set to "YES_OR_NO_QUERY"
.
This function sets up the prediction market by getting the proposer reward and calling _requestOraclePrice
. This last function starts the price request in Optimistic Oracle V2 and sets up a number of options that are explained below._requestOraclePrice
is in charge of initializing the price request in the Optimistic Oracle V2 by performing the following actions:priceSettled
and priceDisputed
callbacks so that our contract can use OO callbacks to respond to these kinds of eventscreate
function with the tokensToCreate
parameter to mint the same number of short and long tokens. Having both tokens in the same proportion means being in a neutral position, as is the case when calling create
. settle
if the oracle has processed the price request.
The returned collateral amount is a function of longTokensToRedeem
, shortTokensToRedeem
, and settlementPrice
.priceSettled
function of this contract is invoked. 0
, 0.5
, or 1
. This number is used in the settle
function to calculate the collateral to pay in exchange of the long and short tokens.priceDisputed
function is called when a price request is disputed. This function re-starts the same price request with the bond amount that was given back to the requester, which in our case is the EventBasedPredictionMarket
. EventBasedPredictionMarket
in goerli network, run: