-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add sequence diamgrams for refinance and settlement
- Loading branch information
1 parent
90411a2
commit ad7cf11
Showing
2 changed files
with
77 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
sequenceDiagram | ||
title Starport Refinance Sequence Diagram | ||
participant F as Fulfiller | ||
participant R as Refinancer | ||
participant L as Lender | ||
participant R as Recaller | ||
|
||
|
||
F->>LoanManager: refinance | ||
LoanManager->>Pricing: isValidRefinance | ||
Pricing->>LoanManager: (SpentItem[] ConsiderPayment, SpentItem[] CarryPayment, AdditionalTransfer[] AT) | ||
|
||
LoanManager->>LoanManager: settle loan | ||
|
||
loop Transfer 1->n ConsiderPayment items | ||
R->>L: Move ConsiderPayment to Lender | ||
end | ||
opt CarryPayment length > 0 | ||
R->>Originator: Move CarryPayment to Originator | ||
end | ||
|
||
opt F is not Refinancer and F is not approved | ||
loop Validate 1->n Caveats | ||
LoanManager->>CaveatEnforcer: validate | ||
end | ||
end | ||
opt AdditionalTransferItems length > 0 | ||
LoanManager->>LoanManager: validateAdditionalTransfers | ||
loop 1->n | ||
alt From is Borrower | ||
B->>AdditionalTransferRecipient: AdditionalTransferItem from Borrower -> AdditionalTransferRecipient | ||
else From is Lender | ||
L->>AdditionalTransferRecipient: AdditionalTransferItem from Lender -> AdditionalTransferRecipient | ||
else From is F | ||
F->>AdditionalTransferRecipient: AdditionalTransferItem from Fulfiller -> AdditionalTransferRecipient | ||
end | ||
end | ||
end | ||
|
||
opt Lender is contract | ||
LoanManager->>L: onERC721Received | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
sequenceDiagram | ||
title Starport Settlement Sequence Diagram | ||
participant F as Fulfiller | ||
|
||
F->>Seaport: fulfillAdvancedOrder/matchAdvancedOrder | ||
Seaport->>Custodian: generateOrder | ||
Custodian->>SettlementHook: isActive | ||
SettlementHook->>Custodian: (true/false) | ||
alt Action is Repayment and SettlementHook is Active | ||
Custodian->>Custodian: _beforeApprovalsSetHook | ||
Custodian->>Custodian: _setOfferApprovalsWithSeaport | ||
Custodian->>Pricing: getPaymentConsideration | ||
Pricing->>Custodian: (SpentItem[] payment, SpentItem[] carry) | ||
Custodian->>LoanManager: settle loan | ||
else Action Settlement and Custodian->>SettlementHook: isActive is false | ||
Custodian->>Custodian: _beforeGetSettlement | ||
Custodian->>SettlementHandler: getSettlement | ||
SettlementHandler->>Custodian: (ReceivedItem[] consideration, address authorized) | ||
Custodian->>Custodian: _afterGetSettlement | ||
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 | ||
end | ||
Custodian->>LoanManager: settle loan | ||
opt Lender is contract | ||
LoanManager->>Lender: onLoanSettledHook | ||
end | ||
end |