Catalog npm
Back to packageRELEASE DETAILS

0.2.0

npm

@0g-brier/protocol

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

0gdefidpmparimutuelprediction-market
Published1 Sept 2026
Direct dependencies4
Transitive dependenciesNot calculated

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.

Declared dependencies 4

Native requirements
4 direct targetsNot calculated transitive count
Package / targetRequirementRelationship
tsx
Environment
{
  "local_name": "tsx",
  "alias": false,
  "peer_metadata": null
}
^4.19.2development
vitest
Environment
{
  "local_name": "vitest",
  "alias": false,
  "peer_metadata": null
}
^3.0.5development
typescript
Environment
{
  "local_name": "typescript",
  "alias": false,
  "peer_metadata": null
}
^5.7.2development
@types/node
Environment
{
  "local_name": "@types/node",
  "alias": false,
  "peer_metadata": null
}
^22.10.0development

Distribution files

1 collected
Distribution 1

Source distribution

Source file
Checksums from source
{
  "shasum": "cdd3dabc554966e4b4d1f1de0898bd1c3de3b15d",
  "tarball": "https://registry.npmjs.org/@0g-brier/protocol/-/protocol-0.2.0.tgz",
  "fileCount": 38,
  "integrity": "sha512-dF2iL5ZQprttuhhwyDfibd+uktI0KQB3t46w1rercfLhtFUysIDfAs/aLTJuOBJURjmPeQVvv0JuSMr7CNCUpQ==",
  "signatures": [
    {
      "sig": "MEYCIQDpWCjS9rn4mXEY6GuU80owPV329fu3CwNw+Ok8ze7/jQIhAPafG2Ye0pPFzCz7VmXy++XUO4bqZ2UuoIczj8fMc091",
      "keyid": "SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"
    },
    {
      "sig": "MEUCIDSK7xG8UdVmqf0Un2c263JNFGigZ7xRT90MaG37JvuQAiEAmJ4HsifHqmb8iO1S1jpFGJCpYUe6dAIxnzYohgm+bLE=",
      "keyid": "SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"
    }
  ],
  "unpackedSize": 45075
}

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_version:09d80a7e63b047e47308d23448bd9f4e4d4d08d989e95206a00742400c38bd87

Other collected versions

0.2.11 Sept0.1.029 AugView all collected versions →