Skip to content

Commit

Permalink
chore(src): adds licensing, import conventions, inline documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
justingreenberg committed Nov 18, 2023
1 parent f79d4c8 commit 3bff191
Show file tree
Hide file tree
Showing 23 changed files with 369 additions and 458 deletions.
94 changes: 47 additions & 47 deletions .gas-snapshot
Original file line number Diff line number Diff line change
@@ -1,22 +1,22 @@
IntegrationTestCaveats:testOriginateUnapprovedFulfiller() (gas: 369613)
IntegrationTestCaveats:testOriginateWBorrowerApproval() (gas: 323372)
IntegrationTestCaveats:testOriginateUnapprovedFulfiller() (gas: 369610)
IntegrationTestCaveats:testOriginateWBorrowerApproval() (gas: 323357)
IntegrationTestCaveats:testOriginateWCaveats() (gas: 297466)
IntegrationTestCaveats:testOriginateWCaveatsExpired() (gas: 177232)
IntegrationTestCaveats:testOriginateWCaveatsIncrementedNonce() (gas: 205798)
IntegrationTestCaveats:testOriginateWCaveatsInvalidSalt() (gas: 303717)
IntegrationTestCaveats:testOriginateWCaveatsInvalidSaltManual() (gas: 179719)
IntegrationTestCaveats:testOriginateWLenderApproval() (gas: 323448)
IntegrationTestCaveats:testOriginateWCaveatsExpired() (gas: 177229)
IntegrationTestCaveats:testOriginateWCaveatsIncrementedNonce() (gas: 205795)
IntegrationTestCaveats:testOriginateWCaveatsInvalidSalt() (gas: 303711)
IntegrationTestCaveats:testOriginateWCaveatsInvalidSaltManual() (gas: 179716)
IntegrationTestCaveats:testOriginateWLenderApproval() (gas: 323433)
IntegrationTestCaveats:testRefinanceAsLender() (gas: 1088462)
IntegrationTestCaveats:testRefinanceCaveatFailure() (gas: 437545)
IntegrationTestCaveats:testRefinanceLoanStartAtBlockTimestampInvalidLoan() (gas: 384815)
IntegrationTestCaveats:testRefinanceUnapprovedFulfiller() (gas: 495425)
IntegrationTestCaveats:testRefinanceWCaveatsInvalidSalt() (gas: 414216)
IntegrationTestCaveats:testRefinanceWLenderApproval() (gas: 437545)
ModuleTesting:testFixedTermDutchAuctionSettlement() (gas: 436187)
ModuleTesting:testFixedTermDutchAuctionSettlementGetSettlementAuctionExpired() (gas: 439054)
ModuleTesting:testFixedTermDutchAuctionSettlementNotValid() (gas: 435177)
ModuleTesting:testFixedTermDutchAuctionSettlementValid() (gas: 435998)
ModuleTesting:testModuleValidation() (gas: 1272828)
IntegrationTestCaveats:testRefinanceWLenderApproval() (gas: 437533)
ModuleTesting:testFixedTermDutchAuctionSettlement() (gas: 436184)
ModuleTesting:testFixedTermDutchAuctionSettlementGetSettlementAuctionExpired() (gas: 439051)
ModuleTesting:testFixedTermDutchAuctionSettlementNotValid() (gas: 435174)
ModuleTesting:testFixedTermDutchAuctionSettlementValid() (gas: 435995)
ModuleTesting:testModuleValidation() (gas: 1272825)
PausableNonReentrantImpl:test() (gas: 2442)
PausableNonReentrantImpl:testReentrancy() (gas: 2735)
TestBorrowerEnforcer:testBERevertAdditionalTransfers() (gas: 75662)
Expand All @@ -32,16 +32,16 @@ TestCustodian:testGenerateOrderInvalidPostRepayment() (gas: 173324)
TestCustodian:testGenerateOrderInvalidPostSettlement() (gas: 163179)
TestCustodian:testGenerateOrderRepay() (gas: 177479)
TestCustodian:testGenerateOrderRepayAsRepayApprovedBorrower() (gas: 193948)
TestCustodian:testGenerateOrderRepayERC1155AndERC20() (gas: 874180)
TestCustodian:testGenerateOrderRepayERC1155AndERC20HandlerAuthorized() (gas: 803573)
TestCustodian:testGenerateOrderRepayERC1155AndERC20() (gas: 874174)
TestCustodian:testGenerateOrderRepayERC1155AndERC20HandlerAuthorized() (gas: 803567)
TestCustodian:testGenerateOrderRepayInvalidHookAddress() (gas: 97601)
TestCustodian:testGenerateOrderRepayInvalidHookReturnType() (gas: 91984)
TestCustodian:testGenerateOrderRepayNotBorrower() (gas: 106839)
TestCustodian:testGenerateOrderSettlement() (gas: 154934)
TestCustodian:testGenerateOrderSettlementHandlerAuthorized() (gas: 160331)
TestCustodian:testGenerateOrderSettlementNoActiveLoan() (gas: 163342)
TestCustodian:testGenerateOrderSettlementUnauthorized() (gas: 101813)
TestCustodian:testGenerateOrdersWithLoanStartAtBlockTimestampInvalidLoan() (gas: 461053)
TestCustodian:testGenerateOrdersWithLoanStartAtBlockTimestampInvalidLoan() (gas: 461050)
TestCustodian:testGetBorrower() (gas: 78641)
TestCustodian:testInvalidAction() (gas: 173284)
TestCustodian:testInvalidActionRepayInActiveLoan() (gas: 130104)
Expand Down Expand Up @@ -69,30 +69,30 @@ TestLenderEnforcer:testLERevertInvalidLoanTerms() (gas: 80962)
TestLenderEnforcer:testLEValidLoanTerms() (gas: 71955)
TestLenderEnforcer:testLEValidLoanTermsAnyBorrower() (gas: 72087)
TestLenderEnforcer:testLEValidLoanTermsWithAdditionalTransfers() (gas: 73310)
TestLoanCombinations:testLoan20For721SimpleInterestDutchFixedRepay() (gas: 589926)
TestLoanCombinations:testLoan20for20SimpleInterestDutchFixedRepay() (gas: 597139)
TestLoanCombinations:testLoan721for20SimpleInterestDutchFixedRepay() (gas: 588220)
TestLoanCombinations:testLoanAstariaSettlementRepay() (gas: 578030)
TestNewLoan:testBuyNowPayLater() (gas: 2872541)
TestLoanCombinations:testLoan20For721SimpleInterestDutchFixedRepay() (gas: 589923)
TestLoanCombinations:testLoan20for20SimpleInterestDutchFixedRepay() (gas: 597136)
TestLoanCombinations:testLoan721for20SimpleInterestDutchFixedRepay() (gas: 588217)
TestLoanCombinations:testLoanAstariaSettlementRepay() (gas: 578027)
TestNewLoan:testBuyNowPayLater() (gas: 2872538)
TestNewLoan:testInvalidSenderBNPL() (gas: 1613720)
TestNewLoan:testInvalidUserDataHashBNPL() (gas: 1616299)
TestNewLoan:testNewLoanAs1271ProxyAccountSender() (gas: 864172)
TestNewLoan:testNewLoanAs1271ProxyAccountThirdPartyFiller() (gas: 873557)
TestNewLoan:testNewLoanERC721CollateralDefaultTerms2() (gas: 427351)
TestNewLoan:testNewLoanRefinance() (gas: 588882)
TestNewLoan:testNewLoanViaOriginatorBorrowerApprovalAndLenderApproval() (gas: 328439)
TestNewLoan:testNewLoanViaOriginatorLenderApproval() (gas: 384733)
TestNewLoan:testSettleLoan() (gas: 639410)
TestNewLoan:testNewLoanAs1271ProxyAccountThirdPartyFiller() (gas: 873554)
TestNewLoan:testNewLoanERC721CollateralDefaultTerms2() (gas: 427348)
TestNewLoan:testNewLoanRefinance() (gas: 588879)
TestNewLoan:testNewLoanViaOriginatorBorrowerApprovalAndLenderApproval() (gas: 328412)
TestNewLoan:testNewLoanViaOriginatorLenderApproval() (gas: 384718)
TestNewLoan:testSettleLoan() (gas: 639407)
TestPausableNonReentrant:testNotOwner() (gas: 21254)
TestPausableNonReentrant:testPauseAndUnpause() (gas: 22555)
TestPausableNonReentrant:testReentrancy() (gas: 15360)
TestPausableNonReentrant:testUnpauseWhenNotPaused() (gas: 12582)
TestRepayLoan:testRepayLoanApprovedRepayer() (gas: 661916)
TestRepayLoan:testRepayLoanBase() (gas: 598119)
TestRepayLoan:testRepayLoanGenerateOrderNotSeaport() (gas: 436382)
TestRepayLoan:testRepayLoanInSettlement() (gas: 583446)
TestRepayLoan:testRepayLoanInvalidRepayer() (gas: 601777)
TestRepayLoan:testRepayLoanThatDoesNotExist() (gas: 857426)
TestRepayLoan:testRepayLoanApprovedRepayer() (gas: 661913)
TestRepayLoan:testRepayLoanBase() (gas: 598116)
TestRepayLoan:testRepayLoanGenerateOrderNotSeaport() (gas: 436379)
TestRepayLoan:testRepayLoanInSettlement() (gas: 583443)
TestRepayLoan:testRepayLoanInvalidRepayer() (gas: 601774)
TestRepayLoan:testRepayLoanThatDoesNotExist() (gas: 857423)
TestSimpleInterestPricing:test_calculateInterest() (gas: 895930)
TestSimpleInterestPricing:test_getPaymentConsideration() (gas: 943140)
TestSimpleInterestPricing:test_getRefinanceConsideration() (gas: 933907)
Expand All @@ -105,9 +105,9 @@ TestStarport:testCannotIssueSameLoanTwice() (gas: 364572)
TestStarport:testCannotOriginateWhilePaused() (gas: 73457)
TestStarport:testCannotSettleInvalidLoan() (gas: 74915)
TestStarport:testCannotSettleUnlessValidCustodian() (gas: 70985)
TestStarport:testCaveatEnforcerRevert() (gas: 99214)
TestStarport:testDefaultFeeRake() (gas: 361421)
TestStarport:testDefaultFeeRakeExoticDebt() (gas: 370933)
TestStarport:testCaveatEnforcerRevert() (gas: 99211)
TestStarport:testDefaultFeeRake() (gas: 361418)
TestStarport:testDefaultFeeRakeExoticDebt() (gas: 370930)
TestStarport:testExoticDebtWithNoCaveatsNotAsBorrower() (gas: 377404)
TestStarport:testIncrementCaveatNonce() (gas: 35208)
TestStarport:testInitializedFlagSetProperly() (gas: 67393)
Expand All @@ -121,8 +121,8 @@ TestStarport:testInvalidTransferLengthDebt() (gas: 173436)
TestStarport:testInvalidateCaveatSalt() (gas: 33463)
TestStarport:testNonDefaultCustodianCustodyCallFails() (gas: 264447)
TestStarport:testNonDefaultCustodianCustodyCallSuccess() (gas: 290660)
TestStarport:testNonPayableFunctions() (gas: 112043)
TestStarport:testOverrideFeeRake() (gas: 357317)
TestStarport:testNonPayableFunctions() (gas: 112040)
TestStarport:testOverrideFeeRake() (gas: 357314)
TestStarport:testPause() (gas: 18093)
TestStarport:testRefinancePostRepaymentFails() (gas: 120803)
TestStarport:testTokenNoCodeCollateral() (gas: 148242)
Expand All @@ -132,13 +132,13 @@ TestStrategistOriginator:testEncodeWithAccountCounter() (gas: 12307)
TestStrategistOriginator:testGetStrategistData() (gas: 1489933)
TestStrategistOriginator:testIncrementCounterAsStrategist() (gas: 18676)
TestStrategistOriginator:testIncrementCounterNotAuthorized() (gas: 13401)
TestStrategistOriginator:testInvalidCollateral() (gas: 209797)
TestStrategistOriginator:testInvalidDeadline() (gas: 215512)
TestStrategistOriginator:testInvalidDebt() (gas: 211435)
TestStrategistOriginator:testInvalidDebtAmountAskingMoreThanOffered() (gas: 211796)
TestStrategistOriginator:testInvalidDebtAmountOfferingZero() (gas: 212095)
TestStrategistOriginator:testInvalidDebtAmountRequestingZero() (gas: 212049)
TestStrategistOriginator:testInvalidDebtLength() (gas: 210678)
TestStrategistOriginator:testInvalidOffer() (gas: 427302)
TestStrategistOriginator:testInvalidSigner() (gas: 214006)
TestStrategistOriginator:testInvalidCollateral() (gas: 209785)
TestStrategistOriginator:testInvalidDeadline() (gas: 215500)
TestStrategistOriginator:testInvalidDebt() (gas: 211423)
TestStrategistOriginator:testInvalidDebtAmountAskingMoreThanOffered() (gas: 211784)
TestStrategistOriginator:testInvalidDebtAmountOfferingZero() (gas: 212083)
TestStrategistOriginator:testInvalidDebtAmountRequestingZero() (gas: 212037)
TestStrategistOriginator:testInvalidDebtLength() (gas: 210666)
TestStrategistOriginator:testInvalidOffer() (gas: 427287)
TestStrategistOriginator:testInvalidSigner() (gas: 213994)
TestStrategistOriginator:testSetStrategist() (gas: 17796)
25 changes: 14 additions & 11 deletions src/BNPLHelper.sol
Original file line number Diff line number Diff line change
@@ -1,20 +1,23 @@
// SPDX-License-Identifier: BUSL-1.1
// Copyright (c) 2023 Astaria Labs

pragma solidity ^0.8.17;

import {Starport} from "starport-core/Starport.sol";
import {CaveatEnforcer} from "starport-core/enforcers/CaveatEnforcer.sol";
import {AdditionalTransfer} from "starport-core/lib/StarportLib.sol";

import {Seaport} from "seaport/contracts/Seaport.sol";
import {
OfferItem,
SpentItem,
ConsiderationItem,
AdvancedOrder,
OrderParameters,
ConsiderationItem,
CriteriaResolver,
Fulfillment,
ItemType,
Fulfillment
OfferItem,
OrderParameters,
SpentItem
} from "seaport-types/src/lib/ConsiderationStructs.sol";
import {AdditionalTransfer} from "starport-core/lib/StarportLib.sol";

import {Seaport} from "seaport/contracts/Seaport.sol";
import {Starport} from "./Starport.sol";
import {CaveatEnforcer} from "./enforcers/CaveatEnforcer.sol";

interface IVault {
function flashLoan(
Expand Down Expand Up @@ -54,9 +57,9 @@ contract BNPLHelper is IFlashLoanRecipient {
Fulfillment[] fulfillments;
}

error SenderNotVault();
error DoNotSendETH();
error InvalidUserDataProvided();
error SenderNotVault();

function makeFlashLoan(address[] calldata tokens, uint256[] calldata amounts, bytes calldata userData) external {
activeUserDataHash = keccak256(userData);
Expand Down
Loading

0 comments on commit 3bff191

Please sign in to comment.