HYPE Price: $22.33 (+0.83%)
 

Overview

HYPE Balance

HyperEVM LogoHyperEVM LogoHyperEVM Logo0 HYPE

HYPE Value

$0.00

More Info

Private Name Tags

Multichain Info

No addresses found
Transaction Hash
Block
From
To
Set Treasury191009412025-11-13 13:37:5374 days ago1763041073IN
0x61434e92...d3224F520
0 HYPE0.000240899.89081404

View more zero value Internal Transactions in Advanced View mode

Advanced mode:
Cross-Chain Transactions
Loading...
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
TokenPublicRaiseUpgradeable

Compiler Version
v0.8.19+commit.7dd6d404

Optimization Enabled:
Yes with 2000 runs

Other Settings:
paris EvmVersion
// SPDX-License-Identifier: MIT
pragma solidity =0.8.19;

import {Ownable2StepUpgradeable} from "@openzeppelin/contracts-upgradeable/access/Ownable2StepUpgradeable.sol";
import {ReentrancyGuardUpgradeable} from "@openzeppelin/contracts-upgradeable/security/ReentrancyGuardUpgradeable.sol";
import {ITokenPublicRaise} from "./interfaces/ITokenPublicRaise.sol";

/**
 * @title TokenPublicRaiseUpgradeable
 * @notice Fixed-rate public raise that accepts native currency and accounts purchased token amounts per depositor.
 * @dev
 * - Price is expressed as `tokenPricePerOneNative` = tokens per 1e18 native units (wei).
 *   Example: if 1 ETH buys 1,000 tokens with 18 decimals, set `tokenPricePerOneNative = 1000e18`.
 * - Enforces a global cap (`totalDepositCap`) and a per-user cap (`maxDepositAmount`).
 * - Tracks per-user deposited native value (`userDeposited`) and purchased tokens (`userTokensAllocated`).
 * - Uses {Ownable2StepUpgradeable} for admin operations and {ReentrancyGuardUpgradeable} to protect deposit paths.
 *
 * Upgradeability:
 * - The implementation constructor disables initializers. Use {initialize} once on the proxy.
 */
contract TokenPublicRaiseUpgradeable is ITokenPublicRaise, Ownable2StepUpgradeable, ReentrancyGuardUpgradeable {
    /**
     * @notice Destination address to receive collected native funds.
     */
    address public treasury;

    /**
     * @notice Inclusive sale start timestamp.
     */
    uint256 public startTimestamp;

    /**
     * @notice Inclusive sale end timestamp.
     */
    uint256 public endTimestamp;

    /**
     * @notice Suggested minimum amount per deposit transaction (native units).
     */
    uint256 public minDepositAmount;

    /**
     * @notice Maximum total amount a single user is allowed to deposit (native units).
     */
    uint256 public maxDepositAmount;

    /**
     * @notice Global cap for all deposits combined (native units).
     */
    uint256 public totalDepositCap;

    /**
     * @notice Price: number of sale tokens received per 1e18 units of native currency.
     * @dev tokensOut = `msg.value * tokenPricePerOneNative / 1e18`.
     */
    uint256 public tokenPricePerOneNative;

    /**
     * @notice Total native currency deposited into the raise so far.
     */
    uint256 public totalDeposited;

    /**
     * @notice Per-user native currency deposited into the raise.
     */
    mapping(address user => uint256) public userDeposited;

    /**
     * @notice Per-user amount of tokens accounted as purchased.
     * @dev This contract only accounts purchases; it does not transfer sale tokens.
     */
    mapping(address user => uint256) public userTokensAllocated;

    /** 
     * @dev Reverts when `msg.value` is below the minimum accepted amount for a context.
     */
    error DepositBelowMin();

    /**
     * @dev Reverts when a user attempts to exceed the per-user cap.
     */
    error DepositAboveMax();

    /**
     * @dev Reverts when the attempted deposit would exceed the global cap.
     */
    error DepositCapReached();

    /**
     * @dev Reverts on zero amount where non-zero is required.
     */
    error AmountZero();

    /**
     * @dev Reverts on zero address where non-zero is required.
     */
    error AddressZero();

    /**
     * @dev Reverts if the raise is not currently active (not started or already finished).
     */
    error RaiseNotActive();

    /**
     * @dev Reverts if timestamps are invalid (e.g., end <= start).
     */
    error InvalidRaiseWindow();

    /**
     * @dev Reverts if provided limit values are inconsistent (e.g., min > max).
     */
    error InvalidDepositLimits();

    /**
     * @dev Reverts if a withdrawal is attempted before the raise has ended.
     */
    error RaiseNotEnded();

    /**
     * @dev Reverts if native currency transfer via call failed.
     */
    error NativeTransferFailed();

    /**
     * @dev Disable initializers on the implementation instance.
     */
    constructor() {
        _disableInitializers();
    }

    /**
     * @notice Initializes the raise configuration.
     * @dev Callable once on the proxy. Emits {ExchangeRateUpdated}, {TreasuryUpdated},
     *      {DepositLimitsUpdated}, and {RaiseWindowUpdated}.
     * @param startTimestamp_ Inclusive sale start timestamp.
     * @param endTimestamp_ Inclusive sale end timestamp.
     * @param minDepositAmount_ Suggested minimum per-user deposit (native units).
     * @param maxDepositAmount_ Maximum per-user total deposit (native units).
     * @param totalDepositCap_ Global cap across all users (native units).
     * @param tokenPricePerOneNative_ Tokens per 1e18 native units.
     * @param treasury_ Destination address for collected native funds.
     */
    function initialize(uint256 startTimestamp_, uint256 endTimestamp_, uint256 minDepositAmount_, uint256 maxDepositAmount_, uint256 totalDepositCap_, uint256 tokenPricePerOneNative_, address treasury_) external initializer {
        __Ownable_init();
        __Ownable2Step_init();
        __ReentrancyGuard_init();

        _setTreasury(treasury_);
        _setDepositLimits(minDepositAmount_, maxDepositAmount_, totalDepositCap_);
        _setRaiseWindow(startTimestamp_, endTimestamp_);
        _setTokenPricePerOneNative(tokenPricePerOneNative_);
    }

    /**
     * @notice Deposits native currency into the raise at the current fixed price.
     * @dev
     * - Reverts if the raise is inactive.
     * - Caps the accepted amount by both global and per-user remaining allowances.
     * - Accounts purchased tokens using `tokenPricePerOneNative`.
     * - Emits {Deposited}.
     */
    function deposit() payable external nonReentrant {
        _deposit();
    }

    /**
     * @notice Fallback deposit path to accept plain native transfers during the active window.
     * @dev Mirrors {deposit}. Emits {Deposited}.
     */
    receive() external payable nonReentrant {
        _deposit();
    }

    /**
     * @notice Withdraws the entire native balance to the treasury after the raise has ended.
     * @dev
     * - Only callable by the owner.
     * - Reverts if `block.timestamp <= endTimestamp` (raise not finished yet).
     * - Reverts if there is no balance to withdraw.
     * - Uses checks-effects-interactions and {nonReentrant}.
     * - Emits {TreasuryWithdrawn}.
     */
    function withdrawToTreasury() external onlyOwner nonReentrant {
        if (block.timestamp <= endTimestamp) revert RaiseNotEnded();

        uint256 amount = address(this).balance;
        _revertIfZero(amount);

        (bool ok, ) = payable(treasury).call{value: amount}("");
        if (!ok) revert NativeTransferFailed();

        emit TreasuryWithdrawn(treasury, amount);
    }

    /**
     * @notice Updates the fixed exchange rate (tokens per 1e18 native units).
     * @dev
     * Requirements:
     * - Caller must be the owner.
     * - `tokenPricePerOneNative_` must be non-zero.
     *
     * Emits:
     * - {ExchangeRateUpdated}.
     *
     * Reverts:
     * - {AmountZero} if `tokenPricePerOneNative_` is zero.
     * @param tokenPricePerOneNative_ New price (tokens per 1e18 native units).
     */
    function setTokenPricePerOneNative(uint256 tokenPricePerOneNative_) external onlyOwner {
        _setTokenPricePerOneNative(tokenPricePerOneNative_);
    }

    /**
     * @notice Updates the treasury address.
     * @dev Only callable by the owner. Emits {TreasuryUpdated}.
     * @param treasury_ The new treasury address.
     */
    function setTreasury(address treasury_) external onlyOwner {
        _setTreasury(treasury_);
    }

    /**
     * @notice Updates min/per-user/global deposit limits.
     * @dev Only callable by the owner. Emits {DepositLimitsUpdated}.
     * @param minDepositAmount_ Suggested minimum per-tx deposit (native units).
     * @param maxDepositAmount_ Maximum per-user total deposit (native units).
     * @param totalDepositCap_ Global cap across all users (native units).
     */
    function setDepositLimits(uint256 minDepositAmount_, uint256 maxDepositAmount_, uint256 totalDepositCap_) external onlyOwner {
        _setDepositLimits(minDepositAmount_, maxDepositAmount_, totalDepositCap_);
    }

    /**
     * @notice Updates the start/end timestamps of the raise window.
     * @dev Only callable by the owner. Emits {RaiseWindowUpdated}.
     * @param startTimestamp_ Inclusive sale start timestamp.
     * @param endTimestamp_ Inclusive sale end timestamp.
     */
    function setRaiseWindow(uint256 startTimestamp_, uint256 endTimestamp_) external onlyOwner {
        _setRaiseWindow(startTimestamp_, endTimestamp_);
    }

    /**
     * @notice Returns the maximum additional native amount `user_` can still deposit.
     * @dev
     * - If the raise is inactive, returns 0.
     * - Computed as `min(globalRemaining, perUserRemaining)`.
     * - Uses saturating logic for `globalRemaining` and `perUserRemaining`.
     * @param user_ The user address to query.
     * @return maxAllowed The maximum additional deposit amount in native units.
     */
    function maxDeposit(address user_) public view returns(uint256 maxAllowed) {
        if (!isRaiseActive()) {
            return 0;
        }

        uint256 globalRemaining = totalDeposited >= totalDepositCap
            ? 0
            : (totalDepositCap - totalDeposited);

        uint256 already = userDeposited[user_];
        uint256 userRemaining = maxDepositAmount > already ? (maxDepositAmount - already) : 0;

        maxAllowed = globalRemaining < userRemaining ? globalRemaining : userRemaining;
    }

    /**
     * @notice Returns whether the raise window is currently active.
     * @dev Active iff `block.timestamp` is within [startTimestamp, endTimestamp].
     */
    function isRaiseActive() public view returns(bool) {
        return block.timestamp >= startTimestamp && block.timestamp <= endTimestamp;
    }

    /**
     * @notice Returns a compact snapshot of global config/state and the user’s counters.
     * @param user_ The user address to query.
     * @return active Whether the raise is active.
     * @return start Start timestamp.
     * @return end End timestamp.
     * @return min Suggested minimum per-tx deposit.
     * @return max Maximum per-user deposit.
     * @return globalCap Global deposit cap.
     * @return price Tokens per 1e18 native units.
     * @return totalIn Total native deposited.
     * @return userIn User’s native deposited.
     * @return userOut User’s accounted purchased tokens.
     * @return userMaxDeposit User's max deposit amount available for deposit
     */
    function getInfo(address user_) external view returns(
        bool active,
        uint256 start,
        uint256 end,
        uint256 min,
        uint256 max,
        uint256 globalCap,
        uint256 price,
        uint256 totalIn,
        uint256 userIn,
        uint256 userOut,
        uint256 userMaxDeposit
    ) {
        active = isRaiseActive();
        start = startTimestamp;
        end = endTimestamp;
        min = minDepositAmount;
        max = maxDepositAmount;
        globalCap = totalDepositCap;
        price = tokenPricePerOneNative;
        totalIn = totalDeposited;
        if(user_ != address(0)) {
            userIn = userDeposited[user_];
            userOut = userTokensAllocated[user_];
            userMaxDeposit = maxDeposit(user_);
        }
    }

    /**
     * @dev Core deposit logic shared by {deposit} and {receive}.
     *      Emits {Deposited}.
     *
     * Reverts:
     * - {RaiseNotActive} if not active.
     * - {DepositCapReached} if global cap is already reached.
     * - {DepositAboveMax} if the sender already reached the per-user cap.
     * - {AmountZero} if the accepted amount or tokens out evaluates to zero.
     */
    function _deposit() internal {
        if(!isRaiseActive()) {
            revert RaiseNotActive();
        }
        uint256 amount = msg.value;
        _revertIfZero(amount);

        uint256 globalRemaining = totalDeposited >= totalDepositCap
            ? 0
            : (totalDepositCap - totalDeposited);

        if (globalRemaining == 0) revert DepositCapReached();

        uint256 maxLimit = maxDeposit(_msgSender());

        if (maxLimit == 0 || amount > maxLimit) revert DepositAboveMax();

        if (amount + userDeposited[_msgSender()] < minDepositAmount) revert DepositBelowMin();

        uint256 tokensOut = amount * tokenPricePerOneNative / 1e18;

        _revertIfZero(tokensOut);

        totalDeposited += amount;
        userDeposited[_msgSender()] += amount;
        userTokensAllocated[_msgSender()] += tokensOut;

        emit Deposited(_msgSender(), amount, tokensOut);
    }

    /**
     * @dev Internal setter for the treasury address.
     *      Emits {TreasuryUpdated}.
     * @param treasury_ Non-zero treasury address.
     */
    function _setTreasury(address treasury_) internal {
        _revertIfZero(treasury_);
        treasury = treasury_;
        emit TreasuryUpdated(treasury_);
    }

    /**
     * @dev Internal setter for deposit limits.
     *      Emits {DepositLimitsUpdated}.
     * @param minDepositAmount_ Suggested minimum per-tx deposit.
     * @param maxDepositAmount_ Maximum per-user deposit.
     * @param totalDepositCap_ Global cap across all users.
     *
     * Reverts:
     * - {AmountZero} if any max or total value is zero (as checked).
     * - {InvalidDepositLimits} if `minDepositAmount_ > maxDepositAmount_`.
     */
    function _setDepositLimits(uint256 minDepositAmount_, uint256 maxDepositAmount_, uint256 totalDepositCap_) internal {
        _revertIfZero(maxDepositAmount_);
        _revertIfZero(totalDepositCap_);

        if(minDepositAmount_ > maxDepositAmount_) revert InvalidDepositLimits();

        minDepositAmount = minDepositAmount_;
        maxDepositAmount = maxDepositAmount_;
        totalDepositCap = totalDepositCap_;

        emit DepositLimitsUpdated(minDepositAmount_, maxDepositAmount_, totalDepositCap_);
    }

    /**
     * @dev Internal setter for the exchange rate (tokens per 1e18 native units).
     *
     * Requirements:
     * - `tokenPricePerOneNative_` must be non-zero.
     *
     * Emits:
     * - {ExchangeRateUpdated}.
     *
     * Reverts:
     * - {AmountZero} if `tokenPricePerOneNative_ == 0`.
     * @param tokenPricePerOneNative_ New price to set.
     */
    function _setTokenPricePerOneNative(uint256 tokenPricePerOneNative_) internal {
        _revertIfZero(tokenPricePerOneNative_);
        tokenPricePerOneNative = tokenPricePerOneNative_;
        emit ExchangeRateUpdated(tokenPricePerOneNative_);
    }

    /**
     * @dev Internal setter for start/end timestamps.
     *      Emits {RaiseWindowUpdated}.
     * @param startTimestamp_ Inclusive start timestamp.
     * @param endTimestamp_ Inclusive end timestamp.
     *
     * Reverts:
     * - {AmountZero} if either timestamp is zero.
     * - {InvalidRaiseWindow} if `endTimestamp_ <= startTimestamp_`.
     */
    function _setRaiseWindow(uint256 startTimestamp_, uint256 endTimestamp_) internal {
        _revertIfZero(startTimestamp_);
        _revertIfZero(endTimestamp_);

        if (endTimestamp_ <= startTimestamp_) revert InvalidRaiseWindow();

        startTimestamp = startTimestamp_;
        endTimestamp = endTimestamp_;
        emit RaiseWindowUpdated(startTimestamp_, endTimestamp_);
    }

    /**
     * @dev Reverts if `addr_` is the zero address.
     * @param addr_ Address to check.
     */
    function _revertIfZero(address addr_) internal pure {
        if (addr_ == address(0)) revert AddressZero();
    }
    
    /**
     * @dev Reverts if `amount_` is zero.
     * @param amount_ Amount to check.
     */
    function _revertIfZero(uint256 amount_) internal pure {
        if (amount_ == 0) revert AmountZero();
    }
}

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (access/Ownable2Step.sol)

pragma solidity ^0.8.0;

import "./OwnableUpgradeable.sol";
import {Initializable} from "../proxy/utils/Initializable.sol";

/**
 * @dev Contract module which provides access control mechanism, where
 * there is an account (an owner) that can be granted exclusive access to
 * specific functions.
 *
 * By default, the owner account will be the one that deploys the contract. This
 * can later be changed with {transferOwnership} and {acceptOwnership}.
 *
 * This module is used through inheritance. It will make available all functions
 * from parent (Ownable).
 */
abstract contract Ownable2StepUpgradeable is Initializable, OwnableUpgradeable {
    address private _pendingOwner;

    event OwnershipTransferStarted(address indexed previousOwner, address indexed newOwner);

    function __Ownable2Step_init() internal onlyInitializing {
        __Ownable_init_unchained();
    }

    function __Ownable2Step_init_unchained() internal onlyInitializing {
    }
    /**
     * @dev Returns the address of the pending owner.
     */
    function pendingOwner() public view virtual returns (address) {
        return _pendingOwner;
    }

    /**
     * @dev Starts the ownership transfer of the contract to a new account. Replaces the pending transfer if there is one.
     * Can only be called by the current owner.
     */
    function transferOwnership(address newOwner) public virtual override onlyOwner {
        _pendingOwner = newOwner;
        emit OwnershipTransferStarted(owner(), newOwner);
    }

    /**
     * @dev Transfers ownership of the contract to a new account (`newOwner`) and deletes any pending owner.
     * Internal function without access restriction.
     */
    function _transferOwnership(address newOwner) internal virtual override {
        delete _pendingOwner;
        super._transferOwnership(newOwner);
    }

    /**
     * @dev The new owner accepts the ownership transfer.
     */
    function acceptOwnership() public virtual {
        address sender = _msgSender();
        require(pendingOwner() == sender, "Ownable2Step: caller is not the new owner");
        _transferOwnership(sender);
    }

    /**
     * @dev This empty reserved space is put in place to allow future versions to add new
     * variables without shifting down storage in the inheritance chain.
     * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps
     */
    uint256[49] private __gap;
}

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (access/Ownable.sol)

pragma solidity ^0.8.0;

import "../utils/ContextUpgradeable.sol";
import {Initializable} from "../proxy/utils/Initializable.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.
 *
 * By default, the owner account will be the one that deploys the contract. 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 OwnableUpgradeable is Initializable, ContextUpgradeable {
    address private _owner;

    event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);

    /**
     * @dev Initializes the contract setting the deployer as the initial owner.
     */
    function __Ownable_init() internal onlyInitializing {
        __Ownable_init_unchained();
    }

    function __Ownable_init_unchained() internal onlyInitializing {
        _transferOwnership(_msgSender());
    }

    /**
     * @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 {
        require(owner() == _msgSender(), "Ownable: caller is not the owner");
    }

    /**
     * @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 {
        require(newOwner != address(0), "Ownable: new owner is the zero address");
        _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);
    }

    /**
     * @dev This empty reserved space is put in place to allow future versions to add new
     * variables without shifting down storage in the inheritance chain.
     * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps
     */
    uint256[49] private __gap;
}

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (proxy/utils/Initializable.sol)

pragma solidity ^0.8.2;

import "../../utils/AddressUpgradeable.sol";

/**
 * @dev This is a base contract to aid in writing upgradeable contracts, or any kind of contract that will be deployed
 * behind a proxy. Since proxied contracts do not make use of a constructor, it's common to move constructor logic to an
 * external initializer function, usually called `initialize`. It then becomes necessary to protect this initializer
 * function so it can only be called once. The {initializer} modifier provided by this contract will have this effect.
 *
 * The initialization functions use a version number. Once a version number is used, it is consumed and cannot be
 * reused. This mechanism prevents re-execution of each "step" but allows the creation of new initialization steps in
 * case an upgrade adds a module that needs to be initialized.
 *
 * For example:
 *
 * [.hljs-theme-light.nopadding]
 * ```solidity
 * contract MyToken is ERC20Upgradeable {
 *     function initialize() initializer public {
 *         __ERC20_init("MyToken", "MTK");
 *     }
 * }
 *
 * contract MyTokenV2 is MyToken, ERC20PermitUpgradeable {
 *     function initializeV2() reinitializer(2) public {
 *         __ERC20Permit_init("MyToken");
 *     }
 * }
 * ```
 *
 * TIP: To avoid leaving the proxy in an uninitialized state, the initializer function should be called as early as
 * possible by providing the encoded function call as the `_data` argument to {ERC1967Proxy-constructor}.
 *
 * CAUTION: When used with inheritance, manual care must be taken to not invoke a parent initializer twice, or to ensure
 * that all initializers are idempotent. This is not verified automatically as constructors are by Solidity.
 *
 * [CAUTION]
 * ====
 * Avoid leaving a contract uninitialized.
 *
 * An uninitialized contract can be taken over by an attacker. This applies to both a proxy and its implementation
 * contract, which may impact the proxy. To prevent the implementation contract from being used, you should invoke
 * the {_disableInitializers} function in the constructor to automatically lock it when it is deployed:
 *
 * [.hljs-theme-light.nopadding]
 * ```
 * /// @custom:oz-upgrades-unsafe-allow constructor
 * constructor() {
 *     _disableInitializers();
 * }
 * ```
 * ====
 */
abstract contract Initializable {
    /**
     * @dev Indicates that the contract has been initialized.
     * @custom:oz-retyped-from bool
     */
    uint8 private _initialized;

    /**
     * @dev Indicates that the contract is in the process of being initialized.
     */
    bool private _initializing;

    /**
     * @dev Triggered when the contract has been initialized or reinitialized.
     */
    event Initialized(uint8 version);

    /**
     * @dev A modifier that defines a protected initializer function that can be invoked at most once. In its scope,
     * `onlyInitializing` functions can be used to initialize parent contracts.
     *
     * Similar to `reinitializer(1)`, except that functions marked with `initializer` can be nested in the context of a
     * constructor.
     *
     * Emits an {Initialized} event.
     */
    modifier initializer() {
        bool isTopLevelCall = !_initializing;
        require(
            (isTopLevelCall && _initialized < 1) || (!AddressUpgradeable.isContract(address(this)) && _initialized == 1),
            "Initializable: contract is already initialized"
        );
        _initialized = 1;
        if (isTopLevelCall) {
            _initializing = true;
        }
        _;
        if (isTopLevelCall) {
            _initializing = false;
            emit Initialized(1);
        }
    }

    /**
     * @dev A modifier that defines a protected reinitializer function that can be invoked at most once, and only if the
     * contract hasn't been initialized to a greater version before. In its scope, `onlyInitializing` functions can be
     * used to initialize parent contracts.
     *
     * A reinitializer may be used after the original initialization step. This is essential to configure modules that
     * are added through upgrades and that require initialization.
     *
     * When `version` is 1, this modifier is similar to `initializer`, except that functions marked with `reinitializer`
     * cannot be nested. If one is invoked in the context of another, execution will revert.
     *
     * Note that versions can jump in increments greater than 1; this implies that if multiple reinitializers coexist in
     * a contract, executing them in the right order is up to the developer or operator.
     *
     * WARNING: setting the version to 255 will prevent any future reinitialization.
     *
     * Emits an {Initialized} event.
     */
    modifier reinitializer(uint8 version) {
        require(!_initializing && _initialized < version, "Initializable: contract is already initialized");
        _initialized = version;
        _initializing = true;
        _;
        _initializing = false;
        emit Initialized(version);
    }

    /**
     * @dev Modifier to protect an initialization function so that it can only be invoked by functions with the
     * {initializer} and {reinitializer} modifiers, directly or indirectly.
     */
    modifier onlyInitializing() {
        require(_initializing, "Initializable: contract is not initializing");
        _;
    }

    /**
     * @dev Locks the contract, preventing any future reinitialization. This cannot be part of an initializer call.
     * Calling this in the constructor of a contract will prevent that contract from being initialized or reinitialized
     * to any version. It is recommended to use this to lock implementation contracts that are designed to be called
     * through proxies.
     *
     * Emits an {Initialized} event the first time it is successfully executed.
     */
    function _disableInitializers() internal virtual {
        require(!_initializing, "Initializable: contract is initializing");
        if (_initialized != type(uint8).max) {
            _initialized = type(uint8).max;
            emit Initialized(type(uint8).max);
        }
    }

    /**
     * @dev Returns the highest version that has been initialized. See {reinitializer}.
     */
    function _getInitializedVersion() internal view returns (uint8) {
        return _initialized;
    }

    /**
     * @dev Returns `true` if the contract is currently initializing. See {onlyInitializing}.
     */
    function _isInitializing() internal view returns (bool) {
        return _initializing;
    }
}

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (security/ReentrancyGuard.sol)

pragma solidity ^0.8.0;
import {Initializable} from "../proxy/utils/Initializable.sol";

/**
 * @dev Contract module that helps prevent reentrant calls to a function.
 *
 * Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier
 * available, which can be applied to functions to make sure there are no nested
 * (reentrant) calls to them.
 *
 * Note that because there is a single `nonReentrant` guard, functions marked as
 * `nonReentrant` may not call one another. This can be worked around by making
 * those functions `private`, and then adding `external` `nonReentrant` entry
 * points to them.
 *
 * TIP: If you would like to learn more about reentrancy and alternative ways
 * to protect against it, check out our blog post
 * https://blog.openzeppelin.com/reentrancy-after-istanbul/[Reentrancy After Istanbul].
 */
abstract contract ReentrancyGuardUpgradeable is Initializable {
    // Booleans are more expensive than uint256 or any type that takes up a full
    // word because each write operation emits an extra SLOAD to first read the
    // slot's contents, replace the bits taken up by the boolean, and then write
    // back. This is the compiler's defense against contract upgrades and
    // pointer aliasing, and it cannot be disabled.

    // The values being non-zero value makes deployment a bit more expensive,
    // but in exchange the refund on every call to nonReentrant will be lower in
    // amount. Since refunds are capped to a percentage of the total
    // transaction's gas, it is best to keep them low in cases like this one, to
    // increase the likelihood of the full refund coming into effect.
    uint256 private constant _NOT_ENTERED = 1;
    uint256 private constant _ENTERED = 2;

    uint256 private _status;

    function __ReentrancyGuard_init() internal onlyInitializing {
        __ReentrancyGuard_init_unchained();
    }

    function __ReentrancyGuard_init_unchained() internal onlyInitializing {
        _status = _NOT_ENTERED;
    }

    /**
     * @dev Prevents a contract from calling itself, directly or indirectly.
     * Calling a `nonReentrant` function from another `nonReentrant`
     * function is not supported. It is possible to prevent this from happening
     * by making the `nonReentrant` function external, and making it call a
     * `private` function that does the actual work.
     */
    modifier nonReentrant() {
        _nonReentrantBefore();
        _;
        _nonReentrantAfter();
    }

    function _nonReentrantBefore() private {
        // On the first call to nonReentrant, _status will be _NOT_ENTERED
        require(_status != _ENTERED, "ReentrancyGuard: reentrant call");

        // Any calls to nonReentrant after this point will fail
        _status = _ENTERED;
    }

    function _nonReentrantAfter() private {
        // By storing the original value once again, a refund is triggered (see
        // https://eips.ethereum.org/EIPS/eip-2200)
        _status = _NOT_ENTERED;
    }

    /**
     * @dev Returns true if the reentrancy guard is currently set to "entered", which indicates there is a
     * `nonReentrant` function in the call stack.
     */
    function _reentrancyGuardEntered() internal view returns (bool) {
        return _status == _ENTERED;
    }

    /**
     * @dev This empty reserved space is put in place to allow future versions to add new
     * variables without shifting down storage in the inheritance chain.
     * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps
     */
    uint256[49] private __gap;
}

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (utils/Address.sol)

pragma solidity ^0.8.1;

/**
 * @dev Collection of functions related to the address type
 */
