Meteora 백서

Meteora

원문

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

| | Finalize cleanup | Leftover, LP-token claims, DAMM v2 positions, and one-time claim flags settle according to the migration path. | ## Product Building Blocks <CardGroup> <Card title="DBC Universal Curve" href="/core-products/dbc/universal-curve" icon="chart-simple"> Learn how single-segment and multi-segment curves shape launch price discovery. </Card> <Card title="DBC Launch Configuration" href="/core-products/dbc/launch-configurations" icon="gear"> Review the config fields around token setup, supply, migration, liquidity locks, and claim addresses. </Card> <Card title="DBC Fees" href="/core-products/dbc/fees/overview" icon="percent"> Compare base fee modes, dynamic fees, fee collection, and fee sharing. </Card> <Card title="DBC Migration and Liquidity" href="/core-products/dbc/migration-and-liquidity" icon="arrow-right"> See how completed curves graduate into DAMM pools, liquidity ownership, locks, and vesting. </Card> <Card title="DBC Surplus and Leftover" href="/core-products/dbc/surplus-and-leftover" icon="coins"> Learn how extra quote tokens and unused fixed-supply base tokens are handled after curve completion and migration. </Card> <Card title="DBC Token 2022 Support" href="/core-products/dbc/token-2022-support" icon="certificate"> Understand how DBC supports Token 2022 base tokens, quote mints, and quote-mint token badges. </Card> <Card title="DBC Transfer Hook Pools" href="/core-products/dbc/transfer-hook-pools" icon="code-branch"> Learn how Token 2022 transfer-hook pools trade during the bonding phase and graduate to DAMM v2. </Card> <Card title="DBC Accounts and Permissions" href="/core-products/dbc/accounts-and-permissions" icon="key"> Review the main state accounts, lifecycle flags, permission gates, and implementation limits. </Card> </CardGroup> <CardGroup> <Card title="DBC Formulas" href="/core-products/dbc/formulas" icon="calculator"> Understand the core product math behind price movement, curve reserves, migration, fees, and surplus. </Card> </CardGroup> ## Who DBC Is For <AccordionGroup> <Accordion title="Launchpads"> DBC is built for launchpads that want repeatable token launch templates. A partner can define the curve, fees, migration target, LP distribution, and creator economics once, then let many creators launch from that configuration. </Accordion> <Accordion title="Token Creators"> DBC helps creators launch with built-in price discovery, migration, Token 2022 support, and configurable post-migration liquidity instead of assembling those pieces separately. </Accordion> <Accordion title="Traders"> Traders get a transparent on-chain curve during the launch phase and a familiar Meteora DAMM pool after graduation. </Accordion> <Accordion title="Ecosystem Integrators"> Aggregators, trading terminals, bots, and dashboards can track a clear launch lifecycle: virtual pool trading first, DAMM pool trading after migration. </Accordion> </AccordionGroup> <Warning> DBC is highly configurable. Launch teams should choose curve shape, fee behavior, migration target, and liquidity distribution carefully because these settings define the economics of the launch. </Warning> # DLMM Collect Fee Mode Source: https://docs.meteora.ag/core-products/dlmm/collect-fee-mode Compare DLMM's InputOnly and OnlyY fee collection modes and how each affects LP fees, limit orders, quote-token economics, and launch design. DLMM Collect Fee Mode determines which token is used to collect trading fees during swaps. It is a pool-level setting that shapes how fees accrue to LPs and limit-order participants. This matters because fee currency is part of the product design of a pool. Some pools should let LPs earn fees in whichever token traders bring into the swap. Other pools, especially launch or quote-driven markets, may prefer fees to accumulate in a single quote-style token. ## Modes DLMM currently supports two collect fee modes: | Mode | Value | What It Means | Best Fit | | - | -: | - | - | | `InputOnly` | `0` | Fees are collected from the token entering the swap. | General-purpose pools where LPs are comfortable earning fees in both sides depending on swap direction. | | `OnlyY` | `1` | Fees are collected in token Y, even when token Y is the output token. | Pools that want a more predictable fee token, often when token Y is the quote asset. | <Note>Existing pools have their own configured mode. Pool creators should choose the mode that best matches the pool's economic design before launch.</Note> ## InputOnly `InputOnly` collects fees from the input token of the swap. If a trader swaps token X for token Y, the fee is collected in token X. If a trader swaps token Y for token X, the fee is collected in token Y. <CardGroup> <Card title="Balanced Fee Exposure" icon="scale-balanced"> LPs can earn fees in both assets over time, depending on market flow. </Card> <Card title="General Pool Design" icon="arrows-rotate"> Useful for pools where both assets are meaningful to LPs and neither side needs to be the exclusive fee token. </Card> </CardGroup> ## OnlyY `OnlyY` collects fees in token Y. If token Y is SOL, USDC, or another quote asset, this mode can make fee accrual easier to understand because fees are concentrated in the quote side of the pair. When a trader swaps token Y for token X, the fee is taken from the input token because token Y is entering the pool. When a trader swaps token X for token Y, the fee is still denominated in token Y, so it is accounted from the output side of that bin-level swap. <CardGroup> <Card title="Predictable Fee Token" icon="coins"> LPs and order participants can reason about fees accumulating in token Y rather than both assets. </Card> <Card title="Launch-Friendly" icon="rocket"> Useful when a new token is paired against a familiar quote token and the pool wants fee collection to emphasize that quote side. </Card> </CardGroup> ## How Fees Flow During A Swap ```text theme={"system"} Trader swap -> DLMM calculates base fee + variable fee -> Collect Fee Mode decides the fee token -> Fees are distributed to eligible liquidity in crossed bins -> Protocol and other configured shares are accounted for ``` DLMM calculates fees per bin, which means the bins that participate in the swap are the bins that earn fees. Collect Fee Mode then determines the token denomination for those fees. ## Why Pool Creators Should Care Choosing a collect fee mode is a product decision, not just a configuration detail. <AccordionGroup> <Accordion title="I want a general trading pool"> `InputOnly` is often the more balanced default because fees follow trade direction and can accrue in both assets over time. </Accordion> <Accordion title="I want fees in the quote asset"> `OnlyY` can be a better fit when token Y is the quote asset and LPs or token teams want fees to accumulate there. </Accordion> <Accordion title="I am launching a new token"> Consider whether fee predictability matters more than balanced token exposure. Launch pools often care about simple accounting and quote-token fee capture. </Accordion> </AccordionGroup> ## Interaction With Limit Orders Limit orders can also participate in fee flow when swap activity fills order liquidity, but only on pools whose function mode supports limit orders. Collect Fee Mode affects which token those fees are tracked in. For `InputOnly`, limit-order fees follow the token entering the swap. For `OnlyY`, fees are collected in token Y. This can be important for users who place limit orders to DCA into or out of a token and want to understand which token their fee earnings may use. <Warning>Collect Fee Mode does not remove market risk. LPs and limit-order users can still end up with a different token composition after swaps move through their bins.</Warning> # DLMM Dynamic Positions Source: https://docs.meteora.ag/core-products/dlmm/dynamic-positions Learn how DLMM Dynamic Positions track LP ownership, bin ranges, liquidity shares, fees, rewards, operators, and resizable ranges up to 1,400 bins. DLMM Dynamic Positions are the accounts that track a liquidity provider's ownership in a DLMM pool. When you add liquidity, you are not receiving a fungible LP token or a position NFT. You are creating or updating a dedicated position account that records where your liquidity sits, how much of each bin you own, and what fees or rewards are available to claim. At the program level, this is represented by `PositionV2`. `PositionV2` starts with the default 70-bin layout and can allocate additional per-bin data when the position grows. The maximum supported position length is **1,400 bins**. ## What A Dynamic Position Stores A Dynamic Position belongs to one pool and one owner. It stores the range of bins covered by the position, plus accounting for liquidity, fees, and liquidity mining rewards inside that range. <CardGroup> <Card title="Pool and Owner" icon="user-lock"> The position records the DLMM pool it belongs to and the wallet that owns it. </Card> <Card title="Bin Range" icon="arrows-left-right-to-line"> Lower and upper bin IDs define where the position can place liquidity. </Card> <Card title="Liquidity Shares" icon="chart-pie"> Per-bin shares determine the LP's proportional claim on fees and eligible rewards. </Card> <Card title="Fees and Rewards" icon="coins"> The position tracks pending fees, liquidity mining rewards, and cumulative claimed totals. </Card> </CardGroup> ## Position Range Every Dynamic Position covers a continuous bin range. ```text theme={"system"} lower bin ID upper bin ID [ bin ][ bin ][ bin ][ bin ][ bin ] active bin ``` When the active bin is inside your position range and your liquidity is in bins used by swaps, the position can earn trading fees. If liquidity mining is enabled for the pool, eligible active liquidity can also earn rewards. When price moves outside your range, the position remains open, but that position is no longer contributing active liquidity until price returns or you rebalance. ## Fees, Rewards, and Claims Trading fees accrue to positions based on the bins where the position has liquidity and where swaps happen. A position tracks pending fees for both token X and token Y. Liquidity mining rewards accrue through the position on reward-enabled pools when its liquidity is active, and v2 swap processing can allocate elapsed rewards across crossed bins with liquidity. Fees and rewards do not auto-compound into liquidity; they remain claimable until you claim them. <Note>DLMM Collect Fee Mode affects which token fees are collected in at the pool level. See [DLMM Collect Fee Mode](/core-products/dlmm/collect-fee-mode) for the fee-token behavior.</Note> ## Ownership and Operators The position owner controls the position. The program also supports an **operator** field, which can allow another address to manage position actions such as modifying liquidity. Some positions can have a separate **fee owner**, which controls where claimed fees should be sent. DLMM also includes permission bits that can allow specific operations, such as fee claiming, to become permissionless for a position. <Warning>Only delegate operator permissions to addresses you trust. Operators can perform position-management actions authorized by the program.</Warning> ## Adding, Removing, and Closing Adding liquidity increases the position's liquidity shares in selected bins. Removing liquidity reduces those shares and returns the corresponding token amounts from the pool. Before liquidity is changed, the program updates fee and reward accounting so the position's claimable amounts remain accurate. Positions can also include a `lock_release_point`. If liquidity is still locked, the program prevents liquidity removal until the lock has released. A position can only be closed once all liquidity, fees, and rewards have been cleared. ## Why Dynamic Positions Matter <CardGroup> <Card title="Wider Strategy Ranges" icon="arrows-left-right-to-line"> LPs can cover more price bins in a single position, which is useful for volatile markets or long-running strategies. </Card> <Card title="Dynamic Account Space" icon="database"> The program allocates extra position data only when the position needs to grow beyond the default range. </Card> <Card title="Range Resizing" icon="up-right-and-down-left-from-center"> A position can expand or shrink its bin range instead of always closing and recreating a new account. </Card> <Card title="Rebalance Support" icon="rotate"> Rebalance flows can combine range updates with liquidity changes for more efficient position management. </Card> </CardGroup> ## Resizing The Range Dynamic Positions can be resized without closing the position first. This is useful when the market moves, volatility changes, or an LP wants to refine the position around a new price range. | Action | Product Meaning | | - | - | | Increase length | Add bins to the lower side or upper side of the range. New allocation beyond the default 70-bin layout is capped at `91` added bins per resize instruction. | | Decrease length | Remove empty bins from the lower side or upper side of the range. | | Rebalance liquidity | Combine claim, remove, resize, and add-liquidity actions into a single position-management flow. | <Info>In practice, this helps LPs move from a narrow high-efficiency strategy to a wider defensive range, or from a wide range back into a tighter strategy when the market stabilizes.</Info> ## Shrink Modes Rebalance flows can choose how aggressively to shrink the existing range. | Shrink Mode | Product Meaning | | - | - | | `ShrinkBoth` | Remove empty bins from both sides when possible. | | `NoShrinkLeft` | Keep the lower side and shrink only from the upper side. | | `NoShrinkRight` | Keep the upper side and shrink only from the lower side. | | `NoShrinkBoth` | Keep both sides and avoid shrinking. | ## When To Use Dynamic Positions <AccordionGroup> <Accordion title="Stable pair LP"> Start with a tight range around the peg for high capital efficiency. If the pair begins moving outside the expected band, expand the position range to keep liquidity active across more bins. </Accordion> <Accordion title="Volatile pair LP"> Use a wider position from the beginning so the position can stay relevant through larger price swings. Resize later if volatility cools down. </Accordion> <Accordion title="Launch liquidity"> Cover a broader launch range while concentrating meaningful liquidity near the expected trading zone. As price discovery settles, rebalance around the new market level. </Accordion> <Accordion title="DCA strategy"> Use a wider set of bins to gradually buy or sell through price movement, then shrink empty bins once part of the strategy is complete. </Accordion> </AccordionGroup> ## Dynamic Positions vs Default Position Range | Feature | Default Range | Dynamic Position Range | | - | - | - | | Bin coverage | 70 bins | Up to 1,400 bins | | Account data | Default position size | Extra per-bin data allocated as needed | | Resize allocation | No extra allocation needed | Additional allocation is limited to 91 new bins per resize instruction | | Best fit | Tight active strategies | Wide, evolving, or launch-oriented strategies | | Management style | Simpler range | More flexible range updates | ## What LPs Should Watch Dynamic Positions give LPs more range flexibility, but they do not make a strategy automatically better. A wider range can keep liquidity relevant across more prices, but capital spread over many bins may earn less per bin than a tighter range. <Warning>Dynamic Positions increase flexibility, not guaranteed returns. LPs should still monitor price movement, token composition, and impermanent loss risk.</Warning> # DLMM Formulas Source: https://docs.meteora.ag/core-products/dlmm/formulas Understand the math behind DLMM bin prices, swap amounts, liquidity shares, dynamic fees, protocol fees, composition fees, and liquidity mining rewards. DLMM's math is built around a simple product idea: each pool is a ladder of price bins, and each bin behaves like its own tiny market at a fixed price. <Note>The program performs integer arithmetic with fixed-point values and explicit rounding. This page shows the conceptual formula first, then calls out the important rounding or unit behavior where it matters.</Note> ## Units DLMM uses a few important units: | Value | Program Meaning | | - | - | | `bin step` | Basis points between neighboring bins. `10,000` basis points = `100%`. | | `P` | Bin price in Q64.64 fixed-point form. | | `fee rate` | Stored in `1e9` precision. For example, `10,000,000` means `1%`. | | `FEE_DENOMINATOR` | `1,000,000,000`. | | `MAX_FEE_RATE` | `100,000,000`, or `10%`. | | `protocol share` | Basis points of the trading fee retained by the protocol. Max `2,500`, or `25%`. | ## Bin Price Every DLMM pool has a **bin step**, measured in basis points. The bin step defines the percentage difference between one bin and the next. ```math theme={"system"} P_i = \left(1 + \frac{\text{bin step}}{10{,}000}\right)^i ``` Where: * `P_i` is the price of bin `i` * `i` is the bin ID * `bin step` is the pool's configured step size The program computes this as `get_price_from_id(bin_id, bin_step)` and returns the result in Q64.64 fixed-point form. **Example:** if the bin step is `25` basis points, each neighboring bin is approximately `0.25%` apart. Moving from bin `0` to bin `1` multiplies the price by `1.0025`. ## Bin Liquidity <div> <img alt="DLMM bin liquidity diagram" /> </div> Inside a bin, DLMM uses a constant-sum style liquidity value: ```math theme={"system"} L = P \cdot x + y ``` Where: * `L` is the bin liquidity value * `P` is the bin price * `x` is the amount of token X * `y` is the amount of token Y This fixed-price bin design is what creates zero price impact inside a single bin. Price changes when the available output liquidity in the active bin is consumed and the swap moves to another bin. ## Swap Amounts For a swap from token X to token Y, the output amount is: ```math theme={"system"} \text{amount out}_Y = \left\lfloor \text{amount in}_X \cdot P \right\rfloor ``` For a swap from token Y to token X, the output amount is: ```math theme={"system"} \text{amount out}_X = \left\lfloor \frac{\text{amount in}_Y}{P} \right\rfloor ``` The inverse formulas are used when the program needs to know the required input for a desired output: ```math theme={"system"} \text{amount in}_X = \left\lceil \frac{\text{amount out}_Y}{P} \right\rceil ``` ```math theme={"system"} \text{amount in}_Y = \left\lceil \text{amount out}_X \cdot P \right\rceil ``` The program rounds output amounts down and rounds required input amounts according to the swap path. This protects the pool from giving out more token than the bin can support. ## Total Trading Fee DLMM trading fees have a base fee and an optional variable fee: ```math theme={"system"} \text{total fee rate} = \min(\text{base fee rate} + \text{variable fee rate}, \text{MAX\_FEE\_RATE}) ``` `MAX_FEE_RATE` is `100,000,000` in `1e9` precision, or `10%`. ## Base Fee The base fee is configured through pool fee parameters: ```math theme={"system"} \text{base fee rate} = \text{base factor} \times \text{bin step} \times 10 \times 10^{\text{base fee power factor}} ``` This value is stored in `1e9` precision. **Product intuition:** a larger bin step often pairs with a larger base fee because each bin represents a larger price movement. A smaller bin step is usually used for tighter markets where LPs expect smaller price changes. ## Variable Fee The variable fee is DLMM's volatility-aware fee. In the program, it is calculated as: ```math theme={"system"} \text{variable fee rate} = \left\lceil \frac{ \text{variable fee control} \times (\text{volatility accumulator} \times \text{bin step})^2 }{ 100{,}000{,}000{,}0
프로젝트로 돌아가기