{
    "Function": "_updateGlobalExchangeRate",
    "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": [],
    "Library Calls": [],
    "Low-Level Calls": [],
    "Code": "function _updateGlobalExchangeRate() internal {\n        uint128 currentBlock = uint128(block.number);\n        // if the program ended, set update epoch to the end epoch\n        uint128 currentEpoch = currentBlock < endEpoch? currentBlock : endEpoch;\n        if (currentEpoch != lastUpdateEpoch){\n            // when no one has staked anything, do not update the rate\n            if(totalGlobalShares > 0)\n            {\n                unchecked { globalExchangeRate += uint128(uint256(allocatedTokensPerEpoch) * divider * uint256(currentEpoch - lastUpdateEpoch)/uint256(totalGlobalShares)) ; }\n            }\n            lastUpdateEpoch = currentEpoch;\n        }\n    }"
}