Catalog npm
PACKAGE EXPLORERView in registry

@0g-brier/protocol

npm

The Dynamic Pari-mutuel Market maths behind Brier, in TypeScript — pricing, quoting, units and deployment manifests.

0gdefidpmparimutuelprediction-market
Versions collected3
Direct dependencies4From release 0.2.1
Last observed20 Oct, 22:10 UTC

README

Current package documentation

@0g-brier/protocol

The Dynamic Pari-mutuel Market maths behind Brier, in TypeScript. A mirror of the Solidity library, pinned to it by vectors generated from the contracts themselves — a mirror is only worth having if something fails when it drifts.

npm i @0g-brier/protocol
import {dpm, WAD, networkFor} from "@0g-brier/protocol";

const q: readonly [bigint, bigint] = [1000n * WAD, 1200n * WAD]; // [NO, YES]

dpm.probability(q, 1); // 0.590… — P(YES)
dpm.price(q, 1);       // 0.768… — the marginal PRICE per share

Those are different numbers, and confusing them is the mistake this package exists to prevent. The implied probability is pᵢ²; the marginal price is pᵢ. A price shown with a % sign is a lie about the instrument.

A winning share pays 1/pᵢ, funded entirely by the pool — so every later buyer on your side dilutes you, including your own next order. dpm.costUp, sharesForSpend and quote size a trade against that.

Deployment manifests load through the ./node entry point:

import {loadDeployment} from "@0g-brier/protocol/node";
const {contracts} = loadDeployment(16661, "./deployments"); // 0G mainnet

MIT.

Downloads & popularity

Awaiting observations

No metric observations yet

Download counts and popularity will appear here as the collector receives them.

Versions 3

Collected releases
VersionPublishedDirect dependenciesOpen version
0.2.1Registry latest1 Sept 20264
0.2.01 Sept 20264
0.1.029 Aug 20264

Package advisories

0
No matching advisories collected

This describes our collected data; it is not a security assessment.

Repository

PENDING
hevdev7/0g-brier

Shared repository data · GitHub

License detected in repository
Not collected

Metadata history

Meaningful changes
Current collected state Current

Observed since 20 Oct, 22:10 UTC

No superseded metadata states collected. Unchanged observations do not create new revisions.

Record identity

package:e3fdaeaeaf5c310a5027c950ff730b49a451c04c4b5da848c1c45c0abdf7e9eb