Skip to content

Track and store delas#5

Merged
lukasz-wal merged 22 commits intomainfrom
feature/historical-data
Apr 17, 2026
Merged

Track and store delas#5
lukasz-wal merged 22 commits intomainfrom
feature/historical-data

Conversation

@lukasz-wal
Copy link
Copy Markdown
Collaborator

No description provided.

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR extends the oracle cron service to persist PoRep market deal data in Postgres (via Prisma), add new cron jobs around syncing/settling/terminating deals, and update SLI fetching/attestation plumbing (including new contract integrations and env configuration).

Changes:

  • Introduces Prisma schemas/migrations plus runtime Prisma client wiring (including a second “DMOB” Prisma client).
  • Adds multiple new cron jobs (deal sync, set deal end epoch, settlement bot, terminate deal, claims-terminated-early) and updates HTTP/manual triggers accordingly.
  • Refactors SLI data types and CDP fetching shape; updates on-chain SLI submission logic and wallet role handling.

Reviewed changes

Copilot reviewed 45 out of 47 changed files in this pull request and generated 14 comments.

Show a summary per file
File Description
src/utils/types.ts Adds/updates domain types for SLIs and PoRep deal tracking.
src/services/prisma-service.ts Adds Prisma client factories (main + DMOB).
src/services/filecoin-api-service.ts Updates imports to new module specifiers.
src/services/db-service.ts Adds DB queries and deal upsert/sync logic via Prisma.
src/services/db-dmob-service.ts Adds DMOB DB query for allocation term aggregation.
src/services/cdp-fetch-service.ts Changes CDP endpoint + response shape handling.
src/jobs/terminate-deal-job.ts New cron job to terminate rails and mark DB state.
src/jobs/sync-deal-job.ts New cron job to sync deals from chain + validate allocations via DMOB.
src/jobs/settlement-bot-job.ts New cron job to settle rails via FilecoinPay.
src/jobs/set-sli-job.ts Updates SLI cron job to use SP registry + new CDP response shape.
src/jobs/set-deal-end-epoch-job.ts New cron job to set deal end epoch + modify rail payment.
src/jobs/claims-tracking-job.ts Removes old claims tracking job implementation.
src/jobs/claims-terminated-early-job.ts New cron job to detect early-terminated claims and report on-chain.
src/index.ts Adds scheduling for new cron jobs and env validation.
src/http-server/server.ts Updates manual trigger endpoints for new/renamed jobs.
src/config/env.ts Expands env config (roles, contracts, new cron intervals).
src/blockchain/validator-contract.ts Adds validator contract interactions (terminate/set end epoch/modify payment).
src/blockchain/sp-registry-contract.ts Adds SP registry contract integration for provider discovery.
src/blockchain/sli-oracle-contract.ts Refactors SLI submission to new data model and wallet role.
src/blockchain/sla-allocator-contract.ts Removes old SLA allocator contract integration.
src/blockchain/porep-market.contract.ts Adds PoRep market contract reads (getDeals/getCompletedDeals).
src/blockchain/filecoinpay-contract.ts Adds FilecoinPay settleRail contract interaction.
src/blockchain/client-contract.ts Refactors client contract calls + introduces wallet account roles.
src/blockchain/blockchain-client.ts Adds wallet-client-per-role caching and account selection.
src/blockchain/abis/validator-abi.ts Adds validator contract ABI.
src/blockchain/abis/sp-registry-abi.ts Updates SP registry ABI entries.
src/blockchain/abis/sli-oracle-abi.ts Updates SLI oracle ABI types/components.
src/blockchain/abis/porep-market-abi.ts Adds PoRep market contract ABI.
src/blockchain/abis/filecoinpay-abi.ts Adds FilecoinPay ABI.
src/blockchain/abis/client-abi.ts Updates client ABI method signature (per-deal allocations).
prismaDmob/schema.prisma Adds DMOB schema model for unified_verified_deal.
prismaDmob/prisma.config.ts Adds Prisma CLI config for DMOB schema.
prisma/schema.prisma Adds oracle DB schema for deals/requirements/terms/history/settlements.
prisma/prisma/migrations/migration_lock.toml Adds Prisma migration lock.
prisma/prisma/migrations/20260414102544_init/migration.sql Initial migration for deal tracking tables.
prisma/prisma/migrations/20260414114403_store_deal_allocation_ids/migration.sql Adds allocationIds column.
prisma/prisma/migrations/20260414135045_create_settlement_history/migration.sql Adds settlement history + deal end epoch flags.
prisma/prisma.config.ts Adds Prisma CLI config (schema/migrations/datasource).
package.json Adds Prisma deps/scripts and adjusts runtime deps.
docker-compose.yml Adds local Postgres service.
ci/runner.sh Adds entrypoint wrapper to derive DATABASE_URL from secret JSON.
ci/aws-secret-to-db-url.js Adds helper to build DATABASE_URL from AWS secret JSON env.
Dockerfile Adds Prisma generate steps + entrypoint runner + truststore bundle.
.gitignore Ignores generated Prisma clients.
.env.example Updates sample env variables (needs alignment with new keys).
.README.md Updates documentation/diagrams for new job flows.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread .env.example Outdated
Comment thread src/blockchain/blockchain-client.ts
Comment thread src/jobs/set-deal-end-epoch-job.ts
Comment thread prisma/prisma.config.ts
Comment thread ci/runner.sh
Comment thread src/jobs/sync-deal-job.ts
Comment thread src/jobs/settlement-bot-job.ts
Comment thread src/jobs/terminate-deal-job.ts
Comment thread src/http-server/server.ts Outdated
Comment thread src/http-server/server.ts
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 49 out of 51 changed files in this pull request and generated 10 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/utils/types.ts Outdated
Comment thread src/jobs/settlement-bot-job.ts
Comment thread src/services/db-dmob-service.ts Outdated
Comment thread src/http-server/server.ts
Comment thread src/blockchain/validator-contract.ts
Comment thread src/utils/types.ts
Comment thread src/blockchain/sp-registry-contract.ts
Comment thread package.json
Comment thread src/http-server/server.ts
Comment thread src/blockchain/blockchain-client.ts
@lukasz-wal lukasz-wal force-pushed the feature/historical-data branch from 050ce77 to 8dc2285 Compare April 15, 2026 20:25
@lukasz-wal lukasz-wal merged commit cc5ad08 into main Apr 17, 2026
5 checks passed
@lukasz-wal lukasz-wal deleted the feature/historical-data branch April 17, 2026 10:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants