ETH Price: $2,863.73 (-2.70%)

Contract

0x29b4f619840621719159D30ca17F9306aB7Cdb60
 

Overview

ETH Balance

0 ETH

ETH Value

$0.00

Token Holdings

More Info

Private Name Tags

Multichain Info

No addresses found
Transaction Hash
Block
From
To
Take Locked50423172024-06-20 14:40:49584 days ago1718894449IN
0x29b4f619...6aB7Cdb60
0 ETH0.00003020.32684253
Deposit50415072024-06-20 14:13:49584 days ago1718892829IN
0x29b4f619...6aB7Cdb60
0 ETH0.000046120.25474067
Deposit50414662024-06-20 14:12:27584 days ago1718892747IN
0x29b4f619...6aB7Cdb60
0 ETH0.000497752.75080348
Deposit50407182024-06-20 13:47:31584 days ago1718891251IN
0x29b4f619...6aB7Cdb60
0 ETH0.000490192.70906596
Deposit50406342024-06-20 13:44:43584 days ago1718891083IN
0x29b4f619...6aB7Cdb60
0 ETH0.000038750.2076
Deposit50382122024-06-20 12:23:59584 days ago1718886239IN
0x29b4f619...6aB7Cdb60
0 ETH0.000491452.71576917
Deposit50378392024-06-20 12:11:33584 days ago1718885493IN
0x29b4f619...6aB7Cdb60
0 ETH0.00049622.74212068
Deposit50373892024-06-20 11:56:33584 days ago1718884593IN
0x29b4f619...6aB7Cdb60
0 ETH0.000518512.77952869
Deposit50358692024-06-20 11:05:53584 days ago1718881553IN
0x29b4f619...6aB7Cdb60
0 ETH0.00007240.4
Deposit50346172024-06-20 10:24:09584 days ago1718879049IN
0x29b4f619...6aB7Cdb60
0 ETH0.000332032.9009422
Deposit50345762024-06-20 10:22:47584 days ago1718878967IN
0x29b4f619...6aB7Cdb60
0 ETH0.000332022.90115972
Deposit50345212024-06-20 10:20:57584 days ago1718878857IN
0x29b4f619...6aB7Cdb60
0 ETH0.000541162.90105069
User Whitelist A...50345032024-06-20 10:20:21584 days ago1718878821IN
0x29b4f619...6aB7Cdb60
0 ETH0.000024380.40119188
Deposit50345032024-06-20 10:20:21584 days ago1718878821IN
0x29b4f619...6aB7Cdb60
0 ETH0.000524682.89974028
Deposit50340192024-06-20 10:04:13584 days ago1718877853IN
0x29b4f619...6aB7Cdb60
0 ETH0.00051872.85365448
Deposit50336782024-06-20 9:52:51584 days ago1718877171IN
0x29b4f619...6aB7Cdb60
0 ETH0.000517662.86092763
Deposit50334512024-06-20 9:45:17584 days ago1718876717IN
0x29b4f619...6aB7Cdb60
0 ETH0.000065540.36217362
Deposit50323122024-06-20 9:07:19584 days ago1718874439IN
0x29b4f619...6aB7Cdb60
0 ETH0.000525762.90566644
User Whitelist A...50306302024-06-20 8:11:15584 days ago1718871075IN
0x29b4f619...6aB7Cdb60
0 ETH0.000024430.40189614
Deposit50287742024-06-20 7:09:23584 days ago1718867363IN
0x29b4f619...6aB7Cdb60
0 ETH0.000507492.86812803
Deposit50284032024-06-20 6:57:01584 days ago1718866621IN
0x29b4f619...6aB7Cdb60
0 ETH0.000061480.3397
Deposit50279342024-06-20 6:41:23584 days ago1718865683IN
0x29b4f619...6aB7Cdb60
0 ETH0.000503692.78364506
Deposit50276002024-06-20 6:30:15584 days ago1718865015IN
0x29b4f619...6aB7Cdb60
0 ETH0.000049240.2720717
Deposit50271952024-06-20 6:16:45584 days ago1718864205IN
0x29b4f619...6aB7Cdb60
0 ETH0.000498332.75403522
Deposit50267252024-06-20 6:01:05584 days ago1718863265IN
0x29b4f619...6aB7Cdb60
0 ETH0.000465232.71499994
View all transactions

Latest 1 internal transaction

Advanced mode:
Parent Transaction Hash Block From To
49125422024-06-17 14:34:59587 days ago1718634899  Contract Creation0 ETH

Cross-Chain Transactions
Loading...
Loading

Minimal Proxy Contract for 0x9c7031de848362b0e9349990b3a34681f1eae065

Contract Name:
TokenSaleUSDB

Compiler Version
v0.8.19+commit.7dd6d404

Optimization Enabled:
No with 200 runs

Other Settings:
default evmVersion

Contract Source Code (Solidity Standard Json-Input format)

// SPDX-License-Identifier: UNLICENSED

pragma solidity ^0.8.11;

import "@openzeppelin/contracts-upgradeable/security/ReentrancyGuardUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/token/ERC20/utils/SafeERC20Upgradeable.sol";
import "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";
import "./interfaces/ITokenSale.sol";
import "./interfaces/IAdmin.sol";
import "./interfaces/IERC20D.sol";
import "./interfaces/IPancakeRouter01.sol";
import "./interfaces/IPancakeFactory.sol";

interface IBlastPoints {
    function configurePointsOperator(address operator) external;
    function configurePointsOperatorOnBehalf(
        address contractAddress,
        address operator
    ) external;
}

contract TokenSaleUSDB is
    Initializable,
    ITokenSale,
    ReentrancyGuardUpgradeable
{
    using SafeERC20Upgradeable for IERC20D;

    uint256 constant POINT_BASE = 10000;
    uint256 constant ETH_DECIMAL = 1e18;
    bytes32 constant DEFAULT_ADMIN_ROLE = 0x00;

    address public marketingWallet;
    address public creator;

    uint256 public maxAllocation;
    uint256 public platformTax;
    uint256 public lockinPeriod;
    uint256 public tokenPrice;

    bool public isKYCEnabled;
    bool public liqAdded;

    Params public params;
    Config public config;
    IERC20D public USDB;
    IPancakeRouter01 public router;
    IPancakeFactory public factory;
    IAdmin admin;
    Epoch public epoch;
    bool isRaiseClaimed;
    bytes32 public constant OPERATOR = keccak256("OPERATOR");
    address[] public usersOnDeposit;

    mapping(address => Staked) public stakes;
    mapping(address => uint256) public tokensaleTiers;
    mapping(address => uint256) public userDepositIndex;

    State public state;

    function initialize(
        Params calldata _params,
        address _admin,
        address _creator,
        uint256 _maxAllocation,
        uint256 _platformTax,
        bool _isKYC
    ) external initializer {
        params = _params;
        admin = IAdmin(_admin);
        creator = _creator;
        state.totalSupplyInValue = _maxAllocation;
        USDB = IERC20D(0x4300000000000000000000000000000000000003);
        marketingWallet = admin.wallet();
        maxAllocation = _maxAllocation;
        platformTax = _platformTax;
        router = IPancakeRouter01(params.router);
        factory = IPancakeFactory(router.factory());
        isKYCEnabled = _isKYC;
        liqAdded = true;
        tokenPrice = (_maxAllocation * ETH_DECIMAL) / _params.totalSupply;
        IBlastPoints(0x2536FE9ab3F511540F2f9e2eC2A805005C3Dd800)
            .configurePointsOperator(
                0x8C5fFc7D23e6BF7dA90c68AA9F4b2F638BeaB890
            );
        __ReentrancyGuard_init();
    }

    function setConfig(Config memory _config, address _creator) external {
        require(creator == _creator, "Only Creator can Call");
        require(config.NoOfVestingIntervals == 0, "Already triggered");
        config = _config;
        emit SetConfig(_config);
    }

    function userWhitelistAllocation(
        address[] calldata users,
        uint256[] calldata allocations
    ) public {
        require(admin.hasRole(OPERATOR, msg.sender), "onlyOperator");
        require(users.length == allocations.length, "Invalid length");
        for (uint256 i = 0; i < users.length; i++)
            tokensaleTiers[users[i]] = allocations[i];
        emit UserWhitelistAllocation(users, allocations);
    }

    function checkingEpoch() internal {
        uint256 time = block.timestamp;
        if (
            epoch != Epoch.Private &&
            time >= params.saleStart &&
            time <= params.saleEnd
        ) {
            epoch = Epoch.Private;
            return;
        }
        if ((epoch != Epoch.Finished && (time > params.saleEnd))) {
            epoch = Epoch.Finished;
            lockinPeriod = uint32(block.timestamp);
            return;
        }
    }

    function _onlyAdmin() internal view {
        require(
            admin.hasRole(DEFAULT_ADMIN_ROLE, msg.sender) ||
                msg.sender == address(admin),
            "onlyadmin"
        );
    }

    function deposit(uint256 _amount) external {
        if (isKYCEnabled)
            require(admin.isKYCDone(msg.sender) == true, "KYC not done");
        address sender = msg.sender;
        require(!admin.blacklist(address(this), sender), "Blacklisted");
        checkingEpoch();

        require(epoch == Epoch.Private, "Incorrect time");
        require(_amount > 0, "0 deposit");

        if (userDepositIndex[sender] == 0) {
            usersOnDeposit.push(sender);
            userDepositIndex[sender] = usersOnDeposit.length;
        }
        if (epoch == Epoch.Private) _processPrivate(sender, _amount);
    }

    function _processPrivate(address _sender, uint256 _amount) internal {
        Staked storage s = stakes[_sender];
        uint256 amount = _amount;
        uint256 sum = s.amount + amount;

        uint256 maxAllocationOfUser = tokensaleTiers[_sender] == 0
            ? params.baseLine
            : tokensaleTiers[_sender];

        require(sum <= maxAllocationOfUser, "upto max allocation");

        s.amount += amount;
        state.totalSold += amount;
        USDB.safeTransferFrom(_sender, address(this), amount);

        emit DepositPrivate(_sender, _amount, address(this));
    }

    function takeUSDBRaised() public nonReentrant {
        checkingEpoch();
        require(epoch == Epoch.Finished, "Not time yet");
        require(!isRaiseClaimed, "Already paid");

        uint256 earned = state.totalSold > state.totalSupplyInValue
            ? state.totalSupplyInValue
            : state.totalSold;

        isRaiseClaimed = true;
        if (earned > 0) {
            uint earning = (earned * (platformTax)) / POINT_BASE;
            USDB.safeTransfer(admin.wallet(), earning);
            earned =
                (earned * (POINT_BASE - params.liqudityPercentage)) /
                POINT_BASE;
            USDB.safeTransfer(creator, earned - earning);
        }
        if (state.totalSold < state.totalSupplyInValue) {
            uint unsold = state.totalSupplyInValue - state.totalSold;
            uint unsoldTokens = (unsold * ETH_DECIMAL) / tokenPrice;
            if (params.burnUnsold) {
                IERC20D(params.tokenAddress).safeTransfer(
                    0x000000000000000000000000000000000000dEaD,
                    unsoldTokens
                );
            } else {
                IERC20D(params.tokenAddress).safeTransfer(
                    creator,
                    unsoldTokens
                );
            }
        }

        emit RaiseClaimed(creator, earned);
    }

    function addLiq() external nonReentrant {
        require(isRaiseClaimed, "takeUSDBRaised not called");
        require(
            block.timestamp >= lockinPeriod + config.LiqGenerationTime,
            "Lockin period is not over yet"
        );
        require(liqAdded, "liqAdded");
        uint USDBAmount = state.totalSold > state.totalSupplyInValue
            ? state.totalSupplyInValue
            : state.totalSold;
        USDBAmount = (USDBAmount * (params.liqudityPercentage)) / POINT_BASE;

        uint tokenAmount = state.totalSold > state.totalSupplyInValue
            ? params.tokenLiquidity
            : (params.tokenLiquidity * state.totalSold) /
                state.totalSupplyInValue;

        USDB.safeApprove(address(router), USDBAmount);
        IERC20D(params.tokenAddress).safeApprove(address(router), tokenAmount);
        router.addLiquidity(
            address(USDB),
            params.tokenAddress,
            USDBAmount,
            tokenAmount,
            0,
            0,
            address(this),
            block.timestamp + 10 minutes
        );
        if (params.tokenLiquidity - tokenAmount > 0)
            IERC20D(params.tokenAddress).safeTransfer(
                creator,
                params.tokenLiquidity - tokenAmount
            );
        lockinPeriod = block.timestamp;
        liqAdded = false;
    }

    function claimLP() external {
        require(
            isRaiseClaimed && !liqAdded,
            "takeUSDBRaised || addliq not called"
        );
        require(
            block.timestamp >= lockinPeriod + config.LPLockin,
            "Lockin period is not over yet"
        );
        address pair = factory.getPair(address(USDB), params.tokenAddress);
        uint256 liquidity = IERC20D(pair).balanceOf(address(this));
        if (liquidity > 0) IERC20D(pair).safeTransfer(creator, liquidity);
    }

    function claim() external nonReentrant {
        require(
            uint8(epoch) > 1 && !admin.blockClaim(address(this)),
            "TokenSale: Not time or not allowed"
        );
        require(isRaiseClaimed, "takeUSDBRaised not called");
        require(
            uint8(epoch) > 1 && !admin.blockClaim(address(this)),
            "Not time or not allowed"
        );

        Staked storage s = stakes[msg.sender];
        require(s.amount != 0, "No Deposit");
        if (s.share == 0) (s.share, s.left) = _claim(s);
        require(s.left != 0, "Nothing to Claim");

        uint bal = USDB.balanceOf(address(this));
        uint left = s.left < bal ? s.left : bal;
        s.left -= left;
        USDB.safeTransfer(msg.sender, left);
        emit Claim(msg.sender, left);
    }

    function vesting() external nonReentrant {
        require(
            isRaiseClaimed && !liqAdded,
            "takeUSDBRaised || addLiq not called"
        );
        require(
            uint32(block.timestamp) >= lockinPeriod + config.vestingPeriod,
            "vesting period is not over yet"
        );
        require(
            uint8(epoch) > 1 && !admin.blockClaim(address(this)),
            "Not time or not allowed"
        );

        Staked storage s = stakes[msg.sender];
        require(s.amount != 0, "No Deposit");
        if (s.share == 0) (s.share, s.left) = _claim(s);
        uint bal = IERC20D(params.tokenAddress).balanceOf(address(this));
        uint amountFinal;
        if (s.amountFinal == 0) {
            amountFinal = (s.share * ETH_DECIMAL) / tokenPrice < bal
                ? (s.share * ETH_DECIMAL) / tokenPrice
                : bal;
            s.amountFinal = amountFinal;
        } else {
            amountFinal = s.amountFinal;
        }
        require(amountFinal > s.claimed, "Already Claimed");

        uint vestingIntervals = block.timestamp <
            (lockinPeriod + config.vestingPeriod + config.vestingDistribution)
            ? 1
            : ((block.timestamp - lockinPeriod - config.vestingPeriod) /
                config.vestingDistribution) + 1;
        uint amount;
        if (vestingIntervals > config.NoOfVestingIntervals)
            vestingIntervals = config.NoOfVestingIntervals;
        require(
            vestingIntervals > s.vestingPoint,
            "Already claimed for this point"
        );
        if (vestingIntervals == config.NoOfVestingIntervals) {
            amount = amountFinal - s.claimed;
        } else {
            uint amountFirst = (amountFinal * config.FirstVestPercentage) /
                POINT_BASE;
            amount = amountFirst;
            if (vestingIntervals > 1) {
                uint claimed = s.claimed > 0 ? s.claimed - amountFirst : 0;
                amount = amountFinal - amountFirst;
                amount =
                    ((amount * (vestingIntervals - 1)) /
                        (config.NoOfVestingIntervals - 1)) -
                    claimed;
                if (s.claimed == 0) amount += amountFirst;
            }
        }
        s.vestingPoint = vestingIntervals;
        s.claimed += amount;
        IERC20D(params.tokenAddress).safeTransfer(msg.sender, amount);

        emit Vest(msg.sender, amount);
    }

    function _claim(
        Staked memory _s
    ) internal view returns (uint256, uint256 left) {
        if (state.totalSold > state.totalSupplyInValue) {
            _s.share = (_s.amount * state.totalSupplyInValue) / state.totalSold;
            left = _s.amount - _s.share;
        } else {
            _s.share = _s.amount;
        }

        return (_s.share, left);
    }

    function canClaim(address _user) external view returns (uint256, uint256) {
        return _claim(stakes[_user]);
    }

    function takeLocked() external {
        _onlyAdmin();
        require(block.timestamp >= (params.saleEnd + 600), "Not ended");
        uint amountUSDB = USDB.balanceOf(address(this));
        if (amountUSDB > 0) USDB.safeTransfer(admin.wallet(), amountUSDB);
    }
}

