MarketAdapter¶
One instance per active prediction market. Deployed by the operator when entering a new position. Decommissioned when its market settles and capital is redeployed.
Role¶
The MarketAdapter is the venue-specific boundary between the LiquidityVault and the prediction market. All venue-specific logic — order submission, settlement claiming, price reading — is encapsulated here.
The vault interacts with all adapters exclusively through the formal interface defined below. Any adapter implementation that does not satisfy this interface exactly will produce an ABI mismatch and fail silently or revert at the call site.
Key Properties¶
- Stateless beyond the position it holds — once deployed, it holds NO shares and reports their value
- Vault-authorized calls only —
buyNoShares,sellNoShares, andclaimSettlementrevert if not called by the authorized vault address - Immutable vault reference — the vault address is set at deployment and cannot be changed
- Up to four adapters can be active simultaneously
Sections¶
Formal Solidity Interface¶
The following interface is the authoritative definition. All adapter implementations must conform to this exact ABI. All vault calls to the adapter use these selectors.
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
interface IMarketAdapter {
// Buy NO shares with USDC.
// Returns: (sharesAcquired, executionPrice)
// sharesAcquired : NO shares received from the venue (1e18 precision)
// executionPrice : weighted average fill price in 1e18 fixed-point
// (e.g. 0.93e18 = $0.93 per NO share)
// The vault uses executionPrice as position.entryPrice.
// Reverts if slippage exceeds maxSlippageBps (50 bps on entry).
// Vault-only.
function buyNoShares(uint256 assets)
external
returns (uint256 sharesAcquired, uint256 executionPrice);
// Sell up to `shares` NO shares at market.
// Returns: (actualSharesSold, usdcReceived)
// actualSharesSold : shares actually sold, computed via before/after balance diff.
// May be less than `shares` if position is smaller than requested.
// usdcReceived : USDC transferred back to the vault.
// Caps at actual position size; does not attempt to sell more than held.
// Reverts if slippage exceeds maxSlippageBps (200 bps on exit).
// Called only by emergencyLiquidate when system is paused.
// Vault-only.
function sellNoShares(uint256 shares)
external
returns (uint256 actualSharesSold, uint256 usdcReceived);
// Current best-bid market price of NO shares from venue.
// Returned in 1e18 fixed-point.
function currentPrice() external view returns (uint256);
// positionSize() * currentPrice() / 1e18.
// Real-time market value of the entire NO share holding.
function positionValue() external view returns (uint256);
// NO shares held by this adapter (1e18 precision).
function positionSize() external view returns (uint256);
// True when the underlying prediction market has resolved
// and settlement is final (oracle dispute window closed).
// Must return false during any pending dispute period.
function isSettled() external view returns (bool);
// Claim settlement proceeds and transfer USDC to the vault.
// Returns: usdcReturned
// Reverts if isSettled() is false.
// Vault-only.
function claimSettlement() external returns (uint256 usdcReturned);
}
Adapter Trust
Each MarketAdapter is deployed by governance and holds vault funds. A malicious or buggy adapter could steal or lock funds. Adapters must be deployed from a verified factory or use a standardized, audited implementation. The vault must never approve an adapter that has not been reviewed. See Security — Adapter Trust.