Commit Graph

2 Commits

Author SHA1 Message Date
Liviu
b45682d578 feat(corebook): CoreBookClient + AereCoreBookClient selector fixes + AERE_COREBOOK markets gate
- CoreBookClient: full read/write surface for AereCoreBookV0 (placeGTC/IOC/
  withSlippage/Protected, cancel, claim base+quote, flushFees; bestBid/bestAsk/
  marketInfo/depth/openOrdersOf via Lens), price math mirrors (_computeQuote,
  _lockBuyFunds incl. 256-wei buffer), orderId derivation (pre-incremented
  nonce keccak), event decode for OrderPlaced/Filled/OrderCancelled/Claimed.
  Verified 63/63 against ethers v6 ground truth.
- AereCoreBookClient (pre-existing): fixed 11 wrong read selectors (bestBid,
  bestAsk, pendingSinkFee, TAKER_FEE_BPS, PRICE_TICK, LOT_SIZE, decimals
  factors, PRICE_SCALE, cancel-delay constants) - every read would have
  thrown before.
- addresses.ts: AERE_COREBOOK = { markets: {} } - founder gate, no market
  listed until explicit approval.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-06-11 10:44:18 +03:00
Liviu
fbc6d4f68a feat(sdk): R5+R6 surfaces — CoreBook client + sAERE drip + Compliance challenge bond
New & expanded clients reflecting all R4/R5/R6 contract hardening:

- corebook/AereCoreBookClient.ts (NEW):
  - Side+TimeInForce enums; pre-computed selectors for place/placeProtected/
    placeWithSlippage/placeWithSlippageProtected/iocFill/cancel/flushFees/
    sweepDust/claim
  - read* helpers for bestBid, bestAsk, pendingSinkFee, TAKER_FEE_BPS,
    PRICE_TICK, LOT_SIZE, QUOTE_DECIMALS_FACTOR, BASE_DECIMALS_FACTOR,
    PRICE_SCALE, totalClaimableQuote/Base, per-user claimable lookups
  - computeQuote(price, qty) helper mirrors on-chain formula
  - recommendedSlippage(side, limit, qty, bps) computes maxAvgPriceWei for
    real sandwich protection — discourages naive iocFill
  - Docstrings explicitly state which entrypoint to use for crossing vs
    resting orders (R6 HIGH-5/MED-9 enforcement)

- saere/sAEREClient.ts (R5/R6):
  - atomicState() — single-call snapshot of {bal, totalAssets, undist,
    totalSupply, rewardRate, periodFinish, lastObservedBalance} eliminating
    cross-block drift in fuzz/dashboard reads
  - readUndistributed(), readRewardRate(), readPeriodFinish()
  - encodeSync() — permissionless drip refresh

- compliance/NewComplianceClients.ts (R5/R6):
  - proposeAssociationRoot + challengeAssociationRoot (bond required) +
    dismissChallenge entrypoints
  - challengeBond(), maxDismissalsPerRoot(), dismissCount(root),
    challenger(root), isKnownRoot(root), getLastRoot(), nextLeafIndex()
  - removed publishDepositRoot (R5: roots are on-chain Merkle, not pushed)
  - static computeActualLeaf helper note: leaf = keccak256(commitment, sender)
    so SDK consumers build ZK proofs against the bound leaf

- index.ts: export corebook surface

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-06-09 12:56:44 +03:00