{
    "Function": "withdrawTokens",
    "File": "contracts/staking/libs/Stakes.sol",
    "Parent Contracts": [],
    "High-Level Calls": [
        "Stakes",
        "Stakes",
        "Stakes"
    ],
    "Internal Calls": [],
    "Library Calls": [
        "tokensWithdrawable",
        "release",
        "unlockTokens"
    ],
    "Low-Level Calls": [],
    "Code": "function withdrawTokens(Stakes.Indexer storage stake) internal returns (uint256) {\n        // Calculate tokens that can be released\n        uint256 tokensToWithdraw = stake.tokensWithdrawable();\n\n        if (tokensToWithdraw > 0) {\n            // Reset locked tokens\n            stake.unlockTokens(tokensToWithdraw);\n\n            // Decrease indexer stake\n            stake.release(tokensToWithdraw);\n        }\n\n        return tokensToWithdraw;\n    }"
}