Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: create2 improvement #92

Merged
merged 1 commit into from
Jan 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
274 changes: 137 additions & 137 deletions .gas-snapshot

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion lib/seaport
Submodule seaport updated 61 files
+22 −0 .github/workflows/docs.yml
+2 −2 .github/workflows/stale.yml
+2 −23 .github/workflows/test.yml
+284 −6 README.md
+127 −0 contracts/helpers/navigator/SeaportNavigator.sol
+20 −0 contracts/helpers/navigator/lib/CriteriaHelper.sol
+66 −12 contracts/helpers/navigator/lib/CriteriaHelperLib.sol
+18 −0 contracts/helpers/navigator/lib/ExecutionsHelper.sol
+18 −0 contracts/helpers/navigator/lib/FulfillmentsHelper.sol
+10 −0 contracts/helpers/navigator/lib/HelperInterface.sol
+194 −0 contracts/helpers/navigator/lib/HelperItemLib.sol
+43 −11 contracts/helpers/navigator/lib/MerkleLib.sol
+300 −0 contracts/helpers/navigator/lib/NavigatorAdvancedOrderLib.sol
+64 −0 contracts/helpers/navigator/lib/NavigatorContextLib.sol
+44 −0 contracts/helpers/navigator/lib/NavigatorCriteriaResolverLib.sol
+41 −0 contracts/helpers/navigator/lib/NavigatorDetailsLib.sol
+116 −0 contracts/helpers/navigator/lib/NavigatorExecutionsLib.sol
+51 −0 contracts/helpers/navigator/lib/NavigatorFulfillmentsLib.sol
+44 −0 contracts/helpers/navigator/lib/NavigatorRequestValidatorLib.sol
+36 −0 contracts/helpers/navigator/lib/NavigatorSeaportValidatorLib.sol
+434 −0 contracts/helpers/navigator/lib/NavigatorSuggestedActionLib.sol
+0 −0 contracts/helpers/navigator/lib/OrderAvailabilityLib.sol
+18 −0 contracts/helpers/navigator/lib/OrderDetailsHelper.sol
+25 −22 contracts/helpers/navigator/lib/OrderStructureLib.sol
+20 −0 contracts/helpers/navigator/lib/RequestValidator.sol
+43 −0 contracts/helpers/navigator/lib/SeaportNavigatorInterface.sol
+68 −55 contracts/helpers/navigator/lib/SeaportNavigatorTypes.sol
+18 −0 contracts/helpers/navigator/lib/SuggestedActionHelper.sol
+20 −0 contracts/helpers/navigator/lib/ValidatorHelper.sol
+0 −296 contracts/helpers/order-helper/SeaportOrderHelper.sol
+0 −718 contracts/helpers/order-helper/lib/OrderHelperLib.sol
+0 −184 contracts/helpers/order-helper/lib/SeaportOrderHelperInterface.sol
+15 −80 contracts/helpers/order-validator/SeaportValidator.sol
+722 −0 contracts/helpers/order-validator/lib/ReadOnlyOrderValidator.sol
+1 −17 contracts/helpers/order-validator/lib/SeaportValidatorInterface.sol
+10 −0 docs/AuditLink.md
+12 −3 docs/Deployment.md
+9 −0 docs/FunctionSignatures.md
+104 −71 docs/OrderValidator.md
+9 −0 docs/Overview.md
+10 −0 docs/SeaportDiagramLink.md
+9 −0 docs/SeaportDocumentation.md
+9 −0 docs/ZoneDocumentation.md
+1 −1 lib/seaport-sol
+1 −1 package.json
+92 −0 script/CallNavigator.s.sol
+217 −0 script/NavigatorDeployer.s.sol
+12 −5 test/foundry/FulfillOrderTest.t.sol
+0 −28 test/foundry/new/BaseOrderTest.sol
+9 −4 test/foundry/new/FuzzGenerators.t.sol
+669 −0 test/foundry/new/SeaportNavigator.t.sol
+61 −0 test/foundry/new/SeaportNavigatorTest.sol
+0 −669 test/foundry/new/SeaportOrderHelper.t.sol
+7 −37 test/foundry/new/SeaportValidator.t.sol
+33 −0 test/foundry/new/SeaportValidatorTest.sol
+90 −41 test/foundry/new/helpers/FuzzEngine.sol
+7 −7 test/foundry/new/helpers/FuzzEngineLib.sol
+7 −8 test/foundry/new/helpers/FuzzGenerators.sol
+12 −12 test/foundry/new/helpers/FuzzTestContextLib.sol
+2 −11 test/foundry/offerers/ContractOffersNativeTokenOfferItems.t.sol
+25 −32 yarn.lock
2 changes: 0 additions & 2 deletions src/Starport.sol
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,6 @@ contract Starport is PausableNonReentrant {

Stargate public immutable SG;
uint256 public immutable chainId;
address public immutable defaultCustodian;
bytes32 public immutable DEFAULT_CUSTODIAN_CODE_HASH;
bytes32 public immutable CACHED_DOMAIN_SEPARATOR;

Expand Down Expand Up @@ -173,7 +172,6 @@ contract Starport is PausableNonReentrant {
assembly ("memory-safe") {
defaultCustodianCodeHash := extcodehash(custodian)
}
defaultCustodian = custodian;
DEFAULT_CUSTODIAN_CODE_HASH = defaultCustodianCodeHash;
_initializeOwner(msg.sender);
}
Expand Down
2 changes: 1 addition & 1 deletion test/StarportTest.sol
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ contract StarportTest is BaseOrderTest, Stargate {
fulfiller = makeAndAllocateAccount("fulfiller");

SP = new Starport(address(consideration), Stargate(address(this)));
custodian = Custodian(payable(SP.defaultCustodian()));
custodian = new Custodian(SP, address(consideration));
SO = new StrategistOriginator(SP, strategist.addr, 1e16, address(this));
pricing = new SimpleInterestPricing(SP);
settlement = new FixedTermDutchAuctionSettlement(SP);
Expand Down
2 changes: 1 addition & 1 deletion test/fuzz-testing/TestFuzzStarport.sol
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,7 @@ contract TestFuzzStarport is StarportTest, Bound, DeepEq {

loan.debt = debt;
loan.borrower = borrower.addr;
loan.custodian = SP.defaultCustodian();
loan.custodian = address(custodian);
loan.issuer = lender.addr;
return loan;
}
Expand Down
8 changes: 4 additions & 4 deletions test/integration-testing/TestNewLoan.sol
Original file line number Diff line number Diff line change
Expand Up @@ -277,7 +277,7 @@ contract TestNewLoan is StarportTest {
Starport.Loan memory loan = generateDefaultLoanTerms();

StrategistOriginator.Details memory newLoanDetails = StrategistOriginator.Details({
custodian: SP.defaultCustodian(),
custodian: address(custodian),
issuer: lender.addr,
deadline: block.number + 8,
offer: StrategistOriginator.Offer({
Expand Down Expand Up @@ -311,14 +311,14 @@ contract TestNewLoan is StarportTest {
);
assert(erc20s[0].balanceOf(borrower.addr) == borrowerBalanceBefore + loan.debt[0].amount);
assert(erc20s[0].balanceOf(lender.addr) == lenderBalanceBefore - loan.debt[0].amount);
assert(erc721s[0].ownerOf(loan.collateral[0].identifier) == address(SP.defaultCustodian()));
assert(erc721s[0].ownerOf(loan.collateral[0].identifier) == address(address(custodian)));
}

function testNewLoanViaOriginatorBorrowerApprovalAndLenderApproval() public {
Starport.Loan memory loan = generateDefaultLoanTerms();

StrategistOriginator.Details memory newLoanDetails = StrategistOriginator.Details({
custodian: SP.defaultCustodian(),
custodian: address(custodian),
issuer: lender.addr,
deadline: block.number + 8,
offer: StrategistOriginator.Offer({
Expand Down Expand Up @@ -354,7 +354,7 @@ contract TestNewLoan is StarportTest {
);
assert(erc20s[0].balanceOf(borrower.addr) == borrowerBalanceBefore + loan.debt[0].amount);
assert(erc20s[0].balanceOf(lender.addr) == lenderBalanceBefore - loan.debt[0].amount);
assert(erc721s[0].ownerOf(loan.collateral[0].identifier) == address(SP.defaultCustodian()));
assert(erc721s[0].ownerOf(loan.collateral[0].identifier) == address(address(custodian)));
}

event log_receivedItems(ReceivedItem[] items);
Expand Down
18 changes: 9 additions & 9 deletions test/unit-testing/TestStrategistOriginator.sol
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ contract TestStrategistOriginator is StarportTest, DeepEq {
Starport.Loan memory loan = generateDefaultLoanTerms();

StrategistOriginator.Details memory newLoanDetails = StrategistOriginator.Details({
custodian: SP.defaultCustodian(),
custodian: address(custodian),
issuer: lender.addr,
deadline: block.timestamp + 8,
offer: StrategistOriginator.Offer({
Expand Down Expand Up @@ -108,7 +108,7 @@ contract TestStrategistOriginator is StarportTest, DeepEq {
Starport.Loan memory loan = generateDefaultLoanTerms();

StrategistOriginator.Details memory newLoanDetails = StrategistOriginator.Details({
custodian: SP.defaultCustodian(),
custodian: address(custodian),
issuer: lender.addr,
deadline: block.timestamp + 8,
offer: StrategistOriginator.Offer({
Expand Down Expand Up @@ -151,7 +151,7 @@ contract TestStrategistOriginator is StarportTest, DeepEq {
Starport.Loan memory loan = generateDefaultLoanTerms();

StrategistOriginator.Details memory newLoanDetails = StrategistOriginator.Details({
custodian: SP.defaultCustodian(),
custodian: address(custodian),
issuer: lender.addr,
deadline: block.timestamp + 8,
offer: StrategistOriginator.Offer({
Expand Down Expand Up @@ -194,7 +194,7 @@ contract TestStrategistOriginator is StarportTest, DeepEq {
Starport.Loan memory loan = generateDefaultLoanTerms();

StrategistOriginator.Details memory newLoanDetails = StrategistOriginator.Details({
custodian: SP.defaultCustodian(),
custodian: address(custodian),
issuer: lender.addr,
deadline: block.timestamp + 8,
offer: StrategistOriginator.Offer({
Expand Down Expand Up @@ -238,7 +238,7 @@ contract TestStrategistOriginator is StarportTest, DeepEq {
loan.debt[0].amount = 0;

StrategistOriginator.Details memory newLoanDetails = StrategistOriginator.Details({
custodian: SP.defaultCustodian(),
custodian: address(custodian),
issuer: lender.addr,
deadline: block.timestamp + 8,
offer: StrategistOriginator.Offer({
Expand Down Expand Up @@ -280,7 +280,7 @@ contract TestStrategistOriginator is StarportTest, DeepEq {
Starport.Loan memory loan = generateDefaultLoanTerms();

StrategistOriginator.Details memory newLoanDetails = StrategistOriginator.Details({
custodian: SP.defaultCustodian(),
custodian: address(custodian),
issuer: lender.addr,
deadline: block.timestamp + 8,
offer: StrategistOriginator.Offer({
Expand Down Expand Up @@ -322,7 +322,7 @@ contract TestStrategistOriginator is StarportTest, DeepEq {
Starport.Loan memory loan = generateDefaultLoanTerms();

StrategistOriginator.Details memory newLoanDetails = StrategistOriginator.Details({
custodian: SP.defaultCustodian(),
custodian: address(custodian),
issuer: lender.addr,
deadline: block.timestamp + 8,
offer: StrategistOriginator.Offer({
Expand Down Expand Up @@ -366,7 +366,7 @@ contract TestStrategistOriginator is StarportTest, DeepEq {
Starport.Loan memory loan = generateDefaultLoanTerms();

StrategistOriginator.Details memory newLoanDetails = StrategistOriginator.Details({
custodian: SP.defaultCustodian(),
custodian: address(custodian),
issuer: lender.addr,
deadline: block.timestamp + 8,
offer: StrategistOriginator.Offer({
Expand Down Expand Up @@ -410,7 +410,7 @@ contract TestStrategistOriginator is StarportTest, DeepEq {
Starport.Loan memory loan = generateDefaultLoanTerms();

StrategistOriginator.Details memory newLoanDetails = StrategistOriginator.Details({
custodian: SP.defaultCustodian(),
custodian: address(custodian),
issuer: lender.addr,
deadline: block.timestamp + 8,
offer: StrategistOriginator.Offer({
Expand Down