@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
package/USER_JOURNEYS.md DELETED
@@ -1,195 +0,0 @@
1
- # User Journeys
2
-
3
- ## Repo Purpose
4
-
5
- This repo packages autonomous Revnets: staged Juicebox projects whose runtime behavior is intentionally constrained after launch. It owns deploy-time stage encoding, runtime enforcement, hidden-token mechanics, and lending against revnet token exposure.
6
-
7
- ## Primary Actors
8
-
9
- - teams launching autonomous Revnets with encoded stage transitions
10
- - participants buying, holding, and cashing out Revnet exposure over time
11
- - borrowers using Revnet tokens as collateral instead of selling them
12
- - operators working inside the narrow post-launch envelope the deployer allows
13
-
14
- ## Key Surfaces
15
-
16
- - `REVDeployer`: launch-time packaging, stage config, and operator envelope
17
- - `REVOwner`: runtime pay and cash-out behavior for active Revnets
18
- - `REVLoans`: borrowing, repayment, transfer, reallocation, and liquidation
19
- - `REVHiddenTokens`: temporarily hide and later reveal token supply
20
- - `autoIssueFor(...)`, `hideTokensOf(...)`, `revealTokensOf(...)`, `borrowFrom(...)`: high-signal runtime entrypoints
21
-
22
- ## Journey 1: Launch A Revnet With Its Long-Lived Rules Encoded Up Front
23
-
24
- **Actor:** launch team.
25
-
26
- **Intent:** deploy a Revnet whose economic envelope is encoded up front and stays bounded afterward.
27
-
28
- **Preconditions**
29
-
30
- - the team knows the stage schedule, issuance behavior, operator envelope, and optional integrations
31
- - the team accepts that many choices become expensive or impossible to change later
32
-
33
- **Main Flow**
34
-
35
- 1. Use `REVDeployer` with the staged config, split operators, and optional integrations.
36
- 2. The deployer launches the underlying project and preserves the intended ownership model.
37
- 3. Stage and auxiliary behavior are committed at launch instead of left to ordinary owner discretion.
38
- 4. The Revnet can now accept payments and progress through stages under the encoded rules.
39
-
40
- **Failure Modes**
41
-
42
- - teams assume deploy-time parameters can be revisited casually
43
- - optional integrations are enabled without auditing their effect on the resulting network
44
-
45
- **Postconditions**
46
-
47
- - the Revnet launches with its long-lived stage envelope encoded up front
48
-
49
- ## Journey 2: Participate Across Stage Transitions
50
-
51
- **Actor:** participant.
52
-
53
- **Intent:** buy, hold, and exit Revnet exposure across stage changes.
54
-
55
- **Preconditions**
56
-
57
- - the Revnet is already live
58
- - the participant understands active stage parameters can change behavior over time
59
-
60
- **Main Flow**
61
-
62
- 1. Pay through the configured terminal or router.
63
- 2. Let `REVOwner` enforce runtime behavior such as pay handling, delayed exits, and stage-sensitive constraints.
64
- 3. As stages advance, later pays and exits follow the new active parameters while project identity stays constant.
65
-
66
- **Failure Modes**
67
-
68
- - stage parameters are misread as mutable when they are fixed
69
- - delayed cash-out behavior is misunderstood
70
- - optional integrations materially change the participant experience
71
-
72
- **Postconditions**
73
-
74
- - the participant's buys and exits follow the active stage's constraints
75
-
76
- ## Journey 3: Claim Stage-Based Auto-Issuance
77
-
78
- **Actor:** auto-issuance beneficiary.
79
-
80
- **Intent:** claim stage-specific issuance only when it is actually live.
81
-
82
- **Preconditions**
83
-
84
- - the Revnet was deployed with auto-issuance allocations
85
- - the target stage has started
86
-
87
- **Main Flow**
88
-
89
- 1. Check `amountToAutoIssue(...)`.
90
- 2. Call `autoIssueFor(...)` once the stage is active.
91
- 3. The stored allocation is consumed and cannot be claimed twice.
92
-
93
- **Failure Modes**
94
-
95
- - callers try to claim before the stage is active
96
- - reviewers assume auto-issuance is a generic mint path rather than a bounded stage allocation
97
-
98
- **Postconditions**
99
-
100
- - the stage allocation is either claimed once or remains reserved until valid
101
-
102
- ## Journey 4: Hide Tokens To Change Visible Supply
103
-
104
- **Actor:** holder or authorized operator.
105
-
106
- **Intent:** remove tokens from visible supply temporarily and later restore them.
107
-
108
- **Preconditions**
109
-
110
- - the holder granted `BURN_TOKENS` to `REVHiddenTokens`
111
- - either the holder has been allowlisted for hidden-token actions, or the caller is the project owner / an operator with `HIDE_TOKENS`
112
- - the holder accepts the supply and collateral implications of hiding tokens
113
-
114
- **Main Flow**
115
-
116
- 1. Grant `BURN_TOKENS` to `REVHiddenTokens`.
117
- 2. An operator calls `setTokenHidingAllowedFor(...)` to allow the holder to hide their own tokens.
118
- 3. The holder, project owner, or a `HIDE_TOKENS` operator calls `hideTokensOf(...)` to burn tokens and track the hidden balance.
119
- 4. The lower visible supply changes per-token cash-out value.
120
- 5. Later, the holder calls `revealTokensOf(...)` to remint hidden tokens back to themselves.
121
-
122
- **Failure Modes**
123
-
124
- - more tokens are revealed than were hidden
125
- - holders attempt to hide tokens without being allowlisted
126
- - non-holders attempt to reveal hidden tokens
127
- - hidden tokens are assumed to remain usable as loan collateral
128
-
129
- **Postconditions**
130
-
131
- - visible supply is reduced or restored according to the holder's hidden-token state
132
-
133
- ## Journey 5: Borrow Against Revnet Tokens Instead Of Selling Them
134
-
135
- **Actor:** holder or delegated loan operator.
136
-
137
- **Intent:** borrow against Revnet exposure instead of selling it.
138
-
139
- **Preconditions**
140
-
141
- - the holder has eligible Revnet token exposure
142
- - the holder trusts any delegated operator with `OPEN_LOAN`
143
-
144
- **Main Flow**
145
-
146
- 1. Interact with `REVLoans` using eligible token exposure as collateral.
147
- 2. The system burns the collateralized exposure and mints a loan NFT.
148
- 3. Borrowed value is issued under live Revnet economics.
149
- 4. The borrower can later repay, reallocate, transfer, or face liquidation.
150
-
151
- **Failure Modes**
152
-
153
- - delegated operators redirect value in ways the holder did not intend
154
- - reviewers model the loan system as escrowed collateral when it is burned-collateral lending
155
-
156
- **Postconditions**
157
-
158
- - collateralized exposure becomes a live loan position under Revnet economics
159
-
160
- ## Journey 6: Operate Inside The Bounded Post-Launch Control Envelope
161
-
162
- **Actor:** operator with ongoing powers.
163
-
164
- **Intent:** use the sanctioned post-launch controls without violating the autonomous model.
165
-
166
- **Preconditions**
167
-
168
- - the Revnet is live
169
- - the operator knows exactly which controls the deployment left available
170
-
171
- **Main Flow**
172
-
173
- 1. Review what `REVDeployer` allowed.
174
- 2. Use only those sanctioned surfaces.
175
- 3. Audit cross-package behavior whenever optional integrations are enabled.
176
-
177
- **Failure Modes**
178
-
179
- - operators behave as though the Revnet were a normal owner-governed project
180
- - reviewers inspect controls in isolation and miss integrated runtime behavior
181
-
182
- **Postconditions**
183
-
184
- - post-launch control remains inside the bounded envelope left by deployment
185
-
186
- ## Trust Boundaries
187
-
188
- - this repo is trusted for revnet-specific economics and runtime policy
189
- - treasury accounting still comes from core
190
- - optional integrations materially change revnet behavior and must be reviewed together with the local code
191
-
192
- ## Hand-Offs
193
-
194
- - Use [nana-core-v6](../nana-core-v6/USER_JOURNEYS.md) for underlying terminal and project accounting.
195
- - Use [nana-buyback-hook-v6](../nana-buyback-hook-v6/USER_JOURNEYS.md), [nana-suckers-v6](../nana-suckers-v6/USER_JOURNEYS.md), and [nana-721-hook-v6](../nana-721-hook-v6/USER_JOURNEYS.md) when those integrations are enabled.
package/foundry.lock DELETED
@@ -1,11 +0,0 @@
1
- {
2
- "lib/forge-std": {
3
- "rev": "83c5d212a01f8950727da4095cdfe2654baccb5b"
4
- },
5
- "lib/sphinx": {
6
- "branch": {
7
- "name": "v0.23.0",
8
- "rev": "5fb24a825f46bd6ae0b5359fe0da1d2346126b09"
9
- }
10
- }
11
- }
@@ -1,10 +0,0 @@
1
- {
2
- "detectors_to_exclude": "timestamp,uninitialized-local,naming-convention,solc-version,shadowing-local",
3
- "exclude_informational": true,
4
- "exclude_low": false,
5
- "exclude_medium": false,
6
- "exclude_high": false,
7
- "disable_color": false,
8
- "filter_paths": "(mocks/|test/|node_modules/|lib/)",
9
- "legacy_ast": false
10
- }