@rev-net/core-v6 0.0.37 → 0.0.40

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (112) hide show
  1. package/CHANGELOG.md +2 -2
  2. package/README.md +6 -7
  3. package/foundry.toml +1 -1
  4. package/package.json +23 -16
  5. package/references/operations.md +1 -1
  6. package/references/runtime.md +1 -1
  7. package/script/Deploy.s.sol +12 -9
  8. package/src/REVDeployer.sol +69 -67
  9. package/src/REVHiddenTokens.sol +2 -2
  10. package/src/REVLoans.sol +26 -22
  11. package/src/REVOwner.sol +147 -29
  12. package/src/interfaces/IREVDeployer.sol +2 -1
  13. package/src/interfaces/IREVHiddenTokens.sol +4 -1
  14. package/src/interfaces/IREVOwner.sol +5 -0
  15. package/src/structs/REVAutoIssuance.sol +4 -2
  16. package/src/structs/REVConfig.sol +8 -5
  17. package/src/structs/REVDescription.sol +6 -5
  18. package/src/structs/REVLoan.sol +8 -5
  19. package/src/structs/REVStageConfig.sol +14 -16
  20. package/ADMINISTRATION.md +0 -73
  21. package/ARCHITECTURE.md +0 -116
  22. package/AUDIT_INSTRUCTIONS.md +0 -90
  23. package/RISKS.md +0 -107
  24. package/SKILLS.md +0 -46
  25. package/STYLE_GUIDE.md +0 -610
  26. package/USER_JOURNEYS.md +0 -195
  27. package/foundry.lock +0 -11
  28. package/slither-ci.config.json +0 -10
  29. package/sphinx.lock +0 -507
  30. package/test/REV.integrations.t.sol +0 -573
  31. package/test/REVAutoIssuanceFuzz.t.sol +0 -328
  32. package/test/REVDeployerRegressions.t.sol +0 -396
  33. package/test/REVInvincibility.t.sol +0 -1371
  34. package/test/REVInvincibilityHandler.sol +0 -387
  35. package/test/REVLifecycle.t.sol +0 -420
  36. package/test/REVLoans.invariants.t.sol +0 -724
  37. package/test/REVLoansAttacks.t.sol +0 -816
  38. package/test/REVLoansFeeRecovery.t.sol +0 -783
  39. package/test/REVLoansFindings.t.sol +0 -711
  40. package/test/REVLoansRegressions.t.sol +0 -364
  41. package/test/REVLoansSourceFeeRecovery.t.sol +0 -517
  42. package/test/REVLoansSourced.t.sol +0 -1839
  43. package/test/REVLoansUnSourced.t.sol +0 -409
  44. package/test/TestAuditFixVerification.t.sol +0 -675
  45. package/test/TestBurnHeldTokens.t.sol +0 -394
  46. package/test/TestCEIPattern.t.sol +0 -508
  47. package/test/TestCashOutCallerValidation.t.sol +0 -452
  48. package/test/TestConversionDocumentation.t.sol +0 -365
  49. package/test/TestCrossCurrencyReclaim.t.sol +0 -610
  50. package/test/TestCrossSourceReallocation.t.sol +0 -361
  51. package/test/TestERC2771MetaTx.t.sol +0 -585
  52. package/test/TestEmptyBuybackSpecs.t.sol +0 -300
  53. package/test/TestFlashLoanSurplus.t.sol +0 -365
  54. package/test/TestHiddenTokens.t.sol +0 -474
  55. package/test/TestHookArrayOOB.t.sol +0 -278
  56. package/test/TestLiquidationBehavior.t.sol +0 -398
  57. package/test/TestLoanSourceRotation.t.sol +0 -553
  58. package/test/TestLoansCashOutDelay.t.sol +0 -493
  59. package/test/TestLongTailEconomics.t.sol +0 -677
  60. package/test/TestLowFindings.t.sol +0 -677
  61. package/test/TestMixedFixes.t.sol +0 -593
  62. package/test/TestPermit2Signatures.t.sol +0 -683
  63. package/test/TestReallocationSandwich.t.sol +0 -412
  64. package/test/TestRevnetRegressions.t.sol +0 -350
  65. package/test/TestSplitWeightAdjustment.t.sol +0 -527
  66. package/test/TestSplitWeightE2E.t.sol +0 -605
  67. package/test/TestSplitWeightFork.t.sol +0 -855
  68. package/test/TestStageTransitionBorrowable.t.sol +0 -301
  69. package/test/TestSwapTerminalPermission.t.sol +0 -262
  70. package/test/TestTerminalEncodingInHash.t.sol +0 -326
  71. package/test/TestUint112Overflow.t.sol +0 -311
  72. package/test/TestZeroAmountLoanGuard.t.sol +0 -378
  73. package/test/TestZeroRepayment.t.sol +0 -354
  74. package/test/audit/CrossChainBuybackRouteMismatch.t.sol +0 -184
  75. package/test/audit/HiddenSupplyCashout.t.sol +0 -61
  76. package/test/audit/LoanIdOverflowGuard.t.sol +0 -523
  77. package/test/audit/NemesisVerification.t.sol +0 -97
  78. package/test/audit/OperatorDelegation.t.sol +0 -356
  79. package/test/audit/PhantomSurplusTerminal.t.sol +0 -367
  80. package/test/audit/REVOwnerCurrencyMismatch.t.sol +0 -188
  81. package/test/audit/REVOwnerRemoteSurplusCurrencyMismatch.t.sol +0 -140
  82. package/test/audit/ReallocatePermission.t.sol +0 -363
  83. package/test/audit/RemoteLoanAccountingGap.t.sol +0 -74
  84. package/test/audit/SupportsInterfaceTest.t.sol +0 -51
  85. package/test/audit/TestFeeAllowanceLeak.t.sol +0 -197
  86. package/test/audit/TestLoansAndDeployerFixes.t.sol +0 -576
  87. package/test/fork/ForkTestBase.sol +0 -727
  88. package/test/fork/TestAutoIssuanceFork.t.sol +0 -148
  89. package/test/fork/TestCashOutFork.t.sol +0 -253
  90. package/test/fork/TestIssuanceDecayFork.t.sol +0 -158
  91. package/test/fork/TestLoanAdversarialFork.t.sol +0 -744
  92. package/test/fork/TestLoanBorrowFork.t.sol +0 -163
  93. package/test/fork/TestLoanCrossRulesetFork.t.sol +0 -308
  94. package/test/fork/TestLoanERC20Fork.t.sol +0 -459
  95. package/test/fork/TestLoanLiquidationFork.t.sol +0 -135
  96. package/test/fork/TestLoanReallocateFork.t.sol +0 -113
  97. package/test/fork/TestLoanRepayFork.t.sol +0 -188
  98. package/test/fork/TestLoanTransferFork.t.sol +0 -143
  99. package/test/fork/TestPermit2PaymentFork.t.sol +0 -300
  100. package/test/fork/TestSplitWeightFork.t.sol +0 -189
  101. package/test/helpers/MaliciousContracts.sol +0 -247
  102. package/test/helpers/REVEmpty721Config.sol +0 -45
  103. package/test/mock/MockBuybackCashOutRecorder.sol +0 -84
  104. package/test/mock/MockBuybackDataHook.sol +0 -112
  105. package/test/mock/MockBuybackDataHookMintPath.sol +0 -68
  106. package/test/mock/MockSuckerRegistry.sol +0 -17
  107. package/test/regression/TestBurnPermissionRequired.t.sol +0 -294
  108. package/test/regression/TestCashOutBuybackFeeLeak.t.sol +0 -232
  109. package/test/regression/TestCrossRevnetLiquidation.t.sol +0 -255
  110. package/test/regression/TestCumulativeLoanCounter.t.sol +0 -361
  111. package/test/regression/TestLiquidateGapHandling.t.sol +0 -394
  112. package/test/regression/TestZeroPriceFeed.t.sol +0 -422
