Skip to main content
PoolVault is an ERC-4626 vault where LPs deposit USDC to earn yield from trader losses and fees. The vault is the counterparty to every position: it pays trader profits and absorbs trader losses. Pool share price reflects total assets adjusted for aggregate unrealized PnL.

Contract Relationships

Read Functions

poolEquity

function poolEquity() external view returns (uint256)
Returns pool equity: totalAssets adjusted for aggregate unrealized PnL across all open positions. This is the effective pool value that RiskManager uses for cap calculations.

netExposure

function netExposure() external view returns (int256)
Returns aggregate net exposure across all pairs: sum(long notional) - sum(short notional). Positive means pool is net long, negative means net short.

grossNotional

function grossNotional() external view returns (uint256)
Returns total gross notional of all open positions across all pairs.

utilization

function utilization() external view returns (uint256)
Returns utilization ratio in basis points: grossNotional * 10000 / totalAssets.

notionalUtilization

function notionalUtilization() external view returns (uint256)
Returns notional utilization ratio in basis points. Used for withdrawal cap enforcement.

maxWithdrawable

function maxWithdrawable() external view returns (uint256)
Returns maximum USDC amount withdrawable without exceeding the utilization cap.

isAllowlisted

function isAllowlisted(address account) external view returns (bool)
Returns whether an address is on the LP deposit allowlist.

allowlistEnabled

function allowlistEnabled() external view returns (bool)
Returns whether allowlist enforcement is active. When disabled, any address can deposit.

pairNetExposure

function pairNetExposure(bytes32 pairId) external view returns (int256)
Returns net exposure for a specific currency pair.

pairGrossNotional

function pairGrossNotional(bytes32 pairId) external view returns (uint256)
Returns gross notional for a specific currency pair.

ERC-4626 Standard

PoolVault inherits all standard ERC-4626 view functions:
FunctionReturns
totalAssets()Total USDC held by the vault
convertToShares(assets)Shares for a given USDC deposit
convertToAssets(shares)USDC for a given share redemption
maxDeposit(receiver)Maximum USDC depositable
maxMint(receiver)Maximum shares mintable
maxWithdraw(owner)Maximum USDC withdrawable
maxRedeem(owner)Maximum shares redeemable

Write Functions

deposit (ERC-4626)

function deposit(uint256 assets, address receiver) external returns (uint256 shares)
Deposits USDC and mints pool shares to receiver. Requires prior ERC-20 approval.
NameTypeDescription
assetsuint256USDC amount to deposit (6 decimals)
receiveraddressAddress to receive pool shares

withdraw (ERC-4626)

function withdraw(uint256 assets, address receiver, address owner) external returns (uint256 shares)
Withdraws USDC by burning pool shares. Subject to utilization cap enforcement.
NameTypeDescription
assetsuint256USDC amount to withdraw (6 decimals)
receiveraddressAddress to receive USDC
owneraddressShare owner (must be caller or have allowance)

Admin Functions

setAllowlisted

function setAllowlisted(address account, bool allowed) external
Updates the LP allowlist status for an address. Owner only.

setAllowlistEnabled

function setAllowlistEnabled(bool enabled) external
Enables or disables allowlist enforcement. Owner only.

Protocol Functions

applyPnl

function applyPnl(int256 pnl) external
Applies trader PnL to the pool. Called by SettlementEngine on position close. Positive = pool gains (trader loss), negative = pool pays (trader profit).

updateExposure

function updateExposure(bytes32 pairId, int256 notionalDelta, bool isLong) external
Records exposure change from position open/close/reduce. Updates both aggregate and per-pair tracking.
NameTypeDescription
pairIdbytes32Currency pair identifier
notionalDeltaint256Notional change (positive for open, negative for close)
isLongboolWhether the trader position is long

Events

EventWhen Emitted
DepositLP deposits USDC (ERC-4626 standard)
WithdrawLP withdraws USDC (ERC-4626 standard)
AllowlistUpdatedLP allowlist status changed
ExposureUpdatedAggregate exposure changed
PairExposureUpdatedPer-pair exposure changed
PnlAppliedTrader PnL applied to pool

Vault Mechanics

How the ERC-4626 vault works for LPs.

Share Price

Share price calculation and PnL impact.

Pool Utilization

Utilization caps and withdrawal limits.