{
    "Function": "redeem",
    "File": "tokenomics/contracts/Depository.sol",
    "Parent Contracts": [
        "tokenomics/contracts/interfaces/IErrorsTokenomics.sol"
    ],
    "High-Level Calls": [
        "IToken"
    ],
    "Internal Calls": [
        "revert BondNotRedeemable(uint256)",
        "revert ZeroValue()",
        "revert OwnerOnly(address,address)"
    ],
    "Library Calls": [],
    "Low-Level Calls": [],
    "Code": "function redeem(uint256[] memory bondIds) external returns (uint256 payout) {\n        for (uint256 i = 0; i < bondIds.length; ++i) {\n            // Get the amount to pay and the maturity status\n            uint256 pay = mapUserBonds[bondIds[i]].payout;\n            bool matured = block.timestamp >= mapUserBonds[bondIds[i]].maturity;\n\n            // Revert if the bond does not exist or is not matured yet\n            if (pay == 0 || !matured) {\n                revert BondNotRedeemable(bondIds[i]);\n            }\n\n            // Check that the msg.sender is the owner of the bond\n            if (mapUserBonds[bondIds[i]].account != msg.sender) {\n                revert OwnerOnly(msg.sender, mapUserBonds[bondIds[i]].account);\n            }\n\n            // Increase the payout\n            payout += pay;\n\n            // Get the productId\n            uint256 productId = mapUserBonds[bondIds[i]].productId;\n\n            // Delete the Bond struct and release the gas\n            delete mapUserBonds[bondIds[i]];\n            emit RedeemBond(productId, msg.sender, bondIds[i]);\n        }\n\n        // Check for the non-zero payout\n        if (payout == 0) {\n            revert ZeroValue();\n        }\n\n        // No reentrancy risk here since it's the last operation, and originated from the OLAS token\n        // No need to check for the return value, since it either reverts or returns true, see the ERC20 implementation\n        IToken(olas).transfer(msg.sender, payout);\n    }"
}