Overview
The NFTPassport contract manages the whitelist system for Fenines Network. Validators create referral keys to invite delegators, establishing a permissioned staking system with built-in attribution tracking.Contract Address:
0x0000000000000000000000000000000000001001 (System Contract)Core Concepts
Referral Keys
Unique cryptographic keys created by validators to invite delegators
Whitelist
Delegator must be whitelisted to a validator before staking
Multi-Use Codes
Optional promo-code style keys with usage limits
Direct Invites
Validators can directly whitelist addresses without keys
Workflow
1
Validator Creates Key
Validator generates a referral key (one-time or multi-use)
2
Delegator Uses Key
Delegator uses the key to get whitelisted
3
Delegator Can Stake
Now delegator is whitelisted and can stake to that validator
Validator Functions
createReferralKey
Create a one-time use referral key.bytes32
required
Unique key hash. Generate using
keccak256 of a random string or nonce.- Creates key with
isActive = true - Key can be used once
- Added to validator’s key list
- Increments
validatorActiveKeyCount
createReferralKeyWithExpiry
Create a one-time key with expiration.uint256
required
Number of blocks until expiration (e.g., 28800 = ~24 hours at 3s blocks)
createMultiUseKey
Create a multi-use referral code (like a promo code).uint256
required
Maximum number of uses (0 = unlimited)
uint256
Blocks until expiration (0 = never expires)
- Public promo codes for marketing campaigns
- Partner referral programs
- Community growth initiatives
- Event-specific invitations
revokeReferralKey
Deactivate a referral key.- Sets
isActive = false - Key can no longer be used
- Decrements
validatorActiveKeyCount - Does NOT affect already-whitelisted users
directInvite
Directly whitelist a delegator without requiring a key.- Delegator cannot be self (validator)
- Delegator not already whitelisted
- Contract not paused
- VIP delegators
- Partnership agreements
- Manual whitelist management
- Testing/development
batchDirectInvite
Whitelist multiple delegators at once.revokeWhitelist
Remove a delegator from whitelist.Delegator Functions
useReferralKey
Use a referral key to get whitelisted.- Key must exist
- Key must be active
- Key not expired (if expiry set)
- Not already whitelisted to this validator
- Usage limit not reached (for multi-use keys)
- Increments
usageCount - One-time keys: deactivated after use
- Delegator added to whitelist
- Sets
delegatorValidator[delegator] = validator
exitFromValidator
Self-remove from validator’s whitelist.Best practice: Unstake from FenineSystem first, then exit whitelist. Cannot re-enter without new referral key.
View Functions
isWhitelisted
Check if a delegator is whitelisted to a validator.This function is called internally by
FenineSystem.stakeToValidator() to verify permission.getKeyInfo
Get detailed information about a referral key.getValidatorKeys
Get all referral keys created by a validator.getValidatorStats
Get validator’s referral statistics.getWhitelistedBy
Get which validator whitelisted a delegator.Helper Functions
hashReferralCode
Generate key hash from human-readable string.generateKey
Generate deterministic key from validator address + nonce.Events
Integration Examples
- Validator: Create Campaign
- Delegator: Join with Code
- List All Whitelisted Users
Best Practices
Key Management
Key Management
- Generate keys off-chain using
keccak256to save gas - Use descriptive codes for multi-use keys (
SUMMER2024, not random hashes) - Store key-to-code mappings in your backend
- Revoke compromised keys immediately
- Set expiry on time-limited campaigns
For Validators
For Validators
- Use one-time keys for VIP delegators
- Use multi-use keys for public campaigns
- Monitor key usage via
getKeyInfo() - Track conversion: keys created → keys used → actual stakes
- Revoke keys if abused
For Delegators
For Delegators
- Save the original code, not the hash
- Check key validity before using (
getKeyInfo) - One delegator can be whitelisted to multiple validators
- Exit cleanly: unstake first, then call
exitFromValidator()
Security
Security
- Keys are NOT secrets - they’re invitation tokens
- Anyone with the code can use it (if multi-use or unused)
- Validators should distribute keys via trusted channels
- Monitor for unusual usage patterns
Admin Functions
setPaused
Pause/unpause the contract.- Cannot create keys
- Cannot use keys
- Cannot direct invite
- View functions still work
transferAdmin
Transfer admin role.Next Steps
FenineSystem Contract
Learn about staking and rewards
Tax Manager
Reward taxation system