Skip to content

Implement create_school_if_needed Instruction #2

Description

@sanaderi

Create a School account on-chain as a Program Derived Address (PDA) when the first donation request for a school is submitted. This account will store minimal information and be owned by the program, ensuring users cannot modify it directly.

Tasks

  • Define a School PDA that stores:
    • school_id (string or bytes)
    • Optional minimal metadata
  • Implement logic to:
    • Check if a School PDA already exists for a given school_id.
    • Create the School PDA if it does not exist.
    • Ensure the PDA’s owner is the program.
  • Ensure PDA initialization includes correct space, lamports, and bump seed.
  • Write unit tests covering:
    • Creation of a new School PDA.
    • Attempting to create a duplicate School PDA (should not create a new one).

Acceptance Criteria

  • School PDA is created automatically if it doesn’t exist.
  • The program owns all School PDAs.
  • No duplicate School PDAs are created.
  • Unit tests pass successfully.

@holygrimacing

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions