Skip to content

Commit

Permalink
Feat/divorce v1 (#53)
Browse files Browse the repository at this point in the history
* remove v1 from the core repo

* chore: update snapshot with v1 removal

* remove v1 enforcer

* chore: fmt

* cleanup imports, remove getAction from starportlib
  • Loading branch information
androolloyd authored Nov 5, 2023
1 parent 47f1613 commit 7709d6c
Show file tree
Hide file tree
Showing 18 changed files with 15 additions and 2,070 deletions.
39 changes: 2 additions & 37 deletions .gas-snapshot
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
DiffFuzzTestStarportLib:testSpentToReceived((uint8,address,uint256,uint256)[]) (runs: 256, μ: 880612, ~: 882686)
DiffFuzzTestStarportLib:testUnboundSpentToReceived((uint8,address,uint256,uint256)[]) (runs: 256, μ: 232899, ~: 237832)
DiffFuzzTestStarportLib:testSpentToReceived((uint8,address,uint256,uint256)[]) (runs: 256, μ: 880533, ~: 883411)
DiffFuzzTestStarportLib:testUnboundSpentToReceived((uint8,address,uint256,uint256)[]) (runs: 256, μ: 232912, ~: 237832)
IntegrationTestCaveats:testOriginateUnapprovedFulfiller() (gas: 341166)
IntegrationTestCaveats:testOriginateWBorrowerApproval() (gas: 298037)
IntegrationTestCaveats:testOriginateWCaveats() (gas: 272104)
Expand All @@ -15,45 +15,10 @@ IntegrationTestCaveats:testRefinanceWCaveatsInvalidSalt() (gas: 386773)
IntegrationTestCaveats:testRefinanceWLenderApproval() (gas: 411275)
PausableNonReentrantImpl:test() (gas: 2442)
PausableNonReentrantImpl:testReentrancy() (gas: 2735)
TestAstariaV1Loan:testNewLoanERC721CollateralDefaultTermsRecallBase() (gas: 1009322)
TestAstariaV1Loan:testNewLoanERC721CollateralDefaultTermsRecallLender() (gas: 711557)
TestAstariaV1Loan:testNewLoanERC721CollateralDefaultTermsRecallLiquidation() (gas: 1382121)
TestAstariaV1Pricing:testGetRefiannceConsiderationValidEqualRate() (gas: 143045)
TestAstariaV1Pricing:testGetRefiannceConsiderationValidHigherRate() (gas: 155206)
TestAstariaV1Pricing:testGetRefiannceConsiderationValidLowerRate() (gas: 150235)
TestAstariaV1Pricing:testGetRefinanceConsiderationAsBorrowerZeroRate() (gas: 81159)
TestAstariaV1Pricing:testGetRefinanceConsiderationInsufficientRefinance() (gas: 107916)
TestAstariaV1Pricing:testGetRefinanceConsiderationInvalidRefinance() (gas: 88217)
TestAstariaV1Pricing:testGetRefinanceConsiderationZeroRate() (gas: 135663)
TestAstariaV1Settlement:testGetAuctionStart() (gas: 433743)
TestAstariaV1Settlement:testGetAuctionStartNotStarted() (gas: 433316)
TestAstariaV1Settlement:testGetCurrentAuctionPrice() (gas: 448527)
TestAstariaV1Settlement:testGetCurrentAuctionPriceNoAuction() (gas: 436880)
TestAstariaV1Settlement:testGetSettlementDutchAuctionSettlementAbove() (gas: 490449)
TestAstariaV1Settlement:testGetSettlementFailedDutchAuction() (gas: 448917)
TestAstariaV1Settlement:testGetSettlementLoanNotRecalled() (gas: 439423)
TestAstariaV1Settlement:testV1SettlementHandlerValidate() (gas: 419993)
TestAstariaV1Settlement:testV1SettlementHandlerValidateInvalidHandler() (gas: 420117)
TestAstariaV1Status:testCannotRecallTwice() (gas: 545599)
TestAstariaV1Status:testCannotWithdrawLoanHasNotBeenRefinanced() (gas: 428440)
TestAstariaV1Status:testCannotWithdrawWithdrawDoesNotExist() (gas: 434857)
TestAstariaV1Status:testGenerateRecallConsideration() (gas: 477168)
TestAstariaV1Status:testInvalidRecallInvalidStakeType() (gas: 507644)
TestAstariaV1Status:testInvalidRecallLoanDoesNotExist() (gas: 475937)
TestAstariaV1Status:testIsActive() (gas: 432690)
TestAstariaV1Status:testIsRecalledInsideWindow() (gas: 559633)
TestAstariaV1Status:testIsRecalledOutsideWindow() (gas: 557534)
TestAstariaV1Status:testRecallAndRefinanceInsideWindow() (gas: 713941)
TestAstariaV1Status:testRecallRateActiveRecall() (gas: 545388)
TestAstariaV1Status:testRecallRateEmptyRecall() (gas: 430233)
TestBorrowerEnforcer:testBERevertAdditionalTransfers() (gas: 73195)
TestBorrowerEnforcer:testBERevertInvalidLoanTerms() (gas: 78316)
TestBorrowerEnforcer:testBEValidLoanTerms() (gas: 69518)
TestBorrowerEnforcer:testBEValidLoanTermsAnyIssuer() (gas: 69581)
TestCompoundInterest:testAmountMax() (gas: 65767)
TestCompoundInterest:testRateMax() (gas: 68106)
TestCompoundInterest:testRateTooLowOne() (gas: 73157)
TestCompoundInterest:testRateTooLowZero() (gas: 68419)
TestCustodian:testCannotLazyMintTwice() (gas: 76753)
TestCustodian:testCannotMintInvalidLoanInvalidCustodian() (gas: 66884)
TestCustodian:testCannotMintInvalidLoanValidCustodian() (gas: 72556)
Expand Down
10 changes: 5 additions & 5 deletions src/Custodian.sol
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,11 @@ import {ConsiderationInterface} from "seaport-types/src/interfaces/Consideration
import {ContractOffererInterface} from "seaport-types/src/interfaces/ContractOffererInterface.sol";

import {FixedPointMathLib} from "solady/src/utils/FixedPointMathLib.sol";
import {Status} from "starport-core/status/Status.sol";
import {Settlement} from "starport-core/settlement/Settlement.sol";
import {Pricing} from "starport-core/pricing/Pricing.sol";
import {Starport} from "starport-core/Starport.sol";
import {StarportLib, Actions} from "starport-core/lib/StarportLib.sol";
import {Status} from "./status/Status.sol";
import {Settlement} from "./settlement/Settlement.sol";
import {Pricing} from "./pricing/Pricing.sol";
import {Starport} from "./Starport.sol";
import {StarportLib, Actions} from "./lib/StarportLib.sol";

contract Custodian is ERC721, ContractOffererInterface {
using {StarportLib.getId} for Starport.Loan;
Expand Down
13 changes: 6 additions & 7 deletions src/Starport.sol
Original file line number Diff line number Diff line change
Expand Up @@ -27,16 +27,15 @@ import {ItemType, OfferItem, Schema, SpentItem, ReceivedItem} from "seaport-type

import {ConsiderationInterface} from "seaport-types/src/interfaces/ConsiderationInterface.sol";
import {FixedPointMathLib} from "solady/src/utils/FixedPointMathLib.sol";
import {Pricing} from "starport-core/pricing/Pricing.sol";
import {StarportLib, Actions} from "starport-core/lib/StarportLib.sol";
import {AdditionalTransfer} from "starport-core/lib/StarportLib.sol";
import {Custodian} from "starport-core/Custodian.sol";
import {Pricing} from "./pricing/Pricing.sol";
import {StarportLib, AdditionalTransfer} from "./lib/StarportLib.sol";
import {Custodian} from "./Custodian.sol";
import {SignatureCheckerLib} from "solady/src/utils/SignatureCheckerLib.sol";
import {CaveatEnforcer} from "starport-core/enforcers/CaveatEnforcer.sol";
import {CaveatEnforcer} from "./enforcers/CaveatEnforcer.sol";
import {Ownable} from "solady/src/auth/Ownable.sol";
import {SafeTransferLib} from "solady/src/utils/SafeTransferLib.sol";
import {PausableNonReentrant} from "starport-core/lib/PausableNonReentrant.sol";
import {Settlement} from "starport-core/settlement/Settlement.sol";
import {PausableNonReentrant} from "./lib/PausableNonReentrant.sol";
import {Settlement} from "./settlement/Settlement.sol";

contract Starport is ERC721, PausableNonReentrant {
using FixedPointMathLib for uint256;
Expand Down
50 changes: 0 additions & 50 deletions src/enforcers/AstariaV1LenderEnforcer.sol

This file was deleted.

6 changes: 0 additions & 6 deletions src/lib/StarportLib.sol
Original file line number Diff line number Diff line change
Expand Up @@ -42,12 +42,6 @@ library StarportLib {
uint256 internal constant CUSTODIAN_WORD_OFFSET = 0x40;
int256 constant NATURAL_NUMBER_SIGNED_WAD = int256(2718281828459045235);

function getAction(bytes calldata data) internal pure returns (Actions action) {
assembly {
action := calldataload(data.offset)
}
}

function getCustodian(bytes calldata data) internal pure returns (address custodian) {
assembly {
custodian := calldataload(add(data.offset, CUSTODIAN_WORD_OFFSET))
Expand Down
71 changes: 0 additions & 71 deletions src/pricing/AstariaV1Pricing.sol

This file was deleted.

17 changes: 0 additions & 17 deletions src/pricing/CompoundInterestPricing.sol

This file was deleted.

Loading

0 comments on commit 7709d6c

Please sign in to comment.