{
    "Function": "claimable",
    "File": "contracts/SecondSwap_StepVesting.sol",
    "Parent Contracts": [
        "contracts/interface/SecondSwap_Vesting.sol"
    ],
    "High-Level Calls": [
        "Math"
    ],
    "Internal Calls": [],
    "Library Calls": [
        "min"
    ],
    "Low-Level Calls": [],
    "Code": "function claimable(address _beneficiary) public view returns (uint256, uint256) {\n        Vesting memory vesting = _vestings[_beneficiary];\n        if (vesting.totalAmount == 0) {\n            return (0, 0);\n        }\n\n        uint256 currentTime = Math.min(block.timestamp, endTime);\n        if (currentTime < startTime) {\n            return (0, 0);\n        }\n\n        uint256 elapsedTime = currentTime - startTime;\n        uint256 currentStep = elapsedTime / stepDuration;\n        uint256 claimableSteps = currentStep - vesting.stepsClaimed;\n\n        uint256 claimableAmount;\n\n        if (vesting.stepsClaimed + claimableSteps >= numOfSteps) {\n            //[BUG FIX] user can buy more than they are allocated\n            claimableAmount = vesting.totalAmount - vesting.amountClaimed;\n            return (claimableAmount, claimableSteps);\n        }\n\n        claimableAmount = vesting.releaseRate * claimableSteps;\n        return (claimableAmount, claimableSteps);\n    }"
}