library AddressUpgradeable {
    /**
     * @dev Returns true if `account` is a contract.
     *
     * [IMPORTANT]
     * ====
     * It is unsafe to assume that an address for which this function returns
     * false is an externally-owned account (EOA) and not a contract.
     *
     * Among others, `isContract` will return false for the following
     * types of addresses:
     *
     *  - an externally-owned account
     *  - a contract in construction
     *  - an address where a contract will be created
     *  - an address where a contract lived, but was destroyed
     *
     * Furthermore, `isContract` will also return true if the target contract within
     * the same transaction is already scheduled for destruction by `SELFDESTRUCT`,
     * which only has an effect at the end of a transaction.
     * ====
     *
     * [IMPORTANT]
     * ====
     * You shouldn't rely on `isContract` to protect against flash loan attacks!
     *
     * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets
     * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract
     * constructor.
     * ====
     */
    function isContract(address account) internal view returns (bool) {
        // This method relies on extcodesize/address.code.length, which returns 0
        // for contracts in construction, since the code is only stored at the end
        // of the constructor execution.

        return account.code.length > 0;
    }

    /**
     * @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.0/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].
     */
    function sendValue(address payable recipient, uint256 amount) internal {
        require(address(this).balance >= amount, "Address: insufficient balance");

        (bool success, ) = recipient.call{value: amount}("");
        require(success, "Address: unable to send value, recipient may have reverted");
    }

    /**
     * @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, it is bubbled up by this
     * function (like regular Solidity function calls).
     *
     * 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.
     *
     * _Available since v3.1._
     */
    function functionCall(address target, bytes memory data) internal returns (bytes memory) {
        return functionCallWithValue(target, data, 0, "Address: low-level call failed");
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with
     * `errorMessage` as a fallback revert reason when `target` reverts.
     *
     * _Available since v3.1._
     */
    function functionCall(
        address target,
        bytes memory data,
        string memory errorMessage
    ) internal returns (bytes memory) {
        return functionCallWithValue(target, data, 0, errorMessage);
    }

    /**
     * @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`.
     *
     * _Available since v3.1._
     */
    function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {
        return functionCallWithValue(target, data, value, "Address: low-level call with value failed");
    }

    /**
     * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but
     * with `errorMessage` as a fallback revert reason when `target` reverts.
     *
     * _Available since v3.1._
     */
    function functionCallWithValue(
        address target,
        bytes memory data,
        uint256 value,
        string memory errorMessage
    ) internal returns (bytes memory) {
        require(address(this).balance >= value, "Address: insufficient balance for call");
        (bool success, bytes memory returndata) = target.call{value: value}(data);
        return verifyCallResultFromTarget(target, success, returndata, errorMessage);
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
     * but performing a static call.
     *
     * _Available since v3.3._
     */
    function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {
        return functionStaticCall(target, data, "Address: low-level static call failed");
    }

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

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
     * but performing a delegate call.
     *
     * _Available since v3.4._
     */
    function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {
        return functionDelegateCall(target, data, "Address: low-level delegate call failed");
    }

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

    /**
     * @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling
     * the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract.
     *
     * _Available since v4.8._
     */
    function verifyCallResultFromTarget(
        address target,
        bool success,
        bytes memory returndata,
        string memory errorMessage
    ) internal view returns (bytes memory) {
        if (success) {
            if (returndata.length == 0) {
                // only check isContract if the call was successful and the return data is empty
                // otherwise we already know that it was a contract
                require(isContract(target), "Address: call to non-contract");
            }
            return returndata;
        } else {
            _revert(returndata, errorMessage);
        }
    }

    /**
     * @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the
     * revert reason or using the provided one.
     *
     * _Available since v4.3._
     */
    function verifyCallResult(
        bool success,
        bytes memory returndata,
        string memory errorMessage
    ) internal pure returns (bytes memory) {
        if (success) {
            return returndata;
        } else {
            _revert(returndata, errorMessage);
        }
    }

    function _revert(bytes memory returndata, string memory errorMessage) 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(errorMessage);
        }
    }
}

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.4) (utils/Context.sol)

pragma solidity ^0.8.0;
import {Initializable} from "../proxy/utils/Initializable.sol";

/**
 * @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 ContextUpgradeable is Initializable {
    function __Context_init() internal onlyInitializing {
    }

    function __Context_init_unchained() internal onlyInitializing {
    }
    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;
    }

    /**
     * @dev This empty reserved space is put in place to allow future versions to add new
     * variables without shifting down storage in the inheritance chain.
     * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps
     */
    uint256[50] private __gap;
}

// SPDX-License-Identifier: MIT
pragma solidity =0.8.19;

/**
 * @title ITokenPublicRaise
 * @notice Interface for a fixed-rate public raise that accepts native currency and
 *         accounts purchased token amounts per depositor.
 */
interface ITokenPublicRaise {
    /**
     * @notice Emitted on a successful deposit during the active raise window.
     * @param user      Depositor address.
     * @param amountIn  Accepted native amount in wei (may be capped by per-user/global limits).
     * @param tokensOut Accounted amount of sale tokens purchased for `amountIn`
     *                  using the current fixed exchange rate.
     */
    event Deposited(address indexed user, uint256 amountIn, uint256 tokensOut);

    /**
     * @notice Emitted when the treasury address is updated by the owner.
     * @param newTreasury The new destination address for collected native funds.
     */
    event TreasuryUpdated(address indexed newTreasury);

    /**
     * @notice Emitted when deposit limits are updated by the owner.
     * @param minDepositAmount Suggested minimum per-transaction deposit (native units, wei).
     * @param maxDepositAmount Maximum total native amount a single user may deposit (wei).
     * @param totalDepositCap  Global cap for total native deposits across all users (wei).
     */
    event DepositLimitsUpdated(uint256 minDepositAmount, uint256 maxDepositAmount, uint256 totalDepositCap);

    /**
     * @notice Emitted when the raise window (start/end timestamps) is updated by the owner.
     * @param startTimestamp Inclusive start timestamp.
     * @param endTimestamp   Inclusive end timestamp.
     */
    event RaiseWindowUpdated(uint256 startTimestamp, uint256 endTimestamp);

    /**
     * @notice Emitted when the fixed exchange rate is updated by the owner.
     * @dev The rate is expressed as "tokens per 1e18 native units".
     * @param tokenPricePerOneNative Number of tokens allocated per 1e18 native units (wei).
     */
    event ExchangeRateUpdated(uint256 tokenPricePerOneNative);

    /**
     * @notice Emitted when native funds are withdrawn to the treasury after the raise ends.
     * @param treasury Treasury address that received the funds.
     * @param amount   Amount of native currency (wei) transferred to `treasury`.
     */
    event TreasuryWithdrawn(address indexed treasury, uint256 amount);

    /**
     * @notice Initializes the raise configuration (proxy initializer).
     * @param startTimestamp_          Inclusive sale start timestamp.
     * @param endTimestamp_            Inclusive sale end timestamp.
     * @param minDepositAmount_        Suggested minimum per-transaction deposit (wei).
     * @param maxDepositAmount_        Maximum total native amount per user (wei).
     * @param totalDepositCap_         Global cap across all users (wei).
     * @param tokenPricePerOneNative_  Tokens per 1e18 native units (wei-denominated rate).
     * @param treasury_                Destination address for collected native funds.
     */
    function initialize(
        uint256 startTimestamp_,
        uint256 endTimestamp_,
        uint256 minDepositAmount_,
        uint256 maxDepositAmount_,
        uint256 totalDepositCap_,
        uint256 tokenPricePerOneNative_,
        address treasury_
    ) external;

    /**
     * @notice Deposits native currency during the active raise window at the fixed rate.
     * @dev The effective accepted amount may be capped by per-user and/or global remaining allowances.
     */
    function deposit() external payable;

    /**
     * @notice Withdraws the entire native balance to the treasury after the raise has ended.
     * @dev Only callable by the owner in the implementation.
     */
    function withdrawToTreasury() external;

    /**
     * @notice Updates the fixed exchange rate (tokens per 1e18 native units).
     * @param tokenPricePerOneNative_ New price (tokens per 1e18 native units).
     */
    function setTokenPricePerOneNative(uint256 tokenPricePerOneNative_) external;

    /**
     * @notice Updates the treasury address.
     * @param treasury_ New treasury address.
     */
    function setTreasury(address treasury_) external;

    /**
     * @notice Updates min/per-user/global deposit limits.
     * @param minDepositAmount_ Suggested minimum per-transaction deposit (wei).
     * @param maxDepositAmount_ Maximum total native amount per user (wei).
     * @param totalDepositCap_  Global cap across all users (wei).
     */
    function setDepositLimits(
        uint256 minDepositAmount_,
        uint256 maxDepositAmount_,
        uint256 totalDepositCap_
    ) external;

    /**
     * @notice Updates the start/end timestamps of the raise window.
     * @param startTimestamp_ Inclusive start timestamp.
     * @param endTimestamp_   Inclusive end timestamp.
     */
    function setRaiseWindow(uint256 startTimestamp_, uint256 endTimestamp_) external;

    /**
     * @notice Returns the maximum additional native amount `user_` can still deposit (in wei).
     * @param user_ The user address to query.
     * @return maxAllowed Maximum additional deposit permitted for `user_`.
     */
    function maxDeposit(address user_) external view returns (uint256 maxAllowed);

    /**
     * @notice Returns whether the raise window is currently active.
     * @return active True if `block.timestamp` ∈ [startTimestamp, endTimestamp], false otherwise.
     */
    function isRaiseActive() external view returns (bool active);

    /**
     * @notice Returns a snapshot of global config/state and the user’s counters.
     * @param user_ Address to query (use zero address for global-only fields).
     * @return active         Whether the raise is active.
     * @return start          Start timestamp.
     * @return end            End timestamp.
     * @return min            Suggested minimum per-transaction deposit.
     * @return max            Maximum per-user deposit.
     * @return globalCap      Global deposit cap.
     * @return price          Tokens per 1e18 native units.
     * @return totalIn        Total native deposited.
     * @return userIn         User’s native deposited (0 for zero address).
     * @return userOut        User’s accounted purchased tokens (0 for zero address).
     * @return userMaxDeposit User’s remaining allowed deposit (0 for zero address).
     */
    function getInfo(address user_)
        external
        view
        returns (
            bool active,
            uint256 start,
            uint256 end,
            uint256 min,
            uint256 max,
            uint256 globalCap,
            uint256 price,
            uint256 totalIn,
            uint256 userIn,
            uint256 userOut,
            uint256 userMaxDeposit
        );
}

Settings
{
  "evmVersion": "paris",
  "viaIR": true,
  "optimizer": {
    "enabled": true,
    "runs": 2000
  },
  "metadata": {
    "bytecodeHash": "none"
  },
  "outputSelection": {
    "*": {
      "*": [
        "evm.bytecode",
        "evm.deployedBytecode",
        "devdoc",
        "userdoc",
        "metadata",
        "abi"
      ]
    }
  }
}

Contract Security Audit

Contract ABI

API
[{"inputs":[],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"AddressZero","type":"error"},{"inputs":[],"name":"AmountZero","type":"error"},{"inputs":[],"name":"DepositAboveMax","type":"error"},{"inputs":[],"name":"DepositBelowMin","type":"error"},{"inputs":[],"name":"DepositCapReached","type":"error"},{"inputs":[],"name":"InvalidDepositLimits","type":"error"},{"inputs":[],"name":"InvalidRaiseWindow","type":"error"},{"inputs":[],"name":"NativeTransferFailed","type":"error"},{"inputs":[],"name":"RaiseNotActive","type":"error"},{"inputs":[],"name":"RaiseNotEnded","type":"error"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"minDepositAmount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"maxDepositAmount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"totalDepositCap","type":"uint256"}],"name":"DepositLimitsUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"user","type":"address"},{"indexed":false,"internalType":"uint256","name":"amountIn","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"tokensOut","type":"uint256"}],"name":"Deposited","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"tokenPricePerOneNative","type":"uint256"}],"name":"ExchangeRateUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint8","name":"version","type":"uint8"}],"name":"Initialized","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferStarted","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"startTimestamp","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"endTimestamp","type":"uint256"}],"name":"RaiseWindowUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"newTreasury","type":"address"}],"name":"TreasuryUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"treasury","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"TreasuryWithdrawn","type":"event"},{"inputs":[],"name":"acceptOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"deposit","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[],"name":"endTimestamp","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"user_","type":"address"}],"name":"getInfo","outputs":[{"internalType":"bool","name":"active","type":"bool"},{"internalType":"uint256","name":"start","type":"uint256"},{"internalType":"uint256","name":"end","type":"uint256"},{"internalType":"uint256","name":"min","type":"uint256"},{"internalType":"uint256","name":"max","type":"uint256"},{"internalType":"uint256","name":"globalCap","type":"uint256"},{"internalType":"uint256","name":"price","type":"uint256"},{"internalType":"uint256","name":"totalIn","type":"uint256"},{"internalType":"uint256","name":"userIn","type":"uint256"},{"internalType":"uint256","name":"userOut","type":"uint256"},{"internalType":"uint256","name":"userMaxDeposit","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"startTimestamp_","type":"uint256"},{"internalType":"uint256","name":"endTimestamp_","type":"uint256"},{"internalType":"uint256","name":"minDepositAmount_","type":"uint256"},{"internalType":"uint256","name":"maxDepositAmount_","type":"uint256"},{"internalType":"uint256","name":"totalDepositCap_","type":"uint256"},{"internalType":"uint256","name":"tokenPricePerOneNative_","type":"uint256"},{"internalType":"address","name":"treasury_","type":"address"}],"name":"initialize","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"isRaiseActive","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"user_","type":"address"}],"name":"maxDeposit","outputs":[{"internalType":"uint256","name":"maxAllowed","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"maxDepositAmount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"minDepositAmount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"pendingOwner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"minDepositAmount_","type":"uint256"},{"internalType":"uint256","name":"maxDepositAmount_","type":"uint256"},{"internalType":"uint256","name":"totalDepositCap_","type":"uint256"}],"name":"setDepositLimits","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"startTimestamp_","type":"uint256"},{"internalType":"uint256","name":"endTimestamp_","type":"uint256"}],"name":"setRaiseWindow","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenPricePerOneNative_","type":"uint256"}],"name":"setTokenPricePerOneNative","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"treasury_","type":"address"}],"name":"setTreasury","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"startTimestamp","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"tokenPricePerOneNative","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalDepositCap","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalDeposited","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"treasury","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"user","type":"address"}],"name":"userDeposited","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"user","type":"address"}],"name":"userTokensAllocated","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"withdrawToTreasury","outputs":[],"stateMutability":"nonpayable","type":"function"},{"stateMutability":"payable","type":"receive"}]

608080604052346100c1576000549060ff8260081c1661006f575060ff80821603610034575b604051610ff090816100c78239f35b60ff90811916176000557f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb3847402498602060405160ff8152a138610025565b62461bcd60e51b815260206004820152602760248201527f496e697469616c697a61626c653a20636f6e747261637420697320696e697469604482015266616c697a696e6760c81b6064820152608490fd5b600080fdfe60406080815260049081361015610028575b5050361561001e57600080fd5b610026610b05565b005b600091823560e01c908163371d8646146109775781633a241b3f14610952578163402d267d146109255781635845350e1461073d5781635db88e851461071e57816361d027b3146106f6578163645006ca146106d7578163715018a61461066657816379ba5097146105ce5781637e80c1861461046d5781638092be4a146104365781638169e61f146103ff5781638da5cb5b146103d75781638ed83271146103b857816399a0a97314610392578163a85adeab14610373578163bf96487c1461034757508063c90ebd3514610329578063d0e30db014610315578063e30c3978146102ee578063e6fd48bc146102d0578063f0f44260146102a3578063f2fde38b14610228578063ff50abdc1461020a5763ffdd5cf103610011573461020657602060031936011261020657610160916101616109a4565b908081809361016e610dce565b9560ca549060cb5460cc549060cd549260ce549460cf549660d054986001600160a01b038216806101d9575b50505081519b15158c5260208c01528a01526060890152608088015260a087015260c086015260e0850152610100840152610120830152610140820152f35b929c5099509950885260d16020526101fd81808a20549960d2602052205499610d4b565b9938808061019a565b5080fd5b503461020657816003193601126102065760209060d0549051908152f35b82346102a05760206003193601126102a0576102426109a4565b61024a610a1c565b6001600160a01b03809116908173ffffffffffffffffffffffffffffffffffffffff196065541617606555603354167f38d16b8cac22d99fc7c124b9cd0de2d3fa1faef420bfe791d8c362d765e227008380a380f35b80fd5b82346102a05760206003193601126102a0576102cd6102c06109a4565b6102c8610a1c565b610df3565b80f35b503461020657816003193601126102065760209060ca549051908152f35b50346102065781600319360112610206576020906001600160a01b03606554169051908152f35b82806003193601126102a0576102cd610b05565b503461020657816003193601126102065760209060cf549051908152f35b9190503461036f57600319360112610206576102cd90610365610a1c565b6024359035610f33565b8280fd5b50503461020657816003193601126102065760209060cb549051908152f35b5050346102065781600319360112610206576020906103af610dce565b90519015158152f35b50503461020657816003193601126102065760209060cd549051908152f35b5050346102065781600319360112610206576020906001600160a01b03603354169051908152f35b50503461020657602060031936011261020657806020926001600160a01b036104266109a4565b16815260d2845220549051908152f35b50503461020657602060031936011261020657806020926001600160a01b0361045d6109a4565b16815260d1845220549051908152f35b90503461036f578260031936011261036f57610487610a1c565b61048f610ce9565b60cb544211156105a75747906104a482610fb2565b6001600160a01b039084808080868660c954165af13d156105a25767ffffffffffffffff3d81811161058f578651917fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0603f81601f85011601168301908382109082111761057c57875281528660203d92013e5b1561055557507f41fdd680478135993bc53fb2ffaf9560951b57ef62ff6badd02b61e018b4f17f9160209160c954169351908152a2600160975580f35b83517ff4b3b1bc000000000000000000000000000000000000000000000000000000008152fd5b602489604187634e487b7160e01b835252fd5b602488604186634e487b7160e01b835252fd5b610518565b90517faf898cee000000000000000000000000000000000000000000000000000000008152fd5b9190503461036f578260031936011261036f57336001600160a01b0360655416036105fd57826102cd336109bf565b906020608492519162461bcd60e51b8352820152602960248201527f4f776e61626c6532537465703a2063616c6c6572206973206e6f74207468652060448201527f6e6577206f776e657200000000000000000000000000000000000000000000006064820152fd5b83346102a057806003193601126102a05761067f610a1c565b806001600160a01b0373ffffffffffffffffffffffffffffffffffffffff198060655416606555603354908116603355167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e08280a380f35b50503461020657816003193601126102065760209060cc549051908152f35b5050346102065781600319360112610206576020906001600160a01b0360c954169051908152f35b50503461020657816003193601126102065760209060ce549051908152f35b90503461036f5760e060031936011261036f5760c435906001600160a01b03821682036109215783549160ff8360081c161592838094610914575b80156108fd575b15610894576108009291818560017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff006107ef9516178955610866575b506107c4610ae5565b6107cc610ae5565b6107e560ff885460081c166107e081610a74565b610a74565b6001609755610df3565b610365608435606435604435610e72565b61080b60a435610ef9565b610813575080f35b60207f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb3847402498917fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00ff84541684555160018152a180f35b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff000016610101178755386107bb565b608483602087519162461bcd60e51b8352820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201527f647920696e697469616c697a65640000000000000000000000000000000000006064820152fd5b50303b15801561077f5750600160ff82161461077f565b50600160ff821610610778565b8380fd5b5050346102065760206003193601126102065760209061094b6109466109a4565b610d4b565b9051908152f35b839034610206576020600319360112610206576102cd90610971610a1c565b35610ef9565b839034610206576060600319360112610206576102cd90610996610a1c565b604435906024359035610e72565b600435906001600160a01b03821682036109ba57565b600080fd5b73ffffffffffffffffffffffffffffffffffffffff199081606554166065556033546001600160a01b038092168093821617603355167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0600080a3565b6001600160a01b03603354163303610a3057565b606460405162461bcd60e51b815260206004820152602060248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152fd5b15610a7b57565b608460405162461bcd60e51b815260206004820152602b60248201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960448201527f6e697469616c697a696e670000000000000000000000000000000000000000006064820152fd5b610afa60ff60005460081c166107e081610a74565b610b03336109bf565b565b610b0d610ce9565b610b15610dce565b15610cbf57610b2334610fb2565b60d05460ce5481818110610cb157505060005b15610c8757610b4433610d4b565b8015908115610c7d575b50610c53573360005260d16020526040610b6c816000205434610de6565b60cc5411610c2a5760cf5490813402913483041434151715610c1457610bc8670de0b6b3a76400007f73a19dd210f1a7f902193214c0ee91dd35ee5b4d920cba8d519eca65a7b488ca930493610bc185610fb2565b3490610de6565b60d0553360005260d160205280600020610be3348254610de6565b90553360005260d260205280600020610bfd848254610de6565b905580519234845260208401523392a26001609755565b634e487b7160e01b600052601160045260246000fd5b600490517fd1f6358f000000000000000000000000000000000000000000000000000000008152fd5b60046040517f475826fa000000000000000000000000000000000000000000000000000000008152fd5b9050341138610b4e565b60046040517f4b9f2b54000000000000000000000000000000000000000000000000000000008152fd5b610cba91610d3e565b610b36565b60046040517f71f28f94000000000000000000000000000000000000000000000000000000008152fd5b600260975414610cfa576002609755565b606460405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c006044820152fd5b91908203918211610c1457565b610d53610dce565b15610dc85760d05460ce54808210610db05750506001600160a01b036000915b16600090815260d1602052604081205460cd5481811115610da957610d989250610d3e565b80821015610da4575090565b905090565b5050610d98565b6001600160a01b0391610dc291610d3e565b91610d73565b50600090565b60ca5442101580610ddc5790565b5060cb5442111590565b91908201809211610c1457565b6001600160a01b03168015610e48578073ffffffffffffffffffffffffffffffffffffffff1960c954161760c9557f7dae230f18360d76a040c81f050aa14eb9d6dc7901b20fc5d855e2a20fe814d1600080a2565b60046040517f9fabe1c1000000000000000000000000000000000000000000000000000000008152fd5b610e7b82610fb2565b610e8483610fb2565b818111610ecf577fa749cb7617d49429c02d5eac1160aa687470bab76159e9047cf78e55a12e952b926060928260cc558060cd558160ce5560405192835260208301526040820152a1565b60046040517f7211b830000000000000000000000000000000000000000000000000000000008152fd5b60207f388f446e9526fe5c9af20a5919b342370c8a7c0cb05245afe1e545658fa3cdba91610f2681610fb2565b8060cf55604051908152a1565b90610f3d82610fb2565b610f4681610fb2565b81811115610f8857816040917f39169eaa46f1309e047fd5d2ae4416afac3b0ec091322005862210c2de80dea89360ca558060cb5582519182526020820152a1565b60046040517fdd458d44000000000000000000000000000000000000000000000000000000008152fd5b15610fb957565b60046040517fcbca5aa2000000000000000000000000000000000000000000000000000000008152fdfea164736f6c6343000813000a

Deployed Bytecode

