{
    "Function": "pendingLockAtEpochOf",
    "File": "contracts/VE3DLocker.sol",
    "Parent Contracts": [
        "node_modules/@openzeppelin/contracts/access/Ownable.sol",
        "node_modules/@openzeppelin/contracts/utils/Context.sol",
        "node_modules/@openzeppelin/contracts/security/ReentrancyGuard.sol"
    ],
    "High-Level Calls": [
        "BoringMath",
        "BoringMath"
    ],
    "Internal Calls": [],
    "Library Calls": [
        "add",
        "sub"
    ],
    "Low-Level Calls": [],
    "Code": "function pendingLockAtEpochOf(uint256 _epoch, address _user)\n        external\n        view\n        returns (uint256 amount)\n    {\n        LockedBalance[] storage locks = userLocks[_user];\n\n        //get next epoch from the given epoch index\n        uint256 nextEpoch = uint256(epochs[_epoch].date).add(rewardsDuration);\n\n        //traverse inversely to make more current queries more gas efficient\n        for (uint256 i = locks.length - 1; i + 1 != 0; i--) {\n            uint256 lockEpoch = uint256(locks[i].unlockTime).sub(lockDuration);\n\n            //return the next epoch balance\n            if (lockEpoch == nextEpoch) {\n                return locks[i].amount;\n            } else if (lockEpoch < nextEpoch) {\n                //no need to check anymore\n                break;\n            }\n        }\n\n        return 0;\n    }"
}