Source: src/core/UmiaMarketCore.sol
Decision market engine with virtual token accounting.
- Creates markets/proposals.
- Handles split/merge with a minimal virtual-token ledger (
balanceOf/transfer+LedgerLib), not full ERC-6909 (no approve/allowance/operator surface). - Runs per-proposal CPMM markets.
- Settles markets with TWAP-based winner selection.
- Coordinates settlement claims and winning payload execution.
marketCounter,proposalCounter,activeUnsettledMarketCount_markets[marketId](MarketData),_proposals[proposalId](ProposalData) — packed structs inMarketCoreTypes_pools[proposalId](Pool: CPMM reserves, accrued protocol fees, user virtual supplies, LP shares)_settle[marketId](SettleAcct: real venture/money balances, winner + winning TWAP, LP re-add accounting,settledAt,executed-adjacent flags onMarketData)balanceOf[owner][id],totalSupply[id]— the virtual venture/money + LP-share ledger (LedgerLib)proposalToMarket,activeMarketByVenture,_hasClaimed[marketId][user]- EIP-712 replay state:
marketCreationNonces,swapNonces,DOMAIN_SEPARATOR - Market stake accounting lives in the separate
UmiaMarketStakecontract, not here.
- Market lifecycle:
createMarketgetMarketStatussettleMarketclaimSettlementexecuteWinningProposal
- Trading/accounting:
split,merge- swaps:
swapExactIn,swapExactOut(self-custodial), plusswapExactInWithPermit,swapExactOutWithPermit(EIP-712 relayed) addLiquidity
createMarketrequires signer-approved payload and nonce.- Swaps are self-custodial:
swapExactIn/swapExactOutmove the caller's own virtual tokens. The permit variants recover an EIP-712 signer and consume a per-signerswapNoncesentry for replay protection. executeWinningProposalresolves executor from hub and requires non-zero executor if payload execution is needed.
Defined in MarketCreationLib (not on UmiaMarketCore itself):
TRADING_MAX_START_DELAY = 7 days— start at/beforeblock.timestampclamps to now (no minimum delay)TRADING_MIN_DURATION = 1 hoursTRADING_MAX_DURATION = 96 hoursTRADING_DEFAULT_DURATION = 3 days— used whenduration == 0MIN_PROPOSALS = 1MAX_PROPOSALS = 5
- A no-op proposal is auto-inserted at index 0 for each market.
- 50% of venture LP liquidity is removed during market creation and partially re-added at settlement.
- Winner threshold comparison uses hub-configured
winningMarketThresholdBps.