{
    "Function": "redeemPayment",
    "File": "src/contracts/middleware/PaymentManager.sol",
    "Parent Contracts": [
        "src/contracts/permissions/Pausable.sol",
        "src/contracts/interfaces/IPausable.sol",
        "src/contracts/interfaces/IPaymentManager.sol",
        "lib/openzeppelin-contracts-upgradeable/contracts/proxy/utils/Initializable.sol"
    ],
    "High-Level Calls": [
        "SafeERC20",
        "IDelegationManager",
        "SafeERC20"
    ],
    "Internal Calls": [
        "require(bool,string)",
        "require(bool,string)",
        "onlyWhenNotPaused",
        "_payForServiceHook"
    ],
    "Library Calls": [
        "safeTransfer",
        "safeTransfer"
    ],
    "Low-Level Calls": [],
    "Code": "function redeemPayment() external onlyWhenNotPaused(PAUSED_REDEEM_PAYMENT) {\n        // verify that the `msg.sender` has a committed payment\n        require(\n            operatorToPayment[msg.sender].status == PaymentStatus.COMMITTED,\n            \"PaymentManager.redeemPayment: Payment Status is not 'COMMITTED'\"\n        );\n\n        // check that the fraudproof period has already transpired\n        require(\n            block.timestamp > operatorToPayment[msg.sender].confirmAt,\n            \"PaymentManager.redeemPayment: Payment still eligible for fraudproof\"\n        );\n\n        // update the status to show that operator's payment is getting redeemed\n        operatorToPayment[msg.sender].status = PaymentStatus.REDEEMED;\n\n        // Transfer back the challengeAmount to the operator as there was no successful challenge to the payment commitment made by the operator.\n        paymentChallengeToken.safeTransfer(msg.sender, operatorToPayment[msg.sender].challengeAmount);\n\n        // look up payment amount and delegation terms address for the `msg.sender`\n        uint256 amount = operatorToPayment[msg.sender].amount;\n        IDelegationTerms dt = delegationManager.delegationTerms(msg.sender);\n\n        // transfer the amount due in the payment claim of the operator to its delegation terms contract, where the delegators can withdraw their rewards.\n        paymentToken.safeTransfer(address(dt), amount);\n\n        // emit event\n        emit PaymentRedemption(msg.sender, amount);\n\n        // inform the DelegationTerms contract of the payment, which will determine the rewards the operator and its delegators are eligible for\n        _payForServiceHook(dt, amount);\n    }"
}