diff --git a/.gas-snapshot b/.gas-snapshot index d1880acd..d4e7920f 100644 --- a/.gas-snapshot +++ b/.gas-snapshot @@ -1,5 +1,5 @@ -DiffFuzzTestStarPortLib:testSpentToReceived((uint8,address,uint256,uint256)[]) (runs: 256, μ: 880473, ~: 882534) -DiffFuzzTestStarPortLib:testUnboundSpentToReceived((uint8,address,uint256,uint256)[]) (runs: 256, μ: 232912, ~: 237832) +DiffFuzzTestStarPortLib:testSpentToReceived((uint8,address,uint256,uint256)[]) (runs: 256, μ: 880497, ~: 882879) +DiffFuzzTestStarPortLib:testUnboundSpentToReceived((uint8,address,uint256,uint256)[]) (runs: 256, μ: 232905, ~: 237832) IntegrationTestCaveats:testOriginateUnapprovedFulfiller() (gas: 341266) IntegrationTestCaveats:testOriginateWBorrowerApproval() (gas: 296157) IntegrationTestCaveats:testOriginateWCaveats() (gas: 272197) @@ -8,10 +8,10 @@ IntegrationTestCaveats:testOriginateWCaveatsInvalidSalt() (gas: 257806) IntegrationTestCaveats:testOriginateWCaveatsInvalidSaltManual() (gas: 174782) IntegrationTestCaveats:testOriginateWLenderApproval() (gas: 296276) IntegrationTestCaveats:testRefinanceAsLender() (gas: 1056340) -IntegrationTestCaveats:testRefinanceCaveatFailure() (gas: 422093) -IntegrationTestCaveats:testRefinanceUnapprovedFulfiller() (gas: 479996) -IntegrationTestCaveats:testRefinanceWCaveatsInvalidSalt() (gas: 400984) -IntegrationTestCaveats:testRefinanceWLenderApproval() (gas: 423613) +IntegrationTestCaveats:testRefinanceCaveatFailure() (gas: 422075) +IntegrationTestCaveats:testRefinanceUnapprovedFulfiller() (gas: 479978) +IntegrationTestCaveats:testRefinanceWCaveatsInvalidSalt() (gas: 400966) +IntegrationTestCaveats:testRefinanceWLenderApproval() (gas: 423604) PausableNonReentrantImpl:test() (gas: 2442) PausableNonReentrantImpl:testReentrancy() (gas: 2735) TestAstariaV1Handler:testGetAuctionStart() (gas: 427553) @@ -35,7 +35,7 @@ TestAstariaV1Hook:testIsRecalledInsideWindow() (gas: 562926) TestAstariaV1Hook:testIsRecalledOutsideWindow() (gas: 560827) TestAstariaV1Hook:testRecallRateActiveRecall() (gas: 548487) TestAstariaV1Hook:testRecallRateEmptyRecall() (gas: 424392) -TestAstariaV1Loan:testNewLoanERC721CollateralDefaultTermsRecallBase() (gas: 1016029) +TestAstariaV1Loan:testNewLoanERC721CollateralDefaultTermsRecallBase() (gas: 1016002) TestAstariaV1Loan:testNewLoanERC721CollateralDefaultTermsRecallLender() (gas: 719784) TestAstariaV1Loan:testNewLoanERC721CollateralDefaultTermsRecallLiquidation() (gas: 744900) TestBorrowerEnforcer:testBERevertAdditionalTransfers() (gas: 73195) diff --git a/src/LoanManager.sol b/src/LoanManager.sol index 58c1f01d..676a46bc 100644 --- a/src/LoanManager.sol +++ b/src/LoanManager.sol @@ -48,7 +48,7 @@ interface LoanSettledCallback { function onLoanSettled(LoanManager.Loan calldata loan) external; } -contract LoanManager is Ownable, ERC721, PausableNonReentrant { +contract LoanManager is ERC721, PausableNonReentrant { using FixedPointMathLib for uint256; using {StarPortLib.toReceivedItems} for SpentItem[]; @@ -250,12 +250,12 @@ contract LoanManager is Ownable, ERC721, PausableNonReentrant { loan.originator = address(0); loan.start = 0; - if (msg.sender != loan.issuer && approvals[loan.issuer][msg.sender] != ApprovalType.LENDER) { - _validateAndEnforceCaveats(lenderCaveat, loan.issuer, additionalTransfers, loan); + if (msg.sender != loan.issuer && approvals[lender][msg.sender] != ApprovalType.LENDER) { + _validateAndEnforceCaveats(lenderCaveat, lender, additionalTransfers, loan); } if (additionalTransfers.length > 0) { - _validateAdditionalTransfers(loan.borrower, loan.issuer, msg.sender, additionalTransfers); + _validateAdditionalTransfers(loan.borrower, lender, msg.sender, additionalTransfers); StarPortLib.transferAdditionalTransfers(additionalTransfers); }