This repository contains a Foundry-based Solidity implementation of a CDP protocol where users deposit
Uniswap V2 LP tokens as collateral and mint LPUSD, a USD-pegged stablecoin.
The system is built around LP-specific risk management, including:
- fair LP pricing using oracle-based valuation instead of pool spot price
- per-collateral risk parameters such as max LTV, liquidation threshold, mint fee, and debt ceiling
- a Stability Pool that absorbs liquidations using deposited
LPUSD - liquidation and redemption mechanisms to support solvency and peg stability
LPUSD: ERC-20 stablecoin minted and burned by the vault systemVaultManager: core CDP engine for deposits, minting, repayment, withdrawals, and vault accountingCollateralAdapter: custody layer for supported LP tokensLPOracle: fair-price oracle for Uniswap V2 LP tokensPriceGuard: TWAP deviation circuit breakerStabilityPool:LPUSDpool used to absorb liquidationsLiquidationManager: liquidation routing and settlementRedemptionManager: redemptions ofLPUSDinto collateral
src/contracts: contract implementationssrc/interfaces: Solidity interfaces and NatSpectest/unit: unit tests and Bulloak treesscript: deployment and scripting entrypoints
- Solidity
0.8.30 - Foundry
- OpenZeppelin Contracts
pnpmfor JavaScript tooling- Solhint, Lintspec, Bulloak, Commitlint, Husky
- Install Foundry.
- Install project dependencies:
pnpm install- Copy
.env.exampleto.envand fill in the required variables if you plan to deploy or run fork-based flows.
pnpm build
pnpm test
pnpm test:unit
pnpm test:integration
pnpm lint:check
pnpm lint:sol
pnpm coverageDeployment scripts are available for Sepolia and mainnet:
pnpm deploy:sepolia
pnpm deploy:mainnetThese commands expect the relevant RPC, Etherscan, and deployer environment variables to be configured in
.env.
MIT. See LICENSE.