Exhibit





EXHIBIT 10.4



Execution Version
THIRD AMENDMENT TO
AMENDED AND RESTATED CREDIT AGREEMENT


THIS  THIRD  AMENDMENT  TO  AMENDED  AND  RESTATED CREDIT AGREEMENT, dated as of December 21, 2018 (this “Amendment”), to the Amended and Restated Credit Agreement, dated as of September 30, 2016 (as previously amended, restated, amended and restated, or otherwise modified, the “Credit Agreement”), and entered into by, among others, SemGroup Corporation, as the Borrower (the “Borrower”), the lenders party thereto (the “Lenders”) and Wells Fargo Bank, National Association, as administrative agent (in such capacity, the “Administrative Agent”) and collateral agent for the Lenders. Capitalized terms used herein and not otherwise defined herein shall have the meanings ascribed to them in the Credit Agreement.


W I T N E S S E T H:


WHEREAS, the Borrower desires to amend certain provisions of the Credit Agreement as specified below (the “Specified Amendments”);


WHEREAS, the Loan Parties have requested that the Lenders agree to amend certain provisions of the Credit Agreement in order to permit each of the Specified Amendments; and


WHEREAS, subject to certain conditions, the Lenders party hereto (who shall constitute the Required Lenders) are willing to agree to such amendments.


NOW, THEREFORE, in consideration of the promises and covenants contained herein and for other good and valuable consideration, the receipt and sufficiency of which are hereby acknowledged, the parties hereto, intending to be legally bound hereby, agree as follows:


Section 1.    Amendments to the Credit Agreement
(a)Section 1.01 of the Credit Agreement is hereby amended by inserting the following terms therein in appropriate alphabetical order:


““Meridian Acquisition” shall mean the acquisition of Meritage Midstream ULC by SemCanada.


“Meridian Acquisition Date” shall mean the effective date of the Meridian Acquisition.


“Meridian Contribution” shall mean the contribution of SemCAMS by SemCanada II to SemCanada on or after the Third Amendment Effective Date.


“SemCanada II” shall mean SemCanada II, L.P., an Oklahoma limited partnership.
“SemCanada” shall mean SemCanada ULC, an Alberta unlimited liability corporation, or such other Person formed for purposes of the consummation of the Meridian Acquisition.


“Third Amendment Effective Date” shall mean December 21, 2018.””


(b)Section 1.01 of the Credit Agreement is hereby amended by amending and restating the proviso appearing in the definition of Permitted Deductions as follows:


“provided, that Permitted Deductions shall not exceed (i) on any date of determination of Consolidated Net Debt from the Meridian Acquisition Date to the date that is the first anniversary of the Meridian Acquisition Date, all cash and Permitted Investments of the Borrower and its Restricted Subsidiaries so long as on such date of determination, there are no outstanding Loans and (ii) for all other purposes, U.S.$50.0 million.”


(c)Section 1.01 of the Credit Agreement is hereby amended by amending and restating clause (iv) of the definition of Unrestricted Subsidiary as follows: “(x) SemCanada II and its subsidiaries; provided, that if the Meridian Acquisition shall not have been consummated on or prior to the earliest of (i) the date that is six months from the Third Amendment Effective Date, (ii) any “outside date” in the definitive documentation entered into in connection with the Meridian Acquisition and (iii) the date on which the Borrower in good faith determines that the Meridian Acquisition shall not be consummated, SemCanada 








EXHIBIT 10.4



II and its subsidiaries shall be deemed to be Restricted Subsidiaries automatically and without further notice or action within five (5) Business Days after the occurrence of such earliest date, and (y) beginning on the Meridian Acquisition Date, to the extent created for purposes of an initial public offering of SemCanada II or any of its subsidiaries, any other Subsidiary of SemGroup that is solely formed for such purpose, and”


(d)Section 2.10 of the Credit Agreement is hereby amended by amending and restating clause (b) thereof in its entirety as follows:


“(b) (i) All optional prepayments of the Revolving Facility Loans pursuant to Section 2.11(a) or mandatory prepayments of the Revolving Facility Loans pursuant to Section 2.11(b), Section 2.11(c), Section 2.11(h), Section 2.11(i) and Section 2.11(j) shall be applied ratably among the Lenders, and any mandatory payments or prepayments pursuant to Section 2.11(f) shall be applied as set forth in Section 9.23.”


(e)Section 2.11 of the Credit Agreement is hereby amended by amending and restating clauses (h) and (i) thereof in their entirety as follows:


