Skip to content

core: implement share price calculation in liquidity pool #16

@EmeditWeb

Description

@EmeditWeb

Problem

The liquidity pool has total_shares and total_deposits
but no mechanism to calculate the actual share price.
This breaks the yield mechanism entirely.

What To Build

  1. Add share price calculation
  2. Fix deposit() to issue shares at current price
  3. Fix withdraw() to calculate USDC from shares
  4. Add accumulate_interest()

Files To Touch

  • contracts/liquidity-pool-contract/src/lib.rs
  • contracts/liquidity-pool-contract/src/types.rs
  • contracts/liquidity-pool-contract/src/storage.rs
  • contracts/liquidity-pool-contract/src/tests.rs

Acceptance Criteria

  • Share price calculated correctly
  • New deposits issued at current share price
  • Withdrawals return correct USDC amount
  • Interest increases share price for all holders
  • All arithmetic uses checked operations

Mandatory Checks Before PR

  • cargo build passes
  • All tests pass
  • No integer overflow possible
  • PR references this issue

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions