Address Contract Verified
Address
0xb86895ff3AAe878e8EBd9817AE30D57D47D880Cd
Balance
0 ETH
Nonce
1
Code Size
3951 bytes
Creator
0x79a1C0c7...6Cdf at tx 0x798d1d89...9475ad
Indexed Transactions
0
Contract Bytecode
3951 bytes
0x608060405234801561000f575f5ffd5b50600436106100a7575f3560e01c8063715018a61161006f578063715018a61461015f5780638da5cb5b14610169578063a5a865dc14610187578063c8f74bb8146101a5578063f2fde38b146101d5578063ff08603d146101f1576100a7565b80630808f3eb146100ab5780631f516741146100db578063231e96e5146100f757806331c160e41461012757806361e35ba514610143575b5f5ffd5b6100c560048036038101906100c09190610a9c565b610221565b6040516100d29190610ae1565b60405180910390f35b6100f560048036038101906100f09190610b47565b61029f565b005b610111600480360381019061010c9190610b97565b610333565b60405161011e9190610ae1565b60405180910390f35b610141600480360381019061013c9190610c08565b6103b9565b005b61015d60048036038101906101589190610cb9565b6104b3565b005b610167610592565b005b6101716105a5565b60405161017e9190610d39565b60405180910390f35b61018f6105cc565b60405161019c9190610ae1565b60405180910390f35b6101bf60048036038101906101ba9190610a9c565b610640565b6040516101cc9190610dc5565b60405180910390f35b6101ef60048036038101906101ea9190610a9c565b6107ed565b005b61020b60048036038101906102069190610dde565b610871565b6040516102189190610e45565b60405180910390f35b5f5f60015f61022f85610640565b600381111561024157610240610d52565b5b600381111561025357610252610d52565b5b81526020019081526020015f206040518060400160405290815f82015481526020016001820154815250509050805f01514210158015610297575080602001514211155b915050919050565b6102a76108d3565b8060025f8560038111156102be576102bd610d52565b5b60038111156102d0576102cf610d52565b5b81526020019081526020015f205f8473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f205f6101000a81548160ff021916908315150217905550505050565b5f60025f84600381111561034a57610349610d52565b5b600381111561035c5761035b610d52565b5b81526020019081526020015f205f8373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f205f9054906101000a900460ff16905092915050565b6103c16108d3565b818111610403576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016103fa90610eb8565b60405180910390fd5b60405180604001604052808381526020018281525060015f85600381111561042e5761042d610d52565b5b60038111156104405761043f610d52565b5b81526020019081526020015f205f820151815f01556020820151816001015590505082600381111561047557610474610d52565b5b7f661124c8826d75343ee919baad251f50d4348b31f86cd88dabc18a6d96e351bd83836040516104a6929190610ee5565b60405180910390a2505050565b6104bb6108d3565b5f60025f8660038111156104d2576104d1610d52565b5b60038111156104e4576104e3610d52565b5b81526020019081526020015f2090505f8484905090505f5b818110156105895783835f88888581811061051a57610519610f0c565b5b905060200201602081019061052f9190610a9c565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f205f6101000a81548160ff0219169083151502179055508060010190506104fc565b50505050505050565b61059a6108d3565b6105a35f61095a565b565b5f5f5f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b5f5f60015f5f60038111156105e4576105e3610d52565b5b60038111156105f6576105f5610d52565b5b81526020019081526020015f206040518060400160405290815f82015481526020016001820154815250509050805f0151421015801561063a575080602001514211155b91505090565b5f60025f60038081111561065757610656610d52565b5b600381111561066957610668610d52565b5b81526020019081526020015f205f8373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f205f9054906101000a900460ff16156106cc57600390506107e8565b60025f600260038111156106e3576106e2610d52565b5b60038111156106f5576106f4610d52565b5b81526020019081526020015f205f8373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f205f9054906101000a900460ff161561075857600290506107e8565b60025f6001600381111561076f5761076e610d52565b5b600381111561078157610780610d52565b5b81526020019081526020015f205f8373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f205f9054906101000a900460ff16156107e457600190506107e8565b5f90505b919050565b6107f56108d3565b5f73ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1603610865575f6040517f1e4fbdf700000000000000000000000000000000000000000000000000000000815260040161085c9190610d39565b60405180910390fd5b61086e8161095a565b50565b610879610a22565b60015f83600381111561088f5761088e610d52565b5b60038111156108a1576108a0610d52565b5b81526020019081526020015f206040518060400160405290815f82015481526020016001820154815250509050919050565b6108db610a1b565b73ffffffffffffffffffffffffffffffffffffffff166108f96105a5565b73ffffffffffffffffffffffffffffffffffffffff16146109585761091c610a1b565b6040517f118cdaa700000000000000000000000000000000000000000000000000000000815260040161094f9190610d39565b60405180910390fd5b565b5f5f5f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050815f5f6101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508173ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a35050565b5f33905090565b60405180604001604052805f81526020015f81525090565b5f5ffd5b5f5ffd5b5f73ffffffffffffffffffffffffffffffffffffffff82169050919050565b5f610a6b82610a42565b9050919050565b610a7b81610a61565b8114610a85575f5ffd5b50565b5f81359050610a9681610a72565b92915050565b5f60208284031215610ab157610ab0610a3a565b5b5f610abe84828501610a88565b91505092915050565b5f8115159050919050565b610adb81610ac7565b82525050565b5f602082019050610af45f830184610ad2565b92915050565b60048110610b06575f5ffd5b50565b5f81359050610b1781610afa565b92915050565b610b2681610ac7565b8114610b30575f5ffd5b50565b5f81359050610b4181610b1d565b92915050565b5f5f5f60608486031215610b5e57610b5d610a3a565b5b5f610b6b86828701610b09565b9350506020610b7c86828701610a88565b9250506040610b8d86828701610b33565b9150509250925092565b5f5f60408385031215610bad57610bac610a3a565b5b5f610bba85828601610b09565b9250506020610bcb85828601610a88565b9150509250929050565b5f819050919050565b610be781610bd5565b8114610bf1575f5ffd5b50565b5f81359050610c0281610bde565b92915050565b5f5f5f60608486031215610c1f57610c1e610a3a565b5b5f610c2c86828701610b09565b9350506020610c3d86828701610bf4565b9250506040610c4e86828701610bf4565b9150509250925092565b5f5ffd5b5f5ffd5b5f5ffd5b5f5f83601f840112610c7957610c78610c58565b5b8235905067ffffffffffffffff811115610c9657610c95610c5c565b5b602083019150836020820283011115610cb257610cb1610c60565b5b9250929050565b5f5f5f5f60608587031215610cd157610cd0610a3a565b5b5f610cde87828801610b09565b945050602085013567ffffffffffffffff811115610cff57610cfe610a3e565b5b610d0b87828801610c64565b93509350506040610d1e87828801610b33565b91505092959194509250565b610d3381610a61565b82525050565b5f602082019050610d4c5f830184610d2a565b92915050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52602160045260245ffd5b60048110610d9057610d8f610d52565b5b50565b5f819050610da082610d7f565b919050565b5f610daf82610d93565b9050919050565b610dbf81610da5565b82525050565b5f602082019050610dd85f830184610db6565b92915050565b5f60208284031215610df357610df2610a3a565b5b5f610e0084828501610b09565b91505092915050565b610e1281610bd5565b82525050565b604082015f820151610e2c5f850182610e09565b506020820151610e3f6020850182610e09565b50505050565b5f604082019050610e585f830184610e18565b92915050565b5f82825260208201905092915050565b7f496e76616c69642074696d652072616e676500000000000000000000000000005f82015250565b5f610ea2601283610e5e565b9150610ead82610e6e565b602082019050919050565b5f6020820190508181035f830152610ecf81610e96565b9050919050565b610edf81610bd5565b82525050565b5f604082019050610ef85f830185610ed6565b610f056020830184610ed6565b9392505050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52603260045260245ffdfea26469706673582212203f13e149e18221ce42006fecf9977127abf4be5c2a04b5e3aaa99f4066e7636d64736f6c634300081b0033
Verified Source Code Full Match
Compiler: v0.8.27+commit.40a35a09
EVM: cancun
Optimization: No
WhitelistManager.sol 165 lines
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.20;
import {Ownable} from "@openzeppelin/[email protected]/access/Ownable.sol";
/**
* @title WhitelistManager
* @author XeonNG
* @notice Stores sale‑phase parameters and whitelists for four tiers
* (Public, Whitelist, Private, Preferred). A separate “sale” contract can
* query this manager to decide whether a buyer is allowed.
*/
contract WhitelistManager is Ownable {
/* --------------------------------------------------------------------- */
/* Data Types */
/* --------------------------------------------------------------------- */
enum SaleType {
Public,
Whitelist,
Private,
Preferred
}
struct SaleConfig {
uint256 startTime; // Unix timestamp (seconds)
uint256 endTime; // Unix timestamp (seconds)
}
/* --------------------------------------------------------------------- */
/* State Vars */
/* --------------------------------------------------------------------- */
/// @dev Sale params by tier
mapping(SaleType => SaleConfig) private _configs;
/// @dev Whitelist status by tier → user
mapping(SaleType => mapping(address => bool)) private _isWhitelisted;
/* --------------------------------------------------------------------- */
/* Events */
/* --------------------------------------------------------------------- */
event ConfigUpdated(
SaleType indexed saleType,
uint256 startTime,
uint256 endTime
);
/* --------------------------------------------------------------------- */
/* Constructor */
/* --------------------------------------------------------------------- */
constructor(address initialOwner) Ownable(initialOwner) {}
/* --------------------------------------------------------------------- */
/* Admin Logic */
/* --------------------------------------------------------------------- */
/**
* @notice Set the time window and quantity limits for a sale tier.
* @param saleType Tier being updated.
* @param startTime Inclusive Unix timestamp.
* @param endTime Inclusive Unix timestamp.
*/
function setConfig(
SaleType saleType,
uint256 startTime,
uint256 endTime
) external onlyOwner {
require(endTime > startTime, "Invalid time range");
_configs[saleType] = SaleConfig({
startTime: startTime,
endTime: endTime
});
emit ConfigUpdated(saleType, startTime, endTime);
}
/**
* @notice Add or remove a single wallet from a tier’s whitelist.
* @dev For batch updates see {setWhitelistedBatch}.
*/
function setWhitelisted(
SaleType saleType,
address account,
bool allowed
) external onlyOwner {
_isWhitelisted[saleType][account] = allowed;
}
/**
* @notice Gas‑efficient batch whitelist update.
* @param saleType Tier to update.
* @param accounts Wallets to update.
* @param allowed true to whitelist, false to remove.
*/
function setWhitelistedBatch(
SaleType saleType,
address[] calldata accounts,
bool allowed
) external onlyOwner {
mapping(address => bool) storage list = _isWhitelisted[saleType];
uint256 len = accounts.length;
for (uint256 i; i < len; ++i) {
list[accounts[i]] = allowed;
}
}
/* --------------------------------------------------------------------- */
/* Read‑only Helpers */
/* --------------------------------------------------------------------- */
/**
* @notice Return the sale tier a wallet belongs to.
* @dev Preferred > Private > Whitelist > Public precedence.
*/
function tierOf(address user) public view returns (SaleType tier) {
if (_isWhitelisted[SaleType.Preferred][user]) return SaleType.Preferred;
if (_isWhitelisted[SaleType.Private][user]) return SaleType.Private;
if (_isWhitelisted[SaleType.Whitelist][user]) return SaleType.Whitelist;
return SaleType.Public;
}
/**
* @notice Quick check usable by a sale contract.
* @param user Wallet to validate.
* @return True if current block is within that user’s tier window.
*/
function canBuy(address user) external view returns (bool) {
SaleConfig memory cfg = _configs[tierOf(user)];
return
block.timestamp >= cfg.startTime && block.timestamp <= cfg.endTime;
}
/**
* @notice Get the full config for a tier.
*/
function getConfig(
SaleType saleType
) external view returns (SaleConfig memory) {
return _configs[saleType];
}
/**
* @notice Check explicit whitelist status.
*/
function isWhitelisted(
SaleType saleType,
address user
) external view returns (bool) {
return _isWhitelisted[saleType][user];
}
/**
* @notice Check if the current block is within the Public sale window.
*/
function isPublicSale() external view returns (bool) {
SaleConfig memory cfg = _configs[SaleType.Public];
return
block.timestamp >= cfg.startTime && block.timestamp <= cfg.endTime;
}
}
Ownable.sol 100 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (access/Ownable.sol)
pragma solidity ^0.8.20;
import {Context} from "../utils/Context.sol";
/**
* @dev Contract module which provides a basic access control mechanism, where
* there is an account (an owner) that can be granted exclusive access to
* specific functions.
*
* The initial owner is set to the address provided by the deployer. This can
* later be changed with {transferOwnership}.
*
* This module is used through inheritance. It will make available the modifier
* `onlyOwner`, which can be applied to your functions to restrict their use to
* the owner.
*/
abstract contract Ownable is Context {
address private _owner;
/**
* @dev The caller account is not authorized to perform an operation.
*/
error OwnableUnauthorizedAccount(address account);
/**
* @dev The owner is not a valid owner account. (eg. `address(0)`)
*/
error OwnableInvalidOwner(address owner);
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev Initializes the contract setting the address provided by the deployer as the initial owner.
*/
constructor(address initialOwner) {
if (initialOwner == address(0)) {
revert OwnableInvalidOwner(address(0));
}
_transferOwnership(initialOwner);
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
_checkOwner();
_;
}
/**
* @dev Returns the address of the current owner.
*/
function owner() public view virtual returns (address) {
return _owner;
}
/**
* @dev Throws if the sender is not the owner.
*/
function _checkOwner() internal view virtual {
if (owner() != _msgSender()) {
revert OwnableUnauthorizedAccount(_msgSender());
}
}
/**
* @dev Leaves the contract without owner. It will not be possible to call
* `onlyOwner` functions. Can only be called by the current owner.
*
* NOTE: Renouncing ownership will leave the contract without an owner,
* thereby disabling any functionality that is only available to the owner.
*/
function renounceOwnership() public virtual onlyOwner {
_transferOwnership(address(0));
}
/**
* @dev Transfers ownership of the contract to a new account (`newOwner`).
* Can only be called by the current owner.
*/
function transferOwnership(address newOwner) public virtual onlyOwner {
if (newOwner == address(0)) {
revert OwnableInvalidOwner(address(0));
}
_transferOwnership(newOwner);
}
/**
* @dev Transfers ownership of the contract to a new account (`newOwner`).
* Internal function without access restriction.
*/
function _transferOwnership(address newOwner) internal virtual {
address oldOwner = _owner;
_owner = newOwner;
emit OwnershipTransferred(oldOwner, newOwner);
}
}
Context.sol 28 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.1) (utils/Context.sol)
pragma solidity ^0.8.20;
/**
* @dev Provides information about the current execution context, including the
* sender of the transaction and its data. While these are generally available
* via msg.sender and msg.data, they should not be accessed in such a direct
* manner, since when dealing with meta-transactions the account sending and
* paying for execution may not be the actual sender (as far as an application
* is concerned).
*
* This contract is only required for intermediate, library-like contracts.
*/
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
function _msgData() internal view virtual returns (bytes calldata) {
return msg.data;
}
function _contextSuffixLength() internal view virtual returns (uint256) {
return 0;
}
}
Read Contract
canBuy 0x0808f3eb → bool
getConfig 0xff08603d → tuple
isPublicSale 0xa5a865dc → bool
isWhitelisted 0x231e96e5 → bool
owner 0x8da5cb5b → address
tierOf 0xc8f74bb8 → uint8
Write Contract 5 functions
These functions modify contract state and require a wallet transaction to execute.
renounceOwnership 0x715018a6
No parameters
setConfig 0x31c160e4
uint8 saleType
uint256 startTime
uint256 endTime
setWhitelisted 0x1f516741
uint8 saleType
address account
bool allowed
setWhitelistedBatch 0x61e35ba5
uint8 saleType
address[] accounts
bool allowed
transferOwnership 0xf2fde38b
address newOwner
Recent Transactions
No transactions found for this address