World ID Integration
Learn how Avocado Fund uses World ID for secure borrower verification
Overview
Avocado Fund uses World ID to verify borrowers' identities before allowing them to access uncollateralized loans. This integration:
- Verifies that borrowers are unique humans (prevents Sybil attacks)
- Preserves privacy through zero-knowledge proofs
- Enables manual credit limit approval based on verification level
- Creates a seamless user experience within the borrowing flow
Integration Components
World ID Widget
The integration uses the World ID IDKit widget to handle the verification process. In our implementation, we've created a mock version for development purposes, but in production, you would use the actual @worldcoin/idkit package.
Verification Component
The WorldIDVerification component handles displaying the verification UI, processing verification results, communicating with parent components via callbacks, and showing appropriate feedback based on verification status.
Borrow Page Integration
The borrow page integrates the verification component and updates UI based on verification status, shows pending approval state, and provides a seamless tab-based interface for the entire borrowing flow.
Admin Interface
The admin interface allows protocol operators to review verification applications, manually approve credit limits, and manage protocol risk parameters.
Verification Flow
- User visits the borrow page
- User clicks "Verify with World ID" button
- World ID verification process occurs (either via Orb or device)
- Upon successful verification:
- User's identity is confirmed
- Application enters manual review status
- Protocol team reviews and approves credit limit
- Once approved, borrowing functionality is unlocked
Credit Approval Process
Credit limits are manually approved by the protocol team after verification:
- User completes World ID verification (Orb or Phone)
- Verification is recorded on-chain
- Protocol team reviews the verification
- Credit limit is manually assigned based on:
- Verification level (Orb vs Phone)
- Additional risk factors
- Protocol liquidity
This manual approval process adds an extra layer of security to prevent abuse.
Implementation Details
Mock Implementation
For development purposes, we've created a mock implementation of the World ID widget that simulates the verification process. In production, you would use the actual @worldcoin/idkit package.
Verification Result
The verification result includes:
type VerificationResult = {
merkle_root: string;
nullifier_hash: string;
proof: string;
verification_level: "orb" | "device";
};Parent-Child Communication
The verification component communicates with the parent component via a callback:
interface WorldIDVerificationProps {
onVerificationSuccess?: (creditLimit: number) => void;
}Production Deployment
For production deployment:
- Register your app on the World ID Developer Portal
- Replace the mock implementation with the actual
@worldcoin/idkitpackage - Implement a backend verification endpoint to verify proofs
- Connect the verification result to your smart contracts for on-chain verification
Security Considerations
- Always verify proofs on your backend before granting access
- Implement rate limiting to prevent abuse
- Consider additional risk factors beyond World ID verification
- Store verification status securely
- Use manual approval process for credit limits