Skip to content

backend: Complete Unimplemented Database Operations in Plan API Handlers #1037

Description

@ONEONUORA

Problem Description

Several key API handlers in backend/src/api.rs contain placeholder comments indicating missing database logic:

  • Line 517: // Contributors: Implement saving plan to database, set default fields, and run in a transaction
  • Line 737: // Contributors: Implement plan update with beneficiary allocation_bps validation
  • Line 970: // Contributors: Implement plan retrieval, filtering by owner, and apply on-the-fly yield accumulation
  • Line 1169: // Contributors: Implement resetting last_ping timestamp and calculating accrued yield up to the ping time
  • Line 1270: // Contributors: Implement calculating final payout with yield, parsing fiat payout details, submitting fiat payouts to AnchorRegistry...

Missing Functionality & Specs

  • create_plan: Complete atomic DB insertion for plans and associated beneficiaries rows inside a SQL transaction.
  • update_plan: Add strict validation checking that allocation_bps across updated beneficiaries equals 10,000 bps before updating DB.
  • get_plans: Calculate dynamic, on-the-fly yield accumulation using yield_calculator and join beneficiary records.
  • ping_plan: Update last_ping timestamp, recalculate inactivity_deadline_at, update accrued yield, and log ping audit record.
  • trigger_payout: Submit off-ramp requests to AnchorRegistry for fiat payouts, emit webhooks, and transition plan status to SETTLED.

Affected Files

  • backend/src/api.rs

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

GrantFox OSSIssue tracked in GrantFox OSSMaybe RewardedIssue may be eligible for a GrantFox rewardThird CampaignCampaign: Third Campaign

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions