Skip to content

Eryx0614/Newbie-friendly-Whitelist-smart-contract

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 

Repository files navigation

Newbie-friendly-Whitelist-smart-contract

Overview

The Token_WhiteList smart contract is designed to manage a whitelist for token minting processes, making it particularly useful for initial coin offerings (ICOs) or any scenario where controlled access to token minting is required. This contract is developed with simplicity and accessibility in mind, making it suitable for beginners in Ethereum smart contract development.

Features

  • Ownership Management: The contract uses an Ownable abstract contract to handle ownership, ensuring that only the owner can perform certain administrative tasks.
  • Whitelist Management: Administrators can add or remove addresses from the whitelist, controlling who can mint tokens.
  • Merkle Proof Integration: Incorporates Merkle proof verification for adding addresses to the whitelist, allowing for efficient on-chain verification without storing all whitelist addresses.
  • Open/Closed Minting State: The contract owner can toggle the minting state, allowing or disallowing mint operations based on external conditions or stages in the project.

Contract Functions

Constructor
  • Initializes the owner and sets up the initial whitelist addresses.
setMintWhitelist
  • Arguments: address target, bool state
  • Description: Adds or removes an address from the whitelist.
setIsOpen
  • Arguments: bool state
  • Description: Opens or closes the minting function to control when tokens can be minted.
setMerkleRoot
  • Arguments: bytes32 node
  • Description: Sets the root of the Merkle Tree used for validating entries against the whitelist using Merkle proofs.
verifyWhitelistNumber
  • Arguments: address target
  • Description: Checks if an address is on the whitelist.
getWhitelist
  • Returns: List of all addresses and their whitelisting status.
  • Description: Provides a complete list of addresses that have been added to or removed from the whitelist.
mintWhitelist
  • Arguments: bytes32 node, bytes32[] calldata _merkleProof
  • Description: Allows an address to add themselves to the whitelist if they provide a valid Merkle proof that they belong on the list.

How to Deploy

  1. Prepare Environment: Ensure you have Node.js and Truffle installed.
  2. Install Dependencies: Run npm install to install necessary dependencies like OpenZeppelin contracts.
  3. Configure Network: Set up your truffle-config.js to include the network you intend to deploy to (e.g., Rinkeby, Mainnet).
  4. Compile Contract: Execute truffle compile.
  5. Deploy Contract: Run truffle migrate --network <your_network> to deploy the contract.

Security Considerations

  • Ensure that the merkleRoot is securely generated and stored.
  • Regularly audit and test the contract's functions and permissions, especially those that alter the state of whitelisting and ownership.

License

This project is unlicensed and free for use and modification without limitation.

About

Token Whitelist Solidity Smart Contract

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published