{
    "Function": "getDepositorCollGain",
    "File": "contracts/src/StabilityPool.sol",
    "Parent Contracts": [
        "contracts/src/Interfaces/IStabilityPoolEvents.sol",
        "contracts/src/Interfaces/IStabilityPool.sol",
        "contracts/src/Interfaces/IBoldRewardsReceiver.sol",
        "contracts/src/Dependencies/LiquityBase.sol",
        "contracts/src/Interfaces/ILiquityBase.sol"
    ],
    "High-Level Calls": [
        "LiquityMath"
    ],
    "Internal Calls": [],
    "Library Calls": [
        "_min"
    ],
    "Low-Level Calls": [],
    "Code": "function getDepositorCollGain(address _depositor) public view override returns (uint256) {\n        uint256 initialDeposit = deposits[_depositor].initialValue;\n        if (initialDeposit == 0) return 0;\n\n        Snapshots storage snapshots = depositSnapshots[_depositor];\n\n        // Coll gains from the same scale in which the deposit was made need no scaling\n        uint256 normalizedGains = scaleToS[snapshots.scale] - snapshots.S;\n\n        // Scale down further coll gains by a power of `SCALE_FACTOR` depending on how many scale changes they span\n        for (uint256 i = 1; i <= SCALE_SPAN; ++i) {\n            normalizedGains += scaleToS[snapshots.scale + i] / SCALE_FACTOR ** i;\n        }\n\n        return LiquityMath._min((initialDeposit * normalizedGains) / snapshots.P, collBalance);\n    }"
}