Cryo Explorer Ethereum Mainnet

Address Contract Verified

Address 0x3a9c8Fcef5e2B0253b0cC4730a91b6b472f419f1
Balance 0 ETH
Nonce 1
Code Size 8252 bytes
Indexed Transactions 0
External Etherscan · Sourcify

Contract Bytecode

8252 bytes
0x6080604052600436106101d85760003560e01c80638456cb5911610102578063b8e50cab11610095578063ed20590a11610064578063ed20590a1461056c578063f2fde38b1461058c578063f6326fb3146105ac578063fd56981a146105b457600080fd5b8063b8e50cab1461050a578063c5c4744c14610520578063d63626ba14610536578063d85349f71461055657600080fd5b80639a03c47e116100d15780639a03c47e14610492578063a8660a78146104b2578063aef691e9146104c8578063b3c84728146104dd57600080fd5b80638456cb59146103eb5780638a19c8bc146104005780638c65c81f1461042c5780638da5cb5b1461047457600080fd5b806348c54b9d1161017a5780635c975abb116101495780635c975abb1461036c578063675418ac1461039657806368aec27f146103b6578063715018a6146103d657600080fd5b806348c54b9d146102c057806348dec2a7146102d557806349df728c1461032c5780634f6300a21461034c57600080fd5b80633c21e595116101b65780633c21e5951461025e5780633e413bee146102745780633f4ba83a1461029457806347e40553146102ab57600080fd5b80631514617e146101dd57806319d152fa146102065780632f48ab7d1461023e575b600080fd5b3480156101e957600080fd5b506101f360065481565b6040519081526020015b60405180910390f35b34801561021257600080fd5b50600954610226906001600160a01b031681565b6040516001600160a01b0390911681526020016101fd565b34801561024a57600080fd5b50600d54610226906001600160a01b031681565b34801561026a57600080fd5b506101f360085481565b34801561028057600080fd5b50600c54610226906001600160a01b031681565b3480156102a057600080fd5b506102a96105fd565b005b3480156102b757600080fd5b506102a961060f565b3480156102cc57600080fd5b506102a96106b6565b3480156102e157600080fd5b506103116102f0366004611bcb565b60406020819052600091825290208054600182015460029092015490919083565b604080519384526020840192909252908201526060016101fd565b34801561033857600080fd5b506102a9610347366004611bcb565b610856565b34801561035857600080fd5b506102a9610367366004611be6565b610985565b34801561037857600080fd5b50600054600160a01b900460ff1660405190151581526020016101fd565b3480156103a257600080fd5b506102a96103b1366004611c12565b610cdf565b3480156103c257600080fd5b506102a96103d1366004611c99565b610d4f565b3480156103e257600080fd5b506102a9610f40565b3480156103f757600080fd5b506102a9610f52565b34801561040c57600080fd5b5060035461041a9060ff1681565b60405160ff90911681526020016101fd565b34801561043857600080fd5b5061044c610447366004611d33565b610f62565b604080519586526020860194909452928401919091526060830152608082015260a0016101fd565b34801561048057600080fd5b506000546001600160a01b0316610226565b34801561049e57600080fd5b506102a96104ad366004611d33565b610f97565b3480156104be57600080fd5b506101f360055481565b3480156104d457600080fd5b506101f3611060565b3480156104e957600080fd5b506101f36104f8366004611bcb565b600a6020526000908152604090205481565b34801561051657600080fd5b506101f360075481565b34801561052c57600080fd5b506101f360025481565b34801561054257600080fd5b506101f3610551366004611bcb565b6110f6565b34801561056257600080fd5b506101f360045481565b34801561057857600080fd5b506102a9610587366004611d4c565b611241565b34801561059857600080fd5b506102a96105a7366004611bcb565b6114dd565b6102a961151b565b3480156105c057600080fd5b506105e86105cf366004611d33565b6041602052600090815260409020805460019091015482565b604080519283526020830191909152016101fd565b61060561181a565b61060d611847565b565b61061761181a565b60035460ff166000908152604160205260409020600101544210156106835760405162461bcd60e51b815260206004820152601f60248201527f43757272656e7420526f756e642054696d65206973206e6f7420656e6465640060448201526064015b60405180910390fd5b600380546001919060009061069c90849060ff16611d8c565b92506101000a81548160ff021916908360ff160217905550565b6106be61189c565b6106c66118c7565b6004546005546106d69190611da5565b42101561071d5760405162461bcd60e51b815260206004820152601560248201527421b634b333103832b934b7b2103737ba1037bb32b960591b604482015260640161067a565b6000610728336110f6565b90506000811161077a5760405162461bcd60e51b815260206004820152601d60248201527f4e6f20746f6b656e7320617661696c61626c6520666f7220636c61696d000000604482015260640161067a565b60095460405163a9059cbb60e01b8152336004820152602481018390526001600160a01b039091169063a9059cbb906044016020604051808303816000875af11580156107cb573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107ef9190611db8565b503360009081526040602081905281206002018054839290610812908490611da5565b909155505060405181815233907f896e034966eaaf1adc54acc0f257056febbd300c9e47182cf761982cf1f5e4309060200160405180910390a25061060d60018055565b61085e61181a565b6040516370a0823160e01b81523060048201526000906001600160a01b038316906370a0823190602401602060405180830381865afa1580156108a5573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108c99190611dda565b60405163a9059cbb60e01b8152336004820152602481018290529091506001600160a01b0383169063a9059cbb906044016020604051808303816000875af1158015610919573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061093d9190611db8565b50816001600160a01b03167f68577e4d693c1b056a60bc4e39438810239a0bfe64869c4eb7e3baebb5f656348260405161097991815260200190565b60405180910390a25050565b61098d61189c565b6109956118c7565b600d546001600160a01b03828116911614806109be5750600c546001600160a01b038281169116145b610a195760405162461bcd60e51b815260206004820152602660248201527f57652063616e206f6e6c79207573652055534454206f72205553444320666f7260448201526520747261646560d01b606482015260840161067a565b60035460ff16600090815260416020526040902054421015610a4d5760405162461bcd60e51b815260040161067a90611df3565b60035460ff16600090815260416020526040902060010154421115610a845760405162461bcd60e51b815260040161067a90611e21565b600354600a60ff90911610610aab5760405162461bcd60e51b815260040161067a90611e45565b60008211610acb5760405162461bcd60e51b815260040161067a90611e7a565b600354600090600e9060ff16600a8110610ae757610ae7611eb1565b600502016002015483610afa9190611ec7565b610b0c90670de0b6b3a7640000611ee9565b600354909150600e9060ff16600a8110610b2857610b28611eb1565b6005020154600354600e9060ff16600a8110610b4657610b46611eb1565b600502016001015484610b599190611da5565b1115610b775760405162461bcd60e51b815260040161067a90611f00565b610b9f33610b8d6000546001600160a01b031690565b6001600160a01b0385169190866118f1565b6003548190600e9060ff16600a8110610bba57610bba611eb1565b600502016004016000828254610bd09190611da5565b90915550506003548390600e9060ff16600a8110610bf057610bf0611eb1565b600502016001016000828254610c069190611da5565b925050819055508260026000828254610c1f9190611da5565b90915550503360009081526040602081905281208054859290610c43908490611da5565b90915550503360009081526040602081905281206001018054839290610c6a908490611da5565b90915550506001600160a01b0382166000908152600a602052604081208054859290610c97908490611da5565b909155505060405183815233907f59062170a285eb80e8c6b8ced60428442a51910635005233fc4ce084a475845e9060200160405180910390a250610cdb60018055565b5050565b610ce761181a565b4260055411610d385760405162461bcd60e51b815260206004820152601b60248201527f56657374696e672068617320616c726561647920737461727465640000000000604482015260640161067a565b600694909455600491909155600555600755600855565b610d5761181a565b8483148015610d6557508281145b610db15760405162461bcd60e51b815260206004820152601860248201527f4172726179206c656e67746873206d757374206d617463680000000000000000604482015260640161067a565b60005b85811015610f37576000878783818110610dd057610dd0611eb1565b9050602002016020810190610de59190611f37565b90506000868684818110610dfb57610dfb611eb1565b9050602002013590506000858585818110610e1857610e18611eb1565b905060200201359050600a8360ff1610610e645760405162461bcd60e51b815260206004820152600d60248201526c125b9d985b1a59081c9bdd5b99609a1b604482015260640161067a565b808210610ec15760405162461bcd60e51b815260206004820152602560248201527f53746172742074696d65206d757374206265206c657373207468616e20656e646044820152642074696d6560d81b606482015260840161067a565b604080518082018252838152602080820184815260ff8716600081815260418452859020935184559051600190930192909255825185815290810184905290917f19950f60dd13dd3ce7d3a7841ca2532fdbc0f800cffe9c5cb55b136169e6a83c910160405180910390a2505050600101610db4565b50505050505050565b610f4861181a565b61060d6000611951565b610f5a61181a565b61060d6119a1565b600e81600a8110610f7257600080fd5b6005020180546001820154600283015460038401546004909401549294509092909185565b610f9f61181a565b6009546040516323b872dd60e01b8152336004820152306024820152604481018390526001600160a01b03909116906323b872dd906064016020604051808303816000875af1158015610ff6573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061101a9190611db8565b506009546040518281526001600160a01b03909116907ff4c563a3ea86ff1f4275e8c207df0375a51963f2b831b7bf4da8be938d92876c9060200160405180910390a250565b600080600b60009054906101000a90046001600160a01b03166001600160a01b031663feaf968c6040518163ffffffff1660e01b815260040160a060405180830381865afa1580156110b6573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110da9190611f74565b5050509150506305f5e100816110f09190611ec7565b91505090565b6001600160a01b0381166000908152604060208190528120600101546004546005546111229190611da5565b4210156111325750600092915050565b6006546004546005546111459190611da5565b61114f9190611da5565b4210611182576001600160a01b03831660009081526040602081905290206002015461117b9082611fc4565b9392505050565b60006004546005546111949190611da5565b61119e9042611fc4565b90506000600754826111b09190611ec7565b905060006064600854856111c49190611ee9565b6111ce9190611ec7565b905060006006546007548484886111e59190611fc4565b6111ef9190611ee9565b6111f99190611ee9565b6112039190611ec7565b61120d9083611da5565b6001600160a01b0388166000908152604060208190529020600201549091506112369082611fc4565b979650505050505050565b61124961189c565b6112516118c7565b60035460ff166000908152604160205260409020544210156112855760405162461bcd60e51b815260040161067a90611df3565b60035460ff166000908152604160205260409020600101544211156112bc5760405162461bcd60e51b815260040161067a90611e21565b600354600a60ff909116106112e35760405162461bcd60e51b815260040161067a90611e45565b600081116113035760405162461bcd60e51b815260040161067a90611e7a565b600354600090600e9060ff16600a811061131f5761131f611eb1565b6005020160020154826113329190611ec7565b61134490670de0b6b3a7640000611ee9565b600354909150600e9060ff16600a811061136057611360611eb1565b6005020154600354600e9060ff16600a811061137e5761137e611eb1565b6005020160010154836113919190611da5565b11156113af5760405162461bcd60e51b815260040161067a90611f00565b6003548190600e9060ff16600a81106113ca576113ca611eb1565b6005020160040160008282546113e09190611da5565b90915550506003548290600e9060ff16600a811061140057611400611eb1565b6005020160010160008282546114169190611da5565b92505081905550816002600082825461142f9190611da5565b90915550506001600160a01b0383166000908152604060208190528120805484929061145c908490611da5565b90915550506001600160a01b0383166000908152604060208190528120600101805483929061148c908490611da5565b9091555050604080516001600160a01b0385168152602081018490527f7d3833e8b4d59be6d2bab33c045018e5c62cfae005c6dc1288526968c713d946910160405180910390a150610cdb60018055565b6114e561181a565b6001600160a01b03811661150f57604051631e4fbdf760e01b81526000600482015260240161067a565b61151881611951565b50565b61152361189c565b61152b6118c7565b60035460ff1660009081526041602052604090205442101561155f5760405162461bcd60e51b815260040161067a90611df3565b60035460ff166000908152604160205260409020600101544211156115965760405162461bcd60e51b815260040161067a90611e21565b600354600a60ff909116106115bd5760405162461bcd60e51b815260040161067a90611e45565b60006115c7611060565b905060006115d58234611ee9565b90506000670de0b6b3a76400006115ec8434611ee9565b6115f990620f4240611ee9565b6116039190611ec7565b9050600081116116255760405162461bcd60e51b815260040161067a90611e7a565b600354600090600e9060ff16600a811061164157611641611eb1565b600502016002015483620f42406116589190611ee9565b6116629190611ec7565b600354909150600e9060ff16600a811061167e5761167e611eb1565b6005020154600354600e9060ff16600a811061169c5761169c611eb1565b6005020160010154836116af9190611da5565b11156116cd5760405162461bcd60e51b815260040161067a90611f00565b600080546040516001600160a01b03909116913480156108fc02929091818181858888f19350505050158015611707573d6000803e3d6000fd5b506003548190600e9060ff16600a811061172357611723611eb1565b6005020160040160008282546117399190611da5565b90915550506003548290600e9060ff16600a811061175957611759611eb1565b60050201600101600082825461176f9190611da5565b9250508190555081600260008282546117889190611da5565b909155505033600090815260406020819052812080548492906117ac908490611da5565b909155505033600090815260406020819052812060010180548392906117d3908490611da5565b909155505060405182815233907f6c703791f399558807424f489ccd811c72b4ff0b74af547264fad7c646776df09060200160405180910390a25050505061060d60018055565b6000546001600160a01b0316331461060d5760405163118cdaa760e01b815233600482015260240161067a565b61184f6119e4565b6000805460ff60a01b191690557f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa335b6040516001600160a01b03909116815260200160405180910390a1565b600054600160a01b900460ff161561060d5760405163d93c066560e01b815260040160405180910390fd5b6002600154036118ea57604051633ee5aeb560e01b815260040160405180910390fd5b6002600155565b604080516001600160a01b0385811660248301528416604482015260648082018490528251808303909101815260849091019091526020810180516001600160e01b03166323b872dd60e01b17905261194b908590611a0e565b50505050565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6119a961189c565b6000805460ff60a01b1916600160a01b1790557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a25861187f3390565b600054600160a01b900460ff1661060d57604051638dfc202b60e01b815260040160405180910390fd5b6000611a236001600160a01b03841683611a76565b90508051600014158015611a48575080806020019051810190611a469190611db8565b155b15611a7157604051635274afe760e01b81526001600160a01b038416600482015260240161067a565b505050565b6060611a8483836000611a8d565b90505b92915050565b606081471015611ab25760405163cd78605960e01b815230600482015260240161067a565b600080856001600160a01b03168486604051611ace9190611fd7565b60006040518083038185875af1925050503d8060008114611b0b576040519150601f19603f3d011682016040523d82523d6000602084013e611b10565b606091505b5091509150611b20868383611b2a565b9695505050505050565b606082611b3f57611b3a82611b86565b61117b565b8151158015611b5657506001600160a01b0384163b155b15611b7f57604051639996b31560e01b81526001600160a01b038516600482015260240161067a565b508061117b565b805115611b965780518082602001fd5b604051630a12f52160e11b815260040160405180910390fd5b80356001600160a01b0381168114611bc657600080fd5b919050565b600060208284031215611bdd57600080fd5b611a8482611baf565b60008060408385031215611bf957600080fd5b82359150611c0960208401611baf565b90509250929050565b600080600080600060a08688031215611c2a57600080fd5b505083359560208501359550604085013594606081013594506080013592509050565b60008083601f840112611c5f57600080fd5b50813567ffffffffffffffff811115611c7757600080fd5b6020830191508360208260051b8501011115611c9257600080fd5b9250929050565b60008060008060008060608789031215611cb257600080fd5b863567ffffffffffffffff80821115611cca57600080fd5b611cd68a838b01611c4d565b90985096506020890135915080821115611cef57600080fd5b611cfb8a838b01611c4d565b90965094506040890135915080821115611d1457600080fd5b50611d2189828a01611c4d565b979a9699509497509295939492505050565b600060208284031215611d4557600080fd5b5035919050565b60008060408385031215611d5f57600080fd5b611d6883611baf565b946020939093013593505050565b634e487b7160e01b600052601160045260246000fd5b60ff8181168382160190811115611a8757611a87611d76565b80820180821115611a8757611a87611d76565b600060208284031215611dca57600080fd5b8151801515811461117b57600080fd5b600060208284031215611dec57600080fd5b5051919050565b60208082526014908201527314d85b19481b9bdd081cdd185c9d1959081e595d60621b604082015260600190565b6020808252600a908201526914d85b1948115b99195960b21b604082015260600190565b6020808252818101527f416c6c2070726573616c6520726f756e64732061726520636f6d706c65746564604082015260600190565b60208082526018908201527f496e73756666696369656e7420616d6f756e742073656e740000000000000000604082015260600190565b634e487b7160e01b600052603260045260246000fd5b600082611ee457634e487b7160e01b600052601260045260246000fd5b500490565b8082028115828204841417611a8757611a87611d76565b6020808252601e908201527f4d617820636170207265616368656420666f72207468697320726f756e640000604082015260600190565b600060208284031215611f4957600080fd5b813560ff8116811461117b57600080fd5b805169ffffffffffffffffffff81168114611bc657600080fd5b600080600080600060a08688031215611f8c57600080fd5b611f9586611f5a565b9450602086015193506040860151925060608601519150611fb860808701611f5a565b90509295509295909350565b81810381811115611a8757611a87611d76565b6000825160005b81811015611ff85760208186018101518583015201611fde565b50600092019182525091905056fea26469706673582212200fae5f42699cb14fb433828ba9ab94ad6c9c1fd53b3d147b760e0b3f2bccc48864736f6c63430008190033

