Lista DAO 백서

Lista DAO

원문

bitpro가 원문에서 글자만 모은 내용이에요. 표·그림·수식은 빠지거나 깨질 수 있어요. 전체 53쪽 중 17쪽

single role. *** ## Layer 2 — the market: `getPrice(MarketParams)` A Moolah market's price is the collateral asset priced **in the loan asset**, not in USD. This is the number Moolah's health and liquidation math actually consumes. ```solidity struct MarketParams { address loanToken; address collateralToken; address oracle; address irm; uint256 lltv; } interface IMoolah { function idToMarketParams(Id id) external view returns (MarketParams memory); function getPrice(MarketParams calldata marketParams) external view returns (uint256); function isHealthy(MarketParams calldata marketParams, Id id, address borrower) external view returns (bool); } ``` `getPrice` is `view`. Under the hood it reads both legs from the market's oracle (`oracle.peek(collateralToken)` and `oracle.peek(loanToken)`) and combines them with a fixed scale factor. ### The market scale factor From `Moolah.getPrice` / `_getPrice`, with `base = collateralToken` and `quote = loanToken`: ```solidity uint256 scaleFactor = 10 ** (36 + quoteTokenDecimals - baseTokenDecimals); return scaleFactor.mulDivDown(basePrice, quotePrice); // = scaleFactor * basePrice / quotePrice (rounded down) ``` where `basePrice = peek(collateralToken)`, `quotePrice = peek(loanToken)`, `baseTokenDecimals = IERC20Metadata(collateralToken).decimals()`, and `quoteTokenDecimals = IERC20Metadata(loanToken).decimals()`. Because the same feed decimals appear in both `basePrice` and `quotePrice`, they cancel in the ratio, and the `36 + quoteDecimals − baseDecimals` exponent normalizes the result to Moolah's canonical price scale. The result is deliberately targeted at the constant: ```solidity uint256 constant ORACLE_PRICE_SCALE = 1e36; ``` Read `getPrice` as a **raw-unit conversion factor, not a human-readable price**: multiplying a raw collateral amount (in the collateral token's own decimals) by `getPrice` and dividing by `1e36` yields the equivalent debt in **raw loan-token units** — `rawCollateral × getPrice / 1e36 = rawLoan`. Because the scale factor carries `10**(quoteDecimals − baseDecimals)`, `getPrice / 1e36` equals the per-whole-token price *only when both tokens share the same decimals*; for a human "1 collateral = X loan tokens" price across different decimals, apply the token decimals yourself (or derive it from the two USD legs via `peek`). The health and liquidation math below works entirely in raw units, so you never need the human price for on-chain-accurate results. > Broker markets note. `getPrice(marketParams)` calls the internal price with `user = address(0)`, which always returns the plain market price. For fixed-term/credit **broker** markets, an account-specific price can deviate from the market price; the protocol uses the market price for the standard health check so liquidators can act in time. Unless you are integrating a broker product, `getPrice(marketParams)` is the number you want. See [Broker Reference](/for-developer/lista-lending/broker-reference). *** ## Computing health with the scale factor Moolah's health check (`Moolah._isHealthy`) is: ```solidity uint256 maxBorrow = uint256(position.collateral) .mulDivDown(collateralPrice, ORACLE_PRICE_SCALE) // collateral * price / 1e36 .wMulDown(marketParams.lltv); // * lltv / 1e18 bool healthy = maxBorrow >= borrowed; // borrowed rounded up ``` where: * `collateralPrice = getPrice(marketParams)` (the `1e36`-scaled collateral-in-loan price). * `position.collateral` is the raw collateral amount in the collateral token's own decimals. * `borrowed` is the borrower's debt in loan-token units (borrow shares converted to assets, rounded **up** in the protocol's favor). * `lltv` is WAD-scaled (`1e18` = 100%), and `wMulDown(x, lltv) = x * lltv / 1e18`. So the collateral's borrowing power, in loan-token units, is: ``` maxBorrow = collateral * getPrice / 1e36 * lltv / 1e18 ``` The position is healthy while `maxBorrow >= borrowed`. Note the two independent scale divisions: `1e36` (the price scale) and `1e18` (the LLTV WAD). Dropping either one is the most common integration error. You do not have to reproduce this off-chain to answer "is this position healthy?" — Moolah exposes `isHealthy(marketParams, id, borrower)` as a `view` function that applies the protocol's health formula. > It is **not** execution-equivalent. The view reads the market's *stored* totals, whereas `borrow`, `withdrawCollateral`, and `liquidate` all call `_accrueInterest` first. A position can therefore pass the view and still fail on execution once accrued interest is folded into the debt. For an execution-equivalent answer, simulate the call, or accrue interest first (`accrueInterest` is permissionless) and read the view immediately after. ### Read-only example (viem) ```typescript import { createPublicClient, http } from "viem"; const client = createPublicClient({ transport: http(RPC_URL) }); // 1. Resolve the market's params from its id (bytes32). // `idToMarketParams` is a public-mapping getter, so its ABI outputs are five // FLATTENED values, not a struct — viem returns an array. Destructure it; // reading `.lltv` off the result is undefined. const [loanToken, collateralToken, oracle, irm, lltv] = await client.readContract({ address: MOOLAH, abi: MOOLAH_ABI, functionName: "idToMarketParams", args: [marketId], }); const marketParams = { loanToken, collateralToken, oracle, irm, lltv }; // 2. Collateral price, quoted in the loan token, scaled by 1e36. const price = await client.readContract({ address: MOOLAH, abi: MOOLAH_ABI, functionName: "getPrice", args: [marketParams], }); // bigint // 3. Borrowing power of `collateral` units, in loan-token units. const ORACLE_PRICE_SCALE = 10n ** 36n; const WAD = 10n ** 18n; const maxBorrow = ((collateral * price) / ORACLE_PRICE_SCALE) * lltv / WAD; const healthy = maxBorrow >= borrowed; ``` `collateral` and `borrowed` here are raw on-chain integers in each token's own decimals; do not pre-scale them. `getPrice` already accounts for the decimal difference between the two tokens. ## Liquidation price The health boundary is where `maxBorrow == borrowed`. Solving the health inequality for the collateral price gives the **liquidation price** — the `getPrice` value at which a position with fixed `collateral` and `borrowed` becomes eligible for liquidation: ``` liquidationPrice = borrowed * 1e36 * 1e18 / (collateral * lltv) ``` (all values raw, in their native units/scales). The position becomes liquidatable once `getPrice(marketParams)` falls below `liquidationPrice`. > Treat that as an **approximate analytical threshold, not an exact integer boundary.** The on-chain check is `maxBorrow >= borrowed`, where `maxBorrow` is floored twice and `borrowed` is rounded up — all in the protocol's favour — so a position can already be liquidatable *at* the computed price. Use this formula to rank and monitor candidates, and `isHealthy` or a simulated transaction to decide whether a specific position can actually be liquidated right now. The same scale appears when collateral is seized (`Moolah.liquidate`): the loan-token value of seized collateral is `seizedAssets.mulDivUp(collateralPrice, ORACLE_PRICE_SCALE)`. That equals `seizedAssets * getPrice / 1e36` **only on non-broker markets** — `liquidate` prices with `_getPrice(marketParams, borrower)`, which routes through the broker when one is set, so on a broker market it is not the `getPrice` value. The liquidation incentive factor and cursor are **compile-time constants** (`LIQUIDATION_CURSOR`, `MAX_LIQUIDATION_INCENTIVE_FACTOR` in `ConstantsLib`), not governance-tunable parameters. *** ## Checklist for integrators * **Pricing a position's health / a liquidation:** use `getPrice(marketParams)` and divide by `ORACLE_PRICE_SCALE` (`1e36`), then apply `lltv` with the `1e18` WAD. Never mix in a raw `peek` value here. * **Need a single asset's USD value:** use `oracle.peek(asset)` and confirm that feed's decimals before scaling. * **Auditing a market's oracle:** read `marketParams.oracle`, then `getTokenConfig(collateralToken)` to see the main/pivot/fallback sources, enabled flags, and staleness tolerance; cross-reference the addresses on [Standard Collaterals](/for-developer/multi-oracle/multi-oracle-standard) / [bStock Collaterals](/for-developer/multi-oracle/multi-oracle-bstock). * **All of these are `view` calls** — no transaction needed. They are not all unconditionally callable, though: for a **bStock** collateral, `StockOracle` reverts with `StockMarketClosed()` while the market is flagged closed, so `peek` and `getPrice` revert for that asset. `isHealthy` reverts too **unless** the position has no debt, in which case it returns `true` without touching the oracle. Treat the revert as expected protocol state, not an RPC fault. Note the closed flag is not a clock — it is a manager-level global switch, a per-stock bot flag, and a pauser-level emergency close, so it will not always line up with exchange hours. ## Related pages * [Oracle](/introduction/lista-lending/oracle) — conceptual overview of oracles in Lista Lending. * [Moolah Lending SDK](/for-developer/lista-lending/sdk) — TypeScript helpers that read market data and prices for you. # LISTA Governance `LISTA` is the protocol's governance and incentive token. > **veLISTA is being retired under LIP-024.** New locking has been disabled on-chain since 2026-04-07 and governance voting has moved to plain LISTA on Snapshot. Existing locks can still be exited — see the Smart Contract page for the exit path and its one exception. * [Smart Contract](/for-developer/lista-governance/smart-contract) — `LISTA`, the voting-escrow contracts, the retirement state and the emission distributors. # Smart Contract > **veLISTA is being retired under LIP-024.** The on-chain switch is `freePenaltyStartTime` = **2026-04-07 08:20 UTC**. From that moment `lock`, `relockUnclaimed`, `increaseAmount` / `increaseAmountFor` and `extendWeek` all revert with `free penalty period start`, and `getPenalty(address)` returns `0` for every account **while `block.timestamp` is within `[freePenaltyStartTime, freePenaltyEndTime]`** — see the bounded-window caveat below before relying on it past that. `enableAutoLock` / `disableAutoLock` remain callable on existing positions. Governance voting has moved to plain LISTA on Snapshot, and protocol revenue previously distributed to veLISTA stakers now funds LISTA buybacks. > > Existing locks can still be exited without penalty. There is no `withdraw` function, and the two exits are **mutually exclusive**: > > * `claim()` — only once the lock term has elapsed **and** the position is not auto-locked. Otherwise it reverts `no claimable tokens`. > * `earlyClaim()` — only while the position is still locked or auto-locked. Otherwise it reverts `cannot claim with penalty`. > > Two caveats. The penalty-free period is a bounded window that a `MANAGER` can change — read `freePenaltyEndTime` before relying on it. And `earlyClaim` checks an independent `earlyClaimBlacklist` before anything else. A blacklisted auto-locked position therefore cannot use `earlyClaim()`, and `claim()` is blocked while auto-lock is on — but the exit is **delayed, not removed**: `disableAutoLock()` is not gated by the penalty-free modifier and carries no blacklist check, and it converts the position to a fixed term ending `lockWeeks` weeks later, after which `claim()` works penalty-free. Worst case is a 52-week wait. > > The `veLista*` contracts below stay readable on-chain and existing positions can still be exited through them, but they should not be used for new integrations. ## Main <table><thead><tr><th width="289">Name</th><th>Contract Address</th></tr></thead><tbody><tr><td>veLista <em>(retired · LIP-024)</em></td><td><a href="https://bscscan.com/address/0xd0C380D31DB43CD291E2bbE2Da2fD6dc877b87b3">0xd0C380D31DB43CD291E2bbE2Da2fD6dc877b87b3</a></td></tr><tr><td>veListaDistributor <em>(retired · LIP-024)</em></td><td><a href="https://bscscan.com/address/0x45aAc046Bc656991c52cf25E783c6942425ce40C">0x45aAc046Bc656991c52cf25E783c6942425ce40C</a></td></tr><tr><td>LISTA</td><td><a href="https://bscscan.com/address/0xFceB31A79F71AC9CBDCF853519c1b12D379EdC46">0xFceB31A79F71AC9CBDCF853519c1b12D379EdC46</a></td></tr><tr><td>Lista Airdrop <em>(closed)</em></td><td><a href="https://bscscan.com/address/0x2ed866Ca9C33bf695C78af222d61Bd4D9cB558d3">0x2ed866Ca9C33bf695C78af222d61Bd4D9cB558d3</a></td></tr><tr><td>ListaVault</td><td><a href="https://bscscan.com/address/0x307d13267f360f78005f476fa913f8848f30292a">0x307d13267f360f78005f476Fa913F8848F30292A</a></td></tr><tr><td>OracleCenter</td><td><a href="https://bscscan.com/address/0x946a68b29149f819FBcE866cED3632e0C9F7C53b">0x946a68b29149f819FBcE866cED3632e0C9F7C53b</a></td></tr><tr><td>BorrowLisUSDListaDistributor</td><td><a href="https://bscscan.com/address/0x0aed860ca496600f6976219cb1acec435d7f4f3b">0x0AED860cA496600F6976219Cb1acEc435d7F4f3B</a></td></tr><tr><td>StakeLisUSDListaDistributor</td><td><a href="https://bscscan.com/address/0xFeB28443692216f66D14C7be4a449a765E2BDbAc">0xFeB28443692216f66D14C7be4a449a765E2BDbAc</a></td></tr><tr><td>EmissionVoting <em>(retired · LIP-024)</em></td><td><a href="https://bscscan.com/address/0xfc136f286805a7922d9bf04317068964b231336c#code">0xfc136f286805a7922d9bf04317068964b231336c</a></td></tr><tr><td>VeListaRevenueDistributor <em>(retired · LIP-024)</em></td><td><a href="https://bscscan.com/address/0xE4153Eb04417bE05b8d6B2222E4Cdd8AE674ee76">0xE4153Eb04417bE05b8d6B2222E4Cdd8AE674ee76</a></td></tr><tr><td>VeListaInterestRebater <em>(retired · LIP-024)</em></td><td><a href="https://bscscan.com/address/0xda1E93d58CCCC9683f9Cb051cAEC5CF2F01B3253">0xda1E93d58CCCC9683f9Cb051cAEC5CF2F01B3253</a></td></tr></tbody></table> ## LP Staking LISTA emissions reach staking pools through per-pool **distributor** contracts fed by `ListaVault`. The set of distributors is on-chain and changes over time, so read it from the vault rather than from a list here: ```solidity // ListaVault — address in the Main table above function distributorId() external view returns (uint16); // highest id issued so far function idToDistributor(uint16 id) external view returns (address); function getDistributorWeeklyEmissions(uint16 id, uint16 week) external view returns (uint256); function getWeek(uint256 timestamp) external view returns (uint16); function distributorBlacklist(uint16 id) external view returns (bool); ``` Ids are issued sequentially from `1` and never reused, so `idToDistributor(i)` for `i` in `1..distributorId()` is the complete registry. A distributor's **registration does not mean it is being funded** — check `getDistributorWeeklyEmissions(id, getWeek(block.timestamp))` for the week you care about; a `0` there means no emission was allocated to it that week. `claimableList(account, distributors)` returns a user's claimable amount per distributor in one call. ### Staking and vault infrastructure | Name | Address | | -------------- | ------------------------------------------ | | PancakeStaking | 0xE31f0BcE1F825A8e27f2Cc30B54af19DA2978f10 | | ThenaStaking | 0xFA5B482882F9e025facCcE558c2F72c6c50AC719 | | PancakeVault | 0x62DfeC5C9518fE2e0ba483833d1BAD94ecF68153 | | ThenaVault | 0xF40D0d497966fe198765877484FFf08c2D2004ad | | LpProxy | 0x5A0E3291514F5F1797A0C7eFefdac81eeC70ec01 | # Collateral Debt Position The CDP is Lista's original borrowing product: deposit collateral, mint the **lisUSD** stablecoin against it. It is a MakerDAO/Helio-style engine — `Vat`, `Jug`, `Spotter`, `Dog`, `Clipper` and `Vow` behind an `Interaction` entrypoint. > **This product is being wound down.** New borrowing reverts protocol-wide and both deposits and liquidation auctions are whitelisted. Build new integrations against [Lista Lending](/for-developer/lista-lending) instead. * [Mechanics](/for-developer/collateral-debt-position/mechanics) — the live gates, and how an existing position is unwound. * [Flash Loan](/for-developer/collateral-debt-position/flash-loan) — ERC-3156 flash minting of lisUSD, which still works. * [CDP API](/for-developer/collateral-debt-position/api) — read-side endpoints for existing positions. * [Smart Contract](/for-developer/collateral-debt-position/smart-contract) — deployed addresses. # Mechanics The Collateral Debt Position (CDP) module lets a user deposit collateral and mint **lisUSD** against it. It is a MakerDAO/Helio-style fork: `Vat`, `Jug`, `Spotter`, `Dog`, `Clipper`, `Abacus` and `Vow` behind the **Interaction** entrypoint. > ## This product is being wound down > > **Do not build new integrations against it.** Use [Lista Lending](/for-developer/lista-lending) instead — it is the actively developed lending product and has a full [integration guide](/for-developer/lista-lending/integration-patterns), [contract reference](/for-developer/lista-lending/contract-reference) and [SDK](/for-developer/lista-lending/sdk). > > Most of the CDP's user-facing surface is already closed. Verify each of these live before assuming otherwise: > > What still works: repaying, withdrawing collateral, and liquidation of the positions that remain. | Check | Current value | Effect | | ------------------------------------ | ------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | `Vat.Line()` | `0` | **All new borrowing reverts** `Vat/ceiling-exceeded`, protocol-wide, regardless of the per-collateral `line`. | | `Interaction.whitelistMode()` | `1` | Deposits are whitelisted. The gate is on the **participant**, not the caller, so an integrator cannot deposit for a non-whitelisted user. | | `Interaction.auctionWhitelistMode()` | `1` | Starting, buying from and resetting auctions are restricted to `Interaction.auctionWhitelist`. This fork adds `auth` to `Clipper.take`/`redo`, so unlike upstream MakerDAO there is **no open keeper or buyer role**. | ## Unwinding an existing position | Call | Purpose | | ------------------------------------------------ | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | `Interaction.locked(token, usr)` | Collateral deposited (`ink`). | | `Interaction.borrowed(token, usr)` | Current lisUSD debt (`art * rate / RAY`). When the debt is non-zero this adds a flat 100-wei buffer so a repay can fully clear the position — repay the value it returns, not your own computation. | | `Interaction.payback(token, amount)` | Repay lisUSD. Burns via `HayJoin` and reduces `art`. | | `Interaction.withdraw(participant, token, dink)` | Withdraw collateral, subject to the position staying safe. Note the **three** parameters with `participant` first — there is no two-argument form. When the collateral has no provider, `msg.sender` must equal `participant`; when it does have one (slisBNB, for example), the withdrawal has to be driven through that provider so the certificate token is unwrapped — unless a `MANAGER` has flipped `providerCompatibilityMode[token]` on for that collateral, which additionally allows `participant` to call directly. Read the mapping rather than assuming; it is currently `false` for slisBNB. | A position is safe while `ink * spot >= art * rate`. `spot` already has the liquidation ratio applied, so it sits below the raw oracle price. Interest accrues into the Vat's per-collateral rate ac
프로젝트로 돌아가기