{
    "Function": "getBonds",
    "File": "tokenomics/contracts/Depository.sol",
    "Parent Contracts": [
        "tokenomics/contracts/interfaces/IErrorsTokenomics.sol"
    ],
    "High-Level Calls": [],
    "Internal Calls": [
        "revert ZeroAddress()"
    ],
    "Library Calls": [],
    "Low-Level Calls": [],
    "Code": "function getBonds(address account, bool matured) external view\n        returns (uint256[] memory bondIds, uint256 payout)\n    {\n        // Check the address\n        if (account == address(0)) {\n            revert ZeroAddress();\n        }\n\n        uint256 numAccountBonds;\n        // Calculate the number of pending bonds\n        uint256 numBonds = bondCounter;\n        bool[] memory positions = new bool[](numBonds);\n        // Record the bond number if it belongs to the account address and was not yet redeemed\n        for (uint256 i = 0; i < numBonds; ++i) {\n            // Check if the bond belongs to the account\n            // If not and the address is zero, the bond was redeemed or never existed\n            if (mapUserBonds[i].account == account) {\n                // Check if requested bond is not matured but owned by the account address\n                if (!matured ||\n                    // Or if the requested bond is matured, i.e., the bond maturity timestamp passed\n                    block.timestamp >= mapUserBonds[i].maturity)\n                {\n                    positions[i] = true;\n                    ++numAccountBonds;\n                    // The payout is always bigger than zero if the bond exists\n                    payout += mapUserBonds[i].payout;\n                }\n            }\n        }\n\n        // Form pending bonds index array\n        bondIds = new uint256[](numAccountBonds);\n        uint256 numPos;\n        for (uint256 i = 0; i < numBonds; ++i) {\n            if (positions[i]) {\n                bondIds[numPos] = i;\n                ++numPos;\n            }\n        }\n    }"
}