Verified Source Code Full Match

Compiler: v0.8.25+commit.b61c2a91 EVM: paris Optimization: Yes (200 runs)
Presale.sol 325 lines
// SPDX-License-Identifier: MIT
pragma solidity 0.8.25;

import "@openzeppelin/contracts/token/ERC20/ERC20.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/utils/Pausable.sol";
import {AggregatorV3Interface} from "@chainlink/contracts/src/v0.8/shared/interfaces/AggregatorV3Interface.sol";
import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import "@openzeppelin/contracts/utils/ReentrancyGuard.sol";

contract LuckHunterPreSale is Ownable, Pausable, ReentrancyGuard{
    
    using SafeERC20 for IERC20;
    uint256 public totalRaised;
    uint8 public currentRound = 0;

    uint256 public cliffDuration;
    uint256 public vestingStartTime;
    uint256 public vestingDuration;
    uint256 public vestingInterval;
    uint256 public cliffPercentage;

    IERC20 public vestingToken;

    struct Round {
        uint256 maxDepositToken;
        uint256 amountRaised;
        uint256 price;
        uint256 vestedTokens;
        uint256 tokensSold;
    }

    mapping(address => uint256) public tokenRaised;
    AggregatorV3Interface internal EthUSDDataFeed;
    address public usdc = 0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48;
    address public usdt = 0xdAC17F958D2ee523a2206206994597C13D831ec7;

    struct User {
        uint256 investedAmount;
        uint256 totalVestedAmounts;
        uint256 claimedTokens;
    }

    struct RoundTime {
        uint256 start;
        uint256 end;
    }

    Round[10] public rounds;
    mapping(address => User) public userDetails;
    mapping(uint256 => RoundTime) public roundTime;

    event TokensDeposited(address indexed user, uint256 amount);
    event ETHDeposited(address indexed user, uint256 amount);
    event TokensClaimed(address indexed user, uint256 amount);
    event TokenAdded(address indexed token, uint256 amount);
    event TokenWithdraw(address indexed token, uint256 amount);
    event RoundTimeUpdated(uint256 indexed round, uint256 start, uint256 end);
    event BoughtWithWert(address user, uint256 amount);


    constructor(
        uint256 _vestingDuration,
        uint256 _vestingInterval,
        uint256 _cliffDuration,
        uint256 _vestingStartTime,
        uint256 _cliffPercentage,
        address _owner
    ) Ownable(_owner) {
        
        vestingToken = IERC20(0x2b838A5DAdE021BE2A50a96897Ae350b9a93fF63);
        vestingDuration = _vestingDuration;
        cliffDuration = _cliffDuration;
        vestingStartTime = _vestingStartTime;
        vestingInterval = _vestingInterval;
        cliffPercentage = _cliffPercentage;

        EthUSDDataFeed = AggregatorV3Interface(
            0x5f4eC3Df9cbd43714FE2740f5E3616155c5b8419
        );

        rounds[0] = Round(250000 * 10**6, 0, 1000, 250000000 * 10**18, 0);
        rounds[1] = Round(350000 * 10**6, 0, 1120, 312500000 * 10**18, 0);
        rounds[2] = Round(450000 * 10**6, 0, 1240, 362903226 * 10**18, 0); 
        rounds[3] = Round(550000 * 10**6, 0, 1380, 398550725 * 10**18, 0); 
        rounds[4] = Round(650000 * 10**6, 0, 1520, 427631579 * 10**18, 0); 
        rounds[5] = Round(750000 * 10**6, 0, 1680, 446428571 * 10**18, 0);
        rounds[6] = Round(850000 * 10**6, 0, 1860, 456989247 * 10**18, 0); 
        rounds[7] = Round(950000 * 10**6, 0, 2060, 461165049 * 10**18, 0); 
        rounds[8] = Round(1050000 * 10**6, 0, 2280, 460526316 * 10**18, 0);
        rounds[9] = Round(1150000 * 10**6, 0, 2520, 456349206 * 10**18, 0);
    }

    function updateVesting(
        uint256 _vestingDuration,
        uint256 _vestingInterval,
        uint256 _cliffDuration,
        uint256 _vestingStartTime,
        uint256 _cliffPercentage
        ) external onlyOwner {
        require(
            vestingStartTime > block.timestamp,
            "Vesting has already started"
        );

        vestingDuration = _vestingDuration;
        cliffDuration = _cliffDuration;
        vestingStartTime = _vestingStartTime;
        vestingInterval = _vestingInterval;
        cliffPercentage = _cliffPercentage;
    }

    function updateRoundTimes(
        uint8[] calldata _rounds,
        uint256[] calldata _starts,
        uint256[] calldata _ends
    ) external onlyOwner {
        require(
            _rounds.length == _starts.length && _starts.length == _ends.length,
            "Array lengths must match"
        );

        for (uint256 i = 0; i < _rounds.length; i++) {
            uint8 round = _rounds[i];
            uint256 start = _starts[i];
            uint256 end = _ends[i];

            require(round < rounds.length, "Invalid round");
            require(start < end, "Start time must be less than end time");

            roundTime[round] = RoundTime(start, end);
            emit RoundTimeUpdated(round, start, end);
        }
    }

    function nextRound() public onlyOwner {
        if (block.timestamp < roundTime[currentRound].end) {
            revert("Current Round Time is not ended");
        } else {
            currentRound += 1;
        }
    }

    function depositETH() public payable whenNotPaused nonReentrant {
        require(
            block.timestamp >= roundTime[currentRound].start,
            "Sale not started yet"
        );
        require(block.timestamp <= roundTime[currentRound].end, "Sale Ended");
        require(
            currentRound < rounds.length,
            "All presale rounds are completed"
        );
        uint256 ethToUsdPrice = getPriceOfETH();
        uint256 amount = (msg.value * ethToUsdPrice);

        uint256 amountInvestedByUser = (msg.value * ethToUsdPrice * 10e5) /
            10**18;
        require(amountInvestedByUser > 0, "Insufficient amount sent");

        uint256 tokensToBuy = (amount * 10**6) / (rounds[currentRound].price);

        require(
            amountInvestedByUser + rounds[currentRound].amountRaised <=
                rounds[currentRound].maxDepositToken,
            "Max cap reached for this round"
        );

        payable(owner()).transfer(msg.value);

        rounds[currentRound].tokensSold += tokensToBuy;
        rounds[currentRound].amountRaised += amountInvestedByUser;
        totalRaised += amountInvestedByUser;
        userDetails[msg.sender].investedAmount += amountInvestedByUser;
        userDetails[msg.sender].totalVestedAmounts += tokensToBuy;

        emit ETHDeposited(msg.sender, amountInvestedByUser);
    }

    function getPriceOfETH() public view returns (uint256) {
        (
            ,
            /* uint80 roundID */
            int256 answer, /*uint startedAt*/
            ,
            ,

        ) = /*uint timeStamp*/
            /*uint80 answeredInRound*/
            EthUSDDataFeed.latestRoundData();

        return uint256(answer) / 10**8;
    }

    function depositTokens(uint256 amount, address _depositToken)
        public
        whenNotPaused
        nonReentrant
    {
        require(
            _depositToken == usdt || _depositToken == usdc,
            "We can only use USDT or USDC for trade"
        );
        require(
            block.timestamp >= roundTime[currentRound].start,
            "Sale not started yet"
        );
        require(block.timestamp <= roundTime[currentRound].end, "Sale Ended");
        require(
            currentRound < rounds.length,
            "All presale rounds are completed"
        );

        require(amount > 0, "Insufficient amount sent");

        uint256 tokensToBuy = (amount / rounds[currentRound].price) * 10**18;

        require(
            amount + rounds[currentRound].amountRaised <=
                rounds[currentRound].maxDepositToken,
            "Max cap reached for this round"
        );

        IERC20(_depositToken).safeTransferFrom(msg.sender, owner(), amount);

        rounds[currentRound].tokensSold += tokensToBuy;
        rounds[currentRound].amountRaised += amount;
        totalRaised += amount;
        userDetails[msg.sender].investedAmount += amount;
        userDetails[msg.sender].totalVestedAmounts += tokensToBuy;

        tokenRaised[_depositToken] += amount;
        emit TokensDeposited(msg.sender, amount);
    }

    function claimTokens() public whenNotPaused nonReentrant{
        require(
            block.timestamp >= vestingStartTime + cliffDuration,
            "Cliff period not over"
        );
        uint256 claimableTokens = calculateUnlockedToken(msg.sender);
        require(claimableTokens > 0, "No tokens available for claim");

        vestingToken.transfer(msg.sender, claimableTokens);
        userDetails[msg.sender].claimedTokens += claimableTokens;
        emit TokensClaimed(msg.sender, claimableTokens);
    }

    function calculateUnlockedToken(address _wallet)
        public
        view
        returns (uint256)
    {
        uint256 totalVested = userDetails[_wallet].totalVestedAmounts;

        if (block.timestamp < vestingStartTime + cliffDuration) {
            return 0;
        } else if (
            block.timestamp >=
            vestingStartTime + cliffDuration + vestingDuration
        ) {
            return totalVested - userDetails[_wallet].claimedTokens;
        } else {
            uint256 elapsedTime = block.timestamp -
                (vestingStartTime + cliffDuration);
            uint256 vestingPeriods = elapsedTime / vestingInterval;
            uint256 cliffReleaseAmount = (totalVested * cliffPercentage) / 100;
            uint256 totalUnlocked = cliffReleaseAmount +
                ((totalVested - cliffReleaseAmount) *
                    vestingPeriods *
                    vestingInterval) /
                vestingDuration;
            return totalUnlocked - userDetails[_wallet].claimedTokens;
        }
    }

    function buyTokensWert(address user, uint256 amount) external whenNotPaused nonReentrant {
        require(
            block.timestamp >= roundTime[currentRound].start,
            "Sale not started yet"
        );
        require(block.timestamp <= roundTime[currentRound].end, "Sale Ended");
        require(
            currentRound < rounds.length,
            "All presale rounds are completed"
        );

        require(amount > 0, "Insufficient amount sent");

        uint256 tokensToBuy = (amount / rounds[currentRound].price) * 10**18;

        require(
            amount + rounds[currentRound].amountRaised <=
                rounds[currentRound].maxDepositToken,
            "Max cap reached for this round"
        );

        rounds[currentRound].tokensSold += tokensToBuy;
        rounds[currentRound].amountRaised += amount;
        totalRaised += amount;
        userDetails[user].investedAmount += amount;
        userDetails[user].totalVestedAmounts += tokensToBuy;

        emit BoughtWithWert(user, amount);
    }

    function addTokensToPresale(uint256 amount) external onlyOwner {
        vestingToken.transferFrom(msg.sender, address(this), amount);
        emit TokenAdded(address(vestingToken), amount);
    }

    function withdrawTokens(address _token) external onlyOwner {
        uint256 amount = IERC20(_token).balanceOf(address(this));
        IERC20(_token).transfer(msg.sender, amount);
        emit TokenWithdraw(address(_token), amount);
    }

    function pause() external onlyOwner {
        _pause();
    }

    function unpause() external onlyOwner {
        _unpause();
    }
}
Address.sol 159 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (utils/Address.sol)

pragma solidity ^0.8.20;

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

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

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

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

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

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

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

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

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

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

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

    /**
     * @dev Reverts with returndata if present. Otherwise reverts with {FailedInnerCall}.
     */
    function _revert(bytes memory returndata) private pure {
        // Look for revert reason and bubble it up if present
        if (returndata.length > 0) {
            // The easiest way to bubble the revert reason is using memory via assembly
            /// @solidity memory-safe-assembly
            assembly {
                let returndata_size := mload(returndata)
                revert(add(32, returndata), returndata_size)
            }
        } else {
            revert FailedInnerCall();
        }
    }
}
Context.sol 28 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.1) (utils/Context.sol)

pragma solidity ^0.8.20;

/**
 * @dev Provides information about the current execution context, including the
 * sender of the transaction and its data. While these are generally available
 * via msg.sender and msg.data, they should not be accessed in such a direct
 * manner, since when dealing with meta-transactions the account sending and
 * paying for execution may not be the actual sender (as far as an application
 * is concerned).
 *
 * This contract is only required for intermediate, library-like contracts.
 */
abstract contract Context {
    function _msgSender() internal view virtual returns (address) {
        return msg.sender;
    }

    function _msgData() internal view virtual returns (bytes calldata) {
        return msg.data;
    }

    function _contextSuffixLength() internal view virtual returns (uint256) {
        return 0;
    }
}
Ownable.sol 100 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (access/Ownable.sol)

