mirror of
https://github.com/XRPLF/xrpl-dev-portal.git
synced 2025-11-20 11:45:50 +00:00
Remove more AMM docs
This commit is contained in:
@@ -197,25 +197,25 @@ Request('ledger_entry - AccountRoot', {
|
||||
}
|
||||
})
|
||||
|
||||
Request('ledger_entry - AMM', {
|
||||
description: "Returns a single Automated Market Maker object in its raw ledger format.",
|
||||
link: "ledger_entry.html#get-amm-object",
|
||||
status: "not_enabled",
|
||||
body: {
|
||||
"id": "example_get_amm",
|
||||
"command": "ledger_entry",
|
||||
"amm": {
|
||||
"asset": {
|
||||
"currency": "XRP"
|
||||
},
|
||||
"asset2": {
|
||||
"currency" : "TST",
|
||||
"issuer" : "rP9jPyP5kyvFRb6ZiRghAGw5u8SGAmU4bd"
|
||||
}
|
||||
},
|
||||
"ledger_index": "validated"
|
||||
}
|
||||
})
|
||||
// Request('ledger_entry - AMM', {
|
||||
// description: "Returns a single Automated Market Maker object in its raw ledger format.",
|
||||
// link: "ledger_entry.html#get-amm-object",
|
||||
// status: "not_enabled",
|
||||
// body: {
|
||||
// "id": "example_get_amm",
|
||||
// "command": "ledger_entry",
|
||||
// "amm": {
|
||||
// "asset": {
|
||||
// "currency": "XRP"
|
||||
// },
|
||||
// "asset2": {
|
||||
// "currency" : "TST",
|
||||
// "issuer" : "rP9jPyP5kyvFRb6ZiRghAGw5u8SGAmU4bd"
|
||||
// }
|
||||
// },
|
||||
// "ledger_index": "validated"
|
||||
// }
|
||||
// })
|
||||
|
||||
Request('ledger_entry - DirectoryNode', {
|
||||
description: "Returns a directory object in its raw ledger format.",
|
||||
|
||||
@@ -1,86 +0,0 @@
|
||||
---
|
||||
html: automated-market-makers.html
|
||||
parent: decentralized-exchange.html
|
||||
blurb: 自動マーケットメーカー(AMM)は、資産ペア間の流動性を提供し、分散型取引所のオーダーブックを補完すると同時に、流動性提供者に利益を提供します。
|
||||
status: not_enabled
|
||||
labels:
|
||||
- XRP
|
||||
- 分散型取引所
|
||||
- AMM
|
||||
---
|
||||
|
||||
# 自動マーケットメーカー
|
||||
|
||||
自動マーケットメーカー(AMM)は、XRP Ledgerの分散型取引所において流動性を提供するスマートコントラクトです。個々のAMMは2つの資産のプールを保有し、数式で定められた取引レートでユーザーがその2つの資産間でスワップを可能とします。
|
||||
|
||||
{% include '_snippets/amm-disclaimer.ja.md' %}
|
||||
|
||||
任意の資産ペアに対して、最大1つのAMMが元帳に存在することができます。AMMはそのペアが存在しない場合、誰でも作成することができ、また既存のAMMに預けることもできます。AMMに資産を預ける人は、流動性供給者(LP/Liquidity Provider)と呼ばれ、AMMから「LPトークン」を受け取ります。LPトークンによって、流動性供給者は以下のことが可能になります。
|
||||
|
||||
- LPトークンを、AMMのプール内の資産の一部(手数料を含む)と交換する。
|
||||
- AMMの手数料設定を変更するために投票する。票は、投票者が保有するLPトークンの数に基づいて重み付けされます。
|
||||
- AMMの取引手数料の一時的な割引を得るために、LPトークンの一部を入札する。
|
||||
|
||||
プール内の2つの資産の取引が比較的活発で均衡している場合、手数料は流動性供給者の収益になります。しかし、資産間の相対価格が変動すると、流動性供給者は[為替リスク](https://www.investopedia.com/terms/c/currencyrisk.asp)により損失を被る可能性があります。
|
||||
|
||||
## AMMの仕組み
|
||||
|
||||
AMMは2つの異なる資産を保有します。このうち最大でも片方がXRPであり、もう片方または両方は[トークン](tokens.html)となります。この場合、発行者の異なるトークンは異なる資産とみなされます。つまり、通貨コードは同じだが発行者が異なる2つのトークン(「WayGateが発行したFOO」と「StableFooが発行したFOO」は異なる)や、発行者は同じだが通貨コードが異なるトークンに対してAMMが存在する可能性があるということです。また、順番は関係なく、FOO.WayGateからXRPへのAMMは、XRPからFOO.WayGateへのAMMと同一になります。
|
||||
|
||||
ユーザーが分散型取引所で取引を行う場合、[オファー](offers.html)と[クロスカレンシー決済](cross-currency-payments.html)は自動的にAMMを使用してトランザクションを成立させることが出来ます。トランザクションは低コストで取引を行えるように、オファー、AMM、またはその両方の組み合わせで実行されます。
|
||||
|
||||
AMMは、プール内の資産残高に基づき取引レートを設定します。AMMに対して取引を行うと、AMMが保有する資産残高の変動に応じて、取引レートが調整されます。一方の資産の量が減れば、その資産の価格が上がり、他方の資産の量が増えれば、その資産の価格が下がります。AMMは、プール内の残高が多いほど、一般的により良い取引レートを提供します。同一取引であればプール内の残高が大きい方がAMMの資産バランスに生じる変化は小さくなるからです。AMMの2つの資産のバランスが崩れれば崩れるほど、交換レートは極端に悪化します。
|
||||
|
||||
また、AMMは交換レートに加え、一定割合の取引手数料を徴収しています。
|
||||
|
||||
XRP Ledgerの実装は、重みパラメータを0.5とした _幾何平均_ AMMですので、_定積_ マーケットメーカーのように機能します。 _定積_ AMMの公式や一般的なAMMの経済学についての詳しい説明は、[Kris Machowski's Introduction to Automated Market Makers](https://www.machow.ski/posts/an_introduction_to_automated_market_makers/)をご覧ください。
|
||||
|
||||
## LPトークン
|
||||
<!-- TODO: add diagrams showcasing flow of funds -->
|
||||
AMMの作成者は、最初の流動性供給者となり、AMMのプール内の資産の100%の所有権を表すLPトークンを受け取ります。LPトークンの一部または全部を交換して、現在のプール残高に比例した資産をAMMから引き出せます。(この比率は、人々がAMMに対して取引を行うにつれて変化します)AMMは、同時に両方の資産を引き出す際に手数料はかかりません。
|
||||
|
||||
例えば、5ETHと5USDでAMMを作成し、その後誰かが1.26USDを1ETHに交換したとすると、現在プールには4ETHと6.26USDが入っています。LPトークンの半分を使用して、2ETHと3.13USDを引き出すことができます。
|
||||
|
||||
誰でも既存のAMMに資産を預けることができます。預け入れると、その金額に応じて新しいLPトークンを受け取ります。流動性供給者がAMMから引き出すことができる金額は、発行済みのLPトークンの総数に対する流動性提供者のLPトークンの保有割合に基づきます。
|
||||
|
||||
LPトークンはXRP Ledgerの他のトークンと同様に、様々な[種類の支払い](payment-types.html)で使用したり、分散型取引所で取引したり、新しいAMMの資産として預けることも可能です。(LPトークンを支払い(Payment)として受け取るには、AMMアカウントを発行元として、限度額が0でない[トラストライン](trust-lines-and-issuing.html)を設定する必要があります)。ただし、LPトークンをAMMに直接送る(換金する)には[AMMWithdraw][]トランザクションタイプを使用し、他のタイプの支払いは使用できません。同様に、AMMのプールに資産を送るには、[AMMDeposit][]トランザクションタイプを使用する必要があります。
|
||||
|
||||
AMMは、発行済のLPトークンがない場合に限り、AMMの資産プールが空になるように設計されています。こうした状況は、[AMMWithdraw][]トランザクションの結果としてのみ発生し、発生した時点でAMMは自動的に削除されます。
|
||||
|
||||
### LPトークンの通貨コード
|
||||
|
||||
LPトークンは、160ビットの16進法["非標準"フォーマット](currency-formats.html#非標準通貨コード)の特別なタイプの通貨コードを使用します。これらのコードの最初の8ビットは`0x03`です。残りのコードは、2つの資産の通貨コードとその発行者のSHA-512ハッシュで、最初の152ビットまで切り捨てたものです。(資産は、数値の低い通貨と発行者のペアを最初にする「正規化された順序」で配置されます。)その結果、LPトークンは、通貨と発行者のペアを最初にする「正規化された順序」で配置されます。その結果、ある資産ペアのAMMのLPトークンは、予測可能で一貫した通貨コードを持っています。
|
||||
|
||||
## 取引手数料
|
||||
|
||||
取引手数料は流動性供給者の収益源であり、プールの資産に対して他者に取引をさせることによる為替リスクを相殺するものです。取引手数料は流動性提供者に直接支払われずにAMMに支払われますが、流動性供給者は自分のLPトークンをAMMのプールの一定割合と交換することができるため、利益を得ることができます。
|
||||
|
||||
流動性供給者は、投票によって取引手数料を0%から1%まで、0.001%刻みで設定することが出来ます。流動性供給者は取引手数料を適切に設定するインセンティブがあり、手数料が高すぎる場合、トレーダーはより良いレートを得るために代わりにオーダーブックを使用することになります。手数料が低すぎる場合、流動性供給者はこのプールへの貢献に対してメリットが得られなくなります。AMMの各流動性供給者は、その保有するLPトークンの量に比例して、取引手数料への投票権を有します。
|
||||
|
||||
投票するには、流動性供給者が[AMMVoteトランザクション][]を送信します。誰かが新しい票を入れるたびに、AMMは手数料を再計算し、直近の票の平均を、それらの投票者が保有するLPトークンの数で重み付けしたものにします。この方法では、最大8つの流動性供給者の投票がカウントされます。それ以上の流動性供給者が投票しようとすると、上位8つの投票(保有LPトークンの多い順)だけがカウントされます。流動性供給者のLPトークンのシェアは、様々な理由(例えば[オファー](offers.html)を使ったトークンの取引)で急速に変化しますが、取引手数料は誰かが新しい票を入れるたびに再計算されます(その票がトップ8に入っていない場合でも計算されます)。
|
||||
|
||||
### オークションスロット
|
||||
|
||||
これまでの自動マーケットメーカーとは異なり、XRP LedgerのAMMのデザインには、流動性供給者が24時間の取引手数料の割引を得るために入札することができる _オークションスロット_ 機能があります。入札はLPトークンで支払う必要があり、落札に使用したLPトークンはAMMに返還されます。一度に複数のアカウントがオークションスロットを保持することはできませんが、落札者は割引を得るために追加で最大4つのアカウントを指定することができます。最低落札価格は設定されていませんが、もしその枠が埋まっている場合は、現在の枠の所有者に競り勝たなければなりません。もし誰かがあなたの入札を退けた場合、残り時間に応じて、落札額の一部が返金されます。アクティブなオークションスロットを保持している限り、そのAMMに対しては取引手数料なしで取引を行うことができます。
|
||||
|
||||
どのようなAMMであっても、その資産の価格が外部市場で大きく変動すると、トレーダーは裁定取引によってAMMから利益を得ることができ、その結果、流動性供給者は損失を被ることになります。オークションの仕組みは、より多くの価値を流動性供給者に還元し、AMMの価格をより迅速に外部市場とのバランスに戻すことを意図しています。
|
||||
|
||||
## 台帳上の表示
|
||||
|
||||
台帳の状態データでは、AMMは複数の[レジャーオブジェクトのタイプ](ledger-object-types.html)で構成されています。
|
||||
|
||||
- 自動マーケットメーカー自体を記述した[AMMオブジェクト][]
|
||||
|
||||
- AMMのLPトークンを発行し、AMMのXRP(保有している場合)を保有する特別な[AccountRootオブジェクト][]
|
||||
|
||||
このAccountRootのアドレスは、AMMの作成時にランダムに選ばれ、AMMを削除して再作成した場合にも異なるアドレスが選ばれます。これは、AMMのアカウントにユーザーが事前にXRPで資金を供給することを防止するためです。
|
||||
|
||||
- AMMのプールにあるトークンのAMM専用アカウントへの[トラストライン](trust-lines-and-issuing.html)
|
||||
|
||||
これらのオブジェクトはどのアカウントにも所有されていないため、[準備金要件](reserves.html)は適用されません。ただし、スパムを防ぐため、AMMを作成するための取引には特別な[トランザクションコスト](transaction-cost.html)があり、通常よりも多くのXRPを消費する必要があります。
|
||||
|
||||
|
||||
<!--{# common link defs #}-->
|
||||
{% include '_snippets/rippled-api-links.md' %}
|
||||
{% include '_snippets/tx-type-links.md' %}
|
||||
{% include '_snippets/rippled_versions.md' %}
|
||||
@@ -1,88 +0,0 @@
|
||||
---
|
||||
html: automated-market-makers.html
|
||||
parent: decentralized-exchange.html
|
||||
blurb: Automated Market Makers (AMMs) provide liquidity between asset pairs, complemeting the order books in the decentralized exchange while providing passive income for their liquidity providers.
|
||||
status: not_enabled
|
||||
labels:
|
||||
- XRP
|
||||
- Decentralized Exchange
|
||||
- AMM
|
||||
---
|
||||
# Automated Market Makers
|
||||
|
||||
Automated Market Makers (AMMs) are smart contracts that provide liquidity in the XRP Ledger's decentralized exchange. Each AMM holds a pool of two assets and enables users to swap between them at an exchange rate set by a formula.
|
||||
|
||||
{% include '_snippets/amm-disclaimer.md' %}
|
||||
|
||||
For any given pair of assets, there can be up to one AMM in the ledger. Anyone can create the AMM for an asset pair if it doesn't exist yet, or deposit to an existing AMM. Those who deposit assets into an AMM are called _liquidity providers_ (LPs) and receive "LP Tokens" from the AMM. LP Tokens enable liquidity providers to:
|
||||
|
||||
- Redeem their LP Tokens for a share of the assets in the AMM's pool, including fees collected.
|
||||
- Vote to change the AMM's fee settings. The votes are weighted based on how many LP Tokens the voters hold.
|
||||
- Bid some of their LP Tokens to receive a temporary discount on the AMM's trading fees.
|
||||
|
||||
When the flow of funds between the two assets in a pool is relatively active and balanced, the fees provide a source of passive income for liquidity providers. However, when the relative price between the assets shifts, the liquidity providers can take a loss on the [currency risk](https://www.investopedia.com/terms/c/currencyrisk.asp).
|
||||
|
||||
## How the AMM Works
|
||||
|
||||
An AMM holds two different assets: at most one of these can be XRP, and one or both of them can be [tokens](tokens.html). Tokens with different issuers are considered different assets for this purpose. This means that there can be an AMM for two tokens with the same currency code but different issuers ("FOO issued by WayGate" is different than "FOO issued by StableFoo"), or the same issuer but different currency codes. The order does not matter; the AMM for FOO.WayGate to XRP is the same as for XRP to FOO.WayGate.
|
||||
|
||||
When users want to trade in the decentralized exchange, their [Offers](offers.html) and [Cross-Currency Payments](cross-currency-payments.html) can automatically use AMMs to complete the trade. A single transaction might execute by matching Offers, AMMs, or a mix of both, depending on what's cheaper.
|
||||
|
||||
An AMM sets its exchange rate based on the balance of assets in the pool. When you trade against an AMM, the exchange rate adjusts based on how much your trade shifts the balance of assets the AMM holds. As its supply of one asset goes down, the price of that asset goes up; as its supply of an asset goes up, the price of that asset goes down. An AMM gives generally better exchange rates when it has larger overall amounts in its pool. This is because any given trade causes a smaller shift in the balance of the AMM's assets. The more a trade unbalances the AMM's supply of the two assets, the more extreme the exchange rate becomes.
|
||||
|
||||
The AMM also charges a percentage trading fee on top of the exchange rate.
|
||||
|
||||
The XRP Ledger's implements a _geometric mean_ AMM with a weight parameter of 0.5, so it functions like a _constant product_ market maker. For a detailed explanation of the _constant product_ AMM formula and the economics of AMMs in general, see [Kris Machowski's Introduction to Automated Market Makers](https://www.machow.ski/posts/an_introduction_to_automated_market_makers/).
|
||||
|
||||
|
||||
## LP Tokens
|
||||
<!-- TODO: add diagrams showcasing flow of funds -->
|
||||
Whoever creates the AMM becomes the first liquidity provider, and receives LP Tokens that represent 100% ownership of assets in the AMM's pool. They can redeem some or all of those LP Tokens to withdraw assets from the AMM in proportion to the amounts currently there. (The proportions shift over time as people trade against the AMM.) The AMM does not charge a fee when withdrawing both assets.
|
||||
|
||||
For example, if you created an AMM with 5 ETH and 5 USD, and then someone exchanged 1.26 USD for 1 ETH, the pool now has 4 ETH and 6.26 USD in it. You can spend half your LP Tokens to withdraw 2 ETH and 3.13 USD.
|
||||
|
||||
Anyone can deposit assets to an existing AMM. When they do, they receive new LP Tokens based on how much they deposited. The amount that a liquidity provider can withdraw from an AMM is based on the proportion of the AMM's LP Tokens they hold compared to the total number of LP Tokens outstanding.
|
||||
|
||||
LP Tokens are like other tokens in the XRP Ledger, so you can use them in many [types of payments](payment-types.html), trade them in the decentralized exchange, or even deposit them as assets for new AMMs. (To receive LP Tokens as payment, you must set up a [trust line](trust-lines-and-issuing.html) with a nonzero limit with the AMM Account as the issuer.) However, you can _only_ send LP Tokens directly to the AMM (redeeming them) using the [AMMWithdraw][] transaction type, not through other types of payments. Similarly, you can only send assets to the AMM's pool through the [AMMDeposit][] transaction type.
|
||||
|
||||
The AMM is designed so that an AMM's asset pool is empty if and only if the AMM has no outstanding LP Tokens. This situation can only occur as the result of an [AMMWithdraw][] transaction; when it does, the AMM is automatically deleted.
|
||||
|
||||
### LP Token Currency Codes
|
||||
|
||||
LP Tokens use a special type of currency code in the 160-bit hexadecimal ["non-standard" format](currency-formats.html#nonstandard-currency-codes). These codes have the first 8 bits `0x03`. The remainder of the code is a SHA-512 hash, truncated to the first 152 bits, of the two assets' currency codes and their issuers. (The assets are placed in a "canonical order" with the numerically lower currency+issuer pair first.) As a result, the LP Tokens for a given asset pair's AMM have a predictable, consistent currency code.
|
||||
|
||||
|
||||
## Trading Fees
|
||||
|
||||
Trading fees are a source of passive income for liquidity providers, and they offset the currency risk of letting others trade against the pool's assets. Trading fees are paid to the AMM, not directly to liquidity providers, but liquidity providers benefit because their LP Tokens can be redeemed for a percentage of the AMM's pool.
|
||||
|
||||
Liquidity providers can vote to set the fee from 0% to 1%, in increments of 0.001%. Liquidity providers have an incentive to set trading fees at an appropriate rate: if fees are too high, trades will use order books to get a better rate instead; if fees are too low, liquidity providers don't get any benefit for contributing to the pool. <!-- STYLE_OVERRIDE: will --> Each AMM gives its liquidity providers the power to vote on its fees, in proportion to the amount of LP Tokens those liquidity providers hold.
|
||||
|
||||
To vote, a liquidity provider sends an [AMMVote transaction][]. Whenever anyone places a new vote, the AMM recalculates its fee to be an average of the latest votes weighted by how many LP Tokens those voters hold. Up to 8 liquidity providers' votes can be counted this way; if more liquidity providers try to vote then only the top 8 votes (by most LP Tokens held) are counted. Even though liquidity providers' share of LP Tokens can shift rapidly for many reasons (such as trading those tokens using [Offers](offers.html)), the trading fees are only recalculated whenever someone places a new vote (even if that vote is not one of the top 8).
|
||||
|
||||
### Auction Slot
|
||||
|
||||
Unlike any previous Automated Market Makers, the XRP Ledger's AMM design has an _auction slot_ that a liquidity provider can bid on to get a discount on the trading fee for a 24-hour period. The bid must be paid in LP Tokens, which are returned to the AMM. No more than one account can hold the auction slot at a time, but the bidder can name up to 4 more accounts to also receive the discount. There is no minimum bid, but if the slot is currently occupied then you must outbid the current slot holder to displace them. If someone displaces you, you get part of your bid back depending on how much time remains. As long as you hold an active auction slot, you pay a discounted trading fee of 0% when making trades against that AMM.
|
||||
|
||||
With any AMM, when the price of its assets shifts significantly in external markets, traders can use arbitrage to profit off the AMM, which results in a loss for liquidity providers. The auction mechanism is intended to return more of that value to liquidity providers and more quickly bring the AMM's prices back into balance with external markets.
|
||||
|
||||
|
||||
## Representation in the Ledger
|
||||
|
||||
In the ledger's state data, an AMM consists of multiple [ledger entries](ledger-object-types.html):
|
||||
|
||||
- An [AMM object][] describing the automated market maker itself.
|
||||
|
||||
- A special [AccountRoot object][] that issues the AMM's LP Tokens, and holds the AMM's XRP (if it has any).
|
||||
|
||||
The address of this AccountRoot is chosen somewhat randomly when the AMM is created, and it is different if the AMM is deleted and re-created. This is to prevent people from funding the AMM account with excess XRP in advance.
|
||||
|
||||
- [Trust lines](trust-lines-and-issuing.html) to the special AMM Account for the tokens in the AMM's pool.
|
||||
|
||||
These objects are not owned by any account, so the [reserve requirement](reserves.html) does not apply to them. However, to prevent spam, the transaction to create an AMM has a special [transaction cost](transaction-cost.html) that requires the sender to burn a larger than usual amount of XRP.
|
||||
|
||||
|
||||
<!--{# common link defs #}-->
|
||||
{% include '_snippets/rippled-api-links.md' %}
|
||||
{% include '_snippets/tx-type-links.md' %}
|
||||
{% include '_snippets/rippled_versions.md' %}
|
||||
@@ -145,73 +145,6 @@ rippled json ledger_entry '{ "account_root": "r9cZA1mLK5R5Am25ArfXFmqgNwjZgnfk59
|
||||
|
||||
|
||||
|
||||
### Get AMM Object
|
||||
|
||||
_(Automated Market Maker (AMM) functionality is part of the proposed [XLS-30d](https://github.com/XRPLF/XRPL-Standards/discussions/78) extension :not_enabled: to the XRP Ledger protocol. You can use these features on AMM test networks, but there isn't an official amendment and they aren't available on the production Mainnet.)_
|
||||
|
||||
Retrieve an Automated Market-Maker (AMM) object from the ledger. This is similar to [amm_info method][], but the `ledger_entry` version returns only the ledger entry as stored.
|
||||
|
||||
| Field | Type | Description |
|
||||
|:-------------|:-----------------|:----------------------|
|
||||
| `amm` | Object or String | The [AMM](amm.html) to retrieve. If you specify a string, it must be the [object ID](ledger-object-ids.html) of the AMM, as hexadecimal. If you specify an object, it must contain `asset` and `asset2` sub-fields. |
|
||||
| `amm.asset` | Object | One of the two assets in this AMM's pool, as a [currency object without an amount](currency-formats.html#specifying-without-amounts). |
|
||||
| `amm.asset2` | Object | The other of the two assets in this AMM's pool, as a [currency object without an amount](currency-formats.html#specifying-without-amounts). |
|
||||
|
||||
<!-- MULTICODE_BLOCK_START -->
|
||||
|
||||
*WebSocket*
|
||||
|
||||
```json
|
||||
{
|
||||
"id": 3,
|
||||
"command": "ledger_entry",
|
||||
"amm": {
|
||||
"asset": {
|
||||
"currency": "XRP"
|
||||
},
|
||||
"asset2": {
|
||||
"currency" : "TST",
|
||||
"issuer" : "rP9jPyP5kyvFRb6ZiRghAGw5u8SGAmU4bd"
|
||||
}
|
||||
}
|
||||
"ledger_index": "validated"
|
||||
}
|
||||
```
|
||||
|
||||
*JSON-RPC*
|
||||
|
||||
```json
|
||||
{
|
||||
"method": "ledger_entry",
|
||||
"params": [
|
||||
{
|
||||
"amm": {
|
||||
"asset": {
|
||||
"currency": "XRP"
|
||||
},
|
||||
"asset2": {
|
||||
"currency" : "TST",
|
||||
"issuer" : "rP9jPyP5kyvFRb6ZiRghAGw5u8SGAmU4bd"
|
||||
}
|
||||
},
|
||||
"ledger_index": "validated"
|
||||
}
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
*Commandline*
|
||||
|
||||
```sh
|
||||
rippled json ledger_entry '{ "amm": { "asset": { "currency": "XRP" }, "asset2": { "currency" : "TST", "issuer" : "rP9jPyP5kyvFRb6ZiRghAGw5u8SGAmU4bd" } }, "ledger_index": "validated" }'
|
||||
```
|
||||
|
||||
<!-- MULTICODE_BLOCK_END -->
|
||||
|
||||
[Try it! >](websocket-api-tool.html?server=wss%3A%2F%2Famm.devnet.rippletest.net%3A51233%2F#ledger_entry-amm)
|
||||
|
||||
|
||||
|
||||
### Get DirectoryNode Object
|
||||
|
||||
Retrieve a [DirectoryNode](directorynode.html), which contains a list of other ledger objects. Can be provided as string (object ID of the Directory) or as an object.
|
||||
|
||||
@@ -55,7 +55,6 @@ XRP Ledgerのアカウントとは、XRPの保有者と取引の送信者を意
|
||||
|
||||
パスは、支払いが送信者から受信者に届くまでに中間ステップでたどる道筋を定義します。パスは、送信者と受信者をオーダーブックを介してつなぐことで、複数通貨間の支払いを可能にします。パスと他のオーダーブックに関しては、以下のメソッドを使用します。
|
||||
|
||||
* **[`amm_info`](amm_info.html)** :not_enabled: - 自動マーケットメイカー(AMM)についての情報を取得します。
|
||||
* **[`book_offers`](book_offers.html)** - 2つの通貨を交換するオファーに関する情報を取得します。
|
||||
* **[`deposit_authorized`](deposit_authorized.html)** - あるアカウントが別のアカウントへの支払いの直接送信について承認されているかどうかを調べます。
|
||||
* **[`nft_buy_offers`](nft_buy_offers.html)** - Retrieve a list of buy offers for a specified NFToken object.
|
||||
|
||||
@@ -59,7 +59,6 @@ By default, the following methods are [admin-only](admin-api-methods.html). They
|
||||
|
||||
Paths define a way for payments to flow through intermediary steps on their way from sender to receiver. Paths enable cross-currency payments by connecting sender and receiver through order books. Use these methods to work with paths and other books.
|
||||
|
||||
* **[`amm_info`](amm_info.html)** :not_enabled: - Get info about an Automated Market Maker (AMM).
|
||||
* **[`book_offers`](book_offers.html)** - Get info about offers to exchange two currencies.
|
||||
* **[`deposit_authorized`](deposit_authorized.html)** - Look up whether one account is authorized to send payments directly to another. <!-- STYLE_OVERRIDE: is authorized to -->
|
||||
* **[`nft_buy_offers`](nft_buy_offers.html)** - Retrieve a list of buy offers for a specified NFToken object.
|
||||
|
||||
@@ -68,7 +68,6 @@ AccountRootオブジェクトには以下のフラグ値を指定できます。
|
||||
|
||||
| フラグ名 | 16進数値 | 10進数値 | 対応する[AccountSetのフラグ](accountset.html#accountsetのフラグ) | 説明 |
|
||||
|---------------------|--------------|----------|---------------|-------------------------------|
|
||||
| `lsfAMM`:not_enabled: | `0x00010000` | 33554432 | (なし) | このアカウントは、自動マーケットメーカーのインスタンスです。:not_enabled: |
|
||||
| `lsfDefaultRipple` | `0x00800000` | 8388608 | `asfDefaultRipple` | このアドレスのトラストラインでデフォルトで[rippling](rippling.html)を有効にします。発行アドレスに必要です。他のアドレスでの使用は推奨されません。 |
|
||||
| `lsfDepositAuth` | `0x01000000` | 16777216 | `asfDepositAuth` | このアカウントは、アカウントが送信するトランザクションと、[事前承認された](depositauth.html#事前承認)アカウントからの資金だけを受領します。([DepositAuth](depositauth.html)が有効になっています。) |
|
||||
| `lsfDisableMaster` | `0x00100000` | 1048576 | `asfDisableMaster` | このアカウントのトランザクションの署名にマスターキーを使用することを禁止します。 |
|
||||
@@ -79,20 +78,6 @@ AccountRootオブジェクトには以下のフラグ値を指定できます。
|
||||
| `lsfRequireAuth` | `0x00040000` | 262144 | `asfRequireAuth` | このアカウントは、他のユーザーがこのアカウントのトークンを保有することを個別に承認する必要があります。 |
|
||||
| `lsfRequireDestTag` | `0x00020000` | 131072 | `asfRequireDest` | 受信ペイメントには宛先タグの指定が必要です。 |
|
||||
|
||||
## AMMの特殊なAccountRootオブジェクト
|
||||
|
||||
{% include '_snippets/amm-disclaimer.ja.md' %}
|
||||
|
||||
[自動マーケットメーカー](automated-market-makers.html) (AMM) は、AMMの詳細の一部を追跡するための[AMMオブジェクト][]に加えて、LPトークンを発行しAMMプール内の資産を保持するためにAccountRootオブジェクトを使用します。AMMに関連するAccountRootのアドレスは、AMMが作成される前にユーザーがそのアドレスを特定し資金を提供できないように、ランダム化されています。AMMのAccountRootは、通常のアカウントとは異なり、以下のような設定で作成されます。
|
||||
|
||||
- `lsfAMM` **有効** : これは、AccountRootがAMMの一部であり、通常のアカウントでないことを示します。
|
||||
- `lsfDisableMaster` **有効** : トランザクションへ署名する手段はありません。これにより、誰もそのアカウントを直接操作することができず、トランザクションを送信することができなくなります。
|
||||
- `lsfRequireAuth` **有効** : 事前承認されているアカウントは存在しません。これにより、AMMアカウントに資産を追加する唯一の方法は、[AMMDepositトランザクション][]を使用することであることが保証されます。
|
||||
- `lsfDefaultRipple` **有効** : ユーザー間でAMMのLPトークンを送信したり、取引したりすることが可能になります。
|
||||
|
||||
これらの特殊なアカウントは、[準備金要件](reserves.html)の対象外ですが、AMMのプール内の2つの資産のうちの1つであれば、XRPを保有することができます。
|
||||
|
||||
LPトークンは他の[トークン](tokens.html)と同様に動作しますが、これらのトークンはAMM関連のトランザクションでも使用することができます。AMMの残高や、AMMに影響を与えたトランザクションの履歴は、通常のアカウントと同じように確認することができます。
|
||||
|
||||
## AccountRoot IDのフォーマット
|
||||
|
||||
|
||||
@@ -69,7 +69,6 @@ AccountRoot objects can have the following flag values:
|
||||
|
||||
| Flag Name | Hex Value | Decimal Value | Corresponding [AccountSet Flag](accountset.html#accountset-flags) | Description |
|
||||
|-----------------------------------|--------------|-------------------|-----------------------------------|----|
|
||||
| `lsfAMM` :not_enabled: | `0x02000000` | 33554432 | (None) | This account is an Automated Market Maker instance. :not_enabled: |
|
||||
| `lsfDefaultRipple` | `0x00800000` | 8388608 | `asfDefaultRipple` | Enable [rippling](rippling.html) on this addresses's trust lines by default. Required for issuing addresses; discouraged for others. |
|
||||
| `lsfDepositAuth` | `0x01000000` | 16777216 | `asfDepositAuth` | This account has [DepositAuth](depositauth.html) enabled, meaning it can only receive funds from transactions it sends, and from [preauthorized](depositauth.html#preauthorization) accounts. _(Added by the [DepositAuth amendment][])_ |
|
||||
| `lsfDisableMaster` | `0x00100000` | 1048576 | `asfDisableMaster` | Disallows use of the master key to sign transactions for this account. |
|
||||
@@ -85,22 +84,6 @@ AccountRoot objects can have the following flag values:
|
||||
| `lsfRequireDestTag` | `0x00020000` | 131072 | `asfRequireDest` | Requires incoming payments to specify a Destination Tag. |
|
||||
|
||||
|
||||
## Special AMM AccountRoot Objects
|
||||
|
||||
{% include '_snippets/amm-disclaimer.md' %}
|
||||
|
||||
[Automated Market Makers](automated-market-makers.html) (AMMs) use an AccountRoot object to issue their LP Tokens and hold the assets in the AMM pool, and an [AMM object][] for tracking some of the details of the AMM. The address of an AMM's AccountRoot is randomized so that users cannot identify and fund the address in advance of the AMM being created. Unlike normal accounts, AMM AccountRoot objects are created with the following settings:
|
||||
|
||||
- `lsfAMM` **enabled**. This indicates that the AccountRoot is part of an AMM and is not a regular account.
|
||||
- `lsfDisableMaster` **enabled** and no other means of authorizing transactions. This ensures no one can control the account directly, and it cannot send transactions.
|
||||
- `lsfRequireAuth` **enabled** and no accounts preauthorized. This ensures that the only way to add money to the AMM Account is using the [AMMDeposit transaction][].
|
||||
- `lsfDefaultRipple` **enabled**. This ensures that users can send and trade the AMM's LP Tokens among themselves.
|
||||
|
||||
These special accounts are not subject to the [reserve requirement](reserves.html) but they can hold XRP if it is one of the two assets in the AMM's pool.
|
||||
|
||||
In most other ways, these accounts function like ordinary accounts; the LP Tokens they issue behave like other [tokens](tokens.html) except that those tokens can also be used in AMM-related transactions. You can check an AMM's balances and the history of transactions that affected it the same way you would with a regular account.
|
||||
|
||||
|
||||
## AccountRoot ID Format
|
||||
|
||||
The ID of an AccountRoot object is the [SHA-512Half][] of the following values, concatenated in order:
|
||||
|
||||
@@ -15,14 +15,6 @@ Transactions with `tec` codes destroy the XRP paid as a [transaction cost](trans
|
||||
|
||||
| Code | Value | Explanation |
|
||||
|:---------------------------|:------|:----------------------------------------|
|
||||
| `tecAMM_BALANCE` | 163 |
|
||||
| `tecAMM_DIRECT_PAYMENT` | 169 | The transaction tried to send money directly to an AccountRoot object that is part of an [Automated Market Maker](automated-market-makers.html) (AMM) :not_enabled:. AMM AccountRoot entries cannot send or receive money directly except through [AMMWithdraw][] and [AMMDeposit][] transactions. |
|
||||
| `tecAMM_EXISTS` | 167 | The [AMMCreate transaction][] :not_enabled: tried to create an [Automated Market Maker](automated-market-makers.html) (AMM) instance that already exists. There can only be at most one AMM per unique currency pair. |
|
||||
| `tecAMM_FAILED_DEPOSIT` | 164 | The [AMMDeposit transaction][] :not_enabled: failed, probably because the sender does not have enough of the specified assets, or because the deposit requested an effective price that isn't possible with the available amounts. |
|
||||
| `tecAMM_FAILED_WITHDRAW` | 165 | The [AMMWithdraw transaction][] :not_enabled: failed, probably because the sender does not have enough LP Tokens, or because the withdraw requested an effective price that isn't possible with the available amounts. |
|
||||
| `tecAMM_FAILED_BID` | 168 | The [AMMBid transaction][] :not_enabled: failed, probably because the price to win the auction was higher than the specified maximum value or the sender's current balance. |
|
||||
| `tecAMM_FAILED_VOTE` | 170 | The [AMMVote transaction][] :not_enabled: failed, probably because there are already too many votes from accounts that hold more LP Tokens for this AMM. (This can still recalculate the AMM's trading fee.) |
|
||||
| `tecAMM_INVALID_TOKENS` | 166 | The AMM-related transaction :not_enabled: failed due to insufficient LP Tokens or problems with rounding; for example, depositing a very small amount of assets could fail if the amount of LP Tokens to be returned rounds down to zero. |
|
||||
| `tecCANT_ACCEPT_OWN_NFTOKEN_OFFER` | 157 | The transaction tried to accept an offer that was placed by the same account to buy or sell a [non-fungible token](non-fungible-tokens.html). _(Added by the [NonFungibleTokensV1_1 amendment][].)_ |
|
||||
| `tecCLAIM` | 100 | Unspecified failure, with transaction cost destroyed. |
|
||||
| `tecCRYPTOCONDITION_ERROR` | 146 | This [EscrowCreate][] or [EscrowFinish][] transaction contained a malformed or mismatched crypto-condition. |
|
||||
@@ -61,13 +53,12 @@ Transactions with `tec` codes destroy the XRP paid as a [transaction cost](trans
|
||||
| `tecNO_TARGET` | 138 | The transaction referenced an Escrow or PayChannel ledger object that doesn't exist, either because it never existed or it has already been deleted. (For example, another [EscrowFinish transaction][] has already executed the held payment.) Alternatively, the destination account has `asfDisallowXRP` set so it cannot be the destination of this [PaymentChannelCreate][] or [EscrowCreate][] transaction. |
|
||||
| `tecOBJECT_NOT_FOUND` | 160 | One of the objects specified by this transaction did not exist in the ledger. _(Added by the [NonFungibleTokensV1_1 amendment][].)_ |
|
||||
| `tecOVERSIZE` | 145 | This transaction could not be processed, because the server created an excessively large amount of [metadata](transaction-metadata.html) when it tried to apply the transaction. [New in: rippled 0.29.0-hf1][] |
|
||||
| `tecOWNERS` | 132 | The transaction requires that account sending it has a nonzero "owners count", so the transaction cannot succeed. For example, an account cannot enable the [`lsfRequireAuth`](accountset.html#accountset-flags) flag if it has any trust lines or available offers. |
|
||||
| `tecOWNERS` | 132 | The transaction cannot succeed because the sender already owns objects in the ledger. For example, an account cannot enable the [`lsfRequireAuth`](accountset.html#accountset-flags) flag if it has any trust lines or available offers. |
|
||||
| `tecPATH_DRY` | 128 | The transaction failed because the provided [paths](paths.html) did not have enough liquidity to send anything at all. This could mean that the source and destination accounts are not linked by [trust lines](trust-lines-and-issuing.html). |
|
||||
| `tecPATH_PARTIAL` | 101 | The transaction failed because the provided [paths](paths.html) did not have enough liquidity to send the full amount. |
|
||||
| `tecTOO_SOON` | 152 | The [AccountDelete transaction][] failed because the account to be deleted had a `Sequence` number that is too high. The current ledger index must be at least 256 higher than the account's sequence number. |
|
||||
| `tecUNFUNDED` | 129 | The transaction failed because the account does not hold enough XRP to pay the amount in the transaction _and_ satisfy the additional [reserve](reserves.html) necessary to execute this transaction. |
|
||||
| `tecUNFUNDED_ADD` | 102 | **DEPRECATED.** |
|
||||
| `tecUNFUNDED_AMM` | 162 | The [AMMCreate transaction][] :not_enabled: failed because the sender does not have enough of the specified assets to fund it. |
|
||||
| `tecUNFUNDED_PAYMENT` | 104 | The transaction failed because the sending account is trying to send more XRP than it holds, not counting the [reserve](reserves.html). |
|
||||
| `tecUNFUNDED_OFFER` | 103 | The [OfferCreate transaction][] failed because the account creating the offer does not have any of the `TakerGets` currency. |
|
||||
|
||||
|
||||
@@ -13,8 +13,6 @@ These codes indicate that the transaction was malformed, and cannot succeed acco
|
||||
|
||||
| Code | Explanation |
|
||||
|:------------------------------|:----------------------------------------------|
|
||||
| `temBAD_AMM_OPTIONS` | The AMM-related transaction :not_enabled: specified a combination of parameters that is invalid. |
|
||||
| `temBAD_AMM_TOKENS` | The AMM-related transaction :not_enabled: specified its LP Tokens in an invalid format or specified LP Tokens for the wrong AMM instance. |
|
||||
| `temBAD_AMOUNT` | An amount specified by the transaction (for example the destination `Amount` or `SendMax` values of a [Payment][]) was invalid, possibly because it was a negative number. |
|
||||
| `temBAD_AUTH_MASTER` | The key used to sign this transaction does not match the master key for the account sending it, and the account does not have a [Regular Key](cryptographic-keys.html) set. |
|
||||
| `temBAD_CURRENCY` | The transaction improperly specified a currency field. See [Specifying Currency Amounts][Currency Amount] for the correct format. |
|
||||
@@ -45,8 +43,6 @@ These codes indicate that the transaction was malformed, and cannot succeed acco
|
||||
| `temREDUNDANT` | The transaction would do nothing; for example, it is sending a payment directly to the sending account, or creating an offer to buy and sell the same currency from the same issuer. |
|
||||
| `temREDUNDANT_SEND_MAX` | [Removed in: rippled 0.28.0][] |
|
||||
| `temRIPPLE_EMPTY` | The [Payment transaction][] includes an empty `Paths` field, but paths are necessary to complete this payment. |
|
||||
| `temBAD_AMM_OPTIONS` | The transaction specified an invalid combination of options regarding an [Automated Market Maker](automated-market-makers.html) (AMM). :not_enabled: |
|
||||
| `temBAD_AMM_TOKENS` | The transaction incorrectly specified an [Automated Market Maker](automated-market-makers.html)'s LP Tokens. :not_enabled: |
|
||||
| `temBAD_WEIGHT` | The [SignerListSet transaction][] includes a `SignerWeight` that is invalid, for example a zero or negative value. |
|
||||
| `temBAD_SIGNER` | The [SignerListSet transaction][] includes a signer who is invalid. For example, there may be duplicate entries, or the owner of the SignerList may also be a member. |
|
||||
| `temBAD_QUORUM` | The [SignerListSet transaction][] has an invalid `SignerQuorum` value. Either the value is not greater than zero, or it is more than the sum of all signers in the list. |
|
||||
|
||||
@@ -17,7 +17,6 @@ labels:
|
||||
| `terINSUF_FEE_B` | トランザクションの送信元アカウントに、トランザクションに指定されている`Fee`の支払いに十分なXRPがありません。 |
|
||||
| `terLAST` | 内部使用のみ。通常はこのコードは返されません。 |
|
||||
| `terNO_ACCOUNT` | レジャーのトランザクション送信元アドレスに(まだ)資金が供給されていません。 |
|
||||
| `terNO_AMM` | The AMM-related transaction :not_enabled: specifies an asset pair that does not currently have an AMM instance. <!-- TODO: translate --> |
|
||||
| `terNO_AUTH` | トランザクションでは、`lsfRequireAuth`が有効であるアカウントが発行した通貨を未承認のトラストラインに追加する操作が行われます。たとえば、保有が許可されていない通貨を購入するオファーを出した場合などです。 |
|
||||
| `terNO_LINE` | 内部使用のみ。通常はこのコードは返されません。 |
|
||||
| `terNO_RIPPLE` | 内部使用のみ。通常はこのコードは返されません。 |
|
||||
|
||||
@@ -17,7 +17,6 @@ These codes indicate that the transaction failed, but it could apply successfull
|
||||
| `terINSUF_FEE_B` | The account sending the transaction does not have enough XRP to pay the `Fee` specified in the transaction. |
|
||||
| `terLAST` | Used internally only. This code should never be returned. |
|
||||
| `terNO_ACCOUNT` | The address sending the transaction is not funded in the ledger (yet). |
|
||||
| `terNO_AMM` | The AMM-related transaction :not_enabled: specifies an asset pair that does not currently have an AMM instance. |
|
||||
| `terNO_AUTH` | The transaction would involve adding currency issued by an account with `lsfRequireAuth` enabled to a trust line that is not authorized. For example, you placed an offer to buy a currency you aren't authorized to hold. |
|
||||
| `terNO_LINE` | Used internally only. This code should never be returned. |
|
||||
| `terNO_RIPPLE` | Used internally only. This code should never be returned. |
|
||||
|
||||
@@ -916,12 +916,13 @@ pages:
|
||||
targets:
|
||||
- ja
|
||||
|
||||
- md: concepts/decentralized-exchange/automated-market-makers.md
|
||||
# Redirect AMM concept to separate site for unreleased features
|
||||
- name: Automated Market Makers (AMM)
|
||||
html: automated-market-makers.html
|
||||
template: pagetype-redirect.html.jinja
|
||||
redirect_url: https://opensource.ripple.com/docs/xls-30d-amm/automated-market-makers/
|
||||
targets:
|
||||
- en
|
||||
|
||||
- md: concepts/decentralized-exchange/automated-market-makers.ja.md
|
||||
targets:
|
||||
- ja
|
||||
|
||||
- md: concepts/decentralized-exchange/offers.md
|
||||
|
||||
Reference in New Issue
Block a user