ETH Price: $3,394.41 (+6.16%)
Gas: 29 Gwei

Contract

0x481dacbf63363d142d761C6DE51da05F10A2b70D
 

Overview

ETH Balance

0 ETH

Eth Value

$0.00

Token Holdings

More Info

Private Name Tags

TokenTracker

Multichain Info

No addresses found
Transaction Hash
Method
Block
From
To
Claim Tokens198544662024-05-12 14:14:2364 days ago1715523263IN
0x481dacbf...F10A2b70D
0 ETH0.000450486.19157163
Claim Tokens197187502024-04-23 14:40:5983 days ago1713883259IN
0x481dacbf...F10A2b70D
0 ETH0.0022141924.64108046
Claim Tokens195419742024-03-29 20:17:23107 days ago1711743443IN
0x481dacbf...F10A2b70D
0 ETH0.0024526427.29469815
Claim Tokens195419692024-03-29 20:16:23107 days ago1711743383IN
0x481dacbf...F10A2b70D
0 ETH0.0025920628.84627542
Claim Tokens195419612024-03-29 20:14:47107 days ago1711743287IN
0x481dacbf...F10A2b70D
0 ETH0.0025982228.91482173
Claim Tokens195419592024-03-29 20:14:23107 days ago1711743263IN
0x481dacbf...F10A2b70D
0 ETH0.0026213129.17172786
Claim Tokens195419572024-03-29 20:13:59107 days ago1711743239IN
0x481dacbf...F10A2b70D
0 ETH0.0027324130.40819283
Claim Tokens195240082024-03-27 6:50:35110 days ago1711522235IN
0x481dacbf...F10A2b70D
0 ETH0.0020828623.17948745
Claim Tokens195145912024-03-25 22:56:59111 days ago1711407419IN
0x481dacbf...F10A2b70D
0 ETH0.001998627.46927683
Claim Tokens195145212024-03-25 22:42:59111 days ago1711406579IN
0x481dacbf...F10A2b70D
0 ETH0.0014907126.78353422
Claim Tokens195135432024-03-25 19:25:11111 days ago1711394711IN
0x481dacbf...F10A2b70D
0 ETH0.001678630.15918818
Claim Tokens195051542024-03-24 15:00:35113 days ago1711292435IN
0x481dacbf...F10A2b70D
0 ETH0.0014816520.36413335
Claim Tokens195003612024-03-23 22:48:23113 days ago1711234103IN
0x481dacbf...F10A2b70D
0 ETH0.0008857415.91408706
Claim Tokens194982692024-03-23 15:43:47114 days ago1711208627IN
0x481dacbf...F10A2b70D
0 ETH0.00150320.65753086
Claim Tokens194858212024-03-21 21:52:11115 days ago1711057931IN
0x481dacbf...F10A2b70D
0 ETH0.0022760625.32957868
Claim Tokens194780942024-03-20 19:49:23116 days ago1710964163IN
0x481dacbf...F10A2b70D
0 ETH0.0027842238.26687451
Claim Tokens194780892024-03-20 19:48:23116 days ago1710964103IN
0x481dacbf...F10A2b70D
0 ETH0.0024632833.85583466
Claim Tokens194780832024-03-20 19:47:11116 days ago1710964031IN
0x481dacbf...F10A2b70D
0 ETH0.0029525432.85791849
Claim Tokens194780722024-03-20 19:44:59116 days ago1710963899IN
0x481dacbf...F10A2b70D
0 ETH0.0034134337.98703799
Claim Tokens194707592024-03-19 19:05:11117 days ago1710875111IN
0x481dacbf...F10A2b70D
0 ETH0.0031125634.63868723
Claim Tokens194707532024-03-19 19:03:59117 days ago1710875039IN
0x481dacbf...F10A2b70D
0 ETH0.0032277535.92059315
Claim Tokens194668382024-03-19 5:53:11118 days ago1710827591IN
0x481dacbf...F10A2b70D
0 ETH0.0022908425.49403247
Claim Tokens194626742024-03-18 15:50:23119 days ago1710777023IN
0x481dacbf...F10A2b70D
0 ETH0.0025693735.31391887
Claim Tokens194581902024-03-18 0:42:11119 days ago1710722531IN
0x481dacbf...F10A2b70D
0 ETH0.002053828.2278351
Claim Tokens194573412024-03-17 21:49:47119 days ago1710712187IN
0x481dacbf...F10A2b70D
0 ETH0.0023700226.37520089
View all transactions

Latest 2 internal transactions

Advanced mode:
Parent Transaction Hash Block From To
192852562024-02-22 19:33:47143 days ago1708630427
0x481dacbf...F10A2b70D
26.99999991 ETH
192471062024-02-17 10:52:59149 days ago1708167179  Contract Creation0 ETH
Loading...
Loading

Similar Match Source Code
This contract matches the deployed Bytecode of the Source Code for Contract 0x116Bb715...Ee06f9C85
The constructor portion of the code might be different and could alter the actual behaviour of the contract

Contract Name:
Launchpad

Compiler Version
v0.8.23+commit.f704f362

Optimization Enabled:
Yes with 3000 runs

Other Settings:
paris EvmVersion
File 1 of 13 : Launchpad.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.20;

import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/token/ERC20/ERC20.sol";
import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import "@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol";
import "./interfaces/ILaunchpadFactory.sol";
import {MerkleProof} from "@openzeppelin/contracts/utils/cryptography/MerkleProof.sol";
import {MainLaunchpadInfo} from "./interfaces/ILaunchpadFactory.sol";
import "./constants/Errors.sol";



