diff --git a/docs/mermaid/origination.mmd b/docs/mermaid/origination.mmd
index bddb08d1..51cc7961 100644
--- a/docs/mermaid/origination.mmd
+++ b/docs/mermaid/origination.mmd
@@ -2,18 +2,21 @@ sequenceDiagram
title Starport Origination Sequence Diagram
- Box green Orignation
+ Box blue Parties
+ participant AdditionalTransferRecipient
participant Fulfiller
+ end
+
+ Box green Orignation
participant Starport
participant CaveatEnforcer
end
- Box blue Assets
- participant Lender
+ Box rgb(112,100,0) Assets
participant Borrower
participant Custodian
+ participant Lender
participant FeeRecipient
- participant AdditionalTransferRecipient
end
Fulfiller->>Starport: originate
@@ -60,8 +63,4 @@ sequenceDiagram
Fulfiller->>AdditionalTransferRecipient: AdditionalTransferItem from Fulfiller => AdditionalTransferRecipient
end
end
- end
-
- opt Lender is contract
- Starport->>Lender: onLoanOpened
end
\ No newline at end of file
diff --git a/docs/mermaid/origination.svg b/docs/mermaid/origination.svg
index eb4ec3ca..87c92b23 100644
--- a/docs/mermaid/origination.svg
+++ b/docs/mermaid/origination.svg
@@ -1 +1 @@
-
\ No newline at end of file
+
\ No newline at end of file
diff --git a/docs/mermaid/refinance.mmd b/docs/mermaid/refinance.mmd
index b522f4f5..fe9bb263 100644
--- a/docs/mermaid/refinance.mmd
+++ b/docs/mermaid/refinance.mmd
@@ -1,16 +1,32 @@
sequenceDiagram
title Starport Refinance Sequence Diagram
+
+
+
+ Box blue
+ participant AdditionalTransferRecipient
participant F as Fulfiller
- participant R as Refinancer
- participant L as Lender
- participant R as Recaller
+ end
+ Box green
+ participant Starport
+ participant Pricing
+ participant Settlement
+ participant CaveatEnforcer
+ end
+ Box rgb(112,100,0)
+ participant B as Borrower
+ participant R as New Lender
+ participant L as Original Lender
+ participant Originator as Original Originator
+ end
F->>Starport: refinance
Starport->>Pricing: getRefinanceConsideration
Pricing->>Starport: (SpentItem[] ConsiderPayment, SpentItem[] CarryPayment, AdditionalTransfer[] AT)
- Starport->>Starport: settle loan
+ Starport->>Starport: _settleLoan
+ Starport->>Settlement: postRepayment
loop Transfer 1->n ConsiderPayment items
R->>L: Move ConsiderPayment to Lender
@@ -30,13 +46,10 @@ sequenceDiagram
alt From is Borrower
B->>AdditionalTransferRecipient: AdditionalTransferItem from Borrower -> AdditionalTransferRecipient
else From is Lender
- L->>AdditionalTransferRecipient: AdditionalTransferItem from Lender -> AdditionalTransferRecipient
+ R->>AdditionalTransferRecipient: AdditionalTransferItem from Refinancer -> AdditionalTransferRecipient
else From is F
F->>AdditionalTransferRecipient: AdditionalTransferItem from Fulfiller -> AdditionalTransferRecipient
end
end
end
-
- opt Lender is contract
- Starport->>L: onERC721Received
- end
\ No newline at end of file
+ Starport->>Starport: _issueLoan
\ No newline at end of file
diff --git a/docs/mermaid/refinance.svg b/docs/mermaid/refinance.svg
new file mode 100644
index 00000000..298ed7dd
--- /dev/null
+++ b/docs/mermaid/refinance.svg
@@ -0,0 +1 @@
+
\ No newline at end of file
diff --git a/docs/mermaid/settlement.mmd b/docs/mermaid/settlement.mmd
index 91403e42..6b7ed04b 100644
--- a/docs/mermaid/settlement.mmd
+++ b/docs/mermaid/settlement.mmd
@@ -1,35 +1,36 @@
sequenceDiagram
title Starport Settlement Sequence Diagram
+ Box green
participant F as Fulfiller
-
+ participant Seaport
+ end
+ Box rgb(112, 100, 0)
+ participant Custodian
+ participant Status
+ participant Pricing
+ participant Settlement
+ participant Starport
+ participant Authorized
+ end
F->>Seaport: fulfillAdvancedOrder/matchAdvancedOrder
Seaport->>Custodian: generateOrder
Custodian->>Status: isActive
Status->>Custodian: (true/false)
alt Action is Repayment and Status is Active
- Custodian->>Custodian: _beforeApprovalsSetHook
- Custodian->>Custodian: _setOfferApprovalsWithSeaport
Custodian->>Pricing: getPaymentConsideration
Pricing->>Custodian: (SpentItem[] payment, SpentItem[] carry)
Custodian->>Starport: settle loan
+ Custodian->>Settlement: postRepayment
else Action Settlement and Custodian->>Status: isActive is false
- Custodian->>Custodian: _beforeGetSettlement
- Custodian->>SettlementHandler: getSettlement
- SettlementHandler->>Custodian: (ReceivedItem[] consideration, address authorized)
- Custodian->>Custodian: _afterGetSettlement
+ Custodian->>Settlement: getSettlement
+ Settlement->>Custodian: (ReceivedItem[] consideration, address authorized)
alt authorized is address(0) || authorized is Fulfiller
- Custodian->>Custodian: _beforeApprovalsSetHook
Custodian->>Custodian: _setOfferApprovalsWithSeaport
else authorized is loan handler || authorized is loan issuer
Custodian->>Custodian: _moveCollateralToAuthorized
- Custodian->>Custodian: _beforeSettlementHandlerHook
- alt authorized is loan handler
- Custodian->>SettlementHandler: execute
- Custodian->>Custodian: _afterSettlementHandlerHook
- end
+ Custodian->>Authorized: transfer 1->n collateral
end
Custodian->>Starport: settle loan
- opt Lender is contract
- Starport->>Lender: onLoanSettledHook
- end
+ Custodian->>Settlement: postSettlement
+
end
diff --git a/docs/mermaid/settlement.svg b/docs/mermaid/settlement.svg
new file mode 100644
index 00000000..16f61f47
--- /dev/null
+++ b/docs/mermaid/settlement.svg
@@ -0,0 +1 @@
+
\ No newline at end of file