Skip to content
First Access Exchange

x/binary reference

x/binary lists, prices, halts, resolves and settles every chain market: standalone binary markets, IPO events (a binary, calls, puts and S), and private companies (the perpetual, its index and its ladder of expiries). Protos: dydxprotocol/binary/{binary,event,company,query,tx,genesis}.proto.

Records

BinaryMarket

One record per chain market (binary, call, put and company perpetual), keyed by perpetual id.

FieldMeaning
perpetual_id, clob_pair_id, market_idThe perpetual, its book and its oracle market
ticker, question, rules_urlWhat it asks and where its rules are
resolution_timeFrom this time it may resolve No (an event's deadline)
admin, resolve_delay_secondsWho may halt and resolve besides governance, and the least time between the halt and the admin's resolve
statusMARKET_STATUS_TRADING, _HALTED, _RESOLVING, _RESOLVED_YES, _RESOLVED_NO
halted_height, halted_time, halted_open_interestThe halt
outcome, resolved_atOUTCOME_YES or OUTCOME_NO
event_idThe event, for an event's markets
payout_per_shareWhat one contract pays (a PERP: w = |u − M|)
settled_*, phaseThe payout's progress and totals: holders, long and short shares, paid, collected, shortfall
company_id, settle_reference_price, final_value, payers_longA company perpetual: M, u, which side pays
settled_payee_deficit, settled_payee_pool, settled_withheld, perp_scan_*, perp_payer_burdenA company perpetual's settlement accounting

Event

FieldMeaning
id, company, ticker_base, rules_urlThe event
resolution_timeThe deadline
admin, resolve_delay_secondsAs for a market
statusEVENT_STATUS_TRADING, _HALTED, _RESOLVING, _RESOLVED_YES, _RESOLVED_NO
halted_height, halted_time, outcome, resolved_by, resolved_atThe halt and resolution
final_market_cap, basic_shares_outstanding, ipo_close_price_micro_usd, source_urlA Yes resolution: cap = shares × close / 10⁹, in micro-$B
binary_perpetual_id, option_perpetual_ids, implied_market_idIts markets: the binary, calls and puts, S
call_margin_ppm, call_min_margin_ppmThe event's call margin rates
company_idThe company, for a company expiry; 0 otherwise

ImpliedPrice

event_id, market_id, reference_cap, value (S), last_update_height, stale, stale_since_height, hold_reason, strikes_used, params (ImpliedPriceParams), binary_price (p, ppm), binary_price_reference, depth_used.

Company and CompanyIndex

Company: id, name, ticker_base, status (COMPANY_STATUS_*), template (CompanyTemplate), perp_perpetual_id, perp_clob_pair_id, index_market_id, expiry_event_ids, ipo_event_id, final_value, settled_by, settle_reason, source_url, ladder_retry_after_height, ladder_deferred_since_height.

CompanyIndex: company_id, market_id, params (CompanyIndexParams), value (I), mode (INDEX_MODE_BLENDED, _FALLBACK, _HELD), stale, stale_since_height, hold_reason, last_update_height, blend_raw (B), weights (ExpiryWeight: event_id, s, p_ppm, depth, weight, share_ppm), fallback_ema (E), book_twap_mid, premium_ppm, premium_valid, impact_bid, impact_ask, has_blended, reentry_ramp_until_height.

The parameters' defaults and bounds are in the parameter reference.

Queries

gRPC dydxprotocol.binary.Query/RESTCLI dydxprotocold q binary
AllMarkets/dydxprotocol/binary/marketlist-markets
Market/dydxprotocol/binary/market/{perpetual_id}show-market [perpetual-id]
AllEvents/dydxprotocol/binary/eventlist-events
Event/dydxprotocol/binary/event/{event_id}show-event [event-id]
ImpliedPrice/dydxprotocol/binary/implied_price/{event_id}show-implied-price [event-id]
AllCompanies/dydxprotocol/binary/companylist-companies
Company/dydxprotocol/binary/company/{company_id}show-company [company-id]
CompanyIndex/dydxprotocol/binary/company_index/{company_id}show-company-index [company-id]

Messages

MessageSignerDoes
MsgCreateBinaryMarketgovernanceLists a standalone binary market
MsgHaltBinaryMarketadmin or governanceHalts a standalone binary market
MsgResolveBinaryMarketadmin or governanceResolves it Yes or No
MsgUpdateBinaryMarketAdminadmin or governanceReplaces its admin
MsgCreateEventgovernanceLists an IPO event: binary, calls, puts, S
MsgAddEventStrikesgovernanceLists more strikes on a trading event
MsgUpdateStrikeParamsgovernanceChanges a call's open interest cap, price cap and margin rates
MsgUpdateImpliedPriceParamsgovernanceChanges an event's implied price parameters
MsgHaltEventadmin or governanceHalts every market of an event (for a company expiry before its deadline: the IPO)
MsgResolveEventadmin or governanceResolves an event: Yes with shares, close and source, or No
MsgUpdateEventAdminadmin or governanceReplaces an event's admin
MsgCreateCompanygovernanceLists a company: perpetual, index, insurance fund, three expiries
MsgUpdateCompanyParamsgovernanceChanges a company's template, index parameters, caps and funding bound
MsgSettleCompanyPerpgovernanceSettles a company's perpetual at a value or at the index
MsgUpdateCompanyAdminadmin or governanceReplaces a company's admin and its unresolved expiries'

"Governance" is the x/gov module account as authority or signer, through a proposal (governance). The admin's messages are ordinary transactions:

dydxprotocold tx binary halt-event 3 --from ADMIN --chain-id firstaccess-testnet-1 \
  --node https://rpc.testnet.firstaccess.exchange:443 --gas auto --gas-adjustment 1.5 \
  --gas-prices 25000000000adv4tnt
# Yes: shares, close in micro-dollars, source; cap = shares x close / 1e9 micro-$B
dydxprotocold tx binary resolve-event 3 yes --shares 1000000000 --close-micro 55000000 \
  --source-url https://www.sec.gov/... --from ADMIN ...
dydxprotocold tx binary resolve-event 1 no --from ADMIN ...
dydxprotocold tx binary update-event-admin 3 dydx1NEW... --from ADMIN ...
dydxprotocold tx binary update-company-admin 1 dydx1NEW... --from ADMIN ...

halt-market, resolve-market and update-admin do the same for a standalone binary market; they refuse an event's markets (ErrEventMarket) and a company perpetual.

MsgResolveEvent

FieldMeaning
signerThe event's admin or the governance module account
event_idThe event
outcomeOUTCOME_YES (any time after the halt) or OUTCOME_NO (from the deadline)
basic_shares_outstandingYes only: basic shares outstanding on IPO day
ipo_close_price_micro_usdYes only: the IPO-day closing price per share, micro-dollars
source_urlWhere both were read

The rest of the messages' fields are listed with their bounds in the parameter reference.

Events

Emitted by x/binary (attributes include perpetual_id, event_id, company_id, signer, values and reasons):

AreaEvent types
Standalone marketsbinary_market_halted, binary_market_resolving, binary_market_resolved, binary_market_admin_updated, binary_settlement_failed
Eventsbinary_event_created, binary_event_strikes_added, binary_strike_params_updated, binary_implied_params_updated, binary_event_halted, binary_event_resolving, binary_event_resolved, binary_event_admin_updated
Pricesimplied_price_updated, implied_price_held, call_mark_updated, call_mark_skipped, binary_price_skipped
Settlementsettlement_haircut, settlement_pool_deficit
Companiescompany_created, company_params_updated, company_admin_updated, company_index_updated, company_index_held, company_index_near_cap, company_ladder_listed, company_ladder_listing_failed, company_ladder_deferred, company_expiry_auto_halted, company_ipo_halted, company_settlement_pending, company_settling, company_settled, company_settlement_replaced, company_settlement_needs_governance

Errors

Codespace binary:

CodeErrorMessage
1ErrMarketNotFoundbinary market not found
2ErrInvalidMarketinvalid binary market
3ErrNotAdminsigner is neither the market's admin nor governance
4ErrAlreadyResolvedmarket is already resolved
5ErrTooEarlyToResolveNomarket cannot resolve No before its resolution time
6ErrInvalidOutcomeoutcome must be Yes or No
7ErrSettlementImbalancedsettlement payouts do not sum to zero
8ErrNotTradingmarket is not trading
9ErrNotHaltedmarket must be halted before it resolves
10ErrResolveInHaltBlockmarket resolves only from the block after its halt
11ErrInvalidAdmininvalid admin address
12ErrTickerInMarketMapticker is in the market map
13ErrVaultExistsa vault already exists for the new order book
14ErrResolveDelaythe admin resolves only once the market's resolve delay has passed since its halt
15ErrSettlementIncompletethe shares paid out differ from the open interest at the halt
17ErrEventNotFoundevent not found
18ErrInvalidEventinvalid event
19ErrInvalidImpliedPriceParamsinvalid implied price params
20ErrInvalidStrikeinvalid strike
30ErrEventMarketthe market belongs to an event: halt, resolve and re-admin the event
31ErrEventNotTradingevent is not trading
32ErrEventNotHaltedevent must be halted before it resolves
33ErrEventResolvedevent is already resolved
34ErrTooManyEventstoo many trading events
35ErrTooManyStrikestoo many strikes on the event
36ErrInvalidResolutioninvalid event resolution
37ErrSettlementShortfalla fully backed short could not pay what it owed
38ErrCompanyNotFoundcompany not found
39ErrInvalidCompanyinvalid company
40ErrInvalidCompanyTemplateinvalid company template
41ErrInvalidCompanyIndexParamsinvalid company index params
42ErrInvalidCompanyDeadlinesa company's first deadlines are 3, UTC, on day 1 to 28, strictly increasing, in different months
43ErrTooManyCompaniestoo many active companies
44ErrCompanyNotActivecompany is not active
45ErrCompanyTickerConflictticker overlaps a company's ticker base
46ErrInvalidCompanySettleinvalid company perpetual settlement
47ErrCompanySettledcompany's perpetual is already settling or settled
48ErrCompanyInsuranceSeedcould not seed the company perpetual's insurance fund
49ErrCompanyLadderListingcould not list a company expiry
53ErrRequiresGovernanceonly governance may resolve this value: it settles the company perpetual outside the admin's band

Related errors elsewhere: x/perpetuals 20010 ErrPremiumVoteForChainMarket, 20011 ErrInvalidCompanyPerp; x/clob's price band refusal, for example "order price 40000000 subticks outside the band [45000000, 55000000] of clob pair 0: price outside the band around the market's oracle price".