{
    "Function": "redelegateUnstaked",
    "File": "contracts/DelegatedStaking.sol",
    "Parent Contracts": [
        "node_modules/@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol",
        "node_modules/@openzeppelin/contracts-upgradeable/utils/ContextUpgradeable.sol",
        "node_modules/@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol"
    ],
    "High-Level Calls": [],
    "Internal Calls": [
        "require(bool,string)",
        "require(bool,string)",
        "_stake",
        "require(bool,string)"
    ],
    "Library Calls": [],
    "Low-Level Calls": [],
    "Code": "function redelegateUnstaked(uint128 amount, uint128 oldValidatorId, uint128 newValidatorId, uint128 unstakingId) public {\n        require(validators[oldValidatorId].disabledEpoch != 0, \"Validator is not disabled\");\n        require(validators[oldValidatorId]._address != msg.sender, \"Validator cannot redelegate\");\n        Unstaking storage us = validators[oldValidatorId].unstakings[msg.sender][unstakingId];\n        require(us.amount >= amount, \"Unstaking has less tokens\");\n        _stake(newValidatorId, amount, false);\n        unchecked { us.amount -= amount; }\n        // set cool down end to 0 to release gas if new unstaking amount is 0\n        if(us.amount == 0)\n            us.coolDownEnd = 0;\n        emit TransferredUnstake(oldValidatorId, newValidatorId, msg.sender, amount, unstakingId);\n    }"
}