-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
bee9ac9
commit 62310aa
Showing
4 changed files
with
73 additions
and
52 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 |
---|---|---|
@@ -1,30 +1,25 @@ | ||
# ApplicationService sequences | ||
|
||
## calculatePremium | ||
## create | ||
|
||
```mermaid | ||
sequenceDiagram | ||
actor C as Caller | ||
participant AS as ApplicationService | ||
participant P as Product | ||
participant DS as DistributionService | ||
participant IR as InstanceReader | ||
participant RS as RegistryService | ||
participant R as Registry | ||
participant PS as PricingService | ||
participant IS as InstanceStore | ||
C ->> AS: calculatePremium(productNftId, sumInsured, referral, [...]) | ||
AS ->> P: calculateNetPremium(sumInsured) | ||
P ->> AS: netPremium | ||
AS ->> AS: _getFixedFeeAmounts() | ||
AS ->> IR: getProductSetupInfo()<br/> getPoolSetupInfo() <br/> getBundleInfo() <br/> getDistributionSetupInfo() | ||
AS ->> AS: _calculateVariableFeeAmounts | ||
AS ->> DS: calculateFeeAmount(distributionNftId, referral, netPremium, (intermediary)premium) | ||
DS ->> IR: getDistributionSetupInfo() | ||
DS ->> DS: calculate distribution fee and full premium | ||
DS ->> DS: referralIsValid() | ||
DS ->> IR: getReferralInfo()<br/> getDistributorInfo<br/> getDistributorTypeInfo() | ||
opt if referral is valid | ||
DS ->> DS: calculate discount, comission based on referral | ||
end | ||
DS ->> DS: calculate distribution owner fee and final premium | ||
DS ->> AS: premium (final) | ||
AS ->> C: premium | ||
``` | ||
C ->> AS: create() | ||
AS ->> RS: registerPolicy(objectInfo) | ||
RS ->> +R: register(objectInfo) | ||
R ->> R: mint NFT | ||
R ->> -RS: policyNftId | ||
RS ->> AS: policyNftId | ||
AS ->> +PS: calculatePremium(productNftId, sumInsured, referralId, [...]) | ||
PS ->> -AS: premium | ||
AS ->> IS: createApplication(policyNftId, policyInfo) | ||
AS ->> C: policyNftId | ||
``` |
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
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,29 @@ | ||
# PolicyService sequences | ||
|
||
## collateralize | ||
|
||
```mermaid | ||
sequenceDiagram | ||
actor C as Caller | ||
participant PS as PolicyService | ||
participant PRS as PricingService | ||
participant TH as TokenHandler | ||
participant DS as DistributionService | ||
participant POS as PoolService | ||
participant IS as InstanceStore | ||
participant IR as InstanceReader | ||
C ->> PS: collateralize(policy, premiumAmount) | ||
PS ->> IR: getPolicyInfo | ||
PS ->> IR: getPolicyState | ||
opt if require premium payment | ||
PS ->> +PRS: calculatePremium(productNftId, sumInsured, referralId, [...]) | ||
PRS ->> -PS: premium | ||
PS ->> TH: transfer(productFee) | ||
PS ->> TH: transfer(distributionFee) | ||
PS ->> DS: processSale(distributionNftId, referallId, premium, distributionFee) | ||
PS ->> TH: transfer(poolFee) | ||
PS ->> POS: processSale(bundleNftId, premium, poolFee) | ||
end | ||
PS ->> IS: updatePolicy(policyNftId, policyInfo, policyState) | ||
``` |
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,26 @@ | ||
# PricingService sequences | ||
|
||
## calculatePremium | ||
|
||
```mermaid | ||
sequenceDiagram | ||
actor C as Caller | ||
participant PS as PricingService | ||
participant P as Product | ||
participant DS as DistributionService | ||
participant IR as InstanceReader | ||
C ->> PS: calculatePremium(productNftId, sumInsured, referralId, [...]) | ||
PS ->> P: calculateNetPremium(sumInsured, [...]) | ||
P ->> PS: netPremium | ||
PS ->> IR: getProductSetupInfo()<br/> getPoolSetupInfo() <br/> getBundleInfo() <br/> getDistributionSetupInfo() | ||
PS ->> PS: _getFixedFeeAmounts() | ||
PS ->> PS: _calculateVariableFeeAmounts() | ||
PS ->> +PS: _calculateDistributionOwnerFeeAmount() | ||
PS ->> DS: referralIsValid(referralId) | ||
opt if referral is valid | ||
PS ->> IR: getReferralInfo()<br/> getDistributorInfo<br/> getDistributorTypeInfo() | ||
PS ->> -PS: calculate discount, comission based on referral | ||
end | ||
PS ->> C: premium | ||
``` |