{
    "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    /* ========== 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    // The address of Converter contract.\r\n    address public immutable converter;\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(IERC20 _vader, address _converter) {\r\n        require(\r\n            _vader != IERC20(_ZERO_ADDRESS) && _converter != _ZERO_ADDRESS,\r\n            \"LinearVesting::constructor: Misconfiguration\"\r\n        );\r\n\r\n        vader = _vader;\r\n        converter = _converter;\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(address _vester)\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[_vester];\r\n        return\r\n            _getClaim(\r\n                vester.amount,\r\n                vester.lastClaim,\r\n                vester.start,\r\n                vester.end\r\n            );\r\n    }\r\n\r\n    /* ========== MUTATIVE FUNCTIONS ========== */\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 claim() 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.transfer(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(address[] calldata vesters, uint192[] calldata amounts)\r\n        external\r\n        override\r\n        onlyOwner\r\n    {\r\n        require(\r\n            vesters.length == amounts.length,\r\n            \"LinearVesting::begin: Vesters and Amounts lengths do not match\"\r\n        );\r\n\r\n        uint256 _start = block.timestamp;\r\n        uint256 _end = block.timestamp + _VESTING_DURATION;\r\n\r\n        start = _start;\r\n        end = _end;\r\n\r\n        uint256 total;\r\n        // C4-Audit Fix for Issue # 81\r\n        for (uint256 i = 0; i < vesters.length; ++i) {\r\n            require(\r\n                amounts[i] != 0,\r\n                \"LinearVesting::begin: Incorrect Amount Specified\"\r\n            );\r\n            require(\r\n                vesters[i] != _ZERO_ADDRESS,\r\n                \"LinearVesting::begin: Zero Vester Address Specified\"\r\n            );\r\n            require(\r\n                vest[vesters[i]].amount == 0,\r\n                \"LinearVesting::begin: Duplicate Vester Entry Specified\"\r\n            );\r\n            vest[vesters[i]] = Vester(\r\n                amounts[i],\r\n                0,\r\n                uint128(_start),\r\n                uint128(_end)\r\n            );\r\n            total = total + amounts[i];\r\n        }\r\n        require(\r\n            total == _TEAM_ALLOCATION,\r\n            \"LinearVesting::begin: Invalid Vest Amounts Specified\"\r\n        );\r\n\r\n        require(\r\n            vader.balanceOf(address(this)) >= _TEAM_ALLOCATION,\r\n            \"LinearVesting::begin: Vader is less than TEAM_ALLOCATION\"\r\n        );\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     * Requirements:\r\n     * - Only {converter} can call.\r\n     */\r\n    function vestFor(address user, uint256 amount)\r\n        external\r\n        override\r\n        onlyConverter\r\n        hasStarted\r\n    {\r\n        require(\r\n            amount <= type(uint192).max,\r\n            \"LinearVesting::vestFor: Amount Overflows uint192\"\r\n        );\r\n        require(\r\n            vest[user].amount == 0,\r\n            \"LinearVesting::vestFor: 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.transferFrom(msg.sender, address(this), amount);\r\n\r\n        emit VestingCreated(user, amount);\r\n    }\r\n\r\n    /* ========== PRIVATE FUNCTIONS ========== */\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    /*\r\n     * @dev Ensures that only converter is able to call a function.\r\n     **/\r\n    function _onlyConverter() private view {\r\n        require(\r\n            msg.sender == converter,\r\n            \"LinearVesting::_onlyConverter: Only converter is allowed to call\"\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\r\n    /*\r\n     * @dev Throws if called by address that is not converter.\r\n     **/\r\n    modifier onlyConverter() {\r\n        _onlyConverter();\r\n        _;\r\n    }\r\n}"
}