@@ -440,9 +440,7 @@ contract AllowancePositionManagerTest is SpokeBase {
440440 }
441441
442442 // temporary withdraw allowance takes precedence over stored withdraw allowance, and does not cumulate
443- function test_withdrawOnBehalfOf_revertsWith_InsufficientWithdrawAllowance_TemporaryAllowanceTakesPrecedence ()
444- public
445- {
443+ function test_withdrawOnBehalfOf_revertsWith_InsufficientTemporaryWithdrawAllowance () public {
446444 uint256 storedAllowance = 300e18 ;
447445 _fuzzyApproveWithdraw (alice, alicePk, bob, _daiReserveId (spoke), storedAllowance, 0 );
448446
@@ -452,7 +450,7 @@ contract AllowancePositionManagerTest is SpokeBase {
452450
453451 vm.expectRevert (
454452 abi.encodeWithSelector (
455- IAllowancePositionManager.InsufficientWithdrawAllowance .selector ,
453+ IAllowancePositionManager.InsufficientTemporaryWithdrawAllowance .selector ,
456454 temporaryAllowance,
457455 amount
458456 )
@@ -463,7 +461,7 @@ contract AllowancePositionManagerTest is SpokeBase {
463461 assertEq (positionManager.withdrawAllowance (alice, bob, _daiReserveId (spoke)), storedAllowance);
464462 }
465463
466- function test_withdrawOnBehalfOf_fuzz_revertsWith_InsufficientWithdrawAllowance (
464+ function test_withdrawOnBehalfOf_fuzz_revertsWith_InsufficientAllowance (
467465 uint256 approvalAmount ,
468466 uint256 approvalType
469467 ) public {
@@ -478,11 +476,20 @@ contract AllowancePositionManagerTest is SpokeBase {
478476 onBehalfOf: alice
479477 });
480478
481- _fuzzyApproveWithdraw (alice, alicePk, bob, _daiReserveId (spoke), approvalAmount, approvalType);
479+ approvalType = _fuzzyApproveWithdraw (
480+ alice,
481+ alicePk,
482+ bob,
483+ _daiReserveId (spoke),
484+ approvalAmount,
485+ approvalType
486+ );
482487
483488 vm.expectRevert (
484489 abi.encodeWithSelector (
485- IAllowancePositionManager.InsufficientWithdrawAllowance.selector ,
490+ (approvalType == 2 )
491+ ? IAllowancePositionManager.InsufficientTemporaryWithdrawAllowance.selector
492+ : IAllowancePositionManager.InsufficientWithdrawAllowance.selector ,
486493 approvalAmount,
487494 amount
488495 )
@@ -734,9 +741,7 @@ contract AllowancePositionManagerTest is SpokeBase {
734741 }
735742
736743 // temporary credit delegation takes precedence over stored credit delegation, and does not cumulate
737- function test_borrowOnBehalfOf_revertsWith_InsufficientCreditDelegation_temporaryDelegateCreditTakesPrecedence ()
738- public
739- {
744+ function test_borrowOnBehalfOf_revertsWith_InsufficientTemporaryCreditDelegation () public {
740745 uint256 storedAllowance = 300e18 ;
741746 _fuzzyDelegateCredit (alice, alicePk, bob, _daiReserveId (spoke), storedAllowance, 0 );
742747
@@ -746,7 +751,7 @@ contract AllowancePositionManagerTest is SpokeBase {
746751
747752 vm.expectRevert (
748753 abi.encodeWithSelector (
749- IAllowancePositionManager.InsufficientCreditDelegation .selector ,
754+ IAllowancePositionManager.InsufficientTemporaryCreditDelegation .selector ,
750755 temporaryAllowance,
751756 amount
752757 )
@@ -757,7 +762,7 @@ contract AllowancePositionManagerTest is SpokeBase {
757762 assertEq (positionManager.creditDelegation (alice, bob, _daiReserveId (spoke)), storedAllowance);
758763 }
759764
760- function test_borrowOnBehalfOf_fuzz_revertsWith_InsufficientCreditDelegation (
765+ function test_borrowOnBehalfOf_fuzz_revertsWith_InsufficientAllowance (
761766 uint256 creditDelegationAmount ,
762767 uint256 approvalType
763768 ) public {
@@ -766,7 +771,7 @@ contract AllowancePositionManagerTest is SpokeBase {
766771 Utils.supplyCollateral (spoke, _daiReserveId (spoke), alice, borrowAmount, alice);
767772 Utils.supplyCollateral (spoke, _daiReserveId (spoke), bob, borrowAmount, bob);
768773
769- _fuzzyDelegateCredit (
774+ approvalType = _fuzzyDelegateCredit (
770775 alice,
771776 alicePk,
772777 bob,
@@ -777,7 +782,9 @@ contract AllowancePositionManagerTest is SpokeBase {
777782
778783 vm.expectRevert (
779784 abi.encodeWithSelector (
780- IAllowancePositionManager.InsufficientCreditDelegation.selector ,
785+ (approvalType == 2 )
786+ ? IAllowancePositionManager.InsufficientTemporaryCreditDelegation.selector
787+ : IAllowancePositionManager.InsufficientCreditDelegation.selector ,
781788 creditDelegationAmount,
782789 borrowAmount
783790 )
0 commit comments