All asset pairs experience different volatility by nature. To support a permissionless margin trading market, isolated pools are needed with risk parameters associated with the pair. Each pair has its collateral ratio, according to the pair's volatility and the block time and throughput of the chain. The protocol can support from 1.5X to 10X leverage trading.
Real-time pricing from the on-chain AMM model is taken as a reference and used in risk calculation and liquidation. This is important for widening and speeding up the leverage trading market in a decentralized environment, compared to waiting for a Chainlink oracle to create or update market data. As Vitalik suggested, prices from a DEX provide native data are maintained onchain, secured by technical and economical design, and are the defacto oracle for more DeFi use cases, such as margin trading.
To avoid flash loan attacks, there are restrictions implemented in the protocol design:
- No open, close, or liquidation operations can be in the same transaction
- Liquidation refers to OnDemand Oracle to make sure the liquidation price is valid to avoid attackers manipulating prices, triggering liquidations to gain benefits, or creating cascading liquidation events.
1/3 of the transaction fees of the pair are set aside as insurance to compensate lenders if the loan fails to maintain the solvency of the pool.
Furthermore, each lending pool will have 20% of generated interests set aside as a reserve.