@@ -1,387 +0,0 @@
1
- // SPDX-License-Identifier: MIT
2
- pragma solidity 0.8.28;
3
-
4
- // forge-lint: disable-next-line(unaliased-plain-import)
5
- import "forge-std/Test.sol";
6
- // forge-lint: disable-next-line(unaliased-plain-import)
7
- import /* {*} from */ "@bananapus/core-v6/test/helpers/TestBaseWorkflow.sol";
8
- import {JBConstants} from "@bananapus/core-v6/src/libraries/JBConstants.sol";
9
- // forge-lint: disable-next-line(unused-import)
10
- import {JBAccountingContext} from "@bananapus/core-v6/src/structs/JBAccountingContext.sol";
11
- import {mulDiv} from "@prb/math/src/Common.sol";
12
- // forge-lint: disable-next-line(unused-import)
13
- import {IERC20} from "@openzeppelin/contracts/token/ERC20/IERC20.sol";
14
-
15
- import {IREVLoans} from "../src/interfaces/IREVLoans.sol";
16
- import {REVLoan} from "../src/structs/REVLoan.sol";
17
- import {REVLoanSource} from "../src/structs/REVLoanSource.sol";
18
- import {JBTest} from "@bananapus/core-v6/test/helpers/JBTest.sol";
19
-
20
- /// @title REVInvincibilityHandler
21
- /// @notice Stateful fuzzing handler for the revnet + loans interaction surface.
22
- /// @dev 10 operations with ghost variables tracking all value flows.
23
- contract REVInvincibilityHandler is JBTest {
24
- // =========================================================================
25
- // Ghost variables
26
- // =========================================================================
27
- // forge-lint: disable-next-line(mixed-case-variable)
28
- uint256 public COLLATERAL_SUM;
29
- // forge-lint: disable-next-line(mixed-case-variable)
30
- uint256 public COLLATERAL_RETURNED;
31
- // forge-lint: disable-next-line(mixed-case-variable)
32
- uint256 public BORROWED_SUM;
33
- // forge-lint: disable-next-line(mixed-case-variable)
34
- uint256 public REPAID_SUM;
35
- // forge-lint: disable-next-line(mixed-case-variable)
36
- uint256 public PAID_IN_SUM;
37
- // forge-lint: disable-next-line(mixed-case-variable)
38
- uint256 public CASHED_OUT_SUM;
39
- // forge-lint: disable-next-line(mixed-case-variable)
40
- uint256 public ADDED_TO_BALANCE_SUM;
41
-
42
- // Per-operation call counts
43
- // forge-lint: disable-next-line(mixed-case-variable)
44
- uint256 public callCount_payAndBorrow;
45
- // forge-lint: disable-next-line(mixed-case-variable)
46
- uint256 public callCount_repayLoan;
47
- // forge-lint: disable-next-line(mixed-case-variable)
48
- uint256 public callCount_reallocateCollateral;
49
- // forge-lint: disable-next-line(mixed-case-variable)
50
- uint256 public callCount_liquidateLoans;
51
- // forge-lint: disable-next-line(mixed-case-variable)
52
- uint256 public callCount_advanceTime;
53
- // forge-lint: disable-next-line(mixed-case-variable)
54
- uint256 public callCount_payInto;
55
- // forge-lint: disable-next-line(mixed-case-variable)
56
- uint256 public callCount_cashOut;
57
- // forge-lint: disable-next-line(mixed-case-variable)
58
- uint256 public callCount_addToBalance;
59
- // forge-lint: disable-next-line(mixed-case-variable)
60
- uint256 public callCount_sendReservedTokens;
61
- // forge-lint: disable-next-line(mixed-case-variable)
62
- uint256 public callCount_changeStage;
63
-
64
- // Fee project tracking
65
- uint256 public feeProjectBalanceAtStart;
66
-
67
- // =========================================================================
68
- // Dependencies
69
- // =========================================================================
70
- // forge-lint: disable-next-line(mixed-case-variable)
71
- IJBMultiTerminal public TERMINAL;
72
- // forge-lint: disable-next-line(mixed-case-variable)
73
- IREVLoans public LOANS;
74
- // forge-lint: disable-next-line(mixed-case-variable)
75
- IJBPermissions public PERMS;
76
- // forge-lint: disable-next-line(mixed-case-variable)
77
- IJBTokens public TOKENS;
78
- // forge-lint: disable-next-line(mixed-case-variable)
79
- IJBController public CTRL;
80
- // forge-lint: disable-next-line(mixed-case-variable)
81
- uint256 public REVNET_ID;
82
- // forge-lint: disable-next-line(mixed-case-variable)
83
- uint256 public FEE_PROJECT_ID;
84
- // forge-lint: disable-next-line(mixed-case-variable)
85
- address public USER;
86
-
87
- // Stage boundaries (for changeStage)
88
- uint256 public stage1Start;
89
- uint256 public stage2Start;
90
-
91
- constructor(
92
- IJBMultiTerminal terminal,
93
- IREVLoans loans,
94
- IJBPermissions permissions,
95
- IJBTokens tokens,
96
- IJBController controller,
97
- uint256 revnetId,
98
- uint256 feeProjectId,
99
- address user,
100
- uint256 _stage1Start,
101
- uint256 _stage2Start
102
- ) {
103
- TERMINAL = terminal;
104
- LOANS = loans;
105
- PERMS = permissions;
106
- TOKENS = tokens;
107
- CTRL = controller;
108
- REVNET_ID = revnetId;
109
- FEE_PROJECT_ID = feeProjectId;
110
- USER = user;
111
- stage1Start = _stage1Start;
112
- stage2Start = _stage2Start;
113
- }
114
-
115
- modifier useActor() {
116
- vm.startPrank(USER);
117
- _;
118
- vm.stopPrank();
119
- }
120
-
121
- // =========================================================================
122
- // Operation 1: payAndBorrow — pay ETH, borrow against tokens
123
- // =========================================================================
124
- function payAndBorrow(uint256 seed) public useActor {
125
- uint256 payAmount = bound(seed, 0.1 ether, 5 ether);
126
- uint256 prepaidFee = bound(seed >> 8, 25, 500);
127
-
128
- vm.deal(USER, payAmount);
129
-
130
- uint256 receivedTokens = TERMINAL.pay{value: payAmount}(REVNET_ID, JBConstants.NATIVE_TOKEN, 0, USER, 0, "", "");
131
-
132
- if (receivedTokens == 0) return;
133
-
134
- uint256 borrowable =
135
- LOANS.borrowableAmountFrom(REVNET_ID, receivedTokens, 18, uint32(uint160(JBConstants.NATIVE_TOKEN)));
136
-
137
- if (borrowable == 0) return;
138
-
139
- // Mock permission
140
- mockExpect(
141
- address(PERMS),
142
- abi.encodeCall(IJBPermissions.hasPermission, (address(LOANS), USER, REVNET_ID, 11, true, true)),
143
- abi.encode(true)
144
- );
145
-
146
- REVLoanSource memory source = REVLoanSource({token: JBConstants.NATIVE_TOKEN, terminal: TERMINAL});
147
- (, REVLoan memory loan) =
148
- LOANS.borrowFrom(REVNET_ID, source, borrowable, receivedTokens, payable(USER), prepaidFee, USER);
149
-
150
- COLLATERAL_SUM += receivedTokens;
151
- BORROWED_SUM += loan.amount;
152
- PAID_IN_SUM += payAmount;
153
- ++callCount_payAndBorrow;
154
- }
155
-
156
- // =========================================================================
157
- // Operation 2: repayLoan — partially/fully repay a loan
158
- // =========================================================================
159
- function repayLoan(uint256 seed) public useActor {
160
- if (callCount_payAndBorrow == 0) return;
161
-
162
- uint256 percentToPayDown = bound(seed, 1000, 9999);
163
- uint256 daysToWarp = bound(seed >> 16, 1, 90);
164
- vm.warp(block.timestamp + daysToWarp * 1 days);
165
-
166
- uint256 id = (REVNET_ID * 1_000_000_000_000) + callCount_payAndBorrow;
167
-
168
- try IERC721(address(LOANS)).ownerOf(id) {}
169
- catch {
170
- return;
171
- }
172
-
173
- REVLoan memory latestLoan = LOANS.loanOf(id);
174
- if (latestLoan.amount == 0) return;
175
-
176
- uint256 collateralReturned = mulDiv(latestLoan.collateral, percentToPayDown, 10_000);
177
- uint256 newCollateral = latestLoan.collateral - collateralReturned;
178
- uint256 borrowableFromNewCollateral =
179
- LOANS.borrowableAmountFrom(REVNET_ID, newCollateral, 18, uint32(uint160(JBConstants.NATIVE_TOKEN)));
180
-
181
- if (borrowableFromNewCollateral > 0) borrowableFromNewCollateral -= 1;
182
-
183
- uint256 amountDiff =
184
- borrowableFromNewCollateral > latestLoan.amount ? 0 : latestLoan.amount - borrowableFromNewCollateral;
185
-
186
- uint256 amountPaidDown = amountDiff;
187
-
188
- {
189
- uint256 timeSinceLoanCreated = block.timestamp - latestLoan.createdAt;
190
- if (timeSinceLoanCreated > latestLoan.prepaidDuration) {
191
- uint256 prepaidAmount =
192
- JBFees.feeAmountFrom({amountBeforeFee: amountDiff, feePercent: latestLoan.prepaidFeePercent});
193
- amountPaidDown += JBFees.feeAmountFrom({
194
- amountBeforeFee: amountDiff - prepaidAmount,
195
- feePercent: mulDiv(timeSinceLoanCreated, JBConstants.MAX_FEE, 3650 days)
196
- });
197
- }
198
- }
199
-
200
- JBSingleAllowance memory allowance;
201
- vm.deal(USER, type(uint256).max);
202
-
203
- try LOANS.repayLoan{value: amountPaidDown}(
204
- id, amountPaidDown, collateralReturned, payable(USER), allowance
205
- ) returns (
206
- uint256, REVLoan memory adjustedLoan
207
- ) {
208
- COLLATERAL_RETURNED += collateralReturned;
209
- COLLATERAL_SUM -= collateralReturned;
210
- REPAID_SUM += (latestLoan.amount - adjustedLoan.amount);
211
- if (BORROWED_SUM >= (latestLoan.amount - adjustedLoan.amount)) {
212
- BORROWED_SUM -= (latestLoan.amount - adjustedLoan.amount);
213
- }
214
- ++callCount_repayLoan;
215
- } catch {}
216
- }
217
-
218
- // =========================================================================
219
- // Operation 3: reallocateCollateral — reallocate from existing loan
220
- // =========================================================================
221
- function reallocateCollateral(uint256 seed) public useActor {
222
- if (callCount_payAndBorrow == 0) return;
223
-
224
- uint256 collateralPercentToTransfer = bound(seed, 1, 5000);
225
- uint256 payAmount = bound(seed >> 8, 1 ether, 10 ether);
226
- uint256 prepaidFee = bound(seed >> 16, 25, 500);
227
-
228
- uint256 id = (REVNET_ID * 1_000_000_000_000) + callCount_payAndBorrow;
229
-
230
- try IERC721(address(LOANS)).ownerOf(id) {}
231
- catch {
232
- return;
233
- }
234
-
235
- REVLoan memory latestLoan = LOANS.loanOf(id);
236
- if (latestLoan.amount == 0) return;
237
-
238
- vm.deal(USER, payAmount);
239
- uint256 collateralToAdd =
240
- TERMINAL.pay{value: payAmount}(REVNET_ID, JBConstants.NATIVE_TOKEN, 0, USER, 0, "", "");
241
-
242
- uint256 collateralToTransfer = mulDiv(latestLoan.collateral, collateralPercentToTransfer, 10_000);
243
- if (collateralToTransfer == 0) return;
244
-
245
- uint256 newBorrowable = LOANS.borrowableAmountFrom(
246
- REVNET_ID, collateralToTransfer + collateralToAdd, 18, uint32(uint160(JBConstants.NATIVE_TOKEN))
247
- );
248
-
249
- // Mock permission
250
- mockExpect(
251
- address(PERMS),
252
- abi.encodeCall(IJBPermissions.hasPermission, (address(LOANS), USER, REVNET_ID, 11, true, true)),
253
- abi.encode(true)
254
- );
255
-
256
- try LOANS.reallocateCollateralFromLoan(
257
- id,
258
- collateralToTransfer,
259
- REVLoanSource({token: JBConstants.NATIVE_TOKEN, terminal: TERMINAL}),
260
- newBorrowable,
261
- collateralToAdd,
262
- payable(USER),
263
- prepaidFee
264
- ) returns (
265
- uint256, uint256, REVLoan memory, REVLoan memory newLoan
266
- ) {
267
- COLLATERAL_SUM += collateralToAdd;
268
- BORROWED_SUM += newLoan.amount;
269
- PAID_IN_SUM += payAmount;
270
- ++callCount_reallocateCollateral;
271
- } catch {}
272
- }
273
-
274
- // =========================================================================
275
- // Operation 4: liquidateLoans — attempt liquidation
276
- // =========================================================================
277
- function liquidateLoans(uint256 seed) public {
278
- if (callCount_payAndBorrow == 0) return;
279
-
280
- uint256 count = bound(seed, 1, 5);
281
- uint256 startingLoanId = (REVNET_ID * 1_000_000_000_000) + 1;
282
-
283
- try LOANS.liquidateExpiredLoansFrom(REVNET_ID, startingLoanId, count) {} catch {}
284
-
285
- ++callCount_liquidateLoans;
286
- }
287
-
288
- // =========================================================================
289
- // Operation 5: advanceTime — warp 1 hour to 30 days
290
- // =========================================================================
291
- function advanceTime(uint256 seed) public {
292
- uint256 hoursToWarp = bound(seed, 1, 720); // 1 hour to 30 days
293
- vm.warp(block.timestamp + hoursToWarp * 1 hours);
294
- ++callCount_advanceTime;
295
- }
296
-
297
- // =========================================================================
298
- // Operation 6: payInto — pay without borrowing
299
- // =========================================================================
300
- function payInto(uint256 seed) public useActor {
301
- uint256 payAmount = bound(seed, 0.01 ether, 2 ether);
302
- vm.deal(USER, payAmount);
303
-
304
- TERMINAL.pay{value: payAmount}(REVNET_ID, JBConstants.NATIVE_TOKEN, payAmount, USER, 0, "", "");
305
-
306
- PAID_IN_SUM += payAmount;
307
- ++callCount_payInto;
308
- }
309
-
310
- // =========================================================================
311
- // Operation 7: cashOut — cash out held tokens
312
- // =========================================================================
313
- function cashOut(uint256 seed) public useActor {
314
- IJBToken token = TOKENS.tokenOf(REVNET_ID);
315
- uint256 balance = token.balanceOf(USER);
316
- if (balance == 0) return;
317
-
318
- uint256 cashOutCount = bound(seed, 1, balance);
319
-
320
- // Need to advance past the 30-day cash out delay
321
- // (only if not already past it)
322
- try TERMINAL.cashOutTokensOf({
323
- holder: USER,
324
- projectId: REVNET_ID,
325
- cashOutCount: cashOutCount,
326
- tokenToReclaim: JBConstants.NATIVE_TOKEN,
327
- minTokensReclaimed: 0,
328
- beneficiary: payable(USER),
329
- metadata: ""
330
- }) returns (
331
- uint256 reclaimAmount
332
- ) {
333
- CASHED_OUT_SUM += reclaimAmount;
334
- ++callCount_cashOut;
335
- } catch {}
336
- }
337
-
338
- // =========================================================================
339
- // Operation 8: addToBalance — donate to treasury (no mint)
340
- // =========================================================================
341
- function addToBalance(uint256 seed) public {
342
- uint256 amount = bound(seed, 0.01 ether, 1 ether);
343
- vm.deal(address(this), amount);
344
-
345
- TERMINAL.addToBalanceOf{value: amount}(REVNET_ID, JBConstants.NATIVE_TOKEN, amount, false, "", "");
346
-
347
- ADDED_TO_BALANCE_SUM += amount;
348
- ++callCount_addToBalance;
349
- }
350
-
351
- // =========================================================================
352
- // Operation 9: sendReservedTokens — trigger reserved distribution
353
- // =========================================================================
354
- function sendReservedTokens(uint256) public {
355
- try CTRL.sendReservedTokensToSplitsOf(REVNET_ID) {} catch {}
356
- ++callCount_sendReservedTokens;
357
- }
358
-
359
- // =========================================================================
360
- // Operation 10: changeStage — warp to next stage boundary
361
- // =========================================================================
362
- function changeStage(uint256 seed) public {
363
- uint256 target = bound(seed, 0, 2);
364
-
365
- if (target == 0 && block.timestamp < stage1Start) {
366
- vm.warp(stage1Start + 1);
367
- } else if (target == 1 && block.timestamp < stage2Start) {
368
- vm.warp(stage2Start + 1);
369
- } else {
370
- // Just advance a bit
371
- vm.warp(block.timestamp + 30 days);
372
- }
373
-
374
- ++callCount_changeStage;
375
- }
376
-
377
- // =========================================================================
378
- // Helpers
379
- // =========================================================================
380
- function totalOperations() public view returns (uint256) {
381
- return callCount_payAndBorrow + callCount_repayLoan + callCount_reallocateCollateral + callCount_liquidateLoans
382
- + callCount_advanceTime + callCount_payInto + callCount_cashOut + callCount_addToBalance
383
- + callCount_sendReservedTokens + callCount_changeStage;
384
- }
385
-
386
- receive() external payable {}
387
- }