# BinaryOptionMarket¶

## Description¶

This contract manages a single binary option market, where users can speculate on the outcome of a future event by buying options, each of which is an ERC20 token that pays out 1 sUSD if its corresponding outcome occurs.

Each binary option market has a specific underlying asset, and a strike price for that asset at a particular maturity date. If the reported price of the asset is lower than the strike price at the maturity date, then all the options on the short side of the market pay out 1 sUSD each, while if the price is higher than or equal to the strike price, then the options on the long side pay out 1 sUSD each.

This contract was proposed as part of SIP-53. Further information on the mechanism and its motivation can be found in the SIP.

Market Lifecycle

A market goes through four major phases in its life. The phase a market is currently in can be queried with the phase() function, and the time stamps at which it transitions between these phases is held in the times public variable.

Market Creation

A market can be created by anyone, as long as they can provide enough initial capital to ensure the market is liquid. Upon creation, markets will be tracked in the manager contract until they are eventually resolved and destroyed.

Market creators are incentivised to make markets by the collection of fees, which they share with the fee pool. These fees are released at the resolution of the market; it is in the creator's interest, in order to maximise the fees they collect, to set market parameters that attract the maximum demand over the lifetime of the market.

Binary option markets are created by calls to the BinaryOptionMarketManager.createMarket function: see the documentation for that function for more details.

Bidding

During the bidding phase, the total supply of options and option prices are established. During this period, users can bid on the long or short side of the market and refund those bids. The option prices are determined during this phase according to the computations outlined in the _updatePrices function; the price on one side of the market is effectively the fraction of bids on that side relative to all bids.

Relevant Functions Description
bid Places a bid.
refund Refunds an existing bid, minus a fee.
bidsOf / totalBids Queries current bid balances.
claimableBy / totalClaimable Queries the number of options that would be claimable if the market resolved at the current price.
prices The current prices on the market.
oracleDetails The basic parameters of the market, including the underlying asset, strike price, and maturity date.
pricesAfterBidOrRefund Computes the resulting prices from placing a certain bid or refund.
bidOrRefundForPrice Computes the size of bid or refund to achieve a particular price on market.
oraclePriceAndTimestamp The current underlying asset price, against which the strike price is compared, and when it was set.

During the trading phase, bids and refunds are disabled and the final option prices are fixed, so options can be claimed and exchanged as ERC20 tokens.

Relevant Functions Description
claimableBy / totalClaimable Queries the actual number of options a user can claim.
claimOptions Claims the options owed to a user.
balancesOf / totalSupplies Returns a user's actual option balances.
BinaryOption ERC20 functions Users can freely transfer any claimed options as ERC20 tokens.

Maturity

After the end of the trading period, the market's maturity condition is evaluated and options can be exercised according to the result. The maturity condition is ultimately resolved depending on the result of the oraclePriceAndTimestamp function.

Relevant Functions Description
canResolve Indicates whether the market can be resolved yet.
resolve Queries the current price of the underlying asset from the oracle, compares it against the strike price, saves the final result, and transfers fees to the market creator and pool.
resolved True if the market has been resolved
result Reports which side pays out, or which side would pay out if an unresolved market were resolved immediately.
exerciseOptions Transfers the payout owed to a user from the options they hold.

Expiry

After a period the market can be destroyed by a call to BinaryOptionMarketManager.expireMarkets, which in turn calls BinaryOptionMarket.expire.

Relevant Functions Description
BinaryOptionMarketManager.expireMarkets Destroys a set of markets.
expire Expires this market, destroying it.

Enums

Phase

The phases the market proceeds through.

Value Description
Bidding Users can place and refund bids.
Trading Bidding is disabled, but options can be claimed and transferred as ERC20 tokens.
Maturity The market has matured, and options can be exercised for a value of sUSD.
Expiry The market is ready to be destroyed.

Side

The two sides of the market, each of which represents a particular event occurring.

Value Description
Long The event that the asset price is higher than or equal to the strike price at the maturity date.
Short The event that the asset price is lower than the strike price at the maturity date.
Related Contracts

## Structs¶

### Options¶

Source

The addresses of the two BinaryOption instances for options on each side of the market.

Field Type Description
long contract BinaryOption The address of the token contract for long options.
short contract BinaryOption The address of the token contract for long options.

### OracleDetails¶

Source

Oracle-relevant details used at the resolution of the market.

Field Type Description
key bytes32 The key of the underlying asset of this market, as in the ExchangeRates contract.
strikePrice uint256 The threshold price of the underlying asset. This is an 18-decimal fixed point number.
finalPrice uint256 The actual measured price of the underlying asset at the maturity date. This is an 18-decimal fixed point number.

### Prices¶

Source

The prices of the options on each side of the market.

Field Type Description
long uint256 The current price of long options. This is an 18-decimal fixed point number.
short uint256 The current price of short options. This is an 18-decimal fixed point number.

### Times¶

Source

Timestamps of important dates, which are given as unix timestamps in seconds.

Field Type Description
biddingEnd uint256 The time at which the bidding phase transitions to the trading phase.
maturity uint256 The time at which the trading phase transitions to the maturity phase.
expiry uint256 The time after which the market can be expired.

## Variables¶

### creator¶

Source

The initial creator of the market, who contributed the initial capital and market parameters, and is entitled to the creator fee.

Type: address

### creatorLimits¶

Source

The limits that the market creator is constrained to abide by.

• capitalRequirement: the minimum capital that the market's creator must maintain in the market until the end of bidding. The market's initial bids must be at least this value, and the creator may not submit refunds that would reduce their open bids to a value less than this minimum.
• skewLimit: The creator's smaller bid must be greater than this as a percentage of their total bids.

Type: struct BinaryOptionMarketManager.CreatorLimits

### deposited¶

Source

The sum of open bids on both sides of the market, plus any sUSD witheld for refund fees. We store this explicitly in case any tokens are transferred to this contract directly, as in that case querying the contract's sUSD token balance would throw off several calculations.

Type: uint256

### fees¶

Source

The fee rates charged in this market and the fees collected on behalf of the creator.

Type: struct BinaryOptionMarketManager.Fees

### options¶

Source

The addresses of this market's BinaryOption instances.

Type: struct BinaryOptionMarket.Options

### oracleDetails¶

Source

The oracle parameters of this market, including the underlying asset and strike price.

Type: struct BinaryOptionMarket.OracleDetails

### prices¶

Source

The long and short option prices of this market.

Type: struct BinaryOptionMarket.Prices

### refundsEnabled¶

Source

Type: bool

### resolved¶

Source

True if the market has been resolved, and false otherwise.

Type: bool

### times¶

Source

The unix timestamps at which this market transitions between phases.

Type: struct BinaryOptionMarket.Times

## Constructor¶

### constructor¶

Source

The constructor sets up all the static values for fees, timestamps, asset and strike price among other parameters. The market's owner (the manager contract), and creator are also set at this time. The manager checks that all of these settings are within acceptable ranges, except for the creator limits, which are checked here.

In addition, the market's BinaryOption instances for each side of the market are instantiated, and their initial prices are computed from the initial bids.

Note that the market's known AddressResolver address will be incorrect at first, being initially set to the provided owner address, but this will be remedied after the first sync, which is performed by the manager contract upon construction.

Initial timestamps should be provided in the order [biddingEnd, maturity, destruction], initial bids as [longBid, shortBid], and fees as [poolFee, creatorFee, refundFee].

Details

Signature

constructor(address _owner, address _creator, address _resolver, uint256[2] _creatorLimits, bytes32 _oracleKey, uint256 _strikePrice, bool _refundsEnabled, uint256[3] _times, uint256[2] _bids, uint256[3] _fees)

Visibility

public

State Mutability



Emits

## Views¶

### balancesOf¶

Source

Returns the option balances of the message sender on each side of the market.

Details

Signature

balancesOf(address account) view returns (uint256 long, uint256 short)

Visibility

external

State Mutability

view

### bidOrRefundForPrice¶

Source

Produces the size of bid or refund necessary on a particular side of the market to move the price on one side or the other to a desired level.

For example, to move the long price to $0.8$ by bidding on the long side, one would have to bid bidOrRefundForPrice(Side.Long, Side.Long, 0.8 * UNIT, false). On the other hand, to move the short price to $0.6$ by refunding on the long side, one would need to refund bidOrRefundForPrice(Side.Long, Side.Short, 0.6 * UNIT, true).

If the result would be negative, because the desired operation can only move the price in the opposite direction from the target, the function returns 0.

Formula Derivation

For brevity, the following definitions will be used:

$$\begin{split} \psi &:= 1 - (\text{poolFee} + \text{creatorFee}) \\ \xi &:= 1 - \text{refundFee} \\ D &:= \text{deposited()} \\ P_{this}, P_{that} &:= \text{prices()} \\ Q_{this}, Q_{that} &:= \text{totalBids()} \\ \end{split}$$

The variables $\text{this}$ and $\text{that}$ refer to the opposite sides of the market. Since prices are symmetrical between the sides of the market, they can be interpreted in either order.

If a bid with value $b$ is placed on $\text{this}$ side of the market, the resulting prices are as follows:

$$\begin{split} P_{this} & \leftarrow \frac{Q_{this} + b}{\psi (D + b)} \\ P_{that} & \leftarrow \frac{Q_{that}}{\psi (D + b)} \end{split}$$

The case of a refund of value $r$ must take the refund fee into account:

$$\begin{split} P_{this} &\leftarrow \frac{Q_{this} - r}{\psi (D - \xi r)} \\ P_{that} &\leftarrow \frac{Q_{that}}{\psi (D - \xi r)} \end{split}$$

So by bidding or refunding on $this$ side of the market, we alter the prices on both sides. Note that bids always increase prices on $this$ side and decrease prices on $that$ side, while refunds always decrease prices on $this$ side and increase prices on $that$ side.

Same-Side Price Targeting

By changing our position on $this$ side of the market, we can change $P_{this}$ to a desired level $P^{*}_{this}$. If $P_{this} < P^{*}_{this}$, we must bid a value $b$ to increase the price, while if $P^{*}_{this} < P_{this}$, we must refund a value $r$ to decrease the price, as follows:

$$\begin{split} b &\leftarrow \frac{\psi D P_{this} - Q_{this}}{1 - \psi P_{this} } \\ r &\leftarrow \frac{Q_{this} - \psi D P_{this}}{1 - \xi \psi P_{this}} \end{split}$$

Opposite-Side Price Targeting

Similarly, by changing our position on $this$ side, we can also change $P_{that}$ to a desired level $P^{*}_{that}$. The response of the market is the opposite to the same-side case, so if $P_{that} < P^{*}_{that}$, we must refund a value $r$ to increase the price, while if $P^{*}_{that} < P_{that}$, we must bid a value $b$ to decrease the price, as follows:

$$\begin{split} r &\leftarrow \frac{\psi D P_{that} - Q_{that}}{\xi \psi P_{that}} \\ b &\leftarrow \frac{Q_{that} - \psi D P_{that}}{\psi P_{that}} \end{split}$$

Note that all of these values can be negative if the desired price is in the wrong direction relative to the way it will move given the side of the market we're looking at and whether we're bidding or refunding. Since we cannot perform negative bids or refunds, the function returns 0 instead of throwing an exception or returning negative numbers.

Details

Signature

bidOrRefundForPrice(enum IBinaryOptionMarket.Side bidSide, enum IBinaryOptionMarket.Side priceSide, uint256 price, bool refund) view returns (uint256)

Visibility

external

State Mutability

view

### bidsOf¶

Source

Returns the current bids on each side of the market of the message sender.

Details

Signature

bidsOf(address account) view returns (uint256 long, uint256 short)

Visibility

external

State Mutability

view

### canResolve¶

Source

Returns true if the market can currently be resolved, which is the case when:

Details

Signature

canResolve() view returns (bool)

Visibility

external

State Mutability

view

### claimableBalancesOf¶

Source

Returns balance of options on each side of the market that would be claimable by the message sender at the current prices.

Note that this function still operates during bidding, and only reflects the actually-claimable quantities after the market has transitioned to the trading phase.

Details

Signature

claimableBalancesOf(address account) view returns (uint256 long, uint256 short)

Visibility

external

State Mutability

view

### exercisableDeposits¶

Source

Returns the deposited sUSD, accounting for any fees that should be remitted. This is the value of options to be awarded to each side of the market.

Details

Signature

exercisableDeposits() view returns (uint256)

Visibility

external

State Mutability

view

### oraclePriceAndTimestamp¶

Source

Returns the current price of this market's underlying asset at the ExchangeRates contract, along with the time it was updated.

Details

Signature

oraclePriceAndTimestamp() view returns (uint256 price, uint256 updatedAt)

Visibility

external

State Mutability

view

### phase¶

Source

Returns the current phase the market is in.

Details

Signature

phase() view returns (enum IBinaryOptionMarket.Phase)

Visibility

external

State Mutability

view

### pricesAfterBidOrRefund¶

Source

Computes the resulting market prices if a given bid or refund is made. If a refund greater than or equal to the total bids on that side of the market is requested, the transaction will revert. See bidOrRefundForPrice for details of this computation.

Details

Signature

pricesAfterBidOrRefund(enum IBinaryOptionMarket.Side side, uint256 value, bool refund) view returns (uint256 long, uint256 short)

Visibility

external

State Mutability

view

### requireActiveAndUnpaused¶

Source

Reverts the transaction if the system is suspended, or the manager is paused. This is used by BinaryOption instances to pause transfers if either of these conditions is true.

Details

Signature

requireActiveAndUnpaused() view

Visibility

external

State Mutability

view

Requires

### resolverAddressesRequired¶

Source

Details

Signature

resolverAddressesRequired() view returns (bytes32[] addresses)

Visibility

public

State Mutability

view

### result¶

Source

If the market has not resolved, returns the side of the market that would pay out if it was resolved at the current price. Otherwise, if the market has resolved, the function returns the value that the market resolved to when resolve() was successfully called.

Note that no check is performed that the underlying asset price is fresh.

Details

Signature

result() view returns (enum IBinaryOptionMarket.Side)

Visibility

external

State Mutability

view

### senderPriceAndExercisableDeposits¶

Source

Used by this market's BinaryOption instances to retrieve their own prices and the number of exercisable deposits available, which are used when computing claimable balances. If called by the long option, this function returns the long price; if by the short option, the short price; if it is called by any other address, the transaction is reverted.

Details

Signature

senderPriceAndExercisableDeposits() view returns (uint256 price, uint256 exercisable)

Visibility

external

State Mutability

view

### totalBids¶

Source

Returns the total value of bids on each side of the market.

Details

Signature

totalBids() view returns (uint256 long, uint256 short)

Visibility

external

State Mutability

view

### totalClaimableSupplies¶

Source

Returns the total balance of options claimable from the current total of bids on each side of the market.

Note that due to rounding, this may not predict exactly the quantities which will actually claimed in the end. Like claimableBy, this function still operates during the bidding phase, but will not attain its correct value until bidding has ended.

Details

Signature

totalClaimableSupplies() view returns (uint256 long, uint256 short)

Visibility

external

State Mutability

view

### totalSupplies¶

Source

Returns the total supply of options on each side of the market.

Details

Signature

totalSupplies() view returns (uint256 long, uint256 short)

Visibility

external

State Mutability

view

## Restricted Functions¶

