@@ -952,21 +952,6 @@ contract TestBullaFrendLend is Test {
952952 assertEq (bullaFrendLend.protocolFeeBPS (), newProtocolFeeBPS, "Protocol fee not updated correctly " );
953953 }
954954
955- // helper function to check if token is in protocol fee tokens
956- function isTokenInProtocolFeeTokens (address token ) internal view returns (bool ) {
957- // we've defined at most 3 tokens in our test
958- for (uint256 i = 0 ; i < 3 ; i++ ) {
959- try bullaFrendLend.protocolFeeTokens (i) returns (address tokenAddr ) {
960- if (tokenAddr == token) {
961- return true ;
962- }
963- } catch {
964- break ;
965- }
966- }
967- return false ;
968- }
969-
970955 function testProtocolFeeWithMultipleTokens () public {
971956 vm.startPrank (creditor);
972957 weth.approve (address (bullaFrendLend), 10 ether);
@@ -1052,10 +1037,6 @@ contract TestBullaFrendLend is Test {
10521037 assertEq (bullaFrendLend.protocolFeesByToken (address (weth)), wethProtocolFee, "WETH fee tracking incorrect " );
10531038 assertEq (bullaFrendLend.protocolFeesByToken (address (usdc)), usdcProtocolFee, "USDC fee tracking incorrect " );
10541039 assertEq (bullaFrendLend.protocolFeesByToken (address (dai)), daiProtocolFee, "DAI fee tracking incorrect " );
1055-
1056- assertTrue (isTokenInProtocolFeeTokens (address (weth)), "WETH not found in protocol fee tokens array " );
1057- assertTrue (isTokenInProtocolFeeTokens (address (usdc)), "USDC not found in protocol fee tokens array " );
1058- assertTrue (isTokenInProtocolFeeTokens (address (dai)), "DAI not found in protocol fee tokens array " );
10591040 }
10601041
10611042 function testWithdrawAllFees () public {
@@ -1357,88 +1338,6 @@ contract TestBullaFrendLend is Test {
13571338 }
13581339 }
13591340
1360- function testTokenTrackingUniqueness () public {
1361- vm.startPrank (creditor);
1362- weth.approve (address (bullaFrendLend), 10 ether);
1363- vm.stopPrank ();
1364-
1365- vm.startPrank (debtor);
1366- weth.approve (address (bullaFrendLend), 10 ether);
1367- vm.stopPrank ();
1368-
1369- bullaClaim.approvalRegistry ().permitCreateClaim ({
1370- user: debtor,
1371- controller: address (bullaFrendLend),
1372- approvalType: CreateClaimApprovalType.Approved,
1373- approvalCount: 2 ,
1374- isBindingAllowed: true ,
1375- signature: sigHelper.signCreateClaimPermit ({
1376- pk: debtorPK,
1377- user: debtor,
1378- controller: address (bullaFrendLend),
1379- approvalType: CreateClaimApprovalType.Approved,
1380- approvalCount: 2 ,
1381- isBindingAllowed: true
1382- })
1383- });
1384-
1385- // Create first WETH loan
1386- LoanRequestParams memory wethOffer1 = new LoanRequestParamsBuilder ().withCreditor (creditor).withDebtor (debtor)
1387- .withDescription ("WETH Loan 1 " ).withToken (address (weth)).withLoanAmount (1 ether).withNumberOfPeriodsPerYear (365 )
1388- .build ();
1389-
1390- vm.prank (creditor);
1391- uint256 wethLoanId1 = bullaFrendLend.offerLoan (wethOffer1);
1392-
1393- vm.prank (debtor);
1394- uint256 wethClaimId1 = bullaFrendLend.acceptLoan {value: FEE}(wethLoanId1);
1395-
1396- // Create second WETH loan
1397- LoanRequestParams memory wethOffer2 = new LoanRequestParamsBuilder ().withCreditor (creditor).withDebtor (debtor)
1398- .withDescription ("WETH Loan 2 " ).withToken (address (weth)).withLoanAmount (0.5 ether).withNumberOfPeriodsPerYear (
1399- 365
1400- ).build ();
1401-
1402- vm.prank (creditor);
1403- uint256 wethLoanId2 = bullaFrendLend.offerLoan (wethOffer2);
1404-
1405- vm.prank (debtor);
1406- uint256 wethClaimId2 = bullaFrendLend.acceptLoan {value: FEE}(wethLoanId2);
1407-
1408- vm.warp (block .timestamp + 15 days);
1409-
1410- // Make payments on both loans
1411- vm.startPrank (debtor);
1412-
1413- uint256 initialContractBalance = weth.balanceOf (address (bullaFrendLend));
1414- (uint256 principal1 , uint256 interest1 ) = bullaFrendLend.getTotalAmountDue (wethClaimId1);
1415- bullaFrendLend.payLoan (wethClaimId1, principal1 + interest1);
1416- uint256 fee1 = weth.balanceOf (address (bullaFrendLend)) - initialContractBalance;
1417-
1418- uint256 contractBalanceAfterFirst = weth.balanceOf (address (bullaFrendLend));
1419- (uint256 principal2 , uint256 interest2 ) = bullaFrendLend.getTotalAmountDue (wethClaimId2);
1420- bullaFrendLend.payLoan (wethClaimId2, principal2 + interest2);
1421- uint256 fee2 = weth.balanceOf (address (bullaFrendLend)) - contractBalanceAfterFirst;
1422- vm.stopPrank ();
1423-
1424- // Count WETH tokens in the array
1425- uint256 wethTokenCount = 0 ;
1426- for (uint256 i = 0 ; i < 3 ; i++ ) {
1427- try bullaFrendLend.protocolFeeTokens (i) returns (address token ) {
1428- if (token == address (weth)) {
1429- wethTokenCount++ ;
1430- }
1431- } catch {
1432- break ;
1433- }
1434- }
1435-
1436- assertEq (wethTokenCount, 1 , "WETH should only appear once in protocol fee tokens array " );
1437- assertEq (
1438- bullaFrendLend.protocolFeesByToken (address (weth)), fee1 + fee2, "WETH fees should accumulate correctly "
1439- );
1440- }
1441-
14421341 function testProtocolFeeVariations () public {
14431342 vm.startPrank (creditor);
14441343 weth.approve (address (bullaFrendLend), 10 ether);
0 commit comments