contract Launchpad {
    using SafeERC20 for IERC20;
    
    event TokensPurchased(address indexed _token, address indexed buyer, uint256 amount);
    event TokensClaimed(address indexed _token, address indexed buyer, uint256 amount);
    event ethPricePerTokenUpdated(address indexed _token, uint256 newEthPricePerToken);
    event WhitelistUpdated(uint256 wlBlockNumber, uint256 wlMinBalance, bytes32 wlRoot);
    event TokenHardCapUpdated(address indexed _token, uint256 newTokenHardCap);
    event OperatorTransferred(address indexed previousOperator, address indexed newOperator);
    event VestingDurationUpdated(uint256 newVestingDuration);
    modifier onlyOperator() {
        if (msg.sender != operator) revert OperatorZeroAddress();
        _;
    }

    address public operator;
    string public name;

    IERC20 public immutable token;
    uint256 public immutable decimals;
    uint256 public immutable tokenUnit;

    address public immutable factory;

    uint256 public ethPricePerToken;
    uint256 public tokenHardCap;

    uint256 public minTokenBuy;
    uint256 public maxTokenBuy;

    uint256 public startDate;
    uint256 public endDate;

    uint256 public protocolFee;
    address public protocolFeeAddress;

    uint256 public releaseDelay;
    uint256 public vestingDuration;

    mapping (address => uint256) public purchasedAmount;
    mapping (address => uint256) public claimedAmount;
    uint256 public totalPurchasedAmount;

    uint256 public wlBlockNumber;
    uint256 public wlMinBalance;
    bytes32 public wlRoot;

    constructor(
        MainLaunchpadInfo memory _info,
        uint256 _protocolFee,
        address _protocolFeeAddress,
        address _operator,
        address _factory
    ) {

        name = _info.name;
        factory = _factory;

        if (_info.ethPricePerToken == 0) revert InvalidEthPrice();
        if (_info.minTokenBuy == 0) revert InvalidMinTokenBuy();
        if (_info.maxTokenBuy == 0) revert InvalidMaxTokenBuy();
        if (_info.startDate <= block.timestamp) revert InvalidStartDate();
        if (_info.endDate <= _info.startDate) revert InvalidEndDate();
        if (_operator == address(0)) revert ZeroAddress();

        operator = _operator;

        token = IERC20(_info.token);
        decimals = IERC20Metadata(_info.token).decimals();
        tokenUnit = 10**decimals;

        ethPricePerToken = _info.ethPricePerToken;
        minTokenBuy = _info.minTokenBuy;
        maxTokenBuy = _info.maxTokenBuy;

        startDate = _info.startDate;
        endDate = _info.endDate;

        protocolFee = _protocolFee;
        protocolFeeAddress = _protocolFeeAddress;

        releaseDelay = _info.releaseDelay;
        vestingDuration = _info.vestingDuration;

    }

    /**
     * @return true if the launchpad has started
     */

    function isStarted() public view returns (bool) {
        return block.timestamp >= startDate;
    }

    /**
     * @return true if the launchpad has ended
     */

    function isEnded() public view returns (bool) {
        return block.timestamp >= endDate;
    }

    /**
     * @return true if the tokens in the launchpad are claimable
     */

    function isClaimable() public view returns (bool) {
        return block.timestamp >= endDate + releaseDelay;
    }

    /**
     * 
     * @param newOperator new operator address
     * This function is used to transfer ownership of the launchpad to another address.
     */

    function transferOperatorOwnership(address newOperator) external onlyOperator {
        if (newOperator == address(0)) revert ZeroAddress();
        if (newOperator == operator) revert SameOperator();

        emit OperatorTransferred(operator, newOperator);
        operator = newOperator;
    }

    /**
     * @param _wlBlockNumber block number of the whitelist's snapshot
     * @param _wlMinBalance min balance threshold of the whitelist
     * @param _wlMinBalance merkle tree root of the whitelist
     *
     * When set, the buyTokens() will require a proof matching the buyer address and this root.
     */
    function updateWhitelist(uint256 _wlBlockNumber, uint256 _wlMinBalance, bytes32 _wlRoot) external onlyOperator {
        wlBlockNumber = _wlBlockNumber;
        wlMinBalance = _wlMinBalance;
        wlRoot = _wlRoot;

        emit WhitelistUpdated(wlBlockNumber, wlMinBalance, wlRoot);
    }

    /**
     * 
     * @param _tokenHardCapIncrement amount of tokens to increase the hard cap by
     * This function is used to increase the hard cap of the launchpad.
     * The operator can increase the hard cap by any amount of tokens.
     */

    function increaseHardCap(uint256 _tokenHardCapIncrement) external onlyOperator {
        if (_tokenHardCapIncrement == 0) revert InvalidTokenHardCapIncrement();

        uint256 _feeAmount = _tokenHardCapIncrement * protocolFee / 10000;
        if (_feeAmount > 0) {
            token.safeTransferFrom(msg.sender, protocolFeeAddress, _feeAmount);
            _tokenHardCapIncrement -= _feeAmount;
        }

        IERC20(token).safeTransferFrom(msg.sender, address(this), _tokenHardCapIncrement);
        tokenHardCap += _tokenHardCapIncrement;
        emit TokenHardCapUpdated(address(token), tokenHardCap);
    }

    /**
     * 
     * @param _ethPricePerToken new ETH price per token
     * This function is used to change the ETH price per token.
     */

    function updateEthPricePerToken(uint256 _ethPricePerToken) external onlyOperator {
        if (_ethPricePerToken == 0) revert InvalidEthPrice();
        emit ethPricePerTokenUpdated(address(token), _ethPricePerToken);
        ethPricePerToken = _ethPricePerToken;
    }

    /**
     * 
     * @param ethAmount amount of ETH
     * @return the amount of tokens that the user will receive for the given amount of ETH
     * This function is used to calculate the amount of tokens that the user will receive for the given amount of ETH.
     */

    function ethToToken(uint256 ethAmount) public view returns (uint256) {
        return ethAmount * tokenUnit / ethPricePerToken;
    }

    /**
     * @param proof the proof in case this launchpad has a whitelist, empty otherwise.
     * Allows the user to buy tokens during the launchpad.
     */
    function buyTokens(bytes32[] calldata proof) external payable {
        if (!isStarted()) revert NotStarted();
        if (isEnded()) revert Ended();
        if (msg.value == 0) revert InvalidBuyAmount();


        // check proof validity when a whitelist has been set.
        if (wlBlockNumber > 0 && !MerkleProof.verifyCalldata(
            proof, wlRoot, keccak256(bytes.concat(keccak256(abi.encode(msg.sender))))
        )) {
            revert InvalidWhitelistProof();
        }

        uint256 _tokensAmount = ethToToken(msg.value);
        if (_tokensAmount < minTokenBuy) {
            revert AmountTooLow();
        }

        if (purchasedAmount[msg.sender] + _tokensAmount > maxTokenBuy) {
            revert AmountExceedsMaxTokenAmount();
        }

        if (totalPurchasedAmount + _tokensAmount > tokenHardCap) {
            revert AmountExceedsHardCap();
        }

        purchasedAmount[msg.sender] += _tokensAmount;
        totalPurchasedAmount += _tokensAmount;

        emit TokensPurchased(address(token), msg.sender, _tokensAmount);
    }

    /**
     * 
     * @param _address address of the user
     * @return the amount of tokens that the user can claim
     * This function is used to calculate the amount of tokens that the user can claim.
     * The tokens are released linearly over the vesting duration.
     */

    function claimableAmount(address _address) public view returns (uint256) {
        if (!isClaimable()) {
            return 0;
        }

        uint256 _purchasedAmount = purchasedAmount[_address];
        uint256 _claimedAmount = claimedAmount[_address];
        uint256 _netAmount = _purchasedAmount - _claimedAmount;

        if (vestingDuration == 0 || (block.timestamp >= endDate + releaseDelay + vestingDuration)) {
            return _netAmount;
        }

        uint256 _unlockedAmount = _purchasedAmount * (block.timestamp - endDate - releaseDelay) / vestingDuration;

        if (_unlockedAmount > _purchasedAmount) {
            _unlockedAmount = _purchasedAmount;
        }

        _unlockedAmount -= _claimedAmount;
        
        return _unlockedAmount;
    }

    /**
     * Allows the user to claim their tokens after the launchpad has ended.
     * The tokens are released linearly over the vesting duration.
     */

    function claimTokens() external {
        if (!isClaimable()) {
            revert NotClaimable();
        }
        if (purchasedAmount[msg.sender] == 0) {
            revert NoPurchasedTokens();
        }

        uint256 _claimableAmount = claimableAmount(msg.sender);
        if (_claimableAmount == 0) {
            revert NoClaimableTokens();
        }
        claimedAmount[msg.sender] += _claimableAmount;

        token.safeTransfer(msg.sender, _claimableAmount);

        emit TokensClaimed(address(token), msg.sender, _claimableAmount);
    }

    /**
     * Allows the operator to withdraw ETH after the launchpad has ended.
     */

    function withdrawEth() external onlyOperator {
        if (!isEnded()) {
            revert NotEnded();
        }
        uint256 _balance = address(this).balance;
        if (_balance == 0) {
            revert NoBalanceToWithdraw();
        }
        (bool success, ) = payable(msg.sender).call{value: _balance}("");
        if (!success) {
            revert EthereumTransferFailed();
        }
    }

    /**
     * Allows the operator to withdraw any remaining tokens after the launchpad has ended.
     * This is useful in case the launchpad has not sold all the tokens.
     */

    function withdrawTokens() external onlyOperator {
        if (!isEnded()) {
            revert NotEnded();
        }
        uint256 _balance = token.balanceOf(address(this));
        uint256 _purchasedAmount = totalPurchasedAmount;

        if (_purchasedAmount > _balance) {
            _balance = 0;
        } else {
            _balance -= _purchasedAmount;
        }

        if (_balance <= 0) {
            revert NoBalanceToWithdraw();
        }
        token.safeTransfer(msg.sender, _balance);
    }

    /**
     * 
     * @param _vestingDuration new vesting duration
     * This function is used to change the vesting duration of the launchpad.
     */

    function setVestingDuration(uint256 _vestingDuration) external onlyOperator {
        require(!isEnded(), "Launchpad: ENDED");
        emit VestingDurationUpdated(_vestingDuration);
        vestingDuration = _vestingDuration;
    }

    /**
     * 
     * @param _name new name of the launchpad
     * This function is used to change the name of the launchpad.
     */

    function setName(string memory _name) external onlyOperator {
        name = _name;
    }

    /**
     * 
     * @param _newOwner new owner address
     * This function is used to transfer ownership of purchased tokens to another address.
     * This is useful for external integrators suchs as Zappers,
     * which need to transfer ownership of purchased tokens to the user.
     */

    function transferPurchasedOwnership(address _newOwner) external {

        if (isEnded()) {
            revert Ended();
        }

        uint256 _purchasedAmount = purchasedAmount[msg.sender];
        uint256 _newUserPurchaseAmount = purchasedAmount[_newOwner];

        if (_newUserPurchaseAmount + _purchasedAmount > maxTokenBuy) {
            revert AmountExceedsMaxTokenAmount();
        }

        purchasedAmount[msg.sender] = 0;
        purchasedAmount[_newOwner] += _purchasedAmount;
    }
}

File 2 of 13 : Ownable.sol
// 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);
    }
}

File 3 of 13 : draft-IERC6093.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (interfaces/draft-IERC6093.sol)
pragma solidity ^0.8.20;

/**
 * @dev Standard ERC20 Errors
 * Interface of the https://eips.ethereum.org/EIPS/eip-6093[ERC-6093] custom errors for ERC20 tokens.
 */
interface IERC20Errors {
    /**
     * @dev Indicates an error related to the current `balance` of a `sender`. Used in transfers.
     * @param sender Address whose tokens are being transferred.
     * @param balance Current balance for the interacting account.
     * @param needed Minimum amount required to perform a transfer.
     */
    error ERC20InsufficientBalance(address sender, uint256 balance, uint256 needed);

    /**
     * @dev Indicates a failure with the token `sender`. Used in transfers.
     * @param sender Address whose tokens are being transferred.
     */
    error ERC20InvalidSender(address sender);

    /**
     * @dev Indicates a failure with the token `receiver`. Used in transfers.
     * @param receiver Address to which tokens are being transferred.
     */
    error ERC20InvalidReceiver(address receiver);

    /**
     * @dev Indicates a failure with the `spender`’s `allowance`. Used in transfers.
     * @param spender Address that may be allowed to operate on tokens without being their owner.
     * @param allowance Amount of tokens a `spender` is allowed to operate with.
     * @param needed Minimum amount required to perform a transfer.
     */
    error ERC20InsufficientAllowance(address spender, uint256 allowance, uint256 needed);

    /**
     * @dev Indicates a failure with the `approver` of a token to be approved. Used in approvals.
     * @param approver Address initiating an approval operation.
     */
    error ERC20InvalidApprover(address approver);

    /**
     * @dev Indicates a failure with the `spender` to be approved. Used in approvals.
     * @param spender Address that may be allowed to operate on tokens without being their owner.
     */
    error ERC20InvalidSpender(address spender);
}

/**
 * @dev Standard ERC721 Errors
 * Interface of the https://eips.ethereum.org/EIPS/eip-6093[ERC-6093] custom errors for ERC721 tokens.
 */
interface IERC721Errors {
    /**
     * @dev Indicates that an address can't be an owner. For example, `address(0)` is a forbidden owner in EIP-20.
     * Used in balance queries.
     * @param owner Address of the current owner of a token.
     */
    error ERC721InvalidOwner(address owner);

    /**
     * @dev Indicates a `tokenId` whose `owner` is the zero address.
     * @param tokenId Identifier number of a token.
     */
    error ERC721NonexistentToken(uint256 tokenId);

    /**
     * @dev Indicates an error related to the ownership over a particular token. Used in transfers.
     * @param sender Address whose tokens are being transferred.
     * @param tokenId Identifier number of a token.
     * @param owner Address of the current owner of a token.
     */
    error ERC721IncorrectOwner(address sender, uint256 tokenId, address owner);

    /**
     * @dev Indicates a failure with the token `sender`. Used in transfers.
     * @param sender Address whose tokens are being transferred.
     */
    error ERC721InvalidSender(address sender);

