Skip to content

LLAMMA and Controller


The source code for both contracts, AMM.vy and Controller.vy, is available on GitHub.

Because Curve Lending operates very similarly to the system for minting crvUSD, both Controller.vy and AMM.vy can be used for lending markets. To ensure full compatibility with both systems, several modifications have been made to the codebase:


Full LLAMMA Documentation

The core contract AMM.vy (LLAMMA) remains exactly the same. It is already precisely what we need for lending; no changes are needed.


Full Controller Documentation

The changes made to the codebase of the Controller contract are mainly under-the-hood changes, which do not significantly affect how users interact with the contract. External functions like create_loan, repay, etc., work the same way as before.

The following changes have been made:

  • The Controller now has the ability to handle not only 18-digit tokens (like crvUSD) but also tokens with any number of digits. For this, there were multiple changes to ensure rounding always rounds up in favor of the existing borrowers.

  • The collect_fees() method will not work in lending. Admin fees are set to zero, and all the interest will go to the vault depositors. Moreover, AMM admin fees cannot be charged: their claim would fail too. The system is designed to make money on fees generated by crvUSD itself.

  • The contract that creates the Controller has collateral_token() and borrowed_token() public methods instead of a stablecoin() method. This keeps the code clean and understandable when a stablecoin is collateral, not the borrowed asset. However, compatibility with the stablecoin() method is preserved.

  • Transfers of native ETH are removed for safety. To enhance safety with unknown variables, automatic wrapping of ETH is disabled permanently.