📄️ Dual Purpose Pools
Dual Purpose Pools (DP Pools) are a core feature of Ammalgam, combining Automated Market Making (AMM) and lending into one simple, unified system. Instead of separating trading and lending into different platforms, DP Pools let liquidity providers (LPs) earn both swap fees and lending interest at the same time, from the same deposit.
📄️ DLEX
The Decentralized Lending Exchange(DLEX) is at the core of Ammalgam's execution and settlement architecture. It integrates AMM trading mechanics and lending functions within a unified liquidity layer.
📄️ AMMs
Ammalgam was forked from Uniswap V2 and has maintained the interface and utility of the Uniswap V2 Factory and Pair contract. The factory allows any two ERC-20 tokens to be grouped together to create a new Pair contract. The Pair allows for users to provide both assets in equal value to allow for traders to swap between the two assets in return for a small fee associated with each swap. Swaps are priced based on the invariant curve $X \cdot Y = K$ where the quantities of the two ERC-20 tokens in the pair are $X$ and $Y$ and $K$, sometimes known as the invariant, must have a starting value before the swap that is less than or equal to the value after the swap.
📄️ Risk Engine
Ammalgam's Risk Engine secures the protocol through an integrated system of cross-margining, dynamic liquidation mechanics, and internal price safeguards.
📄️ No-Oracle Design
Ammalgam operates without any dependence on other protocols or oracles. In order to facilitate lending, we must define the concept of price so that assets can be valued at for the purpose of properly comparing collateral securing them. There are three key components to our method of defining price:
📄️ Approach
To address these issues, Ammalgam has designed a tiered approach which intensifies to handle these death spirals as markets turn violent and subside during normal market conditions. There are 4 levels of protection against the impact of market death spirals:
📄️ Capital Efficiency
Ammalgam maximizes capital efficiency by combining trading and lending within a unified AMM structure. It uses the constant product formula $X \times Y = K$, with liquidity tracked as $L = \sqrt$.
📄️ Liquidations
Price Dependent Liquidations
📄️ Interest Accrual
In our original design, the relationship between where interest is accrued and where it is distributed is a bit tricky since market making liquidity can be borrowed and the individual assets are also lent out. This is because most of these individual assets are not used in an AMM with Uniswap V2 type liquidity. Here is a drawing showing where X, Y, and K are being borrowed from.
📄️ Dynamic Swap Pricing
Once 90% of reserves have been lent out, Dynamic Swap Pricing will kick in to start to add a premium to trades taking the scarce liquidity and a discount for those bringing it. This essentially puts a throttle on swap transactions depleting the threatened assets. These adjustments start small and gradually increase as the health of the liquidity deteriorates. You can think of the adjustment to the invariant curves behavior similar to how Curve handles the depletion of assets as the stable invariant ($x+y = k$) as the pool becomes unbalanced.