osmosis-labs / isotonic

Smart Contracts for the Lendex Protocol
MIT License
1 stars 0 forks source link

Add cap to each market #65

Closed ethanfrey closed 2 years ago

ethanfrey commented 2 years ago

When constructing a Market, you can provide a cap on the size of the market. This will limit how much money can be stored in the market. When depositing tokens to mint LTokens, we enforce this cap. It may exceed it via interest and repayments, but that should be a relatively minor amount, not like $100 million in a market designed for $2 million.

This can be set in init messages and adjusted via Governance https://github.com/confio/lendex/issues/48

It is only enforce on minting, and measure in terms of the underlying token (denom - or DisplayBalance). Not number of LTokens or taking into account price. It should be stable and clear

Note this cap is Option<Uint128>. You can also create uncapped markets

Note: We cap hard on deposit at the limit. User should get a hint before depositing how much the max is, and if depositing more, be told what the max is.