- LibBadges.sol - Badge & evolution system
- LibAISubdomains.sol - AI subdomain management & capabilities
- LibMetadata.sol (UPDATED) - Now includes badge/evolution rendering
- LibMinting.sol (UPDATED) - Awards badges automatically
- AppStorage.sol (UPDATED) - Added badge/evolution storage
- AEDAI.sol - New module for AI functionality
# Replace these in your contracts/ directory:
cp LibBadges.sol contracts/libraries/
cp LibAISubdomains.sol contracts/libraries/
cp LibMetadata.sol contracts/libraries/ # REPLACE existing
cp LibMinting.sol contracts/libraries/ # REPLACE existing
cp AppStorage.sol contracts/core/ # REPLACE existing
cp AEDAI.sol contracts/modules/ai/ # NEW directoryAdd these imports:
import "./libraries/LibBadges.sol";
import "./libraries/LibAISubdomains.sol";Deploy AEDAI.sol as a separate contract, then add it to your existing system via your module registry.
Your existing metadata server should automatically work since the evolution data is in the on-chain tokenURI. But you can add specific routes if needed:
// In metadata-server.js, add evolution data to response:
const evolutionLevel = await contract.getEvolutionLevel(tokenId);
const badges = await contract.getTokenBadges(tokenId);- Domains start at Level 0
- Each badge awards evolution points (decorative = 1 point, capability = 2 points)
- Frame color and thickness change based on level:
- Level 0: Neon green (#39FF14)
- Level 1-4: Cyan (#00F6FF)
- Level 5-9: Pink (#FF2E92)
- Level 10-14: Purple (#9D4EDD)
- Level 15+: Gold (#FFD700)
Decorative Badges (auto-awarded):
first_subdomain- Create your first subdomainsubdomain_veteran- Create 5 subdomainssubdomain_master- Create 10 subdomains
AI Capability Badges (purchased):
ai_vision- 0.2 ETH - Unlocks vision processingai_communication- 0.15 ETH - Enables agent-to-agent messagingai_memory- 0.25 ETH - Memory expansionai_reasoning- 0.3 ETH - Enhanced reasoning
Users can create AI subdomains like:
echo.sigma.alsania(GPT-4)aegis.sigma.alsania(DeepSeek)claude.sigma.alsania(Claude)
Restrictions:
- One AI subdomain per model type per parent
- Must purchase separately from regular subdomains (0.5 ETH base price)
- Stays in user's wallet (non-transferable/soulbound concept via ownership)
// User calls on AEDAI module:
aedAI.createAISubdomain{value: 0.5 ether}(
"echo", // label
"sigma.alsania", // parent domain
"gpt-4" // model type
);// User purchases vision for their AI subdomain:
uint256 echoTokenId = aedAI.getAISubdomain("sigma.alsania", "gpt-4");
aedAI.purchaseAICapability{value: 0.2 ether}(
echoTokenId,
"vision"
);// Admin awards custom badge:
aedAI.awardBadge(
tokenId,
"community_champion",
abi.encodePacked("Awarded for community contributions"),
false // not a capability badge
);const level = await contract.getEvolutionLevel(tokenId);
// Show level badge in UIconst badges = await contract.getTokenBadges(tokenId);
badges.forEach(badge => {
console.log(`${badge.badgeType} - Awarded: ${new Date(badge.awardedAt * 1000)}`);
});const hasVision = await aedAI.hasAICapability(tokenId, "vision");
// Enable/disable vision features in UI based on this- Deploy updated AppStorage
- Deploy LibBadges
- Deploy LibAISubdomains
- Deploy updated LibMetadata
- Deploy updated LibMinting
- Deploy AEDAI module
- Register AEDAI in your module registry
- Test domain registration (should work as before)
- Test subdomain creation (should auto-award badges)
- Test AI subdomain creation
- Test AI capability purchase
- Check tokenURI renders with badges/evolution
- Verify one AI sub per model restriction works
- Create AI subdomain: ~250k gas
- Purchase capability: ~180k gas
- Auto badge award (on subdomain create): +~80k gas
- Evolution SVG rendering: ~120k gas
After integration, you can:
- Add more badge types (custom achievements, events, milestones)
- Create agent-to-agent messaging using the communication capability
- Build a badge marketplace
- Add evolution-based unlocks (Level 10 = free subdomain, etc.)
- Implement memory storage tied to the memory capability badge
Check if badges are rendering:
// Get badge SVG for visual confirmation
string memory svg = LibBadges.getBadgeSVG(tokenId);Verify evolution level calculation:
// Should increase with each badge
uint256 level = LibBadges.getEvolutionLevel(tokenId);