creation_sourcecode: {{
    "language": "Solidity",
    "sources": {
      "contracts/token/IntelliQuant_Staking.sol": {
        "content": "// SPDX-License-Identifier: MIT\npragma solidity 0.8.0;\n\n// Web: https://intelliquantcoin.com\n// Telegram: https://t.me/IntelliQuantOfficial\n// Docs: https://docs.intelliquantcoin.com\n// Twitter: https://twitter.com/IntelliQuant\n\n//       $$$$$\n//       $:::$\n//   $$$$$:::$$$$$$ IIIIIIIIIINNNNNNNN        NNNNNNNN     QQQQQQQQQ     UUUUUUUU     UUUUUUUU\n// $$::::::::::::::$I::::::::IN:::::::N       N::::::N   QQ:::::::::QQ   U::::::U     U::::::U\n//$:::::$$$$$$$::::$I::::::::IN::::::::N      N::::::N QQ:::::::::::::QQ U::::::U     U::::::U\n//$::::$       $$$$$II::::::IIN:::::::::N     N::::::NQ:::::::QQQ:::::::QUU:::::U     U:::::UU\n//$::::$              I::::I  N::::::::::N    N::::::NQ::::::O   Q::::::Q U:::::U     U:::::U\n//$::::$              I::::I  N:::::::::::N   N::::::NQ:::::O     Q:::::Q U:::::D     D:::::U\n//$:::::$$$$$$$$$     I::::I  N:::::::N::::N  N::::::NQ:::::O     Q:::::Q U:::::D     D:::::U\n// $$::::::::::::$$   I::::I  N::::::N N::::N N::::::NQ:::::O     Q:::::Q U:::::D     D:::::U\n//   $$$$$$$$$:::::$  I::::I  N::::::N  N::::N:::::::NQ:::::O     Q:::::Q U:::::D     D:::::U\n//            $::::$  I::::I  N::::::N   N:::::::::::NQ:::::O     Q:::::Q U:::::D     D:::::U\n//            $::::$  I::::I  N::::::N    N::::::::::NQ:::::O  QQQQ:::::Q U:::::D     D:::::U\n//$$$$$       $::::$  I::::I  N::::::N     N:::::::::NQ::::::O Q::::::::Q U::::::U   U::::::U\n//$::::$$$$$$$:::::$II::::::IIN::::::N      N::::::::NQ:::::::QQ::::::::Q U:::::::UUU:::::::U\n//$::::::::::::::$$ I::::::::IN::::::N       N:::::::N QQ::::::::::::::Q   UU:::::::::::::UU\n// $$$$$$:::$$$$$   I::::::::IN::::::N        N::::::N   QQ:::::::::::Q      UU:::::::::UU\n//      $:::$       IIIIIIIIIINNNNNNNN         NNNNNNN     QQQQQQQQ::::QQ      UUUUUUUUU\n//      $$$$$                                                      Q:::::Q\n//\n\ninterface IERC20 {\n    function transfer(address to, uint256 value) external returns (bool);\n\n    function approve(address spender, uint256 value) external returns (bool);\n\n    function transferFrom(\n        address from,\n        address to,\n        uint256 value\n    ) external returns (bool);\n\n    function totalSupply() external view returns (uint256);\n\n    function balanceOf(address who) external view returns (uint256);\n\n    function allowance(\n        address owner,\n        address spender\n    ) external view returns (uint256);\n\n    event Transfer(address indexed from, address indexed to, uint256 value);\n\n    event Approval(\n        address indexed owner,\n        address indexed spender,\n        uint256 value\n    );\n}\n\n/**\n * @dev Contract module that helps prevent reentrant calls to a function.\n *\n * Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier\n * available, which can be applied to functions to make sure there are no nested\n * (reentrant) calls to them.\n *\n * Note that because there is a single `nonReentrant` guard, functions marked as\n * `nonReentrant` may not call one another. This can be worked around by making\n * those functions `private`, and then adding `external` `nonReentrant` entry\n * points to them.\n *\n * TIP: If you would like to learn more about reentrancy and alternative ways\n * to protect against it, check out our blog post\n * https://blog.openzeppelin.com/reentrancy-after-istanbul/[Reentrancy After Istanbul].\n */\nabstract contract ReentrancyGuard {\n    // Booleans are more expensive than uint256 or any type that takes up a full\n    // word because each write operation emits an extra SLOAD to first read the\n    // slot's contents, replace the bits taken up by the boolean, and then write\n    // back. This is the compiler's defense against contract upgrades and\n    // pointer aliasing, and it cannot be disabled.\n\n    // The values being non-zero value makes deployment a bit more expensive,\n    // but in exchange the refund on every call to nonReentrant will be lower in\n    // amount. Since refunds are capped to a percentage of the total\n    // transaction's gas, it is best to keep them low in cases like this one, to\n    // increase the likelihood of the full refund coming into effect.\n    uint256 private constant _NOT_ENTERED = 1;\n    uint256 private constant _ENTERED = 2;\n\n    uint256 private _status;\n\n    constructor() {\n        _status = _NOT_ENTERED;\n    }\n\n    /**\n     * @dev Prevents a contract from calling itself, directly or indirectly.\n     * Calling a `nonReentrant` function from another `nonReentrant`\n     * function is not supported. It is possible to prevent this from happening\n     * by making the `nonReentrant` function external, and making it call a\n     * `private` function that does the actual work.\n     */\n    modifier nonReentrant() {\n        _nonReentrantBefore();\n        _;\n        _nonReentrantAfter();\n    }\n\n    function _nonReentrantBefore() private {\n        // On the first call to nonReentrant, _notEntered will be true\n        require(_status != _ENTERED, \"ReentrancyGuard: reentrant call\");\n\n        // Any calls to nonReentrant after this point will fail\n        _status = _ENTERED;\n    }\n\n    function _nonReentrantAfter() private {\n        // By storing the original value once again, a refund is triggered (see\n        // https://eips.ethereum.org/EIPS/eip-2200)\n        _status = _NOT_ENTERED;\n    }\n}\n\nlibrary SafeMath {\n    /**\n\n    * @dev Multiplies two unsigned integers, reverts on overflow.\n\n    */\n\n    function mul(uint256 a, uint256 b) internal pure returns (uint256) {\n        // Gas optimization: this is cheaper than requiring 'a' not being zero, but the\n\n        // benefit is lost if 'b' is also tested.\n\n        // See: https://github.com/OpenZeppelin/openzeppelin-solidity/pull/522\n\n        if (a == 0) {\n            return 0;\n        }\n\n        uint256 c = a * b;\n\n        require(c / a == b);\n\n        return c;\n    }\n\n    /**\n\n    * @dev Integer division of two unsigned integers truncating the quotient, reverts on division by zero.\n\n    */\n\n    function div(uint256 a, uint256 b) internal pure returns (uint256) {\n        // Solidity only automatically asserts when dividing by 0\n\n        require(b > 0);\n\n        uint256 c = a / b;\n\n        // assert(a == b * c + a % b); // There is no case in which this doesn't hold\n\n        return c;\n    }\n\n    /**\n\n    * @dev Subtracts two unsigned integers, reverts on overflow (i.e. if subtrahend is greater than minuend).\n\n    */\n\n    function sub(uint256 a, uint256 b) internal pure returns (uint256) {\n        require(b <= a);\n\n        uint256 c = a - b;\n\n        return c;\n    }\n\n    /**\n\n    * @dev Adds two unsigned integers, reverts on overflow.\n\n    */\n\n    function add(uint256 a, uint256 b) internal pure returns (uint256) {\n        uint256 c = a + b;\n\n        require(c >= a);\n\n        return c;\n    }\n\n    /**\n\n    * @dev Divides two unsigned integers and returns the remainder (unsigned integer modulo),\n\n    * reverts when dividing by zero.\n\n    */\n\n    function mod(uint256 a, uint256 b) internal pure returns (uint256) {\n        require(b != 0);\n\n        return a % b;\n    }\n}\n\nabstract contract Context {\n    function _msgSender() internal view virtual returns (address) {\n        return msg.sender;\n    }\n\n    function _msgData() internal view virtual returns (bytes calldata) {\n        return msg.data;\n    }\n}\n\nabstract contract Pausable is Context {\n    /**\n     * @dev Emitted when the pause is triggered by `account`.\n     */\n    event Paused(address account);\n    /**\n     * @dev Emitted when the pause is lifted by `account`.\n     */\n    event Unpaused(address account);\n    bool private _paused;\n\n    /**\n     * @dev Initializes the contract in unpaused state.\n     */\n    constructor() {\n        _paused = false;\n    }\n\n    /**\n     * @dev Returns true if the contract is paused, and false otherwise.\n     */\n    function paused() public view virtual returns (bool) {\n        return _paused;\n    }\n\n    /**\n     * @dev Modifier to make a function callable only when the contract is not paused.\n     *\n     * Requirements:\n     *\n     * - The contract must not be paused.\n     */\n    modifier whenNotPaused() {\n        require(!paused(), \"Pausable: paused\");\n        _;\n    }\n    /**\n     * @dev Modifier to make a function callable only when the contract is paused.\n     *\n     * Requirements:\n     *\n     * - The contract must be paused.\n     */\n    modifier whenPaused() {\n        require(paused(), \"Pausable: not paused\");\n        _;\n    }\n\n    /**\n     * @dev Triggers stopped state.\n     *\n     * Requirements:\n     *\n     * - The contract must not be paused.\n     */\n    function _pause() internal virtual whenNotPaused {\n        _paused = true;\n        emit Paused(_msgSender());\n    }\n\n    /**\n     * @dev Returns to normal state.\n     *\n     * Requirements:\n     *\n     * - The contract must be paused.\n     */\n    function _unpause() internal virtual whenPaused {\n        _paused = false;\n        emit Unpaused(_msgSender());\n    }\n}\n\ncontract Ownable {\n    address private _owner;\n\n    event OwnershipTransferred(\n        address indexed previousOwner,\n        address indexed newOwner\n    );\n\n    /**\n\n     * @dev Initializes the contract setting the deployer as the initial owner.\n\n     */\n\n    constructor() {\n        _owner = msg.sender;\n\n        emit OwnershipTransferred(address(0), _owner);\n    }\n\n    /**\n\n     * @dev Returns the address of the current owner.\n\n     */\n\n    function owner() public view returns (address) {\n        return _owner;\n    }\n\n    /**\n\n     * @dev Throws if called by any account other than the owner.\n\n     */\n\n    modifier onlyOwner() {\n        require(_owner == msg.sender, \"Ownable: caller is not the owner\");\n\n        _;\n    }\n\n    /**\n\n     * @dev Transfers ownership of the contract to a new account (`newOwner`).\n\n     * Can only be called by the current owner.\n\n     */\n\n    function transferOwnership(address newOwner) public onlyOwner {\n        require(\n            newOwner != address(0),\n            \"Ownable: new owner is the zero address\"\n        );\n\n        emit OwnershipTransferred(_owner, newOwner);\n\n        _owner = newOwner;\n    }\n}\n\ncontract IntelliQuant_Staking is Ownable, Pausable, ReentrancyGuard {\n    using SafeMath for uint256;\n    IERC20 public Token;\n\n    struct userInfo {\n        uint256 DepositeToken;\n        uint256 lastUpdated;\n        uint256 lockableDays;\n        uint256 WithdrawReward;\n        uint256 WithdrawAbleReward;\n        uint256 depositeTime;\n        uint256 WithdrawDepositeAmount;\n    }\n\n    event Deposite_(\n        address indexed to,\n        address indexed From,\n        uint256 amount,\n        uint256 day,\n        uint256 time\n    );\n\n    mapping(uint256 => uint256) public allocation;\n    mapping(address => uint256[]) public depositeToken;\n    mapping(address => uint256[]) public lockabledays;\n    mapping(address => uint256[]) public depositetime;\n    mapping(address => userInfo) public Users;\n    mapping(address => bool) public isSpam;\n\n    uint256 public minimumDeposit = 1000000000000000000; //1 token\n    uint256 public deductionPercentage = 10000000000000000000; //10%\n    uint256 public taxMakeupPercentage = 1000000000000000000; //1% this should be same as transferTaxPercentage in IntelliQuant token contract\n    address public taxreceiver;\n\n    uint256 public time = 1 days;\n\n    constructor(IERC20 _token) {\n        Token = _token;\n\n        allocation[14] = 416666666660000000; //10 % APY = 0.41 percent\n        allocation[30] = 1666666666670000000; //20 % APY= 1.66 percent\n        allocation[60] = 5000000000000000000; //30 % APY= 5 percent\n        allocation[90] = 12500000000000000000; //50% APY= 12.5 percent\n    }\n\n    function farm(\n        uint256 _amount,\n        uint256 _lockableDays\n    ) external whenNotPaused nonReentrant {\n        require(isSpam[msg.sender] == false, \"Account is spam!\");\n        require(_amount >= minimumDeposit, \"Invalid amount\");\n        require(allocation[_lockableDays] > 0, \"Invalid day selection\");\n        Token.transferFrom(msg.sender, address(this), _amount);\n        depositeToken[msg.sender].push(_amount);\n        depositetime[msg.sender].push(uint40(block.timestamp));\n        Users[msg.sender].DepositeToken += _amount;\n        lockabledays[msg.sender].push(_lockableDays);\n        emit Deposite_(\n            msg.sender,\n            address(this),\n            _amount,\n            _lockableDays,\n            block.timestamp\n        );\n    }\n\n    function pendindRewards(address _add) public view returns (uint256 reward) {\n        uint256 Reward;\n        for (uint256 z = 0; z < depositeToken[_add].length; z++) {\n            uint256 lockTime = depositetime[_add][z] +\n                (lockabledays[_add][z] * time);\n            if (block.timestamp > lockTime) {\n                reward = (\n                    allocation[lockabledays[_add][z]]\n                        .mul(depositeToken[_add][z])\n                        .div(100)\n                ).div(1e18);\n                Reward += reward;\n            }\n        }\n        return Reward;\n    }\n\n    function harvest(uint256 _index) external whenNotPaused nonReentrant {\n        require(\n            _index < depositeToken[msg.sender].length,\n            \"index out of bound\"\n        );\n        require(isSpam[msg.sender] == false, \"Account is spam!\");\n        uint256 deductionfee;\n\n        require(Users[msg.sender].DepositeToken > 0, \" Deposit not \");\n        uint256 lockTime = depositetime[msg.sender][_index] +\n            (lockabledays[msg.sender][_index].mul(time));\n        if (block.timestamp > lockTime) {\n            uint256 reward = (\n                allocation[lockabledays[msg.sender][_index]]\n                    .mul(depositeToken[msg.sender][_index])\n                    .div(100)\n            ).div(1e18);\n\n            Users[msg.sender].WithdrawAbleReward += reward;\n            Users[msg.sender].DepositeToken -= depositeToken[msg.sender][\n                _index\n            ];\n            Users[msg.sender].WithdrawDepositeAmount += depositeToken[\n                msg.sender\n            ][_index];\n            depositeToken[msg.sender][_index] = 0;\n            lockabledays[msg.sender][_index] = 0;\n            depositetime[msg.sender][_index] = 0;\n        } else {\n            Users[msg.sender].DepositeToken -= depositeToken[msg.sender][\n                _index\n            ];\n            uint256 a;\n            if (deductionPercentage > 0) {\n                a = (\n                    (\n                        (depositeToken[msg.sender][_index]).mul(\n                            deductionPercentage\n                        )\n                    ).div(100)\n                ).div(1e18);\n            }\n            uint256 b = depositeToken[msg.sender][_index] - a;\n            Users[msg.sender].WithdrawDepositeAmount += b;\n            deductionfee += a;\n            depositeToken[msg.sender][_index] = 0;\n            lockabledays[msg.sender][_index] = 0;\n            depositetime[msg.sender][_index] = 0;\n        }\n\n        for (\n            uint256 i = _index;\n            i < depositeToken[msg.sender].length - 1;\n            i++\n        ) {\n            depositeToken[msg.sender][i] = depositeToken[msg.sender][i + 1];\n            lockabledays[msg.sender][i] = lockabledays[msg.sender][i + 1];\n            depositetime[msg.sender][i] = depositetime[msg.sender][i + 1];\n        }\n        depositeToken[msg.sender].pop();\n        lockabledays[msg.sender].pop();\n        depositetime[msg.sender].pop();\n\n        uint256 totalwithdrawAmount;\n\n        totalwithdrawAmount = Users[msg.sender].WithdrawDepositeAmount.add(\n            Users[msg.sender].WithdrawAbleReward\n        );\n\n        uint256 taxMakeup = (\n            (\n                (totalwithdrawAmount).mul(\n                    taxMakeupPercentage + taxMakeupPercentage.div(2)\n                )\n            ).div(100)\n        ).div(1e18);\n\n        Token.transfer(msg.sender, totalwithdrawAmount + taxMakeup);\n        if (deductionfee > 0) {\n            Token.transfer(taxreceiver, deductionfee);\n        }\n        Users[msg.sender].WithdrawReward = Users[msg.sender].WithdrawReward.add(\n            Users[msg.sender].WithdrawAbleReward\n        );\n        Users[msg.sender].WithdrawAbleReward = 0;\n        Users[msg.sender].WithdrawDepositeAmount = 0;\n    }\n\n    function changeDeductionPercentage(uint256 amount) public onlyOwner {\n        deductionPercentage = amount;\n    }\n\n    function changeTaxMakeupPercentage(uint256 amount) public onlyOwner {\n        taxMakeupPercentage = amount;\n    }\n\n    function UserInformation(\n        address _add\n    )\n        public\n        view\n        returns (uint256[] memory, uint256[] memory, uint256[] memory)\n    {\n        return (depositeToken[_add], lockabledays[_add], depositetime[_add]);\n    }\n\n    function emergencyWithdrawtokens(\n        IERC20 _token,\n        uint256 _amount\n    ) external onlyOwner {\n        _token.transfer(msg.sender, _amount);\n    }\n\n    function emergencyWithdrawETH(uint256 Amount) external onlyOwner {\n        payable(msg.sender).transfer(Amount);\n    }\n\n    function changetimeCal(uint256 _time) external onlyOwner {\n        time = _time;\n    }\n\n    function changeMinimmumAmount(uint256 amount) external onlyOwner {\n        minimumDeposit = amount;\n    }\n\n    function changePercentages(\n        uint256 _14dayspercent,\n        uint256 _30dayspercent,\n        uint256 _60dayspercent,\n        uint256 _90dayspercent\n    ) external onlyOwner {\n        allocation[14] = _14dayspercent;\n        allocation[30] = _30dayspercent;\n        allocation[60] = _60dayspercent;\n        allocation[90] = _90dayspercent;\n    }\n\n    function pausePool() external onlyOwner {\n        _pause();\n    }\n\n    function UnpausePool() external onlyOwner {\n        _unpause();\n    }\n\n    function changeToken(IERC20 addr) public onlyOwner {\n        Token = addr;\n    }\n\n    function addorRemoveSpam(address _Addr, bool _state) external onlyOwner {\n        isSpam[_Addr] = _state;\n    }\n\n    function settaxreceiver(address _taxreceiver) external onlyOwner {\n        taxreceiver = _taxreceiver;\n    }\n\n    receive() external payable {\n        //  receive the ETH\n    }\n}\n"
      }
    },
    "settings": {
      "optimizer": {
        "enabled": false,
        "runs": 200
      },
      "outputSelection": {
        "*": {
          "*": [
            "evm.bytecode",
            "evm.deployedBytecode",
            "devdoc",
            "userdoc",
            "metadata",
            "abi"
          ]
        }
      },
      "libraries": {}
    }
  }}