
Ampli Finance
A self-custodial margin protocol for Uniswap v4
About
The problem it solves 1. Inefficient Capital Use in Lending Protocols Traditional DeFi lending platforms rely on the lender/borrower model, where idle liquidity sits unused until matched with a borrower. This leads to low utilization and poor capital efficiency. 2. Impermanent Loss for Liquidity Providers Traditional AMMs expose LPs to impermanent loss without any built-in mechanism for offsetting or compensating that risk, discouraging participation and limiting sustainable liquidity. 3. Fragmented Margin Infrastructure Margin trading is often siloed within centralized platforms or specialized protocols. Ampli unifies leveraged trading, staking, and LP provisioning into a single permissionless margin layer. 4. Lack of Composability Existing margin systems are difficult to integrate into broader DeFi ecosystems. Ampli is built on Uniswap v4 and designed for composability—markets and positions are tokenized, programmable, and interoperable. 5. Rigid Risk Models Most margin systems have fixed risk parameters. Ampli enables custom interest rate curves, oracle selection, and asset pairings for each market—giving creators the flexibility to tailor risk models to different use cases.
How it's made
Challenges we ran into 1. Determining a Robust Interest Rate Without Relying on Utilization Challenge: Traditional lending protocols tie interest rates to utilization, but Ampli has no lender pool or utilization ratio. We needed a new model to dynamically price leverage that still reflects market demand and risk. Solution: We anchored the interest rate to peg deviation between the base and debt token, using configurable mathematical functions (e.g. linear, quadratic) to ensure rates increase as the debt token weakens. This creates a self-correcting mechanism that replaces utilization with market-based price signals. 2. Bootstrapping Demand and Liquidity for a New Debt Token Challenge: Without lenders supplying capital upfront, Ampli relies on active liquidity for its debt token to support borrowing. Creating sustainable incentives for LPs—without relying on emissions or complex tokenomics—was a key hurdle. Solution: We designed the protocol so that all borrower interest flows directly to LPs of the debt/base pair, turning them into long-term stakeholders. This aligns incentives and ensures liquidity deepens as borrowing demand grows. 3. Preventing Negative Interest Rates in Solidity Challenge: Solidity doesn’t have built-in safeguards against subtle math bugs (like negative interest rates due to underflows or faulty peg assumptions). Solution: We carefully encoded guardrails at both swap and rate calculation layers, and extensively fuzz-tested economic edge cases to ensure interest logic always respects protocol invariants. 4. Ensuring Predictable Liquidation Outcomes Challenge: Liquidation logic had to remain fair, permissionless, and always incentivized—even in edge cases where the position is deeply underwater. Solution: We added a minimum liquidation incentive mechanism where the protocol mints debt tokens if necessary to ensure the liquidator is compensated, making the process predictable and safe for all participants. 5. Supporting Configurable Markets Without Duplicating Infrastructure Challenge: Each market needed custom parameters (assets, interest model, oracle) without deploying isolated contracts, which would be costly and hard to maintain. Solution: We implemented a singleton architecture with per-market initialization and flash-resolved accounting. This enables flexible, isolated risk while keeping gas costs low and state management centralized.