{
 "lead": "ikr-redeem",
 "commit": "bbeda7b27ae80abcf070e0158cb8a31e87bb2286",
 "midnightSubmoduleCommit": "4e2570e51171d09228645b2d5bdf84ef24b1720b",
 "blocked": false,
 "hasCandidates": false,
 "summary": "No fault found in in-kind redemption (vault.forceDeallocate -> MidnightAdapter.deallocate forceDeallocate branch -> Midnight.take). Ten end-to-end tests on the real Midnight and VaultV2 pass at the pinned commit with 18 and 6 decimals, including a 256-run fuzz test. In every case: the redeemer pays exactly assets + ceil(assets*settlementFee/WAD); Midnight collects exactly that fee; the taker gets exactly `assets` credit units; the vault receives exactly `assets`; the adapter is left with 0 dust; the vault's allocation drop equals the stored net-credit drop (including any synced loss); and the drop in the adapter's realAssets is <= the cash received, so the vault is never left below book value. The most a third party can do is a 2-wei griefing front-run of an exact whole-position redemption, which is Informational.",
 "candidates": [],
 "lowInfo": [
  {
   "title": "Whole-position in-kind redemptions are brittle: the amount must equal the adapter's live gross credit at inclusion, so time passing or a 1-wei front-run makes them revert",
   "class": "Informational",
   "verified": true,
   "refs": [
    "src/adapters/midnight/MidnightAdapter.sol:436-452",
    "src/adapters/midnight/MidnightAdapter.sol:469",
    "lib/midnight/src/Midnight.sol:370-383",
    "lib/midnight/src/Midnight.sol:794-816",
    "src/VaultV2.sol:567-586"
   ],
   "detail": "The adapter's IKR offer is reduceOnly, so Midnight reverts with MakerCreditOrDebtIncreased when units (= assets) exceed the adapter's credit after _updatePosition (Midnight.sol:380-383). That credit is gross, before the pending fee, and Midnight lowers it every second as the continuous fee accrues. In testIkrWholePositionStaleCreditReverts, stored credit was 100593430826474621736007 while the redeemable (updated) credit after 2 days was 100587918857676772584508, so redeeming the stored figure reverts. In testIkrWholePositionFrontRunGrief, a second shareholder holding 1 share front-runs with a 1-wei IKR, spending 2 wei of assets and 1 share. The victim's exact whole-position IKR then reverts, and a retry with credit - 1 succeeds. No funds are at risk and the redeemer can always redeem slightly less, so this is griefing or UX only. The adapter cannot clamp the amount because VaultV2.deallocateInternal pulls exactly `assets` (VaultV2.sol:583). Suggested fix: document that the redeemable maximum is updatePositionView(...).credit at execution time, and have periphery or routers compute min(desired, live credit) inside the same transaction."
  },
  {
   "title": "Exact fee matching in forceDeallocate depends implicitly on tickToPrice(0) == 0",
   "class": "Informational",
   "verified": true,
   "refs": [
    "src/adapters/midnight/MidnightAdapter.sol:441",
    "src/adapters/midnight/MidnightAdapter.sol:453-456",
    "lib/midnight/src/Midnight.sol:346-352",
    "lib/midnight/src/Midnight.sol:405",
    "lib/midnight/src/Midnight.sol:448-449",
    "lib/midnight/src/libraries/TickLib.sol:8",
    "lib/midnight/src/libraries/TickLib.sol:46-53"
   ],
   "detail": "The adapter charges the sender assets.mulDivUp(settlementFee, WAD). Midnight charges the payer (the adapter) buyerAssets - sellerAssets = ceil(u*(p+f)/WAD) - ceil(u*p/WAD), where p is the tick-0 offer price. These are equal only because tick 0's price is 0: the raw value of about 4.5e10 rounds to 0 with PRICE_ROUNDING_STEP = 1e11 (testTickZeroPriceIsZero logs tickToPrice(0) = 0). With p = 0, sellerAssets is 0, so the adapter's maker group 0 consumption never grows either. testIkrNotBlockedByGroupZeroConsumed shows IKR still works after setConsumed(bytes32(0), type(uint128).max). If p were > 0, Midnight's fee could be 1 wei below the amount collected, leaving 1 wei of skimmable dust per IKR, and consumed[adapter][0] would grow. The Midnight dependency is pinned and immutable, so the current impact is none. Suggested fix: add a NatSpec note or a constructor or test assertion that tickToPrice(0) == 0, or compute the fee as Midnight does."
  },
  {
   "title": "1-wei in-kind redemptions move credit without moving the adapter's net credit, because of Midnight's pending-fee rounding",
   "class": "Informational",
   "verified": true,
   "refs": [
    "lib/midnight/src/Midnight.sol:373-377",
    "src/adapters/midnight/MidnightAdapter.sol:471-477"
   ],
   "detail": "Midnight rounds the seller's pendingFee decrease up and the buyer's pendingFee increase down. In testIkrZeroAndOneWei, a 1-wei IKR transfers 1 credit unit and adds 0 pending fee for the taker, while the adapter's net credit drops by 0 and the vault's allocation drops by 0. The vault receives 1 wei, a gain over book of 1 wei. Each call costs the caller 2 wei of assets plus a 1-wei penalty, and Midnight's continuous-fee revenue loses at most 1 wei per take. The effect favours the vault and sits on the Midnight side, outside the adapter's scope. It is recorded for completeness and is not reportable against the adapter."
  },
  {
   "title": "A 0-asset forceDeallocate lets any 1-share holder sync an unsynced Midnight loss into the vault's cap allocations",
   "class": "Informational",
   "verified": true,
   "refs": [
    "src/adapters/midnight/MidnightAdapter.sol:427-477",
    "src/adapters/midnight/MidnightAdapter.sol:848-855"
   ],
   "detail": "In the forceDeallocate branch, stored netCredit is rewritten from live Midnight state, and the full difference is reported to the vault as the allocation change. In testIkrUnsyncedLoss, a third party first realizes bad debt with a permissionless liquidate(…, 0, 0, …). Stored netCredit 100574138935682149705759 is then stale. A 5000e18 IKR lowers the vault allocation by 55286110563734018852879 while only 5000e18 of cash comes in. This is consistent with realAssets, which already reads live credit when lossFactor != 0, so share price is unaffected. The vault's gain over book is still +29496499997885277622. Allocators can also do this through deallocate with 0 assets. There is no impact beyond freeing cap room earlier."
  }
 ],
 "covered": [
  "Build: cloned morpho-org/vault-v2 at bbeda7b27ae80abcf070e0158cb8a31e87bb2286 with submodules (lib/midnight at 4e2570e5). Ran forge build src lib/midnight/src/Midnight.sol lib/midnight/src/ratifiers. Existing suites pass: MidnightAdapterTest 314/314, MidnightAdapterIntegrationTest 8/8, ForceDeallocateTest 2/2.",
  "Full trace of vault.forceDeallocate -> deallocateInternal -> adapter.deallocate (forceDeallocate branch) -> Midnight.take on the adapter's own tick-0 reduceOnly sell offer, self-ratified while inForceDeallocate -> onBuy clears the transient flags and unadmits -> token transfers with payer = adapter and receiver = adapter, and no onSell -> vault pulls `assets` -> penalty withdraw from onBehalf.",
  "Who pays what: the sender pays assets + ceil(assets*fee/WAD); the adapter's ceil matches Midnight's fee arithmetic exactly (sellerAssets = 0 at tick 0); the penalty is ceil(assets*penalty/WAD), taken from onBehalf's shares. The taker gets exactly `assets` credit units, or repays its own debt first if it is a borrower, at a price of 1 plus fees, as the README documents.",
  "Vault accounting: the allocation change equals the stored net-credit change, and the realAssets drop is <= cash in, for pending continuous fees, an unsynced loss (lossFactor > 0), post-maturity, 0 and 1 wei, the whole gross position (market removed, realAssets 0), and fuzzed amount and time (256 runs). Ran with DECIMALS=18 and DECIMALS=6.",
  "Dust: adapter balance unchanged in all cases; no skimmable residue from IKR.",
  "Blocking by third parties: group-0 consumption cannot block (sellerAssets 0); setConsumed max still works; liquidationLocked only applies within a take; the only third-party block found is the whole-position front-run or time decay above (Informational). Non-IKR-compatible enter gates blocking IKR is accepted in the NatSpec (MidnightAdapter.sol:77) and TrustSec TRST-CR-1.",
  "Authorization: the taker must be the sender or authorize the sender on Midnight, and must hold > 0 vault shares; the adapter pulls funds only from msg.sender of the vault call; the Midnight authorization a user gives the adapter is used only in this branch.",
  "Prior audits: neither the Cantina nor the TrustSec draft (both on the earlier commit 6476e9d9) has a finding on the current IKR design. TRST-L-1 (front-running a user's dedicated force-deallocate buy offer) and TRST-R-3 (accrueInterest in the forceDeallocate branch) target the older design, where the adapter sold into a caller-chosen offer; at bbeda7b2 the adapter takes its own tick-0 offer and does not accrue in this branch. TRST-R-11 notes that setConsumed(max) does not stop 0-asset takes; here IKR does not depend on group consumption at all."
 ],
 "notCovered": [
  "IKR through IKRCompatibleEnterGate with a restrictive sub-gate was code-reviewed only (admit/unadmit, MidnightAdapter.sol:457-464, 520-526); it relied on the existing passing testWrapperGateForceDeallocateAfterRevocation, and no new gated-market test was written.",
  "IKR on forceRemoved markets (code-reviewed: reverts ForceRemoved) and on markets with a maxed-out lossFactor (Midnight reverts MarketLossFactorMaxedOut) were not tested.",
  "IKR re-entered from inside an allocator buy or sell callback, or in nested vaults, was not tested.",
  "VaultV2 send/receive gates on the penalty withdraw, and the effect of vault maxRate on how fast the IKR gain is recognized, were not tested (VaultV2 behaviour, outside the adapter).",
  "Tokens with non-standard transfer behaviour, which the adapter's token requirements exclude.",
  "No independent clean-clone re-run by a second agent was done in this item."
 ],
 "evidence": {
  "path": "test/poc/IkrRedeemPoC.t.sol (in a vault-v2 clone at the pinned commit; inherits test/integration/MidnightAdapterIntegrationTest.sol)",
  "command": "forge build src lib/midnight/src/Midnight.sol lib/midnight/src/ratifiers && forge test --match-path test/poc/IkrRedeemPoC.t.sol --match-test 'Ikr|Tick' -vv   (also run with DECIMALS=6)",
  "source": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\nimport \"../integration/MidnightAdapterIntegrationTest.sol\";\nimport {console2} from \"../../lib/forge-std/src/console2.sol\";\n\n/// @dev End-to-end checks of in-kind redemption (vault.forceDeallocate -> adapter.deallocate -> Midnight.take).\n/// @dev Every IKR is driven by an untrusted vault shareholder (redeemer). No trusted role misbehaves.\ncontract IkrRedeemPoC is MidnightAdapterIntegrationTest {\n    using MathLib for uint256;\n\n    address internal redeemer = makeAddr(\"redeemer\");\n    address internal liquidator = makeAddr(\"liquidator\");\n\n    struct Snap {\n        uint256 senderBal;\n        uint256 adapterBal;\n        uint256 vaultBal;\n        uint256 takerCredit;\n        uint256 takerPending;\n        uint256 adapterCredit;\n        uint256 adapterNetCredit;\n        uint256 allocation;\n        uint256 realAssets;\n        uint256 claimableFee;\n        uint256 redeemerShares;\n        uint256 totalAssets;\n        uint256 storedNetCredit;\n    }\n\n    /// @dev Midnight's maximum fees (lib/midnight/src/libraries/ConstantsLib.sol:11-18), copied to avoid an osaka-only import.\n    uint256 internal constant MAX_CONTINUOUS_FEE = uint32(uint256(0.01e18) / uint256(365 days));\n\n    function maxSettlementFee(uint256 i) internal pure returns (uint256) {\n        return [uint256(0.000014e18), 0.000014e18, 0.000098e18, 0.000417e18, 0.00125e18, 0.0025e18, 0.005e18][i];\n    }\n\n    bool internal ikrReady;\n\n    /// @dev Called at the start of each test (the parent's setUp is not virtual).\n    function _setUpIkr() internal {\n        if (ikrReady) return;\n        ikrReady = true;\n        // Max Midnight fees on the loan token, set before the market is created (so the market inherits them).\n        vm.startPrank(owner);\n        midnight.setFeeSetter(owner);\n        for (uint256 i; i <= 6; i++) {\n            midnight.setDefaultSettlementFee(address(underlyingToken), i, maxSettlementFee(i));\n        }\n        midnight.setDefaultContinuousFee(address(underlyingToken), MAX_CONTINUOUS_FEE);\n        vm.stopPrank();\n        // Adapter buys ~100.6k units of credit in a 7-day market from the borrower (pending continuous fee > 0).\n        t0 = block.timestamp;\n        testMakerBuy();\n\n        // Redeemer: an ordinary depositor.\n        deal(address(underlyingToken), redeemer, 20_000 * oneToken);\n        vm.startPrank(redeemer);\n        SafeERC20Lib.safeApprove(address(underlyingToken), address(vault), type(uint256).max);\n        vault.deposit(1_000 * oneToken, redeemer);\n        SafeERC20Lib.safeApprove(address(underlyingToken), address(adapter), type(uint256).max);\n        midnight.setIsAuthorized(address(adapter), true, redeemer);\n        vm.stopPrank();\n    }\n\n    function _id() internal view returns (bytes32) {\n        return IdLib.toId(_mkt());\n    }\n\n    function _mkt() internal view returns (Market memory market) {\n        // testMakerBuy's market was created at t0 with a 7-day maturity.\n        market = _marketAt(7 days);\n    }\n\n    uint256 internal t0;\n\n    function _marketAt(uint256 duration) internal view returns (Market memory market) {\n        CollateralParams[] memory collaterals = new CollateralParams[](1);\n        collaterals[0] = collateralParams;\n        market = Market({\n            chainId: block.chainid,\n            midnight: address(midnight),\n            loanToken: address(underlyingToken),\n            collateralParams: collaterals,\n            maturity: t0 + duration,\n            rcfThreshold: 0,\n            enterGate: address(0),\n            liquidatorGate: address(0)\n        });\n    }\n\n    function _snap() internal view returns (Snap memory s) {\n        bytes32 id = _id();\n        s.senderBal = underlyingToken.balanceOf(redeemer);\n        s.adapterBal = underlyingToken.balanceOf(address(adapter));\n        s.vaultBal = underlyingToken.balanceOf(address(vault));\n        (uint128 tc, uint128 tp,) = midnight.updatePositionView(_mkt(), id, redeemer);\n        s.takerCredit = tc;\n        s.takerPending = tp;\n        (uint128 ac, uint128 ap,) = midnight.updatePositionView(_mkt(), id, address(adapter));\n        s.adapterCredit = ac;\n        s.adapterNetCredit = ac - ap;\n        s.allocation = vault.allocation(adapter.adapterId());\n        s.realAssets = adapter.realAssets();\n        s.claimableFee = midnight.claimableSettlementFee(address(underlyingToken));\n        s.redeemerShares = vault.balanceOf(redeemer);\n        s.totalAssets = vault.totalAssets();\n        s.storedNetCredit = adapter.marketData(id).netCredit;\n    }\n\n    /// @dev Runs one IKR and checks every conservation property. Returns the vault's gain over book value.\n    function _ikr(uint256 assets, string memory label) internal returns (int256 gainOverBook) {\n        Market memory market = _mkt();\n        bytes32 id = _id();\n        uint256 fee = midnight.settlementFee(id, market.maturity.zeroFloorSub(block.timestamp));\n        uint256 expectedFeeAssets = assets.mulDivUp(fee, WAD);\n        uint256 penaltyAssets = assets.mulDivUp(vault.forceDeallocatePenalty(address(adapter)), WAD);\n\n        Snap memory b = _snap();\n        vm.prank(redeemer);\n        vault.forceDeallocate(address(adapter), abi.encode(market, redeemer), assets, redeemer);\n        Snap memory a = _snap();\n\n        uint256 paid = b.senderBal - a.senderBal;\n        uint256 midnightFee = a.claimableFee - b.claimableFee;\n        uint256 creditGot = a.takerCredit - b.takerCredit;\n        uint256 netCreditDrop = b.adapterNetCredit - a.adapterNetCredit;\n        uint256 allocDrop = b.allocation - a.allocation;\n        uint256 storedBefore = b.storedNetCredit;\n        uint256 bookDrop = b.realAssets - a.realAssets;\n        uint256 vaultCashIn = a.vaultBal - b.vaultBal;\n\n        console2.log(\"----\", label);\n        console2.log(\"assets requested         \", assets);\n        console2.log(\"settlement fee (WAD)     \", fee);\n        console2.log(\"redeemer paid            \", paid);\n        console2.log(\"  of which Midnight fee  \", midnightFee);\n        console2.log(\"taker credit received    \", creditGot);\n        console2.log(\"taker pending fee added  \", a.takerPending - b.takerPending);\n        console2.log(\"vault cash in            \", vaultCashIn);\n        console2.log(\"adapter net credit drop  \", netCreditDrop);\n        console2.log(\"vault allocation drop    \", allocDrop);\n        console2.log(\"adapter realAssets drop  \", bookDrop);\n        console2.log(\"penalty assets           \", penaltyAssets);\n        console2.log(\"adapter dust left        \", a.adapterBal - b.adapterBal);\n\n        assertEq(paid, assets + expectedFeeAssets, \"sender pays assets + fee\");\n        assertEq(midnightFee, expectedFeeAssets, \"adapter fee == Midnight fee\");\n        assertEq(a.adapterBal, b.adapterBal, \"no dust in adapter\");\n        assertEq(creditGot, assets, \"taker gets exactly `assets` units\");\n        assertEq(vaultCashIn, assets, \"vault receives assets\");\n        console2.log(\"stored net credit before \", storedBefore);\n        assertEq(allocDrop, storedBefore - a.adapterNetCredit, \"allocation tracks stored net credit (syncs any loss)\");\n        assertEq(adapter.marketData(id).netCredit, a.adapterNetCredit, \"stored net credit synced\");\n        assertLe(bookDrop, vaultCashIn, \"vault never below book value\");\n        gainOverBook = int256(vaultCashIn) - int256(bookDrop);\n        console2.log(\"vault gain over book     \", uint256(gainOverBook));\n    }\n\n    function testTickZeroPriceIsZero() public pure {\n        console2.log(\"tickToPrice(0)           \", TickLib.tickToPrice(0));\n        assertEq(TickLib.tickToPrice(0), 0);\n    }\n\n    function testIkrZeroAndOneWei() public {\n        _setUpIkr();\n        _ikr(0, \"0 wei\");\n        _ikr(1, \"1 wei\");\n        vm.warp(block.timestamp + 3 days);\n        _ikr(1, \"1 wei after 3 days\");\n    }\n\n    function testIkrPendingFeeMid() public {\n        _setUpIkr();\n        vm.warp(block.timestamp + 1 days);\n        _ikr(5_000 * oneToken, \"5k with pending continuous fee, ttm 6d\");\n    }\n\n    function testIkrUnsyncedLoss() public {\n        _setUpIkr();\n        // Anyone realizes bad debt: collateral worth ~half the debt, liquidate with 0/0.\n        oracle.setPrice(ORACLE_PRICE_SCALE * oneToken / 1e18 / 4);\n        vm.prank(liquidator);\n        midnight.liquidate(_mkt(), 0, 0, 0, borrower, false, liquidator, address(0), \"\");\n        bytes32 id = _id();\n        console2.log(\"lossFactor               \", uint256(midnight.lossFactor(id)));\n        console2.log(\"stored net credit (stale)\", uint256(adapter.marketData(id).netCredit));\n        _ikr(5_000 * oneToken, \"5k with unsynced loss\");\n    }\n\n    function testIkrAfterMaturity() public {\n        _setUpIkr();\n        vm.warp(_mkt().maturity + 1 days);\n        _ikr(5_000 * oneToken, \"5k after maturity\");\n    }\n\n    function testIkrWholePosition() public {\n        _setUpIkr();\n        vm.warp(block.timestamp + 2 days);\n        (uint128 credit,,) = midnight.updatePositionView(_mkt(), _id(), address(adapter));\n        deal(address(underlyingToken), redeemer, 2 * uint256(credit));\n        vm.prank(redeemer);\n        vault.deposit(uint256(credit) / 10, redeemer); // enough shares for the 2% penalty\n        _ikr(credit, \"whole position (gross credit)\");\n        assertEq(adapter.marketIdsLength(), 0, \"market removed\");\n        assertEq(adapter.realAssets(), 0);\n    }\n\n    /// @dev Stored (not updated) credit overshoots the redeemable amount once continuous fees accrue.\n    function testIkrWholePositionStaleCreditReverts() public {\n        _setUpIkr();\n        vm.warp(block.timestamp + 2 days);\n        uint256 stored = midnight.credit(_id(), address(adapter));\n        (uint128 updated,,) = midnight.updatePositionView(_mkt(), _id(), address(adapter));\n        console2.log(\"stored credit            \", stored);\n        console2.log(\"redeemable (updated)     \", uint256(updated));\n        deal(address(underlyingToken), redeemer, 2 * stored);\n        vm.prank(redeemer);\n        vault.deposit(stored / 10, redeemer);\n        Market memory market = _mkt();\n        vm.prank(redeemer);\n        vm.expectRevert();\n        vault.forceDeallocate(address(adapter), abi.encode(market, redeemer), stored, redeemer);\n    }\n\n    /// forge-config: default.fuzz.runs = 256\n    function testFuzzIkr(uint256 assets, uint256 elapsed) public {\n        _setUpIkr();\n        elapsed = bound(elapsed, 0, 9 days);\n        vm.warp(block.timestamp + elapsed);\n        (uint128 credit,,) = midnight.updatePositionView(_mkt(), _id(), address(adapter));\n        assets = bound(assets, 0, credit);\n        deal(address(underlyingToken), redeemer, 2 * uint256(credit));\n        vm.prank(redeemer);\n        vault.deposit(uint256(credit) / 10, redeemer);\n        _ikr(assets, \"fuzz\");\n    }\n\n    /// @dev Cancelling the adapter's group 0 on Midnight (consumed = max) does not block IKR: sellerAssets is 0 at tick 0.\n    function testIkrNotBlockedByGroupZeroConsumed() public {\n        _setUpIkr();\n        vm.prank(allocator);\n        adapter.setConsumed(bytes32(0), type(uint128).max);\n        _ikr(5_000 * oneToken, \"after setConsumed(group 0, max)\");\n    }\n\n    /// @dev A third shareholder front-runs a whole-position IKR with a 1-wei IKR; the whole-position IKR reverts.\n    function testIkrWholePositionFrontRunGrief() public {\n        _setUpIkr();\n        address griefer = makeAddr(\"griefer\");\n        deal(address(underlyingToken), griefer, 10 * oneToken);\n        vm.startPrank(griefer);\n        SafeERC20Lib.safeApprove(address(underlyingToken), address(vault), type(uint256).max);\n        vault.deposit(1, griefer);\n        SafeERC20Lib.safeApprove(address(underlyingToken), address(adapter), type(uint256).max);\n        midnight.setIsAuthorized(address(adapter), true, griefer);\n        vm.stopPrank();\n\n        (uint128 credit,,) = midnight.updatePositionView(_mkt(), _id(), address(adapter));\n        deal(address(underlyingToken), redeemer, 2 * uint256(credit));\n        vm.prank(redeemer);\n        vault.deposit(uint256(credit) / 10, redeemer);\n\n        uint256 grieferBefore = underlyingToken.balanceOf(griefer);\n        uint256 grieferSharesBefore = vault.balanceOf(griefer);\n        Market memory market = _mkt();\n        vm.prank(griefer);\n        vault.forceDeallocate(address(adapter), abi.encode(market, griefer), 1, griefer);\n        console2.log(\"griefer assets spent     \", grieferBefore - underlyingToken.balanceOf(griefer));\n        console2.log(\"griefer shares burned    \", grieferSharesBefore - vault.balanceOf(griefer));\n\n        vm.prank(redeemer);\n        vm.expectRevert();\n        vault.forceDeallocate(address(adapter), abi.encode(market, redeemer), credit, redeemer);\n        // Retrying with the remaining credit succeeds.\n        _ikr(uint256(credit) - 1, \"retry with credit - 1\");\n    }\n}\n",
  "output": "Ran 10 tests for test/poc/IkrRedeemPoC.t.sol:IkrRedeemPoC\n[PASS] testFuzzIkr(uint256,uint256) (runs: 256, μ: 3063777, ~: 3064949)\nLogs:\n  ---- fuzz\n  assets requested          79645845272473361932265\n  settlement fee (WAD)      69807662037037\n  redeemer paid             79651405162722796893791\n    of which Midnight fee   5559890249434961526\n  taker credit received     79645845272473361932265\n  taker pending fee added   10880411418293460649\n  vault cash in             79645845272473361932265\n  adapter net credit drop   79634964260739688110836\n  vault allocation drop     79634964260739688110836\n  adapter realAssets drop   79310605760109752620273\n  penalty assets            1592916905449467238646\n  adapter dust left         0\n  stored net credit before  100574138935682149705759\n  vault gain over book      335239512363609311992\n\n[PASS] testIkrAfterMaturity() (gas: 2863666)\nLogs:\n  ---- 5k after maturity\n  assets requested          5000000000000000000000\n  settlement fee (WAD)      14000000000000\n  redeemer paid             5000070000000000000000\n    of which Midnight fee   70000000000000000\n  taker credit received     5000000000000000000000\n  taker pending fee added   0\n  vault cash in             5000000000000000000000\n  adapter net credit drop   5000000000000000000000\n  vault allocation drop     5000000000000000000000\n  adapter realAssets drop   5000000000000000000000\n  penalty assets            100000000000000000000\n  adapter dust left         0\n  stored net credit before  100574138935682149705759\n  vault gain over book      0\n\n[PASS] testIkrNotBlockedByGroupZeroConsumed() (gas: 2893408)\nLogs:\n  ---- after setConsumed(group 0, max)\n  assets requested          5000000000000000000000\n  settlement fee (WAD)      98000000000000\n  redeemer paid             5000490000000000000000\n    of which Midnight fee   490000000000000000\n  taker credit received     5000000000000000000000\n  taker pending fee added   958904107056000000\n  vault cash in             5000000000000000000000\n  adapter net credit drop   4999041095892944000000\n  vault allocation drop     4999041095892944000000\n  adapter realAssets drop   4970503500002114722378\n  penalty assets            100000000000000000000\n  adapter dust left         0\n  stored net credit before  100574138935682149705759\n  vault gain over book      29496499997885277622\n\n[PASS] testIkrPendingFeeMid() (gas: 2862045)\nLogs:\n  ---- 5k with pending continuous fee, ttm 6d\n  assets requested          5000000000000000000000\n  settlement fee (WAD)      84000000000000\n  redeemer paid             5000420000000000000000\n    of which Midnight fee   420000000000000000\n  taker credit received     5000000000000000000000\n  taker pending fee added   821917806048000000\n  vault cash in             5000000000000000000000\n  adapter net credit drop   4999178059675039046857\n  vault allocation drop     4999178059675039046857\n  adapter realAssets drop   4974696628013868228236\n  penalty assets            100000000000000000000\n  adapter dust left         0\n  stored net credit before  100574138935682149705759\n  vault gain over book      25303371986131771764\n\n[PASS] testIkrUnsyncedLoss() (gas: 3053495)\nLogs:\n  lossFactor                170141183460469231731685612341188336919\n  stored net credit (stale) 100574138935682149705759\n  ---- 5k with unsynced loss\n  assets requested          5000000000000000000000\n  settlement fee (WAD)      98000000000000\n  redeemer paid             5000490000000000000000\n    of which Midnight fee   490000000000000000\n  taker credit received     5000000000000000000000\n  taker pending fee added   958904107056000000\n  vault cash in             5000000000000000000000\n  adapter net credit drop   4999041095892944000000\n  vault allocation drop     55286110563734018852879\n  adapter realAssets drop   4970503500002114722378\n  penalty assets            100000000000000000000\n  adapter dust left         0\n  stored net credit before  100574138935682149705759\n  vault gain over book      29496499997885277622\n\n[PASS] testIkrWholePosition() (gas: 3032694)\nLogs:\n  ---- whole position (gross credit)\n  assets requested          100587918857676772584508\n  settlement fee (WAD)      70000000000000\n  redeemer paid             100594960011996809958589\n    of which Midnight fee   7041154320037374081\n  taker credit received     100587918857676772584508\n  taker pending fee added   13779166930405989880\n  vault cash in             100587918857676772584508\n  adapter net credit drop   100574138935682149705759\n  vault allocation drop     100574138935682149705759\n  adapter realAssets drop   100163369717968392027009\n  penalty assets            2011758377153535451691\n  adapter dust left         0\n  stored net credit before  100574138935682149705759\n  vault gain over book      424549139708380557499\n\n[PASS] testIkrWholePositionFrontRunGrief() (gas: 4000493)\nLogs:\n  griefer assets spent      2\n  griefer shares burned     1\n  ---- retry with credit - 1\n  assets requested          100593430826474621736006\n  settlement fee (WAD)      98000000000000\n  redeemer paid             100603288982695616248937\n    of which Midnight fee   9858156220994512931\n  taker credit received     100593430826474621736006\n  taker pending fee added   19291890792472030248\n  vault cash in             100593430826474621736006\n  adapter net credit drop   100574138935682149705759\n  vault allocation drop     100574138935682149705759\n  adapter realAssets drop   100000000000042545435846\n  penalty assets            2011868616529492434721\n  adapter dust left         0\n  stored net credit before  100574138935682149705759\n  vault gain over book      593430826432076300160\n\n[PASS] testIkrWholePositionStaleCreditReverts() (gas: 2510350)\nLogs:\n  stored credit             100593430826474621736007\n  redeemable (updated)      100587918857676772584508\n\n[PASS] testIkrZeroAndOneWei() (gas: 4280606)\nLogs:\n  ---- 0 wei\n  assets requested          0\n  settlement fee (WAD)      98000000000000\n  redeemer paid             0\n    of which Midnight fee   0\n  taker credit received     0\n  taker pending fee added   0\n  vault cash in             0\n  adapter net credit drop   0\n  vault allocation drop     0\n  adapter realAssets drop   0\n  penalty assets            0\n  adapter dust left         0\n  stored net credit before  100574138935682149705759\n  vault gain over book      0\n  ---- 1 wei\n  assets requested          1\n  settlement fee (WAD)      98000000000000\n  redeemer paid             2\n    of which Midnight fee   1\n  taker credit received     1\n  taker pending fee added   0\n  vault cash in             1\n  adapter net credit drop   0\n  vault allocation drop     0\n  adapter realAssets drop   0\n  penalty assets            1\n  adapter dust left         0\n  stored net credit before  100574138935682149705759\n  vault gain over book      1\n  ---- 1 wei after 3 days\n  assets requested          1\n  settlement fee (WAD)      56000000000000\n  redeemer paid             2\n    of which Midnight fee   1\n  taker credit received     1\n  taker pending fee added   0\n  vault cash in             1\n  adapter net credit drop   0\n  vault allocation drop     0\n  adapter realAssets drop   0\n  penalty assets            1\n  adapter dust left         0\n  stored net credit before  100574138935682149705759\n  vault gain over book      1\n\n[PASS] testTickZeroPriceIsZero() (gas: 4485)\nLogs:\n  tickToPrice(0)            0\n\nSuite result: ok. 10 passed; 0 failed; 0 skipped; finished in 135.14ms (153.58ms CPU time)\n\nRan 1 test suite in 139.32ms (135.14ms CPU time): 10 tests passed, 0 failed, 0 skipped (10 total tests)",
  "output6Decimals": "[PASS] testFuzzIkr(uint256,uint256) (runs: 256, μ: 3061438, ~: 3064697)\n[PASS] testIkrAfterMaturity() (gas: 2863426)\n[PASS] testIkrNotBlockedByGroupZeroConsumed() (gas: 2893168)\n[PASS] testIkrPendingFeeMid() (gas: 2861805)\n[PASS] testIkrUnsyncedLoss() (gas: 3053219)\n[PASS] testIkrWholePosition() (gas: 3032382)\n[PASS] testIkrWholePositionFrontRunGrief() (gas: 4000121)\n[PASS] testIkrWholePositionStaleCreditReverts() (gas: 2510038)\n[PASS] testIkrZeroAndOneWei() (gas: 4280414)\n[PASS] testTickZeroPriceIsZero() (gas: 4485)\nSuite result: ok. 10 passed; 0 failed; 0 skipped; finished in 161.98ms (180.72ms CPU time)"
 }
}