// 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.4) (token/ERC20/extensions/IERC20Permit.sol)

pragma solidity ^0.8.0;

/**
 * @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 IERC20PermitUpgradeable {
    /**
     * @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);
}

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/IERC20.sol)

pragma solidity ^0.8.0;

/**
 * @dev Interface of the ERC20 standard as defined in the EIP.
 */
interface IERC20Upgradeable {
    /**
     * @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 amount of tokens in existence.
     */
    function totalSupply() external view returns (uint256);

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

    /**
     * @dev Moves `amount` 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 amount) 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 `amount` 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 amount) external returns (bool);

    /**
     * @dev Moves `amount` tokens from `from` to `to` using the
     * allowance mechanism. `amount` 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 amount) external returns (bool);
}

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.3) (token/ERC20/utils/SafeERC20.sol)

pragma solidity ^0.8.0;

import "../IERC20Upgradeable.sol";
import "../extensions/IERC20PermitUpgradeable.sol";
import "../../../utils/AddressUpgradeable.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 SafeERC20Upgradeable {
    using AddressUpgradeable for address;

    /**
     * @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(IERC20Upgradeable token, address to, uint256 value) internal {
        _callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, 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(IERC20Upgradeable token, address from, address to, uint256 value) internal {
        _callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value));
    }

    /**
     * @dev Deprecated. This function has issues similar to the ones found in
     * {IERC20-approve}, and its usage is discouraged.
     *
     * Whenever possible, use {safeIncreaseAllowance} and
     * {safeDecreaseAllowance} instead.
     */
    function safeApprove(IERC20Upgradeable token, address spender, uint256 value) internal {
        // safeApprove should only be called when setting an initial allowance,
        // or when resetting it to zero. To increase and decrease it, use
        // 'safeIncreaseAllowance' and 'safeDecreaseAllowance'
        require(
            (value == 0) || (token.allowance(address(this), spender) == 0),
            "SafeERC20: approve from non-zero to non-zero allowance"
        );
        _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, 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(IERC20Upgradeable token, address spender, uint256 value) internal {
        uint256 oldAllowance = token.allowance(address(this), spender);
        _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, oldAllowance + value));
    }

    /**
     * @dev Decrease the calling contract's allowance toward `spender` by `value`. If `token` returns no value,
     * non-reverting calls are assumed to be successful.
     */
    function safeDecreaseAllowance(IERC20Upgradeable token, address spender, uint256 value) internal {
        unchecked {
            uint256 oldAllowance = token.allowance(address(this), spender);
            require(oldAllowance >= value, "SafeERC20: decreased allowance below zero");
            _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, oldAllowance - value));
        }
    }

    /**
     * @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(IERC20Upgradeable token, address spender, uint256 value) internal {
        bytes memory approvalCall = abi.encodeWithSelector(token.approve.selector, spender, value);

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

    /**
     * @dev Use a ERC-2612 signature to set the `owner` approval toward `spender` on `token`.
     * Revert on invalid signature.
     */
    function safePermit(
        IERC20PermitUpgradeable token,
        address owner,
        address spender,
        uint256 value,
        uint256 deadline,
        uint8 v,
        bytes32 r,
        bytes32 s
    ) internal {
        uint256 nonceBefore = token.nonces(owner);
        token.permit(owner, spender, value, deadline, v, r, s);
        uint256 nonceAfter = token.nonces(owner);
        require(nonceAfter == nonceBefore + 1, "SafeERC20: permit did not succeed");
    }

    /**
     * @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(IERC20Upgradeable 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, "SafeERC20: low-level call failed");
        require(returndata.length == 0 || abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed");
    }

    /**
     * @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(IERC20Upgradeable 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))) && AddressUpgradeable.isContract(address(token));
    }
}

// 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 v4.4.1 (access/IAccessControl.sol)

pragma solidity ^0.8.0;

/**
 * @dev External interface of AccessControl declared to support ERC165 detection.
 */
interface IAccessControl {
    /**
     * @dev Emitted when `newAdminRole` is set as ``role``'s admin role, replacing `previousAdminRole`
     *
     * `DEFAULT_ADMIN_ROLE` is the starting admin for all roles, despite
     * {RoleAdminChanged} not being emitted signaling this.
     *
     * _Available since v3.1._
     */
    event RoleAdminChanged(bytes32 indexed role, bytes32 indexed previousAdminRole, bytes32 indexed newAdminRole);

    /**
     * @dev Emitted when `account` is granted `role`.
     *
     * `sender` is the account that originated the contract call, an admin role
     * bearer except when using {AccessControl-_setupRole}.
     */
    event RoleGranted(bytes32 indexed role, address indexed account, address indexed sender);

    /**
     * @dev Emitted when `account` is revoked `role`.
     *
     * `sender` is the account that originated the contract call:
     *   - if using `revokeRole`, it is the admin role bearer
     *   - if using `renounceRole`, it is the role bearer (i.e. `account`)
     */
    event RoleRevoked(bytes32 indexed role, address indexed account, address indexed sender);

    /**
     * @dev Returns `true` if `account` has been granted `role`.
     */
    function hasRole(bytes32 role, address account) external view returns (bool);

    /**
     * @dev Returns the admin role that controls `role`. See {grantRole} and
     * {revokeRole}.
     *
     * To change a role's admin, use {AccessControl-_setRoleAdmin}.
     */
    function getRoleAdmin(bytes32 role) external view returns (bytes32);

    /**
     * @dev Grants `role` to `account`.
     *
     * If `account` had not been already granted `role`, emits a {RoleGranted}
     * event.
     *
     * Requirements:
     *
     * - the caller must have ``role``'s admin role.
     */
    function grantRole(bytes32 role, address account) external;

    /**
     * @dev Revokes `role` from `account`.
     *
     * If `account` had been granted `role`, emits a {RoleRevoked} event.
     *
     * Requirements:
     *
     * - the caller must have ``role``'s admin role.
     */
    function revokeRole(bytes32 role, address account) external;

    /**
     * @dev Revokes `role` from the calling account.
     *
     * Roles are often managed via {grantRole} and {revokeRole}: this function's
     * purpose is to provide a mechanism for accounts to lose their privileges
     * if they are compromised (such as when a trusted device is misplaced).
     *
     * If the calling account had been granted `role`, emits a {RoleRevoked}
     * event.
     *
     * Requirements:
     *
     * - the caller must be `account`.
     */
    function renounceRole(bytes32 role, address account) external;
}

// SPDX-License-Identifier: UNLICENSED

pragma solidity ^0.8.19;
import "@openzeppelin/contracts/access/IAccessControl.sol";
import "./ITokenSale.sol";

/**
 * @title IAdmin.
 * @dev interface of Admin contract
 * which can set addresses for contracts for:
 * airdrop, token sales maintainers, staking.
 * Also Admin can create new pool.
 */
interface IAdmin is IAccessControl {
    function getParams(address)
        external
        view
        returns (ITokenSale.Params memory);

    function tokenSalesM(address) external returns (bool);

    function blockClaim(address) external returns (bool);

    function tokenSales(uint256) external returns (address);

    function masterTokenSale() external returns (address);

    function setMasterContract(address) external;

    function getTokenSales() external view returns (address[] memory);

    function wallet() external view returns (address);

    function addToBlackList(address, address[] memory) external;

    function blacklist(address, address) external returns (bool);

    function isKYCDone(address) external returns (bool);

    function createPoolNew(ITokenSale.Params calldata _params, uint256,bool) external payable;


    /**
     * @dev Emitted when pool is created.
     */
    event CreateTokenSale(address instanceAddress);
    /**
     * @dev Emitted when airdrop is set.
     */
    event SetAirdrop(address airdrop);

    event SetterUint(string, uint);
}

// SPDX-License-Identifier: UNLICENSED



pragma solidity ^0.8.4;
import "@openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol";

interface IERC20D is IERC20Upgradeable {
    function decimals() external returns (uint8);
    function _taxFee() external returns(uint256);
}

// SPDX-License-Identifier: UNLICENSED



pragma solidity >=0.6.2;

interface IPancakeFactory {
    function getPair(address tokenA, address tokenB)
        external
        view
        returns (address pair);
}

// SPDX-License-Identifier: UNLICENSED



pragma solidity >=0.6.2;

interface IPancakeRouter01 {
    function factory() external pure returns (address);

    function WETH() external pure returns (address);

    function addLiquidity(
        address tokenA,
        address tokenB,
        uint256 amountADesired,
        uint256 amountBDesired,
        uint256 amountAMin,
        uint256 amountBMin,
        address to,
        uint256 deadline
    )
        external
        returns (
            uint256 amountA,
            uint256 amountB,
            uint256 liquidity
        );

    function addLiquidityETH(
        address token,
        uint256 amountTokenDesired,
        uint256 amountTokenMin,
        uint256 amountETHMin,
        address to,
        uint256 deadline
    )
        external
        payable
        returns (
            uint256 amountToken,
            uint256 amountETH,
            uint256 liquidity
        );

    // function removeLiquidity(
    //     address tokenA,
    //     address tokenB,
    //     uint256 liquidity,
    //     uint256 amountAMin,
    //     uint256 amountBMin,
    //     address to,
    //     uint256 deadline
    // ) external returns (uint256 amountA, uint256 amountB);

    // function removeLiquidityETH(
    //     address token,
    //     uint256 liquidity,
    //     uint256 amountTokenMin,
    //     uint256 amountETHMin,
    //     address to,
    //     uint256 deadline
    // ) external returns (uint256 amountToken, uint256 amountETH);

    // function removeLiquidityWithPermit(
    //     address tokenA,
    //     address tokenB,
    //     uint256 liquidity,
    //     uint256 amountAMin,
    //     uint256 amountBMin,
    //     address to,
    //     uint256 deadline,
    //     bool approveMax,
    //     uint8 v,
    //     bytes32 r,
    //     bytes32 s
    // ) external returns (uint256 amountA, uint256 amountB);

    // function removeLiquidityETHWithPermit(
    //     address token,
    //     uint256 liquidity,
    //     uint256 amountTokenMin,
    //     uint256 amountETHMin,
    //     address to,
    //     uint256 deadline,
    //     bool approveMax,
    //     uint8 v,
    //     bytes32 r,
    //     bytes32 s
    // ) external returns (uint256 amountToken, uint256 amountETH);

    // function swapExactTokensForTokens(
    //     uint256 amountIn,
    //     uint256 amountOutMin,
    //     address[] calldata path,
    //     address to,
    //     uint256 deadline
    // ) external returns (uint256[] memory amounts);

    // function swapTokensForExactTokens(
    //     uint256 amountOut,
    //     uint256 amountInMax,
    //     address[] calldata path,
    //     address to,
    //     uint256 deadline
    // ) external returns (uint256[] memory amounts);

    // function swapExactETHForTokens(
    //     uint256 amountOutMin,
    //     address[] calldata path,
    //     address to,
    //     uint256 deadline
    // ) external payable returns (uint256[] memory amounts);

    // function swapTokensForExactETH(
    //     uint256 amountOut,
    //     uint256 amountInMax,
    //     address[] calldata path,
    //     address to,
    //     uint256 deadline
    // ) external returns (uint256[] memory amounts);

    // function swapExactTokensForETH(
    //     uint256 amountIn,
    //     uint256 amountOutMin,
    //     address[] calldata path,
    //     address to,
    //     uint256 deadline
    // ) external returns (uint256[] memory amounts);

    // function swapETHForExactTokens(
    //     uint256 amountOut,
    //     address[] calldata path,
    //     address to,
    //     uint256 deadline
    // ) external payable returns (uint256[] memory amounts);

    // function quote(
    //     uint256 amountA,
    //     uint256 reserveA,
    //     uint256 reserveB
    // ) external pure returns (uint256 amountB);

    // function getAmountOut(
    //     uint256 amountIn,
    //     uint256 reserveIn,
    //     uint256 reserveOut
    // ) external pure returns (uint256 amountOut);

    // function getAmountIn(
    //     uint256 amountOut,
    //     uint256 reserveIn,
    //     uint256 reserveOut
    // ) external pure returns (uint256 amountIn);

    // function getAmountsOut(uint256 amountIn, address[] calldata path)
    //     external
    //     view
    //     returns (uint256[] memory amounts);

    // function getAmountsIn(uint256 amountOut, address[] calldata path)
    //     external
    //     view
    //     returns (uint256[] memory amounts);
}

// SPDX-License-Identifier: UNLICENSED


/**
 * @title ITokenSale.
 * @dev interface of ITokenSale
 * params structure and functions.
 */
pragma solidity ^0.8.19;

interface ITokenSale {

    struct Staked {
        uint amount;
        uint share;
        uint claimed;
        uint left;
        uint vestingPoint;
        uint amountFinal;
    }

    enum Epoch {
        Incoming,
        Private,
        Finished
    }

    /**
     * @dev describe initial params for token sale
     * @param totalSupply set total amount of tokens. (Token decimals)
     * @param saleStart set starting time for private sale.
     * @param saleEnd set finish time for private sale.
     * @param tokenPrice set price for private sale per token in $ (18 decimals).
     * @param airdrop - amount reserved for airdrop
     */
    struct Params {
        address tokenAddress;
        address router;
        uint totalSupply; 
        uint96 saleStart;
        uint96 saleEnd;
        uint64 liqudityPercentage; //with base 10000
        uint tokenLiquidity; //token amount to add to liquid
        uint baseLine; // with 18 decimal
        bool burnUnsold;
    }

    struct Config{
        uint LPLockin; //in seconds
        uint vestingPeriod; //in seconds for vesting starting time
        uint vestingDistribution; //in seconds for vesting distribution duration
        uint NoOfVestingIntervals; //in seconds for vesting
        uint FirstVestPercentage; //with base 10000
        uint LiqGenerationTime;
    }

    struct State {
        uint totalSold;
        uint totalSupplyInValue;
    }

 
    /**
     * @dev initialize implem100entation logic contracts addresses
     * @param _admin for admin contract.
     */
    function initialize(
        Params memory params,
        address _admin,
        address _creator,
        uint256 _maxAllocation,
        uint256 _platformTax,
        bool _isKYC
    ) external;

    /**
     * @dev claim to sell tokens in airdrop.
     */
    // function claim() external;

    function creator() external view returns(address);
    function setConfig(Config memory _config, address _creator) external;

    /**
     * @dev get banned list of addresses from participation in sales in this contract.
     */
    // function epoch() external returns (Epoch);
    // // function destroy() external;
    // function checkingEpoch() external;
    // // function totalTokenSold() external view returns (uint128);
    // function userWhitelistAllocation(address[] calldata users, uint256[] calldata tiers) external;
    // function stakes(address)
    //     external
    //     returns (
    //         uint,
    //         uint,
    //         bool,
    //         uint256
    //     );
    // function claimLP() external ;
    // function takeLocked() external;
    // function removeOtherERC20Tokens(address) external;
    // function canClaim(address) external returns (uint120, uint256);
    // function takeUSDBRaised() external;

    event DepositPrivate(address indexed user, uint256 amount, address instance);
    event Claim(address indexed user, uint256 change);
    event Vest(address indexed user, uint256 change);
    event TransferAirdrop(uint256 amount);
    event TransferLeftovers(uint256 earned);
    event ERC20TokensRemoved(address _tokenAddress, address sender, uint256 balance);
    event RaiseClaimed(address _receiver, uint256 _amountInBUSD);
    event UserWhitelistAllocation(address[] users,uint256[] allocations);
    event SetConfig(Config);
}

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

Contract ABI

API
[{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"user","type":"address"},{"indexed":false,"internalType":"uint256","name":"change","type":"uint256"}],"name":"Claim","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"user","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"},{"indexed":false,"internalType":"address","name":"instance","type":"address"}],"name":"DepositPrivate","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"_tokenAddress","type":"address"},{"indexed":false,"internalType":"address","name":"sender","type":"address"},{"indexed":false,"internalType":"uint256","name":"balance","type":"uint256"}],"name":"ERC20TokensRemoved","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint8","name":"version","type":"uint8"}],"name":"Initialized","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"_receiver","type":"address"},{"indexed":false,"internalType":"uint256","name":"_amountInBUSD","type":"uint256"}],"name":"RaiseClaimed","type":"event"},{"anonymous":false,"inputs":[{"components":[{"internalType":"uint256","name":"LPLockin","type":"uint256"},{"internalType":"uint256","name":"vestingPeriod","type":"uint256"},{"internalType":"uint256","name":"vestingDistribution","type":"uint256"},{"internalType":"uint256","name":"NoOfVestingIntervals","type":"uint256"},{"internalType":"uint256","name":"FirstVestPercentage","type":"uint256"},{"internalType":"uint256","name":"LiqGenerationTime","type":"uint256"}],"indexed":false,"internalType":"struct ITokenSale.Config","name":"","type":"tuple"}],"name":"SetConfig","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"TransferAirdrop","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"earned","type":"uint256"}],"name":"TransferLeftovers","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address[]","name":"users","type":"address[]"},{"indexed":false,"internalType":"uint256[]","name":"allocations","type":"uint256[]"}],"name":"UserWhitelistAllocation","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"user","type":"address"},{"indexed":false,"internalType":"uint256","name":"change","type":"uint256"}],"name":"Vest","type":"event"},{"inputs":[],"name":"OPERATOR","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"USDB","outputs":[{"internalType":"contract IERC20D","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"addLiq","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_user","type":"address"}],"name":"canClaim","outputs":[{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"claim","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"claimLP","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"config","outputs":[{"internalType":"uint256","name":"LPLockin","type":"uint256"},{"internalType":"uint256","name":"vestingPeriod","type":"uint256"},{"internalType":"uint256","name":"vestingDistribution","type":"uint256"},{"internalType":"uint256","name":"NoOfVestingIntervals","type":"uint256"},{"internalType":"uint256","name":"FirstVestPercentage","type":"uint256"},{"internalType":"uint256","name":"LiqGenerationTime","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"creator","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"deposit","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"epoch","outputs":[{"internalType":"enum ITokenSale.Epoch","name":"","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"factory","outputs":[{"internalType":"contract IPancakeFactory","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"components":[{"internalType":"address","name":"tokenAddress","type":"address"},{"internalType":"address","name":"router","type":"address"},{"internalType":"uint256","name":"totalSupply","type":"uint256"},{"internalType":"uint96","name":"saleStart","type":"uint96"},{"internalType":"uint96","name":"saleEnd","type":"uint96"},{"internalType":"uint64","name":"liqudityPercentage","type":"uint64"},{"internalType":"uint256","name":"tokenLiquidity","type":"uint256"},{"internalType":"uint256","name":"baseLine","type":"uint256"},{"internalType":"bool","name":"burnUnsold","type":"bool"}],"internalType":"struct ITokenSale.Params","name":"_params","type":"tuple"},{"internalType":"address","name":"_admin","type":"address"},{"internalType":"address","name":"_creator","type":"address"},{"internalType":"uint256","name":"_maxAllocation","type":"uint256"},{"internalType":"uint256","name":"_platformTax","type":"uint256"},{"internalType":"bool","name":"_isKYC","type":"bool"}],"name":"initialize","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"isKYCEnabled","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"liqAdded","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"lockinPeriod","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"marketingWallet","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"maxAllocation","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"params","outputs":[{"internalType":"address","name":"tokenAddress","type":"address"},{"internalType":"address","name":"router","type":"address"},{"internalType":"uint256","name":"totalSupply","type":"uint256"},{"internalType":"uint96","name":"saleStart","type":"uint96"},{"internalType":"uint96","name":"saleEnd","type":"uint96"},{"internalType":"uint64","name":"liqudityPercentage","type":"uint64"},{"internalType":"uint256","name":"tokenLiquidity","type":"uint256"},{"internalType":"uint256","name":"baseLine","type":"uint256"},{"internalType":"bool","name":"burnUnsold","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"platformTax","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"router","outputs":[{"internalType":"contract IPancakeRouter01","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"components":[{"internalType":"uint256","name":"LPLockin","type":"uint256"},{"internalType":"uint256","name":"vestingPeriod","type":"uint256"},{"internalType":"uint256","name":"vestingDistribution","type":"uint256"},{"internalType":"uint256","name":"NoOfVestingIntervals","type":"uint256"},{"internalType":"uint256","name":"FirstVestPercentage","type":"uint256"},{"internalType":"uint256","name":"LiqGenerationTime","type":"uint256"}],"internalType":"struct ITokenSale.Config","name":"_config","type":"tuple"},{"internalType":"address","name":"_creator","type":"address"}],"name":"setConfig","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"stakes","outputs":[{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"uint256","name":"share","type":"uint256"},{"internalType":"uint256","name":"claimed","type":"uint256"},{"internalType":"uint256","name":"left","type":"uint256"},{"internalType":"uint256","name":"vestingPoint","type":"uint256"},{"internalType":"uint256","name":"amountFinal","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"state","outputs":[{"internalType":"uint256","name":"totalSold","type":"uint256"},{"internalType":"uint256","name":"totalSupplyInValue","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"takeLocked","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"takeUSDBRaised","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"tokenPrice","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"tokensaleTiers","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"userDepositIndex","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address[]","name":"users","type":"address[]"},{"internalType":"uint256[]","name":"allocations","type":"uint256[]"}],"name":"userWhitelistAllocation","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"usersOnDeposit","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"vesting","outputs":[],"stateMutability":"nonpayable","type":"function"}]

Block Transaction Difficulty 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  ]
[ 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.