Notes
- Unlike Compound V2, the lToken’s own supply/borrow/redeem functions are callable only by Core
- Must call
enterMarketson 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
- Protocols: the other protocols, by what they do.
- Protocols and tokens: calling a contract by its namespace, or through its ABI.
- Glossary: the words these pages use, in plain terms.
