@lunarbase-lab/pmm-v2-math
v0.4.1
Published
Bit-exact LunarBase quote math for TypeScript
Maintainers
Readme
@lunarbase-lab/pmm-v2-math
Pure TypeScript bigint quote math with Solidity-compatible results.
Status: fully supported.
Install
npm install @lunarbase-lab/pmm-v2-mathUse
import {
quote,
solidityQuoteAmount,
type QuotePolicy,
type QuoteRequest,
type QuoteState,
} from "@lunarbase-lab/pmm-v2-math";
const policy = { feeClass: "Whitelisted" } satisfies QuotePolicy;
const outcome = quote(request satisfies QuoteRequest, executionBlock, state satisfies QuoteState, policy);
const contractAmount = solidityQuoteAmount(request, outcome);The root entry point is intentionally limited to quotes, quote state, and canonical address helpers. Import optional low-level facilities explicitly:
import { fullMulDivDown } from "@lunarbase-lab/pmm-v2-math/arithmetic";
import { decodeLaneSlot0, modelQuoteToLaneSlot0Fields } from "@lunarbase-lab/pmm-v2-math/slot0";Fee stages and checked implementation primitives are internal details of the bit-exact quote engine.
Guarantees
- Exact-input and exact-output quotes use checked
uint256arithmetic. - Values used in EVM arithmetic are represented as
bigint. - The package has no RPC, persistence, clock, async-runtime, or network dependency.