### cancel¶

Source

Details

Signature

cancel(address payable beneficiary)

Visibility

external

State Mutability



Requires

Modifiers

### expire¶

Source

This function allows the manager to destroy this market at the end of its life. The value of any expired but unexercised options is sent to the caller. The market will also destroy its child BinaryOption instances before it destroys itself.

The function will revert if the market is not resolved, or if there are options remaining and the market is not yet past its expiry date. This means that a market can be expired early if all its in-the-money options have been exercised.

Details

Signature

expire(address payable beneficiary)

Visibility

external

State Mutability



Requires

Modifiers

### resolve¶

Source

This function allows anyone to resolve the market, as long as it satisfies the conditions of canResolve().

Market resolution requires fetching the latest price of this market's underlying asset, checking that it was last updated recently enough, and then computing and saving the fees that were collected. After a successful invocation, the variable resolved will be true. The final oracle price is saved and can be queried from oracleDetails.finalPrice.

This function reverts the transaction if the system is suspended or the manager contract is paused.

Details

Signature

resolve()

Visibility

external

State Mutability



Requires

Modifiers

Emits

## Internal Functions¶

### _balancesOf¶

Source

Details

Signature

_balancesOf(address account) view returns (uint256 long, uint256 short)

Visibility

internal

State Mutability

view

### _biddingEnded¶

Source

True if the current time is after the bidding end time.

Details

Signature

_biddingEnded() view returns (bool)

Visibility

internal

State Mutability

view

### _bidsOf¶

Source

See bidsOf.

Details

Signature

_bidsOf(address account) view returns (uint256 long, uint256 short)

Visibility

internal

State Mutability

view

### _checkCreatorLimits¶

Source

Reverts if the provided bids would violate the creator limits.

Details

Signature

_checkCreatorLimits(uint256 longBid, uint256 shortBid) view

Visibility

internal

State Mutability

view

Requires

### _chooseSide¶

Source

Selects between a long and a short value depending on its first input.

Details

Signature

_chooseSide(enum IBinaryOptionMarket.Side side, uint256 longValue, uint256 shortValue) pure returns (uint256)

Visibility

internal

State Mutability

pure

### _claimOptions¶

Source

Details

Signature

_claimOptions() returns (uint256 longClaimed, uint256 shortClaimed)

Visibility

internal

State Mutability



Requires

Modifiers

Emits

### _claimableBalancesOf¶

Source

Details

Signature

_claimableBalancesOf(address account) view returns (uint256 long, uint256 short)

Visibility

internal

State Mutability

view

### _computePrices¶

Source

Computes the market prices from the long and short bid totals, and the funds deposited in the contract. These prices are computed approximately as follows:

 1 2 longPrice = longBids / (feeMultiplier * deposited) shortPrice = shortBids / (feeMultiplier * deposited) 

Interpreting / and * as fixed point math operators (with rounding).

Note that the denominator _feeMultiplier * deposited is the total value of options awarded to each side of the market, and deposited is equal to longBids + shortBids + refundFeesCollected.

If either the long or short bids are zero, then the transaction is reverted, as this would lead to a zero price, and hence divisions-by-zero when computing claimable option quantities. This means that the initial bids cannot both be zero, nor can the entire balance on either side of the market be refunded.

Details

Signature

_computePrices(uint256 longBids, uint256 shortBids, uint256 _deposited) view returns (uint256 long, uint256 short)

Visibility

internal

State Mutability

view

Requires

### _decrementDeposited¶

Source

Deducts a value from the tracked deposited quantity, and ensures that it is also deducted in the manager contract.

Details

Signature

_decrementDeposited(uint256 value) returns (uint256 _deposited)

Visibility

internal

State Mutability



### _exchangeRates¶

Source

Returns the cached address of the ExchangeRates instance.

Details

Signature

_exchangeRates() view returns (contract IExchangeRates)

Visibility

internal

State Mutability

view

### _exercisableDeposits¶

Source

Details

Signature

_exercisableDeposits(uint256 _deposited) view returns (uint256)

Visibility

internal

State Mutability

view

### _expired¶

Source

True if the market is resolved, and either the expiry date is in the past, or there is no more sUSD deposited in the market.

Details

Signature

_expired() view returns (bool)

Visibility

internal

State Mutability

view

### _feePool¶

Source

Retrieves the cached address of the FeePool instance.

Details

Signature

_feePool() view returns (contract IFeePool)

Visibility

internal

State Mutability

view

### _incrementDeposited¶

Source

Adds a value to the tracked deposited quantity, and ensures that it is also added in the manager contract.

Details

Signature

_incrementDeposited(uint256 value) returns (uint256 _deposited)

Visibility

internal

State Mutability



### _isFreshPriceUpdateTime¶

Source

True if a given timestamp is younger than the maximum oracle price age, false otherwise; fresh prices are acceptable for resolving the market.

Details

Signature

_isFreshPriceUpdateTime(uint256 timestamp) view returns (bool)

Visibility

internal

State Mutability

view

### _manager¶

Source

Returns the address of the BinaryOptionMarketManager which tracks this market. Note that this address is also this contract's owner.

Details

Signature

_manager() view returns (contract BinaryOptionMarketManager)

Visibility

internal

State Mutability

view

### _matured¶

Source

True if the maturity date is in the past, and false otherwise.

Details

Signature

_matured() view returns (bool)

Visibility

internal

State Mutability

view

### _option¶

Source

Returns the appropriate option contract address for a given side of the market.

Details

Signature

_option(enum IBinaryOptionMarket.Side side) view returns (contract BinaryOption)

Visibility

internal

State Mutability

view

### _oraclePriceAndTimestamp¶

Source

Details

Signature

_oraclePriceAndTimestamp() view returns (uint256 price, uint256 updatedAt)

Visibility

internal

State Mutability

view

### _requireManagerNotPaused¶

Source

Reverts the transaction if the BinaryOptionMarketManager is paused.

Details

Signature

_requireManagerNotPaused() view

Visibility

internal

State Mutability

view

Requires

### _result¶

Source

See result.

Details

Signature

_result() view returns (enum IBinaryOptionMarket.Side)

Visibility

internal

State Mutability

view

### _sUSD¶

Source

Retrieves the cached address of the sUSD Synth instance.

Details

Signature

_sUSD() view returns (contract IERC20)

Visibility

internal

State Mutability

view

### _selfDestruct¶

Source

Details

Signature

_selfDestruct(address payable beneficiary)

Visibility

internal

State Mutability



### _subToZero¶

Source

Returns the difference of two numbers, or zero if the difference is negative.

Details

Signature

_subToZero(uint256 a, uint256 b) pure returns (uint256)

Visibility

internal

State Mutability

pure

### _systemStatus¶

Source

Retrieves the cached address of the SystemStatus contract.

Details

Signature

_systemStatus() view returns (contract ISystemStatus)

Visibility

internal

State Mutability

view

### _totalBids¶

Source

Details

Signature

_totalBids() view returns (uint256 long, uint256 short)

Visibility

internal

State Mutability

view

### _updatePrices¶

Source

Updates the current prices from the long and short bid quantities, and the total deposited value in the contract. See _computePrices for details.

Details

Signature

_updatePrices(uint256 longBids, uint256 shortBids, uint256 _deposited)

Visibility

internal

State Mutability



Emits

## External Functions¶

### bid¶

Source

Allows a user to place an sUSD bid on one or the other side of the market.

To process a bid, the market increments the user's bid balance on the appropriate option contract, as well as incrementing the total value deposited both in this market and in the manager contract. The deposit quantities having been updated, the option prices are recomputed to reflect the changed odds.

The value of the bid is withdrawn from the message sender's sUSD balance by a call to ERC20.transferFrom, so the caller must have ensured that they have granted the market sufficient approval and that they have enough sUSD to support the bid.

