AstraDAO Whitelist

Overview

The AstraDAOWhitelist contract is designed to manage the whitelist functionality for the Astra DAO ecosystem. This contract ensures that only verified and authorized accounts can participate in certain actions within the DAO. It leverages the PureFiContext for KYC verification and includes functionalities for the contract owner to manage the whitelist and blacklist.

Key Components

  1. Dependencies and Imports:

    • Ownable2StepUpgradeable: An upgradeable ownership management contract.

    • PureFiContext: A context for integrating with the PureFi verification system.

    • IAstraDAOWhitelist: The interface defining the whitelist functionality.

  2. Storage Variables:

    • mapping(address => bool) private whitelist: A mapping to store whitelisted addresses.

    • event Whitelisted(address indexed account): Event emitted when an account is whitelisted.

    • event Blacklisted(address indexed account): Event emitted when an account is blacklisted.

  3. Initialization:

    • initialize(address _verifier): Initializes the contract with the PureFi verifier address and sets up the ownership structure.

  4. Versioning:

    • version() public pure returns (uint32): Returns the version of the contract in Major.minor.internal format.

  5. Verifier Management:

    • setVerifier(address _verifier) external onlyOwner: Allows the owner to set the PureFi verifier address.

  6. Whitelist Management:

    • isWhitelisted(address _account) external view override returns (bool): Checks if an account is whitelisted.

    • whitelistWithKYCPurefi(bytes calldata _purefidata) external: Adds an account to the whitelist after passing KYC verification through PureFi.

    • whitelistByOwner(address _account) external onlyOwner: Allows the owner to add an account to the whitelist directly.

    • blacklist(address _account) external override onlyOwner: Allows the owner to remove an account from the whitelist (blacklist).

Detailed Functionality

  1. Initialization (initialize):

    • Sets up the initial PureFi verifier address.

    • Initializes ownership with Ownable2StepUpgradeable.

  2. Versioning (version):

    • Provides the current version of the contract for tracking and upgrade purposes.

  3. Verifier Management (setVerifier):

    • Allows the owner to update the PureFi verifier, ensuring that the contract can always use the latest verifier service.

  4. Whitelist Check (isWhitelisted):

    • Provides a way to check if a specific address is in the whitelist.

  5. KYC Whitelist (whitelistWithKYCPurefi):

    • Utilizes the PureFiContext for KYC verification.

    • Adds the sender to the whitelist if they pass KYC and are not already whitelisted.

  6. Owner Whitelist (whitelistByOwner):

    • Allows the contract owner to manually add an address to the whitelist without KYC.

  7. Blacklist (blacklist):

    • Allows the contract owner to remove an address from the whitelist, effectively blacklisting them.

Events

  • Whitelisted: Emitted when an account is added to the whitelist.

  • Blacklisted: Emitted when an account is removed from the whitelist.

Last updated