Skip to content

feat: implement token transfers, risk-priced premiums, and governance docs - #579

Merged
Levi-Ojukwu merged 1 commit into
Invoice-Liquidity-Network:mainfrom
oomokaro1:feat/insurance-pool-improvements
Jul 26, 2026
Merged

feat: implement token transfers, risk-priced premiums, and governance docs#579
Levi-Ojukwu merged 1 commit into
Invoice-Liquidity-Network:mainfrom
oomokaro1:feat/insurance-pool-improvements

Conversation

@oomokaro1

Copy link
Copy Markdown
Contributor

Closes #527, Closes #526, Closes #528, Closes #543

Type of Change

  • Bug fix (non-breaking change that fixes an issue)
  • New feature (non-breaking change that adds functionality)
  • Refactoring (no functional or behavioral changes)
  • Documentation update

Summary

This PR implements three major improvements to the insurance pool contract:

  1. Issue Implement actual token transfers in insurance pool #527 - Token Transfers: Added real token transfers to the insurance pool using Soroban's token interface. deposit_premium now transfers tokens from LP to pool, and claim transfers tokens from pool to LP. Uses checks-effects-interactions pattern for reentrancy protection.

  2. Issue Implement risk-priced insurance premiums #528 - Risk-Priced Premiums: Implemented risk-based premium calculation where higher-risk LPs pay higher premiums. Added tiered coverage caps based on premiums paid (50%-150% of base coverage). Includes governance parameters for base rate and risk multiplier configuration.

  3. Issue Update docs/events.md with all governance events #526 - Governance Events Documentation: Added comprehensive event schemas for all governance contract events including GovernanceInitialized, GovernanceParameterUpdated, ProposalCreated, VoteCast, ProposalExecuted, ProposalVetoed, VotesDelegated, VotesUndelegated, and VetoPowerDisabled.

  4. Issue Implement on-chain mechanism to update insurance pool coverage cap #543 - Coverage Cap Update: Verified existing timelock mechanism for coverage cap updates is already implemented and working.

Motivation / Context

These changes make the insurance pool production-ready by:

Changes

Smart Contract (Rust)

  • Added TokenAddress storage key and initialize now accepts token parameter
  • deposit_premium calls token.transfer() to move tokens from LP to pool
  • claim now accepts lp parameter and calls token.transfer() to compensate LP
  • Added risk-priced premium calculation: calculate_premium_rate_bps(), calculate_premium_amount()
  • Added tiered coverage: get_tiered_coverage() based on premiums paid
  • Added governance parameters: set_base_premium_rate_bps(), set_risk_multiplier()
  • Added LP risk tracking: increment_default_count(), get_default_count()
  • 24 comprehensive tests covering all new functionality

SDK (TypeScript)

  • Updated claimInsurance() to accept lpAddress parameter
  • Added initializeInsurancePool() with token address parameter
  • Added getTokenAddress() read method
  • Added calculatePremiumRate() and getTieredCoverage() read methods

CLI

  • Updated claim command to require --lp <address> option
  • Added token address display in status output

Documentation

  • Added full event schemas for all insurance pool events
  • Added full event schemas for all governance events

@drips-wave

drips-wave Bot commented Jul 25, 2026

Copy link
Copy Markdown

@oomokaro1 Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits.

You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀

Learn more about application limits

@oomokaro1
oomokaro1 force-pushed the feat/insurance-pool-improvements branch from aac9afc to 565ab2f Compare July 26, 2026 11:25
@Levi-Ojukwu
Levi-Ojukwu merged commit 66f4942 into Invoice-Liquidity-Network:main Jul 26, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

2 participants