{
    "Function": "slitherConstructorConstantVariables",
    "File": "contracts/tokens/vesting/LinearVesting.sol",
    "Parent Contracts": [
        "node_modules/@openzeppelin/contracts/access/Ownable.sol",
        "node_modules/@openzeppelin/contracts/utils/Context.sol",
        "contracts/shared/ProtocolConstants.sol",
        "contracts/interfaces/tokens/vesting/ILinearVesting.sol"
    ],
    "High-Level Calls": [],
    "Internal Calls": [],
    "Library Calls": [],
    "Low-Level Calls": [],
    "Code": "contract LinearVesting is ILinearVesting, ProtocolConstants, Ownable {\r\n    /* ========== LIBRARIES ========== */\r\n\r\n    // Used for safe VADER transfers\r\n    using SafeERC20 for IERC20;\r\n\r\n    /* ========== STATE VARIABLES ========== */\r\n\r\n    // The Vader token\r\n    IERC20 public immutable vader;\r\n\r\n    // The start of the vesting period\r\n    uint256 public start;\r\n\r\n    // The end of the vesting period\r\n    uint256 public end;\r\n\r\n    // The status of each vesting member (Vester)\r\n    mapping(address => Vester) public vest;\r\n\r\n    /* ========== CONSTRUCTOR ========== */\r\n\r\n    /**\r\n     * @dev Initializes the contract's vesters and vesting amounts as well as sets\r\n     * the Vader token address.\r\n     *\r\n     * It conducts a sanity check to ensure that the total vesting amounts specified match\r\n     * the team allocation to ensure that the contract is deployed correctly.\r\n     *\r\n     * Additionally, it transfers ownership to the Vader contract that needs to consequently\r\n     * initiate the vesting period via {begin} after it mints the necessary amount to the contract.\r\n     */\r\n    constructor(\r\n        IERC20 _vader,\r\n        address[] memory vesters,\r\n        uint192[] memory amounts\r\n    ) {\r\n        require(\r\n            _vader != IERC20(_ZERO_ADDRESS) && vesters.length == amounts.length,\r\n            \"LinearVesting::constructor: Misconfiguration\"\r\n        );\r\n\r\n        vader = _vader;\r\n\r\n        uint256 total;\r\n        for (uint256 i = 0; i < vesters.length; i++) {\r\n            require(\r\n                amounts[i] != 0,\r\n                \"LinearVesting::constructor: Incorrect Amount Specified\"\r\n            );\r\n            vest[vesters[i]].amount = amounts[i];\r\n            total = total + amounts[i];\r\n        }\r\n        require(\r\n            total == _TEAM_ALLOCATION,\r\n            \"LinearVesting::constructor: Invalid Vest Amounts Specified\"\r\n        );\r\n\r\n        transferOwnership(address(_vader));\r\n    }\r\n\r\n    /* ========== VIEWS ========== */\r\n\r\n    /**\r\n     * @dev Returns the amount a user can claim at a given point in time.\r\n     *\r\n     * Requirements:\r\n     * - the vesting period has started\r\n     */\r\n    function getClaim()\r\n        external\r\n        view\r\n        override\r\n        hasStarted\r\n        returns (uint256 vestedAmount)\r\n    {\r\n        Vester memory vester = vest[msg.sender];\r\n        return _getClaim(vester.amount, vester.lastClaim);\r\n    }\r\n\r\n    /* ========== MUTATIVE FUNCTIONS ========== */\r\n\r\n    /**\r\n     * @dev Allows a user to claim their pending vesting amount.\r\n     *\r\n     * Emits a {Vested} event indicating the user who claimed their vested tokens\r\n     * as well as the amount that was vested.\r\n     *\r\n     * Requirements:\r\n     *\r\n     * - the vesting period has started\r\n     * - the caller must have a non-zero vested amount\r\n     */\r\n    function claim()\r\n        external\r\n        override\r\n        hasStarted\r\n        returns (uint256 vestedAmount)\r\n    {\r\n        Vester memory vester = vest[msg.sender];\r\n\r\n        require(\r\n            vester.start == 0,\r\n            \"LinearVesting::claim: Incorrect Vesting Type\"\r\n        );\r\n\r\n        vestedAmount = _getClaim(vester.amount, vester.lastClaim);\r\n\r\n        require(vestedAmount != 0, \"LinearVesting::claim: Nothing to claim\");\r\n\r\n        vester.amount -= uint192(vestedAmount);\r\n        vester.lastClaim = uint64(block.timestamp);\r\n\r\n        vest[msg.sender] = vester;\r\n\r\n        emit Vested(msg.sender, vestedAmount);\r\n\r\n        vader.safeTransfer(msg.sender, vestedAmount);\r\n    }\r\n\r\n    /**\r\n     * @dev Allows a user to claim their pending vesting amount of the vested claim\r\n     *\r\n     * Emits a {Vested} event indicating the user who claimed their vested tokens\r\n     * as well as the amount that was vested.\r\n     *\r\n     * Requirements:\r\n     *\r\n     * - the vesting period has started\r\n     * - the caller must have a non-zero vested amount\r\n     */\r\n    function claimConverted() external override returns (uint256 vestedAmount) {\r\n        Vester memory vester = vest[msg.sender];\r\n\r\n        require(\r\n            vester.start != 0,\r\n            \"LinearVesting::claim: Incorrect Vesting Type\"\r\n        );\r\n\r\n        require(\r\n            vester.start < block.timestamp,\r\n            \"LinearVesting::claim: Not Started Yet\"\r\n        );\r\n\r\n        vestedAmount = _getClaim(\r\n            vester.amount,\r\n            vester.lastClaim,\r\n            vester.start,\r\n            vester.end\r\n        );\r\n\r\n        require(vestedAmount != 0, \"LinearVesting::claim: Nothing to claim\");\r\n\r\n        vester.amount -= uint192(vestedAmount);\r\n        vester.lastClaim = uint64(block.timestamp);\r\n\r\n        vest[msg.sender] = vester;\r\n\r\n        emit Vested(msg.sender, vestedAmount);\r\n\r\n        vader.safeTransfer(msg.sender, vestedAmount);\r\n    }\r\n\r\n    /* ========== RESTRICTED FUNCTIONS ========== */\r\n\r\n    /**\r\n     * @dev Allows the vesting period to be initiated.\r\n     *\r\n     * Emits a {VestingInitialized} event from which the start and\r\n     * end can be calculated via it's attached timestamp.\r\n     *\r\n     * Requirements:\r\n     *\r\n     * - the caller must be the owner (vader token)\r\n     */\r\n    function begin() external override onlyOwner {\r\n        start = block.timestamp;\r\n        end = block.timestamp + _VESTING_DURATION;\r\n\r\n        emit VestingInitialized(_VESTING_DURATION);\r\n\r\n        renounceOwnership();\r\n    }\r\n\r\n    /**\r\n     * @dev Adds a new vesting schedule to the contract\r\n     */\r\n    function vestFor(address user, uint256 amount) external override {\r\n        require(\r\n            vest[user].amount == 0,\r\n            \"LinearVesting::selfVest: Already a vester\"\r\n        );\r\n        vest[user] = Vester(\r\n            uint192(amount),\r\n            0,\r\n            uint128(block.timestamp),\r\n            uint128(block.timestamp + 365 days)\r\n        );\r\n        vader.safeTransferFrom(msg.sender, address(this), amount);\r\n    }\r\n\r\n    /* ========== PRIVATE FUNCTIONS ========== */\r\n\r\n    /**\r\n     * @dev Calculates the amount a user's vest is due. To calculate,\r\n     * the following formula is utilized:\r\n     *\r\n     * - (remainingAmount * timeElapsed) / timeUntilEnd\r\n     *\r\n     * Each variable is described as follows:\r\n     *\r\n     * - remainingAmount (amount): Vesting amount remaining. Each claim subtracts from\r\n     * this amount to ensure calculations are properly conducted.\r\n     *\r\n     * - timeElapsed (block.timestamp.sub(lastClaim)): Time that has elapsed since the\r\n     * last claim.\r\n     *\r\n     * - timeUntilEnd (end.sub(lastClaim)): Time remaining for the particular vesting\r\n     * member's total duration.\r\n     *\r\n     * Vesting calculations are relative and always update the last\r\n     * claim timestamp as well as remaining amount whenever they\r\n     * are claimed.\r\n     */\r\n    function _getClaim(uint256 amount, uint256 lastClaim)\r\n        private\r\n        view\r\n        returns (uint256)\r\n    {\r\n        uint256 _end = end;\r\n\r\n        if (block.timestamp >= _end) return amount;\r\n        if (lastClaim == 0) lastClaim = start;\r\n\r\n        return (amount * (block.timestamp - lastClaim)) / (_end - lastClaim);\r\n    }\r\n\r\n    /**\r\n     * @dev Calculates the amount a user's vest is due. To calculate,\r\n     * the following formula is utilized:\r\n     *\r\n     * - (remainingAmount * timeElapsed) / timeUntilEnd\r\n     *\r\n     * Each variable is described as follows:\r\n     *\r\n     * - remainingAmount (amount): Vesting amount remaining. Each claim subtracts from\r\n     * this amount to ensure calculations are properly conducted.\r\n     *\r\n     * - timeElapsed (block.timestamp.sub(lastClaim)): Time that has elapsed since the\r\n     * last claim.\r\n     *\r\n     * - timeUntilEnd (end.sub(lastClaim)): Time remaining for the particular vesting\r\n     * member's total duration.\r\n     *\r\n     * Vesting calculations are relative and always update the last\r\n     * claim timestamp as well as remaining amount whenever they\r\n     * are claimed.\r\n     */\r\n    function _getClaim(\r\n        uint256 amount,\r\n        uint256 lastClaim,\r\n        uint256 _start,\r\n        uint256 _end\r\n    ) private view returns (uint256) {\r\n        if (block.timestamp >= _end) return amount;\r\n        if (lastClaim == 0) lastClaim = _start;\r\n\r\n        return (amount * (block.timestamp - lastClaim)) / (_end - lastClaim);\r\n    }\r\n\r\n    /**\r\n     * @dev Validates that the vesting period has started\r\n     */\r\n    function _hasStarted() private view {\r\n        require(\r\n            start != 0,\r\n            \"LinearVesting::_hasStarted: Vesting hasn't started yet\"\r\n        );\r\n    }\r\n\r\n    /* ========== MODIFIERS ========== */\r\n\r\n    /**\r\n     * @dev Throws if the vesting period hasn't started\r\n     */\r\n    modifier hasStarted() {\r\n        _hasStarted();\r\n        _;\r\n    }\r\n}"
}