0x60406080815260049081361015610028575b5050361561001e57600080fd5b610026610b05565b005b600091823560e01c908163371d8646146109775781633a241b3f14610952578163402d267d146109255781635845350e1461073d5781635db88e851461071e57816361d027b3146106f6578163645006ca146106d7578163715018a61461066657816379ba5097146105ce5781637e80c1861461046d5781638092be4a146104365781638169e61f146103ff5781638da5cb5b146103d75781638ed83271146103b857816399a0a97314610392578163a85adeab14610373578163bf96487c1461034757508063c90ebd3514610329578063d0e30db014610315578063e30c3978146102ee578063e6fd48bc146102d0578063f0f44260146102a3578063f2fde38b14610228578063ff50abdc1461020a5763ffdd5cf103610011573461020657602060031936011261020657610160916101616109a4565b908081809361016e610dce565b9560ca549060cb5460cc549060cd549260ce549460cf549660d054986001600160a01b038216806101d9575b50505081519b15158c5260208c01528a01526060890152608088015260a087015260c086015260e0850152610100840152610120830152610140820152f35b929c5099509950885260d16020526101fd81808a20549960d2602052205499610d4b565b9938808061019a565b5080fd5b503461020657816003193601126102065760209060d0549051908152f35b82346102a05760206003193601126102a0576102426109a4565b61024a610a1c565b6001600160a01b03809116908173ffffffffffffffffffffffffffffffffffffffff196065541617606555603354167f38d16b8cac22d99fc7c124b9cd0de2d3fa1faef420bfe791d8c362d765e227008380a380f35b80fd5b82346102a05760206003193601126102a0576102cd6102c06109a4565b6102c8610a1c565b610df3565b80f35b503461020657816003193601126102065760209060ca549051908152f35b50346102065781600319360112610206576020906001600160a01b03606554169051908152f35b82806003193601126102a0576102cd610b05565b503461020657816003193601126102065760209060cf549051908152f35b9190503461036f57600319360112610206576102cd90610365610a1c565b6024359035610f33565b8280fd5b50503461020657816003193601126102065760209060cb549051908152f35b5050346102065781600319360112610206576020906103af610dce565b90519015158152f35b50503461020657816003193601126102065760209060cd549051908152f35b5050346102065781600319360112610206576020906001600160a01b03603354169051908152f35b50503461020657602060031936011261020657806020926001600160a01b036104266109a4565b16815260d2845220549051908152f35b50503461020657602060031936011261020657806020926001600160a01b0361045d6109a4565b16815260d1845220549051908152f35b90503461036f578260031936011261036f57610487610a1c565b61048f610ce9565b60cb544211156105a75747906104a482610fb2565b6001600160a01b039084808080868660c954165af13d156105a25767ffffffffffffffff3d81811161058f578651917fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0603f81601f85011601168301908382109082111761057c57875281528660203d92013e5b1561055557507f41fdd680478135993bc53fb2ffaf9560951b57ef62ff6badd02b61e018b4f17f9160209160c954169351908152a2600160975580f35b83517ff4b3b1bc000000000000000000000000000000000000000000000000000000008152fd5b602489604187634e487b7160e01b835252fd5b602488604186634e487b7160e01b835252fd5b610518565b90517faf898cee000000000000000000000000000000000000000000000000000000008152fd5b9190503461036f578260031936011261036f57336001600160a01b0360655416036105fd57826102cd336109bf565b906020608492519162461bcd60e51b8352820152602960248201527f4f776e61626c6532537465703a2063616c6c6572206973206e6f74207468652060448201527f6e6577206f776e657200000000000000000000000000000000000000000000006064820152fd5b83346102a057806003193601126102a05761067f610a1c565b806001600160a01b0373ffffffffffffffffffffffffffffffffffffffff198060655416606555603354908116603355167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e08280a380f35b50503461020657816003193601126102065760209060cc549051908152f35b5050346102065781600319360112610206576020906001600160a01b0360c954169051908152f35b50503461020657816003193601126102065760209060ce549051908152f35b90503461036f5760e060031936011261036f5760c435906001600160a01b03821682036109215783549160ff8360081c161592838094610914575b80156108fd575b15610894576108009291818560017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff006107ef9516178955610866575b506107c4610ae5565b6107cc610ae5565b6107e560ff885460081c166107e081610a74565b610a74565b6001609755610df3565b610365608435606435604435610e72565b61080b60a435610ef9565b610813575080f35b60207f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb3847402498917fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00ff84541684555160018152a180f35b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff000016610101178755386107bb565b608483602087519162461bcd60e51b8352820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201527f647920696e697469616c697a65640000000000000000000000000000000000006064820152fd5b50303b15801561077f5750600160ff82161461077f565b50600160ff821610610778565b8380fd5b5050346102065760206003193601126102065760209061094b6109466109a4565b610d4b565b9051908152f35b839034610206576020600319360112610206576102cd90610971610a1c565b35610ef9565b839034610206576060600319360112610206576102cd90610996610a1c565b604435906024359035610e72565b600435906001600160a01b03821682036109ba57565b600080fd5b73ffffffffffffffffffffffffffffffffffffffff199081606554166065556033546001600160a01b038092168093821617603355167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0600080a3565b6001600160a01b03603354163303610a3057565b606460405162461bcd60e51b815260206004820152602060248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152fd5b15610a7b57565b608460405162461bcd60e51b815260206004820152602b60248201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960448201527f6e697469616c697a696e670000000000000000000000000000000000000000006064820152fd5b610afa60ff60005460081c166107e081610a74565b610b03336109bf565b565b610b0d610ce9565b610b15610dce565b15610cbf57610b2334610fb2565b60d05460ce5481818110610cb157505060005b15610c8757610b4433610d4b565b8015908115610c7d575b50610c53573360005260d16020526040610b6c816000205434610de6565b60cc5411610c2a5760cf5490813402913483041434151715610c1457610bc8670de0b6b3a76400007f73a19dd210f1a7f902193214c0ee91dd35ee5b4d920cba8d519eca65a7b488ca930493610bc185610fb2565b3490610de6565b60d0553360005260d160205280600020610be3348254610de6565b90553360005260d260205280600020610bfd848254610de6565b905580519234845260208401523392a26001609755565b634e487b7160e01b600052601160045260246000fd5b600490517fd1f6358f000000000000000000000000000000000000000000000000000000008152fd5b60046040517f475826fa000000000000000000000000000000000000000000000000000000008152fd5b9050341138610b4e565b60046040517f4b9f2b54000000000000000000000000000000000000000000000000000000008152fd5b610cba91610d3e565b610b36565b60046040517f71f28f94000000000000000000000000000000000000000000000000000000008152fd5b600260975414610cfa576002609755565b606460405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c006044820152fd5b91908203918211610c1457565b610d53610dce565b15610dc85760d05460ce54808210610db05750506001600160a01b036000915b16600090815260d1602052604081205460cd5481811115610da957610d989250610d3e565b80821015610da4575090565b905090565b5050610d98565b6001600160a01b0391610dc291610d3e565b91610d73565b50600090565b60ca5442101580610ddc5790565b5060cb5442111590565b91908201809211610c1457565b6001600160a01b03168015610e48578073ffffffffffffffffffffffffffffffffffffffff1960c954161760c9557f7dae230f18360d76a040c81f050aa14eb9d6dc7901b20fc5d855e2a20fe814d1600080a2565b60046040517f9fabe1c1000000000000000000000000000000000000000000000000000000008152fd5b610e7b82610fb2565b610e8483610fb2565b818111610ecf577fa749cb7617d49429c02d5eac1160aa687470bab76159e9047cf78e55a12e952b926060928260cc558060cd558160ce5560405192835260208301526040820152a1565b60046040517f7211b830000000000000000000000000000000000000000000000000000000008152fd5b60207f388f446e9526fe5c9af20a5919b342370c8a7c0cb05245afe1e545658fa3cdba91610f2681610fb2565b8060cf55604051908152a1565b90610f3d82610fb2565b610f4681610fb2565b81811115610f8857816040917f39169eaa46f1309e047fd5d2ae4416afac3b0ec091322005862210c2de80dea89360ca558060cb5582519182526020820152a1565b60046040517fdd458d44000000000000000000000000000000000000000000000000000000008152fd5b15610fb957565b60046040517fcbca5aa2000000000000000000000000000000000000000000000000000000008152fdfea164736f6c6343000813000a

Block Transaction Gas Used Reward
view all blocks ##produced##

Block Uncle Number Difficulty Gas Used Reward
View All Uncles
Loading...
Loading
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  ]

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.