What you can do
| lend | Supply loan token to a market | Approve the loan token, then Moolah.supply(marketParams, assets, 0, onBehalf, "0x") |
| post collateral | Supply collateral to a market | Approve the collateral token, then Moolah.supplyCollateral(marketParams, assets, onBehalf, "0x") |
| borrow | Borrow loan token against collateral | Moolah.borrow(marketParams, assets, 0, onBehalf, receiver) after posting collateral and checking isHealthy |
| repay | Repay loan token debt | Approve the loan token, then Moolah.repay(marketParams, assets, 0, onBehalf, "0x") |
| withdraw | Withdraw lent loan token or collateral | Moolah.withdraw(marketParams, assets, 0, onBehalf, receiver) or Moolah.withdrawCollateral(marketParams, assets, onBehalf, receiver) |
| liquidate | Repay an unhealthy borrower debt and seize collateral | Approve the loan token, then Moolah.liquidate(marketParams, borrower, 0, repaidShares, "0x"). Check the liquidation whitelist first. |
| read market | Read a market and a user position | Moolah.idToMarketParams(id), Moolah.market(id), Moolah.position(id, user) |
Each market has its own oracle, interest rate model and LLTV. A bad oracle affects its market and can create bad debt there.
Some markets restrict liquidations to a whitelist, so liquidators outside it cannot act.
Broker and provider roles can act on some markets. Check a market brokers and providers before relying on it.
The proxies are upgradeable by their admin. The implementations have changed since the first deployment.
Contracts
Read any function, or build a write and sign it. Amounts are in base units (1 USDC = 1000000).Moolah proxy (BNB Chain)pool on bnb0x8F73b65B4caAf64FBA2aF91cC5D4a2A1318E5D8C
write supply((address,address,address,address,uint256),uint256,uint256,address,bytes)
Supply loan token to a market: (marketParams, assets, shares, onBehalf, data). Pass assets or shares, and set the other to 0. Use empty bytes for data. Approve the loan token to Moolah first.
write withdraw((address,address,address,address,uint256),uint256,uint256,address,address)
Withdraw loan token: (marketParams, assets, shares, onBehalf, receiver). Pass assets or shares, and set the other to 0. msg.sender must be authorized for onBehalf.
write borrow((address,address,address,address,uint256),uint256,uint256,address,address)
Borrow loan token: (marketParams, assets, shares, onBehalf, receiver). Needs collateral in the market. msg.sender must be authorized for onBehalf. The borrowed assets go to receiver.
write repay((address,address,address,address,uint256),uint256,uint256,address,bytes)
Repay loan token debt: (marketParams, assets, shares, onBehalf, data). Approve the loan token to Moolah first. Repaying more shares than borrowed reverts.
write supplyCollateral((address,address,address,address,uint256),uint256,address,bytes)
Post collateral: (marketParams, assets, onBehalf, data). Approve the collateral token to Moolah first. No interest is accrued in this call.
write withdrawCollateral((address,address,address,address,uint256),uint256,address,address)
Withdraw collateral: (marketParams, assets, onBehalf, receiver). msg.sender must be authorized for onBehalf. Reverts if it would withdraw more collateral than the position holds.
write liquidate((address,address,address,address,uint256),address,uint256,uint256,bytes)
Liquidate an unhealthy borrower: (marketParams, borrower, seizedAssets, repaidShares, data). Pass seizedAssets or repaidShares, and set the other to 0. Approve the loan token first. Some markets restrict liquidators to a whitelist.
write flashLoan(address,uint256,bytes)
Flash loan a token from the core contract: (token, assets, data). The receiver must repay in the same transaction. Some tokens are blacklisted.
write setAuthorization(address,bool)
Authorize or revoke an address to manage your positions in every market: (authorized, isAuthorized).
read isHealthy((address,address,address,address,uint256),bytes32,address)
True if a borrower is healthy in a market: (marketParams, marketId, borrower).
read getPrice((address,address,address,address,uint256))
Oracle price used by the market for collateral valuation.
read position(bytes32,address)
Supply shares, borrow shares and collateral of a user in a market: (marketId, user).
read market(bytes32)
Market totals (supply, borrow, last update and fee) for a market id.
read idToMarketParams(bytes32)
MarketParams (loan token, collateral token, oracle, interest rate model, LLTV) for a market id.
Moolah proxy (Ethereum)pool on ethereum0xf820fB4680712CD7263a0D3D024D5b5aEA82Fd70
write supply((address,address,address,address,uint256),uint256,uint256,address,bytes)
Supply loan token to a market: (marketParams, assets, shares, onBehalf, data). Pass assets or shares, and set the other to 0. Use empty bytes for data. Approve the loan token to Moolah first.
write withdraw((address,address,address,address,uint256),uint256,uint256,address,address)
Withdraw loan token: (marketParams, assets, shares, onBehalf, receiver). Pass assets or shares, and set the other to 0. msg.sender must be authorized for onBehalf.
write borrow((address,address,address,address,uint256),uint256,uint256,address,address)
Borrow loan token: (marketParams, assets, shares, onBehalf, receiver). Needs collateral in the market. msg.sender must be authorized for onBehalf. The borrowed assets go to receiver.
write repay((address,address,address,address,uint256),uint256,uint256,address,bytes)
Repay loan token debt: (marketParams, assets, shares, onBehalf, data). Approve the loan token to Moolah first. Repaying more shares than borrowed reverts.
write supplyCollateral((address,address,address,address,uint256),uint256,address,bytes)
Post collateral: (marketParams, assets, onBehalf, data). Approve the collateral token to Moolah first. No interest is accrued in this call.
write withdrawCollateral((address,address,address,address,uint256),uint256,address,address)
Withdraw collateral: (marketParams, assets, onBehalf, receiver). msg.sender must be authorized for onBehalf. Reverts if it would withdraw more collateral than the position holds.
write liquidate((address,address,address,address,uint256),address,uint256,uint256,bytes)
Liquidate an unhealthy borrower: (marketParams, borrower, seizedAssets, repaidShares, data). Pass seizedAssets or repaidShares, and set the other to 0. Approve the loan token first. Some markets restrict liquidators to a whitelist.
write flashLoan(address,uint256,bytes)
Flash loan a token from the core contract: (token, assets, data). The receiver must repay in the same transaction. Some tokens are blacklisted.
write setAuthorization(address,bool)
Authorize or revoke an address to manage your positions in every market: (authorized, isAuthorized).
read isHealthy((address,address,address,address,uint256),bytes32,address)
True if a borrower is healthy in a market: (marketParams, marketId, borrower).
read getPrice((address,address,address,address,uint256))
Oracle price used by the market for collateral valuation.
read position(bytes32,address)
Supply shares, borrow shares and collateral of a user in a market: (marketId, user).
read market(bytes32)
Market totals (supply, borrow, last update and fee) for a market id.
read idToMarketParams(bytes32)
MarketParams (loan token, collateral token, oracle, interest rate model, LLTV) for a market id.