Skip to content

Commit

Permalink
Merge branch 'main' of https://github.com/astariaxyz/starport into fe…
Browse files Browse the repository at this point in the history
…at/custodian-handler-changes
  • Loading branch information
androolloyd committed Oct 12, 2023
2 parents 4179318 + d5b60df commit f75ec13
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 27 deletions.
57 changes: 30 additions & 27 deletions .gas-snapshot
Original file line number Diff line number Diff line change
@@ -1,23 +1,23 @@
EnforcerTest:testCollateralEnforcer() (gas: 946539)
EnforcerTest:testFailCollateralEnforcerDifferentCollateral() (gas: 828668)
EnforcerTest:testFailRateEnforcerMaxCarryRate() (gas: 783830)
EnforcerTest:testFailRateEnforcerMaxRate() (gas: 783780)
EnforcerTest:testFailRateEnforcerMaxRateAndMaxCarryRate() (gas: 783645)
EnforcerTest:testRateEnforcerBasic() (gas: 903803)
EnforcerTest:testTermEnforcerBasic() (gas: 976065)
TestAstariaV1Loan:testNewLoanERC721CollateralDefaultTermsRecall() (gas: 964715)
TestAstariaV1Loan:testNewLoanERC721CollateralDefaultTermsRecallLender() (gas: 854952)
TestAstariaV1Loan:testNewLoanERC721CollateralDefaultTermsRecallLiquidation() (gas: 901869)
EnforcerTest:testCollateralEnforcer() (gas: 950836)
EnforcerTest:testFailCollateralEnforcerDifferentCollateral() (gas: 832965)
EnforcerTest:testFailRateEnforcerMaxCarryRate() (gas: 788105)
EnforcerTest:testFailRateEnforcerMaxRate() (gas: 788077)
EnforcerTest:testFailRateEnforcerMaxRateAndMaxCarryRate() (gas: 787942)
EnforcerTest:testRateEnforcerBasic() (gas: 908012)
EnforcerTest:testTermEnforcerBasic() (gas: 980340)
TestAstariaV1Loan:testNewLoanERC721CollateralDefaultTermsRecall() (gas: 969012)
TestAstariaV1Loan:testNewLoanERC721CollateralDefaultTermsRecallLender() (gas: 859249)
TestAstariaV1Loan:testNewLoanERC721CollateralDefaultTermsRecallLiquidation() (gas: 906166)
TestCustodian:testCannotLazyMintTwice() (gas: 76591)
TestCustodian:testCannotMintInvalidLoanInvalidCustodian() (gas: 66811)
TestCustodian:testCannotMintInvalidLoanValidCustodian() (gas: 72394)
TestCustodian:testCustodySelector() (gas: 11040)
TestCustodian:testGenerateOrderInvalidHandlerExecution() (gas: 147048)
TestCustodian:testGenerateOrderRepay() (gas: 188954)
TestCustodian:testGenerateOrderRepayAsRepayApprovedBorrower() (gas: 214528)
TestCustodian:testGenerateOrderRepayERC1155AndERC20AndNative() (gas: 1116373)
TestCustodian:testGenerateOrderRepayERC1155AndERC20AndNativeHandlerAuthorized() (gas: 1015092)
TestCustodian:testGenerateOrderRepayERC1155WithRevert() (gas: 526204)
TestCustodian:testGenerateOrderRepayERC1155AndERC20AndNative() (gas: 1129198)
TestCustodian:testGenerateOrderRepayERC1155AndERC20AndNativeHandlerAuthorized() (gas: 1027917)
TestCustodian:testGenerateOrderRepayERC1155WithRevert() (gas: 530479)
TestCustodian:testGenerateOrderRepayInvalidHookAddress() (gas: 104747)
TestCustodian:testGenerateOrderRepayInvalidHookReturnType() (gas: 99150)
TestCustodian:testGenerateOrderRepayNotBorrower() (gas: 110738)
Expand All @@ -43,20 +43,23 @@ TestCustodian:testSupportsInterface() (gas: 9428)
TestCustodian:testSymbol() (gas: 7105)
TestCustodian:testTokenURI() (gas: 64811)
TestCustodian:testTokenURIInvalidLoan() (gas: 13196)
TestExoticLoans:testSwap() (gas: 1290801)
TestLoanCombinations:testLoan20For721SimpleInterestDutchFixedRepay() (gas: 252)
TestLoanCombinations:testLoan20for20SimpleInterestDutchFixedRepay() (gas: 499503)
TestLoanCombinations:testLoan721for20SimpleInterestDutchFixedRepay() (gas: 706902)
TestLoanCombinations:testLoanAstariaSettlementRepay() (gas: 498842)
TestLoanCombinations:testLoanSimpleInterestEnglishFixed() (gas: 692767)
TestLoanManager:testGenerateOrder() (gas: 1005619)
TestLoanManager:testGenerateOrderNotSeaport() (gas: 12986)
TestLoanManager:testSupportsInterface() (gas: 9311)
TestNewLoan:testBuyNowPayLater() (gas: 1144422)
TestNewLoan:testNewLoanERC721CollateralDefaultTerms2():((uint256,address,address,address,address,(uint8,address,uint256,uint256)[],(uint8,address,uint256,uint256)[],(address,bytes,address,bytes,address,bytes))) (gas: 974876)
TestNewLoan:testNewLoanERC721CollateralDefaultTermsRefinance() (gas: 635625)
TestNewLoan:testSettleLoan() (gas: 1229216)
TestRepayLoan:testRepayLoan() (gas: 690073)
TestExoticLoans:testSwap() (gas: 1334111)
TestLoanCombinations:testLoan20For721SimpleInterestDutchFixedRepay() (gas: 164)
TestLoanCombinations:testLoan20for20SimpleInterestDutchFixedRepay() (gas: 539940)
TestLoanCombinations:testLoan721for20SimpleInterestDutchFixedRepay() (gas: 756028)
TestLoanCombinations:testLoanAstariaSettlementRepay() (gas: 575128)
TestLoanCombinations:testLoanSimpleInterestEnglishFixed() (gas: 747673)
TestLoanManager:testGenerateOrder() (gas: 1005642)
TestLoanManager:testGenerateOrderNotSeaport() (gas: 13074)
TestLoanManager:testName() (gas: 7206)
TestLoanManager:testSupportsInterface() (gas: 9579)
TestLoanManager:testSymbol() (gas: 7148)
TestNewLoan:testBuyNowPayLater() (gas: 1148679)
TestNewLoan:testNewLoanERC721CollateralDefaultTerms2():((uint256,address,address,address,address,(uint8,address,uint256,uint256)[],(uint8,address,uint256,uint256)[],(address,bytes,address,bytes,address,bytes))) (gas: 979129)
TestNewLoan:testNewLoanERC721CollateralDefaultTermsRefinance() (gas: 639900)
TestNewLoan:testNewLoanERC721CollateralLessDebtThanOffered():((uint256,address,address,address,address,(uint8,address,uint256,uint256)[],(uint8,address,uint256,uint256)[],(address,bytes,address,bytes,address,bytes))) (gas: 979463)
TestNewLoan:testSettleLoan() (gas: 1233491)
TestRepayLoan:testRepayLoan() (gas: 694472)
TestStarLiteUtils:testEncodeReceivedWithRecipient() (gas: 17955)
TestStarLiteUtils:testSpentToReceived() (gas: 17708)
TestStarLiteUtils:testValidateSaltOpt(address,bytes32) (runs: 256, μ: 26479, ~: 26479)
Expand Down
3 changes: 3 additions & 0 deletions src/originators/Originator.sol
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,8 @@ abstract contract Originator is Ownable {

event CounterUpdated();

event HashInvalidated(bytes32 hash);

modifier onlyLoanManager() {
if (msg.sender != address(LM)) {
revert NotLoanManager();
Expand Down Expand Up @@ -246,6 +248,7 @@ abstract contract Originator is Ownable {
if (details.offer.salt != bytes32(0)) {
if (!usedHashes[contextHash]) {
usedHashes[contextHash] = true;
emit HashInvalidated(contextHash);
} else {
revert InvalidOffer();
}
Expand Down

0 comments on commit f75ec13

Please sign in to comment.