    /**
     * @dev Indicates a failure with the token `receiver`. Used in transfers.
     * @param receiver Address to which tokens are being transferred.
     */
    error ERC721InvalidReceiver(address receiver);

    /**
     * @dev Indicates a failure with the `operator`’s approval. Used in transfers.
     * @param operator Address that may be allowed to operate on tokens without being their owner.
     * @param tokenId Identifier number of a token.
     */
    error ERC721InsufficientApproval(address operator, uint256 tokenId);

    /**
     * @dev Indicates a failure with the `approver` of a token to be approved. Used in approvals.
     * @param approver Address initiating an approval operation.
     */
    error ERC721InvalidApprover(address approver);

    /**
     * @dev Indicates a failure with the `operator` to be approved. Used in approvals.
     * @param operator Address that may be allowed to operate on tokens without being their owner.
     */
    error ERC721InvalidOperator(address operator);
}

/**
 * @dev Standard ERC1155 Errors
 * Interface of the https://eips.ethereum.org/EIPS/eip-6093[ERC-6093] custom errors for ERC1155 tokens.
 */
interface IERC1155Errors {
    /**
     * @dev Indicates an error related to the current `balance` of a `sender`. Used in transfers.
     * @param sender Address whose tokens are being transferred.
     * @param balance Current balance for the interacting account.
     * @param needed Minimum amount required to perform a transfer.
     * @param tokenId Identifier number of a token.
     */
    error ERC1155InsufficientBalance(address sender, uint256 balance, uint256 needed, uint256 tokenId);

    /**
     * @dev Indicates a failure with the token `sender`. Used in transfers.
     * @param sender Address whose tokens are being transferred.
     */
    error ERC1155InvalidSender(address sender);

    /**
     * @dev Indicates a failure with the token `receiver`. Used in transfers.
     * @param receiver Address to which tokens are being transferred.
     */
    error ERC1155InvalidReceiver(address receiver);

    /**
     * @dev Indicates a failure with the `operator`’s approval. Used in transfers.
     * @param operator Address that may be allowed to operate on tokens without being their owner.
     * @param owner Address of the current owner of a token.
     */
    error ERC1155MissingApprovalForAll(address operator, address owner);

    /**
     * @dev Indicates a failure with the `approver` of a token to be approved. Used in approvals.
     * @param approver Address initiating an approval operation.
     */
    error ERC1155InvalidApprover(address approver);

    /**
     * @dev Indicates a failure with the `operator` to be approved. Used in approvals.
     * @param operator Address that may be allowed to operate on tokens without being their owner.
     */
    error ERC1155InvalidOperator(address operator);

    /**
     * @dev Indicates an array length mismatch between ids and values in a safeBatchTransferFrom operation.
     * Used in batch transfers.
     * @param idsLength Length of the array of token identifiers
     * @param valuesLength Length of the array of token amounts
     */
    error ERC1155InvalidArrayLength(uint256 idsLength, uint256 valuesLength);
}

File 4 of 13 : ERC20.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/ERC20.sol)

pragma solidity ^0.8.20;

import {IERC20} from "./IERC20.sol";
import {IERC20Metadata} from "./extensions/IERC20Metadata.sol";
import {Context} from "../../utils/Context.sol";
import {IERC20Errors} from "../../interfaces/draft-IERC6093.sol";

/**
 * @dev Implementation of the {IERC20} interface.
 *
 * This implementation is agnostic to the way tokens are created. This means
 * that a supply mechanism has to be added in a derived contract using {_mint}.
 *
 * TIP: For a detailed writeup see our guide
 * https://forum.openzeppelin.com/t/how-to-implement-erc20-supply-mechanisms/226[How
 * to implement supply mechanisms].
 *
 * The default value of {decimals} is 18. To change this, you should override
 * this function so it returns a different value.
 *
 * We have followed general OpenZeppelin Contracts guidelines: functions revert
 * instead returning `false` on failure. This behavior is nonetheless
 * conventional and does not conflict with the expectations of ERC20
 * applications.
 *
 * Additionally, an {Approval} event is emitted on calls to {transferFrom}.
 * This allows applications to reconstruct the allowance for all accounts just
 * by listening to said events. Other implementations of the EIP may not emit
 * these events, as it isn't required by the specification.
 */
abstract contract ERC20 is Context, IERC20, IERC20Metadata, IERC20Errors {
    mapping(address account => uint256) private _balances;

    mapping(address account => mapping(address spender => uint256)) private _allowances;

    uint256 private _totalSupply;

    string private _name;
    string private _symbol;

    /**
     * @dev Sets the values for {name} and {symbol}.
     *
     * All two of these values are immutable: they can only be set once during
     * construction.
     */
    constructor(string memory name_, string memory symbol_) {
        _name = name_;
        _symbol = symbol_;
    }

    /**
     * @dev Returns the name of the token.
     */
    function name() public view virtual returns (string memory) {
        return _name;
    }

    /**
     * @dev Returns the symbol of the token, usually a shorter version of the
     * name.
     */
    function symbol() public view virtual returns (string memory) {
        return _symbol;
    }

    /**
     * @dev Returns the number of decimals used to get its user representation.
     * For example, if `decimals` equals `2`, a balance of `505` tokens should
     * be displayed to a user as `5.05` (`505 / 10 ** 2`).
     *
     * Tokens usually opt for a value of 18, imitating the relationship between
     * Ether and Wei. This is the default value returned by this function, unless
     * it's overridden.
     *
     * NOTE: This information is only used for _display_ purposes: it in
     * no way affects any of the arithmetic of the contract, including
     * {IERC20-balanceOf} and {IERC20-transfer}.
     */
    function decimals() public view virtual returns (uint8) {
        return 18;
    }

    /**
     * @dev See {IERC20-totalSupply}.
     */
    function totalSupply() public view virtual returns (uint256) {
        return _totalSupply;
    }

    /**
     * @dev See {IERC20-balanceOf}.
     */
    function balanceOf(address account) public view virtual returns (uint256) {
        return _balances[account];
    }

    /**
     * @dev See {IERC20-transfer}.
     *
     * Requirements:
     *
     * - `to` cannot be the zero address.
     * - the caller must have a balance of at least `value`.
     */
    function transfer(address to, uint256 value) public virtual returns (bool) {
        address owner = _msgSender();
        _transfer(owner, to, value);
        return true;
    }

    /**
     * @dev See {IERC20-allowance}.
     */
    function allowance(address owner, address spender) public view virtual returns (uint256) {
        return _allowances[owner][spender];
    }

    /**
     * @dev See {IERC20-approve}.
     *
     * NOTE: If `value` is the maximum `uint256`, the allowance is not updated on
     * `transferFrom`. This is semantically equivalent to an infinite approval.
     *
     * Requirements:
     *
     * - `spender` cannot be the zero address.
     */
    function approve(address spender, uint256 value) public virtual returns (bool) {
        address owner = _msgSender();
        _approve(owner, spender, value);
        return true;
    }

    /**
     * @dev See {IERC20-transferFrom}.
     *
     * Emits an {Approval} event indicating the updated allowance. This is not
     * required by the EIP. See the note at the beginning of {ERC20}.
     *
     * NOTE: Does not update the allowance if the current allowance
     * is the maximum `uint256`.
     *
     * Requirements:
     *
     * - `from` and `to` cannot be the zero address.
     * - `from` must have a balance of at least `value`.
     * - the caller must have allowance for ``from``'s tokens of at least
     * `value`.
     */
    function transferFrom(address from, address to, uint256 value) public virtual returns (bool) {
        address spender = _msgSender();
        _spendAllowance(from, spender, value);
        _transfer(from, to, value);
        return true;
    }

    /**
     * @dev Moves a `value` amount of tokens from `from` to `to`.
     *
     * This internal function is equivalent to {transfer}, and can be used to
     * e.g. implement automatic token fees, slashing mechanisms, etc.
     *
     * Emits a {Transfer} event.
     *
     * NOTE: This function is not virtual, {_update} should be overridden instead.
     */
    function _transfer(address from, address to, uint256 value) internal {
        if (from == address(0)) {
            revert ERC20InvalidSender(address(0));
        }
        if (to == address(0)) {
            revert ERC20InvalidReceiver(address(0));
        }
        _update(from, to, value);
    }

    /**
     * @dev Transfers a `value` amount of tokens from `from` to `to`, or alternatively mints (or burns) if `from`
     * (or `to`) is the zero address. All customizations to transfers, mints, and burns should be done by overriding
     * this function.
     *
     * Emits a {Transfer} event.
     */
    function _update(address from, address to, uint256 value) internal virtual {
        if (from == address(0)) {
            // Overflow check required: The rest of the code assumes that totalSupply never overflows
            _totalSupply += value;
        } else {
            uint256 fromBalance = _balances[from];
            if (fromBalance < value) {
                revert ERC20InsufficientBalance(from, fromBalance, value);
            }
            unchecked {
                // Overflow not possible: value <= fromBalance <= totalSupply.
                _balances[from] = fromBalance - value;
            }
        }

        if (to == address(0)) {
            unchecked {
                // Overflow not possible: value <= totalSupply or value <= fromBalance <= totalSupply.
                _totalSupply -= value;
            }
        } else {
            unchecked {
                // Overflow not possible: balance + value is at most totalSupply, which we know fits into a uint256.
                _balances[to] += value;
            }
        }

        emit Transfer(from, to, value);
    }

    /**
     * @dev Creates a `value` amount of tokens and assigns them to `account`, by transferring it from address(0).
     * Relies on the `_update` mechanism
     *
     * Emits a {Transfer} event with `from` set to the zero address.
     *
     * NOTE: This function is not virtual, {_update} should be overridden instead.
     */
    function _mint(address account, uint256 value) internal {
        if (account == address(0)) {
            revert ERC20InvalidReceiver(address(0));
        }
        _update(address(0), account, value);
    }

    /**
     * @dev Destroys a `value` amount of tokens from `account`, lowering the total supply.
     * Relies on the `_update` mechanism.
     *
     * Emits a {Transfer} event with `to` set to the zero address.
     *
     * NOTE: This function is not virtual, {_update} should be overridden instead
     */
    function _burn(address account, uint256 value) internal {
        if (account == address(0)) {
            revert ERC20InvalidSender(address(0));
        }
        _update(account, address(0), value);
    }

    /**
     * @dev Sets `value` as the allowance of `spender` over the `owner` s tokens.
     *
     * This internal function is equivalent to `approve`, and can be used to
     * e.g. set automatic allowances for certain subsystems, etc.
     *
     * Emits an {Approval} event.
     *
     * Requirements:
     *
     * - `owner` cannot be the zero address.
     * - `spender` cannot be the zero address.
     *
     * Overrides to this logic should be done to the variant with an additional `bool emitEvent` argument.
     */
    function _approve(address owner, address spender, uint256 value) internal {
        _approve(owner, spender, value, true);
    }

    /**
     * @dev Variant of {_approve} with an optional flag to enable or disable the {Approval} event.
     *
     * By default (when calling {_approve}) the flag is set to true. On the other hand, approval changes made by
     * `_spendAllowance` during the `transferFrom` operation set the flag to false. This saves gas by not emitting any
     * `Approval` event during `transferFrom` operations.
     *
     * Anyone who wishes to continue emitting `Approval` events on the`transferFrom` operation can force the flag to
     * true using the following override:
     * ```
     * function _approve(address owner, address spender, uint256 value, bool) internal virtual override {
     *     super._approve(owner, spender, value, true);
     * }
     * ```
     *
     * Requirements are the same as {_approve}.
     */
    function _approve(address owner, address spender, uint256 value, bool emitEvent) internal virtual {
        if (owner == address(0)) {
            revert ERC20InvalidApprover(address(0));
        }
        if (spender == address(0)) {
            revert ERC20InvalidSpender(address(0));
        }
        _allowances[owner][spender] = value;
        if (emitEvent) {
            emit Approval(owner, spender, value);
        }
    }

    /**
     * @dev Updates `owner` s allowance for `spender` based on spent `value`.
     *
     * Does not update the allowance value in case of infinite allowance.
     * Revert if not enough allowance is available.
     *
     * Does not emit an {Approval} event.
     */
    function _spendAllowance(address owner, address spender, uint256 value) internal virtual {
        uint256 currentAllowance = allowance(owner, spender);
        if (currentAllowance != type(uint256).max) {
            if (currentAllowance < value) {
                revert ERC20InsufficientAllowance(spender, currentAllowance, value);
            }
            unchecked {
                _approve(owner, spender, currentAllowance - value, false);
            }
        }
    }
}

File 5 of 13 : IERC20Metadata.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/extensions/IERC20Metadata.sol)

pragma solidity ^0.8.20;

import {IERC20} from "../IERC20.sol";

/**
 * @dev Interface for the optional metadata functions from the ERC20 standard.
 */
interface IERC20Metadata is IERC20 {
    /**
     * @dev Returns the name of the token.
     */
    function name() external view returns (string memory);

    /**
     * @dev Returns the symbol of the token.
     */
    function symbol() external view returns (string memory);

    /**
     * @dev Returns the decimals places of the token.
     */
    function decimals() external view returns (uint8);
}

File 6 of 13 : IERC20Permit.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/extensions/IERC20Permit.sol)

pragma solidity ^0.8.20;

/**
 * @dev Interface of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in
 * https://eips.ethereum.org/EIPS/eip-2612[EIP-2612].
 *
 * Adds the {permit} method, which can be used to change an account's ERC20 allowance (see {IERC20-allowance}) by
 * presenting a message signed by the account. By not relying on {IERC20-approve}, the token holder account doesn't
 * need to send a transaction, and thus is not required to hold Ether at all.
 *
 * ==== Security Considerations
 *
 * There are two important considerations concerning the use of `permit`. The first is that a valid permit signature
 * expresses an allowance, and it should not be assumed to convey additional meaning. In particular, it should not be
 * considered as an intention to spend the allowance in any specific way. The second is that because permits have
 * built-in replay protection and can be submitted by anyone, they can be frontrun. A protocol that uses permits should
 * take this into consideration and allow a `permit` call to fail. Combining these two aspects, a pattern that may be
 * generally recommended is:
 *
 * ```solidity
 * function doThingWithPermit(..., uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s) public {
 *     try token.permit(msg.sender, address(this), value, deadline, v, r, s) {} catch {}
 *     doThing(..., value);
 * }
 *
 * function doThing(..., uint256 value) public {
 *     token.safeTransferFrom(msg.sender, address(this), value);
 *     ...
 * }
 * ```
 *
 * Observe that: 1) `msg.sender` is used as the owner, leaving no ambiguity as to the signer intent, and 2) the use of
 * `try/catch` allows the permit to fail and makes the code tolerant to frontrunning. (See also
 * {SafeERC20-safeTransferFrom}).
 *
 * Additionally, note that smart contract wallets (such as Argent or Safe) are not able to produce permit signatures, so
 * contracts should have entry points that don't rely on permit.
 */
interface IERC20Permit {
    /**
     * @dev Sets `value` as the allowance of `spender` over ``owner``'s tokens,
     * given ``owner``'s signed approval.
     *
     * IMPORTANT: The same issues {IERC20-approve} has related to transaction
     * ordering also apply here.
     *
     * Emits an {Approval} event.
     *
     * Requirements:
     *
     * - `spender` cannot be the zero address.
     * - `deadline` must be a timestamp in the future.
     * - `v`, `r` and `s` must be a valid `secp256k1` signature from `owner`
     * over the EIP712-formatted function arguments.
     * - the signature must use ``owner``'s current nonce (see {nonces}).
     *
     * For more information on the signature format, see the
     * https://eips.ethereum.org/EIPS/eip-2612#specification[relevant EIP
     * section].
     *
     * CAUTION: See Security Considerations above.
     */
    function permit(
        address owner,
        address spender,
        uint256 value,
        uint256 deadline,
        uint8 v,
        bytes32 r,
        bytes32 s
    ) external;

    /**
     * @dev Returns the current nonce for `owner`. This value must be
     * included whenever a signature is generated for {permit}.
     *
     * Every successful call to {permit} increases ``owner``'s nonce by one. This
     * prevents a signature from being used multiple times.
     */
    function nonces(address owner) external view returns (uint256);

    /**
     * @dev Returns the domain separator used in the encoding of the signature for {permit}, as defined by {EIP712}.
     */
    // solhint-disable-next-line func-name-mixedcase
    function DOMAIN_SEPARATOR() external view returns (bytes32);
}

File 7 of 13 : IERC20.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/IERC20.sol)

pragma solidity ^0.8.20;

/**
 * @dev Interface of the ERC20 standard as defined in the EIP.
 */
interface IERC20 {
    /**
     * @dev Emitted when `value` tokens are moved from one account (`from`) to
     * another (`to`).
     *
     * Note that `value` may be zero.
     */
    event Transfer(address indexed from, address indexed to, uint256 value);

    /**
     * @dev Emitted when the allowance of a `spender` for an `owner` is set by
     * a call to {approve}. `value` is the new allowance.
     */
    event Approval(address indexed owner, address indexed spender, uint256 value);

    /**
     * @dev Returns the value of tokens in existence.
     */
    function totalSupply() external view returns (uint256);

    /**
     * @dev Returns the value of tokens owned by `account`.
     */
    function balanceOf(address account) external view returns (uint256);

    /**
     * @dev Moves a `value` amount of tokens from the caller's account to `to`.
     *
     * Returns a boolean value indicating whether the operation succeeded.
     *
     * Emits a {Transfer} event.
     */
    function transfer(address to, uint256 value) external returns (bool);

    /**
     * @dev Returns the remaining number of tokens that `spender` will be
     * allowed to spend on behalf of `owner` through {transferFrom}. This is
     * zero by default.
     *
     * This value changes when {approve} or {transferFrom} are called.
     */
    function allowance(address owner, address spender) external view returns (uint256);

    /**
     * @dev Sets a `value` amount of tokens as the allowance of `spender` over the
     * caller's tokens.
     *
     * Returns a boolean value indicating whether the operation succeeded.
     *
     * IMPORTANT: Beware that changing an allowance with this method brings the risk
     * that someone may use both the old and the new allowance by unfortunate
     * transaction ordering. One possible solution to mitigate this race
     * condition is to first reduce the spender's allowance to 0 and set the
     * desired value afterwards:
     * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
     *
     * Emits an {Approval} event.
     */
    function approve(address spender, uint256 value) external returns (bool);

    /**
     * @dev Moves a `value` amount of tokens from `from` to `to` using the
     * allowance mechanism. `value` is then deducted from the caller's
     * allowance.
     *
     * Returns a boolean value indicating whether the operation succeeded.
     *
     * Emits a {Transfer} event.
     */
    function transferFrom(address from, address to, uint256 value) external returns (bool);
}

File 8 of 13 : SafeERC20.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/utils/SafeERC20.sol)

pragma solidity ^0.8.20;

import {IERC20} from "../IERC20.sol";
import {IERC20Permit} from "../extensions/IERC20Permit.sol";
import {Address} from "../../../utils/Address.sol";

/**
 * @title SafeERC20
 * @dev Wrappers around ERC20 operations that throw on failure (when the token
 * contract returns false). Tokens that return no value (and instead revert or
 * throw on failure) are also supported, non-reverting calls are assumed to be
 * successful.
 * To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract,
 * which allows you to call the safe operations as `token.safeTransfer(...)`, etc.
 */
library SafeERC20 {
    using Address for address;

    /**
     * @dev An operation with an ERC20 token failed.
     */
    error SafeERC20FailedOperation(address token);

    /**
     * @dev Indicates a failed `decreaseAllowance` request.
     */
    error SafeERC20FailedDecreaseAllowance(address spender, uint256 currentAllowance, uint256 requestedDecrease);

    /**
     * @dev Transfer `value` amount of `token` from the calling contract to `to`. If `token` returns no value,
     * non-reverting calls are assumed to be successful.
     */
    function safeTransfer(IERC20 token, address to, uint256 value) internal {
        _callOptionalReturn(token, abi.encodeCall(token.transfer, (to, value)));
    }

    /**
     * @dev Transfer `value` amount of `token` from `from` to `to`, spending the approval given by `from` to the
     * calling contract. If `token` returns no value, non-reverting calls are assumed to be successful.
     */
    function safeTransferFrom(IERC20 token, address from, address to, uint256 value) internal {
        _callOptionalReturn(token, abi.encodeCall(token.transferFrom, (from, to, value)));
    }

    /**
     * @dev Increase the calling contract's allowance toward `spender` by `value`. If `token` returns no value,
     * non-reverting calls are assumed to be successful.
     */
    function safeIncreaseAllowance(IERC20 token, address spender, uint256 value) internal {
        uint256 oldAllowance = token.allowance(address(this), spender);
        forceApprove(token, spender, oldAllowance + value);
    }

    /**
     * @dev Decrease the calling contract's allowance toward `spender` by `requestedDecrease`. If `token` returns no
     * value, non-reverting calls are assumed to be successful.
     */
    function safeDecreaseAllowance(IERC20 token, address spender, uint256 requestedDecrease) internal {
        unchecked {
            uint256 currentAllowance = token.allowance(address(this), spender);
            if (currentAllowance < requestedDecrease) {
                revert SafeERC20FailedDecreaseAllowance(spender, currentAllowance, requestedDecrease);
            }
            forceApprove(token, spender, currentAllowance - requestedDecrease);
        }
    }

    /**
     * @dev Set the calling contract's allowance toward `spender` to `value`. If `token` returns no value,
     * non-reverting calls are assumed to be successful. Meant to be used with tokens that require the approval
     * to be set to zero before setting it to a non-zero value, such as USDT.
     */
    function forceApprove(IERC20 token, address spender, uint256 value) internal {
        bytes memory approvalCall = abi.encodeCall(token.approve, (spender, value));

        if (!_callOptionalReturnBool(token, approvalCall)) {
            _callOptionalReturn(token, abi.encodeCall(token.approve, (spender, 0)));
            _callOptionalReturn(token, approvalCall);
        }
    }

    /**
     * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement
     * on the return value: the return value is optional (but if data is returned, it must not be false).
     * @param token The token targeted by the call.
     * @param data The call data (encoded using abi.encode or one of its variants).
     */
    function _callOptionalReturn(IERC20 token, bytes memory data) private {
        // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since
        // we're implementing it ourselves. We use {Address-functionCall} to perform this call, which verifies that
        // the target address contains contract code and also asserts for success in the low-level call.

        bytes memory returndata = address(token).functionCall(data);
        if (returndata.length != 0 && !abi.decode(returndata, (bool))) {
            revert SafeERC20FailedOperation(address(token));
        }
    }

    /**
     * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement
     * on the return value: the return value is optional (but if data is returned, it must not be false).
     * @param token The token targeted by the call.
     * @param data The call data (encoded using abi.encode or one of its variants).
     *
     * This is a variant of {_callOptionalReturn} that silents catches all reverts and returns a bool instead.
     */
    function _callOptionalReturnBool(IERC20 token, bytes memory data) private returns (bool) {
        // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since
        // we're implementing it ourselves. We cannot use {Address-functionCall} here since this should return false
        // and not revert is the subcall reverts.

        (bool success, bytes memory returndata) = address(token).call(data);
        return success && (returndata.length == 0 || abi.decode(returndata, (bool))) && address(token).code.length > 0;
    }
}

File 9 of 13 : Address.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (utils/Address.sol)

pragma solidity ^0.8.20;

/**
 * @dev Collection of functions related to the address type
 */
library Address {
    /**
     * @dev The ETH balance of the account is not enough to perform the operation.
     */
    error AddressInsufficientBalance(address account);

    /**
     * @dev There's no code at `target` (it is not a contract).
     */
    error AddressEmptyCode(address target);

    /**
     * @dev A call to an address target failed. The target may have reverted.
     */
    error FailedInnerCall();

    /**
     * @dev Replacement for Solidity's `transfer`: sends `amount` wei to
     * `recipient`, forwarding all available gas and reverting on errors.
     *
     * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost
     * of certain opcodes, possibly making contracts go over the 2300 gas limit
     * imposed by `transfer`, making them unable to receive funds via
     * `transfer`. {sendValue} removes this limitation.
     *
     * https://consensys.net/diligence/blog/2019/09/stop-using-soliditys-transfer-now/[Learn more].
     *
     * IMPORTANT: because control is transferred to `recipient`, care must be
     * taken to not create reentrancy vulnerabilities. Consider using
     * {ReentrancyGuard} or the
     * https://solidity.readthedocs.io/en/v0.8.20/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].
     */
    function sendValue(address payable recipient, uint256 amount) internal {
        if (address(this).balance < amount) {
            revert AddressInsufficientBalance(address(this));
        }

        (bool success, ) = recipient.call{value: amount}("");
        if (!success) {
            revert FailedInnerCall();
        }
    }

    /**
     * @dev Performs a Solidity function call using a low level `call`. A
     * plain `call` is an unsafe replacement for a function call: use this
     * function instead.
     *
     * If `target` reverts with a revert reason or custom error, it is bubbled
     * up by this function (like regular Solidity function calls). However, if
     * the call reverted with no returned reason, this function reverts with a
     * {FailedInnerCall} error.
     *
     * Returns the raw returned data. To convert to the expected return value,
     * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].
     *
     * Requirements:
     *
     * - `target` must be a contract.
     * - calling `target` with `data` must not revert.
     */
    function functionCall(address target, bytes memory data) internal returns (bytes memory) {
        return functionCallWithValue(target, data, 0);
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
     * but also transferring `value` wei to `target`.
     *
     * Requirements:
     *
     * - the calling contract must have an ETH balance of at least `value`.
     * - the called Solidity function must be `payable`.
     */
    function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {
        if (address(this).balance < value) {
            revert AddressInsufficientBalance(address(this));
        }
        (bool success, bytes memory returndata) = target.call{value: value}(data);
        return verifyCallResultFromTarget(target, success, returndata);
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
     * but performing a static call.
     */
    function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {
        (bool success, bytes memory returndata) = target.staticcall(data);
        return verifyCallResultFromTarget(target, success, returndata);
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
     * but performing a delegate call.
     */
    function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {
        (bool success, bytes memory returndata) = target.delegatecall(data);
        return verifyCallResultFromTarget(target, success, returndata);
    }

    /**
     * @dev Tool to verify that a low level call to smart-contract was successful, and reverts if the target
     * was not a contract or bubbling up the revert reason (falling back to {FailedInnerCall}) in case of an
     * unsuccessful call.
     */
    function verifyCallResultFromTarget(
        address target,
        bool success,
        bytes memory returndata
    ) internal view returns (bytes memory) {
        if (!success) {
            _revert(returndata);
        } else {
            // only check if target is a contract if the call was successful and the return data is empty
            // otherwise we already know that it was a contract
            if (returndata.length == 0 && target.code.length == 0) {
                revert AddressEmptyCode(target);
            }
            return returndata;
        }
    }

    /**
     * @dev Tool to verify that a low level call was successful, and reverts if it wasn't, either by bubbling the
     * revert reason or with a default {FailedInnerCall} error.
     */
    function verifyCallResult(bool success, bytes memory returndata) internal pure returns (bytes memory) {
        if (!success) {
            _revert(returndata);
        } else {
            return returndata;
        }
    }

    /**
     * @dev Reverts with returndata if present. Otherwise reverts with {FailedInnerCall}.
     */
    function _revert(bytes memory returndata) private pure {
        // Look for revert reason and bubble it up if present
        if (returndata.length > 0) {
            // The easiest way to bubble the revert reason is using memory via assembly
            /// @solidity memory-safe-assembly
            assembly {
                let returndata_size := mload(returndata)
                revert(add(32, returndata), returndata_size)
            }
        } else {
            revert FailedInnerCall();
        }
    }
}

File 10 of 13 : Context.sol
// 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;
    }
}

File 11 of 13 : MerkleProof.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (utils/cryptography/MerkleProof.sol)

pragma solidity ^0.8.20;

/**
 * @dev These functions deal with verification of Merkle Tree proofs.
 *
 * The tree and the proofs can be generated using our
 * https://github.com/OpenZeppelin/merkle-tree[JavaScript library].
 * You will find a quickstart guide in the readme.
 *
 * WARNING: You should avoid using leaf values that are 64 bytes long prior to
 * hashing, or use a hash function other than keccak256 for hashing leaves.
 * This is because the concatenation of a sorted pair of internal nodes in
 * the Merkle tree could be reinterpreted as a leaf value.
 * OpenZeppelin's JavaScript library generates Merkle trees that are safe
 * against this attack out of the box.
 */
library MerkleProof {
    /**
     *@dev The multiproof provided is not valid.
     */
    error MerkleProofInvalidMultiproof();

    /**
     * @dev Returns true if a `leaf` can be proved to be a part of a Merkle tree
     * defined by `root`. For this, a `proof` must be provided, containing
     * sibling hashes on the branch from the leaf to the root of the tree. Each
     * pair of leaves and each pair of pre-images are assumed to be sorted.
     */
    function verify(bytes32[] memory proof, bytes32 root, bytes32 leaf) internal pure returns (bool) {
        return processProof(proof, leaf) == root;
    }

    /**
     * @dev Calldata version of {verify}
     */
    function verifyCalldata(bytes32[] calldata proof, bytes32 root, bytes32 leaf) internal pure returns (bool) {
        return processProofCalldata(proof, leaf) == root;
    }

    /**
     * @dev Returns the rebuilt hash obtained by traversing a Merkle tree up
     * from `leaf` using `proof`. A `proof` is valid if and only if the rebuilt
     * hash matches the root of the tree. When processing the proof, the pairs
     * of leafs & pre-images are assumed to be sorted.
     */
    function processProof(bytes32[] memory proof, bytes32 leaf) internal pure returns (bytes32) {
        bytes32 computedHash = leaf;
        for (uint256 i = 0; i < proof.length; i++) {
            computedHash = _hashPair(computedHash, proof[i]);
        }
        return computedHash;
    }

    /**
     * @dev Calldata version of {processProof}
     */
    function processProofCalldata(bytes32[] calldata proof, bytes32 leaf) internal pure returns (bytes32) {
        bytes32 computedHash = leaf;
        for (uint256 i = 0; i < proof.length; i++) {
            computedHash = _hashPair(computedHash, proof[i]);
        }
        return computedHash;
    }

    /**
     * @dev Returns true if the `leaves` can be simultaneously proven to be a part of a Merkle tree defined by
     * `root`, according to `proof` and `proofFlags` as described in {processMultiProof}.
     *
     * CAUTION: Not all Merkle trees admit multiproofs. See {processMultiProof} for details.
     */
    function multiProofVerify(
        bytes32[] memory proof,
        bool[] memory proofFlags,
        bytes32 root,
        bytes32[] memory leaves
    ) internal pure returns (bool) {
        return processMultiProof(proof, proofFlags, leaves) == root;
    }

    /**
     * @dev Calldata version of {multiProofVerify}
     *
     * CAUTION: Not all Merkle trees admit multiproofs. See {processMultiProof} for details.
     */
    function multiProofVerifyCalldata(
        bytes32[] calldata proof,
        bool[] calldata proofFlags,
        bytes32 root,
        bytes32[] memory leaves
    ) internal pure returns (bool) {
        return processMultiProofCalldata(proof, proofFlags, leaves) == root;
    }

    /**
     * @dev Returns the root of a tree reconstructed from `leaves` and sibling nodes in `proof`. The reconstruction
     * proceeds by incrementally reconstructing all inner nodes by combining a leaf/inner node with either another
     * leaf/inner node or a proof sibling node, depending on whether each `proofFlags` item is true or false
     * respectively.
     *
     * CAUTION: Not all Merkle trees admit multiproofs. To use multiproofs, it is sufficient to ensure that: 1) the tree
     * is complete (but not necessarily perfect), 2) the leaves to be proven are in the opposite order they are in the
     * tree (i.e., as seen from right to left starting at the deepest layer and continuing at the next layer).
     */
    function processMultiProof(
        bytes32[] memory proof,
        bool[] memory proofFlags,
        bytes32[] memory leaves
    ) internal pure returns (bytes32 merkleRoot) {
        // This function rebuilds the root hash by traversing the tree up from the leaves. The root is rebuilt by
        // consuming and producing values on a queue. The queue starts with the `leaves` array, then goes onto the
        // `hashes` array. At the end of the process, the last hash in the `hashes` array should contain the root of
        // the Merkle tree.
        uint256 leavesLen = leaves.length;
        uint256 proofLen = proof.length;
        uint256 totalHashes = proofFlags.length;

        // Check proof validity.
        if (leavesLen + proofLen != totalHashes + 1) {
            revert MerkleProofInvalidMultiproof();
        }

        // The xxxPos values are "pointers" to the next value to consume in each array. All accesses are done using
        // `xxx[xxxPos++]`, which return the current value and increment the pointer, thus mimicking a queue's "pop".
        bytes32[] memory hashes = new bytes32[](totalHashes);
        uint256 leafPos = 0;
        uint256 hashPos = 0;
        uint256 proofPos = 0;
        // At each step, we compute the next hash using two values:
        // - a value from the "main queue". If not all leaves have been consumed, we get the next leaf, otherwise we
        //   get the next hash.
        // - depending on the flag, either another value from the "main queue" (merging branches) or an element from the
        //   `proof` array.
        for (uint256 i = 0; i < totalHashes; i++) {
            bytes32 a = leafPos < leavesLen ? leaves[leafPos++] : hashes[hashPos++];
            bytes32 b = proofFlags[i]
                ? (leafPos < leavesLen ? leaves[leafPos++] : hashes[hashPos++])
                : proof[proofPos++];
            hashes[i] = _hashPair(a, b);
        }

        if (totalHashes > 0) {
            if (proofPos != proofLen) {
                revert MerkleProofInvalidMultiproof();
            }
            unchecked {
                return hashes[totalHashes - 1];
            }
        } else if (leavesLen > 0) {
            return leaves[0];
        } else {
            return proof[0];
        }
    }

    /**
     * @dev Calldata version of {processMultiProof}.
     *
     * CAUTION: Not all Merkle trees admit multiproofs. See {processMultiProof} for details.
     */
    function processMultiProofCalldata(
        bytes32[] calldata proof,
        bool[] calldata proofFlags,
        bytes32[] memory leaves
    ) internal pure returns (bytes32 merkleRoot) {
        // This function rebuilds the root hash by traversing the tree up from the leaves. The root is rebuilt by
        // consuming and producing values on a queue. The queue starts with the `leaves` array, then goes onto the
        // `hashes` array. At the end of the process, the last hash in the `hashes` array should contain the root of
        // the Merkle tree.
        uint256 leavesLen = leaves.length;
        uint256 proofLen = proof.length;
        uint256 totalHashes = proofFlags.length;

        // Check proof validity.
        if (leavesLen + proofLen != totalHashes + 1) {
            revert MerkleProofInvalidMultiproof();
        }

        // The xxxPos values are "pointers" to the next value to consume in each array. All accesses are done using
        // `xxx[xxxPos++]`, which return the current value and increment the pointer, thus mimicking a queue's "pop".
        bytes32[] memory hashes = new bytes32[](totalHashes);
        uint256 leafPos = 0;
        uint256 hashPos = 0;
        uint256 proofPos = 0;
        // At each step, we compute the next hash using two values:
        // - a value from the "main queue". If not all leaves have been consumed, we get the next leaf, otherwise we
        //   get the next hash.
        // - depending on the flag, either another value from the "main queue" (merging branches) or an element from the
        //   `proof` array.
        for (uint256 i = 0; i < totalHashes; i++) {
            bytes32 a = leafPos < leavesLen ? leaves[leafPos++] : hashes[hashPos++];
            bytes32 b = proofFlags[i]
                ? (leafPos < leavesLen ? leaves[leafPos++] : hashes[hashPos++])
                : proof[proofPos++];
            hashes[i] = _hashPair(a, b);
        }

        if (totalHashes > 0) {
            if (proofPos != proofLen) {
                revert MerkleProofInvalidMultiproof();
            }
            unchecked {
                return hashes[totalHashes - 1];
            }
        } else if (leavesLen > 0) {
            return leaves[0];
        } else {
            return proof[0];
        }
    }

    /**
     * @dev Sorts the pair (a, b) and hashes the result.
     */
    function _hashPair(bytes32 a, bytes32 b) private pure returns (bytes32) {
        return a < b ? _efficientHash(a, b) : _efficientHash(b, a);
    }

    /**
     * @dev Implementation of keccak256(abi.encode(a, b)) that doesn't allocate or expand memory.
     */
    function _efficientHash(bytes32 a, bytes32 b) private pure returns (bytes32 value) {
        /// @solidity memory-safe-assembly
        assembly {
            mstore(0x00, a)
            mstore(0x20, b)
            value := keccak256(0x00, 0x40)
        }
    }
}

File 12 of 13 : Errors.sol
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.9;

error ZeroAddress();
error InvalidEthPrice();
error InvalidMinTokenBuy();
error InvalidMaxTokenBuy();
error InvalidStartDate();
error InvalidEndDate();
error OperatorZeroAddress();
error SameOperator();
error InvalidTokenHardCapIncrement();
error NotStarted();
error Ended();
error InvalidWhitelistProof();
error InvalidBuyAmount();
error AmountExceedsHardCap();
error AmountTooLow();
error AmountExceedsMaxTokenAmount();
error NotClaimable();
error NoPurchasedTokens();
error NoClaimableTokens();
error NotEnded();
error NoBalanceToWithdraw();
error EthereumTransferFailed();
error InvalidProtocolFee();

File 13 of 13 : ILaunchpadFactory.sol
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.9;


struct MainLaunchpadInfo {
    string name;
    address token;
    uint256 ethPricePerToken;
    uint256 minTokenBuy;
    uint256 maxTokenBuy;
    uint256 startDate;
    uint256 endDate;
    uint256 releaseDelay;
    uint256 vestingDuration;
}

interface ILaunchpadFactory {
    function launchpads() external view returns (address[] memory);
    function trustedLaunchpads() external view returns (address[] memory);
    function protocolFeeAddress() external view returns (address);
    function protocolFee() external view returns (uint256);
}

Settings
{
  "optimizer": {
    "enabled": true,
    "runs": 3000
  },
  "evmVersion": "paris",
  "outputSelection": {
    "*": {
      "*": [
        "evm.bytecode",
        "evm.deployedBytecode",
        "devdoc",
        "userdoc",
        "metadata",
        "abi"
      ]
    }
  },
  "metadata": {
    "useLiteralContent": true
  },
  "libraries": {}
}

Contract Security Audit

Contract ABI

[{"inputs":[{"components":[{"internalType":"string","name":"name","type":"string"},{"internalType":"address","name":"token","type":"address"},{"internalType":"uint256","name":"ethPricePerToken","type":"uint256"},{"internalType":"uint256","name":"minTokenBuy","type":"uint256"},{"internalType":"uint256","name":"maxTokenBuy","type":"uint256"},{"internalType":"uint256","name":"startDate","type":"uint256"},{"internalType":"uint256","name":"endDate","type":"uint256"},{"internalType":"uint256","name":"releaseDelay","type":"uint256"},{"internalType":"uint256","name":"vestingDuration","type":"uint256"}],"internalType":"struct MainLaunchpadInfo","name":"_info","type":"tuple"},{"internalType":"uint256","name":"_protocolFee","type":"uint256"},{"internalType":"address","name":"_protocolFeeAddress","type":"address"},{"internalType":"address","name":"_operator","type":"address"},{"internalType":"address","name":"_factory","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[{"internalType":"address","name":"target","type":"address"}],"name":"AddressEmptyCode","type":"error"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"AddressInsufficientBalance","type":"error"},{"inputs":[],"name":"AmountExceedsHardCap","type":"error"},{"inputs":[],"name":"AmountExceedsMaxTokenAmount","type":"error"},{"inputs":[],"name":"AmountTooLow","type":"error"},{"inputs":[],"name":"Ended","type":"error"},{"inputs":[],"name":"EthereumTransferFailed","type":"error"},{"inputs":[],"name":"FailedInnerCall","type":"error"},{"inputs":[],"name":"InvalidBuyAmount","type":"error"},{"inputs":[],"name":"InvalidEndDate","type":"error"},{"inputs":[],"name":"InvalidEthPrice","type":"error"},{"inputs":[],"name":"InvalidMaxTokenBuy","type":"error"},{"inputs":[],"name":"InvalidMinTokenBuy","type":"error"},{"inputs":[],"name":"InvalidStartDate","type":"error"},{"inputs":[],"name":"InvalidTokenHardCapIncrement","type":"error"},{"inputs":[],"name":"InvalidWhitelistProof","type":"error"},{"inputs":[],"name":"NoBalanceToWithdraw","type":"error"},{"inputs":[],"name":"NoClaimableTokens","type":"error"},{"inputs":[],"name":"NoPurchasedTokens","type":"error"},{"inputs":[],"name":"NotClaimable","type":"error"},{"inputs":[],"name":"NotEnded","type":"error"},{"inputs":[],"name":"NotStarted","type":"error"},{"inputs":[],"name":"OperatorZeroAddress","type":"error"},{"inputs":[{"internalType":"address","name":"token","type":"address"}],"name":"SafeERC20FailedOperation","type":"error"},{"inputs":[],"name":"SameOperator","type":"error"},{"inputs":[],"name":"ZeroAddress","type":"error"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOperator","type":"address"},{"indexed":true,"internalType":"address","name":"newOperator","type":"address"}],"name":"OperatorTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"_token","type":"address"},{"indexed":false,"internalType":"uint256","name":"newTokenHardCap","type":"uint256"}],"name":"TokenHardCapUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"_token","type":"address"},{"indexed":true,"internalType":"address","name":"buyer","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"TokensClaimed","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"_token","type":"address"},{"indexed":true,"internalType":"address","name":"buyer","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"TokensPurchased","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"newVestingDuration","type":"uint256"}],"name":"VestingDurationUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"wlBlockNumber","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"wlMinBalance","type":"uint256"},{"indexed":false,"internalType":"bytes32","name":"wlRoot","type":"bytes32"}],"name":"WhitelistUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"_token","type":"address"},{"indexed":false,"internalType":"uint256","name":"newEthPricePerToken","type":"uint256"}],"name":"ethPricePerTokenUpdated","type":"event"},{"inputs":[{"internalType":"bytes32[]","name":"proof","type":"bytes32[]"}],"name":"buyTokens","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[],"name":"claimTokens","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_address","type":"address"}],"name":"claimableAmount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"claimedAmount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"decimals","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"endDate","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"ethPricePerToken","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"ethAmount","type":"uint256"}],"name":"ethToToken","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"factory","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_tokenHardCapIncrement","type":"uint256"}],"name":"increaseHardCap","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"isClaimable","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"isEnded","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"isStarted","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"maxTokenBuy","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"minTokenBuy","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"name","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"operator","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"protocolFee","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"protocolFeeAddress","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"purchasedAmount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"releaseDelay","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"string","name":"_name","type":"string"}],"name":"setName","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_vestingDuration","type":"uint256"}],"name":"setVestingDuration","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"startDate","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"token","outputs":[{"internalType":"contract IERC20","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"tokenHardCap","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"tokenUnit","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalPurchasedAmount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"newOperator","type":"address"}],"name":"transferOperatorOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_newOwner","type":"address"}],"name":"transferPurchasedOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_ethPricePerToken","type":"uint256"}],"name":"updateEthPricePerToken","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_wlBlockNumber","type":"uint256"},{"internalType":"uint256","name":"_wlMinBalance","type":"uint256"},{"internalType":"bytes32","name":"_wlRoot","type":"bytes32"}],"name":"updateWhitelist","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"vestingDuration","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"withdrawEth","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"withdrawTokens","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"wlBlockNumber","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"wlMinBalance","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"wlRoot","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"}]

Deployed Bytecode

0x6080604052600436106102855760003560e01c80638988504911610153578063bc402f8f116100cb578063c47f00271161007f578063e27a248911610064578063e27a24891461069c578063e93c980d146106bc578063fc0c546a146106f057600080fd5b8063c47f00271461065c578063cce516b71461067c57600080fd5b8063c24a0f8b116100b0578063c24a0f8b146105fc578063c3a4714914610612578063c45a01551461062857600080fd5b8063bc402f8f146105d0578063bedac100146105e657600080fd5b8063a4fd6f5611610122578063afe07ce411610107578063afe07ce414610584578063b0e21e8a1461059a578063b8e0d08d146105b057600080fd5b8063a4fd6f5614610559578063ab98089f1461057157600080fd5b806389885049146104ef5780638d8f2adb1461050f578063964d86c914610524578063a0ef91df1461054457600080fd5b806344c4dcc1116102015780636ccf95fc116101b55780637195bf231161019a5780637195bf23146104ae57806374478bb3146104c457806382c30987146104d957600080fd5b80636ccf95fc146104825780636fb64e291461049857600080fd5b8063544736e6116101e6578063544736e614610406578063570ca7351461042a5780635ea5c1691461046257600080fd5b806344c4dcc1146103c457806348c54b9d146103f157600080fd5b80631514617e116102585780633044e2771161023d5780633044e2771461035a578063313ce5671461037a57806339688256146103ae57600080fd5b80631514617e146103245780632ad50ce91461033a57600080fd5b806304e869031461028a57806306fdde03146102ca5780630b97bc86146102ec5780630ffbdcaa14610302575b600080fd5b34801561029657600080fd5b506102b76102a5366004611908565b600d6020526000908152604090205481565b6040519081526020015b60405180910390f35b3480156102d657600080fd5b506102df610724565b6040516102c19190611955565b3480156102f857600080fd5b506102b760065481565b34801561030e57600080fd5b5061032261031d366004611988565b6107b2565b005b34801561033057600080fd5b506102b7600b5481565b34801561034657600080fd5b50610322610355366004611908565b610885565b34801561036657600080fd5b50610322610375366004611908565b610960565b34801561038657600080fd5b506102b77f000000000000000000000000000000000000000000000000000000000000001281565b3480156103ba57600080fd5b506102b760035481565b3480156103d057600080fd5b506102b76103df366004611908565b600c6020526000908152604090205481565b3480156103fd57600080fd5b50610322610a86565b34801561041257600080fd5b506006544210155b60405190151581526020016102c1565b34801561043657600080fd5b5060005461044a906001600160a01b031681565b6040516001600160a01b0390911681526020016102c1565b34801561046e57600080fd5b5061032261047d3660046119a1565b610c0f565b34801561048e57600080fd5b506102b760025481565b3480156104a457600080fd5b506102b760105481565b3480156104ba57600080fd5b506102b7600a5481565b3480156104d057600080fd5b5061041a610c8f565b3480156104e557600080fd5b506102b760115481565b3480156104fb57600080fd5b506102b761050a366004611908565b610ca9565b34801561051b57600080fd5b50610322610d80565b34801561053057600080fd5b5061032261053f366004611988565b610f21565b34801561055057600080fd5b50610322610fee565b34801561056557600080fd5b5060075442101561041a565b61032261057f3660046119cd565b611113565b34801561059057600080fd5b506102b760055481565b3480156105a657600080fd5b506102b760085481565b3480156105bc57600080fd5b506103226105cb366004611988565b6113e2565b3480156105dc57600080fd5b506102b7600f5481565b3480156105f257600080fd5b506102b7600e5481565b34801561060857600080fd5b506102b760075481565b34801561061e57600080fd5b506102b760045481565b34801561063457600080fd5b5061044a7f0000000000000000000000007f9da88321cc5ee680bf6cd7e1d8a3bcb27a3ee581565b34801561066857600080fd5b50610322610677366004611a58565b611566565b34801561068857600080fd5b5060095461044a906001600160a01b031681565b3480156106a857600080fd5b506102b76106b7366004611988565b61159d565b3480156106c857600080fd5b506102b77f0000000000000000000000000000000000000000000000000de0b6b3a764000081565b3480156106fc57600080fd5b5061044a7f00000000000000000000000095ccffae3eb8767d4a941ec43280961dde89f4de81565b6001805461073190611b09565b80601f016020809104026020016040519081016040528092919081815260200182805461075d90611b09565b80156107aa5780601f1061077f576101008083540402835291602001916107aa565b820191906000526020600020905b81548152906001019060200180831161078d57829003601f168201915b505050505081565b6000546001600160a01b031633146107dd5760405163b2e661d760e01b815260040160405180910390fd5b600754421061084d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601060248201527f4c61756e63687061643a20454e4445440000000000000000000000000000000060448201526064015b60405180910390fd5b6040518181527fe41050a384bb8564f1f0f7deee716caf1c0a20a94b147933a4a217427fceaace9060200160405180910390a1600b55565b60075442106108c0576040517f477383f300000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b336000908152600c6020526040808220546001600160a01b03841683529120546005546108ed8383611b59565b1115610925576040517f6a93ecd900000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b336000908152600c60205260408082208290556001600160a01b038516825281208054849290610956908490611b59565b9091555050505050565b6000546001600160a01b0316331461098b5760405163b2e661d760e01b815260040160405180910390fd5b6001600160a01b0381166109cb576040517fd92e233d00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6000546001600160a01b0390811690821603610a13576040517f0d7ba3a600000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600080546040516001600160a01b03808516939216917f74da04524d50c64947f5dd5381ef1a4dca5cba8ed1d816243f9e48aa0b5617ed91a3600080547fffffffffffffffffffffffff0000000000000000000000000000000000000000166001600160a01b0392909216919091179055565b610a8e610c8f565b610ac4576040517f6247a84e00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b336000908152600c60205260408120549003610b0c576040517f5dd9982e00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6000610b1733610ca9565b905080600003610b53576040517fb8d485a500000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b336000908152600d602052604081208054839290610b72908490611b59565b90915550610bac90506001600160a01b037f00000000000000000000000095ccffae3eb8767d4a941ec43280961dde89f4de1633836115dd565b60405181815233907f00000000000000000000000095ccffae3eb8767d4a941ec43280961dde89f4de6001600160a01b0316907fa86305abc2db271df4609aa86a8d044bc11fb36939841bfdad6c1ab2b26e94719060200160405180910390a350565b6000546001600160a01b03163314610c3a5760405163b2e661d760e01b815260040160405180910390fd5b600f8390556010829055601181905560408051848152602081018490529081018290527f48a56cad4f4700b5cec54bb868120f657d71333d300cfbdd06d52c0920f21d039060600160405180910390a1505050565b6000600a54600754610ca19190611b59565b421015905090565b6000610cb3610c8f565b610cbf57506000919050565b6001600160a01b0382166000908152600c6020908152604080832054600d9092528220549091610cef8284611b6c565b9050600b5460001480610d1e5750600b54600a54600754610d109190611b59565b610d1a9190611b59565b4210155b15610d2b57949350505050565b6000600b54600a5460075442610d419190611b6c565b610d4b9190611b6c565b610d559086611b7f565b610d5f9190611b96565b905083811115610d6c5750825b610d768382611b6c565b9695505050505050565b6000546001600160a01b03163314610dab5760405163b2e661d760e01b815260040160405180910390fd5b600754421015610de7576040517fd3018d1800000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6040517f70a082310000000000000000000000000000000000000000000000000000000081523060048201526000907f00000000000000000000000095ccffae3eb8767d4a941ec43280961dde89f4de6001600160a01b0316906370a0823190602401602060405180830381865afa158015610e67573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e8b9190611bb8565b600e5490915081811115610ea25760009150610eaf565b610eac8183611b6c565b91505b60008211610ee9576040517fbbd8170800000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b610f1d6001600160a01b037f00000000000000000000000095ccffae3eb8767d4a941ec43280961dde89f4de1633846115dd565b5050565b6000546001600160a01b03163314610f4c5760405163b2e661d760e01b815260040160405180910390fd5b80600003610f86576040517f59e3bc8d00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b7f00000000000000000000000095ccffae3eb8767d4a941ec43280961dde89f4de6001600160a01b03167f5a618a77896880d7865b0093eac54a86e9bad19c67a4870cf1bf46420c041d8782604051610fe191815260200190565b60405180910390a2600255565b6000546001600160a01b031633146110195760405163b2e661d760e01b815260040160405180910390fd5b600754421015611055576040517fd3018d1800000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b476000819003611091576040517fbbd8170800000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b604051600090339083908381818185875af1925050503d80600081146110d3576040519150601f19603f3d011682016040523d82523d6000602084013e6110d8565b606091505b5050905080610f1d576040517f53a7326b00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60065442101561114f576040517f6f312cbd00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600754421061118a576040517f477383f300000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b346000036111c4576040517f384dbe5a00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6000600f5411801561122157506011546040805133602082015261121f92859285920160408051601f198184030181528282528051602091820120908301520160405160208183030381529060405280519060200120611656565b155b15611258576040517fa26e706500000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60006112633461159d565b90506004548110156112a1576040517f1fbaba3500000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600554336000908152600c60205260409020546112bf908390611b59565b11156112f7576040517f6a93ecd900000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60035481600e546113089190611b59565b1115611340576040517fc11132a700000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b336000908152600c60205260408120805483929061135f908490611b59565b9250508190555080600e60008282546113789190611b59565b909155505060405181815233906001600160a01b037f00000000000000000000000095ccffae3eb8767d4a941ec43280961dde89f4de16907ff9b4eb3e43eebbf559e9b96ceff1c786a7edab2938c7f5f80678197c2e0edba59060200160405180910390a3505050565b6000546001600160a01b0316331461140d5760405163b2e661d760e01b815260040160405180910390fd5b80600003611447576040517fe690acde00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60006127106008548361145a9190611b7f565b6114649190611b96565b905080156114b5576009546114a8906001600160a01b037f00000000000000000000000095ccffae3eb8767d4a941ec43280961dde89f4de8116913391168461166e565b6114b28183611b6c565b91505b6114ea6001600160a01b037f00000000000000000000000095ccffae3eb8767d4a941ec43280961dde89f4de1633308561166e565b81600360008282546114fc9190611b59565b90915550506003546040519081526001600160a01b037f00000000000000000000000095ccffae3eb8767d4a941ec43280961dde89f4de16907fa3b7fca9670bb037363dfd4e1a7f841adac6df1f3ce5a23a57fedce69b400f1c9060200160405180910390a25050565b6000546001600160a01b031633146115915760405163b2e661d760e01b815260040160405180910390fd5b6001610f1d8282611c21565b6002546000906115cd7f0000000000000000000000000000000000000000000000000de0b6b3a764000084611b7f565b6115d79190611b96565b92915050565b6040516001600160a01b0383811660248301526044820183905261165191859182169063a9059cbb906064015b604051602081830303815290604052915060e01b6020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff83818316178352505050506116ad565b505050565b600082611664868685611729565b1495945050505050565b6040516001600160a01b0384811660248301528381166044830152606482018390526116a79186918216906323b872dd9060840161160a565b50505050565b60006116c26001600160a01b0384168361176d565b905080516000141580156116e75750808060200190518101906116e59190611ce1565b155b15611651576040517f5274afe70000000000000000000000000000000000000000000000000000000081526001600160a01b0384166004820152602401610844565b600081815b84811015611762576117588287878481811061174c5761174c611d03565b9050602002013561177b565b915060010161172e565b5090505b9392505050565b6060611766838360006117aa565b6000818310611797576000828152602084905260409020611766565b6000838152602083905260409020611766565b6060814710156117e8576040517fcd786059000000000000000000000000000000000000000000000000000000008152306004820152602401610844565b600080856001600160a01b031684866040516118049190611d19565b60006040518083038185875af1925050503d8060008114611841576040519150601f19603f3d011682016040523d82523d6000602084013e611846565b606091505b5091509150610d7686838360608261186657611861826118c6565b611766565b815115801561187d57506001600160a01b0384163b155b156118bf576040517f9996b3150000000000000000000000000000000000000000000000000000000081526001600160a01b0385166004820152602401610844565b5080611766565b8051156118d65780518082602001fd5b6040517f1425ea4200000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60006020828403121561191a57600080fd5b81356001600160a01b038116811461176657600080fd5b60005b8381101561194c578181015183820152602001611934565b50506000910152565b6020815260008251806020840152611974816040850160208701611931565b601f01601f19169190910160400192915050565b60006020828403121561199a57600080fd5b5035919050565b6000806000606084860312156119b657600080fd5b505081359360208301359350604090920135919050565b600080602083850312156119e057600080fd5b823567ffffffffffffffff808211156119f857600080fd5b818501915085601f830112611a0c57600080fd5b813581811115611a1b57600080fd5b8660208260051b8501011115611a3057600080fd5b60209290920196919550909350505050565b634e487b7160e01b600052604160045260246000fd5b600060208284031215611a6a57600080fd5b813567ffffffffffffffff80821115611a8257600080fd5b818401915084601f830112611a9657600080fd5b813581811115611aa857611aa8611a42565b604051601f8201601f19908116603f01168101908382118183101715611ad057611ad0611a42565b81604052828152876020848701011115611ae957600080fd5b826020860160208301376000928101602001929092525095945050505050565b600181811c90821680611b1d57607f821691505b602082108103611b3d57634e487b7160e01b600052602260045260246000fd5b50919050565b634e487b7160e01b600052601160045260246000fd5b808201808211156115d7576115d7611b43565b818103818111156115d7576115d7611b43565b80820281158282048414176115d7576115d7611b43565b600082611bb357634e487b7160e01b600052601260045260246000fd5b500490565b600060208284031215611bca57600080fd5b5051919050565b601f821115611651576000816000526020600020601f850160051c81016020861015611bfa5750805b601f850160051c820191505b81811015611c1957828155600101611c06565b505050505050565b815167ffffffffffffffff811115611c3b57611c3b611a42565b611c4f81611c498454611b09565b84611bd1565b602080601f831160018114611c845760008415611c6c5750858301515b600019600386901b1c1916600185901b178555611c19565b600085815260208120601f198616915b82811015611cb357888601518255948401946001909101908401611c94565b5085821015611cd15787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b600060208284031215611cf357600080fd5b8151801515811461176657600080fd5b634e487b7160e01b600052603260045260246000fd5b60008251611d2b818460208701611931565b919091019291505056fea2646970667358221220719fbe9d6399073574d8257a9620f05f0a414729fea970933747a995c1641e3564736f6c63430008170033

Block Transaction Difficulty Gas Used Reward
View All Blocks Produced

Block Uncle Number Difficulty Gas Used Reward
View All Uncles
Loading...
Loading
Loading...
Loading

Validator Index Block Amount
View All Withdrawals

Transaction Hash Block Value Eth2 PubKey Valid
View All Deposits
Loading...
Loading
[ Download: CSV Export  ]
[ Download: CSV Export  ]

A contract address hosts a smart contract, which is a set of code stored on the blockchain that runs when predetermined conditions are met. Learn more about addresses in our Knowledge Base.