Skip to content

Commit

Permalink
feat: add new event to track invalidated hashes (#28)
Browse files Browse the repository at this point in the history
* feat: add new event to track invalidated hashed

* format & snapshot

---------

Co-authored-by: dangerousfood <[email protected]>
  • Loading branch information
dangerousfood and dangerousfood authored Oct 11, 2023
1 parent f044587 commit d5b60df
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 8 deletions.
16 changes: 8 additions & 8 deletions .gas-snapshot
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ EnforcerTest:testFailRateEnforcerMaxRate() (gas: 783780)
EnforcerTest:testFailRateEnforcerMaxRateAndMaxCarryRate() (gas: 783645)
EnforcerTest:testRateEnforcerBasic() (gas: 903898)
EnforcerTest:testTermEnforcerBasic() (gas: 976160)
TestAstariaV1Loan:testNewLoanERC721CollateralDefaultTermsRecall() (gas: 964589)
TestAstariaV1Loan:testNewLoanERC721CollateralDefaultTermsRecallLender() (gas: 867112)
TestAstariaV1Loan:testNewLoanERC721CollateralDefaultTermsRecallLiquidation() (gas: 913906)
TestAstariaV1Loan:testNewLoanERC721CollateralDefaultTermsRecall() (gas: 964597)
TestAstariaV1Loan:testNewLoanERC721CollateralDefaultTermsRecallLender() (gas: 867128)
TestAstariaV1Loan:testNewLoanERC721CollateralDefaultTermsRecallLiquidation() (gas: 913922)
TestCustodian:testCannotLazyMintTwice() (gas: 76569)
TestCustodian:testCannotMintInvalidLoanInvalidCustodian() (gas: 66833)
TestCustodian:testCannotMintInvalidLoanValidCustodian() (gas: 72328)
Expand Down Expand Up @@ -50,11 +50,11 @@ TestLoanCombinations:testLoanSimpleInterestEnglishFixed() (gas: 701464)
TestLoanManager:testGenerateOrder() (gas: 998199)
TestLoanManager:testGenerateOrderInvalidSender() (gas: 12986)
TestLoanManager:testSupportsInterface() (gas: 7003)
TestNewLoan:testBuyNowPayLater() (gas: 1144531)
TestNewLoan:testNewLoanERC721CollateralDefaultTerms2():((uint256,address,address,address,address,(uint8,address,uint256,uint256)[],(uint8,address,uint256,uint256)[],(address,bytes,address,bytes,address,bytes))) (gas: 974985)
TestNewLoan:testNewLoanERC721CollateralDefaultTermsRefinance() (gas: 635547)
TestNewLoan:testSettleLoan() (gas: 1240937)
TestRepayLoan:testRepayLoan() (gas: 698757)
TestNewLoan:testBuyNowPayLater() (gas: 1144517)
TestNewLoan:testNewLoanERC721CollateralDefaultTerms2():((uint256,address,address,address,address,(uint8,address,uint256,uint256)[],(uint8,address,uint256,uint256)[],(address,bytes,address,bytes,address,bytes))) (gas: 974971)
TestNewLoan:testNewLoanERC721CollateralDefaultTermsRefinance() (gas: 635551)
TestNewLoan:testSettleLoan() (gas: 1240923)
TestRepayLoan:testRepayLoan() (gas: 698749)
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 @@ -219,6 +221,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 d5b60df

Please sign in to comment.