PARI MUTUEL POOL (PMP)
(Work in progress) PMP Contract Interface Documentation
Overview
Pari Mutuel Pool is a decentralized pari manuel contract that aggregates user stakes on discrete outcomes of an event. A PMP does not charge protocol fees, but requires approval from one or more oracles before becoming active.
Each PMP is:
Deployed by a PrivateNote
Bound to a specific event and oracle list
Governed by oracle proposals (multi-oracle voting)
Contract Metadata
Contract name:
PMPRole: Pari Mutuel Pool
Deployed by:
PrivateNoteAuthorization model:
Users:
PrivateNoteOracles: oracle public keys
Lifecycle:
Deploy → Oracle Approval → Configuration → Staking → Resolution → Claims
Key Concepts
Outcomes — Discrete result intervals (minimum 2)
Staking window — Time interval for accepting stakes
Result window — Time interval for resolving outcome
Oracle approval — Required before activation
Oracle governance — Proposals and voting for configuration & resolution
Events
StakeAccepted
StakeAcceptedEmitted when a stake is successfully accepted.
note: the user’sPrivateNoteaddressoutcomeId: the chosen outcome identifieramount: stake amount
ApprovedByOracle
ApprovedByOracleEmitted when all oracle event lists approve the PMP.
oracleEventList: the oracle event list contract address that sent the approvaloraclePubkey: the oracle public key used as an oracle identifier
Resolved
ResolvedEmitted when the event outcome is resolved.
outcomeId: the resolved outcome identifier
ClaimProcessed
ClaimProcessedEmitted when a claim is processed.
note: the user’sPrivateNoteaddressoutcomeId: the outcome the user claimed forpayout: computed payout amount (0 if unresolved or losing)win:trueif the claim matches the resolved outcome
TimingsSet
Emitted when staking and result windows are configured and the pool is marked approved.
stakeStart: staking start timestampstakeEnd: staking end timestampresultStart: result window start timestampresultEnd: result window end timestamp
EventCancelled
Emitted when the event is cancelled.
ProposalCreated
Emitted when an oracle governance proposal is created.
proposalId: deterministic proposal identifier (typically hash offunctionType+data)functionType: action type identifierdata: ABI-encoded payload (TvmCell)
ProposalExecuted
Emitted when a proposal is executed.
proposalId: executed proposal identifierfunctionType: executed action type identifierdata: executed ABI payload (TvmCell)
Oracle Approval Flow
approveEvent
approveEventOracle confirms/approves the event.
Parameters:
oracle_pubkey: oracle public key used as an oracle identifieroutcomeNames: mappingoutcomeId -> name(used only on first approval) It represents a logical band of outcomes for a single event. Where:outcomeId(key, e.g.0, 1, 2, …) — the identifier of a specific outcomename— a description of that outcome
Example: Sports Event "Real vs Benfica" Outcome band:
0 — Real wins
1 — Benfica wins
2 — Draw
describe: event description (used only on first approval)trustAddr: optional internal address binding tooracle_pubkeyfor internal voting flows
Access Control:
Callable only by approved
OracleEventListcontracts
Behavior:
prevents duplicate approvals (by pubkey / sender rules in implementation);
on the first oracle approval, initializes:
the event description (
describe);outcome names mapping (
outcomeNames);number of outcomes (
numOutcomes = outcomeNames.keys().length);
once all required oracle confirmations are collected, emits
ApprovedByOracle(...).
rejectEvent
rejectEventRejects the PMP and self-destructs the contract.
Staking
acceptStake
acceptStakeAccepts a stake from the user’s PrivateNote and records it in the pool.
Parameters:
outcomeId: chosen outcome identifierstakeAmount: stake amountdeposit_identifier_hash: hash used to compute the caller’sPrivateNoteaddressisInc: whether this stake should increase the active stake count for the outcome
Requirements:
PMP approved by all oracles
Within staking time window
Outcome ID valid
Side Effects:
Updates pools and counters
Notifies
PrivateNotevia callback
cancelStake
cancelStakeCancels a stake and triggers refund-side handling in PrivateNote.
Parameters:
outcomeId: chosen outcome identifierstakeAmount: stake amountdeposit_identifier_hash: hash used to compute the caller’sPrivateNoteaddress
Access:
only the computed
PrivateNoteaddress fordeposit_identifier_hash.
Requirements:
the event must be cancelled.
Claims
claim
claimProcesses a claim for a user.
Parameters:
stakeAmount: stake amountoutcomeId: chosen outcome identifierdeposit_identifier_hash: hash used to compute the caller’sPrivateNoteaddress
Access:
only the computed
PrivateNoteaddress fordeposit_identifier_hash.
Requirements:
the pool must be approved;
outcomeId < numOutcomes.
Behavior:
if the outcome is not resolved yet, payout is
0andwin = false(claim is acknowledged);if resolved and losing, payout is
0andwin = false;if resolved and winning, payout is proportional:
payout = stakeAmount * totalPool / winningPool
Additionally:
emits
ClaimProcessed(...);calls
PrivateNote.onClaimAccepted(...);when the last active stake for the winning outcome is claimed, the contract self-destructs to
_deployer.
Oracle Governance
createProposal
createProposalCreates a new oracle governance proposal.
Parameters:
function_type: action type identifier (implementation-specific)data: ABI-encoded payload (TvmCell) for the action
Access:
only authorized oracles (either via trusted internal sender binding or external sender pubkey membership, depending on implementation rules).
Behavior:
the creator’s vote is counted immediately;
if there is only one oracle, the proposal executes immediately;
otherwise emits
ProposalCreated(...).
vote
voteVotes on an existing proposal.
Parameter:
proposalId: identifier of the proposal to vote on
Access:
only authorized oracles.
Behavior:
rejects if proposal does not exist;
ignores/removes proposal if it is past deadline;
prevents double voting by the same oracle pubkey;
executes proposal automatically once the threshold is reached (implementation-specific);
successful execution leads to
ProposalExecuted(...).
View Functions
getDetails
getDetailsReturns the complete contract state in a single call.
Returns :
nameHuman-readable pool name. Acts as a static identifier of the Pari Mutuel Pool and is passed toPrivateNotecallbacks.token_typeIdentifier of the token type used by this pool. Fixed at deployment time.event_idUnique identifier of the event associated with this Pari Mutuel Pool. Used in oracle interactions.oracle_list_hashHash of the oracle list configuration for this event, ensuring all oracle confirmations refer to the same oracle set.deployerAddress of the contract deployer. Receives remaining funds when the contract self-destructs after the final winning claim.rootAddress of the RootPN contract. Used for deterministicPrivateNoteaddress computation.privateNoteCodeHashHash of thePrivateNotecontract code used by the pool. Allows off-chain verification ofPrivateNoteaddresses.totalPoolTotal amount staked across all outcomes. Used in payout calculation.approvedIndicates whether the pool has been fully approved by oracles and is ready to accept stakes.numOutcomesNumber of possible outcomes for the event. Set once during the first oracle approval.resolvedOutcomeOptional final outcome identifier. If empty, the event is not resolved yet; if set, contains the winningoutcomeId.stakeStartUnix timestamp when staking becomes available.stakeEndUnix timestamp when staking ends.resultStartUnix timestamp when the result resolution window starts.resultEndUnix timestamp when the result resolution window ends.isCancelledIndicates whether the event has been cancelled. Whentrue, staking is disabled and stake cancellation is allowed.numberOfOracleEventsTotal number of oracle event list contracts configured at deployment.approvedOracleEventsNumber of oracle event lists that have already approved the event.outcomePoolAmountsMapping ofoutcomeIdto the total amount staked on that outcome.outcomeStakeCountsMapping ofoutcomeIdto the number of active stakes for that outcome.outcomeNamesMapping ofoutcomeIdto a name of the outcome.
getVersion
getVersionReturns the implementation version and kind identifier.
Returns:
semver: version stringkind: contract kind string (expected"PMP")
Last updated