The transaction reverts if this function is called outside the bidding period, if the system is suspended, or if the manager contract is paused.

Details

Signature

bid(enum IBinaryOptionMarket.Side side, uint256 value)

Visibility

external

State Mutability



Modifiers

Emits

### claimOptions¶

Source

Once the bidding period has concluded, this function claims all options owing to the message sender on both sides of the market. The number of options owed is simply the user's bid balances, divided by the current option prices. The caller's bid balances are set to zero, while the appropriate number of options are credited to their wallet.

This function reverts the transaction if the system is suspended or the manager contract is paused.

Implemented by the _claimOptions function.

Details

Signature

claimOptions() returns (uint256 longClaimed, uint256 shortClaimed)

Visibility

external

State Mutability



### exerciseOptions¶

Source

exerciseOptions allows a user to claim any sUSD owed to them after their options have matured. This function will exercise any options held by the message sender on either side of the market, zeroing out their option balances. If the caller holds $n$ options on the winning side of the market, they will be transferred $n$ sUSD. Any options held on the losing side of the market will yield no payout. Upon exercising options, the quantity of sUSD paid to the called will be deducted from the tracked totals here, and in the manager contract.

If the market is unresolved at call time, it will be resolved if it can be. If the caller has unclaimed options, they will be claimed before they are exercised.

This function reverts the transaction if the system is suspended or the manager contract is paused.

Details

Signature

exerciseOptions() returns (uint256)

Visibility

external

State Mutability



Requires

Emits

### refund¶

Source

Refunds an existing bid, remitting the refund value minus a percentage determined by the refund fee rate as sUSD. The function returns the value refunded as sUSD.

The full value of the refund is deducted from the caller's bids, while this value minus the refund fee is actually remitted as sUSD. The deposited quantity in the market and in the manager contract are decremented by the transferred value. The deposit quantities having been updated, the option prices are recomputed to reflect the changed odds.

The refund fee, which will eventually be paid out to option-holders, is retained in the pot, although not on either side's bid total. As such, refunds discount option prices for all those remaining in the market.

If the message sender is the market's creator, then a refund transaction will revert if it would either violate the capital requirement, or if it would refund their entire position on either side of the market.

The transaction reverts if this function is called outside the bidding period, if the system is suspended, or if the manager contract is paused.

Details

Signature

refund(enum IBinaryOptionMarket.Side side, uint256 value) returns (uint256 refundMinusFee)

Visibility

external

State Mutability



Requires

Modifiers

Emits

## Modifiers¶

### afterBidding¶

Source

Reverts the transaction if bidding has not concluded.

### afterMaturity¶

Source

Reverts the transaction if the market has not matured.

### duringBidding¶

Source

Reverts the transaction if bidding has ended.

### managerNotPaused¶

Source

Reverts the transaction if the manager is not paused.

### systemActive¶

Source

Reverts the transaction if the system is suspended.

## Events¶

### Bid¶

Source

Signature: Bid(enum IBinaryOptionMarket.Side side, address account, uint256 value)

### MarketResolved¶

Source

The market was resolved.

Signature: MarketResolved(enum IBinaryOptionMarket.Side result, uint256 oraclePrice, uint256 oracleTimestamp, uint256 deposited, uint256 poolFees, uint256 creatorFees)

### OptionsClaimed¶

Source

The market was resolved.

Signature: OptionsClaimed(address account, uint256 longOptions, uint256 shortOptions)

### OptionsExercised¶

Source

A quantity of options was exercised.

Signature: OptionsExercised(address account, uint256 value)

### PricesUpdated¶

Source

The option prices were updated.

Signature: PricesUpdated(uint256 longPrice, uint256 shortPrice)

### Refund¶

Source

A refund was processed. The value argument is the quantity of sUSD actually refunded, without the fee.

Signature: Refund(enum IBinaryOptionMarket.Side side, address account, uint256 value, uint256 fee)