@bananapus/core-v6 0.0.28 → 0.0.30

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.
@@ -802,7 +802,7 @@ contract TestFeeFreeCashOutBypass is TestBaseWorkflow {
802
802
  beneficiary: payable(user),
803
803
  metadata: new bytes(0)
804
804
  });
805
- // Balance dropped significantly. _reduceFeeFreeSurplus should have capped fee-free at remaining balance.
805
+ // Balance dropped significantly. _capFeeFreeSurplus should have capped fee-free at remaining balance.
806
806
 
807
807
  // Step 4: Switch back to zero tax. Cash out remaining.
808
808
  _reconfigureWithTaxRate(_projectIdB, 0);
@@ -855,7 +855,7 @@ contract TestFeeFreeCashOutBypass is TestBaseWorkflow {
855
855
  vm.prank(multisig());
856
856
  jbFeelessAddresses().setFeelessAddress(_attacker, true);
857
857
 
858
- // Step 3: Feeless cashout — no fees charged, but _reduceFeeFreeSurplus should still cap.
858
+ // Step 3: Feeless cashout — no fees charged, but _capFeeFreeSurplus should still cap.
859
859
  uint256 attackerTokens = _tokens.totalBalanceOf(_attacker, _projectIdB);
860
860
  vm.prank(_attacker);
861
861
  uint256 reclaim = _terminal.cashOutTokensOf({
@@ -340,7 +340,7 @@ contract TestCashOutTokensOf_Local is JBMultiTerminalSetup {
340
340
  whenADataHookIsConfigured
341
341
  whenCallerHasPermission
342
342
  {
343
- // it will safeIncreaseAllowance pass the full amount to the hook and emit HookAfterRecordCashOut
343
+ // it will forceApprove pass the full amount to the hook and emit HookAfterRecordCashOut
344
344
 
345
345
  // mint mocked erc20 tokens to hodler
346
346
  _mockToken2.mint(address(_terminal), _defaultAmount * 10);
@@ -350,9 +350,6 @@ contract TestCashOutTokensOf_Local is JBMultiTerminalSetup {
350
350
  vm.prank(_holder);
351
351
  _mockToken2.approve(address(_terminal), _defaultAmount);
352
352
 
353
- vm.prank(address(_terminal));
354
- _mockToken2.approve(address(_mockHook), _defaultAmount);
355
-
356
353
  uint256 reclaimAmount = 1e9;
357
354
  JBCashOutHookSpecification[] memory hookSpecifications = new JBCashOutHookSpecification[](1);
358
355
  hookSpecifications[0] =
@@ -431,8 +428,8 @@ contract TestCashOutTokensOf_Local is JBMultiTerminalSetup {
431
428
 
432
429
  mockExpect(address(_mockHook), abi.encodeCall(IJBCashOutHook.afterCashOutRecordedWith, (context)), "");
433
430
 
434
- // ensure approval is increased
435
- vm.expectCall(address(_mockToken2), abi.encodeCall(IERC20.approve, (address(_mockHook), _defaultAmount * 2)));
431
+ // ensure approval is set via forceApprove
432
+ vm.expectCall(address(_mockToken2), abi.encodeCall(IERC20.approve, (address(_mockHook), _defaultAmount)));
436
433
 
437
434
  _acceptToken(address(_mockToken2), 18, uint32(uint160(address(_mockToken2))));
438
435
 
@@ -456,7 +453,7 @@ contract TestCashOutTokensOf_Local is JBMultiTerminalSetup {
456
453
  whenADataHookIsConfigured
457
454
  whenCallerHasPermission
458
455
  {
459
- // it will safeIncreaseAllowance pass the amount to the hook and emit HookAfterRecordCashOut
456
+ // it will forceApprove pass the amount to the hook and emit HookAfterRecordCashOut
460
457
 
461
458
  // mint mocked erc20 tokens to hodler
462
459
  _mockToken2.mint(address(_terminal), _defaultAmount * 10);
@@ -466,9 +463,6 @@ contract TestCashOutTokensOf_Local is JBMultiTerminalSetup {
466
463
  vm.prank(_holder);
467
464
  _mockToken2.approve(address(_terminal), _defaultAmount);
468
465
 
469
- vm.prank(address(_terminal));
470
- _mockToken2.approve(address(_mockHook), _defaultAmount);
471
-
472
466
  uint256 reclaimAmount = 1e9;
473
467
  JBCashOutHookSpecification[] memory hookSpecifications = new JBCashOutHookSpecification[](1);
474
468
  JBCashOutHookSpecification[] memory paySpecs = new JBCashOutHookSpecification[](0);
@@ -332,12 +332,7 @@ contract TestExecutePayout_Local is JBMultiTerminalSetup {
332
332
  uint256 taxedAmount = JBFees.feeAmountFrom(_defaultAmount, _fee);
333
333
  uint256 amountAfterTax = _defaultAmount - taxedAmount;
334
334
 
335
- // mock call for SafeERC20s allowance check
336
- mockExpect(
337
- _usdc, abi.encodeCall(IERC20.allowance, (address(_terminal), address(_mockSecondTerminal))), abi.encode(0)
338
- );
339
-
340
- // mock call for SafeERC20s safeIncreaseAllowance approval
335
+ // mock call for SafeERC20s forceApprove approval
341
336
  mockExpect(_usdc, abi.encodeCall(IERC20.approve, (_mockSecondTerminal, amountAfterTax)), "");
342
337
 
343
338
  // mock call to second terminals addToBalanceOf
@@ -421,12 +416,7 @@ contract TestExecutePayout_Local is JBMultiTerminalSetup {
421
416
  uint256 taxedAmount = JBFees.feeAmountFrom(_defaultAmount, _fee);
422
417
  uint256 amountAfterTax = _defaultAmount - taxedAmount;
423
418
 
424
- // mock call for SafeERC20s allowance check
425
- mockExpect(
426
- _usdc, abi.encodeCall(IERC20.allowance, (address(_terminal), address(_mockSecondTerminal))), abi.encode(0)
427
- );
428
-
429
- // mock call for SafeERC20s safeIncreaseAllowance approval
419
+ // mock call for SafeERC20s forceApprove approval
430
420
  mockExpect(_usdc, abi.encodeCall(IERC20.approve, (_mockSecondTerminal, amountAfterTax)), "");
431
421
 
432
422
  // mock call to second terminals pay function
@@ -68,12 +68,9 @@ contract TestExecuteProcessFee_Local is JBMultiTerminalSetup {
68
68
  }
69
69
 
70
70
  function test_WhenTokenIsErc20AndFeeTerminalIsExternal() external {
71
- // it will safeIncreaseAllowance
71
+ // it will forceApprove
72
72
 
73
- // mock token allowance call
74
- mockExpect(_usdc, abi.encodeCall(IERC20.allowance, (address(_terminal), address(_feeTerminal))), abi.encode(0));
75
-
76
- // mock approval call
73
+ // mock approval call for forceApprove
77
74
  mockExpect(_usdc, abi.encodeCall(IERC20.approve, (address(_feeTerminal), _defaultAmount)), "");
78
75
 
79
76
  // mock pay call to fee terminal
@@ -103,7 +103,7 @@ contract TestMigrateBalanceOf_Local is JBMultiTerminalSetup {
103
103
  } */
104
104
 
105
105
  function test_GivenTokenIsERC20() external whenPermissioned {
106
- // it will safeIncreaseAllowance and addToBalanceOf
106
+ // it will forceApprove and addToBalanceOf
107
107
 
108
108
  // mock _isFeeless to return true (skip migration fee for this unit test)
109
109
  mockExpect(
@@ -132,10 +132,7 @@ contract TestMigrateBalanceOf_Local is JBMultiTerminalSetup {
132
132
  abi.encode(_defaultAmount)
133
133
  );
134
134
 
135
- // mock call for SafeERC20s allowance check
136
- mockExpect(_usdc, abi.encodeCall(IERC20.allowance, (address(_terminal), address(_newTerminal))), abi.encode(0));
137
-
138
- // mock call for SafeERC20s safeIncreaseAllowance approval
135
+ // mock call for SafeERC20s forceApprove approval
139
136
  mockExpect(_usdc, abi.encodeCall(IERC20.approve, (address(_newTerminal), _defaultAmount)), "");
140
137
 
141
138
  // mock call to new terminal addToBalance