Skip to content

Commit

Permalink
add claim closing, refine payout handling
Browse files Browse the repository at this point in the history
  • Loading branch information
matthiaszimmermann committed Jul 28, 2022
1 parent af18849 commit d942f73
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 17 deletions.
12 changes: 8 additions & 4 deletions contracts/components/Product.sol
Original file line number Diff line number Diff line change
Expand Up @@ -174,10 +174,6 @@ abstract contract Product is
data);
}

function _declineClaim(bytes32 processId, uint256 claimId) internal {
_productService.declineClaim(processId, claimId);
}

function _confirmClaim(
bytes32 processId,
uint256 claimId,
Expand All @@ -194,6 +190,14 @@ abstract contract Product is
data);
}

function _declineClaim(bytes32 processId, uint256 claimId) internal {
_productService.declineClaim(processId, claimId);
}

function _closeClaim(bytes32 processId, uint256 claimId) internal {
_productService.closeClaim(processId, claimId);
}

function _newPayout(
bytes32 processId,
uint256 claimId,
Expand Down
18 changes: 7 additions & 11 deletions contracts/modules/IPolicy.sol
Original file line number Diff line number Diff line change
Expand Up @@ -32,26 +32,23 @@ interface IPolicy {

event LogPremiumCollected(bytes32 processId, uint256 amount);

event LogClaimCreated(bytes32 processId, uint256 claimId);
event LogClaimConfirmed(bytes32 processId, uint256 claimId);
event LogClaimCreated(bytes32 processId, uint256 claimId, uint256 claimAmount);
event LogClaimConfirmed(bytes32 processId, uint256 claimId, uint256 confirmedAmount);
event LogClaimDeclined(bytes32 processId, uint256 claimId);
event LogClaimClosed(bytes32 processId, uint256 claimId);

event LogPayoutCreated(
bytes32 processId,
uint256 claimId,
uint256 payoutId
uint256 payoutId,
uint256 amount
);

event LogPayoutProcessed(
bytes32 processId,
uint256 payoutId
);

event LogPayoutCompleted(
bytes32 processId,
uint256 payoutId
);

// States
enum PolicyFlowState {Started, Paused, Finished}
enum ApplicationState {Applied, Revoked, Underwritten, Declined}
Expand Down Expand Up @@ -145,6 +142,7 @@ interface IPolicy {

function confirmClaim(bytes32 processId, uint256 claimId) external;
function declineClaim(bytes32 processId, uint256 claimId) external;
function closeClaim(bytes32 processId, uint256 claimId) external;

function createPayout(
bytes32 processId,
Expand All @@ -155,8 +153,6 @@ interface IPolicy {

function processPayout(
bytes32 processId,
uint256 payoutId,
bool isComplete,
bytes calldata data
uint256 payoutId
) external;
}
5 changes: 3 additions & 2 deletions contracts/services/IProductService.sol
Original file line number Diff line number Diff line change
Expand Up @@ -31,15 +31,16 @@ interface IProductService {
bytes calldata data
) external returns(uint256 claimId);

function declineClaim(bytes32 processId, uint256 claimId) external;

function confirmClaim(
bytes32 processId,
uint256 claimId,
uint256 payoutAmount,
bytes calldata data
) external returns(uint256 payoutId);

function declineClaim(bytes32 processId, uint256 claimId) external;
function closeClaim(bytes32 processId, uint256 claimId) external;

function newPayout(
bytes32 processId,
uint256 claimId,
Expand Down

0 comments on commit d942f73

Please sign in to comment.