@rev-net/core-v6 0.0.36 → 0.0.37

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 (28) hide show
  1. package/RISKS.md +11 -1
  2. package/package.json +9 -9
  3. package/src/REVLoans.sol +120 -83
  4. package/src/REVOwner.sol +3 -3
  5. package/test/REV.integrations.t.sol +14 -14
  6. package/test/REVInvincibility.t.sol +16 -16
  7. package/test/REVLifecycle.t.sol +32 -32
  8. package/test/REVLoansSourced.t.sol +15 -15
  9. package/test/TestCashOutCallerValidation.t.sol +8 -8
  10. package/test/TestConversionDocumentation.t.sol +2 -5
  11. package/test/TestCrossCurrencyReclaim.t.sol +72 -72
  12. package/test/TestLongTailEconomics.t.sol +56 -56
  13. package/test/TestSwapTerminalPermission.t.sol +21 -21
  14. package/test/audit/HiddenSupplyCashout.t.sol +61 -0
  15. package/test/audit/NemesisVerification.t.sol +97 -0
  16. package/test/audit/REVOwnerCurrencyMismatch.t.sol +188 -0
  17. package/test/audit/{CodexREVOwnerRemoteSurplusCurrencyMismatch.t.sol → REVOwnerRemoteSurplusCurrencyMismatch.t.sol} +4 -6
  18. package/test/audit/ReallocatePermission.t.sol +363 -0
  19. package/test/audit/RemoteLoanAccountingGap.t.sol +74 -0
  20. package/test/fork/TestCashOutFork.t.sol +48 -48
  21. package/test/fork/TestLoanAdversarialFork.t.sol +744 -0
  22. package/test/fork/TestLoanERC20Fork.t.sol +2 -8
  23. package/test/fork/TestPermit2PaymentFork.t.sol +32 -32
  24. package/test/regression/TestBurnPermissionRequired.t.sol +5 -5
  25. package/test/regression/TestCashOutBuybackFeeLeak.t.sol +8 -8
  26. /package/test/audit/{CodexCrossChainBuybackRouteMismatch.t.sol → CrossChainBuybackRouteMismatch.t.sol} +0 -0
  27. /package/test/audit/{NemesisOperatorDelegation.t.sol → OperatorDelegation.t.sol} +0 -0
  28. /package/test/audit/{CodexPhantomSurplusTerminal.t.sol → PhantomSurplusTerminal.t.sol} +0 -0
@@ -143,14 +143,8 @@ contract TestLoanERC20Fork is ForkTestBase {
143
143
  vm.prank(payer);
144
144
  tokensReceived = jbMultiTerminal()
145
145
  .pay({
146
- projectId: id,
147
- token: USDC,
148
- amount: amount,
149
- beneficiary: payer,
150
- minReturnedTokens: 0,
151
- memo: "",
152
- metadata: ""
153
- });
146
+ projectId: id, token: USDC, amount: amount, beneficiary: payer, minReturnedTokens: 0, memo: "", metadata: ""
147
+ });
154
148
  }
155
149
 
156
150
  // ───────────────────────── USDC Loan Helpers
@@ -181,14 +181,14 @@ contract TestPermit2PaymentFork is ForkTestBase {
181
181
  vm.prank(signer);
182
182
  uint256 tokensReceived = jbMultiTerminal()
183
183
  .pay({
184
- projectId: revnetId,
185
- token: address(testToken),
186
- amount: payAmount,
187
- beneficiary: signer,
188
- minReturnedTokens: 0,
189
- memo: "permit2 payment",
190
- metadata: metadata
191
- });
184
+ projectId: revnetId,
185
+ token: address(testToken),
186
+ amount: payAmount,
187
+ beneficiary: signer,
188
+ minReturnedTokens: 0,
189
+ memo: "permit2 payment",
190
+ metadata: metadata
191
+ });
192
192
 
193
193
  // Verify payment succeeded.
194
194
  assertGt(tokensReceived, 0, "should receive project tokens from Permit2 payment");
@@ -220,14 +220,14 @@ contract TestPermit2PaymentFork is ForkTestBase {
220
220
  vm.expectRevert();
221
221
  jbMultiTerminal()
222
222
  .pay({
223
- projectId: revnetId,
224
- token: address(testToken),
225
- amount: payAmount,
226
- beneficiary: signer,
227
- minReturnedTokens: 0,
228
- memo: "expired permit2",
229
- metadata: metadata
230
- });
223
+ projectId: revnetId,
224
+ token: address(testToken),
225
+ amount: payAmount,
226
+ beneficiary: signer,
227
+ minReturnedTokens: 0,
228
+ memo: "expired permit2",
229
+ metadata: metadata
230
+ });
231
231
  }
232
232
 
233
233
  /// @notice Replaying the same Permit2 nonce should revert on the second payment.
@@ -243,14 +243,14 @@ contract TestPermit2PaymentFork is ForkTestBase {
243
243
  vm.prank(signer);
244
244
  jbMultiTerminal()
245
245
  .pay({
246
- projectId: revnetId,
247
- token: address(testToken),
248
- amount: payAmount,
249
- beneficiary: signer,
250
- minReturnedTokens: 0,
251
- memo: "first permit2 payment",
252
- metadata: metadata
253
- });
246
+ projectId: revnetId,
247
+ token: address(testToken),
248
+ amount: payAmount,
249
+ beneficiary: signer,
250
+ minReturnedTokens: 0,
251
+ memo: "first permit2 payment",
252
+ metadata: metadata
253
+ });
254
254
 
255
255
  // Second payment with the same nonce.
256
256
  // The permit call will fail (nonce already used), terminal catches it via try-catch,
@@ -259,14 +259,14 @@ contract TestPermit2PaymentFork is ForkTestBase {
259
259
  vm.expectRevert();
260
260
  jbMultiTerminal()
261
261
  .pay({
262
- projectId: revnetId,
263
- token: address(testToken),
264
- amount: payAmount,
265
- beneficiary: signer,
266
- minReturnedTokens: 0,
267
- memo: "replayed permit2 payment",
268
- metadata: metadata
269
- });
262
+ projectId: revnetId,
263
+ token: address(testToken),
264
+ amount: payAmount,
265
+ beneficiary: signer,
266
+ minReturnedTokens: 0,
267
+ memo: "replayed permit2 payment",
268
+ metadata: metadata
269
+ });
270
270
  }
271
271
 
272
272
  // ───────────────────────── Permit2 Signature Helpers
@@ -275,11 +275,11 @@ contract TestBurnPermissionRequired is TestBaseWorkflow {
275
275
  vm.prank(user);
276
276
  jbPermissions()
277
277
  .setPermissionsFor({
278
- account: user,
279
- permissionsData: JBPermissionsData({
280
- operator: address(LOANS_CONTRACT), projectId: uint64(REVNET_ID), permissionIds: permissionIds
281
- })
282
- });
278
+ account: user,
279
+ permissionsData: JBPermissionsData({
280
+ operator: address(LOANS_CONTRACT), projectId: uint64(REVNET_ID), permissionIds: permissionIds
281
+ })
282
+ });
283
283
 
284
284
  // Borrow should now succeed.
285
285
  REVLoanSource memory source = REVLoanSource({token: JBConstants.NATIVE_TOKEN, terminal: jbMultiTerminal()});
@@ -157,14 +157,14 @@ contract TestCashOutBuybackFeeLeak is TestBaseWorkflow {
157
157
  vm.prank(user);
158
158
  jbMultiTerminal()
159
159
  .cashOutTokensOf({
160
- holder: user,
161
- projectId: revnetId,
162
- cashOutCount: fullCashOutCount,
163
- tokenToReclaim: JBConstants.NATIVE_TOKEN,
164
- minTokensReclaimed: 0,
165
- beneficiary: payable(user),
166
- metadata: ""
167
- });
160
+ holder: user,
161
+ projectId: revnetId,
162
+ cashOutCount: fullCashOutCount,
163
+ tokenToReclaim: JBConstants.NATIVE_TOKEN,
164
+ minTokensReclaimed: 0,
165
+ beneficiary: payable(user),
166
+ metadata: ""
167
+ });
168
168
 
169
169
  // THE INVARIANT: The buyback hook callback should receive nonFeeCashOutCount.
170
170
  // The real buyback hook remints `context.cashOutCount` tokens and sells them on the pool.