BTB
/

Curve LlamaLend

Lendingwebsite
Isolated lending markets from Curve. Lenders deposit crvUSD into a market vault to earn interest. Borrowers post a collateral token and borrow crvUSD in a loan that is liquidated gradually across bands. Anyone can read each market's loans and health.

What you can do

lendDeposit crvUSD into a market vault to earn the lending APRapprove crvUSD to the vault, then vault.deposit(amount)
unlendWithdraw crvUSD from a market vaultcheck maxRedeem(owner), then vault.redeem(shares) or vault.withdraw(assets); withdrawals depend on unborrowed liquidity
borrowOpen a loan with collateral and borrow crvUSDapprove the collateral token to the controller, then controller.create_loan(collateralAmount, debtAmount, N); check health and max_borrowable first
borrow-moreBorrow more on an existing loancontroller.borrow_more(0, debtAmount) or with extra collateral controller.borrow_more(collateralAmount, debtAmount) after approving collateral
repayRepay crvUSD on a loanapprove crvUSD to the controller, then controller.repay(amount); repaying the full debt closes the loan
check-positionRead a loan's health and debtcontroller.health(user, true), controller.debt(user), controller.user_state(user)
Loans are liquidated when health drops below 0. Soft liquidation across bands can start before a hard liquidation, so check health after price moves.
Each market has its own collateral token, oracle and N range. A bad collateral price can cause losses only in that market, but depositors in the market share that loss.
Lender withdrawals depend on unborrowed crvUSD. When utilization is high, redeem may return less than maxRedeem suggests or be unavailable until borrowers repay.
Market rates follow the monetary policy of each market and can change with utilization.

Contracts

Read any function, or build a write and sign it. Amounts are in base units (1 USDC = 1000000).
OneWayLendingFactory (Ethereum)factory on ethereum0xeA6876DDE9e3467564acBeE1Ed5bac88783205E0
read market_count()
Number of lending markets created by this factory on Ethereum. Use it with vaults(i) and controllers(i) to list every market.
read vaults(uint256)
Lender vault address of market index i. Deposit crvUSD into this vault to earn interest.
read controllers(uint256)
Controller address of market index i. Borrowers open and manage loans through this contract.
read collateral_tokens(uint256)
Collateral token of market index i.
read borrowed_tokens(uint256)
Borrowed token of market index i. This is crvUSD for every LlamaLend market.
read names(uint256)
Name of market index i, for example WETH-long.
Vault (WETH-long market, example)vault on ethereum0x5AE28c9197a4a6570216fC7e53E7e0221D7A0FEF
write deposit(uint256)
Lend crvUSD to this market. Argument: crvUSD amount in 18 decimals. Approve crvUSD to the vault first. Shares go to the caller.
write redeem(uint256)
Burn vault shares and receive crvUSD. Argument: share amount. Use maxRedeem first to see what is available right now, since withdrawals depend on unborrowed liquidity.
write withdraw(uint256)
Withdraw a crvUSD amount by burning the matching shares. Argument: crvUSD amount. Limited by available liquidity.
read maxRedeem(address)
Maximum shares the owner can redeem right now.
read lend_apr()
Current lending APR for suppliers. Scaled to 1e18.
read borrow_apr()
Current borrowing APR. Scaled to 1e18.
read totalAssets()
Total crvUSD held by the vault, including amounts lent out.
write approve(address,uint256)
Approve a spender for vault share tokens. Only needed if the shares are moved by another contract.
Controller (WETH-long market, example)pool on ethereum0xaade9230AA9161880E13a38C83400d3D1995267b
write create_loan(uint256,uint256,uint256)
Open a loan. Arguments: collateral amount, crvUSD debt amount, N (number of soft-liquidation bands, which sets the liquidation range). Approve the collateral token to this controller first. Reverts if the loan would be too close to liquidation.
write add_collateral(uint256)
Add collateral to your own loan. Argument: collateral amount. Approve the collateral token first.
write remove_collateral(uint256)
Remove collateral from your loan. Argument: collateral amount. Reverts if the loan would become unhealthy.
write borrow_more(uint256,uint256)
Increase your debt. Arguments: collateral added (0 for none), crvUSD to borrow. Reverts if the loan would become unhealthy.
write repay(uint256)
Repay crvUSD debt on your loan. Argument: crvUSD amount. Approve crvUSD to this controller first. Repaying the full debt closes the loan.
read health(address,bool)
Health of a loan as an int256 scaled to 1e18. Arguments: user, full flag (true counts the full position). Below 0 means liquidatable.
read debt(address)
Current crvUSD debt of a user on this market.
read loan_exists(address)
True if the user has an open loan on this market.
read user_state(address)
Four uint256 values describing a user's loan state (collateral, stablecoin and debt figures, plus band data). Read the Curve docs for the field order before relying on a single value.
read max_borrowable(uint256,uint256,uint256)
Largest crvUSD debt a collateral amount can support over N bands. Arguments: collateral, N, current debt (0 for a new loan).
read min_collateral(uint256,uint256)
Minimum collateral needed for a debt over N bands. Arguments: debt, N.
OneWayLendingFactory (Arbitrum)factory on arbitrum0xcaEC110C784c9DF37240a8Ce096D352A75922DeA
read market_count()
Number of lending markets on Arbitrum. Use with vaults(i) and controllers(i) to list them.
read vaults(uint256)
Lender vault address of market index i on Arbitrum.
read controllers(uint256)
Controller address of market index i on Arbitrum.
read collateral_tokens(uint256)
Collateral token of market index i on Arbitrum.
OneWayLendingFactory (Optimism)factory on optimism0x5EA8f3D674C70b020586933A0a5b250734798BeF
read market_count()
Number of lending markets on Optimism. Use with vaults(i) and controllers(i) to list them.
read vaults(uint256)
Lender vault address of market index i on Optimism.
read controllers(uint256)
Controller address of market index i on Optimism.
read collateral_tokens(uint256)
Collateral token of market index i on Optimism.
OneWayLendingFactory (Fraxtal)factory on fraxtal0xf3c9bdAB17B7016fBE3B77D17b1602A7db93ac66
read market_count()
Number of lending markets on Fraxtal. Use with vaults(i) and controllers(i) to list them.
read vaults(uint256)
Lender vault address of market index i on Fraxtal.
read controllers(uint256)
Controller address of market index i on Fraxtal.