LLAMMA and Controller
AMM.vy & Controller.vyLlamalend uses Controller V3 — the same blueprint that powers the latest crvUSD mint markets (weETH, cbBTC, LBTC). The Controller and AMM contracts originated in the crvUSD system and were extended for lending use. For a full version history including the evolution from crvUSD V1 through V3, see the crvUSD Overview.
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 were made in V3:
AMM.vy (LLAMMA)The core contract AMM.vy (LLAMMA) remains exactly the same as in the crvUSD system. No changes were needed for lending.
Controller.vyThe Controller has been modified for lending with changes to token decimal handling, fee collection, and ETH transfer behavior.
Changes to Controller.vy
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()andborrowed_token()public methods instead of astablecoin()method. This keeps the code clean and understandable when a stablecoin is collateral, not the borrowed asset. However, compatibility with thestablecoin()method is preserved. -
Transfers of native ETH are removed for safety. To enhance safety with unknown variables, automatic wrapping of ETH is disabled permanently.