Life Achievement NFT

What it does:
Allows users to mint NFTs representing personal achievements, milestones, or certifications, creating a verifiable digital record of accomplishments.

Why it matters:
Ensures authenticity, prevents falsification of achievements, enables social recognition, and allows monetization or sharing of accomplishments.

How it works:

  • Users mint NFTs for specific achievements with metadata (title, description, date, proof)

  • NFTs can be transferred, displayed, or showcased as part of a personal portfolio

  • Achievements can be verified by oracles, institutions, or peers

  • Integrates with Reputation-Based Access Control, Skill-for-Skill Exchange, or Play-to-Earn Reward Engine

  • Dashboards show minted achievements, verifications, and earned recognition

  • NFTs can unlock perks, access, or token rewards

      // SPDX-License-Identifier: MIT
pragma solidity ^0.8.20;

import "@openzeppelin/contracts/token/ERC721/ERC721.sol";
import "@openzeppelin/contracts/access/Ownable.sol";

/**
 * @title LifeAchievementNFT
 * @author Nam
 * @notice Mint and manage NFTs representing personal achievements
 */
contract LifeAchievementNFT is ERC721, Ownable {

    struct Achievement {
        string title;
        string description;
        uint256 date; // timestamp of achievement
        string proofURI; // IPFS or external link
        bool verified;
    }

    mapping(uint256 => Achievement) public achievements;
    uint256 public achievementCount;

    mapping(address => bool) public authorizedVerifiers;

    // -------------------- EVENTS --------------------

    event AchievementMinted(uint256 indexed tokenId, address owner, string title);
    event AchievementVerified(uint256 indexed tokenId, address verifier);

    // -------------------- VERIFIER MANAGEMENT --------------------

    function authorizeVerifier(address _verifier) external onlyOwner {
        authorizedVerifiers[_verifier] = true;
    }

    function revokeVerifier(address _verifier) external onlyOwner {
        authorizedVerifiers[_verifier] = false;
    }

    modifier onlyVerifier() {
        require(authorizedVerifiers[msg.sender], "Not authorized verifier");
        _;
    }

    // -------------------- NFT MINTING --------------------

    constructor() ERC721("LifeAchievementNFT", "LIFE") {}

    function mintAchievement(string calldata _title, string calldata _description, uint256 _date, string calldata _proofURI) external {
        achievementCount += 1;
        uint256 newTokenId = achievementCount;

        achievements[newTokenId] = Achievement({
            title: _title,
            description: _description,
            date: _date,
            proofURI: _proofURI,
            verified: false
        });

        _mint(msg.sender, newTokenId);

        emit AchievementMinted(newTokenId, msg.sender, _title);
    }

    // -------------------- VERIFICATION --------------------

    function verifyAchievement(uint256 _tokenId) external onlyVerifier {
        Achievement storage a = achievements[_tokenId];
        require(!a.verified, "Already verified");

        a.verified = true;

        emit AchievementVerified(_tokenId, msg.sender);
    }

    // -------------------- VIEW FUNCTIONS --------------------

    function getAchievement(uint256 _tokenId) external view returns (Achievement memory) {
        return achievements[_tokenId];
    }

    function tokenURI(uint256 tokenId) public view override returns (string memory) {
        return achievements[tokenId].proofURI;
    }
}