POL Price: $0.592253 (-3.70%)

Contract Diff Checker

Contract Name:
VCITY_KYC

Contract Source Code:

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

contract VCITY_KYC {
    
    address private owner;
    mapping(uint => bool) private KYCCompleted; // 仅存储用户的KYC完成状态
    uint private userCount; // 用户计数器

    constructor() {
        owner = msg.sender;
        userCount = 0;
    }

    // 批量添加KYC用户
    function Add_KYC_Users(uint[] memory userIDs) public {
        require(msg.sender == owner, "Only owner can add KYC users"); // 确保只有合约所有者可以添加用户

        for(uint i = 0; i < userIDs.length; i++) {
            uint _id = userIDs[i];
            if (!KYCCompleted[_id]) { // 检查用户是否已经完成KYC
                KYCCompleted[_id] = true;
                userCount++;
                emit KYC_User(_id, block.timestamp); // 触发事件
            }
        }
    }

    // 查询特定用户的KYC状态
    function KYC(uint userID) public view returns (string memory) {
        return KYCCompleted[userID] ? unicode"KYC已通过 / KYC Passed" : unicode"KYC未通过 / KYC Failed";
    }    

    // 查看总用户数量
    function Total() public view returns (uint) {
        return userCount;
    }

    event KYC_User(uint userID, uint kycTime);
}

Please enter a contract address above to load the contract details and source code.

Context size (optional):