Skip to content

feat: Add KYC verification for plan creation and claiming#235

Open
zintarh wants to merge 2 commits intoFracverse:masterfrom
zintarh:feature/kyc-verification-for-plans
Open

feat: Add KYC verification for plan creation and claiming#235
zintarh wants to merge 2 commits intoFracverse:masterfrom
zintarh:feature/kyc-verification-for-plans

Conversation

@zintarh
Copy link
Contributor

@zintarh zintarh commented Feb 26, 2026

Overview

This PR implements KYC verification for inheritance plan creation and claiming, ensuring only approved users can interact with these critical functions.

Changes

Core Implementation

  • ✅ Added KycStatus enum with Pending, Approved, and Rejected states
  • ✅ Added KycStatus(Address) to DataKey for persistent storage
  • ✅ Implemented set_kyc_status() and get_kyc_status() functions
  • ✅ Added KycNotApproved error type to InheritanceError enum

Plan Creation Protection

  • ✅ Added KYC pre-check in create_inheritance_plan() function
  • ✅ Returns KycNotApproved error if user's KYC status is not approved
  • ✅ Blocks pending and rejected users from creating plans

Plan Claiming Protection

  • ✅ Implemented new claim_plan() function with KYC verification
  • ✅ Verifies claimant's KYC status before allowing claim
  • ✅ Validates email and claim code against plan beneficiaries
  • ✅ Returns appropriate errors for unauthorized attempts

Testing

  • ✅ Comprehensive unit tests for KYC status management
  • ✅ Tests for approved users successfully creating and claiming plans
  • ✅ Tests for pending/rejected users being blocked
  • ✅ Tests for proper error messages
  • ✅ Tests for invalid claim credentials

Requirements Met

Pre-check before creating a plan: Verifies user's KYC status is approved
Pre-check before claiming a plan: Verifies user's KYC status is approved
Descriptive errors: Returns KycNotApproved error for unauthorized attempts
Comprehensive tests: All scenarios covered with unit and integration tests

Testing

All tests pass successfully:

  • Approved users can create and claim plans ✅
  • Pending users are blocked from creating/claiming ✅
  • Rejected users are blocked from creating/claiming ✅
  • Proper error messages are returned ✅

Closes #71

- Add KycStatus enum (Pending, Approved, Rejected)
- Add KYC status management functions (set_kyc_status, get_kyc_status)
- Add KYC check to create_inheritance_plan function
- Implement claim_plan function with KYC verification
- Add comprehensive unit and integration tests
- Block pending/rejected users from creating or claiming plans

Closes Fracverse#71
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.

[Soroban] Only Verified Users Can Create or Claim Plans

1 participant