JackpotLPManager

Manages liquidity provider (LP) deposits, withdrawals, and share accounting. LP funds back the prize pool and earn edge from ticket sales.

State Variables

Variable
Type
Description

jackpot

address

Reference to the main Jackpot contract

lpPoolCap

uint256

Maximum allowed LP pool size

lpDrawingState

mapping(uint256 => LPDrawingState)

LP pool state per drawing

lpInfo

mapping(address => LP)

LP position data per address

drawingAccumulator

mapping(uint256 => uint256)

Share price accumulator per drawing

Structs

LP

struct LP {
    uint256 consolidatedShares;    // Active LP shares (1e18 scale)
    DepositInfo lastDeposit;       // Most recent deposit details
    WithdrawalInfo pendingWithdrawal; // Active withdrawal request
    uint256 claimableWithdrawals;  // USDC ready to claim
}

DepositInfo

WithdrawalInfo

LPDrawingState

LPValueBreakdown

Events

LPDeposit

LPWithdrawalInitiated

LPWithdrawalFinalized

Functions

getLpInfo

Get complete LP position information for an address.

Parameters:

Name
Type
Description

_lpAddress

address

Address to query LP position for

Returns:

Type
Description

LP

Complete LP position including shares, deposits, and withdrawals

Example:


getLPValueBreakdown

Get the USDC value breakdown of an LP's position.

Parameters:

Name
Type
Description

_drawingId

uint256

Drawing ID to calculate values for

_lpAddress

address

Address to query

Returns:

Type
Description

LPValueBreakdown

USDC values for active, pending deposits/withdrawals, and claimable

Example:


getLPDrawingState

Get LP pool state for a specific drawing.

Parameters:

Name
Type
Description

_drawingId

uint256

Drawing ID to query

Returns:

Type
Description

LPDrawingState

Pool totals, pending deposits, and pending withdrawals

Example:


getDrawingAccumulator

Get the share price accumulator for a drawing.

Parameters:

Name
Type
Description

_drawingId

uint256

Drawing ID to query

Returns:

Type
Description

uint256

Accumulator value (1e18 scale) used for share price calculations

Example:

LP Share Economics

How Shares Work

  1. Initial Deposit: When you deposit USDC, you receive shares based on the current accumulator

  2. Share Value: Share value increases when LPs earn edge from ticket sales

  3. Withdrawals: Shares are converted back to USDC at the current accumulator rate

Timing

  • Deposits: Become active at the start of the next drawing

  • Withdrawals: Must be initiated, then finalized after the drawing completes

  • Edge: Earned proportionally to share holdings

Example Flow

Last updated