Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Outline claimInsurance process and workflow #9

Open
sambacha opened this issue Jul 25, 2024 · 1 comment
Open

Outline claimInsurance process and workflow #9

sambacha opened this issue Jul 25, 2024 · 1 comment
Assignees
Labels
documentation Improvements or additions to documentation

Comments

@sambacha
Copy link
Contributor

Currently, claimInsurance does not have the logic necessary to 'validate' a claim. This is because the management of captive insurance claims is handled by us, which is why it is called Captive Insurance.

Until the L2 Construct is implemented for v2 supporting multiple relays, this is fine. However, we should outline and document how exactly a claim is substantiated. Typically, the insured party must provide notice to their insurance carrier for potential claims. Therefore, it is up to the underlying LST/Validator/Node Operator to initiate this process, it is not up to us to initialize the process for paying out a claim.

@sambacha sambacha added the documentation Improvements or additions to documentation label Jul 25, 2024
@sambacha sambacha self-assigned this Jul 25, 2024
@sandybradley
Copy link
Contributor

How about a flow more like ...

struct Claim {
    address claimant;
    uint128 liquidityClaimed;
    uint256 timestamp;
    bool approved;
}

mapping(uint256 => Claim) public claims;
uint256 public claimCounter;

function submitClaim(uint128 liquidity) external {
    require(liquidity <= balances[msg.sender].amount, "Insufficient liquidity");
    claimCounter++;
    claims[claimCounter] = Claim(msg.sender, liquidity, block.timestamp, false);
    emit ClaimSubmitted(msg.sender, liquidity, block.timestamp);
}

function approveClaim(uint256 claimId) external onlyOwner {
    Claim storage claim = claims[claimId];
    require(!claim.approved, "Claim already approved");
    claim.approved = true;
    _processClaim(claim);
}

function _processClaim(Claim memory claim) internal {
    // Logic to withdraw liquidity and transfer funds to claimant
}

event ClaimSubmitted(address indexed claimant, uint128 liquidity, uint256 timestamp);

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation
Projects
None yet
Development

No branches or pull requests

2 participants