From 64d141fc47c1427401f3120aa8dc85dd3fd443a4 Mon Sep 17 00:00:00 2001 From: Joseph Delong Date: Mon, 11 Dec 2023 08:24:32 -0600 Subject: [PATCH] fix: forge fmt --- .gas-snapshot | 86 +++++++++++++++++++++--------------------- .gitignore | 1 + src/scripts/Deploy.sol | 50 +++++++++++------------- 3 files changed, 66 insertions(+), 71 deletions(-) diff --git a/.gas-snapshot b/.gas-snapshot index a5cc648..bd3d4c7 100644 --- a/.gas-snapshot +++ b/.gas-snapshot @@ -1,44 +1,44 @@ -TestAstariaV1Loan:testNewLoanERC721CollateralDefaultTermsRecallAuctionFailLenderClaim() (gas: 653231) -TestAstariaV1Loan:testNewLoanERC721CollateralDefaultTermsRecallAuctionFailLenderClaimRandomFulfiller() (gas: 644215) -TestAstariaV1Loan:testNewLoanERC721CollateralDefaultTermsRecallBase() (gas: 1042358) -TestAstariaV1Loan:testNewLoanERC721CollateralDefaultTermsRecallLender() (gas: 666730) -TestAstariaV1Loan:testNewLoanERC721CollateralDefaultTermsRecallLiquidation() (gas: 1438180) -TestAstariaV1Pricing:testGetRefinanceConsiderationAsBorrowerZeroRate() (gas: 79783) -TestAstariaV1Pricing:testGetRefinanceConsiderationInsufficientRefinance() (gas: 111189) -TestAstariaV1Pricing:testGetRefinanceConsiderationInvalidRefinance() (gas: 88304) -TestAstariaV1Pricing:testGetRefinanceConsiderationValidEqualRate() (gas: 149516) +TestAstariaV1Loan:testNewLoanERC721CollateralDefaultTermsRecallAuctionFailLenderClaim() (gas: 653431) +TestAstariaV1Loan:testNewLoanERC721CollateralDefaultTermsRecallAuctionFailLenderClaimRandomFulfiller() (gas: 644415) +TestAstariaV1Loan:testNewLoanERC721CollateralDefaultTermsRecallBase() (gas: 1042647) +TestAstariaV1Loan:testNewLoanERC721CollateralDefaultTermsRecallLender() (gas: 666952) +TestAstariaV1Loan:testNewLoanERC721CollateralDefaultTermsRecallLiquidation() (gas: 1438402) +TestAstariaV1Pricing:testGetRefinanceConsiderationAsBorrowerZeroRate() (gas: 79805) +TestAstariaV1Pricing:testGetRefinanceConsiderationInsufficientRefinance() (gas: 111300) +TestAstariaV1Pricing:testGetRefinanceConsiderationInvalidRefinance() (gas: 88414) +TestAstariaV1Pricing:testGetRefinanceConsiderationValidEqualRate() (gas: 149494) TestAstariaV1Pricing:testGetRefinanceConsiderationValidHigherRate() (gas: 162892) -TestAstariaV1Pricing:testGetRefinanceConsiderationValidLowerRate() (gas: 157711) -TestAstariaV1Pricing:testGetRefinanceConsiderationZeroRate() (gas: 81207) +TestAstariaV1Pricing:testGetRefinanceConsiderationValidLowerRate() (gas: 157689) +TestAstariaV1Pricing:testGetRefinanceConsiderationZeroRate() (gas: 81185) TestAstariaV1Pricing:testGetRefinanceNewDecimalMismatch() (gas: 81092) -TestAstariaV1Pricing:testV1PricingValidateInvalid() (gas: 69869) +TestAstariaV1Pricing:testV1PricingValidateInvalid() (gas: 69891) TestAstariaV1Pricing:testV1PricingValidateValid() (gas: 69677) -TestAstariaV1Settlement:testGetAuctionStart() (gas: 468743) -TestAstariaV1Settlement:testGetAuctionStartNotStarted() (gas: 468163) -TestAstariaV1Settlement:testGetCurrentAuctionPrice() (gas: 483815) -TestAstariaV1Settlement:testGetCurrentAuctionPriceNoAuction() (gas: 471816) -TestAstariaV1Settlement:testGetSettlementConsiderationDutchAuctionSettlementAbove() (gas: 524599) -TestAstariaV1Settlement:testGetSettlementConsiderationFailedDutchAuction() (gas: 484272) -TestAstariaV1Settlement:testGetSettlementConsiderationLoanNotRecalled() (gas: 474409) -TestAstariaV1Settlement:testGetSettlementConsiderationLoanRecalledByLender() (gas: 506886) -TestAstariaV1Settlement:testGetSettlementConsiderationNoRecallRate() (gas: 486189) -TestAstariaV1Settlement:testV1SettlementHandlerValidate() (gas: 454714) +TestAstariaV1Settlement:testGetAuctionStart() (gas: 468921) +TestAstariaV1Settlement:testGetAuctionStartNotStarted() (gas: 468341) +TestAstariaV1Settlement:testGetCurrentAuctionPrice() (gas: 483971) +TestAstariaV1Settlement:testGetCurrentAuctionPriceNoAuction() (gas: 471994) +TestAstariaV1Settlement:testGetSettlementConsiderationDutchAuctionSettlementAbove() (gas: 524777) +TestAstariaV1Settlement:testGetSettlementConsiderationFailedDutchAuction() (gas: 484450) +TestAstariaV1Settlement:testGetSettlementConsiderationLoanNotRecalled() (gas: 474587) +TestAstariaV1Settlement:testGetSettlementConsiderationLoanRecalledByLender() (gas: 507064) +TestAstariaV1Settlement:testGetSettlementConsiderationNoRecallRate() (gas: 486367) +TestAstariaV1Settlement:testV1SettlementHandlerValidate() (gas: 454870) TestAstariaV1Settlement:testV1SettlementValidateInvalid() (gas: 62616) TestAstariaV1Settlement:testV1SettlementValidateValid() (gas: 61991) -TestAstariaV1Status:testCannotRecallTwice() (gas: 581966) -TestAstariaV1Status:testCannotWithdrawLoanHasNotBeenRefinanced() (gas: 463071) -TestAstariaV1Status:testCannotWithdrawWithdrawDoesNotExist() (gas: 469779) -TestAstariaV1Status:testGenerateRecallConsideration() (gas: 508246) -TestAstariaV1Status:testInvalidRecallInvalidStakeType() (gas: 523692) -TestAstariaV1Status:testInvalidRecallLoanDoesNotExist() (gas: 510984) -TestAstariaV1Status:testIsActive() (gas: 467865) -TestAstariaV1Status:testIsRecalledInsideWindow() (gas: 596425) -TestAstariaV1Status:testIsRecalledOutsideWindow() (gas: 594357) -TestAstariaV1Status:testRecallAndRefinanceInsideWindow() (gas: 753362) -TestAstariaV1Status:testRecallRateActiveRecall() (gas: 582949) -TestAstariaV1Status:testRecallRateEmptyRecall() (gas: 466199) +TestAstariaV1Status:testCannotRecallTwice() (gas: 582100) +TestAstariaV1Status:testCannotWithdrawLoanHasNotBeenRefinanced() (gas: 463294) +TestAstariaV1Status:testCannotWithdrawWithdrawDoesNotExist() (gas: 469935) +TestAstariaV1Status:testGenerateRecallConsideration() (gas: 508424) +TestAstariaV1Status:testInvalidRecallInvalidStakeType() (gas: 523870) +TestAstariaV1Status:testInvalidRecallLoanDoesNotExist() (gas: 511184) +TestAstariaV1Status:testIsActive() (gas: 468021) +TestAstariaV1Status:testIsRecalledInsideWindow() (gas: 596625) +TestAstariaV1Status:testIsRecalledOutsideWindow() (gas: 594535) +TestAstariaV1Status:testRecallAndRefinanceInsideWindow() (gas: 753562) +TestAstariaV1Status:testRecallRateActiveRecall() (gas: 583105) +TestAstariaV1Status:testRecallRateEmptyRecall() (gas: 466399) TestAstariaV1Status:testV1StatusValidateInValid() (gas: 69799) -TestAstariaV1Status:testV1StatusValidateValid() (gas: 63252) +TestAstariaV1Status:testV1StatusValidateValid() (gas: 63230) TestCompoundInterest:testDecimalsTooHigh() (gas: 3340) TestCompoundInterest:testDecimalsTooLowZero() (gas: 3391) TestCompoundInterest:testInterestAccrual() (gas: 67017) @@ -47,17 +47,17 @@ TestCompoundInterest:testRateExceedsMaxRecallRate() (gas: 3319) TestCompoundInterest:testRateTooLowOne() (gas: 5105) TestCompoundInterest:testRateTooLowOneNonWADDecimal() (gas: 6412) TestCompoundInterest:testRateTooLowZero() (gas: 5126) -TestV1BorrowerEnforcer:testFuzzRateMethods((uint256,uint256,uint256),uint256) (runs: 200, μ: 1107, ~: 1107) +TestV1BorrowerEnforcer:testFuzzRateMethods((uint256,uint256,uint256),uint256) (runs: 10000, μ: 1218, ~: 1218) TestV1BorrowerEnforcer:testRevertLocateCurrentRateAndAmount() (gas: 61164) TestV1BorrowerEnforcer:testV1BorrowerEnforcerAmountOOB() (gas: 114125) -TestV1BorrowerEnforcer:testV1BorrowerEnforcerDebtBundlesNotSupported() (gas: 75113) +TestV1BorrowerEnforcer:testV1BorrowerEnforcerDebtBundlesNotSupported() (gas: 75091) TestV1BorrowerEnforcer:testV1BorrowerEnforcerEnd() (gas: 121194) TestV1BorrowerEnforcer:testV1BorrowerEnforcerHalfway() (gas: 116129) -TestV1BorrowerEnforcer:testV1BorrowerEnforcerRateGTCurrent() (gas: 95445) -TestV1BorrowerEnforcer:testV1BorrowerEnforcerRateLTCurrent() (gas: 102645) -TestV1BorrowerEnforcer:testV1BorrowerEnforcerStart() (gas: 99757) -TestV1LenderEnforcer:testV1LenderEnforcerAdditionalTransfers() (gas: 119520) +TestV1BorrowerEnforcer:testV1BorrowerEnforcerRateGTCurrent() (gas: 95423) +TestV1BorrowerEnforcer:testV1BorrowerEnforcerRateLTCurrent() (gas: 102623) +TestV1BorrowerEnforcer:testV1BorrowerEnforcerStart() (gas: 99735) +TestV1LenderEnforcer:testV1LenderEnforcerAdditionalTransfers() (gas: 119498) TestV1LenderEnforcer:testV1LenderEnforcerAmount() (gas: 118376) TestV1LenderEnforcer:testV1LenderEnforcerDebtBundlesNotSupported() (gas: 75149) -TestV1LenderEnforcer:testV1LenderEnforcerMatchIdentifier() (gas: 126134) -TestV1LenderEnforcer:testV1LenderEnforcerRate() (gas: 118310) \ No newline at end of file +TestV1LenderEnforcer:testV1LenderEnforcerMatchIdentifier() (gas: 126112) +TestV1LenderEnforcer:testV1LenderEnforcerRate() (gas: 118332) \ No newline at end of file diff --git a/.gitignore b/.gitignore index 5225768..0ae8528 100644 --- a/.gitignore +++ b/.gitignore @@ -18,3 +18,4 @@ out/ # Dotenv file .env +.turbo/ \ No newline at end of file diff --git a/src/scripts/Deploy.sol b/src/scripts/Deploy.sol index 20dda41..3f10289 100644 --- a/src/scripts/Deploy.sol +++ b/src/scripts/Deploy.sol @@ -21,21 +21,20 @@ contract Deploy is Script { Account public deployer; Account public liquidator; - TestERC20 public erc20; TestERC721 public erc721; -// Starport public SP = Starport(address(0x75573d1dff9e2efe784d089f882a5ea320dd96f0)); + // Starport public SP = Starport(address(0x75573d1dff9e2efe784d089f882a5ea320dd96f0)); Starport public SP; AstariaV1Pricing public v1Pricing; AstariaV1Status public v1Status; AstariaV1Settlement public v1Settlement; -// RacerOriginator public ftOriginator; -// RacerPricing public ftPricing; -// RacerHandler public fthandler; -// RacerMarginHook public ftMarginHook; -// RacerHelper public racerHelper; + // RacerOriginator public ftOriginator; + // RacerPricing public ftPricing; + // RacerHandler public fthandler; + // RacerMarginHook public ftMarginHook; + // RacerHelper public racerHelper; bool forkNet = false; @@ -108,7 +107,6 @@ contract Deploy is Script { vm.writeJson(output, "./out/contract-addresses.json"); } - function seedOriginationData() internal { uint256 liquidatorKey = vm.envUint("LIQUIDATOR_PRIVATE_KEY"); liquidator = Account({addr: vm.addr(liquidatorKey), key: liquidatorKey}); @@ -117,18 +115,13 @@ contract Deploy is Script { //non-liquidatable borrow - bytes memory pricingDetails = abi.encode(BasePricing.Details({ - rate: 0.0000001 ether, - carryRate: 0.0000001 ether, - decimals: 18 - })); + bytes memory pricingDetails = + abi.encode(BasePricing.Details({rate: 0.0000001 ether, carryRate: 0.0000001 ether, decimals: 18})); - borrow( - pricingDetails - ); + borrow(pricingDetails); //liquidatable borrow -// borrow(pricingDetails, 0x0, 0x1); + // borrow(pricingDetails, 0x0, 0x1); } struct FundingData { @@ -143,11 +136,18 @@ contract Deploy is Script { } function borrow(bytes memory pricingData) internal { + bytes memory statusData = abi.encode( + BaseRecall.Details({ + honeymoon: 7 days, + recallWindow: 7 days, + recallStakeDuration: 7 days, + recallMax: 10e18, + recallerRewardRatio: 0.5 ether + }) + ); - - bytes memory statusData = abi.encode(BaseRecall.Details({honeymoon: 7 days, recallWindow: 7 days, recallStakeDuration: 7 days, recallMax: 10e18, recallerRewardRatio: 0.5 ether})); - - bytes memory settlementData = abi.encode(DutchAuctionSettlement.Details({startingPrice: 100 ether, endingPrice: 100 wei, window: 7 days})); + bytes memory settlementData = + abi.encode(DutchAuctionSettlement.Details({startingPrice: 100 ether, endingPrice: 100 wei, window: 7 days})); Starport.Terms memory terms = Starport.Terms({ pricing: address(v1Pricing), @@ -159,12 +159,7 @@ contract Deploy is Script { }); SpentItem[] memory collateral = new SpentItem[](1); - collateral[0] = SpentItem({ - itemType: ItemType.ERC721, - token: address(erc721), - identifier: 1, - amount: 1 - }); + collateral[0] = SpentItem({itemType: ItemType.ERC721, token: address(erc721), identifier: 1, amount: 1}); //debt @@ -197,7 +192,6 @@ contract Deploy is Script { (uint8 v, bytes32 r, bytes32 s) = vm.sign(lender.key, hash); caveats.signature = abi.encodePacked(r, s, v); - // uint256 start; // start of the loan // address custodian; // where the collateral is being held // address borrower; // the borrower