Skip to main content
Lending protocol on Scroll. Compound-style markets (lTokens), but every user action goes through the Core contract, which names the market.

Notes

  • Unlike Compound V2, the lToken’s own supply/borrow/redeem functions are callable only by Core
  • Must call enterMarkets on Core before borrowing against any market
  • Scroll-only deployment

Its names in a program

On Scroll, Layerbank is a namespace: its contracts need no import.

Deployments

ABI

Where a line says what an address it returns is, a program that calls the function through its namespace calls that contract’s methods on the result directly: <Namespace>.<Contract>.<function>(...).<method>(...). A token’s methods are the ERC-20 functions, and its writes are SafeERC20.

LTokenABI

import LTokenABI from "./protocols/layerbank/LTokenABI.json";
  • balanceOf(address account) view returns (uint256)
  • underlyingBalanceOf(address account) view returns (uint256)
  • borrowBalanceOf(address account) view returns (uint256)
  • exchangeRate() view returns (uint256)
  • underlying() view returns (address): the address is a token

LayerBankCoreABI

import LayerBankCoreABI from "./protocols/layerbank/LayerBankCoreABI.json"; Speaks for: core.
  • enterMarkets(address[] lTokens)
  • exitMarket(address lToken)
  • supply(address lToken, uint256 uAmount) payable returns (uint256)
  • redeemToken(address lToken, uint256 lAmount) returns (uint256)
  • redeemUnderlying(address lToken, uint256 uAmount) returns (uint256)
  • borrow(address lToken, uint256 amount)
  • repayBorrow(address lToken, uint256 amount) payable

Next steps