“(h) In the case of the Meridian Contribution and the Meridian Acquisition, SemCanada II, SemGroup Netherlands B.V., the Borrower or any other Restricted Subsidiary shall apply all cash proceeds received by it (net of (i) attorneys’ fees, accountants’ fees, advisors’ fees, consultants’ fees, investment banking fees, sales commissions, survey costs, title insurance premiums, and related search and recording charges, transfer taxes, deed or mortgage recording taxes and required payments of other obligations relating to the applicable asset (other than pursuant hereto) and any cash reserve for adjustment in respect of the sale price of such asset established in accordance with GAAP, including without  limitation liabilities related to environmental matters or against any indemnification obligations associated with such transaction and (ii) Taxes paid or payable as a result thereof) in connection with such Meridian Contribution and the Meridian Acquisition upon (and in any event within three (3) Business Days of) receipt thereof to prepay the Borrowings in accordance with Section 2.10(b).


(i) From and after the date that the Meridian Contribution is consummated, SemCanada II, SemGroup Netherlands B.V., the Borrower or any other Restricted Subsidiary shall apply all cash proceeds received by it (net of (i) attorneys’ fees, accountants’ fees, advisors’ fees, consultants’ fees, investment banking fees, sales commissions, survey costs, title insurance premiums, and related search and recording charges, transfer taxes, deed or mortgage recording taxes and required payments of other obligations relating to the applicable asset (other than pursuant hereto) and any cash reserve for adjustment in respect of the sale price of such asset established in accordance with GAAP, including without  limitation liabilities related to environmental matters or against any indemnification obligations associated with such transaction and (ii) Taxes paid or payable as a result thereof) upon (and in any event within three (3) Business Days of) receipt thereof to prepay the Borrowings in accordance with Section 2.10(b) from any issuance, sale, transfer or other disposition (including, without limitation, through an initial public offering) of the Equity Interests of any Person that is owned, directly or indirectly, by the Borrower and its Restricted Subsidiaries and owns, directly or indirectly, any of the property and assets owned by SemCAMS as of the Third Amendment Effective Date.


(f)Section 6.04 of the Credit Agreement is hereby amended by (i) deleting  the word “and” appearing at the end of clause (t) thereof, (ii) deleting the “.” appearing at the end of clause (u) thereof and replacing it with a “;” in lieu thereof and (iii) adding new clauses (v)  and (w) as follows:


“(v) on or after the Third Amendment Effective Date,  the  Meridian  Contribution; provided that the net cash proceeds thereof are applied in accordance with Section 2.11(h); provided, further, that if the Meridian Acquisition shall not have been consummated on or prior to the earliest of (i) the date that is six months from the Third Amendment Effective Date, (ii) any “outside date” in the definitive documentation entered into in connection with the Meridian Acquisition and (iii) the date on which the Borrower in good faith determines that the Meridian Acquisition shall not be consummated, this clause (v) shall no longer be effective; and


(w)   on or after the Meridian Acquisition Date, investments in the form of   Equity Interests received in connection with the initial public offering referred to below  in  any parent  entity of  SemCanada  II formed  by the  Borrower  after the Third Amendment Effective Date solely for purposes of consummating an initial public offering of SemCanada II or any of its subsidiaries.”










EXHIBIT 10.4



(g)    Section 6.05 of the Credit Agreement is hereby amended by (i) deleting the word “and” appearing at the end of clause (o) thereof, (ii) deleting the “.” appearing at the end of clause (p) thereof and replacing it with a “; and” in lieu thereof and (iii) adding a new clause (q) as follows:


“(q)    on or after the Meridian Acquisition Date, the initial public offering of any parent entity of SemCanada II formed solely for the purposes of consummating such initial public offer; provided that any net cash proceeds thereof received by the Borrower or any Restricted Subsidiary thereof are applied in accordance with Section 2.11(i).”


Section 2.    Conditions Precedent to the Effectiveness of this Amendment
This Amendment shall become effective as of the date on which each of the following conditions precedent shall have been satisfied (the date of satisfaction of such conditions being referred to herein as the “Third Amendment Effective Date”):


(a)the Administrative Agent shall have received this Amendment, duly executed by each of the Borrower, the Guarantors and the Required Lenders;


(b)the representations and warranties set forth in Article III of the Credit Agreement shall be true and correct in all material respects (except that such materiality qualifier shall not be applicable to any representations and warranties that already are qualified or modified by materiality in the text thereof) on and as of the Third Amendment Effective Date, to the same extent as though made on and as of such date, except to the extent such representations and warranties expressly relate to an earlier date (in which case such representations and warranties shall be true and correct in  all material respects as of such earlier date (except that such materiality qualifier shall not be applicable to any representations and warranties that already are qualified or modified by materiality in the text thereof));


(c)as of the Third Amendment Effective Date, no Event of Default or Default shall have occurred and be continuing;


(d)the Borrower shall have paid all fees and expenses payable to the Lenders and the Administrative Agent hereunder or under any other Loan Document; and


(e)the Borrower shall have obtained all material consents necessary or advisable in connection with the transactions contemplated by this Amendment.


Section 3.    Acknowledgment and Consent.


(a)Each Guarantor acknowledges and agrees that any of the Loan Documents to which it is a party or otherwise bound shall continue in full force and effect and that all of its obligations thereunder shall be valid and enforceable and shall not be impaired or limited by the execution or effectiveness of this Amendment.


(b)Each Guarantor acknowledges and agrees that (i) notwithstanding the conditions to effectiveness set forth in this Amendment, such Guarantor is not required by the terms of the Credit Agreement or any other Loan Document to consent to the amendments to the Credit Agreement effected pursuant to this Amendment and (ii) nothing in the Credit Agreement, this Amendment or any other Loan Document shall be deemed to require the consent of such Guarantor to any future amendments to the Credit Agreement.


Section 4.    Reference to and Effect on the Loan Documents


(a)This Amendment is a Loan Document executed pursuant to the Credit Agreement and shall be construed, administered and applied in accordance with the terms and provisions thereof. The Borrower agrees to pay any applicable costs and expenses incurred in connection with this Amendment in accordance with the terms set forth in the Credit Agreement, including Section 9.05 thereof.


(b)Except as specifically amended above, all of the terms and provisions of the Credit Agreement and all other Loan Documents are and shall remain in full force and effect and are hereby ratified and confirmed.








EXHIBIT 10.4





(c)The execution, delivery, effectiveness and performance of this Amendment shall not operate as a waiver of any right, power or remedy of the Lenders, the Borrower or the Administrative Agent under any of the Loan Documents, nor constitute a waiver of any other provision of any of the Loan Documents or for any purpose.


(d)Each of the Loan Documents, including the Credit Agreement, and any and all other agreements, documents or instruments now or hereafter executed and/or delivered pursuant to the terms hereof or pursuant to the terms of the Credit Agreement as amended  hereby, are hereby amended so that any reference in such Loan Documents to the Credit Agreement, whether direct or indirect, shall mean a reference to the Credit Agreement as amended hereby.


Section 5.    Execution in Counterparts
This Amendment may be executed in any number of counterparts, each of which when so executed and delivered shall be deemed an original, but all such counterparts together shall constitute but one and the same instrument. Delivery of an executed counterpart  by telecopy or other electronic transmission shall be effective as delivery of a manually executed counterpart of this Amendment.


Section 6.    Governing Law
THIS AMENDMENT SHALL BE CONSTRUED IN ACCORDANCE WITH, AND GOVERNED BY THE LAWS OF, THE STATE OF NEW YORK.
Section 7.    Headings
Section and Subsection headings herein are included herein for convenience of reference only and shall not constitute a part hereof for any other purpose or be given any substantive effect.


Section 8.    Notices
All communications and notices hereunder shall be given as provided in the  Credit Agreement.


Section 9.    Severability
The illegality or unenforceability of any provision of this Amendment or any instrument or agreement required hereunder shall not in any way affect or impair the legality or enforceability of the remaining provisions of this Amendment or any instrument or agreement required hereunder.


Section 10.    Successors
The terms of this Amendment shall be binding upon, and shall inure to the benefit of, the parties hereto and their respective successors and assigns.


Section 11.    Waiver of Jury Trial
EACH PARTY HERETO HEREBY WAIVES, TO THE FULLEST EXTENT PERMITTED BY APPLICABLE LAW, ANY RIGHT IT MAY HAVE TO A TRIAL BY JURY IN RESPECT OF ANY LITIGATION DIRECTLY OR INDIRECTLY ARISING OUT OF, UNDER OR IN CONNECTION WITH THIS AMENDMENT. EACH PARTY HERETO (i) CERTIFIES THAT NO REPRESENTATIVE, AGENT OR ATTORNEY OF ANY OTHER PARTY HAS REPRESENTED, EXPRESSLY OR OTHERWISE, THAT SUCH OTHER PARTY WOULD NOT, IN THE EVENT OF LITIGATION, SEEK TO ENFORCE THE FOREGOING WAIVER AND (ii) ACKNOWLEDGES THAT IT AND THE OTHER  PARTIES HERETO HAVE BEEN INDUCED TO ENTER INTO THIS AMENDMENT BY, AMONG OTHER THINGS, THE MUTUAL WAIVERS AND CERTIFICATIONS IN THIS SECTION 11.








EXHIBIT 10.4





Section 12.    Jurisdiction
Each of the parties to this Amendment hereby irrevocably and unconditionally submits, for itself and its property, to the non-exclusive jurisdiction of any New York State court or federal court of the United States of America sitting in New York County, New York, and any appellate court from any thereof, in any action or proceeding arising out of or relating to this Amendment or the transactions contemplated hereby, or for recognition or enforcement of any judgment, and each of the parties hereto hereby irrevocably and unconditionally agrees that all claims in respect of any such action or proceeding may be heard and determined in such New York State or, to the extent permitted by law, in such federal court.


[SIGNATURE PAGES FOLLOW]








EXHIBIT 10.4



IN WITNESS WHEREOF, the parties hereto have caused this Amendment to be executed by their respective officers thereunto duly authorized, as of the date first written above.
SEMGROUP CORPORATION


By:  /s/ Robert N. Fitzgerald
Name:  Robert N. Fitzgerald
Title:    Senior Vice President and Chief Financial Officer




Subsidiary Guarantors 
SEMGAS, L.P. 
SEMMATERIALS, L.P.
By: SEMOPERATING G.P., L.L.C., each such
Guarantor's general partner


By:  /s/ Robert N. Fitzgerald
Name:  Robert N. Fitzgerald
Title:    Senior Vice President and Chief Financial Officer




SEMOPERATING G.P., L.L.C. SEMDEVELOPMENT, L.L.C. 
SEMCRUDE PIPELINE, L.L.C.
ROSE ROCK MIDSTREAM OPERATING, LLC
ROSE ROCK FINANCE CORPORATION 
ROSE ROCK MIDSTREAM ENERGY GP, LLC
ROSE ROCK MIDSTREAM FIELD SERVICES, LLC


By:  /s/ Robert N. Fitzgerald
Name:  Robert N. Fitzgerald
Title:    Senior Vice President and Chief Financial Officer












































[Third Amendment Signature Page]








EXHIBIT 10.4





ROSE ROCK MIDSTREAM CRUDE, L.P.
By: ROSE ROCK MIDSTREAM ENERGY GP,
LLC, as general partner


By:  /s/ Robert N. Fitzgerald
Name:  Robert N. Fitzgerald
Title:    Senior Vice President and Chief Financial Officer


SEMGROUP EUROPE HOLDING, L.L.C. 
SEMMEXICO, L.L.C.
MID-AMERICA MIDSTREAM GAS SERVICES, L.L.C.


By:  /s/ Robert N. Fitzgerald
Name:  Robert N. Fitzgerald
Title:    Senior Vice President and Chief Financial Officer




WATTENBERG HOLDING, LLC


By:  ROSE ROCK MIDSTREAM OPERATING,
        LLC, as sole member and manager


By:  /s/ Robert N. Fitzgerald
Name:  Robert N. Fitzgerald
Title:    Senior Vice President and Chief Financial Officer


BEACHHEAD HOLDINGS LLC 
BEACHHEAD I LLC 
BEACHHEAD II LLC


By:  /s/ Robert N. Fitzgerald
Name:  Robert N. Fitzgerald
Title:    Senior Vice President and Chief Financial Officer










































[Third Amendment Signature Page]










EXHIBIT 10.4





WELLS FARGO BANK, NATIONAL ASSOCIATION,
as Administrative Agent






By:  /s/ Andrew Ostrov
        Name:  Andrew Ostrov
        Title:     Director






























































































[Third Amendment Signature Page]












EXHIBIT 10.4





WELLS FARGO BANK, NATIONAL ASSOCIATION,
as a Lender




By:  /s/ Andrew Ostrov
       Name:  Andrew Ostrov
       Title:     Director


































































































[Third Amendment Signature Page]








EXHIBIT 10.4







CITIBANK, N.A.,
as a Lender


By:  /s/ Michael Zeller
Name:  Michael Zeller
Title:    Vice President


































































































[Third Amendment Signature Page]








EXHIBIT 10.4







The Bank of Nova Scotia, Houston Branch, 
as a Lender






By:  /s/ Joe Lattanzi
        Name:  Joe Lattanzi
        Title:    Managing Director




























































































[Third Amendment Signature Page]










EXHIBIT 10.4





ROYAL BANK OF CANADA,
as a Lender




By:  /s/ Jason S. York
Name:  Jason S. York
Title:    Authorized Signatory






























































































[Third Amendment Signature Page]










EXHIBIT 10.4





THE TORONTO-DOMINION BANK, 
NEW YORK BRANCH,
as a Lender




By:  /s/ Maria Macchiaroli
       Name:  MARIA MACCHIAROLI
       Title:    AUTHORIZED SIGNATORY


[If a second signature is required]


By:  ________________________
        Name:    
        Title:  




















































































[Third Amendment Signature Page]










EXHIBIT 10.4



Capital  One,  National Association,
as a Lender


By:  /s/ Kristin Oswald
        Name:  Kristin Oswald
        Title:    Vice President






































































































[Third Amendment Signature Page]








EXHIBIT 10.4





ABN AMRO CAPITAL USA LLC
as a Lender






By:  /s/ Darrell Holley
       Name:  Darrell Holley
       Title:    Managing Director


[If a second signature is required]


By:  /s/ Kelly Hall
       Name:  Kelly Hall
       Title:    Director




















































































[Third Amendment Signature Page]








EXHIBIT 10.4







BARCLAY’s BANK PLC,
as a Lender






By:  /s/ Sydney G. Dennis
       Name:  Sydney G. Dennis
       Title:    Director






























































































[Third Amendment Signature Page]








EXHIBIT 10.4







CREDIT SUISSE AG, 
CAYMAN ISLANDS BRANCH, 
as a Lender






By:  /s/ Nupur Kumar
       Name:  Nupur Kumar
       Title:    Authorized Signatory




By:  /s/ Christopher Zybrick
       Name:  Christopher Zybrick
       Title:     Authorized Signatory
















































































[Third Amendment Signature Page]












EXHIBIT 10.4





SUNTRUST BANK,
as a Lender






By:  /s/ Benjamin L. Brown
       Name:  Benjamin L. Brown
       Title:    Director
































































































[Third Amendment Signature Page]










EXHIBIT 10.4







BMO Harris Financing, Inc.
as a Lender






By:  /s/ Matthew Davis
        Name:  Matthew Davis
        Title:    Director




























































































[Third Amendment Signature Page]








EXHIBIT 10.4







BNP Paribas,
as a Lender




By:  /s/ Joe Onischuk
        Name: Joe Onischuk
        Title:   Managing Director


By:  /s/ Ray Dunning
        Name: Ray Dunning
        Title:   Managing Director




























































[Third Amendment Signature Page]










EXHIBIT 10.4





Compass Bank,
as a Lender




By:  /s/ Mark H. Wolf
       Name:  Mark H. Wolf
       Title:     Senior Vice President


































































































[Third Amendment Signature Page]








EXHIBIT 10.4





BOKF, NA DBA Bank of Oklahoma,
as a Lender


By:  /s/ Matt Chase
       Name:  Matt Chase
       Title:    Senior Vice President


































































































[Third Amendment Signature Page]








EXHIBIT 10.4







REGIONS BANK,
as a Lender




By:  /s/ Michael Kolosowsky
       Name:  Michael Kolosowsky
       Title:    Managing Director
































































































[Third Amendment Signature Page]










EXHIBIT 10.4







CADENCE BANK N.A.,
 as a lender


By:  /s/ William W. Brown
Name:  William W. Brown
Title:     Executive Vice President
































































































[Third Amendment Signature Page]










EXHIBIT 10.4





Morgan Stanley Senior Funding Inc.,
as a Lender




By:  /s/ John Kuhns
       Name:  John Kuhns
       Title:    Vice President


































































































[Third Amendment Signature Page]










EXHIBIT 10.4





Morgan Stanley Bank N.A.,
as a Lender




By:  /s/ John Kuhns
       Name:  John Kuhns
       Title:    Authorized Signatory


































































































[Third Amendment Signature Page]








EXHIBIT 10.4





ZIONS BANCORPORATION, N.A.    DBA
AMEGY BANK, as  a Lender


By:  /s/ Jill McSorley
   Name:  Jill McSorley
   Title:    Senior Vice President-Amegy Bank Division


































































































[Third Amendment Signature Page]










EXHIBIT 10.4







COMMERCE BANK,
as a Lender




By:  /s/ Eric Rutter
       Name:  Eric Rutter
       Title:     Assistant Vice President
































































































[Third Amendment Signature Page]