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.
- 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.
- Initializes the owner and sets up the initial whitelist addresses.
- Arguments:
address target
,bool state
- Description: Adds or removes an address from the whitelist.
- Arguments:
bool state
- Description: Opens or closes the minting function to control when tokens can be minted.
- Arguments:
bytes32 node
- Description: Sets the root of the Merkle Tree used for validating entries against the whitelist using Merkle proofs.
- Arguments:
address target
- Description: Checks if an address is on the whitelist.
- 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.
- 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.
- Prepare Environment: Ensure you have
Node.js
andTruffle
installed. - Install Dependencies: Run
npm install
to install necessary dependencies like OpenZeppelin contracts. - Configure Network: Set up your
truffle-config.js
to include the network you intend to deploy to (e.g., Rinkeby, Mainnet). - Compile Contract: Execute
truffle compile
. - Deploy Contract: Run
truffle migrate --network <your_network>
to deploy the contract.
- 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.
This project is unlicensed and free for use and modification without limitation.