# Claim Manager

<figure><img src="/files/bHA5ZQzSopvQ7E8rM0uE" alt=""><figcaption></figcaption></figure>

Claim payout operation begins with the claim validator, who is responsible for approving the claim amount and providing approved amount data associated with the claim case to the "Claim Manager". The claim voter will then be notified by the contract and the claim reserve value will be recorded. The claim's status will shift from the voting phase to the finalized phase once the claim voter vote has been concluded and a consensus has been reached.

If the risk subsidy ratio is 50 percent for each risk carrier, for example, the contract will submit a claim to the risk carrier service after the claim payment request is fulfilled, requesting payment of 100 USD. The agreed-upon split is 50/50, with each risk carrier taking responsibility for 50 USD.

Once the payment from the risk carrier service has been paid to the "Claim Manager," the "Claim Manager" will then update the claim case status and the amount that has been paid out in claims. Finally, the token's claim payout value will be paid to the user in an amount that corresponds the approved claim amount according to the accepted token standard.

### submitAssessment

```solidity
function submitAssessment(
    uint256 _claimId_,
    uint256 _claimApprovedAmount_,
    bool _isAccepted_
) external returns (bool)
```

"The `submitAssessment` function allows a validator to submit an assessment for an insurance claim. The function takes three parameters: the claim ID, the approved amount for the claim, and a flag indicating whether the claim is accepted or rejected.

{% hint style="info" %}
The caller must be a validator in the claim case, which means that they are a validator staked in the selected product pool and have been chosen to participate in the assessment of the claim.
{% endhint %}

Upon successful submission of the assessment, the function emits the `ClaimAssessmentSubmitted` event. If the validator reward needs to be increased, the function will also emit the `ClaimAssessmentRewardIncreased` event.

When the consensus on the assessment of a claim is reached, the function will emit the `ClaimAssessmentConsensusReached` event, indicating that the claim assessment process is complete, and the payout to the policy holder can be initiated. Additionally, if the consensus is reached, the function will also emit the `ClaimAssessmentPointIncreased` event, signifying that the validator's point will be increased.

The function returns a boolean value, with `true` indicating that the assessment has been submitted successfully."

Requirements:

* `nonReentrant` - The function must not be reentrant.
* `whenNotPaused` - The function must not be paused.

Events:

* [`ClaimAssessmentSubmitted` ](#claimassessmentsubmitted)- Emitted when the assessment is submitted successfully.
* [`ClaimAssessmentRewardIncreased` ](#claimassessmentrewardincreased)- Emitted when the claim validator reward is increased successfully.
* [`ClaimAssessmentConsensusReached` ](#claimassessmentconsensusreached)- Emitted when the consensus on the assessment of a claim is reached. This event signifies that the claim assessment process is complete and the payout to the policy holder can be initiated.
* [`ClaimAssessmentPointIncreased`](#claimassessmentpointincreased) - Emitted when the consensus on the assessment of a claim is reached. This event signifies that the claim assessment process is complete and the point will increased to the validator of the claim.

**Parameters**

| Name                  | Type    | Description                                                                                 |
| --------------------- | ------- | ------------------------------------------------------------------------------------------- |
| *claimId*             | uint256 | The claim id.                                                                               |
| *claimApprovedAmount* | uint256 | The approved amount of the claim that the validator has approved.                           |
| *isAccepted*          | bool    | The validator is a flag that indicates whether the submitted claim is accepted or rejected. |

**Return Values**

| Name | Type | Description                                       |
| ---- | ---- | ------------------------------------------------- |
| \[0] | bool | True if the assessment is submitted successfully. |

#### ClaimAssessmentSubmitted

```solidity
event ClaimAssessmentSubmitted(
    uint256 claimId,
    address validator,
    uint256 claimApprovedAmount,
    bool isAccepted
)
```

This event is emitted when the assessment is submitted successfully.

| Name                | Type    | Description                                                                                 |
| ------------------- | ------- | ------------------------------------------------------------------------------------------- |
| claimId             | uint256 | The claim id.                                                                               |
| validator           | address | The validator address who selected from the submitted claim.                                |
| claimApprovedAmount | uint256 | The approved amount of the claim that the validator has approved.                           |
| isAccepted          | bool    | The validator is a flag that indicates whether the submitted claim is accepted or rejected. |

### voteAssessment

```solidity
function voteAssessment(
    uint256 _claimId_,
    bool _isAccepted_
) external returns (bool)
```

"The `voteAssessment` function allows a claim voter, who is a validator staked in a selected product pool but was not chosen to participate in the assessment of a claim, to vote on the assessment. The function takes two parameters: the claim ID and a boolean flag indicating whether the claim is accepted or rejected.

{% hint style="info" %}
The caller must be a claim voter, which means that they are a validator staked in the selected product pool but were not chosen to participate in the assessment of the claim.
{% endhint %}

Upon successful voting, the function emits the `ClaimAssessmentVoted` event. If the claim voter reward needs to be increased, the function will also emit the `ClaimAssessmentRewardIncreased` event.

When the consensus on the assessment of a claim is reached, the function will emit the `ClaimAssessmentConsensusReached` event, indicating that the claim assessment process is complete, and the payout to the policy holder can be initiated. Additionally, if the consensus is reached, the function will also emit the `ClaimAssessmentPointIncreased` event, signifying that the validator's point will be increased.

The function returns a boolean value, with `true` indicating that the vote has been submitted successfully."

Requirements:

* `nonReentrant` - The function must not be reentrant.
* `whenNotPaused` - The function must not be paused.

Events:

* [`ClaimAssessmentVoted`](#claimassessmentvoted) - Emitted when the assessment is voted successfully.
* [`ClaimAssessmentRewardIncreased` ](#claimassessmentrewardincreased)- Emitted when the claim voter reward is increased successfully.
* [`ClaimAssessmentConsensusReached`](#claimassessmentconsensusreached) - Emitted when the consensus on the assessment of a claim is reached. This event signifies that the claim assessment process is complete and the payout to the policy holder can be initiated.
* [`ClaimAssessmentPointIncreased`](#claimassessmentpointincreased) - Emitted when the consensus on the assessment of a claim is reached. This event signifies that the claim assessment process is complete and the point will increased to the validator of the claim.

| Name         | Type    | Description                                                                             |
| ------------ | ------- | --------------------------------------------------------------------------------------- |
| *claimId*    | uint256 | The claim id.                                                                           |
| *isAccepted* | bool    | The voter is a flag that indicates whether the submitted claim is accepted or rejected. |

| Name | Type | Description                                   |
| ---- | ---- | --------------------------------------------- |
| \[0] | bool | True if the assessment is voted successfully. |

#### ClaimAssessmentVoted

```solidity
event ClaimAssessmentVoted(uint256 claimId, address voter, bool isAccepted)
```

This event is emitted when the assessment is voted successfully.

| Name       | Type    | Description                                                                             |
| ---------- | ------- | --------------------------------------------------------------------------------------- |
| claimId    | uint256 | The claim id.                                                                           |
| voter      | address | The voter address.                                                                      |
| isAccepted | bool    | The voter is a flag that indicates whether the submitted claim is accepted or rejected. |

#### ClaimAssessmentRewardIncreased

```solidity
event ClaimAssessmentRewardIncreased(uint256 claimId, address caller, uint256 reward)
```

This event is emitted when the assessment is voted successfully.

| Name    | Type    | Description                                                                |
| ------- | ------- | -------------------------------------------------------------------------- |
| claimId | uint256 | The claim id.                                                              |
| caller  | address | The caller's address means the validator's address or the voter's address. |
| reward  | uint256 | The reward amount that given to the voter.                                 |

#### ClaimAssessmentConsensusReached

```solidity
event ClaimAssessmentConsensusReached(uint256 claimId, ClaimStatus status)
```

This event is emitted when the claim is consensus.

| Name    | Type                                                                                           | Description       |
| ------- | ---------------------------------------------------------------------------------------------- | ----------------- |
| claimId | uint256                                                                                        | The claim id.     |
| status  | [ClaimStatus](/covest-insaas-protocol/insaas-smart-contracts/claim-case-states.md#claimstatus) | The claim status. |

#### ClaimAssessmentPointIncreased

```solidity
event ClaimAssessmentPointIncreased(uint256 claimId, address validator, uint256 point)
```

This event is emitted when the claim is consensus.

| Name      | Type    | Description                                                  |
| --------- | ------- | ------------------------------------------------------------ |
| claimId   | uint256 | The claim id.                                                |
| validator | address | The validator address who selected from the submitted claim. |
| point     | uint256 | The point amount that given to the validator.                |


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.covestlabs.com/covest-insaas-protocol/insaas-smart-contracts/claim-assessor/claim-manager.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
