Conversation
…hema migration Closes accesslayerorg#869 - Add POST /api/v1/creator/:keyId/curve with strict validation (1-5 milestones, ascending order, integer exponents 1-5) - Invoke curveGateway.configureGraduatedCurve before persistence - Add GET /api/v1/keys/:keyId/curve-config - Add schema migration for curve_milestones, base_exponent, and GRADUATED_CURVE_CONFIGURED - Log activity event on successful configuration
There was a problem hiding this comment.
Copilot review overview
🟡 Changes recommended
Critical migration and contract-dispatch issues, plus validation and consistency concerns, block approval.
Get a fresh assessment by requesting another Copilot review.
Review effort: Lite
Findings: 2
Open (3)
What changed in this PR
Adds creator-only graduated curve configuration and public curve-config inspection endpoints.
Changes:
- Adds milestone and exponent validation.
- Persists configurations and records activity events.
- Updates Prisma schema, migration, and tests.
| File | Description |
|---|---|
src/modules/keys/keys.routes.ts |
Public curve configuration endpoint |
src/modules/creator/creator.routes.ts |
Creator configuration endpoint and validation |
src/modules/creator/creator-curve.service.ts |
Curve gateway abstraction |
src/modules/creator/__tests__/creator-curve.test.ts |
Endpoint tests |
prisma/schema/creator.prisma |
Curve configuration fields |
prisma/schema/activity.prisma |
Activity event type |
prisma/migrations/20260924_add_graduated_curve/migration.sql |
Database migration |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
| -- AlterEnum | ||
| ALTER TYPE "ActivityType" ADD VALUE IF NOT EXISTS 'GRADUATED_CURVE_CONFIGURED'; | ||
|
|
||
| -- AlterTable | ||
| ALTER TABLE "CreatorProfile" ADD COLUMN IF NOT EXISTS "curve_milestones" JSONB, | ||
| ADD COLUMN IF NOT EXISTS "base_exponent" INTEGER NOT NULL DEFAULT 1; |
| }, | ||
| 'Submitting configure_graduated_curve contract call' | ||
| ); | ||
| return { transactionHash: undefined }; |
| typeof m.supplyThreshold !== 'number' || | ||
| typeof m.exponent !== 'number' || | ||
| isNaN(m.supplyThreshold) || | ||
| isNaN(m.exponent) |
|
Superseded by #1007, which carries all four issues (#866, #869, #870, #872) on one branch rebased on latest Splitting these four across separate PRs meant they collided with each other: all four touch Closing this one in favour of #1007. |


Summary
Implements the graduated bonding curve configuration endpoints, allowing creator key owners to customize milestone tiers and curve exponents as supply grows, and allows public inspection of configured parameters.
Closes #869
Implementation Details
POST /api/v1/creator/:keyId/curve: Creator-only endpoint to configure tiered supply milestones and exponents.GET /api/v1/keys/:keyId/curve-config: Public endpoint to query active curve milestones and base exponent.requireKeyCreator('keyId')).supplyThresholdmust be positive and in strictly ascending order.exponentmust be an integer between 1 and 5 (enforcingNumber.isInteger).curveGateway.configureGraduatedCurve.CreatorProfile.curveMilestones.GRADUATED_CURVE_CONFIGUREDin Activity ledger.prisma/migrations/20260924_add_graduated_curve/migration.sqlfor existing database deployments.Testing
src/modules/creator/__tests__/creator-curve.test.tsverifying: