Skip to content

Commit

Permalink
update docs
Browse files Browse the repository at this point in the history
  • Loading branch information
androolloyd committed Nov 22, 2023
1 parent 67e3177 commit 510ae95
Show file tree
Hide file tree
Showing 6 changed files with 49 additions and 34 deletions.
15 changes: 7 additions & 8 deletions docs/mermaid/origination.mmd
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -60,8 +63,4 @@ sequenceDiagram
Fulfiller->>AdditionalTransferRecipient: AdditionalTransferItem from Fulfiller => AdditionalTransferRecipient
end
end
end

opt Lender is contract
Starport->>Lender: onLoanOpened
end
2 changes: 1 addition & 1 deletion docs/mermaid/origination.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
31 changes: 22 additions & 9 deletions docs/mermaid/refinance.mmd
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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
Starport->>Starport: _issueLoan
1 change: 1 addition & 0 deletions docs/mermaid/refinance.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
33 changes: 17 additions & 16 deletions docs/mermaid/settlement.mmd
Original file line number Diff line number Diff line change
@@ -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
1 change: 1 addition & 0 deletions docs/mermaid/settlement.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 510ae95

Please sign in to comment.