pragma solidity ^0.8.20;

import {Context} from "../utils/Context.sol";

/**
 * @dev Contract module which provides a basic access control mechanism, where
 * there is an account (an owner) that can be granted exclusive access to
 * specific functions.
 *
 * The initial owner is set to the address provided by the deployer. This can
 * later be changed with {transferOwnership}.
 *
 * This module is used through inheritance. It will make available the modifier
 * `onlyOwner`, which can be applied to your functions to restrict their use to
 * the owner.
 */
abstract contract Ownable is Context {
    address private _owner;

    /**
     * @dev The caller account is not authorized to perform an operation.
     */
    error OwnableUnauthorizedAccount(address account);

    /**
     * @dev The owner is not a valid owner account. (eg. `address(0)`)
     */
    error OwnableInvalidOwner(address owner);

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

    /**
     * @dev Initializes the contract setting the address provided by the deployer as the initial owner.
     */
    constructor(address initialOwner) {
        if (initialOwner == address(0)) {
            revert OwnableInvalidOwner(address(0));
        }
        _transferOwnership(initialOwner);
    }

    /**
     * @dev Throws if called by any account other than the owner.
     */
    modifier onlyOwner() {
        _checkOwner();
        _;
    }

    /**
     * @dev Returns the address of the current owner.
     */
    function owner() public view virtual returns (address) {
        return _owner;
    }

    /**
     * @dev Throws if the sender is not the owner.
     */
    function _checkOwner() internal view virtual {
        if (owner() != _msgSender()) {
            revert OwnableUnauthorizedAccount(_msgSender());
        }
    }

    /**
     * @dev Leaves the contract without owner. It will not be possible to call
     * `onlyOwner` functions. Can only be called by the current owner.
     *
     * NOTE: Renouncing ownership will leave the contract without an owner,
     * thereby disabling any functionality that is only available to the owner.
     */
    function renounceOwnership() public virtual onlyOwner {
        _transferOwnership(address(0));
    }

    /**
     * @dev Transfers ownership of the contract to a new account (`newOwner`).
     * Can only be called by the current owner.
     */
    function transferOwnership(address newOwner) public virtual onlyOwner {
        if (newOwner == address(0)) {
            revert OwnableInvalidOwner(address(0));
        }
        _transferOwnership(newOwner);
    }

    /**
     * @dev Transfers ownership of the contract to a new account (`newOwner`).
     * Internal function without access restriction.
     */
    function _transferOwnership(address newOwner) internal virtual {
        address oldOwner = _owner;
        _owner = newOwner;
        emit OwnershipTransferred(oldOwner, newOwner);
    }
}
Pausable.sol 119 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (utils/Pausable.sol)

pragma solidity ^0.8.20;

import {Context} from "../utils/Context.sol";

/**
 * @dev Contract module which allows children to implement an emergency stop
 * mechanism that can be triggered by an authorized account.
 *
 * This module is used through inheritance. It will make available the
 * modifiers `whenNotPaused` and `whenPaused`, which can be applied to
 * the functions of your contract. Note that they will not be pausable by
 * simply including this module, only once the modifiers are put in place.
 */
abstract contract Pausable is Context {
    bool private _paused;

    /**
     * @dev Emitted when the pause is triggered by `account`.
     */
    event Paused(address account);

    /**
     * @dev Emitted when the pause is lifted by `account`.
     */
    event Unpaused(address account);

    /**
     * @dev The operation failed because the contract is paused.
     */
    error EnforcedPause();

    /**
     * @dev The operation failed because the contract is not paused.
     */
    error ExpectedPause();

    /**
     * @dev Initializes the contract in unpaused state.
     */
    constructor() {
        _paused = false;
    }

    /**
     * @dev Modifier to make a function callable only when the contract is not paused.
     *
     * Requirements:
     *
     * - The contract must not be paused.
     */
    modifier whenNotPaused() {
        _requireNotPaused();
        _;
    }

    /**
     * @dev Modifier to make a function callable only when the contract is paused.
     *
     * Requirements:
     *
     * - The contract must be paused.
     */
    modifier whenPaused() {
        _requirePaused();
        _;
    }

    /**
     * @dev Returns true if the contract is paused, and false otherwise.
     */
    function paused() public view virtual returns (bool) {
        return _paused;
    }

    /**
     * @dev Throws if the contract is paused.
     */
    function _requireNotPaused() internal view virtual {
        if (paused()) {
            revert EnforcedPause();
        }
    }

    /**
     * @dev Throws if the contract is not paused.
     */
    function _requirePaused() internal view virtual {
        if (!paused()) {
            revert ExpectedPause();
        }
    }

    /**
     * @dev Triggers stopped state.
     *
     * Requirements:
     *
     * - The contract must not be paused.
     */
    function _pause() internal virtual whenNotPaused {
        _paused = true;
        emit Paused(_msgSender());
    }

    /**
     * @dev Returns to normal state.
     *
     * Requirements:
     *
     * - The contract must be paused.
     */
    function _unpause() internal virtual whenPaused {
        _paused = false;
        emit Unpaused(_msgSender());
    }
}
ERC20.sol 316 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/ERC20.sol)

pragma solidity ^0.8.20;

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

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

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

    uint256 private _totalSupply;

    string private _name;
    string private _symbol;

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

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

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

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

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

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

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

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

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

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

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

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

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

        emit Transfer(from, to, value);
    }

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

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

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

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

    /**
     * @dev Updates `owner` s allowance for `spender` based on spent `value`.
     *
     * Does not update the allowance value in case of infinite allowance.
     * Revert if not enough allowance is available.
     *
     * Does not emit an {Approval} event.
     */
    function _spendAllowance(address owner, address spender, uint256 value) internal virtual {
        uint256 currentAllowance = allowance(owner, spender);
        if (currentAllowance != type(uint256).max) {
            if (currentAllowance < value) {
                revert ERC20InsufficientAllowance(spender, currentAllowance, value);
            }
            unchecked {
                _approve(owner, spender, currentAllowance - value, false);
            }
        }
    }
}
IERC20.sol 79 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/IERC20.sol)

pragma solidity ^0.8.20;

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

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

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

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

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

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

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

    /**
     * @dev Moves a `value` amount of tokens from `from` to `to` using the
     * allowance mechanism. `value` is then deducted from the caller's
     * allowance.
     *
     * Returns a boolean value indicating whether the operation succeeded.
     *
     * Emits a {Transfer} event.
     */
    function transferFrom(address from, address to, uint256 value) external returns (bool);
}
ReentrancyGuard.sol 84 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (utils/ReentrancyGuard.sol)

pragma solidity ^0.8.20;

/**
 * @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 ReentrancyGuard {
    // 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;

    /**
     * @dev Unauthorized reentrant call.
     */
    error ReentrancyGuardReentrantCall();

    constructor() {
        _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
        if (_status == ENTERED) {
            revert ReentrancyGuardReentrantCall();
        }

        // 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;
    }
}
draft-IERC6093.sol 161 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (interfaces/draft-IERC6093.sol)
pragma solidity ^0.8.20;

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    /**
     * @dev Indicates an array length mismatch between ids and values in a safeBatchTransferFrom operation.
     * Used in batch transfers.
     * @param idsLength Length of the array of token identifiers
     * @param valuesLength Length of the array of token amounts
     */
    error ERC1155InvalidArrayLength(uint256 idsLength, uint256 valuesLength);
}
SafeERC20.sol 118 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/utils/SafeERC20.sol)

pragma solidity ^0.8.20;

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

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

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

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

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

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

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

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

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

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

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

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

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

        (bool success, bytes memory returndata) = address(token).call(data);
        return success && (returndata.length == 0 || abi.decode(returndata, (bool))) && address(token).code.length > 0;
    }
}
IERC20Permit.sol 90 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/extensions/IERC20Permit.sol)

pragma solidity ^0.8.20;

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

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

    /**
     * @dev Returns the domain separator used in the encoding of the signature for {permit}, as defined by {EIP712}.
     */
    // solhint-disable-next-line func-name-mixedcase
    function DOMAIN_SEPARATOR() external view returns (bytes32);
}
IERC20Metadata.sol 26 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/extensions/IERC20Metadata.sol)

pragma solidity ^0.8.20;

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

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

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

    /**
     * @dev Returns the decimals places of the token.
     */
    function decimals() external view returns (uint8);
}
AggregatorV3Interface.sol 20 lines
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

// solhint-disable-next-line interface-starts-with-i
interface AggregatorV3Interface {
  function decimals() external view returns (uint8);

  function description() external view returns (string memory);

  function version() external view returns (uint256);

  function getRoundData(
    uint80 _roundId
  ) external view returns (uint80 roundId, int256 answer, uint256 startedAt, uint256 updatedAt, uint80 answeredInRound);

  function latestRoundData()
    external
    view
    returns (uint80 roundId, int256 answer, uint256 startedAt, uint256 updatedAt, uint80 answeredInRound);
}

Read Contract

calculateUnlockedToken 0xd63626ba → uint256
cliffDuration 0xd85349f7 → uint256
cliffPercentage 0x3c21e595 → uint256
currentRound 0x8a19c8bc → uint8
getPriceOfETH 0xaef691e9 → uint256
owner 0x8da5cb5b → address
paused 0x5c975abb → bool
roundTime 0xfd56981a → uint256, uint256
rounds 0x8c65c81f → uint256, uint256, uint256, uint256, uint256
tokenRaised 0xb3c84728 → uint256
totalRaised 0xc5c4744c → uint256
usdc 0x3e413bee → address
usdt 0x2f48ab7d → address
userDetails 0x48dec2a7 → uint256, uint256, uint256
vestingDuration 0x1514617e → uint256
vestingInterval 0xb8e50cab → uint256
vestingStartTime 0xa8660a78 → uint256
vestingToken 0x19d152fa → address

Write Contract 13 functions

These functions modify contract state and require a wallet transaction to execute.

addTokensToPresale 0x9a03c47e
uint256 amount
buyTokensWert 0xed20590a
address user
uint256 amount
claimTokens 0x48c54b9d
No parameters
depositETH 0xf6326fb3
No parameters
depositTokens 0x4f6300a2
uint256 amount
address _depositToken
nextRound 0x47e40553
No parameters
pause 0x8456cb59
No parameters
renounceOwnership 0x715018a6
No parameters
transferOwnership 0xf2fde38b
address newOwner
unpause 0x3f4ba83a
No parameters
updateRoundTimes 0x68aec27f
uint8[] _rounds
uint256[] _starts
uint256[] _ends
updateVesting 0x675418ac
uint256 _vestingDuration
uint256 _vestingInterval
uint256 _cliffDuration
uint256 _vestingStartTime
uint256 _cliffPercentage
withdrawTokens 0x49df728c
address _token

Recent Transactions

No transactions found for this address