THORChain 백서

THORChain

원문

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

p-based fee model breaks path-independence and incentivises traders to break up their trade in small amounts.\ For protocols that can't order trades (such as anything built on Ethereum), this causes issues because traders will compete with each other in Ethereum Block Space and pay fees to miners, instead of paying fees to the protocol.\ It is possible to build primitive trade ordering in an Ethereum Smart Contract in order to counter this and make traders compete with each other on trade size again.\ THORChain is able to order trades based on fee & slip size, known as the Swap Queue. This ensures fees collected are maximal and prevents low-value trades. {% endhint %} ## Calculating Pool Ownership When a liquidity provider commits capital, the ownership % of the pool is calculated: $$ units=P\*\frac{rA+Ra+2ra}{rA+Ra+2RA} $$ * units = newly created pool units for the liquidity provider * r = rune deposited * a = asset deposited * R = total Rune Balance (before deposit) * A = total Asset Balance (before deposit) * P = total Pool Units (before deposit) The liquidity provider is allocated rewards proportional to their ownership of the pool. If they own 2% of the pool, they are allocated 2% of the pool's rewards. ## Virtual Depths Balances of the pool (X and Y), are used as inputs for the CLP model. An amplification factor can be applied (to both, or either) in order to change the "weights" of the balances: | Element | Description | | ------- | --------------------- | | a | Input Balance Weight | | b | Output Balance Weight | $$ Eqn 7: y= \frac{ xYbXa} {(x+Xa)^2 } $$ If `a = b = 2` then the pool behaves as if the depth is twice as deep, the slip is thus half as much, and the price the swapper receives is better. This is akin to smoothing the bonding curve, but it does not affect pool solvency in any way. Virtual depths are currently not implemented If `a = 2, b = 1` then the `Y` asset will behave as though it is twice as deep as the `X` asset, or, that the pool is no longer 1:1 bonded. Instead the pool can be said to have 67:33 balance, where the liquidity providers are twice as exposed to one asset over the other. {% hint style="info" %} Virtual Depths were initially applied to Synth Swaps using a multiplier of 2. It was intended that Synth Swaps would create 50% less slip and users pay 50% less fees. However, this was disabled after discovering that this would allow front-running. The multiplier is specified on `/constants` as: ``` "VirtualMultSynths": 2, ``` but currently overridden by a Mimir value of 1. {% endhint %} ## Impermanent Loss Protection {% hint style="success" %} As per [ADR 005](https://dev.thorchain.org/architecture/adr-005-deprecate-ilp.html) Impermanent Loss Protection has been removed for all liquidiy providers. {% endhint %} Impermanent Loss Protection ensures LPs always either make a profit, or leave with at break even after a minimum period of time (set at 100 days), and partially covered before that point. This should alleviate most of the concerns regarding become an LP. THORChain tracks a member's deposit values. When the member goes to redeem, their loss (against their original deposit value) is calculated and is subsidised with RUNE from the reserve. {% hint style="info" %} Impermanent Loss Protection is always recorded and calculated symmetrically. {% endhint %} There is a 100 day linear increase in the amount of coverage received, such that at 50 days, the member receives 50%, 90 days is 90% etc. | Element | Description | Element | Description | | ------- | --------------- | ------- | --------------- | | R0 | RUNE Deposited | R1 | RUNE to redeem | | A0 | Asset Deposited | A1 | Asset to redeem | $$ \text{P1} = \frac{R1}{A1} $$ `P1` is the pool ratio at withdrawal. $$ \text{coverage} = ((A0 \* P1) + R0) - ((A1 \* P1) + R1) => ((A0 \* R1/A1) + R0) - (R1 + R1) $$ {% hint style="info" %} Deposit values are *not* the amounts the member deposited. They are the immediate symmetrical value of what the member deposited instead. {% endhint %} The coverage is then adjusted for the 100 day rule. [`blocksForFullProtection`](/technical-documentation/technical-deep-dive/governance#mimir) `= 1440000 // 100 days` $$ \text{protectionProgress }= (currentHeight - heightLastAdded) / blocksForFullProtection $$ $$ \text{protection} = (protectionProgress \* coverage) $$ Then the extra RUNE added into the member's liquidity position to issue them extra liquidity units. The member then redeems all their units, and they will realise extra RUNE and extra ASSET. {% hint style="info" %} Since the protection amount is added asymmetrically, the protection will experience a small slip. This helps to prevent attack vectors. {% endhint %} # Trade Assets How THORChain enables Trade Assets as a capital efficient alternative to synthetic assets A new class of primitives, known as Trade Assets, has been introduced on THORChain. These assets offer twice the capital efficiency of [synthetic assets](/technical-documentation/thorchain-finance/synthetic-asset-model), enhancing the effectiveness of arbitrageurs with the same capital. Trade accounts settle with THORChain's block speed and cost, enabling swaps with 6-second finality without excessive network fees. Trade Assets can be redeemed for native assets anytime with no slippage, making them ideal for arbitrageurs and high-frequency traders. Trade Assets emulate the experience of trading on a centralized exchange, without compromising on transparency or security. They represent a significant step in making THORChain more user-friendly for high-frequency traders. With twice the capital efficiency of Synthetic Assets, arbitraging pools becomes much more efficient, leading to tighter price spreads across exchanges. In short, Trade Assets provide active traders with an experience akin to trading on a centralized exchange, but entirely on-chain, without compromising transparency or security. ### What are Trade Assets? Trade Assets are native assets custodied by THORChain but held outside of liquidity pools. Users receive a credit to their THORChain address, while the assets are held by a protocol-controlled module. Unlike synthetic assets, Trade Assets are not held directly by user wallets. Conceptually, Trade Assets resemble a deposit on a centralized exchange, but with the transparency of being on-chain. Funds are held 1:1 as L1 assets by THORChain until the user withdraws them back to self-custody. ### Advantages of Trade Assets * Backed 1:1 by native assets secured by THORChain * Mint or redeem Trade Assets with no slippage (only L1 gas fees) * 2x capital efficiency of Synthetic Assets * No outbound fee when swapping to a Trade Asset * Finality with THORChain block speed (6 seconds) * Not subject to outbound delays or confirmation counting ### Trade Assets vs Synthetic Assets: Key Differences Trade Assets allow faster and more capital-efficient arbitrage of the pools compared to [Synthetics](/technical-documentation/thorchain-finance/synthetic-asset-model). Synthetics adjust one side of the pool depth, causing only half the price movement, while Trade Accounts use full capital efficiency for price corrections. For example, a $100 RUNE → BTC swap requires $200 of Synthetic BTC to correct the price, whereas Trade Accounts only need $100 to achieve the same correction. This enables quicker restoration of price deviations with less capital. <figure><img src="https://3337783180-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FfvaTNxU33ciP7UstKtwU%2Fuploads%2Fgit-blob-0d919ccfa8a087a992640250483245be642528c1%2FGPur1ZmXAAA1PKA.jpeg?alt=media" alt=""><figcaption></figcaption></figure> ### Why Transition to Trade Assets Now? With THORChain's growth and increased decentralization, the network is now resilient to attacks that previously limited the feasibility of Trade Assets. The launch of Trade Assets presents new opportunities for arbitrage, order books, high-frequency trading, and P2P lending markets, leveraging the network's robust security and efficiency. ### Dashboards tracking Trade Assets There are multiple dashboards to track the performance of RUNE added to the RUNEPool: * <https://thorchain.network/trade> * <https://thorchain.net/thorfi/trades> * <https://runescan.io/txs?type=traders> Dashboards for Trade Assets continuously evolve as THORChain expands, but taking the example of [THORChain.network](https://thorchain.network/trade/) you will find the following in the dashboard: * Trade Asset: Which asset minted as a Trade Asset * Price: Current price of 1 unit of the Trade Asset * Balance: How many units of the Trade Asset has been minted * Valuation: Price \* Balance * Pool Ratio: How much the Trade Asset make up entire Trade Asset pool does this account for ### Economic Security Trade Assets are the first to be held outside liquidity pools on THORChain. This means that not all native assets in TSS Vaults are paired with RUNE. To maintain network economic security, the [Incentive Pendulum](/technical-documentation/technical-deep-dive/economic-model) now considers the value of all assets in the vaults, not just those in pools, when distributing rewards between Nodes and LPs. If the value of vault assets exceeds bonded value, Trade Accounts may face negative interest rates until the value ratio is balanced. To ensure the security of the network, if the combined pool and trade account value exceeds the total bonded value, trade assets will be liquidated to buy RUNE and deposited into the bond module. This safeguard ensures liquidity redistribution to Active Node Operators and occurs only if the Incentive Pendulum is underbonded. ### Using Trade Accounts #### How Trade Accounts Work 1. **Deposit L1 assets**: Traders deposit L1 assets into the network, minting a Trade Asset in a 1:1 ratio within a Network Trade module. 2. **Receive accredited shares**: Traders receive accredited shares of this module relative to their deposit. 3. **Swap/Trade assets**: Traders can swap/trade assets with RUNE or other trade assets within the module. 4. **Withdraw balance**: Traders can withdraw from their Trade Account with an outbound delay. #### How to Mint or Burn Trade Assets Minting or burning trade assets involves using a specific memo syntax, prefixed with `TRADE+` or `TRADE-`. The asset name is inferred from the received asset, and no slippage fees apply, only L1 gas fees. For example, depositing 1 BTC.BTC will result in the crediting of 1 BTC\~BTC (minus BTC network gas fees), and withdrawing 1 BTC\~BTC will result in the crediting of 1 BTC.BTC (minus network fees). #### Adding to the Trade Account To add to the Trade Account, send L1 Asset to the Inbound Address with the memo: `TRADE+:THORADD`. Example: ```makefile TRADE+:thor1g6pnmnyeg48yc3lg796plt0uw50qpp7humfggz ``` This adds the sent asset and amount to the Trade Account. #### Swapping Trade Assets Use the swap memo when swapping to and from trade assets. Example: ```makefile =:ETH~ETH:thor1g6pnmnyeg48yc3lg796plt0uw50qpp7humfggz ``` Swap (from RUNE) to Ether Trade Asset. #### Withdrawing from the Trade Account To withdraw, send a THORChain MsgDeposit with the memo `TRADE-:ADDR`. Example: ```makefile TRADE-:bc1qp8278yutn09r2wu3jrc8xg2a7hgdgwv2gvsdyw ``` Withdraw 0.1 BTC from the Trade Account and send to the specified address. #### Verifying Trade Account Balances Balances can be verified using the Owner's THORChain Address via the `trade/account/` endpoint. Example: ```url https://gateway.liquify.com/chain/thorchain_api/thorchain/trade/account/thor1g6pnmnyeg48yc3lg796plt0uw50qpp7humfggz ``` ### Future Opportunities * **Arbitrage bots**: Enhance trading efficiency. * **Order books and high-frequency trading**: Support advanced trading strategies. * **P2P Lending market**: Enable deposit of one trade asset and withdrawal of another, with dynamic reserve asset interest rates. ### Sources 1. Trade Accounts [Dev Docs](https://dev.thorchain.org/concepts/trade-accounts.html) 2. Relevant PRs: [!3347](https://gitlab.com/thorchain/thornode/-/merge_requests/3347)&[!3451](https://gitlab.com/thorchain/thornode/-/merge_requests/3451) 3. [Twitter Spaces](https://twitter.com/THORChain)— held most weeks,[subscribe on RSS](https://rss.com/podcasts/thorchain/)or wherever you get your podcasts 4. [THORChain University](https://crypto-university.medium.com/)— educational content, monthly posts, &[discord](https://discord.com/invite/c4EhDZdFMA)server 5. [GrassRoots Crypto](https://www.youtube.com/c/grassrootscrypto)— update and explanation videos # Secured Assets Asset Type to Integrate into the App Layer Secure Assets allow L1 tokens to be deposited to THORChain, creating a new native asset, which can be transferred between accounts and integrated with CosmWasm smart contracts using standard Cosmos SDK messages. They also replace [Trade Assets](/technical-documentation/thorchain-finance/trade-assets). {% hint style="info" %} See the [Dev Docs ](https://dev.thorchain.org/concepts/secured-assets.html)for a more detailed description.\ Also see [Technology](/technical-documentation/technology) for generic Cosmos information. What notation will they have? {% endhint %} ### Asset Notation The [delimiter](/thornodes/frequently-asked-questions/asset-types) for Secured Assets is a dash '-'.\ E.g. `ETH.ETH` is L1. `ETH-ETH` will be a secured asset. While ETH.tc is pictured, that may change to `ETH-ETH`. ## How will Secured Assets Move Between Base and App Layer? Secured assets are x/bank tokens on the App Layer (Rujira) representing claim to the native asset on base layer (THORChain). The native asset is secured to and from the app layer with the following flow: ### Mint and Burn Secured Assets Example shows the mint and burn process for BTC <figure><img src="https://3337783180-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FfvaTNxU33ciP7UstKtwU%2Fuploads%2Fgit-blob-c61e7a7f5e5ab9a9d869e49d7149ef92da0eebf7%2Fimage%20(55).png?alt=media" alt=""><figcaption></figcaption></figure> ### Swapping Secured Assets Examples below explain how a user: 1. Swap a Secured Asset (SA)—BTC—to another Secured Asset—ETH 2. Swap a Secured Asset—BTC—to a base asset—ETH <figure><img src="https://3337783180-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FfvaTNxU33ciP7UstKtwU%2Fuploads%2Fgit-blob-5c6334ace3b68e566a5da0f30b74d6c0fe5ce20c%2Fimage%20(56).png?alt=media" alt=""><figcaption></figcaption></figure> 3. Secured Asset Swapping, swapping the L1 under the hood <figure><img src="https://3337783180-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FfvaTNxU33ciP7UstKtwU%2Fuploads%2Fgit-blob-1e356fb715525323e35c8dc6c3e316c305881519%2Fimage%20(59).png?alt=media" alt=""><figcaption></figcaption></figure> Find more information about [Secured Assets](https://docs.rujira.network/developers/secured-assets) in the Rujira Docs or in the [Dev Docs](https://dev.thorchain.org/concepts/secured-assets.html). # TOR How THORChain's USD-pegged stablecoin TOR works. To understand [Lending (Deprecated)](/thornodes/archived/lending) within THORChain fully, one needs to understand the mechanics of `TOR`. TOR (`thor.tor`) is a non-transferable unit of account within THORChain designed to match the value of $1 USD and has been in use since [ADR 003](https://dev.thorchain.org/architecture/adr-003-flooredoutboundfee.html). It cannot be exported anywhere and always has a market cap of $0. TOR is valued by taking the median price of the active USD pools. All collateral, debt and repayments within Lending were converted to and accounted for in TOR. ### TOR Price Stability TOR is anchored to a basket of USD-pegged stablecoins, such as USDC and USDT. The value of TOR is determined by taking the median price of these active USD pools, ensuring it remains stable and closely pegged to $1 USD. This median approach ensures that TOR is the most stable among the stablecoins in its basket, mitigating the risk of price volatility from any single stablecoin. ### Two-Way Burn Mechanism There is a RUNE<>TOR mechanism that operates as a two-way burn process. When TOR is minted, an equivalent value of RUNE is burned, and conversely, when TOR is burned, the same value of RUNE is minted. This process ensures that the creation and destruction of TOR directly impact the supply of RUNE, maintaining a balanced and inflation-resistant system. ### TOR Pool Depth and Volatility Sensitivity The depth of the TOR pool is calculated as the sum of all TOR pools. However, it is sensitive to market volatility. During periods of high volatility, the pool depth contracts to increase slippage for swaps, discouraging users from trading during these times and protecting the system from manipulation. Conversely, during stable periods, the pool depth expands, reducing slippage and encouraging swaps. This dynamic adjustment helps maintain the stability and health of the TOR pool. ### TOR Anchor You can find the addresses for various stablecoins on specific networks (TORANCHOR) that make up TOR pools on [Mimir](https://gateway.liquify.com/chain/thorchain_api/thorchain/mimir): ```json "TORANCHOR-AVAX-USDC-0XB97EF9EF8734C71904D8002F8B6BC66DD9C48A6E": 1, "TORANCHOR-AVAX-USDT-0X9702230A8EA53601F5CD2DC00FDBC13D4DF4A8C7": 1, "TORANCHOR-BSC-USDC-0X8AC76A51CC950D9822D68B83FE1AD97B32CD580D": 1, "TORANCHOR-ETH-DAI-0X6B175474E89094C44DA98B954EEDEAC495271D0F": 1, "TORANCHOR-ETH-USDC-0XA0B86991C6218B36C1D19D4A2E9EB0CE3606EB48": 1, "TORANCHOR-ETH-USDT-0XDAC17F958D2EE523A2206206994597C13D831EC7": 1 ``` ### TOR Usage TOR is used for accounting with THORChain and to price assets, instead of using any specific stablecoin. While TOR is currently non-transferable, greater use of TOR is a possibility. #### # RUNEPool How RUNEPool works, its use case, key components and how it enhances liquidity provision for RUNE holders RUNEPool is a feature of THORChain that allows RUNE holders to join the Protocol Owned Liquidity (POL). By buying into the liquidity pool through RUNEPool, users get a share of the liquidity that THORChain owns across all its pools. This participation helps users earn Annual Percentage Rate (APR) returns and improves the efficiency of the protocol's liquidity, supporting the growth of THORChain's network. ## How does RUNEPool work? RUNEPool dynamically matches external capital with various pools in the system. Managing 13 different pools, each on its price curve, RUNEPool aggregates and distributes RUNE across these pools. By using the [Incentive Pendulum](/technical-documentation/technical-deep-dive/economic-model), RUNEPool smoothens out price curves, reducing volatility and making THORChain products more attractive to investors. #### Use Case RUNEPool offers a single product to gather idle RUNE from centralized exchanges and custodial services, moving them into THORChain's decentralized infrastructure to generate yield. This enhances the productivity of these assets and builds up POL through community participation. #### Benefits Adding RUNE to RUNEPool abstracts away user experience complexities, focusing on the Incentive Pendulum and fees generated from the pools. RUNEPool allocates funds based on the yield, simplifying decision-making for users. #### Key Components 1. **PoL-Enabled Pools**: POL-Enabled pools are defined via the mimir key POL-{Asset}. Currently, all (eight) native assets and five USD stable coins are enabled for POL. The exact list is within the mimir endpoint. 2. **RUNEPool Units (RPU)**: Ownership in RUNEPool is tracked through RUNEPool Units (RPU). These units represent a Pooler’s share in the pool. When a Pooler redeems their units, the total PoL size in RUNE is assessed, and the holder's share is distributed. 3. **Impermanent Loss Management (IL)**: Users experience aggregate IL across PoL-Enabled pools, reducing the risk compared to any si
프로젝트로 돌아가기