A=V(1+r)
fee=VkT
function getCreditAmountOut(
    State storage state,
    uint256 cashAmountIn,
    uint256 maxCashAmountIn,
    uint256 maxCredit,
    uint256 ratePerTenor,
    uint256 tenor
) internal view returns (uint256 creditAmountOut, uint256 fees) {
    if (cashAmountIn == maxCashAmountIn) {
        creditAmountOut = maxCredit;
        fees = getSwapFee(state, cashAmountIn, tenor);
    } else if (cashAmountIn < maxCashAmountIn) {
        ...
    } else {
        revert Errors.NOT_ENOUGH_CREDIT(maxCashAmountIn, cashAmountIn);
    }
}
function executeBuyCreditMarket(State storage state, BuyCreditMarketParams memory params)
    external
    returns (uint256 cashAmountIn)
{
    state.data.borrowAToken.transferFrom(msg.sender, borrower, cashAmountIn - fees);
    state.data.borrowAToken.transferFrom(msg.sender, state.feeConfig.feeRecipient, fees);
}
